import{N as a,n as r,Z as n,R as e,f as t,_ as l,g as s,d as g,a as o,c as d,M as c,k as i,i as f,l as u}from"../../vendor.js";import{forwardRef as v,useState as m,Children as D,cloneElement as p}from"react";var b=["className","children","disabled","data","dragImage","dragImageOffset","onDrag","onDragStart","onDragEnd"];function h(a,r){var n=i(a);if(f){var e=f(a);r&&(e=u(e).call(e,(function(r){return d(a,r).enumerable}))),n.push.apply(n,e)}return n}function y(a){for(var r=1;r<arguments.length;r++){var n,e=null!=arguments[r]?arguments[r]:{};if(r%2)t(n=h(Object(e),!0)).call(n,(function(r){l(a,r,e[r])}));else if(s)g(a,s(e));else{var c;t(c=h(Object(e))).call(c,(function(r){o(a,r,d(e,r))}))}}return a}var I=v((function(t,l){var s=t.className,g=t.children,o=t.disabled,d=void 0!==o&&o,i=t.data,f=void 0===i?{}:i,u=t.dragImage,v=t.dragImageOffset,h=void 0===v?{x:0,y:0}:v,I=t.onDrag,N=t.onDragStart,x=t.onDragEnd,O=a(t,b),j=m(!1),E=r(j,2),S=E[0],T=E[1],R=m(!1),k=r(R,2),B=k[0],C=k[1];n((function(){B&&(T(!0),C(!1))}),0,[B]);var M=D.only(g);return p(M,y(y({},O),{},{ref:l,className:e(s,M.props.className,{dragging:!d&&B,dragged:!d&&S,draggable:!d}),draggable:!d,onDragStart:function(a){if(!d){var r=a.currentTarget.getBoundingClientRect();try{var n,e;null===(n=(e=a.dataTransfer).setData)||void 0===n||n.call(e,"text",c(f)),u&&a.dataTransfer.setDragImage(u,h.x,h.y)}catch(a){}C(!0),null==N||N(a,r)}},onDrag:function(a){d||null==I||I(a)},onDragEnd:function(a){d||(T(!1),null==x||x(a))}}))}));export{I as D};
//# sourceMappingURL=index.js.map
