import{__awaiter,__extends,__generator}from"tslib";import{b as balDevice}from"./device-85159a44.js";import{L as ListenerAbstract,a as SingleSubject}from"./listener-aa4bfae3.js";import{k as rIC}from"./helpers-2253b115.js";var BalSwipeListener=function(t){__extends(i,t);function i(){return t!==null&&t.apply(this,arguments)||this}i.prototype.connect=function(i){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(r){switch(r.label){case 0:t.prototype.connect.call(this,i);return[4,this.loadLib()];case 1:r.sent();if(this.PointerListenerLib){this.pointerListener=new this.PointerListenerLib(i,{DEBUG:true});this.pointerListener.on("swipeleft",(function(){return e.notify({left:true,right:false})}));this.pointerListener.on("swiperight",(function(){return e.notify({left:false,right:true})}))}return[2]}}))}))};i.prototype.disconnect=function(){var i;t.prototype.disconnect.call(this);(i=this.pointerListener)===null||i===void 0?void 0:i.destroy()};i.prototype.loadLib=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(i){return[2,new Promise((function(i,e){rIC((function(){return __awaiter(t,void 0,void 0,(function(){var t=this;return __generator(this,(function(r){import("./contact-91a44c8c.js").then((function(e){t.PointerListenerLib=e.PointerListener;i()})).catch(e);return[2]}))}))}))}))]}))}))};return i}(ListenerAbstract);var BalSwipeSubject=function(t){__extends(i,t);function i(i){if(i===void 0){i={mobileOnly:false}}var e=t.call(this,(function(t,i){if(i){t.swipeListener(i)}}))||this;e.options=i;e.listener=new BalSwipeListener;return e}i.prototype.attach=function(i){var e=this;if(this.options.mobileOnly===true&&balDevice.isMobile||this.options.mobileOnly!==true){t.prototype.attach.call(this,i);this.listener.connect(i.el);this.listener.add((function(i){return t.prototype.notify.call(e,i)}))}};i.prototype.detach=function(){t.prototype.detach.call(this);this.listener.disconnect()};return i}(SingleSubject);export{BalSwipeSubject as B};