import{L as s,a as t}from"./p-ab217a42.js";import{b as i}from"./p-e680e7e4.js";import{h as e}from"./p-4f82c566.js";class n extends s{constructor(){super(...arguments),this.debouncedNotify=e((()=>this.notify()),10)}connect(s){var t;super.connect(s),"undefined"!=typeof ResizeObserver&&(void 0!==this.resizeObserver&&(null===(t=this.resizeObserver)||void 0===t||t.disconnect(),this.resizeObserver=void 0),this.resizeObserver=new ResizeObserver((s=>{i.hasWindow&&window.requestAnimationFrame((()=>{Array.isArray(s)&&s.length&&this.debouncedNotify()}))})),this.resizeObserver.observe(s))}disconnect(){var s;super.disconnect(),null===(s=this.resizeObserver)||void 0===s||s.disconnect(),this.resizeObserver=void 0}}class r extends t{constructor(){super((s=>{s.resizeListener({})})),this.listener=new n}attach(s){super.attach(s),this.listener.connect(s.el),this.listener.add((s=>super.notify(s)))}detach(){super.detach(),this.listener.disconnect()}}function o(){return function(s){const{connectedCallback:t,disconnectedCallback:i}=s;s.connectedCallback=function(){return this._balResizeSubject||(this._balResizeSubject=new r,this._balResizeSubject.attach(this)),t&&t.call(this)},s.disconnectedCallback=function(){return this._balResizeSubject&&(this._balResizeSubject.detach(),this._balResizeSubject=void 0),i&&i.call(this)}}}export{o as L}