import"./observable-tloG64m6.js";import{EventEmitter as e}from"./kd/utilsPrivate.js";import"./i18n-B98kiI7M.js";class t{constructor(t){const n=t&&t.duration>=0?t.duration:2e3;this.eventemitter=new e,this._interacting=!1,this._debouncedLeave=i(this.leave.bind(this),n),this._debounceInteraction=t&&t.debounceInteraction,this._interactedRecently=!1,this._debounceInteraction&&(this._debouncedEmitLeave=i(()=>{this._interacting||(this._interactedRecently=!1,this.eventemitter.emit("leave"))},200),this._debouncedEmitEnter=()=>{this._interactedRecently||(this._interactedRecently=!0,this.eventemitter.emit("enter"))})}isInteracting(){return this._interacting}enter(){this._interacting||(this._interacting=!0,this._debounceInteraction?this._debouncedEmitEnter():this.eventemitter.emit("enter"))}onenter(e){this.eventemitter.on("enter",e)}leave(){this._interacting&&(this._interacting=!1,this._debounceInteraction?this._debouncedEmitLeave():this.eventemitter.emit("leave"))}onleave(e){this.eventemitter.on("leave",e)}interacting(){this.enter(),this._debouncedLeave()}}function i(e,t,i){const n=i||{};let r,s=n.leading;return function(){const i=Array.prototype.slice.apply(arguments);s&&(e.apply(this,i),s=!1),clearTimeout(r),r=setTimeout(function(){e.apply(this,i),s=n.leading},t)}}export{t as I,i as d};
