function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
/**
 * 预约页拆出的轻量子组件（无业务数据请求）：
 * - `RecordBoardBodyViewCapture`：同步 bodyView 到 ref，并可通知宿主；
 * - `ScheduleSyncOnFloorEnter`：从表格回到平面图/日历、或从日历回到平面图时，用当前营业日 patch 列表时间窗口；
 * - `PisellReservationToolbarTabs`：平面图/日历为日程带 + Segmented；表格 / 资源墙不展示日程带，仅 extraTabs；
 * - `ReservationGridTopRight` / `PisellReservationScheduleEndActions` / `ReservationFloorMapCanvasTabsTrailing`：工具栏与画布尾区。
 */
import React, { useEffect, useMemo, useRef } from 'react';
import dayjs from 'dayjs';
import { locales } from '@pisell/utils';
import { CheckOutlined, EditOutlined } from '@ant-design/icons';
import { Button, Segmented, Select } from 'antd';
import { PisellReservationScheduleBand, useRecordBoardContext, useRecordBoardShellBodyMeta } from '@pisell/materials';
import { mergeSearchParamsBookingWindow, stripCalendarOnlyFlags } from "../data/reservationDataUtils";
import { I18N_AT_CURRENT_TIME, I18N_AT_CURRENT_TIME_SHORT, I18N_EDIT_MAP, I18N_EDIT_MAP_DONE, I18N_GO_CURRENT, I18N_NEW, I18N_NON_CURRENT_HINT, I18N_PAGE_TITLE, I18N_PAGE_TITLE_VENUE, I18N_VIEW_FLOOR, I18N_VIEW_GRID, I18N_VIEW_CALENDAR, I18N_VIEW_RESOURCE_WALL, I18N_CALENDAR_RESOURCE, I18N_CALENDAR_DAY, I18N_CALENDAR_WEEK, I18N_CALENDAR_MONTH, PISELL_RESERVATION_PHONE_TIME_AXIS_CELL_PX, PISELL_RESERVATION_PHONE_TIME_NAVIGATOR_HEIGHT_PX, RESERVATION_TIMELINE_BUSINESS_RANGE } from "../reservationConstants";
import { ReservationFloorMapDockAppearanceToggle } from "./ReservationFloorMapDockAppearanceToggle";

/** 无 UI：将 RecordBoard Context 中的 `bodyView` 写入 ref，并可选通知宿主（如预约页按视图切换 booking 的 form_record_ids） */
export function RecordBoardBodyViewCapture(props) {
  var _useRecordBoardContex = useRecordBoardContext(),
    bodyView = _useRecordBoardContex.bodyView;
  useEffect(function () {
    var _props$onBodyViewChan;
    props.bodyViewRef.current = bodyView;
    (_props$onBodyViewChan = props.onBodyViewChange) === null || _props$onBodyViewChan === void 0 || _props$onBodyViewChan.call(props, bodyView);
  }, [bodyView, props.bodyViewRef, props.onBodyViewChange]);
  return null;
}

/**
 * 视图切换时统一收敛 `floorDayBookingData.searchParams`：
 * - 从 grid / 任意非视图区切到 floorMap / calendar / resourceWall 时，锚定当前营业日单日窗；
 * - 从 calendar / resourceWall 切回 floorMap 时，除锚定单日窗外，必须清掉 calendar 周/月视图写入的
 *   `compact_fields` / `enable_remote_memory_cache`（否则 osServer 在非今日锚定下会走 compact with，
 *    booking 缺失 resources，平面图合并落空）；
 * - 从 calendar 切到 grid / resourceWall 时，单独清 calendar-only flags，避免之后再切回 floorMap 时残留。
 *
 * 注意：此组件必须常驻挂载（放在 `<PisellRecordBoard>` 内、`<ShellFrame>` 外），
 * 否则 ShellFrame 会按 bodyView 条件渲染 children，导致它只在 grid 视图下挂载而无法观测到切换事件。
 */
export function ScheduleSyncOnFloorEnter(props) {
  var _useRecordBoardContex2 = useRecordBoardContext(),
    bodyView = _useRecordBoardContex2.bodyView;
  var prevRef = useRef(null);
  useEffect(function () {
    var prev = prevRef.current;
    if (props.isInternalListData && (bodyView === 'floorMap' || bodyView === 'calendar' || bodyView === 'resourceWall') && prev !== null && prev !== 'floorMap' && prev !== 'calendar' && prev !== 'resourceWall') {
      props.patchSearchParams(function (p) {
        return stripCalendarOnlyFlags(mergeSearchParamsBookingWindow(p, props.schedule.date, props.operatingDayBoundary, props.timelineRange, dayjs()));
      });
    }
    if (props.isInternalListData && (prev === 'calendar' || prev === 'resourceWall') && bodyView === 'floorMap') {
      props.patchSearchParams(function (p) {
        return stripCalendarOnlyFlags(mergeSearchParamsBookingWindow(p, props.schedule.date, props.operatingDayBoundary, props.timelineRange, dayjs()));
      });
    }
    /**
     * 从 calendar 切到 grid / resourceWall：
     * - resourceWall 与 floorMap 共用 `floorDayBookingData`，必须同时收敛回**锚定营业日单日窗**，
     *   否则会残留 calendar 周/月视口的 `booking_time_start_between`；
     * - grid 视图用的是独立的 `gridBookingData`，这里调整的是 `floorDayBookingData.searchParams`，
     *   不会影响 grid 当前展示；好处是之后再切回 floorMap/resourceWall/calendar 时状态一致。
     */
    if (props.isInternalListData && prev === 'calendar' && (bodyView === 'grid' || bodyView === 'resourceWall')) {
      props.patchSearchParams(function (p) {
        return stripCalendarOnlyFlags(mergeSearchParamsBookingWindow(p, props.schedule.date, props.operatingDayBoundary, props.timelineRange, dayjs()));
      });
    }
    prevRef.current = bodyView;
  }, [bodyView, props.schedule.date.valueOf(), props.isInternalListData, props.patchSearchParams, props.schedule.date, props.operatingDayBoundary, props.timelineRange]);
  return null;
}
function useReservationBodyViewToggleState() {
  var _shellMeta$hasGridCon;
  var _useRecordBoardContex3 = useRecordBoardContext(),
    bodyViewSwitchable = _useRecordBoardContex3.bodyViewSwitchable;
  var shellMeta = useRecordBoardShellBodyMeta();
  var hasGrid = (_shellMeta$hasGridCon = shellMeta === null || shellMeta === void 0 ? void 0 : shellMeta.hasGridContent) !== null && _shellMeta$hasGridCon !== void 0 ? _shellMeta$hasGridCon : true;
  var hasFloor = shellMeta === null || shellMeta === void 0 ? void 0 : shellMeta.hasFloorMapSlot;
  var hasCalendar = shellMeta === null || shellMeta === void 0 ? void 0 : shellMeta.hasCalendarSlot;
  var hasResourceWall = shellMeta === null || shellMeta === void 0 ? void 0 : shellMeta.hasResourceWallSlot;
  var floorForToggle = shellMeta === null || shellMeta === void 0 ? void 0 : shellMeta.effectiveFloorMapProps;
  var canFloor = Boolean(hasFloor && floorForToggle != null);
  var canCalendar = Boolean(hasCalendar);
  var canResourceWall = Boolean(hasResourceWall);
  var bodyViewOptionCount = (hasGrid ? 1 : 0) + (canFloor ? 1 : 0) + (canCalendar ? 1 : 0) + (canResourceWall ? 1 : 0);
  var allowBodyViewToggle = bodyViewOptionCount >= 2 && bodyViewSwitchable !== false;
  var bodyViewSegmentedOptions = useMemo(function () {
    var opts = [];
    if (canFloor) {
      opts.push({
        label: locales.getText(I18N_VIEW_FLOOR),
        value: 'floorMap'
      });
    }
    if (canCalendar) {
      opts.push({
        label: locales.getText(I18N_VIEW_CALENDAR),
        value: 'calendar'
      });
    }
    if (canResourceWall) {
      opts.push({
        label: locales.getText(I18N_VIEW_RESOURCE_WALL),
        value: 'resourceWall'
      });
    }
    if (hasGrid) {
      opts.push({
        label: locales.getText(I18N_VIEW_GRID),
        value: 'grid'
      });
    }
    return opts;
  }, [canFloor, canCalendar, canResourceWall, hasGrid]);
  return {
    allowBodyViewToggle: allowBodyViewToggle,
    bodyViewSegmentedOptions: bodyViewSegmentedOptions
  };
}
export function ReservationMobileToolbarBodyViewSelect() {
  var _useRecordBoardContex4 = useRecordBoardContext(),
    bodyView = _useRecordBoardContex4.bodyView,
    setBodyView = _useRecordBoardContex4.setBodyView;
  var _useReservationBodyVi = useReservationBodyViewToggleState(),
    allowBodyViewToggle = _useReservationBodyVi.allowBodyViewToggle,
    bodyViewSegmentedOptions = _useReservationBodyVi.bodyViewSegmentedOptions;
  if (!allowBodyViewToggle) return null;
  if (bodyView !== 'grid' && bodyView !== 'resourceWall') return null;
  return /*#__PURE__*/React.createElement(Select, {
    className: "pisell-reservation-mobile-toolbar-body-view-select",
    popupClassName: "pisell-reservation-body-view-select-dropdown",
    popupMatchSelectWidth: false,
    size: "small",
    value: bodyView,
    onChange: function onChange(v) {
      return setBodyView(v);
    },
    options: bodyViewSegmentedOptions.map(function (o) {
      return {
        label: o.label,
        value: o.value
      };
    })
  });
}

/**
 * 顶栏 tabs：**仅平面图、日历**下为日程带 + 时间轴 + 标题旁切换；表格 / 资源墙不展示 ScheduleBand，
 * 切换器由 RecordBoard 工具栏顶行承担（表格态在 Find 左侧；资源墙无 Find 时在顶行左侧），与历史行为一致。
 */
export function PisellReservationToolbarTabs(props) {
  var _props$calendarGranul, _props$scheduleProps, _props$timeNavigatorP, _props$timeNavigatorP2, _props$timeNavigatorP5, _props$timeNavigatorP6, _props$timeNavigatorP7, _props$timeNavigatorP8, _props$timeNavigatorP9, _props$timeNavigatorP10, _props$timeNavigatorP11;
  var _useRecordBoardContex5 = useRecordBoardContext(),
    bodyView = _useRecordBoardContex5.bodyView,
    setBodyView = _useRecordBoardContex5.setBodyView;
  var _useReservationBodyVi2 = useReservationBodyViewToggleState(),
    allowBodyViewToggle = _useReservationBodyVi2.allowBodyViewToggle,
    bodyViewSegmentedOptions = _useReservationBodyVi2.bodyViewSegmentedOptions;
  if (bodyView === 'grid') {
    return props.extraTabs ? /*#__PURE__*/React.createElement(React.Fragment, null, props.extraTabs) : null;
  }
  if (bodyView === 'resourceWall') {
    return props.extraTabs ? /*#__PURE__*/React.createElement(React.Fragment, null, props.extraTabs) : null;
  }
  var segmentedSize = props.phoneLayout ? 'middle' : 'large';

  /** 手机布局：深色顶栏 Segmented 改为下拉，避免多 Tab 挤爆 */
  var bodyViewToggle = allowBodyViewToggle ? props.phoneLayout ? /*#__PURE__*/React.createElement(Select, {
    className: "pisell-reservation-body-view-select",
    popupClassName: "pisell-reservation-body-view-select-dropdown",
    popupMatchSelectWidth: false,
    size: "middle",
    value: bodyView,
    onChange: function onChange(v) {
      return setBodyView(v);
    },
    options: bodyViewSegmentedOptions.map(function (o) {
      return {
        label: o.label,
        value: o.value
      };
    })
  }) : /*#__PURE__*/React.createElement(Segmented, {
    className: "pisell-reservation-body-view-segmented",
    size: segmentedSize,
    value: bodyView,
    onChange: function onChange(v) {
      return setBodyView(v);
    },
    options: bodyViewSegmentedOptions
  }) : null;
  var scheduleStartMerged = /*#__PURE__*/React.createElement("div", {
    className: "pisell-reservation-schedule-start-merge"
  }, props.scheduleStartSlot, bodyViewToggle);

  /**
   * 手机布局：把「不在当前时间 + Go to current time」两个元素合并成一颗胶囊，
   * 节省一行高度；桌面保留原双元素结构。
   */
  var afterDateSlot = /*#__PURE__*/React.createElement("div", {
    className: "pisell-reservation-follow-time-slot"
  }, props.phoneLayout ? props.followWallClock ? /*#__PURE__*/React.createElement("span", {
    className: "pisell-reservation-follow-current-chip pisell-reservation-follow-current-chip--on",
    "aria-live": "polite",
    "aria-label": locales.getText(I18N_AT_CURRENT_TIME)
  }, /*#__PURE__*/React.createElement("span", {
    className: "pisell-reservation-follow-current-chip-dot"
  }), /*#__PURE__*/React.createElement("span", {
    className: "pisell-reservation-follow-current-chip-label"
  }, locales.getText(I18N_AT_CURRENT_TIME_SHORT))) : /*#__PURE__*/React.createElement("button", {
    type: "button",
    className: "pisell-reservation-follow-current-chip pisell-reservation-follow-current-chip--off",
    onClick: props.onFollowWallClockToggle,
    "aria-pressed": false,
    "aria-label": locales.getText(I18N_GO_CURRENT)
  }, /*#__PURE__*/React.createElement("span", {
    className: "pisell-reservation-follow-current-chip-label"
  }, locales.getText(I18N_GO_CURRENT))) : props.followWallClock ? /*#__PURE__*/React.createElement("span", {
    className: "pisell-reservation-follow-time-hint pisell-reservation-follow-time-hint--at-current",
    "aria-live": "polite"
  }, locales.getText(I18N_AT_CURRENT_TIME)) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
    className: "pisell-reservation-follow-time-hint pisell-reservation-follow-time-hint--off-current",
    "aria-live": "polite"
  }, locales.getText(I18N_NON_CURRENT_HINT)), /*#__PURE__*/React.createElement("button", {
    type: "button",
    className: "pisell-reservation-follow-current-btn pisell-reservation-follow-current-btn--go-current",
    onClick: props.onFollowWallClockToggle,
    "aria-pressed": false
  }, /*#__PURE__*/React.createElement("span", {
    className: "pisell-reservation-follow-current-btn-label"
  }, locales.getText(I18N_GO_CURRENT)))));
  var calendarNavUnit = bodyView === 'calendar' ? props.calendarGranularity === 'resource' ? 'month' : (_props$calendarGranul = props.calendarGranularity) !== null && _props$calendarGranul !== void 0 ? _props$calendarGranul : 'day' : 'day';
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PisellReservationScheduleBand, {
    value: props.schedule,
    onChange: props.onScheduleChange,
    scheduleRowClassName: props.phoneLayout && !allowBodyViewToggle ? 'pisell-reservation-schedule-band-schedule-row--phone-single-line' : undefined,
    hideTimeNavigator: bodyView === 'calendar',
    scheduleProps: _objectSpread(_objectSpread({}, props.scheduleProps), {}, {
      navigationLocked: Boolean((_props$scheduleProps = props.scheduleProps) === null || _props$scheduleProps === void 0 ? void 0 : _props$scheduleProps.navigationLocked)
    }, bodyView === 'calendar' ? {
      navigationUnit: calendarNavUnit
    } : {}),
    timeNavigatorProps: _objectSpread(_objectSpread({
      range: RESERVATION_TIMELINE_BUSINESS_RANGE,
      businessHours: RESERVATION_TIMELINE_BUSINESS_RANGE
    }, props.timeNavigatorProps), {}, {
      showNowButton: (_props$timeNavigatorP = (_props$timeNavigatorP2 = props.timeNavigatorProps) === null || _props$timeNavigatorP2 === void 0 ? void 0 : _props$timeNavigatorP2.showNowButton) !== null && _props$timeNavigatorP !== void 0 ? _props$timeNavigatorP : false,
      /**
       * 预约场景禁用时间轴吸附：松手后保留指针停留位置对应的连续时间，
       * 不再回弹到最近的 0/15/30/45 step 刻度。即使外层把 `snapToStep` 透传为 true，
       * 也在此被强制覆盖为 false，与 PisellReservation.tsx 的合并层形成双保险。
       */
      snapToStep: false,
      /**
       * 桌面：`cursor-moves`（拖指针）。手机：`axis-moves`（拖刻度轴，指针固定视口中央）。
       */
      cursorMode: props.phoneLayout ? 'axis-moves' : 'cursor-moves',
      onUserInteraction: function onUserInteraction() {
        var _props$timeNavigatorP3, _props$timeNavigatorP4;
        props.onTimeNavigatorUserInteraction();
        (_props$timeNavigatorP3 = props.timeNavigatorProps) === null || _props$timeNavigatorP3 === void 0 || (_props$timeNavigatorP4 = _props$timeNavigatorP3.onUserInteraction) === null || _props$timeNavigatorP4 === void 0 || _props$timeNavigatorP4.call(_props$timeNavigatorP3);
      },
      userInteractionLocked: Boolean((_props$timeNavigatorP5 = props.timeNavigatorProps) === null || _props$timeNavigatorP5 === void 0 ? void 0 : _props$timeNavigatorP5.userInteractionLocked),
      loadDensity: props.loadDensity,
      horizontalAxisCellSizePx: props.phoneLayout ? (_props$timeNavigatorP6 = (_props$timeNavigatorP7 = props.timeNavigatorProps) === null || _props$timeNavigatorP7 === void 0 ? void 0 : _props$timeNavigatorP7.horizontalAxisCellSizePx) !== null && _props$timeNavigatorP6 !== void 0 ? _props$timeNavigatorP6 : PISELL_RESERVATION_PHONE_TIME_AXIS_CELL_PX : (_props$timeNavigatorP8 = props.timeNavigatorProps) === null || _props$timeNavigatorP8 === void 0 ? void 0 : _props$timeNavigatorP8.horizontalAxisCellSizePx,
      horizontalTrackHeightPx: props.phoneLayout ? (_props$timeNavigatorP9 = (_props$timeNavigatorP10 = props.timeNavigatorProps) === null || _props$timeNavigatorP10 === void 0 ? void 0 : _props$timeNavigatorP10.horizontalTrackHeightPx) !== null && _props$timeNavigatorP9 !== void 0 ? _props$timeNavigatorP9 : PISELL_RESERVATION_PHONE_TIME_NAVIGATOR_HEIGHT_PX : (_props$timeNavigatorP11 = props.timeNavigatorProps) === null || _props$timeNavigatorP11 === void 0 ? void 0 : _props$timeNavigatorP11.horizontalTrackHeightPx
    }),
    scheduleStartSlot: scheduleStartMerged,
    scheduleAfterDateSlot: afterDateSlot,
    scheduleEndSlot: props.scheduleEndSlot
  }), props.extraTabs);
}

/** 表格视图时展示工具栏右上角透传；平面图时收起（编辑入口在画布 Tab 行右侧） */
export function ReservationGridTopRight(props) {
  var _props$extra;
  var _useRecordBoardContex6 = useRecordBoardContext(),
    bodyView = _useRecordBoardContex6.bodyView;
  if (bodyView === 'floorMap' || bodyView === 'calendar') return null;
  return /*#__PURE__*/React.createElement(React.Fragment, null, (_props$extra = props.extra) !== null && _props$extra !== void 0 ? _props$extra : null);
}
/** 顶栏日程带右侧：日历粒度（与左上角 Segmented 同款）+ 新建 */
export function PisellReservationScheduleEndActions(props) {
  var _useRecordBoardContex7 = useRecordBoardContext(),
    bodyView = _useRecordBoardContex7.bodyView;
  var shellMeta = useRecordBoardShellBodyMeta();
  var showGranularity = bodyView === 'calendar' && Boolean(shellMeta === null || shellMeta === void 0 ? void 0 : shellMeta.hasCalendarSlot) && props.calendarGranularity != null && props.onCalendarGranularityChange != null;
  var segmentedSize = props.phoneLayout ? 'middle' : 'large';
  var granularityOpts = [{
    label: locales.getText(I18N_CALENDAR_RESOURCE),
    value: 'resource'
  }, {
    label: locales.getText(I18N_CALENDAR_DAY),
    value: 'day'
  }, {
    label: locales.getText(I18N_CALENDAR_WEEK),
    value: 'week'
  }, {
    label: locales.getText(I18N_CALENDAR_MONTH),
    value: 'month'
  }];
  return /*#__PURE__*/React.createElement("div", {
    className: "pisell-reservation-schedule-end-slots"
  }, showGranularity ? props.phoneLayout ? /*#__PURE__*/React.createElement(Select, {
    className: "pisell-reservation-body-view-select pisell-reservation-calendar-granularity-select",
    popupClassName: "pisell-reservation-body-view-select-dropdown pisell-reservation-calendar-granularity-select-dropdown",
    popupMatchSelectWidth: false,
    size: "middle",
    value: props.calendarGranularity,
    onChange: function onChange(v) {
      var _props$onCalendarGran;
      return (_props$onCalendarGran = props.onCalendarGranularityChange) === null || _props$onCalendarGran === void 0 ? void 0 : _props$onCalendarGran.call(props, v);
    },
    options: granularityOpts.map(function (o) {
      return {
        label: o.label,
        value: o.value
      };
    })
  }) : /*#__PURE__*/React.createElement(Segmented, {
    className: "pisell-reservation-body-view-segmented pisell-reservation-calendar-granularity-segmented",
    size: segmentedSize,
    value: props.calendarGranularity,
    onChange: function onChange(v) {
      var _props$onCalendarGran2;
      return (_props$onCalendarGran2 = props.onCalendarGranularityChange) === null || _props$onCalendarGran2 === void 0 ? void 0 : _props$onCalendarGran2.call(props, v);
    },
    options: granularityOpts
  }) : null, /*#__PURE__*/React.createElement("button", {
    type: "button",
    className: props.phoneLayout ? 'pisell-reservation-new-btn pisell-reservation-new-btn--phone' : 'pisell-reservation-new-btn',
    onClick: function onClick() {
      var _props$onNewReservati;
      return (_props$onNewReservati = props.onNewReservation) === null || _props$onNewReservati === void 0 ? void 0 : _props$onNewReservati.call(props);
    }
  }, locales.getText(I18N_NEW)));
}
/** 平面图左下 Dock 展开区：与缩放/网格平级的业务工具按钮。 */
export function ReservationFloorMapDockToolButtons(props) {
  return /*#__PURE__*/React.createElement(ReservationFloorMapDockAppearanceToggle, {
    mode: props.appearanceMode,
    onToggle: props.onToggleAppearanceMode
  });
}

/** 平面图左下 Dock 展开区：编辑 / 完成编辑（经 PisellFloorMapLayout.viewportDockTrailing） */
export function ReservationFloorMapCanvasTabsTrailing(props) {
  var _useRecordBoardContex8 = useRecordBoardContext(),
    bodyView = _useRecordBoardContex8.bodyView;
  useEffect(function () {
    if (bodyView !== 'floorMap' && props.mapEditInternal) {
      props.setMapEditInternal(false);
    }
  }, [bodyView, props.mapEditInternal, props.setMapEditInternal]);
  if (bodyView !== 'floorMap') return null;
  if (props.isFloorModeControlled) return null;
  var editLabel = locales.getText(props.mapEditInternal ? I18N_EDIT_MAP_DONE : I18N_EDIT_MAP);
  var handleToggleMapEdit = function handleToggleMapEdit() {
    if (props.mapEditInternal) {
      var _props$floorMapLayout, _props$floorMapLayout2;
      (_props$floorMapLayout = props.floorMapLayoutRef.current) === null || _props$floorMapLayout === void 0 || (_props$floorMapLayout2 = _props$floorMapLayout.saveLayout) === null || _props$floorMapLayout2 === void 0 || _props$floorMapLayout2.call(_props$floorMapLayout);
    }
    props.setMapEditInternal(function (v) {
      return !v;
    });
  };
  if (props.phoneLayout) {
    return /*#__PURE__*/React.createElement("button", {
      type: "button",
      className: props.mapEditInternal ? 'pisell-floor-map-layout-view-controls-tool-btn pisell-floor-map-layout-view-controls-tool-btn--active' : 'pisell-floor-map-layout-view-controls-tool-btn',
      title: editLabel,
      "aria-label": editLabel,
      "aria-pressed": props.mapEditInternal,
      onClick: handleToggleMapEdit
    }, props.mapEditInternal ? /*#__PURE__*/React.createElement(CheckOutlined, null) : /*#__PURE__*/React.createElement(EditOutlined, null));
  }
  return /*#__PURE__*/React.createElement("div", {
    className: "pisell-reservation-floor-map-dock-actions"
  }, /*#__PURE__*/React.createElement(Button, {
    type: "primary",
    size: "middle",
    className: "pisell-reservation-topbar-edit-btn",
    onClick: handleToggleMapEdit
  }, editLabel));
}

/** 默认顶栏标题 slot */
export function ReservationDefaultScheduleStart() {
  return /*#__PURE__*/React.createElement("span", {
    className: "pisell-reservation-page-title"
  }, locales.getText(I18N_PAGE_TITLE));
}

/** 场控页顶栏标题 slot */
export function ReservationVenueScheduleStart() {
  return /*#__PURE__*/React.createElement("span", {
    className: "pisell-reservation-page-title"
  }, locales.getText(I18N_PAGE_TITLE_VENUE));
}