var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/plus/salesSdk/adjustTime/components/AdjustTimeActionList.tsx
var AdjustTimeActionList_exports = {};
__export(AdjustTimeActionList_exports, {
  AdjustTimeActionList: () => AdjustTimeActionList
});
module.exports = __toCommonJS(AdjustTimeActionList_exports);
var import_react = __toESM(require("react"));
var import_antd = require("antd");
var import_classnames = __toESM(require("classnames"));
var import_time = require("../utils/time");
var import_i18n = require("../i18n");
var formatMoney = (value, currencySymbol) => `${currencySymbol}${Number(value || 0).toFixed(2)}`;
var fillDuration = (template, minutes) => template.replace("{duration}", (0, import_i18n.formatDurationI18n)(Number(minutes || 0)));
var getProductHelpText = (product) => {
  if (product.unlimited) {
    return (0, import_i18n.t)("pisell2.adjust-time.help.product-unlimited-fallback");
  }
  return fillDuration(
    (0, import_i18n.t)("pisell2.adjust-time.help.product-fixed-fallback"),
    product.minMinutes || product.unitMinutes || product.maxMinutes
  );
};
var HelpTip = ({ title }) => {
  if (!title) return null;
  return /* @__PURE__ */ import_react.default.createElement(import_antd.Tooltip, { title: /* @__PURE__ */ import_react.default.createElement("div", { style: { whiteSpace: "pre-wrap" } }, title) }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-adjust-time__help" }, "?"));
};
var AdjustTimeActionList = ({
  booking,
  products,
  activeAction,
  currencySymbol,
  onActionChange
}) => {
  const start = (0, import_time.toDate)(booking.start);
  const end = (0, import_time.toDate)(booking.end);
  return /* @__PURE__ */ import_react.default.createElement("aside", { className: "pisell-adjust-time__rail" }, /* @__PURE__ */ import_react.default.createElement("section", { className: "pisell-adjust-time__booking-card" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-adjust-time__product-head" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-adjust-time__venue-cover", "aria-label": (0, import_i18n.t)("pisell2.adjust-time.venue-cover") }, booking.cover ? /* @__PURE__ */ import_react.default.createElement("img", { src: booking.cover, alt: "" }) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("span", null), /* @__PURE__ */ import_react.default.createElement("span", null), /* @__PURE__ */ import_react.default.createElement("span", null), /* @__PURE__ */ import_react.default.createElement("span", null))), /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement("h1", { className: "pisell-adjust-time__title" }, booking.title), booking.id != null && /* @__PURE__ */ import_react.default.createElement("p", { className: "pisell-adjust-time__meta" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-adjust-time__meta-label" }, (0, import_i18n.t)("pisell2.adjust-time.booking-id")), /* @__PURE__ */ import_react.default.createElement("strong", null, booking.id)))), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-adjust-time__was-block" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-adjust-time__was-label" }, (0, import_i18n.t)("pisell2.adjust-time.was")), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-adjust-time__was-time" }, /* @__PURE__ */ import_react.default.createElement("span", null, (0, import_time.formatTime)(start), "-", (0, import_time.formatTime)(end)), /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-adjust-time__pill-ended" }, (0, import_i18n.t)("pisell2.adjust-time.ended"))), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-adjust-time__was-time pisell-adjust-time__was-date" }, (0, import_time.formatDate)(start)))), /* @__PURE__ */ import_react.default.createElement("nav", { className: "pisell-adjust-time__actions", "aria-label": (0, import_i18n.t)("pisell2.adjust-time.actions-aria") }, /* @__PURE__ */ import_react.default.createElement("button", { type: "button", className: (0, import_classnames.default)("pisell-adjust-time__action", { "pisell-adjust-time__action--active": activeAction === "payOvertime" }), onClick: () => onActionChange("payOvertime") }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-adjust-time__icon pisell-adjust-time__icon--glyph" }, "◷"), /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-adjust-time__action-main" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-adjust-time__action-label" }, (0, import_i18n.t)("pisell2.adjust-time.pay-overtime"))), /* @__PURE__ */ import_react.default.createElement(HelpTip, { title: (0, import_i18n.t)("pisell2.adjust-time.help.pay-overtime") })), products.map((product, index) => /* @__PURE__ */ import_react.default.createElement("button", { key: product.id, type: "button", className: (0, import_classnames.default)("pisell-adjust-time__action", { "pisell-adjust-time__action--active": activeAction === `product:${product.id}` }), onClick: () => onActionChange(`product:${product.id}`) }, /* @__PURE__ */ import_react.default.createElement("span", { className: (0, import_classnames.default)("pisell-adjust-time__icon", `pisell-adjust-time__icon--${index % 4}`) }, product.unlimited ? "Day" : `${product.minMinutes || 0}m`), /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-adjust-time__action-main" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-adjust-time__action-label" }, product.title), /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-adjust-time__action-price" }, formatMoney(product.price, currencySymbol))), /* @__PURE__ */ import_react.default.createElement(HelpTip, { title: getProductHelpText(product) }))), /* @__PURE__ */ import_react.default.createElement("button", { type: "button", className: (0, import_classnames.default)("pisell-adjust-time__action", { "pisell-adjust-time__action--active": activeAction === "manualDuration" }), onClick: () => onActionChange("manualDuration") }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-adjust-time__icon pisell-adjust-time__icon--dim pisell-adjust-time__icon--glyph" }, "⌁"), /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-adjust-time__action-main" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-adjust-time__action-label" }, (0, import_i18n.t)("pisell2.adjust-time.manual-add-time"))), /* @__PURE__ */ import_react.default.createElement(HelpTip, { title: (0, import_i18n.t)("pisell2.adjust-time.help.manual-add-time") })), /* @__PURE__ */ import_react.default.createElement("button", { type: "button", className: (0, import_classnames.default)("pisell-adjust-time__action", { "pisell-adjust-time__action--active": activeAction === "restart" }), onClick: () => onActionChange("restart") }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-adjust-time__icon pisell-adjust-time__icon--dim pisell-adjust-time__icon--glyph" }, "⟳"), /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-adjust-time__action-main" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-adjust-time__action-label" }, (0, import_i18n.t)("pisell2.adjust-time.restart"))), /* @__PURE__ */ import_react.default.createElement(HelpTip, { title: (0, import_i18n.t)("pisell2.adjust-time.help.restart") }))));
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  AdjustTimeActionList
});
