Liferay.Loader.define("commerce-frontend-js@3.0.43/components/data_renderers/TooltipPriceRenderer", ['module', 'exports', 'require', '@frontend-taglib-clay$clayui/icon', '@frontend-taglib-clay$clayui/tooltip', 'frontend-js-react-web$prop-types', 'frontend-js-react-web$react'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = void 0;

    var _icon = _interopRequireDefault(require("@frontend-taglib-clay$clayui/icon"));

    var _tooltip = require("@frontend-taglib-clay$clayui/tooltip");

    var _propTypes = _interopRequireDefault(require("frontend-js-react-web$prop-types"));

    var _react = _interopRequireDefault(require("frontend-js-react-web$react"));

    function _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { default: obj };
    }

    /**
     * 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 TooltipTable(props) {
      return (/*#__PURE__*/_react.default.createElement("div", {
          className: "bg-dark"
        }, /*#__PURE__*/_react.default.createElement("table", {
          className: "tooltip-table"
        }, /*#__PURE__*/_react.default.createElement("tbody", null, props.value.details.map(function (detail, i) {
          return (/*#__PURE__*/_react.default.createElement("tr", {
              key: i
            }, /*#__PURE__*/_react.default.createElement("td", {
              className: "table-column-text-start"
            }, detail.label), /*#__PURE__*/_react.default.createElement("td", {
              className: "table-column-text-end"
            }, Array.isArray(detail.value) ? detail.value.join(' | ') : detail.value))
          );
        }), /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", {
          className: "table-column-text-start"
        }, props.value.final.label || Liferay.Language.get('final-price')), /*#__PURE__*/_react.default.createElement("td", {
          className: "table-column-text-end"
        }, props.value.final.value)))))
      );
    }

    function TooltipPriceRenderer(props) {
      if (!props.value) {
        return null;
      }

      return (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, props.value.final.value, props.value.details && /*#__PURE__*/_react.default.createElement(_tooltip.ClayTooltipProvider, {
          contentRenderer: function contentRenderer() {
            return (/*#__PURE__*/_react.default.createElement(TooltipTable, props)
            );
          },
          delay: 0
        }, /*#__PURE__*/_react.default.createElement("span", {
          className: "tooltip-provider",
          title: Liferay.Language.get('price-summary')
        }, /*#__PURE__*/_react.default.createElement(_icon.default, {
          symbol: "info-circle"
        }))))
      );
    }

    var _default = TooltipPriceRenderer;
    exports.default = _default;
    //# sourceMappingURL=TooltipPriceRenderer.js.map
  }
});
//# sourceMappingURL=TooltipPriceRenderer.js.map