import { addDomEvent as e } from "../events/add-dom-event.es.js";
import { Feature as i } from "../motion/features/Feature.es.js";
import { pipe as s } from "../../../../../../motion-utils@12.23.6/node_modules/motion-utils/dist/es/pipe.es.js";
class a extends i {
  constructor() {
    super(...arguments), this.isActive = !1;
  }
  onFocus() {
    let t = !1;
    try {
      t = this.node.current.matches(":focus-visible");
    } catch {
      t = !0;
    }
    !t || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
  }
  onBlur() {
    !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
  }
  mount() {
    this.unmount = s(e(this.node.current, "focus", () => this.onFocus()), e(this.node.current, "blur", () => this.onBlur()));
  }
  unmount() {
  }
}
export {
  a as FocusGesture
};
//# sourceMappingURL=focus.es.js.map
