{"version":3,"sources":["webpack:///./node_modules/@ionic/core/dist/esm-es5/tap-click-ca00ce7f.js"],"names":["startTapClick","config","onTouchEnd","ev","lastTouch","pointerUp","cancelActive","clearTimeout","activeDefer","undefined","activatableEle","removeActivated","pointerDown","isScrolling","scrollingEl","setActivatedElement","getActivatableTarget","activeRipple","MOUSE_WAIT","lastActivated","useRippleEffect","getBoolean","clearDefers","WeakMap","parentElement","el","_a","x","y","has","Error","classList","contains","ACTIVATED","addActivated","deferId","get","delete","delay","isInstant","ADD_ACTIVATED_DEFERS","remove","setTimeout","Date","now","add","rippleEffect","getRippleEffect","addRipple","removeRipple","then","smooth","time","active","CLEAR_STATE_DEFERS","set","doc","document","addEventListener","target","t","composedPath","closest","path","i","length","shadowRoot","ripple","querySelector"],"mappings":"+FAAA,mEACIA,EAAgB,SAAUC,GAiBT,SAAbC,EAAuBC,GACvBC,EAAY,YAAID,CAAE,EAClBE,EAAUF,CAAE,CAChB,CAamB,SAAfG,IACAC,aAAaC,CAAW,EACxBA,EAAcC,OACVC,IACAC,EAAgB,EAAK,EACrBD,EAAiBD,OAEzB,CACkB,SAAdG,EAAwBT,GACpBO,GAAkBG,EAAY,IAGlCC,EAAcL,OACdM,EAAoBC,EAAqBb,CAAE,EAAGA,CAAE,EACpD,CACgB,SAAZE,EAAsBF,GACtBY,EAAoBN,OAAWN,CAAE,CACrC,CAjDA,IAEIW,EACAJ,EACAO,EACAT,EALAJ,EAA0B,GAAd,CAACc,EACbC,EAAgB,EAKhBC,EAAkBnB,EAAOoB,WAAW,WAAY,EAAI,GAAKpB,EAAOoB,WAAW,eAAgB,EAAI,EAC/FC,EAAc,IAAIC,QAClBV,EAAc,WACd,OAAuBJ,SAAhBK,GAA2D,OAA9BA,EAAYU,aACpD,EAwCIT,EAAsB,SAAUU,EAAItB,GAEpC,GAAIsB,IAAMA,IAAOf,EAAjB,CAGAH,aAAaC,CAAW,EACxBA,EAAcC,OACd,IAAIiB,EAAK,YAAavB,CAAE,EAAGwB,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ACZO,EAAuB,IACvBc,EAAqB,IACrBpC,EAAa,I","file":"js/chunk-2d0c5785.393d2d69.js","sourcesContent":["import { n as now, p as pointerCoord } from './helpers-46f4a262.js';\nvar startTapClick = function (config) {\n    var lastTouch = -MOUSE_WAIT * 10;\n    var lastActivated = 0;\n    var scrollingEl;\n    var activatableEle;\n    var activeRipple;\n    var activeDefer;\n    var useRippleEffect = config.getBoolean('animated', true) && config.getBoolean('rippleEffect', true);\n    var clearDefers = new WeakMap();\n    var isScrolling = function () {\n        return scrollingEl !== undefined && scrollingEl.parentElement !== null;\n    };\n    // Touch Events\n    var onTouchStart = function (ev) {\n        lastTouch = now(ev);\n        pointerDown(ev);\n    };\n    var onTouchEnd = function (ev) {\n        lastTouch = now(ev);\n        pointerUp(ev);\n    };\n    var onMouseDown = function (ev) {\n        var t = now(ev) - MOUSE_WAIT;\n        if (lastTouch < t) {\n            pointerDown(ev);\n        }\n    };\n    var onMouseUp = function (ev) {\n        var t = now(ev) - MOUSE_WAIT;\n        if (lastTouch < t) {\n            pointerUp(ev);\n        }\n    };\n    var cancelActive = function () {\n        clearTimeout(activeDefer);\n        activeDefer = undefined;\n        if (activatableEle) {\n            removeActivated(false);\n            activatableEle = undefined;\n        }\n    };\n    var pointerDown = function (ev) {\n        if (activatableEle || isScrolling()) {\n            return;\n        }\n        scrollingEl = undefined;\n        setActivatedElement(getActivatableTarget(ev), ev);\n    };\n    var pointerUp = function (ev) {\n        setActivatedElement(undefined, ev);\n    };\n    var setActivatedElement = function (el, ev) {\n        // do nothing\n        if (el && el === activatableEle) {\n            return;\n        }\n        clearTimeout(activeDefer);\n        activeDefer = undefined;\n        var _a = pointerCoord(ev), x = _a.x, y = _a.y;\n        // deactivate selected\n        if (activatableEle) {\n            if (clearDefers.has(activatableEle)) {\n                throw new Error('internal error');\n            }\n            if (!activatableEle.classList.contains(ACTIVATED)) {\n                addActivated(activatableEle, x, y);\n            }\n            removeActivated(true);\n        }\n        // activate\n        if (el) {\n            var deferId = clearDefers.get(el);\n            if (deferId) {\n                clearTimeout(deferId);\n                clearDefers.delete(el);\n            }\n            var delay = isInstant(el) ? 0 : ADD_ACTIVATED_DEFERS;\n            el.classList.remove(ACTIVATED);\n            activeDefer = setTimeout(function () {\n                addActivated(el, x, y);\n                activeDefer = undefined;\n            }, delay);\n        }\n        activatableEle = el;\n    };\n    var addActivated = function (el, x, y) {\n        lastActivated = Date.now();\n        el.classList.add(ACTIVATED);\n        var rippleEffect = useRippleEffect && getRippleEffect(el);\n        if (rippleEffect && rippleEffect.addRipple) {\n            removeRipple();\n            activeRipple = rippleEffect.addRipple(x, y);\n        }\n    };\n    var removeRipple = function () {\n        if (activeRipple !== undefined) {\n            activeRipple.then(function (remove) { return remove(); });\n            activeRipple = undefined;\n        }\n    };\n    var removeActivated = function (smooth) {\n        removeRipple();\n        var active = activatableEle;\n        if (!active) {\n            return;\n        }\n        var time = CLEAR_STATE_DEFERS - Date.now() + lastActivated;\n        if (smooth && time > 0 && !isInstant(active)) {\n            var deferId = setTimeout(function () {\n                active.classList.remove(ACTIVATED);\n                clearDefers.delete(active);\n            }, CLEAR_STATE_DEFERS);\n            clearDefers.set(active, deferId);\n        }\n        else {\n            active.classList.remove(ACTIVATED);\n        }\n    };\n    var doc = document;\n    doc.addEventListener('ionScrollStart', function (ev) {\n        scrollingEl = ev.target;\n        cancelActive();\n    });\n    doc.addEventListener('ionScrollEnd', function () {\n        scrollingEl = undefined;\n    });\n    doc.addEventListener('ionGestureCaptured', cancelActive);\n    doc.addEventListener('touchstart', onTouchStart, true);\n    doc.addEventListener('touchcancel', onTouchEnd, true);\n    doc.addEventListener('touchend', onTouchEnd, true);\n    doc.addEventListener('mousedown', onMouseDown, true);\n    doc.addEventListener('mouseup', onMouseUp, true);\n};\nvar getActivatableTarget = function (ev) {\n    if (ev.composedPath) {\n        var path = ev.composedPath();\n        for (var i = 0; i < path.length - 2; i++) {\n            var el = path[i];\n            if (el.classList && el.classList.contains('ion-activatable')) {\n                return el;\n            }\n        }\n    }\n    else {\n        return ev.target.closest('.ion-activatable');\n    }\n};\nvar isInstant = function (el) {\n    return el.classList.contains('ion-activatable-instant');\n};\nvar getRippleEffect = function (el) {\n    if (el.shadowRoot) {\n        var ripple = el.shadowRoot.querySelector('ion-ripple-effect');\n        if (ripple) {\n            return ripple;\n        }\n    }\n    return el.querySelector('ion-ripple-effect');\n};\nvar ACTIVATED = 'activated';\nvar ADD_ACTIVATED_DEFERS = 200;\nvar CLEAR_STATE_DEFERS = 200;\nvar MOUSE_WAIT = 2500;\nexport { startTapClick };\n"],"sourceRoot":""}