function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
var _excluded = ["childCount", "clone", "depth", "disableSelection", "disableInteraction", "ghost", "handleProps", "indentationWidth", "indicator", "collapsed", "onCollapse", "onRemove", "style", "wrapperRef", "item", "renderItem", "isBlocked", "__designMode"];
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import classNames from 'classnames';
import React, { forwardRef } from 'react';
import { Action, Handle, Remove } from "../../components";
import "./TreeItem.less";
export var TreeItem = /*#__PURE__*/forwardRef(function (props, ref) {
  var childCount = props.childCount,
    clone = props.clone,
    depth = props.depth,
    disableSelection = props.disableSelection,
    disableInteraction = props.disableInteraction,
    ghost = props.ghost,
    handleProps = props.handleProps,
    indentationWidth = props.indentationWidth,
    indicator = props.indicator,
    collapsed = props.collapsed,
    onCollapse = props.onCollapse,
    onRemove = props.onRemove,
    style = props.style,
    wrapperRef = props.wrapperRef,
    item = props.item,
    renderItem = props.renderItem,
    isBlocked = props.isBlocked,
    __designMode = props.__designMode,
    otherProps = _objectWithoutProperties(props, _excluded);
  if (renderItem) {
    return renderItem(props, ref);
  }
  return /*#__PURE__*/React.createElement("li", _extends({
    className: classNames('Wrapper', clone && 'clone', ghost && 'ghost', indicator && 'indicator', disableSelection && 'disableSelection', disableInteraction && 'disableInteraction'),
    ref: wrapperRef,
    style: {
      '--spacing': "".concat(indentationWidth * depth, "px")
    }
  }, otherProps), /*#__PURE__*/React.createElement("div", {
    className: 'TreeItem',
    ref: ref,
    style: style
  }, /*#__PURE__*/React.createElement(Handle, __designMode === 'design' ? {} : _objectSpread({}, handleProps)), onCollapse && /*#__PURE__*/React.createElement(Action, {
    onClick: onCollapse,
    className: classNames('Collapse', collapsed && 'collapsed')
  }, collapseIcon), /*#__PURE__*/React.createElement("span", {
    className: 'Text'
  }, item.id), !clone && onRemove && /*#__PURE__*/React.createElement(Remove, {
    onClick: onRemove
  }), clone && childCount && childCount > 1 ? /*#__PURE__*/React.createElement("span", {
    className: 'Count'
  }, childCount) : null));
});
var collapseIcon = /*#__PURE__*/React.createElement("svg", {
  width: "10",
  xmlns: "http://www.w3.org/2000/svg",
  viewBox: "0 0 70 41"
}, /*#__PURE__*/React.createElement("path", {
  d: "M30.76 39.2402C31.885 40.3638 33.41 40.995 35 40.995C36.59 40.995 38.115 40.3638 39.24 39.2402L68.24 10.2402C69.2998 9.10284 69.8768 7.59846 69.8494 6.04406C69.822 4.48965 69.1923 3.00657 68.093 1.90726C66.9937 0.807959 65.5106 0.178263 63.9562 0.150837C62.4018 0.123411 60.8974 0.700397 59.76 1.76024L35 26.5102L10.24 1.76024C9.10259 0.700397 7.59822 0.123411 6.04381 0.150837C4.4894 0.178263 3.00632 0.807959 1.90702 1.90726C0.807714 3.00657 0.178019 4.48965 0.150593 6.04406C0.123167 7.59846 0.700153 9.10284 1.75999 10.2402L30.76 39.2402Z"
}));