var __extends=this&&this.__extends||function(){var t=function(n,i){t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i))t[i]=n[i]};return t(n,i)};return function(n,i){if(typeof i!=="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");t(n,i);function e(){this.constructor=n}n.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)}}();System.register(["./p-DDPYMMGG.system.js","./p-D7_eHNTI.system.js","./p-D1opIX9W.system.js"],(function(t){"use strict";var n,i,e,s,r;return{setters:[function(t){n=t.L;i=t.a},function(t){e=t.b},function(t){s=t.o;r=t.p}],execute:function(){t("L",f);var u=function(t){__extends(n,t);function n(){var i=t.apply(this,arguments)||this;i.state=n.DefaultState;i.onMouseEnter=function(){i.updateState({hovered:true})};i.onMouseLeave=function(){i.updateState({hovered:false})};i.onPointerDown=function(){i.updateState({pressed:true})};i.onPointerUp=function(){i.updateState({pressed:false})};return i}n.prototype.connect=function(i){t.prototype.connect.call(this,i);s(this.el,"mouseenter",this.onMouseEnter,n.EventListenerOptions);s(this.el,"mouseleave",this.onMouseLeave,n.EventListenerOptions);s(this.el,"pointerdown",this.onPointerDown,n.EventListenerOptions);if(e.hasDocument){s(document,"pointerup",this.onPointerUp,n.EventListenerOptions)}};n.prototype.disconnect=function(){t.prototype.disconnect.call(this);if(this.el){r(this.el,"mouseenter",this.onMouseEnter);r(this.el,"mouseleave",this.onMouseLeave);r(this.el,"pointerdown",this.onPointerDown);if(e.hasDocument){r(document,"pointerup",this.onPointerUp)}}};n.prototype.updateState=function(t){this.state=Object.assign(Object.assign({},this.state),t);this.notify(this.state)};return n}(n);t("B",u);u.EventListenerOptions={passive:true};u.DefaultState={hovered:false,pressed:false};var o=function(t){__extends(n,t);function n(){var n=t.call(this,(function(t,n){if(n){t.elementStateListener(n)}}))||this;n.listener=new u;return n}n.prototype.attach=function(n){var i=this;t.prototype.attach.call(this,n);this.listener.connect(n.el);this.listener.add((function(n){return t.prototype.notify.call(i,n)}))};n.prototype.detach=function(){t.prototype.detach.call(this);this.listener.disconnect()};return n}(i);function f(){return function(t,n,i){var e=t.connectedCallback,s=t.disconnectedCallback;t.connectedCallback=function(){if(!this._balElementStateSubject){this._balElementStateSubject=new o;this._balElementStateSubject.attach(this)}return e&&e.call(this)};t.disconnectedCallback=function(){if(this._balElementStateSubject){this._balElementStateSubject.detach();this._balElementStateSubject=undefined}return s&&s.call(this)}}}}}}));