/*******************************************************************************
 * @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) 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 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0
 * (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 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, 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) 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) 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, 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

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

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

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

/*******************************************************************************
 * @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, 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) 2011, 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @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, 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, 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) 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @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, 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: 
 *		Felipe Heidrich (IBM Corporation) - initial API and implementation
 *		Silenio Quarti (IBM Corporation) - initial API and implementation
 *		Mihai Sucan (Mozilla Foundation) - fix for Bug#334583 Bug#348471 Bug#349485 Bug#350595 Bug#360726 Bug#361180 Bug#362835 Bug#362428 Bug#362286 Bug#354270 Bug#361474 Bug#363945 Bug#366312 Bug#370584
 ******************************************************************************/

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

/*******************************************************************************
 * @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, 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @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) 2013, 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation 
 ******************************************************************************/

/*******************************************************************************
 * @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) 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation 
 ******************************************************************************/

/*******************************************************************************
 * @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) 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) 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) 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
 * Licensed Materials - Property of IBM
 * (c) Copyright IBM Corporation 2011. All Rights Reserved. 
 * 
 * Note to U.S. Government Users Restricted Rights:  Use, 
 * duplication or disclosure restricted by GSA ADP Schedule 
 * Contract with IBM Corp.
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Licensed Materials - Property of IBM
 * (c) Copyright IBM Corporation 2014. All Rights Reserved. 
 * 
 * Note to U.S. Government Users Restricted Rights:  Use, 
 * duplication or disclosure restricted by GSA ADP Schedule 
 * Contract with IBM Corp.
 *******************************************************************************/

/*

 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

 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 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (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). 

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

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

 Contributors:
 IBM Corporation - initial API and implementation

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

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

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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


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


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


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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors:  IBM Corporation - initial API and implementation

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


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


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

 Contributors:
 IBM Corporation - initial API and implementation

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

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

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

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

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

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

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


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


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

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

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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


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


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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

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

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

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

 Contributors: IBM Corporation - initial API and implementation

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


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


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

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

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - _initial API and implementation

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


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


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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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


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


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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

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

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

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

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

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

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

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

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

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

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

 Contributors: IBM Corporation - initial API and implementation

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

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

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

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

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation 

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

 Contributors: IBM Corporation - initial API and implementation 

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

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

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

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

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

 Contributors: IBM Corporation - initial API and implementation 

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

 Contributors: IBM Corporation - initial API and implementation 

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

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 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) 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

 Licensed Materials - Property of IBM
 (c) Copyright IBM Corporation 2011. All Rights Reserved. 

 Note to U.S. Government Users Restricted Rights:  Use, 
 duplication or disclosure restricted by GSA ADP Schedule 
 Contract with IBM Corp.

 Licensed Materials - Property of IBM
 (c) Copyright IBM Corporation 2014. All Rights Reserved. 

 Note to U.S. Government Users Restricted Rights:  Use, 
 duplication or disclosure restricted by GSA ADP Schedule 
 Contract with IBM Corp.

 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

 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
*/
define("orion/util",[],function(){var i=navigator.userAgent,k=i.indexOf("MSIE")!==-1||i.indexOf("Trident")!==-1?document.documentMode:void 0,j=parseFloat(i.split("Firefox/")[1]||i.split("Minefield/")[1])||void 0,h=i.indexOf("Opera")!==-1?parseFloat(i.split("Version/")[1]):void 0,a=parseFloat(i.split("Chrome/")[1])||void 0,g=i.indexOf("Safari")!==-1&&!a,e=parseFloat(i.split("WebKit/")[1])||void 0,f=i.indexOf("Android")!==-1,d=i.indexOf("iPad")!==-1,i=i.indexOf("iPhone")!==-1,c=d||i,b=navigator.platform.indexOf("Mac")!==
-1,l=navigator.platform.indexOf("Win")!==-1,m=navigator.platform.indexOf("Linux")!==-1,s="ontouchstart"in document.createElement("input");return{formatMessage:function(b){var c=arguments;return b.replace(/\$\{([^\}]+)\}/g,function(b,d){return c[(d<<0)+1]})},createElement:function(b,c){return b.createElementNS?b.createElementNS("http://www.w3.org/1999/xhtml",c):b.createElement(c)},isIE:k,isFirefox:j,isOpera:h,isChrome:a,isSafari:g,isWebkit:e,isAndroid:f,isIPad:d,isIPhone:i,isIOS:c,isMac:b,isWindows:l,
isLinux:m,isTouch:s,platformDelimiter:l?"\r\n":"\n"}});
define("orion/webui/littlelib",["orion/util"],function(i){function k(d,c){c||(c=document);return c.querySelectorAll(d)}function j(d){var c=d.tabIndex;c===0&&i.isIE&&!{a:!0,body:!0,button:!0,frame:!0,iframe:!0,img:!0,input:!0,isindex:!0,object:!0,select:!0,textarea:!0}[d.nodeName.toLowerCase()]&&!d.attributes.tabIndex&&(c=-1);return c}function h(d){if(j(d)>=0)return d;if(d.hasChildNodes())for(var c=0;c<d.childNodes.length;c++){var b=h(d.childNodes[c]);if(b)return b}return null}function a(d){if(j(d)>=
0)return d;if(d.hasChildNodes())for(var c=d.childNodes.length-1;c>=0;c--){var b=a(d.childNodes[c]);if(b)return b}return null}function g(d,c){if(d.nodeType===3){var b=e.exec(d.nodeValue);b&&b.length>1&&c(d,b)}if(d.hasChildNodes())for(b=0;b<d.childNodes.length;b++)g(d.childNodes[b],c)}var e=/\$\{([^\}]+)\}/,f=null;return{$:function(d,c){c||(c=document);return c.querySelector(d)},$$:k,$$array:function(d,c){return Array.prototype.slice.call(k(d,c))},node:function(d){var c=d;typeof d==="string"&&(c=document.getElementById(d));
return c},contains:function(d,c){if(!d||!c)return!1;if(d===c)return!0;var b=d.compareDocumentPosition(c);return Boolean(b&16)},bounds:function(d){d=d.getBoundingClientRect();return{left:d.left+document.documentElement.scrollLeft,top:d.top+document.documentElement.scrollTop,width:d.width,height:d.height}},empty:function(d){for(;d.hasChildNodes();)d.removeChild(d.firstChild)},firstTabbable:h,lastTabbable:a,stop:function(d){if(window.document.all)d.keyCode=0;d.preventDefault&&(d.preventDefault(),d.stopPropagation())},
processTextNodes:function(d,c){g(d,function(b,d){b.parentNode.replaceChild(document.createTextNode(c[d[1]]||d[1]),b)})},processDOMNodes:function(d,c){g(d,function(b,d){var f=c[d[1]];if(f){var a=document.createRange(),e=d.index;a.setStart(b,e);a.setEnd(b,e+d[0].length);a.deleteContents();a.insertNode(f)}})},addAutoDismiss:function(d,c){function b(b){f.forEach(function(c){var d=!1,f=c.excludeNodes.some(function(c){return document.body.contains(c)?(d=!0,c.contains(b.target)):!1});if(d&&!f)try{c.dismiss(b)}catch(a){typeof console!==
"undefined"&&console&&console.error(a&&a.message)}});f=f.filter(function(b){return b.excludeNodes.some(function(b){return document.body.contains(b)})})}f===null&&(f=[],document.addEventListener("click",b,!0),i.isIOS&&document.addEventListener("touchend",function(b){function c(){b.target.removeEventListener("click",c)}b.touches.length===0&&b.target.addEventListener("click",c)},!1));f.push({excludeNodes:d,dismiss:c})},setFramesEnabled:function(d){for(var c=document.getElementsByTagName("iframe"),b=
0;b<c.length;b++)c[b].parentNode.style.pointerEvents=d?"":"none"},removeAutoDismiss:function(d){f=f.filter(function(c){return d!==c.dismiss})},KEY:{BKSPC:8,TAB:9,ENTER:13,ESCAPE:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DEL:46}}});
(function(i,k){typeof define==="function"&&define.amd?define("orion/Deferred",k):typeof exports==="object"?module.exports=k():(i.orion=i.orion||{},i.orion.Deferred=k())})(this,function(){function i(){for(var e;e=a.shift();)e();g=!1}function k(e){a.push(e);g||(g=!0,setTimeout(i,0))}function j(a){return function(){a.apply(void 0,arguments)}}function h(){function e(){for(var c;c=m.shift();){var d=c.deferred,f=l==="fulfilled"?"resolve":"reject";if(typeof c[f]==="function")try{var e=(0,c[f])(b),g=e&&(typeof e===
"object"||typeof e==="function")&&e.then;if(typeof g==="function")if(e===d.promise)d.reject(new TypeError);else{var h=e.cancel;typeof h==="function"?d._protected(a).parentCancel=h.bind(e):delete d._protected(a).parentCancel;g.call(e,j(d.resolve),j(d.reject),j(d.progress))}else d.resolve(e)}catch(n){d.reject(n)}else d[f](b)}}function f(c){delete o.parentCancel;l="rejected";b=c;m.length&&k(e)}function d(c){function a(b){return function(n){j||(j=!0,b(n))}}var j=!1;delete o.parentCancel;try{var i=c&&
(typeof c==="object"||typeof c==="function")&&c.then;if(typeof i==="function")if(c===g)f(new TypeError);else{l="assumed";var u=c&&c.cancel;if(typeof u!=="function"){var v=new h,c=v.promise;try{i(v.resolve,v.reject,v.progress)}catch(n){v.reject(n)}u=c.cancel;i=c.then}b=c;i.call(c,a(d),a(f));o.parentCancel=u.bind(c)}else l="fulfilled",b=c,m.length&&k(e)}catch(w){a(f)(w)}}function c(){var b=o.parentCancel;if(b)delete o.parentCancel,b();else if(!l)b=Error("Cancel"),b.name="Cancel",f(b)}var b,l,m=[],g=
this,o={};Object.defineProperty(this,"_protected",{value:function(b){if(b!==a)throw Error("protected");return o}});this.resolve=function(b){l||d(b);return g};this.reject=function(b){l||f(b);return g};this.progress=function(b){l||m.forEach(function(c){if(c.progress)try{c.progress(b)}catch(d){}});return g.promise};this.cancel=function(){o.parentCancel?setTimeout(c,0):c();return g};this.then=function(b,c,d){b={resolve:b,reject:c,progress:d,deferred:new h};m.push(b);b.deferred._protected(a).parentCancel=
g.promise.cancel.bind(g);(l==="fulfilled"||l==="rejected")&&k(e);return b.deferred.promise};this.promise={then:g.then,cancel:g.cancel}}var a=[],g=!1;h.all=function(a,f){function d(c,d){m||(l[c]=d,--b===0&&g.resolve(l))}function c(b,c){if(!m){if(f)try{d(b,f(c));return}catch(a){c=a}g.reject(c)}}var b=a.length,l=[],m=!1,g=new h;g.then(void 0,function(){m=!0;a.forEach(function(b){b.cancel&&b.cancel()})});b===0?g.resolve(l):a.forEach(function(b,f){b.then(d.bind(void 0,f),c.bind(void 0,f))});return g.promise};
h.when=function(a,f,d,c){var b;if(!(a&&typeof a.then==="function"))b=new h,b.resolve(a),a=b.promise;return a.then(f,d,c)};return h});
define("orion/EventTarget",[],function(){function i(){this._namedListeners={}}i.prototype={dispatchEvent:function(i){if(!i.type)throw Error("unspecified type");var j=this._namedListeners[i.type];j&&j.forEach(function(h){try{typeof h==="function"?h(i):h.handleEvent(i)}catch(a){typeof console!=="undefined"&&console.log(a)}});return!i.defaultPrevented},addEventListener:function(i,j){if(typeof j==="function"||j.handleEvent)this._namedListeners[i]=this._namedListeners[i]||[],this._namedListeners[i].push(j)},
removeEventListener:function(i,j){var h=this._namedListeners[i];if(h)for(var a=0;a<h.length;a++)if(h[a]===j){h.length===1?delete this._namedListeners[i]:h.splice(a,1);break}}};i.prototype.constructor=i;i.attach=function(k){var j=new i;k.dispatchEvent=j.dispatchEvent.bind(j);k.addEventListener=j.addEventListener.bind(j);k.removeEventListener=j.removeEventListener.bind(j)};return i});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(i,k){function j(f,d,c){this._properties=c||{};this._properties["service.id"]=f;this._properties.objectClass=d;this._properties["service.names"]=d}function h(f,d,c){this._serviceId=f;this._serviceReference=d;this._internalRegistry=c}function a(f,d){function c(b){return function(){var c;try{if(!d())throw Error("Service was unregistered");var a=f[b].apply(f,Array.prototype.slice.call(arguments));if(a&&typeof a.then==="function")return a;
else c=new i,c.resolve(a)}catch(e){c=new i,c.reject(e)}return c.promise}}for(var b in f)typeof f[b]==="function"&&(this[b]=c(b))}function g(a,d){this.type=a;this.serviceReference=d}function e(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new k;var a=this;this._internalRegistry={isRegistered:function(d){return a._entries[d]?!0:!1},unregisterService:function(d){var c=a._entries[d];if(!c)throw Error("Service has already been unregistered: "+d);var b=c.reference;a._serviceEventTarget.dispatchEvent(new g("unregistering",
b));a._entries[d]=null;b.getProperty("objectClass").forEach(function(c){for(var d=a._namedReferences[c],e=0;e<d.length;e++)if(d[e]===b){d.length===1?delete a._namedReferences[c]:d.splice(e,1);break}})},modifyService:function(d){var c=a._entries[d];if(!c)throw Error("Service not found while trying to send modified event: "+d);a._serviceEventTarget.dispatchEvent(new g("modified",c.reference))}}}j.prototype={getPropertyKeys:function(){var a=[],d;for(d in this._properties)this._properties.hasOwnProperty(d)&&
a.push(d);return a},getProperty:function(a){return this._properties[a]}};j.prototype.constructor=j;h.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(a){var d=this._serviceReference._properties;this._serviceReference._properties=a||{};a["service.id"]=this._serviceId;
a.objectClass=d.objectClass;a["service.names"]=d["service.names"];this._internalRegistry.modifyService(this._serviceId)}};h.prototype.constructor=h;e.prototype={getService:function(a){var d;if(typeof a==="string")(a=this._namedReferences[a])&&a.some(function(c){d=this._entries[c.getProperty("service.id")].service;return!!d},this);else if(a=this._entries[a.getProperty("service.id")])d=a.service;return d||null},getServiceReferences:function(a){if(a)return this._namedReferences[a]?this._namedReferences[a]:
[];var d=[];this._entries.forEach(function(c){c&&d.push(c.reference)});return d},registerService:function(f,d,c){if(typeof d==="undefined"||d===null)throw Error("invalid service");typeof f==="string"?f=[f]:Array.isArray(f)||(f=[]);var b=this._entries.length,e=new j(b,f,c),m=this._namedReferences;f.forEach(function(b){m[b]=m[b]||[];m[b].push(e)});f=new a(d,this._internalRegistry.isRegistered.bind(null,b));this._entries.push({reference:e,service:f});f=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new g("registered",
e));return new h(b,e,f)},addEventListener:function(a,d){this._serviceEventTarget.addEventListener(a,d)},removeEventListener:function(a,d){this._serviceEventTarget.removeEventListener(a,d)}};e.prototype.constructor=e;return{ServiceRegistry:e}});
define("orion/xhr",["orion/Deferred"],function(i){function k(j,h,a,g){var e=typeof a.response!=="undefined"?a.response:a.responseText,f;try{f=a.status}catch(d){f=0}j={args:h,response:e,responseText:typeof e==="string"?e:null,status:f,url:j,xhr:a};if(typeof g!=="undefined")j.error=g;return j}return function(j,h,a){var a=a||{},g=arguments.length>3&&arguments[3]?arguments[3]:new XMLHttpRequest,e=new i,f=a.headers||{},d=a.log||!1,c;typeof f["X-Requested-With"]==="undefined"&&(f["X-Requested-With"]="XMLHttpRequest");
if(typeof a.data!=="undefined"&&(j==="POST"||j==="PUT"))c=a.data;var b=!1,l=!1;e.promise.then(void 0,function(c){b=!0;!l&&c instanceof Error&&c.name==="Cancel"&&g.abort()});g.onabort=function(){l=!0;if(!b){var c=Error("Cancel");c.name="Cancel";e.reject(c)}};g.onload=function(){var b=k(h,a,g);200<=g.status&&g.status<400?e.resolve(b):(e.reject(b),d&&typeof console!=="undefined"&&console.log(Error(g.statusText)))};g.onerror=function(){var b=k(h,a,g);e.reject(b);d&&typeof console!=="undefined"&&console.log(Error(g.statusText))};
g.onprogress=function(b){b.xhr=g;e.progress(b)};try{g.open(j,h,!0);if(typeof a.responseType==="string")g.responseType=a.responseType;if(typeof a.timeout==="number")if(typeof g.timeout==="number")g.timeout=a.timeout,g.addEventListener("timeout",function(){e.reject(k(h,a,g,"Timeout exceeded"))});else{var m=setTimeout(function(){e.reject(k(h,a,g,"Timeout exceeded"))},a.timeout);e.promise.then(clearTimeout.bind(null,m),clearTimeout.bind(null,m))}Object.keys(f).forEach(function(b){g.setRequestHeader(b,
f[b])});g.send(c||null)}catch(s){e.reject(k(h,a,g,s))}return e.promise}});
define("orion/preferences",["require","orion/Deferred","orion/xhr"],function(i,k,j){function h(c,b){this._name=c;this._providers=b;this._flushPending=!1;this._cached=null;this._stores=[];this._pendingDeletes=[];this._dirty=[]}function a(c,b){return{get:function(d,a){if(b===0)return null;var e=localStorage.getItem(c+d);if(e===null)return null;e=JSON.parse(e);return a||b===-1||e._expires&&e._expires>(new Date).getTime()?(delete e._expires,e):null},set:function(d,a){if(b!==0){if(b!==-1)a._expires=(new Date).getTime()+
1E3*b;if(Object.keys(a).length===0)localStorage.removeItem(c+d);else{var e=JSON.stringify(a);localStorage.setItem(c+d,e);delete a._expires}}},remove:function(b){localStorage.removeItem(c+b)}}}function g(c){this._currentPromises={};this._cache=new a("/orion/preferences/user",3600);this._service=null;this.available=function(){if(!this._service){var b=c.getServiceReferences("orion.core.preference.provider");if(b.length>0)this._service=c.getService(b[0])}return!!this._service}}function e(c){this._location=
c;this._currentPromise=null;this._cache=new a("/orion/preferences/default",3600)}function f(){this._cache=new a("/orion/preferences/local",-1)}function d(c,b){this._userProvider=new g(c);this._localProvider=new f;b=b||"defaults.pref";b.indexOf("://")===-1&&(b=i.toUrl(b));this._defaultsProvider=new e(b);this._serviceRegistration=c.registerService("orion.core.preference",this)}h.prototype={_flush:function(){for(var c=[],b=0;b<this._stores.length;++b){var d=this._stores[b];this._dirty.indexOf(d)!==-1&&
c.push(this._providers[b].put(this._name,d));if(this._pendingDeletes[b]&&this._pendingDeletes[b].length>0){for(d=0;d<this._pendingDeletes[b].length;d++)c.push(this._providers[b].remove(this._name,this._pendingDeletes[b][d]));delete this._pendingDeletes[b]}}this._dirty=[];return k.all(c)},_scheduleFlush:function(c){c&&this._dirty.indexOf(c)===-1&&this._dirty.push(c);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 c=0;c<this._stores.length;++c){var b=this._stores[c],d;for(d in b)b.hasOwnProperty(d)&&typeof this._cached[d]==="undefined"&&(this._cached[d]=b[d])}}return this._cached},keys:function(){return Object.keys(this._getCached())},get:function(c){return this._getCached()[c]},put:function(c,b){if(this._stores.length!==0){var d=this._stores[0];if(d[c]!==b)d[c]=b,this._cached=null,this._scheduleFlush(d)}},remove:function(c){for(var b=0;b<
this._stores.length;++b){var d=this._stores[b];if(d.hasOwnProperty(c))return delete d[c],this._pendingDeletes[b]||(this._pendingDeletes[b]=[]),this._pendingDeletes[b].push(c),this._cached=null,this._scheduleFlush(),!0}return!1},clear:function(){for(var c=0;c<this._stores.length;++c)this._stores[c]={},this._scheduleFlush(this._stores[c]);this._cached=null},sync:function(c){if(this._flushPending)return this._flushPending=!1,this._flush();for(var b=this,d=[],a=0;a<this._providers.length;++a)d.push(this._providers[a].get(this._name,
c).then(function(c){return function(d){b._stores[c]=d}}(a)));return k.all(d).then(function(){b._cached=null;b._getCached()})},flush:function(){this._flush()}};g.prototype={get:function(c,b){if(this._currentPromises[c])return this._currentPromises[c];var d=new k,a=null;b?this._cache.remove(c):a=this._cache.get(c);if(a!==null)d.resolve(a);else{this._currentPromises[c]=d;var e=this;this._service.get(c).then(function(b){e._cache.set(c,b);delete e._currentPromises[c];d.resolve(b)},function(b){b.status===
404?(b={},e._cache.set(c,b),delete e._currentPromises[c],d.resolve(b)):(delete e._currentPromises[c],d.resolve(e._cache.get(c,!0)||{}))})}return d},put:function(c,b){this._cache.set(c,b);return this._service.put(c,b)},remove:function(c,b){var d=this._cache.get(c);delete d[b];this._cache.set(c,d);return this._service.remove(c,b)}};e.prototype={get:function(c,b){if(this._currentPromise)return this._currentPromise;var d=new k,a=null;b?this._cache.remove(c):a=this._cache.get(c);if(a!==null)d.resolve(a);
else{this._currentPromise=d;var e=this;j("GET",this._location,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(b){b=JSON.parse(b.response);e._cache.set(c,b[c]||{});e._currentPromise=null;d.resolve(b[c]||{})},function(b){b.xhr.status===401||b.xhr.status===404?(e._cache.set(c,{}),e._currentPromise=null,d.resolve({})):(e._currentPromise=null,b=e._cache.get(c,!0),b!==null?d.resolve(b[c]||{}):d.resolve({}))})}return d},put:function(){var c=new k;c.resolve();return c},remove:function(c,b){var d=
this._cache.get(c);delete d[b];this.put(c,d)}};f.prototype={get:function(c){var b=new k,c=this._cache.get(c);c!==null?b.resolve(c):b.resolve({});return b},put:function(c,b){var d=new k;this._cache.set(c,b);d.resolve();return d},remove:function(c,b){var d=this._cache.get(c);delete d[b];this.put(c,d)}};d.DEFAULT_SCOPE=1;d.LOCAL_SCOPE=2;d.USER_SCOPE=4;d.prototype={listenForChangedSettings:function(c,b,a){if(!b||typeof b!=="number"||b>7||b<1)a=b,b=d.DEFAULT_SCOPE|d.LOCAL_SCOPE|d.USER_SCOPE;window.addEventListener("storage",
a,!1);if((d.USER_SCOPE&b)!==0)return"/orion/preferences/user"+c;else if((d.LOCAL_SCOPE&b)!==0)return"/orion/preferences/local"+c;return"/orion/preferences/default"+c},getPreferences:function(c,b){if(!b||typeof b!=="number"||b>7||b<1)b=d.DEFAULT_SCOPE|d.LOCAL_SCOPE|d.USER_SCOPE;var a=[];d.USER_SCOPE&b&&this._userProvider.available()&&a.push(this._userProvider);d.LOCAL_SCOPE&b&&a.push(this._localProvider);d.DEFAULT_SCOPE&b&&a.push(this._defaultsProvider);var e=new h(c,a);return e.sync().then(function(){return e})},
getSetting:function(c,b,d){for(var a,e=0;e<c.length;e++)if(c[e].label===b)for(var f=0;f<c[e].data.length;f++)if(c[e].data[f].label===d){a=c[e].data[f].value;break}return a}};return{PreferencesService:d}});
(function(){function i(b){if(typeof b!=="string")throw new TypeError;}function k(b){return b?b.split("&"):[]}function j(b){return b.length===0?"":b.join("&")}function h(b){var n=/([^=]*)(?:=?)(.*)/.exec(b),b=n[1]?decodeURIComponent(n[1]):"",n=n[2]?decodeURIComponent(n[2]):"";return[b,n]}function a(b){var n=encodeURIComponent(b[0]);b[1]&&(n+="="+encodeURIComponent(b[1]));return n}function g(b,n){var c="",d=[],a=0;return{next:function(){if(c!==b.query)c=b.query,d=k(c);if(a<d.length){var e=h(d[a++]);
switch(n){case "keys":return e[0];case "values":return e[1];case "keys+values":return[e[0],e[1]];default:throw new TypeError;}}throw y;}}}function e(b){Object.defineProperty(this,"_url",{get:function(){return b._url}})}function f(b){return b?/[1-9]\d*$/.exec(b)[0]:""}function d(b){var n=[];b.split("/").forEach(function(b){b===".."?n.pop():b!=="."&&n.push(b)});return n.join("/")}function c(b){return b.replace(/\s/g,function(b){return"%"+b.charCodeAt(0).toString(16)})}function b(b,n){if(typeof b!==
"string")throw new TypeError;var b=c(b),a=o.exec(b);if(!a)return null;var e={};e.scheme=a[1]||"";if(e.scheme&&!p.test(e.scheme))return null;var l=a[2];if(l&&(l=q.exec(l),e.userinfo=l[1],e.host=l[2],e.port=l[3],e.port&&!t.test(e.port)))return null;e.path=a[3];e.query=a[4];e.fragment=a[5];if(!e.scheme&&n&&(e.scheme=n.scheme,!e.host&&n.host))e.userinfo=n.userinfo,e.host=n.host,e.port=n.port,e.pathRelative=!0;if(e.pathRelative)if(e.path){if(e.path[0]!=="/")a=/^(.*\/)[^\/]*$/.exec(n.path)[1]||"/",e.path=
a+e.path}else e.path=n.path;if(e.scheme)e.scheme=e.scheme.toLowerCase();if(e.port)e.port=f(e.port);if(e.host&&e.path)e.path=d(e.path);return e}function l(n,c){var d;if(c){c=c.href||c;d=b(c);if(!d||!d.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:d})}d=b(n,d);if(!d)throw new SyntaxError;Object.defineProperty(this,"_input",{value:n,writable:!0});Object.defineProperty(this,"_url",{value:d,writable:!0});var a=new e(this);Object.defineProperty(this,"query",{get:function(){return this._url?
a:null},enumerable:!0})}try{var m;if(typeof window.URL==="function"&&window.URL.length!==0&&(m=new window.URL("http://www.w3.org?q")).protocol==="http:"&&m.query)return}catch(s){}var o=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,q=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,p=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,t=/^\d*$/,r=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,u=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,v=/^([^?#\s]*)$/,n=/^([^\s]*)$/,w=/^\S*$/,x=/([^:]*):?(.*)/,y=typeof StopIteration!==
"undefined"?StopIteration:Error("Stop Iteration"),F={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(e.prototype,{get:{value:function(b){i(b);var n;k(this._url.query).some(function(c){c=h(c);if(c[0]===b)return n=c[1],!0});return n},enumerable:!0},set:{value:function(b,n){i(b);i(n);var c=k(this._url.query);c.some(function(d,e){var f=h(d);if(f[0]===b)return f[1]=n,c[e]=a(f),!0})||c.push(a([b,n]));this._url.query=j(c)},enumerable:!0},has:{value:function(b){i(b);
return k(this._url.query).some(function(n){if(h(n)[0]===b)return!0})},enumerable:!0},"delete":{value:function(b){i(b);var n=k(this._url.query),c=n.filter(function(n){return h(n)[0]!==b});return c.length!==n.length?(this._url.query=j(c),!0):!1},enumerable:!0},clear:{value:function(){this._url.query=""},enumerable:!0},forEach:{value:function(b,n){if(typeof b!=="function")throw new TypeError;var c=g(this._url,"keys+values");try{for(;;){var d=c.next();b.call(n,d[1],d[0],this)}}catch(a){if(a!==y)throw a;
}},enumerable:!0},keys:{value:function(){return g(this._url,"keys")},enumerable:!0},values:{value:function(){return g(this._url,"values")},enumerable:!0},items:{value:function(){return g(this._url,"keys+values")}},size:{get:function(){return k(this._url.query).length},enumerable:!0},getAll:{value:function(b){i(b);var n=[];k(this._url.query).forEach(function(c){c=h(c);c[0]===b&&n.push(c[1])});return n},enumerable:!0},append:{value:function(b,n){i(b);i(n);var c=k(this._url.query);c.push(a([b,n]));this._url.query=
j(c)},enumerable:!0}});Object.defineProperties(l.prototype,{href:{get:function(){var b;if(this._url){b=this._url;var n=b.scheme?b.scheme+":":"";b.host&&(n+="//",b.userinfo&&(n+=b.userinfo+"@"),n+=b.host,b.port&&(n+=":"+b.port));n+=b.path;b.query&&(n+="?"+b.query);b.fragment&&(n+="#"+b.fragment);b=n}else b=this._input;return b},set:function(n){i(n);this._input=n;this._url=b(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(b){i(b);if(this._url&&(b=b.slice(-1)===":"?b.substring(0,b.length-1):b,b===""||p.test(b)))this._url.scheme=b.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(b){i(b);if(this._url)this._url.userinfo=b}},username:{get:function(){if(!this._url)return"";var b=x.exec(this._userinfo);return decodeURIComponent(b[1]||"")},set:function(b){i(b);if(this._url){var n=
x.exec(this._userinfo),b=[encodeURIComponent(b||"")];n[2]&&b.push(n[2]);this._userinfo=b.join(":")}},enumerable:!0},password:{get:function(){if(!this._url)return"";var b=x.exec(this._userinfo);return decodeURIComponent(b[2]||"")},set:function(b){i(b);if(this._url){var n=[x.exec(this._userinfo)[1]||""];b&&n.push(encodeURIComponent(b));this._userinfo=n.join(":")}},enumerable:!0},host:{get:function(){var b="";this._url&&this._url.host&&(b+=this._url.host,this._url.port&&(b+=":"+this._url.port));return b},
set:function(b){i(b);if(this._url&&(b=u.exec(b)))this._url.host=b[1],this._url.port=f(b[2])},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(b){i(b);if(this._url&&r.exec(b))this._url.host=b},enumerable:!0},port:{get:function(){var b=this._url?this._url.port||"":"";b&&b===F[this.protocol]&&(b="");return b},set:function(b){i(b);if(this._url&&t.exec(b))this._url.port=f(b)},enumerable:!0},pathname:{get:function(){return this._url?this._url.path:""},set:function(b){i(b);
if(this._url&&v.exec(b))this._url.host&&b&&b[0]!=="/"&&(b="/"+b),this._url.path=b?d(b):""},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(b){i(b);if(this._url&&(b&&b[0]==="?"&&(b=b.substring(1)),n.exec(b)))this._url.query=b},enumerable:!0},hash:{get:function(){return this._url&&this._url.fragment?"#"+this._url.fragment:""},set:function(b){i(b);if(this._url&&(b&&b[0]==="#"&&(b=b.substring(1)),w.exec(b)))this._url.fragment=b},enumerable:!0}});
if((m=window.URL||window.webkitURL)&&m.createObjectURL)Object.defineProperty(l,"createObjectURL",{value:m.createObjectURL.bind(m),enumerable:!1}),Object.defineProperty(l,"revokeObjectURL",{value:m.revokeObjectURL.bind(m),enumerable:!1});window.URL=l})();define("orion/URL-shim",function(){});
define("orion/pluginregistry",["orion/Deferred","orion/EventTarget","orion/URL-shim"],function(i,k){function j(b,c){var d=Object.keys(b),a=Object.keys(c);if(d.length!==a.length)return!1;d.sort();a.sort();for(var e=0,f=d.length;e<f;e++){var g=d[e];if(g!==a[e])return!1;var h=b[g],g=c[g];if(h!==g&&JSON.stringify(h)!==JSON.stringify(g))return!1}return!0}function h(b){if(b.indexOf("://")===-1)try{return(new URL(b,location.href)).href}catch(c){}return b}function a(b){var c=null,d={key:function(d){return(c=
c||Object.keys(b))[d]},getItem:function(c){return b[c]},setItem:function(d,a){b[d]=a;c=null},removeItem:function(d){delete b[d];c=null},clear:function(){(c=c||Object.keys(b)).forEach(function(c){delete b[c]}.bind(this));c=null}};Object.defineProperty(d,"length",{get:function(){return(c=c||Object.keys(b)).length}});return d}function g(b,c){if(c&&c instanceof XMLHttpRequest){var d,a;try{d=c.status,a=c.statusText}catch(e){d=0,a=""}return{status:d||0,statusText:a}}return c}function e(b){var c=b?JSON.parse(JSON.stringify(b,
g)):b;if(b instanceof Error)c.__isError=!0,c.message=c.message||b.message,c.name=c.name||b.name;return c}function f(b,c){this.type=b;this.plugin=c}function d(b,c){this.__objectId=b;this.__methods=c}function c(b,c,a){function g(b){B&&a.postMessage(b,B)}function h(b){if(!B)return(new i).reject(Error("plugin not connected"));b.id=String(O++);var c=new i;S[b.id]=c;c.then(null,function(c){z==="active"&&c instanceof Error&&c.name==="Cancel"&&g({requestId:b.id,method:"cancel",params:c.message?[c.message]:
[]})});var n=Object.prototype.toString;b.params.forEach(function(a,e){if(n.call(a)==="[object Object]"&&!(a instanceof d)){var f,l;for(f in a)n.call(a[f])==="[object Function]"&&(l=l||[],l.push(f));if(l){var w=M++;P[w]=a;f=function(){delete P[w]};c.then(f,f);b.params[e]=new d(w,l)}}});a.postMessage(b,B);return c.promise}function p(b,c){b||b===0?g({id:b,result:null,error:c}):console.log(c)}function t(b,c,n,d){d.forEach(function(b,c){if(b&&typeof b.__objectId!=="undefined"){var n={};b.__methods.forEach(function(c){n[c]=
function(){return h({objectId:b.__objectId,method:c,params:Array.prototype.slice.call(arguments)})}});d[c]=n}});var a=typeof b===void 0?null:{id:b,result:null,error:null};try{var f=n.apply(c,d);if(a)f&&typeof f.then==="function"?(R[b]=f,f.then(function(c){delete R[b];a.result=c;g(a)},function(c){if(R[b])delete R[b],a.error=e(c),g(a)},function(){g({responseId:b,method:"progress",params:Array.prototype.slice.call(arguments)})})):(a.result=f,g(a))}catch(l){if(a)a.error=e(l),g(a)}}function r(b){try{if(b.method){var c=
b.method,n=b.params||[];if("serviceId"in b){var d=K[b.serviceId];d||p(b.id,"service not found");c in d?t(b.id,d,d[c],n):p(b.id,"method not found")}else if("objectId"in b){var e=P[b.objectId];e||p(b.id,"object not found");c in e?t(b.id,e,e[c],n):p(b.id,"method not found")}else if("requestId"in b){var f=R[b.requestId];f&&c==="cancel"&&f.cancel&&f.cancel.apply(f,n)}else if("responseId"in b){var l=S[b.responseId];l&&c==="progress"&&l.progress&&l.progress.apply(l,n)}else if("plugin"===b.method){var w=
b.params[0];L({headers:w.headers,services:w.services}).then(function(){E&&E.resolve(x)})}else if("timeout"===b.method)E&&E.reject(b.error);else throw Error("Bad method: "+b.method);}else{var g=S[String(b.id)];delete S[String(b.id)];if(b.error){var h=a.handleServiceError(x,b.error);g.reject(h)}else g.resolve(b.result)}}catch(m){console.log("Plugin._messageHandler "+m)}}function u(b){var c={};if(b.methods&&(b.methods.forEach(function(n){c[n]=function(){var c={serviceId:b.serviceId,method:n,params:Array.prototype.slice.call(arguments)};
return z==="active"?h(c):x.start({"transient":!0}).then(function(){return h(c)})}}),c.addEventListener&&c.removeEventListener)){var n=new k,a=M++;P[a]={handleEvent:n.dispatchEvent.bind(n)};var e=new d(a,["handleEvent"]),f=c.addEventListener;c.addEventListener=function(b,c){n._namedListeners[b]||f(b,e);n.addEventListener(b,c)};var l=c.removeEventListener;c.removeEventListener=function(b,c){n.removeEventListener(b,c);n._namedListeners[b]||l(b,e)}}return c}function v(c){var n=JSON.parse(JSON.stringify(c.properties));
n.__plugin__=b;c=c.names||c.type||[];Array.isArray(c)||(c=[c]);n.objectClass=c;return n}function n(b){var c=u(b),n=v(b),n=a.registerService(b.names||b.type,c,n);C[b.serviceId]={registration:n,proxy:c}}function w(){a.persist(b,{created:y,headers:F,services:H,autostart:D,lastModified:G})}var x=this,c=c||{},y=c.created||(new Date).getTime(),F=c.headers||{},H=c.services||[],D=c.autostart,G=c.lastModified||0,z="installed",J,E,B,Q,C={},O=0,M=0,R={},S={},P={},K={},L;this._persist=w;this._resolve=function(){z=
"resolved";a.dispatchEvent(new f("resolved",x))};this._getAutostart=function(){return D};this._getCreated=function(){return y};this.getLocation=function(){return b};this.getHeaders=function(){return JSON.parse(JSON.stringify(F))};this.getName=function(){var b=this.getHeaders();return b?b.name||"":null};this.getVersion=function(){var b=this.getHeaders();return b?b.version||"0.0.0":null};this.getLastModified=function(){return G};this.getServiceReferences=function(){var b=[];Object.keys(C).forEach(function(c){b.push(C[c].registration.getReference())});
return b};this.setParent=function(b){return Q!==b?(Q=b,x.stop({"transient":!0}).then(function(){if("started"===D)return x.start({"transient":!0});else if("lazy"===D)return x.start({lazy:!0,"transient":!0})})):(new i).resolve()};this.getState=function(){return z};this.start=function(c){if(z==="uninstalled")return(new i).reject(Error("Plugin is uninstalled"));if(J)return J.promise.then(this.start.bind(this,c));if(z==="active")return(new i).resolve();if(!c||!c.transient){var d=c&&c.lazy?"lazy":"started";
d!==D&&(D=d,w())}d=a.getState();if(d!=="starting"&&d!=="active")return c.transient?(new i).reject(Error("start transient error")):(new i).resolve();if(z==="installed")try{this._resolve()}catch(e){return(new i).reject(e)}z==="resolved"&&H.forEach(function(b){n(b)});if(c&&c.lazy)return z!=="starting"&&(z="starting",a.dispatchEvent(new f("lazy activation",x))),(new i).resolve();var g=new i;J=g;z="starting";a.dispatchEvent(new f("starting",x));E=new i;B=a.connect(b,r,Q);E.then(function(){E=null;z="active";
a.dispatchEvent(new f("started",x));J=null;g.resolve()},function(){E=null;z="stopping";a.dispatchEvent(new f("stopping",x));Object.keys(C).forEach(function(b){C[b].registration.unregister();delete C[b]});a.disconnect(B);B=null;z="resolved";J=null;a.dispatchEvent(new f("stopped",x));g.reject(Error("plugin activation error"))});return g.promise};this.stop=function(b){if(z==="uninstalled")return(new i).reject(Error("Plugin is uninstalled"));if(J)return J.promise.then(this.stop.bind(this,b));if((!b||
!b.transient)&&"stopped"!==D)D="stopped",w();if(z!=="active"&&z!=="starting")return(new i).resolve();J=b=new i;z="stopping";a.dispatchEvent(new f("stopping",x));Object.keys(C).forEach(function(b){C[b].registration.unregister();delete C[b]});B&&(a.disconnect(B),B=null);z="resolved";J=null;a.dispatchEvent(new f("stopped",x));b.resolve();return b.promise};L=function(c){if(z==="uninstalled")return(new i).reject(Error("Plugin is uninstalled"));if(!c)return G===0&&(G=(new Date).getTime(),w()),a.loadManifest(b).then(L);
var d=F,e=H,g=D;F=c.headers||{};H=c.services||{};D=c.autostart||D;c.lastModified?G=c.lastModified:(G=(new Date).getTime(),w());if(j(F,d)&&j(H,e)&&D===g)return(new i).resolve();if(z==="active"||z==="starting"){var h=[];Object.keys(H).forEach(function(b){var c=H[b];h.push(b);var d=C[b];if(d){if(j(c.methods,Object.keys(d.proxy))){var b=v(c),a=d.registration.getReference(),e={};a.getPropertyKeys().forEach(function(b){e[b]=a.getProperty(b)});j(b,e)||d.registration.setProperties(b);return}d.registration.unregister();
delete C[b]}n(c)});Object.keys(C).forEach(function(b){h.indexOf(b)===-1&&(C[b].registration.unregister(),delete C[b])})}z==="active"&&(a.disconnect(B),E=new i,B=a.connect(b,r,Q),E.then(function(){E=null},function(){E=null;z="stopping";a.dispatchEvent(new f("stopping"),x);Object.keys(C).forEach(function(b){C[b].registration.unregister();delete C[b]});a.disconnect(B);B=null;z="resolved";a.dispatchEvent(new f("stopped",x))}));return(new i).resolve()};this.update=function(b){return L(b).then(function(){a.dispatchEvent(new f("updated",
x))})};this.uninstall=function(){if(z==="uninstalled")return(new i).reject(Error("Plugin is uninstalled"));if(z==="active"||z==="starting"||z==="stopping")return this.stop().then(this.uninstall.bind(this),this.uninstall.bind(this));a.removePlugin(this);z="uninstalled";a.dispatchEvent(new f("uninstalled",x));return(new i).resolve()}}var b=/^http[s]?/i;return{Plugin:c,PluginRegistry:function(d,e){function g(b){var c=b.source;r.some(function(n){if(c===n.target){try{var d;if(typeof n.useStructuredClone===
"undefined"){var a=typeof b.data!=="string";d=a?b.data:JSON.parse(b.data);n.useStructuredClone=a}else d=n.useStructuredClone?b.data:JSON.parse(b.data);n.handler(d)}catch(e){}return!0}})}var e=e||{},o=e.storage||localStorage;o.getItem||(o=a(o));var q="installed",p,j=[],r=[],u=new k,v={},n={registerService:d.registerService.bind(d),connect:function(b,c,n,d){function a(b){b=Error(b);b.name="timeout";c({method:"timeout",error:b})}var e={handler:c,url:b},f=setTimeout(a.bind(null,"Load timeout for: "+b),
d||15E3),l=document.createElement("iframe");l.name=b+"_"+(new Date).getTime();l.src=b;l.onload=function(){clearTimeout(f);f=setTimeout(a.bind(null,"Plugin handshake timeout for: "+b),5E3)};l.sandbox="allow-scripts allow-same-origin";l.style.width=l.style.height="100%";l.frameBorder=0;(n||p).appendChild(l);e.target=l.contentWindow;e.close=function(){clearTimeout(f);if(l){var b=l.parentNode;b&&b.removeChild(l);l=null}};r.push(e);return e},disconnect:function(b){for(var c=0;c<r.length;c++)if(b===r[c]){r.splice(c,
1);try{b.close()}catch(n){}break}},removePlugin:function(b){for(var c=0;c<j.length;c++)if(b===j[c]){j.splice(c,1);break}o.removeItem("plugin."+b.getLocation())},persist:function(b,c){o.setItem("plugin."+b,JSON.stringify(c))},postMessage:function(b,c){c.target.postMessage(c.useStructuredClone?b:JSON.stringify(b),c.url)},dispatchEvent:function(b){try{u.dispatchEvent(b)}catch(c){console&&console.log("PluginRegistry.dispatchEvent "+c)}},loadManifest:function(b){var c=new i,d=n.connect(b,function(b){d&&
b.method&&("manifest"===b.method||"plugin"===b.method?(b=b.params[0],n.disconnect(d),d=null,c.resolve(b)):"timeout"===b.method&&(n.disconnect(d),d=null,c.reject(b.error)))});return c.promise},getState:function(){return q},handleServiceError:function(c,n){if(n&&n.status===401){var d=c.getHeaders(),a=c.getName()||c.getLocation(),e=document.createElement("span");e.appendChild(document.createTextNode("Authentication required for: "+a+"."));if(d.login)e.appendChild(document.createTextNode(" ")),a=document.createElement("a"),
a.target="_blank",a.textContent="Login",a.href=d.login,b.test(a.href)?(e.appendChild(a),e.appendChild(document.createTextNode(" and re-try the request."))):console.log("Illegal Login URL: "+d.login);return{Severity:"Error",HTML:!0,Message:(new XMLSerializer).serializeToString(e)}}if(n.__isError){var f=n,n=Error(f.message);Object.keys(f).forEach(function(b){n[b]=f[b]});delete n.__isError}return n}};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=n.getState;this.init=function(){if(!(q==="starting"||q==="active"||q==="stopping")){addEventListener("message",g,!1);for(var b=[],d=0,a=o.length;d<a;d++)b.push(o.key(d));b.forEach(function(b){if(b.indexOf("plugin.")===0){var d=b.substring(7),b=JSON.parse(o.getItem(b));b.created&&j.push(new c(d,b,n))}});j.sort(function(b,c){return b._getCreated()<c._getCreated()?-1:1});if(e.parent)p=e.parent;else{p=document.createElement("div");
if(!e.visible)p.style.display="none",p.style.visibility="hidden";document.body.appendChild(p)}e.plugins&&Object.keys(e.plugins).forEach(function(b){b=h(b);if(!this.getPlugin(b)){var d=e.plugins[b];typeof d!=="object"&&(d={});d.autostart=d.autostart||e.defaultAutostart||"lazy";j.push(new c(b,d,n))}}.bind(this));q="starting"}};this.start=function(){q!=="starting"&&this.init();if(q!=="starting")return(new i).reject("Cannot start framework. Framework is already "+q+".");var b=[],c=(new Date).getTime();
j.forEach(function(n){var d=n._getAutostart();n.getLastModified()===0?b.push(n.update().then(function(){if("started"===d)return n.start({"transient":!0});if("lazy"===d)return n.start({lazy:!0,"transient":!0});n._resolve()})):"started"===d?b.push(n.start({"transient":!0})):"lazy"===d?(b.push(n.start({lazy:!0,"transient":!0})),c>n.getLastModified()+864E5&&n.update()):n._resolve()});return i.all(b,function(b){console.log("PluginRegistry.stop "+b)}).then(function(){q="active"})};this.stop=function(){if(q!==
"starting"&&q!=="active")return(new i).reject("Cannot stop registry. Registry is already "+q+".");q="stopping";var b=[];j.forEach(function(c){b.push(c.stop({"transient":!0}))});return i.all(b,function(b){console.log("PluginRegistry.stop "+b)}).then(function(){if(!e.parent){var b=p.parentNode;b&&b.removeChild(p)}p=null;removeEventListener("message",g);q="resolved"})};this.update=function(){this.stop().then(this.start.bind(this))};this.uninstall=function(){return(new i).reject("Cannot uninstall registry")};
this.installPlugin=function(b,d){var b=h(b),a=this.getPlugin(b);if(a)return(new i).resolve(a);if(v[b])return v[b];if(d)return a=new c(b,d,n),j.push(a),a._persist(),n.dispatchEvent(new f("installed",a)),(new i).resolve(a);var e=n.loadManifest(b).then(function(d){a=new c(b,d,n);j.push(a);a._persist();delete v[b];n.dispatchEvent(new f("installed",a));return a},function(c){delete v[b];throw c;});return v[b]=e};this.getPlugins=function(){return j.slice()};this.getPlugin=function(b){var c=null,b=h(b);j.some(function(n){if(b===
n.getLocation())return c=n,!0});return c};this.addEventListener=u.addEventListener.bind(u);this.removeEventListener=u.removeEventListener.bind(u);this.resolvePlugins=function(){var b=!0;j.forEach(function(c){b=b&&c._resolve()});return b}}}});
define("orion/serviceTracker",[],function(){function i(h,a){function g(b){var c=b.getProperty("service.id"),a=this.addingService(b);a&&(f[c]=b,d[c]=a)}function e(b){var c=b.getProperty("service.id"),a=d[c];delete f[c];delete d[c];this.removedService(b,a)}this.serviceRegistry=h;var f={},d={},c=k,b,l;this.close=function(){if(c!==j)throw"Already closed";c=k;h.removeEventListener("registered",b);h.removeEventListener("unregistering",l);l=b=null;var d=this;this.getServiceReferences().forEach(function(b){e.call(d,
b)});if(typeof this.onClose==="function")this.onClose()};this.getServiceReferences=function(){var b=Object.keys(f);return!b.length?null:b.map(function(b){return f[b]})};this.open=function(){if(c!==k)throw"Already open";c=j;var d=this;b=function(b){if(b.serviceReference.getProperty("objectClass").indexOf(a)!==-1&&(g.call(d,b.serviceReference),typeof d.onServiceAdded==="function"))return d.onServiceAdded(b.serviceReference,d.serviceRegistry.getService(b.serviceReference))};l=function(b){b.serviceReference.getProperty("objectClass").indexOf(a)!==
-1&&e.call(d,b.serviceReference)};h.addEventListener("registered",b);h.addEventListener("unregistering",l);h.getServiceReferences(a).forEach(function(b){g.call(d,b);if(typeof d.onServiceAdded==="function")return d.onServiceAdded(b,h.getService(b))});if(typeof this.onOpen==="function")this.onOpen()}}var k=0,j=1;i.prototype={addingService:function(h){return this.serviceRegistry.getService(h)},onOpen:null,onClose:null,onServiceAdded:null,removedService:function(){}};return i});
define("orion/objects",[],function(){function i(i){for(var j=1;j<arguments.length;j++){var h=arguments[j],a;for(a in h)Object.prototype.hasOwnProperty.call(h,a)&&(i[a]=h[a])}return i}return{clone:function(k){if(Array.isArray(k))return Array.prototype.slice.call(k);var j=Object.create(Object.getPrototypeOf(k));i(j,k);return j},mixin:i,toArray:function(i){return Array.isArray(i)?i:[i]}}});
define("orion/config",["orion/Deferred","orion/serviceTracker","orion/objects"],function(i,k,j){var h,a,g,e,f,d="pid";h=function(b,c,a){function e(b,d,a){d.forEach(function(e,n){try{var f=b[n].getProperty("__plugin__"),g=f&&c.getPlugin(f);(!f||g&&g.getState()==="active")&&d[n].updated(a)}catch(h){typeof console!=="undefined"&&console.log(h)}})}k.call(this,b,"orion.cm.managedservice");var f={},g={},h=function(c){var e=[];c.plugin.getServiceReferences().forEach(function(c){if(c.getProperty("objectClass").indexOf("orion.cm.managedservice")!==
-1){var f=c.getProperty(d),c=b.getService(c);f&&c&&(f=(f=a._find(f))&&f.getProperties(),e.push(c.updated(f)))}});return i.all(e)};this.addingService=function(c){var a=c.getProperty(d),e=b.getService(c);if(!a||!e)return null;f[a]||(f[a]=[]);g[a]||(g[a]=[]);f[a].push(c);g[a].push(e);return e};this.onServiceAdded=function(b,c){var f=b.getProperty(d),f=a._find(f);e([b],[c],f&&f.getProperties())};this.onOpen=function(){c.addEventListener("started",h)};this.onClose=function(){c.removeEventListener("started",
h)};this.notifyUpdated=function(b){var c=b.getPid();e(f[c]||[],g[c]||[],b.getProperties())};this.notifyDeleted=function(b){b=b.getPid();e(f[b]||[],g[b]||[],null)};this.removedService=function(b,c){var a=b.getProperty(d),e=f[a],n=g[a];e.length>1?e.splice(e.indexOf(b),1):delete f[a];n.length>1?n.splice(n.indexOf(c),1):delete g[a]}};a=function(){function b(b,c,d){this.store=new g(this,d);this.configAdmin=new e(this,this.store);this.tracker=new h(b,c,this.store)}b.prototype={getConfigurationAdmin:function(){var b=
this;return this.configAdmin._init().then(function(c){b.tracker.open();return c})},notifyDeleted:function(b){this.tracker.notifyDeleted(b)},notifyUpdated:function(b){this.tracker.notifyUpdated(b)}};return b}();e=function(){function b(b,c){this.factory=b;this.store=c}b.prototype={_init:function(){var b=this;return this.store._init().then(function(){return b})},getConfiguration:function(b){return this.store.get(b)},listConfigurations:function(){return this.store.list()}};return b}();var c="/cm/configurations";
g=function(){function b(b,a){this.factory=b;this.prefsService=a;this.configs=Object.create(null);this.pref=null;var e=this;this.initPromise=this.prefsService.getPreferences(c).then(function(b){e.pref=b;b.keys().forEach(function(c){if(!e.configs[c]){var a=b.get(c);typeof a==="object"&&a!==null&&Object.keys(a).length>0&&(a[d]=c,e.configs[c]=new f(e.factory,e,a))}})})}b.prototype={_init:function(){return this.initPromise},_find:function(b){return this.configs[b]||null},get:function(b){var c=this._find(b);
c||(c=new f(this.factory,this,b),this.configs[b]=c);return c},list:function(){var b=this,c=[];this.pref.keys().forEach(function(d){(d=b._find(d))&&d.getProperties()!==null&&c.push(d)});return c},remove:function(b){this.pref.remove(b);delete this.configs[b]},save:function(b,c){this.pref.put(b,c.getProperties(!0)||{})}};return b}();f=function(){function b(b,c){c=j.clone(c);delete c[d];b.properties=c}function c(a,e,f){this.factory=a;this.store=e;if(f!==null&&typeof f==="object")this.pid=f[d],b(this,
f);else if(typeof f==="string")this.pid=f,this.properties=null;else throw Error("Invalid pid/properties "+f);}c.prototype={_checkRemoved:function(){if(this._removed)throw Error("Configuration was removed");},getPid:function(){this._checkRemoved();return this.pid},getProperties:function(b){this._checkRemoved();var c=null;if(this.properties&&(c=j.clone(this.properties),!b))c[d]=this.pid;return c},remove:function(){this._checkRemoved();this.factory.notifyDeleted(this);this.store.remove(this.pid);this._removed=
!0},update:function(c){this._checkRemoved();b(this,c);this.store.save(this.pid,this);this.factory.notifyUpdated(this)},toString:function(){return"[ConfigImpl pid: "+this.pid+", properties: "+JSON.stringify(this.properties)+"]"}};return c}();return{ConfigurationAdminFactory:a}});
define("orion/bootstrap","require,orion/Deferred,orion/serviceregistry,orion/preferences,orion/pluginregistry,orion/config".split(","),function(i,k,j,h,a,g){var e;return{startup:function(){if(e)return e;e=new k;var f=new j.ServiceRegistry,d=new h.PreferencesService(f);return d.getPreferences("/plugins").then(function(c){var b={plugins:{}};c.keys().forEach(function(d){var a=i.toUrl(d);b.plugins[a]=c[d]});var l=new a.PluginRegistry(f,b);return l.start().then(function(){if(f.getServiceReferences("orion.core.preference.provider").length>
0)return d.getPreferences("/plugins",d.USER_SCOPE).then(function(b){var c=[];b.keys().forEach(function(b){b=i.toUrl(b);l.getPlugin(b)||c.push(l.installPlugin(b,{autostart:"lazy"}).then(function(b){return b.update().then(function(){return b.start({lazy:!0})})}))});return k.all(c,function(b){console.log(b)})})}).then(function(){return(new g.ConfigurationAdminFactory(f,l,d)).getConfigurationAdmin().then(f.registerService.bind(f,"orion.cm.configadmin"))}).then(function(){var b=f.getService("orion.core.auth");
if(b){var c=b.getUser().then(function(c){if(c)localStorage.setItem("lastLogin",(new Date).getTime());else return b.getAuthForm(window.location.href).then(function(b){setTimeout(function(){window.location=b},0)})}),d=localStorage.getItem("lastLogin");if(!d||d<(new Date).getTime()-9E5)return c}}).then(function(){var b={serviceRegistry:f,preferences:d,pluginRegistry:l};e.resolve(b);return b})})}}});
(function(){function i(a,g,e,f,d,c){g[a]&&(e.push(a),(g[a]===!0||g[a]===1)&&f.push(d+a+"/"+c))}function k(a,g,e,f,d){g=f+g+"/"+d;require._fileExists(a.toUrl(g+".js"))&&e.push(g)}function j(a,g,e){for(var f in g)g.hasOwnProperty(f)&&(!a.hasOwnProperty(f)||e)?a[f]=g[f]:typeof g[f]==="object"&&j(a[f],g[f],e)}var h=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(a){var g=a.config?a.config():{};return{version:"2.0.1+",load:function(a,f,d,c){c=c||{};if(c.locale)g.locale=c.locale;
var b=h.exec(a),l=b[1],m=b[4],s=b[5],o=m.split("-"),q=[],p={},t,r="";if(b[5])l=b[1],a=l+s;else{s=b[4];m=g.locale;if(!m)m=g.locale=typeof navigator==="undefined"?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase();o=m.split("-")}if(c.isBuild){q.push(a);k(f,"root",q,l,s);for(t=0;t<o.length;t++)c=o[t],r+=(r?"-":"")+c,k(f,r,q,l,s);f(q,function(){d()})}else f([a],function(b){var c=[],n;i("root",b,c,q,l,s);for(t=0;t<o.length;t++)n=o[t],r+=(r?"-":"")+n,i(r,b,c,q,l,s);f(q,function(){var n,
a,e;for(n=c.length-1;n>-1&&c[n];n--){e=c[n];a=b[e];if(a===!0||a===1)a=f(l+e+"/"+s);j(p,a)}d(p)})})}}})})();
define("orion/i18n",[],function(){return{load:function(i,k,j,h){var h=h||{},a=/(^.*(?:^|\/)nls(?:\/|$))([^\/]*)\/?([^\/]*)/,g=a.exec(i);if(g){if(!k.defined||k.defined(i))try{j(k(i));return}catch(e){}if(h.isBuild||h.isTest)j({});else if(k.specified&&!k.specified("orion/bootstrap"))j({});else{var f=g[1],d=g[3]?g[2]:"",c=g[3]||g[2];k(["orion/bootstrap"],function(b){b.startup().then(function(b){var e=b.serviceRegistry,b=e.getServiceReferences("orion.i18n.message");if(d)b.some(function(b){return i===b.getProperty("name")?
(e.getService(b).getMessageBundle().then(function(b){j(b)},function(){j({})}),!0):!1})||j({});else{var s={},o;b.forEach(function(b){var e=b.getProperty("name");if((g=a.exec(e))&&f===g[1]&&c===(g[3]||g[2]))if(d=g[3]?g[2]:""){if((b=h.locale||(typeof navigator!=="undefined"?navigator.language||navigator.userLanguage:null))&&b.toLowerCase().indexOf(d.toLowerCase())===0)s[d]=!0,(!k.specified||!k.specified(e))&&define(e,["orion/i18n!"+e],function(b){return b})}else o=b});!k.specified||!k.specified(i)?o?
e.getService(o).getMessageBundle().then(function(b){Object.keys(s).forEach(function(c){typeof b[c]==="undefined"&&(b[c]=s[c])});define(i,[],b);j(b)},function(){define(i,[],s);j(s)}):(define(i,[],s),j(s)):j(s)}})})}}else j(null)}}});
define("orion/nls/root/messages",{Navigator:"Navigator",Sites:"Sites",Shell:"Shell",ShellLinkWorkspace:"Workspace Shell","Get Plugins":"Get Plugins",Global:"Global",Editor:"Editor",EditorRelatedLink:"Show Current Folder",EditorRelatedLinkParent:"Show Enclosing Folder",EditorLinkWorkspace:"Show Workspace",EditorRelatedLinkProj:"Show Project","Filter bindings":"Filter bindings","Orion Editor":"Orion Editor","Orion Image Viewer":"Orion Image Viewer","Orion Markdown Viewer":"Orion Markdown Viewer","Orion JSON Editor":"Orion JSON Editor",
"View on Site":"View on Site","View this file or folder on a web site hosted by Orion":"View this file or folder on a web site hosted by Orion.","Show a list of all the keybindings on this page":"Show a list of all the keybindings on this page","Show Keys":"Show Keys","Hide or show the page banner and footer":"Hide or show the page banner and footer","Toggle banner and footer":"Toggle banner and footer","Choose a file by name and open an editor on it":"Choose a file by name and open an editor on it",
"Find File Named...":"Find File Named...","System Configuration Details":"System Configuration Details","System Config Tooltip":"Go to the System Configuration Details page","Background Operations":"Background Operations","Background Operations Tooltip":"Go to the Background Operations page","Operation status is unknown":"Operation status is unknown","Unknown item":"Unknown item","Can't search: no search service is available":"Can't search: no search service is available","could not find banner parent, id was ":"could not find banner parent, id was ",
Related:"Related",Options:"Options",FAQ:"FAQ","Report a Bug":"Bugs","Privacy Policy":"Privacy","Terms of Use":"Terms","Copyright Agent":"Copyright","Orion Logo":"Orion Logo","Orion is in Beta. Please try it out but BEWARE your data may be lost.":"I20140226-2325","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.",Browser:"Web Browser",OutlineProgress:"Getting outline for ${0} from ${1}",UnknownError:"An unknown error occurred.",UnknownWarning:"An unknown warning occurred.",Filter:"Filter (* = any string, ? = any character)",
"To view the browser's context menu, trigger the context menu again.":"To view the browser's context menu, trigger the context menu again.",Edit:"Edit",CentralNavTooltip:"Toggle Navigation Menu"});define("orion/nls/messages",["orion/i18n!orion/nls/messages","orion/nls/root/messages"],function(i,k){var j={root:k};Object.keys(i).forEach(function(h){typeof j[h]==="undefined"&&(j[h]=i[h])});return j});
define("text",["module"],function(i){var k,j,h=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],a=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,g=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,e=typeof location!=="undefined"&&location.href,f=e&&location.protocol&&location.protocol.replace(/\:/,""),d=e&&location.hostname,c=e&&(location.port||void 0),b=[],l=i.config&&i.config()||{};k={version:"2.0.5",strip:function(b){if(b){var b=b.replace(a,""),c=b.match(g);c&&(b=c[1])}else b="";return b},
jsEscape:function(b){return b.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:l.createXhr||function(){var b,c,d;if(typeof XMLHttpRequest!=="undefined")return new XMLHttpRequest;else if(typeof ActiveXObject!=="undefined")for(c=0;c<3;c+=1){d=h[c];try{b=new ActiveXObject(d)}catch(a){}if(b){h=[d];break}}return b},parseName:function(b){var c,
d,a=!1,e=b.indexOf(".");c=b.indexOf("./")===0||b.indexOf("../")===0;e!==-1&&(!c||e>1)?(c=b.substring(0,e),d=b.substring(e+1,b.length)):c=b;b=d||c;e=b.indexOf("!");e!==-1&&(a=b.substring(e+1)==="strip",b=b.substring(0,e),d?d=b:c=b);return{moduleName:c,ext:d,strip:a}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(b,c,d,a){var e,f;e=k.xdRegExp.exec(b);if(!e)return!0;b=e[2];e=e[3];e=e.split(":");f=e[1];e=e[0];return(!b||b===c)&&(!e||e.toLowerCase()===d.toLowerCase())&&(!f&&!e||f===a)},finishLoad:function(c,
d,a,e){a=d?k.strip(a):a;l.isBuild&&(b[c]=a);e(a)},load:function(b,a,g,h){if(h.isBuild&&!h.inlineText)g();else{l.isBuild=h.isBuild;var p=k.parseName(b),h=p.moduleName+(p.ext?"."+p.ext:""),j=a.toUrl(h),i=l.useXhr||k.useXhr;!e||i(j,f,d,c)?k.get(j,function(c){k.finishLoad(b,p.strip,c,g)},function(b){g.error&&g.error(b)}):a([h],function(b){k.finishLoad(p.moduleName+"."+p.ext,p.strip,b,g)})}},write:function(c,d,a){if(b.hasOwnProperty(d)){var e=k.jsEscape(b[d]);a.asModule(c+"!"+d,"define(function () { return '"+
e+"';});\n")}},writeFile:function(b,c,d,a,e){var c=k.parseName(c),f=c.ext?"."+c.ext:"",l=c.moduleName+f,g=d.toUrl(c.moduleName+f)+".js";k.load(l,d,function(){var c=function(b){return a(g,b)};c.asModule=function(b,c){return a.asModule(b,g,c)};k.write(b,l,c,e)},e)}};if(l.env==="node"||!l.env&&typeof process!=="undefined"&&process.versions&&process.versions.node)j=require.nodeRequire("fs"),k.get=function(b,c){var d=j.readFileSync(b,"utf8");d.indexOf("\ufeff")===0&&(d=d.substring(1));c(d)};else if(l.env===
"xhr"||!l.env&&k.createXhr())k.get=function(b,c,d,a){var e=k.createXhr(),f;e.open("GET",b,!0);if(a)for(f in a)a.hasOwnProperty(f)&&e.setRequestHeader(f.toLowerCase(),a[f]);if(l.onXhr)l.onXhr(e,b);e.onreadystatechange=function(){var a;if(e.readyState===4)a=e.status,a>399&&a<600?(a=Error(b+" HTTP status: "+a),a.xhr=e,d(a)):c(e.responseText)};e.send(null)};else if(l.env==="rhino"||!l.env&&typeof Packages!=="undefined"&&typeof java!=="undefined")k.get=function(b,c){var d,a,e=new java.io.File(b),f=java.lang.System.getProperty("line.separator"),
e=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(e),"utf-8")),l="";try{d=new java.lang.StringBuffer;(a=e.readLine())&&a.length()&&a.charAt(0)===65279&&(a=a.substring(1));for(a!==null&&d.append(a);(a=e.readLine())!==null;)d.append(f),d.append(a);l=String(d.toString())}finally{e.close()}c(l)};return k});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(i,k,j){return{slideoutHTMLFragment:function(h){var a=document.createElement("div");a.innerHTML=j;var g=k.$("#slideContainer",a);g.id=h+g.id;g=k.$("#pageCommandParameters",a);g.id=h+g.id;g=k.$("#pageCommandDismiss",a);g.id=h+g.id;return a.innerHTML}}});
define("orion/keyBinding",["orion/util"],function(i){function k(h,a,g,e,f,d){this.type=d||"keydown";this.keyCode=typeof h==="string"&&this.type==="keydown"?h.toUpperCase().charCodeAt(0):h;this.mod1=a!==void 0&&a!==null?a:!1;this.mod2=g!==void 0&&g!==null?g:!1;this.mod3=e!==void 0&&e!==null?e:!1;this.mod4=f!==void 0&&f!==null?f:!1}function j(h){this.keys=h}k.prototype={getKeys:function(){return[this]},match:function(h,a){if(a!==void 0){if(a!==0)return!1}else if(h instanceof Array){if(h.length>1)return!1;
h=h[0]}return h.type!==this.type?!1:this.keyCode===h.keyCode||this.keyCode===String.fromCharCode(i.isOpera?h.which:h.charCode!==void 0?h.charCode:h.keyCode)?this.mod1!==(i.isMac?h.metaKey:h.ctrlKey)?!1:this.type==="keydown"&&this.mod2!==h.shiftKey?!1:this.mod3!==h.altKey?!1:i.isMac&&this.mod4!==h.ctrlKey?!1:!0:!1},equals:function(h){return!h?!1:this.keyCode!==h.keyCode?!1:this.mod1!==h.mod1?!1:this.mod2!==h.mod2?!1:this.mod3!==h.mod3?!1:this.mod4!==h.mod4?!1:this.type!==h.type?!1:!0}};j.prototype=
{getKeys:function(){return this.keys.slice(0)},match:function(h,a){var g=this.keys;if(a!==void 0)return a>g.length?!1:g[a].match(h)?a===g.length-1?!0:a+1:!1;else{h instanceof Array||(h=[h]);if(h.length>g.length)return!1;var e;for(e=0;e<h.length;e++)if(!g[e].match(h[e]))return!1;return e===g.length?!0:e}},equals:function(h){if(!h.keys)return!1;if(h.keys.length!==this.keys.length)return!1;for(var a=0;a<h.keys.length;a++)if(!h.keys[a].equals(this.keys[a]))return!1;return!0}};return{KeyBinding:k,KeyStroke:k,
KeySequence:j}});
define("orion/webui/dropdown",["require","orion/webui/littlelib","orion/EventTarget"],function(i,k,j){function h(a){j.attach(this);this._init(a)}h.prototype={_init:function(a){this._dropdownNode=k.node(a.dropdown);if(!this._dropdownNode)throw"no dom node for dropdown found";this._populate=a.populate;this._selectionClass=a.selectionClass;this._parentDropdown=a.parentDropdown;this._positioningNode=a.positioningNode;if(!this._parentDropdown)for(var g=this._dropdownNode.parentNode;g&&document!==g;){if(g.classList&&
g.classList.contains("dropdownMenu")){this._parentDropdown=g.dropdown;break}g=g.parentNode}this._triggerNode=a.triggerNode?a.triggerNode:k.$(".dropdownTrigger",this._dropdownNode.parentNode);if(!this._triggerNode)throw"no dom node for dropdown trigger found";if(!a.skipTriggerEventListeners){var e=this;this._triggerNode.addEventListener("click",function(a){e.toggle(a)&&k.stop(a)},!1);this._triggerNode.tagName.toLowerCase()==="span"&&this._triggerNode.addEventListener("keydown",function(a){if(a.keyCode===
k.KEY.ENTER||a.keyCode===k.KEY.SPACE)e.toggle(),k.stop(a)},!1)}this._dropdownNode.addEventListener("keydown",this._dropdownKeyDown.bind(this),!1)},addTriggerNode:function(a){var g=this;a.addEventListener("click",function(a){g.toggle(a)&&k.stop(a)},!1)},toggle:function(a){return this.isVisible()?this.close():this.open(a)},isVisible:function(){return this._isVisible},open:function(a){var g=!1;if(!this.isVisible()){this.dispatchEvent({type:"triggered",dropdown:this,event:a});k.setFramesEnabled(!1);this._populate&&
(this.empty(),this._populate(this._dropdownNode));var e=this.getItems();if(e.length>0){if(!this._hookedAutoDismiss)this._boundAutoDismiss?k.removeAutoDismiss(this._boundAutoDismiss):this._boundAutoDismiss=this._autoDismiss.bind(this),g=k.$$array(".dropdownSubMenu",this._dropdownNode),k.addAutoDismiss([this._triggerNode].concat(g),this._boundAutoDismiss),this._hookedAutoDismiss=!0;this._triggerNode.classList.add("dropdownTriggerOpen");this._selectionClass&&this._triggerNode.classList.add(this._selectionClass);
this._dropdownNode.classList.add("dropdownMenuOpen");this._isVisible=!0;this._positionDropdown(a);e[0].focus();g=!0;this._parentDropdown&&this._parentDropdown.submenuOpen(this)}}return g},_autoDismiss:function(a){if(this.close(!1)&&this._dropdownNode.contains(a.target))for(a=this._parentDropdown;a;)a.close(!1),a=a._parentDropdown},_positionDropdown:function(){this._dropdownNode.style.left="";this._dropdownNode.style.top="";if(this._positioningNode)this._dropdownNode.style.left=this._positioningNode.offsetLeft+
"px";else{var a=k.bounds(this._dropdownNode),g=k.bounds(document.body);if(a.left+a.width>g.left+g.width)if(this._triggerNode.classList.contains("dropdownMenuItem"))this._dropdownNode.style.left=-a.width+"px";else{var e=k.bounds(this._boundingNode(this._triggerNode)),f=k.bounds(this._triggerNode);this._dropdownNode.style.left=f.left-e.left-a.width+f.width+"px"}a=a.top+a.height-(g.top+g.height);if(0<a)this._dropdownNode.style.top=Math.floor(this._dropdownNode.style.top-a)+"px"}},_boundingNode:function(a){var g=
window.getComputedStyle(a,null);return g===null?a:g.getPropertyValue("position")==="absolute"||!a.parentNode||a===document.body?a:this._boundingNode(a.parentNode)},close:function(a){var g=!1;if(this.isVisible())this._triggerNode.classList.remove("dropdownTriggerOpen"),this._selectionClass&&this._triggerNode.classList.remove(this._selectionClass),this._dropdownNode.classList.remove("dropdownMenuOpen"),k.setFramesEnabled(!0),a&&this._triggerNode.focus(),this._isVisible=!1,g=!0;return g},getItems:function(){var a=
[],g=this;k.$$array("li:not(.dropdownSeparator) > .dropdownMenuItem",this._dropdownNode,!0).forEach(function(e){e.parentNode.parentNode===g._dropdownNode&&a.push(e)});a.forEach(function(a){if(!a._hasDropdownMouseover)a.addEventListener("mouseover",function(f){a.dropdown?a.dropdown.open(f):(g._closeSelectedSubmenu(),k.stop(f))}),a._hasDropdownMouseover=!0});return a},empty:function(){var a=this;k.$$array("li",this._dropdownNode).forEach(function(g){g.parentNode===a._dropdownNode&&g.parentNode.removeChild(g)});
this._hookedAutoDismiss=!1},_dropdownKeyDown:function(a){if(a.keyCode===k.KEY.UP||a.keyCode===k.KEY.DOWN||a.keyCode===k.KEY.RIGHT||a.keyCode===k.KEY.ENTER||a.keyCode===k.KEY.LEFT){var g=this.getItems(),e=document.activeElement;if(g.length&&g.length>0&&e){var f=g.indexOf(e);f<0&&(f=g.indexOf(e.parentNode));f>=0&&(a.keyCode===k.KEY.UP&&f>0?(f--,g[f].focus()):a.keyCode===k.KEY.DOWN&&f<g.length-1?(f++,g[f].focus()):a.keyCode===k.KEY.ENTER||a.keyCode===k.KEY.RIGHT?e.classList.contains("dropdownTrigger")&&
e.dropdown&&e.dropdown.open():a.keyCode===k.KEY.LEFT&&e.parentNode.parentNode.classList.contains("dropdownMenuOpen")&&this.close(!0),k.stop(a))}}else a.keyCode===k.KEY.ESCAPE&&(this.close(!0),k.stop(a))},submenuOpen:function(a){if(a!==this._selectedSubmenu)this._closeSelectedSubmenu(),this._selectedSubmenu=a},_closeSelectedSubmenu:function(){for(var a=this._selectedSubmenu;a;)a.close(),a=a._selectedSubmenu},destroy:function(){this.empty();this._boundAutoDismiss&&k.removeAutoDismiss(this._boundAutoDismiss)}};
h.prototype.constructor=h;return{Dropdown:h}});define("text!orion/webui/dropdowntriggerbutton.html",[],function(){return'<button class="dropdownTrigger">${ButtonText}<\!--span class="dropdownArrowDown core-sprite-openarrow"></span--\></button><ul class="dropdownMenu"></ul>'});define("text!orion/webui/dropdowntriggerbuttonwitharrow.html",[],function(){return'<button class="dropdownTrigger dropdownDefaultButton">${ButtonText}<span class="dropdownArrowDown core-sprite-openarrow"></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"><span class="dropdownCommandName">${ButtonText}</span><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(i,k){function j(h){this._init(h)}j.prototype={_init:function(h){this._node=k.node(h.node);if(!this._node)throw"no dom node for tooltip found";this._position=h.position||["right","above","below","left"];this._text=h.text;this._hideDelay=h.hideDelay===void 0?200:h.hideDelay;this._tailSize=h.tailSize||10;this._trigger=h.trigger||"mouseover";this._afterShowing=h.afterShowing;this._afterHiding=h.afterHiding;var a=this;if(this._trigger===
"click")this._showDelay=0,this._node.addEventListener("click",this._clickHandler=function(e){e.target===a._node&&(a.show(),k.stop(e))},!1);else if(this._trigger==="mouseover"){this._showDelay=h.showDelay===void 0?500:h.showDelay;h=["mouseout","click"];this._node.addEventListener("mouseover",this._mouseoverHandler=function(e){k.contains(a._node,e.target)&&(a.show(),k.stop(e))},!1);this._leaveHandler=function(e){k.contains(a._node,e.target)&&a.hide()};for(var g=0;g<h.length;g++)this._node.addEventListener(h[g],
this._leaveHandler,!1)}},_makeTipNode:function(){if(!this._tip){this._tip=document.createElement("span");this._tip.classList.add("tooltipContainer");this._tipInner=document.createElement("div");this._tipInner.classList.add("tooltip");if(this._text)this._tipTextContent=document.createElement("div"),this._tipTextContent.classList.add("textContent"),this._tipInner.appendChild(this._tipTextContent),this._tipTextContent.appendChild(document.createTextNode(this._text));this._tip.appendChild(this._tipInner);
document.body.appendChild(this._tip);var h=this;k.addAutoDismiss([this._tip,this._node],function(){h.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(h._timeout)window.clearTimeout(h._timeout),h._timeout=null;h._tip.addEventListener("mouseout",function(a){k.contains(h._tip,a.target)&&(h.hide(),k.stop(a))},
!1)},!1)}return this._tip},_positionTip:function(h,a){this._makeTipNode();h==="left"?this._tipInner.classList.add("left"):this._tipInner.classList.remove("left");var g=this._node,e;for(e=k.bounds(g);g&&!e.width&&!e.height;g=g.parentNode)e=k.bounds(g);var g=k.bounds(this._tipInner),f;switch(h){case "above":f=e.top-g.height-this._tailSize-1;e=e.left-this._tailSize;break;case "below":f=e.top+e.height+this._tailSize+1;e=e.left-this._tailSize;break;case "left":f=e.top-this._tailSize/2;e=e.left-g.width-
this._tailSize-1;break;default:f=e.top-this._tailSize/2,e=e.left+e.width+this._tailSize+1}var d=k.bounds(document.documentElement);if(f+g.height>d.height)if(a)f=d.height-g.height-1;else return!1;if(e+g.width>d.width)if(a)e=d.width-g.width-1;else return!1;if(e<0)if(a)e=4;else return!1;if(f<0)if(a)f=4;else return!1;if(this._tail&&this._tail.previousPosition!==h)this._tip.removeChild(this._tail),this._tail=null;if(!this._tail){this._tail=document.createElement("span");this._tail.classList.add("tooltipTailFrom"+
h);h==="above"||h==="left"?this._tip.appendChild(this._tail):this._tip.insertBefore(this._tail,this._tipInner);if(h==="left")this._tail.style.left=g.width+"px";this._tail.previousPosition=h}this._tip.style.top=f+"px";this._tip.style.left=e+"px";return!0},contentContainer:function(){this._makeTipNode();return this._tipInner},show:function(){if(!this._tip||!this._tip.classList.contains("tooltipShowing")){if(this._timeout)window.clearTimeout(this._timeout),this._timeout=null;this._showDelay?this._timeout=
window.setTimeout(this._showImmediately.bind(this),this._showDelay):this._showImmediately()}},_showImmediately:function(){for(var h=!1,a=0;!h&&a<this._position.length;)h=this._positionTip(this._position[a]),a++;h||this._positionTip(this._position[0],!0);this._tip.classList.add("tooltipShowing");this._afterShowing&&this._afterShowing()},hide:function(h){if(this._timeout)window.clearTimeout(this._timeout),this._timeout=null;if(this._tip&&this._tip.classList.contains("tooltipShowing")){if(h===void 0)h=
this._hideDelay;var a=this;this._timeout=window.setTimeout(function(){a._tip.classList.remove("tooltipShowing");a._tip.removeAttribute("style");a._afterHiding&&a._afterHiding()},h)}},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 h=["mouseout","click"],a=0;a<h.length;a++)this._node.removeEventListener(h[a],this._leaveHandler,!1)}}};j.prototype.constructor=j;return{Tooltip:j}});
define("orion/commands","orion/util,orion/webui/littlelib,orion/webui/dropdown,text!orion/webui/dropdowntriggerbutton.html,text!orion/webui/dropdowntriggerbuttonwitharrow.html,text!orion/webui/submenutriggerbutton.html,text!orion/webui/checkedmenuitem.html,orion/webui/tooltip".split(","),function(i,k,j,h,a,g,e,f){function d(b){var c=b.invocation;if(c){var d=b.command;if(d.hrefCallback)return b=d.hrefCallback.call(c.handler||window,c),b.then?b.then(function(b){window.open(b)}):window.open(b),!0;else if(c.commandRegistry)return c.commandRegistry._invoke(c),
!0;else if(d.onClick||d.callback)return window.setTimeout(function(){(d.onClick||d.callback).call(c.handler||window,c)},0),!0}return!1}function c(b,c){for(var a in c)if(c[a]&&c[a].keyBinding&&c[a].command&&c[a].keyBinding.match(b)){var e=c[a],f=e.keyBinding;if((!f.domScope||k.contains(k.node(f.domScope),b.target))&&d(e)){k.stop(b);break}}}function b(){var b={};if(r){var c,d,a;d=Object.keys(u);for(c=0;c<d.length;c++)a=d[c],b[a]=u[a];var e=r();d=Object.keys(e);for(c=0;c<d.length;c++)a=d[c],b[a]=e[a]}else b=
u;return b}function l(d){c(d,b())}function m(b,c){b=b||window.event;if(function(b){if(i.isMac){if(b.metaKey&&!b.altKey)return!b.shiftKey&&!b.ctrlKey&&(b.keyCode===65||b.keyCode===67||b.keyCode===86||b.keyCode===88||b.keyCode===90)?!0:!1;if(b.ctrlKey)return!1}else{if(b.ctrlKey&&!b.altKey)return!b.shiftKey&&(b.keyCode===65||b.keyCode===67||b.keyCode===86||b.keyCode===88||b.keyCode===90)?!0:!1;if(b.altKey&&!b.ctrlKey)return!1}if(b["char"])return b["char"].length>0;else if(b.charCode||b.keyCode)switch(b=
b.charCode||b.keyCode,b){case 8:case 9:case 13:case 46:return!0;default:return b>=32&&b<112||b>123}return!1}(b)){if(b.target.contentEditable==="true")return;var d=b.target.nodeName.toLowerCase();if(d==="input")switch(b.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(d==="textarea")return}c?c(b):l(b)}function s(){this._init()}
function o(b,c,d){c.classList.add("commandImage");var a;b.imageClass?b.addImageClassToElement?c.classList.add(b.imageClass):(a=document.createElement("span"),c.appendChild(a),a.classList.add(b.spriteClass),a.classList.add(b.imageClass)):(a=new Image,a.alt=b.name,a.name=d,a.id=d,a.src=b.image,c.appendChild(a));return a}function q(b,c){var a=document.createElement("span");a.classList.add("dropdownKeyBinding");a.appendChild(document.createTextNode(c));b.appendChild(a)}function p(b,c,a,d,e){this.commandRegistry=
e;this.handler=b;this.items=c;this.userData=a;this.command=d;if(d.parameters)this.parameters=d.parameters.makeCopy();this.id=d.id}function t(b){this._init(b)}var r=null,u={};s.prototype={setProxy:function(b){this.proxy=b},setKeyBindings:function(b){this.bindings=b},_init:function(){var b=this;document.addEventListener("keydown",function(c){return m(c,function(c){var n=b.proxy,a=b.bindings;if(a&&n)for(var d=0;d<a.length;d++)a[d].match(c)&&(n.processKey({type:c.type,keyCode:c.keyCode,altKey:c.altKey,
ctrlKey:c.ctrlKey,metaKey:c.metaKey,shiftKey:c.shiftKey}),k.stop(c))})})}};window.document.addEventListener("keydown",m,!1);p.prototype={collectsParameters:function(){return this.commandRegistry&&this.commandRegistry.collectsParameters()},makeCopy:function(b){var c=new p(this.handler,this.items,this.userData,this.command,this.commandRegistry);c.domNode=this.domNode;c.domParent=this.domParent;if(b)c.parameters=b.makeCopy();else if(this.parameters)c.parameters=this.parameters.makeCopy();return c}};
p.prototype.constructor=p;t.prototype={_init:function(b){this.id=b.id;this.name=b.name;this.tooltip=b.tooltip;this.callback=b.callback;this.hrefCallback=b.hrefCallback;this.choiceCallback=b.choiceCallback;this.positioningNode=b.positioningNode;this.image=b.image||"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC";this.imageClass=b.imageClass;this.addImageClassToElement=b.addImageClassToElement;this.selectionClass=
b.selectionClass;this.spriteClass=b.spriteClass||"commandSprite";this.visibleWhen=b.visibleWhen;this.parameters=b.parameters;this.isEditor=b.isEditor},populateChoicesMenu:function(b,c,a,d,e){var a=this.getChoices(c,a,d),f=a.some(function(b){return b.checked});a.forEach(function(a){if(a.name){var d=document.createElement("li");b.appendChild(d);var l=document.createElement("span");l.tabIndex=0;l.role="menuitem";l.classList.add("dropdownMenuItem");if(f){var g=document.createElement("span");g.classList.add("check");
g.appendChild(document.createTextNode(a.checked?"\u25cf":""));l.appendChild(g)}g=document.createTextNode(a.name);l.appendChild(g);d.appendChild(l);l.choice=a;l.addEventListener("click",function(b){b.target.choice&&b.target.choice.callback.call(b.target.choice,c)},!1);l.addEventListener("keydown",function(b){(b.keyCode===k.KEY.ENTER||b.keyCode===k.KEY.SPACE)&&b.target.choice&&b.target.choice.callback.call(b.target.choice,c)},!1)}else e._generateMenuSeparator(b)})},getChoices:function(b,c,a){return this.choiceCallback?
this.choiceCallback.call(c,b,a):null},makeChoiceCallback:function(b,c){return function(a){b.callback&&b.callback.call(b,c,a)}},hasImage:function(){return this.imageClass||this.image!=="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC"}};t.prototype.constructor=t;return{Command:t,CommandInvocation:p,createDropdownMenu:function(b,c,d,e,f,l,g,m,p){b=k.node(b);if(!b)throw"no parent node was specified";
var q=document.createRange();q.selectNode(b);q=p?q.createContextualFragment(a):q.createContextualFragment(h);k.processTextNodes(q,{ButtonText:c});b.appendChild(q);var b=b.lastChild,s;p?(p=b.previousSibling,s=p.lastChild):p=b.previousSibling;e?p.classList.add(e):(p.classList.add("orionButton"),p.classList.add("commandButton"));if(f){if(!l)p.textContent="",p.setAttribute("aria-label",c);o({spriteClass:"commandSprite",imageClass:f},p,c);p.classList.add("orionButton")}p.dropdown=new j.Dropdown({dropdown:b,
populate:d,selectionClass:g,skipTriggerEventListeners:!!s,positioningNode:m});b.dropdown=p.dropdown;return{menuButton:p,menu:b,dropdown:p.dropdown,dropdownArrow:s}},createCheckedMenuItem:function(b,c,a,d){b=k.node(b);if(!b)throw"no parent node was specified";var f=document.createRange();f.selectNode(b);f=f.createContextualFragment(e);k.processTextNodes(f,{ItemText:c});b.appendChild(f);b=k.$(".checkedMenuItem",b.lastChild);b.checked=a;b.addEventListener("change",d,!1);return b},createCommandItem:function(b,
c,a,d,e,l,g){var h,l=l||!c.name&&c.hasImage();if(c.hrefCallback)h=document.createElement("a"),h.id=d,l&&c.hasImage()?o(c,h,d):(h.className="commandLink",h.appendChild(document.createTextNode(c.name))),g=c.hrefCallback.call(a.handler,a),g.then?g.then(function(b){h.href=b}):h.href=g?g:"#";else{h=document.createElement("button");h.className="orionButton";l?c.hasImage()?(o(c,h,d),c.name&&h.setAttribute("aria-label",c.name)):(h.classList.add("commandButton"),h.classList.add("commandMissingImageButton"),
h.appendChild(document.createTextNode(c.name))):(h.classList.add("commandButton"),d=document.createTextNode(c.name),h.appendChild(d));var m=g||c.callback;if(m)c.onClick=m,h.addEventListener("click",function(){m.call(a.handler,a)},!1)}b.nodeName.toLowerCase()==="ul"?(g=document.createElement("li"),b.appendChild(g),b=g):h.classList.add("commandMargins");b.appendChild(h);if(c.tooltip)h.commandTooltip=new f.Tooltip({node:h,text:c.tooltip,position:["above","below","right","left"]});e&&(u[c.id]={keyBinding:e,
command:c,invocation:a});return h},createCommandMenuItem:function(b,c,a,d,e,l){var g,h=b.dropdown;if(c.hrefCallback){g=document.createElement("a");var m=document.createElement("span");m.appendChild(document.createTextNode(c.name));m.classList.add("dropdownCommandName");g.appendChild(m);e=c.hrefCallback.call(a.handler,a);e.then?e.then(function(b){g.href=b}):g.href=e?e:"#";g.addEventListener("keydown",function(b){(b.keyCode===k.KEY.ENTER||b.keyCode===k.KEY.SPACE)&&g.click()},!1)}else{g=document.createElement("span");
g.tabIndex=0;m=document.createElement("span");m.appendChild(document.createTextNode(c.name));m.classList.add("dropdownCommandName");g.appendChild(m);var o=e||c.callback;if(o)c.onClick=o,g.addEventListener("click",function(){h.close(!0);o.call(a.handler,a)},!1),g.addEventListener("keydown",function(b){if(b.keyCode===k.KEY.ENTER||b.keyCode===k.KEY.SPACE)b.preventDefault(),g.click()},!1)}g.className="dropdownMenuItem";g.role="menuitem";if(c.tooltip)g.commandTooltip=new f.Tooltip({node:g,text:c.tooltip,
position:["above","below","right","left"]});l&&q(g,l);l=document.createElement("li");b.appendChild(l);l.appendChild(g);d&&(u[c.id]={keyBinding:d,command:c,invocation:a});return g},executeBinding:d,setKeyBindingProvider:function(b){r=b},localKeyBindings:u,CommandsProxy:s,getKeyBindings:b,processKey:l,NO_IMAGE:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC",_testMethodProcessKey:c}});
define("orion/explorers/navigationUtils",[],function(){function i(j,h){if(!k&&j)j.push({domNode:h}),h.tabIndex=-1,h.style.outline="none"}var k=navigator.userAgent.indexOf("iPad")!==-1;return{addNavGrid:function(j,h,a){j&&(j=j.getGridNavHolder(h,!0))&&i(j,a)},generateNavGrid:i,removeNavGrid:function(j,h){if(j)for(var a=0;a<j.length;a++)if(j[a].domNode===h){j.splice(a,1);break}}}});
define("orion/PageUtil",[],function(){var i=/^http[s]?/i;return{hash:function(){var i=window.location.href.split("#")[1];return i?"#"+i:""},matchResourceParameters:function(i){var i=i||window.location.toString(),j={resource:""},h=i.indexOf("#");if(h!==-1&&(i=i.substring(h+1),i.length!==0)){i=i.split(",");j.resource=decodeURIComponent(i[0]);for(h=1;h<i.length;h++){var a=/([^=]*)(=?)(.*)/.exec(i[h]),g=decodeURIComponent(a[1]||""),a=decodeURIComponent(a[3]||"");g!==""&&g!=="resource"&&(j[g]=a)}}return j},
validateURLScheme:function(k,j){var h=k;if(k.indexOf("://")===-1){var a=document.createElement("a");a.href=k;h=a.href}a=!1;return(a=j?j.some(function(a){return RegExp("^"+a+":","i").test(h)}):i.test(h))?k:(console.log("Illegal URL Scheme: '"+k+"'"),"")}}});
define("orion/uiUtils",["orion/webui/littlelib"],function(i){function k(h){var a="",g=navigator.platform.indexOf("Mac")!==-1;g?(h.mod4&&(a+="\u2303"),h.mod3&&(a+="\u2325"),h.mod2&&(a+="\u21e7"),h.mod1&&(a+="\u2318")):(h.mod1&&(a+="Ctrl+"),h.mod2&&(a+="Shift+"),h.mod3&&(a+="Alt+"));if(h.alphaKey)return a+h.alphaKey;if(h.type==="keypress")return a+h.keyCode;for(var e in i.KEY)if(typeof(i.KEY[e]==="number")&&i.KEY[e]===h.keyCode){if(g)switch(i.KEY[e]){case i.KEY.BKSPC:e="\u232b";break;case i.KEY.TAB:e=
"\u21e5";break;case i.KEY.ENTER:e="\u23ce";break;case i.KEY.ESCAPE:e="\u238b";break;case i.KEY.SPACE:e="\u2423";break;case i.KEY.PAGEUP:e="\u21de";break;case i.KEY.PAGEDOWN:e="\u21df";break;case i.KEY.END:e="\u21f2";break;case i.KEY.HOME:e="\u21f1";break;case i.KEY.DEL:e="\u2326"}switch(i.KEY[e]){case i.KEY.DOWN:e="\u2193";break;case i.KEY.UP:e="\u2191";break;case i.KEY.RIGHT:e="\u2192";break;case i.KEY.LEFT:e="\u2190"}return a+e}var f;switch(h.keyCode){case 59:f=h.mod2?":":";";break;case 61:f=h.mod2?
"+":"=";break;case 188:f=h.mod2?"<":",";break;case 190:f=h.mod2?">":".";break;case 191:f=h.mod2?"?":"/";break;case 192:f=h.mod2?"~":"`";break;case 219:f=h.mod2?"{":"[";break;case 220:f=h.mod2?"|":"\\";break;case 221:f=h.mod2?"}":"]";break;case 222:f=h.mod2?'"':"'"}return f?a+f:h.keyCode>=112&&h.keyCode<=123?a+"F"+(h.keyCode-111):a+String.fromCharCode(h.keyCode)}function j(h){var a=window.navigator.platform.indexOf("Mac")!==-1;return a&&h.metaKey||!a&&h.ctrlKey}return{getUserKeyString:function(h){for(var a=
"",h=h.getKeys(),g=0;g<h.length;g++)g!==0&&(a+=" "),a+=k(h[g]);return a},getUserText:function(h){var a=h.id,g=h.refNode,e=h.hideRefNode,f=h.initialText,d=h.onComplete,c=h.onEditDestroy,b=h.selectTo,l=h.isInitialValid,h=h.insertAsChild,m=!1,s=function(b){return function(h){if(!m){var o=i.node(a),s=o.value;if(o)if(b&&h.keyCode===i.KEY.ESCAPE){if(e)g.style.display="inline";m=!0;o.parentNode.removeChild(o);c&&c()}else if(!(b&&h.keyCode!==i.KEY.ENTER)){if(s.length===0||!l&&s===f){if(e)g.style.display=
"inline"}else if(d(s),e&&g.parentNode)g.style.display="inline";m=!0;o.parentNode&&o.parentNode.removeChild(o);c&&c()}}}},o=document.createElement("input");o.id=a;o.value=f||"";h?g.appendChild(o):g.parentNode.insertBefore(o,g.nextSibling);o.classList.add("userEditBoxPrompt");if(e)g.style.display="none";o.addEventListener("keydown",s(!0),!1);o.addEventListener("blur",s(!1),!1);window.setTimeout(function(){o.focus();if(f){var c=i.node(a),d=b?f.indexOf(b):-1;if(d>0)if(c.createTextRange)c=c.createTextRange(),
c.collapse(!0),c.moveStart("character",0),c.moveEnd("character",d),c.select();else if(c.setSelectionRange)c.setSelectionRange(0,d);else{if(c.selectionStart!==void 0)c.selectionStart=0,c.selectionEnd=d}else c.select()}},0)},openInNewWindow:j,followLink:function(h,a){a&&j(a)?window.open(h):window.location=h},createButton:function(h,a){var g=document.createElement("button");g.className="orionButton commandButton commandMargins";g.addEventListener("click",function(e){a();i.stop(e)},!1);h&&g.appendChild(document.createTextNode(h));
return g},createDropdownButton:function(){},isFormElement:function(h){switch(h.tagName.toLowerCase()){case "button":case "fieldset":case "form":case "input":case "keygen":case "label":case "legend":case "meter":case "optgroup":case "output":case "progress":case "select":case "textarea":return!0}return!1}}});
define("orion/commandRegistry","orion/commands,orion/explorers/navigationUtils,orion/PageUtil,orion/uiUtils,orion/webui/littlelib,orion/webui/dropdown,orion/webui/tooltip,text!orion/webui/checkedmenuitem.html,text!orion/webui/dropdowntriggerbutton.html,text!orion/webui/submenutriggerbutton.html".split(","),function(i,k,j,h,a,g,e,f,d,c){function b(b){this._commandList={};this._contributionsByScopeId={};this._activeBindings={};this._urlBindings={};this._pendingBindings={};this._init(b);this._parameterCollector=
null}function l(b,c){this.token=b;this.parameterName=c}function m(b,c,a){this.event=b;this.handler=c;this.capture=a||!1}function s(b,c,a,d,e,f){this.name=b;this.type=c;this.label=a;this.value=d;this.lines=e||1;this.eventListeners=Array.isArray(f)?f:f?[f]:[]}function o(b,c,a){this._storeParameters(b);this._hasOptionalParameters=c&&c.hasOptionalParameters;this._options=c;this.optionsRequested=!1;this.getParameters=a;this.clientCollect=c&&c.clientCollect}b.prototype={_init:function(b){this._selectionService=
b.selection;var c=this;i.setKeyBindingProvider(function(){return c._activeBindings})},processURL:function(b){for(var c in this._urlBindings)if(this._urlBindings[c]&&this._urlBindings[c].urlBinding&&this._urlBindings[c].command){var a=this._urlBindings[c].urlBinding.match(b);if(a){var d=this._urlBindings[c],e=d.command,f=d.invocation;if(f&&f.parameters&&e.callback){f.parameters.setValue(a.parameterName,a.parameterValue);var n=this;window.setTimeout(function(){n._invoke(f)},0);break}}}},findCommand:function(b){return this._commandList[b]},
runCommand:function(b,c,a,d){c?(b=this._commandList[b])&&(b.visibleWhen?b.visibleWhen(c):1)&&b.callback&&this._invoke(new i.CommandInvocation(a,c,null,b,this),d):(c=this._urlBindings[b])&&c.command&&c.command.callback&&this._invoke(c.invocation,d)},getSelectionService:function(){return this._selectionService},setParameterCollector:function(b){this._parameterCollector=b},openParameterCollector:function(b,c,a){this._parameterCollector&&(this._parameterCollector.close(),this._parameterCollector.open(b,
c,a))},confirm:function(b,c,a,d,e,f){var n=!1;if(this._parameterCollector&&!e){var l=this;this._parameterCollector.close();if(this._parameterCollector.open(b,function(b,e){var f=document.createElement("span");f.classList.add("parameterPrompt");f.textContent=c;b.appendChild(f);f=document.createElement("button");f.addEventListener("click",function(){n=!0;l._parameterCollector.close()},!1);e.appendChild(f);f.appendChild(document.createTextNode(a));f.className="dismissButton";var g=document.createElement("button");
g.addEventListener("click",function(){n=!1;l._parameterCollector.close()},!1);e.appendChild(g);g.appendChild(document.createTextNode(d));g.className="dismissButton";return f},function(){f(n)}))return}n=window.confirm(c);f(n)},closeParameterCollector:function(){this._parameterCollector&&this._parameterCollector.close()},collectsParameters:function(){return this._parameterCollector},_invoke:function(b,c){return this._collectAndInvoke(b.makeCopy(c),!1)},_collectAndInvoke:function(b,c){if(b)if(this._parameterCollector&&
b.parameters&&b.parameters.hasParameters()&&(c||b.parameters.shouldCollectParameters())){var a=!1;b.parameters.updateParameters(b);if(b.parameters.shouldCollectParameters()&&(a=this._parameterCollector.collectParameters(b),!a)){var d=new e.Tooltip({node:b.domNode,afterHiding:function(){this.destroy()},trigger:"click",position:["below","right","above","left"]}),a=d.contentContainer();a.classList.add("parameterPopup");var f=window.document.activeElement,l=this._parameterCollector.getFillFunction(b,
function(){f&&f.focus();d.destroy()})(a);d.show();window.setTimeout(function(){l.focus();l.select()},0);a=!0}a||b.command.callback.call(b.handler||window,b)}else b.command.callback.call(b.handler||window,b);else window.console.log("Client attempted to invoke command without an available (rendered) command invocation")},collectParameters:function(b){this._collectAndInvoke(b,!0)},showKeyBindings:function(b){function c(b){return function(){i.executeBinding(b)}}var a={},d,e,f=[],n;for(n in this._activeBindings)(e=
this._activeBindings[n])&&e.keyBinding&&e.command&&(e.command.name||e.command.tooltip)&&f.push(e);f.sort(function(b,c){return(b.command.name||b.command.tooltip).localeCompare(c.command.name||c.command.tooltip)});for(n=0;n<f.length;n++)e=f[n],e.keyBinding.scopeName?(a[e.keyBinding.scopeName]||(a[e.keyBinding.scopeName]=[]),a[e.keyBinding.scopeName].push(e)):(d=h.getUserKeyString(e.keyBinding),b.createItem(d,e.command.name||e.command.tooltip,c(e)));for(var l in a)a[l].length&&a[l].length>0&&(b.createHeader(l),
a[l].forEach(function(a){d=h.getUserKeyString(a.keyBinding);b.createItem(d,a.command.name||a.command.tooltip,c(a))}))},addCommand:function(b){this._commandList[b.id]=b;var c=this._pendingBindings[b.id];if(c){var a=this;c.forEach(function(c){a._addBinding(b,c.type,c.binding,c.bindingOnly)});delete this._pendingBindings[b.id]}},addCommandGroup:function(b,c,a,d,e,f,n,l,g,h){this._contributionsByScopeId[b]||(this._contributionsByScopeId[b]={});b=this._contributionsByScopeId[b];e&&(b=this._createEntryForPath(b,
e));if(b[c]){if(d)b[c].title=d;if(a)b[c].position=a;if(n)b[c].imageClass=n;if(l)b[c].tooltip=l;if(g)b[c].selectionClass=g;h===!0?b[c].pretendDefaultActionId=!0:b[c].defaultActionId=h;b[c].emptyGroupMessage=f}else b[c]={title:d,position:a,emptyGroupMessage:f,imageClass:n,tooltip:l,selectionClass:g,defaultActionId:h===!0?null:h,pretendDefaultActionId:h===!0,children:{}},b.sortedContributions=null},_createEntryForPath:function(b,c){c&&c.split("/").forEach(function(c){if(c.length>1){if(!b[c])b[c]={position:0,
children:{}},b.sortedContributions=null;b=b[c].children}});return b},registerSelectionService:function(b,c){this._contributionsByScopeId[b]||(this._contributionsByScopeId[b]={});this._contributionsByScopeId[b].localSelectionService=c},registerCommandContribution:function(b,c,a,d,e,f,n){this._contributionsByScopeId[b]||(this._contributionsByScopeId[b]={});b=this._contributionsByScopeId[b];d&&(b=this._createEntryForPath(b,d));b[c]={position:a};f&&((a=this._commandList[c])?this._addBinding(a,"key",f,
e):this._addPendingBinding(c,"key",f,e));n&&((a=this._commandList[c])?this._addBinding(a,"url",n,e):this._addPendingBinding(c,"url",n,e));b.sortedContributions=null},unregisterCommandContribution:function(b,c,a){if(this._contributionsByScopeId[b]){delete this._commandList[c];delete this._activeBindings[c];delete this._urlBindings[c];delete this._pendingBindings[c];var d=this._contributionsByScopeId[b];a&&a.split("/").forEach(function(b){if(b.length>1&&d[b])d=d[b].children});delete d[c];d.sortedContributions=
null}},_addBinding:function(b,c,a,d){if(!b.id)throw Error("No command id: "+b);c==="key"?this._activeBindings[b.id]={command:b,keyBinding:a,bindingOnly:d}:c==="url"&&(this._urlBindings[b.id]={command:b,urlBinding:a,bindingOnly:d})},_addPendingBinding:function(b,c,a,d){this._pendingBindings[b]=this._pendingBindings[b]||[];this._pendingBindings[b].push({type:c,binding:a,bindingOnly:d})},_checkForTrailingSeparator:function(b,c,d){var e;if(c==="tool"||c==="button")if((e=b.childNodes.length>0?b.childNodes[b.childNodes.length-
1]:null)&&e.classList.contains("commandSeparator"))return d?(b.removeChild(e),!1):!0;if(c==="menu"&&(b=a.$$array("li > *",b),b.length>0&&b[b.length-1].classList.contains("dropdownSeparator")))if(e=b[b.length-1],d)e.parentNode.parentNode.removeChild(e.parentNode);else return!0;return!1},renderCommands:function(b,c,d,e,f,l,n){if(typeof b!=="string")throw"a scope id for rendering must be specified";c=a.node(c);if(!c)throw"no parent";var g=this._contributionsByScopeId[b];if(!d&&g){var d=g.localSelectionService||
this._selectionService,h=this;d&&d.getSelections(function(a){h.renderCommands(b,c,a,e,f,l)})}else g&&(this._render(g,c,d,e,f||"button",l,n),this._checkForTrailingSeparator(c,f,!0))},destroy:function(b){b=a.node(b);if(!b)throw"no parent";for(;b.hasChildNodes();){var c=b.firstChild;c.commandTooltip&&c.commandTooltip.destroy();c.emptyGroupTooltip&&c.emptyGroupTooltip.destroy();this.destroy(c);b.removeChild(c)}},_render:function(b,c,a,d,f,l,n){var g=b.sortedContributions;if(!g){var g=[],m=!1,y;for(y in b)if(Object.prototype.hasOwnProperty.call(b,
y)){var o=b[y];if(o&&typeof o.position==="number")o.id=y,g.push(o),m=!0}if(m)g.sort(function(b,c){return b.position-c.position}),b.sortedContributions=g}var s=0,j=this;g.forEach(function(b){var g;if(!b.imageClass)b.imageClass=null;if(b.children&&Object.getOwnPropertyNames(b.children).length>0){var w=b.children;if(f==="tool"||f==="button")if(b.title){var m;if(b.defaultActionId)(w=j._commandList[b.defaultActionId])&&(w.visibleWhen?w.visibleWhen(a):1)?(m=new i.CommandInvocation(d,a,l,w,j),m.domParent=
c):b.pretendDefaultActionId=!0;w=j._createDropdownMenu(c,b.title,null,null,b.imageClass,b.tooltip,b.selectionClass,null,m,b.pretendDefaultActionId);n&&k.generateNavGrid(n,w.menuButton);if(w)if(j._render(b.children,w.menu,a,d,"menu",l,n),j._checkForTrailingSeparator(w.menu,"menu",!0),w.menu.childNodes.length===0)if(b.emptyGroupMessage){if(!w.menuButton.emptyGroupTooltip)w.menuButton.emptyGroupTooltip=new e.Tooltip({node:w.menuButton,text:b.emptyGroupMessage,trigger:"click",position:["below","right",
"above","left"]})}else n&&k.removeNavGrid(n,w.menuButton),b=function(b){b&&b.parentNode&&b.parentNode.removeChild(b)},b(w.menu),b(w.menuButton),b(w.destroyButton);else w.menuButton.style.visibility="visible"}else{var y;c.childNodes.length>0&&!j._checkForTrailingSeparator(c,f)&&(y=j.generateSeparatorImage(c));j._render(w,c,a,d,f,l,n);c.childNodes.length>0&&c.childNodes[c.childNodes.length-1]!==y&&(y=j.generateSeparatorImage(c))}else if(b.title){if(b=j._createDropdownMenu(c,b.title,!0,null,null,b.imageClass))j._render(w,
b.menu,a,d,"menu",l,n),j._checkForTrailingSeparator(b.menu,"menu",!0),b.menu.childNodes.length===0&&b.destroyButton&&c.removeChild(b.destroyButton)}else c.childNodes.length>0&&j._generateMenuSeparator(c),j._render(w,c,a,d,f,l,n),j._generateMenuSeparator(c)}else{var x=j._commandList[b.id],w=x?!0:!1;m=b=null;if(x){g=new i.CommandInvocation(d,a,l,x,j);g.domParent=c;y=w&&(x.visibleWhen?x.visibleWhen(a):!0);if(j._activeBindings[x.id]&&j._activeBindings[x.id].keyBinding)b=j._activeBindings[x.id],b.invocation=
y?g:null,b.bindingOnly&&(w=!1);if(j._urlBindings[x.id]&&j._urlBindings[x.id].urlBinding)m=j._urlBindings[x.id],m.invocation=y?g:null,m.bindingOnly&&(w=!1);w=w&&y}if(w)x.choiceCallback?(f==="tool"||f==="button"?(b=c,w=!1,c.nodeName.toLowerCase()==="ul"&&(b=document.createElement("li"),c.appendChild(b))):(b=c,w=!0),j._createDropdownMenu(b,x.name,w,function(b){x.populateChoicesMenu(b,a,d,l,j)}.bind(x),x.imageClass,x.tooltip||x.title,x.selectionClass,x.positioningNode)):(g.handler=g.handler||this,g.domParent=
c,w=function(){j._invoke(g)},f==="menu"?(m=null,b&&b.keyBinding&&(m=h.getUserKeyString(b.keyBinding)),b=i.createCommandMenuItem(c,x,g,null,w,m)):(b=f+x.id+s,b=i.createCommandItem(c,x,g,b,null,f==="tool",w)),k.generateNavGrid(n,b),g.domNode=b,s++)}})},_createDropdownMenu:function(b,d,f,l,h,m,n,w,x,y){b=a.node(b);if(!b||!a.contains(document.body,b))return null;var o,s,j=b;if(f)m=document.createRange(),m.selectNode(b),m=m.createContextualFragment(c),a.processTextNodes(m,{ButtonText:d}),b.appendChild(m),
s=b.lastChild,h=s.lastChild,d=h.previousSibling,d.dropdown=new g.Dropdown({dropdown:h,populate:l,parentDropdown:b.dropdown}),h.dropdown=d.dropdown;else{b.nodeName.toLowerCase()==="ul"&&(j=document.createElement("li"),b.appendChild(j),s=j);b=null;h&&(b="dropdownButtonWithIcon",m=m||d);var m=h?m||d:m,k=i.createDropdownMenu(j,d,l,b,h,!1,n,w,x||y);o=k.dropdownArrow;d=k.menuButton;if(o){if(x)x.domNode=k.menuButton;var z=this;d.onclick=function(b){var c=a.bounds(o);b.clientX>=c.left&&k.dropdown?k.dropdown.toggle(b):
z._invoke(x)};if(k.dropdown)d.onkeydown=function(b){a.KEY.DOWN===b.keyCode&&(k.dropdown.toggle(b),a.stop(b))}}var h=k.menu,J;(l=x&&x.command&&(x.command.tooltip||x.command.name))?J=x.command.tooltip||x.command.name:l&&(J=m);if(J)d.commandTooltip=new e.Tooltip({node:d,text:J,position:["above","below","right","left"]})}return{menuButton:d,menu:h,dropdown:d.dropdown,destroyButton:s,dropdownArrow:o}},_generateMenuSeparator:function(b){if(!this._checkForTrailingSeparator(b,"menu")){var c=document.createElement("li");
c.classList.add("dropdownSeparator");var a=document.createElement("span");a.classList.add("dropdownSeparator");c.appendChild(a);b.appendChild(c)}},generateSeparatorImage:function(b){var c;c=b.nodeName.toLowerCase()==="ul"?document.createElement("li"):document.createElement("span");b.appendChild(c);c.classList.add("core-sprite-sep");c.classList.add("imageSprite");c.classList.add("commandSeparator");return c}};b.prototype.constructor=b;l.prototype={match:function(b){b=j.matchResourceParameters(b);return typeof b[this.token]!==
"undefined"?(this.parameterValue=b[this.token],this):null}};l.prototype.constructor=l;m.prototype.constructor=m;s.prototype={optionsRequested:function(){return this.optionsRequested}};s.prototype.constructor=s;o.prototype={_storeParameters:function(b){this.parameterTable=null;if(b){var c=this.parameterTable={};b.forEach(function(b){c[b.name]=b})}},updateParameters:function(b){typeof this.getParameters==="function"&&this._storeParameters(this.getParameters(b))},hasParameters:function(){return this.parameterTable!==
null},shouldCollectParameters:function(){return!this.clientCollect&&this.hasParameters()},parameterNamed:function(b){return this.parameterTable[b]},valueFor:function(b){return(b=this.parameterTable[b])?b.value:null},setValue:function(b,c){var a=this.parameterTable[b];if(a)a.value=c},forEach:function(b){for(var c in this.parameterTable)this.parameterTable[c].type&&this.parameterTable[c].name&&b(this.parameterTable[c])},makeCopy:function(){var b=[];this.forEach(function(c){c=new s(c.name,c.type,c.label,
c.value,c.lines,c.eventListeners);b.push(c)});var c=new o(b,this._options,this.getParameters);c.clientCollect=this.clientCollect;return c},hasOptionalParameters:function(){return this._hasOptionalParameters}};o.prototype.constructor=o;return{CommandRegistry:b,URLBinding:l,ParametersDescription:o,CommandParameter:s,CommandEventListener:m}});
define("orion/parameterCollectors",["i18n!orion/nls/messages","require","orion/webui/littlelib"],function(i,k,j){function h(a,g){this._activeContainer=null;this._getElementsFunction=a;this._toolbarLayoutFunction=g}h.prototype={close:function(){if(this._activeElements){this._activeElements.parameterArea&&j.empty(this._activeElements.parameterArea);this._activeElements.slideContainer&&this._activeElements.slideContainer.classList.remove("slideContainerActive");this._activeElements.dismissArea&&j.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(a,g,e){typeof a==="string"&&(a=j.node(a));if(this._activeElements&&this._activeElements.slideContainer&&this._activeElements.commandNode===a)return this._activeElements.focusNode&&
this._activeElements.focusNode.focus(),!0;this.close();this._activeElements=null;if((this._activeElements=this._getElementsFunction(a))&&this._activeElements.parameterArea&&this._activeElements.slideContainer){this._activeElements.onClose=e;var f=g(this._activeElements.parameterArea,this._activeElements.dismissArea);if(!f)return!1;this._activeElements.focusNode=f;a=j.$$array("#closebox",this._activeElements.dismissArea||this._activeElements.parameterArea);if(a.length===0){g=this._activeElements.dismissArea||
this._activeElements.parameterArea;a=document.createElement("button");a.id="closebox";a.className="imageSprite core-sprite-close dismissButton";a.title=i.Close;g.appendChild(a);var d=this;a.addEventListener("click",function(){d.close()},!1)}this._activeElements.slideContainer.classList.add("slideContainerActive");this._toolbarLayoutFunction(this._activeElements);if(f)this._oldFocusNode=window.document.activeElement,window.setTimeout(function(){f.focus();f.select&&f.select()},0);this._activeElements.commandNode&&
this._activeElements.commandNode.classList.add("activeCommand");return!0}return!1},_collectAndCall:function(a,g){j.$$array("input",g).forEach(function(e){e.type==="checkbox"?a.parameters.setValue(e.parameterName,e.checked):e.type!=="button"&&a.parameters.setValue(e.parameterName,e.value.trim())});j.$$array("textArea",g).forEach(function(e){a.parameters.setValue(e.parameterName,e.value.trim())});a.command.callback&&a.command.callback.call(a.handler,a)},collectParameters:function(a){return a.parameters?
(a.domNode&&a.domNode.classList.add("commandMarker"),this.open(a.domNode||a.domParent,this.getFillFunction(a))):!1},getFillFunction:function(a,g){var e=this;return function(f,d){var c=null,b=function(){g&&g();e.close()},l=function(c){c.keyCode===j.KEY.ENTER&&e._collectAndCall(a,f);if(c.keyCode===j.KEY.ESCAPE||c.keyCode===j.KEY.ENTER)b(),j.stop(c)};a.parameters.forEach(function(d){var e=null;if(d.label)e=document.createElement("label"),e.classList.add("parameterInput"),e.setAttribute("for",d.name+
"parameterCollector"),e.textContent=d.label,f.appendChild(e);var g=d.name+"parameterCollector",h,e=e||f;if(d.type==="text"&&typeof d.lines==="number"&&d.lines>1)h=document.createElement("textarea"),h.rows=d.lines,h.type="textarea",h.id=g,e.appendChild(h),l=function(c){c.keyCode===j.KEY.ESCAPE&&(b(),j.stop(c))};else if(d.type==="boolean"){if(h=document.createElement("input"),h.type="checkbox",h.id=g,e.appendChild(h),d.value)h.checked=!0}else if(h=document.createElement("input"),h.type=d.type,h.id=
g,e.appendChild(h),d.value)h.value=d.value;h.classList.add("parameterInput");h.setAttribute("speech","speech");h.setAttribute("x-webkit-speech","x-webkit-speech");h.parameterName=d.name;c||(c=h);d.eventListeners.length>0&&d.eventListeners.forEach(function(b){h.addEventListener(b.event,function(c){return b.handler(c,a)},b.capture)});h.addEventListener("keydown",l,!1)});var h=d;h||(h=document.createElement("span"),h.classList.add("layoutRight"),h.classList.add("parametersDismiss"),f.appendChild(h));
var s=function(b,c){var d=document.createElement("button");c.appendChild(d);b&&d.appendChild(document.createTextNode(b));d.classList.add("dismissButton");return d};if(a.parameters.hasOptionalParameters())a.parameters.optionsRequested=!1,s(i.More,h).addEventListener("click",function(){a.parameters.optionsRequested=!0;e._collectAndCall(a,f);b()},!1);s(i.Submit,h).addEventListener("click",function(){e._collectAndCall(a,f);b()},!1);h=s(null,h);h.id="closebox";h.classList.add("imageSprite");h.classList.add("core-sprite-close");
h.title=i.Close;h.addEventListener("click",function(){b()},!1);return c}}};h.prototype.constructor=h;return{CommandParameterCollector:h}});define("orion/regex",[],function(){return{escape:function(i){return i.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$&")},parse:function(i){return(i=/^\s*\/(.+)\/([gim]{0,3})\s*$/.exec(i))?{pattern:i[1],flags:i[2]}:null}}});
define("orion/contentTypes",[],function(){function i(c,b){function d(b,c,a,e){var a=c.filename.indexOf(a)>=0,f;f=e.toLowerCase();f=c.extension.indexOf(f)!==-1;if(a||f){if(!(f=!b))a&&(e=e.toLowerCase(),a=b.extension.indexOf(e)!==-1),f=a;if(f)return c}return b}if(typeof c!=="string")return null;for(var a=c&&c.split(".").pop(),e=null,f=0;f<b.length;f++){var g=b[f];d(e,g,c,a)===g&&(e=g)}return e}function k(c){return c===null||typeof c==="undefined"?[]:Array.isArray(c)?c:[c]}function j(c){return k(c).map(function(b){return String.prototype.toLowerCase.call(b)})}
function h(c){return{id:c.id,name:c.name,image:c.image,imageClass:c.imageClass,"extends":c["extends"],extension:j(c.extension),filename:k(c.filename)}}function a(c){var b=Object.create(null);c.map(h).forEach(function(c){Object.prototype.hasOwnProperty.call(b,c.id)||(b[c.id]=c)});return b}function g(c){if(c&&c.registerService){this.serviceRegistry=c;for(var b=c.getServiceReferences(f).concat(c.getServiceReferences(d)),l=[],g=0;g<b.length;g++)for(var h=k(b[g].getProperty("contentTypes")),o=0;o<h.length;o++)l.push(h[o]);
this.map=a(l);c.registerService(e,this)}else if(Array.isArray(c))this.serviceRegistry=null,this.map=a(c);else throw Error("Invalid parameter");}var e="orion.core.contentTypeRegistry",f="orion.core.contenttype",d="orion.file.contenttype";g.prototype={getContentTypes:function(){var c=this.getContentTypesMap(),b=[],a;for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&b.push(c[a]);return b},getContentTypesMap:function(){return this.map},getFileContentType:function(c){return i(c.Name,this.getContentTypes())},
getFilenameContentType:function(c){return i(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 a=c,d={};a&&(a=this.getContentType(a["extends"]));){if(a.id===b.id)return!0;if(d[a.id])throw Error("Cycle: "+a.id);d[a.id]=!0}return!1},isSomeExtensionOf:function(c,b){for(var a=0;a<b.length;a++)if(this.isExtensionOf(c,
b[a]))return!0;return!1}};return{ContentTypeRegistry:g,getFilenameContentType:i}});
define("orion/URITemplate",[],function(){function i(b){this._text=b}function k(b){return b.replace("%25","%")}function j(b,a){if(a==="U")return encodeURIComponent(b).replace(/[!'()*]/g,function(b){return"%"+b.charCodeAt(0).toString(16).toUpperCase()});if(a==="U+R")return encodeURI(b).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(c,k);if(a==="U+R-,")return encodeURI(b).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/,/g,"%2C");throw Error("Unknown allowed character set: "+a);}function h(b,c,a){for(var d=
[],e=0;e<b.length;e++)typeof b[e]!=="undefined"&&d.push(j(b[e],c));return d.join(a)}function a(b,c,a,d){for(var e=Object.keys(b),f=[],g=0;g<e.length;g++)typeof b[e[g]]!=="undefined"&&f.push(j(e[g],c)+a+j(b[e[g]],c));return f.join(d)}function g(b){if(b.length===0)throw Error("Invalid Expression: 0 length expression");(this._operator=f[b[0]])?b=b.substring(1):this._operator=f.NUL;for(var c=[],a=b.split(","),e=0;e<a.length;e++){var g=a[e].match(d);if(g===null)throw Error("Bad VarSpec: "+b);c.push({name:g[1],
explode:!!g[2],prefix:g[3]?parseInt(g[3],10):-1})}this._varSpecList=c}function e(b){for(var c=[],a=0,d=b.indexOf("{",a);d!==-1;){c.push(new i(b.substring(a,d)));a=b.indexOf("}",d+1);if(a===-1)throw Error("Invalid template: "+b);c.push(new g(b.substring(d+1,a)));a+=1;d=b.indexOf("{",a)}c.push(new i(b.substring(a)));this._templateComponents=c}var f={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-,"}},d=/^((?:(?:[a-zA-Z0-9_])|(?:%[0-9A-F][0-9A-F]))(?:(?:[a-zA-Z0-9_.])|(?:%[0-9A-F][0-9A-F]))*)(?:(\*)|:([0-9]+))?$/,c=/%25[0-9A-F][0-9A-F]/g;i.prototype={expand:function(){return encodeURI(this._text)}};
g.prototype={expand:function(b){for(var c=[],d=0;d<this._varSpecList.length;d++){var e=this._varSpecList[d],f=e.name,g=b[f],p=typeof g;if(p!=="undefined"&&g!==null){var i=c.length===0?this._operator.first:this._operator.sep;if(p==="string")this._operator.named&&(i+=j(f,"U+R"),i+=g.length===0?this._operator.ifemp:"="),e.prefix!==-1&&e.prefix<g.length&&(g=g.substring(0,e.prefix)),i+=j(g,this._operator.allow);else if(Array.isArray(g)){if(g.length===0)continue;e.explode?i+=h(g,this._operator.allow,this._operator.sep):
(e=h(g,this._operator.allow,","),this._operator.named&&(i+=j(f,"U+R"),i+=e.length===0?this._operator.ifemp:"="),i+=e)}else if(p==="object"){if(Object.keys(g).length===0)continue;e.explode?i+=a(g,this._operator.allow,"=",this._operator.sep):(e=a(g,this._operator.allow,",",","),this._operator.named&&(i+=j(f,"U+R"),i+=e.length===0?this._operator.ifemp:"="),i+=e)}else throw Error("bad param type: "+f+" : "+p);c.push(i)}}return c.join("")}};e.prototype={expand:function(b){for(var c=[],a=0;a<this._templateComponents.length;a++)c.push(this._templateComponents[a].expand(b));
return c.join("")}};return e});
define("orion/i18nUtil",["require","orion/Deferred"],function(i,k){function j(a){if(a=localStorage.getItem("orion/messageBundle/"+a))if(a=JSON.parse(a),a._expires&&a._expires>(new Date).getTime())return delete a._expires,a;return null}var h={};return{getMessageBundle:function(a){function g(b){b?i(["i18n!"+a],function(b){if(b){var c=a;b._expires=(new Date).getTime()+9E5;localStorage.setItem("orion/messageBundle/"+c,JSON.stringify(b));delete b._expires}f.resolve(b)}):e(Error(a))}function e(b){f.reject(b)}
if(h[a])return h[a];var f=new k;h[a]=f;var d=j(a);if(d)return f.resolve(d),f;try{i([a],g,e)}catch(c){i(["orion/i18n!"+a],g,e)}return f},formatMessage:function(a){var g=arguments;return a.replace(/\$\{([^\}]+)\}/g,function(a,f){return g[(f<<0)+1]})}}});
define("orion/PageLinks","require,orion/Deferred,orion/PageUtil,orion/URITemplate,orion/i18nUtil,orion/objects,orion/URL-shim".split(","),function(i,k,j,h,a,g){function e(){return i.toUrl?(new URL(i.toUrl("orion/../"),window.location.href)).href.slice(0,-1):(new URL("/",window.location.href)).href.slice(0,-1)}function f(b){var c={};b.getPropertyKeys().forEach(function(a){a!=="objectClass"&&a!=="service.names"&&a!=="service.id"&&a!=="__plugin__"&&(c[a]=b.getProperty(a))});return c}function d(b){return a.getMessageBundle(b.nls).then(function(c){b.textContent=
b.nameKey?c[b.nameKey]:b.name;return b},function(){b.textContent=b.nameKey||b.name;return b})}function c(b,c){var a=b.getServiceReferences(c||"orion.page.link"),l=j.matchResourceParameters(window.location.href),g={OrionHome:e(),Location:l.resource},m=[];a.forEach(function(b){b=f(b);if(b.uriTemplate&&(b.nls||b.name)){var c=(new h(b.uriTemplate)).expand(g),c=j.validateURLScheme(c);b.href=c;b.nls?m.push(d(b)):(b.textContent=b.name,m.push((new k).resolve(b)))}});return k.all(m)}function b(b){var c=this.categories=
Object.create(null);b.forEach(function(b){c[b.id]=b})}function l(b){this.allPageLinks=b;this.allPageLinks.sort(m)}function m(b,c){var a=b.textContent&&b.textContent.toLowerCase(),d=c.textContent&&c.textContent.toLowerCase();return a<d?-1:a>d?1:0}var s;g.mixin(b.prototype,{getCategoryIDs:function(){return Object.keys(this.categories)},getCategory:function(b){return this.categories[b]||null}});g.mixin(l.prototype,{createLinkElements:function(){return this.allPageLinks.map(function(b){var c=b.href,b=
b.textContent,a=document.createElement("a");a.href=c;a.target="_self";a.classList.add("targetSelector");a.textContent=b;return a})},getAllLinks:function(){return this.allPageLinks}});return{getCategoriesInfo:function(c){var a;return!s?(a=[],c.getServiceReferences("orion.page.link.category").forEach(function(b){b=f(b);if(b.id&&(b.name||b.nameKey))b.nls?a.push(d(b)):(b.textContent=b.name,a.push((new k).resolve(b)))}),k.all(a).then(function(c){return s=new b(c)})):(new k).resolve(s)},getPageLinksInfo:function(b,
a){return c(b,a).then(function(b){return new l(b)})},getOrionHome:e}});
define("orion/edit/nls/root/messages",{Editor:"Editor",switchEditor:"Switch Editor",Fetching:"Fetching: ${0}",confirmUnsavedChanges:"There are unsaved changes.  Do you still want to navigate away?",searchFiles:"Search Files...",searchTerm:"Enter search term:",unsavedChanges:"There are unsaved changes.",unsavedAutoSaveChanges:"Please stay on the page until Auto Save is complete.",Save:"Save",Saved:"Saved",Blame:"Blame",BlameTooltip:"Show blame annotations",saveOutOfSync:"Resource is out of sync with the server. Do you want to save it anyway?",
loadOutOfSync:"Resource is out of sync with the server. Do you want to load it anyway? This will overwrite your local changes.",ReadingMetadata:"Reading metadata of ${0}",ReadingMetadataError:"Can not get metadata of ${0}",Reading:"Reading ${0}",readonly:"Read Only.",saveFile:"Save this file",gotoLine:"Go to Line...",gotoLineTooltip:"Go to specified line number",gotoLinePrompt:"Go to line:",Undo:"Undo",Redo:"Redo",Find:"Find...",noResponse:"No response from server.  Check your internet connection and try again.",
savingFile:"Saving file ${0}",running:"Running ${0}","Saving...":"Saving...",View:"View",SidePanel:"Side Panel",SidePanelTooltip:"Choose what to show in the side panel.",Actions:"Actions",Navigator:"Navigator",FolderNavigator:"Folder Navigator",Project:"Project",New:"New",File:"File",Edit:"Edit",Tools:"Tools",Add:"Add",noActions:"There are no actions for the current selection.",NoFile:"Use the ${0} to create new files and folders. Click a file to start coding.",LocalEditorSettings:"Local Editor Settings",
NoProject:"${0} is not a project. To convert it to a project use ${1}.",NoProjects:"There are no projects in your workspace. Use the ${0} menu to create projects.",disconnected:"(disconnected)",ChooseFS:"Choose Filesystem",ChooseFSTooltip:"Choose the filesystem you want to view.",FSTitle:"${0} (${1})",Deploy:"Deploy","Deploy As":"Deploy As",Import:"Import",Export:"Export",OpenWith:"Open With",OpenRelated:"Open Related",Dependency:"Dependency",UnnamedCommand:"Unnamed"});
define("orion/edit/nls/messages",["orion/i18n!orion/edit/nls/messages","orion/edit/nls/root/messages"],function(i,k){var j={root:k};Object.keys(i).forEach(function(h){typeof j[h]==="undefined"&&(j[h]=i[h])});return j});
define("orion/extensionCommands","require,orion/Deferred,orion/commands,orion/regex,orion/contentTypes,orion/URITemplate,orion/i18nUtil,orion/URL-shim,orion/PageLinks,i18n!orion/edit/nls/messages".split(","),function(i,k,j,h,a,g,e,f,d,c){function b(b){var c={};b.getPropertyKeys().forEach(function(a){c[a]=b.getProperty(a)});return c}var l={},m=d.getOrionHome();l._cloneItemWithoutChildren=function p(b){if(b===null||typeof b!=="object")return b;var c=b.constructor(),a;for(a in b)a!=="children"&&a!==
"Children"&&(c[a]=p(b[a]));return c};l._getOpenWithNavCommandExtensions=function(b){function c(b,a){for(var d=b.getServiceReferences("orion.navigate.openWith"),n=[],e=[],f=0;f<d.length;f++){var l=d[f];if(l.getProperty("editor")===a.id){var g=l.getProperty("contentType");g instanceof Array?n=n.concat(g):n.push(g||"*/*");l=l.getProperty("excludedContentTypes");l instanceof Array?e=e.concat(l):l!==null&&typeof l!=="undefined"&&e.push(l)}}0===n.length&&(n=null);0===e.length&&(e=null);return{contentTypes:n,
excludedContentTypes:e}}for(var a=function(){for(var c=b.getServiceReferences("orion.edit.editor"),a=[],d=0;d<c.length;d++){var n=c[d],e=n.getProperty("id");a.push({id:e,"default":n.getProperty("default")||!1,name:n.getProperty("name"),nameKey:n.getProperty("nameKey"),nls:n.getProperty("nls"),uriTemplate:n.getProperty("orionTemplate")||n.getProperty("uriTemplate"),validationProperties:n.getProperty("validationProperties")||[]})}return a}(),d=[],e=0;e<a.length;e++){var n=a[e],f=c(b,n);d.push({properties:{name:n.name||
n.id,nameKey:n.nameKey,id:"eclipse.openWithCommand."+n.id,contentType:f.contentTypes,excludedContentTypes:f.excludedContentTypes,uriTemplate:n.uriTemplate,nls:n.nls,forceSingleItem:!0,isEditor:n["default"]?"default":"editor",validationProperties:n.validationProperties},service:{}})}return d};l._makeValidator=function(b,c,d,e){function f(b,c,a,d){var n=a.match,e,l;if((e=c.indexOf("["))>=0){if((l=c.indexOf("]"))<0)return!1;var g=c.substring(0,e),h;if(!(h=b[g])||!Array.isArray(h))return!1;e=c.substring(e+
1,l);e=parseInt(e,10);if(isNaN(e))return!1;e<0&&(e+=h.length);c=c.substring(l+1);c=g+":"+String(e)+c}if(c.indexOf("|")>=0)return e=c.substring(0,c.indexOf("|")),c=c.substring(c.indexOf("|")+1),f(b,e,a,d)?!0:f(b,c,a,d);else if(c.indexOf(":")>=0)return e=c.substring(0,c.indexOf(":")),c=c.substring(c.indexOf(":")+1),b[e]?f(b[e],c,a,d):!1;else{a:{var g=!1,m;if(c.charAt(0)==="!")a=typeof b[c.substring(1)]==="undefined";else if(typeof b[c]!=="undefined"){if(typeof n==="undefined")m=b[c],g=!0;else if(typeof n===
"string"){if(!typeof(b[c]==="string")){a=!1;break a}if(a.variableName){if(n=RegExp(n).exec(b[c]))m=n[0],m=a.variableMatchPosition==="before"?b[c].substring(0,n.index):a.variableMatchPosition==="after"?b[c].substring(n.index+m.length):a.variableMatchPosition==="only"?m:b[c],g=!0}else{a=RegExp(n).test(b[c]);break a}}else b[c]===n&&(m=b[c],g=!0);if(g&&a.variableName&&(d[a.variableName]=m,d.itemCached=b,a.replacements))for(b=0;b<a.replacements.length;b++)m=!1,a.replacements[b].pattern?d[a.variableName]=
d[a.variableName].replace(RegExp(a.replacements[b].pattern),a.replacements[b].replacement||""):m=!0,m&&window.console.log("Invalid replacements specified in validation property.  "+a.replacements[b]);a=g}else a=!1}return a}}function n(c,d,n){if(n.info.validationProperties)for(var e=0;e<n.info.validationProperties.length;e++){var l=n.info.validationProperties[e];if(typeof l.source!=="undefined"){if(!f(c,l.source,l,n))return!1}else return window.console.log("Invalid validationProperties in "+b.id+".  No source property specified."),
!1}var e=!0,g=d?a.getFilenameContentType(c.Name,d):null,g=g||{id:"application/octet-stream"};n.info.excludedContentTypes&&d&&(e=n.info.excludedContentTypes.every(function(b){b=b.replace(/([*?])/g,".$1");return-1!==g.id.search(b)?!1:!0}));e&&n.info.contentType&&d&&(e=n.info.contentType.some(function(b){b=b.replace(/([*?])/g,".$1");return-1!==g.id.search(b)?!0:!1}));return e}return{info:b,validationFunction:function(b){typeof e==="function"&&(b=e.call(this,b));if(b){if(Array.isArray(b)){if((this.info.forceSingleItem||
this.info.uriTemplate)&&b.length!==1)return!1;if(b.length<1)return!1}else b=[b];for(var c=0;c<b.length;c++)if(!n(b[c],d,this))return!1;return!0}return!1},generatesURI:function(){return!!this.info.uriTemplate},getURI:function(b){if(this.info.uriTemplate){var c={},a;for(a in b)Object.prototype.hasOwnProperty.call(b,a)&&(c[a]=b[a]);if(this.info.validationProperties)for(a=0;a<this.info.validationProperties.length;a++){var d=this.info.validationProperties[a];d.source&&d.variableName&&(this.itemCached===
b&&this[d.variableName]||f(b,d.source,d,this),b[d.variableName]?window.console.log("Variable name "+d.variableName+" in the extension "+this.info.id+" conflicts with an existing property in the item metadata."):c[d.variableName]=this[d.variableName])}c.OrionHome=m;return(new g(this.info.uriTemplate)).expand(c)}return null}}};var s=c.UnnamedCommand;l._createCommandOptions=function(b,c,a,d,f,n){function g(e,h){var w=l._makeValidator(b,a,d,n);e.visibleWhen=w.validationFunction.bind(w);if(f)if(w.generatesURI.bind(w)())e.hrefCallback=
function(b){b=Array.isArray(b.items)?b.items[0]:b.items;return w.getURI.bind(w)(b)};else{var m=b;e.callback=function(b){var d;if(m.forceSingleItem)b=Array.isArray(b.items)?b.items[0]:b.items,d=l._cloneItemWithoutChildren(b);else if(Array.isArray(b.items)){d=[];for(var n=0;n<b.items.length;n++)d.push(l._cloneItemWithoutChildren(b.items[n]))}else d=l._cloneItemWithoutChildren(b.items);if(a)var f=a.getService("orion.page.progress");c.run?f?f.progress(c.run(d),"Running command: "+e.name):c.run(d):a&&
(f?f.progress(a.getService(c).run(d),"Running command: "+e.name):a.getService(c).run(d))}}h.resolve(e)}var h=new k;if(b.nls){var m=function(c){var a;c?(a=b.tooltipKey&&c[b.tooltipKey],c=b.nameKey&&c[b.nameKey]||b.name||s,a=a||b.tooltip||""):(c=b.name||b.nameKey||s,a=b.tooltip||b.tooltipKey||"");g({name:c,image:b.image,id:b.id||b.name,tooltip:a,isEditor:b.isEditor,showGlobally:b.showGlobally},h)};e.getMessageBundle(b.nls).then(m,m.bind(this,null))}else g({name:b.name,image:b.image,id:b.id||b.name,
tooltip:b.tooltip,isEditor:b.isEditor,showGlobally:b.showGlobally},h);return h};l.getOpenWithCommand=function(b,c,a){for(var d,b=a||l.getOpenWithCommands(b),a=0;a<b.length;a++)if(b[a].visibleWhen(c)){var e=b[a].isEditor==="default";if(!d||e)if(d=b[a],e)break}return d};l.getOpenWithCommands=function(b){var c=[],a;for(a in b._commandList){var d=b._commandList[a];d.isEditor&&c.push(d)}return c};var o;l.createAndPlaceFileCommandsExtension=function(b,a,d,e,f,n){return l.createFileCommands(b,null,n?"all":
void 0,!!n,a).then(function(b){f&&0<b.length&&(a.addCommandGroup(d,"eclipse.openWith",1E3,c.OpenWith,f,null,null,null,"dropdownSelection"),a.addCommandGroup(d,"eclipse.fileCommandExtensions",1E3,c.OpenRelated,f));b.forEach(function(b){var c=null;f&&(c=b.isEditor?f+"/eclipse.openWith":f+"/eclipse.fileCommandExtensions");a.registerCommandContribution(d,b.id,e,c)});return{}})};l.createFileCommands=function(b,c,a,d,e){var a=a===void 0?"global":a,d=d===void 0?!0:d,n=[];l._cachedFileCommands||l._createCachedFileCommands(b);
(a==="all"||a==="global")&&l._cachedFileCommands.forEach(function(b){var c=b.properties;(a==="all"||c.forceSingleItem&&c.showGlobally)&&n.push(b)});return k.when(function(){var a=b.getService("orion.core.contentTypeRegistry")||c;return o||k.when(a.getContentTypes(),function(b){return o=b})}(),function(){if(d){if(!l._cachedOpenWithExtensions)l._cachedOpenWithExtensions=l._getOpenWithNavCommandExtensions(b,o);n=n.concat(l._cachedOpenWithExtensions);e._addedOpenWithCommands=d}var c=n.map(function(c){var a=
c.properties,c=c.service,d=e.findCommand(a.id||a.name);return d?(new k).resolve(d):l._createCommandOptions(a,c,b,o,!0).then(function(b){b=new j.Command(b);e.addCommand(b);return b})});return k.all(c,function(b){return{_error:b}}).then(function(b){return b})})};l._createCachedFileCommands=function(c){var a=c.getServiceReferences("orion.navigate.command");l._cachedFileCommands=[];for(var d=0;d<a.length;d++)if(a[d].getProperty("id")!=="orion.navigateFromMetadata"){var e=c.getService(a[d]),f=b(a[d]);
l._cachedFileCommands.push({properties:f,service:e})}};l.getFileCommandIds=function(){var b=[];if(l._cachedFileCommands)l._cachedFileCommands.length&&(b=l._cachedFileCommands.map(function(b){return b.properties.id}));else throw"extensionCommandUtils._cachedFileCommands is not initialized";return b};l.createOpenWithCommands=function(b,c,a){return a&&a._addedOpenWithCommands?(new k).resolve(l.getOpenWithCommands(a)):l.createFileCommands(b,c,"none",!0,a)};return l});
define("orion/breadcrumbs",["require","orion/webui/littlelib"],function(i,k){function j(h){this._init(h)}j.prototype={_init:function(h){var a=k.node(h.container);if(!a)throw"no parent container";this._container=a;a.classList.remove("currentLocation");this._id=h.id||"eclipse.breadcrumbs";this._resource=h.resource||null;this._rootSegmentName=h.rootSegmentName;this._workspaceRootSegmentName=h.workspaceRootSegmentName;this._workspaceRootURL=h.workspaceRootURL;this._makeHref=h.makeHref;this._makeFinalHref=
h.makeFinalHref;this._maxLength=h.maxLength;this.path="";this.measure();this.render()},getNavigatorWorkspaceRootSegment:function(){if(this._workspaceRootSegmentName){var h;if(this._resource&&this._resource.Parents&&!this._resource.skip){h=document.createElement("a");var a=this._workspaceRootURL?this._workspaceRootURL:"";this._makeHref?this._makeHref(h,a):h.href=i.toUrl("edit/edit.html")+"#"+a}else h=document.createElement("span");k.empty(h);h.appendChild(document.createTextNode(this._workspaceRootSegmentName));
return h}return null},MAX_LENGTH:500,INCLUDE_FIRST_SECTION:!0,segments:[],buildSegment:function(h){var a=document.createElement("a");a.classList.add("breadcrumb");a.appendChild(document.createTextNode(h));return a},addSegmentHref:function(h,a){this._makeHref?this._makeHref(h,a.Location,a):h.href=i.toUrl("edit/edit.html")+"#"+a.ChildrenLocation},buildSegments:function(h,a){if(this._resource.Parents){var g=this._resource.Parents.slice(0),e,f;g&&(g=g.slice(0),a==="reverse"&&(g=g.reverse().slice(0)),
g.forEach(function(a){if(!a.skip)h?(f=h,h=null):f=a.Name,e=this.buildSegment(f),this.path+=a.Name,this.addSegmentHref(e,a),e.include=!1,this.segments.push(e)}.bind(this)))}},addDivider:function(){var h=document.createElement("span");h.appendChild(document.createTextNode(" / "));this.path+="/";h.classList.add("breadcrumbSeparator");this.append(h)},refresh:function(){(this.crumbs=k.node(this._id))?k.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(h){this.crumbs.appendChild(h)},addTitle:function(h,a){var g=a||document.title;this.crumbs.childNodes.length===0&&(h=document.createElement("span"),h.appendChild(document.createTextNode(g)),
h.classList.add("breadcrumb"),h.classList.add("currentLocation"),this.append(h))},finalSegment:function(h,a){if(!this._resource.skip){var g;g=a?a:this._resource.Name;this._makeFinalHref?(h=this.buildSegment(g),this.addSegmentHref(h,this._resource)):(h=document.createElement("span"),h.appendChild(document.createTextNode(g)));h.classList.add("currentLocation");this.path+=this._resource.Name;this.append(h)}},firstSegment:function(h){if(h)if(this.append(h),this._resource&&this._resource.Parents&&!this._resource.skip)h.classList.add("breadcrumb"),
this.addDivider();else{if(!this._resource.skip)h.href="";h.classList.add("currentLocation")}},drawSegments:function(){this._resource.Parents&&this.segments.slice(0).forEach(function(h){h.include===!0&&(this.append(h),this.addDivider())}.bind(this))},measureSegments:function(){this.INCLUDE_FIRST_SECTION=!0;if(this._resource.Parents){var h=this.segments.slice(0).reverse();h.forEach(function(a){this.append(a);this.addDivider();this.crumbs.offsetWidth<this.MAX_LENGTH?a.include=!0:this.INCLUDE_FIRST_SECTION=
!1}.bind(this));this.segments=h.reverse()}},measure:function(){var h=this._container;h.style.width="auto";this.MAX_LENGTH=this._maxLength?this._maxLength:h.offsetWidth;this.refresh();this.segments=[];this.crumbs.style.visibility="hidden";var h=this.getNavigatorWorkspaceRootSegment(),a=this._rootSegmentName;if(a)this.addTitle(h,a);else if(this.finalSegment(h,a),this._resource&&this._resource.Parents&&(this.buildSegments(a,"reverse"),this.measureSegments(),this.firstSegment(h)),this.crumbs.offsetWidth>=
this.MAX_LENGTH)this.INCLUDE_FIRST_SECTION=!1},render:function(){this.refresh();var h=this.getNavigatorWorkspaceRootSegment(),a=this._rootSegmentName;a?this.addTitle(h,a):(this.INCLUDE_FIRST_SECTION===!0&&this.firstSegment(h),this._resource&&this._resource.Parents&&(this.drawSegments(),this.finalSegment(h,a)));this.crumbs.parentNode.style.width=this.crumbs.offsetWidth+20+"px"}};j.prototype.constructor=j;return{BreadCrumbs:j}});
define("orion/webui/splitter",["require","orion/EventTarget","orion/webui/littlelib"],function(i,k,j){function h(a){k.attach(this);this._init(a)}h.prototype={_init:function(a){this._tracking=null;this._animationDelay=501;this._closeReversely=a.closeReversely;this.$node=j.node(a.node);if(!this.$node)throw"no dom node for splitter found";this.$sideNode=j.node(a.sidePanel);if(!this.$sideNode)throw"no dom node for side panel found";this.$mainNode=j.node(a.mainPanel);if(!this.$mainNode)throw"no dom node for main panel found";
this._vertical=a.vertical;this._prefix="/orion/splitter/"+(this.$node.id||document.body.id||"");if(a.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 a.closeByDefault!=="undefined")this._closeByDefault=a.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(a){this.addEventListener("resize",function(g){a(g.node)})},_initializeFromStoredSettings:function(){var a=localStorage.getItem(this._prefix+"/toggleState");this._closed=typeof a==="string"?a==="closed":this._closeByDefault;var a=j.bounds(this.$node.parentNode),g=j.bounds(this.$node),e;if(this._vertical)if(e=localStorage.getItem(this._prefix+"/yPosition")){if(this._splitTop=parseInt(e,10),this._splitTop>a.top+a.height-g.height)this._splitTop=a.top+a.height/
2}else{if(this._closeByDefault)this._initialSplit=this._getSplitPosition(),this._splitTop=0}else if(e=localStorage.getItem(this._prefix+"/xPosition")){if(this._splitLeft=parseInt(e,10),this._splitLeft>a.left+a.width-g.width)this._splitLeft=a.left+a.width/2}else if(this._closeByDefault)this._initialSplit=this._getSplitPosition(),this._splitLeft=0},_getSplitPosition:function(){var a=j.bounds(this.$node),g=j.bounds(this.$node.parentNode);return this.vertical?a.top-g.top:a.left-g.left},_adjustToSplitPosition:function(a){var g=
j.bounds(this.$node),e=j.bounds(this.$node.parentNode);if(this._vertical){this._splitHeight=g.height;if(a||!this._splitTop)this._splitTop=g.top,localStorage.setItem(this._prefix+"/yPosition",this._splitTop);a=this._splitTop;this.$node.parentNode.style.position==="relative"&&(a=this._splitTop-e.top);this.$sideNode.style.height=a+"px";this.$sideNode.style.display="block";this.$node.style.top=a+"px"}else{this._splitWidth=g.width;if(a||!this._splitLeft)this._splitLeft=g.left,localStorage.setItem(this._prefix+
"/xPosition",this._splitLeft);a=this._splitLeft;this.$node.parentNode.style.position==="relative"&&(a=this._splitLeft-e.left);this.$sideNode.style.width=a+"px";this.$sideNode.style.display="block";this.$node.style.left=a+"px"}this._resize()},_resize:function(a,g,e){var a=a||0,f=j.bounds(this.$node.parentNode),d=j.bounds(this.$node);this._vertical?(e===void 0&&(e=d.top-f.top),e+=d.height,this.$mainNode.style.top=e+"px"):(g===void 0&&(g=d.left-f.left),g+=d.width,this.$mainNode.style.left=g+"px");var c=
this;window.setTimeout(function(){c._notifyResizeListeners(c.$mainNode);c._notifyResizeListeners(c.$sideNode)},a)},_notifyResizeListeners:function(a){this.dispatchEvent({type:"resize",node:a})},_notifyToggleListeners:function(){this.dispatchEvent({type:"toggle",closed:this._closed})},_thumbDown:function(a,g){a||this._addAnimation();var e=this._splitTop,f=this._splitLeft;if(this._closed){if(this._closed=!1,!this._splitLeft&&!this._splitTop&&typeof this._initialSplit==="number")e=f=this._initialSplit}else if(this._closed=
!0,this._closeReversely){var d=j.bounds(this.$node.parentNode),c=j.bounds(this.$node);this._vertical?e=d.height-c.height:f=d.width-c.width}else e=f=0;this._vertical?(this.$sideNode.style.height=e+"px",this.$node.style.top=e+"px"):(this.$sideNode.style.width=f+"px",this.$node.style.left=f+"px");this._resize(this._animationDelay,f,e);a||this._removeAnimation();g||localStorage.setItem(this._prefix+"/toggleState",this._closed?"closed":null);var b=this;window.setTimeout(function(){b._notifyToggleListeners()},
this._animationDelay)},_removeAnimation:function(){var a=this;window.setTimeout(function(){a.$sideNode.classList.remove(a._vertical?"sidePanelVerticalLayoutAnimation":"sidePanelLayoutAnimation");a.$mainNode.classList.remove(a._vertical?"mainPanelVerticalLayoutAnimation":"mainPanelLayoutAnimation");a.$node.classList.remove(a._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(a){if(a.target===this._thumb)return j.stop(a),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),j.setFramesEnabled(!1),j.stop(a)},_mouseMove:function(a){if(this._tracking){var g=j.bounds(this.$node.parentNode);if(this._vertical){this._splitTop=a.clientY;if(this._splitTop<g.top+5)this._splitTop=g.top+5;else if(this._splitTop>g.top+g.height-5)this._splitTop=g.top+g.height-5;var e=this._splitTop,e=this._splitTop-g.top;this.$node.style.top=e+"px"}else{this._splitLeft=a.clientX;if(this._splitLeft<g.left+5)this._splitLeft=g.left+5;else if(this._splitLeft>
g.left+g.width-5)this._splitLeft=g.left+g.width-5;e=this._splitLeft;e=this._splitLeft-2*g.left;this.$node.style.left=e+"px"}this._adjustToSplitPosition(!0);j.stop(a)}},_mouseUp:function(a){if(this._tracking)j.setFramesEnabled(!0),window.removeEventListener("mousemove",this._tracking),this._tracking=null,this.$node.classList.remove("splitTracking"),this.$mainNode.classList.remove("panelTracking"),this.$sideNode.classList.remove("panelTracking"),j.stop(a)}};h.prototype.constructor=h;return{Splitter:h}});
define("orion/keyAssist",["i18n!orion/nls/messages","orion/webui/littlelib","orion/util"],function(i,k,j){function h(a){this.commandRegistry=a.commandRegistry;this.create();this._filterString="";this._providers=[]}h.prototype={addProvider:function(a){this._providers.push(a)},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 g=this._keyAssistInput=document.createElement("input");
g.classList.add("keyAssistInput");g.type="text";g.placeholder=i["Filter bindings"];a.appendChild(g);var e=this._keyAssistContents=document.createElement("div");e.classList.add("keyAssistContents");if(j.isIOS||j.isAndroid)e.style.overflowY="auto";a.appendChild(e);var f=this._keyAssistTable=document.createElement("table");f.tabIndex=0;f.classList.add("keyAssistList");e.appendChild(f);document.body.appendChild(a);g.addEventListener("keydown",function(a){this._keyDown(a)}.bind(this));f.addEventListener("keydown",
function(a){this._keyDown(a)}.bind(this));g.addEventListener("input",function(){this.filterChanged()}.bind(this));e.addEventListener(j.isFirefox?"DOMMouseScroll":"mousewheel",function(a){this._scrollWheel(a)}.bind(this));document.addEventListener("keydown",function(a){a.keyCode===k.KEY.ESCAPE&&this.hide()}.bind(this));k.addAutoDismiss([a],function(){this.hide()}.bind(this))},createContents:function(){k.empty(this._keyAssistTable);this._selectedIndex=-1;this._selectedRow=null;for(var a=this._idCount=
this._keyAssistContents.scrollTop=0;a<this._providers.length;a++)this._providers[a].showKeyBindings(this);this.createHeader(i.Global);this.commandRegistry.showKeyBindings(this)},createItem:function(a,g,e){if(this._filterString){var f=this._filterString.toLowerCase(),d;f!==this._filterString?(f=this._filterString,d=function(b){return b}):d=function(b){return b.toLowerCase()};if(d(g).indexOf(f)===-1&&d(a).indexOf(f)===-1&&d(this._lastHeader).indexOf(f)===-1)return}var c=this._keyAssistTable.insertRow(-1);
c.id="keyAssist-keyBinding-"+this._idCount++;c.setAttribute("role","menuitem");c._execute=e;c.classList.add("keyAssistItem");c.addEventListener("click",function(b){this._selectedRow=c;this.execute();b.preventDefault()}.bind(this));e=c.insertCell(-1);e.classList.add("keyAssistName");e.appendChild(document.createTextNode(g));e=c.insertCell(-1);e.classList.add("keyAssistAccel");e.appendChild(document.createTextNode(a))},createHeader:function(a){this._lastHeader=a;var g=this._keyAssistTable.insertRow(-1);
g.classList.add("keyAssistSection");var g=g.insertCell(-1),e=document.createElement("h2");e.appendChild(document.createTextNode(a));g.appendChild(e)},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,g=this._keyAssistDiv,a=g===a||(g.compareDocumentPosition(a)&16)!==0;g.style.display="none";a&&document.compareDocumentPosition(this._previousActiveElement)!==1&&this._previousActiveElement.focus();this._previousActiveElement=null}},isVisible:function(){return this._keyAssistDiv.style.display==="block"},removeProvider:function(a){a=this._providers.indexOf(a);a!==-1&&this._providers.splice(a,
1)},select:function(a){var g=this._keyAssistTable.querySelectorAll(".keyAssistItem");if(g.length===0)this._selectedIndex=-1;else{var e=this._selectedIndex;e+=a?1:-1;e%=g.length;e<0&&(e=g.length-1);if(this._selectedIndex!==-1)a=g[this._selectedIndex],a.classList.remove("selected"),this._selectedRow=null;this._selectedIndex=e;if(this._selectedIndex!==-1){this._selectedRow=a=g[this._selectedIndex];a.classList.add("selected");this._keyAssistTable.setAttribute("aria-activedescendant",a.id);this._keyAssistTable.focus();
var g=a.getBoundingClientRect(),f=this._keyAssistContents,d=f.getBoundingClientRect();a.offsetTop<f.scrollTop?e===0?f.scrollTop=0:a.scrollIntoView(!0):g.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 g=0,g=j.isIE||j.isOpera?-a.wheelDelta:j.isFirefox?a.detail*40:-a.wheelDeltaY,e=this._keyAssistContents,f=e.scrollTop;e.scrollTop+=g;if(f!==e.scrollTop)return a.preventDefault&&a.preventDefault(),!1}};return{KeyAssistPanel:h}});
define("orion/widgets/themes/ThemePreferences",[],function(){function i(i,j){this._preferences=i;this._themeData=j;var h=j.getThemeStorageInfo();this._themeVersion=h.version;var a=i.listenForChangedSettings(h.storage,2,function(g){g.key===a&&this.apply()}.bind(this))}i.prototype={_initialize:function(i,j,h){var a,g;this._themeVersion===void 0||h.get("version")===this._themeVersion?(a=h.get(i.styleset),(g=h.get("selected"))&&(g=JSON.parse(g))):g=a=null;a||(a=j.getStyles(),h.put(i.styleset,JSON.stringify(a)));
if(!g||g[i.selectedKey]===void 0)g=g||{},g[i.selectedKey]=i.defaultTheme,h.put("selected",JSON.stringify(g));h.put("version",this._themeVersion)},apply:function(){this.setTheme()},getTheme:function(i){var j=this._themeData,h=j.getThemeStorageInfo();this._preferences.getPreferences(h.storage,2).then(function(a){this._initialize(h,j,a);var g=JSON.parse(a.get("selected")),a=JSON.parse(a.get(h.styleset)),e;if(a)for(var f=0;f<a.length;f++)if(a[f].name===g[h.selectedKey]){e=a[f];break}i({style:e,styles:a})}.bind(this))},
setTheme:function(i,j){var h=this._themeData,a=h.getThemeStorageInfo();this._preferences.getPreferences(a.storage,2).then(function(g){this._initialize(a,h,g);var e=JSON.parse(g.get("selected"));i||(i=e[a.selectedKey]);e[a.selectedKey]=i;g.put("selected",JSON.stringify(e));j?g.put(a.styleset,JSON.stringify(j)):j=JSON.parse(g.get(a.styleset));for(var f=0;f<j.length;f++)if(j[f].name===e[a.selectedKey]){h.processSettings(j[f]);break}g.put("version",this._themeVersion)}.bind(this))},setFontSize:function(i){var j=
this._themeData,h=j.getThemeStorageInfo();this._preferences.getPreferences(h.storage,2).then(function(a){this._initialize(h,j,a);var g=JSON.parse(a.get("selected")),e=JSON.parse(a.get(h.styleset)),f;if(e)for(var d=0;d<e.length;d++)e[d].fontSize=i,e[d].name===g[h.selectedKey]&&(f=e[d]);a.put(h.styleset,JSON.stringify(e));j.processSettings(f)}.bind(this))}};return{ThemePreferences:i}});
define("orion/settings/nls/root/messages",{"Plugin Description":"Plugin Description",Create:"Create","Loading...":"Loading...","Label:":"Label:",Title:"Title",Plugins:"Plugins","User Profile":"User Profile",Git:"Git","Git Settings":"Git Settings",General:"General",Navigation:"Navigation",Links:"Links","Open in same tab":"Open in same tab","Open in new tab":"Open in new tab",Font:"Font",Family:"Family","Sans Serif":"Sans Serif",Serif:"Serif",Size:"Size","8pt":"8pt","9pt":"9pt","10pt":"10pt","12pt":"12pt",
Color:"Color",Background:"Background",Strings:"Strings","String Types":"String Types",blue:"blue",Weight:"Weight",Normal:"Normal",Bold:"Bold",Comments:"Comments","Comment Types":"Comment Types",green:"green",Keywords:"Keywords","Keyword Types":"Keyword Types",darkred:"darkred",Categories:"Categories",Username:"Username","Full Name":"Full Name","Email Address":"Email Address","Email Confirmed":"Email Confirmed",Account:"Account","Current Password":"Current Password","New Password":"New Password","Verify Password":"Verify Password",
Password:"Password",OpenId:"OpenId",AOL:"AOL",Yahoo:"Yahoo",Google:"Google",Unlink:"Unlink",Link:"Link",Unlinked:"Unlinked",Linked:"Linked","Linked Accounts":"Linked Accounts","Git Email Address":"Git Email Address","Git Username":"Git Username","Git Credentials Storage":"Git Credentials Storage",Update:"Update","Update Profile Settings":"Update Profile Settings","Update Git User Settings":"Update Git User Settings","Update Git Credentials":"Update Git Credentials","User profile data successfully updated.":"User profile data successfully updated.",
"Git user data successfully updated.":"Git user data successfully updated.","Git Credentials successfully updated.":"Git Credentials successfully updated.","Edit Plugin JavaScript":"Edit Plugin JavaScript","Install Plugin":"Install Plugin","Plugin Name:":"Plugin Name:","Author Name:":"Author Name:","Licence:":"Licence:","Description:":"Description:","A plugin for Eclipse Orion":"A plugin for Eclipse Orion","Plugin Link":"Plugin Link",Install:"Install","Install a plugin by specifying its URL":"Install a plugin by specifying its URL",
"Plugin URL:":"Plugin URL:",Disable:"Disable",DisableTooltip:"Disable the plugin",Enable:"Enable",EnableTooltip:"Enable the plugin","Reload all":"Reload all","Reload all installed plugins":"Reload all installed plugins","Create a new Orion Plugin":"Create a new Orion Plugin","Find More Orion Plugins":"Find More Orion Plugins","Get Plugins":"Get Plugins",Reload:"Reload","Reload the plugin":"Reload the plugin",Delete:"Delete","Delete this plugin from the configuration":"Delete this plugin from the configuration",
"Type a plugin url here ...":"Type a plugin url here ...","Installed ":"Installed ","Installing ":"Installing ","Already installed":"Already installed"," plugin":" plugin","Reloaded ":"Reloaded ","Uninstalled ":"Uninstalled ","Are you sure you want to uninstall '":"Are you sure you want to uninstall '",Services:"Services",Value:"Value","JavaScript Object":"JavaScript Object","click here, then check javascript console to drill down":"click here, then check javascript console to drill down",Item:"Item",
"Git Config":"Git Config","Clear Git Credentials":"Clear Git Credentials","Enable Storage":"Enable Storage","Please be aware that your credentials will be stored persistently in the browser.":"Please be aware that your credentials will be stored persistently in the browser.","Do you wish to enable the Key Storage?":"Do you wish to enable the Key Storage?",general:"General",validation:"Validation","Deleted git credentials for ${0}":"Deleted git credentials for ${0}",Editor:"Editor",editorSettings:"Settings",
EditorThemes:"Themes",Import:"Import","Import a theme":"Import a theme",Export:"Export","Export a theme":"Export a theme","Theme name:":"Theme name:",yourTheme:"yourTheme",fileManagement:"File Management",typing:"Typing",autoSave:"Auto Save",autoSaveTimeout:"Save interval (ms)",autoLoad:"Auto Load",saveDiffs:"Save file as diffs",trimTrailingWhiteSpace:"Trim Trailing Whitespace on Save",Restore:"Restore Defaults",Default:"Default",keys:"Keys",tabs:"Tabs",tabSize:"Tab Size",expandTab:"Insert spaces for tabs",
smoothScrolling:"Smooth Scrolling",scrollAnimation:"Scrolling Animation",scrollAnimationTimeout:"Scrolling Duration (ms)",keyBindings:"Key Bindings",rulers:"Rulers",annotationRuler:"Show Annotation Ruler",lineNumberRuler:"Show Line Number Ruler",foldingRuler:"Show Folding Ruler",overviewRuler:"Show Overview Ruler",whitespaces:"White Spaces",wrapping:"Wrapping",wordWrap:"Word Wrap",showMargin:"Show Margin",marginOffset:"Margin Column",showTabs:"Show Tabs",showSpaces:"Show Spaces",autoSaveTimeoutInvalid:"Invalid save interval.",
scrollAnimationTimeoutInvalid:"Invalid scrolling duration.",tabSizeInvalid:"Invalid tab size.",localSettingsTooltip:"Toggle whether this setting is shown in the local editor settings drop down.",editorSettingsInfo:"Use the ${0} and ${1} to toggle whether a given setting is shown in the local editor settings drop down ${2}.",autoPairParentheses:"Autopair (Parentheses)",autoPairBraces:"Autopair {Braces}",autoPairSquareBrackets:"Autopair [Square] Brackets",autoPairAngleBrackets:"Autopair <Angle> Brackets",
autoPairQuotations:'Autopair "Strings"',autoCompleteComments:"Autocomplete /** Block Comments */",smartIndentation:"Smart Indentation",sourceControl:"Source Control",showBlame:"Show Blame",languageTools:"Language Tools",showOccurrences:"Show Occurrences",contentAssistAutoTrigger:"Show Content Assist automatically","Editor preferences updated":"Editor preferences updated","Editor defaults restored":"Editor defaults restored",Theme:"Theme","Font Size":"Font Size","New Theme Name:":"New Theme Name:",
"Font Size:":"Font Size:","UI Theme":"UI Theme","Navigation Bar":"Navigation Bar","Navigation Text":"Navigation Text","Search Box":"Search Box","Tool Panel":"Tool Panel","Selection Bar":"Selection Bar",Location:"Location",Content:"Content","Main Panel":"Main Panel",Button:"Button","Button Text":"Button Text","Section Text":"Section Text","Side Panel":"Side Panel","Line Color":"Line Color","Line Numbers":"Line Numbers",Foreground:"Foreground","Current Line":"Current Line","HTML Attribute":"HTML Attribute",
"Overview Ruler":"Overview Ruler","HTML Tag":"HTML Tag","Annotation Ruler":"Annotation Ruler","Show Guide":"Show Guide","Check Guide":"Check Guide",Cancel:"Cancel","Revert Theme":"Revert Theme","Update Theme":"Update Theme","Theme:":"Theme:",clickDiagram:"Click diagram to style.",clickUpdate:"Click Update button to save preview.","CSS Class Name":"CSS Class Name","CSS Attribute":"CSS Attribute","CSS Value":"CSS Value","CSS Text":"CSS Text","COLOR:":"Color:","NEW COLOR:":"New Color:",Ok:"Ok","OR HEX:":"Or Hex: "});
define("orion/settings/nls/messages",["orion/i18n!orion/settings/nls/messages","orion/settings/nls/root/messages"],function(i,k){var j={root:k};Object.keys(i).forEach(function(h){typeof j[h]==="undefined"&&(j[h]=i[h])});return j});
define("orion/editor/eventTarget",[],function(){function i(){}i.addMixin=function(k){var j=i.prototype,h;for(h in j)j.hasOwnProperty(h)&&(k[h]=j[h])};i.prototype={addEventListener:function(i,j,h){if(!this._eventTypes)this._eventTypes={};var a=this._eventTypes[i];a||(a=this._eventTypes[i]={level:0,listeners:[]});a.listeners.push({listener:j,useCapture:h})},dispatchEvent:function(i){var j=i.type;this._dispatchEvent("pre"+j,i);this._dispatchEvent(j,i);this._dispatchEvent("post"+j,i)},_dispatchEvent:function(i,
j){var h=this._eventTypes?this._eventTypes[i]:null;if(h){var a=h.listeners;try{if(h.level++,a)for(var g=0,e=a.length;g<e;g++)if(a[g]){var f=a[g].listener;typeof f==="function"?f.call(this,j):f.handleEvent&&typeof f.handleEvent==="function"&&f.handleEvent(j)}}finally{if(h.level--,h.compact&&h.level===0){for(g=a.length-1;g>=0;g--)a[g]||a.splice(g,1);a.length===0&&delete this._eventTypes[i];h.compact=!1}}}},isListening:function(i){return!this._eventTypes?!1:this._eventTypes[i]!==void 0},removeEventListener:function(i,
j,h){if(this._eventTypes){var a=this._eventTypes[i];if(a){for(var g=a.listeners,e=0,f=g.length;e<f;e++){var d=g[e];if(d&&d.listener===j&&d.useCapture===h){a.level!==0?(g[e]=null,a.compact=!0):g.splice(e,1);break}}g.length===0&&delete this._eventTypes[i]}}}};return{EventTarget:i}});
define("orion/editor/textTheme",["require","orion/editor/eventTarget","orion/util"],function(i,k,j){function h(a){a=a||{};this._document=a.document||document}var a={};h.getTheme=function(g){var g=g||"default",e=a[g];e||(e=a[g]=new h);return e};h.prototype={getThemeClass:function(){return this._themeClass},setThemeClass:function(a,e){var f=this,d=f._themeClass;f._themeClass=a;this._load(a,e,function(){f.onThemeChanged({type:"ThemeChanged",oldValue:d,newValue:f.getThemeClass()})})},onThemeChanged:function(a){return this.dispatchEvent(a)},
buildStyleSheet:function(a,e){function f(c,b,e){b&&(d.push("."+a+" ."+c+" {"),d.push("\t"+(e?"background-color":"color")+": "+b+";"),d.push("}"))}var d=[];d.push("");d.push("."+a+" {");e.fontFamily&&d.push("\tfont-family: "+e.fontFamily+";");e.fontSize&&d.push("\tfont-size: "+e.fontSize+";");e.fontSize&&d.push("\tcolor: "+e.text+";");d.push("}");d.push("."+a+".textview {");e.background&&d.push("\tbackground-color: "+e.background+";");d.push("}");f("ruler.annotations",e.annotationRuler,!0);f("ruler.lines",
e.annotationRuler,!0);f("ruler.folding",e.annotationRuler,!0);f("ruler.overview",e.overviewRuler,!0);f("rulerLines",e.lineNumber,!1);f("rulerLines.even",e.lineNumberEven,!1);f("rulerLines.odd",e.lineNumberOdd,!1);f("annotationLine.currentLine",e.currentLine,!0);f("entity-name-tag",e.keyword,!1);f("entity-other-attribute-name",e.attribute,!1);f("string-quoted",e.string,!1);f("meta.annotation.currentLine",e.currentLine,!0);f("keyword",e.keyword,!1);f("string",e.string,!1);f("comment",e.comment,!1);
f("comment.block.documentation",e.comment,!1);f("keyword.other.documentation.markup",e.comment,!1);return d.join("\n")},_createStyle:function(a,e,f,d){var c=this._document,a="orion-theme-"+a,b=c.getElementById(a);if(b){if(d||b.firstChild.data===e)return;b.removeChild(b.firstChild);b.appendChild(c.createTextNode(e))}else d?(b=j.createElement(c,"link"),b.rel="stylesheet",b.type="text/css",b.href=e,b.addEventListener("load",function(){f()})):(b=j.createElement(c,"style"),b.appendChild(c.createTextNode(e))),
b.id=a,(c.getElementsByTagName("head")[0]||c.documentElement).appendChild(b);d||f()},_load:function(a,e,f){if(a)if(typeof e==="string")this._createStyle(a,e,f);else if(e=e.href,e.substring(e.length-4)!==".css"&&(e+=".css"),/^\//.test(e)||/[a-zA-Z0-9]+:\/\//i.test(e)||!i.toUrl)this._createStyle(a,e,f,!0);else{var d=this;i(["text!"+e],function(c){d._createStyle(a,c,f,!1)})}else f()}};k.EventTarget.addMixin(h.prototype);return{TextTheme:h}});
define("orion/widgets/themes/ThemeClass",[],function(){function i(i){this.attributes=[];this.element=document.createElement("div");this.style=this.element.style;this.className=i;this.classString="."+i+"{ "}i.prototype.className=null;i.prototype.classString=void 0;i.prototype.style=void 0;i.prototype.closeString=" }\n";i.prototype.toString=function(){return this.classString=this.classString+this.style.cssText+this.closeString};return{ThemeClass:i}});
define("orion/widgets/themes/container/ThemeSheetWriter",["orion/widgets/themes/ThemeClass"],function(i){function k(){}k.prototype.navbar="white";k.prototype.button="#777777";k.prototype.location="#EFEFEF";k.prototype.selection="#cedce7";k.prototype.sidepanel="#F7F7F7";k.prototype.mainpanel="white";k.prototype.navtext="#bfbfbf";k.prototype.content="#3087B3";k.prototype.search="#444";k.prototype.toolpanel="white";k.prototype.writeNavigationStyle=function(){var j="",h=[],a=new i.ThemeClass("orionPage");
a.style.backgroundColor="#fdfdfd";a.style.width="100%";a.style.height="100%";h.push(a);a=new i.ThemeClass("topRowBanner");a.style.margin="0";a.style.border="0";a.style.backgroundColor=this.navbar;a.style.height="16px";a.style.padding="10px";a.style.paddingLeft="6px";a.style.paddingRight="2px";a.style.borderBottom="none";a.style.boxShadow="0 2px 2px 0 rgba(0, 0, 0, 0.1),0 1px 0 0 rgba(0, 0, 0, 0.1)";a.style.zIndex="100";h.push(a);a=new i.ThemeClass("a");a.style.textDecoration="none";a.style.color=
this.content;h.push(a);a=new i.ThemeClass("navlink");a.style.display="inline-block";a.style.padding="2px";a.style.color=this.content;a.style.verticalAlign="bottom";h.push(a);a=new i.ThemeClass("primaryNav");a.style.color=this.navtext;a.style.fontSize="8pt";a.style.fontWeight="normal";a.style.paddingTop="0";a.style.verticalAlign="baseline";h.push(a);a=new i.ThemeClass("primaryNav a");a.style.fontSize="8pt";a.style.color=this.navtext;a.style.marginRight="6px";a.style.marginLeft="6px";a.style.verticalAlign=
"baseline";a.style.textDecoration="none";h.push(a);a=new i.ThemeClass("primaryNav a:hover");a.style.color="#bfbfbf";a.style.cursor="hand";a.style.color="white";a.style.fontWeight="normal";h.push(a);for(var g in h)j+=h[g].toString();return j};k.prototype.writeLocationStyle=function(){var j="",h=[],a=new i.ThemeClass("titleArea");a.style.margin="0";a.style.paddingTop="5px";a.style.border="0";a.style.background=this.location;a.style.background="-webkit-gradient(linear, left top, left bottom, color-stop(0%,"+
this.location+"), color-stop(100%,"+this.location+"))";a.style.borderBottom="1px solid "+this.location;a.style.minHeight="20px";h.push(a);a=new i.ThemeClass("breadcrumb");a.style.fontSize="8pt";a.style.textDecoration="none";a.style.color="#f1f1f2;";a.style.paddingTop="2px";h.push(a);a=new i.ThemeClass("a.breadcrumb:hover");a.style.textDecoration="none";a.style.borderBottom="1px dotted";a.style.color="#F58B0F";a.style.cursor="pointer";h.push(a);a=new i.ThemeClass("breadcrumbSeparator");a.style.fontSize=
"8pt";a.style.textDecoration="none";a.style.color=this.separator;a.style.fontWeight="bold";h.push(a);a=new i.ThemeClass("currentLocation");a.style.fontWeight="bold";a.style.fontSize="8pt";a.style.color=this.breadcrumb;a.style.textDecoration="none";a.style.textWrap="normal";a.style.lineHeight="10pt";h.push(a);a=new i.ThemeClass("a.currentLocation:hover");a.style.fontWeight="bold";a.style.fontSize="10pt";a.style.color="#666666";a.style.textDecoration="none";a.style.borderBottom="0";h.push(a);a=new i.ThemeClass("navlinkonpage");
a.style.color=this.content;a.style.verticalAlign="middle";h.push(a);if(this.bannerProgress)a=new i.ThemeClass("topRowBanner .progressPane_running"),a.style.borderColor=this.bannerProgress,h.push(a);for(var g in h)j+=h[g].toString();return j};k.prototype.writeButtonStyle=function(){var j="",h=[],a=new i.ThemeClass("commandButton");a.style.color="#666";a.style.border="1px solid #dedede";a.style.backgroundColor="#ddd";a.style.textAlign="center";a.style.verticalAlign="middle";a.style.cursor="pointer";
a.style.display="inline-block";a.style.padding="4px 6px";a.style.borderRadius="3px";a.style.lineHeight="12px";a.style.fontSize="9pt";a.style.userSelect="none";h.push(a);a=new i.ThemeClass("commandButton:over");a.style.backgroundColor="#e6e6e6";a.style.border="1px solid #808080";h.push(a);a=new i.ThemeClass("commandMenu");a.style.color="#222";a.style.display="inline-block";a.style.verticalAlign="baseline";a.style.margin="0";a.style.fontSize="8pt";a.style.fontWeight="normal";a.style.border="1px solid #dedede";
a.style.backgroundColor="#efefef";a.style.cursor="pointer";a.style.borderRadius="1px";h.push(a);a=new i.ThemeClass("commandMenuItem");a.style.border="0";a.style.padding="0";a.style.margin="0";h.push(a);for(var g in h)j+=h[g].toString();return j};k.prototype.writeMainStyle=function(){var j="",h=[],a=new i.ThemeClass("searchbox");a.style.backgroundImage="url(../images/core_sprites.png)";a.style.backgroundRepeat="no-repeat";a.style.backgroundPosition="4px -297px";a.style.width="12px";a.style.height=
"12px";a.style.backgroundColor=this.search;a.style.border="1px solid "+this.search;a.style.fontSize="11px";a.style.width="15em";a.style.height="16px";a.style.borderRadius="10px";a.style.color="#999";a.style.padding="0";a.style.paddingLeft="20px";a.style.marginLeft="5px";a.style.marginTop="6px !important";a.style.font="7pt Lucida Sans Unicode,Lucida Grande,Verdana,Arial,Helvetica,Myriad,Tahoma,clean,sans-serif !important";h.push(a);a=new i.ThemeClass("searchbox:focus");a.style.color="white";a.style.outline=
"none";h.push(a);a=new i.ThemeClass("checkedRow");a.style.cssText="background-color:"+this.selection+" !important;";h.push(a);a=new i.ThemeClass("navbar-item-selected");a.style.background=this.selection;a.style.color=this.content;h.push(a);a=new i.ThemeClass("auxpane");a.style.border="0";a.style.background=this.sidepanel;h.push(a);a=new i.ThemeClass("mainpane");a.style.background=this.mainpanel;a.style.border=0;h.push(a);a=new i.ThemeClass("mainToolbar");a.style.background=this.toolpanel;h.push(a);
for(var g in h)j+=h[g].toString();return j};k.prototype.render=function(){console.log(this.writeNavigationStyle());console.log(this.writeLocationStyle());console.log(this.writeMainStyle());console.log(this.writeButtonStyle())};k.prototype.getSheet=function(i){i.navbar.value?(this.navbar=i.navbar.value,this.button=i.button.value,this.location=i.location.value,this.selection=i.selection.value,this.sidepanel=i.sidepanel.value,this.mainpanel=i.mainpanel.value,this.navtext=i.navtext.value,this.search=
i.search.value,this.content=i.content.value,this.toolpanel=i.toolpanel.value,this.bannerProgress=i.bannerProgress.value):(this.navbar=i.navbar,this.button=i.button,this.location=i.location,this.selection=i.selection,this.sidepanel=i.sidepanel,this.mainpanel=i.mainpanel,this.navtext=i.navtext,this.search=i.search,this.content=i.content,this.toolpanel=i.toolpanel,this.bannerProgress=i.bannerProgress);return this.writeNavigationStyle()+this.writeLocationStyle()+this.writeMainStyle()+this.writeButtonStyle()};
return{ThemeSheetWriter:k}});
define("orion/widgets/themes/container/ThemeData",["i18n!orion/settings/nls/messages","orion/editor/textTheme","orion/widgets/themes/container/ThemeSheetWriter"],function(i,k,j){function h(){}function a(){this.styles=[];var a=new h;a.name="Orion";a.navbar="white";a.button="#EFEFEF";a.location="#efefef";a.selection="FEC";a.sidepanel="#FBFBFB";a.mainpanel="white";a.toolpanel="white";a.navtext="#bfbfbf";a.content="#3087B3";a.search="#444";a.breadcrumb="#3087B3";a.separator="#333";a.bannerProgress="whitesmoke";
this.styles.push(a);a=new h;a.name="Orion2014";a.navbar="white";a.button="#EFEFEF";a.location="#EFEFEF";a.selection="FEC";a.sidepanel="#EEEEEE";a.mainpanel="#EEEEEE";a.toolpanel="#EEEEEE";a.navtext="#BFBFBF";a.content="#333333";a.search="#444444";a.breadcrumb="#333333";a.separator="#333333";a.bannerProgress="orange";this.styles.push(a);a=new h;a.name="Green Zone";a.navbar="seagreen";a.button="lavender";a.location="darkseagreen";a.selection="moccasin";a.sidepanel="aliceblue";a.mainpanel="white";a.toolpanel=
"white";a.navtext="#FBFBFB";a.content="darkgreen";a.search="darkgreen";a.breadcrumb="#3087B3";a.separator="seagreen";a.bannerProgress="#F2F2F2";this.styles.push(a);a=new h;a.name="Pretty In Pink";a.navbar="plum";a.button="lavender";a.location="pink";a.selection="lavender";a.sidepanel="seashell";a.mainpanel="white";a.toolpanel="white";a.navtext="#FBFBFB";a.content="mediumorchid";a.search="violet";a.breadcrumb="#3087B3";a.separator="plum";a.bannerProgress="#F2F2F2";this.styles.push(a);a=new h;a.name=
"Blue Monday";a.navbar="cornflowerblue";a.button="lavender";a.location="skyblue";a.selection="lavender";a.sidepanel="aliceblue";a.mainpanel="white";a.toolpanel="white";a.navtext="#FBFBFB";a.content="royalblue";a.search="royalblue";a.breadcrumb="#3087B3";a.separator="cornflowerblue";a.bannerProgress="#F2F2F2";this.styles.push(a);a=new h;a.name="Vanilla Skies";a.navbar="sandybrown";a.button="lemmonchiffon";a.location="cornsilk";a.selection="lemonchiffon";a.sidepanel="white";a.mainpanel="white";a.toolpanel=
"white";a.navtext="lemonchiffon";a.content="chocolate";a.search="moccasin";a.breadcrumb="#3087B3";a.separator="sandybrown";a.bannerProgress="#F2F2F2";this.styles.push(a);a=new h;a.name="Beetlejuice";a.navbar="indigo";a.button="slateblue";a.location="darkslateblue";a.selection="silver";a.sidepanel="lavender";a.mainpanel="white";a.toolpanel="white";a.navtext="#FBFBFB";a.content="mediumslateblue";a.search="#444";a.breadcrumb="#3087B3";a.separator="indigo";a.bannerProgress="#F2F2F2";this.styles.push(a);
a=new h;a.name="Red";a.navbar="#CD2127";a.button="#777777";a.location="#D85F56";a.selection="lightcoral";a.sidepanel="#EFDAB2";a.mainpanel="#FDFADD";a.toolpanel="#FDFADD";a.navtext="#FBFBFB";a.content="darkred";a.search="#D85F56";a.breadcrumb="darkred";a.separator="#CD2127";a.bannerProgress="#F2F2F2";this.styles.push(a)}function g(){return this.styles}h.prototype.name="Orion";h.prototype.navbar="#404648";h.prototype.button="#EFEFEF";h.prototype.location="#333";h.prototype.breadcrumb="#3087B3";h.prototype.separator=
"#333";h.prototype.selection="FEC";h.prototype.sidepanel="#FBFBFB";h.prototype.mainpanel="white";h.prototype.toolpanel="white";h.prototype.navtext="#bfbfbf";h.prototype.content="#3087B3";h.prototype.search="#444";h.prototype.bannerProgress="white";a.prototype.styles=[];a.prototype.getStyles=g;a.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"styles",defaultTheme:"Orion2014",selectedKey:"selected",version:"5.0"}};a.prototype.getViewData=function(){var a={top:10,left:10,
width:350,height:350};a.shapes=[{type:"RECTANGLE",name:i["Navigation Bar"],x:10,y:10,width:350,height:32,family:"navbar",fill:"#333",order:1},{type:"TEXT",name:i["Navigation Text"],label:"UserName",x:290,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif"},{type:"ROUNDRECTANGLE",name:i["Search Box"],x:215,y:20,width:70,height:12,family:"search",fill:"#444",order:3},{type:"RECTANGLE",name:i["Tool Panel"],x:150,y:71,width:209,height:30,family:"toolpanel",fill:"white",order:4},{type:"RECTANGLE",
name:i["Selection Bar"],x:155,y:133,width:200,height:20,family:"selection",fill:"#FEC",order:7},{type:"RECTANGLE",name:i.Location,x:10,y:42,width:350,height:29,family:"location",fill:"#efefef",order:8},{type:"TEXT",name:i["Navigation Text"],label:"Navigator",x:60,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif",order:2},{type:"TEXT",name:i.Content,label:"Breadcrumb",x:15,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},{type:"TEXT",name:i.Content,label:"/",x:78,y:60,family:"content",
fill:"#3087B3",font:"8pt sans-serif",order:9},{type:"TEXT",name:i.Content,label:"Location",x:84,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},{type:"RECTANGLE",name:i["Main Panel"],x:150,y:101,width:209,height:258,family:"mainpanel",fill:"white",order:6},{type:"ROUNDRECTANGLE",name:i.Button,x:155,y:76,width:37,height:20,family:"button",fill:"#EFEFEF",order:11},{type:"TEXT",name:i["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:i["Section Text"],label:"Section",x:30,y:94,family:"navbar",fill:"#333",font:"8pt sans-serif"},{type:"LINE",name:i["Line Color"],x1:150,y1:101,x2:360,y2:101,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:i["Line Color"],x1:150,y1:71,x2:150,y2:360,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:i["Line Color"],
x1:20,y1:100,x2:140,y2:100,linewidth:2,fill:"#DEDEDE"},{type:"RECTANGLE",name:i["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:i["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 f=0;f<3;f++)a.shapes.push({type:"TEXT",name:i.Content,label:"org.eclipse.orion.content",x:170,y:127+20*f,fill:"#3087B3",family:"content"});for(f=0;f<3;f++)a.shapes.push({type:"TEXT",name:i.Content,label:"Item",x:25,y:115+20*f,fill:"#3087B3",family:"content"});for(f=0;f<3;f++)a.shapes.push({type:"TRIANGLE",
name:"twisty",x1:160,y1:121+f*20,x2:165,y2:124+f*20,x3:160,y3:127+f*20,family:"navbar",fill:"#333"});a.shapes.push({type:"IMAGE",name:"logo",x:15,y:18,source:"../../images/orion-transparent.png",family:"logo"});return a};a.prototype.processSettings=function(a){var f=new j.ThemeSheetWriter;(new k.TextTheme.getTheme("orionTheme")).setThemeClass("orionTheme",f.getSheet(a))};return{ThemeData:a,getStyles:g}});
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","FileName FolderName":"FileName FolderName(Optional)","Searching...":"Searching...","Searching for occurrences of":'Searching for occurrences of: "${0}"',
name:"name","orion.widgets.UserMenu":"orion.widgets.UserMenu",test:"test","Sign Out":"Sign Out","Sign Out ":"Sign Out ","</a>":"</a>",">":">","Sign In To ":"Sign In To ","Sign In":"Sign In",Help:"Help","Report a Bug":"Report a Bug","Keyboard Shortcuts":"Keyboard Shortcuts",Settings:"Settings","View profile of ":"View profile of ",Profiles:"Profiles","Information Needed":"Information Needed",Cancel:"Cancel","If the same file exists in both the source and destination:":"If the same file exists in both the source and destination:",
"Cancel the transfer":"Cancel the transfer","Always overwrite destination":"Always overwrite destination","Overwrite if source is newer":"Overwrite if source is newer",New:"New","Building file skeleton...":"Building file skeleton...",Add:"Add","Upload...":"Upload...","For a list of available commands type '${0}'.":"For a list of available commands type '${0}'.","Main Pages":"Main Pages","Related Links":"Related Links"});
define("orion/widgets/nls/messages",["orion/i18n!orion/widgets/nls/messages","orion/widgets/nls/root/messages"],function(i,k){var j={root:k};Object.keys(i).forEach(function(h){typeof j[h]==="undefined"&&(j[h]=i[h])});return j});
define("orion/widgets/userAssistance/UATaskPanel",["orion/webui/littlelib"],function(i){function k(j,h,a){this.elements=a;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);h===!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),i.addAutoDismiss([this.container],this.destroy.bind(this))):j.appendChild(this.taskPanel);this.chosenSwitch=this.createSwitch(null,!0);this.chosenSwitch.firstChild.className="chosenCircle";this.initialize();this.elements.forEach(this.createSwitch.bind(this))}k.prototype.elementNode=null;k.prototype.switchesContainer=null;k.prototype.switches=null;k.prototype.radioButtons=null;k.prototype.chosenSwitch=null;k.prototype.addElement=
function(i){var h=document.createElement("span");h.className="UAContainer-icon";h.innerHTML='<span class="workingSpan"><img src="'+i.image+'" id="'+i.label+'ImageNode" alt="'+i.alt+'" height="64" width="64"></span><span class="UAIcon-label"><span class="UALabel" id="'+i.label+'LabelNode" >'+i.label+"</span></span>";h.onmouseover=function(){document.getElementById(i.label+"ImageNode").src=i.secondaryImage;document.getElementById(i.label+"LabelNode").className="UALabel-live";h.className="UAContainer-icon-live"};
h.onmouseout=function(){document.getElementById(i.label+"ImageNode").src=i.image;document.getElementById(i.label+"LabelNode").className="UALabel";h.className="UAContainer-icon"};var a=this;h.onclick=function(){a.showMedia(i)};this.elementNode.appendChild(h)};k.prototype.clearElements=function(){this.elementNode.innerHTML=""};k.prototype.showMedia=function(i){this.clearElements();this.addElement(i);var h=document.createElement("span");h.className="UAContainer-media";h.innerHTML='<div></div><div></div><span class="mediaSpan"><img src="'+
i.media+'" alt="'+i.alt+'" height="300" width="400"></span>';this.elementNode.appendChild(h);setTimeout(function(){h.style.opacity=1},100);i=document.getElementById(i.label+"switch");this.chosenSwitch.firstChild.className="circle";this.chosenSwitch=i.parentNode;i.className="chosenCircle"};k.prototype.createSwitch=function(i){var h;h=i?i.label+"switch":"indexSwitch";var a=document.createElement("span");a.className="workingSpan";a.innerHTML='<div class="circle" id ="'+h+'"></div>';var g=this;a.onclick=
i?function(){g.showMedia(i)}:function(){g.initialize();g.chosenSwitch.firstChild.className="circle";g.chosenSwitch=a;g.chosenSwitch.firstChild.className="chosenCircle"};this.switches.appendChild(a);return this.radioButtons[this.radioButtons.length]=a};k.prototype.initialize=function(){this.clearElements();this.elements.forEach(this.addElement.bind(this))};k.prototype.destroy=function(){document.body.removeChild(this.backdrop);document.body.removeChild(this.container)};return k});
define("orion/webui/dialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/uiUtils"],function(i,k,j,h){function a(){}var g=null;a.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 a=document.body;this.$frameParent=a;this.$$modalExclusions=this.$$modalExclusions||[];var f=document.createRange();f.selectNode(a);f=f.createContextualFragment(this.CONTAINERTEMPLATE);a.appendChild(f);this.$frame=a.lastChild;this.title&&j.$("#title",this.$frame).appendChild(document.createTextNode(this.title));this.$close=j.$("#closeDialog",this.$frame);var d=this;this.$close.addEventListener("click",function(){d.hide()},!1);this.$parent=j.$(".dialogContent",this.$frame);
f=document.createRange();f.selectNode(this.$parent);a=f.createContextualFragment(this.TEMPLATE);this.messages&&j.processTextNodes(a,this.messages);this.$parent.appendChild(a);this.$buttonContainer=j.$(".dialogButtons",this.$frame);this._makeButtons();this.$frame.addEventListener("keydown",function(c){c.keyCode===j.KEY.ESCAPE?d.hide():c.keyCode===j.KEY.ENTER&&typeof d._defaultCallback==="function"&&d._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 a=this;this.buttons.forEach(function(f){var d=h.createButton(f.text,f.callback);if(f.id)d.id=f.id,a["$"+d.id]=d;if(f.isDefault)a._defaultCallback=f.callback,a._defaultButton=d;a.$buttonContainer.appendChild(d)})}},_makeModal:function(){var a=this;this.$frame.addEventListener("blur",function(b){a.$lastFocusedElement=b.target},!0);this._modalListener=function(b){var c=!j.contains(a.$frame,
b.target);if(c)for(var d=0;d<a.$$modalExclusions.length;d++)if(j.contains(a.$$modalExclusions[d],b.target)){c=!1;break}c&&(window.setTimeout(function(){(a.$lastFocusedElement||a.$parent).focus()},0),j.stop(b))};this.$frameParent.addEventListener("focus",this._modalListener,!0);this.$frameParent.addEventListener("click",this._modalListener,!0);var f=this.$frameParent.childNodes,d=!1;this._addedBackdrop=[];for(var c=0;c<f.length;c++){for(var b=0;b<this.$$modalExclusions.length;b++)if(j.contains(this.$$modalExclusions[b],
f[c])){d=!0;break}!d&&f[c]!==a.$frame&&f[c].classList&&!f[c].classList.contains("tooltipContainer")&&(b=f[c],b.classList.contains("modalBackdrop")||(b.classList.add("modalBackdrop"),this._addedBackdrop.push(b)))}(f=j.lastTabbable(this.$buttonContainer)||j.lastTabbable(this.$parent))&&f.addEventListener("keydown",function(b){if(b.keyCode===j.KEY.TAB){var c=a._getFirstFocusField();c&&c!==b.target&&c.focus();j.stop(b)}},!1)},_addChildDialog:function(a){this.$$modalExclusions.push(a.$frame||a.$parent)},
_inModalExclusion:function(a){return this.$$modalExclusions.some(function(f){return a.$frame===f||a.$parent===f})},_bindElements:function(a){for(var f=0;f<a.childNodes.length;f++){var d=a.childNodes[f];d.id&&(this["$"+d.id]=d);this._bindElements(d)}},hide:function(a){!a&&g===this&&(g=null);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");j.setFramesEnabled(!0);typeof this._afterHiding==="function"&&this._afterHiding();var f=this;this.keepAlive||window.setTimeout(function(){f.destroy()},0)},show:function(a){if(this.modal)if(g){if(!g._inModalExclusion(this)){this.hide(!0);return}}else g=this;typeof this._beforeShowing==="function"&&this._beforeShowing();j.setFramesEnabled(!1);var f=j.bounds(this.$frame),d=j.bounds(document.documentElement),c;a?(c=j.bounds(a),a=c.top+c.height+4,c=c.left+
4,a+f.height>d.height&&(a=Math.max(0,d.height-f.height-4)),c+f.width>d.width&&(c=Math.max(0,d.width-f.width-4))):(c=Math.max(0,(d.width-f.width)/2),a=Math.max(0,(d.height-f.height)/2));this.$lastFocusedElement=document.activeElement;this.$frame.style.top=a+"px";this.$frame.style.left=c+"px";this.$frame.classList.add("dialogShowing");typeof this._afterShowing==="function"&&this._afterShowing();this.customFocus||this._getFirstFocusField().focus()},_getFirstFocusField:function(){return j.firstTabbable(this.$parent)||
this._defaultButton||j.firstTabbable(this.$buttonContainer)||this.$close},destroy:function(){if(this.$frame)g===this&&(g=null),j.setFramesEnabled(!0),this._addedBackdrop&&this._addedBackdrop.length>0&&this._addedBackdrop.forEach(function(a){a.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}};a.prototype.constructor=
a;return{Dialog:a}});
define("orion/widgets/UserMenu","i18n!orion/widgets/nls/messages,require,orion/webui/littlelib,orion/PageLinks,orion/widgets/userAssistance/UATaskPanel,orion/webui/dialog".split(","),function(i,k,j,h,a){function g(a){this._displaySignOut=!0;this._init(a)}g.prototype={_init:function(a){this._dropdownNode=j.node(a.dropdownNode);if(!this._dropdownNode)throw"no dom node for dropdown found";this._dropdown=a.dropdown;this._serviceRegistry=a.serviceRegistry;this.authenticatedServices={};this.unauthenticatedServices=
{};this._noSeparator=a.noSeparator;this._dropDownItemClass=a.dropDownItemClass;this._keyAssistClass=a.keyAssistClass;if(a.signOut!==void 0)this._displaySignOut=a.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(a){var f=0,d;for(d in a)a.hasOwnProperty(d)&&f++;return f},_makeMenuItem:function(a,
f){var d=document.createElement("span");d.role="menuitem";d.tabIndex=0;var c=document.createTextNode(a);d.appendChild(c);typeof this._dropDownItemClass==="string"?this._dropDownItemClass!==""&&d.classList.add(this._dropDownItemClass):d.classList.add("dropdownMenuItem");d.addEventListener("click",f,!1);d.addEventListener("keydown",function(b){(b.keyCode===j.KEY.ENTER||b.keyCode===j.KEY.SPACE)&&f()},!1);return d},_renderAuthenticatedService:function(a){var f=this,d=this.authenticatedServices[a].authService;
if(d&&d.logout&&this._displaySignOut){var c=document.createElement("li"),b=this._makeMenuItem(i["Sign Out"],function(){d.logout().then(function(){f.addUserItem(a,d,f.authenticatedServices[a].label);localStorage.removeItem(a);localStorage.removeItem("lastLogin");for(var b=localStorage.length-1;b>=0;b--){var c=localStorage.key(b);c&&c.indexOf("/orion/preferences/user")===0&&localStorage.removeItem(c)}d.getAuthForm(window.location.href).then(function(b){window.location=b})})});c.appendChild(b);this._dropdownNode.appendChild(c)}},
renderServices:function(){function a(b){d[b]||(d[b]=f.createDocumentFragment());return d[b]}var f=document,d=[],c=this._serviceRegistry;h.getPageLinksInfo(c,"orion.page.link.user").then(function(b){this._dropdown?this._dropdown.empty():this._dropdownNode&&j.empty(this._dropdownNode);b.getAllLinks().forEach(function(b){var c,d;if(b.category&&(d=/user\.(\d+)/.exec(b.category)))c=parseInt(d[1],10);if(typeof c!=="number"||isNaN(c))c=1;c=a(c);d=f.createElement("li");var l=f.createElement("a");l.role="menuitem";
typeof this._dropDownItemClass==="string"?this._dropDownItemClass!==""&&l.classList.add(this._dropDownItemClass):l.classList.add("dropdownMenuItem");l.href=b.href;l.textContent=b.textContent;d.appendChild(l);c.appendChild(d);l.addEventListener("keydown",function(b){(b.keyCode===j.KEY.ENTER||b.keyCode===j.KEY.SPACE)&&l.click()},!1)}.bind(this));if(this.keyAssistFunction){var b=document.createElement("li"),l=this._makeMenuItem(i["Keyboard Shortcuts"],this.keyAssistFunction);typeof this._keyAssistClass===
"string"?this._keyAssistClass!==""&&l.classList.add(this._keyAssistClass):l.classList.add("key-assist-menuitem");b.appendChild(l);a(0).appendChild(b)}if(b=c.getServiceReferences("orion.page.getstarted")[0])l=b.getProperty("data"),b=document.createElement("li"),l=this._makeMenuItem("Getting Started",this.getStartedDialog.bind(this,l)),b.appendChild(l),a(0).appendChild(b);var g=this;d.sort(function(b,c){return b-c}).forEach(function(b,c){if(c<d.length-1&&!this._noSeparator){var a=document.createElement("li");
a.classList.add("dropdownSeparator");var f=document.createElement("span");f.classList.add("dropdownSeparator");a.appendChild(f);b.appendChild(a)}g._dropdownNode.appendChild(b)}.bind(this));if(this.isSingleService())for(var h in this.authenticatedServices)this.authenticatedServices.hasOwnProperty(h)&&this._renderAuthenticatedService(h,0)}.bind(this))},getStartedDialog:function(e){new a(null,!0,e)},setKeyAssist:function(a){this.keyAssistFunction=a;this.renderServices()},addUserItem:function(a,f,d,c){c?
(this.unauthenticatedServices[a]&&delete this.unauthenticatedServices[a],this.authenticatedServices[a]={authService:f,label:d,data:c}):(this.authenticatedServices[a]&&delete this.authenticatedServices[a],this.unauthenticatedServices[a]=this.unauthenticatedServices[a]?{authService:f,label:d,pending:this.unauthenticatedServices[a].pending}:{authService:f,label:d});this.renderServices()}};g.prototype.constructor=g;return{UserMenu:g}});
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(i,k){var j={root:k};Object.keys(i).forEach(function(h){typeof j[h]==="undefined"&&(j[h]=i[h])});return j});
define("orion/searchUtils","i18n!orion/nls/messages,require,orion/regex,orion/commandRegistry,orion/PageUtil,orion/URITemplate".split(","),function(i,k,j,h,a,g){function e(a,c,b){var f="";b&&(f="^");if(f=j.parse("/"+f+a.searchStr+"/"))b=f.pattern,f=f.flags,f.indexOf("i")===-1&&!c.caseSensitive&&(f+="i"),a.regExp={pattern:b,flags:f},a.wildCard=!0}var f={ALL_FILE_TYPE:"*.*"};f.doSearch=function(a,c,b,e){if(a){var g=!0;b==="*"&&(b="");b===""&&(g=e&&e.type!==f.ALL_FILE_TYPE);if(g)b!==""&&f.addRecentSearch(c,
b,e?e.regEx:!1),a=a.createSearchParams(b,!1,!1,e),a=f.generateSearchHref(a),window.location=a}else window.alert(i["Can't search: no search service is available"])};f.generateSearchHelper=function(a,c){var b=a.keyword,g=b,h={};a.fileType&&a.fileType!==f.ALL_FILE_TYPE&&b===""&&(g="*."+a.fileType);if(a.regEx)h.searchStr=b,e(h,a,c);else{var i=b.indexOf("*")>-1,o=b.indexOf("?")>-1;i&&(b=b.split("*").join(".*"));o&&(b=b.split("?").join("."));!i&&!o&&!a.nameSearch?(h.searchStr=a.caseSensitive?b.split("\\").join(""):
b.split("\\").join("").toLowerCase(),h.wildCard=!1):(h.searchStr=a.caseSensitive?b:b.toLowerCase(),e(h,a,c),h.wildCard=!0)}h.searchStrLength=h.searchStr.length;return{params:a,inFileQuery:h,displayedSearchTerm:g}};f.convertSearchParams=function(a){if(a.rows!==void 0)a.rows=parseInt(a.rows,10);if(a.start!==void 0)a.start=parseInt(a.start,10);if(typeof a.regEx==="string")a.regEx=a.regEx.toLowerCase()==="true";if(typeof a.caseSensitive==="string")a.caseSensitive=a.caseSensitive.toLowerCase()==="true";
if(typeof a.nameSearch==="string")a.nameSearch=a.nameSearch.toLowerCase()==="true"};f.copySearchParams=function(a,c){var b={},f;for(f in a)if(a[f]!==void 0&&a[f]!==null&&(c||f!=="replace"))b[f]=a[f];return b};f.generateSearchHref=function(a){var c=k.toUrl("search/search.html"),a=f.copySearchParams(a,!0),b=a.resource;a.resource=void 0;return typeof a.keyword!=="undefined"?(new g(c+"#{,resource,params*}")).expand({resource:b,params:a}):(new g(c+"#{,resource}")).expand({resource:b})};f.generateFindURLBinding=
function(a,c,b,f,e){a={find:c.searchStr,regEx:c.wildCard?!0:void 0,caseSensitive:a.caseSensitive?!0:void 0,replaceWith:typeof f==="string"?f:void 0,atLine:typeof b==="number"?b:void 0};return e?a:","+(new g("{,params*}")).expand({params:a})};f.convertFindURLBinding=function(a){if(typeof a.regEx==="string")a.regEx=a.regEx.toLowerCase()==="true";if(typeof a.caseSensitive==="string")a.caseSensitive=a.caseSensitive.toLowerCase()==="true";if(typeof a.atLine==="string")a.atLine=parseInt(a.atLine,10)};f.replaceRegEx=
function(a,c,b){return a.replace(RegExp(c.pattern,c.flags),b)};f.replaceStringLiteral=function(a,c,b){c=j.parse("/"+c+"/gim");return f.replaceRegEx(a,c,b)};f.searchOnelineLiteral=function(a,c,b){var f;f=0;for(var e=!1,g=[];;)if(f=c.indexOf(a.searchStr,f),f<0)break;else{g.push({startIndex:f,length:a.searchStrLength});e=!0;if(b)break;f+=a.searchStrLength}return e?g:null};f.findRegExp=function(a,c,b,f){if(!c)return null;b=b||"";b+=(b.indexOf("g")===-1?"g":"")+(b.indexOf("m")===-1?"m":"");var e=null;
return(e=RegExp(c,b).exec(a.substring(f)))&&{startIndex:e.index+f,length:e[0].length}};f.searchOnelineRegEx=function(a,c,b){for(var e=0,g=!1,h=[];;)if(e=f.findRegExp(c,a.regExp.pattern,a.regExp.flags,e)){h.push(e);g=!0;if(b)break;e=e.startIndex+e.length}else break;return g?h:null};f.generateNewContents=function(a,c,b,e,g,h){if(e&&c){if(!a)b.contents=[];for(var o=0;o<c.length;o++){for(var i=c[o],j=!1,k=!1,r=[],u,v=0,n=0;n<e.children.length;n++)if(e.children[n].lineNumber-1===o){v=n;for(j=0;j<e.children[n].matches.length;j++)e.children[n+
j].checked!==!1&&r.push(j);k=r.length>0;u=e.children[n].matches;j=!0;break}if(j){if(k){r=f.replaceCheckedMatches(i,g,u,r,h);i=r.replacedStr;for(j=0;j<e.children[v].matches.length;j++)e.children[v+j].newMatches=r.newMatches}else for(j=0;j<e.children[v].matches.length;j++)e.children[v+j].newMatches=e.children[v+j].matches;a?b.contents[o]=i:b.contents.push(i)}else a||b.contents.push(i)}}};f.generateMatchContext=function(a,c,b){var f=[],e=a*2+1,g;c.length<=e?(g=0,a=c.length-1):(g=b-a,g<0?(g=0,a=g+e-1):
(a=b+a,a>c.length-1&&(a=c.length-1,g=a-e+1)));for(e=g;e<=a;e++)f.push({context:c[e],current:e===b});return f};f.splitFile=function(a){for(var c=0,b=0,f=0,e=0,g=[];;){c!==-1&&c<=f&&(c=a.indexOf("\r",f));b!==-1&&b<=f&&(b=a.indexOf("\n",f));if(b===-1&&c===-1){g.push(a.substring(e));break}var h=1;c!==-1&&b!==-1?c+1===b?(h=2,f=b+1):f=(c<b?c:b)+1:f=c!==-1?c+1:b+1;g.push(a.substring(e,f-h));e=f}return g};f.searchWithinFile=function(a,c,b,e,g,h){b=f.splitFile(b);if(g)c.contents=b;if(c){c.children=[];for(var o=
e=0;o<b.length;o++){var i=b[o];if(i&&i.length>0){var j=h?i:i.toLowerCase();if(j=a.wildCard?f.searchOnelineRegEx(a,j):f.searchOnelineLiteral(a,j)){var k,r=o+1;if(g)for(var u=0;u<j.length;u++)k=u+1,k={parent:c,checked:c.checked,type:"detail",matches:j,lineNumber:r,matchNumber:k,name:i,location:c.location+"-"+r+"-"+k},c.children.push(k);else k={parent:c,context:f.generateMatchContext(2,b,o),checked:c.checked,type:"detail",matches:j,lineNumber:r,name:i,location:c.location+"-"+r},c.children.push(k);e+=
j.length}}}c.totalMatches=e}};f.replaceCheckedMatches=function(a,c,b,f,e){for(var g=0,h="",i=[],j=0;j<b.length;j++){g!==b[j].startIndex&&(h+=a.substring(g,b[j].startIndex));if(b[j].length)e=b[j].length;for(var g=!1,k=0;k<f.length;k++)if(f[k]===j){g=!0;break}g?(i.push({startIndex:h.length,length:c.length}),h+=c):(i.push({startIndex:h.length,length:e}),h+=a.substring(b[j].startIndex,b[j].startIndex+e));g=b[j].startIndex+e}g<a.length&&(h+=a.substring(g));return{replacedStr:h,newMatches:i}};f.fullPathNameByMeta=
function(a){var c=a.length,b="";if(c>0)for(c-=1;c>-1;c--)b=b+(b===""?"":"/")+a[c].Name;return b};f.path2FolderName=function(a,c,b){return a.substring(0,a.length-c.length-(b?0:1))};f._storeRecentSearch=function(a,c,b,f){a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){a.put("recentSearch",c);b&&window.setTimeout(function(){b.dispatchEvent({type:"inputDataListChanged",deleting:f})}.bind(this),20)})};f.addRecentSearch=function(a,c,b){typeof c==="string"&&c&&
a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(e){var g,e=e.get("recentSearch");typeof e==="string"&&(e=JSON.parse(e));if(e){for(g in e)if(e[g].name===c)return;e.length>=20&&e.splice(19,e.length-20+1)}else e=[];e.splice(0,0,{name:c,regEx:b});f._storeRecentSearch(a,e)})};f.removeRecentSearch=function(a,c,b){typeof c==="string"&&c&&a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(e){var g,e=e.get("recentSearch");typeof e===
"string"&&(e=JSON.parse(e));if(e)for(g in e)if(e[g].name===c){e.splice(g,1);f._storeRecentSearch(a,e,b,!0);break}})};f.getSearches=function(a,c,b){a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){a=a.get(c);typeof a==="string"&&(a=JSON.parse(a));a&&b&&b(a)})};f.getMixedSearches=function(a,c,b,e){a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){var d=a.get("recentSearch");typeof d==="string"&&(d=JSON.parse(d));c&&(a=
a.get("search"),typeof a==="string"&&(a=JSON.parse(a)),a&&a.forEach(function(c){if(b){var a=f.parseQueryStr(c.query);d.some(function(b){return a.searchStrTitle===b.name})||d.push({name:a.searchStrTitle,label:c.name})}else d.push({name:null,label:c.name,value:c.query})}));d&&e&&e(d)})};f.getOpenSearchPref=function(a,c){a.getService("orion.core.preference").getPreferences("/cm/configurations").then(function(b){b=b.get("nav.config");c(b&&b["links.newtab"]!=="undefined"?b["links.newtab"]?!0:!1:!1)})};
f.setOpenSearchPref=function(a,c){a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){b.put("openSearchPref",{openInNewTab:c})})};return f});
define("orion/crawler/searchCrawler","i18n!orion/crawler/nls/messages,require,orion/i18nUtil,orion/searchUtils,orion/contentTypes,orion/Deferred".split(","),function(i,k,j,h,a,g){function e(a,d,c,b){this.registry=a;this.fileClient=d;this.fileLocations=[];this.fileSkeleton=[];this._totalCounter=this._hitCounter=0;this._searchOnName=b&&b.searchOnName;this._buildSkeletonOnly=b&&b.buildSkeletonOnly;this._fetchChildrenCallBack=b&&b.fetchChildrenCallBack;this._searchParams=c;this.searchHelper=this._searchOnName||
this._buildSkeletonOnly?null:h.generateSearchHelper(c);this._location=b&&b.location;this._childrenLocation=b&&b.childrenLocation?b.childrenLocation:this._location;this._cancelled=!1;this._statusService=this.registry.getService("orion.page.message");this._progressService=this.registry.getService("orion.page.progress");this._statusService&&this._statusService.setCancelFunction(function(){this._cancelFileContentsSearch()}.bind(this))}e.prototype.search=function(a){var d=this.registry.getService("orion.core.contentTypeRegistry");
this._onSearchComplete=a;this._cancelled=!1;this._deferredArray=[];d.getContentTypes().then(function(c){this.contentTypesCache=c;var b=this;this._visitRecursively(this._childrenLocation).then(function(){b._cancelled||b._reportResult()}.bind(b),function(c){b._reportResult();b._statusService&&c.name==="Cancel"&&(console.log("Crawling search cancelled. Deferred array length : "+b._deferredArray.length),b._statusService.setProgressResult({Message:i["Search cancelled by user"],Severity:"Warning"}))}.bind(b))}.bind(this))};
e.prototype.searchName=function(a,d){if(a)this._searchParams=a,this.searchHelper=h.generateSearchHelper(a,!0);if(d)this.onSearchNameComplete=d;var c=[];this._cancelled=!1;this._deferredArray=[];this._sort(this.fileSkeleton);if(this.fileSkeleton.length>0){for(var b=0;b<this.fileSkeleton.length;b++){var e=this.fileSkeleton[b].Name.toLowerCase();if(this.searchHelper.inFileQuery.wildCard?h.searchOnelineRegEx(this.searchHelper.inFileQuery,e,!0):h.searchOnelineLiteral(this.searchHelper.inFileQuery,e,!0))if(c.push(this.fileSkeleton[b]),
c.length>=this.searchHelper.params.rows)break}this.onSearchNameComplete({response:{numFound:c.length,docs:c}})}else this.onSearchNameComplete({response:{numFound:0,docs:[]}})};e.prototype.buildSkeleton=function(a,d){this._buildingSkeleton=!0;var c=this.registry.getService("orion.core.contentTypeRegistry");this._cancelled=!1;this._deferredArray=[];var b=this;a();c.getContentTypes().then(function(c){b.contentTypesCache=c;b._visitRecursively(b._childrenLocation).then(function(){b._buildingSkeleton=!1;
d();b.searchHelper&&!b._buildSkeletonOnly&&b.searchName()})})};e.prototype._sort=function(a){a.sort(function(a,c){var b,e;if(this._searchParams.sort==="Path asc"){b=a.Location&&a.Location.toLowerCase();b=h.path2FolderName(b,a.Name&&a.Name.toLowerCase(),!0);e=c.Location&&c.Location.toLowerCase();e=h.path2FolderName(e,c.Name&&c.Name.toLowerCase(),!0);if(b<e)return-1;if(b>e)return 1}return this._sortOnNameSingle(a,c)}.bind(this))};e.prototype._reportResult=function(){this._sort(this.fileLocations);this._onSearchComplete({response:{numFound:this.fileLocations.length,
docs:this.fileLocations}})};e.prototype._sortOnNameSingle=function(a,d){var c=a.Name&&a.Name.toLowerCase(),b=d.Name&&d.Name.toLowerCase();return c<b?-1:c>b?1:0};e.prototype._onFileType=function(a){return this.searchHelper.params.fileType?this.searchHelper.params.fileType===h.ALL_FILE_TYPE?!0:a.extension.indexOf(this.searchHelper.params.fileType)>=0:!0};e.prototype._visitRecursively=function(e){var d=[],c=this;this._fetchChildrenCallBack&&this._fetchChildrenCallBack(e);return(c._progressService?this._progressService.progress(c.fileClient.fetchChildren(e),
"Crawling search for children of "+e):c.fileClient.fetchChildren(e)).then(function(b){for(var e=0;e<b.length;e++)if(b[e].Directory!==void 0&&b[e].Directory===!1)if(c._searchOnName)d.push(c._buildSingleSkeleton(b[e]));else if(c._buildSkeletonOnly)d.push(c._buildSingleSkeleton(b[e]));else{if(!c._cancelled){var f=a.getFilenameContentType(b[e].Name,c.contentTypesCache);if(f&&(f["extends"]==="text/plain"||f.id==="text/plain")&&c._onFileType(f))f=c._sniffSearch(b[e]),d.push(f),c._deferredArray.push(f)}}else if(b[e].Location)if(c._cancelled)break;
else f=c._visitRecursively(b[e].ChildrenLocation),d.push(f),c._deferredArray.push(f);return g.all(d)})};e.prototype._hitOnceWithinFile=function(a){a=this._searchParams.caseSensitive?a:a.toLowerCase();return this.searchHelper.inFileQuery.wildCard?h.searchOnelineRegEx(this.searchHelper.inFileQuery,a,!0):h.searchOnelineLiteral(this.searchHelper.inFileQuery,a,!0)};e.prototype._reportSingleHit=function(a){if(!this._cancelled)a.LastModified=a.LocalTimeStamp,this.fileLocations.push(a),this._hitCounter++,
this._sort(this.fileLocations),this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}},!0)};e.prototype._cancelFileContentsSearch=function(){(this._cancelled=!0)&&this._deferredArray.forEach(function(a){a.cancel()})};e.prototype._sniffSearch=function(a){this._totalCounter++;var d=this;if(!this._cancelled)if(this.searchHelper.params.keyword==="")this._reportSingleHit(a),this._statusService&&this._statusService.setProgressResult({Message:j.formatMessage(i["${0} files found out of ${1}"],
this._hitCounter,this._totalCounter)});else return(d._progressService?d._progressService.progress(d.fileClient.read(a.Location),"Reading file "+a.Location):d.fileClient.read(a.Location)).then(function(c){d._hitOnceWithinFile(c)&&d._reportSingleHit(a);d._statusService&&d._statusService.setProgressResult({Message:j.formatMessage(i["${0} files found out of ${1}"],d._hitCounter,d._totalCounter)},i.Cancel)},function(a){a&&a.message&&a.message.toLowerCase()!=="cancel"&&console.error("Error loading file content: "+
a.message)})};e.prototype._buildSingleSkeleton=function(a){this._totalCounter++;this.fileSkeleton.push(a);this.searchHelper&&!this._buildSkeletonOnly&&this._totalCounter%100===0&&this.searchName();a=new g;a.resolve(this._totalCounter);return a};e.prototype.constructor=e;return{SearchCrawler:e}});
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(i,k,j,h,a,g,e){function f(a){this._init(a)}f.prototype=new e.Dialog;f.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="'+
h.toUrl("../../../images/progress_running.gif")+'" class="progressPane_running_dialog" id="crawlingProgress"></img></div><div id="results" style="max-height:250px; height:auto; overflow-y:auto;" aria-live="off"></div><div id="statusbar"></div></div>';f.prototype._init=function(a){this.title=a.title||i["Find File Named"];this.modal=!0;this.messages=i;this._searcher=a.searcher;this._progress=a.progress;this._onHide=a.onHide;this._contentTypeService=new j.ContentTypeRegistry(this._searcher.registry);
if(!this._searcher)throw Error("Missing required argument: searcher");this._searchDelay=a.searchDelay||500;this._time=0;this._searcher.setCrawler(null);this._forceUseCrawler=!1;this._initialText=a.initialText;this._message=a.message;this._nameSearch=!0;if(a.nameSearch!==void 0)this._nameSearch=a.nameSearch;this._searchOnRoot=!0;this._fileService=this._searcher.getFileService();if(!this._fileService)throw Error(i["Missing required argument: fileService"]);this._searchRenderer=a.searchRenderer;if(!this._searchRenderer||
typeof this._searchRenderer.makeRenderFunction!=="function")throw Error(i["Missing required argument: searchRenderer"]);this._initialize()};f.prototype._bindToDom=function(d){var c=this;c.$crawlingProgress.style.display="none";this._nameSearch?this.$fileName.setAttribute("placeholder",i["FileName FolderName"]):this.$fileName.setAttribute("placeholder",i.Search);this.$fileName.addEventListener("input",function(){c._time=+new Date;c._timeoutId&&clearTimeout(c._timeoutId);c._timeoutId=setTimeout(c.checkSearch.bind(c),
0)},!1);this.$fileName.addEventListener("keydown",function(b){if(b.keyCode===a.KEY.ENTER){var d=a.$("a",c.$results);if(d)a.stop(b),(g.isMac?b.metaKey:b.ctrlKey)?window.open(d.href):(window.location.href=d.href,c.hide())}},!1);d.addEventListener("keydown",function(b){var d,e,f;if(b.keyCode===a.KEY.DOWN||b.keyCode===a.KEY.UP)d=a.$$array("a",c.$results),e=document.activeElement,f=d.indexOf(e),b.keyCode===a.KEY.DOWN?f>=0?(e.classList.remove("treeIterationCursor"),d=f<d.length-1?d[f+1]:d[0],d.focus(),
d.classList.add("treeIterationCursor")):d.length>0&&(d=-1<d.length-1?d[0]:d[0],d.focus(),d.classList.add("treeIterationCursor")):f>=0?(e.classList.remove("treeIterationCursor"),e=c.$fileName,d=f>0?d[f-1]:e,d.focus(),f>0&&d.classList.add("treeIterationCursor")):d.length>0&&(d[d.length-1].focus(),d[d.length-1].classList.add("treeIterationCursor")),a.stop(b)});d.addEventListener("mouseup",function(b){b.target.focus()},!1);setTimeout(function(){if(c._forceUseCrawler||!c._fileService.getService(c._searcher.getSearchLocation()).search){var b=
c._searchOnRoot?c._searcher.getSearchRootLocation():c._searcher.getChildrenLocation(),b=new k.SearchCrawler(c._searcher.registry,c._fileService,"",{searchOnName:!0,location:b});c._searcher.setCrawler(b);b.buildSkeleton(function(){c.$crawlingProgress.style.display="inline";c.$progress.appendChild(document.createTextNode(i["Building file skeleton..."]))},function(){c.$crawlingProgress.style.display="none";c.$progress.removeChild(c.$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()};f.prototype.checkSearch=function(){clearTimeout(this._timeoutId);var a=(new Date).getTime();a-this._time>this._searchDelay?(this._time=a,this.doSearch()):this._timeoutId=setTimeout(this.checkSearch.bind(this),50)};f.prototype._detectFolderKeyword=function(a){var c,b=a,e=null;if(this._nameSearch&&(c=/(\S+)\s*(.*)/,(a=c.exec(a))&&a.length===3))a[1]&&
(b=a[1]),a[2]&&(e=a[2]);return{keyword:b,folderKeyword:e}};f.prototype.doSearch=function(){var d=this.$fileName.value;if(d){var c=this._detectFolderKeyword(d),b=this._searcher.createSearchParams(c.keyword,this._nameSearch,this._searchOnRoot),e=this._searchRenderer.makeRenderFunction(this._contentTypeService,this.$results,!1,this.decorateResult.bind(this));this.currentSearch=e;var f=document.createElement("div");f.appendChild(document.createTextNode(this._nameSearch?i["Searching..."]:g.formatMessage(i["Searching for occurrences of"],
d)));a.empty(this.$results);this.$results.appendChild(f);this._searcher.search(b,c.folderKeyword,function(){e===this.currentSearch&&e.apply(null,arguments)}.bind(this))}};f.prototype.decorateResult=function(d){function c(a){a.button===0&&!a.ctrlKey&&!a.metaKey&&b.hide()}for(var b=this,d=a.$$array("a",d),e=0;e<d.length;e++)d[e].addEventListener("click",c,!1)};f.prototype._beforeHiding=function(){clearTimeout(this._timeoutId)};f.prototype._afterHiding=function(){this._onHide&&this._onHide()};f.prototype.constructor=
f;return{OpenResourceDialog:f}});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\n\t<div id="staticBanner" class="layoutBlock topRowBanner"> <\!-- primaryNav --\>\n\t\t<div id="centralNavigationArea" style="position:absolute;left:0;top:0;width:39px;height:36px; z-index:1;border-right:1px solid #ddd;"></div>\n\n\t\t<\!-- Static "Home" link. TODO delete this --\>\n\t\t<a id="home" class="layoutLeft "></a>\n\n\t\t<\!-- Left banner component: hamburger --\>\n\t\t<nav id="primaryNav" class="bannerLeftArea" style="z-index:2;" role="navigation">\n\t\t\t\t<button class="centralNavigation commandSprite core-sprite-hamburger" type="button"id="centralNavigation"></button>\n\t\t</nav>\n\n\t\t<\!-- Middle banner component: Breadcrumb bar --\>\n\t\t<div class="clear navigationBreadcrumb bannerMiddleArea" >\n\t\t\t<div id="location" class="currentLocation"></div>\n\t\t</div>\n\n\t\t<\!-- Right banner component: user identity --\>\n\t\t<div class="bannerRightArea" style="z-index:2;">\n\t\t\t<\!-- Global commands support. --\>\n\t\t\t<div id="globalActions" class="spacingLeft layoutLeft"></div>\n\n\t\t\t<\!-- Search. TODO delete this --\>\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\n\t\t\t<\!-- User identity menu and Progress --\>\n\t\t\t<div id="userMenu" class="spacingRight layoutRight" style="color:#ccc;line-height:16px;">\n\t\t\t\t<div style="position: absolute;right: 0px;top:0;width: 39px;height:36px; z-index:-50;border-left: 1px solid #ddd;"></div>\n\n\t\t\t\t<\!-- Progress indicator --\>\n\t\t\t\t<img class="progressPane" id="progressPane" tabindex="0" role="progressbar"></img>\n\n\t\t\t\t<\!-- User identity menu --\>\n\t\t\t\t<span id="userTrigger" tabindex="0" role="button" class="dropdownTrigger" style="z-index:2;">\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\n\t<\!-- IDE notification messages go in here --\>\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'<\!--\n<footer id="footerContent" class="layoutBlock footerLayout" role="contentinfo">\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="https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Orion&version=5.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>\n--\>'});
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<ul class="layoutRight commandList pageActions" id="settingsActions"></ul>\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(i,k){function j(h,a,g){if(h=k.node(h))this._parent=h;else throw Error("Parent node of dropdown menu not found");this.options=g=g||{};this.navDropDownId=this._parent.id+"_navdropdown";this.selectionClass=g.selectionClass;h=document.createElement("div");h.classList.add("dropDownContainer");h.id=this.navDropDownId;h.style.display="none";this._parent.appendChild(h);this._dropdownMenu=h;if(a=k.node(a))this._triggerNode=
a;else throw"Trigger node of dropdown menu not found";if(this._triggerNode.style.visibility==="hidden")this._triggerNode.style.visibility="visible";if(!g.noClick)this._triggerNode.onclick=this.click.bind(this);this._dropdownMenu.addEventListener("keydown",function(a){a.keyCode===k.KEY.ESCAPE&&this.clearPanel()}.bind(this))}i.mixin(j.prototype,{click:function(){this._dropdownMenu.style.display==="none"?this.updateContent(this.getContentNode(),function(){k.setFramesEnabled(!1);this._dropdownMenu.style.display=
"";this._positionDropdown();this.selectionClass&&this._triggerNode.classList.add(this.selectionClass);this.handle=k.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",k.setFramesEnabled(!0),this.selectionClass&&this._triggerNode.classList.remove(this.selectionClass),this.options.onHide))this.options.onHide()},
addContent:function(h){this._dropdownMenu.innerHTML=h},getContentNode:function(){return this._dropdownMenu},updateContent:function(h,a){a()},_positionDropdown:function(){this._dropdownMenu.style.right="";var h=k.bounds(this._dropdownMenu),a=k.bounds(document.body);if(h.left+h.width>a.left+a.width)h=k.bounds(this._boundingNode(this._triggerNode)),a=k.bounds(this._triggerNode),this._dropdownMenu.style.right=h.width-(a.left-h.left+a.width)+"px"},_boundingNode:function(h){var a=window.getComputedStyle(h,
null);return a===null?h:a.getPropertyValue("position")==="absolute"||!h.parentNode||h===document.body?h:this._boundingNode(h.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)k.setFramesEnabled(!0),k.empty(this._parent),this._parent=this.select=null}});return j});define("orion/customGlobalCommands",[],function(){return{}});
define("orion/navigate/nls/root/messages",{"Click one of the tasks below to create an Orion folder.  You can upload, import, or generate files.":"Click one of the tasks below to create an Orion folder.  You can upload, import, or generate files.","Toggle Left Pane":"Toggle Left Pane","Open or close the left pane":"Open or close the left pane",Navigator:"Navigator","Strings Xtrnalizr":"Strings Xtrnalizr","Externalize Strings from JavaScript files in this folder":"Externalize strings from JavaScript files in this folder.",
"Choose a Folder":"Choose a Folder","Copy of ${0}":"Copy of ${0}","Enter a new name for '${0}'":"Enter a new name for '${0}'","Choose folder...":"Choose folder...",Rename:"Rename","Rename the selected files or folders":"Rename the selected files or folders","Compare with each other":"Compare with each other","Compare the selected 2 files with each other":"Compare the selected 2 files with each other","Compare with...":"Compare with...","Compare the selected folder with a specified folder":"Compare the selected folder with a specified folder",
Delete:"Delete","Unknown item":"Unknown item","Are you sure you want to delete these ${0} items?":"Are you sure you want to delete these ${0} items?","Are you sure you want to delete '${0}'?":"Are you sure you want to delete '${0}'?","Export as zip":"Zip","Create a zip file of the folder contents and download it":"Create a zip file of the folder contents and download it","New File":"File","Create a new file":"Create a new file","Name:":"Name:","New Folder":"Folder","Folder name:":"Folder name:","Create a new folder":"Create a new folder",
"Creating folder":"Creating folder",Folder:"Folder","Create an empty folder":"Create an empty folder","Create an empty folder on the Orion server.  You can import, upload, or create content in the editor.":"Create an empty folder on the Orion server.  You can import, upload, or create content in the editor.","Sample HTML5 Site":"Sample HTML5 Site","Generate a sample":"Generate a sample",'Generate an HTML5 "Hello World" website, including JavaScript, HTML, and CSS files.':'Generate an HTML5 "Hello World" website, including JavaScript, HTML, and CSS files.',
"Creating a folder for ${0}":"Creating a folder for ${0}","SFTP Import":"SFTP Import","Import content from SFTP":"Import content from SFTP","Import content from an SFTP location into an Orion folder.  You will be prompted for the SFTP location and credentials.":"Import content from an SFTP location into an Orion folder.  You will be prompted for the SFTP location and credentials.","Imported Content":"Imported Content","Upload a Zip":"Upload a Zip","Upload content from a local zip file":"Upload content from a local zip file",
"Upload content from a local zip file into an Orion folder.  You will be prompted for the local zip file.":"Upload content from a local zip file into an Orion folder.  You will be prompted for the local zip file.","Uploaded Content":"Uploaded Content","Creating an upload folder for ":"Creating an upload folder for ","Clone Git Repository":"Clone Git Repository","Clone a git repository":"Clone a git repository","Go to the Orion repositories page to provide a git repository URL.  Once the repository is created, it will appear in the Navigator.":"Go to the Orion repositories page to provide a git repository URL.  Once the repository is created, it will appear in the Navigator.",
"Link to Server":"Link to Server","Link to existing content on the server":"Link to existing content on the server","Create a folder that links to an existing folder on the server.":"Create a folder that links to an existing folder on the server.","Server path:":"Server path:","The name and server location were not specified.":"The name and server location were not specified.","Go Up":"Go Up","Move up to the parent folder":"Move up to the parent folder","Go Into":"Go Into","Move into the selected folder":"Move into the selected folder",
"Import local file...":"File System","Copy files and folders from your local file system":"Copy files and folders from your local file system","SFTP from...":"SFTP","Copy files and folders from a specified SFTP connection":"Copy files and folders from a specified SFTP connection","Importing from ${0}":"Importing from ${0}","SFTP to...":"SFTP","Copy files and folders to a specified SFTP location":"Copy files and folders to a specified SFTP location",Exporting:"Exporting to ${0}","Pasting ${0}":"Pasting ${0}",
"Copy to":"Copy to","Move to":"Move to","Copying ${0}":"Copying ${0}","Moving ${0}":"Moving ${0}","Renaming ${0}":"Renaming ${0}","Deleting ${0}":"Deleting ${0}","Creating ${0}":"Creating ${0}","Linking to ${0}":"Linking to ${0}","Move files and folders to a new location":"Move files and folders to a new location",Cut:"Cut",Copy:"Copy","Fetching children of ":"Fetching children of ",Paste:"Paste","Cannot paste into the Workspace root":"Cannot paste into the Workspace root","Open With":"Open With",
"Loading ":"Loading ",New:"New",File:"File",Actions:"Actions","Orion Content":"Orion Content"," is not supported in this file system":" is not supported in this file system","Create new content":"Create new content","Import from HTTP...":"HTTP","File URL:":"File URL:","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} menu 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(i,k){var j={root:k};Object.keys(i).forEach(function(h){typeof j[h]==="undefined"&&(j[h]=i[h])});return j});
define("orion/fileClient",["i18n!orion/navigate/nls/messages","orion/Deferred","orion/i18nUtil"],function(i,k,j){function h(a,f,d){if(!a[f])throw f+i[" is not supported in this file system"];return a[f].apply(a,d)}function a(e,f,d,c){if(!e.readBlob)throw i["source file service does not support binary read"];if(!d.writeBlob)throw i["target file service does not support binary write"];if(f[f.length-1]!=="/")return h(e,"readBlob",[f]).then(function(b){return h(d,"writeBlob",[c,b])});var b=c.substring(0,
c.length-1),g=decodeURIComponent(b.substring(b.lastIndexOf("/")+1)),b=b.substring(0,b.lastIndexOf("/")+1);return h(d,"createFolder",[b,g]).then(function(){},function(){}).then(function(){return h(e,"fetchChildren",[f]).then(function(b){for(var f=[],g=0;g<b.length;++g){var h=b[g].Location,l=h;b[g].Directory&&(l=h.substring(0,h.length-1));l=decodeURIComponent(l.substring(l.lastIndexOf("/")+1));l=c+encodeURIComponent(l);b[g].Directory&&(l+="/");f[g]=a(e,h,d,l)}return k.all(f)})})}function g(a,f){function d(b){var a=
new k;a.reject(i["No Matching FileService for location:"]+b);return a}var c=a.getServiceReferences("orion.core.file"),b=c;if(f)for(var b=[],g=0;g<c.length;++g)f(c[g])&&b.push(c[g]);for(var h=[],s=[],o=[],q=[],p={fetchChildren:function(){var b=new k;b.resolve(q);return b},createWorkspace:function(){var b=new k;b.reject(i["no file service"]);return b},loadWorkspaces:function(){var b=new k;b.reject(i["no file service"]);return b},loadWorkspace:function(){var b=new k;window.setTimeout(function(){b.resolve({Directory:!0,
Length:0,LocalTimeStamp:0,Name:i["File Servers"],Location:"/",Children:q,ChildrenLocation:"/"})},100);return b},search:d,createProject:d,createFolder:d,createFile:d,deleteFile:d,moveFile:d,copyFile:d,read:d,write:d},c=0;c<b.length;++c)q[c]={Directory:!0,Length:0,LocalTimeStamp:0,Location:b[c].getProperty("top"),ChildrenLocation:b[c].getProperty("top"),Name:b[c].getProperty("Name")},g=b[c].getProperty("pattern")||b[c].getProperty("top").replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),g[0]!=="^"&&(g=
"^"+g),h[c]=RegExp(g),s[c]=a.getService(b[c]),o[c]=b[c].getProperty("Name"),b[c].getProperty("NameKey")&&b[c].getProperty("nls")&&j.getMessageBundle(b[c].getProperty("nls")).then(function(a,c){q[a].Name=c[b[a].getProperty("NameKey")];o[a]=c[b[a].getProperty("NameKey")]}.bind(this,c));this._getServiceIndex=function(b){if(b==="/")return-1;else if(!b||b.length&&b.length===0)return s[0]?0:-1;for(var a=0;a<h.length;++a)if(h[a].test(b))return a;throw i["No Matching FileService for location:"]+b;};this._getService=
function(b){b=this._getServiceIndex(b);return b===-1?p:s[b]};this._getServiceName=function(b){b=this._getServiceIndex(b);return b===-1?p.Name:o[b]};this._getServiceRootURL=function(b){b=this._getServiceIndex(b);return b===-1?p.Location:q[b].Location}}g.prototype={getService:function(a){return this._getService(a)},fileServiceName:function(a){return this._getServiceName(a)},fileServiceRootURL:function(a){return this._getServiceRootURL(a)},fetchChildren:function(a){return h(this._getService(a),"fetchChildren",
arguments)},createWorkspace:function(a){return h(this._getService(),"createWorkspace",arguments)},loadWorkspaces:function(){return h(this._getService(),"loadWorkspaces",arguments)},loadWorkspace:function(a){return h(this._getService(a),"loadWorkspace",arguments)},createProject:function(a,f,d,c){return h(this._getService(a),"createProject",arguments)},createFolder:function(a,f){return h(this._getService(a),"createFolder",arguments)},createFile:function(a,f){return h(this._getService(a),"createFile",
arguments)},deleteFile:function(a){return h(this._getService(a),"deleteFile",arguments)},moveFile:function(e,f,d){var c=this._getService(e),b=this._getService(f);if(c===b)return h(c,"moveFile",arguments);var g=e[e.length-1]==="/",m=f;m[m.length-1]!=="/"&&(m+="/");if(d)m+=encodeURIComponent(d);else{var i=e;g&&(i=i.substring(0,i.length-1));m+=i.substring(i.lastIndexOf("/")+1)}g&&m[m.length-1]!=="/"&&(m+="/");return a(c,e,b,m).then(function(){return h(c,"deleteFile",[e])})},copyFile:function(e,f,d){var c=
this._getService(e),b=this._getService(f);if(c===b)return h(c,"copyFile",arguments);var g=e[e.length-1]==="/",m=f;m[m.length-1]!=="/"&&(m+="/");if(d)m+=encodeURIComponent(d);else{var i=e;g&&(i=i.substring(0,i.length-1));m+=i.substring(i.lastIndexOf("/")+1)}g&&m[m.length-1]!=="/"&&(m+="/");return a(c,e,b,m)},read:function(a,f){return h(this._getService(a),"read",arguments)},readBlob:function(a){return h(this._getService(a),"readBlob",arguments)},write:function(a,f,d){return h(this._getService(a),"write",
arguments)},remoteImport:function(a,f){return h(this._getService(a),"remoteImport",arguments)},remoteExport:function(a,f){return h(this._getService(a),"remoteExport",arguments)},search:function(a){return h(this._getService(a.resource),"search",arguments)}};g.prototype.constructor=g;return{FileClient:g}});
define("orion/webui/SideMenu","orion/commands,orion/objects,orion/webui/littlelib,orion/PageLinks,orion/PageUtil,orion/URITemplate,orion/URL-shim,orion/util".split(","),function(i,k,j,h,a,g,e,f){function d(b,a){this.parentNode=j.node(b);this.contentNode=j.node(a);if(!this.parentNode)throw Error("Missing parentNode");this.menuitems=Object.create(null);this.categories=this.links=null;this.anchor=document.createElement("ul");this.anchor.classList.add("sideMenuList");this.parentNode.appendChild(this.anchor);
this.anchor.addEventListener("click",this._handleEvent.bind(this));this.anchor.addEventListener("touchstart",this._handleEvent.bind(this));this.anchor.addEventListener("focus",this._handleEvent.bind(this),!0);j.addAutoDismiss([this.anchor],this._expandMenu.bind(this,null))}function c(b){return!b.isRelatedLink}function b(b,a){var c=b.order,d=a.order;if(c<d)return-1;else if(d<c)return 1;return 0}function l(b,a){var c=b.source.order,d=a.source.order,c=typeof c==="number"?c:100,d=typeof d==="number"?
d:100;return c===d?b.textContent.localeCompare(a.textContent):c<d?-1:1}var m=f.isTouch;k.mixin(d.prototype,{LOCAL_STORAGE_NAME:"sideMenuNavigation",OPEN_STATE:"open",CLOSED_STATE:"closed",DEFAULT_STATE:"open",SIDE_MENU_OPEN_WIDTH:"40px",TRANSITION_DURATION_MS:301,addMenuItem:function(b,a,c){var d=this.anchor,b=this.createListItem(b,a);c&&b.classList.add("sideMenuItemActive");d.appendChild(b);this.menuitems[a]=b},setSideMenu:function(){var b=this.getDisplayState(),a=this.parentNode;if(a){if(b===this.CLOSED_STATE){this.setPageContentLeft("0");
if(this._timeout)window.clearTimeout(this._timeout),this._timeout=null;this._timeout=window.setTimeout(function(){a.style.display="none"},this.TRANSITION_DURATION_MS);a.classList.add("animating")}if(b===this.OPEN_STATE){if(this._timeout)window.clearTimeout(this._timeout),this._timeout=null;a.classList.remove("animating");a.style.display="block";a.style.width=this.SIDE_MENU_OPEN_WIDTH;this.setPageContentLeft(this.SIDE_MENU_OPEN_WIDTH)}}},setPageContentLeft:function(b){var a=this.contentNode;if(a)a.style.left=
b},toggleSideMenu:function(){var b=this.getDisplayState(),a=this.contentNode;a&&a.classList.add("content-fixedHeight-animation");b=b===this.OPEN_STATE?this.CLOSED_STATE:this.OPEN_STATE;b===this.DEFAULT_STATE?localStorage.removeItem(this.LOCAL_STORAGE_NAME):localStorage.setItem(this.LOCAL_STORAGE_NAME,b);this.setSideMenu()},clearMenuItems:function(){this.menuitems=[];j.empty(this.anchor)},getMenuItems:function(){var b=this.menuitems;return Object.keys(b).map(function(a){return b[a]})},getMenuItem:function(b){return this.menuitems[b]},
getDisplayState:function(){var b=localStorage.getItem(this.LOCAL_STORAGE_NAME);if(!b)b=this.DEFAULT_STATE;return b},createListItem:function(b,a){var c=document.createElement("li");c.className=b;c.classList.add("sideMenuItem");c.categoryId=a;return c},setCategories:function(b){this.categories=b;this.links=Object.create(null)},setPageLinks:function(b){this.pageLinks=b;var a=this,c=b.createLinkElements();b.getAllLinks().forEach(function(b,d){var e=c[d];e.source=b;a._getLinksBin(b.category).push(e)});
this._renderLinks()},setRelatedLinks:function(b,a){this.relatedLinks=b;var d=this;Object.keys(this.links).forEach(function(b){var a=d._getLinksBin(b);d.links[b]=a.filter(c)});var e=document.createDocumentFragment();b.forEach(function(b){var a=b.relatedLink,c=d._getLinksBin(a.category),b=i.createCommandMenuItem(e,b.command,b.invocation);b.classList.remove("dropdownMenuItem");b.isRelatedLink=!0;b.source=a;c.push(b)});this._renderLinks(a)},_getLinksBin:function(b){if(b){var a=this.links;a[b]=a[b]||[];
return a[b]}else return[]},_sort:function(){var b=this.links;Object.keys(b).forEach(function(a){b[a].sort(l)})},_renderCategories:function(){var c=this.categories,d=this,e=new URL(window.location.href),f=a.matchResourceParameters();f.OrionHome=h.getOrionHome();var l=!1;this.clearMenuItems();c.getCategoryIDs().map(function(b){return c.getCategory(b)}).sort(b).forEach(function(b){var a=d._getLinksBin(b.id);a.length&&(l?d.addMenuItem(b.imageClass,b.id,!1):(a=a.some(function(b){if(!b.source.uriTemplate)return!1;
b=new g(b.source.uriTemplate);b=new URL(b.expand(f),window.location);return b.protocol===e.protocol&&b.host===e.host&&b.hostname===e.hostname&&b.port===e.port&&b.pathname===e.pathname&&b.search===e.search?l=!0:!1}),d.addMenuItem(b.imageClass,b.id,a)))})},_renderLinks:function(b){b=b||[];this._sort();this._renderCategories();var a=this,c=window.location.href;Object.keys(this.menuitems).forEach(function(d){var e=a.getMenuItem(d);if(e){for(var f=a._getLinksBin(d).slice(),f=f.filter(function(a){var d=
a.source;return b.indexOf(d.id)>=0||!d.default&&!d.force&&a.href===c?!1:!0}),f=f.filter(function(b){b=b.source;return!(f.length>1&&b.default&&!b.force)}),g=f.length-1;g>0;g--)f[g].href===f[g-1].href&&f.splice(g,1);if(f.length){e.appendChild(a._createCategoryElement(d,e,f[0]));var h=document.createElement("ul");h.className="sideMenuSubMenu";f.forEach(function(b){var a=document.createElement("li");a.className="sideMenuSubMenuItem";var c=document.createElement("a");c.href=b;c.className="sideMenuSubMenuItemLink";
var d=document.createElement("span");d.innerHTML=b.innerHTML;d.className="sideMenuSubMenuItemSpan";c.appendChild(d);a.appendChild(c);h.appendChild(a)});e.appendChild(h)}}})},_createCategoryElement:function(b,a,c){var b=this.categories.getCategory(b),d;m?(d=document.createElement("button"),d.type="button"):(d=document.createElement("a"),d.href=c.href);d.className+=b.imageClass;d.classList.add("submenu-trigger");d.tabIndex="0";a.classList.remove(b.imageClass);return d},_handleEvent:function(b){var a=
b.target,b=b.type==="focus";if(a.tagName!=="A"||b)a.classList.contains("submenu-trigger")&&(m||b)&&this._expandMenu(j.$(".sideMenuSubMenu",a.parentNode))},_expandMenu:function(b){this.getMenuItems().forEach(function(a){a=j.$(".sideMenuSubMenu",a);b!==a&&a.classList.remove("expanded")});b&&b.classList.toggle("expanded")}});return d});
define("orion/globalCommands","i18n!orion/nls/messages,require,orion/commonHTMLFragments,orion/keyBinding,orion/EventTarget,orion/commandRegistry,orion/commands,orion/parameterCollectors,orion/extensionCommands,orion/uiUtils,orion/keyBinding,orion/breadcrumbs,orion/webui/littlelib,orion/webui/splitter,orion/webui/dropdown,orion/webui/tooltip,orion/contentTypes,orion/URITemplate,orion/keyAssist,orion/PageUtil,orion/widgets/themes/ThemePreferences,orion/widgets/themes/container/ThemeData,orion/Deferred,orion/widgets/UserMenu,orion/PageLinks,orion/webui/dialogs/OpenResourceDialog,text!orion/banner/banner.html,text!orion/banner/footer.html,text!orion/banner/toolbar.html,orion/widgets/input/DropDownMenu,orion/util,orion/customGlobalCommands,orion/fileClient,orion/webui/SideMenu,orion/objects".split(","),function(i,
k,j,h,a,g,e,f,d,c,b,l,m,s,o,q,p,t,r,u,v,n,w,x,y,F,H,D,G,z,J,E,B,Q,C){var O,M,R,S,P,K,L,A;function I(b,a){if(b.getLabel)return b.getLabel();else{var c=new w;c.resolve(a.properties.name);return c}}function N(b){m.node("progressPane").setAttribute("aria-label",i["Operations - Press spacebar to show current operations"]);(b=b.getService("orion.page.progress"))&&b.init.bind(b)("progressPane")}function V(b,a){var c=b.getServiceReferences("orion.core.auth");ea=[];var d=O.apply(this,arguments);if(d)for(var n=
0;n<c.length;n++){var e=c[n],f=b.getService(e);I(f,e).then(function(b){f.getKey().then(function(a){ea.push(a);f.getUser().then(function(c){d.addUserItem(a,f,b,c)},function(c,n){d.addUserItem(a,f,b,n)});window.addEventListener("storage",function(){da[a]!==localStorage.getItem(a)&&(da[a]=localStorage.getItem(a),f.getUser().then(function(c){d.addUserItem(a,f,b,c)},function(){d.addUserItem(a,f,b)}))},!1)})})}}function X(b){return b}function W(b,a,c,n,f){function g(b){for(var a={},c=b.getPropertyKeys(),
d,n=0;n<c.length;n++)d=c[n],a[d]=b.getProperty(d);return a}function h(b,a){var c=null;b.some(function(b){return a===b.getProperty("id")?!!(c=b):!1});return c}function l(b){var c=b.command;if(!c.visibleWhen||c.visibleWhen(a))return b.invocation=new e.CommandInvocation(a,a,null,c,n),(new w).resolve(b);else if(typeof f==="function")return i||(i=f()),w.when(i,function(d){if(d&&a===fa&&(!c.visibleWhen||c.visibleWhen(d)))return b.invocation=new e.CommandInvocation(d,d,null,c,n),b});return(new w).resolve()}
function y(b,a,c){return c?(new w).resolve({relatedLink:b,command:c}):a.then(function(a){return{relatedLink:b,command:new e.Command(a)}})}var m=arguments,x,i,o=b&&b.getServiceReferences("orion.page.link.related");if(o&&o.length!==0){var j=this;w.when(function(){if(x)return x;var a=b.getService("orion.core.contentTypeRegistry");a||(a=new p.ContentTypeRegistry(b),a=b.getService("orion.core.contentTypeRegistry"));return a.getContentTypes().then(function(b){return x=b})}(),function(){if(M.apply(j,m)){var a=
b.getServiceReferences("orion.navigate.command"),e=[];o.forEach(function(c){var f=g(c);if(f.id){var l;if((f.nls&&f.nameKey||f.name)&&f.uriTemplate)l=d._createCommandOptions(f,c,b,x,!0),e.push(y(f,l,null));else if(l=h(a,f.id)){var w=g(l),c={};C.mixin(c,w,f);(f=n.findCommand(f.id))?e.push(y(c,null,f)):(l=d._createCommandOptions(w,l,b,x,!0),e.push(y(c,l,null)))}}});w.all(e,X).then(function(b){b.sort(function(b,a){return b.command.name.localeCompare(a.command.name)});return w.all(b.map(l),X).then(function(a){var d=
[],a=a.filter(function(a,c){if(a)return!0;d.push(b[c]);return!1});R.call(j,n,a,d,c);S.apply(j,m)})})}})}}function ha(b){var a=m.node("globalActions");a&&(b.destroy(a),b.renderCommands(a.id,a,{},{},"tool"))}function aa(b){var a=window.getComputedStyle(b,null);return a===null?b:a.getPropertyValue("position")==="absolute"||!b.parentNode||b===document.body?b:aa(b.parentNode)}function ba(b){var a={},c=null;typeof b==="string"&&(b=m.node(b));b||(b=m.node("pageActions"));for(var d=b;d&&d.classList;){if(d.classList.contains("toolComposite")){c=
d;break}d=d.parentNode}if(b.classList.contains("commandMarker"))a.commandNode=b;if(c&&(a.slideContainer=m.$(".slideParameters",c),a.parameterArea=m.$(".parameters",c),a.dismissArea=m.$(".parametersDismiss",c),a.notifications=m.$("#notificationArea",c),c.parentNode&&(a.toolbarTarget=m.$(".toolbarTarget",c.parentNode),a.toolbarTarget)))b=m.bounds(a.toolbarTarget),d=m.bounds(aa(a.toolbarTarget.parentNode)),a.toolbarTargetY=b.top-d.top,a.toolbar=c;return a}function ca(b){if(b=b.slideContainer)if(b.style.left=
"",b.style.top="",b.classList.contains("slideContainerActive")){var a=m.bounds(b),c=m.bounds(b.parentNode);b.style.left=(c.width-a.width)/2+"px";b.style.top="0"}}var g=function(b){var a=document.createElement("a");a.href=b;return a.href}(k.toUrl("auth/NotifyAuthentication.html")),da={},U=null;O=E.createMenuGenerator||function(b,a){if(m.node("userMenu")){var c=m.node("userDropdown"),d=new o.Dropdown({dropdown:c}),c=new x.UserMenu({dropdownNode:c,dropdown:d,serviceRegistry:b}),d=m.node("userTrigger");
new q.Tooltip({node:d,text:i.Options,position:["below","left"]});var d=document.getElementById("userTrigger"),n=d.className;n+=" imageSprite core-sprite-silhouette";d.className=n;c.setKeyAssist(a);return c}};M=E.beforeGenerateRelatedLinks||function(){return!0};R=E.addRelatedLinkCommands||function(b,a,c,d){this.sideMenu&&this.sideMenu.setRelatedLinks(a,d)};S=E.afterGenerateRelatedLinks||function(){};P=E.afterSetPageTarget||function(){};K=E.generateNavigationMenu||function(){var b=m.node("sideMenu");
if(b){var a=m.node("centralNavigation");new q.Tooltip({node:a,text:i.CentralNavTooltip,position:["right"]});U=this.sideMenu=new Q(b,m.node("pageContent"));a.addEventListener("click",U.toggleSideMenu.bind(U));(b=m.node("sideMenuToggle"))&&b.addEventListener("click",U.toggleSideMenu.bind(U))}};L=E.afterGenerateNavigationMenu||function(){};A=E.afterGenerateBanner||function(){};var ea=[],fa,$=[],T,Z=null,Y=null,ga=new a;return{generateBanner:function(b,a,c,d,g,l,x,o){function q(b){b.registerService("orion.cm.managedservice",
{updated:function(b){for(var b=b&&b["links.newtab"]!=="undefined"?b["links.newtab"]?"_blank":"_self":"_self",a=m.$$array(".targetSelector"),c=0;c<a.length;c++)a[c].target=b}},{pid:"nav.config"})}(new v.ThemePreferences(d,new n.ThemeData)).apply();var p=m.node(b);if(!p)throw i["could not find banner parent, id was "]+b;var u=document.createRange();u.selectNode(p);u=u.createContextualFragment(H);m.processTextNodes(u,i);p.firstChild?p.insertBefore(u,p.firstChild):p.appendChild(u);p=m.node("home");p.href=
k.toUrl("edit/edit.html");p.setAttribute("aria-label",i["Orion Home"]);m.node("progressPane").src=e.NO_IMAGE;if(p=m.node("pageToolbar"))p.classList.add("toolbarLayout"),p.innerHTML=G+j.slideoutHTMLFragment("mainToolbar");(p=m.node("closeNotifications"))&&p.setAttribute("aria-label",i["Close notification"]);if(J.isFirefox<=17&&(p=m.node("staticBanner")))p.style.width="100%",p.style.MozBoxSizing="border-box";if(p=m.node("footer"))p.innerHTML=D,m.processTextNodes(p,i);c.setParameterCollector(new f.CommandParameterCollector(ba,
ca));document.addEventListener("keydown",function(b){b.keyCode===m.KEY.ESCAPE&&(b=a.getService("orion.page.message"))&&b.setProgressMessage("")},!1);K.apply(this,arguments);L.apply(this,arguments);p=y.getCategoriesInfo(a);u=y.getPageLinksInfo(a,"orion.page.link");w.all([p,u]).then(function(b){if(U){var a=b[1];U.setCategories(b[0]);U.setPageLinks(a);U.setSideMenu()}});if(p=m.$(".split")){var u=m.$(".sidePanelLayout"),t=m.$(".mainPanelLayout");if(u&&t)Z={side:u,main:t},Z.splitter=new s.Splitter({node:p,
sidePanel:u,mainPanel:t,toggle:!0,closeByDefault:o}),p=new e.Command({name:i["Toggle side panel"],tooltip:i["Open or close the side panel"],id:"orion.toggleSidePane",callback:function(){Z.splitter.toggleSidePanel()}}),c.addCommand(p),c.registerCommandContribution("pageActions","orion.toggleSidePane",1,null,!0,new h.KeyBinding("l",J.isMac?!1:!0,!0,!1,J.isMac?!0:!1))}var z=!1,E=function(b,a){if(!z){var c=a.getService("orion.page.progress"),d=new F.OpenResourceDialog({searcher:b,progress:c,searchRenderer:b.defaultRenderer,
onHide:function(){z=!1}});window.setTimeout(function(){z=!0;d.show()},0)}},p=new e.Command({name:i["Find File Named..."],tooltip:i["Choose a file by name and open an editor on it"],id:"orion.openResource",callback:function(){E(g,a)}});c.addCommand(p);c.registerCommandContribution("globalActions","orion.openResource",100,null,!0,new h.KeyBinding("f",!0,!0));p=new e.Command({name:i["Toggle banner and footer"],tooltip:i["Hide or show the page banner and footer"],id:"orion.toggleTrim",callback:function(){var b=
m.node("banner"),a=m.node("footer"),c=m.node("sideMenu"),d=m.$(".content-fixedHeight"),n=b.style.visibility==="hidden";n?(b.style.visibility="visible",a.style.visibility="visible",d.classList.remove("content-fixedHeight-maximized"),c&&c.classList.remove("sideMenu-maximized")):(b.style.visibility="hidden",a.style.visibility="hidden",d.classList.add("content-fixedHeight-maximized"),c&&c.classList.add("sideMenu-maximized"));ga.dispatchEvent({type:"toggleTrim",maximized:!n});return!0}});c.addCommand(p);
c.registerCommandContribution("globalActions","orion.toggleTrim",100,null,!0,new h.KeyBinding("m",!0,!0));p=new e.Command({name:i["System Configuration Details"],tooltip:i["System Config Tooltip"],id:"orion.configDetailsPage",hrefCallback:function(){return k.toUrl("help/about.html")}});c.addCommand(p);c.registerCommandContribution("globalActions","orion.configDetailsPage",100,null,!0,new h.KeyBinding(112,!0,!0));p=new e.Command({name:i["Background Operations"],tooltip:i["Background Operations Tooltip"],
id:"orion.backgroundOperations",hrefCallback:function(){return k.toUrl("operations/list.html")}});c.addCommand(p);c.registerCommandContribution("globalActions","orion.backgroundOperations",100,null,!0,new h.KeyBinding("o",!0,!0));Y=new r.KeyAssistPanel({commandRegistry:c});p=new e.Command({name:i["Show Keys"],tooltip:i["Show a list of all the keybindings on this page"],id:"orion.keyAssist",callback:function(){Y.isVisible()?Y.hide():Y.show();return!0}});c.addCommand(p);c.registerCommandContribution("globalActions",
"orion.keyAssist",100,null,!0,new h.KeyBinding(191,!1,!0));ha(c);V(a,p.callback);N(a);window.addEventListener("hashchange",function(){c.processURL(window.location.href)},!1);window.setTimeout(function(){q(a)},0);A.apply(this,arguments)},getToolbarElements:ba,getMainSplitter:function(){return Z},getKeyAssist:function(){return Y},getGlobalEventTarget:function(){return ga},layoutToolbarElements:ca,setPageTarget:function(b){var a,c,d=b.breadcrumbRootName,n=b.serviceRegistry;b.target?(b.searchService&&
b.searchService.setLocationByMetaData(b.target),b.fileService&&!b.breadcrumbTarget&&(c=d?d+" ":"",c+=b.fileService.fileServiceName(b.target.Location),d=null),a=b.name||b.target.Name,fa=b.target,W.call(this,n,b.target,$,b.commandService,b.makeAlternate)):(b.breadcrumbTarget||(d=d||b.task||b.name),a=b.name,W.call(this,n,{NoTarget:""},$,b.commandService,b.makeAlternate));(T=b.title)||(T=a?a+" - "+b.task:b.task);window.document.title=T;P.apply(this,arguments);if(a=b.breadCrumbContainer?m.node(b.breadCrumbContainer):
m.node("location")){m.empty(a);var e=n&&new B.FileClient(n),n=b.breadcrumbTarget||b.target,e=e&&n&&n.Location?e.fileServiceRootURL(n.Location):null;new l.BreadCrumbs({container:a,resource:n,rootSegmentName:d,workspaceRootSegmentName:c,workspaceRootURL:e,makeFinalHref:b.makeBreadcrumFinalLink,makeHref:b.makeBreadcrumbLink})}},setDirtyIndicator:function(b){if(T)T.charAt(0)==="*"&&!b&&(T=T.substring(1)),b&&T.charAt(0)!=="*"&&(T="*"+T),window.document.title=T;var a=m.node("dirty");if(a)a.textContent=
b?"*":""},setPageCommandExclusions:function(b){$=b},notifyAuthenticationSite:g}});
define("orion/urlUtils",["orion/PageUtil","orion/URL-shim"],function(i){return{detectValidURL:function(k){for(var j=/\[([^\]]*)\]\(([^\)]+)\)/g,h=j.exec(k),a=[],g=0;h;){if(h.length===3&&h[2].length>0){var e=new URL(h[2]);e.protocol!==":"&&i.validateURLScheme(e.href)&&(h.index>g&&a.push({segmentStr:k.substring(g,h.index)}),a.push({segmentStr:h[1].length>0?h[1]:h[2],urlStr:h[2]}),g=h.index+h[0].length)}h=j.exec(k)}if(g===0)return null;g<k.length-1&&a.push({segmentStr:k.substring(g)});return a},processURLSegments:function(i,
j){j.forEach(function(h){if(h.urlStr){var a=document.createElement("a");a.href=h.urlStr;a.appendChild(document.createTextNode(h.segmentStr))}else a=document.createElement("span"),a.textContent=h.segmentStr;i.appendChild(a)})}}});
define("orion/status",["i18n!orion/nls/messages","orion/webui/littlelib","orion/globalCommands","orion/urlUtils"],function(i,k,j,h){function a(a,f,d,c,b){this._serviceRegistry=a;this._serviceRegistration=a.registerService("orion.page.message",this);this._operationsClient=f;this.notificationContainerDomId=b;this.domId=d;this.progressDomId=c||d;this._hookedClose=!1;this._timer=null;this._clickToDisMiss=!0;this._cancelMsg=null}var g;a.prototype={_init:function(){var a=k.node("closeNotifications");if(a&&
!this._hookedClose){a.style.cursor="pointer";this._hookedClose=!0;var f=k.node(this.notificationContainerDomId);k.addAutoDismiss([f],function(){this._clickToDisMiss&&this.close()}.bind(this));a.addEventListener("click",function(){this.close()}.bind(this));f.addEventListener("click",function(a){a&&a.target&&a.target.nodeName.toLowerCase()==="a"&&(a=k.$$("a",f))&&a.length&&a.length===1&&this.close()}.bind(this))}},close:function(){window.clearTimeout(this._timer);var a=k.node("closeNotifications");
this._cancelMsg&&this._cancelFunc&&a?(a.innerHTML="",a.classList.remove("cancelButton"),a.classList.add("dismissButton"),a.classList.add("core-sprite-close"),a.classList.add("imageSprite"),this._cancelFunc(),this._cancelMsg=null):this.setProgressMessage("")},_getNotifierElements:function(){if(!this._notifierElements)this._notifierElements=j.getToolbarElements(this.notificationContainerDomId);return this._notifierElements},setMessage:function(a,f,d){this._init();this.currentMessage=a;var c=k.node(this.domId);
if(typeof d==="boolean"){var b=c.getAttribute("aria-live");c.setAttribute("aria-live",d?"polite":"off");window.setTimeout(function(){a===this.currentMessage&&(k.empty(c),c.appendChild(document.createTextNode(a)),window.setTimeout(function(){c.setAttribute("aria-live",b)},100))}.bind(this),100)}else k.empty(c),c.appendChild(document.createTextNode(a));typeof f==="number"&&window.setTimeout(function(){a===this.currentMessage&&(k.empty(c),c.appendChild(document.createTextNode("")))}.bind(this),f)},setErrorMessage:function(a){this._clickToDisMiss=
!0;this.currentMessage=a;this._init();var f=a.responseText||a.message||a;if(typeof f==="string")try{f=JSON.parse(f)}catch(d){}var a=f.Message||f,c="red";if(f.Severity)switch(f.Severity){case "Warning":c="#FFCC00";break;case "Error":c="red";break;case "Info":case "Ok":c="green"}f=document.createElement("span");f.style.color=c;f.appendChild(document.createTextNode(a));a=k.node(this.domId);k.empty(a);a.appendChild(f)},setProgressMessage:function(a){this._clickToDisMiss=!1;this._init();this.currentMessage=
a;var f=document.createElement("span");f.classList.add("progressIcon");var d=k.node(this.progressDomId);k.empty(d);d.appendChild(f);d.appendChild(document.createTextNode(a));f=k.node(this.notificationContainerDomId);f.classList.remove("notificationHide");if(a&&a.length>0)f.classList.add("progressNormal"),f.classList.add("notificationShow");else if(this._progressMonitors&&this._progressMonitors.length>0)return this._renderOngoingMonitors();else f.classList.remove("notificationShow"),f.classList.add("notificationHide")},
setCancelFunction:function(a){this._cancelFunc=a},setProgressResult:function(a,f){this._clickToDisMiss=!1;this._cancelMsg=f;this.currentMessage=a;var d=a.responseText||a;if(typeof d==="string")try{d=JSON.parse(d)}catch(c){}this._init();var b=d.Message||d.toString(),g=i.UnknownError,m="core-sprite-information",j="progressNormal",o=document.createElement("span");o.classList.add("imageSprite");o.classList.add("progressIcon");var q=[];if(d.Severity)switch(d.Severity){case "Warning":g=i.UnknownWarning;
m="core-sprite-warning";j="progressWarning";q.push("progressInfo");q.push("progressError");q.push("progressNormal");this._clickToDisMiss=!0;break;case "Error":m="core-sprite-error";j="progressError";q.push("progressWarning");q.push("progressInfo");q.push("progressNormal");this._clickToDisMiss=!0;break;default:j="progressNormal",q.push("progressWarning"),q.push("progressError"),q.push("progressNormal")}q.push("notificationHide");o.classList.add(m);var p=k.node(this.progressDomId),m=k.node(this.notificationContainerDomId);
k.empty(p);p.appendChild(o);b===Object.prototype.toString()&&(b=g);if(d.HTML)d=document.createElement("span"),d.innerHTML=b,p.appendChild(d);else{if(g=h.detectValidURL(b))b=document.createDocumentFragment(),h.processURLSegments(b,g),Array.prototype.forEach.call(k.$$("a",b),function(b){b.target="_blank"});else{if(d.Severity!=="Warning"&&d.Severity!=="Error"&&!f)this._timer&&window.clearTimeout(this._timer),this._timer=window.setTimeout(function(){this.setProgressMessage("");this._timer=null}.bind(this),
5E3);b=document.createTextNode(b)}p.appendChild(b)}if(j&&this.progressDomId!==this.domId){m.classList.add(j);for(j=0;j<q.length;j++)m.classList.remove(q[j])}m.classList.add("notificationShow");if(q=k.node("closeNotifications"))this._cancelMsg?(q.classList.add("cancelButton"),q.classList.remove("dismissButton"),q.classList.remove("core-sprite-close"),q.classList.remove("imageSprite"),q.innerHTML=this._cancelMsg):(q.innerHTML="",q.classList.remove("cancelButton"),q.classList.add("dismissButton"),q.classList.add("core-sprite-close"),
q.classList.add("imageSprite"))},showWhile:function(a,f){var d=this;if(f){d.setProgressMessage(f);var c=function(){f===d.currentMessage&&d.setProgressMessage("")};a.then(c,c)}return a},_lastProgressId:0,_progressMonitors:{length:0},createProgressMonitor:function(a,f){return new g(this,++this._lastProgressId,a,f)},_renderOngoingMonitors:function(){if(this._progressMonitors.length>0){var a="",f=!0,d;for(d in this._progressMonitors)this._progressMonitors[d].status&&(f||(a+=", "),a+=this._progressMonitors[d].status,
f=!1);this.setProgressMessage(a)}else this.setProgressMessage("")},_beginProgressMonitor:function(a){this._progressMonitors[a.progressId]=a;this._progressMonitors.length++;this._renderOngoingMonitors()},_workedProgressMonitor:function(a){this._progressMonitors[a.progressId]=a;this._renderOngoingMonitors()},_doneProgressMonitor:function(a){delete this._progressMonitors[a.progressId];this._progressMonitors.length--;a.status?this.setProgressResult(a.status):this._renderOngoingMonitors()}};a.prototype.constructor=
a;g=function(a,f,d,c){this.statusService=a;this.progressId=f;if(d){this.deferred=d;this.begin(c);var b=this;d.then(function(){b.done.bind(b)()},function(){b.done.bind(b)()})}};g.prototype.begin=function(a){this.status=a;this.statusService._beginProgressMonitor(this)};g.prototype.done=function(a){this.status=a;this.statusService._doneProgressMonitor(this)};g.prototype.worked=function(a){this.status=a;this.statusService._workedProgressMonitor(this)};g.prototype.constructor=g;return{StatusReportingService:a,
ProgressMonitor:g}});
define("orion/operations/nls/root/messages",{More:"More","No Matching OperationService for location:":"No Matching OperationService for location:","No operations services registered.":"No operations services registered.","could not find toolbar ":"could not find toolbar ","Remove Completed":"Remove Completed","Remove all completed operations":"Remove all completed operations",Remove:"Remove","Remove operations from the operations list.":"Remove operations from the operations list.",Cancel:"Cancel",
"Cancel operations from the operations list.":"Cancel operations from the operations list.","Operation resulted in a warning.":"Operation resulted in a warning.","Operation resulted in an error.":"Operation resulted in an error.","Operation is running.":"Operation is running.","Operation is canceled.":"Operation is canceled.","Operation failed.":"Operation failed.",Name:"Name",Actions:"Actions",Status:"Status",Scheduled:"Scheduled"});
define("orion/operations/nls/messages",["orion/i18n!orion/operations/nls/messages","orion/operations/nls/root/messages"],function(i,k){var j={root:k};Object.keys(i).forEach(function(h){typeof j[h]==="undefined"&&(j[h]=i[h])});return j});
define("orion/webui/popupdialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/webui/tooltip"],function(i,k,j,h){function a(){}a.prototype={_initialize:function(a,e,f,d,c){this._tooltip=new h.Tooltip({node:a,hideDelay:c||0,afterShowing:this._afterShowingFunction(e).bind(this),afterHiding:f,trigger:d?d:"click"});this.$parent=this._tooltip.contentContainer();this.$parent.role="dialog";a=document.createRange();a.selectNode(this.$parent);a=a.createContextualFragment(this.TEMPLATE);
this.messages&&j.processTextNodes(a,i);this.$parent.appendChild(a);var b=this._tooltip;this.$parent.addEventListener("keydown",function(a){a.keyCode===j.KEY.ESCAPE&&b.hide()},!1);this._bindElements(this.$parent);typeof this._bindToDom==="function"&&this._bindToDom(this.$parent)},_bindElements:function(a){for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];f.id&&(this["$"+f.id]=f);this._bindElements(f)}},_afterShowingFunction:function(a){return function(){a&&a.bind(this)();if(!this.customFocus){var e=
j.firstTabbable(this.$parent);e&&e.focus()}}},hide:function(){this._tooltip.hide()},show:function(){this._tooltip.show()}};a.prototype.constructor=a;return{PopupDialog:a}});
define("orion/operationsCommands",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/commands"],function(i,k,j,h){var a={};(function(){var g=!1;a.updateNavTools=function(a,f,d,c,b,h){var m=j.node(c);if(m)f.destroy(m);else throw i["could not find toolbar "]+c;f.renderCommands(c,m,h,d,"button");if(b&&(c=j.node(b)))f.destroy(c),f.renderCommands(b,c,null,d,"button");g||(g=!0,a.getService("orion.page.selection").addEventListener("selectionChanged",function(a){var c=j.node(b);
c&&(f.destroy(c),f.renderCommands(b,c,a.selections,d,"button"))}))};a.createOperationsCommands=function(a,f,d){function c(b){return!b.operation||!b.operation.type?!1:b.operation.type==="loadstart"||b.operation.type==="progress"}var b=new h.Command({name:i["Remove Completed"],tooltip:i["Remove all completed operations"],id:"eclipse.removeCompletedOperations",callback:function(){d.removeCompletedOperations().then(function(){f.loadOperations.bind(f)()})},visibleWhen:function(){return!0}});a.addCommand(b);
b=new h.Command({name:i.Remove,tooltip:i["Remove operations from the operations list."],imageClass:"core-sprite-delete",id:"eclipse.removeOperation",callback:function(b){for(var b=Array.isArray(b.items)?b.items:[b.items],a=0;a<b.length;a++){var c=b[a];d.removeOperation.bind(d)(c.Location).then(function(){f.loadOperations.bind(f)()},function(){f.loadOperations.bind(f)()})}},visibleWhen:function(b){if(!Array.isArray(b)||b.length===0)return!c(b);for(var a in b)if(c(b[a]))return!1;return!0}});a.addCommand(b);
b=new h.Command({name:i.Cancel,tooltip:i["Cancel operations from the operations list."],imageClass:"core-sprite-stop",id:"eclipse.cancelOperation",callback:function(b){for(var b=Array.isArray(b.items)?b.items:[b.items],a=0;a<b.length;a++){var c=b[a];c.deferred&&c.deferred.cancel()}},visibleWhen:function(b){if(!Array.isArray(b)||b.length===0)return c(b)&&(b.operation&&b.operation.cancelable?!0:!1);for(var a in b)if(!c(b[a])||!b[a].operation||!b[a].operation.cancelable)return!1;return!0}});a.addCommand(b)}})();
return a});
define("orion/webui/dialogs/OperationsDialog",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/webui/popupdialog","orion/operationsCommands"],function(i,k,j,h,a){function g(a){this._options=a}g.prototype=new h.PopupDialog;g.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>';g.prototype._init=
function(e){this._myOperations=[];this._operationsDeferreds=[];this._commandService=e.commandRegistry;a.createOperationsCommands(this._commandService);this._commandService.registerCommandContribution("operationsDialogItems","eclipse.cancelOperation",1);this._initialize(e.triggerNode)};g.prototype._bindToDom=function(){this.$allOperationsLink.href=k.toUrl("operations/list.html");this._setOperationsVisibility()};g.prototype.setOperations=function(a,f){this._myOperations||this._init(this._options);this._myOperations=
[];this._operationsDeferreds=[];if(a)for(var d in a)this._myOperations.push(a[d]),this._operationsDeferreds.push(f[d]);this._renderOperations()};g.prototype.parseProgressResult=function(a){if(!a)return{};a=a.responseText||a;try{a=JSON.parse(a)}catch(f){}var d={Message:a.Message||a,Severity:a.Severity};if(a.DetailedMessage&&a.DetailedMessage!==d.Message)d.DetailedMessage=a.DetailedMessage;return d};g.prototype._renderOperations=function(){this._renderOperationsTable(this.$myOperationsList,this._myOperations,
this._operationsDeferreds)};g.prototype._renderOperationsTable=function(a,f,d){j.empty(a);for(var c=0;c<f.length;c++){var b=f[c],g=document.createElement("tr"),h=document.createElement("td");h.style.paddingLeft="5px";h.style.paddingRight="5px";h.textContent=b.Name;g.appendChild(h);var s=document.createElement("div");h.appendChild(s);h=document.createElement("span");h.style.paddingRight="5px";h.classList.add("imageSprite");switch(b.type){case "Warning":h.classList.add("core-sprite-warning");h.setAttribute("aria-label",
i["Operation resulted in a warning."]);break;case "error":h.classList.add("core-sprite-error");h.setAttribute("aria-label",i["Operation resulted in an error."]);break;case "loadstart":case "progress":h.classList.add("core-sprite-start");h.setAttribute("aria-label",i["Operation is running."]);break;case "abort":h.classList.add("core-sprite-stop");h.setAttribute("aria-label",i["Operation is canceled."]);break;case "load":case "loadend":h.classList.add("core-sprite-ok"),h.setAttribute("aria-label","Operation ok.")}s.appendChild(h);
h=document.createElement("span");h.classList.add("operationStatus");h.textContent=b.Name;s.appendChild(h);if(b.error){var o=b.error.Message||b.error;b.error.DetailedMessage&&b.error.DetailedMessage!==""&&(o+=": "+b.error.DetailedMessage);h.textContent=o;h.classList.remove("operationStatus");h.classList.add("operationError")}this._commandService.renderCommands("operationsDialogItems",s,{operation:b,deferred:d[c]},this,"tool");a.appendChild(g)}this._setOperationsVisibility()};g.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"};g.prototype.constructor=g;return{OperationsDialog:g}});
define("orion/progress",["i18n!orion/nls/messages","require","orion/Deferred","orion/webui/littlelib","orion/webui/dialogs/OperationsDialog"],function(i,k,j,h,a){function g(f,d){if(!this._progressPane){this._progressPane=h.node(f);this._operationsDialog=new a.OperationsDialog({triggerNode:this._progressPane,commandRegistry:d});var c=this;this._progressPane.addEventListener("keydown",function(b){(b.charOrCode===" "||b.keyCode===h.KEY.ENTER)&&c._operationsDialog.show()})}}function e(a,d,c,b){this._serviceRegistry=
a;this._serviceRegistration=a.registerService("orion.page.progress",this);this._commandRegistry=c;this._operationsClient=d;this._operations={};this._operationDeferrds={};this._operationsIndex=0;this._lastIconClass=this._lastOperation=null;this._progressMonitorClass=b}g.prototype={_switchIconTo:function(a){this._lastIconClass&&this._progressPane.classList.remove(this._lastIconClass);this._lastIconClass=a;this._progressPane.classList.add(this._lastIconClass)},generateOperationsInfo:function(a,d){var c=
{},b;for(b in a)a[b].progressMonitor||(c[b]=a[b]);if(this._isEmpty(c))this._switchIconTo("progressPane_empty"),this._progressPane.title=i.Operations,this._progressPane.alt=i.Operations,this._progressPane.hasAttribute("aria-valuetext")&&this._progressPane.removeAttribute("aria-valuetext");else{var e="";for(b in c){var g=c[b];if(g.type&&(g.type==="loadstart"||g.type==="progress")){e="running";break}}switch(e){case "running":this._progressPane.title=i["Operations running"];this._progressPane.alt=i["Operations running"];
this._progressPane.setAttribute("aria-valuetext",i["Operations running"]);this._switchIconTo("progressPane_running");break;case "warning":this._progressPane.title=i["Some operations finished with warning"];this._progressPane.alt=i["Some operations finished with warning"];this._progressPane.setAttribute("aria-valuetext",i["Some operations finished with warning"]);this._switchIconTo("progressPane_warning");break;case "error":this._progressPane.title=i["Some operations finished with error"];this._progressPane.alt=
i["Some operations finished with error"];this._progressPane.setAttribute("aria-valuetext",i["Some operations finished with error"]);this._switchIconTo("progressPane_error");break;default:this._progressPane.title=i.Operations,this._progressPane.alt=i.Operations,this._progressPane.hasAttribute("aria-valuetext")&&this._progressPane.removeAttribute("aria-valuetext"),this._switchIconTo("progressPane_operations")}}this._operationsDialog.setOperations(c,d)},_isEmpty:function(a){for(var d in a)return!1;return!0}};
g.prototype.constructon=g;e.prototype={init:function(a){if(!this._progressMonitorClass)this._progressMonitorTool=new g(a,this._commandRegistry)},progress:function(a,d,c){var b=this,e=this._operationsIndex++;!c&&this._progressMonitorClass&&(c=new this._progressMonitorClass,c.begin(d));a.then(function(){if(b._operations[e]){var g=b._operations[e];if(d)g.Name=d;b._lastOperation=g;g.type="loadend";if(c)g.progressMonitor=c;b.writeOperation.bind(b)(e,g,a);g.Location||b._removeOperationFromTheList.bind(b)(e)}},
function(g){if(b._operations[e]){var h=b._operations[e];if(d)h.Name=d;if(c)h.progressMonitor=c;b._lastOperation=h;h.type=g.canceled?"abort":"error";h.error=g;b.writeOperation.bind(b)(e,h,a);h.Location||b._removeOperationFromTheList.bind(b)(e)}},function(g){if(d)g.Name=d;if(c)g.progressMonitor=c;b.writeOperation.bind(b)(e,g,a)});return a},removeOperation:function(a){for(var d in this._operations)if(this._operations[d].Location&&this._operations[d].Location===a){this._removeOperationFromTheList(d);
break}this._operationsClient.removeOperation.bind(this._operationsClient)(a)},_removeOperationFromTheList:function(a){var d=this._operations[a].progressMonitor;delete this._operations[a];delete this._operationDeferrds[a];d?d.done():this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},removeCompletedOperations:function(){for(var a in this._operations){var d=this._operations[a];if(d.type&&d.type!=="loadstart"&&d.type!=="progress")(d=this._operations[a].progressMonitor)&&
d.done(),delete this._operations[a],delete this._operationDeferrds[a]}this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},setProgressResult:function(a){this._serviceRegistry.getService("orion.page.message").setProgressResult(a)},showWhile:function(a,d,c){d&&this._serviceRegistry.getService("orion.page.message").setProgressMessage(d);var b=this;a.then(function(){b._serviceRegistry.getService("orion.page.message").setProgressMessage("")},function(a){c?b._serviceRegistry.getService("orion.page.message").setProgressMessage(""):
b.setProgressResult.bind(b)(a);return a});return this.progress(a,d)},writeOperation:function(a,d,c){this._operations[a]=d;this._operationDeferrds[a]=c;d.Location&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/operations").then(function(b){b.put(d.Location,{Name:d.Name,expires:d.expires})});d.progressMonitor?d.progressMonitor.progress(d.Name):this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)}};e.prototype.constructor=e;return{ProgressService:e}});
define("orion/dialogs",[],function(){function i(i){this._serviceRegistry=i;this._serviceRegistration=i.registerService("orion.page.dialog",this)}i.prototype={confirm:function(i,j){j(window.confirm(i))},openFiles:function(){}};i.prototype.constructor=i;return{DialogService:i}});
define("orion/selection",["orion/EventTarget","orion/Deferred"],function(i){function k(j,h){h||(h="orion.page.selection");this._serviceRegistry=j;i.attach(this);this._serviceRegistration=j.registerService(h,this);this._selections=null}k.prototype={getSelection:function(i){var h=this._getSingleSelection();typeof i==="function"&&i(h);return h},getSelections:function(i){var h=Array.isArray(this._selections)?this._selections.slice():[];typeof i==="function"&&i(h);return h},_getSingleSelection:function(){return this._selections&&
this._selections.length>0?this._selections[0]:null},setSelections:function(i){var h=this._selections;this._selections=Array.isArray(i)?i.length>0?i.slice():null:i?[i]:null;h!==this._selections&&this.dispatchEvent({type:"selectionChanged",selection:this._getSingleSelection(),selections:this._selections})}};k.prototype.constructor=k;return{Selection:k}});
define("orion/operationsClient",["i18n!orion/operations/nls/messages","orion/Deferred"],function(i,k){function j(a,f,d){return a[f].apply(a,d)}function h(a){this._location=a}function a(){var a=new k;a.reject(i["No Matching OperationService for location:"]+this._location);return a}function g(a){this._services=[];this._patterns=[];this._operationListeners=[];this._currentLongpollingIds=[];this._preferenceService=a.getService("orion.core.preference");for(var f=a.getServiceReferences("orion.core.operation"),
d=0;d<f.length;d++){var c=a.getService(f[d]);this._services[d]=c;c=f[d].getProperty("pattern")||".*";c[0]!=="^"&&(c="^"+c);this._patterns[d]=RegExp(c)}this._getService=function(b){if(!b)return this._services[0];for(var a=0;a<this._patterns.length;++a)if(this._patterns[a].test(b))return this._services[a];this._operations.remove(b);return new h(b)}}h.prototype={getOperation:a,getOperations:a,removeCompletedOperations:a,removeOperation:a,cancelOperation:a};h.prototype.constructor=h;g.prototype={getOperations:function(){var a=
new k;if(this._operations)return a.resolve(this._operations),a;var f=this;this._preferenceService.getPreferences("/operations").then(function(d){f._operations=d;a.resolve(f._operations)});return a},getOperation:function(a){return j(this._getService(a),"getOperation",arguments)},removeCompletedOperations:function(){for(var a=[],f=this,d=0;d<this._services.length;d++){var c=this._patterns[d],b=new k;a[d]=b.promise;j(this._services[d],"removeCompletedOperations").then(function(b){return function(a){Array.isArray(a)&&
f.getOperations.bind(f)().then(function(d){for(var f=d.keys(),e=0;e<f.length;e++){var g=f[e];c.test(g)&&a.indexOf(g)<0&&d.remove(g)}b.resolve()})}}(b),function(b){return function(a){b.reject(a)}}(b))}return k.all(a)},removeOperation:function(a){var f=this;return j(this._getService(a),"removeOperation",arguments).then(function(){f.getOperations.bind(f)().then(function(d){d.remove(a)})},function(a){return a},function(a){return a})}};g.prototype.constructor=g;return{OperationsClient:g}});
define("orion/search/nls/root/messages",{"Find:":"Find:","Find With":"Find With","ReplaceWith:":"ReplaceWith:","Replace With":"Replace With","Show all":"Show all","Wrap search":"Wrap search","Incremental search":"Incremental search","Whole Word":"Whole Word","Regular expression":"Regular expression","Find after replace":"Find after replace",Options:"Options","Find next match":"Find next match","Find previous match":"Find previous match",Next:"Next",Previous:"Previous",Replace:"Replace","Replace 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","${0} is already saved":"${0} is already saved","Type a search term":"Type a search term","Type a replace term":"Type a replace term","Case sensitive":"Case sensitive","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 the Search page for this folder.","${0}. Try your search again.":"${0}. Try your search again.","Click or use delete key to delete the search term":"Click or use delete key to delete the search term","${0} matches":"${0} matches","Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace <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(i,k){var j={root:k};Object.keys(i).forEach(function(h){typeof j[h]==="undefined"&&(j[h]=i[h])});return j});
define("orion/webui/treetable",["i18n!orion/nls/messages","orion/webui/littlelib"],function(i,k){function j(h){this._init(h)}j.prototype={_init:function(h){var a=h.parent,g=this,a=k.node(a);if(!a)throw i["no parent"];if(!h.model)throw i["no tree model"];if(!h.renderer)throw i["no renderer"];this._parent=a;this._treeModel=h.model;this._onComplete=h.onComplete;this._renderer=h.renderer;this._showRoot=h.showRoot===void 0?!1:h.showRoot;this._indent=h.indent===void 0?16:h.indent;this._onCollapse=h.onCollapse;
this._labelColumnIndex=h.labelColumnIndex===void 0?0:h.labelColumnIndex;this._id=h.id===void 0?"treetable":h.id;this._tableStyle=h.tableStyle;this._tableElement=h.tableElement||"table";this._tableBodyElement=h.tableBodyElement||"tbody";this._tableRowElement=h.tableRowElement||"tr";this._root=this._treeModel.getRoot(function(a){g._showRoot?(a._depth=0,g._generate([a],0)):g._treeModel.getChildren(a,function(a){g.destroyed||g._generate(a,0)})})},destroy:function(){this.destroyed=!0},_generate:function(h,
a){k.empty(this._parent);var g=document.createElement("div");this._renderer.wrapperCallback&&this._renderer.wrapperCallback(g);var e=document.createElement(this._tableElement);this._renderer.tableCallback&&this._renderer.tableCallback(e);e.id=this._id;this._tableStyle&&e.classList.add(this._tableStyle);this._renderer.initTable(e,this);this._bodyElement=document.createElement(this._tableBodyElement);this._renderer.bodyCallback&&this._renderer.bodyCallback(this._bodyElement);this._bodyElement.id=this._id+
"tbody";h.length===0?this._renderer.emptyCallback&&this._renderer.emptyCallback(this._bodyElement):this._generateChildren(h,a);e.appendChild(this._bodyElement);g.appendChild(e);this._parent.appendChild(g);this._rowsChanged();this._onComplete&&this._onComplete(this)},_generateChildren:function(h,a,g){for(var e=0;e<h.length;e++){var f=document.createElement(this._tableRowElement);f.id=this._treeModel.getId(h[e]);f._depth=a;f._item=h[e];this._renderer.render(h[e],f);f.childNodes[this._labelColumnIndex].style.paddingLeft=
this._indent*a+"px";this._renderer.rowCallback&&this._renderer.rowCallback(f,h[e]);g?(this._bodyElement.insertBefore(f,g.nextSibling),g&&(g=f)):this._bodyElement.appendChild(f)}},_rowsChanged:function(){this._renderer.rowsChanged&&this._renderer.rowsChanged()},getSelected:function(){return this._renderer.getSelected()},refresh:function(h,a,g){var e=this._treeModel.getId(h),f;if(e===this._id)this._removeChildRows(e),this._generateChildren(a,0),this._rowsChanged();else{var d=k.node(e);d?(d._item=h,
d&&(g||d._expanded)?(this._removeChildRows(e),a?(d._expanded=!0,this._renderer.updateExpandVisuals(d,!0),this._generateChildren(a,d._depth+1,d),this._rowsChanged()):(f=this,this._renderer.updateExpandVisuals(d,"progress"),a=this._treeModel.getChildren(d._item,function(a){if(!f.destroyed&&(f._renderer.updateExpandVisuals(d,!0),!d._expanded))d._expanded=!0,f._generateChildren(a,d._depth+1,d),f._rowsChanged()}))):this._renderer.updateExpandVisuals(d,!1)):console.log(i["could not find table row "]+e)}},
getItem:function(h){var a=k.node(h);return a&&a._item?a._item:h},toggle:function(h){var a=k.node(h);a&&(a._expanded?this.collapse(h):this.expand(h))},isExpanded:function(h){h=typeof h==="string"?h:this._treeModel.getId(h);return(h=k.node(h))?h._expanded:!1},expand:function(h,a,g){var h=typeof h==="string"?h:this._treeModel.getId(h),e=k.node(h);if(e)if(e._expanded)a&&a.apply(f,g);else{var f=this;this._renderer.updateExpandVisuals(e,"progress");this._treeModel.getChildren(e._item,function(d){if(!f.destroyed){f._renderer.updateExpandVisuals(e,
!0);if(!e._expanded)e._expanded=!0,f._generateChildren(d,e._depth+1,e),f._rowsChanged();a&&a.apply(f,g)}})}},_removeChildRows:function(h){for(var a=h===this._id,g=!1,e=-1,f=[],d=k.$$array(".treeTableRow",this._parent),c=0;c<d.length;c++){var b=d[c];if(g)break;if(a)b._depth>e?f.push(b):g=!0;else if(b.id===h)a=!0,e=b._depth}for(h=0;h<f.length;h++)a=f[h],a.parentNode.removeChild(a)},collapse:function(h){var h=typeof h==="string"?h:this._treeModel.getId(h),a=k.node(h);if(a){if(!a._expanded)return;a._expanded=
!1;this._renderer.updateExpandVisuals(a,!1);this._removeChildRows(h);this._rowsChanged()}this._onCollapse&&this._onCollapse(a._item)},getIndent:function(){return this._indent}};j.prototype.constructor=j;return{TableTree:j}});
define("orion/treeModelIterator",[],function(){var i={};i.TreeModelIterator=function(){function i(j,h){this.firstLevelChildren=j;this.reset();this._init(h)}i.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 h=this._getChildren(i),h=h&&h.length>0;this.isExpanded&&h&&(h=this.isExpanded(i));return h},_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 h=this._diveIn(this._cursor);
if(!h){if(i&&this._expandable(this._cursor)&&this.forceExpandFunc){var a=this;return this.forceExpandFunc(this._cursor,"first",function(g){g&&a.setCursor(g)})}(h=this._findSibling(this._cursor,!0))&&this.setCursor(h)}return h},_backward:function(i){if(!this._cursor)return null;var h=this._findSibling(this._cursor,!1);h&&h!==this._cursor.parent&&(h=this._drillToLast(h));if(i&&h&&this._expandable(h)&&this.forceExpandFunc&&h!==this._cursor.parent){var a=this;return this.forceExpandFunc(h,"last",function(g){g&&
a.setCursor(g)})}h&&this.setCursor(h);return h},_findSibling:function(i,h){for(var a=this.topLevel(i),g=this._getChildren(i.parent),g=a?this.firstLevelChildren:g,e=0;e<g.length;e++)if(g[e]===i)return e===0&&!h?a?null:i.parent:e===g.length-1&&h?a?null:this._findSibling(i.parent,h):h?g[e+1]:g[e-1];return null},_inParentChain:function(i,h){for(var a=i.parent;a;){if(a===h)return!0;a=a.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,h,a){this.setCursor(h);var g=[];for(g.push(h);;){if(this.iterate(i))g.push(this.cursor());else break;if(a===this.cursor())return g}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,h){var a=this.cursor(),
g=this._scan(!0,i,h);g||(g=this._scan(!1,i,h));this.setCursor(a);return g},iterate:function(i,h){return i?this._forward(h):this._backward(h)},iterateOnTop:function(i,h){var a=this._findSibling(this._getTopLevelParent(this.cursor()),i);a?this.setCursor(a):h&&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 i}();return i});
define("orion/explorers/explorerNavHandler",["orion/webui/littlelib","orion/treeModelIterator","orion/uiUtils"],function(i,k,j){var h={},a=navigator.userAgent.indexOf("iPad")!==-1,g=window.navigator.platform.indexOf("Mac")!==-1;h.ExplorerNavHandler=function(){function e(a,d,c){this.explorer=a;this.model=this.explorer.model;this._navDict=d;this._listeners=[];this._selections=[];this._currentColumn=0;a=this._getEventListeningDiv();a.tabIndex=0;a.classList.add("selectionModelContainer");var b=this;this._modelIterator=
new k.TreeModelIterator([],{isExpanded:this.isExpanded.bind(this),getChildrenFunc:c.getChildrenFunc,isExpandable:this.explorer.renderer.isExpandable?function(a){return b.explorer.renderer.isExpandable(a)}:function(a){return b.isExpandable(a)},forceExpandFunc:this.explorer.forceExpandFunc?function(a,c,d){return b.explorer.forceExpandFunc(a,c,d)}:void 0});this._init(c);(!c||c.setFocus!==!1)&&a.focus();c=function(a){if(j.isFormElement(a.target))return!0;if(b.explorer.preventDefaultFunc&&b.explorer.preventDefaultFunc(a,
b._modelIterator.cursor()))return!0;if(a.keyCode===i.KEY.DOWN)return b.onDownArrow(a);else if(a.keyCode===i.KEY.UP)return b.onUpArrow(a);else if(a.keyCode===i.KEY.RIGHT)return b.onRightArrow(a);else if(a.keyCode===i.KEY.LEFT)return b.onLeftArrow(a);else if(a.keyCode===i.KEY.SPACE)return b.onSpace(a);else if(a.keyCode===i.KEY.ENTER)return b.onEnter(a)};a.addEventListener("keydown",c,!1);this._listeners.push({type:"keydown",listener:c});c=function(){if(b.explorer.onFocus)b.explorer.onFocus(!1);else b.toggleCursor(null,
!1)};a.addEventListener("blur",c,!1);this._listeners.push({type:"blur",listener:c});c=function(){if(b.explorer.onFocus)b.explorer.onFocus(!0);else b.toggleCursor(null,!0)};a.addEventListener("focus",c,!1);this._listeners.push({type:"focus",listener:c});this._parentDiv=a}e.prototype={destroy:function(){this._parentDiv.classList.remove("selectionModelContainer");this.removeListeners()},_init:function(a){this._linearGridMove=!1;if(a)this._selectionPolicy=a.selectionPolicy,this.gridClickSelectionPolicy=
a.gridClickSelectionPolicy||"none",this.preventDefaultFunc=a.preventDefaultFunc,this.postDefaultFunc=a.postDefaultFunc},_ctrlKeyOn:function(a){return g?a.metaKey:a.ctrlKey},removeListeners:function(){if(this._listeners)for(var a=0;a<this._listeners.length;a++)this._parentDiv.removeEventListener(this._listeners[a].type,this._listeners[a].listener,!1)},focus:function(){var a=this._getEventListeningDiv();a&&a.focus()},_getEventListeningDiv:function(a){return this.explorer.keyEventListeningDiv&&typeof this.explorer.keyEventListeningDiv===
"function"?this.explorer.keyEventListeningDiv(a):i.node(this.explorer._parentId)},isExpandable:function(a){return!a?!1:i.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(a)))?!0:!1},isExpanded:function(a){return!a?!1:this.explorer.myTree.isExpanded(this.model.getId(a))},refreshSelection:function(a,d){var c=this;this.explorer.selection&&this.explorer.selection.getSelections(function(b){c._clearSelection(d);for(var e=0;e<b.length;e++)c._selections.push(b[e]);c._selections.length>0?
c.cursorOn(c._selections[0],!0,!1,a):c.cursorOn(null,!1,!1,a);if(!(c._shiftSelectionAnchor&&c._inSelection(c._shiftSelectionAnchor)>=0))c._shiftSelectionAnchor=null})},refreshModel:function(a,d,c,b){this._currentColumn=0;this.topIterationNodes=[];this.model=d;this._navDict=a;if(this.model.getTopIterationNodes)this.topIterationNodes=this.model.getTopIterationNodes();else if(c)this.topIterationNodes=c;this._modelIterator.setTree(this.topIterationNodes);!b&&this.explorer.selection&&(this.toggleCursor(this._modelIterator.cursor(),
!1),this._modelIterator.reset());this.refreshSelection(!0)},getTopLevelNodes:function(){return this._modelIterator.firstLevelChildren},_inSelection:function(a){for(var a=this.model.getId(a),d=0;d<this._selections.length;d++)if(a===this.model.getId(this._selections[d]))return d;return-1},_clearSelection:function(a){if(a)for(a=0;a<this._selections.length;a++)this._checkRow(this._selections[a],!0);this._selections=[]},getSelectionPolicy:function(){return this._selectionPolicy},setSelectionPolicy:function(a){if(this._selectionPolicy!==
a)this._selectionPolicy=a,this._selectionPolicy==="cursorOnly"&&this._clearSelection(!0)},setSelection:function(a,d,c){if(this._selectionPolicy==="cursorOnly")d&&this.explorer.renderer._useCheckboxSelection&&this._checkRow(a,!0);else if(this._isRowSelectable(a)){!d||this._selectionPolicy==="singleSelection"?(this._clearSelection(!0),this._checkRow(a,!1),this._selections.push(a),this._lastSelection=a):(d=this._inSelection(a),d>=0?(this._checkRow(a,!0),this._selections.splice(d,1)):(this._checkRow(a,
!1),this._selections.push(a),this._lastSelection=a));if(c)this._shiftSelectionAnchor=this._lastSelection;this.explorer.selection&&(this.explorer.renderer.storeSelections(),this.explorer.selection.setSelections(this._selections))}},moveColumn:function(a,d){a||(a=this.currentModel());var c=this._getGridChildren(a);if(c&&c.length>1||d===0&&c){d!==0&&this.toggleCursor(a,!1);var b=this._currentColumn,e=!0;b+=d;b<0?(this._linearGridMove&&d!==0&&(this._modelIterator.iterate(!1)?a=this.currentModel():e=!1),
b=e?c.length-1:this._currentColumn):b>=c.length&&(this._linearGridMove&&d!==0&&(this._modelIterator.iterate(!0)?a=this.currentModel():e=!1),b=e?0:this._currentColumn);this._currentColumn=b;d!==0&&this.toggleCursor(a,!0);return!0}return!1},_getGridChildren:function(a){return this._navDict?this._navDict.getGridNavHolder(a):null},getCurrentGrid:function(a){a||(a=this.currentModel());return(a=this._getGridChildren(a))&&a.length>0?a[this._currentColumn]:null},getAriaContainerElement:function(a){for(var d=
this._parentDiv,c;a&&a!==d&&(c=a.getAttribute("role"))!=="grid"&&c!=="tree"&&c!=="treegrid";)a=a.parentNode;return a===d?null:a},toggleCursor:function(a,d){var c=this.getRowDiv(a),b=this.getCurrentGrid(a);b?(c&&(d?c.classList.add("treeIterationCursorRow"):c.classList.remove("treeIterationCursorRow")),b.domNode&&(c=this.getAriaContainerElement(b.domNode),d?(b.domNode.classList.add("treeIterationCursor"),c&&c.setAttribute("aria-activedescendant",b.domNode.id)):b.domNode.classList.remove("treeIterationCursor"))):
c&&(d?c.classList.add("treeIterationCursorRow_Dotted"):c.classList.remove("treeIterationCursorRow_Dotted"))},currentModel:function(){return this._modelIterator.cursor()},cursorOn:function(a,d,c,b){var e,g;if(a||d){if(g===this._modelIterator.cursor())return;e=this._modelIterator.cursor();g=a;this._modelIterator.setCursor(g)}else e=this._modelIterator.prevCursor(),g=this._modelIterator.cursor();if(e!==g||d)if(this.toggleCursor(e,!1),!d||g){this.moveColumn(null,0);this.toggleCursor(g,!0);if((a=this.getRowDiv())&&
!b){b=a.parentNode;for(d=document.documentElement;b&&b!==d;){var h=window.getComputedStyle(b,null);if(!h)break;h=h.getPropertyValue("overflow-y");if(h==="auto"||h==="scroll")break;b=b.parentNode}b&&(d=!0,a.offsetTop<=b.scrollTop?(d=!1,c===void 0&&(c=!1)):a.offsetTop+a.offsetHeight>=b.scrollTop+b.clientHeight&&(d=!1,c===void 0&&(c=!0)),d||a.scrollIntoView(!c))}if(this.explorer.onCursorChanged)this.explorer.onCursorChanged(e,g)}},getSelection:function(){return this._selections},getSelectionIds:function(){for(var a=
[],d=0;d<this._selections.length;d++)a.push(this.model.getId(this._selections[d]));return a},getRowDiv:function(a){a=a?a:this._modelIterator.cursor();if(!a)return null;var a=this.model.getId(a),d=this._navDict.getValue(a);return d&&d.rowDomNode?d.rowDomNode:i.node(a)},iterate:function(a,d,c,b){var e=null;if(this.topIterationNodes&&this.topIterationNodes.length!==0)if(b){b=this.currentModel();for((e=this._modelIterator.iterate(a,d))&&this._setCursorOnItem(a,c);e&&e.isNotSelectable;)(e=this._modelIterator.iterate(a,
d))&&this._setCursorOnItem(a,c);e||(this.cursorOn(b,!0,!1,!0),this._setCursorOnItem(a,c))}else(e=this._modelIterator.iterate(a,d))&&this._setCursorOnItem(a,c)},_setCursorOnItem:function(a,d){this.cursorOn(null,!1,a);if(d){var c=this._inSelection(this._modelIterator.prevCursor()),b=this._inSelection(this._modelIterator.cursor());c>=0&&b>=0?this.setSelection(this._modelIterator.prevCursor(),!0):this.setSelection(this.currentModel(),!0)}},_checkRow:function(a,d){if(this.explorer.renderer._useCheckboxSelection&&
this._selectionPolicy!=="singleSelection"){var c=this.getRowDiv(a);if(c){var b=i.node(this.explorer.renderer.getCheckBoxId(c.id)),e=d?!b.checked:!0;if(e!==b.checked)this.explorer.renderer.onCheck(c,b,e,!0)}}else this._select(a,d)},_select:function(a){a||(a=this._modelIterator.cursor());var d=this.getRowDiv(a);d&&(this._inSelection(a)<0?d.classList.add("checkedRow"):d.classList.remove("checkedRow"))},_onModelGrid:function(a,d){var c=this._getGridChildren(a);if(c)for(var b=0;b<c.length;b++)if(d.target===
c[b].domNode)return!0;return!1},onClick:function(e,d){if(this.isDisabled(this.getRowDiv(e)))i.stop(d);else{var c=i.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(e)));if(d.target!==c&&!(this.gridClickSelectionPolicy==="none"&&this._onModelGrid(e,d)))if(this.cursorOn(e,!0,!1,!0),a)this.setSelection(e,!0);else if(this._ctrlKeyOn(d))this.setSelection(e,!0,!0);else if(d.shiftKey&&this._shiftSelectionAnchor){if(c=this._modelIterator.scan(this._shiftSelectionAnchor,e)){this._clearSelection(!0);
for(var b=0;b<c.length;b++)this.setSelection(c[b],!0)}}else this.setSelection(e,!1,!0)}},onCollapse:function(a){this._modelIterator.collapse(a)&&this.cursorOn()},onUpArrow:function(a){this.iterate(!1,!1,a.shiftKey,!0);!this._ctrlKeyOn(a)&&!a.shiftKey&&this.setSelection(this.currentModel(),!1,!0);a.preventDefault();return!1},onDownArrow:function(a){this.iterate(!0,!1,a.shiftKey,!0);!this._ctrlKeyOn(a)&&!a.shiftKey&&this.setSelection(this.currentModel(),!1,!0);a.preventDefault();return!1},_shouldMoveColumn:function(a){var d=
this.currentModel(),c=this._getGridChildren(d);return c&&c.length>1?this.isExpandable(d)?this._ctrlKeyOn(a):!0:!1},onLeftArrow:function(a){if(this._shouldMoveColumn(a))return this.moveColumn(null,-1),a.preventDefault(),!0;var d=this._modelIterator.cursor();if(!d)return!1;if(this.isExpandable(d)&&this.isExpanded(d))return this.explorer.myTree.collapse(d),a.preventDefault(),!0;this._modelIterator.topLevel(d)?this.explorer.scopeUp&&typeof this.explorer.scopeUp==="function"&&this.explorer.scopeUp():(this.cursorOn(d.parent),
this.setSelection(d.parent,!1,!0))},onRightArrow:function(a){if(this._shouldMoveColumn(a))return this.moveColumn(null,1),a.preventDefault(),!0;var d=this._modelIterator.cursor();if(!d)return!1;if(this.isExpandable(d)&&!this.isExpanded(d))return this.explorer.myTree.expand(d),this.explorer.postUserExpand&&this.explorer.postUserExpand(this.model.getId(d)),a.preventDefault(),!1},_isRowSelectable:function(a){return this.explorer.isRowSelectable?this.explorer.isRowSelectable(a):!0},onSpace:function(a){this.setSelection(this.currentModel(),
!0,!0);a.preventDefault()},onEnter:function(a){var d=this.getCurrentGrid(this._modelIterator.cursor());if(d)if(d.widget)if(typeof d.onClick==="function")d.onClick();else typeof d.widget.focus==="function"&&d.widget.focus();else{var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,0,0,0,0,0,this._ctrlKeyOn(a),!1,!1,!1,0,null);d.domNode.dispatchEvent(c)}else if(d=this._modelIterator.cursor()){if(this.explorer.renderer.getRowActionElement&&(c=this.explorer.renderer.getRowActionElement(this.model.getId(d)),
c.href))this._ctrlKeyOn(a)?window.open(c.href):window.location.href=c.href;if(this.explorer.renderer.performRowAction)return this.explorer.renderer.performRowAction(a,d),a.preventDefault(),!1}},setIsNotSelectable:function(a,d){a.isNotSelectable=d},disableItem:function(a){var d=this.getRowDiv(a);this.isExpandable(a)&&this.isExpanded(a)&&(this._modelIterator.collapse(a),this.explorer.myTree.toggle(d.id));d.classList.remove("checkedRow");d.classList.add("disabledNavRow");this.setIsNotSelectable(a,!0)},
isDisabled:function(a){return a.classList.contains("disabledNavRow")},enableItem:function(a){var d=this.getRowDiv(a);d&&(d.classList.remove("disabledNavRow"),this.setIsNotSelectable(a,!1))}};return e}();h.ExplorerNavDict=function(){function a(e){this._dict={};this._model=e}a.prototype={addRow:function(a,d){this._dict[this._model.getId(a)]={model:a,rowDomNode:d}},getValue:function(a){return this._dict[a]},getGridNavHolder:function(a,d){if(!a)return null;var c=this._model.getId(a);if(this._dict[c]){if(!this._dict[c].gridChildren&&
d)this._dict[c].gridChildren=[];return this._dict[c].gridChildren}return null},initGridNavHolder:function(a){if(!a)return null;a=this._model.getId(a);if(this._dict[a])this._dict[a].gridChildren=null}};return a}();return h});
define("orion/explorers/explorer","i18n!orion/nls/messages,require,orion/webui/littlelib,orion/webui/treetable,orion/explorers/explorerNavHandler,orion/commands".split(","),function(i,k,j,h,a,g){var e={};e.Explorer=function(){function e(a,c,b,f){this.registry=a;this.renderer=b;this.selection=c;this.commandService=f;if(this.renderer)this.renderer.explorer=this;this.myTree=null}e.prototype={destroy:function(){this._navHandler&&this._navHandler.destroy();this.model&&this.model.destroy();this.myTree&&
this.myTree.destroy();this.destroyed=!0},changedItem:function(a,c){this.myTree&&this.myTree.refresh.bind(this.myTree)(a,c,!0)},updateCommands:function(a){this.myTree&&this.myTree._renderer.updateCommands.bind(this.myTree._renderer)(a)},makeNewItemPlaceHolder:function(a,c,b,e){a=this.getRow(a);if(b)return a=a.childNodes[b],a.appendChild(document.createElement("br")),e=document.createElement("span"),e.id=c+"placeHolderRow",a.appendChild(e),{tempNode:e,refNode:e};if(a){var f=document.createElement("tr");
f.id=c+"placeHolderRow";b=document.createElement("td");b.id=c+"placeHolderCol";f.appendChild(b);e?(a.parentNode.insertBefore(f,a.nextSibling),a=parseInt(a.firstChild.style.paddingLeft),b.style.paddingLeft=this.myTree.getIndent()+a+"px"):a.appendChild(f);e=j.node(c+"placeHolderRow");a=j.node(c+"placeHolderCol");if(e&&a)return{tempNode:e,refNode:a}}return null},getRow:function(a){if(a=this.model.getId(a))return j.node(a)},collapseAll:function(){for(var a=this._navHandler.getTopLevelNodes(),c=0;c<a.length;c++)this.myTree.collapse(a[c])},
expandAll:function(a){if(a)this._expandRecursively(a);else if(this._navHandler)for(var a=this._navHandler.getTopLevelNodes(),c=0;c<a.length;c++)this._expandRecursively(a[c])},_expandRecursively:function(a){if(this._navHandler&&this._navHandler.isExpandable(a)){var c=this;this.myTree.expand(a,function(){c.model.getChildren(a,function(b){if(!(b===void 0||b===null))for(var a=b.length,d=0;d<a;d++)c._expandRecursively(b[d])})})}},createTree:function(d,c,b){d=typeof d==="string"?d:d.id||d;this.selection&&
this.selection.setSelections([]);this.getNavHandler()&&this.getNavHandler()._clearSelection();var e=d+"innerTree",f=j.node(e);f&&j.empty(f);if(c)c.rootId=e;this.model=c;this._parentId=d;this._treeOptions=b;if(!b||b&&!b.noSelection)this.selectionPolicy=b?b.selectionPolicy:"",this._navDict=new a.ExplorerNavDict(this.model);this.myTree=new h.TableTree({id:e,model:c,parent:d,onComplete:b?b.onComplete:void 0,labelColumnIndex:this.renderer.getLabelColumnIndex(),renderer:this.renderer,showRoot:b?!!b.showRoot:
!1,indent:b?b.indent:void 0,onCollapse:b?b.onCollapse:void 0,navHandlerFactory:b?b.navHandlerFactory:void 0,tableElement:b?b.tableElement:void 0,tableBodyElement:b?b.tableBodyElement:void 0,tableRowElement:b?b.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 a=this.getNavHandler(),c=[];
if(a&&this.getNavDict())for(var b=a.getSelection(),e=0;e<b.length;e++){var f=a.getRowDiv(b[e]);f&&f.parentNode&&(f=this.getNavDict().getValue(this.model.getId(b[e])),f.model&&c.push(f.model))}this.selection.setSelections(c)}},getRootPath:function(){return this.model&&this.model.root?this.model.root.Location:null},initNavHandler:function(){var d=this._treeOptions;if(!d||d&&!d.noSelection){if(!this.getNavHandler())this._navHandler=d&&d.navHandlerFactory&&typeof d.navHandlerFactory.createNavHandler===
"function"?d.navHandlerFactory.createNavHandler(this,this._navDict,d):new a.ExplorerNavHandler(this,this._navDict,{getChildrenFunc:d?d.getChildrenFunc:null,setFocus:d&&d.setFocus,selectionPolicy:d?d.selectionPolicy:null});var c=this;this.model.getRoot(function(b){b instanceof Array?c.getNavHandler().refreshModel(c.getNavDict(),c.model,b):b.children&&b.children instanceof Array&&c.getNavHandler().refreshModel(c.getNavDict(),c.model,b.children);d&&d.setFocus&&c.getNavHandler().cursorOn(null,!1,!1,!0)})}},
_lastHash:null,checkbox:!1};return e}();e.createExplorerCommands=function(a,d){function c(b){return typeof b.getItemCount==="function"?b.getItemCount()>0?d?d(b):!0:!1:!1}var b=new g.Command({tooltip:i["Expand all"],imageClass:"core-sprite-expandAll",id:"orion.explorer.expandAll",groupId:"orion.explorerGroup",visibleWhen:function(b){return c(b)},callback:function(b){b.items.expandAll()}}),e=new g.Command({tooltip:i["Collapse all"],imageClass:"core-sprite-collapseAll",id:"orion.explorer.collapseAll",
groupId:"orion.explorerGroup",visibleWhen:function(b){return c(b)},callback:function(b){b.items.collapseAll()}});a.addCommand(b);a.addCommand(e)};e.ExplorerModel=function(){function a(d,c,b){this.rootPath=d;this.fetchItems=c;this.idPrefix=b||""}a.prototype={destroy:function(){this.destroyed=!0},getRoot:function(a){var c=this;this.fetchItems(this.rootPath).then(function(b){c.root=b;a(b)})},getChildren:function(a,c){a.Children?c(a.Children):a.ChildrenLocation?this.fetchItems(a.ChildrenLocation).then(function(b){a.Children=
b;c(b)}):c([])},getId:function(a){if(a.Location===this.root.Location)return this.rootId;for(var a=a.Location.replace(/[\\\/]/g,""),c=this.idPrefix,b=0;b<a.length;b++)c+=a[b].match(/[^\.\:\-\_0-9A-Za-z]/g)?a.charCodeAt(b):a[b];return c}};return a}();e.ExplorerFlatModel=function(){function a(d,c,b){this.rootPath=d;this.fetchItems=c;this.root=b}a.prototype=new e.ExplorerModel;a.prototype.getRoot=function(a){if(this.root)a(this.root);else{var c=this;this.fetchItems(this.rootPath).then(function(b){c.root=
b;a(b)})}};a.prototype.getChildren=function(a,c){a===this.root?c(this.root):c([])};return a}();e.ExplorerRenderer=function(){function a(d,c){this.explorer=c;this._init(d);this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._progressImageClass="core-sprite-progress";this._twistieSpriteClass="modelDecorationSprite"}a.prototype={_init:function(a){if(a){this._useCheckboxSelection=a.checkbox===void 0?!1:a.checkbox;this.selectionPolicy=a.singleSelection?
"singleSelection":"";this._cachePrefix=a.cachePrefix;this.getCheckedFunc=a.getCheckedFunc;this.onCheckedFunc=a.onCheckedFunc;this._highlightSelection=!0;this._treeTableClass=a.treeTableClass||"treetable";if(a.highlightSelection===!1)this._highlightSelection=!1;if(!this.actionScopeId)this.actionScopeId=a.actionScopeId;if(!this.commandService)this.commandService=a.commandService}},getLabelColumnIndex:function(){return this.explorer.checkbox?1:0},initTable:function(a,c){this.tableTree=c;this.tableNode=
a;j.empty(a);this._treeTableClass&&a.classList.add(this._treeTableClass);this.renderTableHeader(a)},getActionsColumn:function(a,c,b,e,f){var b=b||"tool",g=document.createElement("td");g.id=c.id+"actionswrapper";e&&g.classList.add(e);this.actionScopeId&&this.commandService?this.commandService.renderCommands(this.actionScopeId,g,a,this.explorer,b,null,f&&this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(a,!0):null):window.console.log("Warning, no command service or action scope was specified.  No commands rendered.");
return g},initCheckboxColumn:function(){if(this._useCheckboxSelection)return document.createElement("th")},getCheckboxColumn:function(a,c){if(this._useCheckboxSelection){var b=document.createElement("td"),e=document.createElement("span");e.id=this.getCheckBoxId(c.id);e.classList.add("core-sprite-check");e.classList.add("selectionCheckmarkSprite");e.rowId=c.id;if(this.getCheckedFunc)e.checked=this.getCheckedFunc(a),e.checked?(this._highlightSelection&&c.classList.add("checkedRow"),e.classList.add("core-sprite-check_on")):
(this._highlightSelection&&c.classList.remove("checkedRow"),e.classList.remove("core-sprite-check_on"));b.appendChild(e);var f=this;e.addEventListener("click",function(b){f.onCheck(c,b.target,b.target.checked?!1:!0,!0)},!1);return b}},getCheckBoxId:function(a){return a+"selectedState"},onCheck:function(a,c,b,e,f){(c.checked=b)?c.classList.add("core-sprite-check_on"):c.classList.remove("core-sprite-check_on");if(this.onCheckedFunc)this.onCheckedFunc(c.rowId,b,e);this.explorer.getNavHandler()&&f&&this.explorer.getNavHandler().setSelection(this.explorer.getNavDict().getValue(a.id).model,
!0)},storeSelections:function(){if(this.explorer.getNavHandler()){var a=this.explorer.getNavHandler().getSelectionIds(),c=this._getUIStatePreferencePath();c&&window.sessionStorage&&(window.sessionStorage[c+"selection"]=JSON.stringify(a))}},_restoreSelections:function(a){var c=this.explorer.getNavDict(),b=this.explorer.getNavHandler();if(b&&c&&b.getSelectionPolicy()!=="cursorOnly"&&(a=window.sessionStorage[a+"selection"],typeof a==="string"&&(a=a.length>0?JSON.parse(a):null),a)){for(var e=[],b=0;b<
a.length;b++){var f=c.getValue(a[b]);if(f&&f.rowDomNode&&f.model&&(e.push(f.model),this._highlightSelection&&f.rowDomNode.classList.add("checkedRow"),f=j.node(this.getCheckBoxId(f.rowDomNode.id))))f.checked=!0,f.classList.add("core-sprite-check_on")}this.explorer.selection&&(this.explorer.selection.setSelections(e),this.explorer.getNavHandler()&&this.explorer.getNavHandler().refreshSelection())}},_storeExpansions:function(a){window.sessionStorage[a+"expanded"]=JSON.stringify(this._expanded)},_restoreExpansions:function(a){var c=
!1,b=window.sessionStorage[a+"expanded"];typeof b==="string"&&(b=b.length>0?JSON.parse(b):null);var e;if(b)for(e=0;e<b.length;e++)if(j.node(b[e])){this._expanded.push(b[e]);var f=this;this.tableTree.expand(b[e],function(){f._restoreSelections(a)});c=!0}return!c},_getUIStatePreferencePath:function(){if(this.explorer){var a=this.explorer.getRootPath();if(this._cachePrefix&&a)return"/"+this._cachePrefix+"/"+a.replace(/[^\.\:\-\_0-9A-Za-z]/g,"")+"/uiState"}return null},expandCollapseImageId:function(a){return a+
"__expand"},updateExpandVisuals:function(a,c){var b=j.node(this.expandCollapseImageId(a.id));b&&(b.classList.remove(this._expandImageClass),b.classList.remove(this._collapseImageClass),b.classList.remove(this._progressImageClass),b.classList.add(c==="progress"?this._progressImageClass:c?this._expandImageClass:this._collapseImageClass))},getExpandImage:function(a,c,b,e){var f=document.createElement("span");f.id=this.expandCollapseImageId(a.id);c.appendChild(f);f.classList.add(this._twistieSpriteClass);
f.classList.add(this._collapseImageClass);if(b){var g=document.createElement("span");c.appendChild(g);g.classList.add(e||"imageSprite");g.classList.add(b)}var h=this;f.onclick=function(){if(!h.explorer.getNavHandler().isDisabled(a)){h.tableTree.toggle(a.id);if(h.tableTree.isExpanded(a.id))h._expanded.push(a.id),h.explorer.postUserExpand&&h.explorer.postUserExpand(a.id);else for(var b in h._expanded)if(h._expanded[b]===a.id){h._expanded.splice(b,1);break}(b=h._getUIStatePreferencePath())&&window.sessionStorage&&
h._storeExpansions(b)}};return f},render:function(a,c){c.classList.add("navRow");this.renderRow(a,c)},rowsChanged:function(){this.explorer.selectionPolicy!=="cursorOnly"&&(this.explorer.refreshSelection(),this.explorer.initNavHandler());(j.$(".sectionTreeTable",this.tableNode.parentNode)||j.$(".treetable",this.tableNode.parentNode))&&j.$$array(".treeTableRow",this.tableNode).forEach(function(a,c){var b=!(c%2)?"darkSectionTreeTableRow":"lightSectionTreeTableRow",e=b==="darkSectionTreeTableRow"?"lightSectionTreeTableRow":
"darkSectionTreeTableRow";a.classList.add(b);a.classList.remove(e)})},updateCommands:function(){if(this.commandService)for(var a=j.$$array(".treeTableRow"),c=0;c<a.length;c++){var b=a[c],e=j.node(b.id+"actionswrapper");this.commandService.destroy(e);this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,e,b._item,this.explorer,"tool")}},_initializeUIState:function(){this._expanded=[];var a=this._getUIStatePreferencePath();a&&window.sessionStorage&&this._restoreExpansions(a)&&this._restoreSelections(a)}};
return a}();e.SelectionRenderer=function(){function a(d,c){this._init(d);this.explorer=c}a.prototype=new e.ExplorerRenderer;a.prototype.renderTableHeader=function(a){var c=document.createElement("thead"),b=document.createElement("tr");c.classList.add("navTableHeading");this._useCheckboxSelection&&b.appendChild(this.initCheckboxColumn(a));for(var e=0,f=this.getCellHeaderElement(e);f;)f.innerHTML.length>0&&f.classList.add("navColumn"),b.appendChild(f),f=this.getCellHeaderElement(++e);c.appendChild(b);
e>0&&a.appendChild(c)};a.prototype.renderRow=function(a,c){c.verticalAlign="baseline";c.classList.add("treeTableRow");var b=this.explorer.getNavDict();if(b){b.addRow(a,c);var e=this;c.addEventListener("click",function(b){if(e.explorer.getNavHandler())e.explorer.getNavHandler().onClick(a,b)},!1)}if(b=this.getCheckboxColumn(a,c))b.classList.add("checkColumn"),c.appendChild(b);for(var b=0,f=this.getCellElement(b,a,c);f;)c.appendChild(f),b===0?this.getPrimColumnStyle?f.classList.add(this.getPrimColumnStyle(a)):
f.classList.add("navColumn"):this.getSecondaryColumnStyle?f.classList.add(this.getSecondaryColumnStyle()):f.classList.add("secondaryColumn"),f=this.getCellElement(++b,a,c)};a.prototype.getCellHeaderElement=function(){};a.prototype.getCellElement=function(){};return a}();e.SimpleFlatModel=function(){function a(d,c,b){this.items=d;this.getKey=b;this.idPrefix=c;this.root={children:d}}a.prototype=new e.ExplorerModel;a.prototype.getRoot=function(a){a(this.root)};a.prototype.getId=function(a){for(var a=
this.getKey(a).replace(/[\\\/]/g,""),c="",b=0;b<a.length;b++)c+=a[b].match(/[^\.\:\-\_0-9A-Za-z]/g)?a.charCodeAt(b):a[b];return this.idPrefix+c};a.prototype.getChildren=function(a,c){a===this.root?c(this.items):c([])};return a}();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(i,k,j,h,a,g,e,f){function d(b){switch(b&&b.id){case "image/jpeg":case "image/png":case "image/gif":case "image/ico":case "image/tiff":case "image/svg":return!0}return!1}function c(b,c,f,h,i,j,r,u,v){var c=g.clone(c),n;if(c.Directory)n=document.createElement("a"),
n.className="navlinkonpage",n.href=!b?l:(new e(b+"#{,resource,params*}")).expand({resource:c.ChildrenLocation}),c.Name&&n.appendChild(document.createTextNode(c.Name));else{i||(i=a.getOpenWithCommands(f));n=document.createElement("a");n.className="navlink targetSelector";j&&typeof j==="object"&&Object.keys(j).forEach(function(b){n[b]=j[b]});var w=null,x=null;if(w=u?u.holderDom:n)x=document.createElement("span"),x.className="core-sprite-file modelDecorationSprite thumbnail",w.appendChild(x);c.Name&&
n.appendChild(document.createTextNode(c.Name));var y=c.Location;if(r&&typeof r==="object")c.params={},g.mixin(c.params,r);(b=a.getOpenWithCommand(f,c,i))&&(y=b.hrefCallback({items:c}));k.when(h.getFileContentType(c),function(b){if(w){var a=w,e=x;if(b){var f,g=b.imageClass,h=b.image;if(g)f=document.createElement("span"),f.className+=g,f.classList.add("thumbnail");else if(h)f=document.createElement("img"),f.src=h,f.classList.add("thumbnail");f&&a.replaceChild(f,e)}}n.href=y;v&&typeof v.updateFileNode===
"function"&&v.updateFileNode(c,n,d(b))})}return n}function b(b,a,c,d){this.explorer=a;this.commandService=c;this.contentTypeService=d;this.openWithCommands=null;this.actionScopeId=b.actionScopeId;this._init(b);this.target="_self"}var l=new e("#{,resource,params*}");b.prototype=new j.SelectionRenderer;b.prototype.wrapperCallback=function(b){b.setAttribute("role","tree")};b.prototype.tableCallback=function(b){b.setAttribute("aria-label",i.Navigator);b.setAttribute("role","presentation")};b.prototype.rowCallback=
function(b){b.setAttribute("role","treeitem")};b.prototype.emptyCallback=function(b){var a=document.createElement("tr"),c=document.createElement("td");c.colSpan=this.oneColumn?1:3;var d=document.createElement("div");d.classList.add("noFile");d.textContent=i.NoFile;var e=document.createElement("span");e.appendChild(document.createTextNode(i.File));f.processDOMNodes(d,[e]);c.appendChild(d);a.appendChild(c);b.appendChild(a)};b.prototype.getCellHeaderElement=function(b){if(this.oneColumn&&b!==0)return null;
switch(b){case 0:case 1:case 2:document.createElement("th").style.height="8px"}};b.prototype.setTarget=function(b){this.target=b};b.prototype.getFolderImage=function(){if(!this.showFolderImage)return null;var b=document.createElement("span");b.className="core-sprite-folder modelDecorationSprite";return b};b.prototype.createFolderNode=function(b){var a;this.showFolderLinks?(a=c(this.folderLink||"",b,this.commandService,this.contentTypeService),(b=this.getFolderImage(b))&&a.insertBefore(b,a.firstChild)):
(a=document.createElement("span"),a.textContent=b.Name);return a};b.prototype.updateFileNode=function(){};b.prototype.showFolderLinks=!0;b.prototype.getCellElement=function(b,d,e){switch(b){case 0:var b=document.createElement("td"),f=document.createElement("span");f.id=e.id+"MainCol";f.setAttribute("role","presentation");b.appendChild(f);b.setAttribute("role","presentation");f.className="mainNavColumn";var g;if(d.Directory)this.getExpandImage(e,f),g=this.createFolderNode(d),f.appendChild(g),this.explorer._makeDropTarget(d,
g),this.explorer._makeDropTarget(d,e);else{if(!this.openWithCommands)this.openWithCommands=a.getOpenWithCommands(this.commandService);g=c("",d,this.commandService,this.contentTypeService,this.openWithCommands,{target:this.target},null,null,this);f.appendChild(g)}if(g)g.id=e.id+"NameLink",g.nodeType===1&&(h.addNavGrid(this.explorer.getNavDict(),d,g),g.setAttribute("role","link"),g.setAttribute("tabindex","-1"));this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,f,d,this.explorer,
"tool",null,!0);return b;case 1:if(this.oneColumn)return null;e=document.createElement("td");if(d.LocalTimeStamp)e.textContent=(new Date(d.LocalTimeStamp)).toLocaleString();return e;case 2:if(this.oneColumn)return null;e=document.createElement("td");if(!d.Directory&&typeof d.Length==="number")d=parseInt(d.Length,10)/1024,e.textContent=Math.ceil(d).toLocaleString()+" KB";e.style.textAlign="right";return e}};b.prototype.constructor=b;return{NavigatorRenderer:b,isImage:d,createLink:c}});
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(i,k,j,h,a,g,e,f,d){function c(b,a){this.serviceRegistry=b;this.commandRegistry=a;this.openWithCommands=null}function b(b){this.registry=b.serviceRegistry;this._commandService=b.commandService;this._fileService=b.fileService;this.defaultRenderer=new c(this.registry,
this._commandService);this._fileService||console.error("No file service on search client")}c.prototype.makeRenderFunction=function(b,c,g,o,q){var p=this.serviceRegistry,t=this.commandRegistry;this.openWithCommands=this.openWithCommands||f.createOpenWithCommands(p,b,t);var r=this;return function(f,p,n,w){d.when(r.openWithCommands,function(d){if(n)j.empty(c),d=document.createElement("div"),d.appendChild(document.createTextNode(i["Search failed."])),c.appendChild(d),typeof o==="function"&&o(c);else{var y=
function(){function b(a,c){var d=c.folderName?c.folderName:c.path,n=document.createElement("span");n.id=d.replace(/[^a-zA-Z0-9_\.:\-]/g,"");n.appendChild(document.createTextNode(" - "+d+" "));a.appendChild(n)}var a={};return function(c,d){var n=d.name;if(a.hasOwnProperty(n)){b(c,d);var e=a[n];typeof e==="function"&&(a[n]=null,e())}else a[n]=function(){b(c,d)}}}(),F=!1;j.empty(c);if(f&&f.length>0){var H=document.createElement("table");H.setAttribute("role","presentation");for(var D=0;D<f.length;D++){var G=
f[D],r;if(!F&&(F=!0,g))r=H.insertRow(0).insertCell(0),r.textContent=g;r=H.insertRow(-1).insertCell(0);r.colspan=2;q&&q(r);var J={Name:G.name,Directory:G.directory,Location:G.path||G.location},E=null;if(typeof G.LineNumber==="number")E={},E.line=G.LineNumber;if(w&&w.keyword&&!w.nameSearch){var B=a.generateSearchHelper(w),E=E||{};E.find=B.inFileQuery.searchStr;E.regEx=B.inFileQuery.wildCard?!0:void 0}J=e.createLink(k.toUrl("edit/edit.html"),J,t,b,d,{"aria-describedby":(G.folderName?G.folderName:G.path).replace(/[^a-zA-Z0-9_\.:\-]/g,
""),style:{verticalAlign:"middle"}},E);G.LineNumber&&J.appendChild(document.createTextNode(" (Line "+G.LineNumber+")"));r.appendChild(J);y(r,G)}c.appendChild(H);typeof o==="function"&&o(c)}!F&&p&&(d=h.formatMessage(i["No matches found for ${0}"],p),j.empty(c),c.appendChild(document.createTextNode(d)),typeof o==="function"&&o(c))}})}};b.prototype={search:function(b,c,d){var e=function(b){for(var d=[],e=0;e<b.response.docs.length;e++){var f=b.response.docs[e],g=f.Location,n=a.path2FolderName(f.Path?
f.Path:f.Location,f.Name),h=n?n:g;(c?h.indexOf(c)>=0:1)&&d.push({name:f.Name,path:g,folderName:n,directory:f.Directory,lineNumber:f.LineNumber})}return d};if(this._crawler&&b.nameSearch)this._crawler.searchName(b,function(a){d(e(a),b.keyword,null,b)});else try{this.registry.getService("orion.page.progress").progress(this._fileService.search(b),"Searching "+b.keyword).then(function(a){var c=b.keyword,c=c.substring(c.indexOf("}")+1),c=c.substring(c.indexOf(":")+1);d(e(a),c,null,b)},function(b){d(null,
null,b,null)})}catch(f){typeof f==="string"&&f.indexOf("search")>-1&&this._crawler?this._crawler.searchName(b,function(a){d(e(a),null,null,b)}):typeof f==="string"&&f.indexOf("search")>-1&&!b.nameSearch?(new g.SearchCrawler(this.registry,this._fileService,b,{childrenLocation:this.getChildrenLocation()})).search(function(a){d(e(a),null,null,b)}):this.registry.getService("orion.page.message").setErrorMessage(f)}},getFileService:function(){return this._fileService},setCrawler:function(b){this._crawler=
b},handleError:function(b,a){console.error(b);j.empty(a);a.appendChild(document.createTextNode(b));return b},setLocationByMetaData:function(b,a){var c="",d=null;this._searchRootLocation=this._fileService.fileServiceRootURL(b.Location);a&&b&&b.Parents&&b.Parents.length>0?d=a.index==="last"?b.Parents[b.Parents.length-1]:b.Parents[0]:b&&b.Directory&&b.Location&&b.Parents&&(d=b);if(d)this.setLocationbyURL(d.Location),c=d.Name,this._childrenLocation=d.ChildrenLocation;else if(b)this.setLocationbyURL(this._searchRootLocation),
c=this._fileService.fileServiceName(b.Location),this._childrenLocation=b.ChildrenLocation;d=j.node("search");c||(c="");if(d&&d.placeholder){d.value="";var e=h.formatMessage(i["Search ${0}"],c);d.placeholder=e.length>30?e.substring(0,27)+"...":h.formatMessage(i["Search ${0}"],c)}if(d&&d.title)d.title=i["Type a keyword or wild card to search in "]+c},setLocationbyURL:function(b){this._searchLocation=b},setRootLocationbyURL:function(b){this._searchRootLocation=b},setChildrenLocationbyURL:function(b){this._childrenLocation=
b},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(b,a,c,d){c=c?this.getSearchRootLocation():this.getSearchLocation();return a?{resource:c,sort:"NameLower asc",
rows:100,start:0,nameSearch:!0,keyword:b}:{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:b,replace:d?d.replace:void 0}}};b.prototype.constructor=b;return{Searcher:b}});
define("orion/links",[],function(){function i(i){this._init(i)}i.prototype={_init:function(i){this._registry=i.serviceRegistry;this._serviceRegistration=this._registry.registerService("orion.core.textlink",this)},_replaceLink:function(i,j,h,a,g){var e=i.search(h);e>0&&(j.appendChild(document.createTextNode(i.substring(0,e))),i=i.substring(e));var h=i.replace(h,""),e=i.substring(0,i.length-h.length),f=e.split(" ",a);if(f.length===a){for(var i=document.createElement("a"),d=0;d<a;d++)g=g.replace("%"+
(d+1),f[d]);i.setAttribute("href",g);i.textContent=e;j.appendChild(i);i=h}return i},addLinks:function(i,j){var h=j||document.createElement("div"),a=this._registry.getServiceReferences("orion.core.linkScanner");if(a.length>0)for(var g=a[0],a=RegExp(g.getProperty("pattern"),"i"),e=g.getProperty("words"),g=g.getProperty("anchor"),f=i.search(a);f>=0;)i=this._replaceLink(i,h,a,e,g),f=i.search(a);i.length>0&&h.appendChild(document.createTextNode(i));return h}};i.prototype.constructor=i;return{TextLinkService:i}});
define("orion/operation",["orion/xhr","orion/Deferred"],function(i,k){function j(a,g,e,f){i("GET",a,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(d){d=d.response?JSON.parse(d.response):null;g.progress(d);!d.type||d.type==="loadstart"||d.type==="progress"?setTimeout(function(){j(a,g,e,f)},2E3):(d.type==="error"||d.type==="abort"?g.reject(f?f(d):d.Result):g.resolve(e?e(d):d.Result.JsonData),d.Location||i("DELETE",a,{headers:{"Orion-Version":"1"},timeout:15E3}))},function(a){var c=a;if(a.responseText!==
void 0){c=a.responseText;try{c=JSON.parse(a.responseText)}catch(b){}}c.Message!==void 0?(c.HttpCode=c.HttpCode===void 0?a.status:c.HttpCode,c.Severity=c.Severity===void 0?"Error":c.Severity,g.reject(c)):g.reject({Severity:"Error",Message:c,HttpCode:a.status})})}function h(a,g){g.then(null,function(e){e instanceof Error&&e.name==="Cancel"&&i("PUT",a,{headers:{"Orion-Version":"1"},data:JSON.stringify({abort:!0}),timeout:15E3})})}return{handle:function(a,g,e){var f=new k;h(a,f);j(a,f,g,e);return f}}});
define("orion/cfui/cFClient",["require","orion/xhr","orion/Deferred","orion/operation"],function(i,k,j,h){var a=a||{};a.CFService=function(){function a(e){if(e)this._serviceRegistry=e,this._serviceRegistration=e.registerService("orion.cf.service",this)}a.prototype={_getServiceResponse:function(a,f){var d=f.response?JSON.parse(f.response):null;if(f.xhr&&f.xhr.status===202){var c=h.handle(d.Location);c.then(function(b){try{a.resolve(JSON.parse(b))}catch(c){a.resolve(b)}},function(b){b.failedOperation=
d.Location;a.reject(b)},a.progress);a.then(null,function(b){c.reject(b)})}else a.resolve(d)},_handleServiceResponseError:function(a,f){a.reject(this._translateResponseToStatus(f))},_translateResponseToStatus:function(a){var f;try{f=JSON.parse(a.responseText)}catch(d){f={Message:messages["Problem while performing the action"]}}f.HttpCode=a.status;return f},_xhrV1:function(a,f,d){var c=this,b=new j;k(a,f,{headers:{"CF-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",
data:JSON.stringify(d)}).then(function(a){c._getServiceResponse(b,a)},function(a){c._handleServiceResponseError(b,a)});return b},setTarget:function(a,f,d){a={Url:a};if(f)a.Org=f;if(d)a.Space=d;return this._xhrV1("POST",i.toUrl("cfapi/target"),a)},login:function(a,f,d){var c={};if(a)c.Url=a;if(f)c.Username=f,c.Password=d;return this._xhrV1("POST",i.toUrl("cfapi/target"),c)},logout:function(){return this._xhrV1("DELETE",i.toUrl("cfapi/target"))},getLogs:function(a,f,d,c){f||(new j).reject("Application name not set");
f=i.toUrl("cfapi/logs/"+f);d&&(f+="/"+d);c&&(f+="/"+c);a&&(f+="?Target="+JSON.stringify(a));return this._xhrV1("GET",f)},getTarget:function(){return this._xhrV1("GET",i.toUrl("cfapi/target"))},getInfo:function(){return this._xhrV1("GET",i.toUrl("cfapi/info"))},pushApp:function(a,f,d){f={Name:f,ContentLocation:d};if(a)f.Target=a;return this._xhrV1("PUT",i.toUrl("cfapi/apps"),f)},getApp:function(a,f,d){var c=i.toUrl("cfapi/apps");f?c+="?Name="+f:location&&(c+="?ContentLocation="+d);a&&(c+="&Target="+
JSON.stringify(a));return this._xhrV1("GET",c)},getApps:function(){return this._xhrV1("GET",i.toUrl("cfapi/apps"))},startApp:function(a,f,d){f={Name:f,ContentLocation:d,State:"Started"};if(a)f.Target=a;return this._xhrV1("PUT",i.toUrl("cfapi/apps"),f)},stopApp:function(a,f,d){f={Name:f,ContentLocation:d,State:"Stopped"};if(a)f.Target=a;return this._xhrV1("PUT",i.toUrl("cfapi/apps"),f)}};return a}();return a});
define("orion/cfui/logsExplorer",["orion/webui/littlelib","orion/explorers/explorer","orion/objects","orion/URITemplate"],function(i,k,j,h){function a(a,d){this.root=a;this.numberOfInstances=Object.keys(this.root.logs).length;this.prefix=d}function g(a,d){this._init(a);this.explorer=d;this.commandService=a.commandRegistry;this.actionScopeId=a.actionScopeId;this.colorLightDarkRows=a.isMiniNav}function e(a,d,c,b,e,h){this.parent=b;this.titleNode=e;k.Explorer.apply(this,[a,d,new g({singleSelection:!0,
checkbox:!1,commandRegistry:c,isMiniNav:h},this),c])}a.prototype=new k.ExplorerModel;j.mixin(a.prototype,{getRoot:function(a){a(this.root)},getChildren:function(a,d){if(a===this.root)if(this.numberOfInstances===1){var c=Object.keys(this.root.logs)[0];this.root.children=this.root.logs[c];this.root.children.forEach(function(b){b.parent=this.root;b.Target=this.root.Target;b.Instance=c}.bind(this));d(this.root.children)}else{var b=[],e;for(e in this.root.logs)b.push({Instance:e,Children:this.root.logs[e],
Type:"Instance",parent:a});this.root.children=b;d(b)}else a.Instance?(b=a.Children,b.forEach(function(b){b.parent=a;b.Instance=a.Instance;b.Target=this.root.Target}.bind(this)),a.children=b,d(b)):d([])},getId:function(a){return a===this.root?this.prefix+this.root.Application:a.Instance&&a.Children?this.prefix+this.root.Application+"_"+a.Instance:a.Instance&&a.Name?this.prefix+this.root.Application+"_"+a.Instance+"_"+a.Name:this.prefix+this.root.Application+"_"+a.Name},constructor:a});g.prototype=
new k.SelectionRenderer;g.prototype.constructor=g;j.mixin(g.prototype,{getCellElement:function(a,d,c){if(a!==0)return null;var a=document.createElement("td"),b=document.createElement("span");b.id=c.id+"MainCol";b.setAttribute("role","presentation");a.appendChild(b);a.setAttribute("role","presentation");b.className="mainNavColumn";if(d.Type==="Log"){c=document.createElement("span");c.className="coreImageSprite core-sprite-file";c.style.paddingLeft="16px";b.appendChild(c);c=document.createElement("a");
c.appendChild(document.createTextNode(d.Name));var e=d.Target?j.clone(d.Target):{};j.mixin(e,{instance:d.Instance,log:d.Name});c.href=(new h("#{,resource,params*}")).expand({resource:d.Application,params:e});b.appendChild(c)}else d.Type==="Instance"&&(this.getExpandImage(c,b),b.appendChild(document.createTextNode("Instance: "+d.Instance)));a.appendChild(b);return a},rowsChanged:function(){k.SelectionRenderer.prototype.rowsChanged.apply(this,arguments);this.colorLightDarkRows&&(i.$$array(".darkSectionTreeTableRow",
this.tableNode).forEach(function(a){a.classList.remove("darkSectionTreeTableRow")}),i.$$array(".lightSectionTreeTableRow",this.tableNode).forEach(function(a){a.classList.remove("lightSectionTreeTableRow")}))},prototype:g});e.prototype=Object.create(k.Explorer.prototype);j.mixin(e.prototype,{load:function(e){this.logs=e;if(e.Application&&this.titleNode){i.empty(this.titleNode);var d=document.createElement("span");d.id="LogsNavigationTitle";d.className="filesystemName layoutLeft";d.appendChild(document.createTextNode(e.Application));
this.titleNode.appendChild(d)}this.createTree(this.parent,new a(e,this.parent.id),{indent:"8px"});this.initNavHandler()},constructor:e});return{LogsExplorer:e}});define("orion/editor/i18n",{load:function(i,k,j){k.specified&&k.specified("orion/bootstrap")?k(["orion/i18n!"+i],function(h){j(h)}):j({})}});
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(i,k){var j={root:k},h;for(h in i)i.hasOwnProperty(h)&&typeof j[h]==="undefined"&&(j[h]=i[h]);return j});
define("orion/editor/textModel",["orion/editor/eventTarget","orion/regex","orion/util"],function(i,k,j){function h(a,g){this._lastLineIndex=-1;this._text=[""];this._lineOffsets=[0];this.setText(a);this.setLineDelimiter(g)}h.prototype={destroy:function(){},find:function(a){if(this._text.length>1)this._text=[this._text.join("")];var g=a.string,e=a.regex,f=g,d="",c=a.caseInsensitive;if(f)if(e){if(g=k.parse(f))f=g.pattern,d=g.flags}else f=g.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$&"),c&&(f=f.replace(/[iI\u0130\u0131]/g,
"[Ii\u0130\u0131]"));var b=null,h;if(f){var g=a.reverse,i=a.wrap,e=a.wholeWord,j=a.start||0,a=a.end,o=a!==null&&a!==void 0;d.indexOf("g")===-1&&(d+="g");d.indexOf("m")===-1&&(d+="m");c&&d.indexOf("i")===-1&&(d+="i");e&&(f="\\b"+f+"\\b");var q=this._text[0],p,t,r=0;o&&(c=j<a?j:a,q=q.substring(c,j<a?a:j),r=c);var u=RegExp(f,d);if(g)h=function(){var b=null;for(u.lastIndex=0;;){t=u.lastIndex;p=u.exec(q);if(t===u.lastIndex)return null;if(p){if(!(p.index+r<j)){if(!i||b)break;j=q.length+r}b={start:p.index+
r,end:u.lastIndex+r}}else break}if(b)j=b.start;return b};else{if(!o)u.lastIndex=j;h=function(){for(;;){t=u.lastIndex;p=u.exec(q);if(t===u.lastIndex)break;if(p)return{start:p.index+r,end:u.lastIndex+r};if(!(t!==0&&i))break}return null}}b=h()}return{next:function(){var a=b;a&&(b=h());return a},hasNext:function(){return b!==null}}},getCharCount:function(){for(var a=0,g=0;g<this._text.length;g++)a+=this._text[g].length;return a},getLine:function(a,g){var e=this.getLineCount();if(!(0<=a&&a<e))return null;
var f=this._lineOffsets[a];if(a+1<e){e=this.getText(f,this._lineOffsets[a+1]);if(g)return e;for(var f=e.length,d;(d=e.charCodeAt(f-1))===10||d===13;)f--;return e.substring(0,f)}else return this.getText(f)},getLineAtOffset:function(a){var g=this.getCharCount();if(!(0<=a&&a<=g))return-1;var e=this.getLineCount();if(a===g)return e-1;var f,d,c=this._lastLineIndex;if(0<=c&&c<e&&(f=this._lineOffsets[c],d=c+1<e?this._lineOffsets[c+1]:g,f<=a&&a<d))return c;for(var b=e,h=-1;b-h>1;)if(c=Math.floor((b+h)/2),
f=this._lineOffsets[c],d=c+1<e?this._lineOffsets[c+1]:g,a<=f)b=c;else if(a<d){b=c;break}else h=c;return this._lastLineIndex=b},getLineCount:function(){return this._lineOffsets.length},getLineDelimiter:function(){return this._lineDelimiter},getLineEnd:function(a,g){var e=this.getLineCount();if(!(0<=a&&a<e))return-1;if(a+1<e){e=this._lineOffsets[a+1];if(g)return e;for(var f=this.getText(Math.max(this._lineOffsets[a],e-2),e),d=f.length,c;(c=f.charCodeAt(d-1))===10||c===13;)d--;return e-(f.length-d)}else return this.getCharCount()},
getLineStart:function(a){return!(0<=a&&a<this.getLineCount())?-1:this._lineOffsets[a]},getText:function(a,g){a===void 0&&(a=0);g===void 0&&(g=this.getCharCount());if(a===g)return"";for(var e=0,f=0,d;f<this._text.length;){d=this._text[f].length;if(a<=e+d)break;e+=d;f++}for(var c=e,b=f;f<this._text.length;){d=this._text[f].length;if(g<=e+d)break;e+=d;f++}if(b===f)return this._text[b].substring(a-c,g-e);c=this._text[b].substring(a-c);e=this._text[f].substring(0,g-e);return c+this._text.slice(b+1,f).join("")+
e},onChanging:function(a){return this.dispatchEvent(a)},onChanged:function(a){return this.dispatchEvent(a)},setLineDelimiter:function(a,g){a==="auto"&&(a=void 0,this.getLineCount()>1&&(a=this.getText(this.getLineEnd(0),this.getLineEnd(0,!0))));this._lineDelimiter=a?a:j.platformDelimiter;if(g){var e=this.getLineCount();if(e>1){for(var f=Array(e),d=0;d<e;d++)f[d]=this.getLine(d);this.setText(f.join(this._lineDelimiter))}}},setText:function(a,g,e){a===void 0&&(a="");g===void 0&&(g=0);e===void 0&&(e=
this.getCharCount());if(!(g===e&&a==="")){for(var f=this.getLineAtOffset(g),d=this.getLineAtOffset(e),c=g,b=e-g,h=d-f,i=a.length,j=0,o=this.getLineCount(),q=0,p=0,k=0,r=[];;){q!==-1&&q<=k&&(q=a.indexOf("\r",k));p!==-1&&p<=k&&(p=a.indexOf("\n",k));if(p===-1&&q===-1)break;k=q!==-1&&p!==-1?q+1===p?p+1:(q<p?q:p)+1:q!==-1?q+1:p+1;r.push(g+k);j++}this.onChanging({type:"Changing",text:a,start:c,removedCharCount:b,addedCharCount:i,removedLineCount:h,addedLineCount:j});r.length===0&&(k=this.getLineStart(f),
d=d+1<o?this.getLineStart(d+1):this.getCharCount(),g!==k&&(a=this.getText(k,g)+a,g=k),e!==d&&(a+=this.getText(e,d),e=d));k=i-b;for(d=f+h+1;d<o;d++)this._lineOffsets[d]+=k;if(r.length<5E4)f=[f+1,h].concat(r),Array.prototype.splice.apply(this._lineOffsets,f);else{k=f+1;this._lineOffsets.splice(k,h);for(o=0;o<r.length;o+=5E4)f=[k,0].concat(r.slice(o,Math.min(r.length,o+5E4))),Array.prototype.splice.apply(this._lineOffsets,f),k+=5E4}for(k=o=0;k<this._text.length;){d=this._text[k].length;if(g<=o+d)break;
o+=d;k++}f=o;for(r=k;k<this._text.length;){d=this._text[k].length;if(e<=o+d)break;o+=d;k++}d=this._text[k];g=this._text[r].substring(0,g-f);e=d.substring(e-o);r=[r,k-r+1];g&&r.push(g);a&&r.push(a);e&&r.push(e);Array.prototype.splice.apply(this._text,r);if(this._text.length===0)this._text=[""];this.onChanged({type:"Changed",start:c,removedCharCount:b,addedCharCount:i,removedLineCount:h,addedLineCount:j})}}};i.EventTarget.addMixin(h.prototype);return{TextModel:h}});
define("orion/editor/keyModes",["orion/keyBinding","orion/util"],function(i,k){function j(a){if(a)this._view=a,this._keyBindings=this.createKeyBindings(),this._keyBindingIndex=0}function h(a){j.call(this,a)}j.prototype={createKeyBindings:function(){return[]},getKeyBindings:function(a){for(var g=[],e=this._keyBindings,f=0;f<e.length;f++)e[f].actionID===a&&g.push(e[f].keyBinding);return g},getView:function(){return this._view},isActive:function(){return this._view.getKeyModes().indexOf(this)!==-1},
match:function(a){if(a.type==="keydown")switch(a.keyCode){case 16:case 17:case 18:case 91:return}for(var g=this._keyBindingIndex,e=this._matchingKeyBindings||this._keyBindings,f=[],d=0;d<e.length;d++){var c=e[d],b=c.keyBinding.match(a,g);if(b===!0)return this._keyBindingIndex=0,this._matchingKeyBindings=null,c.actionID;else typeof b==="number"&&f.push(c)}if(f.length===0)this._keyBindingIndex=0,this._matchingKeyBindings=null;else return this._keyBindingIndex++,this._matchingKeyBindings=f,"noop"},setKeyBinding:function(a,
g){for(var e=this._keyBindings,f=0;f<e.length;f++){var d=e[f];if(d.keyBinding.equals(a)){g?d.actionID=g:d.predefined?d.actionID="noop":e.splice(f,1);return}}g&&e.push({keyBinding:a,actionID:g})},setView:function(a){this._view=a}};h.prototype=new j;h.prototype.createKeyBindings=function(){var a=i.KeyBinding,g=[];g.push({actionID:"lineUp",keyBinding:new a(38),predefined:!0});g.push({actionID:"lineDown",keyBinding:new a(40),predefined:!0});g.push({actionID:"charPrevious",keyBinding:new a(37),predefined:!0});
g.push({actionID:"charNext",keyBinding:new a(39),predefined:!0});k.isMac?(g.push({actionID:"scrollPageUp",keyBinding:new a(33),predefined:!0}),g.push({actionID:"scrollPageDown",keyBinding:new a(34),predefined:!0}),g.push({actionID:"pageUp",keyBinding:new a(33,null,null,!0),predefined:!0}),g.push({actionID:"pageDown",keyBinding:new a(34,null,null,!0),predefined:!0}),g.push({actionID:"lineStart",keyBinding:new a(37,!0),predefined:!0}),g.push({actionID:"lineEnd",keyBinding:new a(39,!0),predefined:!0}),
g.push({actionID:"wordPrevious",keyBinding:new a(37,null,null,!0),predefined:!0}),g.push({actionID:"wordNext",keyBinding:new a(39,null,null,!0),predefined:!0}),g.push({actionID:"scrollTextStart",keyBinding:new a(36),predefined:!0}),g.push({actionID:"scrollTextEnd",keyBinding:new a(35),predefined:!0}),g.push({actionID:"textStart",keyBinding:new a(38,!0),predefined:!0}),g.push({actionID:"textEnd",keyBinding:new a(40,!0),predefined:!0}),g.push({actionID:"scrollPageUp",keyBinding:new a(38,null,null,null,
!0),predefined:!0}),g.push({actionID:"scrollPageDown",keyBinding:new a(40,null,null,null,!0),predefined:!0}),g.push({actionID:"lineStart",keyBinding:new a(37,null,null,null,!0),predefined:!0}),g.push({actionID:"lineEnd",keyBinding:new a(39,null,null,null,!0),predefined:!0}),g.push({actionID:"lineStart",keyBinding:new a(38,null,null,!0),predefined:!0}),g.push({actionID:"lineEnd",keyBinding:new a(40,null,null,!0),predefined:!0})):(g.push({actionID:"pageUp",keyBinding:new a(33),predefined:!0}),g.push({actionID:"pageDown",
keyBinding:new a(34),predefined:!0}),g.push({actionID:"lineStart",keyBinding:new a(36),predefined:!0}),g.push({actionID:"lineEnd",keyBinding:new a(35),predefined:!0}),g.push({actionID:"wordPrevious",keyBinding:new a(37,!0),predefined:!0}),g.push({actionID:"wordNext",keyBinding:new a(39,!0),predefined:!0}),g.push({actionID:"textStart",keyBinding:new a(36,!0),predefined:!0}),g.push({actionID:"textEnd",keyBinding:new a(35,!0),predefined:!0}));k.isFirefox&&k.isLinux&&(g.push({actionID:"lineUp",keyBinding:new a(38,
!0),predefined:!0}),g.push({actionID:"lineDown",keyBinding:new a(40,!0),predefined:!0}));k.isWindows&&(g.push({actionID:"scrollLineUp",keyBinding:new a(38,!0),predefined:!0}),g.push({actionID:"scrollLineDown",keyBinding:new a(40,!0),predefined:!0}));g.push({actionID:"selectLineUp",keyBinding:new a(38,null,!0),predefined:!0});g.push({actionID:"selectLineDown",keyBinding:new a(40,null,!0),predefined:!0});g.push({actionID:"selectCharPrevious",keyBinding:new a(37,null,!0),predefined:!0});g.push({actionID:"selectCharNext",
keyBinding:new a(39,null,!0),predefined:!0});g.push({actionID:"selectPageUp",keyBinding:new a(33,null,!0),predefined:!0});g.push({actionID:"selectPageDown",keyBinding:new a(34,null,!0),predefined:!0});k.isMac?(g.push({actionID:"selectLineStart",keyBinding:new a(37,!0,!0),predefined:!0}),g.push({actionID:"selectLineEnd",keyBinding:new a(39,!0,!0),predefined:!0}),g.push({actionID:"selectWordPrevious",keyBinding:new a(37,null,!0,!0),predefined:!0}),g.push({actionID:"selectWordNext",keyBinding:new a(39,
null,!0,!0),predefined:!0}),g.push({actionID:"selectTextStart",keyBinding:new a(36,null,!0),predefined:!0}),g.push({actionID:"selectTextEnd",keyBinding:new a(35,null,!0),predefined:!0}),g.push({actionID:"selectTextStart",keyBinding:new a(38,!0,!0),predefined:!0}),g.push({actionID:"selectTextEnd",keyBinding:new a(40,!0,!0),predefined:!0}),g.push({actionID:"selectLineStart",keyBinding:new a(37,null,!0,null,!0),predefined:!0}),g.push({actionID:"selectLineEnd",keyBinding:new a(39,null,!0,null,!0),predefined:!0}),
g.push({actionID:"selectLineStart",keyBinding:new a(38,null,!0,!0),predefined:!0}),g.push({actionID:"selectLineEnd",keyBinding:new a(40,null,!0,!0),predefined:!0})):(k.isLinux&&(g.push({actionID:"selectWholeLineUp",keyBinding:new a(38,!0,!0),predefined:!0}),g.push({actionID:"selectWholeLineDown",keyBinding:new a(40,!0,!0),predefined:!0})),g.push({actionID:"selectLineStart",keyBinding:new a(36,null,!0),predefined:!0}),g.push({actionID:"selectLineEnd",keyBinding:new a(35,null,!0),predefined:!0}),g.push({actionID:"selectWordPrevious",
keyBinding:new a(37,!0,!0),predefined:!0}),g.push({actionID:"selectWordNext",keyBinding:new a(39,!0,!0),predefined:!0}),g.push({actionID:"selectTextStart",keyBinding:new a(36,!0,!0),predefined:!0}),g.push({actionID:"selectTextEnd",keyBinding:new a(35,!0,!0),predefined:!0}));g.push({actionID:"undo",keyBinding:new i.KeyBinding("z",!0),predefined:!0});k.isMac?g.push({actionID:"redo",keyBinding:new i.KeyBinding("z",!0,!0),predefined:!0}):g.push({actionID:"redo",keyBinding:new i.KeyBinding("y",!0),predefined:!0});
g.push({actionID:"deletePrevious",keyBinding:new a(8),predefined:!0});g.push({actionID:"deletePrevious",keyBinding:new a(8,null,!0),predefined:!0});g.push({actionID:"deleteNext",keyBinding:new a(46),predefined:!0});g.push({actionID:"deleteWordPrevious",keyBinding:new a(8,!0),predefined:!0});g.push({actionID:"deleteWordPrevious",keyBinding:new a(8,!0,!0),predefined:!0});g.push({actionID:"deleteWordNext",keyBinding:new a(46,!0),predefined:!0});g.push({actionID:"tab",keyBinding:new a(9),predefined:!0});
g.push({actionID:"shiftTab",keyBinding:new a(9,null,!0),predefined:!0});g.push({actionID:"enter",keyBinding:new a(13),predefined:!0});g.push({actionID:"enter",keyBinding:new a(13,null,!0),predefined:!0});g.push({actionID:"selectAll",keyBinding:new a("a",!0),predefined:!0});g.push({actionID:"toggleTabMode",keyBinding:new a("m",!0),predefined:!0});k.isMac&&(g.push({actionID:"deleteNext",keyBinding:new a(46,null,!0),predefined:!0}),g.push({actionID:"deleteWordPrevious",keyBinding:new a(8,null,null,!0),
predefined:!0}),g.push({actionID:"deleteWordNext",keyBinding:new a(46,null,null,!0),predefined:!0}));g.push({actionID:"toggleWrapMode",keyBinding:new i.KeyBinding("w",!0,!1,!0)});g.push({actionID:"toggleOverwriteMode",keyBinding:new i.KeyBinding(45)});if(!k.isFirefox){var e=k.isMac&&k.isChrome;g.push({actionID:"noop",keyBinding:new a("u",!e,!1,!1,e),predefined:!0});g.push({actionID:"noop",keyBinding:new a("i",!e,!1,!1,e),predefined:!0});g.push({actionID:"noop",keyBinding:new a("b",!e,!1,!1,e),predefined:!0})}k.isFirefox&&
(g.push({actionID:"copy",keyBinding:new a(45,!0),predefined:!0}),g.push({actionID:"paste",keyBinding:new a(45,null,!0),predefined:!0}),g.push({actionID:"cut",keyBinding:new a(46,null,!0),predefined:!0}));k.isMac&&(g.push({actionID:"lineStart",keyBinding:new a("a",!1,!1,!1,!0),predefined:!0}),g.push({actionID:"lineEnd",keyBinding:new a("e",!1,!1,!1,!0),predefined:!0}),g.push({actionID:"lineUp",keyBinding:new a("p",!1,!1,!1,!0),predefined:!0}),g.push({actionID:"lineDown",keyBinding:new a("n",!1,!1,
!1,!0),predefined:!0}),g.push({actionID:"charPrevious",keyBinding:new a("b",!1,!1,!1,!0),predefined:!0}),g.push({actionID:"charNext",keyBinding:new a("f",!1,!1,!1,!0),predefined:!0}),g.push({actionID:"deletePrevious",keyBinding:new a("h",!1,!1,!1,!0),predefined:!0}),g.push({actionID:"deleteNext",keyBinding:new a("d",!1,!1,!1,!0),predefined:!0}),g.push({actionID:"deleteLineEnd",keyBinding:new a("k",!1,!1,!1,!0),predefined:!0}),k.isFirefox?(g.push({actionID:"scrollPageDown",keyBinding:new a("v",!1,
!1,!1,!0),predefined:!0}),g.push({actionID:"deleteLineStart",keyBinding:new a("u",!1,!1,!1,!0),predefined:!0}),g.push({actionID:"deleteWordPrevious",keyBinding:new a("w",!1,!1,!1,!0),predefined:!0})):(g.push({actionID:"pageDown",keyBinding:new a("v",!1,!1,!1,!0),predefined:!0}),g.push({actionID:"centerLine",keyBinding:new a("l",!1,!1,!1,!0),predefined:!0}),g.push({actionID:"enterNoCursor",keyBinding:new a("o",!1,!1,!1,!0),predefined:!0})));return g};return{KeyMode:j,DefaultKeyMode:h}});
define("orion/editor/util",[],function(){return{contains:function(i,k){if(!k)return!1;if(!i.compareDocumentPosition){for(var j=k;j;){if(i===j)return!0;j=j.parentNode}return!1}return i===k||(i.compareDocumentPosition(k)&16)!==0},addEventListener:function(i,k,j,h){typeof i.addEventListener==="function"?i.addEventListener(k,j,h===!0):i.attachEvent("on"+k,j)},removeEventListener:function(i,k,j,h){typeof i.removeEventListener==="function"?i.removeEventListener(k,j,h===!0):i.detachEvent("on"+k,j)}}});
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(i,k,j,h,a,g,e){function f(b,a,c){if(c){a.className="";for(var c=a.attributes,d=c.length;d-- >0;)(!e.isIE||e.isIE>=9||e.isIE<9&&c[d].specified)&&a.removeAttribute(c[d].name)}if(b){if(b.styleClass)a.className=b.styleClass;if(c=b.style)for(var f in c)c.hasOwnProperty(f)&&(a.style[f]=c[f]);if(b=b.attributes)for(var g in b)b.hasOwnProperty(g)&&
a.setAttribute(g,b[g])}}function d(b){return b instanceof Array?b.slice(0):b}function c(b,a){if(!b)return a;if(!a)return b;for(var c in a)a.hasOwnProperty(c)&&(b.hasOwnProperty(c)||(b[c]=a[c]));return b}function b(a,c){if(a===c)return!0;if(a&&!c||!a&&c)return!1;if(a&&a.constructor===String||c&&c.constructor===String)return!1;if(a instanceof Array||c instanceof Array){if(!(a instanceof Array&&c instanceof Array))return!1;if(a.length!==c.length)return!1;for(var d=0;d<a.length;d++)if(!b(a[d],c[d]))return!1;
return!0}if(!(a instanceof Object)||!(c instanceof Object))return!1;for(d in a)if(a.hasOwnProperty(d)){if(!c.hasOwnProperty(d))return!1;if(!b(a[d],c[d]))return!1}for(d in c)if(!a.hasOwnProperty(d))return!1;return!0}function l(b,a,c){for(var d=0,e=0,f=0,g=b.length;f<g;){d!==-1&&d<=f&&(d=b.indexOf("\r",f));e!==-1&&e<=f&&(e=b.indexOf("\n",f));var h=f,l;if(e===-1&&d===-1){a(b.substring(f));break}d!==-1&&e!==-1?d+1===e?(l=d,f=e+1):(l=d<e?d:e,f=(d<e?d:e)+1):d!==-1?(l=d,f=d+1):(l=e,f=e+1);a(b.substring(h,
l));c()}}function m(b){var a,c,d,e,f=b.ownerDocument.defaultView||b.ownerDocument.parentWindow;if(f.getComputedStyle)b=f.getComputedStyle(b,null),a=b.getPropertyValue("padding-left"),c=b.getPropertyValue("padding-top"),d=b.getPropertyValue("padding-right"),e=b.getPropertyValue("padding-bottom");else if(b.currentStyle)a=b.currentStyle.paddingLeft,c=b.currentStyle.paddingTop,d=b.currentStyle.paddingRight,e=b.currentStyle.paddingBottom;return{left:parseInt(a,10)||0,top:parseInt(c,10)||0,right:parseInt(d,
10)||0,bottom:parseInt(e,10)||0}}function s(b){var a,c,d,e,f=b._trim;if(!f){var f=m(b),g=b.ownerDocument.defaultView||b.ownerDocument.parentWindow;if(g.getComputedStyle)e=g.getComputedStyle(b,null),a=e.getPropertyValue("border-left-width"),c=e.getPropertyValue("border-top-width"),d=e.getPropertyValue("border-right-width"),e=e.getPropertyValue("border-bottom-width");else if(b.currentStyle)a=b.currentStyle.borderLeftWidth,c=b.currentStyle.borderTopWidth,d=b.currentStyle.borderRightWidth,e=b.currentStyle.borderBottomWidth;
a=parseInt(a,10)||0;c=parseInt(c,10)||0;d=parseInt(d,10)||0;e=parseInt(e,10)||0;f.left+=a;f.top+=c;f.right+=d;f.bottom+=e;b._trim=f}return f}function o(b,a,c){this.start=b;this.end=a;this.caret=c}function q(b){this.left=b.left;this.top=b.top;this.right=b.right;this.bottom=b.bottom}function p(b,a,c){this.view=b;this.lineIndex=a;this._lineDiv=c}function t(b){this._init(b||{})}var r=g.addEventListener,u=g.removeEventListener,v=function(){function b(a){this.options=a}b.prototype.play=function(){var b=
typeof this.options.duration==="number"?this.options.duration:350,a=this.options.easing||this.defaultEasing,c=this.options.onAnimate||function(){},d=this.options.curve[0],n=this.options.curve[1],e=n-d,f=-1,g,h=this;this.interval=this.options.window.setInterval(function(){f=f===-1?(new Date).getTime():f;var l=((new Date).getTime()-f)/b;l<1?(l=a(l),g=d+l*e,c(g)):(c(n),h.stop())},typeof this.options.rate==="number"?this.options.rate:20)};b.prototype.stop=function(){this.options.window.clearInterval(this.interval);
(this.options.onEnd||function(){})()};b.prototype.defaultEasing=function(b){return Math.sin(b*(Math.PI/2))};return b}();o.prototype={clone:function(){return new o(this.start,this.end,this.caret)},collapse:function(){this.caret?this.end=this.start:this.start=this.end},extend:function(b){this.caret?this.start=b:this.end=b;if(this.start>this.end)b=this.start,this.start=this.end,this.end=b,this.caret=!this.caret},setCaret:function(b){this.end=this.start=b;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(b){return this.caret===b.caret&&this.start===b.start&&this.end===b.end}};q.prototype={toString:function(){return"{l="+this.left+", t="+this.top+", r="+this.right+", b="+this.bottom+"}"}};p.prototype={create:function(b,a){if(!this._lineDiv){var c=this._lineDiv=this._createLine(b,a,this.lineIndex);c._line=
this;return c}},_createLine:function(a,c,d){var g=this.view,h=g._model,l=h.getLine(d),i=h.getLineStart(d),m={type:"LineStyle",textView:g,lineIndex:d,lineText:l,lineStart:i};if(l.length<2E3)g.onLineStyle(m);h=c||e.createElement(a.ownerDocument,"div");if(!c||!b(c.viewStyle,m.style)){f(m.style,h,c);if(c)c._trim=null;h.viewStyle=m.style;h.setAttribute("role","presentation")}h.lineIndex=d;d=[];this._createRanges(m.ranges,l,0,l.length,i,{tabOffset:0,ranges:d});l=" ";!g._fullSelection&&e.isIE<9&&(l="\ufeff");
m={text:l,style:g._metrics.largestFontStyle,ignoreChars:1};d.length===0||!d[d.length-1].style||d[d.length-1].style.tagName!=="div"?d.push(m):d.splice(d.length-1,0,m);var o,j,p,s,q,l=g=0,u,k;if(c){if(j=c.modelChangedEvent)j.removedLineCount===0&&j.addedLineCount===0?(k=j.start-i,u=j.addedCharCount-j.removedCharCount):k=-1,c.modelChangedEvent=void 0;j=c.firstChild}for(i=0;i<d.length;i++){m=d[i];s=m.text;g+=s.length;o=m.style;if(j)if(q=j.firstChild.data,p=j.viewStyle,q===s&&b(o,p)){l+=q.length;j._rectsCache=
void 0;o=j=j.nextSibling;continue}else for(;j;){if(k!==-1){p=g;p>=k&&(p-=u);q=(q=j.firstChild.data)?q.length:0;if(l+q>p)break;l+=q}p=j.nextSibling;h.removeChild(j);j=p}o=this._createSpan(h,s,o,m.ignoreChars);j?h.insertBefore(o,j):h.appendChild(o);if(c)c.lineWidth=void 0}if(c)for(a=o?o.nextSibling:null;a;)p=a.nextSibling,c.removeChild(a),a=p;else a.appendChild(h);return h},_createRanges:function(a,c,d,e,f,g){if(!(d>e)){if(a)for(var h=0;h<a.length;h++){var l=a[h];if(!(l.end<f+d)){var i=Math.max(f+d,
l.start)-f;if(i>e)break;var m=Math.min(f+e,l.end)-f;if(i<=m){i=Math.max(d,i);m=Math.min(e,m);d<i&&this._createRange(c,d,i,null,g);if(!l.style||!l.style.unmergeable)for(;h+1<a.length&&a[h+1].start-f===m&&b(l.style,a[h+1].style);)l=a[h+1],m=Math.min(f+e,l.end)-f,h++;this._createRange(c,i,m,l.style,g);d=m}}}d<e&&this._createRange(c,d,e,null,g)}},_createRange:function(b,a,c,d,e){if(!(a>c)){var f=this.view._customTabSize;if(f&&f!==8)for(var g=b.indexOf("\t",a);g!==-1&&g<c;){a<g&&(a={text:b.substring(a,
g),style:d},e.ranges.push(a),e.tabOffset+=a.text.length);a=f-e.tabOffset%f;if(a>0){for(var h="\u00a0",l=1;l<a;l++)h+=" ";a={text:h,style:d,ignoreChars:a-1};e.ranges.push(a);e.tabOffset+=a.text.length}a=g+1;if(a===c)return;g=b.indexOf("\t",a)}a<=c&&(a={text:b.substring(a,c),style:d},e.ranges.push(a),e.tabOffset+=a.text.length)}},_createSpan:function(b,a,c,d){var g=this.view,h="span";c&&c.tagName&&(h=c.tagName.toLowerCase());var l=h==="a";if(l)b.hasLink=!0;l&&!g._linksVisible&&(h="span");l=b.ownerDocument;
b=e.createElement(b.ownerDocument,h);c&&c.html?(b.innerHTML=c.html,b.ignore=!0):c&&c.node?(b.appendChild(c.node),b.ignore=!0):b.appendChild(l.createTextNode(c&&c.text?c.text:a));f(c,b);if(h==="a"){var i=g._getWindow();r(b,"click",function(b){return g._handleLinkClick(b?b:i.event)},!1)}b.viewStyle=c;if(d)b.ignoreChars=d;return b},_ensureCreated:function(){return this._lineDiv?this._lineDiv:this._createdDiv=this.create(this.view._clientDiv,null)},getBoundingClientRect:function(b,a){var c=this._ensureCreated(),
d=this.view;if(b===void 0)return this._getLineBoundingClientRect(c,!0);var f=d._model,g=c.ownerDocument,h=this.lineIndex,l=null;if(b<f.getLineEnd(h)){h=f.getLineStart(h);for(f=c.firstChild;f;){if(!f.ignore){var i=f.firstChild,m=i.length;f.ignoreChars&&(m-=f.ignoreChars);if(h+m>b){l=b-h;if(i.length===1)l=new q(f.getBoundingClientRect());else if(d._isRangeRects)g=g.createRange(),g.setStart(i,l),g.setEnd(i,l+1),l=new q(g.getBoundingClientRect());else if(e.isIE){if(g=g.body.createTextRange(),g.moveToElementText(f),
g.collapse(),(h=l===0&&e.isIE===8)&&(l=1),g.moveEnd("character",l+1),g.moveStart("character",l),l=new q(g.getBoundingClientRect()),h)l.left=f.getClientRects()[0].left}else{var o=i.data;f.removeChild(i);f.appendChild(g.createTextNode(o.substring(0,l)));var j=e.createElement(g,"span");j.appendChild(g.createTextNode(o.substring(l,l+1)));f.appendChild(j);f.appendChild(g.createTextNode(o.substring(l+1)));l=new q(j.getBoundingClientRect());f.innerHTML="";f.appendChild(i);this._createdDiv||(g=d._getSelection(),
(h<=g.start&&g.start<h+m||h<=g.end&&g.end<h+m)&&d._updateDOMSelection())}e.isIE&&(g=c.ownerDocument.defaultView||c.ownerDocument.parentWindow,c=g.screen.logicalXDPI/g.screen.deviceXDPI,g=g.screen.logicalYDPI/g.screen.deviceYDPI,l.left*=c,l.right*=c,l.top*=g,l.bottom*=g);break}h+=m}f=f.nextSibling}}c=this.getBoundingClientRect();if(!l)d._wrapMode?(d=this.getClientRects(),l=d[d.length-1],l.left=l.right,l.left+=c.left,l.top+=c.top,l.right+=c.left,l.bottom+=c.top):(l=new q(c),l.left=l.right);if(a||a===
void 0)l.left-=c.left,l.top-=c.top,l.right-=c.left,l.bottom-=c.top;return l},_getClientRects:function(b,a){var c,d,e,f;if(!b._rectsCache){c=b.getClientRects();d=Array(c.length);for(f=0;f<c.length;f++)e=d[f]=new q(c[f]),e.left-=a.left,e.top-=a.top,e.right-=a.left,e.bottom-=a.top;b._rectsCache=d}c=b._rectsCache;d=[c.length];for(f=0;f<c.length;f++)d[f]=new q(c[f]);return d},getClientRects:function(b){if(!this.view._wrapMode)return[this.getBoundingClientRect()];for(var a=this._ensureCreated(),c=[],d=
a.firstChild,e,f=a.getBoundingClientRect();d;){if(!d.ignore)for(var g=this._getClientRects(d,f),a=0;a<g.length;a++){var h=g[a],l;if(h.top!==h.bottom){var i=h.top+(h.bottom-h.top)/2;for(l=0;l<c.length;l++)if(e=c[l],e.top<=i&&i<e.bottom)break;if(l===c.length)c.push(h);else{if(h.left<e.left)e.left=h.left;if(h.top<e.top)e.top=h.top;if(h.right>e.right)e.right=h.right;if(h.bottom>e.bottom)e.bottom=h.bottom}}}d=d.nextSibling}return b!==void 0?c[b]:c},_getLineBoundingClientRect:function(b,a){var c=new q(b.getBoundingClientRect());
if(!this.view._wrapMode){c.right=c.left;for(var d=b.lastChild;d&&d.ignoreChars===d.firstChild.length;)d=d.previousSibling;if(d)d=d.getBoundingClientRect(),c.right=d.right+s(b).right}a&&(d=s(b),c.left+=d.left,c.right-=d.right);return c},getLineCount:function(){return!this.view._wrapMode?1:this.getClientRects().length},getLineIndex:function(b){if(!this.view._wrapMode)return 0;for(var a=this.getClientRects(),b=this.getBoundingClientRect(b),b=b.top+(b.bottom-b.top)/2,c=0;c<a.length;c++)if(a[c].top<=b&&
b<a[c].bottom)return c;return a.length-1},getLineStart:function(b){if(!this.view._wrapMode||b===0)return this.view._model.getLineStart(b);var a=this.getClientRects();return this.getOffset(a[b].left+1,a[b].top+1)},getOffset:function(b,a){var c=this.view,d=c._model,f=this.lineIndex,g=d.getLineStart(f),h=d.getLineEnd(f);if(g===h)return g;var l=this._ensureCreated(),i=this.getBoundingClientRect(),m,o;if(c._wrapMode){m=this.getClientRects();if(a<m[0].top)a=m[0].top;for(var j=0;j<m.length;j++)if(o=m[j],
o.top<=a&&a<o.bottom)break;if(b<o.left)b=o.left;b>o.right&&(b=o.right-1)}else b<0&&(b=0),b>i.right-i.left&&(b=i.right-i.left);var p=l.ownerDocument,j=p.defaultView||p.parentWindow,s=e.isIE?j.screen.logicalXDPI/j.screen.deviceXDPI:1,q=e.isIE?j.screen.logicalYDPI/j.screen.deviceYDPI:1,j=g,u=l.firstChild;a:for(;u;){if(!u.ignore){var k=u.firstChild,l=k.length;u.ignoreChars&&(l-=u.ignoreChars);var v,r,t;m=this._getClientRects(u,i);for(var L=0;L<m.length;L++)if(o=m[L],o.left<=b&&b<o.right&&(!c._wrapMode||
o.top<=a&&a<o.bottom)){var L=o.left+i.left,A;if(e.isIE||c._isRangeRects){for(var p=c._isRangeRects?p.createRange():p.body.createTextRange(),I=l,N=-1;I-N>1;){var V=Math.floor((I+N)/2);m=N+1;o=V===l-1&&u.ignoreChars?k.length:V+1;A=m===0&&e.isIE===8;c._isRangeRects?(p.setStart(k,m),p.setEnd(k,o)):(A&&(m=1),p.moveToElementText(u),p.move("character",m),p.moveEnd("character",o-m));m=p.getClientRects();for(var X=!1,W=0;W<m.length;W++)if(o=m[W],v=(A?L:o.left)*s-i.left,t=o.right*s-i.left,r=o.top*q-i.top,o=
o.bottom*q-i.top,v<=b&&b<t&&(!c._wrapMode||r<=a&&a<o)){X=!0;break}X?I=V:N=V}j+=I;m=I;o=I===l-1&&u.ignoreChars?k.length:Math.min(I+1,k.length);c._isRangeRects?(p.setStart(k,m),p.setEnd(k,o)):(p.moveToElementText(u),p.move("character",m),p.moveEnd("character",o-m));m=p.getClientRects();c=!1;m.length>0&&(o=m[0],v=(A?L:o.left)*s-i.left,t=o.right*s-i.left,c=b>v+(t-v)/2);i=j-g;d=d.getLine(f);f=d.charCodeAt(i);55296<=f&&f<=56319&&c?i<d.length&&(f=d.charCodeAt(i+1),56320<=f&&f<=57343&&(j+=1)):56320<=f&&f<=
57343&&!c&&i>0&&(f=d.charCodeAt(i-1),55296<=f&&f<=56319&&(j-=1));c&&j++}else{d=[];for(f=0;f<l;f++)d.push("<span>"),f===l-1?d.push(k.data.substring(f)):d.push(k.data.substring(f,f+1)),d.push("</span>");u.innerHTML=d.join("");for(d=u.firstChild;d;){o=d.getBoundingClientRect();v=o.left-i.left;t=o.right-i.left;if(v<=b&&b<t){b>v+(t-v)/2&&j++;break}j++;d=d.nextSibling}if(!this._createdDiv)u.innerHTML="",u.appendChild(k),i=c._getSelection(),(j<=i.start&&i.start<j+l||j<=i.end&&i.end<j+l)&&c._updateDOMSelection()}break a}j+=
l}u=u.nextSibling}return Math.min(h,Math.max(g,j))},getNextOffset:function(b,a){if(a.unit==="line"){var c=this.view._model,d=c.getLineAtOffset(b);if(a.count>0)return a.count--,c.getLineEnd(d);a.count++;return c.getLineStart(d)}return a.unit==="wordend"||a.unit==="wordWS"||a.unit==="wordendWS"?this._getNextOffset_W3C(b,a):e.isIE?this._getNextOffset_IE(b,a):this._getNextOffset_W3C(b,a)},_getNextOffset_W3C:function(b,a){function c(b){return 33<=b&&b<=47||58<=b&&b<=64||91<=b&&b<=94||b===96||123<=b&&b<=
126}function d(b){return b===32||b===9}var e=this.view._model,f=e.getLineAtOffset(b),g=e.getLine(f),h=e.getLineStart(f),e=e.getLineEnd(f),f=g.length,l=b-h,i,m=a.count<0?-1:1;if(a.unit==="word"||a.unit==="wordend"||a.unit==="wordWS"||a.unit==="wordendWS")for(var o,j,p;a.count!==0;){if(a.count>0){if(l===f)return e;i=g.charCodeAt(l);o=c(i);j=!o&&!d(i);for(l++;l<f;){i=g.charCodeAt(l);if(a.unit!=="wordWS"&&a.unit!=="wordendWS"){p=c(i);if(a.unit==="wordend"){if(!p&&o)break}else if(p&&!o)break;i=!p&&!d(i)}else i=
!d(i);if(a.unit==="wordend"||a.unit==="wordendWS"){if(!i&&j)break}else if(i&&!j)break;j=i;o=p;l++}}else{if(l===0)return h;l--;i=g.charCodeAt(l);o=c(i);for(j=!o&&!d(i);0<l;){i=g.charCodeAt(l-1);if(a.unit!=="wordWS"&&a.unit!=="wordendWS"){p=c(i);if(a.unit==="wordend"){if(p&&!o)break}else if(!p&&o)break;i=!p&&!d(i)}else i=!d(i);if(a.unit==="wordend"||a.unit==="wordendWS"){if(i&&!j)break}else if(!i&&j)break;j=i;o=p;l--}}a.count-=m}else for(;a.count!==0&&0<=l+m&&l+m<=f;)l+=m,i=g.charCodeAt(l),56320<=i&&
i<=57343&&l>0&&(i=g.charCodeAt(l-1),55296<=i&&i<=56319&&(l+=m)),a.count-=m;return h+l},_getNextOffset_IE:function(b,a){var c=this._ensureCreated(),d=this.view._model,e=this.lineIndex,f=0,g;g=d.getLineStart(e);var h=c.ownerDocument,l=a.count<0?-1:1;if(b===d.getLineEnd(e)){for(c=c.lastChild;c&&c.ignoreChars===c.firstChild.length;)c=c.previousSibling;if(!c)return g;f=h.body.createTextRange();f.moveToElementText(c);g=f.text.length;f.moveEnd(a.unit,l);f=b+f.text.length-g}else if(b===g&&a.count<0)f=g;else for(c=
c.firstChild;c;){d=c.firstChild.length;c.ignoreChars&&(d-=c.ignoreChars);if(g+d>b){f=h.body.createTextRange();if(b===g&&a.count<0){for(g=c.previousSibling;g;){if(g.firstChild&&g.firstChild.length)break;g=g.previousSibling}f.moveToElementText(g?g:c.previousSibling)}else f.moveToElementText(c),f.collapse(),f.moveEnd("character",b-g);g=f.text.length;f.moveEnd(a.unit,l);f=b+f.text.length-g;break}g=d+g;c=c.nextSibling}a.count-=l;return f},destroy:function(){var b=this._createdDiv;if(b)b.parentNode.removeChild(b),
this._createdDiv=null}};t.prototype={addKeyMode:function(b,a){var c=this._keyModes;a!==void 0?c.splice(a,0,b):c.push(b);b._modeAdded&&b._modeAdded()},addRuler:function(b,a){b.setView(this);var c=this._rulers;if(a!==void 0){var d,e;for(d=0,e=0;d<c.length&&e<a;d++)b.getLocation()===c[d].getLocation()&&e++;c.splice(e,0,b);a=e}else c.push(b);this._createRuler(b,a);this._update()},computeSize:function(){var b=0,a=0,c=this._model,d=this._clientDiv;if(!d)return{width:b,height:a};var f=d.style.width;if(e.isWebkit)d.style.width=
"0x7fffffffpx";for(var c=c.getLineCount(),g=0;g<c;g++){var h=this._getLine(g),l=h.getBoundingClientRect(),b=Math.max(b,l.right-l.left);a+=l.bottom-l.top;h.destroy()}if(e.isWebkit)d.style.width=f;d=this._getViewPadding();b+=d.right+d.left+this._metrics.scrollWidth;a+=d.bottom+d.top+this._metrics.scrollWidth;return{width:b,height:a}},convert:function(b,a,c){if(this._clientDiv){var d=this._getScroll(),e=this._getViewPadding(),f=this._viewDiv.getBoundingClientRect();a==="document"&&(b.x!==void 0&&(b.x+=
-d.x+f.left+e.left),b.y!==void 0&&(b.y+=-d.y+f.top+e.top));c==="document"&&(b.x!==void 0&&(b.x+=d.x-f.left-e.left),b.y!==void 0&&(b.y+=d.y-f.top-e.top));return b}},destroy:function(){for(var b=0;b<this._rulers.length;b++)this._rulers[b].setView(null);this.rulers=null;this._destroyView();this.onDestroy({type:"Destroy"});this._parent=null;this._model&&this._model.destroy&&this._model.destroy();this._actions=this._keyModes=this._doubleClickSelection=this._selection=this._theme=this._model=null},focus:function(){this._clientDiv&&
(this._updateDOMSelection(),this._clientDiv.focus(),this._updateDOMSelection())},hasFocus:function(){return this._hasFocus},getActionDescription:function(b){if(b=this._actions[b])return b.actionDescription},getActions:function(b){var a=[],c=this._actions,d;for(d in c)c.hasOwnProperty(d)&&(b||!c[d].defaultHandler)&&a.push(d);return a},getBottomIndex:function(b){return!this._clientDiv?0:this._getBottomIndex(b)},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 b=this._getScroll();return{x:b.x,y:b.y,width:this._getClientWidth(),height:this._getClientHeight()}},getHorizontalPixel:function(){return!this._clientDiv?0:this._getScroll().x},getKeyBindings:function(b){for(var a=[],c=this._keyModes,d=0;d<c.length;d++)a=a.concat(c[d].getKeyBindings(b));return a},getKeyModes:function(){return this._keyModes.slice(0)},
getLineHeight:function(b){return!this._clientDiv?0:this._getLineHeight(b)},getLineIndex:function(b){return!this._clientDiv?0:this._getLineIndex(b)},getLinePixel:function(b){return!this._clientDiv?0:this._getLinePixel(b)},getLocationAtOffset:function(b){if(!this._clientDiv)return{x:0,y:0};var a=this._model,b=Math.min(Math.max(0,b),a.getCharCount()),a=a.getLineAtOffset(b),c=this._getLine(a),b=c.getBoundingClientRect(b);c.destroy();c=b.left;a=this._getLinePixel(a)+b.top;return{x:c,y:a}},getNextOffset:function(b,
a){var c=new o(b,b,!1);this._doMove(a,c);return c.getCaret()},getOptions:function(){var b;if(arguments.length===0)b=this._defaultOptions();else if(arguments.length===1){if(b=arguments[0],typeof b==="string")return d(this["_"+b])}else{b={};for(var a in arguments)arguments.hasOwnProperty(a)&&(b[arguments[a]]=void 0)}for(var c in b)b.hasOwnProperty(c)&&(b[c]=d(this["_"+c]));return b},getModel:function(){return this._model},getOffsetAtLocation:function(b,a){if(!this._clientDiv)return 0;var c=this._getLineIndex(a),
d=this._getLine(c),c=d.getOffset(b,a-this._getLinePixel(c));d.destroy();return c},getLineAtOffset:function(b){this.getModel().getLineAtOffset(b)},getLineStart:function(b){this.getModel().getLineStart(b)},getRulers:function(){return this._rulers.slice(0)},getSelection:function(){var b=this._getSelection();return{start:b.start,end:b.end}},getText:function(b,a){return this._model.getText(b,a)},getTopIndex:function(b){return!this._clientDiv?0:this._getTopIndex(b)},getTopPixel:function(){return!this._clientDiv?
0:this._getScroll().y},invokeAction:function(b,a,c){if(this._clientDiv){if(b=this._actions[b]){if(!a&&b.handler&&b.handler(c))return!0;if(b.defaultHandler)return typeof b.defaultHandler(c)==="boolean"}return!1}},isDestroyed:function(){return!this._clientDiv},onContextMenu:function(b){return this.dispatchEvent(b)},onDragStart:function(b){return this.dispatchEvent(b)},onDrag:function(b){return this.dispatchEvent(b)},onDragEnd:function(b){return this.dispatchEvent(b)},onDragEnter:function(b){return this.dispatchEvent(b)},
onDragOver:function(b){return this.dispatchEvent(b)},onDragLeave:function(b){return this.dispatchEvent(b)},onDrop:function(b){return this.dispatchEvent(b)},onDestroy:function(b){return this.dispatchEvent(b)},onLineStyle:function(b){return this.dispatchEvent(b)},onKeyDown:function(b){return this.dispatchEvent(b)},onKeyPress:function(b){return this.dispatchEvent(b)},onKeyUp:function(b){return this.dispatchEvent(b)},onModelChanged:function(b){return this.dispatchEvent(b)},onModelChanging:function(b){return this.dispatchEvent(b)},
onModify:function(b){return this.dispatchEvent(b)},onMouseDown:function(b){return this.dispatchEvent(b)},onMouseUp:function(b){return this.dispatchEvent(b)},onMouseMove:function(b){return this.dispatchEvent(b)},onMouseOver:function(b){return this.dispatchEvent(b)},onMouseOut:function(b){return this.dispatchEvent(b)},onSelection:function(b){return this.dispatchEvent(b)},onScroll:function(b){return this.dispatchEvent(b)},onVerify:function(b){return this.dispatchEvent(b)},onFocus:function(b){return this.dispatchEvent(b)},
onBlur:function(b){return this.dispatchEvent(b)},redraw:function(){if(!(this._redrawCount>0)){var b=this._model.getLineCount();this.redrawRulers(0,b);this.redrawLines(0,b)}},redrawRulers:function(b,a){if(!(this._redrawCount>0))for(var c=this.getRulers(),d=0;d<c.length;d++)this.redrawLines(b,a,c[d])},redrawLines:function(b,a,c){if(!(this._redrawCount>0)&&(b===void 0&&(b=0),a===void 0&&(a=this._model.getLineCount()),b!==a)){var d=this._clientDiv;if(d){if(c)for(d=this._getRulerParent(c).firstChild;d;){if(d._ruler===
c)break;d=d.nextSibling}c?d.rulerChanged=!0:this._lineHeight&&this._resetLineHeight(b,a);if(!c||c.getOverview()==="page")for(d=d.firstChild;d;){var e=d.lineIndex;if(b<=e&&e<a)d.lineChanged=!0;d=d.nextSibling}if(!c&&!this._wrapMode&&b<=this._maxLineIndex&&this._maxLineIndex<a)this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0;this._queueUpdate()}}},redrawRange:function(b,a){if(!(this._redrawCount>0)){var c=this._model;b===void 0&&(b=0);a===void 0&&(a=c.getCharCount());
var d=c.getLineAtOffset(b),c=c.getLineAtOffset(Math.max(b,a-1))+1;this.redrawLines(d,c)}},removeKeyMode:function(b){for(var a=this._keyModes,c=0;c<a.length;c++)if(a[c]===b){a.splice(c,1);break}b._modeRemoved&&b._modeRemoved()},removeRuler:function(b){for(var a=this._rulers,c=0;c<a.length;c++)if(a[c]===b){a.splice(c,1);b.setView(null);this._destroyRuler(b);this._update();break}},resize:function(){this._clientDiv&&this._handleResize(null)},setAction:function(b,a,c){if(b){var d=this._actions,e=d[b];
e||(e=d[b]={});e.handler=a;if(c!==void 0)e.actionDescription=c}},setKeyBinding:function(b,a){this._keyModes[0].setKeyBinding(b,a)},setCaretOffset:function(b,a,c){var d=this._model.getCharCount(),b=Math.max(0,Math.min(b,d));this._setSelection(new o(b,b,!1),a===void 0||a,!0,c)},setHorizontalPixel:function(b){this._clientDiv&&(b=Math.max(0,b),this._scrollView(b-this._getScroll().x,0))},setRedraw:function(b){b?--this._redrawCount===0&&this.redraw():this._redrawCount++},setModel:function(b){if(b&&b!==
this._model){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);var a=this._model.getLineCount(),c=this._model.getCharCount(),d=b.getLineCount(),e=b.getCharCount(),f={type:"ModelChanging",text:b.getText(),start:0,removedCharCount:c,addedCharCount:e,removedLineCount:a,addedLineCount:d};this.onModelChanging(f);this._model=b;f={type:"ModelChanged",start:0,removedCharCount:c,addedCharCount:e,removedLineCount:a,
addedLineCount:d};this.onModelChanged(f);this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._reset();this._update()}},setOptions:function(a){var c=this._defaultOptions(),e;for(e in a)if(a.hasOwnProperty(e)){var f=a[e];if(!b(this["_"+e],f)){var g=c[e]?c[e].update:null;g?g.call(this,f):this["_"+e]=d(f)}}},setSelection:function(b,a,c,d){var e=b>a;if(e)var f=b,b=a,a=f;f=this._model.getCharCount();b=
Math.max(0,Math.min(b,f));a=Math.max(0,Math.min(a,f));this._setSelection(new o(b,a,e),c===void 0||c,!0,d)},setText:function(b,a,c){var d=a===void 0&&c===void 0;a===void 0&&(a=0);c===void 0&&(c=this._model.getCharCount());if(d)this._variableLineHeight=!1;this._modifyContent({text:b,start:a,end:c,_code:!0},!d);if(d)this._columnX=-1,this._setSelection(new o(0,0,!1),!0),e.isFirefox&&this._fixCaret()},setTopIndex:function(b){this._clientDiv&&this._scrollView(0,this._getLinePixel(Math.max(0,b))-this._getScroll().y)},
setTopPixel:function(b){this._clientDiv&&this._scrollView(0,Math.max(0,b)-this._getScroll().y)},showSelection:function(){return this._showCaret(!0)},update:function(b,a){this._clientDiv&&(b&&this._updateStyle(),a===void 0||a?this._update():this._queueUpdate())},_handleRootMouseDown:function(b){if(!this._ignoreEvent(b)){if(e.isFirefox&&b.which===1)this._clientDiv.contentEditable=!1,this._ignoreBlur=(this._overlayDiv||this._clientDiv).draggable=!0;var a=this._overlayDiv||this._clientDiv;if(e.isIE<9)a=
this._viewDiv;for(var c=b.target?b.target:b.srcElement;c;){if(a===c)return;c=c.parentNode}b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();if(!this._isW3CEvents){var d=this;this._getWindow().setTimeout(function(){d._clientDiv.focus()},0)}}},_handleRootMouseUp:function(b){if(!this._ignoreEvent(b)&&e.isFirefox&&b.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(e.isIE<9&&!this._getSelection().isEmpty()){var b=this._rootDiv,a=e.createElement(b.ownerDocument,"div");b.appendChild(a);b.removeChild(a)}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",b=this._getWindow(),a=this._selDiv1.ownerDocument,b.getSelection){a=b.getSelection();for(b=a.anchorNode;b;){if(b===this._clientDiv){a.rangeCount>0&&a.removeAllRanges();
break}b=b.parentNode}}else if(a.selection){this._ignoreSelect=!1;for(b=a.selection.createRange().parentElement();b;){if(b===this._clientDiv){a.selection.empty();break}b=b.parentNode}this._ignoreSelect=!0}if(!this._ignoreFocus)this.onBlur({type:"Blur"})}},_handleContextMenu:function(b){if(!this._ignoreEvent(b)){e.isIE&&this._lastMouseButton===3&&this._updateDOMSelection();var a=!1;this.isListening("ContextMenu")?(a=this._createMouseEvent("ContextMenu",b),a.screenX=b.screenX,a.screenY=b.screenY,this.onContextMenu(a),
a=a.defaultPrevented):e.isMac&&e.isFirefox&&b.button===0&&(a=!0);if(a)return b.preventDefault&&b.preventDefault(),!1}},_handleCopy:function(b){if(!this._ignoreEvent(b)&&!this._ignoreCopy&&this._doCopy(b))return b.preventDefault&&b.preventDefault(),!1},_handleCut:function(b){if(!this._ignoreEvent(b)&&this._doCut(b))return b.preventDefault&&b.preventDefault(),!1},_handleDataModified:function(b){this._ignoreEvent(b)||this._startIME()},_handleDblclick:function(b){if(!this._ignoreEvent(b)&&(this._lastMouseTime=
b.timeStamp?b.timeStamp:(new Date).getTime(),this._clickCount!==2))this._clickCount=2,this._handleMouse(b)},_handleDragStart:function(b){if(!this._ignoreEvent(b)){if(e.isFirefox){var a=this;this._getWindow().setTimeout(function(){a._clientDiv.contentEditable=!0;a._clientDiv.draggable=!1;a._ignoreBlur=!1},0)}if(this.isListening("DragStart")&&this._dragOffset!==-1)this._isMouseDown=!1,this.onDragStart(this._createMouseEvent("DragStart",b)),this._dragOffset=-1;else return b.preventDefault&&b.preventDefault(),
!1}},_handleDrag:function(b){if(!this._ignoreEvent(b)&&this.isListening("Drag"))this.onDrag(this._createMouseEvent("Drag",b))},_handleDragEnd:function(b){if(!this._ignoreEvent(b)){this._dropTarget=!1;this._dragOffset=-1;if(this.isListening("DragEnd"))this.onDragEnd(this._createMouseEvent("DragEnd",b));e.isFirefox&&(this._fixCaret(),b.dataTransfer.dropEffect==="none"&&!b.dataTransfer.mozUserCancelled&&this._fixCaret())}},_handleDragEnter:function(b){if(!this._ignoreEvent(b)){var a=!0;this._dropTarget=
!0;this.isListening("DragEnter")&&(a=!1,this.onDragEnter(this._createMouseEvent("DragEnter",b)));if(e.isWebkit||a)return b.preventDefault&&b.preventDefault(),!1}},_handleDragOver:function(b){if(!this._ignoreEvent(b)){var a=!0;this.isListening("DragOver")&&(a=!1,this.onDragOver(this._createMouseEvent("DragOver",b)));if(e.isWebkit||a){if(a)b.dataTransfer.dropEffect="none";b.preventDefault&&b.preventDefault();return!1}}},_handleDragLeave:function(b){if(!this._ignoreEvent(b)&&(this._dropTarget=!1,this.isListening("DragLeave")))this.onDragLeave(this._createMouseEvent("DragLeave",
b))},_handleDrop:function(b){if(!this._ignoreEvent(b)){this._dropTarget=!1;if(this.isListening("Drop"))this.onDrop(this._createMouseEvent("Drop",b));b.preventDefault&&b.preventDefault();return!1}},_handleFocus:function(){this._hasFocus=!0;e.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 b=this._highlightRGB;this._selDiv1.style.background=
b;this._selDiv2.style.background=b;this._selDiv3.style.background=b}if(!this._ignoreFocus)this.onFocus({type:"Focus"})},_handleKeyDown:function(b){if(!this._ignoreEvent(b)){if(this.isListening("KeyDown")){var a=this._createKeyEvent("KeyDown",b);this.onKeyDown(a);if(a.defaultPrevented){if(e.isFirefox)this._keyDownPrevented=!0;b.preventDefault();return}}a=!1;switch(b.keyCode){case 16:case 17:case 18:case 91:a=!0;break;default:this._setLinksVisible(!1)}if(b.keyCode===229){if(this._readonly)return b.preventDefault&&
b.preventDefault(),!1;a=!0;if(e.isSafari&&e.isMac&&b.ctrlKey)a=!1,b.keyCode=129;a&&this._startIME()}else a||this._commitIME();if((e.isMac||e.isLinux)&&e.isFirefox<4||e.isOpera<12.16)return this._keyDownEvent=b,!0;if(this._doAction(b))return b.preventDefault?(b.preventDefault(),b.stopPropagation()):(b.cancelBubble=!0,b.returnValue=!1,b.keyCode=0),!1}},_handleKeyPress:function(b){if(!this._ignoreEvent(b))if(this._keyDownPrevented)b.preventDefault&&(b.preventDefault(),b.stopPropagation()),this._keyDownPrevented=
void 0;else{if(e.isMac&&e.isWebkit&&(63232<=b.keyCode&&b.keyCode<=63487||b.keyCode===13||b.keyCode===8))return b.preventDefault&&b.preventDefault(),!1;if(((e.isMac||e.isLinux)&&e.isFirefox<4||e.isOpera<12.16)&&this._doAction(this._keyDownEvent))return b.preventDefault&&b.preventDefault(),!1;var a=e.isMac?b.metaKey:b.ctrlKey;if(b.charCode!==void 0&&a)switch(b.charCode){case 99:case 118:case 120:return!0}if(this.isListening("KeyPress")&&(a=this._createKeyEvent("KeyPress",b),this.onKeyPress(a),a.defaultPrevented)){b.preventDefault();
return}if(this._doAction(b))return b.preventDefault?(b.preventDefault(),b.stopPropagation()):(b.cancelBubble=!0,b.returnValue=!1,b.keyCode=0),!1;a=!1;if(e.isMac){if(b.ctrlKey||b.metaKey)a=!0}else if(e.isFirefox){if(b.ctrlKey||b.altKey)a=!0}else b.ctrlKey^b.altKey&&(a=!0);if(!a&&(a=e.isOpera?b.which:b.charCode!==void 0?b.charCode:b.keyCode,a>31))return this._doContent(String.fromCharCode(a)),b.preventDefault&&b.preventDefault(),!1}},_handleDocKeyUp:function(b){(e.isMac?b.metaKey:b.ctrlKey)||this._setLinksVisible(!1)},
_handleKeyUp:function(b){if(!this._ignoreEvent(b)){if(this.isListening("KeyUp")){var a=this._createKeyEvent("KeyUp",b);this.onKeyUp(a);if(a.defaultPrevented){b.preventDefault();return}}this._handleDocKeyUp(b);b.keyCode===13&&this._commitIME()}},_handleLinkClick:function(b){if(!(e.isMac?b.metaKey:b.ctrlKey))return b.preventDefault&&b.preventDefault(),!1},_handleMouse:function(b){var a=this._getWindow(),c=!0,d=a;if(e.isIE||e.isFirefox&&!this._overlayDiv)d=this._clientDiv;if(this._overlayDiv){if(this._hasFocus)this._ignoreFocus=
!0;var f=this;a.setTimeout(function(){f.focus();f._ignoreFocus=!1},0)}this._clickCount===1?(c=this._setSelectionTo(b.clientX,b.clientY,b.shiftKey,(!e.isOpera||e.isOpera>=12.16)&&this._hasFocus&&this.isListening("DragStart")))&&this._setGrab(d):(this._isW3CEvents&&this._setGrab(d),this._doubleClickSelection=null,this._setSelectionTo(b.clientX,b.clientY,b.shiftKey),this._doubleClickSelection=this._getSelection());return c},_handleMouseDown:function(b){if(!this._ignoreEvent(b)){if(this._linksVisible)if((b.target||
b.srcElement).tagName!=="A")this._setLinksVisible(!1);else return;this._commitIME();var a=b.which;a||(b.button===4&&(a=2),b.button===2&&(a=3),b.button===1&&(a=1));var c=a!==2&&b.timeStamp?b.timeStamp:(new Date).getTime(),d=c-this._lastMouseTime,f=Math.abs(this._lastMouseX-b.clientX),g=Math.abs(this._lastMouseY-b.clientY),h=this._lastMouseButton===a;this._lastMouseX=b.clientX;this._lastMouseY=b.clientY;this._lastMouseTime=c;this._lastMouseButton=a;if(a===1)this._isMouseDown=!0,h&&d<=this._clickTime&&
f<=this._clickDist&&g<=this._clickDist?this._clickCount++:this._clickCount=1;if(this.isListening("MouseDown")&&(c=this._createMouseEvent("MouseDown",b),this.onMouseDown(c),c.defaultPrevented)){b.preventDefault();return}if(a===1&&this._handleMouse(b)&&(e.isIE>=9||e.isOpera||e.isChrome||e.isSafari||e.isFirefox&&!this._overlayDiv))this._hasFocus||this.focus(),b.preventDefault();e.isFirefox&&this._lastMouseButton===3&&this._updateDOMSelection()}},_handleMouseOver:function(b){if(!this._ignoreEvent(b)&&
!this._animation&&this.isListening("MouseOver"))this.onMouseOver(this._createMouseEvent("MouseOver",b))},_handleMouseOut:function(b){if(!this._ignoreEvent(b)&&!this._animation&&this.isListening("MouseOut"))this.onMouseOut(this._createMouseEvent("MouseOut",b))},_handleMouseMove:function(b){if(!this._animation){var a=this._isClientDiv(b);if(this.isListening("MouseMove")&&a)this.onMouseMove(this._createMouseEvent("MouseMove",b));if(!this._dropTarget){var c=this._linksVisible||this._lastMouseMoveX!==
b.clientX||this._lastMouseMoveY!==b.clientY;this._lastMouseMoveX=b.clientX;this._lastMouseMoveY=b.clientY;this._setLinksVisible(c&&!this._isMouseDown&&(e.isMac?b.metaKey:b.ctrlKey));if(!this._isW3CEvents){if(b.button===0)return this._setGrab(null),!0;if(!this._isMouseDown&&b.button===1&&(this._clickCount&1)!==0&&a)return this._clickCount=2,this._handleMouse(b,this._clickCount)}if(this._isMouseDown&&this._dragOffset===-1){var a=b.clientX,b=b.clientY,d=this._getViewPadding(),f=this._viewDiv.getBoundingClientRect(),
g=this._getClientWidth(),h=this._getClientHeight(),c=f.left+d.left,l=f.top+d.top,g=f.left+d.left+g,d=f.top+d.top+h;b<l?this._doAutoScroll("up",a,b-l):b>d?this._doAutoScroll("down",a,b-d):a<c&&!this._wrapMode?this._doAutoScroll("left",a-c,b):a>g&&!this._wrapMode?this._doAutoScroll("right",a-g,b):(this._endAutoScroll(),this._setSelectionTo(a,b,!0))}}}},_isClientDiv:function(b){for(var a=this._overlayDiv||this._clientDiv,b=b.target?b.target:b.srcElement;b;){if(a===b)return!0;b=b.parentNode}return!1},
_createKeyEvent:function(b,a){return{type:b,event:a,preventDefault:function(){this.defaultPrevented=!0}}},_createMouseEvent:function(b,a){var c=this.convert({x:a.clientX,y:a.clientY},"page","document");return{type:b,event:a,clickCount:this._clickCount,x:c.x,y:c.y,preventDefault:function(){this.defaultPrevented=!0}}},_handleMouseUp:function(b){var a=b.which?b.button===0:b.button===1;if(this.isListening("MouseUp")&&(this._isClientDiv(b)||a&&this._isMouseDown))this.onMouseUp(this._createMouseEvent("MouseUp",
b));if(!this._linksVisible&&a&&this._isMouseDown){if(this._dragOffset!==-1)a=this._getSelection(),a.extend(this._dragOffset),a.collapse(),this._setSelection(a,!0,!0),this._dragOffset=-1;this._isMouseDown=!1;this._endAutoScroll();this._isW3CEvents&&this._setGrab(null);e.isFirefox&&b.preventDefault()}},_handleMouseWheel:function(b){var a=this._getLineHeight(),c=0,d=0;e.isIE||e.isOpera?d=-b.wheelDelta/40*a:e.isFirefox?b.type==="wheel"?b.deltaMode?(c=Math.max(-256,Math.min(256,b.deltaX))*a,d=Math.max(-256,
Math.min(256,b.deltaY))*a):(c=b.deltaX,d=b.deltaY):(a=e.isMac?b.detail*3:Math.max(-256,Math.min(256,b.detail))*a,b.axis===b.HORIZONTAL_AXIS?c=a:d=a):e.isMac?(d=b.timeStamp-this._wheelTimeStamp,this._wheelTimeStamp=b.timeStamp,c=b.wheelDeltaX%120!==0?1:d<40?40/(40-d):40,d=b.wheelDeltaY%120!==0?1:d<40?40/(40-d):40,c=Math.ceil(-b.wheelDeltaX/c),-1<c&&c<0&&(c=-1),0<c&&c<1&&(c=1),d=Math.ceil(-b.wheelDeltaY/d),-1<d&&d<0&&(d=-1),0<d&&d<1&&(d=1)):(c=-b.wheelDeltaX,d=-b.wheelDeltaY/120*8*a);if(e.isSafari||
e.isChrome&&e.isMac){for(a=b.target;a&&a.lineIndex===void 0;)a=a.parentNode;this._mouseWheelLine=a}a=this._getScroll();this._scrollView(c,d);c=this._getScroll();if(a.x!==c.x||a.y!==c.y)return b.preventDefault&&b.preventDefault(),!1},_handlePaste:function(b){if(!this._ignoreEvent(b)&&!this._ignorePaste&&this._doPaste(b)){if(e.isIE){var a=this;this._ignoreFocus=!0;this._getWindow().setTimeout(function(){a._updateDOMSelection();a._ignoreFocus=!1},0)}b.preventDefault&&b.preventDefault();return!1}},_handleResize:function(){var a=
this._rootDiv.clientWidth,c=this._rootDiv.clientHeight;if(this._rootWidth!==a||this._rootHeight!==c){this._rootWidth!==a&&this._wrapMode&&this._resetLineHeight();this._rootWidth=a;this._rootHeight=c;a=e.isIE<9;c=this._calculateMetrics();if(!b(c,this._metrics)){if(this._variableLineHeight)this._variableLineHeight=!1,this._resetLineHeight();this._metrics=c;a=!0}a?this._queueUpdate():this._update()}},_handleRulerEvent:function(b){for(var a=b.target?b.target:b.srcElement,c=a.lineIndex;a&&!a._ruler;){if(c===
void 0&&a.lineIndex!==void 0)c=a.lineIndex;a=a.parentNode}var d=a?a._ruler:null;if(c===void 0&&d&&d.getOverview()==="document"){var c=this._getClientHeight(),e=this._model.getLineCount(),f=this._getViewPadding(),g=this._viewDiv.getBoundingClientRect(),c=Math.floor((b.clientY-g.top-this._metrics.scrollWidth)*e/(c+f.top+f.bottom-2*this._metrics.scrollWidth));0<=c&&c<e||(c=void 0)}if(d)switch(b.type){case "click":if(d.onClick)d.onClick(c,b);break;case "dblclick":if(d.onDblClick)d.onDblClick(c,b);break;
case "mousemove":if(d.onMouseMove)d.onMouseMove(c,b);break;case "mouseover":if(d.onMouseOver)d.onMouseOver(c,b);break;case "mouseout":if(d.onMouseOut){for(e=b.relatedTarget;e&&e!==this._rootDiv;){if(e===a)return;e=e.parentNode}d.onMouseOut(c,b)}}},_handleScroll:function(){var b=this._getScroll(!1),a=this._hScroll,c=this._vScroll;if(a!==b.x||c!==b.y)this._hScroll=b.x,this._vScroll=b.y,this._commitIME(),this._update(c===b.y),this.onScroll({type:"Scroll",oldValue:{x:a,y:c},newValue:b})},_handleSelectStart:function(b){if(this._ignoreSelect)return b&&
b.preventDefault&&b.preventDefault(),!1},_getModelOffset:function(b,a){if(b){var c;c=b.tagName==="DIV"?b:b.parentNode.parentNode;var d=0,e=c.lineIndex;if(b.tagName!=="DIV")for(c=c.firstChild;c;){var f=c.firstChild;if(f===b){c.ignoreChars&&(d-=c.ignoreChars);d+=a;break}c.ignoreChars&&(d-=c.ignoreChars);d+=f.data.length;c=c.nextSibling}return Math.max(0,d)+this._model.getLineStart(e)}},_updateSelectionFromDOM:function(){var b=this._getWindow().getSelection(),a=this._getModelOffset(b.anchorNode,b.anchorOffset),
b=this._getModelOffset(b.focusNode,b.focusOffset);a===void 0||b===void 0||this._setSelection(new o(a,b),!1,!1)},_handleSelectionChange:function(){if(this._imeOffset===-1)if(e.isAndroid){var b=this._getWindow();this._selTimer&&b.clearTimeout(this._selTimer);var a=this;this._selTimer=b.setTimeout(function(){if(a._clientDiv)a._selTimer=null,a._updateSelectionFromDOM()},250)}else this._updateSelectionFromDOM()},_handleTextInput:function(b){if(!this._ignoreEvent(b)){this._imeOffset=-1;var a=this._getWindow().getSelection();
if(a.anchorNode!==this._anchorNode||a.focusNode!==this._focusNode||a.anchorOffset!==this._anchorOffset||a.focusOffset!==this._focusOffset){for(var c=a.anchorNode;c;){if(c.lineIndex!==void 0)break;c=c.parentNode}if(c){var d=this._model,e=c.lineIndex,f=d.getLine(e),g=f,h=0,d=d.getLineStart(e);if(a.rangeCount>0)a.getRangeAt(0).deleteContents(),e=c.ownerDocument.createTextNode(b.data),a.getRangeAt(0).insertNode(e),h=this._getDOMText(c,e),g=h.text,h=h.offset,e.parentNode.removeChild(e);c.lineRemoved=!0;
for(c=0;f.charCodeAt(c)===g.charCodeAt(c)&&c<h;)c++;a=f.length-1;for(e=g.length-f.length;f.charCodeAt(a)===g.charCodeAt(a+e)&&a+e>=h+b.data.length;)a--;a++;f=g.substring(c,a+e);c+=d;a+=d;this._modifyContent({text:f,start:c,end:a,_ignoreDOMSelection:!0},!0)}}else this._doContent(b.data);b.preventDefault()}},_handleTouchStart:function(b){this._commitIME();var a=this._getWindow();if(this._touchScrollTimer)this._vScrollDiv.style.display="none",this._hScrollDiv.style.display="none",a.clearInterval(this._touchScrollTimer),
this._touchScrollTimer=null;var c=b.touches;if(c.length===1){var c=c[0],d=c.clientX,f=c.clientY;this._touchStartX=d;this._touchStartY=f;if(e.isAndroid&&(f<c.pageY-a.pageYOffset||d<c.pageX-a.pageXOffset))d=c.pageX-a.pageXOffset,f=c.pageY-a.pageYOffset;a=this.convert({x:d,y:f},"page","document");this._lastTouchOffset=this.getOffsetAtLocation(a.x,a.y);this._touchStartTime=b.timeStamp;this._touching=!0}},_handleTouchMove:function(b){var a=b.touches;if(a.length===1){a=a[0];this._touchCurrentX=a.clientX;
this._touchCurrentY=a.clientY;if(!this._touchScrollTimer&&b.timeStamp-this._touchStartTime<200){this._vScrollDiv.style.display="block";if(!this._wrapMode)this._hScrollDiv.style.display="block";var c=this,d=this._getWindow();this._touchScrollTimer=d.setInterval(function(){var b=0,a=0;if(c._touching)b=c._touchStartX-c._touchCurrentX,a=c._touchStartY-c._touchCurrentY,c._touchSpeedX=b/10,c._touchSpeedY=a/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";d.clearInterval(c._touchScrollTimer);c._touchScrollTimer=null;return}else b=c._touchSpeedX*10,a=c._touchSpeedY*10,c._touchSpeedX*=0.95,c._touchSpeedY*=0.95;c._scrollView(b,a)},10)}this._touchScrollTimer&&b.preventDefault()}},_handleTouchEnd:function(b){if(b.touches.length===0)this._touching=!1},_doAction:function(b){var a,c,d=this._keyModes;for(c=d.length-1;c>=0;c--)if(a=d[c],typeof a.match===
"function"&&(a=a.match(b),a!==void 0))return this.invokeAction(a);return!1},_doMove:function(b,a){var c=this._model,d=a.getCaret(),e=c.getLineAtOffset(d);if(!b.count)b.count=1;for(;b.count!==0;){var f=c.getLineStart(e);if(b.count<0&&d===f)if(e>0)b.unit==="character"&&b.count++,e--,a.extend(c.getLineEnd(e));else break;else if(b.count>0&&d===c.getLineEnd(e))if(e+1<c.getLineCount())b.unit==="character"&&b.count--,e++,a.extend(c.getLineStart(e));else break;else{var g=!1;b.expandTab&&b.unit==="character"&&
(d-f)%this._tabSize===0&&(g=!/[^ ]/.test(c.getText(f,d)));g?(a.extend(d-this._tabSize),b.count+=b.count<0?1:-1):(f=this._getLine(e),a.extend(f.getNextOffset(d,b)),f.destroy())}d=a.getCaret()}return a},_doBackspace:function(b){var a=this._getSelection();if(a.isEmpty()){if(!b.count)b.count=1;b.count*=-1;b.expandTab=this._expandTab;this._doMove(b,a)}this._modifyContent({text:"",start:a.start,end:a.end},!0);return!0},_doCase:function(b){var a=this._getSelection();this._doMove(b,a);var c=this.getText(a.start,
a.end);this._setSelection(a,!0);switch(b.type){case "lower":c=c.toLowerCase();break;case "capitalize":c=c.replace(/(?:^|\s)\S/g,function(b){return b.toUpperCase()});break;case "reverse":b="";for(a=0;a<c.length;a++){var d=c[a],e=d.toLowerCase(),d=e!==d?e:d.toUpperCase();b+=d}c=b;break;default:c=c.toUpperCase()}this._doContent(c);return!0},_doContent:function(b){var a=this._getSelection();if(this._overwriteMode&&a.isEmpty()){var c=this._model,d=c.getLineAtOffset(a.end);a.end<c.getLineEnd(d)&&(c=this._getLine(d),
a.extend(c.getNextOffset(a.getCaret(),{unit:"character",count:1})),c.destroy())}this._modifyContent({text:b,start:a.start,end:a.end,_ignoreDOMSelection:!0},!0)},_doCopy:function(b){var a=this._getSelection();return!a.isEmpty()?this._setClipboardText(this._getBaseText(a.start,a.end),b):!0},_doCursorNext:function(b){var a=this._getSelection();!a.isEmpty()&&!b.select?a.start=a.end:this._doMove(b,a);b.select||a.collapse();this._setSelection(a,!0);return!0},_doCursorPrevious:function(b){var a=this._getSelection();
if(!a.isEmpty()&&!b.select)a.end=a.start;else{if(!b.count)b.count=1;b.count*=-1;this._doMove(b,a)}b.select||a.collapse();this._setSelection(a,!0);return!0},_doCut:function(b){var a=this._getSelection();return!a.isEmpty()?(a=this._getBaseText(a.start,a.end),this._doContent(""),this._setClipboardText(a,b)):!0},_doDelete:function(b){var a=this._getSelection();a.isEmpty()&&this._doMove(b,a);this._modifyContent({text:"",start:a.start,end:a.end},!0);return!0},_doEnd:function(b){var a=this._getSelection(),
c=this._model,d;if(b.ctrl)a.extend(c.getCharCount()),d=function(){};else{var e=a.getCaret(),f=c.getLineAtOffset(e);if(this._wrapMode){var g=this._getLine(f),e=g.getLineIndex(e),e=e===g.getLineCount()-1?c.getLineEnd(f):g.getLineStart(e+1)-1;g.destroy()}else b.count&&b.count>0&&(f=Math.min(f+b.count-1,c.getLineCount()-1)),e=c.getLineEnd(f);a.extend(e)}b.select||a.collapse();this._setSelection(a,!0,!0,d);return!0},_doEnter:function(b){var a=this._model,c=this._getSelection();this._doContent(a.getLineDelimiter());
if(b&&b.noCursor)c.end=c.start,this._setSelection(c,!0);return!0},_doHome:function(b){var a=this._getSelection(),c=this._model,d;if(b.ctrl)a.extend(0),d=function(){};else{var e=a.getCaret(),f=c.getLineAtOffset(e);this._wrapMode?(c=this._getLine(f),e=c.getLineIndex(e),e=c.getLineStart(e),c.destroy()):e=c.getLineStart(f);a.extend(e)}b.select||a.collapse();this._setSelection(a,!0,!0,d);return!0},_doLineDown:function(b){var a=this._model,c=this._getSelection(),d=c.getCaret(),f=a.getLineAtOffset(d),g=
this._getLine(f),h=this._columnX,l=1,i=!1;if(h===-1||b.wholeLine||b.select&&e.isIE)h=b.wholeLine?a.getLineEnd(f+1):d,h=g.getBoundingClientRect(h).left;(d=g.getLineIndex(d))<g.getLineCount()-1?l=g.getClientRects(d+1).top+1:(d=a.getLineCount()-1,i=f===d,b.count&&b.count>0?f=Math.min(f+b.count,d):f++);d=!1;if(i){if(b.select||e.isMac||e.isLinux)c.extend(a.getCharCount()),d=!0}else g.lineIndex!==f&&(g.destroy(),g=this._getLine(f)),c.extend(g.getOffset(h,l)),d=!0;d&&(b.select||c.collapse(),this._setSelection(c,
!0,!0));this._columnX=h;g.destroy();return!0},_doLineUp:function(b){var a=this._model,c=this._getSelection(),d=c.getCaret(),f=a.getLineAtOffset(d),g=this._getLine(f),h=this._columnX,l=!1,i;if(h===-1||b.wholeLine||b.select&&e.isIE)h=b.wholeLine?a.getLineStart(f-1):d,h=g.getBoundingClientRect(h).left;(d=g.getLineIndex(d))>0?i=g.getClientRects(d-1).top+1:(l=f===0,l||(b.count&&b.count>0?f=Math.max(f-b.count,0):f--,i=this._getLineHeight(f)-1));d=!1;if(l){if(b.select||e.isMac||e.isLinux)c.extend(0),d=!0}else g.lineIndex!==
f&&(g.destroy(),g=this._getLine(f)),c.extend(g.getOffset(h,i)),d=!0;d&&(b.select||c.collapse(),this._setSelection(c,!0,!0));this._columnX=h;g.destroy();return!0},_doNoop:function(){return!0},_doPageDown:function(b){var a=this,c=this._model,d=this._getSelection(),f=d.getCaret(),g=c.getLineAtOffset(f),h=c.getLineCount(),l=this._getScroll(),c=this._getClientHeight(),i,m;if(this._lineHeight){i=this._columnX;l=this._getBoundsAtOffset(f);if(i===-1||b.select&&e.isIE)i=l.left;f=this._getLineIndex(l.top+c);
m=this._getLine(f);g=this._getLinePixel(f);f=m.getOffset(i,l.top+c-g);c=m.getBoundingClientRect(f);m.destroy();d.extend(f);b.select||d.collapse();this._setSelection(d,!0,!0,function(){a._columnX=i},c.top+g-l.top);return!0}if(g<h-1){var o=this._getLineHeight(),j=Math.min(h-g-1,Math.floor(c/o)),j=Math.max(1,j);i=this._columnX;if(i===-1||b.select&&e.isIE)m=this._getLine(g),i=m.getBoundingClientRect(f).left,m.destroy();m=this._getLine(g+j);d.extend(m.getOffset(i,0));m.destroy();b.select||d.collapse();
b=h*o;f=l.y+j*o;f+c>b&&(f=b-c);this._setSelection(d,!0,!0,function(){a._columnX=i},f-l.y)}return!0},_doPageUp:function(b){var a=this,c=this._model,d=this._getSelection(),f=d.getCaret(),g=c.getLineAtOffset(f),h=this._getScroll(),l=this._getClientHeight(),i;if(this._lineHeight){i=this._columnX;h=this._getBoundsAtOffset(f);if(i===-1||b.select&&e.isIE)i=h.left;f=this._getLineIndex(h.bottom-l);c=this._getLine(f);g=this._getLinePixel(f);f=c.getOffset(i,h.bottom-l-g);l=c.getBoundingClientRect(f);c.destroy();
d.extend(f);b.select||d.collapse();this._setSelection(d,!0,!0,function(){a._columnX=i},l.top+g-h.top);return!0}if(g>0){var m=this._getLineHeight(),l=Math.max(1,Math.min(g,Math.floor(l/m)));i=this._columnX;if(i===-1||b.select&&e.isIE)c=this._getLine(g),i=c.getBoundingClientRect(f).left,c.destroy();c=this._getLine(g-l);d.extend(c.getOffset(i,this._getLineHeight(g-l)-1));c.destroy();b.select||d.collapse();b=Math.max(0,h.y-l*m);this._setSelection(d,!0,!0,function(){a._columnX=i},b-h.y)}return!0},_doPaste:function(b){var a=
this;return this._getClipboardText(b,function(b){b&&(e.isLinux&&a._lastMouseButton===2&&(new Date).getTime()-a._lastMouseTime<=a._clickTime&&a._setSelectionTo(a._lastMouseX,a._lastMouseY),a._doContent(b))})!==null},_doScroll:function(b){var a=b.type,c=this._model,d=c.getLineCount(),b=this._getClientHeight(),e=this._getLineHeight();d*=e;var f=this._getScroll().y,g;switch(a){case "textStart":g=0;break;case "textEnd":g=d-b;break;case "pageDown":g=f+b;break;case "pageUp":g=f-b;break;case "lineDown":g=
f+e;break;case "lineUp":g=f-e;break;case "centerLine":a=this._getSelection(),g=c.getLineAtOffset(a.start),c=(c.getLineAtOffset(a.end)-g+1)*e,g=g*e-b/2+c/2}g!==void 0&&(g=Math.min(Math.max(0,g),d-b),this._scrollViewAnimated(0,g-f,function(){}));return!0},_doSelectAll:function(){var b=this._model,a=this._getSelection();a.setCaret(0);a.extend(b.getCharCount());this._setSelection(a,!1);return!0},_doTab:function(){if(this._tabMode&&!this._readonly){var b="\t";if(this._expandTab)var a=this._model,b=this._getSelection().getCaret(),
c=a.getLineAtOffset(b),a=a.getLineStart(c),b=Array(this._tabSize-(b-a)%this._tabSize+1).join(" ");this._doContent(b);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 b=
this._model,a=this._getSelection(),c=this.convert({x:this._autoScrollX,y:this._autoScrollY},"page","document"),d=a.getCaret(),f=b.getLineCount(),g=b.getLineAtOffset(d),h;if(this._autoScrollDir==="up"||this._autoScrollDir==="down")d=this._autoScrollY/this._getLineHeight(),d=d<0?Math.floor(d):Math.ceil(d),h=Math.max(0,Math.min(f-1,g+d));else if(this._autoScrollDir==="left"||this._autoScrollDir==="right")h=this._getLineIndex(c.y),g=this._getLine(g),c.x+=g.getBoundingClientRect(d,!1).left,g.destroy();
h===0&&(e.isMac||e.isLinux)?a.extend(0):h===f-1&&(e.isMac||e.isLinux)?a.extend(b.getCharCount()):(g=this._getLine(h),a.extend(g.getOffset(c.x,c.y-this._getLinePixel(h))),g.destroy());this._setSelection(a,!0)},_autoScrollTimer:function(){this._autoScroll();var b=this;this._autoScrollTimerID=this._getWindow().setTimeout(function(){b._autoScrollTimer()},this._AUTO_SCROLL_RATE)},_calculateLineHeightTimer:function(b){if(this._lineHeight&&!this._calculateLHTimer){var a=this._model.getLineCount(),c=0;if(b){for(var b=
0,d=(new Date).getTime(),e=0;c<a;)if(this._lineHeight[c]||(b++,e||(e=c),this._lineHeight[c]=this._calculateLineHeight(c)),c++,(new Date).getTime()-d>100)break;this.redrawRulers(0,a);this._queueUpdate()}b=this._getWindow();if(c!==a){var f=this;this._calculateLHTimer=b.setTimeout(function(){f._calculateLHTimer=null;f._calculateLineHeightTimer(!0)},0)}else if(this._calculateLHTimer)b.clearTimeout(this._calculateLHTimer),this._calculateLHTimer=void 0}},_calculateLineHeight:function(b){var b=this._getLine(b),
a=b.getBoundingClientRect();b.destroy();return Math.max(1,a.bottom-a.top)},_calculateMetrics:function(){var b=this._clientDiv,a=b.ownerDocument,c=e.createElement(a,"div");c.style.lineHeight="normal";var d={type:"LineStyle",textView:this,0:0,lineText:this._model.getLine(0),lineStart:0};this.onLineStyle(d);f(d.style,c);c.style.position="fixed";c.style.left="-1000px";var g=e.createElement(a,"span");g.appendChild(a.createTextNode(" "));c.appendChild(g);var h=e.createElement(a,"span");h.style.fontStyle=
"italic";h.appendChild(a.createTextNode(" "));c.appendChild(h);var l=e.createElement(a,"span");l.style.fontWeight="bold";l.appendChild(a.createTextNode(" "));c.appendChild(l);d=e.createElement(a,"span");d.style.fontWeight="bold";d.style.fontStyle="italic";d.appendChild(a.createTextNode(" "));c.appendChild(d);b.appendChild(c);var i=c.getBoundingClientRect(),g=g.getBoundingClientRect(),h=h.getBoundingClientRect(),l=l.getBoundingClientRect(),d=d.getBoundingClientRect(),g=g.bottom-g.top,h=h.bottom-h.top,
l=l.bottom-l.top,o=d.bottom-d.top,j=0,d=i.bottom-i.top<=0,i=Math.max(1,i.bottom-i.top);h>g&&(j=1);l>h&&(j=2);o>l&&(j=3);var p;if(j!==0){p={style:{}};if((j&1)!==0)p.style.fontStyle="italic";if((j&2)!==0)p.style.fontWeight="bold"}g=s(c);b.removeChild(c);o=m(this._viewDiv);c=e.createElement(a,"div");c.style.position="fixed";c.style.left="-1000px";c.style.paddingLeft=o.left+"px";c.style.paddingTop=o.top+"px";c.style.paddingRight=o.right+"px";c.style.paddingBottom=o.bottom+"px";c.style.width="100px";c.style.height=
"100px";o=e.createElement(a,"div");o.style.width="100%";o.style.height="100%";c.appendChild(o);b.appendChild(c);j=c.getBoundingClientRect();h=o.getBoundingClientRect();l=0;if(!this._singleMode)c.style.overflow="hidden",o.style.height="200px",l=c.clientWidth,c.style.overflow="scroll",l-=c.clientWidth;b.removeChild(c);o={left:h.left-j.left,top:h.top-j.top,right:j.right-h.right,bottom:j.bottom-h.bottom};h=j=0;if(!d&&(this._wrapOffset||this._marginOffset))c=e.createElement(a,"div"),c.style.position="fixed",
c.style.left="-1000px",c.innerHTML=Array(this._wrapOffset+1).join(" "),b.appendChild(c),j=c.getBoundingClientRect(),j=Math.ceil(j.right-j.left),c.innerHTML=Array(this._marginOffset+1).join(" "),h=c.getBoundingClientRect(),h=Math.ceil(h.right-h.left),b.removeChild(c);return{lineHeight:i,largestFontStyle:p,lineTrim:g,viewPadding:o,scrollWidth:l,wrapWidth:j,marginWidth:h,invalid:d}},_cancelAnimation:function(){if(this._animation)this._animation.stop(),this._animation=null},_clearSelection:function(b){var a=
this._getSelection();if(a.isEmpty())return!1;b==="next"?a.start=a.end:a.end=a.start;this._setSelection(a,!0);return!0},_commitIME:function(){if(this._imeOffset!==-1){this._scrollDiv.focus();this._clientDiv.focus();var b=this._model,a=b.getLineAtOffset(this._imeOffset),c=b.getLineStart(a),d=this._getDOMText(this._getLineNode(a)).text,b=b.getLine(a),c=this._imeOffset-c,b=c+d.length-b.length;c!==b&&this._doContent(d.substring(c,b));this._imeOffset=-1}},_createActions:function(){this.addKeyMode(new j.DefaultKeyMode(this));
var b=this;this._actions={noop:{defaultHandler:function(){return b._doNoop()}},lineUp:{defaultHandler:function(a){return b._doLineUp(c(a,{select:!1}))},actionDescription:{name:i.lineUp}},lineDown:{defaultHandler:function(a){return b._doLineDown(c(a,{select:!1}))},actionDescription:{name:i.lineDown}},lineStart:{defaultHandler:function(a){return b._doHome(c(a,{select:!1,ctrl:!1}))},actionDescription:{name:i.lineStart}},lineEnd:{defaultHandler:function(a){return b._doEnd(c(a,{select:!1,ctrl:!1}))},actionDescription:{name:i.lineEnd}},
charPrevious:{defaultHandler:function(a){return b._doCursorPrevious(c(a,{select:!1,unit:"character"}))},actionDescription:{name:i.charPrevious}},charNext:{defaultHandler:function(a){return b._doCursorNext(c(a,{select:!1,unit:"character"}))},actionDescription:{name:i.charNext}},pageUp:{defaultHandler:function(a){return b._doPageUp(c(a,{select:!1}))},actionDescription:{name:i.pageUp}},pageDown:{defaultHandler:function(a){return b._doPageDown(c(a,{select:!1}))},actionDescription:{name:i.pageDown}},scrollPageUp:{defaultHandler:function(a){return b._doScroll(c(a,
{type:"pageUp"}))},actionDescription:{name:i.scrollPageUp}},scrollPageDown:{defaultHandler:function(a){return b._doScroll(c(a,{type:"pageDown"}))},actionDescription:{name:i.scrollPageDown}},scrollLineUp:{defaultHandler:function(a){return b._doScroll(c(a,{type:"lineUp"}))},actionDescription:{name:i.scrollLineUp}},scrollLineDown:{defaultHandler:function(a){return b._doScroll(c(a,{type:"lineDown"}))},actionDescription:{name:i.scrollLineDown}},wordPrevious:{defaultHandler:function(a){return b._doCursorPrevious(c(a,
{select:!1,unit:"word"}))},actionDescription:{name:i.wordPrevious}},wordNext:{defaultHandler:function(a){return b._doCursorNext(c(a,{select:!1,unit:"word"}))},actionDescription:{name:i.wordNext}},textStart:{defaultHandler:function(a){return b._doHome(c(a,{select:!1,ctrl:!0}))},actionDescription:{name:i.textStart}},textEnd:{defaultHandler:function(a){return b._doEnd(c(a,{select:!1,ctrl:!0}))},actionDescription:{name:i.textEnd}},scrollTextStart:{defaultHandler:function(a){return b._doScroll(c(a,{type:"textStart"}))},
actionDescription:{name:i.scrollTextStart}},scrollTextEnd:{defaultHandler:function(a){return b._doScroll(c(a,{type:"textEnd"}))},actionDescription:{name:i.scrollTextEnd}},centerLine:{defaultHandler:function(a){return b._doScroll(c(a,{type:"centerLine"}))},actionDescription:{name:i.centerLine}},selectLineUp:{defaultHandler:function(a){return b._doLineUp(c(a,{select:!0}))},actionDescription:{name:i.selectLineUp}},selectLineDown:{defaultHandler:function(a){return b._doLineDown(c(a,{select:!0}))},actionDescription:{name:i.selectLineDown}},
selectWholeLineUp:{defaultHandler:function(a){return b._doLineUp(c(a,{select:!0,wholeLine:!0}))},actionDescription:{name:i.selectWholeLineUp}},selectWholeLineDown:{defaultHandler:function(a){return b._doLineDown(c(a,{select:!0,wholeLine:!0}))},actionDescription:{name:i.selectWholeLineDown}},selectLineStart:{defaultHandler:function(a){return b._doHome(c(a,{select:!0,ctrl:!1}))},actionDescription:{name:i.selectLineStart}},selectLineEnd:{defaultHandler:function(a){return b._doEnd(c(a,{select:!0,ctrl:!1}))},
actionDescription:{name:i.selectLineEnd}},selectCharPrevious:{defaultHandler:function(a){return b._doCursorPrevious(c(a,{select:!0,unit:"character"}))},actionDescription:{name:i.selectCharPrevious}},selectCharNext:{defaultHandler:function(a){return b._doCursorNext(c(a,{select:!0,unit:"character"}))},actionDescription:{name:i.selectCharNext}},selectPageUp:{defaultHandler:function(a){return b._doPageUp(c(a,{select:!0}))},actionDescription:{name:i.selectPageUp}},selectPageDown:{defaultHandler:function(a){return b._doPageDown(c(a,
{select:!0}))},actionDescription:{name:i.selectPageDown}},selectWordPrevious:{defaultHandler:function(a){return b._doCursorPrevious(c(a,{select:!0,unit:"word"}))},actionDescription:{name:i.selectWordPrevious}},selectWordNext:{defaultHandler:function(a){return b._doCursorNext(c(a,{select:!0,unit:"word"}))},actionDescription:{name:i.selectWordNext}},selectTextStart:{defaultHandler:function(a){return b._doHome(c(a,{select:!0,ctrl:!0}))},actionDescription:{name:i.selectTextStart}},selectTextEnd:{defaultHandler:function(a){return b._doEnd(c(a,
{select:!0,ctrl:!0}))},actionDescription:{name:i.selectTextEnd}},deletePrevious:{defaultHandler:function(a){return b._doBackspace(c(a,{unit:"character"}))},actionDescription:{name:i.deletePrevious}},deleteNext:{defaultHandler:function(a){return b._doDelete(c(a,{unit:"character"}))},actionDescription:{name:i.deleteNext}},deleteWordPrevious:{defaultHandler:function(a){return b._doBackspace(c(a,{unit:"word"}))},actionDescription:{name:i.deleteWordPrevious}},deleteWordNext:{defaultHandler:function(a){return b._doDelete(c(a,
{unit:"word"}))},actionDescription:{name:i.deleteWordNext}},deleteLineStart:{defaultHandler:function(a){return b._doBackspace(c(a,{unit:"line"}))},actionDescription:{name:i.deleteLineStart}},deleteLineEnd:{defaultHandler:function(a){return b._doDelete(c(a,{unit:"line"}))},actionDescription:{name:i.deleteLineEnd}},tab:{defaultHandler:function(){return b._doTab()},actionDescription:{name:i.tab}},shiftTab:{defaultHandler:function(){return b._doShiftTab()},actionDescription:{name:i.shiftTab}},enter:{defaultHandler:function(){return b._doEnter()},
actionDescription:{name:i.enter}},enterNoCursor:{defaultHandler:function(a){return b._doEnter(c(a,{noCursor:!0}))},actionDescription:{name:i.enterNoCursor}},selectAll:{defaultHandler:function(){return b._doSelectAll()},actionDescription:{name:i.selectAll}},copy:{defaultHandler:function(){return b._doCopy()},actionDescription:{name:i.copy}},cut:{defaultHandler:function(){return b._doCut()},actionDescription:{name:i.cut}},paste:{defaultHandler:function(){return b._doPaste()},actionDescription:{name:i.paste}},
uppercase:{defaultHandler:function(a){return b._doCase(c(a,{type:"upper"}))},actionDescription:{name:i.uppercase}},lowercase:{defaultHandler:function(a){return b._doCase(c(a,{type:"lower"}))},actionDescription:{name:i.lowercase}},capitalize:{defaultHandler:function(a){return b._doCase(c(a,{unit:"word",type:"capitalize"}))},actionDescription:{name:i.capitalize}},reversecase:{defaultHandler:function(a){return b._doCase(c(a,{type:"reverse"}))},actionDescription:{name:i.reversecase}},toggleOverwriteMode:{defaultHandler:function(){return b._doOverwriteMode()},
actionDescription:{name:i.toggleOverwriteMode}},toggleTabMode:{defaultHandler:function(){return b._doTabMode()},actionDescription:{name:i.toggleTabMode}},toggleWrapMode:{defaultHandler:function(){return b._doWrapMode()},actionDescription:{name:i.toggleWrapMode}}}},_createRulerParent:function(b){var a=e.createElement(document,"div");a.className=b;a.tabIndex=-1;a.style.overflow="hidden";a.style.MozUserSelect="none";a.style.WebkitUserSelect="none";a.style.position="absolute";a.style.top="0px";a.style.bottom=
"0px";a.style.cursor="default";a.style.display="none";a.setAttribute("aria-hidden","true");this._rootDiv.appendChild(a);return a},_createRuler:function(b,a){if(this._clientDiv){var c=this._getRulerParent(b);if(c){if(c!==this._marginDiv||this._marginOffset)c.style.display="block";var d=e.createElement(c.ownerDocument,"div");d._ruler=b;d.rulerChanged=!0;d.style.position="relative";d.style.cssFloat="left";d.style.styleFloat="left";d.style.outline="none";if(a===void 0||a<0||a>=c.children.length)c.appendChild(d);
else{for(var f=c.firstChild;f&&a-- >0;)f=f.nextSibling;c.insertBefore(d,f)}}}},_createView:function(){if(!this._clientDiv){for(var b=this._parent;b.hasChildNodes();)b.removeChild(b.lastChild);var a=b.ownerDocument,c=e.createElement(a,"div");this._rootDiv=c;c.tabIndex=-1;c.style.position="relative";c.style.overflow="hidden";c.style.width="100%";c.style.height="100%";c.style.overflow="hidden";c.style.WebkitTextSizeAdjust="100%";c.setAttribute("role","application");b.appendChild(c);this._leftDiv=this._createRulerParent("textviewLeftRuler");
b=e.createElement(a,"div");b.className="textviewScroll";this._viewDiv=b;b.tabIndex=-1;b.style.position="absolute";b.style.top="0px";b.style.bottom="0px";b.style.borderWidth="0px";b.style.margin="0px";b.style.outline="none";b.style.background="transparent";if(e.isMac&&e.isWebkit)b.style.pointerEvents="none",b.style.zIndex="2";c.appendChild(b);var d=this._createRulerParent("textviewRightRuler");this._rightDiv=d;d.style.right="0px";this._scrollDiv=d=e.createElement(a,"div");d.style.margin="0px";d.style.borderWidth=
"0px";d.style.padding="0px";b.appendChild(d);(this._marginDiv=this._createRulerParent("textviewMarginRuler")).style.zIndex="4";if(!e.isIE&&!e.isIOS)this._clipDiv=b=e.createElement(a,"div"),b.style.position="absolute",b.style.overflow="hidden",b.style.margin="0px",b.style.borderWidth="0px",b.style.padding="0px",b.style.background="transparent",c.appendChild(b),this._clipScrollDiv=d=e.createElement(a,"div"),d.style.position="absolute",d.style.height="1px",d.style.top="-1000px",d.style.background="transparent",
b.appendChild(d);this._setFullSelection(this._fullSelection,!0);b=e.createElement(a,"div");b.className="textviewContent";this._clientDiv=b;b.tabIndex=0;b.style.position="absolute";b.style.borderWidth="0px";b.style.margin="0px";b.style.padding="0px";b.style.outline="none";b.style.zIndex="1";b.style.WebkitUserSelect="text";b.setAttribute("spellcheck","false");if(e.isIOS||e.isAndroid)b.style.WebkitTapHighlightColor="transparent";(this._clipDiv||c).appendChild(b);if(e.isIOS||e.isAndroid)this._vScrollDiv=
d=e.createElement(a,"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",c.appendChild(d),this._hScrollDiv=d=e.createElement(a,"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",c.appendChild(d);if(e.isFirefox&&!b.setCapture)this._overlayDiv=a=e.createElement(a,"div"),a.style.position=b.style.position,a.style.borderWidth=b.style.borderWidth,a.style.margin=b.style.margin,a.style.padding=b.style.padding,a.style.cursor="text",a.style.zIndex="2",(this._clipDiv||
c).appendChild(a);b.contentEditable="true";b.setAttribute("role","textbox");b.setAttribute("aria-multiline","true");this._setWrapMode(this._wrapMode,!0);this._setReadOnly(this._readonly);this._setThemeClass(this._themeClass,!0);this._setTabSize(this._tabSize,!0);this._setMarginOffset(this._marginOffset,!0);this._hookEvents();c=this._rulers;for(a=0;a<c.length;a++)this._createRuler(c[a]);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:a.TextTheme.getTheme(),update:this._setTheme},themeClass:{value:void 0,update:this._setThemeClass}}},_destroyRuler:function(b){var a=this._getRulerParent(b);if(a)for(var c=a.firstChild;c;){if(c._ruler===b){c._ruler=void 0;a.removeChild(c);if(a.children.length===0&&(a!==this._marginDiv||!this._marginOffset))a.style.display="none";break}c=c.nextSibling}},_destroyView:function(){if(this._clientDiv){this._setGrab(null);
this._unhookEvents();var b=this._getWindow();if(this._autoScrollTimerID)b.clearTimeout(this._autoScrollTimerID),this._autoScrollTimerID=null;if(this._updateTimer)b.clearTimeout(this._updateTimer),this._updateTimer=null;b=this._rootDiv;b.parentNode.removeChild(b);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(b,a,c){this._autoScrollDir=b;this._autoScrollX=a;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 b=this._clientDiv;if(b){var a=this._hasFocus;this._ignoreFocus=!0;a&&b.blur();b.contentEditable=!1;b.contentEditable=!0;a&&b.focus();this._ignoreFocus=
!1}},_getBaseText:function(b,a){var c=this._model;c.getBaseModel&&(b=c.mapOffset(b),a=c.mapOffset(a),c=c.getBaseModel());return c.getText(b,a)},_getBottomIndex:function(b){var a=this._bottomChild;if(b&&this._getClientHeight()>this._getLineHeight()){var b=a.getBoundingClientRect(),c=this._clientDiv.getBoundingClientRect();b.bottom>c.bottom&&(a=this._getLinePrevious(a)||a)}return a.lineIndex},_getBoundsAtOffset:function(b){var a=this._getLine(this._model.getLineAtOffset(b)),b=a.getBoundingClientRect(b),
c=this._getLinePixel(a.lineIndex);b.top+=c;b.bottom+=c;a.destroy();return b},_getClientHeight:function(){var b=this._getViewPadding();return Math.max(0,this._viewDiv.clientHeight-b.top-b.bottom)},_getClientWidth:function(){var b=this._getViewPadding();return Math.max(0,this._viewDiv.clientWidth-b.left-b.right)},_getClipboardText:function(b,a){var c=this._model.getLineDelimiter(),d,f,g=this._getWindow(),h=g.clipboardData;if(!h&&b)h=b.clipboardData;if(h)return d=[],f=h.getData(e.isIE?"Text":"text/plain"),
l(f,function(b){d.push(b)},function(){d.push(c)}),f=d.join(""),a&&a(f),f;if(e.isFirefox){this._ignoreFocus=!0;var i=this._clipboardDiv,h=this._rootDiv.ownerDocument;if(!i)this._clipboardDiv=i=e.createElement(h,"div"),i.style.position="fixed",i.style.whiteSpace="pre",i.style.left="-1000px",this._rootDiv.appendChild(i);i.innerHTML="<pre contenteditable=''></pre>";i.firstChild.focus();var m=this,o=function(){var b=m._getTextFromElement(i);i.innerHTML="";d=[];l(b,function(b){d.push(b)},function(){d.push(c)});
return d.join("")},j=!1;this._ignorePaste=!0;if(!e.isLinux||this._lastMouseButton!==2)try{j=h.execCommand("paste",!1,null)}catch(p){j=i.childNodes.length>1||i.firstChild&&i.firstChild.childNodes.length>0}this._ignorePaste=!1;if(!j)return b?(g.setTimeout(function(){m.focus();(f=o())&&a&&a(f);m._ignoreFocus=!1},0),null):(this.focus(),this._ignoreFocus=!1,"");this.focus();this._ignoreFocus=!1;(f=o())&&a&&a(f);return f}return""},_getDOMText:function(b,a){for(var c=b.firstChild,d="",e=0;c;){var f;if(!c.ignore)if(c.ignoreChars){f=
c.lastChild;for(var g=0,h=[],l=-1;f;){var i=f.data;if(i)for(var m=i.length-1;m>=0;m--){var o=i.substring(m,m+1);g<c.ignoreChars&&(o===" "||o==="\u200b"||o==="\ufeff")?g++:h.push(o==="\u00a0"?"\t":o)}if(a===f)l=h.length;f=f.previousSibling}h=h.reverse().join("");l!==-1&&(e=d.length+h.length-l);d+=h}else for(f=c.firstChild;f;){if(a===f)e=d.length;d+=f.data;f=f.nextSibling}c=c.nextSibling}return{text:d,offset:e}},_getTextFromElement:function(b){var a=b.ownerDocument,c=a.defaultView;if(!c.getSelection)return b.innerText||
b.textContent;a=a.createRange();a.selectNode(b);var b=c.getSelection(),c=[],d;for(d=0;d<b.rangeCount;d++)c.push(b.getRangeAt(d));this._ignoreSelect=!0;b.removeAllRanges();b.addRange(a);a=b.toString();b.removeAllRanges();for(d=0;d<c.length;d++)b.addRange(c[d]);this._ignoreSelect=!1;return a},_getViewPadding:function(){return this._metrics.viewPadding},_getLine:function(b){var a=this._getLineNode(b);return a&&!a.lineChanged&&!a.lineRemoved?a._line:new p(this,b)},_getLineHeight:function(b,a){if(b!==
void 0&&this._lineHeight){var c=this._lineHeight[b];if(c)return c;if(a||a===void 0)return this._lineHeight[b]=this._calculateLineHeight(b)}return this._metrics.lineHeight},_getLineNode:function(b){for(var a=this._clientDiv.firstChild;a;){if(b===a.lineIndex)return a;a=a.nextSibling}},_getLineNext:function(b){for(b=b?b.nextSibling:this._clientDiv.firstChild;b&&b.lineIndex===-1;)b=b.nextSibling;return b},_getLinePrevious:function(b){for(b=b?b.previousSibling:this._clientDiv.lastChild;b&&b.lineIndex===
-1;)b=b.previousSibling;return b},_getLinePixel:function(b){b=Math.min(Math.max(0,b),this._model.getLineCount());if(this._lineHeight){var a=this._getTopIndex(),c=-this._topIndexY+this._getScroll().y;if(b>a)for(;a<b;a++)c+=this._getLineHeight(a);else for(a-=1;a>=b;a--)c-=this._getLineHeight(a);return c}return this._getLineHeight()*b},_getLineIndex:function(b){var a,c=0,d=this._model.getLineCount();if(this._lineHeight){var c=this._getTopIndex(),e=-this._topIndexY+this._getScroll().y;if(b!==e)if(b<e)for(;b<
e&&c>0;)b+=this._getLineHeight(--c);else for(a=this._getLineHeight(c);b-a>=e&&c<d-1;)b-=a,a=this._getLineHeight(++c)}else a=this._getLineHeight(),c=Math.floor(b/a);return Math.max(0,Math.min(d-1,c))},_getRulerParent:function(b){switch(b.getLocation()){case "left":return this._leftDiv;case "right":return this._rightDiv;case "margin":return this._marginDiv}return null},_getScroll:function(b){(b===void 0||b)&&this._cancelAnimation();b=this._viewDiv;return{x:b.scrollLeft,y:b.scrollTop}},_getSelection:function(){return this._selection.clone()},
_getTopIndex:function(b){var a=this._topChild;if(b&&this._getClientHeight()>this._getLineHeight()){var b=a.getBoundingClientRect(),c=this._getViewPadding(),d=this._viewDiv.getBoundingClientRect();b.top<d.top+c.top&&(a=this._getLineNext(a)||a)}return a.lineIndex},_hookEvents:function(){var b=this;this._modelListener={onChanging:function(a){b._onModelChanging(a)},onChanged:function(a){b._onModelChanged(a)}};this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",
this._modelListener.onChanged);this._themeListener={onChanged:function(){b._setThemeClass(b._themeClass)}};this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);var a=this._handlers=[],c=this._clientDiv,d=this._viewDiv,f=this._rootDiv,g=this._overlayDiv||c,h=c.ownerDocument,l=this._getWindow(),i=e.isIE?h:l;a.push({target:l,type:"resize",handler:function(a){return b._handleResize(a?a:l.event)}});a.push({target:c,type:"blur",handler:function(a){return b._handleBlur(a?a:l.event)}});
a.push({target:c,type:"focus",handler:function(a){return b._handleFocus(a?a:l.event)}});a.push({target:d,type:"focus",handler:function(){c.focus()}});a.push({target:d,type:"scroll",handler:function(a){return b._handleScroll(a?a:l.event)}});a.push({target:c,type:"textInput",handler:function(a){return b._handleTextInput(a?a:l.event)}});a.push({target:c,type:"keydown",handler:function(a){return b._handleKeyDown(a?a:l.event)}});a.push({target:c,type:"keypress",handler:function(a){return b._handleKeyPress(a?
a:l.event)}});a.push({target:c,type:"keyup",handler:function(a){return b._handleKeyUp(a?a:l.event)}});e.isIE&&a.push({target:h,type:"keyup",handler:function(a){return b._handleDocKeyUp(a?a:l.event)}});a.push({target:c,type:"contextmenu",handler:function(a){return b._handleContextMenu(a?a:l.event)}});a.push({target:c,type:"copy",handler:function(a){return b._handleCopy(a?a:l.event)}});a.push({target:c,type:"cut",handler:function(a){return b._handleCut(a?a:l.event)}});a.push({target:c,type:"paste",
handler:function(a){return b._handlePaste(a?a:l.event)}});if(e.isIOS||e.isAndroid)a.push({target:h,type:"selectionchange",handler:function(a){return b._handleSelectionChange(a?a:l.event)}}),a.push({target:c,type:"touchstart",handler:function(a){return b._handleTouchStart(a?a:l.event)}}),a.push({target:c,type:"touchmove",handler:function(a){return b._handleTouchMove(a?a:l.event)}}),a.push({target:c,type:"touchend",handler:function(a){return b._handleTouchEnd(a?a:l.event)}});else{a.push({target:c,type:"selectstart",
handler:function(a){return b._handleSelectStart(a?a:l.event)}});a.push({target:c,type:"mousedown",handler:function(a){return b._handleMouseDown(a?a:l.event)}});a.push({target:c,type:"mouseover",handler:function(a){return b._handleMouseOver(a?a:l.event)}});a.push({target:c,type:"mouseout",handler:function(a){return b._handleMouseOut(a?a:l.event)}});a.push({target:i,type:"mouseup",handler:function(a){return b._handleMouseUp(a?a:l.event)}});a.push({target:i,type:"mousemove",handler:function(a){return b._handleMouseMove(a?
a:l.event)}});a.push({target:f,type:"mousedown",handler:function(a){return b._handleRootMouseDown(a?a:l.event)}});a.push({target:f,type:"mouseup",handler:function(a){return b._handleRootMouseUp(a?a:l.event)}});a.push({target:g,type:"dragstart",handler:function(a){return b._handleDragStart(a?a:l.event)}});a.push({target:g,type:"drag",handler:function(a){return b._handleDrag(a?a:l.event)}});a.push({target:g,type:"dragend",handler:function(a){return b._handleDragEnd(a?a:l.event)}});a.push({target:g,
type:"dragenter",handler:function(a){return b._handleDragEnter(a?a:l.event)}});a.push({target:g,type:"dragover",handler:function(a){return b._handleDragOver(a?a:l.event)}});a.push({target:g,type:"dragleave",handler:function(a){return b._handleDragLeave(a?a:l.event)}});a.push({target:g,type:"drop",handler:function(a){return b._handleDrop(a?a:l.event)}});a.push({target:this._clientDiv,type:e.isFirefox>26?"wheel":e.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return b._handleMouseWheel(a?
a:l.event)}});this._clipDiv&&a.push({target:this._clipDiv,type:e.isFirefox>26?"wheel":e.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return b._handleMouseWheel(a?a:l.event)}});if(e.isFirefox&&(!e.isWindows||e.isFirefox>=15))(d=l.MutationObserver||l.MozMutationObserver)?(this._mutationObserver=new d(function(a){b._handleDataModified(a)}),this._mutationObserver.observe(c,{subtree:!0,characterData:!0})):a.push({target:this._clientDiv,type:"DOMCharacterDataModified",handler:function(a){return b._handleDataModified(a?
a:l.event)}});this._overlayDiv&&(a.push({target:this._overlayDiv,type:"mousedown",handler:function(a){return b._handleMouseDown(a?a:l.event)}}),a.push({target:this._overlayDiv,type:"mouseover",handler:function(a){return b._handleMouseOver(a?a:l.event)}}),a.push({target:this._overlayDiv,type:"mouseout",handler:function(a){return b._handleMouseOut(a?a:l.event)}}),a.push({target:this._overlayDiv,type:"contextmenu",handler:function(a){return b._handleContextMenu(a?a:l.event)}}));this._isW3CEvents||a.push({target:this._clientDiv,
type:"dblclick",handler:function(a){return b._handleDblclick(a?a:l.event)}})}this._hookRulerEvents(this._leftDiv,a);this._hookRulerEvents(this._rightDiv,a);this._hookRulerEvents(this._marginDiv,a);for(d=0;d<a.length;d++)f=a[d],r(f.target,f.type,f.handler,f.capture)},_hookRulerEvents:function(b,a){if(b){var c=this,d=this._getWindow();e.isIE&&a.push({target:b,type:"selectstart",handler:function(){return!1}});a.push({target:b,type:e.isFirefox>26?"wheel":e.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return c._handleMouseWheel(b?
b:d.event)}});a.push({target:b,type:"click",handler:function(b){c._handleRulerEvent(b?b:d.event)}});a.push({target:b,type:"dblclick",handler:function(b){c._handleRulerEvent(b?b:d.event)}});a.push({target:b,type:"mousemove",handler:function(b){c._handleRulerEvent(b?b:d.event)}});a.push({target:b,type:"mouseover",handler:function(b){c._handleRulerEvent(b?b:d.event)}});a.push({target:b,type:"mouseout",handler:function(b){c._handleRulerEvent(b?b:d.event)}})}},_getWindow:function(){return this._parent.ownerDocument.defaultView||
this._parent.ownerDocument.parentWindow},_ignoreEvent:function(b){for(b=b.target;b&&b!==this._clientDiv;){if(b.ignore)return!0;b=b.parentNode}return!1},_init:function(b){var a=b.parent;typeof a==="string"&&(a=(b.document||document).getElementById(a));if(!a)throw"no parent";b.parent=a;b.model=b.model||new k.TextModel;var c=this._defaultOptions(),d;for(d in c)c.hasOwnProperty(d)&&(this["_"+d]=b[d]!==void 0?b[d]:c[d].value);this._keyModes=[];this._rulers=[];this._selection=new o(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=(!e.isIE||e.isIE>=9)&&typeof a.ownerDocument.createRange().getBoundingClientRect==="function";this._isW3CEvents=a.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(b,a){if(!this._readonly||b._code)if(b.type="Verify",this.onVerify(b),!(b.text===null||b.text===void 0)){var c=this._model;try{if(b._ignoreDOMSelection)this._ignoreDOMSelection=!0;c.setText(b.text,b.start,b.end)}finally{if(b._ignoreDOMSelection)this._ignoreDOMSelection=!1}a&&(c=
this._getSelection(),c.setCaret(b.start+b.text.length),this._setSelection(c,!0));this.onModify({type:"Modify"})}},_onModelChanged:function(b){b.type="ModelChanged";this.onModelChanged(b);b.type="Changed";var a=b.start,c=b.addedCharCount,d=b.removedCharCount,e=b.addedLineCount,f=b.removedLineCount,g=this._getSelection();g.end>a&&(g.end>a&&g.start<a+d?g.setCaret(a+c):(g.start+=c-d,g.end+=c-d),this._setSelection(g,!1,!1));a=this._model.getLineAtOffset(a);for(c=this._getLineNext();c;){d=c.lineIndex;if(a<=
d&&d<=a+f)a===d&&!c.modelChangedEvent&&!c.lineRemoved?(c.modelChangedEvent=b,c.lineChanged=!0):(c.lineRemoved=!0,c.lineChanged=!1,c.modelChangedEvent=null);if(d>a+f)c.lineIndex=d+e-f,c._line.lineIndex=c.lineIndex;c=this._getLineNext(c)}this._lineHeight&&(b=[a,f].concat(Array(e)),Array.prototype.splice.apply(this._lineHeight,b));if(!this._wrapMode&&a<=this._maxLineIndex&&this._maxLineIndex<=a+f)this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0;this._update()},_onModelChanging:function(b){b.type=
"ModelChanging";this.onModelChanging(b);b.type="Changing"},_queueUpdate:function(){if(!this._updateTimer&&!this._ignoreQueueUpdate){var b=this;this._updateTimer=this._getWindow().setTimeout(function(){b._updateTimer=null;b._update()},0)}},_resetLineHeight:function(b,a){if(this._wrapMode||this._variableLineHeight){if(b!==void 0&&a!==void 0)for(var c=b;c<a;c++)this._lineHeight[c]=void 0;else this._lineHeight=Array(this._model.getLineCount());this._calculateLineHeightTimer()}else this._lineHeight=null},
_resetLineWidth:function(){var b=this._clientDiv;if(b)for(b=b.firstChild;b;)b.lineWidth=void 0,b=b.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 o(0,0,!1),!1,!1);if(this._viewDiv)this._viewDiv.scrollLeft=0,this._viewDiv.scrollTop=0;var b=this._clientDiv;if(b){for(var a=b.firstChild;a;)a.lineRemoved=!0,a=a.nextSibling;if(e.isFirefox)this._ignoreFocus=
!1,(a=this._hasFocus)&&b.blur(),b.contentEditable=!1,b.contentEditable=!0,a&&b.focus(),this._ignoreFocus=!1}},_scrollViewAnimated:function(b,a,c){var d=this._getWindow();if(c&&this._scrollAnimation){var e=this;this._animation=new v({window:d,duration:this._scrollAnimation,curve:[a,0],onAnimate:function(b){b=a-Math.floor(b);e._scrollView(0,b);a-=b},onEnd:function(){e._animation=null;e._scrollView(b,a);c&&d.setTimeout(c,0)}});this._animation.play()}else this._scrollView(b,a),c&&d.setTimeout(c,0)},_scrollView:function(b,
a){this._ensureCaretVisible=!1;var c=this._viewDiv;b&&(c.scrollLeft+=b);a&&(c.scrollTop+=a)},_setClipboardText:function(b,a){var c,d=this._getWindow(),f=d.clipboardData;if(!f&&a)f=a.clipboardData;if(f&&(c=[],l(b,function(b){c.push(b)},function(){c.push(e.platformDelimiter)}),f.setData(e.isIE?"Text":"text/plain",c.join(""))))return!0;var g=this._parent.ownerDocument,h=e.createElement(g,"pre");h.style.position="fixed";h.style.left="-1000px";l(b,function(b){h.appendChild(g.createTextNode(b))},function(){h.appendChild(e.createElement(g,
"br"))});h.appendChild(g.createTextNode(" "));this._clientDiv.appendChild(h);f=g.createRange();f.setStart(h.firstChild,0);f.setEndBefore(h.lastChild);var i=d.getSelection();i.rangeCount>0&&i.removeAllRanges();i.addRange(f);var m=this,f=function(){h&&h.parentNode===m._clientDiv&&m._clientDiv.removeChild(h);m._updateDOMSelection()},i=!1;this._ignoreCopy=!0;try{i=g.execCommand("copy",!1,null)}catch(o){}this._ignoreCopy=!1;if(!i&&a)return d.setTimeout(f,0),!1;f();return!0},_setDOMSelection:function(b,
a,c,d,f){for(var g,h,l,i,m=0,o=b.firstChild,j,p,s=this._model.getLine(b.lineIndex).length;o;){if(!o.ignore){j=o.firstChild;p=j.length;o.ignoreChars&&(p-=o.ignoreChars);if(m+p>a||m+p>=s){g=j;h=a-m;o.ignoreChars&&p>0&&h===p&&(h+=o.ignoreChars);break}m+=p}o=o.nextSibling}for(var m=0,o=c.firstChild,q=this._model.getLine(c.lineIndex).length;o;){if(!o.ignore){j=o.firstChild;p=j.length;o.ignoreChars&&(p-=o.ignoreChars);if(p+m>d||m+p>=q){l=j;i=d-m;o.ignoreChars&&p>0&&i===p&&(i+=o.ignoreChars);break}m+=p}o=
o.nextSibling}this._setDOMFullSelection(b,a,s,c,d,q);b=this._getWindow();a=this._parent.ownerDocument;if(b.getSelection){c=b.getSelection();b=a.createRange();b.setStart(g,h);b.setEnd(l,i);if(this._hasFocus&&(c.anchorNode!==g||c.anchorOffset!==h||c.focusNode!==l||c.focusOffset!==i||c.anchorNode!==l||c.anchorOffset!==i||c.focusNode!==g||c.focusOffset!==h))this._anchorNode=g,this._anchorOffset=h,this._focusNode=l,this._focusOffset=i,this._ignoreSelect=!1,c.rangeCount>0&&c.removeAllRanges(),c.addRange(b),
this._ignoreSelect=!0;if(this._cursorDiv&&(b=a.createRange(),f?(b.setStart(g,h),b.setEnd(g,h)):(b.setStart(l,i),b.setEnd(l,i)),l=b.getClientRects()[0],i=this._cursorDiv.parentNode,g=i.getBoundingClientRect(),l&&g))this._cursorDiv.style.top=l.top-g.top+i.scrollTop+"px",this._cursorDiv.style.left=l.left-g.left+i.scrollLeft+"px"}else if(a.selection&&this._hasFocus)f=a.body,b=e.createElement(a,"div"),f.appendChild(b),f.removeChild(b),b=f.createTextRange(),b.moveToElementText(g.parentNode),b.moveStart("character",
h),g=f.createTextRange(),g.moveToElementText(l.parentNode),g.moveStart("character",i),b.setEndPoint("EndToStart",g),this._ignoreSelect=!1,b.select(),this._ignoreSelect=!0},_setDOMFullSelection:function(b,a,c,d,e){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",!(b===d&&a===e))){var f=this._model,g=this._getViewPadding(),h=this._clientDiv.getBoundingClientRect(),
l=this._viewDiv.getBoundingClientRect(),c=l.left+g.left,i=h.right,g=l.top+g.top,m=h.bottom,l=h=0;this._clipDiv?(l=this._clipDiv.getBoundingClientRect(),h=l.left-this._clipDiv.scrollLeft):(l=this._rootDiv.getBoundingClientRect(),h=l.left);l=l.top;this._ignoreDOMSelection=!0;var o=(new p(this,b.lineIndex,b)).getBoundingClientRect(f.getLineStart(b.lineIndex)+a,!1),j=o.left,a=(new p(this,d.lineIndex,d)).getBoundingClientRect(f.getLineStart(d.lineIndex)+e,!1),f=a.left;this._ignoreDOMSelection=!1;var s=
this._selDiv1,j=Math.min(i,Math.max(c,j)),q=Math.min(m,Math.max(g,o.top)),u=i,e=Math.min(m,Math.max(g,o.bottom));s.style.left=j-h+"px";s.style.top=q-l+"px";s.style.width=Math.max(0,u-j)+"px";s.style.height=Math.max(0,e-q)+"px";if(b.lineIndex===d.lineIndex)u=Math.min(f,i),s.style.width=Math.max(0,u-j)+"px";else if(o=Math.min(m,Math.max(g,a.top)),f=Math.min(i,Math.max(c,f)),g=Math.min(m,Math.max(g,a.bottom)),m=this._selDiv3,m.style.left=c-h+"px",m.style.top=o-l+"px",m.style.width=Math.max(0,f-c)+"px",
m.style.height=Math.max(0,g-o)+"px",Math.abs(b.lineIndex-d.lineIndex)>1)b=this._selDiv2,b.style.left=c-h+"px",b.style.top=e-l+"px",b.style.width=Math.max(0,i-c)+"px",b.style.height=Math.max(0,o-e)+"px"}},_setGrab:function(b){if(b!==this._grabControl)b?(b.setCapture&&b.setCapture(),this._grabControl=b):(this._grabControl.releaseCapture&&this._grabControl.releaseCapture(),this._grabControl=null)},_setLinksVisible:function(b){if(this._linksVisible!==b){this._linksVisible=b;if(e.isIE&&b)this._hadFocus=
this._hasFocus;var a=this._clientDiv;a.contentEditable=!b;this._hadFocus&&!b&&a.focus();if(this._overlayDiv)this._overlayDiv.style.zIndex=b?"-1":"1";for(b=this._getLineNext();b;){if(b.hasLink)for(a=b.firstChild;a;)if(a.ignore)a=a.nextSibling;else{var c=a.nextSibling,d=a.viewStyle;d&&d.tagName&&d.tagName.toLowerCase()==="a"&&b.replaceChild(b._line._createSpan(b,a.firstChild.data,d),a);a=c}b=this._getLineNext(b)}this._updateDOMSelection()}},_setSelection:function(b,a,c,d,e){if(b){this._columnX=-1;c===
void 0&&(c=!0);var f=this._selection;this._selection=b;a!==!1&&this._showCaret(!1,d,a,e);c&&this._updateDOMSelection();if(!f.equals(b))this.onSelection({type:"Selection",oldValue:{start:f.start,end:f.end},newValue:{start:b.start,end:b.end}})}},_setSelectionTo:function(b,a,c,d){var e=this._model,f=this._getSelection(),a=this.convert({x:b,y:a},"page","document"),b=this._getLineIndex(a.y);if(this._clickCount===1){e=this._getLine(b);b=e.getOffset(a.x,a.y-this._getLinePixel(b));e.destroy();if(d&&!c&&f.start<=
b&&b<f.end)return this._dragOffset=b,!1;f.extend(b);c||f.collapse()}else(this._clickCount&1)===0?(e=this._getLine(b),b=e.getOffset(a.x,a.y-this._getLinePixel(b)),this._doubleClickSelection?b>=this._doubleClickSelection.start?(c=this._doubleClickSelection.start,d=e.getNextOffset(b,{unit:"wordend",count:1})):(c=e.getNextOffset(b,{unit:"word",count:-1}),d=this._doubleClickSelection.end):(c=e.getNextOffset(b,{unit:"word",count:-1}),d=e.getNextOffset(c,{unit:"wordend",count:1})),e.destroy()):this._doubleClickSelection?
(d=e.getLineAtOffset(this._doubleClickSelection.start),b>=d?(c=e.getLineStart(d),d=e.getLineEnd(b)):(c=e.getLineStart(b),d=e.getLineEnd(d))):(c=e.getLineStart(b),d=e.getLineEnd(b)),f.setCaret(c),f.extend(d);this._setSelection(f,!0,!0);return!0},_setFullSelection:function(b,a){this._fullSelection=b;if(e.isWebkit)this._fullSelection=!0;var c=this._clipDiv||this._rootDiv;if(c)if(this._fullSelection){if(!this._selDiv1&&this._fullSelection&&!e.isIOS){var d=c.ownerDocument;this._highlightRGB=e.isWebkit?
"transparent":"Highlight";var f=e.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";c.appendChild(f);var g=e.createElement(d,"div");this._selDiv2=g;g.style.position="absolute";g.style.borderWidth="0px";g.style.margin="0px";g.style.padding="0px";g.style.outline="none";g.style.background=this._highlightRGB;
g.style.width="0px";g.style.height="0px";g.style.zIndex="0";c.appendChild(g);this._selDiv3=d=e.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";c.appendChild(d);if(e.isFirefox&&e.isMac){c=this._getWindow().getComputedStyle(d,null).getPropertyValue("background-color");switch(c){case "rgb(119, 141, 168)":c="rgb(199, 208, 218)";
break;case "rgb(127, 127, 127)":c="rgb(198, 198, 198)";break;case "rgb(255, 193, 31)":c="rgb(250, 236, 115)";break;case "rgb(243, 70, 72)":c="rgb(255, 176, 139)";break;case "rgb(255, 138, 34)":c="rgb(255, 209, 129)";break;case "rgb(102, 197, 71)":c="rgb(194, 249, 144)";break;case "rgb(140, 78, 184)":c="rgb(232, 184, 255)";break;default:c="rgb(180, 213, 255)"}this._highlightRGB=c;f.style.background=c;g.style.background=c;d.style.background=c}a||this._updateDOMSelection()}}else{if(this._selDiv1)c.removeChild(this._selDiv1),
this._selDiv1=null;if(this._selDiv2)c.removeChild(this._selDiv2),this._selDiv2=null;if(this._selDiv3)c.removeChild(this._selDiv3),this._selDiv3=null}},_setBlockCursor:function(b){this._blockCursorVisible=b;this._updateBlockCursorVisible()},_setOverwriteMode:function(b){this._overwriteMode=b;this._updateBlockCursorVisible()},_updateBlockCursorVisible:function(){if(this._blockCursorVisible||this._overwriteMode){if(!this._cursorDiv){var b=e.createElement(document,"div");b.className="textviewBlockCursor";
this._cursorDiv=b;b.tabIndex=-1;b.style.zIndex="2";b.style.color="transparent";b.style.position="absolute";b.style.pointerEvents="none";b.innerHTML="&nbsp;";this._viewDiv.appendChild(b);this._updateDOMSelection()}}else if(this._cursorDiv)this._cursorDiv.parentNode.removeChild(this._cursorDiv),this._cursorDiv=null},_setMarginOffset:function(b,a){this._marginOffset=b;this._marginDiv.style.display=b?"block":"none";if(!a)this._metrics=this._calculateMetrics(),this._queueUpdate()},_setWrapOffset:function(b,
a){this._wrapOffset=b;if(!a)this._metrics=this._calculateMetrics(),this._queueUpdate()},_setReadOnly:function(b){this._readonly=b;this._clientDiv.setAttribute("aria-readonly",b?"true":"false")},_setSingleMode:function(b,a){this._singleMode=b;this._updateOverflow();this._updateStyle(a)},_setTabSize:function(b,a){this._tabSize=b;this._customTabSize=void 0;var c=this._clientDiv;if(e.isOpera){if(c)c.style.OTabSize=this._tabSize+""}else if(e.isWebkit>=537.1){if(c)c.style.tabSize=this._tabSize+""}else if(e.isFirefox>=
4){if(c)c.style.MozTabSize=this._tabSize+""}else if(this._tabSize!==8)this._customTabSize=this._tabSize;a||(this.redrawLines(),this._resetLineWidth())},_setTheme:function(b){this._theme&&this._theme.removeEventListener("ThemeChanged",this._themeListener.onChanged);(this._theme=b)&&this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);this._setThemeClass(this._themeClass)},_setThemeClass:function(b,a){this._themeClass=b;var c="textview",d=this._theme.getThemeClass();d&&(c+=" "+
d);this._themeClass&&d!==this._themeClass&&(c+=" "+this._themeClass);this._rootDiv.className=c;this._updateStyle(a)},_setWrapMode:function(b,a){this._wrapMode=b&&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();a||(this.redraw(),this._resetLineWidth());this._resetLineHeight()},_showCaret:function(b,a,c,d){if(this._clientDiv){var e=this._model,f=this._getSelection(),
g=this._getScroll(),h=f.getCaret(),l=f.start,i=f.end,m=e.getLineAtOffset(i),o=Math.max(Math.max(l,e.getLineStart(m)),i-1),e=this._getClientWidth(),m=this._getClientHeight(),j=e/4,p=this._getBoundsAtOffset(h===l?l:o),s=p.left,q=p.right,u=p.top,k=p.bottom;b&&!f.isEmpty()&&(p=this._getBoundsAtOffset(h===i?l:o),p.top===u?h===l?q=s+Math.min(p.right-s,e):s=q-Math.min(q-p.left,e):h===l?k=u+Math.min(p.bottom-u,m):u=k-Math.min(k-p.top,m));b=0;s<g.x&&(b=Math.min(s-g.x,-j));q>g.x+e&&(b=Math.max(q-g.x-e,j));
f=0;u<g.y?f=u-g.y:k>g.y+m&&(f=k-g.y-m);d&&(d>0?f>0&&(f=Math.max(f,d)):f<0&&(f=Math.min(f,d)));if(b!==0||f!==0)return f!==0&&typeof c==="number"&&(c<0&&(c=0),c>1&&(c=1),f+=Math.floor(f>0?c*m:-c*m)),this._scrollViewAnimated(b,f,a),m!==this._getClientHeight()||e!==this._getClientWidth()?this._showCaret():this._ensureCaretVisible=!0,!0;else a&&a();return!1}},_startIME:function(){if(this._imeOffset===-1){var b=this._getSelection();b.isEmpty()||this._modifyContent({text:"",start:b.start,end:b.end},!0);
this._imeOffset=b.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 b=0;b<this._handlers.length;b++){var a=this._handlers[b];u(a.target,a.type,a.handler)}this._handlers=null;if(this._mutationObserver)this._mutationObserver.disconnect(),this._mutationObserver=
null},_updateDOMSelection:function(){if(!(this._redrawCount>0)&&!this._ignoreDOMSelection&&this._clientDiv){var b=this._getSelection(),a=this._model,c=a.getLineAtOffset(b.start),d=a.getLineAtOffset(b.end),e=this._getLineNext();if(e){var f=this._getLinePrevious(),g;c<e.lineIndex?(g=e,c=0):c>f.lineIndex?(g=f,c=0):(g=this._getLineNode(c),c=b.start-a.getLineStart(c));d<e.lineIndex?a=0:d>f.lineIndex?(e=f,a=0):(e=this._getLineNode(d),a=b.end-a.getLineStart(d));this._setDOMSelection(g,c,e,a,b.caret)}}},
_update:function(b){if(!(this._redrawCount>0)){if(this._updateTimer)this._getWindow().clearTimeout(this._updateTimer),this._updateTimer=null,b=!1;var a=this._clientDiv,c=this._viewDiv;if(a){if(this._metrics.invalid)this._ignoreQueueUpdate=!0,this._updateStyle(),this._ignoreQueueUpdate=!1;var d=this._model,f=this._getScroll(!1),g=this._getViewPadding(),h=d.getLineCount(),l=this._getLineHeight(),i=!1,m=!1,o=!1,j=this._metrics.scrollWidth;if(this._wrapMode)a.style.width=(this._metrics.wrapWidth||this._getClientWidth())+
"px";var s,q,u,k,v=0,r=0,t;if(this._lineHeight){for(;r<h;){t=this._getLineHeight(r);if(v+t>f.y)break;v+=t;r++}s=r;q=Math.max(0,s-1);u=d=f.y-v;s>0&&(d+=this._getLineHeight(s-1))}else k=Math.max(0,f.y)/l,s=Math.floor(k),q=Math.max(0,s-1),d=Math.round((k-q)*l),u=Math.round((k-s)*l);this._topIndexY=u;k=this._rootDiv;var K=k.clientWidth,L=k.clientHeight;if(b){l=0;this._leftDiv&&(s=this._leftDiv.getBoundingClientRect(),l=s.right-s.left);s=this._getClientWidth();k=this._getClientHeight();m=s;if(this._wrapMode){if(this._metrics.wrapWidth)m=
this._metrics.wrapWidth}else m=Math.max(this._maxLineWidth,m);for(;r<h;)t=this._getLineHeight(r,!1),v+=t,r++;h=v}else{k=this._getClientHeight();u=Math.min(s+Math.floor((k+u)/l),h-1);var f=Math.min(u+1,h-1),A;for(t=a.firstChild;t;){A=t.lineIndex;var I=t.nextSibling;if(!(q<=A&&A<=f)||t.lineRemoved||t.lineIndex===-1)this._mouseWheelLine===t?(t.style.display="none",t.lineIndex=-1):a.removeChild(t);t=I}t=this._getLineNext();var I=c.ownerDocument,N=I.createDocumentFragment();for(A=q;A<=f;A++)if(!t||t.lineIndex>
A)(new p(this,A)).create(N,null);else{N.firstChild&&(a.insertBefore(N,t),N=I.createDocumentFragment());if(t&&t.lineChanged)t=(new p(this,A)).create(N,t),t.lineChanged=!1;t=this._getLineNext(t)}N.firstChild&&a.insertBefore(N,t);if(e.isWebkit&&!this._wrapMode)a.style.width="0x7fffffffpx";t=this._getLineNext();A=k+d;for(N=!1;t;){q=t.lineWidth;if(q===void 0)if(I=t._line.getBoundingClientRect(),q=t.lineWidth=Math.ceil(I.right-I.left),I=I.bottom-I.top,this._lineHeight)this._lineHeight[t.lineIndex]=I;else if(l!==
0&&I!==0&&Math.ceil(l)!==Math.ceil(I))this._variableLineHeight=!0,this._lineHeight=[],this._lineHeight[t.lineIndex]=I;if(this._lineHeight&&!N&&(A-=this._lineHeight[t.lineIndex],A<0))u=t.lineIndex,N=!0;if(!this._wrapMode){if(q>=this._maxLineWidth)this._maxLineWidth=q,this._maxLineIndex=t.lineIndex;if(this._checkMaxLineIndex===t.lineIndex)this._checkMaxLineIndex=-1}if(t.lineIndex===s)this._topChild=t;if(t.lineIndex===u)this._bottomChild=t;t=this._getLineNext(t)}if(this._checkMaxLineIndex!==-1&&(A=this._checkMaxLineIndex,
this._checkMaxLineIndex=-1,0<=A&&A<h)){l=new p(this,A);I=l.getBoundingClientRect();q=I.right-I.left;if(q>=this._maxLineWidth)this._maxLineWidth=q,this._maxLineIndex=A;l.destroy()}for(;r<h;)t=this._getLineHeight(r,r<=u),v+=t,r++;h=v;this._updateRuler(this._leftDiv,s,f,L);this._updateRuler(this._rightDiv,s,f,L);this._updateRuler(this._marginDiv,s,f,L);l=0;this._leftDiv&&(s=this._leftDiv.getBoundingClientRect(),l=s.right-s.left);f=0;this._rightDiv&&(f=this._rightDiv.getBoundingClientRect(),f=f.right-
f.left);c.style.left=l+"px";c.style.right=f+"px";f=this._scrollDiv;f.style.height=h+"px";s=this._getClientWidth();if(!this._singleMode&&!this._wrapMode){v=i=k;(r=c.style.overflowX==="scroll")?i+=j:v-=j;t=u=s;(q=c.style.overflowY==="scroll")?u+=j:t-=j;k=i;s=u;h>k&&(o=!0,s=t);this._maxLineWidth>s&&(m=!0,k=v,h>k&&(o=!0,s=t));if(r!==m)c.style.overflowX=m?"scroll":"hidden";if(q!==o)c.style.overflowY=o?"scroll":"hidden";i=r!==m||q!==o}o=s;if(this._wrapMode){if(this._metrics.wrapWidth)o=this._metrics.wrapWidth}else o=
Math.max(this._maxLineWidth,o);m=o;if((!e.isIE||e.isIE>=9)&&this._maxLineWidth>s)o+=g.right+g.left;f.style.width=o+"px";if(this._clipScrollDiv)this._clipScrollDiv.style.width=o+"px";f=this._getScroll(!1)}if(this._vScrollDiv)o=k-8,v=Math.max(15,Math.ceil(Math.min(1,o/(h+g.top+g.bottom))*o)),this._vScrollDiv.style.left=l+s-8+"px",this._vScrollDiv.style.top=Math.floor(Math.max(0,f.y*o/h))+"px",this._vScrollDiv.style.height=v+"px";if(!this._wrapMode&&this._hScrollDiv)o=s-8,v=Math.max(15,Math.ceil(Math.min(1,
o/(this._maxLineWidth+g.left+g.right))*o)),this._hScrollDiv.style.left=l+Math.floor(Math.max(0,Math.floor(f.x*o/this._maxLineWidth)))+"px",this._hScrollDiv.style.top=k-9+"px",this._hScrollDiv.style.width=v+"px";r=f.x;v=this._clipDiv;o=this._overlayDiv;if(u=this._marginDiv)u.style.left=-r+l+this._metrics.marginWidth+g.left+"px",u.style.bottom=(c.style.overflowX==="scroll"?j:0)+"px";if(v){v.scrollLeft=r;v.scrollTop=0;c=l+g.left;j=g.top;b=s;l=k;r=0;u=-d;if(f.x===0)c-=g.left,b+=g.left,r=g.left;f.x+s===
m&&(b+=g.right);f.y===0&&(j-=g.top,l+=g.top,u+=g.top);f.y+k===h&&(l+=g.bottom);v.style.left=c+"px";v.style.top=j+"px";v.style.right=K-b-c+"px";v.style.bottom=L-l-j+"px";a.style.left=r+"px";a.style.top=u+"px";a.style.width=m+"px";a.style.height=k+d+"px";if(o)o.style.left=a.style.left,o.style.top=a.style.top,o.style.width=a.style.width,o.style.height=a.style.height}else{c=r;j=d;K=r+s;L=d+k;c===0&&(c-=g.left);j===0&&(j-=g.top);K===m&&(K+=g.right);f.y+k===h&&(L+=g.bottom);a.style.clip="rect("+j+"px,"+
K+"px,"+L+"px,"+c+"px)";a.style.left=-r+l+g.left+"px";a.style.width=(this._wrapMode||e.isWebkit?m:s+r)+"px";if(!b)a.style.top=-d+g.top+"px",a.style.height=k+d+"px";if(o&&(o.style.clip=a.style.clip,o.style.left=a.style.left,o.style.width=a.style.width,!b))o.style.top=a.style.top,o.style.height=a.style.height}this._updateDOMSelection();if(i)a=this._ensureCaretVisible,this._ensureCaretVisible=!1,a&&this._showCaret(),this._queueUpdate()}}},_updateOverflow:function(){var b=this._viewDiv;this._wrapMode?
(b.style.overflowX="hidden",b.style.overflowY="scroll"):b.style.overflow="hidden"},_updateRuler:function(b,a,c,d){if(b)for(var g=this._parent.ownerDocument,h=this._getLineHeight(),l=this._getViewPadding(),b=b.firstChild;b;){var i=b._ruler,m=h,o=i.getOverview();o==="page"&&(m+=this._topIndexY);b.style.top=-m+"px";b.style.height=d+m+"px";b.rulerChanged&&f(i.getRulerStyle(),b);var j,p=b.firstChild;p?(j=p,p=p.nextSibling):(j=e.createElement(g,"div"),j.style.visibility="hidden",b.appendChild(j));var s;
if(b.rulerChanged&&j){m=-1;if(s=i.getWidestAnnotation())if(f(s.style,j),s.html)j.innerHTML=s.html;j.lineIndex=m;j.style.height=h+l.top+"px"}var q;if(o==="page"){for(i=i.getAnnotations(a,c+1);p;)m=p.lineIndex,s=p.nextSibling,(!(a<=m&&m<=c)||p.lineChanged)&&b.removeChild(p),p=s;p=b.firstChild.nextSibling;q=g.createDocumentFragment();for(m=a;m<=c;m++)if(!p||p.lineIndex>m){j=e.createElement(g,"div");if(s=i[m]){f(s.style,j);if(s.html)j.innerHTML=s.html;j.annotation=s}j.lineIndex=m;j.style.height=this._getLineHeight(m)+
"px";q.appendChild(j)}else if(q.firstChild&&(b.insertBefore(q,p),q=g.createDocumentFragment()),p)p=p.nextSibling;q.firstChild&&b.insertBefore(q,p)}else{s=this._getClientHeight();m=this._model.getLineCount();p=s+l.top+l.bottom-2*this._metrics.scrollWidth;o=h*m<p?h:p/m;if(b.rulerChanged){for(s=b.childNodes.length;s>1;)b.removeChild(b.lastChild),s--;i=i.getAnnotations(0,m);q=g.createDocumentFragment();for(var u in i)if(m=u>>>0,!(m<0)){j=e.createElement(g,"div");s=i[u];f(s.style,j);j.style.position="absolute";
j.style.top=this._metrics.scrollWidth+h+Math.floor(m*o)+"px";if(s.html)j.innerHTML=s.html;j.annotation=s;j.lineIndex=m;q.appendChild(j)}b.appendChild(q)}else if(b._oldTrackHeight!==p)for(j=b.firstChild?b.firstChild.nextSibling:null;j;)j.style.top=this._metrics.scrollWidth+h+Math.floor(j.lineIndex*o)+"px",j=j.nextSibling;b._oldTrackHeight=p}b.rulerChanged=!1;b=b.nextSibling}},_updateStyleSheet:function(){var b="";e.isWebkit&&this._metrics.scrollWidth>0&&(b+="\n.textview ::-webkit-scrollbar-corner {background: #eeeeee;}");
e.isFirefox&&e.isMac&&this._highlightRGB&&this._highlightRGB!=="Highlight"&&(b+="\n.textview ::-moz-selection {background: "+this._highlightRGB+";}");if(b){var a=document.getElementById("_textviewStyle");if(a)a.removeChild(a.firstChild),a.appendChild(document.createTextNode(b));else{a=e.createElement(document,"style");a.id="_textviewStyle";var c=document.getElementsByTagName("head")[0]||document.documentElement;a.appendChild(document.createTextNode(b));c.insertBefore(a,c.firstChild)}}},_updateStyle:function(b){if(!b&&
e.isIE)this._rootDiv.style.lineHeight="normal";var a=this._metrics=this._calculateMetrics();this._rootDiv.style.lineHeight=e.isIE?a.lineHeight-(a.lineTrim.top+a.lineTrim.bottom)+"px":"normal";this._updateStyleSheet();b||(this.redraw(),this._resetLineWidth())}};h.EventTarget.addMixin(t.prototype);return{TextView:t}});
define("orion/editor/projectionTextModel",["orion/editor/textModel","orion/editor/eventTarget"],function(i,k){function j(h){this._model=h;this._projections=[];var a=this;this._listener={onChanged:function(g){a._onChanged(g)},onChanging:function(g){a._onChanging(g)}};h.addEventListener("postChanged",this._listener.onChanged);h.addEventListener("preChanging",this._listener.onChanging)}j.prototype={destroy:function(){if(this._model)this._model.removeEventListener("postChanged",this._listener.onChanged),
this._model.removeEventListener("preChanging",this._listener.onChanging),this._model=null},addProjection:function(h){if(h){var a=this._model,g=this._projections;h._lineIndex=a.getLineAtOffset(h.start);h._lineCount=a.getLineAtOffset(h.end)-h._lineIndex;var e=h.text;e||(e="");h._model=typeof e==="string"?new i.TextModel(e,a.getLineDelimiter()):e;var a=this.mapOffset(h.start,!0),e=h.end-h.start,f=h._lineCount,d=h._model.getCharCount(),c=h._model.getLineCount()-1;this.onChanging({type:"Changing",text:h._model.getText(),
start:a,removedCharCount:e,addedCharCount:d,removedLineCount:f,addedLineCount:c});var b=this._binarySearch(g,h.start);g.splice(b,0,h);this.onChanged({type:"Changed",start:a,removedCharCount:e,addedCharCount:d,removedLineCount:f,addedLineCount:c})}},getProjections:function(){return this._projections.slice(0)},getBaseModel:function(){return this._model},mapOffset:function(h,a){var g=this._projections,e=0,f,d;if(a){for(f=0;f<g.length;f++){d=g[f];if(d.start>h)break;if(d.end>h)return-1;e+=d._model.getCharCount()-
(d.end-d.start)}return h+e}for(f=0;f<g.length;f++){d=g[f];if(d.start>h-e)break;var c=d._model.getCharCount();if(d.start+c>h-e)return-1;e+=c-(d.end-d.start)}return h-e},removeProjection:function(h){var a,g=0;for(a=0;a<this._projections.length;a++){var e=this._projections[a];if(e===h){h=e;break}g+=e._model.getCharCount()-(e.end-e.start)}if(a<this._projections.length){var e=this._model,g=h.start+g,f=h.end-h.start,d=h._lineCount,c=h._model.getCharCount(),b=h._model.getLineCount()-1;this.onChanging({type:"Changing",
text:e.getText(h.start,h.end),start:g,removedCharCount:c,addedCharCount:f,removedLineCount:b,addedLineCount:d});this._projections.splice(a,1);this.onChanged({type:"Changed",start:g,removedCharCount:c,addedCharCount:f,removedLineCount:b,addedLineCount:d})}},_binarySearch:function(h,a){for(var g=h.length,e=-1,f;g-e>1;)f=Math.floor((g+e)/2),a<=h[f].start?g=f:e=f;return g},getCharCount:function(){for(var h=this._model.getCharCount(),a=this._projections,g=0;g<a.length;g++){var e=a[g];h+=e._model.getCharCount()-
(e.end-e.start)}return h},getLine:function(h,a){if(h<0)return null;var g=this._model,e=this._projections,f=0,d=[],c=0,b,l,i;for(b=0;b<e.length;b++){i=e[b];if(i._lineIndex>=h-f)break;l=i._model.getLineCount()-1;if(i._lineIndex+l>=h-f)if(c=h-(i._lineIndex+f),c<l)return i._model.getLine(c,a);else d.push(i._model.getLine(l));c=i.end;f+=l-i._lineCount}for(c=Math.max(c,g.getLineStart(h-f));b<e.length;b++){i=e[b];if(i._lineIndex>h-f)break;d.push(g.getText(c,i.start));l=i._model.getLineCount()-1;if(i._lineIndex+
l>h-f)return d.push(i._model.getLine(0,a)),d.join("");d.push(i._model.getText());c=i.end;f+=l-i._lineCount}e=g.getLineEnd(h-f,a);c<e&&d.push(g.getText(c,e));return d.join("")},getLineAtOffset:function(h){for(var a=this._model,g=this._projections,e=0,f=0,d=0;d<g.length;d++){var c=g[d];if(c.start>h-e)break;var b=c._model.getCharCount();if(c.start+b>h-e){g=h-(c.start+e);f+=c._model.getLineAtOffset(g);e+=g;break}f+=c._model.getLineCount()-1-c._lineCount;e+=b-(c.end-c.start)}return a.getLineAtOffset(h-
e)+f},getLineCount:function(){for(var h=this._projections,a=this._model.getLineCount(),g=0;g<h.length;g++){var e=h[g];a+=e._model.getLineCount()-1-e._lineCount}return a},getLineDelimiter:function(){return this._model.getLineDelimiter()},getLineEnd:function(h,a){if(h<0)return-1;for(var g=this._model,e=this._projections,f=0,d=0,c=0;c<e.length;c++){var b=e[c];if(b._lineIndex>h-f)break;var l=b._model.getLineCount()-1;if(b._lineIndex+l>h-f)return b._model.getLineEnd(h-(b._lineIndex+f),a)+b.start+d;d+=
b._model.getCharCount()-(b.end-b.start);f+=l-b._lineCount}return g.getLineEnd(h-f,a)+d},getLineStart:function(h){if(h<0)return-1;for(var a=this._model,g=this._projections,e=0,f=0,d=0;d<g.length;d++){var c=g[d];if(c._lineIndex>=h-e)break;var b=c._model.getLineCount()-1;if(c._lineIndex+b>=h-e)return c._model.getLineStart(h-(c._lineIndex+e))+c.start+f;f+=c._model.getCharCount()-(c.end-c.start);e+=b-c._lineCount}return a.getLineStart(h-e)+f},getText:function(h,a){h===void 0&&(h=0);var g=this._model,e=
this._projections,f=0,d=[],c,b,l;for(c=0;c<e.length;c++){b=e[c];if(b.start>h-f)break;l=b._model.getCharCount();if(b.start+l>h-f)if(a!==void 0&&b.start+l>a-f)return b._model.getText(h-(b.start+f),a-(b.start+f));else d.push(b._model.getText(h-(b.start+f))),h=b.end+f+l-(b.end-b.start);f+=l-(b.end-b.start)}var i=h-f;if(a!==void 0){for(;c<e.length;c++){b=e[c];if(b.start>a-f)break;d.push(g.getText(i,b.start));l=b._model.getCharCount();if(b.start+l>a-f)return d.push(b._model.getText(0,a-(b.start+f))),d.join("");
d.push(b._model.getText());i=b.end;f+=l-(b.end-b.start)}d.push(g.getText(i,a-f))}else{for(;c<e.length;c++)b=e[c],d.push(g.getText(i,b.start)),d.push(b._model.getText()),i=b.end;d.push(g.getText(i))}return d.join("")},_onChanged:function(){var h=this._change,a=h.baseStart,g=h.baseEnd,e,f,d=this._projections;for(e=0;e<d.length;e++)if(f=d[e],f.end>a)break;var c=e;for(e=0;e<d.length;e++)if(f=d[e],f.start>=g)break;var b=e,l=this._model,a=h.baseText.length-(g-a);for(e=b;e<d.length;e++)f=d[e],f.start+=a,
f.end+=a,f._lineIndex=l.getLineAtOffset(f.start);f=d.splice(c,b-c);for(e=0;e<f.length;e++)f[e].annotation&&f[e].annotation._expand();this.onChanged({type:"Changed",start:h.start,removedCharCount:h.removedCharCount,addedCharCount:h.addedCharCount,removedLineCount:h.removedLineCount,addedLineCount:h.addedLineCount});this._change=void 0},_onChanging:function(h){var a=!!this._change,g=this._change||{},e=h.start,f=e+h.removedCharCount;g.baseStart=e;g.baseEnd=f;g.baseText=h.text;g.addedLineCount=h.addedLineCount;
if(!a){this._change=g;g.text=h.text;var d=this._projections,c,b,l,h=function(a){for(b=0,c=0;b<d.length;b++){l=d[b];if(l.start>a)break;if(l.end>a)return-1;c+=l._model.getCharCount()-(l.end-l.start)}return a+c};g.start=h(e);if(g.start===-1)g.text=this._model.getText(l.start,e)+g.text,g.addedLineCount+=this._model.getLineAtOffset(e)-this._model.getLineAtOffset(l.start),g.start=l.start+c;g.end=h(f);if(g.end===-1)g.text+=this._model.getText(f,l.end),g.addedLineCount+=this._model.getLineAtOffset(l.end)-
this._model.getLineAtOffset(f),g.end=l.start+c}g.addedCharCount=g.text.length;g.removedCharCount=g.end-g.start;g.removedLineCount=this.getLineAtOffset(g.end)-this.getLineAtOffset(g.start);this.onChanging({type:"Changing",text:g.text,start:g.start,removedCharCount:g.removedCharCount,addedCharCount:g.addedCharCount,removedLineCount:g.removedLineCount,addedLineCount:g.addedLineCount})},onChanging:function(h){return this.dispatchEvent(h)},onChanged:function(h){return this.dispatchEvent(h)},setLineDelimiter:function(h){this._model.setLineDelimiter(h)},
setText:function(h,a,g){function e(a){for(c=0,d=0;c<f.length;c++){b=f[c];if(b.start>a-d)break;var e=b._model.getCharCount();if(b.start+e>a-d)return-1;d+=e-(b.end-b.start)}return a-d}this._change={text:h||"",start:a||0,end:g===void 0?this.getCharCount():g};var f=this._projections,d,c,b,l,i,h=e(this._change.start);if(h===-1)l={projection:b,start:this._change.start-(b.start+d)},h=b.end;a=e(this._change.end);if(a===-1)i={projection:b,end:this._change.end-(b.start+d)},a=b.start;if(l&&i&&l.projection===
i.projection)b._model.setText(this._change.text,l.start,i.end);else{this._model.setText(this._change.text,h,a);if(l)b=l.projection,b._model.setText("",l.start);if(i)b=i.projection,b._model.setText("",0,i.end),b.start=b.end,b._lineCount=0}this._change=void 0}};k.EventTarget.addMixin(j.prototype);return{ProjectionTextModel:j}});
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(i,k,j,h,a,g){function e(a){this._view=a;this._fadeDelay=500;this._hideDelay=200;this._showDelay=500;this._autoHideDelay=5E3;this._create(a.getOptions("parent").ownerDocument)}e.getTooltip=function(a){if(!a._tooltip)a._tooltip=new e(a);return a._tooltip};e.prototype={_create:function(e){if(!this._tooltipDiv){var d=
this._tooltipDiv=g.createElement(e,"div");d.tabIndex=0;d.className="textviewTooltip";d.setAttribute("aria-live","assertive");d.setAttribute("aria-atomic","true");var c=this._tooltipContents=g.createElement(e,"div");d.appendChild(c);e.body.appendChild(d);var b=this;a.addEventListener(d,"mouseover",function(){if(b._hideDelay){var a=b._getWindow();if(b._delayedHideTimeout)a.clearTimeout(b._delayedHideTimeout),b._delayedHideTimeout=null;if(b._hideTimeout)a.clearTimeout(b._hideTimeout),b._hideTimeout=
null;b._nextTarget=null}},!1);a.addEventListener(d,"mouseout",function(c){c=c.relatedTarget||c.toElement;c===d||b._hasFocus()||(!c||!a.contains(d,c))&&b._hide()},!1);a.addEventListener(d,"keydown",function(a){a.keyCode===27&&b._hide()},!1);a.addEventListener(e,"mousedown",this._mouseDownHandler=function(c){b.isVisible()&&(a.contains(d,c.target||c.srcElement)||b._hide())},!0);this._view.addEventListener("Destroy",function(){b.destroy()});this._hide()}},_getWindow:function(){var a=this._tooltipDiv.ownerDocument;
return a.defaultView||a.parentWindow},destroy:function(){if(this._tooltipDiv){this._hide();var e=this._tooltipDiv.parentNode;e&&e.removeChild(this._tooltipDiv);a.removeEventListener(this._tooltipDiv.ownerDocument,"mousedown",this._mouseDownHandler,!0);this._tooltipDiv=null}},_hasFocus:function(){var e=this._tooltipDiv;return!e?!1:a.contains(e,e.ownerDocument.activeElement)},hide:function(a){if(a===void 0)a=this._hideDelay;var d=this._getWindow();if(this._delayedHideTimeout)d.clearTimeout(this._delayedHideTimeout),
this._delayedHideTimeout=null;var c=this;a?c._delayedHideTimeout=d.setTimeout(function(){c._delayedHideTimeout=null;c._hide();c.setTarget(c._nextTarget,0)},a):(c._hide(),c.setTarget(c._nextTarget,0))},_hide:function(){var a=this._tooltipDiv;if(a){this._hasFocus()&&this._view.focus();if(this._contentsView)this._contentsView.destroy(),this._contentsView=null;if(this._tooltipContents)this._tooltipContents.innerHTML="";a.style.visibility="hidden";a=this._getWindow();if(this._showTimeout)a.clearTimeout(this._showTimeout),
this._showTimeout=null;if(this._delayedHideTimeout)a.clearTimeout(this._delayedHideTimeout),this._delayedHideTimeout=null;if(this._hideTimeout)a.clearTimeout(this._hideTimeout),this._hideTimeout=null;if(this._fadeTimeout)a.clearInterval(this._fadeTimeout),this._fadeTimeout=null}},isVisible:function(){return this._tooltipDiv&&this._tooltipDiv.style.visibility==="visible"},setTarget:function(a,d,c){if(this.isVisible()){if(!this._hasFocus())this._nextTarget=a,this.hide(c)}else if(this._target=a){var b=
this,a=b._getWindow();if(b._showTimeout)a.clearTimeout(b._showTimeout),b._showTimeout=null;d===0?b.show(!0):b._showTimeout=a.setTimeout(function(){b._showTimeout=null;b.show(!0)},d?d:b._showDelay)}},show:function(a){if(this._target){var d=this._target.getTooltipInfo();if(d){var c=this._tooltipDiv,b=this._tooltipContents;c.style.left=c.style.right=c.style.width=c.style.height=b.style.width=b.style.height="auto";var e=d.contents;e instanceof Array&&(e=this._getAnnotationContents(e));if(typeof e==="string")b.innerHTML=
e;else if(this._isNode(e))b.appendChild(e);else if(e instanceof h.ProjectionTextModel){var g=this._view,i=g.getOptions();i.wrapMode=!1;i.parent=b;var o=i.themeClass;o?((o=o.replace("tooltipTheme",""))&&(o=" "+o),o="tooltipTheme"+o):o="tooltipTheme";i.themeClass=o;i=this._contentsView=new k.TextView(i);i.addEventListener("LineStyle",function(b){g.onLineStyle(b)});i.setModel(e);e=i.computeSize();b.style.width=e.width+"px";b.style.height=e.height+"px";i.resize()}else return;b=c.ownerDocument.documentElement;
d.anchor==="right"?(e=b.clientWidth-d.x,c.style.right=e+"px"):(e=parseInt(this._getNodeStyle(c,"padding-left","0"),10),e+=parseInt(this._getNodeStyle(c,"border-left-width","0"),10),e=d.x-e,c.style.left=e+"px");c.style.maxWidth=b.clientWidth-e-10+"px";e=parseInt(this._getNodeStyle(c,"padding-top","0"),10);e+=parseInt(this._getNodeStyle(c,"border-top-width","0"),10);e=d.y-e;c.style.top=e+"px";c.style.maxHeight=b.clientHeight-e-10+"px";c.style.opacity="1";c.style.visibility="visible";if(a){var j=this,
p=this._getWindow();j._hideTimeout=p.setTimeout(function(){j._hideTimeout=null;var b=parseFloat(j._getNodeStyle(c,"opacity","1"));j._fadeTimeout=p.setInterval(function(){c.style.visibility==="visible"&&b>0?(b-=0.1,c.style.opacity=b):j._hide()},j._fadeDelay/10)},j._autoHideDelay)}}}},_getAnnotationContents:function(e){function d(b,a){var c=k.getLineStart(k.getLineAtOffset(b)),d=k.getLineEnd(k.getLineAtOffset(a),!0);return k.getText(c,d)}function c(b){var c=b.title,e=g.createElement(o,"div");e.className=
"tooltipRow";if(b.html)e.innerHTML=b.html,e.lastChild&&a.addEventListener(e.lastChild,"click",function(){var a=b.start,c=b.end;p.getBaseModel&&(a=p.mapOffset(a,!0),c=p.mapOffset(c,!0));q.setSelection(a,c,1/3,function(){j._hide()})},!1),e.appendChild(o.createTextNode("\u00a0"));c||(c=d(b.start,b.end));typeof c==="function"&&(c=b.title());if(typeof c==="string"){var f=g.createElement(o,"span");f.appendChild(o.createTextNode(c));c=f}e.appendChild(c);return e}for(var b,l=[],m=0;m<e.length;m++)b=e[m],
b.title!==""&&!b.groupAnnotation&&l.push(b);e=l;if(e.length===0)return null;var j=this,o=this._tooltipDiv.ownerDocument,q=this._view,p=q.getModel(),k=p.getBaseModel?p.getBaseModel():p;if(e.length===1)if(b=e[0],b.title!==void 0){b=c(b);if(b.firstChild)(e=b.firstChild.className)&&(e+=" "),e+="single",b.firstChild.className=e;return b}else return e=new h.ProjectionTextModel(k),l=k.getLineStart(k.getLineAtOffset(b.start)),m=k.getCharCount(),b.end!==m&&e.addProjection({start:b.end,end:m}),l>0&&e.addProjection({start:0,
end:l}),e;else{l=g.createElement(o,"div");b=g.createElement(o,"em");b.appendChild(o.createTextNode(i.multipleAnnotations));l.appendChild(b);for(m=0;m<e.length;m++)b=e[m],(b=c(b))&&l.appendChild(b);return l}},_getNodeStyle:function(a,d,c){var b;if(a&&(b=a.style[d],!b))if(a.currentStyle){for(b=0;(b=d.indexOf("-",b))!==-1;)d=d.substring(0,b)+d.substring(b+1,b+2).toUpperCase()+d.substring(b+2);b=a.currentStyle[d]}else b=(a=a.ownerDocument.defaultView.getComputedStyle(a,null))?a.getPropertyValue(d):null;
return b||c},_isNode:function(a){return typeof Node==="object"?a instanceof Node:a&&typeof a==="object"&&typeof a.nodeType==="number"&&typeof a.nodeName==="string"}};return{Tooltip:e}});
define("orion/editor/annotations",["i18n!orion/editor/nls/messages","orion/editor/eventTarget"],function(i,k){function j(a,b,d){this.start=a;this.end=b;this._projectionModel=d;this.html=this._expandedHTML;this.style=this._expandedStyle;this.expanded=!0}function h(){}function a(a,b){var d=a.lastIndexOf("."),d=a.substring(d+1),e={title:i[d],style:{styleClass:"annotation "+d},html:"<div class='annotationHTML "+d+"'></div>",overviewStyle:{styleClass:"annotationOverview "+d}};b?e.lineStyle={styleClass:"annotationLine "+
d}:e.rangeStyle={styleClass:"annotationRange "+d};h.registerType(a,e)}function g(){}function e(a){this._annotations=[];var b=this;this._listener={onChanged:function(a){b._onChanged(a)}};this.setTextModel(a)}function f(a,b){this._view=a;this._annotationModel=b;var d=this;this._listener={onDestroy:function(b){d._onDestroy(b)},onLineStyle:function(b){d._onLineStyle(b)},onChanged:function(b){d._onAnnotationModelChanged(b)}};a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("postLineStyle",
this._listener.onLineStyle);b.addEventListener("Changed",this._listener.onChanged)}j.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)return!1;this.expanded=!1;this.html=this._collapsedHTML;this.style=this._collapsedStyle;this._annotationModel&&this._annotationModel.modifyAnnotation(this);
return!0},_expand:function(){if(this.expanded)return!1;this.expanded=!0;this.html=this._expandedHTML;this.style=this._expandedStyle;this._annotationModel&&this._annotationModel.modifyAnnotation(this);return!0},collapse:function(){if(this._collapse()){var a=this._projectionModel,b=a.getBaseModel();this._projection={annotation:this,start:b.getLineStart(b.getLineAtOffset(this.start)+1),end:b.getLineEnd(b.getLineAtOffset(this.end),!0)};a.addProjection(this._projection)}},expand:function(){this._expand()&&
this._projectionModel.removeProjection(this._projection)}};h.ANNOTATION_ERROR="orion.annotation.error";h.ANNOTATION_WARNING="orion.annotation.warning";h.ANNOTATION_TASK="orion.annotation.task";h.ANNOTATION_BREAKPOINT="orion.annotation.breakpoint";h.ANNOTATION_BOOKMARK="orion.annotation.bookmark";h.ANNOTATION_FOLDING="orion.annotation.folding";h.ANNOTATION_CURRENT_BRACKET="orion.annotation.currentBracket";h.ANNOTATION_MATCHING_BRACKET="orion.annotation.matchingBracket";h.ANNOTATION_CURRENT_LINE="orion.annotation.currentLine";
h.ANNOTATION_CURRENT_SEARCH="orion.annotation.currentSearch";h.ANNOTATION_MATCHING_SEARCH="orion.annotation.matchingSearch";h.ANNOTATION_READ_OCCURRENCE="orion.annotation.readOccurrence";h.ANNOTATION_WRITE_OCCURRENCE="orion.annotation.writeOccurrence";h.ANNOTATION_SELECTED_LINKED_GROUP="orion.annotation.selectedLinkedGroup";h.ANNOTATION_CURRENT_LINKED_GROUP="orion.annotation.currentLinkedGroup";h.ANNOTATION_LINKED_GROUP="orion.annotation.linkedGroup";h.ANNOTATION_BLAME="orion.annotation.blame";h.ANNOTATION_CURRENT_BLAME=
"orion.annotation.currentBlame";var d={};h.registerType=function(a,b){var e=b;if(typeof e!=="function")e=function(b,a,c){this.start=b;this.end=a;if(c!==void 0)this.title=c},e.prototype=b;e.prototype.type=a;d[a]=e;return a};h.createAnnotation=function(a,b,d,e){return new (this.getType(a))(b,d,e)};h.getType=function(a){return d[a]};a(h.ANNOTATION_ERROR);a(h.ANNOTATION_WARNING);a(h.ANNOTATION_TASK);a(h.ANNOTATION_BREAKPOINT);a(h.ANNOTATION_BOOKMARK);a(h.ANNOTATION_CURRENT_BRACKET);a(h.ANNOTATION_MATCHING_BRACKET);
a(h.ANNOTATION_CURRENT_SEARCH);a(h.ANNOTATION_MATCHING_SEARCH);a(h.ANNOTATION_READ_OCCURRENCE);a(h.ANNOTATION_WRITE_OCCURRENCE);a(h.ANNOTATION_SELECTED_LINKED_GROUP);a(h.ANNOTATION_CURRENT_LINKED_GROUP);a(h.ANNOTATION_LINKED_GROUP);a(h.ANNOTATION_CURRENT_LINE,!0);a(h.ANNOTATION_BLAME,!0);a(h.ANNOTATION_CURRENT_BLAME,!0);h.registerType(h.ANNOTATION_FOLDING,j);g.addMixin=function(a){var b=g.prototype,d;for(d in b)b.hasOwnProperty(d)&&(a[d]=b[d])};g.prototype={addAnnotationType:function(a){if(!this._annotationTypes)this._annotationTypes=
[];this._annotationTypes.push(a)},getAnnotationTypePriority:function(a){if(this._annotationTypes)for(var b=0;b<this._annotationTypes.length;b++)if(this._annotationTypes[b]===a)return b+1;return 0},getAnnotationsByType:function(a,b,d){a=a.getAnnotations(b,d);for(d=[];a.hasNext();)b=a.next(),this.getAnnotationTypePriority(b.type)!==0&&d.push(b);var e=this;d.sort(function(b,a){return e.getAnnotationTypePriority(b.type)-e.getAnnotationTypePriority(a.type)});return d},isAnnotationTypeVisible:function(a){return this.getAnnotationTypePriority(a)!==
0},removeAnnotationType:function(a){if(this._annotationTypes)for(var b=0;b<this._annotationTypes.length;b++)if(this._annotationTypes[b]===a){this._annotationTypes.splice(b,1);break}}};e.prototype={addAnnotation:function(a){if(a){var b=this._annotations,d=this._binarySearch(b,a.start);b.splice(d,0,a);a._annotationModel=this;this.onChanged({type:"Changed",added:[a],removed:[],changed:[]})}},getTextModel:function(){return this._model},getAnnotations:function(a,b){var d=this._annotations,e,f=0,g;g=a===
void 0&&b===void 0?function(){return f<d.length?d[f++]:null}:function(){for(;f<d.length;){var e=d[f++];if(a===e.start||(a>e.start?a<e.end:e.start<b))return e;if(e.start>=b)break}return null};e=g();return{next:function(){var b=e;b&&(e=g());return b},hasNext:function(){return e!==null}}},modifyAnnotation:function(a){if(a&&!(this._getAnnotationIndex(a)<0))this.onChanged({type:"Changed",added:[],removed:[],changed:[a]})},onChanged:function(a){return this.dispatchEvent(a)},removeAnnotations:function(a){var b=
this._annotations,d,e;if(a){d=[];for(e=b.length-1;e>=0;e--){var f=b[e];if(f.type===a)b.splice(e,1),d.splice(0,0,f),f._annotationModel=null}}else d=b;this.onChanged({type:"Changed",removed:d,added:[],changed:[]})},removeAnnotation:function(a){if(a){var b=this._getAnnotationIndex(a);if(!(b<0))a._annotationModel=null,this.onChanged({type:"Changed",removed:this._annotations.splice(b,1),added:[],changed:[]})}},replaceAnnotations:function(a,b){var d=this._annotations,e,f,g,h=[];if(a)for(e=a.length-1;e>=
0;e--)if(g=a[e],f=this._getAnnotationIndex(g),!(f<0))g._annotationModel=null,d.splice(f,1),h.splice(0,0,g);b||(b=[]);for(e=0;e<b.length;e++)g=b[e],f=this._binarySearch(d,g.start),g._annotationModel=this,d.splice(f,0,g);this.onChanged({type:"Changed",removed:h,added:b,changed:[]})},setTextModel:function(a){this._model&&this._model.removeEventListener("Changed",this._listener.onChanged);(this._model=a)&&this._model.addEventListener("Changed",this._listener.onChanged)},_binarySearch:function(a,b){for(var d=
a.length,e=-1,f;d-e>1;)f=Math.floor((d+e)/2),b<=a[f].start?d=f:e=f;return d},_getAnnotationIndex:function(a){for(var b=this._annotations,d=this._binarySearch(b,a.start);d<b.length&&b[d].start===a.start;){if(b[d]===a)return d;d++}return-1},_onChanged:function(a){var b=a.start,d=a.removedCharCount,e=this._annotations,f=b+d;if(0<e.length){for(var g={type:"Changed",added:[],removed:[],changed:[],textModelChangedEvent:a},a=a.addedCharCount-d,d=0;d<e.length;d++){var h=e[d];if(h.start>=f)h._oldStart=h.start,
h._oldEnd=h.end,h.start+=a,h.end+=a,g.changed.push(h);else if(!(h.end<=b))h.start<b&&f<h.end?(h._oldStart=h.start,h._oldEnd=h.end,h.end+=a,g.changed.push(h)):(e.splice(d,1),g.removed.push(h),h._annotationModel=null,h.expand&&h.expand(),d--)}if(g.added.length>0||g.removed.length>0||g.changed.length>0)this.onChanged(g)}}};k.EventTarget.addMixin(e.prototype);f.prototype={destroy:function(){var a=this._view;if(a)a.removeEventListener("Destroy",this._listener.onDestroy),a.removeEventListener("LineStyle",
this._listener.onLineStyle),this.view=null;(a=this._annotationModel)&&a.removeEventListener("Changed",this._listener.onChanged)},_mergeStyle:function(a,b){if(b){a||(a={});a.styleClass&&b.styleClass&&a.styleClass!==b.styleClass?a.styleClass+=" "+b.styleClass:a.styleClass=b.styleClass;var d;if(b.tagName&&!a.tagName)a.tagName=b.tagName;if(b.style){if(!a.style)a.style={};for(d in b.style)a.style[d]||(a.style[d]=b.style[d])}if(b.attributes){if(!a.attributes)a.attributes={};for(d in b.attributes)a.attributes[d]||
(a.attributes[d]=b.attributes[d])}}return a},_mergeStyleRanges:function(a,b){a||(a=[]);var d,e;for(e=0;e<a.length&&b;e++){var f=a[e];if(b.end<=f.start)break;if(!(b.start>=f.end)){d=this._mergeStyle({},f.style);d=this._mergeStyle(d,b.style);var g=[];g.push(e,1);b.start<f.start&&g.push({start:b.start,end:f.start,style:b.style});b.start>f.start&&g.push({start:f.start,end:b.start,style:f.style});g.push({start:Math.max(f.start,b.start),end:Math.min(f.end,b.end),style:d});b.end<f.end&&g.push({start:b.end,
end:f.end,style:f.style});b=b.end>f.end?{start:f.end,end:b.end,style:b.style}:null;Array.prototype.splice.apply(a,g)}}b&&(d=this._mergeStyle({},b.style),a.splice(e,0,{start:b.start,end:b.end,style:d}));return a},_onAnnotationModelChanged:function(a){function b(b,a){g.getBaseModel&&(b=g.mapOffset(b,!0),a=g.mapOffset(a,!0));b!==-1&&a!==-1&&e.redrawRange(b,a)}function d(a,c){for(var e=0;e<a.length;e++)if(f.isAnnotationTypeVisible(a[e].type)){var g=a[e];b(g.start,g.end);c&&g._oldStart!==void 0&&g._oldEnd&&
b(g._oldStart,g._oldEnd)}}var e=this._view;if(e){var f=this,g=e.getModel();d(a.added);d(a.removed);d(a.changed,!0)}},_onDestroy:function(){this.destroy()},_onLineStyle:function(a){var b=this._annotationModel,d=a.textView.getModel(),e=b.getTextModel(),f=a.lineStart,g=a.lineStart+a.lineText.length;e!==d&&(f=d.mapOffset(f),g=d.mapOffset(g));for(b=b.getAnnotations(f,g);b.hasNext();)if(f=b.next(),this.isAnnotationTypeVisible(f.type)){if(f.rangeStyle){var g=f.start,h=f.end;e!==d&&(g=d.mapOffset(g,!0),h=
d.mapOffset(h,!0));a.ranges=this._mergeStyleRanges(a.ranges,{start:g,end:h,style:f.rangeStyle})}if(f.lineStyle)a.style=this._mergeStyle({},a.style),a.style=this._mergeStyle(a.style,f.lineStyle)}}};g.addMixin(f.prototype);return{FoldingAnnotation:j,AnnotationType:h,AnnotationTypeList:g,AnnotationModel:e,AnnotationStyler:f}});
define("orion/editor/editor","i18n!orion/editor/nls/messages,orion/editor/eventTarget,orion/editor/tooltip,orion/editor/annotations,orion/objects,orion/util".split(","),function(i,k,j,h,a,g){function e(a){a=a||{};this._domNode=a.domNode;this._model=a.model;this._undoStack=a.undoStack;this._statusReporter=a.statusReporter;this._title=null;var b=this;this._listener={onChanged:function(a){b.onChanged(a)}};this._model&&this._model.addEventListener("Changed",this._listener.onChanged);this.checkDirty()}
function f(a){a=a||{};e.call(this,a);this._textViewFactory=a.textViewFactory;this._undoStackFactory=a.undoStackFactory;this._textDNDFactory=a.textDNDFactory;this._annotationFactory=a.annotationFactory;this._foldingRulerFactory=a.foldingRulerFactory;this._lineNumberRulerFactory=a.lineNumberRulerFactory;this._contentAssistFactory=a.contentAssistFactory;this._keyBindingFactory=a.keyBindingFactory;this._contentAssist=this._foldingRuler=this._overviewRuler=this._lineNumberRuler=this._annotationRuler=this._annotationModel=
this._annotationStyler=null}var d=h.AnnotationType;e.prototype={destroy:function(){this.uninstall();this._statusReporter=this._domNode=null;this._model&&this._model.removeEventListener("Changed",this._listener.onChanged)},checkDirty:function(){this.setDirty(this._undoStack&&!this._undoStack.isClean())},focus:function(){},getModel:function(){return this._model},getText:function(a,b){return this.getModel().getText(a,b)},getTitle:function(){return this._title},getUndoStack:function(){return this._undoStack},
install:function(){this.installed=!0},isDirty:function(){return this._dirty},markClean:function(){this.getUndoStack().markClean();this.setDirty(!1)},onDirtyChanged:function(a){return this.dispatchEvent(a)},onInputChanged:function(a){return this.dispatchEvent(a)},onChanged:function(){this.checkDirty()},reportStatus:function(a,b,d){this._statusReporter&&this._statusReporter(a,b,d)},resize:function(){},setDirty:function(a){if(this._dirty!==a)this._dirty=a,this.onDirtyChanged({type:"DirtyChanged"})},
_setModelText:function(a){this._model&&this._model.setText(a)},setInput:function(a,b,d,e){this._title=a;e||(b?this.reportStatus(b,"error"):d!==null&&d!==void 0&&typeof d==="string"&&this._setModelText(d),this._undoStack&&this._undoStack.reset());this.checkDirty();this.onInputChanged({type:"InputChanged",title:a,message:b,contents:d,contentsSaved:e})},setText:function(a,b,d){this.getModel().setText(a,b,d)},uninstall:function(){this.installed=!1}};k.EventTarget.addMixin(e.prototype);f.prototype=new e;
a.mixin(f.prototype,{destroy:function(){e.prototype.destroy.call(this);this._textViewFactory=this._undoStackFactory=this._textDNDFactory=this._annotationFactory=this._foldingRulerFactory=this._lineNumberRulerFactory=this._contentAssistFactory=this._keyBindingFactory=null},getAnnotationModel:function(){return this._annotationModel},getAnnotationRuler:function(){return this._annotationRuler},getAnnotationStyler:function(){return this._annotationStyler},getContentAssist:function(){return this._contentAssist},
getFoldingRuler:function(){return this._foldingRuler},getLineNumberRuler:function(){return this._lineNumberRuler},getModel:function(){if(!this._textView)return null;var a=this._textView.getModel();a.getBaseModel&&(a=a.getBaseModel());return a},getOverviewRuler:function(){return this._overviewRuler},getTextView:function(){return this._textView},getKeyModes:function(){return this._textView.getKeyModes()},getSourceCodeActions:function(){return this._sourceCodeActions},getLinkedMode:function(){return this._linkedMode},
getTextActions:function(){return this._textActions},focus:function(){this._textView&&this._textView.focus()},resize:function(){this._textView&&this._textView.resize()},setAnnotationRulerVisible:function(a,b){if(this._annotationRulerVisible!==a||b)if(this._annotationRulerVisible=a,this._annotationRuler){var d=this._textView;a?d.addRuler(this._annotationRuler,0):d.removeRuler(this._annotationRuler)}},setFoldingRulerVisible:function(a,b){if(this._foldingRulerVisible!==a||b)if(this._foldingRulerVisible=
a,this._foldingRuler){var d=this._textView;d.getModel().getBaseModel&&(a?d.addRuler(this._foldingRuler):d.removeRuler(this._foldingRuler))}},setLineNumberRulerVisible:function(a,b){if(this._lineNumberRulerVisible!==a||b)if(this._lineNumberRulerVisible=a,this._lineNumberRuler){var d=this._textView;a?d.addRuler(this._lineNumberRuler,!this._annotationRulerVisible?0:1):d.removeRuler(this._lineNumberRuler)}},setOverviewRulerVisible:function(a,b){if(this._overviewRulerVisible!==a||b)if(this._overviewRulerVisible=
a,this._overviewRuler){var d=this._textView;a?d.addRuler(this._overviewRuler):d.removeRuler(this._overviewRuler)}},mapOffset:function(a,b){var d=this._textView.getModel();d.getBaseModel&&(a=d.mapOffset(a,b));return a},getLineAtOffset:function(a){return this.getModel().getLineAtOffset(this.mapOffset(a))},getLineStart:function(a){return this.getModel().getLineStart(a)},getCaretOffset:function(){return this.mapOffset(this._textView.getCaretOffset())},getSelection:function(){var a=this._textView,b=a.getSelection(),
a=a.getModel();if(a.getBaseModel)b.start=a.mapOffset(b.start),b.end=a.mapOffset(b.end);return b},_expandOffset:function(a){var b=this._textView.getModel(),e=this._annotationModel;if(e&&b.getBaseModel)for(a=e.getAnnotations(a,a+1);a.hasNext();)b=a.next(),b.type===d.ANNOTATION_FOLDING&&b.expand&&b.expand()},setCaretOffset:function(a,b,d){var e=this._textView,f=e.getModel();f.getBaseModel&&(this._expandOffset(a),a=f.mapOffset(a,!0));e.setCaretOffset(a,b,d)},setText:function(a,b,d){var e=this._textView,
f=e.getModel();f.getBaseModel&&(b!==void 0&&(this._expandOffset(b),b=f.mapOffset(b,!0)),d!==void 0&&(this._expandOffset(d),d=f.mapOffset(d,!0)));e.setText(a,b,d)},setSelection:function(a,b,d,e){var f=this._textView,g=f.getModel();g.getBaseModel&&(this._expandOffset(a),this._expandOffset(b),a=g.mapOffset(a,!0),b=g.mapOffset(b,!0));f.setSelection(a,b,d,e)},moveSelection:function(a,b,d,e){var f=this._textView;this.setSelection(a,b||a,1/3,function(){(e===void 0||e)&&f.focus();d&&d()})},_getTooltipInfo:function(a,
b){var d=this._textView,e=this.getAnnotationModel();if(!e)return null;var f=this._annotationStyler;if(!f)return null;var g=d.getOffsetAtLocation(a,b);if(g===-1)return null;g=this.mapOffset(g);f=f.getAnnotationsByType(e,g,g+1);e=[];for(g=0;g<f.length;g++)f[g].rangeStyle&&e.push(f[g]);if(e.length===0)return null;d=d.convert({x:a,y:b},"document","page");return{contents:e,anchor:"left",x:d.x+10,y:d.y+20}},_highlightCurrentLine:function(a,b){var e=this._annotationModel;if(e){var f=this._textView;if(!f.getOptions("singleMode")){var g=
f.getModel(),h=b?g.getLineAtOffset(b.start):-1,i=g.getLineAtOffset(a.start),f=a.start===a.end,j=!b||b.start===b.end,k=g.getLineStart(i),r=g.getLineEnd(i);g.getBaseModel&&(k=g.mapOffset(k),r=g.mapOffset(r));g=this._currentLineAnnotation;if(!(h===i&&j&&f&&g&&g.start===k&&g.end===r)){var h=g?[g]:null,u;f&&(g=d.createAnnotation(d.ANNOTATION_CURRENT_LINE,k,r),u=[g]);this._currentLineAnnotation=g;e.replaceAnnotations(h,u)}}}},installTextView:function(){this.install()},install:function(){if(!this._textView){this._textView=
this._textViewFactory();if(this._undoStackFactory)this._undoStack=this._undoStackFactory.createUndoStack(this),this.checkDirty();if(this._textDNDFactory)this._textDND=this._textDNDFactory.createTextDND(this,this._undoStack);if(this._contentAssistFactory)this._contentAssist=this._contentAssistFactory.createContentAssistMode(this).getContentAssist();var a=this,b=this._textView,f=this;this._listener={onModelChanged:function(){f.checkDirty()},onMouseOver:function(b){f._listener.onMouseMove(b)},onMouseMove:function(a){var c=
j.Tooltip.getTooltip(b);if(c&&!(f._listener.lastMouseX===a.event.clientX&&f._listener.lastMouseY===a.event.clientY))f._listener.lastMouseX=a.event.clientX,f._listener.lastMouseY=a.event.clientY,c.setTarget({x:a.x,y:a.y,getTooltipInfo:function(){return f._getTooltipInfo(this.x,this.y)}})},onMouseOut:function(a){var c=j.Tooltip.getTooltip(b);if(c&&!(f._listener.lastMouseX===a.event.clientX&&f._listener.lastMouseY===a.event.clientY))f._listener.lastMouseX=a.event.clientX,f._listener.lastMouseY=a.event.clientY,
c.setTarget(null)},onScroll:function(){var a=j.Tooltip.getTooltip(b);a&&a.setTarget(null,0,0)},onSelection:function(b){f._updateCursorStatus();f._highlightCurrentLine(b.newValue,b.oldValue)}};b.addEventListener("ModelChanged",this._listener.onModelChanged);b.addEventListener("Selection",this._listener.onSelection);b.addEventListener("MouseOver",this._listener.onMouseOver);b.addEventListener("MouseOut",this._listener.onMouseOut);b.addEventListener("MouseMove",this._listener.onMouseMove);b.addEventListener("Scroll",
this._listener.onScroll);if(this._keyBindingFactory){var g;if(g=typeof this._keyBindingFactory==="function"?this._keyBindingFactory(this,this.getKeyModes(),this._undoStack,this._contentAssist):this._keyBindingFactory.createKeyBindings(a,this._undoStack,this._contentAssist))this._textActions=g.textActions,this._linkedMode=g.linkedMode,this._sourceCodeActions=g.sourceCodeActions}g=function(b){if(b!==void 0&&b!==-1){for(var e=this.getView().getModel(),f=this.getAnnotationModel(),g=a.mapOffset(e.getLineStart(b)),
b=a.mapOffset(e.getLineEnd(b)),e=f.getAnnotations(g,b),h=null;e.hasNext();){var i=e.next();if(i.type===d.ANNOTATION_BOOKMARK){h=i;break}}h?f.removeAnnotation(h):(h=d.createAnnotation(d.ANNOTATION_BOOKMARK,g,b),h.title=void 0,f.addAnnotation(h))}};if(this._annotationFactory){var h=b.getModel();h.getBaseModel&&(h=h.getBaseModel());if(this._annotationModel=this._annotationFactory.createAnnotationModel(h))if(h=this._annotationStyler=this._annotationFactory.createAnnotationStyler(b,this._annotationModel))h.addAnnotationType(d.ANNOTATION_CURRENT_SEARCH),
h.addAnnotationType(d.ANNOTATION_MATCHING_SEARCH),h.addAnnotationType(d.ANNOTATION_ERROR),h.addAnnotationType(d.ANNOTATION_WARNING),h.addAnnotationType(d.ANNOTATION_MATCHING_BRACKET),h.addAnnotationType(d.ANNOTATION_CURRENT_BRACKET),h.addAnnotationType(d.ANNOTATION_CURRENT_LINE),h.addAnnotationType(d.ANNOTATION_READ_OCCURRENCE),h.addAnnotationType(d.ANNOTATION_WRITE_OCCURRENCE),h.addAnnotationType(d.ANNOTATION_SELECTED_LINKED_GROUP),h.addAnnotationType(d.ANNOTATION_CURRENT_LINKED_GROUP),h.addAnnotationType(d.ANNOTATION_LINKED_GROUP),
h.addAnnotationType("orion.annotation.highlightError");var h=this._annotationFactory.createAnnotationRulers(this._annotationModel),i=this._annotationRuler=h.annotationRuler;if(i)i.onDblClick=g,i.setMultiAnnotationOverlay({html:"<div class='annotationHTML overlay'></div>"}),i.addAnnotationType(d.ANNOTATION_ERROR),i.addAnnotationType(d.ANNOTATION_WARNING),i.addAnnotationType(d.ANNOTATION_TASK),i.addAnnotationType(d.ANNOTATION_BOOKMARK);this.setAnnotationRulerVisible(this._annotationRulerVisible||this._annotationRulerVisible===
void 0,!0);if(i=this._overviewRuler=h.overviewRuler)i.addAnnotationType(d.ANNOTATION_CURRENT_SEARCH),i.addAnnotationType(d.ANNOTATION_MATCHING_SEARCH),i.addAnnotationType(d.ANNOTATION_READ_OCCURRENCE),i.addAnnotationType(d.ANNOTATION_WRITE_OCCURRENCE),i.addAnnotationType(d.ANNOTATION_CURRENT_BLAME),i.addAnnotationType(d.ANNOTATION_ERROR),i.addAnnotationType(d.ANNOTATION_WARNING),i.addAnnotationType(d.ANNOTATION_TASK),i.addAnnotationType(d.ANNOTATION_BOOKMARK),i.addAnnotationType(d.ANNOTATION_MATCHING_BRACKET),
i.addAnnotationType(d.ANNOTATION_CURRENT_BRACKET),i.addAnnotationType(d.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(d.ANNOTATION_CURRENT_BLAME),this._lineNumberRuler.addAnnotationType(d.ANNOTATION_BLAME),this._lineNumberRuler.onDblClick=g,this.setLineNumberRulerVisible(this._lineNumberRulerVisible||
this._lineNumberRulerVisible===void 0,!0);if(this._foldingRulerFactory)this._foldingRuler=this._foldingRulerFactory.createFoldingRuler(this._annotationModel),this._foldingRuler.addAnnotationType(d.ANNOTATION_FOLDING),this.setFoldingRulerVisible(this._foldingRulerVisible||this._foldingRulerVisible===void 0,!0);this.dispatchEvent({type:"TextViewInstalled",textView:b});e.prototype.install.call(this)}},uninstallTextView:function(){this.uninstall()},uninstall:function(){var a=this._textView;if(a)a.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:a}),e.prototype.uninstall.call(this)},_updateCursorStatus:function(){var a=
this.getModel(),b=this.getCaretOffset(),d=a.getLineAtOffset(b),a=a.getLineStart(d);b-=a;for(var a=this.getKeyModes(),e=0;e<a.length;e++){var f=a[e];if(f.isActive()&&f.isStatusActive&&f.isStatusActive())return}this.reportStatus(g.formatMessage(i.lineColumn,d+1,b+1))},showAnnotations:function(a,b,e,f){var g=this._annotationModel;if(g){for(var h=[],i=[],j=g.getTextModel(),k=g.getAnnotations(),r;k.hasNext();)r=k.next(),b.indexOf(r.type)!==-1&&r.creatorID===this&&h.push(r);if(a)for(b=0;b<a.length;b++)if(r=
a[b]){if(e)r=e(r);else{var u;typeof r.line==="number"?(u=j.getLineStart(r.line-1),k=u+r.start-1,u=u+r.end-1):(k=r.start,u=r.end);var v=f(r);if(!v)continue;r=d.createAnnotation(v,k,u,r.description)}r.creatorID=this;i.push(r)}g.replaceAnnotations(h,i)}},showProblems:function(a){this.showAnnotations(a,[d.ANNOTATION_ERROR,d.ANNOTATION_WARNING,d.ANNOTATION_TASK],null,function(b){switch(b.severity){case "error":return d.ANNOTATION_ERROR;case "warning":return d.ANNOTATION_WARNING;case "task":return d.ANNOTATION_TASK}return null})},
showOccurrences:function(a){this.showAnnotations(a,[d.ANNOTATION_READ_OCCURRENCE,d.ANNOTATION_WRITE_OCCURRENCE],null,function(b){return b.readAccess?d.ANNOTATION_READ_OCCURRENCE:d.ANNOTATION_WRITE_OCCURRENCE})},showBlame:function(c){var b=this._blameRGB,e=this.getTextView().getOptions("parent").ownerDocument;if(!b){var f=g.createElement(e,"div");f.className="annotation blame";e.body.appendChild(f);var j=(e.defaultView||e.parentWindow).getComputedStyle(f).getPropertyValue("background-color");f.parentNode.removeChild(f);
var f=j.indexOf("("),o=j.indexOf(")"),j=j.substring(f+1,o);this._blameRGB=b=j.split(",").slice(0,3)}var k=function(){var b=h.AnnotationType.createAnnotation(this.groupType,this.start,this.end,this.title);b.style=a.mixin({},b.style);b.style.style=a.mixin({},b.style.style);b.style.style.backgroundColor="";this.groupAnnotation=b;b.blame=this.blame;b.html=this.html;b.creatorID=this.creatorID;return b},p=function(){var b=g.createElement(e,"div");b.className="tooltipTitle";var a=this.blame.Message.indexOf("\n");
if(a===-1)a=this.blame.Message.length;var c=g.createElement(e,"a");c.href=this.blame.CommitLink;c.appendChild(e.createTextNode(this.blame.Message.substring(0,a)));b.appendChild(c);b.appendChild(g.createElement(e,"br"));b.appendChild(e.createTextNode(g.formatMessage(i.committerOnTime,this.blame.AuthorName,this.blame.Time)));return b},t=this.getModel();this.showAnnotations(c,[d.ANNOTATION_BLAME,d.ANNOTATION_CURRENT_BLAME],function(c){var e=t.getLineStart(c.Start-1),f=t.getLineEnd(c.End-1,!0),e=h.AnnotationType.createAnnotation(d.ANNOTATION_BLAME,
e,f,p),f=b.slice(0);f.push(c.Shade);e.style=a.mixin({},e.style);e.style.style=a.mixin({},e.style.style);e.style.style.backgroundColor="rgba("+f.join()+")";e.groupId=c.Name;e.groupType=d.ANNOTATION_CURRENT_BLAME;e.createGroupAnnotation=k;e.html='<img class="annotationHTML blame" src="'+c.AuthorImage+'"/>';e.blame=c;return e})},showSelection:function(a,b,d,e,f){typeof a==="number"?(typeof b!=="number"&&(b=a),this.moveSelection(a,b)):typeof d==="number"&&(a=this.getModel().getLineStart(d-1),typeof e===
"number"&&(a+=e),typeof f!=="number"&&(f=0),this.moveSelection(a,a+f))},_setModelText:function(a){this._textView&&(this._textView.setText(a),this._textView.getModel().setLineDelimiter("auto"),this._highlightCurrentLine(this._textView.getSelection()))},setInput:function(a,b,d,f,g){e.prototype.setInput.call(this,a,b,d,f);this._textView&&!f&&!g&&this._textView.focus()},onGotoLine:function(a,b,d,e){if(this._textView){var f=this.getModel(),a=Math.max(0,Math.min(a,f.getLineCount()-1)),g=f.getLineStart(a),
h=0;d===void 0&&(d=0);typeof b==="string"?(a=f.getLine(a).indexOf(b),a!==-1&&(h=a,d=h+b.length)):(h=b,b=f.getLineEnd(a)-g,h=Math.min(h,b),d=Math.min(d,b));this.moveSelection(g+h,g+d,e)}}});return{BaseEditor:e,Editor:f}});
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(i,k,j,h,a,g,e){function f(b){var c=b.getTextView();j.KeyMode.call(this,c);this.editor=b;this._active=!1;this._success=!0;this._ignoreSelection=!1;this._prefix="";c.setAction("incrementalFindCancel",function(){this.setActive(!1);return!0}.bind(this));c.setAction("incrementalFindBackspace",function(){return this._backspace()}.bind(this));
var d=this;this._listener={onVerify:function(b){var c=d.editor,e=c.getModel(),f=c.mapOffset(b.start),c=c.mapOffset(b.end),e=e.getText(f,c);if((e=d._prefix.match(RegExp("^"+a.escape(e),"i")))&&e.length>0)d._prefix+=b.text,d._success=!0,d._status(),d.find(d._forward,!0),b.text=null},onSelection:function(){d._ignoreSelection||d.setActive(!1)}}}function d(b,a,c){if(b){this._editor=b;this._undoStack=a;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 d=this;this._listeners={onEditorFocus:function(b){d._removeCurrentAnnotation(b)}};this.setOptions(c)}}var c={};f.prototype=new j.KeyMode;g.mixin(f.prototype,{createKeyBindings:function(){var b=k.KeyBinding,a=[];a.push({actionID:"incrementalFindBackspace",keyBinding:new b(8)});a.push({actionID:"incrementalFindCancel",keyBinding:new b(13)});a.push({actionID:"incrementalFindCancel",
keyBinding:new b(27)});a.push({actionID:"incrementalFindReverse",keyBinding:new b(38)});a.push({actionID:"incrementalFind",keyBinding:new b(40)});a.push({actionID:"incrementalFindReverse",keyBinding:new b("k",!0,!0)});a.push({actionID:"incrementalFind",keyBinding:new b("k",!0)});return a},find:function(b,a){this._forward=b;if(!this.isActive())return this.setActive(!0),!1;var c=this._prefix;if(c.length===0)return!1;var d=this.editor,e=d.getModel(),e=b?this._success?a?this._start:d.getCaretOffset()+
1:0:this._success?a?this._start:d.getCaretOffset():e.getCharCount()-1;if(c=d.getModel().find({string:c,start:e,reverse:!b,caseInsensitive:c.toLowerCase()===c}).next()){if(!a)this._start=e;this._ignoreSelection=this._success=!0;d.moveSelection(b?c.start:c.end,b?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(b){if(this._active!==b)this._active=b,this._prefix=
"",this._success=!0,b=this.editor.getTextView(),this._start=this.editor.getCaretOffset(),this.editor.setCaretOffset(this._start),this._active?(b.addEventListener("Verify",this._listener.onVerify),b.addEventListener("Selection",this._listener.onSelection),b.addKeyMode(this)):(b.removeEventListener("Verify",this._listener.onVerify),b.removeEventListener("Selection",this._listener.onSelection),b.removeKeyMode(this)),this._status()},_backspace:function(){var b=this._prefix,b=this._prefix=b.substring(0,
b.length-1);return b.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 b;b=this._forward?this._success?i.incrementalFindStr:i.incrementalFindStrNotFound:this._success?i.incrementalFindReverseStr:i.incrementalFindReverseStrNotFound;b=e.formatMessage(b,this._prefix);this.editor.reportStatus(b,this._success?"":"error")}else this.editor.reportStatus("")}});
c.IncrementalFind=f;d.prototype={find:function(b,a,c){this.setOptions({reverse:!b});var d=this.getFindString(),e;if(a)d=a.findString||d,e=a.count;b=this.getOptions();this.setOptions(a);a=c?this._startOffset:this.getStartOffset();if((e=this._doFind(d,a,e))&&!c)this._startOffset=e.start;this.setOptions(b);this._hideAfterFind&&this.hide();return e},getStartOffset:function(){return this._start!==void 0?this._start:this._reverse?this._editor.getSelection().start-1:this._editor.getCaretOffset()},getFindString:function(){var b=
this._editor.getSelection(),b=this._editor.getText(b.start,b.end);this._regex&&(b=a.escape(b));return b||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 b=this._editor.getTextView();b&&(b.removeEventListener("Focus",this._listeners.onEditorFocus),b.focus())},_processReplaceString:function(b){var a=b;if(this._regex){for(var a="",c=!1,d=this._editor.getModel().getLineDelimiter(),e=0;e<b.length;e++){var f=b.substring(e,e+1);if(c){switch(f){case "R":a+=d;break;case "r":a+=
"\r";break;case "n":a+="\n";break;case "t":a+="\t";break;case "\\":a+="\\";break;default:a+="\\"+f}c=!1}else f==="\\"?c=!0:a+=f}c&&(a+="\\")}return a},isVisible:function(){return this._visible},replace:function(){var b=this.getFindString();if(b){var a=this._editor,c=this._processReplaceString(this.getReplaceString()),d=a.getSelection().start;if(a=a.getModel().find({string:b,start:d,reverse:!1,wrap:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive}).next())this.startUndo(),
this._doReplace(a.start,a.end,b,c),this.endUndo()}this._findAfterReplace&&b&&this._doFind(b,this.getStartOffset())},replaceAll:function(){var b=this.getFindString();if(b){this._replacingAll=!0;var a=this._editor,c=a.getTextView();a.reportStatus(i.replaceAll);var d=this._processReplaceString(this.getReplaceString()),f=this;window.setTimeout(function(){for(var g=0,h=0;;){var j=f._doFind(b,g,null,!0);if(!j)break;h++;h===1&&(c.setRedraw(!1),f.startUndo());f._doReplace(j.start,j.end,b,d);g=f.getStartOffset()}h>
0&&(f.endUndo(),c.setRedraw(!0));g>0?a.reportStatus(e.formatMessage(i.replacedMatches,h)):a.reportStatus(i.nothingReplaced,"error");f._replacingAll=!1},100)}},setOptions:function(b){if(b){if((b.showAll===!0||b.showAll===!1)&&this._showAll!==b.showAll)if(this._showAll=b.showAll,this.isVisible())if(this._showAll)this._markAllOccurrences();else{var a=this._editor.getAnnotationModel();a&&a.removeAnnotations(h.AnnotationType.ANNOTATION_MATCHING_SEARCH)}if(b.caseInsensitive===!0||b.caseInsensitive===!1)this._caseInsensitive=
b.caseInsensitive;if(b.wrap===!0||b.wrap===!1)this._wrap=b.wrap;if(b.wholeWord===!0||b.wholeWord===!1)this._wholeWord=b.wholeWord;if(b.incremental===!0||b.incremental===!1)this._incremental=b.incremental;if(b.regex===!0||b.regex===!1)this._regex=b.regex;if(b.findAfterReplace===!0||b.findAfterReplace===!1)this._findAfterReplace=b.findAfterReplace;if(b.hideAfterFind===!0||b.hideAfterFind===!1)this._hideAfterFind=b.hideAfterFind;if(b.reverse===!0||b.reverse===!1)this._reverse=b.reverse;if(b.hasOwnProperty("findCallback"))this._findCallback=
b.findCallback;if(b.hasOwnProperty("start"))this._start=b.start;if(b.hasOwnProperty("end"))this._end=b.end}},show:function(b){this._visible=!0;if(b){if(!this._savedOptions)this._savedOptions=[];this._savedOptions.push(this.getOptions());this.setOptions(b)}this._startOffset=this._editor.getSelection().start;this._editor.getTextView().addEventListener("Focus",this._listeners.onEditorFocus);var a=this;window.setTimeout(function(){a._incremental&&a.find(!0,null,!0)},0)},startUndo:function(){this._undoStack&&
this._undoStack.startCompoundChange()},endUndo:function(){this._undoStack&&this._undoStack.endCompoundChange()},_find:function(b,a,c){return this._editor.getModel().find({string:b,start:a,end:this._end,reverse:this._reverse,wrap:c?!1:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive})},_doFind:function(b,a,c,d){var c=c||1,e=this._editor;if(!b)return this._removeAllAnnotations(),null;this._lastString=b;var f,g;if(this._regex)try{g=this._find(b,a,d)}catch(j){e.reportStatus(j.message,
"error");return}else g=this._find(b,a,d);for(b=0;b<c&&g.hasNext();b++)f=g.next();if(!this._replacingAll){f?this._editor.reportStatus(""):this._editor.reportStatus(i.notFound,"error");if(this.isVisible()){c=h.AnnotationType.ANNOTATION_CURRENT_SEARCH;if(g=e.getAnnotationModel())g.removeAnnotations(c),f&&g.addAnnotation(h.AnnotationType.createAnnotation(c,f.start,f.end));if(this._showAll){this._timer&&window.clearTimeout(this._timer);var k=this;this._timer=window.setTimeout(function(){k._markAllOccurrences();
k._timer=null},500)}}this._findCallback?this._findCallback(f):f&&e.moveSelection(f.start,f.end,null,!1)}return f},_doReplace:function(b,a,c,d){var e=this._editor;if(this._regex&&(d=e.getText(b,a).replace(RegExp(c,this._caseInsensitive?"i":""),d),!d))return;e.setText(d,b,a);e.setSelection(b,b+d.length,!0)},_markAllOccurrences:function(){var b=this._editor.getAnnotationModel();if(b){for(var a=h.AnnotationType.ANNOTATION_MATCHING_SEARCH,c=b.getAnnotations(),d=[],e;c.hasNext();){var f=c.next();f.type===
a&&d.push(f)}if(this.isVisible()){c=this.getFindString();c=this._editor.getModel().find({string:c,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive});for(e=[];c.hasNext();)f=c.next(),e.push(h.AnnotationType.createAnnotation(a,f.start,f.end))}b.replaceAnnotations(d,e)}},_removeAllAnnotations:function(){var b=this._editor.getAnnotationModel();b&&(b.removeAnnotations(h.AnnotationType.ANNOTATION_CURRENT_SEARCH),b.removeAnnotations(h.AnnotationType.ANNOTATION_MATCHING_SEARCH))},
_removeCurrentAnnotation:function(){var b=this._editor.getAnnotationModel();b&&b.removeAnnotations(h.AnnotationType.ANNOTATION_CURRENT_SEARCH)}};c.Find=d;return c});
define("orion/editor/actions","i18n!orion/editor/nls/messages,orion/keyBinding,orion/editor/annotations,orion/editor/tooltip,orion/editor/find,orion/util".split(","),function(i,k,j,h,a,g){function e(b,c,d){this.editor=b;this.undoStack=c;this._incrementalFind=new a.IncrementalFind(b);this._find=d?d:new a.Find(b,c);this._lastEditLocation=null;this.init()}function f(b,a,c,d){this.editor=b;this.undoStack=a;this.contentAssist=c;this.linkedMode=d;this.contentAssist&&this.contentAssist.addEventListener("ProposalApplied",
this.contentAssistProposalApplied.bind(this));this.init()}var d=j.AnnotationType,c={};e.prototype={init:function(){var b=this.editor.getTextView();this._lastEditListener={onModelChanged:function(b){if(this.editor.isDirty())this._lastEditLocation=b.start+b.addedCharCount}.bind(this)};b.addEventListener("ModelChanged",this._lastEditListener.onModelChanged);b.setAction("undo",function(b){if(this.undoStack){var a=1;if(b&&b.count)a=b.count;for(;a>0;)this.undoStack.undo(),--a;return!0}return!1}.bind(this),
{name:i.undo});b.setAction("redo",function(b){if(this.undoStack){var a=1;if(b&&b.count)a=b.count;for(;a>0;)this.undoStack.redo(),--a;return!0}return!1}.bind(this),{name:i.redo});b.setKeyBinding(new k.KeyBinding("f",!0),"find");b.setAction("find",function(){if(this._find){var b=this.editor.getSelection();(b=prompt(i.find,this.editor.getText(b.start,b.end)))&&this._find.find(!0,{findString:b})}}.bind(this),{name:i.find});b.setKeyBinding(new k.KeyBinding("k",!0),"findNext");b.setAction("findNext",function(b){return this._find?
(this._find.find(!0,b),!0):!1}.bind(this),{name:i.findNext});b.setKeyBinding(new k.KeyBinding("k",!0,!0),"findPrevious");b.setAction("findPrevious",function(b){return this._find?(this._find.find(!1,b),!0):!1}.bind(this),{name:i.findPrevious});b.setKeyBinding(new k.KeyBinding("j",!0),"incrementalFind");b.setAction("incrementalFind",function(){this._incrementalFind&&this._incrementalFind.find(!0);return!0}.bind(this),{name:i.incrementalFind});b.setKeyBinding(new k.KeyBinding("j",!0,!0),"incrementalFindReverse");
b.setAction("incrementalFindReverse",function(){this._incrementalFind&&this._incrementalFind.find(!1);return!0}.bind(this),{name:i.incrementalFindReverse});b.setAction("tab",function(){return this.indentLines()}.bind(this));b.setAction("shiftTab",function(){return this.unindentLines()}.bind(this),{name:i.unindentLines});b.setKeyBinding(new k.KeyBinding(38,!1,!1,!0),"moveLinesUp");b.setAction("moveLinesUp",function(){return this.moveLinesUp()}.bind(this),{name:i.moveLinesUp});b.setKeyBinding(new k.KeyBinding(40,
!1,!1,!0),"moveLinesDown");b.setAction("moveLinesDown",function(){return this.moveLinesDown()}.bind(this),{name:i.moveLinesDown});b.setKeyBinding(new k.KeyBinding(38,!0,!1,!0),"copyLinesUp");b.setAction("copyLinesUp",function(){return this.copyLinesUp()}.bind(this),{name:i.copyLinesUp});b.setKeyBinding(new k.KeyBinding(40,!0,!1,!0),"copyLinesDown");b.setAction("copyLinesDown",function(){return this.copyLinesDown()}.bind(this),{name:i.copyLinesDown});b.setKeyBinding(new k.KeyBinding("d",!0,!1,!1),
"deleteLines");b.setAction("deleteLines",function(b){return this.deleteLines(b)}.bind(this),{name:i.deleteLines});b.setKeyBinding(new k.KeyBinding("l",!g.isMac,!1,!1,g.isMac),"gotoLine");b.setAction("gotoLine",function(){return this.gotoLine()}.bind(this),{name:i.gotoLine});b.setKeyBinding(new k.KeyBinding(190,!0),"nextAnnotation");b.setAction("nextAnnotation",function(){return this.nextAnnotation(!0)}.bind(this),{name:i.nextAnnotation});b.setKeyBinding(new k.KeyBinding(188,!0),"previousAnnotation");
b.setAction("previousAnnotation",function(){return this.nextAnnotation(!1)}.bind(this),{name:i.prevAnnotation});b.setKeyBinding(new k.KeyBinding("e",!0,!1,!0,!1),"expand");b.setAction("expand",function(){return this.expandAnnotation(!0)}.bind(this),{name:i.expand});b.setKeyBinding(new k.KeyBinding("c",!0,!1,!0,!1),"collapse");b.setAction("collapse",function(){return this.expandAnnotation(!1)}.bind(this),{name:i.collapse});b.setKeyBinding(new k.KeyBinding("e",!0,!0,!0,!1),"expandAll");b.setAction("expandAll",
function(){return this.expandAnnotations(!0)}.bind(this),{name:i.expandAll});b.setKeyBinding(new k.KeyBinding("c",!0,!0,!0,!1),"collapseAll");b.setAction("collapseAll",function(){return this.expandAnnotations(!1)}.bind(this),{name:i.collapseAll});b.setKeyBinding(new k.KeyBinding("q",!g.isMac,!1,!1,g.isMac),"lastEdit");b.setAction("lastEdit",function(){return this.gotoLastEdit()}.bind(this),{name:i.lastEdit})},copyLinesDown:function(){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;
var a=b.getModel(),c=b.getSelection(),d=a.getLineAtOffset(c.start),c=a.getLineAtOffset(c.end>c.start?c.end-1:c.end),e=a.getLineStart(d),d=a.getLineEnd(c,!0),f=a.getLineCount(),g="",e=a.getText(e,d);c===f-1&&(e=(g=a.getLineDelimiter())+e);b.setText(e,d,d);b.setSelection(d+g.length,d+e.length);return!0},copyLinesUp:function(){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var a=b.getModel(),c=b.getSelection(),d=a.getLineAtOffset(c.start),c=a.getLineAtOffset(c.end>c.start?c.end-
1:c.end),d=a.getLineStart(d),e=a.getLineEnd(c,!0),f=a.getLineCount(),g="",e=a.getText(d,e);c===f-1&&(e+=g=a.getLineDelimiter());b.setText(e,d,d);b.setSelection(d,d+e.length-g.length);return!0},deleteLines:function(b){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var c=1;if(b&&b.count)c=b.count;var d=a.getSelection(),e=a.getModel(),f=e.getLineAtOffset(d.start),b=e.getLineStart(f),c=d.start!==d.end||c===1?e.getLineAtOffset(d.end>d.start?d.end-1:d.end):Math.min(f+c-1,e.getLineCount()-
1),c=e.getLineEnd(c,!0);a.setText("",b,c);return!0},expandAnnotation:function(b){var a=this.editor,c=a.getAnnotationModel();if(!c)return!0;var d=a.getModel(),e=a.getCaretOffset(),f=d.getLineAtOffset(e),e=d.getLineStart(f),f=d.getLineEnd(f,!0);d.getBaseModel&&(e=d.mapOffset(e),f=d.mapOffset(f),d.getBaseModel());for(var g,c=c.getAnnotations(e,f);!g&&c.hasNext();)d=c.next(),d.type===j.AnnotationType.ANNOTATION_FOLDING&&(g=d);g&&b!==g.expanded&&(b?g.expand():(a.setCaretOffset(g.start),g.collapse()));
return!0},expandAnnotations:function(b){var a=this.editor,c=a.getTextView(),d=a.getAnnotationModel();if(!d)return!0;a.getModel();d=d.getAnnotations();for(c.setRedraw(!1);d.hasNext();)a=d.next(),a.type===j.AnnotationType.ANNOTATION_FOLDING&&b!==a.expanded&&(b?a.expand():a.collapse());c.setRedraw(!0);return!0},indentLines:function(){var b=this.editor,a=b.getTextView();if(a.getOptions("readonly"))return!1;if(a.getOptions("tabMode")){var c=b.getModel(),d=b.getSelection(),e=c.getLineAtOffset(d.start),
f=c.getLineAtOffset(d.end>d.start?d.end-1:d.end);if(e!==f){var g=[];g.push("");for(var h=e;h<=f;h++)g.push(c.getLine(h,!0));h=c.getLineStart(e);c=c.getLineEnd(f,!0);a=a.getOptions("tabSize","expandTab");a=a.expandTab?Array(a.tabSize+1).join(" "):"\t";b.setText(g.join(a),h,c);b.setSelection(h===d.start?d.start:d.start+a.length,d.end+(f-e+1)*a.length);return!0}return!1}},gotoLastEdit:function(){typeof this._lastEditLocation==="number"&&this.editor.showSelection(this._lastEditLocation);return!0},gotoLine:function(){var b=
this.editor,a=b.getModel().getLineAtOffset(b.getCaretOffset());if(a=prompt(i.gotoLinePrompty,a+1))a=parseInt(a,10),b.onGotoLine(a-1,0);return!0},moveLinesDown:function(){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var a=b.getModel(),c=b.getSelection(),d=a.getLineAtOffset(c.start),e=a.getLineAtOffset(c.end>c.start?c.end-1:c.end),f=a.getLineCount();if(e===f-1)return!0;var d=a.getLineStart(d),c=a.getLineEnd(e,!0),g=a.getLineEnd(e+1,!0)-(c-d),h=0;e!==f-2?a=a.getText(d,c):(e=a.getLineEnd(e),
a=a.getText(e,c)+a.getText(d,e),h+=c-e);this.startUndo();b.setText("",d,c);b.setText(a,g,g);b.setSelection(g+h,g+h+a.length);this.endUndo();return!0},moveLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var c=a.getModel(),d=a.getSelection(),e=c.getLineAtOffset(d.start);if(e===0)return!0;var f=c.getLineAtOffset(d.end>d.start?d.end-1:d.end),g=c.getLineCount(),d=c.getLineStart(e-1),h=c.getLineStart(e),i=c.getLineEnd(f,!0),j=c.getText(h,i),k=0;f===g-1&&(f=c.getLineEnd(e-
1),e=c.getLineEnd(e-1,!0),j+=c.getText(f,e),h=f,k=e-f);this.startUndo();a.setText("",h,i);a.setText(j,d,d);a.setSelection(d,d+j.length-k);this.endUndo();return!0},nextAnnotation:function(a){function c(a){return!!a.lineStyle||a.type===d.ANNOTATION_MATCHING_BRACKET||a.type===d.ANNOTATION_CURRENT_BRACKET||!g.isAnnotationTypeVisible(a.type)}var e=this.editor,f=e.getAnnotationModel();if(!f)return!0;var g=e.getOverviewRuler()||e.getAnnotationStyler();if(!g)return!0;for(var i=e.getModel(),j=e.getCaretOffset(),
k=f.getAnnotations(a?j:0,a?i.getCharCount():j),r=null;k.hasNext();){var u=k.next();if(a){if(u.start<=j)continue}else if(u.start>=j)continue;if(!c(u)&&(r=u,a))break}if(r){for(var v=[r],k=f.getAnnotations(r.start,r.start);k.hasNext();)u=k.next(),u!==r&&!c(u)&&v.push(u);var n=e.getTextView(),w=i.getLineAtOffset(r.start),x=h.Tooltip.getTooltip(n);if(!x)return e.moveSelection(r.start),!0;e.moveSelection(r.start,r.start,function(){x.setTarget({getTooltipInfo:function(){var a=n.convert({x:n.getLocationAtOffset(r.start).x,
y:n.getLocationAtOffset(i.getLineStart(w)).y},"document","page");return{contents:v,x:a.x,y:a.y+Math.floor(n.getLineHeight(w)*1.33)}}},0)})}return!0},unindentLines:function(){var a=this.editor,c=a.getTextView();if(c.getOptions("readonly"))return!1;if(c.getOptions("tabMode")){for(var d=a.getModel(),e=a.getSelection(),f=d.getLineAtOffset(e.start),g=d.getLineAtOffset(e.end>e.start?e.end-1:e.end),h=c.getOptions("tabSize"),i=Array(h+1).join(" "),j=[],k=c=0,v=f;v<=g;v++){var n=d.getLine(v,!0);if(d.getLineStart(v)!==
d.getLineEnd(v))if(n.indexOf("\t")===0)n=n.substring(1),c++;else if(n.indexOf(i)===0)n=n.substring(h),c+=h;else return!0;v===f&&(k=c);j.push(n)}f=d.getLineStart(f);h=d.getLineEnd(g,!0);d=d.getLineStart(g);a.setText(j.join(""),f,h);g=f===e.start?e.start:e.start-k;e=Math.max(g,e.end-c+(e.end===d+1&&e.start!==e.end?1:0));a.setSelection(g,e);return!0}},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()}};c.TextActions=
e;f.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 k.KeyBinding("t",!0,!1,!0),"trimTrailingWhitespaces");a.setAction("trimTrailingWhitespaces",function(){return this.trimTrailingWhitespaces()}.bind(this),{name:i.trimTrailingWhitespaces});a.setKeyBinding(new k.KeyBinding(191,!0),"toggleLineComment");a.setAction("toggleLineComment",
function(){return this.toggleLineComment()}.bind(this),{name:i.toggleLineComment});a.setKeyBinding(new k.KeyBinding(191,!0,!g.isMac,!1,g.isMac),"addBlockComment");a.setAction("addBlockComment",function(){return this.addBlockComment()}.bind(this),{name:i.addBlockComment});a.setKeyBinding(new k.KeyBinding(220,!0,!g.isMac,!1,g.isMac),"removeBlockComment");a.setAction("removeBlockComment",function(){return this.removeBlockComment()}.bind(this),{name:i.removeBlockComment});a.setKeyBinding(new k.KeyBinding("[",
!1,!1,!1,!1,"keypress"),"autoPairSquareBracket");a.setAction("autoPairSquareBracket",function(){return this.autoPairBrackets("[","]")}.bind(this));a.setKeyBinding(new k.KeyBinding("]",!1,!1,!1,!1,"keypress"),"skipClosingSquareBracket");a.setAction("skipClosingSquareBracket",function(){return this.skipClosingBracket("]")}.bind(this));a.setKeyBinding(new k.KeyBinding("<",!1,!1,!1,!1,"keypress"),"autoPairAngleBracket");a.setAction("autoPairAngleBracket",function(){return this.autoPairBrackets("<",">")}.bind(this));
a.setKeyBinding(new k.KeyBinding(">",!1,!1,!1,!1,"keypress"),"skipClosingAngleBracket");a.setAction("skipClosingAngleBracket",function(){return this.skipClosingBracket(">")}.bind(this));a.setKeyBinding(new k.KeyBinding("(",!1,!1,!1,!1,"keypress"),"autoPairParentheses");a.setAction("autoPairParentheses",function(){return this.autoPairBrackets("(",")")}.bind(this));a.setKeyBinding(new k.KeyBinding(")",!1,!1,!1,!1,"keypress"),"skipClosingParenthesis");a.setAction("skipClosingParenthesis",function(){return this.skipClosingBracket(")")}.bind(this));
a.setKeyBinding(new k.KeyBinding("{",!1,!1,!1,!1,"keypress"),"autoPairBraces");a.setAction("autoPairBraces",function(){return this.autoPairBrackets("{","}")}.bind(this));a.setKeyBinding(new k.KeyBinding("}",!1,!1,!1,!1,"keypress"),"skipClosingBrace");a.setAction("skipClosingBrace",function(){return this.skipClosingBracket("}")}.bind(this));a.setKeyBinding(new k.KeyBinding("'",!1,!1,!1,!1,"keypress"),"autoPairSingleQuotation");a.setAction("autoPairSingleQuotation",function(){return this.autoPairQuotations("'")}.bind(this));
a.setKeyBinding(new k.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,c=a.getTextView();if(c.getOptions("readonly"))return!1;var d=a.getSelection();if(d.start===d.end){for(var e=a.getModel(),f=e.getLineAtOffset(d.start),g=e.getLine(f,!1),h=e.getLineStart(f),i=0,j=d.start-
h,k;i<j&&((k=g.charCodeAt(i))===32||k===9);)i++;var h=g.substring(0,i),c=c.getOptions("tabSize","expandTab"),v=c.expandTab?Array(c.tabSize+1).join(" "):"\t",c=e.getLineDelimiter(),n=/^[\s]*\/\*[\*]*[\s]*$/,w=/^[\s]*\*/,x=/\*\/[\s]*$/,y=g.substring(0,j),F=g.substring(j),H;if(this.smartIndentation&&g.charCodeAt(H=y.trimRight().length-1)===123)return e=j-H-1,F=F.length-F.trimLeft().length,g=g.charCodeAt(j+F)===125?c+h+v+c+h:c+h+v,a.setText(g,d.start-e,d.end+F),a.setCaretOffset(d.start+c.length+h.length+
v.length-e),!0;else if(this.autoCompleteComments&&!x.test(y)&&(n.test(y)||w.test(y))){if(i=n.exec(y)){g=c+h+" * ";g+=x.test(F)?F.substring(0,F.length-2).trim():F.trim();if(e.getLineCount()===f+1||!w.test(e.getLine(f+1)))g+=c+h+" */";a.setText(g,d.start,d.end+F.length);a.setCaretOffset(d.start+c.length+h.length+3);return!0}if(i=w.exec(y))for(f-=1;f>=0;f--)if(i=e.getLine(f,!1),n.test(i))return x.test(F)||g.charCodeAt(j)===47?(g=c+h+"*"+F,h=d.start+c.length+h.length+1):(g=c+h+"* "+F,h=d.start+c.length+
h.length+2),a.setText(g,d.start,d.end+F.length),a.setCaretOffset(h),!0;else if(!w.test(i))break}else if(x.test(y)&&h.charCodeAt(h.length-1)===32)return g=c+h.substring(0,h.length-1),a.setText(g,d.start,d.end),a.setCaretOffset(d.start+g.length),!0;else if(i>0){for(i=j;i<g.length&&((k=g.charCodeAt(i++))===32||k===9);)d.end++;a.setText(e.getLineDelimiter()+h,d.start,d.end);return!0}}return!1},addBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var c=a.getModel(),
d=a.getSelection(),e=this._findEnclosingComment(c,d.start,d.end);if(e.commentStart!==void 0&&e.commentEnd!==void 0)return!0;c=c.getText(d.start,d.end);if(c.length===0)return!0;var e=c.length,c=c.replace(/\/\*|\*\//g,""),f=c.length;a.setText("/*"+c+"*/",d.start,d.end);a.setSelection(d.start+2,d.end+2+(f-e));return!0},autoPairBrackets:function(a,c){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 d=this.editor;if(d.getTextView().getOptions("readonly"))return!1;var e=d.getSelection(),f=d.getModel(),g=d.getCaretOffset()===f.getCharCount()?"":f.getText(e.start,e.start+1).trim(),h=/^$|[)}\]>]/;if(e.start===e.end&&h.test(g))return d.setText(a+c,e.start,e.start),d.setCaretOffset(e.start+1),!0;else if(e.start!==e.end)return f=f.getText(e.start,e.end),d.setText(a+f+c,e.start,e.end),d.setSelection(e.start+1,e.end+1),!0;return!1},autoPairQuotations:function(a){if(!this.autoPairQuotation)return!1;
var c=this.editor;if(c.getTextView().getOptions("readonly"))return!1;var d=c.getSelection(),e=c.getModel(),f=c.getCaretOffset(),g=f===0?"":e.getText(d.start-1,d.start).trim(),h=f===e.getCharCount()?"":e.getText(d.start,d.start+1).trim(),f=/^"$|^'$/,i=/\w/,j=/^$|[)}\]>]/;if(d.start!==d.end){e=e.getText(d.start,d.end);if(f.test(e))return!1;c.setText(a+e+a,d.start,d.end);c.setSelection(d.start+1,d.end+1)}else if(h===a)c.setCaretOffset(d.start+1);else if(g===a||f.test(h)||i.test(g)||!j.test(h))return!1;
else c.setText(a+a,d.start,d.start),c.setCaretOffset(d.start+1);return!0},contentAssistProposalApplied:function(a){a=a.data.proposal;if(a.positions&&a.positions.length>0&&this.linkedMode){for(var c=[],d=0;d<a.positions.length;++d)c[d]={positions:[{offset:a.positions[d].offset,length:a.positions[d].length}]};this.linkedMode.enterLinkedMode({groups:c,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 c=a.getSelection();if(c.start!==c.end)return!1;var d=a.getModel(),e=a.getCaretOffset(),f=e===0?"":d.getText(c.start-1,c.start),d=e===d.getCharCount()?"":d.getText(c.start,c.start+1);(f==="("&&d===")"||f==="["&&d==="]"||f==="{"&&d==="}"||f==="<"&&d===">"||f==='"'&&d==='"'||f==="'"&&d==="'")&&a.setText("",c.start,c.start+
1);return!1},_findEnclosingComment:function(a,c,d){var e=a.getLineAtOffset(c),f=a.getLineAtOffset(d),g,h,i,j,k,v;for(g=e;g>=0;g--)if(h=a.getLine(g),i=g===e?c-a.getLineStart(e):h.length,j=h.lastIndexOf("/*",i),h=h.lastIndexOf("*/",i),h>j)break;else if(j!==-1){k=a.getLineStart(g)+j;break}for(g=f;g<a.getLineCount();g++)if(h=a.getLine(g),i=g===f?d-a.getLineStart(f):0,j=h.indexOf("/*",i),h=h.indexOf("*/",i),j!==-1&&j<h)break;else if(h!==-1){v=a.getLineStart(g)+h;break}return{commentStart:k,commentEnd:v}},
lineStart:function(){for(var a=this.editor,c=a.getModel(),d=a.getCaretOffset(),e=c.getLineAtOffset(d),f=c.getLineStart(e),c=c.getLine(e),e=0;e<c.length;e++){var g=c.charCodeAt(e);if(!(g===32||g===9))break}e+=f;return d!==e?(a.setSelection(e,e),!0):!1},removeBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var c=a.getModel(),d=a.getSelection(),e=c.getText(d.start,d.end),f,g,h;for(h=0;h<e.length;h++)if(e.substring(h,h+2)==="/*"){f=d.start+h;break}for(;h<e.length;h++)if(e.substring(h,
h+2)==="*/"){g=d.start+h;break}if(f!==void 0&&g!==void 0)a.setText(c.getText(f+2,g),f,g+2),a.setSelection(f,g);else{e=this._findEnclosingComment(c,d.start,d.end);if(e.commentStart===void 0||e.commentEnd===void 0)return!0;c=c.getText(e.commentStart+2,e.commentEnd);a.setText(c,e.commentStart,e.commentEnd+2);a.setSelection(d.start-2,d.end-2)}return!0},toggleLineComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;for(var c=a.getModel(),d=a.getSelection(),e=c.getLineAtOffset(d.start),
f=c.getLineAtOffset(d.end>d.start?d.end-1:d.end),g=!0,h=[],i,j,k=e;k<=f;k++)if(i=c.getLine(k,!0),h.push(i),!g||(j=i.indexOf("//"))===-1)g=!1;else if(j!==0){var v;for(v=0;v<j;v++)if(g=i.charCodeAt(v),!(g===32||g===9))break;g=v===j}k=c.getLineStart(e);v=c.getLineEnd(f,!0);if(g){for(g=0;g<h.length;g++)i=h[g],j=i.indexOf("//"),h[g]=i.substring(0,j)+i.substring(j+2);h=h.join("");i=c.getLineStart(f);c=k===d.start?d.start:d.start-2;d=d.end-2*(f-e+1)+(d.end===i+1?2:0)}else h.splice(0,0,""),h=h.join("//"),
c=k===d.start?d.start:d.start+2,d=d.end+2*(f-e+1);a.setText(h,k,v);a.setSelection(c,d);return!0},trimTrailingWhitespaces:function(){var a=this.editor,c=a.getModel(),d=a.getSelection();a.getTextView().setRedraw(!1);a.getUndoStack().startCompoundChange();for(var e=/(\s+$)/,f=c.getLineCount(),g=0;g<f;g++){var h=c.getLine(g),i=e.exec(h);if(i){var j=c.getLineStart(g),h=i[0].length,i=j+i.index;c.setText("",i,i+h);if(d.start>i)d.start=Math.max(i,d.start-h);if(d.start!==d.end&&d.end>i)d.end=Math.max(i,d.end-
h)}}a.getUndoStack().endCompoundChange();a.getTextView().setRedraw(!0);a.setSelection(d.start,d.end,!1)},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},skipClosingBracket:function(a){var c=this.editor;if(c.getTextView().getOptions("readonly"))return!1;var d=c.getSelection(),e=c.getModel();return(c.getCaretOffset()===e.getCharCount()?"":e.getText(d.start,d.start+1))===a?(c.setCaretOffset(d.start+1),!0):!1},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()},
setAutoPairParentheses:function(a){this.autoPairParentheses=a},setAutoPairBraces:function(a){this.autoPairBraces=a},setAutoPairSquareBrackets:function(a){this.autoPairSquareBrackets=a},setAutoPairAngleBrackets:function(a){this.autoPairAngleBrackets=a},setAutoPairQuotations:function(a){this.autoPairQuotation=a},setAutoCompleteComments:function(a){this.autoCompleteComments=a},setSmartIndentation:function(a){this.smartIndentation=a}};c.SourceCodeActions=f;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 c});
define("orion/editor/undoStack",[],function(){function i(h,a,g,e,f){this.model=h;this.offset=a;this.text=g;this.previousText=e;this.type=f}function k(h){this.owner=h;this.changes=[]}function j(h,a){this.size=a!==void 0?a:100;this.reset();var g=this;this._listener={onChanging:function(a){g._onChanging(a)},onDestroy:function(a){g._onDestroy(a)}};if(h.getModel){var e=h.getModel();e.getBaseModel&&(e=e.getBaseModel());this.model=e;this.setView(h)}else this.shared=!0,this.model=h;this.model.addEventListener("Changing",
this._listener.onChanging)}i.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(h,a){this._doUndoRedo(this.offset,this.previousText,this.text,h,a);return!0},redo:function(h,a){this._doUndoRedo(this.offset,this.text,this.previousText,h,a);return!0},merge:function(h,a,g,e,f){if(e===this.type)if(e===1&&h===
this.offset+this.text.length)return this.text+=a,!0;else if(e===-1&&f===this.offset)return this.offset=h,this.previousText=g+this.previousText,!0;else if(e===-1&&h===this.offset)return this.previousText+=g,!0;return!1},_doUndoRedo:function(h,a,g,e,f){this.model.setText(a,h,h+g.length);f&&e&&(g=e.getModel(),g!==this.model&&(h=g.mapOffset(h,!0)),e.setSelection(h,h+a.length))}};k.prototype={getRedoChanges:function(){for(var h=[],a=0;a<this.changes.length;a++)h=h.concat(this.changes[a].getRedoChanges());
return h},getUndoChanges:function(){for(var h=[],a=this.changes.length-1;a>=0;a--)h=h.concat(this.changes[a].getUndoChanges());return h},add:function(h){this.changes.push(h)},end:function(h){if(h)this.endSelection=h.getSelection(),this.endCaret=h.getCaretOffset();(h=this.owner)&&h.end&&h.end()},undo:function(h,a){this.changes.length>1&&h&&h.setRedraw(!1);for(var g=this.changes.length-1;g>=0;g--)this.changes[g].undo(h,!1);this.changes.length>1&&h&&h.setRedraw(!0);if(a&&h){var g=this.startSelection.start,
e=this.startSelection.end;h.setSelection(this.startCaret?g:e,this.startCaret?e:g)}(g=this.owner)&&g.undo&&g.undo();return this.changes.length>0},redo:function(h,a){this.changes.length>1&&h&&h.setRedraw(!1);for(var g=0;g<this.changes.length;g++)this.changes[g].redo(h,!1);h&&h.setRedraw(!0);if(a&&h){var g=this.endSelection.start,e=this.endSelection.end;h.setSelection(this.endCaret?g:e,this.endCaret?e:g)}(g=this.owner)&&g.redo&&g.redo();return this.changes.length>0},merge:function(h,a,g,e,f){var d=this.changes.length;
return d>0?this.changes[d-1].merge(h,a,g,e,f):!1},start:function(h){if(h)this.startSelection=h.getSelection(),this.startCaret=h.getCaretOffset();(h=this.owner)&&h.start&&h.start()}};j.prototype={destroy:function(){this._onDestroy()},add:function(h){this.compoundChange?this.compoundChange.add(h):(this.stack.splice(this.index,this.stack.length-this.index,h),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 h=[],a=this.index;a<this.stack.length;a++)h=h.concat(this.stack[a].getRedoChanges());
return h},getUndoChanges:function(){this._commitUndo();for(var h=[],a=this.index;a>=0;a--)h=h.concat(this.stack[a].getUndoChanges());return h},undo:function(){this._commitUndo();var h;h=!1;this._ignoreUndo=!0;do{if(this.index<=0)break;h=this.stack[--this.index]}while(!(h=h.undo(this.view,!0)));this._ignoreUndo=!1;return h},redo:function(){this._commitUndo();var h;this._ignoreUndo=!0;do{if(this.index>=this.stack.length)break;h=this.stack[this.index++]}while(!h.redo(this.view,!0));this._ignoreUndo=
!1;return!0},reset:function(){this.index=0;this.cleanChange=void 0;this.stack=[];this._ignoreUndo=!1;this._compoundChange=void 0},setView:function(h){if(this.view!==h)this.view&&h.removeEventListener("Destroy",this._listener.onDestroy),(this.view=h)&&h.addEventListener("Destroy",this._listener.onDestroy)},startCompoundChange:function(h){this._commitUndo();h=new k(h);this.add(h);this.compoundChange=h;this.compoundChange.start(this.view);return this.compoundChange},_commitUndo:function(){this.endCompoundChange()},
_onDestroy:function(h){(!h||!this.shared)&&this.model.removeEventListener("Changing",this._listener.onChanging);if(this.view)this.view.removeEventListener("Destroy",this._listener.onDestroy),this.view=null},_onChanging:function(h){if(!this._ignoreUndo){var a=h.text,g=h.start,e=h.addedCharCount,f=h.removedCharCount,h=g+f,d=0;e===0&&f===1?d=-1:e===1&&f===0&&(d=1);e=this.stack.length;f=this.model.getText(g,h);(!(e>0&&this.index===e)||!this.stack[e-1].merge(g,a,f,d,h))&&this.add(new i(this.model,g,a,
f,d))}}};return{UndoStack:j}});
define("orion/editor/rulers",["i18n!orion/editor/nls/messages","orion/editor/annotations","orion/editor/tooltip","orion/util"],function(i,k,j,h){function a(a,b,d,e){this._location=b||"left";this._overview=d||"page";this._rulerStyle=e;this._view=null;var f=this;this._listener={onTextModelChanged:function(a){f._onTextModelChanged(a)},onAnnotationModelChanged:function(a){f._onAnnotationModelChanged(a)}};this.setAnnotationModel(a)}function g(c,b,d,e,f){a.call(this,c,b,"page",d);this._oddStyle=e||{style:{backgroundColor:"white"}};
this._evenStyle=f||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._firstLine=1}function e(c,b,d){a.call(this,c,b,"page",d)}function f(c,b,d){a.call(this,c,b,"document",d)}function d(a,b,d){e.call(this,a,b,d)}a.prototype={getAnnotations:function(a,b){var d=this._annotationModel;if(!d)return[];var e=this._view.getModel(),f=e.getLineStart(a),g=e.getLineEnd(b-1),h=e;e.getBaseModel&&(h=e.getBaseModel(),f=e.mapOffset(f),g=e.mapOffset(g));for(var i=[],d=this.getAnnotationsByType(d,f,g),f=0;f<
d.length;f++)for(var g=d[f],j=h.getLineAtOffset(g.start),k=h.getLineAtOffset(Math.max(g.start,g.end-1)),u=j;u<=k;u++){var v=u;if(e!==h){v=h.getLineStart(u);v=e.mapOffset(v,!0);if(v===-1)continue;v=e.getLineAtOffset(v)}if(a<=v&&v<b){var n=this._mergeAnnotation(i[v],g,u-j,k-j+1);n&&(i[v]=n)}}if(!this._multiAnnotation&&this._multiAnnotationOverlay)for(var w in i)i[w]._multiple&&(i[w].html+=this._multiAnnotationOverlay.html);return i},getAnnotationModel:function(){return this._annotationModel},getLocation:function(){return this._location},
getOverview:function(){return this._overview},getRulerStyle:function(){return this._rulerStyle},getView:function(){return this._view},getWidestAnnotation:function(){return null},setAnnotationModel:function(a){this._annotationModel&&this._annotationModel.removEventListener("Changed",this._listener.onAnnotationModelChanged);(this._annotationModel=a)&&this._annotationModel.addEventListener("Changed",this._listener.onAnnotationModelChanged)},setMultiAnnotation:function(a){this._multiAnnotation=a},setMultiAnnotationOverlay:function(a){this._multiAnnotationOverlay=
a},setView:function(a){this._onTextModelChanged&&this._view&&this._view.removeEventListener("ModelChanged",this._listener.onTextModelChanged);this._view=a;this._onTextModelChanged&&this._view&&this._view.addEventListener("ModelChanged",this._listener.onTextModelChanged)},onClick:function(a){if(a!==void 0){var b=this._view,d=b.getModel(),e=d,f=d.getLineStart(a),g=f,h=f,i=this._annotationModel;if(i){b=b.getSelection();h=d.getLineEnd(a,!0);if(f<=b.start&&b.start<h)f=b.start;d.getBaseModel&&(f=d.mapOffset(f),
h=d.mapOffset(h),e=d.getBaseModel());for(var k,h=i.getAnnotations(f,h),i=null;!k&&h.hasNext();)b=h.next(),this.isAnnotationTypeVisible(b.type)&&(i=b,b.start<=f||(k=b));if(i&&i.groupId!==void 0)this._currentClickGroup=this._currentClickGroup===i.groupId?null:i.groupId,this._setCurrentGroup(a);k&&e.getLineAtOffset(k.start)===e.getLineAtOffset(f)?(f=k.start,h=k.end):h=f=g;d.getBaseModel&&(f=d.mapOffset(f,!0),h=d.mapOffset(h,!0))}(a=j.Tooltip.getTooltip(this._view))&&a.setTarget(null);this._view.setSelection(h,
f,1/3,function(){})}},onDblClick:function(){},onMouseMove:function(a,b){var d=j.Tooltip.getTooltip(this._view);if(d&&!(d.isVisible()&&this._tooltipLineIndex===a)){this._tooltipLineIndex=a;var e=this;d.setTarget({y:b.clientY,getTooltipInfo:function(){return e._getTooltipInfo(e._tooltipLineIndex,this.y)}})}},onMouseOver:function(a,b){this.onMouseMove(a,b);this._currentClickGroup||this._setCurrentGroup(a)},onMouseOut:function(){this._currentClickGroup||this._setCurrentGroup(-1);var a=j.Tooltip.getTooltip(this._view);
a&&a.setTarget(null)},_getTooltipInfo:function(a,b){if(a!==void 0){var d=this._view,e=d.getModel(),f=this._annotationModel,g=[];if(f){var g=e.getLineStart(a),h=e.getLineEnd(a);e.getBaseModel&&(g=e.mapOffset(g),h=e.mapOffset(h));g=this.getAnnotationsByType(f,g,h)}f=this._getTooltipContents(a,g);if(!f)return null;f={contents:f,anchor:this.getLocation()};g=d.getClientArea();g.y=this.getOverview()==="document"?d.convert({y:b},"view","document").y:d.getLocationAtOffset(e.getLineStart(a)).y;d.convert(g,
"document","page");f.x=g.x;f.y=g.y;f.anchor==="right"&&(f.x+=g.width);return f}},_getTooltipContents:function(a,b){return b},_onAnnotationModelChanged:function(a){function b(a){for(var b=0;b<a.length;b++)if(f.isAnnotationTypeVisible(a[b].type)){var c=a[b].start,g=a[b].end;e.getBaseModel&&(c=e.mapOffset(c,!0),g=e.mapOffset(g,!0));c!==-1&&g!==-1&&d.redrawLines(e.getLineAtOffset(c),e.getLineAtOffset(Math.max(c,g-1))+1,f)}}var d=this._view;if(d){var e=d.getModel(),f=this,g=e.getLineCount();a.textModelChangedEvent?
(a=a.textModelChangedEvent.start,e.getBaseModel&&(a=e.mapOffset(a,!0)),a=e.getLineAtOffset(a),d.redrawLines(a,g,f)):(b(a.added),b(a.removed),b(a.changed))}},_mergeAnnotation:function(a,b,d){a||(a={});if(d===0)if(a.html&&b.html){if(b.html!==a.html&&!a._multiple&&this._multiAnnotation)a.html=this._multiAnnotation.html;a._multiple=!0}else a.html=b.html;a.style=this._mergeStyle(a.style,b.style);return a},_mergeStyle:function(a,b){if(b){a||(a={});a.styleClass&&b.styleClass&&a.styleClass!==b.styleClass?
a.styleClass+=" "+b.styleClass:a.styleClass=b.styleClass;var d;if(b.style){if(!a.style)a.style={};for(d in b.style)a.style[d]===void 0&&(a.style[d]=b.style[d])}if(b.attributes){if(!a.attributes)a.attributes={};for(d in b.attributes)a.attributes[d]===void 0&&(a.attributes[d]=b.attributes[d])}}return a},_setCurrentGroup:function(a){var b=this._annotationModel,d=null,e=b.getTextModel(),f,g=this._currentGroupAnnotation;if(a!==-1){var h=e.getLineStart(a),i=e.getLineEnd(a);e.getBaseModel&&(h=e.mapOffset(h),
i=e.mapOffset(i));for(f=b.getAnnotations(h,i);f.hasNext();)if(e=f.next(),this.isAnnotationTypeVisible(e.type)&&e.start<=h&&e.end>=i&&e.groupId!==void 0){d=e;break}if(g&&d&&g.groupId===d.groupId)return}this._currentGroupAnnotation=null;g&&b.removeAnnotations(g.groupType);if(d&&a!==-1){this._currentGroupAnnotation=d;f=b.getAnnotations();for(a=[];f.hasNext();)e=f.next(),delete e.groupAnnotation,e.groupId===d.groupId&&(e=e.createGroupAnnotation(),a.push(e));b.replaceAnnotations(null,a)}}};k.AnnotationTypeList.addMixin(a.prototype);
g.prototype=new a;g.prototype.getAnnotations=function(c,b){for(var d=a.prototype.getAnnotations.call(this,c,b),e=this._view.getModel(),f=c;f<b;f++){var g=f&1?this._oddStyle:this._evenStyle,h=f;e.getBaseModel&&(h=e.getLineStart(h),h=e.getBaseModel().getLineAtOffset(e.mapOffset(h)));d[f]||(d[f]={});d[f].html=this._firstLine+h+"";if(!d[f].style)d[f].style=g}return d};g.prototype.getWidestAnnotation=function(){var a=this._view.getModel().getLineCount();return this.getAnnotations(a-1,a)[a-1]};g.prototype.setFirstLine=
function(a){this._firstLine=a!==void 0?a:1};g.prototype._onTextModelChanged=function(a){var a=a.start,b=this._view.getModel(),d=(this._firstLine+(b.getBaseModel?b.getBaseModel().getLineCount():b.getLineCount())-1+"").length;if(this._numOfDigits!==d)this._numOfDigits=d,this._view.redrawLines(b.getLineAtOffset(a),b.getLineCount(),this)};e.prototype=new a;f.prototype=new a;f.prototype.getRulerStyle=function(){var a={style:{lineHeight:"1px",fontSize:"1px"}};return a=this._mergeStyle(a,this._rulerStyle)};
f.prototype._getTooltipContents=function(c,b){if(b.length===0){var d=this._view.getModel(),e=c;d.getBaseModel&&(e=d.getLineStart(e),e=d.getBaseModel().getLineAtOffset(d.mapOffset(e)));return h.formatMessage(i.line,e+1)}return a.prototype._getTooltipContents.call(this,c,b)};f.prototype._mergeAnnotation=function(a,b,d,e){if(d===0){if(!a)a={html:"&nbsp;",style:{style:{height:3*e+"px"}}},a.style=this._mergeStyle(a.style,b.overviewStyle);return a}};d.prototype=new e;d.prototype.onClick=function(a){if(a!==
void 0){var b=this._annotationModel;if(b){var d=this._view.getModel(),e=d.getLineStart(a),a=d.getLineEnd(a,!0);d.getBaseModel&&(e=d.mapOffset(e),a=d.mapOffset(a),d=d.getBaseModel());for(var f,b=b.getAnnotations(e,a);!f&&b.hasNext();)a=b.next(),this.isAnnotationTypeVisible(a.type)&&(f=a);f&&d.getLineAtOffset(f.start)===d.getLineAtOffset(e)&&((d=j.Tooltip.getTooltip(this._view))&&d.setTarget(null),f.expanded?f.collapse():f.expand())}}};d.prototype._getTooltipContents=function(a,b){return b.length===
1&&b[0].expanded?null:e.prototype._getTooltipContents.call(this,a,b)};d.prototype._onAnnotationModelChanged=function(a){function b(a){for(h=0;h<a.length;h++)if(g.isAnnotationTypeVisible(a[h].type)){var b=a[h].start;f.getBaseModel&&(b=f.mapOffset(b,!0));b!==-1&&(j=Math.min(j,f.getLineAtOffset(b)))}}if(a.textModelChangedEvent)e.prototype._onAnnotationModelChanged.call(this,a);else{var d=this._view;if(d){var f=d.getModel(),g=this,h,i=f.getLineCount(),j=i;b(a.added);b(a.removed);b(a.changed);a=d.getRulers();
for(h=0;h<a.length;h++)d.redrawLines(j,i,a[h])}}};return{Ruler:a,AnnotationRuler:e,LineNumberRuler:g,OverviewRuler:f,FoldingRuler:d}});
define("orion/editor/textDND",["orion/util"],function(i){function k(i,h){this._view=i;this._undoStack=h;this._dragSelection=null;this._dropOffset=-1;this._dropText=null;var a=this;this._listener={onDragStart:function(g){a._onDragStart(g)},onDragEnd:function(g){a._onDragEnd(g)},onDragEnter:function(g){a._onDragEnter(g)},onDragOver:function(g){a._onDragOver(g)},onDrop:function(g){a._onDrop(g)},onDestroy:function(g){a._onDestroy(g)}};i.addEventListener("DragStart",this._listener.onDragStart);i.addEventListener("DragEnd",
this._listener.onDragEnd);i.addEventListener("DragEnter",this._listener.onDragEnter);i.addEventListener("DragOver",this._listener.onDragOver);i.addEventListener("Drop",this._listener.onDrop);i.addEventListener("Destroy",this._listener.onDestroy)}k.prototype={destroy:function(){var i=this._view;if(i)i.removeEventListener("DragStart",this._listener.onDragStart),i.removeEventListener("DragEnd",this._listener.onDragEnd),i.removeEventListener("DragEnter",this._listener.onDragEnter),i.removeEventListener("DragOver",
this._listener.onDragOver),i.removeEventListener("Drop",this._listener.onDrop),i.removeEventListener("Destroy",this._listener.onDestroy),this._view=null},_onDestroy:function(){this.destroy()},_onDragStart:function(i){var h=this._view,a=h.getSelection(),h=h.getModel();if(h.getBaseModel)a.start=h.mapOffset(a.start),a.end=h.mapOffset(a.end),h=h.getBaseModel();if(h=h.getText(a.start,a.end))this._dragSelection=a,i.event.dataTransfer.effectAllowed="copyMove",i.event.dataTransfer.setData("Text",h)},_onDragEnd:function(j){if(this._dragSelection){var h=
this._view,a=j.event.dataTransfer.dropEffect;if(!i.isFirefox&&(a!=="none"||this._dropText))a=j.event.dataTransfer.dropEffect=this._dropEffect;this._undoStack&&this._undoStack.startCompoundChange();(j=a==="move")&&h.setText("",this._dragSelection.start,this._dragSelection.end);if(this._dropText){var a=this._dropText,g=this._dropOffset;if(j)if(g>=this._dragSelection.end)g-=this._dragSelection.end-this._dragSelection.start;else if(g>=this._dragSelection.start)g=this._dragSelection.start;h.setText(a,
g,g);h.setSelection(g,g+a.length);this._dropText=null;this._dropOffset=-1}this._undoStack&&this._undoStack.endCompoundChange()}this._dragSelection=null},_onDragEnter:function(i){this._onDragOver(i)},_onDragOver:function(j){var h=j.event.dataTransfer.types,a=!this._view.getOptions("readonly");a&&h&&(a=h.contains?h.contains("text/plain")||h.contains("Text"):h.indexOf("text/plain")!==-1||h.indexOf("Text")!==-1);if(a){if(!i.isFirefox)this._dropEffect=j.event.dataTransfer.dropEffect=(i.isMac?j.event.altKey:
j.event.ctrlKey)?"copy":"move"}else j.event.dataTransfer.dropEffect="none"},_onDrop:function(j){var h=this._view,a=j.event.dataTransfer.getData("Text");if(a){if(!i.isFirefox)j.event.dataTransfer.dropEffect=this._dropEffect;j=h.getOffsetAtLocation(j.x,j.y);this._dragSelection?(this._dropOffset=j,this._dropText=a):(h.setText(a,j,j),h.setSelection(j,j+a.length))}}};return{TextDND:k}});
define("orion/editor/templates",[],function(){function i(i,h,a,g){this.prefix=i;this.description=h;this.template=a;this.name=g;this._parse()}function k(i,h){this._keywords=i||[];this._templates=[];this.addTemplates(h||[])}i.prototype={getProposal:function(i,h,a){var i=h-i.length,h={},g,e=a.delimiter!==void 0?a.delimiter:"\n";a.indentation&&(e+=a.indentation);for(var f=a.tab!==void 0?a.tab:"\t",d=0,c=this.variables,b=this.segments,a=[],l=0;l<b.length;l++){var k=b[l],s=c[k];if(s!==void 0)switch(k){case "${tab}":k=
f;break;case "${delimiter}":k=e;break;case "${cursor}":k="";g=d;break;default:var o=h[k];o||(o=h[k]={data:s.data,positions:[]});k=s.substitution;o.data&&o.data.values&&(k=o.data.values[0]);o.positions.push({offset:i+d,length:k.length})}a.push(k);d+=k.length}var e=[],q;for(q in h)h.hasOwnProperty(q)&&e.push(h[q]);a=a.join("");if(g===void 0)g=a.length;return{proposal:a,name:this.name,description:this.description,groups:e,escapePosition:i+g,style:"noemphasis"}},match:function(i){return this.prefix.indexOf(i)===
0},_parse:function(){var i=this.template,h=[],a={},g,e=0,i=i.replace(/\n/g,"${delimiter}"),i=i.replace(/\t/g,"${tab}");i.replace(/\$\{((?:[^\\}]+|\\.))*\}/g,function(f,d,c){var b=f.substring(2,f.length-1),d=f,l=b,k=null,s=l.indexOf(":");s!==-1&&(l=l.substring(0,s),d="${"+l+"}",k=JSON.parse(b.substring(s+1).replace("\\}","}").trim()));(b=a[d])||(b=a[d]={});b.substitution=l;if(k)b.data=k;(g=i.substring(e,c))&&h.push(g);h.push(d);e=c+f.length;return l});(g=i.substring(e,i.length))&&h.push(g);this.segments=
h;this.variables=a}};k.prototype={addTemplates:function(j){for(var h=this.getTemplates(),a=0;a<j.length;a++)h.push(new i(j[a].prefix,j[a].description,j[a].template,j[a].name))},computeProposals:function(i,h,a){var g=this.getPrefix(i,h,a),e=[];this.isValid(g,i,h,a)&&(e=e.concat(this.getTemplateProposals(g,h,a)),e=e.concat(this.getKeywordProposals(g)));return e},getKeywords:function(){return this._keywords},getKeywordProposals:function(i){var h=[],a=this.getKeywords();if(a){for(var g=0;g<a.length;g++)a[g].indexOf(i)===
0&&h.push({proposal:a[g].substring(i.length),description:a[g],style:"noemphasis_keyword"});0<h.length&&h.splice(0,0,{proposal:"",description:"Keywords",style:"noemphasis_title_keywords",unselectable:!0})}return h},getPrefix:function(i,h,a){return a.prefix},getTemplates:function(){return this._templates},getTemplateProposals:function(i,h,a){for(var g=[],e=this.getTemplates(),f=0;f<e.length;f++){var d=e[f];d.match(i)&&(d=d.getProposal(i,h,a),this.removePrefix(i,d),g.push(d))}0<g.length&&(g.sort(function(a,
b){return a.name<b.name?-1:a.name>b.name?1:0}),g.splice(0,0,{proposal:"",description:"Templates",style:"noemphasis_title",unselectable:!0}));return g},removePrefix:function(i,h){if(!(h.overwrite=h.proposal.substring(0,i.length)!==i))h.proposal=h.proposal.substring(i.length)},isValid:function(){return!0}};return{Template:i,TemplateContentAssist:k}});
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(i,k,j,h,a,g){function e(a,c,b){var e=a.getTextView();j.KeyMode.call(this,e);this.editor=a;this.undoStack=c;this.contentAssist=b;this.linkedModeModel=null;e.setAction("linkedModeEnter",function(){this.exitLinkedMode(!0);return!0}.bind(this));e.setAction("linkedModeCancel",function(){this.exitLinkedMode(!1);
return!0}.bind(this));e.setAction("linkedModeNextGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup((a.selectedGroupIndex+1)%a.groups.length);return!0}.bind(this));e.setAction("linkedModePreviousGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup(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,g=0;g<d.length;++g){f=d[g];e=f.position;var h=e.offset<=b&&b<=e.offset+e.length;h&&!f.ansestor?(e.offset+=c,
e.length+=a,c+=a):(e.offset+=c,f.ansestor&&h&&(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,g;e;)if(f=this._getPositionChanged(e,c,d),g=f.position,g===void 0||g.model!==e)this.exitLinkedMode(!1),e=this.linkedModeModel;else break;if(e){var h=this._compoundChange;h?h.owner.model===e&&h.owner.group===g.group||
(this.endUndo(),this.startUndo()):this.startUndo();e.selectedGroupIndex=g.group;var h=0,i=a.text.length-(d-c);f=f.positions;var j;c-=g.position.offset;for(var l=d-g.position.offset,k=0;k<f.length;++k)if(j=f[k],d=j.position,j.oldOffset=d.offset,j.model===e&&j.group===g.group?(d.offset+=h,d.length+=i,h+=i):(d.offset+=h,j.ansestor&&(d.length+=g.count*i)),j.escape)j.model.escapePosition=d.offset;this.ignoreVerify=!0;for(k=f.length-1;k>=0;k--)j=f[k],j.model===e&&j.group===g.group&&b.setText(a.text,j.oldOffset+
c,j.oldOffset+l);this.ignoreVerify=!1;a.text=null;this._updateAnnotations(f)}}}.bind(this)}}var f={};e.prototype=new j.KeyMode;g.mixin(e.prototype,{createKeyBindings:function(){var a=k.KeyBinding,c=[];c.push({actionID:"linkedModeEnter",keyBinding:new a(13)});c.push({actionID:"linkedModeCancel",keyBinding:new a(27)});c.push({actionID:"linkedModeNextGroup",keyBinding:new a(9)});c.push({actionID:"linkedModePreviousGroup",keyBinding:new a(9,!1,!0)});return c},enterLinkedMode:function(a){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(i.linkedModeEntered,null,!0)}this._sortedPositions=null;if(this.linkedModeModel)a.previousModel=this.linkedModeModel,a.parentGroup=this.linkedModeModel.selectedGroupIndex,this.linkedModeModel.nextModel=a;this.linkedModeModel=
a;this.selectLinkedGroup(0)},exitLinkedMode:function(a){if(this.isActive()){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 b=this.editor,e=b.getTextView();e.removeKeyMode(this);e.removeEventListener("Verify",this.linkedModeListener.onVerify);e.removeEventListener("ModelChanged",
this.linkedModeListener.onModelChanged);e=this.contentAssist;e.removeEventListener("Activating",this.linkedModeListener.onActivating);e.offset=void 0;this.editor.reportStatus(i.linkedModeExited,null,!0);a&&b.setCaretOffset(c.escapePosition,!1)}this.selectLinkedGroup(0)}},startUndo:function(){if(this.undoStack){var a=this,c=this.linkedModeModel;this._compoundChange=this.undoStack.startCompoundChange({model:c,group:c.selectedGroupIndex,end:function(){a._compoundChange=null}})}},endUndo:function(){this.undoStack&&
this.undoStack.endCompoundChange()},isActive:function(){return!!this.linkedModeModel},isStatusActive:function(){return!!this.linkedModeModel},selectLinkedGroup:function(d){var c=this.linkedModeModel;if(c){c.selectedGroupIndex=d;var d=c.groups[d],b=d.positions[0],e=this.editor;e.setSelection(b.offset,b.offset+b.length);if(c=this.contentAssist)if(c.offset=void 0,d.data&&d.data.type==="link"&&d.data.values)(this._groupContentAssistProvider=new a.TemplateContentAssist(d.data.values)).getPrefix=function(){var a=
e.getSelection();return a.start===a.end&&(a=e.getCaretOffset(),b.offset<=a&&a<=b.offset+b.length)?e.getText(b.offset,a):""},c.offset=b.offset,c.deactivate(),c.activate();else if(this._groupContentAssistProvider)this._groupContentAssistProvider=null,c.deactivate()}this._updateAnnotations()},_getModelPositions:function(a,c,b){for(var e=c.groups,f=0;f<e.length;f++)for(var g=e[f].positions,h=0;h<g.length;h++){var i=g[h];b&&(i={offset:i.offset+b,length:i.length});i={index:h,group:f,count:g.length,model:c,
position:i};a.push(i);if(c.nextModel&&c.nextModel.parentGroup===f)i.ansestor=!0,this._getModelPositions(a,c.nextModel,(b||0)+g[h].offset-g[0].offset)}},_getSortedPositions:function(a){var c=this._sortedPositions;if(!c){for(c=[];a.previousModel;)a=a.previousModel;for(this._getModelPositions(c,a);a;)a.escapePosition!==void 0&&c.push({escape:!0,model:a,position:{offset:a.escapePosition,length:0}}),a=a.nextModel;c.sort(function(a,c){return a.position.offset-c.position.offset});this._sortedPositions=c}return c},
_getPositionChanged:function(a,c,b){for(var e,a=this._getSortedPositions(a),f=a.length-1;f>=0;f--){var g=a[f].position;if(g.offset<=c&&b<=g.offset+g.length){e=a[f];break}}return{position:e,positions:a}},_updateAnnotations:function(a){var c=this.editor.getAnnotationModel();if(c){var b=[],e=[];c.getTextModel();for(var f=c.getAnnotations(),g;f.hasNext();)switch(g=f.next(),g.type){case h.AnnotationType.ANNOTATION_LINKED_GROUP:case h.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP:case h.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:b.push(g)}if(f=
this.linkedModeModel)for(var a=a||this._getSortedPositions(f),i=0;i<a.length;i++)if(g=a[i],g.model===f){var j=h.AnnotationType.ANNOTATION_LINKED_GROUP;g.group===f.selectedGroupIndex&&(j=g.index===0?h.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:h.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP);g=g.position;g=h.AnnotationType.createAnnotation(j,g.offset,g.offset+g.length,"");e.push(g)}c.replaceAnnotations(b,e)}}});f.LinkedMode=e;return f});
define("orion/editor/factories","orion/editor/actions,orion/editor/undoStack,orion/editor/rulers,orion/editor/annotations,orion/editor/textDND,orion/editor/linkedMode".split(","),function(i,k,j,h,a,g){function e(){}function f(){}function d(){}function c(){}function b(){}function l(){}var m={};e.prototype={createKeyBindings:function(a,b,c,d){var d=new i.TextActions(a,b,d),e=new g.LinkedMode(a,b,c),a=new i.SourceCodeActions(a,b,c,e);return{textActions:d,linkedMode:e,sourceCodeActions:a}}};m.KeyBindingsFactory=
e;f.prototype={createUndoStack:function(a){a=a.getTextView();return new k.UndoStack(a,200)}};m.UndoFactory=f;d.prototype={createLineNumberRuler:function(a){return new j.LineNumberRuler(a,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"})}};m.LineNumberRulerFactory=d;c.prototype={createFoldingRuler:function(a){return new j.FoldingRuler(a,"left",{styleClass:"ruler folding"})}};m.FoldingRulerFactory=c;b.prototype={createAnnotationModel:function(a){return new h.AnnotationModel(a)},
createAnnotationStyler:function(a,b){return new h.AnnotationStyler(a,b)},createAnnotationRulers:function(a){var b=new j.AnnotationRuler(a,"left",{styleClass:"ruler annotations"}),a=new j.OverviewRuler(a,"right",{styleClass:"ruler overview"});return{annotationRuler:b,overviewRuler:a}}};m.AnnotationFactory=b;l.prototype={createTextDND:function(b,c){return new a.TextDND(b.getTextView(),c)}};m.TextDNDFactory=l;return m});
define("orion/editor/editorFeatures",["orion/editor/factories","orion/editor/actions","orion/editor/linkedMode","orion/objects"],function(i,k,j,h){return h.mixin({},i,k,j)});
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,orion/webui/littlelib".split(","),function(i,k,j,h,a,g,e,f,d){var c,b,l;function m(a){this.textView=a;this.state=c;this.resetProviderInfoArray();var d=this;this.contentAssistListener={onModelChanging:function(a){this._latestModelChangingEvent=a}.bind(this),onSelection:function(a){this.isDeactivatingChange(this._latestModelChangingEvent,
a)?this.setState(c):this.isActive()&&(this.state===b&&this.setState(l),this.filterProposals(a));this._latestModelChangingEvent=null}.bind(this),onScroll:function(){this.setState(c)}.bind(this)};a.setKeyBinding(f.isMac?new k.KeyBinding(" ",!1,!1,!1,!0):new k.KeyBinding(" ",!0),"contentAssist");a.setKeyBinding(f.isMac?new k.KeyBinding(" ",!1,!1,!0,!0):new k.KeyBinding(" ",!0,!1,!0),"contentAssist");a.setAction("contentAssist",function(){a.getOptions("readonly")||d.activate();return!0},{name:i.contentAssist})}
function s(a,b){var c=a.textView;j.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;if(d.proposals.length===0)d.selectedIndex=-1,d.cancel();else{for(d.selectedIndex=0;d.proposals[d.selectedIndex]&&d.proposals[d.selectedIndex].unselectable;)d.selectedIndex++;if(d.proposals[d.selectedIndex]){if(d.widget){var b=!0;if(a.autoApply){for(a=d.selectedIndex+1;d.proposals[a]&&
d.proposals[a].unselectable;)a++;d.proposals[a]||(b=!1,d.contentAssist.apply(d.proposals[d.selectedIndex]))}b&&(d.widget.show(),d.widget.selectNode(d.selectedIndex))}}else d.selectedIndex=-1,d.cancel()}});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("contentAssistHome",function(){this.widget&&this.widget.scrollIndex(0,!0);return this.lineDown(0)}.bind(this));c.setAction("contentAssistEnd",function(){return this.lineUp(this.proposals.length-1)}.bind(this));c.setAction("contentAssistTab",function(){return this.tab()}.bind(this));this.widget&&(this.widget.setContentAssistMode(this),
this.widget.createAccessible())}function o(a,b){this.contentAssist=a;this.textView=this.contentAssist.getTextView();this.isShowing=this.textViewListenerAdded=!1;var c=this.textView.getOptions("parent").ownerDocument;this.parentNode=typeof b==="string"?c.getElementById(b):b;if(!this.parentNode){this.parentNode=f.createElement(c,"div");this.parentNode.className="contentassist";var d=c.getElementsByTagName("body")[0];if(d)d.appendChild(this.parentNode);else throw Error("parentNode is required");}this.parentNode.addEventListener("scroll",
this.onScroll.bind(this));var g=this;this.textViewListener={onMouseDown:function(a){(a.event.target||a.event.srcElement).parentElement!==g.parentNode&&g.contentAssist.deactivate()}};this.contentAssist.addEventListener("Deactivating",function(){g.hide()});this.scrollListener=function(){g.isShowing&&g.position()};e.addEventListener(c,"scroll",this.scrollListener)}c=1;b=2;l=3;var q={selected:"selected",hr:"proposal-hr",emphasis:"proposal-emphasis",noemphasis:"proposal-noemphasis",noemphasis_keyword:"proposal-noemphasis-keyword",
noemphasis_title:"proposal-noemphasis-title",noemphasis_title_keywords:"proposal-noemphasis-title-keywords",dfault:"proposal-default"};m.prototype={apply:function(a){if(!a)return!1;var b=this.textView,d=b.getSelection(),e=this._initialCaretOffset,f=e,g=d=Math.max(d.start,d.end),h=b.getModel();h.getBaseModel&&(f=h.mapOffset(f),g=h.mapOffset(g),h=h.getBaseModel());a.overwrite&&(e=this.getPrefixStart(h,f));f={proposal:a,start:f,end:g};this.setState(c);b.setText(typeof a==="string"?a:a.proposal,e,d);
this.dispatchEvent({type:"ProposalApplied",data:f});return!0},activate:function(a,d){if(this.state===c)this._autoTriggered=d?!0:!1,this.setState(b,a)},deactivate:function(){this.setState(c)},getTextView:function(){return this.textView},isActive:function(){return this.state===b||this.state===l},isDeactivatingChange:function(a,b){var c=!1;b.newValue.start<this._initialCaretOffset?c=!0:a&&(c=a.removedLineCount>0||a.addedLineCount>0);return c},setState:function(a,d){var e;if(a===b)this._filterText="",
e="Activating",this._mode&&this._mode.setActive(!0);else if(a===c)e="Deactivating",this._mode&&this._mode.setActive(!1),this._initialCaretOffset=-1,this._filterText="";e&&this.dispatchEvent({type:e,providerInfoArray:d});this.state=a;this.onStateChange(a)},setMode:function(a){this._mode=a},onStateChange:function(a){if(a===c){if(this.listenerAdded)this._latestModelChangingEvent=null,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===b){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,b=this.textView.getCaretOffset(),c=this.textView.getSelection(),c=Math.min(c.start,c.end);this._initialCaretOffset=Math.min(b,c);this._computeProposals(this._initialCaretOffset).then(function(b){a._computedProposals=b;a.isActive()&&(b=a._flatten(b),a.dispatchEvent({type:"ProposalsComputed",data:{proposals:b},autoApply:!a._autoTriggered}))})},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(b){var c=this._providerInfoArray,d=this.textView,e=d.getSelection(),f=d.getModel(),h=b;if(f.getBaseModel)h=f.mapOffset(h),e.start=f.mapOffset(e.start),e.end=f.mapOffset(e.end),f=f.getBaseModel();for(var b=f.getLine(f.getLineAtOffset(h)),i=0;i<b.length&&/\s/.test(b.charAt(i));)i++;var i=b.substring(0,i),d=d.getOptions("tabSize","expandTab"),d=d.expandTab?Array(d.tabSize+1).join(" "):"\t",
j={line:b,offset:h,prefix:f.getText(this.getPrefixStart(f,h),h),selection:e,delimiter:f.getLineDelimiter(),tab:d,indentation:i},l=this,c=c.map(function(b){var b=b.provider,c;try{var d,e;if(d=b.computeContentAssist){var i=l.editorContextProvider,k=i.getEditorContext();j=g.mixin(j,i.getOptions());e=d.apply(b,[k,j])}else if(d=b.getProposals||b.computeProposals)e=d.apply(b,[f.getText(),h,j]);c=l.progress?l.progress.progress(e,"Generating content assist proposal"):e}catch(o){l.handleError(o)}return a.when(c)});
return a.all(c,this.handleError)},filterProposals:function(){var a="",b=0;if(this._latestModelChangingEvent){a=this._latestModelChangingEvent.text;if(b=this._latestModelChangingEvent.removedCharCount)this._filterText=this._filterText.substring(0,this._filterText.length-b);if(a)this._filterText=this._filterText.concat(a);a=this.textView.getModel();a.getBaseModel&&(a=a.getBaseModel());var c=this.textView.getText(this.getPrefixStart(a,this._initialCaretOffset),this._initialCaretOffset),d=[];this._computedProposals.forEach(function(a){a=
a.filter(function(a){if(q[a.style]===q.hr||q[a.style]===q.noemphasis_title)return!0;var b="";if(a.overwrite){if(a.name)b=a.name;else if(a.proposal)b=a.proposal;else return!1;return 0===b.indexOf(c+this._filterText)}else return a.name||a.proposal?(b=!1,a.name&&(b=0===a.name.indexOf(c+this._filterText)),!b&&a.proposal&&(b=0===a.proposal.indexOf(this._filterText)),b):typeof a==="string"?0===a.indexOf(this._filterText):!1},this);a.length>0&&d.push(a)},this);d=this._removeExtraUnselectableElements(d);
this.dispatchEvent({type:"ProposalsComputed",data:{proposals:this._flatten(d)},autoApply:!1})}},_removeExtraUnselectableElements:function(a){return a.map(function(a){return a.filter(function(b,c){var d=!0;if(q[b.style]===q.hr)0===c||a.length-1===c?d=!1:q.hr===q[a[c-1].style]&&(d=!1);else if(q[b.style]===q.noemphasis_title){var e=a[c+1];e?q[e.style]===q.noemphasis_title&&(d=!1):d=!1}return d})})},setEditorContextProvider:function(a){this.editorContextProvider=a},_generateProviderId:function(){this._uniqueProviderIdCounter?
this._uniqueProviderIdCounter++:this._uniqueProviderIdCounter=0;return"ContentAssistGeneratedID_"+this._uniqueProviderIdCounter},setAutoTriggerEnabled:function(a){this._autoTriggerEnabled=a;this._updateAutoTriggerListenerState()},setProviders:function(a){this.setProviderInfoArray(a.map(function(a){return{provider:a,id:this._generateProviderId()}},this))},setProviderInfoArray:function(a){this.resetProviderInfoArray();this._providerInfoArray=a;this._charTriggersInstalled=a.some(function(a){return a.charTriggers});
this._updateAutoTriggerListenerState()},resetProviderInfoArray:function(){this._providerInfoArray=[];this._charTriggersInstalled=!1;this._updateAutoTriggerListenerState()},setProgress:function(a){this.progress=a},setStyleAccessor:function(a){this._styleAccessor=a},_flatten:function(a){return a.reduce(function(a,b){var c=a;if(Array.isArray(b)&&b.length>0){var c=b,d=a;b[0].style&&0===q[b[0].style].indexOf(q.noemphasis)&&(c=a,d=b);c.length>0&&c[c.length-1].style&&q.hr!==q[c[c.length-1].style]&&(c=c.concat({proposal:"",
name:"",description:"---------------------------------",style:"hr",unselectable:!0}));c=c.concat(d)}return c},[])},_triggerListener:function(){if(this._styleAccessor){var a=this.textView.getCaretOffset(),b=null,c=[];if(this._charTriggersInstalled){var d=this.textView.getText(a-1,a);this._providerInfoArray.forEach(function(e){var f=e.charTriggers;if(f&&f.test(d)){var f=!1,g=e.excludedStyles;g&&(b||(b=this._styleAccessor.getStyles(a-1)),f=b.some(function(a){return g.test(a.style)}));f||c.push(e)}},
this);c.length>0&&this.activate(c,!0)}}},_updateAutoTriggerListenerState:function(){if(!this._boundTriggerListener)this._boundTriggerListener=this._triggerListener.bind(this);if(this._triggerListenerInstalled){if(!this._autoTriggerEnabled||!this._charTriggersInstalled)this.textView.removeEventListener("Modify",this._boundTriggerListener),this._triggerListenerInstalled=!1}else if(this._autoTriggerEnabled&&this._charTriggersInstalled)this.textView.addEventListener("Modify",this._boundTriggerListener),
this._triggerListenerInstalled=!0}};h.EventTarget.addMixin(m.prototype);s.prototype=new j.KeyMode;g.mixin(s.prototype,{createKeyBindings:function(){var a=k.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:"contentAssistHome",keyBinding:new a(d.KEY.HOME)});b.push({actionID:"contentAssistEnd",keyBinding:new a(d.KEY.END)});b.push({actionID:"contentAssistTab",keyBinding:new a(9)});return b},cancel:function(){this.getContentAssist().deactivate()},getContentAssist:function(){return this.contentAssist},getProposals:function(){return this.proposals},isActive:function(){return this.getContentAssist().isActive()},setActive:function(a){a?this.contentAssist.textView.addKeyMode(this):
this.contentAssist.textView.removeKeyMode(this)},lineUp:function(a,b){return this.selectNew(a,b,!1)},lineDown:function(a,b){return this.selectNew(a,b,!0)},selectNew:function(a,b,c){if(c){if(void 0===a&&(a=this.selectedIndex+1),a>=this.proposals.length)if(b)return!0;else a=0}else if(void 0===a&&(a=this.selectedIndex-1),0>a)if(b)return!0;else a=this.proposals.length-1;for(var d=a;this.proposals[a]&&this.proposals[a].unselectable;){if(c){if(a++,a>=this.proposals.length)if(b)return!0;else a=0}else if(a--,
0>a)if(b)return!0;else a=this.proposals.length-1;if(a===d){a=-1;break}}this.selectedIndex=a;this.widget&&this.widget.selectNode(a);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 0===a?this.lineDown(a,!0):this.lineUp(a,!0)}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,!0)}else return this.lineDown()},enter:function(){return this.contentAssist.apply(this.proposals[this.selectedIndex]||null)},tab:function(){return this.widget?(this.widget.parentNode.focus(),!0):!1}});o.prototype={onClick:function(a){if(!a)a=window.event;this.contentAssist.apply(this.getProposal(a.target||a.srcElement));this.textView.focus()},onScroll:function(){this.previousCloneNode&&!this.preserveCloneThroughScroll&&(this._removeCloneNode(),this.previousSelectedNode.classList.add(q.selected));
this.preserveCloneThroughScroll=!1},createDiv:function(a,b,c){var d=b.ownerDocument,e=f.createElement(d,"div");e.id="contentoption"+c;e.setAttribute("role","option");e.className=q[a.style]?q[a.style]:q.dfault;a.style==="hr"?a=f.createElement(d,"hr"):(a=this._createDisplayNode(e,a,c),e.contentAssistProposalIndex=c);e.appendChild(a);b.appendChild(e)},createAccessible:function(){var a=this._contentAssistMode,b=this;this.parentNode.addEventListener("keydown",function(c){if(!c)c=window.event;c.preventDefault&&
c.preventDefault();if(c.keyCode===d.KEY.ESCAPE)return a.cancel();else if(c.keyCode===d.KEY.UP)return a.lineUp();else if(c.keyCode===d.KEY.DOWN)return a.lineDown();else if(c.keyCode===d.KEY.ENTER)return a.enter();else if(c.keyCode===d.KEY.PAGEDOWN)return a.pageDown();else if(c.keyCode===d.KEY.PAGEUP)return a.pageUp();else if(c.keyCode===d.KEY.HOME)return b.scrollIndex(0,!0),a.lineDown(0);else if(c.keyCode===d.KEY.END)return a.lineUp(a.getProposals().length-1);return!1})},_createDisplayNode:function(a,
b,c){var d=null,e=null;if(typeof b==="string")e=b;else if(b.description&&typeof b.description==="string")if(b.name&&typeof b.name==="string"){var f=this._createNameNode(b.name);f.contentAssistProposalIndex=c;d=document.createElement("span");d.appendChild(f);f=document.createTextNode(b.description);d.appendChild(f);a.setAttribute("title",b.name+b.description)}else e=b.description;else e=b.proposal;e&&(d=this._createNameNode(e),a.setAttribute("title",e));d.contentAssistProposalIndex=c;return d},_createNameNode:function(a){var b=
document.createElement("span");b.classList.add("proposal-name");b.appendChild(document.createTextNode(a));return b},getProposal:function(a){var b=null,a=a.contentAssistProposalIndex;void 0!==a&&(b=this._contentAssistMode.getProposals()[a]||null);return b},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);this.preserveCloneThroughScroll=!0},selectNode:function(a){var b=null;if(this.previousSelectedNode)this.previousSelectedNode.classList.remove(q.selected),this.previousSelectedNode=null,this.previousCloneNode&&this._removeCloneNode();if(-1!==a){b=this.parentNode.childNodes[a];b.classList.add(q.selected);this.parentNode.setAttribute("aria-activedescendant",
b.id);b.focus();if(b.offsetTop<this.parentNode.scrollTop)b.scrollIntoView(!0),this.preserveCloneThroughScroll=!0;else if(b.offsetTop+b.offsetHeight>this.parentNode.scrollTop+this.parentNode.clientHeight)b.scrollIntoView(!1),this.preserveCloneThroughScroll=!0;var c=d.bounds(b.firstChild||b),e=d.bounds(this.parentNode),a=window.getComputedStyle(this.parentNode),f=window.getComputedStyle(b),f=parseInt(a.paddingLeft)+parseInt(a.paddingRight)+parseInt(f.paddingLeft)+parseInt(f.paddingRight);if(c.width>=
e.width-f){f=parseInt(a.top);e=b.cloneNode(!0);e.classList.add("cloneProposal");e.style.top=f+b.offsetTop-this.parentNode.scrollTop+"px";e.style.left=a.left;e.setAttribute("id",e.id+"_clone");c=c.left+c.width-parseInt(document.documentElement.clientWidth);if(c>0)a=parseInt(a.left)-c,0>a&&(a=0),e.style.left=a+"px";a=document.createElement("div");a.id="clone_contentassist";a.classList.add("contentassist");a.classList.add("cloneWrapper");a.appendChild(e);a.onclick=this.parentNode.onclick;this.parentNode.parentNode.insertBefore(a,
this.parentNode);var g=function(a){a.contentAssistProposalIndex=b.contentAssistProposalIndex;if(a.hasChildNodes())for(var c=0;c<a.childNodes.length;c++)g(a.childNodes[c])};g(a);b.classList.remove(q.selected);this.previousCloneNode=a}}this.previousSelectedNode=b},setContentAssistMode:function(a){this._contentAssistMode=a},show:function(){var a=this._contentAssistMode.getProposals();if(a.length===0)this.hide();else{this.parentNode.innerHTML="";for(var b=0;b<a.length;b++)this.createDiv(a[b],this.parentNode,
b);this.position();this.parentNode.onclick=this.onClick.bind(this);this.isShowing=!0;if(!this.textViewListenerAdded)this.textView.addEventListener("MouseDown",this.textViewListener.onMouseDown),this.textViewListenerAdded=!0}},hide:function(){this.parentNode.ownerDocument.activeElement===this.parentNode&&this.textView.focus();this.parentNode.style.display="none";this.parentNode.onclick=null;this.isShowing=!1;if(this.textViewListenerAdded)this.textView.removeEventListener("MouseDown",this.textViewListener.onMouseDown),
this.textViewListenerAdded=!1;if(this.previousSelectedNode)this.previousSelectedNode=null,this.previousCloneNode&&this._removeCloneNode()},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"},_removeCloneNode:function(){this.parentNode.parentNode.contains(this.previousCloneNode)&&this.parentNode.parentNode.removeChild(this.previousCloneNode);
this.previousCloneNode=null}};return{ContentAssist:m,ContentAssistMode:s,ContentAssistWidget:o}});
define("orion/editor/emacs",["i18n!orion/editor/nls/messages","orion/editor/keyModes","orion/keyBinding","orion/util"],function(i,k,j,h){function a(a){k.KeyMode.call(this,a)}a.prototype=new k.KeyMode;a.prototype.createKeyBindings=function(){var a=[];a.push({actionID:"emacs-beginning-of-line",keyBinding:this._createStroke("a",!h.isMac,!1,!1,h.isMac)});a.push({actionID:"emacs-end-of-line",keyBinding:this._createStroke("e",!h.isMac,!1,!1,h.isMac)});a.push({actionID:"emacs-forward-char",keyBinding:this._createStroke("f",
!h.isMac,!1,!1,h.isMac)});a.push({actionID:"emacs-backward-char",keyBinding:this._createStroke("b",!h.isMac,!1,!1,h.isMac)});a.push({actionID:"emacs-forward-word",keyBinding:this._createStroke("f",!1,!1,!0)});a.push({actionID:"emacs-backward-word",keyBinding:this._createStroke("b",!1,!1,!0)});a.push({actionID:"emacs-next-line",keyBinding:this._createStroke("n",!h.isMac,!1,!1,h.isMac)});a.push({actionID:"emacs-previous-line",keyBinding:this._createStroke("p",!h.isMac,!1,!1,h.isMac)});a.push({actionID:"emacs-beginning-of-buffer",
keyBinding:this._createStroke(188,!1,!0,!0)});a.push({actionID:"emacs-end-of-buffer",keyBinding:this._createStroke(190,!1,!0,!0)});a.push({actionID:"emacs-delete-backward-char",keyBinding:this._createStroke(46,!h.isMac,!1,!1,h.isMac)});a.push({actionID:"emacs-delete-char",keyBinding:this._createStroke("d",!h.isMac,!1,!1,h.isMac)});a.push({actionID:"emacs-kill-line",keyBinding:this._createStroke("k",!h.isMac,!1,!1,h.isMac)});a.push({actionID:"emacs-kill-word",keyBinding:this._createStroke("d",!1,!1,
!0)});a.push({actionID:"emacs-backward-kill-word",keyBinding:this._createStroke(46,!1,!1,!0)});a.push({actionID:"undo",keyBinding:this._createSequence([this._createStroke("x",!0),this._createStroke("u")])});a.push({actionID:"redo",keyBinding:this._createSequence([this._createStroke("x",!0),this._createStroke("r")])});a.push({actionID:"emacs-scroll-up",keyBinding:this._createStroke("v",!h.isMac,!1,!1,h.isMac)});a.push({actionID:"emacs-scroll-down",keyBinding:this._createStroke("v",!1,!1,!0)});a.push({actionID:"emacs-set-mark-command",
keyBinding:this._createStroke(" ",!h.isMac,!1,!1,h.isMac)});a.push({actionID:"emacs-reset-mark-command",keyBinding:this._createStroke("g",!h.isMac,!1,!1,h.isMac)});a.push({actionID:"emacs-exchange-point-and-mark",keyBinding:this._createSequence([this._createStroke("x",!h.isMac,!1,!1,h.isMac),this._createStroke("x",!h.isMac,!1,!1,h.isMac)])});for(var e=0;e<=9;e++)a.push({actionID:"emacs-digit-argument-"+e,keyBinding:this._createStroke(48+e,!h.isMac,!1,!1,h.isMac)}),a.push({actionID:"emacs-digit-argument-"+
e,keyBinding:this._createStroke(48+e,!1,!1,!0)}),a.push({actionID:"emacs-digit-argument-"+e,keyBinding:this._createStroke(48+e,!h.isMac,!1,!0,h.isMac)});a.push({actionID:"emacs-negative-argument",keyBinding:this._createStroke(189,!h.isMac,!1,!1,h.isMac)});a.push({actionID:"emacs-negative-argument",keyBinding:this._createStroke(189,!1,!1,!0)});a.push({actionID:"emacs-negative-argument",keyBinding:this._createStroke(189,!h.isMac,!1,!0,h.isMac)});a.push({actionID:"emacs-uppercase",keyBinding:this._createStroke("u",
!1,!1,!0)});a.push({actionID:"emacs-lowercase",keyBinding:this._createStroke("l",!1,!1,!0)});a.push({actionID:"emacs-capitalize",keyBinding:this._createStroke("c",!1,!1,!0)});a.push({actionID:"contentAssist",keyBinding:this._createStroke(191,!1,!1,!0)});a.push({actionID:"find",keyBinding:this._createStroke("r",!1,!1,!0)});a.push({actionID:"incrementalFind",keyBinding:this._createStroke("s",!0)});a.push({actionID:"incrementalFindReverse",keyBinding:this._createStroke("r",!0)});a.push({actionID:"save",
keyBinding:this._createSequence([this._createStroke("x",!h.isMac,!1,!1,h.isMac),this._createStroke("s",!h.isMac,!1,!1,h.isMac)])});this._createActions(this.getView());return a};a.prototype._createStroke=function(a,e,f,d,c){a=new j.KeyStroke(a,e,f,d,c);a.scopeName=i.emacs;return a};a.prototype._createSequence=function(a){a=new j.KeySequence(a);a.scopeName=i.emacs;return a};a.prototype._getData=function(){var a={count:(this._argument||1)*(this._sign||1)};this._argument=0;this._sign=1;return a};a.prototype._moveCursor=
function(a){var e=this._getData();if(this._marker)e.select=!0;return this.getView().invokeAction(a,!1,e)};a.prototype._digitArgument=function(a){this._argument=(this._argument||0)*10+a;return!0};a.prototype._negativeArgument=function(){this._sign=(this._sign||1)*-1;return!0};a.prototype._createActions=function(a){var e=this;a.setAction("emacs-beginning-of-line",function(){return e._moveCursor("lineStart")},{name:i.lineStart});a.setAction("emacs-end-of-line",function(){return e._moveCursor("lineEnd")},
{name:i.lineEnd});a.setAction("emacs-forward-char",function(){return e._moveCursor("charNext")},{name:i.charNext});a.setAction("emacs-backward-char",function(){return e._moveCursor("charPrevious")},{name:i.charPrevious});a.setAction("emacs-forward-word",function(){return e._moveCursor("wordNext")},{name:i.wordNext});a.setAction("emacs-backward-word",function(){return e._moveCursor("wordPrevious")},{name:i.wordPrevious});a.setAction("emacs-next-line",function(){return e._moveCursor("lineDown")},{name:i.lineDown});
a.setAction("emacs-previous-line",function(){return e._moveCursor("lineUp")},{name:i.lineUp});a.setAction("emacs-beginning-of-buffer",function(){return e._moveCursor("textStart")},{name:i.textStart});a.setAction("emacs-end-of-buffer",function(){return e._moveCursor("textEnd")},{name:i.textEnd});a.setAction("emacs-delete-backward-char",function(){return a.invokeAction("deletePrevious")},{name:i.deletePrevious});a.setAction("emacs-delete-char",function(){return a.invokeAction("deletePrevious")},{name:i.deletePrevious});
a.setAction("emacs-kill-line",function(){return a.invokeAction("deleteLineEnd")},{name:i.deleteLineEnd});a.setAction("emacs-kill-word",function(){return a.invokeAction("deleteWordNext")},{name:i.deleteWordNext});a.setAction("emacs-backward-kill-word",function(){return a.invokeAction("deleteWordPrevious")},{name:i.deleteWordPrevious});a.setAction("emacs-scroll-up",function(){return e._moveCursor("pageDown")},{name:i.pageDown});a.setAction("emacs-scroll-down",function(){return e._moveCursor("pageUp")},
{name:i.pageUp});a.setAction("emacs-set-mark-command",function(){var f=a.getCaretOffset();a.setCaretOffset(f);e._marker=f;return!0},{name:i.setMarkCommand});a.setAction("emacs-exchange-point-and-mark",function(){if(e._marker!==void 0){var f=a.getCaretOffset(),d=a.getSelection();if(d.end===f){var c=d.start;d.start=d.end;d.end=c}e._marker=f;a.setSelection(d.start,d.end)}return!0},{name:i.exchangeMarkPoint});a.setAction("emacs-reset-mark-command",function(){var f=a.getCaretOffset();a.setCaretOffset(f);
e._marker=void 0;return!0},{name:i.clearMark});a.setAction("emacs-digit-argument-0",function(){return e._digitArgument(0)},{name:h.formatMessage(i.digitArgument,"0")});a.setAction("emacs-digit-argument-1",function(){return e._digitArgument(1)},{name:h.formatMessage(i.digitArgument,"1")});a.setAction("emacs-digit-argument-2",function(){return e._digitArgument(2)},{name:h.formatMessage(i.digitArgument,"2")});a.setAction("emacs-digit-argument-3",function(){return e._digitArgument(3)},{name:h.formatMessage(i.digitArgument,
"3")});a.setAction("emacs-digit-argument-4",function(){return e._digitArgument(4)},{name:h.formatMessage(i.digitArgument,"4")});a.setAction("emacs-digit-argument-5",function(){return e._digitArgument(5)},{name:h.formatMessage(i.digitArgument,"5")});a.setAction("emacs-digit-argument-6",function(){return e._digitArgument(6)},{name:h.formatMessage(i.digitArgument,"6")});a.setAction("emacs-digit-argument-7",function(){return e._digitArgument(7)},{name:h.formatMessage(i.digitArgument,"7")});a.setAction("emacs-digit-argument-8",
function(){return e._digitArgument(8)},{name:h.formatMessage(i.digitArgument,"8")});a.setAction("emacs-digit-argument-9",function(){return e._digitArgument(9)},{name:h.formatMessage(i.digitArgument,"9")});a.setAction("emacs-negative-argument",function(){return e._negativeArgument()},{name:i.negativeArgument});a.setAction("emacs-uppercase",function(){var f=e._getData();f.unit="word";return a.invokeAction("uppercase",!1,f)},{name:i.uppercase});a.setAction("emacs-lowercase",function(){var f=e._getData();
f.unit="word";return a.invokeAction("lowercase",!1,f)},{name:i.lowercase});a.setAction("emacs-capitalize",function(){var f=e._getData();f.unit="word";return a.invokeAction("capitalize",!1,f)},{name:i.capitalize})};return{EmacsMode:a}});
define("orion/editor/vi",["i18n!orion/editor/nls/messages","orion/editor/keyModes","orion/keyBinding","orion/util"],function(i,k,j,h){function a(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}function g(a,b,c,d,e,f,g){a=new j.KeyStroke(a,b,c,d,e,f);a.scopeName=g||i.vi;return a}function e(a,b){var c=new j.KeySequence(a);c.scopeName=b||i.vi;return c}function f(a,b,c){this.key=b;this.msg=c;this.number="";k.KeyMode.call(this,a);a&&this._createActions(a)}function d(a){var b=a.getView();this.viMode=
a;k.KeyMode.call(this,b);this._createActions(b)}function c(a,b,c,d){this.viMode=a;this.nextMode=b;f.call(this,a.getView(),c,d)}function b(a){var b=a.getView();k.KeyMode.call(this,b);this.viMode=a;this._createActions(b)}function l(a,d){f.call(this,a,"",i.vimove);this.insertMode=new b(this);this.changeMode=new c(this,this.insertMode,"c",i.vichange);this.deleteMode=new c(this,this,"d",i.videlete);this.yankMode=new c(this,this,"y",i.viyank);this.statusReporter=d}var m,s;f.prototype=new k.KeyMode;a(f.prototype,
{_msg:function(a){return{name:h.formatMessage(i[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:g(c+"",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi"+b+"Left",keyBinding:g("h",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Left",keyBinding:g("h",!0,!1,!1,!1)});a.push({actionID:"vi"+b+"Left",keyBinding:g(8)});a.push({actionID:"vi"+b+"Left",keyBinding:g(37)});a.push({actionID:"vi"+b+"Down",keyBinding:g("j",
!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Down",keyBinding:g(40)});a.push({actionID:"vi"+b+"Up",keyBinding:g("k",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Up",keyBinding:g(38)});a.push({actionID:"vi"+b+"Right",keyBinding:g("l",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Right",keyBinding:g(39)});a.push({actionID:"vi"+b+"Right",keyBinding:g(32)});a.push({actionID:"vi"+b+"w",keyBinding:g("w",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"b",keyBinding:g("b",!1,!1,!1,!1,
"keypress")});a.push({actionID:"vi"+b+"W",keyBinding:g("W",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"B",keyBinding:g("B",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"e",keyBinding:g("e",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"E",keyBinding:g("E",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"$",keyBinding:g("$",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"^_",keyBinding:g("^",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"^_",keyBinding:g("_",!1,!1,!1,!1,"keypress")});
a.push({actionID:"vi"+b+"+",keyBinding:g("+",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"+",keyBinding:g(13)});a.push({actionID:"vi"+b+"-",keyBinding:g("-",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"|",keyBinding:g("|",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"H",keyBinding:g("H",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"M",keyBinding:g("M",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"L",keyBinding:g("L",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"/",
keyBinding:g("/",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"?",keyBinding:g("?",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"n",keyBinding:g("n",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"N",keyBinding:g("N",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"f",keyBinding:g("f",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"F",keyBinding:g("F",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"t",keyBinding:g("t",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"T",keyBinding:g("T",
!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+",",keyBinding:g(",",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+";",keyBinding:g(";",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"G",keyBinding:g("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}});d.prototype=new k.KeyMode;a(d.prototype,{createKeyBindings:function(){var a=[];a.push({actionID:"vi-:-ESC",keyBinding:g(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=k.KeyMode.prototype.match.call(this,a);b||(b=this.getView().getKeyModes()[0].match(a));return b},storeNumber:function(a){this.number=a}});c.prototype=new f;a(c.prototype,
{createKeyBindings:function(){var a=f.prototype.createKeyBindings.call(this);a.push({actionID:"vi-"+this.key+"ESC",keyBinding:g(27),predefined:!0});a.push({actionID:"vi-"+this.key+"-"+this.key,keyBinding:g(this.key,!1,!1,!1,!1,"keypress")});return a},_invoke:function(a,b){var b=b||{},c=this.getView(),d=c.getCaretOffset(),e=d,g=c.getModel(),h=this;b.editDone=function(){var a=c.getCaretOffset();if(e>a){var f=e;e=a;a=f}b.editLine&&(e=g.getLineStart(g.getLineAtOffset(e)),a=g.getLineEnd(g.getLineAtOffset(a),
h.key==="c"?!1:!0));h.key==="y"?(m=c.getText(e,a),s=b.editLine,c.setCaretOffset(d)):c.setText("",e,a);c.removeKeyMode(h);c.addKeyMode(h.nextMode)};f.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){f.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=""}});b.prototype=new k.KeyMode;a(b.prototype,{createKeyBindings:function(){var a=[];a.push({actionID:"vi-insert-ESC",keyBinding:g(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=k.KeyMode.prototype.match.call(this,a);b||(b=this.getView().getKeyModes()[0].match(a));return b},storeNumber:function(){}});l.prototype=new f;a(l.prototype,{createKeyBindings:function(){var a=f.prototype.createKeyBindings.call(this);a.push({actionID:"vi-ctrl-f",keyBinding:g("f",!0)});a.push({actionID:"vi-ctrl-b",keyBinding:g("b",!0)});a.push({actionID:"vi-ctrl-e",keyBinding:g("e",!0)});a.push({actionID:"vi-ctrl-y",
keyBinding:g("y",!0)});a.push({actionID:"statusLineMode",keyBinding:g(":",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi-a",keyBinding:g("a",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-A",keyBinding:g("A",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-i",keyBinding:g("i",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-I",keyBinding:g("I",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-o",keyBinding:g("o",!1,!1,!1,!1,"keypress"),predefined:!0});
a.push({actionID:"vi-O",keyBinding:g("O",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-R",keyBinding:g("R",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-s",keyBinding:g("s",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-S",keyBinding:g("S",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-p",keyBinding:g("p",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-P",keyBinding:g("P",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-u",
keyBinding:g("u",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-c",keyBinding:g("c",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-d",keyBinding:g("d",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-y",keyBinding:g("y",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-~",keyBinding:g("~",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-x",keyBinding:g("x",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-X",keyBinding:g("X",
!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-C",keyBinding:g("C",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-D",keyBinding:g("D",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-*",keyBinding:g("*",!1,!1,!1,!1,"keypress"),predefined:!0});return a},getKeyBindings:function(a){var b=k.KeyMode.prototype.getKeyBindings.call(this,a),b=b||[],c=this.changeMode.getKeyBindings(a),d;if(!this.changeMode.isActive())for(d=0;d<c.length;d++)c[d]=e([g("c",!1,!1,!1,!1,"keypress"),
c[d]]);b=b.concat(c);c=this.deleteMode.getKeyBindings(a);if(!this.deleteMode.isActive())for(d=0;d<c.length;d++)c[d]=e([g("d",!1,!1,!1,!1,"keypress"),c[d]]);b=b.concat(c);c=this.yankMode.getKeyBindings(a);if(!this.yankMode.isActive())for(d=0;d<c.length;d++)c[d]=e([g("y",!1,!1,!1,!1,"keypress"),c[d]]);return b=b.concat(c)},match:function(a){var b=k.KeyMode.prototype.match.call(this,a);!b&&a.type==="keypress"&&(b="noop");return b},_createActions:function(a){f.prototype._createActions.call(this,a);var b=
this;a.setAction("vi-ctrl-f",function(){return b._invoke("pageDown")},{name:i.pageDown});a.setAction("vi-ctrl-b",function(){return b._invoke("pageUp")},{name:i.pageUp});a.setAction("vi-ctrl-e",function(){return b._invoke("scrollLineDown")},{name:i.scrollLineDown});a.setAction("vi-ctrl-y",function(){return b._invoke("scrollLineUp")},{name:i.scrollLineUp});a.setAction("vi-a",function(){return b._toInsertMode("charNext")},{name:i.via});a.setAction("vi-A",function(){return b._toInsertMode("lineEnd")},
{name:i.viA});a.setAction("vi-i",function(){return b._toInsertMode("noop")},{name:i.vii});a.setAction("vi-I",function(){return b._toInsertMode("lineStart")},{name:i.viI});a.setAction("vi-O",function(){b._invoke("lineUp");b._invoke("lineEnd");b._toInsertMode("enter");return!0},{name:i.viO});a.setAction("vi-o",function(){b._invoke("lineEnd");b._toInsertMode("enter");return!0},{name:i.vio});a.setAction("vi-R",function(){return b._toInsertMode("toggleOverwriteMode")},{name:i.viR});a.setAction("vi-s",
function(){return b._toInsertMode("deleteNext",{unit:"char"})},{name:i.vis});a.setAction("vi-S",function(){return b._toInsertMode("deleteLines",{unit:"line"})},{name:i.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();s?c.start=c.end=d.getLineEnd(d.getLineAtOffset(e),!0):(c.start++,c.end++)}a.setText(m,c.start,c.end)})},{name:i.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(s)c.start=c.end=d.getLineStart(d.getLineAtOffset(e))}a.setText(m,c.start,c.end)})},{name:i.viP});a.setAction("vi-u",function(){return b._invoke("undo")},{name:i.Undo});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:i.reversecase});a.setAction("vi-x",function(){return b._invoke("deleteNext")},{name:i.deleteNext});a.setAction("vi-X",function(){return b._invoke("deletePrevious")},{name:i.deletePrevious});a.setAction("vi-C",function(){return b._toInsertMode("deleteLineEnd")},{name:i.viC});a.setAction("vi-D",
function(){return b._invoke("deleteLineEnd")},{name:i.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:i.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:l}});
define("orion/editorPreferences",[],function(){function i(h,a){this._preferences=h;if(this._callback=a)var g=h.listenForChangedSettings(k,function(e){e.key===g&&a()}.bind(this))}var k="/editor/settings",j={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,contentAssistAutoTrigger:!0,contentAssistAutoTriggerVisible:!0,
showOccurrences:!1,showOccurrencesVisible:!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};i.prototype={_initialize:function(h){var h=h.get("editorSettings")||{},a;for(a in j)h.hasOwnProperty(a)||(h[a]=j[a]);return h},getPrefs:function(h){this._preferences.getPreferences(k).then(function(a){a=this._initialize(a);typeof a==="string"&&(a=JSON.parse(a));h(a)}.bind(this))},setPrefs:function(h,a){this._preferences.getPreferences(k).then(function(g){g.put("editorSettings",h);h=this._initialize(g);a&&a(h);this._callback&&this._callback(h)}.bind(this))}};return{EditorPreferences:i}});
define("orion/widgets/themes/editor/ThemeData",["i18n!orion/settings/nls/messages","orion/editor/textTheme"],function(i,k){function j(){}function h(){this.styles=[];var a=new j;a.name="Eclipse";a.annotationRuler="white";a.background="white";a.comment="green";a.keyword="#7f0055";a.text="darkSlateGray";a.string="blue";a.overviewRuler="white";a.lineNumberOdd="#444";a.lineNumberEven="#444";a.lineNumber="#444";a.currentLine="#EAF2FE";a.tag="darkorange";a.attribute="cadetBlue";a.fontFamily=g;a.fontSize=
e;this.styles.push(a);a=new j;a.name="Prospecto";a.annotationRuler="white";a.background="white";a.comment="#3C802C";a.keyword="#CC4C07";a.text="#333";a.string="#446FBD";a.overviewRuler="white";a.lineNumberOdd="silver";a.lineNumberEven="silver";a.lineNumber="silver";a.currentLine="#EAF2FE";a.tag="#CC4C07";a.attribute="cadetBlue";a.fontFamily=g;a.fontSize=e;this.styles.push(a);a=new j;a.name="Blue";a.annotationRuler="lavender";a.background="aliceBlue";a.comment="indigo";a.keyword="cornFlowerBlue";a.text=
"navy";a.string="cornFlowerBlue";a.overviewRuler="lavender";a.lineNumberOdd="darkSlateGray";a.lineNumberEven="darkSlateGray";a.lineNumber="darkSlateGray";a.currentLine="white";a.tag="cornFlowerBlue";a.attribute="cadetBlue";a.fontFamily=g;a.fontSize=e;this.styles.push(a);a=new j;a.name="Ambience";a.annotationRuler="#3D3D3D";a.background="#202020";a.comment="mediumslateblue";a.keyword="cornFlowerBlue";a.text="darkseagreen";a.string="lightcoral";a.overviewRuler="white";a.lineNumberOdd="black";a.lineNumberEven=
"black";a.lineNumber="black";a.currentLine="lightcyan";a.tag="cornFlowerBlue";a.attribute="cadetBlue";a.fontFamily=g;a.fontSize=e;this.styles.push(a);a=new j;a.name="Tierra";a.annotationRuler="moccasin";a.background="lemonchiffon";a.comment="darkseagreen";a.keyword="darkred";a.text="#555555";a.string="orangered";a.overviewRuler="moccasin";a.lineNumberOdd="chocolate";a.lineNumberEven="chocolate";a.lineNumber="chocolate";a.currentLine="#baa289";a.tag="darkred";a.attribute="cadetBlue";a.fontFamily=g;
a.fontSize=e;this.styles.push(a);a=new j;a.name="Nimbus";a.annotationRuler="#444";a.background="dimgray";a.comment="darkseagreen";a.keyword="darkorange";a.text="white";a.string="cornflowerblue";a.overviewRuler="#444";a.lineNumberOdd="#aaa";a.lineNumberEven="#aaa";a.lineNumber="#aaa";a.currentLine="#aabfbb";a.tag="darkorange";a.attribute="cadetBlue";a.fontFamily=g;a.fontSize=e;this.styles.push(a);a=new j;a.name="Adelante";a.annotationRuler="#E2D2B2";a.background="#F1E7C8";a.comment="#5D774E";a.keyword=
"#AF473B";a.text="dimgray";a.string="#DE5D3B";a.overviewRuler="#E2D2B2";a.lineNumberOdd="#AF473B";a.lineNumberEven="#AF473B";a.lineNumber="#AF473B";a.currentLine="#9e937b";a.tag="#AF473B";a.attribute="cadetBlue";a.fontFamily=g;a.fontSize=e;this.styles.push(a);a=new j;a.name="Raspberry Pi";a.annotationRuler="seashell";a.background="seashell";a.comment="#66B32F";a.keyword="#E73E36";a.text="dimgray";a.string="darkorange";a.overviewRuler="seashell";a.lineNumberOdd="#E73E36";a.lineNumberEven="#E73E36";
a.lineNumber="#E73E36";a.currentLine="#F5B1AE";a.tag="#E73E36";a.attribute="cadetBlue";a.fontFamily=g;a.fontSize=e;this.styles.push(a)}function a(){return this.styles}var g='"Consolas", "Monaco", "Vera Mono", "monospace"',e="10pt";h.prototype.styles=[];h.prototype.getStyles=a;h.prototype.fontSettable=!0;h.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"editorstyles",defaultTheme:"Prospecto",selectedKey:"editorSelected",version:"5.0"}};h.prototype.parseToXML=function(a){try{var d=
null;if(window.DOMParser){var d=(new DOMParser).parseFromString(a,"text/xml"),c=d.getElementsByTagName("parsererror");return!c||!c.length||!c[0].childNodes.length?d:null}else return d=new ActiveXObject("Microsoft.XMLDOM"),d.async=!1,d.loadXML(a),d}catch(b){}};h.prototype.selectFontSize=function(a){console.log("fontsize: "+a)};h.prototype.importTheme=function(a){console.log("import theme");console.log(a);var d=this.parseToXML(a.parameters.valueFor("name")),c=new j;c.name=d.getElementsByTagName("colorTheme")[0].attributes[1].value;
c.annotationRuler=d.getElementsByTagName("background")[0].attributes[0].value;c.background=d.getElementsByTagName("background")[0].attributes[0].value;c.comment=d.getElementsByTagName("singleLineComment")[0].attributes[0].value;c.keyword=d.getElementsByTagName("keyword")[0].attributes[0].value;c.text=d.getElementsByTagName("foreground")[0].attributes[0].value;c.string=d.getElementsByTagName("string")[0].attributes[0].value;c.overviewRuler=d.getElementsByTagName("background")[0].attributes[0].value;
c.lineNumberOdd=d.getElementsByTagName("lineNumber")[0].attributes[0].value;c.lineNumberEven=d.getElementsByTagName("lineNumber")[0].attributes[0].value;c.lineNumber=d.getElementsByTagName("lineNumber")[0].attributes[0].value;c.currentLine=d.getElementsByTagName("selectionBackground")[0].attributes[0].value;a.items.addTheme(c)};h.prototype.processSettings=function(a){var d=k.TextTheme.getTheme();d.setThemeClass("editorTheme",d.buildStyleSheet("editorTheme",a))};h.prototype.getViewData=function(){var a=
{top:10,left:10,width:400,height:350},d=a.left,c=a.top;a.shapes=[{type:"TEXT",name:i["Line Numbers"],label:"1",x:d+20,y:c+20,fill:"darkSlateGray",family:"lineNumber",font:"9pt sans-serif"},{type:"RECTANGLE",name:i.Background,x:d+46,y:c,width:290,height:a.height,family:"background",fill:"white"},{type:"TEXT",name:i.Strings,label:"'text/javascript'",x:d+134,y:c+20,fill:"darkorange",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:i.Foreground,label:"=",x:d+124,y:c+20,fill:"darkSlateGray",family:"text",
font:"9pt sans-serif"},{type:"RECTANGLE",name:i["Current Line"],x:d+46,y:c+87,width:290,height:18,family:"currentLine",fill:"#eaf2fd"},{type:"TEXT",name:i["HTML Attribute"],label:"type",x:d+98,y:c+20,fill:"darkGray",family:"attribute",font:"9pt sans-serif"},{type:"RECTANGLE",name:i["Overview Ruler"],x:d+336,y:c,width:14,height:a.height,family:"overviewRuler",fill:"white"},{type:"TEXT",name:i.Comments,label:"/* comment */",x:d+75,y:c+40,fill:"darkSeaGreen",family:"comment",font:"9pt sans-serif"},{type:"TEXT",
name:i["HTML Tag"],label:"<script",x:d+55,y:c+20,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:i["HTML Tag"],label:">",x:d+213,y:c+20,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:i.Strings,label:"'Result'",x:d+164,y:c+80,fill:"cornflowerBlue",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:i.Foreground,label:"multiply(a,b){",x:d+120,y:c+60,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i.Keywords,label:"function",
x:d+75,y:c+60,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:i.Keywords,label:"var",x:d+95,y:c+80,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:i.Foreground,label:"output = ",x:d+115,y:c+80,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i.Foreground,label:";",x:d+205,y:c+80,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i.Keywords,label:"var",x:d+95,y:c+100,fill:"darkorange",family:"keyword",
font:"9pt sans-serif"},{type:"TEXT",name:i.Foreground,label:"result = a*b;",x:d+115,y:c+100,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i.Keywords,label:"return",x:d+95,y:c+120,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:i.Foreground,label:"output + result;",x:d+135,y:c+120,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i.Foreground,label:"}",x:d+75,y:c+140,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},
{type:"TEXT",name:i["HTML Tag"],label:"<\/script>",x:d+55,y:c+160,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:i["HTML Tag"],label:"<style",x:d+55,y:c+200,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:i["HTML Attribute"],label:"type",x:d+95,y:c+200,fill:"darkGray",family:"attribute",font:"9pt sans-serif"},{type:"TEXT",name:i.Foreground,label:"=",x:d+121,y:c+200,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i.Strings,
label:"'text/css'",x:d+131,y:c+200,fill:"darkorange",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:i["HTML Tag"],label:">",x:d+180,y:c+200,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:i["CSS Class Name"],label:".some-class",x:d+75,y:c+220,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:i["CSS Class Name"],label:"{",x:d+145,y:c+220,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i["CSS Attribute"],label:"color:",
x:d+95,y:c+240,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i["CSS Value"],label:"#123456",x:d+130,y:c+240,fill:"darkSlateGray",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:i["CSS Text"],label:";",x:d+180,y:c+240,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i["CSS Class Name"],label:"}",x:d+75,y:c+260,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i["HTML Tag"],label:"</style>",x:d+55,y:c+280,fill:"darkorange",
family:"keyword",font:"9pt sans-serif"},{type:"RECTANGLE",name:i["Annotation Ruler"],x:d,y:c,width:46,height:a.height,family:"annotationRuler",fill:"white"}];for(var b=0;b<16;b++)a.shapes.push({type:"TEXT",name:i["Line Numbers"],label:b+1,x:d+20,y:c+20*b+20,fill:"darkSlateGray",family:"lineNumber",font:"9pt sans-serif"});return a};return{ThemeData:h,getStyles:a}});
define("orion/widgets/input/TextField",["orion/objects","orion/webui/littlelib"],function(i,k){function j(h,a){i.mixin(this,h);this.node=a||document.createElement("div");this.node.innerHTML=this.templateString;this.textfield=k.$(".setting-control",this.node)}i.mixin(j.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)k.empty(this.node),this.textfield=this.node=null},setStorageItem:function(){},width:function(h){this.textfield.style.width=h},getValue:function(){return this.inputType==="integer"?parseInt(this.textfield.value,10):this.textfield.value},setValue:function(h){this.textfield.value=h},getSelection:function(){return this.getValue()},setSelection:function(h){this.setValue(h)},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 h;if(this.selection&&this.selection.value)h=this.selection.value;this.setStorageItem(this.category,this.item,this.element,h,this.ui)}});return j});
define("orion/widgets/input/LabeledTextfield",["orion/objects","orion/webui/littlelib","orion/widgets/input/TextField"],function(i,k,j){function h(a,g){j.apply(this,arguments);this.mylabel=k.$(".setting-label",this.node)}i.mixin(h.prototype,j.prototype,{templateString:'<div class="setting-property"><label><span class="setting-label"></span><input class="setting-control" type="text" /></label></div>',destroy:function(){j.prototype.destroy.call(this);if(this.mylabel)this.mylabel=null},postCreate:function(){j.prototype.postCreate.call(this);
this.mylabel.textContent=this.fieldlabel+":"}});return h});
define("orion/widgets/input/Checkbox",["orion/objects","orion/webui/littlelib"],function(i,k){function j(h,a){i.mixin(this,h);this.node=a||document.createElement("div");this.node.innerHTML=this.templateString;this.checkbox=k.$(".setting-control",this.node)}i.mixin(j.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)k.empty(this.node),
this.checkbox=this.node=null},setStorageItem:function(){},isChecked:function(){return this.checkbox.checked},setChecked:function(h){this.checkbox.checked=h},getSelection:function(){return this.isChecked()},setSelection:function(h){this.setChecked(h)},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 j});
define("orion/widgets/input/LabeledCheckbox",["orion/objects","orion/webui/littlelib","orion/widgets/input/Checkbox"],function(i,k,j){function h(a,g){j.apply(this,arguments);this.mylabel=k.$(".setting-label",this.node)}i.mixin(h.prototype,j.prototype,{templateString:'<label><span class="setting-label"></span><input class="setting-control settingsCheckbox" type="checkbox"/></label>',postCreate:function(){j.prototype.postCreate.call(this);this.mylabel.textContent=this.fieldlabel+":"},destroy:function(){j.prototype.destroy.call(this);
if(this.mylabel)this.mylabel=null}});return h});
define("orion/widgets/input/Select",["orion/objects","orion/webui/littlelib"],function(i,k){function j(h,a){i.mixin(this,h);this.node=a||document.createElement("div");this.node.innerHTML=this.templateString;this.select=k.$(".setting-control",this.node)}i.mixin(j.prototype,{templateString:'<select class="setting-control" id="selection"></select>',addOptions:function(h){var a=document.createElement("option");a.value=h.value;a.appendChild(document.createTextNode(typeof h.label==="string"?h.label:h.value));
if(h.selected)a.selected="selected";this.select.appendChild(a)},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)k.empty(this.node),this.node=this.select=null},setStorageItem:function(){},getSelected:function(){return this.select.value},getSelectedIndex:function(){return this.select.selectedIndex},setSelectedIndex:function(h){this.select.selectedIndex=
h},getSelection:function(){return this.getSelected()},setSelection:function(h){for(var a=0;a<this.options.length;a++)if(this.options[a].value===h){this.setSelectedIndex(a);return}this.setSelectedIndex(0)},change:function(){var h=this.select.value;this.category?this.setStorageItem(this.category,this.item,this.element,h,this.ui):this.setStorageItem(h)}});return j});
define("orion/widgets/input/LabeledSelect",["orion/objects","orion/webui/littlelib","orion/widgets/input/Select"],function(i,k,j){function h(a,g){j.apply(this,arguments);this.mylabel=k.$(".setting-label",this.node)}i.mixin(h.prototype,j.prototype,{templateString:'<div class="setting-property"><label><span class="setting-label"></span><select class="setting-control"></select></label></div>',postCreate:function(){j.prototype.postCreate.call(this);this.mylabel.textContent=this.fieldlabel+":"},destroy:function(){j.prototype.destroy.call(this);
if(this.mylabel)this.mylabel=null}});return h});
define("orion/section","orion/webui/littlelib,orion/selection,orion/commandRegistry,orion/commonHTMLFragments,orion/objects,orion/selection".split(","),function(i,k,j,h,a,g){function e(a,c){var b=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");a.appendChild(this.domNode);for(var f=0;f<e.length;f++)this.domNode.classList.add(e[f]);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("sectionTitleTwistie"),this.domNode.style.cursor="pointer",this.domNode.appendChild(this.twistie),this.domNode.tabIndex=
0,this.domNode.addEventListener("click",function(a){(a.target===b.titleNode||a.target===b.twistie)&&b._changeExpandedState()},!1),this.domNode.addEventListener("keydown",function(a){a.keyCode===i.KEY.ENTER&&(a.target===b.domNode||a.target===b.titleNode||a.target===b.twistie)&&b._changeExpandedState()},!1);if(c.iconClass){var g=document.createElement("span");g.classList.add("sectionIcon");this.domNode.appendChild(g);e=Array.isArray(c.iconClass)?c.iconClass:[c.iconClass];e.forEach(function(a){g.classList.add(a)})}c.headerClass&&
(e=Array.isArray(c.headerClass)?c.headerClass:[c.headerClass],e.forEach(function(a){this.domNode.classList.add(a)}.bind(this)));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("ul");this.actionsNode.id=c.id+"ActionArea";this.actionsNode.classList.add("layoutRight");this.actionsNode.classList.add("commandList");this.actionsNode.classList.add("sectionActions");
this.domNode.appendChild(this.actionsNode);this.selectionNode=document.createElement("ul");this.selectionNode.id=c.id+"SelectionArea";this.selectionNode.classList.add("layoutRight");this.selectionNode.classList.add("commandList");this.selectionNode.classList.add("sectionActions");this.domNode.appendChild(this.selectionNode);c.slideout&&(e=h.slideoutHTMLFragment(c.id),f=document.createRange(),f.selectNode(this.domNode),e=f.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);a.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";this.domNode.classList.add("sectionWrapperClosed");
if(this._preferenceService){var j=this;this._preferenceService.getPreferences("/window/views").then(function(a){a=a.get(j.id);if(a!==void 0)j.hidden=!a;if(!j.hidden)j._contentParent.style.display="block",j.domNode.classList.remove("sectionWrapperClosed");j._updateExpandedState(!j.hidden,!1)})}else{if(!this.hidden)this._contentParent.style.display="block",this.domNode.classList.remove("sectionWrapperClosed");this._updateExpandedState(!this.hidden,!1)}this._commandService=c.commandService;this._lastMonitor=
0;this._loading={}}function f(a){this._section=a;this._id=++a._lastMonitor}e.prototype={setTitle:function(a){this.titleNode.textContent=a},getHeaderElement:function(){return this.domNode},getTitleElement:function(){return this.titleNode},getActionElement:function(){return this._toolActionsNode},setContent:function(a){typeof a==="string"?this._contentParent.innerHTML=a:(this._contentParent.innerHTML="",this._contentParent.appendChild(a))},getContentElement:function(){return this._contentParent},embedExplorer:function(d,
c,b){this._contentParent.innerHTML="";if(!d.parent)d.parent=c;this._contentParent.appendChild(d.parent);d.section=this;a.mixin(d,{createActionSections:function(){this.actionsSections&&this.actionsSections.forEach(function(a){if(!i.node(a)){var b=document.createElement("ul");b.id=a;b.classList.add("commandList");b.classList.add("layoutRight");this.section.actionsNode.appendChild(b)}}.bind(this))},getCommandsVisible:function(){return this.section.actionsNode.style.visibility!=="hidden"},setCommandsVisible:function(a){this.section.actionsNode.style.visibility=
a?"":"hidden";var b=a?null:"cursorOnly";this.renderer.selectionPolicy=b;var c=this.getNavHandler();c&&c.setSelectionPolicy(b);a?this.updateCommands():this.actionsSections&&this.actionsSections.forEach(function(a){i.node(a)&&this.commandRegistry.destroy(a)}.bind(this))},destroy:function(){Object.getPrototypeOf(this).destroy.call(this);var a=this;this.actionsSections&&(this.actionsSections.forEach(function(b){delete a[b]}),delete this.actionsSections)},updateCommands:function(a){this.section.actionsNode&&
this.getCommandsVisible()&&(this.createActionSections(),Object.getPrototypeOf(this).updateCommands.call(this,a))},loaded:function(){var a=this;if(!this.selection&&!b)this.serviceRegistry||this.registry?(this.selection=new g.Selection(this.serviceRegistry||this.registry,this.parent.id+"Selection"),this.selection.addEventListener("selectionChanged",function(b){a.updateCommands(b.selections)})):window.console.error("Could not create a Selection for the explorer because of lack of serviceRegistry");var c=
this.registerCommands();!c||!c.then?a.updateCommands():c.then(function(){a.updateCommands()})}});if(d.renderer)d.renderer.section=this,a.mixin(d.renderer,{getCellHeaderElement:function(a){(a=Object.getPrototypeOf(this).getCellHeaderElement.call(this,a))&&this.section.setTitle(a.innerHTML);return null}})},createProgressMonitor:function(){return new f(this)},_setMonitorMessage:function(a,c){this._progressNode.style.visibility="visible";this._loading[a]=c;var b="",e;for(e in this._loading)b!==""&&(b+=
"\n"),b+=this._loading[e];this._progressNode.title=b},_monitorDone:function(a){delete this._loading[a];var a="",c;for(c in this._loading)a!==""&&(a+="\n"),a+=this._loading[c];this._progressNode.title=a;if(a==="")this._progressNode.style.visibility="hidden"},_changeExpandedState:function(){this.hidden?(this._contentParent.style.display="block",this.domNode.classList.remove("sectionWrapperClosed"),this.hidden=!1):(this._contentParent.style.display="none",this.domNode.classList.add("sectionWrapperClosed"),
this.hidden=!0);this._updateExpandedState(!this.hidden,!0)},_updateExpandedState:function(a,c){var b=this.twistie,e=this.id;b&&(b.classList.add(a?this._expandImageClass:this._collapseImageClass),b.classList.remove(a?this._collapseImageClass:this._expandImageClass));this._preferenceService&&c&&this._preferenceService.getPreferences("/window/views").then(function(b){b.put(e,a)});this._onExpandCollapse&&this._onExpandCollapse(a,this)}};e.prototype.constructor=e;f.prototype={begin:function(a){this.status=
a;this._section._setMonitorMessage(this.id,a)},worked:function(a){this.status=a;this._section._setMonitorMessage(this.id,a)},done:function(a){this.status=a;this._section._monitorDone(this.id)}};f.prototype.constructor=f;return{Section:e}});
define("orion/widgets/settings/Subsection",[],function(){function i(i){var j=i.sectionName;this.parentNode=i.parentNode;this.children=i.children;i=document.createElement("section");i.classList.add("setting-row");i.setAttribute("role","region");i.setAttribute("aria-labelledby","Navigation-header");var h=document.createElement("h3");h.classList.add("setting-header");h.textContent=j;j=document.createElement("div");j.classList.add("setting-content");i.appendChild(h);i.appendChild(j);this.node=i;this.subsectionContent=
j}i.prototype.show=function(){this.parentNode&&this.parentNode.appendChild(this.node);if(this.children){var i=this;this.children.forEach(function(j){i.subsectionContent.appendChild(j.node);j.show()})}};return i});
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(i,k,j,h,a,g,e,f,d){function c(a,b,c,e,f){if(!e.local){var g=document.createElement("span");g.classList.add(o);g.classList.add(f[b+"LocalVisible"]?q:p);g.title=i.localSettingsTooltip;g.addEventListener("click",
function(){g.classList.contains(p)?(g.classList.add(q),g.classList.remove(p)):(g.classList.add(p),g.classList.remove(q))});b=d.$("label",a.node);b.parentNode.insertBefore(g,b)}return a}function b(a,b,d){return c(new j(b),a,this,b,d)}function l(a,b,d){b.inputType="integer";return c(new k(b),a,this,b,d)}function m(a,b){return!(this.min<=b[a]&&b[a]<=this.max)?i[a+"Invalid"]:""}function s(a,b){f.mixin(this,a);this.node=b}var o="setting-local-indicator",q="on",p="off",t={editorSettings:{keys:{keyBindings:{values:[{value:"",
label:i.Default},{value:"Emacs",label:"Emacs"},{value:"vi",label:"vi"}],create:function(a,b,d){var e=this.values;b.options=[];for(var f=0;f<e.length;f++){var g=e[f],i={value:g.value,label:g.label};if(g.value===d[a])i.selected=!0;b.options.push(i)}return c(new h(b),a,this,b,d)}}},fileManagement:{autoSave:{create:b},autoSaveTimeout:{min:50,max:1E4,create:l,validate:m},autoLoad:{create:b},saveDiffs:{create:b},trimTrailingWhiteSpace:{create:b}},typing:{autoPairQuotations:{create:b},autoPairParentheses:{create:b},
autoPairBraces:{create:b},autoPairSquareBrackets:{create:b},autoPairAngleBrackets:{create:b},autoCompleteComments:{create:b},smartIndentation:{create:b}},tabs:{tabSize:{min:1,max:16,create:l,validate:m},expandTab:{create:b}},whitespaces:{showTabs:{create:b},showSpaces:{create:b}},wrapping:{wordWrap:{create:b},showMargin:{create:b},marginOffset:{min:10,max:200,create:l,validate:m}},smoothScrolling:{scrollAnimation:{create:b},scrollAnimationTimeout:{min:50,max:1E3,create:l,validate:m}},rulers:{annotationRuler:{create:b},
lineNumberRuler:{create:b},foldingRuler:{create:b},overviewRuler:{create:b}},languageTools:{showOccurrences:{create:b},contentAssistAutoTrigger:{create:b}}}};f.mixin(s.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=d.$(".sections",this.node);this.createSections();this.local?this.sections.classList.add("local"):
(document.getElementById("pageActions").innerHTML=this.commandTemplate,this.createToolbar())},createSections:function(){var b=this.oldPrefs,c=[],e,f,j=this.themePreferences;if(!this.local&&this.editorThemeWidget)this.editorThemeSection=new a.Section(this.sections,{id:"editorThemeSettings",title:i.EditorThemes,canHide:!0,slideout:!0}),this.editorThemeWidget.renderData(this.editorThemeSection.getContentElement(),"INITIALIZE");else{var l=this.oldThemeStyles;if(b.themeVisible&&(!this.local||b.themeLocalVisible)){var k=
l.styles;e=[];for(var m=0;m<k.length;m++){f={value:k[m].name,label:k[m].name};if(k[m].name===l.style.name)f.selected=!0;e.push(f)}c.push(e=this.themeSelect=new h({fieldlabel:i.Theme,options:e}));e.setStorageItem=function(a){j.setTheme(a)}}if(b.fontSizeVisible&&(!this.local||b.fontSizeLocalVisible)){l=l.style.fontSize;e=[];for(k=8;k<19;k++){f={value:k+"pt",label:k+"pt"};if(f.label===l)f.selected=!0;e.push(f)}c.push(e=this.sizeSelect=new h({fieldlabel:i["Font Size"],options:e}));e.setStorageItem=function(a){j.setFontSize(a)}}!this.local&&
c.length>0&&(c=new g({sectionName:i.Theme,parentNode:this.editorThemeSection.getContentElement(),children:c}),c.show(),c=[])}var s,D;for(D in t)if(t.hasOwnProperty(D)){if(!this.local)s=new a.Section(this.sections,{id:D,title:i[D],canHide:!0,slideout:!0}),e=document.createElement("div"),e.classList.add("setting-info"),e.textContent=i.editorSettingsInfo,f=document.createElement("span"),f.classList.add(o),f.classList.add(q),l=document.createElement("span"),l.classList.add(o),l.classList.add(p),k=document.createElement("span"),
k.classList.add("core-sprite-wrench"),k.classList.add("icon-inline"),k.classList.add("imageSprite"),d.processDOMNodes(e,[f,l,k]),s.getContentElement().appendChild(e);for(var G in t[D])if(t[D].hasOwnProperty(G)){for(var z in t[D][G])if(b[z+"Visible"]&&(!this.local||b[z+"LocalVisible"]))f=t[D][G][z],e={},e.local=this.local,e.fieldlabel=i[z],c.push(f.widget=f.create(z,e,b));!this.local&&c.length>0&&(c=new g({sectionName:i[G],parentNode:s.getContentElement(),children:c}),c.show(),c=[])}}this.local&&c.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=d.node("editorSettingsToolActionsArea");this.commandService.addCommand(new e.Command({name:i.Restore,tooltip:i["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 e.Command({name:i.Update,tooltip:i["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(i["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(i["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 e=d.$("."+o,c.widget.node);a[b+"LocalVisible"]=e&&e.classList.contains(q)}return!0}.bind(this))},setValues:function(a){this._forEach(function(b,c){c.widget.setSelection(a[b]);
if(!this.local){var e=d.$("."+o,c.widget.node);e&&(a[b+"LocalVisible"]?(e.classList.add(q),e.classList.remove(p)):(e.classList.add(p),e.classList.remove(q)))}return!0}.bind(this))},destroy:function(){if(this.node)this.node=null;if(this.editorThemeWidget)this.editorThemeWidget.destroy(),this.editorThemeWidget=null}});return s});
define("orion/inputCompletion/inputCompletion",["orion/EventTarget"],function(i){function k(j,h,a){i.attach(this);this._binderFunc=h;this.setInputField(j);(j=a?a.group:null)||(j=this._inputField&&this._inputField.id?this._inputField.id:"default__input__group");this._completionIdPrefix=j+"__completion__";this._proposeFromStart=a?a.proposeFromStart:!1;this._extendedProvider=a?a.extendedProvider:null;this._serviceRegistry=a?a.serviceRegistry:null;this._onDelete=a?a.onDelete:null;this._deleteToolTips=
a?a.deleteToolTips:"";this._proposalIndex=-1;this._dismissed=!0;this._mouseDown=!1;this._dataList=[];this._initUI();this._listeners=[];a=function(a){this._binderFunc&&this._binderFunc(function(e){this._bind(e);a.deleting&&(this._proposeOn(this._inputField.value),this._selectProposal(this._proposalIndex,!0))}.bind(this))}.bind(this);this.addEventListener("inputDataListChanged",a);this._listeners.push({evtTarget:this,type:"inputDataListChanged",handler:a});a=function(){this._mouseDown=!0}.bind(this);
this._completionUIContainer.addEventListener("mousedown",a);this._listeners.push({evtTarget:this._completionUIContainer,type:"mousedown",handler:a});a=function(){this._mouseDown=!1}.bind(this);this._completionUIContainer.addEventListener("mouseup",a);this._listeners.push({evtTarget:this._completionUIContainer,type:"mouseup",handler:a})}k.prototype._removeListeners=function(i){i&&i.forEach(function(h){h.evtTarget.removeEventListener(h.type,h.handler,!1)})};k.prototype.destroy=function(){this._removeListeners(this._inputFieldListeners);
this._removeListeners(this.listeners)};k.prototype.hasValueOf=function(i){return this._dataList.some(function(h){return h.value===i})};k.prototype.setInputField=function(i){this._inputField&&this._inputFieldListeners&&this._removeListeners(this._inputFieldListeners);this._inputFieldListeners=[];this._inputField=i;if(typeof this._inputField==="string")this._inputField=document.getElementById(this._inputField);i=function(){this._mouseDown?window.setTimeout(function(){this._inputField.focus()}.bind(this),
200):this._dismiss()}.bind(this);this._inputField.addEventListener("blur",i);this._inputFieldListeners.push({evtTarget:this._inputField,type:"blur",handler:i});i=function(h){this.onKeyDown(h)}.bind(this);this._inputField.addEventListener("keydown",i);this._inputFieldListeners.push({evtTarget:this._inputField,type:"keydown",handler:i});i=function(){this._proposeOn(this._inputField.value)}.bind(this);this._inputField.addEventListener("input",i);this._inputFieldListeners.push({evtTarget:this._inputField,
type:"input",handler:i});i=function(){if(this._dismissed&&this._binderFunc)this._dismissing?this._dismissing=!1:this._binderFunc&&this._binderFunc(function(h){this._bind(h)}.bind(this))}.bind(this);this._inputField.addEventListener("focus",i);this._inputFieldListeners.push({evtTarget:this._inputField,type:"focus",handler:i})};k.prototype.onKeyDown=function(i){if(this._dismissed)return!0;var h=i.charCode||i.keyCode;if(h===13){if(this._proposalList&&this._proposalList.length>0&&this._proposalIndex>=
0&&this._proposalIndex<this._proposalList.length)return i.preventDefault(),this._dismiss(this._proposalList[this._proposalIndex].item.value,i.ctrlKey),i.stopPropagation(),!1}else if((h===40||h===38)&&this._proposalList&&this._proposalList.length>0)return i.preventDefault(),this._walk(h===40),i.stopPropagation(),!1;else if(h===27)return i.preventDefault(),this._dismiss(),!1;else if(h===46&&this._proposalIndex>-1&&this._onDelete)return i.preventDefault(),this._onDelete(this._proposalList[this._proposalIndex].item.value,
this),this._resetIndexAfterDeletion(),i.stopPropagation(),!1;return!0};k.prototype._resetIndexAfterDeletion=function(){if(this._proposalList.length<=1)this._proposalIndex=-1;else if(this._proposalIndex===this._proposalList.length-1)this._proposalIndex=this._proposalList.length-2};k.prototype._bind=function(i){this._dataList=i};k.prototype._getUIContainerID=function(){return this._completionIdPrefix+"UIContainer"};k.prototype._getUIProposalListId=function(){return this._completionIdPrefix+"UIProposalList"};
k.prototype._initUI=function(){this._completionUIContainer=document.getElementById(this._getUIContainerID());if(!this._completionUIContainer)this._completionUIContainer=document.createElement("div"),this._completionUIContainer.id=this._getUIContainerID(),this._completionUIContainer.style.display="none",this._completionUIContainer.className="inputCompletionContainer",this._completionUIContainer.setAttribute("role","list"),this._completionUIContainer.setAttribute("aria-atomic","true"),this._completionUIContainer.setAttribute("aria-live",
"assertive"),document.body.appendChild(this._completionUIContainer);this._completionUIContainer.textContent="";this._completionUL=document.getElementById(this._getUIProposalListId());if(!this._completionUL)this._completionUL=document.createElement("ul"),this._completionUL.id=this._getUIProposalListId(),this._completionUL.className="inputCompletionUL";this._completionUL.textContent="";this._completionUIContainer.appendChild(this._completionUL)};k.prototype._createProposalLink=function(i,h,a,g){var e=
document.createElement("a");e.href=require.toUrl(h);e.appendChild(this._createBoldText(i,a,g));return e};k.prototype._createBoldText=function(i,h,a,g){if(h<0)return document.createTextNode(i);var g=g?g:document.createElement("span"),e;0!==h&&(e=document.createTextNode(i.substring(0,h)),g.appendChild(e));var f=document.createElement("b");g.appendChild(f);e=document.createTextNode(i.substring(h,h+a));f.appendChild(e);h+a<i.length&&(e=document.createTextNode(i.substring(h+a)),g.appendChild(e));return g};
k.prototype._proposeOnCategory=function(i,h){if(h.length!==0){var a;if(i){a=document.createElement("li");a.className="inputCompletionLICategory";var g=document.createTextNode(i);a.appendChild(g);this._completionUL.appendChild(a)}h.forEach(function(e){a=document.createElement("li");a.onmouseover=function(a){this._selectProposal(a.currentTarget)}.bind(this);a.onclick=function(a){this._dismiss(a.currentTarget.completionItem.value)}.bind(this);a.className="inputCompletionLINormal";a.completionItem=e.item;
var f;if(typeof e.item.value==="string"){var d=document.createElement("table");d.style.width="100%";d.style.tableLayout="fixed";d.style.borderSpacing="0";var c=document.createElement("tr");c.style.width=this._inputField.offsetWidth+"px";d.appendChild(c);var b=document.createElement("td");b.classList.add("inputCompletionLILeftTD");var g=this._createBoldText(e.item.value,e.boldIndex,e.boldLength);b.appendChild(g);b.style.overflow="hidden";c.appendChild(b);if(this._onDelete)f=document.createElement("button"),
f.classList.add("inputCompletionDismissButton"),f.classList.add("layoutRight"),f.classList.add("core-sprite-close"),f.classList.add("imageSprite"),f.style.display="none",f.style.margin="0 0 0",f.title=this._deleteToolTips,f.onclick=function(a){a.stopPropagation();this._onDelete(e.item.value,this);this._resetIndexAfterDeletion()}.bind(this),b=document.createElement("td"),b.classList.add("inputCompletionLIRightTD"),b.appendChild(f),c.appendChild(b);a.appendChild(d)}else e.item.value.name&&e.item.value.type===
"link"&&a.appendChild(this._createProposalLink(e.item.value.name,e.item.value.value,e.boldIndex,e.boldLength));this._completionUL.appendChild(a);this._proposalList.push({item:e.item,domNode:a,deleteBtn:f})}.bind(this))}};k.prototype._domNode2Index=function(i){if(this._proposalList)for(var h=0;h<this._proposalList.length;h++)if(this._proposalList[h].domNode===i)return h;return-1};k.prototype._highlight=function(i,h){var a=i,g,e=!1;if(!isNaN(a))e=!0,this._proposalList&&i>=0&&i<this._proposalList.length?
(a=this._proposalList[i].domNode,g=this._proposalList[i].deleteBtn):a=null;if(a){a.className=h?"inputCompletionLISelected":"inputCompletionLINormal";if(g)g.style.display=h?"":"none";h&&e&&(a.offsetTop<this._completionUIContainer.scrollTop?a.scrollIntoView(!0):a.offsetTop+a.offsetHeight>this._completionUIContainer.scrollTop+this._completionUIContainer.clientHeight&&a.scrollIntoView(!1))}};k.prototype._selectProposal=function(i,h){var a=i;isNaN(a)&&(a=this._domNode2Index(i));if(a!==this._proposalIndex||
h)this._highlight(this._proposalIndex,!1),this._proposalIndex=a,this._highlight(this._proposalIndex,!0)};k.prototype._dismiss=function(i,h){if(!this._mouseDown){this._dismissed=!0;this._proposalList=null;this._proposalIndex=-1;if(typeof i==="string")this._inputField.value=i,this._dismissing=!0,this._inputField.focus();else if(i&&i.name&&i.type==="link")h?window.open(i.value):window.location.href=i.value;window.setTimeout(function(){this._completionUIContainer.style.display="none"}.bind(this),200)}};
k.prototype._show=function(){if(this._proposalList&&this._proposalList.length>0){for(var i=0,h=0,a=this._inputField;a;)i+=a.offsetLeft,h+=a.offsetTop,a=a.offsetParent;this._completionUIContainer.style.display="block";this._completionUIContainer.style.top=h+this._inputField.offsetHeight+2+"px";this._completionUIContainer.style.left=i+"px";this._completionUIContainer.style.width=this._inputField.offsetWidth+"px";this._dismissed=this._mouseDown=!1}else this._dismissed=!0,this._proposalList=null,this._proposalIndex=
-1,this._completionUIContainer.style.display="none"};k.prototype._walk=function(i){i=this._proposalIndex+(i?1:-1);i<-1?i=this._proposalList.length-1:i>=this._proposalList.length&&(i=-1);this._selectProposal(i)};k.prototype._proposeOnList=function(i,h,a){var g="",e=[],f=h?h.length:0;i.forEach(function(d){if(d.type==="category")this._proposeOnCategory(g,e),g=d.label,e=[];else{var c=!0,b=-1;if(h&&a){var i;typeof d.value==="string"?i=d.value.toLowerCase():d.value.name&&(i=d.value.name.toLowerCase());
b=i.indexOf(h);b<0?c=!1:this._proposeFromStart&&(c=b===0)}c&&e.push({item:d,boldIndex:b,boldLength:f})}}.bind(this));this._proposeOnCategory(g,e)};k.prototype._proposeOn=function(i){this._completionUL.textContent="";var h=i?i.toLowerCase():null;this._proposalList=[];this._proposeOnList(this._dataList,h,!0);this._extendedProvider&&h?this._extendedProvider(i,function(a){a&&a.forEach(function(a){this._proposeOnList(a.proposals,a.filterForMe?h:i,a.filterForMe)}.bind(this));this._show()}.bind(this),[]):
this._show()};k.prototype.constructor=k;return{InputCompletion:k}});
define("orion/searchAndReplace/textSearcher","i18n!orion/search/nls/messages,orion/editor/find,orion/commands,orion/objects,orion/searchUtils,orion/inputCompletion/inputCompletion,orion/webui/littlelib".split(","),function(i,k,j,h,a,g,e){function f(a,c,b,e,f){k.Find.call(this,a,e,f);this._serviceRegistry=c;this._commandService=b}f.prototype=new k.Find;h.mixin(f.prototype,{getFindString:function(){var a=document.getElementById("localSearchFindWith");return!a?k.Find.prototype.getFindString.call(this):
a.value},getReplaceString:function(){var a=document.getElementById("localSearchReplaceWith");return!a?k.Find.prototype.getReplaceString(this):a.value},hide:function(){var a=this.isVisible();k.Find.prototype.hide.call(this);a&&this._commandService.closeParameterCollector()},show:function(a){k.Find.prototype.show.call(this,a);var c=a.findString;this._addRecentfind(c);var a=a.replaceString,b=document.getElementById("localSearchFindWith");b||(this._createActionTable(),b=document.getElementById("localSearchFindWith"));
if(c)b.value=c;if(a)document.getElementById("localSearchReplaceWith").value=a;window.setTimeout(function(){b.select();b.focus()},10)},_showReplaceInfo:function(){this._regex?(this._replaceInfo.src="data:image/gif;base64,R0lGODlhBwAIAMQAAMzX6cbT5kh4qFiIuKC40FCIuGSXwmWZw2SaxGacxmadxmWcxbPM4GigyJW92JzC26DI0P///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAAHAAgAAAUmoEQUQkFI0PBEz5A2yII0w9AwkUPbRpTsjUNEQUsFIgCXiGSShAAAOw==",this._replaceInfo.title=i["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=i["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 a=this;this._commandService.openParameterCollector("pageNavigationActions",function(c){var b=document.createElement("input");b.type="text";b.name=i["Find:"];b.className="parameterInput";b.id="localSearchFindWith";b.placeholder=
i["Find With"];b.oninput=function(b){return a._handleInput(b)};b.onkeydown=function(b){return a._handleKeyDown(b)};c.appendChild(b);a._initCompletion(b);a._createButton(i.Next,c,function(){a._addRecentfind(a.getFindString());a.find(!0)});a._createButton(i.Previous,c,function(){a._addRecentfind(a.getFindString());a.find(!1)});var e=a._editor.getTextView().getOptions("readonly");if(!e){var f=document.createElement("input");f.type="text";f.name=i["ReplaceWith:"];f.className="parameterInput";f.id="localSearchReplaceWith";
f.placeholder=i["Replace With"];f.onkeydown=function(b){return a._handleKeyDown(b)};c.appendChild(f);a._replaceInfo=a._createInfoImage(null,c,null);a._showReplaceInfo();a._createButton(i.Replace,c,function(){a.replace()});a._createButton(i["Replace All"],c,function(){a.replaceAll()})}f=document.createElement("div");c.appendChild(f);f.classList.add("findOptionsDiv");var g=j.createDropdownMenu(f,i.Options,null,"dismissButton",null,!0);g.menuButton.classList.add("parameterInlineButton");j.createCheckedMenuItem(g.menu,
i["Show all"],a._showAll,function(b){a.setOptions({showAll:b.target.checked});g.dropdown.close(!0)});j.createCheckedMenuItem(g.menu,i["Case sensitive"],!a._caseInsensitive,function(b){a.setOptions({caseInsensitive:!b.target.checked});g.dropdown.close(!0);a.find(!0)});j.createCheckedMenuItem(g.menu,i["Wrap search"],a._wrap,function(b){a.setOptions({wrap:b.target.checked});g.dropdown.close(!0)});j.createCheckedMenuItem(g.menu,i["Incremental search"],a._incremental,function(b){a.setOptions({incremental:b.target.checked});
g.dropdown.close(!0)});j.createCheckedMenuItem(g.menu,i["Whole Word"],a._wholeWord,function(b){a.setOptions({wholeWord:b.target.checked});g.dropdown.close(!0);a.find(!0)});a._regExBox=j.createCheckedMenuItem(g.menu,i["Regular expression"],a._regex,function(b){a.setOptions({regex:b.target.checked});g.dropdown.close(!0);a.find(!0);a._showReplaceInfo()});e||j.createCheckedMenuItem(g.menu,i["Find after replace"],a._findAfterReplace,function(b){a.setOptions({findAfterReplace:b.target.checked});g.dropdown.close(!0)});
return b},function(){a.hide()})},_storeRecentFind:function(a,c,b){this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(e){e.put("recentFind",a);c&&window.setTimeout(function(){c.dispatchEvent({type:"inputDataListChanged",deleting:b})}.bind(this),20)})},_addRecentfind:function(a){typeof a==="string"&&a&&(!this._completion||!this._completion.hasValueOf(a))&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){var b,
c=c.get("recentFind");typeof c==="string"&&(c=JSON.parse(c));if(c){for(b in c)if(c[b].name===a)return;c.length>=30&&c.splice(29,c.length-30+1)}else c=[];c.splice(0,0,{name:a});this._storeRecentFind(c,this._completion)}.bind(this))},_removeRecentSearch:function(a,c){typeof a==="string"&&a&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){var e,b=b.get("recentFind");typeof b==="string"&&(b=JSON.parse(b));if(b)for(e in b)if(b[e].name===a){b.splice(e,
1);this._storeRecentFind(b,c,!0);break}}.bind(this))},_initCompletion:function(a){if(this._completion)this._completion.setInputField(a);else{var c=function(a){this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){c=c.get("recentFind");typeof c==="string"&&(c=JSON.parse(c));if(c){var d=[];c.forEach(function(a){d.push({type:"proposal",label:a.name,value:a.name})});a(d)}})}.bind(this);this._completion=new g.InputCompletion(a,c,{serviceRegistry:this._serviceRegistry,
group:"localSearch",onDelete:function(a,c){this._removeRecentSearch(a,c)}.bind(this),deleteToolTips:i["Click or use delete key to delete the search term"]})}},_createButton:function(a,c,b){var f=document.createElement("button");f.addEventListener("click",b.bind(this),!1);var g=this;f.addEventListener("keydown",function(a){a.keyCode===e.KEY.ESCAPE&&g.hide()});f.appendChild(document.createTextNode(a));f.className="dismissButton parameterInlineButton";c.appendChild(f)},_createInfoImage:function(a,c){var b=
document.createElement("img");b.classList.add("replaceInfo");b.addEventListener("click",function(){this._regExBox.checked=!this._regex;this.setOptions({regex:!this._regex});this.find(!0);this._showReplaceInfo()}.bind(this));c.appendChild(b);return b},_handleInput:function(){this._incremental&&this.find(!0,null,!0);return!0},_handleKeyDown:function(a){var c=(this.isMac?a.metaKey:a.ctrlKey)&&!a.altKey&&!a.shiftKey;if(c&&a.keyCode===70)return a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0,
!1;if((this.isMac?a.metaKey:a.ctrlKey)&&!a.altKey&&a.keyCode===75||a.keyCode===13)return a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0,this._addRecentfind(this.getFindString()),a.keyCode===13?this.find(this._reverse?a.shiftKey:!a.shiftKey):this.find(!a.shiftKey),!1;if(c&&a.keyCode===82)return a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0,this.replace(),!1;return a.keyCode===27?(this.hide(),!1):!0}});return{TextSearcher:f}});
define("orion/blamer",["orion/extensionCommands","orion/PageLinks","orion/URITemplate"],function(i,k,j){function h(a,g){for(var e=g.getFileMetadata(),f=a.getServiceReferences("orion.edit.blamer"),d=0;d<f.length;d++){var c=f[d],b={};b.validationProperties=c.getProperty("validationProperties");b.forceSingleItem=!0;b=i._makeValidator(b,a);if(b.validationFunction.bind(b)(e))return a.getService(c)}return null}return{isVisible:function(a,g){return!!h(a,g)&&!!a.getService("orion.core.blame")},getBlame:function(a,
g){var e=h(a,g);e&&e.doBlame(g.getInput()).then(function(e){for(var d=k.getOrionHome(),c=0;c<e.length;c++){var b=e[c],g=new j(b.CommitLink),h={};h.OrionHome=d;b.CommitLink=g.expand(h)}a.getService("orion.core.blame")._setAnnotations(e)})}}});
define("orion/edit/editorContext",[],function(){return{getEditorContext:function(i){var k=Object.create(null);i.getServiceReferences("orion.edit.context").forEach(function(j){var h=i.getService(j);Object.keys(h).forEach(function(a){typeof h[a]==="function"&&(k[a]=h[a].bind(h))})});return k},getOptions:function(i){var k=Object.create(null);i.getServiceReferences("orion.edit.context").forEach(function(i){i.getPropertyKeys().forEach(function(h){h!=="service.id"&&h!=="service.names"&&h!=="objectClass"&&
(k[h]=i.getProperty(h))})});return k}}});
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/editor/annotations,orion/blamer,orion/regex,orion/util,orion/edit/editorContext".split(","),function(i,k,j,h,a,g,e,f,d,c,b,l,m,s,o,q,p,t,r,u){function v(a){var b=
new e(a.uriTemplate),c=a.params||{};c.OrionHome=c.OrionHome||o.getOrionHome();var b=b.expand(c),c=document.createElement("div"),d=document.createElement("iframe");d.id=a.id;d.name=a.id;d.type="text/html";d.sandbox="allow-scripts allow-same-origin";d.frameborder=a.border!==void 0?a.border:1;d.src=b;d.className="delegatedUI";if(a.width)c.style.width=a.width,d.style.width=a.width;if(a.height)c.style.height=a.height,d.style.height=a.height;d.style.visibility="hidden";a.parent!==null&&(a.parent||window.document.body).appendChild(c);
c.appendChild(d);d.style.left=a.left||(window.innerWidth-parseInt(d.clientWidth,10))/2+"px";d.style.top=a.top||(window.innerHeight-parseInt(d.clientHeight,10))/2+"px";d.style.visibility="";window.addEventListener("message",function z(b){if(b.source===d.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",z,!1);d.parentNode.removeChild(d)}},!1);return c}function n(a){this.serviceRegistry=a.serviceRegistry;this.commandService=a.commandRegistry;this.fileClient=a.fileClient;this.inputManager=a.inputManager;this.toolbarId=a.toolbarId;this.saveToolbarId=a.saveToolbarId;this.editToolbarId=a.editToolbarId;this.pageNavId=a.navToolbarId;this.isReadOnly=a.readonly;this._localSearcher=a.textSearcher;this._searcher=a.searcher;this.editorSettings=a.editorSettings;
this.localSettings=a.localSettings}var w={},x=null;w.createDelegatedUI=v;n.prototype={generateSimpleEditorCommands:function(a,b){this.isReadOnly||(this._generateUndoStackCommands(a),this._generateSaveCommand(a,b));this._generateSearchFilesCommand(a);this._generateGotoLineCommnand(a);this._generateFindCommnand(a)},generateEditorCommands:function(a){this.generateBaseEditorCommands(a);this.generateExtraEditorCommands(a)},generateBaseEditorCommands:function(a){this.isReadOnly||(this._generateUndoStackCommands(a),
this._generateSaveCommand(a),this._generateEditCommands(a))},generateExtraEditorCommands:function(a){this._generateSettingsCommand(a);this._generateSearchFilesCommand(a);this._generateGotoLineCommnand(a);this._generateFindCommnand(a);this._generateBlame(a)},_generateSettingsCommand:function(b){var c=this,e=new f.Command({imageClass:"core-sprite-wrench",tooltip:i.LocalEditorSettings,id:"orion.edit.settings",visibleWhen:function(){return b.installed},callback:function(d){var f=e.settingsDropDown;if(!f||
f.isDestroyed())f=e.settingsDropDown=new a(d.domNode.parentNode,d.domNode,{noClick:!0,selectionClass:"dropdownSelection",onShow:function(){f.focus()},onHide:function(){b.focus()}}),f.updateContent=c.localSettings.show.bind(c.localSettings),d=f.getContentNode(),d.tabIndex=d.style.marginTop=0;f.click()}});this.commandService.addCommand(e);this.commandService.registerCommandContribution("settingsActions","orion.edit.settings",1,null,!1,new d.KeyBinding("s",!0,!0))},_generateUndoStackCommands:function(a){this.commandService.addCommand(new f.Command({name:i.Undo,
id:"orion.undo",visibleWhen:function(){return a.installed},callback:function(){a.getUndoStack().undo()}}));this.commandService.registerCommandContribution(this.editToolbarId||this.toolbarId,"orion.undo",400,this.editToolbarId?"orion.menuBarEditGroup/orion.undoGroup":null,!this.editToolbarId,new d.KeyBinding("z",!0));this.commandService.addCommand(new f.Command({name:i.Redo,id:"orion.redo",visibleWhen:function(){return a.installed},callback:function(){a.getUndoStack().redo()}}));this.commandService.registerCommandContribution(this.editToolbarId||
this.toolbarId,"orion.redo",401,this.editToolbarId?"orion.menuBarEditGroup/orion.undoGroup":null,!this.editToolbarId,r.isMac?new d.KeyBinding("z",!0,!0):new d.KeyBinding("y",!0))},_generateSearchFilesCommand:function(a){var b=this;if(b._searcher){var c=!1;this.commandService.addCommand(new f.Command({name:i.searchFiles,tooltip:i.searchFiles,id:"orion.searchFiles",visibleWhen:function(){return a.installed},callback:function(){if(!c){var d=a.getSelection(),d=a.getText(d.start,d.end),e=b.serviceRegistry.getService("orion.page.progress"),
f=new h.OpenResourceDialog({searcher:b._searcher,progress:e,searchRenderer:b._searcher.defaultRenderer,nameSearch:!1,title:i.searchFiles,message:i.searchTerm,initialText:d,onHide:function(){c=!1;a.focus()}});window.setTimeout(function(){c=!0;f.show(j.node(b.toolbarId))},0)}}}));this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.searchFiles",1,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new d.KeyBinding("h",!0))}},_generateSaveCommand:function(a,
b){var c=this,e=b?b:"orion.save",g=new f.Command({name:i.Save,tooltip:i.saveFile,id:e,visibleWhen:function(){return!a.installed||c.inputManager.getReadOnly()?!1:!0},callback:function(){c.inputManager.save();return!0}});this.commandService.addCommand(g);this.commandService.registerCommandContribution(this.saveToolbarId||this.toolbarId,e,1,this.saveToolbarId?"orion.menuBarFileGroup/orion.saveGroup":null,!1,new d.KeyBinding("s",!0));a.getTextView&&a.getTextView()&&(a.getTextView().setKeyBinding(new d.KeyBinding("s",
!0),"save"),a.getTextView().setAction("save",g.callback,g))},_generateGotoLineCommnand:function(a){var b=this,e=new c.ParametersDescription([new c.CommandParameter("line","number","Line:")],{hasOptionalParameters:!1},function(){var b=a.getModel().getLineAtOffset(a.getCaretOffset())+1;return[new c.CommandParameter("line","number","Line:",b.toString())]}),e=new f.Command({name:i.gotoLine,tooltip:i.gotoLineTooltip,id:"orion.gotoLine",visibleWhen:function(){return a.installed},parameters:e,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(i.gotoLinePrompt,b+1))&&(b=parseInt(b,10)));if(b)a.onGotoLine(b-1,0)}});this.commandService.addCommand(e);this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.gotoLine",3,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new d.KeyBinding("l",!r.isMac,!1,!1,r.isMac),new c.URLBinding("gotoLine",
"line"));a.getTextView&&a.getTextView()&&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},e)},_generateFindCommnand:function(a){var b=this,e=new c.ParametersDescription([new c.CommandParameter("find","text","Find:")],{clientCollect:!0},function(){var d=a.getSelection(),e="";d.end>d.start&&(e=a.getModel().getText(d.start,d.end),b._localSearcher&&b._localSearcher.getOptions().regex&&(e=
t.escape(e)));return[new c.CommandParameter("find","text","Find:",e)]}),e=new f.Command({name:i.Find,tooltip:i.Find,id:"orion.editor.find",visibleWhen:function(){return a.installed},parameters:e,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=t.escape(d))):c.parameters&&c.parameters.valueFor("find")&&(d=c.parameters.valueFor("find"),
e=s.matchResourceParameters(),m.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(e);this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.editor.find",0,
this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new d.KeyBinding("f",!0),new c.URLBinding("find","find"));a.getTextView&&a.getTextView()&&a.getTextView().setAction("find",function(a){if(a)return b._localSearcher.show(a),!0;b.commandService.runCommand("orion.editor.find",null,null,new c.ParametersDescription([new c.CommandParameter("useEditorSelection","text","","true")],{clientCollect:!0}));return!0},e)},_generateBlame:function(a){var b=this;this.commandService.addCommand(new f.Command({name:i.Blame,
tooltip:i.BlameTooltip,id:"orion.edit.blame",parameters:new c.ParametersDescription([new c.CommandParameter("blame","boolean")],{clientCollect:!0}),visibleWhen:function(){return!a.installed?!1:p.isVisible(b.serviceRegistry,b.inputManager)},callback:function(c){for(var d=!1,e=a.getAnnotationModel().getAnnotations();e.hasNext();)if(e.next().type===q.AnnotationType.ANNOTATION_BLAME){d=!0;break}d=!d;c.parameters&&c.parameters.valueFor("blame")&&(d=c.parameters.valueFor("blame")==="true");d?p.getBlame(b.serviceRegistry,
b.inputManager):a.showBlame([])}}));this.commandService.registerCommandContribution(this.toolbarId,"orion.edit.blame",1,"orion.menuBarToolsGroup",!1,new d.KeyBinding("b",!0,!0),new c.URLBinding("blame","blame"))},_generateEditCommands:function(a){function c(a){if(!a)return null;var b=new d.KeyBinding;d.KeyBinding.apply(b,a);return b}function e(a,b){!b&&a&&typeof a.HTML!=="undefined"&&delete a.HTML;var c=h.serviceRegistry.getService("orion.page.message");c?c.setProgressResult(a):window.console.log(a)}
var h=this,n=this.toolbarId,m=this.serviceRegistry,o=m.getServiceReferences("orion.edit.command"),p=this.inputManager,w=m.getService("orion.page.progress"),s=function(b,c,d){var g=d.visibleWhen;d.visibleWhen=function(b){return!a.installed||h.inputManager.getReadOnly()?!1:!g||g(b)};d.callback=function(){a=this;var d=a.getSelection?a.getSelection():{start:0,end:0},f=a.getModel(),g=function(b){typeof b==="object"&&b?(b.text&&a.setText(b.text),b.selection&&(a.setSelection&&a.setSelection(b.selection.start,
b.selection.end,!0),a.focus())):typeof b==="string"&&(a.setText(b,d.start,d.end,!0),a.setSelection&&a.setSelection(d.start,d.start+b.length),a.focus())},h;c.execute?(f={contentType:p.getContentType(),input:p.getInput()},h=u.getEditorContext(m),h.openDelegatedUI=v,h.setStatus=e,f=c.execute(h,f),h=null):(f=c.run(f.getText(d.start,d.end),f.getText(),d,p.getInput()),h=function(a){if(a&&a.uriTemplate){var c={};c.uriTemplate=a.uriTemplate;c.params=p.getFileMetadata();c.id=b.id;c.width=a.width;c.height=
a.height;c.done=g;c.status=e;v(c)}else a&&(a.Status||a.status)?e(a.Status||a.status):g(a)});w.showWhile(f,k.formatMessage(i.running,b.name)).then(h);return!0};d.callback=d.callback.bind(a);return new f.Command(d)};g.when(function(a){if(x)return x;var b=a.getService("orion.core.contentTypeRegistry");b||(b=new l.ContentTypeRegistry(a),b=a.getService("orion.core.contentTypeRegistry"));return b.getContentTypes().then(function(a){return x=a})}(this.serviceRegistry),function(){var d=[],e=100;o.forEach(function(f){var g=
f.getProperty("editor");if(!g||!(a.id&&g!==a.id)){for(var i=h.serviceRegistry.getService(f),j={},g=f.getPropertyKeys(),k=0;k<g.length;k++)j[g[k]]=f.getProperty(g[k]);j.forceSingleItem=!0;f=b._createCommandOptions(j,f,h.serviceRegistry,x,!1,function(){return p.getFileMetadata()});d.push(f);f.then(function(a){a=s(j,i,a);h.commandService.addCommand(a);h.commandService.registerCommandContribution(h.toolbarId,a.id,e,"orion.menuBarToolsGroup",!1,c(j.key))});e++}});g.all(d,function(a){return{_error:a}}).then(function(){var b;
if(b=p.getFileMetadata()){var c=j.node(n);c&&(h.commandService.destroy(c),h.commandService.renderCommands(c.id,c,b,a,"button"));if(c=j.node("pageNavigationActions"))h.commandService.destroy(c),h.commandService.renderCommands(c.id,c,a,a,"button")}})})}};w.EditorCommandFactory=n;return w});
define("orion/edit/dispatcher",["orion/edit/dispatcher"],function(){function i(i,j,h){this.serviceRegistry=i;this.editor=j;this.inputManager=h;this.contentTypeService=i.getService("orion.core.contentTypeRegistry");if(!this.contentTypeService)throw Error("Missing required service");this.serviceReferences={};var a=this;this.listener={onServiceAdded:function(g){a._onServiceAdded(g.serviceReference)},onServiceRemoved:function(g){a._onServiceRemoved(g.serviceReference)}};this.serviceRegistry.addEventListener("registered",
this.listener.onServiceAdded);this.serviceRegistry.addEventListener("unregistering",this.listener.onServiceRemoved);this._init()}i.prototype={_init:function(){var i=this;this.editor.getTextView()?this._wire(this.serviceRegistry):this.editor.addEventListener("TextViewInstalled",function(){i._wire(i.serviceRegistry)})},_wire:function(i){for(var i=i.getServiceReferences("orion.edit.model"),j=0;j<i.length;j++)this._wireServiceReference(i[j])},_wireServiceReference:function(i){var j=i.getProperty("contentType");
if(typeof j!==void 0&&j!==null){var h=this;this.contentTypeService.isSomeExtensionOf(this.inputManager.getContentType(),j).then(function(a){a&&h._wireService(i,h.serviceRegistry.getService(i))})}},_wireService:function(i,j){for(var h=Object.keys(j),a=this.editor.getTextView(),g=0;g<h.length;g++){var e=h[g],f=j[e];e.substr(0,2)!=="on"||typeof f!=="function"||(e=e.substr(2),this._wireServiceMethod(i,j,f,a,e))}this._initService(j,a)},_wireServiceMethod:function(i,j,h,a,g){j=function(a){h(a).then()};
i=i.getProperty("service.id");this.serviceReferences[i]=this.serviceReferences[i]||[];this.serviceReferences[i].push([a,g,j]);a.addEventListener(g,j)},_onServiceRemoved:function(i){var i=i.getProperty("service.id"),j=this.serviceReferences[i];if(j){for(var h=0;h<j.length;h++){var a=j[h];a[0].removeEventListener(a[1],a[2])}delete this.serviceReferences[i]}},_onServiceAdded:function(i){i.getProperty("objectClass").indexOf("orion.edit.model")!==-1&&this._wireServiceReference(i)},_initService:function(i,
j){var h=i.onModelChanging;if(typeof h==="function"){var a=j.getModel(),g=a.getText(),a={type:"Changing",text:g,start:0,removedCharCount:0,addedCharCount:g.length,removedLineCount:0,addedLineCount:a.getLineCount()};h.call(i,a)}}};return{Dispatcher:i}});
define("orion/edit/typedefs",["orion/objects","orion/serviceTracker"],function(i,k){function j(h){this.props=Object.create(null);this.defs=Object.create(null);this.registration=null;var a=new k(h,"orion.core.typedef"),g=this;a.onServiceAdded=function(a){var f=a.getProperty("id"),d=a.getProperty("defs");if(!f||!d)throw Error("TypeDef registration missing required 'id' or 'defs' [service id: "+a.getProperty("service.id")+"]");var c={};a.getPropertyKeys().forEach(function(b){b!=="defs"&&b!=="service.id"&&
b!=="service.names"&&b!=="objectClass"&&(c[b]=a.getProperty(b))});g.props[f]=c;g.defs[f]=d;g._updateRegistration()};a.removedService=function(a){a=a.getProperty("id");delete g.props[a];delete g.defs[a];g._updateRegistration()};a.open();this.registration=h.registerService("orion.edit.context",{getTypeDef:this.getTypeDef.bind(this)},null);this._updateRegistration()}i.mixin(j.prototype,{_updateRegistration:function(){this.registration&&this.registration.setProperties({typeDefs:this.getAllProperties()})},
getTypeDef:function(h){return this.defs[h]||null},getProperties:function(h){return this.props[h]||null},getAllProperties:function(){return this.props}});return j});
define("orion/editor/stylers/lib/syntax",[],function(){return{id:"orion.lib",grammars:[{id:"orion.lib",patterns:[{include:"#brace_open"},{include:"#brace_close"},{include:"#bracket_open"},{include:"#bracket_close"},{include:"#parenthesis_open"},{include:"#parenthesis_close"},{include:"#number_decimal"},{include:"#number_hex"},{include:"#string_doubleQuote"},{include:"#string_singleQuote"}],repository:{brace_open:{match:"{",name:"punctuation.section.block.begin"},brace_close:{match:"}",name:"punctuation.section.block.end"},
bracket_open:{match:"\\[",name:"punctuation.section.bracket.begin"},bracket_close:{match:"\\]",name:"punctuation.section.bracket.end"},parenthesis_open:{match:"\\(",name:"punctuation.section.parens.begin"},parenthesis_close:{match:"\\)",name:"punctuation.section.parens.end"},doc_block:{begin:"/\\*\\*",end:"\\*/",name:"comment.block.documentation",patterns:[{match:"@(?:(?!\\*/)\\S)*",name:"keyword.other.documentation.tag"},{match:"\\<\\S*\\>",name:"keyword.other.documentation.markup"},{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",
name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]},number_decimal:{match:"\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:[eE][+-]?\\d+)?\\b",name:"constant.numeric.number"},number_hex:{match:"\\b0[xX][0-9A-Fa-f]+\\b",name:"constant.numeric.hex"},string_doubleQuote:{match:'"(?:\\\\.|[^"])*"?',name:"string.quoted.double"},string_singleQuote:{match:"'(?:\\\\.|[^'])*'?",name:"string.quoted.single"},todo_comment_singleLine:{match:"(\\b)(TODO)(\\b)(.*)",
name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.line"}}}}},{id:"orion.c-like",patterns:[{include:"orion.lib"},{include:"#comment_singleLine"},{include:"#comment_block"}],repository:{comment_singleLine:{match:"//.*",name:"comment.line.double-slash",patterns:[{include:"orion.lib#todo_comment_singleLine"}]},comment_block:{begin:"/\\*",end:"\\*/",name:"comment.block",patterns:[{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",
captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]}}}],keywords:[]}});
define("orion/editor/stylers/application_javascript/syntax",["orion/editor/stylers/lib/syntax"],function(i){var k="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(","),i=i.grammars;i.push({id:"orion.js",contentTypes:["application/javascript"],patterns:[{include:"orion.lib#doc_block"},
{include:"orion.c-like"},{match:"\\b(?:"+k.join("|")+")\\b",name:"keyword.control.js"},{match:"/(?![\\s])(?:\\\\.|[^/])+/(?:[gim]{0,3})",name:"string.regexp.js"},{begin:"'(?:\\\\.|[^\\\\'])*\\\\$",end:"^(?:$|(?:\\\\.|[^\\\\'])*('|[^\\\\]$))",name:"string.quoted.single.js"},{begin:'"(?:\\\\.|[^\\\\"])*\\\\$',end:'^(?:$|(?:\\\\.|[^\\\\"])*("|[^\\\\]$))',name:"string.quoted.double.js"}]});return{id:i[i.length-1].id,grammars:i,keywords:k}});
define("orion/editor/stylers/text_x-java-source/syntax",["orion/editor/stylers/lib/syntax"],function(i){var k="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(","),i=i.grammars;i.push({id:"orion.java",contentTypes:["text/x-java-source"],
patterns:[{include:"orion.lib#doc_block"},{include:"orion.c-like"},{match:"\\b(?:"+k.join("|")+")\\b",name:"keyword.control.java"}],repository:{string_singleQuote:{}}});return{id:i[i.length-1].id,grammars:i,keywords:k}});
define("orion/editor/stylers/text_css/syntax",["orion/editor/stylers/lib/syntax"],function(i){var k="alignment-adjust,alignment-baseline,animation-delay,animation-direction,animation-duration,animation-iteration-count,animation-name,animation-play-state,animation-timing-function,animation,appearance,azimuth,backface-visibility,background-attachment,background-clip,background-color,background-image,background-origin,background-position,background-repeat,background-size,background,baseline-shift,binding,bleed,bookmark-label,bookmark-level,bookmark-state,bookmark-target,border-bottom-color,border-bottom-left-radius,border-bottom-right-radius,border-bottom-style,border-bottom-width,border-bottom,border-collapse,border-color,border-image-outset,border-image-repeat,border-image-slice,border-image-source,border-image-width,border-image,border-left-color,border-left-style,border-left-width,border-left,border-radius,border-right-color,border-right-style,border-right-width,border-right,border-spacing,border-style,border-top-color,border-top-left-radius,border-top-right-radius,border-top-style,border-top-width,border-top,border-width,border,bottom,box-align,box-decoration-break,box-direction,box-flex-group,box-flex,box-lines,box-ordinal-group,box-orient,box-pack,box-shadow,box-sizing,break-after,break-before,break-inside,caption-side,clear,clip,color-profile,color,column-count,column-fill,column-gap,column-rule-color,column-rule-style,column-rule-width,column-rule,column-span,column-width,columns,content,counter-increment,counter-reset,crop,cue-after,cue-before,cue,cursor,direction,display,dominant-baseline,drop-initial-after-adjust,drop-initial-after-align,drop-initial-before-adjust,drop-initial-before-align,drop-initial-size,drop-initial-value,elevation,empty-cells,fit-position,fit,flex-align,flex-flow,flex-inline-pack,flex-order,flex-pack,float-offset,float,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,font,grid-columns,grid-rows,hanging-punctuation,height,hyphenate-after,hyphenate-before,hyphenate-character,hyphenate-lines,hyphenate-resource,hyphens,icon,image-orientation,image-rendering,image-resolution,inline-box-align,left,letter-spacing,line-height,line-stacking-ruby,line-stacking-shift,line-stacking-strategy,line-stacking,list-style-image,list-style-position,list-style-type,list-style,margin-bottom,margin-left,margin-right,margin-top,margin,mark-after,mark-before,mark,marker-offset,marks,marquee-direction,marquee-loop,marquee-play-count,marquee-speed,marquee-style,max-height,max-width,min-height,min-width,move-to,nav-down,nav-index,nav-left,nav-right,nav-up,opacity,orphans,outline-color,outline-offset,outline-style,outline-width,outline,overflow-style,overflow-x,overflow-y,overflow,padding-bottom,padding-left,padding-right,padding-top,padding,page-break-after,page-break-before,page-break-inside,page-policy,page,pause-after,pause-before,pause,perspective-origin,perspective,phonemes,pitch-range,pitch,play-during,position,presentation-level,punctuation-trim,quotes,rendering-intent,resize,rest-after,rest-before,rest,richness,right,rotation-point,rotation,ruby-align,ruby-overhang,ruby-position,ruby-span,size,speak-header,speak-numeral,speak-punctuation,speak,speech-rate,stress,string-set,table-layout,target-name,target-new,target-position,target,text-align-last,text-align,text-decoration,text-emphasis,text-height,text-indent,text-justify,text-outline,text-shadow,text-transform,text-wrap,top,transform-origin,transform-style,transform,transition-delay,transition-duration,transition-property,transition-timing-function,transition,unicode-bidi,vertical-align,visibility,voice-balance,voice-duration,voice-family,voice-pitch-range,voice-pitch,voice-rate,voice-stress,voice-volume,volume,white-space-collapse,white-space,widows,width,word-break,word-spacing,word-wrap,z-index".split(","),i=
i.grammars;i.push({id:"orion.css",contentTypes:["text/css"],patterns:[{include:"orion.lib"},{include:"orion.c-like#comment_block"},{match:"(?:-webkit-|-moz-|-ms-|\\b)(?:"+k.join("|")+")\\b",name:"keyword.control.css"},{match:"(?i)\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:%|em|ex|ch|rem|vw|vh|vmin|vmax|in|cm|mm|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?\\b",name:"constant.numeric.value.css"},{begin:"(['\"])(?:\\\\.|[^\\\\\\1])*\\\\$",end:"^(?:$|(?:\\\\.|[^\\\\\\1])*(\\1|[^\\\\]$))",name:"string.quoted.multiline.css"}],
repository:{number_hex:{match:"#[0-9A-Fa-f]+\\b",name:"constant.numeric.hex.css"}}});return{id:i[i.length-1].id,grammars:i,keywords:k}});
define("examples/editor/textStyler",["orion/editor/annotations","orion/editor/stylers/application_javascript/syntax","orion/editor/stylers/text_x-java-source/syntax","orion/editor/stylers/text_css/syntax"],function(i,k,j,h){function a(a,b){this.keywords=a;this.whitespacesVisible=b;this.setText("")}function g(){a.call(this,null,!0)}function e(b){a.call(this,null,b)}function f(){a.call(this,null,!1)}function d(d,h,i){this.commentStart="/*";this.commentEnd="*/";var j=[];switch(h){case "java":j=b;break;
case "js":j=c;break;case "css":j=l}this.whitespacesVisible=this.spacesVisible=this.tabsVisible=!1;this.detectHyperlinks=!0;this.highlightCaretLine=!1;this.detectTasks=this.foldingEnabled=!0;this._scanner=new a(j,this.whitespacesVisible);this._firstScanner=new f;this._commentScanner=new e(this.whitespacesVisible);this._whitespaceScanner=new g;if(h==="css")this._scanner.isCSS=!0,this._firstScanner.isCSS=!0;this.view=d;this.annotationModel=i;this._bracketAnnotations=void 0;var k=this;this._listener=
{onChanged:function(a){k._onModelChanged(a)},onDestroy:function(a){k._onDestroy(a)},onLineStyle:function(a){k._onLineStyle(a)},onMouseDown:function(a){k._onMouseDown(a)},onSelection:function(a){k._onSelection(a)}};h=d.getModel();h.getBaseModel&&(h=h.getBaseModel());h.addEventListener("Changed",this._listener.onChanged);d.addEventListener("MouseDown",this._listener.onMouseDown);d.addEventListener("Selection",this._listener.onSelection);d.addEventListener("Destroy",this._listener.onDestroy);d.addEventListener("LineStyle",
this._listener.onLineStyle);this._computeComments();this._computeFolding();d.redrawLines()}var c=k.keywords,b=j.keywords,l=h.keywords,m={styleClass:"comment"},s={styleClass:"comment"},o={styleClass:"comment block documentation"},q={styleClass:"keyword other documentation markup"},p={styleClass:"keyword other documentation task"},t={styleClass:"keyword other documentation tag"},r={styleClass:"string"},u={styleClass:"constant numeric"},v={styleClass:"keyword"},n={styleClass:"punctuation separator space",
unmergeable:!0},w={styleClass:"punctuation separator tab",unmergeable:!0},x={styleClass:"meta annotation currentLine"};a.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}};g.prototype=new a(null);g.prototype.nextToken=function(){for(this.startOffset=this.offset;;){var a=this._read();switch(a){case -1:return null;case 32:return 11;case 9:return 10;default:do a=this._read();while(!(a===32||a===9||a===-1));this._unread(a);
return 1}}};e.prototype=new a(null);e.prototype.setType=function(a){this._type=a};e.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}}};f.prototype=new a(null);f.prototype._default=function(a){for(;;)switch(a=this._read(),a){case 47:case 34:case 39:case -1:return this._unread(a),
1}};d.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(i.AnnotationType.ANNOTATION_FOLDING);for(var c=[],d=a.getBaseModel(),e=this.comments,f=0;f<e.length;f++){var g=e[f];(g=this._createFoldingAnnotation(a,d,g.start,g.end))&&c.push(g)}b.replaceAnnotations(null,c)}}}},_createFoldingAnnotation:function(a,b,c,d){var e=b.getLineAtOffset(c),b=b.getLineAtOffset(d);return e===b?null:new (i.AnnotationType.getType(i.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 g=d.getAnnotations(b,c),e=[],h=i.AnnotationType.ANNOTATION_TASK;g.hasNext();){var j=g.next();j.type===h&&e.push(j)}g=[];j=this._commentScanner;j.setText(f.getText(b,c));for(var l;l=j.nextToken();){var k=j.getStartOffset()+b;l===14&&(l=f.getLineEnd(f.getLineAtOffset(k)),a!==6&&(l=Math.min(l,c-this.commentEnd.length)),g.push(i.AnnotationType.createAnnotation(h,k,l,f.getText(k,l))))}d.replaceAnnotations(e,
g)}}},_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 x}return null},_getStyles:function(a,b,c){a.getBaseModel&&(c=a.mapOffset(c));for(var d=c+b.length,e=[],f=c,g=this.comments,h=this._binarySearch(g,c,!0);h<g.length;h++){if(g[h].start>=d)break;var i=g[h].start,j=g[h].end;f<i&&this._parse(b.substring(f-c,i-c),f,e);var l=g[h].type,k;switch(l){case 8:k=o;break;case 7:k=s;break;case 5:k=
r}f=Math.max(f,i);i=Math.min(d,j);(l===8||l===7)&&(this.whitespacesVisible||this.detectHyperlinks)?this._parseComment(b.substring(f-c,i-c),f,e,k,l):l===5&&this.whitespacesVisible?this._parseString(b.substring(f-c,i-c),f,e,r):e.push({start:f,end:i,style:k});f=j}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(a,b,c){var d=this._scanner;for(d.setText(a);a=d.nextToken();){var e=
d.getStartOffset()+b,f=null;switch(a){case 2:f=v;break;case 3:f=u;break;case 5:case 4:if(this.whitespacesVisible){this._parseString(d.getData(),e,c,r);continue}else f=r;break;case 8:this._parseComment(d.getData(),e,c,o,a);continue;case 6:this._parseComment(d.getData(),e,c,m,a);continue;case 7:this._parseComment(d.getData(),e,c,s,a);continue;case 10:this.whitespacesVisible&&this.tabsVisible&&(f=w);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(f=n)}c.push({start:e,end:d.getOffset()+b,
style:f})}},_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,g=d;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(g=w);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(g=n);break;case 12:g=q;break;case 13:g=t;break;case 14:g=p;break;default:this.detectHyperlinks&&(g=this._detectHyperlinks(f.getData(),e,c,g))}g&&c.push({start:e,end:f.getOffset()+b,style:g})}},_parseString:function(a,b,c,d){var e=
this._whitespaceScanner;for(e.setText(a);a=e.nextToken();){var f=e.getStartOffset()+b,g=d;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(g=w);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(g=n)}g&&c.push({start:f,end:e.getOffset()+b,style:g})}},_detectHyperlinks:function(a,b,c,d){var e=null,f;if((f=a.indexOf("://"))>0){for(var e=a,g=f;g>0;){f=e.charCodeAt(g-1);if(!(97<=f&&f<=122||65<=f&&f<=90||45===f||48<=f&&f<=57))break;g--}if(g>0&&(f="\"\"''(){}[]<>".indexOf(e.substring(g-
1,g)),f!==-1&&(f&1)===0&&(f=e.lastIndexOf("\"\"''(){}[]<>".substring(f+1,f+2)))!==-1)){var h=f;f=this._clone(d);f.tagName="a";f.attributes={href:e.substring(g,h)};c.push({start:b,end:b+g,style:d});c.push({start:b+g,end:b+h,style:f});c.push({start:b+h,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 g=a.getLineAtOffset(b),c=a.getLine(g),h=a.getLineStart(g),i=a.getLineEnd(g),c=this._findBrackets(d,f,c,h,h,i),i=0;i<c.length;i++)if(h=c[i]>=0?1:-1,c[i]*h-1===b){var j=1;if(e&1){for(i--;i>=0;i--)if(h=c[i]>=0?1:-1,j+=h,j===0)return c[i]*h-1;for(g-=1;g>=0;){c=a.getLine(g);h=a.getLineStart(g);i=a.getLineEnd(g);c=this._findBrackets(d,f,c,h,h,i);for(e=c.length-1;e>=0;e--)if(h=c[e]>=0?1:-1,j+=h,j===0)return c[e]*h-1;g--}}else{for(i++;i<c.length;i++)if(h=c[i]>=0?1:-1,j+=h,j===0)return c[i]*
h-1;g+=1;for(e=a.getLineCount();g<e;){c=a.getLine(g);h=a.getLineStart(g);i=a.getLineEnd(g);c=this._findBrackets(d,f,c,h,h,i);for(i=0;i<c.length;i++)if(h=c[i]>=0?1:-1,j+=h,j===0)return c[i]*h-1;g++}}break}return-1},_findBrackets:function(a,b,c,d,e,f){for(var g=[],a=a.charCodeAt(0),b=b.charCodeAt(0),h=e,i=this._scanner,j,l=this.comments,k=this._binarySearch(l,e,!0);k<l.length;k++){if(l[k].start>=f)break;j=l[k].start;var n=l[k].end;if(h<j)for(i.setText(c.substring(h-e,j-e));j=i.nextToken();)j===a?g.push(i.getStartOffset()+
h-e+d+1):j===b&&g.push(-(i.getStartOffset()+h-e+d+1));h=n}if(h<f)for(i.setText(c.substring(h-e,f-e));j=i.nextToken();)j===a?g.push(i.getStartOffset()+h-e+d+1):j===b&&g.push(-(i.getStartOffset()+h-e+d+1));return g},_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 g=c.start===c.end,b=b.start===b.end;f===e&&b&&g||(b&&d.redrawLines(f,f+1),(f!==e||!b)&&g&&d.redrawLines(e,e+1))}if(this.annotationModel){var b=this._bracketAnnotations,h,j;if(c.start===c.end&&(j=d.getCaretOffset())>0)j-=1,a.getBaseModel&&(j=a.mapOffset(j),a=a.getBaseModel()),a=this._findMatchingBracket(a,j),a!==-1&&(h=[i.AnnotationType.createAnnotation(i.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,a+1),i.AnnotationType.createAnnotation(i.AnnotationType.ANNOTATION_CURRENT_BRACKET,
j,j+1)]);this._bracketAnnotations=h;this.annotationModel.replaceAnnotations(b,h)}},_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,g=f.getCharCount(),h=this.comments.length,j=f.getLineStart(f.getLineAtOffset(b)),l=this._binarySearch(this.comments,j,!0),k=this._binarySearch(this.comments,c,!1,l-1,h);l<h&&this.comments[l].start<=j&&j<this.comments[l].end?(j=this.comments[l].start,j>b&&(j+=d)):j=l===h&&h>0&&g-d===this.comments[h-1].end?this.comments[h-1].start:j;var n;k<h?(n=this.comments[k].end,n>b&&(n+=d),k+=1):(k=h,n=g);for(var m,g=this._findComments(f.getText(j,n),j),
h=l;h<this.comments.length;h++)m=this.comments[h],m.start>b&&(m.start+=d),m.start>b&&(m.end+=d);var o=k-l!==g.length;if(!o)for(h=0;h<g.length;h++){m=this.comments[l+h];var u=g[h];if(m.start!==u.start||m.end!==u.end||m.type!==u.type){o=!0;break}}h=[l,k-l].concat(g);Array.prototype.splice.apply(this.comments,h);o&&(h=j,m=n,a!==f&&(h=a.mapOffset(h,!0),m=a.mapOffset(m,!0)),e.redrawRange(h,m));if(this.foldingEnabled&&f!==a&&this.annotationModel){e=this.annotationModel;l=e.getAnnotations(j,n);j=[];for(n=
[];l.hasNext();)if(m=l.next(),m.type===i.AnnotationType.ANNOTATION_FOLDING){n.push(m);for(h=0;h<g.length;h++)if(m.start===g[h].start&&m.end===g[h].end)break;h===g.length?(j.push(m),m.expand()):(h=m.start,k=m.end,h>b&&(h-=d),k>b&&(k-=d),h<=b&&b<k&&h<=c&&c<k&&(h=f.getLineAtOffset(m.start),k=f.getLineAtOffset(m.end),h!==k?m.expanded||m.expand():e.removeAnnotation(m)))}b=[];for(h=0;h<g.length;h++){m=g[h];for(d=0;d<n.length;d++)if(n[d].start===m.start&&n[d].end===m.end)break;d===n.length&&(m=this._createFoldingAnnotation(a,
f,m.start,m.end))&&b.push(m)}e.replaceAnnotations(j,b)}}};return{TextStyler:d}});
define("orion/editor/textStyler",["orion/editor/annotations"],function(i){function k(a,b){this._unnamedCounter=0;this._patterns=[];this._rootId=b;a.forEach(function(a){this._addRepositoryPatterns(a.repository||{},a.id);this._addPatterns(a.patterns||[],a.id)}.bind(this))}function j(a,b,c,d,e){this.start=a.start;this.end=a.end;this.contentStart=a.contentStart;this.contentEnd=a.contentEnd;this.pattern=b;this._styler=c;this._parent=e;this._linePatterns=[];this._blockPatterns=[];this._enclosurePatterns=
{};if(d)this._initPatterns(),this._subBlocks=t(d,d.getText(this.start,this.end),this,this.start)}function h(a){this._styler=a}function a(a,b,c,d){this.highlightCaretLine=this.whitespacesVisible=this.spacesVisible=this.tabsVisible=!1;this.detectTasks=this.foldingEnabled=!0;this.view=a;this.annotationModel=b;this.patternManager=new k(c,d);this._accessor=new h(this);this._bracketAnnotations=void 0;var e=this;this._listener={onChanged:function(a){e._onModelChanged(a)},onDestroy:function(a){e._onDestroy(a)},
onLineStyle:function(a){e._onLineStyle(a)},onMouseDown:function(a){e._onMouseDown(a)},onSelection:function(a){e._onSelection(a)}};c=a.getModel();c.getBaseModel&&(c=c.getBaseModel());c.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);d=c.getCharCount();this._rootBlock=
new j({start:0,contentStart:0,end:d,contentEnd:d},null,this,c);this._computeFolding(this._rootBlock.getBlocks());b&&this.detectTasks&&(d=[],r(this._rootBlock,c,d),b.replaceAnnotations([],d));a.redrawLines()}var g={styleClass:"meta annotation currentLine"},e=/$/,f=/\\(\d)/g,d=/(.*)(?:[\r\n]|$)/g,c={regex:/ /g,style:{styleClass:"punctuation separator space",unmergeable:!0}},b={regex:/\t/g,style:{styleClass:"punctuation separator tab",unmergeable:!0}},l=function(a,b,c,e){var f=c,g=a.lastIndex;d.lastIndex=
c;var c=d.exec(b),h,i;a.lastIndex=0;if(c){for(i=c.index;0<=--i;)if(h=b.charAt(i),h==="\n"||h==="\r")break;h=b.substring(i+1,c.index+c[1].length);a.lastIndex=i=c.index-i-1}for(;c&&c.index<b.length;){var j;if(e){var l=a.lastIndex;if(a.test(h))a.lastIndex=l,j=a.exec(h)}else j=a.exec(h);if(j)return j.index+=f,j.index-=i,a.lastIndex=g,j;i=0;f+=c[0].length;if(c=d.exec(b))h=c[1],a.lastIndex=0}a.lastIndex=g;return null},m=function(a,b){var c=a.toString();f.lastIndex=0;if(!f.test(c))return a;f.lastIndex=0;
for(var d=f.exec(c);d;)c=c.replace(d[0],b[d[1]]||""),f.lastIndex=0,d=f.exec(c);return RegExp(c.substring(1,c.length-2),"g")},s=function(a,b,c,d){if(b=l(a.pattern.regex?a.pattern.regex:a.pattern.regexBegin,b,d,!0)){a.result=b;for(d=0;d<c.length;d++)if(b.index<c[d].result.index||b.index===c[d].result.index&&a.pattern.pattern.index<c[d].pattern.pattern.index){c.splice(d,0,a);return}c.push(a)}},o=function(a,b,c,d){if(b[0])d.push({start:c,end:c+a[0].length,style:b[0].name});else for(var e=0,f=1;f<a.length;f++)if(a[f]){var g=
b[f];if(g){var h=c+e;d.push({start:h,end:h+a[f].length,style:g.name})}e+=a[f].length}},q=function(a,b,c){var d=a.start;b.forEach(function(b){d<=b.start&&c.push({start:d,end:b.start,style:a.style});c.push(b);d=b.end});d<a.end&&c.push({start:d,end:a.end,style:a.style})},p=function(a,b,c,d,f){if(c=c.getLinePatterns()){var g=[];c.forEach(function(b){var c=b.regex||b.regexBegin;c.oldLastIndex=c.lastIndex;(c=l(c,a,0))&&g.push({result:c,pattern:b})});g.sort(function(a,b){return a.result.index<b.result.index?
-1:a.result.index>b.result.index?1:a.pattern.pattern.index<b.pattern.pattern.index?-1:1});for(var h=0;g.length>0;){var i=g[0];g.splice(0,1);if(!(i.result.index<h)){var j=i.result.index,k,p=[];if(i.pattern.regex){h=i.result;k=j+h[0].length;k={start:b+j,end:b+k,style:i.pattern.pattern.name};if(!f){i.pattern.pattern.captures&&o(h,i.pattern.pattern.captures,b+j,p);p.sort(function(a,b){return a.start<b.start?-1:a.start>b.start?1:0});for(j=0;j<p.length-1;j++)if(p[j+1].start<p[j].end){var r={start:p[j+1].end,
end:p[j].end,style:p[j].style};p[j].end=p[j+1].start;p.splice(j+2,0,r)}}q(k,p,d)}else{h=i.pattern.regexEnd;h=m(h,i.result);h=l(h,a,i.result.index+i.result[0].length);if(!h)e.lastIndex=0,h=e.exec(a);k=h.index+h[0].length;d.push({start:b+j,end:b+k,style:i.pattern.pattern.name})}h=h.index+h[0].length}s(i,a,g,h)}c.forEach(function(a){a=a.regex||a.regexBegin;a.lastIndex=a.oldLastIndex})}},t=function(a,b,c,d){var f=[];c.getBlockPatterns().forEach(function(a){var c=l(a.regexBegin||a.regex,b,0);c&&f.push({result:c,
pattern:a})}.bind(this));if(!f.length)return f;f.sort(function(a,b){return a.result.index<b.result.index?-1:a.result.index>b.result.index?1:a.pattern.pattern.index<b.pattern.pattern.index?-1:1});for(var g=0,h=[];f.length>0;){var i=f[0];f.splice(0,1);if(!(i.result.index<g)){var k=a.getLineAtOffset(d+i.result.index),o=a.getLine(k),q=[];p(o,a.getLineStart(k),c,q);k=d+i.result.index;for(o=0;o<q.length;o++)if(q[o].start===k){var g=i.result.index,r=null,t=i.pattern.regexEnd;if(t){g+=i.result[0].length;
for(var t=m(t,i.result),B=g;!r;){B=l(t,b,B);if(!B)e.lastIndex=0,B=e.exec(b);var Q=[],C=new j({start:k,end:d+B.index+B[0].length,contentStart:d+g,contentEnd:d+B.index},i.pattern,c.getStyler(),a,c);p(b.substring(g,B.index+B[0].length),g,C,Q);if(!Q.length||Q[Q.length-1].end<=B.index)r=C;B=B.index+B[0].length}}else r=new j({start:k,end:k+i.result[0].length,contentStart:k,contentEnd:k+i.result[0].length},i.pattern,c.getStyler(),a,c);h.push(r);g=r.end-d;break}o===q.length&&(g=i.result.index+1)}s(i,b,f,
g)}return h},r=function(a,b,c){if(a.getAnnotationModel()){var d=i.AnnotationType.ANNOTATION_TASK;if(a.getLinePatterns().length&&a.pattern&&a.pattern.pattern.name&&a.pattern.pattern.name.indexOf("comment")===0){var e=[];p(b.getText(a.contentStart,a.end),a.contentStart,a,e,!0);for(var f=0;f<e.length;f++)e[f].style==="meta.annotation.task.todo"&&c.push(i.AnnotationType.createAnnotation(d,e[f].start,e[f].end,b.getText(e[f].start,e[f].end)))}a.getBlocks().forEach(function(a){r(a,b,c)}.bind(this))}};k.prototype=
{getPatterns:function(a){var b=[0],c={},d=RegExp("^"+(a?typeof a==="string"?a:a.qualifiedId:this._rootId)+"#[^#]+$"),e=[];this._patterns.forEach(function(a){if(d.test(a.qualifiedId))a.include?e.push(a):(a.index=b[0]++,c[a.id]=a)}.bind(this));e.forEach(function(a){this._processInclude(a,b,c)}.bind(this));var f=[];Object.keys(c).forEach(function(a){f.push(c[a])});return f},_addPatterns:function(a,b){a.forEach(function(a){this._addPattern(a,this._NO_ID+this._unnamedCounter++,b)}.bind(this))},_addRepositoryPatterns:function(a,
b){Object.keys(a).forEach(function(c){this._addPattern(a[c],c,b)}.bind(this))},_addPattern:function(a,b,c){a.parentId=c;a.id=b;a.qualifiedId=a.parentId+"#"+a.id;this._patterns.push(a);a.patterns&&!a.include&&this._addPatterns(a.patterns,a.qualifiedId)},_processInclude:function(a,b,c){var d,e=a.include.indexOf("#");d=e===0?RegExp("^"+a.qualifiedId.substring(0,a.qualifiedId.indexOf("#"))+a.include+"$"):e===-1?RegExp("^"+a.include+"#"+this._NO_ID+"[^#]+$"):RegExp("^"+a.include+"$");var f=[];this._patterns.forEach(function(a){if(d.test(a.qualifiedId))if(a.include)f.push(a);
else if(!c[a.id])a.index=b[0]++,c[a.id]=a}.bind(this));f.forEach(function(a){this._processInclude(a,b,c)}.bind(this))},_NO_ID:"NoID"};j.prototype={adjustEnd:function(a){this.end+=a;this.contentEnd+=a;this._subBlocks.forEach(function(b){b.adjustEnd(a)})},adjustStart:function(a){this.start+=a;this.contentStart+=a;this._subBlocks.forEach(function(b){b.adjustStart(a)})},computeStyle:function(a,b){if(!this.pattern||!(this.start<=b&&b<this.end))return null;var c={start:this.start,end:this.end,style:this.pattern.pattern.name};
if(this.contentStart<=b&&b<this.contentEnd)return this.pattern.pattern.contentName?{start:this.contentStart,end:this.contentEnd,style:this.pattern.pattern.contentName}:c;var d,e,f,g;if(b<this.contentStart){e=this.pattern.pattern.beginCaptures||this.pattern.pattern.captures;if(!e)return c;d=this.pattern.regexBegin;f=a.getText(this.start,this.contentStart);g=this.start}else{e=this.pattern.pattern.endCaptures||this.pattern.pattern.captures;if(!e)return c;d=this.pattern.regexEnd;f=a.getText(this.contentEnd,
this.end);g=this.contentEnd}d.lastIndex=0;if(f=d.exec(f)){d=[];o(f,e,g,d);for(e=0;e<d.length;e++)if(d[e].start<=b&&b<d[e].end)return d[e]}return c},getAnnotationModel:function(){return this._styler._getAnnotationModel()},getBlockPatterns:function(){return this._blockPatterns},getBlocks:function(){return this._subBlocks},getEnclosurePatterns:function(){return this._enclosurePatterns},getLinePatterns:function(){return this._linePatterns},getParent:function(){return this._parent},getPatternManager:function(){return this._styler._getPatternManager()},
getStyler:function(){return this._styler},isRenderingWhitespace:function(){return this._styler._isRenderingWhitespace()},_initPatterns:function(){var a=function(a){var b=/^\(\?i\)\s*/.exec(a);b&&(a=a.substring(b[0].length));return a};this.getPatternManager().getPatterns(this.pattern?this.pattern.pattern:null).forEach(function(b){var c;if(b.match&&!b.begin&&!b.end){c="g";var d=a(b.match);d!==b.match&&(c+="i");c={regex:RegExp(d,c),pattern:b};this._linePatterns.push(c);if(b.patterns)this._blockPatterns.push(c);
else if(b.name&&b.name.indexOf("punctuation.section")===0&&(b.name.indexOf(".begin")!==-1||b.name.indexOf(".end")!==-1))this._enclosurePatterns[b.name]=c}else if(!b.match&&b.begin&&b.end){c="g";d=a(b.begin);d!==b.begin&&(c+="i");var e="g",f=a(b.end);f!==b.end&&(e+="i");c={regexBegin:RegExp(d,c),regexEnd:RegExp(f,e),pattern:b};this._linePatterns.push(c);this._blockPatterns.push(c)}}.bind(this))}};h.prototype={getStyles:function(a){return this._styler.getStyles(a)}};a.prototype={destroy:function(){var a=
this.view;if(a){var b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());b.removeEventListener("Changed",this._listener.onChanged);a.removeEventListener("MouseDown",this._listener.onMouseDown);a.removeEventListener("Selection",this._listener.onSelection);a.removeEventListener("Destroy",this._listener.onDestroy);a.removeEventListener("LineStyle",this._listener.onLineStyle);this.view=null}},getStyleAccessor:function(){return this._accessor},getStyles:function(a){var b=[],c=this.view.getModel();c.getBaseModel&&
(c=c.getBaseModel());var d=this._findBlock(this._rootBlock,a),e=c.getLineAtOffset(a),f=c.getLine(e),g=[];p(f,c.getLineStart(e),d,g);for(e=0;e<g.length;e++){if(a<g[e].start)break;if(g[e].start<=a&&a<g[e].end){b.push(g[e]);break}}for(;d;)(g=d.computeStyle(c,a))&&b.splice(0,0,g),d=d.getParent();return b},setHighlightCaretLine:function(a){this.highlightCaretLine=a},setWhitespacesVisible:function(a,b){if(this.whitespacesVisible!==a)this.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(){},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},_computeFolding:function(a){if(this.foldingEnabled){var b=this.view.getModel();if(b.getBaseModel){var c=this.annotationModel;if(c){c.removeAnnotations(i.AnnotationType.ANNOTATION_FOLDING);for(var d=[],e=b.getBaseModel(),f=0;f<a.length;f++){var g=a[f];(g=this._createFoldingAnnotation(b,e,g.start,g.end))&&d.push(g)}c.replaceAnnotations(null,d)}}}},_createFoldingAnnotation:function(a,b,c,d){var e=b.getLineAtOffset(c),
b=b.getLineAtOffset(d);return e===b?null:new (i.AnnotationType.getType(i.AnnotationType.ANNOTATION_FOLDING))(c,d,a)},_findBlock:function(a,b){var c=a.getBlocks();if(!c.length)return a;var d=this._binarySearch(c,b,!0);return d<c.length&&c[d].start<=b&&b<c[d].end?this._findBlock(c[d],b):a},_findBrackets:function(a,b,c,d,e,f){for(var g=[],h=[],i=e,j=c.getBlocks(),l=this._binarySearch(j,e,!0);l<j.length;l++){if(j[l].start>=f)break;var k=j[l].start,m=j[l].end;i<k&&(p(d.substring(i-e,k-e),i,c,h),h.forEach(function(c){c.style.indexOf(a.pattern.name)===
0?g.push(c.start+1):c.style.indexOf(b.pattern.name)===0&&g.push(-(c.start+1))}),h=[]);i=m}i<f&&(p(d.substring(i-e,f-e),i,c,h),h.forEach(function(c){c.style.indexOf(a.pattern.name)===0?g.push(c.start+1):c.style.indexOf(b.pattern.name)===0&&g.push(-(c.start+1))}));return g},_findMatchingBracket:function(a,b,c){for(var d=a.getLineAtOffset(c),e=a.getLineEnd(d),f=a.getText(c,e),g,h=b.getEnclosurePatterns(),i=Object.keys(h),j=0;j<i.length;j++){var k=h[i[j]],m=l(k.regex,f,0);if(m&&m.index===0){g=k;break}}if(!g)return-1;
f=!1;g.pattern.name.indexOf(".begin")!==-1?(f=!0,j=g.pattern.name.replace(".begin",".end")):j=g.pattern.name.replace(".end",".begin");h=h[j];if(!h)return-1;i=a.getLine(d);k=a.getLineStart(d);e=this._findBrackets(g,h,b,i,k,e);for(j=0;j<e.length;j++)if(i=e[j]>=0?1:-1,e[j]*i-1===c){c=1;if(f){for(j++;j<e.length;j++)if(i=e[j]>=0?1:-1,c+=i,c===0)return e[j]*i-1;d+=1;for(j=a.getLineCount();d<j;){i=a.getLine(d);k=a.getLineStart(d);e=a.getLineEnd(d);e=this._findBrackets(g,h,b,i,k,e);for(f=0;f<e.length;f++)if(i=
e[f]>=0?1:-1,c+=i,c===0)return e[f]*i-1;d++}}else{for(j--;j>=0;j--)if(i=e[j]>=0?1:-1,c+=i,c===0)return e[j]*i-1;for(d-=1;d>=0;){i=a.getLine(d);k=a.getLineStart(d);e=a.getLineEnd(d);e=this._findBrackets(g,h,b,i,k,e);for(j=e.length-1;j>=0;j--)if(i=e[j]>=0?1:-1,c+=i,c===0)return e[j]*i-1;d--}}break}return-1},_getAnnotationModel:function(){return this.annotationModel},_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 g}return null},_getPatternManager:function(){return this.patternManager},_getStyles:function(a,b,c,d){b.getBaseModel&&(d=b.mapOffset(d));for(var e=d+c.length,f=[],g=d,h=a.getBlocks(),i=this._binarySearch(h,d,!0);i<h.length;i++){if(h[i].start>=e)break;var j=h[i].start,k=h[i].end;g<j&&p(c.substring(g-d,j-d),g,a,f);var m=Math.max(g,j);if(m===j&&h[i].pattern.regexBegin){var s=l(h[i].pattern.regexBegin,c.substring(m-d),0);if(s){var q=h[i].pattern.pattern.beginCaptures||h[i].pattern.pattern.captures;
q?o(s,q,m,f):f.push({start:m,end:m+s[0].length,style:h[i].pattern.pattern.name});m+=s[0].length}}var j=Math.min(e,k),r=[];if(j===k&&h[i].pattern.regexEnd&&(g=c.substring(j-g-(h[i].end-h[i].contentEnd)),s=l(h[i].pattern.regexEnd,g,0)))(q=h[i].pattern.pattern.endCaptures||h[i].pattern.pattern.captures)?o(s,q,j-s[0].length,r):h[i].pattern.pattern.name&&r.push({start:j-s[0].length,end:j,style:h[i].pattern.pattern.name}),j-=s[0].length;var g=this._getStyles(h[i],b,c.substring(m-d,j-d),m),t=h[i].pattern.pattern.contentName||
h[i].pattern.pattern.name;if(t){var O=m;g.forEach(function(a){a.start-O&&f.push({start:O,end:a.start,style:t});f.push(a);O=a.end});j-O&&f.push({start:O,end:j,style:t})}else f=f.concat(g);f=f.concat(r);g=k}g<e&&p(c.substring(g-d,e-d),g,a,f);if(b.getBaseModel)for(a=0;a<f.length;a++)c=f[a].end-f[a].start,f[a].start=b.mapOffset(f[a].start,!0),f[a].end=f[a].start+c;return f},_isRenderingWhitespace:function(){return this.whitespacesVisible&&(this.tabsVisible||this.spacesVisible)},_onDestroy:function(){this.destroy()},
_onLineStyle:function(a){if(a.textView===this.view)a.style=this._getLineStyle(a.lineIndex);a.ranges=this._getStyles(this._rootBlock,a.textView.getModel(),a.lineText,a.lineStart);a.ranges.forEach(function(a){if(a.style)a.style={styleClass:a.style.replace(/\./g," ")}});this._isRenderingWhitespace()&&(this.spacesVisible&&this._spliceStyles(c,a.ranges,a.lineText,a.lineStart),this.tabsVisible&&this._spliceStyles(b,a.ranges,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 g=c.start===c.end,b=b.start===b.end;f===e&&b&&g||(b&&d.redrawLines(f,f+1),(f!==e||!b)&&g&&d.redrawLines(e,e+1))}if(this.annotationModel){var b=this._bracketAnnotations,h,j;if(c.start===c.end&&(j=d.getCaretOffset())>0)j-=1,a.getBaseModel&&(j=a.mapOffset(j),a=a.getBaseModel()),c=this._findBlock(this._rootBlock,j),a=this._findMatchingBracket(a,c,j),a!==-1&&(h=[i.AnnotationType.createAnnotation(i.AnnotationType.ANNOTATION_MATCHING_BRACKET,
a,a+1),i.AnnotationType.createAnnotation(i.AnnotationType.ANNOTATION_CURRENT_BRACKET,j,j+1)]);this._bracketAnnotations=h;this.annotationModel.replaceAnnotations(b,h)}},_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());var g=this._findBlock(this._rootBlock,e),e=this._findMatchingBracket(f,g,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,a=a.addedCharCount-c,d=this.view,e=d.getModel(),f=e.getBaseModel?e.getBaseModel():e,c=b+c,g=f.getCharCount(),h=this._rootBlock.getBlocks(),j=h.length,k=f.getLineStart(f.getLineAtOffset(b)),l=this._binarySearch(h,k,!0),m=this._binarySearch(h,c,!1,l-1,j),o;l<j&&h[l].start<=k&&k<h[l].end?(o=h[l].start,o>b&&(o+=a)):o=l===j&&j>0&&g-a===h[j-1].end?h[j-1].start:k;var p;do m<j?(p=h[m].end,p>b&&(p+=a),m+=1):
(m=j,p=g),k=f.getText(o,p),k=t(f,k,this._rootBlock,o);while(k.length&&h.length&&m<j&&k[k.length-1].pattern.pattern.id!==h[m-1].pattern.pattern.id);for(g=l;g<h.length;g++)j=h[g],j.start>b&&j.adjustStart(a),j.start>b&&j.adjustEnd(a);var s=m-l!==k.length;if(!s)for(g=0;g<k.length;g++){var j=h[l+g],q=k[g];if(j.start!==q.start||j.end!==q.end||j.type!==q.type){s=!0;break}}g=[l,m-l].concat(k);Array.prototype.splice.apply(h,g);s&&(g=o,j=p,e!==f&&(g=e.mapOffset(g,!0),j=e.mapOffset(j,!0)),d.redrawRange(g,j));
if(this.annotationModel){d=[];h=[];l=[];o=this.annotationModel.getAnnotations(o,p);for(p=this.foldingEnabled&&f!==e;o.hasNext();)if(j=o.next(),p&&j.type===i.AnnotationType.ANNOTATION_FOLDING){l.push(j);for(g=0;g<k.length;g++)if(j.start===k[g].start&&j.end===k[g].end)break;g===k.length?(d.push(j),j.expand()):(g=j.start,m=j.end,g>b&&(g-=a),m>b&&(m-=a),g<=b&&b<m&&g<=c&&c<m&&(g=f.getLineAtOffset(j.start),m=f.getLineAtOffset(j.end),g!==m?j.expanded||j.expand():this.annotationModel.removeAnnotation(j)));
for(g=0;g<k.length;g++){j=k[g];for(m=0;m<l.length;m++)if(l[m].start===j.start&&l[m].end===j.end)break;m===l.length&&(j=this._createFoldingAnnotation(e,f,j.start,j.end))&&h.push(j)}}else j.type===i.AnnotationType.ANNOTATION_TASK&&d.push(j);if(this.detectTasks)for(g=0;g<k.length;g++)r(k[g],f,h);this.annotationModel.replaceAnnotations(d,h)}},_spliceStyles:function(a,b,c,d){for(var e=a.regex,f=e.lastIndex=0,g=e.exec(c);g;){for(g=d+g.index;f<b.length;){if(g<b[f].end)break;f++}var h={start:g,end:g+1,style:a.style};
if(f<b.length&&b[f].start<=g){var i={start:g+1,end:b[f].end,style:b[f].style};b[f].end=g;b.splice(f+1,0,i);b.splice(f+1,0,h);f+=2}else b.splice(f,0,h),f++;g=e.exec(c)}}};return{TextStyler:a}});
define("orion/editor/textMateStyler",["orion/regex"],function(i){function k(a){var g;if(a instanceof Array){g=Array(a.length);for(var e=0;e<a.length;e++)g[e]=k(a[e])}else for(e in g={},a)if(Object.prototype.hasOwnProperty.call(a,e)){var f=a[e];g[e]=typeof f==="object"&&f!==null?k(f):f}return g}function j(a,g,e){this.initialize(a);this.grammar=k(g);this.externalGrammars=e?k(e):[];this._styles={};this._tree=null;this._allGrammars={};this.preprocess(this.grammar)}var h={unsupported:[{regex:/\(\?[ims\-]:/,
func:function(){return"option on/off for subexp"}},{regex:/\(\?<([=!])/,func:function(a){return a[1]==="="?"lookbehind":"negative lookbehind"}},{regex:/\(\?>/,func:function(){return"atomic group"}}],toRegExp:function(a){function g(a,b){throw Error('Unsupported regex feature "'+a+'": "'+b[0]+'" at index: '+b.index+" in "+b.input);}var e="",f,a=h.processGlobalFlag("x",a,function(a){for(var b="",d=!1,e=a.length,f=0;f<e;){var g=a.charAt(f);if(!d&&g==="#")for(;f<e&&g!=="\r"&&g!=="\n";)g=a.charAt(++f);
else if(!d&&/\s/.test(g))for(;f<e&&/\s/.test(g);)g=a.charAt(++f);else g==="\\"?(b+=g,/\s/.test(a.charAt(f+1))||(b+=a.charAt(f+1),f+=1)):(g==="["?d=!0:g==="]"&&(d=!1),b+=g),f+=1}return b}),a=h.processGlobalFlag("i",a,function(a){e+="i";return a});for(f=0;f<this.unsupported.length;f++){var d;(d=this.unsupported[f].regex.exec(a))&&g(this.unsupported[f].func(d),d)}return RegExp(a,e)},processGlobalFlag:function(a,g,e){function f(a,b){for(var d=0,e=a.length,f=-1,g=b;g<e&&f===-1;g++)switch(a.charAt(g)){case "\\":g++;
break;case "(":d++;break;case ")":d--,d===0&&(f=g)}return f}var d="(?"+a+")",a="(?"+a+":";if(g.substring(0,d.length)===d)return e(g.substring(d.length));else if(g.substring(0,a.length)===a){d=f(g,0);if(d<g.length-1)throw Error("Only a "+a+") group that encloses the entire regex is supported in: "+g);return e(g.substring(a.length,d))}return g},hasBackReference:function(a){return/\\\d+/.test(a.source)},getSubstitutedRegex:function(a,g,e){for(var e=typeof e==="undefined"?!0:!1,a=a.source.split(/(\\\d+)/g),
f=[],d=0;d<a.length;d++){var c=a[d],b=/\\(\d+)/.exec(c);b?(c=g[b[1]]||"",f.push(e?i.escape(c):c)):f.push(c)}return RegExp(f.join(""))},groupify:function(a,g){for(var e=a.source,f=e.length,d=[],c=0,b=[],h=1,i=1,j=[],k={},q={},p=0;p<f;p++){var t=d[d.length-1],r=e.charAt(p);switch(r){case "(":if(t===4)d.pop(),j.push(")"),b[b.length-1].end=p;var u=p+2<f?e.charAt(p+1)+""+e.charAt(p+2):null;if(u==="?:"||u==="?="||u==="?!"){var v;u==="?:"?v=1:(v=3,c++);d.push(v);b.push({start:p,end:-1,type:v});j.push(r);
j.push(u);p+=u.length}else d.push(2),b.push({start:p,end:-1,type:2,oldNum:h,num:i}),j.push(r),c===0&&(q[i]=null),k[h]=i,h++,i++;break;case ")":t=d.pop();t===3&&c--;b[b.length-1].end=p;j.push(r);break;case "*":case "+":case "?":case "}":var n=r,w=e.charAt(p-1),u=p-1;if(r==="}"){for(v=p-1;e.charAt(v)!=="{"&&v>=0;v--);w=e.charAt(v-1);u=v-1;n=e.substring(v,p+1)}v=b[b.length-1];if(w===")"&&(v.type===2||v.type===4)){j.splice(v.start,0,"(");j.push(n);j.push(")");r={start:v.start,end:j.length-1,type:4,num:v.num};
for(w=0;w<b.length;w++)if(t=b[w],(t.type===2||t.type===4)&&t.start>=v.start&&t.end<=u)if(t.start+=1,t.end+=1,t.num+=1,t.type===2)k[t.oldNum]=t.num;b.push(r);i++;break}default:r!=="|"&&t!==2&&t!==4&&c===0&&(d.push(4),b.push({start:p,end:-1,type:4,num:i}),j.push("("),q[i]=null,i++),j.push(r),r==="\\"&&(r=e.charAt(p+1),j.push(r),p+=1)}}for(;d.length;)d.pop(),j.push(")");var e=RegExp(j.join("")),f={},g=g||k,x;for(x in g)g.hasOwnProperty(x)&&(f[x]="\\"+g[x]);e=this.getSubstitutedRegex(e,f,!1);return[e,
k,q]},complexCaptures:function(a){if(!a)return!1;for(var g in a)if(a.hasOwnProperty(g)&&g!=="0")return!0;return!1}};j.prototype={initialize:function(a){this.textView=a;this.textView.stylerOptions=this;var g=this;this._listener={onModelChanged:function(a){g.onModelChanged(a)},onDestroy:function(a){g.onDestroy(a)},onLineStyle:function(a){g.onLineStyle(a)},onStorage:function(a){g.onStorage(a)}};a.addEventListener("ModelChanged",this._listener.onModelChanged);a.addEventListener("Destroy",this._listener.onDestroy);
a.addEventListener("LineStyle",this._listener.onLineStyle);a.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(a){for(a=[a];a.length!==0;){var g=
a.pop();if(!g._resolvedRule||!g._typedRule)if(g._resolvedRule=this._resolve(g),g._typedRule=this._createTypedRule(g),this.addStyles(g.name),this.addStyles(g.contentName),this.addStylesForCaptures(g.captures),this.addStylesForCaptures(g.beginCaptures),this.addStylesForCaptures(g.endCaptures),g._resolvedRule!==g&&a.push(g._resolvedRule),g.patterns)for(var e=0;e<g.patterns.length;e++)a.push(g.patterns[e])}},addStyles:function(a){if(a&&!this._styles[a]){this._styles[a]=[];for(var g=a.split("."),e=0;e<
g.length;e++)this._styles[a].push(g.slice(0,e+1).join("-"))}},addStylesForCaptures:function(a){for(var g in a)a.hasOwnProperty(g)&&this.addStyles(a[g].name)},ContainerRule:function(){function a(a){this.rule=a;this.subrules=a.patterns}a.prototype.valueOf=function(){return"aa"};return a}(),BeginEndRule:function(){function a(a){this.rule=a;this.beginRegex=h.toRegExp(a.begin);this.endRegex=h.toRegExp(a.end);this.subrules=a.patterns||[];this.endRegexHasBackRef=h.hasBackReference(this.endRegex);var e=h.complexCaptures(a.captures),
a=h.complexCaptures(a.beginCaptures)||h.complexCaptures(a.endCaptures);if(this.isComplex=e||a)e=h.groupify(this.beginRegex),this.beginRegex=e[0],this.beginOld2New=e[1],this.beginConsuming=e[2],e=h.groupify(this.endRegex,this.beginOld2New),this.endRegex=e[0],this.endOld2New=e[1],this.endConsuming=e[2]}a.prototype.valueOf=function(){return this.beginRegex};return a}(),MatchRule:function(){function a(a){this.rule=a;this.matchRegex=h.toRegExp(a.match);if(this.isComplex=h.complexCaptures(a.captures))a=
h.groupify(this.matchRegex),this.matchRegex=a[0],this.matchOld2New=a[1],this.matchConsuming=a[2]}a.prototype.valueOf=function(){return this.matchRegex};return a}(),_createTypedRule:function(a){return a.match?new this.MatchRule(a):a.begin?new this.BeginEndRule(a):new this.ContainerRule(a)},_resolve:function(a){var g=a;if(a.include){if(a.begin||a.end||a.match)throw Error('Unexpected regex pattern in "include" rule '+a.include);a=a.include;if(a.charAt(0)==="#"){if(g=this.grammar.repository&&this.grammar.repository[a.substring(1)],
!g)throw Error("Couldn't find included rule "+a+" in grammar repository");}else if(a==="$self")g=this.grammar;else if(a==="$base")throw Error('Include "$base" is not supported');else if(g=this._allGrammars[a],!g)for(var e=0;e<this.externalGrammars.length;e++){var f=this.externalGrammars[e];if(f.scopeName===a){this.preprocess(f);g=this._allGrammars[a]=f;break}}}return g},ContainerNode:function(){function a(a,e){this.parent=a;this.rule=e;this.children=[];this.end=this.start=null}a.prototype.addChild=
function(a){this.children.push(a)};a.prototype.valueOf=function(){var a=this.rule;return"ContainerNode { "+(a.include||"")+" "+(a.name||"")+(a.comment||"")+"}"};return a}(),BeginEndNode:function(){function a(a,e,f){this.parent=a;this.rule=e;this.children=[];this.setStart(f);this.endMatch=this.end=null;this.endRegexSubstituted=e.endRegexHasBackRef?h.getSubstitutedRegex(e.endRegex,f):null}a.prototype.addChild=function(a){this.children.push(a)};a.prototype.getIndexInParent=function(){return this.parent?
this.parent.children.indexOf(this):-1};a.prototype.setStart=function(a){this.start=a.index;this.beginMatch=a};a.prototype.setEnd=function(a){a&&typeof a==="object"?(this.endMatch=a,this.end=a.index+a[0].length):(this.endMatch=null,this.end=a)};a.prototype.shiftStart=function(a){this.start+=a;this.beginMatch.index+=a};a.prototype.shiftEnd=function(a){this.end+=a;this.endMatch&&(this.endMatch.index+=a)};a.prototype.valueOf=function(){return"{"+this.rule.beginRegex+" range="+this.start+".."+this.end+
"}"};return a}(),push:function(a,g){if(g)for(var e=g.length;e>0;)a.push(g[--e])},exec:function(a,g,e){(g=a.exec(g))&&(g.index+=e);a.lastIndex=0;return g},afterMatch:function(a){return a.index+a[0].length},getEndMatch:function(a,g,e){if(a instanceof this.BeginEndNode){var f=a.rule,a=a.endRegexSubstituted||f.endRegex;return!a?null:this.exec(a,g,e)}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(a){var g=a.addedCharCount,e=a.removedCharCount,a=a.start;if(this._tree){var f=this.textView.getModel(),d=f.getCharCount(),f=f.getLineEnd(f.getLineAtOffset(a)-1),c=this.getFirstDamaged(f,f),f=f===-1?0:f,g=c?this.parse(c,!0,f,a,g,e):d;this.textView.redrawRange(f,g)}else this.initialParse()},getFirstDamaged:function(a,g){if(a<0)return this._tree;for(var e=[this._tree],f=null;e.length;){var d=e.pop();if(!d.parent||this.isDamaged(d,a,g)){d instanceof this.BeginEndNode&&(f=
d);for(var c=0;c<d.children.length;c++)e.push(d.children[c])}}return f||this._tree},isDamaged:function(a,g,e){return a.start<=e&&a.end>g},parse:function(a,g,e,f,d,c){var b=this.textView.getModel(),h=b.getLineStart(b.getLineCount()-1),i=b.getCharCount(),j=this.getInitialExpected(a,e),k=-1;if(g)a.repaired=!0,a.endNeedsUpdate=!0,k=(k=a.children[a.children.length-1])?b.getLineEnd(b.getLineAtOffset(k.end+(d-c))):-1,f=b.getLineEnd(b.getLineAtOffset(f+c)),k=Math.max(k,f);for(var k=k===-1?i:k,f=j,q=a,p=!1,
t=e,r=-1;q&&(!g||t<k);){var u=this.getNextMatch(b,q,t);u||(t=t>=h?i:b.getLineStart(b.getLineAtOffset(t)+1));var v=u&&u.match,n=u&&u.rule,w=u&&u.isEnd;if(u&&u.isSub){if(t=this.afterMatch(v),n instanceof this.BeginEndRule)p=!0,g&&n===f.rule&&q===f.parent?(q=f,q.setStart(v),q.repaired=!0,q.endNeedsUpdate=!0,f=this.getNextExpected(f,"begin")):(g&&(this.prune(q,f),g=!1),v=new this.BeginEndNode(q,n,v),q.addChild(v),q=v)}else if(w||t===i){if(q instanceof this.BeginEndNode)v?(p=!0,r=Math.max(r,q.end),q.setEnd(v),
t=this.afterMatch(v),g&&q===f&&q.parent===f.parent?(q.repaired=!0,delete q.endNeedsUpdate,f=this.getNextExpected(f,"end")):g&&(this.prune(q,f),g=!1)):(q.setEnd(i),delete q.endNeedsUpdate);q=q.parent}g&&t>=k&&!p&&(this.prune(a,j),g=!1)}this.removeUnrepairedChildren(a,g,e);this.cleanup(g,a,e,k,i,d,c);return g?Math.max(r,t):t},removeUnrepairedChildren:function(a,g,e){if(g){for(var g=a.children,f=-1,d=0;d<g.length;d++){var c=g[d];if(!c.repaired&&this.isDamaged(c,e,Number.MAX_VALUE)){f=d;break}}if(f!==
-1)a.children.length=f}},cleanup:function(a,g,e,f,d,c,b){if(a){a=c-b;d=this.getIntersecting(f-a+1,d);g=this.getIntersecting(e,f);for(e=0;e<d.length;e++)f=d[e],!f.repaired&&f instanceof this.BeginEndNode&&(f.shiftEnd(a),f.shiftStart(a));for(e=0;e<g.length;e++)f=g[e],f.repaired&&f.endNeedsUpdate&&f.shiftEnd(a),delete f.endNeedsUpdate,delete f.repaired}else{g=this.getIntersecting(e,f);for(e=0;e<g.length;e++)delete g[e].repaired}},getNextMatch:function(a,g,e,f){var d=a.getLineAtOffset(e),d=a.getLineEnd(d),
c=a.getText(e,d),b=[],h=[],a=[],d=[];for(this.push(b,g.rule.subrules);b.length;){var i=b.length?b.pop():null,i=i&&i._resolvedRule._typedRule;if(i instanceof this.ContainerRule&&h.indexOf(i)===-1)h.push(i),this.push(b,i.subrules);else if(!i||!f||i.matchRegex){var j=i&&this.exec(i.matchRegex||i.beginRegex,c,e);j&&(a.push(j),d.push(i))}}b=Number.MAX_VALUE;h=-1;for(i=0;i<a.length;i++)if(j=a[i],j.index<b)b=j.index,h=i;if(!f&&(e=this.getEndMatch(g,c,e)))if(f=g.rule.applyEndPatternLast,h===-1||e.index<b||
!f&&e.index===b)return{isEnd:!0,rule:g.rule,match:e};return h===-1?null:{isSub:!0,rule:d[h],match:a[h]}},getInitialExpected:function(a,g){var e,f;if(a===this._tree)for(e=0;e<a.children.length;e++){if(f=a.children[e],f.start>=g)return f}else if(a instanceof this.BeginEndNode&&a.endMatch){var d=a.endMatch.index;for(e=0;e<a.children.length;e++)if(f=a.children[e],f.start>=g)break;if(f&&f.start<d)return f}return a},getNextExpected:function(a,g){if(g==="begin"){var e=a.children[0];return e?e:a}else if(g===
"end"&&(e=a.parent)){var f=e.children[e.children.indexOf(a)+1];return f?f:e}return null},prune:function(a,g){if(g.parent===a)a.children.length=g.getIndexInParent();else if(a instanceof this.BeginEndNode)a.endMatch=null,a.end=null;if(a.parent)a.parent.children.length=a.getIndexInParent()+1},onLineStyle:function(a){this._tree||this.initialParse();var g=a.lineStart,e=this.textView.getModel(),f=e.getLineEnd(a.lineIndex),d=e.getLineEnd(e.getLineAtOffset(g)-1),d=this.getFirstDamaged(d,d),g=this.getLineScope(e,
d,g,f);a.ranges=this.toStyleRanges(g);a.ranges.sort(function(a,b){return a.start-b.start})},getLineScope:function(a,g,e,f){for(var d=e,c=this.getInitialExpected(g,e),b=[],h=[];g&&d<f;){var i=this.getNextMatch(a,g,d);if(!i)break;var j=i&&i.match,k=i&&i.rule,q=i&&i.isSub,i=i&&i.isEnd;j.index!==d&&h.push({start:d,end:j.index,node:g});if(q)d=this.afterMatch(j),k instanceof this.BeginEndRule?(this.addBeginScope(b,j,k),g=c,c=this.getNextExpected(c,"begin")):this.addMatchScope(b,j,k);else if(i)d=this.afterMatch(j),
this.addEndScope(b,j,k),c=this.getNextExpected(c,"end"),g=g.parent}d<f&&h.push({start:d,end:f,node:g});a=this.getInheritedLineScope(h,e,f);return b.concat(a)},getInheritedLineScope:function(a){for(var g=[],e=0;e<a.length;e++)for(var f=a[e],d=f.node;d;){var c=d.rule.rule,b=c.name;if(c=c.contentName||b){this.addScopeRange(g,f.start,f.end,c);break}d=d.parent}return g},addBeginScope:function(a,g,e){var f=e.rule;this.addCapturesScope(a,g,f.beginCaptures||f.captures,e.isComplex,e.beginOld2New,e.beginConsuming)},
addEndScope:function(a,g,e){var f=e.rule;this.addCapturesScope(a,g,f.endCaptures||f.captures,e.isComplex,e.endOld2New,e.endConsuming)},addMatchScope:function(a,g,e){var f=e.rule,d=f.name;(f=f.captures)?this.addCapturesScope(a,g,f,e.isComplex,e.matchOld2New,e.matchConsuming):this.addScope(a,g,d)},addScope:function(a,g,e){e&&a.push({start:g.index,end:this.afterMatch(g),scope:e})},addScopeRange:function(a,g,e,f){f&&a.push({start:g,end:e,scope:f})},addCapturesScope:function(a,g,e,f,d,c){if(e)if(f){for(var f=
{1:0},b=0,h=1;g[h]!==void 0;h++)c[h]!==void 0&&(b+=g[h].length),g[h+1]!==void 0&&(f[h+1]=b);c=g.index;for(b=1;e[b];b++){var h=e[b].name,i=d[b],j=c+f[i];typeof g[i]!=="undefined"&&this.addScopeRange(a,j,j+g[i].length,h)}}else this.addScope(a,g,e[0]&&e[0].name)},getIntersecting:function(a,g){for(var e=[],f=this._tree?[this._tree]:[];f.length;){var d=f.pop(),c=!1;d instanceof this.ContainerNode?c=!0:this.isDamaged(d,a,g)&&(c=!0,e.push(d));if(c)for(var c=d.children.length,b=0;b<c;b++)f.push(d.children[b])}return e.reverse()},
toStyleRanges:function(a){for(var g=[],e=0;e<a.length;e++){var f=a[e],d=this._styles[f.scope];if(!d)throw Error("styles not found for "+f.scope);d=d.join(" ");g.push({start:f.start,end:f.end,style:{styleClass:d}})}return g}};return{RegexUtil:h,TextMateStyler:j}});
define("orion/editor/AsyncStyler",["i18n!orion/editor/nls/messages","orion/editor/annotations"],function(i,k){function j(e){return e.getProperty("objectClass").indexOf(a)!==-1&&e.getProperty("type")==="highlighter"}function h(a,f,d){this.initialize(a,f,d);this.lineStyles=[]}var a="orion.edit.highlighter",g=a+" service must be an event emitter";k.AnnotationType.registerType("orion.annotation.highlightError",{title:i.syntaxError,html:"<div class='annotationHTML error'></div>",rangeStyle:{styleClass:"annotationRange error"}});
h.prototype={initialize:function(e,f,d){this.textView=e;this.serviceRegistry=f;this.annotationModel=d;this.services=[];var c=this;this.listener={onModelChanging:function(a){c.onModelChanging(a)},onModelChanged:function(a){c.onModelChanged(a)},onDestroy:function(a){c.onDestroy(a)},onLineStyle:function(a){c.onLineStyle(a)},onStyleReady:function(a){c.onStyleReady(a)},onServiceAdded:function(a){c.onServiceAdded(a.serviceReference,c.serviceRegistry.getService(a.serviceReference))},onServiceRemoved:function(a){c.onServiceRemoved(a.serviceReference,
c.serviceRegistry.getService(a.serviceReference))}};e.addEventListener("ModelChanging",this.listener.onModelChanging);e.addEventListener("ModelChanged",this.listener.onModelChanged);e.addEventListener("Destroy",this.listener.onDestroy);e.addEventListener("LineStyle",this.listener.onLineStyle);f.addEventListener("registered",this.listener.onServiceAdded);f.addEventListener("unregistering",this.listener.onServiceRemoved);e=f.getServiceReferences(a);for(d=0;d<e.length;d++){var b=e[d];j(b)&&this.addServiceListener(f.getService(b))}},
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 a=0;a<this.services.length;a++)this.removeServiceListener(this.services[a]);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(a){this.startLine=this.textView.getModel().getLineAtOffset(a.start)},onModelChanged:function(a){var f=this.startLine;(a.addedLineCount||a.removedLineCount)&&Array.prototype.splice.apply(this.lineStyles,[f,a.removedLineCount].concat(this._getEmptyStyle(a.addedLineCount)))},
onStyleReady:function(a){var f=a.lineStyles||a.style,a=Number.MAX_VALUE,d=-1,c=this.textView.getModel(),b;for(b in f)Object.prototype.hasOwnProperty.call(f,b)&&(this.lineStyles[b]=f[b],a=Math.min(a,b),d=Math.max(d,b));a=Math.max(a,0);d=Math.min(d,c.getLineCount());if(f=this.annotationModel){for(var g=f.getAnnotations(c.getLineStart(a),c.getLineEnd(d)),h=[];g.hasNext();){var i=g.next();i.type==="orion.annotation.highlightError"&&h.push(i)}g=[];for(i=a;i<=d;i++){b=i;var j=this.lineStyles[b],j=j&&j.errors;
b=c.getLineStart(b);if(j)for(var q=0;q<j.length;q++){var p=j[q];g.push(k.AnnotationType.createAnnotation("orion.annotation.highlightError",p.start+b,p.end+b))}}f.replaceAnnotations(h,g)}this.textView.redrawLines(a,d+1)},onLineStyle:function(a){function f(a,b){for(var d=a.length,e=[],f=0;f<d;f++){var g=a[f];e.push({start:g.start+b,end:g.end+b,style:g.style})}return e}var d=this.lineStyles[a.lineIndex];if(d)if(d.ranges)a.ranges=f(d.ranges,a.lineStart);else if(d.style)a.style=d.style},_getEmptyStyle:function(a){for(var f=
[],d=0;d<a;d++)f.push(null);return f},setContentType:function(a){this.contentType=a;if(this.services)for(a=0;a<this.services.length;a++){var f=this.services[a];if(f.setContentType){var d=this.serviceRegistry.getService("orion.page.progress");d?d.progress(f.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):f.setContentType(this.contentType)}}},onServiceAdded:function(a,f){j(a)&&this.addServiceListener(f)},onServiceRemoved:function(a,
f){this.services.indexOf(f)!==-1&&this.removeServiceListener(f)},addServiceListener:function(a){if(typeof a.addEventListener==="function"){if(a.addEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),this.services.push(a),a.setContentType&&this.contentType){var f=this.serviceRegistry.getService("orion.page.progress");f?f.progress(a.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):a.setContentType(this.contentType)}}else typeof console!==
"undefined"&&console.log(Error(g))},removeServiceListener:function(a){typeof a.removeEventListener==="function"?(a.removeEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),a=this.services.indexOf(a),a!==-1&&this.services.splice(a,1)):typeof console!=="undefined"&&console.log(Error(g))}};return h});
define("orion/highlight",["examples/editor/textStyler","orion/editor/textStyler","orion/editor/textMateStyler","orion/editor/AsyncStyler","orion/Deferred"],function(i,k,j,h,a){function g(d,c,b,e,g,s,o){function q(d,e){var f=d.getProperty("contentType")||d.getProperty("contentTypes"),g=d.getProperty("fileTypes");if(f)return a.when(c.isSomeExtensionOf(b,f)).then(function(a){return a?d:null});else if(e&&g&&g.indexOf(e)!==-1)return f=new a,f.resolve(d),f;return null}function p(a){var b=null;switch(a&&
a.id){case "application/javascript":case "application/json":b=new i.TextStyler(e,"js",g);break;case "text/x-java-source":b=new i.TextStyler(e,"java",g);break;case "text/css":b=new i.TextStyler(e,"css",g)}return b}if(!f){var t=p(b);if(t)return s=new a,s.resolve(t),s}if(f&&!this.orionGrammars)this.orionGrammars={};for(var t=s&&s.split(".").pop().toLowerCase(),s=d.getServiceReferences("orion.edit.highlighter"),r=[],u=[],v=0;v<s.length;v++){var n=s[v],w=n.getProperty("type");w==="grammar"||!f&&typeof w===
"undefined"?r.push(n.getProperty("grammar")):w!=="highlighter"&&(w=n.getProperty("id"))&&!this.orionGrammars[w]&&(this.orionGrammars[w]={id:w,contentTypes:n.getProperty("contentTypes"),patterns:n.getProperty("patterns"),repository:n.getProperty("repository")});(n=q(n,t))&&u.push(n)}return a.all(u,function(a){return{_error:a}}).then(function(a){for(var c,i=a.length-1;i>=0;i--){var n=a[i];if(n&&!n._error&&(o||n.getProperty("type")!=="highlighter")){c=n;break}}var p;if(c)if(a=c.getProperty("type"),a===
"highlighter")p=new h(e,d,g),p.setContentType(b);else if(a==="grammar"||!f&&typeof a==="undefined")c=c.getProperty("grammar"),p=new j.TextMateStyler(e,c,r);else if(f){p=[];for(var q in this.orionGrammars)p.push(this.orionGrammars[q]);p=new k.TextStyler(e,g,p,c.getProperty("id"))}return p})}function e(a,c){this.serviceRegistry=a;this.contentTypeService=c;this.styler=null}var f=1;e.prototype={setup:function(a,c,b,e,f){f=typeof f==="undefined"?!0:f;if(this.styler)this.styler.destroy&&this.styler.destroy(),
this.styler=null;var h=this;return g(this.serviceRegistry,this.contentTypeService?this.contentTypeService:this.serviceRegistry.getService("orion.core.contentTypeRegistry"),a,c,b,e,f).then(function(a){return h.styler=a})},getStyler:function(){return this.styler}};return{createStyler:g,SyntaxHighlighter:e}});
define("orion/markOccurrences",["orion/edit/editorContext","orion/Deferred"],function(i,k){function j(h,a,g){this.registry=h;this.inputManager=a;this.editor=g}j.prototype={setOccurrencesVisible:function(h){if(this.occurrencesVisible!==h)(this.occurrencesVisible=h)||this.editor.showOccurrences([])},findOccurrences:function(){function h(a,c,b){function e(a,b,c){a=b.getProperty("contentType");return f.isSomeExtensionOf(c,a).then(function(a){return a?b:null})}for(var f=a.getService("orion.core.contentTypeRegistry"),
g=a.getServiceReferences("orion.edit.occurrences"),h=[],i=0;i<g.length;i++){var j=g[i],t=j.getProperty("pattern");j.getProperty("contentType")?h.push(e(a,j,c)):t&&RegExp(t).test(b)&&(t=new k,t.resolve(j),h.push(t))}return k.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 a,g=this,e=g.registry.getService("orion.edit.occurrences"),f=function(){a&&window.clearTimeout(a);g.occurrencesVisible&&(a=window.setTimeout(function(){a=
null;var d={selection:g.editor.getSelection()};e.computeOccurrences(i.getEditorContext(g.registry),d).then(function(a){g.editor.showOccurrences(a)})},500))};g.inputManager.addEventListener("InputChanged",function(d){var c=g.editor.getTextView();c&&(c.removeEventListener("Selection",f),h(g.registry,d.contentType,d.title).then(function(b){!b||b.length===0?a&&window.clearTimeout(a):c.addEventListener("Selection",f)}))})}};return{MarkOccurrences:j}});
define("orion/syntaxchecker",["orion/Deferred","orion/edit/editorContext"],function(i,k){return{SyntaxChecker:function(){function j(a,g){this.registry=a;this.editor=g}function h(a,g,e){a=Math.max(a,g);return a=Math.min(a,e)}j.prototype={checkSyntax:function(a,g,e,f){function d(a,b){function c(a,b,e){a=b.getProperty("contentType");return d.isSomeExtensionOf(e,a).then(function(a){return a?b:null})}for(var d=a.getService("orion.core.contentTypeRegistry"),e=a.getServiceReferences("orion.edit.validator"),
f=[],h=0;h<e.length;h++){var j=e[h],k=j.getProperty("pattern");j.getProperty("contentType")?f.push(c(a,j,b)):k&&RegExp(k).test(g)&&(k=new i,k.resolve(j),f.push(k))}return i.all(f,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(a&&!e){var c=this,b=this.registry;d(b,a).then(function(d){var e=function(a){return a&&(a.problems||a.errors)||[]},h=b.getService("orion.page.progress"),d=d.map(function(c){var c=b.getService(c),
d;c.computeProblems?(d={contentType:a.id,title:g},d=c.computeProblems(k.getEditorContext(b),d)):c.checkSyntax&&(d=c.checkSyntax(g,f));return h.progress(d,"Validating "+g).then(e)});i.all(d,function(a){return{_error:a}}).then(function(a){for(var d=[],e=0;e<a.length;e++){var f=a[e];f._error||(c._fixup(f),d=d.concat(f))}b.getService("orion.core.marker")._setProblems(d)})})}},_fixup:function(a){for(var g=this.editor.getModel(),e=0;e<a.length;e++){var f=a[e];f.description=f.description||f.reason;f.severity=
f.severity||"error";f.start=typeof f.start==="number"?f.start:f.character;if(typeof f.line==="number"){var d=g.getLine(f.line-1,!1).length;f.start=h(f.start,1,d-1);f.end=typeof f.end==="number"?f.end:-1;f.end=h(f.end,f.start+1,d)}else if(d=g.getCharCount(),f.start=h(f.start,0,d),f.end=typeof f.end==="number"?f.end:-1,f.end=h(f.end,f.start,d),f.end===d&&g.getLineCount()>1&&d===g.getLineStart(g.getLineCount()-1)){var c=g.getLineCount()-2,d=g.getLineStart(c),c=g.getLineEnd(c);d===c?f.start=f.end=c:(f.start=
c-1,f.end=c)}}}};return j}()}});
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/globalCommands,orion/edit/dispatcher,orion/edit/editorContext,orion/edit/typedefs,orion/highlight,orion/markOccurrences,orion/syntaxchecker,orion/keyBinding,orion/uiUtils,orion/util,orion/objects".split(","),function(i,
k,j,h,a,g,e,f,d,c,b,l,m,s,o,q,p,t,r,u,v,n,w,x,y,F){function H(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.statusReporter=a.statusReporter;this.model=
a.model;this.undoStack=a.undoStack;this.syntaxHighlighter=new u.SyntaxHighlighter(this.serviceRegistry);this.typeDefRegistry=new r(this.serviceRegistry);(a=q.getKeyAssist())&&a.addProvider(this);var b=q.getMainSplitter();b&&b.splitter.addEventListener("resize",function(a){this.editor&&a.node===b.main&&this.editor.resize()}.bind(this));q.getGlobalEventTarget().addEventListener("toggleTrim",function(){this.editor&&this.editor.resize()}.bind(this));this.settings={};this._init()}H.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 f.EmacsMode(b);b.addKeyMode(this.emacs)}else if(a.keyBindings==="vi"){if(!this.vi)this.vi=new d.VIMode(b,this.statusReporter);b.addKeyMode(this.vi)}},getParent:function(){return this._parent},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());this.markOccurrences.setOccurrencesVisible(a.showOccurrences);b.getContentAssist()&&b.getContentAssist().setAutoTriggerEnabled(a.contentAssistAutoTrigger)},updateStyler:function(a){var b=this.syntaxHighlighter.getStyler();b&&(b.setTabsVisible&&b.setTabsVisible(a.showTabs),b.setSpacesVisible&&b.setSpacesVisible(a.showSpaces))},showKeyBindings:function(a){var b=this.editor;if(b&&b.getTextView&&b.getTextView()){var c=
b.getTextView(),d=c.getActions(!0).filter(function(a){return(a=c.getActionDescription(a))&&a.name});d.sort(function(a,b){return c.getActionDescription(a).name.localeCompare(c.getActionDescription(b).name)});a.createHeader(i.Editor);for(var e=function(a){return function(){c.focus();return c.invokeAction(a)}},b={},f,g=0;g<d.length;g++)for(var h=d[g],j=c.getActionDescription(h),k=c.getKeyBindings(h),l=0;l<k.length;l++){f=k[l];var m=x.getUserKeyString(f);f.scopeName?(b[f.scopeName]||(b[f.scopeName]=[]),
b[f.scopeName].push({bindingString:m,name:j.name,execute:e(h)})):a.createItem(m,j.name,e(h))}for(var n in b)if(b[n].length){a.createHeader(n);for(d=0;d<b[n].length;d++)f=b[n][d],a.createItem(f.bindingString,f.name,f.execute)}}},_init:function(){var d=null;if(this.preferences)d=this.editorPreferences=new c.EditorPreferences(this.preferences,function(a){a?this.updateSettings(a):d.getPrefs(this.updateSettings.bind(this))}.bind(this));var f=null;this.preferences&&(f=new b.ThemePreferences(this.preferences,
new l.ThemeData),f.apply());var q,r=this,u=this._parent,x=this.readonly,H=this.commandRegistry,C=this.serviceRegistry,O=this.fileClient,M=this.inputManager,R=this.searcher,S=this.progress,P=this.contentTypeRegistry,K=function(a,b,c){var d=M.getContentType(),e=a.getTitle(),a=C.getServiceReferences("orion.edit.contentAssist").concat(C.getServiceReferences("orion.edit.contentassist"));(c=c&&c.providerInfoArray)||(c=a.map(function(a){var b=a.getProperty("contentType"),c=a.getProperty("pattern");if(b&&
P.isSomeExtensionOf(d,b)||c&&RegExp(c).test(e)){var b=C.getService(a),c=a.getProperty("service.id").toString(),f=a.getProperty("charTriggers"),a=a.getProperty("excludedStyles");f&&(f=RegExp(f));a&&(a=RegExp(a));return{provider:b,id:c,charTriggers:f,excludedStyles:a}}return null}).filter(function(a){return!!a}));var f={};Object.keys(t).forEach(function(a){typeof t[a]==="function"&&(f[a]=t[a].bind(null,C))});b.setEditorContextProvider(f);b.setProviderInfoArray(c);b.setAutoTriggerEnabled(r.settings.contentAssistAutoTrigger);
b.setProgress(S);b.setStyleAccessor(r.getStyleAccessor())},L=x?null:{createContentAssistMode:function(a){var b=new e.ContentAssist(a.getTextView());b.addEventListener("Activating",K.bind(null,a,b));var c=new e.ContentAssistWidget(b,"contentassist"),c=new e.ContentAssistMode(b,c);b.setMode(c);K(a,b);b.computeProposals();return c}},A=this.editor=new k.Editor({textViewFactory:function(){var b=r.updateViewOptions(r.settings);F.mixin(b,{parent:u,model:new a.ProjectionTextModel(r.model||new h.TextModel),
wrappable:!0});return new j.TextView(b)},undoStackFactory:r.undoStack?{createUndoStack:function(a){r.undoStack.setView(a.getTextView());return r.undoStack}}:new g.UndoFactory,textDNDFactory:new g.TextDNDFactory,annotationFactory:new g.AnnotationFactory,foldingRulerFactory:new g.FoldingRulerFactory,lineNumberRulerFactory:new g.LineNumberRulerFactory,contentAssistFactory:L,keyBindingFactory:function(a,b,c,e){b=new s.TextSearcher(a,C,H,c);c=(new g.KeyBindingsFactory).createKeyBindings(a,c,e,b);r.updateSourceCodeActions(r.settings,
c.sourceCodeActions);(new o.EditorCommandFactory({serviceRegistry:C,commandRegistry:H,fileClient:O,inputManager:M,toolbarId:"toolsActions",saveToolbarId:"fileActions",editToolbarId:"editActions",readonly:x,navToolbarId:"pageNavigationActions",textSearcher:b,searcher:R,editorSettings:function(){return r.settings},localSettings:q})).generateEditorCommands(a);var f=a.getTextView();if(a=H.findCommand("orion.keyAssist"))f.setKeyBinding(new w.KeyStroke(191,!1,!0,!y.isMac,y.isMac),a.id),f.setAction(a.id,
a.callback,a);f.setAction("toggleWrapMode",function(){f.invokeAction("toggleWrapMode",!0);var a=f.getOptions("wrapMode");r.settings.wordWrap=a;d&&d.setPrefs(r.settings);return!0});r.vi=r.emacs=null;r.updateKeyMode(r.settings,f);return c},statusReporter:this.statusReporter,domNode:u});A.id="orion.editor";A.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 p.Dispatcher(this.serviceRegistry,A,M);f&&d&&(q=new m({local:!0,editor:A,themePreferences:f,preferences:d}));M.addEventListener("InputChanged",function(a){var b=A.getTextView();b&&(b.setOptions(this.updateViewOptions(this.settings)),this.syntaxHighlighter.setup(a.contentType,A.getTextView(),A.getAnnotationModel(),a.title,!0).then(function(){this.updateStyler(this.settings);A.getContentAssist()&&K(A,A.getContentAssist())}.bind(this)))}.bind(this));M.addEventListener("Saving",function(){r.settings.trimTrailingWhiteSpace&&
A.getTextView().invokeAction("trimTrailingWhitespaces")});(f=C.getService("orion.core.marker"))&&f.addEventListener("problemsChanged",function(a){A.showProblems(a.problems)});(f=C.getService("orion.core.blame"))&&f.addEventListener("blameChanged",function(a){A.showBlame(a.blameInfo)});f=this.markOccurrences=new v.MarkOccurrences(C,M,A);f.setOccurrencesVisible(this.settings.occurrencesVisible);f.findOccurrences();var I=new n.SyntaxChecker(C,A);A.addEventListener("InputChanged",function(a){I.checkSyntax(M.getContentType(),
a.title,a.message,a.contents);M.getReadOnly()&&A.reportStatus(i.readonly,"error")});var N={};"getCaretOffset,setCaretOffset,getSelection,setSelection,getText,setText,getLineAtOffset,getLineStart".split(",").forEach(function(a){N[a]=A[a].bind(A)});C.registerService("orion.edit.context",N,null);this.editorPreferences&&this.editorPreferences.getPrefs(this.updateSettings.bind(this))},create:function(){this.editor.install()},destroy:function(){this.editor.uninstall()},getStyleAccessor:function(){var a=
null,b=this.syntaxHighlighter.getStyler();b&&b.getStyleAccessor&&(a=b.getStyleAccessor());return a}};return{EditorView:H}});
define("orion/inputManager","i18n!orion/edit/nls/messages,orion/i18nUtil,orion/Deferred,orion/EventTarget,orion/objects,orion/PageUtil".split(","),function(i,k,j,h,a,g){function e(a){this._document=a.document||document;this._timeout=a.timeout;for(var a="keypress,keydown,keyup,mousemove,mousedown,mousemove".split(","),b=function(){this._resetTimer()}.bind(this),d=0;d<a.length;d++)this._document.addEventListener(a[d],b,!0);h.attach(this)}function f(a,b){if(a){if(!b.Severity){var d=b,e={Severity:"Error",
Message:i.noResponse};if(d.status!==0)if(d.responseText){d=d.responseText;try{var f=JSON.parse(d);e.Severity=f.Severity||e.Severity;e.Message=f.Message||e.Message}catch(g){e.Message=d}}else try{e.Message=JSON.stringify(d)}catch(h){}b=e}a.setProgressResult(b)}else window.console.log(b)}function d(a){h.attach(this);this.serviceRegistry=a.serviceRegistry;this.statusService=a.statusService;this.fileClient=a.fileClient;this.progressService=a.progressService;this.contentTypeRegistry=a.contentTypeRegistry;
this.selection=a.selection;this._input=this._title="";this.dispatcher=null;this._unsavedChanges=[]}e.prototype={_resetTimer:function(){var a=this._document.defaultView||this._document.parentWindow;if(this._timer)a.clearTimeout(this._timer),this._timer=null;if(this._timeout!==-1)this._timer=a.setTimeout(function(){this.onIdle({type:"Idle"});this._timer=null;this._resetTimer()}.bind(this),this._timeout)},onIdle:function(a){return this.dispatchEvent(a)},setTimeout:function(a){this._timeout=a;this._resetTimer()}};
a.mixin(d.prototype,{_maybeLoadWorkspace:function(a){var b=this.fileClient;return a===b.fileServiceRootURL(a)?b.loadWorkspace(a).then(function(a){return a.Location}):(new j).resolve(a)},_read:function(a){if(this.cachedMetadata&&this.cachedMetadata.Location===a)return(new j).resolve(this.cachedMetadata);var b=this.fileClient,d=Array.prototype.slice.call(arguments,1);return this._maybeLoadWorkspace(a).then(function(a){return b.read.apply(b,[a].concat(d))})},load:function(){var a=this.getInput();if(a){var b=
this.fileClient,d=this._parsedLocation.resource,e=this.progressService,g=function(a,b,c){return!e?a:e.progress(a,k.formatMessage(b,c))},h=this.getEditor();if(this._fileMetadata)!this._saving&&!this._fileMetadata.Directory&&!this._readonly&&g(b.read(d,!0),i.ReadingMetadata,a).then(function(e){if(this._fileMetadata&&this._fileMetadata.Location===e.Location&&this._fileMetadata.ETag!==e.ETag)this._fileMetadata=e,(!h.isDirty()||window.confirm(i.loadOutOfSync))&&g(b.read(d),i.Reading,a).then(function(b){h.setInput(a,
null,b);this._unsavedChanges=[]}.bind(this))}.bind(this));else{var q=d;if(q.indexOf("/gitapi/commit/")===0){var p=q.indexOf("/file"),t=q.indexOf("?",p);if(t===-1)t=q.length;q=q.substring(p,t);this._readonly=!0}var r=window.setTimeout(function(){r=null;this.reportStatus(k.formatMessage(i.Fetching,a))}.bind(this),800),u=function(){this.reportStatus("");r&&window.clearTimeout(r)}.bind(this),v=function(a){u();var b=null;if(this.serviceRegistry)b=this.serviceRegistry.getService("orion.page.message");else if(this.statusService)b=
this.statusService;f(b,a);this._setNoInput()}.bind(this);this._acceptPatch=null;g(this._read(q,!0),i.ReadingMetadata,q).then(function(e){e?e.Directory?j.when(e.Children||g(b.fetchChildren(e.ChildrenLocation),i.Reading,a),function(b){u();e.Children=b;this._setInputContents(this._parsedLocation,a,b,e)}.bind(this),v):this._isText(e)?g(b.read(d,!1,!0),i.Reading,a).then(function(b){u();if(typeof b!=="string")this._acceptPatch=b.acceptPatch,b=b.result;this._setInputContents(this._parsedLocation,a,b,e)}.bind(this),
v):g(b._getService(d).readBlob(d),i.Reading,a).then(function(b){u();this._setInputContents(this._parsedLocation,a,b,e)}.bind(this),v):v({responseText:k.formatMessage(i.ReadingMetadataError,q)})}.bind(this),v)}}},processParameters:function(a){var b=this.getEditor();b&&b.processParameters&&b.processParameters(a)},getAutoLoadEnabled:function(){return this._autoLoadEnabled},getAutoSaveEnabled:function(){return this._autoSaveEnabled},getEditor:function(){return this.editor},getInput:function(){return this._input},
getTitle:function(){return this._title},getFileMetadata:function(){return this._fileMetadata},getReadOnly:function(){var a=this._fileMetadata;return this._readonly||!a||a.Attributes&&a.Attributes.ReadOnly},getContentType:function(){return this._contentType},onFocus:function(){this._autoSaveEnabled&&this._errorSaving?this.save():this._autoLoadEnabled&&this.load()},onChanging:function(a){if(this._getSaveDiffsEnabled()){var b=this._unsavedChanges.length,d=a.removedCharCount,e=a.start,f=a.start+d,g=0;
a.addedCharCount===0?g=-1:d===0&&(g=1);if(b>0&&g===this.previousChangeType){b=this._unsavedChanges[b-1];if(d===0&&e===b.end+b.text.length){b.text+=a.text;return}if(a.addedCharCount===0&&f===b.start){b.start=e;return}}this.previousChangeType=g;this._unsavedChanges.push({start:e,end:f,text:a.text})}},reportStatus:function(a){this.statusReporter?this.statusReporter(a):this.editor&&this.editor.reportStatus(a)},save:function(){function a(b){if(g===w.getInput())w.getFileMetadata().ETag=b.ETag,d.setInput(g,
null,h,!0);w.reportStatus("");e&&n&&n.setProgressResult({Message:i.Saved,Severity:"Normal"});w.afterSave&&w.afterSave();w._saving=!1}function b(a){w.reportStatus("");f(n,a);w._saving=!1;w._errorSaving=!0}if(!this._saving){var d=this.getEditor();if(d&&d.isDirty()&&!this.getReadOnly()){var e=this._errorSaving;this._saving=!0;var g=this.getInput();this.reportStatus(i["Saving..."]);this.dispatchEvent({type:"Saving",inputManager:this});d.markClean();var h=d.getText(),j=h;if(this._getSaveDiffsEnabled()&&
!this._errorSaving){for(var p=this._unsavedChanges,t=0,r=0;r<p.length;r++)t+=p[r].text.length;h.length>t&&(j={diff:p})}this._unsavedChanges=[];this._errorSaving=!1;var p={ETag:this.getFileMetadata().ETag},u=this._parsedLocation.resource,j=this.fileClient.write(u,j,p),v=this.progressService,n=null;this.serviceRegistry&&(n=this.serviceRegistry.getService("orion.page.message"));v&&(j=v.progress(j,k.formatMessage(i.savingFile,g)));var w=this;j.then(a,function(d){d.status===412?window.confirm(i.saveOutOfSync)?
(d=w.fileClient.write(u,h),v&&(d=v.progress(d,k.formatMessage(i.savingFile,g))),d.then(a,b)):w._saving=!1:b(d)})}}},setAutoLoadEnabled:function(a){this._autoLoadEnabled=a},setAutoSaveTimeout:function(a){this._autoSaveEnabled=a!==-1;this._idle?this._idle.setTimeout(a):(this._idle=new e({document:document,timeout:a}),this._idle.addEventListener("Idle",function(){this._errorSaving||this.save()}.bind(this)))},setContentType:function(a){this._contentType=a},setInput:function(a){if(!this._ignoreInput&&
(a||(a=g.hash()),typeof a==="string")){var b=this.getEditor();a&&a[0]!=="#"&&(a="#"+a);var d=g.matchResourceParameters(a),e=this._parsedLocation||{};if(b&&b.isDirty()){var f=this._location;if(e.resource!==d.resource)if(this._autoSaveEnabled)this.save();else if(!window.confirm(i.confirmUnsavedChanges)){window.location.hash=f;return}}b=b&&e.editor!==d.editor;this._location=a;this._parsedLocation=d;this._ignoreInput=!0;this.selection&&this.selection.setSelections(a);this._ignoreInput=!1;(a=d.resource)?
a===this._input?b?(this.reportStatus(""),this._setInputContents(d,a,null,this._fileMetadata,this._isText(this._fileMetadata))):this.processParameters(d):(this._input=a,this._readonly=!1,this._fileMetadata=null,this.load()):this._setNoInput(!0)}},setTitle:function(a){var b=a.lastIndexOf("/");b!==-1&&(a=a.substring(b+1));this._title=a},setSaveDiffsEnabled:function(a){this._saveDiffsEnabled=a},_getSaveDiffsEnabled:function(){return this._saveDiffsEnabled&&this._acceptPatch!==null&&this._acceptPatch.indexOf("application/json-patch")!==
-1},_isText:function(a){a=this.contentTypeRegistry.getFileContentType(a);if(!a)return!0;var b=this.contentTypeRegistry.getContentType("text/plain");return this.contentTypeRegistry.isExtensionOf(a,b)},_setNoInput:function(a){a?this.fileClient.loadWorkspace("").then(function(a){this._input=a.ChildrenLocation;this._setInputContents(a.ChildrenLocation,null,a,a)}.bind(this)):(this._input=this._title=this._fileMetadata=null,this.setContentType(null),this.dispatchEvent({type:"InputChanged",input:null}))},
_setInputContents:function(a,b,d,e,f){var g,h=!1;e?(this._fileMetadata=e,this.setTitle(e.Location||String(e)),this.setContentType(this.contentTypeRegistry.getFileContentType(e)),g=e.Name,h=e.Directory):(this._fileMetadata=null,this.setTitle(b),this.setContentType(this.contentTypeRegistry.getFilenameContentType(this.getTitle())),g=this.getTitle());var i=this.getEditor();if(this._focusListener)i&&i.getTextView&&i.getTextView()&&i.getTextView().removeEventListener("Focus",this._focusListener),this._focusListener=
null;if(this._changingListener)i&&i.getModel&&i.getModel()&&i.getModel().removeEventListener("Changing",this._changingListener),this._changingListener=null;e={type:"InputChanged",input:a,name:g,title:b,contentType:this.getContentType(),metadata:e,location:window.location,contents:d};this.dispatchEvent(e);this.editor=i=e.editor;if(!h){if(i&&i.getModel&&i.getModel())i.getModel().addEventListener("Changing",this._changingListener=this.onChanging.bind(this));f||i.setInput(b,null,d);if(i&&i.getTextView&&
i.getTextView())i.getTextView().addEventListener("Focus",this._focusListener=this.onFocus.bind(this));this._unsavedChanges=[];this.processParameters(a)}}});return{handleError:f,InputManager:d}});
define("orion/cfui/logView","orion/editor/editor,orion/editor/textModel,orion/editorView,orion/inputManager,orion/objects,orion/webui/littlelib,orion/PageUtil,orion/Deferred,orion/globalCommands,orion/URL-shim".split(","),function(i,k,j,h,a,g,e,f,d){function c(a){h.InputManager.apply(this,[a]);this.cFClient=a.cFClient;this.commandRegistry=a.commandRegistry}function b(a){this.options=a;this._parent=a.parent;this.serviceRegistry=a.serviceRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.commandRegistry=
a.commandRegistry;this.progress=a.progressService;this.undoStack=a.undoStack;this._createInputManager()}c.prototype=new h.InputManager({});a.mixin(c.prototype,{_read:function(a){var b=new f,c=this.applicationInfo.instance||Object.keys(this.applicationInfo.logs)[0];this.cFClient.getLogs(this.applicationInfo.Target,this.applicationInfo.Application,a,this.applicationInfo.instance).then(function(a){a=a[c];a.Instance=c;b.resolve(a);d.setPageTarget({task:"Cloud Foundry Logs",target:a,breadcrumbTarget:a,
serviceRegistry:this.serviceRegistry,commandService:this.commandRegistry})}.bind(this));return b},setApplicationInfo:function(a){this.applicationInfo=a},getApplicationInfo:function(){return this.applicationInfo},load:function(){var a=this.getInput();if(a){var b=null,c=function(){this.reportStatus("");b&&window.clearTimeout(b)}.bind(this),d=function(a){c();var b=this.serviceRegistry.getService("orion.page.message");if(b){if(a.status===0)a={Severity:"Error",Message:"No response"};else{var d=a.responseText;
if(d)try{a=JSON.parse(d)}catch(e){a={Severity:"Error",Message:d}}}b.setProgressResult(a)}else window.console.log(a);this._setNoInput()}.bind(this);this._acceptPatch=null;if(!this.lastLogLoaded||this.lastLogLoaded!==a||this.applicationInfo.instance!==null&&this.lastLogInstance!==this.applicationInfo.instance)this.progressService.showWhile(this._read(a,!0),"Loading "+a).then(function(b){this.lastLogLoaded=a;this.lastLogInstance=b.Instance;this._setInputContents(this._parsedLocation,a,b.Contents,b)}.bind(this),
d);else{var b=window.setTimeout(function(){b=null;this.reportStatus("Fetching "+a)}.bind(this),800),e=!1,f=this.applicationInfo.instance||Object.keys(this.applicationInfo.logs)[0];this.cFClient.getLogs(this.applicationInfo.Target,this.applicationInfo.Application).then(function(b){this.applicationInfo.logs[f].forEach(function(g){g.Name===a&&b[f].forEach(function(b){b.Name===a&&(g.Size!==b.Size&&(e=!0,this._read(a,!0).then(function(b){this._setInputContents(this._parsedLocation,a,b.Contents,b);this.lastLogLoaded=
a}.bind(this),d)),c())}.bind(this))}.bind(this));e||c();this.applicationInfo.logs=b}.bind(this),d)}}else this.lastLogInstance=this.lastLogLoaded=null},constructor:c});b.prototype={_createInputManager:function(){this.inputManager=new c(this.options);var a={parent:this._parent,model:new k.TextModel,undoStack:this.options.undoStack,serviceRegistry:this.options.serviceRegistry,pluginRegistry:this.options.pluginRegistry,commandRegistry:this.options.commandRegistry,contentTypeRegistry:this.options.contentTypeRegistry,
inputManager:this.inputManager,readonly:!0,preferences:this.options.preferences,searcher:this.options.searcher,selection:this.options.selection,fileService:this.options.fileClient,fileClient:this.options.fileClient,statusReporter:this.options.statusReporter,statusService:this.options.statusService,progressService:this.options.progressService};this.editorView=new j.EditorView(a)},create:function(){if(!this.editorCreated)this.editorView.create(),this.editorCreated=!0,this.inputListener=function(a){a.editor=
this.editorView.editor}.bind(this),this.inputManager.addEventListener("InputChanged",this.inputListener),this.inputManager.lastLogLoaded=null,this.inputManager.lastLogInstance=null},destroy:function(){this.editorCreated&&(this.editorView.destroy(),this.inputListener&&this.inputManager.removeEventListener("InputChanged",this.inputListener));this.editorCreated=!1}};return{LogEditorView:b}});
define("orion/cfui/widgets/CfLoginDialog",["orion/webui/dialog"],function(i){function k(i){this._init(i)}k.prototype=new i.Dialog;k.prototype.TEMPLATE='<div style="padding: 5px;" id="userIdRow"><div style="float: left; width: 150px;"><label id="userIdLabel" for="userId"></label></div><input id="userId" style="width: 200px;" value=""></div><div style="padding: 5px;" id="passwordRow"><div style="float: left; width: 150px;"><label id="passwordLabel" for="password"></label></div><input type="password" id="password" style="width: 200px;" value=""></div>';
k.prototype._init=function(i){this.options=i||{};this.title=this.options.title||"Cloud Foundry Login";this.modal=!0;this.buttons=[{text:"OK",isDefault:!0,callback:this.done.bind(this)}];this._func=i.func;this._initialize()};k.prototype._bindToDom=function(){this.$userIdLabel.appendChild(document.createTextNode("User Id:"));this.$passwordLabel.appendChild(document.createTextNode("Password:"))};k.prototype.done=function(){this.options.func(this.$userId.value,this.$password.value);this.hide()};return k.prototype.constructor=
k});
define('built-logs.js',"orion/webui/littlelib,orion/bootstrap,orion/status,orion/progress,orion/commandRegistry,orion/keyBinding,orion/dialogs,orion/selection,orion/contentTypes,orion/fileClient,orion/operationsClient,orion/searchClient,orion/globalCommands,orion/links,orion/cfui/cFClient,orion/PageUtil,orion/cfui/logsExplorer,orion/cfui/logView,orion/section,orion/cfui/widgets/CfLoginDialog".split(","),function(i,k,j,h,a,g,e,f,d,c,b,l,m,s,o,q,p,t,r,u){k.startup().then(function(g){function k(a){m.setPageTarget({task:a.Application?"Cloud Foundry Logs":
a.Application+" - Cloud Foundry Logs",target:a,breadcrumbTarget:a,serviceRegistry:y,commandService:D});M.classList.remove("toolbarTarget");i.empty(M);(new r.Section(M,{id:"logsNavSection",title:"Log Files",canHide:!1})).embedExplorer(P);P.setCommandsVisible(!1);P.load(a)}function w(a){if(z){if(a.status===0)a={Severity:"Error",Message:"No response"};else{var b=a.responseText;if(b)try{a=JSON.parse(b)}catch(c){a={Severity:"Error",Message:b}}}z.setProgressResult(a)}else window.console.log(a)}function x(a){var b;
if(a.Url||a.Org||a.Space)b={Url:a.Url,Org:a.Org,Space:a.Space},a.target=b;a.log&&K.create();a.log||K.destroy();if(this.lastLogsInfo.Application!==a.resource)J.showWhile(B.getLogs(b,a.resource),"Getting logs").then(function(c){this.lastLogsInfo=c={Target:b,Application:a.resource,instance:a.instance,logs:c};K.inputManager.setApplicationInfo(c);S.load(c);a.log?(M.classList.add("toolbarTarget"),K.inputManager.setInput(a.log)):k(c)},function(c){c.JsonData&&c.JsonData.error_code&&c.JsonData.error_code===
"CF-InvalidAuthToken"?(new u({title:"Login to "+b.Url,func:function(c,d){J.showWhile(B.login(b.Url,c,d,b.Org,b.Space),"Logging in to "+b.Url).then(function(){x(a)},w)}})).show():c.HttpCode===404&&c.Message==="Target not set"?F.getPreferences("/settingsCF").then(function(b){a.Url=b.get("targetUrl");x(a)}):w(c)});else{if(this.lastLogsInfo.instance!==a.instance)this.lastLogsInfo.instance=a.instance,K.inputManager.setApplicationInfo(this.lastLogsInfo),a.log&&K.inputManager.getInput()===a.log&&K.inputManager.load();
a.log?(M.classList.add("toolbarTarget"),K.inputManager.setInput(a.log)):k(K.inputManager.getApplicationInfo())}}var y=g.serviceRegistry,F=g.preferences,g=g.pluginRegistry;new e.DialogService(y);var H=new f.Selection(y),D=new a.CommandRegistry({selection:H}),G=new b.OperationsClient(y),z=new j.StatusReportingService(y,G,"statusPane","notifications","notificationArea"),J=new h.ProgressService(y,G,D);new s.TextLinkService({serviceRegistry:y});var G=new c.FileClient(y),E=new l.Searcher({serviceRegistry:y,
commandService:D,fileService:G}),B=new o.CFService(y),Q=new d.ContentTypeRegistry(y),C=i.node("sidebar"),O=i.node("sidebarToolbar"),M=i.node("log"),R=document.createElement("div"),S=new p.LogsExplorer(y,H,D,C,O,!0),P=new p.LogsExplorer(y,H,D,R),K=new t.LogEditorView({parent:M,undoStack:null,serviceRegistry:y,pluginRegistry:g,commandRegistry:D,contentTypeRegistry:Q,preferences:F,searcher:E,selection:H,fileService:G,statusReporter:function(a,b,c){b==="progress"?z.setProgressMessage(a):b==="error"?z.setErrorMessage(a):
z.setMessage(a,null,c)},statusService:z,progressService:J,cFClient:B});m.generateBanner("cf-logs",y,D,F,E,{});this.lastLogsInfo={};x(q.matchResourceParameters());window.addEventListener("hashchange",function(){x(q.matchResourceParameters())}.bind(this))})});