@ -21,7 +21,7 @@ export function stopEvent(e) {
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				// Emulate Element.setCapture() when not supported
 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				let  _captureRecursion  =  false ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				let  _capture Elem =  null ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				let  _capture d Elem =  null ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				function  _captureProxy ( e )  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    // Recursion protection as we'll see our own event
 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    if  ( _captureRecursion )  return ; 
 
			
		 
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
			
			 
			 
			
				@ -30,7 +30,7 @@ function _captureProxy(e) {
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    const  newEv  =  new  e . constructor ( e . type ,  e ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    _captureRecursion  =  true ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    _capture Elem. dispatchEvent ( newEv ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    _capture d Elem. dispatchEvent ( newEv ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    _captureRecursion  =  false ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    // Avoid double events
 
 
			
		 
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
			
			 
			 
			
				@ -48,58 +48,58 @@ function _captureProxy(e) {
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				} 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				// Follow cursor style of target element
 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				function  _capture ElemChanged( )  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    const  capture Elem =  document . getElementById ( "noVNC_mouse_capture_elem" ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    capture Elem. style . cursor  =  window . getComputedStyle ( _capture Elem) . cursor ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				function  _capture d ElemChanged( )  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    const  proxy Elem =  document . getElementById ( "noVNC_mouse_capture_elem" ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    proxy Elem. style . cursor  =  window . getComputedStyle ( _capture d Elem) . cursor ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				} 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				const  _captureObserver  =  new  MutationObserver ( _capture ElemChanged) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				const  _captureObserver  =  new  MutationObserver ( _capture d ElemChanged) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				let  _captureIndex  =  0 ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				export  function  setCapture ( elem )  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    if  ( elem . setCapture )  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				export  function  setCapture ( target )  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    if  ( target . setCapture )  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        elem . setCapture ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        target . setCapture ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        // IE releases capture on 'click' events which might not trigger
 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        elem . addEventListener ( 'mouseup' ,  releaseCapture ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        target . addEventListener ( 'mouseup' ,  releaseCapture ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    }  else  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        // Release any existing capture in case this method is
 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        // called multiple times without coordination
 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        releaseCapture ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        let  capture Elem =  document . getElementById ( "noVNC_mouse_capture_elem" ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        let  proxy Elem =  document . getElementById ( "noVNC_mouse_capture_elem" ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        if  ( capture Elem ===  null )  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            capture Elem =  document . createElement ( "div" ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            capture Elem. id  =  "noVNC_mouse_capture_elem" ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            capture Elem. style . position  =  "fixed" ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            capture Elem. style . top  =  "0px" ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            capture Elem. style . left  =  "0px" ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            capture Elem. style . width  =  "100%" ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            capture Elem. style . height  =  "100%" ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            capture Elem. style . zIndex  =  10000 ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            capture Elem. style . display  =  "none" ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            document . body . appendChild ( capture Elem) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        if  ( proxy Elem ===  null )  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            proxy Elem =  document . createElement ( "div" ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            proxy Elem. id  =  "noVNC_mouse_capture_elem" ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            proxy Elem. style . position  =  "fixed" ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            proxy Elem. style . top  =  "0px" ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            proxy Elem. style . left  =  "0px" ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            proxy Elem. style . width  =  "100%" ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            proxy Elem. style . height  =  "100%" ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            proxy Elem. style . zIndex  =  10000 ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            proxy Elem. style . display  =  "none" ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            document . body . appendChild ( proxy Elem) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            // This is to make sure callers don't get confused by having
 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            // our blocking element as the target
 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            capture Elem. addEventListener ( 'contextmenu' ,  _captureProxy ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            proxy Elem. addEventListener ( 'contextmenu' ,  _captureProxy ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            capture Elem. addEventListener ( 'mousemove' ,  _captureProxy ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            capture Elem. addEventListener ( 'mouseup' ,  _captureProxy ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            proxy Elem. addEventListener ( 'mousemove' ,  _captureProxy ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            proxy Elem. addEventListener ( 'mouseup' ,  _captureProxy ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        _capture Elem =  elem  ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        _capture dElem =  target  ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        _captureIndex ++ ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        // Track cursor and get initial cursor
 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        _captureObserver . observe ( elem ,  { attributes :  true } ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        _capture ElemChanged( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        _captureObserver . observe ( target ,  { attributes :  true } ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        _capture d ElemChanged( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        capture Elem. style . display  =  "" ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        proxy Elem. style . display  =  "" ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        // We listen to events on window in order to keep tracking if it
 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        // happens to leave the viewport
 
 
			
		 
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
			
			 
			 
			
				@ -114,7 +114,7 @@ export function releaseCapture() {
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        document . releaseCapture ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    }  else  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        if  ( ! _capture Elem)  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        if  ( ! _capture d Elem)  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            return ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
			
			 
			 
			
				@ -124,14 +124,14 @@ export function releaseCapture() {
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            // Only clear it if it's the expected grab (i.e. no one
 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            // else has initiated a new grab)
 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            if  ( _captureIndex  ===  expected )  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                _capture Elem =  null ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                _capture d Elem =  null ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				            } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        } ,  0 ,  _captureIndex ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        _captureObserver . disconnect ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        const  capture Elem =  document . getElementById ( "noVNC_mouse_capture_elem" ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        capture Elem. style . display  =  "none" ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        const  proxy Elem =  document . getElementById ( "noVNC_mouse_capture_elem" ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        proxy Elem. style . display  =  "none" ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        window . removeEventListener ( 'mousemove' ,  _captureProxy ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        window . removeEventListener ( 'mouseup' ,  _captureProxy ) ;