Liferay.Loader.define("layout-content-page-editor-web@2.0.166/page_editor/app/utils/getLayoutDataItemLabel", ['module', 'exports', 'require', '../config/constants/layoutDataItemTypeLabels', '../config/constants/layoutDataItemTypes'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = getLayoutDataItemLabel;

    var _layoutDataItemTypeLabels = require("../config/constants/layoutDataItemTypeLabels");

    var _layoutDataItemTypes = require("../config/constants/layoutDataItemTypes");

    /**
     * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
     * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
     */
    function getLayoutDataItemLabel(item, fragmentEntryLinks) {
      if (item.type === _layoutDataItemTypes.LAYOUT_DATA_ITEM_TYPES.fragment && item.config && item.config.fragmentEntryLinkId && fragmentEntryLinks[item.config.fragmentEntryLinkId]) {
        return fragmentEntryLinks[item.config.fragmentEntryLinkId].name;
      }

      var itemTypeKey = Object.keys(_layoutDataItemTypes.LAYOUT_DATA_ITEM_TYPES).find(function (key) {
        return _layoutDataItemTypes.LAYOUT_DATA_ITEM_TYPES[key] === item.type;
      });

      if (itemTypeKey in _layoutDataItemTypeLabels.LAYOUT_DATA_ITEM_TYPE_LABELS) {
        return _layoutDataItemTypeLabels.LAYOUT_DATA_ITEM_TYPE_LABELS[itemTypeKey];
      }

      return item.type;
    }
    //# sourceMappingURL=getLayoutDataItemLabel.js.map
  }
});
//# sourceMappingURL=getLayoutDataItemLabel.js.map