import{I as t,Y as s,R as i,S as n}from"./p-CklISCW5.js";import{L as e,a}from"./p-DttRmuGk.js";class h extends e{constructor(){super(...arguments),this.debouncedNotify=t((t=>this.notify({target:t})),42),this.callbackWillAnimate=t=>{s(t,this.el,(t=>this.debouncedNotify(t)))},this.callbackDidAnimate=t=>{s(t,this.el,(t=>this.debouncedNotify(t)))}}connect(t){super.connect(t);const s=window;s&&(i(s,"balWillAnimate",this.callbackWillAnimate,{passive:!0}),i(s,"balDidAnimate",this.callbackDidAnimate,{passive:!0}))}disconnect(){super.disconnect();const t=window;t&&(n(t,"balWillAnimate",this.callbackWillAnimate),n(t,"balDidAnimate",this.callbackDidAnimate))}}class c extends a{constructor(){super(((t,s)=>{t.animationListener(s)})),this.listener=new h}attach(t){super.attach(t),this.listener.connect(t.el),this.listener.add((t=>super.notify(t)))}detach(){super.detach(),this.listener.disconnect()}}function o(){return function(t){const{connectedCallback:s,componentDidLoad:i,disconnectedCallback:n}=t;t.connectedCallback=function(){return this._balAnimationSubject||(this._balAnimationSubject=new c),s&&s.call(this)},t.componentDidLoad=function(){return this._balAnimationSubject.attach(this),i&&i.call(this)},t.disconnectedCallback=function(){return this._balAnimationSubject&&(this._balAnimationSubject.detach(),this._balAnimationSubject=void 0),n&&n.call(this)}}}new c;export{o as L}