import{resize_observer_styles_default as e}from"./chunk.RMCOWJOW.js";import{watch as s}from"./chunk.C7FWPEOY.js";import{ShoelaceElement as t}from"./chunk.Z7XDKKOD.js";import{__decorateClass as r}from"./chunk.6M63UXML.js";import{html as i}from"../../../../lit/index.js";import{property as o}from"../../../../lit/decorators.js";var l=class extends t{constructor(){super(...arguments),this.observedElements=[],this.disabled=!1}connectedCallback(){super.connectedCallback(),this.resizeObserver=new ResizeObserver((e=>{this.emit("sl-resize",{detail:{entries:e}})})),this.disabled||this.startObserver()}disconnectedCallback(){super.disconnectedCallback(),this.stopObserver()}handleSlotChange(){this.disabled||this.startObserver()}startObserver(){const e=this.shadowRoot.querySelector("slot");if(null!==e){const s=e.assignedElements({flatten:!0});this.observedElements.forEach((e=>this.resizeObserver.unobserve(e))),this.observedElements=[],s.forEach((e=>{this.resizeObserver.observe(e),this.observedElements.push(e)}))}}stopObserver(){this.resizeObserver.disconnect()}handleDisabledChange(){this.disabled?this.stopObserver():this.startObserver()}render(){return i` <slot @slotchange=${this.handleSlotChange}></slot> `}};l.styles=e,r([o({type:Boolean,reflect:!0})],l.prototype,"disabled",2),r([s("disabled",{waitUntilFirstUpdate:!0})],l.prototype,"handleDisabledChange",1);export{l as SlResizeObserver};