"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.NestedTableGhostIndentationCell = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
var _mobxReactLite = require("mobx-react-lite");
var _designSystem = require("@wix/design-system");
var _dragAndDrop = require("@wix/wix-style-react-incubator/drag-and-drop");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/NestedTableDragAndDrop/NestedTableGhostIndentationCell.tsx";
function _NestedTableGhostIndentationCell(props) {
  var _nestedTable$nestedTa, _nestedTable$nestedTa2, _nestedTable$nestedTa3, _item$originalKeyedIt;
  const {
    item
  } = props;
  const {
    state
  } = item;
  const {
    nestedTable
  } = state;
  const {
    isDragOverlay
  } = (0, _dragAndDrop.useDraggableRowContext)();
  const dragDepth = (_nestedTable$nestedTa = nestedTable.nestedTableDragAndDrop) != null && _nestedTable$nestedTa.dragAndDropDisabled ? (_nestedTable$nestedTa2 = nestedTable.nestedTableDragAndDrop.dragEventItems) == null ? void 0 : _nestedTable$nestedTa2.activeItem.item.state.childrenDepth : (_nestedTable$nestedTa3 = nestedTable.nestedTableDragAndDrop) == null || (_nestedTable$nestedTa3 = _nestedTable$nestedTa3.dragEventDepth) == null ? void 0 : _nestedTable$nestedTa3.depth;
  const {
    tableDragAndDropState
  } = nestedTable.tableState;
  const activeId = tableDragAndDropState == null ? void 0 : tableDragAndDropState.dnd.activeId;
  if (activeId !== ((_item$originalKeyedIt = item.originalKeyedItem) == null ? void 0 : _item$originalKeyedIt.id) || isDragOverlay) {
    return null;
  }
  const {
    classes
  } = _designSystem.Table.dataTableRowStyle;
  return /*#__PURE__*/_react.default.createElement("td", (0, _extends2.default)({
    "data-hook": "ghost-indentation-cell"
  }, process.env.NODE_ENV === 'test' && {
    'data-indentation-width': nestedTable._indentationWidth,
    'data-parent-cell-padding-start': nestedTable._parentCellPaddingStart
  }, {
    style: {
      visibility: 'visible',
      paddingInlineStart: 0,
      paddingInlineEnd: 0,
      width: (dragDepth === 0 ? 0 : nestedTable._parentCellPaddingStart) + (dragDepth ?? 0) * nestedTable._indentationWidth
    },
    className: classes.light,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 42,
      columnNumber: 5
    }
  }));
}
const NestedTableGhostIndentationCell = exports.NestedTableGhostIndentationCell = (0, _mobxReactLite.observer)(_NestedTableGhostIndentationCell);
//# sourceMappingURL=NestedTableGhostIndentationCell.js.map