import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { _objectWithoutProperties } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
import { TreeItem } from "./TreeItem.js";
import { iOS } from "../../utilities.js";
import React, { memo } from "react";
import { useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
//#region src/components/pisellDraggable/components/TreeItem/SortableTreeItem.tsx
const _excluded = ["id", "depth"];
const animateLayoutChanges = ({ isSorting, wasDragging }) => isSorting || wasDragging ? false : true;
const SortableTreeItem = (_ref) => {
	let { id, depth } = _ref, props = _objectWithoutProperties(_ref, _excluded);
	const { attributes, isDragging, isSorting, listeners, setDraggableNodeRef, setDroppableNodeRef, transform, transition } = useSortable({
		id,
		animateLayoutChanges
	});
	const style = {
		transform: CSS.Translate.toString(transform),
		transition
	};
	return /* @__PURE__ */ React.createElement(TreeItem, _objectSpread2({
		ref: setDraggableNodeRef,
		wrapperRef: setDroppableNodeRef,
		style,
		depth,
		ghost: isDragging,
		disableSelection: iOS,
		disableInteraction: isSorting,
		handleProps: _objectSpread2(_objectSpread2({}, attributes), listeners)
	}, props));
};
var SortableTreeItem_default = memo(SortableTreeItem);
//#endregion
export { SortableTreeItem_default as default };
