/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
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 i,watch as n,initial as r,syncAndInitial as s}from"../../../core/reactiveUtils.js";import{property as a,subclass as c}from"../../../core/accessorSupport/decorators.js";import{DoubleClickZoom as p}from"./handlers/DoubleClickZoom.js";import{DoubleTapDragZoom as m}from"./handlers/DoubleTapDragZoom.js";import{DragPan as h}from"./handlers/DragPan.js";import{DragRotate as l}from"./handlers/DragRotate.js";import{GamepadNavigation as u}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 f}from"./handlers/MouseWheelZoom.js";import{PinchRotateAndZoom as g}from"./handlers/PinchAction.js";import{BrowserEventSource as j}from"../../input/BrowserEventSource.js";import{InputManager as A,ViewEventPriorities as D}from"../../input/InputManager.js";import{PreventContextMenu as _}from"../../input/handlers/PreventContextMenu.js";import{getPointerActions as y}from"../../input/handlers/support.js";import{DoubleTapDrag as M}from"../../input/recognizers/DoubleTapDrag.js";import{Drag as b}from"../../input/recognizers/Drag.js";import{ImmediateDoubleClick as z}from"../../input/recognizers/ImmediateDoubleClick.js";import{PointerClickHoldAndDrag as P}from"../../input/recognizers/PointerClickHoldAndDrag.js";import{SingleAndDoubleClick as I}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([i(()=>!e(),()=>this._disconnect()),i(e,()=>this._connect())])}destroy(){this._disconnect()}get latestPointerInfo(){return this._inputManager?.latestPointerInfo}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 z,new P,new I,new b(this.view.navigation),new M],i=new A({eventSource:t,recognizers:o}),a=new h(this.view,["primary"]),c=new l(this.view,["secondary"]);i.installHandlers("prevent-context-menu",[new _],D.INTERNAL),i.installHandlers("navigation",[new g(this.view),new u(this.view),new f(this.view),new p(this.view),new p(this.view,[T.counter]),a,new w(this.view,T.pan),new v(this.view,T.zoom),new d(this.view,T.rotate),c,new m(this.view,"touch")],D.INTERNAL),this.view.viewEvents.connect(i),this._source=t,this._inputManager=i,this.addHandles([n(()=>this.view?.navigation?.browserTouchPanEnabled,e=>{this._source&&(this._source.browserTouchPanningEnabled=!e)},r),n(()=>{const{actionMap:e}=this.view.navigation;return{panActions:y("pan",e),rotateActions:y("rotate",e)}},({panActions:e,rotateActions:t})=>{a.pointerActions=e,c.pointerActions=t},s)],C)}get test(){}};e([a()],E.prototype,"view",void 0),e([a()],E.prototype,"latestPointerInfo",null),e([a()],E.prototype,"multiTouchActive",null),E=e([c("esri.views.2d.input.MapViewInputManager")],E);const k=E;export{k as default};
