"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.KanbanDragOverlayCardItem = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _mobxReactLite = require("mobx-react-lite");
var _Card = require("../Kanban/Card");
var _state = require("../../state");
var _react = _interopRequireDefault(require("react"));
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/KanbanDragAndDropDndKit/KanbanDragOverlayCardItem.tsx";
function _KanbanDragOverlayCardItem(props) {
  const {
    state,
    renderItem,
    actionCell,
    dataExtension,
    tags
  } = props;
  const {
    activeId
  } = state.dragAndDropState;
  if (!activeId) {
    return null;
  }

  // Parse the activeId to get stageKey and itemKey
  const [stageKey, itemKey] = activeId.split('-##-');
  if (!stageKey || !itemKey) {
    return null;
  }
  const stageState = state.kanbanStageStates[stageKey];
  if (!stageState) {
    return null;
  }
  const keyedItem = stageState.itemsCollectionState.getKeyedItem(itemKey);
  if (!keyedItem) {
    return null;
  }
  const itemActionsState = new _state.ItemActionsState({
    fade: 'static',
    keyedItem,
    collection: stageState.itemsCollectionState,
    reportBi: state.toolbar.reportBi
  });
  const cardProps = {
    keyedItem,
    stageKey: stageState.stageKey,
    originalItem: keyedItem.item,
    itemIndex: 0,
    // Index not relevant for overlay
    itemActionsState,
    item: {
      ...(renderItem == null ? void 0 : renderItem({
        stage: stageState.stage,
        item: keyedItem.item
      })),
      key: keyedItem.key
    },
    actionCell,
    dataExtension,
    tags,
    isDragging: true,
    state
  };
  return /*#__PURE__*/_react.default.createElement(_Card.CardComponent, (0, _extends2.default)({}, cardProps, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 71,
      columnNumber: 10
    }
  }));
}
const KanbanDragOverlayCardItem = exports.KanbanDragOverlayCardItem = (0, _mobxReactLite.observer)(_KanbanDragOverlayCardItem);
//# sourceMappingURL=KanbanDragOverlayCardItem.js.map