Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Webster2013-06-14 13:22:01 -0400
committerPaul Webster2013-06-14 13:22:01 -0400
commitbbc6934b849f24fe31717220e96ebfe210159eb8 (patch)
tree4f822514fd207c891026ebe9a688cc1cc84dd0b2
parent046474a52e0ba1f1435ad285eae0d8ef19d529bf (diff)
downloadorg.eclipse.e4.tools-bbc6934b849f24fe31717220e96ebfe210159eb8.tar.gz
org.eclipse.e4.tools-bbc6934b849f24fe31717220e96ebfe210159eb8.tar.xz
org.eclipse.e4.tools-bbc6934b849f24fe31717220e96ebfe210159eb8.zip
Bug 410841 - Explorer editing CSS with orionI20130616-2200I20130615-2200I20130614-2200
A sample view that loads the Orion CSS editor with the current theme.
-rw-r--r--bundles/org.eclipse.e4.tools.orion.css.editor/.classpath7
-rw-r--r--bundles/org.eclipse.e4.tools.orion.css.editor/.project28
-rw-r--r--bundles/org.eclipse.e4.tools.orion.css.editor/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--bundles/org.eclipse.e4.tools.orion.css.editor/META-INF/MANIFEST.MF11
-rw-r--r--bundles/org.eclipse.e4.tools.orion.css.editor/build.properties7
-rw-r--r--bundles/org.eclipse.e4.tools.orion.css.editor/icons/sample.gifbin0 -> 983 bytes
-rw-r--r--bundles/org.eclipse.e4.tools.orion.css.editor/plugin.xml42
-rw-r--r--bundles/org.eclipse.e4.tools.orion.css.editor/src/org/eclipse/e4/tools/orion/css/editor/Activator.java61
-rw-r--r--bundles/org.eclipse.e4.tools.orion.css.editor/src/org/eclipse/e4/tools/orion/css/editor/views/GetContentHandler.java24
-rw-r--r--bundles/org.eclipse.e4.tools.orion.css.editor/src/org/eclipse/e4/tools/orion/css/editor/views/SampleCSSView.java123
-rw-r--r--bundles/org.eclipse.e4.tools.orion.css.editor/web/built-editor.css473
-rw-r--r--bundles/org.eclipse.e4.tools.orion.css.editor/web/built-editor.min.js905
-rw-r--r--bundles/org.eclipse.e4.tools.orion.css.editor/web/css.html17
-rw-r--r--bundles/org.eclipse.e4.tools.orion.css.editor/web/orion.editor.txt3
14 files changed, 1708 insertions, 0 deletions
diff --git a/bundles/org.eclipse.e4.tools.orion.css.editor/.classpath b/bundles/org.eclipse.e4.tools.orion.css.editor/.classpath
new file mode 100644
index 00000000..ad32c83a
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.orion.css.editor/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.e4.tools.orion.css.editor/.project b/bundles/org.eclipse.e4.tools.orion.css.editor/.project
new file mode 100644
index 00000000..8577cf21
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.orion.css.editor/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.e4.tools.orion.css.editor</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.e4.tools.orion.css.editor/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.orion.css.editor/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..c537b630
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.orion.css.editor/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/bundles/org.eclipse.e4.tools.orion.css.editor/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.orion.css.editor/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..43224a68
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.orion.css.editor/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Editor
+Bundle-SymbolicName: org.eclipse.e4.tools.orion.css.editor;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.e4.tools.orion.css.editor.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.100"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
diff --git a/bundles/org.eclipse.e4.tools.orion.css.editor/build.properties b/bundles/org.eclipse.e4.tools.orion.css.editor/build.properties
new file mode 100644
index 00000000..b5e6bafc
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.orion.css.editor/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/,\
+ web/
diff --git a/bundles/org.eclipse.e4.tools.orion.css.editor/icons/sample.gif b/bundles/org.eclipse.e4.tools.orion.css.editor/icons/sample.gif
new file mode 100644
index 00000000..34fb3c9d
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.orion.css.editor/icons/sample.gif
Binary files differ
diff --git a/bundles/org.eclipse.e4.tools.orion.css.editor/plugin.xml b/bundles/org.eclipse.e4.tools.orion.css.editor/plugin.xml
new file mode 100644
index 00000000..11e8deab
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.orion.css.editor/plugin.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ name="Sample CSS Category"
+ id="org.eclipse.e4.tools.orion.css.editor">
+ </category>
+ <view
+ name="Sample CSS View"
+ icon="icons/sample.gif"
+ category="org.eclipse.e4.tools.orion.css.editor"
+ class="org.eclipse.e4.tools.orion.css.editor.views.SampleCSSView"
+ id="org.eclipse.e4.tools.orion.css.editor.views.SampleCSSView">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.ui.category.file"
+ defaultHandler="org.eclipse.e4.tools.orion.css.editor.views.GetContentHandler"
+ id="org.eclipse.e4.tools.orion.css.editor.get.content"
+ name="Get Editor Content">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="toolbar:org.eclipse.e4.tools.orion.css.editor.views.SampleCSSView">
+ <command
+ commandId="org.eclipse.e4.tools.orion.css.editor.get.content"
+ icon="icons/sample.gif"
+ label="Get Editor content"
+ style="push">
+ </command>
+ </menuContribution>
+ </extension>
+
+</plugin>
diff --git a/bundles/org.eclipse.e4.tools.orion.css.editor/src/org/eclipse/e4/tools/orion/css/editor/Activator.java b/bundles/org.eclipse.e4.tools.orion.css.editor/src/org/eclipse/e4/tools/orion/css/editor/Activator.java
new file mode 100644
index 00000000..1320dd63
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.orion.css.editor/src/org/eclipse/e4/tools/orion/css/editor/Activator.java
@@ -0,0 +1,61 @@
+package org.eclipse.e4.tools.orion.css.editor;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "z.ex.css.editor"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
diff --git a/bundles/org.eclipse.e4.tools.orion.css.editor/src/org/eclipse/e4/tools/orion/css/editor/views/GetContentHandler.java b/bundles/org.eclipse.e4.tools.orion.css.editor/src/org/eclipse/e4/tools/orion/css/editor/views/GetContentHandler.java
new file mode 100644
index 00000000..7bf51f70
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.orion.css.editor/src/org/eclipse/e4/tools/orion/css/editor/views/GetContentHandler.java
@@ -0,0 +1,24 @@
+package org.eclipse.e4.tools.orion.css.editor.views;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+public class GetContentHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ final IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
+ if (part instanceof SampleCSSView) {
+ SampleCSSView view = (SampleCSSView) part;
+ final Browser browser = view.getBrowser();
+ final Object rc = browser.evaluate("return window.editor.getText();");
+ System.out.println(rc);
+ }
+ return null;
+ }
+
+}
diff --git a/bundles/org.eclipse.e4.tools.orion.css.editor/src/org/eclipse/e4/tools/orion/css/editor/views/SampleCSSView.java b/bundles/org.eclipse.e4.tools.orion.css.editor/src/org/eclipse/e4/tools/orion/css/editor/views/SampleCSSView.java
new file mode 100644
index 00000000..8d6c2530
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.orion.css.editor/src/org/eclipse/e4/tools/orion/css/editor/views/SampleCSSView.java
@@ -0,0 +1,123 @@
+package org.eclipse.e4.tools.orion.css.editor.views;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.e4.tools.orion.css.editor.Activator;
+import org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine;
+import org.eclipse.e4.ui.css.swt.theme.ITheme;
+import org.eclipse.e4.ui.css.swt.theme.IThemeEngine;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.ViewPart;
+import org.osgi.framework.Bundle;
+
+/**
+ * This sample class demonstrates how to plug-in a new workbench view. The view
+ * shows data obtained from the model. The sample creates a dummy model on the
+ * fly, but a real implementation would connect to the model available either in
+ * this or another plug-in (e.g. the workspace). The view is connected to the
+ * model using a content provider.
+ * <p>
+ * The view uses a label provider to define how model objects should be
+ * presented in the view. Each view can present the same model objects using
+ * different labels and icons, if needed. Alternatively, a single label provider
+ * can be shared between views in order to ensure that objects of the same type
+ * are presented in the same way everywhere.
+ * <p>
+ */
+
+public class SampleCSSView extends ViewPart {
+
+ /**
+ * The ID of the view as specified by the extension.
+ */
+ public static final String ID = "z.ex.css.editor.views.SampleCSSView";
+ private Browser browser;
+ private String editorHtml;
+ private String editorContent;
+
+ /**
+ * This is a callback that will allow us to create the viewer and initialize
+ * it.
+ *
+ * @throws PartInitException
+ */
+ public void createPartControl(Composite parent) {
+ browser = new Browser(parent, SWT.NONE);
+ browser.setText(editorHtml, true);
+ }
+
+ @Override
+ public void init(IViewSite site) throws PartInitException {
+ super.init(site);
+ try {
+ initContent();
+ final Bundle bundle = Activator.getDefault().getBundle();
+ final InputStream in = bundle
+ .getEntry("/web/css.html").openStream();
+ String cssTemplate = loadFile(in, 1024);
+ final String editorCssUrl = FileLocator.toFileURL(bundle.getEntry("/web/built-editor.css")).toExternalForm();
+ final String editorJsUrl = FileLocator.toFileURL(bundle.getEntry("/web/built-editor.min.js")).toExternalForm();
+
+ editorHtml = String.format(cssTemplate, editorCssUrl, editorJsUrl, editorContent);
+ System.out.println(editorHtml);
+ } catch (IOException e) {
+ throw new PartInitException("Failed to load CSS editor", e);
+ }
+ }
+
+ private void initContent() throws MalformedURLException, IOException {
+ IThemeEngine engine = (IThemeEngine) getSite().getService(IThemeEngine.class);
+ final ITheme theme = engine.getActiveTheme();
+ final List<String> sheets = ((ThemeEngine)engine).getStylesheets(theme);
+ if (sheets.size()>0) {
+ String path = sheets.get(0);
+ final InputStream in = FileLocator.toFileURL(new URL(sheets.get(0))).openStream();
+ editorContent = loadFile(in, 1024);
+ } else {
+ editorContent = "/*\n * This is an Orion editor sample.\n */\nfunction() {\n var a = 'hi there!';\n window.console.log(a);\n}";
+ }
+ }
+
+ public String loadFile(final InputStream in, final int bufferSize) throws IOException {
+ final char[] buffer = new char[bufferSize];
+ final StringBuilder out = new StringBuilder();
+ final Reader reader = new InputStreamReader(in, "UTF-8");
+ try {
+ int size = reader.read(buffer, 0, buffer.length);
+ while (size > 0) {
+ out.append(buffer, 0, size);
+ size = reader.read(buffer, 0, buffer.length);
+ }
+ } finally {
+ reader.close();
+ }
+ return out.toString();
+ }
+
+ /**
+ * Passing the focus request to the viewer's control.
+ */
+ public void setFocus() {
+ browser.setFocus();
+ }
+
+ /**
+ * @return the browser
+ */
+ public Browser getBrowser() {
+ return browser;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.e4.tools.orion.css.editor/web/built-editor.css b/bundles/org.eclipse.e4.tools.orion.css.editor/web/built-editor.css
new file mode 100644
index 00000000..820924e2
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.orion.css.editor/web/built-editor.css
@@ -0,0 +1,473 @@
+.textview {
+ background-color: white;
+ font-family: "Consolas", "Monaco", "Vera Mono", "monospace";
+ font-size: 10pt;
+ min-width: 50px;
+ min-height: 50px;
+}
+.textviewScroll {
+ padding: 1px 2px;
+}
+.textviewContent {
+ cursor: auto;
+}
+.textviewLeftRuler {
+ border-right: 1px solid #eaeaea;
+}
+.textviewRightRuler {
+ border-left: 1px solid #eaeaea;
+}
+.textviewBlockCursor {
+ background: black;
+ opacity: 0.4;
+}
+.ruler {
+}
+.ruler.annotations {
+ width: 16px;
+}
+.ruler.folding {
+ width: 14px;
+}
+.ruler.lines {
+ text-align: right;
+}
+.ruler.overview {
+ width: 14px;
+}
+.rulerLines {
+ color: silver;
+}
+.rulerLines.even
+.rulerLines.odd {
+}
+.annotation {
+}
+.annotation.error,
+.annotation.warning,
+.annotation.task,
+.annotation.bookmark,
+.annotation.breakpoint,
+.annotation.collapsed,
+.annotation.expanded,
+.annotation.currentBracket,
+.annotation.matchingBracket,
+.annotation.currentLine,
+.annotation.matchingSearch,
+.annotation.currentSearch,
+.annotation.readOccurrence,
+.annotation.writeOccurrence,
+.annotation.linkedGroup,
+.annotation.currentLinkedGroup,
+.annotation.selectedLinkedGroup {
+}
+.annotationHTML {
+ cursor: pointer;
+ width: 16px;
+ height: 16px;
+ display: inline-block;
+ vertical-align: middle;
+ background-position: center;
+ background-repeat: no-repeat;
+}
+.annotationHTML.error {
+
+ background-image: url("data:image/gif;base64,R0lGODlhEAAQANUAAPVvcvWHiPVucvRuc+ttcfV6f91KVN5LU99PV/FZY/JhaM4oN84pONE4Rd1ATfJLWutVYPRgbdxpcsgWKMgZKs4lNfE/UvE/U+artcpdSc5uXveimslHPuBhW/eJhfV5efaCgO2CgP+/v+PExP///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACUALAAAAAAQABAAAAZ+wJJwSCwaScgkySgkjTQZTkYzWhadnE5oE+pwqkSshwQqkzxfa4kkQXxEpA9J9EFI1KQGQQBAigYCBA14ExEWF0gXihETeA0QD3AkD5QQg0NsDnAJmwkOd5gYFSQKpXAFDBhqaxgLBwQBBAapq00YEg0UDRKqTGtKSL7Cw8JBADs=");
+}
+.annotationHTML.warning {
+
+ background-image: url("data:image/gif;base64,R0lGODlhEAAQANUAAP7bc//egf/ij/7ijv/jl/7kl//mnv7lnv/uwf7CTP7DTf7DT/7IW//Na/7Na//NbP7QdP/dmbltAIJNAF03AMSAJMSCLKqASa2DS6uBSquCSrGHTq6ETbCHT7WKUrKIUcCVXL+UXMOYX8GWXsSZYMiib6+ETbOIUcOXX86uhd3Muf///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACsALAAAAAAQABAAAAZowJVwSCwaj0ihikRSJYcoBEL0XKlGkcjImQQhJBREKFnyICoThKeE/AAW6AXgdPyUAgrLJBEo0YsbAQyDhAEdRRwDDw8OaA4NDQImRBgFEJdglxAEGEQZKQcHBqOkKRpFF6mqq1WtrUEAOw==");
+}
+.annotationHTML.task {
+
+ background-image: url("data:image/gif;base64,R0lGODlhEAAQAMQAAN7s4uTy6ICvY423c2WdP2ugR3mqWYeza2ejOl6VNVqPM1aJMURsJ2GaOnKlT8PbsbPDqGmmO1OCLk98LEhxKGWfOWKaN0t2KkJoJf///////wAAAAAAAAAAAAAAAAAAACH5BAEAABoALAAAAAAQABAAAAVmoCaOZDk+UaquDxkNcCxHJHLceI6QleD/vkCmQrIYjkiDMGAhJRzQ6NKRICkKgYJ2qVWQFktCmEBYkCSNZSbQaDckpAl5TCZMSBdtAaDXX0gUUYJRFCQMSYgGDCQQGI6PkBAmkyUhADs=");
+}
+.annotationHTML.bookmark {
+
+ background-image: url("data:image/gif;base64,R0lGODlhEAAQALMAAP7//+/VNPzZS/vifeumAPrBOOSlHOSuRP///wAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAgALAAAAAAQABAAAARLEMlJq5Xn3EvIrkenfRIhCB5pmKhRdbAJAGhssuc8n6eJoAKdkOaTAIdEQeWoA1oGsiZhYAnIcqiApVPjElyUbkFSgCkn5XElLYkAADs=");
+}
+.annotationHTML.breakpoint {
+
+ background-image: url("data:image/gif;base64,R0lGODlhEAAQANUAAFheoFxkoFxnpmt0pmZxpnF7rYyWwmJwpnaFs3aDrWt8rXGBrYycwmZ3mXuNs42cu77F03GIs3aJrYGVu2J5oKCuxeDj6LK/03GLrYieu3aIoIygu6m4zcLN3MTM1m6Rs2aLriRgkSZilXGXtoGcs7LD0QBLhSZikihol3ScubrO2Yaqu5q4xpO0wpm7yabF0ZO9yaXI0r3X3tHj6P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAADQALAAAAAAQABAAAAafQJpwSCwWLYZBIDAwWIw0A+FFpW6aRUPCxe1yE4ahhdCCxWSzmSwGgxGeUceKpUqhUCkVa7UK0wgkJCUjJoUmIyWBBEIEGhoeJ4YmJx6OAUIADQ0QIZIhEJoAQgEUFBUgkiAVpZdRCxIPFx8iIh8XDw4FfhYHDhgZHB0dHBkYEwdwUQoTEc3OEwp+QwYHCBMMDBMIB9JESAJLAk5Q5EVBADs=");
+}
+.annotationHTML.collapsed {
+
+ width: 14px;
+ height: 14px;
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWBJREFUeNpi/P//PwMlgImBQkCxASzoAp++fo+6de+Z+fXbD/Jev/nAICoiwKCpqrBBTUlqNR835zJ09YzIYfDxy7eo/cevLmXlYGNQUJAEahZieP3mHcODB08Zfv/4w+BoqR3Nz8O1DKcXzt94HPqXmZlBU1+LgZNfkMHazIOBA0hr6uswgMTP33gYijcMLlx/EMAnLs7w7sc/hg9AG0HgPZB+B8S84hJA+UcBeMPg+at3DJIMnAxZzt5wsUhnXzDdsmIVWB6vAcLCfAys3z4wzN64huEfkJ/uH8IwexOQDQymD2/fgeXxekFLRWHD51evGDhZGRi4WSFSnCwgNjB2Xr1m0AbK4zXAQkdhNdPf3wx3r91g+PruLcOqnasYvn54x3Dv2k0G5r+/GMyB8nijEQTefvoadeH6w9Cbtx8GvH//kUFQkJ9BQ1V+g76m/GphPu5lBA0YenmBYgMAAgwA34GIKjmLxOUAAAAASUVORK5CYII=");
+}
+.annotationHTML.expanded {
+
+ width: 14px;
+ height: 14px;
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAT5JREFUeNrUksFKw0AURW+mTWw67SSEiG209U90r4jddFO34l+5U0HdZCHiFwiCOz9AlMSmGEpMOqk1TWJSFGyFbATR2dyZd+Dw3mOENE3xkyP8PYHrBT3OX7uW43ZefA6FUaw1dJPSyrmu1k8KBYOh37Od4XFZLEPXFdRrFMGIw3U9TKMYqw1tb0VjcxLy9eEF425CCIxWE5JcxSQGxCyNloG87gXhwWIHc4J767lTZQw8ShFGSZbxRyaQmZJxd3NRUJ6ffwQNEi6PzG/L2tjdmvFCgcKqKL2F2Olu43MzggDka+IjPuOFI7Sbujn2fUglYKkkzFIi+R0I/QDrGS8UqDX5QkhiOHYfE84hkhSTkGNgOyDJFCzjhYLTq+vDtrG8r1LZtB6fcHtzB+uhD5VWzLx+lvF/8JV/XfAuwADsrJbMGG4l4AAAAABJRU5ErkJggg==");
+}
+.annotationHTML.multiple {
+
+ background-image: url("data:image/gif;base64,R0lGODlhEAAQANUAAOdpa+yJiuFYXOFYXeBYXONwded8f+NwdmhwkHB4iPr7/ezx+fP2+2h4kOzy+Wh4iPr8/gCBwTaczjaXyjaYyjaXyTaYyfr8/QCMzQCMzACHxzao2jal2Dak1zag03iAgI/Ckn64fZrHmX+4fZLCianPopPCiarOoqbLlafLlbnXq7nWq6fLlMTcsoCIeJCQcIiIeKCYaJiQcO16ee16evGVlfGWlfahn/ahoPWhn/WhoPe1tP///////wAAAAAAACH5BAEAAD0ALAAAAAAQABAAAAaRwJ5wSCwaj8WYcslcDmObaDTGq1Zjzw4mk+FQIRcFTzaUeTRoj4zHaI+HL0lkLnnxFgsH7zWEWSoTFBMwVlUwQy6JMDCJjYwuQx8tk5MfOzk4OjcfkSssKCkqHzY0MzQ1nEIJJSYkJCcJAQCzAQlDDyIjISMiCQYEAgMGD0MNIMfHDQUHBc3EQgjR0tPSSNY9QQA7");
+}
+.annotationHTML.overlay {
+
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAYAAADEUlfTAAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJEAQvB2JVdrAAAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAAAD1JREFUCNdtjkESADAEAzemf69f66HMqGlOIhYiFRFRtSQBWAY7mzx+EDTL6sSgb1jTk7Q87rxyqe37fXsAa78gLyZnRgEAAAAASUVORK5CYII=");
+ background-position: right bottom;
+ position: relative;
+ top: -16px;
+}
+.annotationHTML.currentBracket {
+
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sLEBULCGQmEKAAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAnklEQVQ4y7VTsRHDIBATJg1HCUzAHEzFBExAzwZsRMkE9gifKhc72ODYibr/+xcnoQdugq0LAujEwmbn0UxQh4OxpjX1XgshwFqLnPM5PQTQGlprWpbl3RhJ/CSQUm7qPYLp7i8cEpRSoJT6ju0lIaVEQgiKMQ4lHHpQayVjzHWCn5jIOcc8z9dMBADvPZxz3SC1tzCI8vgWdvL+VzwB8JSj2GFTyxIAAAAASUVORK5CYII=");
+}
+.annotationHTML.matchingBracket {
+
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sLEBUMAsuyb3kAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAoklEQVQ4y61TsQ3EIAw80DcI0USKGIApWIsB2IGGKbJPugxBR3VfvfRRCOSTvw7LPuPzGXgI8f0gwAsFu5rXIYMdDiEOIdnKW5YFzjnEGH+bhwA/KKVwmibu0BhRnpEZY1BrHTaVT7fQJZjnGeu63tOAJFNKVEox53yqQZfAWstt27oidgm01ve3UEqBaBjnspG89wgh3LiFgZXHt3Dh23/FGxKViehm0X85AAAAAElFTkSuQmCC");
+}
+.annotationHTML.currentLine {
+
+ background-image: url("data:image/gif;base64,R0lGODlhEAAQAMQAALxe0bNWzbdZzrlb0KpPx61RybBTy6VLxadNxZGctIeUroyYsG92hHyMqIKRq2l9nmyAoHGDonaIpStXj6q80k1aXf///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABYALAAAAAAQABAAAAVCoCWOZGmeKDql5ppOMGXBk/zOoltSNO6XrlXwxIPNYiMGq8SoLC2MaNPygEQkDYdikUg6LQcEoWAICAaA5HPNLoUAADs=");
+}
+.annotationHTML.matchingSearch {
+
+ background-image: url("data:image/gif;base64,R0lGODlhEAAQANUAALClrLu1ubOpsKqdp6eapKufqMTAw7attLSrsrGnr62jq8C7v765vaebpb22vLmyuMbCxsnGycfEx8G+wcrIysTBxUltof//yf///v70jergpPvws+nWc/npqvrpqvrpq/raffffnvXVkfTVkvXUkd+9f+SiOemvV+uyXa2OX7mYZqeIXKuNX/ClO7KQYqiIXJ59Vp19VpFvTo9uTZBvTpNyUJNyUf///////wAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAADgALAAAAAAQABAAAAZ4QJxwSCwajS2aS1U6DlunzcagcuKgG4sn5HJiLZ2QiHbEbj6hEapVTKVYr3OItG5TIhVGLF0npigUEAsPAjV9Q24pEhMBCAoybEUmGRcrDgcAAzNGkxcYNzAJBQSbRJ0YqBc2DaVEHJ6pGTStRBqfGBcZILRWvThBADs=");
+}
+.annotationHTML.currentSearch {
+
+ background-image: url("data:image/gif;base64,R0lGODlhEAAQANUAALClrLu1ubOpsKqdp6eapKufqMTAw7attLSrsrGnr62jq8C7v765vaebpb22vLmyuMbCxsnGycfEx8G+wcrIysTBxUltof//yf///v70jergpPvws+nWc/npqvrpqvrpq/raffffnvXVkfTVkvXUkd+9f+SiOemvV+uyXa2OX7mYZqeIXKuNX/ClO7KQYqiIXJ59Vp19VpFvTo9uTZBvTpNyUJNyUf///////wAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAADgALAAAAAAQABAAAAZ4QJxwSCwajS2aS1U6DlunzcagcuKgG4sn5HJiLZ2QiHbEbj6hEapVTKVYr3OItG5TIhVGLF0npigUEAsPAjV9Q24pEhMBCAoybEUmGRcrDgcAAzNGkxcYNzAJBQSbRJ0YqBc2DaVEHJ6pGTStRBqfGBcZILRWvThBADs=");
+}
+.annotationOverview {
+ cursor: pointer;
+ border-radius: 2px;
+ left: 2px;
+ width: 8px;
+}
+.annotationOverview.task {
+ background-color: lightgreen;
+ border: 1px solid green;
+}
+.annotationOverview.breakpoint {
+ background-color: lightblue;
+ border: 1px solid blue;
+}
+.annotationOverview.bookmark {
+ background-color: yellow;
+ border: 1px solid orange;
+}
+.annotationOverview.error {
+ background-color: lightcoral;
+ border: 1px solid darkred;
+}
+.annotationOverview.warning {
+ background-color: Gold;
+ border: 1px solid black;
+}
+.annotationOverview.currentBracket {
+ background-color: lightgray;
+ border: 1px solid red;
+}
+.annotationOverview.matchingBracket {
+ background-color: lightgray;
+ border: 1px solid red;
+}
+.annotationOverview.currentLine {
+ background-color: #EAF2FE;
+ border: 1px solid black;
+}
+.annotationOverview.matchingSearch {
+ background-color: #C3E1FF;
+ border: 1px solid black;
+}
+.annotationOverview.currentSearch {
+ background-color: #53D1FF;
+ border: 1px solid black;
+}
+.annotationOverview.readOccurrence {
+ background-color: lightgray;
+ border: 1px solid black;
+}
+.annotationOverview.writeOccurrence {
+ background-color: Gold;
+ border: 1px solid darkred;
+}
+.annotationRange {
+ background-repeat: repeat-x;
+ background-position: left bottom;
+}
+.annotationRange.task {
+
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sLDhEoIrb7JmcAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAGUlEQVQI12NggIH/DGdhDCM45z/DfyiBAADgdQjGhI/4DAAAAABJRU5ErkJggg==");
+}
+.annotationRange.breakpoint {
+
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sLDhEqHTKradgAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAIklEQVQI11XJMQ0AMAzAMGMafwrFlD19+sUKIJTFo9k+B/kQ+Qr2bIVKOgAAAABJRU5ErkJggg==");
+}
+.annotationRange.bookmark {
+
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=");
+}
+.annotationRange.error {
+
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==");
+}
+.annotationRange.warning {
+
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=");
+}
+.annotationRange.currentBracket {
+}
+.annotationRange.matchingBracket {
+ outline: 1px solid red;
+}
+.annotationRange.matchingSearch {
+ background-color: #C3E1FF;
+}
+.annotationRange.currentSearch {
+ background-color: #53D1FF;
+}
+.annotationRange.readOccurrence {
+ background-color: lightgray;
+}
+.annotationRange.writeOccurrence {
+ background-color: yellow;
+}
+.annotationRange.linkedGroup {
+ outline: 1px solid grey;
+}
+.annotationRange.currentLinkedGroup {
+ background-color: #C3E1FF;
+}
+.annotationRange.selectedLinkedGroup {
+ background-color: #53D1FF;
+}
+.annotationLine {
+}
+.annotationLine.currentLine {
+ background-color: #EAF2FE;
+}
+.tooltip.textview {
+ background-color: InfoBackground !important;
+ color: InfoText !important;
+}
+.tooltip .textviewScroll {
+ padding: 0px;
+}
+.textviewTooltip {
+ font-family: monospace;
+ font-size: 10pt;
+ background-color: InfoBackground;
+ color: InfoText;
+ padding: 2px;
+ border-radius: 4px;
+ border: 1px solid black;
+ z-index: 100;
+ position: fixed;
+ overflow: hidden;
+ white-space: pre;
+}
+.textviewTooltip em {
+ font-style: normal;
+ font-weight: bold;
+}
+.tooltip .annotationLine.currentLine {
+ background-color: transparent;
+}
+.contentassist {
+ font-size:10pt;
+ font-family: "Consolas", "Monaco", "Vera Mono", "monospace";
+ display: none;
+ background-color: white;
+ position: fixed;
+ top: 100px;
+ left: 100px;
+ border: 1px solid #DDD;
+ z-index:100;
+ cursor: default;
+ overflow: auto;
+ min-width: 70px;
+ min-height: 50px;
+ max-width: 350px;
+ max-height: 150px;
+ white-space: nowrap;
+}
+.contentassist:focus {
+ border: 1px solid #666;
+}
+.contentassist .proposal-emphasis {
+ font-weight: normal;
+}
+.contentassist hr{
+ border: 0;
+ height: 0;
+ border-top: 1px solid rgba(0, 0, 0, 0.1);
+ border-bottom: 1px solid rgba(255, 255, 255, 0.3);
+}
+.contentassist .proposal-noemphasis {
+ background-color: aliceblue;
+ font-weight: lighter;
+ color: grey;
+}
+.contentassist .proposal-hr {
+
+ border: 0;
+ height: 0;
+ border-top: 1px solid rgba(0, 0, 0, 0.1);
+ border-bottom: 1px solid rgba(255, 255, 255, 0.3);
+}
+.contentassist .proposal-default {
+
+}
+.contentassist .selected {
+
+ font-weight:bold;
+ padding-bottom: 3px;
+ background-color: #FEC;
+ font-weight: bold;
+}
+.contentassist>div {
+ padding: 1px 3px 0 3px;
+}
+.contentassist>div:hover {
+ background-color: #EAF2FE;
+}
+.token_singleline_comment {
+ color: #3C802C;
+}
+.token_multiline_comment {
+ color: #3C802C;
+}
+.token_doc_comment {
+ color: #00008F;
+}
+a.token_singleline_comment, a.token_multiline_comment, a.token_doc_comment {
+ text-decoration: underline;
+}
+.token_doc_html_markup {
+ color: #7F7F9F;
+}
+.token_doc_tag {
+ color: #7F9FBF;
+}
+.token_task_tag {
+ color: #7F9FBF;
+}
+.token_string {
+ color: #446fbd;
+}
+.token_number {
+ color: blue;
+}
+.token_keyword {
+ color: #CC4C07;
+ font-weight: bold;
+}
+.token_space {
+
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAIAAABv85FHAAAABnRSTlMA/wAAAACkwsAdAAAAIUlEQVR4nGP4z8CAC+GUIEXuABhgkTuABEiRw2cmae4EAH05X7xDolNRAAAAAElFTkSuQmCC");
+ background-repeat: no-repeat;
+ background-position: center center;
+}
+.token_tab {
+
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAJCAIAAACJ2loDAAAABnRSTlMA/wD/AP83WBt9AAAAMklEQVR4nGP4TwRgoK6i52c3bz5w6zMSA6tJn28d2Lx589nnCAYu63AaSLxJRLoJPwAAeNk0aG4opfMAAAAASUVORK5CYII=");
+ background-repeat: no-repeat;
+ background-position: left center;
+}
+.line_caret {
+ background-color: #EAF2FE;
+}
+.comment {
+ color: #3C802C;
+}
+.comment-block-documentation {
+ color: #00008F;
+}
+.constant {
+ font-style: italic;
+ color: blue;
+}
+.constant-character-entity {
+ font-style: normal;
+}
+.entity {
+ color: #3f7f7f;
+}
+.entity-name-function, .entity-name-type {
+ font-weight: bold;
+}
+.invalid-illegal {
+ color: white;
+ background-color: red;
+}
+.invalid-deprecated {
+ text-decoration: line-through;
+}
+.invalid {
+ color: red;
+ font-weight: bold;
+}
+.keyword-control {
+ color: #7F0055;
+ font-weight: bold;
+}
+.keyword-operator {
+ color: #ddd;
+}
+.markup-heading {
+ font-weight: bold;
+}
+.markup-quote {
+ font-style: italic;
+}
+.meta-tag {
+ color: #3f7f7f;
+}
+.storage {
+ color: #7F0055;
+}
+.string {
+ color: blue;
+}
+.support {
+ color: #21439c;
+}
+.variable {
+ color: #0000c0;
+}
+.variable-parameter {
+ color: black;
+}
+.variable-language {
+ color: #7F0055;
+ font-weight: bold;
+}
+.entity-name-tag {
+ color: #CC4C07;
+}
+.entity-other-attribute-name {
+ color: #3C802C;
+}
+.punctuation-definition-comment {
+ color: #3f5fbf;
+}
+.punctuation-definition-string {
+ color: blue;
+}
+.string-quoted {
+ color: #2a00ff;
+}
+.cm-meta { color: #00008F; }
+.cm-keyword { font-weight: bold; color: #7F0055; }
+.cm-atom { color: #21439c; }
+.cm-number { color: black; }
+.cm-def { color: green; }
+.cm-variable { color: black; }
+.cm-variable-2 { color: #004080; }
+.cm-variable-3 { color: #004080; }
+.cm-property { color: black; }
+.cm-operator { color: #222; }
+.cm-comment { color: green; }
+.cm-string { color: blue; }
+.cm-error { color: #ff0000; }
+.cm-qualifier { color: gray; }
+.cm-builtin { color: #7F0055; }
+.cm-bracket { color: white; background-color: gray; }
+.cm-tag { color: #3f7f7f; }
+.cm-attribute { color: #7f007f; }
diff --git a/bundles/org.eclipse.e4.tools.orion.css.editor/web/built-editor.min.js b/bundles/org.eclipse.e4.tools.orion.css.editor/web/built-editor.min.js
new file mode 100644
index 00000000..983f953f
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.orion.css.editor/web/built-editor.min.js
@@ -0,0 +1,905 @@
+/*
+
+ 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) 2012 IBM Corporation and others.
+ All rights reserved. This program and the accompanying materials are made
+ available under the terms of the Eclipse Public License v1.0
+ (http://www.eclipse.org/legal/epl-v10.html), and 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, 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) 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:
+ 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:
+ 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: IBM Corporation - initial API and implementation
+
+ Copyright (c) 2010, 2012 IBM Corporation and others.
+ All rights reserved. This program and the accompanying materials are made
+ available under the terms of the Eclipse Public License v1.0
+ (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+ License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+
+ Contributors: IBM Corporation - initial API and implementation
+
+ Copyright (c) 2010, 2012 IBM Corporation and others.
+ All rights reserved. This program and the accompanying materials are made
+ available under the terms of the Eclipse Public License v1.0
+ (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+ License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+
+ Contributors:
+ Felipe Heidrich (IBM Corporation) - initial API and implementation
+ Silenio Quarti (IBM Corporation) - initial API and implementation
+
+ Copyright (c) 2009, 2012 IBM Corporation and others.
+ All rights reserved. This program and the accompanying materials are made
+ available under the terms of the Eclipse Public License v1.0
+ (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+ License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+
+ Contributors: IBM Corporation - initial API and implementation
+
+ Copyright (c) 2013 IBM Corporation and others.
+ All rights reserved. This program and the accompanying materials are made
+ available under the terms of the Eclipse Public License v1.0
+ (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+ License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+
+ Contributors: IBM Corporation - initial API and implementation
+
+ Copyright (c) 2013 IBM Corporation and others.
+ All rights reserved. This program and the accompanying materials are made
+ available under the terms of the Eclipse Public License v1.0
+ (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+ License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+
+ Contributors:
+ IBM Corporation - initial API and implementation
+
+ Copyright (c) 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) 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) 2012 IBM Corporation and others.
+ All rights reserved. This program and the accompanying materials are made
+ available under the terms of the Eclipse Public License v1.0
+ (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+ License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+
+ Contributors: IBM Corporation - initial API and implementation
+
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+ All rights reserved. This program and the accompanying materials are made
+ available under the terms of the Eclipse Public License v1.0
+ (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+ License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+
+ Contributors:
+ IBM Corporation - initial API and implementation
+
+ Copyright (c) 2010, 2012 IBM Corporation and others.
+ All rights reserved. This program and the accompanying materials are made
+ available under the terms of the Eclipse Public License v1.0
+ (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+ License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+
+ Contributors: IBM Corporation - initial API and implementation
+
+ Copyright (c) 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.
+ Copyright (c) 2012 VMware, Inc.
+ All rights reserved. This program and the accompanying materials are made
+ available under the terms of the Eclipse Public License v1.0
+ (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+ License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+
+ Contributors:
+ IBM Corporation - initial API and implementation
+ Andrew Eisenberg - rename to jsTemplateContentAssist.js
+
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+ All rights reserved. This program and the accompanying materials are made
+ available under the terms of the Eclipse Public License v1.0
+ (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+ License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+
+ Contributors: IBM Corporation - initial API and implementation
+
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+ All rights reserved. This program and the accompanying materials are made
+ available under the terms of the Eclipse Public License v1.0
+ (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+ License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+
+ Contributors:
+ IBM Corporation - initial API and implementation
+
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+ All rights reserved. This program and the accompanying materials are made
+ available under the terms of the Eclipse Public License v1.0
+ (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+ License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+
+ Contributors: IBM Corporation - initial API and implementation
+
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+ All rights reserved. This program and the accompanying materials are made
+ available under the terms of the Eclipse Public License v1.0
+ (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+ License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+
+ Contributors: IBM Corporation - initial API and implementation
+
+ Copyright (c) 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) 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
+ 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 IBM Corporation and others.
+ All rights reserved. This program and the accompanying materials are made
+ available under the terms of the Eclipse Public License v1.0
+ (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+ License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+
+ Contributors:
+ IBM Corporation - initial API and implementation
+*/
+var requirejs,require,define;
+(function(k){function p(a,g){var t,c,s,d,i,b,f,m,n,h=g&&g.split("/"),e=l.map,j=e&&e["*"]||{};if(a&&a.charAt(0)===".")if(g){h=h.slice(0,h.length-1);a=h.concat(a.split("/"));for(m=0;m<a.length;m+=1)if(t=a[m],t===".")a.splice(m,1),m-=1;else if(t==="..")if(m===1&&(a[2]===".."||a[0]===".."))break;else m>0&&(a.splice(m-1,2),m-=2);a=a.join("/")}else a.indexOf("./")===0&&(a=a.substring(2));if((h||j)&&e){t=a.split("/");for(m=t.length;m>0;m-=1){c=t.slice(0,m).join("/");if(h)for(n=h.length;n>0;n-=1)if(s=e[h.slice(0,
+n).join("/")])if(s=s[c]){d=s;i=m;break}if(d)break;!b&&j&&j[c]&&(b=j[c],f=m)}!d&&b&&(d=b,i=f);d&&(t.splice(0,i,d),a=t.join("/"))}return a}function o(c,g){return function(){return a.apply(k,v.call(arguments,0).concat([c,g]))}}function e(a){return function(g){return p(g,a)}}function b(a){return function(g){m[a]=g}}function d(a){if(q.call(n,a)){var g=n[a];delete n[a];r[a]=!0;f.apply(k,g)}if(!q.call(m,a)&&!q.call(r,a))throw Error("No "+a);return m[a]}function h(a){var g,t=a?a.indexOf("!"):-1;t>-1&&(g=
+a.substring(0,t),a=a.substring(t+1,a.length));return[g,a]}function j(a){return function(){return l&&l.config&&l.config[a]||{}}}var f,a,c,i,m={},n={},l={},r={},q=Object.prototype.hasOwnProperty,v=[].slice;c=function(a,g){var t,c=h(a),s=c[0],a=c[1];s&&(s=p(s,g),t=d(s));s?a=t&&t.normalize?t.normalize(a,e(g)):p(a,g):(a=p(a,g),c=h(a),s=c[0],a=c[1],s&&(t=d(s)));return{f:s?s+"!"+a:a,n:a,pr:s,p:t}};i={require:function(a){return o(a)},exports:function(a){var g=m[a];return typeof g!=="undefined"?g:m[a]={}},
+module:function(a){return{id:a,uri:"",exports:m[a],config:j(a)}}};f=function(a,g,t,x){var s,f,h,l,e=[],j,x=x||a;if(typeof t==="function"){g=!g.length&&t.length?["require","exports","module"]:g;for(l=0;l<g.length;l+=1)if(h=c(g[l],x),f=h.f,f==="require")e[l]=i.require(a);else if(f==="exports")e[l]=i.exports(a),j=!0;else if(f==="module")s=e[l]=i.module(a);else if(q.call(m,f)||q.call(n,f)||q.call(r,f))e[l]=d(f);else if(h.p)h.p.load(h.n,o(x,!0),b(f),{}),e[l]=m[f];else throw Error(a+" missing "+f);g=t.apply(m[a],
+e);if(a)if(s&&s.exports!==k&&s.exports!==m[a])m[a]=s.exports;else if(g!==k||!j)m[a]=g}else a&&(m[a]=t)};requirejs=require=a=function(b,g,t,x,s){if(typeof b==="string")return i[b]?i[b](g):d(c(b,g).f);else b.splice||(l=b,g.splice?(b=g,g=t,t=null):b=k);g=g||function(){};typeof t==="function"&&(t=x,x=s);x?f(k,b,g,t):setTimeout(function(){f(k,b,g,t)},4);return a};a.config=function(c){l=c;return a};define=function(a,g,t){g.splice||(t=g,g=[]);!q.call(m,a)&&!q.call(n,a)&&(n[a]=[a,g,t])};define.amd={jQuery:!0}})();
+define("almond",function(){});
+(function(){function k(b,d,h,e,f,a){d[b]&&(h.push(b),(d[b]===!0||d[b]===1)&&e.push(f+b+"/"+a))}function p(b,d,h,e,f){d=e+d+"/"+f;require._fileExists(b.toUrl(d+".js"))&&h.push(d)}function o(b,d,h){for(var e in d)d.hasOwnProperty(e)&&(!b.hasOwnProperty(e)||h)?b[e]=d[e]:typeof d[e]==="object"&&o(b[e],d[e],h)}var e=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(b){var d=b.config?b.config():{};return{version:"2.0.1+",load:function(b,j,f,a){a=a||{};if(a.locale)d.locale=a.locale;
+var c=e.exec(b),i=c[1],m=c[4],n=c[5],l=m.split("-"),r=[],q={},v,u="";if(c[5])i=c[1],b=i+n;else{n=c[4];m=d.locale;if(!m)m=d.locale=typeof navigator==="undefined"?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase();l=m.split("-")}if(a.isBuild){r.push(b);p(j,"root",r,i,n);for(v=0;v<l.length;v++)a=l[v],u+=(u?"-":"")+a,p(j,u,r,i,n);j(r,function(){f()})}else j([b],function(g){var a=[],c;k("root",g,a,r,i,n);for(v=0;v<l.length;v++)c=l[v],u+=(u?"-":"")+c,k(u,g,a,r,i,n);j(r,function(){var c,
+d,x;for(c=a.length-1;c>-1&&a[c];c--){x=a[c];d=g[x];if(d===!0||d===1)d=j(i+x+"/"+n);o(q,d)}f(q)})})}}})})();define("orion/editor/i18n",{load:function(k,p,o){p.specified&&p.specified("orion/bootstrap")?p(["orion/i18n!"+k],function(e){o(e)}):o({})}});
+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",toggleWrapMode:"Toggle Wrap Mode",toggleTabMode:"Toggle Tab Mode",toggleOverwriteMode:"Toggle Overwrite Mode",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",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}",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(k,p){var o={root:p},e;for(e in k)k.hasOwnProperty(e)&&typeof o[e]==="undefined"&&(o[e]=k[e]);return o});
+define("orion/editor/eventTarget",[],function(){function k(){}k.addMixin=function(p){var o=k.prototype,e;for(e in o)o.hasOwnProperty(e)&&(p[e]=o[e])};k.prototype={addEventListener:function(k,o,e){if(!this._eventTypes)this._eventTypes={};var b=this._eventTypes[k];b||(b=this._eventTypes[k]={level:0,listeners:[]});b.listeners.push({listener:o,useCapture:e})},dispatchEvent:function(k){var o=k.type;this._dispatchEvent("pre"+o,k);this._dispatchEvent(o,k);this._dispatchEvent("post"+o,k)},_dispatchEvent:function(k,
+o){var e=this._eventTypes?this._eventTypes[k]:null;if(e){var b=e.listeners;try{if(e.level++,b)for(var d=0,h=b.length;d<h;d++)if(b[d]){var j=b[d].listener;typeof j==="function"?j.call(this,o):j.handleEvent&&typeof j.handleEvent==="function"&&j.handleEvent(o)}}finally{if(e.level--,e.compact&&e.level===0){for(d=b.length-1;d>=0;d--)b[d]||b.splice(d,1);b.length===0&&delete this._eventTypes[k];e.compact=!1}}}},isListening:function(k){return!this._eventTypes?!1:this._eventTypes[k]!==void 0},removeEventListener:function(k,
+o,e){if(this._eventTypes){var b=this._eventTypes[k];if(b){for(var d=b.listeners,h=0,j=d.length;h<j;h++){var f=d[h];if(f&&f.listener===o&&f.useCapture===e){b.level!==0?(d[h]=null,b.compact=!0):d.splice(h,1);break}}d.length===0&&delete this._eventTypes[k]}}}};return{EventTarget:k}});
+define("orion/util",[],function(){var k=navigator.userAgent,p=parseFloat(k.split("MSIE")[1])||void 0,o=parseFloat(k.split("Firefox/")[1]||k.split("Minefield/")[1])||void 0,e=k.indexOf("Opera")!==-1,b=parseFloat(k.split("Chrome/")[1])||void 0,d=k.indexOf("Safari")!==-1&&!b,h=parseFloat(k.split("WebKit/")[1])||void 0,j=k.indexOf("Android")!==-1,f=k.indexOf("iPad")!==-1,k=k.indexOf("iPhone")!==-1,a=f||k,c=navigator.platform.indexOf("Mac")!==-1,i=navigator.platform.indexOf("Win")!==-1,m=navigator.platform.indexOf("Linux")!==
+-1;return{formatMessage:function(a){var c=arguments;return a.replace(/\$\{([^\}]+)\}/g,function(a,d){return c[(d<<0)+1]})},createElement:function(a,c){return a.createElementNS?a.createElementNS("http://www.w3.org/1999/xhtml",c):a.createElement(c)},isIE:p,isFirefox:o,isOpera:e,isChrome:b,isSafari:d,isWebkit:h,isAndroid:j,isIPad:f,isIPhone:k,isIOS:a,isMac:c,isWindows:i,isLinux:m,platformDelimiter:i?"\r\n":"\n"}});
+define("orion/editor/textModel",["orion/editor/eventTarget","orion/util"],function(k,p){function o(e,b){this._lastLineIndex=-1;this._text=[""];this._lineOffsets=[0];this.setText(e);this.setLineDelimiter(b)}o.prototype={find:function(e){if(this._text.length>1)this._text=[this._text.join("")];var b=e.string,d=b,h=e.caseInsensitive;!e.regex&&b&&(d=b.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$&"),h&&(d=d.replace(/[iI\u0130\u0131]/g,"[Ii\u0130\u0131]")));var j=null,f;if(d){var b=e.reverse,a=e.wrap,c=e.wholeWord,
+i=e.start||0,e=e.end,m=e!==null&&e!==void 0,n="";n.indexOf("g")===-1&&(n+="g");h&&n.indexOf("i")===-1&&(n+="i");c&&(d="\\b"+d+"\\b");var l=this._text[0],r,q,k=0;m&&(h=i<e?i:e,l=l.substring(h,i<e?e:i),k=h);var o=RegExp(d,n);if(b)f=function(){var g=null;for(o.lastIndex=0;;){q=o.lastIndex;r=o.exec(l);if(q===o.lastIndex)return null;if(r){if(!(r.index+k<i)){if(!a||g)break;i=l.length+k}g={start:r.index+k,end:o.lastIndex+k}}else break}if(g)i=g.start;return g};else{if(!m)o.lastIndex=i;f=function(){for(;;){q=
+o.lastIndex;r=o.exec(l);if(q===o.lastIndex)break;if(r)return{start:r.index+k,end:o.lastIndex+k};if(!(q!==0&&a))break}return null}}j=f()}return{next:function(){var g=j;g&&(j=f());return g},hasNext:function(){return j!==null}}},getCharCount:function(){for(var e=0,b=0;b<this._text.length;b++)e+=this._text[b].length;return e},getLine:function(e,b){var d=this.getLineCount();if(!(0<=e&&e<d))return null;var h=this._lineOffsets[e];if(e+1<d){d=this.getText(h,this._lineOffsets[e+1]);if(b)return d;for(var h=
+d.length,j;(j=d.charCodeAt(h-1))===10||j===13;)h--;return d.substring(0,h)}else return this.getText(h)},getLineAtOffset:function(e){var b=this.getCharCount();if(!(0<=e&&e<=b))return-1;var d=this.getLineCount();if(e===b)return d-1;var h,j,f=this._lastLineIndex;if(0<=f&&f<d&&(h=this._lineOffsets[f],j=f+1<d?this._lineOffsets[f+1]:b,h<=e&&e<j))return f;for(var a=d,c=-1;a-c>1;)if(f=Math.floor((a+c)/2),h=this._lineOffsets[f],j=f+1<d?this._lineOffsets[f+1]:b,e<=h)a=f;else if(e<j){a=f;break}else c=f;return this._lastLineIndex=
+a},getLineCount:function(){return this._lineOffsets.length},getLineDelimiter:function(){return this._lineDelimiter},getLineEnd:function(e,b){var d=this.getLineCount();if(!(0<=e&&e<d))return-1;if(e+1<d){d=this._lineOffsets[e+1];if(b)return d;for(var h=this.getText(Math.max(this._lineOffsets[e],d-2),d),j=h.length,f;(f=h.charCodeAt(j-1))===10||f===13;)j--;return d-(h.length-j)}else return this.getCharCount()},getLineStart:function(e){return!(0<=e&&e<this.getLineCount())?-1:this._lineOffsets[e]},getText:function(e,
+b){e===void 0&&(e=0);b===void 0&&(b=this.getCharCount());if(e===b)return"";for(var d=0,h=0,j;h<this._text.length;){j=this._text[h].length;if(e<=d+j)break;d+=j;h++}for(var f=d,a=h;h<this._text.length;){j=this._text[h].length;if(b<=d+j)break;d+=j;h++}if(a===h)return this._text[a].substring(e-f,b-d);f=this._text[a].substring(e-f);d=this._text[h].substring(0,b-d);return f+this._text.slice(a+1,h).join("")+d},onChanging:function(e){return this.dispatchEvent(e)},onChanged:function(e){return this.dispatchEvent(e)},
+setLineDelimiter:function(e,b){e==="auto"&&(e=void 0,this.getLineCount()>1&&(e=this.getText(this.getLineEnd(0),this.getLineEnd(0,!0))));this._lineDelimiter=e?e:p.platformDelimiter;if(b){var d=this.getLineCount();if(d>1){for(var h=Array(d),j=0;j<d;j++)h[j]=this.getLine(j);this.setText(h.join(this._lineDelimiter))}}},setText:function(e,b,d){e===void 0&&(e="");b===void 0&&(b=0);d===void 0&&(d=this.getCharCount());if(!(b===d&&e==="")){for(var h=this.getLineAtOffset(b),j=this.getLineAtOffset(d),f=b,a=
+d-b,c=j-h,i=e.length,m=0,n=this.getLineCount(),l=0,r=0,q=0,k=[];;){l!==-1&&l<=q&&(l=e.indexOf("\r",q));r!==-1&&r<=q&&(r=e.indexOf("\n",q));if(r===-1&&l===-1)break;q=l!==-1&&r!==-1?l+1===r?r+1:(l<r?l:r)+1:l!==-1?l+1:r+1;k.push(b+q);m++}this.onChanging({type:"Changing",text:e,start:f,removedCharCount:a,addedCharCount:i,removedLineCount:c,addedLineCount:m});k.length===0&&(q=this.getLineStart(h),j=j+1<n?this.getLineStart(j+1):this.getCharCount(),b!==q&&(e=this.getText(q,b)+e,b=q),d!==j&&(e+=this.getText(d,
+j),d=j));q=i-a;for(j=h+c+1;j<n;j++)this._lineOffsets[j]+=q;if(k.length<5E4)h=[h+1,c].concat(k),Array.prototype.splice.apply(this._lineOffsets,h);else{q=h+1;this._lineOffsets.splice(q,c);for(n=0;n<k.length;n+=5E4)h=[q,0].concat(k.slice(n,Math.min(k.length,n+5E4))),Array.prototype.splice.apply(this._lineOffsets,h),q+=5E4}for(q=n=0;q<this._text.length;){j=this._text[q].length;if(b<=n+j)break;n+=j;q++}h=n;for(k=q;q<this._text.length;){j=this._text[q].length;if(d<=n+j)break;n+=j;q++}j=this._text[q];b=
+this._text[k].substring(0,b-h);d=j.substring(d-n);k=[k,q-k+1];b&&k.push(b);e&&k.push(e);d&&k.push(d);Array.prototype.splice.apply(this._text,k);if(this._text.length===0)this._text=[""];this.onChanged({type:"Changed",start:f,removedCharCount:a,addedCharCount:i,removedLineCount:c,addedLineCount:m})}}};k.EventTarget.addMixin(o.prototype);return{TextModel:o}});
+define("orion/keyBinding",["orion/util"],function(k){function p(e,b,d,h,j,f){this.type=f||"keydown";this.keyCode=typeof e==="string"&&this.type==="keydown"?e.toUpperCase().charCodeAt(0):e;this.mod1=b!==void 0&&b!==null?b:!1;this.mod2=d!==void 0&&d!==null?d:!1;this.mod3=h!==void 0&&h!==null?h:!1;this.mod4=j!==void 0&&j!==null?j:!1}function o(e){this.keys=e}p.prototype={getKeys:function(){return[this]},match:function(e,b){if(b!==void 0){if(b!==0)return!1}else if(e instanceof Array){if(e.length>1)return!1;
+e=e[0]}return e.type!==this.type?!1:this.keyCode===e.keyCode||this.keyCode===String.fromCharCode(k.isOpera?e.which:e.charCode!==void 0?e.charCode:e.keyCode)?this.mod1!==(k.isMac?e.metaKey:e.ctrlKey)?!1:this.type==="keydown"&&this.mod2!==e.shiftKey?!1:this.mod3!==e.altKey?!1:k.isMac&&this.mod4!==e.ctrlKey?!1:!0:!1},equals:function(e){return!e?!1:this.keyCode!==e.keyCode?!1:this.mod1!==e.mod1?!1:this.mod2!==e.mod2?!1:this.mod3!==e.mod3?!1:this.mod4!==e.mod4?!1:this.type!==e.type?!1:!0}};o.prototype=
+{getKeys:function(){return this.keys.slice(0)},match:function(e,b){var d=this.keys;if(b!==void 0)return b>d.length?!1:d[b].match(e)?b===d.length-1?!0:b+1:!1;else{e instanceof Array||(e=[e]);if(e.length>d.length)return!1;var h;for(h=0;h<e.length;h++)if(!d[h].match(e[h]))return!1;return h===d.length?!0:h}},equals:function(e){if(!e.keys)return!1;if(e.keys.length!==this.keys.length)return!1;for(var b=0;b<e.keys.length;b++)if(!e.keys[b].equals(this.keys[b]))return!1;return!0}};return{KeyBinding:p,KeyStroke:p,
+KeySequence:o}});
+define("orion/editor/keyModes",["orion/keyBinding","orion/util"],function(k,p){function o(b){this._view=b;this._keyBindings=this.createKeyBindings();this._keyBindingIndex=0}function e(){o.call(this)}o.prototype={createKeyBindings:function(){return[]},getKeyBindings:function(b){for(var d=[],h=this._keyBindings,e=0;e<h.length;e++)h[e].actionID===b&&d.push(h[e].keyBinding);return d},getView:function(){return this._view},isActive:function(){return!0},match:function(b){switch(b.keyCode){case 16:case 17:case 18:case 91:return}for(var d=this._keyBindingIndex,
+h=this._matchingKeyBindings||this._keyBindings,e=[],f=0;f<h.length;f++){var a=h[f],c=a.keyBinding.match(b,d);if(c===!0)return this._keyBindingIndex=0,this._matchingKeyBindings=null,a.actionID;else typeof c==="number"&&e.push(a)}if(e.length===0)this._keyBindingIndex=0,this._matchingKeyBindings=null;else return this._keyBindingIndex++,this._matchingKeyBindings=e,"noop"},setKeyBinding:function(b,d){for(var h=this._keyBindings,e=0;e<h.length;e++){var f=h[e];if(f.keyBinding.equals(b)){d?f.actionID=d:f.predefined?
+f.actionID="noop":h.splice(e,1);return}}d&&h.push({keyBinding:b,actionID:d})},setView:function(b){this._view=b}};e.prototype=new o;e.prototype.createKeyBindings=function(){var b=k.KeyBinding,d=[];d.push({actionID:"lineUp",keyBinding:new b(38),predefined:!0});d.push({actionID:"lineDown",keyBinding:new b(40),predefined:!0});d.push({actionID:"charPrevious",keyBinding:new b(37),predefined:!0});d.push({actionID:"charNext",keyBinding:new b(39),predefined:!0});p.isMac?(d.push({actionID:"scrollPageUp",keyBinding:new b(33),
+predefined:!0}),d.push({actionID:"scrollPageDown",keyBinding:new b(34),predefined:!0}),d.push({actionID:"pageUp",keyBinding:new b(33,null,null,!0),predefined:!0}),d.push({actionID:"pageDown",keyBinding:new b(34,null,null,!0),predefined:!0}),d.push({actionID:"lineStart",keyBinding:new b(37,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new b(39,!0),predefined:!0}),d.push({actionID:"wordPrevious",keyBinding:new b(37,null,null,!0),predefined:!0}),d.push({actionID:"wordNext",keyBinding:new b(39,
+null,null,!0),predefined:!0}),d.push({actionID:"scrollTextStart",keyBinding:new b(36),predefined:!0}),d.push({actionID:"scrollTextEnd",keyBinding:new b(35),predefined:!0}),d.push({actionID:"textStart",keyBinding:new b(38,!0),predefined:!0}),d.push({actionID:"textEnd",keyBinding:new b(40,!0),predefined:!0}),d.push({actionID:"scrollPageUp",keyBinding:new b(38,null,null,null,!0),predefined:!0}),d.push({actionID:"scrollPageDown",keyBinding:new b(40,null,null,null,!0),predefined:!0}),d.push({actionID:"lineStart",
+keyBinding:new b(37,null,null,null,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new b(39,null,null,null,!0),predefined:!0}),d.push({actionID:"lineStart",keyBinding:new b(38,null,null,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new b(40,null,null,!0),predefined:!0})):(d.push({actionID:"pageUp",keyBinding:new b(33),predefined:!0}),d.push({actionID:"pageDown",keyBinding:new b(34),predefined:!0}),d.push({actionID:"lineStart",keyBinding:new b(36),predefined:!0}),d.push({actionID:"lineEnd",
+keyBinding:new b(35),predefined:!0}),d.push({actionID:"wordPrevious",keyBinding:new b(37,!0),predefined:!0}),d.push({actionID:"wordNext",keyBinding:new b(39,!0),predefined:!0}),d.push({actionID:"textStart",keyBinding:new b(36,!0),predefined:!0}),d.push({actionID:"textEnd",keyBinding:new b(35,!0),predefined:!0}));p.isFirefox&&p.isLinux&&(d.push({actionID:"lineUp",keyBinding:new b(38,!0),predefined:!0}),d.push({actionID:"lineDown",keyBinding:new b(40,!0),predefined:!0}));p.isWindows&&(d.push({actionID:"scrollLineUp",
+keyBinding:new b(38,!0),predefined:!0}),d.push({actionID:"scrollLineDown",keyBinding:new b(40,!0),predefined:!0}));d.push({actionID:"selectLineUp",keyBinding:new b(38,null,!0),predefined:!0});d.push({actionID:"selectLineDown",keyBinding:new b(40,null,!0),predefined:!0});d.push({actionID:"selectCharPrevious",keyBinding:new b(37,null,!0),predefined:!0});d.push({actionID:"selectCharNext",keyBinding:new b(39,null,!0),predefined:!0});d.push({actionID:"selectPageUp",keyBinding:new b(33,null,!0),predefined:!0});
+d.push({actionID:"selectPageDown",keyBinding:new b(34,null,!0),predefined:!0});p.isMac?(d.push({actionID:"selectLineStart",keyBinding:new b(37,!0,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new b(39,!0,!0),predefined:!0}),d.push({actionID:"selectWordPrevious",keyBinding:new b(37,null,!0,!0),predefined:!0}),d.push({actionID:"selectWordNext",keyBinding:new b(39,null,!0,!0),predefined:!0}),d.push({actionID:"selectTextStart",keyBinding:new b(36,null,!0),predefined:!0}),d.push({actionID:"selectTextEnd",
+keyBinding:new b(35,null,!0),predefined:!0}),d.push({actionID:"selectTextStart",keyBinding:new b(38,!0,!0),predefined:!0}),d.push({actionID:"selectTextEnd",keyBinding:new b(40,!0,!0),predefined:!0}),d.push({actionID:"selectLineStart",keyBinding:new b(37,null,!0,null,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new b(39,null,!0,null,!0),predefined:!0}),d.push({actionID:"selectLineStart",keyBinding:new b(38,null,!0,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new b(40,
+null,!0,!0),predefined:!0})):(p.isLinux&&(d.push({actionID:"selectWholeLineUp",keyBinding:new b(38,!0,!0),predefined:!0}),d.push({actionID:"selectWholeLineDown",keyBinding:new b(40,!0,!0),predefined:!0})),d.push({actionID:"selectLineStart",keyBinding:new b(36,null,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new b(35,null,!0),predefined:!0}),d.push({actionID:"selectWordPrevious",keyBinding:new b(37,!0,!0),predefined:!0}),d.push({actionID:"selectWordNext",keyBinding:new b(39,!0,
+!0),predefined:!0}),d.push({actionID:"selectTextStart",keyBinding:new b(36,!0,!0),predefined:!0}),d.push({actionID:"selectTextEnd",keyBinding:new b(35,!0,!0),predefined:!0}));d.push({actionID:"undo",keyBinding:new k.KeyBinding("z",!0),predefined:!0});p.isMac?d.push({actionID:"redo",keyBinding:new k.KeyBinding("z",!0,!0),predefined:!0}):d.push({actionID:"redo",keyBinding:new k.KeyBinding("y",!0),predefined:!0});d.push({actionID:"deletePrevious",keyBinding:new b(8),predefined:!0});d.push({actionID:"deletePrevious",
+keyBinding:new b(8,null,!0),predefined:!0});d.push({actionID:"deleteNext",keyBinding:new b(46),predefined:!0});d.push({actionID:"deleteWordPrevious",keyBinding:new b(8,!0),predefined:!0});d.push({actionID:"deleteWordPrevious",keyBinding:new b(8,!0,!0),predefined:!0});d.push({actionID:"deleteWordNext",keyBinding:new b(46,!0),predefined:!0});d.push({actionID:"tab",keyBinding:new b(9),predefined:!0});d.push({actionID:"shiftTab",keyBinding:new b(9,null,!0),predefined:!0});d.push({actionID:"enter",keyBinding:new b(13),
+predefined:!0});d.push({actionID:"enter",keyBinding:new b(13,null,!0),predefined:!0});d.push({actionID:"selectAll",keyBinding:new b("a",!0),predefined:!0});d.push({actionID:"toggleTabMode",keyBinding:new b("m",!0),predefined:!0});p.isMac&&(d.push({actionID:"deleteNext",keyBinding:new b(46,null,!0),predefined:!0}),d.push({actionID:"deleteWordPrevious",keyBinding:new b(8,null,null,!0),predefined:!0}),d.push({actionID:"deleteWordNext",keyBinding:new b(46,null,null,!0),predefined:!0}));d.push({actionID:"toggleWrapMode",
+keyBinding:new k.KeyBinding("w",!0,!1,!0)});d.push({actionID:"toggleOverwriteMode",keyBinding:new k.KeyBinding(45)});if(!p.isFirefox){var h=p.isMac&&p.isChrome;d.push({actionID:"noop",keyBinding:new b("u",!h,!1,!1,h),predefined:!0});d.push({actionID:"noop",keyBinding:new b("i",!h,!1,!1,h),predefined:!0});d.push({actionID:"noop",keyBinding:new b("b",!h,!1,!1,h),predefined:!0})}p.isFirefox&&(d.push({actionID:"copy",keyBinding:new b(45,!0),predefined:!0}),d.push({actionID:"paste",keyBinding:new b(45,
+null,!0),predefined:!0}),d.push({actionID:"cut",keyBinding:new b(46,null,!0),predefined:!0}));p.isMac&&(d.push({actionID:"lineStart",keyBinding:new b("a",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new b("e",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"lineUp",keyBinding:new b("p",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"lineDown",keyBinding:new b("n",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"charPrevious",keyBinding:new b("b",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"charNext",
+keyBinding:new b("f",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deletePrevious",keyBinding:new b("h",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deleteNext",keyBinding:new b("d",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deleteLineEnd",keyBinding:new b("k",!1,!1,!1,!0),predefined:!0}),p.isFirefox?(d.push({actionID:"scrollPageDown",keyBinding:new b("v",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deleteLineStart",keyBinding:new b("u",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deleteWordPrevious",
+keyBinding:new b("w",!1,!1,!1,!0),predefined:!0})):(d.push({actionID:"pageDown",keyBinding:new b("v",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"centerLine",keyBinding:new b("l",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"enterNoCursor",keyBinding:new b("o",!1,!1,!1,!0),predefined:!0})));return d};return{KeyMode:o,DefaultKeyMode:e}});
+define("orion/editor/textTheme",["require","orion/editor/eventTarget","orion/util"],function(k,p,o){function e(d){d=d||{};this._document=d.document||document}var b={};e.getTheme=function(d){var d=d||"default",h=b[d];h||(h=b[d]=new e);return h};e.prototype={getThemeClass:function(){return this._themeClass},setThemeClass:function(d,b){var e=this,f=e._themeClass;e._themeClass=d;this._load(d,b,function(){e.onThemeChanged({type:"ThemeChanged",oldValue:f,newValue:e.getThemeClass()})})},onThemeChanged:function(d){return this.dispatchEvent(d)},
+buildStyleSheet:function(d,b){function e(a,c,b){c&&(f.push("."+d+" ."+a+" {"),f.push("\t"+(b?"background-color":"color")+": "+c+";"),f.push("}"))}var f=[];f.push("");f.push("."+d+" {");b.fontFamily&&f.push("\tfont-family: "+b.fontFamily+";");b.fontSize&&f.push("\tfont-size: "+b.fontSize+";");b.fontSize&&f.push("\tcolor: "+b.text+";");f.push("}");f.push("."+d+".textview {");b.background&&f.push("\tbackground-color: "+b.background+";");f.push("}");e("ruler.annotations",b.annotationRuler,!0);e("ruler.lines",
+b.annotationRuler,!0);e("ruler.folding",b.annotationRuler,!0);e("ruler.overview",b.overviewRuler,!0);e("rulerLines",b.lineNumber,!1);e("rulerLines.even",b.lineNumberEven,!1);e("rulerLines.odd",b.lineNumberOdd,!1);e("annotationLine.currentLine",b.currentLine,!0);e("entity-name-tag",b.keyword,!1);e("entity-other-attribute-name",b.attribute,!1);e("string-quoted",b.string,!1);e("line_caret",b.currentLine,!0);e("token_keyword",b.keyword,!1);e("token_string",b.string,!1);e("token_singleline_comment",b.comment,
+!1);e("token_multiline_comment",b.comment,!1);e("token_doc_comment",b.comment,!1);e("token_doc_html_markup",b.comment,!1);return f.join("\n")},_createStyle:function(d,b,e,f){var a=this._document,d="orion-theme-"+d,c=a.getElementById(d);if(c){if(f||c.firstChild.data===b)return;c.removeChild(c.firstChild);c.appendChild(a.createTextNode(b))}else f?(c=o.createElement(a,"link"),c.rel="stylesheet",c.type="text/css",c.href=b,c.addEventListener("load",function(){e()})):(c=o.createElement(a,"style"),c.appendChild(a.createTextNode(b))),
+c.id=d,(a.getElementsByTagName("head")[0]||a.documentElement).appendChild(c);f||e()},_load:function(d,b,e){if(d)if(typeof b==="string")this._createStyle(d,b,e);else if(b=b.href,b.substring(b.length-4)!==".css"&&(b+=".css"),/^\//.test(b)||/[a-zA-Z0-9]+:\/\//i.test(b)||!k.toUrl)this._createStyle(d,b,e,!0);else{var f=this;k(["text!"+b],function(a){f._createStyle(d,a,e,!1)})}else e()}};p.EventTarget.addMixin(e.prototype);return{TextTheme:e}});
+define("orion/editor/textView","i18n!orion/editor/nls/messages,orion/editor/textModel,orion/editor/keyModes,orion/editor/eventTarget,orion/editor/textTheme,orion/util".split(","),function(k,p,o,e,b,d){function h(g,a,c,s){typeof g.addEventListener==="function"?g.addEventListener(a,c,s===!0):g.attachEvent("on"+a,c)}function j(g,a,c){if(c){a.className="";for(var c=a.attributes,s=c.length;s-- >0;)(!d.isIE||d.isIE>=9||d.isIE<9&&c[s].specified)&&a.removeAttribute(c[s].name)}if(g){if(g.styleClass)a.className=
+g.styleClass;if(c=g.style)for(var b in c)c.hasOwnProperty(b)&&(a.style[b]=c[b]);if(g=g.attributes)for(var i in g)g.hasOwnProperty(i)&&a.setAttribute(i,g[i])}}function f(g){return g instanceof Array?g.slice(0):g}function a(g,a){if(!g)return a;if(!a)return g;for(var c in a)a.hasOwnProperty(c)&&(g.hasOwnProperty(c)||(g[c]=a[c]));return g}function c(g,a){if(g===a)return!0;if(g&&!a||!g&&a)return!1;if(g&&g.constructor===String||a&&a.constructor===String)return!1;if(g instanceof Array||a instanceof Array){if(!(g instanceof
+Array&&a instanceof Array))return!1;if(g.length!==a.length)return!1;for(var d=0;d<g.length;d++)if(!c(g[d],a[d]))return!1;return!0}if(!(g instanceof Object)||!(a instanceof Object))return!1;for(d in g)if(g.hasOwnProperty(d)){if(!a.hasOwnProperty(d))return!1;if(!c(g[d],a[d]))return!1}for(d in a)if(!g.hasOwnProperty(d))return!1;return!0}function i(g,a,c){for(var s=0,d=0,b=0,i=g.length;b<i;){s!==-1&&s<=b&&(s=g.indexOf("\r",b));d!==-1&&d<=b&&(d=g.indexOf("\n",b));var f=b,m;if(d===-1&&s===-1){a(g.substring(b));
+break}s!==-1&&d!==-1?s+1===d?(m=s,b=d+1):(m=s<d?s:d,b=(s<d?s:d)+1):s!==-1?(m=s,b=s+1):(m=d,b=d+1);a(g.substring(f,m));c()}}function m(g){var a,c,s,d,b=g.ownerDocument.defaultView||g.ownerDocument.parentWindow;if(b.getComputedStyle)g=b.getComputedStyle(g,null),a=g.getPropertyValue("padding-left"),c=g.getPropertyValue("padding-top"),s=g.getPropertyValue("padding-right"),d=g.getPropertyValue("padding-bottom");else if(g.currentStyle)a=g.currentStyle.paddingLeft,c=g.currentStyle.paddingTop,s=g.currentStyle.paddingRight,
+d=g.currentStyle.paddingBottom;return{left:parseInt(a,10)||0,top:parseInt(c,10)||0,right:parseInt(s,10)||0,bottom:parseInt(d,10)||0}}function n(g){var a,c,s,d,b=g._trim;if(!b){var b=m(g),i=g.ownerDocument.defaultView||g.ownerDocument.parentWindow;if(i.getComputedStyle)d=i.getComputedStyle(g,null),a=d.getPropertyValue("border-left-width"),c=d.getPropertyValue("border-top-width"),s=d.getPropertyValue("border-right-width"),d=d.getPropertyValue("border-bottom-width");else if(g.currentStyle)a=g.currentStyle.borderLeftWidth,
+c=g.currentStyle.borderTopWidth,s=g.currentStyle.borderRightWidth,d=g.currentStyle.borderBottomWidth;a=parseInt(a,10)||0;c=parseInt(c,10)||0;s=parseInt(s,10)||0;d=parseInt(d,10)||0;b.left+=a;b.top+=c;b.right+=s;b.bottom+=d;g._trim=b}return b}function l(g,a,c){this.start=g;this.end=a;this.caret=c}function r(g){this.left=g.left;this.top=g.top;this.right=g.right;this.bottom=g.bottom}function q(g,a,c){this.view=g;this.lineIndex=a;this._lineDiv=c}function v(g){this._init(g||{})}var u=function(){function g(g){this.options=
+g}g.prototype.play=function(){var g=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],b=this.options.curve[1],i=b-d,f=-1,m,n=this;this.interval=this.options.window.setInterval(function(){f=f===-1?(new Date).getTime():f;var l=((new Date).getTime()-f)/g;l<1?(l=a(l),m=d+l*i,c(m)):(c(b),n.stop())},typeof this.options.rate==="number"?this.options.rate:20)};g.prototype.stop=function(){this.options.window.clearInterval(this.interval);
+(this.options.onEnd||function(){})()};g.prototype.defaultEasing=function(g){return Math.sin(g*(Math.PI/2))};return g}();l.prototype={clone:function(){return new l(this.start,this.end,this.caret)},collapse:function(){this.caret?this.end=this.start:this.start=this.end},extend:function(g){this.caret?this.start=g:this.end=g;if(this.start>this.end)g=this.start,this.start=this.end,this.end=g,this.caret=!this.caret},setCaret:function(g){this.end=this.start=g;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(g){return this.caret===g.caret&&this.start===g.start&&this.end===g.end}};r.prototype={toString:function(){return"{l="+this.left+", t="+this.top+", r="+this.right+", b="+this.bottom+"}"}};q.prototype={create:function(g,a){if(!this._lineDiv){var c=this._lineDiv=this._createLine(g,a,this.lineIndex);c._line=
+this;return c}},_createLine:function(g,a,b){var s=this.view,i=s._model,f=i.getLine(b),m=i.getLineStart(b),n={type:"LineStyle",textView:s,lineIndex:b,lineText:f,lineStart:m};if(f.length<2E3)s.onLineStyle(n);i=a||d.createElement(g.ownerDocument,"div");if(!a||!c(a.viewStyle,n.style)){j(n.style,i,a);if(a)a._trim=null;i.viewStyle=n.style;i.setAttribute("role","presentation")}i.lineIndex=b;b=[];this._createRanges(n.ranges,f,0,f.length,m,{tabOffset:0,ranges:b});f=" ";!s._fullSelection&&d.isIE<9&&(f="\ufeff");
+d.isWebkit&&(f="\u200c");n={text:f,style:s._metrics.largestFontStyle,ignoreChars:1};b.length===0||!b[b.length-1].style||b[b.length-1].style.tagName!=="div"?b.push(n):b.splice(b.length-1,0,n);var l,e,h,r,q,f=s=0,k,o;if(a){if(e=a.modelChangedEvent)e.removedLineCount===0&&e.addedLineCount===0?(o=e.start-m,k=e.addedCharCount-e.removedCharCount):o=-1,a.modelChangedEvent=void 0;e=a.firstChild}for(m=0;m<b.length;m++){n=b[m];r=n.text;s+=r.length;l=n.style;if(e)if(q=e.firstChild.data,h=e.viewStyle,q===r&&
+c(l,h)){f+=q.length;e._rectsCache=void 0;l=e=e.nextSibling;continue}else for(;e;){if(o!==-1){h=s;h>=o&&(h-=k);q=(q=e.firstChild.data)?q.length:0;if(f+q>h)break;f+=q}h=e.nextSibling;i.removeChild(e);e=h}l=this._createSpan(i,r,l,n.ignoreChars);e?i.insertBefore(l,e):i.appendChild(l);if(a)a.lineWidth=void 0}if(a)for(g=l?l.nextSibling:null;g;)h=g.nextSibling,a.removeChild(g),g=h;else g.appendChild(i);return i},_createRanges:function(g,a,d,s,b,i){if(!(d>s)){if(g)for(var f=0;f<g.length;f++){var m=g[f];if(!(m.end<
+b+d)){var n=Math.max(b+d,m.start)-b;if(n>s)break;var l=Math.min(b+s,m.end)-b;if(n<=l){n=Math.max(d,n);l=Math.min(s,l);for(d<n&&this._createRange(a,d,n,null,i);f+1<g.length&&g[f+1].start-b===l&&c(m.style,g[f+1].style);)m=g[f+1],l=Math.min(b+s,m.end)-b,f++;this._createRange(a,n,l,m.style,i);d=l}}}d<s&&this._createRange(a,d,s,null,i)}},_createRange:function(g,a,c,s,d){if(!(a>c)){var b=this.view._customTabSize;if(b&&b!==8)for(var i=g.indexOf("\t",a);i!==-1;){a<i&&(a={text:g.substring(a,i),style:s},d.ranges.push(a),
+d.tabOffset+=a.text.length);a=b-d.tabOffset%b;if(a>0){for(var f="\u00a0",m=1;m<a;m++)f+=" ";a={text:f,style:s,ignoreChars:a-1};d.ranges.push(a);d.tabOffset+=a.text.length}a=i+1;if(a===c)return;i=g.indexOf("\t",a)}a<=c&&(a={text:g.substring(a,c),style:s},d.ranges.push(a),d.tabOffset+=a.text.length)}},_createSpan:function(g,a,c,s){var b=this.view,i="span";c&&c.tagName&&(i=c.tagName.toLowerCase());var f=i==="a";if(f)g.hasLink=!0;f&&!b._linksVisible&&(i="span");f=g.ownerDocument;g=d.createElement(g.ownerDocument,
+i);c&&c.html?(g.innerHTML=c.html,g.ignore=!0):c&&c.node?(g.appendChild(c.node),g.ignore=!0):g.appendChild(f.createTextNode(c&&c.text?c.text:a));j(c,g);if(i==="a"){var m=b._getWindow();h(g,"click",function(g){return b._handleLinkClick(g?g:m.event)},!1)}g.viewStyle=c;if(s)g.ignoreChars=s;return g},_ensureCreated:function(){return this._lineDiv?this._lineDiv:this._createdDiv=this.create(this.view._clientDiv,null)},getBoundingClientRect:function(g,a){var c=this._ensureCreated(),s=this.view;if(g===void 0)return this._getLineBoundingClientRect(c,
+!0);var b=s._model,i=c.ownerDocument,f=this.lineIndex,m=null;if(g<b.getLineEnd(f)){b=b.getLineStart(f);for(f=c.firstChild;f;){if(!f.ignore){var n=f.firstChild,l=n.length;f.ignoreChars&&(l-=f.ignoreChars);if(b+l>g){m=g-b;if(s._isRangeRects)i=i.createRange(),i.setStart(n,m),i.setEnd(n,m+1),m=new r(i.getBoundingClientRect());else if(d.isIE)i=i.body.createTextRange(),i.moveToElementText(f),i.collapse(),i.moveEnd("character",m+1),i.moveStart("character",m),m=new r(i.getBoundingClientRect());else{var e=
+n.data;f.removeChild(n);f.appendChild(i.createTextNode(e.substring(0,m)));var h=d.createElement(i,"span");h.appendChild(i.createTextNode(e.substring(m,m+1)));f.appendChild(h);f.appendChild(i.createTextNode(e.substring(m+1)));m=new r(h.getBoundingClientRect());f.innerHTML="";f.appendChild(n);this._createdDiv||(i=s._getSelection(),(b<=i.start&&i.start<b+l||b<=i.end&&i.end<b+l)&&s._updateDOMSelection())}d.isIE&&(i=c.ownerDocument.defaultView||c.ownerDocument.parentWindow,c=i.screen.logicalXDPI/i.screen.deviceXDPI,
+i=i.screen.logicalYDPI/i.screen.deviceYDPI,m.left*=c,m.right*=c,m.top*=i,m.bottom*=i);break}b+=l}f=f.nextSibling}}c=this.getBoundingClientRect();if(!m)s._wrapMode?(s=this.getClientRects(),m=s[s.length-1],m.left=m.right,m.left+=c.left,m.top+=c.top,m.right+=c.left,m.bottom+=c.top):(m=new r(c),m.left=m.right);if(a||a===void 0)m.left-=c.left,m.top-=c.top,m.right-=c.left,m.bottom-=c.top;return m},_getClientRects:function(g,a){var c,s,d,b;if(!g._rectsCache){c=g.getClientRects();s=Array(c.length);for(b=
+0;b<c.length;b++)d=s[b]=new r(c[b]),d.left-=a.left,d.top-=a.top,d.right-=a.left,d.bottom-=a.top;g._rectsCache=s}c=g._rectsCache;s=[c.length];for(b=0;b<c.length;b++)s[b]=new r(c[b]);return s},getClientRects:function(g){if(!this.view._wrapMode)return[this.getBoundingClientRect()];for(var a=this._ensureCreated(),c=[],s=a.firstChild,d,b=a.getBoundingClientRect();s;){if(!s.ignore)for(var i=this._getClientRects(s,b),a=0;a<i.length;a++){var f=i[a],m;if(f.top!==f.bottom){var n=f.top+(f.bottom-f.top)/2;for(m=
+0;m<c.length;m++)if(d=c[m],d.top<=n&&n<d.bottom)break;if(m===c.length)c.push(f);else{if(f.left<d.left)d.left=f.left;if(f.top<d.top)d.top=f.top;if(f.right>d.right)d.right=f.right;if(f.bottom>d.bottom)d.bottom=f.bottom}}}s=s.nextSibling}return g!==void 0?c[g]:c},_getLineBoundingClientRect:function(g,a){var c=new r(g.getBoundingClientRect());if(!this.view._wrapMode){c.right=c.left;for(var d=g.lastChild;d&&d.ignoreChars===d.firstChild.length;)d=d.previousSibling;if(d)d=d.getBoundingClientRect(),c.right=
+d.right+n(g).right}a&&(d=n(g),c.left+=d.left,c.right-=d.right);return c},getLineCount:function(){return!this.view._wrapMode?1:this.getClientRects().length},getLineIndex:function(g){if(!this.view._wrapMode)return 0;for(var a=this.getClientRects(),g=this.getBoundingClientRect(g),g=g.top+(g.bottom-g.top)/2,c=0;c<a.length;c++)if(a[c].top<=g&&g<a[c].bottom)return c;return a.length-1},getLineStart:function(g){if(!this.view._wrapMode||g===0)return this.view._model.getLineStart(g);var a=this.getClientRects();
+return this.getOffset(a[g].left+1,a[g].top+1)},getOffset:function(g,a){var c=this.view,s=c._model,b=this.lineIndex,i=s.getLineStart(b),f=s.getLineEnd(b);if(i===f)return i;var m=this._ensureCreated(),n=this.getBoundingClientRect(),l,e;if(c._wrapMode){l=this.getClientRects();if(a<l[0].top)a=l[0].top;for(var h=0;h<l.length;h++)if(e=l[h],e.top<=a&&a<e.bottom)break;if(g<e.left)g=e.left;g>e.right&&(g=e.right-1)}else g<0&&(g=0),g>n.right-n.left&&(g=n.right-n.left);var j=m.ownerDocument,h=j.defaultView||
+j.parentWindow,r=d.isIE?h.screen.logicalXDPI/h.screen.deviceXDPI:1,q=d.isIE?h.screen.logicalYDPI/h.screen.deviceYDPI:1,h=i,k=m.firstChild;a:for(;k;){if(!k.ignore){var o=k.firstChild,m=o.length;k.ignoreChars&&(m-=k.ignoreChars);var v,p,u;l=this._getClientRects(k,n);for(var z=0;z<l.length;z++)if(e=l[z],e.left<=g&&g<e.right&&(!c._wrapMode||e.top<=a&&a<e.bottom)){if(d.isIE||c._isRangeRects){for(var j=c._isRangeRects?j.createRange():j.body.createTextRange(),z=m,C=-1;z-C>1;){var D=Math.floor((z+C)/2);l=
+C+1;e=D===m-1&&k.ignoreChars?o.length:D+1;c._isRangeRects?(j.setStart(o,l),j.setEnd(o,e)):(j.moveToElementText(k),j.move("character",l),j.moveEnd("character",e-l));l=j.getClientRects();for(var J=!1,F=0;F<l.length;F++)if(e=l[F],v=e.left*r-n.left,u=e.right*r-n.left,p=e.top*q-n.top,e=e.bottom*q-n.top,v<=g&&g<u&&(!c._wrapMode||p<=a&&a<e)){J=!0;break}J?z=D:C=D}h+=z;l=z;e=z===m-1&&k.ignoreChars?o.length:Math.min(z+1,o.length);c._isRangeRects?(j.setStart(o,l),j.setEnd(o,e)):(j.moveToElementText(k),j.move("character",
+l),j.moveEnd("character",e-l));e=j.getClientRects()[0];v=e.left*r-n.left;u=e.right*r-n.left;c=g>v+(u-v)/2;n=h-i;s=s.getLine(b);b=s.charCodeAt(n);55296<=b&&b<=56319&&c?n<s.length&&(b=s.charCodeAt(n+1),56320<=b&&b<=57343&&(h+=1)):56320<=b&&b<=57343&&!c&&n>0&&(b=s.charCodeAt(n-1),55296<=b&&b<=56319&&(h-=1));c&&h++}else{s=[];for(b=0;b<m;b++)s.push("<span>"),b===m-1?s.push(o.data.substring(b)):s.push(o.data.substring(b,b+1)),s.push("</span>");k.innerHTML=s.join("");for(s=k.firstChild;s;){e=s.getBoundingClientRect();
+v=e.left-n.left;u=e.right-n.left;if(v<=g&&g<u){g>v+(u-v)/2&&h++;break}h++;s=s.nextSibling}if(!this._createdDiv)k.innerHTML="",k.appendChild(o),n=c._getSelection(),(h<=n.start&&n.start<h+m||h<=n.end&&n.end<h+m)&&c._updateDOMSelection()}break a}h+=m}k=k.nextSibling}return Math.min(f,Math.max(i,h))},getNextOffset:function(g,a){if(a.unit==="line"){var c=this.view._model,s=c.getLineAtOffset(g);return a.count>0?c.getLineEnd(s):c.getLineStart(s)}return a.unit==="wordend"||a.unit==="wordWS"||a.unit==="wordendWS"?
+this._getNextOffset_W3C(g,a):d.isIE?this._getNextOffset_IE(g,a):this._getNextOffset_W3C(g,a)},_getNextOffset_W3C:function(g,a){function c(g){return 33<=g&&g<=47||58<=g&&g<=64||91<=g&&g<=94||g===96||123<=g&&g<=126}function d(g){return g===32||g===9}var b=this.view._model,i=b.getLineAtOffset(g),f=b.getLine(i),m=b.getLineStart(i),b=b.getLineEnd(i),i=f.length,n=g-m,l,e=a.count<0?-1:1;if(a.unit==="word"||a.unit==="wordend"||a.unit==="wordWS"||a.unit==="wordendWS")for(var h,j,r;a.count!==0;){if(a.count>
+0){if(n===i)return b;l=f.charCodeAt(n);h=c(l);j=!h&&!d(l);for(n++;n<i;){l=f.charCodeAt(n);if(a.unit!=="wordWS"&&a.unit!=="wordendWS"){r=c(l);if(a.unit==="wordend"){if(!r&&h)break}else if(r&&!h)break;l=!r&&!d(l)}else l=!d(l);if(a.unit==="wordend"||a.unit==="wordendWS"){if(!l&&j)break}else if(l&&!j)break;j=l;h=r;n++}}else{if(n===0)return m;n--;l=f.charCodeAt(n);h=c(l);for(j=!h&&!d(l);0<n;){l=f.charCodeAt(n-1);if(a.unit!=="wordWS"&&a.unit!=="wordendWS"){r=c(l);if(a.unit==="wordend"){if(r&&!h)break}else if(!r&&
+h)break;l=!r&&!d(l)}else l=!d(l);if(a.unit==="wordend"||a.unit==="wordendWS"){if(l&&!j)break}else if(!l&&j)break;j=l;h=r;n--}}a.count-=e}else for(;a.count!==0&&0<=n+e&&n+e<=i;)n+=e,l=f.charCodeAt(n),56320<=l&&l<=57343&&n>0&&(l=f.charCodeAt(n-1),55296<=l&&l<=56319&&(n+=e)),a.count-=e;return m+n},_getNextOffset_IE:function(g,a){for(var c=this._ensureCreated(),d=this.view._model,b=this.lineIndex,i=0,f,m=d.getLineStart(b),n=c.ownerDocument,l=a.count<0?-1:1;a.count!==0;){if(g===d.getLineEnd(b)){for(f=
+c.lastChild;f&&f.ignoreChars;)f=f.previousSibling;if(!f)return m;i=n.body.createTextRange();i.moveToElementText(f);f=i.text.length;i.moveEnd(a.unit,a.count);i=g+i.text.length-f}else if(g===m&&a.count<0)i=m;else for(f=c.firstChild;f;){var e=f.firstChild.length;f.ignoreChars&&(e-=f.ignoreChars);if(m+e>g){i=n.body.createTextRange();g===m&&a.count<0?i.moveToElementText(f.previousSibling):(i.moveToElementText(f),i.collapse(),i.moveEnd("character",g-m));f=i.text.length;i.moveEnd(a.unit,a.count);i=g+i.text.length-
+f;break}m=e+m;f=f.nextSibling}a.count-=l}return i},destroy:function(){var g=this._createdDiv;if(g)g.parentNode.removeChild(g),this._createdDiv=null}};v.prototype={addKeyMode:function(g,a){var c=this._keyModes;a!==void 0?c.splice(a,0,g):c.push(g);g._modeAdded&&g._modeAdded()},addRuler:function(g,a){g.setView(this);var c=this._rulers;if(a!==void 0){var d,b;for(d=0,b=0;d<c.length&&b<a;d++)g.getLocation()===c[d].getLocation()&&b++;c.splice(b,0,g);a=b}else c.push(g);this._createRuler(g,a);this._update()},
+computeSize:function(){var g=0,a=0,c=this._model,b=this._clientDiv;if(!b)return{width:g,height:a};var i=b.style.width;if(d.isWebkit)b.style.width="0x7fffffffpx";for(var c=c.getLineCount(),f=0;f<c;f++){var m=this._getLine(f),n=m.getBoundingClientRect(),g=Math.max(g,n.right-n.left);a+=n.bottom-n.top;m.destroy()}if(d.isWebkit)b.style.width=i;b=this._getViewPadding();g+=b.right+b.left+this._metrics.scrollWidth;a+=b.bottom+b.top+this._metrics.scrollWidth;return{width:g,height:a}},convert:function(g,a,
+c){if(this._clientDiv){var d=this._getScroll(),b=this._getViewPadding(),i=this._viewDiv.getBoundingClientRect();a==="document"&&(g.x!==void 0&&(g.x+=-d.x+i.left+b.left),g.y!==void 0&&(g.y+=-d.y+i.top+b.top));c==="document"&&(g.x!==void 0&&(g.x+=d.x-i.left-b.left),g.y!==void 0&&(g.y+=d.y-i.top-b.top));return g}},destroy:function(){for(var g=0;g<this._rulers.length;g++)this._rulers[g].setView(null);this.rulers=null;this._destroyView();this.onDestroy({type:"Destroy"});this._actions=this._keyModes=this._doubleClickSelection=
+this._selection=this._theme=this._model=this._parent=null},focus:function(){this._clientDiv&&(this._updateDOMSelection(),d.isOpera&&this._clientDiv.blur(),this._clientDiv.focus(),this._updateDOMSelection())},hasFocus:function(){return this._hasFocus},getActionDescription:function(g){if(g=this._actions[g])return g.actionDescription},getActions:function(g){var a=[],c=this._actions,d;for(d in c)c.hasOwnProperty(d)&&(g||!c[d].defaultHandler)&&a.push(d);return a},getBottomIndex:function(g){return!this._clientDiv?
+0:this._getBottomIndex(g)},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 g=this._getScroll();return{x:g.x,y:g.y,width:this._getClientWidth(),height:this._getClientHeight()}},getHorizontalPixel:function(){return!this._clientDiv?0:this._getScroll().x},getKeyBindings:function(g){for(var a=[],c=this._keyModes,
+d=0;d<c.length;d++)a=a.concat(c[d].getKeyBindings(g));return a},getKeyModes:function(){return this._keyModes.slice(0)},getLineHeight:function(g){return!this._clientDiv?0:this._getLineHeight(g)},getLineIndex:function(g){return!this._clientDiv?0:this._getLineIndex(g)},getLinePixel:function(g){return!this._clientDiv?0:this._getLinePixel(g)},getLocationAtOffset:function(g){if(!this._clientDiv)return{x:0,y:0};var a=this._model,g=Math.min(Math.max(0,g),a.getCharCount()),a=a.getLineAtOffset(g),c=this._getLine(a),
+g=c.getBoundingClientRect(g);c.destroy();c=g.left;a=this._getLinePixel(a)+g.top;return{x:c,y:a}},getOptions:function(){var g;if(arguments.length===0)g=this._defaultOptions();else if(arguments.length===1){if(g=arguments[0],typeof g==="string")return f(this["_"+g])}else{g={};for(var a in arguments)arguments.hasOwnProperty(a)&&(g[arguments[a]]=void 0)}for(var c in g)g.hasOwnProperty(c)&&(g[c]=f(this["_"+c]));return g},getModel:function(){return this._model},getOffsetAtLocation:function(g,a){if(!this._clientDiv)return 0;
+var c=this._getLineIndex(a),d=this._getLine(c),c=d.getOffset(g,a-this._getLinePixel(c));d.destroy();return c},getRulers:function(){return this._rulers.slice(0)},getSelection:function(){var g=this._getSelection();return{start:g.start,end:g.end}},getText:function(g,a){return this._model.getText(g,a)},getTopIndex:function(g){return!this._clientDiv?0:this._getTopIndex(g)},getTopPixel:function(){return!this._clientDiv?0:this._getScroll().y},invokeAction:function(g,a,c){if(this._clientDiv){if(g=this._actions[g]){if(!a&&
+g.handler&&g.handler(c))return!0;if(g.defaultHandler)return typeof g.defaultHandler(c)==="boolean"}return!1}},isDestroyed:function(){return!this._clientDiv},onContextMenu:function(g){return this.dispatchEvent(g)},onDragStart:function(g){return this.dispatchEvent(g)},onDrag:function(g){return this.dispatchEvent(g)},onDragEnd:function(g){return this.dispatchEvent(g)},onDragEnter:function(g){return this.dispatchEvent(g)},onDragOver:function(g){return this.dispatchEvent(g)},onDragLeave:function(g){return this.dispatchEvent(g)},
+onDrop:function(g){return this.dispatchEvent(g)},onDestroy:function(g){return this.dispatchEvent(g)},onLineStyle:function(g){return this.dispatchEvent(g)},onKeyDown:function(g){return this.dispatchEvent(g)},onKeyPress:function(g){return this.dispatchEvent(g)},onKeyUp:function(g){return this.dispatchEvent(g)},onModelChanged:function(g){return this.dispatchEvent(g)},onModelChanging:function(g){return this.dispatchEvent(g)},onModify:function(g){return this.dispatchEvent(g)},onMouseDown:function(g){return this.dispatchEvent(g)},
+onMouseUp:function(g){return this.dispatchEvent(g)},onMouseMove:function(g){return this.dispatchEvent(g)},onMouseOver:function(g){return this.dispatchEvent(g)},onMouseOut:function(g){return this.dispatchEvent(g)},onSelection:function(g){return this.dispatchEvent(g)},onScroll:function(g){return this.dispatchEvent(g)},onVerify:function(g){return this.dispatchEvent(g)},onFocus:function(g){return this.dispatchEvent(g)},onBlur:function(g){return this.dispatchEvent(g)},redraw:function(){if(!(this._redrawCount>
+0)){var g=this._model.getLineCount();this.redrawRulers(0,g);this.redrawLines(0,g)}},redrawRulers:function(g,a){if(!(this._redrawCount>0))for(var c=this.getRulers(),d=0;d<c.length;d++)this.redrawLines(g,a,c[d])},redrawLines:function(g,a,c){if(!(this._redrawCount>0)&&(g===void 0&&(g=0),a===void 0&&(a=this._model.getLineCount()),g!==a)){var d=this._clientDiv;if(d){if(c)for(d=(c.getLocation()==="left"?this._leftDiv:this._rightDiv).firstChild;d;){if(d._ruler===c)break;d=d.nextSibling}c?d.rulerChanged=
+!0:this._lineHeight&&this._resetLineHeight(g,a);if(!c||c.getOverview()==="page")for(d=d.firstChild;d;){var b=d.lineIndex;if(g<=b&&b<a)d.lineChanged=!0;d=d.nextSibling}if(!c&&!this._wrapMode&&g<=this._maxLineIndex&&this._maxLineIndex<a)this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0;this._queueUpdate()}}},redrawRange:function(g,a){if(!(this._redrawCount>0)){var c=this._model;g===void 0&&(g=0);a===void 0&&(a=c.getCharCount());var d=c.getLineAtOffset(g),c=c.getLineAtOffset(Math.max(g,
+a-1))+1;this.redrawLines(d,c)}},removeKeyMode:function(g){for(var a=this._keyModes,c=0;c<a.length;c++)if(a[c]===g){a.splice(c,1);g._modeRemoved&&g._modeRemoved();break}},removeRuler:function(g){for(var a=this._rulers,c=0;c<a.length;c++)if(a[c]===g){a.splice(c,1);g.setView(null);this._destroyRuler(g);this._update();break}},resize:function(){this._clientDiv&&this._handleResize(null)},setAction:function(g,a,c){if(g){var d=this._actions,b=d[g];b||(b=d[g]={});b.handler=a;if(c!==void 0)b.actionDescription=
+c}},setKeyBinding:function(g,a){this._keyModes[0].setKeyBinding(g,a)},setCaretOffset:function(g,a,c){var d=this._model.getCharCount(),g=Math.max(0,Math.min(g,d));this._setSelection(new l(g,g,!1),a===void 0||a,!0,c)},setHorizontalPixel:function(g){this._clientDiv&&(g=Math.max(0,g),this._scrollView(g-this._getScroll().x,0))},setRedraw:function(g){g?--this._redrawCount===0&&this.redraw():this._redrawCount++},setModel:function(g){if(g&&g!==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=g.getLineCount(),b=g.getCharCount(),i={type:"ModelChanging",text:g.getText(),start:0,removedCharCount:c,addedCharCount:b,removedLineCount:a,addedLineCount:d};this.onModelChanging(i);this._model=g;i={type:"ModelChanged",start:0,removedCharCount:c,addedCharCount:b,removedLineCount:a,addedLineCount:d};this.onModelChanged(i);this._model.addEventListener("preChanging",
+this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._reset();this._update()}},setOptions:function(g){var a=this._defaultOptions(),d;for(d in g)if(g.hasOwnProperty(d)){var b=g[d];if(!c(this["_"+d],b)){var i=a[d]?a[d].update:null;i?i.call(this,b):this["_"+d]=f(b)}}},setSelection:function(g,a,c,d){var b=g>a;if(b)var i=g,g=a,a=i;i=this._model.getCharCount();g=Math.max(0,Math.min(g,i));a=Math.max(0,Math.min(a,i));this._setSelection(new l(g,a,b),
+c===void 0||c,!0,d)},setText:function(g,a,c){var b=a===void 0&&c===void 0;a===void 0&&(a=0);c===void 0&&(c=this._model.getCharCount());if(b)this._variableLineHeight=!1;this._modifyContent({text:g,start:a,end:c,_code:!0},!b);if(b)this._columnX=-1,this._setSelection(new l(0,0,!1),!0),d.isFirefox&&this._fixCaret()},setTopIndex:function(g){this._clientDiv&&this._scrollView(0,this._getLinePixel(Math.max(0,g))-this._getScroll().y)},setTopPixel:function(g){this._clientDiv&&this._scrollView(0,Math.max(0,
+g)-this._getScroll().y)},showSelection:function(){return this._showCaret(!0)},update:function(g,a){this._clientDiv&&(g&&this._updateStyle(),a===void 0||a?this._update():this._queueUpdate())},_handleRootMouseDown:function(g){if(!this._ignoreEvent(g)){if(d.isFirefox&&g.which===1)this._clientDiv.contentEditable=!1,this._ignoreBlur=(this._overlayDiv||this._clientDiv).draggable=!0;var a=this._overlayDiv||this._clientDiv;if(d.isIE<9)a=this._viewDiv;for(var c=g.target?g.target:g.srcElement;c;){if(a===c)return;
+c=c.parentNode}g.preventDefault&&g.preventDefault();g.stopPropagation&&g.stopPropagation();if(!this._isW3CEvents){var b=this;this._getWindow().setTimeout(function(){b._clientDiv.focus()},0)}}},_handleRootMouseUp:function(g){if(!this._ignoreEvent(g)&&d.isFirefox&&g.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(d.isIE<9&&!this._getSelection().isEmpty()){var g=
+this._rootDiv,a=d.createElement(g.ownerDocument,"div");g.appendChild(a);g.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",g=this._getWindow(),a=this._selDiv1.ownerDocument,g.getSelection){a=g.getSelection();for(g=a.anchorNode;g;){if(g===this._clientDiv){a.rangeCount>0&&a.removeAllRanges();break}g=g.parentNode}}else if(a.selection){this._ignoreSelect=
+!1;for(g=a.selection.createRange().parentElement();g;){if(g===this._clientDiv){a.selection.empty();break}g=g.parentNode}this._ignoreSelect=!0}if(!this._ignoreFocus)this.onBlur({type:"Blur"})}},_handleContextMenu:function(g){if(!this._ignoreEvent(g)){d.isIE&&this._lastMouseButton===3&&this._updateDOMSelection();var a=!1;this.isListening("ContextMenu")?(a=this._createMouseEvent("ContextMenu",g),a.screenX=g.screenX,a.screenY=g.screenY,this.onContextMenu(a),a=a.defaultPrevented):d.isMac&&d.isFirefox&&
+g.button===0&&(a=!0);if(a)return g.preventDefault&&g.preventDefault(),!1}},_handleCopy:function(g){if(!this._ignoreEvent(g)&&!this._ignoreCopy&&this._doCopy(g))return g.preventDefault&&g.preventDefault(),!1},_handleCut:function(g){if(!this._ignoreEvent(g)&&this._doCut(g))return g.preventDefault&&g.preventDefault(),!1},_handleDataModified:function(g){this._ignoreEvent(g)||this._startIME()},_handleDblclick:function(g){if(!this._ignoreEvent(g)&&(this._lastMouseTime=g.timeStamp?g.timeStamp:(new Date).getTime(),
+this._clickCount!==2))this._clickCount=2,this._handleMouse(g)},_handleDragStart:function(g){if(!this._ignoreEvent(g)){if(d.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",g)),this._dragOffset=-1;else return g.preventDefault&&g.preventDefault(),!1}},_handleDrag:function(g){if(!this._ignoreEvent(g)&&
+this.isListening("Drag"))this.onDrag(this._createMouseEvent("Drag",g))},_handleDragEnd:function(g){if(!this._ignoreEvent(g)){this._dropTarget=!1;this._dragOffset=-1;if(this.isListening("DragEnd"))this.onDragEnd(this._createMouseEvent("DragEnd",g));d.isFirefox&&(this._fixCaret(),g.dataTransfer.dropEffect==="none"&&!g.dataTransfer.mozUserCancelled&&this._fixCaret())}},_handleDragEnter:function(g){if(!this._ignoreEvent(g)){var a=!0;this._dropTarget=!0;this.isListening("DragEnter")&&(a=!1,this.onDragEnter(this._createMouseEvent("DragEnter",
+g)));if(d.isWebkit||a)return g.preventDefault&&g.preventDefault(),!1}},_handleDragOver:function(g){if(!this._ignoreEvent(g)){var a=!0;this.isListening("DragOver")&&(a=!1,this.onDragOver(this._createMouseEvent("DragOver",g)));if(d.isWebkit||a){if(a)g.dataTransfer.dropEffect="none";g.preventDefault&&g.preventDefault();return!1}}},_handleDragLeave:function(g){if(!this._ignoreEvent(g)&&(this._dropTarget=!1,this.isListening("DragLeave")))this.onDragLeave(this._createMouseEvent("DragLeave",g))},_handleDrop:function(g){if(!this._ignoreEvent(g)){this._dropTarget=
+!1;if(this.isListening("Drop"))this.onDrop(this._createMouseEvent("Drop",g));g.preventDefault&&g.preventDefault();return!1}},_handleFocus:function(){this._hasFocus=!0;d.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 g=this._highlightRGB;this._selDiv1.style.background=g;this._selDiv2.style.background=g;this._selDiv3.style.background=
+g}if(!this._ignoreFocus)this.onFocus({type:"Focus"})},_handleKeyDown:function(g){if(!this._ignoreEvent(g)){if(this.isListening("KeyDown")){var a=this._createKeyEvent("KeyDown",g);this.onKeyDown(a);if(a.defaultPrevented){if(d.isFirefox)this._keyDownPrevented=!0;g.preventDefault();return}}a=!1;switch(g.keyCode){case 16:case 17:case 18:case 91:a=!0;break;default:this._setLinksVisible(!1)}if(g.keyCode===229){if(this._readonly)return g.preventDefault&&g.preventDefault(),!1;a=!0;if(d.isSafari&&d.isMac&&
+g.ctrlKey)a=!1,g.keyCode=129;a&&this._startIME()}else a||this._commitIME();if((d.isMac||d.isLinux)&&d.isFirefox<4||d.isOpera)return this._keyDownEvent=g,!0;if(this._doAction(g))return g.preventDefault?(g.preventDefault(),g.stopPropagation()):(g.cancelBubble=!0,g.returnValue=!1,g.keyCode=0),!1}},_handleKeyPress:function(g){if(!this._ignoreEvent(g))if(this._keyDownPrevented)g.preventDefault&&(g.preventDefault(),g.stopPropagation()),this._keyDownPrevented=void 0;else{if(d.isMac&&d.isWebkit&&(63232<=
+g.keyCode&&g.keyCode<=63487||g.keyCode===13||g.keyCode===8))return g.preventDefault&&g.preventDefault(),!1;if(((d.isMac||d.isLinux)&&d.isFirefox<4||d.isOpera)&&this._doAction(this._keyDownEvent))return g.preventDefault&&g.preventDefault(),!1;var a=d.isMac?g.metaKey:g.ctrlKey;if(g.charCode!==void 0&&a)switch(g.charCode){case 99:case 118:case 120:return!0}if(this.isListening("KeyPress")&&(a=this._createKeyEvent("KeyPress",g),this.onKeyPress(a),a.defaultPrevented)){g.preventDefault();return}if(this._doAction(g))return g.preventDefault?
+(g.preventDefault(),g.stopPropagation()):(g.cancelBubble=!0,g.returnValue=!1,g.keyCode=0),!1;a=!1;if(d.isMac){if(g.ctrlKey||g.metaKey)a=!0}else if(d.isFirefox){if(g.ctrlKey||g.altKey)a=!0}else g.ctrlKey^g.altKey&&(a=!0);if(!a&&(a=d.isOpera?g.which:g.charCode!==void 0?g.charCode:g.keyCode,a>31))return this._doContent(String.fromCharCode(a)),g.preventDefault&&g.preventDefault(),!1}},_handleKeyUp:function(g){if(!this._ignoreEvent(g)){if(this.isListening("KeyUp")){var a=this._createKeyEvent("KeyUp",g);
+this.onKeyUp(a);if(a.defaultPrevented){g.preventDefault();return}}(d.isMac?g.metaKey:g.ctrlKey)||this._setLinksVisible(!1);g.keyCode===13&&this._commitIME()}},_handleLinkClick:function(g){if(!(d.isMac?g.metaKey:g.ctrlKey))return g.preventDefault&&g.preventDefault(),!1},_handleMouse:function(g){var a=this._getWindow(),c=!0,b=a;if(d.isIE||d.isFirefox&&!this._overlayDiv)b=this._clientDiv;if(this._overlayDiv){if(this._hasFocus)this._ignoreFocus=!0;var i=this;a.setTimeout(function(){i.focus();i._ignoreFocus=
+!1},0)}this._clickCount===1?(c=this._setSelectionTo(g.clientX,g.clientY,g.shiftKey,!d.isOpera&&this._hasFocus&&this.isListening("DragStart")))&&this._setGrab(b):(this._isW3CEvents&&this._setGrab(b),this._doubleClickSelection=null,this._setSelectionTo(g.clientX,g.clientY,g.shiftKey),this._doubleClickSelection=this._getSelection());return c},_handleMouseDown:function(g){if(!this._ignoreEvent(g)){if(this._linksVisible)if((g.target||g.srcElement).tagName!=="A")this._setLinksVisible(!1);else return;this._commitIME();
+var a=g.which;a||(g.button===4&&(a=2),g.button===2&&(a=3),g.button===1&&(a=1));var c=a!==2&&g.timeStamp?g.timeStamp:(new Date).getTime(),b=c-this._lastMouseTime,i=Math.abs(this._lastMouseX-g.clientX),f=Math.abs(this._lastMouseY-g.clientY),m=this._lastMouseButton===a;this._lastMouseX=g.clientX;this._lastMouseY=g.clientY;this._lastMouseTime=c;this._lastMouseButton=a;if(a===1)this._isMouseDown=!0,m&&b<=this._clickTime&&i<=this._clickDist&&f<=this._clickDist?this._clickCount++:this._clickCount=1;if(this.isListening("MouseDown")&&
+(c=this._createMouseEvent("MouseDown",g),this.onMouseDown(c),c.defaultPrevented)){g.preventDefault();return}if(a===1&&this._handleMouse(g)&&(d.isIE>=9||d.isOpera||d.isChrome||d.isSafari||d.isFirefox&&!this._overlayDiv))this._hasFocus||this.focus(),g.preventDefault();d.isFirefox&&this._lastMouseButton===3&&this._updateDOMSelection()}},_handleMouseOver:function(g){if(!this._ignoreEvent(g)&&!this._animation&&this.isListening("MouseOver"))this.onMouseOver(this._createMouseEvent("MouseOver",g))},_handleMouseOut:function(g){if(!this._ignoreEvent(g)&&
+!this._animation&&this.isListening("MouseOut"))this.onMouseOut(this._createMouseEvent("MouseOut",g))},_handleMouseMove:function(g){if(!this._animation){var a=this._isClientDiv(g);if(this.isListening("MouseMove")&&a)this.onMouseMove(this._createMouseEvent("MouseMove",g));if(!this._dropTarget){var c=this._linksVisible||this._lastMouseMoveX!==g.clientX||this._lastMouseMoveY!==g.clientY;this._lastMouseMoveX=g.clientX;this._lastMouseMoveY=g.clientY;this._setLinksVisible(c&&!this._isMouseDown&&(d.isMac?
+g.metaKey:g.ctrlKey));if(!this._isW3CEvents){if(g.button===0)return this._setGrab(null),!0;if(!this._isMouseDown&&g.button===1&&(this._clickCount&1)!==0&&a)return this._clickCount=2,this._handleMouse(g,this._clickCount)}if(this._isMouseDown&&this._dragOffset===-1){var a=g.clientX,g=g.clientY,b=this._getViewPadding(),i=this._viewDiv.getBoundingClientRect(),f=this._getClientWidth(),m=this._getClientHeight(),c=i.left+b.left,n=i.top+b.top,f=i.left+b.left+f,b=i.top+b.top+m;g<n?this._doAutoScroll("up",
+a,g-n):g>b?this._doAutoScroll("down",a,g-b):a<c&&!this._wrapMode?this._doAutoScroll("left",a-c,g):a>f&&!this._wrapMode?this._doAutoScroll("right",a-f,g):(this._endAutoScroll(),this._setSelectionTo(a,g,!0))}}}},_isClientDiv:function(g){for(var a=this._overlayDiv||this._clientDiv,g=g.target?g.target:g.srcElement;g;){if(a===g)return!0;g=g.parentNode}return!1},_createKeyEvent:function(g,a){return{type:g,event:a,preventDefault:function(){this.defaultPrevented=!0}}},_createMouseEvent:function(g,a){var c=
+this.convert({x:a.clientX,y:a.clientY},"page","document");return{type:g,event:a,clickCount:this._clickCount,x:c.x,y:c.y,preventDefault:function(){this.defaultPrevented=!0}}},_handleMouseUp:function(g){var a=g.which?g.button===0:g.button===1;if(this.isListening("MouseUp")&&(this._isClientDiv(g)||a&&this._isMouseDown))this.onMouseUp(this._createMouseEvent("MouseUp",g));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);d.isFirefox&&g.preventDefault()}},_handleMouseWheel:function(g){var a=this._getLineHeight(),c=0,b=0;d.isIE||d.isOpera?b=-g.wheelDelta/40*a:d.isFirefox?(a=d.isMac?g.detail*3:Math.max(-256,Math.min(256,g.detail))*a,g.axis===g.HORIZONTAL_AXIS?c=a:b=a):d.isMac?(b=g.timeStamp-this._wheelTimeStamp,this._wheelTimeStamp=g.timeStamp,c=g.wheelDeltaX%120!==0?1:b<40?40/(40-b):40,b=
+g.wheelDeltaY%120!==0?1:b<40?40/(40-b):40,c=Math.ceil(-g.wheelDeltaX/c),-1<c&&c<0&&(c=-1),0<c&&c<1&&(c=1),b=Math.ceil(-g.wheelDeltaY/b),-1<b&&b<0&&(b=-1),0<b&&b<1&&(b=1)):(c=-g.wheelDeltaX,b=-g.wheelDeltaY/120*8*a);if(d.isSafari){for(a=g.target;a&&a.lineIndex===void 0;)a=a.parentNode;this._mouseWheelLine=a}a=this._getScroll();this._scrollView(c,b);c=this._getScroll();if(a.x!==c.x||a.y!==c.y)return g.preventDefault&&g.preventDefault(),!1},_handlePaste:function(g){if(!this._ignoreEvent(g)&&!this._ignorePaste&&
+this._doPaste(g)){if(d.isIE){var a=this;this._ignoreFocus=!0;this._getWindow().setTimeout(function(){a._updateDOMSelection();a._ignoreFocus=!1},0)}g.preventDefault&&g.preventDefault();return!1}},_handleResize:function(){var g=this._parent.clientWidth,a=this._parent.clientHeight;if(this._parentWidth!==g||this._parentHeight!==a)this._parentWidth!==g&&this._wrapMode&&this._resetLineHeight(),this._parentWidth=g,this._parentHeight=a,d.isIE<9?this._queueUpdate():this._update()},_handleRulerEvent:function(g){for(var a=
+g.target?g.target:g.srcElement,c=a.lineIndex;a&&!a._ruler;){if(c===void 0&&a.lineIndex!==void 0)c=a.lineIndex;a=a.parentNode}a=a?a._ruler:null;if(c===void 0&&a&&a.getOverview()==="document"){var c=this._getClientHeight(),d=this._model.getLineCount(),b=this._getViewPadding(),i=this._viewDiv.getBoundingClientRect(),c=Math.floor((g.clientY-i.top-this._metrics.scrollWidth)*d/(c+b.top+b.bottom-2*this._metrics.scrollWidth));0<=c&&c<d||(c=void 0)}if(a)switch(g.type){case "click":if(a.onClick)a.onClick(c,
+g);break;case "dblclick":if(a.onDblClick)a.onDblClick(c,g);break;case "mousemove":if(a.onMouseMove)a.onMouseMove(c,g);break;case "mouseover":if(a.onMouseOver)a.onMouseOver(c,g);break;case "mouseout":if(a.onMouseOut)a.onMouseOut(c,g)}},_handleScroll:function(){var g=this._getScroll(!1),a=this._hScroll,c=this._vScroll;if(a!==g.x||c!==g.y)this._hScroll=g.x,this._vScroll=g.y,this._commitIME(),this._update(c===g.y),this.onScroll({type:"Scroll",oldValue:{x:a,y:c},newValue:g})},_handleSelectStart:function(g){if(this._ignoreSelect)return g&&
+g.preventDefault&&g.preventDefault(),!1},_getModelOffset:function(g,a){if(g){var c;c=g.tagName==="DIV"?g:g.parentNode.parentNode;var d=0,b=c.lineIndex;if(g.tagName!=="DIV")for(c=c.firstChild;c;){var i=c.firstChild;if(i===g){c.ignoreChars&&(d-=c.ignoreChars);d+=a;break}c.ignoreChars&&(d-=c.ignoreChars);d+=i.data.length;c=c.nextSibling}return Math.max(0,d)+this._model.getLineStart(b)}},_updateSelectionFromDOM:function(){var g=this._getWindow().getSelection(),a=this._getModelOffset(g.anchorNode,g.anchorOffset),
+g=this._getModelOffset(g.focusNode,g.focusOffset);a===void 0||g===void 0||this._setSelection(new l(a,g),!1,!1)},_handleSelectionChange:function(){if(this._imeOffset===-1)if(d.isAndroid){var g=this._getWindow();this._selTimer&&g.clearTimeout(this._selTimer);var a=this;this._selTimer=g.setTimeout(function(){if(a._clientDiv)a._selTimer=null,a._updateSelectionFromDOM()},250)}else this._updateSelectionFromDOM()},_handleTextInput:function(g){if(!this._ignoreEvent(g)){this._imeOffset=-1;if(d.isAndroid){for(var a=
+this._getWindow().getSelection(),c=a.anchorNode;c;){if(c.lineIndex!==void 0)break;c=c.parentNode}if(c){var b=this._model,i=c.lineIndex,f=b.getLine(i),m=f,n=0,b=b.getLineStart(i);if(a.rangeCount>0)a.getRangeAt(0).deleteContents(),i=c.ownerDocument.createTextNode(g.data),a.getRangeAt(0).insertNode(i),n=this._getDOMText(c,i),m=n.text,n=n.offset,i.parentNode.removeChild(i);c.lineRemoved=!0;for(c=0;f.charCodeAt(c)===m.charCodeAt(c)&&c<n;)c++;a=f.length-1;for(i=m.length-f.length;f.charCodeAt(a)===m.charCodeAt(a+
+i)&&a+i>=n+g.data.length;)a--;a++;f=m.substring(c,a+i);c+=b;a+=b;this._modifyContent({text:f,start:c,end:a,_ignoreDOMSelection:!0},!0)}}else this._doContent(g.data);g.preventDefault()}},_handleTouchStart:function(g){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=g.touches;if(c.length===1){var c=c[0],b=c.clientX,i=c.clientY;this._touchStartX=
+b;this._touchStartY=i;if(d.isAndroid&&(i<c.pageY-a.pageYOffset||b<c.pageX-a.pageXOffset))b=c.pageX-a.pageXOffset,i=c.pageY-a.pageYOffset;a=this.convert({x:b,y:i},"page","document");this._lastTouchOffset=this.getOffsetAtLocation(a.x,a.y);this._touchStartTime=g.timeStamp;this._touching=!0}},_handleTouchMove:function(g){var a=g.touches;if(a.length===1){a=a[0];this._touchCurrentX=a.clientX;this._touchCurrentY=a.clientY;if(!this._touchScrollTimer&&g.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 g=0,a=0;if(c._touching)g=c._touchStartX-c._touchCurrentX,a=c._touchStartY-c._touchCurrentY,c._touchSpeedX=g/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 g=c._touchSpeedX*10,a=c._touchSpeedY*10,c._touchSpeedX*=0.95,c._touchSpeedY*=0.95;c._scrollView(g,a)},10)}this._touchScrollTimer&&g.preventDefault()}},_handleTouchEnd:function(g){if(g.touches.length===0)this._touching=!1},_doAction:function(g){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(g),a!==void 0))return this.invokeAction(a);return!1},_doBackspace:function(g){var a=this._getSelection();if(a.isEmpty()){var c=
+this._model,d=a.getCaret(),b=c.getLineAtOffset(d);if(!g.count)g.count=1;for(g.count*=-1;g.count!==0;){var i=c.getLineStart(b);if(d===i)b>0&&(g.unit==="character"&&g.count++,b--,a.extend(c.getLineEnd(b)));else{var f=!1;this._expandTab&&g.unit==="character"&&(d-i)%this._tabSize===0&&(f=!/[^ ]/.test(c.getText(i,d)));f?a.extend(d-this._tabSize):(i=this._getLine(b),a.extend(i.getNextOffset(d,g)),i.destroy())}d=a.getCaret()}}this._modifyContent({text:"",start:a.start,end:a.end},!0);return!0},_doContent:function(g){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:g,start:a.start,end:a.end,_ignoreDOMSelection:!0},!0)},_doCopy:function(a){var c=this._getSelection();return!c.isEmpty()?this._setClipboardText(this._getBaseText(c.start,c.end),a):!0},_doCursorNext:function(a){if(!a.select&&this._clearSelection("next"))return!0;
+var c=this._model,d=this._getSelection(),b=d.getCaret(),i=c.getLineAtOffset(b);if(!a.count)a.count=1;for(;a.count!==0;){if(b===c.getLineEnd(i))if(i+1<c.getLineCount())a.unit==="character"&&a.count--,i++,d.extend(c.getLineStart(i));else break;else{var f=this._getLine(i);d.extend(f.getNextOffset(b,a));f.destroy()}b=d.getCaret()}a.select||d.collapse();this._setSelection(d,!0);return!0},_doCursorPrevious:function(a){if(!a.select&&this._clearSelection("previous"))return!0;var c=this._model,d=this._getSelection(),
+b=d.getCaret(),i=c.getLineAtOffset(b);if(!a.count)a.count=1;for(a.count*=-1;a.count!==0;){if(b===c.getLineStart(i))if(i>0)a.unit==="character"&&a.count++,i--,d.extend(c.getLineEnd(i));else break;else{var f=this._getLine(i);d.extend(f.getNextOffset(b,a));f.destroy()}b=d.getCaret()}a.select||d.collapse();this._setSelection(d,!0);return!0},_doCut:function(a){var c=this._getSelection();return!c.isEmpty()?(c=this._getBaseText(c.start,c.end),this._doContent(""),this._setClipboardText(c,a)):!0},_doDelete:function(a){var c=
+this._getSelection();if(c.isEmpty()){var d=this._model,b=c.getCaret(),i=d.getLineAtOffset(b);if(!a.count)a.count=1;for(;a.count!==0;){if(b===d.getLineEnd(i))i+1<d.getLineCount()&&(a.unit==="character"&&a.count--,i++,c.extend(d.getLineStart(i)));else{var f=this._getLine(i);c.extend(f.getNextOffset(b,a));f.destroy()}b=c.getCaret()}}this._modifyContent({text:"",start:c.start,end:c.end},!0);return!0},_doEnd:function(a){var c=this._getSelection(),d=this._model,b;if(a.ctrl)c.extend(d.getCharCount()),b=
+function(){};else{var i=c.getCaret(),f=d.getLineAtOffset(i);if(this._wrapMode){var m=this._getLine(f),i=m.getLineIndex(i),i=i===m.getLineCount()-1?d.getLineEnd(f):m.getLineStart(i+1)-1;m.destroy()}else i=d.getLineEnd(f);c.extend(i)}a.select||c.collapse();this._setSelection(c,!0,!0,b);return!0},_doEnter:function(a){var c=this._model,d=this._getSelection();this._doContent(c.getLineDelimiter());if(a&&a.noCursor)d.end=d.start,this._setSelection(d,!0);return!0},_doHome:function(a){var c=this._getSelection(),
+d=this._model,b;if(a.ctrl)c.extend(0),b=function(){};else{var i=c.getCaret(),f=d.getLineAtOffset(i);this._wrapMode?(d=this._getLine(f),i=d.getLineIndex(i),i=d.getLineStart(i),d.destroy()):i=d.getLineStart(f);c.extend(i)}a.select||c.collapse();this._setSelection(c,!0,!0,b);return!0},_doLineDown:function(a){var c=this._model,b=this._getSelection(),i=b.getCaret(),f=c.getLineAtOffset(i),m=this._getLine(f),n=this._columnX,l=1,e=!1;if(n===-1||a.wholeLine||a.select&&d.isIE)n=a.wholeLine?c.getLineEnd(f+1):
+i,n=m.getBoundingClientRect(n).left;(i=m.getLineIndex(i))<m.getLineCount()-1?l=m.getClientRects(i+1).top+1:(i=c.getLineCount()-1,e=f===i,a.count&&a.count>0?f=Math.min(f+a.count,i):f++);i=!1;if(e){if(a.select||d.isMac||d.isLinux)b.extend(c.getCharCount()),i=!0}else m.lineIndex!==f&&(m.destroy(),m=this._getLine(f)),b.extend(m.getOffset(n,l)),i=!0;i&&(a.select||b.collapse(),this._setSelection(b,!0,!0));this._columnX=n;m.destroy();return!0},_doLineUp:function(a){var c=this._model,b=this._getSelection(),
+i=b.getCaret(),f=c.getLineAtOffset(i),m=this._getLine(f),n=this._columnX,l=!1,e;if(n===-1||a.wholeLine||a.select&&d.isIE)n=a.wholeLine?c.getLineStart(f-1):i,n=m.getBoundingClientRect(n).left;(i=m.getLineIndex(i))>0?e=m.getClientRects(i-1).top+1:(l=f===0,l||(a.count&&a.count>0?f=Math.max(f-a.count,0):f--,e=this._getLineHeight(f)-1));i=!1;if(l){if(a.select||d.isMac||d.isLinux)b.extend(0),i=!0}else m.lineIndex!==f&&(m.destroy(),m=this._getLine(f)),b.extend(m.getOffset(n,e)),i=!0;i&&(a.select||b.collapse(),
+this._setSelection(b,!0,!0));this._columnX=n;m.destroy();return!0},_doNoop:function(){return!0},_doPageDown:function(a){var c=this,b=this._model,i=this._getSelection(),f=i.getCaret(),m=b.getLineAtOffset(f),n=b.getLineCount(),l=this._getScroll(),b=this._getClientHeight(),e,h;if(this._lineHeight){e=this._columnX;l=this._getBoundsAtOffset(f);if(e===-1||a.select&&d.isIE)e=l.left;f=this._getLineIndex(l.top+b);h=this._getLine(f);m=this._getLinePixel(f);f=h.getOffset(e,l.top+b-m);b=h.getBoundingClientRect(f);
+h.destroy();i.extend(f);a.select||i.collapse();this._setSelection(i,!0,!0,function(){c._columnX=e},b.top+m-l.top);return!0}if(m<n-1){var j=this._getLineHeight(),r=Math.min(n-m-1,Math.floor(b/j)),r=Math.max(1,r);e=this._columnX;if(e===-1||a.select&&d.isIE)h=this._getLine(m),e=h.getBoundingClientRect(f).left,h.destroy();h=this._getLine(m+r);i.extend(h.getOffset(e,0));h.destroy();a.select||i.collapse();a=n*j;f=l.y+r*j;f+b>a&&(f=a-b);this._setSelection(i,!0,!0,function(){c._columnX=e},f-l.y)}return!0},
+_doPageUp:function(a){var c=this,b=this._model,i=this._getSelection(),f=i.getCaret(),m=b.getLineAtOffset(f),n=this._getScroll(),l=this._getClientHeight(),e;if(this._lineHeight){e=this._columnX;n=this._getBoundsAtOffset(f);if(e===-1||a.select&&d.isIE)e=n.left;f=this._getLineIndex(n.bottom-l);b=this._getLine(f);m=this._getLinePixel(f);f=b.getOffset(e,n.bottom-l-m);l=b.getBoundingClientRect(f);b.destroy();i.extend(f);a.select||i.collapse();this._setSelection(i,!0,!0,function(){c._columnX=e},l.top+m-
+n.top);return!0}if(m>0){var h=this._getLineHeight(),l=Math.max(1,Math.min(m,Math.floor(l/h)));e=this._columnX;if(e===-1||a.select&&d.isIE)b=this._getLine(m),e=b.getBoundingClientRect(f).left,b.destroy();b=this._getLine(m-l);i.extend(b.getOffset(e,this._getLineHeight(m-l)-1));b.destroy();a.select||i.collapse();a=Math.max(0,n.y-l*h);this._setSelection(i,!0,!0,function(){c._columnX=e},a-n.y)}return!0},_doPaste:function(a){var c=this;return this._getClipboardText(a,function(a){a&&(d.isLinux&&c._lastMouseButton===
+2&&(new Date).getTime()-c._lastMouseTime<=c._clickTime&&c._setSelectionTo(c._lastMouseX,c._lastMouseY),c._doContent(a))})!==null},_doScroll:function(a){var c=a.type,d=this._model,b=d.getLineCount(),a=this._getClientHeight(),i=this._getLineHeight();b*=i;var f=this._getScroll().y,m;switch(c){case "textStart":m=0;break;case "textEnd":m=b-a;break;case "pageDown":m=f+a;break;case "pageUp":m=f-a;break;case "lineDown":m=f+i;break;case "lineUp":m=f-i;break;case "centerLine":c=this._getSelection(),m=d.getLineAtOffset(c.start),
+d=(d.getLineAtOffset(c.end)-m+1)*i,m=m*i-a/2+d/2}m!==void 0&&(m=Math.min(Math.max(0,m),b-a),this._scrollViewAnimated(0,m-f,function(){}));return!0},_doSelectAll:function(){var a=this._model,c=this._getSelection();c.setCaret(0);c.extend(a.getCharCount());this._setSelection(c,!1);return!0},_doTab:function(){if(this._tabMode&&!this._readonly){var a="\t";if(this._expandTab)var c=this._model,a=this._getSelection().getCaret(),d=c.getLineAtOffset(a),c=c.getLineStart(d),a=Array(this._tabSize-(a-c)%this._tabSize+
+1).join(" ");this._doContent(a);return!0}},_doShiftTab:function(){return!this._tabMode||this._readonly?void 0:!0},_doOverwriteMode:function(){if(!this._readonly)return this.setOptions({overwriteMode:!this.getOptions("overwriteMode")}),!0},_doTabMode:function(){this._tabMode=!this._tabMode;return!0},_doWrapMode:function(){this.setOptions({wrapMode:!this.getOptions("wrapMode")});return!0},_autoScroll:function(){var a=this._model,c=this._getSelection(),b=this.convert({x:this._autoScrollX,y:this._autoScrollY},
+"page","document"),i=c.getCaret(),f=a.getLineCount(),m=a.getLineAtOffset(i),n;if(this._autoScrollDir==="up"||this._autoScrollDir==="down")i=this._autoScrollY/this._getLineHeight(),i=i<0?Math.floor(i):Math.ceil(i),n=Math.max(0,Math.min(f-1,m+i));else if(this._autoScrollDir==="left"||this._autoScrollDir==="right")n=this._getLineIndex(b.y),m=this._getLine(m),b.x+=m.getBoundingClientRect(i,!1).left,m.destroy();n===0&&(d.isMac||d.isLinux)?c.extend(0):n===f-1&&(d.isMac||d.isLinux)?c.extend(a.getCharCount()):
+(m=this._getLine(n),c.extend(m.getOffset(b.x,b.y-this._getLinePixel(n))),m.destroy());this._setSelection(c,!0)},_autoScrollTimer:function(){this._autoScroll();var a=this;this._autoScrollTimerID=this._getWindow().setTimeout(function(){a._autoScrollTimer()},this._AUTO_SCROLL_RATE)},_calculateLineHeightTimer:function(a){if(this._lineHeight&&!this._calculateLHTimer){var c=this._model.getLineCount(),b=0;if(a){for(var a=0,d=(new Date).getTime(),i=0;b<c;)if(this._lineHeight[b]||(a++,i||(i=b),this._lineHeight[b]=
+this._calculateLineHeight(b)),b++,(new Date).getTime()-d>100)break;this.redrawRulers(0,c);this._queueUpdate()}a=this._getWindow();if(b!==c){var f=this;this._calculateLHTimer=a.setTimeout(function(){f._calculateLHTimer=null;f._calculateLineHeightTimer(!0)},0)}else if(this._calculateLHTimer)a.clearTimeout(this._calculateLHTimer),this._calculateLHTimer=void 0}},_calculateLineHeight:function(a){var a=this._getLine(a),c=a.getBoundingClientRect();a.destroy();return Math.max(1,Math.ceil(c.bottom-c.top))},
+_calculateMetrics:function(){var a=this._clientDiv,c=a.ownerDocument,b=d.createElement(c,"div");b.style.lineHeight="normal";var i={type:"LineStyle",textView:this,0:0,lineText:this._model.getLine(0),lineStart:0};this.onLineStyle(i);j(i.style,b);b.style.position="fixed";b.style.left="-1000px";var f=d.createElement(c,"span");f.appendChild(c.createTextNode(" "));b.appendChild(f);var l=d.createElement(c,"span");l.style.fontStyle="italic";l.appendChild(c.createTextNode(" "));b.appendChild(l);var e=d.createElement(c,
+"span");e.style.fontWeight="bold";e.appendChild(c.createTextNode(" "));b.appendChild(e);i=d.createElement(c,"span");i.style.fontWeight="bold";i.style.fontStyle="italic";i.appendChild(c.createTextNode(" "));b.appendChild(i);a.appendChild(b);var h=b.getBoundingClientRect(),f=f.getBoundingClientRect(),l=l.getBoundingClientRect(),e=e.getBoundingClientRect(),i=i.getBoundingClientRect(),f=f.bottom-f.top,l=l.bottom-l.top,e=e.bottom-e.top,r=i.bottom-i.top,q=0,i=h.bottom-h.top<=0,h=Math.max(1,h.bottom-h.top);
+l>f&&(q=1);e>l&&(q=2);r>e&&(q=3);var k;if(q!==0){k={style:{}};if((q&1)!==0)k.style.fontStyle="italic";if((q&2)!==0)k.style.fontWeight="bold"}f=n(b);a.removeChild(b);l=m(this._viewDiv);b=d.createElement(c,"div");b.style.position="fixed";b.style.left="-1000px";b.style.paddingLeft=l.left+"px";b.style.paddingTop=l.top+"px";b.style.paddingRight=l.right+"px";b.style.paddingBottom=l.bottom+"px";b.style.width="100px";b.style.height="100px";e=d.createElement(c,"div");e.style.width="100%";e.style.height="100%";
+b.appendChild(e);a.appendChild(b);c=b.getBoundingClientRect();l=e.getBoundingClientRect();b.style.overflow="hidden";e.style.height="200px";e=b.clientWidth;b.style.overflow="scroll";r=b.clientWidth;a.removeChild(b);l={left:l.left-c.left,top:l.top-c.top,right:c.right-l.right,bottom:c.bottom-l.bottom};return{lineHeight:h,largestFontStyle:k,lineTrim:f,viewPadding:l,scrollWidth:e-r,invalid:i}},_cancelAnimation:function(){if(this._animation)this._animation.stop(),this._animation=null},_clearSelection:function(a){var c=
+this._getSelection();if(c.isEmpty())return!1;a==="next"?c.start=c.end:c.end=c.start;this._setSelection(c,!0);return!0},_commitIME:function(){if(this._imeOffset!==-1){this._scrollDiv.focus();this._clientDiv.focus();var a=this._model,c=a.getLineAtOffset(this._imeOffset),b=a.getLineStart(c),d=this._getDOMText(this._getLineNode(c)).text,a=a.getLine(c),b=this._imeOffset-b,a=b+d.length-a.length;b!==a&&this._doContent(d.substring(b,a));this._imeOffset=-1}},_createActions:function(){this.addKeyMode(new o.DefaultKeyMode);
+var g=this;this._actions={noop:{defaultHandler:function(){return g._doNoop()}},lineUp:{defaultHandler:function(c){return g._doLineUp(a(c,{select:!1}))},actionDescription:{name:k.lineUp}},lineDown:{defaultHandler:function(c){return g._doLineDown(a(c,{select:!1}))},actionDescription:{name:k.lineDown}},lineStart:{defaultHandler:function(c){return g._doHome(a(c,{select:!1,ctrl:!1}))},actionDescription:{name:k.lineStart}},lineEnd:{defaultHandler:function(c){return g._doEnd(a(c,{select:!1,ctrl:!1}))},actionDescription:{name:k.lineEnd}},
+charPrevious:{defaultHandler:function(c){return g._doCursorPrevious(a(c,{select:!1,unit:"character"}))},actionDescription:{name:k.charPrevious}},charNext:{defaultHandler:function(c){return g._doCursorNext(a(c,{select:!1,unit:"character"}))},actionDescription:{name:k.charNext}},pageUp:{defaultHandler:function(c){return g._doPageUp(a(c,{select:!1}))},actionDescription:{name:k.pageUp}},pageDown:{defaultHandler:function(c){return g._doPageDown(a(c,{select:!1}))},actionDescription:{name:k.pageDown}},scrollPageUp:{defaultHandler:function(c){return g._doScroll(a(c,
+{type:"pageUp"}))},actionDescription:{name:k.scrollPageUp}},scrollPageDown:{defaultHandler:function(c){return g._doScroll(a(c,{type:"pageDown"}))},actionDescription:{name:k.scrollPageDown}},scrollLineUp:{defaultHandler:function(c){return g._doScroll(a(c,{type:"lineUp"}))},actionDescription:{name:k.scrollLineUp}},scrollLineDown:{defaultHandler:function(c){return g._doScroll(a(c,{type:"lineDown"}))},actionDescription:{name:k.scrollLineDown}},wordPrevious:{defaultHandler:function(c){return g._doCursorPrevious(a(c,
+{select:!1,unit:"word"}))},actionDescription:{name:k.wordPrevious}},wordNext:{defaultHandler:function(c){return g._doCursorNext(a(c,{select:!1,unit:"word"}))},actionDescription:{name:k.wordNext}},textStart:{defaultHandler:function(c){return g._doHome(a(c,{select:!1,ctrl:!0}))},actionDescription:{name:k.textStart}},textEnd:{defaultHandler:function(c){return g._doEnd(a(c,{select:!1,ctrl:!0}))},actionDescription:{name:k.textEnd}},scrollTextStart:{defaultHandler:function(c){return g._doScroll(a(c,{type:"textStart"}))},
+actionDescription:{name:k.scrollTextStart}},scrollTextEnd:{defaultHandler:function(c){return g._doScroll(a(c,{type:"textEnd"}))},actionDescription:{name:k.scrollTextEnd}},centerLine:{defaultHandler:function(c){return g._doScroll(a(c,{type:"centerLine"}))},actionDescription:{name:k.centerLine}},selectLineUp:{defaultHandler:function(c){return g._doLineUp(a(c,{select:!0}))},actionDescription:{name:k.selectLineUp}},selectLineDown:{defaultHandler:function(c){return g._doLineDown(a(c,{select:!0}))},actionDescription:{name:k.selectLineDown}},
+selectWholeLineUp:{defaultHandler:function(c){return g._doLineUp(a(c,{select:!0,wholeLine:!0}))},actionDescription:{name:k.selectWholeLineUp}},selectWholeLineDown:{defaultHandler:function(c){return g._doLineDown(a(c,{select:!0,wholeLine:!0}))},actionDescription:{name:k.selectWholeLineDown}},selectLineStart:{defaultHandler:function(c){return g._doHome(a(c,{select:!0,ctrl:!1}))},actionDescription:{name:k.selectLineStart}},selectLineEnd:{defaultHandler:function(c){return g._doEnd(a(c,{select:!0,ctrl:!1}))},
+actionDescription:{name:k.selectLineEnd}},selectCharPrevious:{defaultHandler:function(c){return g._doCursorPrevious(a(c,{select:!0,unit:"character"}))},actionDescription:{name:k.selectCharPrevious}},selectCharNext:{defaultHandler:function(c){return g._doCursorNext(a(c,{select:!0,unit:"character"}))},actionDescription:{name:k.selectCharNext}},selectPageUp:{defaultHandler:function(c){return g._doPageUp(a(c,{select:!0}))},actionDescription:{name:k.selectPageUp}},selectPageDown:{defaultHandler:function(c){return g._doPageDown(a(c,
+{select:!0}))},actionDescription:{name:k.selectPageDown}},selectWordPrevious:{defaultHandler:function(c){return g._doCursorPrevious(a(c,{select:!0,unit:"word"}))},actionDescription:{name:k.selectWordPrevious}},selectWordNext:{defaultHandler:function(c){return g._doCursorNext(a(c,{select:!0,unit:"word"}))},actionDescription:{name:k.selectWordNext}},selectTextStart:{defaultHandler:function(c){return g._doHome(a(c,{select:!0,ctrl:!0}))},actionDescription:{name:k.selectTextStart}},selectTextEnd:{defaultHandler:function(c){return g._doEnd(a(c,
+{select:!0,ctrl:!0}))},actionDescription:{name:k.selectTextEnd}},deletePrevious:{defaultHandler:function(c){return g._doBackspace(a(c,{unit:"character"}))},actionDescription:{name:k.deletePrevious}},deleteNext:{defaultHandler:function(c){return g._doDelete(a(c,{unit:"character"}))},actionDescription:{name:k.deleteNext}},deleteWordPrevious:{defaultHandler:function(c){return g._doBackspace(a(c,{unit:"word"}))},actionDescription:{name:k.deleteWordPrevious}},deleteWordNext:{defaultHandler:function(c){return g._doDelete(a(c,
+{unit:"word"}))},actionDescription:{name:k.deleteWordNext}},deleteLineStart:{defaultHandler:function(c){return g._doBackspace(a(c,{unit:"line"}))},actionDescription:{name:k.deleteLineStart}},deleteLineEnd:{defaultHandler:function(c){return g._doDelete(a(c,{unit:"line"}))},actionDescription:{name:k.deleteLineEnd}},tab:{defaultHandler:function(){return g._doTab()},actionDescription:{name:k.tab}},shiftTab:{defaultHandler:function(){return g._doShiftTab()},actionDescription:{name:k.shiftTab}},enter:{defaultHandler:function(){return g._doEnter()},
+actionDescription:{name:k.enter}},enterNoCursor:{defaultHandler:function(c){return g._doEnter(a(c,{noCursor:!0}))},actionDescription:{name:k.enterNoCursor}},selectAll:{defaultHandler:function(){return g._doSelectAll()},actionDescription:{name:k.selectAll}},copy:{defaultHandler:function(){return g._doCopy()},actionDescription:{name:k.copy}},cut:{defaultHandler:function(){return g._doCut()},actionDescription:{name:k.cut}},paste:{defaultHandler:function(){return g._doPaste()},actionDescription:{name:k.paste}},
+toggleOverwriteMode:{defaultHandler:function(){return g._doOverwriteMode()},actionDescription:{name:k.toggleOverwriteMode}},toggleTabMode:{defaultHandler:function(){return g._doTabMode()},actionDescription:{name:k.toggleTabMode}},toggleWrapMode:{defaultHandler:function(){return g._doWrapMode()},actionDescription:{name:k.toggleWrapMode}}}},_createRuler:function(a,c){if(this._clientDiv){var b=a.getLocation()==="left"?this._leftDiv:this._rightDiv;b.style.display="block";var i=d.createElement(b.ownerDocument,
+"div");i._ruler=a;i.rulerChanged=!0;i.style.position="relative";i.style.cssFloat="left";i.style.styleFloat="left";i.style.borderWidth="0px";i.style.margin="0px";i.style.padding="0px";i.style.outline="none";if(c===void 0||c<0||c>=b.children.length)b.appendChild(i);else{for(var f=b.firstChild;f&&--c>0;)f=f.nextSibling;b.insertBefore(i,f)}}},_createView:function(){if(!this._clientDiv){for(var a=this._parent;a.hasChildNodes();)a.removeChild(a.lastChild);var c=a.ownerDocument,b=d.createElement(c,"div");
+this._rootDiv=b;b.tabIndex=-1;b.style.position="relative";b.style.overflow="hidden";b.style.width="100%";b.style.height="100%";b.style.overflow="hidden";b.style.WebkitTextSizeAdjust="100%";b.setAttribute("role","application");a.appendChild(b);a=d.createElement(c,"div");a.className="textviewLeftRuler";this._leftDiv=a;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");b.appendChild(a);a=d.createElement(c,"div");a.className="textviewScroll";this._viewDiv=a;a.tabIndex=-1;a.style.overflow="auto";a.style.position="absolute";a.style.top="0px";a.style.bottom="0px";a.style.borderWidth="0px";a.style.margin="0px";a.style.outline="none";a.style.background="transparent";if(d.isMac&&d.isWebkit)a.style.pointerEvents="none",a.style.zIndex="2";b.appendChild(a);var i=d.createElement(c,"div");i.className="textviewRightRuler";
+this._rightDiv=i;i.tabIndex=-1;i.style.display="none";i.style.overflow="hidden";i.style.MozUserSelect="none";i.style.WebkitUserSelect="none";i.style.position="absolute";i.style.top="0px";i.style.bottom="0px";i.style.cursor="default";i.style.right="0px";i.setAttribute("aria-hidden","true");b.appendChild(i);this._scrollDiv=i=d.createElement(c,"div");i.style.margin="0px";i.style.borderWidth="0px";i.style.padding="0px";a.appendChild(i);if(d.isFirefox)this._clipboardDiv=a=d.createElement(c,"div"),a.style.position=
+"fixed",a.style.whiteSpace="pre",a.style.left="-1000px",b.appendChild(a);if(!d.isIE&&!d.isIOS)this._clipDiv=a=d.createElement(c,"div"),a.style.position="absolute",a.style.overflow="hidden",a.style.margin="0px",a.style.borderWidth="0px",a.style.padding="0px",a.style.background="transparent",b.appendChild(a),this._clipScrollDiv=i=d.createElement(c,"div"),i.style.position="absolute",i.style.height="1px",i.style.top="-1000px",i.style.background="transparent",a.appendChild(i);this._setFullSelection(this._fullSelection,
+!0);a=d.createElement(c,"div");a.className="textviewContent";this._clientDiv=a;a.style.position="absolute";a.style.borderWidth="0px";a.style.margin="0px";a.style.padding="0px";a.style.outline="none";a.style.zIndex="1";a.style.WebkitUserSelect="text";a.setAttribute("spellcheck","false");if(d.isIOS||d.isAndroid)a.style.WebkitTapHighlightColor="transparent";(this._clipDiv||b).appendChild(a);if(d.isIOS||d.isAndroid)this._vScrollDiv=i=d.createElement(c,"div"),i.style.position="absolute",i.style.borderWidth=
+"1px",i.style.borderColor="white",i.style.borderStyle="solid",i.style.borderRadius="4px",i.style.backgroundColor="black",i.style.opacity="0.5",i.style.margin="0px",i.style.padding="0px",i.style.outline="none",i.style.zIndex="3",i.style.width="8px",i.style.display="none",b.appendChild(i),this._hScrollDiv=i=d.createElement(c,"div"),i.style.position="absolute",i.style.borderWidth="1px",i.style.borderColor="white",i.style.borderStyle="solid",i.style.borderRadius="4px",i.style.backgroundColor="black",
+i.style.opacity="0.5",i.style.margin="0px",i.style.padding="0px",i.style.outline="none",i.style.zIndex="3",i.style.height="8px",i.style.display="none",b.appendChild(i);if(d.isFirefox&&!a.setCapture)this._overlayDiv=c=d.createElement(c,"div"),c.style.position=a.style.position,c.style.borderWidth=a.style.borderWidth,c.style.margin=a.style.margin,c.style.padding=a.style.padding,c.style.cursor="text",c.style.zIndex="2",(this._clipDiv||b).appendChild(c);a.contentEditable="true";a.setAttribute("role","textbox");
+a.setAttribute("aria-multiline","true");this._setWrapMode(this._wrapMode,!0);this._setReadOnly(this._readonly);this._setThemeClass(this._themeClass,!0);this._setTabSize(this._tabSize,!0);this._hookEvents();b=this._rulers;for(c=0;c<b.length;c++)this._createRuler(b[c]);this._update()}},_defaultOptions:function(){return{parent:{value:void 0,update:null},model:{value:void 0,update:this.setModel},scrollAnimation:{value:0,update:null},readonly:{value:!1,update:this._setReadOnly},fullSelection:{value:!0,
+update:this._setFullSelection},tabMode:{value:!0,update:null},tabSize:{value:8,update:this._setTabSize},expandTab:{value:!1,update:null},overwriteMode:{value:!1,update:this._setOverwriteMode},blockCursorVisible:{value:!1,update:this._setBlockCursor},wrapMode:{value:!1,update:this._setWrapMode},wrappable:{value:!1,update:null},theme:{value:b.TextTheme.getTheme(),update:this._setTheme},themeClass:{value:void 0,update:this._setThemeClass}}},_destroyRuler:function(a){var c=a.getLocation()==="left"?this._leftDiv:
+this._rightDiv;if(c)for(var b=c.firstChild;b;){if(b._ruler===a){b._ruler=void 0;c.removeChild(b);if(c.children.length===0)c.style.display="none";break}b=b.nextSibling}},_destroyView:function(){if(this._clientDiv){this._setGrab(null);this._unhookEvents();var a=this._getWindow();if(this._autoScrollTimerID)a.clearTimeout(this._autoScrollTimerID),this._autoScrollTimerID=null;if(this._updateTimer)a.clearTimeout(this._updateTimer),this._updateTimer=null;a=this._rootDiv;a.parentNode.removeChild(a);this._hScrollDiv=
+this._vScrollDiv=this._rightDiv=this._leftDiv=this._overlayDiv=this._clientDiv=this._clipScrollDiv=this._clipDiv=this._viewDiv=this._scrollDiv=this._rootDiv=this._clipboardDiv=this._selDiv3=this._selDiv2=this._selDiv1=null}},_doAutoScroll:function(a,c,b){this._autoScrollDir=a;this._autoScrollX=c;this._autoScrollY=b;this._autoScrollTimerID||this._autoScrollTimer()},_endAutoScroll:function(){this._autoScrollTimerID&&this._getWindow().clearTimeout(this._autoScrollTimerID);this._autoScrollTimerID=this._autoScrollDir=
+void 0},_fixCaret:function(){var a=this._clientDiv;if(a){var c=this._hasFocus;this._ignoreFocus=!0;c&&a.blur();a.contentEditable=!1;a.contentEditable=!0;c&&a.focus();this._ignoreFocus=!1}},_getBaseText:function(a,c){var b=this._model;b.getBaseModel&&(a=b.mapOffset(a),c=b.mapOffset(c),b=b.getBaseModel());return b.getText(a,c)},_getBottomIndex:function(a){var c=this._bottomChild;if(a&&this._getClientHeight()>this._getLineHeight()){var a=c.getBoundingClientRect(),b=this._clientDiv.getBoundingClientRect();
+a.bottom>b.bottom&&(c=this._getLinePrevious(c)||c)}return c.lineIndex},_getBoundsAtOffset:function(a){var c=this._getLine(this._model.getLineAtOffset(a)),a=c.getBoundingClientRect(a),b=this._getLinePixel(c.lineIndex);a.top+=b;a.bottom+=b;c.destroy();return a},_getClientHeight:function(){var a=this._getViewPadding();return Math.max(0,this._viewDiv.clientHeight-a.top-a.bottom)},_getClientWidth:function(){var a=this._getViewPadding();return Math.max(0,this._viewDiv.clientWidth-a.left-a.right)},_getClipboardText:function(a,
+c){var b=this._model.getLineDelimiter(),f,m,n=this._getWindow();if(n.clipboardData)return f=[],m=n.clipboardData.getData("Text"),i(m,function(a){f.push(a)},function(){f.push(b)}),m=f.join(""),c&&c(m),m;if(d.isFirefox){this._ignoreFocus=!0;var l=this._clipboardDiv;l.innerHTML="<pre contenteditable=''></pre>";l.firstChild.focus();var e=this,h=function(){var a=e._getTextFromElement(l);l.innerHTML="";f=[];i(a,function(a){f.push(a)},function(){f.push(b)});return f.join("")},j=!1;this._ignorePaste=!0;if(!d.isLinux||
+this._lastMouseButton!==2)try{j=l.ownerDocument.execCommand("paste",!1,null)}catch(r){j=l.childNodes.length>1||l.firstChild&&l.firstChild.childNodes.length>0}this._ignorePaste=!1;if(!j)return a?(n.setTimeout(function(){e.focus();(m=h())&&c&&c(m);e._ignoreFocus=!1},0),null):(this.focus(),this._ignoreFocus=!1,"");this.focus();this._ignoreFocus=!1;(m=h())&&c&&c(m);return m}return a&&a.clipboardData?(f=[],m=a.clipboardData.getData("text/plain"),i(m,function(a){f.push(a)},function(){f.push(b)}),(m=f.join(""))&&
+c&&c(m),m):""},_getDOMText:function(a,c){for(var b=a.firstChild,d="",i=0;b;){var f;if(!b.ignore)if(b.ignoreChars){f=b.lastChild;for(var m=0,n=[],l=-1;f;){for(var e=f.data,h=e.length-1;h>=0;h--){var j=e.substring(h,h+1);m<b.ignoreChars&&(j===" "||j==="\u200c"||j==="\ufeff")?m++:n.push(j==="\u00a0"?"\t":j)}if(c===f)l=n.length;f=f.previousSibling}n=n.reverse().join("");l!==-1&&(i=d.length+n.length-l);d+=n}else for(f=b.firstChild;f;){if(c===f)i=d.length;d+=f.data;f=f.nextSibling}b=b.nextSibling}return{text:d,
+offset:i}},_getTextFromElement:function(a){var c=a.ownerDocument,b=c.defaultView;if(!b.getSelection)return a.innerText||a.textContent;c=c.createRange();c.selectNode(a);var a=b.getSelection(),b=[],d;for(d=0;d<a.rangeCount;d++)b.push(a.getRangeAt(d));this._ignoreSelect=!0;a.removeAllRanges();a.addRange(c);c=a.toString();a.removeAllRanges();for(d=0;d<b.length;d++)a.addRange(b[d]);this._ignoreSelect=!1;return c},_getViewPadding:function(){return this._metrics.viewPadding},_getLine:function(a){var c=this._getLineNode(a);
+return c&&!c.lineChanged&&!c.lineRemoved?c._line:new q(this,a)},_getLineHeight:function(a,c){if(a!==void 0&&this._lineHeight){var b=this._lineHeight[a];if(b)return b;if(c||c===void 0)return this._lineHeight[a]=this._calculateLineHeight(a)}return this._metrics.lineHeight},_getLineNode:function(a){for(var c=this._clientDiv.firstChild;c;){if(a===c.lineIndex)return c;c=c.nextSibling}},_getLineNext:function(a){for(a=a?a.nextSibling:this._clientDiv.firstChild;a&&a.lineIndex===-1;)a=a.nextSibling;return a},
+_getLinePrevious:function(a){for(a=a?a.previousSibling:this._clientDiv.lastChild;a&&a.lineIndex===-1;)a=a.previousSibling;return a},_getLinePixel:function(a){a=Math.min(Math.max(0,a),this._model.getLineCount());if(this._lineHeight){var c=this._getTopIndex(),b=-this._topIndexY+this._getScroll().y;if(a>c)for(;c<a;c++)b+=this._getLineHeight(c);else for(c-=1;c>=a;c--)b-=this._getLineHeight(c);return b}return this._getLineHeight()*a},_getLineIndex:function(a){var c,b=0,d=this._model.getLineCount();if(this._lineHeight){var b=
+this._getTopIndex(),i=-this._topIndexY+this._getScroll().y;if(a!==i)if(a<i)for(;a<i&&b>0;)a+=this._getLineHeight(--b);else for(c=this._getLineHeight(b);a-c>=i&&b<d-1;)a-=c,c=this._getLineHeight(++b)}else c=this._getLineHeight(),b=Math.floor(a/c);return Math.max(0,Math.min(d-1,b))},_getScroll:function(a){(a===void 0||a)&&this._cancelAnimation();a=this._viewDiv;return{x:a.scrollLeft,y:a.scrollTop}},_getSelection:function(){return this._selection.clone()},_getTopIndex:function(a){var c=this._topChild;
+if(a&&this._getClientHeight()>this._getLineHeight()){var a=c.getBoundingClientRect(),b=this._getViewPadding(),d=this._viewDiv.getBoundingClientRect();a.top<d.top+b.top&&(c=this._getLineNext(c)||c)}return c.lineIndex},_hookEvents:function(){var a=this;this._modelListener={onChanging:function(c){a._onModelChanging(c)},onChanged:function(c){a._onModelChanged(c)}};this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);
+this._themeListener={onChanged:function(){a._setThemeClass(a._themeClass)}};this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);var c=this._handlers=[],b=this._clientDiv,i=this._viewDiv,f=this._rootDiv,m=this._overlayDiv||b,n=b.ownerDocument,l=this._getWindow(),e=d.isIE?n:l;c.push({target:l,type:"resize",handler:function(c){return a._handleResize(c?c:l.event)}});c.push({target:b,type:"blur",handler:function(c){return a._handleBlur(c?c:l.event)}});c.push({target:b,type:"focus",
+handler:function(c){return a._handleFocus(c?c:l.event)}});c.push({target:i,type:"focus",handler:function(){b.focus()}});c.push({target:i,type:"scroll",handler:function(c){return a._handleScroll(c?c:l.event)}});c.push({target:b,type:"textInput",handler:function(c){return a._handleTextInput(c?c:l.event)}});c.push({target:b,type:"keydown",handler:function(c){return a._handleKeyDown(c?c:l.event)}});c.push({target:b,type:"keypress",handler:function(c){return a._handleKeyPress(c?c:l.event)}});c.push({target:b,
+type:"keyup",handler:function(c){return a._handleKeyUp(c?c:l.event)}});c.push({target:b,type:"contextmenu",handler:function(c){return a._handleContextMenu(c?c:l.event)}});c.push({target:b,type:"copy",handler:function(c){return a._handleCopy(c?c:l.event)}});c.push({target:b,type:"cut",handler:function(c){return a._handleCut(c?c:l.event)}});c.push({target:b,type:"paste",handler:function(c){return a._handlePaste(c?c:l.event)}});if(d.isIOS||d.isAndroid)c.push({target:n,type:"selectionchange",handler:function(c){return a._handleSelectionChange(c?
+c:l.event)}}),c.push({target:b,type:"touchstart",handler:function(c){return a._handleTouchStart(c?c:l.event)}}),c.push({target:b,type:"touchmove",handler:function(c){return a._handleTouchMove(c?c:l.event)}}),c.push({target:b,type:"touchend",handler:function(c){return a._handleTouchEnd(c?c:l.event)}});else{c.push({target:b,type:"selectstart",handler:function(c){return a._handleSelectStart(c?c:l.event)}});c.push({target:b,type:"mousedown",handler:function(c){return a._handleMouseDown(c?c:l.event)}});
+c.push({target:b,type:"mouseover",handler:function(c){return a._handleMouseOver(c?c:l.event)}});c.push({target:b,type:"mouseout",handler:function(c){return a._handleMouseOut(c?c:l.event)}});c.push({target:e,type:"mouseup",handler:function(c){return a._handleMouseUp(c?c:l.event)}});c.push({target:e,type:"mousemove",handler:function(c){return a._handleMouseMove(c?c:l.event)}});c.push({target:f,type:"mousedown",handler:function(c){return a._handleRootMouseDown(c?c:l.event)}});c.push({target:f,type:"mouseup",
+handler:function(c){return a._handleRootMouseUp(c?c:l.event)}});c.push({target:m,type:"dragstart",handler:function(c){return a._handleDragStart(c?c:l.event)}});c.push({target:m,type:"drag",handler:function(c){return a._handleDrag(c?c:l.event)}});c.push({target:m,type:"dragend",handler:function(c){return a._handleDragEnd(c?c:l.event)}});c.push({target:m,type:"dragenter",handler:function(c){return a._handleDragEnter(c?c:l.event)}});c.push({target:m,type:"dragover",handler:function(c){return a._handleDragOver(c?
+c:l.event)}});c.push({target:m,type:"dragleave",handler:function(c){return a._handleDragLeave(c?c:l.event)}});c.push({target:m,type:"drop",handler:function(c){return a._handleDrop(c?c:l.event)}});c.push({target:this._clientDiv,type:d.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(c){return a._handleMouseWheel(c?c:l.event)}});if(d.isFirefox&&(!d.isWindows||d.isFirefox>=15))(i=l.MutationObserver||l.MozMutationObserver)?(this._mutationObserver=new i(function(c){a._handleDataModified(c)}),this._mutationObserver.observe(b,
+{subtree:!0,characterData:!0})):c.push({target:this._clientDiv,type:"DOMCharacterDataModified",handler:function(c){return a._handleDataModified(c?c:l.event)}});this._overlayDiv&&(c.push({target:this._overlayDiv,type:"mousedown",handler:function(c){return a._handleMouseDown(c?c:l.event)}}),c.push({target:this._overlayDiv,type:"mouseover",handler:function(c){return a._handleMouseOver(c?c:l.event)}}),c.push({target:this._overlayDiv,type:"mouseout",handler:function(c){return a._handleMouseOut(c?c:l.event)}}),
+c.push({target:this._overlayDiv,type:"contextmenu",handler:function(c){return a._handleContextMenu(c?c:l.event)}}));this._isW3CEvents||c.push({target:this._clientDiv,type:"dblclick",handler:function(c){return a._handleDblclick(c?c:l.event)}})}i=this._leftDiv;f=this._rightDiv;d.isIE&&c.push({target:i,type:"selectstart",handler:function(){return!1}});c.push({target:i,type:d.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(c){return a._handleMouseWheel(c?c:l.event)}});c.push({target:i,type:"click",
+handler:function(c){a._handleRulerEvent(c?c:l.event)}});c.push({target:i,type:"dblclick",handler:function(c){a._handleRulerEvent(c?c:l.event)}});c.push({target:i,type:"mousemove",handler:function(c){a._handleRulerEvent(c?c:l.event)}});c.push({target:i,type:"mouseover",handler:function(c){a._handleRulerEvent(c?c:l.event)}});c.push({target:i,type:"mouseout",handler:function(c){a._handleRulerEvent(c?c:l.event)}});d.isIE&&c.push({target:f,type:"selectstart",handler:function(){return!1}});c.push({target:f,
+type:d.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(c){return a._handleMouseWheel(c?c:l.event)}});c.push({target:f,type:"click",handler:function(c){a._handleRulerEvent(c?c:l.event)}});c.push({target:f,type:"dblclick",handler:function(c){a._handleRulerEvent(c?c:l.event)}});c.push({target:f,type:"mousemove",handler:function(c){a._handleRulerEvent(c?c:l.event)}});c.push({target:f,type:"mouseover",handler:function(c){a._handleRulerEvent(c?c:l.event)}});c.push({target:f,type:"mouseout",handler:function(c){a._handleRulerEvent(c?
+c:l.event)}});for(i=0;i<c.length;i++)f=c[i],h(f.target,f.type,f.handler,f.capture)},_getWindow:function(){return this._parent.ownerDocument.defaultView||this._parent.ownerDocument.parentWindow},_ignoreEvent:function(a){for(a=a.target;a&&a!==this._clientDiv;){if(a.ignore)return!0;a=a.parentNode}return!1},_init:function(a){var c=a.parent;typeof c==="string"&&(c=(a.document||document).getElementById(c));if(!c)throw"no parent";a.parent=c;a.model=a.model||new p.TextModel;var b=this._defaultOptions(),i;
+for(i in b)b.hasOwnProperty(i)&&(this["_"+i]=a[i]!==void 0?a[i]:b[i].value);this._keyModes=[];this._rulers=[];this._selection=new l(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=(!d.isIE||d.isIE>=9)&&typeof c.ownerDocument.createRange().getBoundingClientRect==="function";this._isW3CEvents=c.addEventListener;this._autoScrollTimerID=this._autoScrollY=
+this._autoScrollX=null;this._AUTO_SCROLL_RATE=50;this._mouseUpClosure=this._moseMoveClosure=this._grabControl=null;this._clickCount=this._lastMouseTime=this._lastMouseY=this._lastMouseX=0;this._clickTime=250;this._clickDist=5;this._isMouseDown=!1;this._doubleClickSelection=null;this._vScroll=this._hScroll=0;this._imeOffset=-1;this._createActions();this._createView()},_modifyContent:function(a,c){if(!this._readonly||a._code)if(a.type="Verify",this.onVerify(a),!(a.text===null||a.text===void 0)){var b=
+this._model;try{if(a._ignoreDOMSelection)this._ignoreDOMSelection=!0;b.setText(a.text,a.start,a.end)}finally{if(a._ignoreDOMSelection)this._ignoreDOMSelection=!1}c&&(b=this._getSelection(),b.setCaret(a.start+a.text.length),this._setSelection(b,!0));this.onModify({type:"Modify"})}},_onModelChanged:function(a){a.type="ModelChanged";this.onModelChanged(a);a.type="Changed";var c=a.start,b=a.addedCharCount,d=a.removedCharCount,i=a.addedLineCount,f=a.removedLineCount,m=this._getSelection();m.end>c&&(m.end>
+c&&m.start<c+d?m.setCaret(c+b):(m.start+=b-d,m.end+=b-d),this._setSelection(m,!1,!1));c=this._model.getLineAtOffset(c);for(b=this._getLineNext();b;){d=b.lineIndex;if(c<=d&&d<=c+f)c===d&&!b.modelChangedEvent&&!b.lineRemoved?(b.modelChangedEvent=a,b.lineChanged=!0):(b.lineRemoved=!0,b.lineChanged=!1,b.modelChangedEvent=null);if(d>c+f)b.lineIndex=d+i-f,b._line.lineIndex=b.lineIndex;b=this._getLineNext(b)}this._lineHeight&&(a=[c,f].concat(Array(i)),Array.prototype.splice.apply(this._lineHeight,a));if(!this._wrapMode&&
+c<=this._maxLineIndex&&this._maxLineIndex<=c+f)this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0;this._update()},_onModelChanging:function(a){a.type="ModelChanging";this.onModelChanging(a);a.type="Changing"},_queueUpdate:function(){if(!this._updateTimer&&!this._ignoreQueueUpdate){var a=this;this._updateTimer=this._getWindow().setTimeout(function(){a._updateTimer=null;a._update()},0)}},_resetLineHeight:function(a,c){if(this._wrapMode||this._variableLineHeight){if(a!==
+void 0&&c!==void 0)for(var b=a;b<c;b++)this._lineHeight[b]=void 0;else this._lineHeight=Array(this._model.getLineCount());this._calculateLineHeightTimer()}else this._lineHeight=null},_resetLineWidth:function(){var a=this._clientDiv;if(a)for(a=a.firstChild;a;)a.lineWidth=void 0,a=a.nextSibling},_reset:function(){this._maxLineIndex=-1;this._maxLineWidth=0;this._columnX=-1;this._bottomChild=this._topChild=null;this._topIndexY=0;this._variableLineHeight=!1;this._resetLineHeight();this._setSelection(new l(0,
+0,!1),!1,!1);if(this._viewDiv)this._viewDiv.scrollLeft=0,this._viewDiv.scrollTop=0;var a=this._clientDiv;if(a){for(var c=a.firstChild;c;)c.lineRemoved=!0,c=c.nextSibling;if(d.isFirefox)this._ignoreFocus=!1,(c=this._hasFocus)&&a.blur(),a.contentEditable=!1,a.contentEditable=!0,c&&a.focus(),this._ignoreFocus=!1}},_scrollViewAnimated:function(a,c,b){if(b&&this._scrollAnimation){var d=this;this._animation=new u({window:this._getWindow(),duration:this._scrollAnimation,curve:[c,0],onAnimate:function(a){a=
+c-Math.floor(a);d._scrollView(0,a);c-=a},onEnd:function(){d._animation=null;d._scrollView(a,c);b&&b()}});this._animation.play()}else this._scrollView(a,c),b&&b()},_scrollView:function(a,c){this._ensureCaretVisible=!1;var b=this._viewDiv;a&&(b.scrollLeft+=a);c&&(b.scrollTop+=c)},_setClipboardText:function(a,c){var b,f=this._parent.ownerDocument,m=this._getWindow();if(m.clipboardData)return b=[],i(a,function(a){b.push(a)},function(){b.push(d.platformDelimiter)}),m.clipboardData.setData("Text",b.join(""));
+if(c&&c.clipboardData&&(b=[],i(a,function(a){b.push(a)},function(){b.push(d.platformDelimiter)}),c.clipboardData.setData("text/plain",b.join(""))))return!0;var l=d.createElement(f,"pre");l.style.position="fixed";l.style.left="-1000px";i(a,function(a){l.appendChild(f.createTextNode(a))},function(){l.appendChild(d.createElement(f,"br"))});l.appendChild(f.createTextNode(" "));this._clientDiv.appendChild(l);var n=f.createRange();n.setStart(l.firstChild,0);n.setEndBefore(l.lastChild);var e=m.getSelection();
+e.rangeCount>0&&e.removeAllRanges();e.addRange(n);var h=this,n=function(){l&&l.parentNode===h._clientDiv&&h._clientDiv.removeChild(l);h._updateDOMSelection()},e=!1;this._ignoreCopy=!0;try{e=f.execCommand("copy",!1,null)}catch(j){}this._ignoreCopy=!1;if(!e&&c)return m.setTimeout(n,0),!1;n();return!0},_setDOMSelection:function(a,c,b,i,f){for(var m,l,n,e,h=0,j=a.firstChild,r,q,k=this._model.getLine(a.lineIndex).length;j;){if(!j.ignore){r=j.firstChild;q=r.length;j.ignoreChars&&(q-=j.ignoreChars);if(h+
+q>c||h+q>=k){m=r;l=c-h;j.ignoreChars&&q>0&&l===q&&(l+=j.ignoreChars);break}h+=q}j=j.nextSibling}for(var h=0,j=b.firstChild,o=this._model.getLine(b.lineIndex).length;j;){if(!j.ignore){r=j.firstChild;q=r.length;j.ignoreChars&&(q-=j.ignoreChars);if(q+h>i||h+q>=o){n=r;e=i-h;j.ignoreChars&&q>0&&e===q&&(e+=j.ignoreChars);break}h+=q}j=j.nextSibling}this._setDOMFullSelection(a,c,k,b,i,o);c=this._getWindow();a=this._parent.ownerDocument;if(c.getSelection){c=c.getSelection();a=a.createRange();a.setStart(m,
+l);a.setEnd(n,e);if(this._hasFocus&&(c.anchorNode!==m||c.anchorOffset!==l||c.focusNode!==n||c.focusOffset!==e||c.anchorNode!==n||c.anchorOffset!==e||c.focusNode!==m||c.focusOffset!==l))this._ignoreSelect=!1,c.rangeCount>0&&c.removeAllRanges(),c.addRange(a),this._ignoreSelect=!0;if(this._cursorDiv)f?a.setEnd(m,l):a.setStart(n,e),n=a.getClientRects()[0],e=this._cursorDiv.parentNode,m=e.getBoundingClientRect(),this._cursorDiv.style.top=n.top-m.top+e.scrollTop+"px",this._cursorDiv.style.left=n.left-m.left+
+e.scrollLeft+"px"}else if(a.selection&&this._hasFocus)f=a.body,a=d.createElement(a,"div"),f.appendChild(a),f.removeChild(a),a=f.createTextRange(),a.moveToElementText(m.parentNode),a.moveStart("character",l),m=f.createTextRange(),m.moveToElementText(n.parentNode),m.moveStart("character",e),a.setEndPoint("EndToStart",m),this._ignoreSelect=!1,a.select(),this._ignoreSelect=!0},_setDOMFullSelection:function(a,c,b,d,i){if(this._selDiv1&&(b=this._selDiv1,b.style.width="0px",b.style.height="0px",b=this._selDiv2,
+b.style.width="0px",b.style.height="0px",b=this._selDiv3,b.style.width="0px",b.style.height="0px",!(a===d&&c===i))){var f=this._model,m=this._getViewPadding(),l=this._clientDiv.getBoundingClientRect(),n=this._viewDiv.getBoundingClientRect(),b=n.left+m.left,e=l.right,m=n.top+m.top,h=l.bottom,n=l=0;this._clipDiv?(n=this._clipDiv.getBoundingClientRect(),l=n.left-this._clipDiv.scrollLeft):(n=this._rootDiv.getBoundingClientRect(),l=n.left);n=n.top;this._ignoreDOMSelection=!0;var a=(new q(this,a.lineIndex,
+a)).getBoundingClientRect(f.getLineStart(a.lineIndex)+c,!1),j=a.left,i=(new q(this,d.lineIndex,d)).getBoundingClientRect(f.getLineStart(d.lineIndex)+i,!1),c=i.left;this._ignoreDOMSelection=!1;var f=this._selDiv1,j=Math.min(e,Math.max(b,j)),r=Math.min(h,Math.max(m,a.top)),k=e,d=Math.min(h,Math.max(m,a.bottom));f.style.left=j-l+"px";f.style.top=r-n+"px";f.style.width=Math.max(0,k-j)+"px";f.style.height=Math.max(0,d-r)+"px";if(a.top===i.top)k=Math.min(c,e),f.style.width=Math.max(0,k-j)+"px";else if(a=
+Math.min(h,Math.max(m,i.top)),c=Math.min(e,Math.max(b,c)),m=Math.min(h,Math.max(m,i.bottom)),h=this._selDiv3,h.style.left=b-l+"px",h.style.top=a-n+"px",h.style.width=Math.max(0,c-b)+"px",h.style.height=Math.max(0,m-a)+"px",a-d>0)m=this._selDiv2,m.style.left=b-l+"px",m.style.top=d-n+"px",m.style.width=Math.max(0,e-b)+"px",m.style.height=Math.max(0,a-d)+"px"}},_setGrab:function(a){if(a!==this._grabControl)a?(a.setCapture&&a.setCapture(),this._grabControl=a):(this._grabControl.releaseCapture&&this._grabControl.releaseCapture(),
+this._grabControl=null)},_setLinksVisible:function(a){if(this._linksVisible!==a){this._linksVisible=a;if(d.isIE&&a)this._hadFocus=this._hasFocus;var c=this._clientDiv;c.contentEditable=!a;this._hadFocus&&!a&&c.focus();if(this._overlayDiv)this._overlayDiv.style.zIndex=a?"-1":"1";for(a=this._getLineNext();a;){if(a.hasLink)for(c=a.firstChild;c;)if(c.ignore)c=c.nextSibling;else{var b=c.nextSibling,i=c.viewStyle;i&&i.tagName&&i.tagName.toLowerCase()==="a"&&a.replaceChild(a._line._createSpan(a,c.firstChild.data,
+i),c);c=b}a=this._getLineNext(a)}this._updateDOMSelection()}},_setSelection:function(a,c,b,d,i){if(a){this._columnX=-1;b===void 0&&(b=!0);var f=this._selection;this._selection=a;c!==!1&&this._showCaret(!1,d,c,i);b&&this._updateDOMSelection();if(!f.equals(a))this.onSelection({type:"Selection",oldValue:{start:f.start,end:f.end},newValue:{start:a.start,end:a.end}})}},_setSelectionTo:function(a,c,b,d){var i=this._model,f=this._getSelection(),c=this.convert({x:a,y:c},"page","document"),a=this._getLineIndex(c.y);
+if(this._clickCount===1){i=this._getLine(a);a=i.getOffset(c.x,c.y-this._getLinePixel(a));i.destroy();if(d&&!b&&f.start<=a&&a<f.end)return this._dragOffset=a,!1;f.extend(a);b||f.collapse()}else(this._clickCount&1)===0?(i=this._getLine(a),a=i.getOffset(c.x,c.y-this._getLinePixel(a)),this._doubleClickSelection?a>=this._doubleClickSelection.start?(b=this._doubleClickSelection.start,d=i.getNextOffset(a,{unit:"wordend",count:1})):(b=i.getNextOffset(a,{unit:"word",count:-1}),d=this._doubleClickSelection.end):
+(b=i.getNextOffset(a,{unit:"word",count:-1}),d=i.getNextOffset(b,{unit:"wordend",count:1})),i.destroy()):this._doubleClickSelection?(d=i.getLineAtOffset(this._doubleClickSelection.start),a>=d?(b=i.getLineStart(d),d=i.getLineEnd(a)):(b=i.getLineStart(a),d=i.getLineEnd(d))):(b=i.getLineStart(a),d=i.getLineEnd(a)),f.setCaret(b),f.extend(d);this._setSelection(f,!0,!0);return!0},_setFullSelection:function(a,c){this._fullSelection=a;if(d.isWebkit)this._fullSelection=!0;var b=this._clipDiv||this._rootDiv;
+if(b)if(this._fullSelection){if(!this._selDiv1&&this._fullSelection&&!d.isIOS){var i=b.ownerDocument;this._highlightRGB=d.isWebkit?"transparent":"Highlight";var f=d.createElement(i,"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";b.appendChild(f);var m=d.createElement(i,"div");this._selDiv2=m;m.style.position=
+"absolute";m.style.borderWidth="0px";m.style.margin="0px";m.style.padding="0px";m.style.outline="none";m.style.background=this._highlightRGB;m.style.width="0px";m.style.height="0px";m.style.zIndex="0";b.appendChild(m);this._selDiv3=i=d.createElement(i,"div");i.style.position="absolute";i.style.borderWidth="0px";i.style.margin="0px";i.style.padding="0px";i.style.outline="none";i.style.background=this._highlightRGB;i.style.width="0px";i.style.height="0px";i.style.zIndex="0";b.appendChild(i);if(d.isFirefox&&
+d.isMac){b=this._getWindow().getComputedStyle(i,null).getPropertyValue("background-color");switch(b){case "rgb(119, 141, 168)":b="rgb(199, 208, 218)";break;case "rgb(127, 127, 127)":b="rgb(198, 198, 198)";break;case "rgb(255, 193, 31)":b="rgb(250, 236, 115)";break;case "rgb(243, 70, 72)":b="rgb(255, 176, 139)";break;case "rgb(255, 138, 34)":b="rgb(255, 209, 129)";break;case "rgb(102, 197, 71)":b="rgb(194, 249, 144)";break;case "rgb(140, 78, 184)":b="rgb(232, 184, 255)";break;default:b="rgb(180, 213, 255)"}this._highlightRGB=
+b;f.style.background=b;m.style.background=b;i.style.background=b}c||this._updateDOMSelection()}}else{if(this._selDiv1)b.removeChild(this._selDiv1),this._selDiv1=null;if(this._selDiv2)b.removeChild(this._selDiv2),this._selDiv2=null;if(this._selDiv3)b.removeChild(this._selDiv3),this._selDiv3=null}},_setBlockCursor:function(a){this._blockCursorVisible=a;this._updateBlockCursorVisible()},_setOverwriteMode:function(a){this._overwriteMode=a;this._updateBlockCursorVisible()},_updateBlockCursorVisible:function(){if(this._blockCursorVisible||
+this._overwriteMode){if(!this._cursorDiv){var a=d.createElement(document,"div");a.className="textviewBlockCursor";this._cursorDiv=a;a.tabIndex=-1;a.style.zIndex="2";a.style.color="transparent";a.style.position="absolute";a.style.pointerEvents="none";a.innerHTML="&nbsp;";this._viewDiv.appendChild(a);this._updateDOMSelection()}}else if(this._cursorDiv)this._cursorDiv.parentNode.removeChild(this._cursorDiv),this._cursorDiv=null},_setReadOnly:function(a){this._readonly=a;this._clientDiv.setAttribute("aria-readonly",
+a?"true":"false")},_setTabSize:function(a,c){this._tabSize=a;this._customTabSize=void 0;var b=this._clientDiv;if(d.isOpera){if(b)b.style.OTabSize=this._tabSize+""}else if(d.isWebkit>=537.1){if(b)b.style.tabSize=this._tabSize+""}else if(d.isFirefox>=4){if(b)b.style.MozTabSize=this._tabSize+""}else if(this._tabSize!==8)this._customTabSize=this._tabSize;c||(this.redrawLines(),this._resetLineWidth())},_setTheme:function(a){this._theme&&this._theme.removeEventListener("ThemeChanged",this._themeListener.onChanged);
+(this._theme=a)&&this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);this._setThemeClass(this._themeClass)},_setThemeClass:function(a,c){this._themeClass=a;var b="textview",i=this._theme.getThemeClass();i&&(b+=" "+i);this._themeClass&&i!==this._themeClass&&(b+=" "+this._themeClass);this._rootDiv.className=b;this._updateStyle(c)},_setWrapMode:function(a,c){this._wrapMode=a&&this._wrappable;var b=this._clientDiv,i=this._viewDiv;a?(b.style.whiteSpace="pre-wrap",b.style.wordWrap=
+"break-word",i.style.overflowX="hidden",i.style.overflowY="scroll"):(b.style.whiteSpace="pre",b.style.wordWrap="normal",i.style.overflowX="auto",i.style.overflowY="auto");c||(this.redraw(),this._resetLineWidth());this._resetLineHeight()},_showCaret:function(a,c,b,i){if(this._clientDiv){var d=this._model,f=this._getSelection(),m=this._getScroll(),l=f.getCaret(),n=f.start,e=f.end,h=d.getLineAtOffset(e),j=Math.max(Math.max(n,d.getLineStart(h)),e-1),d=this._getClientWidth(),h=this._getClientHeight(),
+r=d/4,q=this._getBoundsAtOffset(l===n?n:j),k=q.left,o=q.right,v=q.top,p=q.bottom;a&&!f.isEmpty()&&(q=this._getBoundsAtOffset(l===e?n:j),q.top===v?l===n?o=k+Math.min(q.right-k,d):k=o-Math.min(o-q.left,d):l===n?p=v+Math.min(q.bottom-v,h):v=p-Math.min(p-q.top,h));a=0;k<m.x&&(a=Math.min(k-m.x,-r));o>m.x+d&&(a=Math.max(o-m.x-d,r));f=0;v<m.y?f=v-m.y:p>m.y+h&&(f=p-m.y-h);i&&(i>0?f>0&&(f=Math.max(f,i)):f<0&&(f=Math.min(f,i)));if(a!==0||f!==0)return f!==0&&typeof b==="number"&&(b<0&&(b=0),b>1&&(b=1),f+=Math.floor(f>
+0?b*h:-b*h)),this._scrollViewAnimated(a,f,c),h!==this._getClientHeight()||d!==this._getClientWidth()?this._showCaret():this._ensureCaretVisible=!0,!0;else c&&c();return!1}},_startIME:function(){if(this._imeOffset===-1){var a=this._getSelection();a.isEmpty()||this._modifyContent({text:"",start:a.start,end:a.end},!0);this._imeOffset=a.start}},_unhookEvents:function(){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);
+this._theme.removeEventListener("ThemeChanged",this._themeListener.onChanged);this._modelListener=null;for(var a=0;a<this._handlers.length;a++){var c=this._handlers[a],b=c.target,i=c.type,c=c.handler;typeof b.removeEventListener==="function"?b.removeEventListener(i,c,!1):b.detachEvent("on"+i,c)}this._handlers=null;if(this._mutationObserver)this._mutationObserver.disconnect(),this._mutationObserver=null},_updateDOMSelection:function(){if(!this._ignoreDOMSelection&&this._clientDiv){var a=this._getSelection(),
+c=this._model,b=c.getLineAtOffset(a.start),i=c.getLineAtOffset(a.end),d=this._getLineNext();if(d){var f=this._getLinePrevious(),m;b<d.lineIndex?(m=d,b=0):b>f.lineIndex?(m=f,b=0):(m=this._getLineNode(b),b=a.start-c.getLineStart(b));i<d.lineIndex?c=0:i>f.lineIndex?(d=f,c=0):(d=this._getLineNode(i),c=a.end-c.getLineStart(i));this._setDOMSelection(m,b,d,c,a.caret)}}},_update:function(a){if(!(this._redrawCount>0)){if(this._updateTimer)this._getWindow().clearTimeout(this._updateTimer),this._updateTimer=
+null,a=!1;var c=this._clientDiv;if(c){if(this._metrics.invalid)this._ignoreQueueUpdate=!0,this._updateStyle(),this._ignoreQueueUpdate=!1;var b=this._model,i=this._getScroll(!1),f=this._getViewPadding(),m=b.getLineCount(),l=this._getLineHeight(),n=this._getClientWidth();if(this._wrapMode)c.style.width=n+"px";var e,h,j,r,k=0,o=0;if(this._lineHeight){for(;o<m;){h=this._getLineHeight(o);if(k+h>i.y)break;k+=h;o++}e=o;h=Math.max(0,e-1);j=b=i.y-k;e>0&&(b+=this._getLineHeight(e-1))}else r=Math.max(0,i.y)/
+l,e=Math.floor(r),h=Math.max(0,e-1),b=Math.round((r-h)*l),j=Math.round((r-e)*l);this._topIndexY=j;r=this._parent;var v=r.clientWidth,p=r.clientHeight;r=this._getClientHeight();if(a){l=0;this._leftDiv&&(e=this._leftDiv.getBoundingClientRect(),l=e.right-e.left);e=n;for(this._wrapMode||(e=Math.max(this._maxLineWidth,e));o<m;)h=this._getLineHeight(o,!1),k+=h,o++;m=k}else{n=this._viewDiv;j=Math.min(e+Math.floor((r+j)/l),m-1);for(var i=Math.min(j+1,m-1),u,w=c.firstChild;w;){u=w.lineIndex;var y=w.nextSibling;
+if(!(h<=u&&u<=i)||w.lineRemoved||w.lineIndex===-1)this._mouseWheelLine===w?(w.style.display="none",w.lineIndex=-1):c.removeChild(w);w=y}var w=this._getLineNext(),y=n.ownerDocument,A=y.createDocumentFragment();for(u=h;u<=i;u++)if(!w||w.lineIndex>u)(new q(this,u)).create(A,null);else{A.firstChild&&(c.insertBefore(A,w),A=y.createDocumentFragment());if(w&&w.lineChanged)w=(new q(this,u)).create(A,w),w.lineChanged=!1;w=this._getLineNext(w)}A.firstChild&&c.insertBefore(A,w);if(d.isWebkit&&!this._wrapMode)c.style.width=
+"0x7fffffffpx";w=this._getLineNext();u=r+b;for(A=!1;w;){h=w.lineWidth;if(h===void 0)if(y=w._line.getBoundingClientRect(),h=w.lineWidth=Math.ceil(y.right-y.left),y=y.bottom-y.top,this._lineHeight)this._lineHeight[w.lineIndex]=Math.ceil(y);else if(l!==0&&y!==0&&l!==y)this._variableLineHeight=!0,this._lineHeight=[],this._lineHeight[w.lineIndex]=Math.ceil(y);if(this._lineHeight&&!A&&(u-=this._lineHeight[w.lineIndex],u<0))j=w.lineIndex,A=!0;if(!this._wrapMode){if(h>=this._maxLineWidth)this._maxLineWidth=
+h,this._maxLineIndex=w.lineIndex;if(this._checkMaxLineIndex===w.lineIndex)this._checkMaxLineIndex=-1}if(w.lineIndex===e)this._topChild=w;if(w.lineIndex===j)this._bottomChild=w;w=this._getLineNext(w)}if(this._checkMaxLineIndex!==-1&&(u=this._checkMaxLineIndex,this._checkMaxLineIndex=-1,0<=u&&u<m)){l=new q(this,u);y=l.getBoundingClientRect();h=y.right-y.left;if(h>=this._maxLineWidth)this._maxLineWidth=h,this._maxLineIndex=u;l.destroy()}for(;o<m;)h=this._getLineHeight(o,o<=j),k+=h,o++;m=k;this._updateRuler(this._leftDiv,
+e,i,p);this._updateRuler(this._rightDiv,e,i,p);l=0;this._leftDiv&&(e=this._leftDiv.getBoundingClientRect(),l=e.right-e.left);i=0;this._rightDiv&&(i=this._rightDiv.getBoundingClientRect(),i=i.right-i.left);n.style.left=l+"px";n.style.right=i+"px";i=this._scrollDiv;i.style.height=m+"px";k=n=this._getClientWidth();this._wrapMode||(k=Math.max(this._maxLineWidth,k));e=k;if((!d.isIE||d.isIE>=9)&&this._maxLineWidth>n)k+=f.right+f.left;i.style.width=k+"px";if(this._clipScrollDiv)this._clipScrollDiv.style.width=
+k+"px";i=this._getScroll(!1)}if(this._vScrollDiv)k=r-8,o=Math.max(15,Math.ceil(Math.min(1,k/(m+f.top+f.bottom))*k)),this._vScrollDiv.style.left=l+n-8+"px",this._vScrollDiv.style.top=Math.floor(Math.max(0,i.y*k/m))+"px",this._vScrollDiv.style.height=o+"px";if(!this._wrapMode&&this._hScrollDiv)k=n-8,o=Math.max(15,Math.ceil(Math.min(1,k/(this._maxLineWidth+f.left+f.right))*k)),this._hScrollDiv.style.left=l+Math.floor(Math.max(0,Math.floor(i.x*k/this._maxLineWidth)))+"px",this._hScrollDiv.style.top=r-
+9+"px",this._hScrollDiv.style.width=o+"px";w=i.x;h=this._clipDiv;k=this._overlayDiv;if(h){h.scrollLeft=w;o=l+f.left;j=f.top;a=n;l=r;w=0;u=-b;if(i.x===0)o-=f.left,a+=f.left,w=f.left;i.x+n===e&&(a+=f.right);i.y===0&&(j-=f.top,l+=f.top,u+=f.top);i.y+r===m&&(l+=f.bottom);h.style.left=o+"px";h.style.top=j+"px";h.style.right=v-a-o+"px";h.style.bottom=p-l-j+"px";c.style.left=w+"px";c.style.top=u+"px";c.style.width=e+"px";c.style.height=r+b+"px";if(k)k.style.left=c.style.left,k.style.top=c.style.top,k.style.width=
+c.style.width,k.style.height=c.style.height}else{o=w;j=b;v=w+n;p=b+r;o===0&&(o-=f.left);j===0&&(j-=f.top);v===e&&(v+=f.right);i.y+r===m&&(p+=f.bottom);c.style.clip="rect("+j+"px,"+v+"px,"+p+"px,"+o+"px)";c.style.left=-w+l+f.left+"px";c.style.width=(d.isWebkit?e:n+w)+"px";if(!a)c.style.top=-b+f.top+"px",c.style.height=r+b+"px";if(k&&(k.style.clip=c.style.clip,k.style.left=c.style.left,k.style.width=c.style.width,!a))k.style.top=c.style.top,k.style.height=c.style.height}this._updateDOMSelection();c=
+this._ensureCaretVisible;this._ensureCaretVisible=!1;r!==this._getClientHeight()&&(this._update(),c&&this._showCaret())}}},_updateRuler:function(a,c,b,i){if(a)for(var f=this._parent.ownerDocument,m=this._getLineHeight(),l=this._getViewPadding(),a=a.firstChild;a;){var n=a._ruler,e=m,h=n.getOverview();h==="page"&&(e+=this._topIndexY);a.style.top=-e+"px";a.style.height=i+e+"px";a.rulerChanged&&j(n.getRulerStyle(),a);var r,q=a.firstChild;q?(r=q,q=q.nextSibling):(r=d.createElement(f,"div"),r.style.visibility=
+"hidden",a.appendChild(r));var k;if(a.rulerChanged&&r){e=-1;if(k=n.getWidestAnnotation())if(j(k.style,r),k.html)r.innerHTML=k.html;r.lineIndex=e;r.style.height=m+l.top+"px"}var o;if(h==="page"){for(n=n.getAnnotations(c,b+1);q;)e=q.lineIndex,k=q.nextSibling,(!(c<=e&&e<=b)||q.lineChanged)&&a.removeChild(q),q=k;q=a.firstChild.nextSibling;o=f.createDocumentFragment();for(e=c;e<=b;e++)if(!q||q.lineIndex>e){r=d.createElement(f,"div");if(k=n[e]){j(k.style,r);if(k.html)r.innerHTML=k.html;r.annotation=k}r.lineIndex=
+e;r.style.height=this._getLineHeight(e)+"px";o.appendChild(r)}else if(o.firstChild&&(a.insertBefore(o,q),o=f.createDocumentFragment()),q)q=q.nextSibling;o.firstChild&&a.insertBefore(o,q)}else{k=this._getClientHeight();e=this._model.getLineCount();q=k+l.top+l.bottom-2*this._metrics.scrollWidth;h=m*e<q?m:q/e;if(a.rulerChanged){for(k=a.childNodes.length;k>1;)a.removeChild(a.lastChild),k--;n=n.getAnnotations(0,e);o=f.createDocumentFragment();for(var v in n)if(e=v>>>0,!(e<0)){r=d.createElement(f,"div");
+k=n[v];j(k.style,r);r.style.position="absolute";r.style.top=this._metrics.scrollWidth+m+Math.floor(e*h)+"px";if(k.html)r.innerHTML=k.html;r.annotation=k;r.lineIndex=e;o.appendChild(r)}a.appendChild(o)}else if(a._oldTrackHeight!==q)for(r=a.firstChild?a.firstChild.nextSibling:null;r;)r.style.top=this._metrics.scrollWidth+m+Math.floor(r.lineIndex*h)+"px",r=r.nextSibling;a._oldTrackHeight=q}a.rulerChanged=!1;a=a.nextSibling}},_updateStyleSheet:function(){var a="";d.isWebkit&&this._metrics.scrollWidth>
+0&&(a+="\n.textview ::-webkit-scrollbar-corner {background: #eeeeee;}");d.isFirefox&&d.isMac&&this._highlightRGB&&this._highlightRGB!=="Highlight"&&(a+="\n.textview ::-moz-selection {background: "+this._highlightRGB+";}");if(a){var c=document.getElementById("_textviewStyle");if(c)c.removeChild(c.firstChild),c.appendChild(document.createTextNode(a));else{c=d.createElement(document,"style");c.id="_textviewStyle";var b=document.getElementsByTagName("head")[0]||document.documentElement;c.appendChild(document.createTextNode(a));
+b.insertBefore(c,b.firstChild)}}},_updateStyle:function(a){if(!a&&d.isIE)this._rootDiv.style.lineHeight="normal";var c=this._metrics=this._calculateMetrics();this._rootDiv.style.lineHeight=d.isIE?c.lineHeight-(c.lineTrim.top+c.lineTrim.bottom)+"px":"normal";this._updateStyleSheet();a||(this.redraw(),this._resetLineWidth())}};e.EventTarget.addMixin(v.prototype);return{TextView:v}});
+define("orion/editor/projectionTextModel",["orion/editor/textModel","orion/editor/eventTarget"],function(k,p){function o(e){this._model=e;this._projections=[]}o.prototype={addProjection:function(e){if(e){var b=this._model,d=this._projections;e._lineIndex=b.getLineAtOffset(e.start);e._lineCount=b.getLineAtOffset(e.end)-e._lineIndex;var h=e.text;h||(h="");e._model=typeof h==="string"?new k.TextModel(h,b.getLineDelimiter()):h;var b=this.mapOffset(e.start,!0),h=e.end-e.start,j=e._lineCount,f=e._model.getCharCount(),
+a=e._model.getLineCount()-1;this.onChanging({type:"Changing",text:e._model.getText(),start:b,removedCharCount:h,addedCharCount:f,removedLineCount:j,addedLineCount:a});var c=this._binarySearch(d,e.start);d.splice(c,0,e);this.onChanged({type:"Changed",start:b,removedCharCount:h,addedCharCount:f,removedLineCount:j,addedLineCount:a})}},getProjections:function(){return this._projections.slice(0)},getBaseModel:function(){return this._model},mapOffset:function(e,b){var d=this._projections,h=0,j,f;if(b){for(j=
+0;j<d.length;j++){f=d[j];if(f.start>e)break;if(f.end>e)return-1;h+=f._model.getCharCount()-(f.end-f.start)}return e+h}for(j=0;j<d.length;j++){f=d[j];if(f.start>e-h)break;var a=f._model.getCharCount();if(f.start+a>e-h)return-1;h+=a-(f.end-f.start)}return e-h},removeProjection:function(e){var b,d=0;for(b=0;b<this._projections.length;b++){var h=this._projections[b];if(h===e){e=h;break}d+=h._model.getCharCount()-(h.end-h.start)}if(b<this._projections.length){var h=this._model,d=e.start+d,j=e.end-e.start,
+f=e._lineCount,a=e._model.getCharCount(),c=e._model.getLineCount()-1;this.onChanging({type:"Changing",text:h.getText(e.start,e.end),start:d,removedCharCount:a,addedCharCount:j,removedLineCount:c,addedLineCount:f});this._projections.splice(b,1);this.onChanged({type:"Changed",start:d,removedCharCount:a,addedCharCount:j,removedLineCount:c,addedLineCount:f})}},_binarySearch:function(e,b){for(var d=e.length,h=-1,j;d-h>1;)j=Math.floor((d+h)/2),b<=e[j].start?d=j:h=j;return d},getCharCount:function(){for(var e=
+this._model.getCharCount(),b=this._projections,d=0;d<b.length;d++){var h=b[d];e+=h._model.getCharCount()-(h.end-h.start)}return e},getLine:function(e,b){if(e<0)return null;var d=this._model,h=this._projections,j=0,f=[],a=0,c,i,m;for(c=0;c<h.length;c++){m=h[c];if(m._lineIndex>=e-j)break;i=m._model.getLineCount()-1;if(m._lineIndex+i>=e-j)if(a=e-(m._lineIndex+j),a<i)return m._model.getLine(a,b);else f.push(m._model.getLine(i));a=m.end;j+=i-m._lineCount}for(a=Math.max(a,d.getLineStart(e-j));c<h.length;c++){m=
+h[c];if(m._lineIndex>e-j)break;f.push(d.getText(a,m.start));i=m._model.getLineCount()-1;if(m._lineIndex+i>e-j)return f.push(m._model.getLine(0,b)),f.join("");f.push(m._model.getText());a=m.end;j+=i-m._lineCount}h=d.getLineEnd(e-j,b);a<h&&f.push(d.getText(a,h));return f.join("")},getLineAtOffset:function(e){for(var b=this._model,d=this._projections,h=0,j=0,f=0;f<d.length;f++){var a=d[f];if(a.start>e-h)break;var c=a._model.getCharCount();if(a.start+c>e-h){d=e-(a.start+h);j+=a._model.getLineAtOffset(d);
+h+=d;break}j+=a._model.getLineCount()-1-a._lineCount;h+=c-(a.end-a.start)}return b.getLineAtOffset(e-h)+j},getLineCount:function(){for(var e=this._projections,b=this._model.getLineCount(),d=0;d<e.length;d++){var h=e[d];b+=h._model.getLineCount()-1-h._lineCount}return b},getLineDelimiter:function(){return this._model.getLineDelimiter()},getLineEnd:function(e,b){if(e<0)return-1;for(var d=this._model,h=this._projections,j=0,f=0,a=0;a<h.length;a++){var c=h[a];if(c._lineIndex>e-j)break;var i=c._model.getLineCount()-
+1;if(c._lineIndex+i>e-j)return c._model.getLineEnd(e-(c._lineIndex+j),b)+c.start+f;f+=c._model.getCharCount()-(c.end-c.start);j+=i-c._lineCount}return d.getLineEnd(e-j,b)+f},getLineStart:function(e){if(e<0)return-1;for(var b=this._model,d=this._projections,h=0,j=0,f=0;f<d.length;f++){var a=d[f];if(a._lineIndex>=e-h)break;var c=a._model.getLineCount()-1;if(a._lineIndex+c>=e-h)return a._model.getLineStart(e-(a._lineIndex+h))+a.start+j;j+=a._model.getCharCount()-(a.end-a.start);h+=c-a._lineCount}return b.getLineStart(e-
+h)+j},getText:function(e,b){e===void 0&&(e=0);var d=this._model,h=this._projections,j=0,f=[],a,c,i;for(a=0;a<h.length;a++){c=h[a];if(c.start>e-j)break;i=c._model.getCharCount();if(c.start+i>e-j)if(b!==void 0&&c.start+i>b-j)return c._model.getText(e-(c.start+j),b-(c.start+j));else f.push(c._model.getText(e-(c.start+j))),e=c.end+j+i-(c.end-c.start);j+=i-(c.end-c.start)}var m=e-j;if(b!==void 0){for(;a<h.length;a++){c=h[a];if(c.start>b-j)break;f.push(d.getText(m,c.start));i=c._model.getCharCount();if(c.start+
+i>b-j)return f.push(c._model.getText(0,b-(c.start+j))),f.join("");f.push(c._model.getText());m=c.end;j+=i-(c.end-c.start)}f.push(d.getText(m,b-j))}else{for(;a<h.length;a++)c=h[a],f.push(d.getText(m,c.start)),f.push(c._model.getText()),m=c.end;f.push(d.getText(m))}return f.join("")},_onChanging:function(e,b,d,h,j,f){for(var a=this._model,c=this._projections,i,m=0,n,l=b+d;i<c.length;i++){d=c[i];if(d.start>b)break;m+=d._model.getCharCount()-(d.end-d.start)}b+=m;for(var r=i;i<c.length;i++){d=c[i];if(d.start>
+l)break;m+=d._model.getCharCount()-(d.end-d.start);n+=d._model.getLineCount()-1-d._lineCount}d=l+m;m=i;this.onChanging(b,d-b,h,j+n,f);c.splice(c,m-r);for(e=e.length-(d-b);i<c.length;i++)d=c[i],d.start+=e,d.end+=e,d._lineIndex=a.getLineAtOffset(d.start)},onChanging:function(e){return this.dispatchEvent(e)},onChanged:function(e){return this.dispatchEvent(e)},setLineDelimiter:function(e){this._model.setLineDelimiter(e)},setText:function(e,b,d){e===void 0&&(e="");b===void 0&&(b=0);var h=b,j=d,f=this._model,
+a=this._projections,c=0,i=0,m,n,l,r,q,k=0;for(m=0;m<a.length;m++){n=a[m];if(n.start>b-c)break;l=n._model.getCharCount();if(n.start+l>b-c)if(d!==void 0&&n.start+l>d-c){n._model.setText(e,b-(n.start+c),d-(n.start+c));return}else k=n._model.getLineCount()-1-n._model.getLineAtOffset(b-(n.start+c)),r={projection:n,start:b-(n.start+c)},b=n.end+c+l-(n.end-n.start);i+=n._model.getLineCount()-1-n._lineCount;c+=l-(n.end-n.start)}b-=c;var o=m,k=f.getLineAtOffset(b)+i-k;if(d!==void 0)for(;m<a.length;m++){n=a[m];
+if(n.start>d-c)break;l=n._model.getCharCount();if(n.start+l>d-c){i+=n._model.getLineAtOffset(d-(n.start+c));l=d-(n.start+c);d=n.end+c;q={projection:n,end:l};break}i+=n._model.getLineCount()-1-n._lineCount;c+=l-(n.end-n.start)}else{for(;m<a.length;m++)n=a[m],i+=n._model.getLineCount()-1-n._lineCount,c+=n._model.getCharCount()-(n.end-n.start);d=j=f.getCharCount()+c}d-=c;n=f.getLineAtOffset(d)+i;j-=h;for(var i=n-k,k=e.length,g=l=n=c=0;;){n!==-1&&n<=g&&(n=e.indexOf("\r",g));l!==-1&&l<=g&&(l=e.indexOf("\n",
+g));if(l===-1&&n===-1)break;g=n!==-1&&l!==-1?n+1===l?l+1:(n<l?n:l)+1:n!==-1?n+1:l+1;c++}this.onChanging({type:"Changing",text:e,start:h,removedCharCount:j,addedCharCount:k,removedLineCount:i,addedLineCount:c});f.setText(e,b,d);if(r)n=r.projection,n._model.setText("",r.start);if(q)n=q.projection,n._model.setText("",0,q.end),n.start=n.end,n._lineCount=0;a.splice(o,m-o);for(e=e.length-(d-b);m<a.length;m++)n=a[m],n.start+=e,n.end+=e,n._lineIndex=f.getLineAtOffset(n.start);this.onChanged({type:"Changed",
+start:h,removedCharCount:j,addedCharCount:k,removedLineCount:i,addedLineCount:c})}};p.EventTarget.addMixin(o.prototype);return{ProjectionTextModel:o}});
+define("orion/editor/annotations",["i18n!orion/editor/nls/messages","orion/editor/eventTarget"],function(k,p){function o(a,c,b){this.start=a;this.end=c;this._projectionModel=b;this.html=this._expandedHTML;this.style=this._expandedStyle;this.expanded=!0}function e(){}function b(a,c){var b=a.lastIndexOf("."),b=a.substring(b+1),d={title:k[b],style:{styleClass:"annotation "+b},html:"<div class='annotationHTML "+b+"'></div>",overviewStyle:{styleClass:"annotationOverview "+b}};c?d.lineStyle={styleClass:"annotationLine "+
+b}:d.rangeStyle={styleClass:"annotationRange "+b};e.registerType(a,d)}function d(){}function h(a){this._annotations=[];var c=this;this._listener={onChanged:function(a){c._onChanged(a)}};this.setTextModel(a)}function j(a,c){this._view=a;this._annotationModel=c;var b=this;this._listener={onDestroy:function(a){b._onDestroy(a)},onLineStyle:function(a){b._onLineStyle(a)},onChanged:function(a){b._onAnnotationModelChanged(a)}};a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("postLineStyle",
+this._listener.onLineStyle);c.addEventListener("Changed",this._listener.onChanged)}o.prototype={_expandedHTML:"<div class='annotationHTML expanded'></div>",_expandedStyle:{styleClass:"annotation expanded"},_collapsedHTML:"<div class='annotationHTML collapsed'></div>",_collapsedStyle:{styleClass:"annotation collapsed"},collapse:function(){if(this.expanded){this.expanded=!1;this.html=this._collapsedHTML;this.style=this._collapsedStyle;var a=this._projectionModel,c=a.getBaseModel();this._projection=
+{start:c.getLineStart(c.getLineAtOffset(this.start)+1),end:c.getLineEnd(c.getLineAtOffset(this.end),!0)};a.addProjection(this._projection)}},expand:function(){if(!this.expanded)this.expanded=!0,this.html=this._expandedHTML,this.style=this._expandedStyle,this._projectionModel.removeProjection(this._projection)}};e.ANNOTATION_ERROR="orion.annotation.error";e.ANNOTATION_WARNING="orion.annotation.warning";e.ANNOTATION_TASK="orion.annotation.task";e.ANNOTATION_BREAKPOINT="orion.annotation.breakpoint";
+e.ANNOTATION_BOOKMARK="orion.annotation.bookmark";e.ANNOTATION_FOLDING="orion.annotation.folding";e.ANNOTATION_CURRENT_BRACKET="orion.annotation.currentBracket";e.ANNOTATION_MATCHING_BRACKET="orion.annotation.matchingBracket";e.ANNOTATION_CURRENT_LINE="orion.annotation.currentLine";e.ANNOTATION_CURRENT_SEARCH="orion.annotation.currentSearch";e.ANNOTATION_MATCHING_SEARCH="orion.annotation.matchingSearch";e.ANNOTATION_READ_OCCURRENCE="orion.annotation.readOccurrence";e.ANNOTATION_WRITE_OCCURRENCE="orion.annotation.writeOccurrence";
+e.ANNOTATION_SELECTED_LINKED_GROUP="orion.annotation.selectedLinkedGroup";e.ANNOTATION_CURRENT_LINKED_GROUP="orion.annotation.currentLinkedGroup";e.ANNOTATION_LINKED_GROUP="orion.annotation.linkedGroup";var f={};e.registerType=function(a,c){var b=c;if(typeof b!=="function")b=function(a,c,b){this.start=a;this.end=c;if(b!==void 0)this.title=b},b.prototype=c;b.prototype.type=a;f[a]=b;return a};e.createAnnotation=function(a,c,b,d){return new (this.getType(a))(c,b,d)};e.getType=function(a){return f[a]};
+b(e.ANNOTATION_ERROR);b(e.ANNOTATION_WARNING);b(e.ANNOTATION_TASK);b(e.ANNOTATION_BREAKPOINT);b(e.ANNOTATION_BOOKMARK);b(e.ANNOTATION_CURRENT_BRACKET);b(e.ANNOTATION_MATCHING_BRACKET);b(e.ANNOTATION_CURRENT_SEARCH);b(e.ANNOTATION_MATCHING_SEARCH);b(e.ANNOTATION_READ_OCCURRENCE);b(e.ANNOTATION_WRITE_OCCURRENCE);b(e.ANNOTATION_SELECTED_LINKED_GROUP);b(e.ANNOTATION_CURRENT_LINKED_GROUP);b(e.ANNOTATION_LINKED_GROUP);b(e.ANNOTATION_CURRENT_LINE,!0);e.registerType(e.ANNOTATION_FOLDING,o);d.addMixin=function(a){var c=
+d.prototype,b;for(b in c)c.hasOwnProperty(b)&&(a[b]=c[b])};d.prototype={addAnnotationType:function(a){if(!this._annotationTypes)this._annotationTypes=[];this._annotationTypes.push(a)},getAnnotationTypePriority:function(a){if(this._annotationTypes)for(var c=0;c<this._annotationTypes.length;c++)if(this._annotationTypes[c]===a)return c+1;return 0},getAnnotationsByType:function(a,c,b){a=a.getAnnotations(c,b);for(b=[];a.hasNext();)c=a.next(),this.getAnnotationTypePriority(c.type)!==0&&b.push(c);var d=
+this;b.sort(function(a,c){return d.getAnnotationTypePriority(a.type)-d.getAnnotationTypePriority(c.type)});return b},isAnnotationTypeVisible:function(a){return this.getAnnotationTypePriority(a)!==0},removeAnnotationType:function(a){if(this._annotationTypes)for(var c=0;c<this._annotationTypes.length;c++)if(this._annotationTypes[c]===a){this._annotationTypes.splice(c,1);break}}};h.prototype={addAnnotation:function(a){if(a){var c=this._annotations,b=this._binarySearch(c,a.start);c.splice(b,0,a);this.onChanged({type:"Changed",
+added:[a],removed:[],changed:[]})}},getTextModel:function(){return this._model},getAnnotations:function(a,c){var b=this._annotations,d,f=0,l=function(){for(;f<b.length;){var d=b[f++];if(a===d.start||(a>d.start?a<d.end:d.start<c))return d;if(d.start>=c)break}return null};d=l();return{next:function(){var a=d;a&&(d=l());return a},hasNext:function(){return d!==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 c=this._annotations,b,d;if(a){b=[];for(d=c.length-1;d>=0;d--){var f=c[d];f.type===a&&c.splice(d,1);b.splice(0,0,f)}}else b=c;this.onChanged({type:"Changed",removed:b,added:[],changed:[]})},removeAnnotation:function(a){if(a&&(a=this._getAnnotationIndex(a),!(a<0)))this.onChanged({type:"Changed",removed:this._annotations.splice(a,1),added:[],changed:[]})},replaceAnnotations:function(a,c){var b=this._annotations,d,f,
+l,e=[];if(a)for(d=a.length-1;d>=0;d--)l=a[d],f=this._getAnnotationIndex(l),f<0||(b.splice(f,1),e.splice(0,0,l));c||(c=[]);for(d=0;d<c.length;d++)l=c[d],f=this._binarySearch(b,l.start),b.splice(f,0,l);this.onChanged({type:"Changed",removed:e,added:c,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,c){for(var b=a.length,d=
+-1,f;b-d>1;)f=Math.floor((b+d)/2),c<=a[f].start?b=f:d=f;return b},_getAnnotationIndex:function(a){for(var c=this._annotations,b=this._binarySearch(c,a.start);b<c.length&&c[b].start===a.start;){if(c[b]===a)return b;b++}return-1},_onChanged:function(a){var c=a.start,b=a.removedCharCount,d=this._annotations,f=c+b;if(0<d.length){for(var l={type:"Changed",added:[],removed:[],changed:[],textModelChangedEvent:a},a=a.addedCharCount-b,b=0;b<d.length;b++){var e=d[b];e.start>=f?(e.start+=a,e.end+=a,l.changed.push(e)):
+e.end<=c||(e.start<c&&f<e.end?(e.end+=a,l.changed.push(e)):(d.splice(b,1),l.removed.push(e),b--))}if(l.added.length>0||l.removed.length>0||l.changed.length>0)this.onChanged(l)}}};p.EventTarget.addMixin(h.prototype);j.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,
+c){if(c){a||(a={});a.styleClass&&c.styleClass&&a.styleClass!==c.styleClass?a.styleClass+=" "+c.styleClass:a.styleClass=c.styleClass;var b;if(c.tagName&&!a.tagName)a.tagName=c.tagName;if(c.style){if(!a.style)a.style={};for(b in c.style)a.style[b]||(a.style[b]=c.style[b])}if(c.attributes){if(!a.attributes)a.attributes={};for(b in c.attributes)a.attributes[b]||(a.attributes[b]=c.attributes[b])}}return a},_mergeStyleRanges:function(a,c){a||(a=[]);var b,d;for(d=0;d<a.length&&c;d++){var f=a[d];if(c.end<=
+f.start)break;if(!(c.start>=f.end)){b=this._mergeStyle({},f.style);b=this._mergeStyle(b,c.style);var l=[];l.push(d,1);c.start<f.start&&l.push({start:c.start,end:f.start,style:c.style});c.start>f.start&&l.push({start:f.start,end:c.start,style:f.style});l.push({start:Math.max(f.start,c.start),end:Math.min(f.end,c.end),style:b});c.end<f.end&&l.push({start:c.end,end:f.end,style:f.style});c=c.end>f.end?{start:f.end,end:c.end,style:c.style}:null;Array.prototype.splice.apply(a,l)}}c&&(b=this._mergeStyle({},
+c.style),a.splice(d,0,{start:c.start,end:c.end,style:b}));return a},_onAnnotationModelChanged:function(a){function c(a){for(var c=0;c<a.length;c++)if(d.isAnnotationTypeVisible(a[c].type)){var e=a[c].start,h=a[c].end;f.getBaseModel&&(e=f.mapOffset(e,!0),h=f.mapOffset(h,!0));e!==-1&&h!==-1&&b.redrawRange(e,h)}}if(!a.textModelChangedEvent){var b=this._view;if(b){var d=this,f=b.getModel();c(a.added);c(a.removed);c(a.changed)}}},_onDestroy:function(){this.destroy()},_onLineStyle:function(a){var c=this._annotationModel,
+b=a.textView.getModel(),d=c.getTextModel(),f=a.lineStart,l=a.lineStart+a.lineText.length;d!==b&&(f=b.mapOffset(f),l=b.mapOffset(l));for(c=c.getAnnotations(f,l);c.hasNext();)if(f=c.next(),this.isAnnotationTypeVisible(f.type)){if(f.rangeStyle){var l=f.start,e=f.end;d!==b&&(l=b.mapOffset(l,!0),e=b.mapOffset(e,!0));a.ranges=this._mergeStyleRanges(a.ranges,{start:l,end:e,style:f.rangeStyle})}if(f.lineStyle)a.style=this._mergeStyle({},a.style),a.style=this._mergeStyle(a.style,f.lineStyle)}}};d.addMixin(j.prototype);
+return{FoldingAnnotation:o,AnnotationType:e,AnnotationTypeList:d,AnnotationModel:h,AnnotationStyler:j}});
+define("orion/editor/tooltip",["i18n!orion/editor/nls/messages","orion/editor/textView","orion/editor/textModel","orion/editor/projectionTextModel","orion/util"],function(k,p,o,e,b){function d(b){this._view=b;this._create(b.getOptions("parent").ownerDocument);b.addEventListener("Destroy",this,this.destroy)}d.getTooltip=function(b){if(!b._tooltip)b._tooltip=new d(b);return b._tooltip};d.prototype={_create:function(d){if(!this._tooltipDiv){var e=this._tooltipDiv=b.createElement(d,"div");e.className=
+"textviewTooltip";e.setAttribute("aria-live","assertive");e.setAttribute("aria-atomic","true");var f=this._tooltipContents=b.createElement(d,"div");e.appendChild(f);d.body.appendChild(e);this.hide()}},_getWindow:function(){var b=this._tooltipDiv.ownerDocument;return b.defaultView||b.parentWindow},destroy:function(){if(this._tooltipDiv){this.hide();var b=this._tooltipDiv.parentNode;b&&b.removeChild(this._tooltipDiv);this._tooltipDiv=null}},hide:function(){if(this._contentsView)this._contentsView.destroy(),
+this._contentsView=null;if(this._tooltipContents)this._tooltipContents.innerHTML="";if(this._tooltipDiv)this._tooltipDiv.style.visibility="hidden";var b=this._getWindow();if(this._showTimeout)b.clearTimeout(this._showTimeout),this._showTimeout=null;if(this._hideTimeout)b.clearTimeout(this._hideTimeout),this._hideTimeout=null;if(this._fadeTimeout)b.clearInterval(this._fadeTimeout),this._fadeTimeout=null},isVisible:function(){return this._tooltipDiv&&this._tooltipDiv.style.visibility==="visible"},setTarget:function(b,
+d){if(this.target!==b&&(this._target=b,this.hide(),b)){var f=this;if(d===0)f.show(!0);else{var a=this._getWindow();f._showTimeout=a.setTimeout(function(){f.show(!0)},d?d:500)}}},show:function(b){if(this._target){var d=this._target.getTooltipInfo();if(d){var f=this._tooltipDiv,a=this._tooltipContents;f.style.left=f.style.right=f.style.width=f.style.height=a.style.width=a.style.height="auto";var c=d.contents;c instanceof Array&&(c=this._getAnnotationContents(c));if(typeof c==="string")a.innerHTML=c;
+else if(this._isNode(c))a.appendChild(c);else if(c instanceof e.ProjectionTextModel){var i=this._view,m=i.getOptions();m.wrapMode=!1;m.parent=a;var n=m.themeClass;n?((n=n.replace("tooltip",""))&&(n=" "+n),n="tooltip"+n):n="tooltip";m.themeClass=n;m=this._contentsView=new p.TextView(m);m._clientDiv.contentEditable=!1;m.addEventListener("LineStyle",function(a){i.onLineStyle(a)});m.setModel(c);c=m.computeSize();a.style.width=c.width+"px";a.style.height=c.height+"px";m.resize()}else return;a=f.ownerDocument.documentElement;
+d.anchor==="right"?(c=a.clientWidth-d.x,f.style.right=c+"px"):(c=parseInt(this._getNodeStyle(f,"padding-left","0"),10),c+=parseInt(this._getNodeStyle(f,"border-left-width","0"),10),c=d.x-c,f.style.left=c+"px");f.style.maxWidth=a.clientWidth-c-10+"px";c=parseInt(this._getNodeStyle(f,"padding-top","0"),10);c+=parseInt(this._getNodeStyle(f,"border-top-width","0"),10);c=d.y-c;f.style.top=c+"px";f.style.maxHeight=a.clientHeight-c-10+"px";f.style.opacity="1";f.style.visibility="visible";if(b){var l=this,
+r=this._getWindow();l._hideTimeout=r.setTimeout(function(){var a=parseFloat(l._getNodeStyle(f,"opacity","1"));l._fadeTimeout=r.setInterval(function(){f.style.visibility==="visible"&&a>0?(a-=0.1,f.style.opacity=a):l.hide()},50)},5E3)}}}},_getAnnotationContents:function(b){function d(c){var b=c.title;if(b==="")return null;var f="<div>";c.html&&(f+=c.html+"&nbsp;");if(!b)b=c.end,c=a.getLineStart(a.getLineAtOffset(c.start)),b=a.getLineEnd(a.getLineAtOffset(b),!0),b=a.getText(c,b);b=b.replace(/</g,"&lt;").replace(/>/g,
+"&gt;");f+="<span style='vertical-align:middle;'>"+b+"</span><div>";return f}if(b.length===0)return null;var f=this._view.getModel(),a=f.getBaseModel?f.getBaseModel():f;if(b.length===1)if(f=b[0],f.title!==void 0)return d(f);else{var b=new e.ProjectionTextModel(a),c=a.getLineStart(a.getLineAtOffset(f.start)),i=a.getCharCount();f.end!==i&&b.addProjection({start:f.end,end:i});c>0&&b.addProjection({start:0,end:c});return b}else{c="<div><em>"+k.multipleAnnotations+"</em></div>";for(i=0;i<b.length;i++)f=
+b[i],(f=d(f))&&(c+=f);return c}},_getNodeStyle:function(b,d,f){var a;if(b&&(a=b.style[d],!a))if(b.currentStyle){for(a=0;(a=d.indexOf("-",a))!==-1;)d=d.substring(0,a)+d.substring(a+1,a+2).toUpperCase()+d.substring(a+2);a=b.currentStyle[d]}else a=(b=b.ownerDocument.defaultView.getComputedStyle(b,null))?b.getPropertyValue(d):null;return a||f},_isNode:function(b){return typeof Node==="object"?b instanceof Node:b&&typeof b==="object"&&typeof b.nodeType==="number"&&typeof b.nodeName==="string"}};return{Tooltip:d}});
+define("orion/editor/rulers",["i18n!orion/editor/nls/messages","orion/editor/annotations","orion/editor/tooltip","orion/util"],function(k,p,o,e){function b(a,c,b,d){this._location=c||"left";this._overview=b||"page";this._rulerStyle=d;this._view=null;var f=this;this._listener={onTextModelChanged:function(a){f._onTextModelChanged(a)},onAnnotationModelChanged:function(a){f._onAnnotationModelChanged(a)}};this.setAnnotationModel(a)}function d(a,c,d,f,e){b.call(this,a,c,"page",d);this._oddStyle=f||{style:{backgroundColor:"white"}};
+this._evenStyle=e||{style:{backgroundColor:"white"}};this._numOfDigits=0}function h(a,c,d){b.call(this,a,c,"page",d)}function j(a,c,d){b.call(this,a,c,"document",d)}function f(a,c,b){h.call(this,a,c,b)}b.prototype={getAnnotations:function(a,c){var b=this._annotationModel;if(!b)return[];var d=this._view.getModel(),f=d.getLineStart(a),l=d.getLineEnd(c-1),e=d;d.getBaseModel&&(e=d.getBaseModel(),f=d.mapOffset(f),l=d.mapOffset(l));for(var h=[],b=this.getAnnotationsByType(b,f,l),f=0;f<b.length;f++)for(var l=
+b[f],j=e.getLineAtOffset(l.start),k=e.getLineAtOffset(Math.max(l.start,l.end-1)),g=j;g<=k;g++){var o=g;if(d!==e){o=e.getLineStart(g);o=d.mapOffset(o,!0);if(o===-1)continue;o=d.getLineAtOffset(o)}if(a<=o&&o<c){var p=this._mergeAnnotation(h[o],l,g-j,k-j+1);p&&(h[o]=p)}}if(!this._multiAnnotation&&this._multiAnnotationOverlay)for(var s in h)h[s]._multiple&&(h[s].html+=this._multiAnnotationOverlay.html);return h},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 c=this._view,b=c.getModel(),d=b,f=b.getLineStart(a),l=f,e=this._annotationModel;if(e){l=c.getSelection();c=Math.max(l.start,l.end);l=b.getLineEnd(a,!0);f<=c&&c<b.getLineEnd(a)&&(f=c+1);b.getBaseModel&&
+(f=b.mapOffset(f),l=b.mapOffset(l),d=b.getBaseModel());for(var h,a=e.getAnnotations(f,l);!h&&a.hasNext();)l=a.next(),this.isAnnotationTypeVisible(l.type)&&(h=l);h&&d.getLineAtOffset(h.start)===d.getLineAtOffset(f)?(f=h.start,l=h.end):l=f;b.getBaseModel&&(f=b.mapOffset(f,!0),l=b.mapOffset(l,!0))}(b=o.Tooltip.getTooltip(this._view))&&b.setTarget(null);this._view.setSelection(l,f,1/3,function(){})}},onDblClick:function(){},onMouseMove:function(a,c){var b=o.Tooltip.getTooltip(this._view);if(b&&!(b.isVisible()&&
+this._tooltipLineIndex===a)){this._tooltipLineIndex=a;var d=this;b.setTarget({y:c.clientY,getTooltipInfo:function(){return d._getTooltipInfo(d._tooltipLineIndex,this.y)}})}},onMouseOver:function(a,c){this.onMouseMove(a,c)},onMouseOut:function(){var a=o.Tooltip.getTooltip(this._view);a&&a.setTarget(null)},_getTooltipInfo:function(a,c){if(a!==void 0){var b=this._view,d=b.getModel(),f=this._annotationModel,l=[];if(f){var l=d.getLineStart(a),e=d.getLineEnd(a);d.getBaseModel&&(l=d.mapOffset(l),e=d.mapOffset(e));
+l=this.getAnnotationsByType(f,l,e)}f=this._getTooltipContents(a,l);if(!f)return null;f={contents:f,anchor:this.getLocation()};l=b.getClientArea();l.y=this.getOverview()==="document"?b.convert({y:c},"view","document").y:b.getLocationAtOffset(d.getLineStart(a)).y;b.convert(l,"document","page");f.x=l.x;f.y=l.y;f.anchor==="right"&&(f.x+=l.width);return f}},_getTooltipContents:function(a,c){return c},_onAnnotationModelChanged:function(a){function c(a){for(var c=0;c<a.length;c++)if(f.isAnnotationTypeVisible(a[c].type)){var l=
+a[c].start,e=a[c].end;d.getBaseModel&&(l=d.mapOffset(l,!0),e=d.mapOffset(e,!0));l!==-1&&e!==-1&&b.redrawLines(d.getLineAtOffset(l),d.getLineAtOffset(Math.max(l,e-1))+1,f)}}var b=this._view;if(b){var d=b.getModel(),f=this,l=d.getLineCount();a.textModelChangedEvent?(a=a.textModelChangedEvent.start,d.getBaseModel&&(a=d.mapOffset(a,!0)),a=d.getLineAtOffset(a),b.redrawLines(a,l,f)):(c(a.added),c(a.removed),c(a.changed))}},_mergeAnnotation:function(a,c,b){a||(a={});if(b===0)if(a.html&&c.html){if(c.html!==
+a.html&&!a._multiple&&this._multiAnnotation)a.html=this._multiAnnotation.html;a._multiple=!0}else a.html=c.html;a.style=this._mergeStyle(a.style,c.style);return a},_mergeStyle:function(a,c){if(c){a||(a={});a.styleClass&&c.styleClass&&a.styleClass!==c.styleClass?a.styleClass+=" "+c.styleClass:a.styleClass=c.styleClass;var b;if(c.style){if(!a.style)a.style={};for(b in c.style)a.style[b]||(a.style[b]=c.style[b])}if(c.attributes){if(!a.attributes)a.attributes={};for(b in c.attributes)a.attributes[b]||
+(a.attributes[b]=c.attributes[b])}}return a}};p.AnnotationTypeList.addMixin(b.prototype);d.prototype=new b;d.prototype.getAnnotations=function(a,c){for(var d=b.prototype.getAnnotations.call(this,a,c),f=this._view.getModel(),e=a;e<c;e++){var l=e&1?this._oddStyle:this._evenStyle,h=e;f.getBaseModel&&(h=f.getLineStart(h),h=f.getBaseModel().getLineAtOffset(f.mapOffset(h)));d[e]||(d[e]={});d[e].html=h+1+"";if(!d[e].style)d[e].style=l}return d};d.prototype.getWidestAnnotation=function(){var a=this._view.getModel().getLineCount();
+return this.getAnnotations(a-1,a)[a-1]};d.prototype._onTextModelChanged=function(a){var a=a.start,c=this._view.getModel(),b=((c.getBaseModel?c.getBaseModel().getLineCount():c.getLineCount())+"").length;if(this._numOfDigits!==b)this._numOfDigits=b,this._view.redrawLines(c.getLineAtOffset(a),c.getLineCount(),this)};h.prototype=new b;j.prototype=new b;j.prototype.getRulerStyle=function(){var a={style:{lineHeight:"1px",fontSize:"1px"}};return a=this._mergeStyle(a,this._rulerStyle)};j.prototype._getTooltipContents=
+function(a,c){if(c.length===0){var d=this._view.getModel(),f=a;d.getBaseModel&&(f=d.getLineStart(f),f=d.getBaseModel().getLineAtOffset(d.mapOffset(f)));return e.formatMessage(k.line,f+1)}return b.prototype._getTooltipContents.call(this,a,c)};j.prototype._mergeAnnotation=function(a,c,b,d){if(b===0){if(!a)a={html:"&nbsp;",style:{style:{height:3*d+"px"}}},a.style=this._mergeStyle(a.style,c.overviewStyle);return a}};f.prototype=new h;f.prototype.onClick=function(a){if(a!==void 0){var c=this._annotationModel;
+if(c){var b=this._view.getModel(),d=b.getLineStart(a),a=b.getLineEnd(a,!0);b.getBaseModel&&(d=b.mapOffset(d),a=b.mapOffset(a),b=b.getBaseModel());for(var f,c=c.getAnnotations(d,a);!f&&c.hasNext();)a=c.next(),this.isAnnotationTypeVisible(a.type)&&(f=a);f&&b.getLineAtOffset(f.start)===b.getLineAtOffset(d)&&((b=o.Tooltip.getTooltip(this._view))&&b.setTarget(null),f.expanded?f.collapse():f.expand(),this._annotationModel.modifyAnnotation(f))}}};f.prototype._getTooltipContents=function(a,c){return c.length===
+1&&c[0].expanded?null:h.prototype._getTooltipContents.call(this,a,c)};f.prototype._onAnnotationModelChanged=function(a){function c(a){for(l=0;l<a.length;l++)if(f.isAnnotationTypeVisible(a[l].type)){var c=a[l].start;d.getBaseModel&&(c=d.mapOffset(c,!0));c!==-1&&(j=Math.min(j,d.getLineAtOffset(c)))}}if(a.textModelChangedEvent)h.prototype._onAnnotationModelChanged.call(this,a);else{var b=this._view;if(b){var d=b.getModel(),f=this,l,e=d.getLineCount(),j=e;c(a.added);c(a.removed);c(a.changed);a=b.getRulers();
+for(l=0;l<a.length;l++)b.redrawLines(j,e,a[l])}}};return{Ruler:b,AnnotationRuler:h,LineNumberRuler:d,OverviewRuler:j,FoldingRuler:f}});
+define("orion/editor/undoStack",[],function(){function k(e,b,d){this.offset=e;this.text=b;this.previousText=d}function p(e){this.owner=e;this.changes=[]}function o(e,b){this.view=e;this.size=b!==void 0?b:100;this.reset();var d=e.getModel();d.getBaseModel&&(d=d.getBaseModel());this.model=d;var h=this;this._listener={onChanging:function(b){h._onChanging(b)},onDestroy:function(b){h._onDestroy(b)}};d.addEventListener("Changing",this._listener.onChanging);e.addEventListener("Destroy",this._listener.onDestroy)}
+k.prototype={undo:function(e,b){this._doUndoRedo(this.offset,this.previousText,this.text,e,b);return!0},redo:function(e,b){this._doUndoRedo(this.offset,this.text,this.previousText,e,b);return!0},_doUndoRedo:function(e,b,d,h,j){var f=h.getModel();if(f.mapOffset&&h.annotationModel){var a=f.mapOffset(e,!0);if(a<0)for(var c=h.annotationModel.getAnnotations(e,e+1);c.hasNext();){var i=c.next();if(i.type==="orion.annotation.folding"){i.expand();a=f.mapOffset(e,!0);break}}if(a<0)return;e=a}f.setText(b,e,
+e+d.length);j&&h.setSelection(e,e+b.length)}};p.prototype={add:function(e){this.changes.push(e)},end:function(e){this.endSelection=e.getSelection();this.endCaret=e.getCaretOffset();(e=this.owner)&&e.end&&e.end()},undo:function(e,b){this.changes.length>1&&e.setRedraw(!1);for(var d=this.changes.length-1;d>=0;d--)this.changes[d].undo(e,!1);this.changes.length>1&&e.setRedraw(!0);if(b){var d=this.startSelection.start,h=this.startSelection.end;e.setSelection(this.startCaret?d:h,this.startCaret?h:d)}(d=
+this.owner)&&d.undo&&d.undo();return this.changes.length>0},redo:function(e,b){this.changes.length>1&&e.setRedraw(!1);for(var d=0;d<this.changes.length;d++)this.changes[d].redo(e,!1);this.changes.length>1&&e.setRedraw(!0);if(b){var d=this.endSelection.start,h=this.endSelection.end;e.setSelection(this.endCaret?d:h,this.endCaret?h:d)}(d=this.owner)&&d.redo&&d.redo();return this.changes.length>0},start:function(e){this.startSelection=e.getSelection();this.startCaret=e.getCaretOffset();(e=this.owner)&&
+e.start&&e.start()}};o.prototype={add:function(e){this.compoundChange?this.compoundChange.add(e):(this.stack.splice(this.index,this.stack.length-this.index,e),this.index++,this.stack.length>this.size&&(this.stack.shift(),this.index--,this.cleanIndex--))},markClean:function(){this.endCompoundChange();this._commitUndo();this.cleanIndex=this.index},isClean:function(){return this.cleanIndex===this.getSize().undo},canUndo:function(){return this.getSize().undo>0},canRedo:function(){return this.getSize().redo>
+0},endCompoundChange:function(){this.compoundChange&&this.compoundChange.end(this.view);this.compoundChange=void 0},getSize:function(){var e=this.index,b=this.stack.length;this._undoStart!==void 0&&e++;return{undo:e,redo:b-e}},undo:function(){this._commitUndo();var e;e=!1;this._ignoreUndo=!0;do{if(this.index<=0)break;e=this.stack[--this.index]}while(!(e=e.undo(this.view,!0)));this._ignoreUndo=!1;return e},redo:function(){this._commitUndo();var e;this._ignoreUndo=!0;do{if(this.index>=this.stack.length)break;
+e=this.stack[this.index++]}while(!e.redo(this.view,!0));this._ignoreUndo=!1;return!0},reset:function(){this.index=this.cleanIndex=0;this.stack=[];this._undoStart=void 0;this._undoText="";this._undoType=0;this._ignoreUndo=!1;this._compoundChange=void 0},startCompoundChange:function(e){this._commitUndo();e=new p(e);this.add(e);this.compoundChange=e;this.compoundChange.start(this.view);return this.compoundChange},_commitUndo:function(){if(this._undoStart!==void 0)this._undoType===-1?this.add(new k(this._undoStart,
+"",this._undoText)):this.add(new k(this._undoStart,this._undoText,"")),this._undoStart=void 0,this._undoText="",this._undoType=0;this.endCompoundChange()},_onDestroy:function(){this.model.removeEventListener("Changing",this._listener.onChanging);this.view.removeEventListener("Destroy",this._listener.onDestroy)},_onChanging:function(e){var b=e.text,d=e.start,h=e.removedCharCount,e=e.addedCharCount;if(!this._ignoreUndo){this._undoStart!==void 0&&!(e===1&&h===0&&this._undoType===1&&d===this._undoStart+
+this._undoText.length||e===0&&h===1&&this._undoType===-1&&(d+1===this._undoStart||d===this._undoStart))&&this._commitUndo();if(!this.compoundChange)if(e===1&&h===0){if(this._undoStart===void 0)this._undoStart=d;this._undoText+=b;this._undoType=1;return}else if(e===0&&h===1){b=this._undoText.length>0&&this._undoStart===d;this._undoStart=d;this._undoType=-1;b?this._undoText+=this.model.getText(d,d+h):this._undoText=this.model.getText(d,d+h)+this._undoText;return}this.add(new k(d,b,this.model.getText(d,
+d+h)))}}};return{UndoStack:o}});
+define("orion/editor/textDND",[],function(){function k(k,o){this._view=k;this._undoStack=o;this._dragSelection=null;this._dropOffset=-1;this._dropText=null;var e=this;this._listener={onDragStart:function(b){e._onDragStart(b)},onDragEnd:function(b){e._onDragEnd(b)},onDragEnter:function(b){e._onDragEnter(b)},onDragOver:function(b){e._onDragOver(b)},onDrop:function(b){e._onDrop(b)},onDestroy:function(b){e._onDestroy(b)}};k.addEventListener("DragStart",this._listener.onDragStart);k.addEventListener("DragEnd",
+this._listener.onDragEnd);k.addEventListener("DragEnter",this._listener.onDragEnter);k.addEventListener("DragOver",this._listener.onDragOver);k.addEventListener("Drop",this._listener.onDrop);k.addEventListener("Destroy",this._listener.onDestroy)}k.prototype={destroy:function(){var k=this._view;if(k)k.removeEventListener("DragStart",this._listener.onDragStart),k.removeEventListener("DragEnd",this._listener.onDragEnd),k.removeEventListener("DragEnter",this._listener.onDragEnter),k.removeEventListener("DragOver",
+this._listener.onDragOver),k.removeEventListener("Drop",this._listener.onDrop),k.removeEventListener("Destroy",this._listener.onDestroy),this._view=null},_onDestroy:function(){this.destroy()},_onDragStart:function(k){var o=this._view,e=o.getSelection(),o=o.getModel();if(o.getBaseModel)e.start=o.mapOffset(e.start),e.end=o.mapOffset(e.end),o=o.getBaseModel();if(o=o.getText(e.start,e.end))this._dragSelection=e,k.event.dataTransfer.effectAllowed="copyMove",k.event.dataTransfer.setData("Text",o)},_onDragEnd:function(k){var o=
+this._view;if(this._dragSelection){this._undoStack&&this._undoStack.startCompoundChange();(k=k.event.dataTransfer.dropEffect==="move")&&o.setText("",this._dragSelection.start,this._dragSelection.end);if(this._dropText){var e=this._dropText,b=this._dropOffset;if(k)if(b>=this._dragSelection.end)b-=this._dragSelection.end-this._dragSelection.start;else if(b>=this._dragSelection.start)b=this._dragSelection.start;o.setText(e,b,b);o.setSelection(b,b+e.length);this._dropText=null;this._dropOffset=-1}this._undoStack&&
+this._undoStack.endCompoundChange()}this._dragSelection=null},_onDragEnter:function(k){this._onDragOver(k)},_onDragOver:function(k){var o=k.event.dataTransfer.types;if(o){var e=!this._view.getOptions("readonly");e&&(e=o.contains?o.contains("text/plain"):o.indexOf("text/plain")!==-1);if(!e)k.event.dataTransfer.dropEffect="none"}},_onDrop:function(k){var o=this._view,e=k.event.dataTransfer.getData("Text");if(e)k=o.getOffsetAtLocation(k.x,k.y),this._dragSelection?(this._dropOffset=k,this._dropText=e):
+(o.setText(e,k,k),o.setSelection(k,k+e.length))}};return{TextDND:k}});
+define("orion/editor/editor","i18n!orion/editor/nls/messages,orion/keyBinding,orion/editor/eventTarget,orion/editor/tooltip,orion/editor/annotations,orion/util".split(","),function(k,p,o,e,b,d){function h(b){this._textViewFactory=b.textViewFactory;this._undoStackFactory=b.undoStackFactory;this._textDNDFactory=b.textDNDFactory;this._annotationFactory=b.annotationFactory;this._foldingRulerFactory=b.foldingRulerFactory;this._lineNumberRulerFactory=b.lineNumberRulerFactory;this._contentAssistFactory=
+b.contentAssistFactory;this._keyBindingFactory=b.keyBindingFactory;this._statusReporter=b.statusReporter;this._domNode=b.domNode;this._foldingRuler=this._overviewRuler=this._lineNumberRuler=this._annotationRuler=this._annotationModel=this._annotationStyler=null;this._dirty=!1;this._title=this._contentAssist=null}function j(b){var a=this,c=Array.prototype.slice.call(arguments,1);return c.length?function(){return arguments.length?a.apply(b,c.concat(Array.prototype.slice.call(arguments))):a.apply(b,
+c)}:function(){return arguments.length?a.apply(b,arguments):a.call(b)}}h.prototype={destroy:function(){this.uninstallTextView();this._textViewFactory=this._undoStackFactory=this._textDNDFactory=this._annotationFactory=this._foldingRulerFactory=this._lineNumberRulerFactory=this._contentAssistFactory=this._keyBindingFactory=this._statusReporter=this._domNode=null},getAnnotationModel:function(){return this._annotationModel},getAnnotationRuler:function(){return this._annotationRuler},getAnnotationStyler:function(){return this._annotationStyler},
+getFoldingRuler:function(){return this._foldingRuler},getLineNumberRuler:function(){return this._lineNumberRuler},getModel:function(){var b=this._textView.getModel();b.getBaseModel&&(b=b.getBaseModel());return b},getOverviewRuler:function(){return this._overviewRuler},getTextView:function(){return this._textView},getTitle:function(){return this._title},getKeyModes:function(){return this._textView.getKeyModes()},isDirty:function(){return this._dirty},setAnnotationRulerVisible:function(b){if(this._annotationRulerVisible!==
+b&&(this._annotationRulerVisible=b,this._annotationRuler)){var a=this._textView;b?a.addRuler(this._annotationRuler,0):a.removeRuler(this._annotationRuler)}},setFoldingRulerVisible:function(b){if(this._foldingRulerVisible!==b&&(this._foldingRulerVisible=b,this._foldingRuler)){var a=this._textView;a.getModel().getBaseModel&&(b?a.addRuler(this._foldingRuler,100):a.removeRuler(this._foldingRuler))}},setDirty:function(b){if(this._dirty!==b)this._dirty=b,this.onDirtyChanged({type:"DirtyChanged"})},setLineNumberRulerVisible:function(b){if(this._lineNumberRulerVisible!==
+b&&(this._lineNumberRulerVisible=b,this._lineNumberRuler)){var a=this._textView;b?a.addRuler(this._lineNumberRuler,1):a.removeRuler(this._lineNumberRuler)}},setOverviewRulerVisible:function(b){if(this._overviewRulerVisible!==b&&(this._overviewRulerVisible=b,this._overviewRuler)){var a=this._textView;b?a.addRuler(this._overviewRuler):a.removeRuler(this._overviewRuler)}},mapOffset:function(b,a){var c=this._textView.getModel();c.getBaseModel&&(b=c.mapOffset(b,a));return b},getCaretOffset:function(){return this.mapOffset(this._textView.getCaretOffset())},
+getSelection:function(){var b=this._textView,a=b.getSelection(),b=b.getModel();if(b.getBaseModel)a.start=b.mapOffset(a.start),a.end=b.mapOffset(a.end);return a},getText:function(b,a){var c=this._textView.getModel();c.getBaseModel&&(c=c.getBaseModel());return c.getText(b,a)},_expandOffset:function(d){var a=this._textView.getModel(),c=this._annotationModel;if(c&&a.getBaseModel)for(d=c.getAnnotations(d,d+1);d.hasNext();)a=d.next(),a.type===b.AnnotationType.ANNOTATION_FOLDING&&a.expand&&(a.expand(),c.modifyAnnotation(a))},
+setCaretOffset:function(b,a,c){var d=this._textView,e=d.getModel();e.getBaseModel&&(this._expandOffset(b),b=e.mapOffset(b,!0));d.setCaretOffset(b,a,c)},setText:function(b,a,c){var d=this._textView,e=d.getModel();e.getBaseModel&&(a!==void 0&&(this._expandOffset(a),a=e.mapOffset(a,!0)),c!==void 0&&(this._expandOffset(c),c=e.mapOffset(c,!0)));d.setText(b,a,c)},setFoldingEnabled:function(b){this.setFoldingRulerVisible(b)},setSelection:function(b,a,c,d){var e=this._textView,n=e.getModel();n.getBaseModel&&
+(this._expandOffset(b),this._expandOffset(a),b=n.mapOffset(b,!0),a=n.mapOffset(a,!0));e.setSelection(b,a,c,d)},moveSelection:function(b,a,c,d){var e=this._textView;this.setSelection(b,a||b,1/3,function(){(d===void 0||d)&&e.focus();c&&c()})},checkDirty:function(){this.setDirty(!this._undoStack.isClean())},reportStatus:function(b,a,c){this._statusReporter&&this._statusReporter(b,a,c)},_getTooltipInfo:function(b,a){var c=this._textView,d=this.getAnnotationModel();if(!d)return null;var e=this._annotationStyler;
+if(!e)return null;var n=c.getOffsetAtLocation(b,a);if(n===-1)return null;n=this.mapOffset(n);e=e.getAnnotationsByType(d,n,n+1);d=[];for(n=0;n<e.length;n++)e[n].rangeStyle&&d.push(e[n]);if(d.length===0)return null;c=c.convert({x:b,y:a},"document","page");return{contents:d,anchor:"left",x:c.x+10,y:c.y+20}},_highlightCurrentLine:function(d,a){var c=this._annotationModel;if(c){var i=this._textView.getModel(),e=a?i.getLineAtOffset(a.start):-1,n=i.getLineAtOffset(d.start),l=d.start===d.end,h=!a||a.start===
+a.end,j=i.getLineStart(n),k=i.getLineEnd(n);i.getBaseModel&&(j=i.mapOffset(j),k=i.mapOffset(k));i=this._currentLineAnnotation;if(!(e===n&&h&&l&&i&&i.start===j&&i.end===k)){var e=i?[i]:null,o;l&&(i=b.AnnotationType.createAnnotation(b.AnnotationType.ANNOTATION_CURRENT_LINE,j,k),o=[i]);this._currentLineAnnotation=i;c.replaceAnnotations(e,o)}}},installTextView:function(){this._textView=this._textViewFactory();if(this._undoStackFactory)this._undoStack=this._undoStackFactory.createUndoStack(this);if(this._textDNDFactory)this._textDND=
+this._textDNDFactory.createTextDND(this,this._undoStack);if(this._contentAssistFactory)this._contentAssist=this._contentAssistFactory.createContentAssistMode(this).getContentAssist();var d=this,a=this._textView,c=this;this._listener={onModelChanged:function(){c.checkDirty()},onMouseOver:function(a){c._listener.onMouseMove(a)},onMouseMove:function(b){var d=e.Tooltip.getTooltip(a);if(d&&!(c._listener.lastMouseX===b.event.clientX&&c._listener.lastMouseY===b.event.clientY))c._listener.lastMouseX=b.event.clientX,
+c._listener.lastMouseY=b.event.clientY,d.setTarget({x:b.x,y:b.y,getTooltipInfo:function(){return c._getTooltipInfo(this.x,this.y)}})},onMouseOut:function(b){var d=e.Tooltip.getTooltip(a);if(d&&!(c._listener.lastMouseX===b.event.clientX&&c._listener.lastMouseY===b.event.clientY))c._listener.lastMouseX=b.event.clientX,c._listener.lastMouseY=b.event.clientY,d.setTarget(null)},onScroll:function(){var c=e.Tooltip.getTooltip(a);c&&c.setTarget(null)},onSelection:function(a){c._updateCursorStatus();c._highlightCurrentLine(a.newValue,
+a.oldValue)}};a.addEventListener("ModelChanged",this._listener.onModelChanged);a.addEventListener("Selection",this._listener.onSelection);a.addEventListener("MouseOver",this._listener.onMouseOver);a.addEventListener("MouseOut",this._listener.onMouseOut);a.addEventListener("MouseMove",this._listener.onMouseMove);a.addEventListener("Scroll",this._listener.onScroll);this._keyBindingFactory&&(typeof this._keyBindingFactory==="function"?this._keyBindingFactory(this,this.getKeyModes(),this._undoStack,this._contentAssist):
+this._keyBindingFactory.createKeyBindings(d,this._undoStack,this._contentAssist));var i=function(a){if(a!==void 0&&a!==-1){for(var c=this.getView().getModel(),i=this.getAnnotationModel(),e=d.mapOffset(c.getLineStart(a)),a=d.mapOffset(c.getLineEnd(a)),c=i.getAnnotations(e,a),m=null;c.hasNext();){var g=c.next();if(g.type===b.AnnotationType.ANNOTATION_BOOKMARK){m=g;break}}m?i.removeAnnotation(m):(m=b.AnnotationType.createAnnotation(b.AnnotationType.ANNOTATION_BOOKMARK,e,a),m.title=void 0,i.addAnnotation(m))}};
+if(this._annotationFactory){var m=a.getModel();m.getBaseModel&&(m=m.getBaseModel());if(this._annotationModel=this._annotationFactory.createAnnotationModel(m))if(m=this._annotationStyler=this._annotationFactory.createAnnotationStyler(a,this._annotationModel))m.addAnnotationType(b.AnnotationType.ANNOTATION_CURRENT_SEARCH),m.addAnnotationType(b.AnnotationType.ANNOTATION_MATCHING_SEARCH),m.addAnnotationType(b.AnnotationType.ANNOTATION_ERROR),m.addAnnotationType(b.AnnotationType.ANNOTATION_WARNING),m.addAnnotationType(b.AnnotationType.ANNOTATION_MATCHING_BRACKET),
+m.addAnnotationType(b.AnnotationType.ANNOTATION_CURRENT_BRACKET),m.addAnnotationType(b.AnnotationType.ANNOTATION_CURRENT_LINE),m.addAnnotationType(b.AnnotationType.ANNOTATION_READ_OCCURRENCE),m.addAnnotationType(b.AnnotationType.ANNOTATION_WRITE_OCCURRENCE),m.addAnnotationType(b.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP),m.addAnnotationType(b.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP),m.addAnnotationType(b.AnnotationType.ANNOTATION_LINKED_GROUP),m.addAnnotationType("orion.annotation.highlightError");
+a.annotationModel=this._annotationModel;var m=this._annotationFactory.createAnnotationRulers(this._annotationModel),n=this._annotationRuler=m.annotationRuler;if(n)n.onDblClick=i,n.setMultiAnnotationOverlay({html:"<div class='annotationHTML overlay'></div>"}),n.addAnnotationType(b.AnnotationType.ANNOTATION_ERROR),n.addAnnotationType(b.AnnotationType.ANNOTATION_WARNING),n.addAnnotationType(b.AnnotationType.ANNOTATION_TASK),n.addAnnotationType(b.AnnotationType.ANNOTATION_BOOKMARK);this.setAnnotationRulerVisible(!0);
+if(n=this._overviewRuler=m.overviewRuler)n.addAnnotationType(b.AnnotationType.ANNOTATION_CURRENT_SEARCH),n.addAnnotationType(b.AnnotationType.ANNOTATION_MATCHING_SEARCH),n.addAnnotationType(b.AnnotationType.ANNOTATION_ERROR),n.addAnnotationType(b.AnnotationType.ANNOTATION_WARNING),n.addAnnotationType(b.AnnotationType.ANNOTATION_TASK),n.addAnnotationType(b.AnnotationType.ANNOTATION_BOOKMARK),n.addAnnotationType(b.AnnotationType.ANNOTATION_MATCHING_BRACKET),n.addAnnotationType(b.AnnotationType.ANNOTATION_CURRENT_BRACKET),
+n.addAnnotationType(b.AnnotationType.ANNOTATION_CURRENT_LINE),n.addAnnotationType(b.AnnotationType.ANNOTATION_READ_OCCURRENCE),n.addAnnotationType(b.AnnotationType.ANNOTATION_WRITE_OCCURRENCE);this.setOverviewRulerVisible(!0)}if(this._lineNumberRulerFactory)this._lineNumberRuler=this._lineNumberRulerFactory.createLineNumberRuler(this._annotationModel),this._lineNumberRuler.onDblClick=i,this.setLineNumberRulerVisible(!0);if(this._foldingRulerFactory)this._foldingRuler=this._foldingRulerFactory.createFoldingRuler(this._annotationModel),
+this._foldingRuler.addAnnotationType(b.AnnotationType.ANNOTATION_FOLDING),this.setFoldingRulerVisible(!1);this.dispatchEvent({type:"TextViewInstalled",textView:a})},uninstallTextView:function(){var b=this._textView;if(b)b.destroy(),this._textView=this._undoStack=this._textDND=this._contentAssist=this._listener=this._annotationModel=this._annotationStyler=this._annotationRuler=this._overviewRuler=this._lineNumberRuler=this._foldingRuler=this._currentLineAnnotation=this._title=null,this._dirty=!1,this.dispatchEvent({type:"TextViewUninstalled",
+textView:b})},_updateCursorStatus:function(){var b=this.getModel(),a=this.getCaretOffset(),c=b.getLineAtOffset(a),b=b.getLineStart(c);a-=b;for(var b=this.getKeyModes(),i=0;i<b.length;i++){var e=b[i];if(e.isActive()&&e.isStatusActive&&e.isStatusActive())return}this.reportStatus(d.formatMessage(k.lineColumn,c+1,a+1))},showProblems:function(d){var a=this._annotationModel;if(a){for(var c=[],i=[],e=a.getTextModel(),n=a.getAnnotations(0,e.getCharCount()),l;n.hasNext();)l=n.next(),(l.type===b.AnnotationType.ANNOTATION_ERROR||
+l.type===b.AnnotationType.ANNOTATION_WARNING)&&c.push(l);if(d)for(n=0;n<d.length;n++)if(l=d[n]){var h=l.description.replace(/'/g,"&#39;").replace(/"/g,"&#34;"),j=e.getLineStart(l.line-1);l=b.AnnotationType.createAnnotation(l.severity==="error"?b.AnnotationType.ANNOTATION_ERROR:b.AnnotationType.ANNOTATION_WARNING,j+l.start-1,j+l.end,h);i.push(l)}a.replaceAnnotations(c,i)}},showOccurrences:function(d){var a=this._annotationModel;if(a){for(var c=[],i=[],e=a.getTextModel(),h=a.getAnnotations(0,e.getCharCount()),
+l;h.hasNext();)l=h.next(),(l.type===b.AnnotationType.ANNOTATION_READ_OCCURRENCE||l.type===b.AnnotationType.ANNOTATION_WRITE_OCCURRENCE)&&c.push(l);if(d)for(h=0;h<d.length;h++)if(l=d[h]){var j=e.getLineStart(l.line-1);l=b.AnnotationType.createAnnotation(l.readAccess===!0?b.AnnotationType.ANNOTATION_READ_OCCURRENCE:b.AnnotationType.ANNOTATION_WRITE_OCCURRENCE,j+l.start-1,j+l.end,l.description);i.push(l)}a.replaceAnnotations(c,i)}},showSelection:function(b,a,c,d,e){typeof b==="number"?(typeof a!=="number"&&
+(a=b),this.moveSelection(b,a)):typeof c==="number"&&(b=this.getModel().getLineStart(c-1),typeof d==="number"&&(b+=d),typeof e!=="number"&&(e=0),this.moveSelection(b,b+e))},setInput:function(b,a,c,d){this._title=b;this._textView&&(d?(this._undoStack.markClean(),this.checkDirty()):(a?this._textView.setText(a):c!==null&&c!==void 0&&(this._textView.setText(c),this._textView.getModel().setLineDelimiter("auto"),this._highlightCurrentLine(this._textView.getSelection())),this._undoStack.reset(),this.checkDirty(),
+this._textView.focus()));this.onInputChanged({type:"InputChanged",title:b,message:a,contents:c,contentsSaved:d})},onInputChanged:function(b){return this.dispatchEvent(b)},onGotoLine:function(b,a,c){if(this._textView){var d=this.getModel(),b=Math.max(0,Math.min(b,d.getLineCount()-1)),e=d.getLineStart(b),h=0;c===void 0&&(c=0);typeof a==="string"?(b=d.getLine(b).indexOf(a),b!==-1&&(h=b,c=h+a.length)):(h=a,a=d.getLineEnd(b)-e,h=Math.min(h,a),c=Math.min(c,a));this.moveSelection(e+h,e+c)}},onDirtyChanged:function(b){return this.dispatchEvent(b)}};
+o.EventTarget.addMixin(h.prototype);if(!Function.prototype.bind)Function.prototype.bind=j;return{Editor:h}});define("orion/editor/regex",[],function(){return{escape:function(k){return k.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$&")},parse:function(k){return(k=/^\s*\/(.+)\/([gim]{0,3})\s*$/.exec(k))?{pattern:k[1],flags:k[2]}:null}}});
+define("orion/objects",[],function(){return{mixin:function(k){Array.prototype.slice.call(arguments,1).forEach(function(p){for(var o=Object.keys(p),e=0;e<o.length;e++){var b=o[e];k[b]=p[b]}})}}});
+define("orion/editor/find","i18n!orion/editor/nls/messages,orion/keyBinding,orion/editor/keyModes,orion/editor/annotations,orion/editor/regex,orion/objects,orion/util".split(","),function(k,p,o,e,b,d,h){function j(a){var d=a.getTextView();o.KeyMode.call(this,d);this.editor=a;this._active=!1;this._success=!0;this._ignoreSelection=!1;this._prefix="";d.setAction("incrementalFindCancel",function(){this.setActive(!1);return!0}.bind(this));d.setAction("incrementalFindBackspace",function(){return this._backspace()}.bind(this));
+var f=this;this._listener={onVerify:function(a){var c=f.editor,d=c.getModel(),i=c.mapOffset(a.start),c=c.mapOffset(a.end),d=d.getText(i,c);if((d=f._prefix.match(RegExp("^"+b.escape(d),"i")))&&d.length>0)f._prefix+=a.text,f._success=!0,f._status(),f.find(f._forward,!0),a.text=null},onSelection:function(){f._ignoreSelection||f.setActive(!1)}}}function f(a,b,d){if(a){this._editor=a;this._undoStack=b;this._showAll=!0;this._visible=!1;this._wrap=this._caseInsensitive=!0;this._wholeWord=!1;this._incremental=
+!0;this._regex=!1;this._findAfterReplace=!0;this._reverse=this._hideAfterFind=!1;this._timer=this._end=this._start=void 0;this._lastString="";var f=this;this._listeners={onEditorFocus:function(a){f._removeCurrentAnnotation(a)}};this.setOptions(d)}}var a={};j.prototype=new o.KeyMode;d.mixin(j.prototype,{createKeyBindings:function(){var a=p.KeyBinding,b=[];b.push({actionID:"incrementalFindBackspace",keyBinding:new a(8)});b.push({actionID:"incrementalFindCancel",keyBinding:new a(13)});b.push({actionID:"incrementalFindCancel",
+keyBinding:new a(27)});b.push({actionID:"incrementalFindReverse",keyBinding:new a(38)});b.push({actionID:"incrementalFind",keyBinding:new a(40)});b.push({actionID:"incrementalFindReverse",keyBinding:new a("k",!0,!0)});b.push({actionID:"incrementalFind",keyBinding:new a("k",!0)});return b},find:function(a,b){this._forward=a;if(!this.isActive())return this.setActive(!0),!1;var d=this._prefix;if(d.length===0)return!1;var f=this.editor,e=f.getModel(),e=a?this._success?b?this._start:f.getCaretOffset()+
+1:0:this._success?b?this._start:f.getCaretOffset():e.getCharCount()-1;if(d=f.getModel().find({string:d,start:e,reverse:!a,caseInsensitive:d.toLowerCase()===d}).next()){if(!b)this._start=e;this._ignoreSelection=this._success=!0;f.moveSelection(a?d.start:d.end,a?d.end:d.start);this._ignoreSelection=!1}else this._success=!1;this._status();return!0},isActive:function(){return this._active},isStatusActive:function(){return this.isActive()},setActive:function(a){if(this._active!==a)this._active=a,this._prefix=
+"",this._success=!0,a=this.editor.getTextView(),this._start=this.editor.getCaretOffset(),this.editor.setCaretOffset(this._start),this._active?(a.addEventListener("Verify",this._listener.onVerify),a.addEventListener("Selection",this._listener.onSelection),a.addKeyMode(this)):(a.removeEventListener("Verify",this._listener.onVerify),a.removeEventListener("Selection",this._listener.onSelection),a.removeKeyMode(this)),this._status()},_backspace:function(){var a=this._prefix,a=this._prefix=a.substring(0,
+a.length-1);return a.length===0?(this._ignoreSelection=this._success=!0,this.editor.setCaretOffset(this.editor.getSelection().start),this._ignoreSelection=!1,this._status(),!0):this.find(this._forward,!0)},_status:function(){if(this.isActive()){var a;a=this._forward?this._success?k.incrementalFindStr:k.incrementalFindStrNotFound:this._success?k.incrementalFindReverseStr:k.incrementalFindReverseStrNotFound;a=h.formatMessage(a,this._prefix);this.editor.reportStatus(a,this._success?"":"error")}else this.editor.reportStatus("")}});
+a.IncrementalFind=j;f.prototype={find:function(a,b,d){this.setOptions({reverse:!a});var f=this.getFindString(),e;if(b)f=b.findString||this.getFindString(),e=b.count;a=this.getOptions();this.setOptions(b);b=d?this._startOffset:this.getStartOffset();if((e=this._doFind(f,b,e))&&!d)this._startOffset=e.start;this.setOptions(a);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 a=this._editor.getSelection();return this._editor.getText(a.start,a.end)||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,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();this._editor.getTextView().removeEventListener("Focus",this._listeners.onEditorFocus);this._editor.getTextView().focus()},isVisible:function(){return this._visible},replace:function(){var a=this.getFindString();if(a){var b=this._editor,d=this.getReplaceString(),f=b.getSelection().start;if(b=b.getModel().find({string:a,start:f,reverse:!1,wrap:this._wrap,
+regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive}).next())this.startUndo(),this._doReplace(b.start,b.end,a,d),this.endUndo()}this._findAfterReplace&&a&&this._doFind(a,this.getStartOffset())},replaceAll:function(){var a=this.getFindString();if(a){this._replacingAll=!0;var b=this._editor,d=b.getTextView();b.reportStatus(k.replaceAll);var f=this.getReplaceString(),e=this;window.setTimeout(function(){for(var j=0,q=0;;){var o=e._doFind(a,j);if(!o)break;q++;q===1&&(d.setRedraw(!1),
+e.startUndo());e._doReplace(o.start,o.end,a,f);j=e.getStartOffset()}q>0&&(e.endUndo(),d.setRedraw(!0));j>0?b.reportStatus(h.formatMessage(k.replacedMatches,q)):b.reportStatus(k.nothingReplaced,"error");e._replacingAll=!1},100)}},setOptions:function(a){if(a){if((a.showAll===!0||a.showAll===!1)&&this._showAll!==a.showAll)if(this._showAll=a.showAll,this.isVisible())if(this._showAll)this._markAllOccurrences(!0);else{var b=this._editor.getAnnotationModel();b&&b.removeAnnotations(e.AnnotationType.ANNOTATION_MATCHING_SEARCH)}if(a.caseInsensitive===
+!0||a.caseInsensitive===!1)this._caseInsensitive=a.caseInsensitive;if(a.wrap===!0||a.wrap===!1)this._wrap=a.wrap;if(a.wholeWord===!0||a.wholeWord===!1)this._wholeWord=a.wholeWord;if(a.incremental===!0||a.incremental===!1)this._incremental=a.incremental;if(a.regex===!0||a.regex===!1)this._regex=a.regex;if(a.findAfterReplace===!0||a.findAfterReplace===!1)this._findAfterReplace=a.findAfterReplace;if(a.hideAfterFind===!0||a.hideAfterFind===!1)this._hideAfterFind=a.hideAfterFind;if(a.reverse===!0||a.reverse===
+!1)this._reverse=a.reverse;if(a.hasOwnProperty("start"))this._start=a.start;if(a.hasOwnProperty("end"))this._end=a.end}},show:function(a){this._visible=!0;if(a){if(!this._savedOptions)this._savedOptions=[];this._savedOptions.push(this.getOptions());this.setOptions(a)}this._startOffset=this._editor.getSelection().start;this._editor.getTextView().addEventListener("Focus",this._listeners.onEditorFocus);var b=this;window.setTimeout(function(){b._incremental&&b.find(!0,null,!0)},0)},startUndo:function(){this._undoStack&&
+this._undoStack.startCompoundChange()},endUndo:function(){this._undoStack&&this._undoStack.endCompoundChange()},_doFind:function(a,b,d){var d=d||1,f=this._editor;if(!a)return this._removeAllAnnotations(),null;this._lastString=a;for(var b=f.getModel().find({string:a,start:b,end:this._end,reverse:this._reverse,wrap:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive}),l,h=0;h<d&&b.hasNext();h++)l=b.next();if(!this._replacingAll){l?this._editor.reportStatus(""):
+this._editor.reportStatus(k.notFound,"error");if(this.isVisible()){d=e.AnnotationType.ANNOTATION_CURRENT_SEARCH;if(b=f.getAnnotationModel())b.removeAnnotations(d),l&&b.addAnnotation(e.AnnotationType.createAnnotation(d,l.start,l.end));if(this._showAll){this._timer&&window.clearTimeout(this._timer);var j=this;this._timer=window.setTimeout(function(){j._markAllOccurrences(!!l,a);j._timer=null},500)}}l&&f.moveSelection(l.start,l.end,null,!1)}return l},_doReplace:function(a,b,d,f){var e=this._editor;if(this._regex&&
+(f=e.getText(a,b).replace(RegExp(d,this._caseInsensitive?"i":""),f),!f))return;e.setText(f,a,b);e.setSelection(a,a+f.length,!0)},_markAllOccurrences:function(a,b){var d=this._editor.getAnnotationModel();if(d){for(var f=e.AnnotationType.ANNOTATION_MATCHING_SEARCH,l=d.getAnnotations(0,d.getTextModel().getCharCount()),h=[],j;l.hasNext();){var k=l.next();k.type===f&&h.push(k)}if(this.isVisible()&&a&&b){l=this._editor.getModel().find({string:b,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive});
+for(j=[];l.hasNext();)k=l.next(),j.push(e.AnnotationType.createAnnotation(f,k.start,k.end))}d.replaceAnnotations(h,j)}},_removeAllAnnotations:function(){var a=this._editor.getAnnotationModel();a&&(a.removeAnnotations(e.AnnotationType.ANNOTATION_CURRENT_SEARCH),a.removeAnnotations(e.AnnotationType.ANNOTATION_MATCHING_SEARCH))},_removeCurrentAnnotation:function(){var a=this._editor.getAnnotationModel();a&&a.removeAnnotations(e.AnnotationType.ANNOTATION_CURRENT_SEARCH)}};a.Find=f;return a});
+define("orion/editor/actions","i18n!orion/editor/nls/messages,orion/keyBinding,orion/editor/annotations,orion/editor/tooltip,orion/editor/find,orion/util".split(","),function(k,p,o,e,b,d){function h(a,c,d){this.editor=a;this.undoStack=c;this._incrementalFind=new b.IncrementalFind(a);this._find=d?d:new b.Find(a,c);this._lastEditLocation=null;this.init()}function j(a,c,b,d){this.editor=a;this.undoStack=c;this.contentAssist=b;this.linkedMode=d;this.contentAssist&&this.contentAssist.addEventListener("ProposalApplied",
+this.contentAssistProposalApplied.bind(this));this.init()}var f={};h.prototype={init:function(){var a=this.editor.getTextView();this._lastEditListener={onModelChanged:function(a){if(this.editor.isDirty())this._lastEditLocation=a.start+a.addedCharCount}.bind(this)};a.addEventListener("ModelChanged",this._lastEditListener.onModelChanged);a.setAction("undo",function(){return this.undoStack?(this.undoStack.undo(),!0):!1}.bind(this),{name:k.undo});a.setAction("redo",function(){return this.undoStack?(this.undoStack.redo(),
+!0):!1}.bind(this),{name:k.redo});a.setKeyBinding(new p.KeyBinding("f",!0),"find");a.setAction("find",function(){if(this._find){var a=this.editor.getSelection();(a=prompt(k.find,this.editor.getText(a.start,a.end)))&&this._find.find(!0,{findString:a})}}.bind(this),{name:k.find});a.setKeyBinding(new p.KeyBinding("k",!0),"findNext");a.setAction("findNext",function(a){return this._find?(this._find.find(!0,a),!0):!1}.bind(this),{name:k.findNext});a.setKeyBinding(new p.KeyBinding("k",!0,!0),"findPrevious");
+a.setAction("findPrevious",function(a){return this._find?(this._find.find(!1,a),!0):!1}.bind(this),{name:k.findPrevious});a.setKeyBinding(new p.KeyBinding("j",!0),"incrementalFind");a.setAction("incrementalFind",function(){this._incrementalFind&&this._incrementalFind.find(!0);return!0}.bind(this),{name:k.incrementalFind});a.setKeyBinding(new p.KeyBinding("j",!0,!0),"incrementalFindReverse");a.setAction("incrementalFindReverse",function(){this._incrementalFind&&this._incrementalFind.find(!1);return!0}.bind(this),
+{name:k.incrementalFindReverse});a.setAction("tab",function(){return this.indentLines()}.bind(this));a.setAction("shiftTab",function(){return this.unindentLines()}.bind(this),{name:k.unindentLines});a.setKeyBinding(new p.KeyBinding(38,!1,!1,!0),"moveLinesUp");a.setAction("moveLinesUp",function(){return this.moveLinesUp()}.bind(this),{name:k.moveLinesUp});a.setKeyBinding(new p.KeyBinding(40,!1,!1,!0),"moveLinesDown");a.setAction("moveLinesDown",function(){return this.moveLinesDown()}.bind(this),{name:k.moveLinesDown});
+a.setKeyBinding(new p.KeyBinding(38,!0,!1,!0),"copyLinesUp");a.setAction("copyLinesUp",function(){return this.copyLinesUp()}.bind(this),{name:k.copyLinesUp});a.setKeyBinding(new p.KeyBinding(40,!0,!1,!0),"copyLinesDown");a.setAction("copyLinesDown",function(){return this.copyLinesDown()}.bind(this),{name:k.copyLinesDown});a.setKeyBinding(new p.KeyBinding("d",!0,!1,!1),"deleteLines");a.setAction("deleteLines",function(){return this.deleteLines()}.bind(this),{name:k.deleteLines});a.setKeyBinding(new p.KeyBinding("l",
+!d.isMac,!1,!1,d.isMac),"gotoLine");a.setAction("gotoLine",function(){return this.gotoLine()}.bind(this),{name:k.gotoLine});a.setKeyBinding(new p.KeyBinding(190,!0),"nextAnnotation");a.setAction("nextAnnotation",function(){return this.nextAnnotation(!0)}.bind(this),{name:k.nextAnnotation});a.setKeyBinding(new p.KeyBinding(188,!0),"previousAnnotation");a.setAction("previousAnnotation",function(){return this.nextAnnotation(!1)}.bind(this),{name:k.prevAnnotation});a.setKeyBinding(new p.KeyBinding("e",
+!0,!1,!0,!1),"expand");a.setAction("expand",function(){return this.expandAnnotation(!0)}.bind(this),{name:k.expand});a.setKeyBinding(new p.KeyBinding("c",!0,!1,!0,!1),"collapse");a.setAction("collapse",function(){return this.expandAnnotation(!1)}.bind(this),{name:k.collapse});a.setKeyBinding(new p.KeyBinding("e",!0,!0,!0,!1),"expandAll");a.setAction("expandAll",function(){return this.expandAnnotations(!0)}.bind(this),{name:k.expandAll});a.setKeyBinding(new p.KeyBinding("c",!0,!0,!0,!1),"collapseAll");
+a.setAction("collapseAll",function(){return this.expandAnnotations(!1)}.bind(this),{name:k.collapseAll});a.setKeyBinding(new p.KeyBinding("q",!d.isMac,!1,!1,d.isMac),"lastEdit");a.setAction("lastEdit",function(){return this.gotoLastEdit()}.bind(this),{name:k.lastEdit})},copyLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var c=a.getModel(),b=a.getSelection(),d=c.getLineAtOffset(b.start),b=c.getLineAtOffset(b.end>b.start?b.end-1:b.end),f=c.getLineStart(d),
+d=c.getLineEnd(b,!0),e=c.getLineCount(),h="",f=c.getText(f,d);b===e-1&&(f=(h=c.getLineDelimiter())+f);a.setText(f,d,d);a.setSelection(d+h.length,d+f.length);return!0},copyLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var c=a.getModel(),b=a.getSelection(),d=c.getLineAtOffset(b.start),b=c.getLineAtOffset(b.end>b.start?b.end-1:b.end),d=c.getLineStart(d),f=c.getLineEnd(b,!0),e=c.getLineCount(),h="",f=c.getText(d,f);b===e-1&&(f+=h=c.getLineDelimiter());a.setText(f,
+d,d);a.setSelection(d,d+f.length-h.length);return!0},deleteLines:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var c=a.getSelection(),b=a.getModel(),d=b.getLineAtOffset(c.start),c=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),d=b.getLineStart(d),b=b.getLineEnd(c,!0);a.setText("",d,b);return!0},expandAnnotation:function(a){var c=this.editor,b=c.getAnnotationModel();if(!b)return!0;var d=c.getModel(),f=c.getCaretOffset(),e=d.getLineAtOffset(f),f=d.getLineStart(e),e=
+d.getLineEnd(e,!0);d.getBaseModel&&(f=d.mapOffset(f),e=d.mapOffset(e),d.getBaseModel());for(var h,d=b.getAnnotations(f,e);!h&&d.hasNext();)f=d.next(),f.type===o.AnnotationType.ANNOTATION_FOLDING&&(h=f);h&&a!==h.expanded&&(a?h.expand():(c.setCaretOffset(h.start),h.collapse()),b.modifyAnnotation(h));return!0},expandAnnotations:function(a){var c=this.editor,b=c.getTextView(),d=c.getAnnotationModel();if(!d)return!0;var c=c.getModel(),f=d.getAnnotations(0,c.getCharCount());for(b.setRedraw(!1);f.hasNext();)c=
+f.next(),c.type===o.AnnotationType.ANNOTATION_FOLDING&&a!==c.expanded&&(a?c.expand():c.collapse(),d.modifyAnnotation(c));b.setRedraw(!0);return!0},indentLines:function(){var a=this.editor,c=a.getTextView();if(c.getOptions("readonly"))return!1;if(c.getOptions("tabMode")){var b=a.getModel(),d=a.getSelection(),f=b.getLineAtOffset(d.start),e=b.getLineAtOffset(d.end>d.start?d.end-1:d.end);if(f!==e){var h=[];h.push("");for(var j=f;j<=e;j++)h.push(b.getLine(j,!0));j=b.getLineStart(f);b=b.getLineEnd(e,!0);
+c=c.getOptions("tabSize","expandTab");c=c.expandTab?Array(c.tabSize+1).join(" "):"\t";a.setText(h.join(c),j,b);a.setSelection(j===d.start?d.start:d.start+c.length,d.end+(e-f+1)*c.length);return!0}return!1}},gotoLastEdit:function(){typeof this._lastEditLocation==="number"&&this.editor.showSelection(this._lastEditLocation);return!0},gotoLine:function(){var a=this.editor,c=a.getModel().getLineAtOffset(a.getCaretOffset());if(c=prompt(k.gotoLinePrompty,c+1))c=parseInt(c,10),a.onGotoLine(c-1,0);return!0},
+moveLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var c=a.getModel(),b=a.getSelection(),d=c.getLineAtOffset(b.start),f=c.getLineAtOffset(b.end>b.start?b.end-1:b.end),e=c.getLineCount();if(f===e-1)return!0;var d=c.getLineStart(d),b=c.getLineEnd(f,!0),h=c.getLineEnd(f+1,!0)-(b-d),j=0;f!==e-2?c=c.getText(d,b):(f=c.getLineEnd(f),c=c.getText(f,b)+c.getText(d,f),j+=b-f);this.startUndo();a.setText("",d,b);a.setText(c,h,h);a.setSelection(h+j,h+j+c.length);this.endUndo();
+return!0},moveLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var c=a.getModel(),b=a.getSelection(),d=c.getLineAtOffset(b.start);if(d===0)return!0;var f=c.getLineAtOffset(b.end>b.start?b.end-1:b.end),e=c.getLineCount(),b=c.getLineStart(d-1),h=c.getLineStart(d),j=c.getLineEnd(f,!0),k=c.getText(h,j),o=0;f===e-1&&(f=c.getLineEnd(d-1),d=c.getLineEnd(d-1,!0),k+=c.getText(f,d),h=f,o=d-f);this.startUndo();a.setText("",h,j);a.setText(k,b,b);a.setSelection(b,b+k.length-
+o);this.endUndo();return!0},nextAnnotation:function(a){var c=this.editor,b=c.getAnnotationModel();if(!b)return!0;for(var d=c.getModel(),f=c.getCaretOffset(),b=b.getAnnotations(a?f:0,a?d.getCharCount():f),l=null;b.hasNext();){var h=b.next();if(a){if(h.start<=f)continue}else if(h.start>=f)continue;switch(h.type){case o.AnnotationType.ANNOTATION_ERROR:case o.AnnotationType.ANNOTATION_WARNING:case o.AnnotationType.ANNOTATION_TASK:case o.AnnotationType.ANNOTATION_BOOKMARK:break;default:continue}l=h;if(a)break}if(l){var j=
+c.getTextView(),k=d.getLineAtOffset(l.start),p=e.Tooltip.getTooltip(j);if(!p)return c.moveSelection(l.start),!0;c.moveSelection(l.start,l.start,function(){p.setTarget({getTooltipInfo:function(){var a=j.convert({x:j.getLocationAtOffset(l.start).x,y:j.getLocationAtOffset(d.getLineStart(k)).y},"document","page");return{contents:[l],x:a.x,y:a.y+Math.floor(j.getLineHeight(k)*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 b=
+a.getModel(),d=a.getSelection(),f=b.getLineAtOffset(d.start),e=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),h=c.getOptions("tabSize"),j=Array(h+1).join(" "),k=[],o=c=0,g=f;g<=e;g++){var p=b.getLine(g,!0);if(b.getLineStart(g)!==b.getLineEnd(g))if(p.indexOf("\t")===0)p=p.substring(1),c++;else if(p.indexOf(j)===0)p=p.substring(h),c+=h;else return!0;g===f&&(o=c);k.push(p)}f=b.getLineStart(f);h=b.getLineEnd(e,!0);b=b.getLineStart(e);a.setText(k.join(""),f,h);e=f===d.start?d.start:d.start-o;d=Math.max(e,
+d.end-c+(d.end===b+1&&d.start!==d.end?1:0));a.setSelection(e,d);return!0}},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()}};f.TextActions=h;j.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 p.KeyBinding(191,!0),"toggleLineComment");
+a.setAction("toggleLineComment",function(){return this.toggleLineComment()}.bind(this),{name:k.toggleLineComment});a.setKeyBinding(new p.KeyBinding(191,!0,!d.isMac,!1,d.isMac),"addBlockComment");a.setAction("addBlockComment",function(){return this.addBlockComment()}.bind(this),{name:k.addBlockComment});a.setKeyBinding(new p.KeyBinding(220,!0,!d.isMac,!1,d.isMac),"removeBlockComment");a.setAction("removeBlockComment",function(){return this.removeBlockComment()}.bind(this),{name:k.removeBlockComment})},
+autoIndent:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var c=a.getSelection();if(c.start===c.end){for(var b=a.getModel(),d=b.getLineAtOffset(c.start),f=b.getLine(d,!0),e=b.getLineStart(d),d=0,e=c.start-e,h;d<e&&((h=f.charCodeAt(d))===32||h===9);)d++;if(d>0){for(var j=f.substring(0,d),d=e;d<f.length&&((h=f.charCodeAt(d++))===32||h===9);)c.end++;a.setText(b.getLineDelimiter()+j,c.start,c.end);return!0}}return!1},addBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;
+var c=a.getModel(),b=a.getSelection(),d=this._findEnclosingComment(c,b.start,b.end);if(d.commentStart!==void 0&&d.commentEnd!==void 0)return!0;c=c.getText(b.start,b.end);if(c.length===0)return!0;var d=c.length,c=c.replace(/\/\*|\*\//g,""),f=c.length;a.setText("/*"+c+"*/",b.start,b.end);a.setSelection(b.start+2,b.end+2+(f-d));return!0},contentAssistProposalApplied:function(a){a=a.data.proposal;if(a.positions&&a.positions.length>0&&this.linkedMode){for(var c=[],b=0;b<a.positions.length;++b)c[b]={positions:[{offset:a.positions[b].offset,
+length:a.positions[b].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},_findEnclosingComment:function(a,c,b){var d=a.getLineAtOffset(c),f=a.getLineAtOffset(b),e,h,j,k,o,g;for(e=d;e>=0;e--)if(h=a.getLine(e),j=e===d?c-a.getLineStart(d):h.length,k=
+h.lastIndexOf("/*",j),h=h.lastIndexOf("*/",j),h>k)break;else if(k!==-1){o=a.getLineStart(e)+k;break}for(e=f;e<a.getLineCount();e++)if(h=a.getLine(e),j=e===f?b-a.getLineStart(f):0,k=h.indexOf("/*",j),h=h.indexOf("*/",j),k!==-1&&k<h)break;else if(h!==-1){g=a.getLineStart(e)+h;break}return{commentStart:o,commentEnd:g}},lineStart:function(){for(var a=this.editor,c=a.getModel(),b=a.getCaretOffset(),d=c.getLineAtOffset(b),f=c.getLineStart(d),c=c.getLine(d),d=0;d<c.length;d++){var e=c.charCodeAt(d);if(!(e===
+32||e===9))break}d+=f;return b!==d?(a.setSelection(d,d),!0):!1},removeBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var c=a.getModel(),b=a.getSelection(),d=c.getText(b.start,b.end),f,e,h;for(h=0;h<d.length;h++)if(d.substring(h,h+2)==="/*"){f=b.start+h;break}for(;h<d.length;h++)if(d.substring(h,h+2)==="*/"){e=b.start+h;break}if(f!==void 0&&e!==void 0)a.setText(c.getText(f+2,e),f,e+2),a.setSelection(f,e);else{d=this._findEnclosingComment(c,b.start,b.end);
+if(d.commentStart===void 0||d.commentEnd===void 0)return!0;c=c.getText(d.commentStart+2,d.commentEnd);a.setText(c,d.commentStart,d.commentEnd+2);a.setSelection(b.start-2,b.end-2)}return!0},toggleLineComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;for(var c=a.getModel(),b=a.getSelection(),d=c.getLineAtOffset(b.start),f=c.getLineAtOffset(b.end>b.start?b.end-1:b.end),e=!0,h=[],j,k,o=d;o<=f;o++)if(j=c.getLine(o,!0),h.push(j),!e||(k=j.indexOf("//"))===-1)e=!1;else if(k!==
+0){var g;for(g=0;g<k;g++)if(e=j.charCodeAt(g),!(e===32||e===9))break;e=g===k}o=c.getLineStart(d);g=c.getLineEnd(f,!0);if(e){for(e=0;e<h.length;e++)j=h[e],k=j.indexOf("//"),h[e]=j.substring(0,k)+j.substring(k+2);h=h.join("");j=c.getLineStart(f);c=o===b.start?b.start:b.start-2;b=b.end-2*(f-d+1)+(b.end===j+1?2:0)}else h.splice(0,0,""),h=h.join("//"),c=o===b.start?b.start:b.start+2,b=b.end+2*(f-d+1);a.setText(h,o,g);a.setSelection(c,b);return!0},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},
+endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()}};f.SourceCodeActions=j;return f});
+define("orion/editor/templates",[],function(){function k(k,e,b){this.prefix=k;this.description=e;this.template=b;this._parse()}function p(k,e){this._keywords=k||[];this._templates=[];this.addTemplates(e||[])}k.prototype={getProposal:function(k,e,b){var k=e-k.length,e={},d,h=b.delimiter!==void 0?b.delimiter:"\n";b.indentation&&(h+=b.indentation);for(var j=b.tab!==void 0?b.tab:"\t",f=0,a=this.variables,c=this.segments,b=[],i=0;i<c.length;i++){var m=c[i],n=a[m];if(n!==void 0)switch(m){case "${tab}":m=
+j;break;case "${delimiter}":m=h;break;case "${cursor}":m="";d=f;break;default:var l=e[m];l||(l=e[m]={data:n.data,positions:[]});m=n.substitution;l.data&&l.data.values&&(m=l.data.values[0]);l.positions.push({offset:k+f,length:m.length})}b.push(m);f+=m.length}var h=[],r;for(r in e)e.hasOwnProperty(r)&&h.push(e[r]);b=b.join("");if(d===void 0)d=b.length;return{proposal:b,description:this.description,groups:h,escapePosition:k+d}},match:function(k){return this.prefix.indexOf(k)===0},_parse:function(){var k=
+this.template,e=[],b={},d,h=0,k=k.replace(/\n/g,"${delimiter}"),k=k.replace(/\t/g,"${tab}");k.replace(/\$\{((?:[^\\}]+|\\.))*\}/g,function(j,f,a){var c=j.substring(2,j.length-1),f=j,i=c,m=null,n=i.indexOf(":");n!==-1&&(i=i.substring(0,n),f="${"+i+"}",m=JSON.parse(c.substring(n+1).replace("\\}","}").trim()));(c=b[f])||(c=b[f]={});c.substitution=i;if(m)c.data=m;(d=k.substring(h,a))&&e.push(d);e.push(f);h=a+j.length;return i});(d=k.substring(h,k.length))&&e.push(d);this.segments=e;this.variables=b}};
+p.prototype={addTemplates:function(o){for(var e=this.getTemplates(),b=0;b<o.length;b++)e.push(new k(o[b].prefix,o[b].description,o[b].template))},computeProposals:function(k,e,b){var d=this.getPrefix(k,e,b),h=[];if(!this.isValid(d,k,e,b))return h;h=h.concat(this.getTemplateProposals(d,e,b));return h=h.concat(this.getKeywordProposals(d))},getKeywords:function(){return this._keywords},getKeywordProposals:function(k){var e=[],b=this.getKeywords();if(b)for(var d=0;d<b.length;d++)b[d].indexOf(k)===0&&
+e.push({proposal:b[d].substring(k.length),description:b[d]});return e},getPrefix:function(k,e,b){return b.prefix},getTemplates:function(){return this._templates},getTemplateProposals:function(k,e,b){for(var d=[],h=this.getTemplates(),j=0;j<h.length;j++){var f=h[j];f.match(k)&&(f=f.getProposal(k,e,b),this.removePrefix(k,f),d.push(f))}return d},removePrefix:function(k,e){if(!(e.overwrite=e.proposal.substring(0,k.length)!==k))e.proposal=e.proposal.substring(k.length)},isValid:function(){return!0}};return{Template:k,
+TemplateContentAssist:p}});
+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(k,p,o,e,b,d){function h(b,a,c){var d=b.getTextView();o.KeyMode.call(this,d);this.editor=b;this.undoStack=a;this.contentAssist=c;this.linkedModeModel=null;d.setAction("linkedModeEnter",function(){this.exitLinkedMode(!0);return!0}.bind(this));d.setAction("linkedModeCancel",function(){this.exitLinkedMode(!1);return!0}.bind(this));
+d.setAction("linkedModeNextGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup((a.selectedGroupIndex+1)%a.groups.length);return!0}.bind(this));d.setAction("linkedModePreviousGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup(a.selectedGroupIndex>0?a.selectedGroupIndex-1:a.groups.length-1);return!0}.bind(this));this.linkedModeListener={onActivating:function(){this._groupContentAssistProvider&&(this.contentAssist.setProviders([this._groupContentAssistProvider]),this.contentAssist.setProgress(null))}.bind(this),
+onModelChanged:function(a){if(!this.ignoreVerify){for(var b=this.linkedModeModel,c,d;b;)if(c=this._getPositionChanged(b,a.start,a.start+a.removedCharCount),d=c.position,d===void 0||d.model!==b)this.exitLinkedMode(!1),b=this.linkedModeModel;else break;if(b){b=0;d=a.addedCharCount-a.removedCharCount;c=c.positions;for(var f,e,h=0;h<c.length;++h){e=c[h];f=e.position;var g=f.offset<=a.start&&a.start<=f.offset+f.length;g&&!e.ansestor?(f.offset+=b,f.length+=d,b+=d):(f.offset+=b,e.ansestor&&g&&(f.length+=
+d));if(e.escape)e.model.escapePosition=f.offset}this._updateAnnotations(c)}}}.bind(this),onVerify:function(a){if(!this.ignoreVerify){for(var b=this.linkedModeModel,c,d;b;)if(c=this._getPositionChanged(b,a.start,a.end),d=c.position,d===void 0||d.model!==b)this.exitLinkedMode(!1),b=this.linkedModeModel;else break;if(b){var f=this._compoundChange;f?f.owner.model===b&&f.owner.group===d.group||(this.endUndo(),this.startUndo()):this.startUndo();b.selectedGroupIndex=d.group;var f=0,e=a.text.length-(a.end-
+a.start);c=c.positions;for(var h,g,i=a.start-d.position.offset,j=a.end-d.position.offset,k=0;k<c.length;++k)if(g=c[k],h=g.position,g.oldOffset=h.offset,g.model===b&&g.group===d.group?(h.offset+=f,h.length+=e,f+=e):(h.offset+=f,g.ansestor&&(h.length+=d.count*e)),g.escape)g.model.escapePosition=h.offset;this.ignoreVerify=!0;f=this.editor.getTextView();for(k=c.length-1;k>=0;k--)g=c[k],g.model===b&&g.group===d.group&&f.setText(a.text,g.oldOffset+i,g.oldOffset+j);this.ignoreVerify=!1;a.text=null;this._updateAnnotations(c)}}}.bind(this)}}
+var j={};h.prototype=new o.KeyMode;d.mixin(h.prototype,{createKeyBindings:function(){var b=p.KeyBinding,a=[];a.push({actionID:"linkedModeEnter",keyBinding:new b(13)});a.push({actionID:"linkedModeCancel",keyBinding:new b(27)});a.push({actionID:"linkedModeNextGroup",keyBinding:new b(9)});a.push({actionID:"linkedModePreviousGroup",keyBinding:new b(9,!1,!0)});return a},enterLinkedMode:function(b){if(!this.linkedModeModel){var a=this.editor.getTextView();a.addKeyMode(this);a.addEventListener("Verify",
+this.linkedModeListener.onVerify);a.addEventListener("ModelChanged",this.linkedModeListener.onModelChanged);this.contentAssist.addEventListener("Activating",this.linkedModeListener.onActivating);this.editor.reportStatus(k.linkedModeEntered,null,!0)}this._sortedPositions=null;if(this.linkedModeModel)b.previousModel=this.linkedModeModel,b.parentGroup=this.linkedModeModel.selectedGroupIndex,this.linkedModeModel.nextModel=b;this.linkedModeModel=b;this.selectLinkedGroup(0)},exitLinkedMode:function(b){if(this.isActive()){if(this._compoundChange)this.endUndo(),
+this._compoundChange=null;this._sortedPositions=null;var a=this.linkedModeModel;this.linkedModeModel=a.previousModel;a.parentGroup=a.previousModel=void 0;if(this.linkedModeModel)this.linkedModeModel.nextModel=void 0;if(!this.linkedModeModel){var c=this.editor.getTextView();c.removeKeyMode(this);c.removeEventListener("Verify",this.linkedModeListener.onVerify);c.removeEventListener("ModelChanged",this.linkedModeListener.onModelChanged);var d=this.contentAssist;d.removeEventListener("Activating",this.linkedModeListener.onActivating);
+d.offset=void 0;this.editor.reportStatus(k.linkedModeExited,null,!0);b&&c.setCaretOffset(a.escapePosition,!1)}this.selectLinkedGroup(0)}},startUndo:function(){if(this.undoStack){var b=this,a=this.linkedModeModel;this._compoundChange=this.undoStack.startCompoundChange({model:a,group:a.selectedGroupIndex,end:function(){b._compoundChange=null}})}},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()},isActive:function(){return!!this.linkedModeModel},isStatusActive:function(){return!!this.linkedModeModel},
+selectLinkedGroup:function(d){var a=this.linkedModeModel;if(a){a.selectedGroupIndex=d;var d=a.groups[d],c=d.positions[0],e=this.editor.getTextView();e.setSelection(c.offset,c.offset+c.length);if(a=this.contentAssist)if(a.offset=void 0,d.data&&d.data.type==="link"&&d.data.values)(this._groupContentAssistProvider=new b.TemplateContentAssist(d.data.values)).getPrefix=function(){var a=e.getSelection();return a.start===a.end&&(a=e.getCaretOffset(),c.offset<=a&&a<=c.offset+c.length)?e.getText(c.offset,
+a):""},a.offset=c.offset,a.deactivate(),a.activate();else if(this._groupContentAssistProvider)this._groupContentAssistProvider=null,a.deactivate()}this._updateAnnotations()},_getModelPositions:function(b,a,c){for(var d=a.groups,e=0;e<d.length;e++)for(var h=d[e].positions,l=0;l<h.length;l++){var j=h[l];c&&(j={offset:j.offset+c,length:j.length});j={index:l,group:e,count:h.length,model:a,position:j};b.push(j);if(a.nextModel&&a.nextModel.parentGroup===e)j.ansestor=!0,this._getModelPositions(b,a.nextModel,
+(c||0)+h[l].offset-h[0].offset)}},_getSortedPositions:function(b){var a=this._sortedPositions;if(!a){for(a=[];b.previousModel;)b=b.previousModel;for(this._getModelPositions(a,b);b;)b.escapePosition!==void 0&&a.push({escape:!0,model:b,position:{offset:b.escapePosition,length:0}}),b=b.nextModel;a.sort(function(a,b){return a.position.offset-b.position.offset});this._sortedPositions=a}return a},_getPositionChanged:function(b,a,c){for(var d,b=this._getSortedPositions(b),e=b.length-1;e>=0;e--){var h=b[e].position;
+if(h.offset<=a&&c<=h.offset+h.length){d=b[e];break}}return{position:d,positions:b}},_updateAnnotations:function(b){var a=this.editor.getAnnotationModel();if(a){for(var c=[],d=[],h=a.getTextModel(),h=a.getAnnotations(0,h.getCharCount()),j;h.hasNext();)switch(j=h.next(),j.type){case e.AnnotationType.ANNOTATION_LINKED_GROUP:case e.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP:case e.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:c.push(j)}if(h=this.linkedModeModel)for(var b=b||this._getSortedPositions(h),
+l=0;l<b.length;l++)if(j=b[l],j.model===h){var k=e.AnnotationType.ANNOTATION_LINKED_GROUP;j.group===h.selectedGroupIndex&&(k=j.index===0?e.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:e.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP);j=j.position;j=e.AnnotationType.createAnnotation(k,j.offset,j.offset+j.length,"");d.push(j)}a.replaceAnnotations(c,d)}}});j.LinkedMode=h;return j});
+define("orion/editor/factories","orion/editor/actions,orion/editor/undoStack,orion/editor/rulers,orion/editor/annotations,orion/editor/textDND,orion/editor/linkedMode".split(","),function(k,p,o,e,b,d){function h(){}function j(){}function f(){}function a(){}function c(){}function i(){}var m={};h.prototype={createKeyBindings:function(a,b,c,f){var f=new k.TextActions(a,b,f),e=new d.LinkedMode(a,b,c),a=new k.SourceCodeActions(a,b,c,e);return{textActions:f,linkedMode:e,sourceCodeActions:a}}};m.KeyBindingsFactory=
+h;j.prototype={createUndoStack:function(a){a=a.getTextView();return new p.UndoStack(a,200)}};m.UndoFactory=j;f.prototype={createLineNumberRuler:function(a){return new o.LineNumberRuler(a,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"})}};m.LineNumberRulerFactory=f;a.prototype={createFoldingRuler:function(a){return new o.FoldingRuler(a,"left",{styleClass:"ruler folding"})}};m.FoldingRulerFactory=a;c.prototype={createAnnotationModel:function(a){return new e.AnnotationModel(a)},
+createAnnotationStyler:function(a,b){return new e.AnnotationStyler(a,b)},createAnnotationRulers:function(a){var b=new o.AnnotationRuler(a,"left",{styleClass:"ruler annotations"}),a=new o.OverviewRuler(a,"right",{styleClass:"ruler overview"});return{annotationRuler:b,overviewRuler:a}}};m.AnnotationFactory=c;i.prototype={createTextDND:function(a,c){return new b.TextDND(a.getTextView(),c)}};m.TextDNDFactory=i;return m});
+define("orion/editor/editorFeatures",["orion/editor/factories","orion/editor/actions","orion/editor/linkedMode"],function(k,p,o){var e={};e.KeyBindingsFactory=k.KeyBindingsFactory;e.UndoFactory=k.UndoFactory;e.LineNumberRulerFactory=k.LineNumberRulerFactory;e.FoldingRulerFactory=k.FoldingRulerFactory;e.AnnotationFactory=k.AnnotationFactory;e.TextDNDFactory=k.TextDNDFactory;e.TextActions=p.TextActions;e.SourceCodeActions=p.SourceCodeActions;e.LinkedMode=o.LinkedMode;return e});
+(function(k,p){typeof define==="function"&&define.amd?define("orion/Deferred",p):typeof exports==="object"?module.exports=p():(k.orion=k.orion||{},k.orion.Deferred=p())})(this,function(){function k(){for(var a;a=h.shift()||j.shift();)a();f=!1}function p(a,b){(b?j:h).push(a);f||(f=!0,b?setTimeout(k,0):k())}function o(a){return function(){a.apply(null,arguments)}}function e(){}function b(){var a=Error("Cancel");a.name="Cancel";return a}function d(){function a(){for(var a;a=h.shift();){var b=a.deferred,
+d=f==="resolved"?"resolve":"reject";if(typeof a[d]==="function")try{var j=a[d](c);j&&typeof j.then==="function"?(b.cancel=j.cancel||e,j.then(o(b.resolve),o(b.reject),b.progress)):b.resolve(j)}catch(n){b.reject(n)}else b[d](c)}}var c,f,h=[],j=this;this.reject=function(b){f||(f="rejected",c=b,h.length&&p(a));return j.promise};this.resolve=function(b){f||(f="resolved",c=b,h.length&&p(a));return j.promise};this.progress=function(a){f||h.forEach(function(b){b.progress&&b.progress(a)});return j.promise};
+this.cancel=function(){f||j.reject(b())};this.then=function(b,c,e){var b={resolve:b,reject:c,progress:e,deferred:new d},k=b.deferred,o=!1,g=function(){o||(o=!0,p(function(){var a=k.cancel===g?j.cancel:k.cancel;typeof a==="function"&&a()},!0))};k.cancel=g;h.push(b);f&&p(a,!0);return k.promise};this.promise=Object.create(Object.prototype,{then:{value:j.then},cancel:{get:function(){return j.cancel},set:function(a){j.cancel=a}}})}var h=[],j=[],f=!1;d.all=function(a,b){function f(a,b){j||(l[a]=b,--h===
+0&&k.resolve(l))}function e(a,d){if(!j){if(b)try{f(a,b(d));return}catch(g){d=g}k.reject(d)}}var h=a.length,l=[],j=!1,k=new d;k.then(null,function(){j=!0;a.forEach(function(a){a.cancel&&a.cancel()})});h===0?k.resolve(l):a.forEach(function(a,b){a.then(f.bind(null,b),e.bind(null,b))});return k.promise};d.when=function(a,b,f,e){var h;if(!(a&&typeof a.then==="function"))h=new d,h.resolve(a),a=h.promise;return a.then(b,f,e)};return d});
+define("orion/editor/contentAssist","i18n!orion/editor/nls/messages,orion/keyBinding,orion/editor/keyModes,orion/editor/eventTarget,orion/Deferred,orion/objects,orion/util".split(","),function(k,p,o,e,b,d,h){var j,f,a;function c(b){this.textView=b;this.state=j;this.providers=[];var c=this;this.contentAssistListener={onModelChanging:function(b){c.isDeactivatingChange(b)?c.setState(j):c.state===f&&c.setState(a)},onScroll:function(){c.setState(j)},onSelection:function(){var b=c.state;if(b===f||b===a)c.computeProposals(),
+c.setState(a)}};b.setKeyBinding(h.isMac?new p.KeyBinding(" ",!1,!1,!1,!0):new p.KeyBinding(" ",!0),"contentAssist");b.setAction("contentAssist",function(){c.activate();return!0},{name:k.contentAssist})}function i(a,b){var c=a.textView;o.KeyMode.call(this,c);this.contentAssist=a;this.widget=b;this.proposals=[];var d=this;this.contentAssist.addEventListener("ProposalsComputed",function(a){d.proposals=a.data.proposals;d.selectedIndex=d.proposals.length?0:-1});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("contentAssistTab",function(){return this.tab()}.bind(this))}function m(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=h.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");}var f=this;this.textViewListener={onMouseDown:function(a){a.event.target.parentElement!==f.parentNode&&f.contentAssist.deactivate()}};this.contentAssist.addEventListener("ProposalsComputed",function(a){f.setProposals(a.data.proposals);
+f.show();if(!f.textViewListenerAdded)f.textView.addEventListener("MouseDown",f.textViewListener.onMouseDown),f.textViewListenerAdded=!0});this.contentAssist.addEventListener("Deactivating",function(){f.setProposals([]);f.hide();if(f.textViewListenerAdded)f.textView.removeEventListener("MouseDown",f.textViewListener.onMouseDown),f.textViewListenerAdded=!1;f.textViewListenerAdded=!1});this.scrollListener=function(){f.isShowing&&f.position()};c.addEventListener&&c.addEventListener("scroll",this.scrollListener)}
+j=1;f=2;a=3;var n={selected:" selected",hr:"proposal-hr",emphasis:"proposal-emphasis",noemphasis:"proposal-noemphasis",dfault:"proposal-default"};c.prototype={apply:function(a){if(!a)return!1;var b=this.textView.getSelection(),c=Math.min(b.start,b.end),b=Math.max(b.start,b.end);a.overwrite&&(c=this.getPrefixStart(c));var d={proposal:a,start:c,end:b};this.setState(j);this.textView.setText(typeof a==="string"?a:a.proposal,c,b);this.dispatchEvent({type:"ProposalApplied",data:d});return!0},activate:function(){this.state===
+j&&this.setState(f)},deactivate:function(){this.setState(j)},getTextView:function(){return this.textView},isActive:function(){return this.state===f||this.state===a},isDeactivatingChange:function(a){var b=a.removedCharCount>0&&a.addedCharCount===0,c=this.textView,c=a.start+1<=c.getModel().getCharCount()&&/^\s*$/.test(c.getText(a.start,a.start+1));return a.removedLineCount>0||a.addedLineCount>0||b&&c},setState:function(a){var b;a===f?(b="Activating",this._mode&&this._mode.setActive(!0)):a===j&&(b="Deactivating",
+this._mode&&this._mode.setActive(!1));b&&this.dispatchEvent({type:b});this.state=a;this.onStateChange(a)},setMode:function(a){this._mode=a},onStateChange:function(a){if(a===j){if(this.listenerAdded)this.textView.removeEventListener("ModelChanging",this.contentAssistListener.onModelChanging),this.textView.removeEventListener("Scroll",this.contentAssistListener.onScroll),this.textView.removeEventListener("Selection",this.contentAssistListener.onSelection),this.listenerAdded=!1}else if(a===f){if(!this.listenerAdded)this.textView.addEventListener("ModelChanging",
+this.contentAssistListener.onModelChanging),this.textView.addEventListener("Scroll",this.contentAssistListener.onScroll),this.textView.addEventListener("Selection",this.contentAssistListener.onSelection),this.listenerAdded=!0;this.computeProposals()}},computeProposals:function(){var a=this;this._computeProposals(this.textView.getCaretOffset()).then(function(b){a.isActive()&&a.dispatchEvent({type:"ProposalsComputed",data:{proposals:b}})})},getPrefixStart:function(a){for(;a>0&&/[A-Za-z0-9_]/.test(this.textView.getText(a-
+1,a));)a--;return a},handleError:function(a){typeof console!=="undefined"&&(console.log("Error retrieving content assist proposals"),console.log(a))},_computeProposals:function(a){for(var c=this.providers,d=this.textView,f=d.getModel(),e=d.getText(),g=f.getLine(f.getLineAtOffset(a)),h=0;h<g.length&&/\s/.test(g.charAt(h));)h++;var h=g.substring(0,h),i=d.getOptions("tabSize","expandTab"),i=i.expandTab?Array(i.tabSize+1).join(" "):"\t",j={line:g,prefix:d.getText(this.getPrefixStart(a),a),selection:d.getSelection(),
+delimiter:f.getLineDelimiter(),tab:i,indentation:h},m=this,c=c.map(function(c){var d=c.computeProposals||c.getProposals,f;try{typeof d==="function"&&(f=m.progress?m.progress.progress(d.apply(c,[e,a,j]),"Generating content assist proposal"):d.apply(c,[e,a,j]))}catch(g){m.handleError(g)}return b.when(f)});return b.all(c,this.handleError).then(function(a){return a.reduce(function(a,b){return b instanceof Array?a.concat(b):a},[])})},setProviders:function(a){this.providers=a.slice(0)},setProgress:function(a){this.progress=
+a}};e.EventTarget.addMixin(c.prototype);i.prototype=new o.KeyMode;d.mixin(i.prototype,{createKeyBindings:function(){var a=p.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:"contentAssistTab",keyBinding:new a(9)});return b},cancel:function(){this.getContentAssist().deactivate()},
+getContentAssist:function(){return this.contentAssist},isActive:function(){return this.getContentAssist().isActive()},setActive:function(a){a?this.contentAssist.textView.addKeyMode(this):this.contentAssist.textView.removeKeyMode(this)},lineUp:function(){for(var a=this.selectedIndex===0?this.proposals.length-1:this.selectedIndex-1;this.proposals[a].unselectable&&a>0;)a--;this.selectedIndex=a;this.widget&&this.widget.setSelectedIndex(this.selectedIndex);return!0},lineDown:function(){for(var a=this.selectedIndex===
+this.proposals.length-1?0:this.selectedIndex+1;this.proposals[a].unselectable&&a<this.proposals.length-1;)a++;this.selectedIndex=a;this.widget&&this.widget.setSelectedIndex(this.selectedIndex);return!0},enter:function(){return this.contentAssist.apply(this.proposals[this.selectedIndex]||null)},tab:function(){return this.widget?(this.widget.createAccessible(this),this.widget.parentNode.focus(),!0):!1}});m.prototype={onClick:function(a){this.contentAssist.apply(this.getProposal(a.target));this.textView.focus()},
+createDiv:function(a,b,c,d){var f=c.ownerDocument,e=h.createElement(f,"div");e.id="contentoption"+d;e.setAttribute("role","option");a.style==="hr"?a=h.createElement(f,"hr"):(e.className=this.calculateClasses(a.style,b),a=f.createTextNode(this.getDisplayString(a)),b&&this.parentNode.setAttribute("aria-activedescendant",e.id));e.appendChild(a,e);c.appendChild(e)},createAccessible:function(a){this._isAccessible||this.parentNode.addEventListener("keydown",function(b){b.preventDefault();if(b.keyCode===
+27)return a.cancel();else if(b.keyCode===38)return a.lineUp();else if(b.keyCode===40)return a.lineDown();else if(b.keyCode===13)return a.enter();return!1});this._isAccessible=!0},calculateClasses:function(a,b){var c=n[a];if(!c)c=n.dfault;return b?c+n.selected:c},getDisplayString:function(a){return typeof a==="string"?a:a.description&&typeof a.description==="string"?a.description:a.proposal},getProposal:function(a){for(var b=0,c=this.parentNode.firstChild;c!==null;c=c.nextSibling){if(c===a)return this.proposals[b]||
+null;b++}return null},setSelectedIndex:function(a){this.selectedIndex=a;this.selectNode(this.parentNode.childNodes[this.selectedIndex])},selectNode:function(a){for(var b=this.parentNode.childNodes,c=0;c<b.length;c++){var d=b[c],f=d.className.indexOf(n.selected);if(f>=0)d.className=d.className.substring(0,f)+d.className.substring(f+n.selected.length);d===a&&(d.className+=n.selected,this.parentNode.setAttribute("aria-activedescendant",d.id),d.focus(),d.offsetTop<this.parentNode.scrollTop?d.scrollIntoView(!0):
+d.offsetTop+d.offsetHeight>this.parentNode.scrollTop+this.parentNode.clientHeight&&d.scrollIntoView(!1))}},setProposals:function(a){this.proposals=a},show:function(){if(this.proposals.length===0)this.hide();else{this.parentNode.innerHTML="";for(var a=0;a<this.proposals.length;a++)this.createDiv(this.proposals[a],a===0,this.parentNode,a);this.position();this.parentNode.onclick=this.onClick.bind(this);this.isShowing=!0}},hide:function(){this.parentNode.ownerDocument.activeElement===this.parentNode&&
+this.textView.focus();this.parentNode.style.display="none";this.parentNode.onclick=null;this.isShowing=!1},position:function(){var a=this.contentAssist,a=this.textView.getLocationAtOffset(a.offset!==void 0?a.offset:this.textView.getCaretOffset());a.y+=this.textView.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;
+var b=this.parentNode.ownerDocument,c=b.documentElement.clientWidth;if(a.y+this.parentNode.offsetHeight>b.documentElement.clientHeight)this.parentNode.style.top=a.y-this.parentNode.offsetHeight-this.textView.getLineHeight()+"px";if(a.x+this.parentNode.offsetWidth>c)this.parentNode.style.left=c-this.parentNode.offsetWidth+"px"}};return{ContentAssist:c,ContentAssistMode:i,ContentAssistWidget:m}});
+define("orion/editor/keywords",[],function(){return{JSKeywords:"break,case,class,catch,continue,const,debugger,default,delete,do,else,enum,export,extends,false,finally,for,function,if,implements,import,in,instanceof,interface,let,new,null,package,private,protected,public,return,static,super,switch,this,throw,true,try,typeof,undefined,var,void,while,with,yield".split(","),CSSKeywords:"alignment-adjust,alignment-baseline,animation,animation-delay,animation-direction,animation-duration,animation-iteration-count,animation-name,animation-play-state,animation-timing-function,appearance,azimuth,backface-visibility,background,background-attachment,background-clip,background-color,background-image,background-origin,background-position,background-repeat,background-size,baseline-shift,binding,bleed,bookmark-label,bookmark-level,bookmark-state,bookmark-target,border,border-bottom,border-bottom-color,border-bottom-left-radius,border-bottom-right-radius,border-bottom-style,border-bottom-width,border-collapse,border-color,border-image,border-image-outset,border-image-repeat,border-image-slice,border-image-source,border-image-width,border-left,border-left-color,border-left-style,border-left-width,border-radius,border-right,border-right-color,border-right-style,border-right-width,border-spacing,border-style,border-top,border-top-color,border-top-left-radius,border-top-right-radius,border-top-style,border-top-width,border-width,bottom,box-align,box-decoration-break,box-direction,box-flex,box-flex-group,box-lines,box-ordinal-group,box-orient,box-pack,box-shadow,box-sizing,break-after,break-before,break-inside,caption-side,clear,clip,color,color-profile,column-count,column-fill,column-gap,column-rule,column-rule-color,column-rule-style,column-rule-width,column-span,column-width,columns,content,counter-increment,counter-reset,crop,cue,cue-after,cue-before,cursor,direction,display,dominant-baseline,drop-initial-after-adjust,drop-initial-after-align,drop-initial-before-adjust,drop-initial-before-align,drop-initial-size,drop-initial-value,elevation,empty-cells,fit,fit-position,flex-align,flex-flow,flex-inline-pack,flex-order,flex-pack,float,float-offset,font,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,grid-columns,grid-rows,hanging-punctuation,height,hyphenate-after,hyphenate-before,hyphenate-character,hyphenate-lines,hyphenate-resource,hyphens,icon,image-orientation,image-rendering,image-resolution,inline-box-align,left,letter-spacing,line-height,line-stacking,line-stacking-ruby,line-stacking-shift,line-stacking-strategy,list-style,list-style-image,list-style-position,list-style-type,margin,margin-bottom,margin-left,margin-right,margin-top,mark,mark-after,mark-before,marker-offset,marks,marquee-direction,marquee-loop,marquee-play-count,marquee-speed,marquee-style,max-height,max-width,min-height,min-width,move-to,nav-down,nav-index,nav-left,nav-right,nav-up,opacity,orphans,outline,outline-color,outline-offset,outline-style,outline-width,overflow,overflow-style,overflow-x,overflow-y,padding,padding-bottom,padding-left,padding-right,padding-top,page,page-break-after,page-break-before,page-break-inside,page-policy,pause,pause-after,pause-before,perspective,perspective-origin,phonemes,pitch,pitch-range,play-during,position,presentation-level,punctuation-trim,quotes,rendering-intent,resize,rest,rest-after,rest-before,richness,right,rotation,rotation-point,ruby-align,ruby-overhang,ruby-position,ruby-span,size,speak,speak-header,speak-numeral,speak-punctuation,speech-rate,stress,string-set,table-layout,target,target-name,target-new,target-position,text-align,text-align-last,text-decoration,text-emphasis,text-height,text-indent,text-justify,text-outline,text-shadow,text-transform,text-wrap,top,transform,transform-origin,transform-style,transition,transition-delay,transition-duration,transition-property,transition-timing-function,unicode-bidi,vertical-align,visibility,voice-balance,voice-duration,voice-family,voice-pitch,voice-pitch-range,voice-rate,voice-stress,voice-volume,volume,white-space,white-space-collapse,widows,width,word-break,word-spacing,word-wrap,z-index".split(","),
+JAVAKeywords:"abstract,boolean,break,byte,case,catch,char,class,continue,default,do,double,else,extends,false,final,finally,float,for,if,implements,import,instanceof,int,interface,long,native,new,null,package,private,protected,public,return,short,static,super,switch,synchronized,this,throw,throws,transient,true,try,void,volatile,while".split(",")}});
+define("orion/editor/cssContentAssist",["orion/editor/templates","orion/editor/keywords"],function(k,p){function o(a){return JSON.stringify(a).replace("}","\\}")}function e(){}for(var b={type:"link",values:"visible,hidden,scroll,auto,no-display,no-content".split(",")},d={type:"link",values:"solid,dashed,dotted,double,groove,ridge,inset,outset".split(",")},h={type:"link",values:[]},j=0;j<10;j++)h.values.push(j.toString());for(var f={type:"link",values:"black,white,red,green,blue,magenta,yellow,cyan,grey,darkred,darkgreen,darkblue,darkmagenta,darkcyan,darkyellow,darkgray,lightgray".split(",")},
+a=[{prefix:"rule",description:"rule - class selector rule",template:".${class} {\n\t${cursor}\n}"},{prefix:"rule",description:"rule - id selector rule",template:"#${id} {\n\t${cursor}\n}"},{prefix:"outline",description:"outline - outline style",template:"outline: ${color:"+o(f)+"} ${style:"+o(d)+"} ${width:"+o(h)+"}px;"},{prefix:"background-image",description:"background-image - image style",template:'background-image: url("${uri}");'},{prefix:"url",description:"url - url image",template:'url("${uri}");'},
+{prefix:"rgb",description:"rgb - rgb color",template:"rgb(${red},${green},${blue});"},{prefix:"@",description:"import - import style sheet",template:'@import "${uri}";'}],c=[{prop:"display",values:{type:"link",values:"none,block,box,flex,inline,inline-block,inline-flex,inline-table,list-item,table,table-caption,table-cell,table-column,table-column-group,table-footer-group,table-header-group,table-row,table-row-group,inherit".split(",")}},{prop:"overflow",values:b},{prop:"overflow-x",values:b},{prop:"overflow-y",
+values:b},{prop:"float",values:{type:"link",values:["left","right","none","inherit"]}},{prop:"position",values:{type:"link",values:["absolute","fixed","relative","static","inherit"]}},{prop:"cursor",values:{type:"link",values:"auto,crosshair,default,e-resize,help,move,n-resize,ne-resize,nw-resize,pointer,progress,s-resize,se-resize,sw-resize,text,w-resize,wait,inherit".split(",")}},{prop:"color",values:f},{prop:"border-top-color",values:f},{prop:"border-bottom-color",values:f},{prop:"border-right-color",
+values:f},{prop:"border-left-color",values:f},{prop:"background-color",values:f},{prop:"font-style",values:{type:"link",values:["italic","normal","oblique","inherit"]}},{prop:"font-weight",values:{type:"link",values:"bold,normal,bolder,lighter,100,200,300,400,500,600,700,800,900,inherit".split(",")}},{prop:"white-space",values:{type:"link",values:"pre,pre-line,pre-wrap,nowrap,normal,inherit".split(",")}},{prop:"word-wrap",values:{type:"link",values:["normal","break-word"]}},{prop:"visibility",values:{type:"link",
+values:["hidden","visible","collapse","inherit"]}}],j=0;j<c.length;j++)b=c[j],a.push({prefix:b.prop,description:b.prop+" - "+b.prop+" style",template:b.prop+": ${value:"+o(b.values)+"};"});c="width,height,top,bottom,left,right,min-width,min-height,max-width,max-height,margin,padding,padding-left,padding-right,padding-top,padding-bottom,margin-left,margin-top,margin-bottom,margin-right".split(",");for(j=0;j<c.length;j++)b=c[j],a.push({prefix:b,description:b+" - "+b+" pixel style",template:b+": ${value}px;"});
+c=["padding","margin"];for(j=0;j<c.length;j++)b=c[j],a.push({prefix:b,description:b+" - "+b+" top right bottom left style",template:b+": ${top}px ${left}px ${bottom}px ${right}px;"}),a.push({prefix:b,description:b+" - "+b+" top right,left bottom style",template:b+": ${top}px ${right_left}px ${bottom}px;"}),a.push({prefix:b,description:b+" - "+b+" top,bottom right,left style",template:b+": ${top_bottom}px ${right_left}px"});c=["border","border-top","border-bottom","border-left","border-right"];for(j=
+0;j<c.length;j++)b=c[j],a.push({prefix:b,description:b+" - "+b+" style",template:b+": ${width:"+o(h)+"}px ${style:"+o(d)+"} ${color:"+o(f)+"};"});e.prototype=new k.TemplateContentAssist(p.CSSKeywords,a);e.prototype.getPrefix=function(a,b){for(var c=b;c&&/[A-Za-z\-\@]/.test(a.charAt(c-1));)c--;return c?a.substring(c,b):""};return{CssContentAssistProvider:e}});
+define("orion/editor/htmlContentAssist",["orion/editor/templates"],function(k){function p(){}var o=new k.Template("","Simple HTML document",'<!DOCTYPE html>\n<html lang="en">\n\t<head>\n\t\t<meta charset=utf-8>\n\t\t<title>${title}</title>\n\t</head>\n\t<body>\n\t\t<h1>${header}</h1>\n\t\t<p>\n\t\t\t${cursor}\n\t\t</p>\n\t</body>\n</html>'),e=[{prefix:"<img",description:"<img> - HTML image element",template:'<img src="${cursor}" alt="${Image}"/>'},{prefix:"<a",description:"<a> - HTML anchor element",
+template:'<a href="${cursor}"></a>'},{prefix:"<ul",description:"<ul> - HTML unordered list",template:"<ul>\n\t<li>${cursor}</li>\n</ul>"},{prefix:"<ol",description:"<ol> - HTML ordered list",template:"<ol>\n\t<li>${cursor}</li>\n</ol>"},{prefix:"<dl",description:"<dl> - HTML definition list",template:"<dl>\n\t<dt>${cursor}</dt>\n\t<dd></dd>\n</dl>"},{prefix:"<table",description:"<table> - basic HTML table",template:"<table>\n\t<tr>\n\t\t<td>${cursor}</td>\n\t</tr>\n</table>"}],b,d,h,j,f="abbr,b,button,canvas,cite,command,dd,del,dfn,dt,em,embed,font,h1,h2,h3,h4,h5,h6,i,ins,kbd,label,li,mark,meter,object,option,output,progress,q,rp,rt,samp,small,strong,sub,sup,td,time,title,tt,u,var".split(",");
+for(j=0;j<f.length;j++)b=f[j],h="<"+b+"></"+b+">",d="<"+b+">${cursor}</"+b+">",e.push({prefix:"<"+b,description:h,template:d});f="address,article,aside,audio,bdo,blockquote,body,caption,code,colgroup,datalist,details,div,fieldset,figure,footer,form,head,header,hgroup,iframe,legend,map,menu,nav,noframes,noscript,optgroup,p,pre,ruby,script,section,select,span,style,tbody,textarea,tfoot,th,thead,tr,video".split(",");for(j=0;j<f.length;j++)b=f[j],h="<"+b+"></"+b+">",d="<"+b+">\n\t${cursor}\n</"+b+">",
+e.push({prefix:"<"+b,description:h,template:d});f="area,base,br,col,hr,input,link,meta,param,keygen,source".split(",");for(j=0;j<f.length;j++)b=f[j],d=h="<"+b+"/>",e.push({prefix:"<"+b,description:h,template:d});p.prototype=new k.TemplateContentAssist([],e);p.prototype.getPrefix=function(a,b){for(var d=b;d&&/[A-Za-z<]/.test(a.charAt(d-1));)if(d--,a.charAt(d)==="<")break;return d?a.substring(d,b):""};p.prototype.computeProposals=function(a,b,d){return a.length===0?[o.getProposal("",b,d)]:k.TemplateContentAssist.prototype.computeProposals.call(this,
+a,b,d)};return{HTMLContentAssistProvider:p}});
+define("orion/editor/jsTemplateContentAssist",["orion/editor/templates","orion/editor/keywords"],function(k,p){function o(){}var e=[{prefix:"if",description:"if - if statement",template:"if (${condition}) {\n\t${cursor}\n}"},{prefix:"if",description:"if - if else statement",template:"if (${condition}) {\n\t${cursor}\n} else {\n\t\n}"},{prefix:"for",description:"for - iterate over array",template:"for (var ${i}=0; ${i}<${array}.length; ${i}++) {\n\t${cursor}\n}"},{prefix:"for",description:"for - iterate over array with local var",
+template:"for (var ${i}=0; ${i}<${array}.length; ${i}++) {\n\tvar ${value} = ${array}[${i}];\n\t${cursor}\n}"},{prefix:"for",description:"for..in - iterate over properties of an object",template:"for (var ${property} in ${object}) {\n\tif (${object}.hasOwnProperty(${property})) {\n\t\t${cursor}\n\t}\n}"},{prefix:"while",description:"while - while loop with condition",template:"while (${condition}) {\n\t${cursor}\n}"},{prefix:"do",description:"do - do while loop with condition",template:"do {\n\t${cursor}\n} while (${condition});"},
+{prefix:"switch",description:"switch - switch case statement",template:"switch (${expression}) {\n\tcase ${value1}:\n\t\t${cursor}\n\t\tbreak;\n\tdefault:\n}"},{prefix:"case",description:"case - case statement",template:"case ${value}:\n\t${cursor}\n\tbreak;"},{prefix:"try",description:"try - try..catch statement",template:"try {\n\t${cursor}\n} catch (${err}) {\n}"},{prefix:"try",description:"try - try..catch statement with finally block",template:"try {\n\t${cursor}\n} catch (${err}) {\n} finally {\n}"},
+{prefix:"var",description:"var - variable declaration",template:"var ${name};"},{prefix:"var",description:"var - variable declaration with value",template:"var ${name} = ${value};"},{prefix:"let",description:"let - local scope variable declaration",template:"let ${name};"},{prefix:"let",description:"let - local scope variable declaration with value",template:"let ${name} = ${value};"},{prefix:"return",description:"return - return result",template:"return ${result};"},{prefix:"typeof",description:"typeof - typeof statement",
+template:'typeof ${object} === "${type:'+JSON.stringify({type:"link",values:"undefined,object,boolean,number,string,function,xml".split(",")}).replace("}","\\}")+'}"'},{prefix:"instanceof",description:"instanceof - instanceof statement",template:"${object} instanceof ${type}"},{prefix:"with",description:"with - with statement",template:"with (${object}) {\n\t${cursor}\n}"},{prefix:"function",description:"function - function declaration",template:"function ${name} (${parameter}) {\n\t${cursor}\n}"},
+{prefix:"log",description:"log - console log",template:"console.log(${object});"}];o.prototype=new k.TemplateContentAssist(p.JSKeywords,e);o.prototype.isValid=function(b,d,e){b=e-b.length-1;for(e="";b>=0;)if(e=d[b],e==="\n"||e==="\r")break;else if(/\s/.test(e))b--;else break;return":!@#$^&*.?<>".indexOf(e)===-1};return{JSTemplateContentAssistProvider:o}});
+define("orion/editor/AsyncStyler",["i18n!orion/editor/nls/messages","orion/editor/annotations"],function(k,p){function o(d){return d.getProperty("objectClass").indexOf(b)!==-1&&d.getProperty("type")==="highlighter"}function e(b,d,f){this.initialize(b,d,f);this.lineStyles=[]}var b="orion.edit.highlighter",d=b+" service must be an event emitter";p.AnnotationType.registerType("orion.annotation.highlightError",{title:k.syntaxError,html:"<div class='annotationHTML error'></div>",rangeStyle:{styleClass:"annotationRange error"}});
+e.prototype={initialize:function(d,e,f){this.textView=d;this.serviceRegistry=e;this.annotationModel=f;this.services=[];var a=this;this.listener={onModelChanging:function(b){a.onModelChanging(b)},onModelChanged:function(b){a.onModelChanged(b)},onDestroy:function(b){a.onDestroy(b)},onLineStyle:function(b){a.onLineStyle(b)},onStyleReady:function(b){a.onStyleReady(b)},onServiceAdded:function(b){a.onServiceAdded(b.serviceReference,a.serviceRegistry.getService(b.serviceReference))},onServiceRemoved:function(b){a.onServiceRemoved(b.serviceReference,
+a.serviceRegistry.getService(b.serviceReference))}};d.addEventListener("ModelChanging",this.listener.onModelChanging);d.addEventListener("ModelChanged",this.listener.onModelChanged);d.addEventListener("Destroy",this.listener.onDestroy);d.addEventListener("LineStyle",this.listener.onLineStyle);e.addEventListener("registered",this.listener.onServiceAdded);e.addEventListener("unregistering",this.listener.onServiceRemoved);d=e.getServiceReferences(b);for(f=0;f<d.length;f++){var c=d[f];o(c)&&this.addServiceListener(e.getService(c))}},
+onDestroy:function(){this.destroy()},destroy:function(){if(this.textView)this.textView.removeEventListener("ModelChanging",this.listener.onModelChanging),this.textView.removeEventListener("ModelChanged",this.listener.onModelChanged),this.textView.removeEventListener("Destroy",this.listener.onDestroy),this.textView.removeEventListener("LineStyle",this.listener.onLineStyle),this.textView=null;if(this.services){for(var b=0;b<this.services.length;b++)this.removeServiceListener(this.services[b]);this.services=
+null}if(this.serviceRegistry)this.serviceRegistry.removeEventListener("registered",this.listener.onServiceAdded),this.serviceRegistry.removeEventListener("unregistering",this.listener.onServiceRemoved),this.serviceRegistry=null;this.lineStyles=this.listener=null},onModelChanging:function(b){this.startLine=this.textView.getModel().getLineAtOffset(b.start)},onModelChanged:function(b){var d=this.startLine;(b.addedLineCount||b.removedLineCount)&&Array.prototype.splice.apply(this.lineStyles,[d,b.removedLineCount].concat(this._getEmptyStyle(b.addedLineCount)))},
+onStyleReady:function(b){var d=b.lineStyles||b.style,b=Number.MAX_VALUE,f=-1,a=this.textView.getModel(),c;for(c in d)d.hasOwnProperty(c)&&(this.lineStyles[c]=d[c],b=Math.min(b,c),f=Math.max(f,c));b=Math.max(b,0);f=Math.min(f,a.getLineCount());if(d=this.annotationModel){for(var e=d.getAnnotations(a.getLineStart(b),a.getLineEnd(f)),m=[];e.hasNext();){var k=e.next();k.type==="orion.annotation.highlightError"&&m.push(k)}e=[];for(k=b;k<=f;k++){c=k;var l=this.lineStyles[c],l=l&&l.errors;c=a.getLineStart(c);
+if(l)for(var o=0;o<l.length;o++){var q=l[o];e.push(p.AnnotationType.createAnnotation("orion.annotation.highlightError",q.start+c,q.end+c))}}d.replaceAnnotations(m,e)}this.textView.redrawLines(b,f+1)},onLineStyle:function(b){function d(a,b){for(var f=a.length,e=[],h=0;h<f;h++){var j=a[h];e.push({start:j.start+b,end:j.end+b,style:j.style})}return e}var f=this.lineStyles[b.lineIndex];if(f)if(f.ranges)b.ranges=d(f.ranges,b.lineStart);else if(f.style)b.style=f.style},_getEmptyStyle:function(b){for(var d=
+[],f=0;f<b;f++)d.push(null);return d},setContentType:function(b){this.contentType=b;if(this.services)for(b=0;b<this.services.length;b++){var d=this.services[b];if(d.setContentType){var f=this.serviceRegistry.getService("orion.page.progress");f?f.progress(d.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):d.setContentType(this.contentType)}}},onServiceAdded:function(b,d){o(b)&&this.addServiceListener(d)},onServiceRemoved:function(b,
+d){this.services.indexOf(d)!==-1&&this.removeServiceListener(d)},addServiceListener:function(b){if(typeof b.addEventListener==="function"){if(b.addEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),this.services.push(b),b.setContentType&&this.contentType){var e=this.serviceRegistry.getService("orion.page.progress");e?e.progress(b.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):b.setContentType(this.contentType)}}else typeof console!==
+"undefined"&&console.log(Error(d))},removeServiceListener:function(b){typeof b.removeEventListener==="function"?(b.removeEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),b=this.services.indexOf(b),b!==-1&&this.services.splice(b,1)):typeof console!=="undefined"&&console.log(Error(d))}};return e});
+define("orion/editor/mirror",["i18n!orion/editor/nls/messages","orion/editor/eventTarget","orion/editor/annotations"],function(k,p,o){function e(b){this.string=b;this.tokenStart=this.pos=0}function b(){this._modes={};this.mimeModes={};this.options={};this.StringStream=e}function d(b){var a=[],c;for(c in b)Object.prototype.hasOwnProperty.call(b,c)&&a.push(c);return a}function h(b,a,c){c=c||{};this.model=b;this.codeMirror=a;this.isWhitespaceVisible=typeof c.whitespacesVisible==="undefined"?!1:c.whitespacesVisible;
+this.mode=null;this.isModeLoaded=!1;this.lines=[];this.dirtyLines=[];this.startLine=Number.MAX_VALUE;this.endLine=-1;this.timer=null;this.initialize(b)}function j(b,a,c){this.init(b,a,c)}e.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos===0},peek:function(){return this.string[this.pos]},next:function(){return this.string[this.pos++]},eat:function(b){var a=this.string[this.pos];return typeof a==="string"&&(a===b||b.test&&b.test(a)||typeof b==="function"&&
+b(a))?this.string[this.pos++]:void 0},eatWhile:function(b){for(var a=!1;this.eat(b)!==void 0;)a=!0;return a},eatSpace:function(){return this.eatWhile(/\s/)},skipToEnd:function(){this.pos=this.string.length},skipTo:function(b){b=this.string.indexOf(b,this.pos);return b!==-1?(this.pos=b,!0):!1},match:function(b,a,c){a=a===!0||typeof a==="undefined";if(typeof b==="string"){var d=c?this.string.toLowerCase():this.string,b=c?b.toLowerCase():b,c=d.indexOf(b,this.pos);if(c!==-1&&a)this.pos=c+b.length;return c!==
+-1}else return(b=this.string.substring(this.pos).match(b))&&a&&typeof b[0]==="string"&&(this.pos+=b.index+b[0].length),b},backUp:function(b){this.pos-=b},column:function(){for(var b=0,a=0;a<this.tokenStart;)b+=this.string[a++]==="\t"?4:1;return b},indentation:function(){for(var b=this.string.search(/\S/),a=0,c=0;c<b;)a+=this.string[c++]==="\t"?4:1;return a},current:function(){return this.string.substring(this.tokenStart,this.pos)},advance:function(){this.tokenStart=this.pos}};b.prototype={options:{},
+setOption:function(b,a){this.options[b]=a},getOption:function(b){return this.options[b]},copyState:function(b,a){if(typeof b.copyState==="function")return b.copyState(a);var c={},d;for(d in a){var e=a[d];c[d]=e instanceof Array?e.slice():e}return c},defineMode:function(b,a){this._modes[b]=a},defineMIME:function(b,a){this.mimeModes[b]=a},getMode:function(b,a){var c={},d;typeof a==="string"&&this.mimeModes[a]&&(a=this.mimeModes[a]);typeof a==="object"&&(c=a,d=this._modes[a.name]);d=d||this._modes[a];
+if(typeof d!=="function")throw"Mode not found "+a;return d(b,c)},listModes:function(){return d(this._modes)},listMIMEs:function(){return d(this.mimeModes)},_getModeName:function(b){b=this.mimeModes[b];if(typeof b==="object")b=b.name;return b}};h.prototype={initialize:function(){var b=this;this.listener={onModelChanging:function(a){b._onModelChanging(a)},onModelChanged:function(a){b._onModelChanged(a)},onDestroy:function(a){b._onDestroy(a)}};this.model.addEventListener("Changing",this.listener.onModelChanging);
+this.model.addEventListener("Changed",this.listener.onModelChanged);this.model.addEventListener("Destroy",this.listener.onDestroy)},destroy:function(){this.model&&(this.model.removeEventListener("Changing",this.listener.onModelChanging),this.model.removeEventListener("Changed",this.listener.onModelChanged),this.model.removeEventListener("Destroy",this.listener.onDestroy));this.dirtyLines=this.lines=this.mode=this.codeMirror=this.model=null;clearTimeout(this.timer);this.timer=null},_onModelChanging:function(b){this.startLine=
+this.model.getLineAtOffset(b.start)},_onModelChanged:function(b){this._dbgEvent(b);var a=this.startLine;(b.removedLineCount||b.addedLineCount)&&Array.prototype.splice.apply(this.lines,[a+1,b.removedLineCount].concat(this._newLines(b.addedLineCount)));this.mode&&(b=Math.max(b.addedLineCount,b.removedLineCount),b=a+Math.min(b,500),this.highlight(a,b),this.highlightLater(b+1))},_onDestroy:function(){this.destroy()},setViewportIndex:function(b){this.viewportIndex=b},_dbgEvent:function(){},_dbgStyle:function(){},
+_newLines:function(b){for(var a=[],c=0;c<b;c++)a.push({style:null,eolState:null});return a},setMode:function(b,a){if(b)this.mode=this.codeMirror.getMode(this.codeMirror.options,b),this.lines=this._newLines(this.model.getLineCount()),a&&this.highlight()},highlight:function(b,a,c){if(this.mode){for(var d=this.model.getLineCount(),b=typeof b==="undefined"?0:b,a=typeof a==="undefined"?d-1:Math.min(a,d-1),d=this.mode,e=this.getState(b),h=b;h<=a;h++){var j=this.lines[h];this.highlightLine(h,j,e);j.eolState=
+this.codeMirror.copyState(d,e)}this._expandRange(b,a);if(!c)this.onHighlightDone()}},highlightLater:function(b){this.dirtyLines.push(b);var a=this;this.timer=setTimeout(function(){a._highlightJob()},50)},_highlightJob:function(){for(var b=+new Date+30,a=this.mode.compareStates,c=this.model.getLineCount();this.dirtyLines.length;){var d=this.viewportIndex,e=this.lines[d],d=e&&!e.eolState?d:this.dirtyLines.pop();if(d>=c)break;this._expandRange(d,d);for(var e=this._getResumeLineIndex(d),d=e+1,e=(e=e>=
+0&&this.lines[e].eolState)?this.codeMirror.copyState(this.mode,e):this.mode.startState(),h=0,j=d;j<c;j++){var k=this.lines[j],o=k.eolState,p=this.highlightLine(j,k,e);k.eolState=this.codeMirror.copyState(this.mode,e);p&&this._expandRange(d,j+1);var k=a&&o&&a(o,k.eolState),u=!a&&!p&&h++>3;if(k||u)break;else if(!o||p)h=0;o=j<c||this.dirtyLines.length;if(+new Date>b&&o){this.highlightLater(j+1);this.onHighlightDone();return}}}this.onHighlightDone()},onHighlightDone:function(){this.startLine!==Number.MAX_VALUE&&
+this.endLine!==-1&&this.dispatchEvent({type:"Highlight",start:this.startLine,end:this.endLine});this.startLine=Number.MAX_VALUE;this.endLine=-1},_getResumeLineIndex:function(b){for(var a=this.lines,c=b-1;c>=0;c--)if(a[c].eolState||b-c>40)return c;return-1},getState:function(b){var a=this.mode,c=this.lines,d,e;for(d=b-1;d>=0;d--)if(e=c[d],e.eolState||b-d>40)break;var h=d>=0&&c[d].eolState;if(h){h=this.codeMirror.copyState(a,h);for(d=Math.max(0,d);d<b-1;d++)e=c[d],this.highlightLine(d,e,h),e.eolState=
+this.codeMirror.copyState(a,h);return h}else return a.startState()},highlightLine:function(b,a,c){if(this.mode){var d=this.model;d.getLineStart(b)===d.getLineEnd(b)&&this.mode.blankLine&&this.mode.blankLine(c);for(var h=a.style||[],b=d.getLine(b),b=new e(b),d=!a.style,j=[],l=0;!b.eol();l++){var k=this.mode.token(b,c)||null,o=b.current();this._whitespaceStyle(k,o,b.tokenStart);k=[b.tokenStart,b.pos,k];o=h[l];j.push(k);d=d||!o||o[0]!==k[0]||o[1]!==k[1]||o[2]!==k[2];b.advance()}if(d=d||j.length!==h.length)a.style=
+j.length?j:null;return d}},_whitespaceStyle:function(b,a,c){if(!b&&this.isWhitespaceVisible&&/\s+/.test(a)){for(var b=[],d,e,h=0;h<a.length;h++){var j=a[h];j!==e&&(e&&b.push([c+d,c+h,e==="\t"?"token_tab":"token_space"]),d=h,e=j)}b.push([c+d,c+h,e==="\t"?"token_tab":"token_space"]);return b}return null},_expandRange:function(b,a){this.startLine=Math.min(this.startLine,b);this.endLine=Math.max(this.endLine,a)},toStyleRangesAndErrors:function(b,a){var c=b.style;if(!c)return null;for(var d=[],e=[],h=
+typeof a==="undefined"?0:this.model.getLineStart(a),j=0;j<c.length;j++){var k=c[j],o=!k[2]?null:k[2]==="token_tab"||k[2]==="token_space"?k[2]:"cm-"+k[2];o&&(k={start:h+k[0],end:h+k[1],style:{styleClass:o}},d.push(k),o==="cm-error"&&e.push(k))}return[d,e]},getLineStyle:function(b){return this.lines[b]},getLineStyles:function(){return this.lines}};p.EventTarget.addMixin(h.prototype);o.AnnotationType.registerType("orion.annotation.highlightError",{title:k.syntaxError,html:"<div class='annotationHTML error'></div>",
+rangeStyle:{styleClass:"annotationRange error"}});j.prototype={init:function(b,a,c){this.textView=b;this.annotationModel=c;this.modeApplier=new h(b.getModel(),a);var d=this;this.listener={onLineStyle:function(a){d.onLineStyle(a)},onDestroy:function(a){d.onDestroy(a)},onHighlight:function(a){d.onHighlight(a)}};b.addEventListener("LineStyle",this.listener.onLineStyle);b.addEventListener("Destroy",this.listener.onDestroy);this.modeApplier.addEventListener("Highlight",this.listener.onHighlight)},destroy:function(){this.modeApplier&&
+(this.modeApplier.removeEventListener("Highlight",this.listener.onHighlight),this.modeApplier.destroy());this.textView&&(this.textView.removeEventListener("LineStyle",this.listener.onLineStyle),this.textView.removeEventListener("Destroy",this.listener.onDestroy));this.listener=this.modeApplier=this.annotationModel=this.textView=null},setMode:function(b){this.modeApplier.setMode(b)},onLineStyle:function(b){var a=b.lineIndex,c=this.modeApplier,d=c.getLineStyle(a);if(!d||!d.eolState){var e=this.textView.getModel().getLineCount();
+c.highlight(a,Math.min(a+20,e-1),!0);d=c.getLineStyle(a)}e=this.textView.getModel();if(d){var h=c.toStyleRangesAndErrors(d,a);if(h&&(b.ranges=h[0],b=this.annotationModel)){c=[];d=[];if(h=h[1])for(var j=0;j<h.length;j++){var k=h[j];k.style.styleClass==="cm-error"&&d.push(o.AnnotationType.createAnnotation("orion.annotation.highlightError",k.start,k.end))}for(a=b.getAnnotations(e.getLineStart(a),e.getLineEnd(a));a.hasNext();)e=a.next(),e.type==="orion.annotation.highlightError"&&c.push(e);b.replaceAnnotations(c,
+d)}}},onHighlight:function(b){this.textView.redrawLines(b.start,b.end)},onDestroy:function(){this.destroy()}};return{Mirror:b,ModeApplier:h,CodeMirrorStyler:j}});
+define("orion/editor/textMateStyler",["orion/editor/regex"],function(k){function p(b){var d;if(b instanceof Array){d=Array(b.length);for(var e=0;e<b.length;e++)d[e]=p(b[e])}else for(e in d={},b)if(Object.prototype.hasOwnProperty.call(b,e)){var j=b[e];d[e]=typeof j==="object"&&j!==null?p(j):j}return d}function o(b,d,e){this.initialize(b);this.grammar=p(d);this.externalGrammars=e?p(e):[];this._styles={};this._tree=null;this._allGrammars={};this.preprocess(this.grammar)}var e={unsupported:[{regex:/\(\?[ims\-]:/,
+func:function(){return"option on/off for subexp"}},{regex:/\(\?<([=!])/,func:function(b){return b[1]==="="?"lookbehind":"negative lookbehind"}},{regex:/\(\?>/,func:function(){return"atomic group"}}],toRegExp:function(b){function d(a,b){throw Error('Unsupported regex feature "'+a+'": "'+b[0]+'" at index: '+b.index+" in "+b.input);}var h="",j,b=e.processGlobalFlag("x",b,function(a){for(var b="",d=!1,e=a.length,f=0;f<e;){var h=a.charAt(f);if(!d&&h==="#")for(;f<e&&h!=="\r"&&h!=="\n";)h=a.charAt(++f);
+else if(!d&&/\s/.test(h))for(;f<e&&/\s/.test(h);)h=a.charAt(++f);else h==="\\"?(b+=h,/\s/.test(a.charAt(f+1))||(b+=a.charAt(f+1),f+=1)):(h==="["?d=!0:h==="]"&&(d=!1),b+=h),f+=1}return b}),b=e.processGlobalFlag("i",b,function(a){h+="i";return a});for(j=0;j<this.unsupported.length;j++){var f;(f=this.unsupported[j].regex.exec(b))&&d(this.unsupported[j].func(f),f)}return RegExp(b,h)},processGlobalFlag:function(b,d,e){function j(a,b){for(var d=0,e=a.length,f=-1,h=b;h<e&&f===-1;h++)switch(a.charAt(h)){case "\\":h++;
+break;case "(":d++;break;case ")":d--,d===0&&(f=h)}return f}var f="(?"+b+")",b="(?"+b+":";if(d.substring(0,f.length)===f)return e(d.substring(f.length));else if(d.substring(0,b.length)===b){f=j(d,0);if(f<d.length-1)throw Error("Only a "+b+") group that encloses the entire regex is supported in: "+d);return e(d.substring(b.length,f))}return d},hasBackReference:function(b){return/\\\d+/.test(b.source)},getSubstitutedRegex:function(b,d,e){for(var e=typeof e==="undefined"?!0:!1,b=b.source.split(/(\\\d+)/g),
+j=[],f=0;f<b.length;f++){var a=b[f],c=/\\(\d+)/.exec(a);c?(a=d[c[1]]||"",j.push(e?k.escape(a):a)):j.push(a)}return RegExp(j.join(""))},groupify:function(b,d){for(var e=b.source,j=e.length,f=[],a=0,c=[],i=1,k=1,n=[],l={},o={},q=0;q<j;q++){var p=f[f.length-1],u=e.charAt(q);switch(u){case "(":if(p===4)f.pop(),n.push(")"),c[c.length-1].end=q;var g=q+2<j?e.charAt(q+1)+""+e.charAt(q+2):null;if(g==="?:"||g==="?="||g==="?!"){var t;g==="?:"?t=1:(t=3,a++);f.push(t);c.push({start:q,end:-1,type:t});n.push(u);
+n.push(g);q+=g.length}else f.push(2),c.push({start:q,end:-1,type:2,oldNum:i,num:k}),n.push(u),a===0&&(o[k]=null),l[i]=k,i++,k++;break;case ")":p=f.pop();p===3&&a--;c[c.length-1].end=q;n.push(u);break;case "*":case "+":case "?":case "}":var x=u,s=e.charAt(q-1),g=q-1;if(u==="}"){for(t=q-1;e.charAt(t)!=="{"&&t>=0;t--);s=e.charAt(t-1);g=t-1;x=e.substring(t,q+1)}t=c[c.length-1];if(s===")"&&(t.type===2||t.type===4)){n.splice(t.start,0,"(");n.push(x);n.push(")");u={start:t.start,end:n.length-1,type:4,num:t.num};
+for(s=0;s<c.length;s++)if(p=c[s],(p.type===2||p.type===4)&&p.start>=t.start&&p.end<=g)if(p.start+=1,p.end+=1,p.num+=1,p.type===2)l[p.oldNum]=p.num;c.push(u);k++;break}default:u!=="|"&&p!==2&&p!==4&&a===0&&(f.push(4),c.push({start:q,end:-1,type:4,num:k}),n.push("("),o[k]=null,k++),n.push(u),u==="\\"&&(u=e.charAt(q+1),n.push(u),q+=1)}}for(;f.length;)f.pop(),n.push(")");var e=RegExp(n.join("")),j={},d=d||l,B;for(B in d)d.hasOwnProperty(B)&&(j[B]="\\"+d[B]);e=this.getSubstitutedRegex(e,j,!1);return[e,
+l,o]},complexCaptures:function(b){if(!b)return!1;for(var d in b)if(b.hasOwnProperty(d)&&d!=="0")return!0;return!1}};o.prototype={initialize:function(b){this.textView=b;this.textView.stylerOptions=this;var d=this;this._listener={onModelChanged:function(b){d.onModelChanged(b)},onDestroy:function(b){d.onDestroy(b)},onLineStyle:function(b){d.onLineStyle(b)},onStorage:function(b){d.onStorage(b)}};b.addEventListener("ModelChanged",this._listener.onModelChanged);b.addEventListener("Destroy",this._listener.onDestroy);
+b.addEventListener("LineStyle",this._listener.onLineStyle);b.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(b){for(b=[b];b.length!==0;){var d=
+b.pop();if(!d._resolvedRule||!d._typedRule)if(d._resolvedRule=this._resolve(d),d._typedRule=this._createTypedRule(d),this.addStyles(d.name),this.addStyles(d.contentName),this.addStylesForCaptures(d.captures),this.addStylesForCaptures(d.beginCaptures),this.addStylesForCaptures(d.endCaptures),d._resolvedRule!==d&&b.push(d._resolvedRule),d.patterns)for(var e=0;e<d.patterns.length;e++)b.push(d.patterns[e])}},addStyles:function(b){if(b&&!this._styles[b]){this._styles[b]=[];for(var d=b.split("."),e=0;e<
+d.length;e++)this._styles[b].push(d.slice(0,e+1).join("-"))}},addStylesForCaptures:function(b){for(var d in b)b.hasOwnProperty(d)&&this.addStyles(b[d].name)},ContainerRule:function(){function b(b){this.rule=b;this.subrules=b.patterns}b.prototype.valueOf=function(){return"aa"};return b}(),BeginEndRule:function(){function b(b){this.rule=b;this.beginRegex=e.toRegExp(b.begin);this.endRegex=e.toRegExp(b.end);this.subrules=b.patterns||[];this.endRegexHasBackRef=e.hasBackReference(this.endRegex);var h=e.complexCaptures(b.captures),
+b=e.complexCaptures(b.beginCaptures)||e.complexCaptures(b.endCaptures);if(this.isComplex=h||b)h=e.groupify(this.beginRegex),this.beginRegex=h[0],this.beginOld2New=h[1],this.beginConsuming=h[2],h=e.groupify(this.endRegex,this.beginOld2New),this.endRegex=h[0],this.endOld2New=h[1],this.endConsuming=h[2]}b.prototype.valueOf=function(){return this.beginRegex};return b}(),MatchRule:function(){function b(b){this.rule=b;this.matchRegex=e.toRegExp(b.match);if(this.isComplex=e.complexCaptures(b.captures))b=
+e.groupify(this.matchRegex),this.matchRegex=b[0],this.matchOld2New=b[1],this.matchConsuming=b[2]}b.prototype.valueOf=function(){return this.matchRegex};return b}(),_createTypedRule:function(b){return b.match?new this.MatchRule(b):b.begin?new this.BeginEndRule(b):new this.ContainerRule(b)},_resolve:function(b){var d=b;if(b.include){if(b.begin||b.end||b.match)throw Error('Unexpected regex pattern in "include" rule '+b.include);b=b.include;if(b.charAt(0)==="#"){if(d=this.grammar.repository&&this.grammar.repository[b.substring(1)],
+!d)throw Error("Couldn't find included rule "+b+" in grammar repository");}else if(b==="$self")d=this.grammar;else if(b==="$base")throw Error('Include "$base" is not supported');else if(d=this._allGrammars[b],!d)for(var e=0;e<this.externalGrammars.length;e++){var j=this.externalGrammars[e];if(j.scopeName===b){this.preprocess(j);d=this._allGrammars[b]=j;break}}}return d},ContainerNode:function(){function b(b,e){this.parent=b;this.rule=e;this.children=[];this.end=this.start=null}b.prototype.addChild=
+function(b){this.children.push(b)};b.prototype.valueOf=function(){var b=this.rule;return"ContainerNode { "+(b.include||"")+" "+(b.name||"")+(b.comment||"")+"}"};return b}(),BeginEndNode:function(){function b(b,h,j){this.parent=b;this.rule=h;this.children=[];this.setStart(j);this.endMatch=this.end=null;this.endRegexSubstituted=h.endRegexHasBackRef?e.getSubstitutedRegex(h.endRegex,j):null}b.prototype.addChild=function(b){this.children.push(b)};b.prototype.getIndexInParent=function(){return this.parent?
+this.parent.children.indexOf(this):-1};b.prototype.setStart=function(b){this.start=b.index;this.beginMatch=b};b.prototype.setEnd=function(b){b&&typeof b==="object"?(this.endMatch=b,this.end=b.index+b[0].length):(this.endMatch=null,this.end=b)};b.prototype.shiftStart=function(b){this.start+=b;this.beginMatch.index+=b};b.prototype.shiftEnd=function(b){this.end+=b;this.endMatch&&(this.endMatch.index+=b)};b.prototype.valueOf=function(){return"{"+this.rule.beginRegex+" range="+this.start+".."+this.end+
+"}"};return b}(),push:function(b,d){if(d)for(var e=d.length;e>0;)b.push(d[--e])},exec:function(b,d,e){(d=b.exec(d))&&(d.index+=e);b.lastIndex=0;return d},afterMatch:function(b){return b.index+b[0].length},getEndMatch:function(b,d,e){if(b instanceof this.BeginEndNode){var j=b.rule,b=b.endRegexSubstituted||j.endRegex;return!b?null:this.exec(b,d,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(b){var d=b.addedCharCount,e=b.removedCharCount,b=b.start;if(this._tree){var j=this.textView.getModel(),f=j.getCharCount(),j=j.getLineEnd(j.getLineAtOffset(b)-1),a=this.getFirstDamaged(j,j),j=j===-1?0:j,d=a?this.parse(a,!0,j,b,d,e):f;this.textView.redrawRange(j,d)}else this.initialParse()},getFirstDamaged:function(b,d){if(b<0)return this._tree;for(var e=[this._tree],j=null;e.length;){var f=e.pop();if(!f.parent||this.isDamaged(f,b,d)){f instanceof this.BeginEndNode&&(j=
+f);for(var a=0;a<f.children.length;a++)e.push(f.children[a])}}return j||this._tree},isDamaged:function(b,d,e){return b.start<=e&&b.end>d},parse:function(b,d,e,j,f,a){var c=this.textView.getModel(),i=c.getLineStart(c.getLineCount()-1),k=c.getCharCount(),n=this.getInitialExpected(b,e),l=-1;if(d)b.repaired=!0,b.endNeedsUpdate=!0,l=(l=b.children[b.children.length-1])?c.getLineEnd(c.getLineAtOffset(l.end+(f-a))):-1,j=c.getLineEnd(c.getLineAtOffset(j+a)),l=Math.max(l,j);for(var l=l===-1?k:l,j=n,o=b,p=!1,
+v=e,u=-1;o&&(!d||v<l);){var g=this.getNextMatch(c,o,v);g||(v=v>=i?k:c.getLineStart(c.getLineAtOffset(v)+1));var t=g&&g.match,x=g&&g.rule,s=g&&g.isEnd;if(g&&g.isSub){if(v=this.afterMatch(t),x instanceof this.BeginEndRule)p=!0,d&&x===j.rule&&o===j.parent?(o=j,o.setStart(t),o.repaired=!0,o.endNeedsUpdate=!0,j=this.getNextExpected(j,"begin")):(d&&(this.prune(o,j),d=!1),t=new this.BeginEndNode(o,x,t),o.addChild(t),o=t)}else if(s||v===k){if(o instanceof this.BeginEndNode)t?(p=!0,u=Math.max(u,o.end),o.setEnd(t),
+v=this.afterMatch(t),d&&o===j&&o.parent===j.parent?(o.repaired=!0,delete o.endNeedsUpdate,j=this.getNextExpected(j,"end")):d&&(this.prune(o,j),d=!1)):(o.setEnd(k),delete o.endNeedsUpdate);o=o.parent}d&&v>=l&&!p&&(this.prune(b,n),d=!1)}this.removeUnrepairedChildren(b,d,e);this.cleanup(d,b,e,l,k,f,a);return d?Math.max(u,v):v},removeUnrepairedChildren:function(b,d,e){if(d){for(var d=b.children,j=-1,f=0;f<d.length;f++){var a=d[f];if(!a.repaired&&this.isDamaged(a,e,Number.MAX_VALUE)){j=f;break}}if(j!==
+-1)b.children.length=j}},cleanup:function(b,d,e,j,f,a,c){if(b){b=a-c;f=this.getIntersecting(j-b+1,f);d=this.getIntersecting(e,j);for(e=0;e<f.length;e++)j=f[e],!j.repaired&&j instanceof this.BeginEndNode&&(j.shiftEnd(b),j.shiftStart(b));for(e=0;e<d.length;e++)j=d[e],j.repaired&&j.endNeedsUpdate&&j.shiftEnd(b),delete j.endNeedsUpdate,delete j.repaired}else{d=this.getIntersecting(e,j);for(e=0;e<d.length;e++)delete d[e].repaired}},getNextMatch:function(b,d,e,j){var f=b.getLineAtOffset(e),f=b.getLineEnd(f),
+a=b.getText(e,f),c=[],i=[],b=[],f=[];for(this.push(c,d.rule.subrules);c.length;){var k=c.length?c.pop():null,k=k&&k._resolvedRule._typedRule;if(k instanceof this.ContainerRule&&i.indexOf(k)===-1)i.push(k),this.push(c,k.subrules);else if(!k||!j||k.matchRegex){var n=k&&this.exec(k.matchRegex||k.beginRegex,a,e);n&&(b.push(n),f.push(k))}}c=Number.MAX_VALUE;i=-1;for(k=0;k<b.length;k++)if(n=b[k],n.index<c)c=n.index,i=k;if(!j&&(e=this.getEndMatch(d,a,e)))if(j=d.rule.applyEndPatternLast,i===-1||e.index<c||
+!j&&e.index===c)return{isEnd:!0,rule:d.rule,match:e};return i===-1?null:{isSub:!0,rule:f[i],match:b[i]}},getInitialExpected:function(b,d){var e,j;if(b===this._tree)for(e=0;e<b.children.length;e++){if(j=b.children[e],j.start>=d)return j}else if(b instanceof this.BeginEndNode&&b.endMatch){var f=b.endMatch.index;for(e=0;e<b.children.length;e++)if(j=b.children[e],j.start>=d)break;if(j&&j.start<f)return j}return b},getNextExpected:function(b,d){if(d==="begin"){var e=b.children[0];return e?e:b}else if(d===
+"end"&&(e=b.parent)){var j=e.children[e.children.indexOf(b)+1];return j?j:e}return null},prune:function(b,d){if(d.parent===b)b.children.length=d.getIndexInParent();else if(b instanceof this.BeginEndNode)b.endMatch=null,b.end=null;if(b.parent)b.parent.children.length=b.getIndexInParent()+1},onLineStyle:function(b){this._tree||this.initialParse();var d=b.lineStart,e=this.textView.getModel(),j=e.getLineEnd(b.lineIndex),f=e.getLineEnd(e.getLineAtOffset(d)-1),f=this.getFirstDamaged(f,f),d=this.getLineScope(e,
+f,d,j);b.ranges=this.toStyleRanges(d);b.ranges.sort(function(a,b){return a.start-b.start})},getLineScope:function(b,d,e,j){for(var f=e,a=this.getInitialExpected(d,e),c=[],i=[];d&&f<j;){var k=this.getNextMatch(b,d,f);if(!k)break;var n=k&&k.match,l=k&&k.rule,o=k&&k.isSub,k=k&&k.isEnd;n.index!==f&&i.push({start:f,end:n.index,node:d});if(o)f=this.afterMatch(n),l instanceof this.BeginEndRule?(this.addBeginScope(c,n,l),d=a,a=this.getNextExpected(a,"begin")):this.addMatchScope(c,n,l);else if(k)f=this.afterMatch(n),
+this.addEndScope(c,n,l),a=this.getNextExpected(a,"end"),d=d.parent}f<j&&i.push({start:f,end:j,node:d});b=this.getInheritedLineScope(i,e,j);return c.concat(b)},getInheritedLineScope:function(b){for(var d=[],e=0;e<b.length;e++)for(var j=b[e],f=j.node;f;){var a=f.rule.rule,c=a.name;if(a=a.contentName||c){this.addScopeRange(d,j.start,j.end,a);break}f=f.parent}return d},addBeginScope:function(b,d,e){var j=e.rule;this.addCapturesScope(b,d,j.beginCaptures||j.captures,e.isComplex,e.beginOld2New,e.beginConsuming)},
+addEndScope:function(b,d,e){var j=e.rule;this.addCapturesScope(b,d,j.endCaptures||j.captures,e.isComplex,e.endOld2New,e.endConsuming)},addMatchScope:function(b,d,e){var j=e.rule,f=j.name;(j=j.captures)?this.addCapturesScope(b,d,j,e.isComplex,e.matchOld2New,e.matchConsuming):this.addScope(b,d,f)},addScope:function(b,d,e){e&&b.push({start:d.index,end:this.afterMatch(d),scope:e})},addScopeRange:function(b,d,e,j){j&&b.push({start:d,end:e,scope:j})},addCapturesScope:function(b,d,e,j,f,a){if(e)if(j){for(var j=
+{1:0},c=0,i=1;d[i]!==void 0;i++)a[i]!==void 0&&(c+=d[i].length),d[i+1]!==void 0&&(j[i+1]=c);a=d.index;for(c=1;e[c];c++){var i=e[c].name,k=f[c],n=a+j[k];typeof d[k]!=="undefined"&&this.addScopeRange(b,n,n+d[k].length,i)}}else this.addScope(b,d,e[0]&&e[0].name)},getIntersecting:function(b,d){for(var e=[],j=this._tree?[this._tree]:[];j.length;){var f=j.pop(),a=!1;f instanceof this.ContainerNode?a=!0:this.isDamaged(f,b,d)&&(a=!0,e.push(f));if(a)for(var a=f.children.length,c=0;c<a;c++)j.push(f.children[c])}return e.reverse()},
+toStyleRanges:function(b){for(var d=[],e=0;e<b.length;e++){var j=b[e],f=this._styles[j.scope];if(!f)throw Error("styles not found for "+j.scope);f=f.join(" ");d.push({start:j.start,end:j.end,style:{styleClass:f}})}return d}};return{RegexUtil:e,TextMateStyler:o}});
+define("orion/editor/htmlGrammar",[],function(){return{HtmlGrammar:function(){return{scopeName:"source.html",uuid:"3B5C76FB-EBB5-D930-F40C-047D082CE99B",patterns:[{begin:"<!(doctype|DOCTYPE)",end:">",contentName:"entity.name.tag.doctype.html",beginCaptures:{0:{name:"entity.name.tag.doctype.html"}},endCaptures:{0:{name:"entity.name.tag.doctype.html"}}},{begin:"<\!--",end:"--\>",beginCaptures:{0:{name:"punctuation.definition.comment.html"}},endCaptures:{0:{name:"punctuation.definition.comment.html"}},
+patterns:[{match:"--",name:"invalid.illegal.badcomment.html"}],contentName:"comment.block.html"},{match:"<[A-Za-z0-9_\\-:]+(?= ?)",name:"entity.name.tag.html"},{include:"#attrName"},{include:"#qString"},{include:"#qqString"},{include:"#entity"},{match:"</[A-Za-z0-9_\\-:]+>",name:"entity.name.tag.html"},{match:">",name:"entity.name.tag.html"}],repository:{attrName:{match:"[A-Za-z\\-:]+(?=\\s*=\\s*['\"])",name:"entity.other.attribute.name.html"},qqString:{match:'(")[^"]+(")',name:"string.quoted.double.html"},
+qString:{match:"(')[^']+(')",name:"string.quoted.single.html"},entity:{match:"&[A-Za-z0-9]+;",name:"constant.character.entity.html"}}}}}});
+define("examples/editor/textStyler",["orion/editor/annotations","orion/editor/keywords"],function(k,p){function o(a,b){this.keywords=a;this.whitespacesVisible=b;this.setText("")}function e(){o.call(this,null,!0)}function b(a){o.call(this,null,a)}function d(){o.call(this,null,!1)}function h(c,g,h){this.commentStart="/*";this.commentEnd="*/";var i=[];switch(g){case "java":i=f;break;case "js":i=j;break;case "css":i=a}this.whitespacesVisible=!1;this.detectHyperlinks=!0;this.highlightCaretLine=!1;this.detectTasks=
+this.foldingEnabled=!0;this._scanner=new o(i,this.whitespacesVisible);this._firstScanner=new d;this._commentScanner=new b(this.whitespacesVisible);this._whitespaceScanner=new e;if(g==="css")this._scanner.isCSS=!0,this._firstScanner.isCSS=!0;this.view=c;this.annotationModel=h;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)}};g=c.getModel();g.getBaseModel&&(g=g.getBaseModel());g.addEventListener("Changed",this._listener.onChanged);c.addEventListener("MouseDown",this._listener.onMouseDown);c.addEventListener("Selection",this._listener.onSelection);c.addEventListener("Destroy",this._listener.onDestroy);c.addEventListener("LineStyle",this._listener.onLineStyle);this._computeComments();this._computeFolding();c.redrawLines()}var j=p.JSKeywords,f=p.JAVAKeywords,a=p.CSSKeywords,c={styleClass:"token_singleline_comment"},
+i={styleClass:"token_multiline_comment"},m={styleClass:"token_doc_comment"},n={styleClass:"token_doc_html_markup"},l={styleClass:"token_task_tag"},r={styleClass:"token_doc_tag"},q={styleClass:"token_string"},v={styleClass:"token_number"},u={styleClass:"token_keyword"},g={styleClass:"token_space"},t={styleClass:"token_tab"},x={styleClass:"line_caret"};o.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}};e.prototype=new o(null);e.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}}};b.prototype=new o(null);b.prototype.setType=function(a){this._type=a};b.prototype.nextToken=function(){for(this.startOffset=this.offset;;){var a=this._read();switch(a){case -1:return null;case 32:case 9:if(this.whitespacesVisible)return a===32?11:10;do a=this._read();while(a===32||a===
+9);this._unread(a);return 9;case 60:if(this._type===8){do a=this._read();while(!(a===62||a===-1));if(a===62)return 12}return 1;case 64:if(this._type===8){do a=this._read();while(97<=a&&a<=122||65<=a&&a<=90||a===95||48<=a&&a<=57);this._unread(a);return 13}return 1;case 84:if((a=this._read())===79)if((a=this._read())===68)if((a=this._read())===79)if(a=this._read(),!(97<=a&&a<=122||65<=a&&a<=90||a===95||48<=a&&a<=57))return this._unread(a),14;this._unread(a);default:do a=this._read();while(!(a===32||
+a===9||a===-1||a===60||a===64||a===84));this._unread(a);return 1}}};d.prototype=new o(null);d.prototype._default=function(a){for(;;)switch(a=this._read(),a){case 47:case 34:case 39:case -1:return this._unread(a),1}};h.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){this.whitespacesVisible=a;this._scanner.whitespacesVisible=a;this._commentScanner.whitespacesVisible=a},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(k.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 (k.AnnotationType.getType(k.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=k.AnnotationType.ANNOTATION_TASK;g.hasNext();){var i=g.next();i.type===h&&e.push(i)}g=[];i=this._commentScanner;i.setText(f.getText(b,c));for(var j;j=i.nextToken();){var l=i.getStartOffset()+b;j===14&&(j=f.getLineEnd(f.getLineAtOffset(l)),a!==6&&(j=Math.min(j,c-this.commentEnd.length)),g.push(k.AnnotationType.createAnnotation(h,l,j,f.getText(l,j))))}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 j=g[h].start,k=g[h].end;f<j&&this._parse(b.substring(f-c,j-c),f,e);var l=g[h].type,n;switch(l){case 8:n=m;break;case 7:n=i;break;case 5:n=q}f=Math.max(f,j);j=Math.min(d,k);(l===8||l===7)&&(this.whitespacesVisible||this.detectHyperlinks)?
+this._parseComment(b.substring(f-c,j-c),f,e,n,l):l===5&&this.whitespacesVisible?this._parseString(b.substring(f-c,j-c),f,e,q):e.push({start:f,end:j,style:n});f=k}f<d&&this._parse(b.substring(f-c,d-c),f,e);if(a.getBaseModel)for(b=0;b<e.length;b++)c=e[b].end-e[b].start,e[b].start=a.mapOffset(e[b].start,!0),e[b].end=e[b].start+c;return e},_parse:function(a,b,d){var e=this._scanner;for(e.setText(a);a=e.nextToken();){var f=e.getStartOffset()+b,h=null;switch(a){case 2:h=u;break;case 3:h=v;break;case 5:case 4:if(this.whitespacesVisible){this._parseString(e.getData(),
+f,d,q);continue}else h=q;break;case 8:this._parseComment(e.getData(),f,d,m,a);continue;case 6:this._parseComment(e.getData(),f,d,c,a);continue;case 7:this._parseComment(e.getData(),f,d,i,a);continue;case 10:this.whitespacesVisible&&(h=t);break;case 11:this.whitespacesVisible&&(h=g)}d.push({start:f,end:e.getOffset()+b,style:h})}},_parseComment:function(a,b,c,d,e){var f=this._commentScanner;f.setText(a);for(f.setType(e);a=f.nextToken();){var e=f.getStartOffset()+b,h=d;switch(a){case 10:this.whitespacesVisible&&
+(h=t);break;case 11:this.whitespacesVisible&&(h=g);break;case 12:h=n;break;case 13:h=r;break;case 14:h=l;break;default:this.detectHyperlinks&&(h=this._detectHyperlinks(f.getData(),e,c,h))}h&&c.push({start:e,end:f.getOffset()+b,style:h})}},_parseString:function(a,b,c,d){var e=this._whitespaceScanner;for(e.setText(a);a=e.nextToken();){var f=e.getStartOffset()+b,h=d;switch(a){case 10:this.whitespacesVisible&&(h=t);break;case 11:this.whitespacesVisible&&(h=g)}h&&c.push({start:f,end:e.getOffset()+b,style:h})}},
+_detectHyperlinks:function(a,b,c,d){var e=null,f;if((f=a.indexOf("://"))>0){for(var e=a,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,k=this.comments,l=this._binarySearch(k,e,!0);l<k.length;l++){if(k[l].start>=f)break;j=k[l].start;var m=k[l].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=m}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,i;if(c.start===c.end&&(i=d.getCaretOffset())>0)i-=1,a.getBaseModel&&(i=a.mapOffset(i),a=a.getBaseModel()),a=this._findMatchingBracket(a,i),a!==-1&&(h=[k.AnnotationType.createAnnotation(k.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,a+1),k.AnnotationType.createAnnotation(k.AnnotationType.ANNOTATION_CURRENT_BRACKET,i,i+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,i=f.getLineStart(f.getLineAtOffset(b)),j=this._binarySearch(this.comments,i,!0),l=this._binarySearch(this.comments,
+c,!1,j-1,h);j<h&&this.comments[j].start<=i&&i<this.comments[j].end?(i=this.comments[j].start,i>b&&(i+=d)):i=j===h&&h>0&&g-d===this.comments[h-1].end?this.comments[h-1].start:i;var m;l<h?(m=this.comments[l].end,m>b&&(m+=d),l+=1):(l=h,m=g);for(var n,g=this._findComments(f.getText(i,m),i),h=j;h<this.comments.length;h++)n=this.comments[h],n.start>b&&(n.start+=d),n.start>b&&(n.end+=d);var o=l-j!==g.length;if(!o)for(h=0;h<g.length;h++){n=this.comments[j+h];var p=g[h];if(n.start!==p.start||n.end!==p.end||
+n.type!==p.type){o=!0;break}}h=[j,l-j].concat(g);Array.prototype.splice.apply(this.comments,h);o&&(h=i,n=m,a!==f&&(h=a.mapOffset(h,!0),n=a.mapOffset(n,!0)),e.redrawRange(h,n));if(this.foldingEnabled&&f!==a&&this.annotationModel){e=this.annotationModel;j=e.getAnnotations(i,m);i=[];for(m=[];j.hasNext();)if(n=j.next(),n.type===k.AnnotationType.ANNOTATION_FOLDING){m.push(n);for(h=0;h<g.length;h++)if(n.start===g[h].start&&n.end===g[h].end)break;h===g.length?(i.push(n),n.expand()):(h=n.start,l=n.end,h>
+b&&(h-=d),l>b&&(l-=d),h<=b&&b<l&&h<=c&&c<l&&(h=f.getLineAtOffset(n.start),l=f.getLineAtOffset(n.end),h!==l?n.expanded||(n.expand(),e.modifyAnnotation(n)):e.removeAnnotation(n)))}b=[];for(h=0;h<g.length;h++){n=g[h];for(d=0;d<m.length;d++)if(m[d].start===n.start&&m[d].end===n.end)break;d===m.length&&(n=this._createFoldingAnnotation(a,f,n.start,n.end))&&b.push(n)}e.replaceAnnotations(i,b)}}};return{TextStyler:h}});
+define("orion/editor/edit","orion/editor/textView,orion/editor/textModel,orion/editor/textTheme,orion/editor/projectionTextModel,orion/editor/eventTarget,orion/keyBinding,orion/editor/rulers,orion/editor/annotations,orion/editor/tooltip,orion/editor/undoStack,orion/editor/textDND,orion/editor/editor,orion/editor/editorFeatures,orion/editor/contentAssist,orion/editor/cssContentAssist,orion/editor/htmlContentAssist,orion/editor/jsTemplateContentAssist,orion/editor/AsyncStyler,orion/editor/mirror,orion/editor/textMateStyler,orion/editor/htmlGrammar,examples/editor/textStyler".split(","),function(k,
+p,o,e,b,d,h,j,f,a,c,i,m,n,l,r,q,v,u,g,t,x){function s(a){var b=a.firstChild;if(b&&b.tagName==="TEXTAREA")return b.value;var c=a.ownerDocument,d=c.defaultView||c.parentWindow,e;if(!(e=!d.getSelection)){if(!(b=a.childNodes.length===1&&b.nodeType===Node.TEXT_NODE)){for(var f,b=a;b&&b!==c&&f!=="none";)f=d.getComputedStyle?d.getComputedStyle(b,null).getPropertyValue("display"):b.currentStyle.display,b=b.parentNode;b=f==="none"}e=b}if(e)return a.innerText||a.textContent;c=c.createRange();c.selectNode(a);
+a=d.getSelection();d=[];for(f=0;f<a.rangeCount;f++)d.push(a.getRangeAt(f));a.removeAllRanges();a.addRange(c);c=a.toString();a.removeAllRanges();for(f=0;f<d.length;f++)a.addRange(d[f]);return c}function B(a){if(a.substring(0,12)==="data-editor-")return a=a.substring(12),a=a.replace(/-([a-z])/ig,function(a,b){return b.toUpperCase()})}function G(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}function K(a,b){var c={};G(c,b);for(var d,e=0,f=a.attributes,g=f.length;e<g;e++){d=f.item(e);var h=B(d.nodeName);
+if(h){d=d.nodeValue;if(d==="true"||d==="false")d=d==="true";c[h]=d}}return c}function L(a){var b=a.ownerDocument,b=b.defaultView||b.parentWindow,c;if(b.getComputedStyle)c=b.getComputedStyle(a,null).getPropertyValue("height");else if(a.currentStyle)c=a.currentStyle.height;return parseInt(c,10)||0}function H(a){var b=a.parent;b||(b="editor");typeof b==="string"&&(b=(a.document||document).getElementById(b));if(!b&&a.className){var c=(a.document||document).getElementsByClassName(a.className);if(c){a.className=
+void 0;for(var d=[],f=0;f<c.length;f++)a.parent=c[f],d.push(H(a));return d}}if(!b)throw"no parent";a=K(b,a);if(typeof a.theme==="string"){var c=o.TextTheme.getTheme(a.theme),f=a.theme.lastIndexOf("/"),h=a.theme;f!==-1&&(h=h.substring(f+1));h.substring(h.length-4)===".css"&&(h=h.substring(0,h.length-4));c.setThemeClass(h,{href:a.theme});a.theme=c}var j;a.readonly||(d={createContentAssistMode:function(a){j=new n.ContentAssist(a.getTextView());a=new n.ContentAssistWidget(j);a=new n.ContentAssistMode(j,
+a);j.setMode(a);return a}});d=new i.Editor({textViewFactory:function(){return new k.TextView({parent:b,model:new e.ProjectionTextModel(new p.TextModel("")),tabSize:a.tabSize?a.tabSize:4,readonly:a.readonly,fullSelection:a.fullSelection,tabMode:a.tabMode,expandTab:a.expandTab,themeClass:a.themeClass,theme:a.theme,wrapMode:a.wrapMode})},undoStackFactory:new m.UndoFactory,annotationFactory:new m.AnnotationFactory,lineNumberRulerFactory:new m.LineNumberRulerFactory,foldingRulerFactory:new m.FoldingRulerFactory,
+textDNDFactory:new m.TextDNDFactory,contentAssistFactory:d,keyBindingFactory:new m.KeyBindingsFactory,statusReporter:a.statusReporter,domNode:b});c=a.contents;c===void 0&&(c=s(b));c||(c="");d.installTextView();d.setLineNumberRulerVisible(a.showLinesRuler===void 0||a.showLinesRuler);d.setAnnotationRulerVisible(a.showAnnotationRuler===void 0||a.showFoldingRuler);d.setOverviewRulerVisible(a.showOverviewRuler===void 0||a.showOverviewRuler);d.setFoldingRulerVisible(a.showFoldingRuler===void 0||a.showFoldingRuler);
+d.setInput(a.title,null,c);({styler:null,highlight:function(b,c){if(this.styler)this.styler.destroy(),this.styler=null;if(b){var d=c.getTextView(),e=c.getAnnotationModel();switch(b){case "js":case "java":case "css":this.styler=new x.TextStyler(d,b,e);c.setFoldingRulerVisible(a.showFoldingRuler===void 0||a.showFoldingRuler);break;case "html":this.styler=new g.TextMateStyler(d,new t.HtmlGrammar)}}}}).highlight(a.lang,d);if(j){var r=new l.CssContentAssistProvider,u=new q.JSTemplateContentAssistProvider;
+j.addEventListener("Activating",function(){/css$/.test(a.lang)?j.setProviders([r]):/js$/.test(a.lang)&&j.setProviders([u])})}if(L(b)<=50)c=d.getTextView().computeSize().height,b.style.height=c+"px";return d}var I=this.orion?this.orion.editor:void 0;if(I)for(var E=0;E<arguments.length;E++)G(I,arguments[E]);return H});var orion=this.orion||(this.orion={}),editor=orion.editor||(orion.editor={});editor.edit=require("orion/editor/edit"); \ No newline at end of file
diff --git a/bundles/org.eclipse.e4.tools.orion.css.editor/web/css.html b/bundles/org.eclipse.e4.tools.orion.css.editor/web/css.html
new file mode 100644
index 00000000..84555880
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.orion.css.editor/web/css.html
@@ -0,0 +1,17 @@
+<html>
+<head>
+<link rel="stylesheet" type="text/css" href="%s"/>
+<script src="%s"></script>
+<script>
+ require(["orion/editor/edit"], function(edit) {
+ window.editor = edit({className: "editor"})[0];
+ });
+</script>
+</head>
+<body>
+<h2>Sample CSS Editor</h2>
+<pre id="regulus" class="editor" data-editor-lang="css">
+%s
+</pre>
+</body>
+</html>
diff --git a/bundles/org.eclipse.e4.tools.orion.css.editor/web/orion.editor.txt b/bundles/org.eclipse.e4.tools.orion.css.editor/web/orion.editor.txt
new file mode 100644
index 00000000..aeda29e0
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.orion.css.editor/web/orion.editor.txt
@@ -0,0 +1,3 @@
+The current built-editor.css and built-editor.min.js
+are from orion 3.0 build I20130613-2230.
+

Back to the top