class h{constructor(t,s,e){this.host=t,this.store=s,this.selector=e,this.host.addController(this),this._value=this.selector?s.getState(this.selector):s.state}get value(){return this._value}hostConnected(){this.selector?this._unsubscribe=this.store.subscribeWithSelector(this.selector,t=>{this._value=t,this.host.requestUpdate()}):this._unsubscribe=this.store.subscribe(t=>{this._value=t,this.host.requestUpdate()})}hostDisconnected(){this._unsubscribe?.()}}export{h as S};
