"use strict";require("./observable-BXDJFaLN.js");var e=require("./utilsPrivate-DL4VBetH.js");require("./i18n-CP31jeWH.js");function t(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)}}exports.InteractingState=class{constructor(i){const n=i&&i.duration>=0?i.duration:2e3;this.eventemitter=new e.EventEmitter,this._interacting=!1,this._debouncedLeave=t(this.leave.bind(this),n),this._debounceInteraction=i&&i.debounceInteraction,this._interactedRecently=!1,this._debounceInteraction&&(this._debouncedEmitLeave=t(()=>{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()}},exports.debounce=t;
