/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{when as n,watch as i,initial as r,syncAndInitial as s}from"../../../core/reactiveUtils.js";import{property as a,subclass as p}from"../../../core/accessorSupport/decorators.js";import{DoubleClickZoom as c}from"./handlers/DoubleClickZoom.js";import{DoubleTapDragZoom as m}from"./handlers/DoubleTapDragZoom.js";import{DragPan as l}from"./handlers/DragPan.js";import{DragRotate as u}from"./handlers/DragRotate.js";import{GamepadNavigation as h}from"./handlers/GamepadNavigation.js";import{KeyPan as w}from"./handlers/KeyPan.js";import{KeyRotate as d}from"./handlers/KeyRotate.js";import{KeyZoom as v}from"./handlers/KeyZoom.js";import{MouseWheelZoom as g}from"./handlers/MouseWheelZoom.js";import{PinchRotateAndZoom as f}from"./handlers/PinchAction.js";import{BrowserEventSource as j}from"../../input/BrowserEventSource.js";import{InputManager as A,ViewEventPriorities as y}from"../../input/InputManager.js";import{PreventContextMenu as _}from"../../input/handlers/PreventContextMenu.js";import{getPointerActions as M}from"../../input/handlers/support.js";import{DoubleTapDrag as D}from"../../input/recognizers/DoubleTapDrag.js";import{Drag as P}from"../../input/recognizers/Drag.js";import{ImmediateDoubleClick as b}from"../../input/recognizers/ImmediateDoubleClick.js";import{PointerClickHoldAndDrag as I}from"../../input/recognizers/PointerClickHoldAndDrag.js";import{SingleAndDoubleClick as z}from"../../input/recognizers/SingleAndDoubleClick.js";const T={counter:"Control",pan:{left:"ArrowLeft",right:"ArrowRight",up:"ArrowUp",down:"ArrowDown"},zoom:{zoomIn:["=","+"],zoomOut:["-","_"]},rotate:{clockwise:["a","A"],counterClockwise:["d","D"],reset:["n","N"]}},C=Symbol("handles");let E=class extends t{initialize(){const e=()=>this.view?.ready;this.addHandles([n(()=>!e(),()=>this._disconnect()),n(e,()=>this._connect())])}destroy(){this._disconnect()}get updating(){return!!this._inputManager?.updating}get latestPointerInfo(){return this._inputManager?.latestPointerInfo}get latestPenInfo(){return this._inputManager?.latestPenInfo}get multiTouchActive(){return this._inputManager?.multiTouchActive??!1}isModifierKeyDown(e){return this._inputManager?.isModifierKeyDown(e)??!1}_disconnect(){this.view.viewEvents.disconnect(),this.removeHandles(C),this._inputManager=o(this._inputManager)}_connect(){const e=this.view.surface,t=new j(e,this.view.input),o=[new b,new I,new z,new P(this.view.navigation),new D],n=new A({eventSource:t,recognizers:o}),a=new l(this.view,["primary"]),p=new u(this.view,["secondary"]);n.installHandlers("prevent-context-menu",[new _],y.INTERNAL),n.installHandlers("navigation",[new f(this.view),new h(this.view),new g(this.view),new c(this.view),new c(this.view,[T.counter]),a,new w(this.view,T.pan),new v(this.view,T.zoom),new d(this.view,T.rotate),p,new m(this.view,"touch")],y.INTERNAL),this.view.viewEvents.connect(n),this._source=t,this._inputManager=n,this.addHandles([i(()=>this.view?.navigation?.browserTouchPanEnabled,e=>{this._source&&(this._source.browserTouchPanningEnabled=!e)},r),i(()=>{const{actionMap:e}=this.view.navigation;return{panActions:M("pan",e),rotateActions:M("rotate",e)}},({panActions:e,rotateActions:t})=>{a.pointerActions=e,p.pointerActions=t},s)],C)}get test(){}};e([a()],E.prototype,"view",void 0),e([a({readOnly:!0})],E.prototype,"updating",null),e([a()],E.prototype,"latestPointerInfo",null),e([a()],E.prototype,"latestPenInfo",null),e([a()],E.prototype,"multiTouchActive",null),E=e([p("esri.views.2d.input.MapViewInputManager")],E);const k=E;export{k as default};
