import{K as r,a,C as n,k as e,l as t,m as o,n as l,o as u,t as c,u as i,f as s}from"../../vendor.js";import{forwardRef as f,useState as p,useEffect as v,Children as d,cloneElement as g}from"react";import"react-popper";import"react-dom";var m=["className","children","disabled","onDrop","onDragOver","onDragLeave"];function D(r,a){var n=c(r);if(i){var e=i(r);a&&(e=s(e).call(e,(function(a){return u(r,a).enumerable}))),n.push.apply(n,e)}return n}function b(r){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?D(Object(n),!0).forEach((function(a){e(r,a,n[a])})):t?o(r,t(n)):D(Object(n)).forEach((function(a){l(r,a,u(n,a))}))}return r}var h=f((function(e,t){var o=e.className,l=e.children,u=e.disabled,c=void 0!==u&&u,i=e.onDrop,s=e.onDragOver,f=e.onDragLeave,D=r(e,m),h=p(!1),O=a(h,2),N=O[0],j=O[1],E=p(0),L=a(E,2),x=L[0],y=L[1],C=p(null),T=a(C,2),Y=T[0],k=T[1];v((function(){x<=0&&j(!1)}),[x]);var B=d.only(l);return g(B,b(b({},D),{},{ref:t,className:n(o,B.props.className,{"drag-enter":!c&&N},{"drag-top":!c&&N&&Y&&"before"===Y},{"drag-bottom":!c&&N&&Y&&"after"===Y}),onDragEnter:function(){c||(y(x+1),j(!0))},onDragLeave:function(r){c||(y(x-1),k(null),null==f||f(r))},onDrop:function(r){c||(y(0),j(!1),null==i||i(JSON.parse(r.dataTransfer.getData("text")),Y,r),r.preventDefault(),k(null))},onDragOver:function(r){var a,n=r.currentTarget.getBoundingClientRect(),e=(null==n?void 0:n.top)+(null==n?void 0:n.height)/2;return r.clientY>=e?a="after":r.clientY<e&&(a="before"),k(a),r.preventDefault(),null==s||s(r,a),!1}}))}));export{h as D};
//# sourceMappingURL=index.js.map
