import{O as a,n as r,a2 as n,S as e,f as t,c as l,g as s,d as g,e as o,h as d,N as c,k as i,l as f,m 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,O=t.onDragEnd,x=a(t,b),S=m(!1),j=r(S,2),E=j[0],T=j[1],k=m(!1),B=r(k,2),C=B[0],R=B[1];n((function(){C&&(T(!0),R(!1))}),0,[C]);var q=D.only(g);return p(q,y(y({},x),{},{ref:l,className:e(s,q.props.className,{dragging:!d&&C,dragged:!d&&E,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){}R(!0),null==N||N(a,r)}},onDrag:function(a){d||null==I||I(a)},onDragEnd:function(a){d||(T(!1),null==O||O(a))}}))}));export{I as D};
//# sourceMappingURL=index.js.map
