import { c as usePlannerUIHandler } from './index-bbdfb97a.js';
import classnames from 'classnames';
import { observer } from 'mobx-react-lite';
import 'react';
import { jsx } from 'react/jsx-runtime';
import '@babel/runtime/helpers/defineProperty';
import 'react-dynamic-multi-render';
import '@crystaldesign/diva-core';
import '@babel/runtime/helpers/asyncToGenerator';
import '@babel/runtime/helpers/slicedToArray';
import '@babel/runtime/helpers/objectWithoutProperties';
import '@babel/runtime/regenerator';
import '@babel/runtime/helpers/classCallCheck';
import '@babel/runtime/helpers/createClass';
import '@babel/runtime/helpers/toConsumableArray';
import '@crystaldesign/diva-utils';
import 'mobx';
import '@crystaldesign/web-planner-logic';
import 'qrcode.react';
import '@babel/runtime/helpers/typeof';
import 'flat';
import 'react-switch';
import 'react-countup';

var AVR = function AVR(_ref) {
  var rect = _ref.rect,
    item = _ref.item,
    onElement = _ref.onElement,
    plannerUIProps = _ref.plannerUIProps;
  var plannerUIHandler = usePlannerUIHandler();
  var iconIsSelected = plannerUIHandler.getDPUIISSelected(item);
  var rotation = (item.rotOfElement ? item.rotOfElement : 0) + (item.iconRotDeg ? item.iconRotDeg : 0);
  return /*#__PURE__*/jsx("div", {
    ref: function ref(elem) {
      return onElement(elem);
    },
    onClick: function onClick() {
      var _item$clickFunction;
      plannerUIHandler.setDPUISelectionChanged(item, !iconIsSelected);
      (_item$clickFunction = item.clickFunction) === null || _item$clickFunction === void 0 || _item$clickFunction.call(item, item.setId, Number(item.elementId), item.dpId, !iconIsSelected, undefined);
    },
    style: {
      left: rect.left + 'px',
      top: rect.top + 'px',
      transform: 'rotate(' + rotation + 'deg)'
    },
    className: classnames(plannerUIProps.classes.buttonGeneral, plannerUIProps.classes.dockingPoint.AVR.avr, iconIsSelected ? plannerUIProps.classes.dockingPoint.AVR.avrSel : undefined),
    children: item.posNr
  });
};
var AVR$1 = observer(AVR);

export { AVR$1 as default };
