/** * what-input - A global utility for tracking the current input method (mouse, keyboard or touch). * @version v4.1.6 * @link https://github.com/ten1seven/what-input * @license MIT */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("whatInput",[],t):"object"==typeof exports?exports.whatInput=t():e.whatInput=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t){"use strict";e.exports=function(){var e="initial",t=null,n=document.documentElement,o=["input","select","textarea"],i=[],r=[16,17,18,91,93],u={keydown:"keyboard",mousedown:"mouse",mousemove:"mouse",MSPointerDown:"pointer",MSPointerMove:"pointer",pointerdown:"pointer",pointermove:"pointer",touchstart:"touch"},d=[],s=!1,a=!1,c={x:null,y:null},p={2:"touch",3:"touch",4:"mouse"},f=!1;try{var v=Object.defineProperty({},"passive",{get:function(){f=!0}});window.addEventListener("test",null,v)}catch(e){}var m=function(){window.PointerEvent?(n.addEventListener("pointerdown",w),n.addEventListener("pointermove",h)):window.MSPointerEvent?(n.addEventListener("MSPointerDown",w),n.addEventListener("MSPointerMove",h)):(n.addEventListener("mousedown",w),n.addEventListener("mousemove",h),"ontouchstart"in window&&(n.addEventListener("touchstart",y),n.addEventListener("touchend",y))),n.addEventListener(L(),h,!!f&&{passive:!0}),n.addEventListener("keydown",w)},w=function(n){if(!s){var i=n.which,d=u[n.type];if("pointer"===d&&(d=E(n)),e!==d||t!==d){var a=document.activeElement,c=!1;a&&a.nodeName&&-1===o.indexOf(a.nodeName.toLowerCase())&&(c=!0),("touch"===d||"mouse"===d||"keyboard"===d&&i&&c&&-1===r.indexOf(i))&&(e=t=d,l())}}},l=function(){n.setAttribute("data-whatinput",e),n.setAttribute("data-whatintent",e),-1===d.indexOf(e)&&(d.push(e),n.className+=" whatinput-types-"+e),x("input")},h=function(e){if(c.x!==e.screenX||c.y!==e.screenY?(a=!1,c.x=e.screenX,c.y=e.screenY):a=!0,!s&&!a){var o=u[e.type];"pointer"===o&&(o=E(e)),t!==o&&(t=o,n.setAttribute("data-whatintent",t),x("intent"))}},y=function(e){"touchstart"===e.type?(s=!1,w(e)):s=!0},x=function(e){for(var n=0,o=i.length;n