/*******************************************************************************
 * @license
 * 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). 
 *
 *******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/**
 * @license 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
 */

/*******************************************************************************
 * @license
 * 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).
 *
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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). 
 * 
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/**
 * @license 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
 */

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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).
 *
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/******************************************************************************* 
 * @license
 * 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 
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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: 
 *		Felipe Heidrich (IBM Corporation) - initial API and implementation
 *		Silenio Quarti (IBM Corporation) - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/*******************************************************************************
 * @license 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
 ******************************************************************************/

/**
 * marked - a markdown parser
 * Copyright (c) 2011-2013, Christopher Jeffrey. (MIT Licensed)
 * https://github.com/chjj/marked
 */

/*******************************************************************************
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *		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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *	Adrian Aichner - regular expression capture group support in replace
 ******************************************************************************/

/******************************************************************************* 
 * @license
 * 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 
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/******************************************************************************* 
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/******************************************************************************* 
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/*******************************************************************************
 *
 * @license
 * 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) 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). 


 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) 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, 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). 

 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).


 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) 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) 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) 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) 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) 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) 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, 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) 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, 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) 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, 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) 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, 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, 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) 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) 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) 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, 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) 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) 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, 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) 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) 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) 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: 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). 


 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) 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) 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: 
 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, 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
 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, 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) 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, 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) 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) 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) 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: 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). 

 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) 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 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) 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
 Adrian Aichner - regular expression capture group support in replace

 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) 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) 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
 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) 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, 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, 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) 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) 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, 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, 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, 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). 

 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) 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 g(){for(var c=navigator.userAgent,d={browser:!1,version:!1},b=[{name:"Chrome/Chromium",regExp:/(?:chrome|crios|chromium)\/(\d+)/i,minVersion:24},{name:"Firefox",regExp:/firefox\/(\d+)/i,minVersion:17},{name:"Microsoft Internet Explorer",regExp:/msie\s(\d+)/i,minVersion:10},{name:"Safari",regExp:/version\/(\d+).*?safari/i,minVersion:5}],h=0;h<b.length;h++){var k=b[h],e=c.match(k.regExp);if(e){d.browser=!0;d.version=e[1]>=k.minVersion;d.name=k.name;break}}return d}function l(){try{return"localStorage"in
window&&window.localStorage!==null}catch(c){return!1}}function i(c){alert(c);throw Error("unsupported browser");}var f=g();if(f.browser)f.version||i("Sorry, your browser version is not supported.\n\nTo use Orion, please upgrade to the latest version of "+f.name+".\n");else if(l()&&!localStorage.skipBrowserCheck)if(confirm("Sorry, your browser is not supported. The latest version of Chrome, Firefox or Safari web browser is recommended.\nContinue anyway?"))localStorage.skipBrowserCheck=1;else throw"unsupported browser";
else l()||i("Sorry, your browser is not supported.\n\nTo use Orion, the latest version of the Chrome, Firefox, or Safari web browser is recommended.\n");return{isSupportedBrowser:g,supportsLocalStorage:l,throwBrowserAlert:i}})();define("orion/browserCompatibility",function(){});
(function(g,l){typeof define==="function"&&define.amd?define("orion/Deferred",l):typeof exports==="object"?module.exports=l():(g.orion=g.orion||{},g.orion.Deferred=l())})(this,function(){function g(){for(var b;b=c.shift();)b();d=!1}function l(b){c.push(b);d||(d=!0,setTimeout(g,0))}function i(b){return function(){b.apply(void 0,arguments)}}function f(){function b(){for(var e;e=p.shift();){var b=e.deferred,h=j==="fulfilled"?"resolve":"reject";if(typeof e[h]==="function")try{var k=(0,e[h])(a),d=k&&(typeof k===
"object"||typeof k==="function")&&k.then;if(typeof d==="function")if(k===b.promise)b.reject(new TypeError);else{var f=k.cancel;typeof f==="function"?b._protected(c).parentCancel=f.bind(k):delete b._protected(c).parentCancel;d.call(k,i(b.resolve),i(b.reject),i(b.progress))}else b.resolve(k)}catch(o){b.reject(o)}else b[h](a)}}function h(e){delete n.parentCancel;j="rejected";a=e;p.length&&l(b)}function k(e){function c(a){return function(e){t||(t=!0,a(e))}}var t=!1;delete n.parentCancel;try{var i=e&&
(typeof e==="object"||typeof e==="function")&&e.then;if(typeof i==="function")if(e===d)h(new TypeError);else{j="assumed";var g=e&&e.cancel;if(typeof g!=="function"){var u=new f,e=u.promise;try{i(u.resolve,u.reject,u.progress)}catch(o){u.reject(o)}g=e.cancel;i=e.then}a=e;i.call(e,c(k),c(h));n.parentCancel=g.bind(e)}else j="fulfilled",a=e,p.length&&l(b)}catch(r){c(h)(r)}}function e(){var a=n.parentCancel;if(a)delete n.parentCancel,a();else if(!j)a=Error("Cancel"),a.name="Cancel",h(a)}var a,j,p=[],d=
this,n={};Object.defineProperty(this,"_protected",{value:function(a){if(a!==c)throw Error("protected");return n}});this.resolve=function(a){j||k(a);return d};this.reject=function(a){j||h(a);return d};this.progress=function(a){j||p.forEach(function(e){if(e.progress)try{e.progress(a)}catch(b){}});return d.promise};this.cancel=function(){n.parentCancel?setTimeout(e,0):e();return d};this.then=function(a,e,h){a={resolve:a,reject:e,progress:h,deferred:new f};p.push(a);a.deferred._protected(c).parentCancel=
d.promise.cancel.bind(d);(j==="fulfilled"||j==="rejected")&&l(b);return a.deferred.promise};this.promise={then:d.then,cancel:d.cancel}}var c=[],d=!1;f.all=function(b,h){function c(e,b){p||(j[e]=b,--a===0&&d.resolve(j))}function e(a,e){if(!p){if(h)try{c(a,h(e));return}catch(b){e=b}d.reject(e)}}var a=b.length,j=[],p=!1,d=new f;d.then(void 0,function(){p=!0;b.forEach(function(a){a.cancel&&a.cancel()})});a===0?d.resolve(j):b.forEach(function(a,b){a.then(c.bind(void 0,b),e.bind(void 0,b))});return d.promise};
f.when=function(b,h,c,e){var a;if(!(b&&typeof b.then==="function"))a=new f,a.resolve(b),b=a.promise;return b.then(h,c,e)};return f});
define("orion/EventTarget",[],function(){function g(){this._namedListeners={}}g.prototype={dispatchEvent:function(g){if(!g.type)throw Error("unspecified type");var i=this._namedListeners[g.type];i&&i.forEach(function(f){try{typeof f==="function"?f(g):f.handleEvent(g)}catch(c){typeof console!=="undefined"&&console.log(c)}});return!g.defaultPrevented},addEventListener:function(g,i){if(typeof i==="function"||i.handleEvent)this._namedListeners[g]=this._namedListeners[g]||[],this._namedListeners[g].push(i)},
removeEventListener:function(g,i){var f=this._namedListeners[g];if(f)for(var c=0;c<f.length;c++)if(f[c]===i){f.length===1?delete this._namedListeners[g]:f.splice(c,1);break}}};g.prototype.constructor=g;g.attach=function(l){var i=new g;l.dispatchEvent=i.dispatchEvent.bind(i);l.addEventListener=i.addEventListener.bind(i);l.removeEventListener=i.removeEventListener.bind(i)};return g});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(g,l){function i(b,c,e){this._properties=e||{};this._properties["service.id"]=b;this._properties.objectClass=c;this._properties["service.names"]=c}function f(b,c,e){this._serviceId=b;this._serviceReference=c;this._internalRegistry=e}function c(b,c){function e(a){return function(){var e;try{if(!c())throw Error("Service was unregistered");var d=b[a].apply(b,Array.prototype.slice.call(arguments));if(d&&typeof d.then==="function")return d;
else e=new g,e.resolve(d)}catch(f){e=new g,e.reject(f)}return e.promise}}for(var a in b)typeof b[a]==="function"&&(this[a]=e(a))}function d(b,c){this.type=b;this.serviceReference=c}function b(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new l;var b=this;this._internalRegistry={isRegistered:function(c){return b._entries[c]?!0:!1},unregisterService:function(c){var e=b._entries[c];if(!e)throw Error("Service has already been unregistered: "+c);var a=e.reference;b._serviceEventTarget.dispatchEvent(new d("unregistering",
a));b._entries[c]=null;a.getProperty("objectClass").forEach(function(e){for(var c=b._namedReferences[e],k=0;k<c.length;k++)if(c[k]===a){c.length===1?delete b._namedReferences[e]:c.splice(k,1);break}})},modifyService:function(c){var e=b._entries[c];if(!e)throw Error("Service not found while trying to send modified event: "+c);b._serviceEventTarget.dispatchEvent(new d("modified",e.reference))}}}i.prototype={getPropertyKeys:function(){var b=[],c;for(c in this._properties)this._properties.hasOwnProperty(c)&&
b.push(c);return b},getProperty:function(b){return this._properties[b]}};i.prototype.constructor=i;f.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 c=this._serviceReference._properties;this._serviceReference._properties=b||{};b["service.id"]=this._serviceId;
b.objectClass=c.objectClass;b["service.names"]=c["service.names"];this._internalRegistry.modifyService(this._serviceId)}};f.prototype.constructor=f;b.prototype={getService:function(b){var c;if(typeof b==="string")(b=this._namedReferences[b])&&b.some(function(e){c=this._entries[e.getProperty("service.id")].service;return!!c},this);else if(b=this._entries[b.getProperty("service.id")])c=b.service;return c||null},getServiceReferences:function(b){if(b)return this._namedReferences[b]?this._namedReferences[b]:
[];var c=[];this._entries.forEach(function(e){e&&c.push(e.reference)});return c},registerService:function(b,k,e){if(typeof k==="undefined"||k===null)throw Error("invalid service");typeof b==="string"?b=[b]:Array.isArray(b)||(b=[]);var a=this._entries.length,j=new i(a,b,e),p=this._namedReferences;b.forEach(function(a){p[a]=p[a]||[];p[a].push(j)});b=new c(k,this._internalRegistry.isRegistered.bind(null,a));this._entries.push({reference:j,service:b});b=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new d("registered",
j));return new f(a,j,b)},addEventListener:function(b,c){this._serviceEventTarget.addEventListener(b,c)},removeEventListener:function(b,c){this._serviceEventTarget.removeEventListener(b,c)}};b.prototype.constructor=b;return{ServiceRegistry:b}});
define("orion/xhr",["orion/Deferred"],function(g){function l(i,f,c,d){var b=typeof c.response!=="undefined"?c.response:c.responseText,h;try{h=c.status}catch(k){h=0}i={args:f,response:b,responseText:typeof b==="string"?b:null,status:h,url:i,xhr:c};if(typeof d!=="undefined")i.error=d;return i}return function(i,f,c){var c=c||{},d=arguments.length>3&&arguments[3]?arguments[3]:new XMLHttpRequest,b=new g,h=c.headers||{},k=c.log||!1,e;typeof h["X-Requested-With"]==="undefined"&&(h["X-Requested-With"]="XMLHttpRequest");
if(typeof c.data!=="undefined"&&(i==="POST"||i==="PUT"))e=c.data;var a=!1,j=!1;b.promise.then(void 0,function(e){a=!0;!j&&e instanceof Error&&e.name==="Cancel"&&d.abort()});d.onabort=function(){j=!0;if(!a){var e=Error("Cancel");e.name="Cancel";b.reject(e)}};d.onload=function(){var a=l(f,c,d);200<=d.status&&d.status<400?b.resolve(a):(b.reject(a),k&&typeof console!=="undefined"&&console.log(Error(d.statusText)))};d.onerror=function(){var a=l(f,c,d);b.reject(a);k&&typeof console!=="undefined"&&console.log(Error(d.statusText))};
d.onprogress=function(a){a.xhr=d;b.progress(a)};try{d.open(i,f,!0);if(typeof c.responseType==="string")d.responseType=c.responseType;if(typeof c.timeout==="number")if(typeof d.timeout==="number")d.timeout=c.timeout,d.addEventListener("timeout",function(){b.reject(l(f,c,d,"Timeout exceeded"))});else{var p=setTimeout(function(){b.reject(l(f,c,d,"Timeout exceeded"))},c.timeout);b.promise.then(clearTimeout.bind(null,p),clearTimeout.bind(null,p))}Object.keys(h).forEach(function(a){d.setRequestHeader(a,
h[a])});d.send(e||null)}catch(m){b.reject(l(f,c,d,m))}return b.promise}});
define("orion/preferences",["require","orion/Deferred","orion/xhr"],function(g,l,i){function f(e,a){this._name=e;this._providers=a;this._flushPending=!1;this._cached=null;this._stores=[];this._pendingDeletes=[];this._dirty=[]}function c(e,a){return{get:function(b,c){if(a===0)return null;var h=localStorage.getItem(e+b);if(h===null)return null;h=JSON.parse(h);return c||a===-1||h._expires&&h._expires>(new Date).getTime()?(delete h._expires,h):null},set:function(b,c){if(a!==0){if(a!==-1)c._expires=(new Date).getTime()+
1E3*a;if(Object.keys(c).length===0)localStorage.removeItem(e+b);else{var h=JSON.stringify(c);localStorage.setItem(e+b,h);delete c._expires}}},remove:function(a){localStorage.removeItem(e+a)}}}function d(e){this._currentPromises={};this._cache=new c("/orion/preferences/user",3600);this._service=null;this.available=function(){if(!this._service){var a=e.getServiceReferences("orion.core.preference.provider");if(a.length>0)this._service=e.getService(a[0])}return!!this._service}}function b(e){this._location=
e;this._currentPromise=null;this._cache=new c("/orion/preferences/default",3600)}function h(){this._cache=new c("/orion/preferences/local",-1)}function k(e,a){this._userProvider=new d(e);this._localProvider=new h;a=a||"defaults.pref";a.indexOf("://")===-1&&(a=g.toUrl(a));this._defaultsProvider=new b(a);this._serviceRegistration=e.registerService("orion.core.preference",this)}f.prototype={_flush:function(){for(var e=[],a=0;a<this._stores.length;++a){var b=this._stores[a];this._dirty.indexOf(b)!==-1&&
e.push(this._providers[a].put(this._name,b));if(this._pendingDeletes[a]&&this._pendingDeletes[a].length>0){for(b=0;b<this._pendingDeletes[a].length;b++)e.push(this._providers[a].remove(this._name,this._pendingDeletes[a][b]));delete this._pendingDeletes[a]}}this._dirty=[];return l.all(e)},_scheduleFlush:function(e){e&&this._dirty.indexOf(e)===-1&&this._dirty.push(e);if(!this._flushPending)this._flushPending=!0,window.setTimeout(function(){if(this._flushPending)this._flushPending=!1,this._flush()}.bind(this),
0)},_getCached:function(){if(!this._cached){this._cached={};for(var e=0;e<this._stores.length;++e){var a=this._stores[e],b;for(b in a)a.hasOwnProperty(b)&&typeof this._cached[b]==="undefined"&&(this._cached[b]=a[b])}}return this._cached},keys:function(){return Object.keys(this._getCached())},get:function(e){return this._getCached()[e]},put:function(e,a){if(this._stores.length!==0){var b=this._stores[0];if(b[e]!==a)b[e]=a,this._cached=null,this._scheduleFlush(b)}},remove:function(e){for(var a=0;a<
this._stores.length;++a){var b=this._stores[a];if(b.hasOwnProperty(e))return delete b[e],this._pendingDeletes[a]||(this._pendingDeletes[a]=[]),this._pendingDeletes[a].push(e),this._cached=null,this._scheduleFlush(),!0}return!1},clear:function(){for(var b=0;b<this._stores.length;++b)this._stores[b]={},this._scheduleFlush(this._stores[b]);this._cached=null},sync:function(b){if(this._flushPending)return this._flushPending=!1,this._flush();for(var a=this,j=[],c=0;c<this._providers.length;++c)j.push(this._providers[c].get(this._name,
b).then(function(b){return function(e){a._stores[b]=e}}(c)));return l.all(j).then(function(){a._cached=null;a._getCached()})},flush:function(){this._flush()}};d.prototype={get:function(b,a){if(this._currentPromises[b])return this._currentPromises[b];var j=new l,c=null;a?this._cache.remove(b):c=this._cache.get(b);if(c!==null)j.resolve(c);else{this._currentPromises[b]=j;var h=this;this._service.get(b).then(function(a){h._cache.set(b,a);delete h._currentPromises[b];j.resolve(a)},function(a){a.status===
404?(a={},h._cache.set(b,a),delete h._currentPromises[b],j.resolve(a)):(delete h._currentPromises[b],j.resolve(h._cache.get(b,!0)||{}))})}return j},put:function(b,a){this._cache.set(b,a);return this._service.put(b,a)},remove:function(b,a){var j=this._cache.get(b);delete j[a];this._cache.set(b,j);return this._service.remove(b,a)}};b.prototype={get:function(b,a){if(this._currentPromise)return this._currentPromise;var j=new l,c=null;a?this._cache.remove(b):c=this._cache.get(b);if(c!==null)j.resolve(c);
else{this._currentPromise=j;var h=this;i("GET",this._location,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(a){a=JSON.parse(a.response);h._cache.set(b,a[b]||{});h._currentPromise=null;j.resolve(a[b]||{})},function(a){a.xhr.status===401||a.xhr.status===404?(h._cache.set(b,{}),h._currentPromise=null,j.resolve({})):(h._currentPromise=null,a=h._cache.get(b,!0),a!==null?j.resolve(a[b]||{}):j.resolve({}))})}return j},put:function(){var b=new l;b.resolve();return b},remove:function(b,a){var j=
this._cache.get(b);delete j[a];this.put(b,j)}};h.prototype={get:function(b){var a=new l,b=this._cache.get(b);b!==null?a.resolve(b):a.resolve({});return a},put:function(b,a){var j=new l;this._cache.set(b,a);j.resolve();return j},remove:function(b,a){var j=this._cache.get(b);delete j[a];this.put(b,j)}};k.DEFAULT_SCOPE=1;k.LOCAL_SCOPE=2;k.USER_SCOPE=4;k.prototype={listenForChangedSettings:function(b,a,j){if(!a||typeof a!=="number"||a>7||a<1)j=a,a=k.DEFAULT_SCOPE|k.LOCAL_SCOPE|k.USER_SCOPE;window.addEventListener("storage",
j,!1);if((k.USER_SCOPE&a)!==0)return"/orion/preferences/user"+b;else if((k.LOCAL_SCOPE&a)!==0)return"/orion/preferences/local"+b;return"/orion/preferences/default"+b},getPreferences:function(b,a){if(!a||typeof a!=="number"||a>7||a<1)a=k.DEFAULT_SCOPE|k.LOCAL_SCOPE|k.USER_SCOPE;var j=[];k.USER_SCOPE&a&&this._userProvider.available()&&j.push(this._userProvider);k.LOCAL_SCOPE&a&&j.push(this._localProvider);k.DEFAULT_SCOPE&a&&j.push(this._defaultsProvider);var c=new f(b,j);return c.sync().then(function(){return c})},
getSetting:function(b,a,j){for(var c,h=0;h<b.length;h++)if(b[h].label===a)for(var k=0;k<b[h].data.length;k++)if(b[h].data[k].label===j){c=b[h].data[k].value;break}return c}};return{PreferencesService:k}});
(function(){function g(a){if(typeof a!=="string")throw new TypeError;}function l(a){return a?a.split("&"):[]}function i(a){return a.length===0?"":a.join("&")}function f(a){var b=/([^=]*)(?:=?)(.*)/.exec(a),a=b[1]?decodeURIComponent(b[1]):"",b=b[2]?decodeURIComponent(b[2]):"";return[a,b]}function c(a){var b=encodeURIComponent(a[0]);a[1]&&(b+="="+encodeURIComponent(a[1]));return b}function d(a,b){var o="",e=[],j=0;return{next:function(){if(o!==a.query)o=a.query,e=l(o);if(j<e.length){var c=f(e[j++]);
switch(b){case "keys":return c[0];case "values":return c[1];case "keys+values":return[c[0],c[1]];default:throw new TypeError;}}throw w;}}}function b(a){Object.defineProperty(this,"_url",{get:function(){return a._url}})}function h(a){var b=[];a.split("/").forEach(function(a){a===".."?b.pop():a!=="."&&b.push(a)});return b.join("/")}function k(a){return a.replace(/\s/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}function e(a,b){if(typeof a!=="string")throw new TypeError;var a=k(a),o=m.exec(a);
if(!o)return null;var e={};e.scheme=o[1]||"";if(e.scheme&&!s.test(e.scheme))return null;var j=o[2];if(j&&(j=n.exec(j),e.userinfo=j[1],e.host=j[2],e.port=j[3],e.port&&!q.test(e.port)))return null;e.path=o[3];e.query=o[4];e.fragment=o[5];if(!e.scheme&&b&&(e.scheme=b.scheme,!e.host&&b.host))e.userinfo=b.userinfo,e.host=b.host,e.port=b.port,e.pathRelative=!0;if(e.pathRelative)if(e.path){if(e.path[0]!=="/")o=/^(.*\/)[^\/]*$/.exec(b.path)[1]||"/",e.path=o+e.path}else e.path=b.path;if(e.scheme)e.scheme=
e.scheme.toLowerCase();if(e.port)e.port=/[1-9]\d*$/.exec(e.port)[0];if(e.host&&e.path)e.path=h(e.path);return e}function a(a,o){var j;if(o){o=o.href||o;j=e(o);if(!j||!j.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:j})}j=e(a,j);if(!j)throw new SyntaxError;Object.defineProperty(this,"_input",{value:a,writable:!0});Object.defineProperty(this,"_url",{value:j,writable:!0});var c=new b(this);Object.defineProperty(this,"query",{get:function(){return this._url?c:null},enumerable:!0})}
try{var j;if(typeof window.URL==="function"&&window.URL.length!==0&&(j=new window.URL("http://www.w3.org?q")).protocol==="http:"&&j.query)return}catch(p){}var m=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,n=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,s=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,q=/^\d*$/,t=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,v=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,x=/^([^?#\s]*)$/,u=/^([^\s]*)$/,o=/^\S*$/,r=/([^:]*):?(.*)/,w=typeof StopIteration!=="undefined"?
StopIteration:Error("Stop Iteration"),z={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(b.prototype,{get:{value:function(a){g(a);var b;l(this._url.query).some(function(e){e=f(e);if(e[0]===a)return b=e[1],!0});return b},enumerable:!0},set:{value:function(a,b){g(a);g(b);var e=l(this._url.query);e.some(function(o,j){var h=f(o);if(h[0]===a)return h[1]=b,e[j]=c(h),!0})||e.push(c([a,b]));this._url.query=i(e)},enumerable:!0},has:{value:function(a){g(a);
return l(this._url.query).some(function(b){if(f(b)[0]===a)return!0})},enumerable:!0},"delete":{value:function(a){g(a);var b=l(this._url.query),e=b.filter(function(b){return f(b)[0]!==a});return e.length!==b.length?(this._url.query=i(e),!0):!1},enumerable:!0},clear:{value:function(){this._url.query=""},enumerable:!0},forEach:{value:function(a,b){if(typeof a!=="function")throw new TypeError;var e=d(this._url,"keys+values");try{for(;;){var o=e.next();a.call(b,o[1],o[0],this)}}catch(j){if(j!==w)throw j;
}},enumerable:!0},keys:{value:function(){return d(this._url,"keys")},enumerable:!0},values:{value:function(){return d(this._url,"values")},enumerable:!0},items:{value:function(){return d(this._url,"keys+values")}},size:{get:function(){return l(this._url.query).length},enumerable:!0},getAll:{value:function(a){g(a);var b=[];l(this._url.query).forEach(function(e){e=f(e);e[0]===a&&b.push(e[1])});return b},enumerable:!0},append:{value:function(a,b){g(a);g(b);var e=l(this._url.query);e.push(c([a,b]));this._url.query=
i(e)},enumerable:!0}});Object.defineProperties(a.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){g(a);this._input=a;this._url=e(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){g(a);if(this._url&&(a=a.slice(-1)===":"?a.substring(0,a.length-1):a,s.test(a)))this._url.scheme=a.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(a){g(a);if(this._url)this._url.userinfo=a}},username:{get:function(){if(!this._url)return"";var a=r.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){g(a);if(this._url){var b=
r.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=r.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){g(a);if(this._url){var b=[r.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){g(a);if(this._url&&(a=v.exec(a)))this._url.host=a[1],this._url.port=/[1-9]\d*$/.exec(a[2])[0]},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(a){g(a);if(this._url&&t.exec(a))this._url.host=a},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===z[this.protocol]&&(a="");return a},set:function(a){g(a);if(this._url&&q.exec(a))this._url.port=/[1-9]\d*$/.exec(a)[0]},enumerable:!0},pathname:{get:function(){return this._url?
this._url.path:""},set:function(a){g(a);if(this._url&&x.exec(a))this._url.host&&a&&a[0]!=="/"&&(a="/"+a),this._url.path=a?h(a):""},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(a){g(a);if(this._url&&(a&&a[0]==="?"&&(a=a.substring(1)),u.exec(a)))this._url.query=a},enumerable:!0},hash:{get:function(){return this._url&&this._url.fragment?"#"+this._url.fragment:""},set:function(a){g(a);if(this._url&&(a&&a[0]==="#"&&(a=a.substring(1)),o.exec(a)))this._url.fragment=
a},enumerable:!0}});window.URL&&window.URL.createObjectURL&&(Object.defineProperty(a,"createObjectURL",{value:window.URL.createObjectURL.bind(window.URL),enumerable:!1}),Object.defineProperty(a,"revokeObjectURL",{value:window.URL.revokeObjectURL.bind(window.URL),enumerable:!1}));window.URL=a})();define("orion/URL-shim",function(){});
define("orion/pluginregistry",["orion/Deferred","orion/EventTarget","orion/URL-shim"],function(g,l){function i(a,b){var e=Object.keys(a),c=Object.keys(b);if(e.length!==c.length)return!1;e.sort();c.sort();for(var h=0,k=e.length;h<k;h++){var d=e[h];if(d!==c[h])return!1;var f=a[d],d=b[d];if(f!==d&&JSON.stringify(f)!==JSON.stringify(d))return!1}return!0}function f(a){if(a.indexOf("://")===-1)try{return(new URL(a,location.href)).href}catch(b){}return a}function c(a){var b=null,e={key:function(e){return(b=
b||Object.keys(a))[e]},getItem:function(b){return a[b]},setItem:function(e,c){a[e]=c;b=null},removeItem:function(e){delete a[e];b=null},clear:function(){(b=b||Object.keys(a)).forEach(function(b){delete a[b]}.bind(this));b=null}};Object.defineProperty(e,"length",{get:function(){return(b=b||Object.keys(a)).length}});return e}function d(a,b){if(b&&b instanceof XMLHttpRequest){var e,c;try{e=b.status,c=b.statusText}catch(h){e=0,c=""}return{status:e||0,statusText:c}}return b}function b(a){var b=a?JSON.parse(JSON.stringify(a,
d)):a;if(a instanceof Error)b.__isError=!0,b.message=b.message||a.message,b.name=b.name||a.name;return b}function h(a,b){this.type=a;this.plugin=b}function k(a,b){this.__objectId=a;this.__methods=b}function e(a,e,c){function d(a){K&&c.postMessage(a,K)}function f(a){if(!K)return(new g).reject(Error("plugin not connected"));a.id=String(U++);var b=new g;G[a.id]=b;b.then(null,function(b){B==="active"&&b instanceof Error&&b.name==="Cancel"&&d({requestId:a.id,method:"cancel",params:b.message?[b.message]:
[]})});var e=Object.prototype.toString;a.params.forEach(function(o,c){if(e.call(o)==="[object Object]"&&!(o instanceof k)){var j,h;for(j in o)e.call(o[j])==="[object Function]"&&(h=h||[],h.push(j));if(h){var r=N++;R[r]=o;j=function(){delete R[r]};b.then(j,j);a.params[c]=new k(r,h)}}});c.postMessage(a,K);return b.promise}function q(a,b){a||a===0?d({id:a,result:null,error:b}):console.log(b)}function t(a,e,o,c){c.forEach(function(a,b){if(a&&typeof a.__objectId!=="undefined"){var e={};a.__methods.forEach(function(b){e[b]=
function(){return f({objectId:a.__objectId,method:b,params:Array.prototype.slice.call(arguments)})}});c[b]=e}});var j=typeof a===void 0?null:{id:a,result:null,error:null};try{var h=o.apply(e,c);if(j)h&&typeof h.then==="function"?(D[a]=h,h.then(function(b){delete D[a];j.result=b;d(j)},function(e){if(D[a])delete D[a],j.error=b(e),d(j)},function(){d({responseId:a,method:"progress",params:Array.prototype.slice.call(arguments)})})):(j.result=h,d(j))}catch(r){if(j)j.error=b(r),d(j)}}function v(a){try{if(a.method){var b=
a.method,e=a.params||[];if("serviceId"in a){var o=H[a.serviceId];o||q(a.id,"service not found");b in o?t(a.id,o,o[b],e):q(a.id,"method not found")}else if("objectId"in a){var j=R[a.objectId];j||q(a.id,"object not found");b in j?t(a.id,j,j[b],e):q(a.id,"method not found")}else if("requestId"in a){var h=D[a.requestId];h&&b==="cancel"&&h.cancel&&h.cancel.apply(h,e)}else if("responseId"in a){var r=G[a.responseId];r&&b==="progress"&&r.progress&&r.progress.apply(r,e)}else if("plugin"===a.method){var k=
a.params[0];Q({headers:k.headers,services:k.services}).then(function(){E.resolve(w)})}else if("timeout"===a.method)E&&E.reject(a.error);else throw Error("Bad method: "+a.method);}else{var d=G[String(a.id)];delete G[String(a.id)];if(a.error){var p=c.handleServiceError(w,a.error);d.reject(p)}else d.resolve(a.result)}}catch(f){console.log("Plugin._messageHandler "+f)}}function x(a){var b={};if(a.methods&&(a.methods.forEach(function(e){b[e]=function(){var b={serviceId:a.serviceId,method:e,params:Array.prototype.slice.call(arguments)};
return B==="active"?f(b):w.start({"transient":!0}).then(function(){return f(b)})}}),b.addEventListener&&b.removeEventListener)){var e=new l,o=N++;R[o]={handleEvent:e.dispatchEvent.bind(e)};var j=new k(o,["handleEvent"]),c=b.addEventListener;b.addEventListener=function(a,b){e._namedListeners[a]||c(a,j);e.addEventListener(a,b)};var h=b.removeEventListener;b.removeEventListener=function(a,b){e.removeEventListener(a,b);e._namedListeners[a]||h(a,j)}}return b}function u(b){var e=JSON.parse(JSON.stringify(b.properties));
e.__plugin__=a;b=b.names||b.type||[];Array.isArray(b)||(b=[b]);e.objectClass=b;return e}function o(a){var b=x(a),e=u(a),e=c.registerService(a.names||a.type,b,e);O[a.serviceId]={registration:e,proxy:b}}function r(){c.persist(a,{created:z,headers:y,services:J,autostart:A,lastModified:L})}var w=this,e=e||{},z=e.created||(new Date).getTime(),y=e.headers||{},J=e.services||[],A=e.autostart,L=e.lastModified||0,B="installed",C,E,K,O={},U=0,N=0,D={},G={},R={},H={},Q;this._persist=r;this._resolve=function(){B=
"resolved";c.dispatchEvent(new h("resolved",w))};this._getAutostart=function(){return A};this._getCreated=function(){return z};this.getLocation=function(){return a};this.getHeaders=function(){return JSON.parse(JSON.stringify(y))};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 L};this.getServiceReferences=function(){var a=[];Object.keys(O).forEach(function(b){a.push(O[b].registration.getReference())});
return a};this.getState=function(){return B};this.start=function(b){if(B==="uninstalled")return(new g).reject(Error("Plugin is uninstalled"));if(C)return C.promise.then(this.start.bind(this,b));if(B==="active")return(new g).resolve();if(!b||!b.transient){var e=b&&b.lazy?"lazy":"started";e!==A&&(A=e,r())}e=c.getState();if(e!=="starting"&&e!=="active")return b.transient?(new g).reject(Error("start transient error")):(new g).resolve();if(B==="installed")try{this._resolve()}catch(k){return(new g).reject(k)}B===
"resolved"&&J.forEach(function(a){o(a)});if(b&&b.lazy)return B!=="starting"&&(B="starting",c.dispatchEvent(new h("lazy activation",w))),(new g).resolve();var d=new g;C=d;B="starting";c.dispatchEvent(new h("starting",w));E=new g;K=c.connect(a,v);E.then(function(){E=null;B="active";c.dispatchEvent(new h("started",w));C=null;d.resolve()},function(){E=null;B="stopping";c.dispatchEvent(new h("stopping",w));Object.keys(O).forEach(function(a){O[a].registration.unregister();delete O[a]});c.disconnect(K);
K=null;B="resolved";C=null;c.dispatchEvent(new h("stopped",w));d.reject(Error("plugin activation error"))});return d.promise};this.stop=function(a){if(B==="uninstalled")return(new g).reject(Error("Plugin is uninstalled"));if(C)return C.promise.then(this.stop.bind(this,a));if((!a||!a.transient)&&"stopped"!==A)A="stopped",r();if(B!=="active"&&B!=="starting")return(new g).resolve();C=a=new g;B="stopping";c.dispatchEvent(new h("stopping",w));Object.keys(O).forEach(function(a){O[a].registration.unregister();
delete O[a]});K&&(c.disconnect(K),K=null);B="resolved";C=null;c.dispatchEvent(new h("stopped",w));a.resolve();return a.promise};Q=function(b){if(B==="uninstalled")return(new g).reject(Error("Plugin is uninstalled"));if(!b)return L===0&&(L=(new Date).getTime(),r()),c.loadManifest(a).then(Q);var e=y,k=J,d=A;y=b.headers||{};J=b.services||{};A=b.autostart||A;b.lastModified?L=b.lastModified:(L=(new Date).getTime(),r());if(i(y,e)&&i(J,k)&&A===d)return(new g).resolve();if(B==="active"||B==="starting"){var p=
[];Object.keys(J).forEach(function(a){var b=J[a];p.push(a);var e=O[a];if(e){if(i(b.methods,Object.keys(e.proxy))){var a=u(b),j=e.registration.getReference(),c={};j.getPropertyKeys().forEach(function(a){c[a]=j.getProperty(a)});i(a,c)||e.registration.setProperties(a);return}e.registration.unregister();delete O[a]}o(b)});Object.keys(O).forEach(function(a){p.indexOf(a)===-1&&(O[a].registration.unregister(),delete O[a])})}B==="active"&&(c.disconnect(K),E=new g,K=c.connect(a,v),E.then(function(){E=null},
function(){E=null;B="stopping";c.dispatchEvent(new h("stopping"),w);Object.keys(O).forEach(function(a){O[a].registration.unregister();delete O[a]});c.disconnect(K);K=null;B="resolved";c.dispatchEvent(new h("stopped",w))}));return(new g).resolve()};this.update=function(a){return Q(a).then(function(){c.dispatchEvent(new h("updated",w))})};this.uninstall=function(){if(B==="uninstalled")return(new g).reject(Error("Plugin is uninstalled"));if(B==="active"||B==="starting"||B==="stopping")return this.stop().then(this.uninstall.bind(this),
this.uninstall.bind(this));c.removePlugin(this);B="uninstalled";c.dispatchEvent(new h("uninstalled",w));return(new g).resolve()}}var a=/^http[s]?/i;return{Plugin:e,PluginRegistry:function(b,k){function d(a){var b=a.source;t.some(function(e){if(b===e.target){try{var j;if(typeof e.useStructuredClone==="undefined"){var c=typeof a.data!=="string";j=c?a.data:JSON.parse(a.data);e.useStructuredClone=c}else j=e.useStructuredClone?a.data:JSON.parse(a.data);e.handler(j)}catch(h){}return!0}})}var k=k||{},n=
k.storage||localStorage;n.getItem||(n=c(n));var s="installed",q=[],t=[],i=new l,x={},u={registerService:b.registerService.bind(b),connect:function(a,b,e){function j(a){a=Error(a);a.name="timeout";b({method:"timeout",error:a})}var c={handler:b,url:a},h=setTimeout(j.bind(null,"Load timeout for: "+a),e||15E3),d=document.createElement("iframe");d.name=a+"_"+(new Date).getTime();if(!k.visible)d.style.display="none",d.style.visibility="hidden";d.src=a;d.onload=function(){clearTimeout(h);setTimeout(j.bind(null,
"Plugin handshake timeout for: "+a),5E3)};d.sandbox="allow-scripts allow-same-origin";document.body.appendChild(d);c.target=d.contentWindow;c.close=function(){d&&(document.body.removeChild(d),d=null)};t.push(c);return c},disconnect:function(a){for(var b=0;b<t.length;b++)if(a===t[b]){t.splice(b,1);try{a.close()}catch(e){}break}},removePlugin:function(a){for(var b=0;b<q.length;b++)if(a===q[b]){q.splice(b,1);break}n.removeItem("plugin."+a.getLocation())},persist:function(a,b){n.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{i.dispatchEvent(a)}catch(b){console&&console.log("PluginRegistry.dispatchEvent "+b)}},loadManifest:function(a){var b=new g,e=u.connect(a,function(a){e&&a.method&&("manifest"===a.method||"plugin"===a.method?(a=a.params[0],u.disconnect(e),e=null,b.resolve(a)):"timeout"===a.method&&(u.disconnect(e),e=null,b.reject(a.error)))});return b.promise},getState:function(){return s},handleServiceError:function(b,
e){if(e&&e.status===401){var j=b.getHeaders(),c=b.getName()||b.getLocation(),h=document.createElement("span");h.appendChild(document.createTextNode("Authentication required for: "+c+"."));if(j.login)h.appendChild(document.createTextNode(" ")),c=document.createElement("a"),c.target="_blank",c.textContent="Login",c.href=j.login,a.test(c.href)?(h.appendChild(c),h.appendChild(document.createTextNode(" and re-try the request."))):console.log("Illegal Login URL: "+j.login);return{Severity:"Error",HTML:!0,
Message:(new XMLSerializer).serializeToString(h)}}if(e.__isError){var k=e,e=Error(k.message);Object.keys(k).forEach(function(a){e[a]=k[a]});delete e.__isError}return e}};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=u.getState;this.init=function(){if(!(s==="starting"||s==="active"||s==="stopping")){addEventListener("message",d,
!1);for(var a=[],b=0,j=n.length;b<j;b++)a.push(n.key(b));a.forEach(function(a){if(a.indexOf("plugin.")===0){var b=a.substring(7),a=JSON.parse(n.getItem(a));a.created&&q.push(new e(b,a,u))}});q.sort(function(a,b){return a._getCreated()<b._getCreated()?-1:1});k.plugins&&Object.keys(k.plugins).forEach(function(a){a=f(a);if(!this.getPlugin(a)){var b=k.plugins[a],b=typeof b==="object"||{};b.autostart=b.autostart||k.defaultAutostart||"lazy";q.push(new e(a,b,u))}}.bind(this));s="starting"}};this.start=function(){s!==
"starting"&&this.init();if(s!=="starting")return(new g).reject("Cannot start framework. Framework is already "+s+".");var a=[],b=(new Date).getTime();q.forEach(function(e){var j=e._getAutostart();e.getLastModified()===0?a.push(e.update().then(function(){if("started"===j)return e.start({"transient":!0});if("lazy"===j)return e.start({lazy:!0,"transient":!0});e._resolve()})):"started"===j?a.push(e.start({"transient":!0})):"lazy"===j?(a.push(e.start({lazy:!0,"transient":!0})),b>e.getLastModified()+864E5&&
e.update()):e._resolve()});return g.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){s="active"})};this.stop=function(){if(s!=="starting"&&s!=="active")return(new g).reject("Cannot stop registry. Registry is already "+s+".");s="stopping";var a=[];q.forEach(function(b){a.push(b.stop({"transient":!0}))});return g.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){removeEventListener("message",d);s="resolved"})};this.update=function(){this.stop().then(this.start.bind(this))};
this.uninstall=function(){return(new g).reject("Cannot uninstall registry")};this.installPlugin=function(a,b){var a=f(a),j=this.getPlugin(a);if(j)return(new g).resolve(j);if(x[a])return x[a];if(b)return j=new e(a,b,u),q.push(j),j._persist(),u.dispatchEvent(new h("installed",j)),(new g).resolve(j);var c=u.loadManifest(a).then(function(b){j=new e(a,b,u);q.push(j);j._persist();delete x[a];u.dispatchEvent(new h("installed",j));return j},function(b){delete x[a];throw b;});return x[a]=c};this.getPlugins=
function(){return q.slice()};this.getPlugin=function(a){var b=null,a=f(a);q.some(function(e){if(a===e.getLocation())return b=e,!0});return b};this.addEventListener=i.addEventListener.bind(i);this.removeEventListener=i.removeEventListener.bind(i);this.resolvePlugins=function(){var a=!0;q.forEach(function(b){a=a&&b._resolve()});return a}}}});
define("orion/serviceTracker",[],function(){function g(f,c){function d(a){var b=a.getProperty("service.id"),e=this.addingService(a);e&&(h[b]=a,k[b]=e)}function b(a){var b=a.getProperty("service.id"),e=k[b];delete h[b];delete k[b];this.removedService(a,e)}this.serviceRegistry=f;var h={},k={},e=l,a,j;this.close=function(){if(e!==i)throw"Already closed";e=l;f.removeEventListener("registered",a);f.removeEventListener("unregistering",j);j=a=null;var c=this;this.getServiceReferences().forEach(function(a){b.call(c,
a)});if(typeof this.onClose==="function")this.onClose()};this.getServiceReferences=function(){var a=Object.keys(h);return!a.length?null:a.map(function(a){return h[a]})};this.open=function(){if(e!==l)throw"Already open";e=i;var h=this;a=function(a){if(a.serviceReference.getProperty("objectClass").indexOf(c)!==-1&&(d.call(h,a.serviceReference),typeof h.onServiceAdded==="function"))return h.onServiceAdded(a.serviceReference,h.serviceRegistry.getService(a.serviceReference))};j=function(a){a.serviceReference.getProperty("objectClass").indexOf(c)!==
-1&&b.call(h,a.serviceReference)};f.addEventListener("registered",a);f.addEventListener("unregistering",j);f.getServiceReferences(c).forEach(function(a){d.call(h,a)});if(typeof this.onOpen==="function")this.onOpen()}}var l=0,i=1;g.prototype={addingService:function(f){return this.serviceRegistry.getService(f)},onOpen:null,onClose:null,onServiceAdded:null,removedService:function(){}};return g});
define("orion/objects",[],function(){function g(g){for(var i=1;i<arguments.length;i++){var f=arguments[i],c;for(c in f)Object.prototype.hasOwnProperty.call(f,c)&&(g[c]=f[c])}return g}return{clone:function(l){if(Array.isArray(l))return Array.prototype.slice.call(l);var i=Object.create(Object.getPrototypeOf(l));g(i,l);return i},mixin:g,toArray:function(g){return Array.isArray(g)?g:[g]}}});
define("orion/config",["orion/Deferred","orion/serviceTracker","orion/objects"],function(g,l,i){var f,c,d,b,h,k="pid";f=function(a,b,e){function c(a,e,h){e.forEach(function(c,o){try{var r=a[o].getProperty("__plugin__"),k=r&&b.getPlugin(r);(!r||k&&k.getState()==="active")&&e[o].updated(h)}catch(d){typeof console!=="undefined"&&console.log(d)}})}l.call(this,a,"orion.cm.managedservice");var h={},d={},f=function(b){var j=[];b.plugin.getServiceReferences().forEach(function(b){if(b.getProperty("objectClass").indexOf("orion.cm.managedservice")!==
-1){var c=b.getProperty(k),b=a.getService(b);c&&b&&(c=(c=e._find(c))&&c.getProperties(),j.push(b.updated(c)))}});return g.all(j)};this.addingService=function(b){var e=b.getProperty(k),j=a.getService(b);if(!e||!j)return null;h[e]||(h[e]=[]);d[e]||(d[e]=[]);h[e].push(b);d[e].push(j);return j};this.onServiceAdded=function(a,b){var j=a.getProperty(k),j=e._find(j);c([a],[b],j&&j.getProperties())};this.onOpen=function(){b.addEventListener("started",f)};this.onClose=function(){b.removeEventListener("started",
f)};this.notifyUpdated=function(a){var b=a.getPid();c(h[b]||[],d[b]||[],a.getProperties())};this.notifyDeleted=function(a){a=a.getPid();c(h[a]||[],d[a]||[],null)};this.removedService=function(a,b){var e=a.getProperty(k),j=h[e],o=d[e];j.length>1?j.splice(j.indexOf(a),1):delete h[e];o.length>1?o.splice(o.indexOf(b),1):delete d[e]}};c=function(){function a(a,e,c){this.store=new d(this,c);this.configAdmin=new b(this,this.store);this.tracker=new f(a,e,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(a,b){this.factory=a;this.store=b}a.prototype={_init:function(){var a=this;return this.store._init().then(function(){return a})},getConfiguration:function(a){return this.store.get(a)},listConfigurations:function(){return this.store.list()}};return a}();var e="/cm/configurations";
d=function(){function a(a,b){this.factory=a;this.prefsService=b;this.configs=Object.create(null);this.pref=null;var c=this;this.initPromise=this.prefsService.getPreferences(e).then(function(a){c.pref=a;a.keys().forEach(function(b){if(!c.configs[b]){var e=a.get(b);typeof e==="object"&&e!==null&&Object.keys(e).length>0&&(e[k]=b,c.configs[b]=new h(c.factory,c,e))}})})}a.prototype={_init:function(){return this.initPromise},_find:function(a){return this.configs[a]||null},get:function(a){var b=this._find(a);
b||(b=new h(this.factory,this,a),this.configs[a]=b);return b},list:function(){var a=this,b=[];this.pref.keys().forEach(function(e){(e=a._find(e))&&e.getProperties()!==null&&b.push(e)});return b},remove:function(a){this.pref.remove(a);delete this.configs[a]},save:function(a,b){this.pref.put(a,b.getProperties(!0)||{})}};return a}();h=function(){function a(a,b){b=i.clone(b);delete b[k];a.properties=b}function b(e,c,j){this.factory=e;this.store=c;if(j!==null&&typeof j==="object")this.pid=j[k],a(this,
j);else if(typeof j==="string")this.pid=j,this.properties=null;else throw Error("Invalid pid/properties "+j);}b.prototype={_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;if(this.properties&&(b=i.clone(this.properties),!a))b[k]=this.pid;return b},remove:function(){this._checkRemoved();this.factory.notifyDeleted(this);this.store.remove(this.pid);this._removed=
!0},update:function(b){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:c}});
define("orion/bootstrap","require,orion/Deferred,orion/serviceregistry,orion/preferences,orion/pluginregistry,orion/config".split(","),function(g,l,i,f,c,d){var b;return{startup:function(){if(b)return b;b=new l;var h=new i.ServiceRegistry,k=new f.PreferencesService(h);return k.getPreferences("/plugins").then(function(e){var a={plugins:{}};e.keys().forEach(function(b){var c=g.toUrl(b);a.plugins[c]=e[b]});var j=new c.PluginRegistry(h,a);return j.start().then(function(){if(h.getServiceReferences("orion.core.preference.provider").length>
0)return k.getPreferences("/plugins",k.USER_SCOPE).then(function(a){var b=[];a.keys().forEach(function(a){a=g.toUrl(a);j.getPlugin(a)||b.push(j.installPlugin(a,{autostart:"lazy"}).then(function(a){return a.update().then(function(){return a.start({lazy:!0})})}))});return l.all(b,function(a){console.log(a)})})}).then(function(){return(new d.ConfigurationAdminFactory(h,j,k)).getConfigurationAdmin().then(h.registerService.bind(h,"orion.cm.configadmin"))}).then(function(){var a=h.getService("orion.core.auth");
if(a){var b=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)})}),e=localStorage.getItem("lastLogin");if(!e||e<(new Date).getTime()-9E5)return b}}).then(function(){var a={serviceRegistry:h,preferences:k,pluginRegistry:j};b.resolve(a);return a})})}}});
(function(){function g(c,d,b,h,k,e){d[c]&&(b.push(c),(d[c]===!0||d[c]===1)&&h.push(k+c+"/"+e))}function l(c,d,b,h,k){d=h+d+"/"+k;require._fileExists(c.toUrl(d+".js"))&&b.push(d)}function i(c,d,b){for(var h in d)d.hasOwnProperty(h)&&(!c.hasOwnProperty(h)||b)?c[h]=d[h]:typeof d[h]==="object"&&i(c[h],d[h],b)}var f=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(c){var d=c.config?c.config():{};return{version:"2.0.1+",load:function(b,c,k,e){e=e||{};if(e.locale)d.locale=e.locale;
var a=f.exec(b),j=a[1],p=a[4],m=a[5],n=p.split("-"),s=[],q={},t,v="";if(a[5])j=a[1],b=j+m;else{m=a[4];p=d.locale;if(!p)p=d.locale=typeof navigator==="undefined"?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase();n=p.split("-")}if(e.isBuild){s.push(b);l(c,"root",s,j,m);for(t=0;t<n.length;t++)e=n[t],v+=(v?"-":"")+e,l(c,v,s,j,m);c(s,function(){k()})}else c([b],function(a){var b=[],e;g("root",a,b,s,j,m);for(t=0;t<n.length;t++)e=n[t],v+=(v?"-":"")+e,g(v,a,b,s,j,m);c(s,function(){var e,
o,d;for(e=b.length-1;e>-1&&b[e];e--){d=b[e];o=a[d];if(o===!0||o===1)o=c(j+d+"/"+m);i(q,o)}k(q)})})}}})})();
define("orion/i18n",[],function(){return{load:function(g,l,i,f){var f=f||{},c=/(^.*(?:^|\/)nls(?:\/|$))([^\/]*)\/?([^\/]*)/,d=c.exec(g);if(d){if(!l.defined||l.defined(g))try{i(l(g));return}catch(b){}if(f.isBuild||f.isTest)i({});else{var h=d[1],k=d[3]?d[2]:"",e=d[3]||d[2];l(["orion/bootstrap"],function(a){a.startup().then(function(a){var b=a.serviceRegistry,a=b.getServiceReferences("orion.i18n.message");if(k)a.some(function(a){return g===a.getProperty("name")?(b.getService(a).getMessageBundle().then(function(a){i(a)},
function(){i({})}),!0):!1})||i({});else{var m={},n;a.forEach(function(a){var b=a.getProperty("name");if((d=c.exec(b))&&h===d[1]&&e===(d[3]||d[2]))if(k=d[3]?d[2]:""){if((a=f.locale||(typeof navigator!=="undefined"?navigator.language||navigator.userLanguage:null))&&a.toLowerCase().indexOf(k.toLowerCase())===0)m[k]=!0,(!l.specified||!l.specified(b))&&define(b,["orion/i18n!"+b],function(a){return a})}else n=a});!l.specified||!l.specified(g)?n?b.getService(n).getMessageBundle().then(function(a){Object.keys(m).forEach(function(b){typeof a[b]===
"undefined"&&(a[b]=m[b])});define(g,[],a);i(a)},function(){define(g,[],m);i(m)}):(define(g,[],m),i(m)):i(m)}})})}}else i(null)}}});
define("orion/edit/nls/root/messages",{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.",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}",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",ViewTooltip:"View",Actions:"Actions",Navigator:"Navigator",FolderNavigator:"Folder Navigator",
Project:"Project",New:"New",Add:"Add",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}.",ChooseFS:"Choose Filesystem",ChooseFSTooltip:"Choose the filesystem you want to view.",FSTitle:"${0} (${1})"});
define("orion/edit/nls/messages",["orion/i18n!orion/edit/nls/messages","orion/edit/nls/root/messages"],function(g,l){var i={root:l};Object.keys(g).forEach(function(f){typeof i[f]==="undefined"&&(i[f]=g[f])});return i});
define("orion/util",[],function(){var g=navigator.userAgent,l=g.indexOf("MSIE")!==-1||g.indexOf("Trident")!==-1?document.documentMode:void 0,i=parseFloat(g.split("Firefox/")[1]||g.split("Minefield/")[1])||void 0,f=g.indexOf("Opera")!==-1,c=parseFloat(g.split("Chrome/")[1])||void 0,d=g.indexOf("Safari")!==-1&&!c,b=parseFloat(g.split("WebKit/")[1])||void 0,h=g.indexOf("Android")!==-1,k=g.indexOf("iPad")!==-1,g=g.indexOf("iPhone")!==-1,e=k||g,a=navigator.platform.indexOf("Mac")!==-1,j=navigator.platform.indexOf("Win")!==
-1,p=navigator.platform.indexOf("Linux")!==-1;return{formatMessage:function(a){var b=arguments;return a.replace(/\$\{([^\}]+)\}/g,function(a,e){return b[(e<<0)+1]})},createElement:function(a,b){return a.createElementNS?a.createElementNS("http://www.w3.org/1999/xhtml",b):a.createElement(b)},isIE:l,isFirefox:i,isOpera:f,isChrome:c,isSafari:d,isWebkit:b,isAndroid:h,isIPad:k,isIPhone:g,isIOS:e,isMac:a,isWindows:j,isLinux:p,platformDelimiter:j?"\r\n":"\n"}});
define("orion/webui/littlelib",["orion/util"],function(g){function l(b,c){c||(c=document);return c.querySelectorAll(b)}function i(b){if(b.tabIndex>=0)return b;if(b.hasChildNodes())for(var c=0;c<b.childNodes.length;c++){var e=i(b.childNodes[c]);if(e)return e}return null}function f(b){if(b.tabIndex>=0)return b;if(b.hasChildNodes())for(var c=b.childNodes.length-1;c>=0;c--){var e=f(b.childNodes[c]);if(e)return e}return null}function c(b,k){if(b.nodeType===3){var e=d.exec(b.nodeValue);e&&e.length>1&&k(b,
e)}if(b.hasChildNodes())for(e=0;e<b.childNodes.length;e++)c(b.childNodes[e],k)}var d=/\$\{([^\}]+)\}/,b=null;return{$:function(b,c){c||(c=document);return c.querySelector(b)},$$:l,$$array:function(b,c){return Array.prototype.slice.call(l(b,c))},node:function(b){var c=b;typeof b==="string"&&(c=document.getElementById(b));return c},contains:function(b,c){if(!b||!c)return!1;if(b===c)return!0;var e=b.compareDocumentPosition(c);return Boolean(e&16)},bounds:function(b){b=b.getBoundingClientRect();return{left:b.left+
document.body.scrollLeft,top:b.top+document.body.scrollTop,width:b.width,height:b.height}},empty:function(b){for(;b.hasChildNodes();)b.removeChild(b.firstChild)},firstTabbable:i,lastTabbable:f,stop:function(b){if(window.document.all)b.keyCode=0;b.preventDefault&&(b.preventDefault(),b.stopPropagation())},processTextNodes:function(b,d){c(b,function(b,a){b.parentNode.replaceChild(document.createTextNode(d[a[1]]||a[1]),b)})},processDOMNodes:function(b,d){c(b,function(b,a){var c=d[a[1]];if(c){var h=document.createRange(),
f=a.index;h.setStart(b,f);h.setEnd(b,f+a[0].length);h.deleteContents();h.insertNode(c)}})},addAutoDismiss:function(c,d){function e(a){b.forEach(function(b){var e=!1,c=b.excludeNodes.some(function(b){return document.body.contains(b)?(e=!0,b.contains(a.target)):!1});if(e&&!c)try{b.dismiss()}catch(h){typeof console!=="undefined"&&console&&console.error(h&&h.message)}});b=b.filter(function(a){return a.excludeNodes.some(function(a){return document.body.contains(a)})})}b===null&&(b=[],document.addEventListener("click",
e,!0),g.isIOS&&document.addEventListener("touchend",function(a){function b(){a.target.removeEventListener("click",b)}a.touches.length===0&&a.target.addEventListener("click",b)},!1));b.push({excludeNodes:c,dismiss:d})},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("orion/webui/dropdown",["require","orion/webui/littlelib"],function(g,l){function i(f){this._init(f)}i.prototype={_init:function(f){this._dropdownNode=l.node(f.dropdown);if(!this._dropdownNode)throw"no dom node for dropdown found";this._triggerNode=l.$(".dropdownTrigger",this._dropdownNode.parentNode);if(!this._triggerNode)throw"no dom node for dropdown trigger found";this._populate=f.populate;this._selectionClass=f.selectionClass;var c=this;this._triggerNode.addEventListener("click",function(d){c.toggle()&&
l.stop(d)},!1);this._triggerNode.tagName.toLowerCase()==="span"&&this._triggerNode.addEventListener("keydown",function(d){if(d.keyCode===l.KEY.ENTER||d.keyCode===l.KEY.SPACE)c.toggle(),l.stop(d)},!1);this._dropdownNode.addEventListener("keydown",this._dropdownKeyDown.bind(this),!1)},toggle:function(){return this.isVisible()?this.close():this.open()},isVisible:function(){return this._triggerNode.classList.contains("dropdownTriggerOpen")},open:function(){if(!this.isVisible()){this._populate&&(this.empty(),
this._populate(this._dropdownNode));var f=this.getItems();if(f.length>0){if(!this._hookedAutoDismiss){var c=l.$$(".dropdownSubMenu",this._dropdownNode);l.addAutoDismiss([this._triggerNode].concat(Array.prototype.slice.call(c)),function(){if(this.isVisible()){this.close();for(var c=this._dropdownNode.parentNode;c;)c.dropdown&&typeof c.dropdown.close==="function"&&c.dropdown.close(),c=c.parentNode}}.bind(this));this._hookedAutoDismiss=!0}this._triggerNode.classList.add("dropdownTriggerOpen");this._selectionClass&&
this._triggerNode.classList.add(this._selectionClass);this._dropdownNode.classList.add("dropdownMenuOpen");this._positionDropdown();f[0].focus();return!0}return!1}},_positionDropdown:function(){this._dropdownNode.style.left="";var f=l.bounds(this._dropdownNode),c=l.bounds(document.body);if(f.left+f.width>c.left+c.width)if(this._triggerNode.classList.contains("dropdownMenuItem"))this._dropdownNode.style.left=-f.width+"px";else{var c=l.bounds(this._boundingNode(this._triggerNode)),d=l.bounds(this._triggerNode);
this._dropdownNode.style.left=d.left-c.left-f.width+d.width+"px"}},_boundingNode:function(f){var c=window.getComputedStyle(f,null);return c===null?f:c.getPropertyValue("position")==="absolute"||!f.parentNode||f===document.body?f:this._boundingNode(f.parentNode)},close:function(f){if(this.isVisible())return this._triggerNode.classList.remove("dropdownTriggerOpen"),this._selectionClass&&this._triggerNode.classList.remove(this._selectionClass),this._dropdownNode.classList.remove("dropdownMenuOpen"),
f&&this._triggerNode.focus(),!0},getItems:function(){var f=[],c=this;l.$$array("li:not(.dropdownSeparator) > .dropdownMenuItem",this._dropdownNode,!0).forEach(function(d){d.parentNode.parentNode===c._dropdownNode&&f.push(d)});return f},empty:function(){var f=this;l.$$array("li",this._dropdownNode).forEach(function(c){c.parentNode===f._dropdownNode&&c.parentNode.removeChild(c)})},_dropdownKeyDown:function(f){if(f.keyCode===l.KEY.UP||f.keyCode===l.KEY.DOWN||f.keyCode===l.KEY.RIGHT||f.keyCode===l.KEY.ENTER||
f.keyCode===l.KEY.LEFT){var c=this.getItems(),d=document.activeElement;if(c.length&&c.length>0&&d){var b=c.indexOf(d);b<0&&(b=c.indexOf(d.parentNode));b>=0&&(f.keyCode===l.KEY.UP&&b>0?(b--,c[b].focus()):f.keyCode===l.KEY.DOWN&&b<c.length-1?(b++,c[b].focus()):f.keyCode===l.KEY.ENTER||f.keyCode===l.KEY.RIGHT?d.classList.contains("dropdownTrigger")&&d.dropdown&&d.dropdown.open():f.keyCode===l.KEY.LEFT&&d.parentNode.parentNode.classList.contains("dropdownMenuOpen")&&this.close(!0),l.stop(f))}}else f.keyCode===
l.KEY.ESCAPE&&(this.close(!0),l.stop(f))}};i.prototype.constructor=i;return{Dropdown:i}});
define("text",["module"],function(g){var l,i,f=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],c=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,d=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,b=typeof location!=="undefined"&&location.href,h=b&&location.protocol&&location.protocol.replace(/\:/,""),k=b&&location.hostname,e=b&&(location.port||void 0),a=[],j=g.config&&g.config()||{};l={version:"2.0.5",strip:function(a){if(a){var a=a.replace(c,""),b=a.match(d);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:j.createXhr||function(){var a,b,e;if(typeof XMLHttpRequest!=="undefined")return new XMLHttpRequest;else if(typeof ActiveXObject!=="undefined")for(b=0;b<3;b+=1){e=f[b];try{a=new ActiveXObject(e)}catch(c){}if(a){f=[e];break}}return a},parseName:function(a){var b,
e,c=!1,j=a.indexOf(".");b=a.indexOf("./")===0||a.indexOf("../")===0;j!==-1&&(!b||j>1)?(b=a.substring(0,j),e=a.substring(j+1,a.length)):b=a;a=e||b;j=a.indexOf("!");j!==-1&&(c=a.substring(j+1)==="strip",a=a.substring(0,j),e?e=a:b=a);return{moduleName:b,ext:e,strip:c}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(a,b,e,c){var j,h;j=l.xdRegExp.exec(a);if(!j)return!0;a=j[2];j=j[3];j=j.split(":");h=j[1];j=j[0];return(!a||a===b)&&(!j||j.toLowerCase()===e.toLowerCase())&&(!h&&!j||h===c)},finishLoad:function(b,
e,c,h){c=e?l.strip(c):c;j.isBuild&&(a[b]=c);h(c)},load:function(a,c,d,f){if(f.isBuild&&!f.inlineText)d();else{j.isBuild=f.isBuild;var q=l.parseName(a),f=q.moduleName+(q.ext?"."+q.ext:""),i=c.toUrl(f),g=j.useXhr||l.useXhr;!b||g(i,h,k,e)?l.get(i,function(b){l.finishLoad(a,q.strip,b,d)},function(a){d.error&&d.error(a)}):c([f],function(a){l.finishLoad(q.moduleName+"."+q.ext,q.strip,a,d)})}},write:function(b,e,c){if(a.hasOwnProperty(e)){var j=l.jsEscape(a[e]);c.asModule(b+"!"+e,"define(function () { return '"+
j+"';});\n")}},writeFile:function(a,b,e,c,j){var b=l.parseName(b),h=b.ext?"."+b.ext:"",d=b.moduleName+h,k=e.toUrl(b.moduleName+h)+".js";l.load(d,e,function(){var b=function(a){return c(k,a)};b.asModule=function(a,b){return c.asModule(a,k,b)};l.write(a,d,b,j)},j)}};if(j.env==="node"||!j.env&&typeof process!=="undefined"&&process.versions&&process.versions.node)i=require.nodeRequire("fs"),l.get=function(a,b){var e=i.readFileSync(a,"utf8");e.indexOf("\ufeff")===0&&(e=e.substring(1));b(e)};else if(j.env===
"xhr"||!j.env&&l.createXhr())l.get=function(a,b,e,c){var h=l.createXhr(),d;h.open("GET",a,!0);if(c)for(d in c)c.hasOwnProperty(d)&&h.setRequestHeader(d.toLowerCase(),c[d]);if(j.onXhr)j.onXhr(h,a);h.onreadystatechange=function(){var c;if(h.readyState===4)c=h.status,c>399&&c<600?(c=Error(a+" HTTP status: "+c),c.xhr=h,e(c)):b(h.responseText)};h.send(null)};else if(j.env==="rhino"||!j.env&&typeof Packages!=="undefined"&&typeof java!=="undefined")l.get=function(a,b){var e,c,j=new java.io.File(a),h=java.lang.System.getProperty("line.separator"),
j=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(j),"utf-8")),d="";try{e=new java.lang.StringBuffer;(c=j.readLine())&&c.length()&&c.charAt(0)===65279&&(c=c.substring(1));for(e.append(c);(c=j.readLine())!==null;)e.append(h),e.append(c);d=String(e.toString())}finally{j.close()}b(d)};return l});define("text!orion/webui/dropdowntriggerbutton.html",[],function(){return'<button class="dropdownTrigger">${ButtonText}<span class="dropdownArrowDown core-sprite-downarrow"></span></button><ul class="dropdownMenu"></ul>'});
define("text!orion/webui/submenutriggerbutton.html",[],function(){return'<li class="dropdownSubMenu"><span class="dropdownTrigger dropdownMenuItem" role="menuitem" tabindex="0">${ButtonText}<span class="dropdownArrowRight core-sprite-closedarrow"></span></span><ul class="dropdownMenu"></ul></li>'});define("text!orion/webui/checkedmenuitem.html",[],function(){return'<li><label class="dropdownMenuItem"><input class="checkedMenuItem" role="menuitem" type="checkbox" />${ItemText}</label></li>'});
define("orion/webui/tooltip",["require","orion/webui/littlelib"],function(g,l){function i(f){this._init(f)}i.prototype={_init:function(f){this._node=l.node(f.node);if(!this._node)throw"no dom node for tooltip found";this._position=f.position||["right","above","below","left"];this._text=f.text;this._hideDelay=f.hideDelay===void 0?200:f.hideDelay;this._tailSize=f.tailSize||10;this._trigger=f.trigger||"mouseover";this._afterShowing=f.afterShowing;this._afterHiding=f.afterHiding;var c=this;if(this._trigger===
"click")this._showDelay=0,this._node.addEventListener("click",this._clickHandler=function(b){b.target===c._node&&(c.show(),l.stop(b))},!1);else if(this._trigger==="mouseover"){this._showDelay=f.showDelay===void 0?500:f.showDelay;f=["mouseout","click"];this._node.addEventListener("mouseover",this._mouseoverHandler=function(b){l.contains(c._node,b.target)&&(c.show(),l.stop(b))},!1);this._leaveHandler=function(b){l.contains(c._node,b.target)&&c.hide()};for(var d=0;d<f.length;d++)this._node.addEventListener(f[d],
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),this._tipTextContent.appendChild(document.createTextNode(this._text));this._tip.appendChild(this._tipInner);
document.body.appendChild(this._tip);var f=this;l.addAutoDismiss([this._tip,this._node],function(){f.hide()});if(this._trigger==="mouseover")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(){if(f._timeout)window.clearTimeout(f._timeout),f._timeout=null;f._tip.addEventListener("mouseout",function(c){l.contains(f._tip,c.target)&&(f.hide(),l.stop(c))},
!1)},!1)}return this._tip},_positionTip:function(f,c){this._makeTipNode();f==="left"?this._tipInner.classList.add("left"):this._tipInner.classList.remove("left");var d=this._node,b;for(b=l.bounds(d);d&&!b.width&&!b.height;d=d.parentNode)b=l.bounds(d);var d=l.bounds(this._tipInner),h;switch(f){case "above":h=b.top-d.height-this._tailSize-1;b=b.left-this._tailSize;break;case "below":h=b.top+b.height+this._tailSize+1;b=b.left-this._tailSize;break;case "left":h=b.top-this._tailSize/2;b=b.left-d.width-
this._tailSize-1;break;default:h=b.top-this._tailSize/2,b=b.left+b.width+this._tailSize+1}var k=l.bounds(document.documentElement);if(h+d.height>k.height)if(c)h=k.height-d.height-1;else return!1;if(b+d.width>k.width)if(c)b=k.width-d.width-1;else return!1;if(b<0)if(c)b=4;else return!1;if(h<0)if(c)h=4;else return!1;if(!this._tail&&(this._tail=document.createElement("span"),this._tail.classList.add("tooltipTailFrom"+f),f==="above"||f==="left"?this._tip.appendChild(this._tail):this._tip.insertBefore(this._tail,
this._tipInner),f==="left"))this._tail.style.left=d.width+"px";this._tip.style.top=h+"px";this._tip.style.left=b+"px";return!0},contentContainer:function(){this._makeTipNode();return this._tipInner},show:function(){if(!this._tip||!this._tip.classList.contains("tooltipShowing")){var f=this;if(this._timeout)window.clearTimeout(this._timeout),this._timeout=null;this._timeout=window.setTimeout(function(){for(var c=!1,d=0;!c&&d<f._position.length;)c=f._positionTip(f._position[d]),d++;c||f._positionTip(f._position[0],
!0);f._tip.classList.add("tooltipShowing");f._afterShowing&&f._afterShowing()},this._showDelay)}},hide:function(f){if(this._timeout)window.clearTimeout(this._timeout),this._timeout=null;if(this._tip&&this._tip.classList.contains("tooltipShowing")){if(f===void 0)f=this._hideDelay;var c=this;this._timeout=window.setTimeout(function(){c._tip.classList.remove("tooltipShowing");c._tip.removeAttribute("style");c._afterHiding&&c._afterHiding()},f)}},destroy:function(){if(this._timeout)window.clearTimeout(this._timeout),
this._timeout=null;if(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 f=["mouseout","click"],c=0;c<f.length;c++)this._node.removeEventListener(f[c],this._leaveHandler,!1)}}};i.prototype.constructor=i;return{Tooltip:i}});
define("orion/commands","require,orion/util,orion/webui/littlelib,orion/webui/dropdown,text!orion/webui/dropdowntriggerbutton.html,text!orion/webui/submenutriggerbutton.html,text!orion/webui/checkedmenuitem.html,orion/webui/tooltip".split(","),function(g,l,i,f,c,d,b,h){function k(a){var b=a.invocation;if(b){var e=a.command;if(e.hrefCallback)return a=e.hrefCallback.call(b.handler||window,b),a.then?a.then(function(a){window.open(a)}):window.open(a),!0;else if(b.commandRegistry)return b.commandRegistry._invoke(b),
!0;else if(e.onClick||e.callback)return window.setTimeout(function(){(e.onClick||e.callback).call(b.handler||window,b)},0),!0}return!1}function e(a,b){for(var e in b)if(b[e]&&b[e].keyBinding&&b[e].command&&b[e].keyBinding.match(a)){var c=b[e],j=c.keyBinding;if((!j.domScope||i.contains(i.node(j.domScope),a.target))&&k(c)){i.stop(a);break}}}function a(a,b,e){b.classList.add("commandImage");var c;a.imageClass?a.addImageClassToElement?b.classList.add(a.imageClass):(c=document.createElement("span"),b.appendChild(c),
c.classList.add(a.spriteClass),c.classList.add(a.imageClass)):(c=new Image,c.alt=a.name,c.name=e,c.id=e,c.src=a.image,b.appendChild(c));return c}function j(a,b,e,c,j){this.commandRegistry=j;this.handler=a;this.items=b;this.userData=e;this.command=c;if(c.parameters)this.parameters=c.parameters.makeCopy();this.id=c.id}function p(a){this._init(a)}var m=null,n={};window.document.addEventListener("keydown",function(a){a=a||window.event;if(function(a){if(l.isMac){if(a.metaKey&&!a.altKey)return!a.shiftKey&&
!a.ctrlKey&&(a.keyCode===65||a.keyCode===67||a.keyCode===86||a.keyCode===88||a.keyCode===90)?!0:!1}else{if(a.ctrlKey&&!a.altKey)return!a.shiftKey&&(a.keyCode===65||a.keyCode===67||a.keyCode===86||a.keyCode===88||a.keyCode===90)?!0:!1;if(a.altKey&&!a.ctrlKey)return!1}if(a["char"])return a["char"].length>0;else if(a.charCode||a.keyCode)switch(a=a.charCode||a.keyCode,a){case 8:case 9:case 13:case 46:return!0;default:return a>=32&&a<112||a>123}return!1}(a)){if(a.target.contentEditable==="true")return;
var b=a.target.nodeName.toLowerCase();if(b==="input")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(b==="textarea")return}b={};if(m){var c,j,h;j=Object.keys(n);for(c=0;c<j.length;c++)h=j[c],b[h]=n[h];var d=m();j=Object.keys(d);for(c=0;c<j.length;c++)h=j[c],b[h]=d[h]}else b=n;e(a,b)},!1);j.prototype=
{collectsParameters:function(){return this.commandRegistry&&this.commandRegistry.collectsParameters()},makeCopy:function(a){var b=new j(this.handler,this.items,this.userData,this.command,this.commandRegistry);b.domNode=this.domNode;b.domParent=this.domParent;if(a)b.parameters=a.makeCopy();else if(this.parameters)b.parameters=this.parameters.makeCopy();return b}};j.prototype.constructor=j;p.prototype={_init:function(a){this.id=a.id;this.name=a.name;this.tooltip=a.tooltip||a.name;this.callback=a.callback;
this.hrefCallback=a.hrefCallback;this.choiceCallback=a.choiceCallback;this.image=a.image||g.toUrl("images/none.png");this.imageClass=a.imageClass;this.addImageClassToElement=a.addImageClassToElement;this.selectionClass=a.selectionClass;this.spriteClass=a.spriteClass||"commandSprite";this.visibleWhen=a.visibleWhen;this.parameters=a.parameters},populateChoicesMenu:function(a,b,e,c,j){this.getChoices(b,e,c).forEach(function(e){if(e.name){var c=document.createElement("li");a.appendChild(c);var h=document.createElement("span");
h.tabIndex=0;h.role="menuitem";h.classList.add("dropdownMenuItem");var d=document.createTextNode(e.name);h.appendChild(d);c.appendChild(h);h.choice=e;h.addEventListener("click",function(a){a.target.choice&&a.target.choice.callback.call(a.target.choice,b)},!1);h.addEventListener("keydown",function(a){(a.keyCode===i.KEY.ENTER||a.keyCode===i.KEY.SPACE)&&a.target.choice&&a.target.choice.callback.call(a.target.choice,b)},!1)}else j._generateMenuSeparator(a)})},getChoices:function(a,b,e){return this.choiceCallback?
this.choiceCallback.call(b,a,e):null},makeChoiceCallback:function(a,b){return function(e){a.callback&&a.callback.call(a,b,e)}},hasImage:function(){return this.imageClass||this.image!==g.toUrl("images/none.png")}};p.prototype.constructor=p;return{Command:p,CommandInvocation:j,createDropdownMenu:function(b,e,j,h,d,k,o){b=i.node(b);if(!b)throw"no parent node was specified";var r=document.createRange();r.selectNode(b);r=r.createContextualFragment(c);i.processTextNodes(r,{ButtonText:e});b.appendChild(r);
b=b.lastChild;r=b.previousSibling;h?r.classList.add(h):(r.classList.add("orionButton"),r.classList.add("commandButton"));if(d){if(!k)r.textContent="",r.setAttribute("aria-label",e);a({spriteClass:"commandSprite",imageClass:d},r,e);r.classList.add("orionButton")}r.dropdown=new f.Dropdown({dropdown:b,populate:j,selectionClass:o});b.dropdown=r.dropdown;return{menuButton:r,menu:b,dropdown:r.dropdown}},createCheckedMenuItem:function(a,e,c,j){a=i.node(a);if(!a)throw"no parent node was specified";var h=
document.createRange();h.selectNode(a);h=h.createContextualFragment(b);i.processTextNodes(h,{ItemText:e});a.appendChild(h);a=i.$(".checkedMenuItem",a.lastChild);a.checked=c;a.addEventListener("change",j,!1);return a},createCommandItem:function(b,e,c,j,d,k,o){var r,k=k||!e.name&&e.hasImage();if(e.hrefCallback)r=document.createElement("a"),r.id=j,k&&e.hasImage()?a(e,r,j):(r.className="commandLink",r.appendChild(document.createTextNode(e.name))),o=e.hrefCallback.call(c.handler,c),o.then?o.then(function(a){r.href=
a}):r.href=o?o:"#";else{r=document.createElement("button");r.className="orionButton";k?e.hasImage()?(a(e,r,j),e.name&&r.setAttribute("aria-label",e.name)):(r.classList.add("commandButton"),r.classList.add("commandMissingImageButton"),r.appendChild(document.createTextNode(e.name))):(r.classList.add("commandButton"),j=document.createTextNode(e.name),r.appendChild(j));var f=o||e.callback;if(f)e.onClick=f,r.addEventListener("click",function(){f.call(c.handler,c)},!1)}b.nodeName.toLowerCase()==="ul"?(o=
document.createElement("li"),b.appendChild(o),b=o):r.classList.add("commandMargins");b.appendChild(r);if(e.tooltip)r.commandTooltip=new h.Tooltip({node:r,text:e.tooltip,position:["above","below","right","left"]});d&&(n[e.id]={keyBinding:d,command:e,invocation:c});return r},createCommandMenuItem:function(a,b,e,c,j){var d,o=a.dropdown;if(b.hrefCallback)d=document.createElement("a"),d.appendChild(document.createTextNode(b.name)),j=b.hrefCallback.call(e.handler,e),j.then?j.then(function(a){d.href=a}):
d.href=j?j:"#",d.addEventListener("keydown",function(a){(a.keyCode===i.KEY.ENTER||a.keyCode===i.KEY.SPACE)&&d.click()},!1);else{d=document.createElement("span");d.tabIndex=0;d.appendChild(document.createTextNode(b.name));var r=j||b.callback;if(r)b.onClick=r,d.addEventListener("click",function(){o.close(!0);r.call(e.handler,e)},!1),d.addEventListener("keydown",function(a){if(a.keyCode===i.KEY.ENTER||a.keyCode===i.KEY.SPACE)a.preventDefault(),d.click()},!1)}if(b.tooltip)d.commandTooltip=new h.Tooltip({node:d,
text:b.tooltip,position:["right","left","above","below"]});d.className="dropdownMenuItem";d.role="menuitem";j=document.createElement("li");a.appendChild(j);j.appendChild(d);c&&(n[b.id]={keyBinding:c,command:b,invocation:e});return d},executeBinding:k,setKeyBindingProvider:function(a){m=a},localKeyBindings:n,_testMethodProcessKey:e}});
define("orion/nls/root/messages",{Navigator:"Navigator",Sites:"Sites",Shell:"Shell","Get Plugins":"Get Plugins",Global:"Global",Editor:"Editor","Filter bindings":"Filter bindings","Orion Editor":"Orion 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.":"I20131030-1703","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","Saved searches":"Saved searches","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.",Raw:"Raw","Open the raw file or folder in the browser":"Open the raw file or folder in the browser",OutlineProgress:"Getting outline for ${0} from ${1}",UnknownError:"An unknown error occurred.",UnknownWarning:"An unknown warning occurred."});
define("orion/nls/messages",["orion/i18n!orion/nls/messages","orion/nls/root/messages"],function(g,l){var i={root:l};Object.keys(g).forEach(function(f){typeof i[f]==="undefined"&&(i[f]=g[f])});return i});
define("orion/uiUtils",["i18n!orion/nls/messages","orion/webui/littlelib"],function(g,l){function i(c){var d="",b=navigator.platform.indexOf("Mac")!==-1;c.mod1&&(d+=b?"Cmd+":"Ctrl+");c.mod2&&(d+="Shift+");c.mod3&&(d+="Alt+");c.mod4&&b&&(d+="Ctrl+");if(c.alphaKey)return d+c.alphaKey;if(c.type==="keypress")return d+c.keyCode;for(var h in l.KEY)if(typeof(l.KEY[h]==="number")&&l.KEY[h]===c.keyCode)return d+h;var k;switch(c.keyCode){case 59:k=c.mod2?":":";";break;case 61:k=c.mod2?"+":"=";break;case 188:k=
c.mod2?"<":",";break;case 190:k=c.mod2?">":".";break;case 191:k=c.mod2?"?":"/";break;case 192:k=c.mod2?"~":"`";break;case 219:k=c.mod2?"{":"[";break;case 220:k=c.mod2?"|":"\\";break;case 221:k=c.mod2?"}":"]";break;case 222:k=c.mod2?'"':"'"}return k?d+k:c.keyCode>=112&&c.keyCode<=123?d+"F"+(c.keyCode-111):d+String.fromCharCode(c.keyCode)}function f(c){var d=window.navigator.platform.indexOf("Mac")!==-1;return d&&c.metaKey||!d&&c.ctrlKey}return{getUserKeyString:function(c){for(var d="",c=c.getKeys(),
b=0;b<c.length;b++)b!==0&&(d+=" "),d+=i(c[b]);return d},getUserText:function(c,d,b,h,k,e,a,j,f){var m=!1,a=function(a){return function(j){if(!m){var n=l.node(c),i=n.value;if(n)if(a&&j.keyCode===l.KEY.ESCAPE){if(b)d.style.display="inline";m=!0;n.parentNode.removeChild(n);e&&e()}else if(!(a&&j.keyCode!==l.KEY.ENTER)){if(i.length===0||!f&&i===h){if(b)d.style.display="inline"}else if(k(i),b&&d.parentNode)d.style.display="inline";m=!0;n.parentNode&&n.parentNode.removeChild(n);e&&e()}}}},n=document.createElement("input");
n.id=c;n.value=h||"";d.parentNode.insertBefore(n,d.nextSibling);n.classList.add("userEditBoxPrompt");if(b)d.style.display="none";n.addEventListener("keydown",a(!0),!1);n.addEventListener("blur",a(!1),!1);window.setTimeout(function(){n.focus();if(h){var a=l.node(c),b=j?h.indexOf(j):-1;if(b>0)if(a.createTextRange)a=a.createTextRange(),a.collapse(!0),a.moveStart("character",0),a.moveEnd("character",b),a.select();else if(a.setSelectionRange)a.setSelectionRange(0,b);else{if(a.selectionStart!==void 0)a.selectionStart=
0,a.selectionEnd=b}else a.select()}},0)},openInNewWindow:f,followLink:function(c,d){d&&f(d)?window.open(c):window.location=c},createButton:function(c,d){var b=document.createElement("button");b.className="orionButton commandButton commandMargins";b.addEventListener("click",function(b){d();l.stop(b)},!1);c&&b.appendChild(document.createTextNode(c));return b},createDropdownButton:function(){},isFormElement:function(c){switch(c.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/selection",["orion/EventTarget","orion/Deferred"],function(g){function l(i,f){f||(f="orion.page.selection");this._serviceRegistry=i;g.attach(this);this._serviceRegistration=i.registerService(f,this);this._selections=null}l.prototype={getSelection:function(i){var f=this._getSingleSelection();typeof i==="function"&&i(f);return f},getSelections:function(i){var f=Array.isArray(this._selections)?this._selections.slice():[];typeof i==="function"&&i(f);return f},_getSingleSelection:function(){return this._selections&&
this._selections.length>0?this._selections[0]:null},setSelections:function(i){var f=this._selections;this._selections=Array.isArray(i)?i.length>0?i.slice():null:i?[i]:null;f!==this._selections&&this.dispatchEvent({type:"selectionChanged",selection:this._getSingleSelection(),selections:this._selections})}};l.prototype.constructor=l;return{Selection:l}});
define("orion/explorers/navigationUtils",[],function(){function g(i,f){if(!l&&i)i.push({domNode:f}),f.tabIndex=-1,f.style.outline="none"}var l=navigator.userAgent.indexOf("iPad")!==-1;return{addNavGrid:function(i,f,c){i&&(i=i.getGridNavHolder(f,!0))&&g(i,c)},generateNavGrid:g,removeNavGrid:function(i,f){if(i)for(var c=0;c<i.length;c++)if(i[c].domNode===f){i.splice(c,1);break}}}});
define("orion/PageUtil",[],function(){var g=/^http[s]?/i;return{hash:function(){var g=window.location.href.split("#")[1];return g?"#"+g:""},matchResourceParameters:function(g){var g=g||window.location.toString(),i={resource:""},f=g.indexOf("#");if(f!==-1&&(g=g.substring(f+1),g.length!==0)){g=g.split(",");i.resource=decodeURIComponent(g[0]);for(f=1;f<g.length;f++){var c=/([^=]*)(=?)(.*)/.exec(g[f]),d=decodeURIComponent(c[1]||""),c=decodeURIComponent(c[3]||"");d!==""&&d!=="resource"&&(i[d]=c)}}return i},
validateURLScheme:function(l,i){var f=l;if(l.indexOf("://")===-1){var c=document.createElement("a");c.href=l;f=c.href}c=!1;return(c=i?i.some(function(c){return RegExp("^"+c+":","i").test(f)}):g.test(f))?l:(console.log("Illegal URL Scheme: '"+l+"'"),"")}}});
define("orion/commandRegistry","require,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(g,l,i,f,c,d,b,h,k,e,a){function j(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 m(a,b,e,c,j){this.name=a;this.type=b;this.label=e;this.value=c;this.lines=j||1}function n(a,b,e){this._storeParameters(a);this._hasOptionalParameters=b&&b.hasOptionalParameters;this._options=b;this.optionsRequested=!1;this.getParameters=e;this.clientCollect=b&&b.clientCollect}j.prototype={_init:function(a){this._selectionService=a.selection;var b=this;l.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 e=this._urlBindings[b].urlBinding.match(a);if(e){var c=this._urlBindings[b],j=c.command,h=c.invocation;if(h&&h.parameters&&j.callback){h.parameters.setValue(e.parameterName,e.parameterValue);var o=this;window.setTimeout(function(){o._invoke(h)},0);break}}}},findCommand:function(a){return this._commandList[a]},runCommand:function(a,b,e,c){b?(a=this._commandList[a])&&(a.visibleWhen?a.visibleWhen(b):1)&&a.callback&&this._invoke(new l.CommandInvocation(e,
b,null,a,this),c):(b=this._urlBindings[a])&&b.command&&b.command.callback&&this._invoke(b.invocation,c)},getSelectionService:function(){return this._selectionService},setParameterCollector:function(a){this._parameterCollector=a},openParameterCollector:function(a,b,e){this._parameterCollector&&(this._parameterCollector.close(),this._parameterCollector.open(a,b,e))},confirm:function(a,b,e,c,j,h){var o=!1;if(this._parameterCollector&&!j){var d=this;this._parameterCollector.close();if(this._parameterCollector.open(a,
function(a,j){var h=document.createElement("span");h.classList.add("parameterPrompt");h.textContent=b;a.appendChild(h);h=document.createElement("button");h.addEventListener("click",function(){o=!0;d._parameterCollector.close()},!1);j.appendChild(h);h.appendChild(document.createTextNode(e));h.className="dismissButton";var k=document.createElement("button");k.addEventListener("click",function(){o=!1;d._parameterCollector.close()},!1);j.appendChild(k);k.appendChild(document.createTextNode(c));k.className=
"dismissButton";return h},function(){h(o)}))return}o=window.confirm(b);h(o)},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){if(a)if(this._parameterCollector&&a.parameters&&a.parameters.hasParameters()&&(b||a.parameters.shouldCollectParameters())){var e=!1;a.parameters.updateParameters(a);
if(a.parameters.shouldCollectParameters()&&(e=this._parameterCollector.collectParameters(a),!e)){var c=new h.Tooltip({node:a.domNode,afterHiding:function(){this.destroy()},trigger:"click",position:["below","right","above","left"]}),e=c.contentContainer();e.classList.add("parameterPopup");var j=window.document.activeElement,d=this._parameterCollector.getFillFunction(a,function(){j&&j.focus();c.destroy()})(e);c.show();window.setTimeout(function(){d.focus();d.select()},0);e=!0}e||a.command.callback.call(a.handler||
window,a)}else 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){this._collectAndInvoke(a,!0)},showKeyBindings:function(a){function b(a){return function(){l.executeBinding(a)}}var e={},j,h,d=[],o;for(o in this._activeBindings)(h=this._activeBindings[o])&&h.keyBinding&&h.command&&(h.command.name||h.command.tooltip)&&d.push(h);d.sort(function(a,b){return(a.command.name||
a.command.tooltip).localeCompare(b.command.name||b.command.tooltip)});for(o=0;o<d.length;o++)h=d[o],h.keyBinding.scopeName?(e[h.keyBinding.scopeName]||(e[h.keyBinding.scopeName]=[]),e[h.keyBinding.scopeName].push(h)):(j=c.getUserKeyString(h.keyBinding),a.createItem(j,h.command.name||h.command.tooltip,b(h)));for(var r in e)e[r].length&&e[r].length>0&&(a.createHeader(r),e[r].forEach(function(e){j=c.getUserKeyString(e.keyBinding);a.createItem(j,e.command.name||e.command.tooltip,b(e))}))},addCommand:function(a){this._commandList[a.id]=
a;var b=this._pendingBindings[a.id];if(b){var e=this;b.forEach(function(b){e._addBinding(a,b.type,b.binding,b.bindingOnly)});delete this._pendingBindings[a.id]}},addCommandGroup:function(a,b,e,c,j,h,o,d,k){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});a=this._contributionsByScopeId[a];j&&(a=this._createEntryForPath(a,j));if(a[b]){if(c)a[b].title=c;if(e)a[b].position=e;if(o)a[b].imageClass=o;if(d)a[b].tooltip=d;if(k)a[b].selectionClass=k;a[b].emptyGroupMessage=h}else a[b]={title:c,
position:e,emptyGroupMessage:h,imageClass:o,tooltip:d,selectionClass:k,children:{}},a.sortedContributions=null},_createEntryForPath:function(a,b){b&&b.split("/").forEach(function(b){if(b.length>1)a[b]||(a[b]={position:0,children:{}}),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,e,c,j,h,o){this._contributionsByScopeId[a]||
(this._contributionsByScopeId[a]={});a=this._contributionsByScopeId[a];c&&(a=this._createEntryForPath(a,c));a[b]={position:e};h&&((e=this._commandList[b])?this._addBinding(e,"key",h,j):this._addPendingBinding(b,"key",h,j));o&&((e=this._commandList[b])?this._addBinding(e,"url",o,j):this._addPendingBinding(b,"url",o,j));a.sortedContributions=null},_addBinding:function(a,b,e,c){if(!a.id)throw Error("No command id: "+a);b==="key"?this._activeBindings[a.id]={command:a,keyBinding:e,bindingOnly:c}:b==="url"&&
(this._urlBindings[a.id]={command:a,urlBinding:e,bindingOnly:c})},_addPendingBinding:function(a,b,e,c){this._pendingBindings[a]=this._pendingBindings[a]||[];this._pendingBindings[a].push({type:b,binding:e,bindingOnly:c})},_checkForTrailingSeparator:function(a,b,e){var c;if(b==="tool"||b==="button")if((c=a.childNodes.length>0?a.childNodes[a.childNodes.length-1]:null)&&c.classList.contains("commandSeparator"))return e?(a.removeChild(c),!1):!0;if(b==="menu"&&(a=d.$$array("li > *",a),a.length>0&&a[a.length-
1].classList.contains("dropdownSeparator")))if(c=a[a.length-1],e)c.parentNode.parentNode.removeChild(c.parentNode);else return!0;return!1},renderCommands:function(a,b,e,c,j,h,o){if(typeof a!=="string")throw"a scope id for rendering must be specified";b=d.node(b);if(!b)throw"no parent";var k=this._contributionsByScopeId[a];if(!e&&k){var e=k.localSelectionService||this._selectionService,f=this;e&&e.getSelections(function(e){f.renderCommands(a,b,e,c,j,h)})}else k&&(this._render(this._contributionsByScopeId[a],
b,e,c,j||"button",h,o),this._checkForTrailingSeparator(b,j,!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,e,c,j,d,o){var k=a.sortedContributions;if(!k){var k=[],f=!1,p;for(p in a)if(Object.prototype.hasOwnProperty.call(a,p)){var m=a[p];if(m&&typeof m.position==="number")m.id=p,k.push(m),f=!0}if(f)k.sort(function(a,
b){return a.position-b.position}),a.sortedContributions=k}var n=0,g=this;k.forEach(function(a){var k,r;if(!a.imageClass)a.imageClass=null;if(a.children&&Object.getOwnPropertyNames(a.children).length>0){k=a.children;var f;if(j==="tool"||j==="button")if(a.title)f=g._createDropdownMenu(b,a.title,null,null,a.imageClass,a.tooltip,a.selectionClass),o&&i.generateNavGrid(o,f.menuButton),window.setTimeout(function(){g._render(a.children,f.menu,e,c,"menu",d,o);g._checkForTrailingSeparator(f.menu,"menu",!0);
if(f.menu.childNodes.length===0)if(a.emptyGroupMessage){if(!f.menuButton.emptyGroupTooltip)f.menuButton.emptyGroupTooltip=new h.Tooltip({node:f.menuButton,text:a.emptyGroupMessage,trigger:"click",position:["below","right","above","left"]})}else o&&i.removeNavGrid(o,f.menuButton),f.menu.parentNode&&f.menu.parentNode.removeChild(f.menu),f.destroyButton&&f.destroyButton.parentNode&&f.destroyButton.parentNode.removeChild(f.destroyButton);else f.menuButton.style.visibility="visible"},0);else{var p;b.childNodes.length>
0&&!g._checkForTrailingSeparator(b,j)&&(p=g.generateSeparatorImage(b));g._render(k,b,e,c,j,d,o);b.childNodes.length>0&&b.childNodes[b.childNodes.length-1]!==p&&(p=g.generateSeparatorImage(b))}else if(a.title){if(p=g._createDropdownMenu(b,a.title,!0,null,null,a.imageClass))g._render(k,p.menu,e,c,"menu",d,o),p.menu.childNodes.length===0&&p.destroyButton&&b.removeChild(p.destroyButton)}else b.childNodes.length>0&&g._generateMenuSeparator(b),g._render(k,b,e,c,j,d,o),g._generateMenuSeparator(b)}else{var w=
g._commandList[a.id];k=w?!0:!1;var m=null,m=null;if(w){r=new l.CommandInvocation(c,e,d,w,g);r.domParent=b;p=k&&(w.visibleWhen?w.visibleWhen(e):!0);if(g._activeBindings[w.id]&&g._activeBindings[w.id].keyBinding)m=g._activeBindings[w.id],m.invocation=p?r:null,m.bindingOnly&&(k=!1);if(g._urlBindings[w.id]&&g._urlBindings[w.id].urlBinding)m=g._urlBindings[w.id],m.invocation=p?r:null,m.bindingOnly&&(k=!1);k=k&&p}if(k)w.choiceCallback?(j==="tool"||j==="button"?(k=b,p=!1,b.nodeName.toLowerCase()==="ul"&&
(k=document.createElement("li"),b.appendChild(k))):(k=b,p=!0),g._createDropdownMenu(k,w.name,p,function(a){w.populateChoicesMenu(a,e,c,d,g)}.bind(w),w.imageClass,w.tooltip||w.title,w.selectionClass)):(r.handler=r.handler||this,r.domParent=b,p=function(){g._invoke(r)},j==="menu"?k=l.createCommandMenuItem(b,w,r,null,p):(k=j+w.id+n,k=l.createCommandItem(b,w,r,k,null,j==="tool",p)),i.generateNavGrid(o,k),r.domNode=k,n++)}})},_createDropdownMenu:function(e,c,j,k,f,p,o){e=d.node(e);if(!e||!d.contains(document.body,
e))return null;var r,w=e;if(j)p=document.createRange(),p.selectNode(e),p=p.createContextualFragment(a),d.processTextNodes(p,{ButtonText:c}),e.appendChild(p),r=e.lastChild,e=r.lastChild,c=e.previousSibling,c.dropdown=new b.Dropdown({dropdown:e,populate:k}),e.dropdown=c.dropdown;else if(e.nodeName.toLowerCase()==="ul"&&(w=document.createElement("li"),e.appendChild(w),r=w),e=null,f&&(e="dropdownButtonWithIcon",p=p||c),p=f?p||c:p,k=l.createDropdownMenu(w,c,k,e,f,!1,o),c=k.menuButton,e=k.menu,p)c.commandTooltip=
new h.Tooltip({node:c,text:p,position:["above","below","right","left"]});return{menuButton:c,menu:e,dropdown:c.dropdown,destroyButton:r}},_generateMenuSeparator:function(a){if(!this._checkForTrailingSeparator(a,"menu")){var b=document.createElement("li");b.classList.add("dropdownSeparator");var e=document.createElement("span");e.classList.add("dropdownSeparator");b.appendChild(e);a.appendChild(b)}},generateSeparatorImage:function(a){var b;b=a.nodeName.toLowerCase()==="ul"?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}};j.prototype.constructor=j;p.prototype={match:function(a){a=f.matchResourceParameters(a);return typeof a[this.token]!=="undefined"?(this.parameterValue=a[this.token],this):null}};p.prototype.constructor=p;m.prototype={optionsRequested:function(){return this.optionsRequested}};m.prototype.constructor=m;n.prototype={_storeParameters:function(a){this.parameterTable=
null;if(a){var b=this.parameterTable={};a.forEach(function(a){b[a.name]=a})}},updateParameters:function(a){typeof this.getParameters==="function"&&this._storeParameters(this.getParameters(a))},hasParameters:function(){return this.parameterTable!==null},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 e=this.parameterTable[a];
if(e)e.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 m(b.name,b.type,b.label,b.value,b.lines);a.push(b)});var b=new n(a,this._options,this.getParameters);b.clientCollect=this.clientCollect;return b},hasOptionalParameters:function(){return this._hasOptionalParameters}};n.prototype.constructor=n;return{CommandRegistry:j,URLBinding:p,ParametersDescription:n,
CommandParameter:m}});define("text!orion/banner/slideout.html",[],function(){return'<div id="slideContainer" class="slideParameters slideContainer">\n\t<span id="pageCommandParameters" class="layoutLeft parameters"></span>\n\t<span id="pageCommandDismiss" class="layoutRight parametersDismiss"></span>\n</div>'});
define("orion/commonHTMLFragments",["require","orion/webui/littlelib","text!orion/banner/slideout.html"],function(g,l,i){return{slideoutHTMLFragment:function(f){var c=document.createElement("div");c.innerHTML=i;var d=l.$("#slideContainer",c);d.id=f+d.id;d=l.$("#pageCommandParameters",c);d.id=f+d.id;d=l.$("#pageCommandDismiss",c);d.id=f+d.id;return c.innerHTML}}});
define("orion/section",["orion/webui/littlelib","orion/selection","orion/commandRegistry","orion/commonHTMLFragments"],function(g,l,i,f){function c(b,c){var d=this;this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._twistieSpriteClass="modelDecorationSprite";if(!c.id)throw Error("Missing required argument: id");this.id=c.id;if(!c.title)throw Error("Missing required argument: title");var e=c.useAuxStyle?["sectionWrapper","sectionWrapperAux","toolComposite"]:
["sectionWrapper","toolComposite"];this.domNode=document.createElement("div");b.appendChild(this.domNode);for(var a=0;a<e.length;a++)this.domNode.classList.add(e[a]);this.domNode.id=c.id;if(c.canHide)this.twistie=document.createElement("span"),this.twistie.classList.add("modelDecorationSprite"),this.twistie.classList.add("layoutLeft"),this.twistie.classList.add("sectionTitle"),this.domNode.style.cursor="pointer",this.domNode.appendChild(this.twistie),this.domNode.tabIndex=0,this.domNode.addEventListener("click",
function(a){(a.target===d.titleNode||a.target===d.twistie)&&d._changeExpandedState()},!1),this.domNode.addEventListener("keydown",function(a){a.keyCode===g.KEY.ENTER&&(a.target===d.domNode||a.target===d.titleNode||a.target===d.twistie)&&d._changeExpandedState()},!1);if(c.iconClass){var j=document.createElement("span");j.classList.add("sectionIcon");this.domNode.appendChild(j);(Array.isArray(c.iconClass)?c.iconClass:[c.iconClass]).forEach(function(a){j.classList.add(a)})}this.titleNode=document.createElement("div");
this.titleNode.id=c.id+"Title";this.titleNode.classList.add("sectionAnchor");this.titleNode.classList.add("sectionTitle");this.titleNode.classList.add("layoutLeft");this.domNode.appendChild(this.titleNode);this.titleNode.textContent=c.title;if(typeof c.getItemCount==="function")e=document.createElement("div"),e.classList.add("layoutLeft"),e.classList.add("sectionItemCount"),this.domNode.appendChild(e),e.textContent=c.getItemCount(this);this._progressNode=document.createElement("div");this._progressNode.id=
c.id+"Progress";this._progressNode.classList.add("sectionProgress");this._progressNode.classList.add("sectionTitle");this._progressNode.classList.add("layoutLeft");this._progressNode.style.visibility="hidden";this._progressNode.textContent="...";this.domNode.appendChild(this._progressNode);e=document.createElement("div");e.id=c.id+"FilterSearchBox";this.domNode.appendChild(e);this._toolActionsNode=document.createElement("div");this._toolActionsNode.id=c.id+"ToolActionsArea";this._toolActionsNode.classList.add("layoutRight");
this._toolActionsNode.classList.add("sectionActions");this.domNode.appendChild(this._toolActionsNode);this.actionsNode=document.createElement("div");this.actionsNode.id=c.id+"ActionArea";this.actionsNode.classList.add("layoutRight");this.actionsNode.classList.add("sectionActions");this.domNode.appendChild(this.actionsNode);this.selectionNode=document.createElement("div");this.selectionNode.id=c.id+"SelectionArea";this.selectionNode.classList.add("layoutRight");this.selectionNode.classList.add("sectionActions");
this.domNode.appendChild(this.selectionNode);c.slideout&&(e=f.slideoutHTMLFragment(c.id),a=document.createRange(),a.selectNode(this.domNode),e=a.createContextualFragment(e),this.domNode.appendChild(e));this._contentParent=document.createElement("div");this._contentParent.id=this.id+"Content";this._contentParent.role="region";this._contentParent.classList.add("sectionTable");this._contentParent.setAttribute("aria-labelledby",this.titleNode.id);b.appendChild(this._contentParent);c.content&&this.setContent(c.content);
this.hidden=c.hidden;if(typeof c.onExpandCollapse==="function")this._onExpandCollapse=c.onExpandCollapse;this._preferenceService=c.preferenceService;this._contentParent.style.display="none";if(this._preferenceService){var p=this;this._preferenceService.getPreferences("/window/views").then(function(a){a=a.get(p.id);if(a!==void 0)p.hidden=!a;if(!p.hidden)p._contentParent.style.display="block";p._updateExpandedState(!p.hidden,!1)})}else{if(!this.hidden)this._contentParent.style.display="block";this._updateExpandedState(!this.hidden,
!1)}this._commandService=c.commandService;this._lastMonitor=0;this._loading={}}function d(b){this._section=b;this._id=++b._lastMonitor}c.prototype={setTitle:function(b){this.titleNode.textContent=b},setContent:function(b){typeof b==="string"?this._contentParent.innerHTML=b:(this._contentParent.innerHTML="",this._contentParent.appendChild(b))},getContentElement:function(){return this._contentParent},createProgressMonitor:function(){return new d(this)},_setMonitorMessage:function(b,c){this._progressNode.style.visibility=
"visible";this._loading[b]=c;var d="",e;for(e in this._loading)d!==""&&(d+="\n"),d+=this._loading[e];this._progressNode.title=d},_monitorDone:function(b){delete this._loading[b];var b="",c;for(c in this._loading)b!==""&&(b+="\n"),b+=this._loading[c];this._progressNode.title=b;if(b==="")this._progressNode.style.visibility="hidden"},_changeExpandedState:function(){this.hidden?(this._contentParent.style.display="block",this.hidden=!1):(this._contentParent.style.display="none",this.hidden=!0);this._updateExpandedState(!this.hidden,
!0)},_updateExpandedState:function(b,c){var d=this.twistie,e=this.id;d&&(d.classList.add(b?this._expandImageClass:this._collapseImageClass),d.classList.remove(b?this._collapseImageClass:this._expandImageClass));this._preferenceService&&c&&this._preferenceService.getPreferences("/window/views").then(function(a){a.put(e,b)});this._onExpandCollapse&&this._onExpandCollapse(b,this)}};c.prototype.constructor=c;d.prototype={begin:function(b){this.status=b;this._section._setMonitorMessage(this.id,b)},worked:function(b){this.status=
b;this._section._setMonitorMessage(this.id,b)},done:function(b){this.status=b;this._section._monitorDone(this.id)}};d.prototype.constructor=d;return{Section:c}});
define("orion/webui/treetable",["i18n!orion/nls/messages","orion/webui/littlelib"],function(g,l){function i(f){this._init(f)}i.prototype={_init:function(f){var c=f.parent,d=this,c=l.node(c);if(!c)throw g["no parent"];if(!f.model)throw g["no tree model"];if(!f.renderer)throw g["no renderer"];this._parent=c;this._treeModel=f.model;this._renderer=f.renderer;this._showRoot=f.showRoot===void 0?!1:f.showRoot;this._indent=f.indent===void 0?16:f.indent;this._onCollapse=f.onCollapse;this._labelColumnIndex=
f.labelColumnIndex===void 0?0:f.labelColumnIndex;this._id=f.id===void 0?"treetable":f.id;this._tableStyle=f.tableStyle;this._tableElement=f.tableElement||"table";this._tableBodyElement=f.tableBodyElement||"tbody";this._tableRowElement=f.tableRowElement||"tr";this._root=this._treeModel.getRoot(function(b){d._showRoot?(b._depth=0,d._generate([b],0)):d._treeModel.getChildren(b,function(b){d.destroyed||d._generate(b,0)})})},destroy:function(){this.destroyed=!0},_generate:function(f,c){l.empty(this._parent);
var d=document.createElement("div");this._renderer.wrapperCallback&&this._renderer.wrapperCallback(d);var b=document.createElement(this._tableElement);this._renderer.tableCallback&&this._renderer.tableCallback(b);b.id=this._id;this._tableStyle&&b.classList.add(this._tableStyle);this._renderer.initTable(b,this);this._bodyElement=document.createElement(this._tableBodyElement);this._renderer.bodyCallback&&this._renderer.bodyCallback(this._bodyElement);this._bodyElement.id=this._id+"tbody";f.length===
0?this._renderer.emptyCallback&&this._renderer.emptyCallback(this._bodyElement):this._generateChildren(f,c);b.appendChild(this._bodyElement);d.appendChild(b);this._parent.appendChild(d);this._rowsChanged()},_generateChildren:function(f,c,d){for(var b=0;b<f.length;b++){var h=document.createElement(this._tableRowElement);h.id=this._treeModel.getId(f[b]);this._renderer.rowCallback&&this._renderer.rowCallback(h);h._depth=c;h._item=f[b];this._renderer.render(f[b],h);h.childNodes[this._labelColumnIndex].style.paddingLeft=
this._indent*c+"px";d?(this._bodyElement.insertBefore(h,d.nextSibling),d&&(d=h)):this._bodyElement.appendChild(h)}},_rowsChanged:function(){this._renderer.rowsChanged&&this._renderer.rowsChanged()},getSelected:function(){return this._renderer.getSelected()},refresh:function(f,c,d){var b=this._treeModel.getId(f),h;if(b===this._id)this._removeChildRows(b),this._generateChildren(c,0),this._rowsChanged();else{var k=l.node(b);k?(k._item=f,k&&(d||k._expanded)?(this._removeChildRows(b),this._renderer.updateExpandVisuals(k,
!0),c?(k._expanded=!0,this._generateChildren(c,k._depth+1,k),this._rowsChanged()):(h=this,c=this._treeModel.getChildren(k._item,function(b){if(!h.destroyed&&!k._expanded)k._expanded=!0,h._generateChildren(b,k._depth+1,k),h._rowsChanged()}))):this._renderer.updateExpandVisuals(k,!1)):console.log(g["could not find table row "]+b)}},getItem:function(f){var c=l.node(f);return c&&c._item?c._item:f},toggle:function(f){var c=l.node(f);c&&(c._expanded?(this.collapse(f),this._renderer.updateExpandVisuals(c,
!1)):(this.expand(f),this._renderer.updateExpandVisuals(c,!0)))},isExpanded:function(f){f=typeof f==="string"?f:this._treeModel.getId(f);return(f=l.node(f))?f._expanded:!1},expand:function(f,c,d){var f=typeof f==="string"?f:this._treeModel.getId(f),b=l.node(f);if(b&&!b._expanded){var h=this;this._renderer.updateExpandVisuals(b,!0);this._treeModel.getChildren(b._item,function(k){if(!h.destroyed){if(!b._expanded)b._expanded=!0,h._generateChildren(k,b._depth+1,b),h._rowsChanged();c&&c.apply(h,d)}})}},
_removeChildRows:function(f){for(var c=f===this._id,d=!1,b=-1,h=[],k=l.$$array(".treeTableRow",this._parent),e=0;e<k.length;e++){var a=k[e];if(d)break;if(c)a._depth>b?h.push(a):d=!0;else if(a.id===f)c=!0,b=a._depth}for(f=0;f<h.length;f++)c=h[f],c.parentNode.removeChild(c)},collapse:function(f){var f=typeof f==="string"?f:this._treeModel.getId(f),c=l.node(f);if(c){if(!c._expanded)return;c._expanded=!1;this._renderer.updateExpandVisuals(c,!1);this._removeChildRows(f);this._rowsChanged()}this._onCollapse&&
this._onCollapse(c._item)}};i.prototype.constructor=i;return{TableTree:i}});
define("orion/treeModelIterator",[],function(){var g={};g.TreeModelIterator=function(){function g(i,f){this.firstLevelChildren=i;this.reset();this._init(f)}g.prototype={_init:function(i){if(i)this.isExpanded=i.isExpanded,this.isExpandable=i.isExpandable,this.forceExpandFunc=i.forceExpandFunc,this.getChildrenFunc=i.getChildrenFunc},topLevel:function(i){return i.parent?i.parent===this.root:!0},_getChildren:function(i){return typeof this.getChildrenFunc==="function"?this.getChildrenFunc(i):i?i.children:
null},_expanded:function(i){if(!i)return!0;var f=this._getChildren(i),f=f&&f.length>0;this.isExpanded&&f&&(f=this.isExpanded(i));return f},_expandable:function(i){return!i?!0:this.isExpandable?this.isExpandable(i):!1},_diveIn:function(i){return this._expanded(i)?(this.setCursor(this._getChildren(i)[0]),this.cursor()):null},_drillToLast:function(i){return this._expanded(i)?(i=this._getChildren(i),this._drillToLast(i[i.length-1])):i},_forward:function(i){if(!this._cursor)return null;var f=this._diveIn(this._cursor);
if(!f){if(i&&this._expandable(this._cursor)&&this.forceExpandFunc){var c=this;return this.forceExpandFunc(this._cursor,"first",function(d){d&&c.setCursor(d)})}(f=this._findSibling(this._cursor,!0))&&this.setCursor(f)}return f},_backward:function(i){if(!this._cursor)return null;var f=this._findSibling(this._cursor,!1);f&&f!==this._cursor.parent&&(f=this._drillToLast(f));if(i&&f&&this._expandable(f)&&this.forceExpandFunc&&f!==this._cursor.parent){var c=this;return this.forceExpandFunc(f,"last",function(d){d&&
c.setCursor(d)})}f&&this.setCursor(f);return f},_findSibling:function(i,f){for(var c=this.topLevel(i),d=this._getChildren(i.parent),d=c?this.firstLevelChildren:d,b=0;b<d.length;b++)if(d[b]===i)return b===0&&!f?c?null:i.parent:b===d.length-1&&f?c?null:this._findSibling(i.parent,f):f?d[b+1]:d[b-1];return null},_inParentChain:function(i,f){for(var c=i.parent;c;){if(c===f)return!0;c=c.parent}return!1},_getTopLevelParent:function(i){if(this.topLevel(i))return i;for(i=i.parent;i;){if(this.topLevel(i))return i;
i=i.parent}return null},_onCollapse:function(i){return this._expanded(i.parent)?i:this._onCollapse(i.parent)},_scan:function(i,f,c){this.setCursor(f);var d=[];for(d.push(f);;){if(this.iterate(i))d.push(this.cursor());else break;if(c===this.cursor())return d}return null},setCursor:function(i){this._prevCursor=this._cursor;this._cursor=i},setTree:function(i){this.firstLevelChildren=i;if(this.firstLevelChildren.length>0)this.root=this.firstLevelChildren[0].parent},scan:function(i,f){var c=this.cursor(),
d=this._scan(!0,i,f);d||(d=this._scan(!1,i,f));this.setCursor(c);return d},iterate:function(i,f){return i?this._forward(f):this._backward(f)},iterateOnTop:function(i,f){var c=this._findSibling(this._getTopLevelParent(this.cursor()),i);c?this.setCursor(c):f&&this.firstLevelChildren.length>0&&this.setCursor(i?this.firstLevelChildren[0]:this.firstLevelChildren[this.firstLevelChildren.length-1])},collapse:function(i){if(!this._cursor)return null;return this._inParentChain(this._cursor,i)?(this.setCursor(i),
this._cursor):null},reset:function(){this.root=this._prevCursor=this._cursor=null;if(this.firstLevelChildren.length>0)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 g}();return g});
define("orion/explorers/explorerNavHandler",["i18n!orion/nls/messages","orion/webui/littlelib","orion/treeModelIterator","orion/uiUtils"],function(g,l,i,f){var g={},c=navigator.userAgent.indexOf("iPad")!==-1,d=window.navigator.platform.indexOf("Mac")!==-1;g.ExplorerNavHandler=function(){function b(b,c,e){this.explorer=b;this.model=this.explorer.model;this._navDict=c;this._listeners=[];this._selections=[];this._currentColumn=0;b=this._getEventListeningDiv();b.tabIndex=0;b.classList.add("selectionModelContainer");
var a=this;this._modelIterator=new i.TreeModelIterator([],{isExpanded:this.isExpanded.bind(this),getChildrenFunc:e.getChildrenFunc,isExpandable:this.explorer.renderer.isExpandable?function(b){return a.explorer.renderer.isExpandable(b)}:function(b){return a.isExpandable(b)},forceExpandFunc:this.explorer.forceExpandFunc?function(b,e,c){return a.explorer.forceExpandFunc(b,e,c)}:void 0});this._init(e);(!e||e.setFocus!==!1)&&b.focus();e=function(b){if(f.isFormElement(b.target))return!0;if(a.explorer.preventDefaultFunc&&
a.explorer.preventDefaultFunc(b,a._modelIterator.cursor()))return!0;if(b.keyCode===l.KEY.DOWN)return a.onDownArrow(b);else if(b.keyCode===l.KEY.UP)return a.onUpArrow(b);else if(b.keyCode===l.KEY.RIGHT)return a.onRightArrow(b);else if(b.keyCode===l.KEY.LEFT)return a.onLeftArrow(b);else if(b.keyCode===l.KEY.SPACE)return a.onSpace(b);else if(b.keyCode===l.KEY.ENTER)return a.onEnter(b)};b.addEventListener("keydown",e,!1);this._listeners.push({type:"keydown",listener:e});e=function(){if(a.explorer.onFocus)a.explorer.onFocus(!1);
else a.toggleCursor(null,!1)};b.addEventListener("blur",e,!1);this._listeners.push({type:"blur",listener:e});e=function(){if(a.explorer.onFocus)a.explorer.onFocus(!0);else a.toggleCursor(null,!0)};b.addEventListener("focus",e,!1);this._listeners.push({type:"focus",listener:e});this._parentDiv=b}b.prototype={destroy:function(){this._parentDiv.classList.remove("selectionModelContainer");this.removeListeners()},_init:function(b){this._linearGridMove=!1;if(b)this._selectionPolicy=b.selectionPolicy,this.gridClickSelectionPolicy=
b.gridClickSelectionPolicy||"none",this.preventDefaultFunc=b.preventDefaultFunc,this.postDefaultFunc=b.postDefaultFunc},_ctrlKeyOn:function(b){return d?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&&typeof this.explorer.keyEventListeningDiv===
"function"?this.explorer.keyEventListeningDiv(b):l.node(this.explorer._parentId)},isExpandable:function(b){return!b?!1:l.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){var c=this;this.explorer.selection&&this.explorer.selection.getSelections(function(e){c._clearSelection();for(var a=0;a<e.length;a++)c._selections.push(e[a]);c._selections.length>0?c.cursorOn(c._selections[0],
!0,!1,b):c.cursorOn();if(!(c._shiftSelectionAnchor&&c._inSelection(c._shiftSelectionAnchor)>=0))c._shiftSelectionAnchor=null})},refreshModel:function(b,c,e,a){this._currentColumn=0;this.topIterationNodes=[];this.model=c;this._navDict=b;if(this.model.getTopIterationNodes)this.topIterationNodes=this.model.getTopIterationNodes();else if(e)this.topIterationNodes=e;this._modelIterator.setTree(this.topIterationNodes);!a&&this.explorer.selection&&(this.toggleCursor(this._modelIterator.cursor(),!1),this._modelIterator.reset());
this.refreshSelection(!0)},getTopLevelNodes:function(){return this._modelIterator.firstLevelChildren},_inSelection:function(b){for(var b=this.model.getId(b),c=0;c<this._selections.length;c++)if(b===this.model.getId(this._selections[c]))return c;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){if(this._selectionPolicy!==
b)this._selectionPolicy=b,this._selectionPolicy==="cursorOnly"&&this._clearSelection(!0)},setSelection:function(b,c,e){if(this._selectionPolicy==="cursorOnly")c&&this.explorer.renderer._useCheckboxSelection&&this._checkRow(b,!0);else if(this._isRowSelectable(b)){!c||this._selectionPolicy==="singleSelection"?(this._clearSelection(!0),this._checkRow(b,!1),this._selections.push(b),this._lastSelection=b):(c=this._inSelection(b),c>=0?(this._checkRow(b,!0),this._selections.splice(c,1)):(this._checkRow(b,
!1),this._selections.push(b),this._lastSelection=b));if(e)this._shiftSelectionAnchor=this._lastSelection;this.explorer.selection&&(this.explorer.renderer.storeSelections(),this.explorer.selection.setSelections(this._selections))}},moveColumn:function(b,c){b||(b=this.currentModel());var e=this._getGridChildren(b);if(e&&e.length>1||c===0&&e){c!==0&&this.toggleCursor(b,!1);var a=this._currentColumn,j=!0;a+=c;a<0?(this._linearGridMove&&c!==0&&(this._modelIterator.iterate(!1)?b=this.currentModel():j=!1),
a=j?e.length-1:this._currentColumn):a>=e.length&&(this._linearGridMove&&c!==0&&(this._modelIterator.iterate(!0)?b=this.currentModel():j=!1),a=j?0:this._currentColumn);this._currentColumn=a;c!==0&&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))&&b.length>0?b[this._currentColumn]:null},getAriaContainerElement:function(b){for(var c=
this._parentDiv,e;b&&b!==c&&(e=b.getAttribute("role"))!=="grid"&&e!=="tree"&&e!=="treegrid";)b=b.parentNode;return b===c?null:b},toggleCursor:function(b,c){var e=this.getRowDiv(b),a=this.getCurrentGrid(b);a?(e&&(c?e.classList.add("treeIterationCursorRow"):e.classList.remove("treeIterationCursorRow")),a.domNode&&(e=this.getAriaContainerElement(a.domNode),c?(a.domNode.classList.add("treeIterationCursor"),e&&e.setAttribute("aria-activedescendant",a.domNode.id)):a.domNode.classList.remove("treeIterationCursor"))):
e&&(c?e.classList.add("treeIterationCursorRow_Dotted"):e.classList.remove("treeIterationCursorRow_Dotted"))},currentModel:function(){return this._modelIterator.cursor()},cursorOn:function(b,c,e,a){var j,d;if(b||c){if(d===this._modelIterator.cursor())return;j=this._modelIterator.cursor();d=b;this._modelIterator.setCursor(d)}else j=this._modelIterator.prevCursor(),d=this._modelIterator.cursor();if(j!==d||c)if(this.toggleCursor(j,!1),!c||d){this.moveColumn(null,0);this.toggleCursor(d,!0);if((b=this.getRowDiv())&&
!a){for(a=b.parentNode;a;){c=window.getComputedStyle(a,null);if(!c)break;c=c.getPropertyValue("overflow-y");if(c==="hidden"||c==="auto"||c==="scroll")break;a=a.parentNode}if(!a)a=document.body;c=!0;b.offsetTop<=a.scrollTop?(c=!1,e===void 0&&(e=!1)):b.offsetTop+b.offsetHeight>=a.scrollTop+a.clientHeight&&(c=!1,e===void 0&&(e=!0));c||b.scrollIntoView(!e)}if(this.explorer.onCursorChanged)this.explorer.onCursorChanged(j,d)}},getSelection:function(){return this._selections},getSelectionIds:function(){for(var b=
[],c=0;c<this._selections.length;c++)b.push(this.model.getId(this._selections[c]));return b},getRowDiv:function(b){b=b?b:this._modelIterator.cursor();if(!b)return null;var b=this.model.getId(b),c=this._navDict.getValue(b);return c&&c.rowDomNode?c.rowDomNode:l.node(b)},iterate:function(b,c,e){this.topIterationNodes.length!==0&&this._modelIterator.iterate(b,c)&&(this.cursorOn(null,!1,b),e&&(b=this._inSelection(this._modelIterator.prevCursor()),c=this._inSelection(this._modelIterator.cursor()),b>=0&&
c>=0?this.setSelection(this._modelIterator.prevCursor(),!0):this.setSelection(this.currentModel(),!0)))},_checkRow:function(b,c){if(this.explorer.renderer._useCheckboxSelection){var e=this.getRowDiv(b);if(e){var a=l.node(this.explorer.renderer.getCheckBoxId(e.id)),j=c?!a.checked:!0;if(j!==a.checked)this.explorer.renderer.onCheck(e,a,j,!0)}}else this._select(b,c)},_select:function(b){b||(b=this._modelIterator.cursor());var c=this.getRowDiv(b);c&&(this._inSelection(b)<0?c.classList.add("checkedRow"):
c.classList.remove("checkedRow"))},_onModelGrid:function(b,c){var e=this._getGridChildren(b);if(e)for(var a=0;a<e.length;a++)if(c.target===e[a].domNode)return!0;return!1},onClick:function(b,d){var e=l.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(b)));if(d.target!==e&&!(this.gridClickSelectionPolicy==="none"&&this._onModelGrid(b,d)))if(this.cursorOn(b,!0,!1,!0),c)this.setSelection(b,!0);else if(this._ctrlKeyOn(d))this.setSelection(b,!0,!0);else if(d.shiftKey&&this._shiftSelectionAnchor){if(e=
this._modelIterator.scan(this._shiftSelectionAnchor,b)){this._clearSelection(!0);for(var a=0;a<e.length;a++)this.setSelection(e[a],!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);!this._ctrlKeyOn(b)&&!b.shiftKey&&this.setSelection(this.currentModel(),!1,!0);b.preventDefault();return!1},onDownArrow:function(b){this.iterate(!0,!1,b.shiftKey);!this._ctrlKeyOn(b)&&!b.shiftKey&&this.setSelection(this.currentModel(),
!1,!0);b.preventDefault();return!1},_shouldMoveColumn:function(b){var c=this.currentModel(),e=this._getGridChildren(c);return e&&e.length>1?this.isExpandable(c)?this._ctrlKeyOn(b):!0:!1},onLeftArrow:function(b){if(this._shouldMoveColumn(b))return this.moveColumn(null,-1),b.preventDefault(),!0;var c=this._modelIterator.cursor();if(!c)return!1;if(this.isExpandable(c)&&this.isExpanded(c))return this.explorer.myTree.collapse(c),b.preventDefault(),!0;this._modelIterator.topLevel(c)?this.explorer.scopeUp&&
typeof this.explorer.scopeUp==="function"&&this.explorer.scopeUp():(this.cursorOn(c.parent),this.setSelection(c.parent,!1,!0))},onRightArrow:function(b){if(this._shouldMoveColumn(b))return this.moveColumn(null,1),b.preventDefault(),!0;var c=this._modelIterator.cursor();if(!c)return!1;if(this.isExpandable(c)&&!this.isExpanded(c))return this.explorer.myTree.expand(c),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 c=this.getCurrentGrid(this._modelIterator.cursor());if(c)if(c.widget)if(typeof c.onClick==="function")c.onClick();else typeof c.widget.focus==="function"&&c.widget.focus();else{var e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,0,0,this._ctrlKeyOn(b),!1,!1,!1,0,null);c.domNode.dispatchEvent(e)}else if(this.explorer.renderer.getRowActionElement&&(c=this._modelIterator.cursor()))if(c=this.explorer.renderer.getRowActionElement(this.model.getId(c)),
c.href)this._ctrlKeyOn(b)?window.open(c.href):window.location.href=c.href}};return b}();g.ExplorerNavDict=function(){function b(b){this._dict={};this._model=b}b.prototype={addRow:function(b,c){this._dict[this._model.getId(b)]={model:b,rowDomNode:c}},getValue:function(b){return this._dict[b]},getGridNavHolder:function(b,c){if(!b)return null;var e=this._model.getId(b);if(this._dict[e]){if(!this._dict[e].gridChildren&&c)this._dict[e].gridChildren=[];return this._dict[e].gridChildren}return null},initGridNavHolder:function(b){if(!b)return null;
b=this._model.getId(b);if(this._dict[b])this._dict[b].gridChildren=null}};return b}();return g});
define("orion/explorers/explorer","i18n!orion/nls/messages,require,orion/webui/littlelib,orion/webui/treetable,orion/explorers/explorerNavHandler,orion/commands,orion/commandRegistry".split(","),function(g,l,i,f,c,d){var b={};b.Explorer=function(){function b(c,e,a,j){this.registry=c;this.renderer=a;this.selection=e;this.commandService=j;this.myTree=null}b.prototype={destroy:function(){this.model&&this.model.destroy();this.myTree&&this.myTree.destroy();this.destroyed=!0},changedItem:function(b,e){this.myTree&&
this.myTree.refresh.bind(this.myTree)(b,e,!0)},updateCommands:function(b){this.myTree&&this.myTree._renderer.updateCommands.bind(this.myTree._renderer)(b)},makeNewItemPlaceHolder:function(b,e,a){b=this.getRow(b);if(a)return b=b.childNodes[a],b.appendChild(document.createElement("br")),a=document.createElement("span"),a.id=e+"placeHolderRow",b.appendChild(a),{tempNode:a,refNode:a};if(b){a=document.createElement("tr");a.id=e+"placeHolderRow";var c=document.createElement("td");c.id=e+"placeHolderCol";
a.appendChild(c);b.appendChild(a);a=i.node(e+"placeHolderRow");b=i.node(e+"placeHolderCol");if(a&&b)return{tempNode:a,refNode:b}}return null},getRow:function(b){if(b=this.model.getId(b))return i.node(b)},collapseAll:function(){for(var b=this._navHandler.getTopLevelNodes(),e=0;e<b.length;e++)this.myTree.collapse(b[e])},expandAll:function(b){if(b)this._expandRecursively(b);else if(this._navHandler)for(var b=this._navHandler.getTopLevelNodes(),e=0;e<b.length;e++)this._expandRecursively(b[e])},_expandRecursively:function(b){if(this._navHandler&&
this._navHandler.isExpandable(b)){var e=this;this.myTree.expand(b,function(){e.model.getChildren(b,function(a){if(!(a===void 0||a===null))for(var b=a.length,c=0;c<b;c++)e._expandRecursively(a[c])})})}},createTree:function(b,e,a){b=typeof b==="string"?b:b.id||b;this.selection&&this.selection.setSelections([]);this.getNavHandler()&&this.getNavHandler()._clearSelection();var j=b+"innerTree",d=i.node(j);d&&i.empty(d);if(e)e.rootId=j;this.model=e;this._parentId=b;this._treeOptions=a;if(!a||a&&!a.noSelection)this.selectionPolicy=
a?a.selectionPolicy:"",this._navDict=new c.ExplorerNavDict(this.model);this.myTree=new f.TableTree({id:j,model:e,parent:b,labelColumnIndex:this.renderer.getLabelColumnIndex(),renderer:this.renderer,showRoot:a?!!a.showRoot:!1,indent:a?a.indent:void 0,onCollapse:a?a.onCollapse:void 0,navHandlerFactory:a?a.navHandlerFactory:void 0,tableElement:a?a.tableElement:void 0,tableBodyElement:a?a.tableBodyElement:void 0,tableRowElement:a?a.tableRowElement:void 0});this.renderer._initializeUIState();this.selectionPolicy===
"cursorOnly"&&this.initNavHandler()},getNavHandler:function(){return this._navHandler},getNavDict:function(){return this._navDict},refreshSelection:function(){if(this.selection){var b=this.getNavHandler(),e=[];if(b&&this.getNavDict())for(var a=b.getSelection(),c=0;c<a.length;c++){var d=b.getRowDiv(a[c]);d&&d.parentNode&&(d=this.getNavDict().getValue(this.model.getId(a[c])),d.model&&e.push(d.model))}this.selection.setSelections(e)}},getRootPath:function(){return this.model&&this.model.root?this.model.root.Location:
null},initNavHandler:function(){var b=this._treeOptions;if(!b||b&&!b.noSelection){if(!this.getNavHandler())this._navHandler=b&&b.navHandlerFactory&&typeof b.navHandlerFactory.createNavHandler==="function"?b.navHandlerFactory.createNavHandler(this,this._navDict,b):new c.ExplorerNavHandler(this,this._navDict,{getChildrenFunc:b?b.getChildrenFunc:null,setFocus:b&&b.setFocus,selectionPolicy:b?b.selectionPolicy:null});var e=this;this.model.getRoot(function(a){a instanceof Array?e.getNavHandler().refreshModel(e.getNavDict(),
e.model,a):a.children&&a.children instanceof Array&&e.getNavHandler().refreshModel(e.getNavDict(),e.model,a.children);b&&b.setFocus&&e.getNavHandler().cursorOn(null,!1,!1,!0)})}},_lastHash:null,checkbox:!1};return b}();b.createExplorerCommands=function(b,c){function e(a){return typeof a.getItemCount==="function"?a.getItemCount()>0?c?c(a):!0:!1:!1}var a=new d.Command({tooltip:g["Expand all"],imageClass:"core-sprite-expandAll",id:"orion.explorer.expandAll",groupId:"orion.explorerGroup",visibleWhen:function(a){return e(a)},
callback:function(a){a.items.expandAll()}}),j=new d.Command({tooltip:g["Collapse all"],imageClass:"core-sprite-collapseAll",id:"orion.explorer.collapseAll",groupId:"orion.explorerGroup",visibleWhen:function(a){return e(a)},callback:function(a){a.items.collapseAll()}});b.addCommand(a);b.addCommand(j)};b.ExplorerModel=function(){function b(c,e,a){this.rootPath=c;this.fetchItems=e;this.idPrefix=a||""}b.prototype={destroy:function(){this.destroyed=!0},getRoot:function(b){var e=this;this.fetchItems(this.rootPath).then(function(a){e.root=
a;b(a)})},getChildren:function(b,e){b.Children?e(b.Children):b.ChildrenLocation?this.fetchItems(b.ChildrenLocation).then(function(a){b.Children=a;e(a)}):e([])},getId:function(b){if(b.Location===this.root.Location)return this.rootId;for(var b=b.Location.replace(/[\\\/]/g,""),e=this.idPrefix,a=0;a<b.length;a++)e+=b[a].match(/[^\.\:\-\_0-9A-Za-z]/g)?b.charCodeAt(a):b[a];return e}};return b}();b.ExplorerFlatModel=function(){function c(b,e,a){this.rootPath=b;this.fetchItems=e;this.root=a}c.prototype=new b.ExplorerModel;
c.prototype.getRoot=function(b){if(this.root)b(this.root);else{var e=this;this.fetchItems(this.rootPath).then(function(a){e.root=a;b(a)})}};c.prototype.getChildren=function(b,e){b===this.root?e(this.root):e([])};return c}();b.ExplorerRenderer=function(){function b(c,e){this.explorer=e;this._init(c);this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._twistieSpriteClass="modelDecorationSprite"}b.prototype={_init:function(b){if(b){this._useCheckboxSelection=
b.checkbox===void 0?!1:b.checkbox;this.selectionPolicy=b.singleSelection?"singleSelection":"";this._cachePrefix=b.cachePrefix;this.getCheckedFunc=b.getCheckedFunc;this.onCheckedFunc=b.onCheckedFunc;this._highlightSelection=!0;this._treeTableClass=b.treeTableClass||"treetable";if(b.highlightSelection===!1)this._highlightSelection=!1;if(!this.actionScopeId)this.actionScopeId=b.actionScopeId;if(!this.commandService)this.commandService=b.commandService}},getLabelColumnIndex:function(){return this.explorer.checkbox?
1:0},initTable:function(b,e){this.tableTree=e;i.empty(b);this._treeTableClass&&b.classList.add(this._treeTableClass);this.renderTableHeader(b)},getActionsColumn:function(b,e,a,c,d){var a=a||"tool",h=document.createElement("td");h.id=e.id+"actionswrapper";c&&h.classList.add(c);this.actionScopeId&&this.commandService?this.commandService.renderCommands(this.actionScopeId,h,b,this.explorer,a,null,d&&this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(b,!0):null):window.console.log("Warning, no command service or action scope was specified.  No commands rendered.");
return h},initCheckboxColumn:function(){if(this._useCheckboxSelection)return document.createElement("th")},getCheckboxColumn:function(b,e){if(this._useCheckboxSelection){var a=document.createElement("td"),c=document.createElement("span");c.id=this.getCheckBoxId(e.id);c.classList.add("core-sprite-check");c.classList.add("selectionCheckmarkSprite");c.rowId=e.id;if(this.getCheckedFunc)c.checked=this.getCheckedFunc(b),c.checked?(this._highlightSelection&&e.classList.add("checkedRow"),c.classList.add("core-sprite-check_on")):
(this._highlightSelection&&e.classList.remove("checkedRow"),c.classList.remove("core-sprite-check_on"));a.appendChild(c);var d=this;c.addEventListener("click",function(a){d.onCheck(e,a.target,a.target.checked?!1:!0,!0)},!1);return a}},getCheckBoxId:function(b){return b+"selectedState"},onCheck:function(b,e,a,c,d){(e.checked=a)?e.classList.add("core-sprite-check_on"):e.classList.remove("core-sprite-check_on");if(this.onCheckedFunc)this.onCheckedFunc(e.rowId,a,c);this.explorer.getNavHandler()&&d&&this.explorer.getNavHandler().setSelection(this.explorer.getNavDict().getValue(b.id).model,
!0)},storeSelections:function(){if(this.explorer.getNavHandler()){var b=this.explorer.getNavHandler().getSelectionIds(),e=this._getUIStatePreferencePath();e&&window.sessionStorage&&(window.sessionStorage[e+"selection"]=JSON.stringify(b))}},_restoreSelections:function(b){var e=this.explorer.getNavDict(),a=this.explorer.getNavHandler();if(a&&e&&a.getSelectionPolicy()!=="cursorOnly"&&(b=window.sessionStorage[b+"selection"],typeof b==="string"&&(b=b.length>0?JSON.parse(b):null),b)){for(var c=[],a=0;a<
b.length;a++){var d=e.getValue(b[a]);if(d&&d.rowDomNode&&d.model&&(c.push(d.model),this._highlightSelection&&d.rowDomNode.classList.add("checkedRow"),d=i.node(this.getCheckBoxId(d.rowDomNode.id))))d.checked=!0,d.classList.add("core-sprite-check_on")}this.explorer.selection&&(this.explorer.selection.setSelections(c),this.explorer.getNavHandler()&&this.explorer.getNavHandler().refreshSelection())}},_storeExpansions:function(b){window.sessionStorage[b+"expanded"]=JSON.stringify(this._expanded)},_restoreExpansions:function(b){var e=
!1,a=window.sessionStorage[b+"expanded"];typeof a==="string"&&(a=a.length>0?JSON.parse(a):null);var c;if(a)for(c=0;c<a.length;c++)if(i.node(a[c])){this._expanded.push(a[c]);var d=this;this.tableTree.expand(a[c],function(){d._restoreSelections(b)});e=!0}return!e},_getUIStatePreferencePath:function(){if(this.explorer){var b=this.explorer.getRootPath();if(this._cachePrefix&&b)return"/"+this._cachePrefix+"/"+b.replace(/[^\.\:\-\_0-9A-Za-z]/g,"")+"/uiState"}return null},expandCollapseImageId:function(b){return b+
"__expand"},updateExpandVisuals:function(b,e){var a=i.node(this.expandCollapseImageId(b.id));a&&(a.classList.add(e?this._expandImageClass:this._collapseImageClass),a.classList.remove(e?this._collapseImageClass:this._expandImageClass))},getExpandImage:function(b,e,a,c){var d=document.createElement("span");d.id=this.expandCollapseImageId(b.id);e.appendChild(d);d.classList.add(this._twistieSpriteClass);d.classList.add(this._collapseImageClass);if(a){var h=document.createElement("span");e.appendChild(h);
h.classList.add(c||"imageSprite");h.classList.add(a)}var f=this;d.onclick=function(){f.tableTree.toggle(b.id);if(f.tableTree.isExpanded(b.id))f._expanded.push(b.id);else for(var a in f._expanded)if(f._expanded[a]===b.id){f._expanded.splice(a,1);break}(a=f._getUIStatePreferencePath())&&window.sessionStorage&&f._storeExpansions(a)};return d},render:function(b,e){e.classList.add("navRow");this.renderRow(b,e)},rowsChanged:function(){this.explorer.selectionPolicy!=="cursorOnly"&&(this.explorer.refreshSelection(),
this.explorer.initNavHandler())},updateCommands:function(){if(this.commandService)for(var b=i.$$array(".treeTableRow"),e=0;e<b.length;e++){var a=b[e],c=i.node(a.id+"actionswrapper");this.commandService.destroy(c);this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,c,a._item,this.explorer,"tool")}},_initializeUIState:function(){this._expanded=[];var b=this._getUIStatePreferencePath();b&&window.sessionStorage&&this._restoreExpansions(b)&&this._restoreSelections(b)}};return b}();
b.SelectionRenderer=function(){function c(b,e){this._init(b);this.explorer=e}c.prototype=new b.ExplorerRenderer;c.prototype.renderTableHeader=function(b){var e=document.createElement("thead"),a=document.createElement("tr");e.classList.add("navTableHeading");this._useCheckboxSelection&&a.appendChild(this.initCheckboxColumn(b));for(var c=0,d=this.getCellHeaderElement(c);d;)d.innerHTML.length>0&&d.classList.add("navColumn"),a.appendChild(d),d=this.getCellHeaderElement(++c);e.appendChild(a);c>0&&b.appendChild(e)};
c.prototype.renderRow=function(b,e){e.verticalAlign="baseline";e.classList.add("treeTableRow");var a=this.explorer.getNavDict();if(a){a.addRow(b,e);var c=this;e.addEventListener("click",function(a){if(c.explorer.getNavHandler())c.explorer.getNavHandler().onClick(b,a)},!1)}if(a=this.getCheckboxColumn(b,e))a.classList.add("checkColumn"),e.appendChild(a);for(var a=0,d=this.getCellElement(a,b,e);d;)e.appendChild(d),a===0?this.getPrimColumnStyle?d.classList.add(this.getPrimColumnStyle()):d.classList.add("navColumn"):
this.getSecondaryColumnStyle?d.classList.add(this.getSecondaryColumnStyle()):d.classList.add("secondaryColumn"),d=this.getCellElement(++a,b,e)};c.prototype.getCellHeaderElement=function(){};c.prototype.getCellElement=function(){};return c}();b.SimpleFlatModel=function(){function c(b,e,a){this.items=b;this.getKey=a;this.idPrefix=e;this.root={children:b}}c.prototype=new b.ExplorerModel;c.prototype.getRoot=function(b){b(this.root)};c.prototype.getId=function(b){for(var b=this.getKey(b).replace(/[\\\/]/g,
""),e="",a=0;a<b.length;a++)e+=b[a].match(/[^\.\:\-\_0-9A-Za-z]/g)?b.charCodeAt(a):b[a];return this.idPrefix+e};c.prototype.getChildren=function(b,e){b===this.root?e(this.items):e([])};return c}();return b});
define("orion/URITemplate",[],function(){function g(a){this._text=a}function l(a){return a.replace("%25","%")}function i(a,b){if(b==="U")return encodeURIComponent(a).replace(/[!'()*]/g,function(a){return"%"+a.charCodeAt(0).toString(16).toUpperCase()});if(b==="U+R")return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(e,l);if(b==="U+R-,")return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/,/g,"%2C");throw Error("Unknown allowed character set: "+b);}function f(a,b,e){for(var c=
[],d=0;d<a.length;d++)typeof a[d]!=="undefined"&&c.push(i(a[d],b));return c.join(e)}function c(a,b,e,c){for(var d=Object.keys(a),h=[],f=0;f<d.length;f++)typeof a[d[f]]!=="undefined"&&h.push(i(d[f],b)+e+i(a[d[f]],b));return h.join(c)}function d(a){if(a.length===0)throw Error("Invalid Expression: 0 length expression");(this._operator=h[a[0]])?a=a.substring(1):this._operator=h.NUL;for(var b=[],e=a.split(","),c=0;c<e.length;c++){var d=e[c].match(k);if(d===null)throw Error("Bad VarSpec: "+a);b.push({name:d[1],
explode:!!d[2],prefix:d[3]?parseInt(d[3],10):-1})}this._varSpecList=b}function b(a){for(var b=[],e=0,c=a.indexOf("{",e);c!==-1;){b.push(new g(a.substring(e,c)));e=a.indexOf("}",c+1);if(e===-1)throw Error("Invalid template: "+a);b.push(new d(a.substring(c+1,e)));e+=1;c=a.indexOf("{",e)}b.push(new g(a.substring(e)));this._templateComponents=b}var h={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:"&",named:!0,ifemp:"=",allow:"U"},"&":{first:"&",sep:"&",named:!0,ifemp:"=",allow:"U"},"#":{first:"#",sep:",",named:!1,ifemp:"",allow:"U+R"},",":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R-,"}},k=/^((?:(?:[a-zA-Z0-9_])|(?:%[0-9A-F][0-9A-F]))(?:(?:[a-zA-Z0-9_.])|(?:%[0-9A-F][0-9A-F]))*)(?:(\*)|:([0-9]+))?$/,e=/%25[0-9A-F][0-9A-F]/g;g.prototype={expand:function(){return encodeURI(this._text)}};
d.prototype={expand:function(a){for(var b=[],e=0;e<this._varSpecList.length;e++){var d=this._varSpecList[e],h=d.name,k=a[h],q=typeof k;if(q!=="undefined"&&k!==null){var g=b.length===0?this._operator.first:this._operator.sep;if(q==="string")this._operator.named&&(g+=i(h,"U+R"),g+=k.length===0?this._operator.ifemp:"="),d.prefix!==-1&&d.prefix<k.length&&(k=k.substring(0,d.prefix)),g+=i(k,this._operator.allow);else if(Array.isArray(k))d.explode?g+=f(k,this._operator.allow,this._operator.sep):(this._operator.named&&
(g+=i(h,"U+R"),g+=k.length===0?this._operator.ifemp:"="),g+=f(k,this._operator.allow,","));else if(q==="object")d.explode?g+=c(k,this._operator.allow,"=",this._operator.sep):(this._operator.named&&(g+=i(h,"U+R"),g+=Object.keys(k).length===0?this._operator.ifemp:"="),g+=c(k,this._operator.allow,",",","));else throw Error("bad param type: "+h+" : "+q);b.push(g)}}return b.join("")}};b.prototype={expand:function(a){for(var b=[],e=0;e<this._templateComponents.length;e++)b.push(this._templateComponents[e].expand(a));
return b.join("")}};return b});
define("orion/i18nUtil",["require","orion/Deferred"],function(g,l){function i(c){if(c=localStorage.getItem("orion/messageBundle/"+c))if(c=JSON.parse(c),c._expires&&c._expires>(new Date).getTime())return delete c._expires,c;return null}var f={};return{getMessageBundle:function(c){function d(){g(["i18n!"+c],function(e){if(e){var a=c;e._expires=(new Date).getTime()+9E5;localStorage.setItem("orion/messageBundle/"+a,JSON.stringify(e));delete e._expires}b.resolve(e)})}if(f[c])return f[c];var b=new l;f[c]=
b;var h=i(c);if(h)return b.resolve(h),b;try{g([c],d)}catch(k){g(["orion/i18n!"+c],d)}return b},formatMessage:function(c){var d=arguments;return c.replace(/\$\{([^\}]+)\}/g,function(b,c){return d[(c<<0)+1]})}}});define("orion/edit/editorContext",[],function(){return{getEditorContext:function(g){var l={};g.getServiceReferences("orion.edit.context").forEach(function(i){var f=g.getService(i);Object.keys(f).forEach(function(c){typeof f[c]==="function"&&(l[c]=f[c].bind(f))})});return l}}});
define("orion/outliner","i18n!orion/nls/messages,orion/Deferred,orion/webui/littlelib,orion/uiUtils,orion/section,orion/explorers/explorer,orion/commands,orion/URITemplate,orion/EventTarget,orion/i18nUtil,orion/edit/editorContext".split(","),function(g,l,i,f,c,d,b,h,k,e,a){function j(a,b,e,c){this.explorer=b;this._init(a);this.title=e;this.selectionService=c}function p(a,b,e){this.registry=a;this.renderer=new j({checkbox:!1,treeTableClass:"outlineExplorer"},this,e,b)}function m(a,b){this.items=a;
this.root={children:a};this.root.outlinerId=b;this.idItemMap={}}function n(a){this._init(a)}function s(a){this._serviceRegistry=a.serviceRegistry;this._preferences=a.preferences;k.attach(this);this._serviceRegistration=this._serviceRegistry.registerService("orion.edit.outline",this);this._outlinePref=this._preferences.getPreferences("/edit/outline");this._provider=new l;this._providerResolved=!1;this.filteredProviders=[]}j.prototype=d.SelectionRenderer.prototype;j.prototype.constructor=j;j.prototype.getLabelColumnIndex=
function(){return 0};j.prototype.getCellElement=function(a,b,e){b&&(a=document.createElement("span"),e.appendChild(a),b.className&&a.classList.add(b.className),b.children&&this.getExpandImage(e,a),b.href?this._createLink(b.label,b.href,a):b.line||b.column||b.start?(e=(new h("#{,resource,params*}")).expand({resource:this.title,params:b}),this._createLink(b.label,e,a)):b.label&&a.appendChild(document.createTextNode(b.label)))};j.prototype._createLink=function(a,b,e){var c=document.createElement("a");
e.appendChild(c);this.selectionService?c.style.cursor="pointer":c.href=b;c.classList.add("navlinkonpage");c.appendChild(document.createTextNode(a));if(this.selectionService){var j=this.selectionService;c.addEventListener("click",function(a){f.openInNewWindow(a)?f.followLink(b,a):j.setSelections(b)},!1)}return c};p.prototype=d.Explorer.prototype;p.prototype.constructor=p;m.prototype.constructor=m;m.prototype.getRoot=function(a){a(this.root)};m.prototype.destroy=function(){};m.prototype.getId=function(a){if(a.outlinerId)return a.outlinerId;
var b=a.label.replace(/[\\\/\.\:\-\_]/g,"");this.idItemMap[b]&&this.idItemMap[b]!==a||i.node(b)?(b=(new Date).getTime().toString(),this.idItemMap[b]=a,a.outlinerId=b):this.idItemMap[b]=a;return b};m.prototype.getChildren=function(a,b){if(a.children){for(var e=0;e<a.children.length;e++)a.children[e].parent=a;b(a.children)}else b([])};m.prototype.doExpansions=function(a){for(var b=0;b<this.root.children.length;b++)this.root.children[b].children&&a.expand(this.root.children[b])};n.prototype={_init:function(a){var b=
i.node(a.parent),e=i.node(a.toolbar);if(!b)throw Error("no parent");if(!a.outlineService)throw Error("no outline service");this._parent=b;this._toolbar=e;this._serviceRegistry=a.serviceRegistry;this._contentTypeRegistry=a.contentTypeRegistry;this._outlineService=a.outlineService;this._commandService=a.commandService;this._selectionService=a.selectionService;this._inputManager=a.inputManager;this._sidebar=a.sidebar;var c=this;this._inputManager.addEventListener("InputChanged",function(a){c.setContentType(a.contentType,
a.location)});this._inputManager.getEditor().addEventListener("InputChanged",this.generateOutline.bind(this));l.when(c._outlineService,function(a){a.addEventListener("outline",function(a){c.providerId=a.providerId;c._renderOutline(a.outline,a.title)})})},generateOutline:function(){this._isActive()&&(this._providerLookup||this._outlineService.emitOutline(this._inputManager))},setSelectedProvider:function(a){this.providerId=a.getProperty("id");this.providerName=a.getProperty("name");this._outlineService.setProvider(a)},
setOutlineProviders:function(a){var b=this.outlineProviders,e=this._isActive();this.outlineProviders=a;this._updateViewModes(b,this.outlineProviders);e&&this._selectNewProvider()},_renderOutline:function(a,b){var e=this._parent;i.empty(e);if(a=a instanceof Array?a:[a]){var c=new m(a);this.explorer=new p(this._serviceRegistry,this._selectionService,b);this.explorer.createTree(e,c,{selectionPolicy:"cursorOnly",setFocus:!1});c.doExpansions(this.explorer.myTree)}},_selectNewProvider:function(){var a=
this.outlineProviders,b=this,e=b._sidebar;a.every(function(a){return b.providerId!==a.getProperty("id")})&&((a=a[0])?e.setViewMode(this._viewModeId(a)):e.setViewMode(e.defaultViewMode))},_viewModeId:function(a){return"outline."+a.getProperty("id")},_updateViewModes:function(a,b){var e=this;a&&a.forEach(function(a){e._sidebar.removeViewMode(e._viewModeId(a))});b.forEach(function(a){e._sidebar.addViewMode(e._viewModeId(a),{label:a.displayName||a.getProperty("name")||a.name+a.serviceId||"undefined",
create:e.createViewMode.bind(e,a),destroy:e.destroyViewMode.bind(e,a)})});e._sidebar.renderViewModeMenu()},_isActive:function(){var a=this._sidebar.getActiveViewModeId();if(!a)return!1;var b=this;return this.outlineProviders&&this.outlineProviders.some(function(e){return a===b._viewModeId(e)})},createViewMode:function(a){this.setSelectedProvider(a);this.generateOutline()},destroyViewMode:function(){},setContentType:function(a,b){var c=this,j=this.filteredProviders=this._serviceRegistry.getServiceReferences("orion.edit.outliner").filter(function(e){var j=
e.getProperty("contentType"),e=e.getProperty("pattern");if(j)return j.some(function(b){return c._contentTypeRegistry.isExtensionOf(a,b)});else if(e&&RegExp(e).test(b))return!0;return!1});this._providerLookup=!0;var d=j.map(function(a){if(a.getProperty("nameKey")&&a.getProperty("nls")){var b=new l;e.getMessageBundle(a.getProperty("nls")).then(function(a,b,e){a.displayName=e[a.getProperty("nameKey")];b.resolve()}.bind(null,a,b),b.reject);return b}else return a.displayName=a.getProperty("name"),(new l).resolve()});
l.all(d,function(a){return a}).then(function(){c._providerLookup=!1;c._outlineService.setOutlineProviders(j);c.setOutlineProviders(j)})}};n.prototype.constructor=n;s.prototype={setOutlineProviders:function(a){this.providers=a;var b=this;l.when(this._outlinePref,function(e){for(var c,j=0;j<a.length;j++)if(c=a[j],e.get("outlineProvider")===a[j].getProperty("id"))break;c&&b.setProvider(c)})},setProvider:function(a){if(this._providerResolved)this._provider=new l;this._provider.resolve(a);this._providerResolved=
!0;var b=a.getProperty("id");b&&this._outlinePref.then(function(a){a.put("outlineProvider",b)})},getProvider:function(){return this._provider.promise},emitOutline:function(b){var c=this;l.when(this.getProvider(),function(j){var d=b.getEditor(),h=d.getTitle(),o=c._serviceRegistry,r=o.getService("orion.page.progress"),f=o.getService(j),k,p;if(k=f.computeOutline)d=b.getContentType(),p=[a.getEditorContext(o),{contentType:d&&d.id}];else if(k=f.getOutline)p=[d.getText(),h];r.progress(k.apply(f,p),e.formatMessage(g.OutlineProgress,
h,j.displayName)).then(function(a){a&&c.dispatchEvent({type:"outline",outline:a,title:h,providerId:j.getProperty("id")})})})}};s.prototype.constructor=s;return{Outliner:n,OutlineService:s}});
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","Delete the selected files or folders":"Delete the selected files or folders","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":"Export as 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":"New File","Create a new file":"Create a new file",
"Name:":"Name:","New Folder":"New 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","Import local file...":"Import local file...","Copy files and folders from your local file system":"Copy files and folders from your local file system","SFTP from...":"SFTP from...","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 to...","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",
"Copy Items":"Copy Items","Copy the selected items to the copy/paste buffer":"Copy the selected items to the copy/paste buffer","Paste Items":"Paste Items","Paste items from the copy/paste buffer":"Paste items from the copy/paste buffer","Cannot paste into the Workspace root":"Cannot paste into the Workspace root","Open With":"Open With","Loading ":"Loading ",New:"New",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...":"Import from HTTP...","File URL:":"File URL:","Copy a file from a URL and optionally unzip it":"Copy 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}?",NoFile:"Use the ${0} to create new files and folders. Click a file to start coding."});define("orion/navigate/nls/messages",["orion/i18n!orion/navigate/nls/messages","orion/navigate/nls/root/messages"],function(g,l){var i={root:l};Object.keys(g).forEach(function(f){typeof i[f]==="undefined"&&(i[f]=g[f])});return i});
define("orion/fileUtils",["require","i18n!orion/nls/messages","orion/URL-shim"],function(g){return{makeRelative:function(g){if(!g)return g;var i=window.location.protocol+"//"+window.location.host;return g.indexOf(i)===0?g.substring(i.length):g},isAtRoot:function(l){if(!l)return!1;if(l==="/workspace")return!0;var i=new URL(g.toUrl("workspace"),window.location.href);return(new URL(l,window.location.href)).href.indexOf(i.href)===0}}});
define("orion/explorers/explorer-table","i18n!orion/navigate/nls/messages,require,orion/Deferred,orion/webui/littlelib,orion/i18nUtil,orion/fileUtils,orion/explorers/explorer,orion/EventTarget,orion/util".split(","),function(g,l,i,f,c,d,b,h,k){function e(a,b,e,c,j,d){this.registry=a;this.root=b;this.fileClient=e;this.idPrefix=c||"";this.excludeFiles=!!j;this.excludeFolders=!!d}function a(a){h.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 h;this.modelEventDispatcher=b;var e=this;this._modelListeners={};"copy,copyMultiple,create,delete,deleteMultiple,import,move,moveMultiple".split(",").forEach(function(a){b.addEventListener(a,
e._modelListeners[a]=e.modelHandler[a].bind(e))});var c=this.renderer;this.registry&&this.registry.registerService("orion.cm.managedservice",{updated:function(a){a=a&&a["links.newtab"]!=="undefined"?a["links.newtab"]?"_blank":"_self":"_self";c.setTarget&&c.setTarget(a)}},{pid:"nav.config"})}e.prototype=new b.ExplorerModel;e.prototype.getRoot=function(a){a(this.root)};e.prototype.processParent=function(a,b){if(this.excludeFiles||this.excludeFolders){var e=[],c;for(c in b)if(!(b[c].Directory?this.excludeFolders:
this.excludeFiles))e.push(b[c]),b[c].parent=a;b=e}else for(e in b)b[e].parent=a;a.children=b;a.children.sort(function(a,b){var e=a.Directory;if(e!==b.Directory)return e?-1:1;var e=a.Name&&a.Name.toLowerCase(),c=b.Name&&b.Name.toLowerCase();return e<c?-1:e>c?1:0});return b};e.prototype.getChildren=function(a,b){var e=this;a.children?b(a.children):a.Directory!==void 0&&a.Directory===!1?b([]):a.Location?this.registry.getService("orion.page.progress").progress(this.fileClient.fetchChildren(a.ChildrenLocation),
"Fetching children of "+a.Name).then(function(c){e.destroyed||b(e.processParent(a,c))}):b([])};e.prototype.hasChildren=function(){var a=!1;this.root.Children&&(a=this.root.Children.length>0);return a};e.prototype.constructor=e;a.prototype=Object.create(b.Explorer.prototype);a.prototype.destroy=function(){var a=this;Object.keys(this._modelListeners).forEach(function(b){a.modelEventDispatcher.removeEventListener(b,a._modelListeners[b])});b.Explorer.prototype.destroy.call(this)};a.prototype.modelHandler=
{copy:function(){},copyMultiple:function(a){var b=this,e={};a.items.forEach(function(a){a=a.newValue.Parents&&a.newValue.Parents[0]||b.treeRoot;e[a.Location]=a});Object.keys(e).forEach(function(a){b.changedItem(e[a],!0)})},create:function(a){this.changedItem(a.parent,!0,a.newValue)},"delete":function(){},deleteMultiple:function(a){var a=a.items,b=this,e;if(a.some(function(a){return a.oldValue.Location===b.treeRoot.Location?(e=a.parent,!0):!1}))this.loadResourceList(e);else{var c={};a.forEach(function(a){a=
a.parent;c[a.Location]=a});Object.keys(c).forEach(function(a){b.changedItem(c[a],!0)})}},"import":function(a){this.changedItem(a.target,!0)},move:function(a){var b=a.oldValue,e=a.newValue,a=a.parent,c=this,j=null;if(a.Projects)if(c.treeRoot.Location===b.Location){var d=c.treeRoot,b=e.ChildrenLocation?e:this.fileClient.read(e.ContentLocation,!0);i.when(b,function(a){c.dispatchEvent({type:"rootMoved",oldValue:d,newValue:a});c.loadResourceList(a)})}else j=c.isExpanded(b)&&b;else b.Directory&&(j=c.isExpanded(b)&&
e);c.changedItem(a,!0);j&&c.changedItem(j,!0)},moveMultiple:function(){this.changedItem(this.treeRoot,!0)}};var j;a.prototype._makeDropTarget=function(a,b,e){function h(a,b,e,j,f,k){b=b||"";if(a.isFile)d.isAtRoot(e.Location)?j.registry.getService("orion.page.message").setProgressResult({Severity:"Error",Message:g["You cannot copy files directly into the workspace.  Create a folder first."]}):a.file(function(a){f(e,a,j,a.name.indexOf(".zip")===a.name.length-4&&window.confirm(c.formatMessage(g["Unzip ${0}?"],
a.name)))});else if(a.isDirectory){var p=a.createReader(),n=function(e){p.readEntries(function(c){for(var d=0;d<c.length;d++)h(c[d],b+a.name+"/",e,j,f,k)})},m=j.registry.getService("orion.page.progress");d.isAtRoot(e.Location)?m.progress(k.createProject(e.ChildrenLocation,a.name),"Initializing project "+a.name).then(function(a){j.loadResourceList(j.treeRoot.Path,!0);m.progress(k.read(a.ContentLocation,!0),"Loading project info "+a.name).then(function(a){n(a)})}):m.progress(k.createFolder(e.Location,
a.name),"Creating folder "+a.name).then(function(a){j.changedItem(e,!0);n(a)})}}if(this.dragAndDrop){var i=this,l=this.dragAndDrop,v=function(a){j=a.target};if(e)this._oldDragStart&&b.removeEventListener("dragstart",this._oldDragStart,!1),this._oldDragStart=v;b.addEventListener("dragstart",v,!1);v=function(){j=null};if(e)this._oldDragEnd&&b.removeEventListener("dragend",this._oldDragEnd,!1),this._oldDragEnd=v;b.addEventListener("dragend",v,!1);v=function(a){b.classList.remove("dragOver");a.preventDefault();
a.stopPropagation()};if(e)this._oldDragLeave&&b.removeEventListener("dragleave",this._oldDragLeave,!1),this._oldDragLeave=v;b.addEventListener("dragleave",v,!1);v=function(a){if(!k.isIE&&(a.dataTransfer.effectAllowed==="all"||a.dataTransfer.effectAllowed==="uninitialized"||a.dataTransfer.effectAllowed.indexOf("copy")>=0))a.dataTransfer.dropEffect="copy";b.classList.add("dragOver");f.stop(a)};if(e)this._oldDragEnter&&b.removeEventListener("dragenter",this._oldDragEnter,!1),this._oldDragEnter=v;b.addEventListener("dragenter",
v,!1);v=function(a){if(!k.isIE&&(a.dataTransfer.effectAllowed==="all"||a.dataTransfer.effectAllowed==="uninitialized"||a.dataTransfer.effectAllowed.indexOf("copy")>=0))a.dataTransfer.dropEffect="copy";f.stop(a)};if(e&&!this._oldDragOver)b.addEventListener("dragover",v,!1),this._oldDragOver=v;v=function(e){b.classList.remove("dragOver");if(j){var k=i.fileClient,o=j.href,r=o.indexOf("#"),o=o.substring(r+1),w=i.registry.getService("orion.page.progress");w.showWhile(k.copyFile(o,a.Location),c.formatMessage(g["Copying ${0}"],
o)).then(function(){i.changedItem(a,!0)},function(a){w?w.setProgressResult(a):window.console.log(a)})}else if(e.dataTransfer.items&&e.dataTransfer.items.length>0)for(k=0;k<e.dataTransfer.items.length;k++)o=null,typeof e.dataTransfer.items[k].getAsEntry==="function"?o=e.dataTransfer.items[k].getAsEntry():typeof e.dataTransfer.items[k].webkitGetAsEntry==="function"&&(o=e.dataTransfer.items[k].webkitGetAsEntry()),o&&h(o,null,a,i,l,i.fileClient);else if(e.dataTransfer.files&&e.dataTransfer.files.length>
0)for(k=0;k<e.dataTransfer.files.length;k++)o=e.dataTransfer.files[k],!o.length&&(!o.type||o.type==="")?i.registry.getService("orion.page.message").setProgressResult({Severity:"Error",Message:c.formatMessage(g["Did not drop ${0}.  Folder drop is not supported in this browser."],o.name)}):d.isAtRoot(a.Location)?i.registry.getService("orion.page.message").setProgressResult({Severity:"Error",Message:g["You cannot copy files directly into the workspace.  Create a folder first."]}):l(a,o,i,o.name.indexOf(".zip")===
o.name.length-4&&window.confirm(c.formatMessage(g["Unzip ${0}?"],o.name)));f.stop(e)};if(e)this._oldDrop&&b.removeEventListener("drop",this._oldDrop,!1),this._oldDrop=v;b.addEventListener("drop",v,!1)}};a.prototype.changedItem=function(a,b){if(this.treeRoot&&this.treeRoot.Location===a.Location)return this.loadResourceList(this.treeRoot,b);var e=this,c=new i;a.children=null;this.model.getChildren(a,function(j){e.getNavHandler();e.myTree.refresh.bind(e.myTree)(a,j,b);c.resolve(j)});return c};a.prototype.isExpanded=
function(a){return this.renderer.tableTree.isExpanded(this.model.getId(a))};a.prototype.getNameNode=function(a){if(a=this.model.getId(a))return f.node(a+"NameLink")};a.prototype.scopeUp=function(){};a.prototype.scopeDown=function(){};a.prototype.loadResourceList=function(a,b,e){a&&typeof a==="object"&&(a=a.ChildrenLocation||a.ContentLocation);a=d.makeRelative(a);if(!b&&a===this._lastPath)return(new i).resolve(this.treeRoot);this._lastPath=a;var c=this;return b||a!==this.treeRoot.Path?this.load(this.fileClient.loadWorkspace(a),
"Loading "+a).then(function(){c.treeRoot.Path=a;typeof e==="function"&&e();c.dispatchEvent({type:"rootChanged",root:c.treeRoot});return(new i).resolve(c.treeRoot)},function(a){c.treeRoot.Path=null;c.dispatchEvent({type:"rootChanged",root:c.treeRoot});return(new i).reject(a)}):(new i).resolve(c.treeRoot)};a.prototype.load=function(a,b,c){var j=f.node(this.parentId),d=f.node("progress");if(!d)d=document.createElement("div"),d.id="progress",f.empty(j),j.appendChild(d);f.empty(d);var h=setTimeout(function(){f.empty(d);
d.appendChild(document.createTextNode(b))},500),k=this;return i.when(a,function(a){clearTimeout(h);if(!k.destroyed){k.treeRoot={};for(var b in a)k.treeRoot[b]=a[b];k.model=new e(k.registry,k.treeRoot,k.fileClient,k.parentId,k.excludeFiles,k.excludeFolders);k.model.processParent(k.treeRoot,a.Children);if(k.dragAndDrop)k._hookedDrag?k._makeDropTarget(k.treeRoot,j,!0):(a=(a=j&&("draggable"in j||"ondragstart"in j&&"ondrop"in j))&&!(!window.File||!window.FileList||!window.FileReader),k._hookedDrag=!0,
a?k._makeDropTarget(k.treeRoot,j,!0):(k.dragAndDrop=null,window.console.log("Local file drag and drop is not supported in this browser.")));k.createTree(k.parentId,k.model,{navHandlerFactory:k.navHandlerFactory,setFocus:typeof k.setFocus==="undefined"?!0:k.setFocus,selectionPolicy:k.renderer.selectionPolicy,onCollapse:function(a){if(k.getNavHandler())k.getNavHandler().onCollapse(a)}});if(typeof c==="function")try{c()}catch(d){k.registry&&k.registry.getService("orion.page.message").setErrorMessage(d)}if(typeof k.onchange===
"function")k.onchange(k.treeRoot);return(new i).resolve(k.treeRoot)}},function(a){clearTimeout(h);k.registry.getService("orion.page.message").setProgressResult(a);return(new i).reject(a)})};a.prototype.onchange=function(){};a.prototype.constructor=a;return{FileExplorer:a,FileModel:e}});define("orion/regex",[],function(){return{escape:function(g){return g.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$&")},parse:function(g){return(g=/^\s*\/(.+)\/([gim]{0,3})\s*$/.exec(g))?{pattern:g[1],flags:g[2]}:null}}});
define("orion/contentTypes",[],function(){function g(c,b){function h(a,b,e,c){var e=b.filename.indexOf(e)>=0,j;j=c.toLowerCase();j=b.extension.indexOf(j)!==-1;if(e||j){if(!(j=!a))e&&(c=c.toLowerCase(),e=a.extension.indexOf(c)!==-1),j=e;if(j)return b}return a}if(typeof c!=="string")return null;for(var f=c&&c.split(".").pop(),e=null,a=0;a<b.length;a++){var j=b[a];h(e,j,c,f)===j&&(e=j)}return e}function l(d){this.serviceRegistry=d;this.map=function(b){function d(a){return a===null||typeof a==="undefined"?
[]:Array.isArray(a)?a:[a]}function k(a){return d(a).map(function(a){return String.prototype.toLowerCase.call(a)})}for(var b=b.getServiceReferences(f).concat(b.getServiceReferences(c)),e={},a=0;a<b.length;a++)for(var j=d(b[a].getProperty("contentTypes")),p=0;p<j.length;p++){var m=j[p];e[m.id]||(e[m.id]={id:m.id,name:m.name,image:m.image,"extends":m["extends"],extension:k(m.extension),filename:d(m.filename)})}return e}(d);d.registerService(i,this)}var i="orion.core.contentTypeRegistry",f="orion.core.contenttype",
c="orion.file.contenttype";l.prototype={getContentTypes:function(){var c=this.getContentTypesMap(),b=[],h;for(h in c)Object.prototype.hasOwnProperty.call(c,h)&&b.push(c[h]);return b},getContentTypesMap:function(){return this.map},getFileContentType:function(c){return g(c.Name,this.getContentTypes())},getFilenameContentType:function(c){return g(c,this.getContentTypes())},getContentType:function(c){return this.map[c]||null},isExtensionOf:function(c,b){c=typeof c==="string"?this.getContentType(c):c;
b=typeof b==="string"?this.getContentType(b):b;if(!c||!b)return!1;if(c.id===b.id)return!0;else for(var h=c,f={};h&&(h=this.getContentType(h["extends"]));){if(h.id===b.id)return!0;if(f[h.id])throw Error("Cycle: "+h.id);f[h.id]=!0}return!1},isSomeExtensionOf:function(c,b){for(var h=0;h<b.length;h++)if(this.isExtensionOf(c,b[h]))return!0;return!1}};return{ContentTypeRegistry:l,getFilenameContentType:g}});
define("orion/PageLinks","require,orion/Deferred,orion/PageUtil,orion/URITemplate,orion/i18nUtil,orion/URL-shim".split(","),function(g,l,i,f,c){function d(){return(new URL(g.toUrl("orion/../"),window.location.href)).href.slice(0,-1)}function b(b,k){var e=b.getServiceReferences(k||"orion.page.link"),a=i.matchResourceParameters(window.location.href),j={OrionHome:d(),Location:a.resource},p=[];e.forEach(function(a){var b={};a.getPropertyKeys().forEach(function(e){b[e]=a.getProperty(e)});if(b.uriTemplate&&
b.nls&&(b.name||b.nameKey)){var e=new l;c.getMessageBundle(b.nls).then(function(a){var c=(new f(b.uriTemplate)).expand(j),c=i.validateURLScheme(c);b.href=c;b.textContent=b.nameKey?a[b.nameKey]:b.name;e.resolve(b)});p.push(e)}else if(b.uriTemplate&&b.name){var d=(new f(b.uriTemplate)).expand(j),d=i.validateURLScheme(d);b.href=d;b.textContent=b.name;p.push((new l).resolve(b))}});return l.all(p)}return{createPageLinks:function(c,d){return b(c,d).then(function(b){b.sort(function(a,b){var e=a.textContent&&
a.textContent.toLowerCase(),c=b.textContent&&b.textContent.toLowerCase();return e<c?-1:e>c?1:0});return b.map(function(a){var b=a.href,a=a.textContent,e=document.createElement("a");e.href=b;e.target="_self";e.classList.add("targetSelector");e.textContent=a;return e})})},getPageLinksInfo:b,getOrionHome:d}});
define("orion/extensionCommands","require,orion/Deferred,orion/commands,orion/regex,orion/contentTypes,orion/URITemplate,orion/i18nUtil,orion/URL-shim,orion/PageLinks".split(","),function(g,l,i,f,c,d,b,h,k){var e={},a=k.getOrionHome();e._cloneItemWithoutChildren=function m(a){if(a===null||typeof a!=="object")return a;var b=a.constructor(),e;for(e in a)e!=="children"&&e!=="Children"&&(b[e]=m(a[e]));return b};e._getOpenWithNavCommandExtensions=function(a){function b(a,e){for(var c=a.getServiceReferences("orion.navigate.openWith"),
j=[],d=0;d<c.length;d++){var o=c[d];o.getProperty("editor")===e.id&&(o=o.getProperty("contentType"),o instanceof Array?j=j.concat(o):o!==null&&typeof o!=="undefined"&&j.push(o))}return j}for(var e=function(){for(var b=a.getServiceReferences("orion.edit.editor"),e=[],c=0;c<b.length;c++){var j=b[c],d=j.getProperty("id");e.push({id:d,name:j.getProperty("name"),nameKey:j.getProperty("nameKey"),nls:j.getProperty("nls"),uriTemplate:j.getProperty("orionTemplate")||j.getProperty("uriTemplate"),validationProperties:j.getProperty("validationProperties")||
[]})}return e}(),c=function(a){for(a=a.getServiceReferences("orion.navigate.openWith.default");0<a.length;)return{editor:a[0].getProperty("editor")};return null}(a),j=[],d=0;d<e.length;d++){var h=e[d],f=c&&c.editor===h.id,o=b(a,h);o.length&&j.push({properties:{name:h.name||h.id,nameKey:h.nameKey,id:"eclipse.openWithCommand."+h.id,tooltip:h.name,tooltipKey:h.nameKey,contentType:o,uriTemplate:h.uriTemplate,nls:h.nls,forceSingleItem:!0,isEditor:f?"default":"editor",validationProperties:h.validationProperties},
service:{}})}return j};e._makeValidator=function(b,e,j,h){function f(a,b,e,c){var j=e.match,d;if(b.indexOf("[")===0){if(b.indexOf("]")<0)return!1;if(!Array.isArray(a))return!1;d=b.replace("[","").replace("]","");for(b=0;b<a.length;b++)if(f(a[b],d,e,c))return!0}else if(b.indexOf("|")>=0)return d=b.substring(0,b.indexOf("|")),b=b.substring(b.indexOf("|")+1),f(a,d,e,c)?!0:f(a,b,e,c);else if(b.indexOf(":")>=0)return d=b.substring(0,b.indexOf(":")),b=b.substring(b.indexOf(":")+1),a[d]?f(a[d],b,e,c):!1;
else{a:{d=!1;var h;if(b.charAt(0)==="!")e=typeof a[b.substring(1)]==="undefined";else if(typeof a[b]!=="undefined"){if(typeof j==="undefined")h=a[b],d=!0;else if(typeof j==="string"){if(!typeof(a[b]==="string")){e=!1;break a}if(e.variableName){if(j=RegExp(j).exec(a[b]))d=j[0],h=e.variableMatchPosition==="before"?a[b].substring(0,j.index):e.variableMatchPosition==="after"?a[b].substring(j.index+d.length):e.variableMatchPosition==="only"?d:a[b],d=!0}else{e=RegExp(j).test(a[b]);break a}}else a[b]===
j&&(h=a[b],d=!0);if(d&&e.variableName&&(c[e.variableName]=h,c.itemCached=a,e.replacements))for(a=0;a<e.replacements.length;a++)b=!1,e.replacements[a].pattern?c[e.variableName]=c[e.variableName].replace(RegExp(e.replacements[a].pattern),e.replacements[a].replacement||""):b=!0,b&&window.console.log("Invalid replacements specified in validation property.  "+e.replacements[a]);e=d}else e=!1}return e}}return{info:b,validationFunction:function(a){typeof h==="function"&&(a=h.call(this,a));if(a){if(Array.isArray(a)){if((this.info.forceSingleItem||
this.info.uriTemplate)&&a.length!==1)return!1;if(a.length<1)return!1}else a=[a];for(var e=0;e<a.length;e++){var d;a:{var o=a[e],r=j;if(this.info.validationProperties)for(d=0;d<this.info.validationProperties.length;d++){var k=this.info.validationProperties[d];if(typeof k.source!=="undefined"){if(!f(o,k.source,k,this)){d=!1;break a}}else{window.console.log("Invalid validationProperties in "+b.id+".  No source property specified.");d=!1;break a}}if(this.info.contentType&&r){k=!1;if(o=c.getFilenameContentType(o.Name,
r))for(d=0;d<this.info.contentType.length;d++)if(o.id===this.info.contentType[d]){k=!0;break}d=k}else d=!0}if(!d)return!1}return!0}return!1},generatesURI:function(){return!!this.info.uriTemplate},getURI:function(b){if(this.info.uriTemplate){var e={},c;for(c in b)Object.prototype.hasOwnProperty.call(b,c)&&(e[c]=b[c]);if(this.info.validationProperties)for(c=0;c<this.info.validationProperties.length;c++){var j=this.info.validationProperties[c];j.source&&j.variableName&&(this.itemCached===b&&this[j.variableName]||
f(b,j.source,j,this),b[j.variableName]?window.console.log("Variable name "+j.variableName+" in the extension "+this.info.id+" conflicts with an existing property in the item metadata."):e[j.variableName]=this[j.variableName])}e.OrionHome=a;return(new d(this.info.uriTemplate)).expand(e)}return null}}};e._createCommandOptions=function(a,c,j,d,h,f){function k(b,r){var w=e._makeValidator(a,j,d,f);b.visibleWhen=w.validationFunction.bind(w);if(h)if(w.generatesURI.bind(w)())b.hrefCallback=function(a){a=
Array.isArray(a.items)?a.items[0]:a.items;return w.getURI.bind(w)(a)};else{var g=a;b.callback=function(a){var d;if(g.forceSingleItem)a=Array.isArray(a.items)?a.items[0]:a.items,d=e._cloneItemWithoutChildren(a);else if(Array.isArray(a.items)){d=[];for(var h=0;h<a.items.length;h++)d.push(e._cloneItemWithoutChildren(a.items[h]))}else d=e._cloneItemWithoutChildren(a.items);if(j)var r=j.getService("orion.page.progress");c.run?r?r.progress(c.run(d),"Running command: "+b.name):c.run(d):j&&(r?r.progress(j.getService(c).run(d),
"Running command: "+b.name):j.getService(c).run(d))}}r.resolve(b)}var g=new l;a.nls?b.getMessageBundle(a.nls).then(function(b){k({name:a.nameKey?b[a.nameKey]:a.name,image:a.image,id:a.id||a.name,tooltip:a.tooltipKey?b[a.tooltipKey]:a.tooltip,isEditor:a.isEditor,showGlobally:a.showGlobally},g)}):k({name:a.name,image:a.image,id:a.id||a.name,tooltip:a.tooltip,isEditor:a.isEditor,showGlobally:a.showGlobally},g);return g};e.getOpenWithCommands=function(a){var b=[],e;for(e in a._commandList){var c=a._commandList[e];
c.isEditor&&b.push(c)}return b};var j;e.createAndPlaceFileCommandsExtension=function(a,b,c,j,d,h){var f=!!h;return e.createFileCommands(a,null,h?"all":void 0,f).then(function(a){b._addedOpenWithCommands=f;var e=!1,h=!1;a.forEach(function(a){b.addCommand(a);d&&!e&&(e=!0,b.addCommandGroup(c,"eclipse.fileCommandExtensions",1E3,null,d));d&&!h&&(h=!0,b.addCommandGroup(c,"eclipse.openWith",1E3,"Open With",d+"/eclipse.fileCommandExtensions"));this.isEditor?b.registerCommandContribution(c,a.id,j+this.index,
d?d+"/eclipse.fileCommandExtensions/eclipse.openWith":null):b.registerCommandContribution(c,a.id,j+this.index,d?d+"/eclipse.fileCommandExtensions":null)});return{}})};e.createFileCommands=function(a,b,c,d){var c=c===void 0?"global":c,d=d===void 0?!0:d,h=a.getServiceReferences("orion.navigate.command"),f=[];if(c==="all"||c==="global")for(var k=0;k<h.length;k++)if(h[k].getProperty("id")!=="orion.navigateFromMetadata"){for(var g=a.getService(h[k]),o={},r=h[k].getPropertyKeys(),w=0;w<r.length;w++)o[r[w]]=
h[k].getProperty(r[w]);(c==="all"||o.forceSingleItem&&o.showGlobally)&&f.push({properties:o,service:g})}return l.when(function(){var e=a.getService("orion.core.contentTypeRegistry")||b;return j||l.when(e.getContentTypes(),function(a){return j=a})}(),function(){f=d?f.concat(e._getOpenWithNavCommandExtensions(a,j)):f;var b=f.map(function(b){var c=b.properties;return e._createCommandOptions(c,b.service,a,j,!0).then(function(a){a=new i.Command(a);if(c.isEditor)a.isEditor=c.isEditor;return a})});return l.all(b,
function(a){return{_error:a}}).then(function(a){return a})})};e.createOpenWithCommands=function(a,b,c){return c&&c._addedOpenWithCommands?(new l).resolve(e.getOpenWithCommands(c)):e.createFileCommands(a,b,"none",!0)};return e});
define("orion/explorers/navigatorRenderer","i18n!orion/navigate/nls/messages,orion/Deferred,orion/explorers/explorer,orion/explorers/navigationUtils,orion/extensionCommands,orion/objects,orion/URITemplate,orion/webui/littlelib".split(","),function(g,l,i,f,c,d,b,h){function k(e,h,f,k,g,i,t,v,x){var h=d.clone(h),u;if(h.Directory)u=document.createElement("a"),u.className="navlinkonpage",u.href=!e?a:(new b(e+"#{,resource,params*}")).expand({resource:h.ChildrenLocation}),h.Name&&u.appendChild(document.createTextNode(h.Name));
else{g||(g=c.getOpenWithCommands(f));if(!i)for(e=0;e<g.length;e++)g[e].isEditor==="default"&&(i=g[e]);u=document.createElement("a");u.className="navlink targetSelector";t&&typeof t==="object"&&Object.keys(t).forEach(function(a){u[a]=t[a]});var o=null,r=null;if(o=x?x.holderDom:u)r=document.createElement("span"),r.className="core-sprite-file modelDecorationSprite",o.appendChild(r);h.Name&&u.appendChild(document.createTextNode(h.Name));var w=!1,z=h.Location;if(v&&typeof v==="object")h.params={},d.mixin(h.params,
v);for(e=0;e<g.length;e++)if(v=g[e],v.visibleWhen(h)){z=v.hrefCallback({items:h});w=!0;break}l.when(k.getFileContentType(h),function(a){var b;if(b=!w)if(b=i){a:{switch(a&&a.id){case "image/jpeg":case "image/png":case "image/gif":case "image/ico":case "image/tiff":case "image/svg":b=!0;break a}b=!1}b=!b}b&&(z=i.hrefCallback({items:h}));if(o){b=o;var e=h.Location,c=r,j;switch(a&&a.id){case "image/jpeg":case "image/png":case "image/gif":case "image/ico":case "image/tiff":case "image/svg":j=document.createElement("img");
j.src=e;j.classList.add("thumbnail");break;default:if(a&&a.image)j=document.createElement("img"),j.src=a.image,j.classList.add("thumbnail")}j&&b.replaceChild(j,c)}u.href=z})}return u}function e(a,b,e,c){this.explorer=b;this.commandService=e;this.contentTypeService=c;this.openWithCommands=null;this.actionScopeId=a.actionScopeId;this._init(a);this.target="_self"}var a=new b("#{,resource,params*}");e.prototype=new i.SelectionRenderer;e.prototype.wrapperCallback=function(a){a.setAttribute("role","tree")};
e.prototype.tableCallback=function(a){a.setAttribute("aria-label",g.Navigator);a.setAttribute("role","presentation")};e.prototype.rowCallback=function(a){a.setAttribute("role","treeitem")};e.prototype.emptyCallback=function(a){var b=document.createElement("tr"),e=document.createElement("td");e.colSpan=this.oneColumn?1:3;var c=document.createElement("div");c.classList.add("noFile");c.textContent=g.NoFile;var d=document.createElement("span");d.classList.add("core-sprite-addcontent");d.classList.add("icon-inline");
d.classList.add("imageSprite");h.processDOMNodes(c,[d]);e.appendChild(c);b.appendChild(e);a.appendChild(b)};e.prototype.getCellHeaderElement=function(a){if(this.oneColumn&&a!==0)return null;switch(a){case 0:case 1:case 2:document.createElement("th").style.height="8px"}};e.prototype.setTarget=function(a){this.target=a};e.prototype.getFolderImage=function(){if(!this.showFolderImage)return null;var a=document.createElement("span");a.className="core-sprite-folder modelDecorationSprite";return a};e.prototype.createFolderNode=
function(a){var b;this.showFolderLinks?(b=k(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};e.prototype.showFolderLinks=!0;e.prototype.getCellElement=function(a,b,e){switch(a){case 0:var a=document.createElement("td"),d=document.createElement("span");d.id=e.id+"MainCol";d.setAttribute("role","presentation");a.appendChild(d);a.setAttribute("role","presentation");
d.className="mainNavColumn";var h;if(b.Directory)this.getExpandImage(e,d),h=this.createFolderNode(b),d.appendChild(h),this.explorer._makeDropTarget(b,h),this.explorer._makeDropTarget(b,e);else{if(!this.openWithCommands){this.openWithCommands=c.getOpenWithCommands(this.commandService);for(h=0;h<this.openWithCommands.length;h++)if(this.openWithCommands[h].isEditor==="default")this.defaultEditor=this.openWithCommands[h]}h=k("",b,this.commandService,this.contentTypeService,this.openWithCommands,this.defaultEditor,
{target:this.target});d.appendChild(h)}if(h)h.id=e.id+"NameLink",h.nodeType===1&&(f.addNavGrid(this.explorer.getNavDict(),b,h),h.setAttribute("role","link"),h.setAttribute("tabindex","-1"));this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,d,b,this.explorer,"tool",null,!0);return a;case 1:if(this.oneColumn)return null;e=document.createElement("td");if(b.LocalTimeStamp)e.textContent=(new Date(b.LocalTimeStamp)).toLocaleString();return e;case 2:if(this.oneColumn)return null;
e=document.createElement("td");if(!b.Directory&&typeof b.Length==="number")b=parseInt(b.Length,10)/1024,e.textContent=Math.ceil(b).toLocaleString()+" KB";e.style.textAlign="right";return e}};e.prototype.constructor=e;return{NavigatorRenderer:e,createLink:k}});
define("orion/keyBinding",["orion/util"],function(g){function l(f,c,d,b,h,k){this.type=k||"keydown";this.keyCode=typeof f==="string"&&this.type==="keydown"?f.toUpperCase().charCodeAt(0):f;this.mod1=c!==void 0&&c!==null?c:!1;this.mod2=d!==void 0&&d!==null?d:!1;this.mod3=b!==void 0&&b!==null?b:!1;this.mod4=h!==void 0&&h!==null?h:!1}function i(f){this.keys=f}l.prototype={getKeys:function(){return[this]},match:function(f,c){if(c!==void 0){if(c!==0)return!1}else if(f instanceof Array){if(f.length>1)return!1;
f=f[0]}return f.type!==this.type?!1:this.keyCode===f.keyCode||this.keyCode===String.fromCharCode(g.isOpera?f.which:f.charCode!==void 0?f.charCode:f.keyCode)?this.mod1!==(g.isMac?f.metaKey:f.ctrlKey)?!1:this.type==="keydown"&&this.mod2!==f.shiftKey?!1:this.mod3!==f.altKey?!1:g.isMac&&this.mod4!==f.ctrlKey?!1:!0:!1},equals:function(f){return!f?!1:this.keyCode!==f.keyCode?!1:this.mod1!==f.mod1?!1:this.mod2!==f.mod2?!1:this.mod3!==f.mod3?!1:this.mod4!==f.mod4?!1:this.type!==f.type?!1:!0}};i.prototype=
{getKeys:function(){return this.keys.slice(0)},match:function(f,c){var d=this.keys;if(c!==void 0)return c>d.length?!1:d[c].match(f)?c===d.length-1?!0:c+1:!1;else{f instanceof Array||(f=[f]);if(f.length>d.length)return!1;var b;for(b=0;b<f.length;b++)if(!d[b].match(f[b]))return!1;return b===d.length?!0:b}},equals:function(f){if(!f.keys)return!1;if(f.keys.length!==this.keys.length)return!1;for(var c=0;c<f.keys.length;c++)if(!f.keys[c].equals(this.keys[c]))return!1;return!0}};return{KeyBinding:l,KeyStroke:l,
KeySequence:i}});
define("orion/compare/compareUtils",["orion/URITemplate"],function(g){var l=l||{};l.compareUtils=l.compareUtils||{};l.compareUtils.lookUpMapper=function(g,f,c){for(var d=0,b=0;b<g.length;b++){var h=g[b][f];h===0&&(h=1);if(c>=d&&c<d+h)return{mapperIndex:b,startFrom:d};if(b===g.length-1)break;d+=g[b][f]}return{mapperIndex:g.length-1,startFrom:d}};l.compareUtils.lookUpLineIndex=function(g,f,c){if(c===0)return 0;for(var d=0,b=0;b<c;b++)d+=g[b][f];return d};l.compareUtils.updateMapper=function(g,f,c,d,
b){if(d!==b&&(d>0||b>0)){var h=l.compareUtils.lookUpMapper(g,f,c);if(!(h.mapperIndex<0)){if(d>0)for(var k=c-h.startFrom,c=h.mapperIndex;c<g.length;c++){k=g[c][f]-k;if(d<=k){g[c][f]-=d;break}g[c][f]-=k;d-=k;k=0}b>0&&(g[h.mapperIndex][f]+=b)}}};l.compareUtils.overlapMapper=function(g,f,c,d,b){g=c+g[f]-1;g<c&&(g=c);b<d&&(b=d);return g<d||b<c?!1:!0};l.compareUtils.findFirstDiff=function(g,f,c,d){for(var b=0,h=null,k=0;k<g.length;k++){if(b>d)break;if(l.compareUtils.overlapMapper(g[k],f,b,c,d)&&(h={mapperIndex:k,
startFrom:b},g[k][2]!==0))break;b+=g[k][f]}return h};l.compareUtils.matchMapper=function(g,f,c,d){if(g.length===0)return c;var b=c+Math.round((d-c)/3),h=l.compareUtils.findFirstDiff(g,f,c,d),k=g[h.mapperIndex][f]===0?h.startFrom:h.startFrom+g[h.mapperIndex][f]-1,e=l.compareUtils.lookUpLineIndex(g,1-f,h.mapperIndex),a=h.startFrom-c;return g[h.mapperIndex][2]===0?e-a:b>=h.startFrom&&b<=k?e-Math.round((d-c)/3):b<h.startFrom?e-a:(g[h.mapperIndex][1-f]===0?e:e+g[h.mapperIndex][1-f]-1)-(k-c)};l.compareUtils.getMapperLineCount=
function(g){for(var f=0,c=0;c<g.length;c++)f+=Math.max(g[c][0],g[c][1]);return f};l.compareUtils.getAnnotationIndex=function(g,f){for(var c=0;c<g.length;c++)if(g[c][0]===f)return c;return-1};l.compareUtils.getAnnotationMapperIndex=function(g,f){return g[f][1]};l.compareUtils.getAnnotationIndexByMapper=function(g,f){for(var c=0;c<g.length;c++)if(g[c][1]===f)return{current:c,prev:c-1,next:c+1};return{current:-1,prev:-1,next:-1}};l.compareUtils.isMapperConflict=function(g,f){return f<0?!1:!g[f][3]?!1:
g[f][3]===1};l.compareUtils.mergeDiffBlocks=function(g,f,c,d,b,h){for(var k=0;k<f.length;k++){var e=f[k][0],a=c[f[k][1]];if(a[0]>0){for(var j="",p=0;p<a[0];p++)j=j+d[a[2]-1+p].substring(b)+h;a=g.getLineCount();e>=a&&(e=a-1);e=g.getLineStart(e);g.setText(j,e,e)}}};l.compareUtils.generateCompareHref=function(i,f){var c=require.toUrl("compare/compare.html");if(!f.conflict)f.conflict=void 0;if(!f.readonly)f.readonly=void 0;return(new g(c+"#{,resource,params*}")).expand({resource:i,params:f})};l.compareUtils.generateCompareTreeHref=
function(i,f){var c=require.toUrl("compare-tree/compare-tree.html");return(new g(c+"#{,resource,params*}")).expand({resource:i,params:f})};return l.compareUtils});
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"," <No available services or timed out, check URL and try reloading>":" <No available services or timed out, check URL and try reloading>",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 (? = any character, * = any string):":"Type the name of a file to open (? = any character, * = any string):",Search:"Search","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 ","</a>":"</a>",">":">","Sign In To ":"Sign In To ","Sign In":"Sign In",Help:"Help","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"});
define("orion/widgets/nls/messages",["orion/i18n!orion/widgets/nls/messages","orion/widgets/nls/root/messages"],function(g,l){var i={root:l};Object.keys(g).forEach(function(f){typeof i[f]==="undefined"&&(i[f]=g[f])});return i});
define("orion/webui/dialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/uiUtils"],function(g,l,i,f){function c(){}c.prototype={DISABLED:"disabled",CONTAINERTEMPLATE:'<div class="dialog" role="dialog"><div class="dialogTitle"><span id="title" class="dialogTitleText layoutLeft"></span><button aria-label="Close" class="dismissButton layoutRight core-sprite-close imageSprite" id="closeDialog"></button></div><div id="dialogContent" class="dialogContent layoutBlock"></div><div id="buttons" class="dialogButtons"></div></div>',_initialize:function(){var c=
document.body;this.$frameParent=c;this.$$modalExclusions=this.$$modalExclusions||[];var b=document.createRange();b.selectNode(c);b=b.createContextualFragment(this.CONTAINERTEMPLATE);c.appendChild(b);this.$frame=c.lastChild;this.title&&i.$("#title",this.$frame).appendChild(document.createTextNode(this.title));this.$close=i.$("#closeDialog",this.$frame);var h=this;this.$close.addEventListener("click",function(){h.hide()},!1);this.$parent=i.$(".dialogContent",this.$frame);b=document.createRange();b.selectNode(this.$parent);
c=b.createContextualFragment(this.TEMPLATE);this.messages&&i.processTextNodes(c,this.messages);this.$parent.appendChild(c);this.$buttonContainer=i.$(".dialogButtons",this.$frame);this._makeButtons();this.$frame.addEventListener("keydown",function(b){b.keyCode===i.KEY.ESCAPE?h.hide():b.keyCode===i.KEY.ENTER&&typeof h._defaultCallback==="function"&&h._defaultCallback()},!1);this._bindElements(this.$parent);typeof this._bindToDom==="function"&&this._bindToDom(this.$parent);this.modal&&this._makeModal()},
_makeButtons:function(){if(this.$buttonContainer&&Array.isArray(this.buttons)){var c=this;this.buttons.forEach(function(b){var h=f.createButton(b.text,b.callback);if(b.id)h.id=b.id,c["$"+h.id]=h;if(b.isDefault)c._defaultCallback=b.callback,c._defaultButton=h;c.$buttonContainer.appendChild(h)})}},_makeModal:function(){var c=this;this.$frame.addEventListener("blur",function(a){c.$lastFocusedElement=a.target},!0);this._modalListener=function(a){var b=!i.contains(c.$frame,a.target);if(b)for(var e=0;e<
c.$$modalExclusions.length;e++)if(i.contains(c.$$modalExclusions[e],a.target)){b=!1;break}b&&(window.setTimeout(function(){(c.$lastFocusedElement||c.$parent).focus()},0),i.stop(a))};this.$frameParent.addEventListener("focus",this._modalListener,!0);this.$frameParent.addEventListener("click",this._modalListener,!0);var b=this.$frameParent.childNodes,h=!1;this._addedBackdrop=[];for(var f=0;f<b.length;f++){for(var e=0;e<this.$$modalExclusions.length;e++)if(i.contains(this.$$modalExclusions[e],b[f])){h=
!0;break}!h&&b[f]!==c.$frame&&b[f].classList&&!b[f].classList.contains("tooltipContainer")&&(e=b[f],e.classList.contains("modalBackdrop")||(e.classList.add("modalBackdrop"),this._addedBackdrop.push(e)))}(b=i.lastTabbable(this.$buttonContainer)||i.lastTabbable(this.$parent))&&b.addEventListener("keydown",function(a){if(a.keyCode===i.KEY.TAB){var b=c._getFirstFocusField();b&&b!==a.target&&b.focus();i.stop(a)}},!1)},_addChildDialog:function(c){this.$$modalExclusions.push(c.$frame||c.$parent)},_bindElements:function(c){for(var b=
0;b<c.childNodes.length;b++){var h=c.childNodes[b];h.id&&(this["$"+h.id]=h);this._bindElements(h)}},hide:function(){typeof this._beforeHiding==="function"&&this._beforeHiding();this._modalListener&&(this.$frameParent.removeEventListener("focus",this._modalListener,!0),this.$frameParent.removeEventListener("click",this._modalListener,!0));this.$frame.classList.remove("dialogShowing");typeof this._afterHiding==="function"&&this._afterHiding();var c=this;this.keepAlive||window.setTimeout(function(){c.destroy()},
0)},show:function(c){typeof this._beforeShowing==="function"&&this._beforeShowing();var b=i.bounds(this.$frame),h=i.bounds(document.documentElement),f;c?(f=i.bounds(c),c=f.top+f.height+4,f=f.left+4,c+b.height>h.height&&(c=Math.max(0,h.height-b.height-4)),f+b.width>h.width&&(f=Math.max(0,h.width-b.width-4))):(f=Math.max(0,(h.width-b.width)/2),c=Math.max(0,(h.height-b.height)/2));this.$lastFocusedElement=document.activeElement;this.$frame.style.top=c+"px";this.$frame.style.left=f+"px";this.$frame.classList.add("dialogShowing");
typeof this._afterShowing==="function"&&this._afterShowing();this.customFocus||this._getFirstFocusField().focus()},_getFirstFocusField:function(){return i.firstTabbable(this.$parent)||this._defaultButton||i.firstTabbable(this.$buttonContainer)||this.$close},destroy:function(){this._addedBackdrop&&this._addedBackdrop.length>0&&this._addedBackdrop.forEach(function(c){c.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}};c.prototype.constructor=c;return{Dialog:c}});
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(g,l,i,f,c,d,b,h){function k(a,b){this.explorer=b;this._init(a)}function e(a){this._init(a)}k.prototype=new b.SelectionRenderer;k.prototype.constructor=k;k.prototype.getLabelColumnIndex=function(){return 0};k.prototype.getCellElement=
function(a,b,e){a=document.createElement("td");e.appendChild(a);var c=document.createElement("span");c.id=e.id+"navSpan";a.appendChild(c);c.className="mainNavColumn singleNavColumn";this.getExpandImage(e,c);c.appendChild(document.createTextNode(b.Name))};e.prototype=new i.Dialog;e.prototype.TEMPLATE='<div id="message" style="width: 25em; padding-bottom: 5px;"></div><div id="directoryTree" class="explorerTreeClass" style="width:25em; min-height: 25em; max-height:30em; height: auto; overflow-y: auto;"></div>';
e.prototype._init=function(a){this.title=a.title||g["Choose a Folder"];this.modal=!0;this.buttons=[{text:g.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()};e.prototype._bindToDom=function(){this.loadFolderList("/");this._message?this.$message.appendChild(document.createTextNode(this._message)):this.$message.style.display="none";this.$directoryTree.focus()};
e.prototype.loadFolderList=function(a){a=f.makeRelative(a);this.selection=new c.Selection(this._serviceRegistry,"orion.directoryPrompter.selection");this.explorer=new h.FileExplorer({treeRoot:{children:[]},selection:this.selection,serviceRegistry:this._serviceRegistry,fileClient:this._fileClient,parentId:"directoryTree",excludeFiles:!0,rendererFactory:function(a){return new k({checkbox:!1,singleSelection:!0,treeTableClass:"directoryPrompter"},a)}});this.explorer.loadResourceList(a,!0,null)};e.prototype.done=
function(){this.selection.getSelection(function(a){this.hide();this._func(a)}.bind(this))};e.prototype.constructor=e;return{DirectoryPrompterDialog:e}});
define("orion/webui/popupdialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/webui/tooltip"],function(g,l,i,f){function c(){}c.prototype={_initialize:function(c,b,h,k,e){this._tooltip=new f.Tooltip({node:c,hideDelay:e||0,afterShowing:this._afterShowingFunction(b).bind(this),afterHiding:h,trigger:k?k:"click"});this.$parent=this._tooltip.contentContainer();this.$parent.role="dialog";c=document.createRange();c.selectNode(this.$parent);c=c.createContextualFragment(this.TEMPLATE);
this.messages&&i.processTextNodes(c,g);this.$parent.appendChild(c);var a=this._tooltip;this.$parent.addEventListener("keydown",function(b){b.keyCode===i.KEY.ESCAPE&&a.hide()},!1);this._bindElements(this.$parent);typeof this._bindToDom==="function"&&this._bindToDom(this.$parent)},_bindElements:function(c){for(var b=0;b<c.childNodes.length;b++){var h=c.childNodes[b];h.id&&(this["$"+h.id]=h);this._bindElements(h)}},_afterShowingFunction:function(c){return function(){c&&c.bind(this)();if(!this.customFocus){var b=
i.firstTabbable(this.$parent);b&&b.focus()}}},hide:function(){this._tooltip.hide()},show:function(){this._tooltip.show()}};c.prototype.constructor=c;return{PopupDialog:c}});
define("orion/webui/dialogs/SFTPConnectionDialog",["i18n!orion/widgets/nls/messages","orion/webui/littlelib","orion/webui/popupdialog","orion/webui/dialog"],function(g,l,i,f){function c(b,c){this.messages=g;this._initialize(b);this._notify=c}function d(b){this._init(b)}localStorage.getItem("orion.sftpConnections")||localStorage.setItem("orion.sftpConnections",JSON.stringify({identifier:"name",label:g.name,items:[]}));c.prototype=new i.PopupDialog;c.prototype.TEMPLATE='<div><label for="sftpHost">${Remote host:}</label><input id="sftpHost" /></div><div><label for="sftpPort">${Port:}</label><input id="sftpPort" /></div><div><label for="sftpPath">${Remote path:}</label><input id="sftpPath" /></div><div><label for="sftpUser">${User name:}</label><input id="sftpUser" /></div><div class="layoutBlock layoutRight"><button id="addSftpConnection" class="dropdownTrigger orionButton commandButton">${Add}</button></div>';
c.prototype._bindToDom=function(){this.$addSftpConnection.addEventListener("click",function(){this._notify({name:this.$sftpUser.value+"@"+this.$sftpHost.value+":"+this.$sftpPort.value+this.$sftpPath.value});this.hide()}.bind(this),!1)};c.prototype.constructor=c;d.prototype=new f.Dialog;d.prototype.TEMPLATE='<div><div><label for="sftpPath">${Location:}</label></div><div><select id="sftpConnectionList" name="sftpConnectionList"></select><button id="newSftpConnection" style="margin-left: 16px;" class="dropdownTrigger orionButton commandButton">${New}<span class="dropdownArrowDown core-sprite-downarrow"></span></button></div><div><label for="sftpPassword">${Password:}</label></div><div><input id="sftpPassword" type="password" /></div><p>${If the same file exists in both the source and destination:}</p><input type="radio" name="overwriteOption" id="overwriteCancel" checked value="overwriteCancel" /><label for="overwriteCancel">${Cancel the transfer}</label><br /><input type="radio" name="overwriteOption" id="overwriteAll" value="overwriteAll" /><label for="overwriteAll">${Always overwrite destination}</label><br /><input type="radio" name="overwriteOption" id="overwriteOlder" value="overWriteOlder" /><label for="overwriteOlder">${Overwrite if source is newer}</label></div>';
d.prototype._init=function(b){this.title="SFTP Transfer";this.messages=g;this.modal=!0;this.buttons=[{text:g["Start Transfer"],callback:this.done.bind(this)}];this.sftpConnectionStoreData=JSON.parse(localStorage.getItem("orion.sftpConnections"));this._func=b.func;this._initialize()};d.prototype._bindToDom=function(){this.$sftpConnectionList.style.minWidth="220px";this._popupDialog=new c(this.$newSftpConnection,this.onAddConnection.bind(this));this._addChildDialog(this._popupDialog);this._populateSelect()};
d.prototype._afterHiding=function(){this._popupDialog.hide()};d.prototype.done=function(){var b=this.$sftpConnectionList.value.split("@"),c,d,e;if(b.length===2)e=b[0],d=b[1];else if(b.length===3)e=b[0]+"@"+b[1],d=b[2];else{this.hide();return}var a=d.indexOf(":");a<=0&&(c=22);var j=d.indexOf("/");j<=0||(c?b=d.substring(0,j):(b=d.substring(0,a),c=d.substring(a+1,j)),d=d.substring(j),this._func(b,c,d,e,this.$sftpPassword.value,this._computeOverwriteValue()));this.hide()};d.prototype._computeOverwriteValue=
function(){if(this.$overwriteCancel.checked)return"no-overwrite";else if(this.$overwriteOlder.checked)return"overwrite-older";return""};d.prototype._populateSelect=function(){l.empty(this.$sftpConnectionList);for(var b=0;b<this.sftpConnectionStoreData.items.length;b++){var c=this.sftpConnectionStoreData.items[b].name,d=document.createElement("option");d.appendChild(document.createTextNode(c));d.value=c;this.$sftpConnectionList.appendChild(d)}};d.prototype.onAddConnection=function(b){for(var c=!1,
d=0;d<this.sftpConnectionStoreData.items.length;d++)if(this.sftpConnectionStoreData.items[d].name===b.name){c=!0;break}if(!c)this.sftpConnectionStoreData.items.unshift(b),localStorage.setItem("orion.sftpConnections",JSON.stringify(this.sftpConnectionStoreData)),this._populateSelect(),this.$sftpConnectionList.value=b.name};d.prototype.constructor=d;return{SFTPConnectionDialog:d}});
define("orion/webui/dialogs/ImportDialog",["i18n!orion/widgets/nls/messages","orion/webui/littlelib","orion/webui/dialog","orion/util"],function(g,l,i,f){function c(c){this._init(c)}c.prototype=new i.Dialog;c.prototype.TEMPLATE='<div ondragover="event.preventDefault()"><div class="uploadContainer" id="uploadContainer"><div class="dottedOutline"><div id="dragArea" class="floatingSection"><div class="uploadInstruction">${Drag a file here}</div><div class="uploadOptions">(<input style="height: 20px;" class="uploadOptionsItem" id="unzipCheckbox" checked="true" type="checkbox"><label style="line-height: 20px;" class="uploadOptionsItem" for="${id}_unzipCheckbox">${unzip zips}</label>)</div><div class="tipInstruction">${or if you prefer}</div></div></div></div><div class="layoutBlock layoutRight"><input type="file" name="selectedFile" id="selectedFile" class="uploadChooser" /><span id="uploadButton" role="button" class="commandButton disabled" tabindex="0">${Upload}</span></div></div>';
c.prototype._init=function(c){this.title=g["Import a file or zip"];this.messages=g;this.modal=!0;this._importLocation=c.importLocation;this._func=c.func;this._initialize()};c.prototype._bindToDom=function(){this.$uploadContainer.addEventListener("dragenter",this.dragEnter.bind(this),!1);this.$uploadContainer.addEventListener("dragover",this.dragOver.bind(this),!1);this.$uploadContainer.addEventListener("dragleave",this.dragLeave.bind(this),!1);this.$uploadContainer.addEventListener("drop",this.drop.bind(this),
!1);this.$selectedFile.addEventListener("change",this.checkUploadState.bind(this),!1);this.$uploadButton.addEventListener("click",this.uploadSelected.bind(this),!1)};c.prototype.handleReadyState=function(c,b){if(this.req.readyState===4){if(this.req.status===400){var h={};try{h=JSON.parse(this.req.responseText)}catch(f){}if(h.JsonData&&h.JsonData.ExistingFiles&&confirm(h.Message+"\nWould you like to retry the import with force overwriting?")){this.uploadFile.bind(this)(b,!0);return}}this.hide();this._func()}};
c.prototype.checkUploadState=function(){this.$selectedFile.files&&this.$selectedFile.files.length>0?this.$uploadButton.classList.remove(this.DISABLED):this.$uploadButton.classList.add(this.DISABLED)};c.prototype.uploadFile=function(c,b){var h=this.$unzipCheckbox.checked&&c.name.indexOf(".zip")===c.name.length-4;this.req=new XMLHttpRequest;this.req.open("post",b?this._importLocation+(this._importLocation.indexOf("?")>0?"&force=true":"?force=true"):this._importLocation,!0);this.req.setRequestHeader("X-Requested-With",
"XMLHttpRequest");this.req.setRequestHeader("Slug",c.name);h||this.req.setRequestHeader("X-Xfer-Options","raw");this.req.setRequestHeader("Content-Type",c.type);this.req.onreadystatechange=function(b){this.handleReadyState.bind(this)(b,c)}.bind(this);this.req.send(c)};c.prototype.uploadSelected=function(){this.$uploadButton.classList.contains(this.DISABLED)||this.$selectedFile.files&&this.$selectedFile.files.length>0&&this.uploadFile(this.$selectedFile.files[0])};c.prototype.dragEnter=function(c){if(!f.isIE&&
(c.dataTransfer.effectAllowed==="all"||c.dataTransfer.effectAllowed==="uninitialized"||c.dataTransfer.effectAllowed.indexOf("copy")>=0))c.dataTransfer.dropEffect="copy";l.stop(c)};c.prototype.dragLeave=function(c){l.stop(c)};c.prototype.dragOver=function(c){if(!f.isIE&&(c.dataTransfer.effectAllowed==="all"||c.dataTransfer.effectAllowed==="uninitialized"||c.dataTransfer.effectAllowed.indexOf("copy")>=0))c.dataTransfer.dropEffect="copy";l.stop(c)};c.prototype.drop=function(c){l.stop(c);c=c.dataTransfer.files;
if(c.length&&c.length>0)for(var b=0;b<c.length;b++)this.uploadFile(c[b])};c.prototype.constructor=c;return{ImportDialog:c}});
define("orion/fileCommands","i18n!orion/navigate/nls/messages,require,orion/webui/littlelib,orion/i18nUtil,orion/uiUtils,orion/fileUtils,orion/commands,orion/commandRegistry,orion/extensionCommands,orion/contentTypes,orion/compare/compareUtils,orion/Deferred,orion/webui/dialogs/DirectoryPrompterDialog,orion/webui/dialogs/SFTPConnectionDialog,orion/webui/dialogs/ImportDialog,orion/EventTarget".split(","),function(g,l,i,f,c,d,b,h,k,e,a,j,p,m,n,s){function q(a,b){var c=a.modelEventDispatcher;c&&typeof c.dispatchEvent===
"function"&&c.dispatchEvent(b)}function t(a){z?z.setProgressResult(a):window.console.log(a)}function v(a,b,e,j,d){var o;b.Location===a.treeRoot.Location?a=i.node(e):(b=a.makeNewItemPlaceHolder(b,e))?(a=b.refNode,o=b.tempNode):a=i.node(e);a?c.getUserText(e+"EditBox",a,!1,j,function(a){a&&(o&&o.parentNode&&o.parentNode.removeChild(o),d(a))}):(e=window.prompt(j))&&d(e)}function x(a){if(!a)return{};Array.isArray(a)&&(a=a.length===1?a[0]:{});return a}function u(a){a=x(a);return a.Location&&d.isAtRoot(a.Location)}
function o(a,b,c,e,o,h){z=c;if(e){var r;r=d.isAtRoot(a.treeRoot.ChildrenLocation)?a.treeRoot:z.progress(b.loadWorkspace(""),"Loading workspace");j.when(r,function(j){j=b.createProject(j.ChildrenLocation,e);h&&(j=c.showWhile(j,h));j.then(function(j){c.progress(b.read(j.ContentLocation,!0),"Reading metadata of newly created project "+e).then(function(b){o&&o(b);q(a,{type:"create",parent:r,newValue:b})},t)},t)},t)}}var r={},w=!1,z=null,y=null,J;r.getModelEventDispatcher=function(){J||(J=new s);return J};
r.uploadFile=function(a,b,c,e,j){this.req=new XMLHttpRequest;this.req.open("post",j?a.ImportLocation+(a.ImportLocation.indexOf("?")>0?"&force=true":"?force=true"):a.ImportLocation,!0);this.req.setRequestHeader("X-Requested-With","XMLHttpRequest");this.req.setRequestHeader("Slug",b.name);e||this.req.setRequestHeader("X-Xfer-Options","raw");this.req.setRequestHeader("Content-Type",b.type);this.req.onreadystatechange=function(){if(this.req.readyState===4){if(this.req.status===400){var j={};try{j=JSON.parse(this.req.responseText)}catch(d){}if(j.JsonData&&
j.JsonData.ExistingFiles&&(c&&c.serviceRegistry?c.serviceRegistry.getService("orion.page.dialog").confirm:confirm)(j.Message+"\nWould you like to retry the import with force overwriting?")){r.uploadFile(a,b,c,e,!0);return}}q(c,{type:"create",parent:a,newValue:null})}}.bind(this);this.req.send(b)};r.updateNavTools=function(a,b,c,e,d,o,h){function r(a,e){var o=i.node(d);if(o){var f=b._contributionsByScopeId[d],a=a||f&&f.localSelectionService||b.getSelectionService();f&&a&&j.when(a.getSelections(),function(a){b.destroy(o);
a=!a||Array.isArray(a)&&!a.length;h&&a?b.renderCommands(o.id,o,e,c,"button"):b.renderCommands(o.id,o,null,c,"button")})}}var f=i.node(e);if(f)b.destroy(f);else throw Error("could not find toolbar "+e);if(y&&o.Location!==y)b.closeParameterCollector(),y=o.Location;b.renderCommands(f.id,f,o,c,"button");d&&r(null,c.treeRoot);if(!w){w=!0;var k=a.getService("orion.page.selection");k.addEventListener("selectionChanged",function(){r(k,c.treeRoot)})}};var A=[];r.createFileCommands=function(r,k,w,y){function s(a){var a=
d.makeRelative(a),a=a.split("#"),a=a[a.length-1],b=a.indexOf("/?");b>0&&(a=a.substring(0,b+1));return a}function J(a,b,c){for(var a=Array.isArray(a)?a:[a],b=function(a){Array.isArray(a)||(a=[a]);var b=[],e=[],d=this;a.forEach(function(a){b.push((c?y.copyFile:y.moveFile).apply(y,[a.Location,d.path,a.Name]).then(function(b){e.push({oldValue:a,newValue:b});G({type:c?"copy":"move",oldValue:a,newValue:b,parent:a.parent})},t))});j.all(b).then(function(){G({type:c?"copyMultiple":"moveMultiple",items:e})})},
e=[],d=0;d<a.length;d++){if(a[d].parent&&a[d].parent.Location)a[d].parent.stripped=a[d].parent.stripped||s(a[d].parent.Location),e.indexOf(a[d].parent.stripped)!==-1||e.push(a[d].parent.stripped);if(a[d].Directory&&!c)a[d].stripped=a[d].stripped||s(a[d].Location),e.push(a[d].stripped)}for(var a=[],o=[],h=w.treeRoot.Children||(w.treeRoot.Workspace?w.treeRoot.Workspace.Children:{}),d=0;d<h.length;d++){var k=h[d];k.stripped=k.stripped||(k.Directory?s(k.Location):null);k.stripped&&e.indexOf(k.stripped)===
-1&&o.push(k)}o.sort(function(a,b){return a.stripped<b.stripped?-1:a.stripped>b.stripped?1:0});for(d=0;d<o.length;d++){for(var e=o[d],h=e.Name,k=e.stripped.split("/").length+1,n=0;n<k-2;n++)h="  "+h;a.push({name:h,path:e.stripped,callback:b})}o.length>0&&a.push({});a.push({name:g["Choose folder..."],callback:function(a){(new p.DirectoryPrompterDialog({title:g["Choose a Folder"],serviceRegistry:r,fileClient:y,func:function(b){if(b&&b.Location){Array.isArray(a)||(a=[a]);var e=[],d=[];a.forEach(function(a){var j=
b.Location,o=a.Name||null,h=c?y.copyFile:y.moveFile,r=f.formatMessage(c?g["Copying ${0}"]:g["Moving ${0}"],a.Location);c&&a.parent&&a.parent.Location===j&&((o=window.prompt(f.formatMessage(g["Enter a new name for '${0}'"],a.Name),f.formatMessage(g["Copy of ${0}"],a.Name)))||(j=null));j&&(j=h.apply(y,[a.Location,b.Location,o]),e.push(z.showWhile(j,r).then(function(b){d.push({oldValue:a,newValue:b});G({type:c?"copy":"move",oldValue:a,newValue:b,parent:a.parent})},t)))});j.all(e).then(function(){G({type:c?
"copyMultiple":"moveMultiple",items:d})})}}})).show()}});return a}function l(a){if(a.parent)return{item:a,parent:a.parent};else if(a.Parents&&a.Parents[0])return{item:a,parent:a.Parents[0]};return y.loadWorkspace(y.fileServiceRootURL(a.Location)).then(function(b){return j.when(b.Children||y.fetchChildren(b)).then(function(c){b.Children=c;c=b.Children.some(function(b){return b.Location===a.Location?(a=b,!0):!1});return{item:a,parent:c?b:null}})})}function N(a){var b=function(a){a=x(a);return a.Directory&&
!d.isAtRoot(a.Location)};return b(w.selection.getSelections())||b(a)}var D=w.commandsId||"";z=r.getService("orion.page.progress");var G=q.bind(null,w),R=function(a){var b=Array.isArray(a)?a:[a];if(b.length===0)return!1;for(var c=0;c<b.length;c++)if(a=b[c],!a.Location||a.Projects)return!1;return!0},H=new b.Command({name:g.Rename,tooltip:g["Rename the selected files or folders"],imageClass:"core-sprite-rename",id:"eclipse.renameResource"+D,visibleWhen:function(a){return Array.isArray(a)?a.length===
1&&a[0].Name:a.Location&&!a.Projects},parameters:new h.ParametersDescription(null,{},function(a){var a=Array.isArray(a.items)?a.items:[a.items],b=w.treeRoot;return a.some(function(a){return a===b})?[new h.CommandParameter("name","text",g["Name:"],b.Name)]:null}),callback:function(a){function b(a){var c=e.Location;j.when(l(e),function(b){e=b.item;var j=b.parent;j&&j.Projects&&j.Projects.some(function(a){return a.Id===e.Id?(c=a.Location,!0):!1});b=y.moveFile(c,j.Location,a);z.showWhile(b,f.formatMessage(g["Renaming ${0}"],
c)).then(function(a){G({type:"move",oldValue:e,newValue:a,parent:j})},t)})}var e=x(a.items),d;a.parameters.hasParameters()&&(d=a.parameters.valueFor("name"))!==null?b(d):((d=w.getNameNode(e))||(d=a.domParent||a.domNode),a=d.id+"EditBox",i.node(a)||c.getUserText(a,d,!0,e.Name,b,null,null,"."))}});k.addCommand(H);var Q=new e.ContentTypeRegistry(r),H=new b.Command({name:g["Compare with each other"],tooltip:g["Compare the selected 2 files with each other"],id:"eclipse.compareWithEachOther"+D,visibleWhen:function(a){if(Array.isArray(a))if(a.length===
2&&!a[0].Directory&&!a[1].Directory){var b=Q.getFilenameContentType(a[0].Name),a=Q.getFilenameContentType(a[1].Name);if(b&&(b["extends"]==="text/plain"||b.id==="text/plain")&&a&&(a["extends"]==="text/plain"||a.id==="text/plain"))return!0}else if(a.length===2&&a[0].Directory&&a[1].Directory)return!0;return!1},hrefCallback:function(b){return b.items[0].Directory&&b.items[1].Directory?a.generateCompareTreeHref(b.items[0].Location,{compareTo:b.items[1].Location,readonly:!0}):a.generateCompareHref(b.items[0].Location,
{compareTo:b.items[1].Location,readonly:!0})}});k.addCommand(H);H=new b.Command({name:g["Compare with..."],tooltip:g["Compare the selected folder with a specified folder"],id:"eclipse.compareWith"+D,visibleWhen:function(a){return Array.isArray(a)&&a.length===1&&a[0].Directory?!0:!1},callback:function(b){(new p.DirectoryPrompterDialog({title:g["Choose a Folder"],serviceRegistry:r,fileClient:y,func:function(c){c&&c.Location&&(c=a.generateCompareTreeHref(b.items[0].Location,{compareTo:c.Location,readonly:!0}),
window.open(c))}})).show()}});k.addCommand(H);H=new b.Command({name:g.Delete,tooltip:g["Delete the selected files or folders"],imageClass:"core-sprite-delete",id:"eclipse.deleteFile"+D,visibleWhen:R,callback:function(a){var b=Array.isArray(a.items)?a.items:[a.items],a=b.length===1?f.formatMessage(g["Are you sure you want to delete '${0}'?"],b[0].Name):f.formatMessage(g["Are you sure you want to delete these ${0} items?"],b.length);r.getService("orion.page.dialog").confirm(a,function(a){if(a){var c=
[],a=b.map(function(a){var b=a.Location;return j.when(l(a),function(e){a=e.item;var d=e.parent;d&&d.Projects&&(b=null,d.Projects.some(function(c){return c.Id===a.Id?(b=c.Location,!0):!1}));if(!b)return(new j).resolve();e=y.deleteFile(b);return z.showWhile(e,f.formatMessage(g["Deleting ${0}"],b)).then(function(){c.push({oldValue:a,newValue:null,parent:d});G({type:"delete",oldValue:a,newValue:null,parent:d})},t)})});j.all(a).then(function(){G({type:"deleteMultiple",items:c})},t)}})}});k.addCommand(H);
H=new b.Command({name:g["Export as zip"],tooltip:g["Create a zip file of the folder contents and download it"],imageClass:"core-sprite-exportzip",id:"eclipse.downloadFile"+D,visibleWhen:function(a){a=x(a);return a.ExportLocation&&a.Directory},hrefCallback:function(a){return x(a.items).ExportLocation}});k.addCommand(H);H=new h.ParametersDescription([new h.CommandParameter("name","text",g["Name:"],g["New File"])]);H=new b.Command({name:g["New File"],tooltip:g["Create a new file"],imageClass:"core-sprite-new_file",
id:"eclipse.newFile"+D,parameters:H,callback:function(a){w.selection.getSelections(function(b){var c;c=b.length===1&&b[0].Directory?b[0]:x(a.items);b=function(a){if(a){var b=y.createFile(c.Location,a);z.showWhile(b,f.formatMessage(g["Creating ${0}"],a)).then(function(a){G({type:"create",parent:c,newValue:a})},t)}};a.parameters&&a.parameters.valueFor("name")?b(a.parameters.valueFor("name")):v(w,c,a.domNode.id,g["New File"],b)})},visibleWhen:N});k.addCommand(H);var H=new h.ParametersDescription([new h.CommandParameter("name",
"text",g["Folder name:"],g["New Folder"])]),M=new b.Command({name:g["New Folder"],tooltip:g["Create a new folder"],imageClass:"core-sprite-new_folder",id:"eclipse.newFolder"+D,parameters:H,callback:function(a){w.selection.getSelections(function(b){var c;c=b.length===1&&b[0].Directory?b[0]:x(a.items);b=function(a){if(a){var b=y.createFolder(c.Location,a);z.showWhile(b,f.formatMessage(g["Creating ${0}"],a)).then(function(a){G({type:"create",parent:c,newValue:a})},t)}};a.parameters&&a.parameters.valueFor("name")?
b(a.parameters.valueFor("name")):v(w,c,a.domNode.id,g["New Folder"],b)})},visibleWhen:function(a){a=x(a);return a.Directory&&!d.isAtRoot(a.Location)}});k.addCommand(M);var F=new h.ParametersDescription([new h.CommandParameter("url","url",g["File URL:"],"URL"),new h.CommandParameter("unzip","boolean",g["Unzip *.zip files:"],!0)]),F=new b.Command({name:g["Import from HTTP..."],tooltip:g["Copy a file from a URL and optionally unzip it"],id:"orion.importZipURL"+D,parameters:F,callback:function(a){var b=
x(a.items),c=a.parameters&&a.parameters.valueFor("url");if(b&&c){var e=b.ImportLocation+(b.ImportLocation.indexOf("?")===-1?"?":"&")+"source="+c,a=a.parameters&&a.parameters.valueFor("unzip")&&c.indexOf(".zip")===c.length-4?"":"raw",e=y.remoteImport(e,{OptionHeader:a});z.showWhile(e,f.formatMessage(g["Importing from ${0}"],c)).then(function(){G({type:"import",target:b})})}},visibleWhen:N});k.addCommand(F);H=new b.Command({name:g["New Folder"],parameters:H,imageClass:"core-sprite-new_folder",tooltip:g["Create an empty folder"],
description:g["Create an empty folder on the Orion server.  You can import, upload, or create content in the editor."],id:"orion.new.project"+D,callback:function(a){w.selection.getSelections(function(b){b.length===1&&b[0].Directory?M.callback(a):(x(a.items),a.parameters&&a.parameters.valueFor("name")?o(w,y,z,a.parameters.valueFor("name")):v(a.items,a.domNode.id,g["New Folder"],function(a){o(w,y,z,a)}))})},visibleWhen:u});k.addCommand(H);H=new b.Command({name:g["Link to Server"],tooltip:g["Link to existing content on the server"],
description:g["Create a folder that links to an existing folder on the server."],imageClass:"core-sprite-link",id:"orion.new.linkProject"+D,parameters:new h.ParametersDescription([new h.CommandParameter("name","text","Name:","New Folder"),new h.CommandParameter("url","url",g["Server path:"],"")]),callback:function(a){var b=function(a,b){if(a&&b){var c=y.createProject(w.treeRoot.ChildrenLocation,a,b,!0);z.showWhile(c,f.formatMessage(g["Linking to ${0}"],b)).then(function(a){q(w,{type:"create",parent:w.treeRoot,
newValue:a})},t)}};a.parameters&&a.parameters.valueFor("name")&&a.parameters.valueFor("url")?b(a.parameters.valueFor("name"),a.parameters.valueFor("url")):t(g["The name and server location were not specified."])},visibleWhen:u});k.addCommand(H);H=new b.Command({name:g["Go Up"],tooltip:g["Move up to the parent folder"],imageClass:"core-sprite-go-up",id:"eclipse.upFolder"+D,callback:function(){typeof w.scopeUp==="function"&&w.scopeUp()},visibleWhen:function(a){a=x(a);return a.Parents}});k.addCommand(H);
H=new b.Command({name:g["Go Into"],tooltip:g["Move into the selected folder"],imageClass:"core-sprite-go-down",id:"eclipse.downFolder"+D,callback:function(){typeof w.scopeDown==="function"&&w.selection.getSelections(function(a){w.scopeDown(a[0])})},visibleWhen:function(){var a=w.selection.getSelections();return a.length===1&&a[0].Directory}});k.addCommand(H);H=new b.Command({name:g["Import local file..."],tooltip:g["Copy files and folders from your local file system"],imageClass:"core-sprite-importzip",
id:"orion.import"+D,callback:function(a){var b=x(a.items);(new n.ImportDialog({importLocation:b.ImportLocation,func:function(){G({type:"import",target:b})}})).show()},visibleWhen:N});k.addCommand(H);H=new b.Command({name:g["SFTP from..."],tooltip:g["Copy files and folders from a specified SFTP connection"],imageClass:"core-sprite-transferin",id:"orion.importSFTP"+D,callback:function(a){var b=x(a.items);(new m.SFTPConnectionDialog({func:function(a,c,e,j,d,o){c=y.remoteImport(b.ImportLocation,{OptionHeader:o?
"sftp,"+o:"sftp",Host:a,Port:c,Path:e,UserName:j,Passphrase:d});z.showWhile(c,f.formatMessage(g["Importing from ${0}"],a)).then(function(a){G({type:"import",target:b});t(a)},t)}})).show()},visibleWhen:N});k.addCommand(H);H=new b.Command({name:g["SFTP to..."],tooltip:g["Copy files and folders to a specified SFTP location"],imageClass:"core-sprite-transferout",id:"eclipse.exportSFTPCommand"+D,callback:function(a){var b=x(a.items);(new m.SFTPConnectionDialog({func:function(a,c,e,j,d,o){c=y.remoteExport(b.ExportLocation,
{OptionHeader:o?"sftp,"+o:"sftp",Host:a,Port:c,Path:e,UserName:j,Passphrase:d});z.showWhile(c,f.formatMessage(g.Exporting,a)).then(t,t)}})).show()},visibleWhen:N});k.addCommand(H);H=new b.Command({name:g["Copy to"],tooltip:"Copy files and folders to a specified location",id:"eclipse.copyFile"+D,choiceCallback:function(a,b){return J(a,b,!0)},visibleWhen:R});k.addCommand(H);R=new b.Command({name:g["Move to"],tooltip:g["Move files and folders to a new location"],id:"eclipse.moveFile"+D,choiceCallback:function(a,
b){return J(a,b,!1)},visibleWhen:R});k.addCommand(R);R=new b.Command({name:g["Copy Items"],tooltip:g["Copy the selected items to the copy/paste buffer"],id:"eclipse.copySelections"+D,callback:function(){w.selection.getSelections(function(a){A=a})}});k.addCommand(R);D=new b.Command({name:g["Paste Items"],tooltip:g["Paste items from the copy/paste buffer"],id:"eclipse.pasteSelections"+D,visibleWhen:N,callback:function(a){w.selection.getSelections(function(b){var c;c=b.length===1&&b[0].Directory?b[0]:
x(a.items);if(A.length>0)if(d.isAtRoot(c.Location))t(g["Cannot paste into the root"]);else{var e=[],o=[];A.forEach(function(a){var b=a.Location,j=a.Name||null;b&&(a.parent&&a.parent.Location===c.Location&&((j=window.prompt(f.formatMessage(g["Enter a new name for '${0}'"],a.Name),f.formatMessage(g["Copy of ${0}"],a.Name)))||(b=null)),b&&(a=y.copyFile(b,c.Location,j),o.push(z.showWhile(a,f.formatMessage(g["Pasting ${0}"],b)).then(function(a){e.push({oldValue:c,newValue:a});G({type:"copy",oldValue:c,
newValue:a})},t))))});j.all(o).then(function(){G({type:"copyMultiple",items:e})})}})}});k.addCommand(D)};r.createNewContentCommand=function(a,c,e,j,d,r,f){var j=e?[]:[new h.CommandParameter("folderName","text",g["Folder name:"],c),new h.CommandParameter("url","url",g["Extracted from:"],j),new h.CommandParameter("unzip","boolean",g["Unzip *.zip files:"],!0)],k=null;j.length>0&&(k=new h.ParametersDescription(j));return new b.Command({name:c,parameters:k,id:a+(d.commandsId||""),callback:function(a){if(e)window.open(e);
else if(a.parameters&&a.parameters.valueFor("folderName")){var b=a.parameters.valueFor("folderName");o(d,r,f,b,function(b){a.parameters.clientCollect=!0;a.commandRegistry.runCommand("orion.importZipURL",b,d,a.parameters)})}else v(d,a.items,a.domNode.id,c,function(b){o(d,r,f,b,function(b){a.commandRegistry.runCommand("orion.importZipURL",b,d,a.parameters)})})},visibleWhen:u})};return r});
define("orion/projectCommands","i18n!orion/navigate/nls/messages,orion/webui/littlelib,orion/commands,orion/Deferred,orion/webui/dialogs/DirectoryPrompterDialog,orion/commandRegistry,orion/i18nUtil,orion/webui/dialogs/ImportDialog".split(","),function(g,l,i,f,c,d,b,h){function k(a){if(!a)return{};Array.isArray(a)&&(a=a.length===1?a[0]:{});return a}function e(a,b,c,e,j,h,f,o,r){var k;k=j.actionComment?r?j.actionComment.replace(/\$\{([^\}]+)\}/g,function(a,b){return r[b]}):j.actionComment:"Getting content from "+
j.type;m.showWhile(j.initDependency(h,r,f),k).then(function(c){a.addProjectDependency(f,c).then(function(){b.changedItem()},e)},function(a){if(a.retry&&a.addParamethers){for(var b=[],j=0;j<a.addParamethers.length;j++)b.push(new d.CommandParameter(a.addParamethers[j].id,a.addParamethers[j].type,a.addParamethers[j].name));o.parameters=new d.ParametersDescription(b);o.oldParams=r;c.collectParameters(o)}e(a)})}var a={},j=!1,p=null,m;a.updateNavTools=function(a,b,c,e,d,h,k){function o(a,e){var j=l.node(d);
if(j){var o=b._contributionsByScopeId[d],a=a||o&&o.localSelectionService||b.getSelectionService();o&&a&&f.when(a.getSelections(),function(a){b.destroy(j);a=!a||Array.isArray(a)&&!a.length;k&&a?b.renderCommands(j.id,j,e,c,"button"):b.renderCommands(j.id,j,null,c,"button")})}}var r=l.node(e);if(r)b.destroy(r);else throw Error("could not find toolbar "+e);if(h.Location!==p)b.closeParameterCollector(),p=h.Location;b.renderCommands(r.id,r,h,c,"button");p&&b.processURL(window.location.href);d&&o(null,c.treeRoot);
if(!j){j=!0;var w=a.getService("orion.page.selection");w.addEventListener("selectionChanged",function(){o(w,c.treeRoot)})}};a.createDependencyCommands=function(a,c,j,d,h,f){function p(a){m?m.setProgressResult(a):window.console.log(a)}m=a.getService("orion.page.progress");a=new i.Command({name:"Connect",tooltip:"Fetch content",id:"orion.project.dependency.connect",callback:function(a){var b=k(a.items),d=a.oldParams||{};if(a.parameters)for(var f in a.parameters.parameterTable)d[f]=a.parameters.valueFor(f);
f=h.getProjectHandler(b.Dependency.Type);f.then?f.then(function(f){e(h,j,c,p,f,b.Dependency,b.Project,a,d)}):e(h,j,c,p,f,b.Dependency,b.Project,a,d)},visibleWhen:function(a){if(!a.Dependency||!a.Project||!a.disconnected)return!1;for(var b=0;b<f.length;b++)if(f[b]===a.Dependency.Type)return!0;return!1}});c.addCommand(a);a=new i.Command({name:"Disconnect from project",tooltip:"Do not treat this folder as a part of the project",imageClass:"core-sprite-delete",id:"orion.project.dependency.disconnect",
callback:function(a){a=k(a.items);m.progress(h.removeProjectDependency(a.Project,a.Dependency),b.formatMessage("Removing ${0} from project ${1}",a.Dependency.Name,a.Project.Name)).then(function(){j.changedItem()})},visibleWhen:function(a){return!a.Dependency||!a.Project?!1:!0}});c.addCommand(a)};a.createProjectCommands=function(b,j,p,l,v,x){function u(a){m?m.setProgressResult(a):window.console.log(a)}function o(a){return v.getProjectHandler(a).then(function(b){if(b.initDependency){var c={name:b.addDependencyName,
id:"orion.project.adddependency."+a,tooltip:b.addDependencyTooltip,callback:function(a){new f;var c=k(a.items),d=a.oldParams||{};if(a.parameters)for(var o in a.parameters.parameterTable)d[o]=a.parameters.valueFor(o);var h=new f;b.paramsToDependencyDescription(d).then(function(a){a&&a.Location?l.loadWorkspace(c.WorkspaceLocation).then(function(c){for(var e=[],j=!1,d=0;d<c.Children.length;d++){if(j===!0)break;var o=b.getDependencyDescription(c.Children[d]);e.push(o);(function(b,c){c.then(function(b){b&&
b.Location===a.Location&&(j=!0,h.resolve(b))})})(d,o)}f.all(e).then(function(){j||h.resolve()})},h.reject):h.resolve()},u);m.showWhile(h,"Searching your workspace for matching content").then(function(o){o?v.addProjectDependency(c,o).then(function(){p.changedItem()},u):e(v,p,j,u,b,{},c,a,d)})},visibleWhen:function(a){return a.type==="Project"}};if(b.addParamethers){for(var o=[],h=0;h<b.addParamethers.length;h++)o.push(new d.CommandParameter(b.addParamethers[h].id,b.addParamethers[h].type,b.addParamethers[h].name));
c.parameters=new d.ParametersDescription(o)}c=new i.Command(c);j.addCommand(c)}})}function r(a){return v.getProjectHandler(a).then(function(b){if(b.initProject){var c={name:b.addProjectName,id:"orion.project.createproject."+a,tooltip:b.addProjectTooltip,callback:function(a){new f;var c=k(a.items),e=a.oldParams||{};if(a.parameters)for(var o in a.parameters.parameterTable)e[o]=a.parameters.valueFor(o);o=b.actionComment?e?b.actionComment.replace(/\$\{([^\}]+)\}/g,function(a,b){return e[b]}):b.actionComment:
"Getting content from "+b.type;m.showWhile(b.initProject(e,{WorkspaceLocation:c.Location}),o).then(function(){p.changedItem(c,!0)},function(b){if(b.retry&&b.addParamethers){for(var c=[],o=0;o<b.addParamethers.length;o++)c.push(new d.CommandParameter(b.addParamethers[o].id,b.addParamethers[o].type,b.addParamethers[o].name));a.parameters=new d.ParametersDescription(c);a.oldParams=e;j.collectParameters(a)}u(b)})},visibleWhen:function(a){return a.Location}};if(b.addParamethers){for(var e=[],o=0;o<b.addParamethers.length;o++)e.push(new d.CommandParameter(b.addParamethers[o].id,
b.addParamethers[o].type,b.addParamethers[o].name));c.parameters=new d.ParametersDescription(e)}c=new i.Command(c);j.addCommand(c)}})}m=b.getService("orion.page.progress");var x=x||[],w=new i.Command({name:"Add External Folder",tooltip:"Add an external folder from workspace",id:"orion.project.addFolder",callback:function(a){var e=k(a.items);(new c.DirectoryPrompterDialog({title:g["Choose a Folder"],serviceRegistry:b,fileClient:l,func:function(a){l.read(a.Location,!0).then(function(a){function b(){var c=
"",j=a.Name;if(a.Parents&&a.Parents.length>0){for(var d=a.Parents.length-1;d>=0;d--)c+=a.Parents[d].Name,c+="/";j+=" ("+a.Parents[a.Parents.length-1].Name+")"}c+=a.Name;v.addProjectDependency(e,{Name:j,Type:"file",Location:c}).then(function(){p.changedItem()},u)}if(!a.Parents||a.Parents.length===0){for(var c=[],j=!1,d=0;d<x.length;d++){if(j)return;var o=v.getProjectHandler(x[d]).then(function(b){return b.getDependencyDescription(a)});c.push(o);o.then(function(a){a&&(j=!0,v.addProjectDependency(e,
a).then(function(){p.changedItem()},u))})}f.all(c).then(function(){j||b()})}else b()},u)}})).show()},visibleWhen:function(a){return a.type==="Project"}});j.addCommand(w);w=new i.Command({name:"Init Basic Project",tooltip:"Convert this folder into a project",id:"orion.project.initProject",callback:function(a){var b=k(a.items),c;b.Parents&&b.Parents.length===0?c=b:b.Parents&&(c=b.Parents[b.Parents.length-1]);c&&v.initProject(c.Location).then(function(){l.read(b.Location,!0).then(function(a){p.changedItem(a)},
u)},u)},visibleWhen:function(a){return a.type==="Folder"}});j.addCommand(w);for(var w=[],z=0;z<x.length;z++){var y=x[z];w.push(o(y));w.push(r(y))}z=new i.Command({name:"Create Readme",tooltip:"Create README.md file in this project",id:"orion.project.create.readme",callback:function(a){var b=k(a.items);m.progress(l.createFile(b.Project.ContentLocation,"README.md"),"Creating README.md").then(function(a){b.Project?m.progress(l.write(a.Location,"# "+b.Project.Name),"Writing sample readme").then(function(){p.changedItem()}):
p.changedItem()})},visibleWhen:function(a){if(!a.Project||!a.Project.children||!a.Project.ContentLocation)return!1;for(var b=0;b<a.Project.children.length;b++)if(a.Project.children[b].Name&&a.Project.children[b].Name.toLowerCase()==="readme.md")return!1;return!0}});j.addCommand(z);z=new i.Command({name:"Create a basic project",tooltip:"Create an empty project",id:"orion.project.create.basic",parameters:new d.ParametersDescription([new d.CommandParameter("name","text","Name: ")]),callback:function(a){var b=
a.parameters.valueFor("name");if(b){var c=k(a.items);m.progress(v.createProject(c.Location,{Name:b}),"Creating project "+b).then(function(){p.changedItem(c,!0)})}},visibleWhen:function(a){return!!a.Location}});j.addCommand(z);z=new i.Command({name:"Create a project from a zipped folder",tooltip:"Create project and fill it with data from local file",id:"orion.project.create.fromfile",parameters:new d.ParametersDescription([new d.CommandParameter("name","text","Name: ")]),callback:function(a){var b=
a.parameters.valueFor("name");if(b){var c=k(a.items);m.progress(v.createProject(c.Location,{Name:b}),"Creating project "+b).then(function(a){m.progress(l.read(a.ContentLocation,!0)).then(function(a){(new h.ImportDialog({importLocation:a.ImportLocation,func:function(){p.changedItem(c,!0)}})).show()})})}},visibleWhen:function(a){return!!a.Location}});j.addCommand(z);a.createDependencyCommands(b,j,p,l,v,x);return f.all(w)};return a});
define("orion/widgets/filesystem/filesystemSwitcher","i18n!orion/edit/nls/messages,orion/objects,orion/webui/littlelib,orion/i18nUtil,orion/commands,orion/URL-shim".split(","),function(g,l,i,f,c){function d(b){this.commandRegistry=b.commandRegistry;this.rootChangeListener=b.rootChangeListener;this.filesystemChangeDispatcher=b.filesystemChangeDispatcher;this.fileClient=b.fileClient;this.node=b.node;this.serviceRegistry=b.serviceRegistry;var c=this;this.listener=function(b){c.refresh(b.root)};this.rootChangeListener&&
this.rootChangeListener.addEventListener("rootChanged",this.listener);this.render()}l.mixin(d.prototype,{destroy:function(){this.rootChangeListener&&this.rootChangeListener.removeEventListener("rootChanged",this.listener);this.commandRegistry.destroy(this.node);i.empty(this.node);this.rootChangeListener=this.filesystemChangeDispatcher=this.listener=this.node=null},registerCommands:function(){if(!this.commandsRegistered){this.commandsRegistered=!0;var b=this.commandRegistry,d=this.serviceRegistry,
f=new c.Command({name:g.ChooseFS,imageClass:"core-sprite-openarrow",selectionClass:"dropdownSelection",tooltip:g.ChooseFSTooltip,id:"orion.nav.switchfs",visibleWhen:function(){return d.getServiceReferences("orion.core.file").length>1},choiceCallback:this._switchFsMenuCallback.bind(this)});b.addCommand(f);b.registerCommandContribution("orion.mininav","orion.nav.switchfs",1)}},_switchFsMenuCallback:function(){var b=this;return this.serviceRegistry.getServiceReferences("orion.core.file").map(function(c){c=
c.getProperty("top");return{name:b._fileServiceLabel(c,!0),callback:b.setActiveFilesystem.bind(b,c)}})},render:function(){this.fsName=document.createElement("div");this.fsName.classList.add("filesystemName");this.fsName.classList.add("layoutLeft");this.menu=document.createElement("ul");this.menu.classList.add("filesystemSwitcher");this.menu.classList.add("commandList");this.menu.classList.add("layoutRight");this.menu.classList.add("pageActions");this.node.appendChild(this.fsName);this.node.appendChild(this.menu);
this.registerCommands();this.fsName.addEventListener("click",this._openMenu.bind(this))},_openMenu:function(){var b=i.$(".dropdownTrigger",this.menu);if(b){var c=document.createEvent("MouseEvents");c.initEvent("click",!0,!0);b.dispatchEvent(c)}},_fileServiceHostname:function(b){b=this.fileClient.fileServiceRootURL(b);b.indexOf("filesystem:")===0&&(b=b.substr(11));var c=b;try{c=(new URL(b,window.location.href)).hostname}catch(d){}return c},_fileServiceLabel:function(b,c){var d=this.fileClient.fileServiceName(b),
e=this._fileServiceHostname(b);if(c)return f.formatMessage(g.FSTitle,d,e);var a=document.createDocumentFragment();a.textContent=g.FSTitle;i.processDOMNodes(a,[document.createTextNode(d),document.createTextNode(e)]);return a},refresh:function(b){var c=b;if(b.ChildrenLocation)c=b.ChildrenLocation;i.empty(this.fsName);this.fsName.appendChild(this._fileServiceLabel(c));this.commandRegistry.destroy(this.menu);this.commandRegistry.renderCommands("orion.mininav",this.menu,{},"menu")},setActiveFilesystem:function(b){var c=
b;if(b.ChildrenLocation)c=b.ChildrenLocation;b=this.fileClient.fileServiceRootURL(c);this.filesystemChangeDispatcher&&this.filesystemChangeDispatcher.dispatchEvent({type:"filesystemChanged",newInput:b})}});return{FilesystemSwitcher:d}});
define("orion/widgets/nav/mini-nav","i18n!orion/edit/nls/messages,orion/objects,orion/webui/littlelib,orion/explorers/explorer-table,orion/explorers/navigatorRenderer,orion/explorers/explorerNavHandler,orion/i18nUtil,orion/keyBinding,orion/commands,orion/fileCommands,orion/projectCommands,orion/extensionCommands,orion/selection,orion/EventTarget,orion/URITemplate,orion/PageUtil,orion/Deferred,orion/widgets/filesystem/filesystemSwitcher,orion/URL-shim".split(","),function(g,l,i,f,c,d,b,h,k,e,a,j,p,
m,n,s,q,t){function v(a){a.setFocus=!1;a.cachePrefix=null;a.modelEventDispatcher=e.getModelEventDispatcher();o.apply(this,arguments);this.commandRegistry=a.commandRegistry;this.editorInputManager=a.editorInputManager;this.progressService=a.progressService;var b=this.sidebarNavInputManager=a.sidebarNavInputManager;this.toolbarNode=a.toolbarNode;this.newActionsScope=this.toolbarNode.id+"New";this.selectionActionsScope=this.toolbarNode.id+"Selection";this.folderNavActionsScope=this.toolbarNode.id+"Folder";
this.treeRoot={};var c=this;this.editorInputListener=function(a){c.reveal(a.metadata,!0)};this.editorInputManager.addEventListener("InputChanged",this.editorInputListener);if(b)this.addEventListener("rootChanged",function(a){c.sidebarNavInputManager.dispatchEvent(a);c.sidebarNavInputManager.dispatchEvent({type:"InputChanged",input:a.root.ChildrenLocation})}),b.setInput=function(a){c.treeRoot&&c.treeRoot.ChildrenLocation!==a&&c.loadRoot(a).then(function(){c.updateCommands()})};var j=this.modelEventDispatcher,
d=this._modelListener=this.onFileModelChange.bind(this);["move","delete"].forEach(function(a){j.addEventListener(a,d)});this.selection=new p.Selection(this.registry,"miniNavFileSelection");this._selectionListener=function(a){c.updateCommands(a.selections)};this.selection.addEventListener("selectionChanged",this._selectionListener);this.commandsRegistered=this.registerCommands()}function x(){w.apply(this,arguments)}function u(a){this.commandRegistry=a.commandRegistry;this.contentTypeRegistry=a.contentTypeRegistry;
this.fileClient=a.fileClient;this.editorInputManager=a.editorInputManager;this.parentNode=a.parentNode;this.sidebarNavInputManager=a.sidebarNavInputManager;this.toolbarNode=a.toolbarNode;this.serviceRegistry=a.serviceRegistry;this.lastRoot=this.explorer=this.fsToolbar=null;var b=this;this.sidebarNavInputManager.addEventListener("InputChanged",function(a){b.lastRoot=a.input})}var o=f.FileExplorer,r=h.KeyBinding,w=c.NavigatorRenderer;v.prototype=Object.create(o.prototype);l.mixin(v.prototype,{onFileModelChange:function(a){var b=
a.oldValue,a=a.newValue,c=this.editorInputManager.getFileMetadata();if(c){var e;[c].concat(c.Parents||[]).some(function(a){return b.Location===a.Location?(e=b,!0):!1});e&&this.sidebarNavInputManager.dispatchEvent({type:"editorInputMoved",parent:this.treeRoot.ChildrenLocation,newInput:e.Location===c.Location?a&&a.ChildrenLocation||a&&a.ContentLocation||a&&a.Location||null:null})}},createActionSections:function(){var a=this;[this.newActionsScope,this.selectionActionsScope,this.folderNavActionsScope].forEach(function(b){if(!a[b]){var c=
document.createElement("ul");c.id=b;c.classList.add("commandList");c.classList.add("layoutLeft");c.classList.add("pageActions");a.toolbarNode.appendChild(c);a[b]=c}})},destroy:function(){var a=this,b=this.modelEventDispatcher;["move","delete"].forEach(function(c){b.removeEventListener(c,a._modelListener)});o.prototype.destroy.call(this);[this.newActionsScope,this.selectionActionsScope,this.folderNavActionsScope].forEach(function(b){delete a[b]});this.sidebarNavInputManager.removeEventListener("InputChanged",
this.navInputListener);this.editorInputManager.removeEventListener("InputChanged",this.editorInputListener);this.selection.removeEventListener("selectionChanged",this._selectionListener)},loadParentOf:function(a,b){if(a){var c=a.Parents&&a.Parents[0];if(!b&&c){if(this.treeRoot&&this.treeRoot.ChildrenLocation===c.ChildrenLocation){this.reveal(a);return}}else c=this.fileClient.fileServiceRootURL(a.Location);return this.loadRoot(c)}},loadRoot:function(a){var a=a&&a.ChildrenLocation||a||"",b=this;return this.commandsRegistered.then(function(){return b.loadResourceList.call(b,
a)})},reveal:function(a,b){if(a)if(b){var c=this,e=function(){var b=c.myTree;if(b&&a.Parents){for(var e=-1,j=0;j<a.Parents.length;j++){var d=a.Parents[j];if(d.Location===c.treeRoot.Location||b.isExpanded(d)){e=j;break}}if(e===-1)e=a.Parents.length;var o=function(e){e<0?c.reveal(a):b.expand(a.Parents[e],o,[e-1])};o(e-1)}};if(this.fileInCurrentTree(a)){var j=this.outOfSync(a);j?this.changedItem(j,!0).then(e):e()}else s.matchResourceParameters().navigate||this.loadParentOf(a,!0).then(e)}else if(e=this.getNavHandler())e.cursorOn(a,
!0),e.setSelection(a)},outOfSync:function(a){var b=this.treeRoot,c=[];if(a&&a.Parents&&b&&b.ChildrenLocation)for(var e=0;e<a.Parents.length;e++){if(a.Parents[e].ChildrenLocation===b.ChildrenLocation)break;c.push(a.Parents[e])}c.reverse();c.push(a);a=b;for(b=0;b<c.length&&a;b++)if(e=a.children){for(var j=!1,d=0;d<e.length;d++)if(e[d].Location===c[b].Location){a=e[d];j=!0;break}if(!j)return a}else break;return null},scopeUp:function(){var a=this.treeRoot;this.loadParentOf(a).then(this.reveal.bind(this,
a))},scopeDown:function(a){this.loadRoot(a).then()},fileInCurrentTree:function(a){var b=this.fileClient,c=this.treeRoot;if(c&&b.fileServiceRootURL(a.Location)!==b.fileServiceRootURL(c.Location))return!1;if(!c.Parents)return!0;if(a&&a.Parents&&c&&c.ChildrenLocation)for(b=0;b<a.Parents.length;b++)if(a.Parents[b].ChildrenLocation===c.ChildrenLocation)return!0;return!1},registerCommands:function(){var b=this.commandRegistry,c=this.fileClient,d=this.registry,o=this.newActionsScope,h=this.selectionActionsScope,
f=this.folderNavActionsScope;b.addCommandGroup(o,"orion.miniNavNewGroup",1E3,g.New,null,null,"core-sprite-addcontent",null,"dropdownSelection");b.addCommandGroup(h,"orion.miniNavSelectionGroup",100,g.Actions,null,null,"core-sprite-gear",null,"dropdownSelection");b.registerSelectionService(h,this.selection);var k=new r(113),w=new r(46),p=new r("c",!0),n=new r("v",!0),m=new r(38,!1,!1,!0),i=new r(40,!1,!1,!0);i.domScope=m.domScope=n.domScope=p.domScope=w.domScope=k.domScope="sidebar";i.scopeName=m.scopeName=
n.scopeName=p.scopeName=w.scopeName=k.scopeName=g.Navigator;b.registerCommandContribution(o,"eclipse.copySelections",1,null,!0,p);b.registerCommandContribution(o,"eclipse.pasteSelections",1,null,!0,n);b.registerCommandContribution(o,"eclipse.newFile",1,"orion.miniNavNewGroup");b.registerCommandContribution(o,"eclipse.newFolder",2,"orion.miniNavNewGroup",!1,null);b.registerCommandContribution(o,"orion.new.project",1,"orion.miniNavNewGroup");b.registerCommandContribution(o,"orion.new.linkProject",2,
"orion.miniNavNewGroup");b.registerCommandContribution(f,"eclipse.upFolder",1,null,!1,m);b.registerCommandContribution(h,"eclipse.downFolder",1,"orion.miniNavSelectionGroup",!1,i);b.registerCommandContribution(h,"eclipse.renameResource",2,"orion.miniNavSelectionGroup",!1,k);b.registerCommandContribution(h,"eclipse.copyFile",3,"orion.miniNavSelectionGroup");b.registerCommandContribution(h,"eclipse.moveFile",4,"orion.miniNavSelectionGroup");b.registerCommandContribution(h,"eclipse.deleteFile",5,"orion.miniNavSelectionGroup",
!1,w);b.registerCommandContribution(h,"eclipse.compareWithEachOther",6,"orion.miniNavSelectionGroup");b.registerCommandContribution(h,"eclipse.compareWith",7,"orion.miniNavSelectionGroup");b.registerCommandContribution(h,"orion.importZipURL",1,"orion.miniNavSelectionGroup/orion.importExportGroup");b.registerCommandContribution(h,"orion.import",2,"orion.miniNavSelectionGroup/orion.importExportGroup");b.registerCommandContribution(h,"eclipse.downloadFile",3,"orion.miniNavSelectionGroup/orion.importExportGroup");
b.registerCommandContribution(h,"orion.importSFTP",4,"orion.miniNavSelectionGroup/orion.importExportGroup");b.registerCommandContribution(h,"eclipse.exportSFTPCommand",5,"orion.miniNavSelectionGroup/orion.importExportGroup");e.createFileCommands(d,b,this,c);h=j.createAndPlaceFileCommandsExtension(d,b,h,0,"orion.miniNavSelectionGroup",!0);if(d.getServiceReferences("orion.projects").length>0){b.addCommandGroup(o,"orion.projectsNewGroup",100,"New Project","orion.miniNavNewGroup");b.registerCommandContribution(o,
"orion.project.create.basic",1,"orion.miniNavNewGroup/orion.projectsNewGroup");b.registerCommandContribution(o,"orion.project.create.fromfile",2,"orion.miniNavNewGroup/orion.projectsNewGroup");var z=d.getService("orion.project.client"),s=new q;z.getProjectHandlerTypes().then(function(e){for(var j=0;j<e.length;j++)b.registerCommandContribution(o,"orion.project.createproject."+e[j],j+3,"orion.miniNavNewGroup/orion.projectsNewGroup");a.createProjectCommands(d,b,this,c,z,e).then(s.resolve,s.resolve)}.bind(this),
s.resolve);return q.all([h,s])}else return h},updateCommands:function(){this.createActionSections();var a=this.commandRegistry;e.updateNavTools(this.registry,a,this,this.newActionsScope,this.selectionActionsScope,this.treeRoot,!0);a.destroy(this.folderNavActionsScope);a.renderCommands(this.folderNavActionsScope,this.folderNavActionsScope,this.treeRoot,this,"tool")}});var z=new n("#{,resource,params*}");x.prototype=Object.create(w.prototype);l.mixin(x.prototype,{showFolderLinks:!0,oneColumn:!0,createFolderNode:function(a){var b=
w.prototype.createFolderNode.call(this,a);this.showFolderLinks&&b.tagName==="A"?(b.href=z.expand({resource:a.Location}),b.classList.add("miniNavFolder"),b.addEventListener("click",this.toggleFolderExpansionState.bind(this,a,!1))):b.classList.add("nav_fakelink");return b},emptyCallback:function(){},toggleFolderExpansionState:function(a,b,c){var e=this.explorer.getNavHandler();if(e&&(e.cursorOn(a),e.setSelection(a,!1),a=e._modelIterator.cursor(),e.isExpandable(a)))return e.isExpanded(a)?this.explorer.myTree.collapse(a):
this.explorer.myTree.expand(a),b&&c.preventDefault(),!1}});l.mixin(u.prototype,{label:g.Navigator,create:function(){var a=this.toolbarNode;if(!this.fsToolbar){var b=this.fsToolbar=document.createElement("div");b.classList.add("fsToolbarLayout");b.classList.add("fsToolbar");this.parentNode.parentNode.insertBefore(b,this.parentNode);this.parentNode.classList.add("miniNavToolbarTarget")}var c=this;this.explorer=new v({commandRegistry:this.commandRegistry,dragAndDrop:e.uploadFile,fileClient:this.fileClient,
editorInputManager:this.editorInputManager,sidebarNavInputManager:this.sidebarNavInputManager,parentId:this.parentNode.id,rendererFactory:function(a){return new x({checkbox:!1,cachePrefix:"MiniNav"},a,c.commandRegistry,c.contentTypeRegistry)},serviceRegistry:this.serviceRegistry,toolbarNode:a});this.fsSwitcher=new t.FilesystemSwitcher({commandRegistry:this.commandRegistry,rootChangeListener:this.explorer,filesystemChangeDispatcher:this.explorer.sidebarNavInputManager,fileClient:this.fileClient,node:this.fsToolbar,
serviceRegistry:this.serviceRegistry});a=s.matchResourceParameters();b=a.resource;this.explorer.loadRoot(a.navigate||this.lastRoot||this.fileClient.fileServiceRootURL(b||"")).then(function(){c.explorer&&(c.explorer.updateCommands(),c.explorer.reveal(c.editorInputManager.getFileMetadata(),!0))})},destroy:function(){if(this.explorer)this.explorer.destroy(),this.explorer=null;if(this.fsSwitcher)this.fsSwitcher.destroy(),this.fsToolbar.parentNode.removeChild(this.fsToolbar),this.fsToolbar=null,this.parentNode.classList.remove("miniNavToolbarTarget")}});
return u});
define("orion/projectClient",["i18n!orion/navigate/nls/messages","orion/Deferred","orion/extensionCommands"],function(g,l,i){function f(c,d){this.serviceRegistry=c;this.fileClient=d;this.allProjectHandlersReferences=c.getServiceReferences("orion.project.handler");this._serviceRegistration=c.registerService("orion.project.client",this)}f.prototype={_getProjectJsonData:function(c,d,b){for(var h=new l,f=0;f<d.length;f++)if(d[f].Name==="project.json")return this.fileClient.read(d[f].Location).then(function(e){try{var a=e&&
e.length>0?JSON.parse(e):{};a.Name=a.Name||c.Name;a.ContentLocation=c.Location;a.WorkspaceLocation=b.Location;a.ProjectJsonLocation=d[f].Location;h.resolve(a)}catch(j){h.reject(j)}},function(b){h.reject(b)},function(b){h.progress(b)}),h;h.resolve(null);return h},readAllProjects:function(c){var d=new l;if(!c.Children)return d.resolve([]),d;for(var b=[],h=[],f=0;f<c.Children.length;f++){var e=new l;this.readProject(c.Children[f],c).then(e.resolve,function(){this.resolve(null)}.bind(e));h.push(e);e.then(function(a){a&&
b.push(a)})}l.all(h).then(function(){d.resolve(b)});return d},readProject:function(c,d){function b(b,a,c){if(b.Parents&&b.Parents.length>0){var d=b.Parents[b.Parents.length-1];d.Children?h._getProjectJsonData.bind(h)(d,d.Children,a).then(c.resolve,c.reject,c.progress):d.ChildrenLocation?this.fileClient.fetchChildren(d.ChildrenLocation).then(function(b){h._getProjectJsonData.bind(h)(d,b,a).then(c.resolve,c.reject,c.progress)},c.reject,c.progress):c.resolve(null)}else b.Children?h._getProjectJsonData.bind(h)(b,
b.Children,a).then(c.resolve,c.reject,c.progress):b.ChildrenLocation?this.fileClient.fetchChildren(b.ChildrenLocation).then(function(d){h._getProjectJsonData.bind(h)(b,d,a).then(c.resolve,c.reject,c.progress)},c.reject,c.progress):c.resolve(null);return c}var h=this,f=new l;d?b.call(h,c,d,f):this.fileClient.loadWorkspace().then(function(e){b.call(h,c,e,f)});return f},initProject:function(c,d){var b=this,h=new l;this.fileClient.createFile(c,"project.json").then(function(f){d?b.fileClient.write(f.Location,
JSON.stringify(d)).then(function(){h.resolve({ContentLocation:c,projectMetadata:d})},h.reject,h.progress):h.resolve({fileMetadata:f})},h.reject,h.progress);return h},createProject:function(c,d){return this.fileClient.createProject(c,d.Name,null,!0).then(function(b){return this.initProject(b.ContentLocation,d)}.bind(this),function(b){return b},function(b){return b})},getDependencyFileMetadata:function(c,d){function b(a,e){this.fileClient.fetchChildren(a).then(function(a){for(var d=0;d<a.length;d++)if(a[d].Name===
e[0]){e.length===1?h.resolve(a[d]):b.bind(f)(a[d].ChildrenLocation,e.splice(1,e.length-1));return}h.reject(c.Location+" could not be found in your workspace")},function(a){h.reject(a)})}var h=new l,f=this;if(c.Type==="file"){var e=c.Location.split("/");this.fileClient.loadWorkspace(d).then(function(a){for(var d=0;d<a.Children.length;d++)if(a.Children[d].Name===e[0]){e.length===1?h.resolve(a.Children[d]):b.bind(f)(a.Children[d].ChildrenLocation,e.splice(1,e.length-1));return}h.reject(c.Location+" could not be found in your workspace")},
function(a){h.reject(a)})}else{var a=this.getProjectHandler(c.Type);if(a===null)return h.reject(c.Type+" is not supported."),h;var j;a.validationProperties&&(j=i._makeValidator(a,this.serviceRegistry,[]));this.fileClient.loadWorkspace(d).then(function(b){for(var e=[],d=!1,f=0;f<b.Children.length;f++){if(d===!0)break;if(j&&j.validationFunction(b.Children[f])){var k=a.getDependencyDescription(b.Children[f]);e.push(k);(function(a,e){e.then(function(e){e&&e.Location===c.Location&&(d=!0,h.resolve(b.Children[a]))})})(f,
k)}}l.all(e).then(function(){d||h.reject(c.Name+" could not be found in your workspace")})},h.reject)}return h},addProjectDependency:function(c,d){var b=new l;this.fileClient.fetchChildren(c.ContentLocation).then(function(h){for(var f=0;f<h.length;f++)if(h[f].Name==="project.json"){this.fileClient.read(h[f].Location).then(function(e){try{var a=e&&e.length>0?JSON.parse(e):{};if(!a.Dependencies)a.Dependencies=[];for(e=0;e<a.Dependencies.length;e++)if(a.Dependencies[e].Location===d.Location){b.resolve(a);
return}a.Dependencies.push(d);this.fileClient.write(h[f].Location,JSON.stringify(a)).then(function(){a.ContentLocation=c.ContentLocation;a.Name=c.Name;b.resolve(a)},b.reject);b.resolve(a)}catch(j){b.reject(j)}}.bind(this),b.reject,b.progress);break}}.bind(this),b.reject);return b},removeProjectDependency:function(c,d){var b=new l;this.fileClient.fetchChildren(c.ContentLocation).then(function(h){for(var f=0;f<h.length;f++)if(h[f].Name==="project.json"){this.fileClient.read(h[f].Location).then(function(e){try{var a=
e&&e.length>0?JSON.parse(e):{};if(!a.Dependencies)a.Dependencies=[];for(var j=a.Dependencies.length-1;j>=0;j--)a.Dependencies[j].Location===d.Location&&a.Dependencies[j].Type===d.Type&&a.Dependencies.splice(j);this.fileClient.write(h[f].Location,JSON.stringify(a)).then(function(){a.ContentLocation=c.ContentLocation;a.Name=c.Name;b.resolve(a)},b.reject)}catch(p){b.reject(p)}}.bind(this),b.reject,b.progress);break}}.bind(this),b.reject);return b},changeProjectProperties:function(c,d){function b(b){this.fileClient.read(b).then(function(e){try{var a=
e&&e.length>0?JSON.parse(e):{},j;for(j in d)a[j]=d[j];this.fileClient.write(b,JSON.stringify(a)).then(function(){a.ContentLocation=c.ContentLocation;a.ProjectJsonLocation=b;a.Name=c.Name;h.resolve(a)},h.reject)}catch(f){h.reject(f)}}.bind(this),h.reject)}if(d){var h=new l;c.ProjectJsonLocation&&b.bind(this)(c.ProjectJsonLocation);return h}},getProjectHandlerTypes:function(){for(var c=[],d=0;d<this.allProjectHandlersReferences.length;d++)c.push(this.allProjectHandlersReferences[d].getProperty("type"));
return c},_getProjectHandlerService:function(c){var d=this.serviceRegistry.getService(c);d.id=c.getProperty("id");d.addParamethers=c.getProperty("addParamethers");d.addDependencyName=c.getProperty("addDependencyName");d.addDependencyTooltip=c.getProperty("addDependencyTooltip");d.type=c.getProperty("type");d.actionComment=c.getProperty("actionComment");d.addProjectName=c.getProperty("addProjectName");d.addProjectTooltip=c.getProperty("addProjectTooltip");d.validationProperties=c.getProperty("validationProperties");
return d},getProjectHandler:function(c){for(var d=0;d<this.allProjectHandlersReferences.length;d++)if(this.allProjectHandlersReferences[d].getProperty("type")===c)return this._getProjectHandlerService(this.allProjectHandlersReferences[d])},getMatchingProjectHandlers:function(c){for(var d=[],b=0;b<this.allProjectHandlersReferences.length;b++)i._makeValidator(this.allProjectHandlersReferences[b]._properties,this.serviceRegistry,[]).validationFunction(c)&&d.push(this._getProjectHandlerService(this.allProjectHandlersReferences[b]));
return d}};f.prototype.constructor=f;return{ProjectClient:f}});
define("orion/widgets/nav/project-nav","require,i18n!orion/edit/nls/messages,orion/objects,orion/webui/littlelib,orion/explorers/explorer-table,orion/explorers/navigatorRenderer,orion/explorers/explorerNavHandler,orion/i18nUtil,orion/keyBinding,orion/fileCommands,orion/projectCommands,orion/extensionCommands,orion/selection,orion/Deferred,orion/EventTarget,orion/URITemplate,orion/PageUtil,orion/section,orion/projectClient".split(","),function(g,l,i,f,c,d,b,h,k,e,a,j,p,m,n,s){function q(a,b,c,e,d,
j){w.apply(this,arguments);this.project=b}function t(a,b){a.setFocus=!1;a.cachePrefix=null;a.modelEventDispatcher=e.getModelEventDispatcher();r.apply(this,arguments);this.commandRegistry=a.commandRegistry;this.projectClient=a.projectClient;this.editorInputManager=a.editorInputManager;this.progressService=a.progressService;this.sidebarNavInputManager=a.sidebarNavInputManager;this.toolbarNode=a.toolbarNode;this.scopeUp=a.scopeUp;this.projectExplorer=b;this.newActionsScope=a.newActionsScope;this.selectionActionsScope=
a.selectionActionsScope;this.goUpActionsScope="GoUpActions";this.followEditor=!0;this.treeRoot={};var c=this,d=this.modelEventDispatcher,j=this._modelListener=this.onFileModelChange.bind(this);["move","delete"].forEach(function(a){d.addEventListener(a,j)});this.selection=new p.Selection(this.registry,"projectNavFileSelection");this._selectionListener=function(a){c.updateCommands(a.selections)};this._editorInputListener=function(a){c.onEditorInputChanged.call(c,a)};this.selection.addEventListener("selectionChanged",
this._selectionListener);this.editorInputManager.addEventListener("InputChanged",this._editorInputListener);this.commandsRegistered=this.registerCommands()}function v(){y.apply(this,arguments)}function x(a){this.parentNode=a.parentNode;this.serviceRegistry=a.serviceRegistry}function u(a){this.commandRegistry=a.commandRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.fileClient=a.fileClient;this.parentId=a.parentId;this.parentNode=a.parentNode;this.toolbarNode=a.toolbarNode;this.serviceRegistry=
a.serviceRegistry;this.projectClient=a.projectClient;this.renderer=new x({parentNode:this.parentNode,serviceRegistry:this.serviceRegistry});this.rendererFactory=a.rendererFactory;a.parentId="projectInfoNode";this.addActionsScope=this.toolbarNode.id+"Add";a.newActionsScope=this.addActionsScope;this.selectionActionsScope=a.selectionActionsScope="filesSectionSelectionArea";this.fileExplorer=new t(a,this);this.explorer=null;this.createToolbar();this.registerCommands()}function o(a){this.commandRegistry=
a.commandRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.fileClient=a.fileClient;this.editorInputManager=a.editorInputManager;this.parentNode=a.parentNode;this.sidebarNavInputManager=a.sidebarNavInputManager;this.toolbarNode=a.toolbarNode;this.serviceRegistry=a.serviceRegistry;this.projectClient=this.serviceRegistry.getService("orion.project.client");this.scopeUp=a.scopeUp;this.explorer=null;var b=this;if(this.sidebarNavInputManager)this.navInputListener=function(a){b.navigatorInput=
a.input},this.sidebarNavInputManager.addEventListener("InputChanged",this.navInputListener)}var r=c.FileExplorer,w=c.FileModel,z=k.KeyBinding,y=d.NavigatorRenderer;q.prototype=Object.create(w.prototype);i.mixin(q.prototype,{processParent:function(a,b){w.prototype.processParent.call(this,a,b);if(!a.Project)a.Project=this.project;for(var c=0;c<b.length;c++)b[c].Project=this.project;return b},getChildren:function(a,b){if(a.children)b(a.children);else{if(a.type==="Project")this.fileClient.loadWorkspace(a.ContentLocation).then(function(c){var e=
[];c.type="ProjectRoot";e.push(c);if(a.Dependencies)for(c=0;c<a.Dependencies.length;c++)e.push({Dependency:a.Dependencies[c]});this.processParent(a,e);b(e)}.bind(this));else if(a.Dependency)if(a.FileMetadata)w.prototype.getChildren.call(this,a.FileMetadata,function(c){this.processParent(a,c);b(c)}.bind(this));else{b([]);return}return w.prototype.getChildren.call(this,a,b)}},getId:function(a){return a.type==="Project"?w.prototype.getId.call(this,{Location:a.ContentLocation}):a.Dependency?w.prototype.getId.call(this,
a.Dependency):w.prototype.getId.call(this,a)},hasChildren:function(){return!0}});t.prototype=Object.create(r.prototype);i.mixin(t.prototype,{onEditorInputChanged:function(a){this.expandToItem(a.metadata,function(){this.reveal(a.metadata,!0)}.bind(this))},onFileModelChange:function(a){var b=a.oldValue,a=a.newValue;if(b.ChildrenLocation===this.treeRoot.ContentLocation)this.sidebarNavInputManager.dispatchEvent({type:"editorInputMoved",parent:a?a.ChildrenLocation||a.ContentLocation:null,newInput:a?a.ChildrenLocation||
a.ContentLocation:null});else{var c=this.editorInputManager.getFileMetadata();if(c){var e;[c].concat(c.Parents||[]).some(function(a){return b.Location===a.Location?(e=b,!0):!1});e&&this.sidebarNavInputManager.dispatchEvent({type:"editorInputMoved",parent:this.treeRoot.ChildrenLocation,newInput:e.Location===c.Location?a&&a.ContentLocation||a&&a.ChildrenLocation||a&&a.Location||null:null})}}},destroy:function(){var a=this,b=this.modelEventDispatcher;["move","delete"].forEach(function(c){b.removeEventListener(c,
a._modelListener)});this.editorInputManager.removeEventListener("InputChanged",this._editorInputListener);this.selection.removeEventListener("selectionChanged",this._selectionListener);r.prototype.destroy.call(this)},loadRoot:function(a,b){var a=a&&a.ChildrenLocation||a||"",c=this;return this.commandsRegistered.then(function(){return a&&typeof a==="object"?c.load.call(c,a):c.loadResourceList.call(c,a,b)})},load:function(a){var b=this;b.treeRoot=a;b.model=new q(b.registry,b.treeRoot,b.fileClient,b.parentId,
b.excludeFiles,b.excludeFolders);a=new m;if(b.dragAndDrop)if(b._hookedDrag)b._makeDropTarget(b.treeRoot,parent,!0);else{var c;c=parent&&("draggable"in parent||"ondragstart"in parent&&"ondrop"in parent)&&!(!window.File||!window.FileList||!window.FileReader);b._hookedDrag=!0;c?b._makeDropTarget(b.treeRoot,parent,!0):(b.dragAndDrop=null,window.console.log("Local file drag and drop is not supported in this browser."))}if(b.model.hasChildren())b.createTree(b.parentId,b.model,{navHandlerFactory:b.navHandlerFactory,
setFocus:typeof b.setFocus==="undefined"?!0:b.setFocus,selectionPolicy:b.renderer.selectionPolicy,onCollapse:function(a){if(b.getNavHandler())b.getNavHandler().onCollapse(a)}});else{f.empty(parent);c=document.createElement("div");c.classList.add("noFile");c.textContent=l.NoFile;var e=document.createElement("span");e.classList.add("core-sprite-addcontent");e.classList.add("icon-inline");e.classList.add("imageSprite");f.processDOMNodes(c,[e]);parent.appendChild(c)}a.resolve();return a},reveal:function(a){if(a){var b=
this.getNavHandler();b&&(a.Location===this.treeRoot.Location&&a.Children&&a.Children.length?(b.cursorOn(a.Children[0],!0,!1,!1),b.setSelection(a.Children[0])):(b.cursorOn(a,!0,!1,!1),b.setSelection(a)))}},registerCommands:function(){var b=this.commandRegistry,c=this.fileClient,d=this.registry,o=this.newActionsScope,h=this.selectionActionsScope,f=this.goUpActionsScope;b.addCommandGroup(o,"orion.miniExplorerNavNewGroup",1E3,l.Add,null,null,"core-sprite-addcontent");b.addCommandGroup(h,"orion.miniNavSelectionGroup",
100,l.Actions,null,null,"core-sprite-gear");b.registerSelectionService(h,this.selection);b.registerCommandContribution(o,"eclipse.copySelections",1,null,!0,new z("c",!0));b.registerCommandContribution(o,"eclipse.pasteSelections",1,null,!0,new z("v",!0));b.registerCommandContribution(f,"eclipse.upFolder",1);b.registerCommandContribution(o,"eclipse.newFile",1,"orion.miniExplorerNavNewGroup/orion.newContentGroup");b.registerCommandContribution(o,"eclipse.newFolder",2,"orion.miniExplorerNavNewGroup/orion.newContentGroup",
!1,null);b.registerCommandContribution(o,"orion.project.addFolder",1,"orion.miniExplorerNavNewGroup/orion.projectDepenencies");var r=new m;this.projectClient.getProjectHandlerTypes().then(function(e){for(var j=0;j<e.length;j++)b.registerCommandContribution(o,"orion.project.adddependency."+e[j],j+1,"orion.miniExplorerNavNewGroup/orion.projectDepenencies");a.createProjectCommands(d,b,this,c,this.projectClient,e).then(r.resolve,r.resolve)}.bind(this),r.resolve);b.registerCommandContribution(o,"orion.project.create.readme",
2,"orion.miniExplorerNavNewGroup/orion.newContentGroup");b.registerCommandContribution(o,"orion.new.project",1,"orion.miniExplorerNavNewGroup");b.registerCommandContribution(o,"orion.new.linkProject",2,"orion.miniExplorerNavNewGroup");b.registerCommandContribution("dependencyCommands","orion.project.dependency.connect",1);b.registerCommandContribution("dependencyCommands","orion.project.dependency.disconnect",2);f=new z(113);f.domScope="sidebar";f.scopeName=l.Navigator;var k=new z(46);k.domScope=
"sidebar";k.scopeName=l.Navigator;b.registerCommandContribution(h,"eclipse.renameResource",2,"orion.miniNavSelectionGroup",!1,f);b.registerCommandContribution(h,"eclipse.copyFile",3,"orion.miniNavSelectionGroup");b.registerCommandContribution(h,"eclipse.moveFile",4,"orion.miniNavSelectionGroup");b.registerCommandContribution(h,"eclipse.deleteFile",5,"orion.miniNavSelectionGroup",!1,k);b.registerCommandContribution(h,"eclipse.compareWithEachOther",6,"orion.miniNavSelectionGroup");b.registerCommandContribution(h,
"eclipse.compareWith",7,"orion.miniNavSelectionGroup");b.registerCommandContribution(h,"orion.importZipURL",1,"orion.miniNavSelectionGroup/orion.importExportGroup");b.registerCommandContribution(h,"orion.import",2,"orion.miniNavSelectionGroup/orion.importExportGroup");b.registerCommandContribution(h,"eclipse.downloadFile",3,"orion.miniNavSelectionGroup/orion.importExportGroup");b.registerCommandContribution(h,"orion.importSFTP",4,"orion.miniNavSelectionGroup/orion.importExportGroup");b.registerCommandContribution(h,
"eclipse.exportSFTPCommand",5,"orion.miniNavSelectionGroup/orion.importExportGroup");e.createFileCommands(d,b,this,c);h=j.createAndPlaceFileCommandsExtension(d,b,h,0,"orion.miniNavSelectionGroup",!0);return m.all([r,h])},createActionSections:function(){var a=this;[this.newActionsScope,this.selectionActionsScope,this.goUpActionsScope].forEach(function(b){if(!a[b]){var c=document.createElement("ul");c.id=b;c.classList.add("commandList");c.classList.add("layoutLeft");c.classList.add("pageActions");a.toolbarNode.appendChild(c);
a[b]=c}})},updateCommands:function(a){if(!(this._lastSelections&&this._lastSelections.length===1&&a&&a.length===1&&this._lastSelections[0].Location===a[0].Location)){this._lastSelections=a;this.createActionSections();var b=this.selectionActionsScope,c=this.treeRoot,d=this.commandRegistry;(!a||a.length===0)&&c.children&&this.selection.setSelections(c.children[0]);(a=f.node(this.goUpActionsScope))&&d.destroy(a);e.updateNavTools(this.registry,d,this,this.newActionsScope,b,c,!0);c.children&&d.renderCommands(this.goUpActionsScope,
a,c.children[0],this,"tool")}},expandToItem:function(a,b){if(a&&this.model){var c=this.model.getId(a);if(f.node(c))this.myTree.isExpanded(a)?b():this.myTree.expand(c,b);else if(a.Parents&&a.Parents.length>0)a.Parents[0].Parents=a.Parents.slice(1),this.expandToItem(a.Parents[0],function(){this.myTree.expand(c,b)}.bind(this))}},changedItem:function(a,b){if(!a||!this.model)this.projectExplorer.changedItem.call(this.projectExplorer,a,!0);else if(!a.Projects){var c;a.Location&&b&&(c=r.prototype.changedItem.call(this,
a,b));this.model.processParent(a,a.children?a.children:[]);this.renderer.updateRow(a,f.node(this.model.getId(a)));return c}}});var J=new s("#{,resource,params*}");v.prototype=Object.create(y.prototype);i.mixin(v.prototype,{showFolderLinks:!0,oneColumn:!0,createFolderNode:function(a){var b=y.prototype.createFolderNode.call(this,a);if(b.tagName==="A")b.classList.add("projectNavFolder"),b.href=J.expand({resource:a.Location});return b},updateRow:function(a,b){if(b){f.empty(b);for(var c=0,e=this.getCellElement(c,
a,b);e;)b.appendChild(e),c===0?this.getPrimColumnStyle?e.classList.add(this.getPrimColumnStyle()):e.classList.add("navColumn"):this.getSecondaryColumnStyle?e.classList.add(this.getSecondaryColumnStyle()):e.classList.add("secondaryColumn"),e=this.getCellElement(++c,a,b)}},getCellElement:function(a,b,c){if((b.Dependency||b.type==="ProjectRoot")&&a===0){a=document.createElement("td");a.className=b.type==="ProjectRoot"?"projectNavColumn projectPrimaryNavColumn":"projectNavColumn";var e=document.createElement("span");
e.id=c.id+"MainCol";e.setAttribute("role","presentation");a.appendChild(e);a.setAttribute("role","presentation");e.className="mainNavColumn projectInformationNode";this.getExpandImage(c,e);var d=b.Dependency?b.Dependency.Name:b.Project?b.Project.Name:b.Name,j=document.createElement("a");if(b.disconnected)d+=" (disconnected)";else if(b.Dependency&&b.FileMetadata)j.href=J.expand({resource:b.FileMetadata.Location});else if(b.Location)j.href=J.expand({resource:b.Location});j.appendChild(document.createTextNode(d));
if(b.Dependency)d=document.createElement("span"),d.className="mainNavColumn",d.style.cssFloat="right",this.explorer.commandRegistry.renderCommands("dependencyCommands",d,b,this,"tool"),a.appendChild(d);e.appendChild(j);this.explorer._makeDropTarget(b,j);this.explorer._makeDropTarget(b,c);j.id=c.id+"NameLink";return a}return y.prototype.getCellElement.call(this,a,b,c)}});x.prototype={render:function(a){var b=document.createElement("div");b.id="projectInfoNode";var c=document.createElement("a");c.style.color=
"black";c.href=J.expand({resource:a.ContentLocation});this.parentNode.appendChild(b)},constructor:x};u.prototype={display:function(b,c){if(b){this.fileMetadata=b;var e=this,d;b&&b.Parents&&b.Parents.length===0?d=b:b&&b.Parents&&(d=b.Parents[b.Parents.length-1]);(c||!(d&&d.Location===this.projectLocation))&&this.fileClient.loadWorkspace().then(function(j){this.projectClient.readProject(b,j).then(function(o){if(o){o.Workspace=j;f.empty(this.parentNode);this.projectLocation=d?d.Location:null;o.type=
"Project";o.Directory=!0;if(o.Dependencies)for(var h=0;h<o.Dependencies.length;h++)(function(a){this.projectClient.getDependencyFileMetadata(o.Dependencies[h],o.WorkspaceLocation).then(function(b){this.fileExplorer.changedItem({Dependency:o.Dependencies[a],FileMetadata:b,Location:b.Location,ChildrenLocation:b.ChildrenLocation},!0)}.bind(this),function(){this.fileExplorer.changedItem({Dependency:o.Dependencies[a],disconnected:!0})}.bind(this))}).call(this,h);this.renderer.render(o);this.fileExplorer.loadRoot(o,
c).then(function(){setTimeout(function(){e.fileExplorer.expandToItem.bind(e.fileExplorer)(b,function(){e.fileExplorer.reveal.bind(e.fileExplorer)(b)})},500)})}else if(f.empty(this.parentNode),this.projectLocation=null,d){var r=document.createElement("div");r.classList.add("noFile");r.textContent=l.NoProject;var k=document.createElement("span");k.classList.add("core-sprite-initproject");k.classList.add("icon-inline");k.classList.add("imageSprite");var w=document.createElement("b");w.appendChild(document.createTextNode(d.Name));
f.processDOMNodes(r,[w,k]);this.parentNode.appendChild(r);d.type="Folder";a.updateNavTools(this.serviceRegistry,this.commandRegistry,this,this.addActionsScope,this.selectionActionsScope,d,!0)}}.bind(this))}.bind(this))}},createToolbar:function(){var a=document.createElement("ul");a.id=this.addActionsScope;a.classList.add("commandList");a.classList.add("layoutLeft");a.classList.add("pageActions");this.toolbarNode.appendChild(a)},changedItem:function(a){a?this.display(a):this.display(this.fileMetadata,
!0)},registerCommands:function(){var b=this.commandRegistry,c=this.fileClient,e=this.serviceRegistry;b.addCommandGroup(this.addActionsScope,"orion.projectNavInitGroup",1001,"Init Project",null,null,"core-sprite-initproject");b.registerCommandContribution(this.addActionsScope,"orion.project.initProject",1,"orion.projectNavInitGroup");a.createProjectCommands(e,b,this,c,this.projectClient)},updateCommands:function(){},destroy:function(){if(this.fileExplorer)this.fileExplorer.destroy(),this.fileExplorer=
null},constructor:u};i.mixin(o.prototype,{label:l.Project,create:function(){var a=this;this.explorer=new u({commandRegistry:this.commandRegistry,dragAndDrop:e.uploadFile,fileClient:this.fileClient,editorInputManager:this.editorInputManager,sidebarNavInputManager:this.sidebarNavInputManager,parentId:this.parentNode.id,parentNode:this.parentNode,projectClient:this.projectClient,rendererFactory:function(b){return new v({checkbox:!1,cachePrefix:"ProjectNav"},b,a.commandRegistry,a.contentTypeRegistry)},
serviceRegistry:this.serviceRegistry,toolbarNode:this.toolbarNode,scopeUp:this.scopeUp});this.editorInputManager.getFileMetadata()?this.explorer.display(this.editorInputManager.getFileMetadata()):this.fileClient.loadWorkspace(this.navigatorInput,!0).then(function(b){a.explorer.display(b)},function(b){a.serviceRegistry.getService("orion.page.progress").setProgressResult(b)})},destroy:function(){this.explorer&&this.explorer.destroy();this.explorer=null}});return o});
define("orion/sidebar","orion/Deferred,orion/objects,orion/commands,orion/outliner,orion/webui/littlelib,orion/URITemplate,orion/PageUtil,orion/widgets/nav/mini-nav,orion/widgets/nav/project-nav,i18n!orion/edit/nls/messages".split(","),function(g,l,i,f,c,d,b,h,k,e){function a(a){this.params=a;this.commandRegistry=a.commandRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.fileClient=a.fileClient;this.editorInputManager=a.editorInputManager;this.outlineService=a.outlineService;this.parentNode=
c.node(a.parent);this.toolbarNode=c.node(a.toolbar);this.selection=a.selection;this.serviceRegistry=a.serviceRegistry;this.sidebarNavInputManager=a.sidebarNavInputManager;this.viewModes={};this.switcherNode=this.modeContributionToolbar=this.activeViewMode=null}var j=new d("#{,resource,params*}");l.mixin(a.prototype,{defaultViewMode:"nav",show:function(){if(!this.created){this.created=!0;var a=this.commandRegistry,c=this.contentTypeRegistry,d=this.fileClient,g=this.editorInputManager,q=this.outlineService,
l=this.parentNode,v=this.progressService,x=this.selection,u=this.serviceRegistry,o=this.toolbarNode,r=this.modeContributionToolbar=document.createElement("div");r.id=o.id+"childModes";o.appendChild(r);var w=this.switcherNode=document.createElement("ul");w.id=o.id+"viewmodeSwitch";w.classList.add("layoutRight");w.classList.add("commandList");w.classList.add("pageActions");o.appendChild(w);o=new i.Command({name:e.View,imageClass:"core-sprite-outline",selectionClass:"dropdownSelection",tooltip:e.ViewTooltip,
id:"orion.sidebar.viewmode",visibleWhen:function(){return!0},choiceCallback:this.viewModeMenuCallback.bind(this)});a.addCommand(o);a.registerCommandContribution(w.id,"orion.sidebar.viewmode",1);this.addViewMode("nav",new h({commandRegistry:a,contentTypeRegistry:c,fileClient:d,editorInputManager:g,parentNode:l,sidebarNavInputManager:this.sidebarNavInputManager,serviceRegistry:u,toolbarNode:r}));var z=this;if(this.serviceRegistry.getServiceReferences("orion.projects").length>0){var y=new k({commandRegistry:a,
contentTypeRegistry:c,fileClient:d,editorInputManager:g,parentNode:l,sidebarNavInputManager:this.sidebarNavInputManager,serviceRegistry:u,toolbarNode:r,scopeUp:function(){var a=b.matchResourceParameters(),c=a.resource;delete a.navigate;delete a.resource;window.location.href=j.expand({resource:c,params:a});z.setViewMode("nav")}});this.editorInputManager.getFileMetadata()&&(this.addViewMode("project",y),this.renderViewModeMenu());this.editorInputManager.addEventListener("InputChanged",function(a){if(a.input){if(z.addViewMode("project",
y),z.renderViewModeMenu(),a.metadata&&a.metadata.Directory)if(a.metadata.Children)for(var b=0;b<a.metadata.Children.length;b++){if(a.metadata.Children[b].Name==="project.json"){z.setViewMode("project");break}}else a.metadata.ChildrenLocation&&z.fileClient.fetchChildren(a.metadata.ChildrenLocation).then(function(a){for(var b=0;b<a.length;b++)if(a[b].Name==="project.json"){z.setViewMode("project");break}})}else z.removeViewMode("project"),z.renderViewModeMenu()});this.sidebarNavInputManager.addEventListener("InputChanged",
function(a){z.editorInputManager.getFileMetadata()||(a.input?z.addViewMode("project",y):z.removeViewMode("project"),z.renderViewModeMenu())})}this.outliner=new f.Outliner({parent:l,toolbar:r,serviceRegistry:u,contentTypeRegistry:c,outlineService:q,commandService:a,selectionService:x,inputManager:g,progressService:v,sidebar:this});this.setViewMode(this.defaultViewMode)}},viewModeMenuCallback:function(){var a=this;return Object.keys(this.viewModes).map(function(b){return{name:a.getViewMode(b).label||
b,callback:a.setViewMode.bind(a,b)}})},getActiveViewModeId:function(){return this.activeViewModeId},addViewMode:function(a,b){if(!a)throw Error("Invalid id: "+a);if(!b||typeof b!=="object")throw Error("Invalid mode: "+b);Object.prototype.hasOwnProperty.call(this.viewModes,a)||(this.viewModes[a]=b)},removeViewMode:function(a){var b=this.getViewMode(a);b&&typeof b.destroy==="function"&&b.destroy();delete this.viewModes[a]},getViewMode:function(a){return Object.prototype.hasOwnProperty.call(this.viewModes,
a)?this.viewModes[a]:null},setViewMode:function(a){var b=this.activeViewMode;b&&typeof b.destroy==="function"&&b.destroy();this.commandRegistry.destroy(this.modeContributionToolbar);c.empty(this.parentNode);this.activeViewModeId=(b=this.activeViewMode=this.getViewMode(a))?a:null;b&&typeof b.create==="function"&&b.create()},renderViewModeMenu:function(){var a=this.switcherNode;this.commandRegistry.destroy(a);Object.keys(this.viewModes).length>1&&this.commandRegistry.renderCommands(a.id,a,{},this,"button")}});
return a});
define("orion/inputManager","i18n!orion/edit/nls/messages,orion/i18nUtil,orion/Deferred,orion/EventTarget,orion/objects,orion/PageUtil".split(","),function(g,l,i,f,c,d){function b(b){this._document=b.document||document;this._timeout=b.timeout;for(var b="keypress,keydown,keyup,mousemove,mousedown,mousemove".split(","),a=function(){this._resetTimer()}.bind(this),c=0;c<b.length;c++)this._document.addEventListener(b[c],a,!0);f.attach(this)}function h(b,a){if(b){if(a.status===0)a={Severity:"Error",Message:g.noResponse};
else{var c=a.responseText;if(c)try{a=JSON.parse(c)}catch(d){a={Severity:"Error",Message:c}}}b.setProgressResult(a)}else window.console.log(a)}function k(b){f.attach(this);this.editor=b.editor;this.serviceRegistry=b.serviceRegistry;this.fileClient=b.fileClient;this.progressService=b.progressService;this.contentTypeRegistry=b.contentTypeRegistry;this.selection=b.selection;this._input=this._title="";this.dispatcher=null;this._unsavedChanges=[]}b.prototype={_resetTimer:function(){var b=this._document.defaultView||
this._document.parentWindow;if(this._timer)b.clearTimeout(this._timer),this._timer=null;if(this._timeout!==-1)this._timer=b.setTimeout(function(){this.onIdle({type:"Idle"});this._timer=null;this._resetTimer()}.bind(this),this._timeout)},onIdle:function(b){return this.dispatchEvent(b)},setTimeout:function(b){this._timeout=b;this._resetTimer()}};c.mixin(k.prototype,{_maybeLoadWorkspace:function(b){var a=this.fileClient;return b===a.fileServiceRootURL(b)?a.loadWorkspace(b).then(function(a){return a.Location}):
(new i).resolve(b)},_read:function(b){var a=this.fileClient,c=Array.prototype.slice.call(arguments,1);return this._maybeLoadWorkspace(b).then(function(b){return a.read.apply(a,[b].concat(c))})},load:function(){var b=this.getInput();if(b){var a=this.fileClient,c=this._parsedLocation.resource,d=this.progressService,f=function(a,b,c){return!d?a:d.progress(a,l.formatMessage(b,c))},k=this.getEditor();if(this._fileMetadata)!this._saving&&!this._fileMetadata.Directory&&!this._readonly&&f(a.read(c,!0),g.ReadingMetadata,
b).then(function(d){if(this._fileMetadata&&this._fileMetadata.Location===d.Location&&this._fileMetadata.ETag!==d.ETag)this._fileMetadata=d,(!k.isDirty()||window.confirm(g.loadOutOfSync))&&f(a.read(c),g.Reading,b).then(function(a){k.setInput(b,null,a);this._unsavedChanges=[]}.bind(this))}.bind(this));else{var i=c;if(i.indexOf("/gitapi/commit/")===0){var q=i.indexOf("/file"),t=i.indexOf("?",q);if(t===-1)t=i.length;i=i.substring(q,t);this._readonly=!0}var v=window.setTimeout(function(){v=null;k.reportStatus(l.formatMessage(g.Fetching,
b))},800),x=function(){k.reportStatus("");v&&window.clearTimeout(v)},u=function(a){x();var b=this.serviceRegistry.getService("orion.page.message");h(b,a);this._setNoInput()}.bind(this);this._acceptPatch=null;f(this._read(i,!0),g.ReadingMetadata,i).then(function(d){d.Directory?f(a.fetchChildren(d.ChildrenLocation),g.Reading,b).then(function(a){x();d.Children=a;this._setInputContents(this._parsedLocation,b,a,d)}.bind(this),u):f(a.read(c,!1,!0),g.Reading,b).then(function(a){x();if(typeof a!=="string")this._acceptPatch=
a.acceptPatch,a=a.result;this._setInputContents(this._parsedLocation,b,a,d)}.bind(this),u)}.bind(this),u)}}},processParameters:function(b){var a=this.getEditor();a.processParameters&&a.processParameters(b)},getEditor:function(){return this.editor},getInput:function(){return this._input},getTitle:function(){return this._title},getFileMetadata:function(){return this._fileMetadata},getReadOnly:function(){var b=this._fileMetadata;return this._readonly||!b||b.Attributes&&b.Attributes.ReadOnly},getContentType:function(){return this._contentType},
save:function(){function b(a){if(f===r.getInput())r.getFileMetadata().ETag=a.ETag,c.setInput(f,null,k,!0);c.reportStatus("");d&&o.setProgressResult({Message:g.Saved,Severity:"Normal"});r.afterSave&&r.afterSave();r._saving=!1}function a(a){c.reportStatus("");h(o,a);r._saving=!1;r._errorSaving=!0}if(!this._saving){var c=this.getEditor();if(c.isDirty()&&!this.getReadOnly()){var d=this._errorSaving;this._saving=!0;var f=this.getInput();c.reportStatus(g["Saving..."]);this.dispatchEvent({type:"Saving",
inputManager:this});c.markClean();var k=c.getText(),i=k;if(this._getSaveDiffsEnabled()&&!this._errorSaving){for(var q=this._unsavedChanges,t=0,v=0;v<q.length;v++)t+=q[v].text.length;k.length>t&&(i={diff:q})}this._unsavedChanges=[];this._errorSaving=!1;var q={ETag:this.getFileMetadata().ETag},x=this._parsedLocation.resource,i=this.fileClient.write(x,i,q),u=this.progressService,o=this.serviceRegistry.getService("orion.page.message");u&&(i=u.progress(i,l.formatMessage(g.savingFile,f)));var r=this;i.then(b,
function(c){c.status===412?window.confirm(g.saveOutOfSync)?(c=r.fileClient.write(x,k),u&&(c=u.progress(c,l.formatMessage(g.savingFile,f))),c.then(b,a)):r._saving=!1:a(c)})}}},setAutoLoadEnabled:function(b){this._autoLoadEnabled=b},setAutoSaveTimeout:function(c){this._autoSaveEnabled=c!==-1;this._idle?this._idle.setTimeout(c):(this._idle=new b({document:document,timeout:c}),this._idle.addEventListener("Idle",function(){this._errorSaving||this.save()}.bind(this)))},setContentType:function(b){this._contentType=
b},setInput:function(b){if(!this._ignoreInput&&(b||(b=d.hash()),typeof b==="string")){var a=this.getEditor();b&&b[0]!=="#"&&(b="#"+b);var c=d.matchResourceParameters(b);if(a.isDirty()&&(a=this._location,d.matchResourceParameters(a).resource!==c.resource))if(this._autoSaveEnabled)this.save();else if(!window.confirm(g.confirmUnsavedChanges)){window.location.hash=a;return}this._location=b;this._parsedLocation=c;this._ignoreInput=!0;this.selection.setSelections(b);this._ignoreInput=!1;(b=c.resource)?
b===this._input?this.processParameters(c):(this._input=b,this._readonly=!1,this._fileMetadata=null,this.load()):this._setNoInput(!0)}},setTitle:function(b){var a=b.lastIndexOf("/");a!==-1&&(b=b.substring(a+1));this._title=b},setSaveDiffsEnabled:function(b){this._saveDiffsEnabled=b},_getSaveDiffsEnabled:function(){return this._saveDiffsEnabled&&this._acceptPatch!==null&&this._acceptPatch.indexOf("application/json-patch")!==-1},_setNoInput:function(b){b?this.fileClient.loadWorkspace("").then(function(a){this._input=
a.ChildrenLocation;this._setInputContents(a.ChildrenLocation,null,a,a)}.bind(this)):(this._input=this._title=null,this.setContentType(null),this.editor.uninstall(),this.dispatchEvent({type:"InputChanged",input:null}))},_setInputContents:function(b,a,c,d){var h,f=!1;d?(this._fileMetadata=d,this.setTitle(d.Location||String(d)),this.setContentType(this.contentTypeRegistry.getFileContentType(d)),h=d.Name,f=d.Directory):(this._fileMetadata=null,this.setTitle(a),this.setContentType(this.contentTypeRegistry.getFilenameContentType(this.getTitle())),
h=this.getTitle());var k=this.getEditor();f?k.uninstall():k.getTextView()||(k.install(),k.getTextView().addEventListener("Focus",function(){this._autoSaveEnabled&&this._errorSaving?this.save():this._autoLoadEnabled&&this.load()}.bind(this)),k.getModel().addEventListener("Changing",function(a){if(this._getSaveDiffsEnabled()){var b=this._unsavedChanges.length,c=a.removedCharCount,e=a.start,d=a.start+c,j=0;a.addedCharCount===0?j=-1:c===0&&(j=1);if(b>0&&j===this.previousChangeType){b=this._unsavedChanges[b-
1];if(c===0&&e===b.end+b.text.length){b.text+=a.text;return}if(a.addedCharCount===0&&d===b.start){b.start=e;return}}this.previousChangeType=j;this._unsavedChanges.push({start:e,end:d,text:a.text})}}.bind(this)));this.dispatchEvent({type:"InputChanged",input:b,name:h,title:a,contentType:this.getContentType(),metadata:d,location:window.location,contents:c});if(!f)k.setInput(a,null,c),this._unsavedChanges=[],this.processParameters(b)}});return{InputManager:k}});
define("orion/parameterCollectors",["i18n!orion/nls/messages","require","orion/webui/littlelib"],function(g,l,i){function f(c,d){this._activeContainer=null;this._getElementsFunction=c;this._toolbarLayoutFunction=d}f.prototype={close:function(){if(this._activeElements){this._activeElements.parameterArea&&i.empty(this._activeElements.parameterArea);this._activeElements.slideContainer&&this._activeElements.slideContainer.classList.remove("slideContainerActive");this._activeElements.dismissArea&&i.empty(this._activeElements.dismissArea);
this._activeElements.commandNode&&this._activeElements.commandNode.classList.remove("activeCommand");this._toolbarLayoutFunction(this._activeElements);if(this._activeElements.onClose)this._activeElements.onClose();if(this._oldFocusNode)this._oldFocusNode.focus(),this._oldFocusNode=null}this._activeElements=null},open:function(c,d,b){typeof c==="string"&&(c=i.node(c));if(this._activeElements&&this._activeElements.slideContainer&&this._activeElements.commandNode===c)return this._activeElements.focusNode&&
this._activeElements.focusNode.focus(),!0;this.close();this._activeElements=null;if((this._activeElements=this._getElementsFunction(c))&&this._activeElements.parameterArea&&this._activeElements.slideContainer){this._activeElements.onClose=b;var h=d(this._activeElements.parameterArea,this._activeElements.dismissArea);if(!h)return!1;this._activeElements.focusNode=h;c=i.$$array("#closebox",this._activeElements.dismissArea||this._activeElements.parameterArea);if(c.length===0){d=this._activeElements.dismissArea||
this._activeElements.parameterArea;c=document.createElement("button");c.id="closebox";c.className="imageSprite core-sprite-close dismissButton";c.title=g.Close;d.appendChild(c);var f=this;c.addEventListener("click",function(){f.close()},!1)}this._activeElements.slideContainer.classList.add("slideContainerActive");this._toolbarLayoutFunction(this._activeElements);if(h)this._oldFocusNode=window.document.activeElement,window.setTimeout(function(){h.focus();h.select&&h.select()},0);this._activeElements.commandNode&&
this._activeElements.commandNode.classList.add("activeCommand");return!0}return!1},_collectAndCall:function(c,d){i.$$array("input",d).forEach(function(b){b.type==="checkbox"?c.parameters.setValue(b.parameterName,b.checked):b.type!=="button"&&c.parameters.setValue(b.parameterName,b.value.trim())});i.$$array("textArea",d).forEach(function(b){c.parameters.setValue(b.parameterName,b.value.trim())});c.command.callback&&c.command.callback.call(c.handler,c)},collectParameters:function(c){return c.parameters?
(c.domNode&&c.domNode.classList.add("commandMarker"),this.open(c.domNode||c.domParent,this.getFillFunction(c))):!1},getFillFunction:function(c,d){var b=this;return function(h,f){var e=null,a=function(){d&&d();b.close()},j=function(e){e.keyCode===i.KEY.ENTER&&b._collectAndCall(c,h);if(e.keyCode===i.KEY.ESCAPE||e.keyCode===i.KEY.ENTER)a(),i.stop(e)};c.parameters.forEach(function(b){var c=null;if(b.label)c=document.createElement("label"),c.classList.add("parameterInput"),c.setAttribute("for",b.name+
"parameterCollector"),c.textContent=b.label,h.appendChild(c);var d=b.name+"parameterCollector",f=c||h;if(b.type==="text"&&typeof b.lines==="number"&&b.lines>1)c=document.createElement("textarea"),c.rows=b.lines,c.type="textarea",c.id=d,f.appendChild(c),j=function(b){b.keyCode===i.KEY.ESCAPE&&(a(),i.stop(b))};else if(b.type==="boolean"){if(c=document.createElement("input"),c.type="checkbox",c.id=d,f.appendChild(c),b.value)c.checked=!0}else if(c=document.createElement("input"),c.type=b.type,c.id=d,
f.appendChild(c),b.value)c.value=b.value;c.classList.add("parameterInput");c.setAttribute("speech","speech");c.setAttribute("x-webkit-speech","x-webkit-speech");c.parameterName=b.name;e||(e=c);c.addEventListener("keydown",j,!1)});var p=f;p||(p=document.createElement("span"),p.classList.add("layoutRight"),p.classList.add("parametersDismiss"),h.appendChild(p));var m=function(a,b){var c=document.createElement("button");b.appendChild(c);a&&c.appendChild(document.createTextNode(a));c.classList.add("dismissButton");
return c};if(c.parameters.hasOptionalParameters())c.parameters.optionsRequested=!1,m(g.More,p).addEventListener("click",function(){c.parameters.optionsRequested=!0;b._collectAndCall(c,h);a()},!1);m(g.Submit,p).addEventListener("click",function(){b._collectAndCall(c,h);a()},!1);p=m(null,p);p.id="closebox";p.classList.add("imageSprite");p.classList.add("core-sprite-close");p.title=g.Close;p.addEventListener("click",function(){a()},!1);return e}}};f.prototype.constructor=f;return{CommandParameterCollector:f}});
define("orion/breadcrumbs",["require","orion/webui/littlelib"],function(g,l){function i(f){this._init(f)}i.prototype={_init:function(f){var c=l.node(f.container);if(!c)throw"no parent container";this._container=c;c.classList.remove("currentLocation");this._id=f.id||"eclipse.breadcrumbs";this._resource=f.resource||null;this._rootSegmentName=f.rootSegmentName;this._workspaceRootSegmentName=f.workspaceRootSegmentName;this._workspaceRootURL=f.workspaceRootURL;this._makeHref=f.makeHref;this.path="";this.measure();
this.render()},getNavigatorWorkspaceRootSegment:function(){if(this._workspaceRootSegmentName){var f;if(this._resource&&this._resource.Parents){f=document.createElement("a");var c=this._workspaceRootURL?this._workspaceRootURL:"";this._makeHref?this._makeHref(f,c):f.href=g.toUrl("edit/edit.html")+"#"+c}else f=document.createElement("span");l.empty(f);f.appendChild(document.createTextNode(this._workspaceRootSegmentName));return f}return null},MAX_LENGTH:500,INCLUDE_FIRST_SECTION:!0,segments:[],buildSegment:function(f){var c=
document.createElement("a");c.classList.add("breadcrumb");c.appendChild(document.createTextNode(f));return c},addSegmentHref:function(f,c){this._makeHref?this._makeHref(f,c.Location,c):f.href=g.toUrl("edit/edit.html")+"#"+c.ChildrenLocation},buildSegments:function(f,c){if(this._resource.Parents){var d=this._resource.Parents.slice(0),b,h;d&&(d=d.slice(0),c==="reverse"&&(d=d.reverse().slice(0)),d.forEach(function(c){f?(h=f,f=null):h=c.Name;b=this.buildSegment(h);this.path+=c.Name;this.addSegmentHref(b,
c);b.include=!1;this.segments.push(b)}.bind(this)))}},addDivider:function(){var f=document.createElement("span");f.appendChild(document.createTextNode(" / "));this.path+="/";f.classList.add("breadcrumbSeparator");this.append(f)},refresh:function(){(this.crumbs=l.node(this._id))?l.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(f){this.crumbs.appendChild(f)},addTitle:function(f,c){var d=c||document.title;this.crumbs.childNodes.length===0&&(f=document.createElement("span"),f.appendChild(document.createTextNode(d)),f.classList.add("breadcrumb"),f.classList.add("currentLocation"),this.append(f))},finalSegment:function(f,
c){f=document.createElement("span");c?f.appendChild(document.createTextNode(c)):f.appendChild(document.createTextNode(this._resource.Name));f.classList.add("currentLocation");this.path+=this._resource.Name;this.append(f)},firstSegment:function(f){if(f)this.append(f),this._resource&&this._resource.Parents?(f.classList.add("breadcrumb"),this.addDivider()):(f.href="",f.classList.add("currentLocation"))},drawSegments:function(){this._resource.Parents&&this.segments.slice(0).forEach(function(f){f.include===
!0&&(this.append(f),this.addDivider())}.bind(this))},measureSegments:function(){this.INCLUDE_FIRST_SECTION=!0;if(this._resource.Parents){var f=this.segments.slice(0).reverse();f.forEach(function(c){this.append(c);this.addDivider();this.crumbs.offsetWidth<this.MAX_LENGTH?c.include=!0:this.INCLUDE_FIRST_SECTION=!1}.bind(this));this.segments=f.reverse()}},measure:function(){var f=document.getElementById("location");f.style.width="auto";this.MAX_LENGTH=f.offsetWidth;this.refresh();this.segments=[];this.crumbs.style.visibility=
"hidden";var f=this.getNavigatorWorkspaceRootSegment(),c=this._rootSegmentName;if(c)this.addTitle(f,c);else if(this.finalSegment(f,c),this._resource&&this._resource.Parents&&(this.buildSegments(c,"reverse"),this.measureSegments(),this.firstSegment(f)),this.crumbs.offsetWidth>=this.MAX_LENGTH)this.INCLUDE_FIRST_SECTION=!1},render:function(){this.refresh();var f=this.getNavigatorWorkspaceRootSegment(),c=this._rootSegmentName;c?this.addTitle(f,c):(this.INCLUDE_FIRST_SECTION===!0&&this.firstSegment(f),
this._resource&&this._resource.Parents&&(this.drawSegments(),this.finalSegment(f,c)));this.crumbs.parentNode.style.width=this.crumbs.offsetWidth+20+"px"}};i.prototype.constructor=i;return{BreadCrumbs:i}});
define("orion/webui/splitter",["require","orion/EventTarget","orion/webui/littlelib"],function(g,l,i){function f(c){l.attach(this);this._init(c)}f.prototype={_init:function(c){this._tracking=null;this._animationDelay=501;this.$node=i.node(c.node);if(!this.$node)throw"no dom node for splitter found";this.$sideNode=i.node(c.sidePanel);if(!this.$sideNode)throw"no dom node for side panel found";this.$mainNode=i.node(c.mainPanel);if(!this.$mainNode)throw"no dom node for main panel found";this._vertical=
c.vertical;this._prefix="/orion/splitter/"+(this.$node.id||document.body.id||"");if(c.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=this.$node.getAttribute("data-initial-state")==="closed";if(typeof c.closeByDefault!=="undefined")this._closeByDefault=c.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";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},toggleSidePanel:function(){this._thumbDown()},openSidePanel:function(){this._closed||
this._thumbDown()},addResizeListener:function(c){this.addEventListener("resize",function(d){c(d.node)})},_initializeFromStoredSettings:function(){var c=localStorage.getItem(this._prefix+"/toggleState");this._closed=typeof c==="string"?c==="closed":this._closeByDefault;if(this._vertical)if(c=localStorage.getItem(this._prefix+"/yPosition"))this._splitTop=parseInt(c,10);else{if(this._closeByDefault)this._initialSplit=this._getSplitPosition(),this._splitTop=0}else if(c=localStorage.getItem(this._prefix+
"/xPosition"))this._splitLeft=parseInt(c,10);else if(this._closeByDefault)this._initialSplit=this._getSplitPosition(),this._splitLeft=0},_getSplitPosition:function(){var c=i.bounds(this.$node),d=i.bounds(this.$node.parentNode);return this.vertical?c.top-d.top:c.left-d.left},_adjustToSplitPosition:function(c){var d=i.bounds(this.$node),b=i.bounds(this.$node.parentNode);if(this._vertical){this._splitHeight=d.height;if(c||!this._splitTop)this._splitTop=d.top,localStorage.setItem(this._prefix+"/yPosition",
this._splitTop);c=this._splitTop;this.$node.parentNode.style.position==="relative"&&(c=this._splitTop-b.top);this.$sideNode.style.height=c+"px";this.$sideNode.style.display="block";this.$node.style.top=c+"px"}else{this._splitWidth=d.width;if(c||!this._splitLeft)this._splitLeft=d.left,localStorage.setItem(this._prefix+"/xPosition",this._splitLeft);c=this._splitLeft;this.$node.parentNode.style.position==="relative"&&(c=this._splitLeft-b.left);this.$sideNode.style.width=c+"px";this.$sideNode.style.display=
"block";this.$node.style.left=c+"px"}this._resize()},_resize:function(c,d,b){var c=c||0,h=i.bounds(this.$node.parentNode),f=i.bounds(this.$node);if(this._vertical){if(b===void 0)b=f.top,this.$node.parentNode.style.position==="relative"&&(b-=h.top);b+=f.height;this.$mainNode.style.top=b+"px"}else{if(d===void 0)d=f.left,this.$node.parentNode.style.position==="relative"&&(d-=h.left);d+=f.width;this.$mainNode.style.left=d+"px"}var e=this;window.setTimeout(function(){e._notifyResizeListeners(e.$mainNode);
e._notifyResizeListeners(e.$sideNode)},c)},_notifyResizeListeners:function(c){this.dispatchEvent({type:"resize",node:c})},_notifyToggleListeners:function(){this.dispatchEvent({type:"toggle",closed:this._closed})},_thumbDown:function(c,d){c||this._addAnimation();var b=this._splitTop,h=this._splitLeft;if(this._closed){if(this._closed=!1,!this._splitLeft&&!this._splitTop&&typeof this._initialSplit==="number")b=h=this._initialSplit}else this._closed=!0,b=h=0;this._vertical?(this.$sideNode.style.height=
b+"px",this.$node.style.top=b+"px"):(this.$sideNode.style.width=h+"px",this.$node.style.left=h+"px");this._resize(this._animationDelay,h,b);c||this._removeAnimation();d||localStorage.setItem(this._prefix+"/toggleState",this._closed?"closed":null);var f=this;window.setTimeout(function(){f._notifyToggleListeners()},this._animationDelay)},_removeAnimation:function(){var c=this;window.setTimeout(function(){c.$sideNode.classList.remove(c._vertical?"sidePanelVerticalLayoutAnimation":"sidePanelLayoutAnimation");
c.$mainNode.classList.remove(c._vertical?"mainPanelVerticalLayoutAnimation":"mainPanelLayoutAnimation");c.$node.classList.remove(c._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")},_mouseDown:function(c){if(c.target===this._thumb)return i.stop(c),this._thumbDown();if(!this._tracking)this.$node.classList.add("splitTracking"),this.$mainNode.classList.add("panelTracking"),this.$sideNode.classList.add("panelTracking"),this._tracking=this._mouseMove.bind(this),window.addEventListener("mousemove",this._tracking),i.stop(c)},_mouseMove:function(c){if(this._tracking){var d=i.bounds(this.$node.parentNode);if(this._vertical){this._splitTop=c.clientY;if(this._splitTop<
d.top+5)this._splitTop=d.top+5;else if(this._splitTop>d.top+d.height-5)this._splitTop=d.top+d.height-5;var b=this._splitTop;this.$node.parentNode.style.position==="relative"&&(b=this._splitTop-d.top);this.$node.style.top=b+"px"}else{this._splitLeft=c.clientX;if(this._splitLeft<d.left+5)this._splitLeft=d.left+5;else if(this._splitLeft>d.left+d.width-5)this._splitLeft=d.left+d.width-5;b=this._splitLeft;this.$node.parentNode.style.position==="relative"&&(b=this._splitLeft-d.left);this.$node.style.left=
b+"px"}this._adjustToSplitPosition(!0);i.stop(c)}},_mouseUp:function(c){if(this._tracking)window.removeEventListener("mousemove",this._tracking),this._tracking=null,this.$node.classList.remove("splitTracking"),this.$mainNode.classList.remove("panelTracking"),this.$sideNode.classList.remove("panelTracking"),i.stop(c)}};f.prototype.constructor=f;return{Splitter:f}});
define("orion/widgets/themes/ThemePreferences",[],function(){function g(g,i){this._preferences=g;this._themeData=i;var f=i.getThemeStorageInfo(),c=g.listenForChangedSettings(f.storage,2,function(d){d.key===c&&this.apply()}.bind(this))}g.prototype={_initialize:function(g,i,f){var c=f.get(g.styleset);c||(c=i.getStyles(),f.put(g.styleset,JSON.stringify(c)));(i=f.get("selected"))&&(i=JSON.parse(i));if(!i||i[g.selectedKey]===void 0)i=i||{},i[g.selectedKey]=g.defaultTheme,f.put("selected",JSON.stringify(i))},
apply:function(){this.setTheme()},getTheme:function(g){var i=this._themeData,f=i.getThemeStorageInfo();this._preferences.getPreferences(f.storage,2).then(function(c){this._initialize(f,i,c);var d=JSON.parse(c.get("selected")),c=JSON.parse(c.get(f.styleset)),b;if(c)for(var h=0;h<c.length;h++)if(c[h].name===d[f.selectedKey]){b=c[h];break}g({style:b,styles:c})}.bind(this))},setTheme:function(g,i){var f=this._themeData,c=f.getThemeStorageInfo();this._preferences.getPreferences(c.storage,2).then(function(d){this._initialize(c,
f,d);var b=JSON.parse(d.get("selected"));g||(g=b[c.selectedKey]);b[c.selectedKey]=g;d.put("selected",JSON.stringify(b));i?d.put(c.styleset,JSON.stringify(i)):i=JSON.parse(d.get(c.styleset));for(d=0;d<i.length;d++)if(i[d].name===b[c.selectedKey]){f.processSettings(i[d]);break}}.bind(this))},setFontSize:function(g){var i=this._themeData,f=i.getThemeStorageInfo();this._preferences.getPreferences(f.storage,2).then(function(c){this._initialize(f,i,c);var d=JSON.parse(c.get("selected")),b=JSON.parse(c.get(f.styleset)),
h;if(b)for(var k=0;k<b.length;k++)b[k].fontSize=g,b[k].name===d[f.selectedKey]&&(h=b[k]);c.put(f.styleset,JSON.stringify(b));i.processSettings(h)}.bind(this))}};return{ThemePreferences:g}});
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 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",
"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",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 local editor settings drop down.",autoPairParentheses:"Autopair (Parentheses)",autoPairBraces:"Autopair {Braces}",autoPairSquareBrackets:"Autopair [Square] Brackets",autoPairAngleBrackets:"Autopair <Angle> Brackets",autoPairQuotations:'Autopair "Strings"',autoCompleteComments:"Autocomplete /** Block Comments */",smartIndentation:"Smart Indentation",sourceControl:"Source Control",showBlame:"Show Blame","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: "});define("orion/settings/nls/messages",["orion/i18n!orion/settings/nls/messages","orion/settings/nls/root/messages"],function(g,l){var i={root:l};Object.keys(g).forEach(function(f){typeof i[f]==="undefined"&&(i[f]=g[f])});return i});
define("orion/editor/eventTarget",[],function(){function g(){}g.addMixin=function(l){var i=g.prototype,f;for(f in i)i.hasOwnProperty(f)&&(l[f]=i[f])};g.prototype={addEventListener:function(g,i,f){if(!this._eventTypes)this._eventTypes={};var c=this._eventTypes[g];c||(c=this._eventTypes[g]={level:0,listeners:[]});c.listeners.push({listener:i,useCapture:f})},dispatchEvent:function(g){var i=g.type;this._dispatchEvent("pre"+i,g);this._dispatchEvent(i,g);this._dispatchEvent("post"+i,g)},_dispatchEvent:function(g,
i){var f=this._eventTypes?this._eventTypes[g]:null;if(f){var c=f.listeners;try{if(f.level++,c)for(var d=0,b=c.length;d<b;d++)if(c[d]){var h=c[d].listener;typeof h==="function"?h.call(this,i):h.handleEvent&&typeof h.handleEvent==="function"&&h.handleEvent(i)}}finally{if(f.level--,f.compact&&f.level===0){for(d=c.length-1;d>=0;d--)c[d]||c.splice(d,1);c.length===0&&delete this._eventTypes[g];f.compact=!1}}}},isListening:function(g){return!this._eventTypes?!1:this._eventTypes[g]!==void 0},removeEventListener:function(g,
i,f){if(this._eventTypes){var c=this._eventTypes[g];if(c){for(var d=c.listeners,b=0,h=d.length;b<h;b++){var k=d[b];if(k&&k.listener===i&&k.useCapture===f){c.level!==0?(d[b]=null,c.compact=!0):d.splice(b,1);break}}d.length===0&&delete this._eventTypes[g]}}}};return{EventTarget:g}});
define("orion/editor/textTheme",["require","orion/editor/eventTarget","orion/util"],function(g,l,i){function f(c){c=c||{};this._document=c.document||document}var c={};f.getTheme=function(d){var d=d||"default",b=c[d];b||(b=c[d]=new f);return b};f.prototype={getThemeClass:function(){return this._themeClass},setThemeClass:function(c,b){var h=this,f=h._themeClass;h._themeClass=c;this._load(c,b,function(){h.onThemeChanged({type:"ThemeChanged",oldValue:f,newValue:h.getThemeClass()})})},onThemeChanged:function(c){return this.dispatchEvent(c)},
buildStyleSheet:function(c,b){function h(b,a,j){a&&(f.push("."+c+" ."+b+" {"),f.push("\t"+(j?"background-color":"color")+": "+a+";"),f.push("}"))}var f=[];f.push("");f.push("."+c+" {");b.fontFamily&&f.push("\tfont-family: "+b.fontFamily+";");b.fontSize&&f.push("\tfont-size: "+b.fontSize+";");b.fontSize&&f.push("\tcolor: "+b.text+";");f.push("}");f.push("."+c+".textview {");b.background&&f.push("\tbackground-color: "+b.background+";");f.push("}");h("ruler.annotations",b.annotationRuler,!0);h("ruler.lines",
b.annotationRuler,!0);h("ruler.folding",b.annotationRuler,!0);h("ruler.overview",b.overviewRuler,!0);h("rulerLines",b.lineNumber,!1);h("rulerLines.even",b.lineNumberEven,!1);h("rulerLines.odd",b.lineNumberOdd,!1);h("annotationLine.currentLine",b.currentLine,!0);h("entity-name-tag",b.keyword,!1);h("entity-other-attribute-name",b.attribute,!1);h("string-quoted",b.string,!1);h("line_caret",b.currentLine,!0);h("token_keyword",b.keyword,!1);h("token_string",b.string,!1);h("token_singleline_comment",b.comment,
!1);h("token_multiline_comment",b.comment,!1);h("token_doc_comment",b.comment,!1);h("token_doc_html_markup",b.comment,!1);return f.join("\n")},_createStyle:function(c,b,h,f){var e=this._document,c="orion-theme-"+c,a=e.getElementById(c);if(a){if(f||a.firstChild.data===b)return;a.removeChild(a.firstChild);a.appendChild(e.createTextNode(b))}else f?(a=i.createElement(e,"link"),a.rel="stylesheet",a.type="text/css",a.href=b,a.addEventListener("load",function(){h()})):(a=i.createElement(e,"style"),a.appendChild(e.createTextNode(b))),
a.id=c,(e.getElementsByTagName("head")[0]||e.documentElement).appendChild(a);f||h()},_load:function(c,b,h){if(c)if(typeof b==="string")this._createStyle(c,b,h);else if(b=b.href,b.substring(b.length-4)!==".css"&&(b+=".css"),/^\//.test(b)||/[a-zA-Z0-9]+:\/\//i.test(b)||!g.toUrl)this._createStyle(c,b,h,!0);else{var f=this;g(["text!"+b],function(b){f._createStyle(c,b,h,!1)})}else h()}};l.EventTarget.addMixin(f.prototype);return{TextTheme:f}});
define("orion/widgets/themes/ThemeClass",[],function(){function g(g){this.attributes=[];this.element=document.createElement("div");this.style=this.element.style;this.className=g;this.classString="."+g+"{ "}g.prototype.className=null;g.prototype.classString=void 0;g.prototype.style=void 0;g.prototype.closeString=" }\n";g.prototype.toString=function(){return this.classString=this.classString+this.style.cssText+this.closeString};return{ThemeClass:g}});
define("orion/widgets/themes/container/ThemeSheetWriter",["orion/widgets/themes/ThemeClass"],function(g){function l(){}l.prototype.navbar="#333";l.prototype.button="#777777";l.prototype.location="#EFEFEF";l.prototype.selection="FEC";l.prototype.sidepanel="#FBFBFB";l.prototype.mainpanel="white";l.prototype.navtext="#bfbfbf";l.prototype.content="#3087B3";l.prototype.search="#444";l.prototype.toolpanel="white";l.prototype.writeNavigationStyle=function(){var i="",f=[],c=new g.ThemeClass("orionPage");
c.style.backgroundColor="#fdfdfd";c.style.width="100%";c.style.height="100%";f.push(c);c=new g.ThemeClass("topRowBanner");c.style.margin="0";c.style.border="0";c.style.backgroundColor=this.navbar;c.style.height="16px";c.style.padding="10px";c.style.paddingLeft="6px";c.style.paddingRight="2px";f.push(c);c=new g.ThemeClass("a");c.style.textDecoration="none";c.style.color=this.content;f.push(c);c=new g.ThemeClass("navlink");c.style.display="inline-block";c.style.padding="2px";c.style.color=this.content;
f.push(c);c=new g.ThemeClass("primaryNav");c.style.color=this.navtext;c.style.fontSize="8pt";c.style.fontWeight="normal";c.style.paddingTop="0";c.style.verticalAlign="baseline";f.push(c);c=new g.ThemeClass("primaryNav a");c.style.fontSize="8pt";c.style.color=this.navtext;c.style.marginRight="6px";c.style.marginLeft="6px";c.style.verticalAlign="baseline";c.style.textDecoration="none";f.push(c);c=new g.ThemeClass("primaryNav a:hover");c.style.color="#bfbfbf";c.style.cursor="hand";c.style.color="white";
c.style.fontWeight="normal";f.push(c);for(var d in f)i+=f[d].toString();return i};l.prototype.writeLocationStyle=function(){var i="",f=[],c=new g.ThemeClass("titleArea");c.style.margin="0";c.style.paddingTop="5px";c.style.border="0";c.style.background=this.location;c.style.background="-webkit-gradient(linear, left top, left bottom, color-stop(0%,"+this.location+"), color-stop(100%,"+this.location+"))";c.style.borderBottom="1px solid "+this.location;c.style.minHeight="20px";f.push(c);c=new g.ThemeClass("breadcrumb");
c.style.fontSize="8pt";c.style.textDecoration="none";c.style.color="#f1f1f2;";c.style.paddingTop="2px";f.push(c);c=new g.ThemeClass("a.breadcrumb:hover");c.style.textDecoration="none";c.style.borderBottom="1px dotted";c.style.color="#F58B0F";c.style.cursor="pointer";f.push(c);c=new g.ThemeClass("breadcrumbSeparator");c.style.fontSize="8pt";c.style.textDecoration="none";c.style.color="#f1f1f2";c.style.fontWeight="bold";f.push(c);c=new g.ThemeClass("currentLocation");c.style.fontWeight="bold";c.style.fontSize=
"8pt";c.style.color="#f1f1f2";c.style.textDecoration="none";c.style.textWrap="normal";c.style.lineHeight="10pt";f.push(c);c=new g.ThemeClass("a.currentLocation:hover");c.style.fontWeight="bold";c.style.fontSize="10pt";c.style.color="#666666";c.style.textDecoration="none";c.style.borderBottom="0";f.push(c);c=new g.ThemeClass("navlinkonpage");c.style.color=this.content;f.push(c);c=new g.ThemeClass("progressPane_running");c.style.background="url(../images/progress_running_dark.gif) no-repeat center";
c.style.width="16px";c.style.height="16px";f.push(c);for(var d in f)i+=f[d].toString();return i};l.prototype.writeButtonStyle=function(){var i="",f=[],c=new g.ThemeClass("commandButton");c.style.color="#666";c.style.border="1px solid #dedede";c.style.backgroundColor="#ddd";c.style.textAlign="center";c.style.verticalAlign="baseline";c.style.cursor="pointer";c.style.display="inline-block";c.style.padding="4px 6px";c.style.borderRadius="3px";c.style.lineHeight="12px";c.style.fontSize="8pt";c.style.userSelect=
"none";f.push(c);c=new g.ThemeClass("commandButton:over");c.style.backgroundColor="#e6e6e6";c.style.border="1px solid #808080";f.push(c);c=new g.ThemeClass("commandMenu");c.style.color="#222";c.style.display="inline-block";c.style.verticalAlign="baseline";c.style.margin="0";c.style.fontSize="8pt";c.style.fontWeight="normal";c.style.border="1px solid #dedede";c.style.backgroundColor="#efefef";c.style.cursor="pointer";c.style.borderRadius="1px";f.push(c);c=new g.ThemeClass("commandMenuItem");c.style.border=
"0";c.style.padding="0";c.style.margin="0";f.push(c);for(var d in f)i+=f[d].toString();return i};l.prototype.writeMainStyle=function(){var i="",f=[],c=new g.ThemeClass("searchbox");c.style.backgroundImage="url(../images/core_sprites.png)";c.style.backgroundRepeat="no-repeat";c.style.backgroundPosition="4px -297px";c.style.width="12px";c.style.height="12px";c.style.backgroundColor=this.search;c.style.border="1px solid "+this.search;c.style.fontSize="11px";c.style.width="15em";c.style.height="16px";
c.style.borderRadius="10px";c.style.color="#999";c.style.padding="0";c.style.paddingLeft="20px";c.style.marginLeft="5px";c.style.marginTop="6px !important";c.style.font="7pt Lucida Sans Unicode,Lucida Grande,Verdana,Arial,Helvetica,Myriad,Tahoma,clean,sans-serif !important";f.push(c);c=new g.ThemeClass("searchbox:focus");c.style.color="white";c.style.outline="none";f.push(c);c=new g.ThemeClass("checkedRow");c.style.cssText="background-color:"+this.selection+" !important;";f.push(c);c=new g.ThemeClass("navbar-item-selected");
c.style.background=this.selection;c.style.color=this.content;f.push(c);c=new g.ThemeClass("auxpane");c.style.border="0";c.style.background=this.sidepanel;c.style.background="-webkit-gradient(linear, left top, left bottom, color-stop(0%,"+this.sidepanel+"), color-stop(100%,"+this.sidepanel+"))";c.style.background="-moz-linear-gradient(top, "+this.sidepanel+" 0%, "+this.sidepanel+" 100%)";f.push(c);c=new g.ThemeClass("mainpane");c.style.background=this.mainpanel;c.style.border=0;f.push(c);c=new g.ThemeClass("mainToolbar");
c.style.background=this.toolpanel;c.style.height="32px";c.style.borderBottom="1px solid #ebebeb";c.style.paddingTop="3px";f.push(c);for(var d in f)i+=f[d].toString();return i};l.prototype.render=function(){console.log(this.writeNavigationStyle());console.log(this.writeLocationStyle());console.log(this.writeMainStyle());console.log(this.writeButtonStyle())};l.prototype.getSheet=function(g){g.navbar.value?(this.navbar=g.navbar.value,this.button=g.button.value,this.location=g.location.value,this.selection=
g.selection.value,this.sidepanel=g.sidepanel.value,this.mainpanel=g.mainpanel.value,this.navtext=g.navtext.value,this.search=g.search.value,this.content=g.content.value,this.toolpanel=g.toolpanel.value):(this.navbar=g.navbar,this.button=g.button,this.location=g.location,this.selection=g.selection,this.sidepanel=g.sidepanel,this.mainpanel=g.mainpanel,this.navtext=g.navtext,this.search=g.search,this.content=g.content,this.toolpanel=g.toolpanel);return this.writeNavigationStyle()+this.writeLocationStyle()+
this.writeMainStyle()+this.writeButtonStyle()};return{ThemeSheetWriter:l}});
define("orion/widgets/themes/container/ThemeData",["i18n!orion/settings/nls/messages","orion/editor/textTheme","orion/widgets/themes/container/ThemeSheetWriter"],function(g,l,i){function f(){}function c(){this.styles=[];var b=new f;b.name="Orion";b.navbar="#404648";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";this.styles.push(b);
b=new f;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";this.styles.push(b);b=new f;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";this.styles.push(b);b=new f;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";this.styles.push(b);b=new f;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";this.styles.push(b);b=new f;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";this.styles.push(b);b=new f;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";this.styles.push(b)}function d(){return this.styles}f.prototype.name="Orion";f.prototype.navbar="#404648";f.prototype.button="#EFEFEF";f.prototype.location="#333";f.prototype.breadcrumb=
"#3087B3";f.prototype.separator="#333";f.prototype.selection="FEC";f.prototype.sidepanel="#FBFBFB";f.prototype.mainpanel="white";f.prototype.toolpanel="white";f.prototype.navtext="#bfbfbf";f.prototype.content="#3087B3";f.prototype.search="#444";c.prototype.styles=[];c.prototype.getStyles=d;c.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"styles",defaultTheme:"Orion",selectedKey:"selected"}};c.prototype.getViewData=function(){var b={top:10,left:10,width:350,height:350};
b.shapes=[{type:"RECTANGLE",name:g["Navigation Bar"],x:10,y:10,width:350,height:32,family:"navbar",fill:"#333",order:1},{type:"TEXT",name:g["Navigation Text"],label:"UserName",x:290,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif"},{type:"ROUNDRECTANGLE",name:g["Search Box"],x:215,y:20,width:70,height:12,family:"search",fill:"#444",order:3},{type:"RECTANGLE",name:g["Tool Panel"],x:150,y:71,width:209,height:30,family:"toolpanel",fill:"white",order:4},{type:"RECTANGLE",name:g["Selection Bar"],
x:155,y:133,width:200,height:20,family:"selection",fill:"#FEC",order:7},{type:"RECTANGLE",name:g.Location,x:10,y:42,width:350,height:29,family:"location",fill:"#efefef",order:8},{type:"TEXT",name:g["Navigation Text"],label:"Navigator",x:60,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif",order:2},{type:"TEXT",name:g.Content,label:"Breadcrumb",x:15,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},{type:"TEXT",name:g.Content,label:"/",x:78,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif",
order:9},{type:"TEXT",name:g.Content,label:"Location",x:84,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},{type:"RECTANGLE",name:g["Main Panel"],x:150,y:101,width:209,height:258,family:"mainpanel",fill:"white",order:6},{type:"ROUNDRECTANGLE",name:g.Button,x:155,y:76,width:37,height:20,family:"button",fill:"#EFEFEF",order:11},{type:"TEXT",name:g["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:g["Section Text"],label:"Section",x:30,y:94,family:"navbar",fill:"#333",font:"8pt sans-serif"},{type:"LINE",name:g["Line Color"],x1:150,y1:101,x2:360,y2:101,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:g["Line Color"],x1:150,y1:71,x2:150,y2:360,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:g["Line Color"],x1:20,y1:100,x2:140,
y2:100,linewidth:2,fill:"#DEDEDE"},{type:"RECTANGLE",name:g["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:g["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 c=0;c<3;c++)b.shapes.push({type:"TEXT",name:g.Content,label:"org.eclipse.orion.content",x:170,y:127+20*c,fill:"#3087B3",family:"content"});for(c=0;c<3;c++)b.shapes.push({type:"TEXT",name:g.Content,label:"Item",x:25,y:115+20*c,fill:"#3087B3",family:"content"});for(c=0;c<3;c++)b.shapes.push({type:"TRIANGLE",
name:"twisty",x1:160,y1:121+c*20,x2:165,y2:124+c*20,x3:160,y3:127+c*20,family:"navbar",fill:"#333"});b.shapes.push({type:"IMAGE",name:"logo",x:15,y:18,source:"../../images/orion-transparent.png",family:"logo"});return b};c.prototype.processSettings=function(b){var c=new i.ThemeSheetWriter;(new l.TextTheme.getTheme("orionTheme")).setThemeClass("orionTheme",c.getSheet(b))};return{ThemeData:c,getStyles:d}});
define("orion/widgets/userAssistance/UATaskPanel",["orion/webui/littlelib"],function(g){function l(i,f,c){this.elements=c;this.taskPanel=document.createElement("div");this.taskPanel.className="UAContainer";this.taskPanel.innerHTML='<header class="UAHeader">Develop software from within the cloud</header>';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);f===!0?(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),g.addAutoDismiss([this.container],this.destroy.bind(this))):i.appendChild(this.taskPanel);this.chosenSwitch=this.createSwitch(null,!0);this.chosenSwitch.firstChild.className="chosenCircle";this.initialize();this.elements.forEach(this.createSwitch.bind(this))}l.prototype.elementNode=null;l.prototype.switchesContainer=null;l.prototype.switches=null;l.prototype.radioButtons=null;l.prototype.chosenSwitch=null;l.prototype.addElement=
function(g){var f=document.createElement("span");f.className="UAContainer-icon";f.innerHTML='<span class="workingSpan"><img src="'+g.image+'" id="'+g.label+'ImageNode" alt="'+g.alt+'" height="64" width="64"></span><span class="UAIcon-label"><span class="UALabel" id="'+g.label+'LabelNode" >'+g.label+"</span></span>";f.onmouseover=function(){document.getElementById(g.label+"ImageNode").src=g.secondaryImage;document.getElementById(g.label+"LabelNode").className="UALabel-live";f.className="UAContainer-icon-live"};
f.onmouseout=function(){document.getElementById(g.label+"ImageNode").src=g.image;document.getElementById(g.label+"LabelNode").className="UALabel";f.className="UAContainer-icon"};var c=this;f.onclick=function(){c.showMedia(g)};this.elementNode.appendChild(f)};l.prototype.clearElements=function(){this.elementNode.innerHTML=""};l.prototype.showMedia=function(g){this.clearElements();this.addElement(g);var f=document.createElement("span");f.className="UAContainer-media";f.innerHTML='<div></div><div></div><span class="mediaSpan"><img src="'+
g.media+'" alt="'+g.alt+'" height="300" width="400"></span>';this.elementNode.appendChild(f);setTimeout(function(){f.style.opacity=1},100);g=document.getElementById(g.label+"switch");this.chosenSwitch.firstChild.className="circle";this.chosenSwitch=g.parentNode;g.className="chosenCircle"};l.prototype.createSwitch=function(g){var f;f=g?g.label+"switch":"indexSwitch";var c=document.createElement("span");c.className="workingSpan";c.innerHTML='<div class="circle" id ="'+f+'"></div>';var d=this;c.onclick=
g?function(){d.showMedia(g)}:function(){d.initialize();d.chosenSwitch.firstChild.className="circle";d.chosenSwitch=c;d.chosenSwitch.firstChild.className="chosenCircle"};this.switches.appendChild(c);return this.radioButtons[this.radioButtons.length]=c};l.prototype.initialize=function(){this.clearElements();this.elements.forEach(this.addElement.bind(this))};l.prototype.destroy=function(){document.body.removeChild(this.backdrop);document.body.removeChild(this.container)};return l});
define("orion/widgets/UserMenu","i18n!orion/widgets/nls/messages,require,orion/webui/littlelib,orion/PageLinks,orion/widgets/userAssistance/UATaskPanel,orion/webui/dialog".split(","),function(g,l,i,f,c){function d(b){this._displaySignOut=!0;this._init(b)}d.prototype={_init:function(b){this._dropdownNode=i.node(b.dropdownNode);if(!this._dropdownNode)throw"no dom node for dropdown found";this._dropdown=b.dropdown;this._serviceRegistry=b.serviceRegistry;this.authenticatedServices={};this.unauthenticatedServices=
{};this._noSeparator=b.noSeparator;this._dropDownItemClass=b.dropDownItemClass;this._keyAssistClass=b.keyAssistClass;if(b.signOut!==void 0)this._displaySignOut=b.signOut},isSingleService:function(){return this.length(this.unauthenticatedServices)+this.length(this.authenticatedServices)===1},hasServices:function(){return this.length(this.unauthenticatedServices)+this.length(this.authenticatedServices)>0},length:function(b){var c=0,d;for(d in b)b.hasOwnProperty(d)&&c++;return c},_makeMenuItem:function(b,
c){var d=document.createElement("span");d.role="menuitem";d.tabIndex=0;var e=document.createTextNode(b);d.appendChild(e);typeof this._dropDownItemClass==="string"?this._dropDownItemClass!==""&&d.classList.add(this._dropDownItemClass):d.classList.add("dropdownMenuItem");d.addEventListener("click",c,!1);d.addEventListener("keydown",function(a){(a.keyCode===i.KEY.ENTER||a.keyCode===i.KEY.SPACE)&&c()},!1);return d},_renderAuthenticatedService:function(b){var c=this,d=this.authenticatedServices[b].authService;
if(d&&d.logout&&this._displaySignOut){var e=document.createElement("li"),a=this._makeMenuItem(g["Sign Out"],function(){d.logout().then(function(){c.addUserItem(b,d,c.authenticatedServices[b].label);localStorage.removeItem(b);localStorage.removeItem("lastLogin");for(var a=localStorage.length-1;a>=0;a--){var e=localStorage.key(a);e&&e.indexOf("/orion/preferences/user")===0&&localStorage.removeItem(e)}d.getAuthForm(window.location.href).then(function(a){window.location=a})})});e.appendChild(a);this._dropdownNode.appendChild(e)}},
renderServices:function(){function b(a){d[a]||(d[a]=c.createDocumentFragment());return d[a]}var c=document,d=[],e=this._serviceRegistry;f.getPageLinksInfo(e,"orion.page.link.user").then(function(a){this._dropdown?this._dropdown.empty():this._dropdownNode&&i.empty(this._dropdownNode);a.forEach(function(a){var e=b(typeof a.category==="number"?a.category:1),d=c.createElement("li"),j=c.createElement("a");j.role="menuitem";typeof this._dropDownItemClass==="string"?this._dropDownItemClass!==""&&j.classList.add(this._dropDownItemClass):
j.classList.add("dropdownMenuItem");j.href=a.href;j.textContent=a.textContent;d.appendChild(j);e.appendChild(d);j.addEventListener("keydown",function(a){(a.keyCode===i.KEY.ENTER||a.keyCode===i.KEY.SPACE)&&j.click()},!1)}.bind(this));if(this.keyAssistFunction){var a=document.createElement("li"),j=this._makeMenuItem(g["Keyboard Shortcuts"],this.keyAssistFunction);typeof this._keyAssistClass==="string"?this._keyAssistClass!==""&&j.classList.add(this._keyAssistClass):j.classList.add("key-assist-menuitem");
a.appendChild(j);b(0).appendChild(a)}if(a=e.getServiceReferences("orion.page.getstarted")[0])j=a.getProperty("data"),a=document.createElement("li"),j=this._makeMenuItem("Getting Started",this.getStartedDialog.bind(this,j)),a.appendChild(j),b(0).appendChild(a);var f=this;d.sort(function(a,b){return a-b}).forEach(function(a,b){if(b<d.length-1&&!this._noSeparator){var c=document.createElement("li");c.classList.add("dropdownSeparator");var e=document.createElement("span");e.classList.add("dropdownSeparator");
c.appendChild(e);a.appendChild(c)}f._dropdownNode.appendChild(a)}.bind(this));if(this.isSingleService())for(var m in this.authenticatedServices)this.authenticatedServices.hasOwnProperty(m)&&this._renderAuthenticatedService(m,0)}.bind(this))},getStartedDialog:function(b){new c(null,!0,b)},setKeyAssist:function(b){this.keyAssistFunction=b;this.renderServices()},addUserItem:function(b,c,d,e){e?(this.unauthenticatedServices[b]&&delete this.unauthenticatedServices[b],this.authenticatedServices[b]={authService:c,
label:d,data:e}):(this.authenticatedServices[b]&&delete this.authenticatedServices[b],this.unauthenticatedServices[b]=this.unauthenticatedServices[b]?{authService:c,label:d,pending:this.unauthenticatedServices[b].pending}:{authService:c,label:d});this.renderServices()}};d.prototype.constructor=d;return{UserMenu:d}});
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(g,l){var i={root:l};Object.keys(g).forEach(function(f){typeof i[f]==="undefined"&&(i[f]=g[f])});return i});
define("orion/searchUtils","i18n!orion/nls/messages,require,orion/regex,orion/commandRegistry,orion/PageUtil,orion/URITemplate".split(","),function(g,l,i,f,c,d){function b(b,c,a){var d="";a&&(d="^");if(d=i.parse("/"+d+b.searchStr+"/"))a=d.pattern,d=d.flags,d.indexOf("i")===-1&&!c.caseSensitive&&(d+="i"),b.regExp={pattern:a,flags:d},b.wildCard=!0}var h={ALL_FILE_TYPE:"*.*"};h.doSearch=function(b,c,a,d){if(b){var f=!0;a==="*"&&(a="");a===""&&(f=d&&d.type!==h.ALL_FILE_TYPE);if(f){a!==""&&h.addRecentSearch(c,
a,d?d.regEx:!1);var b=b.createSearchParams(a,!1,!1,d),m=h.generateSearchHref(b);h.getOpenSearchPref(c,function(a){a?window.open(m):window.location=m})}}else window.alert(g["Can't search: no search service is available"])};h.generateSearchHelper=function(c,e){var a=c.keyword,d=a,f={};c.fileType&&c.fileType!==h.ALL_FILE_TYPE&&a===""&&(d="*."+c.fileType);if(c.regEx)f.searchStr=a,b(f,c,e);else{var g=a.indexOf("*")>-1,n=a.indexOf("?")>-1;g&&(a=a.split("*").join(".*"));n&&(a=a.split("?").join("."));!g&&
!n&&!c.nameSearch?(f.searchStr=c.caseSensitive?a.split("\\").join(""):a.split("\\").join("").toLowerCase(),f.wildCard=!1):(f.searchStr=c.caseSensitive?a:a.toLowerCase(),b(f,c,e),f.wildCard=!0)}f.searchStrLength=f.searchStr.length;return{params:c,inFileQuery:f,displayedSearchTerm:d}};h.convertSearchParams=function(b){if(b.rows!==void 0)b.rows=parseInt(b.rows,10);if(b.start!==void 0)b.start=parseInt(b.start,10);if(typeof b.regEx==="string")b.regEx=b.regEx.toLowerCase()==="true";if(typeof b.caseSensitive===
"string")b.caseSensitive=b.caseSensitive.toLowerCase()==="true";if(typeof b.nameSearch==="string")b.nameSearch=b.nameSearch.toLowerCase()==="true"};h.copySearchParams=function(b,c){var a={},d;for(d in b)if(b[d]!==void 0&&b[d]!==null&&(c||d!=="replace"))a[d]=b[d];return a};h.generateSearchHref=function(b){var c=l.toUrl("search/search.html"),b=h.copySearchParams(b,!0),a=b.resource;b.resource=void 0;return typeof b.keyword!=="undefined"?(new d(c+"#{,resource,params*}")).expand({resource:a,params:b}):
(new d(c+"#{,resource}")).expand({resource:a})};h.generateFindURLBinding=function(b,c,a,j,f){b={find:c.searchStr,regEx:c.wildCard?!0:void 0,caseSensitive:b.caseSensitive?!0:void 0,replaceWith:typeof j==="string"?j:void 0,atLine:typeof a==="number"?a:void 0};return f?b:","+(new d("{,params*}")).expand({params:b})};h.convertFindURLBinding=function(b){if(typeof b.regEx==="string")b.regEx=b.regEx.toLowerCase()==="true";if(typeof b.caseSensitive==="string")b.caseSensitive=b.caseSensitive.toLowerCase()===
"true";if(typeof b.atLine==="string")b.atLine=parseInt(b.atLine,10)};h.replaceRegEx=function(b,c,a){return b.replace(RegExp(c.pattern,c.flags),a)};h.replaceStringLiteral=function(b,c,a){c=i.parse("/"+c+"/gim");return h.replaceRegEx(b,c,a)};h.searchOnelineLiteral=function(b,c,a){var d;d=0;for(var f=!1,h=[];;)if(d=c.indexOf(b.searchStr,d),d<0)break;else{h.push({startIndex:d,length:b.searchStrLength});f=!0;if(a)break;d+=b.searchStrLength}return f?h:null};h.findRegExp=function(b,c,a,d){if(!c)return null;
a=a||"";a+=(a.indexOf("g")===-1?"g":"")+(a.indexOf("m")===-1?"m":"");var f=null;return(f=RegExp(c,a).exec(b.substring(d)))&&{startIndex:f.index+d,length:f[0].length}};h.searchOnelineRegEx=function(b,c,a){for(var d=0,f=!1,g=[];;)if(d=h.findRegExp(c,b.regExp.pattern,b.regExp.flags,d)){g.push(d);f=!0;if(a)break;d=d.startIndex+d.length}else break;return f?g:null};h.generateNewContents=function(b,c,a,d,f,g){if(d&&c){if(!b)a.contents=[];for(var n=0;n<c.length;n++){for(var i=c[n],q=!1,l=!1,v=[],x,u=0,o=
0;o<d.children.length;o++)if(d.children[o].lineNumber-1===n){u=o;for(q=0;q<d.children[o].matches.length;q++)d.children[o+q].checked!==!1&&v.push(q);l=v.length>0;x=d.children[o].matches;q=!0;break}if(q){if(l){v=h.replaceCheckedMatches(i,f,x,v,g);i=v.replacedStr;for(q=0;q<d.children[u].matches.length;q++)d.children[u+q].newMatches=v.newMatches}else for(q=0;q<d.children[u].matches.length;q++)d.children[u+q].newMatches=d.children[u+q].matches;b?a.contents[n]=i:a.contents.push(i)}else b||a.contents.push(i)}}};
h.generateMatchContext=function(b,c,a){var d=[],f=b*2+1,h;c.length<=f?(h=0,b=c.length-1):(h=a-b,h<0?(h=0,b=h+f-1):(b=a+b,b>c.length-1&&(b=c.length-1,h=b-f+1)));for(f=h;f<=b;f++)d.push({context:c[f],current:f===a});return d};h.splitFile=function(b){for(var c=0,a=0,d=0,f=0,h=[];;){c!==-1&&c<=d&&(c=b.indexOf("\r",d));a!==-1&&a<=d&&(a=b.indexOf("\n",d));if(a===-1&&c===-1){h.push(b.substring(f));break}var g=1;c!==-1&&a!==-1?c+1===a?(g=2,d=a+1):d=(c<a?c:a)+1:d=c!==-1?c+1:a+1;h.push(b.substring(f,d-g));
f=d}return h};h.searchWithinFile=function(b,c,a,d,f,g){a=h.splitFile(a);if(f)c.contents=a;if(c){c.children=[];for(var n=d=0;n<a.length;n++){var i=a[n];if(i&&i.length>0){var q=g?i:i.toLowerCase();if(q=b.wildCard?h.searchOnelineRegEx(b,q):h.searchOnelineLiteral(b,q)){var l,v=n+1;if(f)for(var x=0;x<q.length;x++)l=x+1,l={parent:c,checked:c.checked,type:"detail",matches:q,lineNumber:v,matchNumber:l,name:i,location:c.location+"-"+v+"-"+l},c.children.push(l);else l={parent:c,context:h.generateMatchContext(2,
a,n),checked:c.checked,type:"detail",matches:q,lineNumber:v,name:i,location:c.location+"-"+v},c.children.push(l);d+=q.length}}}c.totalMatches=d}};h.replaceCheckedMatches=function(b,c,a,d,f){for(var h=0,g="",i=[],q=0;q<a.length;q++){h!==a[q].startIndex&&(g+=b.substring(h,a[q].startIndex));if(a[q].length)f=a[q].length;for(var h=!1,l=0;l<d.length;l++)if(d[l]===q){h=!0;break}h?(i.push({startIndex:g.length,length:c.length}),g+=c):(i.push({startIndex:g.length,length:f}),g+=b.substring(a[q].startIndex,a[q].startIndex+
f));h=a[q].startIndex+f}h<b.length&&(g+=b.substring(h));return{replacedStr:g,newMatches:i}};h.fullPathNameByMeta=function(b){var c=b.length,a="";if(c>0)for(c-=1;c>-1;c--)a=a+(a===""?"":"/")+b[c].Name;return a};h.path2FolderName=function(b,c,a){return b.substring(0,b.length-c.length-(a?0:1))};h._storeRecentSearch=function(b,c,a){b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){b.put("recentSearch",c);a&&window.setTimeout(function(){a.dispatchEvent({type:"recentSearchesChanged"})}.bind(this),
20)})};h.addRecentSearch=function(b,c,a){typeof c==="string"&&c&&b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(d){var f,d=d.get("recentSearch");typeof d==="string"&&(d=JSON.parse(d));if(d){for(f in d)if(d[f].name===c)return;d.length>=20&&d.splice(19,d.length-20+1)}else d=[];d.splice(0,0,{name:c,regEx:a});h._storeRecentSearch(b,d)})};h.removeRecentSearch=function(b,c,a){typeof c==="string"&&c&&b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(d){var f,
d=d.get("recentSearch");typeof d==="string"&&(d=JSON.parse(d));if(d)for(f in d)if(d[f].name===c){d.splice(f,1);h._storeRecentSearch(b,d,a);break}})};h.getSearches=function(b,c,a){b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){b=b.get(c);typeof b==="string"&&(b=JSON.parse(b));b&&a&&a(b)})};h.getMixedSearches=function(b,c,a,d){b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){var f=b.get("recentSearch");typeof f===
"string"&&(f=JSON.parse(f));c&&(b=b.get("search"),typeof b==="string"&&(b=JSON.parse(b)),b&&b.forEach(function(b){if(a){var c=h.parseQueryStr(b.query);f.some(function(a){return c.searchStrTitle===a.name})||f.push({name:c.searchStrTitle,label:b.name})}else f.push({name:null,label:b.name,value:b.query})}));f&&d&&d(f)})};h.getOpenSearchPref=function(b,c){b.getService("orion.core.preference").getPreferences("/cm/configurations").then(function(a){a=a.get("nav.config");c(a&&a["links.newtab"]!=="undefined"?
a["links.newtab"]?!0:!1:!1)})};h.setOpenSearchPref=function(b,c){b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){a.put("openSearchPref",{openInNewTab:c})})};return h});
define("orion/crawler/searchCrawler","i18n!orion/crawler/nls/messages,require,orion/i18nUtil,orion/searchUtils,orion/contentTypes,orion/Deferred".split(","),function(g,l,i,f,c,d){function b(b,c,e,a){this.registry=b;this.fileClient=c;this.fileLocations=[];this.fileSkeleton=[];this._totalCounter=this._hitCounter=0;this._searchOnName=a&&a.searchOnName;this._buildSkeletonOnly=a&&a.buildSkeletonOnly;this._fetchChildrenCallBack=a&&a.fetchChildrenCallBack;this._searchParams=e;this.searchHelper=this._searchOnName||
this._buildSkeletonOnly?null:f.generateSearchHelper(e);this._location=a&&a.location;this._childrenLocation=a&&a.childrenLocation?a.childrenLocation:this._location;this._cancelled=!1;this.registry.getService("orion.page.message").setCancelFunction(function(){this._cancelFileContentsSearch()}.bind(this))}b.prototype.search=function(b){var c=this.registry.getService("orion.core.contentTypeRegistry");this._onSearchComplete=b;this._cancelled=!1;this._deferredArray=[];c.getContentTypes().then(function(b){this.contentTypesCache=
b;this._visitRecursively(this._childrenLocation).then(function(){this._sort(this.fileLocations);this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}})}.bind(this))}.bind(this))};b.prototype.searchName=function(b,c){if(b)this.searchHelper=f.generateSearchHelper(b,!0);if(c)this.onSearchNameComplete=c;var e=[];this._cancelled=!1;this._deferredArray=[];this._sort(this.fileSkeleton);if(this.fileSkeleton.length>0){for(var a=0;a<this.fileSkeleton.length;a++){var d=
this.fileSkeleton[a].Name.toLowerCase();if(this.searchHelper.inFileQuery.wildCard?f.searchOnelineRegEx(this.searchHelper.inFileQuery,d,!0):f.searchOnelineLiteral(this.searchHelper.inFileQuery,d,!0))if(e.push(this.fileSkeleton[a]),e.length>=this.searchHelper.params.rows)break}this.onSearchNameComplete({response:{numFound:e.length,docs:e}})}};b.prototype.buildSkeleton=function(b,c){this._buildingSkeleton=!0;var e=this.registry.getService("orion.core.contentTypeRegistry");this._cancelled=!1;this._deferredArray=
[];var a=this;b();e.getContentTypes().then(function(b){a.contentTypesCache=b;a._visitRecursively(a._childrenLocation).then(function(){a._buildingSkeleton=!1;c();a.searchHelper&&!a._buildSkeletonOnly&&a.searchName()})})};b.prototype._searchCompleted=function(){console.log("Search Completed.")};b.prototype._searchFiles=function(){var b=[];if(this.fileLocations.length>0)for(var c=0;c<this.fileLocations.length;c++)b.push(this._sniffSearch(this.fileLocations[c]));return d.all(b)};b.prototype._sort=function(b){b.sort(function(b,
c){var a=b.Name&&b.Name.toLowerCase(),d=c.Name&&c.Name.toLowerCase();return a<d?-1:a>d?1:0})};b.prototype._onFileType=function(b){return this.searchHelper.params.fileType?this.searchHelper.params.fileType===f.ALL_FILE_TYPE?!0:b.extension.indexOf(this.searchHelper.params.fileType)>=0:!0};b.prototype._visitRecursively=function(b){var f=[],e=this;this._fetchChildrenCallBack&&this._fetchChildrenCallBack(b);var a=e.registry.getService("orion.page.progress");return(a?a.progress(e.fileClient.fetchChildren(b),
"Crawling search for children of "+b):e.fileClient.fetchChildren(b)).then(function(a){for(var b=0;b<a.length;b++)if(a[b].Directory!==void 0&&a[b].Directory===!1)if(e._searchOnName)f.push(e._buildSingleSkeleton(a[b]));else if(e._buildSkeletonOnly)f.push(e._buildSingleSkeleton(a[b]));else{if(!e._cancelled){var h=c.getFilenameContentType(a[b].Name,e.contentTypesCache);if(h&&(h["extends"]==="text/plain"||h.id==="text/plain")&&e._onFileType(h))h=e._sniffSearch(a[b]),f.push(h),e._deferredArray.push(h)}}else if(a[b].Location)if(e._cancelled)break;
else h=e._visitRecursively(a[b].ChildrenLocation),f.push(h),e._deferredArray.push(h);return d.all(f)})};b.prototype._hitOnceWithinFile=function(b){b=this._searchParams.caseSensitive?b:b.toLowerCase();return this.searchHelper.inFileQuery.wildCard?f.searchOnelineRegEx(this.searchHelper.inFileQuery,b,!0):f.searchOnelineLiteral(this.searchHelper.inFileQuery,b,!0)};b.prototype._reportSingleHit=function(b){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)};b.prototype._cancelFileContentsSearch=function(){(this._cancelled=!0)&&this._deferredArray.forEach(function(b){b.cancel()});this._sort(this.fileLocations);this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}});console.log("Crawling search cancelled. Deferred array length : "+this._deferredArray.length);this.registry.getService("orion.page.message").setProgressResult({Message:g["Search cancelled by user"],
Severity:"Warning"})};b.prototype._sniffSearch=function(b){this._totalCounter++;var c=this;if(!this._cancelled)if(this.searchHelper.params.keyword==="")this._reportSingleHit(b),this.registry.getService("orion.page.message").setProgressResult({Message:i.formatMessage(g["${0} files found out of ${1}"],this._hitCounter,this._totalCounter)});else return this.registry.getService("orion.page.progress").progress(c.fileClient.read(b.Location),"Reading file "+b.Location).then(function(e){c._hitOnceWithinFile(e)&&
c._reportSingleHit(b);c.registry.getService("orion.page.message").setProgressResult({Message:i.formatMessage(g["${0} files found out of ${1}"],c._hitCounter,c._totalCounter)},g.Cancel)},function(b){b&&b.message&&b.message.toLowerCase()!=="cancel"&&console.error("Error loading file content: "+b.message)})};b.prototype._buildSingleSkeleton=function(b){this._totalCounter++;this.fileSkeleton.push(b);this.searchHelper&&!this._buildSkeletonOnly&&this._totalCounter%100===0&&this.searchName();b=new d;b.resolve(this._totalCounter);
return b};b.prototype.constructor=b;return{SearchCrawler:b}});
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(g,l,i,f,c,d,b){function h(b){this._init(b)}h.prototype=new b.Dialog;h.prototype.TEMPLATE='<div role="search"><div><label id="fileNameMessage" for="fileName">${Type the name of a file to open (? = any character, * = any string):}</label></div><div><input id="fileName" type="text" class="setting-control" style="width:90%;"/></div><div id="progress" style="padding: 2px 0 0; width: 100%;"><img src="'+f.toUrl("../../../images/progress_running.gif")+
'" class="progressPane_running_dialog" id="crawlingProgress"></img></div><div id="results" style="max-height:400px; height:auto; overflow-y:auto;" aria-live="off"></div><div id="statusbar"></div></div>';h.prototype._init=function(b){this.title=b.title||g["Find File Named"];this.modal=!0;this.messages=g;this._searcher=b.searcher;this._progress=b.progress;this._onHide=b.onHide;this._contentTypeService=new i.ContentTypeRegistry(this._searcher.registry);if(!this._searcher)throw Error("Missing required argument: searcher");
this._searchDelay=b.searchDelay||500;this._time=0;this._searcher.setCrawler(null);this._forceUseCrawler=!1;this._initialText=b.initialText;this._message=b.message;this._nameSearch=!0;if(b.nameSearch!==void 0)this._nameSearch=b.nameSearch;this._searchOnRoot=!0;this._fileService=this._searcher.getFileService();if(!this._fileService)throw Error(g["Missing required argument: fileService"]);this._searchRenderer=b.searchRenderer;if(!this._searchRenderer||typeof this._searchRenderer.makeRenderFunction!==
"function")throw Error(g["Missing required argument: searchRenderer"]);this._initialize()};h.prototype._bindToDom=function(b){var e=this;e.$crawlingProgress.style.display="none";this.$fileName.setAttribute("placeholder",g.Search);this.$fileName.addEventListener("input",function(){e._time=+new Date;e._timeoutId&&clearTimeout(e._timeoutId);e._timeoutId=setTimeout(e.checkSearch.bind(e),0)},!1);this.$fileName.addEventListener("keydown",function(a){if(a.keyCode===c.KEY.ENTER){var b=c.$("a",e.$results);
b&&(c.stop(a),window.open(b.href),e.hide())}},!1);b.addEventListener("keydown",function(a){var b,d,f;if(a.keyCode===c.KEY.DOWN||a.keyCode===c.KEY.UP)b=c.$$array("a",e.$results),d=document.activeElement,f=b.indexOf(d),a.keyCode===c.KEY.DOWN?f>=0?(d.classList.remove("treeIterationCursor"),b=f<b.length-1?b[f+1]:b[0],b.focus(),b.classList.add("treeIterationCursor")):b.length>0&&(b=-1<b.length-1?b[0]:b[0],b.focus(),b.classList.add("treeIterationCursor")):f>=0?(d.classList.remove("treeIterationCursor"),
d=e.$fileName,b=f>0?b[f-1]:d,b.focus(),f>0&&b.classList.add("treeIterationCursor")):b.length>0&&(b[b.length-1].focus(),b[b.length-1].classList.add("treeIterationCursor")),c.stop(a)});b.addEventListener("mouseup",function(a){a.target.focus()},!1);setTimeout(function(){if(e._forceUseCrawler||!e._fileService.getService(e._searcher.getSearchLocation()).search){var a=e._searchOnRoot?e._searcher.getSearchRootLocation():e._searcher.getChildrenLocation(),a=new l.SearchCrawler(e._searcher.registry,e._fileService,
"",{searchOnName:!0,location:a});e._searcher.setCrawler(a);a.buildSkeleton(function(){e.$crawlingProgress.style.display="inline";e.$progress.appendChild(document.createTextNode(g["Building file skeleton..."]))},function(){e.$crawlingProgress.style.display="none";e.$progress.removeChild(e.$progress.lastChild)})}},0);this._message&&(this.$fileNameMessage.removeChild(this.$fileNameMessage.firstChild),this.$fileNameMessage.appendChild(document.createTextNode(this._message)));if(this._initialText)this.$fileName.value=
this._initialText,this.doSearch()};h.prototype.checkSearch=function(){clearTimeout(this._timeoutId);var b=(new Date).getTime();b-this._time>this._searchDelay?(this._time=b,this.doSearch()):this._timeoutId=setTimeout(this.checkSearch.bind(this),50)};h.prototype.doSearch=function(){var b=this.$fileName.value;if(b){var e=this._searcher.createSearchParams(b,this._nameSearch,this._searchOnRoot),a=this._searchRenderer.makeRenderFunction(this._contentTypeService,this.$results,!1,this.decorateResult.bind(this));
this.currentSearch=a;var j=document.createElement("div");j.appendChild(document.createTextNode(this._nameSearch?g["Searching..."]:d.formatMessage(g["Searching for occurrences of"],b)));c.empty(this.$results);this.$results.appendChild(j);this._searcher.search(e,!1,function(){a===this.currentSearch&&a.apply(null,arguments)}.bind(this))}};h.prototype.decorateResult=function(b){for(var e=this,b=c.$$array("a",b),a=0;a<b.length;a++){var d=b[a];d.addEventListener("mouseup",function(a){a.button===0&&!a.ctrlKey&&
!a.metaKey&&e.hide()},!1);d.addEventListener("keyup",function(a){a.keyCode===c.KEY.ENTER&&e.hide()},!1)}};h.prototype._beforeHiding=function(){clearTimeout(this._timeoutId)};h.prototype._afterHiding=function(){this._onHide&&this._onHide()};h.prototype.constructor=h;return{OpenResourceDialog:h}});define("text!orion/banner/banner.html",[],function(){return'<header id="banner" role="banner">\n\t<\!-- Requires some js code to bind the home link, link to progress image, and binding NLS variables  --\>\n\t<\!-- Top row:  Logo + discovery links + search + user --\>\n\t<div id="staticBanner" class="layoutBlock topRowBanner"> <\!-- primaryNav --\>\n\t\t<a id="home" class="layoutLeft "></a>\n\t\t<nav id="primaryNav" class="bannerLeftArea" role="navigation">\n\t\t\t<button class="centralNavigation commandSprite core-sprite-hamburger" type="button"id="centralNavigation"></button>\n\t\t</nav>\n\t\t<div class="clear navigationBreadcrumb bannerMiddleArea" >\n\t\t\t<div id="location" class="currentLocation"></div>\n\t\t</div>\n\t\t<div class="bannerRightArea">\n\t\t\t<div id="globalActions" class="spacingLeft layoutLeft"></div>\n\t\t\t<input type="text" id="search" autocomplete="off" class="layoutLeft spacingLeft searchbox" role="search" style="display:none;">\n\t\t\t<div id="searchOptions" class="layoutLeft" style="padding-top:1px;display:none;"></div>\n\t\t\t<div id="userMenu" class="spacingRight layoutRight" style="color:#ccc;">\n\t\t\t\t<img class="progressPane" id="progressPane" tabindex="0" role="progressbar"></img>\n\t\t\t\t<span id="userTrigger" tabindex="0" role="button" class="dropdownTrigger">\n\t\t\t\t\t<span class="dropdownArrowEmpty"></span>\n\t\t\t\t</span>\n\t\t\t\t<ul id="userDropdown" class="dropdownMenu" role="menu"></ul>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t<div id="notificationArea" class="notificationHide">\n\t\t<div class="layoutLeft" id="notifications" aria-live="assertive" aria-atomic="true"></div>\n\t\t<div class="layoutRight"><button aria-label="Close" class="dismissButton layoutRight core-sprite-close imageSprite" type="button" id="closeNotifications"></span></div>\n\t</div>\n</header>'});
define("text!orion/banner/footer.html",[],function(){return'<footer id="footerContent" class="layoutBlock footerLayout" role="contentinfo">\n\t<\!-- Requires some js code to bind the NLS variables  --\>\n\t<div class="logoFooter commandSprite core-sprite-orion-logo"></div>\n\t<div class="footerBlock">${Orion is in Beta. Please try it out but BEWARE your data may be lost.}</div>\n\t<div class="footerRightBlock">\n\t\t<ul>\n\t\t\t<\!-- <li><a href="http://wiki.eclipse.org/Orion/FAQ" target="_blank">${FAQ}</a></li --\>\n\t\t\t<li><a href="https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Orion&version=4.0" target="_blank">${Report a Bug}</a>\n\t\t\t<li><a href="http://www.eclipse.org/legal/privacy.php" target="_blank">${Privacy Policy}</a></li>\n\t\t\t<li><a href="http://www.eclipse.org/legal/termsofuse.php" target="_blank">${Terms of Use}</a></li>\n\t\t\t<li><a href="http://www.eclipse.org/legal/copyright.php" target="_blank">${Copyright Agent}</a></li>\n\t\t</ul>\n\t</div>\n</footer>'});
define("text!orion/banner/toolbar.html",[],function(){return'<ul class="layoutLeft commandList pageActions" id="pageActions"></ul>\n<ul class="layoutLeft commandList pageActions" id="selectionTools"></ul>\n<ul class="layoutLeft commandList pageActions" id="navActions"></ul>\n<div class="layoutLeft" style="padding-left:7px;padding-right:7px;margin-top:2px;" id="filterBox" style="visibility: hidden;"></div>\n<div class="layoutRight commandList pageActions" id="settingsActions"></div>\n<div class="layoutRight status" id="statusPane" role="status" aria-live="off"></div>\n<ul class="layoutRight commandList pageActions" id="pageNavigationActions"></ul>'});
define("orion/widgets/input/DropDownMenu",["orion/objects","orion/webui/littlelib"],function(g,l){function i(f,c,d){if(f=l.node(f))this._parent=f;else throw Error("Parent node of dropdown menu not found");this.options=d=d||{};this.navDropDownId=this._parent.id+"_navdropdown";this.selectionClass=d.selectionClass;f=document.createElement("div");f.classList.add("dropDownContainer");f.id=this.navDropDownId;f.style.display="none";this._parent.appendChild(f);this._dropdownMenu=f;if(c=l.node(c))this._triggerNode=
c;else throw"Trigger node of dropdown menu not found";if(this._triggerNode.style.visibility==="hidden")this._triggerNode.style.visibility="visible";if(!d.noClick)this._triggerNode.onclick=this.click.bind(this);this._dropdownMenu.addEventListener("keydown",function(b){b.keyCode===l.KEY.ESCAPE&&this.clearPanel()}.bind(this))}g.mixin(i.prototype,{click:function(){this._dropdownMenu.style.display==="none"?this.updateContent(this.getContentNode(),function(){this._dropdownMenu.style.display="";this._positionDropdown();
this.selectionClass&&this._triggerNode.classList.add(this.selectionClass);this.handle=l.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",this.selectionClass&&this._triggerNode.classList.remove(this.selectionClass),this.options.onHide))this.options.onHide()},addContent:function(f){this._dropdownMenu.innerHTML=
f},getContentNode:function(){return this._dropdownMenu},updateContent:function(f,c){c()},_positionDropdown:function(){this._dropdownMenu.style.left="";var f=l.bounds(this._dropdownMenu),c=l.bounds(this._boundingNode(this._parent));if(f.left+f.width>c.left+c.width)this._dropdownMenu.style.right=0},_boundingNode:function(f){return f.style.right!==""||f.style.position==="absolute"||!f.parentNode||!f.parentNode.style?f:this._boundingNode(f.parentNode)},isDestroyed:function(){return!this._dropdownMenu.parentNode},
isVisible:function(){return this._dropdownMenu.style.display!=="none"&&!this.isDestroyed()},focus:function(){this._dropdownMenu.focus()},destroy:function(){if(this._parent)l.empty(this._parent),this._parent=this.select=null}});return i});
define("orion/widgets/input/GroupedContent",["i18n!orion/widgets/nls/messages","orion/objects","orion/webui/littlelib"],function(g,l){function i(){}l.mixin(i.prototype,{templateString:'<div style="float:left;"><section><span style="color:#333;padding:15px;">'+g["Main Pages"]+'</span><nav><ul id="navigationlinks"></ul></nav></section></div><div class="groupedContentDivider"></div><div style="float:left;"><section><span style="color:#333;padding:15px;">'+g["Related Links"]+'</span><nav><ul id="relatedLinks"></ul></nav></section></div>',
getContentPane:function(){return this.templateString}});return i});define("orion/customGlobalCommands",[],function(){return{}});
define("orion/fileClient",["i18n!orion/navigate/nls/messages","orion/Deferred","orion/i18nUtil"],function(g,l,i){function f(b,c,d){if(!b[c])throw c+g[" is not supported in this file system"];return b[c].apply(b,d)}function c(b,d,k,e){if(!b.readBlob)throw g["source file service does not support binary read"];if(!k.writeBlob)throw g["target file service does not support binary write"];if(d[d.length-1]!=="/")return f(b,"readBlob",[d]).then(function(a){return f(k,"writeBlob",[e,a])});var a=e.substring(0,
e.length-1),j=decodeURIComponent(a.substring(a.lastIndexOf("/")+1)),a=a.substring(0,a.lastIndexOf("/")+1);return f(k,"createFolder",[a,j]).then(function(){},function(){}).then(function(){return f(b,"fetchChildren",[d]).then(function(a){for(var d=[],f=0;f<a.length;++f){var j=a[f].Location,h=j;a[f].Directory&&(h=j.substring(0,j.length-1));h=decodeURIComponent(h.substring(h.lastIndexOf("/")+1));h=e+encodeURIComponent(h);a[f].Directory&&(h+="/");d[f]=c(b,j,k,h)}return l.all(d)})})}function d(b,c){function d(a){var b=
new l;b.reject(g["No Matching FileService for location:"]+a);return b}var e=b.getServiceReferences("orion.core.file"),a=e;if(c)for(var a=[],f=0;f<e.length;++f)c(e[f])&&a.push(e[f]);for(var p=[],m=[],n=[],s=[],q={fetchChildren:function(){var a=new l;a.resolve(s);return a},createWorkspace:function(){var a=new l;a.reject(g["no file service"]);return a},loadWorkspaces:function(){var a=new l;a.reject(g["no file service"]);return a},loadWorkspace:function(){var a=new l;window.setTimeout(function(){a.resolve({Directory:!0,
Length:0,LocalTimeStamp:0,Name:g["File Servers"],Location:"/",Children:s,ChildrenLocation:"/"})},100);return a},search:d,createProject:d,createFolder:d,createFile:d,deleteFile:d,moveFile:d,copyFile:d,read:d,write:d},e=0;e<a.length;++e)s[e]={Directory:!0,Length:0,LocalTimeStamp:0,Location:a[e].getProperty("top"),ChildrenLocation:a[e].getProperty("top"),Name:a[e].getProperty("Name")},f=a[e].getProperty("pattern")||".*",f[0]!=="^"&&(f="^"+f),p[e]=RegExp(f),m[e]=b.getService(a[e]),n[e]=a[e].getProperty("Name"),
a[e].getProperty("NameKey")&&a[e].getProperty("nls")&&i.getMessageBundle(a[e].getProperty("nls")).then(function(b,c){s[b].Name=c[a[b].getProperty("NameKey")];n[b]=c[a[b].getProperty("NameKey")]}.bind(this,e));this._getServiceIndex=function(a){if(a==="/")return-1;else if(!a||a.length&&a.length===0)return m[0]?0:-1;for(var b=0;b<p.length;++b)if(p[b].test(a))return b;throw g["No Matching FileService for location:"]+a;};this._getService=function(a){a=this._getServiceIndex(a);return a===-1?q:m[a]};this._getServiceName=
function(a){a=this._getServiceIndex(a);return a===-1?q.Name:n[a]};this._getServiceRootURL=function(a){a=this._getServiceIndex(a);return a===-1?q.Location:s[a].Location}}d.prototype={getService:function(b){return this._getService(b)},fileServiceName:function(b){return this._getServiceName(b)},fileServiceRootURL:function(b){return this._getServiceRootURL(b)},fetchChildren:function(b){return f(this._getService(b),"fetchChildren",arguments)},createWorkspace:function(b){return f(this._getService(),"createWorkspace",
arguments)},loadWorkspaces:function(){return f(this._getService(),"loadWorkspaces",arguments)},loadWorkspace:function(b){return f(this._getService(b),"loadWorkspace",arguments)},createProject:function(b,c,d,e){return f(this._getService(b),"createProject",arguments)},createFolder:function(b,c){return f(this._getService(b),"createFolder",arguments)},createFile:function(b,c){return f(this._getService(b),"createFile",arguments)},deleteFile:function(b){return f(this._getService(b),"deleteFile",arguments)},
moveFile:function(b,d,k){var e=this._getService(b),a=this._getService(d);if(e===a)return f(e,"moveFile",arguments);var j=b[b.length-1]==="/",g=d;g[g.length-1]!=="/"&&(g+="/");if(k)g+=encodeURIComponent(k);else{var m=b;j&&(m=m.substring(0,m.length-1));g+=m.substring(m.lastIndexOf("/")+1)}j&&g[g.length-1]!=="/"&&(g+="/");return c(e,b,a,g).then(function(){return f(e,"deleteFile",[b])})},copyFile:function(b,d,k){var e=this._getService(b),a=this._getService(d);if(e===a)return f(e,"copyFile",arguments);
var j=b[b.length-1]==="/",g=d;g[g.length-1]!=="/"&&(g+="/");if(k)g+=encodeURIComponent(k);else{var m=b;j&&(m=m.substring(0,m.length-1));g+=m.substring(m.lastIndexOf("/")+1)}j&&g[g.length-1]!=="/"&&(g+="/");return c(e,b,a,g)},read:function(b,c){return f(this._getService(b),"read",arguments)},write:function(b,c,d){return f(this._getService(b),"write",arguments)},remoteImport:function(b,c){return f(this._getService(b),"remoteImport",arguments)},remoteExport:function(b,c){return f(this._getService(b),
"remoteExport",arguments)},search:function(b){return f(this._getService(b.resource),"search",arguments)}};d.prototype.constructor=d;return{FileClient:d}});
define("orion/globalCommands","i18n!orion/nls/messages,require,orion/commonHTMLFragments,orion/keyBinding,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/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/widgets/input/GroupedContent,orion/util,orion/customGlobalCommands,orion/fileClient".split(","),function(g,
l,i,f,c,d,b,h,k,e,a,j,p,m,n,s,q,t,v,x,u,o,r,w,z,y,J,A,L,B,C,E){function K(a,b){if(a.getLabel)return a.getLabel();else{var c=new u;c.resolve(b.properties.name);return c}}function O(a){j.node("progressPane").setAttribute("aria-label",g["Operations - Press spacebar to show current operations"]);(a=a.getService("orion.page.progress"))&&a.init.bind(a)("progressPane")}function U(a,b){var c=a.getServiceReferences("orion.core.auth");I=[];for(var e=F.createMenuGenerator.apply(this,arguments),d=0;d<c.length;d++){var o=
c[d],f=a.getService(o);K(f,o).then(function(a){f.getKey().then(function(b){I.push(b);f.getUser().then(function(c){e.addUserItem(b,f,a,c)},function(c,d){e.addUserItem(b,f,a,d)});window.addEventListener("storage",function(){M[b]!==localStorage.getItem(b)&&(M[b]=localStorage.getItem(b),f.getUser().then(function(c){e.addUserItem(b,f,a,c)},function(){e.addUserItem(b,f,a)}))},!1)})})}}function N(a){return a}function D(a,b,c,e,o){function f(a){if(a)if(!a.visibleWhen||a.visibleWhen(b)){var c=new d.CommandInvocation(b,
b,null,a,e);return(new u).resolve([a,c])}else if(typeof o==="function")return w||(w=o()),u.when(w,function(c){if(c&&b===P&&(!a.visibleWhen||a.visibleWhen(c)))return c=new d.CommandInvocation(c,c,null,a,e),[a,c]});return(new u).resolve()}var j=arguments,r,w,k=a&&a.getServiceReferences("orion.page.link.related");k&&k.length!==0&&u.when(function(){if(r)return r;var b=a.getService("orion.core.contentTypeRegistry");b||(b=new s.ContentTypeRegistry(a),b=a.getService("orion.core.contentTypeRegistry"));return b.getContentTypes().then(function(a){return r=
a})}(),function(){if(F.beforeGenerateRelatedLinks.apply(this,j)){for(var b=[],o=0;o<k.length;o++){var w={},g,p=k[o].getPropertyKeys();for(g=0;g<p.length;g++)w[p[g]]=k[o].getProperty(p[g]);if(w.id&&(g=g=null,c.indexOf(w.id)<0))if((w.nls&&w.nameKey||w.name)&&w.uriTemplate)g=h._createCommandOptions(w,k[o],a,r,!0),b.push(g);else if(g=e.findCommand(w.id))b.push((new u).resolve(g));else{var n=a.getServiceReferences("orion.navigate.command");for(g=0;g<n.length;g++)if(n[g].getProperty("id")===w.id){for(var w=
{},p=n[g].getPropertyKeys(),m=0;m<p.length;m++)w[p[m]]=n[g].getProperty(p[m]);g=h._createCommandOptions(w,n[g],a,r,!0);b.push(g);break}}}u.all(b,N).then(function(a){a=a.map(function(a){return a instanceof d.Command?a:new d.Command(a)}).sort(function(a,b){return a.name.localeCompare(b.name)});return u.all(a.map(f),N).then(function(a){a.forEach(function(a){a&&F.addRelatedLinkCommand(a[0],a[1])});F.afterGenerateRelatedLinks.apply(this,j)})})}})}function G(a){var b=j.node("globalActions");b&&(a.destroy(b),
a.renderCommands(b.id,b,{},{},"tool"))}function R(a){var b=window.getComputedStyle(a,null);return b===null?a:b.getPropertyValue("position")==="absolute"||!a.parentNode||a===document.body?a:R(a.parentNode)}function H(a){var b={},c=null;typeof a==="string"&&(a=j.node(a));a||(a=j.node("pageActions"));for(var e=a;e&&e.classList;){if(e.classList.contains("toolComposite")){c=e;break}e=e.parentNode}if(a.classList.contains("commandMarker"))b.commandNode=a;if(c&&(b.slideContainer=j.$(".slideParameters",c),
b.parameterArea=j.$(".parameters",c),b.dismissArea=j.$(".parametersDismiss",c),b.notifications=j.$("#notificationArea",c),c.parentNode&&(b.toolbarTarget=j.$(".toolbarTarget",c.parentNode),b.toolbarTarget)))a=j.bounds(b.toolbarTarget),e=j.bounds(R(b.toolbarTarget.parentNode)),b.toolbarTargetY=a.top-e.top,b.toolbar=c;return b}function Q(a){if(a.toolbarTarget&&a.toolbarTargetY){var b=0,c;a.notifications&&a.notifications.classList.contains("slideContainerActive")&&(c=j.bounds(a.notifications),b+=c.height);
a.slideContainer&&a.slideContainer.classList.contains("slideContainerActive")&&(c=j.bounds(a.slideContainer),b+=c.height);b>0&&(b+=8);b?(a.toolbarTarget.style.top=a.toolbarTargetY+b+"px",a.toolbar.style.paddingBottom=b+"px"):a.toolbarTarget.style.top=a.toolbar.style.paddingBottom=""}}var c=function(a){var b=document.createElement("a");b.href=a;return b.href}(l.toUrl("auth/NotifyAuthentication.html")),M={},F={createMenuGenerator:C.createMenuGenerator||function(a,b){if(j.node("userMenu")){var c=j.node("userDropdown"),
e=new m.Dropdown({dropdown:c}),c=new o.UserMenu({dropdownNode:c,dropdown:e,serviceRegistry:a}),e=j.node("userTrigger");new n.Tooltip({node:e,text:g.Options,position:["below","left"]});var e=document.getElementById("userTrigger"),d=e.className;d+=" imageSprite core-sprite-silhouette";e.className=d;c.setKeyAssist(b);return c}},beforeGenerateRelatedLinks:C.beforeGenerateRelatedLinks||function(){var a=j.node("relatedLinks");j.empty(a);return!0},addRelatedLinkCommand:C.addRelatedLinkCommand||function(a,
b){var c=j.node("relatedLinks");d.createCommandMenuItem(c,a,b).classList.remove("dropdownMenuItem")},afterGenerateRelatedLinks:C.afterGenerateRelatedLinks||function(){},afterSetPageTarget:C.afterSetPageTarget||function(){},generateNavigationMenu:C.generateNavigationMenu||function(){var a=document.getElementById("centralNavigation");new n.Tooltip({node:a,text:"Navigation Menu",position:["right"]});var a=new A("primaryNav","centralNavigation"),b=new L;a.addContent(b.getContentPane())},afterGenerateBanner:C.afterGenerateBanner||
function(){}},I=[],P,V=[],S,T=null;return{generateBanner:function(a,c,e,o,h,n,m,q){function s(){this.create();this._filterString=""}function t(a){a.registerService("orion.cm.managedservice",{updated:function(a){for(var a=a&&a["links.newtab"]!=="undefined"?a["links.newtab"]?"_blank":"_self":"_self",b=j.$$array(".targetSelector"),c=0;c<b.length;c++)b[c].target=a}},{pid:"nav.config"})}(new v.ThemePreferences(o,new x.ThemeData)).apply();var A=j.node(a);if(!A)throw g["could not find banner parent, id was "]+
a;var C=document.createRange();C.selectNode(A);C=C.createContextualFragment(z);j.processTextNodes(C,g);A.firstChild?A.insertBefore(C,A.firstChild):A.appendChild(C);A=j.node("home");A.href=l.toUrl("edit/edit.html");A.setAttribute("aria-label",g["Orion Home"]);j.node("progressPane").src=l.toUrl("images/none.png");if(A=j.node("pageToolbar"))A.classList.add("toolbarLayout"),A.innerHTML=J+i.slideoutHTMLFragment("mainToolbar");(A=j.node("closeNotifications"))&&A.setAttribute("aria-label",g["Close notification"]);
if(B.isFirefox<=17&&(A=j.node("staticBanner")))A.style.width="100%",A.style.MozBoxSizing="border-box";if(A=j.node("footer"))A.innerHTML=y,j.processTextNodes(A,g);e.setParameterCollector(new b.CommandParameterCollector(H,Q));document.addEventListener("keydown",function(a){a.keyCode===j.KEY.ESCAPE&&(a=c.getService("orion.page.message"))&&a.setProgressMessage("")},!1);F.generateNavigationMenu.apply(this,arguments);var L=j.node("navigationlinks");L&&r.createPageLinks(c,"orion.page.link").then(function(a){a.forEach(function(a){var b=
document.createElement("li");b.appendChild(a);L.appendChild(b)})});if(A=j.$(".split")){var C=j.$(".sidePanelLayout"),u=j.$(".mainPanelLayout");if(C&&u)T={side:C,main:u},T.splitter=new p.Splitter({node:A,sidePanel:C,mainPanel:u,toggle:!0,closeByDefault:q}),A=new d.Command({name:g["Toggle side panel"],tooltip:g["Open or close the side panel"],id:"orion.toggleSidePane",callback:function(){T.splitter.toggleSidePanel()}}),e.addCommand(A),e.registerCommandContribution("pageActions","orion.toggleSidePane",
1,null,!0,new f.KeyBinding("o",!0)),m&&T.splitter.addResizeListener(function(a){m&&a===u&&m.resize()})}var E=!1,K=function(a,b,c){if(!E){var b=b.getService("orion.page.progress"),e=new w.OpenResourceDialog({searcher:a,progress:b,searchRenderer:a.defaultRenderer,onHide:function(){E=!1;c&&c.focus()}});window.setTimeout(function(){E=!0;e.show()},0)}},A=new d.Command({name:g["Find File Named..."],tooltip:g["Choose a file by name and open an editor on it"],id:"eclipse.openResource",callback:function(){K(h,
c,m)}});e.addCommand(A);e.registerCommandContribution("globalActions","eclipse.openResource",100,null,!0,new f.KeyBinding("f",!0,!0));A=new d.Command({name:g["Toggle banner and footer"],tooltip:g["Hide or show the page banner and footer"],id:"orion.toggleTrim",callback:function(){var a=j.node("banner"),b=j.node("footer"),c=j.$(".content-fixedHeight");a.style.visibility==="hidden"?(a.style.visibility="visible",b.style.visibility="visible",c.classList.remove("content-fixedHeight-maximized")):(a.style.visibility=
"hidden",b.style.visibility="hidden",c.classList.add("content-fixedHeight-maximized"));m&&m.resize();return!0}});e.addCommand(A);e.registerCommandContribution("globalActions","orion.toggleTrim",100,null,!0,new f.KeyBinding("m",!0,!0));A=new d.Command({name:g["System Configuration Details"],tooltip:g["System Config Tooltip"],id:"orion.configDetailsPage",hrefCallback:function(){return l.toUrl("help/about.html")}});e.addCommand(A);e.registerCommandContribution("globalActions","orion.configDetailsPage",
100,null,!0,new f.KeyBinding(112,!0,!0));A=new d.Command({name:g["Background Operations"],tooltip:g["Background Operations Tooltip"],id:"orion.backgroundOperations",hrefCallback:function(){return l.toUrl("operations/list.html")}});e.addCommand(A);e.registerCommandContribution("globalActions","orion.backgroundOperations",100,null,!0,new f.KeyBinding("o",!0,!0));s.prototype={create:function(){var a=this._keyAssistDiv=document.createElement("div");a.id="keyAssist";a.style.display="none";a.classList.add("keyAssistFloat");
a.setAttribute("role","menu");var b=this._keyAssistInput=document.createElement("input");b.classList.add("keyAssistInput");b.type="text";b.placeholder=g["Filter bindings"];a.appendChild(b);var c=this._keyAssistContents=document.createElement("div");c.classList.add("keyAssistContents");if(B.isIOS||B.isAndroid)c.style.overflowY="auto";a.appendChild(c);var e=this._keyAssistTable=document.createElement("table");e.tabIndex=0;e.classList.add("keyAssistList");c.appendChild(e);document.body.appendChild(a);
b.addEventListener("keydown",function(a){this._keyDown(a)}.bind(this));e.addEventListener("keydown",function(a){this._keyDown(a)}.bind(this));b.addEventListener("input",function(){this.filterChanged()}.bind(this));c.addEventListener(B.isFirefox?"DOMMouseScroll":"mousewheel",function(a){this._scrollWheel(a)}.bind(this));document.addEventListener("keydown",function(a){a.keyCode===j.KEY.ESCAPE&&this.hide()}.bind(this));j.addAutoDismiss([a],function(){this.hide()}.bind(this))},createContents:function(){j.empty(this._keyAssistTable);
this._selectedIndex=-1;this._selectedRow=null;this._idCount=this._keyAssistContents.scrollTop=0;if(m&&m.getTextView&&m.getTextView()){var a=m.getTextView(),b=a.getActions(!0).filter(function(b){return(b=a.getActionDescription(b))&&b.name});b.sort(function(b,c){return a.getActionDescription(b).name.localeCompare(a.getActionDescription(c).name)});this.createHeader(g.Editor);for(var c=function(b){return function(){a.focus();return a.invokeAction(b)}},d={},o,f=0;f<b.length;f++)for(var h=b[f],r=a.getActionDescription(h),
w=a.getKeyBindings(h),p=0;p<w.length;p++){o=w[p];var n=k.getUserKeyString(o);o.scopeName?(d[o.scopeName]||(d[o.scopeName]=[]),d[o.scopeName].push({bindingString:n,name:r.name,execute:c(h)})):this.createItem(n,r.name,c(h))}for(var i in d)if(d[i].length){this.createHeader(i);for(b=0;b<d[i].length;b++)o=d[i][b],this.createItem(o.bindingString,o.name,o.execute)}}this.createHeader(g.Global);e.showKeyBindings(this)},createItem:function(a,b,c){if(this._filterString){var e=this._filterString.toLowerCase(),
d;e!==this._filterString?(e=this._filterString,d=function(a){return a}):d=function(a){return a.toLowerCase()};if(d(b).indexOf(e)===-1&&d(a).indexOf(e)===-1&&d(this._lastHeader).indexOf(e)===-1)return}var o=this._keyAssistTable.insertRow(-1);o.id="keyAssist-keyBinding-"+this._idCount++;o.setAttribute("role","menuitem");o._execute=c;o.classList.add("keyAssistItem");o.addEventListener("click",function(a){this._selectedRow=o;this.execute();a.preventDefault()}.bind(this));c=o.insertCell(-1);c.classList.add("keyAssistName");
c.appendChild(document.createTextNode(b));c=o.insertCell(-1);c.classList.add("keyAssistAccel");c.appendChild(document.createTextNode(a))},createHeader:function(a){this._lastHeader=a;var b=this._keyAssistTable.insertRow(-1);b.classList.add("keyAssistSection");var b=b.insertCell(-1),c=document.createElement("h2");c.appendChild(document.createTextNode(a));b.appendChild(c)},execute:function(){window.setTimeout(function(){this.hide();var a=this._selectedRow;this._selectedRow=null;a&&a._execute&&a._execute()}.bind(this),
0)},filterChanged:function(){this._timeout&&window.clearTimeout(this._timeout);this._timeout=window.setTimeout(function(){this._timeout=null;var a=this._keyAssistInput.value;if(this._filterString!==a)this._filterString=a,this.createContents()}.bind(this),100)},hide:function(){if(this.isVisible()){var a=document.activeElement,b=this._keyAssistDiv,a=b===a||(b.compareDocumentPosition(a)&16)!==0;b.style.display="none";a&&document.compareDocumentPosition(this._previousActiveElement)!==1&&this._previousActiveElement.focus();
this._previousActiveElement=null}},isVisible:function(){return this._keyAssistDiv.style.display==="block"},select:function(a){var b=this._keyAssistTable.querySelectorAll(".keyAssistItem");if(b.length===0)this._selectedIndex=-1;else{var c=this._selectedIndex;c+=a?1:-1;c%=b.length;c<0&&(c=b.length-1);if(this._selectedIndex!==-1)a=b[this._selectedIndex],a.classList.remove("selected"),this._selectedRow=null;this._selectedIndex=c;if(this._selectedIndex!==-1){this._selectedRow=a=b[this._selectedIndex];
a.classList.add("selected");this._keyAssistTable.setAttribute("aria-activedescendant",a.id);this._keyAssistTable.focus();var b=a.getBoundingClientRect(),e=this._keyAssistContents,d=e.getBoundingClientRect();a.offsetTop<e.scrollTop?c===0?e.scrollTop=0:a.scrollIntoView(!0):b.bottom>d.bottom&&a.scrollIntoView(!1)}}},show:function(){if(!this.isVisible())this._previousActiveElement=document.activeElement,this.createContents(),this._keyAssistContents.style.height=Math.floor(this._keyAssistDiv.parentNode.clientHeight*
0.75)+"px",this._keyAssistDiv.style.display="block",this._keyAssistInput.value=this._filterString,this._keyAssistInput.focus(),this._keyAssistInput.select()},_keyDown:function(a){if(a.keyCode===40)this.select(!0);else if(a.keyCode===38)this.select(!1);else if(a.keyCode===13)this.execute();else return;a.preventDefault()},_scrollWheel:function(a){var b=0,b=B.isIE||B.isOpera?-a.wheelDelta:B.isFirefox?a.detail*40:-a.wheelDeltaY,c=this._keyAssistContents,e=c.scrollTop;c.scrollTop+=b;if(e!==c.scrollTop)return a.preventDefault&&
a.preventDefault(),!1}};var D=new s,N=new d.Command({name:g["Show Keys"],tooltip:g["Show a list of all the keybindings on this page"],id:"eclipse.keyAssist",callback:function(){D.isVisible()?D.hide():D.show();return!0}});e.addCommand(N);e.registerCommandContribution("globalActions","eclipse.keyAssist",100,null,!0,new f.KeyBinding(191,!1,!0));A=function(){m.getTextView().setKeyBinding(new f.KeyBinding(191,!1,!0,!B.isMac,B.isMac),N.id);m.getTextView().setAction(N.id,N.callback,N)};m&&m.getTextView&&
(m.getTextView()?A():m.addEventListener("TextViewInstalled",A));G(e);U(c,N.callback);O(c);window.addEventListener("hashchange",function(){e.processURL(window.location.href)},!1);window.setTimeout(function(){t(c)},0);F.afterGenerateBanner.apply(this,arguments)},getToolbarElements:H,getMainSplitter:function(){return T},layoutToolbarElements:Q,setPageTarget:function(b){var c,e,d=b.breadcrumbRootName,o=b.serviceRegistry;b.target?(b.searchService&&b.searchService.setLocationByMetaData(b.target),b.fileService&&
!b.breadcrumbTarget&&(e=d?d+" ":"",e+=b.fileService.fileServiceName(b.target.Location),d=null),c=b.name||b.target.Name,P=b.target,D(o,b.target,V,b.commandService,b.makeAlternate)):(b.breadcrumbTarget||(d=d||b.task||b.name),c=b.name,D(o,{NoTarget:""},V,b.commandService,b.makeAlternate));(S=b.title)||(S=c?c+" - "+b.task:b.task);window.document.title=S;F.afterSetPageTarget.apply(this,arguments);if(c=j.node("location")){j.empty(c);var f=o&&new E.FileClient(o),o=b.breadcrumbTarget||b.target,f=f&&o&&o.Location?
f.fileServiceRootURL(o.Location):null;new a.BreadCrumbs({container:c,resource:o,rootSegmentName:d,workspaceRootSegmentName:e,workspaceRootURL:f,makeHref:b.makeBreadcrumbLink})}},setDirtyIndicator:function(a){if(S)S.charAt(0)==="*"&&!a&&(S=S.substring(1)),a&&S.charAt(0)!=="*"&&(S="*"+S),window.document.title=S;var b=j.node("dirty");if(b)b.textContent=a?"*":""},setPageCommandExclusions:function(a){V=a},notifyAuthenticationSite:c}});
(function(){function g(a){this.tokens=[];this.tokens.links={};this.options=a||h.defaults;this.rules=k.normal;if(this.options.gfm)this.rules=this.options.tables?k.tables:k.gfm}function l(a,b){this.options=b||h.defaults;this.links=a;this.rules=e.normal;if(!this.links)throw Error("Tokens array requires a `links` property.");if(this.options.gfm)this.rules=this.options.breaks?e.breaks:e.gfm;else if(this.options.pedantic)this.rules=e.pedantic}function i(a){this.tokens=[];this.token=null;this.options=a||
h.defaults}function f(a,b){return a.replace(!b?/&(?!#?\w+;)/g:/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function c(a,b){a=a.source;b=b||"";return function m(c,e){if(!c)return RegExp(a,b);e=e.source||e;e=e.replace(/(^|[^\[])\^/g,"$1");a=a.replace(c,e);return m}}function d(){}function b(a){for(var b=1,c,e;b<arguments.length;b++)for(e in c=arguments[b],c)Object.prototype.hasOwnProperty.call(c,e)&&(a[e]=c[e]);return a}function h(a,c,e){if(e||
typeof c==="function"){e||(e=c,c=null);c&&(c=b({},h.defaults,c));var d=c.highlight,k,l,q=0;try{k=g.lex(a,c)}catch(t){return e(t)}l=k.length;var v=function(a){var b,f;a!==!0&&delete c.highlight;try{b=i.parse(k,c)}catch(h){f=h}c.highlight=d;return f?e(f):e(null,b)};if(!d||d.length<3)return v(!0);if(!l)return v();for(;q<k.length;q++)(function(a){return a.type!=="code"?--l||v():d(a.text,a.lang,function(b,c){if(c==null||c===a.text)return--l||v();a.text=c;a.escaped=!0;--l||v()})})(k[q])}else try{return c&&
(c=b({},h.defaults,c)),i.parse(g.lex(a,c),c)}catch(x){x.message+="\nPlease report this to https://github.com/chjj/marked.";if((c||h.defaults).silent)return"<p>An error occured:</p><pre>"+f(x.message+"",!0)+"</pre>";throw x;}}var k={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:d,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:d,lheading:/^([^\n]+)\n *(=|-){3,} *\n*/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:d,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/,bullet:/(?:[*+-]|\d+\.)/,item:/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/};k.item=c(k.item,"gm")(/bull/g,k.bullet)();k.list=c(k.list)(/bull/g,k.bullet)("hr",/\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)();k._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|@)\\b";
k.html=c(k.html)("comment",/<\!--[\s\S]*?--\>/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,k._tag)();k.paragraph=c(k.paragraph)("hr",k.hr)("heading",k.heading)("lheading",k.lheading)("blockquote",k.blockquote)("tag","<"+k._tag)("def",k.def)();k.normal=b({},k);k.gfm=b({},k.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/});k.gfm.paragraph=c(k.paragraph)("(?!","(?!"+k.gfm.fences.source.replace("\\1","\\2")+"|")();k.tables=
b({},k.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});g.rules=k;g.lex=function(a,b){return(new g(b)).lex(a)};g.prototype.lex=function(a){a=a.replace(/\r\n|\r/g,"\n").replace(/\t/g,"    ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(a,!0)};g.prototype.token=function(a,b){for(var a=a.replace(/^ +$/gm,""),c,e,d,f,h,g,i;a;){if(d=this.rules.newline.exec(a))a=a.substring(d[0].length),d[0].length>
1&&this.tokens.push({type:"space"});if(d=this.rules.code.exec(a))a=a.substring(d[0].length),d=d[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:!this.options.pedantic?d.replace(/\n+$/,""):d});else if(d=this.rules.fences.exec(a))a=a.substring(d[0].length),this.tokens.push({type:"code",lang:d[2],text:d[3]});else if(d=this.rules.heading.exec(a))a=a.substring(d[0].length),this.tokens.push({type:"heading",depth:d[1].length,text:d[2]});else if(b&&(d=this.rules.nptable.exec(a))){a=a.substring(d[0].length);
h={type:"table",header:d[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:d[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:d[3].replace(/\n$/,"").split("\n")};for(g=0;g<h.align.length;g++)h.align[g]=/^ *-+: *$/.test(h.align[g])?"right":/^ *:-+: *$/.test(h.align[g])?"center":/^ *:-+ *$/.test(h.align[g])?"left":null;for(g=0;g<h.cells.length;g++)h.cells[g]=h.cells[g].split(/ *\| */);this.tokens.push(h)}else if(d=this.rules.lheading.exec(a))a=a.substring(d[0].length),this.tokens.push({type:"heading",
depth:d[2]==="="?1:2,text:d[1]});else if(d=this.rules.hr.exec(a))a=a.substring(d[0].length),this.tokens.push({type:"hr"});else if(d=this.rules.blockquote.exec(a))a=a.substring(d[0].length),this.tokens.push({type:"blockquote_start"}),d=d[0].replace(/^ *> ?/gm,""),this.token(d,b),this.tokens.push({type:"blockquote_end"});else if(d=this.rules.list.exec(a)){a=a.substring(d[0].length);f=d[2];this.tokens.push({type:"list_start",ordered:f.length>1});d=d[0].match(this.rules.item);c=!1;i=d.length;for(g=0;g<
i;g++)h=d[g],e=h.length,h=h.replace(/^ *([*+-]|\d+\.) +/,""),~h.indexOf("\n ")&&(e-=h.length,h=!this.options.pedantic?h.replace(RegExp("^ {1,"+e+"}","gm"),""):h.replace(/^ {1,4}/gm,"")),this.options.smartLists&&g!==i-1&&(e=k.bullet.exec(d[g+1])[0],f!==e&&!(f.length>1&&e.length>1)&&(a=d.slice(g+1).join("\n")+a,g=i-1)),e=c||/\n\n(?!\s*$)/.test(h),g!==i-1&&(c=h[h.length-1]==="\n",e||(e=c)),this.tokens.push({type:e?"loose_item_start":"list_item_start"}),this.token(h,!1),this.tokens.push({type:"list_item_end"});
this.tokens.push({type:"list_end"})}else if(d=this.rules.html.exec(a))a=a.substring(d[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:d[1]==="pre"||d[1]==="script",text:d[0]});else if(b&&(d=this.rules.def.exec(a)))a=a.substring(d[0].length),this.tokens.links[d[1].toLowerCase()]={href:d[2],title:d[3]};else if(b&&(d=this.rules.table.exec(a))){a=a.substring(d[0].length);h={type:"table",header:d[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:d[2].replace(/^ *|\| *$/g,
"").split(/ *\| */),cells:d[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(g=0;g<h.align.length;g++)h.align[g]=/^ *-+: *$/.test(h.align[g])?"right":/^ *:-+: *$/.test(h.align[g])?"center":/^ *:-+ *$/.test(h.align[g])?"left":null;for(g=0;g<h.cells.length;g++)h.cells[g]=h.cells[g].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(h)}else if(b&&(d=this.rules.paragraph.exec(a)))a=a.substring(d[0].length),this.tokens.push({type:"paragraph",text:d[1][d[1].length-1]==="\n"?d[1].slice(0,-1):
d[1]});else if(d=this.rules.text.exec(a))a=a.substring(d[0].length),this.tokens.push({type:"text",text:d[0]});else if(a)throw Error("Infinite loop on byte: "+a.charCodeAt(0));}return this.tokens};var e={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:d,tag:/^<\!--[\s\S]*?--\>|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,
em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:d,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/,_inside:/(?:\[[^\]]*\]|[^\]]|\](?=[^\[]*\]))*/,_href:/\s*<?([^\s]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/};e.link=c(e.link)("inside",e._inside)("href",e._href)();e.reflink=c(e.reflink)("inside",e._inside)();e.normal=b({},e);e.pedantic=b({},e.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});
e.gfm=b({},e.normal,{escape:c(e.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:c(e.text)("]|","~]|")("|","|https?://|")()});e.breaks=b({},e.gfm,{br:c(e.br)("{2,}","*")(),text:c(e.gfm.text)("{2,}","*")()});l.rules=e;l.output=function(a,b,c){return(new l(b,c)).output(a)};l.prototype.output=function(a){var m;var j;for(var b="",c,e;a;)if(e=this.rules.escape.exec(a))a=a.substring(e[0].length),b+=e[1];else if(e=this.rules.autolink.exec(a))a=a.substring(e[0].length),
e[2]==="@"?(c=e[1][6]===":"?this.mangle(e[1].substring(7)):this.mangle(e[1]),e=this.mangle("mailto:")+c):(j=c=f(e[1]),e=j),b+='<a href="'+e+'">'+c+"</a>";else if(e=this.rules.url.exec(a))a=a.substring(e[0].length),m=c=f(e[1]),e=m,b+='<a href="'+e+'">'+c+"</a>";else if(e=this.rules.tag.exec(a))a=a.substring(e[0].length),b+=this.options.sanitize?f(e[0]):e[0];else if(e=this.rules.link.exec(a))a=a.substring(e[0].length),b+=this.outputLink(e,{href:e[2],title:e[3]});else if((e=this.rules.reflink.exec(a))||
(e=this.rules.nolink.exec(a)))a=a.substring(e[0].length),c=(e[2]||e[1]).replace(/\s+/g," "),c=this.links[c.toLowerCase()],!c||!c.href?(b+=e[0][0],a=e[0].substring(1)+a):b+=this.outputLink(e,c);else if(e=this.rules.strong.exec(a))a=a.substring(e[0].length),b+="<strong>"+this.output(e[2]||e[1])+"</strong>";else if(e=this.rules.em.exec(a))a=a.substring(e[0].length),b+="<em>"+this.output(e[2]||e[1])+"</em>";else if(e=this.rules.code.exec(a))a=a.substring(e[0].length),b+="<code>"+f(e[2],!0)+"</code>";
else if(e=this.rules.br.exec(a))a=a.substring(e[0].length),b+="<br>";else if(e=this.rules.del.exec(a))a=a.substring(e[0].length),b+="<del>"+this.output(e[1])+"</del>";else if(e=this.rules.text.exec(a))a=a.substring(e[0].length),b+=f(this.smartypants(e[0]));else if(a)throw Error("Infinite loop on byte: "+a.charCodeAt(0));return b};l.prototype.outputLink=function(a,b){return a[0][0]!=="!"?'<a href="'+f(b.href)+'"'+(b.title?' title="'+f(b.title)+'"':"")+">"+this.output(a[1])+"</a>":'<img src="'+f(b.href)+
'" alt="'+f(a[1])+'"'+(b.title?' title="'+f(b.title)+'"':"")+">"};l.prototype.smartypants=function(a){return!this.options.smartypants?a:a.replace(/--/g,"\u2014").replace(/'([^']*)'/g,"\u2018$1\u2019").replace(/"([^"]*)"/g,"\u201c$1\u201d").replace(/\.{3}/g,"\u2026")};l.prototype.mangle=function(a){for(var b="",c=a.length,e=0,d;e<c;e++)d=a.charCodeAt(e),Math.random()>0.5&&(d="x"+d.toString(16)),b+="&#"+d+";";return b};i.parse=function(a,b){return(new i(b)).parse(a)};i.prototype.parse=function(a){this.inline=
new l(a.links,this.options);this.tokens=a.reverse();for(a="";this.next();)a+=this.tok();return a};i.prototype.next=function(){return this.token=this.tokens.pop()};i.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};i.prototype.parseText=function(){for(var a=this.token.text;this.peek().type==="text";)a+="\n"+this.next().text;return this.inline.output(a)};i.prototype.tok=function(){switch(this.token.type){case "space":return"";case "hr":return"<hr>\n";case "heading":return"<h"+
this.token.depth+">"+this.inline.output(this.token.text)+"</h"+this.token.depth+">\n";case "code":if(this.options.highlight){var a=this.options.highlight(this.token.text,this.token.lang);if(a!=null&&a!==this.token.text)this.token.escaped=!0,this.token.text=a}if(!this.token.escaped)this.token.text=f(this.token.text,!0);return"<pre><code"+(this.token.lang?' class="'+this.options.langPrefix+this.token.lang+'"':"")+">"+this.token.text+"</code></pre>\n";case "table":var a="",b,c,e,d;a+="<thead>\n<tr>\n";
for(c=0;c<this.token.header.length;c++)b=this.inline.output(this.token.header[c]),a+=this.token.align[c]?'<th align="'+this.token.align[c]+'">'+b+"</th>\n":"<th>"+b+"</th>\n";a+="</tr>\n</thead>\n";a+="<tbody>\n";for(c=0;c<this.token.cells.length;c++){b=this.token.cells[c];a+="<tr>\n";for(d=0;d<b.length;d++)e=this.inline.output(b[d]),a+=this.token.align[d]?'<td align="'+this.token.align[d]+'">'+e+"</td>\n":"<td>"+e+"</td>\n";a+="</tr>\n"}a+="</tbody>\n";return"<table>\n"+a+"</table>\n";case "blockquote_start":for(a=
"";this.next().type!=="blockquote_end";)a+=this.tok();return"<blockquote>\n"+a+"</blockquote>\n";case "list_start":c=this.token.ordered?"ol":"ul";for(a="";this.next().type!=="list_end";)a+=this.tok();return"<"+c+">\n"+a+"</"+c+">\n";case "list_item_start":for(a="";this.next().type!=="list_item_end";)a+=this.token.type==="text"?this.parseText():this.tok();return"<li>"+a+"</li>\n";case "loose_item_start":for(a="";this.next().type!=="list_item_end";)a+=this.tok();return"<li>"+a+"</li>\n";case "html":return!this.token.pre&&
!this.options.pedantic?this.inline.output(this.token.text):this.token.text;case "paragraph":return"<p>"+this.inline.output(this.token.text)+"</p>\n";case "text":return"<p>"+this.parseText()+"</p>\n"}};d.exec=d;h.options=h.setOptions=function(a){b(h.defaults,a);return h};h.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1};h.Parser=i;h.parser=i.parse;h.Lexer=g;h.lexer=g.lex;h.InlineLexer=l;h.inlineLexer=l.output;h.parse=
h;typeof exports==="object"?module.exports=h:typeof define==="function"&&define.amd?define("marked/marked",[],function(){return h}):this.marked=h}).call(function(){return this||(typeof window!=="undefined"?window:global)}());
define("orion/markdownView",["marked/marked","orion/webui/littlelib"],function(g){function l(g){this.fileClient=g.fileClient;this.progress=g.progress;this._node=null}l.prototype={display:function(i,f){i.className="orionMarkdown";i.innerHTML=g(f,{sanitize:!0})},displayContents:function(g,f){var c=f.Location||f;this.progress.progress(this.fileClient.read(c),"Reading file "+(f.Name||c)).then(function(c){this.display.bind(this)(g,c)}.bind(this))},displayInFrame:function(g,f){g.className="orionMarkdown";
var c=document.createElement("table"),d=document.createElement("tr");c.appendChild(d);var b=document.createElement("th");b.style.textTransform="uppercase";b.appendChild(document.createTextNode(f.Name||"readme"));d.appendChild(b);d=document.createElement("tr");c.appendChild(d);var b=document.createElement("td"),h=document.createElement("div");this.displayContents.call(this,h,f);b.appendChild(h);d.appendChild(b);g.appendChild(c)}};return{MarkdownView:l}});
define("orion/projects/projectEditor","orion/markdownView,orion/URITemplate,orion/webui/littlelib,orion/projectCommands,orion/commandRegistry,orion/PageLinks".split(","),function(g,l,i,f,c,d){function b(b){this.serviceRegistry=b.serviceRegistry;this.fileClient=b.fileClient;this.progress=b.progress;this.projectClient=this.serviceRegistry.getService("orion.project.client");this.commandService=b.commandService;this._node=null;this.markdownView=new g.MarkdownView({fileClient:this.fileClient,progress:this.progress});
this.dependencyActions="dependencyActions";this.createCommands()}var h=new l("./edit.html#{,resource,params*}");b.prototype={createCommands:function(){f.createDependencyCommands(this.serviceRegistry,this.commandService,this,this.fileClient,this.projectClient);this.projectClient.getProjectHandlerTypes();this.commandService.registerCommandContribution(this.dependencyActions,"orion.project.dependency.connect",1);this.commandService.registerCommandContribution(this.dependencyActions,"orion.project.dependency.disconnect",
2)},changedItem:function(){this.fileClient.read(this.parentFolder.Location,!0).then(function(b){i.empty(this.node);this.displayContents(this.node,b)}.bind(this))},display:function(b,c){this.node=b;this.node.className="orionProject";this.projectData=c;var a=document.createElement("span");this.node.appendChild(a);this.renderProjectInfo(a);a=document.createElement("span");this.node.appendChild(a);this.renderAdditionalProjectProperties(a);a=document.createElement("span");this.node.appendChild(a);this.renderDependencies(a)},
displayContents:function(b,c){this.parentFolder=c;this.projectClient.readProject(c).then(function(a){this.display.bind(this)(b,a)}.bind(this))},_renderEditableFields:function(b,c,a,d){function f(){a.value=c.innerText||c.textContent;c.style.visibility="hidden";a.style.visibility="";a.focus();b.onclick=null}c.appendChild(document.createTextNode(this.projectData[d]||" "));b.title="Click to edit";c.style.position="absolute";b.onclick=f.bind(this);a.value=this.projectData[d]||"";a.style.position="absolute";
a.style.visibility="hidden";a.title="Press Enter to save";a.style.width="70%";a.style.marginLeft="0";a.onkeyup=function(a){if(a.keyCode===13){var h={};h[d]=a.target.value;this.progress.progress(this.projectClient.changeProjectProperties(this.projectData,h),"Saving project "+this.projectData.Name).then(function(d){if(d){this.projectData=d;i.empty(c);c.appendChild(document.createTextNode(a.target.value));if(c.href)c.href=a.target.value;c.style.visibility="";a.target.style.visibility="hidden";b.onclick=
f.bind(this)}}.bind(this))}else if(a.keyCode===27)c.style.visibility="",a.target.style.visibility="hidden",b.onclick=f.bind(this)}.bind(this);a.onblur=function(a){c.style.visibility="";a.target.style.visibility="hidden";setTimeout(function(){b.onclick=f.bind(this)}.bind(this),100)}},renderProjectInfo:function(b){var c=document.createElement("table"),a=document.createElement("tr");c.appendChild(a);var d=document.createElement("th");d.colSpan=2;d.appendChild(document.createTextNode("Project Information"));
a.appendChild(d);a=document.createElement("tr");c.appendChild(a);var d=document.createElement("td"),f=document.createElement("b");f.appendChild(document.createTextNode("Name"));d.appendChild(f);d.width="20%";a.appendChild(d);d=document.createElement("td");d.style.verticalAlign="top";var f=document.createElement("span"),h=document.createElement("input");this._renderEditableFields(d,f,h,"Name");d.appendChild(f);d.appendChild(h);a.appendChild(d);c.appendChild(a);a=document.createElement("tr");c.appendChild(a);
d=document.createElement("td");f=document.createElement("b");f.appendChild(document.createTextNode("Description"));d.appendChild(f);d.width="20%";a.appendChild(d);d=document.createElement("td");d.style.verticalAlign="top";d.style.height="40px";f=document.createElement("span");f.style.height="40px";f.style.verticalAlign="middle";f.style.overflow="auto";f.style.width="70%";h=document.createElement("textarea");h.style.height="40px";this._renderEditableFields(d,f,h,"Description");d.appendChild(f);d.appendChild(h);
a.appendChild(d);c.appendChild(a);a=document.createElement("tr");c.appendChild(a);d=document.createElement("td");f=document.createElement("b");f.appendChild(document.createTextNode("Site"));d.appendChild(f);d.width="20%";a.appendChild(d);d=document.createElement("td");d.style.verticalAlign="top";f=document.createElement("a");f.href=this.projectData.Url;h=document.createElement("input");this._renderEditableFields(d,f,h,"Url");d.appendChild(f);d.appendChild(h);a.appendChild(d);c.appendChild(a);b.appendChild(c)},
renderAdditionalProjectProperties:function(b){this.projectClient.getMatchingProjectHandlers(this.parentFolder).then(function(c){for(var a=0;a<c.length;a++){var f=c[a];f&&f.getAdditionalProjectProperties&&this.progress.progress(f.getAdditionalProjectProperties(this.parentFolder,this.projectData),"Getting additional project information").then(function(a){if(a&&a.length&&a.length!==0)for(var c=0;c<a.length;c++){var e=a[c];if(e.name){var f=document.createElement("table"),h=document.createElement("tr");
f.appendChild(h);var j=document.createElement("th");j.colSpan=2;j.appendChild(document.createTextNode(e.name));var g=document.createElement("span");j.appendChild(g);h.appendChild(j);if(e.children)for(g=0;g<e.children.length;g++){var i=e.children[g],h=document.createElement("tr");f.appendChild(h);var j=document.createElement("td"),u=document.createElement("b");u.appendChild(document.createTextNode(i.name));j.appendChild(u);j.width="20%";h.appendChild(j);j=document.createElement("td");if(i.href){var u=
document.createElement("a"),o=new l(i.href);u.href=o.expand({OrionHome:d.getOrionHome()});u.appendChild(document.createTextNode(i.value||" "));j.appendChild(u)}else j.appendChild(document.createTextNode(i.value||" "));h.appendChild(j)}b.appendChild(f)}}}.bind(this))}}.bind(this))},renderDependencies:function(b){if(this.projectData.Dependencies&&this.projectData.Dependencies.length!==0){var c=document.createElement("table"),a=document.createElement("tr");c.appendChild(a);var d=document.createElement("th");
d.appendChild(document.createTextNode("Associated Content"));a.appendChild(d);d=document.createElement("th");a.appendChild(d);for(var f=0;f<this.projectData.Dependencies.length;f++){var g=this.projectData.Dependencies[f],a=document.createElement("tr");c.appendChild(a);d=document.createElement("td");d.appendChild(document.createTextNode(g.Name));var n=document.createElement("span");(function(a,b,c){this.projectClient.getDependencyFileMetadata(c,this.projectData.WorkspaceLocation).then(function(b){if(b){i.empty(a);
var e=document.createElement("a");e.href=h.expand({resource:b.Location});e.appendChild(document.createTextNode(c.Name));a.appendChild(e)}},function(){i.empty(a);a.appendChild(document.createTextNode(c.Name+" (disconnected)"));i.empty(b);this.commandService.renderCommands(this.dependencyActions,b,{Dependency:c,disconnected:!0,Project:this.projectData},this,"tool")}.bind(this))}).call(this,d,n,g);a.appendChild(d);d=document.createElement("td");n.style.cssFloat="right";d.appendChild(n);this.commandService.renderCommands(this.dependencyActions,
n,{Dependency:g,Project:this.projectData},this,"tool");a.appendChild(d)}b.appendChild(c);this.projectData.type="Project"}}};return{ProjectEditor:b}});
define("orion/projects/projectExplorer",["orion/Deferred","orion/URITemplate","orion/webui/littlelib","orion/explorers/explorer"],function(g,l,i,f){function c(b){this._init(b)}function d(b,e,a,d){this.registry=e;this.selection=a;this.commandService=d;this.parentId=b;this.renderer=new c({});this.renderer.explorer=this;this.myTree=null;this.newActionsScope=h}var b=new l("../edit/edit.html#{,resource,params*}"),h="newProjectActions";c.prototype=Object.create(f.ExplorerRenderer.prototype);c.prototype.renderTableHeader=
function(b){var c=document.createElement("thead"),a=document.createElement("tr"),d=document.createElement("th");d.appendChild(document.createTextNode("Projects"));a.appendChild(d);d=document.createElement("th");d.colSpan=2;this.explorer.newActionsSpan=document.createElement("ul");this.explorer.newActionsSpan.id=this.explorer.newActionsScope;this.explorer.newActionsSpan.classList.add("commandList");this.explorer.newActionsSpan.classList.add("layoutRight");d.appendChild(this.explorer.newActionsSpan);
a.appendChild(d);c.appendChild(a);b.appendChild(c)};c.prototype.emptyCallback=function(b){var c=document.createElement("tr"),a=document.createElement("td");a.colSpan=this.oneColumn?1:3;var d=document.createElement("div");d.classList.add("noFile");d.textContent="There are no projects in your workspace, use ${0} to add projects";var f=document.createElement("span");f.classList.add("core-sprite-addcontent");f.classList.add("icon-inline");f.classList.add("imageSprite");i.processDOMNodes(d,[f]);a.appendChild(d);
c.appendChild(a);b.appendChild(c)};c.prototype.renderRow=function(c,e){var a=this.explorer.getNavDict();if(a){a.addRow(c,e);var d=this;e.addEventListener("click",function(a){if(d.explorer.getNavHandler())d.explorer.getNavHandler().onClick(c,a)},!1)}var a=document.createElement("td"),f=document.createElement("a");f.appendChild(document.createTextNode(c.Name));f.href=b.expand({resource:c.ContentLocation});a.appendChild(f);e.appendChild(a);a=document.createElement("td");a.appendChild(document.createTextNode(!c.Description?
" ":c.Description.length>200?c.Description.substring(0,180)+"...":c.Description));e.appendChild(a);a=document.createElement("td");c.Url?(f=document.createElement("a"),f.appendChild(document.createTextNode(c.Url)),f.href=c.Url,a.appendChild(f)):a.appendChild(document.createTextNode(" "));e.appendChild(a)};d.prototype=Object.create(f.Explorer.prototype);d.prototype.loadProjects=function(b){this.model=new f.SimpleFlatModel(b,"orion.project.",function(b){if(b.ContentLocation)return b.ContentLocation.replace(/[\\\/]/g,
"")});this.myTree=this.createTree(this.parentId,this.model,{noSelection:!0,indent:"8px"})};return{ProjectExplorer:d,newActionsScope:h}});
define("orion/projects/projectView",["orion/projects/projectExplorer","orion/selection","orion/URITemplate","orion/webui/littlelib"],function(g,l,i,f){function c(b){this.progress=b.progress;this.fileClient=b.fileClient;this.serviceRegistry=b.serviceRegistry;this.commandService=b.commandService;this.projectClient=this.serviceRegistry.getService("orion.project.client")}var d=new i("#{,resource,params*}");c.prototype={display:function(b,c){c.classList.add("orionProject");this.projectExplorer=new g.ProjectExplorer(c,
this.serviceRegistry,new l.Selection(this.serviceRegistry),this.commandServic);this.changedItem(b)},changedItem:function(b,c,k){var e=this;k==="created"&&b.ContentLocation?window.location=d.expand({resource:b.ContentLocation}):b?e.progress.progress(e.projectClient.readAllProjects(b),"Listing projects").then(function(a){e.projectExplorer.loadProjects(a);f.empty(e.projectExplorer.newActionsSpan);e.commandService.renderCommands(g.newActionsScope,e.projectExplorer.newActionsSpan,b,e.projectExplorer,"tool")}):
e.progress.progress(e.fileClient.loadWorkspace(),"Getting workspace information").then(function(){e.progress.progress(e.projectClient.readAllProjects(b),"Listing projects").then(function(a){e.projectExplorer.loadProjects(a);f.empty(e.projectExplorer.newActionsSpan);e.commandService.renderCommands(g.newActionsScope,e.projectExplorer.newActionsSpan,b,e.projectExplorer,"tool")})})}};return{ProjectView:c}});
define("orion/folderView","i18n!orion/edit/nls/messages,orion/globalCommands,orion/explorers/explorer-table,orion/explorers/navigatorRenderer,orion/selection,orion/fileCommands,orion/extensionCommands,orion/keyBinding,orion/markdownView,orion/projects/projectEditor,orion/PageUtil,orion/URITemplate,orion/webui/littlelib,orion/objects,orion/projects/projectView".split(","),function(g,l,i,f,c,d,b,h,k,e,a,j,p,m,n){function s(){u.apply(this,arguments);this.selectionPolicy=this.explorer.getCommandsVisible()?
null:"cursorOnly"}function q(a){var b=this;a.setFocus=!1;a.cachePrefix=null;a.dragAndDrop=d.uploadFile;a.modelEventDispatcher=d.getModelEventDispatcher();a.rendererFactory=function(b){return new s({checkbox:!1,cachePrefix:"FolderNavigator"},b,a.commandRegistry,a.contentTypeRegistry)};v.apply(this,arguments);this.commandsId=".folderNav";this.serviceRegistry=a.serviceRegistry;this.fileClient=a.fileClient;this.commandRegistry=a.commandRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.treeRoot=
{};var e=p.node(this.parentId);this.toolbarId=e.id+"Tool";this.newActionsScope=e.id+"New";this.selectionActionsScope=e.id+"Selection";this.selection=new c.Selection(this.serviceRegistry,"folderNavFileSelection");this.selection.addEventListener("selectionChanged",function(a){b.updateCommands(a.selections)})}function t(a){this._parent=a.parent;this._input=a.input;this._metadata=a.metadata;this.fileClient=a.fileService;this.progress=a.progress;this.serviceRegistry=a.serviceRegistry;this.commandService=
a.commandService;this.contentTypeRegistry=a.contentTypeRegistry;this.showFolderNav=this.showProjectView=!0;this._init()}var v=i.FileExplorer,x=h.KeyBinding,u=f.NavigatorRenderer,o=new j("#{,resource,params*}");s.prototype=Object.create(u.prototype);m.mixin(s.prototype,{showFolderImage:!0,createFolderNode:function(a){var b=f.NavigatorRenderer.prototype.createFolderNode.call(this,a);if(this.showFolderLinks&&b.tagName==="A")b.href=o.expand({resource:a.Location});b.classList.add("folderNavFolder");b.classList.add("navlink");
b.classList.add("targetSelector");b.classList.remove("navlinkonpage");return b},getCellHeaderElement:function(a){if(a===0){a=document.createElement("th");a.colSpan=1;var b=this.explorer.treeRoot;a.appendChild(document.createTextNode(b.Parents?b.Name:this.explorer.fileClient.fileServiceName(b.Location)));return a}else if(a===1)return a=document.createElement("th"),a.colSpan=2,b=document.createElement("span"),b.id=this.explorer.toolbarId,a.appendChild(b),window.setTimeout(function(){this.explorer.updateCommands()}.bind(this),
0),a;return null},getExpandImage:function(){return null}});q.prototype=Object.create(v.prototype);m.mixin(q.prototype,{loadRoot:function(b){function c(){e.registerCommands().then(function(){e.updateCommands()})}var e=this;b?this.load(b,"Loading "+b.Name).then(c):this.loadResourceList(a.matchResourceParameters().resource+"?depth=1",!1).then(c)},destroy:function(){v.prototype.destroy.call(this);var a=this;[this.newActionsScope,this.selectionActionsScope].forEach(function(b){delete a[b]})},createActionSections:function(a){[this.newActionsScope,
this.selectionActionsScope].forEach(function(b){if(!p.node(b)){var c=document.createElement("ul");c.id=b;c.classList.add("commandList");c.classList.add("layoutRight");a.appendChild(c)}})},registerCommands:function(){var a=this.commandRegistry,c=this.fileClient,e=this.serviceRegistry,f=this.newActionsScope,o=this.selectionActionsScope;a.addCommandGroup(f,"orion.folderNavNewGroup",1E3,g.New,null,null,"core-sprite-expandAll",null,"dropdownSelection");a.addCommandGroup(o,"orion.folderNavSelectionGroup",
100,g.Actions,null,null,"core-sprite-gear",null,"dropdownSelection");a.registerSelectionService(o,this.selection);var h=p.node(this.parentId),j=new x(113),k=new x(46),n=new x("c",!0),i=new x("v",!0);i.domScope=n.domScope=k.domScope=j.domScope=h.id;i.scopeName=n.scopeName=k.scopeName=j.scopeName=g.FolderNavigator;a.registerCommandContribution(f,"eclipse.copySelections"+this.commandsId,1,null,!0,n);a.registerCommandContribution(f,"eclipse.pasteSelections"+this.commandsId,1,null,!0,i);a.registerCommandContribution(f,
"eclipse.newFile"+this.commandsId,1,"orion.folderNavNewGroup");a.registerCommandContribution(f,"eclipse.newFolder"+this.commandsId,2,"orion.folderNavNewGroup",!1,null);a.registerCommandContribution(f,"orion.new.project"+this.commandsId,1,"orion.folderNavNewGroup");a.registerCommandContribution(f,"orion.new.linkProject"+this.commandsId,2,"orion.folderNavNewGroup");a.registerCommandContribution(o,"eclipse.renameResource"+this.commandsId,2,"orion.folderNavSelectionGroup",!1,j);a.registerCommandContribution(o,
"eclipse.copyFile"+this.commandsId,3,"orion.folderNavSelectionGroup");a.registerCommandContribution(o,"eclipse.moveFile"+this.commandsId,4,"orion.folderNavSelectionGroup");a.registerCommandContribution(o,"eclipse.deleteFile"+this.commandsId,5,"orion.folderNavSelectionGroup",!1,k);a.registerCommandContribution(o,"eclipse.compareWithEachOther"+this.commandsId,6,"orion.folderNavSelectionGroup");a.registerCommandContribution(o,"eclipse.compareWith"+this.commandsId,7,"orion.folderNavSelectionGroup");a.registerCommandContribution(o,
"orion.importZipURL"+this.commandsId,1,"orion.folderNavSelectionGroup/orion.importExportGroup");a.registerCommandContribution(o,"orion.import"+this.commandsId,2,"orion.folderNavSelectionGroup/orion.importExportGroup");a.registerCommandContribution(o,"eclipse.downloadFile"+this.commandsId,3,"orion.folderNavSelectionGroup/orion.importExportGroup");a.registerCommandContribution(o,"orion.importSFTP"+this.commandsId,4,"orion.folderNavSelectionGroup/orion.importExportGroup");a.registerCommandContribution(o,
"eclipse.exportSFTPCommand"+this.commandsId,5,"orion.folderNavSelectionGroup/orion.importExportGroup");d.createFileCommands(e,a,this,c);return b.createAndPlaceFileCommandsExtension(e,a,o,0,"orion.folderNavSelectionGroup",!0,this.commandsVisibleWhen,this.commandsId)},getCommandsVisible:function(){return l.getMainSplitter().splitter.isClosed()},setCommandsVisible:function(a){a?this.updateCommands():(this.commandRegistry.destroy(this.newActionsScope),this.commandRegistry.destroy(this.selectionActionsScope));
a=a?null:"cursorOnly";this.renderer.selectionPolicy=a;var b=this.getNavHandler();b&&b.setSelectionPolicy(a)},updateCommands:function(){var a=p.node(this.toolbarId);a&&this.getCommandsVisible()&&(this.createActionSections(a),d.updateNavTools(this.registry,this.commandRegistry,this,this.newActionsScope,this.selectionActionsScope,this.treeRoot,!0))}});t.prototype={_init:function(){if(this.serviceRegistry.getServiceReferences("orion.projects").length===0)this.showProjectView=!1;this.markdownView=new k.MarkdownView({fileClient:this.fileClient,
progress:this.progress});if(this.showProjectView)this.projectEditor=new e.ProjectEditor({fileClient:this.fileClient,progress:this.progress,serviceRegistry:this.serviceRegistry,commandService:this.commandService}),this.projectView=new n.ProjectView({fileClient:this.fileClient,progress:this.progress,serviceRegistry:this.serviceRegistry,commandService:this.commandService});l.getMainSplitter().splitter.addEventListener("toggle",this._splitterToggleListener=function(a){[this.markdownView,this.projectEditor,
this.projectView,this.folderNavExplorer].forEach(function(b){b&&b.setCommandsVisible&&b.setCommandsVisible(a.closed)})}.bind(this))},displayWorkspaceView:function(){if(!this._node)this._node=document.createElement("div");this._parent.appendChild(this._node);if(this.showProjectView){var a=document.createElement("div");this._node.appendChild(a);this.projectView.display(this._metadata,a)}},displayFolderView:function(a){for(var a=a.Children,b,c,e=0;e<a.length;e++){var d=a[e];!d.Directory&&d.Name==="project.json"&&
(b=d);!d.Directory&&d.Name&&d.Name.toLowerCase()==="readme.md"&&(c=d)}if(!this._node)this._node=document.createElement("div");this._parent.appendChild(this._node);b&&this.showProjectView&&(b=document.createElement("div"),this.projectEditor.displayContents(b,this._metadata),this._node.appendChild(b));if(this.showFolderNav)b=document.createElement("div"),b.className="folderNav",b.id="folderNavNode",this.folderNavExplorer=new q({parentId:b,serviceRegistry:this.serviceRegistry,fileClient:this.fileClient,
commandRegistry:this.commandService,contentTypeRegistry:this.contentTypeRegistry}),this.folderNavExplorer.loadRoot(this._metadata),this._node.appendChild(b);c&&(b=document.createElement("div"),this.markdownView.displayInFrame(b,c),this._node.appendChild(b))},create:function(){this._metadata.Projects&&this.displayWorkspaceView();this._metadata.Children?this.displayFolderView(this._metadata):this._metadata.ChildrenLocation&&this.progress.progress(this.fileClient.fetchChildren(this._metadata.ChildrenLocation),
"Fetching children of "+this._metadata.Name).then(function(a){this._metadata.Children=a;this.displayFolderView(this._metadata)}.bind(this))},destroy:function(){l.getMainSplitter().splitter.removeEventListener("toggle",this._splitterToggleListener);this.folderNavExplorer&&this.folderNavExplorer.destroy();this.folderNavExplorer=null;this._node&&this._node.parentNode&&this._node.parentNode.removeChild(this._node);this._node=null}};return{FolderView:t}});
define("orion/editor/i18n",{load:function(g,l,i){l.specified&&l.specified("orion/bootstrap")?l(["orion/i18n!"+g],function(f){i(f)}):i({})}});
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",replaceAll:"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(g,l){var i={root:l},f;for(f in g)g.hasOwnProperty(f)&&typeof i[f]==="undefined"&&(i[f]=g[f]);return i});
define("orion/editor/textModel",["orion/editor/eventTarget","orion/util"],function(g,l){function i(f,c){this._lastLineIndex=-1;this._text=[""];this._lineOffsets=[0];this.setText(f);this.setLineDelimiter(c)}i.prototype={find:function(f){if(this._text.length>1)this._text=[this._text.join("")];var c=f.string,d=c,b=f.caseInsensitive;!f.regex&&c&&(d=c.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$&"),b&&(d=d.replace(/[iI\u0130\u0131]/g,"[Ii\u0130\u0131]")));var h=null,g;if(d){var c=f.reverse,e=f.wrap,a=f.wholeWord,
j=f.start||0,f=f.end,p=f!==null&&f!==void 0,i="";i.indexOf("g")===-1&&(i+="g");b&&i.indexOf("i")===-1&&(i+="i");a&&(d="\\b"+d+"\\b");var n=this._text[0],l,q,t=0;p&&(b=j<f?j:f,n=n.substring(b,j<f?f:j),t=b);var v=RegExp(d,i);if(c)g=function(){var a=null;for(v.lastIndex=0;;){q=v.lastIndex;l=v.exec(n);if(q===v.lastIndex)return null;if(l){if(!(l.index+t<j)){if(!e||a)break;j=n.length+t}a={start:l.index+t,end:v.lastIndex+t}}else break}if(a)j=a.start;return a};else{if(!p)v.lastIndex=j;g=function(){for(;;){q=
v.lastIndex;l=v.exec(n);if(q===v.lastIndex)break;if(l)return{start:l.index+t,end:v.lastIndex+t};if(!(q!==0&&e))break}return null}}h=g()}return{next:function(){var a=h;a&&(h=g());return a},hasNext:function(){return h!==null}}},getCharCount:function(){for(var f=0,c=0;c<this._text.length;c++)f+=this._text[c].length;return f},getLine:function(f,c){var d=this.getLineCount();if(!(0<=f&&f<d))return null;var b=this._lineOffsets[f];if(f+1<d){d=this.getText(b,this._lineOffsets[f+1]);if(c)return d;for(var b=
d.length,h;(h=d.charCodeAt(b-1))===10||h===13;)b--;return d.substring(0,b)}else return this.getText(b)},getLineAtOffset:function(f){var c=this.getCharCount();if(!(0<=f&&f<=c))return-1;var d=this.getLineCount();if(f===c)return d-1;var b,h,g=this._lastLineIndex;if(0<=g&&g<d&&(b=this._lineOffsets[g],h=g+1<d?this._lineOffsets[g+1]:c,b<=f&&f<h))return g;for(var e=d,a=-1;e-a>1;)if(g=Math.floor((e+a)/2),b=this._lineOffsets[g],h=g+1<d?this._lineOffsets[g+1]:c,f<=b)e=g;else if(f<h){e=g;break}else a=g;return this._lastLineIndex=
e},getLineCount:function(){return this._lineOffsets.length},getLineDelimiter:function(){return this._lineDelimiter},getLineEnd:function(f,c){var d=this.getLineCount();if(!(0<=f&&f<d))return-1;if(f+1<d){d=this._lineOffsets[f+1];if(c)return d;for(var b=this.getText(Math.max(this._lineOffsets[f],d-2),d),h=b.length,g;(g=b.charCodeAt(h-1))===10||g===13;)h--;return d-(b.length-h)}else return this.getCharCount()},getLineStart:function(f){return!(0<=f&&f<this.getLineCount())?-1:this._lineOffsets[f]},getText:function(f,
c){f===void 0&&(f=0);c===void 0&&(c=this.getCharCount());if(f===c)return"";for(var d=0,b=0,h;b<this._text.length;){h=this._text[b].length;if(f<=d+h)break;d+=h;b++}for(var g=d,e=b;b<this._text.length;){h=this._text[b].length;if(c<=d+h)break;d+=h;b++}if(e===b)return this._text[e].substring(f-g,c-d);g=this._text[e].substring(f-g);d=this._text[b].substring(0,c-d);return g+this._text.slice(e+1,b).join("")+d},onChanging:function(f){return this.dispatchEvent(f)},onChanged:function(f){return this.dispatchEvent(f)},
setLineDelimiter:function(f,c){f==="auto"&&(f=void 0,this.getLineCount()>1&&(f=this.getText(this.getLineEnd(0),this.getLineEnd(0,!0))));this._lineDelimiter=f?f:l.platformDelimiter;if(c){var d=this.getLineCount();if(d>1){for(var b=Array(d),h=0;h<d;h++)b[h]=this.getLine(h);this.setText(b.join(this._lineDelimiter))}}},setText:function(f,c,d){f===void 0&&(f="");c===void 0&&(c=0);d===void 0&&(d=this.getCharCount());if(!(c===d&&f==="")){for(var b=this.getLineAtOffset(c),h=this.getLineAtOffset(d),g=c,e=
d-c,a=h-b,j=f.length,p=0,i=this.getLineCount(),n=0,l=0,q=0,t=[];;){n!==-1&&n<=q&&(n=f.indexOf("\r",q));l!==-1&&l<=q&&(l=f.indexOf("\n",q));if(l===-1&&n===-1)break;q=n!==-1&&l!==-1?n+1===l?l+1:(n<l?n:l)+1:n!==-1?n+1:l+1;t.push(c+q);p++}this.onChanging({type:"Changing",text:f,start:g,removedCharCount:e,addedCharCount:j,removedLineCount:a,addedLineCount:p});t.length===0&&(q=this.getLineStart(b),h=h+1<i?this.getLineStart(h+1):this.getCharCount(),c!==q&&(f=this.getText(q,c)+f,c=q),d!==h&&(f+=this.getText(d,
h),d=h));q=j-e;for(h=b+a+1;h<i;h++)this._lineOffsets[h]+=q;if(t.length<5E4)b=[b+1,a].concat(t),Array.prototype.splice.apply(this._lineOffsets,b);else{q=b+1;this._lineOffsets.splice(q,a);for(i=0;i<t.length;i+=5E4)b=[q,0].concat(t.slice(i,Math.min(t.length,i+5E4))),Array.prototype.splice.apply(this._lineOffsets,b),q+=5E4}for(q=i=0;q<this._text.length;){h=this._text[q].length;if(c<=i+h)break;i+=h;q++}b=i;for(t=q;q<this._text.length;){h=this._text[q].length;if(d<=i+h)break;i+=h;q++}h=this._text[q];c=
this._text[t].substring(0,c-b);d=h.substring(d-i);t=[t,q-t+1];c&&t.push(c);f&&t.push(f);d&&t.push(d);Array.prototype.splice.apply(this._text,t);if(this._text.length===0)this._text=[""];this.onChanged({type:"Changed",start:g,removedCharCount:e,addedCharCount:j,removedLineCount:a,addedLineCount:p})}}};g.EventTarget.addMixin(i.prototype);return{TextModel:i}});
define("orion/editor/keyModes",["orion/keyBinding","orion/util"],function(g,l){function i(c){if(c)this._view=c,this._keyBindings=this.createKeyBindings(),this._keyBindingIndex=0}function f(c){i.call(this,c)}i.prototype={createKeyBindings:function(){return[]},getKeyBindings:function(c){for(var d=[],b=this._keyBindings,f=0;f<b.length;f++)b[f].actionID===c&&d.push(b[f].keyBinding);return d},getView:function(){return this._view},isActive:function(){return this._view.getKeyModes().indexOf(this)!==-1},
match:function(c){if(c.type==="keydown")switch(c.keyCode){case 16:case 17:case 18:case 91:return}for(var d=this._keyBindingIndex,b=this._matchingKeyBindings||this._keyBindings,f=[],g=0;g<b.length;g++){var e=b[g],a=e.keyBinding.match(c,d);if(a===!0)return this._keyBindingIndex=0,this._matchingKeyBindings=null,e.actionID;else typeof a==="number"&&f.push(e)}if(f.length===0)this._keyBindingIndex=0,this._matchingKeyBindings=null;else return this._keyBindingIndex++,this._matchingKeyBindings=f,"noop"},setKeyBinding:function(c,
d){for(var b=this._keyBindings,f=0;f<b.length;f++){var g=b[f];if(g.keyBinding.equals(c)){d?g.actionID=d:g.predefined?g.actionID="noop":b.splice(f,1);return}}d&&b.push({keyBinding:c,actionID:d})},setView:function(c){this._view=c}};f.prototype=new i;f.prototype.createKeyBindings=function(){var c=g.KeyBinding,d=[];d.push({actionID:"lineUp",keyBinding:new c(38),predefined:!0});d.push({actionID:"lineDown",keyBinding:new c(40),predefined:!0});d.push({actionID:"charPrevious",keyBinding:new c(37),predefined:!0});
d.push({actionID:"charNext",keyBinding:new c(39),predefined:!0});l.isMac?(d.push({actionID:"scrollPageUp",keyBinding:new c(33),predefined:!0}),d.push({actionID:"scrollPageDown",keyBinding:new c(34),predefined:!0}),d.push({actionID:"pageUp",keyBinding:new c(33,null,null,!0),predefined:!0}),d.push({actionID:"pageDown",keyBinding:new c(34,null,null,!0),predefined:!0}),d.push({actionID:"lineStart",keyBinding:new c(37,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new c(39,!0),predefined:!0}),
d.push({actionID:"wordPrevious",keyBinding:new c(37,null,null,!0),predefined:!0}),d.push({actionID:"wordNext",keyBinding:new c(39,null,null,!0),predefined:!0}),d.push({actionID:"scrollTextStart",keyBinding:new c(36),predefined:!0}),d.push({actionID:"scrollTextEnd",keyBinding:new c(35),predefined:!0}),d.push({actionID:"textStart",keyBinding:new c(38,!0),predefined:!0}),d.push({actionID:"textEnd",keyBinding:new c(40,!0),predefined:!0}),d.push({actionID:"scrollPageUp",keyBinding:new c(38,null,null,null,
!0),predefined:!0}),d.push({actionID:"scrollPageDown",keyBinding:new c(40,null,null,null,!0),predefined:!0}),d.push({actionID:"lineStart",keyBinding:new c(37,null,null,null,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new c(39,null,null,null,!0),predefined:!0}),d.push({actionID:"lineStart",keyBinding:new c(38,null,null,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new c(40,null,null,!0),predefined:!0})):(d.push({actionID:"pageUp",keyBinding:new c(33),predefined:!0}),d.push({actionID:"pageDown",
keyBinding:new c(34),predefined:!0}),d.push({actionID:"lineStart",keyBinding:new c(36),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new c(35),predefined:!0}),d.push({actionID:"wordPrevious",keyBinding:new c(37,!0),predefined:!0}),d.push({actionID:"wordNext",keyBinding:new c(39,!0),predefined:!0}),d.push({actionID:"textStart",keyBinding:new c(36,!0),predefined:!0}),d.push({actionID:"textEnd",keyBinding:new c(35,!0),predefined:!0}));l.isFirefox&&l.isLinux&&(d.push({actionID:"lineUp",keyBinding:new c(38,
!0),predefined:!0}),d.push({actionID:"lineDown",keyBinding:new c(40,!0),predefined:!0}));l.isWindows&&(d.push({actionID:"scrollLineUp",keyBinding:new c(38,!0),predefined:!0}),d.push({actionID:"scrollLineDown",keyBinding:new c(40,!0),predefined:!0}));d.push({actionID:"selectLineUp",keyBinding:new c(38,null,!0),predefined:!0});d.push({actionID:"selectLineDown",keyBinding:new c(40,null,!0),predefined:!0});d.push({actionID:"selectCharPrevious",keyBinding:new c(37,null,!0),predefined:!0});d.push({actionID:"selectCharNext",
keyBinding:new c(39,null,!0),predefined:!0});d.push({actionID:"selectPageUp",keyBinding:new c(33,null,!0),predefined:!0});d.push({actionID:"selectPageDown",keyBinding:new c(34,null,!0),predefined:!0});l.isMac?(d.push({actionID:"selectLineStart",keyBinding:new c(37,!0,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new c(39,!0,!0),predefined:!0}),d.push({actionID:"selectWordPrevious",keyBinding:new c(37,null,!0,!0),predefined:!0}),d.push({actionID:"selectWordNext",keyBinding:new c(39,
null,!0,!0),predefined:!0}),d.push({actionID:"selectTextStart",keyBinding:new c(36,null,!0),predefined:!0}),d.push({actionID:"selectTextEnd",keyBinding:new c(35,null,!0),predefined:!0}),d.push({actionID:"selectTextStart",keyBinding:new c(38,!0,!0),predefined:!0}),d.push({actionID:"selectTextEnd",keyBinding:new c(40,!0,!0),predefined:!0}),d.push({actionID:"selectLineStart",keyBinding:new c(37,null,!0,null,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new c(39,null,!0,null,!0),predefined:!0}),
d.push({actionID:"selectLineStart",keyBinding:new c(38,null,!0,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new c(40,null,!0,!0),predefined:!0})):(l.isLinux&&(d.push({actionID:"selectWholeLineUp",keyBinding:new c(38,!0,!0),predefined:!0}),d.push({actionID:"selectWholeLineDown",keyBinding:new c(40,!0,!0),predefined:!0})),d.push({actionID:"selectLineStart",keyBinding:new c(36,null,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new c(35,null,!0),predefined:!0}),d.push({actionID:"selectWordPrevious",
keyBinding:new c(37,!0,!0),predefined:!0}),d.push({actionID:"selectWordNext",keyBinding:new c(39,!0,!0),predefined:!0}),d.push({actionID:"selectTextStart",keyBinding:new c(36,!0,!0),predefined:!0}),d.push({actionID:"selectTextEnd",keyBinding:new c(35,!0,!0),predefined:!0}));d.push({actionID:"undo",keyBinding:new g.KeyBinding("z",!0),predefined:!0});l.isMac?d.push({actionID:"redo",keyBinding:new g.KeyBinding("z",!0,!0),predefined:!0}):d.push({actionID:"redo",keyBinding:new g.KeyBinding("y",!0),predefined:!0});
d.push({actionID:"deletePrevious",keyBinding:new c(8),predefined:!0});d.push({actionID:"deletePrevious",keyBinding:new c(8,null,!0),predefined:!0});d.push({actionID:"deleteNext",keyBinding:new c(46),predefined:!0});d.push({actionID:"deleteWordPrevious",keyBinding:new c(8,!0),predefined:!0});d.push({actionID:"deleteWordPrevious",keyBinding:new c(8,!0,!0),predefined:!0});d.push({actionID:"deleteWordNext",keyBinding:new c(46,!0),predefined:!0});d.push({actionID:"tab",keyBinding:new c(9),predefined:!0});
d.push({actionID:"shiftTab",keyBinding:new c(9,null,!0),predefined:!0});d.push({actionID:"enter",keyBinding:new c(13),predefined:!0});d.push({actionID:"enter",keyBinding:new c(13,null,!0),predefined:!0});d.push({actionID:"selectAll",keyBinding:new c("a",!0),predefined:!0});d.push({actionID:"toggleTabMode",keyBinding:new c("m",!0),predefined:!0});l.isMac&&(d.push({actionID:"deleteNext",keyBinding:new c(46,null,!0),predefined:!0}),d.push({actionID:"deleteWordPrevious",keyBinding:new c(8,null,null,!0),
predefined:!0}),d.push({actionID:"deleteWordNext",keyBinding:new c(46,null,null,!0),predefined:!0}));d.push({actionID:"toggleWrapMode",keyBinding:new g.KeyBinding("w",!0,!1,!0)});d.push({actionID:"toggleOverwriteMode",keyBinding:new g.KeyBinding(45)});if(!l.isFirefox){var b=l.isMac&&l.isChrome;d.push({actionID:"noop",keyBinding:new c("u",!b,!1,!1,b),predefined:!0});d.push({actionID:"noop",keyBinding:new c("i",!b,!1,!1,b),predefined:!0});d.push({actionID:"noop",keyBinding:new c("b",!b,!1,!1,b),predefined:!0})}l.isFirefox&&
(d.push({actionID:"copy",keyBinding:new c(45,!0),predefined:!0}),d.push({actionID:"paste",keyBinding:new c(45,null,!0),predefined:!0}),d.push({actionID:"cut",keyBinding:new c(46,null,!0),predefined:!0}));l.isMac&&(d.push({actionID:"lineStart",keyBinding:new c("a",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new c("e",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"lineUp",keyBinding:new c("p",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"lineDown",keyBinding:new c("n",!1,!1,
!1,!0),predefined:!0}),d.push({actionID:"charPrevious",keyBinding:new c("b",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"charNext",keyBinding:new c("f",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deletePrevious",keyBinding:new c("h",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deleteNext",keyBinding:new c("d",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deleteLineEnd",keyBinding:new c("k",!1,!1,!1,!0),predefined:!0}),l.isFirefox?(d.push({actionID:"scrollPageDown",keyBinding:new c("v",!1,
!1,!1,!0),predefined:!0}),d.push({actionID:"deleteLineStart",keyBinding:new c("u",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deleteWordPrevious",keyBinding:new c("w",!1,!1,!1,!0),predefined:!0})):(d.push({actionID:"pageDown",keyBinding:new c("v",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"centerLine",keyBinding:new c("l",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"enterNoCursor",keyBinding:new c("o",!1,!1,!1,!0),predefined:!0})));return d};return{KeyMode:i,DefaultKeyMode:f}});
define("orion/editor/util",[],function(){return{contains:function(g,l){if(!l)return!1;if(!g.compareDocumentPosition){for(var i=l;i;){if(g===i)return!0;i=i.parentNode}return!1}return g===l||(g.compareDocumentPosition(l)&16)!==0},addEventListener:function(g,l,i,f){typeof g.addEventListener==="function"?g.addEventListener(l,i,f===!0):g.attachEvent("on"+l,i)},removeEventListener:function(g,l,i,f){typeof g.removeEventListener==="function"?g.removeEventListener(l,i,f===!0):g.detachEvent("on"+l,i)}}});
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(g,l,i,f,c,d,b){function h(a,c,e){if(e){c.className="";for(var e=c.attributes,d=e.length;d-- >0;)(!b.isIE||b.isIE>=9||b.isIE<9&&e[d].specified)&&c.removeAttribute(e[d].name)}if(a){if(a.styleClass)c.className=a.styleClass;if(e=a.style)for(var f in e)e.hasOwnProperty(f)&&(c.style[f]=e[f]);if(a=a.attributes)for(var h in a)a.hasOwnProperty(h)&&
c.setAttribute(h,a[h])}}function k(a){return a instanceof Array?a.slice(0):a}function e(a,b){if(!a)return b;if(!b)return a;for(var c in b)b.hasOwnProperty(c)&&(a.hasOwnProperty(c)||(a[c]=b[c]));return a}function a(b,c){if(b===c)return!0;if(b&&!c||!b&&c)return!1;if(b&&b.constructor===String||c&&c.constructor===String)return!1;if(b instanceof Array||c instanceof Array){if(!(b instanceof Array&&c instanceof Array))return!1;if(b.length!==c.length)return!1;for(var e=0;e<b.length;e++)if(!a(b[e],c[e]))return!1;
return!0}if(!(b instanceof Object)||!(c instanceof Object))return!1;for(e in b)if(b.hasOwnProperty(e)){if(!c.hasOwnProperty(e))return!1;if(!a(b[e],c[e]))return!1}for(e in c)if(!b.hasOwnProperty(e))return!1;return!0}function j(a,b,c){for(var e=0,d=0,f=0,h=a.length;f<h;){e!==-1&&e<=f&&(e=a.indexOf("\r",f));d!==-1&&d<=f&&(d=a.indexOf("\n",f));var j=f,g;if(d===-1&&e===-1){b(a.substring(f));break}e!==-1&&d!==-1?e+1===d?(g=e,f=d+1):(g=e<d?e:d,f=(e<d?e:d)+1):e!==-1?(g=e,f=e+1):(g=d,f=d+1);b(a.substring(j,
g));c()}}function p(a){var b,c,e,d,f=a.ownerDocument.defaultView||a.ownerDocument.parentWindow;if(f.getComputedStyle)a=f.getComputedStyle(a,null),b=a.getPropertyValue("padding-left"),c=a.getPropertyValue("padding-top"),e=a.getPropertyValue("padding-right"),d=a.getPropertyValue("padding-bottom");else if(a.currentStyle)b=a.currentStyle.paddingLeft,c=a.currentStyle.paddingTop,e=a.currentStyle.paddingRight,d=a.currentStyle.paddingBottom;return{left:parseInt(b,10)||0,top:parseInt(c,10)||0,right:parseInt(e,
10)||0,bottom:parseInt(d,10)||0}}function m(a){var b,c,e,d,f=a._trim;if(!f){var f=p(a),h=a.ownerDocument.defaultView||a.ownerDocument.parentWindow;if(h.getComputedStyle)d=h.getComputedStyle(a,null),b=d.getPropertyValue("border-left-width"),c=d.getPropertyValue("border-top-width"),e=d.getPropertyValue("border-right-width"),d=d.getPropertyValue("border-bottom-width");else if(a.currentStyle)b=a.currentStyle.borderLeftWidth,c=a.currentStyle.borderTopWidth,e=a.currentStyle.borderRightWidth,d=a.currentStyle.borderBottomWidth;
b=parseInt(b,10)||0;c=parseInt(c,10)||0;e=parseInt(e,10)||0;d=parseInt(d,10)||0;f.left+=b;f.top+=c;f.right+=e;f.bottom+=d;a._trim=f}return f}function n(a,b,c){this.start=a;this.end=b;this.caret=c}function s(a){this.left=a.left;this.top=a.top;this.right=a.right;this.bottom=a.bottom}function q(a,b,c){this.view=a;this.lineIndex=b;this._lineDiv=c}function t(a){this._init(a||{})}var v=d.addEventListener,x=d.removeEventListener,u=function(){function a(b){this.options=b}a.prototype.play=function(){var a=
typeof this.options.duration==="number"?this.options.duration:350,b=this.options.easing||this.defaultEasing,c=this.options.onAnimate||function(){},e=this.options.curve[0],d=this.options.curve[1],f=d-e,o=-1,h,j=this;this.interval=this.options.window.setInterval(function(){o=o===-1?(new Date).getTime():o;var g=((new Date).getTime()-o)/a;g<1?(g=b(g),h=e+g*f,c(h)):(c(d),j.stop())},typeof this.options.rate==="number"?this.options.rate:20)};a.prototype.stop=function(){this.options.window.clearInterval(this.interval);
(this.options.onEnd||function(){})()};a.prototype.defaultEasing=function(a){return Math.sin(a*(Math.PI/2))};return a}();n.prototype={clone:function(){return new n(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;if(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="+this.start+" end="+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="+this.left+", t="+this.top+", r="+this.right+", b="+this.bottom+"}"}};q.prototype={create:function(a,b){if(!this._lineDiv){var c=this._lineDiv=this._createLine(a,b,this.lineIndex);c._line=
this;return c}},_createLine:function(c,e,d){var f=this.view,j=f._model,g=j.getLine(d),k=j.getLineStart(d),p={type:"LineStyle",textView:f,lineIndex:d,lineText:g,lineStart:k};if(g.length<2E3)f.onLineStyle(p);j=e||b.createElement(c.ownerDocument,"div");if(!e||!a(e.viewStyle,p.style)){h(p.style,j,e);if(e)e._trim=null;j.viewStyle=p.style;j.setAttribute("role","presentation")}j.lineIndex=d;d=[];this._createRanges(p.ranges,g,0,g.length,k,{tabOffset:0,ranges:d});g=" ";!f._fullSelection&&b.isIE<9&&(g="\ufeff");
b.isWebkit&&(g="\u200c");p={text:g,style:f._metrics.largestFontStyle,ignoreChars:1};d.length===0||!d[d.length-1].style||d[d.length-1].style.tagName!=="div"?d.push(p):d.splice(d.length-1,0,p);var i,n,m,l,q,g=f=0,s,t;if(e){if(n=e.modelChangedEvent)n.removedLineCount===0&&n.addedLineCount===0?(t=n.start-k,s=n.addedCharCount-n.removedCharCount):t=-1,e.modelChangedEvent=void 0;n=e.firstChild}for(k=0;k<d.length;k++){p=d[k];l=p.text;f+=l.length;i=p.style;if(n)if(q=n.firstChild.data,m=n.viewStyle,q===l&&
a(i,m)){g+=q.length;n._rectsCache=void 0;i=n=n.nextSibling;continue}else for(;n;){if(t!==-1){m=f;m>=t&&(m-=s);q=(q=n.firstChild.data)?q.length:0;if(g+q>m)break;g+=q}m=n.nextSibling;j.removeChild(n);n=m}i=this._createSpan(j,l,i,p.ignoreChars);n?j.insertBefore(i,n):j.appendChild(i);if(e)e.lineWidth=void 0}if(e)for(c=i?i.nextSibling:null;c;)m=c.nextSibling,e.removeChild(c),c=m;else c.appendChild(j);return j},_createRanges:function(b,c,e,d,f,h){if(!(e>d)){if(b)for(var j=0;j<b.length;j++){var g=b[j];if(!(g.end<
f+e)){var k=Math.max(f+e,g.start)-f;if(k>d)break;var p=Math.min(f+d,g.end)-f;if(k<=p){k=Math.max(e,k);p=Math.min(d,p);e<k&&this._createRange(c,e,k,null,h);if(!g.style||!g.style.unmergeable)for(;j+1<b.length&&b[j+1].start-f===p&&a(g.style,b[j+1].style);)g=b[j+1],p=Math.min(f+d,g.end)-f,j++;this._createRange(c,k,p,g.style,h);e=p}}}e<d&&this._createRange(c,e,d,null,h)}},_createRange:function(a,b,c,e,d){if(!(b>c)){var f=this.view._customTabSize;if(f&&f!==8)for(var h=a.indexOf("\t",b);h!==-1&&h<c;){b<
h&&(b={text:a.substring(b,h),style:e},d.ranges.push(b),d.tabOffset+=b.text.length);b=f-d.tabOffset%f;if(b>0){for(var j="\u00a0",g=1;g<b;g++)j+=" ";b={text:j,style:e,ignoreChars:b-1};d.ranges.push(b);d.tabOffset+=b.text.length}b=h+1;if(b===c)return;h=a.indexOf("\t",b)}b<=c&&(b={text:a.substring(b,c),style:e},d.ranges.push(b),d.tabOffset+=b.text.length)}},_createSpan:function(a,c,e,d){var f=this.view,j="span";e&&e.tagName&&(j=e.tagName.toLowerCase());var g=j==="a";if(g)a.hasLink=!0;g&&!f._linksVisible&&
(j="span");g=a.ownerDocument;a=b.createElement(a.ownerDocument,j);e&&e.html?(a.innerHTML=e.html,a.ignore=!0):e&&e.node?(a.appendChild(e.node),a.ignore=!0):a.appendChild(g.createTextNode(e&&e.text?e.text:c));h(e,a);if(j==="a"){var k=f._getWindow();v(a,"click",function(a){return f._handleLinkClick(a?a:k.event)},!1)}a.viewStyle=e;if(d)a.ignoreChars=d;return a},_ensureCreated:function(){return this._lineDiv?this._lineDiv:this._createdDiv=this.create(this.view._clientDiv,null)},getBoundingClientRect:function(a,
c){var e=this._ensureCreated(),d=this.view;if(a===void 0)return this._getLineBoundingClientRect(e,!0);var f=d._model,h=e.ownerDocument,j=this.lineIndex,g=null;if(a<f.getLineEnd(j)){j=f.getLineStart(j);for(f=e.firstChild;f;){if(!f.ignore){var k=f.firstChild,p=k.length;f.ignoreChars&&(p-=f.ignoreChars);if(j+p>a){g=a-j;if(k.length===1)g=new s(f.getBoundingClientRect());else if(d._isRangeRects)h=h.createRange(),h.setStart(k,g),h.setEnd(k,g+1),g=new s(h.getBoundingClientRect());else if(b.isIE){if(h=h.body.createTextRange(),
h.moveToElementText(f),h.collapse(),(j=g===0&&b.isIE===8)&&(g=1),h.moveEnd("character",g+1),h.moveStart("character",g),g=new s(h.getBoundingClientRect()),j)g.left=f.getClientRects()[0].left}else{var i=k.data;f.removeChild(k);f.appendChild(h.createTextNode(i.substring(0,g)));var n=b.createElement(h,"span");n.appendChild(h.createTextNode(i.substring(g,g+1)));f.appendChild(n);f.appendChild(h.createTextNode(i.substring(g+1)));g=new s(n.getBoundingClientRect());f.innerHTML="";f.appendChild(k);this._createdDiv||
(h=d._getSelection(),(j<=h.start&&h.start<j+p||j<=h.end&&h.end<j+p)&&d._updateDOMSelection())}b.isIE&&(h=e.ownerDocument.defaultView||e.ownerDocument.parentWindow,e=h.screen.logicalXDPI/h.screen.deviceXDPI,h=h.screen.logicalYDPI/h.screen.deviceYDPI,g.left*=e,g.right*=e,g.top*=h,g.bottom*=h);break}j+=p}f=f.nextSibling}}e=this.getBoundingClientRect();if(!g)d._wrapMode?(d=this.getClientRects(),g=d[d.length-1],g.left=g.right,g.left+=e.left,g.top+=e.top,g.right+=e.left,g.bottom+=e.top):(g=new s(e),g.left=
g.right);if(c||c===void 0)g.left-=e.left,g.top-=e.top,g.right-=e.left,g.bottom-=e.top;return g},_getClientRects:function(a,b){var c,e,d,f;if(!a._rectsCache){c=a.getClientRects();e=Array(c.length);for(f=0;f<c.length;f++)d=e[f]=new s(c[f]),d.left-=b.left,d.top-=b.top,d.right-=b.left,d.bottom-=b.top;a._rectsCache=e}c=a._rectsCache;e=[c.length];for(f=0;f<c.length;f++)e[f]=new s(c[f]);return e},getClientRects:function(a){if(!this.view._wrapMode)return[this.getBoundingClientRect()];for(var b=this._ensureCreated(),
c=[],e=b.firstChild,d,f=b.getBoundingClientRect();e;){if(!e.ignore)for(var h=this._getClientRects(e,f),b=0;b<h.length;b++){var j=h[b],g;if(j.top!==j.bottom){var k=j.top+(j.bottom-j.top)/2;for(g=0;g<c.length;g++)if(d=c[g],d.top<=k&&k<d.bottom)break;if(g===c.length)c.push(j);else{if(j.left<d.left)d.left=j.left;if(j.top<d.top)d.top=j.top;if(j.right>d.right)d.right=j.right;if(j.bottom>d.bottom)d.bottom=j.bottom}}}e=e.nextSibling}return a!==void 0?c[a]:c},_getLineBoundingClientRect:function(a,b){var c=
new s(a.getBoundingClientRect());if(!this.view._wrapMode){c.right=c.left;for(var e=a.lastChild;e&&e.ignoreChars===e.firstChild.length;)e=e.previousSibling;if(e)e=e.getBoundingClientRect(),c.right=e.right+m(a).right}b&&(e=m(a),c.left+=e.left,c.right-=e.right);return c},getLineCount:function(){return!this.view._wrapMode?1:this.getClientRects().length},getLineIndex:function(a){if(!this.view._wrapMode)return 0;for(var b=this.getClientRects(),a=this.getBoundingClientRect(a),a=a.top+(a.bottom-a.top)/2,
c=0;c<b.length;c++)if(b[c].top<=a&&a<b[c].bottom)return c;return b.length-1},getLineStart:function(a){if(!this.view._wrapMode||a===0)return this.view._model.getLineStart(a);var b=this.getClientRects();return this.getOffset(b[a].left+1,b[a].top+1)},getOffset:function(a,c){var e=this.view,d=e._model,f=this.lineIndex,h=d.getLineStart(f),j=d.getLineEnd(f);if(h===j)return h;var g=this._ensureCreated(),k=this.getBoundingClientRect(),p,i;if(e._wrapMode){p=this.getClientRects();if(c<p[0].top)c=p[0].top;for(var n=
0;n<p.length;n++)if(i=p[n],i.top<=c&&c<i.bottom)break;if(a<i.left)a=i.left;a>i.right&&(a=i.right-1)}else a<0&&(a=0),a>k.right-k.left&&(a=k.right-k.left);var m=g.ownerDocument,n=m.defaultView||m.parentWindow,l=b.isIE?n.screen.logicalXDPI/n.screen.deviceXDPI:1,q=b.isIE?n.screen.logicalYDPI/n.screen.deviceYDPI:1,n=h,s=g.firstChild;a:for(;s;){if(!s.ignore){var t=s.firstChild,g=t.length;s.ignoreChars&&(g-=s.ignoreChars);var v,x,u;p=this._getClientRects(s,k);for(var M=0;M<p.length;M++)if(i=p[M],i.left<=
a&&a<i.right&&(!e._wrapMode||i.top<=c&&c<i.bottom)){var M=i.left+k.left,F;if(b.isIE||e._isRangeRects){for(var m=e._isRangeRects?m.createRange():m.body.createTextRange(),I=g,P=-1;I-P>1;){var V=Math.floor((I+P)/2);p=P+1;i=V===g-1&&s.ignoreChars?t.length:V+1;F=p===0&&b.isIE===8;e._isRangeRects?(m.setStart(t,p),m.setEnd(t,i)):(F&&(p=1),m.moveToElementText(s),m.move("character",p),m.moveEnd("character",i-p));p=m.getClientRects();for(var S=!1,T=0;T<p.length;T++)if(i=p[T],v=(F?M:i.left)*l-k.left,u=i.right*
l-k.left,x=i.top*q-k.top,i=i.bottom*q-k.top,v<=a&&a<u&&(!e._wrapMode||x<=c&&c<i)){S=!0;break}S?I=V:P=V}n+=I;p=I;i=I===g-1&&s.ignoreChars?t.length:Math.min(I+1,t.length);e._isRangeRects?(m.setStart(t,p),m.setEnd(t,i)):(m.moveToElementText(s),m.move("character",p),m.moveEnd("character",i-p));p=m.getClientRects();e=!1;p.length>0&&(i=p[0],v=(F?M:i.left)*l-k.left,u=i.right*l-k.left,e=a>v+(u-v)/2);k=n-h;d=d.getLine(f);f=d.charCodeAt(k);55296<=f&&f<=56319&&e?k<d.length&&(f=d.charCodeAt(k+1),56320<=f&&f<=
57343&&(n+=1)):56320<=f&&f<=57343&&!e&&k>0&&(f=d.charCodeAt(k-1),55296<=f&&f<=56319&&(n-=1));e&&n++}else{d=[];for(f=0;f<g;f++)d.push("<span>"),f===g-1?d.push(t.data.substring(f)):d.push(t.data.substring(f,f+1)),d.push("</span>");s.innerHTML=d.join("");for(d=s.firstChild;d;){i=d.getBoundingClientRect();v=i.left-k.left;u=i.right-k.left;if(v<=a&&a<u){a>v+(u-v)/2&&n++;break}n++;d=d.nextSibling}if(!this._createdDiv)s.innerHTML="",s.appendChild(t),k=e._getSelection(),(n<=k.start&&k.start<n+g||n<=k.end&&
k.end<n+g)&&e._updateDOMSelection()}break a}n+=g}s=s.nextSibling}return Math.min(j,Math.max(h,n))},getNextOffset:function(a,c){if(c.unit==="line"){var e=this.view._model,d=e.getLineAtOffset(a);if(c.count>0)return c.count--,e.getLineEnd(d);c.count++;return e.getLineStart(d)}return c.unit==="wordend"||c.unit==="wordWS"||c.unit==="wordendWS"?this._getNextOffset_W3C(a,c):b.isIE?this._getNextOffset_IE(a,c):this._getNextOffset_W3C(a,c)},_getNextOffset_W3C:function(a,b){function c(a){return 33<=a&&a<=47||
58<=a&&a<=64||91<=a&&a<=94||a===96||123<=a&&a<=126}function e(a){return a===32||a===9}var d=this.view._model,f=d.getLineAtOffset(a),h=d.getLine(f),j=d.getLineStart(f),d=d.getLineEnd(f),f=h.length,g=a-j,k,p=b.count<0?-1:1;if(b.unit==="word"||b.unit==="wordend"||b.unit==="wordWS"||b.unit==="wordendWS")for(var i,n,m;b.count!==0;){if(b.count>0){if(g===f)return d;k=h.charCodeAt(g);i=c(k);n=!i&&!e(k);for(g++;g<f;){k=h.charCodeAt(g);if(b.unit!=="wordWS"&&b.unit!=="wordendWS"){m=c(k);if(b.unit==="wordend"){if(!m&&
i)break}else if(m&&!i)break;k=!m&&!e(k)}else k=!e(k);if(b.unit==="wordend"||b.unit==="wordendWS"){if(!k&&n)break}else if(k&&!n)break;n=k;i=m;g++}}else{if(g===0)return j;g--;k=h.charCodeAt(g);i=c(k);for(n=!i&&!e(k);0<g;){k=h.charCodeAt(g-1);if(b.unit!=="wordWS"&&b.unit!=="wordendWS"){m=c(k);if(b.unit==="wordend"){if(m&&!i)break}else if(!m&&i)break;k=!m&&!e(k)}else k=!e(k);if(b.unit==="wordend"||b.unit==="wordendWS"){if(k&&!n)break}else if(!k&&n)break;n=k;i=m;g--}}b.count-=p}else for(;b.count!==0&&
0<=g+p&&g+p<=f;)g+=p,k=h.charCodeAt(g),56320<=k&&k<=57343&&g>0&&(k=h.charCodeAt(g-1),55296<=k&&k<=56319&&(g+=p)),b.count-=p;return j+g},_getNextOffset_IE:function(a,b){var c=this._ensureCreated(),e=this.view._model,d=this.lineIndex,f=0,h;h=e.getLineStart(d);var j=c.ownerDocument,g=b.count<0?-1:1;if(a===e.getLineEnd(d)){for(c=c.lastChild;c&&c.ignoreChars===c.firstChild.length;)c=c.previousSibling;if(!c)return h;f=j.body.createTextRange();f.moveToElementText(c);h=f.text.length;f.moveEnd(b.unit,g);f=
a+f.text.length-h}else if(a===h&&b.count<0)f=h;else for(c=c.firstChild;c;){e=c.firstChild.length;c.ignoreChars&&(e-=c.ignoreChars);if(h+e>a){f=j.body.createTextRange();a===h&&b.count<0?f.moveToElementText(c.previousSibling):(f.moveToElementText(c),f.collapse(),f.moveEnd("character",a-h));h=f.text.length;f.moveEnd(b.unit,g);f=a+f.text.length-h;break}h=e+h;c=c.nextSibling}b.count-=g;return f},destroy:function(){var a=this._createdDiv;if(a)a.parentNode.removeChild(a),this._createdDiv=null}};t.prototype=
{addKeyMode:function(a,b){var c=this._keyModes;b!==void 0?c.splice(b,0,a):c.push(a);a._modeAdded&&a._modeAdded()},addRuler:function(a,b){a.setView(this);var c=this._rulers;if(b!==void 0){var e,d;for(e=0,d=0;e<c.length&&d<b;e++)a.getLocation()===c[e].getLocation()&&d++;c.splice(d,0,a);b=d}else c.push(a);this._createRuler(a,b);this._update()},computeSize:function(){var a=0,c=0,e=this._model,d=this._clientDiv;if(!d)return{width:a,height:c};var f=d.style.width;if(b.isWebkit)d.style.width="0x7fffffffpx";
for(var e=e.getLineCount(),h=0;h<e;h++){var j=this._getLine(h),g=j.getBoundingClientRect(),a=Math.max(a,g.right-g.left);c+=g.bottom-g.top;j.destroy()}if(b.isWebkit)d.style.width=f;d=this._getViewPadding();a+=d.right+d.left+this._metrics.scrollWidth;c+=d.bottom+d.top+this._metrics.scrollWidth;return{width:a,height:c}},convert:function(a,b,c){if(this._clientDiv){var e=this._getScroll(),d=this._getViewPadding(),f=this._viewDiv.getBoundingClientRect();b==="document"&&(a.x!==void 0&&(a.x+=-e.x+f.left+
d.left),a.y!==void 0&&(a.y+=-e.y+f.top+d.top));c==="document"&&(a.x!==void 0&&(a.x+=e.x-f.left-d.left),a.y!==void 0&&(a.y+=e.y-f.top-d.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._actions=this._keyModes=this._doubleClickSelection=this._selection=this._theme=this._model=this._parent=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=[],c=this._actions,e;for(e in c)c.hasOwnProperty(e)&&(a||!c[e].defaultHandler)&&b.push(e);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=[],c=this._keyModes,e=0;e<c.length;e++)b=b.concat(c[e].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()),b=b.getLineAtOffset(a),c=this._getLine(b),a=c.getBoundingClientRect(a);c.destroy();c=a.left;b=this._getLinePixel(b)+a.top;return{x:c,y:b}},getNextOffset:function(a,b){var c=new n(a,a,!1);this._doMove(b,c);return c.getCaret()},
getOptions:function(){var a;if(arguments.length===0)a=this._defaultOptions();else if(arguments.length===1){if(a=arguments[0],typeof a==="string")return k(this["_"+a])}else{a={};for(var b in arguments)arguments.hasOwnProperty(b)&&(a[arguments[b]]=void 0)}for(var c in a)a.hasOwnProperty(c)&&(a[c]=k(this["_"+c]));return a},getModel:function(){return this._model},getOffsetAtLocation:function(a,b){if(!this._clientDiv)return 0;var c=this._getLineIndex(b),e=this._getLine(c),c=e.getOffset(a,b-this._getLinePixel(c));
e.destroy();return c},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,c){if(this._clientDiv){if(a=this._actions[a]){if(!b&&a.handler&&a.handler(c))return!0;if(a.defaultHandler)return typeof a.defaultHandler(c)===
"boolean"}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(!(this._redrawCount>0)){var a=this._model.getLineCount();this.redrawRulers(0,a);this.redrawLines(0,a)}},redrawRulers:function(a,
b){if(!(this._redrawCount>0))for(var c=this.getRulers(),e=0;e<c.length;e++)this.redrawLines(a,b,c[e])},redrawLines:function(a,b,c){if(!(this._redrawCount>0)&&(a===void 0&&(a=0),b===void 0&&(b=this._model.getLineCount()),a!==b)){var e=this._clientDiv;if(e){if(c)for(e=this._getRulerParent(c).firstChild;e;){if(e._ruler===c)break;e=e.nextSibling}c?e.rulerChanged=!0:this._lineHeight&&this._resetLineHeight(a,b);if(!c||c.getOverview()==="page")for(e=e.firstChild;e;){var d=e.lineIndex;if(a<=d&&d<b)e.lineChanged=
!0;e=e.nextSibling}if(!c&&!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(!(this._redrawCount>0)){var c=this._model;a===void 0&&(a=0);b===void 0&&(b=c.getCharCount());var e=c.getLineAtOffset(a),c=c.getLineAtOffset(Math.max(a,b-1))+1;this.redrawLines(e,c)}},removeKeyMode:function(a){for(var b=this._keyModes,c=0;c<b.length;c++)if(b[c]===a){b.splice(c,
1);break}a._modeRemoved&&a._modeRemoved()},removeRuler:function(a){for(var b=this._rulers,c=0;c<b.length;c++)if(b[c]===a){b.splice(c,1);a.setView(null);this._destroyRuler(a);this._update();break}},resize:function(){this._clientDiv&&this._handleResize(null)},setAction:function(a,b,c){if(a){var e=this._actions,d=e[a];d||(d=e[a]={});d.handler=b;if(c!==void 0)d.actionDescription=c}},setKeyBinding:function(a,b){this._keyModes[0].setKeyBinding(a,b)},setCaretOffset:function(a,b,c){var e=this._model.getCharCount(),
a=Math.max(0,Math.min(a,e));this._setSelection(new n(a,a,!1),b===void 0||b,!0,c)},setHorizontalPixel:function(a){this._clientDiv&&(a=Math.max(0,a),this._scrollView(a-this._getScroll().x,0))},setRedraw:function(a){a?--this._redrawCount===0&&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(),
c=this._model.getCharCount(),e=a.getLineCount(),d=a.getCharCount(),f={type:"ModelChanging",text:a.getText(),start:0,removedCharCount:c,addedCharCount:d,removedLineCount:b,addedLineCount:e};this.onModelChanging(f);this._model=a;f={type:"ModelChanged",start:0,removedCharCount:c,addedCharCount:d,removedLineCount:b,addedLineCount:e};this.onModelChanged(f);this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);
this._reset();this._update()}},setOptions:function(b){var c=this._defaultOptions(),e;for(e in b)if(b.hasOwnProperty(e)){var d=b[e];if(!a(this["_"+e],d)){var f=c[e]?c[e].update:null;f?f.call(this,d):this["_"+e]=k(d)}}},setSelection:function(a,b,c,e){var d=a>b;if(d)var f=a,a=b,b=f;f=this._model.getCharCount();a=Math.max(0,Math.min(a,f));b=Math.max(0,Math.min(b,f));this._setSelection(new n(a,b,d),c===void 0||c,!0,e)},setText:function(a,c,e){var d=c===void 0&&e===void 0;c===void 0&&(c=0);e===void 0&&
(e=this._model.getCharCount());if(d)this._variableLineHeight=!1;this._modifyContent({text:a,start:c,end:e,_code:!0},!d);if(d)this._columnX=-1,this._setSelection(new n(0,0,!1),!0),b.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(){return this._showCaret(!0)},update:function(a,b){this._clientDiv&&
(a&&this._updateStyle(),b===void 0||b?this._update():this._queueUpdate())},_handleRootMouseDown:function(a){if(!this._ignoreEvent(a)){if(b.isFirefox&&a.which===1)this._clientDiv.contentEditable=!1,this._ignoreBlur=(this._overlayDiv||this._clientDiv).draggable=!0;var c=this._overlayDiv||this._clientDiv;if(b.isIE<9)c=this._viewDiv;for(var e=a.target?a.target:a.srcElement;e;){if(c===e)return;e=e.parentNode}a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();if(!this._isW3CEvents){var d=
this;this._getWindow().setTimeout(function(){d._clientDiv.focus()},0)}}},_handleRootMouseUp:function(a){if(!this._ignoreEvent(a)&&b.isFirefox&&a.which===1)this._clientDiv.contentEditable=!0,(this._overlayDiv||this._clientDiv).draggable=!1,this._fixCaret(),this._ignoreBlur=!1},_handleBlur:function(){if(!this._ignoreBlur){this._hasFocus=!1;if(b.isIE<9&&!this._getSelection().isEmpty()){var a=this._rootDiv,c=b.createElement(a.ownerDocument,"div");a.appendChild(c);a.removeChild(c)}if(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(),c=this._selDiv1.ownerDocument,a.getSelection){c=a.getSelection();for(a=c.anchorNode;a;){if(a===this._clientDiv){c.rangeCount>0&&c.removeAllRanges();break}a=a.parentNode}}else if(c.selection){this._ignoreSelect=!1;for(a=c.selection.createRange().parentElement();a;){if(a===this._clientDiv){c.selection.empty();break}a=a.parentNode}this._ignoreSelect=
!0}if(!this._ignoreFocus)this.onBlur({type:"Blur"})}},_handleContextMenu:function(a){if(!this._ignoreEvent(a)){b.isIE&&this._lastMouseButton===3&&this._updateDOMSelection();var c=!1;this.isListening("ContextMenu")?(c=this._createMouseEvent("ContextMenu",a),c.screenX=a.screenX,c.screenY=a.screenY,this.onContextMenu(c),c=c.defaultPrevented):b.isMac&&b.isFirefox&&a.button===0&&(c=!0);if(c)return a.preventDefault&&a.preventDefault(),!1}},_handleCopy:function(a){if(!this._ignoreEvent(a)&&!this._ignoreCopy&&
this._doCopy(a))return a.preventDefault&&a.preventDefault(),!1},_handleCut:function(a){if(!this._ignoreEvent(a)&&this._doCut(a))return a.preventDefault&&a.preventDefault(),!1},_handleDataModified:function(a){this._ignoreEvent(a)||this._startIME()},_handleDblclick:function(a){if(!this._ignoreEvent(a)&&(this._lastMouseTime=a.timeStamp?a.timeStamp:(new Date).getTime(),this._clickCount!==2))this._clickCount=2,this._handleMouse(a)},_handleDragStart:function(a){if(!this._ignoreEvent(a)){if(b.isFirefox){var c=
this;this._getWindow().setTimeout(function(){c._clientDiv.contentEditable=!0;c._clientDiv.draggable=!1;c._ignoreBlur=!1},0)}if(this.isListening("DragStart")&&this._dragOffset!==-1)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));b.isFirefox&&(this._fixCaret(),a.dataTransfer.dropEffect==="none"&&!a.dataTransfer.mozUserCancelled&&this._fixCaret())}},_handleDragEnter:function(a){if(!this._ignoreEvent(a)){var c=!0;this._dropTarget=!0;this.isListening("DragEnter")&&(c=!1,this.onDragEnter(this._createMouseEvent("DragEnter",a)));if(b.isWebkit||c)return a.preventDefault&&a.preventDefault(),!1}},_handleDragOver:function(a){if(!this._ignoreEvent(a)){var c=
!0;this.isListening("DragOver")&&(c=!1,this.onDragOver(this._createMouseEvent("DragOver",a)));if(b.isWebkit||c){if(c)a.dataTransfer.dropEffect="none";a.preventDefault&&a.preventDefault();return!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(){this._hasFocus=!0;b.isIOS&&this._lastTouchOffset!==void 0?(this.setCaretOffset(this._lastTouchOffset,!0),this._lastTouchOffset=void 0):this._updateDOMSelection();if(this._cursorDiv)this._cursorDiv.style.display="block";if(this._selDiv1){var 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){if(!this._ignoreEvent(a)){if(this.isListening("KeyDown")){var c=
this._createKeyEvent("KeyDown",a);this.onKeyDown(c);if(c.defaultPrevented){if(b.isFirefox)this._keyDownPrevented=!0;a.preventDefault();return}}c=!1;switch(a.keyCode){case 16:case 17:case 18:case 91:c=!0;break;default:this._setLinksVisible(!1)}if(a.keyCode===229){if(this._readonly)return a.preventDefault&&a.preventDefault(),!1;c=!0;if(b.isSafari&&b.isMac&&a.ctrlKey)c=!1,a.keyCode=129;c&&this._startIME()}else c||this._commitIME();if((b.isMac||b.isLinux)&&b.isFirefox<4||b.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(b.isMac&&b.isWebkit&&(63232<=a.keyCode&&a.keyCode<=63487||a.keyCode===13||a.keyCode===8))return a.preventDefault&&a.preventDefault(),!1;if(((b.isMac||b.isLinux)&&b.isFirefox<4||b.isOpera)&&
this._doAction(this._keyDownEvent))return a.preventDefault&&a.preventDefault(),!1;var c=b.isMac?a.metaKey:a.ctrlKey;if(a.charCode!==void 0&&c)switch(a.charCode){case 99:case 118:case 120:return!0}if(this.isListening("KeyPress")&&(c=this._createKeyEvent("KeyPress",a),this.onKeyPress(c),c.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;c=!1;if(b.isMac){if(a.ctrlKey||
a.metaKey)c=!0}else if(b.isFirefox){if(a.ctrlKey||a.altKey)c=!0}else a.ctrlKey^a.altKey&&(c=!0);if(!c&&(c=b.isOpera?a.which:a.charCode!==void 0?a.charCode:a.keyCode,c>31))return this._doContent(String.fromCharCode(c)),a.preventDefault&&a.preventDefault(),!1}},_handleDocKeyUp:function(a){(b.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);a.keyCode===13&&this._commitIME()}},_handleLinkClick:function(a){if(!(b.isMac?a.metaKey:a.ctrlKey))return a.preventDefault&&a.preventDefault(),!1},_handleMouse:function(a){var c=this._getWindow(),e=!0,d=c;if(b.isIE||b.isFirefox&&!this._overlayDiv)d=this._clientDiv;if(this._overlayDiv){if(this._hasFocus)this._ignoreFocus=!0;var f=this;c.setTimeout(function(){f.focus();f._ignoreFocus=!1},0)}this._clickCount===1?(e=this._setSelectionTo(a.clientX,a.clientY,a.shiftKey,!b.isOpera&&
this._hasFocus&&this.isListening("DragStart")))&&this._setGrab(d):(this._isW3CEvents&&this._setGrab(d),this._doubleClickSelection=null,this._setSelectionTo(a.clientX,a.clientY,a.shiftKey),this._doubleClickSelection=this._getSelection());return e},_handleMouseDown:function(a){if(!this._ignoreEvent(a)){if(this._linksVisible)if((a.target||a.srcElement).tagName!=="A")this._setLinksVisible(!1);else return;this._commitIME();var c=a.which;c||(a.button===4&&(c=2),a.button===2&&(c=3),a.button===1&&(c=1));
var e=c!==2&&a.timeStamp?a.timeStamp:(new Date).getTime(),d=e-this._lastMouseTime,f=Math.abs(this._lastMouseX-a.clientX),h=Math.abs(this._lastMouseY-a.clientY),j=this._lastMouseButton===c;this._lastMouseX=a.clientX;this._lastMouseY=a.clientY;this._lastMouseTime=e;this._lastMouseButton=c;if(c===1)this._isMouseDown=!0,j&&d<=this._clickTime&&f<=this._clickDist&&h<=this._clickDist?this._clickCount++:this._clickCount=1;if(this.isListening("MouseDown")&&(e=this._createMouseEvent("MouseDown",a),this.onMouseDown(e),
e.defaultPrevented)){a.preventDefault();return}if(c===1&&this._handleMouse(a)&&(b.isIE>=9||b.isOpera||b.isChrome||b.isSafari||b.isFirefox&&!this._overlayDiv))this._hasFocus||this.focus(),a.preventDefault();b.isFirefox&&this._lastMouseButton===3&&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 c=this._isClientDiv(a);if(this.isListening("MouseMove")&&c)this.onMouseMove(this._createMouseEvent("MouseMove",a));if(!this._dropTarget){var e=this._linksVisible||this._lastMouseMoveX!==a.clientX||this._lastMouseMoveY!==a.clientY;this._lastMouseMoveX=a.clientX;this._lastMouseMoveY=a.clientY;this._setLinksVisible(e&&!this._isMouseDown&&(b.isMac?a.metaKey:a.ctrlKey));
if(!this._isW3CEvents){if(a.button===0)return this._setGrab(null),!0;if(!this._isMouseDown&&a.button===1&&(this._clickCount&1)!==0&&c)return this._clickCount=2,this._handleMouse(a,this._clickCount)}if(this._isMouseDown&&this._dragOffset===-1){var c=a.clientX,a=a.clientY,d=this._getViewPadding(),f=this._viewDiv.getBoundingClientRect(),h=this._getClientWidth(),j=this._getClientHeight(),e=f.left+d.left,g=f.top+d.top,h=f.left+d.left+h,d=f.top+d.top+j;a<g?this._doAutoScroll("up",c,a-g):a>d?this._doAutoScroll("down",
c,a-d):c<e&&!this._wrapMode?this._doAutoScroll("left",c-e,a):c>h&&!this._wrapMode?this._doAutoScroll("right",c-h,a):(this._endAutoScroll(),this._setSelectionTo(c,a,!0))}}}},_isClientDiv:function(a){for(var b=this._overlayDiv||this._clientDiv,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 c=this.convert({x:b.clientX,y:b.clientY},
"page","document");return{type:a,event:b,clickCount:this._clickCount,x:c.x,y:c.y,preventDefault:function(){this.defaultPrevented=!0}}},_handleMouseUp:function(a){var c=a.which?a.button===0:a.button===1;if(this.isListening("MouseUp")&&(this._isClientDiv(a)||c&&this._isMouseDown))this.onMouseUp(this._createMouseEvent("MouseUp",a));if(!this._linksVisible&&c&&this._isMouseDown){if(this._dragOffset!==-1)c=this._getSelection(),c.extend(this._dragOffset),c.collapse(),this._setSelection(c,!0,!0),this._dragOffset=
-1;this._isMouseDown=!1;this._endAutoScroll();this._isW3CEvents&&this._setGrab(null);b.isFirefox&&a.preventDefault()}},_handleMouseWheel:function(a){var c=this._getLineHeight(),e=0,d=0;b.isIE||b.isOpera?d=-a.wheelDelta/40*c:b.isFirefox?(c=b.isMac?a.detail*3:Math.max(-256,Math.min(256,a.detail))*c,a.axis===a.HORIZONTAL_AXIS?e=c:d=c):b.isMac?(d=a.timeStamp-this._wheelTimeStamp,this._wheelTimeStamp=a.timeStamp,e=a.wheelDeltaX%120!==0?1:d<40?40/(40-d):40,d=a.wheelDeltaY%120!==0?1:d<40?40/(40-d):40,e=
Math.ceil(-a.wheelDeltaX/e),-1<e&&e<0&&(e=-1),0<e&&e<1&&(e=1),d=Math.ceil(-a.wheelDeltaY/d),-1<d&&d<0&&(d=-1),0<d&&d<1&&(d=1)):(e=-a.wheelDeltaX,d=-a.wheelDeltaY/120*8*c);if(b.isSafari){for(c=a.target;c&&c.lineIndex===void 0;)c=c.parentNode;this._mouseWheelLine=c}c=this._getScroll();this._scrollView(e,d);e=this._getScroll();if(c.x!==e.x||c.y!==e.y)return a.preventDefault&&a.preventDefault(),!1},_handlePaste:function(a){if(!this._ignoreEvent(a)&&!this._ignorePaste&&this._doPaste(a)){if(b.isIE){var c=
this;this._ignoreFocus=!0;this._getWindow().setTimeout(function(){c._updateDOMSelection();c._ignoreFocus=!1},0)}a.preventDefault&&a.preventDefault();return!1}},_handleResize:function(){var c=this._parent.clientWidth,e=this._parent.clientHeight;if(this._parentWidth!==c||this._parentHeight!==e){this._parentWidth!==c&&this._wrapMode&&this._resetLineHeight();this._parentWidth=c;this._parentHeight=e;c=b.isIE<9;e=this._calculateMetrics();if(!a(e,this._metrics)){if(this._variableLineHeight)this._variableLineHeight=
!1,this._resetLineHeight();this._metrics=e;c=!0}c?this._queueUpdate():this._update()}},_handleRulerEvent:function(a){for(var b=a.target?a.target:a.srcElement,c=b.lineIndex;b&&!b._ruler;){if(c===void 0&&b.lineIndex!==void 0)c=b.lineIndex;b=b.parentNode}var e=b?b._ruler:null;if(c===void 0&&e&&e.getOverview()==="document"){var c=this._getClientHeight(),d=this._model.getLineCount(),f=this._getViewPadding(),h=this._viewDiv.getBoundingClientRect(),c=Math.floor((a.clientY-h.top-this._metrics.scrollWidth)*
d/(c+f.top+f.bottom-2*this._metrics.scrollWidth));0<=c&&c<d||(c=void 0)}if(e)switch(a.type){case "click":if(e.onClick)e.onClick(c,a);break;case "dblclick":if(e.onDblClick)e.onDblClick(c,a);break;case "mousemove":if(e.onMouseMove)e.onMouseMove(c,a);break;case "mouseover":if(e.onMouseOver)e.onMouseOver(c,a);break;case "mouseout":if(e.onMouseOut){for(d=a.relatedTarget;d&&d!==this._rootDiv;){if(d===b)return;d=d.parentNode}e.onMouseOut(c,a)}}},_handleScroll:function(){var a=this._getScroll(!1),b=this._hScroll,
c=this._vScroll;if(b!==a.x||c!==a.y)this._hScroll=a.x,this._vScroll=a.y,this._commitIME(),this._update(c===a.y),this.onScroll({type:"Scroll",oldValue:{x:b,y:c},newValue:a})},_handleSelectStart:function(a){if(this._ignoreSelect)return a&&a.preventDefault&&a.preventDefault(),!1},_getModelOffset:function(a,b){if(a){var c;c=a.tagName==="DIV"?a:a.parentNode.parentNode;var e=0,d=c.lineIndex;if(a.tagName!=="DIV")for(c=c.firstChild;c;){var f=c.firstChild;if(f===a){c.ignoreChars&&(e-=c.ignoreChars);e+=b;break}c.ignoreChars&&
(e-=c.ignoreChars);e+=f.data.length;c=c.nextSibling}return Math.max(0,e)+this._model.getLineStart(d)}},_updateSelectionFromDOM:function(){var a=this._getWindow().getSelection(),b=this._getModelOffset(a.anchorNode,a.anchorOffset),a=this._getModelOffset(a.focusNode,a.focusOffset);b===void 0||a===void 0||this._setSelection(new n(b,a),!1,!1)},_handleSelectionChange:function(){if(this._imeOffset===-1)if(b.isAndroid){var a=this._getWindow();this._selTimer&&a.clearTimeout(this._selTimer);var c=this;this._selTimer=
a.setTimeout(function(){if(c._clientDiv)c._selTimer=null,c._updateSelectionFromDOM()},250)}else this._updateSelectionFromDOM()},_handleTextInput:function(a){if(!this._ignoreEvent(a)){this._imeOffset=-1;if(b.isAndroid){for(var c=this._getWindow().getSelection(),e=c.anchorNode;e;){if(e.lineIndex!==void 0)break;e=e.parentNode}if(e){var d=this._model,f=e.lineIndex,h=d.getLine(f),j=h,g=0,d=d.getLineStart(f);if(c.rangeCount>0)c.getRangeAt(0).deleteContents(),f=e.ownerDocument.createTextNode(a.data),c.getRangeAt(0).insertNode(f),
g=this._getDOMText(e,f),j=g.text,g=g.offset,f.parentNode.removeChild(f);e.lineRemoved=!0;for(e=0;h.charCodeAt(e)===j.charCodeAt(e)&&e<g;)e++;c=h.length-1;for(f=j.length-h.length;h.charCodeAt(c)===j.charCodeAt(c+f)&&c+f>=g+a.data.length;)c--;c++;h=j.substring(e,c+f);e+=d;c+=d;this._modifyContent({text:h,start:e,end:c,_ignoreDOMSelection:!0},!0)}}else this._doContent(a.data);a.preventDefault()}},_handleTouchStart:function(a){this._commitIME();var c=this._getWindow();if(this._touchScrollTimer)this._vScrollDiv.style.display=
"none",this._hScrollDiv.style.display="none",c.clearInterval(this._touchScrollTimer),this._touchScrollTimer=null;var e=a.touches;if(e.length===1){var e=e[0],d=e.clientX,f=e.clientY;this._touchStartX=d;this._touchStartY=f;if(b.isAndroid&&(f<e.pageY-c.pageYOffset||d<e.pageX-c.pageXOffset))d=e.pageX-c.pageXOffset,f=e.pageY-c.pageYOffset;c=this.convert({x:d,y:f},"page","document");this._lastTouchOffset=this.getOffsetAtLocation(c.x,c.y);this._touchStartTime=a.timeStamp;this._touching=!0}},_handleTouchMove:function(a){var b=
a.touches;if(b.length===1){b=b[0];this._touchCurrentX=b.clientX;this._touchCurrentY=b.clientY;if(!this._touchScrollTimer&&a.timeStamp-this._touchStartTime<200){this._vScrollDiv.style.display="block";if(!this._wrapMode)this._hScrollDiv.style.display="block";var c=this,e=this._getWindow();this._touchScrollTimer=e.setInterval(function(){var a=0,b=0;if(c._touching)a=c._touchStartX-c._touchCurrentX,b=c._touchStartY-c._touchCurrentY,c._touchSpeedX=a/10,c._touchSpeedY=b/10,c._touchStartX=c._touchCurrentX,
c._touchStartY=c._touchCurrentY;else if(Math.abs(c._touchSpeedX)<0.1&&Math.abs(c._touchSpeedY)<0.1){c._vScrollDiv.style.display="none";c._hScrollDiv.style.display="none";e.clearInterval(c._touchScrollTimer);c._touchScrollTimer=null;return}else a=c._touchSpeedX*10,b=c._touchSpeedY*10,c._touchSpeedX*=0.95,c._touchSpeedY*=0.95;c._scrollView(a,b)},10)}this._touchScrollTimer&&a.preventDefault()}},_handleTouchEnd:function(a){if(a.touches.length===0)this._touching=!1},_doAction:function(a){var b,c,e=this._keyModes;
for(c=e.length-1;c>=0;c--)if(b=e[c],typeof b.match==="function"&&(b=b.match(a),b!==void 0))return this.invokeAction(b);return!1},_doMove:function(a,b){var c=this._model,e=b.getCaret(),d=c.getLineAtOffset(e);if(!a.count)a.count=1;for(;a.count!==0;){var f=c.getLineStart(d);if(a.count<0&&e===f)if(d>0)a.unit==="character"&&a.count++,d--,b.extend(c.getLineEnd(d));else break;else if(a.count>0&&e===c.getLineEnd(d))if(d+1<c.getLineCount())a.unit==="character"&&a.count--,d++,b.extend(c.getLineStart(d));else break;
else{var h=!1;a.expandTab&&a.unit==="character"&&(e-f)%this._tabSize===0&&(h=!/[^ ]/.test(c.getText(f,e)));h?(b.extend(e-this._tabSize),a.count+=a.count<0?1:-1):(f=this._getLine(d),b.extend(f.getNextOffset(e,a)),f.destroy())}e=b.getCaret()}return b},_doBackspace:function(a){var b=this._getSelection();if(b.isEmpty()){if(!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 c=this.getText(b.start,b.end);this._setSelection(b,!0);switch(a.type){case "lower":c=c.toLowerCase();break;case "capitalize":c=c.replace(/(?:^|\s)\S/g,function(a){return a.toUpperCase()});break;case "reverse":a="";for(b=0;b<c.length;b++){var e=c[b],d=e.toLowerCase(),e=d!==e?d:e.toUpperCase();a+=e}c=a;break;default:c=c.toUpperCase()}this._doContent(c);return!0},_doContent:function(a){var b=this._getSelection();if(this._overwriteMode&&b.isEmpty()){var c=this._model,e=c.getLineAtOffset(b.end);
b.end<c.getLineEnd(e)&&(c=this._getLine(e),b.extend(c.getNextOffset(b.getCaret(),{unit:"character",count:1})),c.destroy())}this._modifyContent({text:a,start:b.start,end:b.end,_ignoreDOMSelection:!0},!0)},_doCopy:function(a){var b=this._getSelection();return!b.isEmpty()?this._setClipboardText(this._getBaseText(b.start,b.end),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();if(!b.isEmpty()&&!a.select)b.end=b.start;else{if(!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(),c=this._model,e;if(a.ctrl)b.extend(c.getCharCount()),e=function(){};else{var d=b.getCaret(),f=c.getLineAtOffset(d);if(this._wrapMode){var h=this._getLine(f),d=h.getLineIndex(d),d=d===h.getLineCount()-1?c.getLineEnd(f):h.getLineStart(d+1)-1;h.destroy()}else a.count&&a.count>0&&(f=Math.min(f+a.count-1,c.getLineCount()-1)),d=c.getLineEnd(f);b.extend(d)}a.select||b.collapse();this._setSelection(b,!0,!0,e);return!0},_doEnter:function(a){var b=this._model,c=this._getSelection();this._doContent(b.getLineDelimiter());
if(a&&a.noCursor)c.end=c.start,this._setSelection(c,!0);return!0},_doHome:function(a){var b=this._getSelection(),c=this._model,e;if(a.ctrl)b.extend(0),e=function(){};else{var d=b.getCaret(),f=c.getLineAtOffset(d);this._wrapMode?(c=this._getLine(f),d=c.getLineIndex(d),d=c.getLineStart(d),c.destroy()):d=c.getLineStart(f);b.extend(d)}a.select||b.collapse();this._setSelection(b,!0,!0,e);return!0},_doLineDown:function(a){var c=this._model,e=this._getSelection(),d=e.getCaret(),f=c.getLineAtOffset(d),h=
this._getLine(f),j=this._columnX,g=1,k=!1;if(j===-1||a.wholeLine||a.select&&b.isIE)j=a.wholeLine?c.getLineEnd(f+1):d,j=h.getBoundingClientRect(j).left;(d=h.getLineIndex(d))<h.getLineCount()-1?g=h.getClientRects(d+1).top+1:(d=c.getLineCount()-1,k=f===d,a.count&&a.count>0?f=Math.min(f+a.count,d):f++);d=!1;if(k){if(a.select||b.isMac||b.isLinux)e.extend(c.getCharCount()),d=!0}else h.lineIndex!==f&&(h.destroy(),h=this._getLine(f)),e.extend(h.getOffset(j,g)),d=!0;d&&(a.select||e.collapse(),this._setSelection(e,
!0,!0));this._columnX=j;h.destroy();return!0},_doLineUp:function(a){var c=this._model,e=this._getSelection(),d=e.getCaret(),f=c.getLineAtOffset(d),h=this._getLine(f),j=this._columnX,g=!1,k;if(j===-1||a.wholeLine||a.select&&b.isIE)j=a.wholeLine?c.getLineStart(f-1):d,j=h.getBoundingClientRect(j).left;(d=h.getLineIndex(d))>0?k=h.getClientRects(d-1).top+1:(g=f===0,g||(a.count&&a.count>0?f=Math.max(f-a.count,0):f--,k=this._getLineHeight(f)-1));d=!1;if(g){if(a.select||b.isMac||b.isLinux)e.extend(0),d=!0}else h.lineIndex!==
f&&(h.destroy(),h=this._getLine(f)),e.extend(h.getOffset(j,k)),d=!0;d&&(a.select||e.collapse(),this._setSelection(e,!0,!0));this._columnX=j;h.destroy();return!0},_doNoop:function(){return!0},_doPageDown:function(a){var c=this,e=this._model,d=this._getSelection(),f=d.getCaret(),h=e.getLineAtOffset(f),j=e.getLineCount(),g=this._getScroll(),e=this._getClientHeight(),k,p;if(this._lineHeight){k=this._columnX;g=this._getBoundsAtOffset(f);if(k===-1||a.select&&b.isIE)k=g.left;f=this._getLineIndex(g.top+e);
p=this._getLine(f);h=this._getLinePixel(f);f=p.getOffset(k,g.top+e-h);e=p.getBoundingClientRect(f);p.destroy();d.extend(f);a.select||d.collapse();this._setSelection(d,!0,!0,function(){c._columnX=k},e.top+h-g.top);return!0}if(h<j-1){var i=this._getLineHeight(),n=Math.min(j-h-1,Math.floor(e/i)),n=Math.max(1,n);k=this._columnX;if(k===-1||a.select&&b.isIE)p=this._getLine(h),k=p.getBoundingClientRect(f).left,p.destroy();p=this._getLine(h+n);d.extend(p.getOffset(k,0));p.destroy();a.select||d.collapse();
a=j*i;f=g.y+n*i;f+e>a&&(f=a-e);this._setSelection(d,!0,!0,function(){c._columnX=k},f-g.y)}return!0},_doPageUp:function(a){var c=this,e=this._model,d=this._getSelection(),f=d.getCaret(),h=e.getLineAtOffset(f),j=this._getScroll(),g=this._getClientHeight(),k;if(this._lineHeight){k=this._columnX;j=this._getBoundsAtOffset(f);if(k===-1||a.select&&b.isIE)k=j.left;f=this._getLineIndex(j.bottom-g);e=this._getLine(f);h=this._getLinePixel(f);f=e.getOffset(k,j.bottom-g-h);g=e.getBoundingClientRect(f);e.destroy();
d.extend(f);a.select||d.collapse();this._setSelection(d,!0,!0,function(){c._columnX=k},g.top+h-j.top);return!0}if(h>0){var p=this._getLineHeight(),g=Math.max(1,Math.min(h,Math.floor(g/p)));k=this._columnX;if(k===-1||a.select&&b.isIE)e=this._getLine(h),k=e.getBoundingClientRect(f).left,e.destroy();e=this._getLine(h-g);d.extend(e.getOffset(k,this._getLineHeight(h-g)-1));e.destroy();a.select||d.collapse();a=Math.max(0,j.y-g*p);this._setSelection(d,!0,!0,function(){c._columnX=k},a-j.y)}return!0},_doPaste:function(a){var c=
this;return this._getClipboardText(a,function(a){a&&(b.isLinux&&c._lastMouseButton===2&&(new Date).getTime()-c._lastMouseTime<=c._clickTime&&c._setSelectionTo(c._lastMouseX,c._lastMouseY),c._doContent(a))})!==null},_doScroll:function(a){var b=a.type,c=this._model,e=c.getLineCount(),a=this._getClientHeight(),d=this._getLineHeight();e*=d;var f=this._getScroll().y,h;switch(b){case "textStart":h=0;break;case "textEnd":h=e-a;break;case "pageDown":h=f+a;break;case "pageUp":h=f-a;break;case "lineDown":h=
f+d;break;case "lineUp":h=f-d;break;case "centerLine":b=this._getSelection(),h=c.getLineAtOffset(b.start),c=(c.getLineAtOffset(b.end)-h+1)*d,h=h*d-a/2+c/2}h!==void 0&&(h=Math.min(Math.max(0,h),e-a),this._scrollViewAnimated(0,h-f,function(){}));return!0},_doSelectAll:function(){var a=this._model,b=this._getSelection();b.setCaret(0);b.extend(a.getCharCount());this._setSelection(b,!1);return!0},_doTab:function(){if(this._tabMode&&!this._readonly){var a="\t";if(this._expandTab)var b=this._model,a=this._getSelection().getCaret(),
c=b.getLineAtOffset(a),b=b.getLineStart(c),a=Array(this._tabSize-(a-b)%this._tabSize+1).join(" ");this._doContent(a);return!0}},_doShiftTab:function(){return!this._tabMode||this._readonly?void 0:!0},_doOverwriteMode:function(){if(!this._readonly)return this.setOptions({overwriteMode:!this.getOptions("overwriteMode")}),!0},_doTabMode:function(){this._tabMode=!this._tabMode;return!0},_doWrapMode:function(){this.setOptions({wrapMode:!this.getOptions("wrapMode")});return!0},_autoScroll:function(){var a=
this._model,c=this._getSelection(),e=this.convert({x:this._autoScrollX,y:this._autoScrollY},"page","document"),d=c.getCaret(),f=a.getLineCount(),h=a.getLineAtOffset(d),j;if(this._autoScrollDir==="up"||this._autoScrollDir==="down")d=this._autoScrollY/this._getLineHeight(),d=d<0?Math.floor(d):Math.ceil(d),j=Math.max(0,Math.min(f-1,h+d));else if(this._autoScrollDir==="left"||this._autoScrollDir==="right")j=this._getLineIndex(e.y),h=this._getLine(h),e.x+=h.getBoundingClientRect(d,!1).left,h.destroy();
j===0&&(b.isMac||b.isLinux)?c.extend(0):j===f-1&&(b.isMac||b.isLinux)?c.extend(a.getCharCount()):(h=this._getLine(j),c.extend(h.getOffset(e.x,e.y-this._getLinePixel(j))),h.destroy());this._setSelection(c,!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(),c=0;if(a){for(var a=
0,e=(new Date).getTime(),d=0;c<b;)if(this._lineHeight[c]||(a++,d||(d=c),this._lineHeight[c]=this._calculateLineHeight(c)),c++,(new Date).getTime()-e>100)break;this.redrawRulers(0,b);this._queueUpdate()}a=this._getWindow();if(c!==b){var f=this;this._calculateLHTimer=a.setTimeout(function(){f._calculateLHTimer=null;f._calculateLineHeightTimer(!0)},0)}else if(this._calculateLHTimer)a.clearTimeout(this._calculateLHTimer),this._calculateLHTimer=void 0}},_calculateLineHeight:function(a){var a=this._getLine(a),
b=a.getBoundingClientRect();a.destroy();return Math.max(1,b.bottom-b.top)},_calculateMetrics:function(){var a=this._clientDiv,c=a.ownerDocument,e=b.createElement(c,"div");e.style.lineHeight="normal";var d={type:"LineStyle",textView:this,0:0,lineText:this._model.getLine(0),lineStart:0};this.onLineStyle(d);h(d.style,e);e.style.position="fixed";e.style.left="-1000px";var f=b.createElement(c,"span");f.appendChild(c.createTextNode(" "));e.appendChild(f);var j=b.createElement(c,"span");j.style.fontStyle=
"italic";j.appendChild(c.createTextNode(" "));e.appendChild(j);var g=b.createElement(c,"span");g.style.fontWeight="bold";g.appendChild(c.createTextNode(" "));e.appendChild(g);d=b.createElement(c,"span");d.style.fontWeight="bold";d.style.fontStyle="italic";d.appendChild(c.createTextNode(" "));e.appendChild(d);a.appendChild(e);var k=e.getBoundingClientRect(),f=f.getBoundingClientRect(),j=j.getBoundingClientRect(),g=g.getBoundingClientRect(),d=d.getBoundingClientRect(),f=f.bottom-f.top,j=j.bottom-j.top,
g=g.bottom-g.top,i=d.bottom-d.top,n=0,d=k.bottom-k.top<=0,k=Math.max(1,k.bottom-k.top);j>f&&(n=1);g>j&&(n=2);i>g&&(n=3);var l;if(n!==0){l={style:{}};if((n&1)!==0)l.style.fontStyle="italic";if((n&2)!==0)l.style.fontWeight="bold"}f=m(e);a.removeChild(e);i=p(this._viewDiv);e=b.createElement(c,"div");e.style.position="fixed";e.style.left="-1000px";e.style.paddingLeft=i.left+"px";e.style.paddingTop=i.top+"px";e.style.paddingRight=i.right+"px";e.style.paddingBottom=i.bottom+"px";e.style.width="100px";e.style.height=
"100px";i=b.createElement(c,"div");i.style.width="100%";i.style.height="100%";e.appendChild(i);a.appendChild(e);n=e.getBoundingClientRect();j=i.getBoundingClientRect();g=0;if(!this._singleMode)e.style.overflow="hidden",i.style.height="200px",g=e.clientWidth,e.style.overflow="scroll",g-=e.clientWidth;a.removeChild(e);i={left:j.left-n.left,top:j.top-n.top,right:n.right-j.right,bottom:n.bottom-j.bottom};j=n=0;if(!d&&(this._wrapOffset||this._marginOffset))e=b.createElement(c,"div"),e.style.position="fixed",
e.style.left="-1000px",e.innerHTML=Array(this._wrapOffset+1).join(" "),a.appendChild(e),n=e.getBoundingClientRect(),n=Math.ceil(n.right-n.left),e.innerHTML=Array(this._marginOffset+1).join(" "),j=e.getBoundingClientRect(),j=Math.ceil(j.right-j.left),a.removeChild(e);return{lineHeight:k,largestFontStyle:l,lineTrim:f,viewPadding:i,scrollWidth:g,wrapWidth:n,marginWidth:j,invalid:d}},_cancelAnimation:function(){if(this._animation)this._animation.stop(),this._animation=null},_clearSelection:function(a){var b=
this._getSelection();if(b.isEmpty())return!1;a==="next"?b.start=b.end:b.end=b.start;this._setSelection(b,!0);return!0},_commitIME:function(){if(this._imeOffset!==-1){this._scrollDiv.focus();this._clientDiv.focus();var a=this._model,b=a.getLineAtOffset(this._imeOffset),c=a.getLineStart(b),e=this._getDOMText(this._getLineNode(b)).text,a=a.getLine(b),c=this._imeOffset-c,a=c+e.length-a.length;c!==a&&this._doContent(e.substring(c,a));this._imeOffset=-1}},_createActions:function(){this.addKeyMode(new i.DefaultKeyMode(this));
var a=this;this._actions={noop:{defaultHandler:function(){return a._doNoop()}},lineUp:{defaultHandler:function(b){return a._doLineUp(e(b,{select:!1}))},actionDescription:{name:g.lineUp}},lineDown:{defaultHandler:function(b){return a._doLineDown(e(b,{select:!1}))},actionDescription:{name:g.lineDown}},lineStart:{defaultHandler:function(b){return a._doHome(e(b,{select:!1,ctrl:!1}))},actionDescription:{name:g.lineStart}},lineEnd:{defaultHandler:function(b){return a._doEnd(e(b,{select:!1,ctrl:!1}))},actionDescription:{name:g.lineEnd}},
charPrevious:{defaultHandler:function(b){return a._doCursorPrevious(e(b,{select:!1,unit:"character"}))},actionDescription:{name:g.charPrevious}},charNext:{defaultHandler:function(b){return a._doCursorNext(e(b,{select:!1,unit:"character"}))},actionDescription:{name:g.charNext}},pageUp:{defaultHandler:function(b){return a._doPageUp(e(b,{select:!1}))},actionDescription:{name:g.pageUp}},pageDown:{defaultHandler:function(b){return a._doPageDown(e(b,{select:!1}))},actionDescription:{name:g.pageDown}},scrollPageUp:{defaultHandler:function(b){return a._doScroll(e(b,
{type:"pageUp"}))},actionDescription:{name:g.scrollPageUp}},scrollPageDown:{defaultHandler:function(b){return a._doScroll(e(b,{type:"pageDown"}))},actionDescription:{name:g.scrollPageDown}},scrollLineUp:{defaultHandler:function(b){return a._doScroll(e(b,{type:"lineUp"}))},actionDescription:{name:g.scrollLineUp}},scrollLineDown:{defaultHandler:function(b){return a._doScroll(e(b,{type:"lineDown"}))},actionDescription:{name:g.scrollLineDown}},wordPrevious:{defaultHandler:function(b){return a._doCursorPrevious(e(b,
{select:!1,unit:"word"}))},actionDescription:{name:g.wordPrevious}},wordNext:{defaultHandler:function(b){return a._doCursorNext(e(b,{select:!1,unit:"word"}))},actionDescription:{name:g.wordNext}},textStart:{defaultHandler:function(b){return a._doHome(e(b,{select:!1,ctrl:!0}))},actionDescription:{name:g.textStart}},textEnd:{defaultHandler:function(b){return a._doEnd(e(b,{select:!1,ctrl:!0}))},actionDescription:{name:g.textEnd}},scrollTextStart:{defaultHandler:function(b){return a._doScroll(e(b,{type:"textStart"}))},
actionDescription:{name:g.scrollTextStart}},scrollTextEnd:{defaultHandler:function(b){return a._doScroll(e(b,{type:"textEnd"}))},actionDescription:{name:g.scrollTextEnd}},centerLine:{defaultHandler:function(b){return a._doScroll(e(b,{type:"centerLine"}))},actionDescription:{name:g.centerLine}},selectLineUp:{defaultHandler:function(b){return a._doLineUp(e(b,{select:!0}))},actionDescription:{name:g.selectLineUp}},selectLineDown:{defaultHandler:function(b){return a._doLineDown(e(b,{select:!0}))},actionDescription:{name:g.selectLineDown}},
selectWholeLineUp:{defaultHandler:function(b){return a._doLineUp(e(b,{select:!0,wholeLine:!0}))},actionDescription:{name:g.selectWholeLineUp}},selectWholeLineDown:{defaultHandler:function(b){return a._doLineDown(e(b,{select:!0,wholeLine:!0}))},actionDescription:{name:g.selectWholeLineDown}},selectLineStart:{defaultHandler:function(b){return a._doHome(e(b,{select:!0,ctrl:!1}))},actionDescription:{name:g.selectLineStart}},selectLineEnd:{defaultHandler:function(b){return a._doEnd(e(b,{select:!0,ctrl:!1}))},
actionDescription:{name:g.selectLineEnd}},selectCharPrevious:{defaultHandler:function(b){return a._doCursorPrevious(e(b,{select:!0,unit:"character"}))},actionDescription:{name:g.selectCharPrevious}},selectCharNext:{defaultHandler:function(b){return a._doCursorNext(e(b,{select:!0,unit:"character"}))},actionDescription:{name:g.selectCharNext}},selectPageUp:{defaultHandler:function(b){return a._doPageUp(e(b,{select:!0}))},actionDescription:{name:g.selectPageUp}},selectPageDown:{defaultHandler:function(b){return a._doPageDown(e(b,
{select:!0}))},actionDescription:{name:g.selectPageDown}},selectWordPrevious:{defaultHandler:function(b){return a._doCursorPrevious(e(b,{select:!0,unit:"word"}))},actionDescription:{name:g.selectWordPrevious}},selectWordNext:{defaultHandler:function(b){return a._doCursorNext(e(b,{select:!0,unit:"word"}))},actionDescription:{name:g.selectWordNext}},selectTextStart:{defaultHandler:function(b){return a._doHome(e(b,{select:!0,ctrl:!0}))},actionDescription:{name:g.selectTextStart}},selectTextEnd:{defaultHandler:function(b){return a._doEnd(e(b,
{select:!0,ctrl:!0}))},actionDescription:{name:g.selectTextEnd}},deletePrevious:{defaultHandler:function(b){return a._doBackspace(e(b,{unit:"character"}))},actionDescription:{name:g.deletePrevious}},deleteNext:{defaultHandler:function(b){return a._doDelete(e(b,{unit:"character"}))},actionDescription:{name:g.deleteNext}},deleteWordPrevious:{defaultHandler:function(b){return a._doBackspace(e(b,{unit:"word"}))},actionDescription:{name:g.deleteWordPrevious}},deleteWordNext:{defaultHandler:function(b){return a._doDelete(e(b,
{unit:"word"}))},actionDescription:{name:g.deleteWordNext}},deleteLineStart:{defaultHandler:function(b){return a._doBackspace(e(b,{unit:"line"}))},actionDescription:{name:g.deleteLineStart}},deleteLineEnd:{defaultHandler:function(b){return a._doDelete(e(b,{unit:"line"}))},actionDescription:{name:g.deleteLineEnd}},tab:{defaultHandler:function(){return a._doTab()},actionDescription:{name:g.tab}},shiftTab:{defaultHandler:function(){return a._doShiftTab()},actionDescription:{name:g.shiftTab}},enter:{defaultHandler:function(){return a._doEnter()},
actionDescription:{name:g.enter}},enterNoCursor:{defaultHandler:function(b){return a._doEnter(e(b,{noCursor:!0}))},actionDescription:{name:g.enterNoCursor}},selectAll:{defaultHandler:function(){return a._doSelectAll()},actionDescription:{name:g.selectAll}},copy:{defaultHandler:function(){return a._doCopy()},actionDescription:{name:g.copy}},cut:{defaultHandler:function(){return a._doCut()},actionDescription:{name:g.cut}},paste:{defaultHandler:function(){return a._doPaste()},actionDescription:{name:g.paste}},
uppercase:{defaultHandler:function(b){return a._doCase(e(b,{type:"upper"}))},actionDescription:{name:g.uppercase}},lowercase:{defaultHandler:function(b){return a._doCase(e(b,{type:"lower"}))},actionDescription:{name:g.lowercase}},capitalize:{defaultHandler:function(b){return a._doCase(e(b,{unit:"word",type:"capitalize"}))},actionDescription:{name:g.capitalize}},reversecase:{defaultHandler:function(b){return a._doCase(e(b,{type:"reverse"}))},actionDescription:{name:g.reversecase}},toggleOverwriteMode:{defaultHandler:function(){return a._doOverwriteMode()},
actionDescription:{name:g.toggleOverwriteMode}},toggleTabMode:{defaultHandler:function(){return a._doTabMode()},actionDescription:{name:g.toggleTabMode}},toggleWrapMode:{defaultHandler:function(){return a._doWrapMode()},actionDescription:{name:g.toggleWrapMode}}}},_createRulerParent:function(a){var c=b.createElement(document,"div");c.className=a;c.tabIndex=-1;c.style.overflow="hidden";c.style.MozUserSelect="none";c.style.WebkitUserSelect="none";c.style.position="absolute";c.style.top="0px";c.style.bottom=
"0px";c.style.cursor="default";c.style.display="none";c.setAttribute("aria-hidden","true");this._rootDiv.appendChild(c);return c},_createRuler:function(a,c){if(this._clientDiv){var e=this._getRulerParent(a);if(e){if(e!==this._marginDiv||this._marginOffset)e.style.display="block";var d=b.createElement(e.ownerDocument,"div");d._ruler=a;d.rulerChanged=!0;d.style.position="relative";d.style.cssFloat="left";d.style.styleFloat="left";d.style.outline="none";if(c===void 0||c<0||c>=e.children.length)e.appendChild(d);
else{for(var f=e.firstChild;f&&c-- >0;)f=f.nextSibling;e.insertBefore(d,f)}}}},_createView:function(){if(!this._clientDiv){for(var a=this._parent;a.hasChildNodes();)a.removeChild(a.lastChild);var c=a.ownerDocument,e=b.createElement(c,"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");a.appendChild(e);this._leftDiv=this._createRulerParent("textviewLeftRuler");
a=b.createElement(c,"div");a.className="textviewScroll";this._viewDiv=a;a.tabIndex=-1;a.style.position="absolute";a.style.top="0px";a.style.bottom="0px";a.style.borderWidth="0px";a.style.margin="0px";a.style.outline="none";a.style.background="transparent";if(b.isMac&&b.isWebkit)a.style.pointerEvents="none",a.style.zIndex="2";e.appendChild(a);(this._rightDiv=this._createRulerParent("textviewRightRuler")).style.right="0px";var d=b.createElement(c,"div");this._scrollDiv=d;d.style.margin="0px";d.style.borderWidth=
"0px";d.style.padding="0px";a.appendChild(d);(this._marginDiv=this._createRulerParent("textviewMarginRuler")).style.zIndex="4";if(!b.isIE&&!b.isIOS)this._clipDiv=a=b.createElement(c,"div"),a.style.position="absolute",a.style.overflow="hidden",a.style.margin="0px",a.style.borderWidth="0px",a.style.padding="0px",a.style.background="transparent",e.appendChild(a),this._clipScrollDiv=d=b.createElement(c,"div"),d.style.position="absolute",d.style.height="1px",d.style.top="-1000px",d.style.background="transparent",
a.appendChild(d);this._setFullSelection(this._fullSelection,!0);a=b.createElement(c,"div");a.className="textviewContent";this._clientDiv=a;a.tabIndex=0;a.style.position="absolute";a.style.borderWidth="0px";a.style.margin="0px";a.style.padding="0px";a.style.outline="none";a.style.zIndex="1";a.style.WebkitUserSelect="text";a.setAttribute("spellcheck","false");if(b.isIOS||b.isAndroid)a.style.WebkitTapHighlightColor="transparent";(this._clipDiv||e).appendChild(a);if(b.isIOS||b.isAndroid)this._vScrollDiv=
d=b.createElement(c,"div"),d.style.position="absolute",d.style.borderWidth="1px",d.style.borderColor="white",d.style.borderStyle="solid",d.style.borderRadius="4px",d.style.backgroundColor="black",d.style.opacity="0.5",d.style.margin="0px",d.style.padding="0px",d.style.outline="none",d.style.zIndex="3",d.style.width="8px",d.style.display="none",e.appendChild(d),this._hScrollDiv=d=b.createElement(c,"div"),d.style.position="absolute",d.style.borderWidth="1px",d.style.borderColor="white",d.style.borderStyle=
"solid",d.style.borderRadius="4px",d.style.backgroundColor="black",d.style.opacity="0.5",d.style.margin="0px",d.style.padding="0px",d.style.outline="none",d.style.zIndex="3",d.style.height="8px",d.style.display="none",e.appendChild(d);if(b.isFirefox&&!a.setCapture)this._overlayDiv=c=b.createElement(c,"div"),c.style.position=a.style.position,c.style.borderWidth=a.style.borderWidth,c.style.margin=a.style.margin,c.style.padding=a.style.padding,c.style.cursor="text",c.style.zIndex="2",(this._clipDiv||
e).appendChild(c);a.contentEditable="true";a.setAttribute("role","textbox");a.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();e=this._rulers;for(c=0;c<e.length;c++)this._createRuler(e[c]);this._update()}},_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:c.TextTheme.getTheme(),update:this._setTheme},themeClass:{value:void 0,update:this._setThemeClass}}},_destroyRuler:function(a){var b=this._getRulerParent(a);if(b)for(var c=b.firstChild;c;){if(c._ruler===a){c._ruler=void 0;b.removeChild(c);if(b.children.length===0&&(b!==this._marginDiv||!this._marginOffset))b.style.display="none";break}c=c.nextSibling}},_destroyView:function(){if(this._clientDiv){this._setGrab(null);
this._unhookEvents();var a=this._getWindow();if(this._autoScrollTimerID)a.clearTimeout(this._autoScrollTimerID),this._autoScrollTimerID=null;if(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,c){this._autoScrollDir=a;this._autoScrollX=b;this._autoScrollY=c;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 c=this._model;c.getBaseModel&&(a=c.mapOffset(a),b=c.mapOffset(b),c=c.getBaseModel());return c.getText(a,b)},_getBottomIndex:function(a){var b=this._bottomChild;if(a&&this._getClientHeight()>this._getLineHeight()){var a=b.getBoundingClientRect(),c=this._clientDiv.getBoundingClientRect();a.bottom>c.bottom&&(b=this._getLinePrevious(b)||b)}return b.lineIndex},_getBoundsAtOffset:function(a){var b=this._getLine(this._model.getLineAtOffset(a)),a=b.getBoundingClientRect(a),
c=this._getLinePixel(b.lineIndex);a.top+=c;a.bottom+=c;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,c){var e=this._model.getLineDelimiter(),d,f,h=this._getWindow(),g=h.clipboardData;if(!g&&a)g=a.clipboardData;if(g)return d=[],f=g.getData(b.isIE?"Text":"text/plain"),
j(f,function(a){d.push(a)},function(){d.push(e)}),f=d.join(""),c&&c(f),f;if(b.isFirefox){this._ignoreFocus=!0;var k=this._clipboardDiv,g=this._rootDiv.ownerDocument;if(!k)this._clipboardDiv=k=b.createElement(g,"div"),k.style.position="fixed",k.style.whiteSpace="pre",k.style.left="-1000px",this._rootDiv.appendChild(k);k.innerHTML="<pre contenteditable=''></pre>";k.firstChild.focus();var p=this,i=function(){var a=p._getTextFromElement(k);k.innerHTML="";d=[];j(a,function(a){d.push(a)},function(){d.push(e)});
return d.join("")},n=!1;this._ignorePaste=!0;if(!b.isLinux||this._lastMouseButton!==2)try{n=g.execCommand("paste",!1,null)}catch(m){n=k.childNodes.length>1||k.firstChild&&k.firstChild.childNodes.length>0}this._ignorePaste=!1;if(!n)return a?(h.setTimeout(function(){p.focus();(f=i())&&c&&c(f);p._ignoreFocus=!1},0),null):(this.focus(),this._ignoreFocus=!1,"");this.focus();this._ignoreFocus=!1;(f=i())&&c&&c(f);return f}return""},_getDOMText:function(a,b){for(var c=a.firstChild,e="",d=0;c;){var f;if(!c.ignore)if(c.ignoreChars){f=
c.lastChild;for(var h=0,j=[],g=-1;f;){for(var k=f.data,p=k.length-1;p>=0;p--){var i=k.substring(p,p+1);h<c.ignoreChars&&(i===" "||i==="\u200c"||i==="\ufeff")?h++:j.push(i==="\u00a0"?"\t":i)}if(b===f)g=j.length;f=f.previousSibling}j=j.reverse().join("");g!==-1&&(d=e.length+j.length-g);e+=j}else for(f=c.firstChild;f;){if(b===f)d=e.length;e+=f.data;f=f.nextSibling}c=c.nextSibling}return{text:e,offset:d}},_getTextFromElement:function(a){var b=a.ownerDocument,c=b.defaultView;if(!c.getSelection)return a.innerText||
a.textContent;b=b.createRange();b.selectNode(a);var a=c.getSelection(),c=[],e;for(e=0;e<a.rangeCount;e++)c.push(a.getRangeAt(e));this._ignoreSelect=!0;a.removeAllRanges();a.addRange(b);b=a.toString();a.removeAllRanges();for(e=0;e<c.length;e++)a.addRange(c[e]);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 q(this,a)},_getLineHeight:function(a,b){if(a!==
void 0&&this._lineHeight){var c=this._lineHeight[a];if(c)return c;if(b||b===void 0)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&&a.lineIndex===-1;)a=a.nextSibling;return a},_getLinePrevious:function(a){for(a=a?a.previousSibling:this._clientDiv.lastChild;a&&a.lineIndex===
-1;)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(),c=-this._topIndexY+this._getScroll().y;if(a>b)for(;b<a;b++)c+=this._getLineHeight(b);else for(b-=1;b>=a;b--)c-=this._getLineHeight(b);return c}return this._getLineHeight()*a},_getLineIndex:function(a){var b,c=0,e=this._model.getLineCount();if(this._lineHeight){var c=this._getTopIndex(),d=-this._topIndexY+this._getScroll().y;if(a!==d)if(a<d)for(;a<
d&&c>0;)a+=this._getLineHeight(--c);else for(b=this._getLineHeight(c);a-b>=d&&c<e-1;)a-=b,b=this._getLineHeight(++c)}else b=this._getLineHeight(),c=Math.floor(a/b);return Math.max(0,Math.min(e-1,c))},_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){(a===void 0||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()){var a=b.getBoundingClientRect(),c=this._getViewPadding(),e=this._viewDiv.getBoundingClientRect();a.top<e.top+c.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(){a._setThemeClass(a._themeClass)}};this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);var c=this._handlers=[],e=this._clientDiv,d=this._viewDiv,f=this._rootDiv,h=this._overlayDiv||e,j=e.ownerDocument,g=this._getWindow(),k=b.isIE?j:g;c.push({target:g,type:"resize",handler:function(b){return a._handleResize(b?b:g.event)}});c.push({target:e,type:"blur",handler:function(b){return a._handleBlur(b?b:g.event)}});
c.push({target:e,type:"focus",handler:function(b){return a._handleFocus(b?b:g.event)}});c.push({target:d,type:"focus",handler:function(){e.focus()}});c.push({target:d,type:"scroll",handler:function(b){return a._handleScroll(b?b:g.event)}});c.push({target:e,type:"textInput",handler:function(b){return a._handleTextInput(b?b:g.event)}});c.push({target:e,type:"keydown",handler:function(b){return a._handleKeyDown(b?b:g.event)}});c.push({target:e,type:"keypress",handler:function(b){return a._handleKeyPress(b?
b:g.event)}});c.push({target:e,type:"keyup",handler:function(b){return a._handleKeyUp(b?b:g.event)}});b.isIE&&c.push({target:j,type:"keyup",handler:function(b){return a._handleDocKeyUp(b?b:g.event)}});c.push({target:e,type:"contextmenu",handler:function(b){return a._handleContextMenu(b?b:g.event)}});c.push({target:e,type:"copy",handler:function(b){return a._handleCopy(b?b:g.event)}});c.push({target:e,type:"cut",handler:function(b){return a._handleCut(b?b:g.event)}});c.push({target:e,type:"paste",
handler:function(b){return a._handlePaste(b?b:g.event)}});if(b.isIOS||b.isAndroid)c.push({target:j,type:"selectionchange",handler:function(b){return a._handleSelectionChange(b?b:g.event)}}),c.push({target:e,type:"touchstart",handler:function(b){return a._handleTouchStart(b?b:g.event)}}),c.push({target:e,type:"touchmove",handler:function(b){return a._handleTouchMove(b?b:g.event)}}),c.push({target:e,type:"touchend",handler:function(b){return a._handleTouchEnd(b?b:g.event)}});else{c.push({target:e,type:"selectstart",
handler:function(b){return a._handleSelectStart(b?b:g.event)}});c.push({target:e,type:"mousedown",handler:function(b){return a._handleMouseDown(b?b:g.event)}});c.push({target:e,type:"mouseover",handler:function(b){return a._handleMouseOver(b?b:g.event)}});c.push({target:e,type:"mouseout",handler:function(b){return a._handleMouseOut(b?b:g.event)}});c.push({target:k,type:"mouseup",handler:function(b){return a._handleMouseUp(b?b:g.event)}});c.push({target:k,type:"mousemove",handler:function(b){return a._handleMouseMove(b?
b:g.event)}});c.push({target:f,type:"mousedown",handler:function(b){return a._handleRootMouseDown(b?b:g.event)}});c.push({target:f,type:"mouseup",handler:function(b){return a._handleRootMouseUp(b?b:g.event)}});c.push({target:h,type:"dragstart",handler:function(b){return a._handleDragStart(b?b:g.event)}});c.push({target:h,type:"drag",handler:function(b){return a._handleDrag(b?b:g.event)}});c.push({target:h,type:"dragend",handler:function(b){return a._handleDragEnd(b?b:g.event)}});c.push({target:h,
type:"dragenter",handler:function(b){return a._handleDragEnter(b?b:g.event)}});c.push({target:h,type:"dragover",handler:function(b){return a._handleDragOver(b?b:g.event)}});c.push({target:h,type:"dragleave",handler:function(b){return a._handleDragLeave(b?b:g.event)}});c.push({target:h,type:"drop",handler:function(b){return a._handleDrop(b?b:g.event)}});c.push({target:this._clientDiv,type:b.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return a._handleMouseWheel(b?b:g.event)}});this._clipDiv&&
c.push({target:this._clipDiv,type:b.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return a._handleMouseWheel(b?b:g.event)}});if(b.isFirefox&&(!b.isWindows||b.isFirefox>=15))(d=g.MutationObserver||g.MozMutationObserver)?(this._mutationObserver=new d(function(b){a._handleDataModified(b)}),this._mutationObserver.observe(e,{subtree:!0,characterData:!0})):c.push({target:this._clientDiv,type:"DOMCharacterDataModified",handler:function(b){return a._handleDataModified(b?b:g.event)}});this._overlayDiv&&
(c.push({target:this._overlayDiv,type:"mousedown",handler:function(b){return a._handleMouseDown(b?b:g.event)}}),c.push({target:this._overlayDiv,type:"mouseover",handler:function(b){return a._handleMouseOver(b?b:g.event)}}),c.push({target:this._overlayDiv,type:"mouseout",handler:function(b){return a._handleMouseOut(b?b:g.event)}}),c.push({target:this._overlayDiv,type:"contextmenu",handler:function(b){return a._handleContextMenu(b?b:g.event)}}));this._isW3CEvents||c.push({target:this._clientDiv,type:"dblclick",
handler:function(b){return a._handleDblclick(b?b:g.event)}})}this._hookRulerEvents(this._leftDiv,c);this._hookRulerEvents(this._rightDiv,c);this._hookRulerEvents(this._marginDiv,c);for(d=0;d<c.length;d++)f=c[d],v(f.target,f.type,f.handler,f.capture)},_hookRulerEvents:function(a,c){if(a){var e=this,d=this._getWindow();b.isIE&&c.push({target:a,type:"selectstart",handler:function(){return!1}});c.push({target:a,type:b.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return e._handleMouseWheel(a?
a:d.event)}});c.push({target:a,type:"click",handler:function(a){e._handleRulerEvent(a?a:d.event)}});c.push({target:a,type:"dblclick",handler:function(a){e._handleRulerEvent(a?a:d.event)}});c.push({target:a,type:"mousemove",handler:function(a){e._handleRulerEvent(a?a:d.event)}});c.push({target:a,type:"mouseover",handler:function(a){e._handleRulerEvent(a?a:d.event)}});c.push({target:a,type:"mouseout",handler:function(a){e._handleRulerEvent(a?a:d.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 c=a.parent;typeof c==="string"&&(c=(a.document||document).getElementById(c));if(!c)throw"no parent";a.parent=c;a.model=a.model||new l.TextModel;var e=this._defaultOptions(),d;for(d in e)e.hasOwnProperty(d)&&(this["_"+d]=a[d]!==void 0?a[d]:e[d].value);this._keyModes=[];this._rulers=[];this._selection=new n(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=(!b.isIE||b.isIE>=9)&&typeof c.ownerDocument.createRange().getBoundingClientRect==="function";this._isW3CEvents=c.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()},_modifyContent:function(a,b){if(!this._readonly||a._code)if(a.type="Verify",this.onVerify(a),!(a.text===null||a.text===void 0)){var c=this._model;try{if(a._ignoreDOMSelection)this._ignoreDOMSelection=!0;c.setText(a.text,a.start,a.end)}finally{if(a._ignoreDOMSelection)this._ignoreDOMSelection=!1}b&&(c=
this._getSelection(),c.setCaret(a.start+a.text.length),this._setSelection(c,!0));this.onModify({type:"Modify"})}},_onModelChanged:function(a){a.type="ModelChanged";this.onModelChanged(a);a.type="Changed";var b=a.start,c=a.addedCharCount,e=a.removedCharCount,d=a.addedLineCount,f=a.removedLineCount,h=this._getSelection();h.end>b&&(h.end>b&&h.start<b+e?h.setCaret(b+c):(h.start+=c-e,h.end+=c-e),this._setSelection(h,!1,!1));b=this._model.getLineAtOffset(b);for(c=this._getLineNext();c;){e=c.lineIndex;if(b<=
e&&e<=b+f)b===e&&!c.modelChangedEvent&&!c.lineRemoved?(c.modelChangedEvent=a,c.lineChanged=!0):(c.lineRemoved=!0,c.lineChanged=!1,c.modelChangedEvent=null);if(e>b+f)c.lineIndex=e+d-f,c._line.lineIndex=c.lineIndex;c=this._getLineNext(c)}this._lineHeight&&(a=[b,f].concat(Array(d)),Array.prototype.splice.apply(this._lineHeight,a));if(!this._wrapMode&&b<=this._maxLineIndex&&this._maxLineIndex<=b+f)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(a!==void 0&&b!==void 0)for(var c=a;c<b;c++)this._lineHeight[c]=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 n(0,0,!1),!1,!1);if(this._viewDiv)this._viewDiv.scrollLeft=0,this._viewDiv.scrollTop=0;var a=this._clientDiv;if(a){for(var c=a.firstChild;c;)c.lineRemoved=!0,c=c.nextSibling;if(b.isFirefox)this._ignoreFocus=
!1,(c=this._hasFocus)&&a.blur(),a.contentEditable=!1,a.contentEditable=!0,c&&a.focus(),this._ignoreFocus=!1}},_scrollViewAnimated:function(a,b,c){var e=this._getWindow();if(c&&this._scrollAnimation){var d=this;this._animation=new u({window:e,duration:this._scrollAnimation,curve:[b,0],onAnimate:function(a){a=b-Math.floor(a);d._scrollView(0,a);b-=a},onEnd:function(){d._animation=null;d._scrollView(a,b);c&&e.setTimeout(c,0)}});this._animation.play()}else this._scrollView(a,b),c&&e.setTimeout(c,0)},_scrollView:function(a,
b){this._ensureCaretVisible=!1;var c=this._viewDiv;a&&(c.scrollLeft+=a);b&&(c.scrollTop+=b)},_setClipboardText:function(a,c){var e,d=this._getWindow(),f=d.clipboardData;if(!f&&c)f=c.clipboardData;if(f&&(e=[],j(a,function(a){e.push(a)},function(){e.push(b.platformDelimiter)}),f.setData(b.isIE?"Text":"text/plain",e.join(""))))return!0;var h=this._parent.ownerDocument,g=b.createElement(h,"pre");g.style.position="fixed";g.style.left="-1000px";j(a,function(a){g.appendChild(h.createTextNode(a))},function(){g.appendChild(b.createElement(h,
"br"))});g.appendChild(h.createTextNode(" "));this._clientDiv.appendChild(g);f=h.createRange();f.setStart(g.firstChild,0);f.setEndBefore(g.lastChild);var k=d.getSelection();k.rangeCount>0&&k.removeAllRanges();k.addRange(f);var p=this,f=function(){g&&g.parentNode===p._clientDiv&&p._clientDiv.removeChild(g);p._updateDOMSelection()},k=!1;this._ignoreCopy=!0;try{k=h.execCommand("copy",!1,null)}catch(i){}this._ignoreCopy=!1;if(!k&&c)return d.setTimeout(f,0),!1;f();return!0},_setDOMSelection:function(a,
c,e,d,f){for(var h,j,g,k,p=0,i=a.firstChild,n,m,l=this._model.getLine(a.lineIndex).length;i;){if(!i.ignore){n=i.firstChild;m=n.length;i.ignoreChars&&(m-=i.ignoreChars);if(p+m>c||p+m>=l){h=n;j=c-p;i.ignoreChars&&m>0&&j===m&&(j+=i.ignoreChars);break}p+=m}i=i.nextSibling}for(var p=0,i=e.firstChild,q=this._model.getLine(e.lineIndex).length;i;){if(!i.ignore){n=i.firstChild;m=n.length;i.ignoreChars&&(m-=i.ignoreChars);if(m+p>d||p+m>=q){g=n;k=d-p;i.ignoreChars&&m>0&&k===m&&(k+=i.ignoreChars);break}p+=m}i=
i.nextSibling}this._setDOMFullSelection(a,c,l,e,d,q);a=this._getWindow();c=this._parent.ownerDocument;if(a.getSelection){e=a.getSelection();a=c.createRange();a.setStart(h,j);a.setEnd(g,k);if(this._hasFocus&&(e.anchorNode!==h||e.anchorOffset!==j||e.focusNode!==g||e.focusOffset!==k||e.anchorNode!==g||e.anchorOffset!==k||e.focusNode!==h||e.focusOffset!==j))this._ignoreSelect=!1,e.rangeCount>0&&e.removeAllRanges(),e.addRange(a),this._ignoreSelect=!0;if(this._cursorDiv&&(a=c.createRange(),f?(a.setStart(h,
j),a.setEnd(h,j)):(a.setStart(g,k),a.setEnd(g,k)),g=a.getClientRects()[0],k=this._cursorDiv.parentNode,h=k.getBoundingClientRect(),g&&h))this._cursorDiv.style.top=g.top-h.top+k.scrollTop+"px",this._cursorDiv.style.left=g.left-h.left+k.scrollLeft+"px"}else if(c.selection&&this._hasFocus)f=c.body,a=b.createElement(c,"div"),f.appendChild(a),f.removeChild(a),a=f.createTextRange(),a.moveToElementText(h.parentNode),a.moveStart("character",j),h=f.createTextRange(),h.moveToElementText(g.parentNode),h.moveStart("character",
k),a.setEndPoint("EndToStart",h),this._ignoreSelect=!1,a.select(),this._ignoreSelect=!0},_setDOMFullSelection:function(a,b,c,e,d){if(this._selDiv1&&(c=this._selDiv1,c.style.width="0px",c.style.height="0px",c=this._selDiv2,c.style.width="0px",c.style.height="0px",c=this._selDiv3,c.style.width="0px",c.style.height="0px",!(a===e&&b===d))){var f=this._model,h=this._getViewPadding(),j=this._clientDiv.getBoundingClientRect(),g=this._viewDiv.getBoundingClientRect(),c=g.left+h.left,k=j.right,h=g.top+h.top,
p=j.bottom,g=j=0;this._clipDiv?(g=this._clipDiv.getBoundingClientRect(),j=g.left-this._clipDiv.scrollLeft):(g=this._rootDiv.getBoundingClientRect(),j=g.left);g=g.top;this._ignoreDOMSelection=!0;var i=(new q(this,a.lineIndex,a)).getBoundingClientRect(f.getLineStart(a.lineIndex)+b,!1),n=i.left,b=(new q(this,e.lineIndex,e)).getBoundingClientRect(f.getLineStart(e.lineIndex)+d,!1),f=b.left;this._ignoreDOMSelection=!1;var m=this._selDiv1,n=Math.min(k,Math.max(c,n)),l=Math.min(p,Math.max(h,i.top)),s=k,d=
Math.min(p,Math.max(h,i.bottom));m.style.left=n-j+"px";m.style.top=l-g+"px";m.style.width=Math.max(0,s-n)+"px";m.style.height=Math.max(0,d-l)+"px";if(a.lineIndex===e.lineIndex)s=Math.min(f,k),m.style.width=Math.max(0,s-n)+"px";else if(i=Math.min(p,Math.max(h,b.top)),f=Math.min(k,Math.max(c,f)),h=Math.min(p,Math.max(h,b.bottom)),p=this._selDiv3,p.style.left=c-j+"px",p.style.top=i-g+"px",p.style.width=Math.max(0,f-c)+"px",p.style.height=Math.max(0,h-i)+"px",Math.abs(a.lineIndex-e.lineIndex)>1)a=this._selDiv2,
a.style.left=c-j+"px",a.style.top=d-g+"px",a.style.width=Math.max(0,k-c)+"px",a.style.height=Math.max(0,i-d)+"px"}},_setGrab:function(a){if(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;if(b.isIE&&a)this._hadFocus=this._hasFocus;var c=this._clientDiv;c.contentEditable=!a;this._hadFocus&&!a&&c.focus();
if(this._overlayDiv)this._overlayDiv.style.zIndex=a?"-1":"1";for(a=this._getLineNext();a;){if(a.hasLink)for(c=a.firstChild;c;)if(c.ignore)c=c.nextSibling;else{var e=c.nextSibling,d=c.viewStyle;d&&d.tagName&&d.tagName.toLowerCase()==="a"&&a.replaceChild(a._line._createSpan(a,c.firstChild.data,d),c);c=e}a=this._getLineNext(a)}this._updateDOMSelection()}},_setSelection:function(a,b,c,e,d){if(a){this._columnX=-1;c===void 0&&(c=!0);var f=this._selection;this._selection=a;b!==!1&&this._showCaret(!1,e,b,
d);c&&this._updateDOMSelection();if(!f.equals(a))this.onSelection({type:"Selection",oldValue:{start:f.start,end:f.end},newValue:{start:a.start,end:a.end}})}},_setSelectionTo:function(a,b,c,e){var d=this._model,f=this._getSelection(),b=this.convert({x:a,y:b},"page","document"),a=this._getLineIndex(b.y);if(this._clickCount===1){d=this._getLine(a);a=d.getOffset(b.x,b.y-this._getLinePixel(a));d.destroy();if(e&&!c&&f.start<=a&&a<f.end)return this._dragOffset=a,!1;f.extend(a);c||f.collapse()}else(this._clickCount&
1)===0?(d=this._getLine(a),a=d.getOffset(b.x,b.y-this._getLinePixel(a)),this._doubleClickSelection?a>=this._doubleClickSelection.start?(c=this._doubleClickSelection.start,e=d.getNextOffset(a,{unit:"wordend",count:1})):(c=d.getNextOffset(a,{unit:"word",count:-1}),e=this._doubleClickSelection.end):(c=d.getNextOffset(a,{unit:"word",count:-1}),e=d.getNextOffset(c,{unit:"wordend",count:1})),d.destroy()):this._doubleClickSelection?(e=d.getLineAtOffset(this._doubleClickSelection.start),a>=e?(c=d.getLineStart(e),
e=d.getLineEnd(a)):(c=d.getLineStart(a),e=d.getLineEnd(e))):(c=d.getLineStart(a),e=d.getLineEnd(a)),f.setCaret(c),f.extend(e);this._setSelection(f,!0,!0);return!0},_setFullSelection:function(a,c){this._fullSelection=a;if(b.isWebkit)this._fullSelection=!0;var e=this._clipDiv||this._rootDiv;if(e)if(this._fullSelection){if(!this._selDiv1&&this._fullSelection&&!b.isIOS){var d=e.ownerDocument;this._highlightRGB=b.isWebkit?"transparent":"Highlight";var f=b.createElement(d,"div");this._selDiv1=f;f.style.position=
"absolute";f.style.borderWidth="0px";f.style.margin="0px";f.style.padding="0px";f.style.outline="none";f.style.background=this._highlightRGB;f.style.width="0px";f.style.height="0px";f.style.zIndex="0";e.appendChild(f);var h=b.createElement(d,"div");this._selDiv2=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";e.appendChild(h);this._selDiv3=
d=b.createElement(d,"div");d.style.position="absolute";d.style.borderWidth="0px";d.style.margin="0px";d.style.padding="0px";d.style.outline="none";d.style.background=this._highlightRGB;d.style.width="0px";d.style.height="0px";d.style.zIndex="0";e.appendChild(d);if(b.isFirefox&&b.isMac){e=this._getWindow().getComputedStyle(d,null).getPropertyValue("background-color");switch(e){case "rgb(119, 141, 168)":e="rgb(199, 208, 218)";break;case "rgb(127, 127, 127)":e="rgb(198, 198, 198)";break;case "rgb(255, 193, 31)":e=
"rgb(250, 236, 115)";break;case "rgb(243, 70, 72)":e="rgb(255, 176, 139)";break;case "rgb(255, 138, 34)":e="rgb(255, 209, 129)";break;case "rgb(102, 197, 71)":e="rgb(194, 249, 144)";break;case "rgb(140, 78, 184)":e="rgb(232, 184, 255)";break;default:e="rgb(180, 213, 255)"}this._highlightRGB=e;f.style.background=e;h.style.background=e;d.style.background=e}c||this._updateDOMSelection()}}else{if(this._selDiv1)e.removeChild(this._selDiv1),this._selDiv1=null;if(this._selDiv2)e.removeChild(this._selDiv2),
this._selDiv2=null;if(this._selDiv3)e.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=b.createElement(document,"div");a.className="textviewBlockCursor";this._cursorDiv=a;a.tabIndex=-1;a.style.zIndex="2";a.style.color=
"transparent";a.style.position="absolute";a.style.pointerEvents="none";a.innerHTML="&nbsp;";this._viewDiv.appendChild(a);this._updateDOMSelection()}}else if(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";if(!b)this._metrics=this._calculateMetrics(),this._queueUpdate()},_setWrapOffset:function(a,b){this._wrapOffset=a;if(!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,c){this._tabSize=a;this._customTabSize=void 0;var e=this._clientDiv;if(b.isOpera){if(e)e.style.OTabSize=this._tabSize+""}else if(b.isWebkit>=537.1){if(e)e.style.tabSize=this._tabSize+""}else if(b.isFirefox>=4){if(e)e.style.MozTabSize=this._tabSize+""}else if(this._tabSize!==
8)this._customTabSize=this._tabSize;c||(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 c="textview",e=this._theme.getThemeClass();e&&(c+=" "+e);this._themeClass&&e!==this._themeClass&&(c+=" "+this._themeClass);
this._rootDiv.className=c;this._updateStyle(b)},_setWrapMode:function(a,b){this._wrapMode=a&&this._wrappable;var c=this._clientDiv;this._wrapMode?(c.style.whiteSpace="pre-wrap",c.style.wordWrap="break-word"):(c.style.whiteSpace="pre",c.style.wordWrap="normal");this._updateOverflow();b||(this.redraw(),this._resetLineWidth());this._resetLineHeight()},_showCaret:function(a,b,c,e){if(this._clientDiv){var d=this._model,f=this._getSelection(),h=this._getScroll(),j=f.getCaret(),g=f.start,k=f.end,p=d.getLineAtOffset(k),
i=Math.max(Math.max(g,d.getLineStart(p)),k-1),d=this._getClientWidth(),p=this._getClientHeight(),n=d/4,m=this._getBoundsAtOffset(j===g?g:i),l=m.left,q=m.right,s=m.top,t=m.bottom;a&&!f.isEmpty()&&(m=this._getBoundsAtOffset(j===k?g:i),m.top===s?j===g?q=l+Math.min(m.right-l,d):l=q-Math.min(q-m.left,d):j===g?t=s+Math.min(m.bottom-s,p):s=t-Math.min(t-m.top,p));a=0;l<h.x&&(a=Math.min(l-h.x,-n));q>h.x+d&&(a=Math.max(q-h.x-d,n));f=0;s<h.y?f=s-h.y:t>h.y+p&&(f=t-h.y-p);e&&(e>0?f>0&&(f=Math.max(f,e)):f<0&&(f=
Math.min(f,e)));if(a!==0||f!==0)return f!==0&&typeof c==="number"&&(c<0&&(c=0),c>1&&(c=1),f+=Math.floor(f>0?c*p:-c*p)),this._scrollViewAnimated(a,f,b),p!==this._getClientHeight()||d!==this._getClientWidth()?this._showCaret():this._ensureCaretVisible=!0,!0;else b&&b();return!1}},_startIME:function(){if(this._imeOffset===-1){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];x(b.target,b.type,b.handler)}this._handlers=null;if(this._mutationObserver)this._mutationObserver.disconnect(),this._mutationObserver=null},_updateDOMSelection:function(){if(!(this._redrawCount>0)&&!this._ignoreDOMSelection&&
this._clientDiv){var a=this._getSelection(),b=this._model,c=b.getLineAtOffset(a.start),e=b.getLineAtOffset(a.end),d=this._getLineNext();if(d){var f=this._getLinePrevious(),h;c<d.lineIndex?(h=d,c=0):c>f.lineIndex?(h=f,c=0):(h=this._getLineNode(c),c=a.start-b.getLineStart(c));e<d.lineIndex?b=0:e>f.lineIndex?(d=f,b=0):(d=this._getLineNode(e),b=a.end-b.getLineStart(e));this._setDOMSelection(h,c,d,b,a.caret)}}},_update:function(a){if(!(this._redrawCount>0)){if(this._updateTimer)this._getWindow().clearTimeout(this._updateTimer),
this._updateTimer=null,a=!1;var c=this._clientDiv,e=this._viewDiv;if(c){if(this._metrics.invalid)this._ignoreQueueUpdate=!0,this._updateStyle(),this._ignoreQueueUpdate=!1;var d=this._model,f=this._getScroll(!1),h=this._getViewPadding(),j=d.getLineCount(),g=this._getLineHeight(),k=!1,p=!1,i=!1,n=this._metrics.scrollWidth;if(this._wrapMode)c.style.width=(this._metrics.wrapWidth||this._getClientWidth())+"px";var m,l,s,t,v=0,x=0,u;if(this._lineHeight){for(;x<j;){u=this._getLineHeight(x);if(v+u>f.y)break;
v+=u;x++}m=x;l=Math.max(0,m-1);s=d=f.y-v;m>0&&(d+=this._getLineHeight(m-1))}else t=Math.max(0,f.y)/g,m=Math.floor(t),l=Math.max(0,m-1),d=Math.round((t-l)*g),s=Math.round((t-m)*g);this._topIndexY=s;t=this._parent;var Q=t.clientWidth,M=t.clientHeight;if(a){g=0;this._leftDiv&&(m=this._leftDiv.getBoundingClientRect(),g=m.right-m.left);m=this._getClientWidth();t=this._getClientHeight();p=m;if(this._wrapMode){if(this._metrics.wrapWidth)p=this._metrics.wrapWidth}else p=Math.max(this._maxLineWidth,p);for(;x<
j;)u=this._getLineHeight(x,!1),v+=u,x++;j=v}else{t=this._getClientHeight();s=Math.min(m+Math.floor((t+s)/g),j-1);var f=Math.min(s+1,j-1),F;for(u=c.firstChild;u;){F=u.lineIndex;var I=u.nextSibling;if(!(l<=F&&F<=f)||u.lineRemoved||u.lineIndex===-1)this._mouseWheelLine===u?(u.style.display="none",u.lineIndex=-1):c.removeChild(u);u=I}u=this._getLineNext();var I=e.ownerDocument,P=I.createDocumentFragment();for(F=l;F<=f;F++)if(!u||u.lineIndex>F)(new q(this,F)).create(P,null);else{P.firstChild&&(c.insertBefore(P,
u),P=I.createDocumentFragment());if(u&&u.lineChanged)u=(new q(this,F)).create(P,u),u.lineChanged=!1;u=this._getLineNext(u)}P.firstChild&&c.insertBefore(P,u);if(b.isWebkit&&!this._wrapMode)c.style.width="0x7fffffffpx";u=this._getLineNext();F=t+d;for(P=!1;u;){l=u.lineWidth;if(l===void 0)if(I=u._line.getBoundingClientRect(),l=u.lineWidth=Math.ceil(I.right-I.left),I=I.bottom-I.top,this._lineHeight)this._lineHeight[u.lineIndex]=I;else if(g!==0&&I!==0&&Math.ceil(g)!==Math.ceil(I))this._variableLineHeight=
!0,this._lineHeight=[],this._lineHeight[u.lineIndex]=I;if(this._lineHeight&&!P&&(F-=this._lineHeight[u.lineIndex],F<0))s=u.lineIndex,P=!0;if(!this._wrapMode){if(l>=this._maxLineWidth)this._maxLineWidth=l,this._maxLineIndex=u.lineIndex;if(this._checkMaxLineIndex===u.lineIndex)this._checkMaxLineIndex=-1}if(u.lineIndex===m)this._topChild=u;if(u.lineIndex===s)this._bottomChild=u;u=this._getLineNext(u)}if(this._checkMaxLineIndex!==-1&&(F=this._checkMaxLineIndex,this._checkMaxLineIndex=-1,0<=F&&F<j)){g=
new q(this,F);I=g.getBoundingClientRect();l=I.right-I.left;if(l>=this._maxLineWidth)this._maxLineWidth=l,this._maxLineIndex=F;g.destroy()}for(;x<j;)u=this._getLineHeight(x,x<=s),v+=u,x++;j=v;this._updateRuler(this._leftDiv,m,f,M);this._updateRuler(this._rightDiv,m,f,M);this._updateRuler(this._marginDiv,m,f,M);g=0;this._leftDiv&&(m=this._leftDiv.getBoundingClientRect(),g=m.right-m.left);f=0;this._rightDiv&&(f=this._rightDiv.getBoundingClientRect(),f=f.right-f.left);e.style.left=g+"px";e.style.right=
f+"px";f=this._scrollDiv;f.style.height=j+"px";m=this._getClientWidth();if(!this._singleMode&&!this._wrapMode){v=k=t;(x=e.style.overflowX==="scroll")?k+=n:v-=n;u=s=m;(l=e.style.overflowY==="scroll")?s+=n:u-=n;t=k;m=s;j>t&&(i=!0,m=u);this._maxLineWidth>m&&(p=!0,t=v,j>t&&(i=!0,m=u));if(x!==p)e.style.overflowX=p?"scroll":"hidden";if(l!==i)e.style.overflowY=i?"scroll":"hidden";k=x!==p||l!==i}i=m;if(this._wrapMode){if(this._metrics.wrapWidth)i=this._metrics.wrapWidth}else i=Math.max(this._maxLineWidth,
i);p=i;if((!b.isIE||b.isIE>=9)&&this._maxLineWidth>m)i+=h.right+h.left;f.style.width=i+"px";if(this._clipScrollDiv)this._clipScrollDiv.style.width=i+"px";f=this._getScroll(!1)}if(this._vScrollDiv)i=t-8,v=Math.max(15,Math.ceil(Math.min(1,i/(j+h.top+h.bottom))*i)),this._vScrollDiv.style.left=g+m-8+"px",this._vScrollDiv.style.top=Math.floor(Math.max(0,f.y*i/j))+"px",this._vScrollDiv.style.height=v+"px";if(!this._wrapMode&&this._hScrollDiv)i=m-8,v=Math.max(15,Math.ceil(Math.min(1,i/(this._maxLineWidth+
h.left+h.right))*i)),this._hScrollDiv.style.left=g+Math.floor(Math.max(0,Math.floor(f.x*i/this._maxLineWidth)))+"px",this._hScrollDiv.style.top=t-9+"px",this._hScrollDiv.style.width=v+"px";x=f.x;v=this._clipDiv;i=this._overlayDiv;if(s=this._marginDiv)s.style.left=-x+g+this._metrics.marginWidth+h.left+"px",s.style.bottom=(e.style.overflowX==="scroll"?n:0)+"px";if(v){v.scrollLeft=x;v.scrollTop=0;e=g+h.left;n=h.top;a=m;g=t;x=0;s=-d;if(f.x===0)e-=h.left,a+=h.left,x=h.left;f.x+m===p&&(a+=h.right);f.y===
0&&(n-=h.top,g+=h.top,s+=h.top);f.y+t===j&&(g+=h.bottom);v.style.left=e+"px";v.style.top=n+"px";v.style.right=Q-a-e+"px";v.style.bottom=M-g-n+"px";c.style.left=x+"px";c.style.top=s+"px";c.style.width=p+"px";c.style.height=t+d+"px";if(i)i.style.left=c.style.left,i.style.top=c.style.top,i.style.width=c.style.width,i.style.height=c.style.height}else{e=x;n=d;Q=x+m;M=d+t;e===0&&(e-=h.left);n===0&&(n-=h.top);Q===p&&(Q+=h.right);f.y+t===j&&(M+=h.bottom);c.style.clip="rect("+n+"px,"+Q+"px,"+M+"px,"+e+"px)";
c.style.left=-x+g+h.left+"px";c.style.width=(this._wrapMode||b.isWebkit?p:m+x)+"px";if(!a)c.style.top=-d+h.top+"px",c.style.height=t+d+"px";if(i&&(i.style.clip=c.style.clip,i.style.left=c.style.left,i.style.width=c.style.width,!a))i.style.top=c.style.top,i.style.height=c.style.height}this._updateDOMSelection();if(k)c=this._ensureCaretVisible,this._ensureCaretVisible=!1,c&&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,c,e,d){if(a)for(var f=this._parent.ownerDocument,j=this._getLineHeight(),g=this._getViewPadding(),a=a.firstChild;a;){var k=a._ruler,i=j,p=k.getOverview();p==="page"&&(i+=this._topIndexY);a.style.top=-i+"px";a.style.height=d+i+"px";a.rulerChanged&&h(k.getRulerStyle(),a);var n,m=a.firstChild;m?(n=m,m=m.nextSibling):(n=b.createElement(f,"div"),n.style.visibility="hidden",a.appendChild(n));var l;if(a.rulerChanged&&n){i=-1;
if(l=k.getWidestAnnotation())if(h(l.style,n),l.html)n.innerHTML=l.html;n.lineIndex=i;n.style.height=j+g.top+"px"}var q;if(p==="page"){for(k=k.getAnnotations(c,e+1);m;)i=m.lineIndex,l=m.nextSibling,(!(c<=i&&i<=e)||m.lineChanged)&&a.removeChild(m),m=l;m=a.firstChild.nextSibling;q=f.createDocumentFragment();for(i=c;i<=e;i++)if(!m||m.lineIndex>i){n=b.createElement(f,"div");if(l=k[i]){h(l.style,n);if(l.html)n.innerHTML=l.html;n.annotation=l}n.lineIndex=i;n.style.height=this._getLineHeight(i)+"px";q.appendChild(n)}else if(q.firstChild&&
(a.insertBefore(q,m),q=f.createDocumentFragment()),m)m=m.nextSibling;q.firstChild&&a.insertBefore(q,m)}else{l=this._getClientHeight();i=this._model.getLineCount();m=l+g.top+g.bottom-2*this._metrics.scrollWidth;p=j*i<m?j:m/i;if(a.rulerChanged){for(l=a.childNodes.length;l>1;)a.removeChild(a.lastChild),l--;k=k.getAnnotations(0,i);q=f.createDocumentFragment();for(var s in k)if(i=s>>>0,!(i<0)){n=b.createElement(f,"div");l=k[s];h(l.style,n);n.style.position="absolute";n.style.top=this._metrics.scrollWidth+
j+Math.floor(i*p)+"px";if(l.html)n.innerHTML=l.html;n.annotation=l;n.lineIndex=i;q.appendChild(n)}a.appendChild(q)}else if(a._oldTrackHeight!==m)for(n=a.firstChild?a.firstChild.nextSibling:null;n;)n.style.top=this._metrics.scrollWidth+j+Math.floor(n.lineIndex*p)+"px",n=n.nextSibling;a._oldTrackHeight=m}a.rulerChanged=!1;a=a.nextSibling}},_updateStyleSheet:function(){var a="";b.isWebkit&&this._metrics.scrollWidth>0&&(a+="\n.textview ::-webkit-scrollbar-corner {background: #eeeeee;}");b.isFirefox&&
b.isMac&&this._highlightRGB&&this._highlightRGB!=="Highlight"&&(a+="\n.textview ::-moz-selection {background: "+this._highlightRGB+";}");if(a){var c=document.getElementById("_textviewStyle");if(c)c.removeChild(c.firstChild),c.appendChild(document.createTextNode(a));else{c=b.createElement(document,"style");c.id="_textviewStyle";var e=document.getElementsByTagName("head")[0]||document.documentElement;c.appendChild(document.createTextNode(a));e.insertBefore(c,e.firstChild)}}},_updateStyle:function(a){if(!a&&
b.isIE)this._rootDiv.style.lineHeight="normal";var c=this._metrics=this._calculateMetrics();this._rootDiv.style.lineHeight=b.isIE?c.lineHeight-(c.lineTrim.top+c.lineTrim.bottom)+"px":"normal";this._updateStyleSheet();a||(this.redraw(),this._resetLineWidth())}};f.EventTarget.addMixin(t.prototype);return{TextView:t}});
define("orion/editor/projectionTextModel",["orion/editor/textModel","orion/editor/eventTarget"],function(g,l){function i(f){this._model=f;this._projections=[]}i.prototype={addProjection:function(f){if(f){var c=this._model,d=this._projections;f._lineIndex=c.getLineAtOffset(f.start);f._lineCount=c.getLineAtOffset(f.end)-f._lineIndex;var b=f.text;b||(b="");f._model=typeof b==="string"?new g.TextModel(b,c.getLineDelimiter()):b;var c=this.mapOffset(f.start,!0),b=f.end-f.start,h=f._lineCount,k=f._model.getCharCount(),
e=f._model.getLineCount()-1;this.onChanging({type:"Changing",text:f._model.getText(),start:c,removedCharCount:b,addedCharCount:k,removedLineCount:h,addedLineCount:e});var a=this._binarySearch(d,f.start);d.splice(a,0,f);this.onChanged({type:"Changed",start:c,removedCharCount:b,addedCharCount:k,removedLineCount:h,addedLineCount:e})}},getProjections:function(){return this._projections.slice(0)},getBaseModel:function(){return this._model},mapOffset:function(f,c){var d=this._projections,b=0,h,g;if(c){for(h=
0;h<d.length;h++){g=d[h];if(g.start>f)break;if(g.end>f)return-1;b+=g._model.getCharCount()-(g.end-g.start)}return f+b}for(h=0;h<d.length;h++){g=d[h];if(g.start>f-b)break;var e=g._model.getCharCount();if(g.start+e>f-b)return-1;b+=e-(g.end-g.start)}return f-b},removeProjection:function(f){var c,d=0;for(c=0;c<this._projections.length;c++){var b=this._projections[c];if(b===f){f=b;break}d+=b._model.getCharCount()-(b.end-b.start)}if(c<this._projections.length){var b=this._model,d=f.start+d,h=f.end-f.start,
g=f._lineCount,e=f._model.getCharCount(),a=f._model.getLineCount()-1;this.onChanging({type:"Changing",text:b.getText(f.start,f.end),start:d,removedCharCount:e,addedCharCount:h,removedLineCount:a,addedLineCount:g});this._projections.splice(c,1);this.onChanged({type:"Changed",start:d,removedCharCount:e,addedCharCount:h,removedLineCount:a,addedLineCount:g})}},_binarySearch:function(f,c){for(var d=f.length,b=-1,h;d-b>1;)h=Math.floor((d+b)/2),c<=f[h].start?d=h:b=h;return d},getCharCount:function(){for(var f=
this._model.getCharCount(),c=this._projections,d=0;d<c.length;d++){var b=c[d];f+=b._model.getCharCount()-(b.end-b.start)}return f},getLine:function(f,c){if(f<0)return null;var d=this._model,b=this._projections,h=0,g=[],e=0,a,j,i;for(a=0;a<b.length;a++){i=b[a];if(i._lineIndex>=f-h)break;j=i._model.getLineCount()-1;if(i._lineIndex+j>=f-h)if(e=f-(i._lineIndex+h),e<j)return i._model.getLine(e,c);else g.push(i._model.getLine(j));e=i.end;h+=j-i._lineCount}for(e=Math.max(e,d.getLineStart(f-h));a<b.length;a++){i=
b[a];if(i._lineIndex>f-h)break;g.push(d.getText(e,i.start));j=i._model.getLineCount()-1;if(i._lineIndex+j>f-h)return g.push(i._model.getLine(0,c)),g.join("");g.push(i._model.getText());e=i.end;h+=j-i._lineCount}b=d.getLineEnd(f-h,c);e<b&&g.push(d.getText(e,b));return g.join("")},getLineAtOffset:function(f){for(var c=this._model,d=this._projections,b=0,h=0,g=0;g<d.length;g++){var e=d[g];if(e.start>f-b)break;var a=e._model.getCharCount();if(e.start+a>f-b){d=f-(e.start+b);h+=e._model.getLineAtOffset(d);
b+=d;break}h+=e._model.getLineCount()-1-e._lineCount;b+=a-(e.end-e.start)}return c.getLineAtOffset(f-b)+h},getLineCount:function(){for(var f=this._projections,c=this._model.getLineCount(),d=0;d<f.length;d++){var b=f[d];c+=b._model.getLineCount()-1-b._lineCount}return c},getLineDelimiter:function(){return this._model.getLineDelimiter()},getLineEnd:function(f,c){if(f<0)return-1;for(var d=this._model,b=this._projections,h=0,g=0,e=0;e<b.length;e++){var a=b[e];if(a._lineIndex>f-h)break;var j=a._model.getLineCount()-
1;if(a._lineIndex+j>f-h)return a._model.getLineEnd(f-(a._lineIndex+h),c)+a.start+g;g+=a._model.getCharCount()-(a.end-a.start);h+=j-a._lineCount}return d.getLineEnd(f-h,c)+g},getLineStart:function(f){if(f<0)return-1;for(var c=this._model,d=this._projections,b=0,h=0,g=0;g<d.length;g++){var e=d[g];if(e._lineIndex>=f-b)break;var a=e._model.getLineCount()-1;if(e._lineIndex+a>=f-b)return e._model.getLineStart(f-(e._lineIndex+b))+e.start+h;h+=e._model.getCharCount()-(e.end-e.start);b+=a-e._lineCount}return c.getLineStart(f-
b)+h},getText:function(f,c){f===void 0&&(f=0);var d=this._model,b=this._projections,h=0,g=[],e,a,j;for(e=0;e<b.length;e++){a=b[e];if(a.start>f-h)break;j=a._model.getCharCount();if(a.start+j>f-h)if(c!==void 0&&a.start+j>c-h)return a._model.getText(f-(a.start+h),c-(a.start+h));else g.push(a._model.getText(f-(a.start+h))),f=a.end+h+j-(a.end-a.start);h+=j-(a.end-a.start)}var i=f-h;if(c!==void 0){for(;e<b.length;e++){a=b[e];if(a.start>c-h)break;g.push(d.getText(i,a.start));j=a._model.getCharCount();if(a.start+
j>c-h)return g.push(a._model.getText(0,c-(a.start+h))),g.join("");g.push(a._model.getText());i=a.end;h+=j-(a.end-a.start)}g.push(d.getText(i,c-h))}else{for(;e<b.length;e++)a=b[e],g.push(d.getText(i,a.start)),g.push(a._model.getText()),i=a.end;g.push(d.getText(i))}return g.join("")},_onChanging:function(f,c,d,b,h,g){for(var e=this._model,a=this._projections,j,i=0,m,n=c+d;j<a.length;j++){d=a[j];if(d.start>c)break;i+=d._model.getCharCount()-(d.end-d.start)}c+=i;for(var l=j;j<a.length;j++){d=a[j];if(d.start>
n)break;i+=d._model.getCharCount()-(d.end-d.start);m+=d._model.getLineCount()-1-d._lineCount}d=n+i;i=j;this.onChanging(c,d-c,b,h+m,g);a.splice(a,i-l);for(f=f.length-(d-c);j<a.length;j++)d=a[j],d.start+=f,d.end+=f,d._lineIndex=e.getLineAtOffset(d.start)},onChanging:function(f){return this.dispatchEvent(f)},onChanged:function(f){return this.dispatchEvent(f)},setLineDelimiter:function(f){this._model.setLineDelimiter(f)},setText:function(f,c,d){f===void 0&&(f="");c===void 0&&(c=0);var b=c,h=d,g=this._model,
e=this._projections,a=0,j=0,i,m,n,l,q,t=0;for(i=0;i<e.length;i++){m=e[i];if(m.start>c-a)break;n=m._model.getCharCount();if(m.start+n>c-a)if(d!==void 0&&m.start+n>d-a){m._model.setText(f,c-(m.start+a),d-(m.start+a));return}else t=m._model.getLineCount()-1-m._model.getLineAtOffset(c-(m.start+a)),l={projection:m,start:c-(m.start+a)},c=m.end+a+n-(m.end-m.start);j+=m._model.getLineCount()-1-m._lineCount;a+=n-(m.end-m.start)}c-=a;var v=i,t=g.getLineAtOffset(c)+j-t;if(d!==void 0)for(;i<e.length;i++){m=e[i];
if(m.start>d-a)break;n=m._model.getCharCount();if(m.start+n>d-a){j+=m._model.getLineAtOffset(d-(m.start+a));n=d-(m.start+a);d=m.end+a;q={projection:m,end:n};break}j+=m._model.getLineCount()-1-m._lineCount;a+=n-(m.end-m.start)}else{for(;i<e.length;i++)m=e[i],j+=m._model.getLineCount()-1-m._lineCount,a+=m._model.getCharCount()-(m.end-m.start);d=h=g.getCharCount()+a}d-=a;m=g.getLineAtOffset(d)+j;h-=b;for(var j=m-t,t=f.length,x=n=m=a=0;;){m!==-1&&m<=x&&(m=f.indexOf("\r",x));n!==-1&&n<=x&&(n=f.indexOf("\n",
x));if(n===-1&&m===-1)break;x=m!==-1&&n!==-1?m+1===n?n+1:(m<n?m:n)+1:m!==-1?m+1:n+1;a++}this.onChanging({type:"Changing",text:f,start:b,removedCharCount:h,addedCharCount:t,removedLineCount:j,addedLineCount:a});g.setText(f,c,d);if(l)m=l.projection,m._model.setText("",l.start);if(q)m=q.projection,m._model.setText("",0,q.end),m.start=m.end,m._lineCount=0;e.splice(v,i-v);for(f=f.length-(d-c);i<e.length;i++)m=e[i],m.start+=f,m.end+=f,m._lineIndex=g.getLineAtOffset(m.start);this.onChanged({type:"Changed",
start:b,removedCharCount:h,addedCharCount:t,removedLineCount:j,addedLineCount:a})}};l.EventTarget.addMixin(i.prototype);return{ProjectionTextModel:i}});
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(g,l,i,f,c,d){function b(b){this._view=b;this._fadeDelay=500;this._hideDelay=200;this._showDelay=500;this._autoHideDelay=5E3;this._create(b.getOptions("parent").ownerDocument)}b.getTooltip=function(c){if(!c._tooltip)c._tooltip=new b(c);return c._tooltip};b.prototype={_create:function(b){if(!this._tooltipDiv){var f=
this._tooltipDiv=d.createElement(b,"div");f.tabIndex=0;f.className="textviewTooltip";f.setAttribute("aria-live","assertive");f.setAttribute("aria-atomic","true");var e=this._tooltipContents=d.createElement(b,"div");f.appendChild(e);b.body.appendChild(f);var a=this;c.addEventListener(f,"mouseover",function(){if(a._hideDelay){var b=a._getWindow();if(a._delayedHideTimeout)b.clearTimeout(a._delayedHideTimeout),a._delayedHideTimeout=null;if(a._hideTimeout)b.clearTimeout(a._hideTimeout),a._hideTimeout=
null;a._nextTarget=null}},!1);c.addEventListener(f,"mouseout",function(b){b=b.relatedTarget||b.toElement;b===f||a._hasFocus()||(!b||!c.contains(f,b))&&a._hide()},!1);c.addEventListener(f,"keydown",function(b){b.keyCode===27&&a._hide()},!1);c.addEventListener(b,"mousedown",this._mouseDownHandler=function(b){a.isVisible()&&(c.contains(f,b.target||b.srcElement)||a._hide())},!0);this._view.addEventListener("Destroy",function(){a.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);c.removeEventListener(this._tooltipDiv.ownerDocument,"mousedown",this._mouseDownHandler,!0);this._tooltipDiv=null}},_hasFocus:function(){var b=this._tooltipDiv;return!b?!1:c.contains(b,b.ownerDocument.activeElement)},hide:function(b){if(b===void 0)b=this._hideDelay;var c=this._getWindow();if(this._delayedHideTimeout)c.clearTimeout(this._delayedHideTimeout),
this._delayedHideTimeout=null;var e=this;b?e._delayedHideTimeout=c.setTimeout(function(){e._delayedHideTimeout=null;e._hide();e.setTarget(e._nextTarget,0)},b):(e._hide(),e.setTarget(e._nextTarget,0))},_hide:function(){var b=this._tooltipDiv;if(b){this._hasFocus()&&this._view.focus();if(this._contentsView)this._contentsView.destroy(),this._contentsView=null;if(this._tooltipContents)this._tooltipContents.innerHTML="";b.style.visibility="hidden";b=this._getWindow();if(this._showTimeout)b.clearTimeout(this._showTimeout),
this._showTimeout=null;if(this._delayedHideTimeout)b.clearTimeout(this._delayedHideTimeout),this._delayedHideTimeout=null;if(this._hideTimeout)b.clearTimeout(this._hideTimeout),this._hideTimeout=null;if(this._fadeTimeout)b.clearInterval(this._fadeTimeout),this._fadeTimeout=null}},isVisible:function(){return this._tooltipDiv&&this._tooltipDiv.style.visibility==="visible"},setTarget:function(b,c,e){if(this.isVisible()){if(!this._hasFocus())this._nextTarget=b,this.hide(e)}else if(this._target=b){var a=
this,b=a._getWindow();if(a._showTimeout)b.clearTimeout(a._showTimeout),a._showTimeout=null;c===0?a.show(!0):a._showTimeout=b.setTimeout(function(){a._showTimeout=null;a.show(!0)},c?c:a._showDelay)}},show:function(b){if(this._target){var c=this._target.getTooltipInfo();if(c){var e=this._tooltipDiv,a=this._tooltipContents;e.style.left=e.style.right=e.style.width=e.style.height=a.style.width=a.style.height="auto";var d=c.contents;d instanceof Array&&(d=this._getAnnotationContents(d));if(typeof d==="string")a.innerHTML=
d;else if(this._isNode(d))a.appendChild(d);else if(d instanceof f.ProjectionTextModel){var g=this._view,i=g.getOptions();i.wrapMode=!1;i.parent=a;var n=i.themeClass;n?((n=n.replace("tooltipTheme",""))&&(n=" "+n),n="tooltipTheme"+n):n="tooltipTheme";i.themeClass=n;i=this._contentsView=new l.TextView(i);i.addEventListener("LineStyle",function(a){g.onLineStyle(a)});i.setModel(d);d=i.computeSize();a.style.width=d.width+"px";a.style.height=d.height+"px";i.resize()}else return;a=e.ownerDocument.documentElement;
c.anchor==="right"?(d=a.clientWidth-c.x,e.style.right=d+"px"):(d=parseInt(this._getNodeStyle(e,"padding-left","0"),10),d+=parseInt(this._getNodeStyle(e,"border-left-width","0"),10),d=c.x-d,e.style.left=d+"px");e.style.maxWidth=a.clientWidth-d-10+"px";d=parseInt(this._getNodeStyle(e,"padding-top","0"),10);d+=parseInt(this._getNodeStyle(e,"border-top-width","0"),10);d=c.y-d;e.style.top=d+"px";e.style.maxHeight=a.clientHeight-d-10+"px";e.style.opacity="1";e.style.visibility="visible";if(b){var s=this,
q=this._getWindow();s._hideTimeout=q.setTimeout(function(){s._hideTimeout=null;var a=parseFloat(s._getNodeStyle(e,"opacity","1"));s._fadeTimeout=q.setInterval(function(){e.style.visibility==="visible"&&a>0?(a-=0.1,e.style.opacity=a):s._hide()},s._fadeDelay/10)},s._autoHideDelay)}}}},_getAnnotationContents:function(b){function k(a,b){var c=t.getLineStart(t.getLineAtOffset(a)),e=t.getLineEnd(t.getLineAtOffset(b),!0);return t.getText(c,e)}function e(a){var b=a.title,e=d.createElement(n,"div");e.className=
"tooltipRow";if(a.html)e.innerHTML=a.html,e.lastChild&&c.addEventListener(e.lastChild,"click",function(){var b=a.start,c=a.end;q.getBaseModel&&(b=q.mapOffset(b,!0),c=q.mapOffset(c,!0));l.setSelection(b,c,1/3,function(){m._hide()})},!1),e.appendChild(n.createTextNode("\u00a0"));b||(b=k(a.start,a.end));typeof b==="function"&&(b=a.title());if(typeof b==="string"){var f=d.createElement(n,"span");f.appendChild(n.createTextNode(b));b=f}e.appendChild(b);return e}for(var a,j=[],i=0;i<b.length;i++)a=b[i],
a.title!==""&&!a.groupAnnotation&&j.push(a);b=j;if(b.length===0)return null;var m=this,n=this._tooltipDiv.ownerDocument,l=this._view,q=l.getModel(),t=q.getBaseModel?q.getBaseModel():q;if(b.length===1)if(a=b[0],a.title!==void 0){a=e(a);if(a.firstChild)(b=a.firstChild.className)&&(b+=" "),b+="single",a.firstChild.className=b;return a}else return b=new f.ProjectionTextModel(t),j=t.getLineStart(t.getLineAtOffset(a.start)),i=t.getCharCount(),a.end!==i&&b.addProjection({start:a.end,end:i}),j>0&&b.addProjection({start:0,
end:j}),b;else{j=d.createElement(n,"div");a=d.createElement(n,"em");a.appendChild(n.createTextNode(g.multipleAnnotations));j.appendChild(a);for(i=0;i<b.length;i++)a=b[i],(a=e(a))&&j.appendChild(a);return j}},_getNodeStyle:function(b,c,e){var a;if(b&&(a=b.style[c],!a))if(b.currentStyle){for(a=0;(a=c.indexOf("-",a))!==-1;)c=c.substring(0,a)+c.substring(a+1,a+2).toUpperCase()+c.substring(a+2);a=b.currentStyle[c]}else a=(b=b.ownerDocument.defaultView.getComputedStyle(b,null))?b.getPropertyValue(c):null;
return a||e},_isNode:function(b){return typeof Node==="object"?b instanceof Node:b&&typeof b==="object"&&typeof b.nodeType==="number"&&typeof b.nodeName==="string"}};return{Tooltip:b}});
define("orion/editor/annotations",["i18n!orion/editor/nls/messages","orion/editor/eventTarget"],function(g,l){function i(b,a,c){this.start=b;this.end=a;this._projectionModel=c;this.html=this._expandedHTML;this.style=this._expandedStyle;this.expanded=!0}function f(){}function c(b,a){var c=b.lastIndexOf("."),c=b.substring(c+1),d={title:g[c],style:{styleClass:"annotation "+c},html:"<div class='annotationHTML "+c+"'></div>",overviewStyle:{styleClass:"annotationOverview "+c}};a?d.lineStyle={styleClass:"annotationLine "+
c}:d.rangeStyle={styleClass:"annotationRange "+c};f.registerType(b,d)}function d(){}function b(b){this._annotations=[];var a=this;this._listener={onChanged:function(b){a._onChanged(b)}};this.setTextModel(b)}function h(b,a){this._view=b;this._annotationModel=a;var c=this;this._listener={onDestroy:function(a){c._onDestroy(a)},onLineStyle:function(a){c._onLineStyle(a)},onChanged:function(a){c._onAnnotationModelChanged(a)}};b.addEventListener("Destroy",this._listener.onDestroy);b.addEventListener("postLineStyle",
this._listener.onLineStyle);a.addEventListener("Changed",this._listener.onChanged)}i.prototype={_expandedHTML:"<div class='annotationHTML expanded'></div>",_expandedStyle:{styleClass:"annotation expanded"},_collapsedHTML:"<div class='annotationHTML collapsed'></div>",_collapsedStyle:{styleClass:"annotation collapsed"},collapse:function(){if(this.expanded){this.expanded=!1;this.html=this._collapsedHTML;this.style=this._collapsedStyle;var b=this._projectionModel,a=b.getBaseModel();this._projection=
{start:a.getLineStart(a.getLineAtOffset(this.start)+1),end:a.getLineEnd(a.getLineAtOffset(this.end),!0)};b.addProjection(this._projection)}},expand:function(){if(!this.expanded)this.expanded=!0,this.html=this._expandedHTML,this.style=this._expandedStyle,this._projectionModel.removeProjection(this._projection)}};f.ANNOTATION_ERROR="orion.annotation.error";f.ANNOTATION_WARNING="orion.annotation.warning";f.ANNOTATION_TASK="orion.annotation.task";f.ANNOTATION_BREAKPOINT="orion.annotation.breakpoint";
f.ANNOTATION_BOOKMARK="orion.annotation.bookmark";f.ANNOTATION_FOLDING="orion.annotation.folding";f.ANNOTATION_CURRENT_BRACKET="orion.annotation.currentBracket";f.ANNOTATION_MATCHING_BRACKET="orion.annotation.matchingBracket";f.ANNOTATION_CURRENT_LINE="orion.annotation.currentLine";f.ANNOTATION_CURRENT_SEARCH="orion.annotation.currentSearch";f.ANNOTATION_MATCHING_SEARCH="orion.annotation.matchingSearch";f.ANNOTATION_READ_OCCURRENCE="orion.annotation.readOccurrence";f.ANNOTATION_WRITE_OCCURRENCE="orion.annotation.writeOccurrence";
f.ANNOTATION_SELECTED_LINKED_GROUP="orion.annotation.selectedLinkedGroup";f.ANNOTATION_CURRENT_LINKED_GROUP="orion.annotation.currentLinkedGroup";f.ANNOTATION_LINKED_GROUP="orion.annotation.linkedGroup";f.ANNOTATION_BLAME="orion.annotation.blame";f.ANNOTATION_CURRENT_BLAME="orion.annotation.currentBlame";var k={};f.registerType=function(b,a){var c=a;if(typeof c!=="function")c=function(a,b,c){this.start=a;this.end=b;if(c!==void 0)this.title=c},c.prototype=a;c.prototype.type=b;k[b]=c;return b};f.createAnnotation=
function(b,a,c,d){return new (this.getType(b))(a,c,d)};f.getType=function(b){return k[b]};c(f.ANNOTATION_ERROR);c(f.ANNOTATION_WARNING);c(f.ANNOTATION_TASK);c(f.ANNOTATION_BREAKPOINT);c(f.ANNOTATION_BOOKMARK);c(f.ANNOTATION_CURRENT_BRACKET);c(f.ANNOTATION_MATCHING_BRACKET);c(f.ANNOTATION_CURRENT_SEARCH);c(f.ANNOTATION_MATCHING_SEARCH);c(f.ANNOTATION_READ_OCCURRENCE);c(f.ANNOTATION_WRITE_OCCURRENCE);c(f.ANNOTATION_SELECTED_LINKED_GROUP);c(f.ANNOTATION_CURRENT_LINKED_GROUP);c(f.ANNOTATION_LINKED_GROUP);
c(f.ANNOTATION_CURRENT_LINE,!0);c(f.ANNOTATION_BLAME,!0);c(f.ANNOTATION_CURRENT_BLAME,!0);f.registerType(f.ANNOTATION_FOLDING,i);d.addMixin=function(b){var a=d.prototype,c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c])};d.prototype={addAnnotationType:function(b){if(!this._annotationTypes)this._annotationTypes=[];this._annotationTypes.push(b)},getAnnotationTypePriority:function(b){if(this._annotationTypes)for(var a=0;a<this._annotationTypes.length;a++)if(this._annotationTypes[a]===b)return a+1;return 0},
getAnnotationsByType:function(b,a,c){b=b.getAnnotations(a,c);for(c=[];b.hasNext();)a=b.next(),this.getAnnotationTypePriority(a.type)!==0&&c.push(a);var d=this;c.sort(function(a,b){return d.getAnnotationTypePriority(a.type)-d.getAnnotationTypePriority(b.type)});return c},isAnnotationTypeVisible:function(b){return this.getAnnotationTypePriority(b)!==0},removeAnnotationType:function(b){if(this._annotationTypes)for(var a=0;a<this._annotationTypes.length;a++)if(this._annotationTypes[a]===b){this._annotationTypes.splice(a,
1);break}}};b.prototype={addAnnotation:function(b){if(b){var a=this._annotations,c=this._binarySearch(a,b.start);a.splice(c,0,b);this.onChanged({type:"Changed",added:[b],removed:[],changed:[]})}},getTextModel:function(){return this._model},getAnnotations:function(b,a){var c=this._annotations,d,f=0,h=function(){for(;f<c.length;){var d=c[f++];if(b===d.start||(b>d.start?b<d.end:d.start<a))return d;if(d.start>=a)break}return null};d=h();return{next:function(){var a=d;a&&(d=h());return a},hasNext:function(){return d!==
null}}},modifyAnnotation:function(b){if(b&&!(this._getAnnotationIndex(b)<0))this.onChanged({type:"Changed",added:[],removed:[],changed:[b]})},onChanged:function(b){return this.dispatchEvent(b)},removeAnnotations:function(b){var a=this._annotations,c,d;if(b){c=[];for(d=a.length-1;d>=0;d--){var f=a[d];f.type===b&&(a.splice(d,1),c.splice(0,0,f))}}else c=a;this.onChanged({type:"Changed",removed:c,added:[],changed:[]})},removeAnnotation:function(b){if(b&&(b=this._getAnnotationIndex(b),!(b<0)))this.onChanged({type:"Changed",
removed:this._annotations.splice(b,1),added:[],changed:[]})},replaceAnnotations:function(b,a){var c=this._annotations,d,f,h,g=[];if(b)for(d=b.length-1;d>=0;d--)h=b[d],f=this._getAnnotationIndex(h),f<0||(c.splice(f,1),g.splice(0,0,h));a||(a=[]);for(d=0;d<a.length;d++)h=a[d],f=this._binarySearch(c,h.start),c.splice(f,0,h);this.onChanged({type:"Changed",removed:g,added:a,changed:[]})},setTextModel:function(b){this._model&&this._model.removeEventListener("Changed",this._listener.onChanged);(this._model=
b)&&this._model.addEventListener("Changed",this._listener.onChanged)},_binarySearch:function(b,a){for(var c=b.length,d=-1,f;c-d>1;)f=Math.floor((c+d)/2),a<=b[f].start?c=f:d=f;return c},_getAnnotationIndex:function(b){for(var a=this._annotations,c=this._binarySearch(a,b.start);c<a.length&&a[c].start===b.start;){if(a[c]===b)return c;c++}return-1},_onChanged:function(b){var a=b.start,c=b.removedCharCount,d=this._annotations,f=a+c;if(0<d.length){for(var h={type:"Changed",added:[],removed:[],changed:[],
textModelChangedEvent:b},b=b.addedCharCount-c,c=0;c<d.length;c++){var g=d[c];g.start>=f?(g.start+=b,g.end+=b,h.changed.push(g)):g.end<=a||(g.start<a&&f<g.end?(g.end+=b,h.changed.push(g)):(d.splice(c,1),h.removed.push(g),c--))}if(h.added.length>0||h.removed.length>0||h.changed.length>0)this.onChanged(h)}}};l.EventTarget.addMixin(b.prototype);h.prototype={destroy:function(){var b=this._view;if(b)b.removeEventListener("Destroy",this._listener.onDestroy),b.removeEventListener("LineStyle",this._listener.onLineStyle),
this.view=null;(b=this._annotationModel)&&b.removeEventListener("Changed",this._listener.onChanged)},_mergeStyle:function(b,a){if(a){b||(b={});b.styleClass&&a.styleClass&&b.styleClass!==a.styleClass?b.styleClass+=" "+a.styleClass:b.styleClass=a.styleClass;var c;if(a.tagName&&!b.tagName)b.tagName=a.tagName;if(a.style){if(!b.style)b.style={};for(c in a.style)b.style[c]||(b.style[c]=a.style[c])}if(a.attributes){if(!b.attributes)b.attributes={};for(c in a.attributes)b.attributes[c]||(b.attributes[c]=
a.attributes[c])}}return b},_mergeStyleRanges:function(b,a){b||(b=[]);var c,d;for(d=0;d<b.length&&a;d++){var f=b[d];if(a.end<=f.start)break;if(!(a.start>=f.end)){c=this._mergeStyle({},f.style);c=this._mergeStyle(c,a.style);var h=[];h.push(d,1);a.start<f.start&&h.push({start:a.start,end:f.start,style:a.style});a.start>f.start&&h.push({start:f.start,end:a.start,style:f.style});h.push({start:Math.max(f.start,a.start),end:Math.min(f.end,a.end),style:c});a.end<f.end&&h.push({start:a.end,end:f.end,style:f.style});
a=a.end>f.end?{start:f.end,end:a.end,style:a.style}:null;Array.prototype.splice.apply(b,h)}}a&&(c=this._mergeStyle({},a.style),b.splice(d,0,{start:a.start,end:a.end,style:c}));return b},_onAnnotationModelChanged:function(b){function a(a){for(var b=0;b<a.length;b++)if(d.isAnnotationTypeVisible(a[b].type)){var e=a[b].start,h=a[b].end;f.getBaseModel&&(e=f.mapOffset(e,!0),h=f.mapOffset(h,!0));e!==-1&&h!==-1&&c.redrawRange(e,h)}}if(!b.textModelChangedEvent){var c=this._view;if(c){var d=this,f=c.getModel();
a(b.added);a(b.removed);a(b.changed)}}},_onDestroy:function(){this.destroy()},_onLineStyle:function(b){var a=this._annotationModel,c=b.textView.getModel(),d=a.getTextModel(),f=b.lineStart,h=b.lineStart+b.lineText.length;d!==c&&(f=c.mapOffset(f),h=c.mapOffset(h));for(a=a.getAnnotations(f,h);a.hasNext();)if(f=a.next(),this.isAnnotationTypeVisible(f.type)){if(f.rangeStyle){var h=f.start,g=f.end;d!==c&&(h=c.mapOffset(h,!0),g=c.mapOffset(g,!0));b.ranges=this._mergeStyleRanges(b.ranges,{start:h,end:g,style:f.rangeStyle})}if(f.lineStyle)b.style=
this._mergeStyle({},b.style),b.style=this._mergeStyle(b.style,f.lineStyle)}}};d.addMixin(h.prototype);return{FoldingAnnotation:i,AnnotationType:f,AnnotationTypeList:d,AnnotationModel:b,AnnotationStyler:h}});
define("orion/editor/editor","i18n!orion/editor/nls/messages,orion/editor/eventTarget,orion/editor/tooltip,orion/editor/annotations,orion/objects,orion/util".split(","),function(g,l,i,f,c,d){function b(b){b=b||{};this._domNode=b.domNode;this._statusReporter=b.statusReporter;this._dirty=!1;this._title=null}function h(c){c=c||{};b.call(this,c);this._textViewFactory=c.textViewFactory;this._undoStackFactory=c.undoStackFactory;this._textDNDFactory=c.textDNDFactory;this._annotationFactory=c.annotationFactory;
this._foldingRulerFactory=c.foldingRulerFactory;this._lineNumberRulerFactory=c.lineNumberRulerFactory;this._contentAssistFactory=c.contentAssistFactory;this._keyBindingFactory=c.keyBindingFactory;this._contentAssist=this._foldingRuler=this._overviewRuler=this._lineNumberRuler=this._annotationRuler=this._annotationModel=this._annotationStyler=null}var k=f.AnnotationType;b.prototype={destroy:function(){this.uninstall();this._statusReporter=this._domNode=null},focus:function(){},getModel:function(){return this._model},
getText:function(b,a){return this.getModel().getText(b,a)},getTitle:function(){return this._title},install:function(){},isDirty:function(){return this._dirty},markClean:function(){this.setDirty(!1)},onDirtyChanged:function(b){return this.dispatchEvent(b)},onInputChanged:function(b){return this.dispatchEvent(b)},reportStatus:function(b,a,c){this._statusReporter&&this._statusReporter(b,a,c)},resize:function(){},setDirty:function(b){if(this._dirty!==b)this._dirty=b,this.onDirtyChanged({type:"DirtyChanged"})},
setInput:function(b,a,c,d){this._title=b;this.onInputChanged({type:"InputChanged",title:b,message:a,contents:c,contentsSaved:d})},uninstall:function(){}};l.EventTarget.addMixin(b.prototype);h.prototype=new b;c.mixin(h.prototype,{destroy:function(){b.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(){var b=this._textView.getModel();b.getBaseModel&&(b=b.getBaseModel());return b},getOverviewRuler:function(){return this._overviewRuler},getTextView:function(){return this._textView},getUndoStack:function(){return this._undoStack},
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()},markClean:function(){this.getUndoStack().markClean()},resize:function(){this._textView&&this._textView.resize()},setAnnotationRulerVisible:function(b,a){if(this._annotationRulerVisible!==b||a)if(this._annotationRulerVisible=
b,this._annotationRuler){var c=this._textView;b?c.addRuler(this._annotationRuler,0):c.removeRuler(this._annotationRuler)}},setFoldingRulerVisible:function(b,a){if(this._foldingRulerVisible!==b||a)if(this._foldingRulerVisible=b,this._foldingRuler){var c=this._textView;c.getModel().getBaseModel&&(b?c.addRuler(this._foldingRuler):c.removeRuler(this._foldingRuler))}},setLineNumberRulerVisible:function(b,a){if(this._lineNumberRulerVisible!==b||a)if(this._lineNumberRulerVisible=b,this._lineNumberRuler){var c=
this._textView;b?c.addRuler(this._lineNumberRuler,!this._annotationRulerVisible?0:1):c.removeRuler(this._lineNumberRuler)}},setOverviewRulerVisible:function(b,a){if(this._overviewRulerVisible!==b||a)if(this._overviewRulerVisible=b,this._overviewRuler){var c=this._textView;b?c.addRuler(this._overviewRuler):c.removeRuler(this._overviewRuler)}},mapOffset:function(b,a){var c=this._textView.getModel();c.getBaseModel&&(b=c.mapOffset(b,a));return b},getCaretOffset:function(){return this.mapOffset(this._textView.getCaretOffset())},
getSelection:function(){var b=this._textView,a=b.getSelection(),b=b.getModel();if(b.getBaseModel)a.start=b.mapOffset(a.start),a.end=b.mapOffset(a.end);return a},_expandOffset:function(b){var a=this._textView.getModel(),c=this._annotationModel;if(c&&a.getBaseModel)for(b=c.getAnnotations(b,b+1);b.hasNext();)a=b.next(),a.type===k.ANNOTATION_FOLDING&&a.expand&&(a.expand(),c.modifyAnnotation(a))},setCaretOffset:function(b,a,c){var d=this._textView,f=d.getModel();f.getBaseModel&&(this._expandOffset(b),
b=f.mapOffset(b,!0));d.setCaretOffset(b,a,c)},setText:function(b,a,c){var d=this._textView,f=d.getModel();f.getBaseModel&&(a!==void 0&&(this._expandOffset(a),a=f.mapOffset(a,!0)),c!==void 0&&(this._expandOffset(c),c=f.mapOffset(c,!0)));d.setText(b,a,c)},setSelection:function(b,a,c,d){var f=this._textView,h=f.getModel();h.getBaseModel&&(this._expandOffset(b),this._expandOffset(a),b=h.mapOffset(b,!0),a=h.mapOffset(a,!0));f.setSelection(b,a,c,d)},moveSelection:function(b,a,c,d){var f=this._textView;
this.setSelection(b,a||b,1/3,function(){(d===void 0||d)&&f.focus();c&&c()})},checkDirty:function(){this.setDirty(!this._undoStack.isClean())},_getTooltipInfo:function(b,a){var c=this._textView,d=this.getAnnotationModel();if(!d)return null;var f=this._annotationStyler;if(!f)return null;var h=c.getOffsetAtLocation(b,a);if(h===-1)return null;h=this.mapOffset(h);f=f.getAnnotationsByType(d,h,h+1);d=[];for(h=0;h<f.length;h++)f[h].rangeStyle&&d.push(f[h]);if(d.length===0)return null;c=c.convert({x:b,y:a},
"document","page");return{contents:d,anchor:"left",x:c.x+10,y:c.y+20}},_highlightCurrentLine:function(b,a){var c=this._annotationModel;if(c){var d=this._textView;if(!d.getOptions("singleMode")){var f=d.getModel(),h=a?f.getLineAtOffset(a.start):-1,g=f.getLineAtOffset(b.start),d=b.start===b.end,i=!a||a.start===a.end,l=f.getLineStart(g),v=f.getLineEnd(g);f.getBaseModel&&(l=f.mapOffset(l),v=f.mapOffset(v));f=this._currentLineAnnotation;if(!(h===g&&i&&d&&f&&f.start===l&&f.end===v)){var h=f?[f]:null,x;
d&&(f=k.createAnnotation(k.ANNOTATION_CURRENT_LINE,l,v),x=[f]);this._currentLineAnnotation=f;c.replaceAnnotations(h,x)}}}},install:function(){this.installTextView()},installTextView:function(){if(!this._textView){this._textView=this._textViewFactory();if(this._undoStackFactory)this._undoStack=this._undoStackFactory.createUndoStack(this);if(this._textDNDFactory)this._textDND=this._textDNDFactory.createTextDND(this,this._undoStack);if(this._contentAssistFactory)this._contentAssist=this._contentAssistFactory.createContentAssistMode(this).getContentAssist();
var b=this,a=this._textView,c=this;this._listener={onModelChanged:function(){c.checkDirty()},onMouseOver:function(a){c._listener.onMouseMove(a)},onMouseMove:function(b){var e=i.Tooltip.getTooltip(a);if(e&&!(c._listener.lastMouseX===b.event.clientX&&c._listener.lastMouseY===b.event.clientY))c._listener.lastMouseX=b.event.clientX,c._listener.lastMouseY=b.event.clientY,e.setTarget({x:b.x,y:b.y,getTooltipInfo:function(){return c._getTooltipInfo(this.x,this.y)}})},onMouseOut:function(b){var e=i.Tooltip.getTooltip(a);
if(e&&!(c._listener.lastMouseX===b.event.clientX&&c._listener.lastMouseY===b.event.clientY))c._listener.lastMouseX=b.event.clientX,c._listener.lastMouseY=b.event.clientY,e.setTarget(null)},onScroll:function(){var b=i.Tooltip.getTooltip(a);b&&b.setTarget(null,0,0)},onSelection:function(a){c._updateCursorStatus();c._highlightCurrentLine(a.newValue,a.oldValue)}};a.addEventListener("ModelChanged",this._listener.onModelChanged);a.addEventListener("Selection",this._listener.onSelection);a.addEventListener("MouseOver",
this._listener.onMouseOver);a.addEventListener("MouseOut",this._listener.onMouseOut);a.addEventListener("MouseMove",this._listener.onMouseMove);a.addEventListener("Scroll",this._listener.onScroll);if(this._keyBindingFactory){var d;if(d=typeof this._keyBindingFactory==="function"?this._keyBindingFactory(this,this.getKeyModes(),this._undoStack,this._contentAssist):this._keyBindingFactory.createKeyBindings(b,this._undoStack,this._contentAssist))this._textActions=d.textActions,this._linkedMode=d.linkedMode,
this._sourceCodeActions=d.sourceCodeActions}d=function(a){if(a!==void 0&&a!==-1){for(var c=this.getView().getModel(),d=this.getAnnotationModel(),f=b.mapOffset(c.getLineStart(a)),a=b.mapOffset(c.getLineEnd(a)),c=d.getAnnotations(f,a),h=null;c.hasNext();){var j=c.next();if(j.type===k.ANNOTATION_BOOKMARK){h=j;break}}h?d.removeAnnotation(h):(h=k.createAnnotation(k.ANNOTATION_BOOKMARK,f,a),h.title=void 0,d.addAnnotation(h))}};if(this._annotationFactory){var f=a.getModel();f.getBaseModel&&(f=f.getBaseModel());
if(this._annotationModel=this._annotationFactory.createAnnotationModel(f))if(f=this._annotationStyler=this._annotationFactory.createAnnotationStyler(a,this._annotationModel))f.addAnnotationType(k.ANNOTATION_CURRENT_SEARCH),f.addAnnotationType(k.ANNOTATION_MATCHING_SEARCH),f.addAnnotationType(k.ANNOTATION_ERROR),f.addAnnotationType(k.ANNOTATION_WARNING),f.addAnnotationType(k.ANNOTATION_MATCHING_BRACKET),f.addAnnotationType(k.ANNOTATION_CURRENT_BRACKET),f.addAnnotationType(k.ANNOTATION_CURRENT_LINE),
f.addAnnotationType(k.ANNOTATION_READ_OCCURRENCE),f.addAnnotationType(k.ANNOTATION_WRITE_OCCURRENCE),f.addAnnotationType(k.ANNOTATION_SELECTED_LINKED_GROUP),f.addAnnotationType(k.ANNOTATION_CURRENT_LINKED_GROUP),f.addAnnotationType(k.ANNOTATION_LINKED_GROUP),f.addAnnotationType("orion.annotation.highlightError");a.annotationModel=this._annotationModel;var f=this._annotationFactory.createAnnotationRulers(this._annotationModel),h=this._annotationRuler=f.annotationRuler;if(h)h.onDblClick=d,h.setMultiAnnotationOverlay({html:"<div class='annotationHTML overlay'></div>"}),
h.addAnnotationType(k.ANNOTATION_ERROR),h.addAnnotationType(k.ANNOTATION_WARNING),h.addAnnotationType(k.ANNOTATION_TASK),h.addAnnotationType(k.ANNOTATION_BOOKMARK);this.setAnnotationRulerVisible(this._annotationRulerVisible||this._annotationRulerVisible===void 0,!0);if(h=this._overviewRuler=f.overviewRuler)h.addAnnotationType(k.ANNOTATION_CURRENT_SEARCH),h.addAnnotationType(k.ANNOTATION_MATCHING_SEARCH),h.addAnnotationType(k.ANNOTATION_READ_OCCURRENCE),h.addAnnotationType(k.ANNOTATION_WRITE_OCCURRENCE),
h.addAnnotationType(k.ANNOTATION_CURRENT_BLAME),h.addAnnotationType(k.ANNOTATION_ERROR),h.addAnnotationType(k.ANNOTATION_WARNING),h.addAnnotationType(k.ANNOTATION_TASK),h.addAnnotationType(k.ANNOTATION_BOOKMARK),h.addAnnotationType(k.ANNOTATION_MATCHING_BRACKET),h.addAnnotationType(k.ANNOTATION_CURRENT_BRACKET),h.addAnnotationType(k.ANNOTATION_CURRENT_LINE);this.setOverviewRulerVisible(this._overviewRulerVisible||this._overviewRulerVisible===void 0,!0)}if(this._lineNumberRulerFactory)this._lineNumberRuler=
this._lineNumberRulerFactory.createLineNumberRuler(this._annotationModel),this._lineNumberRuler.addAnnotationType(k.ANNOTATION_CURRENT_BLAME),this._lineNumberRuler.addAnnotationType(k.ANNOTATION_BLAME),this._lineNumberRuler.onDblClick=d,this.setLineNumberRulerVisible(this._lineNumberRulerVisible||this._lineNumberRulerVisible===void 0,!0);if(this._foldingRulerFactory)this._foldingRuler=this._foldingRulerFactory.createFoldingRuler(this._annotationModel),this._foldingRuler.addAnnotationType(k.ANNOTATION_FOLDING),
this.setFoldingRulerVisible(this._foldingRulerVisible||this._foldingRulerVisible===void 0,!0);this.dispatchEvent({type:"TextViewInstalled",textView:a})}},uninstall:function(){this.uninstallTextView()},uninstallTextView:function(){var b=this._textView;if(b)b.destroy(),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:b})},_updateCursorStatus:function(){var b=this.getModel(),a=this.getCaretOffset(),c=b.getLineAtOffset(a),b=b.getLineStart(c);a-=b;for(var b=this.getKeyModes(),f=0;f<b.length;f++){var h=b[f];if(h.isActive()&&h.isStatusActive&&h.isStatusActive())return}this.reportStatus(d.formatMessage(g.lineColumn,
c+1,a+1))},showAnnotations:function(b,a,c,d){var f=this._annotationModel;if(f){for(var h=[],g=[],i=f.getTextModel(),l=f.getAnnotations(0,i.getCharCount()),v;l.hasNext();)v=l.next(),a.indexOf(v.type)!==-1&&v.creatorID===this&&h.push(v);if(b)for(a=0;a<b.length;a++)if(v=b[a]){if(c)v=c(v);else{var x;typeof v.line==="number"?(x=i.getLineStart(v.line-1),l=x+v.start-1,x+=v.end):(l=v.start,x=v.end);var u=d(v);if(!u)continue;v=k.createAnnotation(u,l,x,v.description)}v.creatorID=this;g.push(v)}f.replaceAnnotations(h,
g)}},showProblems:function(b){this.showAnnotations(b,[k.ANNOTATION_ERROR,k.ANNOTATION_WARNING,k.ANNOTATION_TASK],null,function(a){switch(a.severity){case "error":return k.ANNOTATION_ERROR;case "warning":return k.ANNOTATION_WARNING;case "task":return k.ANNOTATION_TASK}return null})},showOccurrences:function(b){this.showAnnotations(b,[k.ANNOTATION_READ_OCCURRENCE,k.ANNOTATION_WRITE_OCCURRENCE],null,function(a){return a.readAccess?k.ANNOTATION_READ_OCCURRENCE:k.ANNOTATION_WRITE_OCCURRENCE})},showBlame:function(b){var a=
this._blameRGB,h=this.getTextView().getOptions("parent").ownerDocument;if(!a){var i=d.createElement(h,"div");i.className="annotation blame";h.body.appendChild(i);var m=(h.defaultView||h.parentWindow).getComputedStyle(i).getPropertyValue("background-color");i.parentNode.removeChild(i);var i=m.indexOf("("),n=m.indexOf(")"),m=m.substring(i+1,n);this._blameRGB=a=m.split(",").slice(0,3)}var l=function(){var a=f.AnnotationType.createAnnotation(this.groupType,this.start,this.end,this.title);a.style=c.mixin({},
a.style);a.style.style=c.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},q=function(){var a=d.createElement(h,"div");a.className="tooltipTitle";var b=this.blame.Message.indexOf("\n");if(b===-1)b=this.blame.Message.length;var c=d.createElement(h,"a");c.href=this.blame.CommitLink;c.appendChild(h.createTextNode(this.blame.Message.substring(0,b)));a.appendChild(c);a.appendChild(d.createElement(h,"br"));
a.appendChild(h.createTextNode(d.formatMessage(g.committerOnTime,this.blame.AuthorName,this.blame.Time)));return a},t=this.getModel();this.showAnnotations(b,[k.ANNOTATION_BLAME,k.ANNOTATION_CURRENT_BLAME],function(b){var e=t.getLineStart(b.Start-1),d=t.getLineEnd(b.End-1,!0),e=f.AnnotationType.createAnnotation(k.ANNOTATION_BLAME,e,d,q),d=a.slice(0);d.push(b.Shade);e.style=c.mixin({},e.style);e.style.style=c.mixin({},e.style.style);e.style.style.backgroundColor="rgba("+d.join()+")";e.groupId=b.Name;
e.groupType=k.ANNOTATION_CURRENT_BLAME;e.createGroupAnnotation=l;e.html='<img class="annotationHTML blame" src="'+b.AuthorImage+'"/>';e.blame=b;return e})},showSelection:function(b,a,c,d,f){typeof b==="number"?(typeof a!=="number"&&(a=b),this.moveSelection(b,a)):typeof c==="number"&&(b=this.getModel().getLineStart(c-1),typeof d==="number"&&(b+=d),typeof f!=="number"&&(f=0),this.moveSelection(b,b+f))},setInput:function(c,a,d,f){this._textView&&(f||(a?this._textView.setText(a):d!==null&&d!==void 0&&
(this._textView.setText(d),this._textView.getModel().setLineDelimiter("auto"),this._highlightCurrentLine(this._textView.getSelection())),this._undoStack.reset(),this._textView.focus()),this.checkDirty());b.prototype.setInput.call(this,c,a,d,f)},onGotoLine:function(b,a,c,d){if(this._textView){var f=this.getModel(),b=Math.max(0,Math.min(b,f.getLineCount()-1)),h=f.getLineStart(b),g=0;c===void 0&&(c=0);typeof a==="string"?(b=f.getLine(b).indexOf(a),b!==-1&&(g=b,c=g+a.length)):(g=a,a=f.getLineEnd(b)-h,
g=Math.min(g,a),c=Math.min(c,a));this.moveSelection(h+g,h+c,d)}}});return{BaseEditor:b,Editor:h}});
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(g,l,i,f,c,d,b){function h(a){var b=a.getTextView();i.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,d=b.getModel(),f=b.mapOffset(a.start),b=b.mapOffset(a.end),d=d.getText(f,b);if((d=e._prefix.match(RegExp("^"+c.escape(d),"i")))&&d.length>0)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 k(a,b,c){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(c)}}var e={};h.prototype=new i.KeyMode;d.mixin(h.prototype,{createKeyBindings:function(){var a=l.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 c=this._prefix;if(c.length===0)return!1;var e=this.editor,d=e.getModel(),d=a?this._success?b?this._start:e.getCaretOffset()+
1:0:this._success?b?this._start:e.getCaretOffset():d.getCharCount()-1;if(c=e.getModel().find({string:c,start:d,reverse:!a,caseInsensitive:c.toLowerCase()===c}).next()){if(!b)this._start=d;this._ignoreSelection=this._success=!0;e.moveSelection(a?c.start:c.end,a?c.end:c.start);this._ignoreSelection=!1}else this._success=!1;this._status();return!0},isActive:function(){return this._active},isStatusActive:function(){return this.isActive()},setActive:function(a){if(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 a.length===0?(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?g.incrementalFindStr:g.incrementalFindStrNotFound:this._success?g.incrementalFindReverseStr:g.incrementalFindReverseStrNotFound;a=b.formatMessage(a,this._prefix);this.editor.reportStatus(a,this._success?"":"error")}else this.editor.reportStatus("")}});
e.IncrementalFind=h;k.prototype={find:function(a,b,c){this.setOptions({reverse:!a});var e=this.getFindString(),d;if(b)e=b.findString||e,d=b.count;a=this.getOptions();this.setOptions(b);b=c?this._startOffset:this.getStartOffset();if((d=this._doFind(e,b,d))&&!c)this._startOffset=d.start;this.setOptions(a);this._hideAfterFind&&this.hide();return d},getStartOffset:function(){return this._start!==void 0?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=c.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;if(this._savedOptions&&(this.setOptions(this._savedOptions.pop()),this._savedOptions.length===0))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="",c=!1,e=this._editor.getModel().getLineDelimiter(),d=0;d<a.length;d++){var f=a.substring(d,d+1);if(c){switch(f){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+="\\"+f}c=!1}else f==="\\"?c=!0:b+=f}c&&(b+="\\")}return b},isVisible:function(){return this._visible},replace:function(){var a=this.getFindString();if(a){var b=this._editor,c=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,c),this.endUndo()}this._findAfterReplace&&a&&this._doFind(a,this.getStartOffset())},replaceAll:function(){var a=this.getFindString();if(a){this._replacingAll=!0;var c=this._editor,e=c.getTextView();c.reportStatus(g.replaceAll);var d=this._processReplaceString(this.getReplaceString()),f=this;window.setTimeout(function(){for(var h=0,k=0;;){var i=f._doFind(a,h,null,!0);if(!i)break;k++;k===1&&(e.setRedraw(!1),f.startUndo());f._doReplace(i.start,i.end,a,d);h=f.getStartOffset()}k>
0&&(f.endUndo(),e.setRedraw(!0));h>0?c.reportStatus(b.formatMessage(g.replacedMatches,k)):c.reportStatus(g.nothingReplaced,"error");f._replacingAll=!1},100)}},setOptions:function(a){if(a){if((a.showAll===!0||a.showAll===!1)&&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(f.AnnotationType.ANNOTATION_MATCHING_SEARCH)}if(a.caseInsensitive===!0||a.caseInsensitive===!1)this._caseInsensitive=
a.caseInsensitive;if(a.wrap===!0||a.wrap===!1)this._wrap=a.wrap;if(a.wholeWord===!0||a.wholeWord===!1)this._wholeWord=a.wholeWord;if(a.incremental===!0||a.incremental===!1)this._incremental=a.incremental;if(a.regex===!0||a.regex===!1)this._regex=a.regex;if(a.findAfterReplace===!0||a.findAfterReplace===!1)this._findAfterReplace=a.findAfterReplace;if(a.hideAfterFind===!0||a.hideAfterFind===!1)this._hideAfterFind=a.hideAfterFind;if(a.reverse===!0||a.reverse===!1)this._reverse=a.reverse;if(a.hasOwnProperty("findCallback"))this._findCallback=
a.findCallback;if(a.hasOwnProperty("start"))this._start=a.start;if(a.hasOwnProperty("end"))this._end=a.end}},show:function(a){this._visible=!0;if(a){if(!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,c){return this._editor.getModel().find({string:a,start:b,end:this._end,reverse:this._reverse,wrap:c?!1:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive})},_doFind:function(a,b,c,e){var c=c||1,d=this._editor;if(!a)return this._removeAllAnnotations(),null;this._lastString=a;var h,k;if(this._regex)try{k=this._find(a,b,e)}catch(i){d.reportStatus(i.message,
"error");return}else k=this._find(a,b,e);for(a=0;a<c&&k.hasNext();a++)h=k.next();if(!this._replacingAll){h?this._editor.reportStatus(""):this._editor.reportStatus(g.notFound,"error");if(this.isVisible()){c=f.AnnotationType.ANNOTATION_CURRENT_SEARCH;if(k=d.getAnnotationModel())k.removeAnnotations(c),h&&k.addAnnotation(f.AnnotationType.createAnnotation(c,h.start,h.end));if(this._showAll){this._timer&&window.clearTimeout(this._timer);var l=this;this._timer=window.setTimeout(function(){l._markAllOccurrences();
l._timer=null},500)}}this._findCallback?this._findCallback(h):h&&d.moveSelection(h.start,h.end,null,!1)}return h},_doReplace:function(a,b,c,e){var d=this._editor;if(this._regex&&(e=d.getText(a,b).replace(RegExp(c,this._caseInsensitive?"i":""),e),!e))return;d.setText(e,a,b);d.setSelection(a,a+e.length,!0)},_markAllOccurrences:function(){var a=this._editor.getAnnotationModel();if(a){for(var b=f.AnnotationType.ANNOTATION_MATCHING_SEARCH,c=a.getAnnotations(0,a.getTextModel().getCharCount()),e=[],d;c.hasNext();){var h=
c.next();h.type===b&&e.push(h)}if(this.isVisible()){c=this.getFindString();c=this._editor.getModel().find({string:c,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive});for(d=[];c.hasNext();)h=c.next(),d.push(f.AnnotationType.createAnnotation(b,h.start,h.end))}a.replaceAnnotations(e,d)}},_removeAllAnnotations:function(){var a=this._editor.getAnnotationModel();a&&(a.removeAnnotations(f.AnnotationType.ANNOTATION_CURRENT_SEARCH),a.removeAnnotations(f.AnnotationType.ANNOTATION_MATCHING_SEARCH))},
_removeCurrentAnnotation:function(){var a=this._editor.getAnnotationModel();a&&a.removeAnnotations(f.AnnotationType.ANNOTATION_CURRENT_SEARCH)}};e.Find=k;return e});
define("orion/editor/actions","i18n!orion/editor/nls/messages,orion/keyBinding,orion/editor/annotations,orion/editor/tooltip,orion/editor/find,orion/util".split(","),function(g,l,i,f,c,d){function b(a,b,e){this.editor=a;this.undoStack=b;this._incrementalFind=new c.IncrementalFind(a);this._find=e?e:new c.Find(a,b);this._lastEditLocation=null;this.init()}function h(a,b,c,e){this.editor=a;this.undoStack=b;this.contentAssist=c;this.linkedMode=e;this.contentAssist&&this.contentAssist.addEventListener("ProposalApplied",
this.contentAssistProposalApplied.bind(this));this.init()}var k=i.AnnotationType,e={};b.prototype={init:function(){var a=this.editor.getTextView();this._lastEditListener={onModelChanged:function(a){if(this.editor.isDirty())this._lastEditLocation=a.start+a.addedCharCount}.bind(this)};a.addEventListener("ModelChanged",this._lastEditListener.onModelChanged);a.setAction("undo",function(){return this.undoStack?(this.undoStack.undo(),!0):!1}.bind(this),{name:g.undo});a.setAction("redo",function(){return this.undoStack?
(this.undoStack.redo(),!0):!1}.bind(this),{name:g.redo});a.setKeyBinding(new l.KeyBinding("f",!0),"find");a.setAction("find",function(){if(this._find){var a=this.editor.getSelection();(a=prompt(g.find,this.editor.getText(a.start,a.end)))&&this._find.find(!0,{findString:a})}}.bind(this),{name:g.find});a.setKeyBinding(new l.KeyBinding("k",!0),"findNext");a.setAction("findNext",function(a){return this._find?(this._find.find(!0,a),!0):!1}.bind(this),{name:g.findNext});a.setKeyBinding(new l.KeyBinding("k",
!0,!0),"findPrevious");a.setAction("findPrevious",function(a){return this._find?(this._find.find(!1,a),!0):!1}.bind(this),{name:g.findPrevious});a.setKeyBinding(new l.KeyBinding("j",!0),"incrementalFind");a.setAction("incrementalFind",function(){this._incrementalFind&&this._incrementalFind.find(!0);return!0}.bind(this),{name:g.incrementalFind});a.setKeyBinding(new l.KeyBinding("j",!0,!0),"incrementalFindReverse");a.setAction("incrementalFindReverse",function(){this._incrementalFind&&this._incrementalFind.find(!1);
return!0}.bind(this),{name:g.incrementalFindReverse});a.setAction("tab",function(){return this.indentLines()}.bind(this));a.setAction("shiftTab",function(){return this.unindentLines()}.bind(this),{name:g.unindentLines});a.setKeyBinding(new l.KeyBinding(38,!1,!1,!0),"moveLinesUp");a.setAction("moveLinesUp",function(){return this.moveLinesUp()}.bind(this),{name:g.moveLinesUp});a.setKeyBinding(new l.KeyBinding(40,!1,!1,!0),"moveLinesDown");a.setAction("moveLinesDown",function(){return this.moveLinesDown()}.bind(this),
{name:g.moveLinesDown});a.setKeyBinding(new l.KeyBinding(38,!0,!1,!0),"copyLinesUp");a.setAction("copyLinesUp",function(){return this.copyLinesUp()}.bind(this),{name:g.copyLinesUp});a.setKeyBinding(new l.KeyBinding(40,!0,!1,!0),"copyLinesDown");a.setAction("copyLinesDown",function(){return this.copyLinesDown()}.bind(this),{name:g.copyLinesDown});a.setKeyBinding(new l.KeyBinding("d",!0,!1,!1),"deleteLines");a.setAction("deleteLines",function(a){return this.deleteLines(a)}.bind(this),{name:g.deleteLines});
a.setKeyBinding(new l.KeyBinding("l",!d.isMac,!1,!1,d.isMac),"gotoLine");a.setAction("gotoLine",function(){return this.gotoLine()}.bind(this),{name:g.gotoLine});a.setKeyBinding(new l.KeyBinding(190,!0),"nextAnnotation");a.setAction("nextAnnotation",function(){return this.nextAnnotation(!0)}.bind(this),{name:g.nextAnnotation});a.setKeyBinding(new l.KeyBinding(188,!0),"previousAnnotation");a.setAction("previousAnnotation",function(){return this.nextAnnotation(!1)}.bind(this),{name:g.prevAnnotation});
a.setKeyBinding(new l.KeyBinding("e",!0,!1,!0,!1),"expand");a.setAction("expand",function(){return this.expandAnnotation(!0)}.bind(this),{name:g.expand});a.setKeyBinding(new l.KeyBinding("c",!0,!1,!0,!1),"collapse");a.setAction("collapse",function(){return this.expandAnnotation(!1)}.bind(this),{name:g.collapse});a.setKeyBinding(new l.KeyBinding("e",!0,!0,!0,!1),"expandAll");a.setAction("expandAll",function(){return this.expandAnnotations(!0)}.bind(this),{name:g.expandAll});a.setKeyBinding(new l.KeyBinding("c",
!0,!0,!0,!1),"collapseAll");a.setAction("collapseAll",function(){return this.expandAnnotations(!1)}.bind(this),{name:g.collapseAll});a.setKeyBinding(new l.KeyBinding("q",!d.isMac,!1,!1,d.isMac),"lastEdit");a.setAction("lastEdit",function(){return this.gotoLastEdit()}.bind(this),{name:g.lastEdit})},copyLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),e=b.getLineAtOffset(c.start),c=b.getLineAtOffset(c.end>c.start?c.end-1:
c.end),d=b.getLineStart(e),e=b.getLineEnd(c,!0),f=b.getLineCount(),h="",d=b.getText(d,e);c===f-1&&(d=(h=b.getLineDelimiter())+d);a.setText(d,e,e);a.setSelection(e+h.length,e+d.length);return!0},copyLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),e=b.getLineAtOffset(c.start),c=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),e=b.getLineStart(e),d=b.getLineEnd(c,!0),f=b.getLineCount(),h="",d=b.getText(e,d);c===f-1&&(d+=h=b.getLineDelimiter());
a.setText(d,e,e);a.setSelection(e,e+d.length-h.length);return!0},deleteLines:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var c=1;if(a&&a.count)c=a.count;var e=b.getSelection(),d=b.getModel(),f=d.getLineAtOffset(e.start),a=d.getLineStart(f),c=e.start!==e.end||c===1?d.getLineAtOffset(e.end>e.start?e.end-1:e.end):Math.min(f+c-1,d.getLineCount()-1),c=d.getLineEnd(c,!0);b.setText("",a,c);return!0},expandAnnotation:function(a){var b=this.editor,c=b.getAnnotationModel();
if(!c)return!0;var e=b.getModel(),d=b.getCaretOffset(),f=e.getLineAtOffset(d),d=e.getLineStart(f),f=e.getLineEnd(f,!0);e.getBaseModel&&(d=e.mapOffset(d),f=e.mapOffset(f),e.getBaseModel());for(var h,e=c.getAnnotations(d,f);!h&&e.hasNext();)d=e.next(),d.type===i.AnnotationType.ANNOTATION_FOLDING&&(h=d);h&&a!==h.expanded&&(a?h.expand():(b.setCaretOffset(h.start),h.collapse()),c.modifyAnnotation(h));return!0},expandAnnotations:function(a){var b=this.editor,c=b.getTextView(),e=b.getAnnotationModel();if(!e)return!0;
var b=b.getModel(),d=e.getAnnotations(0,b.getCharCount());for(c.setRedraw(!1);d.hasNext();)b=d.next(),b.type===i.AnnotationType.ANNOTATION_FOLDING&&a!==b.expanded&&(a?b.expand():b.collapse(),e.modifyAnnotation(b));c.setRedraw(!0);return!0},indentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){var c=a.getModel(),e=a.getSelection(),d=c.getLineAtOffset(e.start),f=c.getLineAtOffset(e.end>e.start?e.end-1:e.end);if(d!==f){var h=[];h.push("");
for(var g=d;g<=f;g++)h.push(c.getLine(g,!0));g=c.getLineStart(d);c=c.getLineEnd(f,!0);b=b.getOptions("tabSize","expandTab");b=b.expandTab?Array(b.tabSize+1).join(" "):"\t";a.setText(h.join(b),g,c);a.setSelection(g===e.start?e.start:e.start+b.length,e.end+(f-d+1)*b.length);return!0}return!1}},gotoLastEdit:function(){typeof this._lastEditLocation==="number"&&this.editor.showSelection(this._lastEditLocation);return!0},gotoLine:function(){var a=this.editor,b=a.getModel().getLineAtOffset(a.getCaretOffset());
if(b=prompt(g.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(),c=a.getSelection(),e=b.getLineAtOffset(c.start),d=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),f=b.getLineCount();if(d===f-1)return!0;var e=b.getLineStart(e),c=b.getLineEnd(d,!0),h=b.getLineEnd(d+1,!0)-(c-e),g=0;d!==f-2?b=b.getText(e,c):(d=b.getLineEnd(d),b=b.getText(d,c)+b.getText(e,d),g+=c-d);this.startUndo();
a.setText("",e,c);a.setText(b,h,h);a.setSelection(h+g,h+g+b.length);this.endUndo();return!0},moveLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),e=b.getLineAtOffset(c.start);if(e===0)return!0;var d=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),f=b.getLineCount(),c=b.getLineStart(e-1),h=b.getLineStart(e),g=b.getLineEnd(d,!0),k=b.getText(h,g),i=0;d===f-1&&(d=b.getLineEnd(e-1),e=b.getLineEnd(e-1,!0),k+=b.getText(d,e),h=d,
i=e-d);this.startUndo();a.setText("",h,g);a.setText(k,c,c);a.setSelection(c,c+k.length-i);this.endUndo();return!0},nextAnnotation:function(a){var b=this.editor,c=b.getAnnotationModel();if(!c)return!0;var e=b.getOverviewRuler()||b.getAnnotationStyler();if(!e)return!0;for(var d=b.getModel(),h=b.getCaretOffset(),c=c.getAnnotations(a?h:0,a?d.getCharCount():h),g=null;c.hasNext();){var i=c.next();if(a){if(i.start<=h)continue}else if(i.start>=h)continue;if(!i.lineStyle&&!(i.type===k.ANNOTATION_MATCHING_BRACKET||
i.type===k.ANNOTATION_CURRENT_BRACKET||!e.isAnnotationTypeVisible(i.type)))if(g=i,a)break}if(g){var l=b.getTextView(),x=d.getLineAtOffset(g.start),u=f.Tooltip.getTooltip(l);if(!u)return b.moveSelection(g.start),!0;b.moveSelection(g.start,g.start,function(){u.setTarget({getTooltipInfo:function(){var a=l.convert({x:l.getLocationAtOffset(g.start).x,y:l.getLocationAtOffset(d.getLineStart(x)).y},"document","page");return{contents:[g],x:a.x,y:a.y+Math.floor(l.getLineHeight(x)*1.33)}}},0)})}return!0},unindentLines:function(){var a=
this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){for(var c=a.getModel(),e=a.getSelection(),d=c.getLineAtOffset(e.start),f=c.getLineAtOffset(e.end>e.start?e.end-1:e.end),h=b.getOptions("tabSize"),g=Array(h+1).join(" "),k=[],i=b=0,l=d;l<=f;l++){var o=c.getLine(l,!0);if(c.getLineStart(l)!==c.getLineEnd(l))if(o.indexOf("\t")===0)o=o.substring(1),b++;else if(o.indexOf(g)===0)o=o.substring(h),b+=h;else return!0;l===d&&(i=b);k.push(o)}d=c.getLineStart(d);h=c.getLineEnd(f,
!0);c=c.getLineStart(f);a.setText(k.join(""),d,h);f=d===e.start?e.start:e.start-i;e=Math.max(f,e.end-b+(e.end===c+1&&e.start!==e.end?1:0));a.setSelection(f,e);return!0}},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()}};e.TextActions=b;h.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 l.KeyBinding("t",!0,!1,!0),"trimTrailingWhitespaces");a.setAction("trimTrailingWhitespaces",function(){return this.trimTrailingWhitespaces()}.bind(this),{name:g.trimTrailingWhitespaces});a.setKeyBinding(new l.KeyBinding(191,!0),"toggleLineComment");a.setAction("toggleLineComment",function(){return this.toggleLineComment()}.bind(this),{name:g.toggleLineComment});a.setKeyBinding(new l.KeyBinding(191,!0,!d.isMac,!1,d.isMac),"addBlockComment");a.setAction("addBlockComment",function(){return this.addBlockComment()}.bind(this),
{name:g.addBlockComment});a.setKeyBinding(new l.KeyBinding(220,!0,!d.isMac,!1,d.isMac),"removeBlockComment");a.setAction("removeBlockComment",function(){return this.removeBlockComment()}.bind(this),{name:g.removeBlockComment});a.setKeyBinding(new l.KeyBinding("[",!1,!1,!1,!1,"keypress"),"autoPairSquareBracket");a.setAction("autoPairSquareBracket",function(){return this.autoPairBrackets("[","]")}.bind(this));a.setKeyBinding(new l.KeyBinding("]",!1,!1,!1,!1,"keypress"),"skipClosingSquareBracket");a.setAction("skipClosingSquareBracket",
function(){return this.skipClosingBracket("]")}.bind(this));a.setKeyBinding(new l.KeyBinding("<",!1,!1,!1,!1,"keypress"),"autoPairAngleBracket");a.setAction("autoPairAngleBracket",function(){return this.autoPairBrackets("<",">")}.bind(this));a.setKeyBinding(new l.KeyBinding(">",!1,!1,!1,!1,"keypress"),"skipClosingAngleBracket");a.setAction("skipClosingAngleBracket",function(){return this.skipClosingBracket(">")}.bind(this));a.setKeyBinding(new l.KeyBinding("(",!1,!1,!1,!1,"keypress"),"autoPairParentheses");
a.setAction("autoPairParentheses",function(){return this.autoPairBrackets("(",")")}.bind(this));a.setKeyBinding(new l.KeyBinding(")",!1,!1,!1,!1,"keypress"),"skipClosingParenthesis");a.setAction("skipClosingParenthesis",function(){return this.skipClosingBracket(")")}.bind(this));a.setKeyBinding(new l.KeyBinding("{",!1,!1,!1,!1,"keypress"),"autoPairBraces");a.setAction("autoPairBraces",function(){return this.autoPairBrackets("{","}")}.bind(this));a.setKeyBinding(new l.KeyBinding("}",!1,!1,!1,!1,"keypress"),
"skipClosingBrace");a.setAction("skipClosingBrace",function(){return this.skipClosingBracket("}")}.bind(this));a.setKeyBinding(new l.KeyBinding("'",!1,!1,!1,!1,"keypress"),"autoPairSingleQuotation");a.setAction("autoPairSingleQuotation",function(){return this.autoPairQuotations("'")}.bind(this));a.setKeyBinding(new l.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 c=a.getSelection();if(c.start===c.end){for(var e=a.getModel(),d=e.getLineAtOffset(c.start),f=e.getLine(d,!1),h=e.getLineStart(d),g=0,k=c.start-h,i;g<k&&((i=f.charCodeAt(g))===32||i===9);)g++;var h=f.substring(0,g),b=b.getOptions("tabSize","expandTab"),l=b.expandTab?Array(b.tabSize+1).join(" "):"\t",b=e.getLineDelimiter(),o=/^[\s]*\/\*[\*]*[\s]*$/,
r=/^[\s]*\*/,w=/\*\/[\s]*$/,z=f.substring(0,k),y=f.substring(k),J;if(this.smartIndentation&&f.charCodeAt(J=z.trimRight().length-1)===123)return e=k-J-1,y=y.length-y.trimLeft().length,f=f.charCodeAt(k+y)===125?b+h+l+b+h:b+h+l,a.setText(f,c.start-e,c.end+y),a.setCaretOffset(c.start+b.length+h.length+l.length-e),!0;else if(this.autoCompleteComments&&!w.test(z)&&(o.test(z)||r.test(z))){if(g=o.exec(z)){f=b+h+" * ";f+=w.test(y)?y.substring(0,y.length-2).trim():y.trim();if(e.getLineCount()===d+1||!r.test(e.getLine(d+
1)))f+=b+h+" */";a.setText(f,c.start,c.end+y.length);a.setCaretOffset(c.start+b.length+h.length+3);return!0}if(g=r.exec(z))for(d-=1;d>=0;d--)if(g=e.getLine(d,!1),o.test(g))return w.test(y)||f.charCodeAt(k)===47?(f=b+h+"*"+y,h=c.start+b.length+h.length+1):(f=b+h+"* "+y,h=c.start+b.length+h.length+2),a.setText(f,c.start,c.end+y.length),a.setCaretOffset(h),!0;else if(!r.test(g))break}else if(w.test(z))return f=f.substring(c.start)+b+h.substring(0,h.length-1),a.setText(f,c.start,c.end),a.setCaretOffset(c.start+
f.length),!0;else if(g>0){for(g=k;g<f.length&&((i=f.charCodeAt(g++))===32||i===9);)c.end++;a.setText(e.getLineDelimiter()+h,c.start,c.end);return!0}}return!1},addBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),e=this._findEnclosingComment(b,c.start,c.end);if(e.commentStart!==void 0&&e.commentEnd!==void 0)return!0;b=b.getText(c.start,c.end);if(b.length===0)return!0;var e=b.length,b=b.replace(/\/\*|\*\//g,""),d=b.length;
a.setText("/*"+b+"*/",c.start,c.end);a.setSelection(c.start+2,c.end+2+(d-e));return!0},autoPairBrackets:function(a,b){if(a==="["&&!this.autoPairSquareBrackets)return!1;else if(a==="{"&&!this.autoPairBraces)return!1;else if(a==="("&&!this.autoPairParentheses)return!1;else if(a==="<"&&!this.autoPairAngleBrackets)return!1;var c=this.editor;if(c.getTextView().getOptions("readonly"))return!1;var e=c.getSelection(),d=c.getModel(),f=c.getCaretOffset()===d.getCharCount()?"":d.getText(e.start,e.start+1).trim(),
h=/^$|[)}\]>]/;if(e.start===e.end&&h.test(f))return c.setText(a+b,e.start,e.start),c.setCaretOffset(e.start+1),!0;else if(e.start!==e.end)return d=d.getText(e.start,e.end),c.setText(a+d+b,e.start,e.end),c.setSelection(e.start+1,e.end+1),!0;return!1},autoPairQuotations:function(a){if(!this.autoPairQuotation)return!1;var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var c=b.getSelection(),e=b.getModel(),d=b.getCaretOffset(),f=d===0?"":e.getText(c.start-1,c.start).trim(),h=d===e.getCharCount()?
"":e.getText(c.start,c.start+1).trim(),d=/^"$|^'$/,g=/\w/,k=/^$|[)}\]>]/;if(c.start!==c.end){e=e.getText(c.start,c.end);if(d.test(e))return!1;b.setText(a+e+a,c.start,c.end);b.setSelection(c.start+1,c.end+1)}else if(h===a)b.setCaretOffset(c.start+1);else if(f===a||d.test(h)||g.test(f)||!k.test(h))return!1;else b.setText(a+a,c.start,c.start),b.setCaretOffset(c.start+1);return!0},contentAssistProposalApplied:function(a){a=a.data.proposal;if(a.positions&&a.positions.length>0&&this.linkedMode){for(var b=
[],c=0;c<a.positions.length;++c)b[c]={positions:[{offset:a.positions[c].offset,length:a.positions[c].length}]};this.linkedMode.enterLinkedMode({groups:b,escapePosition:a.escapePosition})}else a.groups&&a.groups.length>0&&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(),c=a.getModel(),e=a.getCaretOffset(),d=e===0?"":c.getText(b.start-1,b.start),c=e===c.getCharCount()?"":c.getText(b.start,b.start+1);(d==="("&&c===")"||d==="["&&c==="]"||d==="{"&&c==="}"||d==="<"&&c===">"||d==='"'&&c==='"'||d==="'"&&c==="'")&&a.setText("",b.start,b.start+1);return!1},_findEnclosingComment:function(a,b,c){var e=a.getLineAtOffset(b),d=a.getLineAtOffset(c),f,h,g,k,i,l;for(f=e;f>=0;f--)if(h=a.getLine(f),g=f===e?b-a.getLineStart(e):h.length,k=h.lastIndexOf("/*",g),
h=h.lastIndexOf("*/",g),h>k)break;else if(k!==-1){i=a.getLineStart(f)+k;break}for(f=d;f<a.getLineCount();f++)if(h=a.getLine(f),g=f===d?c-a.getLineStart(d):0,k=h.indexOf("/*",g),h=h.indexOf("*/",g),k!==-1&&k<h)break;else if(h!==-1){l=a.getLineStart(f)+h;break}return{commentStart:i,commentEnd:l}},lineStart:function(){for(var a=this.editor,b=a.getModel(),c=a.getCaretOffset(),e=b.getLineAtOffset(c),d=b.getLineStart(e),b=b.getLine(e),e=0;e<b.length;e++){var f=b.charCodeAt(e);if(!(f===32||f===9))break}e+=
d;return c!==e?(a.setSelection(e,e),!0):!1},removeBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),e=b.getText(c.start,c.end),d,f,h;for(h=0;h<e.length;h++)if(e.substring(h,h+2)==="/*"){d=c.start+h;break}for(;h<e.length;h++)if(e.substring(h,h+2)==="*/"){f=c.start+h;break}if(d!==void 0&&f!==void 0)a.setText(b.getText(d+2,f),d,f+2),a.setSelection(d,f);else{e=this._findEnclosingComment(b,c.start,c.end);if(e.commentStart===
void 0||e.commentEnd===void 0)return!0;b=b.getText(e.commentStart+2,e.commentEnd);a.setText(b,e.commentStart,e.commentEnd+2);a.setSelection(c.start-2,c.end-2)}return!0},toggleLineComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;for(var b=a.getModel(),c=a.getSelection(),e=b.getLineAtOffset(c.start),d=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),f=!0,h=[],g,k,i=e;i<=d;i++)if(g=b.getLine(i,!0),h.push(g),!f||(k=g.indexOf("//"))===-1)f=!1;else if(k!==0){var l;for(l=
0;l<k;l++)if(f=g.charCodeAt(l),!(f===32||f===9))break;f=l===k}i=b.getLineStart(e);l=b.getLineEnd(d,!0);if(f){for(f=0;f<h.length;f++)g=h[f],k=g.indexOf("//"),h[f]=g.substring(0,k)+g.substring(k+2);h=h.join("");g=b.getLineStart(d);b=i===c.start?c.start:c.start-2;c=c.end-2*(d-e+1)+(c.end===g+1?2:0)}else h.splice(0,0,""),h=h.join("//"),b=i===c.start?c.start:c.start+2,c=c.end+2*(d-e+1);a.setText(h,i,l);a.setSelection(b,c);return!0},trimTrailingWhitespaces:function(){var a=this.editor,b=a.getModel(),c=
a.getSelection();a.getTextView().setRedraw(!1);a.getUndoStack().startCompoundChange();for(var e=/(\s+$)/,d=b.getLineCount(),f=0;f<d;f++){var h=b.getLine(f),g=e.exec(h);if(g){var k=b.getLineStart(f),h=g[0].length,g=k+g.index;b.setText("",g,g+h);if(c.start>g)c.start=Math.max(g,c.start-h);if(c.start!==c.end&&c.end>g)c.end=Math.max(g,c.end-h)}}a.getUndoStack().endCompoundChange();a.getTextView().setRedraw(!0);a.setSelection(c.start,c.end,!1)},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},
skipClosingBracket:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var c=b.getSelection(),e=b.getModel();return(b.getCaretOffset()===e.getCharCount()?"":e.getText(c.start,c.start+1))===a?(b.setCaretOffset(c.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},setSmartIndentation:function(a){this.smartIndentation=a}};e.SourceCodeActions=h;if(!String.prototype.trimLeft)String.prototype.trimLeft=function(){return this.replace(/^\s+/g,"")};if(!String.prototype.trimRight)String.prototype.trimRight=function(){return this.replace(/\s+$/g,"")};return e});
define("orion/editor/undoStack",[],function(){function g(f,c,d,b){this.offset=f;this.text=c;this.previousText=d;this.type=b}function l(f){this.owner=f;this.changes=[]}function i(f,c){this.view=f;this.size=c!==void 0?c:100;this.reset();var d=f.getModel();d.getBaseModel&&(d=d.getBaseModel());this.model=d;var b=this;this._listener={onChanging:function(c){b._onChanging(c)},onDestroy:function(c){b._onDestroy(c)}};d.addEventListener("Changing",this._listener.onChanging);f.addEventListener("Destroy",this._listener.onDestroy)}
g.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(f,c){this._doUndoRedo(this.offset,this.previousText,this.text,f,c);return!0},redo:function(f,c){this._doUndoRedo(this.offset,this.text,this.previousText,f,c);return!0},merge:function(f,c,d,b,h){if(b===this.type)if(b===1&&f===this.offset+this.text.length)return this.text+=
c,!0;else if(b===-1&&h===this.offset)return this.offset=f,this.previousText=d+this.previousText,!0;else if(b===-1&&f===this.offset)return this.previousText+=d,!0;return!1},_doUndoRedo:function(f,c,d,b,h){var g=b.getModel();if(g.mapOffset&&b.annotationModel){var e=g.mapOffset(f,!0);if(e<0)for(var a=b.annotationModel.getAnnotations(f,f+1);a.hasNext();){var j=a.next();if(j.type==="orion.annotation.folding"){j.expand();e=g.mapOffset(f,!0);break}}if(e<0)return;f=e}g.setText(c,f,f+d.length);h&&b.setSelection(f,
f+c.length)}};l.prototype={getRedoChanges:function(){for(var f=[],c=0;c<this.changes.length;c++)f=f.concat(this.changes[c].getRedoChanges());return f},getUndoChanges:function(){for(var f=[],c=this.changes.length-1;c>=0;c--)f=f.concat(this.changes[c].getUndoChanges());return f},add:function(f){this.changes.push(f)},end:function(f){this.endSelection=f.getSelection();this.endCaret=f.getCaretOffset();(f=this.owner)&&f.end&&f.end()},undo:function(f,c){this.changes.length>1&&f.setRedraw(!1);for(var d=this.changes.length-
1;d>=0;d--)this.changes[d].undo(f,!1);this.changes.length>1&&f.setRedraw(!0);if(c){var d=this.startSelection.start,b=this.startSelection.end;f.setSelection(this.startCaret?d:b,this.startCaret?b:d)}(d=this.owner)&&d.undo&&d.undo();return this.changes.length>0},redo:function(f,c){this.changes.length>1&&f.setRedraw(!1);for(var d=0;d<this.changes.length;d++)this.changes[d].redo(f,!1);this.changes.length>1&&f.setRedraw(!0);if(c){var d=this.endSelection.start,b=this.endSelection.end;f.setSelection(this.endCaret?
d:b,this.endCaret?b:d)}(d=this.owner)&&d.redo&&d.redo();return this.changes.length>0},merge:function(f,c,d,b,h){var g=this.changes.length;return g>0?this.changes[g-1].merge(f,c,d,b,h):!1},start:function(f){this.startSelection=f.getSelection();this.startCaret=f.getCaretOffset();(f=this.owner)&&f.start&&f.start()}};i.prototype={add:function(f){this.compoundChange?this.compoundChange.add(f):(this.stack.splice(this.index,this.stack.length-this.index,f),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 this.index>0},canRedo:function(){return this.stack.length-this.index>0},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 f=[],c=this.index;c<this.stack.length;c++)f=f.concat(this.stack[c].getRedoChanges());return f},getUndoChanges:function(){this._commitUndo();for(var f=[],c=this.index;c>=0;c--)f=f.concat(this.stack[c].getUndoChanges());return f},undo:function(){this._commitUndo();var f;f=!1;this._ignoreUndo=!0;do{if(this.index<=0)break;f=this.stack[--this.index]}while(!(f=f.undo(this.view,!0)));this._ignoreUndo=!1;return f},redo:function(){this._commitUndo();var f;this._ignoreUndo=!0;do{if(this.index>=this.stack.length)break;
f=this.stack[this.index++]}while(!f.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},startCompoundChange:function(f){this._commitUndo();f=new l(f);this.add(f);this.compoundChange=f;this.compoundChange.start(this.view);return this.compoundChange},_commitUndo:function(){this.endCompoundChange()},_onDestroy:function(){this.model.removeEventListener("Changing",this._listener.onChanging);
this.view.removeEventListener("Destroy",this._listener.onDestroy)},_onChanging:function(f){if(!this._ignoreUndo){var c=f.text,d=f.start,b=f.addedCharCount,h=f.removedCharCount,f=d+h,k=0;b===0&&h===1?k=-1:b===1&&h===0&&(k=1);b=this.stack.length;h=this.model.getText(d,f);(!(b>0&&this.index===b)||!this.stack[b-1].merge(d,c,h,k,f))&&this.add(new g(d,c,h,k))}}};return{UndoStack:i}});
define("orion/editor/rulers",["i18n!orion/editor/nls/messages","orion/editor/annotations","orion/editor/tooltip","orion/util"],function(g,l,i,f){function c(b,a,c,d){this._location=a||"left";this._overview=c||"page";this._rulerStyle=d;this._view=null;var f=this;this._listener={onTextModelChanged:function(a){f._onTextModelChanged(a)},onAnnotationModelChanged:function(a){f._onAnnotationModelChanged(a)}};this.setAnnotationModel(b)}function d(b,a,d,f,h){c.call(this,b,a,"page",d);this._oddStyle=f||{style:{backgroundColor:"white"}};
this._evenStyle=h||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._firstLine=1}function b(b,a,d){c.call(this,b,a,"page",d)}function h(b,a,d){c.call(this,b,a,"document",d)}function k(c,a,d){b.call(this,c,a,d)}c.prototype={getAnnotations:function(b,a){var c=this._annotationModel;if(!c)return[];var d=this._view.getModel(),f=d.getLineStart(b),h=d.getLineEnd(a-1),g=d;d.getBaseModel&&(g=d.getBaseModel(),f=d.mapOffset(f),h=d.mapOffset(h));for(var k=[],c=this.getAnnotationsByType(c,f,h),f=0;f<
c.length;f++)for(var h=c[f],i=g.getLineAtOffset(h.start),l=g.getLineAtOffset(Math.max(h.start,h.end-1)),x=i;x<=l;x++){var u=x;if(d!==g){u=g.getLineStart(x);u=d.mapOffset(u,!0);if(u===-1)continue;u=d.getLineAtOffset(u)}if(b<=u&&u<a){var o=this._mergeAnnotation(k[u],h,x-i,l-i+1);o&&(k[u]=o)}}if(!this._multiAnnotation&&this._multiAnnotationOverlay)for(var r in k)k[r]._multiple&&(k[r].html+=this._multiAnnotationOverlay.html);return k},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(b){this._annotationModel&&this._annotationModel.removEventListener("Changed",this._listener.onAnnotationModelChanged);(this._annotationModel=b)&&this._annotationModel.addEventListener("Changed",this._listener.onAnnotationModelChanged)},setMultiAnnotation:function(b){this._multiAnnotation=b},setMultiAnnotationOverlay:function(b){this._multiAnnotationOverlay=
b},setView:function(b){this._onTextModelChanged&&this._view&&this._view.removeEventListener("ModelChanged",this._listener.onTextModelChanged);this._view=b;this._onTextModelChanged&&this._view&&this._view.addEventListener("ModelChanged",this._listener.onTextModelChanged)},onClick:function(b){if(b!==void 0){var a=this._view,c=a.getModel(),d=c,f=c.getLineStart(b),h=f,g=f,k=this._annotationModel;if(k){a=a.getSelection();g=c.getLineEnd(b,!0);if(f<=a.start&&a.start<g)f=a.start;c.getBaseModel&&(f=c.mapOffset(f),
g=c.mapOffset(g),d=c.getBaseModel());for(var l,g=k.getAnnotations(f,g),k=null;!l&&g.hasNext();)a=g.next(),this.isAnnotationTypeVisible(a.type)&&(k=a,a.start<=f||(l=a));if(k&&k.groupId!==void 0)this._currentClickGroup=this._currentClickGroup===k.groupId?null:k.groupId,this._setCurrentGroup(b);l&&d.getLineAtOffset(l.start)===d.getLineAtOffset(f)?(f=l.start,g=l.end):g=f=h;c.getBaseModel&&(f=c.mapOffset(f,!0),g=c.mapOffset(g,!0))}(b=i.Tooltip.getTooltip(this._view))&&b.setTarget(null);this._view.setSelection(g,
f,1/3,function(){})}},onDblClick:function(){},onMouseMove:function(b,a){var c=i.Tooltip.getTooltip(this._view);if(c&&!(c.isVisible()&&this._tooltipLineIndex===b)){this._tooltipLineIndex=b;var d=this;c.setTarget({y:a.clientY,getTooltipInfo:function(){return d._getTooltipInfo(d._tooltipLineIndex,this.y)}})}},onMouseOver:function(b,a){this.onMouseMove(b,a);this._currentClickGroup||this._setCurrentGroup(b)},onMouseOut:function(){this._currentClickGroup||this._setCurrentGroup(-1);var b=i.Tooltip.getTooltip(this._view);
b&&b.setTarget(null)},_getTooltipInfo:function(b,a){if(b!==void 0){var c=this._view,d=c.getModel(),f=this._annotationModel,h=[];if(f){var h=d.getLineStart(b),g=d.getLineEnd(b);d.getBaseModel&&(h=d.mapOffset(h),g=d.mapOffset(g));h=this.getAnnotationsByType(f,h,g)}f=this._getTooltipContents(b,h);if(!f)return null;f={contents:f,anchor:this.getLocation()};h=c.getClientArea();h.y=this.getOverview()==="document"?c.convert({y:a},"view","document").y:c.getLocationAtOffset(d.getLineStart(b)).y;c.convert(h,
"document","page");f.x=h.x;f.y=h.y;f.anchor==="right"&&(f.x+=h.width);return f}},_getTooltipContents:function(b,a){return a},_onAnnotationModelChanged:function(b){function a(a){for(var b=0;b<a.length;b++)if(f.isAnnotationTypeVisible(a[b].type)){var e=a[b].start,h=a[b].end;d.getBaseModel&&(e=d.mapOffset(e,!0),h=d.mapOffset(h,!0));e!==-1&&h!==-1&&c.redrawLines(d.getLineAtOffset(e),d.getLineAtOffset(Math.max(e,h-1))+1,f)}}var c=this._view;if(c){var d=c.getModel(),f=this,h=d.getLineCount();b.textModelChangedEvent?
(b=b.textModelChangedEvent.start,d.getBaseModel&&(b=d.mapOffset(b,!0)),b=d.getLineAtOffset(b),c.redrawLines(b,h,f)):(a(b.added),a(b.removed),a(b.changed))}},_mergeAnnotation:function(b,a,c){b||(b={});if(c===0)if(b.html&&a.html){if(a.html!==b.html&&!b._multiple&&this._multiAnnotation)b.html=this._multiAnnotation.html;b._multiple=!0}else b.html=a.html;b.style=this._mergeStyle(b.style,a.style);return b},_mergeStyle:function(b,a){if(a){b||(b={});b.styleClass&&a.styleClass&&b.styleClass!==a.styleClass?
b.styleClass+=" "+a.styleClass:b.styleClass=a.styleClass;var c;if(a.style){if(!b.style)b.style={};for(c in a.style)b.style[c]===void 0&&(b.style[c]=a.style[c])}if(a.attributes){if(!b.attributes)b.attributes={};for(c in a.attributes)b.attributes[c]===void 0&&(b.attributes[c]=a.attributes[c])}}return b},_setCurrentGroup:function(b){var a=this._annotationModel,c=null,d=a.getTextModel(),f,h,g=this._currentGroupAnnotation;if(b!==-1){var k=d.getLineStart(b),i=d.getLineEnd(b);d.getBaseModel&&(k=d.mapOffset(k),
i=d.mapOffset(i));for(h=a.getAnnotations(k,i);h.hasNext();)if(f=h.next(),this.isAnnotationTypeVisible(f.type)&&f.start<=k&&f.end>=i&&f.groupId!==void 0){c=f;break}if(g&&c&&g.groupId===c.groupId)return}this._currentGroupAnnotation=null;g&&a.removeAnnotations(g.groupType);if(c&&b!==-1){this._currentGroupAnnotation=c;h=a.getAnnotations(0,d.getCharCount());for(b=[];h.hasNext();)f=h.next(),delete f.groupAnnotation,f.groupId===c.groupId&&(f=f.createGroupAnnotation(),b.push(f));a.replaceAnnotations(null,
b)}}};l.AnnotationTypeList.addMixin(c.prototype);d.prototype=new c;d.prototype.getAnnotations=function(b,a){for(var d=c.prototype.getAnnotations.call(this,b,a),f=this._view.getModel(),h=b;h<a;h++){var g=h&1?this._oddStyle:this._evenStyle,k=h;f.getBaseModel&&(k=f.getLineStart(k),k=f.getBaseModel().getLineAtOffset(f.mapOffset(k)));d[h]||(d[h]={});d[h].html=this._firstLine+k+"";if(!d[h].style)d[h].style=g}return d};d.prototype.getWidestAnnotation=function(){var b=this._view.getModel().getLineCount();
return this.getAnnotations(b-1,b)[b-1]};d.prototype.setFirstLine=function(b){this._firstLine=b!==void 0?b:1};d.prototype._onTextModelChanged=function(b){var b=b.start,a=this._view.getModel(),c=(this._firstLine+(a.getBaseModel?a.getBaseModel().getLineCount():a.getLineCount())-1+"").length;if(this._numOfDigits!==c)this._numOfDigits=c,this._view.redrawLines(a.getLineAtOffset(b),a.getLineCount(),this)};b.prototype=new c;h.prototype=new c;h.prototype.getRulerStyle=function(){var b={style:{lineHeight:"1px",
fontSize:"1px"}};return b=this._mergeStyle(b,this._rulerStyle)};h.prototype._getTooltipContents=function(b,a){if(a.length===0){var d=this._view.getModel(),h=b;d.getBaseModel&&(h=d.getLineStart(h),h=d.getBaseModel().getLineAtOffset(d.mapOffset(h)));return f.formatMessage(g.line,h+1)}return c.prototype._getTooltipContents.call(this,b,a)};h.prototype._mergeAnnotation=function(b,a,c,d){if(c===0){if(!b)b={html:"&nbsp;",style:{style:{height:3*d+"px"}}},b.style=this._mergeStyle(b.style,a.overviewStyle);
return b}};k.prototype=new b;k.prototype.onClick=function(b){if(b!==void 0){var a=this._annotationModel;if(a){var c=this._view.getModel(),d=c.getLineStart(b),b=c.getLineEnd(b,!0);c.getBaseModel&&(d=c.mapOffset(d),b=c.mapOffset(b),c=c.getBaseModel());for(var f,a=a.getAnnotations(d,b);!f&&a.hasNext();)b=a.next(),this.isAnnotationTypeVisible(b.type)&&(f=b);f&&c.getLineAtOffset(f.start)===c.getLineAtOffset(d)&&((c=i.Tooltip.getTooltip(this._view))&&c.setTarget(null),f.expanded?f.collapse():f.expand(),
this._annotationModel.modifyAnnotation(f))}}};k.prototype._getTooltipContents=function(c,a){return a.length===1&&a[0].expanded?null:b.prototype._getTooltipContents.call(this,c,a)};k.prototype._onAnnotationModelChanged=function(c){function a(a){for(g=0;g<a.length;g++)if(h.isAnnotationTypeVisible(a[g].type)){var b=a[g].start;f.getBaseModel&&(b=f.mapOffset(b,!0));b!==-1&&(i=Math.min(i,f.getLineAtOffset(b)))}}if(c.textModelChangedEvent)b.prototype._onAnnotationModelChanged.call(this,c);else{var d=this._view;
if(d){var f=d.getModel(),h=this,g,k=f.getLineCount(),i=k;a(c.added);a(c.removed);a(c.changed);c=d.getRulers();for(g=0;g<c.length;g++)d.redrawLines(i,k,c[g])}}};return{Ruler:c,AnnotationRuler:b,LineNumberRuler:d,OverviewRuler:h,FoldingRuler:k}});
define("orion/editor/textDND",["orion/util"],function(g){function l(g,f){this._view=g;this._undoStack=f;this._dragSelection=null;this._dropOffset=-1;this._dropText=null;var c=this;this._listener={onDragStart:function(d){c._onDragStart(d)},onDragEnd:function(d){c._onDragEnd(d)},onDragEnter:function(d){c._onDragEnter(d)},onDragOver:function(d){c._onDragOver(d)},onDrop:function(d){c._onDrop(d)},onDestroy:function(d){c._onDestroy(d)}};g.addEventListener("DragStart",this._listener.onDragStart);g.addEventListener("DragEnd",
this._listener.onDragEnd);g.addEventListener("DragEnter",this._listener.onDragEnter);g.addEventListener("DragOver",this._listener.onDragOver);g.addEventListener("Drop",this._listener.onDrop);g.addEventListener("Destroy",this._listener.onDestroy)}l.prototype={destroy:function(){var g=this._view;if(g)g.removeEventListener("DragStart",this._listener.onDragStart),g.removeEventListener("DragEnd",this._listener.onDragEnd),g.removeEventListener("DragEnter",this._listener.onDragEnter),g.removeEventListener("DragOver",
this._listener.onDragOver),g.removeEventListener("Drop",this._listener.onDrop),g.removeEventListener("Destroy",this._listener.onDestroy),this._view=null},_onDestroy:function(){this.destroy()},_onDragStart:function(g){var f=this._view,c=f.getSelection(),f=f.getModel();if(f.getBaseModel)c.start=f.mapOffset(c.start),c.end=f.mapOffset(c.end),f=f.getBaseModel();if(f=f.getText(c.start,c.end))this._dragSelection=c,g.event.dataTransfer.effectAllowed="copyMove",g.event.dataTransfer.setData("Text",f)},_onDragEnd:function(i){if(this._dragSelection){var f=
this._view,c=i.event.dataTransfer.dropEffect;if(!g.isFirefox&&(c!=="none"||this._dropText))c=i.event.dataTransfer.dropEffect=this._dropEffect;this._undoStack&&this._undoStack.startCompoundChange();(i=c==="move")&&f.setText("",this._dragSelection.start,this._dragSelection.end);if(this._dropText){var c=this._dropText,d=this._dropOffset;if(i)if(d>=this._dragSelection.end)d-=this._dragSelection.end-this._dragSelection.start;else if(d>=this._dragSelection.start)d=this._dragSelection.start;f.setText(c,
d,d);f.setSelection(d,d+c.length);this._dropText=null;this._dropOffset=-1}this._undoStack&&this._undoStack.endCompoundChange()}this._dragSelection=null},_onDragEnter:function(g){this._onDragOver(g)},_onDragOver:function(i){var f=i.event.dataTransfer.types,c=!this._view.getOptions("readonly");c&&f&&(c=f.contains?f.contains("text/plain")||f.contains("Text"):f.indexOf("text/plain")!==-1||f.indexOf("Text")!==-1);if(c){if(!g.isFirefox)this._dropEffect=i.event.dataTransfer.dropEffect=(g.isMac?i.event.altKey:
i.event.ctrlKey)?"copy":"move"}else i.event.dataTransfer.dropEffect="none"},_onDrop:function(i){var f=this._view,c=i.event.dataTransfer.getData("Text");if(c){if(!g.isFirefox)i.event.dataTransfer.dropEffect=this._dropEffect;i=f.getOffsetAtLocation(i.x,i.y);this._dragSelection?(this._dropOffset=i,this._dropText=c):(f.setText(c,i,i),f.setSelection(i,i+c.length))}}};return{TextDND:l}});
define("orion/editor/templates",[],function(){function g(g,f,c){this.prefix=g;this.description=f;this.template=c;this._parse()}function l(g,f){this._keywords=g||[];this._templates=[];this.addTemplates(f||[])}g.prototype={getProposal:function(g,f,c){var g=f-g.length,f={},d,b=c.delimiter!==void 0?c.delimiter:"\n";c.indentation&&(b+=c.indentation);for(var h=c.tab!==void 0?c.tab:"\t",k=0,e=this.variables,a=this.segments,c=[],j=0;j<a.length;j++){var l=a[j],m=e[l];if(m!==void 0)switch(l){case "${tab}":l=
h;break;case "${delimiter}":l=b;break;case "${cursor}":l="";d=k;break;default:var n=f[l];n||(n=f[l]={data:m.data,positions:[]});l=m.substitution;n.data&&n.data.values&&(l=n.data.values[0]);n.positions.push({offset:g+k,length:l.length})}c.push(l);k+=l.length}var b=[],s;for(s in f)f.hasOwnProperty(s)&&b.push(f[s]);c=c.join("");if(d===void 0)d=c.length;return{proposal:c,description:this.description,groups:b,escapePosition:g+d}},match:function(g){return this.prefix.indexOf(g)===0},_parse:function(){var g=
this.template,f=[],c={},d,b=0,g=g.replace(/\n/g,"${delimiter}"),g=g.replace(/\t/g,"${tab}");g.replace(/\$\{((?:[^\\}]+|\\.))*\}/g,function(h,k,e){var a=h.substring(2,h.length-1),k=h,j=a,l=null,m=j.indexOf(":");m!==-1&&(j=j.substring(0,m),k="${"+j+"}",l=JSON.parse(a.substring(m+1).replace("\\}","}").trim()));(a=c[k])||(a=c[k]={});a.substitution=j;if(l)a.data=l;(d=g.substring(b,e))&&f.push(d);f.push(k);b=e+h.length;return j});(d=g.substring(b,g.length))&&f.push(d);this.segments=f;this.variables=c}};
l.prototype={addTemplates:function(i){for(var f=this.getTemplates(),c=0;c<i.length;c++)f.push(new g(i[c].prefix,i[c].description,i[c].template))},computeProposals:function(g,f,c){var d=this.getPrefix(g,f,c),b=[];if(!this.isValid(d,g,f,c))return b;b=b.concat(this.getTemplateProposals(d,f,c));return b=b.concat(this.getKeywordProposals(d))},getKeywords:function(){return this._keywords},getKeywordProposals:function(g){var f=[],c=this.getKeywords();if(c)for(var d=0;d<c.length;d++)c[d].indexOf(g)===0&&
f.push({proposal:c[d].substring(g.length),description:c[d]});return f},getPrefix:function(g,f,c){return c.prefix},getTemplates:function(){return this._templates},getTemplateProposals:function(g,f,c){for(var d=[],b=this.getTemplates(),h=0;h<b.length;h++){var k=b[h];k.match(g)&&(k=k.getProposal(g,f,c),this.removePrefix(g,k),d.push(k))}return d},removePrefix:function(g,f){if(!(f.overwrite=f.proposal.substring(0,g.length)!==g))f.proposal=f.proposal.substring(g.length)},isValid:function(){return!0}};return{Template:g,
TemplateContentAssist:l}});
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(g,l,i,f,c,d){function b(b,c,a){var d=b.getTextView();i.KeyMode.call(this,d);this.editor=b;this.undoStack=c;this.contentAssist=a;this.linkedModeModel=null;d.setAction("linkedModeEnter",function(){this.exitLinkedMode(!0);return!0}.bind(this));d.setAction("linkedModeCancel",function(){this.exitLinkedMode(!1);return!0}.bind(this));
d.setAction("linkedModeNextGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup((a.selectedGroupIndex+1)%a.groups.length);return!0}.bind(this));d.setAction("linkedModePreviousGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup(a.selectedGroupIndex>0?a.selectedGroupIndex-1:a.groups.length-1);return!0}.bind(this));this.linkedModeListener={onActivating:function(){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),c=this.linkedModeModel,d,e;c;)if(d=this._getPositionChanged(c,b,b+a.removedCharCount),e=d.position,e===void 0||e.model!==c)this.exitLinkedMode(!1),c=this.linkedModeModel;else break;if(c){c=0;a=a.addedCharCount-a.removedCharCount;d=d.positions;for(var f,h=0;h<d.length;++h){f=d[h];e=f.position;var g=e.offset<=b&&b<=e.offset+e.length;g&&!f.ansestor?(e.offset+=c,e.length+=a,c+=a):(e.offset+=c,f.ansestor&&g&&(e.length+=
a));if(f.escape)f.model.escapePosition=e.offset}this._updateAnnotations(d)}}}.bind(this),onVerify:function(a){if(!this.ignoreVerify){for(var b=this.editor,c=b.mapOffset(a.start),d=this.editor.mapOffset(a.end),e=this.linkedModeModel,f,h;e;)if(f=this._getPositionChanged(e,c,d),h=f.position,h===void 0||h.model!==e)this.exitLinkedMode(!1),e=this.linkedModeModel;else break;if(e){var g=this._compoundChange;g?g.owner.model===e&&g.owner.group===h.group||(this.endUndo(),this.startUndo()):this.startUndo();
e.selectedGroupIndex=h.group;var g=0,k=a.text.length-(d-c);f=f.positions;var j;c-=h.position.offset;for(var i=d-h.position.offset,l=0;l<f.length;++l)if(j=f[l],d=j.position,j.oldOffset=d.offset,j.model===e&&j.group===h.group?(d.offset+=g,d.length+=k,g+=k):(d.offset+=g,j.ansestor&&(d.length+=h.count*k)),j.escape)j.model.escapePosition=d.offset;this.ignoreVerify=!0;for(l=f.length-1;l>=0;l--)j=f[l],j.model===e&&j.group===h.group&&b.setText(a.text,j.oldOffset+c,j.oldOffset+i);this.ignoreVerify=!1;a.text=
null;this._updateAnnotations(f)}}}.bind(this)}}var h={};b.prototype=new i.KeyMode;d.mixin(b.prototype,{createKeyBindings:function(){var b=l.KeyBinding,c=[];c.push({actionID:"linkedModeEnter",keyBinding:new b(13)});c.push({actionID:"linkedModeCancel",keyBinding:new b(27)});c.push({actionID:"linkedModeNextGroup",keyBinding:new b(9)});c.push({actionID:"linkedModePreviousGroup",keyBinding:new b(9,!1,!0)});return c},enterLinkedMode:function(b){if(!this.linkedModeModel){var c=this.editor.getTextView();
c.addKeyMode(this);c.addEventListener("Verify",this.linkedModeListener.onVerify);c.addEventListener("ModelChanged",this.linkedModeListener.onModelChanged);this.contentAssist.addEventListener("Activating",this.linkedModeListener.onActivating);this.editor.reportStatus(g.linkedModeEntered,null,!0)}this._sortedPositions=null;if(this.linkedModeModel)b.previousModel=this.linkedModeModel,b.parentGroup=this.linkedModeModel.selectedGroupIndex,this.linkedModeModel.nextModel=b;this.linkedModeModel=b;this.selectLinkedGroup(0)},
exitLinkedMode:function(b){if(this.isActive()){if(this._compoundChange)this.endUndo(),this._compoundChange=null;this._sortedPositions=null;var c=this.linkedModeModel;this.linkedModeModel=c.previousModel;c.parentGroup=c.previousModel=void 0;if(this.linkedModeModel)this.linkedModeModel.nextModel=void 0;if(!this.linkedModeModel){var a=this.editor,d=a.getTextView();d.removeKeyMode(this);d.removeEventListener("Verify",this.linkedModeListener.onVerify);d.removeEventListener("ModelChanged",this.linkedModeListener.onModelChanged);
d=this.contentAssist;d.removeEventListener("Activating",this.linkedModeListener.onActivating);d.offset=void 0;this.editor.reportStatus(g.linkedModeExited,null,!0);b&&a.setCaretOffset(c.escapePosition,!1)}this.selectLinkedGroup(0)}},startUndo:function(){if(this.undoStack){var b=this,c=this.linkedModeModel;this._compoundChange=this.undoStack.startCompoundChange({model:c,group:c.selectedGroupIndex,end:function(){b._compoundChange=null}})}},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()},
isActive:function(){return!!this.linkedModeModel},isStatusActive:function(){return!!this.linkedModeModel},selectLinkedGroup:function(b){var d=this.linkedModeModel;if(d){d.selectedGroupIndex=b;var b=d.groups[b],a=b.positions[0],f=this.editor;f.setSelection(a.offset,a.offset+a.length);if(d=this.contentAssist)if(d.offset=void 0,b.data&&b.data.type==="link"&&b.data.values)(this._groupContentAssistProvider=new c.TemplateContentAssist(b.data.values)).getPrefix=function(){var b=f.getSelection();return b.start===
b.end&&(b=f.getCaretOffset(),a.offset<=b&&b<=a.offset+a.length)?f.getText(a.offset,b):""},d.offset=a.offset,d.deactivate(),d.activate();else if(this._groupContentAssistProvider)this._groupContentAssistProvider=null,d.deactivate()}this._updateAnnotations()},_getModelPositions:function(b,c,a){for(var d=c.groups,f=0;f<d.length;f++)for(var h=d[f].positions,g=0;g<h.length;g++){var i=h[g];a&&(i={offset:i.offset+a,length:i.length});i={index:g,group:f,count:h.length,model:c,position:i};b.push(i);if(c.nextModel&&
c.nextModel.parentGroup===f)i.ansestor=!0,this._getModelPositions(b,c.nextModel,(a||0)+h[g].offset-h[0].offset)}},_getSortedPositions:function(b){var c=this._sortedPositions;if(!c){for(c=[];b.previousModel;)b=b.previousModel;for(this._getModelPositions(c,b);b;)b.escapePosition!==void 0&&c.push({escape:!0,model:b,position:{offset:b.escapePosition,length:0}}),b=b.nextModel;c.sort(function(a,b){return a.position.offset-b.position.offset});this._sortedPositions=c}return c},_getPositionChanged:function(b,
c,a){for(var d,b=this._getSortedPositions(b),f=b.length-1;f>=0;f--){var h=b[f].position;if(h.offset<=c&&a<=h.offset+h.length){d=b[f];break}}return{position:d,positions:b}},_updateAnnotations:function(b){var c=this.editor.getAnnotationModel();if(c){for(var a=[],d=[],h=c.getTextModel(),h=c.getAnnotations(0,h.getCharCount()),g;h.hasNext();)switch(g=h.next(),g.type){case f.AnnotationType.ANNOTATION_LINKED_GROUP:case f.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP:case f.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:a.push(g)}if(h=
this.linkedModeModel)for(var b=b||this._getSortedPositions(h),i=0;i<b.length;i++)if(g=b[i],g.model===h){var l=f.AnnotationType.ANNOTATION_LINKED_GROUP;g.group===h.selectedGroupIndex&&(l=g.index===0?f.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:f.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP);g=g.position;g=f.AnnotationType.createAnnotation(l,g.offset,g.offset+g.length,"");d.push(g)}c.replaceAnnotations(a,d)}}});h.LinkedMode=b;return h});
define("orion/editor/factories","orion/editor/actions,orion/editor/undoStack,orion/editor/rulers,orion/editor/annotations,orion/editor/textDND,orion/editor/linkedMode".split(","),function(g,l,i,f,c,d){function b(){}function h(){}function k(){}function e(){}function a(){}function j(){}var p={};b.prototype={createKeyBindings:function(a,b,c,e){var e=new g.TextActions(a,b,e),f=new d.LinkedMode(a,b,c),a=new g.SourceCodeActions(a,b,c,f);return{textActions:e,linkedMode:f,sourceCodeActions:a}}};p.KeyBindingsFactory=
b;h.prototype={createUndoStack:function(a){a=a.getTextView();return new l.UndoStack(a,200)}};p.UndoFactory=h;k.prototype={createLineNumberRuler:function(a){return new i.LineNumberRuler(a,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"})}};p.LineNumberRulerFactory=k;e.prototype={createFoldingRuler:function(a){return new i.FoldingRuler(a,"left",{styleClass:"ruler folding"})}};p.FoldingRulerFactory=e;a.prototype={createAnnotationModel:function(a){return new f.AnnotationModel(a)},
createAnnotationStyler:function(a,b){return new f.AnnotationStyler(a,b)},createAnnotationRulers:function(a){var b=new i.AnnotationRuler(a,"left",{styleClass:"ruler annotations"}),a=new i.OverviewRuler(a,"right",{styleClass:"ruler overview"});return{annotationRuler:b,overviewRuler:a}}};p.AnnotationFactory=a;j.prototype={createTextDND:function(a,b){return new c.TextDND(a.getTextView(),b)}};p.TextDNDFactory=j;return p});
define("orion/editor/editorFeatures",["orion/editor/factories","orion/editor/actions","orion/editor/linkedMode","orion/objects"],function(g,l,i,f){return f.mixin({},g,l,i)});
define("orion/editor/contentAssist","i18n!orion/editor/nls/messages,orion/keyBinding,orion/editor/keyModes,orion/editor/eventTarget,orion/Deferred,orion/objects,orion/editor/util,orion/util".split(","),function(g,l,i,f,c,d,b,h){var k,e,a;function j(a){return a.reduce(function(a,b){return Array.isArray(b)?a.concat(b):a},[])}function p(b){this.textView=b;this.state=k;this.providers=[];var c=this;this.contentAssistListener={onModelChanging:function(b){c.isDeactivatingChange(b)?c.setState(k):c.state===
e&&c.setState(a)},onScroll:function(){c.setState(k)},onSelection:function(){var b=c.state;if(b===e||b===a)c.computeProposals(),c.setState(a)}};b.setKeyBinding(h.isMac?new l.KeyBinding(" ",!1,!1,!1,!0):new l.KeyBinding(" ",!0),"contentAssist");b.setAction("contentAssist",function(){b.getOptions("readonly")||c.activate();return!0},{name:g.contentAssist})}function m(a,b){var c=a.textView;i.KeyMode.call(this,c);this.contentAssist=a;this.widget=b;this.proposals=[];var d=this;this.contentAssist.addEventListener("ProposalsComputed",
function(a){d.proposals=a.data.proposals;d.proposals.length===0?(d.selectedIndex=-1,d.cancel()):d.selectedIndex=0});c.setAction("contentAssistApply",function(){return this.enter()}.bind(this));c.setAction("contentAssistCancel",function(){return this.cancel()}.bind(this));c.setAction("contentAssistNextProposal",function(){return this.lineDown()}.bind(this));c.setAction("contentAssistPreviousProposal",function(){return this.lineUp()}.bind(this));c.setAction("contentAssistNextPage",function(){return this.pageDown()}.bind(this));
c.setAction("contentAssistPreviousPage",function(){return this.pageUp()}.bind(this));c.setAction("contentAssistTab",function(){return this.tab()}.bind(this))}function n(a,c){this.contentAssist=a;this.textView=this.contentAssist.getTextView();this.isShowing=this.textViewListenerAdded=!1;var d=this.textView.getOptions("parent").ownerDocument;this.parentNode=typeof c==="string"?d.getElementById(c):c;if(!this.parentNode){this.parentNode=h.createElement(d,"div");this.parentNode.className="contentassist";
var e=d.getElementsByTagName("body")[0];if(e)e.appendChild(this.parentNode);else throw Error("parentNode is required");}var f=this;this.textViewListener={onMouseDown:function(a){(a.event.target||a.event.srcElement).parentElement!==f.parentNode&&f.contentAssist.deactivate()}};this.contentAssist.addEventListener("ProposalsComputed",function(a){f.setProposals(a.data.proposals);f.show();if(!f.textViewListenerAdded)f.textView.addEventListener("MouseDown",f.textViewListener.onMouseDown),f.textViewListenerAdded=
!0});this.contentAssist.addEventListener("Deactivating",function(){f.setProposals([]);f.hide();if(f.textViewListenerAdded)f.textView.removeEventListener("MouseDown",f.textViewListener.onMouseDown),f.textViewListenerAdded=!1;f.textViewListenerAdded=!1});this.scrollListener=function(){f.isShowing&&f.position()};b.addEventListener(d,"scroll",this.scrollListener)}k=1;e=2;a=3;var s={selected:" selected",hr:"proposal-hr",emphasis:"proposal-emphasis",noemphasis:"proposal-noemphasis",dfault:"proposal-default"};
p.prototype={apply:function(a){if(!a)return!1;var b=this.textView,c=b.getSelection(),d=Math.min(c.start,c.end),e=d,f=c=Math.max(c.start,c.end),h=b.getModel();h.getBaseModel&&(e=h.mapOffset(e),f=h.mapOffset(f),h=h.getBaseModel());a.overwrite&&(d=this.getPrefixStart(h,e));e={proposal:a,start:e,end:f};this.setState(k);b.setText(typeof a==="string"?a:a.proposal,d,c);this.dispatchEvent({type:"ProposalApplied",data:e});return!0},activate:function(){this.state===k&&this.setState(e)},deactivate:function(){this.setState(k)},
getTextView:function(){return this.textView},isActive:function(){return this.state===e||this.state===a},isDeactivatingChange:function(a){var b=a.removedCharCount>0&&a.addedCharCount===0,c=this.textView,c=a.start+1<=c.getModel().getCharCount()&&/^\s*$/.test(c.getText(a.start,a.start+1));return a.removedLineCount>0||a.addedLineCount>0||b&&c},setState:function(a){var b;a===e?(b="Activating",this._mode&&this._mode.setActive(!0)):a===k&&(b="Deactivating",this._mode&&this._mode.setActive(!1));b&&this.dispatchEvent({type:b});
this.state=a;this.onStateChange(a)},setMode:function(a){this._mode=a},onStateChange:function(a){if(a===k){if(this.listenerAdded)this.textView.removeEventListener("ModelChanging",this.contentAssistListener.onModelChanging),this.textView.removeEventListener("Scroll",this.contentAssistListener.onScroll),this.textView.removeEventListener("Selection",this.contentAssistListener.onSelection),this.listenerAdded=!1}else if(a===e){if(!this.listenerAdded)this.textView.addEventListener("ModelChanging",this.contentAssistListener.onModelChanging),
this.textView.addEventListener("Scroll",this.contentAssistListener.onScroll),this.textView.addEventListener("Selection",this.contentAssistListener.onSelection),this.listenerAdded=!0;this.computeProposals()}},computeProposals:function(){var a=this;this._computeProposals(this.textView.getCaretOffset()).then(function(b){a.isActive()&&a.dispatchEvent({type:"ProposalsComputed",data:{proposals:b}})})},getPrefixStart:function(a,b){for(var c=b;c>0&&/[A-Za-z0-9_]/.test(a.getText(c-1,c));)c--;return c},handleError:function(a){typeof console!==
"undefined"&&(console.log("Error retrieving content assist proposals"),console.log(a&&a.stack))},_computeProposals:function(a){var b=this.providers,d=this.textView,e=d.getSelection(),f=d.getModel(),h=a;if(f.getBaseModel)h=f.mapOffset(h),e.start=f.mapOffset(e.start),e.end=f.mapOffset(e.end),f=f.getBaseModel();for(var a=f.getLine(f.getLineAtOffset(h)),g=0;g<a.length&&/\s/.test(a.charAt(g));)g++;var g=a.substring(0,g),d=d.getOptions("tabSize","expandTab"),d=d.expandTab?Array(d.tabSize+1).join(" "):"\t",
k={line:a,offset:h,prefix:f.getText(this.getPrefixStart(f,h),h),selection:e,delimiter:f.getLineDelimiter(),tab:d,indentation:g},i=this,b=b.map(function(a){var b;try{var d,e;if(d=a.computeContentAssist){var g=i.editorContextProvider&&i.editorContextProvider();e=d.apply(a,[g,k])}else if(d=a.getProposals||a.computeProposals)e=d.apply(a,[f.getText(),h,k]);b=i.progress?i.progress.progress(e,"Generating content assist proposal"):e}catch(j){i.handleError(j)}return c.when(b)});return c.all(b,this.handleError).then(j)},
setEditorContextFactory:function(a){this.editorContextProvider=a},setProviders:function(a){this.providers=a.slice(0)},setProgress:function(a){this.progress=a}};f.EventTarget.addMixin(p.prototype);m.prototype=new i.KeyMode;d.mixin(m.prototype,{createKeyBindings:function(){var a=l.KeyBinding,b=[];b.push({actionID:"contentAssistApply",keyBinding:new a(13)});b.push({actionID:"contentAssistCancel",keyBinding:new a(27)});b.push({actionID:"contentAssistNextProposal",keyBinding:new a(40)});b.push({actionID:"contentAssistPreviousProposal",
keyBinding:new a(38)});b.push({actionID:"contentAssistNextPage",keyBinding:new a(34)});b.push({actionID:"contentAssistPreviousPage",keyBinding:new a(33)});b.push({actionID:"contentAssistTab",keyBinding:new a(9)});return b},cancel:function(){this.getContentAssist().deactivate()},getContentAssist:function(){return this.contentAssist},isActive:function(){return this.getContentAssist().isActive()},setActive:function(a){a?this.contentAssist.textView.addKeyMode(this):this.contentAssist.textView.removeKeyMode(this)},
lineUp:function(){return this._lineUp(this.selectedIndex===0?this.proposals.length-1:this.selectedIndex-1)},_lineUp:function(a){for(;this.proposals[a].unselectable&&a>0;)a--;this.selectedIndex=a;this.widget&&this.widget.setSelectedIndex(this.selectedIndex);return!0},lineDown:function(){return this._lineDown(this.selectedIndex===this.proposals.length-1?0:this.selectedIndex+1)},_lineDown:function(a){for(;this.proposals[a].unselectable&&a<this.proposals.length-1;)a++;this.selectedIndex=a;this.widget&&
this.widget.setSelectedIndex(this.selectedIndex);return!0},pageUp:function(){if(this.widget){var a=this.widget.getTopIndex();a===this.selectedIndex&&(this.widget.scrollIndex(a,!1),a=this.widget.getTopIndex());return this._lineUp(a)}else return this.lineUp()},pageDown:function(){if(this.widget){var a=this.widget.getBottomIndex();a===this.selectedIndex&&(this.widget.scrollIndex(a,!0),a=this.widget.getBottomIndex());return this._lineDown(a)}else return this.lineDown()},enter:function(){return this.contentAssist.apply(this.proposals[this.selectedIndex]||
null)},tab:function(){return this.widget?(this.widget.createAccessible(this),this.widget.parentNode.focus(),!0):!1}});n.prototype={onClick:function(a){if(!a)a=window.event;this.contentAssist.apply(this.getProposal(a.target||a.srcElement));this.textView.focus()},createDiv:function(a,b,c,d){var e=c.ownerDocument,f=h.createElement(e,"div");f.id="contentoption"+d;f.setAttribute("role","option");a.style==="hr"?a=h.createElement(e,"hr"):(f.className=this.calculateClasses(a.style,b),a=e.createTextNode(this.getDisplayString(a)),
b&&this.parentNode.setAttribute("aria-activedescendant",f.id));f.appendChild(a,f);c.appendChild(f)},createAccessible:function(a){this._isAccessible||b.addEventListener(this.parentNode,"keydown",function(b){if(!b)b=window.event;if(b.keyCode===27)return a.cancel();else if(b.keyCode===38)return a.lineUp();else if(b.keyCode===40)return a.lineDown();else if(b.keyCode===13)return a.enter();b.preventDefault?b.preventDefault():(b.cancelBubble=!0,b.returnValue=!1,b.keyCode=0);return!1});this._isAccessible=
!0},calculateClasses:function(a,b){var c=s[a];if(!c)c=s.dfault;return b?c+s.selected:c},getDisplayString:function(a){return typeof a==="string"?a:a.description&&typeof a.description==="string"?a.description:a.proposal},getProposal:function(a){for(var b=0,c=this.parentNode.firstChild;c!==null;c=c.nextSibling){if(c===a)return this.proposals[b]||null;b++}return null},getTopIndex:function(){for(var a=this.parentNode.childNodes,b=0;b<a.length;b++)if(a[b].offsetTop>=this.parentNode.scrollTop)return b;return 0},
getBottomIndex:function(){for(var a=this.parentNode.childNodes,b=0;b<a.length;b++){var c=a[b];if(c.offsetTop+c.offsetHeight>this.parentNode.scrollTop+this.parentNode.clientHeight)return Math.max(0,b-1)}return a.length-1},scrollIndex:function(a,b){this.parentNode.childNodes[a].scrollIntoView(b)},setSelectedIndex:function(a){this.selectedIndex=a;this.selectNode(this.parentNode.childNodes[this.selectedIndex])},selectNode:function(a){for(var b=this.parentNode.childNodes,c=0;c<b.length;c++){var d=b[c],
e=d.className.indexOf(s.selected);if(e>=0)d.className=d.className.substring(0,e)+d.className.substring(e+s.selected.length);d===a&&(d.className+=s.selected,this.parentNode.setAttribute("aria-activedescendant",d.id),d.focus(),d.offsetTop<this.parentNode.scrollTop?d.scrollIntoView(!0):d.offsetTop+d.offsetHeight>this.parentNode.scrollTop+this.parentNode.clientHeight&&d.scrollIntoView(!1))}},setProposals:function(a){this.proposals=a},show:function(){if(this.proposals.length===0)this.hide();else{this.parentNode.innerHTML=
"";for(var a=0;a<this.proposals.length;a++)this.createDiv(this.proposals[a],a===0,this.parentNode,a);this.position();this.parentNode.onclick=this.onClick.bind(this);this.isShowing=!0}},hide:function(){this.parentNode.ownerDocument.activeElement===this.parentNode&&this.textView.focus();this.parentNode.style.display="none";this.parentNode.onclick=null;this.isShowing=!1},position:function(){var a=this.contentAssist,b=this.textView;if(a.offset!==void 0){var a=a.offset,c=b.getModel();c.getBaseModel&&(a=
c.mapOffset(a,!0))}else a=this.textView.getCaretOffset();a=b.getLocationAtOffset(a);a.y+=b.getLineHeight();this.textView.convert(a,"document","page");this.parentNode.style.position="fixed";this.parentNode.style.left=a.x+"px";this.parentNode.style.top=a.y+"px";this.parentNode.style.display="block";this.parentNode.scrollTop=0;b=this.parentNode.ownerDocument;c=b.documentElement.clientWidth;if(a.y+this.parentNode.offsetHeight>b.documentElement.clientHeight)this.parentNode.style.top=a.y-this.parentNode.offsetHeight-
this.textView.getLineHeight()+"px";if(a.x+this.parentNode.offsetWidth>c)this.parentNode.style.left=c-this.parentNode.offsetWidth+"px"}};return{ContentAssist:p,ContentAssistMode:m,ContentAssistWidget:n}});
define("orion/editor/emacs",["i18n!orion/editor/nls/messages","orion/editor/keyModes","orion/keyBinding","orion/util"],function(g,l,i,f){function c(c){l.KeyMode.call(this,c)}c.prototype=new l.KeyMode;c.prototype.createKeyBindings=function(){var c=[];c.push({actionID:"emacs-beginning-of-line",keyBinding:this._createStroke("a",!f.isMac,!1,!1,f.isMac)});c.push({actionID:"emacs-end-of-line",keyBinding:this._createStroke("e",!f.isMac,!1,!1,f.isMac)});c.push({actionID:"emacs-forward-char",keyBinding:this._createStroke("f",
!f.isMac,!1,!1,f.isMac)});c.push({actionID:"emacs-backward-char",keyBinding:this._createStroke("b",!f.isMac,!1,!1,f.isMac)});c.push({actionID:"emacs-forward-word",keyBinding:this._createStroke("f",!1,!1,!0)});c.push({actionID:"emacs-backward-word",keyBinding:this._createStroke("b",!1,!1,!0)});c.push({actionID:"emacs-next-line",keyBinding:this._createStroke("n",!f.isMac,!1,!1,f.isMac)});c.push({actionID:"emacs-previous-line",keyBinding:this._createStroke("p",!f.isMac,!1,!1,f.isMac)});c.push({actionID:"emacs-beginning-of-buffer",
keyBinding:this._createStroke(188,!1,!0,!0)});c.push({actionID:"emacs-end-of-buffer",keyBinding:this._createStroke(190,!1,!0,!0)});c.push({actionID:"emacs-delete-backward-char",keyBinding:this._createStroke(46,!f.isMac,!1,!1,f.isMac)});c.push({actionID:"emacs-delete-char",keyBinding:this._createStroke("d",!f.isMac,!1,!1,f.isMac)});c.push({actionID:"emacs-kill-line",keyBinding:this._createStroke("k",!f.isMac,!1,!1,f.isMac)});c.push({actionID:"emacs-kill-word",keyBinding:this._createStroke("d",!1,!1,
!0)});c.push({actionID:"emacs-backward-kill-word",keyBinding:this._createStroke(46,!1,!1,!0)});c.push({actionID:"undo",keyBinding:this._createSequence([this._createStroke("x",!0),this._createStroke("u")])});c.push({actionID:"redo",keyBinding:this._createSequence([this._createStroke("x",!0),this._createStroke("r")])});c.push({actionID:"emacs-scroll-up",keyBinding:this._createStroke("v",!f.isMac,!1,!1,f.isMac)});c.push({actionID:"emacs-scroll-down",keyBinding:this._createStroke("v",!1,!1,!0)});c.push({actionID:"emacs-set-mark-command",
keyBinding:this._createStroke(" ",!f.isMac,!1,!1,f.isMac)});c.push({actionID:"emacs-reset-mark-command",keyBinding:this._createStroke("g",!f.isMac,!1,!1,f.isMac)});c.push({actionID:"emacs-exchange-point-and-mark",keyBinding:this._createSequence([this._createStroke("x",!f.isMac,!1,!1,f.isMac),this._createStroke("x",!f.isMac,!1,!1,f.isMac)])});for(var b=0;b<=9;b++)c.push({actionID:"emacs-digit-argument-"+b,keyBinding:this._createStroke(48+b,!f.isMac,!1,!1,f.isMac)}),c.push({actionID:"emacs-digit-argument-"+
b,keyBinding:this._createStroke(48+b,!1,!1,!0)}),c.push({actionID:"emacs-digit-argument-"+b,keyBinding:this._createStroke(48+b,!f.isMac,!1,!0,f.isMac)});c.push({actionID:"emacs-negative-argument",keyBinding:this._createStroke(189,!f.isMac,!1,!1,f.isMac)});c.push({actionID:"emacs-negative-argument",keyBinding:this._createStroke(189,!1,!1,!0)});c.push({actionID:"emacs-negative-argument",keyBinding:this._createStroke(189,!f.isMac,!1,!0,f.isMac)});c.push({actionID:"emacs-uppercase",keyBinding:this._createStroke("u",
!1,!1,!0)});c.push({actionID:"emacs-lowercase",keyBinding:this._createStroke("l",!1,!1,!0)});c.push({actionID:"emacs-capitalize",keyBinding:this._createStroke("c",!1,!1,!0)});c.push({actionID:"contentAssist",keyBinding:this._createStroke(191,!1,!1,!0)});c.push({actionID:"find",keyBinding:this._createStroke("r",!1,!1,!0)});c.push({actionID:"incrementalFind",keyBinding:this._createStroke("s",!0)});c.push({actionID:"incrementalFindReverse",keyBinding:this._createStroke("r",!0)});c.push({actionID:"save",
keyBinding:this._createSequence([this._createStroke("x",!f.isMac,!1,!1,f.isMac),this._createStroke("s",!f.isMac,!1,!1,f.isMac)])});this._createActions(this.getView());return c};c.prototype._createStroke=function(c,b,f,k,e){c=new i.KeyStroke(c,b,f,k,e);c.scopeName=g.emacs;return c};c.prototype._createSequence=function(c){c=new i.KeySequence(c);c.scopeName=g.emacs;return c};c.prototype._getData=function(){var c={count:(this._argument||1)*(this._sign||1)};this._argument=0;this._sign=1;return c};c.prototype._moveCursor=
function(c){var b=this._getData();if(this._marker)b.select=!0;return this.getView().invokeAction(c,!1,b)};c.prototype._digitArgument=function(c){this._argument=(this._argument||0)*10+c;return!0};c.prototype._negativeArgument=function(){this._sign=(this._sign||1)*-1;return!0};c.prototype._createActions=function(c){var b=this;c.setAction("emacs-beginning-of-line",function(){return b._moveCursor("lineStart")},{name:g.lineStart});c.setAction("emacs-end-of-line",function(){return b._moveCursor("lineEnd")},
{name:g.lineEnd});c.setAction("emacs-forward-char",function(){return b._moveCursor("charNext")},{name:g.charNext});c.setAction("emacs-backward-char",function(){return b._moveCursor("charPrevious")},{name:g.charPrevious});c.setAction("emacs-forward-word",function(){return b._moveCursor("wordNext")},{name:g.wordNext});c.setAction("emacs-backward-word",function(){return b._moveCursor("wordPrevious")},{name:g.wordPrevious});c.setAction("emacs-next-line",function(){return b._moveCursor("lineDown")},{name:g.lineDown});
c.setAction("emacs-previous-line",function(){return b._moveCursor("lineUp")},{name:g.lineUp});c.setAction("emacs-beginning-of-buffer",function(){return b._moveCursor("textStart")},{name:g.textStart});c.setAction("emacs-end-of-buffer",function(){return b._moveCursor("textEnd")},{name:g.textEnd});c.setAction("emacs-delete-backward-char",function(){return c.invokeAction("deletePrevious")},{name:g.deletePrevious});c.setAction("emacs-delete-char",function(){return c.invokeAction("deletePrevious")},{name:g.deletePrevious});
c.setAction("emacs-kill-line",function(){return c.invokeAction("deleteLineEnd")},{name:g.deleteLineEnd});c.setAction("emacs-kill-word",function(){return c.invokeAction("deleteWordNext")},{name:g.deleteWordNext});c.setAction("emacs-backward-kill-word",function(){return c.invokeAction("deleteWordPrevious")},{name:g.deleteWordPrevious});c.setAction("emacs-scroll-up",function(){return b._moveCursor("pageDown")},{name:g.pageDown});c.setAction("emacs-scroll-down",function(){return b._moveCursor("pageUp")},
{name:g.pageUp});c.setAction("emacs-set-mark-command",function(){var f=c.getCaretOffset();c.setCaretOffset(f);b._marker=f;return!0},{name:g.setMarkCommand});c.setAction("emacs-exchange-point-and-mark",function(){if(b._marker!==void 0){var f=c.getCaretOffset(),g=c.getSelection();if(g.end===f){var e=g.start;g.start=g.end;g.end=e}b._marker=f;c.setSelection(g.start,g.end)}return!0},{name:g.exchangeMarkPoint});c.setAction("emacs-reset-mark-command",function(){var f=c.getCaretOffset();c.setCaretOffset(f);
b._marker=void 0;return!0},{name:g.clearMark});c.setAction("emacs-digit-argument-0",function(){return b._digitArgument(0)},{name:f.formatMessage(g.digitArgument,"0")});c.setAction("emacs-digit-argument-1",function(){return b._digitArgument(1)},{name:f.formatMessage(g.digitArgument,"1")});c.setAction("emacs-digit-argument-2",function(){return b._digitArgument(2)},{name:f.formatMessage(g.digitArgument,"2")});c.setAction("emacs-digit-argument-3",function(){return b._digitArgument(3)},{name:f.formatMessage(g.digitArgument,
"3")});c.setAction("emacs-digit-argument-4",function(){return b._digitArgument(4)},{name:f.formatMessage(g.digitArgument,"4")});c.setAction("emacs-digit-argument-5",function(){return b._digitArgument(5)},{name:f.formatMessage(g.digitArgument,"5")});c.setAction("emacs-digit-argument-6",function(){return b._digitArgument(6)},{name:f.formatMessage(g.digitArgument,"6")});c.setAction("emacs-digit-argument-7",function(){return b._digitArgument(7)},{name:f.formatMessage(g.digitArgument,"7")});c.setAction("emacs-digit-argument-8",
function(){return b._digitArgument(8)},{name:f.formatMessage(g.digitArgument,"8")});c.setAction("emacs-digit-argument-9",function(){return b._digitArgument(9)},{name:f.formatMessage(g.digitArgument,"9")});c.setAction("emacs-negative-argument",function(){return b._negativeArgument()},{name:g.negativeArgument});c.setAction("emacs-uppercase",function(){var f=b._getData();f.unit="word";return c.invokeAction("uppercase",!1,f)},{name:g.uppercase});c.setAction("emacs-lowercase",function(){var f=b._getData();
f.unit="word";return c.invokeAction("lowercase",!1,f)},{name:g.lowercase});c.setAction("emacs-capitalize",function(){var f=b._getData();f.unit="word";return c.invokeAction("capitalize",!1,f)},{name:g.capitalize})};return{EmacsMode:c}});
define("orion/editor/vi",["i18n!orion/editor/nls/messages","orion/editor/keyModes","orion/keyBinding","orion/util"],function(g,l,i,f){function c(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}function d(a,b,c,d,e,f,h){a=new i.KeyStroke(a,b,c,d,e,f);a.scopeName=h||g.vi;return a}function b(a,b){var c=new i.KeySequence(a);c.scopeName=b||g.vi;return c}function h(a,b,c){this.key=b;this.msg=c;this.number="";l.KeyMode.call(this,a);a&&this._createActions(a)}function k(a){var b=a.getView();this.viMode=
a;l.KeyMode.call(this,b);this._createActions(b)}function e(a,b,c,d){this.viMode=a;this.nextMode=b;h.call(this,a.getView(),c,d)}function a(a){var b=a.getView();l.KeyMode.call(this,b);this.viMode=a;this._createActions(b)}function j(b,c){h.call(this,b,"",g.vimove);this.insertMode=new a(this);this.changeMode=new e(this,this.insertMode,"c",g.vichange);this.deleteMode=new e(this,this,"d",g.videlete);this.yankMode=new e(this,this,"y",g.viyank);this.statusReporter=c}var p,m;h.prototype=new l.KeyMode;c(h.prototype,
{_msg:function(a){return{name:f.formatMessage(g[a],this.msg)}},createKeyBindings:function(){for(var a=[],b=this.key,b=b?"-"+b+"-":"-",c=0;c<=9;c++)a.push({actionID:"vi"+b+c,keyBinding:d(c+"",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi"+b+"Left",keyBinding:d("h",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Left",keyBinding:d("h",!0,!1,!1,!1)});a.push({actionID:"vi"+b+"Left",keyBinding:d(8)});a.push({actionID:"vi"+b+"Left",keyBinding:d(37)});a.push({actionID:"vi"+b+"Down",keyBinding:d("j",
!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Down",keyBinding:d(40)});a.push({actionID:"vi"+b+"Up",keyBinding:d("k",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Up",keyBinding:d(38)});a.push({actionID:"vi"+b+"Right",keyBinding:d("l",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Right",keyBinding:d(39)});a.push({actionID:"vi"+b+"Right",keyBinding:d(32)});a.push({actionID:"vi"+b+"w",keyBinding:d("w",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"b",keyBinding:d("b",!1,!1,!1,!1,
"keypress")});a.push({actionID:"vi"+b+"W",keyBinding:d("W",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"B",keyBinding:d("B",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"e",keyBinding:d("e",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"E",keyBinding:d("E",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"$",keyBinding:d("$",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"^_",keyBinding:d("^",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"^_",keyBinding:d("_",!1,!1,!1,!1,"keypress")});
a.push({actionID:"vi"+b+"+",keyBinding:d("+",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"+",keyBinding:d(13)});a.push({actionID:"vi"+b+"-",keyBinding:d("-",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"|",keyBinding:d("|",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"H",keyBinding:d("H",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"M",keyBinding:d("M",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"L",keyBinding:d("L",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"/",
keyBinding:d("/",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"?",keyBinding:d("?",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"n",keyBinding:d("n",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"N",keyBinding:d("N",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"f",keyBinding:d("f",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"F",keyBinding:d("F",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"t",keyBinding:d("t",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"T",keyBinding:d("T",
!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+",",keyBinding:d(",",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+";",keyBinding:d(";",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"G",keyBinding:d("G",!1,!1,!1,!1,"keypress")});return a},_createActions:function(a){function b(c){for(var c=a.getModel().getLine(c),d=0,e=c.charCodeAt(d);e===32||e===9;)d++,e=c.charCodeAt(d);return d}function c(a,b){a&&e.getView().setCaretOffset(a.start);b.editDone&&b.editDone()}var d=this.key,d=d?"-"+d+"-":
"-",e=this;a.setAction("vi"+d+"0",function(){return e._storeNumber(0)});a.setAction("vi"+d+"1",function(){return e._storeNumber(1)});a.setAction("vi"+d+"2",function(){return e._storeNumber(2)});a.setAction("vi"+d+"3",function(){return e._storeNumber(3)});a.setAction("vi"+d+"4",function(){return e._storeNumber(4)});a.setAction("vi"+d+"5",function(){return e._storeNumber(5)});a.setAction("vi"+d+"6",function(){return e._storeNumber(6)});a.setAction("vi"+d+"7",function(){return e._storeNumber(7)});a.setAction("vi"+
d+"8",function(){return e._storeNumber(8)});a.setAction("vi"+d+"9",function(){return e._storeNumber(9)});a.setAction("vi"+d+"Left",function(){return e._invoke("charPrevious",{unit:"character"})},this._msg("viLeft"));a.setAction("vi"+d+"Right",function(){return e._invoke("charNext",{unit:"character"})},this._msg("viRight"));a.setAction("vi"+d+"Up",function(){return e._invoke("lineUp",{editLine:!0})},this._msg("viUp"));a.setAction("vi"+d+"Down",function(){return e._invoke("lineDown",{editLine:!0})},
this._msg("viDown"));a.setAction("vi"+d+"w",function(){return e._invoke("wordNext",{unit:"word"})},this._msg("viw"));a.setAction("vi"+d+"b",function(){return e._invoke("wordPrevious",{unit:"word"})},this._msg("vib"));a.setAction("vi"+d+"W",function(){return e._invoke("wordNext",{unit:"wordWS"})},this._msg("viW"));a.setAction("vi"+d+"B",function(){return e._invoke("wordPrevious",{unit:"wordWS"})},this._msg("viB"));a.setAction("vi"+d+"e",function(){e._invoke("charNext",{unit:"character"});e._invoke("wordNext",
{unit:"wordend"});e._invoke("charPrevious",{unit:"character"});return!0},this._msg("vie"));a.setAction("vi"+d+"E",function(){return e._invoke("wordNext",{unit:"wordendWS"})},this._msg("viE"));a.setAction("vi"+d+"$",function(){return e._invoke("lineEnd")},this._msg("vi$"));a.setAction("vi"+d+"^_",function(){return e._invoke(function(){var c=a.getModel(),d=a.getCaretOffset(),d=c.getLineAtOffset(d);a.setCaretOffset(c.getLineStart(d)+b(d))})},this._msg("vi^_"));a.setAction("vi"+d+"+",function(){return e._invoke(function(c){var d=
a.getModel(),e=a.getCaretOffset(),f=d.getLineCount()-1,c=Math.min(d.getLineAtOffset(e)+c.count,f);a.setCaretOffset(d.getLineStart(c)+b(c))},{editLine:!0})},this._msg("vi+"));a.setAction("vi"+d+"-",function(){return e._invoke(function(c){var d=a.getModel(),e=a.getCaretOffset(),c=Math.max(d.getLineAtOffset(e)-c.count,0);a.setCaretOffset(d.getLineStart(c)+b(c))},{editLine:!0})},this._msg("vi-"));a.setAction("vi"+d+"|",function(){return e._invoke(function(b){var c=a.getModel(),d=a.getCaretOffset(),d=
c.getLineAtOffset(d);a.setCaretOffset(Math.min(c.getLineStart(d)+b.count-1,c.getLineEnd(d)))})},this._msg("vi|"));a.setAction("vi"+d+"H",function(){return e._invoke(function(b){b=a.getModel().getLineStart(a.getTopIndex(!0)+(b.count-1));a.setCaretOffset(b)},{editLine:!0})},this._msg("viH"));a.setAction("vi"+d+"M",function(){return e._invoke(function(){var b=Math.ceil((a.getBottomIndex(!0)-a.getTopIndex(!0))/2)+a.getTopIndex(!0);a.setCaretOffset(a.getModel().getLineStart(b))},{editLine:!0})},this._msg("viM"));
a.setAction("vi"+d+"L",function(){return e._invoke(function(b){a.setCaretOffset(a.getModel().getLineStart(a.getBottomIndex(!0)-(b.count-1)))},{editLine:!0})},this._msg("viL"));a.setAction("vi"+d+"/",function(){var a={hideAfterFind:!0,incremental:!1,reverse:!1,findCallback:function(b){e._searchFwd=!0;c(b,a)}};return e._invoke("find",a)},this._msg("vi/"));a.setAction("vi"+d+"?",function(){var a={hideAfterFind:!0,incremental:!1,reverse:!0,findCallback:function(b){e._searchFwd=!1;c(b,a)}};return e._invoke("find",
a)},this._msg("vi?"));a.setAction("vi"+d+"n",function(){var b,d=a.getCaretOffset();e._searchFwd?(b="findNext",d++):b="findPrevious";var f={start:d,findCallback:function(a){c(a,f)}};return e._invoke(b,f)},this._msg("vin"));a.setAction("vi"+d+"N",function(){var b,d=a.getCaretOffset();e._searchFwd?b="findPrevious":(b="findNext",d++);var f={start:d,findCallback:function(a){c(a,f)}};return e._invoke(b,f)},this._msg("viN"));a.setAction("vi"+d+"f",function(){var b=a.getModel(),c=a.getCaretOffset();return e._findChar(c,
b.getLineEnd(b.getLineAtOffset(c)),!1,0)},this._msg("vif"));a.setAction("vi"+d+"F",function(){var b=a.getModel(),c=a.getCaretOffset();return e._findChar(b.getLineStart(b.getLineAtOffset(c)),c,!0,0)},this._msg("viF"));a.setAction("vi"+d+"t",function(){var b=a.getModel(),c=a.getCaretOffset();return e._findChar(c,b.getLineEnd(b.getLineAtOffset(c)),!1,-1)},this._msg("vit"));a.setAction("vi"+d+"T",function(){var b=a.getModel(),c=a.getCaretOffset();return e._findChar(b.getLineStart(b.getLineAtOffset(c)),
c,!0,1)},this._msg("viT"));a.setAction("vi"+d+",",function(){return e._findNextChar(e._charTempOptions.reverse)},this._msg("vi,"));a.setAction("vi"+d+";",function(){return e._findNextChar(!e._charTempOptions.reverse)},this._msg("vi;"));a.setAction("vi"+d+"G",function(){if(e.number===""){var b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());e.number=b.getLineCount()}return e._invoke(function(b){b=b||{};b.line=b.count;b.editLine=!0;b.callback=function(){b.editDone&&b.editDone()};a.invokeAction("gotoLine",
!1,b)})},this._msg("viG"))},_invoke:function(a,b){var c=this.getView(),b=b||{};b.count=this._getCount();typeof a==="function"?a(b):c.invokeAction(a,!1,b);return!0},_getCount:function(){var a=1;this.number!==""&&(a=this.number>>0);this.number="";return a},_findChar:function(a,b,c,d){this._charTempOptions={};this._charTempOptions.start=a;this._charTempOptions.end=b;this._charTempOptions.hideAfterFind=!0;this._charTempOptions.incremental=!1;this._charTempOptions.reverse=c;this._charTempOptions.offset=
d;var e=this._charTempOptions,f=this;this._charTempOptions.findCallback=function(a){a&&f.getView().setCaretOffset(a.start+d);e.editDone&&e.editDone()};return this._invoke("find",this._charTempOptions)},_findNextChar:function(a){if(this._charTempOptions){var b=this.getView(),c={};c.hideAfterFind=this._charTempOptions.hideAfterFind;c.incremental=this._charTempOptions.incremental;c.reverse=this._charTempOptions.reverse;c.wrap=!1;var d=this;c.findCallback=function(a){a&&d.getView().setCaretOffset(a.start+
d._charTempOptions.offset);c.editDone&&c.editDone()};var e=b.getModel();return a?(c.start=b.getCaretOffset()+1-this._charTempOptions.offset,c.end=e.getLineEnd(e.getLineAtOffset(c.start)),c.reverse=!1,this._invoke("findNext",c)):(c.start=b.getCaretOffset()-this._charTempOptions.offset,c.end=e.getLineStart(e.getLineAtOffset(c.start)),c.reverse=!0,this._invoke("findPrevious",c))}return!0},_storeNumber:function(a){var b=this;if(a===0&&!this.number)return this._invoke(function(){b.getView().invokeAction("lineStart",
!0)});this.number+=a;return!0}});k.prototype=new l.KeyMode;c(k.prototype,{createKeyBindings:function(){var a=[];a.push({actionID:"vi-:-ESC",keyBinding:d(27),predefined:!0});return a},_createActions:function(a){var b=this;a.setAction("vi-:-ESC",function(){a.removeKeyMode(b);a.addKeyMode(b.viMode);return!0})},match:function(a){var b=l.KeyMode.prototype.match.call(this,a);b||(b=this.getView().getKeyModes()[0].match(a));return b},storeNumber:function(a){this.number=a}});e.prototype=new h;c(e.prototype,
{createKeyBindings:function(){var a=h.prototype.createKeyBindings.call(this);a.push({actionID:"vi-"+this.key+"ESC",keyBinding:d(27),predefined:!0});a.push({actionID:"vi-"+this.key+"-"+this.key,keyBinding:d(this.key,!1,!1,!1,!1,"keypress")});return a},_invoke:function(a,b){var b=b||{},c=this.getView(),d=c.getCaretOffset(),e=d,f=c.getModel(),g=this;b.editDone=function(){var a=c.getCaretOffset();if(e>a){var h=e;e=a;a=h}b.editLine&&(e=f.getLineStart(f.getLineAtOffset(e)),a=f.getLineEnd(f.getLineAtOffset(a),
g.key==="c"?!1:!0));g.key==="y"?(p=c.getText(e,a),m=b.editLine,c.setCaretOffset(d)):c.setText("",e,a);c.removeKeyMode(g);c.addKeyMode(g.nextMode)};h.prototype._invoke.call(this,a,b);b.editDone();return!0},_getCount:function(){var a=1;this.firstNumber!==""&&(a=this.firstNumber>>0);var b=1;this.number!==""&&(b=this.number>>0);a*=b;this.number=this.firstNumber="";return a},_createActions:function(a){h.prototype._createActions.call(this,a);var b=this;a.setAction("vi-"+b.key+"ESC",function(){a.removeKeyMode(b);
a.addKeyMode(b.viMode);return!0});a.setAction("vi-"+b.key+"-"+b.key,function(){return b._invoke("lineEnd",{editLine:!0})},this._msg("viycd"))},storeNumber:function(a){this.firstNumber=a},_modeAdded:function(){this.secondNumber=""},_modeRemoved:function(){this.number=this.firstNumber=this.command=""}});a.prototype=new l.KeyMode;c(a.prototype,{createKeyBindings:function(){var a=[];a.push({actionID:"vi-insert-ESC",keyBinding:d(27),predefined:!0});return a},_createActions:function(a){var b=this;a.setAction("vi-insert-ESC",
function(){a.removeKeyMode(b);a.addKeyMode(b.viMode);return!0})},match:function(a){var b=l.KeyMode.prototype.match.call(this,a);b||(b=this.getView().getKeyModes()[0].match(a));return b},storeNumber:function(){}});j.prototype=new h;c(j.prototype,{createKeyBindings:function(){var a=h.prototype.createKeyBindings.call(this);a.push({actionID:"vi-ctrl-f",keyBinding:d("f",!0)});a.push({actionID:"vi-ctrl-b",keyBinding:d("b",!0)});a.push({actionID:"vi-ctrl-e",keyBinding:d("e",!0)});a.push({actionID:"vi-ctrl-y",
keyBinding:d("y",!0)});a.push({actionID:"statusLineMode",keyBinding:d(":",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi-a",keyBinding:d("a",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-A",keyBinding:d("A",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-i",keyBinding:d("i",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-I",keyBinding:d("I",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-o",keyBinding:d("o",!1,!1,!1,!1,"keypress"),predefined:!0});
a.push({actionID:"vi-O",keyBinding:d("O",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-R",keyBinding:d("R",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-s",keyBinding:d("s",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-S",keyBinding:d("S",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-p",keyBinding:d("p",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-P",keyBinding:d("P",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-c",
keyBinding:d("c",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-d",keyBinding:d("d",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-y",keyBinding:d("y",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-~",keyBinding:d("~",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-x",keyBinding:d("x",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-X",keyBinding:d("X",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-C",keyBinding:d("C",
!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-D",keyBinding:d("D",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-*",keyBinding:d("*",!1,!1,!1,!1,"keypress"),predefined:!0});return a},getKeyBindings:function(a){var c=l.KeyMode.prototype.getKeyBindings.call(this,a),c=c||[],e=this.changeMode.getKeyBindings(a),f;if(!this.changeMode.isActive())for(f=0;f<e.length;f++)e[f]=b([d("c",!1,!1,!1,!1,"keypress"),e[f]]);c=c.concat(e);e=this.deleteMode.getKeyBindings(a);if(!this.deleteMode.isActive())for(f=
0;f<e.length;f++)e[f]=b([d("d",!1,!1,!1,!1,"keypress"),e[f]]);c=c.concat(e);e=this.yankMode.getKeyBindings(a);if(!this.yankMode.isActive())for(f=0;f<e.length;f++)e[f]=b([d("y",!1,!1,!1,!1,"keypress"),e[f]]);return c=c.concat(e)},match:function(a){var b=l.KeyMode.prototype.match.call(this,a);!b&&a.type==="keypress"&&(b="noop");return b},_createActions:function(a){h.prototype._createActions.call(this,a);var b=this;a.setAction("vi-ctrl-f",function(){return b._invoke("pageDown")},{name:g.pageDown});a.setAction("vi-ctrl-b",
function(){return b._invoke("pageUp")},{name:g.pageUp});a.setAction("vi-ctrl-e",function(){return b._invoke("scrollLineDown")},{name:g.scrollLineDown});a.setAction("vi-ctrl-y",function(){return b._invoke("scrollLineUp")},{name:g.scrollLineUp});a.setAction("vi-a",function(){return b._toInsertMode("charNext")},{name:g.via});a.setAction("vi-A",function(){return b._toInsertMode("lineEnd")},{name:g.viA});a.setAction("vi-i",function(){return b._toInsertMode("noop")},{name:g.vii});a.setAction("vi-I",function(){return b._toInsertMode("lineStart")},
{name:g.viI});a.setAction("vi-O",function(){b._invoke("lineUp");b._invoke("lineEnd");b._toInsertMode("enter");return!0},{name:g.viO});a.setAction("vi-o",function(){b._invoke("lineEnd");b._toInsertMode("enter");return!0},{name:g.vio});a.setAction("vi-R",function(){return b._toInsertMode("toggleOverwriteMode")},{name:g.viR});a.setAction("vi-s",function(){return b._toInsertMode("deleteNext",{unit:"char"})},{name:g.vis});a.setAction("vi-S",function(){return b._toInsertMode("deleteLines",{unit:"line"})},
{name:g.viS});a.setAction("vi-p",function(){return b._invoke(function(){var a=b.getView(),c=a.getSelection();if(c.start===c.end){var d=a.getModel(),e=a.getCaretOffset();m?c.start=c.end=d.getLineEnd(d.getLineAtOffset(e),!0):(c.start++,c.end++)}a.setText(p,c.start,c.end)})},{name:g.vip});a.setAction("vi-P",function(){return b._invoke(function(){var a=b.getView(),c=a.getSelection();if(c.start===c.end){var d=a.getModel(),e=a.getCaretOffset();if(m)c.start=c.end=d.getLineStart(d.getLineAtOffset(e))}a.setText(p,
c.start,c.end)})},{name:g.viP});a.setAction("vi-c",function(){a.removeKeyMode(b);a.addKeyMode(b.changeMode);b.changeMode.storeNumber(b.number);b.number="";return!0});a.setAction("vi-d",function(){a.removeKeyMode(b);a.addKeyMode(b.deleteMode);b.deleteMode.storeNumber(b.number);b.number="";return!0});a.setAction("vi-y",function(){a.removeKeyMode(b);a.addKeyMode(b.yankMode);b.yankMode.storeNumber(b.number);b.number="";return!0});a.setAction("vi-~",function(){return b._invoke("reversecase")},{name:g.reversecase});
a.setAction("vi-x",function(){return b._invoke("deleteNext")},{name:g.deleteNext});a.setAction("vi-X",function(){return b._invoke("deletePrevious")},{name:g.deletePrevious});a.setAction("vi-C",function(){return b._toInsertMode("deleteLineEnd")},{name:g.viC});a.setAction("vi-D",function(){return b._invoke("deleteLineEnd")},{name:g.deleteLineEnd});a.setAction("vi-*",function(){var a=b.getView(),c=a.getCaretOffset(),c=a.getNextOffset(c+1,{count:-1,unit:"word"}),d=a.getNextOffset(c,{count:1,unit:"wordend"}),
a=a.getText(c,d);b._searchFwd=!0;return b._invoke("find",{hideAfterFind:!0,incremental:!1,reverse:!1,findString:a})},{name:g.viStar})},_reportStatus:function(a){this.statusReporter&&this.statusReporter(a)},_toInsertMode:function(a,b){var b=b||{},c=1;this.number!==""&&(c=this.number>>0);b.count=c;c=this.getView();this.insertMode.storeNumber(this.number);c.invokeAction(a,!1,b);c.removeKeyMode(this);c.addKeyMode(this.insertMode);this.number="";return!0},_modeAdded:function(){this.getView().setOptions({blockCursorVisible:!0})},
_modeRemoved:function(){var a=this.getView();a.setOptions({blockCursorVisible:!1});a.removeKeyMode(this.insertMode);a.removeKeyMode(this.changeMode);a.removeKeyMode(this.deleteMode)}});return{VIMode:j}});
define("orion/editorPreferences",[],function(){function g(f,c){this._preferences=f;if(this._callback=c)var d=f.listenForChangedSettings(l,function(b){b.key===d&&c()}.bind(this))}var l="/editor/settings",i={autoSave:!1,autoSaveVisible:!0,autoSaveLocalVisible:!0,autoSaveTimeout:1E3,autoSaveTimeoutVisible:!0,themeVisible:!0,themeLocalVisible:!0,fontSizeVisible:!0,fontSizeLocalVisible:!0,autoLoad:!0,autoLoadVisible:!0,saveDiffs:!0,saveDiffsVisible:!0,showBlame:!1,showBlameVisible:!0,autoPairParentheses:!0,
autoPairParenthesesVisible:!0,autoPairBraces:!0,autoPairBracesVisible:!0,autoPairSquareBrackets:!0,autoPairSquareBracketsVisible:!0,autoPairAngleBrackets:!1,autoPairAngleBracketsVisible:!0,autoPairQuotations:!0,autoPairQuotationsVisible:!0,autoCompleteComments:!0,autoCompleteCommentsVisible:!0,smartIndentation:!0,smartIndentationVisible:!0,trimTrailingWhiteSpace:!1,trimTrailingWhiteSpaceVisible:!0,tabSize:4,tabSizeVisible:!0,expandTab:!1,expandTabVisible:!0,scrollAnimation:!0,scrollAnimationVisible:!0,
scrollAnimationTimeout:300,scrollAnimationTimeoutVisible:!0,annotationRuler:!0,annotationRulerVisible:!0,lineNumberRuler:!0,lineNumberRulerVisible:!0,foldingRuler:!0,foldingRulerVisible:!0,overviewRuler:!0,overviewRulerVisible:!0,showTabs:!1,showTabsVisible:!0,showSpaces:!1,showSpacesVisible:!0,wordWrap:!1,wordWrapVisible:!0,showMargin:!1,showMarginVisible:!0,marginOffset:80,marginOffsetVisible:!0,keyBindings:"Default",keyBindingsVisible:!0,keyBindingsLocalVisible:!0};g.prototype={_initialize:function(f){var f=
f.get("editorSettings")||{},c;for(c in i)f.hasOwnProperty(c)||(f[c]=i[c]);return f},getPrefs:function(f){this._preferences.getPreferences(l).then(function(c){c=this._initialize(c);typeof c==="string"&&(c=JSON.parse(c));f(c)}.bind(this))},setPrefs:function(f,c){this._preferences.getPreferences(l).then(function(d){d.put("editorSettings",f);f=this._initialize(d);c&&c(f);this._callback&&this._callback(f)}.bind(this))}};return{EditorPreferences:g}});
define("orion/widgets/themes/editor/ThemeData",["i18n!orion/settings/nls/messages","orion/editor/textTheme"],function(g,l){function i(){}function f(){this.styles=[];var c=new i;c.name="Eclipse";c.annotationRuler="white";c.background="white";c.comment="green";c.keyword="#7f0055";c.text="darkSlateGray";c.string="blue";c.overviewRuler="white";c.lineNumberOdd="#444";c.lineNumberEven="#444";c.lineNumber="#444";c.currentLine="#EAF2FE";c.tag="darkorange";c.attribute="cadetBlue";c.fontFamily=d;c.fontSize=
b;this.styles.push(c);c=new i;c.name="Prospecto";c.annotationRuler="white";c.background="white";c.comment="#3C802C";c.keyword="#CC4C07";c.text="#333";c.string="#446FBD";c.overviewRuler="white";c.lineNumberOdd="silver";c.lineNumberEven="silver";c.lineNumber="silver";c.currentLine="#EAF2FE";c.tag="#CC4C07";c.attribute="cadetBlue";c.fontFamily=d;c.fontSize=b;this.styles.push(c);c=new i;c.name="Blue";c.annotationRuler="lavender";c.background="aliceBlue";c.comment="indigo";c.keyword="cornFlowerBlue";c.text=
"navy";c.string="cornFlowerBlue";c.overviewRuler="lavender";c.lineNumberOdd="darkSlateGray";c.lineNumberEven="darkSlateGray";c.lineNumber="darkSlateGray";c.currentLine="white";c.tag="cornFlowerBlue";c.attribute="cadetBlue";c.fontFamily=d;c.fontSize=b;this.styles.push(c);c=new i;c.name="Ambience";c.annotationRuler="#3D3D3D";c.background="#202020";c.comment="mediumslateblue";c.keyword="cornFlowerBlue";c.text="darkseagreen";c.string="lightcoral";c.overviewRuler="white";c.lineNumberOdd="black";c.lineNumberEven=
"black";c.lineNumber="black";c.currentLine="lightcyan";c.tag="cornFlowerBlue";c.attribute="cadetBlue";c.fontFamily=d;c.fontSize=b;this.styles.push(c);c=new i;c.name="Tierra";c.annotationRuler="moccasin";c.background="lemonchiffon";c.comment="darkseagreen";c.keyword="darkred";c.text="#555555";c.string="orangered";c.overviewRuler="moccasin";c.lineNumberOdd="chocolate";c.lineNumberEven="chocolate";c.lineNumber="chocolate";c.currentLine="#baa289";c.tag="darkred";c.attribute="cadetBlue";c.fontFamily=d;
c.fontSize=b;this.styles.push(c);c=new i;c.name="Nimbus";c.annotationRuler="#444";c.background="dimgray";c.comment="darkseagreen";c.keyword="darkorange";c.text="white";c.string="cornflowerblue";c.overviewRuler="#444";c.lineNumberOdd="#aaa";c.lineNumberEven="#aaa";c.lineNumber="#aaa";c.currentLine="#aabfbb";c.tag="darkorange";c.attribute="cadetBlue";c.fontFamily=d;c.fontSize=b;this.styles.push(c);c=new i;c.name="Adelante";c.annotationRuler="#E2D2B2";c.background="#F1E7C8";c.comment="#5D774E";c.keyword=
"#AF473B";c.text="dimgray";c.string="#DE5D3B";c.overviewRuler="#E2D2B2";c.lineNumberOdd="#AF473B";c.lineNumberEven="#AF473B";c.lineNumber="#AF473B";c.currentLine="#9e937b";c.tag="#AF473B";c.attribute="cadetBlue";c.fontFamily=d;c.fontSize=b;this.styles.push(c);c=new i;c.name="Raspberry Pi";c.annotationRuler="seashell";c.background="seashell";c.comment="#66B32F";c.keyword="#E73E36";c.text="dimgray";c.string="darkorange";c.overviewRuler="seashell";c.lineNumberOdd="#E73E36";c.lineNumberEven="#E73E36";
c.lineNumber="#E73E36";c.currentLine="#F5B1AE";c.tag="#E73E36";c.attribute="cadetBlue";c.fontFamily=d;c.fontSize=b;this.styles.push(c)}function c(){return this.styles}var d='"Consolas", "Monaco", "Vera Mono", "monospace"',b="10pt";f.prototype.styles=[];f.prototype.getStyles=c;f.prototype.fontSettable=!0;f.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"editorstyles",defaultTheme:"Prospecto",selectedKey:"editorSelected"}};f.prototype.parseToXML=function(b){try{var c=null;
if(window.DOMParser){var c=(new DOMParser).parseFromString(b,"text/xml"),d=c.getElementsByTagName("parsererror");return!d||!d.length||!d[0].childNodes.length?c:null}else return c=new ActiveXObject("Microsoft.XMLDOM"),c.async=!1,c.loadXML(b),c}catch(a){}};f.prototype.selectFontSize=function(b){console.log("fontsize: "+b)};f.prototype.importTheme=function(b){console.log("import theme");console.log(b);var c=this.parseToXML(b.parameters.valueFor("name")),d=new i;d.name=c.getElementsByTagName("colorTheme")[0].attributes[1].value;
d.annotationRuler=c.getElementsByTagName("background")[0].attributes[0].value;d.background=c.getElementsByTagName("background")[0].attributes[0].value;d.comment=c.getElementsByTagName("singleLineComment")[0].attributes[0].value;d.keyword=c.getElementsByTagName("keyword")[0].attributes[0].value;d.text=c.getElementsByTagName("foreground")[0].attributes[0].value;d.string=c.getElementsByTagName("string")[0].attributes[0].value;d.overviewRuler=c.getElementsByTagName("background")[0].attributes[0].value;
d.lineNumberOdd=c.getElementsByTagName("lineNumber")[0].attributes[0].value;d.lineNumberEven=c.getElementsByTagName("lineNumber")[0].attributes[0].value;d.lineNumber=c.getElementsByTagName("lineNumber")[0].attributes[0].value;d.currentLine=c.getElementsByTagName("selectionBackground")[0].attributes[0].value;b.items.addTheme(d)};f.prototype.processSettings=function(b){var c=l.TextTheme.getTheme();c.setThemeClass("editorTheme",c.buildStyleSheet("editorTheme",b))};f.prototype.getViewData=function(){var b=
{top:10,left:10,width:400,height:350},c=b.left,d=b.top;b.shapes=[{type:"TEXT",name:g["Line Numbers"],label:"1",x:c+20,y:d+20,fill:"darkSlateGray",family:"lineNumber",font:"9pt sans-serif"},{type:"RECTANGLE",name:g.Background,x:c+46,y:d,width:290,height:b.height,family:"background",fill:"white"},{type:"TEXT",name:g.Strings,label:"'text/javascript'",x:c+134,y:d+20,fill:"darkorange",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"=",x:c+124,y:d+20,fill:"darkSlateGray",family:"text",
font:"9pt sans-serif"},{type:"RECTANGLE",name:g["Current Line"],x:c+46,y:d+87,width:290,height:18,family:"currentLine",fill:"#eaf2fd"},{type:"TEXT",name:g["HTML Attribute"],label:"type",x:c+98,y:d+20,fill:"darkGray",family:"attribute",font:"9pt sans-serif"},{type:"RECTANGLE",name:g["Overview Ruler"],x:c+336,y:d,width:14,height:b.height,family:"overviewRuler",fill:"white"},{type:"TEXT",name:g.Comments,label:"/* comment */",x:c+75,y:d+40,fill:"darkSeaGreen",family:"comment",font:"9pt sans-serif"},{type:"TEXT",
name:g["HTML Tag"],label:"<script",x:c+55,y:d+20,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g["HTML Tag"],label:">",x:c+213,y:d+20,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g.Strings,label:"'Result'",x:c+164,y:d+80,fill:"cornflowerBlue",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"multiply(a,b){",x:c+120,y:d+60,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g.Keywords,label:"function",
x:c+75,y:d+60,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g.Keywords,label:"var",x:c+95,y:d+80,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"output = ",x:c+115,y:d+80,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:";",x:c+205,y:d+80,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g.Keywords,label:"var",x:c+95,y:d+100,fill:"darkorange",family:"keyword",
font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"result = a*b;",x:c+115,y:d+100,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g.Keywords,label:"return",x:c+95,y:d+120,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"output + result;",x:c+135,y:d+120,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"}",x:c+75,y:d+140,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},
{type:"TEXT",name:g["HTML Tag"],label:"<\/script>",x:c+55,y:d+160,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g["HTML Tag"],label:"<style",x:c+55,y:d+200,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g["HTML Attribute"],label:"type",x:c+95,y:d+200,fill:"darkGray",family:"attribute",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"=",x:c+121,y:d+200,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g.Strings,
label:"'text/css'",x:c+131,y:d+200,fill:"darkorange",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:g["HTML Tag"],label:">",x:c+180,y:d+200,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g["CSS Class Name"],label:".some-class",x:c+75,y:d+220,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g["CSS Class Name"],label:"{",x:c+145,y:d+220,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g["CSS Attribute"],label:"color:",
x:c+95,y:d+240,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g["CSS Value"],label:"#123456",x:c+130,y:d+240,fill:"darkSlateGray",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:g["CSS Text"],label:";",x:c+180,y:d+240,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g["CSS Class Name"],label:"}",x:c+75,y:d+260,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g["HTML Tag"],label:"</style>",x:c+55,y:d+280,fill:"darkorange",
family:"keyword",font:"9pt sans-serif"},{type:"RECTANGLE",name:g["Annotation Ruler"],x:c,y:d,width:46,height:b.height,family:"annotationRuler",fill:"white"}];for(var a=0;a<16;a++)b.shapes.push({type:"TEXT",name:g["Line Numbers"],label:a+1,x:c+20,y:d+20*a+20,fill:"darkSlateGray",family:"lineNumber",font:"9pt sans-serif"});return b};return{ThemeData:f,getStyles:c}});
define("orion/widgets/input/TextField",["orion/objects","orion/webui/littlelib"],function(g,l){function i(f,c){g.mixin(this,f);this.node=c||document.createElement("div");this.node.innerHTML=this.templateString;this.textfield=l.$(".setting-control",this.node)}g.mixin(i.prototype,{templateString:'<input type="text" class="setting-control" name="myname"/>',category:null,item:null,element:null,ui:null,show:function(){this.textfield.addEventListener("change",this.change.bind(this));this.postCreate()},
destroy:function(){if(this.node)l.empty(this.node),this.textfield=this.node=null},setStorageItem:function(){},width:function(f){this.textfield.style.width=f},getValue:function(){return this.inputType==="integer"?parseInt(this.textfield.value,10):this.textfield.value},setValue:function(f){this.textfield.value=f},getSelection:function(){return this.getValue()},setSelection:function(f){this.setValue(f)},postCreate:function(){if(this.inputType&&this.inputType==="password")this.textfield.type="password";
this.editmode&&this.editmode==="readonly"&&this.textfield.setAttribute("readonly","true")},change:function(){var f;if(this.selection&&this.selection.value)f=this.selection.value;this.setStorageItem(this.category,this.item,this.element,f,this.ui)}});return i});
define("orion/widgets/input/LabeledTextfield",["orion/objects","orion/webui/littlelib","orion/widgets/input/TextField"],function(g,l,i){function f(c,d){i.apply(this,arguments);this.mylabel=l.$(".setting-label",this.node)}g.mixin(f.prototype,i.prototype,{templateString:'<div class="setting-property"><label><span class="setting-label"></span><input class="setting-control" type="text" /></label></div>',destroy:function(){i.prototype.destroy.call(this);if(this.mylabel)this.mylabel=null},postCreate:function(){i.prototype.postCreate.call(this);
this.mylabel.textContent=this.fieldlabel+":"}});return f});
define("orion/widgets/input/Checkbox",["orion/objects","orion/webui/littlelib"],function(g,l){function i(f,c){g.mixin(this,f);this.node=c||document.createElement("div");this.node.innerHTML=this.templateString;this.checkbox=l.$(".setting-control",this.node)}g.mixin(i.prototype,{templateString:'<label><input class="setting-control settingsCheckbox" type="checkbox"/></label>',show:function(){this.checkbox.addEventListener("change",this.change.bind(this));this.postCreate()},destroy:function(){if(this.node)l.empty(this.node),
this.checkbox=this.node=null},setStorageItem:function(){},isChecked:function(){return this.checkbox.checked},setChecked:function(f){this.checkbox.checked=f},getSelection:function(){return this.isChecked()},setSelection:function(f){this.setChecked(f)},change:function(){this.setStorageItem(this.checkbox.value)},postCreate:function(){this.checkbox.style.width="20px";this.editmode&&this.editmode==="readonly"&&this.checkbox.setAttribute("disabled","disabled")}});return i});
define("orion/widgets/input/LabeledCheckbox",["orion/objects","orion/webui/littlelib","orion/widgets/input/Checkbox"],function(g,l,i){function f(c,d){i.apply(this,arguments);this.mylabel=l.$(".setting-label",this.node)}g.mixin(f.prototype,i.prototype,{templateString:'<label><span class="setting-label"></span><input class="setting-control settingsCheckbox" type="checkbox"/></label>',postCreate:function(){i.prototype.postCreate.call(this);this.mylabel.textContent=this.fieldlabel+":"},destroy:function(){i.prototype.destroy.call(this);
if(this.mylabel)this.mylabel=null}});return f});
define("orion/widgets/input/Select",["orion/objects","orion/webui/littlelib"],function(g,l){function i(f,c){g.mixin(this,f);this.node=c||document.createElement("div");this.node.innerHTML=this.templateString;this.select=l.$(".setting-control",this.node)}g.mixin(i.prototype,{templateString:'<select class="setting-control" id="selection"></select>',addOptions:function(f){var c=document.createElement("option");c.value=f.value;c.appendChild(document.createTextNode(typeof f.label==="string"?f.label:f.value));
if(f.selected)c.selected="selected";this.select.appendChild(c)},show:function(){this.postCreate()},postCreate:function(){this.options.forEach(this.addOptions.bind(this));this.select.addEventListener("change",this.change.bind(this))},destroy:function(){if(this.node)l.empty(this.node),this.node=this.select=null},setStorageItem:function(){},getSelected:function(){return this.select.value},getSelectedIndex:function(){return this.select.selectedIndex},setSelectedIndex:function(f){this.select.selectedIndex=
f},getSelection:function(){return this.getSelected()},setSelection:function(f){for(var c=0;c<this.options.length;c++)if(this.options[c].value===f){this.setSelectedIndex(c);return}this.setSelectedIndex(0)},change:function(){var f=this.select.value;this.category?this.setStorageItem(this.category,this.item,this.element,f,this.ui):this.setStorageItem(f)}});return i});
define("orion/widgets/input/LabeledSelect",["orion/objects","orion/webui/littlelib","orion/widgets/input/Select"],function(g,l,i){function f(c,d){i.apply(this,arguments);this.mylabel=l.$(".setting-label",this.node)}g.mixin(f.prototype,i.prototype,{templateString:'<div class="setting-property"><label><span class="setting-label"></span><select class="setting-control"></select></label></div>',postCreate:function(){i.prototype.postCreate.call(this);this.mylabel.textContent=this.fieldlabel+":"},destroy:function(){i.prototype.destroy.call(this);
if(this.mylabel)this.mylabel=null}});return f});
define("orion/widgets/settings/Subsection",[],function(){function g(g){var i=g.sectionName;this.parentNode=g.parentNode;this.children=g.children;g=document.createElement("section");g.classList.add("setting-row");g.setAttribute("role","region");g.setAttribute("aria-labelledby","Navigation-header");var f=document.createElement("h3");f.classList.add("setting-header");f.textContent=i;i=document.createElement("div");i.classList.add("setting-content");g.appendChild(f);g.appendChild(i);this.node=g;this.subsectionContent=
i}g.prototype.show=function(){this.parentNode&&this.parentNode.appendChild(this.node);if(this.children){var g=this;this.children.forEach(function(i){g.subsectionContent.appendChild(i.node);i.show()})}};return g});
define("orion/widgets/settings/EditorSettings","i18n!orion/settings/nls/messages,orion/widgets/input/LabeledTextfield,orion/widgets/input/LabeledCheckbox,orion/widgets/input/LabeledSelect,orion/section,orion/widgets/settings/Subsection,orion/commands,orion/objects,orion/webui/littlelib".split(","),function(g,l,i,f,c,d,b,h,k){function e(a,b,c,d,e){if(!d.local){var f=document.createElement("span");f.classList.add(n);f.classList.add(e[b+"LocalVisible"]?s:q);f.title=g.localSettingsTooltip;f.addEventListener("click",
function(){f.classList.contains(q)?(f.classList.add(s),f.classList.remove(q)):(f.classList.add(q),f.classList.remove(s))});b=k.$("label",a.node);b.parentNode.insertBefore(f,b)}return a}function a(a,b,c){return e(new i(b),a,this,b,c)}function j(a,b,c){b.inputType="integer";return e(new l(b),a,this,b,c)}function p(a,b){return!(this.min<=b[a]&&b[a]<=this.max)?g[a+"Invalid"]:""}function m(a,b){h.mixin(this,a);this.node=b}var n="setting-local-indicator",s="on",q="off",t={editorSettings:{keys:{keyBindings:{values:[{value:"",
label:g.Default},{value:"Emacs",label:"Emacs"},{value:"vi",label:"vi"}],create:function(a,b,c){var d=this.values;b.options=[];for(var h=0;h<d.length;h++){var g=d[h],j={value:g.value,label:g.label};if(g.value===c[a])j.selected=!0;b.options.push(j)}return e(new f(b),a,this,b,c)}}},fileManagement:{autoSave:{create:a},autoSaveTimeout:{min:50,max:1E4,create:j,validate:p},autoLoad:{create:a},saveDiffs:{create:a},trimTrailingWhiteSpace:{create:a}},typing:{autoPairQuotations:{create:a},autoPairParentheses:{create:a},
autoPairBraces:{create:a},autoPairSquareBrackets:{create:a},autoPairAngleBrackets:{create:a},autoCompleteComments:{create:a},smartIndentation:{create:a}},tabs:{tabSize:{min:1,max:16,create:j,validate:p},expandTab:{create:a}},whitespaces:{showTabs:{create:a},showSpaces:{create:a}},wrapping:{wordWrap:{create:a},showMargin:{create:a},marginOffset:{min:10,max:200,create:j,validate:p}},smoothScrolling:{scrollAnimation:{create:a},scrollAnimationTimeout:{min:50,max:1E3,create:j,validate:p}},rulers:{annotationRuler:{create:a},
lineNumberRuler:{create:a},foldingRuler:{create:a},overviewRuler:{create:a}},sourceControl:{showBlame:{create:a}}}};h.mixin(m.prototype,{templateString:'<div class="sections"></div>',commandTemplate:'<div id="commandButtons"><div id="editorCommands" class="layoutRight sectionActions"></div></div>',createElements:function(){this.node.innerHTML=this.templateString;this.sections=k.$(".sections",this.node);this.createSections();this.local?this.sections.classList.add("local"):(document.getElementById("pageActions").innerHTML=
this.commandTemplate,this.createToolbar())},createSections:function(){var a=this.oldPrefs,b=[],e,h,j=this.themePreferences;if(!this.local&&this.editorThemeWidget)this.editorThemeSection=new c.Section(this.sections,{id:"editorThemeSettings",title:g.EditorThemes,canHide:!0,slideout:!0}),this.editorThemeWidget.renderData(this.editorThemeSection.getContentElement(),"INITIALIZE");else{var k=this.oldThemeStyles;if(a.themeVisible&&(!this.local||a.themeLocalVisible)){var i=k.styles;e=[];for(var l=0;l<i.length;l++){h=
{value:i[l].name,label:i[l].name};if(i[l].name===k.style.name)h.selected=!0;e.push(h)}b.push(e=this.themeSelect=new f({fieldlabel:g.Theme,options:e}));e.setStorageItem=function(a){j.setTheme(a)}}if(a.fontSizeVisible&&(!this.local||a.fontSizeLocalVisible)){k=k.style.fontSize;e=[];for(i=8;i<19;i++){h={value:i+"pt",label:i+"pt"};if(h.label===k)h.selected=!0;e.push(h)}b.push(e=this.sizeSelect=new f({fieldlabel:g["Font Size"],options:e}));e.setStorageItem=function(a){j.setFontSize(a)}}!this.local&&b.length>
0&&(b=new d({sectionName:g.Theme,parentNode:this.editorThemeSection.getContentElement(),children:b}),b.show(),b=[])}var p,m;for(m in t)if(t.hasOwnProperty(m)){this.local||(p=new c.Section(this.sections,{id:m,title:g[m],canHide:!0,slideout:!0}));for(var n in t[m])if(t[m].hasOwnProperty(n)){for(var q in t[m][n])if(a[q+"Visible"]&&(!this.local||a[q+"LocalVisible"]))h=t[m][n][q],e={},e.local=this.local,e.fieldlabel=g[q],b.push(h.widget=h.create(q,e,a));!this.local&&b.length>0&&(b=new d({sectionName:g[n],
parentNode:p.getContentElement(),children:b}),b.show(),b=[])}}this.local&&b.forEach(function(a){this.sections.appendChild(a.node);if(!a.hasOwnProperty("setStorageItem"))a.setStorageItem=this.update.bind(this);a.show()}.bind(this))},createToolbar:function(){var a=k.node("editorSettingsToolActionsArea");this.commandService.addCommand(new b.Command({name:g.Restore,tooltip:g["Restore default Editor Settings"],id:"orion.restoreeditorsettings",callback:function(a){this.restore(a.items)}.bind(this)}));this.commandService.registerCommandContribution("restoreEditorSettingCommand",
"orion.restoreeditorsettings",2);this.commandService.renderCommands("restoreEditorSettingCommand",a,this,this,"button");this.commandService.addCommand(new b.Command({name:g.Update,tooltip:g["Update Editor Settings"],id:"orion.updateeditorsettings",callback:function(a){this.update(a.items)}.bind(this)}));this.commandService.registerCommandContribution("editorSettingCommand","orion.updateeditorsettings",1);this.commandService.renderCommands("editorSettingCommand",a,this,this,"button")},valueChanged:function(){var a=
{},b;for(b in this.oldPrefs)this.oldPrefs.hasOwnProperty(b)&&(a[b]=this.oldPrefs[b]);this.getValues(a);for(var c in a)if(a.hasOwnProperty(c)&&a[c]!==this.oldPrefs[c])return a},validate:function(a){var b="";this._forEach(function(c,d){return d.validate&&(b=d.validate(c,a))?!1:!0});return b},_progress:function(a,b){this.registry&&this.registry.getService("orion.page.message").setProgressResult({Message:a,Severity:b})},update:function(){var a=this.valueChanged();if(a){var b=this.validate(a);if(b){this._progress(b,
"Error");return}this.preferences.setPrefs(a,function(){this.setValues(this.oldPrefs=a);this._progress(g["Editor preferences updated"],"Normal")}.bind(this))}else this.setValues(this.oldPrefs);this.editor&&this.editor.focus()},restore:function(){this.preferences.setPrefs({},function(a){this._show(a);this._progress(g["Editor defaults restored"],"Normal")}.bind(this))},show:function(a,b){if(a)this.node=a;this.themePreferences.getTheme(function(a){this.preferences.getPrefs(function(c){this._show(c,a);
b&&b()}.bind(this))}.bind(this))},_show:function(a,b){if(b)this.oldThemeStyles=b;this.oldPrefs=a;this.createElements();this.setValues(a)},_forEach:function(a){for(var b in t)if(t.hasOwnProperty(b))for(var c in t[b])if(t[b].hasOwnProperty(c))for(var d in t[b][c])if(t[b][c].hasOwnProperty(d)){var e=t[b][c][d];if(e.widget&&!a(d,e))return}},getValues:function(a){this._forEach(function(b,c){a[b]=c.widget.getSelection();if(!this.local){var d=k.$("."+n,c.widget.node);a[b+"LocalVisible"]=d&&d.classList.contains(s)}return!0}.bind(this))},
setValues:function(a){this._forEach(function(b,c){c.widget.setSelection(a[b]);if(!this.local){var d=k.$("."+n,c.widget.node);d&&(a[b+"LocalVisible"]?(d.classList.add(s),d.classList.remove(q)):(d.classList.add(q),d.classList.remove(s)))}return!0}.bind(this))},destroy:function(){if(this.node)this.node=null;if(this.editorThemeWidget)this.editorThemeWidget.destroy(),this.editorThemeWidget=null}});return m});
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",Replace:"Replace","Replace All":"Replace All","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","< Previous Page":"< Previous Page","Show previous page of search result":"Show previous page of search result","Next Page >":"Next Page >","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","My Saved Searches":"My Saved Searches","Save frequently used searches by choosing ${0} shown above.":"Save frequently used searches by choosing ${0} shown above.",
"Save frequently used searches by clicking on the ${0} button above.":"Save frequently used searches by clicking on the ${0} button above.","Files that contain:":"Files that contain:",Search:"Search","All types":"All types","File type":"File type","All ${0} files":"All ${0} files","Type a search term":"Type a search term","Type a replace term":"Type a replace term","Case sensitive":"Case sensitive","Sort by":"Sort by","File name":"File name","Path name":"Path name",Save:"Save","Type a name for the search":"Type a name for the search",
"Save the current search":"Save the current search","Type filter text":"Type filter text","Scope Search":"Scope Search","Open in Search page for this directory":"Open in Search page for this directory","${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 <td([\\s\\S]*?)</td> with <span$1</span>.":"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 <td([\\s\\S]*?)</td> with <span$1</span>.",
"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 <td([\\s\\S]*?)</td> with <span$1</span>.":"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 <td([\\s\\S]*?)</td> with <span$1</span>."});
define("orion/search/nls/messages",["orion/i18n!orion/search/nls/messages","orion/search/nls/root/messages"],function(g,l){var i={root:l};Object.keys(g).forEach(function(f){typeof i[f]==="undefined"&&(i[f]=g[f])});return i});
define("orion/searchAndReplace/textSearcher",["i18n!orion/search/nls/messages","orion/editor/find","orion/commands","orion/objects","orion/webui/littlelib"],function(g,l,i,f,c){function d(b,c,d,e){l.Find.call(this,b,d,e);this._commandService=c}d.prototype=new l.Find;f.mixin(d.prototype,{getFindString:function(){var b=document.getElementById("localSearchFindWith");return!b?l.Find.prototype.getFindString.call(this):b.value},getReplaceString:function(){var b=document.getElementById("localSearchReplaceWith");
return!b?l.Find.prototype.getReplaceString(this):b.value},hide:function(){var b=this.isVisible();l.Find.prototype.hide.call(this);b&&this._commandService.closeParameterCollector()},show:function(b){l.Find.prototype.show.call(this,b);var c=b.findString,b=b.replaceString,d=document.getElementById("localSearchFindWith");d||(this._createActionTable(),d=document.getElementById("localSearchFindWith"));if(c)d.value=c;if(b)document.getElementById("localSearchReplaceWith").value=b;window.setTimeout(function(){d.select();
d.focus()},10)},_showReplaceInfo:function(){this._regex?(this._replaceInfo.src="data:image/gif;base64,R0lGODlhBwAIAMQAAMzX6cbT5kh4qFiIuKC40FCIuGSXwmWZw2SaxGacxmadxmWcxbPM4GigyJW92JzC26DI0P///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAAHAAgAAAUmoEQUQkFI0PBEz5A2yII0w9AwkUPbRpTsjUNEQUsFIgCXiGSShAAAOw==",this._replaceInfo.title=g["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 <td([\\s\\S]*?)</td> with <span$1</span>."]):
(this._replaceInfo.src="data:image/gif;base64,R0lGODlhBwAIAEAAACH5BAEAABIALAAAAAAHAAgAhwAAAAAAMwAAZgAAmQAAzAAA/wArAAArMwArZgArmQArzAAr/wBVAABVMwBVZgBVmQBVzABV/wCAAACAMwCAZgCAmQCAzACA/wCqAACqMwCqZgCqmQCqzACq/wDVAADVMwDVZgDVmQDVzADV/wD/AAD/MwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMrADMrMzMrZjMrmTMrzDMr/zNVADNVMzNVZjNVmTNVzDNV/zOAADOAMzOAZjOAmTOAzDOA/zOqADOqMzOqZjOqmTOqzDOq/zPVADPVMzPVZjPVmTPVzDPV/zP/ADP/MzP/ZjP/mTP/zDP//2YAAGYAM2YAZmYAmWYAzGYA/2YrAGYrM2YrZmYrmWYrzGYr/2ZVAGZVM2ZVZmZVmWZVzGZV/2aAAGaAM2aAZmaAmWaAzGaA/2aqAGaqM2aqZmaqmWaqzGaq/2bVAGbVM2bVZmbVmWbVzGbV/2b/AGb/M2b/Zmb/mWb/zGb//5kAAJkAM5kAZpkAmZkAzJkA/5krAJkrM5krZpkrmZkrzJkr/5lVAJlVM5lVZplVmZlVzJlV/5mAAJmAM5mAZpmAmZmAzJmA/5mqAJmqM5mqZpmqmZmqzJmq/5nVAJnVM5nVZpnVmZnVzJnV/5n/AJn/M5n/Zpn/mZn/zJn//8wAAMwAM8wAZswAmcwAzMwA/8wrAMwrM8wrZswrmcwrzMwr/8xVAMxVM8xVZsxVmcxVzMxV/8yAAMyAM8yAZsyAmcyAzMyA/8yqAMyqM8yqZsyqmcyqzMyq/8zVAMzVM8zVZszVmczVzMzV/8z/AMz/M8z/Zsz/mcz/zMz///8AAP8AM/8AZv8Amf8AzP8A//8rAP8rM/8rZv8rmf8rzP8r//9VAP9VM/9VZv9Vmf9VzP9V//+AAP+AM/+AZv+Amf+AzP+A//+qAP+qM/+qZv+qmf+qzP+q///VAP/VM//VZv/Vmf/VzP/V////AP//M///Zv//mf//zP///wAAAAAAAAAAAAAAAAgsAPcpQzMJjbJ9xNAQQ6hwUqaHDws+3PeQoMN9DiUuzFRQ2ZiDyyYdHFhwYUAAOw==",
this._replaceInfo.title=g["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 <td([\\s\\S]*?)</td> with <span$1</span>."]);this._replaceInfo.style.display=""},_createActionTable:function(){var b=this;this._commandService.openParameterCollector("pageNavigationActions",function(c){var d=document.createElement("input");d.type="text";d.name=g["Find:"];d.className="parameterInput";d.id="localSearchFindWith";d.placeholder=
g["Find With"];d.oninput=function(a){return b._handleInput(a)};d.onkeydown=function(a){return b._handleKeyDown(a)};c.appendChild(d);b._createButton("Next",c,function(){b.find(!0)});b._createButton("Previous",c,function(){b.find(!1)});var e=b._editor.getTextView().getOptions("readonly");if(!e){var a=document.createElement("input");a.type="text";a.name=g["ReplaceWith:"];a.className="parameterInput";a.id="localSearchReplaceWith";a.placeholder=g["Replace With"];a.onkeydown=function(a){return b._handleKeyDown(a)};
c.appendChild(a);b._replaceInfo=b._createInfoImage(null,c,null);b._showReplaceInfo();b._createButton(g.Replace,c,function(){b.replace()});b._createButton(g["Replace All"],c,function(){b.replaceAll()})}a=document.createElement("div");c.appendChild(a);a.classList.add("findOptionsDiv");var f=i.createDropdownMenu(a,g.Options,null,"dismissButton",null,!0);f.menuButton.classList.add("parameterInlineButton");i.createCheckedMenuItem(f.menu,g["Show all"],b._showAll,function(a){b.setOptions({showAll:a.target.checked});
f.dropdown.close(!0)});i.createCheckedMenuItem(f.menu,g["Case sensitive"],!b._caseInsensitive,function(a){b.setOptions({caseInsensitive:!a.target.checked});f.dropdown.close(!0);b.find(!0)});i.createCheckedMenuItem(f.menu,g["Wrap search"],b._wrap,function(a){b.setOptions({wrap:a.target.checked});f.dropdown.close(!0)});i.createCheckedMenuItem(f.menu,g["Incremental search"],b._incremental,function(a){b.setOptions({incremental:a.target.checked});f.dropdown.close(!0)});i.createCheckedMenuItem(f.menu,g["Whole Word"],
b._wholeWord,function(a){b.setOptions({wholeWord:a.target.checked});f.dropdown.close(!0);b.find(!0)});b._regExBox=i.createCheckedMenuItem(f.menu,g["Regular expression"],b._regex,function(a){b.setOptions({regex:a.target.checked});f.dropdown.close(!0);b.find(!0);b._showReplaceInfo()});e||i.createCheckedMenuItem(f.menu,g["Find after replace"],b._findAfterReplace,function(a){b.setOptions({findAfterReplace:a.target.checked});f.dropdown.close(!0)});return d},function(){b.hide()})},_createButton:function(b,
d,f){var e=document.createElement("button");e.addEventListener("click",f.bind(this),!1);var a=this;e.addEventListener("keydown",function(b){b.keyCode===c.KEY.ESCAPE&&a.hide()});e.appendChild(document.createTextNode(b));e.className="dismissButton parameterInlineButton";d.appendChild(e)},_createInfoImage:function(b,c){var d=document.createElement("img");d.classList.add("replaceInfo");d.addEventListener("click",function(){this._regExBox.checked=!this._regex;this.setOptions({regex:!this._regex});this.find(!0);
this._showReplaceInfo()}.bind(this));c.appendChild(d);return d},_handleInput:function(){this._incremental&&this.find(!0,null,!0);return!0},_handleKeyDown:function(b){var c=(this.isMac?b.metaKey:b.ctrlKey)&&!b.altKey&&!b.shiftKey;if(c&&b.keyCode===70)return b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0,!1;if((this.isMac?b.metaKey:b.ctrlKey)&&!b.altKey&&b.keyCode===75||b.keyCode===13)return b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0,b.keyCode===13?this.find(this._reverse?b.shiftKey:
!b.shiftKey):this.find(!b.shiftKey),!1;if(c&&b.keyCode===82)return b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0,this.replace(),!1;return b.keyCode===27?(this.hide(),!1):!0}});return{TextSearcher:d}});
define("orion/blamer",["orion/extensionCommands","orion/PageLinks","orion/URITemplate"],function(g,l,i){function f(c,d){for(var b=d.getFileMetadata(),f=c.getServiceReferences("orion.edit.blamer"),i=0;i<f.length;i++){var e=f[i],a={};a.validationProperties=e.getProperty("validationProperties");a.forceSingleItem=!0;a=g._makeValidator(a,c);if(a.validationFunction.bind(a)(b))return c.getService(e)}return null}return{isVisible:function(c,d){return!!f(c,d)&&!!c.getService("orion.core.blame")},getBlame:function(c,
d){var b=f(c,d);b&&b.doBlame(d.getInput()).then(function(b){for(var d=l.getOrionHome(),e=0;e<b.length;e++){var a=b[e],f=new i(a.CommitLink),g={};g.OrionHome=d;a.CommitLink=f.expand(g)}c.getService("orion.core.blame")._setAnnotations(b)})}}});
define("orion/editorCommands","i18n!orion/edit/nls/messages,orion/i18nUtil,orion/webui/littlelib,orion/webui/dialogs/OpenResourceDialog,orion/widgets/input/DropDownMenu,orion/Deferred,orion/URITemplate,orion/commands,orion/keyBinding,orion/commandRegistry,orion/extensionCommands,orion/contentTypes,orion/searchUtils,orion/PageUtil,orion/PageLinks,orion/blamer,orion/regex,orion/util,orion/edit/editorContext".split(","),function(g,l,i,f,c,d,b,h,k,e,a,j,p,m,n,s,q,t,v){function x(a){var c=new b(a.uriTemplate),
d=a.params||{};d.OrionHome=d.OrionHome||n.getOrionHome();var c=c.expand(d),d=document.createElement("div"),e=document.createElement("iframe");e.id=a.id;e.name=a.id;e.type="text/html";e.sandbox="allow-scripts allow-same-origin";e.frameborder=a.border!==void 0?a.border:1;e.src=c;e.className="delegatedUI";if(a.width)d.style.width=a.width,e.style.width=a.width;if(a.height)d.style.height=a.height,e.style.height=a.height;e.style.visibility="hidden";a.parent!==null&&(a.parent||window.document.body).appendChild(d);
d.appendChild(e);e.style.left=a.left||(window.innerWidth-parseInt(e.clientWidth,10))/2+"px";e.style.top=a.top||(window.innerHeight-parseInt(e.clientHeight,10))/2+"px";e.style.visibility="";window.addEventListener("message",function L(b){if(b.source===e.contentWindow&&typeof b.data==="string"&&(b=JSON.parse(b.data),b.pageService==="orion.page.delegatedUI"&&b.source===a.id)){if(b.cancelled)a.cancelled&&a.cancelled();else if(b.result)a.done&&a.done(b.result);else if(b.Status||b.status)a.status&&a.status(b.Status||
b.status);window.removeEventListener("message",L,!1);e.parentNode.removeChild(e)}},!1);return d}function u(a,b,c,d,e,f,h,g,j,i,k){this.serviceRegistry=a;this.commandService=b;this.fileClient=c;this.inputManager=d;this.toolbarId=e;this.pageNavId=h;this.isReadOnly=f;this._localSearcher=g;this._searcher=j;this.editorSettings=i;this.localSettings=k}var o={},r=null;o.createDelegatedUI=x;u.prototype={generateEditorCommands:function(a){this._generateSettingsCommand(a);this._generateSearchFilesCommand(a);
this.isReadOnly||(this._generateUndoStackCommands(a),this._generateSaveCommand(a));this._generateGotoLineCommnand(a);this._generateFindCommnand(a);this._generateBlame(a);this.isReadOnly||this._generateEditCommands(a)},_generateSettingsCommand:function(a){var b=this,d=new h.Command({imageClass:"core-sprite-wrench",tooltip:g.LocalEditorSettings,id:"orion.edit.settings",visibleWhen:function(){return!!a.getTextView()},callback:function(e){var f=d.settingsDropDown;if(!f||f.isDestroyed())f=d.settingsDropDown=
new c(e.domParent,e.domNode,{noClick:!0,selectionClass:"dropdownSelection",onShow:function(){f.focus()},onHide:function(){a.focus()}}),f.updateContent=b.localSettings.show.bind(b.localSettings),f.getContentNode().tabIndex=0;f.click()}});this.commandService.addCommand(d);this.commandService.registerCommandContribution("settingsActions","orion.edit.settings",1,null,!1,new k.KeyBinding("s",!0,!0))},_generateUndoStackCommands:function(a){this.commandService.addCommand(new h.Command({name:g.Undo,id:"orion.undo",
visibleWhen:function(){return!!a.getTextView()},callback:function(){a.getTextView().invokeAction("undo")}}));this.commandService.registerCommandContribution(this.toolbarId,"orion.undo",400,null,!0,a.getTextView().getKeyBindings("undo")[0]);this.commandService.addCommand(new h.Command({name:g.Redo,id:"orion.redo",visibleWhen:function(){return!!a.getTextView()},callback:function(){a.getTextView().invokeAction("redo")}}));this.commandService.registerCommandContribution(this.toolbarId,"orion.redo",401,
null,!0,a.getTextView().getKeyBindings("redo")[0])},_generateSearchFilesCommand:function(a){var b=this;if(b._searcher){var c=!1,d=new h.Command({name:g.searchFiles,tooltip:g.searchFiles,id:"orion.searchFiles",visibleWhen:function(){return!!a.getTextView()},callback:function(){a.getTextView().invokeAction("searchFiles")}});this.commandService.addCommand(d);this.commandService.registerCommandContribution(this.pageNavId,"orion.searchFiles",1,null,!0,new k.KeyBinding("h",!0));a.getTextView().setKeyBinding(new k.KeyBinding("h",
!0),"searchFiles");a.getTextView().setAction("searchFiles",function(){if(!c){var d=a.getSelection(),d=a.getText(d.start,d.end),e=b.serviceRegistry.getService("orion.page.progress"),h=new f.OpenResourceDialog({searcher:b._searcher,progress:e,searchRenderer:b._searcher.defaultRenderer,nameSearch:!1,title:g.searchFiles,message:g.searchTerm,initialText:d,onHide:function(){c=!1;a.focus()}});window.setTimeout(function(){c=!0;h.show(i.node(b.toolbarId))},0);return!0}},d)}},_generateSaveCommand:function(a){var b=
this;a.getTextView().setKeyBinding(new k.KeyBinding("s",!0),"save");a.getTextView().setAction("save",function(){if(b.inputManager.save)b.inputManager.save();else if(b.inputManager.onSave){var c=a.getText();b.inputManager.onSave(b.inputManager.getInput(),c,function(){a.setInput(b.inputManager.getInput(),null,c,!0);b.inputManager.afterSave&&b.inputManager.afterSave()},function(a){a.log=!0})}return!0},{name:g.Save});this.commandService.addCommand(new h.Command({name:g.Save,tooltip:g.saveFile,id:"orion.save",
visibleWhen:function(){return!a.getTextView()||b.inputManager.getReadOnly()?!1:!b.editorSettings||!b.editorSettings().autoSave},callback:function(){a.getTextView().invokeAction("save")}}));this.commandService.registerCommandContribution(this.toolbarId,"orion.save",1,null,!1,new k.KeyBinding("s",!0))},_generateGotoLineCommnand:function(a){var b=this,c=new e.ParametersDescription([new e.CommandParameter("line","number","Line:")],{hasOptionalParameters:!1},function(){var b=a.getModel().getLineAtOffset(a.getCaretOffset())+
1;return[new e.CommandParameter("line","number","Line:",b.toString())]}),c=new h.Command({name:g.gotoLine,tooltip:g.gotoLineTooltip,id:"orion.gotoLine",visibleWhen:function(){return!!a.getTextView()},parameters:c,callback:function(b){var c=a.getModel();b.parameters&&b.parameters.valueFor("line")?b=b.parameters.valueFor("line"):(b=c.getLineAtOffset(a.getCaretOffset()),(b=prompt(g.gotoLinePrompt,b+1))&&(b=parseInt(b,10)));if(b)a.onGotoLine(b-1,0)}});this.commandService.addCommand(c);this.commandService.registerCommandContribution(this.pageNavId,
"orion.gotoLine",1,null,!0,new k.KeyBinding("l",!t.isMac,!1,!1,t.isMac),new e.URLBinding("gotoLine","line"));a.getTextView().setAction("gotoLine",function(c){if(c)return a.onGotoLine(c.line-1,0,void 0,c.callback),!0;b.commandService.runCommand("orion.gotoLine");return!0},c)},_generateFindCommnand:function(a){var b=this,c=new e.ParametersDescription([new e.CommandParameter("find","text","Find:")],{clientCollect:!0},function(){var c=a.getSelection(),d="";c.end>c.start&&(d=a.getModel().getText(c.start,
c.end),b._localSearcher&&b._localSearcher.getOptions().regex&&(d=q.escape(d)));return[new e.CommandParameter("find","text","Find:",d)]}),c=new h.Command({name:g.Find,tooltip:g.Find,id:"orion.editor.find",visibleWhen:function(){return!!a.getTextView()},parameters:c,callback:function(c){if(b._localSearcher){var d="",e=null,f=a.getSelection();f.end>f.start&&c.parameters.valueFor("useEditorSelection")?(d=a.getModel().getText(f.start,f.end),b._localSearcher.getOptions().regex&&(d=q.escape(d))):c.parameters&&
c.parameters.valueFor("find")&&(d=c.parameters.valueFor("find"),e=m.matchResourceParameters(),p.convertFindURLBinding(e));if(e){b._localSearcher.setOptions({regex:e.regEx,caseInsensitive:!e.caseSensitive});c={};if(e.atLine)c.start=a.getModel().getLineStart(e.atLine-1);b._localSearcher.show({findString:d,replaceString:e.replaceWith});b._localSearcher.find(!0,c)}else b._localSearcher.show({findString:d});return!0}return!1}});this.commandService.addCommand(c);this.commandService.registerCommandContribution(this.pageNavId,
"orion.editor.find",2,null,!0,new k.KeyBinding("f",!0),new e.URLBinding("find","find"));a.getTextView().setAction("find",function(a){if(a)return b._localSearcher.show(a),!0;b.commandService.runCommand("orion.editor.find",null,null,new e.ParametersDescription([new e.CommandParameter("useEditorSelection","text","","true")],{clientCollect:!0}));return!0},c)},_generateBlame:function(a){var b=this,c=new h.Command({name:g.Blame,tooltip:g.BlameTooltip,id:"orion.edit.blame",parameters:new e.ParametersDescription([new e.CommandParameter("blame",
"boolean")],{clientCollect:!0}),visibleWhen:function(){return!a.getTextView()?!1:b.editorSettings&&!b.editorSettings().showBlame?!1:s.isVisible(b.serviceRegistry,b.inputManager)},callback:function(d){c.visible=!c.visible;if(d.parameters&&d.parameters.valueFor("blame"))c.visible=d.parameters.valueFor("blame")==="true";c.visible?s.getBlame(b.serviceRegistry,b.inputManager):a.showBlame([])}});this.commandService.addCommand(c);this.commandService.registerCommandContribution(this.toolbarId,"orion.edit.blame",
1,null,!1,new k.KeyBinding("b",!0,!0),new e.URLBinding("blame","blame"))},_generateEditCommands:function(b){function c(a){var b=new k.KeyBinding;k.KeyBinding.apply(b,a);return b}function e(a,b){!b&&a&&typeof a.HTML!=="undefined"&&delete a.HTML;var c=f.serviceRegistry.getService("orion.page.message");c?c.setProgressResult(a):window.console.log(a)}var f=this,m=this.serviceRegistry,p=m.getServiceReferences("orion.edit.command"),n=this.inputManager,o=m.getService("orion.page.progress"),q=function(a,c,
d){var j=d.visibleWhen;d.visibleWhen=function(a){return!b.getTextView()||f.inputManager.getReadOnly()?!1:!j||j(a)};d.callback=function(){b=this;var d=b.getSelection(),f=b.getModel(),h=function(a){typeof a==="object"&&a?(a.text&&b.setText(a.text),a.selection&&(b.setSelection(a.selection.start,a.selection.end,!0),b.focus())):typeof a==="string"&&(b.setText(a,d.start,d.end,!0),b.setSelection(d.start,d.start+a.length),b.focus())},j;c.execute?(f={contentType:n.getContentType(),input:n.getInput()},j=v.getEditorContext(m),
j.openDelegatedUI=x,j.setStatus=e,f=c.execute(j,f),j=null):(f=c.run(f.getText(d.start,d.end),f.getText(),d,n.getInput()),j=function(b){if(b&&b.uriTemplate){var c={};c.uriTemplate=b.uriTemplate;c.params=n.getFileMetadata();c.id=a.id;c.width=b.width;c.height=b.height;c.done=h;c.status=e;x(c)}else b.Status||b.status?e(b.Status||b.status):h(b)});o.showWhile(f,l.formatMessage(g.running,a.name)).then(j);return!0};d.callback=d.callback.bind(b);return new h.Command(d)};d.when(function(a){if(r)return r;var b=
a.getService("orion.core.contentTypeRegistry");b||(b=new j.ContentTypeRegistry(a),b=a.getService("orion.core.contentTypeRegistry"));return b.getContentTypes().then(function(a){return r=a})}(this.serviceRegistry),function(){var e=[],h=100;p.forEach(function(d){for(var g=f.serviceRegistry.getService(d),j={},i=d.getPropertyKeys(),k=0;k<i.length;k++)j[i[k]]=d.getProperty(i[k]);j.forceSingleItem=!0;d=a._createCommandOptions(j,d,f.serviceRegistry,r,!1,function(){return n.getFileMetadata()});e.push(d);d.then(function(a){a=
q(j,g,a);f.commandService.addCommand(a);f.commandService.registerCommandContribution(f.toolbarId,a.id,h);if(j.key){var d=b.getTextView();d.setKeyBinding(c(j.key),a.id);d.setAction(a.id,a.callback,a)}});h++});d.all(e,function(a){return{_error:a}}).then(function(){var a;if(a=n.getFileMetadata()){var c=i.node("pageActions");c&&(f.commandService.destroy(c),f.commandService.renderCommands(c.id,c,a,b,"button"));if(c=i.node("pageNavigationActions"))f.commandService.destroy(c),f.commandService.renderCommands(c.id,
c,b,b,"button")}})})}};o.EditorCommandFactory=u;return o});
define("orion/edit/ast",["orion/Deferred","orion/objects","orion/serviceTracker"],function(g,l,i){function f(c,d){this.serviceRegistry=c;this.inputManager=d;this.start()}l.mixin(f.prototype,{start:function(){if(this.registration)throw Error("Already started");this.tracker=new i(this.serviceRegistry,"orion.core.astprovider");this.tracker.open();this.registration=this.serviceRegistry.registerService("orion.core.astmanager",this,null);this.contextRegistration=this.serviceRegistry.registerService("orion.edit.context",
{getAST:this.getAST.bind(this)},null)},stop:function(){if(!this.registration)throw Error("Manager not running");this.registration.unregister();this.contextRegistration.unregister();this.tracker.close();this.listener=this.cachedAST=null},updated:function(){this.cachedAST=null},_getASTProvider:function(c){var d=this.tracker.getServiceReferences().filter(function(b){b=b.getProperty("contentType");return(Array.isArray(b)?b:[b]).indexOf(c)!==-1})[0];return d?this.serviceRegistry.getService(d):null},_getAST:function(c,
d){if(this.cachedAST)return this.cachedAST;var b=this._getASTProvider(c);return b?(d.text=this.inputManager.getEditor().getText(),b.computeAST(d)):null},getAST:function(c){var c=c||{},d=this,b=this.inputManager.getContentType();return g.when(this._getAST(b&&b.id,c),function(b){return d.cachedAST=b})}});return f});
define("orion/edit/dispatcher",["orion/edit/dispatcher"],function(){function g(g,i,f){this.serviceRegistry=g;this.editor=i;this.inputManager=f;this.contentTypeService=g.getService("orion.core.contentTypeRegistry");this.serviceReferences={};var c=this;this.listener={onServiceAdded:function(d){c._onServiceAdded(d.serviceReference)},onServiceRemoved:function(d){c._onServiceRemoved(d.serviceReference)}};this.serviceRegistry.addEventListener("registered",this.listener.onServiceAdded);this.serviceRegistry.addEventListener("unregistering",
this.listener.onServiceRemoved);this._init()}g.prototype={_init:function(){var g=this;this.editor.getTextView()?this._wire(this.serviceRegistry):this.editor.addEventListener("TextViewInstalled",function(){g._wire(g.serviceRegistry)})},_wire:function(g){for(var g=g.getServiceReferences("orion.edit.model"),i=0;i<g.length;i++)this._wireServiceReference(g[i])},_wireServiceReference:function(g){var i=g.getProperty("contentType");if(typeof i!==void 0&&i!==null){var f=this;this.contentTypeService.isSomeExtensionOf(this.inputManager.getContentType(),
i).then(function(c){c&&f._wireService(g,f.serviceRegistry.getService(g))})}},_wireService:function(g,i){var f=g.getProperty("types"),c=this.editor.getTextView();if(f){for(var d=0;d<f.length;d++){var b=f[d],h=i["on"+b];h&&this._wireServiceMethod(g,i,h,c,b)}this._initService(i,c)}},_wireServiceMethod:function(g,i,f,c,d){i=function(b){f(b).then()};g=g.getProperty("service.id");this.serviceReferences[g]=this.serviceReferences[g]||[];this.serviceReferences[g].push([c,d,i]);c.addEventListener(d,i)},_onServiceRemoved:function(g){var g=
g.getProperty("service.id"),i=this.serviceReferences[g];if(i){for(var f=0;f<i.length;f++){var c=i[f];c[0].removeEventListener(c[1],c[2])}delete this.serviceReferences[g]}},_onServiceAdded:function(g){g.getProperty("objectClass").indexOf("orion.edit.model")!==-1&&this._wireServiceReference(g)},_initService:function(g,i){var f=g.onModelChanging;if(typeof f==="function"){var c=i.getModel(),d=c.getText(),c={type:"Changing",text:d,start:0,removedCharCount:0,addedCharCount:d.length,removedLineCount:0,addedLineCount:c.getLineCount()};
f.call(g,c)}}};return{Dispatcher:g}});
define("orion/editor/keywords",[],function(){return{JSKeywords:"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(","),CSSKeywords:"alignment-adjust,alignment-baseline,animation,animation-delay,animation-direction,animation-duration,animation-iteration-count,animation-name,animation-play-state,animation-timing-function,appearance,azimuth,backface-visibility,background,background-attachment,background-clip,background-color,background-image,background-origin,background-position,background-repeat,background-size,baseline-shift,binding,bleed,bookmark-label,bookmark-level,bookmark-state,bookmark-target,border,border-bottom,border-bottom-color,border-bottom-left-radius,border-bottom-right-radius,border-bottom-style,border-bottom-width,border-collapse,border-color,border-image,border-image-outset,border-image-repeat,border-image-slice,border-image-source,border-image-width,border-left,border-left-color,border-left-style,border-left-width,border-radius,border-right,border-right-color,border-right-style,border-right-width,border-spacing,border-style,border-top,border-top-color,border-top-left-radius,border-top-right-radius,border-top-style,border-top-width,border-width,bottom,box-align,box-decoration-break,box-direction,box-flex,box-flex-group,box-lines,box-ordinal-group,box-orient,box-pack,box-shadow,box-sizing,break-after,break-before,break-inside,caption-side,clear,clip,color,color-profile,column-count,column-fill,column-gap,column-rule,column-rule-color,column-rule-style,column-rule-width,column-span,column-width,columns,content,counter-increment,counter-reset,crop,cue,cue-after,cue-before,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,fit-position,flex-align,flex-flow,flex-inline-pack,flex-order,flex-pack,float,float-offset,font,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,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,line-stacking-ruby,line-stacking-shift,line-stacking-strategy,list-style,list-style-image,list-style-position,list-style-type,margin,margin-bottom,margin-left,margin-right,margin-top,mark,mark-after,mark-before,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,outline-color,outline-offset,outline-style,outline-width,overflow,overflow-style,overflow-x,overflow-y,padding,padding-bottom,padding-left,padding-right,padding-top,page,page-break-after,page-break-before,page-break-inside,page-policy,pause,pause-after,pause-before,perspective,perspective-origin,phonemes,pitch,pitch-range,play-during,position,presentation-level,punctuation-trim,quotes,rendering-intent,resize,rest,rest-after,rest-before,richness,right,rotation,rotation-point,ruby-align,ruby-overhang,ruby-position,ruby-span,size,speak,speak-header,speak-numeral,speak-punctuation,speech-rate,stress,string-set,table-layout,target,target-name,target-new,target-position,text-align,text-align-last,text-decoration,text-emphasis,text-height,text-indent,text-justify,text-outline,text-shadow,text-transform,text-wrap,top,transform,transform-origin,transform-style,transition,transition-delay,transition-duration,transition-property,transition-timing-function,unicode-bidi,vertical-align,visibility,voice-balance,voice-duration,voice-family,voice-pitch,voice-pitch-range,voice-rate,voice-stress,voice-volume,volume,white-space,white-space-collapse,widows,width,word-break,word-spacing,word-wrap,z-index".split(","),JAVAKeywords:"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(",")}});
define("examples/editor/textStyler",["orion/editor/annotations","orion/editor/keywords"],function(g,l){function i(a,b){this.keywords=a;this.whitespacesVisible=b;this.setText("")}function f(){i.call(this,null,!0)}function c(a){i.call(this,null,a)}function d(){i.call(this,null,!1)}function b(a,b,g){this.commentStart="/*";this.commentEnd="*/";var j=[];switch(b){case "java":j=k;break;case "js":j=h;break;case "css":j=e}this.whitespacesVisible=this.spacesVisible=this.tabsVisible=!1;this.detectHyperlinks=
!0;this.highlightCaretLine=!1;this.detectTasks=this.foldingEnabled=!0;this._scanner=new i(j,this.whitespacesVisible);this._firstScanner=new d;this._commentScanner=new c(this.whitespacesVisible);this._whitespaceScanner=new f;if(b==="css")this._scanner.isCSS=!0,this._firstScanner.isCSS=!0;this.view=a;this.annotationModel=g;this._bracketAnnotations=void 0;var l=this;this._listener={onChanged:function(a){l._onModelChanged(a)},onDestroy:function(a){l._onDestroy(a)},onLineStyle:function(a){l._onLineStyle(a)},
onMouseDown:function(a){l._onMouseDown(a)},onSelection:function(a){l._onSelection(a)}};b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());b.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 h=l.JSKeywords,
k=l.JAVAKeywords,e=l.CSSKeywords,a={styleClass:"token_singleline_comment"},j={styleClass:"token_multiline_comment"},p={styleClass:"token_doc_comment"},m={styleClass:"token_doc_html_markup"},n={styleClass:"token_task_tag"},s={styleClass:"token_doc_tag"},q={styleClass:"token_string"},t={styleClass:"token_number"},v={styleClass:"token_keyword"},x={styleClass:"token_space",unmergeable:!0},u={styleClass:"token_tab",unmergeable:!0},o={styleClass:"line_caret"};i.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 a===32?11:10;do a=this._read();while(a===32||a===9);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,c=this.offset-1;if(!b&&48<=a&&a<=57){var d=b=!1,e=!1,f=
a;do if(a=this._read(),a===46&&!b)b=!0;else if(a===101&&!d)b=d=!0,a=this._read(),a!==45&&this._unread(a);else if(a===120&&f===48&&this.offset-c===2)b=d=e=!0;else if(!(48<=a&&a<=57||e&&(65<=a&&a<=70||97<=a&&a<=102)))break;while(1);this._unread(a);return 3}if(97<=a&&a<=122||65<=a&&a<=90||a===95||45===a&&b){do a=this._read();while(97<=a&&a<=122||65<=a&&a<=90||a===95||48<=a&&a<=57||45===a&&b);this._unread(a);a=this.keywords;if(a.length>0){c=this.text.substring(c,this.offset);for(b=0;b<a.length;b++)if(this.keywords[b]===
c)return 2}}return 1}},_read:function(){return this.offset<this.text.length?this.text.charCodeAt(this.offset++):-1},_unread:function(a){a!==-1&&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&&a===47)for(;;)if(a=this._read(),a===-1||a===10||a===13)return this._unread(a),6;if(a===42){a=this._read();b=7;for(a===42&&(b=8);;){for(;a===42;)if(a=this._read(),a===47)return b;if(a===-1)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(),a!==10&&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(),a!==10&&this._unread(a)}}break;default:return this._default(a)}}},
setText:function(a){this.text=a;this.startOffset=this.offset=0}};f.prototype=new i(null);f.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(!(a===32||a===9||a===-1));this._unread(a);return 1}}};c.prototype=new i(null);c.prototype.setType=function(a){this._type=a};c.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 a===32?11:10;do a=this._read();while(a===32||a===9);this._unread(a);return 9;case 60:if(this._type===8){do a=this._read();while(!(a===62||a===-1));if(a===62)return 12}return 1;case 64:if(this._type===8){do a=this._read();while(97<=a&&a<=122||65<=a&&a<=90||a===95||48<=a&&a<=57);this._unread(a);return 13}return 1;case 84:if((a=this._read())===79)if((a=this._read())===68)if((a=this._read())===79)if(a=this._read(),!(97<=a&&a<=122||65<=a&&a<=90||a===95||
48<=a&&a<=57))return this._unread(a),14;this._unread(a);default:do a=this._read();while(!(a===32||a===9||a===-1||a===60||a===64||a===84));this._unread(a);return 1}}};d.prototype=new i(null);d.prototype._default=function(a){for(;;)switch(a=this._read(),a){case 47:case 34:case 39:case -1:return this._unread(a),1}};b.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){if(this.whitespacesVisible!==a)this.whitespacesVisible=a,this._scanner.whitespacesVisible=a,this._commentScanner.whitespacesVisible=a,b&&this.view.redraw()},setTabsVisible:function(a){if(this.tabsVisible!==
a)this.tabsVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw()},setSpacesVisible:function(a){if(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,c,d,e){var f;d===void 0&&(d=-1);if(e===void 0)e=
a.length;for(;e-d>1;)if(f=Math.floor((e+d)/2),b<=a[f].start)e=f;else if(c&&b<a[f].end){e=f;break}else d=f;return e},_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(g.AnnotationType.ANNOTATION_FOLDING);for(var c=[],d=a.getBaseModel(),e=this.comments,f=0;f<e.length;f++){var h=
e[f];(h=this._createFoldingAnnotation(a,d,h.start,h.end))&&c.push(h)}b.replaceAnnotations(null,c)}}}},_createFoldingAnnotation:function(a,b,c,d){var e=b.getLineAtOffset(c),b=b.getLineAtOffset(d);return e===b?null:new (g.AnnotationType.getType(g.AnnotationType.ANNOTATION_FOLDING))(c,d,a)},_computeTasks:function(a,b,c){if(this.detectTasks){var d=this.annotationModel;if(d){var e=this.view.getModel(),f=e;e.getBaseModel&&(f=e.getBaseModel());for(var h=d.getAnnotations(b,c),e=[],j=g.AnnotationType.ANNOTATION_TASK;h.hasNext();){var i=
h.next();i.type===j&&e.push(i)}h=[];i=this._commentScanner;i.setText(f.getText(b,c));for(var k;k=i.nextToken();){var l=i.getStartOffset()+b;k===14&&(k=f.getLineEnd(f.getLineAtOffset(l)),a!==6&&(k=Math.min(k,c-this.commentEnd.length)),h.push(g.AnnotationType.createAnnotation(j,l,k,f.getText(l,k))))}d.replaceAnnotations(e,h)}}},_getLineStyle:function(a){if(this.highlightCaretLine){var b=this.view,c=b.getModel(),b=b.getSelection();if(b.start===b.end&&c.getLineAtOffset(b.start)===a)return o}return null},
_getStyles:function(a,b,c){a.getBaseModel&&(c=a.mapOffset(c));for(var d=c+b.length,e=[],f=c,h=this.comments,g=this._binarySearch(h,c,!0);g<h.length;g++){if(h[g].start>=d)break;var i=h[g].start,k=h[g].end;f<i&&this._parse(b.substring(f-c,i-c),f,e);var l=h[g].type,m;switch(l){case 8:m=p;break;case 7:m=j;break;case 5:m=q}f=Math.max(f,i);i=Math.min(d,k);(l===8||l===7)&&(this.whitespacesVisible||this.detectHyperlinks)?this._parseComment(b.substring(f-c,i-c),f,e,m,l):l===5&&this.whitespacesVisible?this._parseString(b.substring(f-
c,i-c),f,e,q):e.push({start:f,end:i,style:m});f=k}f<d&&this._parse(b.substring(f-c,d-c),f,e);if(a.getBaseModel)for(b=0;b<e.length;b++)c=e[b].end-e[b].start,e[b].start=a.mapOffset(e[b].start,!0),e[b].end=e[b].start+c;return e},_parse:function(b,c,d){var e=this._scanner;for(e.setText(b);b=e.nextToken();){var f=e.getStartOffset()+c,h=null;switch(b){case 2:h=v;break;case 3:h=t;break;case 5:case 4:if(this.whitespacesVisible){this._parseString(e.getData(),f,d,q);continue}else h=q;break;case 8:this._parseComment(e.getData(),
f,d,p,b);continue;case 6:this._parseComment(e.getData(),f,d,a,b);continue;case 7:this._parseComment(e.getData(),f,d,j,b);continue;case 10:this.whitespacesVisible&&this.tabsVisible&&(h=u);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(h=x)}d.push({start:f,end:e.getOffset()+c,style:h})}},_parseComment:function(a,b,c,d,e){var f=this._commentScanner;f.setText(a);for(f.setType(e);a=f.nextToken();){var e=f.getStartOffset()+b,h=d;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&
(h=u);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(h=x);break;case 12:h=m;break;case 13:h=s;break;case 14:h=n;break;default:this.detectHyperlinks&&(h=this._detectHyperlinks(f.getData(),e,c,h))}h&&c.push({start:e,end:f.getOffset()+b,style:h})}},_parseString:function(a,b,c,d){var e=this._whitespaceScanner;for(e.setText(a);a=e.nextToken();){var f=e.getStartOffset()+b,h=d;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(h=u);break;case 11:this.whitespacesVisible&&this.spacesVisible&&
(h=x)}h&&c.push({start:f,end:e.getOffset()+b,style:h})}},_detectHyperlinks:function(a,b,c,d){var e=null,f;if((f=a.indexOf("://"))>0){for(var e=a,h=f;h>0;){f=e.charCodeAt(h-1);if(!(97<=f&&f<=122||65<=f&&f<=90||45===f||48<=f&&f<=57))break;h--}if(h>0&&(f="\"\"''(){}[]<>".indexOf(e.substring(h-1,h)),f!==-1&&(f&1)===0&&(f=e.lastIndexOf("\"\"''(){}[]<>".substring(f+1,f+2)))!==-1)){var g=f;f=this._clone(d);f.tagName="a";f.attributes={href:e.substring(h,g)};c.push({start:b,end:b+h,style:d});c.push({start:b+
h,end:b+g,style:f});c.push({start:b+g,end:b+a.length,style:d});return null}}else a.toLowerCase().indexOf("bug#")===0&&(e="https://bugs.eclipse.org/bugs/show_bug.cgi?id="+parseInt(a.substring(4),10));return e?(f=this._clone(d),f.tagName="a",f.attributes={href:e},f):d},_clone:function(a){if(!a)return a;var b={},c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},_findComments:function(a,b){var b=b||0,c=this._firstScanner,d;c.setText(a);for(var e=[];d=c.nextToken();)(d===7||d===8||d===5)&&e.push({start:c.getStartOffset()+
b,end:c.getOffset()+b,type:d}),(d===6||d===7||d===8)&&this._computeTasks(d,c.getStartOffset()+b,c.getOffset()+b);return e},_findMatchingBracket:function(a,b){var c="{}()[]<>",d=a.getText(b,b+1),e=c.indexOf(d,0);if(e===-1)return-1;var f;f=e&1?c.substring(e-1,e):c.substring(e+1,e+2);for(var h=a.getLineAtOffset(b),c=a.getLine(h),g=a.getLineStart(h),j=a.getLineEnd(h),c=this._findBrackets(d,f,c,g,g,j),j=0;j<c.length;j++)if(g=c[j]>=0?1:-1,c[j]*g-1===b){var i=1;if(e&1){for(j--;j>=0;j--)if(g=c[j]>=0?1:-1,
i+=g,i===0)return c[j]*g-1;for(h-=1;h>=0;){c=a.getLine(h);g=a.getLineStart(h);j=a.getLineEnd(h);c=this._findBrackets(d,f,c,g,g,j);for(e=c.length-1;e>=0;e--)if(g=c[e]>=0?1:-1,i+=g,i===0)return c[e]*g-1;h--}}else{for(j++;j<c.length;j++)if(g=c[j]>=0?1:-1,i+=g,i===0)return c[j]*g-1;h+=1;for(e=a.getLineCount();h<e;){c=a.getLine(h);g=a.getLineStart(h);j=a.getLineEnd(h);c=this._findBrackets(d,f,c,g,g,j);for(j=0;j<c.length;j++)if(g=c[j]>=0?1:-1,i+=g,i===0)return c[j]*g-1;h++}}break}return-1},_findBrackets:function(a,
b,c,d,e,f){for(var h=[],a=a.charCodeAt(0),b=b.charCodeAt(0),g=e,j=this._scanner,i,k=this.comments,l=this._binarySearch(k,e,!0);l<k.length;l++){if(k[l].start>=f)break;i=k[l].start;var m=k[l].end;if(g<i)for(j.setText(c.substring(g-e,i-e));i=j.nextToken();)i===a?h.push(j.getStartOffset()+g-e+d+1):i===b&&h.push(-(j.getStartOffset()+g-e+d+1));g=m}if(g<f)for(j.setText(c.substring(g-e,f-e));i=j.nextToken();)i===a?h.push(j.getStartOffset()+g-e+d+1):i===b&&h.push(-(j.getStartOffset()+g-e+d+1));return h},_onDestroy:function(){this.destroy()},
_onLineStyle:function(a){if(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,c=a.newValue,d=this.view,a=d.getModel(),e;if(this.highlightCaretLine){var f=a.getLineAtOffset(b.start);e=a.getLineAtOffset(c.start);var h=c.start===c.end,b=b.start===b.end;f===e&&b&&h||(b&&d.redrawLines(f,f+1),(f!==e||!b)&&h&&d.redrawLines(e,e+1))}if(this.annotationModel){var b=this._bracketAnnotations,
j,i;if(c.start===c.end&&(i=d.getCaretOffset())>0)i-=1,a.getBaseModel&&(i=a.mapOffset(i),a=a.getBaseModel()),a=this._findMatchingBracket(a,i),a!==-1&&(j=[g.AnnotationType.createAnnotation(g.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,a+1),g.AnnotationType.createAnnotation(g.AnnotationType.ANNOTATION_CURRENT_BRACKET,i,i+1)]);this._bracketAnnotations=j;this.annotationModel.replaceAnnotations(b,j)}},_onMouseDown:function(a){if(a.clickCount===2){var b=this.view,c=b.getModel(),d=b.getOffsetAtLocation(a.x,
a.y);if(d>0){var e=d-1,f=c;c.getBaseModel&&(e=c.mapOffset(e),f=c.getBaseModel());e=this._findMatchingBracket(f,e);e!==-1&&(a.preventDefault(),a=e,c.getBaseModel&&(a=c.mapOffset(a,!0)),d>a&&(d--,a++),b.setSelection(a,d))}}},_onModelChanged:function(a){var b=a.start,c=a.removedCharCount,d=a.addedCharCount-c,e=this.view,a=e.getModel(),f=a.getBaseModel?a.getBaseModel():a,c=b+c,h=f.getCharCount(),j=this.comments.length,i=f.getLineStart(f.getLineAtOffset(b)),k=this._binarySearch(this.comments,i,!0),l=this._binarySearch(this.comments,
c,!1,k-1,j);k<j&&this.comments[k].start<=i&&i<this.comments[k].end?(i=this.comments[k].start,i>b&&(i+=d)):i=k===j&&j>0&&h-d===this.comments[j-1].end?this.comments[j-1].start:i;var m;l<j?(m=this.comments[l].end,m>b&&(m+=d),l+=1):(l=j,m=h);for(var p,h=this._findComments(f.getText(i,m),i),j=k;j<this.comments.length;j++)p=this.comments[j],p.start>b&&(p.start+=d),p.start>b&&(p.end+=d);var n=l-k!==h.length;if(!n)for(j=0;j<h.length;j++){p=this.comments[k+j];var o=h[j];if(p.start!==o.start||p.end!==o.end||
p.type!==o.type){n=!0;break}}j=[k,l-k].concat(h);Array.prototype.splice.apply(this.comments,j);n&&(j=i,p=m,a!==f&&(j=a.mapOffset(j,!0),p=a.mapOffset(p,!0)),e.redrawRange(j,p));if(this.foldingEnabled&&f!==a&&this.annotationModel){e=this.annotationModel;k=e.getAnnotations(i,m);i=[];for(m=[];k.hasNext();)if(p=k.next(),p.type===g.AnnotationType.ANNOTATION_FOLDING){m.push(p);for(j=0;j<h.length;j++)if(p.start===h[j].start&&p.end===h[j].end)break;j===h.length?(i.push(p),p.expand()):(j=p.start,l=p.end,j>
b&&(j-=d),l>b&&(l-=d),j<=b&&b<l&&j<=c&&c<l&&(j=f.getLineAtOffset(p.start),l=f.getLineAtOffset(p.end),j!==l?p.expanded||(p.expand(),e.modifyAnnotation(p)):e.removeAnnotation(p)))}b=[];for(j=0;j<h.length;j++){p=h[j];for(d=0;d<m.length;d++)if(m[d].start===p.start&&m[d].end===p.end)break;d===m.length&&(p=this._createFoldingAnnotation(a,f,p.start,p.end))&&b.push(p)}e.replaceAnnotations(i,b)}}};return{TextStyler:b}});
define("orion/editor/textMateStyler",["orion/regex"],function(g){function l(c){var d;if(c instanceof Array){d=Array(c.length);for(var b=0;b<c.length;b++)d[b]=l(c[b])}else for(b in d={},c)if(Object.prototype.hasOwnProperty.call(c,b)){var f=c[b];d[b]=typeof f==="object"&&f!==null?l(f):f}return d}function i(c,d,b){this.initialize(c);this.grammar=l(d);this.externalGrammars=b?l(b):[];this._styles={};this._tree=null;this._allGrammars={};this.preprocess(this.grammar)}var f={unsupported:[{regex:/\(\?[ims\-]:/,
func:function(){return"option on/off for subexp"}},{regex:/\(\?<([=!])/,func:function(c){return c[1]==="="?"lookbehind":"negative lookbehind"}},{regex:/\(\?>/,func:function(){return"atomic group"}}],toRegExp:function(c){function d(b,a){throw Error('Unsupported regex feature "'+b+'": "'+a[0]+'" at index: '+a.index+" in "+a.input);}var b="",h,c=f.processGlobalFlag("x",c,function(b){for(var a="",c=!1,d=b.length,f=0;f<d;){var h=b.charAt(f);if(!c&&h==="#")for(;f<d&&h!=="\r"&&h!=="\n";)h=b.charAt(++f);
else if(!c&&/\s/.test(h))for(;f<d&&/\s/.test(h);)h=b.charAt(++f);else h==="\\"?(a+=h,/\s/.test(b.charAt(f+1))||(a+=b.charAt(f+1),f+=1)):(h==="["?c=!0:h==="]"&&(c=!1),a+=h),f+=1}return a}),c=f.processGlobalFlag("i",c,function(c){b+="i";return c});for(h=0;h<this.unsupported.length;h++){var g;(g=this.unsupported[h].regex.exec(c))&&d(this.unsupported[h].func(g),g)}return RegExp(c,b)},processGlobalFlag:function(c,d,b){function f(b,a){for(var c=0,d=b.length,h=-1,g=a;g<d&&h===-1;g++)switch(b.charAt(g)){case "\\":g++;
break;case "(":c++;break;case ")":c--,c===0&&(h=g)}return h}var g="(?"+c+")",c="(?"+c+":";if(d.substring(0,g.length)===g)return b(d.substring(g.length));else if(d.substring(0,c.length)===c){g=f(d,0);if(g<d.length-1)throw Error("Only a "+c+") group that encloses the entire regex is supported in: "+d);return b(d.substring(c.length,g))}return d},hasBackReference:function(c){return/\\\d+/.test(c.source)},getSubstitutedRegex:function(c,d,b){for(var b=typeof b==="undefined"?!0:!1,c=c.source.split(/(\\\d+)/g),
f=[],i=0;i<c.length;i++){var e=c[i],a=/\\(\d+)/.exec(e);a?(e=d[a[1]]||"",f.push(b?g.escape(e):e)):f.push(e)}return RegExp(f.join(""))},groupify:function(c,d){for(var b=c.source,f=b.length,g=[],e=0,a=[],j=1,i=1,l=[],n={},s={},q=0;q<f;q++){var t=g[g.length-1],v=b.charAt(q);switch(v){case "(":if(t===4)g.pop(),l.push(")"),a[a.length-1].end=q;var x=q+2<f?b.charAt(q+1)+""+b.charAt(q+2):null;if(x==="?:"||x==="?="||x==="?!"){var u;x==="?:"?u=1:(u=3,e++);g.push(u);a.push({start:q,end:-1,type:u});l.push(v);
l.push(x);q+=x.length}else g.push(2),a.push({start:q,end:-1,type:2,oldNum:j,num:i}),l.push(v),e===0&&(s[i]=null),n[j]=i,j++,i++;break;case ")":t=g.pop();t===3&&e--;a[a.length-1].end=q;l.push(v);break;case "*":case "+":case "?":case "}":var o=v,r=b.charAt(q-1),x=q-1;if(v==="}"){for(u=q-1;b.charAt(u)!=="{"&&u>=0;u--);r=b.charAt(u-1);x=u-1;o=b.substring(u,q+1)}u=a[a.length-1];if(r===")"&&(u.type===2||u.type===4)){l.splice(u.start,0,"(");l.push(o);l.push(")");v={start:u.start,end:l.length-1,type:4,num:u.num};
for(r=0;r<a.length;r++)if(t=a[r],(t.type===2||t.type===4)&&t.start>=u.start&&t.end<=x)if(t.start+=1,t.end+=1,t.num+=1,t.type===2)n[t.oldNum]=t.num;a.push(v);i++;break}default:v!=="|"&&t!==2&&t!==4&&e===0&&(g.push(4),a.push({start:q,end:-1,type:4,num:i}),l.push("("),s[i]=null,i++),l.push(v),v==="\\"&&(v=b.charAt(q+1),l.push(v),q+=1)}}for(;g.length;)g.pop(),l.push(")");var b=RegExp(l.join("")),f={},d=d||n,w;for(w in d)d.hasOwnProperty(w)&&(f[w]="\\"+d[w]);b=this.getSubstitutedRegex(b,f,!1);return[b,
n,s]},complexCaptures:function(c){if(!c)return!1;for(var d in c)if(c.hasOwnProperty(d)&&d!=="0")return!0;return!1}};i.prototype={initialize:function(c){this.textView=c;this.textView.stylerOptions=this;var d=this;this._listener={onModelChanged:function(b){d.onModelChanged(b)},onDestroy:function(b){d.onDestroy(b)},onLineStyle:function(b){d.onLineStyle(b)},onStorage:function(b){d.onStorage(b)}};c.addEventListener("ModelChanged",this._listener.onModelChanged);c.addEventListener("Destroy",this._listener.onDestroy);
c.addEventListener("LineStyle",this._listener.onLineStyle);c.redrawLines()},onDestroy:function(){this.destroy()},destroy:function(){if(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(c){for(c=[c];c.length!==0;){var d=
c.pop();if(!d._resolvedRule||!d._typedRule)if(d._resolvedRule=this._resolve(d),d._typedRule=this._createTypedRule(d),this.addStyles(d.name),this.addStyles(d.contentName),this.addStylesForCaptures(d.captures),this.addStylesForCaptures(d.beginCaptures),this.addStylesForCaptures(d.endCaptures),d._resolvedRule!==d&&c.push(d._resolvedRule),d.patterns)for(var b=0;b<d.patterns.length;b++)c.push(d.patterns[b])}},addStyles:function(c){if(c&&!this._styles[c]){this._styles[c]=[];for(var d=c.split("."),b=0;b<
d.length;b++)this._styles[c].push(d.slice(0,b+1).join("-"))}},addStylesForCaptures:function(c){for(var d in c)c.hasOwnProperty(d)&&this.addStyles(c[d].name)},ContainerRule:function(){function c(c){this.rule=c;this.subrules=c.patterns}c.prototype.valueOf=function(){return"aa"};return c}(),BeginEndRule:function(){function c(c){this.rule=c;this.beginRegex=f.toRegExp(c.begin);this.endRegex=f.toRegExp(c.end);this.subrules=c.patterns||[];this.endRegexHasBackRef=f.hasBackReference(this.endRegex);var b=f.complexCaptures(c.captures),
c=f.complexCaptures(c.beginCaptures)||f.complexCaptures(c.endCaptures);if(this.isComplex=b||c)b=f.groupify(this.beginRegex),this.beginRegex=b[0],this.beginOld2New=b[1],this.beginConsuming=b[2],b=f.groupify(this.endRegex,this.beginOld2New),this.endRegex=b[0],this.endOld2New=b[1],this.endConsuming=b[2]}c.prototype.valueOf=function(){return this.beginRegex};return c}(),MatchRule:function(){function c(c){this.rule=c;this.matchRegex=f.toRegExp(c.match);if(this.isComplex=f.complexCaptures(c.captures))c=
f.groupify(this.matchRegex),this.matchRegex=c[0],this.matchOld2New=c[1],this.matchConsuming=c[2]}c.prototype.valueOf=function(){return this.matchRegex};return c}(),_createTypedRule:function(c){return c.match?new this.MatchRule(c):c.begin?new this.BeginEndRule(c):new this.ContainerRule(c)},_resolve:function(c){var d=c;if(c.include){if(c.begin||c.end||c.match)throw Error('Unexpected regex pattern in "include" rule '+c.include);c=c.include;if(c.charAt(0)==="#"){if(d=this.grammar.repository&&this.grammar.repository[c.substring(1)],
!d)throw Error("Couldn't find included rule "+c+" in grammar repository");}else if(c==="$self")d=this.grammar;else if(c==="$base")throw Error('Include "$base" is not supported');else if(d=this._allGrammars[c],!d)for(var b=0;b<this.externalGrammars.length;b++){var f=this.externalGrammars[b];if(f.scopeName===c){this.preprocess(f);d=this._allGrammars[c]=f;break}}}return d},ContainerNode:function(){function c(c,b){this.parent=c;this.rule=b;this.children=[];this.end=this.start=null}c.prototype.addChild=
function(c){this.children.push(c)};c.prototype.valueOf=function(){var c=this.rule;return"ContainerNode { "+(c.include||"")+" "+(c.name||"")+(c.comment||"")+"}"};return c}(),BeginEndNode:function(){function c(c,b,h){this.parent=c;this.rule=b;this.children=[];this.setStart(h);this.endMatch=this.end=null;this.endRegexSubstituted=b.endRegexHasBackRef?f.getSubstitutedRegex(b.endRegex,h):null}c.prototype.addChild=function(c){this.children.push(c)};c.prototype.getIndexInParent=function(){return this.parent?
this.parent.children.indexOf(this):-1};c.prototype.setStart=function(c){this.start=c.index;this.beginMatch=c};c.prototype.setEnd=function(c){c&&typeof c==="object"?(this.endMatch=c,this.end=c.index+c[0].length):(this.endMatch=null,this.end=c)};c.prototype.shiftStart=function(c){this.start+=c;this.beginMatch.index+=c};c.prototype.shiftEnd=function(c){this.end+=c;this.endMatch&&(this.endMatch.index+=c)};c.prototype.valueOf=function(){return"{"+this.rule.beginRegex+" range="+this.start+".."+this.end+
"}"};return c}(),push:function(c,d){if(d)for(var b=d.length;b>0;)c.push(d[--b])},exec:function(c,d,b){(d=c.exec(d))&&(d.index+=b);c.lastIndex=0;return d},afterMatch:function(c){return c.index+c[0].length},getEndMatch:function(c,d,b){if(c instanceof this.BeginEndNode){var f=c.rule,c=c.endRegexSubstituted||f.endRegex;return!c?null:this.exec(c,d,b)}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(c){var d=c.addedCharCount,b=c.removedCharCount,c=c.start;if(this._tree){var f=this.textView.getModel(),g=f.getCharCount(),f=f.getLineEnd(f.getLineAtOffset(c)-1),e=this.getFirstDamaged(f,f),f=f===-1?0:f,d=e?this.parse(e,!0,f,c,d,b):g;this.textView.redrawRange(f,d)}else this.initialParse()},getFirstDamaged:function(c,d){if(c<0)return this._tree;for(var b=[this._tree],f=null;b.length;){var g=b.pop();if(!g.parent||this.isDamaged(g,c,d)){g instanceof this.BeginEndNode&&(f=
g);for(var e=0;e<g.children.length;e++)b.push(g.children[e])}}return f||this._tree},isDamaged:function(c,d,b){return c.start<=b&&c.end>d},parse:function(c,d,b,f,g,e){var a=this.textView.getModel(),j=a.getLineStart(a.getLineCount()-1),i=a.getCharCount(),l=this.getInitialExpected(c,b),n=-1;if(d)c.repaired=!0,c.endNeedsUpdate=!0,n=(n=c.children[c.children.length-1])?a.getLineEnd(a.getLineAtOffset(n.end+(g-e))):-1,f=a.getLineEnd(a.getLineAtOffset(f+e)),n=Math.max(n,f);for(var n=n===-1?i:n,f=l,s=c,q=!1,
t=b,v=-1;s&&(!d||t<n);){var x=this.getNextMatch(a,s,t);x||(t=t>=j?i:a.getLineStart(a.getLineAtOffset(t)+1));var u=x&&x.match,o=x&&x.rule,r=x&&x.isEnd;if(x&&x.isSub){if(t=this.afterMatch(u),o instanceof this.BeginEndRule)q=!0,d&&o===f.rule&&s===f.parent?(s=f,s.setStart(u),s.repaired=!0,s.endNeedsUpdate=!0,f=this.getNextExpected(f,"begin")):(d&&(this.prune(s,f),d=!1),u=new this.BeginEndNode(s,o,u),s.addChild(u),s=u)}else if(r||t===i){if(s instanceof this.BeginEndNode)u?(q=!0,v=Math.max(v,s.end),s.setEnd(u),
t=this.afterMatch(u),d&&s===f&&s.parent===f.parent?(s.repaired=!0,delete s.endNeedsUpdate,f=this.getNextExpected(f,"end")):d&&(this.prune(s,f),d=!1)):(s.setEnd(i),delete s.endNeedsUpdate);s=s.parent}d&&t>=n&&!q&&(this.prune(c,l),d=!1)}this.removeUnrepairedChildren(c,d,b);this.cleanup(d,c,b,n,i,g,e);return d?Math.max(v,t):t},removeUnrepairedChildren:function(c,d,b){if(d){for(var d=c.children,f=-1,g=0;g<d.length;g++){var e=d[g];if(!e.repaired&&this.isDamaged(e,b,Number.MAX_VALUE)){f=g;break}}if(f!==
-1)c.children.length=f}},cleanup:function(c,d,b,f,g,e,a){if(c){c=e-a;g=this.getIntersecting(f-c+1,g);d=this.getIntersecting(b,f);for(b=0;b<g.length;b++)f=g[b],!f.repaired&&f instanceof this.BeginEndNode&&(f.shiftEnd(c),f.shiftStart(c));for(b=0;b<d.length;b++)f=d[b],f.repaired&&f.endNeedsUpdate&&f.shiftEnd(c),delete f.endNeedsUpdate,delete f.repaired}else{d=this.getIntersecting(b,f);for(b=0;b<d.length;b++)delete d[b].repaired}},getNextMatch:function(c,d,b,f){var g=c.getLineAtOffset(b),g=c.getLineEnd(g),
e=c.getText(b,g),a=[],j=[],c=[],g=[];for(this.push(a,d.rule.subrules);a.length;){var i=a.length?a.pop():null,i=i&&i._resolvedRule._typedRule;if(i instanceof this.ContainerRule&&j.indexOf(i)===-1)j.push(i),this.push(a,i.subrules);else if(!i||!f||i.matchRegex){var l=i&&this.exec(i.matchRegex||i.beginRegex,e,b);l&&(c.push(l),g.push(i))}}a=Number.MAX_VALUE;j=-1;for(i=0;i<c.length;i++)if(l=c[i],l.index<a)a=l.index,j=i;if(!f&&(b=this.getEndMatch(d,e,b)))if(f=d.rule.applyEndPatternLast,j===-1||b.index<a||
!f&&b.index===a)return{isEnd:!0,rule:d.rule,match:b};return j===-1?null:{isSub:!0,rule:g[j],match:c[j]}},getInitialExpected:function(c,d){var b,f;if(c===this._tree)for(b=0;b<c.children.length;b++){if(f=c.children[b],f.start>=d)return f}else if(c instanceof this.BeginEndNode&&c.endMatch){var g=c.endMatch.index;for(b=0;b<c.children.length;b++)if(f=c.children[b],f.start>=d)break;if(f&&f.start<g)return f}return c},getNextExpected:function(c,d){if(d==="begin"){var b=c.children[0];return b?b:c}else if(d===
"end"&&(b=c.parent)){var f=b.children[b.children.indexOf(c)+1];return f?f:b}return null},prune:function(c,d){if(d.parent===c)c.children.length=d.getIndexInParent();else if(c instanceof this.BeginEndNode)c.endMatch=null,c.end=null;if(c.parent)c.parent.children.length=c.getIndexInParent()+1},onLineStyle:function(c){this._tree||this.initialParse();var d=c.lineStart,b=this.textView.getModel(),f=b.getLineEnd(c.lineIndex),g=b.getLineEnd(b.getLineAtOffset(d)-1),g=this.getFirstDamaged(g,g),d=this.getLineScope(b,
g,d,f);c.ranges=this.toStyleRanges(d);c.ranges.sort(function(b,a){return b.start-a.start})},getLineScope:function(c,d,b,f){for(var g=b,e=this.getInitialExpected(d,b),a=[],j=[];d&&g<f;){var i=this.getNextMatch(c,d,g);if(!i)break;var l=i&&i.match,n=i&&i.rule,s=i&&i.isSub,i=i&&i.isEnd;l.index!==g&&j.push({start:g,end:l.index,node:d});if(s)g=this.afterMatch(l),n instanceof this.BeginEndRule?(this.addBeginScope(a,l,n),d=e,e=this.getNextExpected(e,"begin")):this.addMatchScope(a,l,n);else if(i)g=this.afterMatch(l),
this.addEndScope(a,l,n),e=this.getNextExpected(e,"end"),d=d.parent}g<f&&j.push({start:g,end:f,node:d});c=this.getInheritedLineScope(j,b,f);return a.concat(c)},getInheritedLineScope:function(c){for(var d=[],b=0;b<c.length;b++)for(var f=c[b],g=f.node;g;){var e=g.rule.rule,a=e.name;if(e=e.contentName||a){this.addScopeRange(d,f.start,f.end,e);break}g=g.parent}return d},addBeginScope:function(c,d,b){var f=b.rule;this.addCapturesScope(c,d,f.beginCaptures||f.captures,b.isComplex,b.beginOld2New,b.beginConsuming)},
addEndScope:function(c,d,b){var f=b.rule;this.addCapturesScope(c,d,f.endCaptures||f.captures,b.isComplex,b.endOld2New,b.endConsuming)},addMatchScope:function(c,d,b){var f=b.rule,g=f.name;(f=f.captures)?this.addCapturesScope(c,d,f,b.isComplex,b.matchOld2New,b.matchConsuming):this.addScope(c,d,g)},addScope:function(c,d,b){b&&c.push({start:d.index,end:this.afterMatch(d),scope:b})},addScopeRange:function(c,d,b,f){f&&c.push({start:d,end:b,scope:f})},addCapturesScope:function(c,d,b,f,g,e){if(b)if(f){for(var f=
{1:0},a=0,j=1;d[j]!==void 0;j++)e[j]!==void 0&&(a+=d[j].length),d[j+1]!==void 0&&(f[j+1]=a);e=d.index;for(a=1;b[a];a++){var j=b[a].name,i=g[a],l=e+f[i];typeof d[i]!=="undefined"&&this.addScopeRange(c,l,l+d[i].length,j)}}else this.addScope(c,d,b[0]&&b[0].name)},getIntersecting:function(c,d){for(var b=[],f=this._tree?[this._tree]:[];f.length;){var g=f.pop(),e=!1;g instanceof this.ContainerNode?e=!0:this.isDamaged(g,c,d)&&(e=!0,b.push(g));if(e)for(var e=g.children.length,a=0;a<e;a++)f.push(g.children[a])}return b.reverse()},
toStyleRanges:function(c){for(var d=[],b=0;b<c.length;b++){var f=c[b],g=this._styles[f.scope];if(!g)throw Error("styles not found for "+f.scope);g=g.join(" ");d.push({start:f.start,end:f.end,style:{styleClass:g}})}return d}};return{RegexUtil:f,TextMateStyler:i}});
define("orion/editor/AsyncStyler",["i18n!orion/editor/nls/messages","orion/editor/annotations"],function(g,l){function i(b){return b.getProperty("objectClass").indexOf(c)!==-1&&b.getProperty("type")==="highlighter"}function f(b,c,d){this.initialize(b,c,d);this.lineStyles=[]}var c="orion.edit.highlighter",d=c+" service must be an event emitter";l.AnnotationType.registerType("orion.annotation.highlightError",{title:g.syntaxError,html:"<div class='annotationHTML error'></div>",rangeStyle:{styleClass:"annotationRange error"}});
f.prototype={initialize:function(b,d,f){this.textView=b;this.serviceRegistry=d;this.annotationModel=f;this.services=[];var e=this;this.listener={onModelChanging:function(a){e.onModelChanging(a)},onModelChanged:function(a){e.onModelChanged(a)},onDestroy:function(a){e.onDestroy(a)},onLineStyle:function(a){e.onLineStyle(a)},onStyleReady:function(a){e.onStyleReady(a)},onServiceAdded:function(a){e.onServiceAdded(a.serviceReference,e.serviceRegistry.getService(a.serviceReference))},onServiceRemoved:function(a){e.onServiceRemoved(a.serviceReference,
e.serviceRegistry.getService(a.serviceReference))}};b.addEventListener("ModelChanging",this.listener.onModelChanging);b.addEventListener("ModelChanged",this.listener.onModelChanged);b.addEventListener("Destroy",this.listener.onDestroy);b.addEventListener("LineStyle",this.listener.onLineStyle);d.addEventListener("registered",this.listener.onServiceAdded);d.addEventListener("unregistering",this.listener.onServiceRemoved);b=d.getServiceReferences(c);for(f=0;f<b.length;f++){var a=b[f];i(a)&&this.addServiceListener(d.getService(a))}},
onDestroy:function(){this.destroy()},destroy:function(){if(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 b=0;b<this.services.length;b++)this.removeServiceListener(this.services[b]);this.services=
null}if(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(b){this.startLine=this.textView.getModel().getLineAtOffset(b.start)},onModelChanged:function(b){var c=this.startLine;(b.addedLineCount||b.removedLineCount)&&Array.prototype.splice.apply(this.lineStyles,[c,b.removedLineCount].concat(this._getEmptyStyle(b.addedLineCount)))},
onStyleReady:function(b){var c=b.lineStyles||b.style,b=Number.MAX_VALUE,d=-1,e=this.textView.getModel(),a;for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&(this.lineStyles[a]=c[a],b=Math.min(b,a),d=Math.max(d,a));b=Math.max(b,0);d=Math.min(d,e.getLineCount());if(c=this.annotationModel){for(var f=c.getAnnotations(e.getLineStart(b),e.getLineEnd(d)),g=[];f.hasNext();){var i=f.next();i.type==="orion.annotation.highlightError"&&g.push(i)}f=[];for(i=b;i<=d;i++){a=i;var n=this.lineStyles[a],n=n&&n.errors;
a=e.getLineStart(a);if(n)for(var s=0;s<n.length;s++){var q=n[s];f.push(l.AnnotationType.createAnnotation("orion.annotation.highlightError",q.start+a,q.end+a))}}c.replaceAnnotations(g,f)}this.textView.redrawLines(b,d+1)},onLineStyle:function(b){function c(b,a){for(var d=b.length,f=[],g=0;g<d;g++){var h=b[g];f.push({start:h.start+a,end:h.end+a,style:h.style})}return f}var d=this.lineStyles[b.lineIndex];if(d)if(d.ranges)b.ranges=c(d.ranges,b.lineStart);else if(d.style)b.style=d.style},_getEmptyStyle:function(b){for(var c=
[],d=0;d<b;d++)c.push(null);return c},setContentType:function(b){this.contentType=b;if(this.services)for(b=0;b<this.services.length;b++){var c=this.services[b];if(c.setContentType){var d=this.serviceRegistry.getService("orion.page.progress");d?d.progress(c.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):c.setContentType(this.contentType)}}},onServiceAdded:function(b,c){i(b)&&this.addServiceListener(c)},onServiceRemoved:function(b,
c){this.services.indexOf(c)!==-1&&this.removeServiceListener(c)},addServiceListener:function(b){if(typeof b.addEventListener==="function"){if(b.addEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),this.services.push(b),b.setContentType&&this.contentType){var c=this.serviceRegistry.getService("orion.page.progress");c?c.progress(b.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):b.setContentType(this.contentType)}}else typeof console!==
"undefined"&&console.log(Error(d))},removeServiceListener:function(b){typeof b.removeEventListener==="function"?(b.removeEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),b=this.services.indexOf(b),b!==-1&&this.services.splice(b,1)):typeof console!=="undefined"&&console.log(Error(d))}};return f});
define("orion/highlight",["examples/editor/textStyler","orion/editor/textMateStyler","orion/editor/AsyncStyler","orion/Deferred"],function(g,l,i,f){function c(b,c,d,e,a,j,p){function m(a,b){var e=a.getProperty("contentType"),g=a.getProperty("fileTypes");if(e)return c.isSomeExtensionOf(d,e).then(function(b){return b?a:null});else if(b&&g&&g.indexOf(b)!==-1)return e=new f,e.resolve(a),e;return null}var n=function(b){var c=null;switch(b&&b.id){case "application/javascript":case "application/json":c=
new g.TextStyler(e,"js",a);break;case "text/x-java-source":c=new g.TextStyler(e,"java",a);break;case "text/css":c=new g.TextStyler(e,"css",a)}return c}(d);if(n)return j=new f,j.resolve(n),j;for(var n=j&&j.split(".").pop().toLowerCase(),j=b.getServiceReferences("orion.edit.highlighter"),s=[],q=[],t=0;t<j.length;t++){var v=j[t];v.getProperty("type")==="grammar"&&s.push(v.getProperty("grammar"));(v=m(v,n))&&q.push(v)}return f.all(q,function(a){return{_error:a}}).then(function(c){for(var f,g=c.length-
1;g>=0;g--){var h=c[g];if(h&&!h._error&&(p||h.getProperty("type")!=="highlighter")){f=h;break}}var j;if(f)if(c=f.getProperty("type"),c==="highlighter")j=new i(e,b,a),j.setContentType(d);else if(c==="grammar"||typeof c==="undefined")f=f.getProperty("grammar"),j=new l.TextMateStyler(e,f,s);return j})}function d(b){this.serviceRegistry=b;this.styler=null}d.prototype={setup:function(b,d,f,e,a){a=typeof a==="undefined"?!0:a;if(this.styler)this.styler.destroy&&this.styler.destroy(),this.styler=null;var g=
this;return c(this.serviceRegistry,this.serviceRegistry.getService("orion.core.contentTypeRegistry"),b,d,f,e,a).then(function(a){return g.styler=a})},getStyler:function(){return this.styler}};return{createStyler:c,SyntaxHighlighter:d}});
define("orion/markOccurrences",["orion/edit/editorContext","orion/Deferred"],function(g,l){function i(f,c,d){this.registry=f;this.inputManager=c;this.editor=d}i.prototype={findOccurrences:function(){function f(b,c,a){function d(a,b,c){a=b.getProperty("contentType");return f.isSomeExtensionOf(c,a).then(function(a){return a?b:null})}for(var f=b.getService("orion.core.contentTypeRegistry"),g=b.getServiceReferences("orion.edit.occurrences"),h=[],i=0;i<g.length;i++){var q=g[i],t=q.getProperty("pattern");
q.getProperty("contentType")?h.push(d(b,q,c)):t&&RegExp(t).test(a)&&(t=new l,t.resolve(q),h.push(t))}return l.all(h,function(a){return{_error:a}}).then(function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c];d&&!d._error&&b.push(d)}return b})}var c,d=this,b=d.registry.getService("orion.edit.occurrences"),h=function(){c&&window.clearTimeout(c);c=window.setTimeout(function(){c=null;var f={selection:d.editor.getSelection()};b.computeOccurrences(g.getEditorContext(d.registry),f).then(function(b){d.editor.showOccurrences(b)})},
500)};d.inputManager.addEventListener("InputChanged",function(b){var e=d.editor.getTextView();e&&(e.removeEventListener("Selection",h),f(d.registry,b.contentType,b.title).then(function(a){!a||a.length===0?c&&window.clearTimeout(c):e.addEventListener("Selection",h)}))})}};return{MarkOccurrences:i}});
define("orion/syntaxchecker",["orion/Deferred","orion/edit/editorContext"],function(g,l){return{SyntaxChecker:function(){function i(f,c){this.registry=f;this.editor=c}i.prototype={checkSyntax:function(f,c,d,b){function h(a,b){function d(a,b,c){a=b.getProperty("contentType");return e.isSomeExtensionOf(c,a).then(function(a){return a?b:null})}for(var e=a.getService("orion.core.contentTypeRegistry"),f=a.getServiceReferences("orion.edit.validator"),h=[],i=0;i<f.length;i++){var k=f[i],l=k.getProperty("pattern");
k.getProperty("contentType")?h.push(d(a,k,b)):l&&RegExp(l).test(c)&&(l=new g,l.resolve(k),h.push(l))}return g.all(h,function(a){return{_error:a}}).then(function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c];d&&!d._error&&b.push(d)}return b})}if(f&&!d){var i=this,e=this.registry;h(e,f).then(function(a){var d=function(a){return a&&(a.problems||a.errors)||[]},h=e.getService("orion.page.progress"),a=a.map(function(a){var a=e.getService(a),g;a.computeProblems?(g={contentType:f.id,title:c},g=a.computeProblems(l.getEditorContext(e),
g)):a.checkSyntax&&(g=a.checkSyntax(c,b));return h.progress(g,"Validating "+c).then(d)});g.all(a,function(a){return{_error:a}}).then(function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c];d._error||(i._fixup(d),b=b.concat(d))}e.getService("orion.core.marker")._setProblems(b)})})}},_fixup:function(f){for(var c=this.editor.getModel(),d=0;d<f.length;d++){var b=f[d];b.description=b.description||b.reason;b.severity=b.severity||"error";b.start=typeof b.start==="number"?b.start:b.character;b.end=typeof b.end===
"number"?b.end:b.start+1;if(typeof b.line==="number"){var g=c.getLine(b.line-1,!1).length;b.start=Math.max(1,b.start)}else g=c.getCharCount(),b.start=Math.max(0,b.start);b.start=Math.min(b.start,g);b.end=Math.min(b.end,g);b.end=Math.max(b.start,b.end)}}};return i}()}});
define("orion/editorView","i18n!orion/edit/nls/messages,orion/editor/editor,orion/editor/textView,orion/editor/textModel,orion/editor/projectionTextModel,orion/editor/editorFeatures,orion/editor/contentAssist,orion/editor/emacs,orion/editor/vi,orion/editorPreferences,orion/widgets/themes/ThemePreferences,orion/widgets/themes/editor/ThemeData,orion/widgets/settings/EditorSettings,orion/searchAndReplace/textSearcher,orion/editorCommands,orion/edit/ast,orion/edit/dispatcher,orion/edit/editorContext,orion/highlight,orion/markOccurrences,orion/syntaxchecker,orion/objects".split(","),function(g,
l,i,f,c,d,b,h,k,e,a,j,p,m,n,s,q,t,v,x,u,o){function r(a){this._parent=a.parent;this.renderToolbars=a.renderToolbars;this.serviceRegistry=a.serviceRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.commandRegistry=a.commandRegistry;this.progress=a.progress;this.statusService=a.statusService;this.fileClient=a.fileService;this.inputManager=a.inputManager;this.preferences=a.preferences;this.readonly=a.readonly;this.searcher=a.searcher;this.syntaxHighlighter=new v.SyntaxHighlighter(this.serviceRegistry);
this.astManager=new s(this.serviceRegistry,this.inputManager);this.settings={};this._init()}r.prototype={updateKeyMode:function(a,b){this.emacs&&b.removeKeyMode(this.emacs);this.vi&&b.removeKeyMode(this.vi);if(a.keyBindings==="Emacs"){if(!this.emacs)this.emacs=new h.EmacsMode(b);b.addKeyMode(this.emacs)}else if(a.keyBindings==="vi"){if(!this.vi)this.vi=new k.VIMode(b,this.statusReporter.bind(this));b.addKeyMode(this.vi)}},updateSourceCodeActions:function(a,b){b&&(b.setAutoPairParentheses(a.autoPairParentheses),
b.setAutoPairBraces(a.autoPairBraces),b.setAutoPairSquareBrackets(a.autoPairSquareBrackets),b.setAutoPairAngleBrackets(a.autoPairAngleBrackets),b.setAutoPairQuotations(a.autoPairQuotations),b.setAutoCompleteComments(a.autoCompleteComments),b.setSmartIndentation(a.smartIndentation))},updateViewOptions:function(a){var b=0;if(a.showMargin&&(b=a.marginOffset,typeof b!=="number"))b=a.marginOffset=parseInt(b,10);var c=0;a.wordWrap&&(c=b);return{readonly:this.readonly||this.inputManager.getReadOnly(),tabSize:a.tabSize||
4,expandTab:a.expandTab,wrapMode:a.wordWrap,wrapOffset:c,marginOffset:b,scrollAnimation:a.scrollAnimation?a.scrollAnimationTimeout:0}},updateSettings:function(a){this.settings=a;var b=this.editor,c=this.inputManager;c.setAutoLoadEnabled(a.autoLoad);c.setAutoSaveTimeout(a.autoSave?a.autoSaveTimeout:-1);c.setSaveDiffsEnabled(a.saveDiffs);this.updateStyler(a);var d=b.getTextView();d&&(this.updateKeyMode(a,d),d.setOptions(this.updateViewOptions(a)));this.updateSourceCodeActions(a,b.getSourceCodeActions());
b.setAnnotationRulerVisible(a.annotationRuler);b.setLineNumberRulerVisible(a.lineNumberRuler);b.setFoldingRulerVisible(a.foldingRuler);b.setOverviewRulerVisible(a.overviewRuler);this.renderToolbars&&this.renderToolbars(c.getFileMetadata())},updateStyler:function(a){var b=this.syntaxHighlighter.getStyler();b&&(b.setTabsVisible&&b.setTabsVisible(a.showTabs),b.setSpacesVisible&&b.setSpacesVisible(a.showSpaces))},statusReporter:function(a,b,c){b==="progress"?this.statusService.setProgressMessage(a):b===
"error"?this.statusService.setErrorMessage(a):this.statusService.setMessage(a,null,c)},_init:function(){var h=this.editorPreferences=new e.EditorPreferences(this.preferences,function(a){a?this.updateSettings(a):h.getPrefs(this.updateSettings.bind(this))}.bind(this)),k=new a.ThemePreferences(this.preferences,new j.ThemeData);k.apply();var r,s=this,v=this._parent,L=this.readonly,B=this.commandRegistry,C=this.serviceRegistry,E=this.fileClient,K=this.inputManager,O=this.searcher,U=this.progress,N=this.contentTypeRegistry,
D=L?null:{createContentAssistMode:function(a){var c=new b.ContentAssist(a.getTextView());c.addEventListener("Activating",function(){var b=K.getContentType(),d=a.getTitle(),e=C.getServiceReferences("orion.edit.contentAssist").concat(C.getServiceReferences("orion.edit.contentassist")).map(function(a){var c=a.getProperty("contentType"),e=a.getProperty("pattern");return c&&N.isSomeExtensionOf(b,c)||e&&RegExp(e).test(d)?C.getService(a):null}).filter(function(a){return!!a});c.setEditorContextFactory(t.getEditorContext.bind(null,
C));c.setProviders(e);c.setProgress(U)});var d=new b.ContentAssistWidget(c,"contentassist"),d=new b.ContentAssistMode(c,d);c.setMode(d);return d}},G=this.editor=new l.Editor({textViewFactory:function(){var a=s.updateViewOptions(s.settings);o.mixin(a,{parent:v,model:new c.ProjectionTextModel(new f.TextModel),wrappable:!0});return new i.TextView(a)},undoStackFactory:new d.UndoFactory,textDNDFactory:new d.TextDNDFactory,annotationFactory:new d.AnnotationFactory,foldingRulerFactory:new d.FoldingRulerFactory,
lineNumberRulerFactory:new d.LineNumberRulerFactory,contentAssistFactory:D,keyBindingFactory:function(a,b,c,e){b=new m.TextSearcher(a,B,c);c=(new d.KeyBindingsFactory).createKeyBindings(a,c,e,b);s.updateSourceCodeActions(s.settings,c.sourceCodeActions);(new n.EditorCommandFactory(C,B,E,K,"pageActions",L,"pageNavigationActions",b,O,function(){return s.settings},r)).generateEditorCommands(a);var f=a.getTextView();f.setAction("toggleWrapMode",function(){f.invokeAction("toggleWrapMode",!0);var a=f.getOptions("wrapMode");
s.settings.wordWrap=a;h.setPrefs(s.settings);return!0});s.vi=s.emacs=null;s.updateKeyMode(s.settings,f);return c},statusReporter:this.statusReporter.bind(this),domNode:v});G.processParameters=function(a){for(var b=["start","end","line","offset","length"],c=0;c<b.length;c++){var d=b[c];a[d]&&(a[d]=parseInt(a[d],10))}this.showSelection(a.start,a.end,a.line,a.offset,a.length)};this.dispatcher=new q.Dispatcher(this.serviceRegistry,G,K);r=new p({local:!0,editor:G,themePreferences:k,preferences:h});K.addEventListener("InputChanged",
function(a){var b=G.getTextView();b&&b.setOptions(this.updateViewOptions(this.settings));this.syntaxHighlighter.setup(a.contentType,G.getTextView(),G.getAnnotationModel(),a.title,!0).then(function(){this.updateStyler(this.settings)}.bind(this))}.bind(this));K.addEventListener("Saving",function(){s.settings.trimTrailingWhiteSpace&&G.getTextView().invokeAction("trimTrailingWhitespaces")});C.getService("orion.core.marker").addEventListener("problemsChanged",function(a){G.showProblems(a.problems)});C.getService("orion.core.blame").addEventListener("blameChanged",
function(a){G.showBlame(a.blameInfo)});var R=new x.MarkOccurrences(C,K,G);G.addEventListener("TextViewInstalled",function(a){a.textView.getModel().addEventListener("Changed",s.astManager.updated.bind(s.astManager));R.findOccurrences()});var H=new u.SyntaxChecker(C,G);G.addEventListener("InputChanged",function(a){H.checkSyntax(K.getContentType(),a.title,a.message,a.contents);K.getReadOnly()&&G.reportStatus(g.readonly,"error")});var Q={};"getCaretOffset,setCaretOffset,getSelection,setSelection,getText,setText".split(",").forEach(function(a){Q[a]=
G[a].bind(G)});C.registerService("orion.edit.context",Q,null);this.editorPreferences.getPrefs(this.updateSettings.bind(this))},create:function(){this.editor.installTextView()},destroy:function(){this.editor.uninstallTextView()}};return{EditorView:r}});
define("orion/urlUtils",["orion/PageUtil","orion/URL-shim"],function(g){return{detectValidURL:function(l){for(var i=/\[([^\]]*)\]\(([^\)]+)\)/g,f=i.exec(l),c=[],d=0;f;){if(f.length===3&&f[2].length>0){var b=new URL(f[2]);b.protocol!==":"&&g.validateURLScheme(b.href)&&(f.index>d&&c.push({segmentStr:l.substring(d,f.index)}),c.push({segmentStr:f[1].length>0?f[1]:f[2],urlStr:f[2]}),d=f.index+f[0].length)}f=i.exec(l)}if(d===0)return null;d<l.length-1&&c.push({segmentStr:l.substring(d)});return c},processURLSegments:function(g,
i){i.forEach(function(f){if(f.urlStr){var c=document.createElement("a");c.href=f.urlStr;c.appendChild(document.createTextNode(f.segmentStr))}else c=document.createElement("span"),c.textContent=f.segmentStr;g.appendChild(c)})}}});
define("orion/status",["i18n!orion/nls/messages","orion/webui/littlelib","orion/globalCommands","orion/urlUtils"],function(g,l,i,f){function c(b,c,d,e,a){this._serviceRegistry=b;this._serviceRegistration=b.registerService("orion.page.message",this);this._operationsClient=c;this.notificationContainerDomId=a;this.domId=d;this.progressDomId=e||d;this._hookedClose=!1;this._timer=null;this._clickToDisMiss=!0;this._cancelMsg=null}var d;c.prototype={_init:function(){var b=l.node("closeNotifications");if(b&&
!this._hookedClose){b.style.cursor="pointer";this._hookedClose=!0;var c=l.node(this.notificationContainerDomId);l.addAutoDismiss([c],function(){this._clickToDisMiss&&this.close()}.bind(this));b.addEventListener("click",function(){this.close()}.bind(this));c.addEventListener("click",function(b){b&&b.target&&b.target.nodeName.toLowerCase()==="a"&&(b=l.$$("a",c))&&b.length&&b.length===1&&this.close()}.bind(this))}},close:function(){window.clearTimeout(this._timer);this.setProgressMessage("");var b=l.node("closeNotifications");
if(this._cancelMsg&&this._cancelFunc&&b)b.innerHTML="",b.classList.remove("cancelButton"),b.classList.add("dismissButton"),b.classList.add("core-sprite-close"),b.classList.add("imageSprite"),this._cancelFunc(),this._cancelMsg=null},_getNotifierElements:function(){if(!this._notifierElements)this._notifierElements=i.getToolbarElements(this.notificationContainerDomId);return this._notifierElements},setMessage:function(b,c,d){this._init();this.currentMessage=b;var e=l.node(this.domId);if(typeof d==="boolean"){var a=
e.getAttribute("aria-live");e.setAttribute("aria-live",d?"polite":"off");window.setTimeout(function(){b===this.currentMessage&&(l.empty(e),e.appendChild(document.createTextNode(b)),window.setTimeout(function(){e.setAttribute("aria-live",a)},100))}.bind(this),100)}else l.empty(e),e.appendChild(document.createTextNode(b));typeof c==="number"&&window.setTimeout(function(){b===this.currentMessage&&(l.empty(e),e.appendChild(document.createTextNode("")))}.bind(this),c)},setErrorMessage:function(b){this._clickToDisMiss=
!0;this.currentMessage=b;this._init();var c=b.responseText||b.message||b;if(typeof c==="string")try{c=JSON.parse(c)}catch(d){}var b=c.Message||c,e="red";if(c.Severity)switch(c.Severity){case "Warning":e="#FFCC00";break;case "Error":e="red";break;case "Info":case "Ok":e="green"}c=document.createElement("span");c.style.color=e;c.appendChild(document.createTextNode(b));b=l.node(this.domId);l.empty(b);b.appendChild(c)},setProgressMessage:function(b){this._clickToDisMiss=!1;this._init();this.currentMessage=
b;var c=document.createElement("span");c.classList.add("imageSprite");c.classList.add("progressIcon");c.classList.add("core-sprite-progress");var d=l.node(this.progressDomId);l.empty(d);d.appendChild(c);d.appendChild(document.createTextNode(b));c=l.node(this.notificationContainerDomId);c.classList.remove("notificationHide");if(b&&b.length>0)c.classList.add("progressNormal"),c.classList.add("notificationShow");else if(this._progressMonitors&&this._progressMonitors.length>0)return this._renderOngoingMonitors();
else c.classList.remove("notificationShow"),c.classList.add("notificationHide")},setCancelFunction:function(b){this._cancelFunc=b},setProgressResult:function(b,c){this._clickToDisMiss=!1;this._cancelMsg=c;this.currentMessage=b;var d=b.responseText||b;if(typeof d==="string")try{d=JSON.parse(d)}catch(e){}this._init();var a=d.Message||d.toString(),i=g.UnknownError,p="core-sprite-information",m="progressNormal",n=document.createElement("span");n.classList.add("imageSprite");n.classList.add("progressIcon");
var s=[];if(d.Severity)switch(d.Severity){case "Warning":i=g.UnknownWarning;p="core-sprite-warning";m="progressWarning";s.push("progressInfo");s.push("progressError");s.push("progressNormal");this._clickToDisMiss=!0;break;case "Error":p="core-sprite-error";m="progressError";s.push("progressWarning");s.push("progressInfo");s.push("progressNormal");this._clickToDisMiss=!0;break;default:m="progressNormal",s.push("progressWarning"),s.push("progressError"),s.push("progressNormal")}s.push("notificationHide");
n.classList.add(p);var q=l.node(this.progressDomId),p=l.node(this.notificationContainerDomId);l.empty(q);q.appendChild(n);a===Object.prototype.toString()&&(a=i);if(d.HTML)d=document.createElement("span"),d.innerHTML=a,q.appendChild(d);else{if(i=f.detectValidURL(a))a=document.createDocumentFragment(),f.processURLSegments(a,i),Array.prototype.forEach.call(l.$$("a",a),function(a){a.target="_blank"});else{if(d.Severity!=="Warning"&&d.Severity!=="Error"&&!c)this._timer&&window.clearTimeout(this._timer),
this._timer=window.setTimeout(function(){this.setProgressMessage("");this._timer=null}.bind(this),5E3);a=document.createTextNode(a)}q.appendChild(a)}if(m&&this.progressDomId!==this.domId){p.classList.add(m);for(m=0;m<s.length;m++)p.classList.remove(s[m])}p.classList.add("notificationShow");if((s=l.node("closeNotifications"))&&this._cancelMsg)s.classList.add("cancelButton"),s.classList.remove("dismissButton"),s.classList.remove("core-sprite-close"),s.classList.remove("imageSprite"),s.innerHTML=this._cancelMsg},
showWhile:function(b,c){var d=this;if(c){d.setProgressMessage(c);var e=function(){c===d.currentMessage&&d.setProgressMessage("")};b.then(e,e)}return b},_lastProgressId:0,_progressMonitors:{length:0},createProgressMonitor:function(b,c){return new d(this,++this._lastProgressId,b,c)},_renderOngoingMonitors:function(){if(this._progressMonitors.length>0){var b="",c=!0,d;for(d in this._progressMonitors)this._progressMonitors[d].status&&(c||(b+=", "),b+=this._progressMonitors[d].status,c=!1);this.setProgressMessage(b)}else this.setProgressMessage("")},
_beginProgressMonitor:function(b){this._progressMonitors[b.progressId]=b;this._progressMonitors.length++;this._renderOngoingMonitors()},_workedProgressMonitor:function(b){this._progressMonitors[b.progressId]=b;this._renderOngoingMonitors()},_doneProgressMonitor:function(b){delete this._progressMonitors[b.progressId];this._progressMonitors.length--;b.status?this.setProgressResult(b.status):this._renderOngoingMonitors()}};c.prototype.constructor=c;d=function(b,c,d,e){this.statusService=b;this.progressId=
c;if(d){this.deferred=d;this.begin(e);var a=this;d.then(function(){a.done.bind(a)()},function(){a.done.bind(a)()})}};d.prototype.begin=function(b){this.status=b;this.statusService._beginProgressMonitor(this)};d.prototype.done=function(b){this.status=b;this.statusService._doneProgressMonitor(this)};d.prototype.worked=function(b){this.status=b;this.statusService._workedProgressMonitor(this)};d.prototype.constructor=d;return{StatusReportingService:c,ProgressMonitor:d}});
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(g,l){var i={root:l};Object.keys(g).forEach(function(f){typeof i[f]==="undefined"&&(i[f]=g[f])});return i});
define("orion/operationsCommands",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/commands"],function(g,l,i,f){var c={};(function(){var d=!1;c.updateNavTools=function(b,c,f,e,a,j){var l=i.node(e);if(l)c.destroy(l);else throw g["could not find toolbar "]+e;c.renderCommands(e,l,j,f,"button");if(a&&(e=i.node(a)))c.destroy(e),c.renderCommands(a,e,null,f,"button");d||(d=!0,b.getService("orion.page.selection").addEventListener("selectionChanged",function(b){var d=i.node(a);
d&&(c.destroy(d),c.renderCommands(a,d,b.selections,f,"button"))}))};c.createOperationsCommands=function(b,c,d){function e(a){return!a.operation||!a.operation.type?!1:a.operation.type==="loadstart"||a.operation.type==="progress"}var a=new f.Command({name:g["Remove Completed"],tooltip:g["Remove all completed operations"],id:"eclipse.removeCompletedOperations",callback:function(){d.removeCompletedOperations().then(function(){c.loadOperations.bind(c)()})},visibleWhen:function(){return!0}});b.addCommand(a);
a=new f.Command({name:g.Remove,tooltip:g["Remove operations from the operations list."],imageClass:"core-sprite-delete",id:"eclipse.removeOperation",callback:function(a){for(var a=Array.isArray(a.items)?a.items:[a.items],b=0;b<a.length;b++){var e=a[b];d.removeOperation.bind(d)(e.Location).then(function(){c.loadOperations.bind(c)()},function(){c.loadOperations.bind(c)()})}},visibleWhen:function(a){if(!Array.isArray(a)||a.length===0)return!e(a);for(var b in a)if(e(a[b]))return!1;return!0}});b.addCommand(a);
a=new f.Command({name:g.Cancel,tooltip:g["Cancel operations from the operations list."],imageClass:"core-sprite-stop",id:"eclipse.cancelOperation",callback:function(a){for(var a=Array.isArray(a.items)?a.items:[a.items],b=0;b<a.length;b++){var c=a[b];c.deferred&&c.deferred.cancel()}},visibleWhen:function(a){if(!Array.isArray(a)||a.length===0)return e(a)&&(a.operation&&a.operation.cancelable?!0:!1);for(var b in a)if(!e(a[b])||!a[b].operation||!a[b].operation.cancelable)return!1;return!0}});b.addCommand(a)}})();
return c});
define("orion/webui/dialogs/OperationsDialog",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/webui/popupdialog","orion/operationsCommands"],function(g,l,i,f,c){function d(b){this._options=b}d.prototype=new f.PopupDialog;d.prototype.TEMPLATE='<table style="width: 360px;"><tr><td><h2>Recent operations</h2></td><td style="text-align: right;"><a id="allOperationsLink" class="navlinkonpage">All Operations</a></td></tr></table><div id="operationsExist"><div style="padding-left: 7px" id="myOperationsListEmpty">No operations running on this page.</div><table id="myOperationsList" style="display: none;"></table></div><div style="padding-left: 7px" id="operationsDontExist">No operations running.</div>';d.prototype._init=
function(b){this._myOperations=[];this._operationsDeferreds=[];this._commandService=b.commandRegistry;c.createOperationsCommands(this._commandService);this._commandService.registerCommandContribution("operationsDialogItems","eclipse.cancelOperation",1);this._initialize(b.triggerNode)};d.prototype._bindToDom=function(){this.$allOperationsLink.href=l.toUrl("operations/list.html");this._setOperationsVisibility()};d.prototype.setOperations=function(b,c){this._myOperations||this._init(this._options);this._myOperations=
[];this._operationsDeferreds=[];if(b)for(var d in b)this._myOperations.push(b[d]),this._operationsDeferreds.push(c[d]);this._renderOperations()};d.prototype.parseProgressResult=function(b){if(!b)return{};b=b.responseText||b;try{b=JSON.parse(b)}catch(c){}var d={Message:b.Message||b,Severity:b.Severity};if(b.DetailedMessage&&b.DetailedMessage!==d.Message)d.DetailedMessage=b.DetailedMessage;return d};d.prototype._renderOperations=function(){this._renderOperationsTable(this.$myOperationsList,this._myOperations,
this._operationsDeferreds)};d.prototype._renderOperationsTable=function(b,c,d){i.empty(b);for(var e=0;e<c.length;e++){var a=c[e],f=document.createElement("tr"),l=document.createElement("td");l.style.paddingLeft="5px";l.style.paddingRight="5px";l.textContent=a.Name;f.appendChild(l);var m=document.createElement("div");l.appendChild(m);l=document.createElement("span");l.style.paddingRight="5px";l.classList.add("imageSprite");switch(a.type){case "Warning":l.classList.add("core-sprite-warning");l.setAttribute("aria-label",
g["Operation resulted in a warning."]);break;case "error":l.classList.add("core-sprite-error");l.setAttribute("aria-label",g["Operation resulted in an error."]);break;case "loadstart":case "progress":l.classList.add("core-sprite-start");l.setAttribute("aria-label",g["Operation is running."]);break;case "abort":l.classList.add("core-sprite-stop");l.setAttribute("aria-label",g["Operation is canceled."]);break;case "load":case "loadend":l.classList.add("core-sprite-ok"),l.setAttribute("aria-label","Operation ok.")}m.appendChild(l);
l=document.createElement("span");l.classList.add("operationStatus");l.textContent=a.Name;m.appendChild(l);if(a.error){var n=a.error.Message||a.error;a.error.DetailedMessage&&a.error.DetailedMessage!==""&&(n+=": "+a.error.DetailedMessage);l.textContent=n;l.classList.remove("operationStatus");l.classList.add("operationError")}this._commandService.renderCommands("operationsDialogItems",m,{operation:a,deferred:d[e]},this,"tool");b.appendChild(f)}this._setOperationsVisibility()};d.prototype._setOperationsVisibility=
function(){this.$myOperationsList.style.display=this._myOperations.length>0?"":"none";this.$myOperationsListEmpty.style.display=this._myOperations.length>0?"none":"";this.$operationsDontExist.style.display=this._myOperations.length>0?"none":"";this.$operationsExist.style.display=this._myOperations.length>0?"":"none"};d.prototype.constructor=d;return{OperationsDialog:d}});
define("orion/progress",["i18n!orion/nls/messages","require","orion/Deferred","orion/webui/littlelib","orion/webui/dialogs/OperationsDialog"],function(g,l,i,f,c){function d(b,d){if(!this._progressPane){this._progressPane=f.node(b);this._operationsDialog=new c.OperationsDialog({triggerNode:this._progressPane,commandRegistry:d});var e=this;this._progressPane.addEventListener("keydown",function(a){(a.charOrCode===" "||a.keyCode===f.KEY.ENTER)&&e._operationsDialog.show()})}}function b(b,c,d,a){this._serviceRegistry=
b;this._serviceRegistration=b.registerService("orion.page.progress",this);this._commandRegistry=d;this._operationsClient=c;this._operations={};this._operationDeferrds={};this._operationsIndex=0;this._lastIconClass=this._lastOperation=null;this._progressMonitorClass=a}d.prototype={_switchIconTo:function(b){this._lastIconClass&&this._progressPane.classList.remove(this._lastIconClass);this._lastIconClass=b;this._progressPane.classList.add(this._lastIconClass)},generateOperationsInfo:function(b,c){var d=
{},a;for(a in b)b[a].progressMonitor||(d[a]=b[a]);if(this._isEmpty(d))this._switchIconTo("progressPane_empty"),this._progressPane.title=g.Operations,this._progressPane.alt=g.Operations,this._progressPane.hasAttribute("aria-valuetext")&&this._progressPane.removeAttribute("aria-valuetext");else{var f="";for(a in d){var i=d[a];if(i.type&&(i.type==="loadstart"||i.type==="progress")){f="running";break}}switch(f){case "running":this._progressPane.title=g["Operations running"];this._progressPane.alt=g["Operations running"];
this._progressPane.setAttribute("aria-valuetext",g["Operations running"]);this._switchIconTo("progressPane_running");break;case "warning":this._progressPane.title=g["Some operations finished with warning"];this._progressPane.alt=g["Some operations finished with warning"];this._progressPane.setAttribute("aria-valuetext",g["Some operations finished with warning"]);this._switchIconTo("progressPane_warning");break;case "error":this._progressPane.title=g["Some operations finished with error"];this._progressPane.alt=
g["Some operations finished with error"];this._progressPane.setAttribute("aria-valuetext",g["Some operations finished with error"]);this._switchIconTo("progressPane_error");break;default:this._progressPane.title=g.Operations,this._progressPane.alt=g.Operations,this._progressPane.hasAttribute("aria-valuetext")&&this._progressPane.removeAttribute("aria-valuetext"),this._switchIconTo("progressPane_operations")}}this._operationsDialog.setOperations(d,c)},_isEmpty:function(b){for(var c in b)return!1;return!0}};
d.prototype.constructon=d;b.prototype={init:function(b){if(!this._progressMonitorClass)this._progressMonitorTool=new d(b,this._commandRegistry)},progress:function(b,c,d){var a=this,f=this._operationsIndex++;!d&&this._progressMonitorClass&&(d=new this._progressMonitorClass,d.begin(c));b.then(function(){if(a._operations[f]){var g=a._operations[f];if(c)g.Name=c;a._lastOperation=g;g.type="loadend";if(d)g.progressMonitor=d;a.writeOperation.bind(a)(f,g,b);g.Location||a._removeOperationFromTheList.bind(a)(f)}},
function(g){if(a._operations[f]){var i=a._operations[f];if(c)i.Name=c;if(d)i.progressMonitor=d;a._lastOperation=i;i.type=g.canceled?"abort":"error";i.error=g;a.writeOperation.bind(a)(f,i,b);i.Location||a._removeOperationFromTheList.bind(a)(f)}},function(g){if(c)g.Name=c;if(d)g.progressMonitor=d;a.writeOperation.bind(a)(f,g,b)});return b},removeOperation:function(b){for(var c in this._operations)if(this._operations[c].Location&&this._operations[c].Location===b){this._removeOperationFromTheList(c);
break}this._operationsClient.removeOperation.bind(this._operationsClient)(b)},_removeOperationFromTheList:function(b){var c=this._operations[b].progressMonitor;delete this._operations[b];delete this._operationDeferrds[b];c?c.done():this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},removeCompletedOperations:function(){for(var b in this._operations){var c=this._operations[b];if(c.type&&c.type!=="loadstart"&&c.type!=="progress")(c=this._operations[b].progressMonitor)&&
c.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,c){c&&this._serviceRegistry.getService("orion.page.message").setProgressMessage(c);var d=this;b.then(function(){d._serviceRegistry.getService("orion.page.message").setProgressMessage("")},function(a){d.setProgressResult.bind(d)(a);
return a});return this.progress(b,c)},writeOperation:function(b,c,d){this._operations[b]=c;this._operationDeferrds[b]=d;c.Location&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/operations").then(function(a){a.put(c.Location,{Name:c.Name,expires:c.expires})});c.progressMonitor?c.progressMonitor.progress(c.Name):this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)}};b.prototype.constructor=b;return{ProgressService:b}});
define("orion/operationsClient",["i18n!orion/operations/nls/messages","orion/Deferred"],function(g,l){function i(b,c,d){return b[c].apply(b,d)}function f(b){this._location=b}function c(){var b=new l;b.reject(g["No Matching OperationService for location:"]+this._location);return b}function d(b){this._services=[];this._patterns=[];this._operationListeners=[];this._currentLongpollingIds=[];this._preferenceService=b.getService("orion.core.preference");for(var c=b.getServiceReferences("orion.core.operation"),
d=0;d<c.length;d++){var e=b.getService(c[d]);this._services[d]=e;e=c[d].getProperty("pattern")||".*";e[0]!=="^"&&(e="^"+e);this._patterns[d]=RegExp(e)}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 f(a)}}f.prototype={getOperation:c,getOperations:c,removeCompletedOperations:c,removeOperation:c,cancelOperation:c};f.prototype.constructor=f;d.prototype={getOperations:function(){var b=
new l;if(this._operations)return b.resolve(this._operations),b;var c=this;this._preferenceService.getPreferences("/operations").then(function(d){c._operations=d;b.resolve(c._operations)});return b},getOperation:function(b){return i(this._getService(b),"getOperation",arguments)},removeCompletedOperations:function(){for(var b=[],c=this,d=0;d<this._services.length;d++){var e=this._patterns[d],a=new l;b[d]=a.promise;i(this._services[d],"removeCompletedOperations").then(function(a){return function(b){Array.isArray(b)&&
c.getOperations.bind(c)().then(function(c){for(var d=c.keys(),f=0;f<d.length;f++){var g=d[f];e.test(g)&&b.indexOf(g)<0&&c.remove(g)}a.resolve()})}}(a),function(a){return function(b){a.reject(b)}}(a))}return l.all(b)},removeOperation:function(b){var c=this;return i(this._getService(b),"removeOperation",arguments).then(function(){c.getOperations.bind(c)().then(function(c){c.remove(b)})},function(b){return b},function(b){return b})}};d.prototype.constructor=d;return{OperationsClient:d}});
define("orion/dialogs",[],function(){function g(g){this._serviceRegistry=g;this._serviceRegistration=g.registerService("orion.page.dialog",this)}g.prototype={confirm:function(g,i){i(window.confirm(g))},openFiles:function(){}};g.prototype.constructor=g;return{DialogService:g}});
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(g,l,i,f,c,d,b,h,k){function e(a,b){this.serviceRegistry=a;this.commandRegistry=b;this.openWithCommands=null}function a(a){this.registry=a.serviceRegistry;this._commandService=a.commandService;this._fileService=a.fileService;this.defaultRenderer=new e(this.registry,
this._commandService);this._fileService||console.error("No file service on search client")}e.prototype.makeRenderFunction=function(a,d,e,n,s){var q=this.serviceRegistry,t=this.commandRegistry;this.openWithCommands=this.openWithCommands||h.createOpenWithCommands(q,a,t);var v=this;return function(h,q,o,r){k.when(v.openWithCommands,function(k){if(o)i.empty(d),k=document.createElement("div"),k.appendChild(document.createTextNode(g["Search failed."])),d.appendChild(k),typeof n==="function"&&n(d);else{var v=
function(){function a(b,c){var d=c.folderName?c.folderName:c.path,e=document.createElement("span");e.id=d.replace(/[^a-zA-Z0-9_\.:\-]/g,"");e.appendChild(document.createTextNode(" - "+d+" "));b.appendChild(e)}var b={};return function(c,d){var e=d.name;if(b.hasOwnProperty(e)){a(c,d);var f=b[e];typeof f==="function"&&(b[e]=null,f())}else b[e]=function(){a(c,d)}}}(),y=!1;i.empty(d);if(h&&h.length>0){var J=document.createElement("table");J.setAttribute("role","presentation");for(var A=0;A<h.length;A++){var L=
h[A],B;if(!y&&(y=!0,e))B=J.insertRow(0).insertCell(0),B.textContent=e;B=J.insertRow(-1).insertCell(0);B.colspan=2;s&&s(B);var C={Name:L.name,Directory:L.directory,Location:L.path||L.location},E=null;if(typeof L.LineNumber==="number")E={},E.line=L.LineNumber;if(r&&r.keyword&&!r.nameSearch){var K=c.generateSearchHelper(r),E=E||{};E.find=K.inFileQuery.searchStr;E.regEx=K.inFileQuery.wildCard?!0:void 0}C=b.createLink(l.toUrl("edit/edit.html"),C,t,a,k,null,{"aria-describedby":(L.folderName?L.folderName:
L.path).replace(/[^a-zA-Z0-9_\.:\-]/g,""),style:{verticalAlign:"middle"}},E);L.LineNumber&&C.appendChild(document.createTextNode(" (Line "+L.LineNumber+")"));B.appendChild(C);v(B,L)}d.appendChild(J);typeof n==="function"&&n(d)}!y&&q&&(k=f.formatMessage(g["No matches found for ${0}"],q),i.empty(d),d.appendChild(document.createTextNode(k)),typeof n==="function"&&n(d))}})}};a.prototype={search:function(a,b,e){var f=function(a){for(var b=[],d=0;d<a.response.docs.length;d++){var e=a.response.docs[d];b.push({name:e.Name,
path:e.Location,folderName:c.path2FolderName(e.Path?e.Path:e.Location,e.Name),directory:e.Directory,lineNumber:e.LineNumber})}return b};if(this._crawler&&a.nameSearch)this._crawler.searchName(a,function(b){e(f(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 c=a.keyword,c=c.substring(c.indexOf("}")+1),c=c.substring(c.indexOf(":")+1);e(f(b),c,null,a)},function(a){e(null,null,a,null)})}catch(g){typeof g===
"string"&&g.indexOf("search")>-1&&this._crawler?this._crawler.searchName(a,function(b){e(f(b),null,null,a)}):typeof g==="string"&&g.indexOf("search")>-1&&!a.nameSearch?(new d.SearchCrawler(this.registry,this._fileService,a,{childrenLocation:this.getChildrenLocation()})).search(function(b){e(f(b),null,null,a)}):this.registry.getService("orion.page.message").setErrorMessage(g)}},getFileService:function(){return this._fileService},setCrawler:function(a){this._crawler=a},handleError:function(a,b){console.error(a);
i.empty(b);b.appendChild(document.createTextNode(a));return a},setLocationByMetaData:function(a,b){var c="",d=null;this._searchRootLocation=this._fileService.fileServiceRootURL(a.Location);b&&a&&a.Parents&&a.Parents.length>0?d=b.index==="last"?a.Parents[a.Parents.length-1]:a.Parents[0]:a&&a.Directory&&a.Location&&a.Parents&&(d=a);if(d)this.setLocationbyURL(d.Location),c=d.Name,this._childrenLocation=d.ChildrenLocation;else if(a)this.setLocationbyURL(this._searchRootLocation),c=this._fileService.fileServiceName(a.Location),
this._childrenLocation=a.ChildrenLocation;d=i.node("search");c||(c="");if(d&&d.placeholder){d.value="";var e=f.formatMessage(g["Search ${0}"],c);d.placeholder=e.length>30?e.substring(0,27)+"...":f.formatMessage(g["Search ${0}"],c)}if(d&&d.title)d.title=g["Type a keyword or wild card to search in "]+c},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,c,d){c=c?this.getSearchRootLocation():this.getSearchLocation();return b?{resource:c,sort:"NameLower asc",rows:100,start:0,nameSearch:!0,keyword:a}:{resource:c,
sort:d&&d.sort?d.sort:"Path asc",rows:d&&d.rows?d.rows:40,start:0,caseSensitive:d?d.caseSensitive:void 0,regEx:d?d.regEx:void 0,fileType:d?d.fileType:void 0,keyword:a,replace:d?d.replace:void 0}}};a.prototype.constructor=a;return{Searcher:a}});
define("orion/problems",["orion/EventTarget"],function(g){function l(i){this._serviceRegistry=i;g.attach(this);this._serviceRegistration=i.registerService("orion.core.marker",this)}l.prototype={_setProblems:function(g){this.problems=g;this.dispatchEvent({type:"problemsChanged",problems:g})}};l.prototype.constructor=l;return{ProblemService:l}});
define("orion/blameAnnotations",["orion/EventTarget"],function(g){function l(i){this._serviceRegistry=i;g.attach(this);this._serviceRegistration=i.registerService("orion.core.blame",this)}l.prototype={_setAnnotations:function(g){this.blameInfo=g;this.dispatchEvent({type:"blameChanged",blameInfo:g})}};l.prototype.constructor=l;return{BlameService:l}});
define("edit/setup","i18n!orion/edit/nls/messages,orion/sidebar,orion/inputManager,orion/globalCommands,orion/folderView,orion/editorView,orion/commandRegistry,orion/contentTypes,orion/fileClient,orion/selection,orion/status,orion/progress,orion/operationsClient,orion/outliner,orion/dialogs,orion/extensionCommands,orion/searchClient,orion/problems,orion/blameAnnotations,orion/EventTarget,orion/URITemplate,orion/i18nUtil,orion/PageUtil,orion/webui/littlelib,orion/projectClient".split(","),function(g,
l,i,f,c,d,b,h,k,e,a,j,p,m,n,s,q,t,v,x,u,o,r,w,z){return{setUpEditor:function(y,J,A){function L(a){var b,c=w.node("pageActions");c&&(a?b=s.createAndPlaceFileCommandsExtension(y,E,c.id,500).then(function(){E.destroy(c);E.renderCommands(c.id,c,a,M,"button")}):E.destroy(c));var d=w.node("pageNavigationActions");d&&(E.destroy(d),a&&E.renderCommands(d.id,d,a,M,"button"));if(d=w.node("settingsActions"))E.destroy(d),a&&E.renderCommands(d.id,d,a,M,"button");return b}function B(){x.attach(this)}var C,E,K,O,
U,N,D,G;(function(){C=new e.Selection(y);var c=new p.OperationsClient(y);K=new a.StatusReportingService(y,c,"statusPane","notifications","notificationArea");new n.DialogService(y);E=new b.CommandRegistry({selection:C});N=new j.ProgressService(y,c,E);new t.ProblemService(y);O=new m.OutlineService({serviceRegistry:y,preferences:J});U=new h.ContentTypeRegistry(y);D=new k.FileClient(y);new z.ProjectClient(y,D);G=new q.Searcher({serviceRegistry:y,commandService:E,fileService:D});new v.BlameService(y)})();
var R=w.node("sidebar"),H=w.node("sidebarToolbar"),Q=w.node("editor"),M,F,I,P,V=new u("#{,resource,params*}"),S=function(a,b,c){b=c?c.Location:D.fileServiceRootURL(b);a.href=V.expand({resource:b})};F=new i.InputManager({serviceRegistry:y,fileClient:D,progressService:N,selection:C,contentTypeRegistry:U});M=(new d.EditorView({parent:Q,renderToolbars:L,fileService:D,progressService:N,serviceRegistry:y,statusService:K,inputManager:F,preferences:J,readonly:A,searcher:G,commandRegistry:E,contentTypeRegistry:U})).editor;
F.editor=M;F.addEventListener("InputChanged",function(a){function b(){E.processURL(window.location.href)}I&&(E.closeParameterCollector(),I.destroy(),I=null);var d=a.metadata,e=L(d),h=a.name,i=d;if(a.input===null||a.input===void 0)h=P?P.Name:"",i=P;f.setPageTarget({task:"Editor",name:h,target:i,makeAlternate:function(){if(d&&d.Parents&&d.Parents.length>0)return N.progress(D.read(d.Parents[0].Location,!0),o.formatMessage(g.ReadingMetadata,d.Parents[0].Location))},makeBreadcrumbLink:S,serviceRegistry:y,
commandService:E,searchService:G,fileService:D});e?e.then(b):b();d&&d.Directory&&(E.closeParameterCollector(),I=new c.FolderView({parent:Q,input:a.input,metadata:d,serviceRegistry:y,commandService:E,contentTypeRegistry:U,selection:C,fileService:D,progress:N}),I.create())});var T=new B,W=new l({commandRegistry:E,contentTypeRegistry:U,editorInputManager:F,fileClient:D,outlineService:O,parent:R,progressService:N,selection:C,serviceRegistry:y,sidebarNavInputManager:T,toolbar:H});B.prototype.processHash=
function(){var a=r.matchResourceParameters().navigate;typeof a==="string"&&this.setInput&&W.getActiveViewModeId()==="nav"&&this.setInput(a)};W.show();T.addEventListener("rootChanged",function(a){P=a.root});A=function(a){window.location=V.expand({resource:a.newInput||""})};T.addEventListener("filesystemChanged",A);T.addEventListener("editorInputMoved",A);M.addEventListener("DirtyChanged",function(){f.setDirtyIndicator(M.isDirty())});C.addEventListener("selectionChanged",function(a){F.setInput(a.selection)});
window.addEventListener("hashchange",function(){F.setInput(r.hash());T.processHash(r.hash())});F.setInput(r.hash());T.processHash(r.hash());f.generateBanner("orion-editor",y,E,J,G,M,M,!1);window.onbeforeunload=function(){if(M.isDirty())return g.unsavedChanges}}}});define('built-edit.js',["orion/browserCompatibility","orion/bootstrap","edit/setup"],function(g,l,i){l.startup().then(function(f){i.setUpEditor(f.serviceRegistry,f.preferences,!1)})});