text: var e=require("@hotwired/stimulus");require("@kanety/stimulus-static-actions");class r extends e.Controller{get draggers(){return this.scope.findAllElements('[draggable="true"]')}start(e){this.currentDrag=this.draggers.find(r=>r.contains(e.target)),this.currentDrag&&(this.toggleClass(!0),this.showHelper(e.pageX,e.pageY),this.dispatch("start",{detail:{dataTransfer:e.dataTransfer,drag:this.currentDrag}}),this.context.actionSet.add(this.constructor.dragActions))}enter(e){var r=this.findCurrentDrop(e.target);r&&(this.toggleOverClass(r,!0),this.dispatch("enter",{detail:{dataTransfer:e.dataTransfer,drag:this.currentDrag,drop:r}})),e.preventDefault()}over(e){var r=this.findCurrentDrop(e.target);r&&this.dispatch("over",{detail:{dataTransfer:e.dataTransfer,drag:this.currentDrag,drop:r}}),e.preventDefault()}leave(e){var r=this.findCurrentDrop(e.target);r&&(this.toggleOverClass(r,!1),this.dispatch("leave",{detail:{dataTransfer:e.dataTransfer,drag:this.currentDrag,drop:r}}))}drag(e){this.moveHelper(e.pageX,e.pageY),this.dispatch("drag",{detail:{dataTransfer:e.dataTransfer,drag:this.currentDrag}})}drop(e){var r=this.findCurrentDrop(e.target);r&&this.dispatch("drop",{detail:{dataTransfer:e.dataTransfer,drag:this.currentDrag,drop:r}})}end(e){this.toggleClass(!1),this.hideHelper(),this.dispatch("end",{detail:{dataTransfer:e.dataTransfer,drag:this.currentDrag}}),this.context.actionSet.remove(this.constructor.dragActions)}findCurrentDrop(e){return this.dropTargets.find(r=>r.contains(e))}toggleClass(e){this.dropTargets.forEach(e?e=>{e.classList.add("st-droppable__drop--ok")}:e=>{e.classList.remove("st-droppable__drop--ok"),e.classList.remove("st-droppable__drop--over")})}toggleOverClass(e,r){r?e.classList.add("st-droppable__drop--over"):e.classList.remove("st-droppable__drop--over")}showHelper(e,r){this.hasHelperTarget&&(this.helperTarget.style.display="",this.moveHelper(e,r))}moveHelper(e,r){this.hasHelperTarget&&e&&r&&(this.helperTarget.style.top=r+10+"px",this.helperTarget.style.left=e+"px")}hideHelper(){this.hasHelperTarget&&(this.helperTarget.style.display="none")}}r.targets=["drop","helper"],r.actions=[["element","dragstart@document->start"]],r.dragActions=[["element","dragenter@document->enter"],["element","dragover@document->over"],["element","dragleave@document->leave"],["element","drag@document->drag"],["element","drop@document->drop"],["element","dragend@document->end"]],module.exports=r;
  //# sourceMappingURL=index.js.map
  