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