Liferay.Loader.define("segments-web@3.0.77/js/components/criteria_builder/DropZone.es",["module","exports","require","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","liferay!frontend-js-react-web$react-dnd","../../utils/drag-types.es"],(function(e,r,t){window;{Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=_interopRequireDefault(t("liferay!frontend-js-react-web$classnames")),o=(_interopRequireDefault(t("liferay!frontend-js-react-web$prop-types")),function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=_getRequireWildcardCache();if(r&&r.has(e))return r.get(e);var t={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(t,o,a):t[o]=e[o]}t.default=e,r&&r.set(e,t);return t}(t("liferay!frontend-js-react-web$react"))),a=t("liferay!frontend-js-react-web$react-dnd"),d=t("../../utils/drag-types.es");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const{CRITERIA_GROUP:e,CRITERIA_ROW:c,PROPERTY:p}=d.DragTypes,u=[e,c,p];class DropZone extends o.Component{render(){const{before:e,canDrop:r,connectDropTarget:t,hover:a}=this.props,d=(0,n.default)("drop-zone-target",{"drop-zone-target-before":e});return o.default.createElement("div",{className:"drop-zone-root"},t(o.default.createElement("div",{className:d},r&&a&&o.default.createElement("div",{className:"drop-zone-indicator"}))))}}var i=(0,a.DropTarget)(u,{canDrop:function canDrop(r,t){const{dropIndex:n,groupId:o,propertyKey:a}=r,{childGroupIds:d=[],criterion:i,groupId:c,index:p,propertyKey:u}=t.getItem(),s=[i.groupId,...d];return!(t.getItemType()===e&&s.includes(o)||c===o&&(p===n||p===n-1))&&a===u},drop:function drop(r,t){const{dropIndex:n,groupId:o,onCriterionAdd:a,onMove:d}=r,{criterion:i,groupId:u,index:s}=t.getItem(),f=t.getItemType();f===p?a(n,i):f!==c&&f!==e||d(u,s,o,n,i)}},((e,r)=>({canDrop:r.canDrop(),connectDropTarget:e.dropTarget(),hover:r.isOver()})))(DropZone);r.default=i}}));
//# sourceMappingURL=DropZone.es.js.map