"use strict";var e=require("@babel/runtime/helpers/defineProperty"),o=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),r=require("prop-types"),n=require("classnames"),i=require("react-sortable-hoc"),a=require("@material-ui/core"),l=require("@material-ui/icons/DragIndicator"),u=require("./Component.js"),d=require("react/jsx-runtime");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=s(e),c=s(o),b=s(r),m=s(n),f=s(l),g=a.makeStyles((function(e){return{sortableComponent:{position:"relative","&:hover":{"& $dragButton":{display:"block"}},zIndex:"99999999 !important",background:function(o){return o.isSortable&&e.palette.background.b5},boxShadow:function(e){return e.isSortable&&"0px 0px 6px rgba(0, 0, 0, 0.5)"}},topComponent:{marginTop:"16px"},bottomComponent:{marginBottom:"8px"},dragInidicationHidden:{"&:hover":{"& $dragButton":{display:"none"}}},dragIndicatorWrapper:{position:"absolute",left:function(e){return e.isMobile?"8px":0},top:function(e){return e.isMobile?"20px":"8px"}},dragButton:{display:function(e){return e.isMobile?"block":"none"},padding:"8px",background:function(o){return o.isMobile?"none":e.palette.background.b9},"&:hover":{background:e.palette.background.b7,"& $dragIndicatorIcon":{color:e.palette.primary.text1}}},dragIndicatorIcon:{cursor:"pointer",color:e.palette.primary.text6,fontSize:"16px"}}})),x=i.sortableHandle((function(e){var o=e.isMobile,t=g({isMobile:o});return d.jsx("div",{className:t.dragIndicatorWrapper,children:d.jsx(a.Tooltip,{title:o?"":"Click & Drag to reorder",children:d.jsx(a.IconButton,{className:t.dragButton,children:d.jsx(f.default,{className:t.dragIndicatorIcon})})})})})),q=i.SortableElement((function(e){var o,r=e.component,n=e.isTopComponent,i=e.isLastCompnent,a=e.isSortable,l=e.sortableIndex,s=e.validate,b=e.onDelete,f=e.onSave,q=e.isMobile,v=e.viewColumnsPerRow,C=e.editColumnsPerRow,R=g({isMobile:q,isSortable:a}),I=t.useState(!1),h=c.default(I,2),S=h[0],y=h[1];return d.jsxs("div",{className:m.default(R.sortableComponent,(o={},p.default(o,R.topComponent,!q&&n),p.default(o,R.bottomComponent,!q&&i),p.default(o,R.dragInidicationHidden,!a&&-1!==l),o)),children:[!S&&d.jsx(x,{isMobile:q}),d.jsx(u,{isMobile:q,viewColumnsPerRow:v,editColumnsPerRow:C,component:r,validate:s,onSave:f,onDelete:b,onChangeEditing:y,isDragComponent:-1!==l})]})}));q.propTypes={isMobile:b.default.bool.isRequired,component:b.default.shape({}).isRequired,isTopComponent:b.default.bool.isRequired,isLastCompnent:b.default.bool.isRequired,isSortable:b.default.bool.isRequired,sortableIndex:b.default.number.isRequired,validate:b.default.func.isRequired,onDelete:b.default.func.isRequired,onSave:b.default.func.isRequired,viewColumnsPerRow:b.default.number.isRequired,editColumnsPerRow:b.default.number.isRequired};var v=t.memo(q);module.exports=v;
