import{B as Behavior,J as setTransitionTimeout}from"./index-16504bb3.js";class OffsetBehavior extends Behavior{connected(){const{host:t,params:e}=this,{name:s}=e,o=`--${s?`${s}-`:""}offset-x`,i=`--${s?`${s}-`:""}offset-y`,n=e=>{this._active=!0;const s=t.getBoundingClientRect(),n=e.clientX-s.left,r=e.clientY-s.top,h=n/s.width*2-1,a=r/s.height*2-1;t.style.setProperty(o,String(h)),t.style.setProperty(i,String(a))};this.on("mousemove",n),this.on("mouseover",e=>{n(e),setTransitionTimeout(t,()=>{this._active&&this.setMod("offset",!0)})}),this.on("mouseout",()=>{this._active=!1,this.setMod("offset",!1),setTimeout(()=>{this._active||(t.style.setProperty(o,"0"),t.style.setProperty(i,"0"))})})}}export default OffsetBehavior;