/*

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2010-2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation
 RequireJS text 2.0.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 Available via the MIT or new BSD license.
 see: http://github.com/requirejs/text for details

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: 
  Felipe Heidrich (IBM Corporation) - initial API and implementation
  Silenio Quarti (IBM Corporation) - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010,2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010,2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2011,2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:  IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation

 Copyright (c) 2012, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation

 Copyright (c) 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation
     Andy Clement (vmware) - bug 344614

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation
 Copyright (c) 2013 IBM Corporation and others. All rights
          reserved. This program and the accompanying materials are made
          available under the terms of the Eclipse Public License v1.0
          (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse
          Distribution License v1.0
          (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - _initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2014 IBM Corporation and others. 
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others 
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: 
  Felipe Heidrich (IBM Corporation) - initial API and implementation
  Silenio Quarti (IBM Corporation) - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: 
  Felipe Heidrich (IBM Corporation) - initial API and implementation
  Silenio Quarti (IBM Corporation) - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: 
  Felipe Heidrich (IBM Corporation) - initial API and implementation
  Silenio Quarti (IBM Corporation) - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: 
  Felipe Heidrich (IBM Corporation) - initial API and implementation
  Silenio Quarti (IBM Corporation) - initial API and implementation
  Mihai Sucan (Mozilla Foundation) - fix for Bug#334583 Bug#348471 Bug#349485 Bug#350595 Bug#360726 Bug#361180 Bug#362835 Bug#362428 Bug#362286 Bug#354270 Bug#361474 Bug#363945 Bug#366312 Bug#370584

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: 
  Felipe Heidrich (IBM Corporation) - initial API and implementation
  Silenio Quarti (IBM Corporation) - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: 
  Felipe Heidrich (IBM Corporation) - initial API and implementation
  Silenio Quarti (IBM Corporation) - initial API and implementation

 Copyright (c) 2009, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2014 IBM Corporation and others. All rights reserved.
 This program and the accompanying materials are made available under the
 terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors: 
 IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: 
  Felipe Heidrich (IBM Corporation) - initial API and implementation
  Silenio Quarti (IBM Corporation) - initial API and implementation

 Copyright (c) 2010, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors: IBM Corporation - initial API and implementation
               Alex Lakatos - fix for bug#369781

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors: IBM Corporation - initial API and implementation
               Alex Lakatos - fix for bug#369781

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation 

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation 

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others. 
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation
 RequireJS i18n 2.0.2 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 Available via the MIT or new BSD license.
 see: http://github.com/requirejs/i18n for details

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation
*/
(function(){function m(d,e,f,b,a,l){e[d]&&(f.push(d),(!0===e[d]||1===e[d])&&b.push(a+d+"/"+l))}function n(d,e,f,b,a){e=b+e+"/"+a;require._fileExists(d.toUrl(e+".js"))&&f.push(e)}function k(d,e,f){for(var b in e)e.hasOwnProperty(b)&&(!d.hasOwnProperty(b)||f)?d[b]=e[b]:"object"===typeof e[b]&&k(d[b],e[b],f)}var e=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(d){var g=d.config?d.config():{},g=g||{};return{version:"2.0.1+",load:function(f,b,a,l){l=l||{};l.locale&&(g.locale=
l.locale);var h=e.exec(f),p=h[1],d=h[4],r=h[5],t=d.split("-"),w=[],s={},x,v="";h[5]?(p=h[1],f=p+r):(r=h[4],d=g.locale,d||(d=g.locale="undefined"===typeof navigator?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase()),t=d.split("-"));if(l.isBuild){w.push(f);n(b,"root",w,p,r);for(x=0;x<t.length;x++)l=t[x],v+=(v?"-":"")+l,n(b,v,w,p,r);b(w,function(){a()})}else b([f],function(h){var l=[],d;m("root",h,l,w,p,r);for(x=0;x<t.length;x++)d=t[x],v+=(v?"-":"")+d,m(v,h,l,w,p,r);b(w,function(){var u,
d,f;for(u=l.length-1;-1<u&&l[u];u--){f=l[u];d=h[f];if(!0===d||1===d)d=b(p+f+"/"+r);k(s,d)}a(s)})})}}})})();
define("orion/i18n",[],function(){return{load:function(m,n,k,e){e=e||{};var d=/(^.*(?:^|\/)nls(?:\/|$))([^\/]*)\/?([^\/]*)/,g=d.exec(m);if(g){if(!n.defined||n.defined(m))try{k(n(m));return}catch(f){}if(e.isBuild||e.isTest)k({});else if(n.specified&&!n.specified("orion/bootstrap"))k({});else{var b=g[1],a=g[3]?g[2]:"",l=g[3]||g[2];n(["orion/bootstrap"],function(h){h.startup().then(function(h){var f=h.serviceRegistry;h=f.getServiceReferences("orion.i18n.message");if(a)h.some(function(a){return m===a.getProperty("name")?
(f.getService(a).getMessageBundle().then(function(a){k(a)},function(){k({})}),!0):!1})||k({});else{var r={},t;h.forEach(function(h){var p=h.getProperty("name");if((g=d.exec(p))&&b===g[1]&&l===(g[3]||g[2]))if(a=g[3]?g[2]:""){if((h=e.locale||("undefined"!==typeof navigator?navigator.language||navigator.userLanguage:null))&&0===h.toLowerCase().indexOf(a.toLowerCase()))r[a]=!0,(!n.specified||!n.specified(p))&&define(p,["orion/i18n!"+p],function(a){return a})}else t=h});!n.specified||!n.specified(m)?t?
f.getService(t).getMessageBundle().then(function(a){Object.keys(r).forEach(function(b){"undefined"===typeof a[b]&&(a[b]=r[b])});define(m,[],a);k(a)},function(){define(m,[],r);k(r)}):(define(m,[],r),k(r)):k(r)}})})}}else k(null)}}});
define("orion/search/nls/root/messages",{"Find:":"Find:","Find With":"Find With","ReplaceWith:":"ReplaceWith:","Replace With":"Replace With","Show all":"Show all","Wrap search":"Wrap search","Incremental search":"Incremental search","Whole Word":"Whole Word","Regular expression":"Regular expression","Find after replace":"Find after replace",Options:"Options","Find next match":"Find next match","Find previous match":"Find previous match",Next:"Next",Previous:"Previous",Replace:"Replace","Replace...":"Replace...",
"Replace All":"Replace All","Show Replace":"Show Replace","Hide Replace":"Hide Replace","Search ${0}":"Search ${0}","Type a keyword or wild card to search in ":"Type a keyword or wild card to search in ","Search failed.":"Search failed.","No matches found for ${0}":"No matches found for ${0}","Searching...":"Searching...","Resource has been changed by others.":"Resource has been changed by others.","Failed to write file.":"Failed to write file.",Results:"Results","Files ${0} of ${1} matching ${2}":"Files ${0} of ${1} matching ${2}",
"Replace ${0} with ${1} for files ${2} of ${3}":"Replace ${0} with ${1} for files ${2} of ${3}",Location:"Location","Click to compare":"Click to compare",'Search again in this folder with "${0}"':'Search again in this folder with "${0}"',"Files replaced":"Files replaced",Status:"Status","${0} out of ${1}  matches replaced.":"${0} out of ${1}  matches replaced.","Replace all matches with...":"Replace all matches with...","Apply Changes":"Apply Changes","Replace all selected matches":"Replace all selected matches",
"Hide Compare":"Hide Compare","Hide compare view of changes":"Hide compare view of changes","Show Compare":"Show Compare","Show compare view of changes":"Show compare view of changes","Show All":"Show All","Show all the results in one page":"Show all the results in one page","\x3c Previous Page":"\x3c Previous Page","Show previous page of search result":"Show previous page of search result","Next Page \x3e":"Next Page \x3e","Show next page of search result":"Show next page of search result","Next result":"Next result",
"Previous result":"Previous result","Expand all results":"Expand all results","Collapse all results":"Collapse all results","Writing files...":"Writing files...","Preparing preview...":"Preparing preview...","Replaced File (${0})":"Replaced File (${0})","Original File (${0})":"Original File (${0})","Sort by Name":"Sort by Name","Compare changes":"Compare changes","Search Results":"Search Results","Replace All Matches":"Replace All Matches","No matches":"No matches",Rename:"Rename","Save frequently used searches by clicking on the ${0} button above.":"Save frequently used searches by clicking on the ${0} button above.",
Search:"Search","All types":"All types","File type":"File type","All ${0} files":"All ${0} files","${0} is already saved":"${0} is already saved","Type a search term":"Type a search term","Type a replace term":"Type a replace term","Case sensitive":"Case sensitive","File name":"File name","Path name":"Path name",Save:"Save","Type filter text":"Type filter text","Scope Search":"Scoped Search","Open in Search page for this directory":"Open the Search page for this folder.","${0}. Try your search again.":"${0}. Try your search again.",
"Click or use delete key to delete the search term":"Click or use delete key to delete the search term","${0} matches":"${0} matches","Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.":"Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.",
"Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.":"Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.",Scope:"Scope","Show previous search terms":"Show previous search terms","Show previous replace terms":"Show previous replace terms","Show replacement preview":"Show replacement preview",
"File name patterns (comma-separated)":"File name patterns (comma-separated)","(* \x3d any string, ? \x3d any character)":"(* \x3d any string, ? \x3d any character)","Choose a Folder":"Choose a Folder"});define("orion/search/nls/messages",["orion/i18n!orion/search/nls/messages","orion/search/nls/root/messages"],function(m,n){var k={root:n};Object.keys(m).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=m[e])});return k});
(function(m,n){"function"===typeof define&&define.amd?define("orion/Deferred",n):"object"===typeof exports?module.exports=n():(m.orion=m.orion||{},m.orion.Deferred=n())})(this,function(){function m(){for(var b;b=d.shift();)b();g=!1}function n(b){d.push(b);g||(g=!0,f())}function k(b){return function(a){b(a)}}function e(){function b(){for(var a;a=f.shift();){var b=a.deferred,h="fulfilled"===d?"resolve":"reject";a=a[h];if("function"===typeof a)try{var l=a(p),e=l&&("object"===typeof l||"function"===typeof l)&&
l.then;if("function"===typeof e)if(l===b.promise)b.reject(new TypeError);else{var g=l.cancel;"function"===typeof g?b._parentCancel=g.bind(l):delete b._parentCancel;e.call(l,k(b.resolve),k(b.reject),k(b.progress))}else b.resolve(l)}catch(t){b.reject(t)}else b[h](p)}}function a(a){delete g._parentCancel;d="rejected";p=a;f.length&&n(b)}function l(h){function s(a){return function(b){(!d||"assumed"===d)&&a(b)}}delete g._parentCancel;try{var k=h&&("object"===typeof h||"function"===typeof h)&&h.then;if("function"===
typeof k)if(h===g)a(new TypeError);else{d="assumed";var m=h&&h.cancel;if("function"!==typeof m){var z=new e;h=z.promise;try{k(z.resolve,z.reject,z.progress)}catch(A){z.reject(A)}m=h.cancel;k=h.then}p=h;k.call(h,s(l),s(a));g._parentCancel=m.bind(h)}else d="fulfilled",p=h,f.length&&n(b)}catch(B){s(a)(B)}}function h(){var b=g._parentCancel;b?(delete g._parentCancel,b()):d||(b=Error("Cancel"),b.name="Cancel",a(b))}var p,d,f=[],g=this;this.resolve=function(a){d||l(a);return g};this.reject=function(b){d||
a(b);return g};this.progress=function(a){d||f.forEach(function(b){if(b.progress)try{b.progress(a)}catch(h){}});return g.promise};this.cancel=function(){g._parentCancel?setTimeout(h,0):h();return g};this.then=function(a,h,l){var p=new e;p._parentCancel=g.promise.cancel;f.push({resolve:a,reject:h,progress:l,deferred:p});("fulfilled"===d||"rejected"===d)&&n(b);return p.promise};this.promise={then:g.then,cancel:g.cancel}}var d=[],g=!1,f=function(){if("undefined"!==typeof process&&"function"===typeof process.nextTick){var b=
process.nextTick;return function(){b(m)}}if("function"===typeof MutationObserver){var a=document.createElement("div");(new MutationObserver(m)).observe(a,{attributes:!0});return function(){a.setAttribute("class","_tick")}}return function(){setTimeout(m,0)}}();e.all=function(b,a){function l(a,b){f||(d[a]=b,0===--p&&g.resolve(d))}function h(b,h){if(!f){if(a)try{l(b,a(h));return}catch(p){h=p}g.reject(h)}}var p=b.length,d=[],f=!1,g=new e;g.then(void 0,function(){f=!0;b.forEach(function(a){a.cancel&&a.cancel()})});
0===p?g.resolve(d):b.forEach(function(a,b){a.then(l.bind(void 0,b),h.bind(void 0,b))});return g.promise};e.when=function(b,a,l,h){var p;b&&"function"===typeof b.then||(p=new e,p.resolve(b),b=p.promise);return b.then(a,l,h)};return e});
define("orion/EventTarget",[],function(){function m(){this._namedListeners={}}m.prototype={dispatchEvent:function(m){if(!m.type)throw Error("unspecified type");var k=this._namedListeners[m.type];k&&k.forEach(function(e){try{"function"===typeof e?e(m):e.handleEvent(m)}catch(d){"undefined"!==typeof console&&console.log(d)}});return!m.defaultPrevented},addEventListener:function(m,k){if("function"===typeof k||k.handleEvent)this._namedListeners[m]=this._namedListeners[m]||[],this._namedListeners[m].push(k)},
removeEventListener:function(m,k){var e=this._namedListeners[m];if(e)for(var d=0;d<e.length;d++)if(e[d]===k){1===e.length?delete this._namedListeners[m]:e.splice(d,1);break}}};m.prototype.constructor=m;m.attach=function(n){var k=new m;n.dispatchEvent=k.dispatchEvent.bind(k);n.addEventListener=k.addEventListener.bind(k);n.removeEventListener=k.removeEventListener.bind(k)};return m});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(m,n){function k(b,a,l){this._properties=l||{};this._properties["service.id"]=b;this._properties.objectClass=a;this._properties["service.names"]=a}function e(b,a,l){this._serviceId=b;this._serviceReference=a;this._internalRegistry=l}function d(b,a){function l(h){return function(){var l;try{if(!a())throw Error("Service was unregistered");var d=b[h].apply(b,Array.prototype.slice.call(arguments));if(d&&"function"===typeof d.then)return d;
l=new m;l.resolve(d)}catch(f){l=new m,l.reject(f)}return l.promise}}for(var h in b)"function"===typeof b[h]&&(this[h]=l(h))}function g(b,a){this.type=b;this.serviceReference=a}function f(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new n;var b=this;this._internalRegistry={isRegistered:function(a){return b._entries[a]?!0:!1},unregisterService:function(a){var l=b._entries[a];if(!l)throw Error("Service has already been unregistered: "+a);var h=l.reference;b._serviceEventTarget.dispatchEvent(new g("unregistering",
h));b._entries[a]=null;h.getProperty("objectClass").forEach(function(a){for(var l=b._namedReferences[a],d=0;d<l.length;d++)if(l[d]===h){1===l.length?delete b._namedReferences[a]:l.splice(d,1);break}})},modifyService:function(a){var l=b._entries[a];if(!l)throw Error("Service not found while trying to send modified event: "+a);b._serviceEventTarget.dispatchEvent(new g("modified",l.reference))}}}k.prototype={getPropertyKeys:function(){var b=[],a;for(a in this._properties)this._properties.hasOwnProperty(a)&&
b.push(a);return b},getProperty:function(b){return this._properties[b]}};k.prototype.constructor=k;e.prototype={unregister:function(){this._internalRegistry.unregisterService(this._serviceId)},getReference:function(){if(!this._internalRegistry.isRegistered(this._serviceId))throw Error("Service has already been unregistered: "+this._serviceId);return this._serviceReference},setProperties:function(b){var a=this._serviceReference._properties;this._serviceReference._properties=b||{};b["service.id"]=this._serviceId;
b.objectClass=a.objectClass;b["service.names"]=a["service.names"];this._internalRegistry.modifyService(this._serviceId)}};e.prototype.constructor=e;f.prototype={getService:function(b){var a;if("string"===typeof b)(b=this._namedReferences[b])&&b.some(function(b){a=this._entries[b.getProperty("service.id")].service;return!!a},this);else if(b=this._entries[b.getProperty("service.id")])a=b.service;return a||null},getServiceReferences:function(b){if(b)return this._namedReferences[b]?this._namedReferences[b]:
[];var a=[];this._entries.forEach(function(b){b&&a.push(b.reference)});return a},registerService:function(b,a,l){if("undefined"===typeof a||null===a)throw Error("invalid service");"string"===typeof b?b=[b]:Array.isArray(b)||(b=[]);var h=this._entries.length,p=new k(h,b,l),f=this._namedReferences;b.forEach(function(a){f[a]=f[a]||[];f[a].push(p)});b=new d(a,this._internalRegistry.isRegistered.bind(null,h));this._entries.push({reference:p,service:b});b=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new g("registered",
p));return new e(h,p,b)},addEventListener:function(b,a){this._serviceEventTarget.addEventListener(b,a)},removeEventListener:function(b,a){this._serviceEventTarget.removeEventListener(b,a)}};f.prototype.constructor=f;return{ServiceRegistry:f}});
define("orion/xhr",["orion/Deferred"],function(m){function n(k,e,d,g){var f="undefined"!==typeof d.response?d.response:d.responseText,b;try{b=d.status}catch(a){b=0}k={args:e,response:f,responseText:"string"===typeof f?f:null,status:b,url:k,xhr:d};"undefined"!==typeof g&&(k.error=g);return k}return function(k,e,d){d=d||{};var g=3<arguments.length&&arguments[3]?arguments[3]:new XMLHttpRequest,f=new m,b=d.headers||{},a=d.log||!1,l;"undefined"===typeof b["X-Requested-With"]&&(b["X-Requested-With"]="XMLHttpRequest");
if("undefined"!==typeof d.data&&("POST"===k||"PUT"===k))l=d.data;var h=!1,p=!1;f.promise.then(void 0,function(a){h=!0;!p&&(a instanceof Error&&"Cancel"===a.name)&&g.abort()});g.onabort=function(){p=!0;if(!h){var a=Error("Cancel");a.name="Cancel";f.reject(a)}};g.onload=function(){var b=n(e,d,g);200<=g.status&&400>g.status?f.resolve(b):(f.reject(b),a&&"undefined"!==typeof console&&console.log(Error(g.statusText)))};g.onerror=function(){var b=n(e,d,g);f.reject(b);a&&"undefined"!==typeof console&&console.log(Error(g.statusText))};
g.onprogress=function(a){a.xhr=g;f.progress(a)};try{g.open(k,e,!0);"string"===typeof d.responseType&&(g.responseType=d.responseType);if("number"===typeof d.timeout)if("number"===typeof g.timeout)g.timeout=d.timeout,g.addEventListener("timeout",function(a){f.reject(n(e,d,g,"Timeout exceeded"))});else{var q=setTimeout(function(){f.reject(n(e,d,g,"Timeout exceeded"))},d.timeout);f.promise.then(clearTimeout.bind(null,q),clearTimeout.bind(null,q))}Object.keys(b).forEach(function(a){g.setRequestHeader(a,
b[a])});g.send(l||null)}catch(r){f.reject(n(e,d,g,r))}return f.promise}});
define("orion/preferences",["require","orion/Deferred","orion/xhr"],function(m,n,k){function e(a,b){this._name=a;this._providers=b;this._flushPending=!1;this._cached=null;this._stores=[];this._pendingDeletes=[];this._dirty=[]}function d(a,b){return{get:function(d,f){if(0===b)return null;var e=localStorage.getItem(a+d);if(null===e)return null;e=JSON.parse(e);return f||-1===b||e._expires&&e._expires>(new Date).getTime()?(delete e._expires,e):null},set:function(d,f){if(0!==b)if(-1!==b&&(f._expires=(new Date).getTime()+
1E3*b),0===Object.keys(f).length)localStorage.removeItem(a+d);else{var e=JSON.stringify(f);localStorage.setItem(a+d,e);delete f._expires}},remove:function(b){localStorage.removeItem(a+b)}}}function g(a){this._currentPromises={};this._cache=new d("/orion/preferences/user",3600);this._service=null;this.available=function(){if(!this._service){var b=a.getServiceReferences("orion.core.preference.provider");0<b.length&&(this._service=a.getService(b[0]))}return!!this._service}}function f(a){this._location=
a;this._currentPromise=null;this._cache=new d("/orion/preferences/default",3600)}function b(){this._cache=new d("/orion/preferences/local",-1)}function a(a,h){this._userProvider=new g(a);this._localProvider=new b;h=h||"defaults.pref";-1===h.indexOf("://")&&(h=m.toUrl(h));this._defaultsProvider=new f(h);this._serviceRegistration=a.registerService("orion.core.preference",this)}e.prototype={_flush:function(){for(var a=[],b=0;b<this._stores.length;++b){var d=this._stores[b];-1!==this._dirty.indexOf(d)&&
a.push(this._providers[b].put(this._name,d));if(this._pendingDeletes[b]&&0<this._pendingDeletes[b].length){for(d=0;d<this._pendingDeletes[b].length;d++)a.push(this._providers[b].remove(this._name,this._pendingDeletes[b][d]));delete this._pendingDeletes[b]}}this._dirty=[];return n.all(a)},_scheduleFlush:function(a){a&&-1===this._dirty.indexOf(a)&&this._dirty.push(a);this._flushPending||(this._flushPending=!0,window.setTimeout(function(){this._flushPending&&(this._flushPending=!1,this._flush())}.bind(this),
0))},_getCached:function(){if(!this._cached){this._cached={};for(var a=0;a<this._stores.length;++a){var b=this._stores[a],d;for(d in b)b.hasOwnProperty(d)&&"undefined"===typeof this._cached[d]&&(this._cached[d]=b[d])}}return this._cached},keys:function(){return Object.keys(this._getCached())},get:function(a){return this._getCached()[a]},put:function(a,b){if(0!==this._stores.length){var d=this._stores[0];d[a]!==b&&(d[a]=b,this._cached=null,this._scheduleFlush(d))}},remove:function(a){for(var b=0;b<
this._stores.length;++b){var d=this._stores[b];if(d.hasOwnProperty(a))return delete d[a],this._pendingDeletes[b]||(this._pendingDeletes[b]=[]),this._pendingDeletes[b].push(a),this._cached=null,this._scheduleFlush(),!0}return!1},clear:function(){for(var a=0;a<this._stores.length;++a)this._stores[a]={},this._scheduleFlush(this._stores[a]);this._cached=null},sync:function(a){if(this._flushPending)return this._flushPending=!1,this._flush();for(var b=this,d=[],f=0;f<this._providers.length;++f)d.push(this._providers[f].get(this._name,
a).then(function(a){return function(l){b._stores[a]=l}}(f)));return n.all(d).then(function(){b._cached=null;b._getCached()})},flush:function(){this._flush()}};g.prototype={get:function(a,b){if(this._currentPromises[a])return this._currentPromises[a];var d=new n,f=null;b?this._cache.remove(a):f=this._cache.get(a);if(null!==f)d.resolve(f);else{this._currentPromises[a]=d;var e=this;this._service.get(a).then(function(b){e._cache.set(a,b);delete e._currentPromises[a];d.resolve(b)},function(b){404===b.status?
(b={},e._cache.set(a,b),delete e._currentPromises[a],d.resolve(b)):(delete e._currentPromises[a],d.resolve(e._cache.get(a,!0)||{}))})}return d},put:function(a,b){this._cache.set(a,b);return this._service.put(a,b)},remove:function(a,b){var d=this._cache.get(a);delete d[b];this._cache.set(a,d);return this._service.remove(a,b)}};f.prototype={get:function(a,b){if(this._currentPromise)return this._currentPromise;var d=new n,f=null;b?this._cache.remove(a):f=this._cache.get(a);if(null!==f)d.resolve(f);else{this._currentPromise=
d;var e=this;k("GET",this._location,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(b){b=JSON.parse(b.response);e._cache.set(a,b[a]||{});e._currentPromise=null;d.resolve(b[a]||{})},function(b){401===b.xhr.status||404===b.xhr.status?(e._cache.set(a,{}),e._currentPromise=null,d.resolve({})):(e._currentPromise=null,b=e._cache.get(a,!0),null!==b?d.resolve(b[a]||{}):d.resolve({}))})}return d},put:function(a,b){var d=new n;d.resolve();return d},remove:function(a,b){var d=this._cache.get(a);
delete d[b];this.put(a,d)}};b.prototype={get:function(a){var b=new n;a=this._cache.get(a);null!==a?b.resolve(a):b.resolve({});return b},put:function(a,b){var d=new n;this._cache.set(a,b);d.resolve();return d},remove:function(a,b){var d=this._cache.get(a);delete d[b];this.put(a,d)}};a.DEFAULT_SCOPE=1;a.LOCAL_SCOPE=2;a.USER_SCOPE=4;a.prototype={listenForChangedSettings:function(b,h,d){if(!h||"number"!==typeof h||7<h||1>h)d=h,h=a.DEFAULT_SCOPE|a.LOCAL_SCOPE|a.USER_SCOPE;window.addEventListener("storage",
d,!1);return 0!==(a.USER_SCOPE&h)?"/orion/preferences/user"+b:0!==(a.LOCAL_SCOPE&h)?"/orion/preferences/local"+b:"/orion/preferences/default"+b},getPreferences:function(b,h){if(!h||"number"!==typeof h||7<h||1>h)h=a.DEFAULT_SCOPE|a.LOCAL_SCOPE|a.USER_SCOPE;var d=[];a.USER_SCOPE&h&&this._userProvider.available()&&d.push(this._userProvider);a.LOCAL_SCOPE&h&&d.push(this._localProvider);a.DEFAULT_SCOPE&h&&d.push(this._defaultsProvider);var f=new e(b,d);return f.sync().then(function(){return f})},getSetting:function(a,
b,d){for(var f,e=0;e<a.length;e++)if(a[e].label===b)for(var g=0;g<a[e].data.length;g++)if(a[e].data[g].label===d){f=a[e].data[g].value;break}return f}};return{PreferencesService:a}});
(function(){function m(a){if("string"!==typeof a)throw new TypeError;}function n(a){return a?a.split("\x26"):[]}function k(a){return 0===a.length?"":a.join("\x26")}function e(a){var b=/([^=]*)(?:=?)(.*)/.exec(a);a=b[1]?decodeURIComponent(b[1]):"";b=b[2]?decodeURIComponent(b[2]):"";return[a,b]}function d(a){var b=encodeURIComponent(a[0]);a[1]&&(b+="\x3d"+encodeURIComponent(a[1]));return b}function g(a,b){var u="",h=[],d=0;return{next:function(){u!==a.query&&(u=a.query,h=n(u));if(d<h.length){var l=
e(h[d++]);switch(b){case "keys":return l[0];case "values":return l[1];case "keys+values":return[l[0],l[1]];default:throw new TypeError;}}throw C;}}}function f(a){Object.defineProperty(this,"_url",{get:function(){return a._url}})}function b(a){return a?/[1-9]\d*$/.exec(a)[0]:""}function a(a){var b=[];a.split("/").forEach(function(a){".."===a?b.pop():"."!==a&&b.push(a)});return b.join("/")}function l(a){return a.replace(/\s/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}function h(u,h){if("string"!==
typeof u)throw new TypeError;u=l(u);var d=t.exec(u);if(!d)return null;var f={};f.scheme=d[1]||"";if(f.scheme&&!s.test(f.scheme))return null;var p=d[2];if(p&&(p=w.exec(p),f.userinfo=p[1],f.host=p[2],f.port=p[3],f.port&&!x.test(f.port)))return null;f.path=d[3];f.query=d[4];f.fragment=d[5];!f.scheme&&h&&(f.scheme=h.scheme,!f.host&&h.host&&(f.userinfo=h.userinfo,f.host=h.host,f.port=h.port,f.pathRelative=!0));f.pathRelative&&(f.path?"/"!==f.path[0]&&(d=/^(.*\/)[^\/]*$/.exec(h.path)[1]||"/",f.path=d+f.path):
f.path=h.path);f.scheme&&(f.scheme=f.scheme.toLowerCase());f.port&&(f.port=b(f.port));f.host&&f.path&&(f.path=a(f.path));return f}function p(a,b){var u;if(b){b=b.href||b;u=h(b);if(!u||!u.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:u})}u=h(a,u);if(!u)throw new SyntaxError;Object.defineProperty(this,"_input",{value:a,writable:!0});Object.defineProperty(this,"_url",{value:u,writable:!0});var d=new f(this);Object.defineProperty(this,"query",{get:function(){return this._url?
d:null},enumerable:!0})}try{var q;if("function"===typeof window.URL&&0!==window.URL.length&&"http:"===(q=new window.URL("http://www.w3.org?q")).protocol&&q.query)return}catch(r){}var t=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,w=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,s=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,x=/^\d*$/,v=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,z=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,A=/^([^?#\s]*)$/,B=/^([^\s]*)$/,u=/^\S*$/,y=/([^:]*):?(.*)/,C="undefined"!==
typeof StopIteration?StopIteration:Error("Stop Iteration"),E={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(f.prototype,{get:{value:function(a){m(a);var b;n(this._url.query).some(function(u){u=e(u);if(u[0]===a)return b=u[1],!0});return b},enumerable:!0},set:{value:function(a,b){m(a);m(b);var u=n(this._url.query);u.some(function(h,f){var l=e(h);if(l[0]===a)return l[1]=b,u[f]=d(l),!0})||u.push(d([a,b]));this._url.query=k(u)},enumerable:!0},has:{value:function(a){m(a);
return n(this._url.query).some(function(b){if(e(b)[0]===a)return!0})},enumerable:!0},"delete":{value:function(a){m(a);var b=n(this._url.query),u=b.filter(function(b){return e(b)[0]!==a});return u.length!==b.length?(this._url.query=k(u),!0):!1},enumerable:!0},clear:{value:function(){this._url.query=""},enumerable:!0},forEach:{value:function(a,b){if("function"!==typeof a)throw new TypeError;var u=g(this._url,"keys+values");try{for(;;){var h=u.next();a.call(b,h[1],h[0],this)}}catch(d){if(d!==C)throw d;
}},enumerable:!0},keys:{value:function(){return g(this._url,"keys")},enumerable:!0},values:{value:function(){return g(this._url,"values")},enumerable:!0},items:{value:function(){return g(this._url,"keys+values")}},size:{get:function(){return n(this._url.query).length},enumerable:!0},getAll:{value:function(a){m(a);var b=[];n(this._url.query).forEach(function(u){u=e(u);u[0]===a&&b.push(u[1])});return b},enumerable:!0},append:{value:function(a,b){m(a);m(b);var u=n(this._url.query);u.push(d([a,b]));this._url.query=
k(u)},enumerable:!0}});Object.defineProperties(p.prototype,{href:{get:function(){var a;if(this._url){a=this._url;var b=a.scheme?a.scheme+":":"";a.host&&(b+="//",a.userinfo&&(b+=a.userinfo+"@"),b+=a.host,a.port&&(b+=":"+a.port));b+=a.path;a.query&&(b+="?"+a.query);a.fragment&&(b+="#"+a.fragment);a=b}else a=this._input;return a},set:function(a){m(a);this._input=a;this._url=h(this._input,this._baseURL)},enumerable:!0},origin:{get:function(){return this._url&&this._url.host?this.protocol+"//"+this.host:
""},enumerable:!0},protocol:{get:function(){return this._url?this._url.scheme+":":":"},set:function(a){m(a);if(this._url&&(a=":"===a.slice(-1)?a.substring(0,a.length-1):a,""===a||s.test(a)))this._url.scheme=a.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(a){m(a);this._url&&(this._url.userinfo=a)}},username:{get:function(){if(!this._url)return"";var a=y.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){m(a);if(this._url){var b=
y.exec(this._userinfo);a=[encodeURIComponent(a||"")];b[2]&&a.push(b[2]);this._userinfo=a.join(":")}},enumerable:!0},password:{get:function(){if(!this._url)return"";var a=y.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){m(a);if(this._url){var b=[y.exec(this._userinfo)[1]||""];a&&b.push(encodeURIComponent(a));this._userinfo=b.join(":")}},enumerable:!0},host:{get:function(){var a="";this._url&&this._url.host&&(a+=this._url.host,this._url.port&&(a+=":"+this._url.port));return a},
set:function(a){m(a);if(this._url&&(a=z.exec(a)))this._url.host=a[1],this._url.port=b(a[2])},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(a){m(a);this._url&&v.exec(a)&&(this._url.host=a)},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===E[this.protocol]&&(a="");return a},set:function(a){m(a);this._url&&x.exec(a)&&(this._url.port=b(a))},enumerable:!0},pathname:{get:function(){return this._url?this._url.path:""},set:function(b){m(b);
this._url&&A.exec(b)&&(this._url.host&&(b&&"/"!==b[0])&&(b="/"+b),this._url.path=b?a(b):"")},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(a){m(a);this._url&&(a&&"?"===a[0]&&(a=a.substring(1)),B.exec(a)&&(this._url.query=a))},enumerable:!0},hash:{get:function(){return this._url&&this._url.fragment?"#"+this._url.fragment:""},set:function(a){m(a);this._url&&(a&&"#"===a[0]&&(a=a.substring(1)),u.exec(a)&&(this._url.fragment=a))},enumerable:!0}});
if((q=window.URL||window.webkitURL)&&q.createObjectURL)Object.defineProperty(p,"createObjectURL",{value:q.createObjectURL.bind(q),enumerable:!1}),Object.defineProperty(p,"revokeObjectURL",{value:q.revokeObjectURL.bind(q),enumerable:!1});window.URL=p})();define("orion/URL-shim",function(){});
define("orion/pluginregistry",["orion/Deferred","orion/EventTarget","orion/URL-shim"],function(m,n){function k(a,b){var h=Object.keys(a),d=Object.keys(b);if(h.length!==d.length)return!1;h.sort();d.sort();for(var f=0,l=h.length;f<l;f++){var e=h[f];if(e!==d[f])return!1;var g=a[e],e=b[e];if(g!==e&&JSON.stringify(g)!==JSON.stringify(e))return!1}return!0}function e(a){if(-1===a.indexOf("://"))try{return(new URL(a,location.href)).href}catch(b){}return a}function d(a){var b=null,h={key:function(h){return(b=
b||Object.keys(a))[h]},getItem:function(b){return a[b]},setItem:function(h,d){a[h]=d;b=null},removeItem:function(h){delete a[h];b=null},clear:function(){(b=b||Object.keys(a)).forEach(function(b){delete a[b]}.bind(this));b=null}};Object.defineProperty(h,"length",{get:function(){return(b=b||Object.keys(a)).length}});return h}function g(a,b){if(b&&b instanceof XMLHttpRequest){var h,d;try{h=b.status,d=b.statusText}catch(f){h=0,d=""}return{status:h||0,statusText:d}}return b}function f(a){var b=a?JSON.parse(JSON.stringify(a,
g)):a;a instanceof Error&&(b.__isError=!0,b.message=b.message||a.message,b.name=b.name||a.name);return b}function b(a,b){this.type=a;this.plugin=b}function a(a,b){this.__objectId=a;this.__methods=b}function l(h,d,l){function e(a){F&&l.postMessage(a,F)}function g(b){if(!F)return(new m).reject(Error("plugin not connected"));b.id=String(Q++);var u=new m;V[b.id]=u;u.then(null,function(a){"active"===G&&(a instanceof Error&&"Cancel"===a.name)&&e({requestId:b.id,method:"cancel",params:a.message?[a.message]:
[]})});var h=Object.prototype.toString;b.params.forEach(function(d,l){if("[object Object]"===h.call(d)&&!(d instanceof a)){var f,p;for(f in d)"[object Function]"===h.call(d[f])&&(p=p||[],p.push(f));if(p){var y=R++;W[y]=d;f=function(){delete W[y]};u.then(f,f);b.params[l]=new a(y,p)}}});l.postMessage(b,F);return u.promise}function s(a,b){a||0===a?e({id:a,result:null,error:b}):console.log(b)}function x(a,b,u,h){h.forEach(function(a,b){if(a&&"undefined"!==typeof a.__objectId){var u={};a.__methods.forEach(function(b){u[b]=
function(){return g({objectId:a.__objectId,method:b,params:Array.prototype.slice.call(arguments)})}});h[b]=u}});var d=void 0===typeof a?null:{id:a,result:null,error:null};try{var l=u.apply(b,h);d&&(l&&"function"===typeof l.then?(U[a]=l,l.then(function(b){delete U[a];d.result=b;e(d)},function(b){U[a]&&(delete U[a],d.error=f(b),e(d))},function(){e({responseId:a,method:"progress",params:Array.prototype.slice.call(arguments)})})):(d.result=l,e(d)))}catch(p){d&&(d.error=f(p),e(d))}}function v(a){try{if(a.method){var b=
a.method,u=a.params||[];if("serviceId"in a){var h=X[a.serviceId];h||s(a.id,"service not found");b in h?x(a.id,h,h[b],u):s(a.id,"method not found")}else if("objectId"in a){var d=W[a.objectId];d||s(a.id,"object not found");b in d?x(a.id,d,d[b],u):s(a.id,"method not found")}else if("requestId"in a){var f=U[a.requestId];f&&("cancel"===b&&f.cancel)&&f.cancel.apply(f,u)}else if("responseId"in a){var p=V[a.responseId];p&&("progress"===b&&p.progress)&&p.progress.apply(p,u)}else if("plugin"===a.method){F.connected();
var q=a.params[0];Y({headers:q.headers,services:q.services}).then(function(){K&&K.resolve(y)})}else if("timeout"===a.method)K&&K.reject(a.error);else throw Error("Bad method: "+a.method);}else{var C=V[String(a.id)];delete V[String(a.id)];if(a.error){var e=l.handleServiceError(y,a.error);C.reject(e)}else C.resolve(a.result)}}catch(g){console.log("Plugin._messageHandler "+g)}}function z(b){var u={};if(b.methods&&(b.methods.forEach(function(a){u[a]=function(){var u={serviceId:b.serviceId,method:a,params:Array.prototype.slice.call(arguments)};
return"active"===G?g(u):y.start({"transient":!0}).then(function(){return g(u)})}}),u.addEventListener&&u.removeEventListener)){var h=new n,d=R++;W[d]={handleEvent:h.dispatchEvent.bind(h)};var f=new a(d,["handleEvent"]),l=u.addEventListener;u.addEventListener=function(a,b){h._namedListeners[a]||l(a,f);h.addEventListener(a,b)};var p=u.removeEventListener;u.removeEventListener=function(a,b){h.removeEventListener(a,b);h._namedListeners[a]||p(a,f)}}return u}function A(a){var b=JSON.parse(JSON.stringify(a.properties));
b.__plugin__=h;a=a.names||a.type||[];Array.isArray(a)||(a=[a]);b.objectClass=a;return b}function B(a){var b=z(a),u=A(a),u=l.registerService(a.names||a.type,b,u);L[a.serviceId]={registration:u,proxy:b}}function u(){l.persist(h,{created:C,headers:E,services:D,autostart:H,lastModified:I})}var y=this;d=d||{};var C=d.created||(new Date).getTime(),E=d.headers||{},D=d.services||[],H=d.autostart,I=d.lastModified||0,G="installed",J,K,F,P,L={},Q=0,R=0,U={},V={},W={},X={},Y;this._default=!1;this._persist=u;
this._resolve=function(){G="resolved";l.dispatchEvent(new b("resolved",y))};this._getAutostart=function(){return H};this._getCreated=function(){return C};this.getLocation=function(){return h};this.getHeaders=function(){return JSON.parse(JSON.stringify(E))};this.getName=function(){var a=this.getHeaders();return a?a.name||"":null};this.getVersion=function(){var a=this.getHeaders();return a?a.version||"0.0.0":null};this.getLastModified=function(){return I};this.getServiceReferences=function(){var a=
[];Object.keys(L).forEach(function(b){a.push(L[b].registration.getReference())});return a};this.setParent=function(a){return P!==a?(P=a,y.stop({"transient":!0}).then(function(){if("started"===H)return y.start({"transient":!0});if("lazy"===H)return y.start({lazy:!0,"transient":!0})})):(new m).resolve()};this.getState=function(){return G};this.start=function(a){if("uninstalled"===G)return(new m).reject(Error("Plugin is uninstalled"));if(J)return J.promise.then(this.start.bind(this,a));if("active"===
G)return(new m).resolve();if(!a||!a.transient){var d=a&&a.lazy?"lazy":"started";d!==H&&(H=d,u())}d=l.getState();if("starting"!==d&&"active"!==d)return a.transient?(new m).reject(Error("start transient error")):(new m).resolve();if("installed"===G)try{this._resolve()}catch(f){return(new m).reject(f)}"resolved"===G&&D.forEach(function(a){B(a)});if(a&&a.lazy)return"starting"!==G&&(G="starting",l.dispatchEvent(new b("lazy activation",y))),(new m).resolve();var q=new m;J=q;G="starting";l.dispatchEvent(new b("starting",
y));K=new m;F=l.connect(h,v,P);K.then(function(){K=null;G="active";l.dispatchEvent(new b("started",y));J=null;q.resolve()},function(){K=null;G="stopping";l.dispatchEvent(new b("stopping",y));Object.keys(L).forEach(function(a){L[a].registration.unregister();delete L[a]});l.disconnect(F);F=null;G="resolved";J=null;l.dispatchEvent(new b("stopped",y));q.reject(Error("Failed to load plugin: "+h));y._default&&(I=0,u())});return q.promise};this.stop=function(a){if("uninstalled"===G)return(new m).reject(Error("Plugin is uninstalled"));
if(J)return J.promise.then(this.stop.bind(this,a));if((!a||!a.transient)&&"stopped"!==H)H="stopped",u();if("active"!==G&&"starting"!==G)return(new m).resolve();J=a=new m;G="stopping";l.dispatchEvent(new b("stopping",y));Object.keys(L).forEach(function(a){L[a].registration.unregister();delete L[a]});F&&(l.disconnect(F),F=null);G="resolved";J=null;l.dispatchEvent(new b("stopped",y));a.resolve();return a.promise};Y=function(a){if("uninstalled"===G)return(new m).reject(Error("Plugin is uninstalled"));
if(!a)return 0===I&&(I=(new Date).getTime(),u()),l.loadManifest(h).then(Y,function(){y._default&&(I=0,u());console.log("Failed to load plugin: "+h)});var d=E,f=D,q=H;E=a.headers||{};D=a.services||[];H=a.autostart||H;a.lastModified?I=a.lastModified:(I=(new Date).getTime(),u());if(k(E,d)&&k(D,f)&&H===q)return(new m).resolve();if("active"===G||"starting"===G){var C=[];Object.keys(D).forEach(function(a){var b=D[a];C.push(a);var u=L[a];if(u){if(k(b.methods,Object.keys(u.proxy))){a=A(b);var h=u.registration.getReference(),
d={};h.getPropertyKeys().forEach(function(a){d[a]=h.getProperty(a)});k(a,d)||u.registration.setProperties(a);return}u.registration.unregister();delete L[a]}B(b)});Object.keys(L).forEach(function(a){-1===C.indexOf(a)&&(L[a].registration.unregister(),delete L[a])})}"active"===G&&(l.disconnect(F),K=new m,F=l.connect(h,v,P),K.then(function(){K=null},function(){K=null;G="stopping";l.dispatchEvent(new b("stopping"),y);Object.keys(L).forEach(function(a){L[a].registration.unregister();delete L[a]});l.disconnect(F);
F=null;G="resolved";l.dispatchEvent(new b("stopped",y))}));return(new m).resolve()};this.update=function(a){return Y(a).then(function(){l.dispatchEvent(new b("updated",y))})};this.uninstall=function(){if("uninstalled"===G)return(new m).reject(Error("Plugin is uninstalled"));if("active"===G||"starting"===G||"stopping"===G)return this.stop().then(this.uninstall.bind(this),this.uninstall.bind(this));l.removePlugin(this);G="uninstalled";l.dispatchEvent(new b("uninstalled",y));return(new m).resolve()}}
var h=/^http[s]?/i;return{Plugin:l,PluginRegistry:function(a,f){function g(a){var b=a.source;v.some(function(h){if(b===h.target){try{var d;if("undefined"===typeof h.useStructuredClone){var f="string"!==typeof a.data;d=f?a.data:JSON.parse(a.data);h.useStructuredClone=f}else d=h.useStructuredClone?a.data:JSON.parse(a.data);h.handler(d)}catch(l){}return!0}})}f=f||{};var t=f.storage||localStorage;t.getItem||(t=d(t));var w="installed",s,k=[],v=[],z=new n,A={},B={registerService:a.registerService.bind(a),
connect:function(a,b,h,d){function f(a){a=Error(a);a.name="timeout";b({method:"timeout",error:a})}var l={handler:b,url:a},p=setTimeout(f.bind(null,"Load timeout for: "+a),d||15E3),q=document.createElement("iframe");q.name=a+"_"+(new Date).getTime();q.src=a;q.onload=function(){clearTimeout(p);p=setTimeout(f.bind(null,"Plugin handshake timeout for: "+a),5E3)};q.sandbox="allow-scripts allow-same-origin";q.style.width=q.style.height="100%";q.frameBorder=0;(h||s).appendChild(q);l.target=q.contentWindow;
l.connected=function(){clearTimeout(p)};l.close=function(){clearTimeout(p);if(q){var a=q.parentNode;a&&a.removeChild(q);q=null}};v.push(l);return l},disconnect:function(a){for(var b=0;b<v.length;b++)if(a===v[b]){v.splice(b,1);try{a.close()}catch(h){}break}},removePlugin:function(a){for(var b=0;b<k.length;b++)if(a===k[b]){k.splice(b,1);break}t.removeItem("plugin."+a.getLocation())},persist:function(a,b){t.setItem("plugin."+a,JSON.stringify(b))},postMessage:function(a,b){b.target.postMessage(b.useStructuredClone?
a:JSON.stringify(a),b.url)},dispatchEvent:function(a){try{z.dispatchEvent(a)}catch(b){console&&console.log("PluginRegistry.dispatchEvent "+b)}},loadManifest:function(a){var b=new m,h=B.connect(a,function(a){h&&a.method&&("manifest"===a.method||"plugin"===a.method?(a=a.params[0],B.disconnect(h),h=null,b.resolve(a)):"timeout"===a.method&&(B.disconnect(h),h=null,b.reject(a.error)))});return b.promise},getState:function(){return w},handleServiceError:function(a,b){if(b&&401===b.status){var d=a.getHeaders(),
f=a.getName()||a.getLocation(),l=document.createElement("span");l.appendChild(document.createTextNode("Authentication required for: "+f+"."));d.login&&(l.appendChild(document.createTextNode(" ")),f=document.createElement("a"),f.target="_blank",f.textContent="Login",f.href=d.login,h.test(f.href)?(l.appendChild(f),l.appendChild(document.createTextNode(" and re-try the request."))):console.log("Illegal Login URL: "+d.login));return{Severity:"Error",HTML:!0,Message:(new XMLSerializer).serializeToString(l)}}if(b.__isError){var p=
b;b=Error(p.message);Object.keys(p).forEach(function(a){b[a]=p[a]});delete b.__isError}return b}};this.getLocation=function(){return"System"};this.getHeaders=function(){return{}};this.getName=function(){return"System"};this.getVersion=function(){return"0.0.0"};this.getLastModified=function(){return 0};this.getState=B.getState;this.init=function(){if(!("starting"===w||"active"===w||"stopping"===w)){addEventListener("message",g,!1);for(var a=[],b=0,h=t.length;b<h;b++)a.push(t.key(b));a.forEach(function(a){if(0===
a.indexOf("plugin.")){var b=a.substring(7);a=JSON.parse(t.getItem(a));a.created&&k.push(new l(b,a,B))}});k.sort(function(a,b){return a._getCreated()<b._getCreated()?-1:1});f.parent?s=f.parent:(s=document.createElement("div"),f.visible||(s.style.display="none",s.style.visibility="hidden"),document.body.appendChild(s));f.plugins&&Object.keys(f.plugins).forEach(function(a){a=e(a);var b=this.getPlugin(a);b?b._default=!0:(b=f.plugins[a],"object"!==typeof b&&(b={}),b.autostart=b.autostart||f.defaultAutostart||
"lazy",b=new l(a,b,B),b._default=!0,k.push(b))}.bind(this));w="starting"}};this.start=function(){"starting"!==w&&this.init();if("starting"!==w)return(new m).reject("Cannot start framework. Framework is already "+w+".");var a=[],b=(new Date).getTime();k.forEach(function(h){var d=h._getAutostart();0===h.getLastModified()?a.push(h.update().then(function(){if("started"===d)return h.start({"transient":!0});if("lazy"===d)return h.start({lazy:!0,"transient":!0});h._resolve()})):"started"===d?a.push(h.start({"transient":!0})):
"lazy"===d?(a.push(h.start({lazy:!0,"transient":!0})),b>h.getLastModified()+864E5&&h.update()):h._resolve()});return m.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){w="active"})};this.stop=function(){if("starting"!==w&&"active"!==w)return(new m).reject("Cannot stop registry. Registry is already "+w+".");w="stopping";var a=[];k.forEach(function(b){a.push(b.stop({"transient":!0}))});return m.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){if(!f.parent){var a=
s.parentNode;a&&a.removeChild(s)}s=null;removeEventListener("message",g);w="resolved"})};this.update=function(){this.stop().then(this.start.bind(this))};this.uninstall=function(){return(new m).reject("Cannot uninstall registry")};this.installPlugin=function(a,h){a=e(a);var d=this.getPlugin(a);if(d)return(new m).resolve(d);if(A[a])return A[a];if(h)return d=new l(a,h,B),k.push(d),d._persist(),B.dispatchEvent(new b("installed",d)),(new m).resolve(d);var f=B.loadManifest(a).then(function(h){d=new l(a,
h,B);k.push(d);d._persist();delete A[a];B.dispatchEvent(new b("installed",d));return d},function(b){delete A[a];throw b;});return A[a]=f};this.getPlugins=function(){return k.slice()};this.getPlugin=function(a){var b=null;a=e(a);k.some(function(h){if(a===h.getLocation())return b=h,!0});return b};this.addEventListener=z.addEventListener.bind(z);this.removeEventListener=z.removeEventListener.bind(z);this.resolvePlugins=function(){var a=!0;k.forEach(function(b){a=a&&b._resolve()});return a}}}});
define("orion/objects",[],function(){function m(m){for(var k=Object.prototype.hasOwnProperty,e=1,d=arguments.length;e<d;e++){var g=arguments[e],f;for(f in g)k.call(g,f)&&(m[f]=g[f])}return m}return{clone:function(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var k=Object.create(Object.getPrototypeOf(n));m(k,n);return k},mixin:m,toArray:function(m){return Array.isArray(m)?m:[m]}}});
define("orion/serviceTracker",[],function(){function m(e,d){function g(h){var d=h.getProperty("service.id"),f=this.addingService(h);f&&(b[d]=h,a[d]=f)}function f(h){var d=h.getProperty("service.id"),f=a[d];delete b[d];delete a[d];this.removedService(h,f)}this.serviceRegistry=e;var b={},a={},l=n,h,p;this.close=function(){if(l!==k)throw"Already closed";l=n;e.removeEventListener("registered",h);e.removeEventListener("unregistering",p);p=h=null;var a=this;this.getServiceReferences().forEach(function(b){f.call(a,
b)});if("function"===typeof this.onClose)this.onClose()};this.getServiceReferences=function(){var a=Object.keys(b);return!a.length?null:a.map(function(a){return b[a]})};this.open=function(){if(l!==n)throw"Already open";l=k;var a=this;h=function(b){if(-1!==b.serviceReference.getProperty("objectClass").indexOf(d)&&(g.call(a,b.serviceReference),"function"===typeof a.onServiceAdded))return a.onServiceAdded(b.serviceReference,a.serviceRegistry.getService(b.serviceReference))};p=function(b){-1!==b.serviceReference.getProperty("objectClass").indexOf(d)&&
f.call(a,b.serviceReference)};e.addEventListener("registered",h);e.addEventListener("unregistering",p);e.getServiceReferences(d).forEach(function(b){g.call(a,b);if("function"===typeof a.onServiceAdded)return a.onServiceAdded(b,e.getService(b))});if("function"===typeof this.onOpen)this.onOpen()}}var n=0,k=1;m.prototype={addingService:function(e){return this.serviceRegistry.getService(e)},onOpen:null,onClose:null,onServiceAdded:null,removedService:function(e,d){}};return m});
define("orion/config",["orion/Deferred","orion/objects","orion/preferences","orion/serviceTracker"],function(m,n,k,e){var d=k.PreferencesService,g,f,b,a,l=d.DEFAULT_SCOPE,h="pid",p="/cm/configurations";g=function(a,b,d){function f(a,h,d){h.forEach(function(u,f){try{var l=a[f].getProperty("__plugin__"),p=l&&b.getPlugin(l);(!l||p&&"active"===p.getState())&&h[f].updated(d)}catch(q){"undefined"!==typeof console&&console.log(q)}})}e.call(this,a,"orion.cm.managedservice");var l={},p={},g=function(b){var f=
[];b.plugin.getServiceReferences().forEach(function(b){if(-1!==b.getProperty("objectClass").indexOf("orion.cm.managedservice")){var u=b.getProperty(h);b=a.getService(b);u&&b&&(u=(u=d._find(u))&&u.getProperties(),f.push(b.updated(u)))}});return m.all(f)};this.addingService=function(b){var d=b.getProperty(h),f=a.getService(b);if(!d||!f)return null;l[d]||(l[d]=[]);p[d]||(p[d]=[]);l[d].push(b);p[d].push(f);return f};this.onServiceAdded=function(a,b){var l=a.getProperty(h),l=d._find(l);f([a],[b],l&&l.getProperties())};
this.onOpen=function(){b.addEventListener("started",g)};this.onClose=function(){b.removeEventListener("started",g)};this.notifyUpdated=function(a){var b=a.getPid();f(l[b]||[],p[b]||[],a.getProperties())};this.notifyDeleted=function(a){a=a.getPid();f(l[a]||[],p[a]||[],null)};this.removedService=function(a,b){var d=a.getProperty(h),u=l[d],f=p[d];1<u.length?u.splice(u.indexOf(a),1):delete l[d];1<f.length?f.splice(f.indexOf(b),1):delete p[d]}};k=function(){function a(h,d,l){this.store=new f(this,l);this.configAdmin=
new b(this,this.store);this.tracker=new g(h,d,this.store)}a.prototype={getConfigurationAdmin:function(){var a=this;return this.configAdmin._init().then(function(b){a.tracker.open();return b})},notifyDeleted:function(a){this.tracker.notifyDeleted(a)},notifyUpdated:function(a){this.tracker.notifyUpdated(a)}};return a}();b=function(){function a(b,h){this.factory=b;this.store=h}a.prototype={_prefName:p,_init:function(){var a=this;return this.store._init().then(function(){return a})},getConfiguration:function(a){return this.store.get(a)},
getDefaultConfiguration:function(a){return this.store._find(a,l)},listConfigurations:function(){return this.store.list()}};return a}();f=function(){function b(a,h){this.factory=a;this.prefsService=h;this.pref=this.configs=this.defaultConfigs=null;var d=this;this.initPromise=m.all([this.prefsService.getPreferences(p,l),this.prefsService.getPreferences(p)]).then(function(a){var b=a[0];d.pref=a[1];d.defaultConfigs=d._toConfigs(b,!0);d.configs=d._toConfigs(d.pref,!1,b)})}b.prototype={_toConfigs:function(b,
d,f){var l=Object.create(null),p=this;b.keys().forEach(function(q){if(!l[q]){var e=b.get(q),g=f&&f.get(q);"object"===typeof e&&(null!==e&&0<Object.keys(e).length)&&(e[h]=q,l[q]=new a(p.factory,p,e,d,g))}});return l},_init:function(){return this.initPromise},_find:function(a,b){return b===d.DEFAULT_SCOPE?this.defaultConfigs[a]||null:this.configs[a]||null},get:function(b){var h=this._find(b),d=this._find(b,l);h||(h=d&&d.getProperties(!0),h=new a(this.factory,this,b,!1,h),this.configs[b]=h);return h},
list:function(){var a=this,b=[];this.pref.keys().forEach(function(h){(h=a._find(h))&&null!==h.getProperties()&&b.push(h)});return b},remove:function(a){this.pref.remove(a);delete this.configs[a]},save:function(a,b){var h=b.getProperties(!0)||{},d=this._find(a,l);if(d){var f=d.getProperties(!0);Object.keys(f).forEach(function(a){Object.prototype.hasOwnProperty.call(h,a)&&h[a]===f[a]&&delete h[a]})}this.pref.put(a,h)}};return b}();a=function(){function a(b,d){d=n.clone(d);delete d[h];b.properties=d}
function b(d,f,l,p,e){this.factory=d;this.store=f;this.readOnly=p;if(null!==l&&"object"===typeof l)this.pid=l[h],a(this,l);else if("string"===typeof l)this.pid=l,this.properties=null;else throw Error("Invalid pid/properties "+l);if(e){var g=this;Object.keys(e).forEach(function(a){a===h||Object.prototype.hasOwnProperty.call(g.properties,a)||(g.properties[a]=e[a])})}}b.prototype={_checkReadOnly:function(){if(this.readOnly)throw Error("Configuration is read only");},_checkRemoved:function(){if(this.removed)throw Error("Configuration was removed");
},getPid:function(){this._checkRemoved();return this.pid},getProperties:function(a){this._checkRemoved();var b=null;this.properties&&(b=n.clone(this.properties),a||(b[h]=this.pid));return b},remove:function(){this._checkReadOnly();this._checkRemoved();this.factory.notifyDeleted(this);this.store.remove(this.pid);this.removed=!0},update:function(b){this._checkReadOnly();this._checkRemoved();a(this,b);this.store.save(this.pid,this);this.factory.notifyUpdated(this)},toString:function(){return"[ConfigImpl pid: "+
this.pid+", properties: "+JSON.stringify(this.properties)+"]"}};return b}();return{ConfigurationAdminFactory:k}});
define("orion/bootstrap","require orion/Deferred orion/serviceregistry orion/preferences orion/pluginregistry orion/config".split(" "),function(m,n,k,e,d,g){var f;return{startup:function(){if(f)return f;f=new n;var b=new k.ServiceRegistry,a=new e.PreferencesService(b);return a.getPreferences("/plugins").then(function(l){var h={plugins:{}};l.keys().forEach(function(a){var b=m.toUrl(a);h.plugins[b]=l[a]});var p=new d.PluginRegistry(b,h);return p.start().then(function(){if(0<b.getServiceReferences("orion.core.preference.provider").length)return a.getPreferences("/plugins",
a.USER_SCOPE).then(function(a){var b=[];a.keys().forEach(function(a){a=m.toUrl(a);p.getPlugin(a)||b.push(p.installPlugin(a,{autostart:"lazy"}).then(function(a){return a.update().then(function(){return a.start({lazy:!0})})}))});return n.all(b,function(a){console.log(a)})})}).then(function(){return(new g.ConfigurationAdminFactory(b,p,a)).getConfigurationAdmin().then(b.registerService.bind(b,"orion.cm.configadmin"))}).then(function(){var a=b.getService("orion.core.auth");if(a){var h=a.getUser().then(function(b){if(b)localStorage.setItem("lastLogin",
(new Date).getTime());else return a.getAuthForm(window.location.href).then(function(a){setTimeout(function(){window.location=a},0)})}),d=localStorage.getItem("lastLogin");if(!d||d<(new Date).getTime()-9E5)return h}}).then(function(){var h={serviceRegistry:b,preferences:a,pluginRegistry:p};f.resolve(h);return h})})}}});
define("orion/nls/root/messages",{Navigator:"Navigator",Sites:"Sites",Shell:"Shell",ShellLinkWorkspace:"Workspace Shell","Get Plugins":"Get Plugins",Global:"Global",Editor:"Editor",EditorRelatedLink:"Show Current Folder",EditorRelatedLinkParent:"Show Enclosing Folder",EditorLinkWorkspace:"Show Workspace",EditorRelatedLinkProj:"Show Project","Filter bindings":"Filter bindings","Orion Editor":"Orion Editor","Orion Image Viewer":"Orion Image Viewer","Orion Markdown Editor":"Orion Markdown Editor","Orion Markdown Viewer":"Orion Markdown Viewer",
"Orion JSON Editor":"Orion JSON Editor","View on Site":"View on Site","View this file or folder on a web site hosted by Orion":"View this file or folder on a web site hosted by Orion.","Show a list of all the keybindings on this page":"Show a list of all the keybindings on this page","Show Keys":"Show Keys","Hide or show the page banner and footer":"Hide or show the page banner and footer","Toggle banner and footer":"Toggle banner and footer","Choose a file by name and open an editor on it":"Choose a file by name and open an editor on it",
"Find File Named...":"Find File Named...","System Configuration Details":"System Configuration Details","System Config Tooltip":"Go to the System Configuration Details page","Background Operations":"Background Operations","Background Operations Tooltip":"Go to the Background Operations page","Operation status is unknown":"Operation status is unknown","Unknown item":"Unknown item","Can't search: no search service is available":"Can't search: no search service is available","could not find banner parent, id was ":"could not find banner parent, id was ",
Related:"Related",Options:"Options",FAQ:"FAQ","Report a Bug":"Bugs","Privacy Policy":"Privacy","Terms of Use":"Terms","Copyright Agent":"Copyright","Orion Logo":"Orion Logo","Orion is in Beta. Please try it out but BEWARE your data may be lost.":"2014-06-28_22-01-29","LOG: ":"LOG: ",View:"View","no parent":"no parent","no tree model":"no tree model","no renderer":"no renderer","could not find table row ":"could not find table row ","Resource is out of sync with the server. Do you want to save it anyway?":"Resource is out of sync with the server. Do you want to save it anyway?",
Operations:"Operations","Operations running":"Operations running","Some operations finished with warning":"Some operations finished with warning","Some operations finished with error":"Some operations finished with error","no service registry":"no service registry",Tasks:"Tasks",Close:"Close","Expand all":"Expand all","Collapse all":"Collapse all",Search:"Search","Advanced search":"Advanced search",Submit:"Submit",More:"More","Recent searches":"Recent searches","Regular expression":"Regular expression",
"Search options":"Search options","Global search":"Global search","Orion Home":"Orion Home","Close notification":"Close notification","Operations - Press spacebar to show current operations":"Operations - Press spacebar to show current operations","Type a keyword or wild card to search in root":"Type a keyword or wild card to search in root","Toggle side panel":"Toggle side panel","Open or close the side panel":"Open or close the side panel",Projects:"Projects","Toggle Sidebar":"Toggle Sidebar","Sample HTML5 Site":"Sample HTML5 Site",
"Generate an HTML5 'Hello World' website, including JavaScript, HTML, and CSS files.":"Generate an HTML5 'Hello World' website, including JavaScript, HTML, and CSS files.","Sample Orion Plugin":"Sample Orion Plugin","Generate a sample plugin for integrating with Orion.":"Generate a sample plugin for integrating with Orion.",Browser:"Web Browser",OutlineProgress:"Getting outline for ${0} from ${1}",UnknownError:"An unknown error occurred.",UnknownWarning:"An unknown warning occurred.",Filter:"Filter (* \x3d any string, ? \x3d any character)",
"To view the browser's context menu, trigger the context menu again.":"To view the browser's context menu, trigger the context menu again.",Edit:"Edit",CentralNavTooltip:"Toggle Navigation Menu"});define("orion/nls/messages",["orion/i18n!orion/nls/messages","orion/nls/root/messages"],function(m,n){var k={root:n};Object.keys(m).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=m[e])});return k});
define("orion/util",[],function(){var m=navigator.userAgent,n=-1!==m.indexOf("MSIE")||-1!==m.indexOf("Trident")?document.documentMode:void 0,k=parseFloat(m.split("Firefox/")[1]||m.split("Minefield/")[1])||void 0,e=-1!==m.indexOf("Opera")?parseFloat(m.split("Version/")[1]):void 0,d=parseFloat(m.split("Chrome/")[1])||void 0,g=-1!==m.indexOf("Safari")&&!d,f=parseFloat(m.split("WebKit/")[1])||void 0,b=-1!==m.indexOf("Android"),a=-1!==m.indexOf("iPad"),m=-1!==m.indexOf("iPhone"),l=a||m,h=-1!==navigator.platform.indexOf("Mac"),
p=-1!==navigator.platform.indexOf("Win"),q=-1!==navigator.platform.indexOf("Linux"),r="undefined"!==typeof document&&"ontouchstart"in document.createElement("input");return{formatMessage:function(a){var b=arguments;return a.replace(/\$\{([^\}]+)\}/g,function(a,h){return b[(h<<0)+1]})},createElement:function(a,b){return a.createElementNS?a.createElementNS("http://www.w3.org/1999/xhtml",b):a.createElement(b)},isIE:n,isFirefox:k,isOpera:e,isChrome:d,isSafari:g,isWebkit:f,isAndroid:b,isIPad:a,isIPhone:m,
isIOS:l,isMac:h,isWindows:p,isLinux:q,isTouch:r,platformDelimiter:p?"\r\n":"\n"}});
define("orion/webui/littlelib",["orion/util"],function(m){function n(a,b){b||(b=document);return b.querySelectorAll(a)}function k(a){var b=a.tabIndex;0===b&&m.isIE&&!{a:!0,body:!0,button:!0,frame:!0,iframe:!0,img:!0,input:!0,isindex:!0,object:!0,select:!0,textarea:!0}[a.nodeName.toLowerCase()]&&!a.attributes.tabIndex&&(b=-1);return b}function e(a){if(0<=k(a))return a;if(a.hasChildNodes())for(var b=0;b<a.childNodes.length;b++){var h=e(a.childNodes[b]);if(h)return h}return null}function d(a){if(0<=
k(a))return a;if(a.hasChildNodes())for(var b=a.childNodes.length-1;0<=b;b--){var h=d(a.childNodes[b]);if(h)return h}return null}function g(a,b){if(3===a.nodeType){var h=f.exec(a.nodeValue);h&&1<h.length&&b(a,h)}if(a.hasChildNodes())for(h=0;h<a.childNodes.length;h++)g(a.childNodes[h],b)}var f=/\$\{([^\}]+)\}/,b=null;return{$:function(a,b){b||(b=document);return b.querySelector(a)},$$:n,$$array:function(a,b){return Array.prototype.slice.call(n(a,b))},node:function(a){var b=a;"string"===typeof a&&(b=
document.getElementById(a));return b},contains:function(a,b){if(!a||!b)return!1;if(a===b)return!0;var h=a.compareDocumentPosition(b);return Boolean(h&16)},bounds:function(a){a=a.getBoundingClientRect();return{left:a.left+document.documentElement.scrollLeft,top:a.top+document.documentElement.scrollTop,width:a.width,height:a.height}},empty:function(a){for(;a.hasChildNodes();)a.removeChild(a.firstChild)},firstTabbable:e,lastTabbable:d,stop:function(a){window.document.all&&(a.keyCode=0);a.preventDefault&&
(a.preventDefault(),a.stopPropagation())},processTextNodes:function(a,b){g(a,function(a,d){a.parentNode.replaceChild(document.createTextNode(b[d[1]]||d[1]),a)})},processDOMNodes:function(a,b){g(a,function(a,d){var f=b[d[1]];if(f){var e=document.createRange(),g=d.index;e.setStart(a,g);e.setEnd(a,g+d[0].length);e.deleteContents();e.insertNode(f)}})},addAutoDismiss:function(a,d){function h(a){b.forEach(function(b){var h=!1,d=b.excludeNodes.some(function(b){return document.body.contains(b)?(h=!0,b.contains(a.target)):
!1});if(h&&!d)try{b.dismiss(a)}catch(f){"undefined"!==typeof console&&console&&console.error(f&&f.message)}});b=b.filter(function(a){return a.excludeNodes.some(function(a){return document.body.contains(a)})})}null===b&&(b=[],document.addEventListener("click",h,!0),m.isIOS&&document.addEventListener("touchend",function(a){function b(){a.target.removeEventListener("click",b)}0===a.touches.length&&a.target.addEventListener("click",b)},!1));b.push({excludeNodes:a,dismiss:d})},setFramesEnabled:function(a){for(var b=
document.getElementsByTagName("iframe"),h=0;h<b.length;h++)b[h].parentNode.style.pointerEvents=a?"":"none"},removeAutoDismiss:function(a){b=b.filter(function(b){return a!==b.dismiss})},KEY:{BKSPC:8,TAB:9,ENTER:13,ESCAPE:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DEL:46}}});
define("text",["module"],function(m){var n,k,e=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],d=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,g=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,f="undefined"!==typeof location&&location.href,b=f&&location.protocol&&location.protocol.replace(/\:/,""),a=f&&location.hostname,l=f&&(location.port||void 0),h=[],p=m.config&&m.config()||{};n={version:"2.0.5",strip:function(a){if(a){a=a.replace(d,"");var b=a.match(g);b&&(a=b[1])}else a="";return a},
jsEscape:function(a){return a.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:p.createXhr||function(){var a,b,h;if("undefined"!==typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!==typeof ActiveXObject)for(b=0;3>b;b+=1){h=e[b];try{a=new ActiveXObject(h)}catch(d){}if(a){e=[h];break}}return a},parseName:function(a){var b,
h,d=!1,f=a.indexOf(".");b=0===a.indexOf("./")||0===a.indexOf("../");-1!==f&&(!b||1<f)?(b=a.substring(0,f),h=a.substring(f+1,a.length)):b=a;a=h||b;f=a.indexOf("!");-1!==f&&(d="strip"===a.substring(f+1),a=a.substring(0,f),h?h=a:b=a);return{moduleName:b,ext:h,strip:d}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(a,b,h,d){var f,l;f=n.xdRegExp.exec(a);if(!f)return!0;a=f[2];f=f[3];f=f.split(":");l=f[1];f=f[0];return(!a||a===b)&&(!f||f.toLowerCase()===h.toLowerCase())&&(!l&&!f||l===d)},finishLoad:function(a,
b,d,f){d=b?n.strip(d):d;p.isBuild&&(h[a]=d);f(d)},load:function(h,d,e,g){if(g.isBuild&&!g.inlineText)e();else{p.isBuild=g.isBuild;var s=n.parseName(h);g=s.moduleName+(s.ext?"."+s.ext:"");var k=d.toUrl(g),m=p.useXhr||n.useXhr;!f||m(k,b,a,l)?n.get(k,function(a){n.finishLoad(h,s.strip,a,e)},function(a){e.error&&e.error(a)}):d([g],function(a){n.finishLoad(s.moduleName+"."+s.ext,s.strip,a,e)})}},write:function(a,b,d,f){h.hasOwnProperty(b)&&(f=n.jsEscape(h[b]),d.asModule(a+"!"+b,"define(function () { return '"+
f+"';});\n"))},writeFile:function(a,b,h,d,f){b=n.parseName(b);var l=b.ext?"."+b.ext:"",p=b.moduleName+l,e=h.toUrl(b.moduleName+l)+".js";n.load(p,h,function(b){b=function(a){return d(e,a)};b.asModule=function(a,b){return d.asModule(a,e,b)};n.write(a,p,b,f)},f)}};if("node"===p.env||!p.env&&"undefined"!==typeof process&&process.versions&&process.versions.node)k=require.nodeRequire("fs"),n.get=function(a,b){var h=k.readFileSync(a,"utf8");0===h.indexOf("\ufeff")&&(h=h.substring(1));b(h)};else if("xhr"===
p.env||!p.env&&n.createXhr())n.get=function(a,b,h,d){var f=n.createXhr(),l;f.open("GET",a,!0);if(d)for(l in d)d.hasOwnProperty(l)&&f.setRequestHeader(l.toLowerCase(),d[l]);if(p.onXhr)p.onXhr(f,a);f.onreadystatechange=function(d){4===f.readyState&&(d=f.status,399<d&&600>d?(d=Error(a+" HTTP status: "+d),d.xhr=f,h(d)):b(f.responseText))};f.send(null)};else if("rhino"===p.env||!p.env&&"undefined"!==typeof Packages&&"undefined"!==typeof java)n.get=function(a,b){var h,d,f=new java.io.File(a),l=java.lang.System.getProperty("line.separator"),
f=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(f),"utf-8")),p="";try{h=new java.lang.StringBuffer;(d=f.readLine())&&(d.length()&&65279===d.charAt(0))&&(d=d.substring(1));for(null!==d&&h.append(d);null!==(d=f.readLine());)h.append(l),h.append(d);p=String(h.toString())}finally{f.close()}b(p)};return n});define("text!orion/banner/slideout.html",[],function(){return'\x3cdiv id\x3d"slideContainer" class\x3d"slideParameters slideContainer"\x3e\n\t\x3cspan id\x3d"pageCommandParameters" class\x3d"layoutLeft parameters"\x3e\x3c/span\x3e\n\t\x3cspan id\x3d"pageCommandDismiss" class\x3d"layoutRight parametersDismiss"\x3e\x3c/span\x3e\n\x3c/div\x3e'});
define("orion/commonHTMLFragments",["require","orion/webui/littlelib","text!orion/banner/slideout.html"],function(m,n,k){return{slideoutHTMLFragment:function(e){var d=document.createElement("div");d.innerHTML=k;var g=n.$("#slideContainer",d);g.id=e+g.id;g=n.$("#pageCommandParameters",d);g.id=e+g.id;g=n.$("#pageCommandDismiss",d);g.id=e+g.id;return d.innerHTML}}});
define("orion/keyBinding",["orion/util"],function(m){function n(e,d,g,f,b,a){this.type=a||"keydown";this.keyCode="string"===typeof e&&"keydown"===this.type?e.toUpperCase().charCodeAt(0):e;this.mod1=void 0!==d&&null!==d?d:!1;this.mod2=void 0!==g&&null!==g?g:!1;this.mod3=void 0!==f&&null!==f?f:!1;this.mod4=void 0!==b&&null!==b?b:!1}function k(e){this.keys=e}n.prototype={getKeys:function(){return[this]},match:function(e,d){if(void 0!==d){if(0!==d)return!1}else if(e instanceof Array){if(1<e.length)return!1;
e=e[0]}return e.type!==this.type?!1:this.keyCode===e.keyCode||this.keyCode===String.fromCharCode(m.isOpera?e.which:void 0!==e.charCode?e.charCode:e.keyCode)?this.mod1!==(m.isMac?e.metaKey:e.ctrlKey)||"keydown"===this.type&&this.mod2!==e.shiftKey||this.mod3!==e.altKey||m.isMac&&this.mod4!==e.ctrlKey?!1:!0:!1},equals:function(e){return!e||this.keyCode!==e.keyCode||this.mod1!==e.mod1||this.mod2!==e.mod2||this.mod3!==e.mod3||this.mod4!==e.mod4||this.type!==e.type?!1:!0}};k.prototype={getKeys:function(){return this.keys.slice(0)},
match:function(e,d){var g=this.keys;if(void 0!==d)return d>g.length?!1:g[d].match(e)?d===g.length-1?!0:d+1:!1;e instanceof Array||(e=[e]);if(e.length>g.length)return!1;var f;for(f=0;f<e.length;f++)if(!g[f].match(e[f]))return!1;return f===g.length?!0:f},equals:function(e){if(!e.keys||e.keys.length!==this.keys.length)return!1;for(var d=0;d<e.keys.length;d++)if(!e.keys[d].equals(this.keys[d]))return!1;return!0}};return{KeyBinding:n,KeyStroke:n,KeySequence:k}});
define("orion/webui/dropdown",["require","orion/webui/littlelib","orion/EventTarget"],function(m,n,k){function e(d){k.attach(this);this._init(d)}function d(d,b){var a=document.createElement(void 0===b?"span":b);a.tabIndex=0;a.className="dropdownMenuItem";a.role="menuitem";var l=document.createElement("span");l.appendChild(document.createTextNode(d));l.classList.add("dropdownCommandName");a.appendChild(l);l=document.createElement("li");l.appendChild(a);return l}function g(){var d=document.createElement("li");
d.classList.add("dropdownSeparator");return d}e.prototype={_init:function(d){this._dropdownNode=n.node(d.dropdown);if(!this._dropdownNode)throw"no dom node for dropdown found";this._populate=d.populate;this._selectionClass=d.selectionClass;this._parentDropdown=d.parentDropdown;this._positioningNode=d.positioningNode;if(!this._parentDropdown)for(var b=this._dropdownNode.parentNode;b&&document!==b;){if(b.classList&&b.classList.contains("dropdownMenu")){this._parentDropdown=b.dropdown;break}b=b.parentNode}this._dropdownNode.tabIndex=
0;this._triggerNode=d.triggerNode?d.triggerNode:n.$(".dropdownTrigger",this._dropdownNode.parentNode);if(!this._triggerNode)throw"no dom node for dropdown trigger found";if(!d.skipTriggerEventListeners){var a=this;this._triggerNode.addEventListener("click",function(b){a.toggle(b)&&n.stop(b)},!1);"span"===this._triggerNode.tagName.toLowerCase()&&this._triggerNode.addEventListener("keydown",function(b){if(b.keyCode===n.KEY.ENTER||b.keyCode===n.KEY.SPACE)a.toggle(),n.stop(b)},!1)}this._dropdownNode.addEventListener("keydown",
this._dropdownKeyDown.bind(this),!1)},addTriggerNode:function(d){var b=this;d.addEventListener("click",function(a){b.toggle(a)&&n.stop(a)},!1)},toggle:function(d){return this.isVisible()?this.close():this.open(d)},isVisible:function(){return this._isVisible},open:function(d){var b=!1;this.isVisible()||(this.dispatchEvent({type:"triggered",dropdown:this,event:d}),n.setFramesEnabled(!1),this._populate&&(this.empty(),this._populate(this._dropdownNode)),0<this.getItems().length&&(this._hookedAutoDismiss||
(this._boundAutoDismiss?n.removeAutoDismiss(this._boundAutoDismiss):this._boundAutoDismiss=this._autoDismiss.bind(this),b=n.$$array(".dropdownSubMenu",this._dropdownNode),n.addAutoDismiss([this._triggerNode].concat(b),this._boundAutoDismiss),this._hookedAutoDismiss=!0),this._triggerNode.classList.add("dropdownTriggerOpen"),this._selectionClass&&this._triggerNode.classList.add(this._selectionClass),this._dropdownNode.classList.add("dropdownMenuOpen"),this._isVisible=!0,this._positionDropdown(d),this._focusDropdownNode(),
b=!0,this._parentDropdown&&this._parentDropdown.submenuOpen(this)));return b},_focusDropdownNode:function(){this._dropdownNode.focus()},_autoDismiss:function(d){if(this.close(!1)&&this._dropdownNode.contains(d.target))for(d=this._parentDropdown;d;)d.close(!1),d=d._parentDropdown},_positionDropdown:function(d){this._dropdownNode.style.left="";this._dropdownNode.style.top="";if(this._positioningNode)this._dropdownNode.style.left=this._positioningNode.offsetLeft+"px";else{d=n.bounds(this._dropdownNode);
var b=n.bounds(document.body);if(d.left+d.width>b.left+b.width)if(this._triggerNode.classList.contains("dropdownMenuItem"))this._dropdownNode.style.left=-d.width+"px";else{var a=n.bounds(this._boundingNode(this._triggerNode)),l=n.bounds(this._triggerNode);this._dropdownNode.style.left=l.left-a.left-d.width+l.width+"px"}d=d.top+d.height-(b.top+b.height);0<d&&(this._dropdownNode.style.top=Math.floor(this._dropdownNode.style.top-d)+"px")}},_boundingNode:function(d){var b=window.getComputedStyle(d,null);
return null===b||"absolute"===b.getPropertyValue("position")||!d.parentNode||d===document.body?d:this._boundingNode(d.parentNode)},close:function(d){var b=!1;this.isVisible()&&(this._triggerNode.classList.remove("dropdownTriggerOpen"),this._selectionClass&&this._triggerNode.classList.remove(this._selectionClass),this._dropdownNode.classList.remove("dropdownMenuOpen"),n.setFramesEnabled(!0),d&&this._triggerNode.focus(),this._isVisible=!1,this._selectedItem&&(this._selectedItem.classList.remove("dropdownMenuItemSelected"),
this._selectedItem=null),b=!0);return b},getItems:function(){var d=[],b=this;n.$$array("li:not(.dropdownSeparator) \x3e .dropdownMenuItem",this._dropdownNode,!0).forEach(function(a){a.parentNode.parentNode===b._dropdownNode&&d.push(a)});d.forEach(function(a){a._hasDropdownMouseover||(a.addEventListener("mouseover",function(d){a.dropdown?a.dropdown.open(d):(b._closeSelectedSubmenu(),n.stop(d));b._selectItem(a)}),a._hasDropdownMouseover=!0)});return d},empty:function(){var d=this;n.$$array("li",this._dropdownNode).forEach(function(b){b.parentNode===
d._dropdownNode&&b.parentNode.removeChild(b)});this._hookedAutoDismiss=!1},_dropdownKeyDown:function(d){if(d.keyCode===n.KEY.UP||d.keyCode===n.KEY.DOWN||d.keyCode===n.KEY.RIGHT||d.keyCode===n.KEY.ENTER||d.keyCode===n.KEY.LEFT){var b=this.getItems();if(b.length&&0<b.length){if(this._selectedItem){var a=b.indexOf(this._selectedItem);0>a&&(a=b.indexOf(this._selectedItem.parentNode));0<=a&&(d.keyCode===n.KEY.UP&&0<a?(a--,this._selectItem(b[a])):d.keyCode===n.KEY.DOWN&&a<b.length-1?(a++,this._selectItem(b[a])):
d.keyCode===n.KEY.ENTER||d.keyCode===n.KEY.RIGHT?this._selectedItem.classList.contains("dropdownTrigger")&&this._selectedItem.dropdown?(this._selectedItem.dropdown.open(),this._selectedItem.dropdown._selectItem()):d.keyCode===n.KEY.ENTER&&this._selectedItem.click():d.keyCode===n.KEY.LEFT&&this._selectedItem.parentNode.parentNode.classList.contains("dropdownMenuOpen")&&(this.close(!0),this._parentDropdown&&this._parentDropdown._dropdownNode.focus()))}else this._selectItem(b[0]);n.stop(d)}}else d.keyCode===
n.KEY.ESCAPE&&(this.close(!0),n.stop(d))},_selectItem:function(d){if(d=d||this.getItems()[0])this._selectedItem&&this._selectedItem.classList.remove("dropdownMenuItemSelected"),this._selectedItem=d,this._selectedItem.classList.add("dropdownMenuItemSelected");document.activeElement!==this._dropdownNode&&this._dropdownNode.focus()},submenuOpen:function(d){d!==this._selectedSubmenu&&(this._closeSelectedSubmenu(),this._selectedSubmenu=d)},_closeSelectedSubmenu:function(){for(var d=this._selectedSubmenu;d;)d.close(),
d=d._selectedSubmenu},destroy:function(){this.empty();this._boundAutoDismiss&&n.removeAutoDismiss(this._boundAutoDismiss)},appendMenuItem:function(f,b){var a=d(f,b);this._dropdownNode.appendChild(a);return a},appendSeparator:function(){var d=g();this._dropdownNode.appendChild(d);return d}};e.prototype.constructor=e;return{Dropdown:e,appendKeyBindingString:function(d,b){var a=document.createElement("span");a.classList.add("dropdownKeyBinding");a.appendChild(document.createTextNode(b));d.appendChild(a)},
createMenuItem:d,createSeparator:g}});define("text!orion/webui/dropdowntriggerbutton.html",[],function(){return'\x3cbutton class\x3d"dropdownTrigger"\x3e${ButtonText}\x3c!--span class\x3d"dropdownArrowDown core-sprite-openarrow"\x3e\x3c/span--\x3e\x3c/button\x3e\x3cul class\x3d"dropdownMenu"\x3e\x3c/ul\x3e'});define("text!orion/webui/dropdowntriggerbuttonwitharrow.html",[],function(){return'\x3cbutton class\x3d"dropdownTrigger dropdownDefaultButton"\x3e${ButtonText}\x3cspan class\x3d"dropdownArrowDown core-sprite-openarrow"\x3e\x3c/span\x3e\x3c/button\x3e\x3cul class\x3d"dropdownMenu"\x3e\x3c/ul\x3e'});
define("text!orion/webui/submenutriggerbutton.html",[],function(){return'\x3cli class\x3d"dropdownSubMenu"\x3e\x3cspan class\x3d"dropdownTrigger dropdownMenuItem" role\x3d"menuitem" tabindex\x3d"0"\x3e\x3cspan class\x3d"dropdownCommandName"\x3e${ButtonText}\x3c/span\x3e\x3cspan class\x3d"dropdownArrowRight core-sprite-closedarrow"\x3e\x3c/span\x3e\x3c/span\x3e\x3cul class\x3d"dropdownMenu"\x3e\x3c/ul\x3e\x3c/li\x3e'});define("text!orion/webui/checkedmenuitem.html",[],function(){return'\x3cli\x3e\x3clabel class\x3d"dropdownMenuItem"\x3e\x3cinput class\x3d"checkedMenuItem" role\x3d"menuitem" type\x3d"checkbox" /\x3e${ItemText}\x3c/label\x3e\x3c/li\x3e'});
define("orion/webui/tooltip",["require","orion/webui/littlelib"],function(m,n){function k(e){this._init(e)}k.prototype={_init:function(e){this._node=n.node(e.node);if(!this._node)throw"no dom node for tooltip found";this._position=e.position||["right","above","below","left"];this._text=e.text;this._hideDelay=void 0===e.hideDelay?200:e.hideDelay;this._tailSize=e.tailSize||10;this._trigger=e.trigger||"mouseover";this._afterShowing=e.afterShowing;this._afterHiding=e.afterHiding;var d=this;if("click"===
this._trigger)this._showDelay=0,this._node.addEventListener("click",this._clickHandler=function(f){f.target===d._node&&(d.show(),n.stop(f))},!1);else if("mouseover"===this._trigger){this._showDelay=void 0===e.showDelay?500:e.showDelay;e=["mouseout","click"];this._node.addEventListener("mouseover",this._mouseoverHandler=function(f){n.contains(d._node,f.target)&&(d.show(),n.stop(f))},!1);this._leaveHandler=function(f){n.contains(d._node,f.target)&&d.hide()};for(var g=0;g<e.length;g++)this._node.addEventListener(e[g],
this._leaveHandler,!1)}},_makeTipNode:function(){if(!this._tip){this._tip=document.createElement("span");this._tip.classList.add("tooltipContainer");this._tipInner=document.createElement("div");this._tipInner.classList.add("tooltip");if(this._text){this._tipTextContent=document.createElement("div");this._tipTextContent.classList.add("textContent");this._tipInner.appendChild(this._tipTextContent);var e=document.createTextNode(this._text);this._tipTextContent.appendChild(e)}this._tip.appendChild(this._tipInner);
document.body.appendChild(this._tip);var d=this;n.addAutoDismiss([this._tip,this._node],function(){d.hide()});"mouseover"===this._trigger&&(this._tipInner.role="tooltip",this._tipInner.id="tooltip"+(new Date).getTime().toString(),this._node.setAttribute("aria-describedby",this._tipInner.id),this._tip.addEventListener("mouseover",function(e){d._timeout&&(window.clearTimeout(d._timeout),d._timeout=null);d._tip.addEventListener("mouseout",function(f){n.contains(d._tip,f.target)&&(d.hide(),n.stop(f))},
!1)},!1))}return this._tip},_positionTip:function(e,d){this._makeTipNode();"left"===e?this._tipInner.classList.add("left"):this._tipInner.classList.remove("left");var g=this._node,f;for(f=n.bounds(g);g&&!f.width&&!f.height;g=g.parentNode)f=n.bounds(g);var g=n.bounds(this._tipInner),b;switch(e){case "above":b=f.top-g.height-this._tailSize-1;f=f.left-this._tailSize;break;case "below":b=f.top+f.height+this._tailSize+1;f=f.left-this._tailSize;break;case "left":b=f.top-this._tailSize/2;f=f.left-g.width-
this._tailSize-1;break;default:b=f.top-this._tailSize/2,f=f.left+f.width+this._tailSize+1}var a=n.bounds(document.documentElement);if(b+g.height>a.height)if(d)b=a.height-g.height-1;else return!1;if(f+g.width>a.width)if(d)f=a.width-g.width-1;else return!1;if(0>f)if(d)f=4;else return!1;if(0>b)if(d)b=4;else return!1;this._tail&&this._tail.previousPosition!==e&&(this._tip.removeChild(this._tail),this._tail=null);this._tail||(this._tail=document.createElement("span"),this._tail.classList.add("tooltipTailFrom"+
e),"above"===e||"left"===e?this._tip.appendChild(this._tail):this._tip.insertBefore(this._tail,this._tipInner),this._tail.previousPosition=e);this._tip.style.top=b+"px";this._tip.style.left=f+"px";return!0},contentContainer:function(){this._makeTipNode();return this._tipInner},show:function(){if(!this._tip||!this._tip.classList.contains("tooltipShowing"))this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null),this._showDelay?this._timeout=window.setTimeout(this._showImmediately.bind(this),
this._showDelay):this._showImmediately()},_showImmediately:function(){for(var e=!1,d=0;!e&&d<this._position.length;)e=this._positionTip(this._position[d]),d++;e||this._positionTip(this._position[0],!0);this._tip.classList.add("tooltipShowing");this._afterShowing&&this._afterShowing()},hide:function(e){this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null);if(this._tip&&this._tip.classList.contains("tooltipShowing")){void 0===e&&(e=this._hideDelay);var d=this;this._timeout=window.setTimeout(function(){d._tip.classList.remove("tooltipShowing");
d._tip.removeAttribute("style");d._afterHiding&&d._afterHiding()},e)}},destroy:function(){this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null);this._tip&&(document.body.removeChild(this._tip),this._tail=this._tipTextContent=this._tipInner=this._tip=null);if(this._node){this._node.removeEventListener("click",this._clickHandler,!1);this._node.removeEventListener("mouseover",this._mouseoverHandler,!1);for(var e=["mouseout","click"],d=0;d<e.length;d++)this._node.removeEventListener(e[d],
this._leaveHandler,!1)}}};k.prototype.constructor=k;return{Tooltip:k}});
define("orion/commands","orion/util orion/webui/littlelib orion/webui/dropdown text!orion/webui/dropdowntriggerbutton.html text!orion/webui/dropdowntriggerbuttonwitharrow.html text!orion/webui/submenutriggerbutton.html text!orion/webui/checkedmenuitem.html orion/webui/tooltip".split(" "),function(m,n,k,e,d,g,f,b){function a(a){var b=a.invocation;if(b){var d=a.command;if(d.hrefCallback)return a=d.hrefCallback.call(b.handler||window,b),a.then?a.then(function(a){window.open(a)}):window.open(a),!0;if(b.commandRegistry)return b.commandRegistry._invoke(b),
!0;if(d.onClick||d.callback)return window.setTimeout(function(){(d.onClick||d.callback).call(b.handler||window,b)},0),!0}return!1}function l(b,d){for(var h in d)if(d[h]&&(d[h].keyBinding&&d[h].command)&&d[h].keyBinding.match(b)){var u=d[h],f=u.keyBinding;if((!f.domScope||n.contains(n.node(f.domScope),b.target))&&a(u)){n.stop(b);break}}}function h(){var a={};if(x){var b,d,h;d=Object.keys(v);for(b=0;b<d.length;b++)h=d[b],a[h]=v[h];var f=x();d=Object.keys(f);for(b=0;b<d.length;b++)h=d[b],a[h]=f[h]}else a=
v;return a}function p(a){l(a,h())}function q(a,b){a=a||window.event;if(function(a){if(m.isMac){if(a.metaKey&&!a.altKey)return!a.shiftKey&&!a.ctrlKey&&(65===a.keyCode||67===a.keyCode||86===a.keyCode||88===a.keyCode||90===a.keyCode)?!0:!1;if(a.ctrlKey)return!1}else{if(a.ctrlKey&&!a.altKey)return!a.shiftKey&&(65===a.keyCode||67===a.keyCode||86===a.keyCode||88===a.keyCode||90===a.keyCode)?!0:!1;if(a.altKey&&!a.ctrlKey)return!1}if(a["char"])return 0<a["char"].length;if(a.charCode||a.keyCode)switch(a=a.charCode||
a.keyCode,a){case 8:case 9:case 13:case 46:return!0;default:return 32<=a&&112>a||123<a}return!1}(a)){if("true"===a.target.contentEditable)return;var d=a.target.nodeName.toLowerCase();if("input"===d)switch(a.target.type.toLowerCase()){case "text":case "password":case "search":case "color":case "date":case "datetime":case "datetime-local":case "email":case "month":case "number":case "range":case "tel":case "time":case "url":case "week":return}else if("textarea"===d)return}b?b(a):p(a)}function r(){this._init()}
function t(a,b,d){b.classList.add("commandImage");var h;a.imageClass?a.addImageClassToElement?b.classList.add(a.imageClass):(h=document.createElement("span"),b.appendChild(h),h.classList.add(a.spriteClass),h.classList.add(a.imageClass)):(h=new Image,h.alt=a.name,h.name=d,h.id=d,h.src=a.image,b.appendChild(h));return h}function w(a,b,d,h,f){this.commandRegistry=f;this.handler=a;this.items=b;this.userData=d;this.command=h;h.parameters&&(this.parameters=h.parameters.makeCopy());this.id=h.id}function s(a){this._init(a)}
var x=null,v={};r.prototype={setProxy:function(a){this.proxy=a},setKeyBindings:function(a){this.bindings=a},_init:function(){var a=this;document.addEventListener("keydown",function(b){return q(b,function(b){var d=a.proxy,h=a.bindings;if(h&&d)for(var f=0;f<h.length;f++)h[f].match(b)&&(d.processKey({type:b.type,keyCode:b.keyCode,altKey:b.altKey,ctrlKey:b.ctrlKey,metaKey:b.metaKey,shiftKey:b.shiftKey}),n.stop(b))})})}};window.document.addEventListener("keydown",q,!1);w.prototype={collectsParameters:function(){return this.commandRegistry&&
this.commandRegistry.collectsParameters()},makeCopy:function(a){var b=new w(this.handler,this.items,this.userData,this.command,this.commandRegistry);b.domNode=this.domNode;b.domParent=this.domParent;a?b.parameters=a.makeCopy():this.parameters&&(b.parameters=this.parameters.makeCopy());return b}};w.prototype.constructor=w;s.prototype={_init:function(a){this.id=a.id;this.name=a.name;this.tooltip=a.tooltip;this.callback=a.callback;this.hrefCallback=a.hrefCallback;this.choiceCallback=a.choiceCallback;
this.positioningNode=a.positioningNode;this.image=a.image||"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC";this.imageClass=a.imageClass;this.addImageClassToElement=a.addImageClassToElement;this.extraClass=a.extraClass;this.selectionClass=a.selectionClass;this.spriteClass=a.spriteClass||"commandSprite";this.visibleWhen=a.visibleWhen;this.parameters=a.parameters;this.isEditor=a.isEditor},populateChoicesMenu:function(a,
b,d,h,f){d=this.getChoices(b,d,h);var l=d.some(function(a){return a.checked});d.forEach(function(d){if(d.name){var h=document.createElement("li");a.appendChild(h);var u=document.createElement("span");u.tabIndex=0;u.role="menuitem";u.classList.add("dropdownMenuItem");if(l){var p=document.createElement("span");p.classList.add("check");p.appendChild(document.createTextNode(d.checked?"\u25cf":""));u.appendChild(p)}p=document.createTextNode(d.name);u.appendChild(p);h.appendChild(u);u.choice=d;u.addEventListener("click",
function(a){a.target.choice&&a.target.choice.callback.call(a.target.choice,b)},!1);u.addEventListener("keydown",function(a){(a.keyCode===n.KEY.ENTER||a.keyCode===n.KEY.SPACE)&&a.target.choice&&a.target.choice.callback.call(a.target.choice,b)},!1)}else f._generateMenuSeparator(a)})},getChoices:function(a,b,d){return this.choiceCallback?this.choiceCallback.call(b,a,d):null},makeChoiceCallback:function(a,b){return function(d){a.callback&&a.callback.call(a,b,d)}},hasImage:function(){return this.imageClass||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC"!==this.image}};s.prototype.constructor=s;return{Command:s,CommandInvocation:w,createDropdownMenu:function(a,b,h,f,l,p,q,g,r){a=n.node(a);if(!a)throw"no parent node was specified";var w=document.createRange();w.selectNode(a);w=r?w.createContextualFragment(d):w.createContextualFragment(e);n.processTextNodes(w,{ButtonText:b});a.appendChild(w);a=a.lastChild;
var s;r?(r=a.previousSibling,s=r.lastChild):r=a.previousSibling;f?r.classList.add(f):(r.classList.add("orionButton"),r.classList.add("commandButton"));l&&(p||(r.textContent="",r.setAttribute("aria-label",b)),t({spriteClass:"commandSprite",imageClass:l},r,b),r.classList.add("orionButton"));r.dropdown=new k.Dropdown({dropdown:a,populate:h,selectionClass:q,skipTriggerEventListeners:!!s,positioningNode:g});a.dropdown=r.dropdown;return{menuButton:r,menu:a,dropdown:r.dropdown,dropdownArrow:s}},createCheckedMenuItem:function(a,
b,d,h){a=n.node(a);if(!a)throw"no parent node was specified";var l=document.createRange();l.selectNode(a);l=l.createContextualFragment(f);n.processTextNodes(l,{ItemText:b});a.appendChild(l);a=n.$(".checkedMenuItem",a.lastChild);a.checked=d;a.addEventListener("change",h,!1);return a},createCommandItem:function(a,d,h,f,l,p,e){var q;p=p||!d.name&&d.hasImage();if(d.hrefCallback)q=document.createElement("a"),q.id=f,p&&d.hasImage()?t(d,q,f):(q.className="commandLink",q.appendChild(document.createTextNode(d.name))),
e=d.hrefCallback.call(h.handler,h),e.then?e.then(function(a){q.href=a}):q.href=e?e:"#";else{q=document.createElement("button");q.className="orionButton";d.extraClass&&q.classList.add(d.extraClass);p?d.hasImage()?(t(d,q,f),d.name&&q.setAttribute("aria-label",d.name)):(q.classList.add("commandButton"),q.classList.add("commandMissingImageButton"),q.appendChild(document.createTextNode(d.name))):(q.classList.add("commandButton"),f=document.createTextNode(d.name),q.appendChild(f));var g=e||d.callback;g&&
(d.onClick=g,q.addEventListener("click",function(a){g.call(h.handler,h)},!1))}"ul"===a.nodeName.toLowerCase()?(e=document.createElement("li"),a.appendChild(e),a=e):q.classList.add("commandMargins");a.appendChild(q);d.tooltip&&(q.commandTooltip=new b.Tooltip({node:q,text:d.tooltip,position:["above","below","right","left"]}));l&&(v[d.id]={keyBinding:l,command:d,invocation:h});return q},createCommandMenuItem:function(a,d,h,f,l,p){var e,q,g=a.dropdown;if(d.hrefCallback)q=k.createMenuItem(d.name,"a"),
e=q.firstElementChild,l=d.hrefCallback.call(h.handler,h),l.then?l.then(function(a){e.href=a}):e.href=l?l:"#",e.addEventListener("keydown",function(a){(a.keyCode===n.KEY.ENTER||a.keyCode===n.KEY.SPACE)&&e.click()},!1);else{q=k.createMenuItem(d.name);e=q.firstElementChild;var r=l||d.callback;r&&(d.onClick=r,e.addEventListener("click",function(a){g.close(!0);r.call(h.handler,h)},!1),e.addEventListener("keydown",function(a){if(a.keyCode===n.KEY.ENTER||a.keyCode===n.KEY.SPACE)a.preventDefault(),e.click()},
!1))}d.tooltip&&(e.commandTooltip=new b.Tooltip({node:e,text:d.tooltip,position:["above","below","right","left"]}));p&&k.appendKeyBindingString(e,p);a.appendChild(q);f&&(v[d.id]={keyBinding:f,command:d,invocation:h});return e},executeBinding:a,setKeyBindingProvider:function(a){x=a},localKeyBindings:v,CommandsProxy:r,getKeyBindings:h,processKey:p,NO_IMAGE:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC",
_testMethodProcessKey:l}});define("orion/explorers/navigationUtils",[],function(){function m(k,e,d,g){!n&&k&&(k.push({domNode:e}),e.tabIndex=-1,e.style.outline="none")}var n=-1!==navigator.userAgent.indexOf("iPad");return{addNavGrid:function(k,e,d){k&&(k=k.getGridNavHolder(e,!0))&&m(k,d)},generateNavGrid:m,removeNavGrid:function(k,e){if(k)for(var d=0;d<k.length;d++)if(k[d].domNode===e){k.splice(d,1);break}}}});
define("orion/PageUtil",[],function(){var m=/^http[s]?/i;return{hash:function(){var m=window.location.href.split("#")[1];return m?"#"+m:""},matchResourceParameters:function(m){m=m||window.location.toString();var k={resource:""},e=m.indexOf("#");if(-1!==e&&(m=m.substring(e+1),0!==m.length)){m=m.split(",");k.resource=decodeURIComponent(m[0]);for(e=1;e<m.length;e++){var d=/([^=]*)(=?)(.*)/.exec(m[e]),g=decodeURIComponent(d[1]||""),d=decodeURIComponent(d[3]||"");""!==g&&"resource"!==g&&(k[g]=d)}}return k},
validateURLScheme:function(n,k){var e=n;if(-1===n.indexOf("://")){var d=document.createElement("a");d.href=n;e=d.href}d=!1;if(d=k?k.some(function(d){return RegExp("^"+d+":","i").test(e)}):m.test(e))return n;console.log("Illegal URL Scheme: '"+n+"'");return""}}});
define("orion/uiUtils",["orion/webui/littlelib"],function(m){function n(e){var d="",g=-1!==navigator.platform.indexOf("Mac");g?(e.mod4&&(d+="\u2303"),e.mod3&&(d+="\u2325"),e.mod2&&(d+="\u21e7"),e.mod1&&(d+="\u2318")):(e.mod1&&(d+="Ctrl+"),e.mod2&&(d+="Shift+"),e.mod3&&(d+="Alt+"));if(e.alphaKey)return d+e.alphaKey;if("keypress"===e.type)return d+e.keyCode;for(var f in m.KEY)if(typeof("number"===m.KEY[f])&&m.KEY[f]===e.keyCode){if(g)switch(m.KEY[f]){case m.KEY.BKSPC:f="\u232b";break;case m.KEY.TAB:f=
"\u21e5";break;case m.KEY.ENTER:f="\u23ce";break;case m.KEY.ESCAPE:f="\u238b";break;case m.KEY.SPACE:f="\u2423";break;case m.KEY.PAGEUP:f="\u21de";break;case m.KEY.PAGEDOWN:f="\u21df";break;case m.KEY.END:f="\u21f2";break;case m.KEY.HOME:f="\u21f1";break;case m.KEY.DEL:f="\u2326"}switch(m.KEY[f]){case m.KEY.DOWN:f="\u2193";break;case m.KEY.UP:f="\u2191";break;case m.KEY.RIGHT:f="\u2192";break;case m.KEY.LEFT:f="\u2190"}return d+f}var b;switch(e.keyCode){case 59:b=e.mod2?":":";";break;case 61:b=e.mod2?
"+":"\x3d";break;case 188:b=e.mod2?"\x3c":",";break;case 190:b=e.mod2?"\x3e":".";break;case 191:b=e.mod2?"?":"/";break;case 192:b=e.mod2?"~":"`";break;case 219:b=e.mod2?"{":"[";break;case 220:b=e.mod2?"|":"\\";break;case 221:b=e.mod2?"}":"]";break;case 222:b=e.mod2?'"':"'"}return b?d+b:112<=e.keyCode&&123>=e.keyCode?d+"F"+(e.keyCode-111):d+String.fromCharCode(e.keyCode)}function k(e){var d=-1!==window.navigator.platform.indexOf("Mac");return d&&e.metaKey||!d&&e.ctrlKey}return{getUserKeyString:function(e){var d=
"";e=e.getKeys();for(var g=0;g<e.length;g++)0!==g&&(d+=" "),d+=n(e[g]);return d},getUserText:function(e){var d=e.id,g=e.refNode,f=e.hideRefNode,b=e.initialText,a=e.onComplete,l=e.onEditDestroy,h=e.selectTo,p=e.isInitialValid;e=e.insertAsChild;var q=!1,r=function(h){return function(e){if(!q){var r=m.node(d),t=r.value;r&&(h&&e.keyCode===m.KEY.ESCAPE?(f&&(g.style.display="inline"),q=!0,r.parentNode.removeChild(r),l&&l()):h&&e.keyCode!==m.KEY.ENTER||(0===t.length||!p&&t===b?f&&(g.style.display="inline"):
(a(t),f&&g.parentNode&&(g.style.display="inline")),q=!0,r.parentNode&&r.parentNode.removeChild(r),l&&l()))}}},t=document.createElement("input");t.id=d;t.value=b||"";e?g.appendChild(t):g.parentNode.insertBefore(t,g.nextSibling);t.classList.add("userEditBoxPrompt");f&&(g.style.display="none");t.addEventListener("keydown",r(!0),!1);t.addEventListener("blur",r(!1),!1);window.setTimeout(function(){t.focus();if(b){var a=m.node(d),f=h?b.indexOf(h):-1;0<f?a.createTextRange?(a=a.createTextRange(),a.collapse(!0),
a.moveStart("character",0),a.moveEnd("character",f),a.select()):a.setSelectionRange?a.setSelectionRange(0,f):void 0!==a.selectionStart&&(a.selectionStart=0,a.selectionEnd=f):a.select()}},0)},openInNewWindow:k,followLink:function(e,d){d&&k(d)?window.open(e):window.location=e},createButton:function(e,d){var g=document.createElement("button");g.className="orionButton commandButton commandMargins";g.addEventListener("click",function(f){d();m.stop(f)},!1);e&&g.appendChild(document.createTextNode(e));return g},
createDropdownButton:function(e,d,g){},isFormElement:function(e){switch(e.tagName.toLowerCase()){case "button":case "fieldset":case "form":case "input":case "keygen":case "label":case "legend":case "meter":case "optgroup":case "output":case "progress":case "select":case "textarea":return!0}return!1}}});
define("orion/commandRegistry","orion/commands orion/explorers/navigationUtils orion/PageUtil orion/uiUtils orion/webui/littlelib orion/webui/dropdown orion/webui/tooltip text!orion/webui/checkedmenuitem.html text!orion/webui/dropdowntriggerbutton.html text!orion/webui/submenutriggerbutton.html".split(" "),function(m,n,k,e,d,g,f,b,a,l){function h(a){this._commandList={};this._contributionsByScopeId={};this._activeBindings={};this._urlBindings={};this._pendingBindings={};this._init(a);this._parameterCollector=
null}function p(a,b){this.token=a;this.parameterName=b}function q(a,b,d){this.event=a;this.handler=b;this.capture=d||!1}function r(a,b,d,h,f,l){this.name=a;this.type=b;this.label=d;this.value=h;this.lines=f||1;this.eventListeners=Array.isArray(l)?l:l?[l]:[]}function t(a,b,d){this._storeParameters(a);this._hasOptionalParameters=b&&b.hasOptionalParameters;this._options=b;this.optionsRequested=!1;this.getParameters=d;this.clientCollect=b&&b.clientCollect;this.getParameterElement=b&&b.getParameterElement;
this.getSubmitName=b&&b.getSubmitName}h.prototype={_init:function(a){this._selectionService=a.selection;var b=this;m.setKeyBindingProvider(function(){return b._activeBindings})},processURL:function(a){for(var b in this._urlBindings)if(this._urlBindings[b]&&this._urlBindings[b].urlBinding&&this._urlBindings[b].command){var d=this._urlBindings[b].urlBinding.match(a);if(d){var h=this._urlBindings[b],f=h.command,l=h.invocation;if(l&&l.parameters&&f.callback){l.parameters.setValue(d.parameterName,d.parameterValue);
var p=this;window.setTimeout(function(){p._invoke(l)},0);break}}}},findCommand:function(a){return this._commandList[a]},runCommand:function(a,b,d,h,f,l){if(b){if((a=this._commandList[a])&&(a.visibleWhen?a.visibleWhen(b):1)&&a.callback)return b=new m.CommandInvocation(d,b,f,a,this),b.domParent=l,this._invoke(b,h)}else if((l=this._urlBindings[a])&&l.command&&l.command.callback)return this._invoke(l.invocation,h)},getSelectionService:function(){return this._selectionService},setParameterCollector:function(a){this._parameterCollector=
a},openParameterCollector:function(a,b,d){this._parameterCollector&&(this._parameterCollector.close(),this._parameterCollector.open(a,b,d))},confirm:function(a,b,d,h,f,l){var p=!1;if(this._parameterCollector&&!f){var u=this;this._parameterCollector.close();if(this._parameterCollector.open(a,function(a,f){var l=document.createElement("span");l.classList.add("parameterPrompt");l.textContent=b;a.appendChild(l);l=document.createElement("button");l.addEventListener("click",function(a){p=!0;u._parameterCollector.close()},
!1);f.appendChild(l);l.appendChild(document.createTextNode(d));l.className="dismissButton";var e=document.createElement("button");e.addEventListener("click",function(a){p=!1;u._parameterCollector.close()},!1);f.appendChild(e);e.appendChild(document.createTextNode(h));e.className="dismissButton";return l},function(){l(p)}))return}p=window.confirm(b);l(p)},closeParameterCollector:function(){this._parameterCollector&&this._parameterCollector.close()},collectsParameters:function(){return this._parameterCollector},
_invoke:function(a,b){return this._collectAndInvoke(a.makeCopy(b),!1)},_collectAndInvoke:function(a,b,d){if(a)if(this._parameterCollector&&a.parameters&&a.parameters.hasParameters()&&(b||a.parameters.shouldCollectParameters())){b=!1;a.parameters.updateParameters(a);if(a.parameters.shouldCollectParameters()&&(b=this._parameterCollector.collectParameters(a,d),!b)){var h=new f.Tooltip({node:a.domNode,afterHiding:function(){this.destroy()},trigger:"click",position:["below","right","above","left"]});b=
h.contentContainer();b.classList.add("parameterPopup");var l=window.document.activeElement,p=this._parameterCollector.getFillFunction(a,function(){l&&l.focus();h.destroy()},d)(b);h.show();window.setTimeout(function(){p.focus();p.select()},0);b=!0}if(!b)return a.command.callback.call(a.handler||window,a)}else return a.command.callback.call(a.handler||window,a);else window.console.log("Client attempted to invoke command without an available (rendered) command invocation")},collectParameters:function(a,
b){this._collectAndInvoke(a,!0,b)},showKeyBindings:function(a){function b(a){return function(){m.executeBinding(a)}}var d={},h,f,l=[],p;for(p in this._activeBindings)(f=this._activeBindings[p])&&(f.keyBinding&&f.command&&(f.command.name||f.command.tooltip))&&l.push(f);l.sort(function(a,b){return(a.command.name||a.command.tooltip).localeCompare(b.command.name||b.command.tooltip)});for(p=0;p<l.length;p++)f=l[p],f.keyBinding.scopeName?(d[f.keyBinding.scopeName]||(d[f.keyBinding.scopeName]=[]),d[f.keyBinding.scopeName].push(f)):
(h=e.getUserKeyString(f.keyBinding),a.createItem(h,f.command.name||f.command.tooltip,b(f)));for(var u in d)d[u].length&&0<d[u].length&&(a.createHeader(u),d[u].forEach(function(d){h=e.getUserKeyString(d.keyBinding);a.createItem(h,d.command.name||d.command.tooltip,b(d))}))},addCommand:function(a){this._commandList[a.id]=a;var b=this._pendingBindings[a.id];if(b){var d=this;b.forEach(function(b){d._addBinding(a,b.type,b.binding,b.bindingOnly)});delete this._pendingBindings[a.id]}},addCommandGroup:function(a,
b,d,h,f,l,p,u,e,q){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});a=this._contributionsByScopeId[a];f&&(a=this._createEntryForPath(a,f));a[b]?(h&&(a[b].title=h),d&&(a[b].position=d),p&&(a[b].imageClass=p),u&&(a[b].tooltip=u),e&&(a[b].selectionClass=e),!0===q?a[b].pretendDefaultActionId=!0:a[b].defaultActionId=q,a[b].emptyGroupMessage=l):(a[b]={title:h,position:d,emptyGroupMessage:l,imageClass:p,tooltip:u,selectionClass:e,defaultActionId:!0===q?null:q,pretendDefaultActionId:!0===
q,children:{}},a.sortedContributions=null)},_createEntryForPath:function(a,b){b&&b.split("/").forEach(function(b){1<b.length&&(a[b]||(a[b]={position:0,children:{}},a.sortedContributions=null),a=a[b].children)});return a},registerSelectionService:function(a,b){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});this._contributionsByScopeId[a].localSelectionService=b},registerCommandContribution:function(a,b,d,h,f,l,p){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]=
{});a=this._contributionsByScopeId[a];h&&(a=this._createEntryForPath(a,h));a[b]={position:d};l&&((d=this._commandList[b])?this._addBinding(d,"key",l,f):this._addPendingBinding(b,"key",l,f));p&&((d=this._commandList[b])?this._addBinding(d,"url",p,f):this._addPendingBinding(b,"url",p,f));a.sortedContributions=null},unregisterCommandContribution:function(a,b,d){if(this._contributionsByScopeId[a]){delete this._commandList[b];delete this._activeBindings[b];delete this._urlBindings[b];delete this._pendingBindings[b];
var h=this._contributionsByScopeId[a];d&&d.split("/").forEach(function(a){1<a.length&&h[a]&&(h=h[a].children)});delete h[b];h.sortedContributions=null}},_addBinding:function(a,b,d,h){if(!a.id)throw Error("No command id: "+a);"key"===b?this._activeBindings[a.id]={command:a,keyBinding:d,bindingOnly:h}:"url"===b&&(this._urlBindings[a.id]={command:a,urlBinding:d,bindingOnly:h})},_addPendingBinding:function(a,b,d,h){this._pendingBindings[a]=this._pendingBindings[a]||[];this._pendingBindings[a].push({type:b,
binding:d,bindingOnly:h})},_checkForTrailingSeparator:function(a,b,h){var f;if("tool"===b||"button"===b)if((f=0<a.childNodes.length?a.childNodes[a.childNodes.length-1]:null)&&f.classList.contains("commandSeparator"))return h?(a.removeChild(f),!1):!0;if("menu"===b&&(a=d.$$array("li \x3e *",a),0<a.length&&a[a.length-1].classList.contains("dropdownSeparator")))if(f=a[a.length-1],h)f.parentNode.parentNode.removeChild(f.parentNode);else return!0;return!1},renderCommands:function(a,b,h,f,l,p,e){if("string"!==
typeof a)throw"a scope id for rendering must be specified";b=d.node(b);if(!b)throw"no parent";var u=this._contributionsByScopeId[a];if(!h&&u){h=u.localSelectionService||this._selectionService;var y=this;h&&h.getSelections(function(d){y.renderCommands(a,b,d,f,l,p)})}else u&&(this._render(u,b,h,f,l||"button",p,e),this._checkForTrailingSeparator(b,l,!0))},destroy:function(a){a=d.node(a);if(!a)throw"no parent";for(;a.hasChildNodes();){var b=a.firstChild;b.commandTooltip&&b.commandTooltip.destroy();b.emptyGroupTooltip&&
b.emptyGroupTooltip.destroy();this.destroy(b);a.removeChild(b)}},_render:function(a,b,d,h,l,p,q){var u=a.sortedContributions;if(!u){var u=[],y=!1,C;for(C in a)if(Object.prototype.hasOwnProperty.call(a,C)){var g=a[C];g&&"number"===typeof g.position&&(g.id=C,u.push(g),y=!0)}y&&(u.sort(function(a,b){return a.position-b.position}),a.sortedContributions=u)}var r=0,t=this;u.forEach(function(a){var u;a.imageClass||(a.imageClass=null);if(a.children&&0<Object.getOwnPropertyNames(a.children).length){var y=
a.children;if("tool"===l||"button"===l)if(a.title){var C;a.defaultActionId&&((y=t._commandList[a.defaultActionId])&&(y.visibleWhen?y.visibleWhen(d):1)?(C=new m.CommandInvocation(h,d,p,y,t),C.domParent=b):a.pretendDefaultActionId=!0);y=t._createDropdownMenu(b,a.title,null,null,a.imageClass,a.tooltip,a.selectionClass,null,C,a.pretendDefaultActionId);q&&n.generateNavGrid(q,y.menuButton);y&&(t._render(a.children,y.menu,d,h,"menu",p,q),t._checkForTrailingSeparator(y.menu,"menu",!0),0===y.menu.childNodes.length?
a.emptyGroupMessage?y.menuButton.emptyGroupTooltip||(y.menuButton.emptyGroupTooltip=new f.Tooltip({node:y.menuButton,text:a.emptyGroupMessage,trigger:"click",position:["below","right","above","left"]})):(q&&n.removeNavGrid(q,y.menuButton),a=function(a){a&&a.parentNode&&a.parentNode.removeChild(a)},a(y.menu),a(y.menuButton),a(y.destroyButton)):y.menuButton.style.visibility="visible")}else{var g;0<b.childNodes.length&&!t._checkForTrailingSeparator(b,l)&&(g=t.generateSeparatorImage(b));t._render(y,b,
d,h,l,p,q);0<b.childNodes.length&&b.childNodes[b.childNodes.length-1]!==g&&(g=t.generateSeparatorImage(b))}else if(a.title){if(a=t._createDropdownMenu(b,a.title,!0,null,null,a.imageClass))t._render(y,a.menu,d,h,"menu",p,q),t._checkForTrailingSeparator(a.menu,"menu",!0),0===a.menu.childNodes.length&&a.destroyButton&&b.removeChild(a.destroyButton)}else 0<b.childNodes.length&&t._generateMenuSeparator(b),t._render(y,b,d,h,l,p,q),t._generateMenuSeparator(b)}else{var k=t._commandList[a.id],y=k?!0:!1;C=
a=null;if(k){u=new m.CommandInvocation(h,d,p,k,t);u.domParent=b;g=!1;try{g=y&&(k.visibleWhen?k.visibleWhen(d):!0)}catch(E){throw console.log(E),E;}t._activeBindings[k.id]&&t._activeBindings[k.id].keyBinding&&(a=t._activeBindings[k.id],a.invocation=g?u:null,a.bindingOnly&&(y=!1));t._urlBindings[k.id]&&t._urlBindings[k.id].urlBinding&&(C=t._urlBindings[k.id],C.invocation=g?u:null,C.bindingOnly&&(y=!1));y=y&&g}y&&(k.choiceCallback?("tool"===l||"button"===l?(a=b,y=!1,"ul"===b.nodeName.toLowerCase()&&
(a=document.createElement("li"),b.appendChild(a))):(a=b,y=!0),t._createDropdownMenu(a,k.name,y,function(a){k.populateChoicesMenu(a,d,h,p,t)}.bind(k),k.imageClass,k.tooltip||k.title,k.selectionClass,k.positioningNode)):(u.handler=u.handler||this,u.domParent=b,y=function(a){t._invoke(u)},"menu"===l?(C=null,a&&a.keyBinding&&(C=e.getUserKeyString(a.keyBinding)),a=m.createCommandMenuItem(b,k,u,null,y,C)):(a=l+k.id+r,a=m.createCommandItem(b,k,u,a,null,"tool"===l,y)),n.generateNavGrid(q,a),u.domNode=a,r++))}})},
_createDropdownMenu:function(a,b,h,p,e,q,r,u,y,C){a=d.node(a);if(!a||!d.contains(document.body,a))return null;var t,k,H=a;if(h)q=document.createRange(),q.selectNode(a),q=q.createContextualFragment(l),d.processTextNodes(q,{ButtonText:b}),a.appendChild(q),k=a.lastChild,e=k.lastChild,b=e.previousSibling,b.dropdown=new g.Dropdown({dropdown:e,populate:p,parentDropdown:a.dropdown}),e.dropdown=b.dropdown;else{"ul"===a.nodeName.toLowerCase()&&(H=document.createElement("li"),a.appendChild(H),k=H);a=null;e&&
(a="dropdownButtonWithIcon",q=q||b);q=e?q||b:q;var n=m.createDropdownMenu(H,b,p,a,e,!1,r,u,y||C);t=n.dropdownArrow;b=n.menuButton;if(t){y&&(y.domNode=n.menuButton);var G=this;b.onclick=function(a){var b=d.bounds(t);a.clientX>=b.left&&n.dropdown?n.dropdown.toggle(a):G._invoke(y)};n.dropdown&&(b.onkeydown=function(a){d.KEY.DOWN===a.keyCode&&(n.dropdown.toggle(a),d.stop(a))})}e=n.menu;var J;(p=y&&y.command&&(y.command.tooltip||y.command.name))?J=y.command.tooltip||y.command.name:p&&(J=q);J&&(b.commandTooltip=
new f.Tooltip({node:b,text:J,position:["above","below","right","left"]}))}return{menuButton:b,menu:e,dropdown:b.dropdown,destroyButton:k,dropdownArrow:t}},_generateMenuSeparator:function(a){if(!this._checkForTrailingSeparator(a,"menu")){var b=document.createElement("li");b.classList.add("dropdownSeparator");var d=document.createElement("span");d.classList.add("dropdownSeparator");b.appendChild(d);a.appendChild(b)}},generateSeparatorImage:function(a){var b;b="ul"===a.nodeName.toLowerCase()?document.createElement("li"):
document.createElement("span");a.appendChild(b);b.classList.add("core-sprite-sep");b.classList.add("imageSprite");b.classList.add("commandSeparator");return b}};h.prototype.constructor=h;p.prototype={match:function(a){a=k.matchResourceParameters(a);return"undefined"!==typeof a[this.token]?(this.parameterValue=a[this.token],this):null}};p.prototype.constructor=p;q.prototype.constructor=q;r.prototype={optionsRequested:function(){return this.optionsRequested}};r.prototype.constructor=r;t.prototype={_storeParameters:function(a){this.parameterTable=
null;if(a){var b=this.parameterTable={};a.forEach(function(a){b[a.name]=a})}},updateParameters:function(a){"function"===typeof this.getParameters&&this._storeParameters(this.getParameters(a))},hasParameters:function(){return null!==this.parameterTable},shouldCollectParameters:function(){return!this.clientCollect&&this.hasParameters()},parameterNamed:function(a){return this.parameterTable[a]},valueFor:function(a){return(a=this.parameterTable[a])?a.value:null},setValue:function(a,b){var d=this.parameterTable[a];
d&&(d.value=b)},forEach:function(a){for(var b in this.parameterTable)this.parameterTable[b].type&&this.parameterTable[b].name&&a(this.parameterTable[b])},makeCopy:function(){var a=[];this.forEach(function(b){b=new r(b.name,b.type,b.label,b.value,b.lines,b.eventListeners);a.push(b)});var b=new t(a,this._options,this.getParameters);b.clientCollect=this.clientCollect;return b},hasOptionalParameters:function(){return this._hasOptionalParameters}};t.prototype.constructor=t;return{CommandRegistry:h,URLBinding:p,
ParametersDescription:t,CommandParameter:r,CommandEventListener:q}});
define("orion/parameterCollectors",["i18n!orion/nls/messages","require","orion/webui/littlelib"],function(m,n,k){function e(d,e){this._activeContainer=null;this._getElementsFunction=d;this._toolbarLayoutFunction=e}e.prototype={close:function(){if(this._activeElements){this._activeElements.parameterArea&&k.empty(this._activeElements.parameterArea);this._activeElements.slideContainer&&this._activeElements.slideContainer.classList.remove("slideContainerActive");this._activeElements.dismissArea&&k.empty(this._activeElements.dismissArea);
this._activeElements.commandNode&&this._activeElements.commandNode.classList.remove("activeCommand");this._toolbarLayoutFunction(this._activeElements);if(this._activeElements.onClose)this._activeElements.onClose();this._oldFocusNode&&(this._oldFocusNode.focus(),this._oldFocusNode=null)}this._activeElements=null},open:function(d,e,f){"string"===typeof d&&(d=k.node(d));if(this._activeElements&&this._activeElements.slideContainer&&this._activeElements.commandNode===d)return this._activeElements.focusNode&&
this._activeElements.focusNode.focus(),!0;this.close();this._activeElements=null;if((this._activeElements=this._getElementsFunction(d))&&this._activeElements.parameterArea&&this._activeElements.slideContainer){this._activeElements.onClose=f;var b=e(this._activeElements.parameterArea,this._activeElements.dismissArea);if(!b)return!1;this._activeElements.focusNode=b;d=k.$$array("#closebox",this._activeElements.dismissArea||this._activeElements.parameterArea);if(0===d.length){e=this._activeElements.dismissArea||
this._activeElements.parameterArea;d=document.createElement("button");d.id="closebox";d.className="imageSprite core-sprite-close dismissButton";d.title=m.Close;e.appendChild(d);var a=this;d.addEventListener("click",function(b){a.close()},!1)}this._activeElements.slideContainer.classList.add("slideContainerActive");this._toolbarLayoutFunction(this._activeElements);b&&(this._oldFocusNode=window.document.activeElement,window.setTimeout(function(){b.focus();b.select&&b.select()},0));this._activeElements.commandNode&&
this._activeElements.commandNode.classList.add("activeCommand");return!0}return!1},_collectAndCall:function(d,e){k.$$array("input",e).forEach(function(b){"checkbox"===b.type?d.parameters.setValue(b.parameterName,b.checked):"button"!==b.type&&d.parameters.setValue(b.parameterName,b.value.trim())});k.$$array("textArea",e).forEach(function(b){d.parameters.setValue(b.parameterName,b.value.trim())});var f=d.parameters.getParameterElement;f&&d.parameters.forEach(function(b){(b=f(b,e))&&("checkbox"===b.type?
d.parameters.setValue(b.parameterName,b.checked):"button"!==b.type?d.parameters.setValue(b.parameterName,b.value.trim()):"textarea"!==b.type&&d.parameters.setValue(b.parameterName,b.value.trim()))});d.command.callback&&d.command.callback.call(d.handler,d)},collectParameters:function(d,e){return d.parameters?(d.domNode&&d.domNode.classList.add("commandMarker"),this.open(d.domNode||d.domParent,this.getFillFunction(d,null,e))):!1},getFillFunction:function(d,e,f){var b=this;return function(a,l){var h=
null,p=function(){e&&e();b.close()},q=function(h){h.keyCode===k.KEY.ENTER&&(b._collectAndCall(d,a),p(),k.stop(h));h.keyCode===k.KEY.ESCAPE&&("function"===typeof f&&f(),p(),k.stop(h))},r=d.parameters;r.forEach(function(b){var f=r.getParameterElement?r.getParameterElement(b,a):null,l=null;!f&&b.label&&(l=document.createElement("label"),l.classList.add("parameterInput"),l.setAttribute("for",b.name+"parameterCollector"),l.textContent=b.label,a.appendChild(l));var e=b.name+"parameterCollector",l=l||a;
"text"===b.type&&"number"===typeof b.lines&&1<b.lines?(f||(f=document.createElement("textarea"),f.rows=b.lines,f.type="textarea",f.id=e,l.appendChild(f)),q=function(a){a.keyCode===k.KEY.ESCAPE&&(p(),k.stop(a))}):"boolean"===b.type?(f||(f=document.createElement("input"),f.type="checkbox",f.id=e,l.appendChild(f)),b.value&&(f.checked=!0)):(f||(f=document.createElement("input"),f.type=b.type,f.id=e,l.appendChild(f)),b.value&&(f.value=b.value));f.classList.add("parameterInput");f.setAttribute("speech",
"speech");f.setAttribute("x-webkit-speech","x-webkit-speech");f.parameterName=b.name;h||(h=f);0<b.eventListeners.length&&b.eventListeners.forEach(function(a){f.addEventListener(a.event,function(b){return a.handler(b,d)},a.capture)});f.addEventListener("keydown",q,!1)});var t=l;t||(t=document.createElement("span"),t.classList.add("layoutRight"),t.classList.add("parametersDismiss"),a.appendChild(t));var w=function(a,b){var d=document.createElement("button");b.appendChild(d);a&&d.appendChild(document.createTextNode(a));
d.classList.add("dismissButton");return d};d.parameters.hasOptionalParameters()&&(d.parameters.optionsRequested=!1,w(m.More,t).addEventListener("click",function(){d.parameters.optionsRequested=!0;b._collectAndCall(d,a);p()},!1));w(r.getSubmitName?r.getSubmitName(d):m.Submit,t).addEventListener("click",function(){b._collectAndCall(d,a);p()},!1);t=w(null,t);t.id="closebox";t.classList.add("imageSprite");t.classList.add("core-sprite-close");t.title=m.Close;t.addEventListener("click",function(a){p();
"function"===typeof f&&f()},!1);return h}}};e.prototype.constructor=e;return{CommandParameterCollector:e}});define("orion/regex",[],function(){return{escape:function(m){return m.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$\x26")},parse:function(m){return(m=/^\s*\/(.+)\/([gim]{0,3})\s*$/.exec(m))?{pattern:m[1],flags:m[2]}:null}}});
define("orion/contentTypes",[],function(){function m(a,b){if("string"!==typeof a)return null;for(var d=a&&a.split(".").pop(),f=null,e=0;e<b.length;e++){var g=b[e],k;a:{k=f;var s=g,m=d,n=0<=s.filename.indexOf(a),z;z=m.toLowerCase();z=-1!==s.extension.indexOf(z);if(n||z){if(!(z=!k))n&&(m=m.toLowerCase(),n=-1!==k.extension.indexOf(m)),z=n;if(z){k=s;break a}}}k===g&&(f=g)}return f}function n(a){return null===a||"undefined"===typeof a?[]:Array.isArray(a)?a:[a]}function k(a){return n(a).map(function(a){return String.prototype.toLowerCase.call(a)})}
function e(a){return{id:a.id,name:a.name,image:a.image,imageClass:a.imageClass,"extends":a["extends"],extension:k(a.extension),filename:n(a.filename)}}function d(a){var b=Object.create(null);a.map(e).forEach(function(a){Object.prototype.hasOwnProperty.call(b,a.id)||(b[a.id]=a)});return b}function g(l){if(l&&l.registerService){this.serviceRegistry=l;for(var h=l.getServiceReferences(b).concat(l.getServiceReferences(a)),p=[],e=0;e<h.length;e++)for(var g=n(h[e].getProperty("contentTypes")),t=0;t<g.length;t++)p.push(g[t]);
this.map=d(p);l.registerService(f,this)}else if(Array.isArray(l))this.serviceRegistry=null,this.map=d(l);else throw Error("Invalid parameter");}var f="orion.core.contentTypeRegistry",b="orion.core.contenttype",a="orion.file.contenttype";g.prototype={getContentTypes:function(){var a=this.getContentTypesMap(),b=[],d;for(d in a)Object.prototype.hasOwnProperty.call(a,d)&&b.push(a[d]);return b},getContentTypesMap:function(){return this.map},getFileContentType:function(a){return m(a.Name,this.getContentTypes())},
getFilenameContentType:function(a){return m(a,this.getContentTypes())},getContentType:function(a){return this.map[a]||null},isExtensionOf:function(a,b){a="string"===typeof a?this.getContentType(a):a;b="string"===typeof b?this.getContentType(b):b;if(!a||!b)return!1;if(a.id===b.id)return!0;for(var d=a,f={};d&&(d=this.getContentType(d["extends"]));){if(d.id===b.id)return!0;if(f[d.id])throw Error("Cycle: "+d.id);f[d.id]=!0}return!1},isSomeExtensionOf:function(a,b){for(var d=0;d<b.length;d++)if(this.isExtensionOf(a,
b[d]))return!0;return!1}};return{ContentTypeRegistry:g,getFilenameContentType:m}});
define("orion/URITemplate",[],function(){function m(a){this._text=a}function n(a){return a.replace("%25","%")}function k(a,b){if("U"===b)return encodeURIComponent(a).replace(/[!'()*]/g,function(a){return"%"+a.charCodeAt(0).toString(16).toUpperCase()});if("U+R"===b)return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(l,n);if("U+R-,"===b)return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/,/g,"%2C");throw Error("Unknown allowed character set: "+b);}function e(a,b,d){for(var f=
[],l=0;l<a.length;l++)"undefined"!==typeof a[l]&&f.push(k(a[l],b));return f.join(d)}function d(a,b,d,f){for(var l=Object.keys(a),e=[],g=0;g<l.length;g++)"undefined"!==typeof a[l[g]]&&e.push(k(l[g],b)+d+k(a[l[g]],b));return e.join(f)}function g(d){if(0===d.length)throw Error("Invalid Expression: 0 length expression");(this._operator=b[d[0]])?d=d.substring(1):this._operator=b.NUL;for(var f=[],l=d.split(","),e=0;e<l.length;e++){var g=l[e].match(a);if(null===g)throw Error("Bad VarSpec: "+d);f.push({name:g[1],
explode:!!g[2],prefix:g[3]?parseInt(g[3],10):-1})}this._varSpecList=f}function f(a){for(var b=[],d=0,f=a.indexOf("{",d);-1!==f;){b.push(new m(a.substring(d,f)));d=a.indexOf("}",f+1);if(-1===d)throw Error("Invalid template: "+a);b.push(new g(a.substring(f+1,d)));d+=1;f=a.indexOf("{",d)}b.push(new m(a.substring(d)));this._templateComponents=b}var b={NUL:{first:"",sep:",",named:!1,ifemp:"",allow:"U"},"+":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R"},".":{first:".",sep:",",named:!1,ifemp:"",allow:"U"},
"/":{first:"/",sep:"/",named:!1,ifemp:"",allow:"U"},";":{first:";",sep:";",named:!0,ifemp:"",allow:"U"},"?":{first:"?",sep:"\x26",named:!0,ifemp:"\x3d",allow:"U"},"\x26":{first:"\x26",sep:"\x26",named:!0,ifemp:"\x3d",allow:"U"},"#":{first:"#",sep:",",named:!1,ifemp:"",allow:"U+R"},",":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R-,"}},a=/^((?:(?:[a-zA-Z0-9_])|(?:%[0-9A-F][0-9A-F]))(?:(?:[a-zA-Z0-9_.])|(?:%[0-9A-F][0-9A-F]))*)(?:(\*)|:([0-9]+))?$/,l=/%25[0-9A-F][0-9A-F]/g;m.prototype={expand:function(a){return encodeURI(this._text)}};
g.prototype={expand:function(a){for(var b=[],f=0;f<this._varSpecList.length;f++){var l=this._varSpecList[f],g=l.name,w=a[g],s=typeof w;if("undefined"!==s&&null!==w){var m=0===b.length?this._operator.first:this._operator.sep;if("string"===s)this._operator.named&&(m+=k(g,"U+R"),m+=0===w.length?this._operator.ifemp:"\x3d"),-1!==l.prefix&&l.prefix<w.length&&(w=w.substring(0,l.prefix)),m+=k(w,this._operator.allow);else if(Array.isArray(w)){if(0===w.length)continue;l.explode?m+=e(w,this._operator.allow,
this._operator.sep):(l=e(w,this._operator.allow,","),this._operator.named&&(m+=k(g,"U+R"),m+=0===l.length?this._operator.ifemp:"\x3d"),m+=l)}else if("object"===s){if(0===Object.keys(w).length)continue;l.explode?m+=d(w,this._operator.allow,"\x3d",this._operator.sep):(l=d(w,this._operator.allow,",",","),this._operator.named&&(m+=k(g,"U+R"),m+=0===l.length?this._operator.ifemp:"\x3d"),m+=l)}else throw Error("bad param type: "+g+" : "+s);b.push(m)}}return b.join("")}};f.prototype={expand:function(a){for(var b=
[],d=0;d<this._templateComponents.length;d++)b.push(this._templateComponents[d].expand(a));return b.join("")}};return f});
define("orion/i18nUtil",["require","orion/Deferred"],function(m,n){function k(d){if(d=localStorage.getItem("orion/messageBundle/"+d))if(d=JSON.parse(d),d._expires&&d._expires>(new Date).getTime())return delete d._expires,d;return null}var e={};return{getMessageBundle:function(d){function g(a){a?m(["i18n!"+d],function(a){if(a){var h=d;a._expires=(new Date).getTime()+9E5;localStorage.setItem("orion/messageBundle/"+h,JSON.stringify(a));delete a._expires}b.resolve(a)}):f(Error(d))}function f(a){b.reject(a)}
if(e[d])return e[d];var b=new n;e[d]=b;var a=k(d);if(a)return b.resolve(a),b;try{m([d],g,f)}catch(l){m(["orion/i18n!"+d],g,f)}return b},formatMessage:function(d){var e=arguments;return d.replace(/\$\{([^\}]+)\}/g,function(d,b){return e[(b<<0)+1]})}}});
define("orion/PageLinks","require orion/Deferred orion/PageUtil orion/URITemplate orion/i18nUtil orion/objects orion/URL-shim".split(" "),function(m,n,k,e,d,g,f){function b(){return m.toUrl?(new URL(m.toUrl("orion/../"),window.location.href)).href.slice(0,-1):(new URL("/",window.location.href)).href.slice(0,-1)}function a(a){var b={};a.getPropertyKeys().forEach(function(d){"objectClass"!==d&&("service.names"!==d&&"service.id"!==d&&"__plugin__"!==d)&&(b[d]=a.getProperty(d))});return b}function l(a){return d.getMessageBundle(a.nls).then(function(b){a.textContent=
a.nameKey?b[a.nameKey]:a.name;return a},function(b){a.textContent=a.nameKey||a.name;return a})}function h(d,h){var f=d.getServiceReferences(h||"orion.page.link"),p=k.matchResourceParameters(window.location.href),q={OrionHome:b(),Location:p.resource},g=[];f.forEach(function(b){b=a(b);if(b.uriTemplate&&(b.nls||b.name)){var d=(new e(b.uriTemplate)).expand(q),d=k.validateURLScheme(d);b.href=d;b.nls?g.push(l(b)):(b.textContent=b.name,g.push((new n).resolve(b)))}});return n.all(g)}function p(a){var b=this.categories=
Object.create(null);a.forEach(function(a){b[a.id]=a})}function q(a){this.allPageLinks=a;this.allPageLinks.sort(r)}function r(a,b){var d=a.textContent&&a.textContent.toLowerCase(),h=b.textContent&&b.textContent.toLowerCase();return d<h?-1:d>h?1:0}var t;g.mixin(p.prototype,{getCategoryIDs:function(){return Object.keys(this.categories)},getCategory:function(a){return this.categories[a]||null}});g.mixin(q.prototype,{createLinkElements:function(){return this.allPageLinks.map(function(a){var b=a.href;a=
a.textContent;var d=document.createElement("a");d.href=b;d.target="_self";d.classList.add("targetSelector");d.textContent=a;return d})},getAllLinks:function(){return this.allPageLinks}});return{getCategoriesInfo:function(b){var d;return!t?(d=[],b.getServiceReferences("orion.page.link.category").forEach(function(h){var f=a(h);if(f.id&&(f.name||f.nameKey))f.service=b.getService(h),f.nls?d.push(l(f)):(f.textContent=f.name,d.push((new n).resolve(f)))}),n.all(d).then(function(a){return t=new p(a)})):(new n).resolve(t)},
getPageLinksInfo:function(a,b){return h(a,b).then(function(a){return new q(a)})},getOrionHome:b}});
define("orion/edit/nls/root/messages",{Editor:"Editor",switchEditor:"Switch Editor",Fetching:"Fetching: ${0}",confirmUnsavedChanges:"There are unsaved changes.  Do you still want to navigate away?",searchFiles:"Search Files...",searchTerm:"Enter search term:",unsavedChanges:"There are unsaved changes.",unsavedAutoSaveChanges:"Please stay on the page until Auto Save is complete.",Save:"Save",Saved:"Saved",Blame:"Blame",BlameTooltip:"Show blame annotations",saveOutOfSync:"Resource is out of sync with the server. Do you want to save it anyway?",
loadOutOfSync:"Resource is out of sync with the server. Do you want to load it anyway? This will overwrite your local changes.",ReadingMetadata:"Reading metadata of ${0}",ReadingMetadataError:"Can not get metadata of ${0}",Reading:"Reading ${0}",readonly:"Read Only.",saveFile:"Save this file",gotoLine:"Go to Line...",gotoLineTooltip:"Go to specified line number",gotoLinePrompt:"Go to line:",Undo:"Undo",Redo:"Redo",Find:"Find...",noResponse:"No response from server.  Check your internet connection and try again.",
savingFile:"Saving file ${0}",running:"Running ${0}","Saving...":"Saving...",View:"View",SidePanel:"Side Panel",SidePanelTooltip:"Choose what to show in the side panel.",Actions:"Actions",Navigator:"Navigator",FolderNavigator:"Folder Navigator",Project:"Project",New:"New",File:"File",Edit:"Edit",Tools:"Tools",Add:"Add",noActions:"There are no actions for the current selection.",NoFile:"Use the ${0} to create new files and folders. Click a file to start coding.",LocalEditorSettings:"Local Editor Settings",
NoProject:"${0} is not a project. To convert it to a project use ${1}.",NoProjects:"There are no projects in your workspace. Use the ${0} menu to create projects.",disconnected:"(disconnected)",ChooseFS:"Choose Filesystem",ChooseFSTooltip:"Choose the filesystem you want to view.",FSTitle:"${0} (${1})",Deploy:"Deploy","Deploy As":"Deploy As",Import:"Import",Export:"Export",OpenWith:"Open With",OpenRelated:"Open Related",Dependency:"Dependency",UnnamedCommand:"Unnamed"});
define("orion/edit/nls/messages",["orion/i18n!orion/edit/nls/messages","orion/edit/nls/root/messages"],function(m,n){var k={root:n};Object.keys(m).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=m[e])});return k});
define("orion/extensionCommands","require orion/Deferred orion/commands orion/regex orion/contentTypes orion/URITemplate orion/i18nUtil orion/URL-shim orion/PageLinks i18n!orion/edit/nls/messages".split(" "),function(m,n,k,e,d,g,f,b,a,l){function h(a){var b={};a.getPropertyKeys().forEach(function(d){b[d]=a.getProperty(d)});return b}var p={},q=a.getOrionHome();p._cloneItemWithoutChildren=function s(a){if(null===a||"object"!==typeof a)return a;var b=a.constructor(),d;for(d in a)"children"!==d&&"Children"!==
d&&(b[d]=s(a[d]));return b};p._getOpenWithNavCommandExtensions=function(a,b){function d(a,b){for(var h=a.getServiceReferences("orion.navigate.openWith"),f=[],l=[],u=0;u<h.length;u++){var p=h[u];if(p.getProperty("editor")===b.id){var e=p.getProperty("contentType");e instanceof Array?f=f.concat(e):f.push(e||"*/*");p=p.getProperty("excludedContentTypes");p instanceof Array?l=l.concat(p):null!==p&&"undefined"!==typeof p&&l.push(p)}}0===f.length&&(f=null);0===l.length&&(l=null);return{contentTypes:f,excludedContentTypes:l}}
for(var h=function(){for(var b=a.getServiceReferences("orion.edit.editor"),d=[],h=0;h<b.length;h++){var f=b[h],l=f.getProperty("id");d.push({id:l,"default":f.getProperty("default")||!1,name:f.getProperty("name"),nameKey:f.getProperty("nameKey"),nls:f.getProperty("nls"),uriTemplate:f.getProperty("orionTemplate")||f.getProperty("uriTemplate"),validationProperties:f.getProperty("validationProperties")||[]})}return d}(),f=[],l,u=0;u<h.length;u++){var p=h[u],e=d(a,p),e={properties:{name:p.name||p.id,nameKey:p.nameKey,
id:"eclipse.openWithCommand."+p.id,contentType:e.contentTypes,excludedContentTypes:e.excludedContentTypes,uriTemplate:p.uriTemplate,nls:p.nls,forceSingleItem:!0,isEditor:p["default"]?"default":"editor",validationProperties:p.validationProperties},service:{}};"orion.editor"===p.id?l=e:f.push(e)}l&&f.push(l);return f};p._makeValidator=function(a,b,h,f){function l(a,b,d,h,f){var u=!1,p;if("!"===b.charAt(0))return"undefined"===typeof a[b.substring(1)];if("undefined"!==typeof a[b]){if("undefined"===typeof d)p=
a[b],u=!0;else if("string"===typeof d){if(!typeof("string"===a[b]))return!1;if(h.variableName){if(d=RegExp(d).exec(a[b]))u=d[0],p="before"===h.variableMatchPosition?a[b].substring(0,d.index):"after"===h.variableMatchPosition?a[b].substring(d.index+u.length):"only"===h.variableMatchPosition?u:a[b],u=!0}else return RegExp(d).test(a[b])}else a[b]===d&&(p=a[b],u=!0);b=h.variableName;h=h.replacements;if(u&&b&&(f[b]=p,f.itemCached=a,h)){if("string"!==typeof p)return window.console.log("Cannot replace "+
b+", value is not a string: "+p),u;for(a=0;a<h.length;a++){p=!1;if(h[a].pattern){d=h[a].pattern;var e=h[a].replacement||"";f[b]=f[b].replace(RegExp(d),e).replace(RegExp(d),e)}else p=!0;p&&window.console.log("Invalid replacements specified in validation property.  "+h[a])}}return u}return!1}function p(a,b,d,h){var f=d.match,u,e;if(0<=(u=b.indexOf("["))){if(0>(e=b.indexOf("]")))return!1;var q=b.substring(0,u),g;if(!(g=a[q])||!Array.isArray(g))return!1;u=b.substring(u+1,e);u=parseInt(u,10);if(isNaN(u))return!1;
0>u&&(u+=g.length);b=b.substring(e+1);b=q+":"+String(u)+b}return 0<=b.indexOf("|")?(u=b.substring(0,b.indexOf("|")),b=b.substring(b.indexOf("|")+1),p(a,u,d,h)?!0:p(a,b,d,h)):0<=b.indexOf(":")?(u=b.substring(0,b.indexOf(":")),b=b.substring(b.indexOf(":")+1),a[u]?p(a[u],b,d,h):!1):l(a,b,f,d,h)}function u(b,h,f){if(f.info.validationProperties)for(var l=0;l<f.info.validationProperties.length;l++){var u=f.info.validationProperties[l];if("undefined"!==typeof u.source){if(!p(b,u.source,u,f))return!1}else return window.console.log("Invalid validationProperties in "+
a.id+".  No source property specified."),!1}var l=!0,e=h?d.getFilenameContentType(b.Name,h):null,e=e||{id:"application/octet-stream"};f.info.excludedContentTypes&&h&&(l=f.info.excludedContentTypes.every(function(a){a=a.replace(/([*?])/g,".$1");return-1!==e.id.search(a)?!1:!0}));l&&(f.info.contentType&&h)&&(l=f.info.contentType.some(function(a){a=a.replace(/([*?])/g,".$1");return-1!==e.id.search(a)?!0:!1}));return l}return{info:a,validationFunction:function(a){"function"===typeof f&&(a=f.call(this,
a));if(a){if(Array.isArray(a)){if((this.info.forceSingleItem||this.info.uriTemplate)&&1!==a.length||1>a.length)return!1}else a=[a];for(var b=0;b<a.length;b++)if(!u(a[b],h,this))return!1;return!0}return!1},generatesURI:function(){return!!this.info.uriTemplate},getURI:function(a){if(this.info.uriTemplate){var b={},d;for(d in a)Object.prototype.hasOwnProperty.call(a,d)&&(b[d]=a[d]);if(this.info.validationProperties)for(d=0;d<this.info.validationProperties.length;d++){var h=this.info.validationProperties[d];
h.source&&h.variableName&&(this.itemCached===a&&this[h.variableName]||p(a,h.source,h,this),a[h.variableName]?window.console.log("Variable name "+h.variableName+" in the extension "+this.info.id+" conflicts with an existing property in the item metadata."):b[h.variableName]=this[h.variableName])}b.OrionHome=q;return(new g(this.info.uriTemplate)).expand(b)}return null}}};var r=l.UnnamedCommand;p._createCommandOptions=function(a,b,d,h,l,e){function u(f,u){var y=p._makeValidator(a,d,h,e);f.visibleWhen=
y.validationFunction.bind(y);if(l)if(y.generatesURI.bind(y)())f.hrefCallback=function(a){a=Array.isArray(a.items)?a.items[0]:a.items;return y.getURI.bind(y)(a)};else{var q=a;f.callback=function(a){var h;if(q.forceSingleItem)a=Array.isArray(a.items)?a.items[0]:a.items,h=p._cloneItemWithoutChildren(a);else if(Array.isArray(a.items)){h=[];for(var l=0;l<a.items.length;l++)h.push(p._cloneItemWithoutChildren(a.items[l]))}else h=p._cloneItemWithoutChildren(a.items);if(d)var u=d.getService("orion.page.progress");
b.run?u?u.progress(b.run(h),"Running command: "+f.name):b.run(h):d&&(u?u.progress(d.getService(b).run(h),"Running command: "+f.name):d.getService(b).run(h))}}u.resolve(f)}var y=new n;if(a.nls){var q=function(b){var d;b?(d=a.tooltipKey&&b[a.tooltipKey],b=a.nameKey&&b[a.nameKey]||a.name||r,d=d||a.tooltip||""):(b=a.name||a.nameKey||r,d=a.tooltip||a.tooltipKey||"");u({name:b,image:a.image,id:a.id||a.name,tooltip:d,isEditor:a.isEditor,showGlobally:a.showGlobally},y)};f.getMessageBundle(a.nls).then(q,q.bind(this,
null))}else u({name:a.name,image:a.image,id:a.id||a.name,tooltip:a.tooltip,isEditor:a.isEditor,showGlobally:a.showGlobally},y);return y};p.getOpenWithCommand=function(a,b,d){var h;a=d||p.getOpenWithCommands(a);for(d=0;d<a.length;d++)if(a[d].visibleWhen(b)){var f="default"===a[d].isEditor;if(!h||f)if(h=a[d],f)break}return h};p.getOpenWithCommands=function(a){var b=[],d;for(d in a._commandList){var h=a._commandList[d];h.isEditor&&b.push(h)}return b};var t;p.createAndPlaceFileCommandsExtension=function(a,
b,d,h,f,e){return p.createFileCommands(a,null,e?"all":void 0,!!e,b).then(function(a){f&&0<a.length&&(b.addCommandGroup(d,"eclipse.openWith",1E3,l.OpenWith,f,null,null,null,"dropdownSelection"),b.addCommandGroup(d,"eclipse.fileCommandExtensions",1E3,l.OpenRelated,f));a.forEach(function(a){var l=null;f&&(l=a.isEditor?f+"/eclipse.openWith":f+"/eclipse.fileCommandExtensions");b.registerCommandContribution(d,a.id,h,l)});return{}})};p.createFileCommands=function(a,b,d,h,f){d=void 0===d?"global":d;h=void 0===
h?!0:h;var l=[];p._cachedFileCommands||p._createCachedFileCommands(a);("all"===d||"global"===d)&&p._cachedFileCommands.forEach(function(a){var b=a.properties;("all"===d||b.forceSingleItem&&b.showGlobally)&&l.push(a)});return n.when(function(){var d=a.getService("orion.core.contentTypeRegistry")||b;return t||n.when(d.getContentTypes(),function(a){return t=a})}(),function(){h&&(p._cachedOpenWithExtensions||(p._cachedOpenWithExtensions=p._getOpenWithNavCommandExtensions(a,t)),l=l.concat(p._cachedOpenWithExtensions),
f._addedOpenWithCommands=h);var b=l.map(function(b){var d=b.properties;b=b.service;var h=f.findCommand(d.id||d.name);return h?(new n).resolve(h):p._createCommandOptions(d,b,a,t,!0).then(function(a){a=new k.Command(a);f.addCommand(a);return a})});return n.all(b,function(a){return{_error:a}}).then(function(a){return a})})};p._createCachedFileCommands=function(a){var b=a.getServiceReferences("orion.navigate.command");p._cachedFileCommands=[];for(var d=0;d<b.length;d++)if("orion.navigateFromMetadata"!==
b[d].getProperty("id")){var f=a.getService(b[d]),l=h(b[d]);p._cachedFileCommands.push({properties:l,service:f})}};p.getFileCommandIds=function(){var a=[];if(p._cachedFileCommands)p._cachedFileCommands.length&&(a=p._cachedFileCommands.map(function(a){return a.properties.id}));else throw"extensionCommandUtils._cachedFileCommands is not initialized";return a};p.createOpenWithCommands=function(a,b,d){return d&&d._addedOpenWithCommands?(new n).resolve(p.getOpenWithCommands(d)):p.createFileCommands(a,b,
"none",!0,d)};return p});
define("orion/breadcrumbs",["require","orion/webui/littlelib"],function(m,n){function k(e){this._init(e)}k.prototype={_init:function(e){var d=n.node(e.container);if(!d)throw"no parent container";this._container=d;d.classList.remove("currentLocation");this._id=e.id||"eclipse.breadcrumbs";this._resource=e.resource||null;this._rootSegmentName=e.rootSegmentName;this._workspaceRootSegmentName=e.workspaceRootSegmentName;this._workspaceRootURL=e.workspaceRootURL;this._makeHref=e.makeHref;this._makeFinalHref=
e.makeFinalHref;this._maxLength=e.maxLength;this.path="";this.measure();this.render()},getNavigatorWorkspaceRootSegment:function(){if(this._workspaceRootSegmentName){var e;if(this._resource&&this._resource.Parents&&!this._resource.skip){e=document.createElement("a");var d=this._workspaceRootURL?this._workspaceRootURL:"";this._makeHref?this._makeHref(e,d):e.href=m.toUrl("edit/edit.html")+"#"+d}else e=document.createElement("span");n.empty(e);e.appendChild(document.createTextNode(this._workspaceRootSegmentName));
return e}return null},MAX_LENGTH:500,INCLUDE_FIRST_SECTION:!0,segments:[],buildSegment:function(e){var d=document.createElement("a");d.classList.add("breadcrumb");d.appendChild(document.createTextNode(e));return d},addSegmentHref:function(e,d){this._makeHref?this._makeHref(e,d.Location,d):e.href=m.toUrl("edit/edit.html")+"#"+d.ChildrenLocation},buildSegments:function(e,d){if(this._resource.Parents){var g=this._resource.Parents.slice(0),f,b;g&&(g=g.slice(0),"reverse"===d&&(g=g.reverse().slice(0)),
g.forEach(function(a){a.skip||(e?(b=e,e=null):b=a.Name,f=this.buildSegment(b),this.path+=a.Name,this.addSegmentHref(f,a),f.include=!1,this.segments.push(f))}.bind(this)))}},addDivider:function(){var e=document.createElement("span");e.appendChild(document.createTextNode(" / "));this.path+="/";e.classList.add("breadcrumbSeparator");this.append(e)},refresh:function(){(this.crumbs=n.node(this._id))?n.empty(this.crumbs):(this.crumbs=document.createElement("span"),this.crumbs.id=this._id,this._container.appendChild(this.crumbs),
this.dirty=document.createElement("span"),this.dirty.id="dirty",this.dirty.className="modifiedFileMarker",this._container.appendChild(this.dirty));this.crumbs.style.width="auto";this.crumbs.style.visibility="visible";this.crumbs.parentNode.className="currentLocation";this.crumbs.parentNode.style.width="auto"},append:function(e){this.crumbs.appendChild(e)},addTitle:function(e,d){var g=d||document.title;0===this.crumbs.childNodes.length&&(e=document.createElement("span"),e.appendChild(document.createTextNode(g)),
e.classList.add("breadcrumb"),e.classList.add("currentLocation"),this.append(e))},finalSegment:function(e,d){if(!this._resource.skip){var g;g=d?d:this._resource.Name;this._makeFinalHref?(e=this.buildSegment(g),this.addSegmentHref(e,this._resource)):(e=document.createElement("span"),e.appendChild(document.createTextNode(g)));e.classList.add("currentLocation");this.path+=this._resource.Name;this.append(e)}},firstSegment:function(e){e&&(this.append(e),this._resource&&this._resource.Parents&&!this._resource.skip?
(e.classList.add("breadcrumb"),this.addDivider()):(this._resource.skip||(e.href=""),e.classList.add("currentLocation")))},drawSegments:function(){this._resource.Parents&&this.segments.slice(0).forEach(function(e){!0===e.include&&(this.append(e),this.addDivider())}.bind(this))},measureSegments:function(){this.INCLUDE_FIRST_SECTION=!0;if(this._resource.Parents){var e=this.segments.slice(0).reverse();e.forEach(function(d){this.append(d);this.addDivider();this.crumbs.offsetWidth<this.MAX_LENGTH?d.include=
!0:this.INCLUDE_FIRST_SECTION=!1}.bind(this));this.segments=e.reverse()}},measure:function(){var e=this._container;e.style.width="auto";this.MAX_LENGTH=this._maxLength?this._maxLength:e.offsetWidth;this.refresh();this.segments=[];this.crumbs.style.visibility="hidden";var e=this.getNavigatorWorkspaceRootSegment(),d=this._rootSegmentName;d?this.addTitle(e,d):(this.finalSegment(e,d),this._resource&&this._resource.Parents&&(this.buildSegments(d,"reverse"),this.measureSegments(),this.firstSegment(e)),
this.crumbs.offsetWidth>=this.MAX_LENGTH&&(this.INCLUDE_FIRST_SECTION=!1))},render:function(){this.refresh();var e=this.getNavigatorWorkspaceRootSegment(),d=this._rootSegmentName;d?this.addTitle(e,d):(!0===this.INCLUDE_FIRST_SECTION&&this.firstSegment(e),this._resource&&this._resource.Parents&&(this.drawSegments(),this.finalSegment(e,d)));this.crumbs.parentNode.style.width=this.crumbs.offsetWidth+20+"px"}};k.prototype.constructor=k;return{BreadCrumbs:k}});
define("orion/webui/splitter",["orion/EventTarget","orion/util","orion/webui/littlelib"],function(m,n,k){function e(d){m.attach(this);this._init(d)}e.prototype={_init:function(d){this._tracking=null;this._animationDelay=501;this._closeReversely=d.closeReversely;this.$node=k.node(d.node);if(!this.$node)throw"no dom node for splitter found";this.$sideNode=k.node(d.sidePanel);if(!this.$sideNode)throw"no dom node for side panel found";this.$mainNode=k.node(d.mainPanel);if(!this.$mainNode)throw"no dom node for main panel found";
this._vertical=d.vertical||!1;var e=this.$node.classList;e.add("split");e.add(this._vertical?"splitVerticalLayout":"splitLayout");e=this.$sideNode.classList;e.add("hasSplit");e.add(this._vertical?"sidePanelVerticalLayout":"sidePanelLayout");e=this.$mainNode.classList;e.add("hasSplit");e.add(this._vertical?"mainPanelVerticalLayout":"mainPanelLayout");this._prefix="/orion/splitter/"+(this.$node.id||document.body.id||"");d.toggle&&(this._thumb=document.createElement("div"),this.$node.appendChild(this._thumb),
this._thumb.classList.add("splitThumb"),this._thumb.classList.add(this._vertical?"splitVerticalThumbLayout":"splitThumbLayout"));this._closeByDefault="closed"===this.$node.getAttribute("data-initial-state");"undefined"!==typeof d.closeByDefault&&(this._closeByDefault=d.closeByDefault);this._initializeFromStoredSettings();this._closed?(this._closed=!1,this._thumbDown(!0,!0)):this._adjustToSplitPosition();this.$node.style.visibility="visible";this.$mainNode.style.display="block";this.$sideNode.style.display=
"block";n.isIOS||n.isAndroid?(this.$node.addEventListener("touchstart",this._touchStart.bind(this),!1),this._thumb&&this._thumb.addEventListener("touchstart",this._touchStart.bind(this),!1),this.$node.addEventListener("touchmove",this._touchMove.bind(this),!1),this.$node.addEventListener("touchend",this._touchEnd.bind(this),!1)):(this.$node.addEventListener("mousedown",this._mouseDown.bind(this),!1),window.addEventListener("mouseup",this._mouseUp.bind(this),!1));window.addEventListener("resize",this._resize.bind(this),
!1)},isClosed:function(){return this._closed},getOrientation:function(){return this._vertical?"vertical":"horizontal"},setOrientation:function(d){d="vertical"===d;d!==this._vertical&&(this._vertical=d,d=this.$node.classList,d.toggle("splitLayout"),d.toggle("splitVerticalLayout"),this.$node.style.left="",this.$node.style.top="",d=this.$sideNode.classList,d.toggle("sidePanelLayout"),d.toggle("sidePanelVerticalLayout"),this.$sideNode.style.left="",this.$sideNode.style.top="",this.$sideNode.style.width=
"",this.$sideNode.style.height="",d=this.$mainNode.classList,d.toggle("mainPanelLayout"),d.toggle("mainPanelVerticalLayout"),this.$mainNode.style.left="",this.$mainNode.style.top="",this.$mainNode.style.width="",this.$mainNode.style.height="",this._thumb&&(d=this._thumb.classList,d.toggle("splitThumbLayout"),d.toggle("splitVerticalThumbLayout")),this._initializeFromStoredSettings(),this._closed?(this._closed=!1,this._thumbDown(!0,!0)):this._adjustToSplitPosition())},toggleSidePanel:function(){this._thumbDown()},
openSidePanel:function(){this._closed||this._thumbDown()},addResizeListener:function(d){this.addEventListener("resize",function(e){d(e.node)})},_initializeFromStoredSettings:function(){var d=localStorage.getItem(this._prefix+"/toggleState");this._closed="string"===typeof d?"closed"===d:this._closeByDefault;var d=k.bounds(this.$node.parentNode),e=k.bounds(this.$node),f;this._vertical?(f=localStorage.getItem(this._prefix+"/yPosition"))?(this._splitTop=parseInt(f,10),this._splitTop>d.top+d.height-e.height&&
(this._splitTop=d.top+d.height/2)):this._closeByDefault&&(this._initialSplit=this._getSplitPosition(),this._splitTop=0):(f=localStorage.getItem(this._prefix+"/xPosition"))?(this._splitLeft=parseInt(f,10),this._splitLeft>d.left+d.width-e.width&&(this._splitLeft=d.left+d.width/2)):this._closeByDefault&&(this._initialSplit=this._getSplitPosition(),this._splitLeft=0)},_getSplitPosition:function(){var d=k.bounds(this.$node),e=k.bounds(this.$node.parentNode);return this.vertical?d.top-e.top:d.left-e.left},
_adjustToSplitPosition:function(d){var e=k.bounds(this.$node),f=k.bounds(this.$node.parentNode);if(this._vertical){this._splitHeight=e.height;if(d||!this._splitTop)this._splitTop=e.top,localStorage.setItem(this._prefix+"/yPosition",this._splitTop);d=this._splitTop;d=this._splitTop-f.top;this.$sideNode.style.height=d+"px";this.$sideNode.style.display="block";this.$node.style.top=d+"px"}else{this._splitWidth=e.width;if(d||!this._splitLeft)this._splitLeft=e.left,localStorage.setItem(this._prefix+"/xPosition",
this._splitLeft);d=this._splitLeft;d=this._splitLeft-f.left;this.$sideNode.style.width=d+"px";this.$sideNode.style.display="block";this.$node.style.left=d+"px"}this._resize()},_resize:function(d,e,f){d=d||0;var b=k.bounds(this.$node.parentNode),a=k.bounds(this.$node);this._vertical?(void 0===f&&(f=a.top-b.top),f+=a.height,this.$mainNode.style.top=f+"px"):(void 0===e&&(e=a.left-b.left),e+=a.width,this.$mainNode.style.left=e+"px");var l=this;window.setTimeout(function(){l._notifyResizeListeners(l.$mainNode);
l._notifyResizeListeners(l.$sideNode)},d)},_notifyResizeListeners:function(d){this.dispatchEvent({type:"resize",node:d})},_notifyToggleListeners:function(){this.dispatchEvent({type:"toggle",closed:this._closed})},_thumbDown:function(d,e){d||this._addAnimation();var f=this._splitTop,b=this._splitLeft;if(this._closed)this._closed=!1,!this._splitLeft&&(!this._splitTop&&"number"===typeof this._initialSplit)&&(f=b=this._initialSplit);else if(this._closed=!0,this._closeReversely){var a=k.bounds(this.$node.parentNode),
l=k.bounds(this.$node);this._vertical?f=a.height-l.height:b=a.width-l.width}else f=b=0;this._vertical?(this.$sideNode.style.height=f+"px",this.$node.style.top=f+"px"):(this.$sideNode.style.width=b+"px",this.$node.style.left=b+"px");this._resize(this._animationDelay,b,f);d||this._removeAnimation();e||localStorage.setItem(this._prefix+"/toggleState",this._closed?"closed":null);var h=this;window.setTimeout(function(){h._notifyToggleListeners()},this._animationDelay)},_removeAnimation:function(){var d=
this;window.setTimeout(function(){d.$sideNode.classList.remove(d._vertical?"sidePanelVerticalLayoutAnimation":"sidePanelLayoutAnimation");d.$mainNode.classList.remove(d._vertical?"mainPanelVerticalLayoutAnimation":"mainPanelLayoutAnimation");d.$node.classList.remove(d._vertical?"splitVerticalLayoutAnimation":"splitLayoutAnimation")},this._animationDelay)},_addAnimation:function(){this.$sideNode.classList.add(this._vertical?"sidePanelVerticalLayoutAnimation":"sidePanelLayoutAnimation");this.$mainNode.classList.add(this._vertical?
"mainPanelVerticalLayoutAnimation":"mainPanelLayoutAnimation");this.$node.classList.add(this._vertical?"splitVerticalLayoutAnimation":"splitLayoutAnimation")},_down:function(){this.$node.classList.add("splitTracking");this.$mainNode.classList.add("panelTracking");this.$sideNode.classList.add("panelTracking")},_move:function(d,e){var f=k.bounds(this.$node.parentNode);if(this._vertical){this._splitTop=e;this._splitTop<f.top+5?this._splitTop=f.top+5:this._splitTop>f.top+f.height-5&&(this._splitTop=f.top+
f.height-5);var b=this._splitTop,b=this._splitTop-f.top;this.$node.style.top=b+"px"}else this._splitLeft=d,this._splitLeft<f.left+5?this._splitLeft=f.left+5:this._splitLeft>f.left+f.width-5&&(this._splitLeft=f.left+f.width-5),b=this._splitLeft,b=this._splitLeft-f.left,this.$node.style.left=b+"px";this._adjustToSplitPosition(!0)},_up:function(){this.$node.classList.remove("splitTracking");this.$mainNode.classList.remove("panelTracking");this.$sideNode.classList.remove("panelTracking")},_mouseDown:function(d){if(d.target===
this._thumb)return k.stop(d),this._thumbDown();this._tracking||(this._down(d),this._tracking=this._mouseMove.bind(this),window.addEventListener("mousemove",this._tracking),k.setFramesEnabled(!1),k.stop(d))},_mouseMove:function(d){this._tracking&&this._move(d.clientX,d.clientY)},_mouseUp:function(d){this._tracking&&(k.setFramesEnabled(!0),window.removeEventListener("mousemove",this._tracking),this._tracking=null,this._up(),k.stop(d))},_touchStart:function(d){if(1===d.touches.length){k.stop(d);if(d.target===
this._thumb)return this._thumbDown();this._down(d);this._touching=!0}},_touchMove:function(d){this._touching&&(d=d.touches,1===d.length&&(d=d[0],this._move(d.clientX,d.clientY)))},_touchEnd:function(d){0===d.touches.length&&(this._touching=!1,this._up())}};e.prototype.constructor=e;return{Splitter:e,ORIENTATION_HORIZONTAL:"horizontal",ORIENTATION_VERTICAL:"vertical"}});
define("orion/keyAssist",["i18n!orion/nls/messages","orion/webui/littlelib","orion/util"],function(m,n,k){function e(d){this.commandRegistry=d.commandRegistry;this.create();this._filterString="";this._providers=[]}e.prototype={addProvider:function(d){this._providers.push(d)},create:function(){var d=this._keyAssistDiv=document.createElement("div");d.id="keyAssist";d.style.display="none";d.classList.add("keyAssistFloat");d.setAttribute("role","menu");var e=this._keyAssistInput=document.createElement("input");
e.classList.add("keyAssistInput");e.type="text";e.placeholder=m["Filter bindings"];d.appendChild(e);var f=this._keyAssistContents=document.createElement("div");f.classList.add("keyAssistContents");if(k.isIOS||k.isAndroid)f.style.overflowY="auto";d.appendChild(f);var b=this._keyAssistTable=document.createElement("table");b.tabIndex=0;b.classList.add("keyAssistList");f.appendChild(b);document.body.appendChild(d);e.addEventListener("keydown",function(a){this._keyDown(a)}.bind(this));b.addEventListener("keydown",
function(a){this._keyDown(a)}.bind(this));e.addEventListener("input",function(a){this.filterChanged()}.bind(this));f.addEventListener(k.isFirefox?"DOMMouseScroll":"mousewheel",function(a){this._scrollWheel(a)}.bind(this));document.addEventListener("keydown",function(a){a.keyCode===n.KEY.ESCAPE&&this.hide()}.bind(this));n.addAutoDismiss([d],function(){this.hide()}.bind(this))},createContents:function(){n.empty(this._keyAssistTable);this._selectedIndex=-1;this._selectedRow=null;for(var d=this._idCount=
this._keyAssistContents.scrollTop=0;d<this._providers.length;d++)this._providers[d].showKeyBindings(this);this.createHeader(m.Global);this.commandRegistry.showKeyBindings(this)},createItem:function(d,e,f){if(this._filterString){var b=this._filterString.toLowerCase(),a;b!==this._filterString?(b=this._filterString,a=function(a){return a}):a=function(a){return a.toLowerCase()};if(-1===a(e).indexOf(b)&&-1===a(d).indexOf(b)&&-1===a(this._lastHeader).indexOf(b))return}var l=this._keyAssistTable.insertRow(-1);
l.id="keyAssist-keyBinding-"+this._idCount++;l.setAttribute("role","menuitem");l._execute=f;l.classList.add("keyAssistItem");l.addEventListener("click",function(a){this._selectedRow=l;this.execute();a.preventDefault()}.bind(this));f=l.insertCell(-1);f.classList.add("keyAssistName");f.appendChild(document.createTextNode(e));f=l.insertCell(-1);f.classList.add("keyAssistAccel");f.appendChild(document.createTextNode(d))},createHeader:function(d){this._lastHeader=d;var e=this._keyAssistTable.insertRow(-1);
e.classList.add("keyAssistSection");var e=e.insertCell(-1),f=document.createElement("h2");f.appendChild(document.createTextNode(d));e.appendChild(f)},execute:function(){window.setTimeout(function(){this.hide();var d=this._selectedRow;this._selectedRow=null;d&&d._execute&&d._execute()}.bind(this),0)},filterChanged:function(){this._timeout&&window.clearTimeout(this._timeout);this._timeout=window.setTimeout(function(){this._timeout=null;var d=this._keyAssistInput.value;this._filterString!==d&&(this._filterString=
d,this.createContents())}.bind(this),100)},hide:function(){if(this.isVisible()){var d=document.activeElement,e=this._keyAssistDiv,d=e===d||0!==(e.compareDocumentPosition(d)&16);e.style.display="none";d&&1!==document.compareDocumentPosition(this._previousActiveElement)&&this._previousActiveElement.focus();this._previousActiveElement=null}},isVisible:function(){return"block"===this._keyAssistDiv.style.display},removeProvider:function(d){d=this._providers.indexOf(d);-1!==d&&this._providers.splice(d,
1)},select:function(d){var e=this._keyAssistTable.querySelectorAll(".keyAssistItem");if(0===e.length)this._selectedIndex=-1;else{var f=this._selectedIndex,f=(f+(d?1:-1))%e.length;0>f&&(f=e.length-1);-1!==this._selectedIndex&&(d=e[this._selectedIndex],d.classList.remove("selected"),this._selectedRow=null);this._selectedIndex=f;if(-1!==this._selectedIndex){this._selectedRow=d=e[this._selectedIndex];d.classList.add("selected");this._keyAssistTable.setAttribute("aria-activedescendant",d.id);this._keyAssistTable.focus();
var e=d.getBoundingClientRect(),b=this._keyAssistContents,a=b.getBoundingClientRect();d.offsetTop<b.scrollTop?0===f?b.scrollTop=0:d.scrollIntoView(!0):e.bottom>a.bottom&&d.scrollIntoView(!1)}}},show:function(){this.isVisible()||(this._previousActiveElement=document.activeElement,this.createContents(),this._keyAssistContents.style.height=Math.floor(0.75*this._keyAssistDiv.parentNode.clientHeight)+"px",this._keyAssistDiv.style.display="block",this._keyAssistInput.value=this._filterString,this._keyAssistInput.focus(),
this._keyAssistInput.select())},_keyDown:function(d){if(40===d.keyCode)this.select(!0);else if(38===d.keyCode)this.select(!1);else if(13===d.keyCode)this.execute();else return;d.preventDefault()},_scrollWheel:function(d){var e=0,e=k.isIE||k.isOpera?-d.wheelDelta:k.isFirefox?40*d.detail:-d.wheelDeltaY,f=this._keyAssistContents,b=f.scrollTop;f.scrollTop+=e;if(b!==f.scrollTop)return d.preventDefault&&d.preventDefault(),!1}};return{KeyAssistPanel:e}});
define("orion/widgets/themes/ThemePreferences",[],function(){function m(m,k){this._preferences=m;this._themeData=k;var e=k.getThemeStorageInfo();this._themeVersion=e.version;var d=m.listenForChangedSettings(e.storage,2,function(e){e.key===d&&this.apply()}.bind(this))}m.prototype={_initialize:function(m,k,e){var d,g;void 0===this._themeVersion||e.get("version")===this._themeVersion?(d=e.get(m.styleset),(g=e.get("selected"))&&(g=JSON.parse(g))):g=d=null;d||(d=k.getStyles(),e.put(m.styleset,JSON.stringify(d)));
if(!g||void 0===g[m.selectedKey])g=g||{},g[m.selectedKey]=m.defaultTheme,e.put("selected",JSON.stringify(g));e.put("version",this._themeVersion)},apply:function(){this.setTheme()},getTheme:function(m){var k=this._themeData,e=k.getThemeStorageInfo();this._preferences.getPreferences(e.storage,2).then(function(d){this._initialize(e,k,d);var g=JSON.parse(d.get("selected"));d=JSON.parse(d.get(e.styleset));var f;if(d)for(var b=0;b<d.length;b++)if(d[b].name===g[e.selectedKey]){f=d[b];break}m({style:f,styles:d})}.bind(this))},
setTheme:function(m,k){var e=this._themeData,d=e.getThemeStorageInfo();this._preferences.getPreferences(d.storage,2).then(function(g){this._initialize(d,e,g);var f=JSON.parse(g.get("selected"));m||(m=f[d.selectedKey]);f[d.selectedKey]=m;g.put("selected",JSON.stringify(f));k?g.put(d.styleset,JSON.stringify(k)):k=JSON.parse(g.get(d.styleset));for(var b=0;b<k.length;b++)if(k[b].name===f[d.selectedKey]){e.processSettings(k[b]);break}g.put("version",this._themeVersion)}.bind(this))},setFontSize:function(m){var k=
this._themeData,e=k.getThemeStorageInfo();this._preferences.getPreferences(e.storage,2).then(function(d){this._initialize(e,k,d);var g=JSON.parse(d.get("selected")),f=JSON.parse(d.get(e.styleset)),b;if(f)for(var a=0;a<f.length;a++)f[a].fontSize=m,f[a].name===g[e.selectedKey]&&(b=f[a]);d.put(e.styleset,JSON.stringify(f));k.processSettings(b)}.bind(this))}};return{ThemePreferences:m}});
define("orion/settings/nls/root/messages",{"Plugin Description":"Plugin Description",Create:"Create","Loading...":"Loading...","Label:":"Label:",Title:"Title",Plugins:"Plugins","User Profile":"User Profile",Git:"Git","Git Settings":"Git Settings",General:"General",Navigation:"Navigation",Links:"Links","Open in same tab":"Open in same tab","Open in new tab":"Open in new tab",Font:"Font",Family:"Family","Sans Serif":"Sans Serif",Serif:"Serif",Size:"Size","8pt":"8pt","9pt":"9pt","10pt":"10pt","12pt":"12pt",
Color:"Color",Background:"Background",Strings:"Strings","String Types":"String Types",blue:"blue",Weight:"Weight",Normal:"Normal",Bold:"Bold",Comments:"Comments","Comment Types":"Comment Types",green:"green",Keywords:"Keywords","Keyword Types":"Keyword Types",darkred:"darkred",Categories:"Categories",Username:"Username","Full Name":"Full Name","Email Address":"Email Address","Email Confirmed":"Email Confirmed",Account:"Account","Current Password":"Current Password","New Password":"New Password","Verify Password":"Verify Password",
Password:"Password",OpenId:"OpenId",AOL:"AOL",Yahoo:"Yahoo",Google:"Google",Unlink:"Unlink",Link:"Link",Unlinked:"Unlinked",Linked:"Linked","Linked Accounts":"Linked Accounts","Git Email Address":"Git Email Address","Git Username":"Git Username","Git Credentials Storage":"Git Credentials Storage",Update:"Update","Update Profile Settings":"Update Profile Settings","Update Git User Settings":"Update Git User Settings","Update Git Credentials":"Update Git Credentials","User profile data successfully updated.":"User profile data successfully updated.",
"Git user data successfully updated.":"Git user data successfully updated.","Git Credentials successfully updated.":"Git Credentials successfully updated.","Edit Plugin JavaScript":"Edit Plugin JavaScript","Install Plugin":"Install Plugin","Plugin Name:":"Plugin Name:","Author Name:":"Author Name:","Licence:":"Licence:","Description:":"Description:","A plugin for Eclipse Orion":"A plugin for Eclipse Orion","Plugin Link":"Plugin Link",Install:"Install","Install a plugin by specifying its URL":"Install a plugin by specifying its URL",
"Plugin URL:":"Plugin URL:",Disable:"Disable",DisableTooltip:"Disable the plugin",Enable:"Enable",EnableTooltip:"Enable the plugin","Reload all":"Reload all","Reload all installed plugins":"Reload all installed plugins","Create a new Orion Plugin":"Create a new Orion Plugin","Find More Orion Plugins":"Find More Orion Plugins","Get Plugins":"Get Plugins",Reload:"Reload","Reload the plugin":"Reload the plugin",Delete:"Delete","Delete this plugin from the configuration":"Delete this plugin from the configuration",
DeleteUser:"Delete User Profile as well as workspaces and projects",DeleteUserComfirmation:"WARNING: This will permanently delete your user profile as well all your work!","Type a plugin url here ...":"Type a plugin url here ...","Installed ":"Installed ","Installing ":"Installing ","Already installed":"Already installed"," plugin":" plugin","Reloaded ":"Reloaded ","Uninstalled ":"Uninstalled ","Are you sure you want to uninstall '":"Are you sure you want to uninstall '",Services:"Services",Value:"Value",
"JavaScript Object":"JavaScript Object","click here, then check javascript console to drill down":"click here, then check javascript console to drill down",Item:"Item","Git Config":"Git Config","Clear Git Credentials":"Clear Git Credentials","Enable Storage":"Enable Storage","Please be aware that your credentials will be stored persistently in the browser.":"Please be aware that your credentials will be stored persistently in the browser.","Do you wish to enable the Key Storage?":"Do you wish to enable the Key Storage?",
general:"General",validation:"Validation","Deleted git credentials for ${0}":"Deleted git credentials for ${0}",Editor:"Editor",editorSettings:"Settings",EditorThemes:"Themes",Import:"Import","Import a theme":"Import a theme",Export:"Export","Export a theme":"Export a theme","Theme name:":"Theme name:",yourTheme:"yourTheme",fileManagement:"File Management",typing:"Typing",autoSave:"Auto Save",autoSaveTimeout:"Save interval (ms)",autoLoad:"Auto Load",saveDiffs:"Save file as diffs",trimTrailingWhiteSpace:"Trim Trailing Whitespace on Save",
Restore:"Restore Defaults",Default:"Default",keys:"Keys",tabs:"Tabs",tabSize:"Tab Size",expandTab:"Insert spaces for tabs",smoothScrolling:"Smooth Scrolling",scrollAnimation:"Scrolling Animation",scrollAnimationTimeout:"Scrolling Duration (ms)",keyBindings:"Key Bindings",rulers:"Rulers",annotationRuler:"Show Annotation Ruler",lineNumberRuler:"Show Line Number Ruler",foldingRuler:"Show Folding Ruler",overviewRuler:"Show Overview Ruler",whitespaces:"White Spaces",wrapping:"Wrapping",wordWrap:"Word Wrap",
showMargin:"Show Margin",marginOffset:"Margin Column",showTabs:"Show Tabs",showSpaces:"Show Spaces",autoSaveTimeoutInvalid:"Invalid save interval.",scrollAnimationTimeoutInvalid:"Invalid scrolling duration.",tabSizeInvalid:"Invalid tab size.",localSettingsTooltip:"Toggle whether this setting is shown in the local editor settings drop down.",editorSettingsInfo:"Use the ${0} and ${1} to toggle whether a given setting is shown in the local editor settings drop down ${2}.",autoPairParentheses:"Autopair (Parentheses)",
autoPairBraces:"Autopair {Braces}",autoPairSquareBrackets:"Autopair [Square] Brackets",autoPairAngleBrackets:"Autopair \x3cAngle\x3e Brackets",autoPairQuotations:'Autopair "Strings"',autoCompleteComments:"Autocomplete /** Block Comments */",smartIndentation:"Smart Indentation",sourceControl:"Source Control",showBlame:"Show Blame",languageTools:"Language Tools",showOccurrences:"Show Occurrences",contentAssistAutoTrigger:"Show Content Assist automatically","Editor preferences updated":"Editor preferences updated",
"Editor defaults restored":"Editor defaults restored",Theme:"Theme","Font Size":"Font Size","New Theme Name:":"New Theme Name:","Font Size:":"Font Size:","UI Theme":"UI Theme","Navigation Bar":"Navigation Bar","Navigation Text":"Navigation Text","Search Box":"Search Box","Tool Panel":"Tool Panel","Selection Bar":"Selection Bar",Location:"Location",Content:"Content","Main Panel":"Main Panel",Button:"Button","Button Text":"Button Text","Section Text":"Section Text","Side Panel":"Side Panel","Line Color":"Line Color",
"Line Numbers":"Line Numbers",Foreground:"Foreground","Current Line":"Current Line","HTML Attribute":"HTML Attribute","Overview Ruler":"Overview Ruler","HTML Tag":"HTML Tag","Annotation Ruler":"Annotation Ruler","Show Guide":"Show Guide","Check Guide":"Check Guide",Cancel:"Cancel","Revert Theme":"Revert Theme","Update Theme":"Update Theme","Theme:":"Theme:",clickDiagram:"Click diagram to style.",clickUpdate:"Click Update button to save preview.","CSS Class Name":"CSS Class Name","CSS Attribute":"CSS Attribute",
"CSS Value":"CSS Value","CSS Text":"CSS Text","COLOR:":"Color:","NEW COLOR:":"New Color:",Ok:"Ok","OR HEX:":"Or Hex: ",splitEditors:"Split Editors",splitOrientation:"Split Orientation",horizontal:"Horizontal",vertical:"Vertical"});define("orion/settings/nls/messages",["orion/i18n!orion/settings/nls/messages","orion/settings/nls/root/messages"],function(m,n){var k={root:n};Object.keys(m).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=m[e])});return k});
define("orion/editor/eventTarget",[],function(){function m(){}m.addMixin=function(n){var k=m.prototype,e;for(e in k)k.hasOwnProperty(e)&&(n[e]=k[e])};m.prototype={addEventListener:function(m,k,e){this._eventTypes||(this._eventTypes={});var d=this._eventTypes[m];d||(d=this._eventTypes[m]={level:0,listeners:[]});d.listeners.push({listener:k,useCapture:e})},dispatchEvent:function(m){var k=m.type;this._dispatchEvent("pre"+k,m);this._dispatchEvent(k,m);this._dispatchEvent("post"+k,m)},_dispatchEvent:function(m,
k){var e=this._eventTypes?this._eventTypes[m]:null;if(e){var d=e.listeners;try{if(e.level++,d)for(var g=0,f=d.length;g<f;g++)if(d[g]){var b=d[g].listener;"function"===typeof b?b.call(this,k):b.handleEvent&&"function"===typeof b.handleEvent&&b.handleEvent(k)}}finally{if(e.level--,e.compact&&0===e.level){for(g=d.length-1;0<=g;g--)d[g]||d.splice(g,1);0===d.length&&delete this._eventTypes[m];e.compact=!1}}}},isListening:function(m){return!this._eventTypes?!1:void 0!==this._eventTypes[m]},removeEventListener:function(m,
k,e){if(this._eventTypes){var d=this._eventTypes[m];if(d){for(var g=d.listeners,f=0,b=g.length;f<b;f++){var a=g[f];if(a&&a.listener===k&&a.useCapture===e){0!==d.level?(g[f]=null,d.compact=!0):g.splice(f,1);break}}0===g.length&&delete this._eventTypes[m]}}}};return{EventTarget:m}});
define("orion/editor/textTheme",["require","orion/editor/eventTarget","orion/util"],function(m,n,k){function e(d){d=d||{};this._document=d.document||document}var d={};e.getTheme=function(g){g=g||"default";var f=d[g];f||(f=d[g]=new e);return f};e.prototype={getThemeClass:function(){return this._themeClass},setThemeClass:function(d,f){var b=this,a=b._themeClass;b._themeClass=d;this._load(d,f,function(){b.onThemeChanged({type:"ThemeChanged",oldValue:a,newValue:b.getThemeClass()})})},onThemeChanged:function(d){return this.dispatchEvent(d)},
buildStyleSheet:function(d,f){function b(b,h,f){h&&(a.push("."+d+" ."+b+" {"),a.push("\t"+(f?"background-color":"color")+": "+h+";"),a.push("}"))}var a=[];a.push("");a.push("."+d+" {");f.fontFamily&&a.push("\tfont-family: "+f.fontFamily+";");f.fontSize&&a.push("\tfont-size: "+f.fontSize+";");f.fontSize&&a.push("\tcolor: "+f.text+";");a.push("}");a.push("."+d+".textview {");f.background&&a.push("\tbackground-color: "+f.background+";");a.push("}");a.push("."+d+" .textviewLeftRuler {");f.leftRuler&&
a.push("\tborder-right: 1px solid "+f.leftRuler+";");a.push("}");a.push("."+d+" .textviewRightRuler {");f.rightRuler&&a.push("\tborder-left: 1px solid "+f.rightRuler+";");a.push("}");b("ruler.annotations",f.annotationRuler,!0);b("ruler.lines",f.annotationRuler,!0);b("ruler.folding",f.annotationRuler,!0);b("ruler.overview",f.overviewRuler,!0);b("rulerLines",f.lineNumber,!1);b("rulerLines.even",f.lineNumberEven,!1);b("rulerLines.odd",f.lineNumberOdd,!1);b("annotationLine.currentLine",f.currentLine,
!0);b("entity-name-tag",f.keyword,!1);b("entity-other-attribute-name",f.attribute,!1);b("string-quoted",f.string,!1);b("meta.annotation.currentLine",f.currentLine,!0);b("keyword",f.keyword,!1);b("string",f.string,!1);b("constant",f.constant,!1);b("comment",f.comment,!1);b("comment.block.documentation",f.comment,!1);b("keyword.other.documentation.markup",f.comment,!1);b("keyword.other.documentation.markup",f.comment,!1);return a.join("\n")},_createStyle:function(d,f,b,a){var l=this._document;d="orion-theme-"+
d;var h=l.getElementById(d);if(h){if(a||h.firstChild.data===f)return;h.removeChild(h.firstChild);h.appendChild(l.createTextNode(f))}else a?(h=k.createElement(l,"link"),h.rel="stylesheet",h.type="text/css",h.href=f,h.addEventListener("load",function(){b()})):(h=k.createElement(l,"style"),h.appendChild(l.createTextNode(f))),h.id=d,(l.getElementsByTagName("head")[0]||l.documentElement).appendChild(h);a||b()},_load:function(d,f,b){if(d)if("string"===typeof f)this._createStyle(d,f,b);else if(f=f.href,
".css"!==f.substring(f.length-4)&&(f+=".css"),/^\//.test(f)||/[a-zA-Z0-9]+:\/\//i.test(f)||!m.toUrl)this._createStyle(d,f,b,!0);else{var a=this;m(["text!"+f],function(f){a._createStyle(d,f,b,!1)})}else b()}};n.EventTarget.addMixin(e.prototype);return{TextTheme:e}});
define("orion/widgets/themes/ThemeClass",[],function(){function m(m){this.attributes=[];this.element=document.createElement("div");this.style=this.element.style;this.className=m;this.classString="."+m+"{ "}m.prototype.className=null;m.prototype.classString=void 0;m.prototype.style=void 0;m.prototype.closeString=" }\n";m.prototype.toString=function(){return this.classString=this.classString+this.style.cssText+this.closeString};return{ThemeClass:m}});
define("orion/widgets/themes/container/ThemeSheetWriter",["orion/widgets/themes/ThemeClass"],function(m){function n(){}n.prototype.navbar="white";n.prototype.button="#777777";n.prototype.location="#EFEFEF";n.prototype.selection="#cedce7";n.prototype.sidepanel="#F7F7F7";n.prototype.mainpanel="white";n.prototype.navtext="#bfbfbf";n.prototype.content="#3087B3";n.prototype.search="#444";n.prototype.toolpanel="white";n.prototype.writeNavigationStyle=function(){var k="",e=[],d=new m.ThemeClass("orionPage");
d.style.backgroundColor="#fdfdfd";d.style.width="100%";d.style.height="100%";e.push(d);d=new m.ThemeClass("topRowBanner");d.style.margin="0";d.style.border="0";d.style.backgroundColor=this.navbar;d.style.height="16px";d.style.padding="10px";d.style.paddingLeft="6px";d.style.paddingRight="2px";d.style.borderBottom="none";d.style.boxShadow="0 2px 2px 0 rgba(0, 0, 0, 0.1),0 1px 0 0 rgba(0, 0, 0, 0.1)";d.style.zIndex="100";e.push(d);d=new m.ThemeClass("a");d.style.textDecoration="none";d.style.color=
this.content;e.push(d);d=new m.ThemeClass("navlink");d.style.display="inline-block";d.style.padding="2px";d.style.color=this.content;d.style.verticalAlign="bottom";e.push(d);d=new m.ThemeClass("primaryNav");d.style.color=this.navtext;d.style.fontSize="8pt";d.style.fontWeight="normal";d.style.paddingTop="0";d.style.verticalAlign="baseline";e.push(d);d=new m.ThemeClass("primaryNav a");d.style.fontSize="8pt";d.style.color=this.navtext;d.style.marginRight="6px";d.style.marginLeft="6px";d.style.verticalAlign=
"baseline";d.style.textDecoration="none";e.push(d);d=new m.ThemeClass("primaryNav a:hover");d.style.color="#bfbfbf";d.style.cursor="hand";d.style.color="white";d.style.fontWeight="normal";e.push(d);for(var g in e)k+=e[g].toString();return k};n.prototype.writeLocationStyle=function(){var k="",e=[],d=new m.ThemeClass("titleArea");d.style.margin="0";d.style.paddingTop="5px";d.style.border="0";d.style.background=this.location;d.style.background="-webkit-gradient(linear, left top, left bottom, color-stop(0%,"+
this.location+"), color-stop(100%,"+this.location+"))";d.style.borderBottom="1px solid "+this.location;d.style.minHeight="20px";e.push(d);d=new m.ThemeClass("breadcrumb");d.style.fontSize="8pt";d.style.textDecoration="none";d.style.color="#f1f1f2;";d.style.paddingTop="2px";e.push(d);d=new m.ThemeClass("a.breadcrumb:hover");d.style.textDecoration="none";d.style.borderBottom="1px dotted";d.style.color="#F58B0F";d.style.cursor="pointer";e.push(d);d=new m.ThemeClass("breadcrumbSeparator");d.style.fontSize=
"8pt";d.style.textDecoration="none";d.style.color=this.separator;d.style.fontWeight="bold";e.push(d);d=new m.ThemeClass("currentLocation");d.style.fontWeight="bold";d.style.fontSize="8pt";d.style.color=this.breadcrumb;d.style.textDecoration="none";d.style.textWrap="normal";d.style.lineHeight="10pt";e.push(d);d=new m.ThemeClass("a.currentLocation:hover");d.style.fontWeight="bold";d.style.fontSize="10pt";d.style.color="#666666";d.style.textDecoration="none";d.style.borderBottom="0";e.push(d);d=new m.ThemeClass("navlinkonpage");
d.style.color=this.content;d.style.verticalAlign="middle";e.push(d);this.bannerProgress&&(d=new m.ThemeClass("topRowBanner .progressPane_running"),d.style.borderColor=this.bannerProgress,e.push(d));for(var g in e)k+=e[g].toString();return k};n.prototype.writeButtonStyle=function(){var k="",e=[],d=new m.ThemeClass("commandButton");d.style.color="#666";d.style.border="1px solid #dedede";d.style.backgroundColor="#ddd";d.style.textAlign="center";d.style.verticalAlign="middle";d.style.cursor="pointer";
d.style.display="inline-block";d.style.padding="4px 6px";d.style.borderRadius="3px";d.style.lineHeight="12px";d.style.fontSize="9pt";d.style.userSelect="none";e.push(d);d=new m.ThemeClass("commandButton:over");d.style.backgroundColor="#e6e6e6";d.style.border="1px solid #808080";e.push(d);d=new m.ThemeClass("commandMenu");d.style.color="#222";d.style.display="inline-block";d.style.verticalAlign="baseline";d.style.margin="0";d.style.fontSize="8pt";d.style.fontWeight="normal";d.style.border="1px solid #dedede";
d.style.backgroundColor="#efefef";d.style.cursor="pointer";d.style.borderRadius="1px";e.push(d);d=new m.ThemeClass("commandMenuItem");d.style.border="0";d.style.padding="0";d.style.margin="0";e.push(d);for(var g in e)k+=e[g].toString();return k};n.prototype.writeMainStyle=function(){var k="",e=[],d=new m.ThemeClass("searchbox");d.style.backgroundImage="url(../images/core_sprites.png)";d.style.backgroundRepeat="no-repeat";d.style.backgroundPosition="4px -297px";d.style.width="12px";d.style.height=
"12px";d.style.backgroundColor=this.search;d.style.border="1px solid "+this.search;d.style.fontSize="11px";d.style.width="15em";d.style.height="16px";d.style.borderRadius="10px";d.style.color="#999";d.style.padding="0";d.style.paddingLeft="20px";d.style.marginLeft="5px";d.style.marginTop="6px !important";d.style.font="7pt Lucida Sans Unicode,Lucida Grande,Verdana,Arial,Helvetica,Myriad,Tahoma,clean,sans-serif !important";e.push(d);d=new m.ThemeClass("searchbox:focus");d.style.color="white";d.style.outline=
"none";e.push(d);d=new m.ThemeClass("checkedRow");d.style.cssText="background-color:"+this.selection+" !important;";e.push(d);d=new m.ThemeClass("navbar-item-selected");d.style.background=this.selection;d.style.color=this.content;e.push(d);d=new m.ThemeClass("auxpane");d.style.border="0";d.style.background=this.sidepanel;e.push(d);d=new m.ThemeClass("mainpane");d.style.background=this.mainpanel;d.style.border=0;e.push(d);d=new m.ThemeClass("mainToolbar");d.style.background=this.toolpanel;e.push(d);
for(var g in e)k+=e[g].toString();return k};n.prototype.render=function(k){console.log(this.writeNavigationStyle());console.log(this.writeLocationStyle());console.log(this.writeMainStyle());console.log(this.writeButtonStyle())};n.prototype.getSheet=function(k){k.navbar.value?(this.navbar=k.navbar.value,this.button=k.button.value,this.location=k.location.value,this.selection=k.selection.value,this.sidepanel=k.sidepanel.value,this.mainpanel=k.mainpanel.value,this.navtext=k.navtext.value,this.search=
k.search.value,this.content=k.content.value,this.toolpanel=k.toolpanel.value,this.bannerProgress=k.bannerProgress.value):(this.navbar=k.navbar,this.button=k.button,this.location=k.location,this.selection=k.selection,this.sidepanel=k.sidepanel,this.mainpanel=k.mainpanel,this.navtext=k.navtext,this.search=k.search,this.content=k.content,this.toolpanel=k.toolpanel,this.bannerProgress=k.bannerProgress);return this.writeNavigationStyle()+this.writeLocationStyle()+this.writeMainStyle()+this.writeButtonStyle()};
return{ThemeSheetWriter:n}});define("orion/widgets/themes/ThemeVersion",[],function(){return"6.1"});
define("orion/widgets/themes/container/ThemeData",["i18n!orion/settings/nls/messages","orion/editor/textTheme","orion/widgets/themes/container/ThemeSheetWriter","orion/widgets/themes/ThemeVersion"],function(m,n,k,e){function d(){}function g(){this.styles=[];var b=new d;b.name="Orion";b.navbar="white";b.button="#EFEFEF";b.location="#efefef";b.selection="FEC";b.sidepanel="#FBFBFB";b.mainpanel="white";b.toolpanel="white";b.navtext="#bfbfbf";b.content="#3087B3";b.search="#444";b.breadcrumb="#3087B3";
b.separator="#333";b.bannerProgress="whitesmoke";this.styles.push(b);b=new d;b.name="Orion2014";b.navbar="white";b.button="#EFEFEF";b.location="#EFEFEF";b.selection="FEC";b.sidepanel="#EEEEEE";b.mainpanel="#EEEEEE";b.toolpanel="#EEEEEE";b.navtext="#BFBFBF";b.content="#333333";b.search="#444444";b.breadcrumb="#333333";b.separator="#333333";b.bannerProgress="orange";this.styles.push(b);b=new d;b.name="Green Zone";b.navbar="seagreen";b.button="lavender";b.location="darkseagreen";b.selection="moccasin";
b.sidepanel="aliceblue";b.mainpanel="white";b.toolpanel="white";b.navtext="#FBFBFB";b.content="darkgreen";b.search="darkgreen";b.breadcrumb="#3087B3";b.separator="seagreen";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new d;b.name="Pretty In Pink";b.navbar="plum";b.button="lavender";b.location="pink";b.selection="lavender";b.sidepanel="seashell";b.mainpanel="white";b.toolpanel="white";b.navtext="#FBFBFB";b.content="mediumorchid";b.search="violet";b.breadcrumb="#3087B3";b.separator="plum";b.bannerProgress=
"#F2F2F2";this.styles.push(b);b=new d;b.name="Blue Monday";b.navbar="cornflowerblue";b.button="lavender";b.location="skyblue";b.selection="lavender";b.sidepanel="aliceblue";b.mainpanel="white";b.toolpanel="white";b.navtext="#FBFBFB";b.content="royalblue";b.search="royalblue";b.breadcrumb="#3087B3";b.separator="cornflowerblue";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new d;b.name="Vanilla Skies";b.navbar="sandybrown";b.button="lemmonchiffon";b.location="cornsilk";b.selection="lemonchiffon";
b.sidepanel="white";b.mainpanel="white";b.toolpanel="white";b.navtext="lemonchiffon";b.content="chocolate";b.search="moccasin";b.breadcrumb="#3087B3";b.separator="sandybrown";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new d;b.name="Beetlejuice";b.navbar="indigo";b.button="slateblue";b.location="darkslateblue";b.selection="silver";b.sidepanel="lavender";b.mainpanel="white";b.toolpanel="white";b.navtext="#FBFBFB";b.content="mediumslateblue";b.search="#444";b.breadcrumb="#3087B3";b.separator="indigo";
b.bannerProgress="#F2F2F2";this.styles.push(b);b=new d;b.name="Red";b.navbar="#CD2127";b.button="#777777";b.location="#D85F56";b.selection="lightcoral";b.sidepanel="#EFDAB2";b.mainpanel="#FDFADD";b.toolpanel="#FDFADD";b.navtext="#FBFBFB";b.content="darkred";b.search="#D85F56";b.breadcrumb="darkred";b.separator="#CD2127";b.bannerProgress="#F2F2F2";this.styles.push(b)}function f(){return this.styles}d.prototype.name="Orion";d.prototype.navbar="#404648";d.prototype.button="#EFEFEF";d.prototype.location=
"#333";d.prototype.breadcrumb="#3087B3";d.prototype.separator="#333";d.prototype.selection="FEC";d.prototype.sidepanel="#FBFBFB";d.prototype.mainpanel="white";d.prototype.toolpanel="white";d.prototype.navtext="#bfbfbf";d.prototype.content="#3087B3";d.prototype.search="#444";d.prototype.bannerProgress="white";g.prototype.styles=[];g.prototype.getStyles=f;g.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"styles",defaultTheme:"Orion2014",selectedKey:"selected",version:e}};
g.prototype.getViewData=function(){var b={top:10,left:10,width:350,height:350};b.shapes=[{type:"RECTANGLE",name:m["Navigation Bar"],x:10,y:10,width:350,height:32,family:"navbar",fill:"#333",order:1},{type:"TEXT",name:m["Navigation Text"],label:"UserName",x:290,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif"},{type:"ROUNDRECTANGLE",name:m["Search Box"],x:215,y:20,width:70,height:12,family:"search",fill:"#444",order:3},{type:"RECTANGLE",name:m["Tool Panel"],x:150,y:71,width:209,height:30,
family:"toolpanel",fill:"white",order:4},{type:"RECTANGLE",name:m["Selection Bar"],x:155,y:133,width:200,height:20,family:"selection",fill:"#FEC",order:7},{type:"RECTANGLE",name:m.Location,x:10,y:42,width:350,height:29,family:"location",fill:"#efefef",order:8},{type:"TEXT",name:m["Navigation Text"],label:"Navigator",x:60,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif",order:2},{type:"TEXT",name:m.Content,label:"Breadcrumb",x:15,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},
{type:"TEXT",name:m.Content,label:"/",x:78,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif",order:9},{type:"TEXT",name:m.Content,label:"Location",x:84,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},{type:"RECTANGLE",name:m["Main Panel"],x:150,y:101,width:209,height:258,family:"mainpanel",fill:"white",order:6},{type:"ROUNDRECTANGLE",name:m.Button,x:155,y:76,width:37,height:20,family:"button",fill:"#EFEFEF",order:11},{type:"TEXT",name:m["Button Text"],label:"Button",x:158,y:90,
family:"navbar",fill:"#333",font:"8pt sans-serif"},{type:"TRIANGLE",name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"},{type:"TEXT",name:m["Section Text"],label:"Section",x:30,y:94,family:"navbar",fill:"#333",font:"8pt sans-serif"},{type:"LINE",name:m["Line Color"],x1:150,y1:101,x2:360,y2:101,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:m["Line Color"],x1:150,
y1:71,x2:150,y2:360,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:m["Line Color"],x1:20,y1:100,x2:140,y2:100,linewidth:2,fill:"#DEDEDE"},{type:"RECTANGLE",name:m["Side Panel"],x:10,y:71,width:140,height:289,family:"sidepanel",fill:"#FBFBFB",order:12},{type:"TRIANGLE",name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"},{type:"TEXT",name:m["Navigation Text"],label:"Navigator",
x:60,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif",order:2},{type:"TRIANGLE",name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"}];for(var a=0;3>a;a++)b.shapes.push({type:"TEXT",name:m.Content,label:"org.eclipse.orion.content",x:170,y:127+20*a,fill:"#3087B3",family:"content"});for(a=0;3>a;a++)b.shapes.push({type:"TEXT",name:m.Content,label:"Item",
x:25,y:115+20*a,fill:"#3087B3",family:"content"});for(a=0;3>a;a++)b.shapes.push({type:"TRIANGLE",name:"twisty",x1:160,y1:121+20*a,x2:165,y2:124+20*a,x3:160,y3:127+20*a,family:"navbar",fill:"#333"});b.shapes.push({type:"IMAGE",name:"logo",x:15,y:18,source:"../../images/orion-transparent.png",family:"logo"});return b};g.prototype.processSettings=function(b){var a=new k.ThemeSheetWriter;(new n.TextTheme.getTheme("orionTheme")).setThemeClass("orionTheme",a.getSheet(b))};return{ThemeData:g,getStyles:f}});
define("orion/widgets/nls/root/messages",{"no input":"no input","no output":"no output","Choose a Folder":"Choose a Folder",OK:"OK",Profile:"Profile","Sign out":"Sign out","N/A":"N/A","logged in since ":"logged in since ","Sign in":"Sign in","Authentication required!":"Authentication required!","Name:":"Name:","Plug-ins":"Plug-ins"," \x3cNo available services or timed out, check URL and try reloading\x3e":" \x3cNo available services or timed out, check URL and try reloading\x3e",Properties:"Properties",
" (Service Id: ":" (Service Id: ",Services:"Services","SFTP Transfer":"SFTP Transfer","Remote host:":"Remote host:","Port:":"SFTP Port:","Remote path:":"Remote path:","User name:":"User name:","Password:":"Password:","Start Transfer":"Start Transfer","Location:":"Location:","orion.sftpConnections":"orion.sftpConnections","Drag a file here":"Drag a file here","unzip zips":"Unzip *.zip files","or if you prefer":"(or upload a file using the buttons below)",Upload:"Upload","Browse...":"Browse...","Import a file or zip":"Import a file or zip",
"Missing required argument: searchRenderer":"Missing required argument: searchRenderer","Missing required argument: favService":"Missing required argument: favService","Find File Named":"Find File Named","Type the name of a file to open (? \x3d any character, * \x3d any string):":"Type the name of a file to open (? \x3d any character, * \x3d any string):",Search:"Search","FileName FolderName":"FileName FolderName(Optional)","Searching...":"Searching...","Searching for occurrences of":'Searching for occurrences of: "${0}"',
name:"name","orion.widgets.UserMenu":"orion.widgets.UserMenu",test:"test","Sign Out":"Sign Out","Sign Out ":"Sign Out ","\x3c/a\x3e":"\x3c/a\x3e","\x3e":"\x3e","Sign In To ":"Sign In To ","Sign In":"Sign In",Help:"Help","Report a Bug":"Report a Bug","Keyboard Shortcuts":"Keyboard Shortcuts",Settings:"Settings","View profile of ":"View profile of ",Profiles:"Profiles","Information Needed":"Information Needed",Cancel:"Cancel","If the same file exists in both the source and destination:":"If the same file exists in both the source and destination:",
"Cancel the transfer":"Cancel the transfer","Always overwrite destination":"Always overwrite destination","Overwrite if source is newer":"Overwrite if source is newer",New:"New","Building file skeleton...":"Building file skeleton...",Add:"Add","Upload...":"Upload...","For a list of available commands type '${0}'.":"For a list of available commands type '${0}'.","Main Pages":"Main Pages","Related Links":"Related Links",Yes:"Yes",No:"No","Click or use delete key to delete the search term":"Click or use delete key to delete the search term"});
define("orion/widgets/nls/messages",["orion/i18n!orion/widgets/nls/messages","orion/widgets/nls/root/messages"],function(m,n){var k={root:n};Object.keys(m).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=m[e])});return k});
define("orion/widgets/userAssistance/UATaskPanel",["orion/webui/littlelib"],function(m){function n(k,e,d){this.elements=d;this.taskPanel=document.createElement("div");this.taskPanel.className="UAContainer";this.taskPanel.innerHTML='\x3cheader class\x3d"UAHeader"\x3eDevelop software from within the cloud\x3c/header\x3e';this.elementNode=document.createElement("div");this.switchesContainer=document.createElement("div");this.switches=document.createElement("span");this.radioButtons=[];this.elementNode.className=
"UAContainer-body";this.taskPanel.appendChild(this.elementNode);this.switchesContainer.className="UAContainer-switch-body";this.switches.className="UAContainer-switches";this.switchesContainer.innerHTML="";this.switchesContainer.appendChild(this.switches);this.taskPanel.appendChild(this.switchesContainer);!0===e?(this.container=document.createElement("div"),this.container.className="UAModal",this.container.appendChild(this.taskPanel),this.backdrop=document.createElement("div"),this.backdrop.className=
"UAModalBackground",document.body.appendChild(this.backdrop),document.body.appendChild(this.container),m.addAutoDismiss([this.container],this.destroy.bind(this))):k.appendChild(this.taskPanel);this.chosenSwitch=this.createSwitch(null,!0);this.chosenSwitch.firstChild.className="chosenCircle";this.initialize();this.elements.forEach(this.createSwitch.bind(this))}n.prototype.elementNode=null;n.prototype.switchesContainer=null;n.prototype.switches=null;n.prototype.radioButtons=null;n.prototype.chosenSwitch=
null;n.prototype.addElement=function(k){var e=document.createElement("span");e.className="UAContainer-icon";e.innerHTML='\x3cspan class\x3d"workingSpan"\x3e\x3cimg src\x3d"'+k.image+'" id\x3d"'+k.label+'ImageNode" alt\x3d"'+k.alt+'" height\x3d"64" width\x3d"64"\x3e\x3c/span\x3e\x3cspan class\x3d"UAIcon-label"\x3e\x3cspan class\x3d"UALabel" id\x3d"'+k.label+'LabelNode" \x3e'+k.label+"\x3c/span\x3e\x3c/span\x3e";e.onmouseover=function(){document.getElementById(k.label+"ImageNode").src=k.secondaryImage;
document.getElementById(k.label+"LabelNode").className="UALabel-live";e.className="UAContainer-icon-live"};e.onmouseout=function(){document.getElementById(k.label+"ImageNode").src=k.image;document.getElementById(k.label+"LabelNode").className="UALabel";e.className="UAContainer-icon"};var d=this;e.onclick=function(){d.showMedia(k)};this.elementNode.appendChild(e)};n.prototype.clearElements=function(){this.elementNode.innerHTML=""};n.prototype.showMedia=function(k){this.clearElements();this.addElement(k);
var e=document.createElement("span");e.className="UAContainer-media";e.innerHTML='\x3cdiv\x3e\x3c/div\x3e\x3cdiv\x3e\x3c/div\x3e\x3cspan class\x3d"mediaSpan"\x3e\x3cimg src\x3d"'+k.media+'" alt\x3d"'+k.alt+'" height\x3d"300" width\x3d"400"\x3e\x3c/span\x3e';this.elementNode.appendChild(e);setTimeout(function(){e.style.opacity=1},100);k=document.getElementById(k.label+"switch");this.chosenSwitch.firstChild.className="circle";this.chosenSwitch=k.parentNode;k.className="chosenCircle"};n.prototype.createSwitch=
function(k){var e;e=k?k.label+"switch":"indexSwitch";var d=document.createElement("span");d.className="workingSpan";d.innerHTML='\x3cdiv class\x3d"circle" id \x3d"'+e+'"\x3e\x3c/div\x3e';var g=this;d.onclick=k?function(){g.showMedia(k)}:function(){g.initialize();g.chosenSwitch.firstChild.className="circle";g.chosenSwitch=d;g.chosenSwitch.firstChild.className="chosenCircle"};this.switches.appendChild(d);return this.radioButtons[this.radioButtons.length]=d};n.prototype.initialize=function(){this.clearElements();
this.elements.forEach(this.addElement.bind(this))};n.prototype.destroy=function(){document.body.removeChild(this.backdrop);document.body.removeChild(this.container)};return n});
define("orion/webui/dialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/uiUtils"],function(m,n,k,e){function d(){}var g=null;d.prototype={DISABLED:"disabled",CONTAINERTEMPLATE:'\x3cdiv class\x3d"dialog" role\x3d"dialog"\x3e\x3cdiv class\x3d"dialogTitle"\x3e\x3cspan id\x3d"title" class\x3d"dialogTitleText layoutLeft"\x3e\x3c/span\x3e\x3cbutton aria-label\x3d"Close" class\x3d"dismissButton layoutRight core-sprite-close imageSprite" id\x3d"closeDialog"\x3e\x3c/button\x3e\x3c/div\x3e\x3cdiv id\x3d"dialogContent" class\x3d"dialogContent layoutBlock"\x3e\x3c/div\x3e\x3cdiv id\x3d"buttons" class\x3d"dialogButtons"\x3e\x3c/div\x3e\x3c/div\x3e',_initialize:function(){var d=
document.body;this.$frameParent=d;this.$$modalExclusions=this.$$modalExclusions||[];var b=document.createRange();b.selectNode(d);b=b.createContextualFragment(this.CONTAINERTEMPLATE);d.appendChild(b);this.$frame=d.lastChild;this.title&&k.$("#title",this.$frame).appendChild(document.createTextNode(this.title));this.$close=k.$("#closeDialog",this.$frame);var a=this;this.$close.addEventListener("click",function(b){a.hide()},!1);this.$parent=k.$(".dialogContent",this.$frame);b=document.createRange();b.selectNode(this.$parent);
d=b.createContextualFragment(this.TEMPLATE);this.messages&&k.processTextNodes(d,this.messages);this.$parent.appendChild(d);this.$buttonContainer=k.$(".dialogButtons",this.$frame);this._makeButtons();this.$frame.addEventListener("keydown",function(b){b.keyCode===k.KEY.ESCAPE?a.hide():b.keyCode===k.KEY.ENTER&&"function"===typeof a._defaultCallback&&a._defaultCallback()},!1);this._bindElements(this.$parent);"function"===typeof this._bindToDom&&this._bindToDom(this.$parent)},_makeButtons:function(){if(this.$buttonContainer&&
Array.isArray(this.buttons)){var d=this;this.buttons.forEach(function(b){var a=e.createButton(b.text,b.callback);b.id&&(a.id=b.id,d["$"+a.id]=a);b.isDefault&&(d._defaultCallback=b.callback,d._defaultButton=a);d.$buttonContainer.appendChild(a)})}},_makeModal:function(d){var b=this;this.$frame.addEventListener("blur",function(a){b.$lastFocusedElement=a.target},!0);this._modalListener=function(a){var d=!k.contains(b.$frame,a.target);if(d)for(var h=0;h<b.$$modalExclusions.length;h++)if(k.contains(b.$$modalExclusions[h],
a.target)){d=!1;break}d&&(window.setTimeout(function(){(b.$lastFocusedElement||b.$parent).focus()},0),k.stop(a))};this.$frameParent.addEventListener("focus",this._modalListener,!0);this.$frameParent.addEventListener("click",this._modalListener,!0);d=this.$frameParent.childNodes;var a=!1;this._addedBackdrop=[];for(var l=0;l<d.length;l++){for(var h=0;h<this.$$modalExclusions.length;h++)if(k.contains(this.$$modalExclusions[h],d[l])){a=!0;break}!a&&(d[l]!==b.$frame&&d[l].classList&&!d[l].classList.contains("tooltipContainer"))&&
(h=d[l],h.classList.contains("modalBackdrop")||(h.classList.add("modalBackdrop"),this._addedBackdrop.push(h)))}(d=k.lastTabbable(this.$buttonContainer)||k.lastTabbable(this.$parent))&&d.addEventListener("keydown",function(a){if(a.keyCode===k.KEY.TAB){var d=b._getFirstFocusField();d&&d!==a.target&&d.focus();k.stop(a)}},!1)},_addChildDialog:function(d){this.$$modalExclusions.push(d.$frame||d.$parent)},_inModalExclusion:function(d){return this.$$modalExclusions.some(function(b){return d.$frame===b||
d.$parent===b})},_bindElements:function(d){for(var b=0;b<d.childNodes.length;b++){var a=d.childNodes[b];a.id&&(this["$"+a.id]=a);this._bindElements(a)}},hide:function(d){!d&&g===this&&(g=null);"function"===typeof this._beforeHiding&&this._beforeHiding();this._modalListener&&(this.$frameParent.removeEventListener("focus",this._modalListener,!0),this.$frameParent.removeEventListener("click",this._modalListener,!0));this.$frame.classList.remove("dialogShowing");k.setFramesEnabled(!0);"function"===typeof this._afterHiding&&
this._afterHiding();var b=this;this.keepAlive||window.setTimeout(function(){b.destroy()},0)},show:function(d){if(this.modal)if(this._makeModal(),g){if(!g._inModalExclusion(this)){this.hide(!0);return}}else g=this;"function"===typeof this._beforeShowing&&this._beforeShowing();k.setFramesEnabled(!1);var b=k.bounds(this.$frame),a=k.bounds(document.documentElement),l;d?(l=k.bounds(d),d=l.top+l.height+4,l=l.left+4,d+b.height>a.height&&(d=Math.max(0,a.height-b.height-4)),l+b.width>a.width&&(l=Math.max(0,
a.width-b.width-4))):(l=Math.max(0,(a.width-b.width)/2),d=Math.max(0,(a.height-b.height)/2));this.$lastFocusedElement=document.activeElement;this.$frame.style.top=d+"px";this.$frame.style.left=l+"px";this.$frame.classList.add("dialogShowing");"function"===typeof this._afterShowing&&this._afterShowing();this.customFocus||this._getFirstFocusField().focus()},_getFirstFocusField:function(){return k.firstTabbable(this.$parent)||this._defaultButton||k.firstTabbable(this.$buttonContainer)||this.$close},
destroy:function(){this.$frame&&(g===this&&(g=null),k.setFramesEnabled(!0),this._addedBackdrop&&0<this._addedBackdrop.length&&this._addedBackdrop.forEach(function(d){d.classList.remove("modalBackdrop")}),this.$frameParent.removeEventListener("focus",this._modalListener,!0),this.$frameParent.removeEventListener("click",this._modalListener,!0),this.$frameParent.removeChild(this.$frame),this.$parent=this.$frame=void 0)}};d.prototype.constructor=d;return{Dialog:d}});
define("orion/widgets/UserMenu","i18n!orion/widgets/nls/messages require orion/webui/littlelib orion/PageLinks orion/widgets/userAssistance/UATaskPanel orion/webui/dialog orion/webui/dropdown".split(" "),function(m,n,k,e,d,g,f){function b(a){this._displaySignOut=!0;this._init(a)}b.prototype={_init:function(a){this._dropdownNode=k.node(a.dropdownNode);if(!this._dropdownNode)throw"no dom node for dropdown found";this._dropdown=a.dropdown;this._serviceRegistry=a.serviceRegistry;this.authenticatedServices=
{};this.unauthenticatedServices={};this._noSeparator=a.noSeparator;this._dropDownItemClass=a.dropDownItemClass;this._keyAssistClass=a.keyAssistClass;void 0!==a.signOut&&(this._displaySignOut=a.signOut)},isSingleService:function(){return 1===this.length(this.unauthenticatedServices)+this.length(this.authenticatedServices)},hasServices:function(){return 0<this.length(this.unauthenticatedServices)+this.length(this.authenticatedServices)},length:function(a){var b=0,d;for(d in a)a.hasOwnProperty(d)&&b++;
return b},_makeMenuItem:function(a,b){var d=f.createMenuItem(a).firstElementChild;"string"===typeof this._dropDownItemClass&&""!==this._dropDownItemClass&&d.classList.add(this._dropDownItemClass);d.addEventListener("click",b,!1);d.addEventListener("keydown",function(a){(a.keyCode===k.KEY.ENTER||a.keyCode===k.KEY.SPACE)&&b()},!1);return d},_renderAuthenticatedService:function(a,b){var d=this,f=this.authenticatedServices[a].authService;if(f&&f.logout&&this._displaySignOut){var e=this._makeMenuItem(m["Sign Out"],
function(){f.logout().then(function(){d.addUserItem(a,f,d.authenticatedServices[a].label);localStorage.removeItem(a);localStorage.removeItem("lastLogin");for(var b=localStorage.length-1;0<=b;b--){var l=localStorage.key(b);l&&0===l.indexOf("/orion/preferences/user")&&localStorage.removeItem(l)}f.getAuthForm(window.location.href).then(function(a){window.location=a})})});this._dropdownNode.appendChild(e.parentNode)}},renderServices:function(){function a(a){d[a]||(d[a]=b.createDocumentFragment());return d[a]}
var b=document,d=[],p=this._serviceRegistry;e.getPageLinksInfo(p,"orion.page.link.user").then(function(e){this._dropdown?this._dropdown.empty():this._dropdownNode&&k.empty(this._dropdownNode);e.getAllLinks().forEach(function(d){var h,f;if(d.category&&(f=/user\.(\d+)/.exec(d.category)))h=parseInt(f[1],10);if("number"!==typeof h||isNaN(h))h=1;h=a(h);f=b.createElement("li");var p=b.createElement("a");p.role="menuitem";"string"===typeof this._dropDownItemClass?""!==this._dropDownItemClass&&p.classList.add(this._dropDownItemClass):
p.classList.add("dropdownMenuItem");p.href=d.href;p.textContent=d.textContent;f.appendChild(p);h.appendChild(f);p.addEventListener("keydown",function(a){(a.keyCode===k.KEY.ENTER||a.keyCode===k.KEY.SPACE)&&p.click()},!1)}.bind(this));this.keyAssistFunction&&(e=this._makeMenuItem(m["Keyboard Shortcuts"],this.keyAssistFunction),"string"===typeof this._keyAssistClass?""!==this._keyAssistClass&&e.classList.add(this._keyAssistClass):e.classList.add("key-assist-menuitem"),e=e.parentNode,a(0).appendChild(e));
if(e=p.getServiceReferences("orion.page.getstarted")[0])e=e.getProperty("data"),e=this._makeMenuItem("Getting Started",this.getStartedDialog.bind(this,e)).parentNode,a(0).appendChild(e);var g=this;d.sort(function(a,b){return a-b}).forEach(function(a,b){if(b<d.length-1&&!this._noSeparator){var l=f.createSeparator();a.appendChild(l)}g._dropdownNode.appendChild(a)}.bind(this));if(this.isSingleService())for(var t in this.authenticatedServices)this.authenticatedServices.hasOwnProperty(t)&&this._renderAuthenticatedService(t,
0)}.bind(this))},getStartedDialog:function(a){new d(null,!0,a)},setKeyAssist:function(a){this.keyAssistFunction=a;this.renderServices()},addUserItem:function(a,b,d,f){f?(this.unauthenticatedServices[a]&&delete this.unauthenticatedServices[a],this.authenticatedServices[a]={authService:b,label:d,data:f}):(this.authenticatedServices[a]&&delete this.authenticatedServices[a],this.unauthenticatedServices[a]=this.unauthenticatedServices[a]?{authService:b,label:d,pending:this.unauthenticatedServices[a].pending}:
{authService:b,label:d});this.renderServices()}};b.prototype.constructor=b;return{UserMenu:b}});
define("orion/crawler/nls/root/messages",{"Searching file:":"Searching file:","is not supported in this file system":"is not supported in this file system","${0} files found out of ${1}":"${0} files found out of ${1}","The search term on this location will not use indexed files.":"The search term on this location will not use indexed files.","It will take longer time. Do you want to proceed?":"It will take longer time. Do you want to proceed?","Search cancelled by user":"Search cancelled by user",
Cancel:"Cancel"});define("orion/crawler/nls/messages",["orion/i18n!orion/crawler/nls/messages","orion/crawler/nls/root/messages"],function(m,n){var k={root:n};Object.keys(m).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=m[e])});return k});
define("orion/searchUtils","i18n!orion/nls/messages require orion/regex orion/commandRegistry orion/PageUtil orion/URITemplate".split(" "),function(m,n,k,e,d,g){function f(a,b,d){var f="";d&&(f="^");if(f=k.parse("/"+f+a.searchStr+"/"))d=f.pattern,f=f.flags,-1===f.indexOf("i")&&!b.caseSensitive&&(f+="i"),a.regExp={pattern:d,flags:f},a.wildCard=!0}var b={ALL_FILE_TYPE:"*.*",doSearch:function(a,d,h,f){a?(d=h,h=!0,"*"===d&&(d=""),""===d&&(h=f&&f.type!==b.ALL_FILE_TYPE),h&&(a=a.createSearchParams(d,!1,
!1,f),a=b.generateSearchHref(a),window.location=a)):window.alert(m["Can't search: no search service is available"])},generateSearchHelper:function(a,d){var h=a.keyword,p=h,e={};a.fileType&&(a.fileType!==b.ALL_FILE_TYPE&&""===h)&&(p="*."+a.fileType);if(a.regEx)e.searchStr=h,f(e,a,d);else{var g=-1<h.indexOf("*"),t=-1<h.indexOf("?");g&&(h=h.split("*").join(".*"));t&&(h=h.split("?").join("."));!g&&!t&&!a.nameSearch?(e.searchStr=a.caseSensitive?h.split("\\").join(""):h.split("\\").join("").toLowerCase(),
e.wildCard=!1):(e.searchStr=a.caseSensitive?h:h.toLowerCase(),f(e,a,d),e.wildCard=!0)}e.searchStrLength=e.searchStr.length;return{params:a,inFileQuery:e,displayedSearchTerm:p}},convertSearchParams:function(a){void 0!==a.rows&&(a.rows=parseInt(a.rows,10));void 0!==a.start&&(a.start=parseInt(a.start,10));"string"===typeof a.regEx&&(a.regEx="true"===a.regEx.toLowerCase());"string"===typeof a.caseSensitive&&(a.caseSensitive="true"===a.caseSensitive.toLowerCase());"string"===typeof a.nameSearch&&(a.nameSearch=
"true"===a.nameSearch.toLowerCase());void 0!==a.fileNamePatterns&&(a.fileNamePatterns=b.getFileNamePatternsArray(a.fileNamePatterns))},getFileNamePatternsArray:function(a){var b=void 0;a&&(a=a.trim(),a=a.replace(/^(\s*,\s*)+/g,""),a=a.replace(/([^\\]),(\s*,\s*)*/g,"$1/"),a=a.replace(/(\s*\/\s*)/g,"/"),a=a.replace(/\/\/+/g,"/"),a=a.replace(/\/+$/g,""),b=a.split("/"));return b},copySearchParams:function(a,b){var d={},f;for(f in a)if(void 0!==a[f]&&null!==a[f]&&(b||"replace"!==f))d[f]=a[f];return d},
generateSearchHref:function(a){var d=n.toUrl("search/search.html");a=b.copySearchParams(a,!0);var h=a.resource;a.resource=void 0;return"undefined"!==typeof a.keyword?(new g(d+"#{,resource,params*}")).expand({resource:h,params:a}):(new g(d+"#{,resource}")).expand({resource:h})},generateFindURLBinding:function(a,b,d,f,e){a={find:b.searchStr,regEx:b.wildCard?!0:void 0,caseSensitive:a.caseSensitive?!0:void 0,replaceWith:"string"===typeof f?f:void 0,atLine:"number"===typeof d?d:void 0};return e?a:","+
(new g("{,params*}")).expand({params:a})},convertFindURLBinding:function(a){"string"===typeof a.regEx&&(a.regEx="true"===a.regEx.toLowerCase());"string"===typeof a.caseSensitive&&(a.caseSensitive="true"===a.caseSensitive.toLowerCase());"string"===typeof a.atLine&&(a.atLine=parseInt(a.atLine,10))},replaceRegEx:function(a,b,d){return a.replace(RegExp(b.pattern,b.flags),d)},replaceStringLiteral:function(a,d,h){d=k.parse("/"+d+"/gim");return b.replaceRegEx(a,d,h)},searchOnelineLiteral:function(a,b,d){var f;
f=0;for(var e=!1,g=[];!(f=b.indexOf(a.searchStr,f),0>f);){g.push({startIndex:f,length:a.searchStrLength});e=!0;if(d)break;f+=a.searchStrLength}return e?g:null},findRegExp:function(a,b,d,f){if(!b)return null;d=d||"";d+=(-1===d.indexOf("g")?"g":"")+(-1===d.indexOf("m")?"m":"");var e=null;return(e=RegExp(b,d).exec(a.substring(f)))&&{startIndex:e.index+f,length:e[0].length}},searchOnelineRegEx:function(a,d,h){for(var f=0,e=!1,g=[];;)if(f=b.findRegExp(d,a.regExp.pattern,a.regExp.flags,f)){g.push(f);e=
!0;if(h)break;f=f.startIndex+f.length}else break;return e?g:null},generateNewContents:function(a,d,h,f,e,g){if(f&&d){a||(h.contents=[]);for(var t=0;t<d.length;t++){for(var k=d[t],m=!1,n=!1,v=[],z,A=0,B=0;B<f.children.length;B++)if(f.children[B].lineNumber-1===t){A=B;for(m=0;m<f.children[B].matches.length;m++)!1!==f.children[B+m].checked&&v.push(m);n=0<v.length;z=f.children[B].matches;m=!0;break}if(m){if(n){v=b.replaceCheckedMatches(k,e,z,v,g);k=v.replacedStr;for(m=0;m<f.children[A].matches.length;m++)f.children[A+
m].newMatches=v.newMatches}else for(m=0;m<f.children[A].matches.length;m++)f.children[A+m].newMatches=f.children[A+m].matches;a?h.contents[t]=k:h.contents.push(k)}else a||h.contents.push(k)}}},generateMatchContext:function(a,b,d){var f=[],e=2*a+1,g;b.length<=e?(g=0,a=b.length-1):(g=d-a,0>g?(g=0,a=g+e-1):(a=d+a,a>b.length-1&&(a=b.length-1,g=a-e+1)));for(e=g;e<=a;e++)f.push({context:b[e],current:e===d});return f},splitFile:function(a){for(var b=0,d=0,f=0,e=0,g=[];;){-1!==b&&b<=f&&(b=a.indexOf("\r",
f));-1!==d&&d<=f&&(d=a.indexOf("\n",f));if(-1===d&&-1===b){g.push(a.substring(e));break}var t=1;-1!==b&&-1!==d?b+1===d?(t=2,f=d+1):f=(b<d?b:d)+1:f=-1!==b?b+1:d+1;g.push(a.substring(e,f-t));e=f}return g},searchWithinFile:function(a,d,h,f,e,g){h=b.splitFile(h);e&&(d.contents=h);if(d){d.children=[];for(var t=f=0;t<h.length;t++){var k=h[t];if(k&&0<k.length){var m=g?k:k.toLowerCase();if(m=a.wildCard?b.searchOnelineRegEx(a,m):b.searchOnelineLiteral(a,m)){var n,v=t+1;if(e)for(var z=0;z<m.length;z++)n=z+
1,n={parent:d,checked:d.checked,type:"detail",matches:m,lineNumber:v,matchNumber:n,name:k,location:d.location+"-"+v+"-"+n},d.children.push(n);else n={parent:d,context:b.generateMatchContext(2,h,t),checked:d.checked,type:"detail",matches:m,lineNumber:v,name:k,location:d.location+"-"+v},d.children.push(n);f+=m.length}}}d.totalMatches=f}},replaceCheckedMatches:function(a,b,d,f,e){for(var g=0,t="",k=[],m=0;m<d.length;m++){g!==d[m].startIndex&&(t+=a.substring(g,d[m].startIndex));d[m].length&&(e=d[m].length);
for(var g=!1,n=0;n<f.length;n++)if(f[n]===m){g=!0;break}g?(k.push({startIndex:t.length,length:b.length}),t+=b):(k.push({startIndex:t.length,length:e}),t+=a.substring(d[m].startIndex,d[m].startIndex+e));g=d[m].startIndex+e}g<a.length&&(t+=a.substring(g));return{replacedStr:t,newMatches:k}},fullPathNameByMeta:function(a){var b=a.length,d="";if(0<b)for(b-=1;-1<b;b--)d=d+(""===d?"":"/")+a[b].Name;return d},path2FolderName:function(a,b,d){return a.substring(0,a.length-b.length-(d?0:1))},getOpenSearchPref:function(a,
b){a.getService("orion.core.preference").getPreferences("/cm/configurations").then(function(a){a=a.get("nav.config");b(a&&"undefined"!==a["links.newtab"]?a["links.newtab"]?!0:!1:!1)})},setOpenSearchPref:function(a,b){a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){a.put("openSearchPref",{openInNewTab:b})})}};return b});
define("orion/crawler/searchCrawler","i18n!orion/crawler/nls/messages require orion/i18nUtil orion/searchUtils orion/contentTypes orion/Deferred".split(" "),function(m,n,k,e,d,g){function f(b,a,d,f){this.registry=b;this.fileClient=a;this.fileLocations=[];this.fileSkeleton=[];this._totalCounter=this._hitCounter=0;this._searchOnName=f&&f.searchOnName;this._buildSkeletonOnly=f&&f.buildSkeletonOnly;this._fetchChildrenCallBack=f&&f.fetchChildrenCallBack;this._searchParams=d;this.searchHelper=this._searchOnName||
this._buildSkeletonOnly?null:e.generateSearchHelper(d);this._location=f&&f.location;this._childrenLocation=f&&f.childrenLocation?f.childrenLocation:this._location;this._reportOnCancel=f&&f.reportOnCancel;this._cancelled=!1;this._statusService=this.registry.getService("orion.page.message");this._progressService=this.registry.getService("orion.page.progress");this._statusService&&this._statusService.setCancelFunction(function(){this._cancelFileContentsSearch()}.bind(this))}f.prototype.search=function(b){var a=
this.registry.getService("orion.core.contentTypeRegistry");this._onSearchComplete=b;this._cancelled=!1;this._deferredArray=[];a.getContentTypes().then(function(a){this.contentTypesCache=a;var b=this;this._visitRecursively(this._childrenLocation).then(function(){(!b._cancelled||b._reportOnCancel)&&b._reportResult();b._cancelled&&b._HandleStatus({name:"Cancel"})}.bind(b),function(a){b._reportResult();b._HandleStatus(a)}.bind(b))}.bind(this))};f.prototype.searchName=function(b,a){b&&(this._searchParams=
b,this.searchHelper=e.generateSearchHelper(b,!0));a&&(this.onSearchNameComplete=a);var d=[];this._cancelled=!1;this._deferredArray=[];this._sort(this.fileSkeleton);if(0<this.fileSkeleton.length){for(var f=0;f<this.fileSkeleton.length;f++){var p=this.fileSkeleton[f].Name.toLowerCase();if(this.searchHelper.inFileQuery.wildCard?e.searchOnelineRegEx(this.searchHelper.inFileQuery,p,!0):e.searchOnelineLiteral(this.searchHelper.inFileQuery,p,!0))if(d.push(this.fileSkeleton[f]),d.length>=this.searchHelper.params.rows)break}this.onSearchNameComplete({response:{numFound:d.length,
docs:d}})}else this.onSearchNameComplete({response:{numFound:0,docs:[]}})};f.prototype.buildSkeleton=function(b,a){this._buildingSkeleton=!0;var d=this.registry.getService("orion.core.contentTypeRegistry");this._cancelled=!1;this._deferredArray=[];var f=this;b();d.getContentTypes().then(function(b){f.contentTypesCache=b;f._visitRecursively(f._childrenLocation).then(function(){f._buildingSkeleton=!1;a();f.searchHelper&&!f._buildSkeletonOnly&&f.searchName()})})};f.prototype._sort=function(b){b.sort(function(a,
b){var d,f;if("Path asc"===this._searchParams.sort){d=a.Location&&a.Location.toLowerCase();d=e.path2FolderName(d,a.Name&&a.Name.toLowerCase(),!0);f=b.Location&&b.Location.toLowerCase();f=e.path2FolderName(f,b.Name&&b.Name.toLowerCase(),!0);if(d<f)return-1;if(d>f)return 1}return this._sortOnNameSingle(a,b)}.bind(this))};f.prototype._HandleStatus=function(b){this._statusService&&"Cancel"===b.name&&(console.log("Crawling search cancelled. Deferred array length : "+this._deferredArray.length),this._statusService.setProgressResult({Message:m["Search cancelled by user"],
Severity:"Warning"}))};f.prototype._reportResult=function(){this._sort(this.fileLocations);this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}})};f.prototype._sortOnNameSingle=function(b,a){var d=b.Name&&b.Name.toLowerCase(),f=a.Name&&a.Name.toLowerCase();return d<f?-1:d>f?1:0};f.prototype._fileNameMatches=function(b){var a=!0;this.searchHelper.params.fileNamePatterns&&(a=this.searchHelper.params.fileNamePatterns.some(function(a){a="^"+a.replace(/([*?])/g,
".$1")+"$";return b.match(a)}));return a};f.prototype._visitRecursively=function(b){var a=[],f=this;this._fetchChildrenCallBack&&this._fetchChildrenCallBack(b);return(f._progressService?this._progressService.progress(f.fileClient.fetchChildren(b),"Crawling search for children of "+b):f.fileClient.fetchChildren(b)).then(function(b){for(var e=0;e<b.length;e++)if(void 0!==b[e].Directory&&!1===b[e].Directory)if(f._searchOnName)a.push(f._buildSingleSkeleton(b[e]));else if(f._buildSkeletonOnly)a.push(f._buildSingleSkeleton(b[e]));
else{if(!f._cancelled){var q=d.getFilenameContentType(b[e].Name,f.contentTypesCache);if(q&&("text/plain"===q["extends"]||"text/plain"===q.id)&&f._fileNameMatches(b[e].Name))q=f._sniffSearch(b[e]),a.push(q),f._deferredArray.push(q)}}else if(b[e].Location)if(f._cancelled)break;else q=f._visitRecursively(b[e].ChildrenLocation),a.push(q),f._deferredArray.push(q);return g.all(a)})};f.prototype._hitOnceWithinFile=function(b){b=this._searchParams.caseSensitive?b:b.toLowerCase();return this.searchHelper.inFileQuery.wildCard?
e.searchOnelineRegEx(this.searchHelper.inFileQuery,b,!0):e.searchOnelineLiteral(this.searchHelper.inFileQuery,b,!0)};f.prototype._reportSingleHit=function(b){this._cancelled||(b.LastModified=b.LocalTimeStamp,this.fileLocations.push(b),this._hitCounter++,this._sort(this.fileLocations),this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}},!0))};f.prototype._cancelFileContentsSearch=function(){(this._cancelled=!0)&&this._deferredArray.forEach(function(b){b.cancel()})};
f.prototype._sniffSearch=function(b){this._totalCounter++;var a=this;if(!this._cancelled)if(""===this.searchHelper.params.keyword)this._reportSingleHit(b),this._statusService&&this._statusService.setProgressResult({Message:k.formatMessage(m["${0} files found out of ${1}"],this._hitCounter,this._totalCounter)});else return(a._progressService?a._progressService.progress(a.fileClient.read(b.Location),"Reading file "+b.Location):a.fileClient.read(b.Location)).then(function(d){a._hitOnceWithinFile(d)&&
a._reportSingleHit(b);a._statusService&&a._statusService.setProgressResult({Message:k.formatMessage(m["${0} files found out of ${1}"],a._hitCounter,a._totalCounter)},m.Cancel)},function(a){a&&(a.message&&"cancel"!==a.message.toLowerCase())&&console.error("Error loading file content: "+a.message)})};f.prototype._buildSingleSkeleton=function(b){this._totalCounter++;this.fileSkeleton.push(b);this.searchHelper&&(!this._buildSkeletonOnly&&0===this._totalCounter%100)&&this.searchName();b=new g;b.resolve(this._totalCounter);
return b};f.prototype.constructor=f;return{SearchCrawler:f}});
define("orion/webui/dialogs/OpenResourceDialog","i18n!orion/widgets/nls/messages orion/crawler/searchCrawler orion/contentTypes require orion/webui/littlelib orion/util orion/webui/dialog".split(" "),function(m,n,k,e,d,g,f){function b(a){this._init(a)}b.prototype=new f.Dialog;b.prototype.TEMPLATE='\x3cdiv role\x3d"search"\x3e\x3cdiv\x3e\x3clabel id\x3d"fileNameMessage" for\x3d"fileName"\x3e${Type the name of a file to open (? \x3d any character, * \x3d any string):}\x3c/label\x3e\x3c/div\x3e\x3cdiv\x3e\x3cinput id\x3d"fileName" type\x3d"text" class\x3d"setting-control" style\x3d"width:90%;"/\x3e\x3c/div\x3e\x3cdiv id\x3d"progress" style\x3d"padding: 2px 0 0; width: 100%;"\x3e\x3cimg src\x3d"'+e.toUrl("../../../images/progress_running.gif")+
'" class\x3d"progressPane_running_dialog" id\x3d"crawlingProgress"\x3e\x3c/img\x3e\x3c/div\x3e\x3cdiv id\x3d"results" style\x3d"max-height:250px; height:auto; overflow-y:auto;" aria-live\x3d"off"\x3e\x3c/div\x3e\x3cdiv id\x3d"statusbar"\x3e\x3c/div\x3e\x3c/div\x3e';b.prototype._init=function(a){this.title=a.title||m["Find File Named"];this.modal=!0;this.messages=m;this._searcher=a.searcher;this._progress=a.progress;this._onHide=a.onHide;this._contentTypeService=new k.ContentTypeRegistry(this._searcher.registry);
if(!this._searcher)throw Error("Missing required argument: searcher");this._searchDelay=a.searchDelay||500;this._time=0;this._searcher.setCrawler(null);this._forceUseCrawler=!1;this._initialText=a.initialText;this._message=a.message;this._nameSearch=!0;void 0!==a.nameSearch&&(this._nameSearch=a.nameSearch);this._searchOnRoot=!0;this._fileService=this._searcher.getFileService();if(!this._fileService)throw Error(m["Missing required argument: fileService"]);this._searchRenderer=a.searchRenderer;if(!this._searchRenderer||
"function"!==typeof this._searchRenderer.makeRenderFunction)throw Error(m["Missing required argument: searchRenderer"]);this._initialize()};b.prototype._bindToDom=function(a){var b=this;b.$crawlingProgress.style.display="none";this._nameSearch?this.$fileName.setAttribute("placeholder",m["FileName FolderName"]):this.$fileName.setAttribute("placeholder",m.Search);this.$fileName.addEventListener("input",function(a){b._time=+new Date;b._timeoutId&&clearTimeout(b._timeoutId);b._timeoutId=setTimeout(b.checkSearch.bind(b),
0)},!1);this.$fileName.addEventListener("keydown",function(a){if(a.keyCode===d.KEY.ENTER){var f=d.$("a",b.$results);f&&(d.stop(a),(g.isMac?a.metaKey:a.ctrlKey)?window.open(f.href):(window.location.href=f.href,b.hide()))}},!1);a.addEventListener("keydown",function(a){var f,e,g;if(a.keyCode===d.KEY.DOWN||a.keyCode===d.KEY.UP)f=d.$$array("a",b.$results),e=document.activeElement,g=f.indexOf(e),a.keyCode===d.KEY.DOWN?0<=g?(e.classList.remove("treeIterationCursor"),f=g<f.length-1?f[g+1]:f[0],f.focus(),
f.classList.add("treeIterationCursor")):0<f.length&&(f=f[0],f.focus(),f.classList.add("treeIterationCursor")):0<=g?(e.classList.remove("treeIterationCursor"),e=b.$fileName,f=0<g?f[g-1]:e,f.focus(),0<g&&f.classList.add("treeIterationCursor")):0<f.length&&(f[f.length-1].focus(),f[f.length-1].classList.add("treeIterationCursor")),d.stop(a)});a.addEventListener("mouseup",function(a){a.target.focus()},!1);setTimeout(function(){if(b._forceUseCrawler||!b._fileService.getService(b._searcher.getSearchLocation()).search){var a=
b._searchOnRoot?b._searcher.getSearchRootLocation():b._searcher.getChildrenLocation(),a=new n.SearchCrawler(b._searcher.registry,b._fileService,"",{searchOnName:!0,location:a});b._searcher.setCrawler(a);a.buildSkeleton(function(){b.$crawlingProgress.style.display="inline";b.$progress.appendChild(document.createTextNode(m["Building file skeleton..."]))},function(){b.$crawlingProgress.style.display="none";b.$progress.removeChild(b.$progress.lastChild)})}},0);this._message&&(this.$fileNameMessage.removeChild(this.$fileNameMessage.firstChild),
this.$fileNameMessage.appendChild(document.createTextNode(this._message)));this._initialText&&(this.$fileName.value=this._initialText,this.doSearch())};b.prototype.checkSearch=function(){clearTimeout(this._timeoutId);var a=(new Date).getTime();a-this._time>this._searchDelay?(this._time=a,this.doSearch()):this._timeoutId=setTimeout(this.checkSearch.bind(this),50)};b.prototype._detectFolderKeyword=function(a){var b,d=a,f=null;if(this._nameSearch&&(b=/(\S+)\s*(.*)/,(a=b.exec(a))&&3===a.length))a[1]&&
(d=a[1]),a[2]&&(f=a[2]);return{keyword:d,folderKeyword:f}};b.prototype.doSearch=function(){var a=this.$fileName.value;if(a){var b=this._detectFolderKeyword(a),f=this._searcher.createSearchParams(b.keyword,this._nameSearch,this._searchOnRoot),e=this._searchRenderer.makeRenderFunction(this._contentTypeService,this.$results,!1,this.decorateResult.bind(this));this.currentSearch=e;var q=document.createElement("div");q.appendChild(document.createTextNode(this._nameSearch?m["Searching..."]:g.formatMessage(m["Searching for occurrences of"],
a)));d.empty(this.$results);this.$results.appendChild(q);this._searcher.search(f,b.folderKeyword,function(){e===this.currentSearch&&e.apply(null,arguments)}.bind(this))}};b.prototype.decorateResult=function(a){function b(a){0===a.button&&(!a.ctrlKey&&!a.metaKey)&&f.hide()}var f=this;a=d.$$array("a",a);for(var e=0;e<a.length;e++)a[e].addEventListener("click",b,!1)};b.prototype._beforeHiding=function(){clearTimeout(this._timeoutId)};b.prototype._afterHiding=function(){this._onHide&&this._onHide()};
b.prototype.constructor=b;return{OpenResourceDialog:b}});define("text!orion/banner/banner.html",[],function(){return'\x3cheader id\x3d"banner" role\x3d"banner"\x3e\n\t\x3c!-- Requires some js code to bind the home link, link to progress image, and binding NLS variables  --\x3e\n\n\t\x3cdiv id\x3d"staticBanner" class\x3d"layoutBlock topRowBanner"\x3e \x3c!-- primaryNav --\x3e\n\t\t\x3cdiv id\x3d"centralNavigationArea" style\x3d"position:absolute;left:0;top:0;width:39px;height:36px; z-index:1;border-right:1px solid #ddd;"\x3e\x3c/div\x3e\n\n\t\t\x3c!-- Static "Home" link. TODO delete this --\x3e\n\t\t\x3ca id\x3d"home" class\x3d"layoutLeft "\x3e\x3c/a\x3e\n\n\t\t\x3c!-- Left banner component: hamburger --\x3e\n\t\t\x3cnav id\x3d"primaryNav" class\x3d"bannerLeftArea" style\x3d"z-index:2;" role\x3d"navigation"\x3e\n\t\t\t\t\x3cbutton class\x3d"centralNavigation commandSprite core-sprite-hamburger" type\x3d"button"id\x3d"centralNavigation"\x3e\x3c/button\x3e\n\t\t\x3c/nav\x3e\n\n\t\t\x3c!-- Middle banner component: Breadcrumb bar --\x3e\n\t\t\x3cdiv class\x3d"clear navigationBreadcrumb bannerMiddleArea" \x3e\n\t\t\t\x3cdiv id\x3d"location" class\x3d"currentLocation"\x3e\x3c/div\x3e\n\t\t\x3c/div\x3e\n\n\t\t\x3c!-- Right banner component: user identity --\x3e\n\t\t\x3cdiv class\x3d"bannerRightArea" style\x3d"z-index:2;"\x3e\n\t\t\t\x3c!-- Global commands support. --\x3e\n\t\t\t\x3cdiv id\x3d"globalActions" class\x3d"spacingLeft layoutLeft"\x3e\x3c/div\x3e\n\n\t\t\t\x3c!-- Search. TODO delete this --\x3e\n\t\t\t\x3cinput type\x3d"text" id\x3d"search" autocomplete\x3d"off" class\x3d"layoutLeft spacingLeft searchbox" role\x3d"search" style\x3d"display:none;"\x3e\n\t\t\t\x3cdiv id\x3d"searchOptions" class\x3d"layoutLeft" style\x3d"padding-top:1px;display:none;"\x3e\x3c/div\x3e\n\n\t\t\t\x3c!-- User identity menu and Progress --\x3e\n\t\t\t\x3cdiv id\x3d"userMenu" class\x3d"spacingRight layoutRight" style\x3d"color:#ccc;line-height:16px;"\x3e\n\t\t\t\t\x3cdiv id\x3d"progressPane" class\x3d"progressWatch" tabindex\x3d"0" role\x3d"progressbar"\x3e\n\t\t\t\t\t\x3cdiv id\x3d"watchButton" class\x3d"watchButton"\x3e\x3c/div\x3e\n\t\t\t\t\t\x3cdiv id\x3d"watchBody" class\x3d"watchBody"\x3e\n\t\t\t\t\t\t\x3cspan class\x3d"hand longMinute"\x3e\n\t\t\t\t\t\t\t\x3cspan class\x3d"darkSide"\x3e\x3c/span\x3e\n\t\t\t\t\t\t\x3c/span\x3e\n\t\t\t\t\t\t\x3cspan class\x3d"hand longHour"\x3e\n\t\t\t\t\t\t\t\x3cspan class\x3d"darkSide"\x3e\x3c/span\x3e\n\t\t\t\t\t\t\x3c/span\x3e\n\t\t\t\t\t\x3c/div\x3e\n\t\t\t\t\x3c/div\x3e\n\t\t\t\t\n\t\t\t\t\x3cdiv style\x3d"position: absolute;right: 0px;top:0;width: 39px;height:36px; z-index:-50;border-left: 1px solid #ddd;"\x3e\x3c/div\x3e\n\t\t\t\t\x3cspan id\x3d"userTrigger" tabindex\x3d"0" role\x3d"button" class\x3d"dropdownTrigger" style\x3d"z-index:2;"\x3e\n\t\t\t\t\x3c/span\x3e\n\t\t\t\t\x3cul id\x3d"userDropdown" class\x3d"dropdownMenu" role\x3d"menu"\x3e\x3c/ul\x3e\n\t\t\t\x3c/div\x3e\n\t\t\x3c/div\x3e\n\t\x3c/div\x3e\n\n\t\x3c!-- IDE notification messages go in here --\x3e\n\t\x3cdiv id\x3d"notificationArea" class\x3d"notificationHide"\x3e\n\t\t\x3cdiv class\x3d"layoutLeft" id\x3d"notifications" aria-live\x3d"assertive" aria-atomic\x3d"true"\x3e\x3c/div\x3e\n\t\t\x3cdiv class\x3d"layoutRight"\x3e\x3cbutton aria-label\x3d"Close" class\x3d"dismissButton layoutRight core-sprite-close imageSprite" type\x3d"button" id\x3d"closeNotifications"\x3e\x3c/span\x3e\x3c/div\x3e\n\t\x3c/div\x3e\n\x3c/header\x3e'});
define("text!orion/banner/footer.html",[],function(){return'\x3c!--\n\x3cfooter id\x3d"footerContent" class\x3d"layoutBlock footerLayout" role\x3d"contentinfo"\x3e\n\t\x3cdiv class\x3d"logoFooter commandSprite core-sprite-orion-logo"\x3e\x3c/div\x3e\n\t\x3cdiv class\x3d"footerBlock"\x3e${Orion is in Beta. Please try it out but BEWARE your data may be lost.}\x3c/div\x3e\n\t\x3cdiv class\x3d"footerRightBlock"\x3e\n\t\t\x3cul\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"https://bugs.eclipse.org/bugs/enter_bug.cgi?product\x3dOrion\x26version\x3d5.0" target\x3d"_blank"\x3e${Report a Bug}\x3c/a\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"http://www.eclipse.org/legal/privacy.php" target\x3d"_blank"\x3e${Privacy Policy}\x3c/a\x3e\x3c/li\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"http://www.eclipse.org/legal/termsofuse.php" target\x3d"_blank"\x3e${Terms of Use}\x3c/a\x3e\x3c/li\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"http://www.eclipse.org/legal/copyright.php" target\x3d"_blank"\x3e${Copyright Agent}\x3c/a\x3e\x3c/li\x3e\n\t\t\x3c/ul\x3e\n\t\x3c/div\x3e\n\x3c/footer\x3e\n--\x3e'});
define("text!orion/banner/toolbar.html",[],function(){return'\x3cul class\x3d"layoutLeft commandList pageActions" id\x3d"pageActions"\x3e\x3c/ul\x3e\n\x3cul class\x3d"layoutLeft commandList pageActions" id\x3d"selectionTools"\x3e\x3c/ul\x3e\n\x3cul class\x3d"layoutLeft commandList pageActions" id\x3d"navActions"\x3e\x3c/ul\x3e\n\x3cdiv class\x3d"layoutLeft" style\x3d"padding-left:7px;padding-right:7px;margin-top:2px;" id\x3d"filterBox" style\x3d"visibility: hidden;"\x3e\x3c/div\x3e\n\x3cul class\x3d"layoutRight commandList pageActions" id\x3d"settingsActions"\x3e\x3c/ul\x3e\n\x3cdiv class\x3d"layoutRight status" id\x3d"statusPane" role\x3d"status" aria-live\x3d"off"\x3e\x3c/div\x3e\n\x3cul class\x3d"layoutRight commandList pageActions" id\x3d"pageNavigationActions"\x3e\x3c/ul\x3e'});
define("orion/widgets/input/DropDownMenu",["orion/objects","orion/webui/littlelib"],function(m,n){function k(e,d,g){if(e=n.node(e))this._parent=e;else throw Error("Parent node of dropdown menu not found");this.options=g=g||{};this.navDropDownId=this._parent.id+"_navdropdown";this.selectionClass=g.selectionClass;e=document.createElement("div");e.classList.add("dropdownMenu");e.classList.add("dropdownMenuOpen");e.id=this.navDropDownId;e.style.display="none";this._parent.appendChild(e);this._dropdownMenu=
e;if(d=n.node(d))this._triggerNode=d;else throw"Trigger node of dropdown menu not found";"hidden"===this._triggerNode.style.visibility&&(this._triggerNode.style.visibility="visible");g.noClick||(this._triggerNode.onclick=this.click.bind(this));this._dropdownMenu.addEventListener("keydown",function(d){d.keyCode===n.KEY.ESCAPE&&this.clearPanel()}.bind(this))}m.mixin(k.prototype,{click:function(){"none"===this._dropdownMenu.style.display?this.updateContent(this.getContentNode(),function(){n.setFramesEnabled(!1);
this._dropdownMenu.style.display="";this._positionDropdown();this.selectionClass&&this._triggerNode.classList.add(this.selectionClass);this.handle=n.addAutoDismiss([this._triggerNode,this._dropdownMenu],this.clearPanel.bind(this));if(this.options.onShow)this.options.onShow()}.bind(this)):this.clearPanel()},clearPanel:function(){if(this.isVisible()&&(this._dropdownMenu.style.display="none",n.setFramesEnabled(!0),this.selectionClass&&this._triggerNode.classList.remove(this.selectionClass),this.options.onHide))this.options.onHide()},
addContent:function(e){this._dropdownMenu.innerHTML=e},getContentNode:function(){return this._dropdownMenu},updateContent:function(e,d){d()},_positionDropdown:function(){this._dropdownMenu.style.right="";var e=n.bounds(this._dropdownMenu),d=n.bounds(document.body);e.left+e.width>d.left+d.width&&(e=n.bounds(this._boundingNode(this._triggerNode)),d=n.bounds(this._triggerNode),this._dropdownMenu.style.right=e.width-(d.left-e.left+d.width)+"px")},_boundingNode:function(e){var d=window.getComputedStyle(e,
null);return null===d||"absolute"===d.getPropertyValue("position")||!e.parentNode||e===document.body?e:this._boundingNode(e.parentNode)},isDestroyed:function(){return!this._dropdownMenu.parentNode},isVisible:function(){return"none"!==this._dropdownMenu.style.display&&!this.isDestroyed()},focus:function(){this._dropdownMenu.focus()},destroy:function(){this._parent&&(n.setFramesEnabled(!0),n.empty(this._parent),this._parent=this.select=null)}});return k});define("orion/customGlobalCommands",[],function(){return{}});
define("orion/navigate/nls/root/messages",{"Click one of the tasks below to create an Orion folder.  You can upload, import, or generate files.":"Click one of the tasks below to create an Orion folder.  You can upload, import, or generate files.","Toggle Left Pane":"Toggle Left Pane","Open or close the left pane":"Open or close the left pane",Navigator:"Navigator","Strings Xtrnalizr":"Strings Xtrnalizr","Externalize Strings from JavaScript files in this folder":"Externalize strings from JavaScript files in this folder.",
"Choose a Folder":"Choose a Folder","Copy of ${0}":"Copy of ${0}","Enter a new name for '${0}'":"Enter a new name for '${0}'","Choose folder...":"Choose folder...",Rename:"Rename","Rename the selected files or folders":"Rename the selected files or folders","Compare with each other":"Compare with each other","Compare the selected 2 files with each other":"Compare the selected 2 files with each other","Compare with...":"Compare with...","Compare the selected folder with a specified folder":"Compare the selected folder with a specified folder",
Delete:"Delete","Unknown item":"Unknown item","Are you sure you want to delete these ${0} items?":"Are you sure you want to delete these ${0} items?","Are you sure you want to delete '${0}'?":"Are you sure you want to delete '${0}'?","Export as zip":"Zip","Create a zip file of the folder contents and download it":"Create a zip file of the folder contents and download it","New File":"File","Create a new file":"Create a new file","Name:":"Name:","New Folder":"Folder","Folder name:":"Folder name:","Create a new folder":"Create a new folder",
"Creating folder":"Creating folder",Folder:"Folder","Create an empty folder":"Create an empty folder","Create an empty folder on the Orion server.  You can import, upload, or create content in the editor.":"Create an empty folder on the Orion server.  You can import, upload, or create content in the editor.","Sample HTML5 Site":"Sample HTML5 Site","Generate a sample":"Generate a sample",'Generate an HTML5 "Hello World" website, including JavaScript, HTML, and CSS files.':'Generate an HTML5 "Hello World" website, including JavaScript, HTML, and CSS files.',
"Creating a folder for ${0}":"Creating a folder for ${0}","SFTP Import":"SFTP Import","Import content from SFTP":"Import content from SFTP","Import content from an SFTP location into an Orion folder.  You will be prompted for the SFTP location and credentials.":"Import content from an SFTP location into an Orion folder.  You will be prompted for the SFTP location and credentials.","Imported Content":"Imported Content","Upload a Zip":"Upload a Zip","Upload content from a local zip file":"Upload content from a local zip file",
"Upload content from a local zip file into an Orion folder.  You will be prompted for the local zip file.":"Upload content from a local zip file into an Orion folder.  You will be prompted for the local zip file.","Uploaded Content":"Uploaded Content","Creating an upload folder for ":"Creating an upload folder for ","Clone Git Repository":"Clone Git Repository","Clone a git repository":"Clone a git repository","Go to the Orion repositories page to provide a git repository URL.  Once the repository is created, it will appear in the Navigator.":"Go to the Orion repositories page to provide a git repository URL.  Once the repository is created, it will appear in the Navigator.",
"Link to Server":"Link to Server","Link to existing content on the server":"Link to existing content on the server","Create a folder that links to an existing folder on the server.":"Create a folder that links to an existing folder on the server.","Server path:":"Server path:","The name and server location were not specified.":"The name and server location were not specified.","Go Up":"Go Up","Move up to the parent folder":"Move up to the parent folder","Go Into":"Go Into","Move into the selected folder":"Move into the selected folder",
"File or zip archive":"File or zip archive","Import a file or zip archive from your local file system":"Import a file or zip archive from your local file system","SFTP from...":"SFTP","Copy files and folders from a specified SFTP connection":"Copy files and folders from a specified SFTP connection","Importing from ${0}":"Importing from ${0}","SFTP to...":"SFTP","Copy files and folders to a specified SFTP location":"Copy files and folders to a specified SFTP location",Exporting:"Exporting to ${0}",
"Pasting ${0}":"Pasting ${0}","Copy to":"Copy to","Move to":"Move to","Copying ${0}":"Copying ${0}","Moving ${0}":"Moving ${0}","Renaming ${0}":"Renaming ${0}","Deleting ${0}":"Deleting ${0}","Creating ${0}":"Creating ${0}","Linking to ${0}":"Linking to ${0}","Move files and folders to a new location":"Move files and folders to a new location",Cut:"Cut",Copy:"Copy","Fetching children of ":"Fetching children of ",Paste:"Paste","Cannot paste into the Workspace root":"Cannot paste into the Workspace root",
"Open With":"Open With","Loading ":"Loading ",New:"New",File:"File",Actions:"Actions","Orion Content":"Orion Content"," is not supported in this file system":" is not supported in this file system","Create new content":"Create new content","Import from HTTP...":"HTTP","File URL:":"File URL:","Import a file from a URL and optionally unzip it":"Import a file from a URL and optionally unzip it","Unzip *.zip files:":"Unzip *.zip files:","Extracted from:":"Extracted from:","Did not drop ${0}.  Folder drop is not supported in this browser.":"Did not drop ${0}.  Folder drop is not supported in this browser.",
"You cannot copy files directly into the workspace.  Create a folder first.":"You cannot copy files directly into the workspace.  Create a folder first.","Unzip ${0}?":"Unzip ${0}?","Upload progress: ":"Upload progress: ","Uploading ":"Uploading ","Cancel upload":"Cancel upload","Uploading the following file failed: ":"Uploading the following file failed: ","Enter project name:":"Enter project name:","Creating project ":"Creating project ",NoFile:"Use the ${0} menu to create new files and folders. Click a file to start coding.",
Download:"Download",Download_tooltips:"Download the file contents as the displayed name","Downloading...":"Reading file contents...","Download not supported":"Contents download is not supported in this browser."});define("orion/navigate/nls/messages",["orion/i18n!orion/navigate/nls/messages","orion/navigate/nls/root/messages"],function(m,n){var k={root:n};Object.keys(m).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=m[e])});return k});
define("orion/fileClient",["i18n!orion/navigate/nls/messages","orion/Deferred","orion/i18nUtil"],function(m,n,k){function e(d,b,a){if(!d[b])throw b+m[" is not supported in this file system"];return d[b].apply(d,a)}function d(f,b,a,l){if(!f.readBlob)throw m["source file service does not support binary read"];if(!a.writeBlob)throw m["target file service does not support binary write"];if("/"!==b[b.length-1])return e(f,"readBlob",[b]).then(function(b){return e(a,"writeBlob",[l,b])});var h=l.substring(0,
l.length-1),p=decodeURIComponent(h.substring(h.lastIndexOf("/")+1)),h=h.substring(0,h.lastIndexOf("/")+1);return e(a,"createFolder",[h,p]).then(function(){},function(){}).then(function(){return e(f,"fetchChildren",[b]).then(function(b){for(var h=[],e=0;e<b.length;++e){var p=b[e].Location,g=p;b[e].Directory&&(g=p.substring(0,p.length-1));g=decodeURIComponent(g.substring(g.lastIndexOf("/")+1));g=l+encodeURIComponent(g);b[e].Directory&&(g+="/");h[e]=d(f,p,a,g)}return n.all(h)})})}function g(d,b){function a(a){var b=
new n;b.reject(m["No Matching FileService for location:"]+a);return b}var l=d.getServiceReferences("orion.core.file"),h=l;if(b)for(var h=[],e=0;e<l.length;++e)b(l[e])&&h.push(l[e]);for(var g=[],r=[],t=[],w=[],s={fetchChildren:function(){var a=new n;a.resolve(w);return a},createWorkspace:function(){var a=new n;a.reject(m["no file service"]);return a},loadWorkspaces:function(){var a=new n;a.reject(m["no file service"]);return a},loadWorkspace:function(a){var b=new n;window.setTimeout(function(){b.resolve({Directory:!0,
Length:0,LocalTimeStamp:0,Name:m["File Servers"],Location:"/",Children:w,ChildrenLocation:"/"})},100);return b},search:a,createProject:a,createFolder:a,createFile:a,deleteFile:a,moveFile:a,copyFile:a,read:a,write:a},l=0;l<h.length;++l)w[l]={Directory:!0,Length:0,LocalTimeStamp:0,Location:h[l].getProperty("top"),ChildrenLocation:h[l].getProperty("top"),Name:h[l].getProperty("Name")},e=h[l].getProperty("pattern")||h[l].getProperty("top").replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"^"!==e[0]&&(e=
"^"+e),g[l]=RegExp(e),r[l]=d.getService(h[l]),t[l]=h[l].getProperty("Name"),h[l].getProperty("NameKey")&&h[l].getProperty("nls")&&k.getMessageBundle(h[l].getProperty("nls")).then(function(a,b){w[a].Name=b[h[a].getProperty("NameKey")];t[a]=b[h[a].getProperty("NameKey")]}.bind(this,l));this._getServiceIndex=function(a){if("/"===a)return-1;if(!a||a.length&&0===a.length)return r[0]?0:-1;for(var b=0;b<g.length;++b)if(g[b].test(a))return b;throw m["No Matching FileService for location:"]+a;};this._getService=
function(a){a=this._getServiceIndex(a);return-1===a?s:r[a]};this._getServiceName=function(a){a=this._getServiceIndex(a);return-1===a?s.Name:t[a]};this._getServiceRootURL=function(a){a=this._getServiceIndex(a);return-1===a?s.Location:w[a].Location}}g.prototype={getService:function(d){return this._getService(d)},fileServiceName:function(d){return this._getServiceName(d)},fileServiceRootURL:function(d){return this._getServiceRootURL(d)},fetchChildren:function(d){return e(this._getService(d),"fetchChildren",
arguments)},createWorkspace:function(d){return e(this._getService(),"createWorkspace",arguments)},loadWorkspaces:function(){return e(this._getService(),"loadWorkspaces",arguments)},loadWorkspace:function(d){return e(this._getService(d),"loadWorkspace",arguments)},createProject:function(d,b,a,l){return e(this._getService(d),"createProject",arguments)},createFolder:function(d,b){return e(this._getService(d),"createFolder",arguments)},createFile:function(d,b){return e(this._getService(d),"createFile",
arguments)},deleteFile:function(d){return e(this._getService(d),"deleteFile",arguments)},moveFile:function(f,b,a){var l=this._getService(f),h=this._getService(b);if(l===h)return e(l,"moveFile",arguments);var p="/"===f[f.length-1],g=b;"/"!==g[g.length-1]&&(g+="/");if(a)g+=encodeURIComponent(a);else{var r=f;p&&(r=r.substring(0,r.length-1));g+=r.substring(r.lastIndexOf("/")+1)}p&&"/"!==g[g.length-1]&&(g+="/");return d(l,f,h,g).then(function(){return e(l,"deleteFile",[f])})},copyFile:function(f,b,a){var l=
this._getService(f),h=this._getService(b);if(l===h)return e(l,"copyFile",arguments);var p="/"===f[f.length-1],g=b;"/"!==g[g.length-1]&&(g+="/");if(a)g+=encodeURIComponent(a);else{var r=f;p&&(r=r.substring(0,r.length-1));g+=r.substring(r.lastIndexOf("/")+1)}p&&"/"!==g[g.length-1]&&(g+="/");return d(l,f,h,g)},read:function(d,b){return e(this._getService(d),"read",arguments)},readBlob:function(d){return e(this._getService(d),"readBlob",arguments)},write:function(d,b,a){return e(this._getService(d),"write",
arguments)},remoteImport:function(d,b){return e(this._getService(d),"remoteImport",arguments)},remoteExport:function(d,b){return e(this._getService(d),"remoteExport",arguments)},search:function(d){return e(this._getService(d.resource),"search",arguments)}};g.prototype.constructor=g;return{FileClient:g}});
define("orion/webui/SideMenu",["orion/webui/littlelib","orion/PageUtil","orion/URL-shim"],function(m,n){function k(g,f){this._parentNode=m.node(g);if(!this._parentNode)throw Error("Missing parentNode");this._contentNode=m.node(f);this._categoryInfos=[];this._categorizedPageLinks={};this._categorizedRelatedLinks={};this._categorizedAnchors=null;this._state=localStorage.getItem(e)||d;this._currentCategory="";this._renderTimeout=this._notificationTimeout=null}var e="sideMenuNavigation",d="open";k.prototype=
{constructor:k.prototype.constructor,setCategories:function(d){this._categoryInfos=d.getCategoryIDs().map(function(f){return d.getCategory(f)}).sort(function(d,b){var a=d.order||100,l=b.order||100;return a<l?-1:l<a?1:d.textContent.localeCompare(b.textContent)})},setPageLinks:function(d){this._categorizedPageLinks={};d.getAllLinks().forEach(function(d){var b=d.category;this._categorizedPageLinks[b]=this._categorizedPageLinks[b]||[];this._categorizedPageLinks[b].push({title:d.textContent,order:d.order||
100,href:d.href})},this)},setRelatedLinks:function(d,f){this._categorizedRelatedLinks={};d.forEach(function(b){var a=b.relatedLink,d=b.command;b=b.invocation;if(!f||-1===f.indexOf(a.id)){var h=a.category;this._categorizedRelatedLinks[h]=this._categorizedRelatedLinks[h]||[];this._categorizedRelatedLinks[h].push({title:d.name,order:a.order||100,href:d.hrefCallback.call(b.handler,b)})}},this);this._updateCategoryAnchors();this._updateCategoryNotifications()},render:function(){if(null===this._categorizedAnchors){this._categorizedAnchors=
{};var d=new URL(window.location.href);this._currentCategory=d.hash="";Object.keys(this._categorizedPageLinks).some(function(b){if(this._categorizedPageLinks[b].some(function(a){var b=new URL(a.href);a.hash="";return d.href===b.href}))return this._currentCategory=b,!0},this);var f=document.createElement("ul");f.classList.add("sideMenuList");this._categoryInfos.forEach(function(b){var a=document.createElement("li");a.classList.add("sideMenuItem");a.classList.add("sideMenu-notification");this._currentCategory===
b.id&&a.classList.add("sideMenuItemActive");a.categoryId=b.id;a.categoryName=b.textContent||b.id;var d=document.createElement("a");d.classList.add("submenu-trigger");if("string"===typeof b.imageDataURI&&0===b.imageDataURI.indexOf("data:image")){var h=document.createElement("img");h.width="16";h.height="16";h.src=b.imageDataURI;d.appendChild(h)}else d.classList.add(b.imageClass||"core-sprite-blank-menu-item");a.appendChild(d);f.appendChild(a);this._categorizedAnchors[b.id]=d},this);this._updateCategoryAnchors();
this._show=function(){this._parentNode.appendChild(f);this._show=k.prototype._show};window.setTimeout(function(){this._show()}.bind(this),1E3)}"closed"===this._state?(this._contentNode.style.left="0",this._renderTimeout&&(window.clearTimeout(this._renderTimeout),this._renderTimeout=null),this._renderTimeout=window.setTimeout(function(){this._parentNode.style.display="none";this._renderTimeout=null}.bind(this),301),this._parentNode.classList.add("animating")):(this._renderTimeout&&(window.clearTimeout(this._renderTimeout),
this._renderTimeout=null),this._parentNode.classList.remove("animating"),this._parentNode.style.display="block",this._parentNode.style.width="40px",this._contentNode.style.left="40px")},hide:function(){localStorage.setItem(e,"closed");this._contentNode.style.left="0"},toggle:function(){var g=this._contentNode;g&&g.classList.add("content-fixedHeight-animation");this._state="open"===this._state?"closed":"open";this._state===d?localStorage.removeItem(e):localStorage.setItem(e,this._state);this.render()},
_updateCategoryAnchors:function(){var d=[];Object.keys(this._categorizedRelatedLinks).forEach(function(f){("git"===f||f.match(/-scm$/))&&d.push(f)});Object.keys(this._categorizedAnchors).forEach(function(f){var b=this._categorizedAnchors[f],a=[];f===this._currentCategory?(b.parentElement.style.display="",b.href="",b.onclick=function(){return!1},b.title=b.parentElement.categoryName):(this._categorizedPageLinks[f]&&a.push.apply(a,this._categorizedPageLinks[f]),this._categorizedRelatedLinks[f]&&a.push.apply(a,
this._categorizedRelatedLinks[f]),0===a.length||0!==d.length&&("git"===f||f.match(/-scm$/))&&-1===d.indexOf(f)?(b.href="",b.title=b.parentElement.categoryName,b.parentElement.style.display="none"):(b.parentElement.style.display="",a.sort(function(a,b){return a.order<b.order?-1:b.order<a.order?1:a.title.localeCompare(b.title)}),f=a.shift(),b.href=f.href,b.title=f.title))},this);this._show()},_updateCategoryNotifications:function(){clearTimeout(this._notificationTimeout);this._notificationTimeout=setTimeout(this._updateCategoryNotifications.bind(this),
3E5);var d=n.matchResourceParameters().resource,f=(new URL(d,window.location.href)).href;this._categoryInfos.forEach(function(b){if(b.service&&b.service.getNotifications){var a=this._categorizedAnchors[b.id].parentElement;b.service.getNotifications(f).then(function(b){if(d===n.matchResourceParameters().resource){var f="";b.forEach(function(a){"info"===a.level&&!f?f="info":"warn"===a.level&&(!f||"info"===f)?f="warn":"error"===a.level&&"error"!==f&&(f="error")});f?a.setAttribute("level",f):a.removeAttribute("level")}},
function(a){window.console.log(a)})}},this)},_show:function(){}};return k});
define("orion/globalCommands","i18n!orion/nls/messages require orion/commonHTMLFragments orion/keyBinding orion/EventTarget orion/commandRegistry orion/commands orion/parameterCollectors orion/extensionCommands orion/uiUtils orion/keyBinding orion/breadcrumbs orion/webui/littlelib orion/webui/splitter orion/webui/dropdown orion/webui/tooltip orion/contentTypes orion/URITemplate orion/keyAssist orion/PageUtil orion/widgets/themes/ThemePreferences orion/widgets/themes/container/ThemeData orion/Deferred orion/widgets/UserMenu orion/PageLinks orion/webui/dialogs/OpenResourceDialog text!orion/banner/banner.html text!orion/banner/footer.html text!orion/banner/toolbar.html orion/widgets/input/DropDownMenu orion/util orion/customGlobalCommands orion/fileClient orion/webui/SideMenu orion/objects".split(" "),function(m,
n,k,e,d,g,f,b,a,l,h,p,q,r,t,w,s,x,v,z,A,B,u,y,C,E,D,H,I,G,J,K,F,P,L){function Q(a,b){if(a.getLabel)return a.getLabel();var d=new u;d.resolve(b.properties.name);return d}function R(a){q.node("progressPane").setAttribute("aria-label",m["Operations - Press spacebar to show current operations"]);(a=a.getService("orion.page.progress"))&&a.init.bind(a)("progressPane")}function U(a,b){var d=a.getServiceReferences("orion.core.auth");ba=[];var f=O.createMenuGenerator.apply(this,arguments);if(f)for(var h=0;h<
d.length;h++){var u=d[h],l=a.getService(u);Q(l,u).then(function(a){l.getKey().then(function(b){ba.push(b);l.getUser().then(function(d){f.addUserItem(b,l,a,d)},function(d,h){f.addUserItem(b,l,a,h)});window.addEventListener("storage",function(d){N[b]!==localStorage.getItem(b)&&(N[b]=localStorage.getItem(b),l.getUser().then(function(d){f.addUserItem(b,l,a,d)},function(d){f.addUserItem(b,l,a)}))},!1)})})}}function V(a){return a}function W(b,d,h,l,e){function p(){if(t)return t;var a=b.getService("orion.core.contentTypeRegistry");
a||(a=new s.ContentTypeRegistry(b),a=b.getService("orion.core.contentTypeRegistry"));return a.getContentTypes().then(function(a){return t=a})}function y(a){for(var b={},d=a.getPropertyKeys(),f,h=0;h<d.length;h++)f=d[h],b[f]=a.getProperty(f);return b}function g(a,b){var d=null;a.some(function(a){return b===a.getProperty("id")?!!(d=a):!1});return d}function C(a){var b=a.command;return!b.visibleWhen||b.visibleWhen(d)?(a.invocation=new f.CommandInvocation(d,d,null,b,l),(new u).resolve(a)):"function"===
typeof e?(k||(k=e()),u.when(k,function(h){if(h&&d===ca&&(!b.visibleWhen||b.visibleWhen(h)))return a.invocation=new f.CommandInvocation(h,h,null,b,l),a})):(new u).resolve()}function q(a,b,d){return d?(new u).resolve({relatedLink:a,command:d}):b.then(function(b){return{relatedLink:a,command:new f.Command(b)}})}var r=arguments,t,k,E=b&&b.getServiceReferences("orion.page.link.related");if(E&&0!==E.length){var m=this;u.when(p(),function(){if(O.beforeGenerateRelatedLinks.apply(m,r)){var d=b.getServiceReferences("orion.navigate.command"),
f=[];E.forEach(function(h){var u=y(h);if(u.id){var e;if((u.nls&&u.nameKey||u.name)&&u.uriTemplate)e=a._createCommandOptions(u,h,b,t,!0),f.push(q(u,e,null));else if(e=g(d,u.id)){var p=y(e);h={};L.mixin(h,p,u);(u=l.findCommand(u.id))?f.push(q(h,null,u)):(e=a._createCommandOptions(p,e,b,t,!0),f.push(q(h,e,null)))}}});u.all(f,V).then(function(a){a.sort(function(a,b){return a.command.name.localeCompare(b.command.name)});return u.all(a.map(C),V).then(function(b){var d=[];b=b.filter(function(b,f){if(b)return!0;
d.push(a[f]);return!1});O.addRelatedLinkCommands.call(m,l,b,d,h);O.afterGenerateRelatedLinks.apply(m,r)})})}})}}function X(a){var b=q.node("globalActions");b&&(a.destroy(b),a.renderCommands(b.id,b,{},{},"tool"))}function Y(a){var b=window.getComputedStyle(a,null);return null===b||"absolute"===b.getPropertyValue("position")||!a.parentNode||a===document.body?a:Y(a.parentNode)}function S(a){var b={},d=null;"string"===typeof a&&(a=q.node(a));a||(a=q.node("pageActions"));for(var f=a;f&&f.classList;){if(f.classList.contains("toolComposite")){d=
f;break}f=f.parentNode}a.classList.contains("commandMarker")&&(b.commandNode=a);d||(d=q.node("pageToolbar"));d&&(b.slideContainer=q.$(".slideParameters",d),b.parameterArea=q.$(".parameters",d),b.dismissArea=q.$(".parametersDismiss",d),b.notifications=q.$("#notificationArea",d),d.parentNode&&(b.toolbarTarget=q.$(".toolbarTarget",d.parentNode),b.toolbarTarget&&(a=q.bounds(b.toolbarTarget),f=q.bounds(Y(b.toolbarTarget.parentNode)),b.toolbarTargetY=a.top-f.top,b.toolbar=d)));return b}function M(a){if(a=
a.slideContainer)if(a.style.left="",a.style.top="",a.classList.contains("slideContainerActive")){var b=q.bounds(a),d=q.bounds(a.parentNode);a.style.left=(d.width-b.width)/2+"px";a.style.top="0"}}g=function(a){var b=document.createElement("a");b.href=a;return b.href}(n.toUrl("auth/NotifyAuthentication.html"));var N={},O={createMenuGenerator:K.createMenuGenerator||function(a,b){if(q.node("userMenu")){var d=q.node("userDropdown"),f=new t.Dropdown({dropdown:d}),d=new y.UserMenu({dropdownNode:d,dropdown:f,
serviceRegistry:a}),f=q.node("userTrigger");new w.Tooltip({node:f,text:m.Options,position:["below","left"]});var f=document.getElementById("userTrigger"),h=f.className;f.className=h+" imageSprite core-sprite-silhouette";d.setKeyAssist(b);return d}},beforeGenerateRelatedLinks:K.beforeGenerateRelatedLinks||function(a,b,d,f,h){return!0},addRelatedLinkCommands:K.addRelatedLinkCommands||function(a,b,d,f){this.sideMenu&&this.sideMenu.setRelatedLinks(b,f)},afterGenerateRelatedLinks:K.afterGenerateRelatedLinks||
function(a,b,d,f,h){},afterSetPageTarget:K.afterSetPageTarget||function(a){},generateNavigationMenu:K.generateNavigationMenu||function(a,b,d,f,h,u,l){if(a=q.node("sideMenu"))b=q.node("centralNavigation"),new w.Tooltip({node:b,text:m.CentralNavTooltip,position:["right"]}),this.sideMenu=new P(a,q.node("pageContent")),b.addEventListener("click",this.sideMenu.toggle.bind(this.sideMenu)),(a=q.node("sideMenuToggle"))&&a.addEventListener("click",this.sideMenu.toggle.bind(this.sideMenu))},afterGenerateNavigationMenu:K.afterGenerateNavigationMenu||
function(a,b,d,f,h,u,l){},afterGenerateBanner:K.afterGenerateBanner||function(a,b,d,f,h,u,l){}},ba=[],ca,aa=[],T,$=null,Z=null,da=new d;return{generateBanner:function(a,d,h,l,p,y,g,t){function w(a){a.registerService("orion.cm.managedservice",{updated:function(a){a=a&&"undefined"!==a["links.newtab"]?a["links.newtab"]?"_blank":"_self":"_self";for(var b=q.$$array(".targetSelector"),d=0;d<b.length;d++)b[d].target=a}},{pid:"nav.config"})}(new A.ThemePreferences(l,new B.ThemeData)).apply();var s=q.node(a);
if(!s)throw m["could not find banner parent, id was "]+a;var P=document.createRange();P.selectNode(s);P=P.createContextualFragment(D);q.processTextNodes(P,m);s.firstChild?s.insertBefore(P,s.firstChild):s.appendChild(P);s=q.node("home");s.href=n.toUrl("edit/edit.html");s.setAttribute("aria-label",m["Orion Home"]);q.node("progressPane").src=f.NO_IMAGE;if(s=q.node("pageToolbar"))s.classList.add("toolbarLayout"),s.innerHTML=I+k.slideoutHTMLFragment("mainToolbar");(s=q.node("closeNotifications"))&&s.setAttribute("aria-label",
m["Close notification"]);if(17>=J.isFirefox&&(s=q.node("staticBanner")))s.style.width="100%",s.style.MozBoxSizing="border-box";if(s=q.node("footer"))s.innerHTML=H,q.processTextNodes(s,m);h.setParameterCollector(new b.CommandParameterCollector(S,M));document.addEventListener("keydown",function(a){a.keyCode===q.KEY.ESCAPE&&(a=d.getService("orion.page.message"))&&a.setProgressMessage("")},!1);O.generateNavigationMenu.apply(this,arguments);O.afterGenerateNavigationMenu.apply(this,arguments);s=C.getCategoriesInfo(d);
P=C.getPageLinksInfo(d,"orion.page.link");u.all([s,P]).then(function(a){if(this.sideMenu){var b=a[1];this.sideMenu.setCategories(a[0]);this.sideMenu.setPageLinks(b);this.sideMenu.render()}}.bind(this));if(s=q.$(".split")){var P=q.$(".sidePanelLayout"),x=q.$(".mainPanelLayout");P&&x&&($={side:P,main:x},$.splitter=new r.Splitter({node:s,sidePanel:P,mainPanel:x,toggle:!0,closeByDefault:t}),s=new f.Command({name:m["Toggle side panel"],tooltip:m["Open or close the side panel"],id:"orion.toggleSidePane",
callback:function(){$.splitter.toggleSidePanel()}}),h.addCommand(s),h.registerCommandContribution("pageActions","orion.toggleSidePane",1,null,!0,new e.KeyBinding("l",J.isMac?!1:!0,!0,!1,J.isMac?!0:!1)))}var L=!1,G=function(a,b){if(!L){var d=b.getService("orion.page.progress"),f=new E.OpenResourceDialog({searcher:a,progress:d,searchRenderer:a.defaultRenderer,onHide:function(){L=!1}});window.setTimeout(function(){L=!0;f.show()},0)}},s=new f.Command({name:m["Find File Named..."],tooltip:m["Choose a file by name and open an editor on it"],
id:"orion.openResource",callback:function(a){G(p,d)}});h.addCommand(s);h.registerCommandContribution("globalActions","orion.openResource",100,null,!0,new e.KeyBinding("f",!0,!0));var K=!1,s=function(){if(K)return!1;var a=q.node("banner"),b=q.node("footer"),d=q.node("sideMenu"),f=q.$(".content-fixedHeight"),h="hidden"===a.style.visibility;h?(a.style.visibility="visible",b.style.visibility="visible",f.classList.remove("content-fixedHeight-maximized"),d&&d.classList.remove("sideMenu-maximized")):(a.style.visibility=
"hidden",b.style.visibility="hidden",f.classList.add("content-fixedHeight-maximized"),d&&d.classList.add("sideMenu-maximized"));da.dispatchEvent({type:"toggleTrim",maximized:!h});return!0};window.orionNoTrim?(s(),K=!0,this.sideMenu.hide()):(s=new f.Command({name:m["Toggle banner and footer"],tooltip:m["Hide or show the page banner and footer"],id:"orion.toggleTrim",callback:s}),h.addCommand(s),h.registerCommandContribution("globalActions","orion.toggleTrim",100,null,!0,new e.KeyBinding("m",!0,!0)));
s=new f.Command({name:m["System Configuration Details"],tooltip:m["System Config Tooltip"],id:"orion.configDetailsPage",hrefCallback:function(){return n.toUrl("help/about.html")}});h.addCommand(s);h.registerCommandContribution("globalActions","orion.configDetailsPage",100,null,!0,new e.KeyBinding(112,!0,!0));s=new f.Command({name:m["Background Operations"],tooltip:m["Background Operations Tooltip"],id:"orion.backgroundOperations",hrefCallback:function(){return n.toUrl("operations/list.html")}});h.addCommand(s);
h.registerCommandContribution("globalActions","orion.backgroundOperations",100,null,!0,new e.KeyBinding("o",!0,!0));Z=new v.KeyAssistPanel({commandRegistry:h});s=new f.Command({name:m["Show Keys"],tooltip:m["Show a list of all the keybindings on this page"],id:"orion.keyAssist",callback:function(){Z.isVisible()?Z.hide():Z.show();return!0}});h.addCommand(s);h.registerCommandContribution("globalActions","orion.keyAssist",100,null,!0,new e.KeyBinding(191,!1,!0));X(h);U(d,s.callback);R(d);window.addEventListener("hashchange",
function(){h.processURL(window.location.href)},!1);window.setTimeout(function(){w(d)},0);O.afterGenerateBanner.apply(this,arguments)},getToolbarElements:S,getMainSplitter:function(){return $},getKeyAssist:function(){return Z},getGlobalEventTarget:function(){return da},layoutToolbarElements:M,setPageTarget:function(a){var b,d,f=a.breadcrumbRootName,h=a.serviceRegistry;a.target?(a.searchService&&a.searchService.setLocationByMetaData(a.target),a.fileService&&(!a.breadcrumbTarget&&!a.staticBreadcrumb)&&
(d=(f?f+" ":"")+a.fileService.fileServiceName(a.target.Location),f=null),b=a.name||a.target.Name,ca=a.target,W.call(this,h,a.target,aa,a.commandService,a.makeAlternate)):(a.breadcrumbTarget||(f=f||a.task||a.name),b=a.name,W.call(this,h,{NoTarget:""},aa,a.commandService,a.makeAlternate));(T=a.title)||(T=b?b+" - "+a.task:a.task);window.document.title=T;O.afterSetPageTarget.apply(this,arguments);if(b=a.breadCrumbContainer?q.node(a.breadCrumbContainer):q.node("location"))if(q.empty(b),a.staticBreadcrumb)new p.BreadCrumbs({container:b,
rootSegmentName:f});else{var u=h&&new F.FileClient(h),h=a.breadcrumbTarget||a.target,u=u&&h&&h.Location?u.fileServiceRootURL(h.Location):null;new p.BreadCrumbs({container:b,resource:h,rootSegmentName:f,workspaceRootSegmentName:d,workspaceRootURL:u,makeFinalHref:a.makeBreadcrumFinalLink,makeHref:a.makeBreadcrumbLink})}},setDirtyIndicator:function(a){T&&("*"===T.charAt(0)&&!a&&(T=T.substring(1)),a&&"*"!==T.charAt(0)&&(T="*"+T),window.document.title=T);var b=q.node("dirty");b&&(b.textContent=a?"*":"")},
setPageCommandExclusions:function(a){aa=a},notifyAuthenticationSite:g}});
define("orion/urlUtils",["orion/PageUtil","orion/URL-shim"],function(m){return{detectValidURL:function(n){for(var k=/\[([^\]]*)\]\(([^\)]+)\)/g,e=k.exec(n),d=[],g=0;e;){if(3===e.length&&0<e[2].length){var f=new URL(e[2]);":"!==f.protocol&&m.validateURLScheme(f.href)&&(e.index>g&&d.push({segmentStr:n.substring(g,e.index)}),d.push({segmentStr:0<e[1].length?e[1]:e[2],urlStr:e[2]}),g=e.index+e[0].length)}e=k.exec(n)}if(0===g)return null;g<n.length&&d.push({segmentStr:n.substring(g)});return d},processURLSegments:function(m,
k){k.forEach(function(e){if(e.urlStr){var d=document.createElement("a");d.href=e.urlStr;d.appendChild(document.createTextNode(e.segmentStr))}else d=document.createElement("span"),d.textContent=e.segmentStr;m.appendChild(d)})}}});
define("orion/status",["i18n!orion/nls/messages","orion/webui/littlelib","orion/globalCommands","orion/urlUtils"],function(m,n,k,e){function d(d,b,a,l,h){this._serviceRegistry=d;this._serviceRegistration=d.registerService("orion.page.message",this);this._operationsClient=b;this.notificationContainerDomId=h;this.domId=a;this.progressDomId=l||a;this._hookedClose=!1;this._timer=null;this._clickToDisMiss=!0;this._cancelMsg=null}var g;d.prototype={_init:function(){var d=n.node("closeNotifications");if(d&&
!this._hookedClose){d.style.cursor="pointer";this._hookedClose=!0;var b=n.node(this.notificationContainerDomId);n.addAutoDismiss([b],function(){this._clickToDisMiss&&this.close()}.bind(this));d.addEventListener("click",function(){this.close()}.bind(this));b.addEventListener("click",function(a){a&&a.target&&"a"===a.target.nodeName.toLowerCase()&&(a=n.$$("a",b))&&(a.length&&1===a.length)&&this.close()}.bind(this))}},close:function(){window.clearTimeout(this._timer);var d=n.node("closeNotifications");
this._cancelMsg&&this._cancelFunc&&d?(d.innerHTML="",d.classList.remove("cancelButton"),d.classList.add("dismissButton"),d.classList.add("core-sprite-close"),d.classList.add("imageSprite"),this._cancelFunc(),this._cancelMsg=null):this.setProgressMessage("")},_getNotifierElements:function(){this._notifierElements||(this._notifierElements=k.getToolbarElements(this.notificationContainerDomId));return this._notifierElements},setMessage:function(d,b,a){this._init();this.currentMessage=d;var l=n.node(this.domId);
if("boolean"===typeof a){var h=l.getAttribute("aria-live");l.setAttribute("aria-live",a?"polite":"off");window.setTimeout(function(){d===this.currentMessage&&(n.empty(l),l.appendChild(document.createTextNode(d)),window.setTimeout(function(){l.setAttribute("aria-live",h)},100))}.bind(this),100)}else n.empty(l),l.appendChild(document.createTextNode(d));"number"===typeof b&&window.setTimeout(function(){d===this.currentMessage&&(n.empty(l),l.appendChild(document.createTextNode("")))}.bind(this),b)},setErrorMessage:function(d){this._clickToDisMiss=
!0;this.currentMessage=d;this._init();var b=d.responseText||d.message||d;if("string"===typeof b)try{b=JSON.parse(b)}catch(a){}d=b.Message||b;var l="red";if(b.Severity)switch(b.Severity){case "Warning":l="#FFCC00";break;case "Error":l="red";break;case "Info":case "Ok":l="green"}b=document.createElement("span");b.style.color=l;b.appendChild(document.createTextNode(d));d=n.node(this.domId);n.empty(d);d.appendChild(b)},setProgressMessage:function(d){this._clickToDisMiss=!1;this._init();this.currentMessage=
d;var b=document.createElement("span");b.classList.add("progressIcon");var a=n.node(this.progressDomId);n.empty(a);a.appendChild(b);a.appendChild(document.createTextNode(d));b=n.node(this.notificationContainerDomId);b.classList.remove("notificationHide");if(d&&0<d.length)b.classList.add("progressNormal"),b.classList.add("notificationShow");else{if(this._progressMonitors&&0<this._progressMonitors.length)return this._renderOngoingMonitors();b.classList.remove("notificationShow");b.classList.add("notificationHide")}},
setCancelFunction:function(d){this._cancelFunc=d},setProgressResult:function(d,b){this._clickToDisMiss=!1;this._cancelMsg=b;this.currentMessage=d;var a=d.responseText||d;if("string"===typeof a)try{a=JSON.parse(a)}catch(l){}this._init();var h=a.Message||a.toString(),p=m.UnknownError,g="core-sprite-information",r="progressNormal",t=document.createElement("span");t.classList.add("imageSprite");t.classList.add("progressIcon");var k=[];if(a.Severity)switch(a.Severity){case "Warning":p=m.UnknownWarning;
g="core-sprite-warning";r="progressWarning";k.push("progressInfo");k.push("progressError");k.push("progressNormal");this._clickToDisMiss=!0;break;case "Error":g="core-sprite-error";r="progressError";k.push("progressWarning");k.push("progressInfo");k.push("progressNormal");this._clickToDisMiss=!0;break;default:r="progressNormal",k.push("progressWarning"),k.push("progressError"),k.push("progressNormal")}k.push("notificationHide");t.classList.add(g);var s=n.node(this.progressDomId),g=n.node(this.notificationContainerDomId);
n.empty(s);s.appendChild(t);h===Object.prototype.toString()&&(h=p);a.HTML?(a=document.createElement("span"),a.innerHTML=h,s.appendChild(a)):((p=e.detectValidURL(h))?(h=document.createDocumentFragment(),e.processURLSegments(h,p),Array.prototype.forEach.call(n.$$("a",h),function(a){a.target="_blank"})):("Warning"!==a.Severity&&("Error"!==a.Severity&&!b)&&(this._timer&&window.clearTimeout(this._timer),this._timer=window.setTimeout(function(){this.setProgressMessage("");this._timer=null}.bind(this),5E3)),
h=document.createTextNode(h)),s.appendChild(h));if(r&&this.progressDomId!==this.domId){g.classList.add(r);for(r=0;r<k.length;r++)g.classList.remove(k[r])}g.classList.add("notificationShow");if(k=n.node("closeNotifications"))this._cancelMsg?(k.classList.add("cancelButton"),k.classList.remove("dismissButton"),k.classList.remove("core-sprite-close"),k.classList.remove("imageSprite"),k.innerHTML=this._cancelMsg):(k.innerHTML="",k.classList.remove("cancelButton"),k.classList.add("dismissButton"),k.classList.add("core-sprite-close"),
k.classList.add("imageSprite"))},showWhile:function(d,b){var a=this;if(b){a.setProgressMessage(b);var l=function(){b===a.currentMessage&&a.setProgressMessage("")};d.then(l,l)}return d},_lastProgressId:0,_progressMonitors:{length:0},createProgressMonitor:function(d,b){return new g(this,++this._lastProgressId,d,b)},_renderOngoingMonitors:function(){if(0<this._progressMonitors.length){var d="",b=!0,a;for(a in this._progressMonitors)this._progressMonitors[a].status&&(b||(d+=", "),d+=this._progressMonitors[a].status,
b=!1);this.setProgressMessage(d)}else this.setProgressMessage("")},_beginProgressMonitor:function(d){this._progressMonitors[d.progressId]=d;this._progressMonitors.length++;this._renderOngoingMonitors()},_workedProgressMonitor:function(d){this._progressMonitors[d.progressId]=d;this._renderOngoingMonitors()},_doneProgressMonitor:function(d){delete this._progressMonitors[d.progressId];this._progressMonitors.length--;d.status?this.setProgressResult(d.status):this._renderOngoingMonitors()}};d.prototype.constructor=
d;g=function(d,b,a,l){this.statusService=d;this.progressId=b;if(a){this.deferred=a;this.begin(l);var h=this;a.then(function(a,b){h.done.bind(h)()},function(a,b){h.done.bind(h)()})}};g.prototype.begin=function(d){this.status=d;this.statusService._beginProgressMonitor(this)};g.prototype.done=function(d){this.status=d;this.statusService._doneProgressMonitor(this)};g.prototype.worked=function(d){this.status=d;this.statusService._workedProgressMonitor(this)};g.prototype.constructor=g;return{StatusReportingService:d,
ProgressMonitor:g}});
define("orion/operations/nls/root/messages",{More:"More","No Matching OperationService for location:":"No Matching OperationService for location:","No operations services registered.":"No operations services registered.","could not find toolbar ":"could not find toolbar ","Remove Completed":"Remove Completed","Remove all completed operations":"Remove all completed operations",Remove:"Remove","Remove operations from the operations list.":"Remove operations from the operations list.",Cancel:"Cancel",
"Cancel operations from the operations list.":"Cancel operations from the operations list.","Operation resulted in a warning.":"Operation resulted in a warning.","Operation resulted in an error.":"Operation resulted in an error.","Operation is running.":"Operation is running.","Operation is canceled.":"Operation is canceled.","Operation failed.":"Operation failed.",Name:"Name",Actions:"Actions",Status:"Status",Scheduled:"Scheduled"});
define("orion/operations/nls/messages",["orion/i18n!orion/operations/nls/messages","orion/operations/nls/root/messages"],function(m,n){var k={root:n};Object.keys(m).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=m[e])});return k});
define("orion/webui/popupdialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/webui/tooltip"],function(m,n,k,e){function d(){}d.prototype={_initialize:function(d,f,b,a,l){this._tooltip=new e.Tooltip({node:d,hideDelay:l||0,afterShowing:this._afterShowingFunction(f).bind(this),afterHiding:b,trigger:a?a:"click"});this.$parent=this._tooltip.contentContainer();this.$parent.role="dialog";d=document.createRange();d.selectNode(this.$parent);d=d.createContextualFragment(this.TEMPLATE);
this.messages&&k.processTextNodes(d,m);this.$parent.appendChild(d);var h=this._tooltip;this.$parent.addEventListener("keydown",function(a){a.keyCode===k.KEY.ESCAPE&&h.hide()},!1);this._bindElements(this.$parent);"function"===typeof this._bindToDom&&this._bindToDom(this.$parent)},_bindElements:function(d){for(var f=0;f<d.childNodes.length;f++){var b=d.childNodes[f];b.id&&(this["$"+b.id]=b);this._bindElements(b)}},_afterShowingFunction:function(d){return function(){d&&d.bind(this)();if(!this.customFocus){var f=
k.firstTabbable(this.$parent);f&&f.focus()}}},hide:function(){this._tooltip.hide()},show:function(){this._tooltip.show()}};d.prototype.constructor=d;return{PopupDialog:d}});
define("orion/operationsCommands",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/commands"],function(m,n,k,e){var d={};(function(){var g=!1;d.updateNavTools=function(d,b,a,l,h,e){var q=k.node(l);if(q)b.destroy(q);else throw m["could not find toolbar "]+l;b.renderCommands(l,q,e,a,"button");if(h&&(l=k.node(h)))b.destroy(l),b.renderCommands(h,l,null,a,"button");g||(g=!0,d.getService("orion.page.selection").addEventListener("selectionChanged",function(d){var f=k.node(h);
f&&(b.destroy(f),b.renderCommands(h,f,d.selections,a,"button"))}))};d.createOperationsCommands=function(d,b,a){function l(a){return!a.operation||!a.operation.type?!1:"loadstart"===a.operation.type||"progress"===a.operation.type}var h=new e.Command({name:m["Remove Completed"],tooltip:m["Remove all completed operations"],id:"eclipse.removeCompletedOperations",callback:function(d){a.removeCompletedOperations().then(function(a){b.loadOperations.bind(b)()})},visibleWhen:function(a){return!0}});d.addCommand(h);
h=new e.Command({name:m.Remove,tooltip:m["Remove operations from the operations list."],imageClass:"core-sprite-delete",id:"eclipse.removeOperation",callback:function(d){d=Array.isArray(d.items)?d.items:[d.items];for(var f=0;f<d.length;f++){var h=d[f];a.removeOperation.bind(a)(h.Location).then(function(){b.loadOperations.bind(b)()},function(){b.loadOperations.bind(b)()})}},visibleWhen:function(a){if(!Array.isArray(a)||0===a.length)return!l(a);for(var b in a)if(l(a[b]))return!1;return!0}});d.addCommand(h);
h=new e.Command({name:m.Cancel,tooltip:m["Cancel operations from the operations list."],imageClass:"core-sprite-stop",id:"eclipse.cancelOperation",callback:function(a){a=Array.isArray(a.items)?a.items:[a.items];for(var b=0;b<a.length;b++){var d=a[b];d.deferred&&d.deferred.cancel()}},visibleWhen:function(a){if(!Array.isArray(a)||0===a.length)return l(a)&&(a.operation&&a.operation.cancelable?!0:!1);for(var b in a)if(!l(a[b])||!a[b].operation||!a[b].operation.cancelable)return!1;return!0}});d.addCommand(h)}})();
return d});
define("orion/webui/dialogs/OperationsDialog",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/webui/popupdialog","orion/operationsCommands"],function(m,n,k,e,d){function g(d){this._options=d}g.prototype=new e.PopupDialog;g.prototype.TEMPLATE='\x3ctable style\x3d"width: 360px;"\x3e\x3ctr\x3e\x3ctd\x3e\x3ch2\x3eRecent operations\x3c/h2\x3e\x3c/td\x3e\x3ctd style\x3d"text-align: right;"\x3e\x3ca id\x3d"allOperationsLink" class\x3d"navlinkonpage"\x3eAll Operations\x3c/a\x3e\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e\x3cdiv id\x3d"operationsExist"\x3e\x3cdiv style\x3d"padding-left: 7px" id\x3d"myOperationsListEmpty"\x3eNo operations running on this page.\x3c/div\x3e\x3ctable id\x3d"myOperationsList" style\x3d"display: none;"\x3e\x3c/table\x3e\x3c/div\x3e\x3cdiv style\x3d"padding-left: 7px" id\x3d"operationsDontExist"\x3eNo operations running.\x3c/div\x3e';g.prototype._init=
function(f){this._myOperations=[];this._operationsDeferreds=[];this._commandService=f.commandRegistry;d.createOperationsCommands(this._commandService);this._commandService.registerCommandContribution("operationsDialogItems","eclipse.cancelOperation",1);this._initialize(f.triggerNode)};g.prototype._bindToDom=function(d){this.$allOperationsLink.href=n.toUrl("operations/list.html");this._setOperationsVisibility()};g.prototype.setOperations=function(d,b){this._myOperations||this._init(this._options);
this._myOperations=[];this._operationsDeferreds=[];if(d)for(var a in d)this._myOperations.push(d[a]),this._operationsDeferreds.push(b[a]);this._renderOperations()};g.prototype.parseProgressResult=function(d){if(!d)return{};d=d.responseText||d;try{d=JSON.parse(d)}catch(b){}var a={Message:d.Message||d,Severity:d.Severity};d.DetailedMessage&&d.DetailedMessage!==a.Message&&(a.DetailedMessage=d.DetailedMessage);return a};g.prototype._renderOperations=function(){this._renderOperationsTable(this.$myOperationsList,
this._myOperations,this._operationsDeferreds)};g.prototype._renderOperationsTable=function(d,b,a){k.empty(d);for(var l=0;l<b.length;l++){var h=b[l],e=document.createElement("tr"),g=document.createElement("td");g.style.paddingLeft="5px";g.style.paddingRight="5px";g.textContent=h.Name;e.appendChild(g);var r=document.createElement("div");g.appendChild(r);g=document.createElement("span");g.style.paddingRight="5px";g.classList.add("imageSprite");switch(h.type){case "Warning":g.classList.add("core-sprite-warning");
g.setAttribute("aria-label",m["Operation resulted in a warning."]);break;case "error":g.classList.add("core-sprite-error");g.setAttribute("aria-label",m["Operation resulted in an error."]);break;case "loadstart":case "progress":g.classList.add("core-sprite-start");g.setAttribute("aria-label",m["Operation is running."]);break;case "abort":g.classList.add("core-sprite-stop");g.setAttribute("aria-label",m["Operation is canceled."]);break;case "load":case "loadend":g.classList.add("core-sprite-ok"),g.setAttribute("aria-label",
"Operation ok.")}r.appendChild(g);g=document.createElement("span");g.classList.add("operationStatus");g.textContent=h.Name;r.appendChild(g);if(h.error){var t=h.error.Message||h.error;h.error.DetailedMessage&&""!==h.error.DetailedMessage&&(t+=": "+h.error.DetailedMessage);g.textContent=t;g.classList.remove("operationStatus");g.classList.add("operationError")}this._commandService.renderCommands("operationsDialogItems",r,{operation:h,deferred:a[l]},this,"tool");d.appendChild(e)}this._setOperationsVisibility()};
g.prototype._setOperationsVisibility=function(){this.$myOperationsList.style.display=0<this._myOperations.length?"":"none";this.$myOperationsListEmpty.style.display=0<this._myOperations.length?"none":"";this.$operationsDontExist.style.display=0<this._myOperations.length?"none":"";this.$operationsExist.style.display=0<this._myOperations.length?"":"none"};g.prototype.constructor=g;return{OperationsDialog:g}});
define("orion/progress",["i18n!orion/nls/messages","require","orion/Deferred","orion/webui/littlelib","orion/webui/dialogs/OperationsDialog"],function(m,n,k,e,d){function g(b,a){if(!this._progressPane){this._progressPane=e.node(b);this._operationsDialog=new d.OperationsDialog({triggerNode:this._progressPane,commandRegistry:a});var f=this;this._progressPane.addEventListener("keydown",function(a){(" "===a.charOrCode||a.keyCode===e.KEY.ENTER)&&f._operationsDialog.show()});this._progressPane.addEventListener("click",
function(a){f._operationsDialog.show()});this._operationsDialog.setOperations(null,null)}}function f(b,a,d,f){this._serviceRegistry=b;this._serviceRegistration=b.registerService("orion.page.progress",this);this._commandRegistry=d;this._operationsClient=a;this._operations={};this._operationDeferrds={};this._operationsIndex=0;this._lastIconClass=this._lastOperation=null;this._progressMonitorClass=f}g.prototype={_switchIconTo:function(b){this._lastIconClass&&this._progressPane.classList.remove(this._lastIconClass);
this._lastIconClass=b;this._progressPane.classList.add(this._lastIconClass)},generateOperationsInfo:function(b,a){var d={},f;for(f in b)b[f].progressMonitor||(d[f]=b[f]);if(this._isEmpty(d))this._switchIconTo("progressPane_empty"),this._progressPane.title=m.Operations,this._progressPane.alt=m.Operations,this._progressPane.hasAttribute("aria-valuetext")&&this._progressPane.removeAttribute("aria-valuetext");else{var e="";for(f in d){var g=d[f];if(g.type&&("loadstart"===g.type||"progress"===g.type)){e=
"running";break}}""===e&&null!=this._lastOperation&&this._lastOperation.type&&"error"===this._lastOperation.type&&"error"==e;switch(e){case "running":this._progressPane.title=m["Operations running"];this._progressPane.alt=m["Operations running"];this._progressPane.setAttribute("aria-valuetext",m["Operations running"]);this._switchIconTo("running");break;case "warning":this._progressPane.title=m["Some operations finished with warning"];this._progressPane.alt=m["Some operations finished with warning"];
this._progressPane.setAttribute("aria-valuetext",m["Some operations finished with warning"]);this._switchIconTo("warning");break;case "error":this._progressPane.title=m["Some operations finished with error"];this._progressPane.alt=m["Some operations finished with error"];this._progressPane.setAttribute("aria-valuetext",m["Some operations finished with error"]);this._switchIconTo("error");break;default:this._progressPane.title=m.Operations,this._progressPane.alt=m.Operations,this._progressPane.hasAttribute("aria-valuetext")&&
this._progressPane.removeAttribute("aria-valuetext"),this._switchIconTo("progressPane_empty")}}this._operationsDialog.setOperations(d,a)},_isEmpty:function(b){for(var a in b)return!1;return!0}};g.prototype.constructor=g;f.prototype={init:function(b){this._progressMonitorClass||(this._progressMonitorTool=new g(b,this._commandRegistry))},progress:function(b,a,d){var f=this,e=this._operationsIndex++;!d&&this._progressMonitorClass&&(d=new this._progressMonitorClass,d.begin(a));b.then(function(g){f._operations[e]&&
(g=f._operations[e],a&&(g.Name=a),f._lastOperation=g,g.type="loadend",d&&(g.progressMonitor=d),f.writeOperation.bind(f)(e,g,b),g.Location||f._removeOperationFromTheList.bind(f)(e))},function(g){if(f._operations[e]){var r=f._operations[e];a&&(r.Name=a);d&&(r.progressMonitor=d);f._lastOperation=r;r.type=g.canceled?"abort":"error";r.error=g;f.writeOperation.bind(f)(e,r,b);r.Location||f._removeOperationFromTheList.bind(f)(e)}},function(g){a&&(g.Name=a);d&&(g.progressMonitor=d);f.writeOperation.bind(f)(e,
g,b)});return b},removeOperation:function(b){for(var a in this._operations)if(this._operations[a].Location&&this._operations[a].Location===b){this._removeOperationFromTheList(a);break}this._operationsClient.removeOperation.bind(this._operationsClient)(b)},_removeOperationFromTheList:function(b){var a=this._operations[b].progressMonitor;delete this._operations[b];delete this._operationDeferrds[b];a?a.done():this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},
removeCompletedOperations:function(){for(var b in this._operations){var a=this._operations[b];a.type&&("loadstart"!==a.type&&"progress"!==a.type)&&((a=this._operations[b].progressMonitor)&&a.done(),delete this._operations[b],delete this._operationDeferrds[b])}this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},setProgressResult:function(b){this._serviceRegistry.getService("orion.page.message").setProgressResult(b)},showWhile:function(b,a,d){a&&this._serviceRegistry.getService("orion.page.message").setProgressMessage(a);
var f=this;b.then(function(a){f._serviceRegistry.getService("orion.page.message").setProgressMessage("")},function(a){d?f._serviceRegistry.getService("orion.page.message").setProgressMessage(""):f.setProgressResult.bind(f)(a);return a});return this.progress(b,a)},writeOperation:function(b,a,d){this._operations[b]=a;this._operationDeferrds[b]=d;a.Location&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/operations").then(function(b){b.put(a.Location,{Name:a.Name,expires:a.expires})});
a.progressMonitor?a.progressMonitor.progress(a.Name):this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)}};f.prototype.constructor=f;return{ProgressService:f}});define("orion/dialogs",[],function(){function m(m){this._serviceRegistry=m;this._serviceRegistration=m.registerService("orion.page.dialog",this)}m.prototype={confirm:function(m,k){k(window.confirm(m))},openFiles:function(m){}};m.prototype.constructor=m;return{DialogService:m}});
define("orion/webui/treetable",["i18n!orion/nls/messages","orion/webui/littlelib"],function(m,n){function k(e){this._init(e)}k.prototype={_init:function(e){var d=e.parent,g=this,d=n.node(d);if(!d)throw m["no parent"];if(!e.model)throw m["no tree model"];if(!e.renderer)throw m["no renderer"];this._parent=d;this._treeModel=e.model;this._onComplete=e.onComplete;this._renderer=e.renderer;this._showRoot=void 0===e.showRoot?!1:e.showRoot;this._indent=void 0===e.indent?16:e.indent;this._onCollapse=e.onCollapse;
this._labelColumnIndex=void 0===e.labelColumnIndex?0:e.labelColumnIndex;this._id=void 0===e.id?"treetable":e.id;this._tableStyle=e.tableStyle;this._tableElement=e.tableElement||"table";this._tableBodyElement=e.tableBodyElement||"tbody";this._tableRowElement=e.tableRowElement||"tr";this._treeModel.getRoot(function(d){g._root=d;g._showRoot?(d._depth=0,g._generate([d],0)):g._treeModel.getChildren(d,function(b){g.destroyed||g._generate(b,0)})})},destroy:function(){this.destroyed=!0},_generate:function(e,
d){n.empty(this._parent);var g=document.createElement("div");this._renderer.wrapperCallback&&this._renderer.wrapperCallback(g);var f=document.createElement(this._tableElement);this._renderer.tableCallback&&this._renderer.tableCallback(f);f.id=this._id;this._tableStyle&&f.classList.add(this._tableStyle);this._renderer.initTable(f,this);this._bodyElement=document.createElement(this._tableBodyElement);this._renderer.bodyCallback&&this._renderer.bodyCallback(this._bodyElement);this._bodyElement.id=this._id+
"tbody";0===e.length?this._renderer.emptyCallback&&this._renderer.emptyCallback(this._bodyElement):this._generateChildren(e,d);f.appendChild(this._bodyElement);g.appendChild(f);this._parent.appendChild(g);this._rowsChanged();this._onComplete&&this._onComplete(this)},_generateChildren:function(e,d,g){for(var f=0;f<e.length;f++){var b=document.createElement(this._tableRowElement);b.id=this._treeModel.getId(e[f]);b._depth=d;b._item=e[f];this._renderer.render(e[f],b);var a=this._indent*d;b.childNodes[Math.min(b.childNodes.length-
1,this._labelColumnIndex)].style.paddingLeft=a+"px";this._renderer.rowCallback&&this._renderer.rowCallback(b,e[f]);g?(this._bodyElement.insertBefore(b,g.nextSibling),g&&(g=b)):this._bodyElement.appendChild(b)}},_rowsChanged:function(){this._renderer.rowsChanged&&this._renderer.rowsChanged()},getSelected:function(){return this._renderer.getSelected()},refresh:function(e,d,g){var f=this._treeModel.getId(e),b;if(f===this._id)this._removeChildRows(f),this._generateChildren(d,0),this._rowsChanged();else if(f===
this._treeModel.getId(this._root)&&e.removeAll)this._removeAllRows(),this._generateChildren(d,0),this._rowsChanged();else{var a=n.node(f);a?(a._item=e,a&&(g||a._expanded)?(this._removeChildRows(f),d?(a._expanded=!0,this._renderer.updateExpandVisuals(a,!0),this._generateChildren(d,a._depth+1,a),this._rowsChanged()):(b=this,this._renderer.updateExpandVisuals(a,"progress"),d=this._treeModel.getChildren(a._item,function(d){b.destroyed||(b._renderer.updateExpandVisuals(a,!0),a._expanded||(a._expanded=
!0,b._generateChildren(d,a._depth+1,a),b._rowsChanged()))}))):this._renderer.updateExpandVisuals(a,!1)):console.log(m["could not find table row "]+f)}},getItem:function(e){var d=n.node(e);return d&&d._item?d._item:e},toggle:function(e){var d=n.node(e);d&&(d._expanded?this.collapse(e):this.expand(e))},isExpanded:function(e){e="string"===typeof e?e:this._treeModel.getId(e);return(e=n.node(e))?e._expanded:!1},expand:function(e,d,g){e="string"===typeof e?e:this._treeModel.getId(e);var f=n.node(e);if(f){var b=
this;f._expanded?d&&d.apply(b,g):(this._renderer.updateExpandVisuals(f,"progress"),this._treeModel.getChildren(f._item,function(a){b.destroyed||(b._renderer.updateExpandVisuals(f,!0),f._expanded||(f._expanded=!0,b._generateChildren(a,f._depth+1,f),b._rowsChanged()),d&&d.apply(b,g))}))}},_removeChildRows:function(e){for(var d=e===this._id,g=!1,f=-1,b=[],a=n.$$array(".treeTableRow",this._parent),l=0;l<a.length;l++){var h=a[l];if(g)break;d?h._depth>f?b.push(h):g=!0:h.id===e&&(d=!0,f=h._depth)}for(e=
0;e<b.length;e++)d=b[e],d.parentNode.removeChild(d)},_removeAllRows:function(){for(var e=n.$$array(".treeTableRow",this._parent),d=0;d<e.length;d++)e[d].parentNode.removeChild(e[d])},collapse:function(e){e="string"===typeof e?e:this._treeModel.getId(e);var d=n.node(e);if(d){if(!d._expanded)return;d._expanded=!1;this._renderer.updateExpandVisuals(d,!1);this._removeChildRows(e);this._rowsChanged()}this._onCollapse&&this._onCollapse(d._item)},getIndent:function(){return this._indent}};k.prototype.constructor=
k;return{TableTree:k}});
define("orion/treeModelIterator",[],function(){var m={};m.TreeModelIterator=function(){function m(k,e){this.firstLevelChildren=k;this.reset();this._init(e)}m.prototype={_init:function(k){k&&(this.isExpanded=k.isExpanded,this.isExpandable=k.isExpandable,this.forceExpandFunc=k.forceExpandFunc,this.getChildrenFunc=k.getChildrenFunc)},topLevel:function(k){return k.parent?k.parent===this.root:!0},_getChildren:function(k){return"function"===typeof this.getChildrenFunc?this.getChildrenFunc(k):k?k.children:
null},_expanded:function(k){if(!k)return!0;var e=this._getChildren(k),e=e&&0<e.length;this.isExpanded&&e&&(e=this.isExpanded(k));return e},_expandable:function(k){return!k?!0:this.isExpandable?this.isExpandable(k):!1},_diveIn:function(k){return this._expanded(k)?(k=this._getChildren(k),this.setCursor(k[0]),this.cursor()):null},_drillToLast:function(k){return this._expanded(k)?(k=this._getChildren(k),this._drillToLast(k[k.length-1])):k},_forward:function(k){if(!this._cursor)return null;var e=this._diveIn(this._cursor);
if(!e){if(k&&this._expandable(this._cursor)&&this.forceExpandFunc){var d=this;return this.forceExpandFunc(this._cursor,"first",function(e){e&&d.setCursor(e)})}(e=this._findSibling(this._cursor,!0))&&this.setCursor(e)}return e},_backward:function(k){if(!this._cursor)return null;var e=this._findSibling(this._cursor,!1);e&&e!==this._cursor.parent&&(e=this._drillToLast(e));if(k&&e&&this._expandable(e)&&this.forceExpandFunc&&e!==this._cursor.parent){var d=this;return this.forceExpandFunc(e,"last",function(e){e&&
d.setCursor(e)})}e&&this.setCursor(e);return e},_findSibling:function(k,e){for(var d=this.topLevel(k),g=this._getChildren(k.parent),g=d?this.firstLevelChildren:g,f=0;f<g.length;f++)if(g[f]===k)return 0===f&&!e?d?null:k.parent:f===g.length-1&&e?d?null:this._findSibling(k.parent,e):e?g[f+1]:g[f-1];return null},_inParentChain:function(k,e){for(var d=k.parent;d;){if(d===e)return!0;d=d.parent}return!1},_getTopLevelParent:function(k){if(this.topLevel(k))return k;for(k=k.parent;k;){if(this.topLevel(k))return k;
k=k.parent}return null},_onCollapse:function(k){return this._expanded(k.parent)?k:this._onCollapse(k.parent)},_scan:function(k,e,d){this.setCursor(e);var g=[];for(g.push(e);;){if(this.iterate(k))g.push(this.cursor());else break;if(d===this.cursor())return g}return null},setCursor:function(k){this._prevCursor=this._cursor;this._cursor=k},setTree:function(k){this.firstLevelChildren=k;0<this.firstLevelChildren.length&&(this.root=this.firstLevelChildren[0].parent)},scan:function(k,e){var d=this.cursor(),
g=this._scan(!0,k,e);g||(g=this._scan(!1,k,e));this.setCursor(d);return g},iterate:function(k,e){return k?this._forward(e):this._backward(e)},iterateOnTop:function(k,e){var d=this._findSibling(this._getTopLevelParent(this.cursor()),k);d?this.setCursor(d):e&&0<this.firstLevelChildren.length&&this.setCursor(k?this.firstLevelChildren[0]:this.firstLevelChildren[this.firstLevelChildren.length-1])},collapse:function(k){return!this._cursor?null:this._inParentChain(this._cursor,k)?(this.setCursor(k),this._cursor):
null},reset:function(){this.root=this._prevCursor=this._cursor=null;0<this.firstLevelChildren.length&&(this._cursor=this.firstLevelChildren[0],this.root=this.firstLevelChildren[0].parent)},cursorMoved:function(){return this._cursor!==this._prevCursor},cursor:function(){return this._cursor},prevCursor:function(){return this._prevCursor}};return m}();return m});
define("orion/explorers/explorerNavHandler",["orion/webui/littlelib","orion/treeModelIterator","orion/uiUtils"],function(m,n,k){var e={},d=-1!==navigator.userAgent.indexOf("iPad"),g=-1!==window.navigator.platform.indexOf("Mac");e.ExplorerNavHandler=function(){function f(b,a,d){this.explorer=b;this.model=this.explorer.model;this._navDict=a;this._listeners=[];this._selections=[];this._currentColumn=0;b=this._getEventListeningDiv();b.tabIndex=0;b.classList.add("selectionModelContainer");var f=this;this._modelIterator=
new n.TreeModelIterator([],{isExpanded:this.isExpanded.bind(this),getChildrenFunc:d.getChildrenFunc,isExpandable:this.explorer.renderer.isExpandable?function(a){return f.explorer.renderer.isExpandable(a)}:function(a){return f.isExpandable(a)},forceExpandFunc:this.explorer.forceExpandFunc?function(a,b,d){return f.explorer.forceExpandFunc(a,b,d)}:void 0});this._init(d);(!d||!1!==d.setFocus)&&b.focus();d=function(a){if(k.isFormElement(a.target)||f.explorer.preventDefaultFunc&&f.explorer.preventDefaultFunc(a,
f._modelIterator.cursor()))return!0;if(a.keyCode===m.KEY.DOWN)return f.onDownArrow(a);if(a.keyCode===m.KEY.UP)return f.onUpArrow(a);if(a.keyCode===m.KEY.RIGHT)return f.onRightArrow(a);if(a.keyCode===m.KEY.LEFT)return f.onLeftArrow(a);if(a.keyCode===m.KEY.SPACE)return f.onSpace(a);if(a.keyCode===m.KEY.ENTER)return f.onEnter(a)};b.addEventListener("keydown",d,!1);this._listeners.push({type:"keydown",listener:d});d=function(a){if(f.explorer.onFocus)f.explorer.onFocus(!1);else f.toggleCursor(null,!1)};
b.addEventListener("blur",d,!1);this._listeners.push({type:"blur",listener:d});d=function(a){if(f.explorer.onFocus)f.explorer.onFocus(!0);else f.toggleCursor(null,!0)};b.addEventListener("focus",d,!1);this._listeners.push({type:"focus",listener:d});this._parentDiv=b}f.prototype={destroy:function(){this._parentDiv.classList.remove("selectionModelContainer");this.removeListeners()},_init:function(b){this._linearGridMove=!1;b&&(this._selectionPolicy=b.selectionPolicy,this.gridClickSelectionPolicy=b.gridClickSelectionPolicy||
"none",this.preventDefaultFunc=b.preventDefaultFunc,this.postDefaultFunc=b.postDefaultFunc)},_ctrlKeyOn:function(b){return g?b.metaKey:b.ctrlKey},removeListeners:function(){if(this._listeners)for(var b=0;b<this._listeners.length;b++)this._parentDiv.removeEventListener(this._listeners[b].type,this._listeners[b].listener,!1)},focus:function(){var b=this._getEventListeningDiv();b&&b.focus()},_getEventListeningDiv:function(b){return this.explorer.keyEventListeningDiv&&"function"===typeof this.explorer.keyEventListeningDiv?
this.explorer.keyEventListeningDiv(b):m.node(this.explorer._parentId)},isExpandable:function(b){return!b?!1:m.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(b)))?!0:!1},isExpanded:function(b){return!b?!1:this.explorer.myTree.isExpanded(this.model.getId(b))},refreshSelection:function(b,a){var d=this;this.explorer.selection&&this.explorer.selection.getSelections(function(f){d._clearSelection(a);for(var e=0;e<f.length;e++)d._selections.push(f[e]);0<d._selections.length?d.cursorOn(d._selections[0],
!0,!1,b):d.cursorOn(null,!1,!1,b);d._shiftSelectionAnchor&&0<=d._inSelection(d._shiftSelectionAnchor)||(d._shiftSelectionAnchor=null)})},refreshModel:function(b,a,d,f){this._currentColumn=0;this.topIterationNodes=[];this.model=a;this._navDict=b;this.model.getTopIterationNodes?this.topIterationNodes=this.model.getTopIterationNodes():d&&(this.topIterationNodes=d);this._modelIterator.setTree(this.topIterationNodes);!f&&this.explorer.selection&&(this.toggleCursor(this._modelIterator.cursor(),!1),this._modelIterator.reset());
this.refreshSelection(!0)},getTopLevelNodes:function(){return this._modelIterator.firstLevelChildren},_inSelection:function(b){b=this.model.getId(b);for(var a=0;a<this._selections.length;a++)if(b===this.model.getId(this._selections[a]))return a;return-1},_clearSelection:function(b){if(b)for(b=0;b<this._selections.length;b++)this._checkRow(this._selections[b],!0);this._selections=[]},getSelectionPolicy:function(){return this._selectionPolicy},setSelectionPolicy:function(b){this._selectionPolicy!==
b&&(("readonlySelection"===this._selectionPolicy||"readonlySelection"===b)&&this._toggleSelectionClass("disabledRow","readonlySelection"===b),this._selectionPolicy=b,"cursorOnly"===this._selectionPolicy&&this._clearSelection(!0))},setSelection:function(b,a,d){"readonlySelection"!==this._selectionPolicy&&("cursorOnly"===this._selectionPolicy?a&&this.explorer.renderer._useCheckboxSelection&&this._checkRow(b,!0):this._isRowSelectable(b)&&(!a||"singleSelection"===this._selectionPolicy?(this._clearSelection(!0),
this._checkRow(b,!1),this._selections.push(b),this._lastSelection=b):(a=this._inSelection(b),0<=a?(this._checkRow(b,!0),this._selections.splice(a,1)):(this._checkRow(b,!1),this._selections.push(b),this._lastSelection=b)),d&&(this._shiftSelectionAnchor=this._lastSelection),this.explorer.selection&&(this.explorer.renderer.storeSelections(),this.explorer.selection.setSelections(this._selections))))},moveColumn:function(b,a){b||(b=this.currentModel());var d=this._getGridChildren(b);if(d&&1<d.length||
0===a&&d){0!==a&&this.toggleCursor(b,!1);var f=this._currentColumn,e=!0,f=f+a;0>f?(this._linearGridMove&&0!==a&&(this._modelIterator.iterate(!1)?b=this.currentModel():e=!1),f=e?d.length-1:this._currentColumn):f>=d.length&&(this._linearGridMove&&0!==a&&(this._modelIterator.iterate(!0)?b=this.currentModel():e=!1),f=e?0:this._currentColumn);this._currentColumn=f;0!==a&&this.toggleCursor(b,!0);return!0}return!1},_getGridChildren:function(b){return this._navDict?this._navDict.getGridNavHolder(b):null},
getCurrentGrid:function(b){b||(b=this.currentModel());return(b=this._getGridChildren(b))&&0<b.length?b[this._currentColumn]:null},getAriaContainerElement:function(b){for(var a=this._parentDiv,d;b&&b!==a&&"grid"!==(d=b.getAttribute("role"))&&"tree"!==d&&"treegrid"!==d;)b=b.parentNode;return b===a?null:b},toggleCursor:function(b,a){var d=this.getRowDiv(b),f=this.getCurrentGrid(b);f?(d&&(a?d.classList.add("treeIterationCursorRow"):d.classList.remove("treeIterationCursorRow")),f.domNode&&(d=this.getAriaContainerElement(f.domNode),
a?(f.domNode.classList.add("treeIterationCursor"),d&&d.setAttribute("aria-activedescendant",f.domNode.id)):f.domNode.classList.remove("treeIterationCursor"))):d&&(a?d.classList.add("treeIterationCursorRow_Dotted"):d.classList.remove("treeIterationCursorRow_Dotted"))},currentModel:function(){return this._modelIterator.cursor()},cursorOn:function(b,a,d,f){var e,g;if(b||a){if(g===this._modelIterator.cursor())return;e=this._modelIterator.cursor();g=b;this._modelIterator.setCursor(g)}else e=this._modelIterator.prevCursor(),
g=this._modelIterator.cursor();if(e!==g||a)if(this.toggleCursor(e,!1),!a||g){this.moveColumn(null,0);this.toggleCursor(g,!0);if((b=this.getRowDiv())&&!f){f=b.parentNode;for(a=document.documentElement;f&&f!==a;){var r=window.getComputedStyle(f,null);if(!r)break;r=r.getPropertyValue("overflow-y");if("auto"===r||"scroll"===r)break;f=f.parentNode}f&&(a=!0,b.offsetTop<=f.scrollTop?(a=!1,void 0===d&&(d=!1)):b.offsetTop+b.offsetHeight>=f.scrollTop+f.clientHeight&&(a=!1,void 0===d&&(d=!0)),a||b.scrollIntoView(!d))}if(this.explorer.onCursorChanged)this.explorer.onCursorChanged(e,
g)}},getSelection:function(){return this._selections},getSelectionIds:function(){for(var b=[],a=0;a<this._selections.length;a++)b.push(this.model.getId(this._selections[a]));return b},getRowDiv:function(b){b=b?b:this._modelIterator.cursor();if(!b)return null;b=this.model.getId(b);var a=this._navDict.getValue(b);return a&&a.rowDomNode?a.rowDomNode:m.node(b)},iterate:function(b,a,d,f){var e=null;if(this.topIterationNodes&&0!==this.topIterationNodes.length)if(f){f=this.currentModel();for((e=this._modelIterator.iterate(b,
a))&&this._setCursorOnItem(b,d);e&&e.isNotSelectable;)(e=this._modelIterator.iterate(b,a))&&this._setCursorOnItem(b,d);e||(this.cursorOn(f,!0,!1,!0),this._setCursorOnItem(b,d))}else(e=this._modelIterator.iterate(b,a))&&this._setCursorOnItem(b,d)},_toggleSelectionClass:function(b,a){this._selections.forEach(function(d){(d=this.getRowDiv(d))&&(a?d.classList.add(b):d.classList.remove(b))}.bind(this))},_setCursorOnItem:function(b,a){this.cursorOn(null,!1,b);if(a){var d=this._inSelection(this._modelIterator.prevCursor()),
f=this._inSelection(this._modelIterator.cursor());0<=d&&0<=f?this.setSelection(this._modelIterator.prevCursor(),!0):this.setSelection(this.currentModel(),!0)}},_checkRow:function(b,a){if(this.explorer.renderer._useCheckboxSelection&&"singleSelection"!==this._selectionPolicy){var d=this.getRowDiv(b);if(d){var f=m.node(this.explorer.renderer.getCheckBoxId(d.id)),e=a?!f.checked:!0;if(e!==f.checked)this.explorer.renderer.onCheck(d,f,e,!0)}}else this._select(b,a)},_select:function(b,a){b||(b=this._modelIterator.cursor());
var d=this.getRowDiv(b);d&&(0>this._inSelection(b)?d.classList.add("checkedRow"):d.classList.remove("checkedRow"))},_onModelGrid:function(b,a){var d=this._getGridChildren(b);if(d)for(var f=0;f<d.length;f++)if(a.target===d[f].domNode)return!0;return!1},onClick:function(b,a){if("readonlySelection"===this._selectionPolicy||this.isDisabled(this.getRowDiv(b)))m.stop(a);else{var f=m.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(b)));if(a.target!==f&&!("none"===this.gridClickSelectionPolicy&&
this._onModelGrid(b,a)))if(this.cursorOn(b,!0,!1,!0),d)this.setSelection(b,!0);else if(this._ctrlKeyOn(a))this.setSelection(b,!0,!0);else if(a.shiftKey&&this._shiftSelectionAnchor){if(f=this._modelIterator.scan(this._shiftSelectionAnchor,b)){this._clearSelection(!0);for(var h=0;h<f.length;h++)this.setSelection(f[h],!0)}}else this.setSelection(b,!1,!0)}},onCollapse:function(b){this._modelIterator.collapse(b)&&this.cursorOn()},onUpArrow:function(b){this.iterate(!1,!1,b.shiftKey,!0);!this._ctrlKeyOn(b)&&
!b.shiftKey&&this.setSelection(this.currentModel(),!1,!0);b.preventDefault();return!1},onDownArrow:function(b){this.iterate(!0,!1,b.shiftKey,!0);!this._ctrlKeyOn(b)&&!b.shiftKey&&this.setSelection(this.currentModel(),!1,!0);b.preventDefault();return!1},_shouldMoveColumn:function(b){var a=this.currentModel(),d=this._getGridChildren(a);return d&&1<d.length?this.isExpandable(a)?this._ctrlKeyOn(b):!0:!1},onLeftArrow:function(b){if(this._shouldMoveColumn(b))return this.moveColumn(null,-1),b.preventDefault(),
!0;var a=this._modelIterator.cursor();if(!a)return!1;if(this.isExpandable(a)&&this.isExpanded(a))return this.explorer.myTree.collapse(a),b.preventDefault(),!0;this._modelIterator.topLevel(a)?this.explorer.scopeUp&&"function"===typeof this.explorer.scopeUp&&this.explorer.scopeUp():(this.cursorOn(a.parent),this.setSelection(a.parent,!1,!0))},onRightArrow:function(b){if(this._shouldMoveColumn(b))return this.moveColumn(null,1),b.preventDefault(),!0;var a=this._modelIterator.cursor();if(!a)return!1;if(this.isExpandable(a)&&
!this.isExpanded(a))return this.explorer.myTree.expand(a),this.explorer.postUserExpand&&this.explorer.postUserExpand(this.model.getId(a)),b.preventDefault(),!1},_isRowSelectable:function(b){return this.explorer.isRowSelectable?this.explorer.isRowSelectable(b):!0},onSpace:function(b){this.setSelection(this.currentModel(),!0,!0);b.preventDefault()},onEnter:function(b){var a=this.getCurrentGrid(this._modelIterator.cursor());if(a)if(a.widget)if("function"===typeof a.onClick)a.onClick();else"function"===
typeof a.widget.focus&&a.widget.focus();else{var d=document.createEvent("MouseEvents");d.initMouseEvent("click",!0,!0,window,0,0,0,0,0,this._ctrlKeyOn(b),!1,!1,!1,0,null);a.domNode.dispatchEvent(d)}else if(a=this._modelIterator.cursor())if(this.explorer.renderer.getRowActionElement&&(d=this.explorer.renderer.getRowActionElement(this.model.getId(a)),d.href&&(this._ctrlKeyOn(b)?window.open(d.href):window.location.href=d.href)),this.explorer.renderer.performRowAction)return this.explorer.renderer.performRowAction(b,
a),b.preventDefault(),!1},setIsNotSelectable:function(b,a){b.isNotSelectable=a},disableItem:function(b){var a=this.getRowDiv(b);this.isExpandable(b)&&this.isExpanded(b)&&(this._modelIterator.collapse(b),this.explorer.myTree.toggle(a.id));a.classList.remove("checkedRow");a.classList.add("disabledNavRow");this.setIsNotSelectable(b,!0)},isDisabled:function(b){return b.classList.contains("disabledNavRow")},enableItem:function(b){var a=this.getRowDiv(b);a&&(a.classList.remove("disabledNavRow"),this.setIsNotSelectable(b,
!1))}};return f}();e.ExplorerNavDict=function(){function d(b){this._dict={};this._model=b}d.prototype={addRow:function(b,a){var d=this._model.getId(b);this._dict[d]={model:b,rowDomNode:a}},getValue:function(b){return this._dict[b]},getGridNavHolder:function(b,a){if(!b)return null;var d=this._model.getId(b);return this._dict[d]?(!this._dict[d].gridChildren&&a&&(this._dict[d].gridChildren=[]),this._dict[d].gridChildren):null},initGridNavHolder:function(b){if(!b)return null;b=this._model.getId(b);this._dict[b]&&
(this._dict[b].gridChildren=null)}};return d}();return e});
define("orion/explorers/explorer","i18n!orion/nls/messages require orion/webui/littlelib orion/webui/treetable orion/explorers/explorerNavHandler orion/commands".split(" "),function(m,n,k,e,d,g){var f={};f.Explorer=function(){function b(a,b,d,f){this.registry=a;this.renderer=d;this.selection=b;this.commandService=f;this.renderer&&(this.renderer.explorer=this);this.myTree=null}b.prototype={destroy:function(){this._navHandler&&this._navHandler.destroy();this.model&&this.model.destroy();this.myTree&&
this.myTree.destroy();this.destroyed=!0},changedItem:function(a,b){this.myTree&&this.myTree.refresh.bind(this.myTree)(a,b,!0)},updateCommands:function(a){this.myTree&&this.myTree._renderer.updateCommands.bind(this.myTree._renderer)(a)},makeNewItemPlaceholder:function(a,b,d){var f=null;if(a=this.getRow(a)){var f=a.parentNode,e=document.createElement("tr");e.id=b+"placeHolderRow";e.classList.add("navRow");var g=document.createElement("td");g.id=b+"placeHolderCol";g.classList.add("navColumn");e.appendChild(g);
d?f.insertBefore(e,a.nextSibling):f.insertBefore(e,a);g.style.paddingLeft=a.firstChild.style.paddingLeft;f={wrapperNode:e,refNode:g,destroyFunction:function(){try{e&&e.parentNode&&e.parentNode.removeChild(e)}catch(a){}}}}return f},getRow:function(a){if(a=this.model.getId(a))return k.node(a)},collapseAll:function(){for(var a=this._navHandler.getTopLevelNodes(),b=0;b<a.length;b++)this.myTree.collapse(a[b])},expandAll:function(a){if(a)this._expandRecursively(a);else if(this._navHandler){a=this._navHandler.getTopLevelNodes();
for(var b=0;b<a.length;b++)this._expandRecursively(a[b])}},_expandRecursively:function(a){if(this._navHandler&&this._navHandler.isExpandable(a)){var b=this;this.myTree.expand(a,function(){b.model.getChildren(a,function(a){if(!(void 0===a||null===a))for(var d=a.length,f=0;f<d;f++)b._expandRecursively(a[f])})})}},createTree:function(a,b,f){a="string"===typeof a?a:a.id||a;this.selection&&this.selection.setSelections([]);this.getNavHandler()&&this.getNavHandler()._clearSelection();var p=a+"innerTree",
g=k.node(p);g&&k.empty(g);b&&(b.rootId=p);this.model=b;this._parentId=a;this._treeOptions=f;if(!f||f&&!f.noSelection)this.selectionPolicy=f?f.selectionPolicy:"",this._navDict=new d.ExplorerNavDict(this.model);this.myTree=new e.TableTree({id:p,model:b,parent:a,onComplete:f?f.onComplete:void 0,labelColumnIndex:this.renderer.getLabelColumnIndex(),renderer:this.renderer,showRoot:f?!!f.showRoot:!1,indent:f?f.indent:void 0,onCollapse:f?f.onCollapse:void 0,navHandlerFactory:f?f.navHandlerFactory:void 0,
tableElement:f?f.tableElement:void 0,tableBodyElement:f?f.tableBodyElement:void 0,tableRowElement:f?f.tableRowElement:void 0});this.renderer._initializeUIState();"cursorOnly"===this.selectionPolicy&&this.initNavHandler()},getNavHandler:function(){return this._navHandler},getNavDict:function(){return this._navDict},refreshSelection:function(){if(this.selection){var a=this.getNavHandler(),b=[];if(a&&this.getNavDict())for(var d=a.getSelection(),f=0;f<d.length;f++){var e=a.getRowDiv(d[f]);e&&e.parentNode&&
(e=this.getNavDict().getValue(this.model.getId(d[f])),e.model&&b.push(e.model))}this.selection.setSelections(b)}},getRootPath:function(){return this.model&&this.model.root?this.model.root.Location:null},initNavHandler:function(){var a=this._treeOptions;if(!a||a&&!a.noSelection){this.getNavHandler()||(this._navHandler=a&&a.navHandlerFactory&&"function"===typeof a.navHandlerFactory.createNavHandler?a.navHandlerFactory.createNavHandler(this,this._navDict,a):new d.ExplorerNavHandler(this,this._navDict,
{getChildrenFunc:a?a.getChildrenFunc:null,setFocus:a&&a.setFocus,selectionPolicy:a?a.selectionPolicy:null}));var b=this;this.model.getRoot(function(d){d instanceof Array?b.getNavHandler().refreshModel(b.getNavDict(),b.model,d):d.children&&d.children instanceof Array&&b.getNavHandler().refreshModel(b.getNavDict(),b.model,d.children);a&&a.setFocus&&b.getNavHandler().cursorOn(null,!1,!1,!0)})}},_lastHash:null,checkbox:!1};return b}();f.createExplorerCommands=function(b,a){function d(b){return"function"===
typeof b.getItemCount&&0<b.getItemCount()?a?a(b):!0:!1}var f=new g.Command({tooltip:m["Expand all"],imageClass:"core-sprite-expandAll",id:"orion.explorer.expandAll",groupId:"orion.explorerGroup",visibleWhen:function(a){return d(a)},callback:function(a){a.items.expandAll()}}),e=new g.Command({tooltip:m["Collapse all"],imageClass:"core-sprite-collapseAll",id:"orion.explorer.collapseAll",groupId:"orion.explorerGroup",visibleWhen:function(a){return d(a)},callback:function(a){a.items.collapseAll()}});
b.addCommand(f);b.addCommand(e)};f.ExplorerModel=function(){function b(a,b,d){this.rootPath=a;this.fetchItems=b;this.idPrefix=d||""}b.prototype={destroy:function(){this.destroyed=!0},getRoot:function(a){var b=this;this.fetchItems(this.rootPath).then(function(d){b.root=d;a(d)})},getChildren:function(a,b){a.Children?b(a.Children):a.ChildrenLocation?this.fetchItems(a.ChildrenLocation).then(function(d){a.Children=d;b(d)}):b([])},getId:function(a){if(a.Location===this.root.Location)return this.rootId;
a=a.Location.replace(/[\\\/]/g,"");for(var b=this.idPrefix,d=0;d<a.length;d++)b=a[d].match(/[^\.\:\-\_0-9A-Za-z]/g)?b+a.charCodeAt(d):b+a[d];return b}};return b}();f.ExplorerFlatModel=function(){function b(a,b,d){this.rootPath=a;this.fetchItems=b;this.root=d}b.prototype=new f.ExplorerModel;b.prototype.getRoot=function(a){if(this.root)a(this.root);else{var b=this;this.fetchItems(this.rootPath).then(function(d){b.root=d;a(d)})}};b.prototype.getChildren=function(a,b){a===this.root?b(this.root):b([])};
return b}();f.ExplorerRenderer=function(){function b(a,b){this.explorer=b;this._init(a);this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._progressImageClass="core-sprite-progress";this._twistieSpriteClass="modelDecorationSprite"}b.prototype={_init:function(a){a&&(this._useCheckboxSelection=void 0===a.checkbox?!1:a.checkbox,this.selectionPolicy=a.singleSelection?"singleSelection":"",this._cachePrefix=a.cachePrefix,a.getCheckedFunc&&(this.getCheckedFunc=
a.getCheckedFunc),a.onCheckedFunc&&(this.onCheckedFunc=a.onCheckedFunc),this._noRowHighlighting=a.noRowHighlighting,this._highlightSelection=!0,this._treeTableClass=a.treeTableClass||"treetable",!1===a.highlightSelection&&(this._highlightSelection=!1),this.actionScopeId||(this.actionScopeId=a.actionScopeId),this.commandService||(this.commandService=a.commandService))},getLabelColumnIndex:function(){return this.explorer.checkbox?1:0},initTable:function(a,b){this.tableTree=b;this.tableNode=a;k.empty(a);
this._treeTableClass&&a.classList.add(this._treeTableClass);this.renderTableHeader(a)},getActionsColumn:function(a,b,d,f,e){d=d||"tool";var g=document.createElement("td");g.id=b.id+"actionswrapper";f&&g.classList.add(f);this.actionScopeId&&this.commandService?this.commandService.renderCommands(this.actionScopeId,g,a,this.explorer,d,null,e&&this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(a,!0):null):window.console.log("Warning, no command service or action scope was specified.  No commands rendered.");
return g},initCheckboxColumn:function(a){if(this._useCheckboxSelection)return document.createElement("th")},getCheckboxColumn:function(a,b){if(this._useCheckboxSelection){var d=document.createElement("td"),f=document.createElement("span");f.id=this.getCheckBoxId(b.id);f.classList.add("core-sprite-check");f.classList.add("selectionCheckmarkSprite");f.rowId=b.id;this.getCheckedFunc&&(f.checked=this.getCheckedFunc(a),f.checked?(this._highlightSelection&&b.classList.add("checkedRow"),f.classList.add("core-sprite-check_on")):
(this._highlightSelection&&b.classList.remove("checkedRow"),f.classList.remove("core-sprite-check_on")));d.appendChild(f);var e=this;f.addEventListener("click",function(d){e.onCheck(b,d.target,d.target.checked?!1:!0,!0,!1,a)},!1);return d}},getCheckBoxId:function(a){return a+"selectedState"},onCheck:function(a,b,d,f,e,g){(b.checked=d)?b.classList.add("core-sprite-check_on"):b.classList.remove("core-sprite-check_on");if(this.onCheckedFunc)this.onCheckedFunc(b.rowId,d,f,g);this.explorer.getNavHandler()&&
e&&this.explorer.getNavHandler().setSelection(this.explorer.getNavDict().getValue(a.id).model,!0)},storeSelections:function(){if(this.explorer.getNavHandler()){var a=this.explorer.getNavHandler().getSelectionIds(),b=this._getUIStatePreferencePath();b&&window.sessionStorage&&(window.sessionStorage[b+"selection"]=JSON.stringify(a))}},_restoreSelections:function(a){var b=this.explorer.getNavDict(),d=this.explorer.getNavHandler();if(d&&(b&&"cursorOnly"!==d.getSelectionPolicy())&&(a=window.sessionStorage[a+
"selection"],"string"===typeof a&&(a=0<a.length?JSON.parse(a):null),a)){for(var f=[],d=0;d<a.length;d++){var e=b.getValue(a[d]);if(e&&(e.rowDomNode&&e.model)&&(f.push(e.model),this._highlightSelection&&e.rowDomNode.classList.add("checkedRow"),e=k.node(this.getCheckBoxId(e.rowDomNode.id))))e.checked=!0,e.classList.add("core-sprite-check_on")}this.explorer.selection&&(this.explorer.selection.setSelections(f),this.explorer.getNavHandler()&&this.explorer.getNavHandler().refreshSelection())}},_storeExpansions:function(a){window.sessionStorage[a+
"expanded"]=JSON.stringify(this._expanded)},_restoreExpansions:function(a){var b=!1,d=window.sessionStorage[a+"expanded"];"string"===typeof d&&(d=0<d.length?JSON.parse(d):null);var f;if(d)for(f=0;f<d.length;f++)if(k.node(d[f])){this._expanded.push(d[f]);var e=this;this.tableTree.expand(d[f],function(){e._restoreSelections(a)});b=!0}return!b},_getUIStatePreferencePath:function(){if(this.explorer){var a=this.explorer.getRootPath();if(this._cachePrefix&&a)return a=a.replace(/[^\.\:\-\_0-9A-Za-z]/g,""),
"/"+this._cachePrefix+"/"+a+"/uiState"}return null},expandCollapseImageId:function(a){return a+"__expand"},updateExpandVisuals:function(a,b){var d=k.node(this.expandCollapseImageId(a.id));d&&(d.classList.remove(this._expandImageClass),d.classList.remove(this._collapseImageClass),d.classList.remove(this._progressImageClass),d.classList.add("progress"===b?this._progressImageClass:b?this._expandImageClass:this._collapseImageClass))},getExpandImage:function(a,b,d,f){var e=document.createElement("span");
e.id=this.expandCollapseImageId(a.id);b.appendChild(e);e.classList.add(this._twistieSpriteClass);e.classList.add(this._collapseImageClass);if(d){var g=document.createElement("span");b.appendChild(g);g.classList.add(f||"imageSprite");g.classList.add(d)}var t=this;e.onclick=function(b){if(!t.explorer.getNavHandler().isDisabled(a)){t.tableTree.toggle(a.id);if(t.tableTree.isExpanded(a.id))t._expanded.push(a.id),t.explorer.postUserExpand&&t.explorer.postUserExpand(a.id);else for(var d in t._expanded)if(t._expanded[d]===
a.id){t._expanded.splice(d,1);break}(b=t._getUIStatePreferencePath())&&window.sessionStorage&&t._storeExpansions(b)}};return e},render:function(a,b){b.classList.add("navRow");this.renderRow(a,b)},rowsChanged:function(){"cursorOnly"!==this.explorer.selectionPolicy&&(this.explorer.refreshSelection(),this.explorer.initNavHandler());this._noRowHighlighting||(k.$(".sectionTreeTable",this.tableNode.parentNode)||k.$(".treetable",this.tableNode.parentNode))&&k.$$array(".treeTableRow",this.tableNode).forEach(function(a,
b){var d=!(b%2)?"lightSectionTreeTableRow":"darkSectionTreeTableRow",f="lightSectionTreeTableRow"===d?"darkSectionTreeTableRow":"lightSectionTreeTableRow";a.classList.add(d);a.classList.remove(f)})},updateCommands:function(){if(this.commandService)for(var a=k.$$array(".treeTableRow"),b=0;b<a.length;b++){var d=a[b],f=k.node(d.id+"actionswrapper");this.commandService.destroy(f);this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,f,d._item,this.explorer,"tool")}},_initializeUIState:function(){this._expanded=
[];var a=this._getUIStatePreferencePath();a&&window.sessionStorage&&this._restoreExpansions(a)&&this._restoreSelections(a)}};return b}();f.SelectionRenderer=function(){function b(a,b){this._init(a);this.explorer=b}b.prototype=new f.ExplorerRenderer;b.prototype.renderTableHeader=function(a){var b=document.createElement("thead"),d=document.createElement("tr");b.classList.add("navTableHeading");this._useCheckboxSelection&&d.appendChild(this.initCheckboxColumn(a));for(var f=0,e=this.getCellHeaderElement(f);e;)0<
e.innerHTML.length&&e.classList.add("navColumn"),d.appendChild(e),e=this.getCellHeaderElement(++f);b.appendChild(d);0<f&&a.appendChild(b)};b.prototype.renderRow=function(a,b){b.verticalAlign="baseline";b.classList.add("treeTableRow");if(void 0===a.selectable||a.selectable){var d=this.explorer.getNavDict();if(d){"cursorOnly"!==this.explorer.selectionPolicy&&b.classList.add("selectableNavRow");d.addRow(a,b);var f=this;b.addEventListener("click",function(b){if(f.explorer.getNavHandler())f.explorer.getNavHandler().onClick(a,
b)},!1)}if(d=this.getCheckboxColumn(a,b))d.classList.add("checkColumn"),b.appendChild(d)}for(var d=0,e=this.getCellElement(d,a,b);e;)b.appendChild(e),0===d?this.getPrimColumnStyle?e.classList.add(this.getPrimColumnStyle(a)):e.classList.add("navColumn"):this.getSecondaryColumnStyle?e.classList.add(this.getSecondaryColumnStyle()):e.classList.add("secondaryColumn"),e=this.getCellElement(++d,a,b)};b.prototype.getCellHeaderElement=function(a){};b.prototype.getCellElement=function(a,b,d){};return b}();
f.SimpleFlatModel=function(){function b(a,b,d){this.items=a;this.getKey=d;this.idPrefix=b;this.root={children:a}}b.prototype=new f.ExplorerModel;b.prototype.getRoot=function(a){a(this.root)};b.prototype.getId=function(a){a=this.getKey(a).replace(/[\\\/]/g,"");for(var b="",d=0;d<a.length;d++)b=a[d].match(/[^\.\:\-\_0-9A-Za-z]/g)?b+a.charCodeAt(d):b+a[d];return this.idPrefix+b};b.prototype.getChildren=function(a,b){a===this.root?b(this.items):b([])};return b}();return f});
define("orion/widgets/browse/commitInfoRenderer",["orion/objects","orion/URITemplate","orion/webui/littlelib","orion/xhr","orion/URL-shim"],function(m,n,k,e){function d(b,a,d){return 0<b?1===b?a+" ":b+" "+d+" ":""}function g(b){b=new Date(b);var a=(new Date).getTime()-b.getTime();b=Math.floor(a/1E3/60/60/24/365);var a=a-31536E6*b,f=Math.floor(a/1E3/60/60/24/30),a=a-2592E6*f,h=Math.floor(a/1E3/60/60/24),a=a-864E5*h,e=Math.floor(a/1E3/60/60),g=Math.floor((a-36E5*e)/1E3/60),a=d(b,"a year","years"),r=
d(f,"a month","months"),t=d(h,"a day","days"),k=d(e,"an hour","hours"),g=d(g,"a minute","minutes"),m="";a?m=0<b?a:a+r:r?m=0<f?r:r+t:t?m=0<h?t:t+k:k?m=0<e?k:k+g:g&&(m=g);return m?m+"ago":"Just now"}function f(b){this._parentDomNode=k.node(b.parent);this._commitInfo=b.commitInfo}m.mixin(f.prototype,{destroy:function(){},_simpleMessage:function(b){var a=this._commitInfo.Message?this._commitInfo.Message:"";if(a){var d=a.replace(/\r\n|\n\r|\n|\r/g,"\n").split("\n");d&&0<d.length&&(a=d[0]);10<b&&a.length>
b&&(a=a.substring(0,b-3)+"...")}return a},_generateMessageNode:function(b){var a;if(this._commitInfo.URL||this._commitInfo.SHA1){a=document.createElement("a");if(this._commitInfo.SHA1){var d=(new URL("commit",window.location.href)).href,d=decodeURIComponent(d);a.href=(new n(d+"{/SHA1}")).expand(this._commitInfo)}else a.href=this._commitInfo.URL;a.classList.add("commitInfolink")}else a=document.createElement("span");a.appendChild(document.createTextNode(b));return a},_requestPhotoURL:function(b,a){var d=
this,f=new URL("/manage/service/com.ibm.team.jazzhub.common.service.IPhotoService/getContributorPhotoURI",window.location.href);f.query.set("contributorUserId",b);e("GET",f.href,{timeout:15E3}).then(function(b){b=JSON.parse(b.response);a.src=b.photoURI},function(){d._useOtherPhotoURL(a)})},_useOtherPhotoURL:function(b){b.src=this._commitInfo.AvatarURL?this._commitInfo.AvatarURL:"https://www.gravatar.com/avatar/?d\x3dmm"},renderSimple:function(b){this._parentDomNode.appendChild(this._generateMessageNode(this._simpleMessage(b)))},
render:function(b,a){var d=this._commitInfo.Author&&this._commitInfo.Author.Date?g(this._commitInfo.Author.Date):"",f=this._simpleMessage(-1),e=this._commitInfo.Author&&this._commitInfo.Author.Name?this._commitInfo.Author.Name:"",q=b;q||(q="Commit");q="Last "+q;if(a){var r=document.createElement("div"),t=new Image;this._commitInfo.Author&&this._commitInfo.Author.UserId?this._requestPhotoURL(this._commitInfo.Author.UserId,t):this._useOtherPhotoURL(t);t.classList.add("commitInfoAvatar");r.appendChild(t)}else r=
document.createElement("div"),r.classList.add("commitInfoLabelContainer"),r.appendChild(document.createTextNode(q.toUpperCase()));this._parentDomNode.appendChild(r);r=document.createElement("div");r.classList.add("commitInfoMessageContainer");t=document.createElement("div");t.classList.add("commitInfoAutorContainer");var m=document.createDocumentFragment(),s=document.createElement("span");s.appendChild(document.createTextNode(e));s.classList.add("navColumnBold");a?(e=document.createElement("span"),
e.appendChild(document.createTextNode(q)),e.classList.add("navColumnBold"),m.textContent=d?"${0} by ${1} "+d+".":"${0} by ${1}.",d=[e,s]):(m.textContent=d?"by ${0} "+d+".":"by ${0}.",d=[s]);k.processDOMNodes(m,d);t.appendChild(m);r.appendChild(t);d=document.createElement("div");d.classList.add("commitInfoMessageTextContainer");d.appendChild(this._generateMessageNode(f));r.appendChild(d);this._parentDomNode.appendChild(r)}});return{CommitInfoRenderer:f,calculateTime:g}});
define("orion/explorers/navigatorRenderer","i18n!orion/navigate/nls/messages orion/Deferred orion/explorers/explorer orion/explorers/navigationUtils orion/extensionCommands orion/objects orion/URITemplate orion/widgets/browse/commitInfoRenderer orion/webui/littlelib".split(" "),function(m,n,k,e,d,g,f,b,a){function l(a){switch(a&&a.id){case "image/jpeg":case "image/png":case "image/gif":case "image/ico":case "image/tiff":case "image/svg":return!0}return!1}function h(a,b,e,h,p,k,m,B,u){b=g.clone(b);
var y;if(b.Directory)y=document.createElement("a"),y.className="navlinkonpage",h=!a?q:new f(a+"#{,resource,params*}"),y.href=h.expand({resource:b.ChildrenLocation}),b.Name&&y.appendChild(document.createTextNode(b.Name));else{p||(p=d.getOpenWithCommands(e));y=document.createElement("a");y.className="navlink targetSelector";k&&"object"===typeof k&&Object.keys(k).forEach(function(a){y[a]=k[a]});var C=null,E=null;if(C=B?B.holderDom:y)E=document.createElement("span"),E.className="core-sprite-file modelDecorationSprite thumbnail",
C.appendChild(E);b.Name&&y.appendChild(document.createTextNode(b.Name));var D=b.Location;m&&"object"===typeof m&&(b.params={},g.mixin(b.params,m));(a=d.getOpenWithCommand(e,b,p))&&(D=a.hrefCallback({items:b}));n.when(h.getFileContentType(b),function(a){if(C){var d=C,f=E;if(a){var e,h=a.imageClass,p=a.image;h?(e=document.createElement("span"),e.className+=h,e.classList.add("thumbnail")):p&&(e=document.createElement("img"),e.src=p,e.classList.add("thumbnail"));e&&d.replaceChild(e,f)}}y.href=D;u&&"function"===
typeof u.updateFileNode&&u.updateFileNode(b,y,l(a))})}y.addEventListener("click",function(){r=b}.bind(this),!1);return y}function p(a,b,d,f){this.explorer=b;this.commandService=d;this.contentTypeService=f;this.openWithCommands=null;this.actionScopeId=a.actionScopeId;this._init(a);this.target="_self"}var q=new f("#{,resource,params*}"),r;p.prototype=new k.SelectionRenderer;p.prototype.wrapperCallback=function(a){a.setAttribute("role","tree")};p.prototype.tableCallback=function(a){a.setAttribute("aria-label",
m.Navigator);a.setAttribute("role","presentation")};p.prototype.rowCallback=function(a,b){a.setAttribute("role","treeitem")};p.prototype.emptyCallback=function(b){var d=document.createElement("tr"),f=document.createElement("td");f.colSpan=this.oneColumn?1:3;var e=document.createElement("div");e.classList.add("noFile");e.textContent=m.NoFile;var h=document.createElement("span");h.appendChild(document.createTextNode(m.File));a.processDOMNodes(e,[h]);f.appendChild(e);d.appendChild(f);b.appendChild(d)};
p.prototype.getDisplayTime=function(a){return(new Date(a)).toLocaleString()};p.prototype.getCommitRenderer=function(a,d){return new b.CommitInfoRenderer({parent:a,commitInfo:d})};p.prototype.getCellHeaderElement=function(a){if(this.oneColumn&&0!==a)return null;switch(a){case 0:case 1:case 2:document.createElement("th").style.height="8px"}};p.prototype.setTarget=function(a){this.target=a};p.prototype.getFolderImage=function(a){if(!this.showFolderImage)return null;a=document.createElement("span");a.className=
"core-sprite-folder modelDecorationSprite";return a};p.prototype.createFolderNode=function(a){var b;this.showFolderLinks?(b=h(this.folderLink||"",a,this.commandService,this.contentTypeService),(a=this.getFolderImage(a))&&b.insertBefore(a,b.firstChild)):(b=document.createElement("span"),b.textContent=a.Name);return b};p.prototype.updateFileNode=function(a,b,d){};p.prototype.showFolderLinks=!0;p.prototype.getCellElement=function(a,b,f){var l=b.LastCommit?2:1,p=b.LastCommit?3:2,g=b.LastCommit?1:-1;switch(a){case 0:return a=
document.createElement("td"),l=document.createElement("span"),l.id=f.id+"MainCol",l.setAttribute("role","presentation"),a.appendChild(l),a.setAttribute("role","presentation"),l.className="mainNavColumn",b.Directory?(this.getExpandImage(f,l),p=this.createFolderNode(b),l.appendChild(p),this.explorer._makeDropTarget(b,p),this.explorer._makeDropTarget(b,f)):(this.openWithCommands||(this.openWithCommands=d.getOpenWithCommands(this.commandService)),p=h("",b,this.commandService,this.contentTypeService,this.openWithCommands,
{target:this.target},null,null,this),l.appendChild(p)),p&&(p.id=f.id+"NameLink",1===p.nodeType&&(e.addNavGrid(this.explorer.getNavDict(),b,p),p.setAttribute("role","link"),p.setAttribute("tabindex","-1"))),this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,l,b,this.explorer,"tool",null,!0),a;case l:if(this.oneColumn)return null;f=document.createElement("td");b.LocalTimeStamp&&(f.textContent=this.getDisplayTime(b.LocalTimeStamp));return f;case p:if(this.oneColumn)return null;
f=document.createElement("td");!b.Directory&&"number"===typeof b.Length&&(b=parseInt(b.Length,10)/1024,f.textContent=Math.ceil(b).toLocaleString()+" KB");f.style.textAlign="right";return f;case g:if(this.oneColumn||!b.LastCommit)return null;f=document.createElement("td");this.getCommitRenderer(f,b.LastCommit).renderSimple(60);return f}};p.prototype.constructor=p;return{NavigatorRenderer:p,isImage:l,getClickedItem:function(){return r},createLink:h}});
define("orion/searchClient","i18n!orion/search/nls/messages require orion/webui/littlelib orion/i18nUtil orion/searchUtils orion/crawler/searchCrawler orion/explorers/navigatorRenderer orion/extensionCommands orion/Deferred".split(" "),function(m,n,k,e,d,g,f,b,a){function l(a,b){this.serviceRegistry=a;this.commandRegistry=b;this.openWithCommands=null}function h(a){this.registry=a.serviceRegistry;this._commandService=a.commandService;this._fileService=a.fileService;this.defaultRenderer=new l(this.registry,
this._commandService);this._fileService||console.error("No file service on search client")}l.prototype.makeRenderFunction=function(h,l,g,t,w){var s=this.serviceRegistry,x=this.commandRegistry;this.openWithCommands=this.openWithCommands||b.createOpenWithCommands(s,h,x);var v=this;return function(b,s,B,u){a.when(v.openWithCommands,function(a){if(B)k.empty(l),a=document.createElement("div"),a.appendChild(document.createTextNode(m["Search failed."])),l.appendChild(a),"function"===typeof t&&t(l);else{var C=
function(){function a(b,d){var f=d.folderName?d.folderName:d.path,u=document.createElement("span");u.id=f.replace(/[^a-zA-Z0-9_\.:\-]/g,"");u.appendChild(document.createTextNode(" - "+f+" "));b.appendChild(u)}var b={};return function(d,f){var u=f.name;if(b.hasOwnProperty(u)){a(d,f);var e=b[u];"function"===typeof e&&(b[u]=null,e())}else b[u]=function(){a(d,f)}}}(),E=!1;k.empty(l);if(b&&0<b.length){var D=document.createElement("table");D.setAttribute("role","presentation");for(var H=0;H<b.length;H++){var v=
b[H],G;E||(E=!0,g&&(G=D.insertRow(0).insertCell(0),G.textContent=g));G=D.insertRow(-1).insertCell(0);G.colspan=2;w&&w(G);var J={Name:v.name,Directory:v.directory,Location:v.path||v.location},K=null;"number"===typeof v.LineNumber&&(K={},K.line=v.LineNumber);if(u&&u.keyword&&!u.nameSearch){var F=d.generateSearchHelper(u),K=K||{};K.find=F.inFileQuery.searchStr;K.regEx=F.inFileQuery.wildCard?!0:void 0}J=f.createLink(n.toUrl("edit/edit.html"),J,x,h,a,{"aria-describedby":(v.folderName?v.folderName:v.path).replace(/[^a-zA-Z0-9_\.:\-]/g,
""),style:{verticalAlign:"middle"}},K);v.LineNumber&&J.appendChild(document.createTextNode(" (Line "+v.LineNumber+")"));G.appendChild(J);C(G,v)}l.appendChild(D);"function"===typeof t&&t(l)}!E&&s&&(a=e.formatMessage(m["No matches found for ${0}"],s),k.empty(l),l.appendChild(document.createTextNode(a)),"function"===typeof t&&t(l))}})}};h.prototype={search:function(a,b,f){var e=function(a){for(var f=[],e=0;e<a.response.docs.length;e++){var h=a.response.docs[e],l=h.Location,g=d.path2FolderName(h.Path?
h.Path:h.Location,h.Name),u=g?g:l;(b?0<=u.indexOf(b):1)&&f.push({name:h.Name,path:l,folderName:g,directory:h.Directory,lineNumber:h.LineNumber})}return f};if(this._crawler&&a.nameSearch)this._crawler.searchName(a,function(b){f(e(b),a.keyword,null,a)});else try{this.registry.getService("orion.page.progress").progress(this._fileService.search(a),"Searching "+a.keyword).then(function(b){var d=a.keyword,d=d.substring(d.indexOf("}")+1),d=d.substring(d.indexOf(":")+1);f(e(b),d,null,a)},function(a){f(null,
null,a,null)})}catch(h){"string"===typeof h&&-1<h.indexOf("search")&&this._crawler?this._crawler.searchName(a,function(b){f(e(b),null,null,a)}):"string"===typeof h&&-1<h.indexOf("search")&&!a.nameSearch?(new g.SearchCrawler(this.registry,this._fileService,a,{childrenLocation:this.getChildrenLocation()})).search(function(b){f(e(b),null,null,a)}):this.registry.getService("orion.page.message").setErrorMessage(h)}},getFileService:function(){return this._fileService},setCrawler:function(a){this._crawler=
a},handleError:function(a,b){console.error(a);k.empty(b);b.appendChild(document.createTextNode(a));return a},setLocationByMetaData:function(a,b){var d="",f=null;this._searchRootLocation=this._fileService.fileServiceRootURL(a.Location);b&&a&&a.Parents&&0<a.Parents.length?f="last"===b.index?a.Parents[a.Parents.length-1]:a.Parents[0]:a&&(a.Directory&&a.Location&&a.Parents)&&(f=a);f?(this.setLocationbyURL(f.Location),d=f.Name,this._childrenLocation=f.ChildrenLocation):a&&(this.setLocationbyURL(this._searchRootLocation),
d=this._fileService.fileServiceName(a.Location),this._childrenLocation=a.ChildrenLocation);f=k.node("search");d||(d="");if(f&&f.placeholder){f.value="";var h=e.formatMessage(m["Search ${0}"],d);f.placeholder=30<h.length?h.substring(0,27)+"...":e.formatMessage(m["Search ${0}"],d)}f&&f.title&&(f.title=m["Type a keyword or wild card to search in "]+d)},setLocationbyURL:function(a){this._searchLocation=a},setRootLocationbyURL:function(a){this._searchRootLocation=a},setChildrenLocationbyURL:function(a){this._childrenLocation=
a},getSearchLocation:function(){return this._searchLocation?this._searchLocation:this._fileService.fileServiceRootURL()},getSearchRootLocation:function(){return this._searchRootLocation?this._searchRootLocation:this._fileService.fileServiceRootURL()},getChildrenLocation:function(){return this._childrenLocation?this._childrenLocation:this._fileService.fileServiceRootURL()},createSearchParams:function(a,b,d,f){d=d?this.getSearchRootLocation():this.getSearchLocation();return b?{resource:d,sort:"NameLower asc",
rows:100,start:0,nameSearch:!0,keyword:a}:{resource:d,sort:f&&f.sort?f.sort:"Path asc",rows:f&&f.rows?f.rows:40,start:0,caseSensitive:f?f.caseSensitive:void 0,regEx:f?f.regEx:void 0,fileType:f?f.fileType:void 0,fileNamePatterns:f&&f.fileNamePatterns?f.fileNamePatterns:void 0,keyword:a,replace:f?f.replace:void 0}}};h.prototype.constructor=h;return{Searcher:h}});
define("orion/operationsClient",["i18n!orion/operations/nls/messages","orion/Deferred"],function(m,n){function k(d,b,a){return d[b].apply(d,a)}function e(d){this._location=d}function d(){var d=new n;d.reject(m["No Matching OperationService for location:"]+this._location);return d}function g(d){this._services=[];this._patterns=[];this._operationListeners=[];this._currentLongpollingIds=[];this._preferenceService=d.getService("orion.core.preference");for(var b=d.getServiceReferences("orion.core.operation"),
a=0;a<b.length;a++){var l=d.getService(b[a]);this._services[a]=l;l=b[a].getProperty("pattern")||".*";"^"!==l[0]&&(l="^"+l);this._patterns[a]=RegExp(l)}this._getService=function(a){if(!a)return this._services[0];for(var b=0;b<this._patterns.length;++b)if(this._patterns[b].test(a))return this._services[b];this._operations.remove(a);return new e(a)}}e.prototype={getOperation:d,getOperations:d,removeCompletedOperations:d,removeOperation:d,cancelOperation:d};e.prototype.constructor=e;g.prototype={getOperations:function(){var d=
new n;if(this._operations)return d.resolve(this._operations),d;var b=this;this._preferenceService.getPreferences("/operations").then(function(a){b._operations=a;d.resolve(b._operations)});return d},getOperation:function(d){return k(this._getService(d),"getOperation",arguments)},removeCompletedOperations:function(){for(var d=[],b=this,a=0;a<this._services.length;a++){var e=this._patterns[a],h=new n;d[a]=h.promise;k(this._services[a],"removeCompletedOperations").then(function(a){return function(d){Array.isArray(d)&&
b.getOperations.bind(b)().then(function(b){for(var f=b.keys(),h=0;h<f.length;h++){var g=f[h];e.test(g)&&0>d.indexOf(g)&&b.remove(g)}a.resolve()})}}(h),function(a){return function(b){a.reject(b)}}(h))}return n.all(d)},removeOperation:function(d){var b=this;return k(this._getService(d),"removeOperation",arguments).then(function(a){b.getOperations.bind(b)().then(function(a){a.remove(d)})},function(a){return a},function(a){return a})}};g.prototype.constructor=g;return{OperationsClient:g}});
define("text!orion/globalSearch/search-features.html",[],function(){return'\x3cdiv id\x3d"replaceTopWidget_id" style\x3d"height:100%;width:100%;position:relative;"\x3e\n\t\x3cdiv id\x3d"replaceTop" class\x3d"topPanelLayout"\x3e\n\t\x3c/div\x3e\n\t\x3cdiv class\x3d"replaceSplitLayout"\x3e\x3c/div\x3e\n\t\x3cdiv id\x3d"replaceBottom" class\x3d"bottomPanelLayout"\x3e\n\t\x3c/div\x3e\n\x3c/div\x3e'});
define("orion/globalSearch/search-features",["orion/webui/littlelib","orion/webui/splitter","orion/globalCommands","text!orion/globalSearch/search-features.html"],function(m,n,k,e){var d=d||{};d.SearchUIFactory=function(){function d(f){this._parentDivID=f.parentDivID}d.prototype={buildUI:function(){var d=m.node(this._parentDivID);d.innerHTML=e;var b=m.$("#replaceTop",d),a=m.$("#replaceBottom",d),d=m.$(".replaceSplitLayout",d);d.id="replaceSplitter";var l=new n.Splitter({node:d,sidePanel:b,mainPanel:a,
vertical:!0});window.setTimeout(function(){l._adjustToSplitPosition(!0)},100);l.addResizeListener(function(b){b===a&&(this._compareWidget&&this._compareWidget.resizeEditors)&&this._compareWidget.resizeEditors()}.bind(this));var h=k.getMainSplitter();h&&h.splitter&&h.splitter.addResizeListener(function(a){a===h.main&&(this._compareWidget&&this._compareWidget.getSplitter())&&this._compareWidget.getSplitter()._adjustToSplitPosition(!0)}.bind(this))},destroy:function(){},setCompareWidget:function(d){this._compareWidget=
d},getMatchDivID:function(){return"replaceTop"},getCompareDivID:function(){return"replaceBottom"}};return d}();return d});define("text!orion/compare/sideBySideTemplate.html",[],function(){return'\x3cdiv id\x3d"topWidget_id" style\x3d"height:100%;width:100%;position:relative"\x3e\n\t\x3cdiv class\x3d"leftPanelLayout "\x3e\n\t\t\x3cdiv class\x3d"titleActionContainer"\x3e\n\t\t\t\x3cdiv class\x3d"compareActionContainer" id\x3d"left_action_id"\x3e\x3c/div\x3e\n\t\t\t\x3cdiv class\x3d"titleContainer" id\x3d"left_title_id"\x3e\x3c/div\x3e\n\t\t\x3c/div\x3e\n\t\t\x3cdiv class\x3d"compareEditorParent" id\x3d"left_editor_id"\x3e\x3c/div\x3e\n\t\t\x3cdiv class\x3d"statusContainer" id\x3d"left_status_id"\x3e\x3c/div\x3e\n\t\x3c/div\x3e\n\t\x3cdiv class\x3d"split compareSplitLayout"\x3e\x3c/div\x3e\n\t\x3cdiv class\x3d"rightPanelLayout"\x3e\n\t\t\x3cdiv class\x3d"titleActionContainer"\x3e\n\t\t\t\x3cdiv class\x3d"compareActionContainer" id\x3d"right_action_id"\x3e\x3c/div\x3e\n\t\t\t\x3cdiv class\x3d"titleContainer" id\x3d"right_title_id"\x3e\x3c/div\x3e\n\t\t\x3c/div\x3e\n\t\t\x3cdiv class\x3d"compareEditorParent"  id\x3d"right_editor_wrapper_id"\x3e\n\t\t\t\x3cdiv class\x3d"canvasContainer"\x3e\n\t\t\t\t\x3ccanvas id\x3d"diff_canvas_id" class\x3d"compareCanvas" width\x3d"46" height\x3d"3000"\x3e\x3c/canvas\x3e\n\t\t\t\x3c/div\x3e\n\t\t\t\x3cdiv class\x3d"compareEditorParentWithCanvas" id\x3d"right_editor_id"\x3e\x3c/div\x3e\n\t\t\x3c/div\x3e\n\t\t\x3cdiv class\x3d"statusContainer" id\x3d"right_status_id"\x3e\x3c/div\x3e\n\t\x3c/div\x3e\n\x3c/div\x3e'});
define("orion/compare/compareUIFactory",["orion/webui/littlelib","orion/webui/splitter","text!orion/compare/sideBySideTemplate.html"],function(m,n,k){var e=e||{};e.TwoWayCompareUIFactory=function(){function d(d){this._parentDivID=d.parentDivID;this._commandSpanId=d.commandSpanId;this._showTitle=d.showTitle;this._leftTitle=d.leftTitle;this._rightTitle=d.rightTitle;this._showLineStatus=d.showLineStatus}d.prototype={_init:function(){var d=this._parentDivID+"_";this._topWidgetDiv=m.node("topWidget_id");
this._topWidgetDiv.id=d+"topWidget_id";this._leftEditorParentDiv=m.node("left_editor_id");this._leftEditorParentDiv.id=d+"left_editor_id";this._rightEditorParentDiv=m.node("right_editor_id");this._rightEditorParentDiv.id=d+"right_editor_id";this._rightEditorWrapperDiv=m.node("right_editor_wrapper_id");this._rightEditorWrapperDiv.id=d+"right_editor_wrapper_id";this._leftActionDiv=m.node("left_action_id");this._leftActionDiv.id=d+"left_action_id";this._rightActionDiv=m.node("right_action_id");this._rightActionDiv.id=
d+"right_action_id";this._leftTitleDiv=m.node("left_title_id");this._leftTitleDiv.id=d+"left_title_id";this._rightTitleDiv=m.node("right_title_id");this._rightTitleDiv.id=d+"right_title_id";this._leftStatusDiv=m.node("left_status_id");this._leftStatusDiv.id=d+"left_status_id";this._rightStatusDiv=m.node("right_status_id");this._rightStatusDiv.id=d+"right_status_id";this._diffCanvasDiv=m.node("diff_canvas_id");this._diffCanvasDiv.id=d+"diff_canvas_id";this._splitterId=d+"orion_splitter";this._showTitle||
this.disableTitle();this._showLineStatus||this.disableLineStatus()},_createSplitter:function(){var d=m.$(".split",this._topWidgetDiv);d.id=this._splitterId;var f=m.$(".leftPanelLayout",this._topWidgetDiv),b=m.$(".rightPanelLayout",this._topWidgetDiv);d&&(f&&b)&&(this._splitter=new n.Splitter({node:d,sidePanel:f,mainPanel:b}))},buildUI:function(){m.node(this._parentDivID).innerHTML=k;this._init();this._createSplitter()},destroy:function(){},getSplitter:function(){return this._splitter},isLeftPane:function(d){return m.$(".leftPanelLayout",
this._topWidgetDiv)===d},getEditorParentDiv:function(d){return d?this._leftEditorParentDiv:this._rightEditorParentDiv},getTitleDiv:function(d){return d?this._leftTitleDiv:this._rightTitleDiv},getActionDivId:function(d){return d?this._leftActionDiv.id:this._rightActionDiv.id},getStatusDiv:function(d){return d?this._leftStatusDiv:this._rightStatusDiv},getCommandSpanId:function(){return this._commandSpanId},getDiffCanvasDiv:function(){return this._diffCanvasDiv},disableTitle:function(){this._leftEditorParentDiv.style.top=
"0px";this._rightEditorWrapperDiv.style.top="0px";this._leftTitleDiv.style.height="0px";this._rightTitleDiv.style.height="0px"},disableLineStatus:function(){this._leftEditorParentDiv.style.marginBottom="0px";this._rightEditorWrapperDiv.style.marginBottom="0px";this._leftStatusDiv.style.height="0px";this._rightStatusDiv.style.height="0px"}};return d}();return e});
define("orion/compare/nls/root/messages",{"Copy current change from right to left":"Copy current change from right to left","Copy current change from left to right":"Copy current change from left to right","Switch to unified diff":"Switch to unified diff",Unified:"Unified","Switch to side by side diff":"Switch to side by side diff","Side by side":"Side by side","Generate link of the current diff":"Generate link of the current diff","Generate Link":"Generate Link","Next diff block":"Next diff block",
"Previous diff block":"Previous diff block","Next diff change":"Next diff change","Previous diff change":"Previous diff change","Copy the link URL:":"Copy the link URL:",Compare:"Compare","Open the compare page":"Open the compare page","fetching...":"fetching...","There are unsaved changes.":"There are unsaved changes.","ERROR: ":"ERROR: ","Compare...":"Compare...","files changed":" files changed",Location:"Location",Options:"Options","Sort by folders":"Sort by folders","Line 0 : Col 0":"Line 0 : Col 0",
"No Matching DiffService for location:":"No Matching DiffService for location:","${0} files compared. The two folders are identical.":"${0} files compared. The two folders are identical."});define("orion/compare/nls/messages",["orion/i18n!orion/compare/nls/messages","orion/compare/nls/root/messages"],function(m,n){var k={root:n};Object.keys(m).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=m[e])});return k});
define("orion/compare/diffParser",[],function(){var m=m||{};m.DiffParser=function(){function m(e,d){this._lineDelimiter=e?e:k?"\r\n":"\n";this._diffLineDelimiter=d?d:this._lineDelimiter;this._DEBUG=!1}var k=-1!==window.navigator.platform.indexOf("Win");m.prototype={_init:function(){this._oFileContents=[];this._diffContents=[];this._oBlocks=[];this._nBlocks=[];this._hunkRanges=[];this._lastToken=" ";this._deltaMap=[];this._nFileContents=[];this._nNewLineAtEnd=this._oNewLineAtEnd=!0;this._diffContentIndex=
1},setLineDelim:function(e){this._diffLineDelimiter=this._lineDelimiter=e},getDiffArray:function(){return{array:this._diffContents,index:this._diffContentIndex}},parse:function(e,d,g,f){this._init();if(""===d)return{outPutFile:e,mapper:[]};this._oFileContents=""===e?[]:e.split(this._lineDelimiter);this._diffContents=d.split(this._diffLineDelimiter);d=this._diffContents.length;this._hunkRanges=[];for(var b=0;b<d;b++){var a=this._parseHunkRange(b);a&&this._hunkRanges.push(a)}if(0===this._hunkRanges.length)return{outPutFile:e,
mapper:[]};this._DEBUG&&(console.log("***Diff contents: \n"),this._diffContents.forEach(function(a){console.log(a)}),console.log("***Hunk ranges: \n"),console.log(JSON.stringify(this._hunkRanges)));for(e=0;e<this._hunkRanges.length;e++)this._parseHunkBlock(e);this._DEBUG&&(console.log("***Original Hunk range blocks: \n"),console.log(JSON.stringify(this._oBlocks)),console.log("***New Hunk range blocks: \n"),console.log(JSON.stringify(this._nBlocks)));this._buildMap(g);this._DEBUG&&(console.log("***New Line at end of file(original): \n"),
console.log(JSON.stringify(this._oNewLineAtEnd)),console.log("***New Line at end of file(new): \n"),console.log(JSON.stringify(this._nNewLineAtEnd)),console.log("***Mapper: \n"),this._logMap(),console.log("***Total line number in original file: "+this._oFileContents.length));f||this._buildNewFile();return{outPutFile:this._nFileContents.join(this._diffLineDelimiter),mapper:this._deltaMap}},_logMap:function(){for(var e=0;e<this._deltaMap.length;e++)if(console.log(JSON.stringify(this._deltaMap[e])),
0<this._deltaMap[e][2]){console.log("    **Diff content on change/add: \n");for(var d=0;d<this._deltaMap[e][0];d++)console.log("    "+this._diffContents[this._deltaMap[e][2]+d-1])}},_logNewFile:function(){for(var e=0;e<this._nFileContents.length;e++)console.log(this._nFileContents[e])},_createBlock:function(e,d,g,f){f===g&&" "===e||(g=[g,f-g,"s"],"-"===e?g[2]="r":"+"===e?g[2]="a":"c"===e&&(g[2]="c"),d.push(g))},_createMinusBlock:function(e,d,g){var f=this._oBlocks.length;0===f||e!==this._oBlocks[f-
1][0]?(this._oBlocks.push([0===e?1:e,g]),this._nBlocks.push([d,0,-2])):this._oBlocks[f-1][1]+=g},_createPlusBlock:function(e,d,g,f){var b=this._nBlocks.length;0===b||d!==this._nBlocks[b-1][0]?(this._oBlocks.push([0===e?1:e,0]),this._nBlocks.push([d,g,f])):(this._nBlocks[b-1][1]+=g,this._nBlocks[b-1][2]=f)},_parseHunkBlock:function(e){for(var d=" ",g=this._hunkRanges[e][0]+1,f=e===this._hunkRanges.length-1?this._diffContents.length:this._hunkRanges[e+1][0],b=0,a=0,l=this._hunkRanges[e][1],h=this._hunkRanges[e][3],
p=g,q=g;q<f;q++)if(0!==this._diffContents[q].length){var r=this._diffContents[q][0];if("\\"===r&&("\\ No newline at end of file"===this._diffContents[q].substring(0,this._diffContents[q].length-1)||"\\ No newline at end of file"===this._diffContents[q]))"-"===d?this._oNewLineAtEnd=!1:" "===d?this._oNewLineAtEnd=this._nNewLineAtEnd=!1:this._nNewLineAtEnd=!1,q>g&&"\r"===this._diffContents[q-1][this._diffContents[q-1].length-1]&&(this._diffContents[q-1]=this._diffContents[q-1].substring(0,this._diffContents[q-
1].length-1));else{switch(r){case "-":case "+":case " ":break;default:continue}if(d!==r){"+"===r&&(p=q);switch(d){case " ":l=this._hunkRanges[e][1]+b;h=this._hunkRanges[e][3]+a;break;case "-":this._createMinusBlock(l,h,this._hunkRanges[e][1]+b-l);break;case "+":this._createPlusBlock(l,h,this._hunkRanges[e][3]+a-h,p)}d=r}switch(r){case "-":b++;break;case "+":a++;break;case " ":b++,a++}}}switch(d){case "-":this._createMinusBlock(l,h,this._hunkRanges[e][1]+b-l);break;case "+":this._createPlusBlock(l,
h,this._hunkRanges[e][3]+a-h,p)}},_detectConflictes:function(e,d){if(0>e)return!1;for(var g=e+d,f=e;f<g;f++){var b=this._diffContents[f];if(-1<b.indexOf("\x3c\x3c\x3c\x3c\x3c")||-1<b.indexOf("\x3e\x3e\x3e\x3e\x3e"))return!0}return!1},_buildMap:function(e){var d=this._oBlocks.length,g=this._oFileContents.length,f=0,b;b=1;for(var a=0;a<d;a++)b=this._oBlocks[a][0]-b,0<b&&(this._deltaMap.push([b,b,0]),f+=b),e&&this._detectConflictes(this._nBlocks[a][2],this._nBlocks[a][1])?this._deltaMap.push([this._nBlocks[a][1],
this._oBlocks[a][1],this._nBlocks[a][2]+1,1]):this._deltaMap.push([this._nBlocks[a][1],this._oBlocks[a][1],this._nBlocks[a][2]+1]),f+=this._oBlocks[a][1],b=this._oBlocks[a][0]+this._oBlocks[a][1];0<g-b&&(this._deltaMap.push([g-b+1,g-b+1,0]),f+=g-b+1);f<g&&(b=g-f,e=this._deltaMap[this._deltaMap.length-1],0===e[2]?(e[0]+=b,e[1]+=b):-1===e[2]?this._deltaMap.push([b,b,0]):this._nNewLineAtEnd===this._oNewLineAtEnd?this._deltaMap.push([b,b,0]):(this._nNewLineAtEnd&&(e[0]+=b),this._oNewLineAtEnd&&(e[1]+=
b)))},_buildNewFile:function(){var e=1,d=!1,g=this._deltaMap.length,f,b;for(f=0;f<g;f++){d=!1;if(0===this._deltaMap[f][2]){for(b=0;b<this._deltaMap[f][0];b++)this._nFileContents.push(this._oFileContents[e+b-1]);d=!0}else if(0<this._deltaMap[f][2])for(b=0;b<this._deltaMap[f][0];b++)this._nFileContents.push(this._diffContents[this._deltaMap[f][2]+b-1].substring(1));e+=this._deltaMap[f][1]}this._nNewLineAtEnd&&!d&&this._nFileContents.push("")},_converHRangeBody:function(e,d){if(e){var g=parseInt(e,10);
d.push(0<=g?g:1)}else d.push(1)},_parseHunkRange:function(e){var d=this._diffContents[e],g=/^@@\s*\+([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*-([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*@@+/,f=/^@@\s*-([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*\+([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*@@+/.exec(d),b=null;if(f&&5===f.length)b=[e],this._converHRangeBody(f[1],b),this._converHRangeBody(f[2],b),this._converHRangeBody(f[3],b),this._converHRangeBody(f[4],b);else if((f=g.exec(d))&&5===f.length)b=[e],this._converHRangeBody(f[3],b),this._converHRangeBody(f[4],
b),this._converHRangeBody(f[1],b),this._converHRangeBody(f[2],b);return b}};return m}();return m});
define("orion/compare/compareUtils",["orion/URITemplate"],function(m){var n=n||{};n.compareUtils=n.compareUtils||{};n.compareUtils.lookUpMapper=function(k,e,d){for(var g=0,f=0;f<k.length;f++){var b=k[f][e];0===b&&(b=1);if(d>=g&&d<g+b)return{mapperIndex:f,startFrom:g};if(f===k.length-1)break;g+=k[f][e]}return{mapperIndex:k.length-1,startFrom:g}};n.compareUtils.lookUpLineIndex=function(k,e,d){if(0===d)return 0;for(var g=0,f=0;f<d;f++)g+=k[f][e];return g};n.compareUtils.updateMapper=function(k,e,d,g,
f){if(g!==f&&(0<g||0<f)){var b=n.compareUtils.lookUpMapper(k,e,d);if(!(0>b.mapperIndex)){if(0<g){var a=d-b.startFrom;for(d=b.mapperIndex;d<k.length;d++){a=k[d][e]-a;if(g<=a){k[d][e]-=g;break}k[d][e]-=a;g-=a;a=0}}0<f&&(k[b.mapperIndex][e]+=f)}}};n.compareUtils.overlapMapper=function(k,e,d,g,f){k=d+k[e]-1;k<d&&(k=d);f<g&&(f=g);return k<g||f<d?!1:!0};n.compareUtils.findFirstDiff=function(k,e,d,g){for(var f=0,b=null,a=0;a<k.length&&!(f>g)&&(!n.compareUtils.overlapMapper(k[a],e,f,d,g)||!(b={mapperIndex:a,
startFrom:f},0!==k[a][2]));a++)f+=k[a][e];return b};n.compareUtils.matchMapper=function(k,e,d,g){if(0===k.length)return d;var f=d+Math.round((g-d)/3),b=n.compareUtils.findFirstDiff(k,e,d,g),a=0===k[b.mapperIndex][e]?b.startFrom:b.startFrom+k[b.mapperIndex][e]-1,l=n.compareUtils.lookUpLineIndex(k,1-e,b.mapperIndex),h=b.startFrom-d;return 0===k[b.mapperIndex][2]?l-h:f>=b.startFrom&&f<=a?l-Math.round((g-d)/3):f<b.startFrom?l-h:(0===k[b.mapperIndex][1-e]?l:l+k[b.mapperIndex][1-e]-1)-(a-d)};n.compareUtils.getMapperLineCount=
function(k){for(var e=0,d=0;d<k.length;d++)e+=Math.max(k[d][0],k[d][1]);return e};n.compareUtils.getAnnotationIndex=function(k,e){for(var d=0;d<k.length;d++)if(k[d][0]===e)return d;return-1};n.compareUtils.getAnnotationMapperIndex=function(k,e){return k[e][1]};n.compareUtils.getAnnotationIndexByMapper=function(k,e){for(var d=0;d<k.length;d++)if(k[d][1]===e)return{current:d,prev:d-1,next:d+1};return{current:-1,prev:-1,next:-1}};n.compareUtils.isMapperConflict=function(k,e){return 0>e||!k[e][3]?!1:
1===k[e][3]};n.compareUtils.mergeDiffBlocks=function(k,e,d,g,f,b){for(var a=0;a<e.length;a++){var l=e[a][0],h=d[e[a][1]];if(0<h[0]){for(var p="",q=0;q<h[0];q++)p=p+g[h[2]-1+q].substring(f)+b;h=k.getLineCount();l>=h&&(l=k.getLineEnd(h-1),q=k.getLineEnd(h-1,!0),l===q?(k.setText(b,l,l),l=h):l=h-1);l=k.getLineStart(l);k.setText(p,l,l)}}};n.compareUtils.generateCompareHref=function(k,e){var d=require.toUrl("compare/compare.html");e.conflict||(e.conflict=void 0);e.readonly||(e.readonly=void 0);return(new m(d+
"#{,resource,params*}")).expand({resource:k,params:e})};n.compareUtils.generateCompareTreeHref=function(k,e){var d=require.toUrl("compare-tree/compare-tree.html");return(new m(d+"#{,resource,params*}")).expand({resource:k,params:e})};return n.compareUtils});
define("orion/compare/compareRulers",["orion/compare/compareUtils"],function(m){var n=n||{};n.CompareRuler=function(){function k(e,d,g){this._location=e||"left";this._overview=d||"page";this._rulerStyle=g;this._editor=null;var f=this;this._listener={onModelChanged:function(b){f._onModelChanged(b)}}}k.prototype={setView:function(e){this._onModelChanged&&this._editor&&this._editor.removeEventListener("ModelChanged",this._listener.onModelChanged);this._editor=e;this._onModelChanged&&this._editor&&this._editor.addEventListener("ModelChanged",
this._listener.onModelChanged)},getLocation:function(){return this._location},getOverview:function(e){return this._overview},getAnnotationModel:function(){return null},addAnnotationType:function(e){},isAnnotationTypeVisible:function(e){return!1},removeAnnotationType:function(e){},setAnnotationModel:function(e){},getAnnotations:function(e,d){for(var g=[],f=e;f<d;f++){var b=this.getStyle(f);b&&(g[f]={html:this.getHTML(f),style:b})}return g},getWidestAnnotation:function(){return{html:this.getHTML(-1),
style:this.getStyle(-1)}},getRulerStyle:function(){return this.getStyle(void 0)}};return k}();n.LineNumberCompareRuler=function(){function k(e,d,g,f,b,a){n.CompareRuler.call(this,g,"page",f);this._diffNavigator=e;this._oddStyle=b||{style:{backgroundColor:"white"}};this._evenStyle=a||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._mapperColumnIndex=d}k.prototype=new n.CompareRuler;k.prototype.getStyle=function(e){return void 0===e?this._rulerStyle:this._evenStyle};k.prototype.getHTML=function(e){var d=
this._editor.getModel(),g=this._diffNavigator.getFeeder(0===this._mapperColumnIndex);return!g?"":-1===e?d.getLineCount():g.getLineNumber?(e=g.getLineNumber(e),-1===e?"":e+1):e+1};k.prototype._onModelChanged=function(e){var d=e.start,g=this._editor.getModel();e=g.getLineCount();var f=(e+"").length;this._numOfDigits!==f&&(this._numOfDigits=f,d=g.getLineAtOffset(d),this._editor.redrawLines(d,e,this))};return k}();n.CompareOverviewRuler=function(){function k(e,d,g,f){this._diffNavigator=g;this._onClick=
f;n.CompareRuler.call(this,e,"document",d)}k.prototype=new n.CompareRuler;k.prototype.getStyle=function(e){var d,g;if(void 0===e)d=this._rulerStyle||{},g=d.style||(d.style={}),g.lineHeight="1px",g.fontSize="1px",g.width="14px";else if(d=-1!==e?{styleClass:"annotationOverview breakpoint"}:{},g=d.style||(d.style={}),g.cursor="pointer",g.width="8px",g.left="2px",0<=e){var f;if(this._diffNavigator&&this._diffNavigator.getFeeder())f=this._diffNavigator.getFeeder().getDiffBlocks();else return null;e=m.getAnnotationIndex(f,
e);if(-1===e)return null;f=m.getAnnotationMapperIndex(f,e);var b;b=this._diffNavigator.getMapper();if(f=m.isMapperConflict(b,f))g.border="1px #FF0000 solid";e===this._diffNavigator.getCurrentBlockIndex()&&(g.backgroundColor=f?"red":"blue");e=this._diffNavigator.getFeeder().getDiffBlockH(e);f=this._diffNavigator.getFeeder().getOverviewLineCount();if(0>e)return null;b=this._editor.getClientArea();e=Math.floor(b.height*e/f);2>e&&(e=2);g.height=e+"px"}else return null;return d};k.prototype.setDiffNavigator=
function(e){this._diffNavigator=e};k.prototype.getHTML=function(e){return"\x26nbsp;"};k.prototype.onClick=function(e,d){void 0!==e&&this._onClick(e,this)};k.prototype._onModelChanged=function(e){0<this._editor.getModel().getLineCount()&&this._editor.redrawLines(0,1,this)};return k}();n.CompareCurveRuler=function(){function k(e){this._canvasDiv=e;this._mapper=void 0}k.prototype={init:function(e,d,g,f){this._rightIniting=this._rightIniting=this._leftIniting=!0;this._mapper=e;this._leftEditor=d;this._rightEditor=
g;this._leftTextView=d.getTextView();this._rightTextView=g.getTextView();this._diffNavigator=f;this.render()},matchPositionFrom:function(e){var d=e?this._leftTextView:this._rightTextView,g=e?this._rightTextView:this._leftTextView,f=d.getTopIndex(),d=d.getBottomIndex();e=m.matchMapper(this._mapper,e?0:1,f,d);g.setTopIndex(e)},copyTo:function(e){if(this._diffNavigator.iterator){var d=this._diffNavigator.iterator.cursor();if(d&&("word"===d.type?!d.copied&&!d.parent.copied:!d.copied)){var g=e?this._rightTextView.getText(d.oldA.start,
d.oldA.end):this._leftTextView.getText(d.newA.start,d.newA.end),f=e?d.newA:d.oldA;(e?this._leftTextView:this._rightTextView).setText(g,f.start,f.end);d.copied=!0}}},render:function(){if(this._mapper){var e=this._canvasDiv.getContext("2d");e.clearRect(0,0,this._canvasDiv.width,this._canvasDiv.height);e.strokeStyle="#AAAAAA";e.lineWidth=1;e.beginPath();var d=this._leftTextView.getTopIndex(),g=this._leftTextView.getBottomIndex(),f=this._rightTextView.getTopIndex(),b=this._rightTextView.getBottomIndex();
this._leftLineH=this._leftTextView.getLineHeight();this._rightLineH=this._rightTextView.getLineHeight();for(var a=0,l=0,h=!1,p=0;p<this._mapper.length;p++){if(0!==this._mapper[p][2])if(m.overlapMapper(this._mapper[p],0,a,d,g)||m.overlapMapper(this._mapper[p],1,l,f,b))this._renderCurve(p,a,l,this._canvasDiv,e,d,g,f,b),h=!0;else if(h)break;a+=this._mapper[p][0];l+=this._mapper[p][1]}e.stroke()}},_renderCurve:function(e,d,g,f,b,a,l,h,p){a=this._mapper[e];d=this._leftTextView.getLinePixel(d+a[0]/2)+a[0]%
2*this._leftLineH/3-this._leftTextView.getTopPixel();g=this._rightTextView.getLinePixel(g+a[1]/2)+a[1]%2*this._rightLineH/3-this._rightTextView.getTopPixel();f=f.parentNode.clientWidth;e===this._diffNavigator.getCurrentMapperIndex()?(b.stroke(),b.strokeStyle="#000",b.lineWidth=1,b.beginPath(),b.moveTo(0,d),b.bezierCurveTo(f/3,d,0.666*f,g,f,g),b.stroke(),b.strokeStyle="#AAAAAA",b.lineWidth=1,b.beginPath()):(b.moveTo(0,d),b.bezierCurveTo(f/3,d,0.666*f,g,f,g),b.stroke())},onChanged:function(e,d){var g=
d?this._rightIniting:this._leftIniting;if(e.removedLineCount!==e.addedLineCount){var f=d?this._rightTextView:this._leftTextView;g||m.updateMapper(this._mapper,d?1:0,f.getModel().getLineAtOffset(e.start),e.removedLineCount,e.addedLineCount);(0<e.removedLineCount||0<e.addedLineCount)&&this.render()}d?this._rightIniting=!1:this._leftIniting=!1;return g}};return k}();return n});
define("orion/editor/i18n",{load:function(m,n,k,e){n.specified&&n.specified("orion/bootstrap")?n(["orion/i18n!"+m],function(d){k(d)}):n(["orion/editor/config"],function(d){k(d&&d.languages||{})})}});
define("orion/editor/nls/root/messages",{multipleAnnotations:"Multiple annotations:",line:"Line: ${0}",breakpoint:"Breakpoint",bookmark:"Bookmark",task:"Task",error:"Error",warning:"Warning",matchingSearch:"Matching Search",currentSearch:"Current Search",currentLine:"Current Line",matchingBracket:"Matching Bracket",currentBracket:"Current Bracket",lineUp:"Line Up",lineDown:"Line Down",lineStart:"Line Start",lineEnd:"Line End",charPrevious:"Previous Character",charNext:"Next Character",pageUp:"Page Up",
pageDown:"Page Down",scrollPageUp:"Scroll Page Up",scrollPageDown:"Scroll Page Down",scrollLineUp:"Scroll Line Up",scrollLineDown:"Scroll Line Down",wordPrevious:"Previous Word",wordNext:"Next Word",textStart:"Document Start",textEnd:"Document End",scrollTextStart:"Scroll Document Start",scrollTextEnd:"Scroll Document End",centerLine:"Center Line",selectLineUp:"Select Line Up",selectLineDown:"Select Line Down",selectWholeLineUp:" Select Whole Line Up",selectWholeLineDown:"Select Whole Line Down",
selectLineStart:"Select Line Start",selectLineEnd:"Select Line End",selectCharPrevious:"Select Previous Character",selectCharNext:"Select Next Character",selectPageUp:"Select Page Up",selectPageDown:"Select Page Down",selectWordPrevious:"Select Previous Word",selectWordNext:"Select Next Word",selectTextStart:"Select Document Start",selectTextEnd:"Select Document End",deletePrevious:"Delete Previous Character",deleteNext:"Delete Next Character",deleteWordPrevious:"Delete Previous Word",deleteWordNext:"Delete Next Word",
deleteLineStart:"Delete Line Start",deleteLineEnd:"Delete Line End",tab:"Insert Tab",enter:"Insert Line Delimiter",enterNoCursor:"Insert Line Delimiter",selectAll:"Select All",copy:"Copy",cut:"Cut",paste:"Paste",uppercase:"To Upper Case",lowercase:"To Lower Case",capitalize:"Capitalize",reversecase:"Reverse Case",toggleWrapMode:"Toggle Wrap Mode",toggleTabMode:"Toggle Tab Mode",toggleOverwriteMode:"Toggle Overwrite Mode",committerOnTime:"${0} on ${1}",emacs:"Emacs",exchangeMarkPoint:"Exchange Mark and Point",
setMarkCommand:"Set Mark",clearMark:"Clear Mark",digitArgument:"Digit Argument ${0}",negativeArgument:"Negative Argument",Comment:"Comment","Flat outline":"Flat outline",incrementalFindStr:"Incremental find: ${0}",incrementalFindStrNotFound:"Incremental find: ${0} (not found)",incrementalFindReverseStr:"Reverse Incremental find: ${0}",incrementalFindReverseStrNotFound:"Reverse Incremental find: ${0} (not found)",find:"Find...",undo:"Undo",redo:"Redo",cancelMode:"Cancel Current Mode",findNext:"Find Next Occurrence",
findPrevious:"Find Previous Occurrence",incrementalFind:"Incremental Find",incrementalFindReverse:"Incremental Find Reverse",indentLines:"Indent Lines",unindentLines:"Unindent Lines",moveLinesUp:"Move Lines Up",moveLinesDown:"Move Lines Down",copyLinesUp:"Copy Lines Up",copyLinesDown:"Copy Lines Down",deleteLines:"Delete Lines",gotoLine:"Goto Line...",gotoLinePrompty:"Goto Line:",nextAnnotation:"Next Annotation",prevAnnotation:"Previous Annotation",expand:"Expand",collapse:"Collapse",expandAll:"Expand All",
collapseAll:"Collapse All",lastEdit:"Last Edit Location",trimTrailingWhitespaces:"Trim Trailing Whitespaces",toggleLineComment:"Toggle Line Comment",addBlockComment:"Add Block Comment",removeBlockComment:"Remove Block Comment",linkedModeEntered:"Linked Mode entered",linkedModeExited:"Linked Mode exited",syntaxError:"Syntax Error",contentAssist:"Content Assist",lineColumn:"Line ${0} : Col ${1}",vi:"vi",vimove:"(Move)",viyank:"(Yank)",videlete:"(Delete)",vichange:"(Change)",viLeft:"${0} Left",viRight:"${0} Right",
viUp:"${0} Up",viDown:"${0} Down",viw:"${0} Next Word",vib:"${0} Beginning of Word",viW:"${0} Next Word (ws stop)",viB:"${0} Beginning of Word (ws stop)",vie:"${0} End of Word",viE:"${0} End of Word (ws stop)",vi$:"${0} End of the line","vi^_":"${0} First non-blank Char Current Line","vi+":"${0} First Char Next Line","vi-":"${0} First Char Previous Line","vi|":"${0} nth Column in Line",viH:"${0} Top of Page",viM:"${0} Middle of Page",viL:"${0} Bottom of Page","vi/":"${0} Search Forward","vi?":"${0} Search Backward",
vin:"${0} Next Search",viN:"${0} Previous Search",vif:"${0} Search Char Fwd",viF:"${0} Search Char Bckwd",vit:"${0} Search Before Char Fwd",viT:"${0} Search Before Char Bckwd","vi,":"${0} Repeat Reverse Char Search","vi;":"${0} Repeat Char Search",viG:"${0} Go to Line",viycd:"${0} Current Line",via:"Append After Cursor",viA:"Append to End of Line",vii:"Insert Before Cursor",viI:"Insert at Beginning of Line",viO:"Insert Line Above",vio:"Insert Line Below",viR:"Begin Overwriting Text",vis:"Substitute a Character",
viS:"Substitute Entire Line",viC:"Change Text Until Line End",vip:"Paste After Char or Line",viP:"Paste Before Char or Line",viStar:"Search Word Under Cursor",next:"Next",previous:"Previous",replace:"Replace",replaceAll:"Replace All",findWith:"Find With",replaceWith:"Replace With",caseInsensitive:"Aa",regex:"/.*/",wholeWord:"\\b",caseInsensitiveTooltip:"Toggle Case Insensitive",regexTooltip:"Toogle Regex",wholeWordTooltip:"Toggle Whole Word",closeTooltip:"Close",replacingAll:"Replacing all...",replacedMatches:"Replaced ${0} matches",
nothingReplaced:"Nothing replaced",notFound:"Not found"});define("orion/editor/nls/messages",["orion/editor/i18n!orion/editor/nls/messages","orion/editor/nls/root/messages"],function(m,n){var k={root:n},e;for(e in m)m.hasOwnProperty(e)&&"undefined"===typeof k[e]&&(k[e]=m[e]);return k});
define("orion/editor/textModel",["orion/editor/eventTarget","orion/regex","orion/util"],function(m,n,k){function e(d,e){this._lastLineIndex=-1;this._text=[""];this._lineOffsets=[0];this.setText(d);this.setLineDelimiter(e)}e.prototype={destroy:function(){},find:function(d){1<this._text.length&&(this._text=[this._text.join("")]);var e=d.string,f=d.regex,b=e,a="",l=d.caseInsensitive;if(b)if(f){if(e=n.parse(b))b=e.pattern,a=e.flags}else b=e.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$\x26"),l&&(b=b.replace(/[iI\u0130\u0131]/g,
"[Ii\u0130\u0131]"));var h=null,p;if(b){var e=d.reverse,q=d.wrap,f=d.wholeWord,r=d.start||0;d=d.end;var k=null!==d&&void 0!==d;-1===a.indexOf("g")&&(a+="g");-1===a.indexOf("m")&&(a+="m");l&&-1===a.indexOf("i")&&(a+="i");f&&(b="\\b"+b+"\\b");var m=this._text[0],s,x,v=0;k&&(l=r<d?r:d,m=m.substring(l,r<d?d:r),v=l);var z=RegExp(b,a);e?p=function(){var a=null;for(z.lastIndex=0;;){x=z.lastIndex;s=z.exec(m);if(x===z.lastIndex)return null;if(s){if(!(s.index+v<r)){if(!q||a)break;r=m.length+v}a={start:s.index+
v,end:z.lastIndex+v}}else break}a&&(r=a.start);return a}:(k||(z.lastIndex=r),p=function(){for(;;){x=z.lastIndex;s=z.exec(m);if(x===z.lastIndex)break;if(s)return{start:s.index+v,end:z.lastIndex+v};if(!(0!==x&&q))break}return null});h=p()}return{next:function(){var a=h;a&&(h=p());return a},hasNext:function(){return null!==h}}},getCharCount:function(){for(var d=0,e=0;e<this._text.length;e++)d+=this._text[e].length;return d},getLine:function(d,e){var f=this.getLineCount();if(!(0<=d&&d<f))return null;
var b=this._lineOffsets[d];if(d+1<f){f=this.getText(b,this._lineOffsets[d+1]);if(e)return f;for(var b=f.length,a;10===(a=f.charCodeAt(b-1))||13===a;)b--;return f.substring(0,b)}return this.getText(b)},getLineAtOffset:function(d){var e=this.getCharCount();if(!(0<=d&&d<=e))return-1;var f=this.getLineCount();if(d===e)return f-1;var b,a,l=this._lastLineIndex;if(0<=l&&l<f&&(b=this._lineOffsets[l],a=l+1<f?this._lineOffsets[l+1]:e,b<=d&&d<a))return l;for(var h=f,p=-1;1<h-p;)if(l=Math.floor((h+p)/2),b=this._lineOffsets[l],
a=l+1<f?this._lineOffsets[l+1]:e,d<=b)h=l;else if(d<a){h=l;break}else p=l;return this._lastLineIndex=h},getLineCount:function(){return this._lineOffsets.length},getLineDelimiter:function(){return this._lineDelimiter},getLineEnd:function(d,e){var f=this.getLineCount();if(!(0<=d&&d<f))return-1;if(d+1<f){f=this._lineOffsets[d+1];if(e)return f;for(var b=this.getText(Math.max(this._lineOffsets[d],f-2),f),a=b.length,l;10===(l=b.charCodeAt(a-1))||13===l;)a--;return f-(b.length-a)}return this.getCharCount()},
getLineStart:function(d){return!(0<=d&&d<this.getLineCount())?-1:this._lineOffsets[d]},getText:function(d,e){void 0===d&&(d=0);void 0===e&&(e=this.getCharCount());if(d===e)return"";for(var f=0,b=0,a;b<this._text.length;){a=this._text[b].length;if(d<=f+a)break;f+=a;b++}for(var l=f,h=b;b<this._text.length;){a=this._text[b].length;if(e<=f+a)break;f+=a;b++}if(h===b)return this._text[h].substring(d-l,e-f);l=this._text[h].substring(d-l);f=this._text[b].substring(0,e-f);return l+this._text.slice(h+1,b).join("")+
f},onChanging:function(d){return this.dispatchEvent(d)},onChanged:function(d){return this.dispatchEvent(d)},setLineDelimiter:function(d,e){"auto"===d&&(d=void 0,1<this.getLineCount()&&(d=this.getText(this.getLineEnd(0),this.getLineEnd(0,!0))));this._lineDelimiter=d?d:k.platformDelimiter;if(e){var f=this.getLineCount();if(1<f){for(var b=Array(f),a=0;a<f;a++)b[a]=this.getLine(a);this.setText(b.join(this._lineDelimiter))}}},setText:function(d,e,f){void 0===d&&(d="");void 0===e&&(e=0);void 0===f&&(f=
this.getCharCount());if(!(e===f&&""===d)){for(var b=this.getLineAtOffset(e),a=this.getLineAtOffset(f),l=e,h=f-e,p=a-b,q=d.length,r=0,k=this.getLineCount(),m=0,s=0,n=0,v=[];;){-1!==m&&m<=n&&(m=d.indexOf("\r",n));-1!==s&&s<=n&&(s=d.indexOf("\n",n));if(-1===s&&-1===m)break;n=-1!==m&&-1!==s?m+1===s?s+1:(m<s?m:s)+1:-1!==m?m+1:s+1;v.push(e+n);r++}this.onChanging({type:"Changing",text:d,start:l,removedCharCount:h,addedCharCount:q,removedLineCount:p,addedLineCount:r});0===v.length&&(n=this.getLineStart(b),
a=a+1<k?this.getLineStart(a+1):this.getCharCount(),e!==n&&(d=this.getText(n,e)+d,e=n),f!==a&&(d+=this.getText(f,a),f=a));n=q-h;for(a=b+p+1;a<k;a++)this._lineOffsets[a]+=n;if(5E4>v.length)b=[b+1,p].concat(v),Array.prototype.splice.apply(this._lineOffsets,b);else{n=b+1;this._lineOffsets.splice(n,p);for(k=0;k<v.length;k+=5E4)b=[n,0].concat(v.slice(k,Math.min(v.length,k+5E4))),Array.prototype.splice.apply(this._lineOffsets,b),n+=5E4}for(n=k=0;n<this._text.length;){a=this._text[n].length;if(e<=k+a)break;
k+=a;n++}b=k;for(v=n;n<this._text.length;){a=this._text[n].length;if(f<=k+a)break;k+=a;n++}a=this._text[n];e=this._text[v].substring(0,e-b);f=a.substring(f-k);v=[v,n-v+1];e&&v.push(e);d&&v.push(d);f&&v.push(f);Array.prototype.splice.apply(this._text,v);0===this._text.length&&(this._text=[""]);this.onChanged({type:"Changed",start:l,removedCharCount:h,addedCharCount:q,removedLineCount:p,addedLineCount:r})}}};m.EventTarget.addMixin(e.prototype);return{TextModel:e}});
define("orion/editor/keyModes",["orion/keyBinding","orion/util"],function(m,n){function k(d){d&&(this._view=d,this._keyBindings=this.createKeyBindings(),this._keyBindingIndex=0)}function e(d){k.call(this,d)}k.prototype={createKeyBindings:function(){return[]},getKeyBindings:function(d){for(var e=[],f=this._keyBindings,b=0;b<f.length;b++)f[b].actionID===d&&e.push(f[b].keyBinding);return e},getView:function(){return this._view},isActive:function(){return-1!==this._view.getKeyModes().indexOf(this)},match:function(d){if("keydown"===
d.type)switch(d.keyCode){case 16:case 17:case 18:case 91:return}for(var e=this._keyBindingIndex,f=this._matchingKeyBindings||this._keyBindings,b=[],a=0;a<f.length;a++){var l=f[a],h=l.keyBinding.match(d,e);if(!0===h)return this._keyBindingIndex=0,this._matchingKeyBindings=null,l.actionID;"number"===typeof h&&b.push(l)}if(0===b.length)this._keyBindingIndex=0,this._matchingKeyBindings=null;else return this._keyBindingIndex++,this._matchingKeyBindings=b,"noop"},setKeyBinding:function(d,e){for(var f=this._keyBindings,
b=0;b<f.length;b++){var a=f[b];if(a.keyBinding.equals(d)){e?a.actionID=e:a.predefined?a.actionID="noop":f.splice(b,1);return}}e&&f.push({keyBinding:d,actionID:e})},setView:function(d){this._view=d}};e.prototype=new k;e.prototype.createKeyBindings=function(){var d=m.KeyBinding,e=[];e.push({actionID:"lineUp",keyBinding:new d(38),predefined:!0});e.push({actionID:"lineDown",keyBinding:new d(40),predefined:!0});e.push({actionID:"charPrevious",keyBinding:new d(37),predefined:!0});e.push({actionID:"charNext",
keyBinding:new d(39),predefined:!0});n.isMac?(e.push({actionID:"scrollPageUp",keyBinding:new d(33),predefined:!0}),e.push({actionID:"scrollPageDown",keyBinding:new d(34),predefined:!0}),e.push({actionID:"pageUp",keyBinding:new d(33,null,null,!0),predefined:!0}),e.push({actionID:"pageDown",keyBinding:new d(34,null,null,!0),predefined:!0}),e.push({actionID:"lineStart",keyBinding:new d(37,!0),predefined:!0}),e.push({actionID:"lineEnd",keyBinding:new d(39,!0),predefined:!0}),e.push({actionID:"wordPrevious",
keyBinding:new d(37,null,null,!0),predefined:!0}),e.push({actionID:"wordNext",keyBinding:new d(39,null,null,!0),predefined:!0}),e.push({actionID:"scrollTextStart",keyBinding:new d(36),predefined:!0}),e.push({actionID:"scrollTextEnd",keyBinding:new d(35),predefined:!0}),e.push({actionID:"textStart",keyBinding:new d(38,!0),predefined:!0}),e.push({actionID:"textEnd",keyBinding:new d(40,!0),predefined:!0}),e.push({actionID:"scrollPageUp",keyBinding:new d(38,null,null,null,!0),predefined:!0}),e.push({actionID:"scrollPageDown",
keyBinding:new d(40,null,null,null,!0),predefined:!0}),e.push({actionID:"lineStart",keyBinding:new d(37,null,null,null,!0),predefined:!0}),e.push({actionID:"lineEnd",keyBinding:new d(39,null,null,null,!0),predefined:!0}),e.push({actionID:"lineStart",keyBinding:new d(38,null,null,!0),predefined:!0}),e.push({actionID:"lineEnd",keyBinding:new d(40,null,null,!0),predefined:!0})):(e.push({actionID:"pageUp",keyBinding:new d(33),predefined:!0}),e.push({actionID:"pageDown",keyBinding:new d(34),predefined:!0}),
e.push({actionID:"lineStart",keyBinding:new d(36),predefined:!0}),e.push({actionID:"lineEnd",keyBinding:new d(35),predefined:!0}),e.push({actionID:"wordPrevious",keyBinding:new d(37,!0),predefined:!0}),e.push({actionID:"wordNext",keyBinding:new d(39,!0),predefined:!0}),e.push({actionID:"textStart",keyBinding:new d(36,!0),predefined:!0}),e.push({actionID:"textEnd",keyBinding:new d(35,!0),predefined:!0}));n.isFirefox&&n.isLinux&&(e.push({actionID:"lineUp",keyBinding:new d(38,!0),predefined:!0}),e.push({actionID:"lineDown",
keyBinding:new d(40,!0),predefined:!0}));n.isWindows&&(e.push({actionID:"scrollLineUp",keyBinding:new d(38,!0),predefined:!0}),e.push({actionID:"scrollLineDown",keyBinding:new d(40,!0),predefined:!0}));e.push({actionID:"selectLineUp",keyBinding:new d(38,null,!0),predefined:!0});e.push({actionID:"selectLineDown",keyBinding:new d(40,null,!0),predefined:!0});e.push({actionID:"selectCharPrevious",keyBinding:new d(37,null,!0),predefined:!0});e.push({actionID:"selectCharNext",keyBinding:new d(39,null,!0),
predefined:!0});e.push({actionID:"selectPageUp",keyBinding:new d(33,null,!0),predefined:!0});e.push({actionID:"selectPageDown",keyBinding:new d(34,null,!0),predefined:!0});n.isMac?(e.push({actionID:"selectLineStart",keyBinding:new d(37,!0,!0),predefined:!0}),e.push({actionID:"selectLineEnd",keyBinding:new d(39,!0,!0),predefined:!0}),e.push({actionID:"selectWordPrevious",keyBinding:new d(37,null,!0,!0),predefined:!0}),e.push({actionID:"selectWordNext",keyBinding:new d(39,null,!0,!0),predefined:!0}),
e.push({actionID:"selectTextStart",keyBinding:new d(36,null,!0),predefined:!0}),e.push({actionID:"selectTextEnd",keyBinding:new d(35,null,!0),predefined:!0}),e.push({actionID:"selectTextStart",keyBinding:new d(38,!0,!0),predefined:!0}),e.push({actionID:"selectTextEnd",keyBinding:new d(40,!0,!0),predefined:!0}),e.push({actionID:"selectLineStart",keyBinding:new d(37,null,!0,null,!0),predefined:!0}),e.push({actionID:"selectLineEnd",keyBinding:new d(39,null,!0,null,!0),predefined:!0}),e.push({actionID:"selectLineStart",
keyBinding:new d(38,null,!0,!0),predefined:!0}),e.push({actionID:"selectLineEnd",keyBinding:new d(40,null,!0,!0),predefined:!0})):(n.isLinux&&(e.push({actionID:"selectWholeLineUp",keyBinding:new d(38,!0,!0),predefined:!0}),e.push({actionID:"selectWholeLineDown",keyBinding:new d(40,!0,!0),predefined:!0})),e.push({actionID:"selectLineStart",keyBinding:new d(36,null,!0),predefined:!0}),e.push({actionID:"selectLineEnd",keyBinding:new d(35,null,!0),predefined:!0}),e.push({actionID:"selectWordPrevious",
keyBinding:new d(37,!0,!0),predefined:!0}),e.push({actionID:"selectWordNext",keyBinding:new d(39,!0,!0),predefined:!0}),e.push({actionID:"selectTextStart",keyBinding:new d(36,!0,!0),predefined:!0}),e.push({actionID:"selectTextEnd",keyBinding:new d(35,!0,!0),predefined:!0}));e.push({actionID:"undo",keyBinding:new m.KeyBinding("z",!0),predefined:!0});n.isMac?e.push({actionID:"redo",keyBinding:new m.KeyBinding("z",!0,!0),predefined:!0}):e.push({actionID:"redo",keyBinding:new m.KeyBinding("y",!0),predefined:!0});
e.push({actionID:"deletePrevious",keyBinding:new d(8),predefined:!0});e.push({actionID:"deletePrevious",keyBinding:new d(8,null,!0),predefined:!0});e.push({actionID:"deleteNext",keyBinding:new d(46),predefined:!0});e.push({actionID:"deleteWordPrevious",keyBinding:new d(8,!0),predefined:!0});e.push({actionID:"deleteWordPrevious",keyBinding:new d(8,!0,!0),predefined:!0});e.push({actionID:"deleteWordNext",keyBinding:new d(46,!0),predefined:!0});e.push({actionID:"tab",keyBinding:new d(9),predefined:!0});
e.push({actionID:"shiftTab",keyBinding:new d(9,null,!0),predefined:!0});e.push({actionID:"enter",keyBinding:new d(13),predefined:!0});e.push({actionID:"enter",keyBinding:new d(13,null,!0),predefined:!0});e.push({actionID:"selectAll",keyBinding:new d("a",!0),predefined:!0});e.push({actionID:"toggleTabMode",keyBinding:new d("m",!0),predefined:!0});n.isMac&&(e.push({actionID:"deleteNext",keyBinding:new d(46,null,!0),predefined:!0}),e.push({actionID:"deleteWordPrevious",keyBinding:new d(8,null,null,!0),
predefined:!0}),e.push({actionID:"deleteWordNext",keyBinding:new d(46,null,null,!0),predefined:!0}));e.push({actionID:"toggleWrapMode",keyBinding:new m.KeyBinding("w",!0,!1,!0)});e.push({actionID:"toggleOverwriteMode",keyBinding:new m.KeyBinding(45)});if(!n.isFirefox){var f=n.isMac&&n.isChrome;e.push({actionID:"noop",keyBinding:new d("u",!f,!1,!1,f),predefined:!0});e.push({actionID:"noop",keyBinding:new d("i",!f,!1,!1,f),predefined:!0});e.push({actionID:"noop",keyBinding:new d("b",!f,!1,!1,f),predefined:!0})}n.isFirefox&&
(e.push({actionID:"copy",keyBinding:new d(45,!0),predefined:!0}),e.push({actionID:"paste",keyBinding:new d(45,null,!0),predefined:!0}),e.push({actionID:"cut",keyBinding:new d(46,null,!0),predefined:!0}));n.isMac&&(e.push({actionID:"lineStart",keyBinding:new d("a",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"lineEnd",keyBinding:new d("e",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"lineUp",keyBinding:new d("p",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"lineDown",keyBinding:new d("n",!1,!1,
!1,!0),predefined:!0}),e.push({actionID:"charPrevious",keyBinding:new d("b",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"charNext",keyBinding:new d("f",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"deletePrevious",keyBinding:new d("h",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"deleteNext",keyBinding:new d("d",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"deleteLineEnd",keyBinding:new d("k",!1,!1,!1,!0),predefined:!0}),n.isFirefox?(e.push({actionID:"scrollPageDown",keyBinding:new d("v",!1,
!1,!1,!0),predefined:!0}),e.push({actionID:"deleteLineStart",keyBinding:new d("u",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"deleteWordPrevious",keyBinding:new d("w",!1,!1,!1,!0),predefined:!0})):(e.push({actionID:"pageDown",keyBinding:new d("v",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"centerLine",keyBinding:new d("l",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"enterNoCursor",keyBinding:new d("o",!1,!1,!1,!0),predefined:!0})));return e};return{KeyMode:k,DefaultKeyMode:e}});
define("orion/editor/util",[],function(){return{contains:function(m,n){if(!n)return!1;if(!m.compareDocumentPosition){for(var k=n;k;){if(m===k)return!0;k=k.parentNode}return!1}return m===n||0!==(m.compareDocumentPosition(n)&16)},addEventListener:function(m,n,k,e){"function"===typeof m.addEventListener?m.addEventListener(n,k,!0===e):m.attachEvent("on"+n,k)},removeEventListener:function(m,n,k,e){"function"===typeof m.removeEventListener?m.removeEventListener(n,k,!0===e):m.detachEvent("on"+n,k)},Animation:function(){function m(m){this.options=
m}m.prototype.play=function(){var m="number"===typeof this.options.duration?this.options.duration:350,k=this.options.easing||this.defaultEasing,e=this.options.onAnimate||function(){},d=this.options.curve[0],g=this.options.curve[1],f=g-d,b=-1,a,l=this;this.interval=this.options.window.setInterval(function(){b=-1===b?(new Date).getTime():b;var h=((new Date).getTime()-b)/m;1>h?(h=k(h),a=d+h*f,e(a)):(e(g),l.stop())},"number"===typeof this.options.rate?this.options.rate:20)};m.prototype.stop=function(){this.options.window.clearInterval(this.interval);
(this.options.onEnd||function(){})()};m.prototype.defaultEasing=function(m){return Math.sin(m*(Math.PI/2))};return m}()}});
define("orion/editor/textView","i18n!orion/editor/nls/messages orion/editor/textModel orion/editor/keyModes orion/editor/eventTarget orion/editor/textTheme orion/editor/util orion/util".split(" "),function(m,n,k,e,d,g,f){function b(a,b,d){if(d){b.className="";d=b.attributes;for(var e=d.length;0<e--;)(!f.isIE||9<=f.isIE||9>f.isIE&&d[e].specified)&&b.removeAttribute(d[e].name)}if(a){a.styleClass&&(b.className=a.styleClass);if(d=a.style)for(var h in d)d.hasOwnProperty(h)&&(b.style[h]=d[h]);if(a=a.attributes)for(var l in a)a.hasOwnProperty(l)&&
b.setAttribute(l,a[l])}}function a(a){return a instanceof Array?a.slice(0):a}function l(a,b){if(!a)return b;if(!b)return a;for(var d in b)b.hasOwnProperty(d)&&(a.hasOwnProperty(d)||(a[d]=b[d]));return a}function h(a,b){if(a===b)return!0;if(a&&!b||!a&&b||a&&a.constructor===String||b&&b.constructor===String)return!1;if(a instanceof Array||b instanceof Array){if(!(a instanceof Array&&b instanceof Array)||a.length!==b.length)return!1;for(var d=0;d<a.length;d++)if(!h(a[d],b[d]))return!1;return!0}if(!(a instanceof
Object)||!(b instanceof Object))return!1;for(d in a)if(a.hasOwnProperty(d)&&(!b.hasOwnProperty(d)||!h(a[d],b[d])))return!1;for(d in b)if(!a.hasOwnProperty(d))return!1;return!0}function p(a,b,d){for(var f=0,e=0,h=0,l=a.length;h<l;){-1!==f&&f<=h&&(f=a.indexOf("\r",h));-1!==e&&e<=h&&(e=a.indexOf("\n",h));var p=h,g;if(-1===e&&-1===f){b(a.substring(h));break}-1!==f&&-1!==e?f+1===e?(g=f,h=e+1):(g=f<e?f:e,h=(f<e?f:e)+1):-1!==f?(g=f,h=f+1):(g=e,h=e+1);b(a.substring(p,g));d()}}function q(a){var b,d,f,e,h=
a.ownerDocument.defaultView||a.ownerDocument.parentWindow;h.getComputedStyle?(a=h.getComputedStyle(a,null),b=a.getPropertyValue("padding-left"),d=a.getPropertyValue("padding-top"),f=a.getPropertyValue("padding-right"),e=a.getPropertyValue("padding-bottom")):a.currentStyle&&(b=a.currentStyle.paddingLeft,d=a.currentStyle.paddingTop,f=a.currentStyle.paddingRight,e=a.currentStyle.paddingBottom);return{left:parseInt(b,10)||0,top:parseInt(d,10)||0,right:parseInt(f,10)||0,bottom:parseInt(e,10)||0}}function r(a){var b,
d,f,e,h=a._trim;if(!h){var h=q(a),l=a.ownerDocument.defaultView||a.ownerDocument.parentWindow;l.getComputedStyle?(e=l.getComputedStyle(a,null),b=e.getPropertyValue("border-left-width"),d=e.getPropertyValue("border-top-width"),f=e.getPropertyValue("border-right-width"),e=e.getPropertyValue("border-bottom-width")):a.currentStyle&&(b=a.currentStyle.borderLeftWidth,d=a.currentStyle.borderTopWidth,f=a.currentStyle.borderRightWidth,e=a.currentStyle.borderBottomWidth);b=parseInt(b,10)||0;d=parseInt(d,10)||
0;f=parseInt(f,10)||0;e=parseInt(e,10)||0;h.left+=b;h.top+=d;h.right+=f;h.bottom+=e;a._trim=h}return h}function t(a,b,d,f){function e(b){if(b.animationName===l){var d=b.target;"function"===typeof d.__DOMReady&&(a.defaultView||a.parentWindow).setTimeout(function(){d.__DOMReady()},0)}}function h(a,b){for(var d=["","-webkit-","-moz-","-ms-","-o-"],f="",e="body ."+a+" {\n",u=0;u<d.length;u++)f+="@"+d[u]+"keyframes "+b+" {\nfrom { opacity: 0.99; }\nto { opacity: 1; }\n}\n",e+=d[u]+"animation-duration: 0.001s;\n"+
d[u]+"animation-name: "+b+";\n";return f+(e+"}")}d="_"+d+"DOMReady";b.className=b.className?b.className+" "+d:d;b.__DOMReady=f;f=d+"Style";if(!a.getElementById(f)){var l=d+"Animation";z(a,"animationstart",e,!1);z(a,"MSAnimationStart",e,!1);z(a,"webkitAnimationStart",e,!1);b=a.createElement("style");b.id=f;f=a.getElementsByTagName("head")[0]||a.documentElement;b.appendChild(a.createTextNode(h(d,l)));f.insertBefore(b,f.firstChild)}}function w(a,b,d){this.start=a;this.end=b;this.caret=d}function s(a){this.left=
a.left;this.top=a.top;this.right=a.right;this.bottom=a.bottom}function x(a,b,d){this.view=a;this.lineIndex=b;this._lineDiv=d}function v(a){this._init(a||{})}var z=g.addEventListener,A=g.removeEventListener,B=g.Animation;w.prototype={clone:function(){return new w(this.start,this.end,this.caret)},collapse:function(){this.caret?this.end=this.start:this.start=this.end},extend:function(a){this.caret?this.start=a:this.end=a;this.start>this.end&&(a=this.start,this.start=this.end,this.end=a,this.caret=!this.caret)},
setCaret:function(a){this.end=this.start=a;this.caret=!1},getCaret:function(){return this.caret?this.start:this.end},toString:function(){return"start\x3d"+this.start+" end\x3d"+this.end+(this.caret?" caret is at start":" caret is at end")},isEmpty:function(){return this.start===this.end},equals:function(a){return this.caret===a.caret&&this.start===a.start&&this.end===a.end}};s.prototype={toString:function(){return"{l\x3d"+this.left+", t\x3d"+this.top+", r\x3d"+this.right+", b\x3d"+this.bottom+"}"}};
x.prototype={create:function(a,b){if(!this._lineDiv){var d=this._lineDiv=this._createLine(a,b,this.lineIndex);d._line=this;return d}},_createLine:function(a,d,e){var l=this.view,p=l._model,g=p.getLine(e),q=p.getLineStart(e),r={type:"LineStyle",textView:l,lineIndex:e,lineText:g,lineStart:q};l.onLineStyle(r);var k=a.ownerDocument,p=d||f.createElement(k,"div");if(!d||!h(d.viewStyle,r.style))b(r.style,p,d),d&&(d._trim=null),p.viewStyle=r.style,p.setAttribute("role","presentation");p.lineIndex=e;if(d&&
p.viewLineText===g&&h(r.ranges,p.viewRanges))return p;p.viewRanges=r.ranges;p.viewLineText=g;e=[];this._createRanges(r.ranges,g,0,g.length,q,{tabOffset:0,ranges:e});r=" ";!l._fullSelection&&9>f.isIE&&(r="\ufeff");l={text:r,style:l._metrics.largestFontStyle,ignoreChars:1};0===e.length||!e[e.length-1].style||"div"!==e[e.length-1].style.tagName?e.push(l):e.splice(e.length-1,0,l);var t,m,s,w=r=0;if(f.isFirefox&&2E3<g.length){d&&(p.innerHTML="",d.lineWidth=void 0);d=k.createDocumentFragment();for(g=0;g<
e.length;g++)l=e[g],q=l.text,t=l.style,t=this._createSpan(p,q,t,l.ignoreChars),d.appendChild(t);p.appendChild(d)}else{var n,v;if(d){if(m=d.modelChangedEvent)0===m.removedLineCount&&0===m.addedLineCount?(v=m.start-q,n=m.addedCharCount-m.removedCharCount):v=-1,d.modelChangedEvent=void 0;m=d.firstChild}for(g=0;g<e.length;g++){l=e[g];q=l.text;r+=q.length;t=l.style;if(m)if(s=m.firstChild.data,k=m.viewStyle,s===q&&h(t,k)){w+=s.length;m._rectsCache=void 0;t=m=m.nextSibling;continue}else for(;m;){if(-1!==
v){k=r;k>=v&&(k-=n);s=(s=m.firstChild.data)?s.length:0;if(w+s>k)break;w+=s}k=m.nextSibling;p.removeChild(m);m=k}t=this._createSpan(p,q,t,l.ignoreChars);m?p.insertBefore(t,m):p.appendChild(t);d&&(d.lineWidth=void 0)}if(d)for(n=t?t.nextSibling:null;n;)k=n.nextSibling,d.removeChild(n),n=k}p.parentNode||a.appendChild(p);return p},_createRanges:function(a,b,d,f,e,l){if(!(d>f)){if(a)for(var p=0;p<a.length;p++){var g=a[p];if(!(g.end<e+d)){var q=Math.max(e+d,g.start)-e;if(q>f)break;var r=Math.min(e+f,g.end)-
e;if(q<=r){q=Math.max(d,q);r=Math.min(f,r);d<q&&this._createRange(b,d,q,null,l);if(!g.style||!g.style.unmergeable)for(;p+1<a.length&&a[p+1].start-e===r&&h(g.style,a[p+1].style);)g=a[p+1],r=Math.min(e+f,g.end)-e,p++;this._createRange(b,q,r,g.style,l);d=r}}}d<f&&this._createRange(b,d,f,null,l)}},_createRange:function(a,b,d,f,e){if(!(b>d)){var h=this.view._customTabSize;if(h&&8!==h)for(var l=a.indexOf("\t",b);-1!==l&&l<d;){b<l&&(b={text:a.substring(b,l),style:f},e.ranges.push(b),e.tabOffset+=b.text.length);
b=h-e.tabOffset%h;if(0<b){for(var p="\u00a0",g=1;g<b;g++)p+=" ";b={text:p,style:f,ignoreChars:b-1};e.ranges.push(b);e.tabOffset+=b.text.length}b=l+1;if(b===d)return;l=a.indexOf("\t",b)}b<=d&&(b={text:a.substring(b,d),style:f},e.ranges.push(b),e.tabOffset+=b.text.length)}},_createSpan:function(a,d,e,h){var l=this.view,p="span";e&&e.tagName&&(p=e.tagName.toLowerCase());var g="a"===p;g&&(this.hasLink=!0);g&&!l._linksVisible&&(p="span");g=a.ownerDocument;a=f.createElement(a.ownerDocument,p);a.appendChild(g.createTextNode(e&&
e.text?e.text:d));e&&e.html?(a.innerHTML=e.html,a.ignore=!0):e&&e.node&&(a.appendChild(e.node),a.ignore=!0);b(e,a);if("a"===p){var q=l._getWindow();z(a,"click",function(a){return l._handleLinkClick(a?a:q.event)},!1)}a.viewStyle=e;h&&(a.ignoreChars=h);return a},_ensureCreated:function(){return this._lineDiv?this._lineDiv:this._createdDiv=this.create(this.view._clientDiv,null)},getBoundingClientRect:function(a,b){var d=this._ensureCreated(),e=this.view;if(void 0===a)return this._getLineBoundingClientRect(d,
!0);var h=e._model,l=d.ownerDocument,p=this.lineIndex,g=null;if(a<h.getLineEnd(p)){var q=h.getLineStart(p);this.forEach(function(b){var h=b.firstChild,p=this._nodeLength(b);if(q+p>a){var y=a-q;if(1===h.length)g=new s(b.getBoundingClientRect());else if(e._isRangeRects)p=l.createRange(),p.setStart(h,y),p.setEnd(h,y+1),g=new s(p.getBoundingClientRect());else if(f.isIE)p=l.body.createTextRange(),p.moveToElementText(b),p.collapse(),(h=0===y&&8===f.isIE)&&(y=1),p.moveEnd("character",y+1),p.moveStart("character",
y),g=new s(p.getBoundingClientRect()),h&&(g.left=b.getClientRects()[0].left);else{var r=h.data;b.removeChild(h);b.appendChild(l.createTextNode(r.substring(0,y)));var k=f.createElement(l,"span");k.appendChild(l.createTextNode(r.substring(y,y+1)));b.appendChild(k);b.appendChild(l.createTextNode(r.substring(y+1)));g=new s(k.getBoundingClientRect());b.innerHTML="";b.appendChild(h);this._createdDiv||(b=e._getSelection(),(q<=b.start&&b.start<q+p||q<=b.end&&b.end<q+p)&&e._updateDOMSelection())}f.isIE&&(y=
d.ownerDocument.defaultView||d.ownerDocument.parentWindow,b=y.screen.logicalXDPI/y.screen.deviceXDPI,y=y.screen.logicalYDPI/y.screen.deviceYDPI,g.left*=b,g.right*=b,g.top*=y,g.bottom*=y);return!1}q+=p;return!0})}h=this.getBoundingClientRect();g||(e._wrapMode?(p=this.getClientRects(),g=p[p.length-1],g.left=g.right,g.left+=h.left,g.top+=h.top,g.right+=h.left,g.bottom+=h.top):(g=new s(h),g.left=g.right));if(b||void 0===b)g.left-=h.left,g.top-=h.top,g.right-=h.left,g.bottom-=h.top;return g},forEach:function(a){for(var b=
this._ensureCreated().firstChild;b;){var d=b.nextSibling;if(!b.ignore&&!a.call(this,b))break;b=d}},_getClientRects:function(a,b){var d,f,e,h;if(!a._rectsCache){d=a.getClientRects();f=Array(d.length);for(h=0;h<d.length;h++)e=f[h]=new s(d[h]),e.left-=b.left,e.top-=b.top,e.right-=b.left,e.bottom-=b.top;a._rectsCache=f}d=a._rectsCache;f=[d.length];for(h=0;h<d.length;h++)f[h]=new s(d[h]);return f},getClientRects:function(a){if(!this.view._wrapMode)return[this.getBoundingClientRect()];var b=[],d=this._ensureCreated().getBoundingClientRect();
this.forEach(function(a){a=this._getClientRects(a,d);for(var f=0;f<a.length;f++){var e=a[f],h,u;if(e.top!==e.bottom){var l=e.top+(e.bottom-e.top)/2;for(h=0;h<b.length&&!(u=b[h],u.top<=l&&l<u.bottom);h++);h===b.length?b.push(e):(e.left<u.left&&(u.left=e.left),e.top<u.top&&(u.top=e.top),e.right>u.right&&(u.right=e.right),e.bottom>u.bottom&&(u.bottom=e.bottom))}}return!0});return void 0!==a?b[a]:b},_getLineBoundingClientRect:function(a,b){var d=new s(a.getBoundingClientRect());if(!this.view._wrapMode){d.right=
d.left;for(var f=a.lastChild;f&&f.ignoreChars===f.firstChild.length;)f=f.previousSibling;f&&(f=f.getBoundingClientRect(),d.right=f.right+r(a).right)}b&&(f=r(a),d.left+=f.left,d.right-=f.right);return d},getLineCount:function(){return!this.view._wrapMode?1:this.getClientRects().length},getLineIndex:function(a){if(!this.view._wrapMode)return 0;var b=this.getClientRects();a=this.getBoundingClientRect(a);a=a.top+(a.bottom-a.top)/2;for(var d=0;d<b.length;d++)if(b[d].top<=a&&a<b[d].bottom)return d;return b.length-
1},getLineStart:function(a){if(!this.view._wrapMode||0===a)return this.view._model.getLineStart(this.lineIndex);var b=this.getClientRects();return this.getOffset(b[a].left+1,b[a].top+1)},_nodeLength:function(a){if(!a||a.ignore)return 0;var b=a.firstChild.length;a.ignoreChars&&(b-=a.ignoreChars);return b},getModelOffset:function(a,b){if(!a)return 0;var d=0;this.forEach(function(f){var e=f.firstChild;if(e===a)return f.ignoreChars&&(d-=f.ignoreChars),d+=b,!1;f.ignoreChars&&(d-=f.ignoreChars);d+=e.data.length;
return!0});return Math.max(0,d)+this.view._model.getLineStart(this.lineIndex)},getNodeOffset:function(a){var b=0,d,f,e=this.view._model,h=e.getLineStart(this.lineIndex),l=a-h,p=e.getLineEnd(this.lineIndex)-h;this.forEach(function(a){var e=a.firstChild,h=this._nodeLength(a);if(h+b>l||b+h>=p)return d=e,f=l-b,a.ignoreChars&&(0<h&&f===h)&&(f+=a.ignoreChars),!1;b+=h;return!0});return{node:d,offset:f}},getText:function(a){var b="",d=0;this.forEach(function(f){var e;if(f.ignoreChars){e=f.lastChild;for(var h=
0,l=[],p=-1;e;){var g=e.data;if(g)for(var q=g.length-1;0<=q;q--){var r=g.substring(q,q+1);h<f.ignoreChars&&(" "===r||"\ufeff"===r)?h++:l.push("\u00a0"===r?"\t":r)}a===e&&(p=l.length);e=e.previousSibling}l=l.reverse().join("");-1!==p&&(d=b.length+l.length-p);b+=l}else for(e=f.firstChild;e;)a===e&&(d=b.length),b+=e.data,e=e.nextSibling;return!0});return{text:b,offset:d}},getOffset:function(a,b){function d(e,C,q){var m=e.firstChild,E=t._nodeLength(e),s=r.ownerDocument,w=s.defaultView||s.parentWindow,
n=f.isIE?w.screen.logicalXDPI/w.screen.deviceXDPI:1,v=f.isIE?w.screen.logicalYDPI/w.screen.deviceYDPI:1,x,L,z,w=q.left+k.left,Q,A;if(f.isIE||h._isRangeRects){for(var s=h._isRangeRects?s.createRange():s.body.createTextRange(),R=E,B=-1;1<R-B;){var J=Math.floor((R+B)/2);q=B+1;x=J===E-1&&e.ignoreChars?m.length:J+1;Q=0===q&&8===f.isIE;h._isRangeRects?(s.setStart(m,q),s.setEnd(m,x)):(Q&&(q=1),s.moveToElementText(e),s.move("character",q),s.moveEnd("character",x-q));A=s.getClientRects();for(var U=!1,X=0;X<
A.length;X++)if(q=A[X],x=(Q?w:q.left)*n-k.left,z=q.right*n-k.left,L=q.top*v-k.top,q=q.bottom*v-k.top,x<=a&&a<z&&(!h._wrapMode||L<=b&&b<q)){U=!0;break}U?R=J:B=J}C+=R;q=R;x=R===E-1&&e.ignoreChars?m.length:Math.min(R+1,m.length);h._isRangeRects?(s.setStart(m,q),s.setEnd(m,x)):(s.moveToElementText(e),s.move("character",q),s.moveEnd("character",x-q));A=s.getClientRects();E=!1;0<A.length&&(q=A[0],x=(Q?w:q.left)*n-k.left,z=q.right*n-k.left,E=a>x+(z-x)/2);e=C-g;m=l.getLine(p);n=m.charCodeAt(e);55296<=n&&
56319>=n&&E?e<m.length&&(n=m.charCodeAt(e+1),56320<=n&&57343>=n&&(C+=1)):56320<=n&&(57343>=n&&!E)&&0<e&&(n=m.charCodeAt(e-1),55296<=n&&56319>=n&&(C-=1));E&&C++}else{n=[];for(Q=0;Q<E;Q++)n.push("\x3cspan\x3e"),Q===E-1?n.push(m.data.substring(Q)):n.push(m.data.substring(Q,Q+1)),n.push("\x3c/span\x3e");e.innerHTML=n.join("");for(n=e.firstChild;n;){q=n.getBoundingClientRect();x=q.left-k.left;z=q.right-k.left;if(x<=a&&a<z){a>x+(z-x)/2&&C++;break}C++;n=n.nextSibling}t._createdDiv||(e.innerHTML="",e.appendChild(m),
e=h._getSelection(),(C<=e.start&&e.start<C+E||C<=e.end&&e.end<C+E)&&h._updateDOMSelection())}return C}function e(d){if(d.ignore)return null;d=t._getClientRects(d,k);for(var f=0;f<d.length;f++){var l=d[f];if(l.left<=a&&a<l.right&&(!h._wrapMode||l.top<=b&&b<l.bottom))return l}return null}var h=this.view,l=h._model,p=this.lineIndex,g=l.getLineStart(p),q=l.getLineEnd(p);if(g===q)return g;var r=this._ensureCreated(),k=this.getBoundingClientRect(),t=this,m,s;if(h._wrapMode){m=this.getClientRects();b<m[0].top&&
(b=m[0].top);for(var w=0;w<m.length&&!(s=m[w],s.top<=b&&b<s.bottom);w++);a<s.left&&(a=s.left);a>s.right&&(a=s.right-1)}else 0>a&&(a=0),a>k.right-k.left&&(a=k.right-k.left);var n,v;if(this._lastHitChild&&this._lastHitChild.parentNode){if(n=this._lastHitOffset,v=this._lastHitChild,s=e(v),!s){m=n;for(var w=n+this._nodeLength(v),x=v.previousSibling,z=v.nextSibling;x||z;){if(x){m-=this._nodeLength(x);if(s=e(x)){v=x;n=m;break}x=x.previousSibling}if(z){if(s=e(z)){v=z;n=w;break}w+=this._nodeLength(z);z=z.nextSibling}}}}else n=
g,this.forEach(function(a){v=a;if(s=e(v))return!1;n+=this._nodeLength(v);return!0});v&&s&&(this._lastHitChild=v,this._lastHitOffset=n,n=d(v,n,s));return Math.min(q,Math.max(g,n))},getNextOffset:function(a,b){if("line"===b.unit){var d=this.view._model,e=d.getLineAtOffset(a);if(0<b.count)return b.count--,d.getLineEnd(e);b.count++;return d.getLineStart(e)}return"wordend"===b.unit||"wordWS"===b.unit||"wordendWS"===b.unit?this._getNextOffset_W3C(a,b):f.isIE?this._getNextOffset_IE(a,b):this._getNextOffset_W3C(a,
b)},_getNextOffset_W3C:function(a,b){function d(a){return 33<=a&&47>=a||58<=a&&64>=a||91<=a&&94>=a||96===a||123<=a&&126>=a}function f(a){return 32===a||9===a}var e=this.view._model,h=e.getLineAtOffset(a),l=e.getLine(h),p=e.getLineStart(h),e=e.getLineEnd(h),h=l.length,g=a-p,q,r=0>b.count?-1:1;if("word"===b.unit||"wordend"===b.unit||"wordWS"===b.unit||"wordendWS"===b.unit)for(var k,m,t;0!==b.count;){if(0<b.count){if(g===h)return e;q=l.charCodeAt(g);k=d(q);m=!k&&!f(q);for(g++;g<h;){q=l.charCodeAt(g);
if("wordWS"!==b.unit&&"wordendWS"!==b.unit){t=d(q);if("wordend"===b.unit){if(!t&&k)break}else if(t&&!k)break;q=!t&&!f(q)}else q=!f(q);if("wordend"===b.unit||"wordendWS"===b.unit){if(!q&&m)break}else if(q&&!m)break;m=q;k=t;g++}}else{if(0===g)return p;g--;q=l.charCodeAt(g);k=d(q);for(m=!k&&!f(q);0<g;){q=l.charCodeAt(g-1);if("wordWS"!==b.unit&&"wordendWS"!==b.unit){t=d(q);if("wordend"===b.unit){if(t&&!k)break}else if(!t&&k)break;q=!t&&!f(q)}else q=!f(q);if("wordend"===b.unit||"wordendWS"===b.unit){if(q&&
!m)break}else if(!q&&m)break;m=q;k=t;g--}}b.count-=r}else for(;0!==b.count&&0<=g+r&&g+r<=h;)g+=r,q=l.charCodeAt(g),56320<=q&&57343>=q&&0<g&&(q=l.charCodeAt(g-1),55296<=q&&56319>=q&&(g+=r)),b.count-=r;return p+g},_getNextOffset_IE:function(a,b){var d=this._ensureCreated(),f=this.view._model,e=this.lineIndex,h=0,l;l=f.getLineStart(e);var p=f.getLine(e),g=f.getLineStart(e),q=d.ownerDocument,r=0>b.count?-1:1;if(a===f.getLineEnd(e)){for(d=d.lastChild;d&&d.ignoreChars===d.firstChild.length;)d=d.previousSibling;
if(!d)return l;h=q.body.createTextRange();h.moveToElementText(d);l=h.text.length;h.moveEnd(b.unit,r);h=a+h.text.length-l}else if(a===l&&0>b.count)h=l;else for(d=d.firstChild;d;){f=this._nodeLength(d);if(l+f>a){h=q.body.createTextRange();if(a===l&&0>b.count){for(l=d.previousSibling;l&&(!l.firstChild||!l.firstChild.length);)l=l.previousSibling;h.moveToElementText(l?l:d.previousSibling)}else h.moveToElementText(d),h.collapse(),h.moveEnd("character",a-l);l=h.text.length;h.moveEnd(b.unit,r);h=a+h.text.length-
l;break}l=f+l;d=d.nextSibling}l=h-g;c=p.charCodeAt(l);56320<=c&&57343>=c&&0<l&&(c=p.charCodeAt(l-1),55296<=c&&56319>=c&&(l+=r));b.count-=r;return l+g},updateLinks:function(){var a=this._ensureCreated();if(this.hasLink){var b=this;this.forEach(function(d){var f=d.viewStyle;f&&(f.tagName&&"a"===f.tagName.toLowerCase())&&a.replaceChild(b._createSpan(a,d.firstChild.data,f),d);return!0})}},destroy:function(){var a=this._createdDiv;a&&(a.parentNode.removeChild(a),this._createdDiv=null)}};v.prototype={addKeyMode:function(a,
b){var d=this._keyModes;void 0!==b?d.splice(b,0,a):d.push(a);a._modeAdded&&a._modeAdded()},addRuler:function(a,b){a.setView(this);var d=this._rulers;if(void 0!==b){var f,e;for(e=f=0;f<d.length&&e<b;f++)a.getLocation()===d[f].getLocation()&&e++;d.splice(e,0,a);b=e}else d.push(a);this._createRuler(a,b);this._update()},computeSize:function(){var a=0,b=0,d=this._model,e=this._clientDiv;if(!e)return{width:a,height:b};var h=e.style.width;f.isWebkit&&(e.style.width="0x7fffffffpx");for(var d=d.getLineCount(),
l=0;l<d;l++){var p=this._getLine(l),g=p.getBoundingClientRect(),a=Math.max(a,g.right-g.left),b=b+(g.bottom-g.top);p.destroy()}f.isWebkit&&(e.style.width=h);e=this._getViewPadding();a+=e.right+e.left+this._metrics.scrollWidth;b+=e.bottom+e.top+this._metrics.scrollWidth;return{width:a,height:b}},convert:function(a,b,d){if(this._clientDiv){var f=this._getScroll(),e=this._getViewPadding(),h=this._viewDiv.getBoundingClientRect();"document"===b&&(void 0!==a.x&&(a.x+=-f.x+h.left+e.left),void 0!==a.y&&(a.y+=
-f.y+h.top+e.top));"document"===d&&(void 0!==a.x&&(a.x+=f.x-h.left-e.left),void 0!==a.y&&(a.y+=f.y-h.top-e.top));return a}},destroy:function(){for(var a=0;a<this._rulers.length;a++)this._rulers[a].setView(null);this.rulers=null;this._destroyView();this.onDestroy({type:"Destroy"});this._parent=null;this._model&&this._model.destroy&&this._model.destroy();this._actions=this._keyModes=this._doubleClickSelection=this._selection=this._theme=this._model=null},focus:function(){this._clientDiv&&(this._updateDOMSelection(),
this._clientDiv.focus(),this._updateDOMSelection())},hasFocus:function(){return this._hasFocus},getActionDescription:function(a){if(a=this._actions[a])return a.actionDescription},getActions:function(a){var b=[],d=this._actions,f;for(f in d)d.hasOwnProperty(f)&&(a||!d[f].defaultHandler)&&b.push(f);return b},getBottomIndex:function(a){return!this._clientDiv?0:this._getBottomIndex(a)},getBottomPixel:function(){return!this._clientDiv?0:this._getScroll().y+this._getClientHeight()},getCaretOffset:function(){return this._getSelection().getCaret()},
getClientArea:function(){if(!this._clientDiv)return{x:0,y:0,width:0,height:0};var a=this._getScroll();return{x:a.x,y:a.y,width:this._getClientWidth(),height:this._getClientHeight()}},getHorizontalPixel:function(){return!this._clientDiv?0:this._getScroll().x},getKeyBindings:function(a){for(var b=[],d=this._keyModes,f=0;f<d.length;f++)b=b.concat(d[f].getKeyBindings(a));return b},getKeyModes:function(){return this._keyModes.slice(0)},getLineHeight:function(a){return!this._clientDiv?0:this._getLineHeight(a)},
getLineIndex:function(a){return!this._clientDiv?0:this._getLineIndex(a)},getLinePixel:function(a){return!this._clientDiv?0:this._getLinePixel(a)},getLocationAtOffset:function(a){if(!this._clientDiv)return{x:0,y:0};var b=this._model;a=Math.min(Math.max(0,a),b.getCharCount());var b=b.getLineAtOffset(a),d=this._getLine(b);a=d.getBoundingClientRect(a);d.destroy();d=a.left;b=this._getLinePixel(b)+a.top;return{x:d,y:b}},getNextOffset:function(a,b){var d=new w(a,a,!1);this._doMove(b,d);return d.getCaret()},
getOptions:function(){var b;if(0===arguments.length)b=this._defaultOptions();else if(1===arguments.length){if(b=arguments[0],"string"===typeof b)return a(this["_"+b])}else{b={};for(var d in arguments)arguments.hasOwnProperty(d)&&(b[arguments[d]]=void 0)}for(var f in b)b.hasOwnProperty(f)&&(b[f]=a(this["_"+f]));return b},getModel:function(){return this._model},getOffsetAtLocation:function(a,b){if(!this._clientDiv)return 0;var d=this._getLineIndex(b),f=this._getLine(d),d=f.getOffset(a,b-this._getLinePixel(d));
f.destroy();return d},getLineAtOffset:function(a){return this.getModel().getLineAtOffset(a)},getLineStart:function(a){this.getModel().getLineStart(a)},getRulers:function(){return this._rulers.slice(0)},getSelection:function(){var a=this._getSelection();return{start:a.start,end:a.end}},getText:function(a,b){return this._model.getText(a,b)},getTopIndex:function(a){return!this._clientDiv?0:this._getTopIndex(a)},getTopPixel:function(){return!this._clientDiv?0:this._getScroll().y},invokeAction:function(a,
b,d){if(this._clientDiv){if(a=this._actions[a]){if(!b&&a.handler&&a.handler(d))return!0;if(a.defaultHandler)return"boolean"===typeof a.defaultHandler(d)}return!1}},isDestroyed:function(){return!this._clientDiv},onContextMenu:function(a){return this.dispatchEvent(a)},onDragStart:function(a){return this.dispatchEvent(a)},onDrag:function(a){return this.dispatchEvent(a)},onDragEnd:function(a){return this.dispatchEvent(a)},onDragEnter:function(a){return this.dispatchEvent(a)},onDragOver:function(a){return this.dispatchEvent(a)},
onDragLeave:function(a){return this.dispatchEvent(a)},onDrop:function(a){return this.dispatchEvent(a)},onDestroy:function(a){return this.dispatchEvent(a)},onLineStyle:function(a){return this.dispatchEvent(a)},onKeyDown:function(a){return this.dispatchEvent(a)},onKeyPress:function(a){return this.dispatchEvent(a)},onKeyUp:function(a){return this.dispatchEvent(a)},onModelChanged:function(a){return this.dispatchEvent(a)},onModelChanging:function(a){return this.dispatchEvent(a)},onModify:function(a){return this.dispatchEvent(a)},
onMouseDown:function(a){return this.dispatchEvent(a)},onMouseUp:function(a){return this.dispatchEvent(a)},onMouseMove:function(a){return this.dispatchEvent(a)},onMouseOver:function(a){return this.dispatchEvent(a)},onMouseOut:function(a){return this.dispatchEvent(a)},onSelection:function(a){return this.dispatchEvent(a)},onScroll:function(a){return this.dispatchEvent(a)},onVerify:function(a){return this.dispatchEvent(a)},onFocus:function(a){return this.dispatchEvent(a)},onBlur:function(a){return this.dispatchEvent(a)},
redraw:function(){if(!(0<this._redrawCount)){var a=this._model.getLineCount();this.redrawRulers(0,a);this.redrawLines(0,a)}},redrawRulers:function(a,b){if(!(0<this._redrawCount))for(var d=this.getRulers(),f=0;f<d.length;f++)this.redrawLines(a,b,d[f])},redrawLines:function(a,b,d){if(!(0<this._redrawCount)&&(void 0===a&&(a=0),void 0===b&&(b=this._model.getLineCount()),a!==b)){var f=this._clientDiv;if(f){if(d)for(f=this._getRulerParent(d).firstChild;f&&f._ruler!==d;)f=f.nextSibling;d?f.rulerChanged=
!0:this._lineHeight&&this._resetLineHeight(a,b);if(!d||"page"===d.getOverview())for(f=f.firstChild;f;){var e=f.lineIndex;a<=e&&e<b&&(f.lineChanged=!0);f=f.nextSibling}!d&&(!this._wrapMode&&a<=this._maxLineIndex&&this._maxLineIndex<b)&&(this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0);this._queueUpdate()}}},redrawRange:function(a,b){if(!(0<this._redrawCount)){var d=this._model;void 0===a&&(a=0);void 0===b&&(b=d.getCharCount());var f=d.getLineAtOffset(a),d=d.getLineAtOffset(Math.max(a,
b-1))+1;this.redrawLines(f,d)}},removeKeyMode:function(a){for(var b=this._keyModes,d=0;d<b.length;d++)if(b[d]===a){b.splice(d,1);break}a._modeRemoved&&a._modeRemoved()},removeRuler:function(a){for(var b=this._rulers,d=0;d<b.length;d++)if(b[d]===a){b.splice(d,1);a.setView(null);this._destroyRuler(a);this._update();break}},resize:function(){this._clientDiv&&this._handleResize(null)},setAction:function(a,b,d){if(a){var f=this._actions,e=f[a];e||(e=f[a]={});e.handler=b;void 0!==d&&(e.actionDescription=
d)}},setKeyBinding:function(a,b){this._keyModes[0].setKeyBinding(a,b)},setCaretOffset:function(a,b,d){var f=this._model.getCharCount();a=Math.max(0,Math.min(a,f));a=new w(a,a,!1);this._setSelection(a,void 0===b||b,!0,d)},setHorizontalPixel:function(a){this._clientDiv&&(a=Math.max(0,a),this._scrollView(a-this._getScroll().x,0))},setRedraw:function(a){a?0===--this._redrawCount&&this.redraw():this._redrawCount++},setModel:function(a){if(a&&a!==this._model){this._model.removeEventListener("preChanging",
this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);var b=this._model.getLineCount(),d=this._model.getCharCount(),f=a.getLineCount(),e=a.getCharCount(),h={type:"ModelChanging",text:a.getText(),start:0,removedCharCount:d,addedCharCount:e,removedLineCount:b,addedLineCount:f};this.onModelChanging(h);this._model=a;h={type:"ModelChanged",start:0,removedCharCount:d,addedCharCount:e,removedLineCount:b,addedLineCount:f};this.onModelChanged(h);this._model.addEventListener("preChanging",
this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._reset();this._update()}},setOptions:function(b){var d=this._defaultOptions(),f;for(f in b)if(b.hasOwnProperty(f)){var e=b[f];if(!h(this["_"+f],e)){var l=d[f]?d[f].update:null;l?l.call(this,e):this["_"+f]=a(e)}}},setSelection:function(a,b,d,f){var e=a>b;if(e){var h=a;a=b;b=h}h=this._model.getCharCount();a=Math.max(0,Math.min(a,h));b=Math.max(0,Math.min(b,h));a=new w(a,b,e);this._setSelection(a,
void 0===d||d,!0,f)},setText:function(a,b,d){var e=void 0===b&&void 0===d;void 0===b&&(b=0);void 0===d&&(d=this._model.getCharCount());e&&(this._variableLineHeight=!1);this._modifyContent({text:a,start:b,end:d,_code:!0},!e);e&&(this._columnX=-1,this._setSelection(new w(0,0,!1),!0),13>f.isFirefox&&this._fixCaret())},setTopIndex:function(a){this._clientDiv&&this._scrollView(0,this._getLinePixel(Math.max(0,a))-this._getScroll().y)},setTopPixel:function(a){this._clientDiv&&this._scrollView(0,Math.max(0,
a)-this._getScroll().y)},showSelection:function(a,b){return this._showCaret(a?!1:!0,b,a)},update:function(a,b){this._clientDiv&&((a||this._metrics.invalid)&&this._updateStyle(),void 0===b||b?this._update():this._queueUpdate())},_handleRootMouseDown:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)){13>f.isFirefox&&1===a.which&&(this._clientDiv.contentEditable=!1,this._ignoreBlur=(this._overlayDiv||this._clientDiv).draggable=!0);var b=this._overlayDiv||this._clientDiv;9>f.isIE&&(b=
this._viewDiv);for(var d=a.target?a.target:a.srcElement;d;){if(b===d||d.className&&-1!==d.className.indexOf("textViewFind"))return;d=d.parentNode}a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();if(!this._isW3CEvents){var e=this;this._getWindow().setTimeout(function(){e._clientDiv.focus()},0)}}},_handleRootMouseUp:function(a){!this._ignoreEvent(a)&&(13>f.isFirefox&&1===a.which)&&(this._clientDiv.contentEditable=!0,(this._overlayDiv||this._clientDiv).draggable=!1,this._fixCaret(),
this._ignoreBlur=!1)},_handleBlur:function(a){this._cancelCheckSelection();if(!this._ignoreBlur){this._commitIME();this._hasFocus=!1;if(9>f.isIE&&!this._getSelection().isEmpty()){a=this._rootDiv;var b=f.createElement(a.ownerDocument,"div");a.appendChild(b);a.removeChild(b)}this._cursorDiv&&(this._cursorDiv.style.display="none");if(this._selDiv1)if(this._selDiv1.style.background="lightgray",this._selDiv2.style.background="lightgray",this._selDiv3.style.background="lightgray",a=this._getWindow(),b=
this._selDiv1.ownerDocument,a.getSelection){b=a.getSelection();for(a=b.anchorNode;a;){if(a===this._clientDiv){0<b.rangeCount&&b.removeAllRanges();break}a=a.parentNode}}else if(b.selection){this._ignoreSelect=!1;for(a=b.selection.createRange().parentElement();a;){if(a===this._clientDiv){b.selection.empty();break}a=a.parentNode}this._ignoreSelect=!0}if(!this._ignoreFocus)this.onBlur({type:"Blur"})}},_handleCompositionStart:function(a){this._ignoreEvent(a)||(this._startIME(),this._mutationObserver&&
(this._mutationObserver.disconnect(),this._mutationObserver=null))},_handleCompositionEnd:function(a){this._ignoreEvent(a)||this._commitIME(a.data)},_handleContextMenu:function(a){if(!this._ignoreEvent(a)){f.isIE&&3===this._lastMouseButton&&this._updateDOMSelection();var b=!1;this.isListening("ContextMenu")?(b=this._createMouseEvent("ContextMenu",a),b.screenX=a.screenX,b.screenY=a.screenY,this.onContextMenu(b),b=b.defaultPrevented):f.isMac&&(f.isFirefox&&0===a.button)&&(b=!0);if(b)return a.preventDefault&&
a.preventDefault(),!1;this._contextMenuOpen=!0;f.isFirefox&&(this._checkSelectionChange=!0,this._pollSelectionChange(!0))}},_handleCopy:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)&&!this._ignoreCopy&&this._doCopy(a))return a.preventDefault&&a.preventDefault(),!1},_handleCut:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)&&this._doCut(a))return a.preventDefault&&a.preventDefault(),!1},_handleDataModified:function(a){this._ignoreEvent(a)||this._startIME()},_handleDblclick:function(a){this._ignoreEvent(a)||
(this._lastMouseTime=a.timeStamp?a.timeStamp:(new Date).getTime(),2!==this._clickCount&&(this._clickCount=2,this._handleMouse(a)))},_handleDragStart:function(a){if(!this._ignoreEvent(a)){if(13>f.isFirefox){var b=this;this._getWindow().setTimeout(function(){b._clientDiv.contentEditable=!0;b._clientDiv.draggable=!1;b._ignoreBlur=!1},0)}if(this.isListening("DragStart")&&-1!==this._dragOffset)this._isMouseDown=!1,this.onDragStart(this._createMouseEvent("DragStart",a)),this._dragOffset=-1;else return a.preventDefault&&
a.preventDefault(),!1}},_handleDrag:function(a){if(!this._ignoreEvent(a)&&this.isListening("Drag"))this.onDrag(this._createMouseEvent("Drag",a))},_handleDragEnd:function(a){if(!this._ignoreEvent(a)){this._dropTarget=!1;this._dragOffset=-1;if(this.isListening("DragEnd"))this.onDragEnd(this._createMouseEvent("DragEnd",a));13>f.isFirefox&&(this._fixCaret(),"none"===a.dataTransfer.dropEffect&&!a.dataTransfer.mozUserCancelled&&this._fixCaret())}},_handleDragEnter:function(a){if(!this._ignoreEvent(a)){var b=
!0;this._dropTarget=!0;this.isListening("DragEnter")&&(b=!1,this.onDragEnter(this._createMouseEvent("DragEnter",a)));if(f.isWebkit||b)return a.preventDefault&&a.preventDefault(),!1}},_handleDragOver:function(a){if(!this._ignoreEvent(a)){var b=!0;this.isListening("DragOver")&&(b=!1,this.onDragOver(this._createMouseEvent("DragOver",a)));if(f.isWebkit||b)return b&&(a.dataTransfer.dropEffect="none"),a.preventDefault&&a.preventDefault(),!1}},_handleDragLeave:function(a){if(!this._ignoreEvent(a)&&(this._dropTarget=
!1,this.isListening("DragLeave")))this.onDragLeave(this._createMouseEvent("DragLeave",a))},_handleDrop:function(a){if(!this._ignoreEvent(a)){this._dropTarget=!1;if(this.isListening("Drop"))this.onDrop(this._createMouseEvent("Drop",a));a.preventDefault&&a.preventDefault();return!1}},_handleFocus:function(a){this._hasFocus=!0;f.isIOS&&void 0!==this._lastTouchOffset?(this.setCaretOffset(this._lastTouchOffset,!0),this._lastTouchOffset=void 0):this._updateDOMSelection();this._cursorDiv&&(this._cursorDiv.style.display=
"block");this._selDiv1&&(a=this._highlightRGB,this._selDiv1.style.background=a,this._selDiv2.style.background=a,this._selDiv3.style.background=a);if(!this._ignoreFocus)this.onFocus({type:"Focus"})},_handleKeyDown:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)){if(this.isListening("KeyDown")){var b=this._createKeyEvent("KeyDown",a);this.onKeyDown(b);if(b.defaultPrevented){f.isFirefox&&(this._keyDownPrevented=!0);a.preventDefault();return}}b=!1;switch(a.keyCode){case 16:case 17:case 18:case 91:b=
!0;break;default:this._setLinksVisible(!1)}if(229===a.keyCode){if(this._readonly)return a.preventDefault&&a.preventDefault(),!1;b=!0;f.isSafari&&f.isMac&&a.ctrlKey&&(b=!1,a.keyCode=129);b&&this._startIME()}else b||this._commitIME();if((f.isMac||f.isLinux)&&4>f.isFirefox||12.16>f.isOpera)return this._keyDownEvent=a,!0;if(this._doAction(a))return a.preventDefault?(a.preventDefault(),a.stopPropagation()):(a.cancelBubble=!0,a.returnValue=!1,a.keyCode=0),!1}},_handleKeyPress:function(a){if(!this._ignoreEvent(a))if(this._keyDownPrevented)a.preventDefault&&
(a.preventDefault(),a.stopPropagation()),this._keyDownPrevented=void 0;else{if(f.isMac&&f.isWebkit&&(63232<=a.keyCode&&63487>=a.keyCode||13===a.keyCode||8===a.keyCode)||((f.isMac||f.isLinux)&&4>f.isFirefox||12.16>f.isOpera)&&this._doAction(this._keyDownEvent))return a.preventDefault&&a.preventDefault(),!1;var b=f.isMac?a.metaKey:a.ctrlKey;if(void 0!==a.charCode&&b)switch(a.charCode){case 99:case 118:case 120:return!0}if(this.isListening("KeyPress")&&(b=this._createKeyEvent("KeyPress",a),this.onKeyPress(b),
b.defaultPrevented)){a.preventDefault();return}if(this._doAction(a))return a.preventDefault?(a.preventDefault(),a.stopPropagation()):(a.cancelBubble=!0,a.returnValue=!1,a.keyCode=0),!1;b=!1;if(f.isMac){if(a.ctrlKey||a.metaKey)b=!0}else if(f.isFirefox){if(a.ctrlKey||a.altKey)b=!0}else a.ctrlKey^a.altKey&&(b=!0);if(!b&&(b=f.isOpera?a.which:void 0!==a.charCode?a.charCode:a.keyCode,31<b))return this._doContent(String.fromCharCode(b)),a.preventDefault&&a.preventDefault(),!1}},_handleDocKeyUp:function(a){(f.isMac?
a.metaKey:a.ctrlKey)||this._setLinksVisible(!1)},_handleKeyUp:function(a){if(!this._ignoreEvent(a)){if(this.isListening("KeyUp")){var b=this._createKeyEvent("KeyUp",a);this.onKeyUp(b);if(b.defaultPrevented){a.preventDefault();return}}this._handleDocKeyUp(a);13===a.keyCode&&this._commitIME()}},_handleLinkClick:function(a){if(!(f.isMac?a.metaKey:a.ctrlKey))return a.preventDefault&&a.preventDefault(),!1},_handleMouse:function(a){var b=this._getWindow(),d=!0,e=b;if(f.isIE||f.isFirefox&&!this._overlayDiv)e=
this._clientDiv;if(this._overlayDiv){this._hasFocus&&(this._ignoreFocus=!0);var h=this;b.setTimeout(function(){h.focus();h._ignoreFocus=!1},0)}1===this._clickCount?(d=this._setSelectionTo(a.clientX,a.clientY,a.shiftKey,(!f.isOpera||12.16<=f.isOpera)&&this._hasFocus&&this.isListening("DragStart")))&&this._setGrab(e):(this._isW3CEvents&&this._setGrab(e),this._doubleClickSelection=null,this._setSelectionTo(a.clientX,a.clientY,a.shiftKey),this._doubleClickSelection=this._getSelection());return d},_handleMouseDown:function(a){if(!this._ignoreEvent(a)){if(this._linksVisible)if("A"!==
(a.target||a.srcElement).tagName)this._setLinksVisible(!1);else return;this._commitIME();var b=a.which;b||(4===a.button&&(b=2),2===a.button&&(b=3),1===a.button&&(b=1));var d=2!==b&&a.timeStamp?a.timeStamp:(new Date).getTime(),e=d-this._lastMouseTime,h=Math.abs(this._lastMouseX-a.clientX),l=Math.abs(this._lastMouseY-a.clientY),p=this._lastMouseButton===b;this._lastMouseX=a.clientX;this._lastMouseY=a.clientY;this._lastMouseTime=d;this._lastMouseButton=b;1===b&&(this._isMouseDown=!0,p&&e<=this._clickTime&&
h<=this._clickDist&&l<=this._clickDist?this._clickCount++:this._clickCount=1);if(this.isListening("MouseDown")&&(d=this._createMouseEvent("MouseDown",a),this.onMouseDown(d),d.defaultPrevented)){a.preventDefault();return}if(1===b&&this._handleMouse(a)&&(9<=f.isIE||f.isOpera||f.isChrome||f.isSafari||f.isFirefox&&!this._overlayDiv))this._hasFocus||this.focus(),a.preventDefault();f.isFirefox&&3===this._lastMouseButton&&this._updateDOMSelection()}},_handleMouseOver:function(a){if(!this._ignoreEvent(a)&&
!this._animation&&this.isListening("MouseOver"))this.onMouseOver(this._createMouseEvent("MouseOver",a))},_handleMouseOut:function(a){if(!this._ignoreEvent(a)&&!this._animation&&this.isListening("MouseOut"))this.onMouseOut(this._createMouseEvent("MouseOut",a))},_handleMouseMove:function(a){if(!this._animation){var b=this._isClientDiv(a);if(this.isListening("MouseMove")&&b)this.onMouseMove(this._createMouseEvent("MouseMove",a));if(!this._dropTarget){var d=this._linksVisible||this._lastMouseMoveX!==
a.clientX||this._lastMouseMoveY!==a.clientY;this._lastMouseMoveX=a.clientX;this._lastMouseMoveY=a.clientY;this._setLinksVisible(d&&!this._isMouseDown&&(f.isMac?a.metaKey:a.ctrlKey));this._checkOverlayScroll();if(!this._isW3CEvents){if(0===a.button)return this._setGrab(null),!0;if(!this._isMouseDown&&1===a.button&&0!==(this._clickCount&1)&&b)return this._clickCount=2,this._handleMouse(a,this._clickCount)}if(this._isMouseDown&&-1===this._dragOffset){b=a.clientX;a=a.clientY;var e=this._getViewPadding(),
h=this._viewDiv.getBoundingClientRect(),l=this._getClientWidth(),p=this._getClientHeight(),d=h.left+e.left,g=h.top+e.top,l=h.left+e.left+l,e=h.top+e.top+p;a<g?this._doAutoScroll("up",b,a-g):a>e?this._doAutoScroll("down",b,a-e):b<d&&!this._wrapMode?this._doAutoScroll("left",b-d,a):b>l&&!this._wrapMode?this._doAutoScroll("right",b-l,a):(this._endAutoScroll(),this._setSelectionTo(b,a,!0))}}}},_isClientDiv:function(a){var b=this._overlayDiv||this._clientDiv;for(a=a.target?a.target:a.srcElement;a;){if(b===
a)return!0;a=a.parentNode}return!1},_createKeyEvent:function(a,b){return{type:a,event:b,preventDefault:function(){this.defaultPrevented=!0}}},_createMouseEvent:function(a,b){var d=this.convert({x:b.clientX,y:b.clientY},"page","document");return{type:a,event:b,clickCount:this._clickCount,x:d.x,y:d.y,preventDefault:function(){this.defaultPrevented=!0}}},_handleMouseUp:function(a){var b=a.which?0===a.button:1===a.button;if(this.isListening("MouseUp")&&(this._isClientDiv(a)||b&&this._isMouseDown))this.onMouseUp(this._createMouseEvent("MouseUp",
a));if(!this._linksVisible){if(b&&this._isMouseDown){if(-1!==this._dragOffset){var d=this._getSelection();d.extend(this._dragOffset);d.collapse();this._setSelection(d,!0,!0);this._dragOffset=-1}this._isMouseDown=!1;this._endAutoScroll();this._isW3CEvents&&this._setGrab(null)}b&&f.isFirefox&&(this._updateDOMSelection(),a.preventDefault())}},_handleMouseWheel:function(a){var b=this._getLineHeight(),d=0,e=0;f.isIE||f.isOpera?e=-a.wheelDelta/40*b:f.isFirefox?"wheel"===a.type?a.deltaMode?(d=Math.max(-256,
Math.min(256,a.deltaX))*b,e=Math.max(-256,Math.min(256,a.deltaY))*b):(d=a.deltaX,e=a.deltaY):(b=f.isMac?3*a.detail:Math.max(-256,Math.min(256,a.detail))*b,a.axis===a.HORIZONTAL_AXIS?d=b:e=b):f.isMac?(e=a.timeStamp-this._wheelTimeStamp,this._wheelTimeStamp=a.timeStamp,d=0!==a.wheelDeltaX%120?1:40>e?40/(40-e):40,e=0!==a.wheelDeltaY%120?1:40>e?40/(40-e):40,d=Math.ceil(-a.wheelDeltaX/d),-1<d&&0>d&&(d=-1),0<d&&1>d&&(d=1),e=Math.ceil(-a.wheelDeltaY/e),-1<e&&0>e&&(e=-1),0<e&&1>e&&(e=1)):(d=-a.wheelDeltaX,
e=8*(-a.wheelDeltaY/120)*b);if(f.isSafari||f.isChrome&&f.isMac){for(b=a.target;b&&void 0===b.lineIndex;)b=b.parentNode;this._mouseWheelLine=b}b=this._getScroll();this._scrollView(d,e);d=this._getScroll();if(b.x!==d.x||b.y!==d.y)return a.preventDefault&&a.preventDefault(),!1},_handlePaste:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)&&!this._ignorePaste&&this._doPaste(a)){if(f.isIE){var b=this;this._ignoreFocus=!0;this._getWindow().setTimeout(function(){b._updateDOMSelection();
b._ignoreFocus=!1},0)}a.preventDefault&&a.preventDefault();return!1}},_handleResize:function(a){a=this._rootDiv.clientWidth;var b=this._rootDiv.clientHeight;if(this._rootWidth!==a||this._rootHeight!==b)this._rootWidth!==a&&this._wrapMode&&this._resetLineHeight(),this._rootWidth=a,this._rootHeight=b,a=9>f.isIE,b=this._calculateMetrics(),h(b,this._metrics)||(this._variableLineHeight&&(this._variableLineHeight=!1,this._resetLineHeight()),this._metrics=b,a=!0),a?this._queueUpdate():this._update()},_handleRulerEvent:function(a){for(var b=
a.target?a.target:a.srcElement,d=b.lineIndex;b&&!b._ruler;)void 0===d&&void 0!==b.lineIndex&&(d=b.lineIndex),b=b.parentNode;var f=b?b._ruler:null;if(void 0===d&&f&&"document"===f.getOverview()){var d=this._getClientHeight(),e=this._model.getLineCount(),h=this._getViewPadding(),l=this._viewDiv.getBoundingClientRect(),d=Math.floor((a.clientY-l.top-this._metrics.scrollWidth)*e/(d+h.top+h.bottom-2*this._metrics.scrollWidth));0<=d&&d<e||(d=void 0)}if(f)switch(a.type){case "click":if(f.onClick)f.onClick(d,
a);break;case "dblclick":if(f.onDblClick)f.onDblClick(d,a);break;case "mousemove":if(f.onMouseMove)f.onMouseMove(d,a);break;case "mouseover":if(f.onMouseOver)f.onMouseOver(d,a);break;case "mouseout":if(f.onMouseOut){for(e=a.relatedTarget;e&&e!==this._rootDiv;){if(e===b)return;e=e.parentNode}f.onMouseOut(d,a)}}},_handleScroll:function(){this._lastScrollTime=(new Date).getTime();var a=this._getScroll(!1),b=this._hScroll,d=this._vScroll;if(b!==a.x||d!==a.y)this._hScroll=a.x,this._vScroll=a.y,this._commitIME(),
this._update(d===a.y),this.onScroll({type:"Scroll",oldValue:{x:b,y:d},newValue:a})},_handleSelectStart:function(a){var b=this._contextMenuOpen;this._contextMenuOpen=!1;if(b)this._checkSelectionChange=!0;else if(this._ignoreSelect)return a&&a.preventDefault&&a.preventDefault(),!1},_getModelOffset:function(a,b){if(a){var d;d="DIV"===a.tagName?a:a.parentNode.parentNode;return!d._line?0:d._line.getModelOffset(a,b)}},_updateSelectionFromDOM:function(){if(!f.isIOS&&!f.isAndroid&&!this._checkSelectionChange)return!1;
var a=this._getWindow().getSelection(),b=this._getModelOffset(a.anchorNode,a.anchorOffset),d=this._getModelOffset(a.focusNode,a.focusOffset),e=this._getSelection();if(void 0===b||void 0===d||e.start===b&&e.end===d)return!1;if(this._checkSelectionChange){var e=this._getLineNext(),h=this._getLinePrevious();if(a.anchorNode===e.firstChild.firstChild&&0===a.anchorOffset&&a.focusNode===h.firstChild.firstChild&&0===a.focusOffset)return!1;if(a.anchorNode===e.firstChild.firstChild&&0===a.anchorOffset&&a.focusNode===
h.lastChild.firstChild||a.anchorNode===this._clientDiv&&a.focusNode===this._clientDiv)b=0,d=this.getModel().getCharCount()}this._setSelection(new w(b,d),!1,!1);this._checkSelectionChange=!1;return!0},_cancelCheckSelection:function(){this._checkSelectionChange&&(this._checkSelectionChange=!1,this._cancelPollSelectionChange())},_cancelPollSelectionChange:function(){this._selPollTimer&&(this._getWindow().clearTimeout(this._selPollTimer),this._selPollTimer=null)},_pollSelectionChange:function(a){var b=
this,d=this._getWindow();this._cancelPollSelectionChange();this._selPollTimer=d.setTimeout(function(){b._selPollTimer=null;b._clientDiv&&!b._updateSelectionFromDOM()&&a&&b._pollSelectionChange(a)},100)},_handleSelectionChange:function(a){-1===this._imeOffset&&(f.isAndroid?this._pollSelectionChange():this._updateSelectionFromDOM())},_handleTextInput:function(a){if(!this._ignoreEvent(a)){this._imeOffset=-1;var b=this._getWindow().getSelection();if(b.anchorNode!==this._anchorNode||b.focusNode!==this._focusNode||
b.anchorOffset!==this._anchorOffset||b.focusOffset!==this._focusOffset){for(var d=b.anchorNode;d&&void 0===d.lineIndex;)d=d.parentNode;if(d){var e=this._model,h=d.lineIndex,l=e.getLine(h),p=l,g=0,e=e.getLineStart(h);0<b.rangeCount&&(b.getRangeAt(0).deleteContents(),h=d.ownerDocument.createTextNode(a.data),b.getRangeAt(0).insertNode(h),g=this._getDOMText(d,h),p=g.text,g=g.offset,h.parentNode.removeChild(h));d.lineRemoved=!0;for(d=0;l.charCodeAt(d)===p.charCodeAt(d)&&d<g;)d++;b=l.length-1;for(h=p.length-
l.length;l.charCodeAt(b)===p.charCodeAt(b+h)&&b+h>=g+a.data.length;)b--;b++;l=p.substring(d,b+h);this._ignoreQueueUpdate=f.isSafari;this._modifyContent({text:l,start:d+e,end:b+e,_ignoreDOMSelection:!0,_ignoreDOMSelection1:f.isChrome},!0);this._ignoreQueueUpdate=!1}}else this._doContent(a.data);a.preventDefault()}},_handleTouchStart:function(a){this._commitIME();var b=this._getWindow();this._touchScrollTimer&&(this._vScrollDiv.style.display="none",this._hScrollDiv.style.display="none",b.clearInterval(this._touchScrollTimer),
this._touchScrollTimer=null);var d=a.touches;if(1===d.length){var d=d[0],e=d.clientX,h=d.clientY;this._touchStartX=e;this._touchStartY=h;if(f.isAndroid&&(h<d.pageY-b.pageYOffset||e<d.pageX-b.pageXOffset))e=d.pageX-b.pageXOffset,h=d.pageY-b.pageYOffset;b=this.convert({x:e,y:h},"page","document");this._lastTouchOffset=this.getOffsetAtLocation(b.x,b.y);this._touchStartTime=a.timeStamp;this._touching=!0}},_handleTouchMove:function(a){var b=a.touches;if(1===b.length){b=b[0];this._touchCurrentX=b.clientX;
this._touchCurrentY=b.clientY;if(!this._touchScrollTimer&&200>a.timeStamp-this._touchStartTime){this._vScrollDiv.style.display="block";this._wrapMode||(this._hScrollDiv.style.display="block");var d=this,f=this._getWindow();this._touchScrollTimer=f.setInterval(function(){var a=0,b=0;if(d._touching)a=d._touchStartX-d._touchCurrentX,b=d._touchStartY-d._touchCurrentY,d._touchSpeedX=a/10,d._touchSpeedY=b/10,d._touchStartX=d._touchCurrentX,d._touchStartY=d._touchCurrentY;else{if(0.1>Math.abs(d._touchSpeedX)&&
0.1>Math.abs(d._touchSpeedY)){d._vScrollDiv.style.display="none";d._hScrollDiv.style.display="none";f.clearInterval(d._touchScrollTimer);d._touchScrollTimer=null;return}a=10*d._touchSpeedX;b=10*d._touchSpeedY;d._touchSpeedX*=0.95;d._touchSpeedY*=0.95}d._scrollView(a,b)},10)}this._touchScrollTimer&&a.preventDefault()}},_handleTouchEnd:function(a){0===a.touches.length&&(this._touching=!1)},_doAction:function(a){var b,d,f=this._keyModes;for(d=f.length-1;0<=d;d--)if(b=f[d],"function"===typeof b.match&&
(b=b.match(a),void 0!==b))return this.invokeAction(b);return!1},_doMove:function(a,b){var d=this._model,f=b.getCaret(),e=d.getLineAtOffset(f);a.count||(a.count=1);for(;0!==a.count;){var h=d.getLineStart(e);if(0>a.count&&f===h)if(0<e)"character"===a.unit&&a.count++,e--,b.extend(d.getLineEnd(e));else break;else if(0<a.count&&f===d.getLineEnd(e))if(e+1<d.getLineCount())"character"===a.unit&&a.count--,e++,b.extend(d.getLineStart(e));else break;else{var l=!1;a.expandTab&&("character"===a.unit&&0===(f-
h)%this._tabSize)&&(h=d.getText(h,f),l=!/[^ ]/.test(h));l?(b.extend(f-this._tabSize),a.count+=0>a.count?1:-1):(h=this._getLine(e),b.extend(h.getNextOffset(f,a)),h.destroy())}f=b.getCaret()}return b},_doBackspace:function(a){var b=this._getSelection();b.isEmpty()&&(a.count||(a.count=1),a.count*=-1,a.expandTab=this._expandTab,this._doMove(a,b));this._modifyContent({text:"",start:b.start,end:b.end},!0);return!0},_doCase:function(a){var b=this._getSelection();this._doMove(a,b);var d=this.getText(b.start,
b.end);this._setSelection(b,!0);switch(a.type){case "lower":d=d.toLowerCase();break;case "capitalize":d=d.replace(/(?:^|\s)\S/g,function(a){return a.toUpperCase()});break;case "reverse":a="";for(b=0;b<d.length;b++){var f=d[b],e=f.toLowerCase(),f=e!==f?e:f.toUpperCase();a+=f}d=a;break;default:d=d.toUpperCase()}this._doContent(d);return!0},_doContent:function(a){var b=this._getSelection();if(this._overwriteMode&&b.isEmpty()){var d=this._model,f=d.getLineAtOffset(b.end);b.end<d.getLineEnd(f)&&(d=this._getLine(f),
b.extend(d.getNextOffset(b.getCaret(),{unit:"character",count:1})),d.destroy())}return this._modifyContent({text:a,start:b.start,end:b.end,_ignoreDOMSelection:!0},!0)},_doCopy:function(a){var b=this._getSelection();return!b.isEmpty()?(b=this._getBaseText(b.start,b.end),this._setClipboardText(b,a)):!0},_doCursorNext:function(a){var b=this._getSelection();!b.isEmpty()&&!a.select?b.start=b.end:this._doMove(a,b);a.select||b.collapse();this._setSelection(b,!0);return!0},_doCursorPrevious:function(a){var b=
this._getSelection();!b.isEmpty()&&!a.select?b.end=b.start:(a.count||(a.count=1),a.count*=-1,this._doMove(a,b));a.select||b.collapse();this._setSelection(b,!0);return!0},_doCut:function(a){var b=this._getSelection();return!b.isEmpty()?(b=this._getBaseText(b.start,b.end),this._doContent(""),this._setClipboardText(b,a)):!0},_doDelete:function(a){var b=this._getSelection();b.isEmpty()&&this._doMove(a,b);this._modifyContent({text:"",start:b.start,end:b.end},!0);return!0},_doEnd:function(a){var b=this._getSelection(),
d=this._model,f;if(a.ctrl)b.extend(d.getCharCount()),f=function(){};else{var e=b.getCaret(),h=d.getLineAtOffset(e);if(this._wrapMode){var l=this._getLine(h),e=l.getLineIndex(e),e=e===l.getLineCount()-1?d.getLineEnd(h):l.getLineStart(e+1)-1;l.destroy()}else a.count&&0<a.count&&(h=Math.min(h+a.count-1,d.getLineCount()-1)),e=d.getLineEnd(h);b.extend(e)}a.select||b.collapse();this._setSelection(b,!0,!0,f);return!0},_doEnter:function(a){var b=this._model,d=this._getSelection();this._doContent(b.getLineDelimiter());
a&&a.noCursor&&(d.end=d.start,this._setSelection(d,!0));return!0},_doHome:function(a){var b=this._getSelection(),d=this._model,f;if(a.ctrl)b.extend(0),f=function(){};else{var e=b.getCaret(),h=d.getLineAtOffset(e);this._wrapMode?(d=this._getLine(h),e=d.getLineIndex(e),e=d.getLineStart(e),d.destroy()):e=d.getLineStart(h);b.extend(e)}a.select||b.collapse();this._setSelection(b,!0,!0,f);return!0},_doLineDown:function(a){var b=this._model,d=this._getSelection(),e=d.getCaret(),h=b.getLineAtOffset(e),l=
this._getLine(h),p=this._columnX,g=1,q=!1;if(-1===p||a.wholeLine||a.select&&f.isIE)p=a.wholeLine?b.getLineEnd(h+1):e,p=l.getBoundingClientRect(p).left;(e=l.getLineIndex(e))<l.getLineCount()-1?g=l.getClientRects(e+1).top+1:(e=b.getLineCount()-1,q=h===e,a.count&&0<a.count?h=Math.min(h+a.count,e):h++);e=!1;if(q){if(a.select||f.isMac||f.isLinux)d.extend(b.getCharCount()),e=!0}else l.lineIndex!==h&&(l.destroy(),l=this._getLine(h)),d.extend(l.getOffset(p,g)),e=!0;e&&(a.select||d.collapse(),this._setSelection(d,
!0,!0));this._columnX=p;l.destroy();return!0},_doLineUp:function(a){var b=this._model,d=this._getSelection(),e=d.getCaret(),h=b.getLineAtOffset(e),l=this._getLine(h),p=this._columnX,g=!1,q;if(-1===p||a.wholeLine||a.select&&f.isIE)p=a.wholeLine?b.getLineStart(h-1):e,p=l.getBoundingClientRect(p).left;0<(e=l.getLineIndex(e))?q=l.getClientRects(e-1).top+1:(g=0===h,g||(a.count&&0<a.count?h=Math.max(h-a.count,0):h--,q=this._getLineHeight(h)-1));e=!1;if(g){if(a.select||f.isMac||f.isLinux)d.extend(0),e=!0}else l.lineIndex!==
h&&(l.destroy(),l=this._getLine(h)),d.extend(l.getOffset(p,q)),e=!0;e&&(a.select||d.collapse(),this._setSelection(d,!0,!0));this._columnX=p;l.destroy();return!0},_doNoop:function(){return!0},_doPageDown:function(a){var b=this,d=this._model,e=this._getSelection(),h=e.getCaret(),l=d.getLineAtOffset(h),p=d.getLineCount(),g=this._getScroll(),d=this._getClientHeight(),q,r;if(this._lineHeight){q=this._columnX;g=this._getBoundsAtOffset(h);if(-1===q||a.select&&f.isIE)q=g.left;h=this._getLineIndex(g.top+d);
r=this._getLine(h);l=this._getLinePixel(h);h=r.getOffset(q,g.top+d-l);d=r.getBoundingClientRect(h);r.destroy();e.extend(h);a.select||e.collapse();this._setSelection(e,!0,!0,function(){b._columnX=q},d.top+l-g.top);return!0}if(l<p-1){var k=this._getLineHeight(),m=Math.min(p-l-1,Math.floor(d/k)),m=Math.max(1,m);q=this._columnX;if(-1===q||a.select&&f.isIE)r=this._getLine(l),q=r.getBoundingClientRect(h).left,r.destroy();r=this._getLine(l+m);e.extend(r.getOffset(q,0));r.destroy();a.select||e.collapse();
a=p*k;h=g.y+m*k;h+d>a&&(h=a-d);this._setSelection(e,!0,!0,function(){b._columnX=q},h-g.y)}return!0},_doPageUp:function(a){var b=this,d=this._model,e=this._getSelection(),h=e.getCaret(),l=d.getLineAtOffset(h),p=this._getScroll(),g=this._getClientHeight(),q;if(this._lineHeight){q=this._columnX;p=this._getBoundsAtOffset(h);if(-1===q||a.select&&f.isIE)q=p.left;h=this._getLineIndex(p.bottom-g);d=this._getLine(h);l=this._getLinePixel(h);h=d.getOffset(q,p.bottom-g-l);g=d.getBoundingClientRect(h);d.destroy();
e.extend(h);a.select||e.collapse();this._setSelection(e,!0,!0,function(){b._columnX=q},g.top+l-p.top);return!0}if(0<l){var r=this._getLineHeight(),g=Math.max(1,Math.min(l,Math.floor(g/r)));q=this._columnX;if(-1===q||a.select&&f.isIE)d=this._getLine(l),q=d.getBoundingClientRect(h).left,d.destroy();d=this._getLine(l-g);e.extend(d.getOffset(q,this._getLineHeight(l-g)-1));d.destroy();a.select||e.collapse();a=Math.max(0,p.y-g*r);this._setSelection(e,!0,!0,function(){b._columnX=q},a-p.y)}return!0},_doPaste:function(a){var b=
this;return null!==this._getClipboardText(a,function(a){a&&(f.isLinux&&2===b._lastMouseButton&&(new Date).getTime()-b._lastMouseTime<=b._clickTime&&b._setSelectionTo(b._lastMouseX,b._lastMouseY),b._doContent(a))})},_doScroll:function(a){var b=a.type,d=this._model,f=d.getLineCount();a=this._getClientHeight();var e=this._getLineHeight(),f=f*e,h=this._getScroll().y,l;switch(b){case "textStart":l=0;break;case "textEnd":l=f-a;break;case "pageDown":l=h+a;break;case "pageUp":l=h-a;break;case "lineDown":l=
h+e;break;case "lineUp":l=h-e;break;case "centerLine":b=this._getSelection(),l=d.getLineAtOffset(b.start),d=(d.getLineAtOffset(b.end)-l+1)*e,l=l*e-a/2+d/2}void 0!==l&&(l=Math.min(Math.max(0,l),f-a),this._scrollViewAnimated(0,l-h,function(){}));return!0},_doSelectAll:function(a){a=this._model;var b=this._getSelection();b.setCaret(0);b.extend(a.getCharCount());this._setSelection(b,!1);return!0},_doTab:function(a){if(this._tabMode&&!this._readonly){a="\t";if(this._expandTab){var b=this._model;a=this._getSelection().getCaret();
var d=b.getLineAtOffset(a),b=b.getLineStart(d);a=Array(this._tabSize-(a-b)%this._tabSize+1).join(" ")}this._doContent(a);return!0}},_doShiftTab:function(a){if(this._tabMode&&!this._readonly)return!0},_doOverwriteMode:function(a){if(!this._readonly)return this.setOptions({overwriteMode:!this.getOptions("overwriteMode")}),!0},_doTabMode:function(a){this._tabMode=!this._tabMode;return!0},_doWrapMode:function(a){this.setOptions({wrapMode:!this.getOptions("wrapMode")});return!0},_autoScroll:function(){var a=
this._model,b=this._getSelection(),d=this.convert({x:this._autoScrollX,y:this._autoScrollY},"page","document"),e=b.getCaret(),h=a.getLineCount(),l=a.getLineAtOffset(e),p;if("up"===this._autoScrollDir||"down"===this._autoScrollDir)e=this._autoScrollY/this._getLineHeight(),e=0>e?Math.floor(e):Math.ceil(e),p=Math.max(0,Math.min(h-1,l+e));else if("left"===this._autoScrollDir||"right"===this._autoScrollDir)p=this._getLineIndex(d.y),l=this._getLine(l),d.x+=l.getBoundingClientRect(e,!1).left,l.destroy();
0===p&&(f.isMac||f.isLinux)?b.extend(0):p===h-1&&(f.isMac||f.isLinux)?b.extend(a.getCharCount()):(l=this._getLine(p),b.extend(l.getOffset(d.x,d.y-this._getLinePixel(p))),l.destroy());this._setSelection(b,!0)},_autoScrollTimer:function(){this._autoScroll();var a=this;this._autoScrollTimerID=this._getWindow().setTimeout(function(){a._autoScrollTimer()},this._AUTO_SCROLL_RATE)},_calculateLineHeightTimer:function(a){if(this._lineHeight&&!this._calculateLHTimer){var b=this._model.getLineCount(),d=0;if(a){a=
0;for(var f=(new Date).getTime(),e=0;d<b&&!(this._lineHeight[d]||(a++,e||(e=d),this._lineHeight[d]=this._calculateLineHeight(d)),d++,100<(new Date).getTime()-f););this.redrawRulers(0,b);this._queueUpdate()}a=this._getWindow();if(d!==b){var h=this;this._calculateLHTimer=a.setTimeout(function(){h._calculateLHTimer=null;h._calculateLineHeightTimer(!0)},0)}else this._calculateLHTimer&&(a.clearTimeout(this._calculateLHTimer),this._calculateLHTimer=void 0)}},_calculateLineHeight:function(a){a=this._getLine(a);
var b=a.getBoundingClientRect();a.destroy();return Math.max(1,b.bottom-b.top)},_calculateMetrics:function(){var a=this._clientDiv,d=a.ownerDocument,e=f.createElement(d,"div");e.style.lineHeight="normal";var h={type:"LineStyle",textView:this,0:0,lineText:this._model.getLine(0),lineStart:0};this.onLineStyle(h);b(h.style,e);e.style.position="fixed";e.style.left="-1000px";var l=f.createElement(d,"span");l.appendChild(d.createTextNode(" "));e.appendChild(l);var p=f.createElement(d,"span");p.style.fontStyle=
"italic";p.appendChild(d.createTextNode(" "));e.appendChild(p);var g=f.createElement(d,"span");g.style.fontWeight="bold";g.appendChild(d.createTextNode(" "));e.appendChild(g);h=f.createElement(d,"span");h.style.fontWeight="bold";h.style.fontStyle="italic";h.appendChild(d.createTextNode(" "));e.appendChild(h);a.appendChild(e);var k=e.getBoundingClientRect(),l=l.getBoundingClientRect(),p=p.getBoundingClientRect(),g=g.getBoundingClientRect(),h=h.getBoundingClientRect(),l=l.bottom-l.top,p=p.bottom-p.top,
g=g.bottom-g.top,m=h.bottom-h.top,t=0,h=0>=k.bottom-k.top,k=Math.max(1,k.bottom-k.top);p>l&&(t=1);g>p&&(t=2);m>g&&(t=3);var s;0!==t&&(s={style:{}},0!==(t&1)&&(s.style.fontStyle="italic"),0!==(t&2)&&(s.style.fontWeight="bold"));l=r(e);a.removeChild(e);m=q(this._viewDiv);e=f.createElement(d,"div");e.style.position="fixed";e.style.left="-1000px";e.style.paddingLeft=m.left+"px";e.style.paddingTop=m.top+"px";e.style.paddingRight=m.right+"px";e.style.paddingBottom=m.bottom+"px";e.style.width="100px";e.style.height=
"100px";m=f.createElement(d,"div");m.style.width="100%";m.style.height="100%";e.appendChild(m);a.appendChild(e);t=e.getBoundingClientRect();p=m.getBoundingClientRect();g=0;this._singleMode||(e.style.overflow="hidden",m.style.height="200px",g=e.clientWidth,e.style.overflow="scroll",g-=e.clientWidth);a.removeChild(e);m={left:p.left-t.left,top:p.top-t.top,right:t.right-p.right,bottom:t.bottom-p.bottom};p=t=0;if(!h&&(this._wrapOffset||this._marginOffset))e=f.createElement(d,"div"),e.style.position="fixed",
e.style.left="-1000px",e.innerHTML=Array(this._wrapOffset+1+(f.isWebkit?0:1)).join(" "),a.appendChild(e),t=e.getBoundingClientRect(),t=Math.ceil(t.right-t.left),e.innerHTML=Array(this._marginOffset+1).join(" "),p=e.getBoundingClientRect(),p=Math.ceil(p.right-p.left),a.removeChild(e);return{lineHeight:k,largestFontStyle:s,lineTrim:l,viewPadding:m,scrollWidth:g,wrapWidth:t,marginWidth:p,invalid:h}},_cancelAnimation:function(){this._animation&&(this._animation.stop(),this._animation=null)},_clearSelection:function(a){var b=
this._getSelection();if(b.isEmpty())return!1;"next"===a?b.start=b.end:b.end=b.start;this._setSelection(b,!0);return!0},_commitIME:function(a){if(-1!==this._imeOffset){var b=this._model,d=b.getLineAtOffset(this._imeOffset),e=b.getLineStart(d),h=this._getLineNode(d);if(!a){this._scrollDiv.focus();this._clientDiv.focus();var l=this._getDOMText(h).text,b=b.getLine(d),e=this._imeOffset-e,b=e+l.length-b.length;e!==b&&(a=l.substring(e,b))}a&&(!this._doContent(a)&&!f.isWebkit)&&(h.lineRemoved=!0,this._queueUpdate());
this._imeOffset=-1}},_createActions:function(){this.addKeyMode(new k.DefaultKeyMode(this));var a=this;this._actions={noop:{defaultHandler:function(){return a._doNoop()}},lineUp:{defaultHandler:function(b){return a._doLineUp(l(b,{select:!1}))},actionDescription:{name:m.lineUp}},lineDown:{defaultHandler:function(b){return a._doLineDown(l(b,{select:!1}))},actionDescription:{name:m.lineDown}},lineStart:{defaultHandler:function(b){return a._doHome(l(b,{select:!1,ctrl:!1}))},actionDescription:{name:m.lineStart}},
lineEnd:{defaultHandler:function(b){return a._doEnd(l(b,{select:!1,ctrl:!1}))},actionDescription:{name:m.lineEnd}},charPrevious:{defaultHandler:function(b){return a._doCursorPrevious(l(b,{select:!1,unit:"character"}))},actionDescription:{name:m.charPrevious}},charNext:{defaultHandler:function(b){return a._doCursorNext(l(b,{select:!1,unit:"character"}))},actionDescription:{name:m.charNext}},pageUp:{defaultHandler:function(b){return a._doPageUp(l(b,{select:!1}))},actionDescription:{name:m.pageUp}},
pageDown:{defaultHandler:function(b){return a._doPageDown(l(b,{select:!1}))},actionDescription:{name:m.pageDown}},scrollPageUp:{defaultHandler:function(b){return a._doScroll(l(b,{type:"pageUp"}))},actionDescription:{name:m.scrollPageUp}},scrollPageDown:{defaultHandler:function(b){return a._doScroll(l(b,{type:"pageDown"}))},actionDescription:{name:m.scrollPageDown}},scrollLineUp:{defaultHandler:function(b){return a._doScroll(l(b,{type:"lineUp"}))},actionDescription:{name:m.scrollLineUp}},scrollLineDown:{defaultHandler:function(b){return a._doScroll(l(b,
{type:"lineDown"}))},actionDescription:{name:m.scrollLineDown}},wordPrevious:{defaultHandler:function(b){return a._doCursorPrevious(l(b,{select:!1,unit:"word"}))},actionDescription:{name:m.wordPrevious}},wordNext:{defaultHandler:function(b){return a._doCursorNext(l(b,{select:!1,unit:"word"}))},actionDescription:{name:m.wordNext}},textStart:{defaultHandler:function(b){return a._doHome(l(b,{select:!1,ctrl:!0}))},actionDescription:{name:m.textStart}},textEnd:{defaultHandler:function(b){return a._doEnd(l(b,
{select:!1,ctrl:!0}))},actionDescription:{name:m.textEnd}},scrollTextStart:{defaultHandler:function(b){return a._doScroll(l(b,{type:"textStart"}))},actionDescription:{name:m.scrollTextStart}},scrollTextEnd:{defaultHandler:function(b){return a._doScroll(l(b,{type:"textEnd"}))},actionDescription:{name:m.scrollTextEnd}},centerLine:{defaultHandler:function(b){return a._doScroll(l(b,{type:"centerLine"}))},actionDescription:{name:m.centerLine}},selectLineUp:{defaultHandler:function(b){return a._doLineUp(l(b,
{select:!0}))},actionDescription:{name:m.selectLineUp}},selectLineDown:{defaultHandler:function(b){return a._doLineDown(l(b,{select:!0}))},actionDescription:{name:m.selectLineDown}},selectWholeLineUp:{defaultHandler:function(b){return a._doLineUp(l(b,{select:!0,wholeLine:!0}))},actionDescription:{name:m.selectWholeLineUp}},selectWholeLineDown:{defaultHandler:function(b){return a._doLineDown(l(b,{select:!0,wholeLine:!0}))},actionDescription:{name:m.selectWholeLineDown}},selectLineStart:{defaultHandler:function(b){return a._doHome(l(b,
{select:!0,ctrl:!1}))},actionDescription:{name:m.selectLineStart}},selectLineEnd:{defaultHandler:function(b){return a._doEnd(l(b,{select:!0,ctrl:!1}))},actionDescription:{name:m.selectLineEnd}},selectCharPrevious:{defaultHandler:function(b){return a._doCursorPrevious(l(b,{select:!0,unit:"character"}))},actionDescription:{name:m.selectCharPrevious}},selectCharNext:{defaultHandler:function(b){return a._doCursorNext(l(b,{select:!0,unit:"character"}))},actionDescription:{name:m.selectCharNext}},selectPageUp:{defaultHandler:function(b){return a._doPageUp(l(b,
{select:!0}))},actionDescription:{name:m.selectPageUp}},selectPageDown:{defaultHandler:function(b){return a._doPageDown(l(b,{select:!0}))},actionDescription:{name:m.selectPageDown}},selectWordPrevious:{defaultHandler:function(b){return a._doCursorPrevious(l(b,{select:!0,unit:"word"}))},actionDescription:{name:m.selectWordPrevious}},selectWordNext:{defaultHandler:function(b){return a._doCursorNext(l(b,{select:!0,unit:"word"}))},actionDescription:{name:m.selectWordNext}},selectTextStart:{defaultHandler:function(b){return a._doHome(l(b,
{select:!0,ctrl:!0}))},actionDescription:{name:m.selectTextStart}},selectTextEnd:{defaultHandler:function(b){return a._doEnd(l(b,{select:!0,ctrl:!0}))},actionDescription:{name:m.selectTextEnd}},deletePrevious:{defaultHandler:function(b){return a._doBackspace(l(b,{unit:"character"}))},actionDescription:{name:m.deletePrevious}},deleteNext:{defaultHandler:function(b){return a._doDelete(l(b,{unit:"character"}))},actionDescription:{name:m.deleteNext}},deleteWordPrevious:{defaultHandler:function(b){return a._doBackspace(l(b,
{unit:"word"}))},actionDescription:{name:m.deleteWordPrevious}},deleteWordNext:{defaultHandler:function(b){return a._doDelete(l(b,{unit:"word"}))},actionDescription:{name:m.deleteWordNext}},deleteLineStart:{defaultHandler:function(b){return a._doBackspace(l(b,{unit:"line"}))},actionDescription:{name:m.deleteLineStart}},deleteLineEnd:{defaultHandler:function(b){return a._doDelete(l(b,{unit:"line"}))},actionDescription:{name:m.deleteLineEnd}},tab:{defaultHandler:function(b){return a._doTab()},actionDescription:{name:m.tab}},
shiftTab:{defaultHandler:function(b){return a._doShiftTab()},actionDescription:{name:m.shiftTab}},enter:{defaultHandler:function(b){return a._doEnter()},actionDescription:{name:m.enter}},enterNoCursor:{defaultHandler:function(b){return a._doEnter(l(b,{noCursor:!0}))},actionDescription:{name:m.enterNoCursor}},selectAll:{defaultHandler:function(b){return a._doSelectAll()},actionDescription:{name:m.selectAll}},copy:{defaultHandler:function(b){return a._doCopy()},actionDescription:{name:m.copy}},cut:{defaultHandler:function(b){return a._doCut()},
actionDescription:{name:m.cut}},paste:{defaultHandler:function(b){return a._doPaste()},actionDescription:{name:m.paste}},uppercase:{defaultHandler:function(b){return a._doCase(l(b,{type:"upper"}))},actionDescription:{name:m.uppercase}},lowercase:{defaultHandler:function(b){return a._doCase(l(b,{type:"lower"}))},actionDescription:{name:m.lowercase}},capitalize:{defaultHandler:function(b){return a._doCase(l(b,{unit:"word",type:"capitalize"}))},actionDescription:{name:m.capitalize}},reversecase:{defaultHandler:function(b){return a._doCase(l(b,
{type:"reverse"}))},actionDescription:{name:m.reversecase}},toggleOverwriteMode:{defaultHandler:function(b){return a._doOverwriteMode()},actionDescription:{name:m.toggleOverwriteMode}},toggleTabMode:{defaultHandler:function(b){return a._doTabMode()},actionDescription:{name:m.toggleTabMode}},toggleWrapMode:{defaultHandler:function(b){return a._doWrapMode()},actionDescription:{name:m.toggleWrapMode}}}},_createRulerParent:function(a,b){var d=f.createElement(a,"div");d.className=b;d.tabIndex=-1;d.style.overflow=
"hidden";d.style.MozUserSelect="none";d.style.WebkitUserSelect="none";d.style.position="absolute";d.style.top="0px";d.style.bottom="0px";d.style.cursor="default";d.style.display="none";d.setAttribute("aria-hidden","true");this._rootDiv.appendChild(d);return d},_createRuler:function(a,b){if(this._clientDiv){var d=this._getRulerParent(a);if(d){if(d!==this._marginDiv||this._marginOffset)d.style.display="block";var e=f.createElement(d.ownerDocument,"div");e._ruler=a;e.rulerChanged=!0;e.style.position=
"relative";e.style.cssFloat="left";e.style.styleFloat="left";e.style.outline="none";if(void 0===b||0>b||b>=d.children.length)d.appendChild(e);else{for(var h=d.firstChild;h&&0<b--;)h=h.nextSibling;d.insertBefore(e,h)}}}},_createView:function(){function a(){l._rootDiv&&(l.update(!0),l._metrics.invalid&&l._getWindow().setTimeout(function(){a()},100))}if(!this._clientDiv){for(var b=this._parent;b.hasChildNodes();)b.removeChild(b.lastChild);var d=b.ownerDocument,e=f.createElement(d,"div");this._rootDiv=
e;e.tabIndex=-1;e.style.position="relative";e.style.overflow="hidden";e.style.width="100%";e.style.height="100%";e.style.overflow="hidden";e.style.WebkitTextSizeAdjust="100%";e.setAttribute("role","application");b.appendChild(e);this._leftDiv=this._createRulerParent(d,"textviewLeftRuler");b=f.createElement(d,"div");b.className="textviewScroll";this._viewDiv=b;b.tabIndex=-1;b.style.position="absolute";b.style.top="0px";b.style.bottom="0px";b.style.borderWidth="0px";b.style.margin="0px";b.style.outline=
"none";b.style.background="transparent";e.appendChild(b);var h=this._createRulerParent(d,"textviewRightRuler");this._rightDiv=h;h.style.right="0px";this._scrollDiv=h=f.createElement(d,"div");h.style.margin="0px";h.style.borderWidth="0px";h.style.padding="0px";b.appendChild(h);(this._marginDiv=this._createRulerParent(d,"textviewMarginRuler")).style.zIndex="4";!f.isIE&&!f.isIOS&&(this._clipDiv=b=f.createElement(d,"div"),b.style.position="absolute",b.style.overflow="hidden",b.style.margin="0px",b.style.borderWidth=
"0px",b.style.padding="0px",b.style.background="transparent",e.appendChild(b),this._clipScrollDiv=h=f.createElement(d,"div"),h.style.position="absolute",h.style.height="1px",h.style.top="-1000px",h.style.background="transparent",b.appendChild(h));this._setFullSelection(this._fullSelection,!0);b=f.createElement(d,"div");b.className="textviewContent";this._clientDiv=b;b.tabIndex=0;b.style.position="absolute";b.style.borderWidth="0px";b.style.margin="0px";b.style.padding="0px";b.style.outline="none";
b.style.zIndex="1";b.style.WebkitUserSelect="text";b.setAttribute("spellcheck","false");if(f.isIOS||f.isAndroid)b.style.WebkitTapHighlightColor="transparent";(this._clipDiv||e).appendChild(b);if(f.isIOS||f.isAndroid)this._vScrollDiv=h=f.createElement(d,"div"),h.style.position="absolute",h.style.borderWidth="1px",h.style.borderColor="white",h.style.borderStyle="solid",h.style.borderRadius="4px",h.style.backgroundColor="black",h.style.opacity="0.5",h.style.margin="0px",h.style.padding="0px",h.style.outline=
"none",h.style.zIndex="3",h.style.width="8px",h.style.display="none",e.appendChild(h),this._hScrollDiv=h=f.createElement(d,"div"),h.style.position="absolute",h.style.borderWidth="1px",h.style.borderColor="white",h.style.borderStyle="solid",h.style.borderRadius="4px",h.style.backgroundColor="black",h.style.opacity="0.5",h.style.margin="0px",h.style.padding="0px",h.style.outline="none",h.style.zIndex="3",h.style.height="8px",h.style.display="none",e.appendChild(h);f.isFirefox&&!b.setCapture&&(this._overlayDiv=
h=f.createElement(d,"div"),h.style.position=b.style.position,h.style.borderWidth=b.style.borderWidth,h.style.margin=b.style.margin,h.style.padding=b.style.padding,h.style.cursor="text",h.style.zIndex="2",(this._clipDiv||e).appendChild(h));b.contentEditable="true";b.setAttribute("role","textbox");b.setAttribute("aria-multiline","true");this._setWrapMode(this._wrapMode,!0);this._setReadOnly(this._readonly);this._setThemeClass(this._themeClass,!0);this._setTabSize(this._tabSize,!0);this._setMarginOffset(this._marginOffset,
!0);this._hookEvents();b=this._rulers;for(h=0;h<b.length;h++)this._createRuler(b[h]);this._update();var l=this;t(d,e,"textview",a)}},_defaultOptions:function(){return{parent:{value:void 0,update:null},model:{value:void 0,update:this.setModel},scrollAnimation:{value:0,update:null},readonly:{value:!1,update:this._setReadOnly},fullSelection:{value:!0,update:this._setFullSelection},tabMode:{value:!0,update:null},tabSize:{value:8,update:this._setTabSize},expandTab:{value:!1,update:null},singleMode:{value:!1,
update:this._setSingleMode},overwriteMode:{value:!1,update:this._setOverwriteMode},blockCursorVisible:{value:!1,update:this._setBlockCursor},marginOffset:{value:0,update:this._setMarginOffset},wrapOffset:{value:0,update:this._setWrapOffset},wrapMode:{value:!1,update:this._setWrapMode},wrappable:{value:!1,update:null},theme:{value:d.TextTheme.getTheme(),update:this._setTheme},themeClass:{value:void 0,update:this._setThemeClass}}},_destroyRuler:function(a){var b=this._getRulerParent(a);if(b)for(var d=
b.firstChild;d;){if(d._ruler===a){d._ruler=void 0;b.removeChild(d);if(0===b.children.length&&(b!==this._marginDiv||!this._marginOffset))b.style.display="none";break}d=d.nextSibling}},_destroyView:function(){if(this._clientDiv){this._setGrab(null);this._unhookEvents();var a=this._getWindow();this._autoScrollTimerID&&(a.clearTimeout(this._autoScrollTimerID),this._autoScrollTimerID=null);this._updateTimer&&(a.clearTimeout(this._updateTimer),this._updateTimer=null);a=this._rootDiv;a.parentNode.removeChild(a);
this._hScrollDiv=this._vScrollDiv=this._cursorDiv=this._marginDiv=this._rightDiv=this._leftDiv=this._overlayDiv=this._clientDiv=this._clipScrollDiv=this._clipDiv=this._viewDiv=this._scrollDiv=this._rootDiv=this._clipboardDiv=this._selDiv3=this._selDiv2=this._selDiv1=null}},_doAutoScroll:function(a,b,d){this._autoScrollDir=a;this._autoScrollX=b;this._autoScrollY=d;this._autoScrollTimerID||this._autoScrollTimer()},_endAutoScroll:function(){this._autoScrollTimerID&&this._getWindow().clearTimeout(this._autoScrollTimerID);
this._autoScrollTimerID=this._autoScrollDir=void 0},_fixCaret:function(){var a=this._clientDiv;if(a){var b=this._hasFocus;this._ignoreFocus=!0;b&&a.blur();a.contentEditable=!1;a.contentEditable=!0;b&&a.focus();this._ignoreFocus=!1}},_getBaseText:function(a,b){var d=this._model;d.getBaseModel&&(a=d.mapOffset(a),b=d.mapOffset(b),d=d.getBaseModel());return d.getText(a,b)},_getBottomIndex:function(a){var b=this._bottomChild;if(a&&this._getClientHeight()>this._getLineHeight()){a=b.getBoundingClientRect();
var d=this._clientDiv.getBoundingClientRect();a.bottom>d.bottom&&(b=this._getLinePrevious(b)||b)}return b.lineIndex},_getBoundsAtOffset:function(a){var b=this._getLine(this._model.getLineAtOffset(a));a=b.getBoundingClientRect(a);var d=this._getLinePixel(b.lineIndex);a.top+=d;a.bottom+=d;b.destroy();return a},_getClientHeight:function(){var a=this._getViewPadding();return Math.max(0,this._viewDiv.clientHeight-a.top-a.bottom)},_getClientWidth:function(){var a=this._getViewPadding();return Math.max(0,
this._viewDiv.clientWidth-a.left-a.right)},_getClipboardText:function(a,b){var d=this._model.getLineDelimiter(),e,h,l=this._getWindow(),g=l.clipboardData;!g&&a&&(g=a.clipboardData);if(g)return e=[],h=g.getData(f.isIE?"Text":"text/plain"),p(h,function(a){e.push(a)},function(){e.push(d)}),h=e.join(""),b&&b(h),h;if(f.isFirefox){this._ignoreFocus=!0;var q=this._clipboardDiv,g=this._rootDiv.ownerDocument;q||(this._clipboardDiv=q=f.createElement(g,"div"),q.style.position="fixed",q.style.whiteSpace="pre",
q.style.left="-1000px",this._rootDiv.appendChild(q));q.innerHTML="\x3cpre contenteditable\x3d''\x3e\x3c/pre\x3e";q.firstChild.focus();var r=this,k=function(){var a=r._getTextFromElement(q);q.innerHTML="";e=[];p(a,function(a){e.push(a)},function(){e.push(d)});return e.join("")},m=!1;this._ignorePaste=!0;if(!f.isLinux||2!==this._lastMouseButton)try{m=g.execCommand("paste",!1,null)}catch(t){m=1<q.childNodes.length||q.firstChild&&0<q.firstChild.childNodes.length}this._ignorePaste=!1;if(!m){if(a)return l.setTimeout(function(){r.focus();
(h=k())&&b&&b(h);r._ignoreFocus=!1},0),null;this.focus();this._ignoreFocus=!1;return""}this.focus();this._ignoreFocus=!1;(h=k())&&b&&b(h);return h}return""},_getDOMText:function(a,b){return a._line.getText(b)},_getTextFromElement:function(a){var b=a.ownerDocument,d=b.defaultView;if(!d.getSelection)return a.innerText||a.textContent;b=b.createRange();b.selectNode(a);a=d.getSelection();var d=[],f;for(f=0;f<a.rangeCount;f++)d.push(a.getRangeAt(f));this._ignoreSelect=!0;a.removeAllRanges();a.addRange(b);
b=a.toString();a.removeAllRanges();for(f=0;f<d.length;f++)a.addRange(d[f]);this._ignoreSelect=!1;return b},_getViewPadding:function(){return this._metrics.viewPadding},_getLine:function(a){var b=this._getLineNode(a);return b&&!b.lineChanged&&!b.lineRemoved?b._line:new x(this,a)},_getLineHeight:function(a,b){if(void 0!==a&&this._lineHeight){var d=this._lineHeight[a];if(d)return d;if(b||void 0===b)return this._lineHeight[a]=this._calculateLineHeight(a)}return this._metrics.lineHeight},_getLineNode:function(a){for(var b=
this._clientDiv.firstChild;b;){if(a===b.lineIndex)return b;b=b.nextSibling}},_getLineNext:function(a){for(a=a?a.nextSibling:this._clientDiv.firstChild;a&&(-1===a.lineIndex||!a._line);)a=a.nextSibling;return a},_getLinePrevious:function(a){for(a=a?a.previousSibling:this._clientDiv.lastChild;a&&(-1===a.lineIndex||!a._line);)a=a.previousSibling;return a},_getLinePixel:function(a){a=Math.min(Math.max(0,a),this._model.getLineCount());if(this._lineHeight){var b=this._getTopIndex(),d=-this._topIndexY+this._getScroll().y;
if(a>b)for(;b<a;b++)d+=this._getLineHeight(b);else for(b-=1;b>=a;b--)d-=this._getLineHeight(b);return d}return this._getLineHeight()*a},_getLineIndex:function(a){var b,d=0,f=this._model.getLineCount();if(this._lineHeight){var d=this._getTopIndex(),e=-this._topIndexY+this._getScroll().y;if(a!==e)if(a<e)for(;a<e&&0<d;)a+=this._getLineHeight(--d);else for(b=this._getLineHeight(d);a-b>=e&&d<f-1;)a-=b,b=this._getLineHeight(++d)}else b=this._getLineHeight(),d=Math.floor(a/b);return Math.max(0,Math.min(f-
1,d))},_getRulerParent:function(a){switch(a.getLocation()){case "left":return this._leftDiv;case "right":return this._rightDiv;case "margin":return this._marginDiv}return null},_getScroll:function(a){(void 0===a||a)&&this._cancelAnimation();a=this._viewDiv;return{x:a.scrollLeft,y:a.scrollTop}},_getSelection:function(){return this._selection.clone()},_getTopIndex:function(a){var b=this._topChild;if(a&&this._getClientHeight()>this._getLineHeight()){a=b.getBoundingClientRect();var d=this._getViewPadding(),
f=this._viewDiv.getBoundingClientRect();a.top<f.top+d.top&&(b=this._getLineNext(b)||b)}return b.lineIndex},_hookEvents:function(){var a=this;this._modelListener={onChanging:function(b){a._onModelChanging(b)},onChanged:function(b){a._onModelChanged(b)}};this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._themeListener={onChanged:function(b){a._setThemeClass(a._themeClass)}};this._theme.addEventListener("ThemeChanged",
this._themeListener.onChanged);var b=this._handlers=[],d=this._clientDiv,e=this._viewDiv,h=this._rootDiv,l=this._overlayDiv||d,p=d.ownerDocument,g=this._getWindow(),q=f.isIE?p:g;b.push({target:g,type:"resize",handler:function(b){return a._handleResize(b?b:g.event)}});b.push({target:d,type:"blur",handler:function(b){return a._handleBlur(b?b:g.event)}});b.push({target:d,type:"focus",handler:function(b){return a._handleFocus(b?b:g.event)}});b.push({target:e,type:"focus",handler:function(a){d.focus()}});
b.push({target:e,type:"scroll",handler:function(b){return a._handleScroll(b?b:g.event)}});b.push({target:d,type:"textInput",handler:function(b){return a._handleTextInput(b?b:g.event)}});b.push({target:d,type:"keydown",handler:function(b){return a._handleKeyDown(b?b:g.event)}});b.push({target:d,type:"keypress",handler:function(b){return a._handleKeyPress(b?b:g.event)}});b.push({target:d,type:"keyup",handler:function(b){return a._handleKeyUp(b?b:g.event)}});f.isIE&&b.push({target:p,type:"keyup",handler:function(b){return a._handleDocKeyUp(b?
b:g.event)}});b.push({target:d,type:"contextmenu",handler:function(b){return a._handleContextMenu(b?b:g.event)}});b.push({target:d,type:"copy",handler:function(b){return a._handleCopy(b?b:g.event)}});b.push({target:d,type:"cut",handler:function(b){return a._handleCut(b?b:g.event)}});b.push({target:d,type:"paste",handler:function(b){return a._handlePaste(b?b:g.event)}});b.push({target:p,type:"selectionchange",handler:function(b){return a._handleSelectionChange(b?b:g.event)}});if(f.isIOS||f.isAndroid)b.push({target:d,
type:"touchstart",handler:function(b){return a._handleTouchStart(b?b:g.event)}}),b.push({target:d,type:"touchmove",handler:function(b){return a._handleTouchMove(b?b:g.event)}}),b.push({target:d,type:"touchend",handler:function(b){return a._handleTouchEnd(b?b:g.event)}});else{b.push({target:d,type:"selectstart",handler:function(b){return a._handleSelectStart(b?b:g.event)}});b.push({target:d,type:"mousedown",handler:function(b){return a._handleMouseDown(b?b:g.event)}});b.push({target:d,type:"mouseover",
handler:function(b){return a._handleMouseOver(b?b:g.event)}});b.push({target:d,type:"mouseout",handler:function(b){return a._handleMouseOut(b?b:g.event)}});b.push({target:q,type:"mouseup",handler:function(b){return a._handleMouseUp(b?b:g.event)}});b.push({target:q,type:"mousemove",handler:function(b){return a._handleMouseMove(b?b:g.event)}});b.push({target:h,type:"mousedown",handler:function(b){return a._handleRootMouseDown(b?b:g.event)}});b.push({target:h,type:"mouseup",handler:function(b){return a._handleRootMouseUp(b?
b:g.event)}});b.push({target:l,type:"dragstart",handler:function(b){return a._handleDragStart(b?b:g.event)}});b.push({target:l,type:"drag",handler:function(b){return a._handleDrag(b?b:g.event)}});b.push({target:l,type:"dragend",handler:function(b){return a._handleDragEnd(b?b:g.event)}});b.push({target:l,type:"dragenter",handler:function(b){return a._handleDragEnter(b?b:g.event)}});b.push({target:l,type:"dragover",handler:function(b){return a._handleDragOver(b?b:g.event)}});b.push({target:l,type:"dragleave",
handler:function(b){return a._handleDragLeave(b?b:g.event)}});b.push({target:l,type:"drop",handler:function(b){return a._handleDrop(b?b:g.event)}});b.push({target:this._clientDiv,type:26<f.isFirefox?"wheel":f.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return a._handleMouseWheel(b?b:g.event)}});this._clipDiv&&b.push({target:this._clipDiv,type:26<f.isFirefox?"wheel":f.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return a._handleMouseWheel(b?b:g.event)}});if(f.isFirefox&&
(!f.isWindows||15<=f.isFirefox))(e=g.MutationObserver||g.MozMutationObserver)?(this._mutationObserver=new e(function(b){a._handleDataModified(b)}),this._mutationObserver.observe(d,{subtree:!0,characterData:!0})):b.push({target:this._clientDiv,type:"DOMCharacterDataModified",handler:function(b){return a._handleDataModified(b?b:g.event)}});if(f.isFirefox&&(!f.isWindows||15<=f.isFirefox)||f.isIE)b.push({target:this._clientDiv,type:"compositionstart",handler:function(b){return a._handleCompositionStart(b?
b:g.event)}}),b.push({target:this._clientDiv,type:"compositionend",handler:function(b){return a._handleCompositionEnd(b?b:g.event)}});this._overlayDiv&&(b.push({target:this._overlayDiv,type:"mousedown",handler:function(b){return a._handleMouseDown(b?b:g.event)}}),b.push({target:this._overlayDiv,type:"mouseover",handler:function(b){return a._handleMouseOver(b?b:g.event)}}),b.push({target:this._overlayDiv,type:"mouseout",handler:function(b){return a._handleMouseOut(b?b:g.event)}}),b.push({target:this._overlayDiv,
type:"contextmenu",handler:function(b){return a._handleContextMenu(b?b:g.event)}}));this._isW3CEvents||b.push({target:this._clientDiv,type:"dblclick",handler:function(b){return a._handleDblclick(b?b:g.event)}})}this._hookRulerEvents(this._leftDiv,b);this._hookRulerEvents(this._rightDiv,b);this._hookRulerEvents(this._marginDiv,b);for(e=0;e<b.length;e++)h=b[e],z(h.target,h.type,h.handler,h.capture)},_hookRulerEvents:function(a,b){if(a){var d=this,e=this._getWindow();f.isIE&&b.push({target:a,type:"selectstart",
handler:function(){return!1}});b.push({target:a,type:26<f.isFirefox?"wheel":f.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return d._handleMouseWheel(a?a:e.event)}});b.push({target:a,type:"click",handler:function(a){d._handleRulerEvent(a?a:e.event)}});b.push({target:a,type:"dblclick",handler:function(a){d._handleRulerEvent(a?a:e.event)}});b.push({target:a,type:"mousemove",handler:function(a){d._handleRulerEvent(a?a:e.event)}});b.push({target:a,type:"mouseover",handler:function(a){d._handleRulerEvent(a?
a:e.event)}});b.push({target:a,type:"mouseout",handler:function(a){d._handleRulerEvent(a?a:e.event)}})}},_getWindow:function(){return this._parent.ownerDocument.defaultView||this._parent.ownerDocument.parentWindow},_ignoreEvent:function(a){for(a=a.target;a&&a!==this._clientDiv;){if(a.ignore)return!0;a=a.parentNode}return!1},_init:function(a){var b=a.parent;"string"===typeof b&&(b=(a.document||document).getElementById(b));if(!b)throw"no parent";a.parent=b;a.model=a.model||new n.TextModel;var d=this._defaultOptions(),
e;for(e in d)d.hasOwnProperty(e)&&(this["_"+e]=void 0!==a[e]?a[e]:d[e].value);this._keyModes=[];this._rulers=[];this._selection=new w(0,0,!1);this._linksVisible=!1;this._maxLineWidth=this._redrawCount=0;this._maxLineIndex=-1;this._ignoreSelect=!0;this._hasFocus=this._ignoreFocus=!1;this._dragOffset=this._columnX=-1;this._isRangeRects=(!f.isIE||9<=f.isIE)&&"function"===typeof b.ownerDocument.createRange().getBoundingClientRect;this._isW3CEvents=b.addEventListener;this._autoScrollTimerID=this._autoScrollY=
this._autoScrollX=null;this._AUTO_SCROLL_RATE=50;this._mouseUpClosure=this._moseMoveClosure=this._grabControl=null;this._clickCount=this._lastMouseTime=this._lastMouseY=this._lastMouseX=0;this._clickTime=250;this._clickDist=5;this._isMouseDown=!1;this._doubleClickSelection=null;this._vScroll=this._hScroll=0;this._imeOffset=-1;this._createActions();this._createView()},_checkOverlayScroll:function(){if(f.isMac&&f.isWebkit&&!this._metrics.invalid&&0===this._metrics.scrollWidth){var a=this._viewDiv,b=
this._isOverOverlayScroll();a.style.pointerEvents=b.vertical||b.horizontal?"":"none"}},_isOverOverlayScroll:function(){if(!(200>(new Date).getTime()-this._lastScrollTime))return{};var a=this._viewDiv.getBoundingClientRect(),b=this._lastMouseMoveX,d=this._lastMouseMoveY;return{vertical:a.top<=d&&d<a.bottom&&a.right-15<=b&&b<a.right,horizontal:a.bottom-15<=d&&d<a.bottom&&a.left<=b&&b<a.right}},_modifyContent:function(a,b){if(this._readonly&&!a._code)return!1;a.type="Verify";this.onVerify(a);if(null===
a.text||void 0===a.text)return!1;var d=this._model;try{a._ignoreDOMSelection&&(this._ignoreDOMSelection=!0),d.setText(a.text,a.start,a.end)}finally{a._ignoreDOMSelection&&(this._ignoreDOMSelection=!1)}if(b){d=this._getSelection();d.setCaret(a.start+a.text.length);try{a._ignoreDOMSelection1&&(this._ignoreDOMSelection=!0),this._setSelection(d,!0)}finally{a._ignoreDOMSelection1&&(this._ignoreDOMSelection=!1)}}this.onModify({type:"Modify"});return!0},_onModelChanged:function(a){a.type="ModelChanged";
this.onModelChanged(a);a.type="Changed";var b=a.start,d=a.addedCharCount,f=a.removedCharCount,e=a.addedLineCount,h=a.removedLineCount,l=this._getSelection();l.end>b&&(l.end>b&&l.start<b+f?l.setCaret(b+d):(l.start+=d-f,l.end+=d-f),this._setSelection(l,!1,!1));b=this._model.getLineAtOffset(b);for(d=this._getLineNext();d;)f=d.lineIndex,b<=f&&f<=b+h&&(b===f&&!d.modelChangedEvent&&!d.lineRemoved?(d.modelChangedEvent=a,d.lineChanged=!0):(d.lineRemoved=!0,d.lineChanged=!1,d.modelChangedEvent=null)),f>b+
h&&(d.lineIndex=f+e-h,d._line.lineIndex=d.lineIndex),d=this._getLineNext(d);this._lineHeight&&(a=[b,h].concat(Array(e)),Array.prototype.splice.apply(this._lineHeight,a));!this._wrapMode&&(b<=this._maxLineIndex&&this._maxLineIndex<=b+h)&&(this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0);this._update()},_onModelChanging:function(a){a.type="ModelChanging";this.onModelChanging(a);a.type="Changing"},_queueUpdate:function(){if(!this._updateTimer&&!this._ignoreQueueUpdate){var a=
this;this._updateTimer=this._getWindow().setTimeout(function(){a._updateTimer=null;a._update()},0)}},_resetLineHeight:function(a,b){if(this._wrapMode||this._variableLineHeight){if(void 0!==a&&void 0!==b)for(var d=a;d<b;d++)this._lineHeight[d]=void 0;else this._lineHeight=Array(this._model.getLineCount());this._calculateLineHeightTimer()}else this._lineHeight=null},_resetLineWidth:function(){var a=this._clientDiv;if(a)for(a=a.firstChild;a;)a.lineWidth=void 0,a=a.nextSibling},_reset:function(){this._maxLineIndex=
-1;this._maxLineWidth=0;this._columnX=-1;this._bottomChild=this._topChild=null;this._topIndexY=0;this._variableLineHeight=!1;this._resetLineHeight();this._setSelection(new w(0,0,!1),!1,!1);this._viewDiv&&(this._viewDiv.scrollLeft=0,this._viewDiv.scrollTop=0);var a=this._clientDiv;if(a){for(a=a.firstChild;a;)a.lineRemoved=!0,a=a.nextSibling;13>f.isFirefox&&this._fixCaret()}},_scrollViewAnimated:function(a,b,d){var f=this._getWindow();if(d&&this._scrollAnimation){var e=this;this._animation=new B({window:f,
duration:this._scrollAnimation,curve:[b,0],onAnimate:function(a){a=b-Math.floor(a);e._scrollView(0,a);b-=a},onEnd:function(){e._animation=null;e._scrollView(a,b);d&&f.setTimeout(d,0)}});this._animation.play()}else this._scrollView(a,b),d&&f.setTimeout(d,0)},_scrollView:function(a,b){this._ensureCaretVisible=!1;var d=this._viewDiv;a&&(d.scrollLeft+=a);b&&(d.scrollTop+=b)},_setClipboardText:function(a,b){var d,e=this._getWindow(),h=e.clipboardData;!h&&b&&(h=b.clipboardData);if(h&&(d=[],p(a,function(a){d.push(a)},
function(){d.push(f.platformDelimiter)}),h.setData(f.isIE?"Text":"text/plain",d.join(""))||21<f.isFirefox))return!0;var l=this._parent.ownerDocument,g=f.createElement(l,"pre");g.style.position="fixed";g.style.left="-1000px";p(a,function(a){g.appendChild(l.createTextNode(a))},function(){g.appendChild(f.createElement(l,"br"))});g.appendChild(l.createTextNode(" "));this._clientDiv.appendChild(g);h=l.createRange();h.setStart(g.firstChild,0);h.setEndBefore(g.lastChild);var q=e.getSelection();0<q.rangeCount&&
q.removeAllRanges();q.addRange(h);var r=this,h=function(){g&&g.parentNode===r._clientDiv&&r._clientDiv.removeChild(g);r._updateDOMSelection()},q=!1;this._ignoreCopy=!0;try{q=l.execCommand("copy",!1,null)}catch(k){}this._ignoreCopy=!1;if(!q&&b)return e.setTimeout(h,0),!1;h();return!0},_setDOMSelection:function(a,b,d,e,h){this._setDOMFullSelection(a,b,d,e);a=a._line.getNodeOffset(b);d=d._line.getNodeOffset(e);e=this._getWindow();b=this._parent.ownerDocument;if(e.getSelection){var l=e.getSelection();
e=b.createRange();e.setStart(a.node,a.offset);e.setEnd(d.node,d.offset);if(this._hasFocus&&(l.anchorNode!==a.node||l.anchorOffset!==a.offset||l.focusNode!==d.node||l.focusOffset!==d.offset||l.anchorNode!==d.node||l.anchorOffset!==d.offset||l.focusNode!==a.node||l.focusOffset!==a.offset))this._anchorNode=a.node,this._anchorOffset=a.offset,this._focusNode=d.node,this._focusOffset=d.offset,this._ignoreSelect=!1,0<l.rangeCount&&l.removeAllRanges(),l.addRange(e),this._ignoreSelect=!0;this._cursorDiv&&
(e=b.createRange(),h?(e.setStart(a.node,a.offset),e.setEnd(a.node,a.offset)):(e.setStart(d.node,d.offset),e.setEnd(d.node,d.offset)),h=e.getClientRects()[0],a=this._cursorDiv.parentNode,d=a.getBoundingClientRect(),h&&d&&(this._cursorDiv.style.top=h.top-d.top+a.scrollTop+"px",this._cursorDiv.style.left=h.left-d.left+a.scrollLeft+"px"))}else b.selection&&this._hasFocus&&(h=b.body,e=f.createElement(b,"div"),h.appendChild(e),h.removeChild(e),e=h.createTextRange(),e.moveToElementText(a.node.parentNode),
e.moveStart("character",a.offset),h=h.createTextRange(),h.moveToElementText(d.node.parentNode),h.moveStart("character",d.offset),e.setEndPoint("EndToStart",h),this._ignoreSelect=!1,e.select(),this._ignoreSelect=!0)},_setDOMFullSelection:function(a,b,d,f){if(this._selDiv1){var e=this._selDiv1;e.style.width="0px";e.style.height="0px";e=this._selDiv2;e.style.width="0px";e.style.height="0px";e=this._selDiv3;e.style.width="0px";e.style.height="0px";if(!(a===d&&b===f)){var h=this._getViewPadding(),l=this._clientDiv.getBoundingClientRect(),
p=this._viewDiv.getBoundingClientRect(),e=p.left+h.left,g=l.right,h=p.top+h.top,q=l.bottom,p=l=0;this._clipDiv?(p=this._clipDiv.getBoundingClientRect(),l=p.left-this._clipDiv.scrollLeft):(p=this._rootDiv.getBoundingClientRect(),l=p.left);p=p.top;this._ignoreDOMSelection=!0;var r=(new x(this,a.lineIndex,a)).getBoundingClientRect(b,!1),k=r.left;b=(new x(this,d.lineIndex,d)).getBoundingClientRect(f,!1);var m=b.left;this._ignoreDOMSelection=!1;var t=this._selDiv1,k=Math.min(g,Math.max(e,k)),s=Math.min(q,
Math.max(h,r.top)),w=g;f=Math.min(q,Math.max(h,r.bottom));t.style.left=k-l+"px";t.style.top=s-p+"px";t.style.width=Math.max(0,w-k)+"px";t.style.height=Math.max(0,f-s)+"px";a.lineIndex===d.lineIndex?(w=Math.min(m,g),t.style.width=Math.max(0,w-k)+"px"):(r=Math.min(q,Math.max(h,b.top)),m=Math.min(g,Math.max(e,m)),h=Math.min(q,Math.max(h,b.bottom)),q=this._selDiv3,q.style.left=e-l+"px",q.style.top=r-p+"px",q.style.width=Math.max(0,m-e)+"px",q.style.height=Math.max(0,h-r)+"px",1<Math.abs(a.lineIndex-d.lineIndex)&&
(a=this._selDiv2,a.style.left=e-l+"px",a.style.top=f-p+"px",a.style.width=Math.max(0,g-e)+"px",a.style.height=Math.max(0,r-f)+"px"))}}},_setGrab:function(a){a!==this._grabControl&&(a?(a.setCapture&&a.setCapture(),this._grabControl=a):(this._grabControl.releaseCapture&&this._grabControl.releaseCapture(),this._grabControl=null))},_setLinksVisible:function(a){if(this._linksVisible!==a){this._linksVisible=a;f.isIE&&a&&(this._hadFocus=this._hasFocus);var b=this._clientDiv;b.contentEditable=!a;this._hadFocus&&
!a&&b.focus();this._overlayDiv&&(this._overlayDiv.style.zIndex=a?"-1":"1");for(a=this._getLineNext();a;)a._line.updateLinks(),a=this._getLineNext(a);this._updateDOMSelection()}},_setSelection:function(a,b,d,f,e){if(a){this._columnX=-1;void 0===d&&(d=!0);var h=this._selection;this._selection=a;!1!==b&&this._showCaret(!1,f,b,e);d&&this._updateDOMSelection();if(!h.equals(a))this.onSelection({type:"Selection",oldValue:{start:h.start,end:h.end},newValue:{start:a.start,end:a.end}})}},_setSelectionTo:function(a,
b,d,f){var e=this._model,h=this._getSelection();b=this.convert({x:a,y:b},"page","document");a=this._getLineIndex(b.y);if(1===this._clickCount){e=this._getLine(a);a=e.getOffset(b.x,b.y-this._getLinePixel(a));e.destroy();if(f&&!d&&h.start<=a&&a<h.end)return this._dragOffset=a,!1;h.extend(a);d||h.collapse()}else 0===(this._clickCount&1)?(e=this._getLine(a),a=e.getOffset(b.x,b.y-this._getLinePixel(a)),this._doubleClickSelection?a>=this._doubleClickSelection.start?(d=this._doubleClickSelection.start,f=
e.getNextOffset(a,{unit:"wordend",count:1})):(d=e.getNextOffset(a,{unit:"word",count:-1}),f=this._doubleClickSelection.end):(d=e.getNextOffset(a,{unit:"word",count:-1}),f=e.getNextOffset(d,{unit:"wordend",count:1})),e.destroy()):this._doubleClickSelection?(f=e.getLineAtOffset(this._doubleClickSelection.start),a>=f?(d=e.getLineStart(f),f=e.getLineEnd(a)):(d=e.getLineStart(a),f=e.getLineEnd(f))):(d=e.getLineStart(a),f=e.getLineEnd(a)),h.setCaret(d),h.extend(f);this._setSelection(h,!0,!0);return!0},
_setFullSelection:function(a,b){this._fullSelection=a;f.isWebkit&&(this._fullSelection=!0);var d=this._clipDiv||this._rootDiv;if(d)if(this._fullSelection){if(!this._selDiv1&&this._fullSelection&&!f.isIOS){var e=d.ownerDocument;this._highlightRGB=f.isWebkit?"transparent":"Highlight";var h=f.createElement(e,"div");this._selDiv1=h;h.style.position="absolute";h.style.borderWidth="0px";h.style.margin="0px";h.style.padding="0px";h.style.outline="none";h.style.background=this._highlightRGB;h.style.width=
"0px";h.style.height="0px";h.style.zIndex="0";d.appendChild(h);var l=f.createElement(e,"div");this._selDiv2=l;l.style.position="absolute";l.style.borderWidth="0px";l.style.margin="0px";l.style.padding="0px";l.style.outline="none";l.style.background=this._highlightRGB;l.style.width="0px";l.style.height="0px";l.style.zIndex="0";d.appendChild(l);this._selDiv3=e=f.createElement(e,"div");e.style.position="absolute";e.style.borderWidth="0px";e.style.margin="0px";e.style.padding="0px";e.style.outline="none";
e.style.background=this._highlightRGB;e.style.width="0px";e.style.height="0px";e.style.zIndex="0";d.appendChild(e);if(f.isFirefox&&f.isMac){d=this._getWindow().getComputedStyle(e,null).getPropertyValue("background-color");switch(d){case "rgb(119, 141, 168)":d="rgb(199, 208, 218)";break;case "rgb(127, 127, 127)":d="rgb(198, 198, 198)";break;case "rgb(255, 193, 31)":d="rgb(250, 236, 115)";break;case "rgb(243, 70, 72)":d="rgb(255, 176, 139)";break;case "rgb(255, 138, 34)":d="rgb(255, 209, 129)";break;
case "rgb(102, 197, 71)":d="rgb(194, 249, 144)";break;case "rgb(140, 78, 184)":d="rgb(232, 184, 255)";break;default:d="rgb(180, 213, 255)"}this._highlightRGB=d;h.style.background=d;l.style.background=d;e.style.background=d}b||this._updateDOMSelection()}}else this._selDiv1&&(d.removeChild(this._selDiv1),this._selDiv1=null),this._selDiv2&&(d.removeChild(this._selDiv2),this._selDiv2=null),this._selDiv3&&(d.removeChild(this._selDiv3),this._selDiv3=null)},_setBlockCursor:function(a){this._blockCursorVisible=
a;this._updateBlockCursorVisible()},_setOverwriteMode:function(a){this._overwriteMode=a;this._updateBlockCursorVisible()},_updateBlockCursorVisible:function(){if(this._blockCursorVisible||this._overwriteMode){if(!this._cursorDiv){var a=this._viewDiv,b=f.createElement(a.ownerDocument,"div");b.className="textviewBlockCursor";this._cursorDiv=b;b.tabIndex=-1;b.style.zIndex="2";b.style.color="transparent";b.style.position="absolute";b.style.pointerEvents="none";b.innerHTML="\x26nbsp;";a.appendChild(b);
this._updateDOMSelection()}}else this._cursorDiv&&(this._cursorDiv.parentNode.removeChild(this._cursorDiv),this._cursorDiv=null)},_setMarginOffset:function(a,b){this._marginOffset=a;this._marginDiv.style.display=a?"block":"none";b||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setWrapOffset:function(a,b){this._wrapOffset=a;b||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setReadOnly:function(a){this._readonly=a;this._clientDiv.setAttribute("aria-readonly",a?"true":
"false")},_setSingleMode:function(a,b){this._singleMode=a;this._updateOverflow();this._updateStyle(b)},_setTabSize:function(a,b){this._tabSize=a;this._customTabSize=void 0;var d=this._clientDiv;f.isOpera?d&&(d.style.OTabSize=this._tabSize+""):537.1<=f.isWebkit?d&&(d.style.tabSize=this._tabSize+""):4<=f.isFirefox?d&&(d.style.MozTabSize=this._tabSize+""):8!==this._tabSize&&(this._customTabSize=this._tabSize);b||(this.redrawLines(),this._resetLineWidth())},_setTheme:function(a){this._theme&&this._theme.removeEventListener("ThemeChanged",
this._themeListener.onChanged);(this._theme=a)&&this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);this._setThemeClass(this._themeClass)},_setThemeClass:function(a,b){this._themeClass=a;var d="textview",f=this._theme.getThemeClass();f&&(d+=" "+f);this._themeClass&&f!==this._themeClass&&(d+=" "+this._themeClass);this._rootDiv.className=d;this._updateStyle(b)},_setWrapMode:function(a,b){this._wrapMode=a&&this._wrappable;var d=this._clientDiv;this._wrapMode?(d.style.whiteSpace=
"pre-wrap",d.style.wordWrap="break-word"):(d.style.whiteSpace="pre",d.style.wordWrap="normal");this._updateOverflow();b||(this.redraw(),this._resetLineWidth());this._resetLineHeight()},_showCaret:function(a,b,d,f){if(this._clientDiv&&!(0<this._redrawCount)&&!this._ignoreDOMSelection){var e=this._model,h=this._getSelection(),l=this._getScroll(),p=h.getCaret(),g=h.start,q=h.end,r=e.getLineAtOffset(g),k=e.getLineAtOffset(q),m=Math.max(Math.max(g,e.getLineStart(k)),q-1),e=this._getClientWidth(),t=this._getClientHeight(),
s=e/4,w=this._getBoundsAtOffset(p===g?g:m),n=w.left,v=w.right,x=w.top,z=w.bottom,A=0,B="object"===typeof d;if((a||B)&&!h.isEmpty())w=this._getBoundsAtOffset(p===q?g:m),A=(w.bottom>z?w.bottom:z)-(w.top<x?w.top:x),a&&(w.top===x?p===g?v=n+Math.min(w.right-n,e):n=v-Math.min(v-w.left,e):p===g?z=x+Math.min(w.bottom-x,t):x=z-Math.min(z-w.top,t));a=0;n<l.x&&(a=Math.min(n-l.x,-s));v>l.x+e&&(a=Math.max(v-l.x-e,s));h=0;x<l.y?h=x-l.y:z>l.y+t&&(h=z-l.y-t);f&&(0<f?0<h&&(h=Math.max(h,f)):0>h&&(h=Math.min(h,f)));
f=B&&"always"===d.scrollPolicy;if(0!==a||0!==h||f)return B?(f=0<h,0===h&&(h=x-l.y),l=d.viewAnchor,x=d.selectionAnchor,d=Math.min(Math.max(0,d.viewAnchorOffset||0)),h="top"===l?h+Math.floor(f?(1-d)*t:-d*t):"bottom"===l?h+Math.floor(f?d*t:-(1-d)*t):"center"===l?h+Math.floor(f?t/2+d*t:t/2-(1-d)*t):h+Math.floor(f?d*t:-d*t),r!==k&&("top"===x&&p!==g?h+=Math.floor(-A):"bottom"===x&&p!==q?h+=Math.floor(A):"center"===x&&(h+=Math.floor(A/2)))):0!==h&&"number"===typeof d&&(0>d&&(d=0),1<d&&(d=1),h+=Math.floor(0<
h?d*t:-d*t)),this._scrollViewAnimated(a,h,b),t!==this._getClientHeight()||e!==this._getClientWidth()?this._showCaret():this._ensureCaretVisible=!0,!0;b&&b();return!1}},_startIME:function(){if(-1===this._imeOffset){var a=this._getSelection();a.isEmpty()||this._modifyContent({text:"",start:a.start,end:a.end},!0);this._imeOffset=a.start}},_unhookEvents:function(){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);
this._theme.removeEventListener("ThemeChanged",this._themeListener.onChanged);this._modelListener=null;for(var a=0;a<this._handlers.length;a++){var b=this._handlers[a];A(b.target,b.type,b.handler)}this._handlers=null;this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null)},_updateDOMSelection:function(){if(!(0<this._redrawCount)&&!this._ignoreDOMSelection&&this._clientDiv){var a=this._getSelection(),b=this._model,d=b.getLineAtOffset(a.start),f=b.getLineAtOffset(a.end),
e=this._getLineNext();if(e){var h=this._getLinePrevious(),l;d<e.lineIndex?(d=e,l=b.getLineStart(e.lineIndex)):d>h.lineIndex?(d=h,l=b.getLineStart(h.lineIndex)):(d=this._getLineNode(d),l=a.start);f<e.lineIndex?(f=e,b=b.getLineStart(e.lineIndex)):f>h.lineIndex?(f=h,b=b.getLineStart(h.lineIndex)):(f=this._getLineNode(f),b=a.end);this._setDOMSelection(d,l,f,b,a.caret)}}},_update:function(a){if(!(0<this._redrawCount)){this._updateTimer&&(this._getWindow().clearTimeout(this._updateTimer),this._updateTimer=
null,a=!1);var b=this._clientDiv,d=this._viewDiv;if(b){this._metrics.invalid&&(this._ignoreQueueUpdate=!0,this._updateStyle(),this._ignoreQueueUpdate=!1);var e=this._model,h=this._getScroll(!1),l=this._getViewPadding(),p=e.getLineCount(),g=this._getLineHeight(),q=!1,r=!1,k=!1,t=this._metrics.scrollWidth;this._wrapMode&&(b.style.width=(this._metrics.wrapWidth||this._getClientWidth())+"px");var m,s,w,n,v=0,z=0,A;if(this._lineHeight){for(;z<p;){A=this._getLineHeight(z);if(v+A>h.y)break;v+=A;z++}m=z;
s=Math.max(0,m-1);w=e=h.y-v;0<m&&(e+=this._getLineHeight(m-1))}else n=Math.max(0,h.y)/g,m=Math.floor(n),s=Math.max(0,m-1),e=Math.round((n-s)*g),w=Math.round((n-m)*g);this._topIndexY=w;n=this._rootDiv;var B=n.clientWidth,S=n.clientHeight;if(a){g=0;this._leftDiv&&(m=this._leftDiv.getBoundingClientRect(),g=m.right-m.left);m=this._getClientWidth();n=this._getClientHeight();r=m;this._wrapMode?this._metrics.wrapWidth&&(r=this._metrics.wrapWidth):r=Math.max(this._maxLineWidth,r);for(;z<p;)A=this._getLineHeight(z,
!1),v+=A,z++;p=v}else{n=this._getClientHeight();w=Math.min(m+Math.floor((n+w)/g),p-1);var h=Math.min(w+1,p-1),M;for(A=b.firstChild;A;){M=A.lineIndex;var N=A.nextSibling;if(!(s<=M&&M<=h)||A.lineRemoved||-1===A.lineIndex)this._mouseWheelLine===A?(A.style.display="none",A.lineIndex=-1):b.removeChild(A);A=N}A=this._getLineNext();var N=d.ownerDocument,O=N.createDocumentFragment();for(M=s;M<=h;M++)!A||A.lineIndex>M?(new x(this,M)).create(O,null):(O.firstChild&&(b.insertBefore(O,A),O=N.createDocumentFragment()),
A&&A.lineChanged&&(A=(new x(this,M)).create(O,A),A.lineChanged=!1),A=this._getLineNext(A));O.firstChild&&b.insertBefore(O,A);f.isWebkit&&!this._wrapMode&&(b.style.width="0x7fffffffpx");A=this._getLineNext();M=n+e;for(O=!1;A;)s=A.lineWidth,void 0===s&&(N=A._line.getBoundingClientRect(),s=A.lineWidth=Math.ceil(N.right-N.left),N=N.bottom-N.top,this._lineHeight?this._lineHeight[A.lineIndex]=N:0!==g&&(0!==N&&Math.ceil(g)!==Math.ceil(N))&&(this._variableLineHeight=!0,this._lineHeight=[],this._lineHeight[A.lineIndex]=
N)),this._lineHeight&&!O&&(M-=this._lineHeight[A.lineIndex],0>M&&(w=A.lineIndex,O=!0)),this._wrapMode||(s>=this._maxLineWidth&&(this._maxLineWidth=s,this._maxLineIndex=A.lineIndex),this._checkMaxLineIndex===A.lineIndex&&(this._checkMaxLineIndex=-1)),A.lineIndex===m&&(this._topChild=A),A.lineIndex===w&&(this._bottomChild=A),A=this._getLineNext(A);-1!==this._checkMaxLineIndex&&(M=this._checkMaxLineIndex,this._checkMaxLineIndex=-1,0<=M&&M<p&&(g=new x(this,M),N=g.getBoundingClientRect(),s=N.right-N.left,
s>=this._maxLineWidth&&(this._maxLineWidth=s,this._maxLineIndex=M),g.destroy()));for(;z<p;)A=this._getLineHeight(z,z<=w),v+=A,z++;p=v;this._updateRuler(this._leftDiv,m,h,S);this._updateRuler(this._rightDiv,m,h,S);this._updateRuler(this._marginDiv,m,h,S);g=0;this._leftDiv&&(m=this._leftDiv.getBoundingClientRect(),g=m.right-m.left);h=0;this._rightDiv&&(h=this._rightDiv.getBoundingClientRect(),h=h.right-h.left);d.style.left=g+"px";d.style.right=h+"px";h=this._scrollDiv;h.style.height=p+"px";m=this._getClientWidth();
!this._singleMode&&!this._wrapMode&&(v=q=n,(z="scroll"===d.style.overflowX)?q+=t:v-=t,A=w=m,(s="scroll"===d.style.overflowY)?w+=t:A-=t,n=q,m=w,p>n&&(k=!0,m=A),this._maxLineWidth>m&&(r=!0,n=v,p>n&&(k=!0,m=A)),z!==r&&(d.style.overflowX=r?"scroll":"hidden"),s!==k&&(d.style.overflowY=k?"scroll":"hidden"),q=z!==r||s!==k);k=m;this._wrapMode?this._metrics.wrapWidth&&(k=this._metrics.wrapWidth):k=Math.max(this._maxLineWidth,k);r=k;if((!f.isIE||9<=f.isIE)&&this._maxLineWidth>m)k+=l.right+l.left;h.style.width=
k+"px";this._clipScrollDiv&&(this._clipScrollDiv.style.width=k+"px");h=this._getScroll(!1)}this._vScrollDiv&&(k=n-8,v=Math.max(15,Math.ceil(Math.min(1,k/(p+l.top+l.bottom))*k)),this._vScrollDiv.style.left=g+m-8+"px",this._vScrollDiv.style.top=Math.floor(Math.max(0,h.y*k/p))+"px",this._vScrollDiv.style.height=v+"px");!this._wrapMode&&this._hScrollDiv&&(k=m-8,v=Math.max(15,Math.ceil(Math.min(1,k/(this._maxLineWidth+l.left+l.right))*k)),this._hScrollDiv.style.left=g+Math.floor(Math.max(0,Math.floor(h.x*
k/this._maxLineWidth)))+"px",this._hScrollDiv.style.top=n-9+"px",this._hScrollDiv.style.width=v+"px");z=h.x;v=this._clipDiv;k=this._overlayDiv;if(w=this._marginDiv)w.style.left=-z+g+this._metrics.marginWidth+l.left+"px",w.style.bottom=("scroll"===d.style.overflowX?t:0)+"px";v?(v.scrollLeft=z,v.scrollTop=0,d=g+l.left,t=l.top,a=m,g=n,z=0,w=-e,0===h.x&&(d-=l.left,a+=l.left,z=l.left),h.x+m===r&&(a+=l.right),0===h.y&&(t-=l.top,g+=l.top,w+=l.top),h.y+n===p&&(g+=l.bottom),v.style.left=d+"px",v.style.top=
t+"px",v.style.right=B-a-d+"px",v.style.bottom=S-g-t+"px",b.style.left=z+"px",b.style.top=w+"px",b.style.width=r+"px",b.style.height=n+e+"px",k&&(k.style.left=b.style.left,k.style.top=b.style.top,k.style.width=b.style.width,k.style.height=b.style.height)):(d=z,t=e,B=z+m,S=e+n,0===d&&(d-=l.left),0===t&&(t-=l.top),B===r&&(B+=l.right),h.y+n===p&&(S+=l.bottom),b.style.clip="rect("+t+"px,"+B+"px,"+S+"px,"+d+"px)",b.style.left=-z+g+l.left+"px",b.style.width=(this._wrapMode||f.isWebkit?r:m+z)+"px",a||(b.style.top=
-e+l.top+"px",b.style.height=n+e+"px"),k&&(k.style.clip=b.style.clip,k.style.left=b.style.left,k.style.width=b.style.width,a||(k.style.top=b.style.top,k.style.height=b.style.height)));this._updateDOMSelection();q&&(b=this._ensureCaretVisible,this._ensureCaretVisible=!1,b&&this._showCaret(),this._queueUpdate())}}},_updateOverflow:function(){var a=this._viewDiv;this._wrapMode?(a.style.overflowX="hidden",a.style.overflowY="scroll"):a.style.overflow="hidden"},_updateRuler:function(a,d,e,h){if(a){var l=
this._parent.ownerDocument,p=this._getLineHeight(),g=this._getViewPadding();for(a=a.firstChild;a;){var q=a._ruler,r=p,k=q.getOverview();"page"===k&&(r+=this._topIndexY);a.style.top=-r+"px";a.style.height=h+r+"px";a.rulerChanged&&b(q.getRulerStyle(),a);var m,t=a.firstChild;t?(m=t,t=t.nextSibling):(m=f.createElement(l,"div"),m.style.visibility="hidden",a.appendChild(m));var s;if(a.rulerChanged&&m){r=-1;if(s=q.getWidestAnnotation())b(s.style,m),s.html&&(m.innerHTML=s.html);m.lineIndex=r;m.style.height=
p+g.top+"px"}var w;if("page"===k){for(q=q.getAnnotations(d,e+1);t;)r=t.lineIndex,s=t.nextSibling,(!(d<=r&&r<=e)||t.lineChanged)&&a.removeChild(t),t=s;t=a.firstChild.nextSibling;w=l.createDocumentFragment();for(r=d;r<=e;r++)if(!t||t.lineIndex>r){m=f.createElement(l,"div");if(s=q[r])b(s.style,m),s.html&&(m.innerHTML=s.html),m.annotation=s;m.lineIndex=r;m.style.height=this._getLineHeight(r)+"px";w.appendChild(m)}else w.firstChild&&(a.insertBefore(w,t),w=l.createDocumentFragment()),t&&(t=t.nextSibling);
w.firstChild&&a.insertBefore(w,t)}else{s=this._getClientHeight();r=this._model.getLineCount();t=s+g.top+g.bottom-2*this._metrics.scrollWidth;k=p*r<t?p:t/r;if(a.rulerChanged){for(s=a.childNodes.length;1<s;)a.removeChild(a.lastChild),s--;q=q.getAnnotations(0,r);w=l.createDocumentFragment();for(var n in q)r=n>>>0,0>r||(m=f.createElement(l,"div"),s=q[n],b(s.style,m),m.style.position="absolute",m.style.top=this._metrics.scrollWidth+p+Math.floor(r*k)+"px",s.html&&(m.innerHTML=s.html),m.annotation=s,m.lineIndex=
r,w.appendChild(m));a.appendChild(w)}else if(a._oldTrackHeight!==t)for(m=a.firstChild?a.firstChild.nextSibling:null;m;)m.style.top=this._metrics.scrollWidth+p+Math.floor(m.lineIndex*k)+"px",m=m.nextSibling;a._oldTrackHeight=t}a.rulerChanged=!1;a=a.nextSibling}}},_updateStyleSheet:function(){var a="";f.isWebkit&&0<this._metrics.scrollWidth&&(a+="\n.textview ::-webkit-scrollbar-corner {background: #eeeeee;}");f.isFirefox&&(f.isMac&&this._highlightRGB&&"Highlight"!==this._highlightRGB)&&(a+="\n.textview ::-moz-selection {background: "+
this._highlightRGB+";}");if(a){var b=this._clientDiv.ownerDocument,d=b.getElementById("_textviewStyle");if(d)d.removeChild(d.firstChild),d.appendChild(b.createTextNode(a));else{d=f.createElement(b,"style");d.id="_textviewStyle";var e=b.getElementsByTagName("head")[0]||b.documentElement;d.appendChild(b.createTextNode(a));e.insertBefore(d,e.firstChild)}}},_updateStyle:function(a){!a&&f.isIE&&(this._rootDiv.style.lineHeight="normal");var b=this._metrics=this._calculateMetrics();this._variableLineHeight&&
(this._variableLineHeight=!1,this._resetLineHeight());this._rootDiv.style.lineHeight=f.isIE?b.lineHeight-(b.lineTrim.top+b.lineTrim.bottom)+"px":"normal";this._updateStyleSheet();if(f.isMac&&f.isWebkit){var d=this._viewDiv;!b.invalid&&0===b.scrollWidth?(d.style.pointerEvents="none",d.style.zIndex="2"):(d.style.pointerEvents="",d.style.zIndex="")}a||(this.redraw(),this._resetLineWidth())}};e.EventTarget.addMixin(v.prototype);return{TextView:v}});
define("orion/editor/projectionTextModel",["orion/editor/textModel","orion/editor/eventTarget"],function(m,n){function k(e){this._model=e;this._projections=[];var d=this;this._listener={onChanged:function(e){d._onChanged(e)},onChanging:function(e){d._onChanging(e)}};e.addEventListener("postChanged",this._listener.onChanged);e.addEventListener("preChanging",this._listener.onChanging)}k.prototype={destroy:function(){this._model&&(this._model.removeEventListener("postChanged",this._listener.onChanged),
this._model.removeEventListener("preChanging",this._listener.onChanging),this._model=null)},addProjection:function(e){if(e){var d=this._model,g=this._projections;e._lineIndex=d.getLineAtOffset(e.start);e._lineCount=d.getLineAtOffset(e.end)-e._lineIndex;var f=e.text;f||(f="");e._model="string"===typeof f?new m.TextModel(f,d.getLineDelimiter()):f;var d=this.mapOffset(e.start,!0),f=e.end-e.start,b=e._lineCount,a=e._model.getCharCount(),l=e._model.getLineCount()-1,h={type:"Changing",text:e._model.getText(),
start:d,removedCharCount:f,addedCharCount:a,removedLineCount:b,addedLineCount:l};this.onChanging(h);h=this._binarySearch(g,e.start);g.splice(h,0,e);this.onChanged({type:"Changed",start:d,removedCharCount:f,addedCharCount:a,removedLineCount:b,addedLineCount:l})}},getProjections:function(){return this._projections.slice(0)},getBaseModel:function(){return this._model},mapOffset:function(e,d){var g=this._projections,f=0,b,a;if(d){for(b=0;b<g.length;b++){a=g[b];if(a.start>e)break;if(a.end>e)return-1;f+=
a._model.getCharCount()-(a.end-a.start)}return e+f}for(b=0;b<g.length;b++){a=g[b];if(a.start>e-f)break;var l=a._model.getCharCount();if(a.start+l>e-f)return-1;f+=l-(a.end-a.start)}return e-f},removeProjection:function(e){this._removeProjection(e)},_removeProjection:function(e,d){var g,f=0;for(g=0;g<this._projections.length;g++){var b=this._projections[g];if(b===e){e=b;break}f+=b._model.getCharCount()-(b.end-b.start)}if(g<this._projections.length){var b=this._model,f=e.start+f,a=e.end-e.start,l=e._lineCount,
h=e._model.getCharCount(),p=e._model.getLineCount()-1;d||(b={type:"Changing",text:b.getText(e.start,e.end),start:f,removedCharCount:h,addedCharCount:a,removedLineCount:p,addedLineCount:l},this.onChanging(b));this._projections.splice(g,1);if(!d)this.onChanged({type:"Changed",start:f,removedCharCount:h,addedCharCount:a,removedLineCount:p,addedLineCount:l})}},_binarySearch:function(e,d){for(var g=e.length,f=-1,b;1<g-f;)b=Math.floor((g+f)/2),d<=e[b].start?g=b:f=b;return g},getCharCount:function(){for(var e=
this._model.getCharCount(),d=this._projections,g=0;g<d.length;g++)var f=d[g],e=e+(f._model.getCharCount()-(f.end-f.start));return e},getLine:function(e,d){if(0>e)return null;var g=this._model,f=this._projections,b=0,a=[],l=0,h,p,q;for(h=0;h<f.length;h++){q=f[h];if(q._lineIndex>=e-b)break;p=q._model.getLineCount()-1;if(q._lineIndex+p>=e-b){l=e-(q._lineIndex+b);if(l<p)return q._model.getLine(l,d);a.push(q._model.getLine(p))}l=q.end;b+=p-q._lineCount}for(l=Math.max(l,g.getLineStart(e-b));h<f.length;h++){q=
f[h];if(q._lineIndex>e-b)break;a.push(g.getText(l,q.start));p=q._model.getLineCount()-1;if(q._lineIndex+p>e-b)return a.push(q._model.getLine(0,d)),a.join("");a.push(q._model.getText());l=q.end;b+=p-q._lineCount}f=g.getLineEnd(e-b,d);l<f&&a.push(g.getText(l,f));return a.join("")},getLineAtOffset:function(e){for(var d=this._model,g=this._projections,f=0,b=0,a=0;a<g.length;a++){var l=g[a];if(l.start>e-f)break;var h=l._model.getCharCount();if(l.start+h>e-f){g=e-(l.start+f);b+=l._model.getLineAtOffset(g);
f+=g;break}b+=l._model.getLineCount()-1-l._lineCount;f+=h-(l.end-l.start)}return d.getLineAtOffset(e-f)+b},getLineCount:function(){for(var e=this._projections,d=this._model.getLineCount(),g=0;g<e.length;g++)var f=e[g],d=d+(f._model.getLineCount()-1-f._lineCount);return d},getLineDelimiter:function(){return this._model.getLineDelimiter()},getLineEnd:function(e,d){if(0>e)return-1;for(var g=this._model,f=this._projections,b=0,a=0,l=0;l<f.length;l++){var h=f[l];if(h._lineIndex>e-b)break;var p=h._model.getLineCount()-
1;if(h._lineIndex+p>e-b)return h._model.getLineEnd(e-(h._lineIndex+b),d)+h.start+a;a+=h._model.getCharCount()-(h.end-h.start);b+=p-h._lineCount}return g.getLineEnd(e-b,d)+a},getLineStart:function(e){if(0>e)return-1;for(var d=this._model,g=this._projections,f=0,b=0,a=0;a<g.length;a++){var l=g[a];if(l._lineIndex>=e-f)break;var h=l._model.getLineCount()-1;if(l._lineIndex+h>=e-f)return l._model.getLineStart(e-(l._lineIndex+f))+l.start+b;b+=l._model.getCharCount()-(l.end-l.start);f+=h-l._lineCount}return d.getLineStart(e-
f)+b},getText:function(e,d){void 0===e&&(e=0);var g=this._model,f=this._projections,b=0,a=[],l,h,p;for(l=0;l<f.length;l++){h=f[l];if(h.start>e-b)break;p=h._model.getCharCount();if(h.start+p>e-b){if(void 0!==d&&h.start+p>d-b)return h._model.getText(e-(h.start+b),d-(h.start+b));a.push(h._model.getText(e-(h.start+b)));e=h.end+b+p-(h.end-h.start)}b+=p-(h.end-h.start)}var q=e-b;if(void 0!==d){for(;l<f.length;l++){h=f[l];if(h.start>d-b)break;a.push(g.getText(q,h.start));p=h._model.getCharCount();if(h.start+
p>d-b)return a.push(h._model.getText(0,d-(h.start+b))),a.join("");a.push(h._model.getText());q=h.end;b+=p-(h.end-h.start)}a.push(g.getText(q,d-b))}else{for(;l<f.length;l++)h=f[l],a.push(g.getText(q,h.start)),a.push(h._model.getText()),q=h.end;a.push(g.getText(q))}return a.join("")},_onChanged:function(e){e=this._change;var d=e.baseStart,g=e.baseEnd,f,b,a=this._projections;for(f=0;f<a.length&&!(b=a[f],b.end>d);f++);var l=f;for(f=0;f<a.length&&!(b=a[f],b.start>=g);f++);var h=f,p=this._model,d=e.baseText.length-
(g-d);for(f=h;f<a.length;f++)b=a[f],b.start+=d,b.end+=d,b._lineIndex=p.getLineAtOffset(b.start);b=a.splice(l,h-l);for(f=0;f<b.length;f++)b[f].annotation&&b[f].annotation._expand();this.onChanged({type:"Changed",start:e.start,removedCharCount:e.removedCharCount,addedCharCount:e.addedCharCount,removedLineCount:e.removedLineCount,addedLineCount:e.addedLineCount});this._change=void 0},_onChanging:function(e){var d=!!this._change,g=this._change||{},f=e.start,b=f+e.removedCharCount;g.baseStart=f;g.baseEnd=
b;g.baseText=e.text;g.addedLineCount=e.addedLineCount;if(!d){this._change=g;g.text=e.text;var a=this._projections,l,h,p;e=function(b){for(l=h=0;h<a.length;h++){p=a[h];if(p.start>b)break;if(p.end>b)return-1;l+=p._model.getCharCount()-(p.end-p.start)}return b+l};g.start=e(f);-1===g.start&&(g.text=this._model.getText(p.start,f)+g.text,g.addedLineCount+=this._model.getLineAtOffset(f)-this._model.getLineAtOffset(p.start),g.start=p.start+l);g.end=e(b);-1===g.end&&(g.text+=this._model.getText(b,p.end),g.addedLineCount+=
this._model.getLineAtOffset(p.end)-this._model.getLineAtOffset(b),g.end=p.start+l)}g.addedCharCount=g.text.length;g.removedCharCount=g.end-g.start;g.removedLineCount=this.getLineAtOffset(g.end)-this.getLineAtOffset(g.start);this.onChanging({type:"Changing",text:g.text,start:g.start,removedCharCount:g.removedCharCount,addedCharCount:g.addedCharCount,removedLineCount:g.removedLineCount,addedLineCount:g.addedLineCount})},onChanging:function(e){return this.dispatchEvent(e)},onChanged:function(e){return this.dispatchEvent(e)},
setLineDelimiter:function(e){this._model.setLineDelimiter(e)},setText:function(e,d,g){function f(d){for(a=l=0;l<b.length;l++){h=b[l];if(h.start>d-a)break;var f=h._model.getCharCount();if(h.start+f>d-a)return-1;a+=f-(h.end-h.start)}return d-a}this._change={text:e||"",start:d||0,end:void 0===g?this.getCharCount():g};var b=this._projections,a,l,h,p,q;e=f(this._change.start);-1===e&&(p={projection:h,start:this._change.start-(h.start+a)},e=h.end);d=f(this._change.end);-1===d&&(q={projection:h,end:this._change.end-
(h.start+a)},d=h.start);p&&q&&p.projection===q.projection?h._model.setText(this._change.text,p.start,q.end):(this._model.setText(this._change.text,e,d),p&&(h=p.projection,h._model.setText("",p.start)),q&&(h=q.projection,h._model.setText("",0,q.end),h.start=h.end,h._lineCount=0));this._change=void 0}};n.EventTarget.addMixin(k.prototype);return{ProjectionTextModel:k}});
define("orion/editor/tooltip","i18n!orion/editor/nls/messages orion/editor/textView orion/editor/textModel orion/editor/projectionTextModel orion/editor/util orion/util".split(" "),function(m,n,k,e,d,g){function f(b){this._view=b;this._fadeDelay=500;this._hideDelay=200;this._showDelay=500;this._autoHideDelay=5E3;this._create(b.getOptions("parent").ownerDocument)}f.getTooltip=function(b){b._tooltip||(b._tooltip=new f(b));return b._tooltip};f.prototype={_create:function(b){if(!this._tooltipDiv){var a=
this._tooltipDiv=g.createElement(b,"div");a.tabIndex=0;a.className="textviewTooltip";a.setAttribute("aria-live","assertive");a.setAttribute("aria-atomic","true");var f=this._tooltipContents=g.createElement(b,"div");a.appendChild(f);b.body.appendChild(a);var e=this;d.addEventListener(a,"mouseover",function(a){e._hideDelay&&(a=e._getWindow(),e._delayedHideTimeout&&(a.clearTimeout(e._delayedHideTimeout),e._delayedHideTimeout=null),e._hideTimeout&&(a.clearTimeout(e._hideTimeout),e._hideTimeout=null),
e._nextTarget=null)},!1);d.addEventListener(a,"mouseout",function(b){b=b.relatedTarget||b.toElement;!(b===a||e._hasFocus())&&(!b||!d.contains(a,b))&&e._hide()},!1);d.addEventListener(a,"keydown",function(a){27===a.keyCode&&e._hide()},!1);d.addEventListener(b,"mousedown",this._mouseDownHandler=function(b){e.isVisible()&&(d.contains(a,b.target||b.srcElement)||e._hide())},!0);this._view.addEventListener("Destroy",function(){e.destroy()});this._hide()}},_getWindow:function(){var b=this._tooltipDiv.ownerDocument;
return b.defaultView||b.parentWindow},destroy:function(){if(this._tooltipDiv){this._hide();var b=this._tooltipDiv.parentNode;b&&b.removeChild(this._tooltipDiv);d.removeEventListener(this._tooltipDiv.ownerDocument,"mousedown",this._mouseDownHandler,!0);this._tooltipDiv=null}},_hasFocus:function(){var b=this._tooltipDiv;return!b?!1:d.contains(b,b.ownerDocument.activeElement)},hide:function(b){void 0===b&&(b=this._hideDelay);var a=this._getWindow();this._delayedHideTimeout&&(a.clearTimeout(this._delayedHideTimeout),
this._delayedHideTimeout=null);var d=this;b?d._delayedHideTimeout=a.setTimeout(function(){d._delayedHideTimeout=null;d._hide();d.setTarget(d._nextTarget,0)},b):(d._hide(),d.setTarget(d._nextTarget,0))},_hide:function(){var b=this._tooltipDiv;b&&(this._hasFocus()&&this._view.focus(),this._contentsView&&(this._contentsView.destroy(),this._contentsView=null),this._tooltipContents&&(this._tooltipContents.innerHTML=""),b.style.visibility="hidden",b=this._getWindow(),this._showTimeout&&(b.clearTimeout(this._showTimeout),
this._showTimeout=null),this._delayedHideTimeout&&(b.clearTimeout(this._delayedHideTimeout),this._delayedHideTimeout=null),this._hideTimeout&&(b.clearTimeout(this._hideTimeout),this._hideTimeout=null),this._fadeTimeout&&(b.clearInterval(this._fadeTimeout),this._fadeTimeout=null))},isVisible:function(){return this._tooltipDiv&&"visible"===this._tooltipDiv.style.visibility},setTarget:function(b,a,d){if(this.isVisible())this._hasFocus()||(this._nextTarget=b,this.hide(d));else if(this._target=b){var e=
this;b=e._getWindow();e._showTimeout&&(b.clearTimeout(e._showTimeout),e._showTimeout=null);0===a?e.show(!0):e._showTimeout=b.setTimeout(function(){e._showTimeout=null;e.show(!0)},a?a:e._showDelay)}},show:function(b){if(this._target){var a=this._target.getTooltipInfo();if(a){var d=this._tooltipDiv,f=this._tooltipContents;d.style.left=d.style.right=d.style.width=d.style.height=f.style.width=f.style.height="auto";var p=a.contents;p instanceof Array&&(p=this._getAnnotationContents(p));if("string"===typeof p)f.innerHTML=
p;else if(this._isNode(p))f.appendChild(p);else if(p instanceof e.ProjectionTextModel){var g=this._view,r=g.getOptions();r.wrapMode=!1;r.parent=f;var k=r.themeClass;k?((k=k.replace("tooltipTheme",""))&&(k=" "+k),k="tooltipTheme"+k):k="tooltipTheme";r.themeClass=k;r=this._contentsView=new n.TextView(r);r.addEventListener("LineStyle",function(a){g.onLineStyle(a)});r.setModel(p);p=r.computeSize();f.style.width=p.width+"px";f.style.height=p.height+"px";r.resize()}else return;f=d.ownerDocument.documentElement;
"right"===a.anchor?(p=f.clientWidth-a.x,d.style.right=p+"px"):(p=parseInt(this._getNodeStyle(d,"padding-left","0"),10),p+=parseInt(this._getNodeStyle(d,"border-left-width","0"),10),p=a.x-p,d.style.left=p+"px");d.style.maxWidth=f.clientWidth-p-10+"px";p=parseInt(this._getNodeStyle(d,"padding-top","0"),10);p+=parseInt(this._getNodeStyle(d,"border-top-width","0"),10);p=a.y-p;d.style.top=p+"px";d.style.maxHeight=f.clientHeight-p-10+"px";d.style.opacity="1";d.style.visibility="visible";if(b){var m=this,
s=this._getWindow();m._hideTimeout=s.setTimeout(function(){m._hideTimeout=null;var a=parseFloat(m._getNodeStyle(d,"opacity","1"));m._fadeTimeout=s.setInterval(function(){"visible"===d.style.visibility&&0<a?(a-=0.1,d.style.opacity=a):m._hide()},m._fadeDelay/10)},m._autoHideDelay)}}}},_getAnnotationContents:function(b){function a(a,b){var d=n.getLineStart(n.getLineAtOffset(a)),e=n.getLineEnd(n.getLineAtOffset(b),!0);return n.getText(d,e)}function f(b){var e=b.title,h=g.createElement(k,"div");h.className=
"tooltipRow";b.html&&(h.innerHTML=b.html,h.lastChild&&d.addEventListener(h.lastChild,"click",function(a){a=b.start;var d=b.end;s.getBaseModel&&(a=s.mapOffset(a,!0),d=s.mapOffset(d,!0));w.setSelection(a,d,1/3,function(){r._hide()})},!1),h.appendChild(k.createTextNode("\u00a0")));e||(e=a(b.start,b.end));"function"===typeof e&&(e=b.title());if("string"===typeof e){var l=g.createElement(k,"span");l.appendChild(k.createTextNode(e));e=l}h.appendChild(e);return h}for(var h,p=[],q=0;q<b.length;q++)h=b[q],
""!==h.title&&!h.groupAnnotation&&p.push(h);b=p;if(0===b.length)return null;var r=this,k=this._tooltipDiv.ownerDocument,w=this._view,s=w.getModel(),n=s.getBaseModel?s.getBaseModel():s;if(1===b.length){h=b[0];if(void 0!==h.title)return h=f(h),h.firstChild&&((b=h.firstChild.className)&&(b+=" "),h.firstChild.className=b+"single"),h;b=new e.ProjectionTextModel(n);p=n.getLineStart(n.getLineAtOffset(h.start));q=n.getCharCount();h.end!==q&&b.addProjection({start:h.end,end:q});0<p&&b.addProjection({start:0,
end:p});return b}p=g.createElement(k,"div");h=g.createElement(k,"em");h.appendChild(k.createTextNode(m.multipleAnnotations));p.appendChild(h);for(q=0;q<b.length;q++)h=b[q],(h=f(h))&&p.appendChild(h);return p},_getNodeStyle:function(b,a,d){var e;if(b&&(e=b.style[a],!e))if(b.currentStyle){for(e=0;-1!==(e=a.indexOf("-",e));)a=a.substring(0,e)+a.substring(e+1,e+2).toUpperCase()+a.substring(e+2);e=b.currentStyle[a]}else e=(b=b.ownerDocument.defaultView.getComputedStyle(b,null))?b.getPropertyValue(a):null;
return e||d},_isNode:function(b){return"object"===typeof Node?b instanceof Node:b&&"object"===typeof b&&"number"===typeof b.nodeType&&"string"===typeof b.nodeName}};return{Tooltip:f}});
define("orion/editor/annotations",["i18n!orion/editor/nls/messages","orion/editor/eventTarget"],function(m,n){function k(){}function e(a,b,d){this.start=a;this.end=b;this._projectionModel=d;this.html=this._expandedHTML;this.style=this._expandedStyle;this.expanded=!0}function d(a,b){var d=a.lastIndexOf("."),d=a.substring(d+1),e={title:m[d],style:{styleClass:"annotation "+d},html:"\x3cdiv class\x3d'annotationHTML "+d+"'\x3e\x3c/div\x3e",overviewStyle:{styleClass:"annotationOverview "+d}};b?e.lineStyle=
{styleClass:"annotationLine "+d}:e.rangeStyle={styleClass:"annotationRange "+d};k.registerType(a,e)}function g(){}function f(a,b,d,e,f){var l;void 0===e&&(e=-1);void 0===f&&(f=a.length);for(;1<f-e;)if(l=Math.floor((f+e)/2),b<=a[l].start)f=l;else if(d&&b<a[l].end){f=l;break}else e=l;return f}function b(a){this._annotations=[];var b=this;this._listener={onChanged:function(a){b._onChanged(a)}};this.setTextModel(a)}function a(a,b){this._view=a;this._annotationModel=b;var d=this;this._listener={onDestroy:function(a){d._onDestroy(a)},
onLineStyle:function(a){d._onLineStyle(a)},onChanged:function(a){d._onAnnotationModelChanged(a)}};a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("postLineStyle",this._listener.onLineStyle);b.addEventListener("Changed",this._listener.onChanged)}e.prototype={_expandedHTML:"\x3cdiv class\x3d'annotationHTML expanded'\x3e\x3c/div\x3e",_expandedStyle:{styleClass:"annotation expanded"},_collapsedHTML:"\x3cdiv class\x3d'annotationHTML collapsed'\x3e\x3c/div\x3e",_collapsedStyle:{styleClass:"annotation collapsed"},
_collapse:function(){if(!this.expanded)return!1;this.expanded=!1;this.html=this._collapsedHTML;this.style=this._collapsedStyle;this._annotationModel&&this._annotationModel.modifyAnnotation(this);return!0},_expand:function(){if(this.expanded)return!1;this.expanded=!0;this.html=this._expandedHTML;this.style=this._expandedStyle;this._annotationModel&&this._annotationModel.modifyAnnotation(this);return!0},_collapseImpl:function(a){if(this._collapse()){a&&this._forEachOverlaping(function(a){a.expanded||
(a._expandImpl(!1),a._recollapse=!0)});a=this._projectionModel;var b=a.getBaseModel();this._projection={annotation:this,start:b.getLineStart(b.getLineAtOffset(this.start)+1),end:b.getLineEnd(b.getLineAtOffset(this.end),!0)};a.addProjection(this._projection)}},_expandImpl:function(a){this._expand()&&(this._projectionModel._removeProjection(this._projection,!this._annotationModel),a&&this._forEachOverlaping(function(a){a._recollapse&&(a._collapseImpl(!1),a._recollapse=!1)}))},_forEachOverlaping:function(a){if(this._annotationModel)for(var b=
this._annotationModel.getAnnotations(this.start,this.end);b.hasNext();){var d=b.next();d!==this&&d.type===k.ANNOTATION_FOLDING&&a.call(this,d)}},collapse:function(){this._recollapse=!1;this._collapseImpl(!0)},expand:function(){this._recollapse=!1;this._expandImpl(!0)}};k.ANNOTATION_ERROR="orion.annotation.error";k.ANNOTATION_WARNING="orion.annotation.warning";k.ANNOTATION_TASK="orion.annotation.task";k.ANNOTATION_BREAKPOINT="orion.annotation.breakpoint";k.ANNOTATION_BOOKMARK="orion.annotation.bookmark";
k.ANNOTATION_FOLDING="orion.annotation.folding";k.ANNOTATION_CURRENT_BRACKET="orion.annotation.currentBracket";k.ANNOTATION_MATCHING_BRACKET="orion.annotation.matchingBracket";k.ANNOTATION_CURRENT_LINE="orion.annotation.currentLine";k.ANNOTATION_CURRENT_SEARCH="orion.annotation.currentSearch";k.ANNOTATION_MATCHING_SEARCH="orion.annotation.matchingSearch";k.ANNOTATION_READ_OCCURRENCE="orion.annotation.readOccurrence";k.ANNOTATION_WRITE_OCCURRENCE="orion.annotation.writeOccurrence";k.ANNOTATION_SELECTED_LINKED_GROUP=
"orion.annotation.selectedLinkedGroup";k.ANNOTATION_CURRENT_LINKED_GROUP="orion.annotation.currentLinkedGroup";k.ANNOTATION_LINKED_GROUP="orion.annotation.linkedGroup";k.ANNOTATION_BLAME="orion.annotation.blame";k.ANNOTATION_CURRENT_BLAME="orion.annotation.currentBlame";var l={};k.registerType=function(a,b){var d=b;"function"!==typeof d&&(d=function(a,b,d){this.start=a;this.end=b;void 0!==d&&(this.title=d)},d.prototype=b);d.prototype.type=a;l[a]=d;return a};k.createAnnotation=function(a,b,d,e){return new (this.getType(a))(b,
d,e)};k.getType=function(a){return l[a]};d(k.ANNOTATION_ERROR);d(k.ANNOTATION_WARNING);d(k.ANNOTATION_TASK);d(k.ANNOTATION_BREAKPOINT);d(k.ANNOTATION_BOOKMARK);d(k.ANNOTATION_CURRENT_BRACKET);d(k.ANNOTATION_MATCHING_BRACKET);d(k.ANNOTATION_CURRENT_SEARCH);d(k.ANNOTATION_MATCHING_SEARCH);d(k.ANNOTATION_READ_OCCURRENCE);d(k.ANNOTATION_WRITE_OCCURRENCE);d(k.ANNOTATION_SELECTED_LINKED_GROUP);d(k.ANNOTATION_CURRENT_LINKED_GROUP);d(k.ANNOTATION_LINKED_GROUP);d(k.ANNOTATION_CURRENT_LINE,!0);d(k.ANNOTATION_BLAME,
!0);d(k.ANNOTATION_CURRENT_BLAME,!0);k.registerType(k.ANNOTATION_FOLDING,e);g.addMixin=function(a){var b=g.prototype,d;for(d in b)b.hasOwnProperty(d)&&(a[d]=b[d])};g.prototype={addAnnotationType:function(a,b){this._annotationTypes||(this._annotationTypes=[]);var d=b-1;void 0==b||!(0<=d&&d<this._annotationTypes.length)?this._annotationTypes.push(a):this._annotationTypes.splice(d,0,a)},getAnnotationTypePriority:function(a){if(this._annotationTypes)for(var b=0;b<this._annotationTypes.length;b++)if(this._annotationTypes[b]===
a)return b+1;return 0},getAnnotationsByType:function(a,b,d){a=a.getAnnotations(b,d);for(d=[];a.hasNext();)b=a.next(),0!==this.getAnnotationTypePriority(b.type)&&d.push(b);var e=this;d.sort(function(a,b){return e.getAnnotationTypePriority(a.type)-e.getAnnotationTypePriority(b.type)});return d},isAnnotationTypeVisible:function(a){return 0!==this.getAnnotationTypePriority(a)},removeAnnotationType:function(a){if(this._annotationTypes)for(var b=0;b<this._annotationTypes.length;b++)if(this._annotationTypes[b]===
a){this._annotationTypes.splice(b,1);break}}};b.prototype={addAnnotation:function(a){if(a){var b=this._annotations,d=f(b,a.start);b.splice(d,0,a);a._annotationModel=this;this.onChanged({type:"Changed",added:[a],removed:[],changed:[]})}},getTextModel:function(){return this._model},getAnnotations:function(a,b){var d=this._annotations,e,f=0,l;l=void 0===a&&void 0===b?function(){return f<d.length?d[f++]:null}:function(){for(;f<d.length;){var e=d[f++];if(a===e.start||(a>e.start?a<e.end:e.start<b))return e;
if(e.start>=b)break}return null};e=l();return{next:function(){var a=e;a&&(e=l());return a},hasNext:function(){return null!==e}}},modifyAnnotation:function(a){if(a&&!(0>this._getAnnotationIndex(a)))this.onChanged({type:"Changed",added:[],removed:[],changed:[a]})},onChanged:function(a){return this.dispatchEvent(a)},removeAnnotations:function(a){var b=this._annotations,d,e;if(a){d=[];for(e=b.length-1;0<=e;e--){var f=b[e];f.type===a&&(b.splice(e,1),d.splice(0,0,f),f._annotationModel=null)}}else d=b;this.onChanged({type:"Changed",
removed:d,added:[],changed:[]})},removeAnnotation:function(a){if(a){var b=this._getAnnotationIndex(a);0>b||(a._annotationModel=null,a={type:"Changed",removed:this._annotations.splice(b,1),added:[],changed:[]},this.onChanged(a))}},replaceAnnotations:function(a,b){var d=this._annotations,e,l,g,k=[];if(a)for(e=a.length-1;0<=e;e--)g=a[e],l=this._getAnnotationIndex(g),0>l||(g._annotationModel=null,d.splice(l,1),k.splice(0,0,g));b||(b=[]);for(e=0;e<b.length;e++)g=b[e],l=f(d,g.start),g._annotationModel=
this,d.splice(l,0,g);this.onChanged({type:"Changed",removed:k,added:b,changed:[]})},setTextModel:function(a){this._model&&this._model.removeEventListener("Changed",this._listener.onChanged);(this._model=a)&&this._model.addEventListener("Changed",this._listener.onChanged)},_getAnnotationIndex:function(a){for(var b=this._annotations,d=f(b,a.start);d<b.length&&b[d].start===a.start;){if(b[d]===a)return d;d++}return-1},_onChanged:function(a){var b=a.start,d=a.addedCharCount,e=a.removedCharCount,f=this._annotations,
l=b+e;if(0<f.length){a={type:"Changed",added:[],removed:[],changed:[],textModelChangedEvent:a};d-=e;for(e=0;e<f.length;e++){var g=f[e];g.start>=l?(g._oldStart=g.start,g._oldEnd=g.end,g.start+=d,g.end+=d,a.changed.push(g)):g.end<=b||(g.start<b&&l<g.end?(g._oldStart=g.start,g._oldEnd=g.end,g.end+=d,a.changed.push(g)):(f.splice(e,1),a.removed.push(g),g._annotationModel=null,g.expand&&g.expand(),e--))}if(0<a.added.length||0<a.removed.length||0<a.changed.length)this.onChanged(a)}}};n.EventTarget.addMixin(b.prototype);
a.prototype={destroy:function(){var a=this._view;a&&(a.removeEventListener("Destroy",this._listener.onDestroy),a.removeEventListener("LineStyle",this._listener.onLineStyle),this.view=null);(a=this._annotationModel)&&a.removeEventListener("Changed",this._listener.onChanged)},_mergeStyle:function(a,b){if(b){a||(a={});a.styleClass=a.styleClass&&b.styleClass&&a.styleClass!==b.styleClass?a.styleClass+(" "+b.styleClass):b.styleClass;var d;b.tagName&&!a.tagName&&(a.tagName=b.tagName);if(b.style)for(d in a.style||
(a.style={}),b.style)a.style[d]||(a.style[d]=b.style[d]);if(b.attributes)for(d in a.attributes||(a.attributes={}),b.attributes)a.attributes[d]||(a.attributes[d]=b.attributes[d])}return a},_mergeStyleRanges:function(a,b){a||(a=[]);for(var d,e=f(a,b.start,!0);e<a.length&&b;e++){var l=a[e];if(b.end<=l.start)break;if(!(b.start>=l.end)){d=this._mergeStyle({},l.style);d=this._mergeStyle(d,b.style);var g=[];g.push(e,1);b.start<l.start&&g.push({start:b.start,end:l.start,style:b.style});b.start>l.start&&g.push({start:l.start,
end:b.start,style:l.style});g.push({start:Math.max(l.start,b.start),end:Math.min(l.end,b.end),style:d});b.end<l.end&&g.push({start:b.end,end:l.end,style:l.style});b=b.end>l.end?{start:l.end,end:b.end,style:b.style}:null;Array.prototype.splice.apply(a,g)}}b&&(d=this._mergeStyle({},b.style),a.splice(e,0,{start:b.start,end:b.end,style:d}));return a},_onAnnotationModelChanged:function(a){function b(a,d){l.getBaseModel&&(a=l.mapOffset(a,!0),d=l.mapOffset(d,!0));-1!==a&&-1!==d&&e.redrawRange(a,d)}function d(a,
e){for(var h=0;h<a.length;h++)if(f.isAnnotationTypeVisible(a[h].type)){var l=a[h];b(l.start,l.end);e&&(void 0!==l._oldStart&&l._oldEnd)&&b(l._oldStart,l._oldEnd)}}var e=this._view;if(e){var f=this,l=e.getModel();d(a.added);d(a.removed);d(a.changed,!0)}},_onDestroy:function(a){this.destroy()},_onLineStyle:function(a){var b=this._annotationModel,d=a.textView.getModel(),e=b.getTextModel(),f=a.lineStart,l=a.lineStart+a.lineText.length;e!==d&&(f=d.mapOffset(f),l=d.mapOffset(l));for(b=b.getAnnotations(f,
l);b.hasNext();)if(f=b.next(),this.isAnnotationTypeVisible(f.type)){if(f.rangeStyle){var l=f.start,g=f.end;e!==d&&(l=d.mapOffset(l,!0),g=d.mapOffset(g,!0));a.ranges=this._mergeStyleRanges(a.ranges,{start:l,end:g,style:f.rangeStyle})}f.lineStyle&&(a.style=this._mergeStyle({},a.style),a.style=this._mergeStyle(a.style,f.lineStyle))}}};g.addMixin(a.prototype);return{FoldingAnnotation:e,AnnotationType:k,AnnotationTypeList:g,AnnotationModel:b,AnnotationStyler:a}});
define("orion/editor/editor","i18n!orion/editor/nls/messages orion/editor/eventTarget orion/editor/tooltip orion/editor/annotations orion/objects orion/util".split(" "),function(m,n,k,e,d,g){function f(a){a=a||{};this._domNode=a.domNode;this._model=a.model;this._undoStack=a.undoStack;this._statusReporter=a.statusReporter;this._title=null;var b=this;this._listener={onChanged:function(a){b.onChanged(a)}};this._model&&this._model.addEventListener("Changed",this._listener.onChanged);this.checkDirty()}
function b(a){a=a||{};f.call(this,a);this._textViewFactory=a.textViewFactory;this._undoStackFactory=a.undoStackFactory;this._textDNDFactory=a.textDNDFactory;this._annotationFactory=a.annotationFactory;this._foldingRulerFactory=a.foldingRulerFactory;this._lineNumberRulerFactory=a.lineNumberRulerFactory;this._contentAssistFactory=a.contentAssistFactory;this._keyBindingFactory=a.keyBindingFactory;this._contentAssist=this._foldingRuler=this._overviewRuler=this._lineNumberRuler=this._annotationRuler=this._annotationModel=
this._annotationStyler=null}var a=e.AnnotationType;f.prototype={destroy:function(){this.uninstall();this._statusReporter=this._domNode=null;this._model&&this._model.removeEventListener("Changed",this._listener.onChanged)},checkDirty:function(){this.setDirty(this._undoStack&&!this._undoStack.isClean())},focus:function(){},getModel:function(){return this._model},getText:function(a,b){return this.getModel().getText(a,b)},getTitle:function(){return this._title},getUndoStack:function(){return this._undoStack},
install:function(){this.installed=!0},isDirty:function(){return this._dirty},markClean:function(){this.getUndoStack().markClean();this.setDirty(!1)},onDirtyChanged:function(a){return this.dispatchEvent(a)},onInputChanged:function(a){return this.dispatchEvent(a)},onChanged:function(a){this.checkDirty()},reportStatus:function(a,b,d){this._statusReporter&&this._statusReporter(a,b,d)},resize:function(){},setDirty:function(a){this._dirty!==a&&(this._dirty=a,this.onDirtyChanged({type:"DirtyChanged"}))},
_setModelText:function(a){this._model&&this._model.setText(a)},setInput:function(a,b,d,e){this._title=a;e||(b?this.reportStatus(b,"error"):null!==d&&(void 0!==d&&"string"===typeof d)&&this._setModelText(d),this._undoStack&&this._undoStack.reset());this.checkDirty();this.onInputChanged({type:"InputChanged",title:a,message:b,contents:d,contentsSaved:e})},setText:function(a,b,d){this.getModel().setText(a,b,d)},uninstall:function(){this.installed=!1}};n.EventTarget.addMixin(f.prototype);b.prototype=new f;
d.mixin(b.prototype,{destroy:function(){f.prototype.destroy.call(this);this._textViewFactory=this._undoStackFactory=this._textDNDFactory=this._annotationFactory=this._foldingRulerFactory=this._lineNumberRulerFactory=this._contentAssistFactory=this._keyBindingFactory=null},getAnnotationModel:function(){return this._annotationModel},getAnnotationRuler:function(){return this._annotationRuler},getAnnotationStyler:function(){return this._annotationStyler},getContentAssist:function(){return this._contentAssist},
getFoldingRuler:function(){return this._foldingRuler},getLineNumberRuler:function(){return this._lineNumberRuler},getModel:function(){if(!this._textView)return null;var a=this._textView.getModel();a.getBaseModel&&(a=a.getBaseModel());return a},getOverviewRuler:function(){return this._overviewRuler},getTextView:function(){return this._textView},getKeyModes:function(){return this._textView.getKeyModes()},getSourceCodeActions:function(){return this._sourceCodeActions},getLinkedMode:function(){return this._linkedMode},
getTextActions:function(){return this._textActions},focus:function(){this._textView&&this._textView.focus()},resize:function(){this._textView&&this._textView.resize()},setAnnotationRulerVisible:function(a,b){if(this._annotationRulerVisible!==a||b)if(this._annotationRulerVisible=a,this._annotationRuler){var d=this._textView;a?d.addRuler(this._annotationRuler,0):d.removeRuler(this._annotationRuler)}},setFoldingRulerVisible:function(a,b){if(this._foldingRulerVisible!==a||b)if(this._foldingRulerVisible=
a,this._foldingRuler){var d=this._textView;d.getModel().getBaseModel&&(a?d.addRuler(this._foldingRuler):d.removeRuler(this._foldingRuler))}},setLineNumberRulerVisible:function(a,b){if(this._lineNumberRulerVisible!==a||b)if(this._lineNumberRulerVisible=a,this._lineNumberRuler){var d=this._textView;a?d.addRuler(this._lineNumberRuler,!this._annotationRulerVisible?0:1):d.removeRuler(this._lineNumberRuler)}},setOverviewRulerVisible:function(a,b){if(this._overviewRulerVisible!==a||b)if(this._overviewRulerVisible=
a,this._overviewRuler){var d=this._textView;a?d.addRuler(this._overviewRuler):d.removeRuler(this._overviewRuler)}},mapOffset:function(a,b){var d=this._textView.getModel();d.getBaseModel&&(a=d.mapOffset(a,b));return a},getLineAtOffset:function(a){return this.getModel().getLineAtOffset(this.mapOffset(a))},getLineStart:function(a){return this.getModel().getLineStart(a)},getCaretOffset:function(){return this.mapOffset(this._textView.getCaretOffset())},getSelection:function(){var a=this._textView,b=a.getSelection(),
a=a.getModel();a.getBaseModel&&(b.start=a.mapOffset(b.start),b.end=a.mapOffset(b.end));return b},_expandOffset:function(b){var d=this._textView.getModel(),e=this._annotationModel;if(e&&d.getBaseModel)for(b=e.getAnnotations(b,b+1);b.hasNext();)d=b.next(),d.type===a.ANNOTATION_FOLDING&&d.expand&&d.expand()},setCaretOffset:function(a,b,d){var e=this._textView,f=e.getModel();f.getBaseModel&&(this._expandOffset(a),a=f.mapOffset(a,!0));e.setCaretOffset(a,b,d)},setText:function(a,b,d){var e=this._textView,
f=e.getModel();f.getBaseModel&&(void 0!==b&&(this._expandOffset(b),b=f.mapOffset(b,!0)),void 0!==d&&(this._expandOffset(d),d=f.mapOffset(d,!0)));e.setText(a,b,d)},setSelection:function(a,b,d,e){var f=this._textView,g=f.getModel();g.getBaseModel&&(this._expandOffset(a),this._expandOffset(b),a=g.mapOffset(a,!0),b=g.mapOffset(b,!0));f.setSelection(a,b,d,e)},moveSelection:function(a,b,d,e){var f=this._textView;this.setSelection(a,b||a,1/3,function(){(void 0===e||e)&&f.focus();d&&d()})},_getTooltipInfo:function(a,
b){var d=this._textView,e=this.getAnnotationModel();if(!e)return null;var f=this._annotationStyler;if(!f)return null;var g=d.getOffsetAtLocation(a,b);if(-1===g)return null;g=this.mapOffset(g);f=f.getAnnotationsByType(e,g,g+1);e=[];for(g=0;g<f.length;g++)f[g].rangeStyle&&e.push(f[g]);if(0===e.length)return null;d=d.convert({x:a,y:b},"document","page");return{contents:e,anchor:"left",x:d.x+10,y:d.y+20}},_highlightCurrentLine:function(b,d){var e=this._annotationModel;if(e){var f=this._textView;if(!f.getOptions("singleMode")){var g=
f.getModel(),k=d?g.getLineAtOffset(d.start):-1,m=g.getLineAtOffset(b.start),f=b.start===b.end,s=!d||d.start===d.end,n=g.getLineStart(m),v=g.getLineEnd(m);g.getBaseModel&&(n=g.mapOffset(n),v=g.mapOffset(v));g=this._currentLineAnnotation;if(!(k===m&&s&&f&&g&&g.start===n&&g.end===v)){var k=g?[g]:null,z;f&&(g=a.createAnnotation(a.ANNOTATION_CURRENT_LINE,n,v),z=[g]);this._currentLineAnnotation=g;e.replaceAnnotations(k,z)}}}},installTextView:function(){this.install()},install:function(){if(!this._textView){this._textView=
this._textViewFactory();this._undoStackFactory&&(this._undoStack=this._undoStackFactory.createUndoStack(this),this.checkDirty());this._textDNDFactory&&(this._textDND=this._textDNDFactory.createTextDND(this,this._undoStack));this._contentAssistFactory&&(this._contentAssist=this._contentAssistFactory.createContentAssistMode(this).getContentAssist());var b=this,d=this._textView,e=this;this._listener={onModelChanged:function(a){e.checkDirty()},onMouseOver:function(a){e._listener.onMouseMove(a)},onMouseMove:function(a){var b=
k.Tooltip.getTooltip(d);b&&!(e._listener.lastMouseX===a.event.clientX&&e._listener.lastMouseY===a.event.clientY)&&(e._listener.lastMouseX=a.event.clientX,e._listener.lastMouseY=a.event.clientY,b.setTarget({x:a.x,y:a.y,getTooltipInfo:function(){return e._getTooltipInfo(this.x,this.y)}}))},onMouseOut:function(a){var b=k.Tooltip.getTooltip(d);b&&!(e._listener.lastMouseX===a.event.clientX&&e._listener.lastMouseY===a.event.clientY)&&(e._listener.lastMouseX=a.event.clientX,e._listener.lastMouseY=a.event.clientY,
b.setTarget(null))},onScroll:function(a){(a=k.Tooltip.getTooltip(d))&&a.setTarget(null,0,0)},onSelection:function(a){e._updateCursorStatus();e._highlightCurrentLine(a.newValue,a.oldValue)}};d.addEventListener("ModelChanged",this._listener.onModelChanged);d.addEventListener("Selection",this._listener.onSelection);d.addEventListener("MouseOver",this._listener.onMouseOver);d.addEventListener("MouseOut",this._listener.onMouseOut);d.addEventListener("MouseMove",this._listener.onMouseMove);d.addEventListener("Scroll",
this._listener.onScroll);if(this._keyBindingFactory){var g;if(g="function"===typeof this._keyBindingFactory?this._keyBindingFactory(this,this.getKeyModes(),this._undoStack,this._contentAssist):this._keyBindingFactory.createKeyBindings(b,this._undoStack,this._contentAssist))this._textActions=g.textActions,this._linkedMode=g.linkedMode,this._sourceCodeActions=g.sourceCodeActions}g=function(d,e){if(void 0!==d&&-1!==d){for(var f=this.getView().getModel(),h=this.getAnnotationModel(),g=b.mapOffset(f.getLineStart(d)),
f=b.mapOffset(f.getLineEnd(d)),p=h.getAnnotations(g,f),q=null;p.hasNext();){var k=p.next();if(k.type===a.ANNOTATION_BOOKMARK){q=k;break}}q?h.removeAnnotation(q):(q=a.createAnnotation(a.ANNOTATION_BOOKMARK,g,f),q.title=void 0,h.addAnnotation(q))}};if(this._annotationFactory){var r=d.getModel();r.getBaseModel&&(r=r.getBaseModel());if(this._annotationModel=this._annotationFactory.createAnnotationModel(r))if(r=this._annotationStyler=this._annotationFactory.createAnnotationStyler(d,this._annotationModel))r.addAnnotationType(a.ANNOTATION_CURRENT_SEARCH),
r.addAnnotationType(a.ANNOTATION_MATCHING_SEARCH),r.addAnnotationType(a.ANNOTATION_ERROR),r.addAnnotationType(a.ANNOTATION_WARNING),r.addAnnotationType(a.ANNOTATION_MATCHING_BRACKET),r.addAnnotationType(a.ANNOTATION_CURRENT_BRACKET),r.addAnnotationType(a.ANNOTATION_CURRENT_LINE),r.addAnnotationType(a.ANNOTATION_READ_OCCURRENCE),r.addAnnotationType(a.ANNOTATION_WRITE_OCCURRENCE),r.addAnnotationType(a.ANNOTATION_SELECTED_LINKED_GROUP),r.addAnnotationType(a.ANNOTATION_CURRENT_LINKED_GROUP),r.addAnnotationType(a.ANNOTATION_LINKED_GROUP),
r.addAnnotationType("orion.annotation.highlightError");var r=this._annotationFactory.createAnnotationRulers(this._annotationModel),m=this._annotationRuler=r.annotationRuler;m&&(m.onDblClick=g,m.setMultiAnnotationOverlay({html:"\x3cdiv class\x3d'annotationHTML overlay'\x3e\x3c/div\x3e"}),m.addAnnotationType(a.ANNOTATION_ERROR),m.addAnnotationType(a.ANNOTATION_WARNING),m.addAnnotationType(a.ANNOTATION_TASK),m.addAnnotationType(a.ANNOTATION_BOOKMARK));this.setAnnotationRulerVisible(this._annotationRulerVisible||
void 0===this._annotationRulerVisible,!0);if(m=this._overviewRuler=r.overviewRuler)m.addAnnotationType(a.ANNOTATION_CURRENT_SEARCH),m.addAnnotationType(a.ANNOTATION_MATCHING_SEARCH),m.addAnnotationType(a.ANNOTATION_READ_OCCURRENCE),m.addAnnotationType(a.ANNOTATION_WRITE_OCCURRENCE),m.addAnnotationType(a.ANNOTATION_CURRENT_BLAME),m.addAnnotationType(a.ANNOTATION_ERROR),m.addAnnotationType(a.ANNOTATION_WARNING),m.addAnnotationType(a.ANNOTATION_TASK),m.addAnnotationType(a.ANNOTATION_BOOKMARK),m.addAnnotationType(a.ANNOTATION_MATCHING_BRACKET),
m.addAnnotationType(a.ANNOTATION_CURRENT_BRACKET),m.addAnnotationType(a.ANNOTATION_CURRENT_LINE);this.setOverviewRulerVisible(this._overviewRulerVisible||void 0===this._overviewRulerVisible,!0)}this._lineNumberRulerFactory&&(this._lineNumberRuler=this._lineNumberRulerFactory.createLineNumberRuler(this._annotationModel),this._lineNumberRuler.addAnnotationType(a.ANNOTATION_CURRENT_BLAME),this._lineNumberRuler.addAnnotationType(a.ANNOTATION_BLAME),this._lineNumberRuler.onDblClick=g,this.setLineNumberRulerVisible(this._lineNumberRulerVisible||
void 0===this._lineNumberRulerVisible,!0));this._foldingRulerFactory&&(this._foldingRuler=this._foldingRulerFactory.createFoldingRuler(this._annotationModel),this._foldingRuler.addAnnotationType(a.ANNOTATION_FOLDING),this.setFoldingRulerVisible(this._foldingRulerVisible||void 0===this._foldingRulerVisible,!0));this.dispatchEvent({type:"TextViewInstalled",textView:d});f.prototype.install.call(this)}},uninstallTextView:function(){this.uninstall()},uninstall:function(){var a=this._textView;a&&(a.destroy(),
this._annotationModel&&this._annotationModel.setTextModel(null),this._textView=this._undoStack=this._textDND=this._contentAssist=this._listener=this._annotationModel=this._annotationStyler=this._annotationRuler=this._overviewRuler=this._lineNumberRuler=this._foldingRuler=this._currentLineAnnotation=this._title=null,this._dirty=!1,this._foldingRulerVisible=this._overviewRulerVisible=this._lineNumberRulerVisible=this._annotationRulerVisible=void 0,this.dispatchEvent({type:"TextViewUninstalled",textView:a}),
f.prototype.uninstall.call(this))},_updateCursorStatus:function(){for(var a=this.getModel(),b=this.getCaretOffset(),d=a.getLineAtOffset(b),a=a.getLineStart(d),b=b-a,a=this.getKeyModes(),e=0;e<a.length;e++){var f=a[e];if(f.isActive()&&f.isStatusActive&&f.isStatusActive())return}this.reportStatus(g.formatMessage(m.lineColumn,d+1,b+1))},showAnnotations:function(b,d,e,f){var g=this._annotationModel;if(g){for(var k=[],m=[],n=g.getTextModel(),x=g.getAnnotations(),v;x.hasNext();)v=x.next(),-1!==d.indexOf(v.type)&&
v.creatorID===this&&k.push(v);if(b)for(d=0;d<b.length;d++)if(v=b[d]){if(e)v=e(v);else{var z;"number"===typeof v.line?(z=n.getLineStart(v.line-1),x=z+v.start-1,z=z+v.end-1):(x=v.start,z=v.end);var A=f(v);if(!A)continue;v=a.createAnnotation(A,x,z,v.description)}v.creatorID=this;m.push(v)}g.replaceAnnotations(k,m)}},showProblems:function(b){this.showAnnotations(b,[a.ANNOTATION_ERROR,a.ANNOTATION_WARNING,a.ANNOTATION_TASK],null,function(b){switch(b.severity){case "error":return a.ANNOTATION_ERROR;case "warning":return a.ANNOTATION_WARNING;
case "task":return a.ANNOTATION_TASK}return null})},showOccurrences:function(b){this.showAnnotations(b,[a.ANNOTATION_READ_OCCURRENCE,a.ANNOTATION_WRITE_OCCURRENCE],null,function(b){return b.readAccess?a.ANNOTATION_READ_OCCURRENCE:a.ANNOTATION_WRITE_OCCURRENCE})},showBlame:function(b){var f=this._blameRGB,p=this.getTextView().getOptions("parent").ownerDocument;if(!f){var q=g.createElement(p,"div");q.className="annotation blame";p.body.appendChild(q);var k=(p.defaultView||p.parentWindow).getComputedStyle(q).getPropertyValue("background-color");
q.parentNode.removeChild(q);var q=k.indexOf("("),t=k.indexOf(")"),k=k.substring(q+1,t);this._blameRGB=f=k.split(",").slice(0,3)}var n=function(){var a=e.AnnotationType.createAnnotation(this.groupType,this.start,this.end,this.title);a.style=d.mixin({},a.style);a.style.style=d.mixin({},a.style.style);a.style.style.backgroundColor="";this.groupAnnotation=a;a.blame=this.blame;a.html=this.html;a.creatorID=this.creatorID;return a},s=function(){var a=g.createElement(p,"div");a.className="tooltipTitle";var b=
this.blame.Message.indexOf("\n");-1===b&&(b=this.blame.Message.length);var d=g.createElement(p,"a");d.href=this.blame.CommitLink;d.appendChild(p.createTextNode(this.blame.Message.substring(0,b)));a.appendChild(d);a.appendChild(g.createElement(p,"br"));a.appendChild(p.createTextNode(g.formatMessage(m.committerOnTime,this.blame.AuthorName,this.blame.Time)));return a},x=this.getModel();this.showAnnotations(b,[a.ANNOTATION_BLAME,a.ANNOTATION_CURRENT_BLAME],function(b){var l=x.getLineStart(b.Start-1),
g=x.getLineEnd(b.End-1,!0),l=e.AnnotationType.createAnnotation(a.ANNOTATION_BLAME,l,g,s),g=f.slice(0);g.push(b.Shade);l.style=d.mixin({},l.style);l.style.style=d.mixin({},l.style.style);l.style.style.backgroundColor="rgba("+g.join()+")";l.groupId=b.Name;l.groupType=a.ANNOTATION_CURRENT_BLAME;l.createGroupAnnotation=n;l.html='\x3cimg class\x3d"annotationHTML blame" src\x3d"'+b.AuthorImage+'"/\x3e';l.blame=b;return l})},showSelection:function(a,b,d,e,f){"number"===typeof a?("number"!==typeof b&&(b=
a),this.moveSelection(a,b)):"number"===typeof d&&(a=this.getModel().getLineStart(d-1),"number"===typeof e&&(a+=e),"number"!==typeof f&&(f=0),this.moveSelection(a,a+f))},_setModelText:function(a){this._textView&&(this._textView.setText(a),this._textView.getModel().setLineDelimiter("auto"),this._highlightCurrentLine(this._textView.getSelection()))},setInput:function(a,b,d,e,g){f.prototype.setInput.call(this,a,b,d,e);this._textView&&(!e&&!g)&&this._textView.focus()},onGotoLine:function(a,b,d,e){if(this._textView){var f=
this.getModel();a=Math.max(0,Math.min(a,f.getLineCount()-1));var g=f.getLineStart(a),k=0;void 0===d&&(d=0);"string"===typeof b?(a=f.getLine(a).indexOf(b),-1!==a&&(k=a,d=k+b.length)):(k=b,b=f.getLineEnd(a)-g,k=Math.min(k,b),d=Math.min(d,b));this.moveSelection(g+k,g+d,e)}}});return{BaseEditor:f,Editor:b}});
define("orion/editor/find","i18n!orion/editor/nls/messages orion/keyBinding orion/editor/keyModes orion/editor/annotations orion/regex orion/objects orion/util".split(" "),function(m,n,k,e,d,g,f){function b(a){var b=a.getTextView();k.KeyMode.call(this,b);this.editor=a;this._active=!1;this._success=!0;this._ignoreSelection=!1;this._prefix="";b.setAction("incrementalFindCancel",function(){this.setActive(!1);return!0}.bind(this));b.setAction("incrementalFindBackspace",function(){return this._backspace()}.bind(this));
var e=this;this._listener={onVerify:function(a){var b=e.editor,f=b.getModel(),h=b.mapOffset(a.start),b=b.mapOffset(a.end),f=f.getText(h,b);if((f=e._prefix.match(RegExp("^"+d.escape(f),"i")))&&0<f.length)e._prefix+=a.text,e._success=!0,e._status(),e.find(e._forward,!0),a.text=null},onSelection:function(){e._ignoreSelection||e.setActive(!1)}}}function a(a,b,d){if(a){this._editor=a;this._undoStack=b;this._showAll=!0;this._visible=!1;this._wrap=this._caseInsensitive=!0;this._wholeWord=!1;this._incremental=
!0;this._regex=!1;this._findAfterReplace=!0;this._reverse=this._hideAfterFind=!1;this._timer=this._end=this._start=void 0;this._lastString="";var e=this;this._listeners={onEditorFocus:function(a){e._removeCurrentAnnotation(a)}};this.setOptions(d)}}var l={};b.prototype=new k.KeyMode;g.mixin(b.prototype,{createKeyBindings:function(){var a=n.KeyBinding,b=[];b.push({actionID:"incrementalFindBackspace",keyBinding:new a(8)});b.push({actionID:"incrementalFindCancel",keyBinding:new a(13)});b.push({actionID:"incrementalFindCancel",
keyBinding:new a(27)});b.push({actionID:"incrementalFindReverse",keyBinding:new a(38)});b.push({actionID:"incrementalFind",keyBinding:new a(40)});b.push({actionID:"incrementalFindReverse",keyBinding:new a("k",!0,!0)});b.push({actionID:"incrementalFind",keyBinding:new a("k",!0)});return b},find:function(a,b){this._forward=a;if(!this.isActive())return this.setActive(!0),!1;var d=this._prefix;if(0===d.length)return!1;var e=this.editor,f=e.getModel(),f=a?this._success?b?this._start:e.getCaretOffset()+
1:0:this._success?b?this._start:e.getCaretOffset():f.getCharCount()-1;(d=e.getModel().find({string:d,start:f,reverse:!a,caseInsensitive:d.toLowerCase()===d}).next())?(b||(this._start=f),this._ignoreSelection=this._success=!0,e.moveSelection(a?d.start:d.end,a?d.end:d.start),this._ignoreSelection=!1):this._success=!1;this._status();return!0},isActive:function(){return this._active},isStatusActive:function(){return this.isActive()},setActive:function(a){this._active!==a&&(this._active=a,this._prefix=
"",this._success=!0,a=this.editor.getTextView(),this._start=this.editor.getCaretOffset(),this.editor.setCaretOffset(this._start),this._active?(a.addEventListener("Verify",this._listener.onVerify),a.addEventListener("Selection",this._listener.onSelection),a.addKeyMode(this)):(a.removeEventListener("Verify",this._listener.onVerify),a.removeEventListener("Selection",this._listener.onSelection),a.removeKeyMode(this)),this._status())},_backspace:function(){var a=this._prefix,a=this._prefix=a.substring(0,
a.length-1);return 0===a.length?(this._ignoreSelection=this._success=!0,this.editor.setCaretOffset(this.editor.getSelection().start),this._ignoreSelection=!1,this._status(),!0):this.find(this._forward,!0)},_status:function(){if(this.isActive()){var a;a=this._forward?this._success?m.incrementalFindStr:m.incrementalFindStrNotFound:this._success?m.incrementalFindReverseStr:m.incrementalFindReverseStrNotFound;a=f.formatMessage(a,this._prefix);this.editor.reportStatus(a,this._success?"":"error")}else this.editor.reportStatus("")}});
l.IncrementalFind=b;a.prototype={find:function(a,b,d){this.setOptions({reverse:!a});var e=this.getFindString(),f;b&&(e=b.findString||e,f=b.count);a=this.getOptions();this.setOptions(b);b=d?this._startOffset:this.getStartOffset();if((f=this._doFind(e,b,f))&&!d)this._startOffset=f.start;this.setOptions(a);this._hideAfterFind&&this.hide();return f},getStartOffset:function(){return void 0!==this._start?this._start:this._reverse?this._editor.getSelection().start-1:this._editor.getCaretOffset()},getFindString:function(){var a=
this._editor.getSelection(),a=this._editor.getText(a.start,a.end);this._regex&&(a=d.escape(a));return a||this._lastString},getOptions:function(){return{showAll:this._showAll,caseInsensitive:this._caseInsensitive,wrap:this._wrap,wholeWord:this._wholeWord,incremental:this._incremental,regex:this._regex,findAfterReplace:this._findAfterReplace,hideAfterFind:this._hideAfterFind,reverse:this._reverse,findCallback:this._findCallback,start:this._start,end:this._end}},getReplaceString:function(){return""},
hide:function(){this._visible=!1;this._savedOptions&&(this.setOptions(this._savedOptions.pop()),0===this._savedOptions.length&&(this._savedOptions=null));this._removeAllAnnotations();var a=this._editor.getTextView();a&&(a.removeEventListener("Focus",this._listeners.onEditorFocus),a.focus())},_processReplaceString:function(a){var b=a;if(this._regex){for(var b="",d=!1,e=this._editor.getModel().getLineDelimiter(),f=0;f<a.length;f++){var l=a.substring(f,f+1);if(d){switch(l){case "R":b+=e;break;case "r":b+=
"\r";break;case "n":b+="\n";break;case "t":b+="\t";break;case "\\":b+="\\";break;default:b+="\\"+l}d=!1}else"\\"===l?d=!0:b+=l}d&&(b+="\\")}return b},isVisible:function(){return this._visible},replace:function(){var a=this.getFindString();if(a){var b=this._editor,d=this._processReplaceString(this.getReplaceString()),e=b.getSelection().start;if(b=b.getModel().find({string:a,start:e,reverse:!1,wrap:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive}).next())this.startUndo(),
this._doReplace(b.start,b.end,a,d),this.endUndo()}this._findAfterReplace&&a&&this._doFind(a,this.getStartOffset())},replaceAll:function(){var a=this.getFindString();if(a){this._replacingAll=!0;var b=this._editor,d=b.getTextView();b.reportStatus(m.replacingAll);var e=this._processReplaceString(this.getReplaceString()),l=this;window.setTimeout(function(){for(var g=0,k=0;;){var n=l._doFind(a,g,null,!0);if(!n)break;k++;1===k&&(d.setRedraw(!1),l.startUndo());l._doReplace(n.start,n.end,a,e);g=l.getStartOffset()}0<
k&&(l.endUndo(),d.setRedraw(!0));0<g?b.reportStatus(f.formatMessage(m.replacedMatches,k)):b.reportStatus(m.nothingReplaced,"error");l._replacingAll=!1},100)}},setOptions:function(a){if(a){if((!0===a.showAll||!1===a.showAll)&&this._showAll!==a.showAll)if(this._showAll=a.showAll,this.isVisible())if(this._showAll)this._markAllOccurrences();else{var b=this._editor.getAnnotationModel();b&&b.removeAnnotations(e.AnnotationType.ANNOTATION_MATCHING_SEARCH)}if(!0===a.caseInsensitive||!1===a.caseInsensitive)this._caseInsensitive=
a.caseInsensitive;if(!0===a.wrap||!1===a.wrap)this._wrap=a.wrap;if(!0===a.wholeWord||!1===a.wholeWord)this._wholeWord=a.wholeWord;if(!0===a.incremental||!1===a.incremental)this._incremental=a.incremental;if(!0===a.regex||!1===a.regex)this._regex=a.regex;if(!0===a.findAfterReplace||!1===a.findAfterReplace)this._findAfterReplace=a.findAfterReplace;if(!0===a.hideAfterFind||!1===a.hideAfterFind)this._hideAfterFind=a.hideAfterFind;if(!0===a.reverse||!1===a.reverse)this._reverse=a.reverse;a.hasOwnProperty("findCallback")&&
(this._findCallback=a.findCallback);a.hasOwnProperty("start")&&(this._start=a.start);a.hasOwnProperty("end")&&(this._end=a.end)}},show:function(a){this._visible=!0;a&&(this._savedOptions||(this._savedOptions=[]),this._savedOptions.push(this.getOptions()),this.setOptions(a));this._startOffset=this._editor.getSelection().start;this._editor.getTextView().addEventListener("Focus",this._listeners.onEditorFocus);var b=this;window.setTimeout(function(){b._incremental&&b.find(!0,null,!0)},0)},startUndo:function(){this._undoStack&&
this._undoStack.startCompoundChange()},endUndo:function(){this._undoStack&&this._undoStack.endCompoundChange()},_find:function(a,b,d){return this._editor.getModel().find({string:a,start:b,end:this._end,reverse:this._reverse,wrap:d?!1:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive})},_doFind:function(a,b,d,f){d=d||1;var l=this._editor;if(!a)return this._removeAllAnnotations(),null;this._lastString=a;var g,k;if(this._regex)try{k=this._find(a,b,f)}catch(n){l.reportStatus(n.message,
"error");return}else k=this._find(a,b,f);for(a=0;a<d&&k.hasNext();a++)g=k.next();if(!this._replacingAll){g?this._editor.reportStatus(""):this._editor.reportStatus(m.notFound,"error");if(this.isVisible()){d=e.AnnotationType.ANNOTATION_CURRENT_SEARCH;if(k=l.getAnnotationModel())k.removeAnnotations(d),g&&k.addAnnotation(e.AnnotationType.createAnnotation(d,g.start,g.end));if(this._showAll){this._timer&&window.clearTimeout(this._timer);var v=this;this._timer=window.setTimeout(function(){v._markAllOccurrences();
v._timer=null},500)}}this._findCallback?this._findCallback(g):g&&l.moveSelection(g.start,g.end,null,!1)}return g},_doReplace:function(a,b,d,e){var f=this._editor;this._regex&&(e=f.getText(a,b).replace(RegExp(d,this._caseInsensitive?"i":""),e));f.setText(e,a,b);f.setSelection(a,a+e.length,!0)},_markAllOccurrences:function(){var a=this._editor.getAnnotationModel();if(a){for(var b=e.AnnotationType.ANNOTATION_MATCHING_SEARCH,d=a.getAnnotations(),f=[],l;d.hasNext();){var g=d.next();g.type===b&&f.push(g)}if(this.isVisible()){d=
this.getFindString();d=this._editor.getModel().find({string:d,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive});for(l=[];d.hasNext();)g=d.next(),l.push(e.AnnotationType.createAnnotation(b,g.start,g.end))}a.replaceAnnotations(f,l)}},_removeAllAnnotations:function(){var a=this._editor.getAnnotationModel();a&&(a.removeAnnotations(e.AnnotationType.ANNOTATION_CURRENT_SEARCH),a.removeAnnotations(e.AnnotationType.ANNOTATION_MATCHING_SEARCH))},_removeCurrentAnnotation:function(a){(a=
this._editor.getAnnotationModel())&&a.removeAnnotations(e.AnnotationType.ANNOTATION_CURRENT_SEARCH)}};l.Find=a;return l});
define("orion/editor/findUI",["i18n!orion/editor/nls/messages","orion/editor/find","orion/objects","orion/editor/util","orion/util"],function(m,n,k,e,d){function g(d,b,a){n.Find.call(this,d,b,a)}g.prototype=new n.Find;k.mixin(g.prototype,{getFindString:function(){var d=this._findInput;return!d?n.Find.prototype.getFindString.call(this):d.value},getReplaceString:function(){var d=this._replaceInput;return!d?n.Find.prototype.getReplaceString(this):d.value},hide:function(){var d=this.isVisible();n.Find.prototype.hide.call(this);
d&&(this._rootDiv.className="textViewFind")},show:function(d){n.Find.prototype.show.call(this,d);var b=d.findString;d=d.replaceString;var a=this._findInput;a||(this._create(),a=this._findInput);b&&(a.value=b);d&&(this._replaceInput.value=d);var e=this;window.setTimeout(function(){e._rootDiv.className="textViewFind show";a.select();a.focus()},0)},_create:function(){var f=this,b=this._editor.getTextView(),a=b.getOptions("parent").ownerDocument,l=d.createElement(a,"div");l.className="textViewFind";e.addEventListener(l,
"keydown",function(a){f._handleKeyDown(a)});this._rootDiv=l;this._createContents(a,l);b._rootDiv.insertBefore(l,b._rootDiv.firstChild)},_createContents:function(f,b){var a=this,l=d.createElement(f,"input");l.className="textViewFindInput";this._findInput=l;l.type="text";l.placeholder=m.findWith;e.addEventListener(l,"input",function(b){return a._handleInput(b)});b.appendChild(l);l=d.createElement(f,"span");a._createButton(f,l,m.next,function(){a.find(!0)});a._createButton(f,l,m.previous,function(){a.find(!1)});
b.appendChild(l);a._editor.getTextView().getOptions("readonly")||(l=d.createElement(f,"input"),l.className="textViewReplaceInput",this._replaceInput=l,l.type="text",l.placeholder=m.replaceWith,b.appendChild(l),l=d.createElement(f,"span"),a._createButton(f,l,m.replace,function(){a.replace()}),a._createButton(f,l,m.replaceAll,function(){a.replaceAll()}),b.appendChild(l));l=d.createElement(f,"span");a._createButton(f,l,m.regex,function(b){a._toggle("regex",b.target)},this._regex,m.regexTooltip);a._createButton(f,
l,m.caseInsensitive,function(b){a._toggle("caseInsensitive",b.target)},this._caseInsensitive,m.caseInsensitiveTooltip);a._createButton(f,l,m.wholeWord,function(b){a._toggle("wholeWord",b.target)},this._wholeWord,m.wholeWordTooltip);b.appendChild(l);l=a._createButton(f,b,"",function(){a.hide()});l.className="textViewFindCloseButton";l.title=m.closeTooltip},_createButton:function(d,b,a,l,h,g){var k=d.createElement("button");this._checked(h,k);g&&(k.title=g);e.addEventListener(k,"click",function(a){l.call(this,
a)},!1);a&&k.appendChild(d.createTextNode(a));b.appendChild(k);return k},_toggle:function(d,b){var a={};a[d]=!this["_"+d];this.setOptions(a);this._checked(a[d],b)},_checked:function(d,b){b.className="textViewFindButton";d&&(b.className+=" checked")},_handleInput:function(){this._incremental&&this.find(!0,null,!0);return!0},_handleKeyDown:function(e){var b,a=(d.isMac?e.metaKey:e.ctrlKey)&&!e.altKey&&!e.shiftKey;a&&70===e.keyCode&&(b=!0);if((d.isMac?e.metaKey:e.ctrlKey)&&!e.altKey&&75===e.keyCode||
13===e.keyCode)13===e.keyCode?this.find(this._reverse?e.shiftKey:!e.shiftKey):this.find(!e.shiftKey),b=!0;a&&82===e.keyCode&&(this.replace(),b=!0);27===e.keyCode&&(this.hide(),b=!0);return b?(e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.cancelBubble=!0,!1):!0}});return{FindUI:g}});
define("orion/editor/actions","i18n!orion/editor/nls/messages orion/keyBinding orion/editor/annotations orion/editor/tooltip orion/editor/find orion/editor/findUI orion/util".split(" "),function(m,n,k,e,d,g,f){function b(a,b,e){this.editor=a;this.undoStack=b;this._incrementalFind=new d.IncrementalFind(a);this._find=e?e:new g.FindUI(a,b);this._lastEditLocation=null;this.init()}function a(a,b,d,e){this.editor=a;this.undoStack=b;this.contentAssist=d;this.linkedMode=e;this.contentAssist&&this.contentAssist.addEventListener("ProposalApplied",
this.contentAssistProposalApplied.bind(this));this.init()}var l=k.AnnotationType,h={};b.prototype={init:function(){var a=this.editor.getTextView();this._lastEditListener={onModelChanged:function(a){this.editor.isDirty()&&(this._lastEditLocation=a.start+a.addedCharCount)}.bind(this)};a.addEventListener("ModelChanged",this._lastEditListener.onModelChanged);a.setAction("undo",function(a){if(this.undoStack){var b=1;a&&a.count&&(b=a.count);for(;0<b;)this.undoStack.undo(),--b;return!0}return!1}.bind(this),
{name:m.undo});a.setAction("redo",function(a){if(this.undoStack){var b=1;a&&a.count&&(b=a.count);for(;0<b;)this.undoStack.redo(),--b;return!0}return!1}.bind(this),{name:m.redo});a.setKeyBinding(new n.KeyBinding("f",!0),"find");a.setAction("find",function(){if(this._find){var a=this.editor.getSelection();this._find.show({findString:this.editor.getText(a.start,a.end)});return!0}return!1}.bind(this),{name:m.find});a.setKeyBinding(new n.KeyBinding("k",!0),"findNext");a.setAction("findNext",function(a){return this._find?
(this._find.find(!0,a),!0):!1}.bind(this),{name:m.findNext});a.setKeyBinding(new n.KeyBinding("k",!0,!0),"findPrevious");a.setAction("findPrevious",function(a){return this._find?(this._find.find(!1,a),!0):!1}.bind(this),{name:m.findPrevious});a.setKeyBinding(new n.KeyBinding("j",!0),"incrementalFind");a.setAction("incrementalFind",function(){this._incrementalFind&&this._incrementalFind.find(!0);return!0}.bind(this),{name:m.incrementalFind});a.setKeyBinding(new n.KeyBinding("j",!0,!0),"incrementalFindReverse");
a.setAction("incrementalFindReverse",function(){this._incrementalFind&&this._incrementalFind.find(!1);return!0}.bind(this),{name:m.incrementalFindReverse});a.setAction("tab",function(){return this.indentLines()}.bind(this));a.setAction("shiftTab",function(){return this.unindentLines()}.bind(this),{name:m.unindentLines});a.setKeyBinding(new n.KeyBinding(38,!1,!1,!0),"moveLinesUp");a.setAction("moveLinesUp",function(){return this.moveLinesUp()}.bind(this),{name:m.moveLinesUp});a.setKeyBinding(new n.KeyBinding(40,
!1,!1,!0),"moveLinesDown");a.setAction("moveLinesDown",function(){return this.moveLinesDown()}.bind(this),{name:m.moveLinesDown});a.setKeyBinding(new n.KeyBinding(38,!0,!1,!0),"copyLinesUp");a.setAction("copyLinesUp",function(){return this.copyLinesUp()}.bind(this),{name:m.copyLinesUp});a.setKeyBinding(new n.KeyBinding(40,!0,!1,!0),"copyLinesDown");a.setAction("copyLinesDown",function(){return this.copyLinesDown()}.bind(this),{name:m.copyLinesDown});a.setKeyBinding(new n.KeyBinding("d",!0,!1,!1),
"deleteLines");a.setAction("deleteLines",function(a){return this.deleteLines(a)}.bind(this),{name:m.deleteLines});a.setKeyBinding(new n.KeyBinding("l",!f.isMac,!1,!1,f.isMac),"gotoLine");a.setAction("gotoLine",function(){return this.gotoLine()}.bind(this),{name:m.gotoLine});a.setKeyBinding(new n.KeyBinding(190,!0),"nextAnnotation");a.setAction("nextAnnotation",function(){return this.nextAnnotation(!0)}.bind(this),{name:m.nextAnnotation});a.setKeyBinding(new n.KeyBinding(188,!0),"previousAnnotation");
a.setAction("previousAnnotation",function(){return this.nextAnnotation(!1)}.bind(this),{name:m.prevAnnotation});a.setKeyBinding(new n.KeyBinding("e",!0,!1,!0,!1),"expand");a.setAction("expand",function(){return this.expandAnnotation(!0)}.bind(this),{name:m.expand});a.setKeyBinding(new n.KeyBinding("c",!0,!1,!0,!1),"collapse");a.setAction("collapse",function(){return this.expandAnnotation(!1)}.bind(this),{name:m.collapse});a.setKeyBinding(new n.KeyBinding("e",!0,!0,!0,!1),"expandAll");a.setAction("expandAll",
function(){return this.expandAnnotations(!0)}.bind(this),{name:m.expandAll});a.setKeyBinding(new n.KeyBinding("c",!0,!0,!0,!1),"collapseAll");a.setAction("collapseAll",function(){return this.expandAnnotations(!1)}.bind(this),{name:m.collapseAll});a.setKeyBinding(new n.KeyBinding("q",!f.isMac,!1,!1,f.isMac),"lastEdit");a.setAction("lastEdit",function(){return this.gotoLastEdit()}.bind(this),{name:m.lastEdit})},copyLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;
var b=a.getModel(),d=a.getSelection(),e=b.getLineAtOffset(d.start),d=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),f=b.getLineStart(e),e=b.getLineEnd(d,!0),h=b.getLineCount(),l="",f=b.getText(f,e);d===h-1&&(f=(l=b.getLineDelimiter())+f);a.setText(f,e,e);a.setSelection(e+l.length,e+f.length);return!0},copyLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),e=b.getLineAtOffset(d.start),d=b.getLineAtOffset(d.end>d.start?d.end-
1:d.end),e=b.getLineStart(e),f=b.getLineEnd(d,!0),h=b.getLineCount(),l="",f=b.getText(e,f);d===h-1&&(f+=l=b.getLineDelimiter());a.setText(f,e,e);a.setSelection(e,e+f.length-l.length);return!0},deleteLines:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var d=1;a&&a.count&&(d=a.count);var e=b.getSelection(),f=b.getModel(),h=f.getLineAtOffset(e.start);a=f.getLineStart(h);d=e.start!==e.end||1===d?f.getLineAtOffset(e.end>e.start?e.end-1:e.end):Math.min(h+d-1,f.getLineCount()-
1);d=f.getLineEnd(d,!0);b.setText("",a,d);return!0},expandAnnotation:function(a){var b=this.editor,d=b.getAnnotationModel();if(!d)return!0;var e=b.getModel(),f=b.getCaretOffset(),h=e.getLineAtOffset(f),f=e.getLineStart(h),h=e.getLineEnd(h,!0);e.getBaseModel&&(f=e.mapOffset(f),h=e.mapOffset(h),e.getBaseModel());for(var l,d=d.getAnnotations(f,h);!l&&d.hasNext();)e=d.next(),e.type===k.AnnotationType.ANNOTATION_FOLDING&&(l=e);l&&a!==l.expanded&&(a?l.expand():(b.setCaretOffset(l.start),l.collapse()));
return!0},expandAnnotations:function(a){var b=this.editor,d=b.getTextView(),b=b.getAnnotationModel();if(!b)return!0;var e=b.getAnnotations();for(d.setRedraw(!1);e.hasNext();)b=e.next(),b.type===k.AnnotationType.ANNOTATION_FOLDING&&a!==b.expanded&&(a?b.expand():b.collapse());d.setRedraw(!0);return!0},indentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){var d=a.getModel(),e=a.getSelection(),f=d.getLineAtOffset(e.start),h=d.getLineAtOffset(e.end>
e.start?e.end-1:e.end);if(f!==h){var l=[];l.push("");for(var g=f;g<=h;g++)l.push(d.getLine(g,!0));g=d.getLineStart(f);d=d.getLineEnd(h,!0);b=b.getOptions("tabSize","expandTab");b=b.expandTab?Array(b.tabSize+1).join(" "):"\t";a.setText(l.join(b),g,d);a.setSelection(g===e.start?e.start:e.start+b.length,e.end+(h-f+1)*b.length);return!0}return!1}},gotoLastEdit:function(){"number"===typeof this._lastEditLocation&&this.editor.showSelection(this._lastEditLocation);return!0},gotoLine:function(){var a=this.editor,
b=a.getModel().getLineAtOffset(a.getCaretOffset());if(b=prompt(m.gotoLinePrompty,b+1))b=parseInt(b,10),a.onGotoLine(b-1,0);return!0},moveLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),e=b.getLineAtOffset(d.start),f=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),h=b.getLineCount();if(f===h-1)return!0;var e=b.getLineStart(e),d=b.getLineEnd(f,!0),l=b.getLineEnd(f+1,!0)-(d-e),g=0;f!==h-2?b=b.getText(e,d):(f=b.getLineEnd(f),
b=b.getText(f,d)+b.getText(e,f),g+=d-f);this.startUndo();a.setText("",e,d);a.setText(b,l,l);a.setSelection(l+g,l+g+b.length);this.endUndo();return!0},moveLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),e=b.getLineAtOffset(d.start);if(0===e)return!0;var f=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),h=b.getLineCount(),d=b.getLineStart(e-1),l=b.getLineStart(e),g=b.getLineEnd(f,!0),k=b.getText(l,g),m=0;f===h-1&&(f=b.getLineEnd(e-
1),e=b.getLineEnd(e-1,!0),k+=b.getText(f,e),l=f,m=e-f);this.startUndo();a.setText("",l,g);a.setText(k,d,d);a.setSelection(d,d+k.length-m);this.endUndo();return!0},nextAnnotation:function(a){function b(a){return!!a.lineStyle||a.type===l.ANNOTATION_MATCHING_BRACKET||a.type===l.ANNOTATION_CURRENT_BRACKET||!h.isAnnotationTypeVisible(a.type)}var d=this.editor,f=d.getAnnotationModel();if(!f)return!0;var h=d.getOverviewRuler()||d.getAnnotationStyler();if(!h)return!0;for(var g=d.getModel(),k=d.getCaretOffset(),
m=f.getAnnotations(a?k:0,a?g.getCharCount():k),n=null;m.hasNext();){var A=m.next();if(a){if(A.start<=k)continue}else if(A.start>=k)continue;if(!b(A)&&(n=A,a))break}if(n){for(var B=[n],m=f.getAnnotations(n.start,n.start);m.hasNext();)A=m.next(),A!==n&&!b(A)&&B.push(A);var u=d.getTextView(),y=g.getLineAtOffset(n.start),C=e.Tooltip.getTooltip(u);if(!C)return d.moveSelection(n.start),!0;d.moveSelection(n.start,n.start,function(){C.setTarget({getTooltipInfo:function(){var a=u.convert({x:u.getLocationAtOffset(n.start).x,
y:u.getLocationAtOffset(g.getLineStart(y)).y},"document","page");return{contents:B,x:a.x,y:a.y+Math.floor(1.33*u.getLineHeight(y))}}},0)})}return!0},unindentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){for(var d=a.getModel(),e=a.getSelection(),f=d.getLineAtOffset(e.start),h=d.getLineAtOffset(e.end>e.start?e.end-1:e.end),l=b.getOptions("tabSize"),g=Array(l+1).join(" "),k=[],m=b=0,n=f;n<=h;n++){var u=d.getLine(n,!0);if(d.getLineStart(n)!==
d.getLineEnd(n))if(0===u.indexOf("\t"))u=u.substring(1),b++;else if(0===u.indexOf(g))u=u.substring(l),b+=l;else return!0;n===f&&(m=b);k.push(u)}f=d.getLineStart(f);l=d.getLineEnd(h,!0);d=d.getLineStart(h);a.setText(k.join(""),f,l);h=f===e.start?e.start:e.start-m;e=Math.max(h,e.end-b+(e.end===d+1&&e.start!==e.end?1:0));a.setSelection(h,e);return!0}},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()}};h.TextActions=
b;a.prototype={init:function(){var a=this.editor.getTextView();a.setAction("lineStart",function(){return this.lineStart()}.bind(this));a.setAction("enter",function(){return this.autoIndent()}.bind(this));a.setKeyBinding(new n.KeyBinding("t",!0,!1,!0),"trimTrailingWhitespaces");a.setAction("trimTrailingWhitespaces",function(){return this.trimTrailingWhitespaces()}.bind(this),{name:m.trimTrailingWhitespaces});a.setKeyBinding(new n.KeyBinding(191,!0),"toggleLineComment");a.setAction("toggleLineComment",
function(){return this.toggleLineComment()}.bind(this),{name:m.toggleLineComment});a.setKeyBinding(new n.KeyBinding(191,!0,!f.isMac,!1,f.isMac),"addBlockComment");a.setAction("addBlockComment",function(){return this.addBlockComment()}.bind(this),{name:m.addBlockComment});a.setKeyBinding(new n.KeyBinding(220,!0,!f.isMac,!1,f.isMac),"removeBlockComment");a.setAction("removeBlockComment",function(){return this.removeBlockComment()}.bind(this),{name:m.removeBlockComment});a.setKeyBinding(new n.KeyBinding("[",
!1,!1,!1,!1,"keypress"),"autoPairSquareBracket");a.setAction("autoPairSquareBracket",function(){return this.autoPairBrackets("[","]")}.bind(this));a.setKeyBinding(new n.KeyBinding("]",!1,!1,!1,!1,"keypress"),"skipClosingSquareBracket");a.setAction("skipClosingSquareBracket",function(){return this.skipClosingBracket("]")}.bind(this));a.setKeyBinding(new n.KeyBinding("\x3c",!1,!1,!1,!1,"keypress"),"autoPairAngleBracket");a.setAction("autoPairAngleBracket",function(){return this.autoPairBrackets("\x3c",
"\x3e")}.bind(this));a.setKeyBinding(new n.KeyBinding("\x3e",!1,!1,!1,!1,"keypress"),"skipClosingAngleBracket");a.setAction("skipClosingAngleBracket",function(){return this.skipClosingBracket("\x3e")}.bind(this));a.setKeyBinding(new n.KeyBinding("(",!1,!1,!1,!1,"keypress"),"autoPairParentheses");a.setAction("autoPairParentheses",function(){return this.autoPairBrackets("(",")")}.bind(this));a.setKeyBinding(new n.KeyBinding(")",!1,!1,!1,!1,"keypress"),"skipClosingParenthesis");a.setAction("skipClosingParenthesis",
function(){return this.skipClosingBracket(")")}.bind(this));a.setKeyBinding(new n.KeyBinding("{",!1,!1,!1,!1,"keypress"),"autoPairBraces");a.setAction("autoPairBraces",function(){return this.autoPairBrackets("{","}")}.bind(this));a.setKeyBinding(new n.KeyBinding("}",!1,!1,!1,!1,"keypress"),"skipClosingBrace");a.setAction("skipClosingBrace",function(){return this.skipClosingBracket("}")}.bind(this));a.setKeyBinding(new n.KeyBinding("'",!1,!1,!1,!1,"keypress"),"autoPairSingleQuotation");a.setAction("autoPairSingleQuotation",
function(){return this.autoPairQuotations("'")}.bind(this));a.setKeyBinding(new n.KeyBinding('"',!1,!1,!1,!1,"keypress"),"autoPairDblQuotation");a.setAction("autoPairDblQuotation",function(){return this.autoPairQuotations('"')}.bind(this));a.setAction("deletePrevious",function(){return this.deletePrevious()}.bind(this))},autoIndent:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;var d=a.getSelection();if(d.start===d.end){for(var e=a.getModel(),f=e.getLineAtOffset(d.start),
h=e.getLine(f,!1),l=e.getLineStart(f),g=0,k=d.start-l,m;g<k&&(32===(m=h.charCodeAt(g))||9===m);)g++;var l=h.substring(0,g),b=b.getOptions("tabSize","expandTab"),n=b.expandTab?Array(b.tabSize+1).join(" "):"\t",b=e.getLineDelimiter(),u=/^[\s]*\/\*[\*]*[\s]*$/,y=/^[\s]*\*/,C=/\*\/[\s]*$/,E=h.substring(0,k),D=h.substring(k),H;if(this.smartIndentation&&123===h.charCodeAt(H=E.trimRight().length-1))return e=k-H-1,D=D.length-D.trimLeft().length,h=125===h.charCodeAt(k+D)?b+l+n+b+l:b+l+n,a.setText(h,d.start-
e,d.end+D),a.setCaretOffset(d.start+b.length+l.length+n.length-e),!0;if(this.autoCompleteComments&&!C.test(E)&&(u.test(E)||y.test(E))){if(g=u.exec(E)){h=b+l+" * ";h=C.test(D)?h+D.substring(0,D.length-2).trim():h+D.trim();if(e.getLineCount()===f+1||!y.test(e.getLine(f+1)))h+=b+l+" */";a.setText(h,d.start,d.end+D.length);a.setCaretOffset(d.start+b.length+l.length+3);return!0}if(g=y.exec(E))for(f-=1;0<=f;f--){g=e.getLine(f,!1);if(u.test(g))return C.test(D)||47===h.charCodeAt(k)?(h=b+l+"*"+D,l=d.start+
b.length+l.length+1):(h=b+l+"* "+D,l=d.start+b.length+l.length+2),a.setText(h,d.start,d.end+D.length),a.setCaretOffset(l),!0;if(!y.test(g))break}}else{if(C.test(E)&&32===l.charCodeAt(l.length-1))return h=b+l.substring(0,l.length-1),a.setText(h,d.start,d.end),a.setCaretOffset(d.start+h.length),!0;if(0<g){for(g=k;g<h.length&&(32===(m=h.charCodeAt(g++))||9===m);)d.end++;a.setText(e.getLineDelimiter()+l,d.start,d.end);return!0}}}return!1},addBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;
var b=a.getModel(),d=a.getSelection(),e=this._findEnclosingComment(b,d.start,d.end);if(void 0!==e.commentStart&&void 0!==e.commentEnd)return!0;b=b.getText(d.start,d.end);if(0===b.length)return!0;var e=b.length,b=b.replace(/\/\*|\*\//g,""),f=b.length;a.setText("/*"+b+"*/",d.start,d.end);a.setSelection(d.start+2,d.end+2+(f-e));return!0},autoPairBrackets:function(a,b){if("["===a&&!this.autoPairSquareBrackets||"{"===a&&!this.autoPairBraces||"("===a&&!this.autoPairParentheses||"\x3c"===a&&!this.autoPairAngleBrackets)return!1;
var d=this.editor;if(d.getTextView().getOptions("readonly"))return!1;var e=d.getSelection(),f=d.getModel(),h=d.getCaretOffset()===f.getCharCount()?"":f.getText(e.start,e.start+1).trim(),l=/^$|[)}\]>]/;return e.start===e.end&&l.test(h)?(d.setText(a+b,e.start,e.start),d.setCaretOffset(e.start+1),!0):e.start!==e.end?(f=f.getText(e.start,e.end),d.setText(a+f+b,e.start,e.end),d.setSelection(e.start+1,e.end+1),!0):!1},autoPairQuotations:function(a){if(!this.autoPairQuotation)return!1;var b=this.editor;
if(b.getTextView().getOptions("readonly"))return!1;var d=b.getSelection(),e=b.getModel(),f=b.getCaretOffset(),h=0===f?"":e.getText(d.start-1,d.start).trim(),l=f===e.getCharCount()?"":e.getText(d.start,d.start+1).trim(),f=/^"$|^'$/,g=/\w/,k=/^$|[)}\]>]/;if(d.start!==d.end){e=e.getText(d.start,d.end);if(f.test(e))return!1;b.setText(a+e+a,d.start,d.end);b.setSelection(d.start+1,d.end+1)}else{if(l!==a){if(h===a||f.test(l)||g.test(h)||!k.test(l))return!1;b.setText(a+a,d.start,d.start)}b.setCaretOffset(d.start+
1)}return!0},contentAssistProposalApplied:function(a){a=a.data.proposal;if(a.positions&&0<a.positions.length&&this.linkedMode){for(var b=[],d=0;d<a.positions.length;++d)b[d]={positions:[{offset:a.positions[d].offset,length:a.positions[d].length}]};this.linkedMode.enterLinkedMode({groups:b,escapePosition:a.escapePosition})}else a.groups&&0<a.groups.length&&this.linkedMode?this.linkedMode.enterLinkedMode({groups:a.groups,escapePosition:a.escapePosition}):a.escapePosition&&this.editor.getTextView().setCaretOffset(a.escapePosition);
return!0},deletePrevious:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getSelection();if(b.start!==b.end)return!1;var d=a.getModel(),e=a.getCaretOffset(),f=0===e?"":d.getText(b.start-1,b.start),d=e===d.getCharCount()?"":d.getText(b.start,b.start+1);("("===f&&")"===d||"["===f&&"]"===d||"{"===f&&"}"===d||"\x3c"===f&&"\x3e"===d||'"'===f&&'"'===d||"'"===f&&"'"===d)&&a.setText("",b.start,b.start+1);return!1},_findEnclosingComment:function(a,b,d){var e=a.getLineAtOffset(b),
f=a.getLineAtOffset(d),h,l,g,k,m,n;for(h=e;0<=h&&!(l=a.getLine(h),g=h===e?b-a.getLineStart(e):l.length,k=l.lastIndexOf("/*",g),l=l.lastIndexOf("*/",g),l>k);h--)if(-1!==k){m=a.getLineStart(h)+k;break}for(h=f;h<a.getLineCount()&&!(l=a.getLine(h),g=h===f?d-a.getLineStart(f):0,k=l.indexOf("/*",g),l=l.indexOf("*/",g),-1!==k&&k<l);h++)if(-1!==l){n=a.getLineStart(h)+l;break}return{commentStart:m,commentEnd:n}},lineStart:function(){for(var a=this.editor,b=a.getModel(),d=a.getCaretOffset(),e=b.getLineAtOffset(d),
f=b.getLineStart(e),b=b.getLine(e),e=0;e<b.length;e++){var h=b.charCodeAt(e);if(!(32===h||9===h))break}e+=f;return d!==e?(a.setSelection(e,e),!0):!1},removeBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),e=b.getText(d.start,d.end),f,h,l;for(l=0;l<e.length;l++)if("/*"===e.substring(l,l+2)){f=d.start+l;break}for(;l<e.length;l++)if("*/"===e.substring(l,l+2)){h=d.start+l;break}if(void 0!==f&&void 0!==h)a.setText(b.getText(f+
2,h),f,h+2),a.setSelection(f,h);else{e=this._findEnclosingComment(b,d.start,d.end);if(void 0===e.commentStart||void 0===e.commentEnd)return!0;b=b.getText(e.commentStart+2,e.commentEnd);a.setText(b,e.commentStart,e.commentEnd+2);a.setSelection(d.start-2,d.end-2)}return!0},toggleLineComment:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;for(var d=this.lineComment||"//",e=a.getModel(),f=a.getSelection(),h=e.getLineAtOffset(f.start),l=e.getLineAtOffset(f.end>f.start?
f.end-1:f.end),g=!0,k=[],m,n=h;n<=l;n++){var u=e.getLine(n,!0);m=u.indexOf(d);k.push(m);if(!g||-1===m)g=!1;else if(0!==m){for(g=0;g<m;g++){var y=u.charCodeAt(g);if(!(32===y||9===y))break}g=g===m}}n=d.length;u=e.getLineStart(h);b.setRedraw(!1);this.startUndo();if(g){for(g=k.length-1;0<=g;g--)m=k[g]+e.getLineStart(h+g),a.setText("",m,m+n);e=e.getLineStart(l);d=u===f.start?f.start:f.start-n;f=f.end-n*(l-h+1)+(f.end===e+1?n:0)}else{for(g=k.length-1;0<=g;g--)m=e.getLineStart(h+g),a.setText(d,m,m);d=u===
f.start?f.start:f.start+n;f=f.end+n*(l-h+1)}this.endUndo();b.setRedraw(!0);a.setSelection(d,f);return!0},trimTrailingWhitespaces:function(){var a=this.editor,b=a.getModel(),d=a.getSelection();a.getTextView().setRedraw(!1);a.getUndoStack().startCompoundChange();for(var e=/(\s+$)/,f=b.getLineCount(),h=0;h<f;h++){var l=b.getLine(h),g=e.exec(l);if(g){var k=b.getLineStart(h),l=g[0].length,g=k+g.index;b.setText("",g,g+l);d.start>g&&(d.start=Math.max(g,d.start-l));d.start!==d.end&&d.end>g&&(d.end=Math.max(g,
d.end-l))}}a.getUndoStack().endCompoundChange();a.getTextView().setRedraw(!0);a.setSelection(d.start,d.end,!1)},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},skipClosingBracket:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var d=b.getSelection(),e=b.getModel();return(b.getCaretOffset()===e.getCharCount()?"":e.getText(d.start,d.start+1))===a?(b.setCaretOffset(d.start+1),!0):!1},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()},
setAutoPairParentheses:function(a){this.autoPairParentheses=a},setAutoPairBraces:function(a){this.autoPairBraces=a},setAutoPairSquareBrackets:function(a){this.autoPairSquareBrackets=a},setAutoPairAngleBrackets:function(a){this.autoPairAngleBrackets=a},setAutoPairQuotations:function(a){this.autoPairQuotation=a},setAutoCompleteComments:function(a){this.autoCompleteComments=a},setLineComment:function(a){this.lineComment=a},setSmartIndentation:function(a){this.smartIndentation=a}};h.SourceCodeActions=
a;String.prototype.trimLeft||(String.prototype.trimLeft=function(){return this.replace(/^\s+/g,"")});String.prototype.trimRight||(String.prototype.trimRight=function(){return this.replace(/\s+$/g,"")});return h});
define("orion/editor/undoStack",[],function(){function m(e,d,g,f,b){this.model=e;this.offset=d;this.text=g;this.previousText=f;this.type=b}function n(e){this.owner=e;this.changes=[]}function k(e,d){this.size=void 0!==d?d:100;this.reset();var g=this;this._listener={onChanging:function(b){g._onChanging(b)},onDestroy:function(b){g._onDestroy(b)}};if(e.getModel){var f=e.getModel();f.getBaseModel&&(f=f.getBaseModel());this.model=f;this.setView(e)}else this.shared=!0,this.model=e;this.model.addEventListener("Changing",
this._listener.onChanging)}m.prototype={getRedoChanges:function(){return[{start:this.offset,end:this.offset+this.previousText.length,text:this.text}]},getUndoChanges:function(){return[{start:this.offset,end:this.offset+this.text.length,text:this.previousText}]},undo:function(e,d){this._doUndoRedo(this.offset,this.previousText,this.text,e,d);return!0},redo:function(e,d){this._doUndoRedo(this.offset,this.text,this.previousText,e,d);return!0},merge:function(e,d,g,f,b){if(f===this.type){if(1===f&&e===
this.offset+this.text.length)return this.text+=d,!0;if(-1===f&&b===this.offset)return this.offset=e,this.previousText=g+this.previousText,!0;if(-1===f&&e===this.offset)return this.previousText+=g,!0}return!1},_doUndoRedo:function(e,d,g,f,b){this.model.setText(d,e,e+g.length);b&&f&&(g=f.getModel(),g!==this.model&&(e=g.mapOffset(e,!0)),f.setSelection(e,e+d.length))}};n.prototype={getRedoChanges:function(){for(var e=[],d=0;d<this.changes.length;d++)e=e.concat(this.changes[d].getRedoChanges());return e},
getUndoChanges:function(){for(var e=[],d=this.changes.length-1;0<=d;d--)e=e.concat(this.changes[d].getUndoChanges());return e},add:function(e){this.changes.push(e)},end:function(e){e&&(this.endSelection=e.getSelection(),this.endCaret=e.getCaretOffset());(e=this.owner)&&e.end&&e.end()},undo:function(e,d){1<this.changes.length&&e&&e.setRedraw(!1);for(var g=this.changes.length-1;0<=g;g--)this.changes[g].undo(e,!1);1<this.changes.length&&e&&e.setRedraw(!0);if(d&&e){var g=this.startSelection.start,f=this.startSelection.end;
e.setSelection(this.startCaret?g:f,this.startCaret?f:g)}(g=this.owner)&&g.undo&&g.undo();return 0<this.changes.length},redo:function(e,d){1<this.changes.length&&e&&e.setRedraw(!1);for(var g=0;g<this.changes.length;g++)this.changes[g].redo(e,!1);(1<this.changes.length,e)&&e.setRedraw(!0);if(d&&e){var g=this.endSelection.start,f=this.endSelection.end;e.setSelection(this.endCaret?g:f,this.endCaret?f:g)}(g=this.owner)&&g.redo&&g.redo();return 0<this.changes.length},merge:function(e,d,g,f,b){var a=this.changes.length;
return 0<a?this.changes[a-1].merge(e,d,g,f,b):!1},start:function(e){e&&(this.startSelection=e.getSelection(),this.startCaret=e.getCaretOffset());(e=this.owner)&&e.start&&e.start()}};k.prototype={destroy:function(){this._onDestroy()},add:function(e){this.compoundChange?this.compoundChange.add(e):(this.stack.splice(this.index,this.stack.length-this.index,e),this.index++,this.stack.length>this.size&&(this.stack.shift(),this.index--))},markClean:function(){this._commitUndo();if(this.cleanChange=this.stack[this.index-
1])this.cleanChange.type=2},isClean:function(){return this.cleanChange===this.stack[this.index-1]},canUndo:function(){return 0<this.index},canRedo:function(){return 0<this.stack.length-this.index},endCompoundChange:function(){this.compoundChange&&this.compoundChange.end(this.view);this.compoundChange=void 0},getSize:function(){return{undo:this.index,redo:this.stack.length-this.index}},getRedoChanges:function(){this._commitUndo();for(var e=[],d=this.index;d<this.stack.length;d++)e=e.concat(this.stack[d].getRedoChanges());
return e},getUndoChanges:function(){this._commitUndo();for(var e=[],d=this.index;0<=d;d--)e=e.concat(this.stack[d].getUndoChanges());return e},undo:function(){this._commitUndo();var e;e=!1;this._ignoreUndo=!0;do{if(0>=this.index)break;e=this.stack[--this.index]}while(!(e=e.undo(this.view,!0)));this._ignoreUndo=!1;return e},redo:function(){this._commitUndo();var e;this._ignoreUndo=!0;do{if(this.index>=this.stack.length)break;e=this.stack[this.index++]}while(!e.redo(this.view,!0));this._ignoreUndo=
!1;return!0},reset:function(){this.index=0;this.cleanChange=void 0;this.stack=[];this._ignoreUndo=!1;this._compoundChange=void 0},setView:function(e){this.view!==e&&(this.view&&e.removeEventListener("Destroy",this._listener.onDestroy),(this.view=e)&&e.addEventListener("Destroy",this._listener.onDestroy))},startCompoundChange:function(e){this._commitUndo();e=new n(e);this.add(e);this.compoundChange=e;this.compoundChange.start(this.view);return this.compoundChange},_commitUndo:function(){this.endCompoundChange()},
_onDestroy:function(e){(!e||!this.shared)&&this.model.removeEventListener("Changing",this._listener.onChanging);this.view&&(this.view.removeEventListener("Destroy",this._listener.onDestroy),this.view=null)},_onChanging:function(e){if(!this._ignoreUndo){var d=e.text,g=e.start,f=e.addedCharCount,b=e.removedCharCount;e=g+b;var a=0;0===f&&1===b?a=-1:1===f&&0===b&&(a=1);f=this.stack.length;b=this.model.getText(g,e);(!(0<f&&this.index===f)||!this.stack[f-1].merge(g,d,b,a,e))&&this.add(new m(this.model,
g,d,b,a))}}};return{UndoStack:k}});
define("orion/editor/rulers",["i18n!orion/editor/nls/messages","orion/editor/annotations","orion/editor/tooltip","orion/util"],function(m,n,k,e){function d(a,b,d,e){this._location=b||"left";this._overview=d||"page";this._rulerStyle=e;this._view=null;var f=this;this._listener={onTextModelChanged:function(a){f._onTextModelChanged(a)},onAnnotationModelChanged:function(a){f._onAnnotationModelChanged(a)}};this.setAnnotationModel(a)}function g(a,b,e,f,g){d.call(this,a,b,"page",e);this._oddStyle=f||{style:{backgroundColor:"white"}};
this._evenStyle=g||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._firstLine=1}function f(a,b,e){d.call(this,a,b,"page",e)}function b(a,b,e){d.call(this,a,b,"document",e)}function a(a,b,d){f.call(this,a,b,d)}d.prototype={getAnnotations:function(a,b){var d=this._annotationModel;if(!d)return[];var e=this._view.getModel(),f=e.getLineStart(a),g=e.getLineEnd(b-1),k=e;e.getBaseModel&&(k=e.getBaseModel(),f=e.mapOffset(f),g=e.mapOffset(g));for(var m=[],d=this.getAnnotationsByType(d,f,g),f=0;f<
d.length;f++)for(var g=d[f],n=k.getLineAtOffset(g.start),v=k.getLineAtOffset(Math.max(g.start,g.end-1)),z=n;z<=v;z++){var A=z;if(e!==k){A=k.getLineStart(z);A=e.mapOffset(A,!0);if(-1===A)continue;A=e.getLineAtOffset(A)}if(a<=A&&A<b){var B=this._mergeAnnotation(m[A],g,z-n,v-n+1);B&&(m[A]=B)}}if(!this._multiAnnotation&&this._multiAnnotationOverlay)for(var u in m)m[u]._multiple&&(m[u].html+=this._multiAnnotationOverlay.html);return m},getAnnotationModel:function(){return this._annotationModel},getLocation:function(){return this._location},
getOverview:function(){return this._overview},getRulerStyle:function(){return this._rulerStyle},getView:function(){return this._view},getWidestAnnotation:function(){return null},setAnnotationModel:function(a){this._annotationModel&&this._annotationModel.removEventListener("Changed",this._listener.onAnnotationModelChanged);(this._annotationModel=a)&&this._annotationModel.addEventListener("Changed",this._listener.onAnnotationModelChanged)},setMultiAnnotation:function(a){this._multiAnnotation=a},setMultiAnnotationOverlay:function(a){this._multiAnnotationOverlay=
a},setView:function(a){this._onTextModelChanged&&this._view&&this._view.removeEventListener("ModelChanged",this._listener.onTextModelChanged);this._view=a;this._onTextModelChanged&&this._view&&this._view.addEventListener("ModelChanged",this._listener.onTextModelChanged)},onClick:function(a,b){if(void 0!==a){var d=this._view,e=d.getModel(),f=e,g=e.getLineStart(a),m=g,n=g,x=this._annotationModel;if(x){d=d.getSelection();n=e.getLineEnd(a,!0);g<=d.start&&d.start<n&&(g=d.start);e.getBaseModel&&(g=e.mapOffset(g),
n=e.mapOffset(n),f=e.getBaseModel());for(var v,n=x.getAnnotations(g,n),x=null;!v&&n.hasNext();)d=n.next(),this.isAnnotationTypeVisible(d.type)&&(x=d,d.start<=g||(v=d));x&&void 0!==x.groupId&&(this._currentClickGroup=this._currentClickGroup===x.groupId?null:x.groupId,this._setCurrentGroup(a));v&&f.getLineAtOffset(v.start)===f.getLineAtOffset(g)?(g=v.start,n=v.end):n=g=m;e.getBaseModel&&(g=e.mapOffset(g,!0),n=e.mapOffset(n,!0))}(e=k.Tooltip.getTooltip(this._view))&&e.setTarget(null);this._view.setSelection(n,
g,1/3,function(){})}},onDblClick:function(a,b){},onMouseMove:function(a,b){var d=k.Tooltip.getTooltip(this._view);if(d&&!(d.isVisible()&&this._tooltipLineIndex===a)){this._tooltipLineIndex=a;var e=this;d.setTarget({y:b.clientY,getTooltipInfo:function(){return e._getTooltipInfo(e._tooltipLineIndex,this.y)}})}},onMouseOver:function(a,b){this.onMouseMove(a,b);this._currentClickGroup||this._setCurrentGroup(a)},onMouseOut:function(a,b){this._currentClickGroup||this._setCurrentGroup(-1);var d=k.Tooltip.getTooltip(this._view);
d&&d.setTarget(null)},_getTooltipInfo:function(a,b){if(void 0!==a){var d=this._view,e=d.getModel(),f=this._annotationModel,g=[];if(f){var g=e.getLineStart(a),k=e.getLineEnd(a);e.getBaseModel&&(g=e.mapOffset(g),k=e.mapOffset(k));g=this.getAnnotationsByType(f,g,k)}f=this._getTooltipContents(a,g);if(!f)return null;f={contents:f,anchor:this.getLocation()};g=d.getClientArea();"document"===this.getOverview()?g.y=d.convert({y:b},"view","document").y:g.y=d.getLocationAtOffset(e.getLineStart(a)).y;d.convert(g,
"document","page");f.x=g.x;f.y=g.y;"right"===f.anchor&&(f.x+=g.width);return f}},_getTooltipContents:function(a,b){return b},_onAnnotationModelChanged:function(a){function b(a){for(var h=0;h<a.length;h++)if(f.isAnnotationTypeVisible(a[h].type)){var l=a[h].start,g=a[h].end;e.getBaseModel&&(l=e.mapOffset(l,!0),g=e.mapOffset(g,!0));-1!==l&&-1!==g&&d.redrawLines(e.getLineAtOffset(l),e.getLineAtOffset(Math.max(l,g-1))+1,f)}}var d=this._view;if(d){var e=d.getModel(),f=this,g=e.getLineCount();a.textModelChangedEvent?
(a=a.textModelChangedEvent.start,e.getBaseModel&&(a=e.mapOffset(a,!0)),a=e.getLineAtOffset(a),d.redrawLines(a,g,f)):(b(a.added),b(a.removed),b(a.changed))}},_mergeAnnotation:function(a,b,d,e){a||(a={});0===d&&(a.html&&b.html?(b.html!==a.html&&(!a._multiple&&this._multiAnnotation)&&(a.html=this._multiAnnotation.html),a._multiple=!0):a.html=b.html);a.style=this._mergeStyle(a.style,b.style);return a},_mergeStyle:function(a,b){if(b){a||(a={});a.styleClass=a.styleClass&&b.styleClass&&a.styleClass!==b.styleClass?
a.styleClass+(" "+b.styleClass):b.styleClass;var d;if(b.style)for(d in a.style||(a.style={}),b.style)void 0===a.style[d]&&(a.style[d]=b.style[d]);if(b.attributes)for(d in a.attributes||(a.attributes={}),b.attributes)void 0===a.attributes[d]&&(a.attributes[d]=b.attributes[d])}return a},_setCurrentGroup:function(a){var b=this._annotationModel,d=null,e=b.getTextModel(),f,g=this._currentGroupAnnotation;if(-1!==a){var k=e.getLineStart(a),m=e.getLineEnd(a);e.getBaseModel&&(k=e.mapOffset(k),m=e.mapOffset(m));
for(f=b.getAnnotations(k,m);f.hasNext();)if(e=f.next(),this.isAnnotationTypeVisible(e.type)&&e.start<=k&&e.end>=m&&void 0!==e.groupId){d=e;break}if(g&&d&&g.groupId===d.groupId)return}this._currentGroupAnnotation=null;g&&b.removeAnnotations(g.groupType);if(d&&-1!==a){this._currentGroupAnnotation=d;f=b.getAnnotations();for(a=[];f.hasNext();)e=f.next(),delete e.groupAnnotation,e.groupId===d.groupId&&(e=e.createGroupAnnotation(),a.push(e));b.replaceAnnotations(null,a)}}};n.AnnotationTypeList.addMixin(d.prototype);
g.prototype=new d;g.prototype.getAnnotations=function(a,b){for(var e=d.prototype.getAnnotations.call(this,a,b),f=this._view.getModel(),g=a;g<b;g++){var k=g&1?this._oddStyle:this._evenStyle,m=g;f.getBaseModel&&(m=f.getLineStart(m),m=f.getBaseModel().getLineAtOffset(f.mapOffset(m)));e[g]||(e[g]={});e[g].html=this._firstLine+m+"";e[g].style||(e[g].style=k)}return e};g.prototype.getWidestAnnotation=function(){var a=this._view.getModel().getLineCount();return this.getAnnotations(a-1,a)[a-1]};g.prototype.setFirstLine=
function(a){this._firstLine=void 0!==a?a:1};g.prototype._onTextModelChanged=function(a){var b=a.start;a=this._view.getModel();var d=a.getBaseModel?a.getBaseModel().getLineCount():a.getLineCount(),d=(this._firstLine+d-1+"").length;this._numOfDigits!==d&&(this._numOfDigits=d,b=a.getLineAtOffset(b),this._view.redrawLines(b,a.getLineCount(),this))};f.prototype=new d;b.prototype=new d;b.prototype.getRulerStyle=function(){var a={style:{lineHeight:"1px",fontSize:"1px"}};return a=this._mergeStyle(a,this._rulerStyle)};
b.prototype._getTooltipContents=function(a,b){if(0===b.length){var f=this._view.getModel(),g=a;f.getBaseModel&&(g=f.getLineStart(g),g=f.getBaseModel().getLineAtOffset(f.mapOffset(g)));return e.formatMessage(m.line,g+1)}return d.prototype._getTooltipContents.call(this,a,b)};b.prototype._mergeAnnotation=function(a,b,d,e){if(0===d)return a||(a={html:"\x26nbsp;",style:{style:{height:3*e+"px"}}},a.style=this._mergeStyle(a.style,b.overviewStyle)),a};a.prototype=new f;a.prototype.onClick=function(a,b){if(void 0!==
a){var d=this._annotationModel;if(d){var e=this._view.getModel(),f=e.getLineStart(a),g=e.getLineEnd(a,!0);e.getBaseModel&&(f=e.mapOffset(f),g=e.mapOffset(g),e=e.getBaseModel());for(var m,d=d.getAnnotations(f,g);!m&&d.hasNext();)g=d.next(),this.isAnnotationTypeVisible(g.type)&&e.getLineAtOffset(g.start)===e.getLineAtOffset(f)&&(m=g);m&&((e=k.Tooltip.getTooltip(this._view))&&e.setTarget(null),m.expanded?m.collapse():m.expand())}}};a.prototype._getTooltipContents=function(a,b){if(0<b.length){var d=this._view.getModel(),
e=d.getLineStart(a);d.getBaseModel&&(e=d.mapOffset(e),d=d.getBaseModel());for(var e=d.getLineAtOffset(e),g=0;g<b.length;g++){var k=b[g];if(this.isAnnotationTypeVisible(k.type)&&d.getLineAtOffset(k.start)===e){if(b[g].expanded)break;return f.prototype._getTooltipContents.call(this,a,[k])}}}return null};a.prototype._onAnnotationModelChanged=function(a){function b(a){for(k=0;k<a.length;k++)if(g.isAnnotationTypeVisible(a[k].type)){var d=a[k].start;e.getBaseModel&&(d=e.mapOffset(d,!0));-1!==d&&(n=Math.min(n,
e.getLineAtOffset(d)))}}if(a.textModelChangedEvent)f.prototype._onAnnotationModelChanged.call(this,a);else{var d=this._view;if(d){var e=d.getModel(),g=this,k,m=e.getLineCount(),n=m;b(a.added);b(a.removed);b(a.changed);a=d.getRulers();for(k=0;k<a.length;k++)d.redrawLines(n,m,a[k])}}};return{Ruler:d,AnnotationRuler:f,LineNumberRuler:g,OverviewRuler:b,FoldingRuler:a}});
define("orion/editor/textDND",["orion/util"],function(m){function n(k,e){this._view=k;this._undoStack=e;this._dragSelection=null;this._dropOffset=-1;this._dropText=null;var d=this;this._listener={onDragStart:function(e){d._onDragStart(e)},onDragEnd:function(e){d._onDragEnd(e)},onDragEnter:function(e){d._onDragEnter(e)},onDragOver:function(e){d._onDragOver(e)},onDrop:function(e){d._onDrop(e)},onDestroy:function(e){d._onDestroy(e)}};k.addEventListener("DragStart",this._listener.onDragStart);k.addEventListener("DragEnd",
this._listener.onDragEnd);k.addEventListener("DragEnter",this._listener.onDragEnter);k.addEventListener("DragOver",this._listener.onDragOver);k.addEventListener("Drop",this._listener.onDrop);k.addEventListener("Destroy",this._listener.onDestroy)}n.prototype={destroy:function(){var k=this._view;k&&(k.removeEventListener("DragStart",this._listener.onDragStart),k.removeEventListener("DragEnd",this._listener.onDragEnd),k.removeEventListener("DragEnter",this._listener.onDragEnter),k.removeEventListener("DragOver",
this._listener.onDragOver),k.removeEventListener("Drop",this._listener.onDrop),k.removeEventListener("Destroy",this._listener.onDestroy),this._view=null)},_onDestroy:function(k){this.destroy()},_onDragStart:function(k){var e=this._view,d=e.getSelection(),e=e.getModel();e.getBaseModel&&(d.start=e.mapOffset(d.start),d.end=e.mapOffset(d.end),e=e.getBaseModel());if(e=e.getText(d.start,d.end))this._dragSelection=d,k.event.dataTransfer.effectAllowed="copyMove",k.event.dataTransfer.setData("Text",e)},_onDragEnd:function(k){if(this._dragSelection){var e=
this._view,d=k.event.dataTransfer.dropEffect;if(!m.isFirefox&&("none"!==d||this._dropText))d=k.event.dataTransfer.dropEffect=this._dropEffect;this._undoStack&&this._undoStack.startCompoundChange();(k="move"===d)&&e.setText("",this._dragSelection.start,this._dragSelection.end);if(this._dropText){var d=this._dropText,g=this._dropOffset;k&&(g>=this._dragSelection.end?g-=this._dragSelection.end-this._dragSelection.start:g>=this._dragSelection.start&&(g=this._dragSelection.start));e.setText(d,g,g);e.setSelection(g,
g+d.length);this._dropText=null;this._dropOffset=-1}this._undoStack&&this._undoStack.endCompoundChange()}this._dragSelection=null},_onDragEnter:function(k){this._onDragOver(k)},_onDragOver:function(k){var e=k.event.dataTransfer.types,d=!this._view.getOptions("readonly");d&&e&&(d=e.contains?e.contains("text/plain")||e.contains("Text"):-1!==e.indexOf("text/plain")||-1!==e.indexOf("Text"));d?m.isFirefox||(this._dropEffect=k.event.dataTransfer.dropEffect=(m.isMac?k.event.altKey:k.event.ctrlKey)?"copy":
"move"):k.event.dataTransfer.dropEffect="none"},_onDrop:function(k){var e=this._view,d=k.event.dataTransfer.getData("Text");d&&(m.isFirefox||(k.event.dataTransfer.dropEffect=this._dropEffect),k=e.getOffsetAtLocation(k.x,k.y),this._dragSelection?(this._dropOffset=k,this._dropText=d):(e.setText(d,k,k),e.setSelection(k,k+d.length)))}};return{TextDND:n}});
define("orion/editor/templates",[],function(){function m(k,e,d,g){this.prefix=k;this.description=e;this.template=d;this.name=g;this._parse()}function n(k,e){this._keywords=k||[];this._templates=[];this.addTemplates(e||[])}m.prototype={getProposal:function(k,e,d){k=e-k.length;e={};var g,f=void 0!==d.delimiter?d.delimiter:"\n";d.indentation&&(f+=d.indentation);var b=void 0!==d.tab?d.tab:"\t",a=0,l=this.variables,h=this.segments;d=[];for(var m=0;m<h.length;m++){var q=h[m],r=l[q];if(void 0!==r)switch(q){case "${tab}":q=
b;break;case "${delimiter}":q=f;break;case "${cursor}":q="";g=a;break;default:var n=e[q];n||(n=e[q]={data:r.data,positions:[]});q=r.substitution;n.data&&n.data.values&&(q=n.data.values[0]);n.positions.push({offset:k+a,length:q.length})}d.push(q);a+=q.length}var f=[],w;for(w in e)e.hasOwnProperty(w)&&f.push(e[w]);d=d.join("");void 0===g&&(g=d.length);return{proposal:d,name:this.name,description:this.description,groups:f,escapePosition:k+g,style:"noemphasis"}},match:function(k){return 0===this.prefix.indexOf(k)},
_parse:function(){var k=this.template,e=[],d={},g,f=0,k=k.replace(/\n/g,"${delimiter}"),k=k.replace(/\t/g,"${tab}");k.replace(/\$\{((?:[^\\}]+|\\.))*\}/g,function(b,a,l){var h=b.substring(2,b.length-1);a=b;var m=h,q=null,r=m.indexOf(":");-1!==r&&(m=m.substring(0,r),a="${"+m+"}",q=JSON.parse(h.substring(r+1).replace("\\}","}").trim()));(h=d[a])||(h=d[a]={});h.substitution=m;q&&(h.data=q);(g=k.substring(f,l))&&e.push(g);e.push(a);f=l+b.length;return m});(g=k.substring(f,k.length))&&e.push(g);this.segments=
e;this.variables=d}};n.prototype={addTemplates:function(k){for(var e=this.getTemplates(),d=0;d<k.length;d++)e.push(new m(k[d].prefix,k[d].description,k[d].template,k[d].name))},initialize:function(){},computeProposals:function(k,e,d){var g=this.getPrefix(k,e,d),f=[];this.isValid(g,k,e,d)&&(f=f.concat(this.getTemplateProposals(g,e,d)),f=f.concat(this.getKeywordProposals(g)));return f},getKeywords:function(){return this._keywords},getKeywordProposals:function(k){var e=[],d=this.getKeywords();if(d){for(var g=
0;g<d.length;g++)0===d[g].indexOf(k)&&e.push({proposal:d[g].substring(k.length),description:d[g],style:"noemphasis_keyword"});0<e.length&&e.splice(0,0,{proposal:"",description:"Keywords",style:"noemphasis_title_keywords",unselectable:!0})}return e},getPrefix:function(k,e,d){return d.prefix},getTemplates:function(){return this._templates},getTemplateProposals:function(k,e,d){for(var g=[],f=this.getTemplates(),b=0;b<f.length;b++){var a=f[b];a.match(k)&&(a=a.getProposal(k,e,d),this.removePrefix(k,a),
g.push(a))}0<g.length&&(g.sort(function(a,b){return a.name<b.name?-1:a.name>b.name?1:0}),g.splice(0,0,{proposal:"",description:"Templates",style:"noemphasis_title",unselectable:!0}));return g},removePrefix:function(k,e){if(!(e.overwrite=e.proposal.substring(0,k.length)!==k))e.proposal=e.proposal.substring(k.length)},isValid:function(k,e,d,g){return!0}};return{Template:m,TemplateContentAssist:n}});
define("orion/editor/linkedMode","i18n!orion/editor/nls/messages orion/keyBinding orion/editor/keyModes orion/editor/annotations orion/editor/templates orion/objects orion/util".split(" "),function(m,n,k,e,d,g){function f(a,b,d){var e=a.getTextView();k.KeyMode.call(this,e);this.editor=a;this.undoStack=b;this.contentAssist=d;this.linkedModeModel=null;e.setAction("linkedModeEnter",function(){this.exitLinkedMode(!0);return!0}.bind(this));e.setAction("linkedModeCancel",function(){this.exitLinkedMode(!1);
return!0}.bind(this));e.setAction("linkedModeNextGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup((a.selectedGroupIndex+1)%a.groups.length);return!0}.bind(this));e.setAction("linkedModePreviousGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup(0<a.selectedGroupIndex?a.selectedGroupIndex-1:a.groups.length-1);return!0}.bind(this));this.linkedModeListener={onActivating:function(a){this._groupContentAssistProvider&&(this.contentAssist.setProviders([this._groupContentAssistProvider]),
this.contentAssist.setProgress(null))}.bind(this),onModelChanged:function(a){if(!this.ignoreVerify){for(var b=this.editor.mapOffset(a.start),d=this.linkedModeModel,e,f;d;)if(e=this._getPositionChanged(d,b,b+a.removedCharCount),f=e.position,void 0===f||f.model!==d)this.exitLinkedMode(!1),d=this.linkedModeModel;else break;if(d){d=0;a=a.addedCharCount-a.removedCharCount;e=e.positions;for(var h,g=0;g<e.length;++g){h=e[g];f=h.position;var l=f.offset<=b&&b<=f.offset+f.length;l&&!h.ansestor?(f.offset+=d,
f.length+=a,d+=a):(f.offset+=d,h.ansestor&&l&&(f.length+=a));h.escape&&(h.model.escapePosition=f.offset)}this._updateAnnotations(e)}}}.bind(this),onVerify:function(a){if(!this.ignoreVerify){for(var b=this.editor,d=b.mapOffset(a.start),e=this.editor.mapOffset(a.end),f=this.linkedModeModel,h,g;f;)if(h=this._getPositionChanged(f,d,e),g=h.position,void 0===g||g.model!==f)this.exitLinkedMode(!1),f=this.linkedModeModel;else break;if(f){var l=this._compoundChange;l?l.owner.model===f&&l.owner.group===g.group||
(this.endUndo(),this.startUndo()):this.startUndo();f.selectedGroupIndex=g.group;var l=0,k=a.text.length-(e-d);h=h.positions;for(var m,d=d-g.position.offset,p=e-g.position.offset,n=0;n<h.length;++n)m=h[n],e=m.position,m.oldOffset=e.offset,m.model===f&&m.group===g.group?(e.offset+=l,e.length+=k,l+=k):(e.offset+=l,m.ansestor&&(e.length+=g.count*k)),m.escape&&(m.model.escapePosition=e.offset);this.ignoreVerify=!0;for(n=h.length-1;0<=n;n--)m=h[n],m.model===f&&m.group===g.group&&b.setText(a.text,m.oldOffset+
d,m.oldOffset+p);this.ignoreVerify=!1;a.text=null;this._updateAnnotations(h)}}}.bind(this)}}var b={};f.prototype=new k.KeyMode;g.mixin(f.prototype,{createKeyBindings:function(){var a=n.KeyBinding,b=[];b.push({actionID:"linkedModeEnter",keyBinding:new a(13)});b.push({actionID:"linkedModeCancel",keyBinding:new a(27)});b.push({actionID:"linkedModeNextGroup",keyBinding:new a(9)});b.push({actionID:"linkedModePreviousGroup",keyBinding:new a(9,!1,!0)});return b},enterLinkedMode:function(a){if(!this.linkedModeModel){var b=
this.editor.getTextView();b.addKeyMode(this);b.addEventListener("Verify",this.linkedModeListener.onVerify);b.addEventListener("ModelChanged",this.linkedModeListener.onModelChanged);this.contentAssist.addEventListener("Activating",this.linkedModeListener.onActivating);this.editor.reportStatus(m.linkedModeEntered,null,!0)}this._sortedPositions=null;this.linkedModeModel&&(a.previousModel=this.linkedModeModel,a.parentGroup=this.linkedModeModel.selectedGroupIndex,this.linkedModeModel.nextModel=a);this.linkedModeModel=
a;this.selectLinkedGroup(0)},exitLinkedMode:function(a){if(this.isActive()){this._compoundChange&&(this.endUndo(),this._compoundChange=null);this._sortedPositions=null;var b=this.linkedModeModel;this.linkedModeModel=b.previousModel;b.parentGroup=b.previousModel=void 0;this.linkedModeModel&&(this.linkedModeModel.nextModel=void 0);if(!this.linkedModeModel){var d=this.editor,e=d.getTextView();e.removeKeyMode(this);e.removeEventListener("Verify",this.linkedModeListener.onVerify);e.removeEventListener("ModelChanged",
this.linkedModeListener.onModelChanged);e=this.contentAssist;e.removeEventListener("Activating",this.linkedModeListener.onActivating);e.offset=void 0;this.editor.reportStatus(m.linkedModeExited,null,!0);a&&d.setCaretOffset(b.escapePosition,!1)}this.selectLinkedGroup(0)}},startUndo:function(){if(this.undoStack){var a=this,b=this.linkedModeModel;this._compoundChange=this.undoStack.startCompoundChange({model:b,group:b.selectedGroupIndex,end:function(){a._compoundChange=null}})}},endUndo:function(){this.undoStack&&
this.undoStack.endCompoundChange()},isActive:function(){return!!this.linkedModeModel},isStatusActive:function(){return!!this.linkedModeModel},selectLinkedGroup:function(a){var b=this.linkedModeModel;if(b){b.selectedGroupIndex=a;a=b.groups[a];var e=a.positions[0],f=this.editor;f.setSelection(e.offset,e.offset+e.length);if(b=this.contentAssist)b.offset=void 0,a.data&&"link"===a.data.type&&a.data.values?((this._groupContentAssistProvider=new d.TemplateContentAssist(a.data.values)).getPrefix=function(){var a=
f.getSelection();return a.start===a.end&&(a=f.getCaretOffset(),e.offset<=a&&a<=e.offset+e.length)?f.getText(e.offset,a):""},b.offset=e.offset,b.deactivate(),b.activate()):this._groupContentAssistProvider&&(this._groupContentAssistProvider=null,b.deactivate())}this._updateAnnotations()},_getModelPositions:function(a,b,d){for(var e=b.groups,f=0;f<e.length;f++)for(var g=e[f].positions,k=0;k<g.length;k++){var m=g[k];d&&(m={offset:m.offset+d,length:m.length});m={index:k,group:f,count:g.length,model:b,
position:m};a.push(m);b.nextModel&&b.nextModel.parentGroup===f&&(m.ansestor=!0,this._getModelPositions(a,b.nextModel,(d||0)+g[k].offset-g[0].offset))}},_getSortedPositions:function(a){var b=this._sortedPositions;if(!b){for(b=[];a.previousModel;)a=a.previousModel;for(this._getModelPositions(b,a);a;)void 0!==a.escapePosition&&b.push({escape:!0,model:a,position:{offset:a.escapePosition,length:0}}),a=a.nextModel;b.sort(function(a,b){return a.position.offset-b.position.offset});this._sortedPositions=b}return b},
_getPositionChanged:function(a,b,d){var e;a=this._getSortedPositions(a);for(var f=a.length-1;0<=f;f--){var g=a[f].position;if(g.offset<=b&&d<=g.offset+g.length){e=a[f];break}}return{position:e,positions:a}},_updateAnnotations:function(a){var b=this.editor.getAnnotationModel();if(b){for(var d=[],f=[],g=b.getAnnotations(),k;g.hasNext();)switch(k=g.next(),k.type){case e.AnnotationType.ANNOTATION_LINKED_GROUP:case e.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP:case e.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:d.push(k)}if(g=
this.linkedModeModel){a=a||this._getSortedPositions(g);for(var m=0;m<a.length;m++)if(k=a[m],k.model===g){var n=e.AnnotationType.ANNOTATION_LINKED_GROUP;k.group===g.selectedGroupIndex&&(n=0===k.index?e.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:e.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP);k=k.position;k=e.AnnotationType.createAnnotation(n,k.offset,k.offset+k.length,"");f.push(k)}}b.replaceAnnotations(d,f)}}});b.LinkedMode=f;return b});
define("orion/editor/factories","orion/editor/actions orion/editor/undoStack orion/editor/rulers orion/editor/annotations orion/editor/textDND orion/editor/linkedMode".split(" "),function(m,n,k,e,d,g){function f(){}function b(){}function a(){}function l(){}function h(){}function p(){}var q={};f.prototype={createKeyBindings:function(a,b,d,e){e=new m.TextActions(a,b,e);var f=new g.LinkedMode(a,b,d);a=new m.SourceCodeActions(a,b,d,f);return{textActions:e,linkedMode:f,sourceCodeActions:a}}};q.KeyBindingsFactory=
f;b.prototype={createUndoStack:function(a){a=a.getTextView();return new n.UndoStack(a,200)}};q.UndoFactory=b;a.prototype={createLineNumberRuler:function(a){return new k.LineNumberRuler(a,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"})}};q.LineNumberRulerFactory=a;l.prototype={createFoldingRuler:function(a){return new k.FoldingRuler(a,"left",{styleClass:"ruler folding"})}};q.FoldingRulerFactory=l;h.prototype={createAnnotationModel:function(a){return new e.AnnotationModel(a)},
createAnnotationStyler:function(a,b){return new e.AnnotationStyler(a,b)},createAnnotationRulers:function(a){var b=new k.AnnotationRuler(a,"left",{styleClass:"ruler annotations"});a=new k.OverviewRuler(a,"right",{styleClass:"ruler overview"});return{annotationRuler:b,overviewRuler:a}}};q.AnnotationFactory=h;p.prototype={createTextDND:function(a,b){return new d.TextDND(a.getTextView(),b)}};q.TextDNDFactory=p;return q});
define("orion/editor/editorFeatures",["orion/editor/factories","orion/editor/actions","orion/editor/linkedMode","orion/objects"],function(m,n,k,e){return e.mixin({},m,n,k)});
var JsDiff=function(){function m(b){for(var a=[],d=0;d<b.length;d++)b[d]&&a.push(b[d]);return a}function n(b){b=b.replace(/&/g,"\x26amp;");b=b.replace(/</g,"\x26lt;");b=b.replace(/>/g,"\x26gt;");return b=b.replace(/"/g,"\x26quot;")}var k=function(b){this.ignoreWhitespace=b};k.prototype={diff:function(b,a){if(a==b)return[{value:a}];if(!a)return[{value:b,removed:!0}];if(!b)return[{value:a,added:!0}];a=this.tokenize(a);b=this.tokenize(b);var d=a.length,e=b.length,f=d+e,g=[{newPos:-1,components:[]}],
k=this.extractCommon(g[0],a,b,0);if(g[0].newPos+1>=d&&k+1>=e)return g[0].components;for(var m=1;m<=f;m++)for(var n=-1*m;n<=m;n+=2){var s;s=g[n-1];var x=g[n+1],k=(x?x.newPos:0)-n;s&&(g[n-1]=void 0);var v=s&&s.newPos+1<d,z=x&&0<=k&&k<e;if(!v&&!z)g[n]=void 0;else{!v||z&&s.newPos<x.newPos?(s={newPos:x.newPos,components:x.components.slice(0)},this.pushComponent(s.components,b[k],void 0,!0)):(s={newPos:s.newPos,components:s.components.slice(0)},s.newPos++,this.pushComponent(s.components,a[s.newPos],!0,
void 0));k=this.extractCommon(s,a,b,n);if(s.newPos+1>=d&&k+1>=e)return s.components;g[n]=s}}},pushComponent:function(b,a,d,e){var f=b[b.length-1];f&&f.added===d&&f.removed===e?b[b.length-1]={value:this.join(f.value,a),added:d,removed:e}:b.push({value:a,added:d,removed:e})},extractCommon:function(b,a,d,e){var f=a.length,g=d.length,k=b.newPos;for(e=k-e;k+1<f&&e+1<g&&this.equals(a[k+1],d[e+1]);)k++,e++,this.pushComponent(b.components,a[k],void 0,void 0);b.newPos=k;return e},equals:function(b,a){var d=
/\S/;return this.ignoreWhitespace&&!d.test(b)&&!d.test(a)?!0:b==a},join:function(b,a){return b+a},tokenize:function(b){return b}};var e=new k,d=new k(!1);d.tokenize=function(b){return m(b.split(/(\s+|\b)/))};var g=new k(!0);g.tokenize=function(b){return m(b.split(/([{}:;,]|\s+)/))};var f=new k;f.tokenize=function(b){return b.split(/^/m)};return{diffChars:function(b,a){return e.diff(b,a)},diffWords:function(b,a){return d.diff(b,a)},diffLines:function(b,a){return f.diff(b,a)},diffCss:function(b,a){return g.diff(b,
a)},createPatch:function(b,a,d,e,g){var k=[];k.push("Index: "+b);k.push("\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d");k.push("--- "+b+"\t"+e);k.push("+++ "+b+"\t"+g);b=f.diff(a,d);b.push({value:"",lines:[]});d=a=0;e=[];for(var m=g=1,n=0;n<b.length;n++){var w=b[n],s=w.lines||
w.value.replace(/\n$/,"").split("\n");w.lines=s;if(w.added||w.removed){if(!a){var x=b[n-1];a=g;d=m;x&&(e.push.apply(e,x.lines.slice(-4).map(function(a){return" "+a})),a-=4,d-=4)}e.push.apply(e,s.map(function(a){return(w.added?"+":"-")+a}));w.added?m+=s.length:g+=s.length}else a&&(8>=s.length&&n<b.length-1?e.push.apply(e,s.map(function(a){return" "+a})):(x=Math.min(s.length,4),k.push("@@ -"+a+","+(g-a+x)+" +"+d+","+(m-d+x)+" @@"),k.push.apply(k,e),k.push.apply(k,s.slice(0,x).map(function(a){return" "+
a})),d=a=0,e=[])),g+=s.length,m+=s.length}1<b.length&&!/\n$/.test(b[b.length-2].value)&&k.push("\\ No newline at end of file\n");return k.join("\n")},convertChangesToXML:function(b){for(var a=[],d=0;d<b.length;d++){var e=b[d];e.added?a.push("\x3cins\x3e"):e.removed&&a.push("\x3cdel\x3e");a.push(n(e.value));e.added?a.push("\x3c/ins\x3e"):e.removed&&a.push("\x3c/del\x3e")}return a.join("")}}}();"undefined"!==typeof module&&(module.exports=JsDiff);
"function"===typeof define&&define.amd&&define("jsdiff/diff",[],function(){return JsDiff});
define("orion/compare/jsdiffAdapter",["jsdiff/diff"],function(m){var n=n||{};n.JSDiffAdapter=function(){function k(){}k.prototype={_specialLine:function(e,d,g){return d.value===e&&g!==e},adapt:function(e,d,g){g||(g="\n");var f=e.split(g),b=d.split(g),a=""===f[f.length-1],b=""===b[b.length-1],l=m.diffLines(e,d);e=[];d=[];for(var h=0,k=0,n=-1,r=0,t=!0,w=g,s=0;s<l.length;s++){var x=l[s],v=x.lines||x.value.split(g),z=v.length,A=0;1<v.length&&""===v[v.length-1]&&z--;1<z&&!t&&""===v[0]&&(z--,A++);x.lines=
v;if(!x.added&&!x.removed){if(!this._specialLine(g,x,w)){if(h||k)e.push([h,k,n]),k=h=0,n=-1,r+=k;e.push([z,z,0]);r+=z}}else if(x.added){-1===n&&(n=d.length+1);h+=z;for(t=A;t<z+A;t++)d.push(x.lines[t])}else k+=z;t=!1;1<v.length&&""===v[v.length-1]&&(t=!0);w=x.value?x.value[x.value.length-1]:g}if(h||k)e.push([h,k,n]),r+=k;r<f.length&&1<f.length&&(g=e[e.length-1],0===g[2]?(g[0]+=1,g[1]+=1):-1===g[2]?e.push([1,1,0]):a===b?e.push([1,1,0]):(b&&(g[0]+=1),a&&(g[1]+=1)));return{mapper:e,changContents:{array:d,
index:0}}},adaptCharDiff:function(e,d,g){e=g?m.diffWords(e,d):m.diffChars(e,d);d=[];for(var f=g=0,b=0,a=0,l=0;l<e.length;l++){var h=e[l];if(!h.added&&!h.removed){if(0<b||0<a)d.push([f,f+b,g,g+a]),f+=b,g+=a,a=b=0;f+=h.value.length;g+=h.value.length}else h.added?b+=h.value.length:a+=h.value.length}(0<b||0<a)&&d.push([f,f+b,g,g+a]);return d}};return k}();return n});
define("orion/compare/diffTreeNavigator",["orion/treeModelIterator","orion/compare/compareUtils","orion/editor/annotations","orion/compare/jsdiffAdapter"],function(m,n,k,e){var d={},g,f,b,a,l,h,p,q,r,t,w,s,x,v,z,A;d.DiffTreeNavigator=function(){function d(a,b,e,f,h,g){this._root={type:"root",children:[]};this._initialized=!1;this.initAll(a,b,e,f,h,g)}g="orion.annotation.diff.addedBlock";f="orion.annotation.diff.currentAddedBlock";b="orion.annotation.diff.deletedBlock";a="orion.annotation.diff.currentDeletedBlock";
l="orion.annotation.diff.blockTop";h="orion.annotation.diff.currentBlockTop";p="orion.annotation.diff.blockConflict";q="orion.annotation.diff.currentBlockConflict";r="orion.annotation.diff.addedWord";t="orion.annotation.diff.currentAddedWord";w="orion.annotation.diff.deletedWord";s="orion.annotation.diff.currentDeletedWord";x="orion.annotation.diff.emptyDeletedWordLeft";v="orion.annotation.diff.emptyDeletedWordRight";z="orion.annotation.diff.emptyAddedWordLeft";A="orion.annotation.diff.emptyAddedWordRight";
k.AnnotationType.registerType(g,{title:"",html:"",lineStyle:{styleClass:"annotationLine addedBlockDiff"}});k.AnnotationType.registerType(f,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentAddedBlockDiff"}});k.AnnotationType.registerType(b,{title:"",html:"",lineStyle:{styleClass:"annotationLine deletedBlockDiff"}});k.AnnotationType.registerType(a,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentDeletedBlockDiff"}});k.AnnotationType.registerType(l,{title:"",html:"",lineStyle:{styleClass:"annotationLine blockDiffTopOnly"}});
k.AnnotationType.registerType(h,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentBlockDiffTopOnly"}});k.AnnotationType.registerType(p,{title:"",html:"",lineStyle:{styleClass:"annotationLine blockDiffConflict"}});k.AnnotationType.registerType(q,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentBlockDiffConflict"}});k.AnnotationType.registerType(r,{title:"word added",html:"",rangeStyle:{styleClass:"annotationRange addedWordDiff"}});k.AnnotationType.registerType(t,{title:"",
html:"",rangeStyle:{styleClass:"annotationRange currentAddedWordDiff"}});k.AnnotationType.registerType(w,{title:"word deleted",html:"",rangeStyle:{styleClass:"annotationRange deletedWordDiff"}});k.AnnotationType.registerType(s,{title:"",html:"",rangeStyle:{styleClass:"annotationRange currentDeletedWordDiff"}});k.AnnotationType.registerType(x,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyDeletedWordDiffLeft"}});k.AnnotationType.registerType(v,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyDeletedWordDiffRight"}});
k.AnnotationType.registerType(z,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyAddedWordDiffLeft"}});k.AnnotationType.registerType(A,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyAddedWordDiffRight"}});d.prototype={initAll:function(a,b,d,e,f,h,g){this._charOrWordDiff=a?a:"word";b&&(this._initialized=!0);this.editorWrapper=[{editor:b,diffFeeder:e},{editor:d,diffFeeder:f}];this._curveRuler=g;(this._overviewRuler=h)&&this._overviewRuler.setDiffNavigator(this)},initMapper:function(a){if(a)for(var b=
0;b<this.editorWrapper.length;b++)this.editorWrapper[b].diffFeeder.init(this.editorWrapper[b].editor.getTextView().getModel(),a)},destroy:function(){this.initAll(this._charOrWordDiff)},renderAnnotations:function(){var a;for(a=0;a<this.editorWrapper.length;a++){this.editorWrapper[a].annoTypes=[];this.editorWrapper[a].diffFeeder.getBlockAnnoTypes(this.editorWrapper[a].annoTypes);this.editorWrapper[a].diffFeeder.getWordAnnoTypes(this.editorWrapper[a].annoTypes);for(var b=0;b<this.editorWrapper[a].annoTypes.length;b++)this.editorWrapper[a].annoTypes[b].current&&
this.editorWrapper[a].editor.getAnnotationStyler().addAnnotationType(this.editorWrapper[a].annoTypes[b].current),this.editorWrapper[a].annoTypes[b].normal&&this.editorWrapper[a].editor.getAnnotationStyler().addAnnotationType(this.editorWrapper[a].annoTypes[b].normal)}this._root.children=[];b=this.editorWrapper[0].diffFeeder.getDiffBlocks();if(!b||0===b.length)this.replaceAllAnnotations(!0,0,"block",!1,[]),this.replaceAllAnnotations(!0,1,"block",!1,[]),this.replaceAllAnnotations(!0,0,"word",!1,[]),
this.replaceAllAnnotations(!0,1,"word",!1,[]),this.replaceAllAnnotations(!0,0,"block",!0,[]),this.replaceAllAnnotations(!0,1,"block",!0,[]),this.replaceAllAnnotations(!0,0,"word",!0,[]),this.replaceAllAnnotations(!0,1,"word",!0,[]);else{var d=new e.JSDiffAdapter;for(a=0;a<b.length;a++){var f=this.generatePairBlockAnnotations(this._root,a);this._root.children.push(f);var h=this.generatePairWordAnnotations(f,a,d);h&&(f.children=h)}this.replaceAllAnnotations(!1,0,"block",!0);this.replaceAllAnnotations(!1,
1,"block",!0);this.replaceAllAnnotations(!1,0,"word",!0);this.replaceAllAnnotations(!1,1,"word",!0);this.iterator=new m.TreeModelIterator(this._root.children)}},replaceAllAnnotations:function(a,b,d,e,f){if(this.editorWrapper[b].annoTypes)for(var h=0;h<this.editorWrapper[b].annoTypes.length;h++)this.editorWrapper[b].annoTypes[h].type===d&&this.replaceDiffAnnotations(this.editorWrapper[b].editor,f?f:this.editorWrapper[b].annoTypes[h].list,e?this.editorWrapper[b].annoTypes[h].normal:this.editorWrapper[b].annoTypes[h].current,
a)},getMapper:function(){return this.editorWrapper[0].diffFeeder.getMapper()},getFeeder:function(a){return a?this.editorWrapper[1].diffFeeder:this.editorWrapper[0].diffFeeder},iterateOnBlock:function(a,b){this.iterator&&(this.iterator.iterateOnTop(a,b),this.updateCurrentAnnotation(!0))},iterateOnChange:function(a){if(!this.iterator)return null;var b=this.iterator.iterate(a);if(b){var d=this.iterator.cursor();"block"===d.type&&(d.children&&0<d.children.length)&&this.iterator.iterate(a);this.updateCurrentAnnotation(!0)}return b},
gotoBlock:function(a,b){if(this.iterator){if(0>a||a>=this._root.children.length||0===this._root.children.length)a=0;void 0!==b&&0<=b&&this._root.children[a].children&&b<this._root.children[a].children.length?this.iterator.setCursor(this._root.children[a].children[b]):this.iterator.setCursor(this._root.children[a]);this.updateCurrentAnnotation(!1);this._positionDiffBlock()}},_hitDiffAnnotation:function(a,b,d){if(d===this.editorWrapper[a].editor.getTextView()){for(var e=0;e<this._root.children.length;e++){d=
this._root.children[e];var f=0===a?d.oldA:d.newA;if(b>=f.start&&b<=f.end){e=d;if(d.children&&0<d.children.length)for(f=0;f<d.children.length;f++){var h=d.children[f],g=0===a?h.oldA:h.newA;if(b>=g.start&&b<=g.end){e=h;break}}return e}}return null}},gotoChange:function(a,b){for(var d=0;d<this.editorWrapper.length;d++){var e=this._hitDiffAnnotation(d,a,b);if(e)return this.iterator.setCursor(e),this.updateCurrentAnnotation(!1,b),!0}return!1},getCurrentBlockIndex:function(){if(!this.iterator)return-1;
var a=this.iterator.cursor();return!a?-1:"block"===a.type?a.index:a.parent.index},getCurrentPosition:function(){if(!this.iterator)return{};var a=this.iterator.cursor();return"block"===a.type?{block:a.index+1}:{block:a.parent.index+1,change:a.index+1}},getCurrentMapperIndex:function(){var a=this.getCurrentBlockIndex();0>a&&(a=0);var b=this.getFeeder().getDiffBlocks();if(!b||0===b.length)return-1;a>b.length-1&&(a=0);return b[a][1]},replaceDiffAnnotations:function(a,b,d,e){if(b&&d&&(a=a.getAnnotationModel())){for(var f=
a.getAnnotations(),h=[];e&&f.hasNext();){var g=f.next();g.type===d&&h.push(g)}a.replaceAnnotations(h,b)}},updateCurrentAnnotation:function(a,b){this.replaceAllAnnotations(!0,0,"block",!1,[]);this.replaceAllAnnotations(!0,1,"block",!1,[]);this.replaceAllAnnotations(!0,0,"word",!1,[]);this.replaceAllAnnotations(!0,1,"word",!1,[]);if(this.iterator){var d=this.iterator.cursor();if(d){var e,f,h={start:d.oldA.start,end:d.oldA.end},g={start:d.newA.start,end:d.newA.end};"word"===d.type?(e=this.editorWrapper[0].diffFeeder.getCurrentWordAnnoType(h,
this.editorWrapper[0].editor.getTextView().getModel()),f=this.editorWrapper[1].diffFeeder.getCurrentWordAnnoType(g,this.editorWrapper[1].editor.getTextView().getModel())):(e=this.editorWrapper[0].diffFeeder.getCurrentBlockAnnoType(d.index),f=this.editorWrapper[1].diffFeeder.getCurrentBlockAnnoType(d.index));e&&this.replaceDiffAnnotations(this.editorWrapper[0].editor,[new (k.AnnotationType.getType(e.current))(h.start,h.end)],e,!0);f&&this.replaceDiffAnnotations(this.editorWrapper[1].editor,[new (k.AnnotationType.getType(f.current))(g.start,
g.end)],f,!0);a?(this.autoSelecting=!0,this.editorWrapper[0].editor.setSelection(d.oldA.start,d.oldA.end,!0),this.editorWrapper[1].editor.setSelection(d.newA.start,d.newA.end,!0),this.autoSelecting=!1):b&&(this.autoSelecting=!0,b!==this.editorWrapper[0].editor.getTextView()&&this.editorWrapper[0].editor.setSelection(d.oldA.start,d.oldA.end,!0),b!==this.editorWrapper[1].editor.getTextView()&&this.editorWrapper[1].editor.setSelection(d.newA.start,d.newA.end,!0),this.autoSelecting=!1)}}},generatePairBlockAnnotations:function(a,
b){var d=this.generateBlockDiffAnnotations(0,b),e=this.generateBlockDiffAnnotations(1,b);return{parent:a,index:b,type:"block",oldA:d,newA:e}},generatePairWordAnnotations:function(a,b,d){var e=this.editorWrapper[0].diffFeeder.getTextOnBlock(b),f=this.editorWrapper[1].diffFeeder.getTextOnBlock(b);b=null;var h=0,g=0;if(e&&f&&e.text&&f.text&&5E3>=e.text.length&&5E3>=f.text.length)b=d.adaptCharDiff(e.text,f.text,"word"===this._charOrWordDiff),g=f.start,h=e.start;else return null;d=[];e=[];this.generateWordDiffAnnotations(0,
d,h,b,2,3);this.generateWordDiffAnnotations(1,e,g,b,0,1);b=[];for(h=0;h<d.length;h++)b.push({parent:a,index:h,type:"word",oldA:d[h],newA:e[h]});return b},getAnnoModelList:function(a,b,d){for(var e=0;e<this.editorWrapper[a].annoTypes.length;e++)if(this.editorWrapper[a].annoTypes[e].type===b&&this.editorWrapper[a].annoTypes[e].normal===d)return this.editorWrapper[a].annoTypes[e].list;return null},generateBlockDiffAnnotations:function(a,b){var d=this.editorWrapper[a].diffFeeder.getCurrentBlockAnnoType(b),
e=this.getAnnoModelList(a,"block",d.normal),f=this.editorWrapper[a].diffFeeder.getCharRange(b),d=k.AnnotationType.createAnnotation(d.normal,f.start,f.end);e&&e.push(d);return d},generateWordDiffAnnotations:function(a,b,d,e,f,h){if(e){var g=this.editorWrapper[a].diffFeeder.getCurrentWordAnnoType({start:-1,end:-1});a=this.getAnnoModelList(a,"word",g.normal);for(var l=0;l<e.length;l++){var m=k.AnnotationType.createAnnotation(g.normal,e[l][f]+d,e[l][h]+d);a.push(m);b.push(m)}}},_updateOverviewRuler:function(){if(this._overviewRuler){var a=
this.editorWrapper[0].editor.getTextView().getTopIndex();this.editorWrapper[0].editor.getTextView().redrawLines(a,a+1,this._overviewRuler)}},_updateCurveRuler:function(){this._curveRuler&&this._curveRuler.render()},_setTextViewPosition:function(a,b){var d=a.getLineHeight(),e=a.getClientArea(),d=Math.floor(e.height/d/3);a.setTopIndex(0<b-d?b-d:0)},_positionDiffBlock:function(){var a=this.getCurrentBlockIndex();0>a&&(a=0);var b=this.getFeeder().getDiffBlocks();0!==b.length&&(this._setTextViewPosition(this.editorWrapper[0].editor.getTextView(),
b[a][0]),this.editorWrapper[0].editor!==this.editorWrapper[1].editor&&(a=n.lookUpLineIndex(this.getMapper(),0,b[a][1]),this._setTextViewPosition(this.editorWrapper[1].editor.getTextView(),a)),this._updateOverviewRuler(),this._updateCurveRuler())},matchPositionFromOverview:function(a){this._initialized&&(a=0>a?0:n.getAnnotationIndex(this.getFeeder().getDiffBlocks(),a),this.gotoBlock(a))},gotoDiff:function(a,b){this.gotoChange(a,b)&&(this._updateOverviewRuler(),this._updateCurveRuler())},nextDiff:function(){this.iterateOnBlock(!0,
!0);this._positionDiffBlock()},prevDiff:function(){this.iterateOnBlock(!1,!0);this._positionDiffBlock()},nextChange:function(){var a=this.iterateOnChange(!0);this._positionDiffBlock();return a},prevChange:function(){this.iterateOnChange(!1);this._positionDiffBlock()}};return d}();d.DiffBlockFeeder=function(){function a(){}a.prototype={_isAddedSide:function(){return 0===this._mapperColumnIndex},getWordAnnoTypes:function(a){this._isAddedSide()?a.push({type:"word",current:t,normal:r,list:[]}):a.push({type:"word",
current:s,normal:w,list:[]});a.push({type:"word",current:x});a.push({type:"word",current:v});a.push({type:"word",current:z});a.push({type:"word",current:A})},getCurrentWordAnnoType:function(a,b){return a.start===a.end&&b?this._isAddedSide()?{current:this._repositionEmptyWord(a,b),normal:r}:{current:this._repositionEmptyWord(a,b),normal:w}:this._isAddedSide()?{current:t,normal:r}:{current:s,normal:w}},_repositionEmptyWord:function(a,b){var d=b.getLineAtOffset(a.start),e=b.getLineStart(d),f=b.getLineEnd(d);
if(e!==f){if(a.start===f)return a.start--,this._isAddedSide()?A:v;a.end++}else if(0<d&&(d--,e=b.getLineStart(d),f=b.getLineEnd(d),e!==f))return a.start=f-1,a.end=f,this._isAddedSide()?A:v;return this._isAddedSide()?z:x},getMapper:function(){return this._mapper},getDiffBlocks:function(){return this._diffBlocks},getDiffBlockH:function(a){if(!this._diffBlocks||0===this._diffBlocks.length)return-1;a=this._diffBlocks[a][1];return-1===a?0:this._mapper[a][this._mapperColumnIndex]},getOverviewLineCount:function(){return this._textModel.getLineCount()},
getLineNumber:function(a){return a},getCharRange:function(a){if(!this._diffBlocks||0===this._diffBlocks.length)return null;var b=this._diffBlocks[a][0],d=b+this._mapper[this._diffBlocks[a][1]][this._mapperColumnIndex]-1;a=this._textModel.getLineStart(b);if(d<b)return{start:a,end:a};b=this._textModel.getLineEnd(d,!0);return{start:a,end:b}},getTextOnBlock:function(a){if(!this._diffBlocks||0===this._diffBlocks.length)return null;a=this.getCharRange(a);return{start:a.start,text:this._textModel.getText(a.start,
a.end)}},isMapperEmpty:function(){return 0===this._mapper.length}};return a}();d.TwoWayDiffBlockFeeder=function(){function e(a,b,d,f){this._mapperColumnIndex=d;this._reverseAnnotation=f;this.init(a,b)}e.prototype=new d.DiffBlockFeeder;e.prototype._isAddedSide=function(){return this._reverseAnnotation?0!==this._mapperColumnIndex:0===this._mapperColumnIndex};e.prototype.init=function(a,b){this._textModel=a;this._diffBlocks=void 0;if(b){this._mapper=b;this._diffBlocks=[];for(var d=0,e=0;e<this._mapper.length;e++)0!==
this._mapper[e][2]&&this._diffBlocks.push([d,e]),d+=this._mapper[e][this._mapperColumnIndex]}};e.prototype.getBlockAnnoTypes=function(d){this._isAddedSide()?d.push({type:"block",normal:g,current:f,list:[]}):d.push({type:"block",normal:b,current:a,list:[]});d.push({type:"block",normal:l,current:h,list:[]});d.push({type:"block",normal:p,current:q,list:[]})};e.prototype.getCurrentBlockAnnoType=function(d){if(!this._diffBlocks||0===this._diffBlocks.length||this._diffBlocks.length<=d)return null;d=this._diffBlocks[d][1];
return 0===this._mapper[d][this._mapperColumnIndex]?{normal:l,current:h}:n.isMapperConflict(this.getMapper(),d)?{normal:p,current:q}:this._isAddedSide()?{type:"block",normal:g,current:f,list:[]}:{type:"block",normal:b,current:a,list:[]}};return e}();d.inlineDiffBlockFeeder=function(){function e(a,b){this._mapperColumnIndex=b;this.init(a)}e.prototype=new d.DiffBlockFeeder;e.prototype.setModel=function(a){this._textModel=a};e.prototype.init=function(a){this._diffBlocks=void 0;if(a){this._mapper=a;this._diffBlocks=
[];this._gapBlocks=[];for(var b=a=0,d=0;d<this._mapper.length;d++){if(0!==this._mapper[d][2]){if(this._isAddedSide()){var e=a+this._mapper[d][1];this._diffBlocks.push([e,d]);this._gapBlocks.push([e,e+this._mapper[d][0],b])}else this._diffBlocks.push([a,d]),this._gapBlocks.push([a,a+this._mapper[d][1],b]);a+=this._mapper[d][0]+this._mapper[d][1]}else this._gapBlocks.push([a,a+this._mapper[d][this._mapperColumnIndex],b]),a+=this._mapper[d][this._mapperColumnIndex];b+=this._mapper[d][this._mapperColumnIndex]}}};
e.prototype.getBlockAnnoTypes=function(d){this._isAddedSide()?d.push({type:"block",normal:g,current:f,list:[]}):d.push({type:"block",normal:b,current:a,list:[]});d.push({type:"block",normal:p,current:q,list:[]})};e.prototype.getCurrentBlockAnnoType=function(d){if(!this._diffBlocks||0===this._diffBlocks.length)return null;d=this._diffBlocks[d][1];return 0===this._mapper[d][this._mapperColumnIndex]?{current:t,normal:r}:n.isMapperConflict(this.getMapper(),d)?{normal:p,current:q}:this._isAddedSide()?
{type:"block",normal:g,current:f,list:[]}:{type:"block",normal:b,current:a,list:[]}};e.prototype.getDiffBlockH=function(a){if(!this._diffBlocks||0===this._diffBlocks.length)return-1;a=this._diffBlocks[a][1];return this._mapper[a][0]+this._mapper[a][1]};e.prototype.getLineNumber=function(a){for(var b=0;b<this._gapBlocks.length;b++)if(this._gapBlocks[b][0]!==this._gapBlocks[b][1]&&a>=this._gapBlocks[b][0]&&a<this._gapBlocks[b][1])return a-this._gapBlocks[b][0]+this._gapBlocks[b][2];return-1};return e}();
return d});
define("orion/compare/compareView","i18n!orion/compare/nls/messages orion/Deferred orion/webui/littlelib orion/compare/diffParser orion/compare/compareRulers orion/editor/editor orion/editor/editorFeatures orion/keyBinding orion/editor/textView orion/compare/compareUIFactory orion/compare/compareUtils orion/compare/jsdiffAdapter orion/compare/diffTreeNavigator".split(" "),function(m,n,k,e,d,g,f,b,a,l,h,p,q,r,t,w){var s={};s.CompareView=function(){function a(){this._diffParser=new e.DiffParser}a.prototype=
{_clearOptions:function(){this.options={};this.options.blockNumber=1;this.options.changeNumber=0},_getLineDelim:function(a,b){return"\n"},_generateMapper:function(a,b,d,e,f){var h=this._getLineDelim(a,d);this._diffParser.setLineDelim(h);if(this.options.mapper&&this.options.toggler)return{delim:h,mapper:this.options.mapper,output:this.options.newFile.Content,diffArray:this.options.diffArray};if("string"===typeof b&&"string"===typeof a)return a=(new p.JSDiffAdapter).adapt(a,b,h),this.options.toggler&&
(this.options.mapper=a.mapper,this.options.newFile.Content=b,this.options.diffArray=a.changContents),{delim:h,mapper:a.mapper,output:b,diffArray:a.changContents};b=this._diffParser.parse(a,d,e,f);a=this._diffParser.getDiffArray();this.options.toggler&&(this.options.mapper=b.mapper,this.options.newFile.Content=b.outPutFile,this.options.diffArray=a);return{delim:h,mapper:b.mapper,output:b.outPutFile,diffArray:a}},_loadImageFile:function(a,b,d){var e=document.createElement("img");e.src=a;var f=new n;
e.onload=function(){b.appendChild(e);if(d){var a=document.createElement("hr");b.appendChild(a)}f.resolve(e.height)};e.onerror=function(){f.resolve(0)};return f},_initSyntaxHighlighter:function(a){this._syntaxHighlighters=null;if(this.options.highlighters&&0<this.options.highlighters.length&&!(1>a.length||2<a.length))this._syntaxHighlighters=[{highlighter:this.options.highlighters[0],target:a[0]}],2===a.length&&2===this.options.highlighters.length&&this._syntaxHighlighters.push({highlighter:this.options.highlighters[1],
target:a[1]})},_highlightSyntax:function(){if(this._syntaxHighlighters){var a=[];this._syntaxHighlighters.forEach(function(b){a.push(b.highlighter.highlight(b.target.fileName,b.target.contentType,b.target.editor))}.bind(this));n.all(a,function(a){return{_error:a}}).then(function(a){this._diffNavigator.renderAnnotations();this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1)}.bind(this))}else window.setTimeout(function(){this._diffNavigator.renderAnnotations();this._diffNavigator.gotoBlock(this.options.blockNumber-
1,this.options.changeNumber-1)}.bind(this),50)},setOptions:function(a,b){b&&this._clearOptions();this.options||(this.options={});a&&Object.keys(a).forEach(function(b){this.options[b]=a[b]}.bind(this));if(a.newFileOnRight){var d=this.options.newFile;this.options.newFile=this.options.oldFile;this.options.oldFile=d}},getOptions:function(){return this.options},getCurrentDiffPos:function(){return this._diffNavigator.getCurrentPosition()},initDiffNav:function(){this._diffNavigator.gotoBlock(0,0)},nextDiff:function(){this._diffNavigator.nextDiff()},
prevDiff:function(){this._diffNavigator.prevDiff()},nextChange:function(){return this._diffNavigator.nextChange()},prevChange:function(){this._diffNavigator.prevChange()},getWidget:function(){return this},startup:function(){this.initEditors();this.refresh(!0)},initEditors:function(a){},initImageMode:function(){}};return a}();s.TwoWayCompareView=function(){function b(a){this.setOptions(a,!0);this._diffNavigator=new q.DiffTreeNavigator("word");this.type="twoWay";this._uiFactory=this.options.uiFactory;
this._uiFactory||(this._uiFactory=new l.TwoWayCompareUIFactory({parentDivID:this.options.parentDivId,showTitle:this.options.showTitle?this.options.showTitle:!1,showLineStatus:this.options.showLineStatus?this.options.showLineStatus:!1}),this._uiFactory.buildUI());this._viewLoadedCounter=0;this.options.commandProvider&&this.options.commandProvider.initCommands(this);this._curveRuler=new d.CompareCurveRuler(this._uiFactory.getDiffCanvasDiv())}b.prototype=new s.CompareView;b.prototype.initEditors=function(a){this._editors=
[];this._editors.push(this._createEditor(a,this._uiFactory.getEditorParentDiv(!1),this._uiFactory.getStatusDiv(!1),this.options.oldFile));this._editors.push(this._createEditor(a,this._uiFactory.getEditorParentDiv(!0),this._uiFactory.getStatusDiv(!0),this.options.newFile,!0));this._overviewRuler=new d.CompareOverviewRuler("right",{styleClass:"ruler overview"},null,function(a,b){this._diffNavigator.matchPositionFromOverview(a)}.bind(this));window.onbeforeunload=function(){if(this._editors&&this._editors.some(function(a){return a.isDirty()}))return m["There are unsaved changes."]}.bind(this)};
b.prototype.initImageMode=function(){this._editors&&(this._editors.forEach(function(a){a.destroy()}),this._editors=null);this._uiFactory.getEditorParentDiv(!0).classList.add("compareEditorParentImageMode");this._uiFactory.getEditorParentDiv().classList.add("compareEditorParentImageMode");this._uiFactory.disableTitle();this._uiFactory.disableLineStatus();this._imageMode=!0};b.prototype.getImageMode=function(){return this._imageMode};b.prototype.getEditors=function(){return this._editors};b.prototype.gotoDiff=
function(a,b,d){d=d?this._editors[1].getTextView():this._editors[0].getTextView();a=d.getModel().getLineStart(a)+b;this._diffNavigator.gotoDiff(a,d)};b.prototype.copyToLeft=function(){this._curveRuler.copyTo(!0)};b.prototype.copyToRight=function(){this._curveRuler.copyTo(!1)};b.prototype.resizeEditors=function(){this._editors.forEach(function(a){a.getTextView().resize()})};b.prototype.getSplitter=function(){return this._uiFactory.getSplitter()};b.prototype._createEditor=function(b,d,e,h,l){var k=
"undefined"===typeof h.readonly?!0:h.readonly,p=function(){var b=new a.TextView({parent:d,readonly:k,tabSize:4});this._viewLoadedCounter++;2===this._viewLoadedCounter&&this._diffNavigator.matchPositionFromOverview(-1);if(this.onLoad)this.onLoad();var e=this.getSplitter();e&&e.addResizeListener(function(a){if(a){var d=!1;(d=this._uiFactory.isLeftPane(a)?l:!l)&&b.resize()}}.bind(this));return b}.bind(this),n=h.keyBindingFactory;n||(n=new f.KeyBindingsFactory);var q=null;if(e)var r="",q=function(a,b){e&&
(r=b?m["ERROR: "]+a:a,e.textContent=""+r)};p=new g.Editor({textViewFactory:p,undoStackFactory:new f.UndoFactory,annotationFactory:new f.AnnotationFactory,keyBindingFactory:n,statusReporter:q,domNode:d});p.installTextView();p.setInput(null,null,h.Content?h.Content:b);p.setOverviewRulerVisible(!1);var t=p.getTextView();t.addEventListener("Selection",function(a){!(a.newValue&&a.newValue.start!==a.newValue.end)&&(!this._diffNavigator.autoSelecting&&this._diffNavigator.editorWrapper[0].diffFeeder)&&(a=
t.getCaretOffset(),this._diffNavigator.gotoDiff(a,t))}.bind(this));t.getModel().addEventListener("Changed",function(a){this._curveRuler.onChanged(a,!l)||(this.options.mapper=null)}.bind(this));l?t.addEventListener("Scroll",function(a){this._curveRuler&&(this._curveRuler.matchPositionFrom(!0),this._curveRuler.render());if(this.onScroll)this.onScroll()}.bind(this)):t.addEventListener("Scroll",function(a){this._curveRuler&&this._curveRuler.render()}.bind(this));return p};b.prototype.destroy=function(){this._editors&&
(this._diffNavigator.destroy(),this._editors.forEach(function(a){a.destroy()}),this._uiFactory.destroy())};b.prototype.addRulers=function(){if(this._editors&&!this._hasRuler){var a=new d.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"}),b=new d.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"});this._editors[1].getTextView().addRuler(a);
this._editors[0].getTextView().addRuler(b);this._editors[0].getTextView().addRuler(this._overviewRuler);this._hasRuler=!0}};b.prototype.refresh=function(a){if(this._imageMode){this.options.commandProvider&&this.options.commandProvider.renderCommands(this);var b=this;return this._loadImageFile(this.options.newFile.URL,this._uiFactory.getEditorParentDiv(!0)).then(function(a){return b._loadImageFile(b.options.oldFile.URL,b._uiFactory.getEditorParentDiv()).then(function(b){return(new n).resolve(a>b?a:
b)})})}var d=this.options.oldFile.Content,e=this.options.newFile.Content,f=this.options.diffContent;"string"===typeof e?f=this._generateMapper(d,e,f,this.options.hasConflicts):(f=this._generateMapper(d,e,f,this.options.hasConflicts),e=f.output);var h=new q.TwoWayDiffBlockFeeder(this._editors[0].getTextView().getModel(),f.mapper,1,this.options.newFileOnRight),g=new q.TwoWayDiffBlockFeeder(this._editors[1].getTextView().getModel(),f.mapper,0,this.options.newFileOnRight);this._diffNavigator.initAll(this.options.charDiff?
"char":"word",this._editors[0],this._editors[1],h,g,this._overviewRuler,this._curveRuler);this._curveRuler.init(f.mapper,this._editors[1],this._editors[0],this._diffNavigator);a&&(this._editors[1].setInput(this.options.newFile.Name,null,e),this._editors[0].setInput(this.options.oldFile.Name,null,d));this._initSyntaxHighlighter([{fileName:this.options.newFile.Name,contentType:this.options.newFile.Type,editor:this._editors[1]},{fileName:this.options.oldFile.Name,contentType:this.options.oldFile.Type,
editor:this._editors[0]}]);this._highlightSyntax();this.options.commandProvider&&this.options.commandProvider.renderCommands(this);this.addRulers();2===this._viewLoadedCounter&&this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1);this.refreshTitle(0);this.refreshTitle(1);a=this._editors[1].getTextView().getModel().getLineCount()*this._editors[1].getTextView().getLineHeight()+5;d=this._editors[0].getTextView().getModel().getLineCount()*this._editors[0].getTextView().getLineHeight()+
5;return a>d?a:d};b.prototype.refreshTitle=function(a,b){if(1===a){var d=this._uiFactory.getTitleDiv(!0);d&&(k.empty(d),d.appendChild(document.createTextNode(b||this._editors[a].isDirty()?this.options.newFile.Name+"*":this.options.newFile.Name)))}else if(d=this._uiFactory.getTitleDiv(!1))k.empty(d),d.appendChild(document.createTextNode(b||this._editors[a].isDirty()?this.options.oldFile.Name+"*":this.options.oldFile.Name))};return b}();s.InlineCompareView=function(){function b(a){this.setOptions(a,
!0);this._diffNavigator=new q.DiffTreeNavigator("word");this.type="inline";this.options.commandProvider&&this.options.commandProvider.initCommands(this);this._editorDiv=this.options.parentDivId}b.prototype=new s.CompareView;b.prototype.addRulers=function(){this._textView&&!this._hasRuler&&(this._textView.addRuler(this._rulerOrigin),this._textView.addRuler(this._rulerNew),this._textView.addRuler(this._overviewRuler),this._hasRuler=!0)};b.prototype.removeRulers=function(){this._textView&&this._hasRuler&&
(this._textView.removeRuler(this._rulerOrigin),this._textView.removeRuler(this._rulerNew),this._textView.removeRuler(this._overviewRuler),this._hasRuler=!1)};b.prototype.destroyEditor=function(){this._textView&&(this._diffNavigator.destroy(),this._textView.setText(""),this.removeRulers())};b.prototype.destroy=function(){this._textView&&(this._diffNavigator.destroy(),this._textView.destroy())};b.prototype.initEditors=function(b){var e=k.node(this._editorDiv),h=function(){return new a.TextView({parent:e,
readonly:!0,tabSize:4})}.bind(this);this._editor=new g.Editor({textViewFactory:h,undoStackFactory:new f.UndoFactory,annotationFactory:new f.AnnotationFactory,domNode:e});this._editor.installTextView();this._editor.setInput(null,null,b);this._editor.setOverviewRulerVisible(!1);this._editor.setAnnotationRulerVisible(!1);this._textView=this._editor.getTextView();this._rulerOrigin=new d.LineNumberCompareRuler(this._diffNavigator,1,"left",{styleClass:"ruler lines inlineRulerLeft"},{styleClass:"rulerLines odd"},
{styleClass:"rulerLines even"});this._rulerNew=new d.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"});this._overviewRuler=new d.CompareOverviewRuler("right",{styleClass:"ruler overview"},null,function(a,b){this._diffNavigator.matchPositionFromOverview(a)}.bind(this));this._textView.addEventListener("Selection",function(a){!(a.newValue&&a.newValue.start!==a.newValue.end)&&(!this._diffNavigator.autoSelecting&&
this._diffNavigator.editorWrapper[0].diffFeeder)&&(a=this._textView.getCaretOffset(),this._diffNavigator.gotoDiff(a,this._textView))}.bind(this))};b.prototype.initImageMode=function(){this._editor&&(this._editor.destroy(),this._editor=null);k.node(this._editorDiv).classList.add("compareEditorParentImageMode");this._imageMode=!0};b.prototype.getImageMode=function(){return this._imageMode};b.prototype._initDiffPosition=function(a){var b=a.getModel();if(b&&b.getAnnotations&&(b=b.getAnnotations(),0<b.length)){var b=
b[0][0],d=a.getLineHeight(),e=a.getClientArea(),d=Math.floor(e.height/d/3);a.setTopIndex(0<b-d?b-d:0)}};b.prototype.refresh=function(){if(this._imageMode){this.options.commandProvider&&this.options.commandProvider.renderCommands(this);var a=this;return this._loadImageFile(this.options.newFile.URL,k.node(this._editorDiv),!0).then(function(b){return a._loadImageFile(a.options.oldFile.URL,k.node(a._editorDiv)).then(function(a){return(new n).resolve(b+a+20)})})}var b=this.options.oldFile.Content,d=this.options.newFile.Content,
e=this._generateMapper(b,d,this.options.diffContent,this.options.hasConflicts,!this.options.toggler);"string"!==typeof d&&(d=e.output);this._textView.getModel().setText(b);b=new q.inlineDiffBlockFeeder(e.mapper,1);d=new q.inlineDiffBlockFeeder(e.mapper,0);h.mergeDiffBlocks(this._textView.getModel(),d.getDiffBlocks(),e.mapper,e.diffArray.array,e.diffArray.index,this._diffParser._lineDelimiter);b.setModel(this._textView.getModel());d.setModel(this._textView.getModel());this._diffNavigator.initAll(this.options.charDiff?
"char":"word",this._editor,this._editor,b,d,this._overviewRuler);this._initSyntaxHighlighter([{fileName:this.options.oldFile.Name,contentType:this.options.oldFile.Type,editor:this._editor}]);this._highlightSyntax();this.options.commandProvider&&this.options.commandProvider.renderCommands(this);this.addRulers();e=this._textView.getTopIndex();this._textView.redrawLines(e,e+1,this._overviewRuler);this._textView.redrawLines(e,e+1,this._rulerOrigin);this._textView.redrawLines(e,e+1,this._rulerNew);this._diffNavigator.gotoBlock(this.options.blockNumber-
1,this.options.changeNumber-1);return this._textView.getLineHeight()*this._textView.getModel().getLineCount()+5};b.prototype.setConflicting=function(a){this._conflcit=a};return b}();s.toggleableCompareView=function(){function a(b,d){d&&(d.toggler=this);this._widget="inline"===b?new s.InlineCompareView(d):new s.TwoWayCompareView(d)}a.prototype={startup:function(){this._widget.startup()},initImageMode:function(){this._imageMode=!0;this._widget.initImageMode()},toggle:function(){var a=this._widget.options;
if(!this._imageMode){var b=this._widget.getCurrentDiffPos();a.blockNumber=b.block;a.changeNumber=b.change}this._widget.destroy();k.empty(k.node(a.parentDivId));this._widget="inline"===this._widget.type?new s.TwoWayCompareView(a):new s.InlineCompareView(a);this._imageMode?this._widget.initImageMode():this._widget.initEditors();this._widget.refresh(!0)},getWidget:function(){return this._widget}};return a}();return s});
define("orion/editor/stylers/lib/syntax",[],function(){return{id:"orion.lib",grammars:[{id:"orion.lib",repository:{brace_open:{match:"{",name:"punctuation.section.block.begin"},brace_close:{match:"}",name:"punctuation.section.block.end"},bracket_open:{match:"\\[",name:"punctuation.section.bracket.begin"},bracket_close:{match:"\\]",name:"punctuation.section.bracket.end"},parenthesis_open:{match:"\\(",name:"punctuation.section.parens.begin"},parenthesis_close:{match:"\\)",name:"punctuation.section.parens.end"},
doc_block:{begin:{match:"/\\*\\*",literal:"/**"},end:{match:"\\*/",literal:"*/"},name:"comment.block.documentation",patterns:[{match:"@(?:(?!\\*/)\\S)*",name:"keyword.other.documentation.tag"},{match:"\\\x3c\\S*\\\x3e",name:"keyword.other.documentation.markup"},{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]},number_decimal:{match:"\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:[eE][+-]?\\d+)?\\b",name:"constant.numeric.number"},
number_hex:{match:"\\b0[xX][0-9A-Fa-f]+\\b",name:"constant.numeric.hex"},string_doubleQuote:{match:'"(?:\\\\.|[^"])*"?',name:"string.quoted.double"},string_singleQuote:{match:"'(?:\\\\.|[^'])*'?",name:"string.quoted.single"},todo_comment_singleLine:{match:"(\\b)(TODO)(\\b)(.*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.line"}}}}},{id:"orion.c-like",repository:{comment_singleLine:{match:{match:"//.*",literal:"//"},name:"comment.line.double-slash",
patterns:[{include:"orion.lib#todo_comment_singleLine"}]},comment_block:{begin:{match:"/\\*",literal:"/*"},end:{match:"\\*/",literal:"*/"},name:"comment.block",patterns:[{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]}}}],keywords:[]}});
define("orion/editor/stylers/application_javascript/syntax",["orion/editor/stylers/lib/syntax"],function(m){var n="break case class catch continue const debugger default delete do else enum export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof undefined var void while with yield".split(" ");m=m.grammars;m.push({id:"orion.js",contentTypes:["application/javascript"],patterns:[{begin:"'(?:\\\\.|[^\\\\'])*\\\\$",
end:"^(?:$|(?:\\\\.|[^\\\\'])*('|[^\\\\]$))",name:"string.quoted.single.js"},{begin:'"(?:\\\\.|[^\\\\"])*\\\\$',end:'^(?:$|(?:\\\\.|[^\\\\"])*("|[^\\\\]$))',name:"string.quoted.double.js"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{match:"/(?![\\s\\*])(?:\\\\.|[^/])+/(?:[gim]{0,3})",name:"string.regexp.js"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},
{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+n.join("|")+")\\b",name:"keyword.control.js"}]});return{id:m[m.length-1].id,grammars:m,keywords:n}});
define("orion/editor/stylers/text_x-java-source/syntax",["orion/editor/stylers/lib/syntax"],function(m){var n="abstract boolean break byte case catch char class continue default do double else extends false final finally float for if implements import instanceof int interface long native new null package private protected public return short static super switch synchronized this throw throws transient true try void volatile while".split(" ");m=m.grammars;m.push({id:"orion.java",contentTypes:["text/x-java-source"],
patterns:[{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+
n.join("|")+")\\b",name:"keyword.control.java"}]});return{id:m[m.length-1].id,grammars:m,keywords:n}});
define("orion/editor/stylers/text_css/syntax",["orion/editor/stylers/lib/syntax"],function(m){var n="alignment-adjust alignment-baseline animation-delay animation-direction animation-duration animation-iteration-count animation-name animation-play-state animation-timing-function animation appearance azimuth backface-visibility background-attachment background-clip background-color background-image background-origin background-position background-repeat background-size background baseline-shift binding bleed bookmark-label bookmark-level bookmark-state bookmark-target border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-bottom border-collapse border-color border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-image border-left-color border-left-style border-left-width border-left border-radius border-right-color border-right-style border-right-width border-right border-spacing border-style border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-top border-width border bottom box-align box-decoration-break box-direction box-flex-group box-flex box-lines box-ordinal-group box-orient box-pack box-shadow box-sizing break-after break-before break-inside caption-side clear clip color-profile color column-count column-fill column-gap column-rule-color column-rule-style column-rule-width column-rule column-span column-width columns content counter-increment counter-reset crop cue-after cue-before cue cursor direction display dominant-baseline drop-initial-after-adjust drop-initial-after-align drop-initial-before-adjust drop-initial-before-align drop-initial-size drop-initial-value elevation empty-cells fit-position fit flex-align flex-flow flex-inline-pack flex-order flex-pack float-offset float font-family font-size font-size-adjust font-stretch font-style font-variant font-weight font grid-columns grid-rows hanging-punctuation height hyphenate-after hyphenate-before hyphenate-character hyphenate-lines hyphenate-resource hyphens icon image-orientation image-rendering image-resolution inline-box-align left letter-spacing line-height line-stacking-ruby line-stacking-shift line-stacking-strategy line-stacking list-style-image list-style-position list-style-type list-style margin-bottom margin-left margin-right margin-top margin mark-after mark-before mark marker-offset marks marquee-direction marquee-loop marquee-play-count marquee-speed marquee-style max-height max-width min-height min-width move-to nav-down nav-index nav-left nav-right nav-up opacity orphans outline-color outline-offset outline-style outline-width outline overflow-style overflow-x overflow-y overflow padding-bottom padding-left padding-right padding-top padding page-break-after page-break-before page-break-inside page-policy page pause-after pause-before pause perspective-origin perspective phonemes pitch-range pitch play-during position presentation-level punctuation-trim quotes rendering-intent resize rest-after rest-before rest richness right rotation-point rotation ruby-align ruby-overhang ruby-position ruby-span size speak-header speak-numeral speak-punctuation speak speech-rate stress string-set table-layout target-name target-new target-position target text-align-last text-align text-decoration text-emphasis text-height text-indent text-justify text-outline text-shadow text-transform text-wrap top transform-origin transform-style transform transition-delay transition-duration transition-property transition-timing-function transition unicode-bidi vertical-align visibility voice-balance voice-duration voice-family voice-pitch-range voice-pitch voice-rate voice-stress voice-volume volume white-space-collapse white-space widows width word-break word-spacing word-wrap z-index".split(" ");m=
m.grammars;m.push({id:"orion.css",contentTypes:["text/css"],patterns:[{begin:"'(?:\\\\.|[^\\\\'])*\\\\$",end:"^(?:$|(?:\\\\.|[^\\\\'])*('|[^\\\\]$))",name:"string.quoted.single.css"},{begin:'"(?:\\\\.|[^\\\\"])*\\\\$',end:'^(?:$|(?:\\\\.|[^\\\\"])*("|[^\\\\]$))',name:"string.quoted.double.css"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},
{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"#number_hex"},{match:"(?i)\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:%|em|ex|ch|rem|vw|vh|vmin|vmax|in|cm|mm|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?\\b",name:"constant.numeric.value.css"},{match:"(?:-webkit-|-moz-|-ms-|-o-|\\b)(?:"+n.join("|")+")\\b",name:"keyword.control.css"}],repository:{number_hex:{match:"#[0-9A-Fa-f]+\\b",name:"constant.numeric.hex.css"}}});
return{id:m[m.length-1].id,grammars:m,keywords:n}});
define("examples/editor/textStyler",["orion/editor/annotations","orion/editor/stylers/application_javascript/syntax","orion/editor/stylers/text_x-java-source/syntax","orion/editor/stylers/text_css/syntax"],function(m,n,k,e){function d(a,b){this.keywords=a;this.whitespacesVisible=b;this.setText("")}function g(){d.call(this,null,!0)}function f(a){d.call(this,null,a)}function b(){d.call(this,null,!1)}function a(a,e,k){this.commentStart="/*";this.commentEnd="*/";var m=[];switch(e){case "java":m=h;break;
case "js":m=l;break;case "css":m=p}this.whitespacesVisible=this.spacesVisible=this.tabsVisible=!1;this.detectHyperlinks=!0;this.highlightCaretLine=!1;this.detectTasks=this.foldingEnabled=!0;this._scanner=new d(m,this.whitespacesVisible);this._firstScanner=new b;this._commentScanner=new f(this.whitespacesVisible);this._whitespaceScanner=new g;"css"===e&&(this._scanner.isCSS=!0,this._firstScanner.isCSS=!0);this.view=a;this.annotationModel=k;this._bracketAnnotations=void 0;var n=this;this._listener=
{onChanged:function(a){n._onModelChanged(a)},onDestroy:function(a){n._onDestroy(a)},onLineStyle:function(a){n._onLineStyle(a)},onMouseDown:function(a){n._onMouseDown(a)},onSelection:function(a){n._onSelection(a)}};e=a.getModel();e.getBaseModel&&(e=e.getBaseModel());e.addEventListener("Changed",this._listener.onChanged);a.addEventListener("MouseDown",this._listener.onMouseDown);a.addEventListener("Selection",this._listener.onSelection);a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("LineStyle",
this._listener.onLineStyle);this._computeComments();this._computeFolding();a.redrawLines()}var l=n.keywords,h=k.keywords,p=e.keywords,q={styleClass:"comment"},r={styleClass:"comment"},t={styleClass:"comment block documentation"},w={styleClass:"keyword other documentation markup"},s={styleClass:"keyword other documentation task"},x={styleClass:"keyword other documentation tag"},v={styleClass:"string"},z={styleClass:"constant numeric"},A={styleClass:"keyword"},B={styleClass:"punctuation separator space",
unmergeable:!0},u={styleClass:"punctuation separator tab",unmergeable:!0},y={styleClass:"meta annotation currentLine"};d.prototype={getOffset:function(){return this.offset},getStartOffset:function(){return this.startOffset},getData:function(){return this.text.substring(this.startOffset,this.offset)},getDataLength:function(){return this.offset-this.startOffset},_default:function(a){switch(a){case 32:case 9:if(this.whitespacesVisible)return 32===a?11:10;do a=this._read();while(32===a||9===a);this._unread(a);
return 9;case 123:case 125:case 40:case 41:case 91:case 93:case 60:case 62:return a;default:var b=this.isCSS,d=this.offset-1;if(!b&&48<=a&&57>=a){var e=b=!1,f=!1,h=a;do if(a=this._read(),46===a&&!b)b=!0;else if(101===a&&!e)b=e=!0,a=this._read(),45!==a&&this._unread(a);else if(120===a&&48===h&&2===this.offset-d)b=e=f=!0;else if(!(48<=a&&57>=a||f&&(65<=a&&70>=a||97<=a&&102>=a)))break;while(1);this._unread(a);return 3}if(97<=a&&122>=a||65<=a&&90>=a||95===a||45===a&&b){do a=this._read();while(97<=a&&
122>=a||65<=a&&90>=a||95===a||48<=a&&57>=a||45===a&&b);this._unread(a);a=this.keywords;if(0<a.length){d=this.text.substring(d,this.offset);for(b=0;b<a.length;b++)if(this.keywords[b]===d)return 2}}return 1}},_read:function(){return this.offset<this.text.length?this.text.charCodeAt(this.offset++):-1},_unread:function(a){-1!==a&&this.offset--},nextToken:function(){for(this.startOffset=this.offset;;){var a=this._read(),b;switch(a){case -1:return null;case 47:a=this._read();if(!this.isCSS&&47===a)for(;;)if(a=
this._read(),-1===a||10===a||13===a)return this._unread(a),6;if(42===a){a=this._read();b=7;for(42===a&&(b=8);;){for(;42===a;)if(a=this._read(),47===a)return b;if(-1===a)return this._unread(a),b;a=this._read()}}this._unread(a);return 1;case 39:for(b=4;;)switch(a=this._read(),a){case 39:return b;case 13:case 10:case -1:return this._unread(a),b;case 92:switch(a=this._read(),a){case 10:b=5;break;case 13:b=5,a=this._read(),10!==a&&this._unread(a)}}break;case 34:for(b=4;;)switch(a=this._read(),a){case 34:return b;
case 13:case 10:case -1:return this._unread(a),b;case 92:switch(a=this._read(),a){case 10:b=5;break;case 13:b=5,a=this._read(),10!==a&&this._unread(a)}}break;default:return this._default(a)}}},setText:function(a){this.text=a;this.startOffset=this.offset=0}};g.prototype=new d(null);g.prototype.nextToken=function(){for(this.startOffset=this.offset;;){var a=this._read();switch(a){case -1:return null;case 32:return 11;case 9:return 10;default:do a=this._read();while(!(32===a||9===a||-1===a));this._unread(a);
return 1}}};f.prototype=new d(null);f.prototype.setType=function(a){this._type=a};f.prototype.nextToken=function(){for(this.startOffset=this.offset;;){var a=this._read();switch(a){case -1:return null;case 32:case 9:if(this.whitespacesVisible)return 32===a?11:10;do a=this._read();while(32===a||9===a);this._unread(a);return 9;case 60:if(8===this._type){do a=this._read();while(!(62===a||-1===a));if(62===a)return 12}return 1;case 64:if(8===this._type){do a=this._read();while(97<=a&&122>=a||65<=a&&90>=
a||95===a||48<=a&&57>=a);this._unread(a);return 13}return 1;case 84:if(79===(a=this._read()))if(68===(a=this._read()))if(79===(a=this._read()))if(a=this._read(),!(97<=a&&122>=a||65<=a&&90>=a||95===a||48<=a&&57>=a))return this._unread(a),14;this._unread(a);default:do a=this._read();while(!(32===a||9===a||-1===a||60===a||64===a||84===a));this._unread(a);return 1}}};b.prototype=new d(null);b.prototype._default=function(a){for(;;)switch(a=this._read(),a){case 47:case 34:case 39:case -1:return this._unread(a),
1}};a.prototype={destroy:function(){var a=this.view;if(a){var b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());b.removeEventListener("Changed",this._listener.onChanged);a.removeEventListener("MouseDown",this._listener.onMouseDown);a.removeEventListener("Selection",this._listener.onSelection);a.removeEventListener("Destroy",this._listener.onDestroy);a.removeEventListener("LineStyle",this._listener.onLineStyle);this.view=null}},setHighlightCaretLine:function(a){this.highlightCaretLine=a},setWhitespacesVisible:function(a,
b){this.whitespacesVisible!==a&&(this.whitespacesVisible=a,this._scanner.whitespacesVisible=a,this._commentScanner.whitespacesVisible=a,b&&this.view.redraw())},setTabsVisible:function(a){this.tabsVisible!==a&&(this.tabsVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw())},setSpacesVisible:function(a){this.spacesVisible!==a&&(this.spacesVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw())},setDetectHyperlinks:function(a){this.detectHyperlinks=
a},setFoldingEnabled:function(a){this.foldingEnabled=a},setDetectTasks:function(a){this.detectTasks=a},_binarySearch:function(a,b,d,e,f){var h;void 0===e&&(e=-1);void 0===f&&(f=a.length);for(;1<f-e;)if(h=Math.floor((f+e)/2),b<=a[h].start)f=h;else if(d&&b<a[h].end){f=h;break}else e=h;return f},_computeComments:function(){var a=this.view.getModel();a.getBaseModel&&(a=a.getBaseModel());this.comments=this._findComments(a.getText())},_computeFolding:function(){if(this.foldingEnabled){var a=this.view.getModel();
if(a.getBaseModel){var b=this.annotationModel;if(b){b.removeAnnotations(m.AnnotationType.ANNOTATION_FOLDING);for(var d=[],e=a.getBaseModel(),f=this.comments,h=0;h<f.length;h++){var g=f[h];(g=this._createFoldingAnnotation(a,e,g.start,g.end))&&d.push(g)}b.replaceAnnotations(null,d)}}}},_createFoldingAnnotation:function(a,b,d,e){var f=b.getLineAtOffset(d);b=b.getLineAtOffset(e);return f===b?null:new (m.AnnotationType.getType(m.AnnotationType.ANNOTATION_FOLDING))(d,e,a)},_computeTasks:function(a,b,d){if(this.detectTasks){var e=
this.annotationModel;if(e){var f=this.view.getModel(),h=f;f.getBaseModel&&(h=f.getBaseModel());for(var g=e.getAnnotations(b,d),f=[],l=m.AnnotationType.ANNOTATION_TASK;g.hasNext();){var k=g.next();k.type===l&&f.push(k)}g=[];k=this._commentScanner;k.setText(h.getText(b,d));for(var p;p=k.nextToken();){var n=k.getStartOffset()+b;14===p&&(p=h.getLineEnd(h.getLineAtOffset(n)),6!==a&&(p=Math.min(p,d-this.commentEnd.length)),g.push(m.AnnotationType.createAnnotation(l,n,p,h.getText(n,p))))}e.replaceAnnotations(f,
g)}}},_getLineStyle:function(a){if(this.highlightCaretLine){var b=this.view,d=b.getModel(),b=b.getSelection();if(b.start===b.end&&d.getLineAtOffset(b.start)===a)return y}return null},_getStyles:function(a,b,d){a.getBaseModel&&(d=a.mapOffset(d));for(var e=d+b.length,f=[],h=d,g=this.comments,l=this._binarySearch(g,d,!0);l<g.length&&!(g[l].start>=e);l++){var k=g[l].start,m=g[l].end;h<k&&this._parse(b.substring(h-d,k-d),h,f);var p=g[l].type,n;switch(p){case 8:n=t;break;case 7:n=r;break;case 5:n=v}h=Math.max(h,
k);k=Math.min(e,m);(8===p||7===p)&&(this.whitespacesVisible||this.detectHyperlinks)?this._parseComment(b.substring(h-d,k-d),h,f,n,p):5===p&&this.whitespacesVisible?this._parseString(b.substring(h-d,k-d),h,f,v):f.push({start:h,end:k,style:n});h=m}h<e&&this._parse(b.substring(h-d,e-d),h,f);if(a.getBaseModel)for(b=0;b<f.length;b++)d=f[b].end-f[b].start,f[b].start=a.mapOffset(f[b].start,!0),f[b].end=f[b].start+d;return f},_parse:function(a,b,d){var e=this._scanner;for(e.setText(a);a=e.nextToken();){var f=
e.getStartOffset()+b,h=null;switch(a){case 2:h=A;break;case 3:h=z;break;case 5:case 4:if(this.whitespacesVisible){this._parseString(e.getData(),f,d,v);continue}else h=v;break;case 8:this._parseComment(e.getData(),f,d,t,a);continue;case 6:this._parseComment(e.getData(),f,d,q,a);continue;case 7:this._parseComment(e.getData(),f,d,r,a);continue;case 10:this.whitespacesVisible&&this.tabsVisible&&(h=u);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(h=B)}d.push({start:f,end:e.getOffset()+b,
style:h})}},_parseComment:function(a,b,d,e,f){var h=this._commentScanner;h.setText(a);for(h.setType(f);a=h.nextToken();){f=h.getStartOffset()+b;var g=e;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(g=u);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(g=B);break;case 12:g=w;break;case 13:g=x;break;case 14:g=s;break;default:this.detectHyperlinks&&(g=this._detectHyperlinks(h.getData(),f,d,g))}g&&d.push({start:f,end:h.getOffset()+b,style:g})}},_parseString:function(a,b,d,e){var f=
this._whitespaceScanner;for(f.setText(a);a=f.nextToken();){var h=f.getStartOffset()+b,g=e;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(g=u);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(g=B)}g&&d.push({start:h,end:f.getOffset()+b,style:g})}},_detectHyperlinks:function(a,b,d,e){var f=null,h;if(0<(h=a.indexOf("://"))){for(var f=a,g=h;0<g;){h=f.charCodeAt(g-1);if(!(97<=h&&122>=h||65<=h&&90>=h||45===h||48<=h&&57>=h))break;g--}if(0<g&&(h="\"\"''(){}[]\x3c\x3e".indexOf(f.substring(g-
1,g)),-1!==h&&0===(h&1)&&-1!==(h=f.lastIndexOf("\"\"''(){}[]\x3c\x3e".substring(h+1,h+2))))){var l=h;h=this._clone(e);h.tagName="a";h.attributes={href:f.substring(g,l)};d.push({start:b,end:b+g,style:e});d.push({start:b+g,end:b+l,style:h});d.push({start:b+l,end:b+a.length,style:e});return null}}else 0===a.toLowerCase().indexOf("bug#")&&(f="https://bugs.eclipse.org/bugs/show_bug.cgi?id\x3d"+parseInt(a.substring(4),10));return f?(h=this._clone(e),h.tagName="a",h.attributes={href:f},h):e},_clone:function(a){if(!a)return a;
var b={},d;for(d in a)a.hasOwnProperty(d)&&(b[d]=a[d]);return b},_findComments:function(a,b){b=b||0;var d=this._firstScanner,e;d.setText(a);for(var f=[];e=d.nextToken();)(7===e||8===e||5===e)&&f.push({start:d.getStartOffset()+b,end:d.getOffset()+b,type:e}),(6===e||7===e||8===e)&&this._computeTasks(e,d.getStartOffset()+b,d.getOffset()+b);return f},_findMatchingBracket:function(a,b){var d="{}()[]\x3c\x3e",e=a.getText(b,b+1),f=d.indexOf(e,0);if(-1===f)return-1;var h;h=f&1?d.substring(f-1,f):d.substring(f+
1,f+2);for(var g=a.getLineAtOffset(b),d=a.getLine(g),l=a.getLineStart(g),k=a.getLineEnd(g),d=this._findBrackets(e,h,d,l,l,k),k=0;k<d.length;k++)if(l=0<=d[k]?1:-1,d[k]*l-1===b){var m=1;if(f&1){for(k--;0<=k;k--)if(l=0<=d[k]?1:-1,m+=l,0===m)return d[k]*l-1;for(g-=1;0<=g;){d=a.getLine(g);l=a.getLineStart(g);k=a.getLineEnd(g);d=this._findBrackets(e,h,d,l,l,k);for(f=d.length-1;0<=f;f--)if(l=0<=d[f]?1:-1,m+=l,0===m)return d[f]*l-1;g--}}else{for(k++;k<d.length;k++)if(l=0<=d[k]?1:-1,m+=l,0===m)return d[k]*
l-1;g+=1;for(f=a.getLineCount();g<f;){d=a.getLine(g);l=a.getLineStart(g);k=a.getLineEnd(g);d=this._findBrackets(e,h,d,l,l,k);for(k=0;k<d.length;k++)if(l=0<=d[k]?1:-1,m+=l,0===m)return d[k]*l-1;g++}}break}return-1},_findBrackets:function(a,b,d,e,f,h){var g=[];a=a.charCodeAt(0);b=b.charCodeAt(0);for(var l=f,k=this._scanner,m,p=this.comments,n=this._binarySearch(p,f,!0);n<p.length&&!(p[n].start>=h);n++){m=p[n].start;var q=p[n].end;if(l<m)for(k.setText(d.substring(l-f,m-f));m=k.nextToken();)m===a?g.push(k.getStartOffset()+
l-f+e+1):m===b&&g.push(-(k.getStartOffset()+l-f+e+1));l=q}if(l<h)for(k.setText(d.substring(l-f,h-f));m=k.nextToken();)m===a?g.push(k.getStartOffset()+l-f+e+1):m===b&&g.push(-(k.getStartOffset()+l-f+e+1));return g},_onDestroy:function(a){this.destroy()},_onLineStyle:function(a){a.textView===this.view&&(a.style=this._getLineStyle(a.lineIndex));a.ranges=this._getStyles(a.textView.getModel(),a.lineText,a.lineStart)},_onSelection:function(a){var b=a.oldValue,d=a.newValue,e=this.view;a=e.getModel();var f;
if(this.highlightCaretLine){var h=a.getLineAtOffset(b.start);f=a.getLineAtOffset(d.start);var g=d.start===d.end,b=b.start===b.end;h===f&&b&&g||(b&&e.redrawLines(h,h+1),(h!==f||!b)&&g&&e.redrawLines(f,f+1))}if(this.annotationModel){var b=this._bracketAnnotations,l,k;if(d.start===d.end&&0<(k=e.getCaretOffset()))k-=1,a.getBaseModel&&(k=a.mapOffset(k),a=a.getBaseModel()),a=this._findMatchingBracket(a,k),-1!==a&&(l=[m.AnnotationType.createAnnotation(m.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,a+1),
m.AnnotationType.createAnnotation(m.AnnotationType.ANNOTATION_CURRENT_BRACKET,k,k+1)]);this._bracketAnnotations=l;this.annotationModel.replaceAnnotations(b,l)}},_onMouseDown:function(a){if(2===a.clickCount){var b=this.view,d=b.getModel(),e=b.getOffsetAtLocation(a.x,a.y);if(0<e){var f=e-1,h=d;d.getBaseModel&&(f=d.mapOffset(f),h=d.getBaseModel());f=this._findMatchingBracket(h,f);-1!==f&&(a.preventDefault(),a=f,d.getBaseModel&&(a=d.mapOffset(a,!0)),e>a&&(e--,a++),b.setSelection(a,e))}}},_onModelChanged:function(a){var b=
a.start,d=a.removedCharCount,e=a.addedCharCount-d,f=this.view;a=f.getModel();var h=a.getBaseModel?a.getBaseModel():a,d=b+d,g=h.getCharCount(),l=this.comments.length,k=h.getLineStart(h.getLineAtOffset(b)),p=this._binarySearch(this.comments,k,!0),n=this._binarySearch(this.comments,d,!1,p-1,l);p<l&&this.comments[p].start<=k&&k<this.comments[p].end?(k=this.comments[p].start,k>b&&(k+=e)):k=p===l&&0<l&&g-e===this.comments[l-1].end?this.comments[l-1].start:k;var q;n<l?(q=this.comments[n].end,q>b&&(q+=e),
n+=1):(n=l,q=g);for(var g=h.getText(k,q),r,g=this._findComments(g,k),l=p;l<this.comments.length;l++)r=this.comments[l],r.start>b&&(r.start+=e),r.start>b&&(r.end+=e);var t=n-p!==g.length;if(!t)for(l=0;l<g.length;l++){r=this.comments[p+l];var s=g[l];if(r.start!==s.start||r.end!==s.end||r.type!==s.type){t=!0;break}}l=[p,n-p].concat(g);Array.prototype.splice.apply(this.comments,l);t&&(l=k,r=q,a!==h&&(l=a.mapOffset(l,!0),r=a.mapOffset(r,!0)),f.redrawRange(l,r));if(this.foldingEnabled&&h!==a&&this.annotationModel){f=
this.annotationModel;p=f.getAnnotations(k,q);k=[];for(q=[];p.hasNext();)if(r=p.next(),r.type===m.AnnotationType.ANNOTATION_FOLDING){q.push(r);for(l=0;l<g.length&&!(r.start===g[l].start&&r.end===g[l].end);l++);l===g.length?(k.push(r),r.expand()):(l=r.start,n=r.end,l>b&&(l-=e),n>b&&(n-=e),l<=b&&(b<n&&l<=d&&d<n)&&(l=h.getLineAtOffset(r.start),n=h.getLineAtOffset(r.end),l!==n?r.expanded||r.expand():f.removeAnnotation(r)))}b=[];for(l=0;l<g.length;l++){r=g[l];for(e=0;e<q.length&&!(q[e].start===r.start&&
q[e].end===r.end);e++);e===q.length&&(r=this._createFoldingAnnotation(a,h,r.start,r.end))&&b.push(r)}f.replaceAnnotations(k,b)}}};return{TextStyler:a}});
define("orion/editor/textStyler",["orion/editor/annotations","orion/editor/eventTarget"],function(m,n){function k(a,b){this._patternManager=new e(a,b)}function e(a,b){this._unnamedCounter=0;this._patterns=[];this._rootId=b;a.forEach(function(a){this._addRepositoryPatterns(a.repository||{},a.id);this._addPatterns(a.patterns||[],a.id)}.bind(this))}function d(a,b,d,e,f,g,k){this.start=a.start;this.end=a.end;this.contentStart=a.contentStart;this.contentEnd=a.contentEnd;this.name=b;this.typeId=d;this.styler=
e;this.parent=g;k&&k(this);this._subBlocks=e.computeBlocks(f,f.getText(this.start,this.end),this,this.start,null,null,null)}function g(a){this._styler=a}function f(a,b,d){this._highlightCaretLine=this._whitespacesVisible=this._spacesVisible=this._tabsVisible=!1;this._detectTasks=this._foldingEnabled=!0;this._view=a;this._annotationModel=b;this._stylerAdapter=d;this._stylerAdapter.setStyler(this);this._accessor=new g(this);this._bracketAnnotations;var e=this;this._listener={onChanged:function(a){e._onModelChanged(a)},
onDestroy:function(a){e._onDestroy(a)},onLineStyle:function(a){e._onLineStyle(a)},onMouseDown:function(a){e._onMouseDown(a)},onSelection:function(a){e._onSelection(a)}};d=a.getModel();d.getBaseModel&&(d=d.getBaseModel());d.addEventListener("Changed",this._listener.onChanged);a.addEventListener("MouseDown",this._listener.onMouseDown);a.addEventListener("Selection",this._listener.onSelection);a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("LineStyle",this._listener.onLineStyle);
var f=d.getCharCount();this._rootBlock=this._stylerAdapter.createBlock({start:0,contentStart:0,end:f,contentEnd:f},this,d,null);b&&(f=[],b.removeAnnotations(m.AnnotationType.ANNOTATION_FOLDING),this._computeFolding(this._rootBlock.getBlocks(),a.getModel(),f),this._detectTasks&&(b.removeAnnotations(m.AnnotationType.ANNOTATION_TASK),this._computeTasks(this._rootBlock,d,f)),b.replaceAnnotations([],f));a.redrawLines()}var b=function(a,b,d,e,f){var g;void 0===e&&(e=-1);void 0===f&&(f=a.length);for(;1<
f-e;)if(g=Math.floor((f+e)/2),b<=a[g].start)f=g;else if(d&&b<a[g].end){f=g;break}else e=g;return f};k.prototype={blockSpansBeyondEnd:function(a){return a.pattern.regexEnd===this._eolRegex},computeBlocks:function(a,b,d,e,f,g,k){if(!b)return[];var m=[],n=[];f=f||0;g=g||Infinity;k=k||Infinity;d.blockPatterns.forEach(function(a){var d=this._findMatch(a.regexBegin||a.regex,b,f);d&&n.push({result:d,pattern:a})}.bind(this));if(!n.length)return m;n.sort(function(a,b){return a.result.index<b.result.index?
-1:a.result.index>b.result.index?1:a.pattern.pattern.index<b.pattern.pattern.index?-1:1});for(var x=0;0<n.length;){var v=n[0];n.splice(0,1);if(g<v.result.index)break;if(!(v.result.index<x)){var x=e+v.result.index,z=v.result.index,A=null,B=v.pattern.regexEnd;if(B){var z=z+v.result[0].length,u=v.pattern,y=this._substituteCaptureValues(B,v.result);y!==B&&(u={pattern:u.pattern,regexBegin:u.regexBegin,regexEnd:y},B=y);for(y=z;!A;){y=this._findMatch(B,b,y);y||(this._eolRegex.lastIndex=0,y=this._eolRegex.exec(b),
u={pattern:u.pattern,regexBegin:u.regexBegin,regexEnd:this._eolRegex});var C=this.createBlock({start:x,end:e+y.index+y[0].length,contentStart:e+z,contentEnd:e+y.index},d.styler,a,d,u),E=C.getBlocks();if(!E.length||E[E.length-1].end<=y.index+e)A=C;y=y.index+y[0].length}}else A=this.createBlock({start:x,end:x+v.result[0].length,contentStart:x,contentEnd:x+v.result[0].length},d.styler,a,d,v.pattern);m.push(A);if(m.length===k||g<=A.end)break;x=A.end-e}this._updateMatch(v,b,n,x,g)}return m},computeStyle:function(a,
d,e){if(!a.pattern)return null;var f={start:a.start,end:a.end,style:a.pattern.pattern.name};if(a.contentStart<=e&&e<a.contentEnd)return a.pattern.pattern.contentName?{start:a.contentStart,end:a.contentEnd,style:a.pattern.pattern.contentName}:f;var g,k;if(e<a.contentStart){k=a.pattern.pattern.beginCaptures||a.pattern.pattern.captures;if(!k)return f;g=a.pattern.regexBegin;d=d.getText(a.start,a.contentStart);a=a.start}else{k=a.pattern.pattern.endCaptures||a.pattern.pattern.captures;if(!k)return f;g=
a.pattern.regexEnd;d=d.getText(a.contentEnd,a.end);a=a.contentEnd}g.lastIndex=0;if(g=g.exec(d))if(d=[],this._getCaptureStyles(g,k,a,d),(k=d[b(d,e,!0)])&&k.start<=e&&e<k.end)return k;return f},createBlock:function(a,b,e,f,g){return new d(a,g?g.pattern.name:null,g?g.pattern.id:null,b,e,f,function(a){a.pattern=g;a.linePatterns=[];a.blockPatterns=[];a.enclosurePatterns={};this._initPatterns(this._patternManager,a)}.bind(this))},getBlockContentStyleName:function(a){return a.pattern.pattern.contentName||
a.pattern.pattern.name},getBlockEndStyle:function(a,b,d,e){var f;if(a.pattern.regexEnd&&(f=this._findMatch(a.pattern.regexEnd,b,0)))(b=a.pattern.pattern.endCaptures||a.pattern.pattern.captures)?this._getCaptureStyles(f,b,d-f[0].length,e):a.pattern.pattern.name&&e.push({start:d-f[0].length,end:d,style:a.pattern.pattern.name});return f?f[0]:null},getBlockStartStyle:function(a,b,d,e){var f;if(a.pattern.regexBegin&&(f=this._findMatch(a.pattern.regexBegin,b,0)))(b=a.pattern.pattern.beginCaptures||a.pattern.pattern.captures)?
this._getCaptureStyles(f,b,d,e):e.push({start:d,end:d+f[0].length,style:a.pattern.pattern.name});return f?f[0]:null},getBracketMatch:function(a,b){for(var d,e=Object.keys(a.enclosurePatterns),f=0;f<e.length;f++){var g=a.enclosurePatterns[e[f]],k=this._findMatch(g.regex,b,0);if(k&&0===k.index){d=g;break}}if(!d)return null;f=!1;-1!==d.pattern.name.indexOf(this._PUNCTUATION_SECTION_BEGIN)?(f=!0,e=d.pattern.name.replace(this._PUNCTUATION_SECTION_BEGIN,this._PUNCTUATION_SECTION_END)):e=d.pattern.name.replace(this._PUNCTUATION_SECTION_END,
this._PUNCTUATION_SECTION_BEGIN);return!a.enclosurePatterns[e]?null:{beginName:d.pattern.name,endName:e,atStart:f}},parse:function(a,b,d,e,f){if(a&&(d=d.linePatterns)){var g=[];d.forEach(function(b){var d=b.regex||b.regexBegin;d.oldLastIndex=d.lastIndex;(d=this._findMatch(d,a,0))&&g.push({result:d,pattern:b})}.bind(this));g.sort(function(a,b){return a.result.index<b.result.index?-1:a.result.index>b.result.index?1:a.pattern.pattern.index<b.pattern.pattern.index?-1:1});for(var k=0;0<g.length;){var m=
g[0];g.splice(0,1);if(!(m.result.index<k)){var n=m.result.index,x,v=[];if(m.pattern.regex){k=m.result;x=n+k[0].length;x={start:b+n,end:b+x,style:m.pattern.pattern.name};if(!f){m.pattern.pattern.captures&&this._getCaptureStyles(k,m.pattern.pattern.captures,b+n,v);v.sort(function(a,b){return a.start<b.start?-1:a.start>b.start?1:0});for(n=0;n<v.length-1;n++)if(v[n+1].start<v[n].end){var z={start:v[n+1].end,end:v[n].end,style:v[n].style};v[n].end=v[n+1].start;v.splice(n+2,0,z)}}this._mergeStyles(x,v,
e)}else k=m.pattern.regexEnd,k=this._substituteCaptureValues(k,m.result),k=this._findMatch(k,a,m.result.index+m.result[0].length),k||(this._eolRegex.lastIndex=0,k=this._eolRegex.exec(a)),x=k.index+k[0].length,e.push({start:b+n,end:b+x,style:m.pattern.pattern.name});k=k.index+k[0].length}this._updateMatch(m,a,g,k)}d.forEach(function(a){a=a.regex||a.regexBegin;a.lastIndex=a.oldLastIndex})}},setStyler:function(){},verifyBlock:function(a,b,d,e){var f=null,g=[];d.parent.blockPatterns.forEach(function(a){var d=
this._findMatch(a.regexBegin||a.regex,b,0);d&&g.push({result:d,pattern:a})}.bind(this));g.sort(function(a,b){return!a.result.index&&b.result.index?-1:a.result.index&&!b.result.index?1:!a.result.index&&!b.result.index?a.pattern.pattern.index<b.pattern.pattern.index?-1:1:0});if(!g.length||0!==g[0].result.index||g[0].pattern.pattern.id!==d.pattern.pattern.id)f=!1;else{var k=g[0],m=k.pattern.regexEnd;if(m){for(var m=this._substituteCaptureValues(m,k.result),k=k.result[0].length,n=this._findMatch(m,b,
k);null===f&&n&&d.start+n.index!==d.contentEnd+e;){var x=this.computeBlocks(a,b,d,d.start,k,n.index+1,null);!x.length||x[x.length-1].end<=d.start+n.index?f=!1:x.length?(k=x[x.length-1].end-d.start,n=this._findMatch(m,b,k)):n=null}n||(this._eolRegex.lastIndex=0,n=this._eolRegex.exec(b),f=d.start+n.index===d.end+e)}else f=d.start+k.result[0].length===d.end+e}return null!==f?f:!0},_findMatch:function(a,b,d,e){var f=d,g=a.lastIndex;this._linebreakRegex.lastIndex=d;d=this._linebreakRegex.exec(b);var k,
m;a.lastIndex=0;if(d){for(m=d.index;0<=--m&&!(k=b.charAt(m),k===this._NEWLINE||k===this._CR););k=b.substring(m+1,d.index+d[1].length);a.lastIndex=m=d.index-m-1}for(;d&&d.index<b.length;){var n;if(e){var x=a.lastIndex;a.test(k)&&(a.lastIndex=x,n=a.exec(k))}else n=a.exec(k);if(n)return n.index+=f,n.index-=m,a.lastIndex=g,n;m=0;f+=d[0].length;if(d=this._linebreakRegex.exec(b))k=d[1],a.lastIndex=0}a.lastIndex=g;return null},_getCaptureStyles:function(a,b,d,e){if(b[0])e.push({start:d,end:d+a[0].length,
style:b[0].name});else for(var f=0,g=1;g<a.length;g++)if(a[g]){var k=b[g];if(k){var m=d+f;e.push({start:m,end:m+a[g].length,style:k.name})}f+=a[g].length}},_initPatterns:function(a,b){if(b.pattern&&b.pattern.pattern.linePatterns)b.linePatterns=b.pattern.pattern.linePatterns,b.blockPatterns=b.pattern.pattern.blockPatterns,b.enclosurePatterns=b.pattern.pattern.enclosurePatterns;else{var d=a.getPatterns(b.pattern?b.pattern.pattern:null),e=function(a){a="string"===typeof a?a:a.match;var b=this._ignoreCaseRegex.exec(a),
d=this._FLAGS;b&&(a=a.substring(b[0].length),d+="i");return RegExp(a,d)}.bind(this),f=-1,g=0;d.forEach(function(a){var d;if(a.match&&!a.begin&&!a.end){if(d={regex:e(a.match),pattern:a},b.linePatterns.push(d),a.name&&0===a.name.indexOf("punctuation.section")&&(-1!==a.name.indexOf(this._PUNCTUATION_SECTION_BEGIN)||-1!==a.name.indexOf(this._PUNCTUATION_SECTION_END)))b.enclosurePatterns[a.name]=d}else!a.match&&(a.begin&&a.end)&&(f=g,d={regexBegin:e(a.begin),regexEnd:e(a.end),pattern:a},b.linePatterns.push(d));
g++}.bind(this));b.blockPatterns=b.linePatterns.slice(0,f+1);b.pattern&&(b.pattern.pattern.enclosurePatterns=b.enclosurePatterns,b.pattern.pattern.linePatterns=b.linePatterns,b.pattern.pattern.blockPatterns=b.blockPatterns)}},_mergeStyles:function(a,b,d){var e=a.start;b.forEach(function(b){e<=b.start&&d.push({start:e,end:b.start,style:a.style});d.push(b);e=b.end});e<a.end&&d.push({start:e,end:a.end,style:a.style})},_substituteCaptureValues:function(a,b){var d=a.toString();this._captureReferenceRegex.lastIndex=
0;if(!this._captureReferenceRegex.test(d))return a;this._captureReferenceRegex.lastIndex=0;for(var e=this._captureReferenceRegex.exec(d);e;)d=d.replace(e[0],b[e[1]]||""),this._captureReferenceRegex.lastIndex=0,e=this._captureReferenceRegex.exec(d);return RegExp(d.substring(1,d.length-1-this._FLAGS.length),this._FLAGS)},_updateMatch:function(a,b,d,e,f){var g=a.pattern.regex?a.pattern.regex:a.pattern.regexBegin;f=f||Infinity;if((b=this._findMatch(g,b,e,!0))&&b.index<f){a.result=b;for(f=0;f<d.length;f++)if(b.index<
d[f].result.index||b.index===d[f].result.index&&a.pattern.pattern.index<d[f].pattern.pattern.index){d.splice(f,0,a);return}d.push(a)}},_captureReferenceRegex:/\\(\d)/g,_eolRegex:/$/,_ignoreCaseRegex:/^\(\?i\)\s*/,_linebreakRegex:/(.*)(?:[\r\n]|$)/g,_CR:"\r",_FLAGS:"g",_NEWLINE:"\n",_PUNCTUATION_SECTION_BEGIN:".begin",_PUNCTUATION_SECTION_END:".end"};e.prototype={getPatterns:function(a){a?(a="string"===typeof a?a:a.qualifiedId,a+="#"):a=this._rootId+"#"+this._NO_ID;var b=[0],d={},e=RegExp("^"+a+"[^#]+$");
this._patterns.forEach(function(a){e.test(a.qualifiedId)&&(a.include?this._processInclude(a,b,d):(a.index=b[0]++,d[a.id]=a))}.bind(this));var f=[];Object.keys(d).forEach(function(a){f.push(d[a])});return f},_addPattern:function(a,b,d){a.parentId=d;a.id=b;a.qualifiedId=a.parentId+"#"+a.id;this._patterns.push(a);a.patterns&&!a.include&&this._addPatterns(a.patterns,a.qualifiedId)},_addPatterns:function(a,b){a.forEach(function(a){this._addPattern(a,this._NO_ID+this._unnamedCounter++,b)}.bind(this))},
_addRepositoryPatterns:function(a,b){Object.keys(a).forEach(function(d){this._addPattern(a[d],d,b)}.bind(this))},_processInclude:function(a,b,d){var e,f=a.include.indexOf("#");e=0===f?RegExp("^"+a.qualifiedId.substring(0,a.qualifiedId.indexOf("#"))+a.include+"$"):-1===f?RegExp("^"+a.include+"#"+this._NO_ID+"[^#]+$"):RegExp("^"+a.include+"$");this._patterns.forEach(function(a){e.test(a.qualifiedId)&&(a.include?this._processInclude(a,b,d):d[a.id]||(a.index=b[0]++,d[a.id]=a))}.bind(this))},_NO_ID:"NoID"};
d.prototype={adjustBounds:function(a,b){a<this.start&&(this.start+=b);a<this.contentStart&&(this.contentStart+=b);a<=this.end&&(this.end+=b);a<=this.contentEnd&&(this.contentEnd+=b);this._subBlocks.forEach(function(d){a<=d.end&&d.adjustBounds(a,b)})},getBlocks:function(){return this._subBlocks},getBlockAtIndex:function(a){return b(this.getBlocks(),a,!0)},isRenderingWhitespace:function(){return this.styler._isRenderingWhitespace()}};g.prototype={getStyles:function(a){return this._styler.getStyles(a)}};
f.prototype={computeBlocks:function(a,b,d,e,f,g,k){return this._stylerAdapter.computeBlocks(a,b,d,e,f,g,k)},destroy:function(){if(this._view){var a=this._view.getModel();a.getBaseModel&&(a=a.getBaseModel());a.removeEventListener("Changed",this._listener.onChanged);this._view.removeEventListener("MouseDown",this._listener.onMouseDown);this._view.removeEventListener("Selection",this._listener.onSelection);this._view.removeEventListener("Destroy",this._listener.onDestroy);this._view.removeEventListener("LineStyle",
this._listener.onLineStyle);this._view=null}},getBlockAtIndex:function(a){return this._findBlock(this._rootBlock,a)},getRootBlock:function(){return this._rootBlock},getStyleAccessor:function(){return this._accessor},getStyles:function(a){var d=[],e=this._view.getModel();e.getBaseModel&&(e=e.getBaseModel());var f=this._findBlock(this._rootBlock,a),g=e.getLineAtOffset(a),k=e.getLine(g),m=[];this._stylerAdapter.parse(k,e.getLineStart(g),f,m);for((g=m[b(m,a,!0)])&&(g.start<=a&&a<g.end)&&d.push(g);f;)(g=
this._stylerAdapter.computeStyle(f,e,a))&&d.splice(0,0,g),f=f.parent;return d},setDetectHyperlinks:function(){},setDetectTasks:function(a){this._detectTasks=a},setFoldingEnabled:function(a){this._foldingEnabled=a},setHighlightCaretLine:function(a){this._highlightCaretLine=a},setSpacesVisible:function(a){this._spacesVisible!==a&&(this._spacesVisible=a,this.setWhitespacesVisible(this._tabsVisible||this._spacesVisible,!1),this._view.redraw())},setTabsVisible:function(a){this._tabsVisible!==a&&(this._tabsVisible=
a,this.setWhitespacesVisible(this._tabsVisible||this._spacesVisible,!1),this._view.redraw())},setWhitespacesVisible:function(a,b){this._whitespacesVisible!==a&&(this._whitespacesVisible=a,b&&this._view.redraw())},_computeFolding:function(a,b,d){if(b.getBaseModel){var e=b.getBaseModel();a.forEach(function(a){var f=this._createFoldingAnnotation(b,e,a.start,a.end);f&&d.push(f);this._computeFolding(a.getBlocks(),b,d)}.bind(this))}},_computeTasks:function(a,b,d,e,f){e=e||a.start;f=f||a.end;if(a.start<=
f&&e<=a.end&&this._annotationModel){var g=m.AnnotationType.ANNOTATION_TASK;if(a.name&&0===a.name.indexOf("comment")){var k=[];this._stylerAdapter.parse(b.getText(a.contentStart,a.end),a.contentStart,a,k,!0);for(var n=0;n<k.length;n++)"meta.annotation.task.todo"===k[n].style&&(e<=k[n].start&&k[n].end<=f)&&d.push(m.AnnotationType.createAnnotation(g,k[n].start,k[n].end,b.getText(k[n].start,k[n].end)))}a.getBlocks().forEach(function(a){this._computeTasks(a,b,d,e,f)}.bind(this))}},_createFoldingAnnotation:function(a,
b,d,e){var f=b.getLineAtOffset(d),g=b.getLineAtOffset(e);return f===g||f+1===g&&b.getLineStart(g)===b.getLineEnd(g)?null:new (m.AnnotationType.getType(m.AnnotationType.ANNOTATION_FOLDING))(d,e,a)},_findBlock:function(a,d){var e=a.getBlocks();if(!e.length)return a;var f=b(e,d,!0);return f<e.length&&e[f].start<=d&&d<e[f].end?this._findBlock(e[f],d):a},_findBrackets:function(a,d,e,f,g){for(var k=[],m=[],n=f,s=d.getBlocks(),x=b(s,f,!0);x<s.length&&!(s[x].start>=g);x++){var v=s[x].start,z=s[x].end;n<v&&
(this._stylerAdapter.parse(e.substring(n-f,v-f),n,d,m),m.forEach(function(b){0===b.style.indexOf(a.beginName)?k.push(b.start+1):0===b.style.indexOf(a.endName)&&k.push(-(b.start+1))}),m=[]);n=z}n<g&&(this._stylerAdapter.parse(e.substring(n-f,g-f),n,d,m),m.forEach(function(b){b.style&&(0===b.style.indexOf(a.beginName)?k.push(b.start+1):0===b.style.indexOf(a.endName)&&k.push(-(b.start+1)))}));return k},_findMatchingBracket:function(a,b,d){var e=a.getLineAtOffset(d),f=a.getLineEnd(e),g=a.getText(d,f),
g=this._stylerAdapter.getBracketMatch(b,g);if(!g)return-1;for(var k=a.getLine(e),m=a.getLineStart(e),f=this._findBrackets(g,b,k,m,f),n=0;n<f.length;n++)if(k=0<=f[n]?1:-1,f[n]*k-1===d){d=1;if(g.atStart){for(n++;n<f.length;n++)if(k=0<=f[n]?1:-1,d+=k,0===d)return f[n]*k-1;e+=1;for(n=a.getLineCount();e<n;){k=a.getLine(e);m=a.getLineStart(e);f=a.getLineEnd(e);f=this._findBrackets(g,b,k,m,f);for(m=0;m<f.length;m++)if(k=0<=f[m]?1:-1,d+=k,0===d)return f[m]*k-1;e++}}else{for(n--;0<=n;n--)if(k=0<=f[n]?1:-1,
d+=k,0===d)return f[n]*k-1;for(e-=1;0<=e;){k=a.getLine(e);m=a.getLineStart(e);f=a.getLineEnd(e);f=this._findBrackets(g,b,k,m,f);for(n=f.length-1;0<=n;n--)if(k=0<=f[n]?1:-1,d+=k,0===d)return f[n]*k-1;e--}}break}return-1},_getLineStyle:function(a){if(this._highlightCaretLine){var b=this._view.getModel(),d=this._view.getSelection();if(d.start===d.end&&b.getLineAtOffset(d.start)===a)return this._caretLineStyle}return null},_getStyles:function(a,d,e,f){d.getBaseModel&&(f=d.mapOffset(f));for(var g=f+e.length,
k=[],m=f,n=a.getBlocks(),s=b(n,f,!0);s<n.length&&!(n[s].start>=g);s++){var x=n[s].start,v=n[s].end;m<x&&this._stylerAdapter.parse(e.substring(m-f,x-f),m,a,k);var z=Math.max(m,x);z===x&&(x=this._stylerAdapter.getBlockStartStyle(n[s],e.substring(z-f),z,k))&&(z+=x.length);var x=Math.min(g,v),A=[];x===v&&(m=e.substring(x-m-(n[s].end-n[s].contentEnd)),(m=this._stylerAdapter.getBlockEndStyle(n[s],m,x,A))&&(x-=m.length));var m=this._getStyles(n[s],d,e.substring(z-f,x-f),z),B=this._stylerAdapter.getBlockContentStyleName(n[s]);
if(B){var u=z;m.forEach(function(a){a.start-u&&k.push({start:u,end:a.start,style:B});a.mergeable&&(a.style+=","+B);k.push(a);u=a.end});x-u&&k.push({start:u,end:x,style:B})}else k=k.concat(m);k=k.concat(A);m=v}m<g&&this._stylerAdapter.parse(e.substring(m-f,g-f),m,a,k);if(d.getBaseModel)for(a=0;a<k.length;a++)e=k[a].end-k[a].start,k[a].start=d.mapOffset(k[a].start,!0),k[a].end=k[a].start+e;return k},_isRenderingWhitespace:function(){return this._whitespacesVisible&&(this._tabsVisible||this._spacesVisible)},
_onDestroy:function(){this.destroy()},_onLineStyle:function(a){a.textView===this._view&&(a.style=this._getLineStyle(a.lineIndex));a.ranges=this._getStyles(this._rootBlock,a.textView.getModel(),a.lineText,a.lineStart);a.ranges.forEach(function(a){a.style&&(a.style={styleClass:a.style.replace(/\./g," ")})});this._isRenderingWhitespace()&&(this._spacesVisible&&this._spliceStyles(this._spacePattern,a.ranges,a.lineText,a.lineStart),this._tabsVisible&&this._spliceStyles(this._tabPattern,a.ranges,a.lineText,
a.lineStart))},_onModelChanged:function(a){var d=a.start,e=a.removedCharCount;a=a.addedCharCount-e;var f=this._view.getModel(),g=f.getBaseModel?f.getBaseModel():f,e=d+e,k=g.getCharCount(),n=g.getLineStart(g.getLineAtOffset(d)),w=this._findBlock(this._rootBlock,d),s,x,v,z,A,B,u;do{v=w.parent;if(!s&&v&&(A=g.getText(w.start,Math.min(k,w.end+a+1)),!this._stylerAdapter.verifyBlock(g,A,w,a))){w=v;continue}x=w.getBlocks();var y=x.length,C=b(x,n,!0),E=b(x,e,!1,C-1,y);s=!1;if(C&&x.length&&x[C-1].end===d){A=
g.getText(x[C-1].start,Math.min(k,d+1));var D=this.computeBlocks(g,A,w,x[C-1].start,null,null,null);D.length&&D[0].end!==x[C-1].end&&(C--,s=!0)}C<y&&x[C].start<=n&&(n<x[C].end||s)?(u=x[C].start,u>d&&(u+=a)):C===y&&0<y&&w.end-a===x[y-1].end?(u=x[--C].start,u>d&&(u+=a)):u=Math.max(n,w.contentStart);B=E<y?x[E].end:w.contentEnd;d<=B&&(B+=a);B=Math.min(B,k-1);A=g.getText(u,B+1);D=this.computeBlocks(g,A,w,u,null,null,null);if(E<y){if(D.length&&D[D.length-1].end===B&&D[D.length-1].typeId===x[E].typeId)break;
if(D.length&&this._stylerAdapter.blockSpansBeyondEnd(D[D.length-1])){E++;for(var H=D[D.length-1].getBlocks(),H=(H.length?H[H.length-1]:D[D.length-1]).typeId;E<y;){if(x[E].typeId===H){var I=x[E].end+a,I=Math.min(I,k-1);A=g.getText(u,I+1);A=this.computeBlocks(g,A,w,u,null,null,null);if(A.length&&A[A.length-1].end===I){B=I;D=A;break}}E++}if(E<y)break}}else if(!D.length||D[D.length-1].end<=w.contentEnd+a)break;if(!v){B=k;E=y;A=g.getText(u,B);D=this.computeBlocks(g,A,w,u,null,null,null);break}w=v;z=!0}while(1);
this._rootBlock.adjustBounds(d,a);E=Math.min(E+1,y);z||(z=E-C!==D.length);if(!z)for(y=0;y<D.length;y++)if(s=x[C+y],k=D[y],s.start!==k.start||s.end!==k.end||s.typeId!==k.typeId){z=!0;break}!x.length&&!D.length?this.dispatchEvent({type:"BlocksChanged",old:[w],"new":[w]}):this.dispatchEvent({type:"BlocksChanged",old:x.slice(C,E),"new":D});C=[C,E-C].concat(D);Array.prototype.splice.apply(x,C);z&&(x=u,z=B,f!==g&&(x=f.mapOffset(x,!0),z=f.mapOffset(z,!0)),this._view.redrawRange(x,z));if(this._annotationModel){x=
[];var G=[],J=[];z=this._annotationModel.getAnnotations(u,B);C=this._foldingEnabled&&g!==f;for(E=w.parent||w;z.hasNext();)D=z.next(),C&&D.type===m.AnnotationType.ANNOTATION_FOLDING?(J.push(D),s=this._findBlock(E,D.start),!s||!(D.start===s.start&&D.end===s.end)?(x.push(D),D.expand()):(s=D.start,y=D.end,s>d&&(s-=a),y>d&&(y-=a),s<=d&&(d<y&&s<=e&&e<y)&&(s=g.getLineAtOffset(D.start),y=g.getLineAtOffset(D.end),s!==y?D.expanded||D.expand():x.push(D)))):D.type===m.AnnotationType.ANNOTATION_TASK&&w.start<=
D.start&&D.end<=w.end&&x.push(D);C&&E.getBlocks().forEach(function(a){this._updateFolding(a,g,f,J,G,u,B)}.bind(this));this._detectTasks&&this._computeTasks(w,g,G,u,B);this._annotationModel.replaceAnnotations(x,G)}},_onMouseDown:function(a){if(2===a.clickCount){var b=this._view.getModel(),d=this._view.getOffsetAtLocation(a.x,a.y);if(0<d){var e=d-1,f=b;b.getBaseModel&&(e=b.mapOffset(e),f=b.getBaseModel());var g=this._findBlock(this._rootBlock,e),e=this._findMatchingBracket(f,g,e);-1!==e&&(a.preventDefault(),
a=e,b.getBaseModel&&(a=b.mapOffset(a,!0)),d>a&&(d--,a++),this._view.setSelection(a,d))}}},_onSelection:function(a){var b=a.oldValue,d=a.newValue;a=this._view.getModel();var e;if(this._highlightCaretLine){var f=a.getLineAtOffset(b.start);e=a.getLineAtOffset(d.start);var g=d.start===d.end,b=b.start===b.end;f===e&&b&&g||(b&&this._view.redrawLines(f,f+1),(f!==e||!b)&&g&&this._view.redrawLines(e,e+1))}if(this._annotationModel){var b=this._bracketAnnotations,k,n;if(d.start===d.end&&0<(n=this._view.getCaretOffset()))n-=
1,a.getBaseModel&&(n=a.mapOffset(n),a=a.getBaseModel()),d=this._findBlock(this._rootBlock,n),a=this._findMatchingBracket(a,d,n),-1!==a&&(k=[m.AnnotationType.createAnnotation(m.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,a+1),m.AnnotationType.createAnnotation(m.AnnotationType.ANNOTATION_CURRENT_BRACKET,n,n+1)]);this._bracketAnnotations=k;this._annotationModel.replaceAnnotations(b,k)}},_spliceStyles:function(a,b,d,e){for(var f=a.regex,g=f.lastIndex=0,k=f.exec(d);k;){for(k=e+k.index;g<b.length&&!(k<
b[g].end);)g++;var m={start:k,end:k+1,style:a.style};if(g<b.length&&b[g].start<=k){var n={start:k+1,end:b[g].end,style:b[g].style};b[g].end=k;b.splice(g+1,0,n);b.splice(g+1,0,m);g+=2}else b.splice(g,0,m),g++;k=f.exec(d)}},_updateFolding:function(a,d,e,f,g,k,m){k=k||a.start;m=m||a.end;if(!a.doNotFold&&a.start<=m&&k<=a.end){var n=b(f,a.start,!0);n<f.length&&f[n].start===a.start&&f[n].end===a.end||(n=this._createFoldingAnnotation(e,d,a.start,a.end))&&g.push(n);a.getBlocks().forEach(function(a){this._updateFolding(a,
d,e,f,g,k,m)}.bind(this))}},_caretLineStyle:{styleClass:"meta annotation currentLine"},_spacePattern:{regex:/[ ]/g,style:{styleClass:"punctuation separator space",unmergeable:!0}},_tabPattern:{regex:/\t/g,style:{styleClass:"punctuation separator tab",unmergeable:!0}}};n.EventTarget.addMixin(f.prototype);return{TextStyler:f,Block:d,createPatternBasedAdapter:function(a,b){return new k(a,b)}}});
define("orion/editor/textMateStyler",["orion/regex"],function(m){function n(d){var e;if(d instanceof Array){e=Array(d.length);for(var f=0;f<d.length;f++)e[f]=n(d[f])}else for(f in e={},d)if(Object.prototype.hasOwnProperty.call(d,f)){var b=d[f];e[f]="object"===typeof b&&null!==b?n(b):b}return e}function k(d,e,f){this.initialize(d);this.grammar=n(e);this.externalGrammars=f?n(f):[];this._styles={};this._tree=null;this._allGrammars={};this.preprocess(this.grammar)}var e={unsupported:[{regex:/\(\?[ims\-]:/,
func:function(d){return"option on/off for subexp"}},{regex:/\(\?<([=!])/,func:function(d){return"\x3d"===d[1]?"lookbehind":"negative lookbehind"}},{regex:/\(\?>/,func:function(d){return"atomic group"}}],toRegExp:function(d){function g(a,b){throw Error('Unsupported regex feature "'+a+'": "'+b[0]+'" at index: '+b.index+" in "+b.input);}var f="",b;d=e.processGlobalFlag("x",d,function(a){for(var b="",d=!1,e=a.length,f=0;f<e;){var g=a.charAt(f);if(!d&&"#"===g)for(;f<e&&"\r"!==g&&"\n"!==g;)g=a.charAt(++f);
else if(!d&&/\s/.test(g))for(;f<e&&/\s/.test(g);)g=a.charAt(++f);else"\\"===g?(b+=g,/\s/.test(a.charAt(f+1))||(b+=a.charAt(f+1),f+=1)):("["===g?d=!0:"]"===g&&(d=!1),b+=g),f+=1}return b});d=e.processGlobalFlag("i",d,function(a){f+="i";return a});for(b=0;b<this.unsupported.length;b++){var a;(a=this.unsupported[b].regex.exec(d))&&g(this.unsupported[b].func(a),a)}return RegExp(d,f)},processGlobalFlag:function(d,e,f){var b="(?"+d+")";d="(?"+d+":";if(e.substring(0,b.length)===b)return f(e.substring(b.length));
if(e.substring(0,d.length)===d){for(var b=0,a=e.length,l=-1,h=0;h<a&&-1===l;h++)switch(e.charAt(h)){case "\\":h++;break;case "(":b++;break;case ")":b--,0===b&&(l=h)}b=l;if(b<e.length-1)throw Error("Only a "+d+") group that encloses the entire regex is supported in: "+e);return f(e.substring(d.length,b))}return e},hasBackReference:function(d){return/\\\d+/.test(d.source)},getSubstitutedRegex:function(d,e,f){f="undefined"===typeof f?!0:!1;d=d.source.split(/(\\\d+)/g);for(var b=[],a=0;a<d.length;a++){var l=
d[a],h=/\\(\d+)/.exec(l);h?(l=e[h[1]]||"",b.push(f?m.escape(l):l)):b.push(l)}return RegExp(b.join(""))},groupify:function(d,e){for(var f=d.source,b=f.length,a=[],l=0,h=[],k=1,m=1,n=[],t={},w={},s=0;s<b;s++){var x=a[a.length-1],v=f.charAt(s);switch(v){case "(":4===x&&(a.pop(),n.push(")"),h[h.length-1].end=s);var z=s+2<b?f.charAt(s+1)+""+f.charAt(s+2):null;if("?:"===z||"?\x3d"===z||"?!"===z){var A;"?:"===z?A=1:(A=3,l++);a.push(A);h.push({start:s,end:-1,type:A});n.push(v);n.push(z);s+=z.length}else a.push(2),
h.push({start:s,end:-1,type:2,oldNum:k,num:m}),n.push(v),0===l&&(w[m]=null),t[k]=m,k++,m++;break;case ")":x=a.pop();3===x&&l--;h[h.length-1].end=s;n.push(v);break;case "*":case "+":case "?":case "}":var B=v,u=f.charAt(s-1),z=s-1;if("}"===v){for(A=s-1;"{"!==f.charAt(A)&&0<=A;A--);u=f.charAt(A-1);z=A-1;B=f.substring(A,s+1)}A=h[h.length-1];if(")"===u&&(2===A.type||4===A.type)){n.splice(A.start,0,"(");n.push(B);n.push(")");v={start:A.start,end:n.length-1,type:4,num:A.num};for(u=0;u<h.length;u++)if(x=
h[u],(2===x.type||4===x.type)&&x.start>=A.start&&x.end<=z)x.start+=1,x.end+=1,x.num+=1,2===x.type&&(t[x.oldNum]=x.num);h.push(v);m++;break}default:"|"!==v&&(2!==x&&4!==x)&&0===l&&(a.push(4),h.push({start:s,end:-1,type:4,num:m}),n.push("("),w[m]=null,m++),n.push(v),"\\"===v&&(v=f.charAt(s+1),n.push(v),s+=1)}}for(;a.length;)a.pop(),n.push(")");f=RegExp(n.join(""));b={};e=e||t;for(var y in e)e.hasOwnProperty(y)&&(b[y]="\\"+e[y]);f=this.getSubstitutedRegex(f,b,!1);return[f,t,w]},complexCaptures:function(d){if(!d)return!1;
for(var e in d)if(d.hasOwnProperty(e)&&"0"!==e)return!0;return!1}};k.prototype={initialize:function(d){this.textView=d;this.textView.stylerOptions=this;var e=this;this._listener={onModelChanged:function(d){e.onModelChanged(d)},onDestroy:function(d){e.onDestroy(d)},onLineStyle:function(d){e.onLineStyle(d)},onStorage:function(d){e.onStorage(d)}};d.addEventListener("ModelChanged",this._listener.onModelChanged);d.addEventListener("Destroy",this._listener.onDestroy);d.addEventListener("LineStyle",this._listener.onLineStyle);
d.redrawLines()},onDestroy:function(d){this.destroy()},destroy:function(){this.textView&&(this.textView.removeEventListener("ModelChanged",this._listener.onModelChanged),this.textView.removeEventListener("Destroy",this._listener.onDestroy),this.textView.removeEventListener("LineStyle",this._listener.onLineStyle),this.textView=null);this._listener=this._tree=this._styles=this.grammar=null},preprocess:function(d){for(d=[d];0!==d.length;){var e=d.pop();if(!e._resolvedRule||!e._typedRule)if(e._resolvedRule=
this._resolve(e),e._typedRule=this._createTypedRule(e),this.addStyles(e.name),this.addStyles(e.contentName),this.addStylesForCaptures(e.captures),this.addStylesForCaptures(e.beginCaptures),this.addStylesForCaptures(e.endCaptures),e._resolvedRule!==e&&d.push(e._resolvedRule),e.patterns)for(var f=0;f<e.patterns.length;f++)d.push(e.patterns[f])}},addStyles:function(d){if(d&&!this._styles[d]){this._styles[d]=[];for(var e=d.split("."),f=0;f<e.length;f++)this._styles[d].push(e.slice(0,f+1).join("-"))}},
addStylesForCaptures:function(d){for(var e in d)d.hasOwnProperty(e)&&this.addStyles(d[e].name)},ContainerRule:function(){function d(d){this.rule=d;this.subrules=d.patterns}d.prototype.valueOf=function(){return"aa"};return d}(),BeginEndRule:function(){function d(d){this.rule=d;this.beginRegex=e.toRegExp(d.begin);this.endRegex=e.toRegExp(d.end);this.subrules=d.patterns||[];this.endRegexHasBackRef=e.hasBackReference(this.endRegex);var f=e.complexCaptures(d.captures);d=e.complexCaptures(d.beginCaptures)||
e.complexCaptures(d.endCaptures);if(this.isComplex=f||d)f=e.groupify(this.beginRegex),this.beginRegex=f[0],this.beginOld2New=f[1],this.beginConsuming=f[2],f=e.groupify(this.endRegex,this.beginOld2New),this.endRegex=f[0],this.endOld2New=f[1],this.endConsuming=f[2]}d.prototype.valueOf=function(){return this.beginRegex};return d}(),MatchRule:function(){function d(d){this.rule=d;this.matchRegex=e.toRegExp(d.match);if(this.isComplex=e.complexCaptures(d.captures))d=e.groupify(this.matchRegex),this.matchRegex=
d[0],this.matchOld2New=d[1],this.matchConsuming=d[2]}d.prototype.valueOf=function(){return this.matchRegex};return d}(),_createTypedRule:function(d){return d.match?new this.MatchRule(d):d.begin?new this.BeginEndRule(d):new this.ContainerRule(d)},_resolve:function(d){var e=d;if(d.include){if(d.begin||d.end||d.match)throw Error('Unexpected regex pattern in "include" rule '+d.include);d=d.include;if("#"===d.charAt(0)){if(e=this.grammar.repository&&this.grammar.repository[d.substring(1)],!e)throw Error("Couldn't find included rule "+
d+" in grammar repository");}else if("$self"===d)e=this.grammar;else{if("$base"===d)throw Error('Include "$base" is not supported');e=this._allGrammars[d];if(!e)for(var f=0;f<this.externalGrammars.length;f++){var b=this.externalGrammars[f];if(b.scopeName===d){this.preprocess(b);e=this._allGrammars[d]=b;break}}}}return e},ContainerNode:function(){function d(d,e){this.parent=d;this.rule=e;this.children=[];this.end=this.start=null}d.prototype.addChild=function(d){this.children.push(d)};d.prototype.valueOf=
function(){var d=this.rule;return"ContainerNode { "+(d.include||"")+" "+(d.name||"")+(d.comment||"")+"}"};return d}(),BeginEndNode:function(){function d(d,f,b){this.parent=d;this.rule=f;this.children=[];this.setStart(b);this.endMatch=this.end=null;this.endRegexSubstituted=f.endRegexHasBackRef?e.getSubstitutedRegex(f.endRegex,b):null}d.prototype.addChild=function(d){this.children.push(d)};d.prototype.getIndexInParent=function(d){return this.parent?this.parent.children.indexOf(this):-1};d.prototype.setStart=
function(d){this.start=d.index;this.beginMatch=d};d.prototype.setEnd=function(d){d&&"object"===typeof d?(this.endMatch=d,this.end=d.index+d[0].length):(this.endMatch=null,this.end=d)};d.prototype.shiftStart=function(d){this.start+=d;this.beginMatch.index+=d};d.prototype.shiftEnd=function(d){this.end+=d;this.endMatch&&(this.endMatch.index+=d)};d.prototype.valueOf=function(){return"{"+this.rule.beginRegex+" range\x3d"+this.start+".."+this.end+"}"};return d}(),push:function(d,e){if(e)for(var f=e.length;0<
f;)d.push(e[--f])},exec:function(d,e,f){if(e=d.exec(e))e.index+=f;d.lastIndex=0;return e},afterMatch:function(d){return d.index+d[0].length},getEndMatch:function(d,e,f){if(d instanceof this.BeginEndNode){var b=d.rule;d=d.endRegexSubstituted||b.endRegex;return!d?null:this.exec(d,e,f)}return null},initialParse:function(){this.textView.getModel().getCharCount();this._tree=new this.ContainerNode(null,this.grammar._typedRule);this.parse(this._tree,!1,0)},onModelChanged:function(d){var e=d.addedCharCount,
f=d.removedCharCount;d=d.start;if(this._tree){var b=this.textView.getModel(),a=b.getCharCount(),b=b.getLineEnd(b.getLineAtOffset(d)-1),l=this.getFirstDamaged(b,b),b=-1===b?0:b,e=l?this.parse(l,!0,b,d,e,f):a;this.textView.redrawRange(b,e)}else this.initialParse()},getFirstDamaged:function(d,e){if(0>d)return this._tree;for(var f=[this._tree],b=null;f.length;){var a=f.pop();if(!a.parent||this.isDamaged(a,d,e)){a instanceof this.BeginEndNode&&(b=a);for(var l=0;l<a.children.length;l++)f.push(a.children[l])}}return b||
this._tree},isDamaged:function(d,e,f){return d.start<=f&&d.end>e},parse:function(d,e,f,b,a,l){var h=this.textView.getModel(),k=h.getLineStart(h.getLineCount()-1),m=h.getCharCount(),n=this.getInitialExpected(d,f),t=-1;e&&(d.repaired=!0,d.endNeedsUpdate=!0,t=(t=d.children[d.children.length-1])?h.getLineEnd(h.getLineAtOffset(t.end+(a-l))):-1,b=h.getLineEnd(h.getLineAtOffset(b+l)),t=Math.max(t,b));t=-1===t?m:t;b=n;for(var w=d,s=!1,x=f,v=-1;w&&(!e||x<t);){var z=this.getNextMatch(h,w,x);z||(x=x>=k?m:h.getLineStart(h.getLineAtOffset(x)+
1));var A=z&&z.match,B=z&&z.rule,u=z&&z.isEnd;if(z&&z.isSub)x=this.afterMatch(A),B instanceof this.BeginEndRule&&(s=!0,e&&B===b.rule&&w===b.parent?(w=b,w.setStart(A),w.repaired=!0,w.endNeedsUpdate=!0,b=this.getNextExpected(b,"begin")):(e&&(this.prune(w,b),e=!1),A=new this.BeginEndNode(w,B,A),w.addChild(A),w=A));else if(u||x===m)w instanceof this.BeginEndNode&&(A?(s=!0,v=Math.max(v,w.end),w.setEnd(A),x=this.afterMatch(A),e&&w===b&&w.parent===b.parent?(w.repaired=!0,delete w.endNeedsUpdate,b=this.getNextExpected(b,
"end")):e&&(this.prune(w,b),e=!1)):(w.setEnd(m),delete w.endNeedsUpdate)),w=w.parent;e&&(x>=t&&!s)&&(this.prune(d,n),e=!1)}this.removeUnrepairedChildren(d,e,f);this.cleanup(e,d,f,t,m,a,l);return e?Math.max(v,x):x},removeUnrepairedChildren:function(d,e,f){if(e){e=d.children;for(var b=-1,a=0;a<e.length;a++){var l=e[a];if(!l.repaired&&this.isDamaged(l,f,Number.MAX_VALUE)){b=a;break}}-1!==b&&(d.children.length=b)}},cleanup:function(d,e,f,b,a,l,h){if(d){d=l-h;a=this.getIntersecting(b-d+1,a);e=this.getIntersecting(f,
b);for(f=0;f<a.length;f++)b=a[f],!b.repaired&&b instanceof this.BeginEndNode&&(b.shiftEnd(d),b.shiftStart(d));for(f=0;f<e.length;f++)b=e[f],b.repaired&&b.endNeedsUpdate&&b.shiftEnd(d),delete b.endNeedsUpdate,delete b.repaired}else{e=this.getIntersecting(f,b);for(f=0;f<e.length;f++)delete e[f].repaired}},getNextMatch:function(d,e,f,b){var a=d.getLineAtOffset(f),a=d.getLineEnd(a),l=d.getText(f,a),h=[],k=[];d=[];a=[];for(this.push(h,e.rule.subrules);h.length;){var m=h.length?h.pop():null,m=m&&m._resolvedRule._typedRule;
if(m instanceof this.ContainerRule&&-1===k.indexOf(m))k.push(m),this.push(h,m.subrules);else if(!m||!b||m.matchRegex){var n=m&&this.exec(m.matchRegex||m.beginRegex,l,f);n&&(d.push(n),a.push(m))}}h=Number.MAX_VALUE;k=-1;for(m=0;m<d.length;m++)n=d[m],n.index<h&&(h=n.index,k=m);if(!b&&(f=this.getEndMatch(e,l,f)))if(b=e.rule.applyEndPatternLast,-1===k||f.index<h||!b&&f.index===h)return{isEnd:!0,rule:e.rule,match:f};return-1===k?null:{isSub:!0,rule:a[k],match:d[k]}},getInitialExpected:function(d,e){var f,
b;if(d===this._tree)for(f=0;f<d.children.length;f++){if(b=d.children[f],b.start>=e)return b}else if(d instanceof this.BeginEndNode&&d.endMatch){var a=d.endMatch.index;for(f=0;f<d.children.length&&!(b=d.children[f],b.start>=e);f++);if(b&&b.start<a)return b}return d},getNextExpected:function(d,e){if("begin"===e){var f=d.children[0];return f?f:d}if("end"===e&&(f=d.parent)){var b=f.children[f.children.indexOf(d)+1];return b?b:f}return null},prune:function(d,e){e.parent===d?d.children.length=e.getIndexInParent():
d instanceof this.BeginEndNode&&(d.endMatch=null,d.end=null);d.parent&&(d.parent.children.length=d.getIndexInParent()+1)},onLineStyle:function(d){this._tree||this.initialParse();var e=d.lineStart,f=this.textView.getModel(),b=f.getLineEnd(d.lineIndex),a=f.getLineEnd(f.getLineAtOffset(e)-1),a=this.getFirstDamaged(a,a),e=this.getLineScope(f,a,e,b);d.ranges=this.toStyleRanges(e);d.ranges.sort(function(a,b){return a.start-b.start})},getLineScope:function(d,e,f,b){for(var a=f,l=this.getInitialExpected(e,
f),h=[],k=[];e&&a<b;){var m=this.getNextMatch(d,e,a);if(!m)break;var n=m&&m.match,t=m&&m.rule,w=m&&m.isSub,m=m&&m.isEnd;n.index!==a&&k.push({start:a,end:n.index,node:e});w?(a=this.afterMatch(n),t instanceof this.BeginEndRule?(this.addBeginScope(h,n,t),e=l,l=this.getNextExpected(l,"begin")):this.addMatchScope(h,n,t)):m&&(a=this.afterMatch(n),this.addEndScope(h,n,t),l=this.getNextExpected(l,"end"),e=e.parent)}a<b&&k.push({start:a,end:b,node:e});d=this.getInheritedLineScope(k,f,b);return h.concat(d)},
getInheritedLineScope:function(d,e,f){e=[];for(f=0;f<d.length;f++)for(var b=d[f],a=b.node;a;){var l=a.rule.rule,h=l.name;if(l=l.contentName||h){this.addScopeRange(e,b.start,b.end,l);break}a=a.parent}return e},addBeginScope:function(d,e,f){var b=f.rule;this.addCapturesScope(d,e,b.beginCaptures||b.captures,f.isComplex,f.beginOld2New,f.beginConsuming)},addEndScope:function(d,e,f){var b=f.rule;this.addCapturesScope(d,e,b.endCaptures||b.captures,f.isComplex,f.endOld2New,f.endConsuming)},addMatchScope:function(d,
e,f){var b=f.rule,a=b.name;(b=b.captures)?this.addCapturesScope(d,e,b,f.isComplex,f.matchOld2New,f.matchConsuming):this.addScope(d,e,a)},addScope:function(d,e,f){f&&d.push({start:e.index,end:this.afterMatch(e),scope:f})},addScopeRange:function(d,e,f,b){b&&d.push({start:e,end:f,scope:b})},addCapturesScope:function(d,e,f,b,a,l){if(f)if(b){b={1:0};for(var h=0,k=1;void 0!==e[k];k++)void 0!==l[k]&&(h+=e[k].length),void 0!==e[k+1]&&(b[k+1]=h);l=e.index;for(h=1;f[h];h++){var k=f[h].name,m=a[h],n=l+b[m];
"undefined"!==typeof e[m]&&this.addScopeRange(d,n,n+e[m].length,k)}}else this.addScope(d,e,f[0]&&f[0].name)},getIntersecting:function(d,e){for(var f=[],b=this._tree?[this._tree]:[];b.length;){var a=b.pop(),l=!1;a instanceof this.ContainerNode?l=!0:this.isDamaged(a,d,e)&&(l=!0,f.push(a));if(l)for(var l=a.children.length,h=0;h<l;h++)b.push(a.children[h])}return f.reverse()},toStyleRanges:function(d){for(var e=[],f=0;f<d.length;f++){var b=d[f],a=this._styles[b.scope];if(!a)throw Error("styles not found for "+
b.scope);a=a.join(" ");e.push({start:b.start,end:b.end,style:{styleClass:a}})}return e}};return{RegexUtil:e,TextMateStyler:k}});
define("orion/editor/AsyncStyler",["i18n!orion/editor/nls/messages","orion/editor/annotations"],function(m,n){function k(e){return-1!==e.getProperty("objectClass").indexOf(d)&&"highlighter"===e.getProperty("type")}function e(d,b,a){this.initialize(d,b,a);this.lineStyles=[]}var d="orion.edit.highlighter",g=d+" service must be an event emitter";n.AnnotationType.registerType("orion.annotation.highlightError",{title:m.syntaxError,html:"\x3cdiv class\x3d'annotationHTML error'\x3e\x3c/div\x3e",rangeStyle:{styleClass:"annotationRange error"}});
e.prototype={initialize:function(e,b,a){this.textView=e;this.serviceRegistry=b;this.annotationModel=a;this.services=[];var g=this;this.listener={onModelChanging:function(a){g.onModelChanging(a)},onModelChanged:function(a){g.onModelChanged(a)},onDestroy:function(a){g.onDestroy(a)},onLineStyle:function(a){g.onLineStyle(a)},onStyleReady:function(a){g.onStyleReady(a)},onServiceAdded:function(a){g.onServiceAdded(a.serviceReference,g.serviceRegistry.getService(a.serviceReference))},onServiceRemoved:function(a){g.onServiceRemoved(a.serviceReference,
g.serviceRegistry.getService(a.serviceReference))}};e.addEventListener("ModelChanging",this.listener.onModelChanging);e.addEventListener("ModelChanged",this.listener.onModelChanged);e.addEventListener("Destroy",this.listener.onDestroy);e.addEventListener("LineStyle",this.listener.onLineStyle);b.addEventListener("registered",this.listener.onServiceAdded);b.addEventListener("unregistering",this.listener.onServiceRemoved);e=b.getServiceReferences(d);for(a=0;a<e.length;a++){var h=e[a];k(h)&&this.addServiceListener(b.getService(h))}},
onDestroy:function(d){this.destroy()},destroy:function(){this.textView&&(this.textView.removeEventListener("ModelChanging",this.listener.onModelChanging),this.textView.removeEventListener("ModelChanged",this.listener.onModelChanged),this.textView.removeEventListener("Destroy",this.listener.onDestroy),this.textView.removeEventListener("LineStyle",this.listener.onLineStyle),this.textView=null);if(this.services){for(var d=0;d<this.services.length;d++)this.removeServiceListener(this.services[d]);this.services=
null}this.serviceRegistry&&(this.serviceRegistry.removeEventListener("registered",this.listener.onServiceAdded),this.serviceRegistry.removeEventListener("unregistering",this.listener.onServiceRemoved),this.serviceRegistry=null);this.lineStyles=this.listener=null},onModelChanging:function(d){this.startLine=this.textView.getModel().getLineAtOffset(d.start)},onModelChanged:function(d){var b=this.startLine;(d.addedLineCount||d.removedLineCount)&&Array.prototype.splice.apply(this.lineStyles,[b,d.removedLineCount].concat(this._getEmptyStyle(d.addedLineCount)))},
onStyleReady:function(d){var b=d.lineStyles||d.style;d=Number.MAX_VALUE;var a=-1,e=this.textView.getModel(),g;for(g in b)Object.prototype.hasOwnProperty.call(b,g)&&(this.lineStyles[g]=b[g],d=Math.min(d,g),a=Math.max(a,g));d=Math.max(d,0);a=Math.min(a,e.getLineCount());if(b=this.annotationModel){for(var k=b.getAnnotations(e.getLineStart(d),e.getLineEnd(a)),m=[];k.hasNext();){var r=k.next();"orion.annotation.highlightError"===r.type&&m.push(r)}k=[];for(r=d;r<=a;r++){g=r;var t=this.lineStyles[g],t=t&&
t.errors;g=e.getLineStart(g);if(t)for(var w=0;w<t.length;w++){var s=t[w];k.push(n.AnnotationType.createAnnotation("orion.annotation.highlightError",s.start+g,s.end+g))}}b.replaceAnnotations(m,k)}this.textView.redrawLines(d,a+1)},onLineStyle:function(d){var b=this.lineStyles[d.lineIndex];if(b)if(b.ranges){for(var b=b.ranges,a=d.lineStart,e=b.length,g=[],k=0;k<e;k++){var m=b[k];g.push({start:m.start+a,end:m.end+a,style:m.style})}d.ranges=g}else b.style&&(d.style=b.style)},_getEmptyStyle:function(d){for(var b=
[],a=0;a<d;a++)b.push(null);return b},setContentType:function(d){this.contentType=d;if(this.services)for(d=0;d<this.services.length;d++){var b=this.services[d];if(b.setContentType){var a=this.serviceRegistry.getService("orion.page.progress");a?a.progress(b.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):b.setContentType(this.contentType)}}},onServiceAdded:function(d,b){k(d)&&this.addServiceListener(b)},onServiceRemoved:function(d,
b){-1!==this.services.indexOf(b)&&this.removeServiceListener(b)},addServiceListener:function(d){if("function"===typeof d.addEventListener){if(d.addEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),this.services.push(d),d.setContentType&&this.contentType){var b=this.serviceRegistry.getService("orion.page.progress");b?b.progress(d.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):d.setContentType(this.contentType)}}else"undefined"!==
typeof console&&console.log(Error(g))},removeServiceListener:function(d){"function"===typeof d.removeEventListener?(d.removeEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),d=this.services.indexOf(d),-1!==d&&this.services.splice(d,1)):"undefined"!==typeof console&&console.log(Error(g))}};return e});
define("orion/highlight",["examples/editor/textStyler","orion/editor/textStyler","orion/editor/textMateStyler","orion/editor/AsyncStyler","orion/Deferred"],function(m,n,k,e,d){function g(a,f,g,p,q,r,t){function w(a,b){var e=a.getProperty("contentType")||a.getProperty("contentTypes"),k=a.getProperty("fileTypes");return e?d.when(f.isSomeExtensionOf(g,e)).then(function(b){return b?a:null}):b&&k&&-1!==k.indexOf(b)?(e=new d,e.resolve(a),e):null}function s(a){var b=null;switch(a&&a.id){case "application/javascript":case "application/json":b=
new m.TextStyler(p,"js",q);break;case "text/x-java-source":b=new m.TextStyler(p,"java",q);break;case "text/css":b=new m.TextStyler(p,"css",q)}return b}if(!b){var x=s(g);if(x)return r=new d,r.resolve(x),r}b&&!this.orionGrammars&&(this.orionGrammars={});x=r&&r.split(".").pop().toLowerCase();r=a.getServiceReferences("orion.edit.highlighter");for(var v=[],z=[],A=0;A<r.length;A++){var B=r[A],u=B.getProperty("type");"grammar"===u||!b&&"undefined"===typeof u?v.push(B.getProperty("grammar")):"highlighter"!==
u&&(u=B.getProperty("id"))&&!this.orionGrammars[u]&&(this.orionGrammars[u]={id:u,contentTypes:B.getProperty("contentTypes"),patterns:B.getProperty("patterns"),repository:B.getProperty("repository")});(B=w(B,x))&&z.push(B)}return d.all(z,function(a){return{_error:a}}).then(function(d){for(var f,l=d.length-1;0<=l;l--){var m=d[l];if(m&&!m._error&&(t||"highlighter"!==m.getProperty("type"))){f=m;break}}var r;if(f)if(d=f.getProperty("type"),"highlighter"===d)r=new e(p,a,q),r.setContentType(g);else if("grammar"===
d||!b&&"undefined"===typeof d)f=f.getProperty("grammar"),r=new k.TextMateStyler(p,f,v);else if(b){r=[];for(var s in this.orionGrammars)r.push(this.orionGrammars[s]);f=new n.createPatternBasedAdapter(r,f.getProperty("id"));r=new n.TextStyler(p,q,f)}return r})}function f(a,b){this.serviceRegistry=a;this.contentTypeService=b;this.styler=null}var b=1;f.prototype={setup:function(a,b,d,e,f){f="undefined"===typeof f?!0:f;this.styler&&(this.styler.destroy&&this.styler.destroy(),this.styler=null);var k=this;
return g(this.serviceRegistry,this.contentTypeService?this.contentTypeService:this.serviceRegistry.getService("orion.core.contentTypeRegistry"),a,b,d,e,f).then(function(a){return k.styler=a})},getStyler:function(){return this.styler}};return{createStyler:g,SyntaxHighlighter:f}});
define("orion/searchModel","i18n!orion/search/nls/messages require orion/Deferred orion/i18nUtil orion/explorers/explorer orion/searchUtils".split(" "),function(m,n,k,e,d,g){function f(b,a,d,e,f,k){this.registry=b;this.fileClient=a;this._resultLocation=d;this._numberOnPage=d.length;this._totalNumber=e;this._listRoot={isRoot:!0,children:[]};this._filteredRoot={isRoot:!0,children:[]};this._filterText=null;this._indexedFileItems=[];this._location2ModelMap=[];this._lineDelimiter="\n";this.onMatchNumberChanged=
k.onMatchNumberChanged;this._searchHelper=g.generateSearchHelper(f)}f.prototype=new d.ExplorerModel;f.prototype.getRoot=function(b){b(this.getListRoot())};f.prototype.getChildren=function(b,a){b&&("file"===b.type&&this._filterText?b.filteredChildren?a(b.filteredChildren):a([]):b.children?a(b.children):"detail"===b.type?a([]):"file"===b.type&&b.location?""!==this._searchHelper.params.keyword&&this.registry.getService("orion.page.progress").progress(this.fileClient.read(b.location),"Getting file contents "+
b.name).then(function(d){g.searchWithinFile(this._searchHelper.inFileQuery,b,d,this._lineDelimiter,this.replaceMode(),this._searchHelper.params.caseSensitive);if(this.onMatchNumberChanged)this.onMatchNumberChanged(b);a(b.children)}.bind(this),function(b){console.error("Error loading file content: "+b.message);a([])}.bind(this)):a([]))};f.prototype.getId=function(b){b===this.getListRoot()?b=this.rootId:(b=b.location,b=b.replace(/[^\.\:\-\_0-9A-Za-z]/g,""));return b};f.prototype.getListRoot=function(){return this._filterText?
this._filteredRoot:this._listRoot};f.prototype.buildResultModel=function(){this._restoreGlobalStatus();this._indexedFileItems=[];this.getListRoot().children=[];for(var b=0;b<this._resultLocation.length;b++){var a={parent:this.getListRoot(),type:"file",name:this._resultLocation[b].name,lastModified:this._resultLocation[b].lastModified,linkLocation:this._resultLocation[b].linkLocation,location:this._resultLocation[b].location,parentLocation:g.path2FolderName(this._resultLocation[b].location,this._resultLocation[b].name,
!0),fullPathName:g.path2FolderName(this._resultLocation[b].path,this._resultLocation[b].name)};this._location2ModelMap[a.location]=a;this.getListRoot().children.push(a);this._indexedFileItems.push(a)}};f.prototype.replaceMode=function(){return"string"===typeof this._searchHelper.params.replace};f.prototype.getPagingParams=function(){return{totalNumber:this._totalNumber,start:this._searchHelper.params.start,rows:this._searchHelper.params.rows,numberOnPage:this._numberOnPage}};f.prototype.getScopingParams=
function(b){var a=g.copySearchParams(this._searchHelper.params,!0);a.resource=b.parentLocation;a.start=0;var a=g.generateSearchHref(a),d=e.formatMessage(m['Search again in this folder with "${0}"'],this._searchHelper.displayedSearchTerm);return{name:b.fullPathName,href:a,tooltip:d}};f.prototype.getDetailInfo=function(b){return{lineString:b.name,lineNumber:b.lineNumber-1,matches:b.matches,matchNumber:b.matchNumber?b.matchNumber-1:0}};f.prototype.getFileName=function(b){return b.name};f.prototype.provideFileContent=
function(b,a){this._provideFileContent(b).then(function(){a(b)})};f.prototype._provideFileContent=function(b){return b.contents?(new k).resolve(b):this.registry.getService("orion.page.progress").progress(this.fileClient.read(b.location),"Getting file contents "+b.Name).then(function(a){g.searchWithinFile(this._searchHelper.inFileQuery,b,a,this._lineDelimiter,this.replaceMode(),this._searchHelper.params.caseSensitive);return b}.bind(this),function(a){console.error("Error loading file content: "+a.message);
return b}.bind(this))};f.prototype.getFileContents=function(b){return b.contents.join(this._lineDelimiter)};f.prototype.getReplacedFileContent=function(b,a,d){g.generateNewContents(a,d.contents,b,d,this._searchHelper.params.replace,this._searchHelper.inFileQuery.searchStrLength);b.lineDelim=this._lineDelimiter};f.prototype.writeReplacedContents=function(b){var a=[];this.getValidFileList().forEach(function(d){a.push(this._writeOneFile(d,b))}.bind(this));return k.all(a,function(a){return{_error:a}})};
f.prototype.getHeaderString=function(){var b=m.Results;if(this._searchHelper.displayedSearchTerm){var a=this.getPagingParams();if(0<a.numberOnPage)var b=a.start+1,d=b+a.numberOnPage-1,b=this.replaceMode()?e.formatMessage(m["Replace ${0} with ${1} for files ${2} of ${3}"],this._searchHelper.displayedSearchTerm,this._searchHelper.params.replace,b+"-"+d,a.totalNumber):e.formatMessage(m["Files ${0} of ${1} matching ${2}"],b+"-"+d,a.totalNumber,this._searchHelper.displayedSearchTerm)}return b};f.prototype.getValidFileList=
function(){return this._indexedFileItems};f.prototype.setValidFileList=function(b){this._indexedFileItems=b};f.prototype.storeLocationStatus=function(b){if(b){var a;a=b?"file"===b.type?b:b.parent:null;a&&(window.sessionStorage[this._searchHelper.params.keyword+"_search_result_currentFileLocation"]=a.location,window.sessionStorage[this._searchHelper.params.keyword+"_search_result_currentDetailIndex"]="file"===b.type?"none":JSON.stringify(this._model2Index(b)))}};f.prototype.restoreLocationStatus=function(){var b=
this._location2Model(window.sessionStorage[this._searchHelper.params.keyword+"_search_result_currentFileLocation"]),a="none",d=window.sessionStorage[this._searchHelper.params.keyword+"_search_result_currentDetailIndex"];"string"===typeof d&&0<d.length&&(a=d);return{file:b,detail:a}};f.prototype.staleCheck=function(b){b=b.toLowerCase();return this._searchHelper.inFileQuery.wildCard?g.searchOnelineRegEx(this._searchHelper.inFileQuery,b,!0):g.searchOnelineLiteral(this._searchHelper.inFileQuery,b,!0)};
f.prototype.filterOn=function(b){if(this._filterText=b){var a=this._filterText.toLowerCase();this._filteredRoot.children=[];this._indexedFileItems.forEach(function(b){var d=!1;if(this._filterSingleString(b.name,a)||this._filterSingleString(b.fullPathName,a))d=!0;b.children&&(b.filteredChildren=[],b.children.forEach(function(e){this._filterSingleString(e.name,a)&&(b.filteredChildren.push(e),d=!0)}.bind(this)));d&&this._filteredRoot.children.push(b)}.bind(this))}};f.prototype.getFilteredChildren=function(b){return"file"===
b.type&&this._filterText&&b.filteredChildren?b.filteredChildren:b.isRoot&&this._filterText?this._filteredRoot.children:b.children};f.prototype._provideSearchHelper=function(){return this._searchHelper};f.prototype._filterSingleString=function(b,a){return 0<=b.toLowerCase().indexOf(a)};f.prototype._model2Index=function(b,a){var d=a;!d&&b.parent&&(d=b.parent.children);if(d)for(var e=0;e<d.length;e++)if(d[e]===b)return e;return-1};f.prototype._location2Model=function(b){return b&&this._location2ModelMap[b]?
this._location2ModelMap[b]:0<this._indexedFileItems.length?this._indexedFileItems[0]:null};f.prototype._restoreGlobalStatus=function(){this.defaultReplaceStr=this._searchHelper.displayedSearchTerm;var b=window.sessionStorage.global_search_default_replace_string;"string"===typeof b&&0<b.length&&(this.defaultReplaceStr=b);this.sortByName=-1<this._provideSearchHelper().params.sort.indexOf("Name")};f.prototype._storeGlobalStatus=function(b){window.sessionStorage.global_search_default_replace_string=b};
f.prototype._writeOneFile=function(b,a){var d=this._matchesReplaced(b);return 0<d?this._provideFileContent(b).then(function(){d=this._matchesReplaced(b);var e={};g.generateNewContents(!1,b.contents,e,b,this._searchHelper.params.replace,this._searchHelper.inFileQuery.searchStrLength);var e=e.contents.join(this._lineDelimiter),f=b.ETag,f=f?{ETag:f}:null;return this.registry.getService("orion.page.progress").progress(this.fileClient.write(b.location,e,f),"Saving changes to "+b.location).then(function(e){a.push({model:b,
matchesReplaced:d,status:"pass"})}.bind(this),function(e){412===e.status?a.push({model:b,message:m["Resource has been changed by others."],matchesReplaced:d,status:"failed"}):(e.log=!0,a.push({model:b,message:m["Failed to write file."],matchesReplaced:d,status:"failed"}))}.bind(this))}.bind(this)):(new k).resolve(b)};f.prototype._matchesReplaced=function(b){var a=0;if(!b.children)return!1===b.checked?0:1;if(b.children)for(var d=0;d<b.children.length;d++)!1!==b.children[d].checked&&(a+=1);return a};
f.prototype.constructor=f;return{SearchResultModel:f}});
define("orion/searchExplorer","i18n!orion/search/nls/messages require orion/Deferred orion/webui/littlelib orion/contentTypes orion/i18nUtil orion/explorers/explorer orion/fileClient orion/commands orion/searchUtils orion/globalSearch/search-features orion/compare/compareUIFactory orion/compare/compareView orion/highlight orion/explorers/navigationUtils orion/webui/tooltip orion/explorers/navigatorRenderer orion/extensionCommands orion/searchModel orion/crawler/searchCrawler".split(" "),function(m,
n,k,e,d,g,f,b,a,l,h,p,q,r,t,w,s,x,v,z){function A(a){(a=e.node(a))&&e.empty(a);return a}function B(a,b,d){(a=e.node(a))&&a.addEventListener(b,d,!1)}function u(a,b,d){if(b=e.node(b))"only"===d&&e.empty(b),b.appendChild(a)}function y(a,b,d,f){a=document.createElement(a);if(b)if(Array.isArray(b))for(var g=0;g<b.length;g++)a.classList.add(b[g]);else"string"===typeof b&&(a.className=b);d&&(a.id=d);(b=e.node(f))&&b.appendChild(a);return a}function C(a,b,d,e,f){a=y("a",a,b,e);a.href=d;f&&a.appendChild(document.createTextNode(f));
return a}function E(a,b,d,e){a=y("span",a,b,d);e&&a.appendChild(document.createTextNode(e));return a}function D(a){return!a?null:"file"===a.type?a:a.parent}function H(a){return"function"===typeof a.getValidFileList?a.getValidFileList():a.getListRoot().children}function I(a,b){this._init(a);this.explorer=b}function G(a,b){this._init(a);this.options=a;this.explorer=b}function J(a,b,d){this.parentId=a;this.reportList=b;this.resultModel=d;this.renderer=new G({checkbox:!1},this)}function K(a){this._syntaxHighlither=
new r.SyntaxHighlighter(a)}function F(a,e){this.registry=a;this._commandService=e;this.fileClient=new b.FileClient(this.registry);this.defaulRows=40;this._contentTypeService=new d.ContentTypeRegistry(this.registry);this.declareCommands()}I.prototype=new f.SelectionRenderer;I.prototype.initCheckboxColumn=function(a){if(this._useCheckboxSelection){a=y("th");var b=y("span",null,null,a);b.classList.add("selectionCheckmarkSprite");b.classList.add("core-sprite-check");this.getCheckedFunc&&(b.checked=this.getCheckedFunc(this.explorer.model.getListRoot()),
b.classList.toggle("core-sprite-check_on"));B(b,"click",function(a){this.onCheck(null,a.target,a.target.checked?!1:!0)}.bind(this));return a}};I.prototype.getCellHeaderElement=function(a){if(2<a)return null;var b,d;return 0!==a?(b=y("th"),d=y("h2","search_header",null,b),1===a?(a=this.explorer.model,a="function"===typeof a.getHeaderString?a.getHeaderString():m.Results,d.textContent=a):2===a&&(d.textContent=m.Location),b):y("th")};I.prototype.focus=function(){var a=e.node(this.explorer.getParentDivId());
window.setTimeout(function(){a.focus()},10)};I.prototype.staleFileElement=function(a,b){if(a.stale){var d=this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(a,!0):null;t.removeNavGrid(d,e.node(this.getItemLinkId(a)));d=e.node(this.getFileSpanId(a));A(d);u(document.createTextNode(b?b:this.explorer.model.getFileName(a)),d,"last");d=e.node(this.getFileIconId(a));A(d)}else this.explorer._prepareFilter(a)};I.prototype.replaceFileElement=function(a){var b=a.totalMatches?this.explorer.model.getFileName(a)+
" ("+g.formatMessage(m["${0} matches"],a.totalMatches)+")":this.explorer.model.getFileName(a)+" ("+m["No matches"]+")";a.totalMatches?(a=e.node(this.getItemLinkId(a)),u(document.createTextNode(b),a,"only")):(a.stale=!0,this.staleFileElement(a,b))};I.prototype.replaceDetailIcon=function(a,b){if(!this.explorer.model.replaceMode()&&a&&"detail"===a.type){var d=e.node(this.getDetailIconId(a));d&&(A(d),d=E(null,null,d),d.classList.add("imageSprite"),"right"===b?d.classList.add("core-sprite-rightarrow"):
"left"===b?d.classList.add("core-sprite-leftarrow"):d.classList.add("core-sprite-none"))}};I.prototype.renderFileElement=function(a,b,d){var e=null;this.explorer.model._provideSearchHelper&&(e=this.explorer.model._provideSearchHelper());e=e?l.generateFindURLBinding(e.params,e.inFileQuery,null,e.params.replace,!0):null;e=s.createLink(null,{Location:a.location,Name:this.explorer.model._filterText?null:d},this.explorer._commandService,this.explorer._contentTypeService,this.explorer._openWithCommands,
{id:this.getItemLinkId(a)},e,{holderDom:this._lastFileIconDom});b.appendChild(e);t.addNavGrid(this.explorer.getNavDict(),a,e);if(this.explorer.model._filterText){a=y("span",null,null,e);b=l.searchOnelineLiteral({searchStr:this.explorer.model._filterText.toLowerCase(),searchStrLength:this.explorer.model._filterText.length},d.toLowerCase(),!1);var f=[];f.push({name:d,startIndex:0,bold:!1,highlight:!1});b&&b.forEach(function(a){f=this._mergesingleSegment(f,{start:a.startIndex,end:a.startIndex+a.length})}.bind(this));
this._renderSegments(f,a)}};I.prototype.generateContextTip=function(a){for(var b=y("table"),d=0;d<a.context.length;d++){var e=y("tr",null,null,b);a.context[d].current?(e=y("td",null,null,e),e.noWrap=!0,e=y("span",null,null,e),this.generateDetailHighlight(a,e)):(e=y("td",null,null,e),e.noWrap=!0,e.textContent=a.context[d].context+"\u00a0")}return b};I.prototype._generateDetailSegments=function(a){for(var b=0,d=[],e=0;e<a.matches.length&&!(b>=a.lineString.length)&&(this.explorer.model.replaceMode()&&
e!==a.matchNumber||!(b!==a.matches[e].startIndex&&d.push({name:a.lineString.substring(b,a.matches[e].startIndex),startIndex:b,bold:!1,highlight:!1}),b=a.matches[e].length,d.push({name:a.lineString.substring(a.matches[e].startIndex,a.matches[e].startIndex+b),startIndex:a.matches[e].startIndex,bold:!0,highlight:!1}),b=a.matches[e].startIndex+b,this.explorer.model.replaceMode()));e++);b<a.lineString.length-1&&d.push({name:a.lineString.substring(b),startIndex:b,bold:!1,highlight:!1});return d};I.prototype._mergesingleSegment=
function(a,b){var d=[];a.forEach(function(a){var e=a.startIndex,f=a.startIndex+a.name.length;b.start>e&&b.end<f?(d.push({name:a.name.substring(0,b.start-e),startIndex:a.startIndex,bold:a.bold,highlight:!1}),d.push({name:a.name.substring(b.start-e,b.end-e),startIndex:b.start,bold:a.bold,highlight:!0}),d.push({name:a.name.substring(b.end-e),startIndex:b.end,bold:a.bold,highlight:!1})):b.start>e&&b.start<f?(d.push({name:a.name.substring(0,b.start-e),startIndex:a.startIndex,bold:a.bold,highlight:!1}),
d.push({name:a.name.substring(b.start-e),startIndex:b.start,bold:a.bold,highlight:!0})):e>=b.start&&f<=b.end?(a.highlight=!0,d.push(a)):b.end>e&&b.end<f?(d.push({name:a.name.substring(0,b.end-e),startIndex:a.startIndex,bold:a.bold,highlight:!0}),d.push({name:a.name.substring(b.end-e),startIndex:b.end,bold:a.bold,highlight:!1})):d.push(a)}.bind(this));return d};I.prototype._mergeFilteredSegments=function(a,b){if(!this.explorer.model._filterText)return a;var d=l.searchOnelineLiteral({searchStr:this.explorer.model._filterText.toLowerCase(),
searchStrLength:this.explorer.model._filterText.length},b.toLowerCase(),!1),e=a;d&&d.forEach(function(a){e=this._mergesingleSegment(e,{start:a.startIndex,end:a.startIndex+a.length})}.bind(this));return e};I.prototype._renderSegments=function(a,b){a.forEach(function(a){var d=a.bold?y("b",null,null,b):y("span",null,null,b);a.highlight&&d.classList.add("search-filter-text");u(document.createTextNode(a.name),d,"only")}.bind(this))};I.prototype.generateDetailHighlight=function(a,b,d){a=this.explorer.model.getDetailInfo(a);
var e=this._generateDetailSegments(a);d&&(e=this._mergeFilteredSegments(e,a.lineString));this._renderSegments(e,b)};I.prototype.renderDetailElement=function(a,b,d,e){b=this.getDetailElement(a,b,d);e&&this.renderDetailLineNumber(a,b);this.generateDetailHighlight(a,b,!0)};I.prototype.renderDetailLineNumber=function(a,b){var d=this.explorer.model.getDetailInfo(a),e=d.lineNumber+1;!this.explorer.model.replaceMode()||1>=d.matches.length?u(document.createTextNode(e+":"),b,"last"):u(document.createTextNode(e+
"("+(d.matchNumber+1)+"):"),b,"last")};I.prototype.getDetailElement=function(a,b,d){var e=this;b=null;this.explorer.model._provideSearchHelper&&(b=this.explorer.model._provideSearchHelper());b=b?l.generateFindURLBinding(b.params,b.inFileQuery,a.lineNumber,b.params.replace,!0):null;b=s.createLink(null,{Location:a.parent.location,Name:null},this.explorer._commandService,this.explorer._contentTypeService,this.explorer._openWithCommands,{id:this.getItemLinkId(a)},b,{});d.appendChild(b);t.addNavGrid(this.explorer.getNavDict(),
a,b);B(b,"click",function(){e.explorer.getNavHandler().cursorOn(a)});return y("span",null,null,b)};I.prototype.getRowActionElement=function(a){return e.node(this.getItemLinkId(a))};I.prototype.getLocationSpanId=function(a){return this.explorer.model.getId(a)+"_locationSpan"};I.prototype.getFileSpanId=function(a){return this.explorer.model.getId(a)+"_fileSpan"};I.prototype.getFileIconId=function(a){return this.explorer.model.getId(a)+"_fileIcon"};I.prototype.getItemLinkId=function(a){return"string"===
typeof a?a+"_itemLink":this.explorer.model.getId(a)+"_itemLink"};I.prototype.getDetailIconId=function(a){return this.explorer.model.getId(a)+"_detailIcon"};I.prototype.renderLocationElement=function(a,b){var d=b?b:e.node(this.getLocationSpanId(a));A(d);var f=this.explorer.model.getScopingParams(a),d=C("navlink",null,f.href,d,this.explorer.model._filterText?null:f.name);d.title=f.tooltip;t.addNavGrid(this.explorer.getNavDict(),a,d);var g=this;B(d,"click",function(){g.explorer.closeContextTip()});if(this.explorer.model._filterText){var d=
y("span",null,null,d),h=l.searchOnelineLiteral({searchStr:this.explorer.model._filterText.toLowerCase(),searchStrLength:this.explorer.model._filterText.length},f.name.toLowerCase(),!1),k=[];k.push({name:f.name,startIndex:0,bold:!1,highlight:!1});h&&h.forEach(function(a){k=this._mergesingleSegment(k,{start:a.startIndex,end:a.startIndex+a.length})}.bind(this));this._renderSegments(k,d)}};I.prototype.getPrimColumnStyle=function(a){return a&&"file"===a.type?"search_primaryColumn":"search_primaryColumn_Details"};
I.prototype.getSecondaryColumnStyle=function(){return"search_secondaryColumn"};I.prototype.getCellElement=function(a,b,d){var e;switch(a){case 0:return a=y("td"),"file"===b.type?(a.noWrap=!0,this._lastFileIconDom=e=E(null,this.getFileIconId(b),a,null),this.explorer.model._provideSearchHelper&&""===this.explorer.model._provideSearchHelper().params.keyword||this.getExpandImage(d,e)):(e=E(null,null,a,null),a.noWrap=!0,a.align="right",this.renderDetailLineNumber(b,e)),a;case 1:return a=y("td"),e=E(null,
this.getFileSpanId(b),a,null),"file"===b.type?(d=b.totalMatches?this.explorer.model.getFileName(b)+" ("+b.totalMatches+" matches)":this.explorer.model.getFileName(b),this.renderFileElement(b,e,d)):(this.renderDetailElement(b,d,e),b=E(null,this.getDetailIconId(b),e,null),b=E(null,null,b,null),b.classList.add("imageSprite"),b.classList.add("core-sprite-none")),a;case 2:return a=y("td"),"file"===b.type&&(e=E(null,this.getLocationSpanId(b),a,null),b.parentLocation&&this.renderLocationElement(b,e)),a}};
I.prototype.constructor=I;G.prototype=new f.SelectionRenderer;G.prototype.getCellHeaderElement=function(a){switch(a){case 0:a=y("th","search_report",null,null);a=y("h2",null,null,a);a.textContent=m["Files replaced"];break;case 1:a=y("th","search_report",null,null),a=y("h2",null,null,a),a.textContent=m.Status}};G.prototype.getCellElement=function(a,b,d){switch(a){case 0:var e=y("td","search_report",null,null);a=y("div",null,null,e);var f=y("span","primaryColumn",null,a);u(document.createTextNode(b.model.fullPathName+
"/"+this.explorer.resultModel.getFileName(b.model)),f,"only");B(f,"click",function(){window.open(b.model.linkLocation)});B(f,"mouseover",function(){f.style.cursor="pointer"});B(f,"mouseout",function(){f.style.cursor="default"});a=y("span",null,null,a);a.classList.add("imageSprite");if(b.status)switch(b.status){case "warning":a.classList.add("core-sprite-warning");break;case "failed":a.classList.add("core-sprite-error");break;case "pass":a.classList.add("core-sprite-ok")}return e;case 1:if(b.status){switch(b.status){case "warning":e=
b.message;break;case "failed":e=b.message;break;case "pass":e=b.model.totalMatches?g.formatMessage(m["${0} out of ${1}  matches replaced."],b.matchesReplaced,b.model.totalMatches):b.message}a=y("td","search_report",null,null);a.textContent=e;return a}}};G.prototype.constructor=G;J.prototype=new f.Explorer;J.prototype.report=function(){this.createTree(this.parentId,new f.ExplorerFlatModel(null,null,this.reportList))};J.prototype.constructor=J;K.prototype={highlight:function(a,b,d){return this._syntaxHighlither.setup(b,
d.getTextView(),null,a,!1)}};F.prototype=new f.Explorer;F.prototype.onchange=function(a){};F.prototype.setResult=function(a,b){var d=this;this.parentNode=a;this.model=b;this.model.replaceMode()?(this.checkbox=this._hasCheckedItems=!0,this.renderer=new I({checkbox:!0,highlightSelection:!1,getCheckedFunc:function(a){return d.getItemChecked(a)},onCheckedFunc:function(a,b,e){d.onRowChecked(a,b,e)}},d)):(this.checkbox=!1,this.renderer=new I({checkbox:!1,highlightSelection:!1},this));this._reporting=!1;
this._currentPreviewModel=this._uiFactory=null;this._currentReplacedContents={contents:null};this._popUpContext=!1;this.timerRunning-=0;this.twoWayCompareView=this._filterTimer=this._timer=null};F.prototype.declareCommands=function(){var b=this,d=new a.Command({name:m["Apply Changes"],tooltip:m["Replace all selected matches"],id:"orion.globalSearch.replaceAll",callback:function(a){b.replaceAll()},visibleWhen:function(a){return b.model&&b.model.replaceMode()&&!b._reporting&&b._hasCheckedItems}}),e=
new a.Command({name:m["Hide Compare"],tooltip:m["Hide compare view of changes"],id:"orion.globalSearch.hideCompare",callback:function(a){b.toggleCompare(!1)},visibleWhen:function(a){return b.model&&b.model.replaceMode()&&!b._reporting&&b._uiFactory}}),g=new a.Command({name:m["Show Compare"],tooltip:m["Show compare view of changes"],id:"orion.globalSearch.showCompare",callback:function(a){b.toggleCompare(!0)},visibleWhen:function(a){return b.model&&b.model.replaceMode()&&!b._reporting&&!b._uiFactory}});
this._commandService.addCommand(e);this._commandService.addCommand(g);this._commandService.addCommand(d);this._commandService.addCommandGroup("pageActions","orion.searchActions.unlabeled",200);this._commandService.registerCommandContribution("pageActions","orion.globalSearch.hideCompare",1,"orion.searchActions.unlabeled");this._commandService.registerCommandContribution("pageActions","orion.globalSearch.showCompare",2,"orion.searchActions.unlabeled");this._commandService.registerCommandContribution("pageActions",
"orion.globalSearch.replaceAll",3,"orion.searchActions.unlabeled");var d=new a.Command({name:m["Show All"],tooltip:m["Show all the results in one page"],id:"orion.search.showAll",hrefCallback:function(){if(!this.model._provideSearchHelper)return null;var a=l.copySearchParams(this.model._provideSearchHelper().params,!0);a.start=0;a.rows=this.model.getPagingParams().totalNumber;return l.generateSearchHref(a)}.bind(this),visibleWhen:function(a){a=this.model.getPagingParams();return!this._crawling&&a.totalNumber>
a.rows}.bind(this)}),e=new a.Command({name:m["\x3c Previous Page"],tooltip:m["Show previous page of search result"],id:"orion.search.prevPage",hrefCallback:function(){if(!b.model._provideSearchHelper)return null;var a=b.caculatePrevPage(),d=l.copySearchParams(b.model._provideSearchHelper().params,!0);d.start=a.start;return l.generateSearchHref(d)},visibleWhen:function(a){a=b.caculatePrevPage();return!this._crawling&&a.start!==b.model.getPagingParams().start}.bind(this)}),g=new a.Command({name:m["Next Page \x3e"],
tooltip:m["Show next page of search result"],id:"orion.search.nextPage",hrefCallback:function(){if(!b.model._provideSearchHelper)return null;var a=b.caculateNextPage(),d=l.copySearchParams(b.model._provideSearchHelper().params,!0);d.start=a.start;return l.generateSearchHref(d)},visibleWhen:function(a){a=b.caculateNextPage();return!this._crawling&&a.start!==b.model.getPagingParams().start}.bind(this)}),h=new a.Command({tooltip:m["Next result"],imageClass:"core-sprite-move-down",id:"orion.search.nextResult",
groupId:"orion.searchGroup",visibleWhen:function(a){return!b._reporting},callback:function(){b.gotoNext(!0,!0)}}),k=new a.Command({tooltip:m["Previous result"],imageClass:"core-sprite-move-up",id:"orion.search.prevResult",groupId:"orion.searchGroup",visibleWhen:function(a){return!b._reporting},callback:function(){b.gotoNext(!1,!0)}});this._commandService.addCommand(d);this._commandService.addCommand(e);this._commandService.addCommand(g);this._commandService.addCommand(h);this._commandService.addCommand(k);
f.createExplorerCommands(this._commandService,function(a){var d=!1;b.model._provideSearchHelper&&""===b.model._provideSearchHelper().params.keyword&&(d=!0);return!a._reporting&&!d});this._commandService.registerCommandContribution("pageNavigationActions","orion.explorer.expandAll",1);this._commandService.registerCommandContribution("pageNavigationActions","orion.explorer.collapseAll",2);this._commandService.registerCommandContribution("pageNavigationActions","orion.search.nextResult",3);this._commandService.registerCommandContribution("pageNavigationActions",
"orion.search.prevResult",4);this._commandService.registerCommandContribution("pageNavigationActions","orion.search.showAll",5);this._commandService.registerCommandContribution("pageNavigationActions","orion.search.prevPage",6);this._commandService.registerCommandContribution("pageNavigationActions","orion.search.nextPage",7)};F.prototype._checkStale=function(a){return this.registry.getService("orion.page.progress").progress(this.fileClient.read(a.location),"Checing file "+a.location+" for stale").then(function(b){this.model.staleCheck(b)&&
(a.stale=!1)}.bind(this),function(a){console.error("Error loading file contents: "+a.message);throw a;}.bind(this))};F.prototype.staleCheck=function(){var a=[];H(this.model).forEach(function(b){a.push(this._loadFileMetaData(b))}.bind(this));return k.all(a,function(a){return{_error:a}})};F.prototype._loadFileMetaData=function(a){return this.registry.getService("orion.page.progress").progress(this.fileClient.read(a.location,!0),"Getting file metadata "+a.location).then(function(b){a.fullPathName=l.fullPathNameByMeta(b.Parents);
a.parentLocation=b.Parents[0].Location;a.stale=a.lastModified!==b.LocalTimeStamp;a.ETag=b.ETag;if(a.stale)return this._checkStale(a).then(function(){this.renderer.staleFileElement(a)}.bind(this));this._prepareFilter(a);return a}.bind(this),function(b){console.error("Error loading file metadata: status "+b.status);a.stale=!0;this.renderer.staleFileElement(a);throw b;}.bind(this))};F.prototype.setCrawling=function(a){this._crawling=a};F.prototype.preview=function(){var b=this;this._commandService.openParameterCollector("pageActions",
function(a){var d=y("input",null,"globalSearchReplaceWith",a);d.type="text";d.name="ReplaceWith:";d.placeholder="Replace With";d.onkeydown=function(a){if(13===a.keyCode)return a=e.node("globalSearchReplaceWith"),b._commandService.closeParameterCollector(),b._doPreview(a.value);if(27===a.keyCode)return b._commandService.closeParameterCollector(),!1};y("span","parameters","globalSearchReplaceCommands",a);return d});var d=document.getElementById("globalSearchReplaceWith");d.value=this.model.defaultReplaceStr;
window.setTimeout(function(){d.select();d.focus()},10);var f=new a.Command({name:"Preview Changes",image:n.toUrl("images/replaceAll.gif"),id:"orion.globalSearch.innerReplaceAll",groupId:"orion.searchGroup",callback:function(){var a=e.node("globalSearchReplaceWith");b._commandService.closeParameterCollector();return b._doPreview(a.value)}});this._commandService.addCommand(f);this._commandService.registerCommandContribution("globalSearchReplaceCommands","orion.globalSearch.innerReplaceAll",1);this._commandService.renderCommands("globalSearchReplaceCommands",
"globalSearchReplaceCommands",this,this,"button")};F.prototype._fileExpanded=function(a,b){var d=H(this.model)[a];return null===b||void 0===b?{childrenNumber:0,childDiv:e.node(this.model.getId(d))}:d.children&&0<d.children.length?(0>b?b=d.children.length-1:b>=d.children.length&&(b=0),{childrenNumber:d.children.length,childDiv:e.node(this.model.getId(d.children[b]))}):{childrenNumber:0,childDiv:null}};F.prototype._doPreview=function(a,b){if(this.model._provideSearchHelper){this.model._storeGlobalStatus&&
this.model._storeGlobalStatus(a);var d=l.copySearchParams(this.model._provideSearchHelper().params,!0);d.replace=a;b&&(d.start=0,d.rows=this.model.getPagingParams().totalNumber);d=l.generateSearchHref(d);window.location.href=d}};F.prototype.searchAgain=function(){if(this.model._provideSearchHelper){var a=l.copySearchParams(this.model._provideSearchHelper().params,!0);a.replace=null;a.rows>this.defaulRows&&(a.rows=this.defaulRows);a=l.generateSearchHref(a);a===window.location.href?window.location.reload():
window.location.href=a}};F.prototype.replaceAll=function(){var a=[],b=this;this._reporting=!0;this.initCommands();this.reportStatus(m["Writing files..."]);this.model.writeReplacedContents(a).then(function(d){A(b.getParentDivId());(new J(b.getParentDivId(),a,b.model)).report();b.reportStatus("")})};F.prototype.toggleCompare=function(a){this.replacePreview(!1,a)};F.prototype.replacePreview=function(a,b){A(this.getParentDivId());b?(this._uiFactory=new h.SearchUIFactory({parentDivID:this.getParentDivId()}),
this._uiFactory.buildUI()):(this._uiFactory&&this._uiFactory.destroy(),this._uiFactory=null);this._currentPreviewModel=this.twoWayCompareView=null;this.initCommands();a&&this.reportStatus(m["Preparing preview..."]);var d=this;this.createTree(this._uiFactory?this._uiFactory.getMatchDivID():this.getParentDivId(),this.model,{selectionPolicy:"singleSelection",indent:0,onCollapse:function(a){d.onCollapse(a)}});a?(this.gotoCurrent(this.model.restoreLocationStatus?this.model.restoreLocationStatus():null),
this.reportStatus(""),!this._crawling&&this.model.staleCheck&&this.staleCheck().then(function(){d.refreshValidFiles()})):this.gotoCurrent(this.model.restoreLocationStatus?this.model.restoreLocationStatus():null)};F.prototype.getItemChecked=function(a){void 0===a.checked&&(a.checked=!0);return a.checked};F.prototype._checkedItem=function(){for(var a=H(this.model),b=0;b<a.length;b++){if(a[b].checked)return!0;if(a[b].children)for(var d=0;d<a[b].children.length;d++)if(a[b].children[d].checked)return!0}return!1};
F.prototype.onRowChecked=function(a,b,d){if(a){if((a=e.node(a))&&a._item)this.onItemChecked(a._item,b,d);a=this._checkedItem()}else a=b,this.onItemChecked(this.model.getListRoot(),b,d);a!==this._hasCheckedItems&&(this._hasCheckedItems=a,this.initCommands())};F.prototype.onNewContentChanged=function(a){a===D(this.getNavHandler().currentModel())&&this.buildPreview(!0)};F.prototype.onItemChecked=function(a,b,d){a.checked=b;if("file"===a.type||a===this.model.getListRoot()){if(a.children)for(d=0;d<a.children.length;d++){var f=
e.node(this.renderer.getCheckBoxId(this.model.getId(a.children[d])));if(f)this.renderer.onCheck(null,f,b,!1);else a.children[d].checked=b}if("file"===a.type)this.onNewContentChanged(a)}else if(d)this.onNewContentChanged(a.parent)};F.prototype.buildPreview=function(a){if(this._uiFactory&&0!==H(this.model).length){var b=this._uiFactory,d=D(this.getNavHandler().currentModel());this._currentPreviewModel=d;var e=this;this.model.provideFileContent(d,function(d){if(e.model.onMatchNumberChanged)e.model.onMatchNumberChanged(d);
e.model.getReplacedFileContent(e._currentReplacedContents,a,d);var f=e._currentReplacedContents.contents;Array.isArray(f)&&(f=e._currentReplacedContents.contents.join(e._currentReplacedContents.lineDelim));var h=e.model.getFileName(d),k=e._contentTypeService.getFilenameContentType(h);d={readonly:!0,hasConflicts:!1,newFileOnRight:!0,oldFile:{Name:d.location,Type:k,Content:e.model.getFileContents(d)},newFile:{Name:d.location,Type:k,Content:f}};e.twoWayCompareView?(e.twoWayCompareView.setOptions(d),
e.twoWayCompareView.refresh(!0)):(e.uiFactoryCompare=new p.TwoWayCompareUIFactory({parentDivID:b.getCompareDivID(),showTitle:!0,rightTitle:g.formatMessage(m["Replaced File (${0})"],h),leftTitle:g.formatMessage(m["Original File (${0})"],h),showLineStatus:!1}),e.uiFactoryCompare.buildUI(),d.uiFactory=e.uiFactoryCompare,d.parentDivID=b.getCompareDivID(),e.twoWayCompareView=new q.TwoWayCompareView(d),e.twoWayCompareView.setOptions({highlighters:[new K(e.registry),new K(e.registry)]}),e.twoWayCompareView.startup(),
e._uiFactory.setCompareWidget(e.twoWayCompareView));A(e.uiFactoryCompare.getTitleDiv());u(document.createTextNode(g.formatMessage(m["Replaced File (${0})"],h)),e.uiFactoryCompare.getTitleDiv(),"only");A(e.uiFactoryCompare.getTitleDiv(!0));u(document.createTextNode(g.formatMessage(m["Original File (${0})"],h)),e.uiFactoryCompare.getTitleDiv(!0),"only");window.setTimeout(function(){e.renderer.focus()},100)})}};F.prototype.caculateNextPage=function(){var a=this.model.getPagingParams();return a.start+
a.rows>=a.totalNumber?{start:a.start}:{start:a.start+a.rows}};F.prototype.caculatePrevPage=function(){var a=this.model.getPagingParams(),a=a.start-a.rows;0>a&&(a=0);return{start:a}};F.prototype.initCommands=function(){this._commandService.destroy("pageActions");this._commandService.renderCommands("pageActions","pageActions",this,this,"button");this._commandService.destroy("pageNavigationActions");this._commandService.renderCommands("pageNavigationActions","pageNavigationActions",this,this,"button")};
F.prototype.reportStatus=function(a){this.registry.getService("orion.page.message").setProgressMessage(a)};F.prototype.isExpanded=function(a){return this.myTree.isExpanded(this.model.getId(a))};F.prototype.popupContext=function(a){this.contextTip&&(this.contextTip.destroy(),this.contextTip=null);var b=this.renderer.getDetailIconId(a);a=this.renderer.generateContextTip(a);var b=e.node(b),d=["below","right"];if(b)for(var f=this.myTree._parent.getClientRects()[0],g=b.getClientRects(),h=0,k=g.length;h<
k;h++)if(g[h].bottom+100>f.bottom){d=["above","right"];break}this.contextTip=new w.Tooltip({node:b,showDelay:0,trigger:"none",position:d});this.contextTip.contentContainer().appendChild(a);this.contextTip.show()};F.prototype.closeContextTip=function(a){this.model.replaceMode()||(this.contextTip&&(this.contextTip.destroy(),this.contextTip=null),a||(this._popUpContext=!1),this.renderer.replaceDetailIcon(this.getNavHandler().currentModel(),"right"))};F.prototype.onCollapse=function(a){var b=this.getNavHandler().currentModel();
b&&"detail"===b.type&&D(a)===a&&this.getNavHandler().cursorOn(a)};F.prototype.onExpand=function(a,b,d){if(a&&a.children&&0<a.children.length&&"string"===typeof b){d=0;d="first"===b?0:"last"===b?a.children.length-1:JSON.parse(b);if("string"===typeof d||0>d||d>=a.children.length)d=0;this.getNavHandler().cursorOn(a.children[d])}};F.prototype.forceExpandFunc=function(a,b,d){this.myTree.expand(a,function(){this.onExpand(a,b,d)}.bind(this));return null};F.prototype.keyEventListeningDiv=function(a){return e.node(this.getParentDivId(a))};
F.prototype.onFocus=function(a){a||this.closeContextTip()};F.prototype.preventDefaultFunc=function(a,b){if(!b)return!0;if(!this.model.replaceMode()&&!a.ctrlKey&&"detail"===b.type){if(37===a.keyCode&&this._popUpContext)return this.closeContextTip(),a.preventDefault(),!0;if(39===a.keyCode&&!this._popUpContext)return this._popUpContext=!0,this.renderer.replaceDetailIcon(b,"left"),this.popupContext(b),a.preventDefault(),!0}return!1};F.prototype.onReplaceCursorChanged=function(a,b){D(this._currentPreviewModel)!==
D(b)&&this.buildPreview();if("detail"===b.type){var d=this.model.getDetailInfo(b);this.twoWayCompareView.gotoDiff(d.lineNumber,d.matches[d.matchNumber].startIndex,!1)}};F.prototype.onCursorChanged=function(a,b){this.renderer.replaceDetailIcon(a,"none");this.model.storeLocationStatus&&this.model.storeLocationStatus(b);var d=this;this.model.replaceMode()?this._uiFactory&&(this._timer?this.timerRunning&&(window.clearTimeOut(this._timer),this._timer=window.setTimeout(function(){d.onReplaceCursorChanged(a,
b);d.timerRunning=!1;d._timer=null},500)):this._timer=window.setTimeout(function(){d.onReplaceCursorChanged(a,b);d.timerRunning=!1;d._timer=null},500)):"detail"===b.type?this._popUpContext?(this.popupContext(b),this.renderer.replaceDetailIcon(b,"left")):this.renderer.replaceDetailIcon(b,"right"):this._popUpContext&&this.closeContextTip(!0)};F.prototype._prepareFilter=function(a){this._validateFilter()&&(a?this.model.getChildren(a,function(a){}):H(this.model).forEach(function(a){this.model.getChildren(a,
function(a){})}.bind(this)))};F.prototype._validateFilter=function(){return!this.model.replaceMode()&&"function"===typeof this.model.filterOn};F.prototype._startUp=function(){var a=A("filterBox"),b=this.model.getPagingParams();this.model._provideSearchHelper&&(window.document.title=this.model._provideSearchHelper().displayedSearchTerm+" - "+g.formatMessage(m["${0} matches"],b.totalNumber));if(0===b.numberOnPage)a&&(a.style.visibility="hidden"),a=m["No matches"],this.model._provideSearchHelper&&(a=
g.formatMessage(m["No matches found for ${0}"],this.model._provideSearchHelper().displayedSearchTerm)),this.parentNode.textContent="",b=y("b",null,null,this.parentNode),u(document.createTextNode(a),b,"only"),this.reportStatus("");else{var d=this;if(a&&this._validateFilter()){a.style.visibility="visible";var e=y("input",["search-control","search-filter-input"],null,a);e.type="text";e.placeholder=m["Type filter text"];e.addEventListener("input",function(a){this._filterTimer&&window.clearTimeout(this._filterTimer);
this._filterTimer=window.setTimeout(function(){this._filterTimer=null;this._renderFiltered(e.value)}.bind(this),1E3)}.bind(this))}this.model.buildResultModel();this.model.replaceMode()?d.replacePreview(!0,!0):(this.initCommands(),A(this.getParentDivId()),this.createTree(this.getParentDivId(),this.model,{selectionPolicy:"singleSelection",indent:0,getChildrenFunc:function(a){return this.model.getFilteredChildren(a)}.bind(this),onCollapse:function(a){d.onCollapse(a)}}),this.gotoCurrent(this.model.restoreLocationStatus?
this.model.restoreLocationStatus():null),this.reportStatus(""),!this._crawling&&this.model.staleCheck?this.staleCheck().then(function(){d.refreshValidFiles()}):d._prepareFilter())}};F.prototype.startUp=function(){if(this._openWithCommands)this._startUp();else{var a=x.createOpenWithCommands(this.registry,this._contentTypeService,this._commandService);k.when(a,function(a){this._openWithCommands=a;this._startUp()}.bind(this))}};F.prototype._incrementalRender=function(){var a=this;this.model.buildResultModel();
this.createTree(this.getParentDivId(),this.model,{selectionPolicy:"singleSelection",getChildrenFunc:function(a){return this.model.getFilteredChildren(a)}.bind(this),indent:0,onCollapse:function(b){a.onCollapse(b)}})};F.prototype.incrementalRender=function(){if(this._openWithCommands)this._incrementalRender();else{var a=x.createOpenWithCommands(this.registry,this._contentTypeService,this._commandService);k.when(a,function(a){this._openWithCommands=a;this._incrementalRender()}.bind(this))}};F.prototype._renderFiltered=
function(a){this.model.filterOn(a);this.createTree(this.getParentDivId(),this.model,{selectionPolicy:"singleSelection",indent:0,onCollapse:function(a){this.onCollapse(a)}.bind(this)});a&&this.expandAll()};F.prototype.refreshValidFiles=function(){for(var a=[],b=D(this.getNavHandler().currentModel()),d=H(this.model),e=0;e<d.length;e++)d[e].stale?b===d[e]&&(b=null):a.push(d[e]);this.model.setValidFileList&&this.model.setValidFileList(a);0===H(this.model).length?(this.getNavHandler().refreshModel(this.getNavDict(),
this.model,H(this.model)),this.getNavHandler().cursorOn(null,!0)):b?this.getNavHandler().refreshModel(this.getNavDict(),this.model,H(this.model),!0):(this.getNavHandler().cursorOn(null,!0),this.getNavHandler().refreshModel(this.getNavDict(),this.model,H(this.model)),this.gotoCurrent())};F.prototype.getItemCount=function(){return this.model.getListRoot().children.length};F.prototype.getParentDivId=function(a){return!this.model.replaceMode()||!a?this.parentNode.id:this._uiFactory?this._uiFactory.getMatchDivID():
this.parentNode.id};F.prototype.gotoCurrent=function(a){var b=null,d="none";a?(b=a.file,d=a.detail):b=this.getNavHandler().currentModel();b||(b=0<H(this.model).length?H(this.model)[0]:null);this.getNavHandler().cursorOn(b,!0);b&&(d&&"none"!==d)&&this.myTree.expand(b,function(){this.onExpand(b,d)}.bind(this))};F.prototype.gotoNext=function(a,b){0!==H(this.model).length&&this.getNavHandler().iterate(a,b)};F.prototype._renderSearchResult=function(a,b,d,f,g){var h=!1,k=[];e.empty(e.node(b));if(0<f.response.numFound)for(var l=
0;l<f.response.docs.length;l++){var m=f.response.docs[l];if(!m.Directory){h||(h=!0);var p=m.Location;k.push({linkLocation:n.toUrl("edit/edit.html")+"#"+p,location:p,path:m.Path?m.Path:p,name:m.Name,lastModified:m.LastModified})}}this.setCrawling(a);var r=this;a=new v.SearchResultModel(this.registry,this.fileClient,k,f.response.numFound,d,{onMatchNumberChanged:function(a){r.renderer.replaceFileElement(a)}});this.setResult(b,a);g?this.incrementalRender():this.startUp()};F.prototype._search=function(a,
b,d){var f=b.regEx||b.caseSensitive;e.empty(e.node("pageNavigationActions"));e.empty(e.node("pageActions"));e.empty(a);if("undefined"!==typeof b.keyword)if(f)a.appendChild(document.createTextNode("")),d=new z.SearchCrawler(this.registry,this.fileClient,b,{childrenLocation:d.getChildrenLocation()}),d.search(function(d,e){this._renderSearchResult(f,a,b,d,e)}.bind(this));else{this.registry.getService("orion.page.message").setProgressMessage(m["Searching..."]);try{this.registry.getService("orion.page.progress").progress(this.fileClient.search(b),
"Searching "+b.keyword).then(function(d){this.registry.getService("orion.page.message").setProgressMessage("");this._renderSearchResult(!1,a,b,d)}.bind(this),function(a){a=g.formatMessage(m["${0}. Try your search again."],a&&a.error?a.error:"Error");this.registry.getService("orion.page.message").setProgressResult({Message:a,Severity:"Error"})}.bind(this))}catch(h){e.empty(a),a.appendChild(document.createTextNode("")),"string"===typeof h&&-1<h.indexOf("search")?(d=new z.SearchCrawler(this.registry,
this.fileClient,b,{childrenLocation:d.getChildrenLocation()}),d.search(function(d,e){this._renderSearchResult(!0,a,b,d,e)}.bind(this))):this.registry.getService("orion.page.message").setErrorMessage(h)}}};F.prototype.runSearch=function(a,b,d){b=e.node(b);this._search(b,a,d)};F.prototype.constructor=F;return{SearchResultExplorer:F}});define("text!orion/globalSearch/searchBuilder.html",[],function(){return'\t\x3cdiv class\x3d"searchMainOptionBlock"\x3e\n\t\t\x3c!-- search box gets inserted here --\x3e\n\t\t\x3cdiv id\x3d"replaceWrapper" class\x3d"replaceWrapper replaceWrapperHidden"\x3e\n\t\t\x3c!-- replace box gets inserted here --\x3e\n\t\t\x3c/div\x3e\n\t\t\x3ca id\x3d"toggleReplaceLink" class\x3d"toggleDisplayLink"\x3e\x3c/a\x3e\n\t\x3c/div\x3e\n\t\n\t\x3cdiv class\x3d"searchOptionBlock"\x3e\n\t\t\x3clabel id\x3d"advSearchCaseSensitiveLabel" class\x3d"searchCheckboxLabel" for\x3d"advSearchCaseSensitive"\x3e\x3c/label\x3e\x3cinput type\x3d"checkbox" id\x3d"advSearchCaseSensitive" class\x3d"searchCheckbox"\x3e\n\t\t\x3cspan class\x3d"layoutRight"\x3e\n\t\t\t\x3clabel id\x3d"advSearchRegExLabel" class\x3d"searchCheckboxLabel" for\x3d"advSearchRegEx"\x3e\x3c/label\x3e\x3cinput type\x3d"checkbox" id\x3d"advSearchRegEx" class\x3d"searchCheckbox"\x3e\n\t\t\x3c/span\x3e\n\t\x3c/div\x3e\n\t\x3cdiv class\x3d"searchOptionBlock"\x3e\n\t\t\x3cdiv id\x3d"fileNamePatternsLabel" class\x3d"searchLabel"\x3e\x3c/div\x3e\n\t\t\x3c!-- file name patterns box gets inserted here --\x3e\n\t\t\x3cspan id\x3d"fileNamePatternsHint" class\x3d"fileNamePatternsHint"\x3e\x3c/span\x3e\n\t\t\n\t\t\x3cdiv id\x3d"searchScope" class\x3d"searchScope"\x3e\n\t\t\t\x3cdiv id\x3d"searchScopeLabel" class\x3d"searchLabel"\x3e\x3c/div\x3e\n\t\t\t\x3cspan id\x3d"searchScopeInputWrapper" class\x3d"searchScopeInputWrapper"\x3e\n\t\t\t\t\x3cspan id\x3d"searchScopeElementWrapper" class\x3d"searchScopeElementWrapper"\x3e\x3c/span\x3e\n\t\t\t\t\x3cbutton id\x3d"searchScopeSelectButton" class\x3d"commandButton core-sprite-outline searchScopeSelectButton"\x3e\x3c/button\x3e\n\t\t\t\x3c/span\x3e\n\t\t\x3c/div\x3e\n\t\x3c/div\x3e'});
define("orion/fileUtils",["require","i18n!orion/nls/messages","orion/URL-shim"],function(m,n){var k;k=m.toUrl?(new URL(m.toUrl("workspace"),window.location.href)).href:(new URL("/",window.location.href)).href;return{makeRelative:function(e){if(!e)return e;var d=window.location.protocol+"//"+window.location.host;return 0===e.indexOf(d)?e.substring(d.length):e},isAtRoot:function(e){return!e?!1:"/workspace"===e?!0:0===(new URL(e,window.location.href)).href.indexOf(k)}}});
define("orion/selection",["orion/EventTarget","orion/Deferred"],function(m,n){function k(e,d){d||(d="orion.page.selection");this._serviceRegistry=e;m.attach(this);this._serviceRegistration=e.registerService(d,this);this._selections=null}k.prototype={getSelection:function(e){var d=this._getSingleSelection();"function"===typeof e&&e(d);return d},getSelections:function(e){var d=Array.isArray(this._selections)?this._selections.slice():[];"function"===typeof e&&e(d);return d},_getSingleSelection:function(){return this._selections&&
0<this._selections.length?this._selections[0]:null},setSelections:function(e){var d=this._selections;Array.isArray(e)?this._selections=0<e.length?e.slice():null:this._selections=e?[e]:null;d!==this._selections&&this.dispatchEvent({type:"selectionChanged",selection:this._getSingleSelection(),selections:this._selections})}};k.prototype.constructor=k;return{Selection:k}});
define("orion/explorers/explorer-table","i18n!orion/navigate/nls/messages orion/Deferred orion/webui/littlelib orion/i18nUtil orion/fileUtils orion/explorers/explorer orion/EventTarget orion/objects orion/util".split(" "),function(m,n,k,e,d,g,f,b,a){function l(a,b,d,e,f,g){this.registry=a;this.root=b;this.fileClient=d;this.idPrefix=e||"";this.excludeFiles=!!f;this.excludeFolders=!!g}function h(a){f.attach(this);this.registry=a.serviceRegistry;this.treeRoot=a.treeRoot;this.selection=a.selection;this.fileClient=
a.fileClient;this.excludeFiles=a.excludeFiles;this.excludeFolders=a.excludeFolders;this.navHandlerFactory=a.navHandlerFactory;this.parentId=a.parentId;this.renderer=a.rendererFactory(this);this.dragAndDrop=a.dragAndDrop;this.setFocus=a.setFocus;this.myTree=this.model=null;this._hookedDrag=this.checkbox=!1;var b=a.modelEventDispatcher?a.modelEventDispatcher:new f;this.modelEventDispatcher=b;var d=this;this._modelListeners={};"copy copyMultiple create delete deleteMultiple import move moveMultiple".split(" ").forEach(function(a){b.addEventListener(a,
d._modelListeners[a]=d.modelHandler[a].bind(d))});this._clickListener=function(a){if("A"===a.target.tagName){for(a=a.target;a&&!a._item;)a=a.parentNode;if(a&&a._item)d.onLinkClick({type:"linkClick",item:a._item})}};(a=k.node(this.parentId))&&a.addEventListener("click",this._clickListener);var e=this.renderer;this.registry&&this.registry.registerService("orion.cm.managedservice",{updated:function(a){a=a&&"undefined"!==a["links.newtab"]?a["links.newtab"]?"_blank":"_self":"_self";e.setTarget&&e.setTarget(a)}},
{pid:"nav.config"})}l.prototype=new g.ExplorerModel;b.mixin(l.prototype,{getRoot:function(a){a(this.root)},processParent:function(a,b){var d=a.Projects?[]:[a].concat(a.Parents||[]);if(this.excludeFiles||this.excludeFolders){var e=[],f;for(f in b)if(!(b[f].Directory?this.excludeFolders:this.excludeFiles))e.push(b[f]),b[f].parent=a,b[f].Parents||(b[f].Parents=d);b=e}else for(e in b)b[e].parent=a,b[e].Parents||(b[e].Parents=d);a.children=b;a.children.sort(this.sortChildren);return b},sortChildren:function(a,
b){var d=a.Directory;if(d!==b.Directory)return d?-1:1;var d=a.Name&&a.Name.toLowerCase(),e=b.Name&&b.Name.toLowerCase();return d<e?-1:d>e?1:0},getChildren:function(a,b){var d=this;if(a.children)b(a.children);else if(void 0!==a.Directory&&!1===a.Directory)b([]);else if(a.Children)b(d.processParent(a,a.Children));else if(a.Location){var e=null;this.registry&&(e=this.registry.getService("orion.page.progress"));(e?e.progress(this.fileClient.fetchChildren(a.ChildrenLocation),m["Fetching children of "]+
a.Name):this.fileClient.fetchChildren(a.ChildrenLocation)).then(function(e){d.destroyed||b(d.processParent(a,e))},function(){b([])})}else b([])},hasChildren:function(){var a=!1;this.root.Children&&(a=0<this.root.Children.length);return a}});l.prototype.constructor=l;var p,q;h.prototype=Object.create(g.Explorer.prototype);b.mixin(h.prototype,{destroy:function(){var a=this;Object.keys(this._modelListeners).forEach(function(b){a.modelEventDispatcher.removeEventListener(b,a._modelListeners[b])});var b=
k.node(this.parentId);b&&b.removeEventListener("click",this._clickListener);g.Explorer.prototype.destroy.call(this)},onLinkClick:function(a){this.dispatchEvent(a)},onModelCreate:function(a){return this.changedItem(a.parent,!0)},onModelCopy:function(a){var b=this,d={};(a.items||[a]).forEach(function(a){a=(a=a.parent)||b.treeRoot;d[a.Location]=a});return n.all(Object.keys(d).map(function(a){return b.changedItem(d[a],!0)}))},onModelMove:function(a){var b=this,d={};(a.items||[a]).forEach(function(a){var e=
b.treeRoot;if((e.Location||e.ContentLocation)===a.oldValue.Location){var f=b.treeRoot;a=a.newValue;a=a.ChildrenLocation?a:this.fileClient.read(a.ContentLocation,!0);return n.when(a,function(a){b.dispatchEvent({type:"rootMoved",oldValue:f,newValue:a});b.loadResourceList(a)})}e=(e=a.oldValue.parent)||b.treeRoot;d[e.Location]=e;e=(e=a.parent)||b.treeRoot;d[e.Location]=e;a.oldValue.Directory&&(a.newValue&&b.isExpanded(a.oldValue))&&(d[a.newValue.Location]=a.newValue)});return n.all(Object.keys(d).map(function(a){return b.changedItem(d[a],
!0)}))},onModelDelete:function(a){a=a.items||[a];var b=this,d=b.treeRoot,e;if(a.some(function(a){if(a.oldValue.Location===(d.Location||d.ContentLocation)){if(a.oldValue.Location!==(a.parent.Location||a.parent.ContentLocation))e=a.parent;return!0}return!1}))return this.loadResourceList(e);var f={};a.forEach(function(a){a=a.parent;f[a.Location]=a});return n.all(Object.keys(f).map(function(a){return b.changedItem(f[a],!0)}))},modelHandler:{copy:function(a){if(!a.count)return this.onModelCopy(a)},copyMultiple:function(a){return this.onModelCopy(a)},
create:function(a){return this.onModelCreate(a)},"delete":function(a){if(!a.count)return this.onModelDelete(a)},deleteMultiple:function(a){return this.onModelDelete(a)},"import":function(a){return this.changedItem(a.target,!0)},move:function(a){if(!a.count)return this.onModelMove(a)},moveMultiple:function(a){return this.onModelMove(a)}},makeNewChildItemPlaceholder:function(a,b,d){var e=new n;this.model.getChildren(a,function(f){var g=null,h=!1;if(f){f.push(b);f.sort(this.model.sortChildren);var g=
f.indexOf(b),k=g+1;f.length>k?g=f[k]:(h=g-1,g=0<=h?f[h]:a,h=!0)}else g=a;f=this.makeNewItemPlaceholder(g,d,h);e.resolve(f)}.bind(this));return e},_makeDropTarget:function(b,f,g){if(this.dragAndDrop){var h=this,l=this.dragAndDrop,v=function(a){p=a.target};g&&(this._oldDragStart&&f.removeEventListener("dragstart",this._oldDragStart,!1),this._oldDragStart=v);f.addEventListener("dragstart",v,!1);v=function(a){p=null};g&&(this._oldDragEnd&&f.removeEventListener("dragend",this._oldDragEnd,!1),this._oldDragEnd=
v);f.addEventListener("dragend",v,!1);v=function(a){f.classList.remove("dragOver");a.preventDefault();a.stopPropagation()};g&&(this._oldDragLeave&&f.removeEventListener("dragleave",this._oldDragLeave,!1),this._oldDragLeave=v);f.addEventListener("dragleave",v,!1);v=function(b){if(p)q=b.dataTransfer.dropEffect=(a.isMac?b.altKey:b.ctrlKey)?"copy":"move";else if(!a.isIE&&("all"===b.dataTransfer.effectAllowed||"uninitialized"===b.dataTransfer.effectAllowed||0<=b.dataTransfer.effectAllowed.indexOf("copy")))b.dataTransfer.dropEffect=
"copy";f.classList.add("dragOver");k.stop(b)};g&&(this._oldDragEnter&&f.removeEventListener("dragenter",this._oldDragEnter,!1),this._oldDragEnter=v);f.addEventListener("dragenter",v,!1);v=function(b){if(p)q=b.dataTransfer.dropEffect=(a.isMac?b.altKey:b.ctrlKey)?"copy":"move";else if(!a.isIE&&("all"===b.dataTransfer.effectAllowed||"uninitialized"===b.dataTransfer.effectAllowed||0<=b.dataTransfer.effectAllowed.indexOf("copy")))b.dataTransfer.dropEffect="copy";k.stop(b)};g&&!this._oldDragOver&&(f.addEventListener("dragover",
v,!1),this._oldDragOver=v);var z=null,A=null;h.registry&&(z=h.registry.getService("orion.page.progress"),A=h.registry.getService("orion.page.message"));var B=function(a){if(A){var b=null,b="string"===typeof a?{Severity:"Error",Message:a}:a&&a.error?{Severity:"Error",Message:a.error}:a;A.setProgressResult(b)}else window.console.log(a)},u=function(a,f,g,h,k,l){var p=!1,q=d.isAtRoot(f.Location);l?(p=!0,l.entryCount++):a.isDirectory&&(p=!0,l={entryCount:1,deferred:new n},g._makeUploadNode(f,a.name,!0).then(function(a){var b=
function(){a.destroyFunction();q?g.loadResourceList(g.treeRoot.Path,!0):g.changedItem(f)};l.deferred.then(b,b)}));var s=function(){l&&(l.entryCount--,0===l.entryCount&&l.deferred.resolve())},t=function(a){if(A){var b=null,b="string"===typeof a?{Severity:"Error",Message:a}:a&&a.error?{Severity:"Error",Message:a.error}:a;A.setProgressResult(b)}else window.console.log(a);s()};!f.Location&&f.fileMetadata&&(f=f.fileMetadata);if(a.isFile)q?t(m["You cannot copy files directly into the workspace.  Create a folder first."]):
a.file(function(a){if(l){var d=a.name.indexOf(".zip")===a.name.length-4&&window.confirm(e.formatMessage(m["Unzip ${0}?"],a.name));h(f,a,g,d,!1,{error:function(b){b=m["Uploading the following file failed: "]+a.name;A?A.setProgressResult({Severity:"Error",Message:b}):window.console.log(b)},loadend:s},!0)}else g._uploadFile(b,a,!0)}.bind(this));else if(a.isDirectory){var v=a.createReader(),w=function(a){v.readEntries(function(b){for(var d=0;d<b.length;d++)u(b[d],a,g,h,k,l);s()})};q?(z?z.progress(k.createProject(f.ChildrenLocation,
a.name),e.formatMessage(m["Creating ${0}"],a.name)):k.createProject(f.ChildrenLocation,a.name)).then(function(a){(z?z.progress(k.read(a.ContentLocation,!0),m["Loading "]+a.name):k.read(a.ContentLocation,!0)).then(function(a){w(a)},t)},t):(z?z.progress(k.createFolder(f.Location,a.name),e.formatMessage(m["Creating ${0}"],a.name)):k.createFolder(f.Location,a.name)).then(function(a){var d=g.modelEventDispatcher;p||d.dispatchEvent({type:"create",parent:b,newValue:a});w(a)},t)}},v=function(a){var g;f.classList.remove("dragOver");
if(p){g=h.fileClient;for(var n=p,v;n;){if(n._item){v=n._item;break}n=n.parentNode}if(!v)return;var w="copy"===q;g=(w?g.copyFile:g.moveFile).apply(g,[v.Location,b.Location,v.Name]);z&&(n=e.formatMessage(m[w?"Copying ${0}":"Moving ${0}"],v.Location),g=z.showWhile(g,n));g.then(function(a){h.modelEventDispatcher.dispatchEvent({type:w?"copy":"move",oldValue:v,newValue:a,parent:b})},B)}else if(a.dataTransfer.items&&0<a.dataTransfer.items.length)for(g=0;g<a.dataTransfer.items.length;g++)n=null,"function"===
typeof a.dataTransfer.items[g].getAsEntry?n=a.dataTransfer.items[g].getAsEntry():"function"===typeof a.dataTransfer.items[g].webkitGetAsEntry&&(n=a.dataTransfer.items[g].webkitGetAsEntry()),n&&u(n,b,h,l,h.fileClient);else if(a.dataTransfer.files&&0<a.dataTransfer.files.length)for(g=0;g<a.dataTransfer.files.length;g++)n=a.dataTransfer.files[g],!n.size&&!n.type?B(e.formatMessage(m["Did not drop ${0}.  Folder drop is not supported in this browser."],n.name)):d.isAtRoot(b.Location)?B(m["You cannot copy files directly into the workspace.  Create a folder first."]):
h._uploadFile(b,n,!0);k.stop(a)};g&&(this._oldDrop&&f.removeEventListener("drop",this._oldDrop,!1),this._oldDrop=v);f.addEventListener("drop",v,!1)}},_uploadFile:function(a,b,d){var f=a;!f.Location&&f.fileMetadata&&(f=f.fileMetadata);a=function(){this._makeUploadNode(f,b.name,!1).then(function(a){var d=a.refNode,g=a.progressBar,h=a.cancelButton,k=a.destroyFunction,l=this.registry.getService("orion.page.message");a={progress:function(a){var b="";if(a.lengthComputable){b=Math.floor(100*(a.loaded/a.total))+
"%";g.style.width=b;var e=Math.round(a.loaded/1024);a=Math.round(a.total/1024);g.title=m["Upload progress: "]+b+",  "+e+"/"+a+" KB";d.title=g.title}},loadend:function(a){k();this.changedItem(f)}.bind(this),error:function(a){a=m["Uploading the following file failed: "]+b.name;l?l.setProgressResult({Severity:"Error",Message:a}):window.console.log(a)}};var n=b.name.indexOf(".zip")===b.name.length-4&&window.confirm(e.formatMessage(m["Unzip ${0}?"],b.name)),p=this.dragAndDrop(f,b,this,n,!1,a,!0);h.addEventListener("click",
function(){p.abort()})}.bind(this))}.bind(this);d?this.expandItem(f,!1).then(a):a()},_makeUploadNode:function(a,b,d){var e=this.getRow(a).id;return this.makeNewChildItemPlaceholder(a,{Name:b,Directory:d},e).then(function(a){var e=null,f,g;if(a){e={};f=a.refNode;g=a.wrapperNode;f.classList.add("uploadNode");e.refNode=f;e.wrapperNode=g;g=document.createElement("span");g.classList.add("uploadNodeText");g.appendChild(document.createTextNode(b));f.appendChild(g);g=document.createElement("span");g.classList.add("progressBarWrapper");
var h=document.createElement("span");h.classList.add("progressBar");g.appendChild(h);f.appendChild(g);e.progressBar=h;d?(h.classList.add("continuous"),f.title=m["Uploading "]+b,h.title=f.title):(g=document.createElement("button"),g.classList.add("imageSprite"),g.classList.add("core-sprite-delete"),g.classList.add("uploadCancelButton"),g.title=m["Cancel upload"],f.appendChild(g),e.cancelButton=g);e.destroyFunction=a.destroyFunction}return e}.bind(this))},createModel:function(){return new l(this.registry,
this.treeRoot,this.fileClient,this.parentId,this.excludeFiles,this.excludeFolders)},changedItem:function(a,b){if(this.treeRoot&&this.treeRoot.Location===a.Location)return this.loadResourceList(this.treeRoot,b);var d=this,e=new n;a.children=a.Children=null;this.model.getChildren(a,function(f){d.getNavHandler();d.myTree.refresh.bind(d.myTree)(a,f,b);e.resolve(f)});return e},showItem:function(a,b){var d=new n;if(!a||!this.model||!this.myTree||!this.myTree.showRoot&&a.Location===this.treeRoot.Location)return d.reject();
var e=this.getRow(a);if(e)d.resolve(e._item||a);else return a.Parents&&0<a.Parents.length?(a.Parents[0].Parents=a.Parents.slice(1),this.expandItem(a.Parents[0],b).then(function(b){var d=this.getRow(a);return!d?this.changedItem(b,!0).then(function(){var b=this.getRow(a);return b?b._item:(new n).reject()}.bind(this)):d._item||a}.bind(this))):void 0===b||b?this.reroot(a):d.reject();return d},expandItem:function(a,b){var d=new n;this.showItem(a,b).then(function(a){this.myTree.isExpanded(a)?d.resolve(a):
this.myTree.expand(this.model.getId(a),function(){d.resolve(a)})}.bind(this),d.reject);return d},reveal:function(a,b){return this.showItem(a,b).then(function(a){var b=this.getNavHandler();b&&(b.cursorOn(a,!0),b.setSelection(a));return a}.bind(this))},reroot:function(a){return(new n).reject()},isExpanded:function(a){a=this.model.getId(a);return this.renderer.tableTree.isExpanded(a)},getNameNode:function(a){if(a=this.model.getId(a))return k.node(a+"NameLink")},scopeUp:function(){},scopeDown:function(a){},
loadResourceList:function(a,b,e){a&&"object"===typeof a&&(a=a.ChildrenLocation||a.ContentLocation);a=d.makeRelative(a);if(!b&&a===this._lastPath)return(new n).resolve(this.treeRoot);this._lastPath=a;var f=this;return b||a!==this.treeRoot.Path?this.load(this.fileClient.loadWorkspace(a),m["Loading "]+a).then(function(b){f.treeRoot.Path=a;"function"===typeof e&&e();f.dispatchEvent({type:"rootChanged",root:f.treeRoot});return(new n).resolve(f.treeRoot)},function(a){f.treeRoot.Path=null;f.dispatchEvent({type:"rootChanged",
root:f.treeRoot});return(new n).reject(a)}):(new n).resolve(f.treeRoot)},load:function(a,b,d){var e=k.node(this.parentId),f=k.node("progress");f||(f=document.createElement("div"),f.id="progress",k.empty(e),e.appendChild(f));k.empty(f);var g=setTimeout(function(){k.empty(f);f.appendChild(document.createTextNode(b))},500),h=this;return n.when(a,function(a){clearTimeout(g);if(!h.destroyed){h.treeRoot={};for(var b in a)h.treeRoot[b]=a[b];h.model=h.createModel();h.dragAndDrop&&(h._hookedDrag?h._makeDropTarget(h.treeRoot,
e,!0):(a=(a=e&&("draggable"in e||"ondragstart"in e&&"ondrop"in e))&&!(!window.File||!window.FileList||!window.FileReader),h._hookedDrag=!0,a?h._makeDropTarget(h.treeRoot,e,!0):(h.dragAndDrop=null,window.console.log("Local file drag and drop is not supported in this browser."))));var f=new n;h.createTree(h.parentId,h.model,{onComplete:function(a){f.resolve(a)},navHandlerFactory:h.navHandlerFactory,setFocus:"undefined"===typeof h.setFocus?!0:h.setFocus,selectionPolicy:h.renderer.selectionPolicy,onCollapse:function(a){if(h.getNavHandler())h.getNavHandler().onCollapse(a)}});
return f.then(function(){if("function"===typeof d)try{d()}catch(a){h.registry&&h.registry.getService("orion.page.message").setErrorMessage(a)}if("function"===typeof h.onchange)h.onchange(h.treeRoot);return h.treeRoot})}},function(a){clearTimeout(g);h.registry&&h.registry.getService("orion.page.message").setProgressResult(a);return(new n).reject(a)})},onchange:function(a){}});h.prototype.constructor=h;return{FileExplorer:h,FileModel:l}});
define("orion/webui/dialogs/DirectoryPrompterDialog","i18n!orion/widgets/nls/messages orion/webui/littlelib orion/webui/dialog orion/fileUtils orion/selection orion/explorers/navigationUtils orion/explorers/explorer orion/explorers/explorer-table".split(" "),function(m,n,k,e,d,g,f,b){function a(a,b){this.explorer=b;this._init(a)}function l(a){this._init(a)}a.prototype=new f.SelectionRenderer;a.prototype.constructor=a;a.prototype.getLabelColumnIndex=function(){return 0};a.prototype.getCellElement=
function(a,b,d){a=document.createElement("td");d.appendChild(a);var e=document.createElement("span");e.id=d.id+"navSpan";a.appendChild(e);e.className="mainNavColumn singleNavColumn";this.getExpandImage(d,e);e.appendChild(document.createTextNode(b.Name))};l.prototype=new k.Dialog;l.prototype.TEMPLATE='\x3cdiv id\x3d"message" style\x3d"width: 25em; padding-bottom: 5px;"\x3e\x3c/div\x3e\x3cdiv id\x3d"directoryTree" class\x3d"explorerTreeClass" style\x3d"width:25em; min-height: 25em; max-height:30em; height: auto; overflow-y: auto;"\x3e\x3c/div\x3e';
l.prototype._init=function(a){this.title=a.title||m["Choose a Folder"];this.modal=!0;this.buttons=[{text:m.OK,isDefault:!0,callback:this.done.bind(this)}];this.customFocus=!0;this._fileClient=a.fileClient;this._serviceRegistry=a.serviceRegistry;this._message=a.message||"";this._func=a.func;this._initialize()};l.prototype._bindToDom=function(a){this.loadFolderList("/");this._message?this.$message.appendChild(document.createTextNode(this._message)):this.$message.style.display="none";this.$directoryTree.focus()};
l.prototype.loadFolderList=function(f){f=e.makeRelative(f);this.selection=new d.Selection(this._serviceRegistry,"orion.directoryPrompter.selection");this.explorer=new b.FileExplorer({treeRoot:{children:[]},selection:this.selection,serviceRegistry:this._serviceRegistry,fileClient:this._fileClient,parentId:"directoryTree",excludeFiles:!0,rendererFactory:function(b){return new a({checkbox:!1,singleSelection:!0,treeTableClass:"directoryPrompter"},b)}});this.explorer.loadResourceList(f,!0,null)};l.prototype.done=
function(){this.selection.getSelection(function(a){this.hide();this._func(a)}.bind(this))};l.prototype.constructor=l;return{DirectoryPrompterDialog:l}});define("text!orion/widgets/input/ComboTextInput.html",[],function(){return'\x3cdiv class\x3d"comboTextInputWrapper"\x3e\n\t\x3cinput type\x3d"text" class\x3d"comboTextInputField"\x3e\n\t\x3cbutton class\x3d"orionButton recentEntryButton" tabindex\x3d"-1"\x3e\n\t\t\x3cspan class\x3d"core-sprite-openarrow recentEntryArrow"\x3e\x3c/span\x3e\n\t\x3c/button\x3e\n\t\x3cbutton class\x3d"orionButton commandButton comboTextInputButton"\x3e\x3c/button\x3e\n\x3c/div\x3e'});
define("orion/inputCompletion/inputCompletion",["orion/EventTarget"],function(m){function n(k,e,d){m.attach(this);this._binderFunc=e;this.setInputField(k);(k=d?d.group:null)||(k=this._inputField&&this._inputField.id?this._inputField.id:"default__input__group");this._completionIdPrefix=k+"__completion__";this._proposeFromStart=d?d.proposeFromStart:!1;this._extendedProvider=d?d.extendedProvider:null;this._serviceRegistry=d?d.serviceRegistry:null;this._onDelete=d?d.onDelete:null;this._deleteToolTips=
d?d.deleteToolTips:"";this._proposalIndex=-1;this._dismissed=!0;this._mouseDown=!1;this._dataList=[];this._initUI();this._listeners=[];d=function(d){this._binderFunc&&this._binderFunc(function(e){this._bind(e);d.deleting&&(this._proposeOn(this._inputField.value),this._selectProposal(this._proposalIndex,!0))}.bind(this))}.bind(this);this.addEventListener("inputDataListChanged",d);this._listeners.push({evtTarget:this,type:"inputDataListChanged",handler:d});d=function(d){this._mouseDown=!0}.bind(this);
this._completionUIContainer.addEventListener("mousedown",d);this._listeners.push({evtTarget:this._completionUIContainer,type:"mousedown",handler:d});d=function(d){this._mouseDown=!1}.bind(this);this._completionUIContainer.addEventListener("mouseup",d);this._listeners.push({evtTarget:this._completionUIContainer,type:"mouseup",handler:d})}n.prototype._removeListeners=function(k){k&&k.forEach(function(e){e.evtTarget.removeEventListener(e.type,e.handler,!1)})};n.prototype.destroy=function(){this._removeListeners(this._inputFieldListeners);
this._removeListeners(this.listeners)};n.prototype.hasValueOf=function(k){return this._dataList.some(function(e){return e.value===k})};n.prototype.setInputField=function(k){this._inputField&&this._inputFieldListeners&&this._removeListeners(this._inputFieldListeners);this._inputFieldListeners=[];this._inputField=k;"string"===typeof this._inputField&&(this._inputField=document.getElementById(this._inputField));k=function(e){this._mouseDown?window.setTimeout(function(){this._inputField.focus()}.bind(this),
200):document.activeElement!==this._inputField&&this._dismiss()}.bind(this);this._inputField.addEventListener("blur",k);this._inputFieldListeners.push({evtTarget:this._inputField,type:"blur",handler:k});k=function(e){this.onKeyDown(e)}.bind(this);this._inputField.addEventListener("keydown",k);this._inputFieldListeners.push({evtTarget:this._inputField,type:"keydown",handler:k});k=function(e){this._proposeOn(this._inputField.value)}.bind(this);this._inputField.addEventListener("input",k);this._inputFieldListeners.push({evtTarget:this._inputField,
type:"input",handler:k});k=function(e){this._dismissed&&this._binderFunc&&(this._dismissing?this._dismissing=!1:this._binderFunc&&this._binderFunc(function(d){this._bind(d)}.bind(this)))}.bind(this);this._inputField.addEventListener("focus",k);this._inputFieldListeners.push({evtTarget:this._inputField,type:"focus",handler:k})};n.prototype.onKeyDown=function(k){if(this._dismissed)return!0;var e=k.charCode||k.keyCode;if(13===e){if(this._proposalList&&0<this._proposalList.length&&0<=this._proposalIndex&&
this._proposalIndex<this._proposalList.length)return k.preventDefault(),this._dismiss(this._proposalList[this._proposalIndex].item.value,k.ctrlKey),k.stopPropagation(),!1}else{if((40===e||38===e)&&this._proposalList&&0<this._proposalList.length)return k.preventDefault(),this._walk(40===e),k.stopPropagation(),!1;if(27===e)return k.preventDefault(),this._dismiss(),!1;if(46===e&&-1<this._proposalIndex&&this._onDelete)return k.preventDefault(),this._onDelete(this._proposalList[this._proposalIndex].item.value,
this),this._resetIndexAfterDeletion(),k.stopPropagation(),!1}return!0};n.prototype._resetIndexAfterDeletion=function(){1>=this._proposalList.length?this._proposalIndex=-1:this._proposalIndex===this._proposalList.length-1&&(this._proposalIndex=this._proposalList.length-2)};n.prototype._bind=function(k){this._dataList=k};n.prototype._getUIContainerID=function(){return this._completionIdPrefix+"UIContainer"};n.prototype._getUIProposalListId=function(){return this._completionIdPrefix+"UIProposalList"};
n.prototype._initUI=function(){this._completionUIContainer=document.getElementById(this._getUIContainerID());this._completionUIContainer||(this._completionUIContainer=document.createElement("div"),this._completionUIContainer.id=this._getUIContainerID(),this._completionUIContainer.style.display="none",this._completionUIContainer.className="inputCompletionContainer",this._completionUIContainer.setAttribute("role","list"),this._completionUIContainer.setAttribute("aria-atomic","true"),this._completionUIContainer.setAttribute("aria-live",
"assertive"),document.body.appendChild(this._completionUIContainer));this._completionUIContainer.textContent="";this._completionUL=document.getElementById(this._getUIProposalListId());this._completionUL||(this._completionUL=document.createElement("ul"),this._completionUL.id=this._getUIProposalListId(),this._completionUL.className="inputCompletionUL");this._completionUL.textContent="";this._completionUIContainer.appendChild(this._completionUL)};n.prototype._createProposalLink=function(k,e,d,g){var f=
document.createElement("a");f.href=require.toUrl(e);f.appendChild(this._createBoldText(k,d,g));return f};n.prototype._createBoldText=function(k,e,d,g){if(0>e)return document.createTextNode(k);g=g?g:document.createElement("span");var f;0!==e&&(f=document.createTextNode(k.substring(0,e)),g.appendChild(f));var b=document.createElement("b");g.appendChild(b);f=document.createTextNode(k.substring(e,e+d));b.appendChild(f);e+d<k.length&&(f=document.createTextNode(k.substring(e+d)),g.appendChild(f));return g};
n.prototype._proposeOnCategory=function(k,e){if(0!==e.length){var d;if(k){d=document.createElement("li");d.className="inputCompletionLICategory";var g=document.createTextNode(k);d.appendChild(g);this._completionUL.appendChild(d)}e.forEach(function(e){d=document.createElement("li");d.onmouseover=function(a){this._selectProposal(a.currentTarget)}.bind(this);d.onclick=function(a){this._dismiss(a.currentTarget.completionItem.value)}.bind(this);d.className="inputCompletionLINormal";d.completionItem=e.item;
var b;if("string"===typeof e.item.value){var a=document.createElement("table");a.style.width="100%";a.style.tableLayout="fixed";a.style.borderSpacing="0";var g=document.createElement("tr");g.style.width=this._inputField.offsetWidth+"px";a.appendChild(g);var h=document.createElement("td");h.classList.add("inputCompletionLILeftTD");var k=this._createBoldText(e.item.value,e.boldIndex,e.boldLength);h.appendChild(k);h.style.overflow="hidden";g.appendChild(h);this._onDelete&&(b=document.createElement("button"),
b.classList.add("inputCompletionDismissButton"),b.classList.add("layoutRight"),b.classList.add("core-sprite-close"),b.classList.add("imageSprite"),b.style.display="none",b.style.margin="0 0 0",b.title=this._deleteToolTips,b.onclick=function(a){a.stopPropagation();this._onDelete(e.item.value,this);this._resetIndexAfterDeletion()}.bind(this),h=document.createElement("td"),h.classList.add("inputCompletionLIRightTD"),h.appendChild(b),g.appendChild(h));d.appendChild(a)}else e.item.value.name&&"link"===
e.item.value.type&&d.appendChild(this._createProposalLink(e.item.value.name,e.item.value.value,e.boldIndex,e.boldLength));this._completionUL.appendChild(d);this._proposalList.push({item:e.item,domNode:d,deleteBtn:b})}.bind(this))}};n.prototype._domNode2Index=function(k){if(this._proposalList)for(var e=0;e<this._proposalList.length;e++)if(this._proposalList[e].domNode===k)return e;return-1};n.prototype._highlight=function(k,e){var d=k,g,f=!1;isNaN(d)||(f=!0,this._proposalList&&0<=k&&k<this._proposalList.length?
(d=this._proposalList[k].domNode,g=this._proposalList[k].deleteBtn):d=null);d&&(d.className=e?"inputCompletionLISelected":"inputCompletionLINormal",g&&(g.style.display=e?"":"none"),e&&f&&(d.offsetTop<this._completionUIContainer.scrollTop?d.scrollIntoView(!0):d.offsetTop+d.offsetHeight>this._completionUIContainer.scrollTop+this._completionUIContainer.clientHeight&&d.scrollIntoView(!1)))};n.prototype._selectProposal=function(k,e){var d=k;isNaN(d)&&(d=this._domNode2Index(k));if(d!==this._proposalIndex||
e)this._highlight(this._proposalIndex,!1),this._proposalIndex=d,this._highlight(this._proposalIndex,!0)};n.prototype._dismiss=function(k,e){this._mouseDown||(this._dismissed=!0,this._proposalList=null,this._proposalIndex=-1,"string"===typeof k?(this._inputField.value=k,this._dismissing=!0,this._inputField.focus()):k&&(k.name&&"link"===k.type)&&(e?window.open(k.value):window.location.href=k.value),this._completionUIContainer.style.display="none")};n.prototype._show=function(){if(this._proposalList&&
0<this._proposalList.length){for(var k=0,e=0,d=this._inputField;d;)k+=d.offsetLeft,e+=d.offsetTop,d=d.offsetParent;this._completionUIContainer.style.display="block";this._completionUIContainer.style.top=e+this._inputField.offsetHeight+2+"px";this._completionUIContainer.style.left=k+"px";this._completionUIContainer.style.width=this._inputField.offsetWidth+"px";this._dismissed=this._mouseDown=!1}else this._dismissed=!0,this._proposalList=null,this._proposalIndex=-1,this._completionUIContainer.style.display=
"none"};n.prototype._walk=function(k){k=this._proposalIndex+(k?1:-1);-1>k?k=this._proposalList.length-1:k>=this._proposalList.length&&(k=-1);this._selectProposal(k)};n.prototype._proposeOnList=function(k,e,d){var g="",f=[],b=e?e.length:0;k.forEach(function(a){if("category"===a.type)this._proposeOnCategory(g,f),g=a.label,f=[];else{var k=!0,h=-1;if(e&&d){var m;"string"===typeof a.value?m=a.value.toLowerCase():a.value.name&&(m=a.value.name.toLowerCase());h=m.indexOf(e);0>h?k=!1:this._proposeFromStart&&
(k=0===h)}k&&f.push({item:a,boldIndex:h,boldLength:b})}}.bind(this));this._proposeOnCategory(g,f)};n.prototype._proposeOn=function(k){this._completionUL.textContent="";var e=k?k.toLowerCase():null;this._proposalList=[];this._proposeOnList(this._dataList,e,!0);this._extendedProvider&&e?this._extendedProvider(k,function(d){d&&d.forEach(function(d){this._proposeOnList(d.proposals,d.filterForMe?e:k,d.filterForMe)}.bind(this));this._show()}.bind(this),[]):this._show()};n.prototype.constructor=n;return{InputCompletion:n}});
define("orion/widgets/input/ComboTextInput",["orion/objects","orion/webui/littlelib","text!orion/widgets/input/ComboTextInput.html","i18n!orion/widgets/nls/messages","orion/inputCompletion/inputCompletion"],function(m,n,k,e,d){function g(d){this._domNodeId=d.id;this._parentNode=d.parentNode;this._insertBeforeNode=d.insertBeforeNode;this._hasButton=d.hasButton;this._buttonText=d.buttonText;this._buttonClickListener=d.buttonClickListener;this._hasInputCompletion=d.hasInputCompletion;this._serviceRegistry=
d.serviceRegistry;this._defaultRecentEntryProposalProvider=d.defaultRecentEntryProposalProvider;this._extendedRecentEntryProposalProvider=d.extendedRecentEntryProposalProvider;this._onRecentEntryDelete=d.onRecentEntryDelete;this._initializeDomNodes()}m.mixin(g.prototype,{_initializeDomNodes:function(){var d=document.createRange();d.selectNode(this._parentNode);var d=d.createContextualFragment(k),b=document.createElement("span");b.appendChild(d);this._domNode=b.lastChild;this._domNode.id=this._domNodeId;
this._textInputNode=n.$(".comboTextInputField",this._domNode);this._textInputNode.addEventListener("focus",function(){this._domNode.classList.add("comboTextInputWrapperFocussed")}.bind(this));this._textInputNode.addEventListener("blur",function(){this._domNode.classList.remove("comboTextInputWrapperFocussed")}.bind(this));this._recentEntryButton=n.$(".recentEntryButton",this._domNode);this._hasInputCompletion?this._initializeCompletion():(this._domNode.removeChild(this._recentEntryButton),this._recentEntryButton=
void 0);this._comboTextInputButton=n.$(".comboTextInputButton",this._domNode);this._hasButton?(this._comboTextInputButton=n.$(".comboTextInputButton",this._domNode),this._buttonText&&this._comboTextInputButton.appendChild(document.createTextNode(this._buttonText)),this._buttonClickListener&&this._comboTextInputButton.addEventListener("click",function(a){this._buttonClickListener(a)}.bind(this))):(this._domNode.removeChild(this._comboTextInputButton),this._comboTextInputButton=void 0);this._insertBeforeNode?
this._parentNode.insertBefore(this._domNode,this._insertBeforeNode):this._parentNode.appendChild(this._domNode)},_initializeCompletion:function(){this._localStorageKey=this._domNodeId+"LocalStorageKey";this._defaultRecentEntryProposalProvider||(this._defaultRecentEntryProposalProvider=function(b){var a=this.getRecentEntryArray();a||(a=[]);b(a)}.bind(this));this._onRecentEntryDelete||(this._onRecentEntryDelete=function(b,a){var d=this.getRecentEntryArray(),e=this._getIndexOfValue(d,b);-1<e&&(d.splice(e,
1),this._storeRecentEntryArray(d),0===d.length&&this._hideRecentEntryButton(),a&&window.setTimeout(function(){a.dispatchEvent({type:"inputDataListChanged",deleting:!0})}.bind(this),20))}.bind(this));this._inputCompletion=new d.InputCompletion(this._textInputNode,this._defaultRecentEntryProposalProvider,{serviceRegistry:this._serviceRegistry,group:this._domNodeId+"InputCompletion",extendedProvider:this._extendedRecentEntryProposalProvider,onDelete:this._onRecentEntryDelete,deleteToolTips:e["Click or use delete key to delete the search term"]});
this._recentEntryButton.addEventListener("click",function(b){this._textInputNode.focus();this._inputCompletion._proposeOn();n.stop(b)}.bind(this));var f=this.getRecentEntryArray();f&&0<f.length?this._showRecentEntryButton():this._hideRecentEntryButton()},getDomNode:function(){return this._domNode},getTextInputNode:function(){return this._textInputNode},getTextInputValue:function(){return this._textInputNode.value},setTextInputValue:function(d){this._textInputNode.value=d},getButton:function(){return this._comboTextInputButton},
getRecentEntryButton:function(){return this._recentEntryButton},setRecentEntryButtonTitle:function(d){this._recentEntryButton&&(this._recentEntryButton.title=d)},addTextInputValueToRecentEntries:function(){var d=this.getTextInputValue();if(d){var b=this.getRecentEntryArray();b||(b=[]);-1===this._getIndexOfValue(b,d)&&(b.push({type:"proposal",label:d,value:d}),this._storeRecentEntryArray(b),this._showRecentEntryButton())}},_getIndexOfValue:function(d,b){var a=-1;d.some(function(d,e){return d.value===
b?(a=e,!0):!1});return a},showButton:function(){this._comboTextInputButton.classList.remove("isHidden")},hideButton:function(){this._comboTextInputButton.classList.add("isHidden")},getRecentEntryArray:function(){var d=null;if(this._localStorageKey){var b=localStorage.getItem(this._localStorageKey);b&&(d=JSON.parse(b))}return d},_storeRecentEntryArray:function(d){d=JSON.stringify(d);localStorage.setItem(this._localStorageKey,d)},_showRecentEntryButton:function(){this._recentEntryButton.classList.remove("isHidden")},
_hideRecentEntryButton:function(){this._recentEntryButton.classList.add("isHidden")}});return g});
define("orion/globalSearch/advSearchOptRenderer","i18n!orion/search/nls/messages orion/fileClient orion/searchUtils orion/contentTypes orion/webui/littlelib orion/Deferred orion/objects orion/EventTarget text!orion/globalSearch/searchBuilder.html orion/PageUtil orion/webui/dialogs/DirectoryPrompterDialog orion/widgets/input/ComboTextInput".split(" "),function(m,n,k,e,d,g,f,b,a,l,h,p){function q(a,f,g){b.attach(this);this._parentDiv=d.node(a);this._searcher=f;this._serviceRegistry=g;this._contentTypeService=
this._serviceRegistry.getService("orion.core.contentTypeRegistry");this._contentTypeService||(this._contentTypeService=new e.ContentTypeRegistry(this._serviceRegistry));this.contentTypesCache=this._contentTypeService.getContentTypes();this.fileClient=new n.FileClient(this._serviceRegistry);this.render()}f.mixin(q.prototype,{destroy:function(){},getOptions:function(){var a="";this._searchLocations.forEach(function(b){a&&(a=a.concat(","));a=a.concat(b)},this);var b=k.getFileNamePatternsArray(this._fileNamePatternsBox.getTextInputValue()),
d=this._replaceBox.getTextInputValue()||void 0;return{keyword:this._searchBox.getTextInputValue(),rows:40,start:0,replace:d,caseSensitive:this._caseSensitiveCB.checked,regEx:this._regExCB.checked,fileNamePatterns:b,resource:a}},loadSearchParams:function(a){this._searchParams=a;this._rootURL=this.fileClient.fileServiceRootURL(this._searchParams.resource);this.dispatchEvent({type:"rootChanged",root:this._rootURL});this._loadSearchParams()},_loadSearchParams:function(){if(this._init&&this._searchParams){this._searchBox.setTextInputValue(this._searchParams.keyword||
"");this._replaceBox.setTextInputValue(this._searchParams.replace||"");this._caseSensitiveCB.checked=this._searchParams.caseSensitive;this._regExCB.checked=this._searchParams.regEx;var a=this._searchParams.fileNamePatterns?this._searchParams.fileNamePatterns.join(", "):"";this._fileNamePatternsBox.setTextInputValue(a);void 0!==this._searchParams.replace?this._showReplaceField():this._hideReplaceField()}},render:function(){this._contentTypeService.getContentTypes().then(function(a){this.contentTypesCache=
a;this._render()}.bind(this))},_render:function(){this._parentDiv.innerHTML=a;this._initHTMLLabels();this._initControls();this._searchTextInputBox.focus()},_submitSearch:function(){var a=this.getOptions();a.replace=null;this._searchBox.addTextInputValueToRecentEntries();this._fileNamePatternsBox.addTextInputValueToRecentEntries();k.doSearch(this._searcher,this._serviceRegistry,a.keyword,a)},_replacePreview:function(){var a=this.getOptions();this._searchBox.addTextInputValueToRecentEntries();this._replaceBox.addTextInputValueToRecentEntries();
this._fileNamePatternsBox.addTextInputValueToRecentEntries();a.replace||(a.replace="");a.keyword&&k.doSearch(this._searcher,this._serviceRegistry,a.keyword,a)},_initSearchBox:function(){var a=function(a,b){var d=this._serviceRegistry.getServiceReferences("orion.search.proposal");if(!d||0===d.length)b(null);else{var e=[];d.forEach(function(b){var d=b.getProperty("filterForMe");e.push(this._serviceRegistry.getService(b).run(a).then(function(a){for(var b={filterForMe:d,proposals:[]},e=0;e<a.length;e++){b.proposals.push({type:"category",
label:a[e].category});for(var f=0;f<a[e].datalist.length;f++)b.proposals.push({type:"proposal",label:a[e].datalist[f],value:a[e].datalist[f]})}return b}))}.bind(this));g.all(e).then(function(a){b(a)})}}.bind(this),b=d.$(".searchMainOptionBlock",this._parentDiv);this._searchBox=new p({id:"advSearchInput",insertBeforeNode:b.firstElementChild,parentNode:b,hasButton:!0,buttonText:m.Search,buttonClickListener:this._submitSearch.bind(this),hasInputCompletion:!0,serviceRegistry:this._serviceRegistry,extendedRecentEntryProposalProvider:a});
this._searchTextInputBox=this._searchBox.getTextInputNode();this._searchTextInputBox.placeholder=m["Type a search term"];this._searchBox.setRecentEntryButtonTitle(m["Show previous search terms"]);this._searchTextInputBox.addEventListener("keydown",function(a){a.defaultPrevented||13===(a.charCode||a.keyCode)&&this._submitSearch()}.bind(this))},_initReplaceBox:function(){this._replaceWrapper=document.getElementById("replaceWrapper");this._replaceBox=new p({id:"advReplaceInput",parentNode:this._replaceWrapper,
hasButton:!0,buttonText:m["Replace..."],buttonClickListener:this._replacePreview.bind(this),hasInputCompletion:!0,serviceRegistry:this._serviceRegistry});this._replaceTextInputBox=this._replaceBox.getTextInputNode();this._replaceTextInputBox.placeholder=m["Replace With"];this._replaceButton=this._replaceBox.getButton();this._replaceButton.title=m["Show replacement preview"];this._replaceBox.setRecentEntryButtonTitle(m["Show previous replace terms"]);this._replaceTextInputBox.addEventListener("keydown",
function(a){(a.charCode||a.keyCode)===d.KEY.ENTER&&this._replacePreview()}.bind(this));this._replaceWrapper.style.width="auto";this._replaceWrapper.style.width=this._replaceBox.getDomNode().scrollWidth+8+"px"},_initFileNamePatternsBox:function(){this._fileNamePatternsHint=document.getElementById("fileNamePatternsHint");this._fileNamePatternsBox=new p({id:"fileNamePatternsInput",insertBeforeNode:this._fileNamePatternsHint,parentNode:this._fileNamePatternsHint.parentNode,hasButton:!1,hasInputCompletion:!0,
serviceRegistry:this._serviceRegistry});this._fileNamePatternsTextInput=this._fileNamePatternsBox.getTextInputNode();this._fileNamePatternsTextInput.classList.add("fileNamePatternsTextInput");this._fileNamePatternsTextInput.placeholder="*.*";d.empty(this._fileNamePatternsHint);this._fileNamePatternsHint.appendChild(document.createTextNode(m["(* \x3d any string, ? \x3d any character)"]));this._fileNamePatternsTextInput.addEventListener("focus",function(){this._fileNamePatternsHint.classList.add("fileNamePatternsHintVisible")}.bind(this));
this._fileNamePatternsTextInput.addEventListener("blur",function(){var a=this._fileNamePatternsBox.getTextInputValue();a&&(a=k.getFileNamePatternsArray(a),this._fileNamePatternsBox.setTextInputValue(a.join(", ")));this._fileNamePatternsHint.classList.remove("fileNamePatternsHintVisible")}.bind(this))},_initControls:function(){this._initSearchBox();this._initReplaceBox();this._initFileNamePatternsBox();this._caseSensitiveCB=document.getElementById("advSearchCaseSensitive");this._regExCB=document.getElementById("advSearchRegEx");
this._toggleReplaceLink=document.getElementById("toggleReplaceLink");this._init=!0;this._loadSearchParams();this._replaceBoxIsHidden()&&(this._toggleReplaceLink.innerHTML=m["Show Replace"]);this._toggleReplaceLink.addEventListener("click",this._toggleReplaceFieldVisibility.bind(this));this._initSearchScope()},_initHTMLLabels:function(){document.getElementById("advSearchCaseSensitiveLabel").appendChild(document.createTextNode(m["Case sensitive"]));document.getElementById("advSearchRegExLabel").appendChild(document.createTextNode(m["Regular expression"]));
document.getElementById("searchScopeLabel").appendChild(document.createTextNode(m.Scope));document.getElementById("fileNamePatternsLabel").appendChild(document.createTextNode(m["File name patterns (comma-separated)"]));document.getElementById("searchScopeSelectButton").title=m["Choose a Folder"]},_initSearchScope:function(){var a=l.matchResourceParameters().resource;this._rootURL=this.fileClient.fileServiceRootURL(a);this._searchLocations=a?[a]:[this._rootURL];this._searchScopeElementWrapper=d.$("#searchScopeElementWrapper",
this._parentDiv);this._displaySelectedSearchScope();this._searchScopeSelectButton=d.$("#searchScopeSelectButton",this._parentDiv);var b=function(a){this._searchLocations=a&&a.Location?[a.Location]:[this._rootURL];this._displaySelectedSearchScope();this._searcher.setLocationbyURL(this._searchLocations[0])}.bind(this);this._searchScopeSelectButton.addEventListener("click",function(){(new h.DirectoryPrompterDialog({title:m["Choose a Folder"],serviceRegistry:this._serviceRegistry,fileClient:this.fileClient,
func:b})).show()}.bind(this))},_replaceBoxIsHidden:function(){return this._replaceWrapper.classList.contains("replaceWrapperHidden")},_toggleReplaceFieldVisibility:function(){this._replaceBoxIsHidden()?this._showReplaceField():this._hideReplaceField()},_showReplaceField:function(){this._searchBox.hideButton();this._replaceWrapper.classList.remove("replaceWrapperHidden");this._toggleReplaceLink.innerHTML=m["Hide Replace"]},_hideReplaceField:function(){this._searchBox.showButton();this._replaceWrapper.classList.add("replaceWrapperHidden");
this._toggleReplaceLink.innerHTML=m["Show Replace"]},_displaySelectedSearchScope:function(){var a=this._searchScopeElementWrapper;d.empty(a);this._searchLocations.forEach(function(b){var d=decodeURI(b),e=d;if(this.fileClient.fileServiceRootURL(e)===b)e=this.fileClient.fileServiceName(e);else if(b=e.split("/"))(e=b.pop())||(e=b.pop());b=document.createElement("span");b.classList.add("searchScopeElement");b.title=d;a.title=d;b.appendChild(document.createTextNode(e));a.appendChild(b)},this)}});return{AdvSearchOptRenderer:q}});
define("search/search","i18n!orion/search/nls/messages require orion/bootstrap orion/status orion/progress orion/dialogs orion/commandRegistry orion/searchClient orion/fileClient orion/operationsClient orion/searchExplorer orion/globalCommands orion/contentTypes orion/searchUtils orion/PageUtil orion/webui/littlelib orion/globalSearch/advSearchOptRenderer".split(" "),function(m,n,k,e,d,g,f,b,a,l,h,p,q,r,t,w,s){function x(a,b,d,e,f,g,h,k){var l=h.resource,n=h.replace?m["Replace All Matches"]:m["Search Results"];
l?l===b.fileServiceRootURL(l)?(e.setRootLocationbyURL(l),e.setLocationbyURL(l),p.setPageTarget({task:"Search",title:n,serviceRegistry:a,commandService:d,searchService:e,fileService:b,breadcrumbRootName:"Search",staticBreadcrumb:!0}),e.setChildrenLocationbyURL(l),g.loadSearchParams(h),f.runSearch(h,"results",e)):(k?k.progress(b.read(l,!0),"Loading file metadata "+l):b.read(l,!0)).then(function(k){p.setPageTarget({task:"Search",title:n,target:k,serviceRegistry:a,fileService:b,commandService:d,searchService:e,
staticBreadcrumb:!0,breadcrumbRootName:"Search"});g.loadSearchParams(h);f.runSearch(h,"results",e)}.bind(this),function(a){window.console.error("Error loading file metadata: "+a.message)}.bind(this)):(p.setPageTarget({task:"Search",title:n,serviceRegistry:a,commandService:d,searchService:e,fileService:b,staticBreadcrumb:!0,breadcrumbRootName:"Search"}),g.loadSearchParams(h),f.runSearch(h,"results",e))}k.startup().then(function(k){var m=k.serviceRegistry;k=k.preferences;new g.DialogService(m);var n=
new l.OperationsClient(m);new e.StatusReportingService(m,n,"statusPane","notifications","notificationArea");var B=new f.CommandRegistry({}),u=new d.ProgressService(m,n,B),y=new a.FileClient(m);new q.ContentTypeRegistry(m);var C=new b.Searcher({serviceRegistry:m,commandService:B,fileService:y}),E=new s.AdvSearchOptRenderer("searchBuilder",C,m);p.generateBanner("orion-searchResults",m,B,k,C,C,null,!1);var D=new h.SearchResultExplorer(m,B),H=function(){var a=w.node("filterBox");a&&w.empty(a);a=t.matchResourceParameters();
r.convertSearchParams(a);x(m,y,B,C,D,E,a,u);if(a=document.getElementById("pageActions"))B.destroy(a),B.renderCommands(a.id,a,C,C,"button")};window.addEventListener("hashchange",function(){H()},!0);H()})});
//@ sourceMappingURL=search.js.map