Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pixi/events

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/events - npm Package Compare versions

Comparing version 6.2.2 to 6.3.0

6

dist/browser/events.min.js
/*!
* @pixi/events - v6.2.2
* Compiled Wed, 26 Jan 2022 16:23:27 UTC
* @pixi/events - v6.3.0
* Compiled Wed, 23 Mar 2022 18:58:56 UTC
*

@@ -8,3 +8,3 @@ * @pixi/events is licensed under the MIT License.

*/
this.PIXI=this.PIXI||{};var _pixi_events=function(t,e,n,o){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function r(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var s=function(){function t(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=t.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new n.Point,this.page=new n.Point,this.AT_TARGET=1,this.BUBBLING_PHASE=2,this.CAPTURING_PHASE=3,this.NONE=0,this.manager=e}return Object.defineProperty(t.prototype,"layerX",{get:function(){return this.layer.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layerY",{get:function(){return this.layer.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageX",{get:function(){return this.page.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageY",{get:function(){return this.page.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this},enumerable:!1,configurable:!0}),t.prototype.composedPath=function(){return!this.manager||this.path&&this.path[this.path.length-1]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path},t.prototype.initEvent=function(t,e,n){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")},t.prototype.preventDefault=function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0},t.prototype.stopImmediatePropagation=function(){this.propagationImmediatelyStopped=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t}(),a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.client=new n.Point,e.movement=new n.Point,e.offset=new n.Point,e.global=new n.Point,e.screen=new n.Point,e}return r(e,t),Object.defineProperty(e.prototype,"clientX",{get:function(){return this.client.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clientY",{get:function(){return this.client.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x",{get:function(){return this.clientX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this.clientY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"movementX",{get:function(){return this.movement.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"movementY",{get:function(){return this.movement.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"offsetX",{get:function(){return this.offset.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"offsetY",{get:function(){return this.offset.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalX",{get:function(){return this.global.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalY",{get:function(){return this.global.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"screenX",{get:function(){return this.screen.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"screenY",{get:function(){return this.screen.y},enumerable:!1,configurable:!0}),e.prototype.getModifierState=function(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)},e.prototype.initMouseEvent=function(t,e,n,o,i,r,s,a,p,h,u,c,l,v,d){throw new Error("Method not implemented.")},e}(s),p=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.width=0,e.height=0,e.isPrimary=!1,e}return r(e,t),e.prototype.getCoalescedEvents=function(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]},e.prototype.getPredictedEvents=function(){throw new Error("getPredictedEvents is not supported!")},e}(a),h=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.DOM_DELTA_LINE=0,e.DOM_DELTA_PAGE=1,e.DOM_DELTA_PIXEL=2,e}return r(e,t),e}(a),u=new n.Point,c=new n.Point,l=function(){function t(t){this.dispatch=new e.EventEmitter,this.moveOnAll=!1,this.mappingState={trackingData:{}},this.eventPool=new Map,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}return t.prototype.addEventMapping=function(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(function(t,e){return t.priority-e.priority})},t.prototype.dispatchEvent=function(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)},t.prototype.mapEvent=function(t){if(this.rootTarget){var e=this.mappingTable[t.type];if(e)for(var n=0,o=e.length;n<o;n++)e[n].fn(t);else console.warn("[EventBoundary]: Event mapping not defined for "+t.type)}},t.prototype.hitTest=function(t,e){var n=this.hitTestRecursive(this.rootTarget,this.rootTarget.interactive,u.set(t,e),this.hitTestFn,this.hitPruneFn);return n&&n[0]},t.prototype.propagate=function(t,e){if(t.target){var n=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(var o=0,i=n.length-1;o<i;o++)if(t.currentTarget=n[o],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){t.eventPhase=t.BUBBLING_PHASE;for(o=n.length-2;o>=0;o--)if(t.currentTarget=n[o],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}},t.prototype.all=function(t,e,n){void 0===n&&(n=this.rootTarget),t.eventPhase=t.BUBBLING_PHASE;var o=n.children;if(o)for(var i=0;i<o.length;i++)this.all(t,e,o[i]);t.currentTarget=n,this.notifyTarget(t,e)},t.prototype.propagationPath=function(t){for(var e=[t],n=0;n<2048&&t!==this.rootTarget;n++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e},t.prototype.hitTestRecursive=function(t,e,n,o,i){if(!t||!t.visible)return null;if(i(t,n))return null;if(t.interactiveChildren&&t.children)for(var r=t.children,s=r.length-1;s>=0;s--){var a=r[s],p=this.hitTestRecursive(a,e||a.interactive,n,o,i);if(p){if(p.length>0&&!p[p.length-1].parent)continue;return(p.length>0||t.interactive)&&p.push(t),p}}return e&&o(t,n)?t.interactive?[t]:[]:null},t.prototype.hitPruneFn=function(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,c),!t.hitArea.contains(c.x,c.y)))return!0;if(t._mask){var n=t._mask;if(!n.containsPoint||!n.containsPoint(e))return!0}return!1},t.prototype.hitTestFn=function(t,e){return!!t.hitArea||!!t.containsPoint&&t.containsPoint(e)},t.prototype.notifyTarget=function(t,e){e=null!=e?e:t.type;var n=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?e+"capture":e;this.notifyListeners(t,n),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)},t.prototype.mapPointerDown=function(t){if(t instanceof p){var e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType)this.dispatchEvent(e,"touchstart");else if("mouse"===e.pointerType||"pen"===e.pointerType){var n=2===e.button;this.dispatchEvent(e,n?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerMove=function(t){var e;if(t instanceof p){var n=this.createPointerEvent(t),o="mouse"===n.pointerType||"pen"===n.pointerType,i=this.trackingData(t.pointerId),r=this.findMountedTarget(i.overTargets);if(i.overTargets&&r!==n.target){var s="mousemove"===t.type?"mouseout":"pointerout",a=this.createPointerEvent(t,s,r);if(this.dispatchEvent(a,"pointerout"),o&&this.dispatchEvent(a,"mouseout"),!n.composedPath().includes(r)){var h=this.createPointerEvent(t,"pointerleave",r);for(h.eventPhase=h.AT_TARGET;h.target&&!n.composedPath().includes(h.target);)h.currentTarget=h.target,this.notifyTarget(h),o&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;this.freeEvent(h)}this.freeEvent(a)}if(r!==n.target){var u="mousemove"===t.type?"mouseover":"pointerover",c=this.clonePointerEvent(n,u);this.dispatchEvent(c,"pointerover"),o&&this.dispatchEvent(c,"mouseover");for(var l=null==r?void 0:r.parent;l&&l!==this.rootTarget.parent&&l!==n.target;)l=l.parent;if(!l||l===this.rootTarget.parent){var v=this.clonePointerEvent(n,"pointerenter");for(v.eventPhase=v.AT_TARGET;v.target&&v.target!==r&&v.target!==this.rootTarget.parent;)v.currentTarget=v.target,this.notifyTarget(v),o&&this.notifyTarget(v,"mouseenter"),v.target=v.target.parent;this.freeEvent(v)}this.freeEvent(c)}var d=this.moveOnAll?"all":"dispatchEvent";this[d](n,"pointermove"),"touch"===n.pointerType&&this[d](n,"touchmove"),o&&(this[d](n,"mousemove"),this.cursor=null===(e=n.target)||void 0===e?void 0:e.cursor),i.overTargets=n.composedPath(),this.freeEvent(n)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerOver=function(t){var e;if(t instanceof p){var n=this.trackingData(t.pointerId),o=this.createPointerEvent(t),i="mouse"===o.pointerType||"pen"===o.pointerType;this.dispatchEvent(o,"pointerover"),i&&this.dispatchEvent(o,"mouseover"),"mouse"===o.pointerType&&(this.cursor=null===(e=o.target)||void 0===e?void 0:e.cursor);var r=this.clonePointerEvent(o,"pointerenter");for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),i&&this.notifyTarget(r,"mouseenter"),r.target=r.target.parent;n.overTargets=o.composedPath(),this.freeEvent(o),this.freeEvent(r)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerOut=function(t){if(t instanceof p){var e=this.trackingData(t.pointerId);if(e.overTargets){var n="mouse"===t.pointerType||"pen"===t.pointerType,o=this.findMountedTarget(e.overTargets),i=this.createPointerEvent(t,"pointerout",o);this.dispatchEvent(i),n&&this.dispatchEvent(i,"mouseout");var r=this.createPointerEvent(t,"pointerleave",o);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),n&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;e.overTargets=null,this.freeEvent(i),this.freeEvent(r)}this.cursor=null}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerUp=function(t){if(t instanceof p){var e=performance.now(),n=this.createPointerEvent(t);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if("mouse"===n.pointerType||"pen"===n.pointerType){var o=2===n.button;this.dispatchEvent(n,o?"rightup":"mouseup")}var i=this.trackingData(t.pointerId),r=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=r;if(r&&!n.composedPath().includes(r)){for(var a=r;a&&!n.composedPath().includes(a);){if(n.currentTarget=a,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if("mouse"===n.pointerType||"pen"===n.pointerType){o=2===n.button;this.notifyTarget(n,o?"rightupoutside":"mouseupoutside")}a=a.parent}delete i.pressTargetsByButton[t.button],s=a}if(s){var h=this.clonePointerEvent(n,"click");h.target=s,h.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:h.target,timeStamp:e});var u=i.clicksByButton[t.button];u.target===h.target&&e-u.timeStamp<200?++u.clickCount:u.clickCount=1,u.target=h.target,u.timeStamp=e,h.detail=u.clickCount,"mouse"===h.pointerType?this.dispatchEvent(h,"click"):"touch"===h.pointerType?this.dispatchEvent(h,"tap"):this.dispatchEvent(h,"pointertap"),this.freeEvent(h)}this.freeEvent(n)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerUpOutside=function(t){if(t instanceof p){var e=this.trackingData(t.pointerId),n=this.findMountedTarget(e.pressTargetsByButton[t.button]),o=this.createPointerEvent(t);if(n){for(var i=n;i;)o.currentTarget=i,this.notifyTarget(o,"pointerupoutside"),"touch"===o.pointerType?this.notifyTarget(o,"touchendoutside"):"mouse"!==o.pointerType&&"pen"!==o.pointerType||this.notifyTarget(o,2===o.button?"rightupoutside":"mouseupoutside"),i=i.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(o)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapWheel=function(t){if(t instanceof h){var e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}else console.warn("EventBoundary cannot map a non-wheel event as a wheel event")},t.prototype.findMountedTarget=function(t){if(!t)return null;for(var e=t[0],n=1;n<t.length&&t[n].parent===e;n++)e=t[n];return e},t.prototype.createPointerEvent=function(t,e,n){var o=this.allocateEvent(p);return this.copyPointerData(t,o),this.copyMouseData(t,o),this.copyData(t,o),o.nativeEvent=t.nativeEvent,o.originalEvent=t,o.target=null!=n?n:this.hitTest(o.global.x,o.global.y),"string"==typeof e&&(o.type=e),o},t.prototype.createWheelEvent=function(t){var e=this.allocateEvent(h);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e},t.prototype.clonePointerEvent=function(t,e){var n=this.allocateEvent(p);return n.nativeEvent=t.nativeEvent,n.originalEvent=t.originalEvent,this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.target=t.target,n.path=t.composedPath().slice(),n.type=null!=e?e:n.type,n},t.prototype.copyWheelData=function(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ},t.prototype.copyPointerData=function(t,e){t instanceof p&&e instanceof p&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)},t.prototype.copyMouseData=function(t,e){t instanceof a&&e instanceof a&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.global.copyFrom(t.global))},t.prototype.copyData=function(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)},t.prototype.trackingData=function(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]},t.prototype.allocateEvent=function(t){this.eventPool.has(t)||this.eventPool.set(t,[]);var e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e},t.prototype.freeEvent=function(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)},t.prototype.notifyListeners=function(t,e){var n=t.currentTarget._events[e];if(n)if("fn"in n)n.fn.call(n.context,t);else for(var o=0,i=n.length;o<i&&!t.propagationImmediatelyStopped;o++)n[o].fn.call(n[o].context,t)},t}(),v={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},d=function(){function t(t){if(this.supportsTouchEvents="ontouchstart"in self,this.supportsPointerEvents=!!self.PointerEvent,this.resolution=1,t.plugins.interaction)throw new Error("EventSystem cannot initialize with the InteractionManager installed!");this.renderer=t,this.rootBoundary=new l(null),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new p(null),this.rootWheelEvent=new h(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.domElement=t.view,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this),this.setTargetElement(this.domElement),this.resolution=this.renderer.resolution}return t.prototype.destroy=function(){this.setTargetElement(null),this.renderer=null},t.prototype.setCursor=function(t){t=t||"default";var e=!0;if(self.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor!==t){this.currentCursor=t;var n=this.cursorStyles[t];if(n)switch(typeof n){case"string":e&&(this.domElement.style.cursor=n);break;case"function":n(t);break;case"object":e&&Object.assign(this.domElement.style,n)}else e&&"string"==typeof t&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}},t.prototype.onPointerDown=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t);if(this.autoPreventDefault&&e[0].isNormalized)(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(var n=0,o=e.length;n<o;n++){var i=e[n],r=this.bootstrapEvent(this.rootPointerEvent,i);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onPointerMove=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){for(var e=this.normalizeToPointerData(t),n=0,o=e.length;n<o;n++){var i=this.bootstrapEvent(this.rootPointerEvent,e[n]);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onPointerUp=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){for(var e=t.target!==this.domElement?"outside":"",n=this.normalizeToPointerData(t),o=0,i=n.length;o<i;o++){var r=this.bootstrapEvent(this.rootPointerEvent,n[o]);r.type+=e,this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onPointerOverOut=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){for(var e=this.normalizeToPointerData(t),n=0,o=e.length;n<o;n++){var i=this.bootstrapEvent(this.rootPointerEvent,e[n]);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onWheel=function(t){var e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,this.rootBoundary.mapEvent(e)},t.prototype.setTargetElement=function(t){this.removeEvents(),this.domElement=t,this.addEvents()},t.prototype.addEvents=function(){if(!this.eventsAdded&&this.domElement){var t=this.domElement.style;self.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none"),this.supportsPointerEvents?(self.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),self.addEventListener("pointerup",this.onPointerUp,!0)):(self.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),self.addEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0)),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}},t.prototype.removeEvents=function(){if(this.eventsAdded&&this.domElement){var t=this.domElement.style;self.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(self.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),self.removeEventListener("pointerup",this.onPointerUp,!0)):(self.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),self.removeEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0)),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}},t.prototype.mapPositionToPoint=function(t,e,n){var o;o=this.domElement.parentElement?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0};var i=1/this.resolution;t.x=(e-o.left)*(this.domElement.width/o.width)*i,t.y=(n-o.top)*(this.domElement.height/o.height)*i},t.prototype.normalizeToPointerData=function(t){var e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(var n=0,o=t.changedTouches.length;n<o;n++){var i=t.changedTouches[n];void 0===i.button&&(i.button=t.touches.length?1:0),void 0===i.buttons&&(i.buttons=t.touches.length?1:0),void 0===i.isPrimary&&(i.isPrimary=1===t.touches.length&&"touchstart"===t.type),void 0===i.width&&(i.width=i.radiusX||1),void 0===i.height&&(i.height=i.radiusY||1),void 0===i.tiltX&&(i.tiltX=0),void 0===i.tiltY&&(i.tiltY=0),void 0===i.pointerType&&(i.pointerType="touch"),void 0===i.pointerId&&(i.pointerId=i.identifier||0),void 0===i.pressure&&(i.pressure=i.force||.5),void 0===i.twist&&(i.twist=0),void 0===i.tangentialPressure&&(i.tangentialPressure=0),void 0===i.layerX&&(i.layerX=i.offsetX=i.clientX),void 0===i.layerY&&(i.layerY=i.offsetY=i.clientY),i.isNormalized=!0,i.type=t.type,e.push(i)}else if(self.MouseEvent&&(!(t instanceof MouseEvent)||this.supportsPointerEvents&&t instanceof self.PointerEvent))e.push(t);else{var r=t;void 0===r.isPrimary&&(r.isPrimary=!0),void 0===r.width&&(r.width=1),void 0===r.height&&(r.height=1),void 0===r.tiltX&&(r.tiltX=0),void 0===r.tiltY&&(r.tiltY=0),void 0===r.pointerType&&(r.pointerType="mouse"),void 0===r.pointerId&&(r.pointerId=1),void 0===r.pressure&&(r.pressure=.5),void 0===r.twist&&(r.twist=0),void 0===r.tangentialPressure&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}return e},t.prototype.normalizeWheelEvent=function(t){var e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e},t.prototype.bootstrapEvent=function(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=v[t.type]||t.type),t},t.prototype.transferMouseData=function(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null},t}(),m={interactive:!1,interactiveChildren:!0,hitArea:null,addEventListener:function(t,e,n){var o="function"==typeof e?void 0:e;t="boolean"==typeof n&&n||"object"==typeof n&&n.capture?t+"capture":t,e="function"==typeof e?e:e.handleEvent,this.on(t,e,o)},removeEventListener:function(t,e,n){var o="function"==typeof e?void 0:e;t="boolean"==typeof n&&n||"object"==typeof n&&n.capture?t+"capture":t,e="function"==typeof e?e:e.handleEvent,this.off(t,e,o)},dispatchEvent:function(t){if(!(t instanceof s))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}};return o.DisplayObject.mixin(m),t.EventBoundary=l,t.EventSystem=d,t.FederatedDisplayObject=m,t.FederatedEvent=s,t.FederatedMouseEvent=a,t.FederatedPointerEvent=p,t.FederatedWheelEvent=h,t}({},PIXI.utils,PIXI,PIXI);Object.assign(this.PIXI,_pixi_events);
this.PIXI=this.PIXI||{};var _pixi_events=function(t,e,n,o){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function r(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var s=function(){function t(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=t.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new n.Point,this.page=new n.Point,this.AT_TARGET=1,this.BUBBLING_PHASE=2,this.CAPTURING_PHASE=3,this.NONE=0,this.manager=e}return Object.defineProperty(t.prototype,"layerX",{get:function(){return this.layer.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layerY",{get:function(){return this.layer.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageX",{get:function(){return this.page.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageY",{get:function(){return this.page.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this},enumerable:!1,configurable:!0}),t.prototype.composedPath=function(){return!this.manager||this.path&&this.path[this.path.length-1]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path},t.prototype.initEvent=function(t,e,n){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")},t.prototype.preventDefault=function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0},t.prototype.stopImmediatePropagation=function(){this.propagationImmediatelyStopped=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t}(),a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.client=new n.Point,e.movement=new n.Point,e.offset=new n.Point,e.global=new n.Point,e.screen=new n.Point,e}return r(e,t),Object.defineProperty(e.prototype,"clientX",{get:function(){return this.client.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clientY",{get:function(){return this.client.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x",{get:function(){return this.clientX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this.clientY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"movementX",{get:function(){return this.movement.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"movementY",{get:function(){return this.movement.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"offsetX",{get:function(){return this.offset.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"offsetY",{get:function(){return this.offset.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalX",{get:function(){return this.global.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalY",{get:function(){return this.global.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"screenX",{get:function(){return this.screen.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"screenY",{get:function(){return this.screen.y},enumerable:!1,configurable:!0}),e.prototype.getModifierState=function(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)},e.prototype.initMouseEvent=function(t,e,n,o,i,r,s,a,p,h,u,l,c,v,d){throw new Error("Method not implemented.")},e}(s),p=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.width=0,e.height=0,e.isPrimary=!1,e}return r(e,t),e.prototype.getCoalescedEvents=function(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]},e.prototype.getPredictedEvents=function(){throw new Error("getPredictedEvents is not supported!")},e}(a),h=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.DOM_DELTA_LINE=0,e.DOM_DELTA_PAGE=1,e.DOM_DELTA_PIXEL=2,e}return r(e,t),e}(a),u=new n.Point,l=new n.Point,c=function(){function t(t){this.dispatch=new e.EventEmitter,this.moveOnAll=!1,this.mappingState={trackingData:{}},this.eventPool=new Map,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}return t.prototype.addEventMapping=function(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(function(t,e){return t.priority-e.priority})},t.prototype.dispatchEvent=function(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)},t.prototype.mapEvent=function(t){if(this.rootTarget){var e=this.mappingTable[t.type];if(e)for(var n=0,o=e.length;n<o;n++)e[n].fn(t);else console.warn("[EventBoundary]: Event mapping not defined for "+t.type)}},t.prototype.hitTest=function(t,e){var n=this.hitTestRecursive(this.rootTarget,this.rootTarget.interactive,u.set(t,e),this.hitTestFn,this.hitPruneFn);return n&&n[0]},t.prototype.propagate=function(t,e){if(t.target){var n=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(var o=0,i=n.length-1;o<i;o++)if(t.currentTarget=n[o],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){t.eventPhase=t.BUBBLING_PHASE;for(o=n.length-2;o>=0;o--)if(t.currentTarget=n[o],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}},t.prototype.all=function(t,e,n){void 0===n&&(n=this.rootTarget),t.eventPhase=t.BUBBLING_PHASE;var o=n.children;if(o)for(var i=0;i<o.length;i++)this.all(t,e,o[i]);t.currentTarget=n,this.notifyTarget(t,e)},t.prototype.propagationPath=function(t){for(var e=[t],n=0;n<2048&&t!==this.rootTarget;n++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e},t.prototype.hitTestRecursive=function(t,e,n,o,i){if(!t||!t.visible)return null;if(i(t,n))return null;if(t.interactiveChildren&&t.children)for(var r=t.children,s=r.length-1;s>=0;s--){var a=r[s],p=this.hitTestRecursive(a,e||a.interactive,n,o,i);if(p){if(p.length>0&&!p[p.length-1].parent)continue;return(p.length>0||t.interactive)&&p.push(t),p}}return e&&o(t,n)?t.interactive?[t]:[]:null},t.prototype.hitPruneFn=function(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,l),!t.hitArea.contains(l.x,l.y)))return!0;if(t._mask){var n=t._mask;if(!n.containsPoint||!n.containsPoint(e))return!0}return!1},t.prototype.hitTestFn=function(t,e){return!!t.hitArea||!!t.containsPoint&&t.containsPoint(e)},t.prototype.notifyTarget=function(t,e){e=null!=e?e:t.type;var n=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?e+"capture":e;this.notifyListeners(t,n),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)},t.prototype.mapPointerDown=function(t){if(t instanceof p){var e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType)this.dispatchEvent(e,"touchstart");else if("mouse"===e.pointerType||"pen"===e.pointerType){var n=2===e.button;this.dispatchEvent(e,n?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerMove=function(t){var e;if(t instanceof p){var n=this.createPointerEvent(t),o="mouse"===n.pointerType||"pen"===n.pointerType,i=this.trackingData(t.pointerId),r=this.findMountedTarget(i.overTargets);if(i.overTargets&&r!==n.target){var s="mousemove"===t.type?"mouseout":"pointerout",a=this.createPointerEvent(t,s,r);if(this.dispatchEvent(a,"pointerout"),o&&this.dispatchEvent(a,"mouseout"),!n.composedPath().includes(r)){var h=this.createPointerEvent(t,"pointerleave",r);for(h.eventPhase=h.AT_TARGET;h.target&&!n.composedPath().includes(h.target);)h.currentTarget=h.target,this.notifyTarget(h),o&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;this.freeEvent(h)}this.freeEvent(a)}if(r!==n.target){var u="mousemove"===t.type?"mouseover":"pointerover",l=this.clonePointerEvent(n,u);this.dispatchEvent(l,"pointerover"),o&&this.dispatchEvent(l,"mouseover");for(var c=null==r?void 0:r.parent;c&&c!==this.rootTarget.parent&&c!==n.target;)c=c.parent;if(!c||c===this.rootTarget.parent){var v=this.clonePointerEvent(n,"pointerenter");for(v.eventPhase=v.AT_TARGET;v.target&&v.target!==r&&v.target!==this.rootTarget.parent;)v.currentTarget=v.target,this.notifyTarget(v),o&&this.notifyTarget(v,"mouseenter"),v.target=v.target.parent;this.freeEvent(v)}this.freeEvent(l)}var d=this.moveOnAll?"all":"dispatchEvent";this[d](n,"pointermove"),"touch"===n.pointerType&&this[d](n,"touchmove"),o&&(this[d](n,"mousemove"),this.cursor=null===(e=n.target)||void 0===e?void 0:e.cursor),i.overTargets=n.composedPath(),this.freeEvent(n)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerOver=function(t){var e;if(t instanceof p){var n=this.trackingData(t.pointerId),o=this.createPointerEvent(t),i="mouse"===o.pointerType||"pen"===o.pointerType;this.dispatchEvent(o,"pointerover"),i&&this.dispatchEvent(o,"mouseover"),"mouse"===o.pointerType&&(this.cursor=null===(e=o.target)||void 0===e?void 0:e.cursor);var r=this.clonePointerEvent(o,"pointerenter");for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),i&&this.notifyTarget(r,"mouseenter"),r.target=r.target.parent;n.overTargets=o.composedPath(),this.freeEvent(o),this.freeEvent(r)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerOut=function(t){if(t instanceof p){var e=this.trackingData(t.pointerId);if(e.overTargets){var n="mouse"===t.pointerType||"pen"===t.pointerType,o=this.findMountedTarget(e.overTargets),i=this.createPointerEvent(t,"pointerout",o);this.dispatchEvent(i),n&&this.dispatchEvent(i,"mouseout");var r=this.createPointerEvent(t,"pointerleave",o);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),n&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;e.overTargets=null,this.freeEvent(i),this.freeEvent(r)}this.cursor=null}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerUp=function(t){if(t instanceof p){var e=performance.now(),n=this.createPointerEvent(t);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if("mouse"===n.pointerType||"pen"===n.pointerType){var o=2===n.button;this.dispatchEvent(n,o?"rightup":"mouseup")}var i=this.trackingData(t.pointerId),r=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=r;if(r&&!n.composedPath().includes(r)){for(var a=r;a&&!n.composedPath().includes(a);){if(n.currentTarget=a,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if("mouse"===n.pointerType||"pen"===n.pointerType){o=2===n.button;this.notifyTarget(n,o?"rightupoutside":"mouseupoutside")}a=a.parent}delete i.pressTargetsByButton[t.button],s=a}if(s){var h=this.clonePointerEvent(n,"click");h.target=s,h.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:h.target,timeStamp:e});var u=i.clicksByButton[t.button];u.target===h.target&&e-u.timeStamp<200?++u.clickCount:u.clickCount=1,u.target=h.target,u.timeStamp=e,h.detail=u.clickCount,"mouse"===h.pointerType?this.dispatchEvent(h,"click"):"touch"===h.pointerType?this.dispatchEvent(h,"tap"):this.dispatchEvent(h,"pointertap"),this.freeEvent(h)}this.freeEvent(n)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerUpOutside=function(t){if(t instanceof p){var e=this.trackingData(t.pointerId),n=this.findMountedTarget(e.pressTargetsByButton[t.button]),o=this.createPointerEvent(t);if(n){for(var i=n;i;)o.currentTarget=i,this.notifyTarget(o,"pointerupoutside"),"touch"===o.pointerType?this.notifyTarget(o,"touchendoutside"):"mouse"!==o.pointerType&&"pen"!==o.pointerType||this.notifyTarget(o,2===o.button?"rightupoutside":"mouseupoutside"),i=i.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(o)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapWheel=function(t){if(t instanceof h){var e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}else console.warn("EventBoundary cannot map a non-wheel event as a wheel event")},t.prototype.findMountedTarget=function(t){if(!t)return null;for(var e=t[0],n=1;n<t.length&&t[n].parent===e;n++)e=t[n];return e},t.prototype.createPointerEvent=function(t,e,n){var o=this.allocateEvent(p);return this.copyPointerData(t,o),this.copyMouseData(t,o),this.copyData(t,o),o.nativeEvent=t.nativeEvent,o.originalEvent=t,o.target=null!=n?n:this.hitTest(o.global.x,o.global.y),"string"==typeof e&&(o.type=e),o},t.prototype.createWheelEvent=function(t){var e=this.allocateEvent(h);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e},t.prototype.clonePointerEvent=function(t,e){var n=this.allocateEvent(p);return n.nativeEvent=t.nativeEvent,n.originalEvent=t.originalEvent,this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.target=t.target,n.path=t.composedPath().slice(),n.type=null!=e?e:n.type,n},t.prototype.copyWheelData=function(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ},t.prototype.copyPointerData=function(t,e){t instanceof p&&e instanceof p&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)},t.prototype.copyMouseData=function(t,e){t instanceof a&&e instanceof a&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.global.copyFrom(t.global))},t.prototype.copyData=function(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)},t.prototype.trackingData=function(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]},t.prototype.allocateEvent=function(t){this.eventPool.has(t)||this.eventPool.set(t,[]);var e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e},t.prototype.freeEvent=function(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)},t.prototype.notifyListeners=function(t,e){var n=t.currentTarget._events[e];if(n)if("fn"in n)n.fn.call(n.context,t);else for(var o=0,i=n.length;o<i&&!t.propagationImmediatelyStopped;o++)n[o].fn.call(n[o].context,t)},t}(),v={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},d=function(){function t(t){if(this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.resolution=1,t.plugins.interaction)throw new Error("EventSystem cannot initialize with the InteractionManager installed!");this.renderer=t,this.rootBoundary=new c(null),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new p(null),this.rootWheelEvent=new h(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.domElement=t.view,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this),this.setTargetElement(this.domElement),this.resolution=this.renderer.resolution}return t.prototype.destroy=function(){this.setTargetElement(null),this.renderer=null},t.prototype.setCursor=function(t){t=t||"default";var e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor!==t){this.currentCursor=t;var n=this.cursorStyles[t];if(n)switch(typeof n){case"string":e&&(this.domElement.style.cursor=n);break;case"function":n(t);break;case"object":e&&Object.assign(this.domElement.style,n)}else e&&"string"==typeof t&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}},t.prototype.onPointerDown=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t);if(this.autoPreventDefault&&e[0].isNormalized)(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(var n=0,o=e.length;n<o;n++){var i=e[n],r=this.bootstrapEvent(this.rootPointerEvent,i);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onPointerMove=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){for(var e=this.normalizeToPointerData(t),n=0,o=e.length;n<o;n++){var i=this.bootstrapEvent(this.rootPointerEvent,e[n]);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onPointerUp=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){for(var e=t.target!==this.domElement?"outside":"",n=this.normalizeToPointerData(t),o=0,i=n.length;o<i;o++){var r=this.bootstrapEvent(this.rootPointerEvent,n[o]);r.type+=e,this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onPointerOverOut=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){for(var e=this.normalizeToPointerData(t),n=0,o=e.length;n<o;n++){var i=this.bootstrapEvent(this.rootPointerEvent,e[n]);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onWheel=function(t){var e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,this.rootBoundary.mapEvent(e)},t.prototype.setTargetElement=function(t){this.removeEvents(),this.domElement=t,this.addEvents()},t.prototype.addEvents=function(){if(!this.eventsAdded&&this.domElement){var t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none"),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0)),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}},t.prototype.removeEvents=function(){if(this.eventsAdded&&this.domElement){var t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0)),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}},t.prototype.mapPositionToPoint=function(t,e,n){var o;o=this.domElement.parentElement?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0};var i=1/this.resolution;t.x=(e-o.left)*(this.domElement.width/o.width)*i,t.y=(n-o.top)*(this.domElement.height/o.height)*i},t.prototype.normalizeToPointerData=function(t){var e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(var n=0,o=t.changedTouches.length;n<o;n++){var i=t.changedTouches[n];void 0===i.button&&(i.button=t.touches.length?1:0),void 0===i.buttons&&(i.buttons=t.touches.length?1:0),void 0===i.isPrimary&&(i.isPrimary=1===t.touches.length&&"touchstart"===t.type),void 0===i.width&&(i.width=i.radiusX||1),void 0===i.height&&(i.height=i.radiusY||1),void 0===i.tiltX&&(i.tiltX=0),void 0===i.tiltY&&(i.tiltY=0),void 0===i.pointerType&&(i.pointerType="touch"),void 0===i.pointerId&&(i.pointerId=i.identifier||0),void 0===i.pressure&&(i.pressure=i.force||.5),void 0===i.twist&&(i.twist=0),void 0===i.tangentialPressure&&(i.tangentialPressure=0),void 0===i.layerX&&(i.layerX=i.offsetX=i.clientX),void 0===i.layerY&&(i.layerY=i.offsetY=i.clientY),i.isNormalized=!0,i.type=t.type,e.push(i)}else if(globalThis.MouseEvent&&(!(t instanceof MouseEvent)||this.supportsPointerEvents&&t instanceof globalThis.PointerEvent))e.push(t);else{var r=t;void 0===r.isPrimary&&(r.isPrimary=!0),void 0===r.width&&(r.width=1),void 0===r.height&&(r.height=1),void 0===r.tiltX&&(r.tiltX=0),void 0===r.tiltY&&(r.tiltY=0),void 0===r.pointerType&&(r.pointerType="mouse"),void 0===r.pointerId&&(r.pointerId=1),void 0===r.pressure&&(r.pressure=.5),void 0===r.twist&&(r.twist=0),void 0===r.tangentialPressure&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}return e},t.prototype.normalizeWheelEvent=function(t){var e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e},t.prototype.bootstrapEvent=function(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=v[t.type]||t.type),t},t.prototype.transferMouseData=function(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null},t}(),m={interactive:!1,interactiveChildren:!0,hitArea:null,addEventListener:function(t,e,n){var o="function"==typeof e?void 0:e;t="boolean"==typeof n&&n||"object"==typeof n&&n.capture?t+"capture":t,e="function"==typeof e?e:e.handleEvent,this.on(t,e,o)},removeEventListener:function(t,e,n){var o="function"==typeof e?void 0:e;t="boolean"==typeof n&&n||"object"==typeof n&&n.capture?t+"capture":t,e="function"==typeof e?e:e.handleEvent,this.off(t,e,o)},dispatchEvent:function(t){if(!(t instanceof s))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}};return o.DisplayObject.mixin(m),t.EventBoundary=c,t.EventSystem=d,t.FederatedDisplayObject=m,t.FederatedEvent=s,t.FederatedMouseEvent=a,t.FederatedPointerEvent=p,t.FederatedWheelEvent=h,t}({},PIXI.utils,PIXI,PIXI);Object.assign(this.PIXI,_pixi_events);
//# sourceMappingURL=events.min.js.map
/*!
* @pixi/events - v6.2.2
* Compiled Wed, 26 Jan 2022 16:23:27 UTC
* @pixi/events - v6.3.0
* Compiled Wed, 23 Mar 2022 18:58:56 UTC
*

@@ -8,3 +8,3 @@ * @pixi/events is licensed under the MIT License.

*/
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var utils=require("@pixi/utils"),math=require("@pixi/math"),display=require("@pixi/display"),extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function __extends(t,e){function n(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var FederatedEvent=function(){function t(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=t.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new math.Point,this.page=new math.Point,this.AT_TARGET=1,this.BUBBLING_PHASE=2,this.CAPTURING_PHASE=3,this.NONE=0,this.manager=e}return Object.defineProperty(t.prototype,"layerX",{get:function(){return this.layer.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layerY",{get:function(){return this.layer.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageX",{get:function(){return this.page.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageY",{get:function(){return this.page.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this},enumerable:!1,configurable:!0}),t.prototype.composedPath=function(){return!this.manager||this.path&&this.path[this.path.length-1]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path},t.prototype.initEvent=function(t,e,n){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")},t.prototype.preventDefault=function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0},t.prototype.stopImmediatePropagation=function(){this.propagationImmediatelyStopped=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t}(),FederatedMouseEvent=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.client=new math.Point,e.movement=new math.Point,e.offset=new math.Point,e.global=new math.Point,e.screen=new math.Point,e}return __extends(e,t),Object.defineProperty(e.prototype,"clientX",{get:function(){return this.client.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clientY",{get:function(){return this.client.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x",{get:function(){return this.clientX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this.clientY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"movementX",{get:function(){return this.movement.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"movementY",{get:function(){return this.movement.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"offsetX",{get:function(){return this.offset.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"offsetY",{get:function(){return this.offset.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalX",{get:function(){return this.global.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalY",{get:function(){return this.global.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"screenX",{get:function(){return this.screen.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"screenY",{get:function(){return this.screen.y},enumerable:!1,configurable:!0}),e.prototype.getModifierState=function(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)},e.prototype.initMouseEvent=function(t,e,n,o,i,r,s,a,p,h,u,d,l,v,c){throw new Error("Method not implemented.")},e}(FederatedEvent),FederatedPointerEvent=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.width=0,e.height=0,e.isPrimary=!1,e}return __extends(e,t),e.prototype.getCoalescedEvents=function(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]},e.prototype.getPredictedEvents=function(){throw new Error("getPredictedEvents is not supported!")},e}(FederatedMouseEvent),FederatedWheelEvent=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.DOM_DELTA_LINE=0,e.DOM_DELTA_PAGE=1,e.DOM_DELTA_PIXEL=2,e}return __extends(e,t),e}(FederatedMouseEvent),PROPAGATION_LIMIT=2048,tempHitLocation=new math.Point,tempLocalMapping=new math.Point,EventBoundary=function(){function t(t){this.dispatch=new utils.EventEmitter,this.moveOnAll=!1,this.mappingState={trackingData:{}},this.eventPool=new Map,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}return t.prototype.addEventMapping=function(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(function(t,e){return t.priority-e.priority})},t.prototype.dispatchEvent=function(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)},t.prototype.mapEvent=function(t){if(this.rootTarget){var e=this.mappingTable[t.type];if(e)for(var n=0,o=e.length;n<o;n++)e[n].fn(t);else console.warn("[EventBoundary]: Event mapping not defined for "+t.type)}},t.prototype.hitTest=function(t,e){var n=this.hitTestRecursive(this.rootTarget,this.rootTarget.interactive,tempHitLocation.set(t,e),this.hitTestFn,this.hitPruneFn);return n&&n[0]},t.prototype.propagate=function(t,e){if(t.target){var n=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(var o=0,i=n.length-1;o<i;o++)if(t.currentTarget=n[o],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){t.eventPhase=t.BUBBLING_PHASE;for(o=n.length-2;o>=0;o--)if(t.currentTarget=n[o],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}},t.prototype.all=function(t,e,n){void 0===n&&(n=this.rootTarget),t.eventPhase=t.BUBBLING_PHASE;var o=n.children;if(o)for(var i=0;i<o.length;i++)this.all(t,e,o[i]);t.currentTarget=n,this.notifyTarget(t,e)},t.prototype.propagationPath=function(t){for(var e=[t],n=0;n<PROPAGATION_LIMIT&&t!==this.rootTarget;n++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e},t.prototype.hitTestRecursive=function(t,e,n,o,i){if(!t||!t.visible)return null;if(i(t,n))return null;if(t.interactiveChildren&&t.children)for(var r=t.children,s=r.length-1;s>=0;s--){var a=r[s],p=this.hitTestRecursive(a,e||a.interactive,n,o,i);if(p){if(p.length>0&&!p[p.length-1].parent)continue;return(p.length>0||t.interactive)&&p.push(t),p}}return e&&o(t,n)?t.interactive?[t]:[]:null},t.prototype.hitPruneFn=function(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,tempLocalMapping),!t.hitArea.contains(tempLocalMapping.x,tempLocalMapping.y)))return!0;if(t._mask){var n=t._mask;if(!n.containsPoint||!n.containsPoint(e))return!0}return!1},t.prototype.hitTestFn=function(t,e){return!!t.hitArea||!!t.containsPoint&&t.containsPoint(e)},t.prototype.notifyTarget=function(t,e){e=null!=e?e:t.type;var n=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?e+"capture":e;this.notifyListeners(t,n),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)},t.prototype.mapPointerDown=function(t){if(t instanceof FederatedPointerEvent){var e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType)this.dispatchEvent(e,"touchstart");else if("mouse"===e.pointerType||"pen"===e.pointerType){var n=2===e.button;this.dispatchEvent(e,n?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerMove=function(t){var e;if(t instanceof FederatedPointerEvent){var n=this.createPointerEvent(t),o="mouse"===n.pointerType||"pen"===n.pointerType,i=this.trackingData(t.pointerId),r=this.findMountedTarget(i.overTargets);if(i.overTargets&&r!==n.target){var s="mousemove"===t.type?"mouseout":"pointerout",a=this.createPointerEvent(t,s,r);if(this.dispatchEvent(a,"pointerout"),o&&this.dispatchEvent(a,"mouseout"),!n.composedPath().includes(r)){var p=this.createPointerEvent(t,"pointerleave",r);for(p.eventPhase=p.AT_TARGET;p.target&&!n.composedPath().includes(p.target);)p.currentTarget=p.target,this.notifyTarget(p),o&&this.notifyTarget(p,"mouseleave"),p.target=p.target.parent;this.freeEvent(p)}this.freeEvent(a)}if(r!==n.target){var h="mousemove"===t.type?"mouseover":"pointerover",u=this.clonePointerEvent(n,h);this.dispatchEvent(u,"pointerover"),o&&this.dispatchEvent(u,"mouseover");for(var d=null==r?void 0:r.parent;d&&d!==this.rootTarget.parent&&d!==n.target;)d=d.parent;if(!d||d===this.rootTarget.parent){var l=this.clonePointerEvent(n,"pointerenter");for(l.eventPhase=l.AT_TARGET;l.target&&l.target!==r&&l.target!==this.rootTarget.parent;)l.currentTarget=l.target,this.notifyTarget(l),o&&this.notifyTarget(l,"mouseenter"),l.target=l.target.parent;this.freeEvent(l)}this.freeEvent(u)}var v=this.moveOnAll?"all":"dispatchEvent";this[v](n,"pointermove"),"touch"===n.pointerType&&this[v](n,"touchmove"),o&&(this[v](n,"mousemove"),this.cursor=null===(e=n.target)||void 0===e?void 0:e.cursor),i.overTargets=n.composedPath(),this.freeEvent(n)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerOver=function(t){var e;if(t instanceof FederatedPointerEvent){var n=this.trackingData(t.pointerId),o=this.createPointerEvent(t),i="mouse"===o.pointerType||"pen"===o.pointerType;this.dispatchEvent(o,"pointerover"),i&&this.dispatchEvent(o,"mouseover"),"mouse"===o.pointerType&&(this.cursor=null===(e=o.target)||void 0===e?void 0:e.cursor);var r=this.clonePointerEvent(o,"pointerenter");for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),i&&this.notifyTarget(r,"mouseenter"),r.target=r.target.parent;n.overTargets=o.composedPath(),this.freeEvent(o),this.freeEvent(r)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerOut=function(t){if(t instanceof FederatedPointerEvent){var e=this.trackingData(t.pointerId);if(e.overTargets){var n="mouse"===t.pointerType||"pen"===t.pointerType,o=this.findMountedTarget(e.overTargets),i=this.createPointerEvent(t,"pointerout",o);this.dispatchEvent(i),n&&this.dispatchEvent(i,"mouseout");var r=this.createPointerEvent(t,"pointerleave",o);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),n&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;e.overTargets=null,this.freeEvent(i),this.freeEvent(r)}this.cursor=null}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerUp=function(t){if(t instanceof FederatedPointerEvent){var e=performance.now(),n=this.createPointerEvent(t);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if("mouse"===n.pointerType||"pen"===n.pointerType){var o=2===n.button;this.dispatchEvent(n,o?"rightup":"mouseup")}var i=this.trackingData(t.pointerId),r=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=r;if(r&&!n.composedPath().includes(r)){for(var a=r;a&&!n.composedPath().includes(a);){if(n.currentTarget=a,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if("mouse"===n.pointerType||"pen"===n.pointerType){o=2===n.button;this.notifyTarget(n,o?"rightupoutside":"mouseupoutside")}a=a.parent}delete i.pressTargetsByButton[t.button],s=a}if(s){var p=this.clonePointerEvent(n,"click");p.target=s,p.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:p.target,timeStamp:e});var h=i.clicksByButton[t.button];h.target===p.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=p.target,h.timeStamp=e,p.detail=h.clickCount,"mouse"===p.pointerType?this.dispatchEvent(p,"click"):"touch"===p.pointerType?this.dispatchEvent(p,"tap"):this.dispatchEvent(p,"pointertap"),this.freeEvent(p)}this.freeEvent(n)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerUpOutside=function(t){if(t instanceof FederatedPointerEvent){var e=this.trackingData(t.pointerId),n=this.findMountedTarget(e.pressTargetsByButton[t.button]),o=this.createPointerEvent(t);if(n){for(var i=n;i;)o.currentTarget=i,this.notifyTarget(o,"pointerupoutside"),"touch"===o.pointerType?this.notifyTarget(o,"touchendoutside"):"mouse"!==o.pointerType&&"pen"!==o.pointerType||this.notifyTarget(o,2===o.button?"rightupoutside":"mouseupoutside"),i=i.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(o)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapWheel=function(t){if(t instanceof FederatedWheelEvent){var e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}else console.warn("EventBoundary cannot map a non-wheel event as a wheel event")},t.prototype.findMountedTarget=function(t){if(!t)return null;for(var e=t[0],n=1;n<t.length&&t[n].parent===e;n++)e=t[n];return e},t.prototype.createPointerEvent=function(t,e,n){var o=this.allocateEvent(FederatedPointerEvent);return this.copyPointerData(t,o),this.copyMouseData(t,o),this.copyData(t,o),o.nativeEvent=t.nativeEvent,o.originalEvent=t,o.target=null!=n?n:this.hitTest(o.global.x,o.global.y),"string"==typeof e&&(o.type=e),o},t.prototype.createWheelEvent=function(t){var e=this.allocateEvent(FederatedWheelEvent);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e},t.prototype.clonePointerEvent=function(t,e){var n=this.allocateEvent(FederatedPointerEvent);return n.nativeEvent=t.nativeEvent,n.originalEvent=t.originalEvent,this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.target=t.target,n.path=t.composedPath().slice(),n.type=null!=e?e:n.type,n},t.prototype.copyWheelData=function(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ},t.prototype.copyPointerData=function(t,e){t instanceof FederatedPointerEvent&&e instanceof FederatedPointerEvent&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)},t.prototype.copyMouseData=function(t,e){t instanceof FederatedMouseEvent&&e instanceof FederatedMouseEvent&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.global.copyFrom(t.global))},t.prototype.copyData=function(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)},t.prototype.trackingData=function(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]},t.prototype.allocateEvent=function(t){this.eventPool.has(t)||this.eventPool.set(t,[]);var e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e},t.prototype.freeEvent=function(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)},t.prototype.notifyListeners=function(t,e){var n=t.currentTarget._events[e];if(n)if("fn"in n)n.fn.call(n.context,t);else for(var o=0,i=n.length;o<i&&!t.propagationImmediatelyStopped;o++)n[o].fn.call(n[o].context,t)},t}(),MOUSE_POINTER_ID=1,TOUCH_TO_POINTER={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},EventSystem=function(){function t(t){if(this.supportsTouchEvents="ontouchstart"in self,this.supportsPointerEvents=!!self.PointerEvent,this.resolution=1,t.plugins.interaction)throw new Error("EventSystem cannot initialize with the InteractionManager installed!");this.renderer=t,this.rootBoundary=new EventBoundary(null),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new FederatedPointerEvent(null),this.rootWheelEvent=new FederatedWheelEvent(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.domElement=t.view,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this),this.setTargetElement(this.domElement),this.resolution=this.renderer.resolution}return t.prototype.destroy=function(){this.setTargetElement(null),this.renderer=null},t.prototype.setCursor=function(t){t=t||"default";var e=!0;if(self.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor!==t){this.currentCursor=t;var n=this.cursorStyles[t];if(n)switch(typeof n){case"string":e&&(this.domElement.style.cursor=n);break;case"function":n(t);break;case"object":e&&Object.assign(this.domElement.style,n)}else e&&"string"==typeof t&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}},t.prototype.onPointerDown=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t);if(this.autoPreventDefault&&e[0].isNormalized)(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(var n=0,o=e.length;n<o;n++){var i=e[n],r=this.bootstrapEvent(this.rootPointerEvent,i);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onPointerMove=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){for(var e=this.normalizeToPointerData(t),n=0,o=e.length;n<o;n++){var i=this.bootstrapEvent(this.rootPointerEvent,e[n]);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onPointerUp=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){for(var e=t.target!==this.domElement?"outside":"",n=this.normalizeToPointerData(t),o=0,i=n.length;o<i;o++){var r=this.bootstrapEvent(this.rootPointerEvent,n[o]);r.type+=e,this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onPointerOverOut=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){for(var e=this.normalizeToPointerData(t),n=0,o=e.length;n<o;n++){var i=this.bootstrapEvent(this.rootPointerEvent,e[n]);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onWheel=function(t){var e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,this.rootBoundary.mapEvent(e)},t.prototype.setTargetElement=function(t){this.removeEvents(),this.domElement=t,this.addEvents()},t.prototype.addEvents=function(){if(!this.eventsAdded&&this.domElement){var t=this.domElement.style;self.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none"),this.supportsPointerEvents?(self.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),self.addEventListener("pointerup",this.onPointerUp,!0)):(self.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),self.addEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0)),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}},t.prototype.removeEvents=function(){if(this.eventsAdded&&this.domElement){var t=this.domElement.style;self.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(self.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),self.removeEventListener("pointerup",this.onPointerUp,!0)):(self.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),self.removeEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0)),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}},t.prototype.mapPositionToPoint=function(t,e,n){var o;o=this.domElement.parentElement?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0};var i=1/this.resolution;t.x=(e-o.left)*(this.domElement.width/o.width)*i,t.y=(n-o.top)*(this.domElement.height/o.height)*i},t.prototype.normalizeToPointerData=function(t){var e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(var n=0,o=t.changedTouches.length;n<o;n++){var i=t.changedTouches[n];void 0===i.button&&(i.button=t.touches.length?1:0),void 0===i.buttons&&(i.buttons=t.touches.length?1:0),void 0===i.isPrimary&&(i.isPrimary=1===t.touches.length&&"touchstart"===t.type),void 0===i.width&&(i.width=i.radiusX||1),void 0===i.height&&(i.height=i.radiusY||1),void 0===i.tiltX&&(i.tiltX=0),void 0===i.tiltY&&(i.tiltY=0),void 0===i.pointerType&&(i.pointerType="touch"),void 0===i.pointerId&&(i.pointerId=i.identifier||0),void 0===i.pressure&&(i.pressure=i.force||.5),void 0===i.twist&&(i.twist=0),void 0===i.tangentialPressure&&(i.tangentialPressure=0),void 0===i.layerX&&(i.layerX=i.offsetX=i.clientX),void 0===i.layerY&&(i.layerY=i.offsetY=i.clientY),i.isNormalized=!0,i.type=t.type,e.push(i)}else if(self.MouseEvent&&(!(t instanceof MouseEvent)||this.supportsPointerEvents&&t instanceof self.PointerEvent))e.push(t);else{var r=t;void 0===r.isPrimary&&(r.isPrimary=!0),void 0===r.width&&(r.width=1),void 0===r.height&&(r.height=1),void 0===r.tiltX&&(r.tiltX=0),void 0===r.tiltY&&(r.tiltY=0),void 0===r.pointerType&&(r.pointerType="mouse"),void 0===r.pointerId&&(r.pointerId=MOUSE_POINTER_ID),void 0===r.pressure&&(r.pressure=.5),void 0===r.twist&&(r.twist=0),void 0===r.tangentialPressure&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}return e},t.prototype.normalizeWheelEvent=function(t){var e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e},t.prototype.bootstrapEvent=function(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=TOUCH_TO_POINTER[t.type]||t.type),t},t.prototype.transferMouseData=function(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null},t}(),FederatedDisplayObject={interactive:!1,interactiveChildren:!0,hitArea:null,addEventListener:function(t,e,n){var o="function"==typeof e?void 0:e;t="boolean"==typeof n&&n||"object"==typeof n&&n.capture?t+"capture":t,e="function"==typeof e?e:e.handleEvent,this.on(t,e,o)},removeEventListener:function(t,e,n){var o="function"==typeof e?void 0:e;t="boolean"==typeof n&&n||"object"==typeof n&&n.capture?t+"capture":t,e="function"==typeof e?e:e.handleEvent,this.off(t,e,o)},dispatchEvent:function(t){if(!(t instanceof FederatedEvent))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}};display.DisplayObject.mixin(FederatedDisplayObject),exports.EventBoundary=EventBoundary,exports.EventSystem=EventSystem,exports.FederatedDisplayObject=FederatedDisplayObject,exports.FederatedEvent=FederatedEvent,exports.FederatedMouseEvent=FederatedMouseEvent,exports.FederatedPointerEvent=FederatedPointerEvent,exports.FederatedWheelEvent=FederatedWheelEvent;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var utils=require("@pixi/utils"),math=require("@pixi/math"),display=require("@pixi/display"),extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function __extends(t,e){function n(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var FederatedEvent=function(){function t(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=t.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new math.Point,this.page=new math.Point,this.AT_TARGET=1,this.BUBBLING_PHASE=2,this.CAPTURING_PHASE=3,this.NONE=0,this.manager=e}return Object.defineProperty(t.prototype,"layerX",{get:function(){return this.layer.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layerY",{get:function(){return this.layer.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageX",{get:function(){return this.page.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageY",{get:function(){return this.page.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this},enumerable:!1,configurable:!0}),t.prototype.composedPath=function(){return!this.manager||this.path&&this.path[this.path.length-1]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path},t.prototype.initEvent=function(t,e,n){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")},t.prototype.preventDefault=function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0},t.prototype.stopImmediatePropagation=function(){this.propagationImmediatelyStopped=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t}(),FederatedMouseEvent=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.client=new math.Point,e.movement=new math.Point,e.offset=new math.Point,e.global=new math.Point,e.screen=new math.Point,e}return __extends(e,t),Object.defineProperty(e.prototype,"clientX",{get:function(){return this.client.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clientY",{get:function(){return this.client.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x",{get:function(){return this.clientX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this.clientY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"movementX",{get:function(){return this.movement.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"movementY",{get:function(){return this.movement.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"offsetX",{get:function(){return this.offset.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"offsetY",{get:function(){return this.offset.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalX",{get:function(){return this.global.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalY",{get:function(){return this.global.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"screenX",{get:function(){return this.screen.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"screenY",{get:function(){return this.screen.y},enumerable:!1,configurable:!0}),e.prototype.getModifierState=function(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)},e.prototype.initMouseEvent=function(t,e,n,o,i,r,s,a,p,h,u,l,d,v,c){throw new Error("Method not implemented.")},e}(FederatedEvent),FederatedPointerEvent=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.width=0,e.height=0,e.isPrimary=!1,e}return __extends(e,t),e.prototype.getCoalescedEvents=function(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]},e.prototype.getPredictedEvents=function(){throw new Error("getPredictedEvents is not supported!")},e}(FederatedMouseEvent),FederatedWheelEvent=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.DOM_DELTA_LINE=0,e.DOM_DELTA_PAGE=1,e.DOM_DELTA_PIXEL=2,e}return __extends(e,t),e}(FederatedMouseEvent),PROPAGATION_LIMIT=2048,tempHitLocation=new math.Point,tempLocalMapping=new math.Point,EventBoundary=function(){function t(t){this.dispatch=new utils.EventEmitter,this.moveOnAll=!1,this.mappingState={trackingData:{}},this.eventPool=new Map,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}return t.prototype.addEventMapping=function(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(function(t,e){return t.priority-e.priority})},t.prototype.dispatchEvent=function(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)},t.prototype.mapEvent=function(t){if(this.rootTarget){var e=this.mappingTable[t.type];if(e)for(var n=0,o=e.length;n<o;n++)e[n].fn(t);else console.warn("[EventBoundary]: Event mapping not defined for "+t.type)}},t.prototype.hitTest=function(t,e){var n=this.hitTestRecursive(this.rootTarget,this.rootTarget.interactive,tempHitLocation.set(t,e),this.hitTestFn,this.hitPruneFn);return n&&n[0]},t.prototype.propagate=function(t,e){if(t.target){var n=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(var o=0,i=n.length-1;o<i;o++)if(t.currentTarget=n[o],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){t.eventPhase=t.BUBBLING_PHASE;for(o=n.length-2;o>=0;o--)if(t.currentTarget=n[o],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}},t.prototype.all=function(t,e,n){void 0===n&&(n=this.rootTarget),t.eventPhase=t.BUBBLING_PHASE;var o=n.children;if(o)for(var i=0;i<o.length;i++)this.all(t,e,o[i]);t.currentTarget=n,this.notifyTarget(t,e)},t.prototype.propagationPath=function(t){for(var e=[t],n=0;n<PROPAGATION_LIMIT&&t!==this.rootTarget;n++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e},t.prototype.hitTestRecursive=function(t,e,n,o,i){if(!t||!t.visible)return null;if(i(t,n))return null;if(t.interactiveChildren&&t.children)for(var r=t.children,s=r.length-1;s>=0;s--){var a=r[s],p=this.hitTestRecursive(a,e||a.interactive,n,o,i);if(p){if(p.length>0&&!p[p.length-1].parent)continue;return(p.length>0||t.interactive)&&p.push(t),p}}return e&&o(t,n)?t.interactive?[t]:[]:null},t.prototype.hitPruneFn=function(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,tempLocalMapping),!t.hitArea.contains(tempLocalMapping.x,tempLocalMapping.y)))return!0;if(t._mask){var n=t._mask;if(!n.containsPoint||!n.containsPoint(e))return!0}return!1},t.prototype.hitTestFn=function(t,e){return!!t.hitArea||!!t.containsPoint&&t.containsPoint(e)},t.prototype.notifyTarget=function(t,e){e=null!=e?e:t.type;var n=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?e+"capture":e;this.notifyListeners(t,n),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)},t.prototype.mapPointerDown=function(t){if(t instanceof FederatedPointerEvent){var e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType)this.dispatchEvent(e,"touchstart");else if("mouse"===e.pointerType||"pen"===e.pointerType){var n=2===e.button;this.dispatchEvent(e,n?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerMove=function(t){var e;if(t instanceof FederatedPointerEvent){var n=this.createPointerEvent(t),o="mouse"===n.pointerType||"pen"===n.pointerType,i=this.trackingData(t.pointerId),r=this.findMountedTarget(i.overTargets);if(i.overTargets&&r!==n.target){var s="mousemove"===t.type?"mouseout":"pointerout",a=this.createPointerEvent(t,s,r);if(this.dispatchEvent(a,"pointerout"),o&&this.dispatchEvent(a,"mouseout"),!n.composedPath().includes(r)){var p=this.createPointerEvent(t,"pointerleave",r);for(p.eventPhase=p.AT_TARGET;p.target&&!n.composedPath().includes(p.target);)p.currentTarget=p.target,this.notifyTarget(p),o&&this.notifyTarget(p,"mouseleave"),p.target=p.target.parent;this.freeEvent(p)}this.freeEvent(a)}if(r!==n.target){var h="mousemove"===t.type?"mouseover":"pointerover",u=this.clonePointerEvent(n,h);this.dispatchEvent(u,"pointerover"),o&&this.dispatchEvent(u,"mouseover");for(var l=null==r?void 0:r.parent;l&&l!==this.rootTarget.parent&&l!==n.target;)l=l.parent;if(!l||l===this.rootTarget.parent){var d=this.clonePointerEvent(n,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==r&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),o&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(u)}var v=this.moveOnAll?"all":"dispatchEvent";this[v](n,"pointermove"),"touch"===n.pointerType&&this[v](n,"touchmove"),o&&(this[v](n,"mousemove"),this.cursor=null===(e=n.target)||void 0===e?void 0:e.cursor),i.overTargets=n.composedPath(),this.freeEvent(n)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerOver=function(t){var e;if(t instanceof FederatedPointerEvent){var n=this.trackingData(t.pointerId),o=this.createPointerEvent(t),i="mouse"===o.pointerType||"pen"===o.pointerType;this.dispatchEvent(o,"pointerover"),i&&this.dispatchEvent(o,"mouseover"),"mouse"===o.pointerType&&(this.cursor=null===(e=o.target)||void 0===e?void 0:e.cursor);var r=this.clonePointerEvent(o,"pointerenter");for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),i&&this.notifyTarget(r,"mouseenter"),r.target=r.target.parent;n.overTargets=o.composedPath(),this.freeEvent(o),this.freeEvent(r)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerOut=function(t){if(t instanceof FederatedPointerEvent){var e=this.trackingData(t.pointerId);if(e.overTargets){var n="mouse"===t.pointerType||"pen"===t.pointerType,o=this.findMountedTarget(e.overTargets),i=this.createPointerEvent(t,"pointerout",o);this.dispatchEvent(i),n&&this.dispatchEvent(i,"mouseout");var r=this.createPointerEvent(t,"pointerleave",o);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),n&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;e.overTargets=null,this.freeEvent(i),this.freeEvent(r)}this.cursor=null}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerUp=function(t){if(t instanceof FederatedPointerEvent){var e=performance.now(),n=this.createPointerEvent(t);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if("mouse"===n.pointerType||"pen"===n.pointerType){var o=2===n.button;this.dispatchEvent(n,o?"rightup":"mouseup")}var i=this.trackingData(t.pointerId),r=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=r;if(r&&!n.composedPath().includes(r)){for(var a=r;a&&!n.composedPath().includes(a);){if(n.currentTarget=a,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if("mouse"===n.pointerType||"pen"===n.pointerType){o=2===n.button;this.notifyTarget(n,o?"rightupoutside":"mouseupoutside")}a=a.parent}delete i.pressTargetsByButton[t.button],s=a}if(s){var p=this.clonePointerEvent(n,"click");p.target=s,p.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:p.target,timeStamp:e});var h=i.clicksByButton[t.button];h.target===p.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=p.target,h.timeStamp=e,p.detail=h.clickCount,"mouse"===p.pointerType?this.dispatchEvent(p,"click"):"touch"===p.pointerType?this.dispatchEvent(p,"tap"):this.dispatchEvent(p,"pointertap"),this.freeEvent(p)}this.freeEvent(n)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapPointerUpOutside=function(t){if(t instanceof FederatedPointerEvent){var e=this.trackingData(t.pointerId),n=this.findMountedTarget(e.pressTargetsByButton[t.button]),o=this.createPointerEvent(t);if(n){for(var i=n;i;)o.currentTarget=i,this.notifyTarget(o,"pointerupoutside"),"touch"===o.pointerType?this.notifyTarget(o,"touchendoutside"):"mouse"!==o.pointerType&&"pen"!==o.pointerType||this.notifyTarget(o,2===o.button?"rightupoutside":"mouseupoutside"),i=i.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(o)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},t.prototype.mapWheel=function(t){if(t instanceof FederatedWheelEvent){var e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}else console.warn("EventBoundary cannot map a non-wheel event as a wheel event")},t.prototype.findMountedTarget=function(t){if(!t)return null;for(var e=t[0],n=1;n<t.length&&t[n].parent===e;n++)e=t[n];return e},t.prototype.createPointerEvent=function(t,e,n){var o=this.allocateEvent(FederatedPointerEvent);return this.copyPointerData(t,o),this.copyMouseData(t,o),this.copyData(t,o),o.nativeEvent=t.nativeEvent,o.originalEvent=t,o.target=null!=n?n:this.hitTest(o.global.x,o.global.y),"string"==typeof e&&(o.type=e),o},t.prototype.createWheelEvent=function(t){var e=this.allocateEvent(FederatedWheelEvent);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e},t.prototype.clonePointerEvent=function(t,e){var n=this.allocateEvent(FederatedPointerEvent);return n.nativeEvent=t.nativeEvent,n.originalEvent=t.originalEvent,this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.target=t.target,n.path=t.composedPath().slice(),n.type=null!=e?e:n.type,n},t.prototype.copyWheelData=function(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ},t.prototype.copyPointerData=function(t,e){t instanceof FederatedPointerEvent&&e instanceof FederatedPointerEvent&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)},t.prototype.copyMouseData=function(t,e){t instanceof FederatedMouseEvent&&e instanceof FederatedMouseEvent&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.global.copyFrom(t.global))},t.prototype.copyData=function(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)},t.prototype.trackingData=function(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]},t.prototype.allocateEvent=function(t){this.eventPool.has(t)||this.eventPool.set(t,[]);var e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e},t.prototype.freeEvent=function(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)},t.prototype.notifyListeners=function(t,e){var n=t.currentTarget._events[e];if(n)if("fn"in n)n.fn.call(n.context,t);else for(var o=0,i=n.length;o<i&&!t.propagationImmediatelyStopped;o++)n[o].fn.call(n[o].context,t)},t}(),MOUSE_POINTER_ID=1,TOUCH_TO_POINTER={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},EventSystem=function(){function t(t){if(this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.resolution=1,t.plugins.interaction)throw new Error("EventSystem cannot initialize with the InteractionManager installed!");this.renderer=t,this.rootBoundary=new EventBoundary(null),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new FederatedPointerEvent(null),this.rootWheelEvent=new FederatedWheelEvent(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.domElement=t.view,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this),this.setTargetElement(this.domElement),this.resolution=this.renderer.resolution}return t.prototype.destroy=function(){this.setTargetElement(null),this.renderer=null},t.prototype.setCursor=function(t){t=t||"default";var e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor!==t){this.currentCursor=t;var n=this.cursorStyles[t];if(n)switch(typeof n){case"string":e&&(this.domElement.style.cursor=n);break;case"function":n(t);break;case"object":e&&Object.assign(this.domElement.style,n)}else e&&"string"==typeof t&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}},t.prototype.onPointerDown=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t);if(this.autoPreventDefault&&e[0].isNormalized)(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(var n=0,o=e.length;n<o;n++){var i=e[n],r=this.bootstrapEvent(this.rootPointerEvent,i);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onPointerMove=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){for(var e=this.normalizeToPointerData(t),n=0,o=e.length;n<o;n++){var i=this.bootstrapEvent(this.rootPointerEvent,e[n]);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onPointerUp=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){for(var e=t.target!==this.domElement?"outside":"",n=this.normalizeToPointerData(t),o=0,i=n.length;o<i;o++){var r=this.bootstrapEvent(this.rootPointerEvent,n[o]);r.type+=e,this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onPointerOverOut=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){for(var e=this.normalizeToPointerData(t),n=0,o=e.length;n<o;n++){var i=this.bootstrapEvent(this.rootPointerEvent,e[n]);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onWheel=function(t){var e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,this.rootBoundary.mapEvent(e)},t.prototype.setTargetElement=function(t){this.removeEvents(),this.domElement=t,this.addEvents()},t.prototype.addEvents=function(){if(!this.eventsAdded&&this.domElement){var t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none"),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0)),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}},t.prototype.removeEvents=function(){if(this.eventsAdded&&this.domElement){var t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0)),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}},t.prototype.mapPositionToPoint=function(t,e,n){var o;o=this.domElement.parentElement?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0};var i=1/this.resolution;t.x=(e-o.left)*(this.domElement.width/o.width)*i,t.y=(n-o.top)*(this.domElement.height/o.height)*i},t.prototype.normalizeToPointerData=function(t){var e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(var n=0,o=t.changedTouches.length;n<o;n++){var i=t.changedTouches[n];void 0===i.button&&(i.button=t.touches.length?1:0),void 0===i.buttons&&(i.buttons=t.touches.length?1:0),void 0===i.isPrimary&&(i.isPrimary=1===t.touches.length&&"touchstart"===t.type),void 0===i.width&&(i.width=i.radiusX||1),void 0===i.height&&(i.height=i.radiusY||1),void 0===i.tiltX&&(i.tiltX=0),void 0===i.tiltY&&(i.tiltY=0),void 0===i.pointerType&&(i.pointerType="touch"),void 0===i.pointerId&&(i.pointerId=i.identifier||0),void 0===i.pressure&&(i.pressure=i.force||.5),void 0===i.twist&&(i.twist=0),void 0===i.tangentialPressure&&(i.tangentialPressure=0),void 0===i.layerX&&(i.layerX=i.offsetX=i.clientX),void 0===i.layerY&&(i.layerY=i.offsetY=i.clientY),i.isNormalized=!0,i.type=t.type,e.push(i)}else if(globalThis.MouseEvent&&(!(t instanceof MouseEvent)||this.supportsPointerEvents&&t instanceof globalThis.PointerEvent))e.push(t);else{var r=t;void 0===r.isPrimary&&(r.isPrimary=!0),void 0===r.width&&(r.width=1),void 0===r.height&&(r.height=1),void 0===r.tiltX&&(r.tiltX=0),void 0===r.tiltY&&(r.tiltY=0),void 0===r.pointerType&&(r.pointerType="mouse"),void 0===r.pointerId&&(r.pointerId=MOUSE_POINTER_ID),void 0===r.pressure&&(r.pressure=.5),void 0===r.twist&&(r.twist=0),void 0===r.tangentialPressure&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}return e},t.prototype.normalizeWheelEvent=function(t){var e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e},t.prototype.bootstrapEvent=function(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=TOUCH_TO_POINTER[t.type]||t.type),t},t.prototype.transferMouseData=function(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null},t}(),FederatedDisplayObject={interactive:!1,interactiveChildren:!0,hitArea:null,addEventListener:function(t,e,n){var o="function"==typeof e?void 0:e;t="boolean"==typeof n&&n||"object"==typeof n&&n.capture?t+"capture":t,e="function"==typeof e?e:e.handleEvent,this.on(t,e,o)},removeEventListener:function(t,e,n){var o="function"==typeof e?void 0:e;t="boolean"==typeof n&&n||"object"==typeof n&&n.capture?t+"capture":t,e="function"==typeof e?e:e.handleEvent,this.off(t,e,o)},dispatchEvent:function(t){if(!(t instanceof FederatedEvent))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}};display.DisplayObject.mixin(FederatedDisplayObject),exports.EventBoundary=EventBoundary,exports.EventSystem=EventSystem,exports.FederatedDisplayObject=FederatedDisplayObject,exports.FederatedEvent=FederatedEvent,exports.FederatedMouseEvent=FederatedMouseEvent,exports.FederatedPointerEvent=FederatedPointerEvent,exports.FederatedWheelEvent=FederatedWheelEvent;
//# sourceMappingURL=events.min.js.map
/*!
* @pixi/events - v6.2.2
* Compiled Wed, 26 Jan 2022 16:23:27 UTC
* @pixi/events - v6.3.0
* Compiled Wed, 23 Mar 2022 18:58:56 UTC
*

@@ -8,3 +8,3 @@ * @pixi/events is licensed under the MIT License.

*/
import{EventEmitter as t}from"@pixi/utils";import{Point as e}from"@pixi/math";import{DisplayObject as n}from"@pixi/display";var o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function i(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var r=function(){function t(n){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=t.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new e,this.page=new e,this.AT_TARGET=1,this.BUBBLING_PHASE=2,this.CAPTURING_PHASE=3,this.NONE=0,this.manager=n}return Object.defineProperty(t.prototype,"layerX",{get:function(){return this.layer.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layerY",{get:function(){return this.layer.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageX",{get:function(){return this.page.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageY",{get:function(){return this.page.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this},enumerable:!1,configurable:!0}),t.prototype.composedPath=function(){return!this.manager||this.path&&this.path[this.path.length-1]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path},t.prototype.initEvent=function(t,e,n){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")},t.prototype.preventDefault=function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0},t.prototype.stopImmediatePropagation=function(){this.propagationImmediatelyStopped=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t}(),s=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.client=new e,n.movement=new e,n.offset=new e,n.global=new e,n.screen=new e,n}return i(n,t),Object.defineProperty(n.prototype,"clientX",{get:function(){return this.client.x},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"clientY",{get:function(){return this.client.y},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"x",{get:function(){return this.clientX},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"y",{get:function(){return this.clientY},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"movementX",{get:function(){return this.movement.x},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"movementY",{get:function(){return this.movement.y},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"offsetX",{get:function(){return this.offset.x},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"offsetY",{get:function(){return this.offset.y},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"globalX",{get:function(){return this.global.x},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"globalY",{get:function(){return this.global.y},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"screenX",{get:function(){return this.screen.x},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"screenY",{get:function(){return this.screen.y},enumerable:!1,configurable:!0}),n.prototype.getModifierState=function(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)},n.prototype.initMouseEvent=function(t,e,n,o,i,r,s,a,p,h,u,l,c,v,d){throw new Error("Method not implemented.")},n}(r),a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.width=0,e.height=0,e.isPrimary=!1,e}return i(e,t),e.prototype.getCoalescedEvents=function(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]},e.prototype.getPredictedEvents=function(){throw new Error("getPredictedEvents is not supported!")},e}(s),p=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.DOM_DELTA_LINE=0,e.DOM_DELTA_PAGE=1,e.DOM_DELTA_PIXEL=2,e}return i(e,t),e}(s),h=new e,u=new e,l=function(){function e(e){this.dispatch=new t,this.moveOnAll=!1,this.mappingState={trackingData:{}},this.eventPool=new Map,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}return e.prototype.addEventMapping=function(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(function(t,e){return t.priority-e.priority})},e.prototype.dispatchEvent=function(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)},e.prototype.mapEvent=function(t){if(this.rootTarget){var e=this.mappingTable[t.type];if(e)for(var n=0,o=e.length;n<o;n++)e[n].fn(t);else console.warn("[EventBoundary]: Event mapping not defined for "+t.type)}},e.prototype.hitTest=function(t,e){var n=this.hitTestRecursive(this.rootTarget,this.rootTarget.interactive,h.set(t,e),this.hitTestFn,this.hitPruneFn);return n&&n[0]},e.prototype.propagate=function(t,e){if(t.target){var n=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(var o=0,i=n.length-1;o<i;o++)if(t.currentTarget=n[o],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){t.eventPhase=t.BUBBLING_PHASE;for(o=n.length-2;o>=0;o--)if(t.currentTarget=n[o],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}},e.prototype.all=function(t,e,n){void 0===n&&(n=this.rootTarget),t.eventPhase=t.BUBBLING_PHASE;var o=n.children;if(o)for(var i=0;i<o.length;i++)this.all(t,e,o[i]);t.currentTarget=n,this.notifyTarget(t,e)},e.prototype.propagationPath=function(t){for(var e=[t],n=0;n<2048&&t!==this.rootTarget;n++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e},e.prototype.hitTestRecursive=function(t,e,n,o,i){if(!t||!t.visible)return null;if(i(t,n))return null;if(t.interactiveChildren&&t.children)for(var r=t.children,s=r.length-1;s>=0;s--){var a=r[s],p=this.hitTestRecursive(a,e||a.interactive,n,o,i);if(p){if(p.length>0&&!p[p.length-1].parent)continue;return(p.length>0||t.interactive)&&p.push(t),p}}return e&&o(t,n)?t.interactive?[t]:[]:null},e.prototype.hitPruneFn=function(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,u),!t.hitArea.contains(u.x,u.y)))return!0;if(t._mask){var n=t._mask;if(!n.containsPoint||!n.containsPoint(e))return!0}return!1},e.prototype.hitTestFn=function(t,e){return!!t.hitArea||!!t.containsPoint&&t.containsPoint(e)},e.prototype.notifyTarget=function(t,e){e=null!=e?e:t.type;var n=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?e+"capture":e;this.notifyListeners(t,n),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)},e.prototype.mapPointerDown=function(t){if(t instanceof a){var e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType)this.dispatchEvent(e,"touchstart");else if("mouse"===e.pointerType||"pen"===e.pointerType){var n=2===e.button;this.dispatchEvent(e,n?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},e.prototype.mapPointerMove=function(t){var e;if(t instanceof a){var n=this.createPointerEvent(t),o="mouse"===n.pointerType||"pen"===n.pointerType,i=this.trackingData(t.pointerId),r=this.findMountedTarget(i.overTargets);if(i.overTargets&&r!==n.target){var s="mousemove"===t.type?"mouseout":"pointerout",p=this.createPointerEvent(t,s,r);if(this.dispatchEvent(p,"pointerout"),o&&this.dispatchEvent(p,"mouseout"),!n.composedPath().includes(r)){var h=this.createPointerEvent(t,"pointerleave",r);for(h.eventPhase=h.AT_TARGET;h.target&&!n.composedPath().includes(h.target);)h.currentTarget=h.target,this.notifyTarget(h),o&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;this.freeEvent(h)}this.freeEvent(p)}if(r!==n.target){var u="mousemove"===t.type?"mouseover":"pointerover",l=this.clonePointerEvent(n,u);this.dispatchEvent(l,"pointerover"),o&&this.dispatchEvent(l,"mouseover");for(var c=null==r?void 0:r.parent;c&&c!==this.rootTarget.parent&&c!==n.target;)c=c.parent;if(!c||c===this.rootTarget.parent){var v=this.clonePointerEvent(n,"pointerenter");for(v.eventPhase=v.AT_TARGET;v.target&&v.target!==r&&v.target!==this.rootTarget.parent;)v.currentTarget=v.target,this.notifyTarget(v),o&&this.notifyTarget(v,"mouseenter"),v.target=v.target.parent;this.freeEvent(v)}this.freeEvent(l)}var d=this.moveOnAll?"all":"dispatchEvent";this[d](n,"pointermove"),"touch"===n.pointerType&&this[d](n,"touchmove"),o&&(this[d](n,"mousemove"),this.cursor=null===(e=n.target)||void 0===e?void 0:e.cursor),i.overTargets=n.composedPath(),this.freeEvent(n)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},e.prototype.mapPointerOver=function(t){var e;if(t instanceof a){var n=this.trackingData(t.pointerId),o=this.createPointerEvent(t),i="mouse"===o.pointerType||"pen"===o.pointerType;this.dispatchEvent(o,"pointerover"),i&&this.dispatchEvent(o,"mouseover"),"mouse"===o.pointerType&&(this.cursor=null===(e=o.target)||void 0===e?void 0:e.cursor);var r=this.clonePointerEvent(o,"pointerenter");for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),i&&this.notifyTarget(r,"mouseenter"),r.target=r.target.parent;n.overTargets=o.composedPath(),this.freeEvent(o),this.freeEvent(r)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},e.prototype.mapPointerOut=function(t){if(t instanceof a){var e=this.trackingData(t.pointerId);if(e.overTargets){var n="mouse"===t.pointerType||"pen"===t.pointerType,o=this.findMountedTarget(e.overTargets),i=this.createPointerEvent(t,"pointerout",o);this.dispatchEvent(i),n&&this.dispatchEvent(i,"mouseout");var r=this.createPointerEvent(t,"pointerleave",o);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),n&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;e.overTargets=null,this.freeEvent(i),this.freeEvent(r)}this.cursor=null}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},e.prototype.mapPointerUp=function(t){if(t instanceof a){var e=performance.now(),n=this.createPointerEvent(t);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if("mouse"===n.pointerType||"pen"===n.pointerType){var o=2===n.button;this.dispatchEvent(n,o?"rightup":"mouseup")}var i=this.trackingData(t.pointerId),r=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=r;if(r&&!n.composedPath().includes(r)){for(var p=r;p&&!n.composedPath().includes(p);){if(n.currentTarget=p,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if("mouse"===n.pointerType||"pen"===n.pointerType){o=2===n.button;this.notifyTarget(n,o?"rightupoutside":"mouseupoutside")}p=p.parent}delete i.pressTargetsByButton[t.button],s=p}if(s){var h=this.clonePointerEvent(n,"click");h.target=s,h.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:h.target,timeStamp:e});var u=i.clicksByButton[t.button];u.target===h.target&&e-u.timeStamp<200?++u.clickCount:u.clickCount=1,u.target=h.target,u.timeStamp=e,h.detail=u.clickCount,"mouse"===h.pointerType?this.dispatchEvent(h,"click"):"touch"===h.pointerType?this.dispatchEvent(h,"tap"):this.dispatchEvent(h,"pointertap"),this.freeEvent(h)}this.freeEvent(n)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},e.prototype.mapPointerUpOutside=function(t){if(t instanceof a){var e=this.trackingData(t.pointerId),n=this.findMountedTarget(e.pressTargetsByButton[t.button]),o=this.createPointerEvent(t);if(n){for(var i=n;i;)o.currentTarget=i,this.notifyTarget(o,"pointerupoutside"),"touch"===o.pointerType?this.notifyTarget(o,"touchendoutside"):"mouse"!==o.pointerType&&"pen"!==o.pointerType||this.notifyTarget(o,2===o.button?"rightupoutside":"mouseupoutside"),i=i.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(o)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},e.prototype.mapWheel=function(t){if(t instanceof p){var e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}else console.warn("EventBoundary cannot map a non-wheel event as a wheel event")},e.prototype.findMountedTarget=function(t){if(!t)return null;for(var e=t[0],n=1;n<t.length&&t[n].parent===e;n++)e=t[n];return e},e.prototype.createPointerEvent=function(t,e,n){var o=this.allocateEvent(a);return this.copyPointerData(t,o),this.copyMouseData(t,o),this.copyData(t,o),o.nativeEvent=t.nativeEvent,o.originalEvent=t,o.target=null!=n?n:this.hitTest(o.global.x,o.global.y),"string"==typeof e&&(o.type=e),o},e.prototype.createWheelEvent=function(t){var e=this.allocateEvent(p);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e},e.prototype.clonePointerEvent=function(t,e){var n=this.allocateEvent(a);return n.nativeEvent=t.nativeEvent,n.originalEvent=t.originalEvent,this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.target=t.target,n.path=t.composedPath().slice(),n.type=null!=e?e:n.type,n},e.prototype.copyWheelData=function(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ},e.prototype.copyPointerData=function(t,e){t instanceof a&&e instanceof a&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)},e.prototype.copyMouseData=function(t,e){t instanceof s&&e instanceof s&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.global.copyFrom(t.global))},e.prototype.copyData=function(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)},e.prototype.trackingData=function(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]},e.prototype.allocateEvent=function(t){this.eventPool.has(t)||this.eventPool.set(t,[]);var e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e},e.prototype.freeEvent=function(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)},e.prototype.notifyListeners=function(t,e){var n=t.currentTarget._events[e];if(n)if("fn"in n)n.fn.call(n.context,t);else for(var o=0,i=n.length;o<i&&!t.propagationImmediatelyStopped;o++)n[o].fn.call(n[o].context,t)},e}(),c={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},v=function(){function t(t){if(this.supportsTouchEvents="ontouchstart"in self,this.supportsPointerEvents=!!self.PointerEvent,this.resolution=1,t.plugins.interaction)throw new Error("EventSystem cannot initialize with the InteractionManager installed!");this.renderer=t,this.rootBoundary=new l(null),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new a(null),this.rootWheelEvent=new p(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.domElement=t.view,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this),this.setTargetElement(this.domElement),this.resolution=this.renderer.resolution}return t.prototype.destroy=function(){this.setTargetElement(null),this.renderer=null},t.prototype.setCursor=function(t){t=t||"default";var e=!0;if(self.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor!==t){this.currentCursor=t;var n=this.cursorStyles[t];if(n)switch(typeof n){case"string":e&&(this.domElement.style.cursor=n);break;case"function":n(t);break;case"object":e&&Object.assign(this.domElement.style,n)}else e&&"string"==typeof t&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}},t.prototype.onPointerDown=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t);if(this.autoPreventDefault&&e[0].isNormalized)(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(var n=0,o=e.length;n<o;n++){var i=e[n],r=this.bootstrapEvent(this.rootPointerEvent,i);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onPointerMove=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){for(var e=this.normalizeToPointerData(t),n=0,o=e.length;n<o;n++){var i=this.bootstrapEvent(this.rootPointerEvent,e[n]);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onPointerUp=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){for(var e=t.target!==this.domElement?"outside":"",n=this.normalizeToPointerData(t),o=0,i=n.length;o<i;o++){var r=this.bootstrapEvent(this.rootPointerEvent,n[o]);r.type+=e,this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onPointerOverOut=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){for(var e=this.normalizeToPointerData(t),n=0,o=e.length;n<o;n++){var i=this.bootstrapEvent(this.rootPointerEvent,e[n]);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onWheel=function(t){var e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,this.rootBoundary.mapEvent(e)},t.prototype.setTargetElement=function(t){this.removeEvents(),this.domElement=t,this.addEvents()},t.prototype.addEvents=function(){if(!this.eventsAdded&&this.domElement){var t=this.domElement.style;self.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none"),this.supportsPointerEvents?(self.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),self.addEventListener("pointerup",this.onPointerUp,!0)):(self.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),self.addEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0)),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}},t.prototype.removeEvents=function(){if(this.eventsAdded&&this.domElement){var t=this.domElement.style;self.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(self.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),self.removeEventListener("pointerup",this.onPointerUp,!0)):(self.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),self.removeEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0)),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}},t.prototype.mapPositionToPoint=function(t,e,n){var o;o=this.domElement.parentElement?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0};var i=1/this.resolution;t.x=(e-o.left)*(this.domElement.width/o.width)*i,t.y=(n-o.top)*(this.domElement.height/o.height)*i},t.prototype.normalizeToPointerData=function(t){var e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(var n=0,o=t.changedTouches.length;n<o;n++){var i=t.changedTouches[n];void 0===i.button&&(i.button=t.touches.length?1:0),void 0===i.buttons&&(i.buttons=t.touches.length?1:0),void 0===i.isPrimary&&(i.isPrimary=1===t.touches.length&&"touchstart"===t.type),void 0===i.width&&(i.width=i.radiusX||1),void 0===i.height&&(i.height=i.radiusY||1),void 0===i.tiltX&&(i.tiltX=0),void 0===i.tiltY&&(i.tiltY=0),void 0===i.pointerType&&(i.pointerType="touch"),void 0===i.pointerId&&(i.pointerId=i.identifier||0),void 0===i.pressure&&(i.pressure=i.force||.5),void 0===i.twist&&(i.twist=0),void 0===i.tangentialPressure&&(i.tangentialPressure=0),void 0===i.layerX&&(i.layerX=i.offsetX=i.clientX),void 0===i.layerY&&(i.layerY=i.offsetY=i.clientY),i.isNormalized=!0,i.type=t.type,e.push(i)}else if(self.MouseEvent&&(!(t instanceof MouseEvent)||this.supportsPointerEvents&&t instanceof self.PointerEvent))e.push(t);else{var r=t;void 0===r.isPrimary&&(r.isPrimary=!0),void 0===r.width&&(r.width=1),void 0===r.height&&(r.height=1),void 0===r.tiltX&&(r.tiltX=0),void 0===r.tiltY&&(r.tiltY=0),void 0===r.pointerType&&(r.pointerType="mouse"),void 0===r.pointerId&&(r.pointerId=1),void 0===r.pressure&&(r.pressure=.5),void 0===r.twist&&(r.twist=0),void 0===r.tangentialPressure&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}return e},t.prototype.normalizeWheelEvent=function(t){var e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e},t.prototype.bootstrapEvent=function(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=c[t.type]||t.type),t},t.prototype.transferMouseData=function(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null},t}(),d={interactive:!1,interactiveChildren:!0,hitArea:null,addEventListener:function(t,e,n){var o="function"==typeof e?void 0:e;t="boolean"==typeof n&&n||"object"==typeof n&&n.capture?t+"capture":t,e="function"==typeof e?e:e.handleEvent,this.on(t,e,o)},removeEventListener:function(t,e,n){var o="function"==typeof e?void 0:e;t="boolean"==typeof n&&n||"object"==typeof n&&n.capture?t+"capture":t,e="function"==typeof e?e:e.handleEvent,this.off(t,e,o)},dispatchEvent:function(t){if(!(t instanceof r))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}};n.mixin(d);export{l as EventBoundary,v as EventSystem,d as FederatedDisplayObject,r as FederatedEvent,s as FederatedMouseEvent,a as FederatedPointerEvent,p as FederatedWheelEvent};
import{EventEmitter as t}from"@pixi/utils";import{Point as e}from"@pixi/math";import{DisplayObject as n}from"@pixi/display";var o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function i(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var r=function(){function t(n){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=t.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new e,this.page=new e,this.AT_TARGET=1,this.BUBBLING_PHASE=2,this.CAPTURING_PHASE=3,this.NONE=0,this.manager=n}return Object.defineProperty(t.prototype,"layerX",{get:function(){return this.layer.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layerY",{get:function(){return this.layer.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageX",{get:function(){return this.page.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageY",{get:function(){return this.page.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this},enumerable:!1,configurable:!0}),t.prototype.composedPath=function(){return!this.manager||this.path&&this.path[this.path.length-1]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path},t.prototype.initEvent=function(t,e,n){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")},t.prototype.preventDefault=function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0},t.prototype.stopImmediatePropagation=function(){this.propagationImmediatelyStopped=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t}(),s=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.client=new e,n.movement=new e,n.offset=new e,n.global=new e,n.screen=new e,n}return i(n,t),Object.defineProperty(n.prototype,"clientX",{get:function(){return this.client.x},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"clientY",{get:function(){return this.client.y},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"x",{get:function(){return this.clientX},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"y",{get:function(){return this.clientY},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"movementX",{get:function(){return this.movement.x},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"movementY",{get:function(){return this.movement.y},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"offsetX",{get:function(){return this.offset.x},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"offsetY",{get:function(){return this.offset.y},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"globalX",{get:function(){return this.global.x},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"globalY",{get:function(){return this.global.y},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"screenX",{get:function(){return this.screen.x},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"screenY",{get:function(){return this.screen.y},enumerable:!1,configurable:!0}),n.prototype.getModifierState=function(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)},n.prototype.initMouseEvent=function(t,e,n,o,i,r,s,a,p,h,u,l,c,v,d){throw new Error("Method not implemented.")},n}(r),a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.width=0,e.height=0,e.isPrimary=!1,e}return i(e,t),e.prototype.getCoalescedEvents=function(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]},e.prototype.getPredictedEvents=function(){throw new Error("getPredictedEvents is not supported!")},e}(s),p=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.DOM_DELTA_LINE=0,e.DOM_DELTA_PAGE=1,e.DOM_DELTA_PIXEL=2,e}return i(e,t),e}(s),h=new e,u=new e,l=function(){function e(e){this.dispatch=new t,this.moveOnAll=!1,this.mappingState={trackingData:{}},this.eventPool=new Map,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}return e.prototype.addEventMapping=function(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(function(t,e){return t.priority-e.priority})},e.prototype.dispatchEvent=function(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)},e.prototype.mapEvent=function(t){if(this.rootTarget){var e=this.mappingTable[t.type];if(e)for(var n=0,o=e.length;n<o;n++)e[n].fn(t);else console.warn("[EventBoundary]: Event mapping not defined for "+t.type)}},e.prototype.hitTest=function(t,e){var n=this.hitTestRecursive(this.rootTarget,this.rootTarget.interactive,h.set(t,e),this.hitTestFn,this.hitPruneFn);return n&&n[0]},e.prototype.propagate=function(t,e){if(t.target){var n=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(var o=0,i=n.length-1;o<i;o++)if(t.currentTarget=n[o],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){t.eventPhase=t.BUBBLING_PHASE;for(o=n.length-2;o>=0;o--)if(t.currentTarget=n[o],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}},e.prototype.all=function(t,e,n){void 0===n&&(n=this.rootTarget),t.eventPhase=t.BUBBLING_PHASE;var o=n.children;if(o)for(var i=0;i<o.length;i++)this.all(t,e,o[i]);t.currentTarget=n,this.notifyTarget(t,e)},e.prototype.propagationPath=function(t){for(var e=[t],n=0;n<2048&&t!==this.rootTarget;n++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e},e.prototype.hitTestRecursive=function(t,e,n,o,i){if(!t||!t.visible)return null;if(i(t,n))return null;if(t.interactiveChildren&&t.children)for(var r=t.children,s=r.length-1;s>=0;s--){var a=r[s],p=this.hitTestRecursive(a,e||a.interactive,n,o,i);if(p){if(p.length>0&&!p[p.length-1].parent)continue;return(p.length>0||t.interactive)&&p.push(t),p}}return e&&o(t,n)?t.interactive?[t]:[]:null},e.prototype.hitPruneFn=function(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,u),!t.hitArea.contains(u.x,u.y)))return!0;if(t._mask){var n=t._mask;if(!n.containsPoint||!n.containsPoint(e))return!0}return!1},e.prototype.hitTestFn=function(t,e){return!!t.hitArea||!!t.containsPoint&&t.containsPoint(e)},e.prototype.notifyTarget=function(t,e){e=null!=e?e:t.type;var n=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?e+"capture":e;this.notifyListeners(t,n),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)},e.prototype.mapPointerDown=function(t){if(t instanceof a){var e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType)this.dispatchEvent(e,"touchstart");else if("mouse"===e.pointerType||"pen"===e.pointerType){var n=2===e.button;this.dispatchEvent(e,n?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},e.prototype.mapPointerMove=function(t){var e;if(t instanceof a){var n=this.createPointerEvent(t),o="mouse"===n.pointerType||"pen"===n.pointerType,i=this.trackingData(t.pointerId),r=this.findMountedTarget(i.overTargets);if(i.overTargets&&r!==n.target){var s="mousemove"===t.type?"mouseout":"pointerout",p=this.createPointerEvent(t,s,r);if(this.dispatchEvent(p,"pointerout"),o&&this.dispatchEvent(p,"mouseout"),!n.composedPath().includes(r)){var h=this.createPointerEvent(t,"pointerleave",r);for(h.eventPhase=h.AT_TARGET;h.target&&!n.composedPath().includes(h.target);)h.currentTarget=h.target,this.notifyTarget(h),o&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;this.freeEvent(h)}this.freeEvent(p)}if(r!==n.target){var u="mousemove"===t.type?"mouseover":"pointerover",l=this.clonePointerEvent(n,u);this.dispatchEvent(l,"pointerover"),o&&this.dispatchEvent(l,"mouseover");for(var c=null==r?void 0:r.parent;c&&c!==this.rootTarget.parent&&c!==n.target;)c=c.parent;if(!c||c===this.rootTarget.parent){var v=this.clonePointerEvent(n,"pointerenter");for(v.eventPhase=v.AT_TARGET;v.target&&v.target!==r&&v.target!==this.rootTarget.parent;)v.currentTarget=v.target,this.notifyTarget(v),o&&this.notifyTarget(v,"mouseenter"),v.target=v.target.parent;this.freeEvent(v)}this.freeEvent(l)}var d=this.moveOnAll?"all":"dispatchEvent";this[d](n,"pointermove"),"touch"===n.pointerType&&this[d](n,"touchmove"),o&&(this[d](n,"mousemove"),this.cursor=null===(e=n.target)||void 0===e?void 0:e.cursor),i.overTargets=n.composedPath(),this.freeEvent(n)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},e.prototype.mapPointerOver=function(t){var e;if(t instanceof a){var n=this.trackingData(t.pointerId),o=this.createPointerEvent(t),i="mouse"===o.pointerType||"pen"===o.pointerType;this.dispatchEvent(o,"pointerover"),i&&this.dispatchEvent(o,"mouseover"),"mouse"===o.pointerType&&(this.cursor=null===(e=o.target)||void 0===e?void 0:e.cursor);var r=this.clonePointerEvent(o,"pointerenter");for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),i&&this.notifyTarget(r,"mouseenter"),r.target=r.target.parent;n.overTargets=o.composedPath(),this.freeEvent(o),this.freeEvent(r)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},e.prototype.mapPointerOut=function(t){if(t instanceof a){var e=this.trackingData(t.pointerId);if(e.overTargets){var n="mouse"===t.pointerType||"pen"===t.pointerType,o=this.findMountedTarget(e.overTargets),i=this.createPointerEvent(t,"pointerout",o);this.dispatchEvent(i),n&&this.dispatchEvent(i,"mouseout");var r=this.createPointerEvent(t,"pointerleave",o);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),n&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;e.overTargets=null,this.freeEvent(i),this.freeEvent(r)}this.cursor=null}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},e.prototype.mapPointerUp=function(t){if(t instanceof a){var e=performance.now(),n=this.createPointerEvent(t);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if("mouse"===n.pointerType||"pen"===n.pointerType){var o=2===n.button;this.dispatchEvent(n,o?"rightup":"mouseup")}var i=this.trackingData(t.pointerId),r=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=r;if(r&&!n.composedPath().includes(r)){for(var p=r;p&&!n.composedPath().includes(p);){if(n.currentTarget=p,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if("mouse"===n.pointerType||"pen"===n.pointerType){o=2===n.button;this.notifyTarget(n,o?"rightupoutside":"mouseupoutside")}p=p.parent}delete i.pressTargetsByButton[t.button],s=p}if(s){var h=this.clonePointerEvent(n,"click");h.target=s,h.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:h.target,timeStamp:e});var u=i.clicksByButton[t.button];u.target===h.target&&e-u.timeStamp<200?++u.clickCount:u.clickCount=1,u.target=h.target,u.timeStamp=e,h.detail=u.clickCount,"mouse"===h.pointerType?this.dispatchEvent(h,"click"):"touch"===h.pointerType?this.dispatchEvent(h,"tap"):this.dispatchEvent(h,"pointertap"),this.freeEvent(h)}this.freeEvent(n)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},e.prototype.mapPointerUpOutside=function(t){if(t instanceof a){var e=this.trackingData(t.pointerId),n=this.findMountedTarget(e.pressTargetsByButton[t.button]),o=this.createPointerEvent(t);if(n){for(var i=n;i;)o.currentTarget=i,this.notifyTarget(o,"pointerupoutside"),"touch"===o.pointerType?this.notifyTarget(o,"touchendoutside"):"mouse"!==o.pointerType&&"pen"!==o.pointerType||this.notifyTarget(o,2===o.button?"rightupoutside":"mouseupoutside"),i=i.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(o)}else console.warn("EventBoundary cannot map a non-pointer event as a pointer event")},e.prototype.mapWheel=function(t){if(t instanceof p){var e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}else console.warn("EventBoundary cannot map a non-wheel event as a wheel event")},e.prototype.findMountedTarget=function(t){if(!t)return null;for(var e=t[0],n=1;n<t.length&&t[n].parent===e;n++)e=t[n];return e},e.prototype.createPointerEvent=function(t,e,n){var o=this.allocateEvent(a);return this.copyPointerData(t,o),this.copyMouseData(t,o),this.copyData(t,o),o.nativeEvent=t.nativeEvent,o.originalEvent=t,o.target=null!=n?n:this.hitTest(o.global.x,o.global.y),"string"==typeof e&&(o.type=e),o},e.prototype.createWheelEvent=function(t){var e=this.allocateEvent(p);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e},e.prototype.clonePointerEvent=function(t,e){var n=this.allocateEvent(a);return n.nativeEvent=t.nativeEvent,n.originalEvent=t.originalEvent,this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.target=t.target,n.path=t.composedPath().slice(),n.type=null!=e?e:n.type,n},e.prototype.copyWheelData=function(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ},e.prototype.copyPointerData=function(t,e){t instanceof a&&e instanceof a&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)},e.prototype.copyMouseData=function(t,e){t instanceof s&&e instanceof s&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.global.copyFrom(t.global))},e.prototype.copyData=function(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)},e.prototype.trackingData=function(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]},e.prototype.allocateEvent=function(t){this.eventPool.has(t)||this.eventPool.set(t,[]);var e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e},e.prototype.freeEvent=function(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)},e.prototype.notifyListeners=function(t,e){var n=t.currentTarget._events[e];if(n)if("fn"in n)n.fn.call(n.context,t);else for(var o=0,i=n.length;o<i&&!t.propagationImmediatelyStopped;o++)n[o].fn.call(n[o].context,t)},e}(),c={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},v=function(){function t(t){if(this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.resolution=1,t.plugins.interaction)throw new Error("EventSystem cannot initialize with the InteractionManager installed!");this.renderer=t,this.rootBoundary=new l(null),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new a(null),this.rootWheelEvent=new p(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.domElement=t.view,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this),this.setTargetElement(this.domElement),this.resolution=this.renderer.resolution}return t.prototype.destroy=function(){this.setTargetElement(null),this.renderer=null},t.prototype.setCursor=function(t){t=t||"default";var e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor!==t){this.currentCursor=t;var n=this.cursorStyles[t];if(n)switch(typeof n){case"string":e&&(this.domElement.style.cursor=n);break;case"function":n(t);break;case"object":e&&Object.assign(this.domElement.style,n)}else e&&"string"==typeof t&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}},t.prototype.onPointerDown=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t);if(this.autoPreventDefault&&e[0].isNormalized)(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(var n=0,o=e.length;n<o;n++){var i=e[n],r=this.bootstrapEvent(this.rootPointerEvent,i);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onPointerMove=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){for(var e=this.normalizeToPointerData(t),n=0,o=e.length;n<o;n++){var i=this.bootstrapEvent(this.rootPointerEvent,e[n]);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onPointerUp=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){for(var e=t.target!==this.domElement?"outside":"",n=this.normalizeToPointerData(t),o=0,i=n.length;o<i;o++){var r=this.bootstrapEvent(this.rootPointerEvent,n[o]);r.type+=e,this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onPointerOverOut=function(t){if(this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,!this.supportsTouchEvents||"touch"!==t.pointerType){for(var e=this.normalizeToPointerData(t),n=0,o=e.length;n<o;n++){var i=this.bootstrapEvent(this.rootPointerEvent,e[n]);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}},t.prototype.onWheel=function(t){var e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer._lastObjectRendered,this.rootBoundary.mapEvent(e)},t.prototype.setTargetElement=function(t){this.removeEvents(),this.domElement=t,this.addEvents()},t.prototype.addEvents=function(){if(!this.eventsAdded&&this.domElement){var t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none"),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0)),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}},t.prototype.removeEvents=function(){if(this.eventsAdded&&this.domElement){var t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0)),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}},t.prototype.mapPositionToPoint=function(t,e,n){var o;o=this.domElement.parentElement?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0};var i=1/this.resolution;t.x=(e-o.left)*(this.domElement.width/o.width)*i,t.y=(n-o.top)*(this.domElement.height/o.height)*i},t.prototype.normalizeToPointerData=function(t){var e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(var n=0,o=t.changedTouches.length;n<o;n++){var i=t.changedTouches[n];void 0===i.button&&(i.button=t.touches.length?1:0),void 0===i.buttons&&(i.buttons=t.touches.length?1:0),void 0===i.isPrimary&&(i.isPrimary=1===t.touches.length&&"touchstart"===t.type),void 0===i.width&&(i.width=i.radiusX||1),void 0===i.height&&(i.height=i.radiusY||1),void 0===i.tiltX&&(i.tiltX=0),void 0===i.tiltY&&(i.tiltY=0),void 0===i.pointerType&&(i.pointerType="touch"),void 0===i.pointerId&&(i.pointerId=i.identifier||0),void 0===i.pressure&&(i.pressure=i.force||.5),void 0===i.twist&&(i.twist=0),void 0===i.tangentialPressure&&(i.tangentialPressure=0),void 0===i.layerX&&(i.layerX=i.offsetX=i.clientX),void 0===i.layerY&&(i.layerY=i.offsetY=i.clientY),i.isNormalized=!0,i.type=t.type,e.push(i)}else if(globalThis.MouseEvent&&(!(t instanceof MouseEvent)||this.supportsPointerEvents&&t instanceof globalThis.PointerEvent))e.push(t);else{var r=t;void 0===r.isPrimary&&(r.isPrimary=!0),void 0===r.width&&(r.width=1),void 0===r.height&&(r.height=1),void 0===r.tiltX&&(r.tiltX=0),void 0===r.tiltY&&(r.tiltY=0),void 0===r.pointerType&&(r.pointerType="mouse"),void 0===r.pointerId&&(r.pointerId=1),void 0===r.pressure&&(r.pressure=.5),void 0===r.twist&&(r.twist=0),void 0===r.tangentialPressure&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}return e},t.prototype.normalizeWheelEvent=function(t){var e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e},t.prototype.bootstrapEvent=function(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=c[t.type]||t.type),t},t.prototype.transferMouseData=function(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null},t}(),d={interactive:!1,interactiveChildren:!0,hitArea:null,addEventListener:function(t,e,n){var o="function"==typeof e?void 0:e;t="boolean"==typeof n&&n||"object"==typeof n&&n.capture?t+"capture":t,e="function"==typeof e?e:e.handleEvent,this.on(t,e,o)},removeEventListener:function(t,e,n){var o="function"==typeof e?void 0:e;t="boolean"==typeof n&&n||"object"==typeof n&&n.capture?t+"capture":t,e="function"==typeof e?e:e.handleEvent,this.off(t,e,o)},dispatchEvent:function(t){if(!(t instanceof r))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}};n.mixin(d);export{l as EventBoundary,v as EventSystem,d as FederatedDisplayObject,r as FederatedEvent,s as FederatedMouseEvent,a as FederatedPointerEvent,p as FederatedWheelEvent};
//# sourceMappingURL=events.min.js.map

@@ -6,2 +6,3 @@ /// <reference path="./global.d.ts" />

import type { IPointData } from '@pixi/math';
import type { IRenderableObject } from '@pixi/core';
import { Point } from '@pixi/math';

@@ -733,3 +734,3 @@

/** The hit-area specifies the area for which pointer events should be captured by this event target. */
hitArea: IHitArea;
hitArea: IHitArea | null;
}

@@ -945,3 +946,3 @@

declare interface Renderer {
_lastObjectRendered: DisplayObject;
_lastObjectRendered: IRenderableObject;
view: HTMLCanvasElement;

@@ -948,0 +949,0 @@ resolution: number;

{
"name": "@pixi/events",
"version": "6.2.2",
"version": "6.3.0",
"main": "dist/cjs/events.js",

@@ -35,7 +35,7 @@ "module": "dist/esm/events.js",

"peerDependencies": {
"@pixi/display": "6.2.2",
"@pixi/math": "6.2.2",
"@pixi/utils": "6.2.2"
"@pixi/display": "6.3.0",
"@pixi/math": "6.3.0",
"@pixi/utils": "6.3.0"
},
"gitHead": "23c4599ad83dbb128d71a1010aa6c4fb96779270"
"gitHead": "dc311cdd7a28e6817556cdc674fd15ef71069467"
}

@@ -24,3 +24,3 @@ # @pixi/events

const app = new PIXI.Application();
const { renderer} = app;
const { renderer } = app;

@@ -27,0 +27,0 @@ document.body.appendChild(app.view);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc