import { r as registerInstance, h, H as Host, a as getElement } from './index-b153bfd0.js';
import { g as getIconPath } from './assets-manager-7d6fc08f.js';
import './mer-animated-dots-7cbae6ef.js';
import 'lit';
import 'lit/directives/when.js';
import 'lit/directives/if-defined.js';
import { L as Locale } from './locale-e5107fad.js';
import { c as config } from './config-5a775b7a.js';
import { r as renderObjectTypeWithIcon } from './constants-ae6a35f5.js';
import { C as COLUMNS_IDS } from './tabular-grid-render-adb3f7e5.js';
import { s as sortTabularGridColumn } from './tabular-grid-column-sort-1d503b27.js';
import './helpers-b443f9e9.js';
import './helpers-102277ef.js';

const bringChangesCss = ".custom-icon-text-wrapper{display:flex;align-items:center;gap:var(--spacing-gap-m)}.warning-error-description{display:flex;align-items:center;gap:var(--spacing-gap-m);padding:var(--spacing-padding-m);max-inline-size:800px;line-height:var(--line-height-spacious)}.warning-error-icon{flex-shrink:0}button.button-secondary{border-color:var(--color-border-neutral-default)}:host{--pill-border-radius:12px;--pill-padding-inline:var(--spacing-padding-m);--pill-padding-block:var(--spacing-padding-xxs);--pill-font-size:var(--font-size-body-s);display:grid;block-size:100%;overflow:auto;grid-template-rows:max-content max-content 1fr}.detail__current-version,.detail__knowledge-base{max-inline-size:250px;min-inline-size:180px}.detail__current-version,.detail__knowledge-base{padding-inline:var(--spacing-padding-xxl);border-inline-end:1px solid var(--color-border-surface-on-elevation-1)}.information__col-1,.detail__genexus-server{padding-inline-end:var(--spacing-padding-xxl);border-inline-end:1px solid var(--color-border-surface-on-elevation-1)}.detail__merge-from-version{padding-inline-start:var(--spacing-padding-xxl)}.section{display:contents}.header{display:grid;gap:var(--spacing-gap-xxl)}.header__detail{display:grid;grid-template-areas:\"detail-title detail-title detail-title detail-title\" \"detail-genexus-server detail-knowledge-base detail-current-version detail-merge-from-version\";row-gap:var(--spacing-gap-xl)}.detail__label{color:var(--color-text-neutral-disabled)}.detail__title{grid-area:detail-title}.detail__commit-name{grid-area:detail-commit-name}.detail__genexus-server{grid-area:detail-genexus-server}.detail__genexus-server>a{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:inline-block}.detail__link{align-items:start;color:var(--color-text-primary-default);text-decoration:underline}.detail__link:hover{color:var(--color-text-primary-hover)}.detail__link:active{color:var(--color-text-primary-pressed)}.detail__knowledge-base{grid-area:detail-knowledge-base}.detail__current-version{grid-area:detail-current-version}.detail__merge-from-version{grid-area:detail-merge-from-version}.header__information{display:grid;row-gap:var(--spacing-gap-m);grid-template-areas:\"information-title information-title\" \"information-col-1 information-col-2\";grid-template-columns:max-content 1fr;grid-template-rows:max-content max-content}.information__title{grid-area:information-title}.information__col-1{grid-area:information-col-1;display:flex;gap:var(--spacing-gap-xxl)}.header__comments .layout__panel{justify-items:start;text-align:left}.controls-container{display:grid;margin-block-start:var(--spacing-padding-xxl)}.filter{grid-template-columns:232px 186px 1fr}.button-merge-checked{margin-inline-start:auto}.main{position:relative;display:grid;overflow:auto}.loader{position:relative;inline-size:100%;block-size:100%;inset-block-start:0}.tabular-grid{border-radius:4px;overflow:hidden}.empty-state{block-size:100%}.loader{--elevation-background-color:var(--color-accent-surface-elevation-1)}.tabular-grid.empty-result::part(main){overflow:hidden}.comments-container{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.button-tertiary.edit-range-button{padding-block:0;align-content:flex-end}.input-comments-container{position:relative}.input-comments{--control-border-color:transparent;padding-block:0 !important;padding-inline:0 !important;--line-height-tight:1.4;block-size:100%;background-color:var(--color-accent-surface-surface);transition:var(--timing-super-fast) block-size, var(--timing-super-fast) background-color, var(--timing-super-fast) padding-block, var(--timing-super-fast) padding-inline}.input-comments:focus{position:absolute;block-size:200px;inline-size:100%;z-index:99;background-color:var(--color-accent-surface-elevation-1);padding-block:var(--control-padding-block) !important;padding-inline:var(--control-padding-inline) !important}ch-tabular-grid-cell.tabular-grid-cell::part(actions-icon){background-size:contain;margin-inline-end:0;--icon-path:var(--icon__gemini-tools_show-more-vertical_neutral--enabled);cursor:pointer}ch-tabular-grid-cell.tabular-grid-cell::part(actions-icon):hover{--icon-path:var(--icon__gemini-tools_show-more-vertical_neutral--hover)}ch-tabular-grid-cell.tabular-grid-cell::part(actions-icon):active{--icon-path:var(--icon__gemini-tools_show-more-vertical_neutral--active)}.tabular-grid-row-actions::part(main),.property-grid-row-actions::part(main){gap:0 !important}.tabular-grid-row-actions>button{justify-content:start}.pill{--pill-background-color:transparent;--pill-color:transparent;--pill-border-color:transparent;background-color:var(--pill-background-color);color:var(--pill-color);border:1px solid var(--pill-border-color);inline-size:100%;padding:var(--pill-padding-block) var(--pill-padding-inline);display:flex;align-items:center;justify-content:center;border-radius:var(--pill-border-radius);position:relative}.pill--to-merge,.pill--to-revert{--pill-background-color:var(--color-accent-neutral-contrast);--pill-color:var(--color-border-primary-default);--pill-border-color:var(--color-accent-primary-pressed)}.pill--to-merge-marked{--pill-background-color:var();--pill-color:var(--color-border-primary-default);--pill-border-color:var()}.pill--pending{--pill-background-color:var(--color-accent-neutral-contrast);--pill-color:var(--color-border-primary-default);--pill-border-color:var(--color-accent-primary-pressed)}.pill--warning{--pill-background-color:var(--color-accent-warning-contrast);--pill-color:var(--color-border-warning-default);--pill-border-color:var(--color-border-warning-default)}.pill--error{--pill-background-color:var(--color-accent-error-contrast);--pill-color:var(--color-border-error-default);--pill-border-color:var(--color-border-error-light)}.pill--merged,.pill--reverted{--pill-background-color:var(--color-accent-success-contrast);--pill-color:var(--color-border-success-default);--pill-border-color:var(--color-accent-success-default)}.pill--transitioning{--pill-color:transparent}.merging-spinner-caption{display:flex;align-items:center;gap:var(--spacing-gap-m);--status-circle-color:transparent;--status-circle-size:$size;--status-circle-inset-inline-start:16px;--pill-color:var(--color-border-primary-default)}.merging-spinner-caption::before{display:inline-block;content:\"\";width:16px;height:16px;border:calc(16px / 7) solid var(--color-accent-primary-pressed);border-top:calc(16px / 7) solid var(--color-border-primary-on-default);border-radius:50%;animation:spin var(--timing-regular) linear infinite}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.tabular-grid .button-secondary{--control-padding-block:var(--pill-padding-block);--control-padding-inline:var(--pill-padding-inline);font-size:inherit;font-weight:inherit;}.tabular-grid .tabular-grid-cell--for-pill{padding-block:0;align-items:center;justify-content:center}.tabular-grid.disabled-custom-selector .tabular-grid-cell::part(selector-label),.tabular-grid.disabled-custom-selector .tabular-grid-column::part(bar-selector),.tabular-grid.disabled-custom-selector .tabular-grid-cell::part(actions-icon){pointer-events:none;opacity:0.5}.tabular-grid-column--settings-custom-selector,.tabular-grid-cell--settings-custom-selector{padding:0}.tabular-grid-cell::part(actions-icon){padding-block:var(--spacing-padding-m)}ch-tabular-grid-cell.tabular-grid-cell::part(actions-icon){block-size:100%;display:block;background-size:16px;padding-inline:var(--spacing-padding-xl)}.tabular-grid-cell.no-checkbox-custom-selector::part(selector-label){visibility:hidden}.tabular-grid-row-actions::part(window){background-color:var(--color-accent-surface-elevation-2) !important}.tabular-grid-row .tabular-grid-cell:nth-child(3){min-inline-size:400px}";

var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
    if (kind === "a" && !f)
        throw new TypeError("Private accessor was defined without a getter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
        throw new TypeError("Cannot read private member from an object whose class did not declare it");
    return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
    if (kind === "m")
        throw new TypeError("Private method is not writable");
    if (kind === "a" && !f)
        throw new TypeError("Private accessor was defined without a setter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
        throw new TypeError("Cannot write private member to an object whose class did not declare it");
    return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _GxIdeTeamDevBringChanges_componentLocale, _GxIdeTeamDevBringChanges_commitLabel, _GxIdeTeamDevBringChanges_comboBoxStatesModel, _GxIdeTeamDevBringChanges_checkedObjectsIdsArray, _GxIdeTeamDevBringChanges_formatComments, _GxIdeTeamDevBringChanges_mergeCheckedClickedHandler, _GxIdeTeamDevBringChanges_mergeSingleObject, _GxIdeTeamDevBringChanges_renderActionCellContent, _GxIdeTeamDevBringChanges_renderCommitsNumbers, _GxIdeTeamDevBringChanges_renderFormatedDate, _GxIdeTeamDevBringChanges_renderObjectStateWithIcon, _GxIdeTeamDevBringChanges_renderObjectsRows, _GxIdeTeamDevBringChanges_rowContextMenuHandler, _GxIdeTeamDevBringChanges_rowMarkingChangedHandler, _GxIdeTeamDevBringChanges_searchInputHandler, _GxIdeTeamDevBringChanges_stateChangedHandler, _GxIdeTeamDevBringChanges_updateFilteredObjects, _GxIdeTeamDevBringChanges_sortTabularGridColumnCallback, _GxIdeTeamDevBringChanges_viewAllCommentsHandler, _GxIdeTeamDevBringChanges_editRangeHandler;
const CSS_BUNDLES = [
    "resets/box-sizing",
    "components/tabular-grid",
    "utils/form--full",
    "utils/layout",
    "utils/typography",
    "utils/spacing",
    "chameleon/scrollbar",
    "components/tooltip"
];
const COMBO_BOX_ALL_VALUE = "all";
const DETAIL_LABEL_CLASSES = "detail__label body-semi-bold-s";
const ADD_ICON = getIconPath({
    category: "system",
    name: "add",
    colorType: "on-surface"
});
const EDITED_ICON = getIconPath({
    category: "system",
    name: "edit",
    colorType: "on-surface"
});
const FILTER_ICON = getIconPath({
    category: "window-tools",
    name: "filter",
    colorType: "on-surface"
});
const SEARCH_ICON = getIconPath({
    category: "system",
    name: "search",
    colorType: "on-surface"
});
const SUBSTRACT_ICON = getIconPath({
    category: "system",
    name: "substract",
    colorType: "on-surface"
});
const WARNING_ICON = getIconPath({
    category: "system",
    name: "warning",
    colorType: "warning"
});
const ERROR_ICON = getIconPath({
    category: "system",
    name: "error",
    colorType: "error"
});
const GxIdeTeamDevBringChanges = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        /**
         * The component hard-coded strings translations.
         */
        // eslint-disable-next-line @stencil-community/own-props-must-be-private
        _GxIdeTeamDevBringChanges_componentLocale.set(this, void 0);
        _GxIdeTeamDevBringChanges_commitLabel.set(this, void 0);
        _GxIdeTeamDevBringChanges_comboBoxStatesModel.set(this, void 0);
        _GxIdeTeamDevBringChanges_checkedObjectsIdsArray.set(this, []);
        _GxIdeTeamDevBringChanges_formatComments.set(this, () => {
            if (this.commitInformation.length === 1) {
                return h("span", null, this.commitInformation[0].comment);
            }
            const firstComment = this.commitInformation[this.commitInformation.length - 1].comment;
            return h("span", null, `${__classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").latest}: ${firstComment}...`);
        });
        _GxIdeTeamDevBringChanges_mergeCheckedClickedHandler.set(this, async () => {
            this.merging = true;
            const newobjectsStatesMap = new Map(this.objectsStatesMap);
            __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_checkedObjectsIdsArray, "f").forEach(checkedObjectId => {
                newobjectsStatesMap.set(checkedObjectId, this.operationType === "revert" ? "reverting" : "merging");
            });
            this.objectsStatesMap = newobjectsStatesMap;
            await this.mergeObjectsCallback(__classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_checkedObjectsIdsArray, "f"));
        });
        _GxIdeTeamDevBringChanges_mergeSingleObject.set(this, objectId => async () => {
            this.merging = true;
            const newobjectsStatesMap = new Map(this.objectsStatesMap);
            newobjectsStatesMap.set(objectId, this.operationType === "revert" ? "reverting" : "merging");
            this.objectsStatesMap = newobjectsStatesMap;
            await this.mergeObjectsCallback([objectId]);
        });
        _GxIdeTeamDevBringChanges_renderActionCellContent.set(this, (actionTaken) => {
            let icon;
            let caption;
            let iconColor;
            if (actionTaken === "Deleted") {
                icon = SUBSTRACT_ICON;
                caption = __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").objects.actions.delete;
                iconColor = "--color-icon-error-default";
            }
            else if (actionTaken === "Inserted") {
                icon = ADD_ICON;
                caption = __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").objects.actions.insert;
                iconColor = "--color-icon-success-default";
            }
            else {
                // modified
                icon = EDITED_ICON;
                caption = __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").objects.actions.modify;
                iconColor = "--color-icon-warning-default";
            }
            return (h("span", { class: "custom-icon-text-wrapper" }, h("ch-image", { type: "mask", class: "icon-s", src: icon, style: { backgroundColor: `var(${iconColor})` } }), `${caption}`));
        });
        _GxIdeTeamDevBringChanges_renderCommitsNumbers.set(this, (onlyNumbers = false) => {
            var _a, _b;
            if (((_a = this.commitInformation) === null || _a === void 0 ? void 0 : _a.length) > 1) {
                // more than one commit
                return onlyNumbers
                    ? `${this.commitInformation[0].id} ... ${this.commitInformation[this.commitInformation.length - 1].id}`
                    : `${__classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_commitLabel, "f")} ${this.commitInformation[0].id} ... ${this.commitInformation[this.commitInformation.length - 1].id}`;
            }
            else if (((_b = this.commitInformation) === null || _b === void 0 ? void 0 : _b.length) === 1) {
                // just one commit
                return onlyNumbers
                    ? this.commitInformation[0].id
                    : `${__classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_commitLabel, "f")} ${this.commitInformation[0].id}`;
            }
            else {
                // Probably commits have not been loaded yet (loading state)
                return onlyNumbers
                    ? `${__classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").loading}`
                    : `${__classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_commitLabel, "f")} ${__classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").loading}`;
            }
        });
        _GxIdeTeamDevBringChanges_renderFormatedDate.set(this, (date) => {
            var _a;
            const dateObject = new Date(date);
            const lang = ((_a = navigator.languages) === null || _a === void 0 ? void 0 : _a[0]) || navigator.language;
            return `${dateObject.toLocaleDateString(lang)} ${dateObject.toLocaleTimeString(lang, {
                hour: "2-digit",
                minute: "2-digit",
                hour12: false
            })}`;
        });
        _GxIdeTeamDevBringChanges_renderObjectStateWithIcon.set(this, (objectType, objectId) => {
            if (objectType === "merging" || objectType === "reverting") {
                return (h("span", { class: "merging-spinner-caption" }, this.operationType === "revert"
                    ? __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").states.reverting
                    : __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").states.merging));
            }
            const classes = `pill pill--${objectType} body-semi-bold-s`;
            if (this.revertPillAsButton &&
                (objectType === "to-merge" ||
                    objectType === "to-merge-marked" ||
                    objectType === "to-revert")) {
                return (h("button", { class: { [classes]: true, "button-secondary": true }, onClick: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_mergeSingleObject, "f").call(this, objectId) }, __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").statesForButton[objectType]));
            }
            else {
                return (h("span", { class: classes }, __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").states[objectType]));
            }
        });
        _GxIdeTeamDevBringChanges_renderObjectsRows.set(this, () => {
            return this.objectsFiltered.map(commitObject => {
                const marked = this.markedObjectsSet.has(commitObject.id);
                const alreadyMerged = this.alreadyMergedObjectsIdsArray.find(checkedObjectId => checkedObjectId === commitObject.id);
                const errorOrWarningMessage = this.commitObjectsMessagesMap.get(commitObject.id);
                const state = this.objectsStatesMap.get(commitObject.id);
                let MESSAGE_ICON;
                if (state === "error") {
                    MESSAGE_ICON = ERROR_ICON;
                }
                else if (state === "warning") {
                    MESSAGE_ICON = WARNING_ICON;
                }
                return (h("ch-tabular-grid-row", { class: "tabular-grid-row", key: commitObject.id, rowid: commitObject.id, ref: (el) => marked && (el === null || el === void 0 ? void 0 : el.setAttribute("marked", "true")) }, h("ch-tabular-grid-cell", { "cell-type": "rich", "row-selector": "true", class: {
                        "tabular-grid-cell": true,
                        "no-checkbox-custom-selector": alreadyMerged
                    }, size: "max-content" }, commitObject.name), h("ch-tabular-grid-cell", { class: "tabular-grid-cell" }, renderObjectTypeWithIcon(commitObject.type)), h("ch-tabular-grid-cell", { class: "tabular-grid-cell" }, commitObject.description), h("ch-tabular-grid-cell", { class: "tabular-grid-cell" }, __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_renderActionCellContent, "f").call(this, commitObject.actionTaken)), h("ch-tabular-grid-cell", { class: "tabular-grid-cell tabular-grid-cell--for-pill" }, __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_renderObjectStateWithIcon, "f").call(this, this.objectsStatesMap.get(commitObject.id), commitObject.id)), errorOrWarningMessage && (h("ch-tabular-grid-rowset", { class: "tabular-grid-rowset" }, h("ch-tabular-grid-rowset-empty", { class: { "tabular-grid-rowset-empty": true, [state]: true } }, h("p", { class: "warning-error-description" }, h("ch-image", { class: "icon-s warning-error-icon", src: MESSAGE_ICON }), errorOrWarningMessage))))));
            });
        });
        _GxIdeTeamDevBringChanges_rowContextMenuHandler.set(this, async (ev) => {
            ev.preventDefault();
            const selectedRowsIds = await this.tabularGridEl.getSelectedRows();
            await this.contextMenuCallback({
                selection: selectedRowsIds,
                clientX: ev.detail.clientX,
                clientY: ev.detail.clientY
            });
        });
        _GxIdeTeamDevBringChanges_rowMarkingChangedHandler.set(this, (event) => {
            const newobjectsMarkedSet = new Set();
            const newobjectsStatesMap = new Map(this.objectsStatesMap);
            const markedRowsIds = event.detail.rowsId;
            const checkedObjectsIgnoringAlreadyMerged = markedRowsIds.filter(markedObjectId => !this.alreadyMergedObjectsIdsArray.includes(markedObjectId));
            __classPrivateFieldSet(this, _GxIdeTeamDevBringChanges_checkedObjectsIdsArray, [...checkedObjectsIgnoringAlreadyMerged], "f");
            // Update markedObjectsSet
            __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_checkedObjectsIdsArray, "f").forEach(checkedObjectId => {
                newobjectsMarkedSet.add(checkedObjectId);
            });
            this.markedObjectsSet = newobjectsMarkedSet;
            this.atLeastOneObjectIsChecked = markedRowsIds.length > 0;
            newobjectsStatesMap.forEach(objectId => {
                const objectCurrentState = this.objectsStatesMap.get(objectId);
                if (objectCurrentState !== "to-merge" &&
                    objectCurrentState !== "to-merge-marked") {
                    return;
                }
                const markedRowIndex = markedRowsIds.findIndex(id => id === objectId);
                if (markedRowIndex !== -1) {
                    newobjectsStatesMap.set(objectId, "to-merge-marked");
                    markedRowsIds.splice(markedRowIndex, 1);
                }
                else {
                    newobjectsStatesMap.set(objectId, "to-merge");
                }
            });
            this.objectsStatesMap = newobjectsStatesMap;
        });
        _GxIdeTeamDevBringChanges_searchInputHandler.set(this, (event) => {
            this.searchValue = event.detail.toLowerCase();
            __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_updateFilteredObjects, "f").call(this);
        });
        _GxIdeTeamDevBringChanges_stateChangedHandler.set(this, (event) => {
            this.stateFilterValue = event.detail;
            __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_updateFilteredObjects, "f").call(this);
        });
        _GxIdeTeamDevBringChanges_updateFilteredObjects.set(this, () => {
            let filteredObjects = [...this.commitObjects];
            // filter by state (ch-combo-box-render) ...
            if (this.stateFilterValue !== "all") {
                filteredObjects = filteredObjects.filter(object => {
                    const objectState = this.objectsStatesMap.get(object.id);
                    return objectState === this.stateFilterValue;
                });
            }
            // and filter by value (ch-edit) as well
            filteredObjects = filteredObjects.filter(object => {
                const includesName = object.name.toLowerCase().includes(this.searchValue);
                const includesType = object.type.name
                    .toLowerCase()
                    .includes(this.searchValue);
                const includesDescription = object.description
                    .toLowerCase()
                    .includes(this.searchValue);
                if (includesName || includesType || includesDescription) {
                    return true;
                }
                return false;
            });
            this.objectsFiltered = filteredObjects;
        });
        _GxIdeTeamDevBringChanges_sortTabularGridColumnCallback.set(this, (e) => {
            const columnId = e.detail.columnId;
            let objectProperty;
            let dateType = "string";
            if (columnId === COLUMNS_IDS.type) {
                objectProperty = "name"; // the type name
                dateType = "object";
            }
            this.objectsFiltered = [
                ...sortTabularGridColumn(e, this.objectsFiltered, dateType, objectProperty)
            ];
        });
        _GxIdeTeamDevBringChanges_viewAllCommentsHandler.set(this, async () => {
            await this.viewAllCommentsCallback();
        });
        _GxIdeTeamDevBringChanges_editRangeHandler.set(this, async () => {
            await this.editRangeCallback();
        });
        this.alreadyMergedObjectsIdsArray = [];
        this.atLeastOneObjectIsChecked = false;
        this.loading = true;
        this.objectsFiltered = [];
        this.searchValue = "";
        this.stateFilterValue = COMBO_BOX_ALL_VALUE;
        this.markedObjectsSet = new Set();
        this.objectsStatesMap = new Map();
        this.commitObjectsMessagesMap = new Map();
        this.merging = false;
        this.commitDetail = undefined;
        this.commitInformation = [];
        this.commitObjects = [];
        this.hideFilters = false;
        this.operationType = "merge";
        this.mergeObjectsCallback = undefined;
        this.revertPillAsButton = false;
        this.contextMenuCallback = undefined;
        this.viewAllCommentsCallback = undefined;
        this.editRangeCallback = undefined;
    }
    objectsStatesMapChanged(newCommitObjectsStateMap) {
        const someObjectIsMerging = [...newCommitObjectsStateMap.entries()].find(([, state]) => state === "merging" || state === "reverting");
        if (!someObjectIsMerging) {
            this.merging = false;
        }
    }
    commitObjectsChanged(newCommitObjects) {
        this.loading = true;
        if (newCommitObjects.length) {
            // This is the first and only objects asignment
            this.loading = false;
            // All commit objects begin as "pending to merge"
            newCommitObjects.forEach(commitObject => {
                this.objectsStatesMap.set(commitObject.id, this.operationType === "revert" ? "to-revert" : "to-merge");
            });
            this.objectsFiltered = this.commitObjects;
        }
    }
    async componentWillLoad() {
        var _a;
        __classPrivateFieldSet(this, _GxIdeTeamDevBringChanges_componentLocale, await Locale.getComponentStrings(this.el), "f");
        __classPrivateFieldSet(this, _GxIdeTeamDevBringChanges_commitLabel, this.commitInformation.length > 1
            ? __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").commmits
            : __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").commmit, "f");
        // Initiate "states" combo box filter
        __classPrivateFieldSet(this, _GxIdeTeamDevBringChanges_comboBoxStatesModel, [
            {
                caption: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").states.all,
                value: COMBO_BOX_ALL_VALUE
            },
            {
                caption: this.operationType === "revert"
                    ? __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").states["to-revert"]
                    : __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").states["to-merge"],
                value: this.operationType === "revert" ? "to-revert" : "to-merge"
            },
            {
                caption: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").states.warning,
                value: "warning"
            },
            {
                caption: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").states.error,
                value: "error"
            },
            {
                caption: this.operationType === "revert"
                    ? __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").states.reverted
                    : __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").states.merged,
                value: this.operationType === "revert" ? "reverted" : "merged"
            }
        ], "f");
        if ((_a = this.commitObjects) === null || _a === void 0 ? void 0 : _a.length) {
            // if commitObjects already set...
            this.commitObjectsChanged(this.commitObjects);
        }
    }
    /**
     * It allows the host updating an object state, by providing the object id.
     * @param objectId The ID of the object to update.
     * @param newState The new state to set on the object.
     * @param message Optional message explaining the change.
     *
     * @example
     * bringChanges.updateObjectState('obj-24', "merging", null);
     * bringChanges.updateObjectState('obj-27', "error", "The server did not respond.");
     */
    async updateObjectState(objectId, newState, message) {
        // update object state
        const newobjectsStatesMap = new Map(this.objectsStatesMap);
        newobjectsStatesMap.set(objectId, newState);
        this.objectsStatesMap = newobjectsStatesMap;
        // add message if state is "warning" or "error"
        if ((message === null || message === void 0 ? void 0 : message.length) > 0) {
            this.commitObjectsMessagesMap.set(objectId, message);
        }
        if (newState === "merged" || newState === "reverted") {
            // remove from checked
            __classPrivateFieldSet(this, _GxIdeTeamDevBringChanges_checkedObjectsIdsArray, __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_checkedObjectsIdsArray, "f").filter(checkedObject => checkedObject !== objectId), "f");
            // add to "already merged". This will hide the checkbox
            this.alreadyMergedObjectsIdsArray.push(objectId);
            // unmark checkbox:
            this.tabularGridEl.markRow(objectId, false);
            // remove message if any
            this.commitObjectsMessagesMap.delete(objectId);
        }
    }
    render() {
        const enableRichRowSelector = this.alreadyMergedObjectsIdsArray.length !== this.commitObjects.length;
        const disableControls = this.merging || this.loading;
        return (h(Host, { class: "widget" }, h("ch-theme", { model: CSS_BUNDLES }), h("section", { class: "section" }, h("header", { class: "header spacing-body-inline spacing-body-block-start" }, h("div", {
            // header details
            class: "header__detail"
        }, h("p", { class: "detail__title subtitle-semi-bold-s" }, this.operationType === "revert"
            ? __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").commitDetail.revertChangesDetail
            : __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").commitDetail.bringChangesDetail), h("div", {
            // genexus server
            class: "detail__genexus-server field field-block"
        }, h("span", { class: DETAIL_LABEL_CLASSES }, __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").commitDetail.genexusServer), h("a", { class: "detail__link body-regular-s", href: this.commitDetail.genexusServer, target: "_blank" }, this.commitDetail.genexusServer)), h("div", {
            // knowledge base
            class: "detail__knowledge-base field field-block"
        }, h("span", { class: DETAIL_LABEL_CLASSES }, __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").commitDetail.knowledgeBase), h("p", { class: "body-regular-s" }, this.commitDetail.knowledgeBase)), h("div", {
            // current version
            class: "detail__current-version field field-block"
        }, h("span", { class: DETAIL_LABEL_CLASSES }, __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").commitDetail.currentVersion), h("a", { class: "body-regular-s" }, this.commitDetail.currentVersion)), (this.operationType === "merge" ||
            this.operationType === "merge-all") && (h("div", {
            // merge from version
            class: "detail__merge-from-version field field-block"
        }, h("span", { class: DETAIL_LABEL_CLASSES }, __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").commitDetail.mergeFromVersion), h("p", { class: "body-regular-s" }, this.commitDetail.mergeFromVersion)))), h("div", {
            // header information
            class: "header__information"
        }, h("p", { class: "information__title subtitle-semi-bold-xs" }, __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").commitInformation.title), h("div", {
            // header information (col-1)
            class: "information__col-1"
        }, h("div", {
            // IDs
            class: "field field-block"
        }, h("span", { class: DETAIL_LABEL_CLASSES }, this.commitInformation.length === 1
            ? __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").commitInformation.id
            : __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").commitInformation.ids), h("p", { class: "body-regular-s" }, __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_renderCommitsNumbers, "f").call(this, true))), this.commitInformation.length === 1 ? (h("div", { class: "field field-block" }, h("span", { class: DETAIL_LABEL_CLASSES }, __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").commitInformation.date), h("p", { class: "body-regular-s" }, __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_renderFormatedDate, "f").call(this, this.commitInformation[0].date)))) : ([
            h("div", { class: "field field-block" }, h("span", { class: DETAIL_LABEL_CLASSES }, __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").commitInformation.from), h("p", { class: "body-regular-s" }, __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_renderFormatedDate, "f").call(this, this.commitInformation[0].date))),
            h("div", { class: "field field-block" }, h("span", { class: DETAIL_LABEL_CLASSES }, __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").commitInformation.to), h("p", { class: "body-regular-s" }, __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_renderFormatedDate, "f").call(this, this.commitInformation[this.commitInformation.length - 1].date))),
            this.operationType === "merge-all" && (h("button", { class: "button-tertiary button-icon-and-text body-semi-bold-s edit-range-button", type: "button", onClick: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_editRangeHandler, "f") }, h("ch-image", { class: "icon-m", src: EDITED_ICON, type: "mask" }), __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").buttons.editRange))
        ]))), h("div", { class: "header__comments" }, h("div", { class: "layout layout--cols-2-1" }, h("div", { class: "layout__panel" }, h("div", { class: "field field-block" }, h("label", { class: DETAIL_LABEL_CLASSES, htmlFor: "commit-comments" }, this.commitInformation.length > 1
            ? `${__classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").commitInformation.comments} (${this.commitInformation.length})`
            : __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").commitInformation.comment), h("p", { class: "body-regular-s comments-container" }, __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_formatComments, "f").call(this))), h("button", { class: "button-tertiary body-semi-bold-s", type: "button", onClick: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_viewAllCommentsHandler, "f") }, this.commitInformation.length > 1
            ? __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").buttons.viewAllComments.replace("{{commentsCount}}", this.commitInformation.length.toString())
            : __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").buttons.viewComment))))), h("div", { class: {
                "field-group": true,
                "controls-container": true,
                "filter": !this.hideFilters,
                "spacing-body-inline": true
            } }, !this.hideFilters && [
            h("ch-edit", { class: "input", disabled: disableControls, startImgSrc: SEARCH_ICON, placeholder: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").filter.searchPlaceholder, type: "search", onInput: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_searchInputHandler, "f") }),
            h("ch-combo-box-render", { class: "combo-box", disabled: disableControls, model: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_comboBoxStatesModel, "f"), value: this.stateFilterValue, onInput: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_stateChangedHandler, "f"), placeholder: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").filter.statePlaceholder })
        ], h("button", { class: "button-primary button-merge-checked", disabled: !this.atLeastOneObjectIsChecked || disableControls, onClick: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_mergeCheckedClickedHandler, "f") }, this.operationType === "revert"
            ? __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").filter.revertSelected
            : __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").filter.mergeSelected)), h("div", { class: "main spacing-body" }, this.commitObjects.length ? (h("ch-tabular-grid", { class: {
                "tabular-grid": true,
                "objects-tabular-grid": true,
                "disabled-custom-selector": this.merging,
                "empty-result": this.objectsFiltered.length === 0
            }, keyboardNavigationMode: "focus", rowSelectionMode: "multiple", onRowMarkingChanged: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_rowMarkingChangedHandler, "f"), onRowContextMenu: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_rowContextMenuHandler, "f"), ref: (el) => (this.tabularGridEl = el) }, h("ch-tabular-grid-columnset", { class: "tabular-grid-column-set" }, h("ch-tabular-grid-column", { class: "tabular-grid-column", columnId: COLUMNS_IDS.name, columnName: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").objects.name, columnType: "rich", richRowSelector: enableRichRowSelector, richRowSelectorMode: "mark", settingable: false, sortable: true, onColumnSortChanged: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_sortTabularGridColumnCallback, "f"), size: "max-content" }), h("ch-tabular-grid-column", { class: "tabular-grid-column", columnId: COLUMNS_IDS.type, columnName: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").objects.type, settingable: false, sortable: true, onColumnSortChanged: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_sortTabularGridColumnCallback, "f"), size: "max-content" }), h("ch-tabular-grid-column", { class: "tabular-grid-column", columnId: COLUMNS_IDS.description, columnName: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").objects.description, settingable: false, sortable: true, onColumnSortChanged: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_sortTabularGridColumnCallback, "f"), size: config.tabularGrid.colSize.description }), h("ch-tabular-grid-column", { class: "tabular-grid-column", columnId: COLUMNS_IDS.action, columnName: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").objects.action, settingable: false, sortable: false, size: "max-content" }), h("ch-tabular-grid-column", {
            // size of this column should the enough for the largest pill, and no more.
            // this prevents layout shifts when pills state changes.
            class: "tabular-grid-column", columnId: COLUMNS_IDS.status, columnName: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").objects.status, settingable: false, sortable: false, size: "100px"
        })), __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_renderObjectsRows, "f").call(this), h("ch-tabular-grid-rowset", { class: "tabular-grid-rowset" }, this.objectsFiltered.length === 0 && (h("ch-tabular-grid-rowset-empty", null, h("gx-ide-empty-state", { class: "empty-state", isAnimated: true, stateIconSrc: FILTER_ICON, stateTitle: "No object matched your filter" })))))) : (h("gx-ide-loader", { cancelLabel: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").loader.cancelLabel, loaderTitle: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").loader.title, description: __classPrivateFieldGet(this, _GxIdeTeamDevBringChanges_componentLocale, "f").loader.description, show: true, class: "loader" }))))));
    }
    static get assetsDirs() { return ["gx-ide-assets/team-dev-bring-changes"]; }
    get el() { return getElement(this); }
    static get watchers() { return {
        "objectsStatesMap": ["objectsStatesMapChanged"],
        "commitObjects": ["commitObjectsChanged"]
    }; }
};
_GxIdeTeamDevBringChanges_componentLocale = new WeakMap(), _GxIdeTeamDevBringChanges_commitLabel = new WeakMap(), _GxIdeTeamDevBringChanges_comboBoxStatesModel = new WeakMap(), _GxIdeTeamDevBringChanges_checkedObjectsIdsArray = new WeakMap(), _GxIdeTeamDevBringChanges_formatComments = new WeakMap(), _GxIdeTeamDevBringChanges_mergeCheckedClickedHandler = new WeakMap(), _GxIdeTeamDevBringChanges_mergeSingleObject = new WeakMap(), _GxIdeTeamDevBringChanges_renderActionCellContent = new WeakMap(), _GxIdeTeamDevBringChanges_renderCommitsNumbers = new WeakMap(), _GxIdeTeamDevBringChanges_renderFormatedDate = new WeakMap(), _GxIdeTeamDevBringChanges_renderObjectStateWithIcon = new WeakMap(), _GxIdeTeamDevBringChanges_renderObjectsRows = new WeakMap(), _GxIdeTeamDevBringChanges_rowContextMenuHandler = new WeakMap(), _GxIdeTeamDevBringChanges_rowMarkingChangedHandler = new WeakMap(), _GxIdeTeamDevBringChanges_searchInputHandler = new WeakMap(), _GxIdeTeamDevBringChanges_stateChangedHandler = new WeakMap(), _GxIdeTeamDevBringChanges_updateFilteredObjects = new WeakMap(), _GxIdeTeamDevBringChanges_sortTabularGridColumnCallback = new WeakMap(), _GxIdeTeamDevBringChanges_viewAllCommentsHandler = new WeakMap(), _GxIdeTeamDevBringChanges_editRangeHandler = new WeakMap();
GxIdeTeamDevBringChanges.style = bringChangesCss;

export { GxIdeTeamDevBringChanges as gx_ide_team_dev_bring_changes };

//# sourceMappingURL=gx-ide-team-dev-bring-changes.entry.js.map