import {a}from'./chunk-T2Y2C76P.js';import {i,h}from'./chunk-3A6GSH7S.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';var t=class extends Event{constructor(e){super(e);}},o=class{constructor(e){this.elementsAllowedToTriggerLongPressEvents=new Set;this.isLongPressing=false;this.longPressTimeout=new Timeout(400,this.onLongPressTimeoutFinished.bind(this));this.pointerDownListener=this.onPointerDown.bind(this);this.pointerMoveListener=this.onPointerMove.bind(this);this.pointerUpListener=this.onPointerUp.bind(this);this.element=e;}connect(){this.element.addEventListener("pointerdown",this.pointerDownListener),this.element.addEventListener("pointermove",this.pointerMoveListener),this.element.addEventListener("pointerup",this.pointerUpListener);}disconnect(){this.element.removeEventListener("pointerdown",this.pointerDownListener),this.element.removeEventListener("pointermove",this.pointerMoveListener),this.element.removeEventListener("pointerup",this.pointerUpListener);}onPointerDown(e){let v=this.elementsAllowedToTriggerLongPressEvents.has(e.target),p=this.elementsAllowedToTriggerLongPressEvents.has(this.element);e instanceof PointerEvent&&(p||v)&&(this.isLongPressing=false,this.pointerDownEvent=e,this.longPressTimeout.start());}onPointerMove(e){e instanceof PointerEvent&&this.pointerDownEvent&&a(this.pointerDownEvent,e)&&this.longPressTimeout.stop();}onPointerUp(){this.longPressTimeout.stop(),this.isLongPressing&&this.element.dispatchEvent(new t(i)),this.isLongPressing=false,this.pointerDownEvent=void 0;}onLongPressTimeoutFinished(){this.isLongPressing=true,this.element.dispatchEvent(new t(h));}};export{t as a,o as b};