1/*! 2 * PEP v0.4.3 | https://github.com/jquery/PEP 3 * Copyright jQuery Foundation and other contributors | http://jquery.org/license 4 */(function(e,t){typeof exports=="object"&&typeof module!="undefined"?module.exports=t():typeof define=="function"&&define.amd?define(t):e.PointerEventsPolyfill=t()})(this,function(){"use strict";var e,t,n,s,o,i,a,d,u,h,m,f,p,g,v,b,y,w,O,x,C,E,k,S,M,F,T,z,D,N,L,R,P,I,B,V,$,W,K,Y,G,H=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","pageX","pageY"],Q=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0];function r(e,t){t=t||Object.create(null);var s,o,i,n=document.createEvent("Event");n.initEvent(e,t.bubbles,t.cancelable);for(s=2;s<H.length;s++)i=H[s],n[i]=t[i]||Q[s];return n.buttons=t.buttons||0,o=0,t.pressure&&n.buttons?o=t.pressure:o=n.buttons?.5:0,n.x=n.clientX,n.y=n.clientY,n.pointerId=t.pointerId||0,n.width=t.width||0,n.height=t.height||0,n.pressure=o,n.tiltX=t.tiltX||0,n.tiltY=t.tiltY||0,n.twist=t.twist||0,n.tangentialPressure=t.tangentialPressure||0,n.pointerType=t.pointerType||"",n.hwTimestamp=t.hwTimestamp||0,n.isPrimary=t.isPrimary,n}Y=window.Map&&window.Map.prototype.forEach,y=Y?Map:q;function q(){this.array=[],this.size=0}q.prototype={set:function(e,t){if(t===0[0])return this.delete(e);this.has(e)||this.size++,this.array[e]=t},has:function(e){return this.array[e]!==0[0]},delete:function(e){this.has(e)&&(delete this.array[e],this.size--)},get:function(e){return this.array[e]},clear:function(){this.array.length=0,this.size=0},forEach:function(e,t){return this.array.forEach(function(n,s){e.call(t,n,s,this)},this)}},h=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","buttons","pointerId","width","height","pressure","tiltX","tiltY","pointerType","hwTimestamp","isPrimary","type","target","currentTarget","which","pageX","pageY","timeStamp"],V=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0,0,0,0,0,0,"",0,!1,"",null,null,0,0,0,0],B={pointerover:1,pointerout:1,pointerenter:1,pointerleave:1},C=typeof SVGElementInstance!="undefined",e={pointermap:new y,eventMap:Object.create(null),captureInfo:Object.create(null),eventSources:Object.create(null),eventSourceList:[],registerSource:function(e,t){var n=t,s=n.events;s&&(s.forEach(function(e){n[e]&&(this.eventMap[e]=n[e].bind(n))},this),this.eventSources[e]=n,this.eventSourceList.push(n))},register:function(e){for(var n,s=this.eventSourceList.length,t=0;t<s&&(n=this.eventSourceList[t]);t++)n.register.call(n,e)},unregister:function(e){for(var n,s=this.eventSourceList.length,t=0;t<s&&(n=this.eventSourceList[t]);t++)n.unregister.call(n,e)},contains:function(e,t){try{return e.contains(t)}catch{return!1}},down:function(e){e.bubbles=!0,this.fireEvent("pointerdown",e)},move:function(e){e.bubbles=!0,this.fireEvent("pointermove",e)},up:function(e){e.bubbles=!0,this.fireEvent("pointerup",e)},enter:function(e){e.bubbles=!1,this.fireEvent("pointerenter",e)},leave:function(e){e.bubbles=!1,this.fireEvent("pointerleave",e)},over:function(e){e.bubbles=!0,this.fireEvent("pointerover",e)},out:function(e){e.bubbles=!0,this.fireEvent("pointerout",e)},cancel:function(e){e.bubbles=!0,this.fireEvent("pointercancel",e)},leaveOut:function(e){this.out(e),this.propagate(e,this.leave,!1)},enterOver:function(e){this.over(e),this.propagate(e,this.enter,!0)},eventHandler:function(e){if(e._handledByPE)return;var n=e.type,t=this.eventMap&&this.eventMap[n];t&&t(e),e._handledByPE=!0},listen:function(e,t){t.forEach(function(t){this.addEvent(e,t)},this)},unlisten:function(e,t){t.forEach(function(t){this.removeEvent(e,t)},this)},addEvent:function(e,t){e.addEventListener(t,this.boundHandler)},removeEvent:function(e,t){e.removeEventListener(t,this.boundHandler)},makeEvent:function(e,t){this.captureInfo[t.pointerId]&&(t.relatedTarget=null);var n=new r(e,t);return t.preventDefault&&(n.preventDefault=t.preventDefault),n._target=n._target||t.target,n},fireEvent:function(e,t){var n=this.makeEvent(e,t);return this.dispatchEvent(n)},cloneEvent:function(e){for(var t,n=Object.create(null),s=0;s<h.length;
4s++)t=h[s],n[t]=e[t]||V[s],C&&(t==="target"||t==="relatedTarget")&&n[t]instanceof SVGElementInstance&&(n[t]=n[t].correspondingUseElement);return e.preventDefault&&(n.preventDefault=function(){e.preventDefault()}),n},getTarget:function(e){var t=this.captureInfo[e.pointerId];if(!t)return e._target;if(e._target===t||!(e.type in B))return t},propagate:function(e,t,n){for(var s=e.target,o=[];s!==document&&!s.contains(e.relatedTarget);)if(o.push(s),s=s.parentNode,!s)return;n&&o.reverse(),o.forEach(function(n){e.target=n,t.call(this,e)},this)},setCapture:function(e,t,n){this.captureInfo[e]&&this.releaseCapture(e,n),this.captureInfo[e]=t,this.implicitRelease=this.releaseCapture.bind(this,e,n),document.addEventListener("pointerup",this.implicitRelease),document.addEventListener("pointercancel",this.implicitRelease);var s=new r("gotpointercapture");s.pointerId=e,s._target=t,n||this.asyncDispatchEvent(s)},releaseCapture:function(e,t){var n,s=this.captureInfo[e];if(!s)return;this.captureInfo[e]=0[0],document.removeEventListener("pointerup",this.implicitRelease),document.removeEventListener("pointercancel",this.implicitRelease),n=new r("lostpointercapture"),n.pointerId=e,n._target=s,t||this.asyncDispatchEvent(n)},dispatchEvent:function(e){var t=this.getTarget(e);if(t)return t.dispatchEvent(e)},asyncDispatchEvent:function(e){requestAnimationFrame(this.dispatchEvent.bind(this,e))}},e.boundHandler=e.eventHandler.bind(e),o={shadow:function(e){if(e)return e.shadowRoot||e.webkitShadowRoot},canTarget:function(e){return e&&Boolean(e.elementFromPoint)},targetingShadow:function(e){var t=this.shadow(e);if(this.canTarget(t))return t},olderShadow:function(e){var n,t=e.olderShadowRoot;return t||(n=e.querySelector("shadow"),n&&(t=n.olderShadowRoot)),t},allShadows:function(e){for(var n=[],t=this.shadow(e);t;)n.push(t),t=this.olderShadow(t);return n},searchRoot:function(e,t,n){if(e){for(var s,a,i=e.elementFromPoint(t,n),o=this.targetingShadow(i);o;){if(s=o.elementFromPoint(t,n),s)return a=this.targetingShadow(s),this.searchRoot(a,t,n)||s;o=this.olderShadow(o)}return i}},owner:function(e){for(var t=e;t.parentNode;)t=t.parentNode;return t.nodeType!==Node.DOCUMENT_NODE&&t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&(t=document),t},findTarget:function(e){var n=e.clientX,s=e.clientY,t=this.owner(e.target);return t.elementFromPoint(n,s)||(t=document),this.searchRoot(t,n,s)}},L=Array.prototype.forEach.call.bind(Array.prototype.forEach),N=Array.prototype.map.call.bind(Array.prototype.map),T=Array.prototype.slice.call.bind(Array.prototype.slice),F=Array.prototype.filter.call.bind(Array.prototype.filter),g=window.MutationObserver||window.WebKitMutationObserver,M="[touch-action]",S={subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0,attributeFilter:["touch-action"]};function j(e,t,n,s){this.addCallback=e.bind(s),this.removeCallback=t.bind(s),this.changedCallback=n.bind(s),g&&(this.observer=new g(this.mutationWatcher.bind(this)))}j.prototype={watchSubtree:function(e){this.observer&&o.canTarget(e)&&this.observer.observe(e,S)},enableOnSubtree:function(e){this.watchSubtree(e),e===document&&document.readyState!=="complete"?this.installOnLoad():this.installNewSubtree(e)},installNewSubtree:function(e){L(this.findElements(e),this.addElement,this)},findElements:function(e){return e.querySelectorAll?e.querySelectorAll(M):[]},removeElement:function(e){this.removeCallback(e)},addElement:function(e){this.addCallback(e)},elementChanged:function(e,t){this.changedCallback(e,t)},concatLists:function(e,t){return e.concat(T(t))},installOnLoad:function(){document.addEventListener("readystatechange",function(){document.readyState==="complete"&&this.installNewSubtree(document)}.bind(this))},isElement:function(e){return e.nodeType===Node.ELEMENT_NODE},flattenMutationTree:function(e){var t=N(e,this.findElements,this);return t.push(F(e,this.isElement)),t.reduce(this.concatLists,[])},mutationWatcher:function(e){e.forEach(this.mutationHandler,this)},mutationHandler:function(e){if(e.type==="childList"){var t,n=this.flattenMutationTree(e.addedNodes);n.forEach(this.addElement,this),t=this.flattenMutationTree(e.removedNodes
4),t.forEach(this.removeElement,this)}else e.type==="attributes"&&this.elementChanged(e.target,e.oldValue)}};function A(e){return"body /shadow-deep/ "+_(e)}function _(e){return'[touch-action="'+e+'"]'}function l(e){return"{ -ms-touch-action: "+e+"; touch-action: "+e+"; }"}E=["none","auto","pan-x","pan-y",{rule:"pan-x pan-y",selectors:["pan-x pan-y","pan-y pan-x"]}],i="",x=window.PointerEvent||window.MSPointerEvent,O=!window.ShadowDOMPolyfill&&document.head.createShadowRoot;function ee(){if(x){E.forEach(function(e){String(e)===e?(i+=_(e)+l(e)+` 5`,O&&(i+=A(e)+l(e)+` 6`)):(i+=e.selectors.map(_)+l(e.rule)+` 7`,O&&(i+=e.selectors.map(A)+l(e.rule)+` 8`))});var e=document.createElement("style");e.textContent=i,document.head.appendChild(e)}}n=e.pointermap,b=25,d=[1,4,2,8,16],s=!1;try{s=new MouseEvent("test",{buttons:1}).buttons===1}catch{}f={POINTER_ID:1,POINTER_TYPE:"mouse",events:["mousedown","mousemove","mouseup","mouseover","mouseout"],register:function(t){e.listen(t,this.events)},unregister:function(t){e.unlisten(t,this.events)},lastTouches:[],isEventSimulatedFromTouch:function(e){for(var n,o,i,s=this.lastTouches,a=e.clientX,r=e.clientY,t=0,c=s.length;t<c&&(n=s[t]);t++)if(o=Math.abs(a-n.x),i=Math.abs(r-n.y),o<=b&&i<=b)return!0},prepareEvent:function(t){var n=e.cloneEvent(t),s=n.preventDefault;return n.preventDefault=function(){t.preventDefault(),s()},n.pointerId=this.POINTER_ID,n.isPrimary=!0,n.pointerType=this.POINTER_TYPE,n},prepareButtonsForMove:function(e,t){var s=n.get(this.POINTER_ID);t.which===0||!s?e.buttons=0:e.buttons=s.buttons,t.buttons=e.buttons},mousedown:function(t){if(!this.isEventSimulatedFromTouch(t)){var i=n.get(this.POINTER_ID),o=this.prepareEvent(t);s||(o.buttons=d[o.button],i&&(o.buttons|=i.buttons),t.buttons=o.buttons),n.set(this.POINTER_ID,t),!i||i.buttons===0?e.down(o):e.move(o)}},mousemove:function(t){if(!this.isEventSimulatedFromTouch(t)){var o=this.prepareEvent(t);s||this.prepareButtonsForMove(o,t),o.button=-1,n.set(this.POINTER_ID,t),e.move(o)}},mouseup:function(t){if(!this.isEventSimulatedFromTouch(t)){var a,i=n.get(this.POINTER_ID),o=this.prepareEvent(t);s||(a=d[o.button],o.buttons=i?i.buttons&~a:0,t.buttons=o.buttons),n.set(this.POINTER_ID,t),o.buttons&=~d[o.button],o.buttons===0?e.up(o):e.move(o)}},mouseover:function(t){if(!this.isEventSimulatedFromTouch(t)){var o=this.prepareEvent(t);s||this.prepareButtonsForMove(o,t),o.button=-1,n.set(this.POINTER_ID,t),e.enterOver(o)}},mouseout:function(t){if(!this.isEventSimulatedFromTouch(t)){var n=this.prepareEvent(t);s||this.prepareButtonsForMove(n,t),n.button=-1,e.leaveOut(n)}},cancel:function(t){var n=this.prepareEvent(t);e.cancel(n),this.deactivateMouse()},deactivateMouse:function(){n.delete(this.POINTER_ID)}},z=e.captureInfo,D=o.findTarget.bind(o),u=o.allShadows.bind(o),t=e.pointermap,R=2500,P=200,m="touch-action",a={events:["touchstart","touchmove","touchend","touchcancel"],register:function(e){I.enableOnSubtree(e)},unregister:function(){},elementAdded:function(t){var s=t.getAttribute(m),n=this.touchActionToScrollType(s);n&&(t._scrollType=n,e.listen(t,this.events),u(t).forEach(function(t){t._scrollType=n,e.listen(t,this.events)},this))},elementRemoved:function(t){t._scrollType=0[0],e.unlisten(t,this.events),u(t).forEach(function(t){t._scrollType=0[0],e.unlisten(t,this.events)},this)},elementChanged:function(e,t){var o=e.getAttribute(m),n=this.touchActionToScrollType(o),s=this.touchActionToScrollType(t);n&&s?(e._scrollType=n,u(e).forEach(function(e){e._scrollType=n},this)):s?this.elementRemoved(e):n&&this.elementAdded(e)},scrollTypes:{EMITTER:"none",XSCROLLER:"pan-x",YSCROLLER:"pan-y",SCROLLER:/^(?:pan-x pan-y)|(?:pan-y pan-x)|auto$/},touchActionToScrollType:function(e){var t=e,n=this.scrollTypes;if(t==="none")return"none";if(t===n.XSCROLLER)return"X";if(t===n.YSCROLLER)return"Y";if(n.SCROLLER.exec(t))return"XY"},POINTER_TYPE:"touch",firstTouch:null,isPrimaryTouch:function(e){return this.firstTouch===e.identifier},setPrimaryTouch:function(e){(t.size===0||t.size===1&&t.has(1))&&(this.firstTouch=e.identifier,this.firstXY={X:e.clientX,Y:e.clientY},this.scrolling=!1,this.cancelResetClickCount())},removePrimaryPointer:function(e){e.isPrimary&&(this.firstTouch=null,this.firstXY=null,this.resetClickCount())},clickCount:0,resetId:null,resetClickCount:function(){var e=function(){this.clickCount=0,this.resetId=null}.bind(this);this.resetId=setTimeout(e,P)},cancelResetClickCount:function(){this.resetId&&clearTimeout(this.resetId)},typeToButtons:function(e){var t=0;return(e==="touchstart"||e==="touchmove")&&(t=1),t},touchToPointer:function(t){var o,s=this.currentTouchEvent,n=e.cloneEvent(t),i=n.pointerId=t.identifier+2;return n.target=z[i]||D(n),n.bubbles=!0,n.cancelable=!0,n.detail=this.clickCount,n.button=0,n.buttons=this.typeToButtons(s.type),n.width=(t.radiusX||t.webkitRadiusX||0)*2,n.height=(t.radiusY||t.webkitRadiusY||0)*2,n.pressure=t.force||t.webkitForce||.5,n.isPrimary=this.isPrimaryTouch(t),n.pointerType=this.POINTER_TYPE,n.altKey=s.altKey,n.ctrlKey=s.
8ctrlKey,n.metaKey=s.metaKey,n.shiftKey=s.shiftKey,o=this,n.preventDefault=function(){o.scrolling=!1,o.firstXY=null,s.preventDefault()},n},processTouches:function(e,t){var n,o,s=e.changedTouches;this.currentTouchEvent=e;for(n=0;n<s.length;n++)o=s[n],t.call(this,this.touchToPointer(o))},shouldScroll:function(e){if(this.firstXY){var t,s,o,i,a,r,n=e.currentTarget._scrollType;return n==="none"?t=!1:n==="XY"?t=!0:(s=e.changedTouches[0],o=n,i=n==="Y"?"X":"Y",a=Math.abs(s["client"+o]-this.firstXY[o]),r=Math.abs(s["client"+i]-this.firstXY[i]),t=a>=r),this.firstXY=null,t}},findTouch:function(e,t){for(var s,n=0,o=e.length;n<o&&(s=e[n]);n++)if(s.identifier===t)return!0},vacuumTouches:function(e){var n,s=e.touches;t.size>=s.length&&(n=[],t.forEach(function(e,t){if(t!==1&&!this.findTouch(s,t-2)){var o=e.out;n.push(o)}},this),n.forEach(this.cancelOut,this))},touchstart:function(e){this.vacuumTouches(e),this.setPrimaryTouch(e.changedTouches[0]),this.dedupSynthMouse(e),this.scrolling||(this.clickCount++,this.processTouches(e,this.overDown))},overDown:function(n){t.set(n.pointerId,{target:n.target,out:n,outTarget:n.target}),e.enterOver(n),e.down(n)},touchmove:function(e){this.scrolling||(this.shouldScroll(e)?(this.scrolling=!0,this.touchcancel(e)):(e.preventDefault(),this.processTouches(e,this.moveOverOut)))},moveOverOut:function(n){var i,a,s=n,o=t.get(s.pointerId);if(!o)return;i=o.out,a=o.outTarget,e.move(s),i&&a!==s.target&&(i.relatedTarget=s.target,s.relatedTarget=a,i.target=a,s.target?(e.leaveOut(i),e.enterOver(s)):(s.target=a,s.relatedTarget=null,this.cancelOut(s))),o.out=s,o.outTarget=s.target},touchend:function(e){this.dedupSynthMouse(e),this.processTouches(e,this.upOut)},upOut:function(t){this.scrolling||(e.up(t),e.leaveOut(t)),this.cleanUpPointer(t)},touchcancel:function(e){this.processTouches(e,this.cancelOut)},cancelOut:function(t){e.cancel(t),e.leaveOut(t),this.cleanUpPointer(t)},cleanUpPointer:function(e){t.delete(e.pointerId),this.removePrimaryPointer(e)},dedupSynthMouse:function(e){var n,o,s=f.lastTouches,t=e.changedTouches[0];this.isPrimaryTouch(t)&&(n={x:t.clientX,y:t.clientY},s.push(n),o=function(e,t){var n=e.indexOf(t);n>-1&&e.splice(n,1)}.bind(null,s,n),setTimeout(o,R))}},I=new j(a.elementAdded,a.elementRemoved,a.elementChanged,a),p=e.pointermap,$=window.MSPointerEvent&&typeof window.MSPointerEvent.MSPOINTER_TYPE_MOUSE=="number",W={events:["MSPointerDown","MSPointerMove","MSPointerUp","MSPointerOut","MSPointerOver","MSPointerCancel","MSGotPointerCapture","MSLostPointerCapture"],register:function(t){e.listen(t,this.events)},unregister:function(t){e.unlisten(t,this.events)},POINTER_TYPES:["","unavailable","touch","pen","mouse"],prepareEvent:function(t){var n=t;return $&&(n=e.cloneEvent(t),n.pointerType=this.POINTER_TYPES[t.pointerType]),n},cleanup:function(e){p.delete(e)},MSPointerDown:function(t){p.set(t.pointerId,t);var n=this.prepareEvent(t);e.down(n)},MSPointerMove:function(t){var n=this.prepareEvent(t);e.move(n)},MSPointerUp:function(t){var n=this.prepareEvent(t);e.up(n),this.cleanup(t.pointerId)},MSPointerOut:function(t){var n=this.prepareEvent(t);e.leaveOut(n)},MSPointerOver:function(t){var n=this.prepareEvent(t);e.enterOver(n)},MSPointerCancel:function(t){var n=this.prepareEvent(t);e.cancel(n),this.cleanup(t.pointerId)},MSLostPointerCapture:function(t){var n=e.makeEvent("lostpointercapture",t);e.dispatchEvent(n)},MSGotPointerCapture:function(t){var n=e.makeEvent("gotpointercapture",t);e.dispatchEvent(n)}};function Z(){if(!window.PointerEvent){if(window.PointerEvent=r,window.navigator.msPointerEnabled){var t=window.navigator.msMaxTouchPoints;Object.defineProperty(window.navigator,"maxTouchPoints",{value:t,enumerable:!0}),e.registerSource("ms",W)}else Object.defineProperty(window.navigator,"maxTouchPoints",{value:0,enumerable:!0}),e.registerSource("mouse",f),window.ontouchstart!==0[0]&&e.registerSource("touch",a);e.register(document)}}K=window.navigator;function c(t){if(!e.pointermap.has(t)){var n=new Error("InvalidPointerId");throw n.name="InvalidPointerId",n}}function X(e){for(var n,t=e.parentNode;t&&t!==e.ownerDocument;)t=t.parentNode;if(!t)throw n=new Error("InvalidStateError"),n.name="InvalidStateError",n}function U(t){var n=e.pointermap.get(t);return n.buttons!==0}K.msPointerEnabled?(v=function(t){c(t),X(this),U(t)&&(e.setCapture(t,this,!0),this.msSetPointerCapture(t))},w=function(t){c(t),e.releaseCapture(t,!0),this.msReleasePointerCapture(t)}):(v=function(n){c(n),X(this),U(n)&&e.setCapture(n,this)},w=function(n){c(n),e.releaseCapture(n)}),G=function(n){return!!e.captureInfo[n]};function J(){window.Element&&!Element.prototype.setPointerCapture&&Object.defineProperties(Element.prototype,{setPointerCapture:{value:v},releasePointerCapture:{value:w},hasPointerCapture:{value:G}})}return ee(),Z(),J(),k={dispatcher:e,Installer:j,PointerEvent:r,PointerMap:y,targetFinding:o},k})
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.