Merging latest changes from main line canvas
authorAnton Epple <toni.epple@eppleton.de>
Tue, 11 Feb 2014 13:31:42 +0100
branchcanvas
changeset 14396c04b26f9a9a
parent 1438 03cd1b3e2e70
parent 1437 3ec3ae9699ef
child 1440 c943709738df
Merging latest changes from main line
dew/nbactions.xml
dew/pom.xml
dew/src/main/java/org/apidesign/bck2brwsr/dew/Compile.java
dew/src/main/java/org/apidesign/bck2brwsr/dew/Dew.java
dew/src/main/java/org/apidesign/bck2brwsr/dew/DewLauncher.java
dew/src/main/resources/org/apidesign/bck2brwsr/dew/css/app.css
dew/src/main/resources/org/apidesign/bck2brwsr/dew/css/bootstrap-combined.min.css
dew/src/main/resources/org/apidesign/bck2brwsr/dew/img/error.png
dew/src/main/resources/org/apidesign/bck2brwsr/dew/img/glyphicons-halflings-white.png
dew/src/main/resources/org/apidesign/bck2brwsr/dew/img/glyphicons-halflings.png
dew/src/main/resources/org/apidesign/bck2brwsr/dew/img/html5.png
dew/src/main/resources/org/apidesign/bck2brwsr/dew/img/java.png
dew/src/main/resources/org/apidesign/bck2brwsr/dew/index.html
dew/src/main/resources/org/apidesign/bck2brwsr/dew/js/angular/angular.min.js
dew/src/main/resources/org/apidesign/bck2brwsr/dew/js/app.js
dew/src/main/resources/org/apidesign/bck2brwsr/dew/js/codemirror/codemirror.css
dew/src/main/resources/org/apidesign/bck2brwsr/dew/js/codemirror/codemirror.js
dew/src/main/resources/org/apidesign/bck2brwsr/dew/js/codemirror/mode/clike.js
dew/src/main/resources/org/apidesign/bck2brwsr/dew/js/codemirror/mode/xml.js
dew/src/main/resources/org/apidesign/bck2brwsr/dew/js/codemirror/theme/elegant.css
dew/src/test/java/org/apidesign/bck2brwsr/dew/CompileTest.java
ide/editor/pom.xml
ide/editor/src/main/java/org/apidesign/bck2brwsr/ide/editor/JNIHelper.java
ide/editor/src/main/java/org/apidesign/bck2brwsr/ide/editor/JSEmbeddingProvider.java
ide/editor/src/main/java/org/apidesign/bck2brwsr/ide/editor/JSNI2JavaScriptBody.java
ide/editor/src/main/java/org/apidesign/bck2brwsr/ide/editor/JsniCommentTokenizer.java
ide/editor/src/main/java/org/apidesign/bck2brwsr/ide/editor/ManglingSink.java
ide/editor/src/main/nbm/manifest.mf
ide/editor/src/main/resources/org/netbeans/modules/jackpot30/test/hints/Bundle.properties
ide/editor/src/test/java/org/apidesign/bck2brwsr/ide/editor/DejsniReaderTest.java
ide/editor/src/test/java/org/apidesign/bck2brwsr/ide/editor/JSNI2JavaScriptBodyTest.java
ide/editor/src/test/java/org/apidesign/bck2brwsr/ide/editor/JsniCommentTokenizerTest.java
ide/editor/src/test/java/org/apidesign/bck2brwsr/ide/editor/ManglingSinkTest.java
ide/pom.xml
javaquery/api/pom.xml
javaquery/demo-twitter/bck2brwsr-assembly.xml
javaquery/demo-twitter/nb-configuration.xml
javaquery/demo-twitter/nbactions.xml
javaquery/demo-twitter/pom.xml
javaquery/demo-twitter/src/main/java/org/apidesign/bck2brwsr/demo/twitter/TwitterClient.java
javaquery/demo-twitter/src/main/resources/org/apidesign/bck2brwsr/demo/twitter/index.html
javaquery/demo-twitter/src/main/resources/org/apidesign/bck2brwsr/demo/twitter/twitterExample.css
javaquery/demo-twitter/src/test/java/org/apidesign/bck2brwsr/demo/twitter/TwitterClientTest.java
javaquery/demo-twitter/src/test/java/org/apidesign/bck2brwsr/demo/twitter/TwitterProtocolTest.java
javaquery/pom.xml
ko/bck2brwsr/src/main/java/org/apidesign/bck2brwsr/ko2brwsr/BrwsrCtxImpl.java
ko/bck2brwsr/src/main/java/org/apidesign/bck2brwsr/ko2brwsr/BrwsrCtxPrvdr.java
ko/bck2brwsr/src/main/java/org/apidesign/bck2brwsr/ko2brwsr/ConvertTypes.java
ko/bck2brwsr/src/main/java/org/apidesign/bck2brwsr/ko2brwsr/Knockout.java
ko/bck2brwsr/src/main/java/org/apidesign/bck2brwsr/ko2brwsr/LoadWS.java
ko/bck2brwsr/src/main/resources/org/apidesign/bck2brwsr/htmlpage/knockout-2.2.1.js
launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/fximpl/Run.java
pom.xml
rt/emul/compact/src/main/java/java/lang/System.java
     1.1 --- a/.hgtags	Tue Feb 11 10:48:24 2014 +0100
     1.2 +++ b/.hgtags	Tue Feb 11 13:31:42 2014 +0100
     1.3 @@ -11,3 +11,4 @@
     1.4  23572dc719bd630817d11eaabdee4565f63ef8e1 release-0.7.1
     1.5  56abd247f421febd8b2c5e59d666968692e11555 release-0.7.2
     1.6  a83e16b8b825399bb21461e578c32d86982e4ed3 release-0.8
     1.7 +1b30bba2b38db83c7a232039cfd2eaf7e0e25f3f release-0.8.1
     2.1 --- a/dew/nbactions.xml	Tue Feb 11 10:48:24 2014 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,52 +0,0 @@
     2.4 -<?xml version="1.0" encoding="UTF-8"?>
     2.5 -<!--
     2.6 -
     2.7 -    Back 2 Browser Bytecode Translator
     2.8 -    Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     2.9 -
    2.10 -    This program is free software: you can redistribute it and/or modify
    2.11 -    it under the terms of the GNU General Public License as published by
    2.12 -    the Free Software Foundation, version 2 of the License.
    2.13 -
    2.14 -    This program is distributed in the hope that it will be useful,
    2.15 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.16 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2.17 -    GNU General Public License for more details.
    2.18 -
    2.19 -    You should have received a copy of the GNU General Public License
    2.20 -    along with this program. Look for COPYING file in the top folder.
    2.21 -    If not, see http://opensource.org/licenses/GPL-2.0.
    2.22 -
    2.23 --->
    2.24 -<actions>
    2.25 -        <action>
    2.26 -            <actionName>run</actionName>
    2.27 -            <goals>
    2.28 -                <goal>process-classes</goal>
    2.29 -                <goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
    2.30 -            </goals>
    2.31 -        </action>
    2.32 -        <action>
    2.33 -            <actionName>debug</actionName>
    2.34 -            <goals>
    2.35 -                <goal>process-classes</goal>
    2.36 -                <goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
    2.37 -            </goals>
    2.38 -            <properties>
    2.39 -                <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath org.apidesign.bck2brwsr.dew.Dew</exec.args>
    2.40 -                <exec.executable>java</exec.executable>
    2.41 -                <jpda.listen>true</jpda.listen>
    2.42 -            </properties>
    2.43 -        </action>
    2.44 -        <action>
    2.45 -            <actionName>profile</actionName>
    2.46 -            <goals>
    2.47 -                <goal>process-classes</goal>
    2.48 -                <goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
    2.49 -            </goals>
    2.50 -            <properties>
    2.51 -                <exec.args>${profiler.args} -classpath %classpath org.apidesign.bck2brwsr.dew.Dew</exec.args>
    2.52 -                <exec.executable>${profiler.java}</exec.executable>
    2.53 -            </properties>
    2.54 -        </action>
    2.55 -    </actions>
     3.1 --- a/dew/pom.xml	Tue Feb 11 10:48:24 2014 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,91 +0,0 @@
     3.4 -<?xml version="1.0"?>
     3.5 -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     3.6 -  <modelVersion>4.0.0</modelVersion>
     3.7 -  <parent>
     3.8 -    <groupId>org.apidesign</groupId>
     3.9 -    <artifactId>bck2brwsr</artifactId>
    3.10 -    <version>0.9-SNAPSHOT</version>
    3.11 -  </parent>
    3.12 -  <groupId>org.apidesign.bck2brwsr</groupId>
    3.13 -  <artifactId>dew</artifactId>
    3.14 -  <version>0.9-SNAPSHOT</version>
    3.15 -  <name>Development Environment for Web</name>
    3.16 -  <url>http://maven.apache.org</url>
    3.17 -    <build>
    3.18 -        <plugins>
    3.19 -            <plugin>
    3.20 -                <groupId>org.apache.maven.plugins</groupId>
    3.21 -                <artifactId>maven-compiler-plugin</artifactId>
    3.22 -                <version>2.3.2</version>
    3.23 -                <configuration>
    3.24 -                    <source>1.7</source>
    3.25 -                    <target>1.7</target>
    3.26 -                </configuration>
    3.27 -            </plugin>
    3.28 -            <plugin>
    3.29 -                <groupId>org.codehaus.mojo</groupId>
    3.30 -                <artifactId>exec-maven-plugin</artifactId>
    3.31 -                <version>1.2.1</version>
    3.32 -                <executions>
    3.33 -                    <execution>
    3.34 -                        <goals>
    3.35 -                            <goal>exec</goal>
    3.36 -                        </goals>
    3.37 -                    </execution>
    3.38 -                </executions>
    3.39 -                <configuration>
    3.40 -                    <executable>java</executable>
    3.41 -                     <arguments>
    3.42 -                        <argument>-classpath</argument>
    3.43 -                        <classpath />
    3.44 -                        <argument>org.apidesign.bck2brwsr.dew.Dew</argument>
    3.45 -                    </arguments>
    3.46 -                </configuration>
    3.47 -            </plugin>
    3.48 -            <plugin>
    3.49 -                <groupId>org.apache.maven.plugins</groupId>
    3.50 -                <artifactId>maven-deploy-plugin</artifactId>
    3.51 -                <version>2.7</version>
    3.52 -                <configuration>
    3.53 -                    <skip>true</skip>
    3.54 -                </configuration>
    3.55 -            </plugin>      
    3.56 -        </plugins>
    3.57 -    </build>
    3.58 -    <properties>
    3.59 -    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    3.60 -  </properties>
    3.61 -  <dependencies>
    3.62 -    <dependency>
    3.63 -      <groupId>org.glassfish.grizzly</groupId>
    3.64 -      <artifactId>grizzly-http-server</artifactId>
    3.65 -      <version>2.2.19</version>
    3.66 -    </dependency>
    3.67 -    <dependency>
    3.68 -      <groupId>${project.groupId}</groupId>
    3.69 -      <artifactId>vm4brwsr</artifactId>
    3.70 -      <version>${project.version}</version>
    3.71 -    </dependency>
    3.72 -    <dependency>
    3.73 -      <groupId>org.json</groupId>
    3.74 -      <artifactId>json</artifactId>
    3.75 -      <version>20090211</version>
    3.76 -    </dependency>
    3.77 -    <dependency>
    3.78 -      <groupId>org.testng</groupId>
    3.79 -      <artifactId>testng</artifactId>
    3.80 -      <scope>test</scope>
    3.81 -      <exclusions>
    3.82 -        <exclusion>
    3.83 -          <artifactId>junit</artifactId>
    3.84 -          <groupId>junit</groupId>
    3.85 -        </exclusion>
    3.86 -      </exclusions>
    3.87 -    </dependency>
    3.88 -    <dependency>
    3.89 -      <groupId>${project.groupId}</groupId>
    3.90 -      <artifactId>javaquery.api</artifactId>
    3.91 -      <version>${project.version}</version>
    3.92 -    </dependency>
    3.93 -  </dependencies>
    3.94 -</project>
     4.1 --- a/dew/src/main/java/org/apidesign/bck2brwsr/dew/Compile.java	Tue Feb 11 10:48:24 2014 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,203 +0,0 @@
     4.4 -/**
     4.5 - * Back 2 Browser Bytecode Translator
     4.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     4.7 - *
     4.8 - * This program is free software: you can redistribute it and/or modify
     4.9 - * it under the terms of the GNU General Public License as published by
    4.10 - * the Free Software Foundation, version 2 of the License.
    4.11 - *
    4.12 - * This program is distributed in the hope that it will be useful,
    4.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4.15 - * GNU General Public License for more details.
    4.16 - *
    4.17 - * You should have received a copy of the GNU General Public License
    4.18 - * along with this program. Look for COPYING file in the top folder.
    4.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    4.20 - */
    4.21 -package org.apidesign.bck2brwsr.dew;
    4.22 -
    4.23 -import java.io.ByteArrayInputStream;
    4.24 -import java.io.ByteArrayOutputStream;
    4.25 -import java.io.IOException;
    4.26 -import java.io.InputStream;
    4.27 -import java.io.OutputStream;
    4.28 -import java.net.URI;
    4.29 -import java.net.URISyntaxException;
    4.30 -import java.util.ArrayList;
    4.31 -import java.util.Arrays;
    4.32 -import java.util.HashMap;
    4.33 -import java.util.List;
    4.34 -import java.util.Map;
    4.35 -import java.util.regex.Matcher;
    4.36 -import java.util.regex.Pattern;
    4.37 -import javax.tools.Diagnostic;
    4.38 -import javax.tools.DiagnosticListener;
    4.39 -import javax.tools.FileObject;
    4.40 -import javax.tools.ForwardingJavaFileManager;
    4.41 -import javax.tools.JavaFileManager;
    4.42 -import javax.tools.JavaFileObject;
    4.43 -import javax.tools.JavaFileObject.Kind;
    4.44 -import javax.tools.SimpleJavaFileObject;
    4.45 -import javax.tools.StandardJavaFileManager;
    4.46 -import javax.tools.StandardLocation;
    4.47 -import javax.tools.ToolProvider;
    4.48 -
    4.49 -/**
    4.50 - *
    4.51 - * @author Jaroslav Tulach <jtulach@netbeans.org>
    4.52 - */
    4.53 -final class Compile implements DiagnosticListener<JavaFileObject> {
    4.54 -    private final List<Diagnostic<? extends JavaFileObject>> errors = new ArrayList<>();
    4.55 -    private final Map<String, byte[]> classes;
    4.56 -    private final String pkg;
    4.57 -    private final String cls;
    4.58 -    private final String html;
    4.59 -
    4.60 -    private Compile(String html, String code) throws IOException {
    4.61 -        this.pkg = findPkg(code);
    4.62 -        this.cls = findCls(code);
    4.63 -        this.html = html;
    4.64 -        classes = compile(html, code);
    4.65 -    }
    4.66 -
    4.67 -    /** Performs compilation of given HTML page and associated Java code
    4.68 -     */
    4.69 -    public static Compile create(String html, String code) throws IOException {
    4.70 -        return new Compile(html, code);
    4.71 -    }
    4.72 -    
    4.73 -    /** Checks for given class among compiled resources */
    4.74 -    public byte[] get(String res) {
    4.75 -        return classes.get(res);
    4.76 -    }
    4.77 -    
    4.78 -    /** Obtains errors created during compilation.
    4.79 -     */
    4.80 -    public List<Diagnostic<? extends JavaFileObject>> getErrors() {
    4.81 -        List<Diagnostic<? extends JavaFileObject>> err = new ArrayList<>();
    4.82 -        for (Diagnostic<? extends JavaFileObject> diagnostic : errors) {
    4.83 -            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
    4.84 -                err.add(diagnostic);
    4.85 -            }
    4.86 -        }
    4.87 -        return err;
    4.88 -    }
    4.89 -    
    4.90 -    private Map<String, byte[]> compile(final String html, final String code) throws IOException {
    4.91 -        StandardJavaFileManager sjfm = ToolProvider.getSystemJavaCompiler().getStandardFileManager(this, null, null);
    4.92 -
    4.93 -        final Map<String, ByteArrayOutputStream> class2BAOS = new HashMap<>();
    4.94 -
    4.95 -        JavaFileObject file = new SimpleJavaFileObject(URI.create("mem://mem"), Kind.SOURCE) {
    4.96 -            @Override
    4.97 -            public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
    4.98 -                return code;
    4.99 -            }
   4.100 -        };
   4.101 -        final JavaFileObject htmlFile = new SimpleJavaFileObject(URI.create("mem://mem2"), Kind.OTHER) {
   4.102 -            @Override
   4.103 -            public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
   4.104 -                return html;
   4.105 -            }
   4.106 -
   4.107 -            @Override
   4.108 -            public InputStream openInputStream() throws IOException {
   4.109 -                return new ByteArrayInputStream(html.getBytes());
   4.110 -            }
   4.111 -        };
   4.112 -        
   4.113 -        final URI scratch;
   4.114 -        try {
   4.115 -            scratch = new URI("mem://mem3");
   4.116 -        } catch (URISyntaxException ex) {
   4.117 -            throw new IOException(ex);
   4.118 -        }
   4.119 -        
   4.120 -        JavaFileManager jfm = new ForwardingJavaFileManager<JavaFileManager>(sjfm) {
   4.121 -            @Override
   4.122 -            public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling) throws IOException {
   4.123 -                if (kind  == Kind.CLASS) {
   4.124 -                    final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
   4.125 -
   4.126 -                    class2BAOS.put(className.replace('.', '/') + ".class", buffer);
   4.127 -                    return new SimpleJavaFileObject(sibling.toUri(), kind) {
   4.128 -                        @Override
   4.129 -                        public OutputStream openOutputStream() throws IOException {
   4.130 -                            return buffer;
   4.131 -                        }
   4.132 -                    };
   4.133 -                }
   4.134 -                
   4.135 -                if (kind == Kind.SOURCE) {
   4.136 -                    return new SimpleJavaFileObject(scratch/*sibling.toUri()*/, kind) {
   4.137 -                        private final ByteArrayOutputStream data = new ByteArrayOutputStream();
   4.138 -                        @Override
   4.139 -                        public OutputStream openOutputStream() throws IOException {
   4.140 -                            return data;
   4.141 -                        }
   4.142 -
   4.143 -                        @Override
   4.144 -                        public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
   4.145 -                            data.close();
   4.146 -                            return new String(data.toByteArray());
   4.147 -                        }
   4.148 -                    };
   4.149 -                }
   4.150 -                
   4.151 -                throw new IllegalStateException();
   4.152 -            }
   4.153 -
   4.154 -            @Override
   4.155 -            public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException {
   4.156 -                if (location == StandardLocation.SOURCE_PATH) {
   4.157 -                    if (packageName.equals(pkg)) {
   4.158 -                        return htmlFile;
   4.159 -                    }
   4.160 -                }
   4.161 -                
   4.162 -                return null;
   4.163 -            }
   4.164 -            
   4.165 -        };
   4.166 -
   4.167 -        ToolProvider.getSystemJavaCompiler().getTask(null, jfm, this, /*XXX:*/Arrays.asList("-source", "1.7", "-target", "1.7"), null, Arrays.asList(file)).call();
   4.168 -
   4.169 -        Map<String, byte[]> result = new HashMap<>();
   4.170 -
   4.171 -        for (Map.Entry<String, ByteArrayOutputStream> e : class2BAOS.entrySet()) {
   4.172 -            result.put(e.getKey(), e.getValue().toByteArray());
   4.173 -        }
   4.174 -
   4.175 -        return result;
   4.176 -    }
   4.177 -
   4.178 -
   4.179 -    @Override
   4.180 -    public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
   4.181 -        errors.add(diagnostic);
   4.182 -    }
   4.183 -    private static String findPkg(String java) throws IOException {
   4.184 -        Pattern p = Pattern.compile("package\\p{javaWhitespace}*([\\p{Alnum}\\.]+)\\p{javaWhitespace}*;", Pattern.MULTILINE);
   4.185 -        Matcher m = p.matcher(java);
   4.186 -        if (!m.find()) {
   4.187 -            throw new IOException("Can't find package declaration in the java file");
   4.188 -        }
   4.189 -        String pkg = m.group(1);
   4.190 -        return pkg;
   4.191 -    }
   4.192 -    private static String findCls(String java) throws IOException {
   4.193 -        Pattern p = Pattern.compile("class\\p{javaWhitespace}*([\\p{Alnum}\\.]+)\\p{javaWhitespace}", Pattern.MULTILINE);
   4.194 -        Matcher m = p.matcher(java);
   4.195 -        if (!m.find()) {
   4.196 -            throw new IOException("Can't find package declaration in the java file");
   4.197 -        }
   4.198 -        String cls = m.group(1);
   4.199 -        return cls;
   4.200 -    }
   4.201 -
   4.202 -    String getHtml() {
   4.203 -        String fqn = "'" + pkg + '.' + cls + "'";
   4.204 -        return html.replace("'${fqn}'", fqn);
   4.205 -    }
   4.206 -}
     5.1 --- a/dew/src/main/java/org/apidesign/bck2brwsr/dew/Dew.java	Tue Feb 11 10:48:24 2014 +0100
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,138 +0,0 @@
     5.4 -/**
     5.5 - * Back 2 Browser Bytecode Translator
     5.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     5.7 - *
     5.8 - * This program is free software: you can redistribute it and/or modify
     5.9 - * it under the terms of the GNU General Public License as published by
    5.10 - * the Free Software Foundation, version 2 of the License.
    5.11 - *
    5.12 - * This program is distributed in the hope that it will be useful,
    5.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5.15 - * GNU General Public License for more details.
    5.16 - *
    5.17 - * You should have received a copy of the GNU General Public License
    5.18 - * along with this program. Look for COPYING file in the top folder.
    5.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    5.20 - */
    5.21 -package org.apidesign.bck2brwsr.dew;
    5.22 -
    5.23 -import java.io.ByteArrayInputStream;
    5.24 -import java.io.IOException;
    5.25 -import java.io.InputStream;
    5.26 -import java.io.InputStreamReader;
    5.27 -import java.io.OutputStream;
    5.28 -import java.util.List;
    5.29 -import java.util.Locale;
    5.30 -import javax.tools.Diagnostic;
    5.31 -import javax.tools.JavaFileObject;
    5.32 -import org.apidesign.vm4brwsr.Bck2Brwsr;
    5.33 -import org.glassfish.grizzly.http.Method;
    5.34 -import org.glassfish.grizzly.http.server.HttpHandler;
    5.35 -import org.glassfish.grizzly.http.server.HttpServer;
    5.36 -import org.glassfish.grizzly.http.server.Request;
    5.37 -import org.glassfish.grizzly.http.server.Response;
    5.38 -import org.glassfish.grizzly.http.util.HttpStatus;
    5.39 -import org.json.JSONArray;
    5.40 -import org.json.JSONObject;
    5.41 -import org.json.JSONTokener;
    5.42 -
    5.43 -/**
    5.44 - *
    5.45 - * @author phrebejk
    5.46 - */
    5.47 -final class Dew extends HttpHandler implements Bck2Brwsr.Resources {
    5.48 -    private Compile data;
    5.49 -
    5.50 -    public static void main(String... args) throws Exception {
    5.51 -        DewLauncher l = new DewLauncher(null);
    5.52 -        l.addClassLoader(DewLauncher.class.getClassLoader());
    5.53 -        final Dew dew = new Dew();
    5.54 -        HttpServer s = l.initServer(dew);
    5.55 -        s.getServerConfiguration().addHttpHandler(dew, "/dew/");
    5.56 -        l.launchServerAndBrwsr(s, "/dew/");
    5.57 -        System.in.read();
    5.58 -    }
    5.59 -    
    5.60 -    @Override
    5.61 -    public void service(Request request, Response response) throws Exception {
    5.62 -        
    5.63 -        if ( request.getMethod() == Method.POST ) {
    5.64 -            InputStream is = request.getInputStream();
    5.65 -            JSONTokener tok = new JSONTokener(new InputStreamReader(is));
    5.66 -            JSONObject obj = new JSONObject(tok);
    5.67 -            String tmpHtml = obj.getString("html");
    5.68 -            String tmpJava = obj.getString("java");
    5.69 -            
    5.70 -            Compile res = Compile.create(tmpHtml, tmpJava);
    5.71 -            List<Diagnostic<? extends JavaFileObject>> err = res.getErrors();
    5.72 -            if (err.isEmpty()) {
    5.73 -                data = res;
    5.74 -                response.getOutputStream().write("[]".getBytes());
    5.75 -                response.setStatus(HttpStatus.OK_200);
    5.76 -            } else {
    5.77 -                
    5.78 -                JSONArray errors = new JSONArray();
    5.79 -                
    5.80 -                for (Diagnostic<? extends JavaFileObject> d : err) {
    5.81 -                    JSONObject e = new JSONObject();
    5.82 -                    e.put("col", d.getColumnNumber());
    5.83 -                    e.put("line", d.getLineNumber());
    5.84 -                    e.put("kind", d.getKind().toString());
    5.85 -                    e.put("msg", d.getMessage(Locale.ENGLISH));
    5.86 -                    errors.put(e);
    5.87 -                }
    5.88 -                
    5.89 -                errors.write(response.getWriter());                
    5.90 -                response.setStatus(HttpStatus.PRECONDITION_FAILED_412);
    5.91 -            }
    5.92 -            
    5.93 -            return;
    5.94 -        }
    5.95 -        
    5.96 -        String r = request.getHttpHandlerPath();
    5.97 -        if (r == null || r.equals("/")) {
    5.98 -            r = "index.html";
    5.99 -        }
   5.100 -        if (r.equals("/result.html")) {
   5.101 -            response.setContentType("text/html");
   5.102 -            if (data != null) {
   5.103 -                response.getOutputBuffer().write(data.getHtml());
   5.104 -            }
   5.105 -            response.setStatus(HttpStatus.OK_200);
   5.106 -            return;
   5.107 -        }
   5.108 -        
   5.109 -        if (r.startsWith("/")) {
   5.110 -            r = r.substring(1);
   5.111 -        }
   5.112 -        
   5.113 -        if (r.endsWith(".html") || r.endsWith(".xhtml")) {
   5.114 -            response.setContentType("text/html");
   5.115 -        }
   5.116 -        OutputStream os = response.getOutputStream();
   5.117 -        try (InputStream is = Dew.class.getResourceAsStream(r) ) {
   5.118 -            copyStream(is, os, request.getRequestURL().toString() );
   5.119 -        } catch (IOException ex) {
   5.120 -            response.setDetailMessage(ex.getLocalizedMessage());
   5.121 -            response.setError();
   5.122 -            response.setStatus(404);
   5.123 -        }
   5.124 -    }
   5.125 -    
   5.126 -    static void copyStream(InputStream is, OutputStream os, String baseURL) throws IOException {
   5.127 -        for (;;) {
   5.128 -            int ch = is.read();
   5.129 -            if (ch == -1) {
   5.130 -                break;
   5.131 -            }
   5.132 -            os.write(ch);            
   5.133 -        }
   5.134 -    }
   5.135 -
   5.136 -    @Override
   5.137 -    public InputStream get(String r) throws IOException {
   5.138 -        byte[] arr = data == null ? null : data.get(r);
   5.139 -        return arr == null ? null : new ByteArrayInputStream(arr);
   5.140 -    }
   5.141 -}
     6.1 --- a/dew/src/main/java/org/apidesign/bck2brwsr/dew/DewLauncher.java	Tue Feb 11 10:48:24 2014 +0100
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,203 +0,0 @@
     6.4 -/**
     6.5 - * Back 2 Browser Bytecode Translator
     6.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     6.7 - *
     6.8 - * This program is free software: you can redistribute it and/or modify
     6.9 - * it under the terms of the GNU General Public License as published by
    6.10 - * the Free Software Foundation, version 2 of the License.
    6.11 - *
    6.12 - * This program is distributed in the hope that it will be useful,
    6.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6.15 - * GNU General Public License for more details.
    6.16 - *
    6.17 - * You should have received a copy of the GNU General Public License
    6.18 - * along with this program. Look for COPYING file in the top folder.
    6.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    6.20 - */
    6.21 -package org.apidesign.bck2brwsr.dew;
    6.22 -
    6.23 -import java.io.IOException;
    6.24 -import java.io.InputStream;
    6.25 -import java.io.Writer;
    6.26 -import java.net.URI;
    6.27 -import java.net.URISyntaxException;
    6.28 -import java.net.URL;
    6.29 -import java.util.Arrays;
    6.30 -import java.util.Enumeration;
    6.31 -import java.util.LinkedHashSet;
    6.32 -import java.util.Set;
    6.33 -import java.util.logging.Level;
    6.34 -import java.util.logging.Logger;
    6.35 -import org.apidesign.vm4brwsr.Bck2Brwsr;
    6.36 -import org.glassfish.grizzly.PortRange;
    6.37 -import org.glassfish.grizzly.http.server.HttpHandler;
    6.38 -import org.glassfish.grizzly.http.server.HttpServer;
    6.39 -import org.glassfish.grizzly.http.server.NetworkListener;
    6.40 -import org.glassfish.grizzly.http.server.Request;
    6.41 -import org.glassfish.grizzly.http.server.Response;
    6.42 -import org.glassfish.grizzly.http.server.ServerConfiguration;
    6.43 -
    6.44 -/**
    6.45 - * Lightweight server to launch dew - the Development Environment for Web.
    6.46 - */
    6.47 -final class DewLauncher {
    6.48 -    private static final Logger LOG = Logger.getLogger(DewLauncher.class.getName());
    6.49 -    private Set<ClassLoader> loaders = new LinkedHashSet<>();
    6.50 -    private Set<Bck2Brwsr.Resources> xRes = new LinkedHashSet<>();
    6.51 -    private final Res resources = new Res();
    6.52 -    private final String cmd;
    6.53 -
    6.54 -    public DewLauncher(String cmd) {
    6.55 -        this.cmd = cmd;
    6.56 -    }
    6.57 -    
    6.58 -    public void addClassLoader(ClassLoader url) {
    6.59 -        this.loaders.add(url);
    6.60 -    }
    6.61 -
    6.62 -    final HttpServer initServer(Bck2Brwsr.Resources... extraResources) throws IOException {
    6.63 -        xRes.addAll(Arrays.asList(extraResources));
    6.64 -        
    6.65 -        HttpServer s = HttpServer.createSimpleServer(".", new PortRange(8080, 65535));
    6.66 -
    6.67 -        final ServerConfiguration conf = s.getServerConfiguration();
    6.68 -        conf.addHttpHandler(new VM(resources), "/bck2brwsr.js");
    6.69 -        conf.addHttpHandler(new VMInit(), "/vm.js");
    6.70 -        conf.addHttpHandler(new Classes(resources), "/classes/");
    6.71 -        return s;
    6.72 -    }
    6.73 -    
    6.74 -    final Object[] launchServerAndBrwsr(HttpServer server, final String page) throws IOException, URISyntaxException, InterruptedException {
    6.75 -        server.start();
    6.76 -        NetworkListener listener = server.getListeners().iterator().next();
    6.77 -        int port = listener.getPort();
    6.78 -        
    6.79 -        URI uri = new URI("http://localhost:" + port + page);
    6.80 -        LOG.log(Level.INFO, "Showing {0}", uri);
    6.81 -        if (cmd == null) {
    6.82 -            try {
    6.83 -                LOG.log(Level.INFO, "Trying Desktop.browse on {0} {2} by {1}", new Object[] {
    6.84 -                    System.getProperty("java.vm.name"),
    6.85 -                    System.getProperty("java.vm.vendor"),
    6.86 -                    System.getProperty("java.vm.version"),
    6.87 -                });
    6.88 -                java.awt.Desktop.getDesktop().browse(uri);
    6.89 -                LOG.log(Level.INFO, "Desktop.browse successfully finished");
    6.90 -                return null;
    6.91 -            } catch (UnsupportedOperationException ex) {
    6.92 -                LOG.log(Level.INFO, "Desktop.browse not supported: {0}", ex.getMessage());
    6.93 -                LOG.log(Level.FINE, null, ex);
    6.94 -            }
    6.95 -        }
    6.96 -        {
    6.97 -            String cmdName = cmd == null ? "xdg-open" : cmd;
    6.98 -            String[] cmdArr = { 
    6.99 -                cmdName, uri.toString()
   6.100 -            };
   6.101 -            LOG.log(Level.INFO, "Launching {0}", Arrays.toString(cmdArr));
   6.102 -            final Process process = Runtime.getRuntime().exec(cmdArr);
   6.103 -            return new Object[] { process, null };
   6.104 -        }
   6.105 -    }
   6.106 -
   6.107 -    private class Res implements Bck2Brwsr.Resources {
   6.108 -        @Override
   6.109 -        public InputStream get(String resource) throws IOException {
   6.110 -            for (ClassLoader l : loaders) {
   6.111 -                URL u = null;
   6.112 -                Enumeration<URL> en = l.getResources(resource);
   6.113 -                while (en.hasMoreElements()) {
   6.114 -                    u = en.nextElement();
   6.115 -                }
   6.116 -                if (u != null) {
   6.117 -                    return u.openStream();
   6.118 -                }
   6.119 -            }
   6.120 -            for (Bck2Brwsr.Resources r : xRes) {
   6.121 -                InputStream is = r.get(resource);
   6.122 -                if (is != null) {
   6.123 -                    return is;
   6.124 -                }
   6.125 -            }
   6.126 -            throw new IOException("Can't find " + resource);
   6.127 -        }
   6.128 -    }
   6.129 -
   6.130 -    private static class VM extends HttpHandler {
   6.131 -        private final String bck2brwsr;
   6.132 -
   6.133 -        public VM(Res loader) throws IOException {
   6.134 -            StringBuilder sb = new StringBuilder();
   6.135 -            Bck2Brwsr.generate(sb, loader);
   6.136 -            this.bck2brwsr = sb.toString();
   6.137 -        }
   6.138 -
   6.139 -        @Override
   6.140 -        public void service(Request request, Response response) throws Exception {
   6.141 -            response.setCharacterEncoding("UTF-8");
   6.142 -            response.setContentType("text/javascript");
   6.143 -            response.getWriter().write(bck2brwsr);
   6.144 -        }
   6.145 -    }
   6.146 -    private static class VMInit extends HttpHandler {
   6.147 -        public VMInit() {
   6.148 -        }
   6.149 -
   6.150 -        @Override
   6.151 -        public void service(Request request, Response response) throws Exception {
   6.152 -            response.setCharacterEncoding("UTF-8");
   6.153 -            response.setContentType("text/javascript");
   6.154 -            response.getWriter().append(
   6.155 -                "function ldCls(res) {\n"
   6.156 -                + "  var request = new XMLHttpRequest();\n"
   6.157 -                + "  request.open('GET', '/classes/' + res, false);\n"
   6.158 -                + "  request.send();\n"
   6.159 -                + "  var arr = eval('(' + request.responseText + ')');\n"
   6.160 -                + "  return arr;\n"
   6.161 -                + "}\n"
   6.162 -                + "var vm = new bck2brwsr(ldCls);\n");
   6.163 -        }
   6.164 -    }
   6.165 -
   6.166 -    private static class Classes extends HttpHandler {
   6.167 -        private final Res loader;
   6.168 -
   6.169 -        public Classes(Res loader) {
   6.170 -            this.loader = loader;
   6.171 -        }
   6.172 -
   6.173 -        @Override
   6.174 -        public void service(Request request, Response response) throws Exception {
   6.175 -            String res = request.getHttpHandlerPath();
   6.176 -            if (res.startsWith("/")) {
   6.177 -                res = res.substring(1);
   6.178 -            }
   6.179 -            try (InputStream is = loader.get(res)) {
   6.180 -                response.setContentType("text/javascript");
   6.181 -                Writer w = response.getWriter();
   6.182 -                w.append("[");
   6.183 -                for (int i = 0;; i++) {
   6.184 -                    int b = is.read();
   6.185 -                    if (b == -1) {
   6.186 -                        break;
   6.187 -                    }
   6.188 -                    if (i > 0) {
   6.189 -                        w.append(", ");
   6.190 -                    }
   6.191 -                    if (i % 20 == 0) {
   6.192 -                        w.write("\n");
   6.193 -                    }
   6.194 -                    if (b > 127) {
   6.195 -                        b = b - 256;
   6.196 -                    }
   6.197 -                    w.append(Integer.toString(b));
   6.198 -                }
   6.199 -                w.append("\n]");
   6.200 -            } catch (IOException ex) {
   6.201 -                response.setError();
   6.202 -                response.setDetailMessage(ex.getMessage());
   6.203 -            }
   6.204 -        }
   6.205 -    }
   6.206 -}
     7.1 --- a/dew/src/main/resources/org/apidesign/bck2brwsr/dew/css/app.css	Tue Feb 11 10:48:24 2014 +0100
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,54 +0,0 @@
     7.4 -/* app css stylesheet */
     7.5 -.code-editor, .mono-font, .CodeMirror {
     7.6 -    font-family: "Inconsolata","Monaco","Consolas","Andale Mono","Bitstream Vera Sans Mono","Courier New",Courier,monospace;
     7.7 -    font-size: 13px;
     7.8 -    line-height: 15px;
     7.9 -}
    7.10 -
    7.11 -.CodeMirror {                    
    7.12 -    border: 1px solid #d9edf7;      
    7.13 -    height: 300px;
    7.14 -}
    7.15 -      
    7.16 -.CodeMirror-scroll {
    7.17 -    overflow-y: auto;
    7.18 -    overflow-x: auto;
    7.19 -}
    7.20 -
    7.21 -.error-hover:hover {
    7.22 -    text-decoration: underline;
    7.23 -    cursor: pointer;
    7.24 -} 
    7.25 -
    7.26 -.ic-html5 {
    7.27 -  display: inline-block;  
    7.28 -  height: 20px;
    7.29 -  width: 20px;
    7.30 -  vertical-align: text-bottom;
    7.31 -  background-repeat: no-repeat;  
    7.32 -  background-image: url("../img/html5.png");  
    7.33 -}
    7.34 -
    7.35 -.ic-java {
    7.36 -  display: inline-block;  
    7.37 -  height: 20px;
    7.38 -  width: 20px;
    7.39 -  vertical-align: text-bottom;
    7.40 -  background-repeat: no-repeat;  
    7.41 -  background-image: url("../img/java.png"); 
    7.42 - 
    7.43 -}
    7.44 -
    7.45 -.issues {    
    7.46 -    width: 16px;
    7.47 -}
    7.48 -
    7.49 -.issue { 
    7.50 -    height: 16px;
    7.51 -    width: 16px;
    7.52 -    vertical-align: middle;
    7.53 -    background-repeat: no-repeat;  
    7.54 -    background-image: url("../img/error.png"); 
    7.55 -    /* color: #822; */
    7.56 -}
    7.57 -
     8.1 --- a/dew/src/main/resources/org/apidesign/bck2brwsr/dew/css/bootstrap-combined.min.css	Tue Feb 11 10:48:24 2014 +0100
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,18 +0,0 @@
     8.4 -/*!
     8.5 - * Bootstrap v2.2.2
     8.6 - *
     8.7 - * Copyright 2012 Twitter, Inc
     8.8 - * Licensed under the Apache License v2.0
     8.9 - * http://www.apache.org/licenses/LICENSE-2.0
    8.10 - *
    8.11 - * Designed and built with all the love in the world @twitter by @mdo and @fat.
    8.12 - */article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}a:hover,a:active{outline:0}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{width:auto\9;height:auto;max-width:100%;vertical-align:middle;border:0;-ms-interpolation-mode:bicubic}#map_canvas img,.google-maps img{max-width:none}button,input,select,textarea{margin:0;font-size:100%;vertical-align:middle}button,input{*overflow:visible;line-height:normal}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}button,html input[type="button"],input[type="reset"],input[type="submit"]{cursor:pointer;-webkit-appearance:button}label,select,button,input[type="button"],input[type="reset"],input[type="submit"],input[type="radio"],input[type="checkbox"]{cursor:pointer}input[type="search"]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type="search"]::-webkit-search-decoration,input[type="search"]::-webkit-search-cancel-button{-webkit-appearance:none}textarea{overflow:auto;vertical-align:top}@media print{*{color:#000!important;text-shadow:none!important;background:transparent!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%!important}@page{margin:.5cm}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;line-height:0;content:""}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}body{margin:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:20px;color:#333;background-color:#fff}a{color:#08c;text-decoration:none}a:hover{color:#005580;text-decoration:underline}.img-rounded{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.img-polaroid{padding:4px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.1);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.1);box-shadow:0 1px 3px rgba(0,0,0,0.1)}.img-circle{-webkit-border-radius:500px;-moz-border-radius:500px;border-radius:500px}.row{margin-left:-20px;*zoom:1}.row:before,.row:after{display:table;line-height:0;content:""}.row:after{clear:both}[class*="span"]{float:left;min-height:1px;margin-left:20px}.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px}.span12{width:940px}.span11{width:860px}.span10{width:780px}.span9{width:700px}.span8{width:620px}.span7{width:540px}.span6{width:460px}.span5{width:380px}.span4{width:300px}.span3{width:220px}.span2{width:140px}.span1{width:60px}.offset12{margin-left:980px}.offset11{margin-left:900px}.offset10{margin-left:820px}.offset9{margin-left:740px}.offset8{margin-left:660px}.offset7{margin-left:580px}.offset6{margin-left:500px}.offset5{margin-left:420px}.offset4{margin-left:340px}.offset3{margin-left:260px}.offset2{margin-left:180px}.offset1{margin-left:100px}.row-fluid{width:100%;*zoom:1}.row-fluid:before,.row-fluid:after{display:table;line-height:0;content:""}.row-fluid:after{clear:both}.row-fluid [class*="span"]{display:block;float:left;width:100%;min-height:30px;margin-left:2.127659574468085%;*margin-left:2.074468085106383%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="span"]:first-child{margin-left:0}.row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.127659574468085%}.row-fluid .span12{width:100%;*width:99.94680851063829%}.row-fluid .span11{width:91.48936170212765%;*width:91.43617021276594%}.row-fluid .span10{width:82.97872340425532%;*width:82.92553191489361%}.row-fluid .span9{width:74.46808510638297%;*width:74.41489361702126%}.row-fluid .span8{width:65.95744680851064%;*width:65.90425531914893%}.row-fluid .span7{width:57.44680851063829%;*width:57.39361702127659%}.row-fluid .span6{width:48.93617021276595%;*width:48.88297872340425%}.row-fluid .span5{width:40.42553191489362%;*width:40.37234042553192%}.row-fluid .span4{width:31.914893617021278%;*width:31.861702127659576%}.row-fluid .span3{width:23.404255319148934%;*width:23.351063829787233%}.row-fluid .span2{width:14.893617021276595%;*width:14.840425531914894%}.row-fluid .span1{width:6.382978723404255%;*width:6.329787234042553%}.row-fluid .offset12{margin-left:104.25531914893617%;*margin-left:104.14893617021275%}.row-fluid .offset12:first-child{margin-left:102.12765957446808%;*margin-left:102.02127659574467%}.row-fluid .offset11{margin-left:95.74468085106382%;*margin-left:95.6382978723404%}.row-fluid .offset11:first-child{margin-left:93.61702127659574%;*margin-left:93.51063829787232%}.row-fluid .offset10{margin-left:87.23404255319149%;*margin-left:87.12765957446807%}.row-fluid .offset10:first-child{margin-left:85.1063829787234%;*margin-left:84.99999999999999%}.row-fluid .offset9{margin-left:78.72340425531914%;*margin-left:78.61702127659572%}.row-fluid .offset9:first-child{margin-left:76.59574468085106%;*margin-left:76.48936170212764%}.row-fluid .offset8{margin-left:70.2127659574468%;*margin-left:70.10638297872339%}.row-fluid .offset8:first-child{margin-left:68.08510638297872%;*margin-left:67.9787234042553%}.row-fluid .offset7{margin-left:61.70212765957446%;*margin-left:61.59574468085106%}.row-fluid .offset7:first-child{margin-left:59.574468085106375%;*margin-left:59.46808510638297%}.row-fluid .offset6{margin-left:53.191489361702125%;*margin-left:53.085106382978715%}.row-fluid .offset6:first-child{margin-left:51.063829787234035%;*margin-left:50.95744680851063%}.row-fluid .offset5{margin-left:44.68085106382979%;*margin-left:44.57446808510638%}.row-fluid .offset5:first-child{margin-left:42.5531914893617%;*margin-left:42.4468085106383%}.row-fluid .offset4{margin-left:36.170212765957444%;*margin-left:36.06382978723405%}.row-fluid .offset4:first-child{margin-left:34.04255319148936%;*margin-left:33.93617021276596%}.row-fluid .offset3{margin-left:27.659574468085104%;*margin-left:27.5531914893617%}.row-fluid .offset3:first-child{margin-left:25.53191489361702%;*margin-left:25.425531914893618%}.row-fluid .offset2{margin-left:19.148936170212764%;*margin-left:19.04255319148936%}.row-fluid .offset2:first-child{margin-left:17.02127659574468%;*margin-left:16.914893617021278%}.row-fluid .offset1{margin-left:10.638297872340425%;*margin-left:10.53191489361702%}.row-fluid .offset1:first-child{margin-left:8.51063829787234%;*margin-left:8.404255319148938%}[class*="span"].hide,.row-fluid [class*="span"].hide{display:none}[class*="span"].pull-right,.row-fluid [class*="span"].pull-right{float:right}.container{margin-right:auto;margin-left:auto;*zoom:1}.container:before,.container:after{display:table;line-height:0;content:""}.container:after{clear:both}.container-fluid{padding-right:20px;padding-left:20px;*zoom:1}.container-fluid:before,.container-fluid:after{display:table;line-height:0;content:""}.container-fluid:after{clear:both}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:21px;font-weight:200;line-height:30px}small{font-size:85%}strong{font-weight:bold}em{font-style:italic}cite{font-style:normal}.muted{color:#999}a.muted:hover{color:#808080}.text-warning{color:#c09853}a.text-warning:hover{color:#a47e3c}.text-error{color:#b94a48}a.text-error:hover{color:#953b39}.text-info{color:#3a87ad}a.text-info:hover{color:#2d6987}.text-success{color:#468847}a.text-success:hover{color:#356635}h1,h2,h3,h4,h5,h6{margin:10px 0;font-family:inherit;font-weight:bold;line-height:20px;color:inherit;text-rendering:optimizelegibility}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-weight:normal;line-height:1;color:#999}h1,h2,h3{line-height:40px}h1{font-size:38.5px}h2{font-size:31.5px}h3{font-size:24.5px}h4{font-size:17.5px}h5{font-size:14px}h6{font-size:11.9px}h1 small{font-size:24.5px}h2 small{font-size:17.5px}h3 small{font-size:14px}h4 small{font-size:14px}.page-header{padding-bottom:9px;margin:20px 0 30px;border-bottom:1px solid #eee}ul,ol{padding:0;margin:0 0 10px 25px}ul ul,ul ol,ol ol,ol ul{margin-bottom:0}li{line-height:20px}ul.unstyled,ol.unstyled{margin-left:0;list-style:none}ul.inline,ol.inline{margin-left:0;list-style:none}ul.inline>li,ol.inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-bottom:20px}dt,dd{line-height:20px}dt{font-weight:bold}dd{margin-left:10px}.dl-horizontal{*zoom:1}.dl-horizontal:before,.dl-horizontal:after{display:table;line-height:0;content:""}.dl-horizontal:after{clear:both}.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}hr{margin:20px 0;border:0;border-top:1px solid #eee;border-bottom:1px solid #fff}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #999}abbr.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:0 0 0 15px;margin:0 0 20px;border-left:5px solid #eee}blockquote p{margin-bottom:0;font-size:16px;font-weight:300;line-height:25px}blockquote small{display:block;line-height:20px;color:#999}blockquote small:before{content:'\2014 \00A0'}blockquote.pull-right{float:right;padding-right:15px;padding-left:0;border-right:5px solid #eee;border-left:0}blockquote.pull-right p,blockquote.pull-right small{text-align:right}blockquote.pull-right small:before{content:''}blockquote.pull-right small:after{content:'\00A0 \2014'}q:before,q:after,blockquote:before,blockquote:after{content:""}address{display:block;margin-bottom:20px;font-style:normal;line-height:20px}code,pre{padding:0 3px 2px;font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:12px;color:#333;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}code{padding:2px 4px;color:#d14;white-space:nowrap;background-color:#f7f7f9;border:1px solid #e1e1e8}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:20px;word-break:break-all;word-wrap:break-word;white-space:pre;white-space:pre-wrap;background-color:#f5f5f5;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.15);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}pre.prettyprint{margin-bottom:20px}pre code{padding:0;color:inherit;white-space:pre;white-space:pre-wrap;background-color:transparent;border:0}.pre-scrollable{max-height:340px;overflow-y:scroll}form{margin:0 0 20px}fieldset{padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:40px;color:#333;border:0;border-bottom:1px solid #e5e5e5}legend small{font-size:15px;color:#999}label,input,button,select,textarea{font-size:14px;font-weight:normal;line-height:20px}input,button,select,textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}label{display:block;margin-bottom:5px}select,textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{display:inline-block;height:20px;padding:4px 6px;margin-bottom:10px;font-size:14px;line-height:20px;color:#555;vertical-align:middle;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}input,textarea,.uneditable-input{width:206px}textarea{height:auto}textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{background-color:#fff;border:1px solid #ccc;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border linear .2s,box-shadow linear .2s;-moz-transition:border linear .2s,box-shadow linear .2s;-o-transition:border linear .2s,box-shadow linear .2s;transition:border linear .2s,box-shadow linear .2s}textarea:focus,input[type="text"]:focus,input[type="password"]:focus,input[type="datetime"]:focus,input[type="datetime-local"]:focus,input[type="date"]:focus,input[type="month"]:focus,input[type="time"]:focus,input[type="week"]:focus,input[type="number"]:focus,input[type="email"]:focus,input[type="url"]:focus,input[type="search"]:focus,input[type="tel"]:focus,input[type="color"]:focus,.uneditable-input:focus{border-color:rgba(82,168,236,0.8);outline:0;outline:thin dotted \9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6)}input[type="radio"],input[type="checkbox"]{margin:4px 0 0;margin-top:1px \9;*margin-top:0;line-height:normal}input[type="file"],input[type="image"],input[type="submit"],input[type="reset"],input[type="button"],input[type="radio"],input[type="checkbox"]{width:auto}select,input[type="file"]{height:30px;*margin-top:4px;line-height:30px}select{width:220px;background-color:#fff;border:1px solid #ccc}select[multiple],select[size]{height:auto}select:focus,input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.uneditable-input,.uneditable-textarea{color:#999;cursor:not-allowed;background-color:#fcfcfc;border-color:#ccc;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.025);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.025);box-shadow:inset 0 1px 2px rgba(0,0,0,0.025)}.uneditable-input{overflow:hidden;white-space:nowrap}.uneditable-textarea{width:auto;height:auto}input:-moz-placeholder,textarea:-moz-placeholder{color:#999}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#999}input::-webkit-input-placeholder,textarea::-webkit-input-placeholder{color:#999}.radio,.checkbox{min-height:20px;padding-left:20px}.radio input[type="radio"],.checkbox input[type="checkbox"]{float:left;margin-left:-20px}.controls>.radio:first-child,.controls>.checkbox:first-child{padding-top:5px}.radio.inline,.checkbox.inline{display:inline-block;padding-top:5px;margin-bottom:0;vertical-align:middle}.radio.inline+.radio.inline,.checkbox.inline+.checkbox.inline{margin-left:10px}.input-mini{width:60px}.input-small{width:90px}.input-medium{width:150px}.input-large{width:210px}.input-xlarge{width:270px}.input-xxlarge{width:530px}input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"]{float:none;margin-left:0}.input-append input[class*="span"],.input-append .uneditable-input[class*="span"],.input-prepend input[class*="span"],.input-prepend .uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"],.row-fluid .input-prepend [class*="span"],.row-fluid .input-append [class*="span"]{display:inline-block}input,textarea,.uneditable-input{margin-left:0}.controls-row [class*="span"]+[class*="span"]{margin-left:20px}input.span12,textarea.span12,.uneditable-input.span12{width:926px}input.span11,textarea.span11,.uneditable-input.span11{width:846px}input.span10,textarea.span10,.uneditable-input.span10{width:766px}input.span9,textarea.span9,.uneditable-input.span9{width:686px}input.span8,textarea.span8,.uneditable-input.span8{width:606px}input.span7,textarea.span7,.uneditable-input.span7{width:526px}input.span6,textarea.span6,.uneditable-input.span6{width:446px}input.span5,textarea.span5,.uneditable-input.span5{width:366px}input.span4,textarea.span4,.uneditable-input.span4{width:286px}input.span3,textarea.span3,.uneditable-input.span3{width:206px}input.span2,textarea.span2,.uneditable-input.span2{width:126px}input.span1,textarea.span1,.uneditable-input.span1{width:46px}.controls-row{*zoom:1}.controls-row:before,.controls-row:after{display:table;line-height:0;content:""}.controls-row:after{clear:both}.controls-row [class*="span"],.row-fluid .controls-row [class*="span"]{float:left}.controls-row .checkbox[class*="span"],.controls-row .radio[class*="span"]{padding-top:5px}input[disabled],select[disabled],textarea[disabled],input[readonly],select[readonly],textarea[readonly]{cursor:not-allowed;background-color:#eee}input[type="radio"][disabled],input[type="checkbox"][disabled],input[type="radio"][readonly],input[type="checkbox"][readonly]{background-color:transparent}.control-group.warning .control-label,.control-group.warning .help-block,.control-group.warning .help-inline{color:#c09853}.control-group.warning .checkbox,.control-group.warning .radio,.control-group.warning input,.control-group.warning select,.control-group.warning textarea{color:#c09853}.control-group.warning input,.control-group.warning select,.control-group.warning textarea{border-color:#c09853;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.warning input:focus,.control-group.warning select:focus,.control-group.warning textarea:focus{border-color:#a47e3c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e}.control-group.warning .input-prepend .add-on,.control-group.warning .input-append .add-on{color:#c09853;background-color:#fcf8e3;border-color:#c09853}.control-group.error .control-label,.control-group.error .help-block,.control-group.error .help-inline{color:#b94a48}.control-group.error .checkbox,.control-group.error .radio,.control-group.error input,.control-group.error select,.control-group.error textarea{color:#b94a48}.control-group.error input,.control-group.error select,.control-group.error textarea{border-color:#b94a48;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.error input:focus,.control-group.error select:focus,.control-group.error textarea:focus{border-color:#953b39;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392}.control-group.error .input-prepend .add-on,.control-group.error .input-append .add-on{color:#b94a48;background-color:#f2dede;border-color:#b94a48}.control-group.success .control-label,.control-group.success .help-block,.control-group.success .help-inline{color:#468847}.control-group.success .checkbox,.control-group.success .radio,.control-group.success input,.control-group.success select,.control-group.success textarea{color:#468847}.control-group.success input,.control-group.success select,.control-group.success textarea{border-color:#468847;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.success input:focus,.control-group.success select:focus,.control-group.success textarea:focus{border-color:#356635;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b}.control-group.success .input-prepend .add-on,.control-group.success .input-append .add-on{color:#468847;background-color:#dff0d8;border-color:#468847}.control-group.info .control-label,.control-group.info .help-block,.control-group.info .help-inline{color:#3a87ad}.control-group.info .checkbox,.control-group.info .radio,.control-group.info input,.control-group.info select,.control-group.info textarea{color:#3a87ad}.control-group.info input,.control-group.info select,.control-group.info textarea{border-color:#3a87ad;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.info input:focus,.control-group.info select:focus,.control-group.info textarea:focus{border-color:#2d6987;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7ab5d3;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7ab5d3;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7ab5d3}.control-group.info .input-prepend .add-on,.control-group.info .input-append .add-on{color:#3a87ad;background-color:#d9edf7;border-color:#3a87ad}input:focus:invalid,textarea:focus:invalid,select:focus:invalid{color:#b94a48;border-color:#ee5f5b}input:focus:invalid:focus,textarea:focus:invalid:focus,select:focus:invalid:focus{border-color:#e9322d;-webkit-box-shadow:0 0 6px #f8b9b7;-moz-box-shadow:0 0 6px #f8b9b7;box-shadow:0 0 6px #f8b9b7}.form-actions{padding:19px 20px 20px;margin-top:20px;margin-bottom:20px;background-color:#f5f5f5;border-top:1px solid #e5e5e5;*zoom:1}.form-actions:before,.form-actions:after{display:table;line-height:0;content:""}.form-actions:after{clear:both}.help-block,.help-inline{color:#595959}.help-block{display:block;margin-bottom:10px}.help-inline{display:inline-block;*display:inline;padding-left:5px;vertical-align:middle;*zoom:1}.input-append,.input-prepend{margin-bottom:5px;font-size:0;white-space:nowrap}.input-append input,.input-prepend input,.input-append select,.input-prepend select,.input-append .uneditable-input,.input-prepend .uneditable-input,.input-append .dropdown-menu,.input-prepend .dropdown-menu{font-size:14px}.input-append input,.input-prepend input,.input-append select,.input-prepend select,.input-append .uneditable-input,.input-prepend .uneditable-input{position:relative;margin-bottom:0;*margin-left:0;vertical-align:top;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-append input:focus,.input-prepend input:focus,.input-append select:focus,.input-prepend select:focus,.input-append .uneditable-input:focus,.input-prepend .uneditable-input:focus{z-index:2}.input-append .add-on,.input-prepend .add-on{display:inline-block;width:auto;height:20px;min-width:16px;padding:4px 5px;font-size:14px;font-weight:normal;line-height:20px;text-align:center;text-shadow:0 1px 0 #fff;background-color:#eee;border:1px solid #ccc}.input-append .add-on,.input-prepend .add-on,.input-append .btn,.input-prepend .btn,.input-append .btn-group>.dropdown-toggle,.input-prepend .btn-group>.dropdown-toggle{vertical-align:top;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.input-append .active,.input-prepend .active{background-color:#a9dba9;border-color:#46a546}.input-prepend .add-on,.input-prepend .btn{margin-right:-1px}.input-prepend .add-on:first-child,.input-prepend .btn:first-child{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.input-append input,.input-append select,.input-append .uneditable-input{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.input-append input+.btn-group .btn:last-child,.input-append select+.btn-group .btn:last-child,.input-append .uneditable-input+.btn-group .btn:last-child{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-append .add-on,.input-append .btn,.input-append .btn-group{margin-left:-1px}.input-append .add-on:last-child,.input-append .btn:last-child,.input-append .btn-group:last-child>.dropdown-toggle{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-prepend.input-append input,.input-prepend.input-append select,.input-prepend.input-append .uneditable-input{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.input-prepend.input-append input+.btn-group .btn,.input-prepend.input-append select+.btn-group .btn,.input-prepend.input-append .uneditable-input+.btn-group .btn{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-prepend.input-append .add-on:first-child,.input-prepend.input-append .btn:first-child{margin-right:-1px;-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.input-prepend.input-append .add-on:last-child,.input-prepend.input-append .btn:last-child{margin-left:-1px;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-prepend.input-append .btn-group:first-child{margin-left:0}input.search-query{padding-right:14px;padding-right:4px \9;padding-left:14px;padding-left:4px \9;margin-bottom:0;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px}.form-search .input-append .search-query,.form-search .input-prepend .search-query{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.form-search .input-append .search-query{-webkit-border-radius:14px 0 0 14px;-moz-border-radius:14px 0 0 14px;border-radius:14px 0 0 14px}.form-search .input-append .btn{-webkit-border-radius:0 14px 14px 0;-moz-border-radius:0 14px 14px 0;border-radius:0 14px 14px 0}.form-search .input-prepend .search-query{-webkit-border-radius:0 14px 14px 0;-moz-border-radius:0 14px 14px 0;border-radius:0 14px 14px 0}.form-search .input-prepend .btn{-webkit-border-radius:14px 0 0 14px;-moz-border-radius:14px 0 0 14px;border-radius:14px 0 0 14px}.form-search input,.form-inline input,.form-horizontal input,.form-search textarea,.form-inline textarea,.form-horizontal textarea,.form-search select,.form-inline select,.form-horizontal select,.form-search .help-inline,.form-inline .help-inline,.form-horizontal .help-inline,.form-search .uneditable-input,.form-inline .uneditable-input,.form-horizontal .uneditable-input,.form-search .input-prepend,.form-inline .input-prepend,.form-horizontal .input-prepend,.form-search .input-append,.form-inline .input-append,.form-horizontal .input-append{display:inline-block;*display:inline;margin-bottom:0;vertical-align:middle;*zoom:1}.form-search .hide,.form-inline .hide,.form-horizontal .hide{display:none}.form-search label,.form-inline label,.form-search .btn-group,.form-inline .btn-group{display:inline-block}.form-search .input-append,.form-inline .input-append,.form-search .input-prepend,.form-inline .input-prepend{margin-bottom:0}.form-search .radio,.form-search .checkbox,.form-inline .radio,.form-inline .checkbox{padding-left:0;margin-bottom:0;vertical-align:middle}.form-search .radio input[type="radio"],.form-search .checkbox input[type="checkbox"],.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"]{float:left;margin-right:3px;margin-left:0}.control-group{margin-bottom:10px}legend+.control-group{margin-top:20px;-webkit-margin-top-collapse:separate}.form-horizontal .control-group{margin-bottom:20px;*zoom:1}.form-horizontal .control-group:before,.form-horizontal .control-group:after{display:table;line-height:0;content:""}.form-horizontal .control-group:after{clear:both}.form-horizontal .control-label{float:left;width:160px;padding-top:5px;text-align:right}.form-horizontal .controls{*display:inline-block;*padding-left:20px;margin-left:180px;*margin-left:0}.form-horizontal .controls:first-child{*padding-left:180px}.form-horizontal .help-block{margin-bottom:0}.form-horizontal input+.help-block,.form-horizontal select+.help-block,.form-horizontal textarea+.help-block,.form-horizontal .uneditable-input+.help-block,.form-horizontal .input-prepend+.help-block,.form-horizontal .input-append+.help-block{margin-top:10px}.form-horizontal .form-actions{padding-left:180px}table{max-width:100%;background-color:transparent;border-collapse:collapse;border-spacing:0}.table{width:100%;margin-bottom:20px}.table th,.table td{padding:8px;line-height:20px;text-align:left;vertical-align:top;border-top:1px solid #ddd}.table th{font-weight:bold}.table thead th{vertical-align:bottom}.table caption+thead tr:first-child th,.table caption+thead tr:first-child td,.table colgroup+thead tr:first-child th,.table colgroup+thead tr:first-child td,.table thead:first-child tr:first-child th,.table thead:first-child tr:first-child td{border-top:0}.table tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed th,.table-condensed td{padding:4px 5px}.table-bordered{border:1px solid #ddd;border-collapse:separate;*border-collapse:collapse;border-left:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.table-bordered th,.table-bordered td{border-left:1px solid #ddd}.table-bordered caption+thead tr:first-child th,.table-bordered caption+tbody tr:first-child th,.table-bordered caption+tbody tr:first-child td,.table-bordered colgroup+thead tr:first-child th,.table-bordered colgroup+tbody tr:first-child th,.table-bordered colgroup+tbody tr:first-child td,.table-bordered thead:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child td{border-top:0}.table-bordered thead:first-child tr:first-child>th:first-child,.table-bordered tbody:first-child tr:first-child>td:first-child{-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topleft:4px}.table-bordered thead:first-child tr:first-child>th:last-child,.table-bordered tbody:first-child tr:first-child>td:last-child{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-topright:4px}.table-bordered thead:last-child tr:last-child>th:first-child,.table-bordered tbody:last-child tr:last-child>td:first-child,.table-bordered tfoot:last-child tr:last-child>td:first-child{-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px}.table-bordered thead:last-child tr:last-child>th:last-child,.table-bordered tbody:last-child tr:last-child>td:last-child,.table-bordered tfoot:last-child tr:last-child>td:last-child{-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px}.table-bordered tfoot+tbody:last-child tr:last-child td:first-child{-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0;-moz-border-radius-bottomleft:0}.table-bordered tfoot+tbody:last-child tr:last-child td:last-child{-webkit-border-bottom-right-radius:0;border-bottom-right-radius:0;-moz-border-radius-bottomright:0}.table-bordered caption+thead tr:first-child th:first-child,.table-bordered caption+tbody tr:first-child td:first-child,.table-bordered colgroup+thead tr:first-child th:first-child,.table-bordered colgroup+tbody tr:first-child td:first-child{-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topleft:4px}.table-bordered caption+thead tr:first-child th:last-child,.table-bordered caption+tbody tr:first-child td:last-child,.table-bordered colgroup+thead tr:first-child th:last-child,.table-bordered colgroup+tbody tr:first-child td:last-child{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-topright:4px}.table-striped tbody>tr:nth-child(odd)>td,.table-striped tbody>tr:nth-child(odd)>th{background-color:#f9f9f9}.table-hover tbody tr:hover td,.table-hover tbody tr:hover th{background-color:#f5f5f5}table td[class*="span"],table th[class*="span"],.row-fluid table td[class*="span"],.row-fluid table th[class*="span"]{display:table-cell;float:none;margin-left:0}.table td.span1,.table th.span1{float:none;width:44px;margin-left:0}.table td.span2,.table th.span2{float:none;width:124px;margin-left:0}.table td.span3,.table th.span3{float:none;width:204px;margin-left:0}.table td.span4,.table th.span4{float:none;width:284px;margin-left:0}.table td.span5,.table th.span5{float:none;width:364px;margin-left:0}.table td.span6,.table th.span6{float:none;width:444px;margin-left:0}.table td.span7,.table th.span7{float:none;width:524px;margin-left:0}.table td.span8,.table th.span8{float:none;width:604px;margin-left:0}.table td.span9,.table th.span9{float:none;width:684px;margin-left:0}.table td.span10,.table th.span10{float:none;width:764px;margin-left:0}.table td.span11,.table th.span11{float:none;width:844px;margin-left:0}.table td.span12,.table th.span12{float:none;width:924px;margin-left:0}.table tbody tr.success td{background-color:#dff0d8}.table tbody tr.error td{background-color:#f2dede}.table tbody tr.warning td{background-color:#fcf8e3}.table tbody tr.info td{background-color:#d9edf7}.table-hover tbody tr.success:hover td{background-color:#d0e9c6}.table-hover tbody tr.error:hover td{background-color:#ebcccc}.table-hover tbody tr.warning:hover td{background-color:#faf2cc}.table-hover tbody tr.info:hover td{background-color:#c4e3f3}[class^="icon-"],[class*=" icon-"]{display:inline-block;width:14px;height:14px;margin-top:1px;*margin-right:.3em;line-height:14px;vertical-align:text-top;background-image:url("../img/glyphicons-halflings.png");background-position:14px 14px;background-repeat:no-repeat}.icon-white,.nav-pills>.active>a>[class^="icon-"],.nav-pills>.active>a>[class*=" icon-"],.nav-list>.active>a>[class^="icon-"],.nav-list>.active>a>[class*=" icon-"],.navbar-inverse .nav>.active>a>[class^="icon-"],.navbar-inverse .nav>.active>a>[class*=" icon-"],.dropdown-menu>li>a:hover>[class^="icon-"],.dropdown-menu>li>a:hover>[class*=" icon-"],.dropdown-menu>.active>a>[class^="icon-"],.dropdown-menu>.active>a>[class*=" icon-"],.dropdown-submenu:hover>a>[class^="icon-"],.dropdown-submenu:hover>a>[class*=" icon-"]{background-image:url("../img/glyphicons-halflings-white.png")}.icon-glass{background-position:0 0}.icon-music{background-position:-24px 0}.icon-search{background-position:-48px 0}.icon-envelope{background-position:-72px 0}.icon-heart{background-position:-96px 0}.icon-star{background-position:-120px 0}.icon-star-empty{background-position:-144px 0}.icon-user{background-position:-168px 0}.icon-film{background-position:-192px 0}.icon-th-large{background-position:-216px 0}.icon-th{background-position:-240px 0}.icon-th-list{background-position:-264px 0}.icon-ok{background-position:-288px 0}.icon-remove{background-position:-312px 0}.icon-zoom-in{background-position:-336px 0}.icon-zoom-out{background-position:-360px 0}.icon-off{background-position:-384px 0}.icon-signal{background-position:-408px 0}.icon-cog{background-position:-432px 0}.icon-trash{background-position:-456px 0}.icon-home{background-position:0 -24px}.icon-file{background-position:-24px -24px}.icon-time{background-position:-48px -24px}.icon-road{background-position:-72px -24px}.icon-download-alt{background-position:-96px -24px}.icon-download{background-position:-120px -24px}.icon-upload{background-position:-144px -24px}.icon-inbox{background-position:-168px -24px}.icon-play-circle{background-position:-192px -24px}.icon-repeat{background-position:-216px -24px}.icon-refresh{background-position:-240px -24px}.icon-list-alt{background-position:-264px -24px}.icon-lock{background-position:-287px -24px}.icon-flag{background-position:-312px -24px}.icon-headphones{background-position:-336px -24px}.icon-volume-off{background-position:-360px -24px}.icon-volume-down{background-position:-384px -24px}.icon-volume-up{background-position:-408px -24px}.icon-qrcode{background-position:-432px -24px}.icon-barcode{background-position:-456px -24px}.icon-tag{background-position:0 -48px}.icon-tags{background-position:-25px -48px}.icon-book{background-position:-48px -48px}.icon-bookmark{background-position:-72px -48px}.icon-print{background-position:-96px -48px}.icon-camera{background-position:-120px -48px}.icon-font{background-position:-144px -48px}.icon-bold{background-position:-167px -48px}.icon-italic{background-position:-192px -48px}.icon-text-height{background-position:-216px -48px}.icon-text-width{background-position:-240px -48px}.icon-align-left{background-position:-264px -48px}.icon-align-center{background-position:-288px -48px}.icon-align-right{background-position:-312px -48px}.icon-align-justify{background-position:-336px -48px}.icon-list{background-position:-360px -48px}.icon-indent-left{background-position:-384px -48px}.icon-indent-right{background-position:-408px -48px}.icon-facetime-video{background-position:-432px -48px}.icon-picture{background-position:-456px -48px}.icon-pencil{background-position:0 -72px}.icon-map-marker{background-position:-24px -72px}.icon-adjust{background-position:-48px -72px}.icon-tint{background-position:-72px -72px}.icon-edit{background-position:-96px -72px}.icon-share{background-position:-120px -72px}.icon-check{background-position:-144px -72px}.icon-move{background-position:-168px -72px}.icon-step-backward{background-position:-192px -72px}.icon-fast-backward{background-position:-216px -72px}.icon-backward{background-position:-240px -72px}.icon-play{background-position:-264px -72px}.icon-pause{background-position:-288px -72px}.icon-stop{background-position:-312px -72px}.icon-forward{background-position:-336px -72px}.icon-fast-forward{background-position:-360px -72px}.icon-step-forward{background-position:-384px -72px}.icon-eject{background-position:-408px -72px}.icon-chevron-left{background-position:-432px -72px}.icon-chevron-right{background-position:-456px -72px}.icon-plus-sign{background-position:0 -96px}.icon-minus-sign{background-position:-24px -96px}.icon-remove-sign{background-position:-48px -96px}.icon-ok-sign{background-position:-72px -96px}.icon-question-sign{background-position:-96px -96px}.icon-info-sign{background-position:-120px -96px}.icon-screenshot{background-position:-144px -96px}.icon-remove-circle{background-position:-168px -96px}.icon-ok-circle{background-position:-192px -96px}.icon-ban-circle{background-position:-216px -96px}.icon-arrow-left{background-position:-240px -96px}.icon-arrow-right{background-position:-264px -96px}.icon-arrow-up{background-position:-289px -96px}.icon-arrow-down{background-position:-312px -96px}.icon-share-alt{background-position:-336px -96px}.icon-resize-full{background-position:-360px -96px}.icon-resize-small{background-position:-384px -96px}.icon-plus{background-position:-408px -96px}.icon-minus{background-position:-433px -96px}.icon-asterisk{background-position:-456px -96px}.icon-exclamation-sign{background-position:0 -120px}.icon-gift{background-position:-24px -120px}.icon-leaf{background-position:-48px -120px}.icon-fire{background-position:-72px -120px}.icon-eye-open{background-position:-96px -120px}.icon-eye-close{background-position:-120px -120px}.icon-warning-sign{background-position:-144px -120px}.icon-plane{background-position:-168px -120px}.icon-calendar{background-position:-192px -120px}.icon-random{width:16px;background-position:-216px -120px}.icon-comment{background-position:-240px -120px}.icon-magnet{background-position:-264px -120px}.icon-chevron-up{background-position:-288px -120px}.icon-chevron-down{background-position:-313px -119px}.icon-retweet{background-position:-336px -120px}.icon-shopping-cart{background-position:-360px -120px}.icon-folder-close{background-position:-384px -120px}.icon-folder-open{width:16px;background-position:-408px -120px}.icon-resize-vertical{background-position:-432px -119px}.icon-resize-horizontal{background-position:-456px -118px}.icon-hdd{background-position:0 -144px}.icon-bullhorn{background-position:-24px -144px}.icon-bell{background-position:-48px -144px}.icon-certificate{background-position:-72px -144px}.icon-thumbs-up{background-position:-96px -144px}.icon-thumbs-down{background-position:-120px -144px}.icon-hand-right{background-position:-144px -144px}.icon-hand-left{background-position:-168px -144px}.icon-hand-up{background-position:-192px -144px}.icon-hand-down{background-position:-216px -144px}.icon-circle-arrow-right{background-position:-240px -144px}.icon-circle-arrow-left{background-position:-264px -144px}.icon-circle-arrow-up{background-position:-288px -144px}.icon-circle-arrow-down{background-position:-312px -144px}.icon-globe{background-position:-336px -144px}.icon-wrench{background-position:-360px -144px}.icon-tasks{background-position:-384px -144px}.icon-filter{background-position:-408px -144px}.icon-briefcase{background-position:-432px -144px}.icon-fullscreen{background-position:-456px -144px}.dropup,.dropdown{position:relative}.dropdown-toggle{*margin-bottom:-3px}.dropdown-toggle:active,.open .dropdown-toggle{outline:0}.caret{display:inline-block;width:0;height:0;vertical-align:top;border-top:4px solid #000;border-right:4px solid transparent;border-left:4px solid transparent;content:""}.dropdown .caret{margin-top:8px;margin-left:2px}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);*border-right-width:2px;*border-bottom-width:2px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{*width:100%;height:1px;margin:9px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #fff}.dropdown-menu li>a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:20px;color:#333;white-space:nowrap}.dropdown-menu li>a:hover,.dropdown-menu li>a:focus,.dropdown-submenu:hover>a{color:#fff;text-decoration:none;background-color:#0081c2;background-image:-moz-linear-gradient(top,#08c,#0077b3);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#0077b3));background-image:-webkit-linear-gradient(top,#08c,#0077b3);background-image:-o-linear-gradient(top,#08c,#0077b3);background-image:linear-gradient(to bottom,#08c,#0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0077b3',GradientType=0)}.dropdown-menu .active>a,.dropdown-menu .active>a:hover{color:#fff;text-decoration:none;background-color:#0081c2;background-image:-moz-linear-gradient(top,#08c,#0077b3);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#0077b3));background-image:-webkit-linear-gradient(top,#08c,#0077b3);background-image:-o-linear-gradient(top,#08c,#0077b3);background-image:linear-gradient(to bottom,#08c,#0077b3);background-repeat:repeat-x;outline:0;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0077b3',GradientType=0)}.dropdown-menu .disabled>a,.dropdown-menu .disabled>a:hover{color:#999}.dropdown-menu .disabled>a:hover{text-decoration:none;cursor:default;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open{*z-index:1000}.open>.dropdown-menu{display:block}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px solid #000;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}.dropdown-submenu{position:relative}.dropdown-submenu>.dropdown-menu{top:0;left:100%;margin-top:-6px;margin-left:-1px;-webkit-border-radius:0 6px 6px 6px;-moz-border-radius:0 6px 6px 6px;border-radius:0 6px 6px 6px}.dropdown-submenu:hover>.dropdown-menu{display:block}.dropup .dropdown-submenu>.dropdown-menu{top:auto;bottom:0;margin-top:0;margin-bottom:-2px;-webkit-border-radius:5px 5px 5px 0;-moz-border-radius:5px 5px 5px 0;border-radius:5px 5px 5px 0}.dropdown-submenu>a:after{display:block;float:right;width:0;height:0;margin-top:5px;margin-right:-10px;border-color:transparent;border-left-color:#ccc;border-style:solid;border-width:5px 0 5px 5px;content:" "}.dropdown-submenu:hover>a:after{border-left-color:#fff}.dropdown-submenu.pull-left{float:none}.dropdown-submenu.pull-left>.dropdown-menu{left:-100%;margin-left:10px;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px}.dropdown .dropdown-menu .nav-header{padding-right:20px;padding-left:20px}.typeahead{z-index:1051;margin-top:2px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);box-shadow:inset 0 1px 1px rgba(0,0,0,0.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,0.15)}.well-large{padding:24px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.well-small{padding:9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.fade{opacity:0;-webkit-transition:opacity .15s linear;-moz-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{position:relative;height:0;overflow:hidden;-webkit-transition:height .35s ease;-moz-transition:height .35s ease;-o-transition:height .35s ease;transition:height .35s ease}.collapse.in{height:auto}.close{float:right;font-size:20px;font-weight:bold;line-height:20px;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20)}.close:hover{color:#000;text-decoration:none;cursor:pointer;opacity:.4;filter:alpha(opacity=40)}button.close{padding:0;cursor:pointer;background:transparent;border:0;-webkit-appearance:none}.btn{display:inline-block;*display:inline;padding:4px 12px;margin-bottom:0;*margin-left:.3em;font-size:14px;line-height:20px;color:#333;text-align:center;text-shadow:0 1px 1px rgba(255,255,255,0.75);vertical-align:middle;cursor:pointer;background-color:#f5f5f5;*background-color:#e6e6e6;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;border:1px solid #bbb;*border:0;border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);border-bottom-color:#a2a2a2;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffe6e6e6',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);*zoom:1;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05)}.btn:hover,.btn:active,.btn.active,.btn.disabled,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn:active,.btn.active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class^="icon-"],.btn-large [class*=" icon-"]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class^="icon-"],.btn-small [class*=" icon-"]{margin-top:0}.btn-mini [class^="icon-"],.btn-mini [class*=" icon-"]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-right:0;padding-left:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%}.btn-primary.active,.btn-warning.active,.btn-danger.active,.btn-success.active,.btn-info.active,.btn-inverse.active{color:rgba(255,255,255,0.75)}.btn{border-color:#c5c5c5;border-color:rgba(0,0,0,0.15) rgba(0,0,0,0.15) rgba(0,0,0,0.25)}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#006dcc;*background-color:#04c;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0044cc',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary:hover,.btn-primary:active,.btn-primary.active,.btn-primary.disabled,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary:active,.btn-primary.active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#faa732;*background-color:#f89406;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450',endColorstr='#fff89406',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning:hover,.btn-warning:active,.btn-warning.active,.btn-warning.disabled,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning:active,.btn-warning.active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#da4f49;*background-color:#bd362f;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeat:repeat-x;border-color:#bd362f #bd362f #802420;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b',endColorstr='#ffbd362f',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-danger:hover,.btn-danger:active,.btn-danger.active,.btn-danger.disabled,.btn-danger[disabled]{color:#fff;background-color:#bd362f;*background-color:#a9302a}.btn-danger:active,.btn-danger.active{background-color:#942a25 \9}.btn-success{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#5bb75b;*background-color:#51a351;background-image:-moz-linear-gradient(top,#62c462,#51a351);background-image:-webkit-gradient(linear,0 0,0 100%,from(#62c462),to(#51a351));background-image:-webkit-linear-gradient(top,#62c462,#51a351);background-image:-o-linear-gradient(top,#62c462,#51a351);background-image:linear-gradient(to bottom,#62c462,#51a351);background-repeat:repeat-x;border-color:#51a351 #51a351 #387038;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462',endColorstr='#ff51a351',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-success:hover,.btn-success:active,.btn-success.active,.btn-success.disabled,.btn-success[disabled]{color:#fff;background-color:#51a351;*background-color:#499249}.btn-success:active,.btn-success.active{background-color:#408140 \9}.btn-info{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#49afcd;*background-color:#2f96b4;background-image:-moz-linear-gradient(top,#5bc0de,#2f96b4);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5bc0de),to(#2f96b4));background-image:-webkit-linear-gradient(top,#5bc0de,#2f96b4);background-image:-o-linear-gradient(top,#5bc0de,#2f96b4);background-image:linear-gradient(to bottom,#5bc0de,#2f96b4);background-repeat:repeat-x;border-color:#2f96b4 #2f96b4 #1f6377;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de',endColorstr='#ff2f96b4',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-info:hover,.btn-info:active,.btn-info.active,.btn-info.disabled,.btn-info[disabled]{color:#fff;background-color:#2f96b4;*background-color:#2a85a0}.btn-info:active,.btn-info.active{background-color:#24748c \9}.btn-inverse{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#363636;*background-color:#222;background-image:-moz-linear-gradient(top,#444,#222);background-image:-webkit-gradient(linear,0 0,0 100%,from(#444),to(#222));background-image:-webkit-linear-gradient(top,#444,#222);background-image:-o-linear-gradient(top,#444,#222);background-image:linear-gradient(to bottom,#444,#222);background-repeat:repeat-x;border-color:#222 #222 #000;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff444444',endColorstr='#ff222222',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-inverse:hover,.btn-inverse:active,.btn-inverse.active,.btn-inverse.disabled,.btn-inverse[disabled]{color:#fff;background-color:#222;*background-color:#151515}.btn-inverse:active,.btn-inverse.active{background-color:#080808 \9}button.btn,input[type="submit"].btn{*padding-top:3px;*padding-bottom:3px}button.btn::-moz-focus-inner,input[type="submit"].btn::-moz-focus-inner{padding:0;border:0}button.btn.btn-large,input[type="submit"].btn.btn-large{*padding-top:7px;*padding-bottom:7px}button.btn.btn-small,input[type="submit"].btn.btn-small{*padding-top:3px;*padding-bottom:3px}button.btn.btn-mini,input[type="submit"].btn.btn-mini{*padding-top:1px;*padding-bottom:1px}.btn-link,.btn-link:active,.btn-link[disabled]{background-color:transparent;background-image:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-link{color:#08c;cursor:pointer;border-color:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-link:hover{color:#005580;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover{color:#333;text-decoration:none}.btn-group{position:relative;display:inline-block;*display:inline;*margin-left:.3em;font-size:0;white-space:nowrap;vertical-align:middle;*zoom:1}.btn-group:first-child{*margin-left:0}.btn-group+.btn-group{margin-left:5px}.btn-toolbar{margin-top:10px;margin-bottom:10px;font-size:0}.btn-toolbar>.btn+.btn,.btn-toolbar>.btn-group+.btn,.btn-toolbar>.btn+.btn-group{margin-left:5px}.btn-group>.btn{position:relative;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-group>.btn+.btn{margin-left:-1px}.btn-group>.btn,.btn-group>.dropdown-menu,.btn-group>.popover{font-size:14px}.btn-group>.btn-mini{font-size:10.5px}.btn-group>.btn-small{font-size:11.9px}.btn-group>.btn-large{font-size:17.5px}.btn-group>.btn:first-child{margin-left:0;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-bottomleft:4px;-moz-border-radius-topleft:4px}.btn-group>.btn:last-child,.btn-group>.dropdown-toggle{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-bottomright:4px}.btn-group>.btn.large:first-child{margin-left:0;-webkit-border-bottom-left-radius:6px;border-bottom-left-radius:6px;-webkit-border-top-left-radius:6px;border-top-left-radius:6px;-moz-border-radius-bottomleft:6px;-moz-border-radius-topleft:6px}.btn-group>.btn.large:last-child,.btn-group>.large.dropdown-toggle{-webkit-border-top-right-radius:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;border-bottom-right-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:6px}.btn-group>.btn:hover,.btn-group>.btn:focus,.btn-group>.btn:active,.btn-group>.btn.active{z-index:2}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{*padding-top:5px;padding-right:8px;*padding-bottom:5px;padding-left:8px;-webkit-box-shadow:inset 1px 0 0 rgba(255,255,255,0.125),inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 1px 0 0 rgba(255,255,255,0.125),inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 1px 0 0 rgba(255,255,255,0.125),inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05)}.btn-group>.btn-mini+.dropdown-toggle{*padding-top:2px;padding-right:5px;*padding-bottom:2px;padding-left:5px}.btn-group>.btn-small+.dropdown-toggle{*padding-top:5px;*padding-bottom:4px}.btn-group>.btn-large+.dropdown-toggle{*padding-top:7px;padding-right:12px;*padding-bottom:7px;padding-left:12px}.btn-group.open .dropdown-toggle{background-image:none;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05)}.btn-group.open .btn.dropdown-toggle{background-color:#e6e6e6}.btn-group.open .btn-primary.dropdown-toggle{background-color:#04c}.btn-group.open .btn-warning.dropdown-toggle{background-color:#f89406}.btn-group.open .btn-danger.dropdown-toggle{background-color:#bd362f}.btn-group.open .btn-success.dropdown-toggle{background-color:#51a351}.btn-group.open .btn-info.dropdown-toggle{background-color:#2f96b4}.btn-group.open .btn-inverse.dropdown-toggle{background-color:#222}.btn .caret{margin-top:8px;margin-left:0}.btn-mini .caret,.btn-small .caret,.btn-large .caret{margin-top:6px}.btn-large .caret{border-top-width:5px;border-right-width:5px;border-left-width:5px}.dropup .btn-large .caret{border-bottom-width:5px}.btn-primary .caret,.btn-warning .caret,.btn-danger .caret,.btn-info .caret,.btn-success .caret,.btn-inverse .caret{border-top-color:#fff;border-bottom-color:#fff}.btn-group-vertical{display:inline-block;*display:inline;*zoom:1}.btn-group-vertical>.btn{display:block;float:none;max-width:100%;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-group-vertical>.btn+.btn{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:first-child{-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0}.btn-group-vertical>.btn:last-child{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px}.btn-group-vertical>.btn-large:first-child{-webkit-border-radius:6px 6px 0 0;-moz-border-radius:6px 6px 0 0;border-radius:6px 6px 0 0}.btn-group-vertical>.btn-large:last-child{-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px}.alert{padding:8px 35px 8px 14px;margin-bottom:20px;text-shadow:0 1px 0 rgba(255,255,255,0.5);background-color:#fcf8e3;border:1px solid #fbeed5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.alert,.alert h4{color:#c09853}.alert h4{margin:0}.alert .close{position:relative;top:-2px;right:-21px;line-height:20px}.alert-success{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.alert-success h4{color:#468847}.alert-danger,.alert-error{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.alert-danger h4,.alert-error h4{color:#b94a48}.alert-info{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.alert-info h4{color:#3a87ad}.alert-block{padding-top:14px;padding-bottom:14px}.alert-block>p,.alert-block>ul{margin-bottom:0}.alert-block p+p{margin-top:5px}.nav{margin-bottom:20px;margin-left:0;list-style:none}.nav>li>a{display:block}.nav>li>a:hover{text-decoration:none;background-color:#eee}.nav>li>a>img{max-width:none}.nav>.pull-right{float:right}.nav-header{display:block;padding:3px 15px;font-size:11px;font-weight:bold;line-height:20px;color:#999;text-shadow:0 1px 0 rgba(255,255,255,0.5);text-transform:uppercase}.nav li+.nav-header{margin-top:9px}.nav-list{padding-right:15px;padding-left:15px;margin-bottom:0}.nav-list>li>a,.nav-list .nav-header{margin-right:-15px;margin-left:-15px;text-shadow:0 1px 0 rgba(255,255,255,0.5)}.nav-list>li>a{padding:3px 15px}.nav-list>.active>a,.nav-list>.active>a:hover{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.2);background-color:#08c}.nav-list [class^="icon-"],.nav-list [class*=" icon-"]{margin-right:2px}.nav-list .divider{*width:100%;height:1px;margin:9px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #fff}.nav-tabs,.nav-pills{*zoom:1}.nav-tabs:before,.nav-pills:before,.nav-tabs:after,.nav-pills:after{display:table;line-height:0;content:""}.nav-tabs:after,.nav-pills:after{clear:both}.nav-tabs>li,.nav-pills>li{float:left}.nav-tabs>li>a,.nav-pills>li>a{padding-right:12px;padding-left:12px;margin-right:2px;line-height:14px}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{margin-bottom:-1px}.nav-tabs>li>a{padding-top:8px;padding-bottom:8px;line-height:20px;border:1px solid transparent;-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>.active>a,.nav-tabs>.active>a:hover{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-pills>li>a{padding-top:8px;padding-bottom:8px;margin-top:2px;margin-bottom:2px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.nav-pills>.active>a,.nav-pills>.active>a:hover{color:#fff;background-color:#08c}.nav-stacked>li{float:none}.nav-stacked>li>a{margin-right:0}.nav-tabs.nav-stacked{border-bottom:0}.nav-tabs.nav-stacked>li>a{border:1px solid #ddd;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.nav-tabs.nav-stacked>li:first-child>a{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-topleft:4px}.nav-tabs.nav-stacked>li:last-child>a{-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomright:4px;-moz-border-radius-bottomleft:4px}.nav-tabs.nav-stacked>li>a:hover{z-index:2;border-color:#ddd}.nav-pills.nav-stacked>li>a{margin-bottom:3px}.nav-pills.nav-stacked>li:last-child>a{margin-bottom:1px}.nav-tabs .dropdown-menu{-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px}.nav-pills .dropdown-menu{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.nav .dropdown-toggle .caret{margin-top:6px;border-top-color:#08c;border-bottom-color:#08c}.nav .dropdown-toggle:hover .caret{border-top-color:#005580;border-bottom-color:#005580}.nav-tabs .dropdown-toggle .caret{margin-top:8px}.nav .active .dropdown-toggle .caret{border-top-color:#fff;border-bottom-color:#fff}.nav-tabs .active .dropdown-toggle .caret{border-top-color:#555;border-bottom-color:#555}.nav>.dropdown.active>a:hover{cursor:pointer}.nav-tabs .open .dropdown-toggle,.nav-pills .open .dropdown-toggle,.nav>li.dropdown.open.active>a:hover{color:#fff;background-color:#999;border-color:#999}.nav li.dropdown.open .caret,.nav li.dropdown.open.active .caret,.nav li.dropdown.open a:hover .caret{border-top-color:#fff;border-bottom-color:#fff;opacity:1;filter:alpha(opacity=100)}.tabs-stacked .open>a:hover{border-color:#999}.tabbable{*zoom:1}.tabbable:before,.tabbable:after{display:table;line-height:0;content:""}.tabbable:after{clear:both}.tab-content{overflow:auto}.tabs-below>.nav-tabs,.tabs-right>.nav-tabs,.tabs-left>.nav-tabs{border-bottom:0}.tab-content>.tab-pane,.pill-content>.pill-pane{display:none}.tab-content>.active,.pill-content>.active{display:block}.tabs-below>.nav-tabs{border-top:1px solid #ddd}.tabs-below>.nav-tabs>li{margin-top:-1px;margin-bottom:0}.tabs-below>.nav-tabs>li>a{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px}.tabs-below>.nav-tabs>li>a:hover{border-top-color:#ddd;border-bottom-color:transparent}.tabs-below>.nav-tabs>.active>a,.tabs-below>.nav-tabs>.active>a:hover{border-color:transparent #ddd #ddd #ddd}.tabs-left>.nav-tabs>li,.tabs-right>.nav-tabs>li{float:none}.tabs-left>.nav-tabs>li>a,.tabs-right>.nav-tabs>li>a{min-width:74px;margin-right:0;margin-bottom:3px}.tabs-left>.nav-tabs{float:left;margin-right:19px;border-right:1px solid #ddd}.tabs-left>.nav-tabs>li>a{margin-right:-1px;-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.tabs-left>.nav-tabs>li>a:hover{border-color:#eee #ddd #eee #eee}.tabs-left>.nav-tabs .active>a,.tabs-left>.nav-tabs .active>a:hover{border-color:#ddd transparent #ddd #ddd;*border-right-color:#fff}.tabs-right>.nav-tabs{float:right;margin-left:19px;border-left:1px solid #ddd}.tabs-right>.nav-tabs>li>a{margin-left:-1px;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.tabs-right>.nav-tabs>li>a:hover{border-color:#eee #eee #eee #ddd}.tabs-right>.nav-tabs .active>a,.tabs-right>.nav-tabs .active>a:hover{border-color:#ddd #ddd #ddd transparent;*border-left-color:#fff}.nav>.disabled>a{color:#999}.nav>.disabled>a:hover{text-decoration:none;cursor:default;background-color:transparent}.navbar{*position:relative;*z-index:2;margin-bottom:20px;overflow:visible}.navbar-inner{min-height:40px;padding-right:20px;padding-left:20px;background-color:#fafafa;background-image:-moz-linear-gradient(top,#fff,#f2f2f2);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#f2f2f2));background-image:-webkit-linear-gradient(top,#fff,#f2f2f2);background-image:-o-linear-gradient(top,#fff,#f2f2f2);background-image:linear-gradient(to bottom,#fff,#f2f2f2);background-repeat:repeat-x;border:1px solid #d4d4d4;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#fff2f2f2',GradientType=0);*zoom:1;-webkit-box-shadow:0 1px 4px rgba(0,0,0,0.065);-moz-box-shadow:0 1px 4px rgba(0,0,0,0.065);box-shadow:0 1px 4px rgba(0,0,0,0.065)}.navbar-inner:before,.navbar-inner:after{display:table;line-height:0;content:""}.navbar-inner:after{clear:both}.navbar .container{width:auto}.nav-collapse.collapse{height:auto;overflow:visible}.navbar .brand{display:block;float:left;padding:10px 20px 10px;margin-left:-20px;font-size:20px;font-weight:200;color:#777;text-shadow:0 1px 0 #fff}.navbar .brand:hover{text-decoration:none}.navbar-text{margin-bottom:0;line-height:40px;color:#777}.navbar-link{color:#777}.navbar-link:hover{color:#333}.navbar .divider-vertical{height:40px;margin:0 9px;border-right:1px solid #fff;border-left:1px solid #f2f2f2}.navbar .btn,.navbar .btn-group{margin-top:5px}.navbar .btn-group .btn,.navbar .input-prepend .btn,.navbar .input-append .btn{margin-top:0}.navbar-form{margin-bottom:0;*zoom:1}.navbar-form:before,.navbar-form:after{display:table;line-height:0;content:""}.navbar-form:after{clear:both}.navbar-form input,.navbar-form select,.navbar-form .radio,.navbar-form .checkbox{margin-top:5px}.navbar-form input,.navbar-form select,.navbar-form .btn{display:inline-block;margin-bottom:0}.navbar-form input[type="image"],.navbar-form input[type="checkbox"],.navbar-form input[type="radio"]{margin-top:3px}.navbar-form .input-append,.navbar-form .input-prepend{margin-top:5px;white-space:nowrap}.navbar-form .input-append input,.navbar-form .input-prepend input{margin-top:0}.navbar-search{position:relative;float:left;margin-top:5px;margin-bottom:0}.navbar-search .search-query{padding:4px 14px;margin-bottom:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;font-weight:normal;line-height:1;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px}.navbar-static-top{position:static;margin-bottom:0}.navbar-static-top .navbar-inner{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030;margin-bottom:0}.navbar-fixed-top .navbar-inner,.navbar-static-top .navbar-inner{border-width:0 0 1px}.navbar-fixed-bottom .navbar-inner{border-width:1px 0 0}.navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding-right:0;padding-left:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px}.navbar-fixed-top{top:0}.navbar-fixed-top .navbar-inner,.navbar-static-top .navbar-inner{-webkit-box-shadow:0 1px 10px rgba(0,0,0,0.1);-moz-box-shadow:0 1px 10px rgba(0,0,0,0.1);box-shadow:0 1px 10px rgba(0,0,0,0.1)}.navbar-fixed-bottom{bottom:0}.navbar-fixed-bottom .navbar-inner{-webkit-box-shadow:0 -1px 10px rgba(0,0,0,0.1);-moz-box-shadow:0 -1px 10px rgba(0,0,0,0.1);box-shadow:0 -1px 10px rgba(0,0,0,0.1)}.navbar .nav{position:relative;left:0;display:block;float:left;margin:0 10px 0 0}.navbar .nav.pull-right{float:right;margin-right:0}.navbar .nav>li{float:left}.navbar .nav>li>a{float:none;padding:10px 15px 10px;color:#777;text-decoration:none;text-shadow:0 1px 0 #fff}.navbar .nav .dropdown-toggle .caret{margin-top:8px}.navbar .nav>li>a:focus,.navbar .nav>li>a:hover{color:#333;text-decoration:none;background-color:transparent}.navbar .nav>.active>a,.navbar .nav>.active>a:hover,.navbar .nav>.active>a:focus{color:#555;text-decoration:none;background-color:#e5e5e5;-webkit-box-shadow:inset 0 3px 8px rgba(0,0,0,0.125);-moz-box-shadow:inset 0 3px 8px rgba(0,0,0,0.125);box-shadow:inset 0 3px 8px rgba(0,0,0,0.125)}.navbar .btn-navbar{display:none;float:right;padding:7px 10px;margin-right:5px;margin-left:5px;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#ededed;*background-color:#e5e5e5;background-image:-moz-linear-gradient(top,#f2f2f2,#e5e5e5);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f2f2f2),to(#e5e5e5));background-image:-webkit-linear-gradient(top,#f2f2f2,#e5e5e5);background-image:-o-linear-gradient(top,#f2f2f2,#e5e5e5);background-image:linear-gradient(to bottom,#f2f2f2,#e5e5e5);background-repeat:repeat-x;border-color:#e5e5e5 #e5e5e5 #bfbfbf;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2',endColorstr='#ffe5e5e5',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.075);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.075);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.075)}.navbar .btn-navbar:hover,.navbar .btn-navbar:active,.navbar .btn-navbar.active,.navbar .btn-navbar.disabled,.navbar .btn-navbar[disabled]{color:#fff;background-color:#e5e5e5;*background-color:#d9d9d9}.navbar .btn-navbar:active,.navbar .btn-navbar.active{background-color:#ccc \9}.navbar .btn-navbar .icon-bar{display:block;width:18px;height:2px;background-color:#f5f5f5;-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,0.25);-moz-box-shadow:0 1px 0 rgba(0,0,0,0.25);box-shadow:0 1px 0 rgba(0,0,0,0.25)}.btn-navbar .icon-bar+.icon-bar{margin-top:3px}.navbar .nav>li>.dropdown-menu:before{position:absolute;top:-7px;left:9px;display:inline-block;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-left:7px solid transparent;border-bottom-color:rgba(0,0,0,0.2);content:''}.navbar .nav>li>.dropdown-menu:after{position:absolute;top:-6px;left:10px;display:inline-block;border-right:6px solid transparent;border-bottom:6px solid #fff;border-left:6px solid transparent;content:''}.navbar-fixed-bottom .nav>li>.dropdown-menu:before{top:auto;bottom:-7px;border-top:7px solid #ccc;border-bottom:0;border-top-color:rgba(0,0,0,0.2)}.navbar-fixed-bottom .nav>li>.dropdown-menu:after{top:auto;bottom:-6px;border-top:6px solid #fff;border-bottom:0}.navbar .nav li.dropdown>a:hover .caret{border-top-color:#555;border-bottom-color:#555}.navbar .nav li.dropdown.open>.dropdown-toggle,.navbar .nav li.dropdown.active>.dropdown-toggle,.navbar .nav li.dropdown.open.active>.dropdown-toggle{color:#555;background-color:#e5e5e5}.navbar .nav li.dropdown>.dropdown-toggle .caret{border-top-color:#777;border-bottom-color:#777}.navbar .nav li.dropdown.open>.dropdown-toggle .caret,.navbar .nav li.dropdown.active>.dropdown-toggle .caret,.navbar .nav li.dropdown.open.active>.dropdown-toggle .caret{border-top-color:#555;border-bottom-color:#555}.navbar .pull-right>li>.dropdown-menu,.navbar .nav>li>.dropdown-menu.pull-right{right:0;left:auto}.navbar .pull-right>li>.dropdown-menu:before,.navbar .nav>li>.dropdown-menu.pull-right:before{right:12px;left:auto}.navbar .pull-right>li>.dropdown-menu:after,.navbar .nav>li>.dropdown-menu.pull-right:after{right:13px;left:auto}.navbar .pull-right>li>.dropdown-menu .dropdown-menu,.navbar .nav>li>.dropdown-menu.pull-right .dropdown-menu{right:100%;left:auto;margin-right:-1px;margin-left:0;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px}.navbar-inverse .navbar-inner{background-color:#1b1b1b;background-image:-moz-linear-gradient(top,#222,#111);background-image:-webkit-gradient(linear,0 0,0 100%,from(#222),to(#111));background-image:-webkit-linear-gradient(top,#222,#111);background-image:-o-linear-gradient(top,#222,#111);background-image:linear-gradient(to bottom,#222,#111);background-repeat:repeat-x;border-color:#252525;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222',endColorstr='#ff111111',GradientType=0)}.navbar-inverse .brand,.navbar-inverse .nav>li>a{color:#999;text-shadow:0 -1px 0 rgba(0,0,0,0.25)}.navbar-inverse .brand:hover,.navbar-inverse .nav>li>a:hover{color:#fff}.navbar-inverse .brand{color:#999}.navbar-inverse .navbar-text{color:#999}.navbar-inverse .nav>li>a:focus,.navbar-inverse .nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .nav .active>a,.navbar-inverse .nav .active>a:hover,.navbar-inverse .nav .active>a:focus{color:#fff;background-color:#111}.navbar-inverse .navbar-link{color:#999}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .divider-vertical{border-right-color:#222;border-left-color:#111}.navbar-inverse .nav li.dropdown.open>.dropdown-toggle,.navbar-inverse .nav li.dropdown.active>.dropdown-toggle,.navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle{color:#fff;background-color:#111}.navbar-inverse .nav li.dropdown>a:hover .caret{border-top-color:#fff;border-bottom-color:#fff}.navbar-inverse .nav li.dropdown>.dropdown-toggle .caret{border-top-color:#999;border-bottom-color:#999}.navbar-inverse .nav li.dropdown.open>.dropdown-toggle .caret,.navbar-inverse .nav li.dropdown.active>.dropdown-toggle .caret,.navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle .caret{border-top-color:#fff;border-bottom-color:#fff}.navbar-inverse .navbar-search .search-query{color:#fff;background-color:#515151;border-color:#111;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0 rgba(255,255,255,0.15);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0 rgba(255,255,255,0.15);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0 rgba(255,255,255,0.15);-webkit-transition:none;-moz-transition:none;-o-transition:none;transition:none}.navbar-inverse .navbar-search .search-query:-moz-placeholder{color:#ccc}.navbar-inverse .navbar-search .search-query:-ms-input-placeholder{color:#ccc}.navbar-inverse .navbar-search .search-query::-webkit-input-placeholder{color:#ccc}.navbar-inverse .navbar-search .search-query:focus,.navbar-inverse .navbar-search .search-query.focused{padding:5px 15px;color:#333;text-shadow:0 1px 0 #fff;background-color:#fff;border:0;outline:0;-webkit-box-shadow:0 0 3px rgba(0,0,0,0.15);-moz-box-shadow:0 0 3px rgba(0,0,0,0.15);box-shadow:0 0 3px rgba(0,0,0,0.15)}.navbar-inverse .btn-navbar{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#0e0e0e;*background-color:#040404;background-image:-moz-linear-gradient(top,#151515,#040404);background-image:-webkit-gradient(linear,0 0,0 100%,from(#151515),to(#040404));background-image:-webkit-linear-gradient(top,#151515,#040404);background-image:-o-linear-gradient(top,#151515,#040404);background-image:linear-gradient(to bottom,#151515,#040404);background-repeat:repeat-x;border-color:#040404 #040404 #000;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff151515',endColorstr='#ff040404',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.navbar-inverse .btn-navbar:hover,.navbar-inverse .btn-navbar:active,.navbar-inverse .btn-navbar.active,.navbar-inverse .btn-navbar.disabled,.navbar-inverse .btn-navbar[disabled]{color:#fff;background-color:#040404;*background-color:#000}.navbar-inverse .btn-navbar:active,.navbar-inverse .btn-navbar.active{background-color:#000 \9}.breadcrumb{padding:8px 15px;margin:0 0 20px;list-style:none;background-color:#f5f5f5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.breadcrumb>li{display:inline-block;*display:inline;text-shadow:0 1px 0 #fff;*zoom:1}.breadcrumb>li>.divider{padding:0 5px;color:#ccc}.breadcrumb>.active{color:#999}.pagination{margin:20px 0}.pagination ul{display:inline-block;*display:inline;margin-bottom:0;margin-left:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*zoom:1;-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:0 1px 2px rgba(0,0,0,0.05);box-shadow:0 1px 2px rgba(0,0,0,0.05)}.pagination ul>li{display:inline}.pagination ul>li>a,.pagination ul>li>span{float:left;padding:4px 12px;line-height:20px;text-decoration:none;background-color:#fff;border:1px solid #ddd;border-left-width:0}.pagination ul>li>a:hover,.pagination ul>.active>a,.pagination ul>.active>span{background-color:#f5f5f5}.pagination ul>.active>a,.pagination ul>.active>span{color:#999;cursor:default}.pagination ul>.disabled>span,.pagination ul>.disabled>a,.pagination ul>.disabled>a:hover{color:#999;cursor:default;background-color:transparent}.pagination ul>li:first-child>a,.pagination ul>li:first-child>span{border-left-width:1px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-bottomleft:4px;-moz-border-radius-topleft:4px}.pagination ul>li:last-child>a,.pagination ul>li:last-child>span{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-bottomright:4px}.pagination-centered{text-align:center}.pagination-right{text-align:right}.pagination-large ul>li>a,.pagination-large ul>li>span{padding:11px 19px;font-size:17.5px}.pagination-large ul>li:first-child>a,.pagination-large ul>li:first-child>span{-webkit-border-bottom-left-radius:6px;border-bottom-left-radius:6px;-webkit-border-top-left-radius:6px;border-top-left-radius:6px;-moz-border-radius-bottomleft:6px;-moz-border-radius-topleft:6px}.pagination-large ul>li:last-child>a,.pagination-large ul>li:last-child>span{-webkit-border-top-right-radius:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;border-bottom-right-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:6px}.pagination-mini ul>li:first-child>a,.pagination-small ul>li:first-child>a,.pagination-mini ul>li:first-child>span,.pagination-small ul>li:first-child>span{-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-bottomleft:3px;-moz-border-radius-topleft:3px}.pagination-mini ul>li:last-child>a,.pagination-small ul>li:last-child>a,.pagination-mini ul>li:last-child>span,.pagination-small ul>li:last-child>span{-webkit-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px;-moz-border-radius-topright:3px;-moz-border-radius-bottomright:3px}.pagination-small ul>li>a,.pagination-small ul>li>span{padding:2px 10px;font-size:11.9px}.pagination-mini ul>li>a,.pagination-mini ul>li>span{padding:0 6px;font-size:10.5px}.pager{margin:20px 0;text-align:center;list-style:none;*zoom:1}.pager:before,.pager:after{display:table;line-height:0;content:""}.pager:after{clear:both}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px}.pager li>a:hover{text-decoration:none;background-color:#f5f5f5}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>span{color:#999;cursor:default;background-color:#fff}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{opacity:0}.modal-backdrop,.modal-backdrop.fade.in{opacity:.8;filter:alpha(opacity=80)}.modal{position:fixed;top:10%;left:50%;z-index:1050;width:560px;margin-left:-280px;background-color:#fff;border:1px solid #999;border:1px solid rgba(0,0,0,0.3);*border:1px solid #999;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;outline:0;-webkit-box-shadow:0 3px 7px rgba(0,0,0,0.3);-moz-box-shadow:0 3px 7px rgba(0,0,0,0.3);box-shadow:0 3px 7px rgba(0,0,0,0.3);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box}.modal.fade{top:-25%;-webkit-transition:opacity .3s linear,top .3s ease-out;-moz-transition:opacity .3s linear,top .3s ease-out;-o-transition:opacity .3s linear,top .3s ease-out;transition:opacity .3s linear,top .3s ease-out}.modal.fade.in{top:10%}.modal-header{padding:9px 15px;border-bottom:1px solid #eee}.modal-header .close{margin-top:2px}.modal-header h3{margin:0;line-height:30px}.modal-body{position:relative;max-height:400px;padding:15px;overflow-y:auto}.modal-form{margin-bottom:0}.modal-footer{padding:14px 15px 15px;margin-bottom:0;text-align:right;background-color:#f5f5f5;border-top:1px solid #ddd;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;*zoom:1;-webkit-box-shadow:inset 0 1px 0 #fff;-moz-box-shadow:inset 0 1px 0 #fff;box-shadow:inset 0 1px 0 #fff}.modal-footer:before,.modal-footer:after{display:table;line-height:0;content:""}.modal-footer:after{clear:both}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.tooltip{position:absolute;z-index:1030;display:block;padding:5px;font-size:11px;opacity:0;filter:alpha(opacity=0);visibility:visible}.tooltip.in{opacity:.8;filter:alpha(opacity=80)}.tooltip.top{margin-top:-3px}.tooltip.right{margin-left:3px}.tooltip.bottom{margin-top:3px}.tooltip.left{margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-top-color:#000;border-width:5px 5px 0}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-right-color:#000;border-width:5px 5px 5px 0}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-left-color:#000;border-width:5px 0 5px 5px}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-bottom-color:#000;border-width:0 5px 5px}.popover{position:absolute;top:0;left:0;z-index:1010;display:none;width:236px;padding:1px;text-align:left;white-space:normal;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;font-weight:normal;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover .arrow,.popover .arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover .arrow{border-width:11px}.popover .arrow:after{border-width:10px;content:""}.popover.top .arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,0.25);border-bottom-width:0}.popover.top .arrow:after{bottom:1px;margin-left:-10px;border-top-color:#fff;border-bottom-width:0}.popover.right .arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,0.25);border-left-width:0}.popover.right .arrow:after{bottom:-10px;left:1px;border-right-color:#fff;border-left-width:0}.popover.bottom .arrow{top:-11px;left:50%;margin-left:-11px;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,0.25);border-top-width:0}.popover.bottom .arrow:after{top:1px;margin-left:-10px;border-bottom-color:#fff;border-top-width:0}.popover.left .arrow{top:50%;right:-11px;margin-top:-11px;border-left-color:#999;border-left-color:rgba(0,0,0,0.25);border-right-width:0}.popover.left .arrow:after{right:1px;bottom:-10px;border-left-color:#fff;border-right-width:0}.thumbnails{margin-left:-20px;list-style:none;*zoom:1}.thumbnails:before,.thumbnails:after{display:table;line-height:0;content:""}.thumbnails:after{clear:both}.row-fluid .thumbnails{margin-left:0}.thumbnails>li{float:left;margin-bottom:20px;margin-left:20px}.thumbnail{display:block;padding:4px;line-height:20px;border:1px solid #ddd;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.055);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.055);box-shadow:0 1px 3px rgba(0,0,0,0.055);-webkit-transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}a.thumbnail:hover{border-color:#08c;-webkit-box-shadow:0 1px 4px rgba(0,105,214,0.25);-moz-box-shadow:0 1px 4px rgba(0,105,214,0.25);box-shadow:0 1px 4px rgba(0,105,214,0.25)}.thumbnail>img{display:block;max-width:100%;margin-right:auto;margin-left:auto}.thumbnail .caption{padding:9px;color:#555}.media,.media-body{overflow:hidden;*overflow:visible;zoom:1}.media,.media .media{margin-top:15px}.media:first-child{margin-top:0}.media-object{display:block}.media-heading{margin:0 0 5px}.media .pull-left{margin-right:10px}.media .pull-right{margin-left:10px}.media-list{margin-left:0;list-style:none}.label,.badge{display:inline-block;padding:2px 4px;font-size:11.844px;font-weight:bold;line-height:14px;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);white-space:nowrap;vertical-align:baseline;background-color:#999}.label{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.badge{padding-right:9px;padding-left:9px;-webkit-border-radius:9px;-moz-border-radius:9px;border-radius:9px}.label:empty,.badge:empty{display:none}a.label:hover,a.badge:hover{color:#fff;text-decoration:none;cursor:pointer}.label-important,.badge-important{background-color:#b94a48}.label-important[href],.badge-important[href]{background-color:#953b39}.label-warning,.badge-warning{background-color:#f89406}.label-warning[href],.badge-warning[href]{background-color:#c67605}.label-success,.badge-success{background-color:#468847}.label-success[href],.badge-success[href]{background-color:#356635}.label-info,.badge-info{background-color:#3a87ad}.label-info[href],.badge-info[href]{background-color:#2d6987}.label-inverse,.badge-inverse{background-color:#333}.label-inverse[href],.badge-inverse[href]{background-color:#1a1a1a}.btn .label,.btn .badge{position:relative;top:-1px}.btn-mini .label,.btn-mini .badge{top:0}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-moz-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-ms-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:0 0}to{background-position:40px 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f7f7f7;background-image:-moz-linear-gradient(top,#f5f5f5,#f9f9f9);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f5f5f5),to(#f9f9f9));background-image:-webkit-linear-gradient(top,#f5f5f5,#f9f9f9);background-image:-o-linear-gradient(top,#f5f5f5,#f9f9f9);background-image:linear-gradient(to bottom,#f5f5f5,#f9f9f9);background-repeat:repeat-x;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5',endColorstr='#fff9f9f9',GradientType=0);-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1)}.progress .bar{float:left;width:0;height:100%;font-size:12px;color:#fff;text-align:center;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#0e90d2;background-image:-moz-linear-gradient(top,#149bdf,#0480be);background-image:-webkit-gradient(linear,0 0,0 100%,from(#149bdf),to(#0480be));background-image:-webkit-linear-gradient(top,#149bdf,#0480be);background-image:-o-linear-gradient(top,#149bdf,#0480be);background-image:linear-gradient(to bottom,#149bdf,#0480be);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff149bdf',endColorstr='#ff0480be',GradientType=0);-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-moz-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:width .6s ease;-moz-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress .bar+.bar{-webkit-box-shadow:inset 1px 0 0 rgba(0,0,0,0.15),inset 0 -1px 0 rgba(0,0,0,0.15);-moz-box-shadow:inset 1px 0 0 rgba(0,0,0,0.15),inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 1px 0 0 rgba(0,0,0,0.15),inset 0 -1px 0 rgba(0,0,0,0.15)}.progress-striped .bar{background-color:#149bdf;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;-moz-background-size:40px 40px;-o-background-size:40px 40px;background-size:40px 40px}.progress.active .bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-moz-animation:progress-bar-stripes 2s linear infinite;-ms-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-danger .bar,.progress .bar-danger{background-color:#dd514c;background-image:-moz-linear-gradient(top,#ee5f5b,#c43c35);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#c43c35));background-image:-webkit-linear-gradient(top,#ee5f5b,#c43c35);background-image:-o-linear-gradient(top,#ee5f5b,#c43c35);background-image:linear-gradient(to bottom,#ee5f5b,#c43c35);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b',endColorstr='#ffc43c35',GradientType=0)}.progress-danger.progress-striped .bar,.progress-striped .bar-danger{background-color:#ee5f5b;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-success .bar,.progress .bar-success{background-color:#5eb95e;background-image:-moz-linear-gradient(top,#62c462,#57a957);background-image:-webkit-gradient(linear,0 0,0 100%,from(#62c462),to(#57a957));background-image:-webkit-linear-gradient(top,#62c462,#57a957);background-image:-o-linear-gradient(top,#62c462,#57a957);background-image:linear-gradient(to bottom,#62c462,#57a957);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462',endColorstr='#ff57a957',GradientType=0)}.progress-success.progress-striped .bar,.progress-striped .bar-success{background-color:#62c462;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-info .bar,.progress .bar-info{background-color:#4bb1cf;background-image:-moz-linear-gradient(top,#5bc0de,#339bb9);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5bc0de),to(#339bb9));background-image:-webkit-linear-gradient(top,#5bc0de,#339bb9);background-image:-o-linear-gradient(top,#5bc0de,#339bb9);background-image:linear-gradient(to bottom,#5bc0de,#339bb9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de',endColorstr='#ff339bb9',GradientType=0)}.progress-info.progress-striped .bar,.progress-striped .bar-info{background-color:#5bc0de;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-warning .bar,.progress .bar-warning{background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450',endColorstr='#fff89406',GradientType=0)}.progress-warning.progress-striped .bar,.progress-striped .bar-warning{background-color:#fbb450;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.accordion{margin-bottom:20px}.accordion-group{margin-bottom:2px;border:1px solid #e5e5e5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.accordion-heading{border-bottom:0}.accordion-heading .accordion-toggle{display:block;padding:8px 15px}.accordion-toggle{cursor:pointer}.accordion-inner{padding:9px 15px;border-top:1px solid #e5e5e5}.carousel{position:relative;margin-bottom:20px;line-height:1}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-moz-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>img{display:block;line-height:1}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:40%;left:15px;width:40px;height:40px;margin-top:-20px;font-size:60px;font-weight:100;line-height:30px;color:#fff;text-align:center;background:#222;border:3px solid #fff;-webkit-border-radius:23px;-moz-border-radius:23px;border-radius:23px;opacity:.5;filter:alpha(opacity=50)}.carousel-control.right{right:15px;left:auto}.carousel-control:hover{color:#fff;text-decoration:none;opacity:.9;filter:alpha(opacity=90)}.carousel-caption{position:absolute;right:0;bottom:0;left:0;padding:15px;background:#333;background:rgba(0,0,0,0.75)}.carousel-caption h4,.carousel-caption p{line-height:20px;color:#fff}.carousel-caption h4{margin:0 0 5px}.carousel-caption p{margin-bottom:0}.hero-unit{padding:60px;margin-bottom:30px;font-size:18px;font-weight:200;line-height:30px;color:inherit;background-color:#eee;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.hero-unit h1{margin-bottom:0;font-size:60px;line-height:1;letter-spacing:-1px;color:inherit}.hero-unit li{line-height:30px}.pull-right{float:right}.pull-left{float:left}.hide{display:none}.show{display:block}.invisible{visibility:hidden}.affix{position:fixed}
    8.13 -/*!
    8.14 - * Bootstrap Responsive v2.2.2
    8.15 - *
    8.16 - * Copyright 2012 Twitter, Inc
    8.17 - * Licensed under the Apache License v2.0
    8.18 - * http://www.apache.org/licenses/LICENSE-2.0
    8.19 - *
    8.20 - * Designed and built with all the love in the world @twitter by @mdo and @fat.
    8.21 - */@-ms-viewport{width:device-width}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;line-height:0;content:""}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.hidden{display:none;visibility:hidden}.visible-phone{display:none!important}.visible-tablet{display:none!important}.hidden-desktop{display:none!important}.visible-desktop{display:inherit!important}@media(min-width:768px) and (max-width:979px){.hidden-desktop{display:inherit!important}.visible-desktop{display:none!important}.visible-tablet{display:inherit!important}.hidden-tablet{display:none!important}}@media(max-width:767px){.hidden-desktop{display:inherit!important}.visible-desktop{display:none!important}.visible-phone{display:inherit!important}.hidden-phone{display:none!important}}@media(min-width:1200px){.row{margin-left:-30px;*zoom:1}.row:before,.row:after{display:table;line-height:0;content:""}.row:after{clear:both}[class*="span"]{float:left;min-height:1px;margin-left:30px}.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:1170px}.span12{width:1170px}.span11{width:1070px}.span10{width:970px}.span9{width:870px}.span8{width:770px}.span7{width:670px}.span6{width:570px}.span5{width:470px}.span4{width:370px}.span3{width:270px}.span2{width:170px}.span1{width:70px}.offset12{margin-left:1230px}.offset11{margin-left:1130px}.offset10{margin-left:1030px}.offset9{margin-left:930px}.offset8{margin-left:830px}.offset7{margin-left:730px}.offset6{margin-left:630px}.offset5{margin-left:530px}.offset4{margin-left:430px}.offset3{margin-left:330px}.offset2{margin-left:230px}.offset1{margin-left:130px}.row-fluid{width:100%;*zoom:1}.row-fluid:before,.row-fluid:after{display:table;line-height:0;content:""}.row-fluid:after{clear:both}.row-fluid [class*="span"]{display:block;float:left;width:100%;min-height:30px;margin-left:2.564102564102564%;*margin-left:2.5109110747408616%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="span"]:first-child{margin-left:0}.row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.564102564102564%}.row-fluid .span12{width:100%;*width:99.94680851063829%}.row-fluid .span11{width:91.45299145299145%;*width:91.39979996362975%}.row-fluid .span10{width:82.90598290598291%;*width:82.8527914166212%}.row-fluid .span9{width:74.35897435897436%;*width:74.30578286961266%}.row-fluid .span8{width:65.81196581196582%;*width:65.75877432260411%}.row-fluid .span7{width:57.26495726495726%;*width:57.21176577559556%}.row-fluid .span6{width:48.717948717948715%;*width:48.664757228587014%}.row-fluid .span5{width:40.17094017094017%;*width:40.11774868157847%}.row-fluid .span4{width:31.623931623931625%;*width:31.570740134569924%}.row-fluid .span3{width:23.076923076923077%;*width:23.023731587561375%}.row-fluid .span2{width:14.52991452991453%;*width:14.476723040552828%}.row-fluid .span1{width:5.982905982905983%;*width:5.929714493544281%}.row-fluid .offset12{margin-left:105.12820512820512%;*margin-left:105.02182214948171%}.row-fluid .offset12:first-child{margin-left:102.56410256410257%;*margin-left:102.45771958537915%}.row-fluid .offset11{margin-left:96.58119658119658%;*margin-left:96.47481360247316%}.row-fluid .offset11:first-child{margin-left:94.01709401709402%;*margin-left:93.91071103837061%}.row-fluid .offset10{margin-left:88.03418803418803%;*margin-left:87.92780505546462%}.row-fluid .offset10:first-child{margin-left:85.47008547008548%;*margin-left:85.36370249136206%}.row-fluid .offset9{margin-left:79.48717948717949%;*margin-left:79.38079650845607%}.row-fluid .offset9:first-child{margin-left:76.92307692307693%;*margin-left:76.81669394435352%}.row-fluid .offset8{margin-left:70.94017094017094%;*margin-left:70.83378796144753%}.row-fluid .offset8:first-child{margin-left:68.37606837606839%;*margin-left:68.26968539734497%}.row-fluid .offset7{margin-left:62.393162393162385%;*margin-left:62.28677941443899%}.row-fluid .offset7:first-child{margin-left:59.82905982905982%;*margin-left:59.72267685033642%}.row-fluid .offset6{margin-left:53.84615384615384%;*margin-left:53.739770867430444%}.row-fluid .offset6:first-child{margin-left:51.28205128205128%;*margin-left:51.175668303327875%}.row-fluid .offset5{margin-left:45.299145299145295%;*margin-left:45.1927623204219%}.row-fluid .offset5:first-child{margin-left:42.73504273504273%;*margin-left:42.62865975631933%}.row-fluid .offset4{margin-left:36.75213675213675%;*margin-left:36.645753773413354%}.row-fluid .offset4:first-child{margin-left:34.18803418803419%;*margin-left:34.081651209310785%}.row-fluid .offset3{margin-left:28.205128205128204%;*margin-left:28.0987452264048%}.row-fluid .offset3:first-child{margin-left:25.641025641025642%;*margin-left:25.53464266230224%}.row-fluid .offset2{margin-left:19.65811965811966%;*margin-left:19.551736679396257%}.row-fluid .offset2:first-child{margin-left:17.094017094017094%;*margin-left:16.98763411529369%}.row-fluid .offset1{margin-left:11.11111111111111%;*margin-left:11.004728132387708%}.row-fluid .offset1:first-child{margin-left:8.547008547008547%;*margin-left:8.440625568285142%}input,textarea,.uneditable-input{margin-left:0}.controls-row [class*="span"]+[class*="span"]{margin-left:30px}input.span12,textarea.span12,.uneditable-input.span12{width:1156px}input.span11,textarea.span11,.uneditable-input.span11{width:1056px}input.span10,textarea.span10,.uneditable-input.span10{width:956px}input.span9,textarea.span9,.uneditable-input.span9{width:856px}input.span8,textarea.span8,.uneditable-input.span8{width:756px}input.span7,textarea.span7,.uneditable-input.span7{width:656px}input.span6,textarea.span6,.uneditable-input.span6{width:556px}input.span5,textarea.span5,.uneditable-input.span5{width:456px}input.span4,textarea.span4,.uneditable-input.span4{width:356px}input.span3,textarea.span3,.uneditable-input.span3{width:256px}input.span2,textarea.span2,.uneditable-input.span2{width:156px}input.span1,textarea.span1,.uneditable-input.span1{width:56px}.thumbnails{margin-left:-30px}.thumbnails>li{margin-left:30px}.row-fluid .thumbnails{margin-left:0}}@media(min-width:768px) and (max-width:979px){.row{margin-left:-20px;*zoom:1}.row:before,.row:after{display:table;line-height:0;content:""}.row:after{clear:both}[class*="span"]{float:left;min-height:1px;margin-left:20px}.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:724px}.span12{width:724px}.span11{width:662px}.span10{width:600px}.span9{width:538px}.span8{width:476px}.span7{width:414px}.span6{width:352px}.span5{width:290px}.span4{width:228px}.span3{width:166px}.span2{width:104px}.span1{width:42px}.offset12{margin-left:764px}.offset11{margin-left:702px}.offset10{margin-left:640px}.offset9{margin-left:578px}.offset8{margin-left:516px}.offset7{margin-left:454px}.offset6{margin-left:392px}.offset5{margin-left:330px}.offset4{margin-left:268px}.offset3{margin-left:206px}.offset2{margin-left:144px}.offset1{margin-left:82px}.row-fluid{width:100%;*zoom:1}.row-fluid:before,.row-fluid:after{display:table;line-height:0;content:""}.row-fluid:after{clear:both}.row-fluid [class*="span"]{display:block;float:left;width:100%;min-height:30px;margin-left:2.7624309392265194%;*margin-left:2.709239449864817%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="span"]:first-child{margin-left:0}.row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.7624309392265194%}.row-fluid .span12{width:100%;*width:99.94680851063829%}.row-fluid .span11{width:91.43646408839778%;*width:91.38327259903608%}.row-fluid .span10{width:82.87292817679558%;*width:82.81973668743387%}.row-fluid .span9{width:74.30939226519337%;*width:74.25620077583166%}.row-fluid .span8{width:65.74585635359117%;*width:65.69266486422946%}.row-fluid .span7{width:57.18232044198895%;*width:57.12912895262725%}.row-fluid .span6{width:48.61878453038674%;*width:48.56559304102504%}.row-fluid .span5{width:40.05524861878453%;*width:40.00205712942283%}.row-fluid .span4{width:31.491712707182323%;*width:31.43852121782062%}.row-fluid .span3{width:22.92817679558011%;*width:22.87498530621841%}.row-fluid .span2{width:14.3646408839779%;*width:14.311449394616199%}.row-fluid .span1{width:5.801104972375691%;*width:5.747913483013988%}.row-fluid .offset12{margin-left:105.52486187845304%;*margin-left:105.41847889972962%}.row-fluid .offset12:first-child{margin-left:102.76243093922652%;*margin-left:102.6560479605031%}.row-fluid .offset11{margin-left:96.96132596685082%;*margin-left:96.8549429881274%}.row-fluid .offset11:first-child{margin-left:94.1988950276243%;*margin-left:94.09251204890089%}.row-fluid .offset10{margin-left:88.39779005524862%;*margin-left:88.2914070765252%}.row-fluid .offset10:first-child{margin-left:85.6353591160221%;*margin-left:85.52897613729868%}.row-fluid .offset9{margin-left:79.8342541436464%;*margin-left:79.72787116492299%}.row-fluid .offset9:first-child{margin-left:77.07182320441989%;*margin-left:76.96544022569647%}.row-fluid .offset8{margin-left:71.2707182320442%;*margin-left:71.16433525332079%}.row-fluid .offset8:first-child{margin-left:68.50828729281768%;*margin-left:68.40190431409427%}.row-fluid .offset7{margin-left:62.70718232044199%;*margin-left:62.600799341718584%}.row-fluid .offset7:first-child{margin-left:59.94475138121547%;*margin-left:59.838368402492065%}.row-fluid .offset6{margin-left:54.14364640883978%;*margin-left:54.037263430116376%}.row-fluid .offset6:first-child{margin-left:51.38121546961326%;*margin-left:51.27483249088986%}.row-fluid .offset5{margin-left:45.58011049723757%;*margin-left:45.47372751851417%}.row-fluid .offset5:first-child{margin-left:42.81767955801105%;*margin-left:42.71129657928765%}.row-fluid .offset4{margin-left:37.01657458563536%;*margin-left:36.91019160691196%}.row-fluid .offset4:first-child{margin-left:34.25414364640884%;*margin-left:34.14776066768544%}.row-fluid .offset3{margin-left:28.45303867403315%;*margin-left:28.346655695309746%}.row-fluid .offset3:first-child{margin-left:25.69060773480663%;*margin-left:25.584224756083227%}.row-fluid .offset2{margin-left:19.88950276243094%;*margin-left:19.783119783707537%}.row-fluid .offset2:first-child{margin-left:17.12707182320442%;*margin-left:17.02068884448102%}.row-fluid .offset1{margin-left:11.32596685082873%;*margin-left:11.219583872105325%}.row-fluid .offset1:first-child{margin-left:8.56353591160221%;*margin-left:8.457152932878806%}input,textarea,.uneditable-input{margin-left:0}.controls-row [class*="span"]+[class*="span"]{margin-left:20px}input.span12,textarea.span12,.uneditable-input.span12{width:710px}input.span11,textarea.span11,.uneditable-input.span11{width:648px}input.span10,textarea.span10,.uneditable-input.span10{width:586px}input.span9,textarea.span9,.uneditable-input.span9{width:524px}input.span8,textarea.span8,.uneditable-input.span8{width:462px}input.span7,textarea.span7,.uneditable-input.span7{width:400px}input.span6,textarea.span6,.uneditable-input.span6{width:338px}input.span5,textarea.span5,.uneditable-input.span5{width:276px}input.span4,textarea.span4,.uneditable-input.span4{width:214px}input.span3,textarea.span3,.uneditable-input.span3{width:152px}input.span2,textarea.span2,.uneditable-input.span2{width:90px}input.span1,textarea.span1,.uneditable-input.span1{width:28px}}@media(max-width:767px){body{padding-right:20px;padding-left:20px}.navbar-fixed-top,.navbar-fixed-bottom,.navbar-static-top{margin-right:-20px;margin-left:-20px}.container-fluid{padding:0}.dl-horizontal dt{float:none;width:auto;clear:none;text-align:left}.dl-horizontal dd{margin-left:0}.container{width:auto}.row-fluid{width:100%}.row,.thumbnails{margin-left:0}.thumbnails>li{float:none;margin-left:0}[class*="span"],.uneditable-input[class*="span"],.row-fluid [class*="span"]{display:block;float:none;width:100%;margin-left:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.span12,.row-fluid .span12{width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="offset"]:first-child{margin-left:0}.input-large,.input-xlarge,.input-xxlarge,input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.input-prepend input,.input-append input,.input-prepend input[class*="span"],.input-append input[class*="span"]{display:inline-block;width:auto}.controls-row [class*="span"]+[class*="span"]{margin-left:0}.modal{position:fixed;top:20px;right:20px;left:20px;width:auto;margin:0}.modal.fade{top:-100px}.modal.fade.in{top:20px}}@media(max-width:480px){.nav-collapse{-webkit-transform:translate3d(0,0,0)}.page-header h1 small{display:block;line-height:20px}input[type="checkbox"],input[type="radio"]{border:1px solid #ccc}.form-horizontal .control-label{float:none;width:auto;padding-top:0;text-align:left}.form-horizontal .controls{margin-left:0}.form-horizontal .control-list{padding-top:0}.form-horizontal .form-actions{padding-right:10px;padding-left:10px}.media .pull-left,.media .pull-right{display:block;float:none;margin-bottom:10px}.media-object{margin-right:0;margin-left:0}.modal{top:10px;right:10px;left:10px}.modal-header .close{padding:10px;margin:-10px}.carousel-caption{position:static}}@media(max-width:979px){body{padding-top:0}.navbar-fixed-top,.navbar-fixed-bottom{position:static}.navbar-fixed-top{margin-bottom:20px}.navbar-fixed-bottom{margin-top:20px}.navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding:5px}.navbar .container{width:auto;padding:0}.navbar .brand{padding-right:10px;padding-left:10px;margin:0 0 0 -5px}.nav-collapse{clear:both}.nav-collapse .nav{float:none;margin:0 0 10px}.nav-collapse .nav>li{float:none}.nav-collapse .nav>li>a{margin-bottom:2px}.nav-collapse .nav>.divider-vertical{display:none}.nav-collapse .nav .nav-header{color:#777;text-shadow:none}.nav-collapse .nav>li>a,.nav-collapse .dropdown-menu a{padding:9px 15px;font-weight:bold;color:#777;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.nav-collapse .btn{padding:4px 10px 4px;font-weight:normal;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.nav-collapse .dropdown-menu li+li a{margin-bottom:2px}.nav-collapse .nav>li>a:hover,.nav-collapse .dropdown-menu a:hover{background-color:#f2f2f2}.navbar-inverse .nav-collapse .nav>li>a,.navbar-inverse .nav-collapse .dropdown-menu a{color:#999}.navbar-inverse .nav-collapse .nav>li>a:hover,.navbar-inverse .nav-collapse .dropdown-menu a:hover{background-color:#111}.nav-collapse.in .btn-group{padding:0;margin-top:5px}.nav-collapse .dropdown-menu{position:static;top:auto;left:auto;display:none;float:none;max-width:none;padding:0;margin:0 15px;background-color:transparent;border:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.nav-collapse .open>.dropdown-menu{display:block}.nav-collapse .dropdown-menu:before,.nav-collapse .dropdown-menu:after{display:none}.nav-collapse .dropdown-menu .divider{display:none}.nav-collapse .nav>li>.dropdown-menu:before,.nav-collapse .nav>li>.dropdown-menu:after{display:none}.nav-collapse .navbar-form,.nav-collapse .navbar-search{float:none;padding:10px 15px;margin:10px 0;border-top:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1)}.navbar-inverse .nav-collapse .navbar-form,.navbar-inverse .nav-collapse .navbar-search{border-top-color:#111;border-bottom-color:#111}.navbar .nav-collapse .nav.pull-right{float:none;margin-left:0}.nav-collapse,.nav-collapse.collapse{height:0;overflow:hidden}.navbar .btn-navbar{display:block}.navbar-static .navbar-inner{padding-right:10px;padding-left:10px}}@media(min-width:980px){.nav-collapse.collapse{height:auto!important;overflow:visible!important}}
     9.1 Binary file dew/src/main/resources/org/apidesign/bck2brwsr/dew/img/error.png has changed
    10.1 Binary file dew/src/main/resources/org/apidesign/bck2brwsr/dew/img/glyphicons-halflings-white.png has changed
    11.1 Binary file dew/src/main/resources/org/apidesign/bck2brwsr/dew/img/glyphicons-halflings.png has changed
    12.1 Binary file dew/src/main/resources/org/apidesign/bck2brwsr/dew/img/html5.png has changed
    13.1 Binary file dew/src/main/resources/org/apidesign/bck2brwsr/dew/img/java.png has changed
    14.1 --- a/dew/src/main/resources/org/apidesign/bck2brwsr/dew/index.html	Tue Feb 11 10:48:24 2014 +0100
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,98 +0,0 @@
    14.4 -<!--
    14.5 -To change this template, choose Tools | Templates
    14.6 -and open the template in the editor.
    14.7 --->
    14.8 -<!DOCTYPE html>
    14.9 -<html lang="en" ng-app="bck2brwsr" ng-controller="DevCtrl">
   14.10 -    <head>
   14.11 -        <title>Back2Browser - DEW</title>
   14.12 -        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   14.13 -        <meta name="viewport" content="width=device-width, initial-scale=1.0">
   14.14 -        <link rel="stylesheet" href="css/bootstrap-combined.min.css"/>  
   14.15 -        <link rel="stylesheet" href="js/codemirror/codemirror.css">
   14.16 -        <link rel="stylesheet" href="js/codemirror/theme/elegant.css"/>
   14.17 -        <link rel="stylesheet" href="css/app.css"/>
   14.18 -    </head>
   14.19 -    <body>
   14.20 -                
   14.21 -        <div class="navbar navbar-fixed-top" style="width: 100%"> 
   14.22 -        <div class="navbar-inner" style="padding-left: 12px; padding-right: 12px;">
   14.23 -            <!-- a class="brand" style="font-size: 100%"><span class="text-info"><b>Java and HTML5</b></span><small>- Together at Last!</small></a-->
   14.24 -            <form class="navbar-form pull-right">
   14.25 -                <!-- select class="span2"></select -->
   14.26 -                <button ng-click="post()" class="btn btn-warning">Rebuild</button>
   14.27 -              </form>
   14.28 -            <!-- ul class="nav">                          
   14.29 -                <li><select class="btn-small" type="text"></select></li>
   14.30 -            </ul -->
   14.31 -            <!-- form class="form form-horizontal pull-right">
   14.32 -                <button class="btn btn-warning btn-small pull-right top" ng-click="post()">Rebuild</button>
   14.33 -            </form -->
   14.34 -            <!-- ul class="nav pull-right">
   14.35 -                
   14.36 -            </ul-->     
   14.37 -        </div>  
   14.38 -        </div>
   14.39 -
   14.40 -        <div class="container-fluid">        
   14.41 -        
   14.42 -        <div style="height: 4em;">&nbsp;</div>    
   14.43 -            
   14.44 -        <div class="row-fluid">
   14.45 -            <div class="span6" style="margin-bottom: 10px;"> 
   14.46 -                <table class="table table-condensed" style="margin-bottom: 2px">
   14.47 -                <tr><td><i class="ic-html5"></i> HTML5</td></tr>               
   14.48 -                </table>
   14.49 -                <div>
   14.50 -                    <textarea ui-codemirror='{ lineNumbers : true, mode : "xml", theme : "elegant", matchBrackets : true, lineWrapping : true }' ng-model="html"></textarea>
   14.51 -                    <div class="alert alert-error" ng-show="doc.modelError">
   14.52 -                        <small>{{doc.modelError.toString()}}</small>
   14.53 -                    </div>
   14.54 -                </div>    
   14.55 -            </div>
   14.56 -            
   14.57 -            <div class="span6">  
   14.58 -                <table class="table table-condensed" style="margin-bottom: 2px">
   14.59 -                <tr><td><i class="ic-java"></i> Java</td></tr>               
   14.60 -                </table>                
   14.61 -                <div>
   14.62 -                    <textarea id="editorJava" ui-codemirror='{ lineNumbers : true, mode : "text/x-java", theme : "elegant", matchBrackets : true, lineWrapping : true, gutters: ["CodeMirror-linenumbers", "issues"] }' ng-model="java"></textarea>
   14.63 -                    <div class="alert alert-error" ng-show="doc.modelError">
   14.64 -                        <small>{{doc.modelError.toString()}}</small>
   14.65 -                    </div>
   14.66 -                </div>
   14.67 -            </div>
   14.68 -        
   14.69 -        </div>    
   14.70 -            
   14.71 -        <table class="table table-condensed">
   14.72 -            <tr ng-click="gotoError(e.line, e.col)" ng-repeat="e in errors" ng-class="errorClass(e.kind)">
   14.73 -                <td style="text-align: right">{{e.line}}</td> 
   14.74 -                <td>:</td> 
   14.75 -                <td style="text-align: left">{{e.col}}</td> 
   14.76 -                <td width="100%" class="text-error error-hover">{{e.msg}} <i class="icon-play"/></td>
   14.77 -            </tr>            
   14.78 -        </table>    
   14.79 -            
   14.80 -        
   14.81 -        <div>&nbsp;</div>    
   14.82 -            
   14.83 -        <ul class="nav nav-tabs">
   14.84 -            <li ng-class="'active'"><a href="#">Result</a></li>
   14.85 -        </ul>    
   14.86 -        
   14.87 -        
   14.88 -        <!-- button class="btn" ng-click="reload()">Reload</button -->
   14.89 -        <iframe id="result" frameborder="0" scrolling="yes" width="100%" style="height: 1000px; overflow: auto; border: 1px solid #DFDFDF;" src="result.html">
   14.90 -            <p>Your browser does not support iframes.</p>
   14.91 -        </iframe>
   14.92 -            
   14.93 -        </div>
   14.94 -        
   14.95 -        <script src="js/angular/angular.min.js"></script>
   14.96 -        <script src="js/codemirror/codemirror.js"></script>
   14.97 -        <script src="js/codemirror/mode/xml.js"></script>
   14.98 -        <script src="js/codemirror/mode/clike.js"></script>
   14.99 -        <script src="js/app.js"></script>
  14.100 -    </body>
  14.101 -</html>
    15.1 --- a/dew/src/main/resources/org/apidesign/bck2brwsr/dew/js/angular/angular.min.js	Tue Feb 11 10:48:24 2014 +0100
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,159 +0,0 @@
    15.4 -/*
    15.5 - AngularJS v1.0.3
    15.6 - (c) 2010-2012 Google, Inc. http://angularjs.org
    15.7 - License: MIT
    15.8 -*/
    15.9 -(function(U,ca,p){'use strict';function m(b,a,c){var d;if(b)if(N(b))for(d in b)d!="prototype"&&d!="length"&&d!="name"&&b.hasOwnProperty(d)&&a.call(c,b[d],d);else if(b.forEach&&b.forEach!==m)b.forEach(a,c);else if(L(b)&&wa(b.length))for(d=0;d<b.length;d++)a.call(c,b[d],d);else for(d in b)b.hasOwnProperty(d)&&a.call(c,b[d],d);return b}function lb(b){var a=[],c;for(c in b)b.hasOwnProperty(c)&&a.push(c);return a.sort()}function ec(b,a,c){for(var d=lb(b),e=0;e<d.length;e++)a.call(c,b[d[e]],d[e]);return d}
   15.10 -function mb(b){return function(a,c){b(c,a)}}function xa(){for(var b=Z.length,a;b;){b--;a=Z[b].charCodeAt(0);if(a==57)return Z[b]="A",Z.join("");if(a==90)Z[b]="0";else return Z[b]=String.fromCharCode(a+1),Z.join("")}Z.unshift("0");return Z.join("")}function x(b){m(arguments,function(a){a!==b&&m(a,function(a,d){b[d]=a})});return b}function G(b){return parseInt(b,10)}function ya(b,a){return x(new (x(function(){},{prototype:b})),a)}function D(){}function ma(b){return b}function I(b){return function(){return b}}
   15.11 -function t(b){return typeof b=="undefined"}function v(b){return typeof b!="undefined"}function L(b){return b!=null&&typeof b=="object"}function F(b){return typeof b=="string"}function wa(b){return typeof b=="number"}function na(b){return Sa.apply(b)=="[object Date]"}function J(b){return Sa.apply(b)=="[object Array]"}function N(b){return typeof b=="function"}function oa(b){return b&&b.document&&b.location&&b.alert&&b.setInterval}function R(b){return F(b)?b.replace(/^\s*/,"").replace(/\s*$/,""):b}function fc(b){return b&&
   15.12 -(b.nodeName||b.bind&&b.find)}function Ta(b,a,c){var d=[];m(b,function(b,g,i){d.push(a.call(c,b,g,i))});return d}function gc(b,a){var c=0,d;if(J(b)||F(b))return b.length;else if(L(b))for(d in b)(!a||b.hasOwnProperty(d))&&c++;return c}function za(b,a){if(b.indexOf)return b.indexOf(a);for(var c=0;c<b.length;c++)if(a===b[c])return c;return-1}function Ua(b,a){var c=za(b,a);c>=0&&b.splice(c,1);return a}function V(b,a){if(oa(b)||b&&b.$evalAsync&&b.$watch)throw B("Can't copy Window or Scope");if(a){if(b===
   15.13 -a)throw B("Can't copy equivalent objects or arrays");if(J(b)){for(;a.length;)a.pop();for(var c=0;c<b.length;c++)a.push(V(b[c]))}else for(c in m(a,function(b,c){delete a[c]}),b)a[c]=V(b[c])}else(a=b)&&(J(b)?a=V(b,[]):na(b)?a=new Date(b.getTime()):L(b)&&(a=V(b,{})));return a}function hc(b,a){var a=a||{},c;for(c in b)b.hasOwnProperty(c)&&c.substr(0,2)!=="$$"&&(a[c]=b[c]);return a}function ha(b,a){if(b===a)return!0;if(b===null||a===null)return!1;if(b!==b&&a!==a)return!0;var c=typeof b,d;if(c==typeof a&&
   15.14 -c=="object")if(J(b)){if((c=b.length)==a.length){for(d=0;d<c;d++)if(!ha(b[d],a[d]))return!1;return!0}}else if(na(b))return na(a)&&b.getTime()==a.getTime();else{if(b&&b.$evalAsync&&b.$watch||a&&a.$evalAsync&&a.$watch||oa(b)||oa(a))return!1;c={};for(d in b){if(d.charAt(0)!=="$"&&!N(b[d])&&!ha(b[d],a[d]))return!1;c[d]=!0}for(d in a)if(!c[d]&&d.charAt(0)!=="$"&&!N(a[d]))return!1;return!0}return!1}function Va(b,a){var c=arguments.length>2?ia.call(arguments,2):[];return N(a)&&!(a instanceof RegExp)?c.length?
   15.15 -function(){return arguments.length?a.apply(b,c.concat(ia.call(arguments,0))):a.apply(b,c)}:function(){return arguments.length?a.apply(b,arguments):a.call(b)}:a}function ic(b,a){var c=a;/^\$+/.test(b)?c=p:oa(a)?c="$WINDOW":a&&ca===a?c="$DOCUMENT":a&&a.$evalAsync&&a.$watch&&(c="$SCOPE");return c}function da(b,a){return JSON.stringify(b,ic,a?"  ":null)}function nb(b){return F(b)?JSON.parse(b):b}function Wa(b){b&&b.length!==0?(b=E(""+b),b=!(b=="f"||b=="0"||b=="false"||b=="no"||b=="n"||b=="[]")):b=!1;
   15.16 -return b}function pa(b){b=u(b).clone();try{b.html("")}catch(a){}return u("<div>").append(b).html().match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(a,b){return"<"+E(b)})}function Xa(b){var a={},c,d;m((b||"").split("&"),function(b){b&&(c=b.split("="),d=decodeURIComponent(c[0]),a[d]=v(c[1])?decodeURIComponent(c[1]):!0)});return a}function ob(b){var a=[];m(b,function(b,d){a.push(Ya(d,!0)+(b===!0?"":"="+Ya(b,!0)))});return a.length?a.join("&"):""}function Za(b){return Ya(b,!0).replace(/%26/gi,"&").replace(/%3D/gi,
   15.17 -"=").replace(/%2B/gi,"+")}function Ya(b,a){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(a?null:/%20/g,"+")}function jc(b,a){function c(a){a&&d.push(a)}var d=[b],e,g,i=["ng:app","ng-app","x-ng-app","data-ng-app"],f=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;m(i,function(a){i[a]=!0;c(ca.getElementById(a));a=a.replace(":","\\:");b.querySelectorAll&&(m(b.querySelectorAll("."+a),c),m(b.querySelectorAll("."+a+"\\:"),c),m(b.querySelectorAll("["+
   15.18 -a+"]"),c))});m(d,function(a){if(!e){var b=f.exec(" "+a.className+" ");b?(e=a,g=(b[2]||"").replace(/\s+/g,",")):m(a.attributes,function(b){if(!e&&i[b.name])e=a,g=b.value})}});e&&a(e,g?[g]:[])}function pb(b,a){b=u(b);a=a||[];a.unshift(["$provide",function(a){a.value("$rootElement",b)}]);a.unshift("ng");var c=qb(a);c.invoke(["$rootScope","$rootElement","$compile","$injector",function(a,b,c,i){a.$apply(function(){b.data("$injector",i);c(b)(a)})}]);return c}function $a(b,a){a=a||"_";return b.replace(kc,
   15.19 -function(b,d){return(d?a:"")+b.toLowerCase()})}function qa(b,a,c){if(!b)throw new B("Argument '"+(a||"?")+"' is "+(c||"required"));return b}function ra(b,a,c){c&&J(b)&&(b=b[b.length-1]);qa(N(b),a,"not a function, got "+(b&&typeof b=="object"?b.constructor.name||"Object":typeof b));return b}function lc(b){function a(a,b,e){return a[b]||(a[b]=e())}return a(a(b,"angular",Object),"module",function(){var b={};return function(d,e,g){e&&b.hasOwnProperty(d)&&(b[d]=null);return a(b,d,function(){function a(c,
   15.20 -d,e){return function(){b[e||"push"]([c,d,arguments]);return j}}if(!e)throw B("No module: "+d);var b=[],c=[],k=a("$injector","invoke"),j={_invokeQueue:b,_runBlocks:c,requires:e,name:d,provider:a("$provide","provider"),factory:a("$provide","factory"),service:a("$provide","service"),value:a("$provide","value"),constant:a("$provide","constant","unshift"),filter:a("$filterProvider","register"),controller:a("$controllerProvider","register"),directive:a("$compileProvider","directive"),config:k,run:function(a){c.push(a);
   15.21 -return this}};g&&k(g);return j})}})}function rb(b){return b.replace(mc,function(a,b,d,e){return e?d.toUpperCase():d}).replace(nc,"Moz$1")}function ab(b,a){function c(){var e;for(var b=[this],c=a,i,f,h,k,j,l;b.length;){i=b.shift();f=0;for(h=i.length;f<h;f++){k=u(i[f]);c?k.triggerHandler("$destroy"):c=!c;j=0;for(e=(l=k.children()).length,k=e;j<k;j++)b.push(ja(l[j]))}}return d.apply(this,arguments)}var d=ja.fn[b],d=d.$original||d;c.$original=d;ja.fn[b]=c}function Q(b){if(b instanceof Q)return b;if(!(this instanceof
   15.22 -Q)){if(F(b)&&b.charAt(0)!="<")throw B("selectors not implemented");return new Q(b)}if(F(b)){var a=ca.createElement("div");a.innerHTML="<div>&#160;</div>"+b;a.removeChild(a.firstChild);bb(this,a.childNodes);this.remove()}else bb(this,b)}function cb(b){return b.cloneNode(!0)}function sa(b){sb(b);for(var a=0,b=b.childNodes||[];a<b.length;a++)sa(b[a])}function tb(b,a,c){var d=$(b,"events");$(b,"handle")&&(t(a)?m(d,function(a,c){db(b,c,a);delete d[c]}):t(c)?(db(b,a,d[a]),delete d[a]):Ua(d[a],c))}function sb(b){var a=
   15.23 -b[Aa],c=Ba[a];c&&(c.handle&&(c.events.$destroy&&c.handle({},"$destroy"),tb(b)),delete Ba[a],b[Aa]=p)}function $(b,a,c){var d=b[Aa],d=Ba[d||-1];if(v(c))d||(b[Aa]=d=++oc,d=Ba[d]={}),d[a]=c;else return d&&d[a]}function ub(b,a,c){var d=$(b,"data"),e=v(c),g=!e&&v(a),i=g&&!L(a);!d&&!i&&$(b,"data",d={});if(e)d[a]=c;else if(g)if(i)return d&&d[a];else x(d,a);else return d}function Ca(b,a){return(" "+b.className+" ").replace(/[\n\t]/g," ").indexOf(" "+a+" ")>-1}function vb(b,a){a&&m(a.split(" "),function(a){b.className=
   15.24 -R((" "+b.className+" ").replace(/[\n\t]/g," ").replace(" "+R(a)+" "," "))})}function wb(b,a){a&&m(a.split(" "),function(a){if(!Ca(b,a))b.className=R(b.className+" "+R(a))})}function bb(b,a){if(a)for(var a=!a.nodeName&&v(a.length)&&!oa(a)?a:[a],c=0;c<a.length;c++)b.push(a[c])}function xb(b,a){return Da(b,"$"+(a||"ngController")+"Controller")}function Da(b,a,c){b=u(b);for(b[0].nodeType==9&&(b=b.find("html"));b.length;){if(c=b.data(a))return c;b=b.parent()}}function yb(b,a){var c=Ea[a.toLowerCase()];
   15.25 -return c&&zb[b.nodeName]&&c}function pc(b,a){var c=function(c,e){if(!c.preventDefault)c.preventDefault=function(){c.returnValue=!1};if(!c.stopPropagation)c.stopPropagation=function(){c.cancelBubble=!0};if(!c.target)c.target=c.srcElement||ca;if(t(c.defaultPrevented)){var g=c.preventDefault;c.preventDefault=function(){c.defaultPrevented=!0;g.call(c)};c.defaultPrevented=!1}c.isDefaultPrevented=function(){return c.defaultPrevented};m(a[e||c.type],function(a){a.call(b,c)});aa<=8?(c.preventDefault=null,
   15.26 -c.stopPropagation=null,c.isDefaultPrevented=null):(delete c.preventDefault,delete c.stopPropagation,delete c.isDefaultPrevented)};c.elem=b;return c}function ga(b){var a=typeof b,c;if(a=="object"&&b!==null)if(typeof(c=b.$$hashKey)=="function")c=b.$$hashKey();else{if(c===p)c=b.$$hashKey=xa()}else c=b;return a+":"+c}function Fa(b){m(b,this.put,this)}function eb(){}function Ab(b){var a,c;if(typeof b=="function"){if(!(a=b.$inject))a=[],c=b.toString().replace(qc,""),c=c.match(rc),m(c[1].split(sc),function(b){b.replace(tc,
   15.27 -function(b,c,d){a.push(d)})}),b.$inject=a}else J(b)?(c=b.length-1,ra(b[c],"fn"),a=b.slice(0,c)):ra(b,"fn",!0);return a}function qb(b){function a(a){return function(b,c){if(L(b))m(b,mb(a));else return a(b,c)}}function c(a,b){N(b)&&(b=l.instantiate(b));if(!b.$get)throw B("Provider "+a+" must define $get factory method.");return j[a+f]=b}function d(a,b){return c(a,{$get:b})}function e(a){var b=[];m(a,function(a){if(!k.get(a))if(k.put(a,!0),F(a)){var c=ta(a);b=b.concat(e(c.requires)).concat(c._runBlocks);
   15.28 -try{for(var d=c._invokeQueue,c=0,f=d.length;c<f;c++){var h=d[c],g=h[0]=="$injector"?l:l.get(h[0]);g[h[1]].apply(g,h[2])}}catch(n){throw n.message&&(n.message+=" from "+a),n;}}else if(N(a))try{b.push(l.invoke(a))}catch(i){throw i.message&&(i.message+=" from "+a),i;}else if(J(a))try{b.push(l.invoke(a))}catch(j){throw j.message&&(j.message+=" from "+String(a[a.length-1])),j;}else ra(a,"module")});return b}function g(a,b){function c(d){if(typeof d!=="string")throw B("Service name expected");if(a.hasOwnProperty(d)){if(a[d]===
   15.29 -i)throw B("Circular dependency: "+h.join(" <- "));return a[d]}else try{return h.unshift(d),a[d]=i,a[d]=b(d)}finally{h.shift()}}function d(a,b,e){var f=[],k=Ab(a),g,n,i;n=0;for(g=k.length;n<g;n++)i=k[n],f.push(e&&e.hasOwnProperty(i)?e[i]:c(i,h));a.$inject||(a=a[g]);switch(b?-1:f.length){case 0:return a();case 1:return a(f[0]);case 2:return a(f[0],f[1]);case 3:return a(f[0],f[1],f[2]);case 4:return a(f[0],f[1],f[2],f[3]);case 5:return a(f[0],f[1],f[2],f[3],f[4]);case 6:return a(f[0],f[1],f[2],f[3],
   15.30 -f[4],f[5]);case 7:return a(f[0],f[1],f[2],f[3],f[4],f[5],f[6]);case 8:return a(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7]);case 9:return a(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8]);case 10:return a(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9]);default:return a.apply(b,f)}}return{invoke:d,instantiate:function(a,b){var c=function(){},e;c.prototype=(J(a)?a[a.length-1]:a).prototype;c=new c;e=d(a,c,b);return L(e)?e:c},get:c,annotate:Ab}}var i={},f="Provider",h=[],k=new Fa,j={$provide:{provider:a(c),
   15.31 -factory:a(d),service:a(function(a,b){return d(a,["$injector",function(a){return a.instantiate(b)}])}),value:a(function(a,b){return d(a,I(b))}),constant:a(function(a,b){j[a]=b;o[a]=b}),decorator:function(a,b){var c=l.get(a+f),d=c.$get;c.$get=function(){var a=r.invoke(d,c);return r.invoke(b,null,{$delegate:a})}}}},l=g(j,function(){throw B("Unknown provider: "+h.join(" <- "));}),o={},r=o.$injector=g(o,function(a){a=l.get(a+f);return r.invoke(a.$get,a)});m(e(b),function(a){r.invoke(a||D)});return r}function uc(){var b=
   15.32 -!0;this.disableAutoScrolling=function(){b=!1};this.$get=["$window","$location","$rootScope",function(a,c,d){function e(a){var b=null;m(a,function(a){!b&&E(a.nodeName)==="a"&&(b=a)});return b}function g(){var b=c.hash(),d;b?(d=i.getElementById(b))?d.scrollIntoView():(d=e(i.getElementsByName(b)))?d.scrollIntoView():b==="top"&&a.scrollTo(0,0):a.scrollTo(0,0)}var i=a.document;b&&d.$watch(function(){return c.hash()},function(){d.$evalAsync(g)});return g}]}function vc(b,a,c,d){function e(a){try{a.apply(null,
   15.33 -ia.call(arguments,1))}finally{if(n--,n===0)for(;w.length;)try{w.pop()()}catch(b){c.error(b)}}}function g(a,b){(function ea(){m(q,function(a){a()});s=b(ea,a)})()}function i(){O!=f.url()&&(O=f.url(),m(A,function(a){a(f.url())}))}var f=this,h=a[0],k=b.location,j=b.history,l=b.setTimeout,o=b.clearTimeout,r={};f.isMock=!1;var n=0,w=[];f.$$completeOutstandingRequest=e;f.$$incOutstandingRequestCount=function(){n++};f.notifyWhenNoOutstandingRequests=function(a){m(q,function(a){a()});n===0?a():w.push(a)};
   15.34 -var q=[],s;f.addPollFn=function(a){t(s)&&g(100,l);q.push(a);return a};var O=k.href,C=a.find("base");f.url=function(a,b){if(a){if(O!=a)return O=a,d.history?b?j.replaceState(null,"",a):(j.pushState(null,"",a),C.attr("href",C.attr("href"))):b?k.replace(a):k.href=a,f}else return k.href.replace(/%27/g,"'")};var A=[],K=!1;f.onUrlChange=function(a){K||(d.history&&u(b).bind("popstate",i),d.hashchange?u(b).bind("hashchange",i):f.addPollFn(i),K=!0);A.push(a);return a};f.baseHref=function(){var a=C.attr("href");
   15.35 -return a?a.replace(/^https?\:\/\/[^\/]*/,""):a};var W={},y="",M=f.baseHref();f.cookies=function(a,b){var d,e,f,k;if(a)if(b===p)h.cookie=escape(a)+"=;path="+M+";expires=Thu, 01 Jan 1970 00:00:00 GMT";else{if(F(b))d=(h.cookie=escape(a)+"="+escape(b)+";path="+M).length+1,d>4096&&c.warn("Cookie '"+a+"' possibly not set or overflowed because it was too large ("+d+" > 4096 bytes)!"),W.length>20&&c.warn("Cookie '"+a+"' possibly not set or overflowed because too many cookies were already set ("+W.length+
   15.36 -" > 20 )")}else{if(h.cookie!==y){y=h.cookie;d=y.split("; ");W={};for(f=0;f<d.length;f++)e=d[f],k=e.indexOf("="),k>0&&(W[unescape(e.substring(0,k))]=unescape(e.substring(k+1)))}return W}};f.defer=function(a,b){var c;n++;c=l(function(){delete r[c];e(a)},b||0);r[c]=!0;return c};f.defer.cancel=function(a){return r[a]?(delete r[a],o(a),e(D),!0):!1}}function wc(){this.$get=["$window","$log","$sniffer","$document",function(b,a,c,d){return new vc(b,d,a,c)}]}function xc(){this.$get=function(){function b(b,
   15.37 -d){function e(a){if(a!=l){if(o){if(o==a)o=a.n}else o=a;g(a.n,a.p);g(a,l);l=a;l.n=null}}function g(a,b){if(a!=b){if(a)a.p=b;if(b)b.n=a}}if(b in a)throw B("cacheId "+b+" taken");var i=0,f=x({},d,{id:b}),h={},k=d&&d.capacity||Number.MAX_VALUE,j={},l=null,o=null;return a[b]={put:function(a,b){var c=j[a]||(j[a]={key:a});e(c);t(b)||(a in h||i++,h[a]=b,i>k&&this.remove(o.key))},get:function(a){var b=j[a];if(b)return e(b),h[a]},remove:function(a){var b=j[a];if(b){if(b==l)l=b.p;if(b==o)o=b.n;g(b.n,b.p);delete j[a];
   15.38 -delete h[a];i--}},removeAll:function(){h={};i=0;j={};l=o=null},destroy:function(){j=f=h=null;delete a[b]},info:function(){return x({},f,{size:i})}}}var a={};b.info=function(){var b={};m(a,function(a,e){b[e]=a.info()});return b};b.get=function(b){return a[b]};return b}}function yc(){this.$get=["$cacheFactory",function(b){return b("templates")}]}function Bb(b){var a={},c="Directive",d=/^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,e=/(([\d\w\-_]+)(?:\:([^;]+))?;?)/,g="Template must have exactly one root element. was: ";
   15.39 -this.directive=function f(d,e){F(d)?(qa(e,"directive"),a.hasOwnProperty(d)||(a[d]=[],b.factory(d+c,["$injector","$exceptionHandler",function(b,c){var e=[];m(a[d],function(a){try{var f=b.invoke(a);if(N(f))f={compile:I(f)};else if(!f.compile&&f.link)f.compile=I(f.link);f.priority=f.priority||0;f.name=f.name||d;f.require=f.require||f.controller&&f.name;f.restrict=f.restrict||"A";e.push(f)}catch(k){c(k)}});return e}])),a[d].push(e)):m(d,mb(f));return this};this.$get=["$injector","$interpolate","$exceptionHandler",
   15.40 -"$http","$templateCache","$parse","$controller","$rootScope",function(b,h,k,j,l,o,r,n){function w(a,b,c){a instanceof u||(a=u(a));m(a,function(b,c){b.nodeType==3&&(a[c]=u(b).wrap("<span></span>").parent()[0])});var d=s(a,b,a,c);return function(b,c){qa(b,"scope");var e=c?ua.clone.call(a):a;e.data("$scope",b);q(e,"ng-scope");c&&c(e,b);d&&d(b,e,e);return e}}function q(a,b){try{a.addClass(b)}catch(c){}}function s(a,b,c,d){function e(a,c,d,k){for(var g,h,j,n,o,l=0,r=0,q=f.length;l<q;r++)j=c[r],g=f[l++],
   15.41 -h=f[l++],g?(g.scope?(n=a.$new(L(g.scope)),u(j).data("$scope",n)):n=a,(o=g.transclude)||!k&&b?g(h,n,j,d,function(b){return function(c){var d=a.$new();return b(d,c).bind("$destroy",Va(d,d.$destroy))}}(o||b)):g(h,n,j,p,k)):h&&h(a,j.childNodes,p,k)}for(var f=[],k,g,h,j=0;j<a.length;j++)g=new ea,k=O(a[j],[],g,d),g=(k=k.length?C(k,a[j],g,b,c):null)&&k.terminal||!a[j].childNodes.length?null:s(a[j].childNodes,k?k.transclude:b),f.push(k),f.push(g),h=h||k||g;return h?e:null}function O(a,b,c,f){var k=c.$attr,
   15.42 -g;switch(a.nodeType){case 1:A(b,fa(Cb(a).toLowerCase()),"E",f);var h,j,n;g=a.attributes;for(var o=0,l=g&&g.length;o<l;o++)if(h=g[o],h.specified)j=h.name,n=fa(j.toLowerCase()),k[n]=j,c[n]=h=R(aa&&j=="href"?decodeURIComponent(a.getAttribute(j,2)):h.value),yb(a,n)&&(c[n]=!0),X(a,b,h,n),A(b,n,"A",f);a=a.className;if(F(a)&&a!=="")for(;g=e.exec(a);)n=fa(g[2]),A(b,n,"C",f)&&(c[n]=R(g[3])),a=a.substr(g.index+g[0].length);break;case 3:H(b,a.nodeValue);break;case 8:try{if(g=d.exec(a.nodeValue))n=fa(g[1]),A(b,
   15.43 -n,"M",f)&&(c[n]=R(g[2]))}catch(r){}}b.sort(y);return b}function C(a,b,c,d,e){function f(a,b){if(a)a.require=z.require,l.push(a);if(b)b.require=z.require,ba.push(b)}function h(a,b){var c,d="data",e=!1;if(F(a)){for(;(c=a.charAt(0))=="^"||c=="?";)a=a.substr(1),c=="^"&&(d="inheritedData"),e=e||c=="?";c=b[d]("$"+a+"Controller");if(!c&&!e)throw B("No controller: "+a);}else J(a)&&(c=[],m(a,function(a){c.push(h(a,b))}));return c}function j(a,d,e,f,g){var n,q,w,K,s;n=b===e?c:hc(c,new ea(u(e),c.$attr));q=n.$$element;
   15.44 -if(C){var zc=/^\s*([@=&])\s*(\w*)\s*$/,O=d.$parent||d;m(C.scope,function(a,b){var c=a.match(zc)||[],e=c[2]||b,f,g,k;switch(c[1]){case "@":n.$observe(e,function(a){d[b]=a});n.$$observers[e].$$scope=O;break;case "=":g=o(n[e]);k=g.assign||function(){f=d[b]=g(O);throw B(Db+n[e]+" (directive: "+C.name+")");};f=d[b]=g(O);d.$watch(function(){var a=g(O);a!==d[b]&&(a!==f?f=d[b]=a:k(O,a=f=d[b]));return a});break;case "&":g=o(n[e]);d[b]=function(a){return g(O,a)};break;default:throw B("Invalid isolate scope definition for directive "+
   15.45 -C.name+": "+a);}})}t&&m(t,function(a){var b={$scope:d,$element:q,$attrs:n,$transclude:g};s=a.controller;s=="@"&&(s=n[a.name]);q.data("$"+a.name+"Controller",r(s,b))});f=0;for(w=l.length;f<w;f++)try{K=l[f],K(d,q,n,K.require&&h(K.require,q))}catch(y){k(y,pa(q))}a&&a(d,e.childNodes,p,g);f=0;for(w=ba.length;f<w;f++)try{K=ba[f],K(d,q,n,K.require&&h(K.require,q))}catch(Ha){k(Ha,pa(q))}}for(var n=-Number.MAX_VALUE,l=[],ba=[],s=null,C=null,A=null,y=c.$$element=u(b),z,H,X,D,v=d,t,x,Y,E=0,G=a.length;E<G;E++){z=
   15.46 -a[E];X=p;if(n>z.priority)break;if(Y=z.scope)M("isolated scope",C,z,y),L(Y)&&(q(y,"ng-isolate-scope"),C=z),q(y,"ng-scope"),s=s||z;H=z.name;if(Y=z.controller)t=t||{},M("'"+H+"' controller",t[H],z,y),t[H]=z;if(Y=z.transclude)M("transclusion",D,z,y),D=z,n=z.priority,Y=="element"?(X=u(b),y=c.$$element=u("<\!-- "+H+": "+c[H]+" --\>"),b=y[0],Ga(e,u(X[0]),b),v=w(X,d,n)):(X=u(cb(b)).contents(),y.html(""),v=w(X,d));if(Y=z.template)if(M("template",A,z,y),A=z,Y=Ha(Y),z.replace){X=u("<div>"+R(Y)+"</div>").contents();
   15.47 -b=X[0];if(X.length!=1||b.nodeType!==1)throw new B(g+Y);Ga(e,y,b);H={$attr:{}};a=a.concat(O(b,a.splice(E+1,a.length-(E+1)),H));K(c,H);G=a.length}else y.html(Y);if(z.templateUrl)M("template",A,z,y),A=z,j=W(a.splice(E,a.length-E),j,y,c,e,z.replace,v),G=a.length;else if(z.compile)try{x=z.compile(y,c,v),N(x)?f(null,x):x&&f(x.pre,x.post)}catch(I){k(I,pa(y))}if(z.terminal)j.terminal=!0,n=Math.max(n,z.priority)}j.scope=s&&s.scope;j.transclude=D&&v;return j}function A(d,e,g,h){var j=!1;if(a.hasOwnProperty(e))for(var n,
   15.48 -e=b.get(e+c),o=0,l=e.length;o<l;o++)try{if(n=e[o],(h===p||h>n.priority)&&n.restrict.indexOf(g)!=-1)d.push(n),j=!0}catch(r){k(r)}return j}function K(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;m(a,function(d,e){e.charAt(0)!="$"&&(b[e]&&(d+=(e==="style"?";":" ")+b[e]),a.$set(e,d,!0,c[e]))});m(b,function(b,f){f=="class"?(q(e,b),a["class"]=(a["class"]?a["class"]+" ":"")+b):f=="style"?e.attr("style",e.attr("style")+";"+b):f.charAt(0)!="$"&&!a.hasOwnProperty(f)&&(a[f]=b,d[f]=c[f])})}function W(a,b,c,d,e,
   15.49 -f,k){var h=[],n,o,r=c[0],q=a.shift(),w=x({},q,{controller:null,templateUrl:null,transclude:null,scope:null});c.html("");j.get(q.templateUrl,{cache:l}).success(function(j){var l,q,j=Ha(j);if(f){q=u("<div>"+R(j)+"</div>").contents();l=q[0];if(q.length!=1||l.nodeType!==1)throw new B(g+j);j={$attr:{}};Ga(e,c,l);O(l,a,j);K(d,j)}else l=r,c.html(j);a.unshift(w);n=C(a,c,d,k);for(o=s(c.contents(),k);h.length;){var ba=h.pop(),j=h.pop();q=h.pop();var y=h.pop(),m=l;q!==r&&(m=cb(l),Ga(j,u(q),m));n(function(){b(o,
   15.50 -y,m,e,ba)},y,m,e,ba)}h=null}).error(function(a,b,c,d){throw B("Failed to load template: "+d.url);});return function(a,c,d,e,f){h?(h.push(c),h.push(d),h.push(e),h.push(f)):n(function(){b(o,c,d,e,f)},c,d,e,f)}}function y(a,b){return b.priority-a.priority}function M(a,b,c,d){if(b)throw B("Multiple directives ["+b.name+", "+c.name+"] asking for "+a+" on: "+pa(d));}function H(a,b){var c=h(b,!0);c&&a.push({priority:0,compile:I(function(a,b){var d=b.parent(),e=d.data("$binding")||[];e.push(c);q(d.data("$binding",
   15.51 -e),"ng-binding");a.$watch(c,function(a){b[0].nodeValue=a})})})}function X(a,b,c,d){var e=h(c,!0);e&&b.push({priority:100,compile:I(function(a,b,c){b=c.$$observers||(c.$$observers={});d==="class"&&(e=h(c[d],!0));c[d]=p;(b[d]||(b[d]=[])).$$inter=!0;(c.$$observers&&c.$$observers[d].$$scope||a).$watch(e,function(a){c.$set(d,a)})})})}function Ga(a,b,c){var d=b[0],e=d.parentNode,f,g;if(a){f=0;for(g=a.length;f<g;f++)if(a[f]==d){a[f]=c;break}}e&&e.replaceChild(c,d);c[u.expando]=d[u.expando];b[0]=c}var ea=
   15.52 -function(a,b){this.$$element=a;this.$attr=b||{}};ea.prototype={$normalize:fa,$set:function(a,b,c,d){var e=yb(this.$$element[0],a),f=this.$$observers;e&&(this.$$element.prop(a,b),d=e);this[a]=b;d?this.$attr[a]=d:(d=this.$attr[a])||(this.$attr[a]=d=$a(a,"-"));c!==!1&&(b===null||b===p?this.$$element.removeAttr(d):this.$$element.attr(d,b));f&&m(f[a],function(a){try{a(b)}catch(c){k(c)}})},$observe:function(a,b){var c=this,d=c.$$observers||(c.$$observers={}),e=d[a]||(d[a]=[]);e.push(b);n.$evalAsync(function(){e.$$inter||
   15.53 -b(c[a])});return b}};var D=h.startSymbol(),ba=h.endSymbol(),Ha=D=="{{"||ba=="}}"?ma:function(a){return a.replace(/\{\{/g,D).replace(/}}/g,ba)};return w}]}function fa(b){return rb(b.replace(Ac,""))}function Bc(){var b={};this.register=function(a,c){L(a)?x(b,a):b[a]=c};this.$get=["$injector","$window",function(a,c){return function(d,e){if(F(d)){var g=d,d=b.hasOwnProperty(g)?b[g]:fb(e.$scope,g,!0)||fb(c,g,!0);ra(d,g,!0)}return a.instantiate(d,e)}}]}function Cc(){this.$get=["$window",function(b){return u(b.document)}]}
   15.54 -function Dc(){this.$get=["$log",function(b){return function(a,c){b.error.apply(b,arguments)}}]}function Ec(){var b="{{",a="}}";this.startSymbol=function(a){return a?(b=a,this):b};this.endSymbol=function(b){return b?(a=b,this):a};this.$get=["$parse",function(c){function d(d,f){for(var h,k,j=0,l=[],o=d.length,r=!1,n=[];j<o;)(h=d.indexOf(b,j))!=-1&&(k=d.indexOf(a,h+e))!=-1?(j!=h&&l.push(d.substring(j,h)),l.push(j=c(r=d.substring(h+e,k))),j.exp=r,j=k+g,r=!0):(j!=o&&l.push(d.substring(j)),j=o);if(!(o=
   15.55 -l.length))l.push(""),o=1;if(!f||r)return n.length=o,j=function(a){for(var b=0,c=o,d;b<c;b++){if(typeof(d=l[b])=="function")d=d(a),d==null||d==p?d="":typeof d!="string"&&(d=da(d));n[b]=d}return n.join("")},j.exp=d,j.parts=l,j}var e=b.length,g=a.length;d.startSymbol=function(){return b};d.endSymbol=function(){return a};return d}]}function Eb(b){for(var b=b.split("/"),a=b.length;a--;)b[a]=Za(b[a]);return b.join("/")}function va(b,a){var c=Fb.exec(b),c={protocol:c[1],host:c[3],port:G(c[5])||Gb[c[1]]||
   15.56 -null,path:c[6]||"/",search:c[8],hash:c[10]};if(a)a.$$protocol=c.protocol,a.$$host=c.host,a.$$port=c.port;return c}function ka(b,a,c){return b+"://"+a+(c==Gb[b]?"":":"+c)}function Fc(b,a,c){var d=va(b);return decodeURIComponent(d.path)!=a||t(d.hash)||d.hash.indexOf(c)!==0?b:ka(d.protocol,d.host,d.port)+a.substr(0,a.lastIndexOf("/"))+d.hash.substr(c.length)}function Gc(b,a,c){var d=va(b);if(decodeURIComponent(d.path)==a)return b;else{var e=d.search&&"?"+d.search||"",g=d.hash&&"#"+d.hash||"",i=a.substr(0,
   15.57 -a.lastIndexOf("/")),f=d.path.substr(i.length);if(d.path.indexOf(i)!==0)throw B('Invalid url "'+b+'", missing path prefix "'+i+'" !');return ka(d.protocol,d.host,d.port)+a+"#"+c+f+e+g}}function gb(b,a,c){a=a||"";this.$$parse=function(b){var c=va(b,this);if(c.path.indexOf(a)!==0)throw B('Invalid url "'+b+'", missing path prefix "'+a+'" !');this.$$path=decodeURIComponent(c.path.substr(a.length));this.$$search=Xa(c.search);this.$$hash=c.hash&&decodeURIComponent(c.hash)||"";this.$$compose()};this.$$compose=
   15.58 -function(){var b=ob(this.$$search),c=this.$$hash?"#"+Za(this.$$hash):"";this.$$url=Eb(this.$$path)+(b?"?"+b:"")+c;this.$$absUrl=ka(this.$$protocol,this.$$host,this.$$port)+a+this.$$url};this.$$rewriteAppUrl=function(a){if(a.indexOf(c)==0)return a};this.$$parse(b)}function Ia(b,a,c){var d;this.$$parse=function(b){var c=va(b,this);if(c.hash&&c.hash.indexOf(a)!==0)throw B('Invalid url "'+b+'", missing hash prefix "'+a+'" !');d=c.path+(c.search?"?"+c.search:"");c=Hc.exec((c.hash||"").substr(a.length));
   15.59 -this.$$path=c[1]?(c[1].charAt(0)=="/"?"":"/")+decodeURIComponent(c[1]):"";this.$$search=Xa(c[3]);this.$$hash=c[5]&&decodeURIComponent(c[5])||"";this.$$compose()};this.$$compose=function(){var b=ob(this.$$search),c=this.$$hash?"#"+Za(this.$$hash):"";this.$$url=Eb(this.$$path)+(b?"?"+b:"")+c;this.$$absUrl=ka(this.$$protocol,this.$$host,this.$$port)+d+(this.$$url?"#"+a+this.$$url:"")};this.$$rewriteAppUrl=function(a){if(a.indexOf(c)==0)return a};this.$$parse(b)}function Hb(b,a,c,d){Ia.apply(this,arguments);
   15.60 -this.$$rewriteAppUrl=function(b){if(b.indexOf(c)==0)return c+d+"#"+a+b.substr(c.length)}}function Ja(b){return function(){return this[b]}}function Ib(b,a){return function(c){if(t(c))return this[b];this[b]=a(c);this.$$compose();return this}}function Ic(){var b="",a=!1;this.hashPrefix=function(a){return v(a)?(b=a,this):b};this.html5Mode=function(b){return v(b)?(a=b,this):a};this.$get=["$rootScope","$browser","$sniffer","$rootElement",function(c,d,e,g){function i(a){c.$broadcast("$locationChangeSuccess",
   15.61 -f.absUrl(),a)}var f,h,k,j=d.url(),l=va(j);a?(h=d.baseHref()||"/",k=h.substr(0,h.lastIndexOf("/")),l=ka(l.protocol,l.host,l.port)+k+"/",f=e.history?new gb(Fc(j,h,b),k,l):new Hb(Gc(j,h,b),b,l,h.substr(k.length+1))):(l=ka(l.protocol,l.host,l.port)+(l.path||"")+(l.search?"?"+l.search:"")+"#"+b+"/",f=new Ia(j,b,l));g.bind("click",function(a){if(!a.ctrlKey&&!(a.metaKey||a.which==2)){for(var b=u(a.target);E(b[0].nodeName)!=="a";)if(b[0]===g[0]||!(b=b.parent())[0])return;var d=b.prop("href"),e=f.$$rewriteAppUrl(d);
   15.62 -d&&!b.attr("target")&&e&&(f.$$parse(e),c.$apply(),a.preventDefault(),U.angular["ff-684208-preventDefault"]=!0)}});f.absUrl()!=j&&d.url(f.absUrl(),!0);d.onUrlChange(function(a){f.absUrl()!=a&&(c.$evalAsync(function(){var b=f.absUrl();f.$$parse(a);i(b)}),c.$$phase||c.$digest())});var o=0;c.$watch(function(){var a=d.url(),b=f.$$replace;if(!o||a!=f.absUrl())o++,c.$evalAsync(function(){c.$broadcast("$locationChangeStart",f.absUrl(),a).defaultPrevented?f.$$parse(a):(d.url(f.absUrl(),b),i(a))});f.$$replace=
   15.63 -!1;return o});return f}]}function Jc(){this.$get=["$window",function(b){function a(a){a instanceof B&&(a.stack?a=a.message&&a.stack.indexOf(a.message)===-1?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function c(c){var e=b.console||{},g=e[c]||e.log||D;return g.apply?function(){var b=[];m(arguments,function(c){b.push(a(c))});return g.apply(e,b)}:function(a,b){g(a,b)}}return{log:c("log"),warn:c("warn"),info:c("info"),error:c("error")}}]}function Kc(b,
   15.64 -a){function c(a){return a.indexOf(q)!=-1}function d(){return n+1<b.length?b.charAt(n+1):!1}function e(a){return"0"<=a&&a<="9"}function g(a){return a==" "||a=="\r"||a=="\t"||a=="\n"||a=="\u000b"||a=="\u00a0"}function i(a){return"a"<=a&&a<="z"||"A"<=a&&a<="Z"||"_"==a||a=="$"}function f(a){return a=="-"||a=="+"||e(a)}function h(a,c,d){d=d||n;throw B("Lexer Error: "+a+" at column"+(v(c)?"s "+c+"-"+n+" ["+b.substring(c,d)+"]":" "+d)+" in expression ["+b+"].");}function k(){for(var a="",c=n;n<b.length;){var k=
   15.65 -E(b.charAt(n));if(k=="."||e(k))a+=k;else{var g=d();if(k=="e"&&f(g))a+=k;else if(f(k)&&g&&e(g)&&a.charAt(a.length-1)=="e")a+=k;else if(f(k)&&(!g||!e(g))&&a.charAt(a.length-1)=="e")h("Invalid exponent");else break}n++}a*=1;o.push({index:c,text:a,json:!0,fn:function(){return a}})}function j(){for(var c="",d=n,f,k,h;n<b.length;){var j=b.charAt(n);if(j=="."||i(j)||e(j))j=="."&&(f=n),c+=j;else break;n++}if(f)for(k=n;k<b.length;){j=b.charAt(k);if(j=="("){h=c.substr(f-d+1);c=c.substr(0,f-d);n=k;break}if(g(j))k++;
   15.66 -else break}d={index:d,text:c};if(Ka.hasOwnProperty(c))d.fn=d.json=Ka[c];else{var l=Jb(c,a);d.fn=x(function(a,b){return l(a,b)},{assign:function(a,b){return Kb(a,c,b)}})}o.push(d);h&&(o.push({index:f,text:".",json:!1}),o.push({index:f+1,text:h,json:!1}))}function l(a){var c=n;n++;for(var d="",e=a,f=!1;n<b.length;){var k=b.charAt(n);e+=k;if(f)k=="u"?(k=b.substring(n+1,n+5),k.match(/[\da-f]{4}/i)||h("Invalid unicode escape [\\u"+k+"]"),n+=4,d+=String.fromCharCode(parseInt(k,16))):(f=Lc[k],d+=f?f:k),
   15.67 -f=!1;else if(k=="\\")f=!0;else if(k==a){n++;o.push({index:c,text:e,string:d,json:!0,fn:function(){return d}});return}else d+=k;n++}h("Unterminated quote",c)}for(var o=[],r,n=0,w=[],q,s=":";n<b.length;){q=b.charAt(n);if(c("\"'"))l(q);else if(e(q)||c(".")&&e(d()))k();else if(i(q)){if(j(),"{,".indexOf(s)!=-1&&w[0]=="{"&&(r=o[o.length-1]))r.json=r.text.indexOf(".")==-1}else if(c("(){}[].,;:"))o.push({index:n,text:q,json:":[,".indexOf(s)!=-1&&c("{[")||c("}]:,")}),c("{[")&&w.unshift(q),c("}]")&&w.shift(),
   15.68 -n++;else if(g(q)){n++;continue}else{var m=q+d(),C=Ka[q],A=Ka[m];A?(o.push({index:n,text:m,fn:A}),n+=2):C?(o.push({index:n,text:q,fn:C,json:"[,:".indexOf(s)!=-1&&c("+-")}),n+=1):h("Unexpected next character ",n,n+1)}s=q}return o}function Mc(b,a,c,d){function e(a,c){throw B("Syntax Error: Token '"+c.text+"' "+a+" at column "+(c.index+1)+" of the expression ["+b+"] starting at ["+b.substring(c.index)+"].");}function g(){if(M.length===0)throw B("Unexpected end of expression: "+b);return M[0]}function i(a,
   15.69 -b,c,d){if(M.length>0){var e=M[0],f=e.text;if(f==a||f==b||f==c||f==d||!a&&!b&&!c&&!d)return e}return!1}function f(b,c,d,f){return(b=i(b,c,d,f))?(a&&!b.json&&e("is not valid json",b),M.shift(),b):!1}function h(a){f(a)||e("is unexpected, expecting ["+a+"]",i())}function k(a,b){return function(c,d){return a(c,d,b)}}function j(a,b,c){return function(d,e){return b(d,e,a,c)}}function l(){for(var a=[];;)if(M.length>0&&!i("}",")",";","]")&&a.push(v()),!f(";"))return a.length==1?a[0]:function(b,c){for(var d,
   15.70 -e=0;e<a.length;e++){var f=a[e];f&&(d=f(b,c))}return d}}function o(){for(var a=f(),b=c(a.text),d=[];;)if(a=f(":"))d.push(H());else{var e=function(a,c,e){for(var e=[e],f=0;f<d.length;f++)e.push(d[f](a,c));return b.apply(a,e)};return function(){return e}}}function r(){for(var a=n(),b;;)if(b=f("||"))a=j(a,b.fn,n());else return a}function n(){var a=w(),b;if(b=f("&&"))a=j(a,b.fn,n());return a}function w(){var a=q(),b;if(b=f("==","!="))a=j(a,b.fn,w());return a}function q(){var a;a=s();for(var b;b=f("+",
   15.71 -"-");)a=j(a,b.fn,s());if(b=f("<",">","<=",">="))a=j(a,b.fn,q());return a}function s(){for(var a=m(),b;b=f("*","/","%");)a=j(a,b.fn,m());return a}function m(){var a;return f("+")?C():(a=f("-"))?j(W,a.fn,m()):(a=f("!"))?k(a.fn,m()):C()}function C(){var a;if(f("("))a=v(),h(")");else if(f("["))a=A();else if(f("{"))a=K();else{var b=f();(a=b.fn)||e("not a primary expression",b)}for(var c;b=f("(","[",".");)b.text==="("?(a=u(a,c),c=null):b.text==="["?(c=a,a=ea(a)):b.text==="."?(c=a,a=t(a)):e("IMPOSSIBLE");
   15.72 -return a}function A(){var a=[];if(g().text!="]"){do a.push(H());while(f(","))}h("]");return function(b,c){for(var d=[],e=0;e<a.length;e++)d.push(a[e](b,c));return d}}function K(){var a=[];if(g().text!="}"){do{var b=f(),b=b.string||b.text;h(":");var c=H();a.push({key:b,value:c})}while(f(","))}h("}");return function(b,c){for(var d={},e=0;e<a.length;e++){var f=a[e],k=f.value(b,c);d[f.key]=k}return d}}var W=I(0),y,M=Kc(b,d),H=function(){var a=r(),c,d;return(d=f("="))?(a.assign||e("implies assignment but ["+
   15.73 -b.substring(0,d.index)+"] can not be assigned to",d),c=r(),function(b,d){return a.assign(b,c(b,d),d)}):a},u=function(a,b){var c=[];if(g().text!=")"){do c.push(H());while(f(","))}h(")");return function(d,e){for(var f=[],k=b?b(d,e):d,h=0;h<c.length;h++)f.push(c[h](d,e));h=a(d,e)||D;return h.apply?h.apply(k,f):h(f[0],f[1],f[2],f[3],f[4])}},t=function(a){var b=f().text,c=Jb(b,d);return x(function(b,d){return c(a(b,d),d)},{assign:function(c,d,e){return Kb(a(c,e),b,d)}})},ea=function(a){var b=H();h("]");
   15.74 -return x(function(c,d){var e=a(c,d),f=b(c,d),k;if(!e)return p;if((e=e[f])&&e.then){k=e;if(!("$$v"in e))k.$$v=p,k.then(function(a){k.$$v=a});e=e.$$v}return e},{assign:function(c,d,e){return a(c,e)[b(c,e)]=d}})},v=function(){for(var a=H(),b;;)if(b=f("|"))a=j(a,b.fn,o());else return a};a?(H=r,u=t=ea=v=function(){e("is not valid json",{text:b,index:0})},y=C()):y=l();M.length!==0&&e("is an unexpected token",M[0]);return y}function Kb(b,a,c){for(var a=a.split("."),d=0;a.length>1;d++){var e=a.shift(),g=
   15.75 -b[e];g||(g={},b[e]=g);b=g}return b[a.shift()]=c}function fb(b,a,c){if(!a)return b;for(var a=a.split("."),d,e=b,g=a.length,i=0;i<g;i++)d=a[i],b&&(b=(e=b)[d]);return!c&&N(b)?Va(e,b):b}function Lb(b,a,c,d,e){return function(g,i){var f=i&&i.hasOwnProperty(b)?i:g,h;if(f===null||f===p)return f;if((f=f[b])&&f.then){if(!("$$v"in f))h=f,h.$$v=p,h.then(function(a){h.$$v=a});f=f.$$v}if(!a||f===null||f===p)return f;if((f=f[a])&&f.then){if(!("$$v"in f))h=f,h.$$v=p,h.then(function(a){h.$$v=a});f=f.$$v}if(!c||f===
   15.76 -null||f===p)return f;if((f=f[c])&&f.then){if(!("$$v"in f))h=f,h.$$v=p,h.then(function(a){h.$$v=a});f=f.$$v}if(!d||f===null||f===p)return f;if((f=f[d])&&f.then){if(!("$$v"in f))h=f,h.$$v=p,h.then(function(a){h.$$v=a});f=f.$$v}if(!e||f===null||f===p)return f;if((f=f[e])&&f.then){if(!("$$v"in f))h=f,h.$$v=p,h.then(function(a){h.$$v=a});f=f.$$v}return f}}function Jb(b,a){if(hb.hasOwnProperty(b))return hb[b];var c=b.split("."),d=c.length,e;if(a)e=d<6?Lb(c[0],c[1],c[2],c[3],c[4]):function(a,b){var e=0,
   15.77 -k;do k=Lb(c[e++],c[e++],c[e++],c[e++],c[e++])(a,b),b=p,a=k;while(e<d);return k};else{var g="var l, fn, p;\n";m(c,function(a,b){g+="if(s === null || s === undefined) return s;\nl=s;\ns="+(b?"s":'((k&&k.hasOwnProperty("'+a+'"))?k:s)')+'["'+a+'"];\nif (s && s.then) {\n if (!("$$v" in s)) {\n p=s;\n p.$$v = undefined;\n p.then(function(v) {p.$$v=v;});\n}\n s=s.$$v\n}\n'});g+="return s;";e=Function("s","k",g);e.toString=function(){return g}}return hb[b]=e}function Nc(){var b={};this.$get=["$filter","$sniffer",
   15.78 -function(a,c){return function(d){switch(typeof d){case "string":return b.hasOwnProperty(d)?b[d]:b[d]=Mc(d,!1,a,c.csp);case "function":return d;default:return D}}}]}function Oc(){this.$get=["$rootScope","$exceptionHandler",function(b,a){return Pc(function(a){b.$evalAsync(a)},a)}]}function Pc(b,a){function c(a){return a}function d(a){return i(a)}var e=function(){var f=[],h,k;return k={resolve:function(a){if(f){var c=f;f=p;h=g(a);c.length&&b(function(){for(var a,b=0,d=c.length;b<d;b++)a=c[b],h.then(a[0],
   15.79 -a[1])})}},reject:function(a){k.resolve(i(a))},promise:{then:function(b,k){var g=e(),i=function(d){try{g.resolve((b||c)(d))}catch(e){a(e),g.reject(e)}},n=function(b){try{g.resolve((k||d)(b))}catch(c){a(c),g.reject(c)}};f?f.push([i,n]):h.then(i,n);return g.promise}}}},g=function(a){return a&&a.then?a:{then:function(c){var d=e();b(function(){d.resolve(c(a))});return d.promise}}},i=function(a){return{then:function(c,k){var g=e();b(function(){g.resolve((k||d)(a))});return g.promise}}};return{defer:e,reject:i,
   15.80 -when:function(f,h,k){var j=e(),l,o=function(b){try{return(h||c)(b)}catch(d){return a(d),i(d)}},r=function(b){try{return(k||d)(b)}catch(c){return a(c),i(c)}};b(function(){g(f).then(function(a){l||(l=!0,j.resolve(g(a).then(o,r)))},function(a){l||(l=!0,j.resolve(r(a)))})});return j.promise},all:function(a){var b=e(),c=a.length,d=[];c?m(a,function(a,e){g(a).then(function(a){e in d||(d[e]=a,--c||b.resolve(d))},function(a){e in d||b.reject(a)})}):b.resolve(d);return b.promise}}}function Qc(){var b={};this.when=
   15.81 -function(a,c){b[a]=x({reloadOnSearch:!0},c);if(a){var d=a[a.length-1]=="/"?a.substr(0,a.length-1):a+"/";b[d]={redirectTo:a}}return this};this.otherwise=function(a){this.when(null,a);return this};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$http","$templateCache",function(a,c,d,e,g,i,f){function h(){var b=k(),h=r.current;if(b&&h&&b.$route===h.$route&&ha(b.pathParams,h.pathParams)&&!b.reloadOnSearch&&!o)h.params=b.params,V(h.params,d),a.$broadcast("$routeUpdate",h);else if(b||
   15.82 -h)o=!1,a.$broadcast("$routeChangeStart",b,h),(r.current=b)&&b.redirectTo&&(F(b.redirectTo)?c.path(j(b.redirectTo,b.params)).search(b.params).replace():c.url(b.redirectTo(b.pathParams,c.path(),c.search())).replace()),e.when(b).then(function(){if(b){var a=[],c=[],d;m(b.resolve||{},function(b,d){a.push(d);c.push(F(b)?g.get(b):g.invoke(b))});if(!v(d=b.template))if(v(d=b.templateUrl))d=i.get(d,{cache:f}).then(function(a){return a.data});v(d)&&(a.push("$template"),c.push(d));return e.all(c).then(function(b){var c=
   15.83 -{};m(b,function(b,d){c[a[d]]=b});return c})}}).then(function(c){if(b==r.current){if(b)b.locals=c,V(b.params,d);a.$broadcast("$routeChangeSuccess",b,h)}},function(c){b==r.current&&a.$broadcast("$routeChangeError",b,h,c)})}function k(){var a,d;m(b,function(b,e){if(!d&&(a=l(c.path(),e)))d=ya(b,{params:x({},c.search(),a),pathParams:a}),d.$route=b});return d||b[null]&&ya(b[null],{params:{},pathParams:{}})}function j(a,b){var c=[];m((a||"").split(":"),function(a,d){if(d==0)c.push(a);else{var e=a.match(/(\w+)(.*)/),
   15.84 -f=e[1];c.push(b[f]);c.push(e[2]||"");delete b[f]}});return c.join("")}var l=function(a,b){var c="^"+b.replace(/([\.\\\(\)\^\$])/g,"\\$1")+"$",d=[],e={};m(b.split(/\W/),function(a){if(a){var b=RegExp(":"+a+"([\\W])");c.match(b)&&(c=c.replace(b,"([^\\/]*)$1"),d.push(a))}});var f=a.match(RegExp(c));f&&m(d,function(a,b){e[a]=f[b+1]});return f?e:null},o=!1,r={routes:b,reload:function(){o=!0;a.$evalAsync(h)}};a.$on("$locationChangeSuccess",h);return r}]}function Rc(){this.$get=I({})}function Sc(){var b=
   15.85 -10;this.digestTtl=function(a){arguments.length&&(b=a);return b};this.$get=["$injector","$exceptionHandler","$parse",function(a,c,d){function e(){this.$id=xa();this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null;this["this"]=this.$root=this;this.$$asyncQueue=[];this.$$listeners={}}function g(a){if(h.$$phase)throw B(h.$$phase+" already in progress");h.$$phase=a}function i(a,b){var c=d(a);ra(c,b);return c}function f(){}e.prototype={$new:function(a){if(N(a))throw B("API-CHANGE: Use $controller to instantiate controllers.");
   15.86 -a?(a=new e,a.$root=this.$root):(a=function(){},a.prototype=this,a=new a,a.$id=xa());a["this"]=a;a.$$listeners={};a.$parent=this;a.$$asyncQueue=[];a.$$watchers=a.$$nextSibling=a.$$childHead=a.$$childTail=null;a.$$prevSibling=this.$$childTail;this.$$childHead?this.$$childTail=this.$$childTail.$$nextSibling=a:this.$$childHead=this.$$childTail=a;return a},$watch:function(a,b,c){var d=i(a,"watch"),e=this.$$watchers,g={fn:b,last:f,get:d,exp:a,eq:!!c};if(!N(b)){var h=i(b||D,"listener");g.fn=function(a,b,
   15.87 -c){h(c)}}if(!e)e=this.$$watchers=[];e.unshift(g);return function(){Ua(e,g)}},$digest:function(){var a,d,e,i,r,n,m,q=b,s,p=[],C,A;g("$digest");do{m=!1;s=this;do{for(r=s.$$asyncQueue;r.length;)try{s.$eval(r.shift())}catch(K){c(K)}if(i=s.$$watchers)for(n=i.length;n--;)try{if(a=i[n],(d=a.get(s))!==(e=a.last)&&!(a.eq?ha(d,e):typeof d=="number"&&typeof e=="number"&&isNaN(d)&&isNaN(e)))m=!0,a.last=a.eq?V(d):d,a.fn(d,e===f?d:e,s),q<5&&(C=4-q,p[C]||(p[C]=[]),A=N(a.exp)?"fn: "+(a.exp.name||a.exp.toString()):
   15.88 -a.exp,A+="; newVal: "+da(d)+"; oldVal: "+da(e),p[C].push(A))}catch(W){c(W)}if(!(i=s.$$childHead||s!==this&&s.$$nextSibling))for(;s!==this&&!(i=s.$$nextSibling);)s=s.$parent}while(s=i);if(m&&!q--)throw h.$$phase=null,B(b+" $digest() iterations reached. Aborting!\nWatchers fired in the last 5 iterations: "+da(p));}while(m||r.length);h.$$phase=null},$destroy:function(){if(h!=this){var a=this.$parent;this.$broadcast("$destroy");if(a.$$childHead==this)a.$$childHead=this.$$nextSibling;if(a.$$childTail==
   15.89 -this)a.$$childTail=this.$$prevSibling;if(this.$$prevSibling)this.$$prevSibling.$$nextSibling=this.$$nextSibling;if(this.$$nextSibling)this.$$nextSibling.$$prevSibling=this.$$prevSibling;this.$parent=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null}},$eval:function(a,b){return d(a)(this,b)},$evalAsync:function(a){this.$$asyncQueue.push(a)},$apply:function(a){try{return g("$apply"),this.$eval(a)}catch(b){c(b)}finally{h.$$phase=null;try{h.$digest()}catch(d){throw c(d),d;}}},
   15.90 -$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);return function(){c[za(c,b)]=null}},$emit:function(a,b){var d=[],e,f=this,g=!1,h={name:a,targetScope:f,stopPropagation:function(){g=!0},preventDefault:function(){h.defaultPrevented=!0},defaultPrevented:!1},i=[h].concat(ia.call(arguments,1)),m,p;do{e=f.$$listeners[a]||d;h.currentScope=f;m=0;for(p=e.length;m<p;m++)if(e[m])try{if(e[m].apply(null,i),g)return h}catch(C){c(C)}else e.splice(m,1),m--,p--;f=f.$parent}while(f);
   15.91 -return h},$broadcast:function(a,b){var d=this,e=this,f={name:a,targetScope:this,preventDefault:function(){f.defaultPrevented=!0},defaultPrevented:!1},g=[f].concat(ia.call(arguments,1)),h,i;do{d=e;f.currentScope=d;e=d.$$listeners[a]||[];h=0;for(i=e.length;h<i;h++)if(e[h])try{e[h].apply(null,g)}catch(m){c(m)}else e.splice(h,1),h--,i--;if(!(e=d.$$childHead||d!==this&&d.$$nextSibling))for(;d!==this&&!(e=d.$$nextSibling);)d=d.$parent}while(d=e);return f}};var h=new e;return h}]}function Tc(){this.$get=
   15.92 -["$window",function(b){var a={},c=G((/android (\d+)/.exec(E(b.navigator.userAgent))||[])[1]);return{history:!(!b.history||!b.history.pushState||c<4),hashchange:"onhashchange"in b&&(!b.document.documentMode||b.document.documentMode>7),hasEvent:function(c){if(c=="input"&&aa==9)return!1;if(t(a[c])){var e=b.document.createElement("div");a[c]="on"+c in e}return a[c]},csp:!1}}]}function Uc(){this.$get=I(U)}function Mb(b){var a={},c,d,e;if(!b)return a;m(b.split("\n"),function(b){e=b.indexOf(":");c=E(R(b.substr(0,
   15.93 -e)));d=R(b.substr(e+1));c&&(a[c]?a[c]+=", "+d:a[c]=d)});return a}function Nb(b){var a=L(b)?b:p;return function(c){a||(a=Mb(b));return c?a[E(c)]||null:a}}function Ob(b,a,c){if(N(c))return c(b,a);m(c,function(c){b=c(b,a)});return b}function Vc(){var b=/^\s*(\[|\{[^\{])/,a=/[\}\]]\s*$/,c=/^\)\]\}',?\n/,d=this.defaults={transformResponse:[function(d){F(d)&&(d=d.replace(c,""),b.test(d)&&a.test(d)&&(d=nb(d,!0)));return d}],transformRequest:[function(a){return L(a)&&Sa.apply(a)!=="[object File]"?da(a):a}],
   15.94 -headers:{common:{Accept:"application/json, text/plain, */*","X-Requested-With":"XMLHttpRequest"},post:{"Content-Type":"application/json;charset=utf-8"},put:{"Content-Type":"application/json;charset=utf-8"}}},e=this.responseInterceptors=[];this.$get=["$httpBackend","$browser","$cacheFactory","$rootScope","$q","$injector",function(a,b,c,h,k,j){function l(a){function c(a){var b=x({},a,{data:Ob(a.data,a.headers,f)});return 200<=a.status&&a.status<300?b:k.reject(b)}a.method=la(a.method);var e=a.transformRequest||
   15.95 -d.transformRequest,f=a.transformResponse||d.transformResponse,h=d.headers,h=x({"X-XSRF-TOKEN":b.cookies()["XSRF-TOKEN"]},h.common,h[E(a.method)],a.headers),e=Ob(a.data,Nb(h),e),g;t(a.data)&&delete h["Content-Type"];g=o(a,e,h);g=g.then(c,c);m(w,function(a){g=a(g)});g.success=function(b){g.then(function(c){b(c.data,c.status,c.headers,a)});return g};g.error=function(b){g.then(null,function(c){b(c.data,c.status,c.headers,a)});return g};return g}function o(b,c,d){function e(a,b,c){m&&(200<=a&&a<300?m.put(w,
   15.96 -[a,b,Mb(c)]):m.remove(w));f(b,a,c);h.$apply()}function f(a,c,d){c=Math.max(c,0);(200<=c&&c<300?j.resolve:j.reject)({data:a,status:c,headers:Nb(d),config:b})}function i(){var a=za(l.pendingRequests,b);a!==-1&&l.pendingRequests.splice(a,1)}var j=k.defer(),o=j.promise,m,p,w=r(b.url,b.params);l.pendingRequests.push(b);o.then(i,i);b.cache&&b.method=="GET"&&(m=L(b.cache)?b.cache:n);if(m)if(p=m.get(w))if(p.then)return p.then(i,i),p;else J(p)?f(p[1],p[0],V(p[2])):f(p,200,{});else m.put(w,o);p||a(b.method,
   15.97 -w,c,e,d,b.timeout,b.withCredentials);return o}function r(a,b){if(!b)return a;var c=[];ec(b,function(a,b){a==null||a==p||(L(a)&&(a=da(a)),c.push(encodeURIComponent(b)+"="+encodeURIComponent(a)))});return a+(a.indexOf("?")==-1?"?":"&")+c.join("&")}var n=c("$http"),w=[];m(e,function(a){w.push(F(a)?j.get(a):j.invoke(a))});l.pendingRequests=[];(function(a){m(arguments,function(a){l[a]=function(b,c){return l(x(c||{},{method:a,url:b}))}})})("get","delete","head","jsonp");(function(a){m(arguments,function(a){l[a]=
   15.98 -function(b,c,d){return l(x(d||{},{method:a,url:b,data:c}))}})})("post","put");l.defaults=d;return l}]}function Wc(){this.$get=["$browser","$window","$document",function(b,a,c){return Xc(b,Yc,b.defer,a.angular.callbacks,c[0],a.location.protocol.replace(":",""))}]}function Xc(b,a,c,d,e,g){function i(a,b){var c=e.createElement("script"),d=function(){e.body.removeChild(c);b&&b()};c.type="text/javascript";c.src=a;aa?c.onreadystatechange=function(){/loaded|complete/.test(c.readyState)&&d()}:c.onload=c.onerror=
   15.99 -d;e.body.appendChild(c)}return function(e,h,k,j,l,o,r){function n(a,c,d,e){c=(h.match(Fb)||["",g])[1]=="file"?d?200:404:c;a(c==1223?204:c,d,e);b.$$completeOutstandingRequest(D)}b.$$incOutstandingRequestCount();h=h||b.url();if(E(e)=="jsonp"){var p="_"+(d.counter++).toString(36);d[p]=function(a){d[p].data=a};i(h.replace("JSON_CALLBACK","angular.callbacks."+p),function(){d[p].data?n(j,200,d[p].data):n(j,-2);delete d[p]})}else{var q=new a;q.open(e,h,!0);m(l,function(a,b){a&&q.setRequestHeader(b,a)});
  15.100 -var s;q.onreadystatechange=function(){q.readyState==4&&n(j,s||q.status,q.responseText,q.getAllResponseHeaders())};if(r)q.withCredentials=!0;q.send(k||"");o>0&&c(function(){s=-1;q.abort()},o)}}}function Zc(){this.$get=function(){return{id:"en-us",NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,maxFrac:3,posPre:"",posSuf:"",negPre:"-",negSuf:"",gSize:3,lgSize:3},{minInt:1,minFrac:2,maxFrac:2,posPre:"\u00a4",posSuf:"",negPre:"(\u00a4",negSuf:")",gSize:3,lgSize:3}],CURRENCY_SYM:"$"},
  15.101 -DATETIME_FORMATS:{MONTH:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),SHORTMONTH:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),DAY:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),SHORTDAY:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(","),AMPMS:["AM","PM"],medium:"MMM d, y h:mm:ss a","short":"M/d/yy h:mm a",fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",mediumDate:"MMM d, y",shortDate:"M/d/yy",mediumTime:"h:mm:ss a",
  15.102 -shortTime:"h:mm a"},pluralCat:function(b){return b===1?"one":"other"}}}}function $c(){this.$get=["$rootScope","$browser","$q","$exceptionHandler",function(b,a,c,d){function e(e,f,h){var k=c.defer(),j=k.promise,l=v(h)&&!h,f=a.defer(function(){try{k.resolve(e())}catch(a){k.reject(a),d(a)}l||b.$apply()},f),h=function(){delete g[j.$$timeoutId]};j.$$timeoutId=f;g[f]=k;j.then(h,h);return j}var g={};e.cancel=function(b){return b&&b.$$timeoutId in g?(g[b.$$timeoutId].reject("canceled"),a.defer.cancel(b.$$timeoutId)):
  15.103 -!1};return e}]}function Pb(b){function a(a,e){return b.factory(a+c,e)}var c="Filter";this.register=a;this.$get=["$injector",function(a){return function(b){return a.get(b+c)}}];a("currency",Qb);a("date",Rb);a("filter",ad);a("json",bd);a("limitTo",cd);a("lowercase",dd);a("number",Sb);a("orderBy",Tb);a("uppercase",ed)}function ad(){return function(b,a){if(!(b instanceof Array))return b;var c=[];c.check=function(a){for(var b=0;b<c.length;b++)if(!c[b](a))return!1;return!0};var d=function(a,b){if(b.charAt(0)===
  15.104 -"!")return!d(a,b.substr(1));switch(typeof a){case "boolean":case "number":case "string":return(""+a).toLowerCase().indexOf(b)>-1;case "object":for(var c in a)if(c.charAt(0)!=="$"&&d(a[c],b))return!0;return!1;case "array":for(c=0;c<a.length;c++)if(d(a[c],b))return!0;return!1;default:return!1}};switch(typeof a){case "boolean":case "number":case "string":a={$:a};case "object":for(var e in a)e=="$"?function(){var b=(""+a[e]).toLowerCase();b&&c.push(function(a){return d(a,b)})}():function(){var b=e,f=
  15.105 -(""+a[e]).toLowerCase();f&&c.push(function(a){return d(fb(a,b),f)})}();break;case "function":c.push(a);break;default:return b}for(var g=[],i=0;i<b.length;i++){var f=b[i];c.check(f)&&g.push(f)}return g}}function Qb(b){var a=b.NUMBER_FORMATS;return function(b,d){if(t(d))d=a.CURRENCY_SYM;return Ub(b,a.PATTERNS[1],a.GROUP_SEP,a.DECIMAL_SEP,2).replace(/\u00A4/g,d)}}function Sb(b){var a=b.NUMBER_FORMATS;return function(b,d){return Ub(b,a.PATTERNS[0],a.GROUP_SEP,a.DECIMAL_SEP,d)}}function Ub(b,a,c,d,e){if(isNaN(b)||
  15.106 -!isFinite(b))return"";var g=b<0,b=Math.abs(b),i=b+"",f="",h=[],k=!1;if(i.indexOf("e")!==-1){var j=i.match(/([\d\.]+)e(-?)(\d+)/);j&&j[2]=="-"&&j[3]>e+1?i="0":(f=i,k=!0)}if(!k){i=(i.split(Vb)[1]||"").length;t(e)&&(e=Math.min(Math.max(a.minFrac,i),a.maxFrac));var i=Math.pow(10,e),b=Math.round(b*i)/i,b=(""+b).split(Vb),i=b[0],b=b[1]||"",k=0,j=a.lgSize,l=a.gSize;if(i.length>=j+l)for(var k=i.length-j,o=0;o<k;o++)(k-o)%l===0&&o!==0&&(f+=c),f+=i.charAt(o);for(o=k;o<i.length;o++)(i.length-o)%j===0&&o!==0&&
  15.107 -(f+=c),f+=i.charAt(o);for(;b.length<e;)b+="0";e&&(f+=d+b.substr(0,e))}h.push(g?a.negPre:a.posPre);h.push(f);h.push(g?a.negSuf:a.posSuf);return h.join("")}function ib(b,a,c){var d="";b<0&&(d="-",b=-b);for(b=""+b;b.length<a;)b="0"+b;c&&(b=b.substr(b.length-a));return d+b}function P(b,a,c,d){return function(e){e=e["get"+b]();if(c>0||e>-c)e+=c;e===0&&c==-12&&(e=12);return ib(e,a,d)}}function La(b,a){return function(c,d){var e=c["get"+b](),g=la(a?"SHORT"+b:b);return d[g][e]}}function Rb(b){function a(a){var b;
  15.108 -if(b=a.match(c)){var a=new Date(0),g=0,i=0;b[9]&&(g=G(b[9]+b[10]),i=G(b[9]+b[11]));a.setUTCFullYear(G(b[1]),G(b[2])-1,G(b[3]));a.setUTCHours(G(b[4]||0)-g,G(b[5]||0)-i,G(b[6]||0),G(b[7]||0))}return a}var c=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(c,e){var g="",i=[],f,h,e=e||"mediumDate",e=b.DATETIME_FORMATS[e]||e;F(c)&&(c=fd.test(c)?G(c):a(c));wa(c)&&(c=new Date(c));if(!na(c))return c;for(;e;)(h=gd.exec(e))?(i=i.concat(ia.call(h,
  15.109 -1)),e=i.pop()):(i.push(e),e=null);m(i,function(a){f=hd[a];g+=f?f(c,b.DATETIME_FORMATS):a.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function bd(){return function(b){return da(b,!0)}}function cd(){return function(b,a){if(!(b instanceof Array))return b;var a=G(a),c=[],d,e;if(!b||!(b instanceof Array))return c;a>b.length?a=b.length:a<-b.length&&(a=-b.length);a>0?(d=0,e=a):(d=b.length+a,e=b.length);for(;d<e;d++)c.push(b[d]);return c}}function Tb(b){return function(a,c,d){function e(a,b){return Wa(b)?
  15.110 -function(b,c){return a(c,b)}:a}if(!(a instanceof Array))return a;if(!c)return a;for(var c=J(c)?c:[c],c=Ta(c,function(a){var c=!1,d=a||ma;if(F(a)){if(a.charAt(0)=="+"||a.charAt(0)=="-")c=a.charAt(0)=="-",a=a.substring(1);d=b(a)}return e(function(a,b){var c;c=d(a);var e=d(b),f=typeof c,g=typeof e;f==g?(f=="string"&&(c=c.toLowerCase()),f=="string"&&(e=e.toLowerCase()),c=c===e?0:c<e?-1:1):c=f<g?-1:1;return c},c)}),g=[],i=0;i<a.length;i++)g.push(a[i]);return g.sort(e(function(a,b){for(var d=0;d<c.length;d++){var e=
  15.111 -c[d](a,b);if(e!==0)return e}return 0},d))}}function S(b){N(b)&&(b={link:b});b.restrict=b.restrict||"AC";return I(b)}function Wb(b,a){function c(a,c){c=c?"-"+$a(c,"-"):"";b.removeClass((a?Ma:Na)+c).addClass((a?Na:Ma)+c)}var d=this,e=b.parent().controller("form")||Oa,g=0,i=d.$error={};d.$name=a.name;d.$dirty=!1;d.$pristine=!0;d.$valid=!0;d.$invalid=!1;e.$addControl(d);b.addClass(Pa);c(!0);d.$addControl=function(a){a.$name&&!d.hasOwnProperty(a.$name)&&(d[a.$name]=a)};d.$removeControl=function(a){a.$name&&
  15.112 -d[a.$name]===a&&delete d[a.$name];m(i,function(b,c){d.$setValidity(c,!0,a)})};d.$setValidity=function(a,b,k){var j=i[a];if(b){if(j&&(Ua(j,k),!j.length)){g--;if(!g)c(b),d.$valid=!0,d.$invalid=!1;i[a]=!1;c(!0,a);e.$setValidity(a,!0,d)}}else{g||c(b);if(j){if(za(j,k)!=-1)return}else i[a]=j=[],g++,c(!1,a),e.$setValidity(a,!1,d);j.push(k);d.$valid=!1;d.$invalid=!0}};d.$setDirty=function(){b.removeClass(Pa).addClass(Xb);d.$dirty=!0;d.$pristine=!1;e.$setDirty()}}function T(b){return t(b)||b===""||b===null||
  15.113 -b!==b}function Qa(b,a,c,d,e,g){var i=function(){var c=R(a.val());d.$viewValue!==c&&b.$apply(function(){d.$setViewValue(c)})};if(e.hasEvent("input"))a.bind("input",i);else{var f;a.bind("keydown",function(a){a=a.keyCode;a===91||15<a&&a<19||37<=a&&a<=40||f||(f=g.defer(function(){i();f=null}))});a.bind("change",i)}d.$render=function(){a.val(T(d.$viewValue)?"":d.$viewValue)};var h=c.ngPattern,k=function(a,b){return T(b)||a.test(b)?(d.$setValidity("pattern",!0),b):(d.$setValidity("pattern",!1),p)};h&&(h.match(/^\/(.*)\/$/)?
  15.114 -(h=RegExp(h.substr(1,h.length-2)),e=function(a){return k(h,a)}):e=function(a){var c=b.$eval(h);if(!c||!c.test)throw new B("Expected "+h+" to be a RegExp but was "+c);return k(c,a)},d.$formatters.push(e),d.$parsers.push(e));if(c.ngMinlength){var j=G(c.ngMinlength),e=function(a){return!T(a)&&a.length<j?(d.$setValidity("minlength",!1),p):(d.$setValidity("minlength",!0),a)};d.$parsers.push(e);d.$formatters.push(e)}if(c.ngMaxlength){var l=G(c.ngMaxlength),c=function(a){return!T(a)&&a.length>l?(d.$setValidity("maxlength",
  15.115 -!1),p):(d.$setValidity("maxlength",!0),a)};d.$parsers.push(c);d.$formatters.push(c)}}function jb(b,a){b="ngClass"+b;return S(function(c,d,e){function g(b,d){if(a===!0||c.$index%2===a)d&&b!==d&&i(d),f(b)}function i(a){L(a)&&!J(a)&&(a=Ta(a,function(a,b){if(a)return b}));d.removeClass(J(a)?a.join(" "):a)}function f(a){L(a)&&!J(a)&&(a=Ta(a,function(a,b){if(a)return b}));a&&d.addClass(J(a)?a.join(" "):a)}c.$watch(e[b],g,!0);e.$observe("class",function(){var a=c.$eval(e[b]);g(a,a)});b!=="ngClass"&&c.$watch("$index",
  15.116 -function(d,g){var j=d%2;j!==g%2&&(j==a?f(c.$eval(e[b])):i(c.$eval(e[b])))})})}var E=function(b){return F(b)?b.toLowerCase():b},la=function(b){return F(b)?b.toUpperCase():b},B=U.Error,aa=G((/msie (\d+)/.exec(E(navigator.userAgent))||[])[1]),u,ja,ia=[].slice,Ra=[].push,Sa=Object.prototype.toString,Yb=U.angular||(U.angular={}),ta,Cb,Z=["0","0","0"];D.$inject=[];ma.$inject=[];Cb=aa<9?function(b){b=b.nodeName?b:b[0];return b.scopeName&&b.scopeName!="HTML"?la(b.scopeName+":"+b.nodeName):b.nodeName}:function(b){return b.nodeName?
  15.117 -b.nodeName:b[0].nodeName};var kc=/[A-Z]/g,id={full:"1.0.3",major:1,minor:0,dot:3,codeName:"bouncy-thunder"},Ba=Q.cache={},Aa=Q.expando="ng-"+(new Date).getTime(),oc=1,Zb=U.document.addEventListener?function(b,a,c){b.addEventListener(a,c,!1)}:function(b,a,c){b.attachEvent("on"+a,c)},db=U.document.removeEventListener?function(b,a,c){b.removeEventListener(a,c,!1)}:function(b,a,c){b.detachEvent("on"+a,c)},mc=/([\:\-\_]+(.))/g,nc=/^moz([A-Z])/,ua=Q.prototype={ready:function(b){function a(){c||(c=!0,b())}
  15.118 -var c=!1;this.bind("DOMContentLoaded",a);Q(U).bind("load",a)},toString:function(){var b=[];m(this,function(a){b.push(""+a)});return"["+b.join(", ")+"]"},eq:function(b){return b>=0?u(this[b]):u(this[this.length+b])},length:0,push:Ra,sort:[].sort,splice:[].splice},Ea={};m("multiple,selected,checked,disabled,readOnly,required".split(","),function(b){Ea[E(b)]=b});var zb={};m("input,select,option,textarea,button,form".split(","),function(b){zb[la(b)]=!0});m({data:ub,inheritedData:Da,scope:function(b){return Da(b,
  15.119 -"$scope")},controller:xb,injector:function(b){return Da(b,"$injector")},removeAttr:function(b,a){b.removeAttribute(a)},hasClass:Ca,css:function(b,a,c){a=rb(a);if(v(c))b.style[a]=c;else{var d;aa<=8&&(d=b.currentStyle&&b.currentStyle[a],d===""&&(d="auto"));d=d||b.style[a];aa<=8&&(d=d===""?p:d);return d}},attr:function(b,a,c){var d=E(a);if(Ea[d])if(v(c))c?(b[a]=!0,b.setAttribute(a,d)):(b[a]=!1,b.removeAttribute(d));else return b[a]||(b.attributes.getNamedItem(a)||D).specified?d:p;else if(v(c))b.setAttribute(a,
  15.120 -c);else if(b.getAttribute)return b=b.getAttribute(a,2),b===null?p:b},prop:function(b,a,c){if(v(c))b[a]=c;else return b[a]},text:x(aa<9?function(b,a){if(b.nodeType==1){if(t(a))return b.innerText;b.innerText=a}else{if(t(a))return b.nodeValue;b.nodeValue=a}}:function(b,a){if(t(a))return b.textContent;b.textContent=a},{$dv:""}),val:function(b,a){if(t(a))return b.value;b.value=a},html:function(b,a){if(t(a))return b.innerHTML;for(var c=0,d=b.childNodes;c<d.length;c++)sa(d[c]);b.innerHTML=a}},function(b,
  15.121 -a){Q.prototype[a]=function(a,d){var e,g;if((b.length==2&&b!==Ca&&b!==xb?a:d)===p)if(L(a)){for(e=0;e<this.length;e++)if(b===ub)b(this[e],a);else for(g in a)b(this[e],g,a[g]);return this}else{if(this.length)return b(this[0],a,d)}else{for(e=0;e<this.length;e++)b(this[e],a,d);return this}return b.$dv}});m({removeData:sb,dealoc:sa,bind:function a(c,d,e){var g=$(c,"events"),i=$(c,"handle");g||$(c,"events",g={});i||$(c,"handle",i=pc(c,g));m(d.split(" "),function(d){var h=g[d];if(!h){if(d=="mouseenter"||
  15.122 -d=="mouseleave"){var k=0;g.mouseenter=[];g.mouseleave=[];a(c,"mouseover",function(a){k++;k==1&&i(a,"mouseenter")});a(c,"mouseout",function(a){k--;k==0&&i(a,"mouseleave")})}else Zb(c,d,i),g[d]=[];h=g[d]}h.push(e)})},unbind:tb,replaceWith:function(a,c){var d,e=a.parentNode;sa(a);m(new Q(c),function(c){d?e.insertBefore(c,d.nextSibling):e.replaceChild(c,a);d=c})},children:function(a){var c=[];m(a.childNodes,function(a){a.nodeName!="#text"&&c.push(a)});return c},contents:function(a){return a.childNodes},
  15.123 -append:function(a,c){m(new Q(c),function(c){a.nodeType===1&&a.appendChild(c)})},prepend:function(a,c){if(a.nodeType===1){var d=a.firstChild;m(new Q(c),function(c){d?a.insertBefore(c,d):(a.appendChild(c),d=c)})}},wrap:function(a,c){var c=u(c)[0],d=a.parentNode;d&&d.replaceChild(c,a);c.appendChild(a)},remove:function(a){sa(a);var c=a.parentNode;c&&c.removeChild(a)},after:function(a,c){var d=a,e=a.parentNode;m(new Q(c),function(a){e.insertBefore(a,d.nextSibling);d=a})},addClass:wb,removeClass:vb,toggleClass:function(a,
  15.124 -c,d){t(d)&&(d=!Ca(a,c));(d?wb:vb)(a,c)},parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},next:function(a){return a.nextSibling},find:function(a,c){return a.getElementsByTagName(c)},clone:cb,triggerHandler:function(a,c){var d=($(a,"events")||{})[c];m(d,function(c){c.call(a,null)})}},function(a,c){Q.prototype[c]=function(c,e){for(var g,i=0;i<this.length;i++)g==p?(g=a(this[i],c,e),g!==p&&(g=u(g))):bb(g,a(this[i],c,e));return g==p?this:g}});Fa.prototype={put:function(a,c){this[ga(a)]=
  15.125 -c},get:function(a){return this[ga(a)]},remove:function(a){var c=this[a=ga(a)];delete this[a];return c}};eb.prototype={push:function(a,c){var d=this[a=ga(a)];d?d.push(c):this[a]=[c]},shift:function(a){var c=this[a=ga(a)];if(c)return c.length==1?(delete this[a],c[0]):c.shift()},peek:function(a){if(a=this[ga(a)])return a[0]}};var rc=/^function\s*[^\(]*\(\s*([^\)]*)\)/m,sc=/,/,tc=/^\s*(_?)(\S+?)\1\s*$/,qc=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Db="Non-assignable model expression: ";Bb.$inject=["$provide"];
  15.126 -var Ac=/^(x[\:\-_]|data[\:\-_])/i,Fb=/^([^:]+):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,$b=/^([^\?#]*)?(\?([^#]*))?(#(.*))?$/,Hc=$b,Gb={http:80,https:443,ftp:21};gb.prototype={$$replace:!1,absUrl:Ja("$$absUrl"),url:function(a,c){if(t(a))return this.$$url;var d=$b.exec(a);d[1]&&this.path(decodeURIComponent(d[1]));if(d[2]||d[1])this.search(d[3]||"");this.hash(d[5]||"",c);return this},protocol:Ja("$$protocol"),host:Ja("$$host"),port:Ja("$$port"),path:Ib("$$path",function(a){return a.charAt(0)==
  15.127 -"/"?a:"/"+a}),search:function(a,c){if(t(a))return this.$$search;v(c)?c===null?delete this.$$search[a]:this.$$search[a]=c:this.$$search=F(a)?Xa(a):a;this.$$compose();return this},hash:Ib("$$hash",ma),replace:function(){this.$$replace=!0;return this}};Ia.prototype=ya(gb.prototype);Hb.prototype=ya(Ia.prototype);var Ka={"null":function(){return null},"true":function(){return!0},"false":function(){return!1},undefined:D,"+":function(a,c,d,e){d=d(a,c);e=e(a,c);return v(d)?v(e)?d+e:d:v(e)?e:p},"-":function(a,
  15.128 -c,d,e){d=d(a,c);e=e(a,c);return(v(d)?d:0)-(v(e)?e:0)},"*":function(a,c,d,e){return d(a,c)*e(a,c)},"/":function(a,c,d,e){return d(a,c)/e(a,c)},"%":function(a,c,d,e){return d(a,c)%e(a,c)},"^":function(a,c,d,e){return d(a,c)^e(a,c)},"=":D,"==":function(a,c,d,e){return d(a,c)==e(a,c)},"!=":function(a,c,d,e){return d(a,c)!=e(a,c)},"<":function(a,c,d,e){return d(a,c)<e(a,c)},">":function(a,c,d,e){return d(a,c)>e(a,c)},"<=":function(a,c,d,e){return d(a,c)<=e(a,c)},">=":function(a,c,d,e){return d(a,c)>=e(a,
  15.129 -c)},"&&":function(a,c,d,e){return d(a,c)&&e(a,c)},"||":function(a,c,d,e){return d(a,c)||e(a,c)},"&":function(a,c,d,e){return d(a,c)&e(a,c)},"|":function(a,c,d,e){return e(a,c)(a,c,d(a,c))},"!":function(a,c,d){return!d(a,c)}},Lc={n:"\n",f:"\u000c",r:"\r",t:"\t",v:"\u000b","'":"'",'"':'"'},hb={},Yc=U.XMLHttpRequest||function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(c){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(d){}throw new B("This browser does not support XMLHttpRequest.");
  15.130 -};Pb.$inject=["$provide"];Qb.$inject=["$locale"];Sb.$inject=["$locale"];var Vb=".",hd={yyyy:P("FullYear",4),yy:P("FullYear",2,0,!0),y:P("FullYear",1),MMMM:La("Month"),MMM:La("Month",!0),MM:P("Month",2,1),M:P("Month",1,1),dd:P("Date",2),d:P("Date",1),HH:P("Hours",2),H:P("Hours",1),hh:P("Hours",2,-12),h:P("Hours",1,-12),mm:P("Minutes",2),m:P("Minutes",1),ss:P("Seconds",2),s:P("Seconds",1),EEEE:La("Day"),EEE:La("Day",!0),a:function(a,c){return a.getHours()<12?c.AMPMS[0]:c.AMPMS[1]},Z:function(a){a=a.getTimezoneOffset();
  15.131 -return ib(a/60,2)+ib(Math.abs(a%60),2)}},gd=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,fd=/^\d+$/;Rb.$inject=["$locale"];var dd=I(E),ed=I(la);Tb.$inject=["$parse"];var jd=I({restrict:"E",compile:function(a,c){c.href||c.$set("href","");return function(a,c){c.bind("click",function(a){if(!c.attr("href"))return a.preventDefault(),!1})}}}),kb={};m(Ea,function(a,c){var d=fa("ng-"+c);kb[d]=function(){return{priority:100,compile:function(){return function(a,g,i){a.$watch(i[d],
  15.132 -function(a){i.$set(c,!!a)})}}}}});m(["src","href"],function(a){var c=fa("ng-"+a);kb[c]=function(){return{priority:99,link:function(d,e,g){g.$observe(c,function(c){c&&(g.$set(a,c),aa&&e.prop(a,c))})}}}});var Oa={$addControl:D,$removeControl:D,$setValidity:D,$setDirty:D};Wb.$inject=["$element","$attrs","$scope"];var Ra=function(a){return["$timeout",function(c){var d={name:"form",restrict:"E",controller:Wb,compile:function(){return{pre:function(a,d,i,f){if(!i.action){var h=function(a){a.preventDefault?
  15.133 -a.preventDefault():a.returnValue=!1};Zb(d[0],"submit",h);d.bind("$destroy",function(){c(function(){db(d[0],"submit",h)},0,!1)})}var k=d.parent().controller("form"),j=i.name||i.ngForm;j&&(a[j]=f);k&&d.bind("$destroy",function(){k.$removeControl(f);j&&(a[j]=p);x(f,Oa)})}}}};return a?x(V(d),{restrict:"EAC"}):d}]},kd=Ra(),ld=Ra(!0),md=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,nd=/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/,od=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/,
  15.134 -ac={text:Qa,number:function(a,c,d,e,g,i){Qa(a,c,d,e,g,i);e.$parsers.push(function(a){var c=T(a);return c||od.test(a)?(e.$setValidity("number",!0),a===""?null:c?a:parseFloat(a)):(e.$setValidity("number",!1),p)});e.$formatters.push(function(a){return T(a)?"":""+a});if(d.min){var f=parseFloat(d.min),a=function(a){return!T(a)&&a<f?(e.$setValidity("min",!1),p):(e.$setValidity("min",!0),a)};e.$parsers.push(a);e.$formatters.push(a)}if(d.max){var h=parseFloat(d.max),d=function(a){return!T(a)&&a>h?(e.$setValidity("max",
  15.135 -!1),p):(e.$setValidity("max",!0),a)};e.$parsers.push(d);e.$formatters.push(d)}e.$formatters.push(function(a){return T(a)||wa(a)?(e.$setValidity("number",!0),a):(e.$setValidity("number",!1),p)})},url:function(a,c,d,e,g,i){Qa(a,c,d,e,g,i);a=function(a){return T(a)||md.test(a)?(e.$setValidity("url",!0),a):(e.$setValidity("url",!1),p)};e.$formatters.push(a);e.$parsers.push(a)},email:function(a,c,d,e,g,i){Qa(a,c,d,e,g,i);a=function(a){return T(a)||nd.test(a)?(e.$setValidity("email",!0),a):(e.$setValidity("email",
  15.136 -!1),p)};e.$formatters.push(a);e.$parsers.push(a)},radio:function(a,c,d,e){t(d.name)&&c.attr("name",xa());c.bind("click",function(){c[0].checked&&a.$apply(function(){e.$setViewValue(d.value)})});e.$render=function(){c[0].checked=d.value==e.$viewValue};d.$observe("value",e.$render)},checkbox:function(a,c,d,e){var g=d.ngTrueValue,i=d.ngFalseValue;F(g)||(g=!0);F(i)||(i=!1);c.bind("click",function(){a.$apply(function(){e.$setViewValue(c[0].checked)})});e.$render=function(){c[0].checked=e.$viewValue};e.$formatters.push(function(a){return a===
  15.137 -g});e.$parsers.push(function(a){return a?g:i})},hidden:D,button:D,submit:D,reset:D},bc=["$browser","$sniffer",function(a,c){return{restrict:"E",require:"?ngModel",link:function(d,e,g,i){i&&(ac[E(g.type)]||ac.text)(d,e,g,i,c,a)}}}],Na="ng-valid",Ma="ng-invalid",Pa="ng-pristine",Xb="ng-dirty",pd=["$scope","$exceptionHandler","$attrs","$element","$parse",function(a,c,d,e,g){function i(a,c){c=c?"-"+$a(c,"-"):"";e.removeClass((a?Ma:Na)+c).addClass((a?Na:Ma)+c)}this.$modelValue=this.$viewValue=Number.NaN;
  15.138 -this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$name=d.name;var f=g(d.ngModel),h=f.assign;if(!h)throw B(Db+d.ngModel+" ("+pa(e)+")");this.$render=D;var k=e.inheritedData("$formController")||Oa,j=0,l=this.$error={};e.addClass(Pa);i(!0);this.$setValidity=function(a,c){if(l[a]!==!c){if(c){if(l[a]&&j--,!j)i(!0),this.$valid=!0,this.$invalid=!1}else i(!1),this.$invalid=!0,this.$valid=!1,j++;l[a]=!c;i(c,a);k.$setValidity(a,
  15.139 -c,this)}};this.$setViewValue=function(d){this.$viewValue=d;if(this.$pristine)this.$dirty=!0,this.$pristine=!1,e.removeClass(Pa).addClass(Xb),k.$setDirty();m(this.$parsers,function(a){d=a(d)});if(this.$modelValue!==d)this.$modelValue=d,h(a,d),m(this.$viewChangeListeners,function(a){try{a()}catch(d){c(d)}})};var o=this;a.$watch(function(){var c=f(a);if(o.$modelValue!==c){var d=o.$formatters,e=d.length;for(o.$modelValue=c;e--;)c=d[e](c);if(o.$viewValue!==c)o.$viewValue=c,o.$render()}})}],qd=function(){return{require:["ngModel",
  15.140 -"^?form"],controller:pd,link:function(a,c,d,e){var g=e[0],i=e[1]||Oa;i.$addControl(g);c.bind("$destroy",function(){i.$removeControl(g)})}}},rd=I({require:"ngModel",link:function(a,c,d,e){e.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),cc=function(){return{require:"?ngModel",link:function(a,c,d,e){if(e){d.required=!0;var g=function(a){if(d.required&&(T(a)||a===!1))e.$setValidity("required",!1);else return e.$setValidity("required",!0),a};e.$formatters.push(g);e.$parsers.unshift(g);
  15.141 -d.$observe("required",function(){g(e.$viewValue)})}}}},sd=function(){return{require:"ngModel",link:function(a,c,d,e){var g=(a=/\/(.*)\//.exec(d.ngList))&&RegExp(a[1])||d.ngList||",";e.$parsers.push(function(a){var c=[];a&&m(a.split(g),function(a){a&&c.push(R(a))});return c});e.$formatters.push(function(a){return J(a)?a.join(", "):p})}}},td=/^(true|false|\d+)$/,ud=function(){return{priority:100,compile:function(a,c){return td.test(c.ngValue)?function(a,c,g){g.$set("value",a.$eval(g.ngValue))}:function(a,
  15.142 -c,g){a.$watch(g.ngValue,function(a){g.$set("value",a,!1)})}}}},vd=S(function(a,c,d){c.addClass("ng-binding").data("$binding",d.ngBind);a.$watch(d.ngBind,function(a){c.text(a==p?"":a)})}),wd=["$interpolate",function(a){return function(c,d,e){c=a(d.attr(e.$attr.ngBindTemplate));d.addClass("ng-binding").data("$binding",c);e.$observe("ngBindTemplate",function(a){d.text(a)})}}],xd=[function(){return function(a,c,d){c.addClass("ng-binding").data("$binding",d.ngBindHtmlUnsafe);a.$watch(d.ngBindHtmlUnsafe,
  15.143 -function(a){c.html(a||"")})}}],yd=jb("",!0),zd=jb("Odd",0),Ad=jb("Even",1),Bd=S({compile:function(a,c){c.$set("ngCloak",p);a.removeClass("ng-cloak")}}),Cd=[function(){return{scope:!0,controller:"@"}}],Dd=["$sniffer",function(a){return{priority:1E3,compile:function(){a.csp=!0}}}],dc={};m("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave".split(" "),function(a){var c=fa("ng-"+a);dc[c]=["$parse",function(d){return function(e,g,i){var f=d(i[c]);g.bind(E(a),function(a){e.$apply(function(){f(e,
  15.144 -{$event:a})})})}}]});var Ed=S(function(a,c,d){c.bind("submit",function(){a.$apply(d.ngSubmit)})}),Fd=["$http","$templateCache","$anchorScroll","$compile",function(a,c,d,e){return{restrict:"ECA",terminal:!0,compile:function(g,i){var f=i.ngInclude||i.src,h=i.onload||"",k=i.autoscroll;return function(g,i){var o=0,m,n=function(){m&&(m.$destroy(),m=null);i.html("")};g.$watch(f,function(f){var p=++o;f?a.get(f,{cache:c}).success(function(a){p===o&&(m&&m.$destroy(),m=g.$new(),i.html(a),e(i.contents())(m),
  15.145 -v(k)&&(!k||g.$eval(k))&&d(),m.$emit("$includeContentLoaded"),g.$eval(h))}).error(function(){p===o&&n()}):n()})}}}}],Gd=S({compile:function(){return{pre:function(a,c,d){a.$eval(d.ngInit)}}}}),Hd=S({terminal:!0,priority:1E3}),Id=["$locale","$interpolate",function(a,c){var d=/{}/g;return{restrict:"EA",link:function(e,g,i){var f=i.count,h=g.attr(i.$attr.when),k=i.offset||0,j=e.$eval(h),l={},o=c.startSymbol(),r=c.endSymbol();m(j,function(a,e){l[e]=c(a.replace(d,o+f+"-"+k+r))});e.$watch(function(){var c=
  15.146 -parseFloat(e.$eval(f));return isNaN(c)?"":(j[c]||(c=a.pluralCat(c-k)),l[c](e,g,!0))},function(a){g.text(a)})}}}],Jd=S({transclude:"element",priority:1E3,terminal:!0,compile:function(a,c,d){return function(a,c,i){var f=i.ngRepeat,i=f.match(/^\s*(.+)\s+in\s+(.*)\s*$/),h,k,j;if(!i)throw B("Expected ngRepeat in form of '_item_ in _collection_' but got '"+f+"'.");f=i[1];h=i[2];i=f.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);if(!i)throw B("'item' in 'item in collection' should be identifier or (key, value) but got '"+
  15.147 -f+"'.");k=i[3]||i[1];j=i[2];var l=new eb;a.$watch(function(a){var e,f,i=a.$eval(h),m=gc(i,!0),p,u=new eb,C,A,v,t,y=c;if(J(i))v=i||[];else{v=[];for(C in i)i.hasOwnProperty(C)&&C.charAt(0)!="$"&&v.push(C);v.sort()}e=0;for(f=v.length;e<f;e++){C=i===v?e:v[e];A=i[C];if(t=l.shift(A)){p=t.scope;u.push(A,t);if(e!==t.index)t.index=e,y.after(t.element);y=t.element}else p=a.$new();p[k]=A;j&&(p[j]=C);p.$index=e;p.$first=e===0;p.$last=e===m-1;p.$middle=!(p.$first||p.$last);t||d(p,function(a){y.after(a);t={scope:p,
  15.148 -element:y=a,index:e};u.push(A,t)})}for(C in l)if(l.hasOwnProperty(C))for(v=l[C];v.length;)A=v.pop(),A.element.remove(),A.scope.$destroy();l=u})}}}),Kd=S(function(a,c,d){a.$watch(d.ngShow,function(a){c.css("display",Wa(a)?"":"none")})}),Ld=S(function(a,c,d){a.$watch(d.ngHide,function(a){c.css("display",Wa(a)?"none":"")})}),Md=S(function(a,c,d){a.$watch(d.ngStyle,function(a,d){d&&a!==d&&m(d,function(a,d){c.css(d,"")});a&&c.css(a)},!0)}),Nd=I({restrict:"EA",compile:function(a,c){var d=c.ngSwitch||c.on,
  15.149 -e={};a.data("ng-switch",e);return function(a,i){var f,h,k;a.$watch(d,function(d){h&&(k.$destroy(),h.remove(),h=k=null);if(f=e["!"+d]||e["?"])a.$eval(c.change),k=a.$new(),f(k,function(a){h=a;i.append(a)})})}}}),Od=S({transclude:"element",priority:500,compile:function(a,c,d){a=a.inheritedData("ng-switch");qa(a);a["!"+c.ngSwitchWhen]=d}}),Pd=S({transclude:"element",priority:500,compile:function(a,c,d){a=a.inheritedData("ng-switch");qa(a);a["?"]=d}}),Qd=S({controller:["$transclude","$element",function(a,
  15.150 -c){a(function(a){c.append(a)})}]}),Rd=["$http","$templateCache","$route","$anchorScroll","$compile","$controller",function(a,c,d,e,g,i){return{restrict:"ECA",terminal:!0,link:function(a,c,k){function j(){var j=d.current&&d.current.locals,k=j&&j.$template;if(k){c.html(k);l&&(l.$destroy(),l=null);var k=g(c.contents()),p=d.current;l=p.scope=a.$new();if(p.controller)j.$scope=l,j=i(p.controller,j),c.contents().data("$ngControllerController",j);k(l);l.$emit("$viewContentLoaded");l.$eval(m);e()}else c.html(""),
  15.151 -l&&(l.$destroy(),l=null)}var l,m=k.onload||"";a.$on("$routeChangeSuccess",j);j()}}}],Sd=["$templateCache",function(a){return{restrict:"E",terminal:!0,compile:function(c,d){d.type=="text/ng-template"&&a.put(d.id,c[0].text)}}}],Td=I({terminal:!0}),Ud=["$compile","$parse",function(a,c){var d=/^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*)$/,e={$setViewValue:D};return{restrict:"E",require:["select",
  15.152 -"?ngModel"],controller:["$element","$scope","$attrs",function(a,c,d){var h=this,k={},j=e,l;h.databound=d.ngModel;h.init=function(a,c,d){j=a;l=d};h.addOption=function(c){k[c]=!0;j.$viewValue==c&&(a.val(c),l.parent()&&l.remove())};h.removeOption=function(a){this.hasOption(a)&&(delete k[a],j.$viewValue==a&&this.renderUnknownOption(a))};h.renderUnknownOption=function(c){c="? "+ga(c)+" ?";l.val(c);a.prepend(l);a.val(c);l.prop("selected",!0)};h.hasOption=function(a){return k.hasOwnProperty(a)};c.$on("$destroy",
  15.153 -function(){h.renderUnknownOption=D})}],link:function(e,i,f,h){function k(a,c,d,e){d.$render=function(){var a=d.$viewValue;e.hasOption(a)?(A.parent()&&A.remove(),c.val(a),a===""&&s.prop("selected",!0)):t(a)&&s?c.val(""):e.renderUnknownOption(a)};c.bind("change",function(){a.$apply(function(){A.parent()&&A.remove();d.$setViewValue(c.val())})})}function j(a,c,d){var e;d.$render=function(){var a=new Fa(d.$viewValue);m(c.children(),function(c){c.selected=v(a.get(c.value))})};a.$watch(function(){ha(e,d.$viewValue)||
  15.154 -(e=V(d.$viewValue),d.$render())});c.bind("change",function(){a.$apply(function(){var a=[];m(c.children(),function(c){c.selected&&a.push(c.value)});d.$setViewValue(a)})})}function l(e,f,g){function h(){var a={"":[]},c=[""],d,i,s,t,u;s=g.$modelValue;t=r(e)||[];var y=l?lb(t):t,A,w,x;w={};u=!1;var z,B;if(n)u=new Fa(s);else if(s===null||q)a[""].push({selected:s===null,id:"",label:""}),u=!0;for(x=0;A=y.length,x<A;x++){w[k]=t[l?w[l]=y[x]:x];d=m(e,w)||"";if(!(i=a[d]))i=a[d]=[],c.push(d);n?d=u.remove(o(e,
  15.155 -w))!=p:(d=s===o(e,w),u=u||d);z=j(e,w);z=z===p?"":z;i.push({id:l?y[x]:x,label:z,selected:d})}!n&&!u&&a[""].unshift({id:"?",label:"",selected:!0});w=0;for(y=c.length;w<y;w++){d=c[w];i=a[d];if(v.length<=w)s={element:C.clone().attr("label",d),label:i.label},t=[s],v.push(t),f.append(s.element);else if(t=v[w],s=t[0],s.label!=d)s.element.attr("label",s.label=d);z=null;x=0;for(A=i.length;x<A;x++)if(d=i[x],u=t[x+1]){z=u.element;if(u.label!==d.label)z.text(u.label=d.label);if(u.id!==d.id)z.val(u.id=d.id);if(u.element.selected!==
  15.156 -d.selected)z.prop("selected",u.selected=d.selected)}else d.id===""&&q?B=q:(B=D.clone()).val(d.id).attr("selected",d.selected).text(d.label),t.push({element:B,label:d.label,id:d.id,selected:d.selected}),z?z.after(B):s.element.append(B),z=B;for(x++;t.length>x;)t.pop().element.remove()}for(;v.length>w;)v.pop()[0].element.remove()}var i;if(!(i=w.match(d)))throw B("Expected ngOptions in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '"+w+"'.");var j=c(i[2]||i[1]),k=i[4]||
  15.157 -i[6],l=i[5],m=c(i[3]||""),o=c(i[2]?i[1]:k),r=c(i[7]),v=[[{element:f,label:""}]];q&&(a(q)(e),q.removeClass("ng-scope"),q.remove());f.html("");f.bind("change",function(){e.$apply(function(){var a,c=r(e)||[],d={},h,i,j,m,q,s;if(n){i=[];m=0;for(s=v.length;m<s;m++){a=v[m];j=1;for(q=a.length;j<q;j++)if((h=a[j].element)[0].selected)h=h.val(),l&&(d[l]=h),d[k]=c[h],i.push(o(e,d))}}else h=f.val(),h=="?"?i=p:h==""?i=null:(d[k]=c[h],l&&(d[l]=h),i=o(e,d));g.$setViewValue(i)})});g.$render=h;e.$watch(h)}if(h[1]){for(var o=
  15.158 -h[0],r=h[1],n=f.multiple,w=f.ngOptions,q=!1,s,D=u(ca.createElement("option")),C=u(ca.createElement("optgroup")),A=D.clone(),h=0,x=i.children(),E=x.length;h<E;h++)if(x[h].value==""){s=q=x.eq(h);break}o.init(r,q,A);if(n&&(f.required||f.ngRequired)){var y=function(a){r.$setValidity("required",!f.required||a&&a.length);return a};r.$parsers.push(y);r.$formatters.unshift(y);f.$observe("required",function(){y(r.$viewValue)})}w?l(e,i,r):n?j(e,i,r):k(e,i,r,o)}}}}],Vd=["$interpolate",function(a){var c={addOption:D,
  15.159 -removeOption:D};return{restrict:"E",priority:100,compile:function(d,e){if(t(e.value)){var g=a(d.text(),!0);g||e.$set("value",d.text())}return function(a,d,e){var k=d.parent(),j=k.data("$selectController")||k.parent().data("$selectController");j&&j.databound?d.prop("selected",!1):j=c;g?a.$watch(g,function(a,c){e.$set("value",a);a!==c&&j.removeOption(c);j.addOption(a)}):j.addOption(e.value);d.bind("$destroy",function(){j.removeOption(e.value)})}}}}],Wd=I({restrict:"E",terminal:!0});(ja=U.jQuery)?(u=
  15.160 -ja,x(ja.fn,{scope:ua.scope,controller:ua.controller,injector:ua.injector,inheritedData:ua.inheritedData}),ab("remove",!0),ab("empty"),ab("html")):u=Q;Yb.element=u;(function(a){x(a,{bootstrap:pb,copy:V,extend:x,equals:ha,element:u,forEach:m,injector:qb,noop:D,bind:Va,toJson:da,fromJson:nb,identity:ma,isUndefined:t,isDefined:v,isString:F,isFunction:N,isObject:L,isNumber:wa,isElement:fc,isArray:J,version:id,isDate:na,lowercase:E,uppercase:la,callbacks:{counter:0}});ta=lc(U);try{ta("ngLocale")}catch(c){ta("ngLocale",
  15.161 -[]).provider("$locale",Zc)}ta("ng",["ngLocale"],["$provide",function(a){a.provider("$compile",Bb).directive({a:jd,input:bc,textarea:bc,form:kd,script:Sd,select:Ud,style:Wd,option:Vd,ngBind:vd,ngBindHtmlUnsafe:xd,ngBindTemplate:wd,ngClass:yd,ngClassEven:Ad,ngClassOdd:zd,ngCsp:Dd,ngCloak:Bd,ngController:Cd,ngForm:ld,ngHide:Ld,ngInclude:Fd,ngInit:Gd,ngNonBindable:Hd,ngPluralize:Id,ngRepeat:Jd,ngShow:Kd,ngSubmit:Ed,ngStyle:Md,ngSwitch:Nd,ngSwitchWhen:Od,ngSwitchDefault:Pd,ngOptions:Td,ngView:Rd,ngTransclude:Qd,
  15.162 -ngModel:qd,ngList:sd,ngChange:rd,required:cc,ngRequired:cc,ngValue:ud}).directive(kb).directive(dc);a.provider({$anchorScroll:uc,$browser:wc,$cacheFactory:xc,$controller:Bc,$document:Cc,$exceptionHandler:Dc,$filter:Pb,$interpolate:Ec,$http:Vc,$httpBackend:Wc,$location:Ic,$log:Jc,$parse:Nc,$route:Qc,$routeParams:Rc,$rootScope:Sc,$q:Oc,$sniffer:Tc,$templateCache:yc,$timeout:$c,$window:Uc})}])})(Yb);u(ca).ready(function(){jc(ca,pb)})})(window,document);angular.element(document).find("head").append('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak{display:none;}ng\\:form{display:block;}</style>');
    16.1 --- a/dew/src/main/resources/org/apidesign/bck2brwsr/dew/js/app.js	Tue Feb 11 10:48:24 2014 +0100
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,224 +0,0 @@
    16.4 -// 'use strict';
    16.5 -
    16.6 -// Declare app level module which depends on filters, and services
    16.7 -angular.module('bck2brwsr', []).
    16.8 -  directive('uiCodemirror', ['$timeout', function($timeout) {
    16.9 -        'use strict';
   16.10 -
   16.11 -        var events = ["cursorActivity", "viewportChange", "gutterClick", "focus", "blur", "scroll", "update"];
   16.12 -        return {
   16.13 -            restrict: 'A',
   16.14 -            require: 'ngModel',
   16.15 -            link: function(scope, elm, attrs, ngModel) {
   16.16 -                var options, opts, onChange, deferCodeMirror, codeMirror, timeoutId, val;
   16.17 -
   16.18 -                if (elm[0].type !== 'textarea') {
   16.19 -                    throw new Error('uiCodemirror3 can only be applied to a textarea element');
   16.20 -                }
   16.21 -
   16.22 -                options = /* uiConfig.codemirror  || */ {};
   16.23 -                opts = angular.extend({}, options, scope.$eval(attrs.uiCodemirror));
   16.24 -
   16.25 -                onChange = function(instance, changeObj) {                    
   16.26 -                    val = instance.getValue();
   16.27 -                    $timeout.cancel(timeoutId);
   16.28 -                    timeoutId = $timeout(function() {
   16.29 -                        ngModel.$setViewValue(val);                        
   16.30 -                      }, 500);                    
   16.31 -                };
   16.32 -                
   16.33 -                deferCodeMirror = function() {
   16.34 -                    codeMirror = CodeMirror.fromTextArea(elm[0], opts);
   16.35 -                    elm[0].codeMirror = codeMirror;
   16.36 -                    // codeMirror.on("change", onChange(opts.onChange));
   16.37 -                    codeMirror.on("change", onChange);
   16.38 -
   16.39 -                    for (var i = 0, n = events.length, aEvent; i < n; ++i) {
   16.40 -                        aEvent = opts["on" + events[i].charAt(0).toUpperCase() + events[i].slice(1)];
   16.41 -                        if (aEvent === void 0)
   16.42 -                            continue;
   16.43 -                        if (typeof aEvent !== "function")
   16.44 -                            continue;
   16.45 -                                                
   16.46 -                        var bound = _.bind( aEvent, scope );
   16.47 -                        
   16.48 -                        codeMirror.on(events[i], bound);
   16.49 -                    }
   16.50 -
   16.51 -                    // CodeMirror expects a string, so make sure it gets one.
   16.52 -                    // This does not change the model.
   16.53 -                    ngModel.$formatters.push(function(value) {
   16.54 -                        if (angular.isUndefined(value) || value === null) {
   16.55 -                            return '';
   16.56 -                        }
   16.57 -                        else if (angular.isObject(value) || angular.isArray(value)) {
   16.58 -                            throw new Error('ui-codemirror cannot use an object or an array as a model');
   16.59 -                        }
   16.60 -                        return value;
   16.61 -                    });
   16.62 -
   16.63 -                    // Override the ngModelController $render method, which is what gets called when the model is updated.
   16.64 -                    // This takes care of the synchronizing the codeMirror element with the underlying model, in the case that it is changed by something else.
   16.65 -                    ngModel.$render = function() {
   16.66 -                        codeMirror.setValue(ngModel.$viewValue);
   16.67 -                    };
   16.68 -
   16.69 -                };
   16.70 -
   16.71 -                $timeout(deferCodeMirror);
   16.72 -
   16.73 -            }
   16.74 -        };
   16.75 -}]);
   16.76 -
   16.77 -function DevCtrl( $scope, $http ) {
   16.78 -    var templateHtml = 
   16.79 -"<html><body>\n" +
   16.80 -"  <input data-bind=\"value: value, valueUpdate: 'afterkeydown'\" \n" +
   16.81 -"     value=\"0\" type=\"number\">\n" +
   16.82 -"  </input>\n" +
   16.83 -"  * <span data-bind=\"text: value\">0</span> \n" +
   16.84 -"  = <span data-bind=\"text: powerValue\">0</span>\n" +
   16.85 -"  <br/>\n" +
   16.86 -"  <button id='dupl'>Duplicate!</button>\n" +
   16.87 -"  <button id=\"clear\">Clear!</button>" +
   16.88 -" <hr/>\n" +
   16.89 -"\n" +
   16.90 -"\n" +
   16.91 -"\n" +
   16.92 -"\n" +
   16.93 -"\n" +
   16.94 -"\n" +
   16.95 -"\n" +
   16.96 -"\n" +
   16.97 -"\n" +
   16.98 -"\n" +
   16.99 -"\n" +
  16.100 -"\n" +
  16.101 -"\n" +
  16.102 -"\n" +
  16.103 -"\n" +
  16.104 -"\n" +
  16.105 -"\n" +
  16.106 -"\n" +
  16.107 -"\n" +
  16.108 -"\n" +
  16.109 -" <script src=\"/bck2brwsr.js\"></script>\n" +
  16.110 -" <script type=\"text/javascript\">\n" +
  16.111 -"   function ldCls(res) {\n" +
  16.112 -"     var request = new XMLHttpRequest();\n" +
  16.113 -"     request.open('GET', '/classes/' + res, false);\n" +
  16.114 -"     request.send();\n" +
  16.115 -"     var arr = eval('(' + request.responseText + ')');\n" +
  16.116 -"     return arr;\n" +
  16.117 -"   }\n" +
  16.118 -"   var vm = bck2brwsr(ldCls);\n" +
  16.119 -"   vm.loadClass('${fqn}');\n" +
  16.120 -" </script>\n" +
  16.121 -"</body></html>";
  16.122 -    var templateJava = 
  16.123 -"package bck2brwsr.demo;\n" +
  16.124 -"import org.apidesign.bck2brwsr.htmlpage.api.*;\n" +
  16.125 -"import static org.apidesign.bck2brwsr.htmlpage.api.OnEvent.*;\n" +
  16.126 -"\n" +
  16.127 -"@Page(xhtml=\"index.html\", className=\"Index\", properties={\n" +
  16.128 -"  @Property(name=\"value\", type=int.class)\n" +
  16.129 -"})\n" +
  16.130 -"class YourFirstHTML5PageInRealLanguage {\n" +
  16.131 -"  static { new Index().applyBindings(); }\n" +
  16.132 -"  @On(event=CLICK, id=\"dupl\") static void duplicateValue(Index m) {\n" +
  16.133 -"    m.setValue(m.getValue() * 2);\n" +
  16.134 -"  }\n" +
  16.135 -"  @On(event=CLICK, id=\"clear\") static void zeroTheValue(Index m) {\n" +
  16.136 -"     m.setValue(0);;\n" +
  16.137 -"  }\n" +
  16.138 -"  @ComputedProperty static int powerValue(int value) {\n" +
  16.139 -"    return value * value;\n" +
  16.140 -"  }\n" +
  16.141 -"}";
  16.142 -
  16.143 -    
  16.144 -    $scope.makeMarker = function( editor, line ) {
  16.145 -        var marker = document.createElement("div");
  16.146 -        marker.innerHTML = " ";
  16.147 -        marker.className = "issue";
  16.148 -        
  16.149 -        var info = editor.lineInfo(line);
  16.150 -        editor.setGutterMarker(line, "issues", info.markers ? null : marker);
  16.151 -        
  16.152 -        return marker;
  16.153 -    };
  16.154 -    
  16.155 -    
  16.156 -    // Returns a function, that, as long as it continues to be invoked, will not
  16.157 -    // be triggered. The function will be called after it stops being called for
  16.158 -    // N milliseconds. If `immediate` is passed, trigger the function on the
  16.159 -    // leading edge, instead of the trailing.
  16.160 -    $scope.debounce = function(func, wait, immediate) {
  16.161 -      var timeout, result;
  16.162 -      return function() {
  16.163 -        var context = this, args = arguments;
  16.164 -        var later = function() {
  16.165 -          timeout = null;
  16.166 -          if (!immediate) result = func.apply(context, args);
  16.167 -        };
  16.168 -        var callNow = immediate && !timeout;
  16.169 -        clearTimeout(timeout);
  16.170 -        timeout = setTimeout(later, wait);
  16.171 -        if (callNow) result = func.apply(context, args);
  16.172 -        return result;
  16.173 -      };
  16.174 -    };
  16.175 -    
  16.176 -    $scope.reload = function() {
  16.177 -        $scope.errors = null;
  16.178 -        var frame = document.getElementById("result");        
  16.179 -        frame.src = "result.html";
  16.180 -        frame.contentDocument.location.reload(true);
  16.181 -        frame.contentWindow.location.reload();
  16.182 -        document.getElementById("editorJava").codeMirror.clearGutter("issues");   
  16.183 -    };
  16.184 -    
  16.185 -    $scope.fail = function( data ) {
  16.186 -        $scope.errors = eval( data );
  16.187 -        var editor = document.getElementById("editorJava").codeMirror;   
  16.188 -        editor.clearGutter( "issues" );
  16.189 -        
  16.190 -        for( var i = 0; i < $scope.errors.length; i ++ ) {
  16.191 -            $scope.makeMarker( editor, $scope.errors[i].line - 1 );
  16.192 -        }
  16.193 -        
  16.194 -    };
  16.195 -    
  16.196 -    $scope.post = function() {
  16.197 -        return $http({url: ".",
  16.198 -            method: "POST",
  16.199 -            //headers: this.headers,
  16.200 -            data: { html : $scope.html, java : $scope.java} 
  16.201 -        }).success( $scope.reload ).error( $scope.fail );
  16.202 -    };
  16.203 -    
  16.204 -    $scope.errorClass = function( kind ) {
  16.205 -        switch( kind ) {
  16.206 -            case "ERROR" :
  16.207 -                return "error";
  16.208 -            default :         
  16.209 -                return "warning";   
  16.210 -        }
  16.211 -    };
  16.212 -    
  16.213 -    $scope.gotoError = function( line, col ) {
  16.214 -        var editor = document.getElementById("editorJava").codeMirror;   
  16.215 -        editor.setCursor({ line: line - 1, ch : col - 1 });
  16.216 -        editor.focus();
  16.217 -    };
  16.218 -    
  16.219 -    $scope.tab = "html";
  16.220 -    $scope.html= templateHtml;  
  16.221 -    $scope.java = templateJava;  
  16.222 -    
  16.223 -    $scope.$watch( "html", $scope.debounce( $scope.post, 2000 ) );
  16.224 -    $scope.$watch( "java", $scope.debounce( $scope.post, 2000 ) );
  16.225 -    $scope.post();
  16.226 -    
  16.227 -}
    17.1 --- a/dew/src/main/resources/org/apidesign/bck2brwsr/dew/js/codemirror/codemirror.css	Tue Feb 11 10:48:24 2014 +0100
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,239 +0,0 @@
    17.4 -/* BASICS */
    17.5 -
    17.6 -.CodeMirror {
    17.7 -  /* Set height, width, borders, and global font properties here */
    17.8 -  font-family: monospace;
    17.9 -  height: 300px;
   17.10 -}
   17.11 -.CodeMirror-scroll {
   17.12 -  /* Set scrolling behaviour here */
   17.13 -  overflow: auto;
   17.14 -}
   17.15 -
   17.16 -/* PADDING */
   17.17 -
   17.18 -.CodeMirror-lines {
   17.19 -  padding: 4px 0; /* Vertical padding around content */
   17.20 -}
   17.21 -.CodeMirror pre {
   17.22 -  padding: 0 4px; /* Horizontal padding of content */
   17.23 -}
   17.24 -
   17.25 -.CodeMirror-scrollbar-filler {
   17.26 -  background-color: white; /* The little square between H and V scrollbars */
   17.27 -}
   17.28 -
   17.29 -/* GUTTER */
   17.30 -
   17.31 -.CodeMirror-gutters {
   17.32 -  border-right: 1px solid #ddd;
   17.33 -  background-color: #f7f7f7;
   17.34 -}
   17.35 -.CodeMirror-linenumbers {}
   17.36 -.CodeMirror-linenumber {
   17.37 -  padding: 0 3px 0 5px;
   17.38 -  min-width: 20px;
   17.39 -  text-align: right;
   17.40 -  color: #999;
   17.41 -}
   17.42 -
   17.43 -/* CURSOR */
   17.44 -
   17.45 -.CodeMirror pre.CodeMirror-cursor {
   17.46 -  border-left: 1px solid black;
   17.47 -}
   17.48 -/* Shown when moving in bi-directional text */
   17.49 -.CodeMirror pre.CodeMirror-secondarycursor {
   17.50 -  border-left: 1px solid silver;
   17.51 -}
   17.52 -.cm-keymap-fat-cursor pre.CodeMirror-cursor {
   17.53 -  width: auto;
   17.54 -  border: 0;
   17.55 -  background: transparent;
   17.56 -  background: rgba(0, 200, 0, .4);
   17.57 -  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800);
   17.58 -}
   17.59 -/* Kludge to turn off filter in ie9+, which also accepts rgba */
   17.60 -.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) {
   17.61 -  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
   17.62 -}
   17.63 -/* Can style cursor different in overwrite (non-insert) mode */
   17.64 -.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
   17.65 -
   17.66 -/* DEFAULT THEME */
   17.67 -
   17.68 -.cm-s-default .cm-keyword {color: #708;}
   17.69 -.cm-s-default .cm-atom {color: #219;}
   17.70 -.cm-s-default .cm-number {color: #164;}
   17.71 -.cm-s-default .cm-def {color: #00f;}
   17.72 -.cm-s-default .cm-variable {color: black;}
   17.73 -.cm-s-default .cm-variable-2 {color: #05a;}
   17.74 -.cm-s-default .cm-variable-3 {color: #085;}
   17.75 -.cm-s-default .cm-property {color: black;}
   17.76 -.cm-s-default .cm-operator {color: black;}
   17.77 -.cm-s-default .cm-comment {color: #a50;}
   17.78 -.cm-s-default .cm-string {color: #a11;}
   17.79 -.cm-s-default .cm-string-2 {color: #f50;}
   17.80 -.cm-s-default .cm-meta {color: #555;}
   17.81 -.cm-s-default .cm-error {color: #f00;}
   17.82 -.cm-s-default .cm-qualifier {color: #555;}
   17.83 -.cm-s-default .cm-builtin {color: #30a;}
   17.84 -.cm-s-default .cm-bracket {color: #997;}
   17.85 -.cm-s-default .cm-tag {color: #170;}
   17.86 -.cm-s-default .cm-attribute {color: #00c;}
   17.87 -.cm-s-default .cm-header {color: blue;}
   17.88 -.cm-s-default .cm-quote {color: #090;}
   17.89 -.cm-s-default .cm-hr {color: #999;}
   17.90 -.cm-s-default .cm-link {color: #00c;}
   17.91 -
   17.92 -.cm-negative {color: #d44;}
   17.93 -.cm-positive {color: #292;}
   17.94 -.cm-header, .cm-strong {font-weight: bold;}
   17.95 -.cm-em {font-style: italic;}
   17.96 -.cm-emstrong {font-style: italic; font-weight: bold;}
   17.97 -.cm-link {text-decoration: underline;}
   17.98 -
   17.99 -.cm-invalidchar {color: #f00;}
  17.100 -
  17.101 -div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
  17.102 -div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
  17.103 -
  17.104 -/* STOP */
  17.105 -
  17.106 -/* The rest of this file contains styles related to the mechanics of
  17.107 -   the editor. You probably shouldn't touch them. */
  17.108 -
  17.109 -.CodeMirror {
  17.110 -  line-height: 1;
  17.111 -  position: relative;
  17.112 -  overflow: hidden;
  17.113 -}
  17.114 -
  17.115 -.CodeMirror-scroll {
  17.116 -  /* 30px is the magic margin used to hide the element's real scrollbars */
  17.117 -  /* See overflow: hidden in .CodeMirror, and the paddings in .CodeMirror-sizer */
  17.118 -  margin-bottom: -30px; margin-right: -30px;
  17.119 -  padding-bottom: 30px; padding-right: 30px;
  17.120 -  height: 100%;
  17.121 -  outline: none; /* Prevent dragging from highlighting the element */
  17.122 -  position: relative;
  17.123 -}
  17.124 -.CodeMirror-sizer {
  17.125 -  position: relative;
  17.126 -}
  17.127 -
  17.128 -/* The fake, visible scrollbars. Used to force redraw during scrolling
  17.129 -   before actuall scrolling happens, thus preventing shaking and
  17.130 -   flickering artifacts. */
  17.131 -.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler {
  17.132 -  position: absolute;
  17.133 -  z-index: 6;
  17.134 -  display: none;
  17.135 -}
  17.136 -.CodeMirror-vscrollbar {
  17.137 -  right: 0; top: 0;
  17.138 -  overflow-x: hidden;
  17.139 -  overflow-y: scroll;
  17.140 -}
  17.141 -.CodeMirror-hscrollbar {
  17.142 -  bottom: 0; left: 0;
  17.143 -  overflow-y: hidden;
  17.144 -  overflow-x: scroll;
  17.145 -}
  17.146 -.CodeMirror-scrollbar-filler {
  17.147 -  right: 0; bottom: 0;
  17.148 -  z-index: 6;
  17.149 -}
  17.150 -
  17.151 -.CodeMirror-gutters {
  17.152 -  position: absolute; left: 0; top: 0;
  17.153 -  height: 100%;
  17.154 -  z-index: 3;
  17.155 -}
  17.156 -.CodeMirror-gutter {
  17.157 -  height: 100%;
  17.158 -  display: inline-block;
  17.159 -  /* Hack to make IE7 behave */
  17.160 -  *zoom:1;
  17.161 -  *display:inline;
  17.162 -}
  17.163 -.CodeMirror-gutter-elt {
  17.164 -  position: absolute;
  17.165 -  cursor: default;
  17.166 -  z-index: 4;
  17.167 -}
  17.168 -
  17.169 -.CodeMirror-lines {
  17.170 -  cursor: text;
  17.171 -}
  17.172 -.CodeMirror pre {
  17.173 -  /* Reset some styles that the rest of the page might have set */
  17.174 -  -moz-border-radius: 0; -webkit-border-radius: 0; -o-border-radius: 0; border-radius: 0;
  17.175 -  border-width: 0;
  17.176 -  background: transparent;
  17.177 -  font-family: inherit;
  17.178 -  font-size: inherit;
  17.179 -  margin: 0;
  17.180 -  white-space: pre;
  17.181 -  word-wrap: normal;
  17.182 -  line-height: inherit;
  17.183 -  color: inherit;
  17.184 -  z-index: 2;
  17.185 -  position: relative;
  17.186 -  overflow: visible;
  17.187 -}
  17.188 -.CodeMirror-wrap pre {
  17.189 -  word-wrap: break-word;
  17.190 -  white-space: pre-wrap;
  17.191 -  word-break: normal;
  17.192 -}
  17.193 -.CodeMirror-linebackground {
  17.194 -  position: absolute;
  17.195 -  left: 0; right: 0; top: 0; bottom: 0;
  17.196 -  z-index: 0;
  17.197 -}
  17.198 -
  17.199 -.CodeMirror-linewidget {
  17.200 -  position: relative;
  17.201 -  z-index: 2;
  17.202 -}
  17.203 -
  17.204 -.CodeMirror-wrap .CodeMirror-scroll {
  17.205 -  overflow-x: hidden;
  17.206 -}
  17.207 -
  17.208 -.CodeMirror-measure {
  17.209 -  position: absolute;
  17.210 -  width: 100%; height: 0px;
  17.211 -  overflow: hidden;
  17.212 -  visibility: hidden;
  17.213 -}
  17.214 -.CodeMirror-measure pre { position: static; }
  17.215 -
  17.216 -.CodeMirror pre.CodeMirror-cursor {
  17.217 -  position: absolute;
  17.218 -  visibility: hidden;
  17.219 -  border-right: none;
  17.220 -  width: 0;
  17.221 -}
  17.222 -.CodeMirror-focused pre.CodeMirror-cursor {
  17.223 -  visibility: visible;
  17.224 -}
  17.225 -
  17.226 -.CodeMirror-selected { background: #d9d9d9; }
  17.227 -.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
  17.228 -
  17.229 -.CodeMirror-searching {
  17.230 -  background: #ffa;
  17.231 -  background: rgba(255, 255, 0, .4);
  17.232 -}
  17.233 -
  17.234 -/* IE7 hack to prevent it from returning funny offsetTops on the spans */
  17.235 -.CodeMirror span { *vertical-align: text-bottom; }
  17.236 -
  17.237 -@media print {
  17.238 -  /* Hide the cursor when printing */
  17.239 -  .CodeMirror pre.CodeMirror-cursor {
  17.240 -    visibility: hidden;
  17.241 -  }
  17.242 -}
    18.1 --- a/dew/src/main/resources/org/apidesign/bck2brwsr/dew/js/codemirror/codemirror.js	Tue Feb 11 10:48:24 2014 +0100
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,4553 +0,0 @@
    18.4 -// CodeMirror version 3.0
    18.5 -//
    18.6 -// CodeMirror is the only global var we claim
    18.7 -window.CodeMirror = (function() {
    18.8 -  "use strict";
    18.9 -
   18.10 -  // BROWSER SNIFFING
   18.11 -
   18.12 -  // Crude, but necessary to handle a number of hard-to-feature-detect
   18.13 -  // bugs and behavior differences.
   18.14 -  var gecko = /gecko\/\d/i.test(navigator.userAgent);
   18.15 -  var ie = /MSIE \d/.test(navigator.userAgent);
   18.16 -  var ie_lt8 = /MSIE [1-7]\b/.test(navigator.userAgent);
   18.17 -  var ie_lt9 = /MSIE [1-8]\b/.test(navigator.userAgent);
   18.18 -  var webkit = /WebKit\//.test(navigator.userAgent);
   18.19 -  var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(navigator.userAgent);
   18.20 -  var chrome = /Chrome\//.test(navigator.userAgent);
   18.21 -  var opera = /Opera\//.test(navigator.userAgent);
   18.22 -  var safari = /Apple Computer/.test(navigator.vendor);
   18.23 -  var khtml = /KHTML\//.test(navigator.userAgent);
   18.24 -  var mac_geLion = /Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent);
   18.25 -  var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent);
   18.26 -  var phantom = /PhantomJS/.test(navigator.userAgent);
   18.27 -
   18.28 -  var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
   18.29 -  // This is woefully incomplete. Suggestions for alternative methods welcome.
   18.30 -  var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent);
   18.31 -  var mac = ios || /Mac/.test(navigator.platform);
   18.32 -
   18.33 -  // Optimize some code when these features are not used
   18.34 -  var sawReadOnlySpans = false, sawCollapsedSpans = false;
   18.35 -
   18.36 -  // CONSTRUCTOR
   18.37 -
   18.38 -  function CodeMirror(place, options) {
   18.39 -    if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);
   18.40 -    
   18.41 -    this.options = options = options || {};
   18.42 -    // Determine effective options based on given values and defaults.
   18.43 -    for (var opt in defaults) if (!options.hasOwnProperty(opt) && defaults.hasOwnProperty(opt))
   18.44 -      options[opt] = defaults[opt];
   18.45 -    setGuttersForLineNumbers(options);
   18.46 -
   18.47 -    var display = this.display = makeDisplay(place);
   18.48 -    display.wrapper.CodeMirror = this;
   18.49 -    updateGutters(this);
   18.50 -    if (options.autofocus && !mobile) focusInput(this);
   18.51 -
   18.52 -    this.view = makeView(new BranchChunk([new LeafChunk([makeLine("", null, textHeight(display))])]));
   18.53 -    this.nextOpId = 0;
   18.54 -    loadMode(this);
   18.55 -    themeChanged(this);
   18.56 -    if (options.lineWrapping)
   18.57 -      this.display.wrapper.className += " CodeMirror-wrap";
   18.58 -
   18.59 -    // Initialize the content.
   18.60 -    this.setValue(options.value || "");
   18.61 -    // Override magic textarea content restore that IE sometimes does
   18.62 -    // on our hidden textarea on reload
   18.63 -    if (ie) setTimeout(bind(resetInput, this, true), 20);
   18.64 -    this.view.history = makeHistory();
   18.65 -
   18.66 -    registerEventHandlers(this);
   18.67 -    // IE throws unspecified error in certain cases, when
   18.68 -    // trying to access activeElement before onload
   18.69 -    var hasFocus; try { hasFocus = (document.activeElement == display.input); } catch(e) { }
   18.70 -    if (hasFocus || (options.autofocus && !mobile)) setTimeout(bind(onFocus, this), 20);
   18.71 -    else onBlur(this);
   18.72 -
   18.73 -    operation(this, function() {
   18.74 -      for (var opt in optionHandlers)
   18.75 -        if (optionHandlers.propertyIsEnumerable(opt))
   18.76 -          optionHandlers[opt](this, options[opt], Init);
   18.77 -      for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);
   18.78 -    })();
   18.79 -  }
   18.80 -
   18.81 -  // DISPLAY CONSTRUCTOR
   18.82 -
   18.83 -  function makeDisplay(place) {
   18.84 -    var d = {};
   18.85 -    var input = d.input = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none;");
   18.86 -    input.setAttribute("wrap", "off"); input.setAttribute("autocorrect", "off"); input.setAttribute("autocapitalize", "off");
   18.87 -    // Wraps and hides input textarea
   18.88 -    d.inputDiv = elt("div", [input], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
   18.89 -    // The actual fake scrollbars.
   18.90 -    d.scrollbarH = elt("div", [elt("div", null, null, "height: 1px")], "CodeMirror-hscrollbar");
   18.91 -    d.scrollbarV = elt("div", [elt("div", null, null, "width: 1px")], "CodeMirror-vscrollbar");
   18.92 -    d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
   18.93 -    // DIVs containing the selection and the actual code
   18.94 -    d.lineDiv = elt("div");
   18.95 -    d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
   18.96 -    // Blinky cursor, and element used to ensure cursor fits at the end of a line
   18.97 -    d.cursor = elt("pre", "\u00a0", "CodeMirror-cursor");
   18.98 -    // Secondary cursor, shown when on a 'jump' in bi-directional text
   18.99 -    d.otherCursor = elt("pre", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor");
  18.100 -    // Used to measure text size
  18.101 -    d.measure = elt("div", null, "CodeMirror-measure");
  18.102 -    // Wraps everything that needs to exist inside the vertically-padded coordinate system
  18.103 -    d.lineSpace = elt("div", [d.measure, d.selectionDiv, d.lineDiv, d.cursor, d.otherCursor],
  18.104 -                         null, "position: relative; outline: none");
  18.105 -    // Moved around its parent to cover visible view
  18.106 -    d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative");
  18.107 -    // Set to the height of the text, causes scrolling
  18.108 -    d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
  18.109 -    // D is needed because behavior of elts with overflow: auto and padding is inconsistent across browsers
  18.110 -    d.heightForcer = elt("div", "\u00a0", null, "position: absolute; height: " + scrollerCutOff + "px");
  18.111 -    // Will contain the gutters, if any
  18.112 -    d.gutters = elt("div", null, "CodeMirror-gutters");
  18.113 -    d.lineGutter = null;
  18.114 -    // Helper element to properly size the gutter backgrounds
  18.115 -    var scrollerInner = elt("div", [d.sizer, d.heightForcer, d.gutters], null, "position: relative; min-height: 100%");
  18.116 -    // Provides scrolling
  18.117 -    d.scroller = elt("div", [scrollerInner], "CodeMirror-scroll");
  18.118 -    d.scroller.setAttribute("tabIndex", "-1");
  18.119 -    // The element in which the editor lives.
  18.120 -    d.wrapper = elt("div", [d.inputDiv, d.scrollbarH, d.scrollbarV,
  18.121 -                            d.scrollbarFiller, d.scroller], "CodeMirror");
  18.122 -    // Work around IE7 z-index bug
  18.123 -    if (ie_lt8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
  18.124 -    if (place.appendChild) place.appendChild(d.wrapper); else place(d.wrapper);
  18.125 -
  18.126 -    // Needed to hide big blue blinking cursor on Mobile Safari
  18.127 -    if (ios) input.style.width = "0px";
  18.128 -    if (!webkit) d.scroller.draggable = true;
  18.129 -    // Needed to handle Tab key in KHTML
  18.130 -    if (khtml) { d.inputDiv.style.height = "1px"; d.inputDiv.style.position = "absolute"; }
  18.131 -    // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
  18.132 -    else if (ie_lt8) d.scrollbarH.style.minWidth = d.scrollbarV.style.minWidth = "18px";
  18.133 -
  18.134 -    // Current visible range (may be bigger than the view window).
  18.135 -    d.viewOffset = d.showingFrom = d.showingTo = d.lastSizeC = 0;
  18.136 -
  18.137 -    // Used to only resize the line number gutter when necessary (when
  18.138 -    // the amount of lines crosses a boundary that makes its width change)
  18.139 -    d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
  18.140 -    // See readInput and resetInput
  18.141 -    d.prevInput = "";
  18.142 -    // Set to true when a non-horizontal-scrolling widget is added. As
  18.143 -    // an optimization, widget aligning is skipped when d is false.
  18.144 -    d.alignWidgets = false;
  18.145 -    // Flag that indicates whether we currently expect input to appear
  18.146 -    // (after some event like 'keypress' or 'input') and are polling
  18.147 -    // intensively.
  18.148 -    d.pollingFast = false;
  18.149 -    // Self-resetting timeout for the poller
  18.150 -    d.poll = new Delayed();
  18.151 -    // True when a drag from the editor is active
  18.152 -    d.draggingText = false;
  18.153 -
  18.154 -    d.cachedCharWidth = d.cachedTextHeight = null;
  18.155 -    d.measureLineCache = [];
  18.156 -    d.measureLineCachePos = 0;
  18.157 -
  18.158 -    // Tracks when resetInput has punted to just putting a short
  18.159 -    // string instead of the (large) selection.
  18.160 -    d.inaccurateSelection = false;
  18.161 -
  18.162 -    // Used to adjust overwrite behaviour when a paste has been
  18.163 -    // detected
  18.164 -    d.pasteIncoming = false;
  18.165 -
  18.166 -    return d;
  18.167 -  }
  18.168 -
  18.169 -  // VIEW CONSTRUCTOR
  18.170 -
  18.171 -  function makeView(doc) {
  18.172 -    var selPos = {line: 0, ch: 0};
  18.173 -    return {
  18.174 -      doc: doc,
  18.175 -      // frontier is the point up to which the content has been parsed,
  18.176 -      frontier: 0, highlight: new Delayed(),
  18.177 -      sel: {from: selPos, to: selPos, head: selPos, anchor: selPos, shift: false, extend: false},
  18.178 -      scrollTop: 0, scrollLeft: 0,
  18.179 -      overwrite: false, focused: false,
  18.180 -      // Tracks the maximum line length so that
  18.181 -      // the horizontal scrollbar can be kept
  18.182 -      // static when scrolling.
  18.183 -      maxLine: getLine(doc, 0),
  18.184 -      maxLineLength: 0,
  18.185 -      maxLineChanged: false,
  18.186 -      suppressEdits: false,
  18.187 -      goalColumn: null,
  18.188 -      cantEdit: false,
  18.189 -      keyMaps: []
  18.190 -    };
  18.191 -  }
  18.192 -
  18.193 -  // STATE UPDATES
  18.194 -
  18.195 -  // Used to get the editor into a consistent state again when options change.
  18.196 -
  18.197 -  function loadMode(cm) {
  18.198 -    var doc = cm.view.doc;
  18.199 -    cm.view.mode = CodeMirror.getMode(cm.options, cm.options.mode);
  18.200 -    doc.iter(0, doc.size, function(line) { line.stateAfter = null; });
  18.201 -    cm.view.frontier = 0;
  18.202 -    startWorker(cm, 100);
  18.203 -  }
  18.204 -
  18.205 -  function wrappingChanged(cm) {
  18.206 -    var doc = cm.view.doc, th = textHeight(cm.display);
  18.207 -    if (cm.options.lineWrapping) {
  18.208 -      cm.display.wrapper.className += " CodeMirror-wrap";
  18.209 -      var perLine = cm.display.scroller.clientWidth / charWidth(cm.display) - 3;
  18.210 -      doc.iter(0, doc.size, function(line) {
  18.211 -        if (line.height == 0) return;
  18.212 -        var guess = Math.ceil(line.text.length / perLine) || 1;
  18.213 -        if (guess != 1) updateLineHeight(line, guess * th);
  18.214 -      });
  18.215 -      cm.display.sizer.style.minWidth = "";
  18.216 -    } else {
  18.217 -      cm.display.wrapper.className = cm.display.wrapper.className.replace(" CodeMirror-wrap", "");
  18.218 -      computeMaxLength(cm.view);
  18.219 -      doc.iter(0, doc.size, function(line) {
  18.220 -        if (line.height != 0) updateLineHeight(line, th);
  18.221 -      });
  18.222 -    }
  18.223 -    regChange(cm, 0, doc.size);
  18.224 -    clearCaches(cm);
  18.225 -    setTimeout(function(){updateScrollbars(cm.display, cm.view.doc.height);}, 100);
  18.226 -  }
  18.227 -
  18.228 -  function keyMapChanged(cm) {
  18.229 -    var style = keyMap[cm.options.keyMap].style;
  18.230 -    cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-keymap-\S+/g, "") +
  18.231 -      (style ? " cm-keymap-" + style : "");
  18.232 -  }
  18.233 -
  18.234 -  function themeChanged(cm) {
  18.235 -    cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
  18.236 -      cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
  18.237 -    clearCaches(cm);
  18.238 -  }
  18.239 -
  18.240 -  function guttersChanged(cm) {
  18.241 -    updateGutters(cm);
  18.242 -    updateDisplay(cm, true);
  18.243 -  }
  18.244 -
  18.245 -  function updateGutters(cm) {
  18.246 -    var gutters = cm.display.gutters, specs = cm.options.gutters;
  18.247 -    removeChildren(gutters);
  18.248 -    for (var i = 0; i < specs.length; ++i) {
  18.249 -      var gutterClass = specs[i];
  18.250 -      var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass));
  18.251 -      if (gutterClass == "CodeMirror-linenumbers") {
  18.252 -        cm.display.lineGutter = gElt;
  18.253 -        gElt.style.width = (cm.display.lineNumWidth || 1) + "px";
  18.254 -      }
  18.255 -    }
  18.256 -    gutters.style.display = i ? "" : "none";
  18.257 -  }
  18.258 -
  18.259 -  function lineLength(doc, line) {
  18.260 -    if (line.height == 0) return 0;
  18.261 -    var len = line.text.length, merged, cur = line;
  18.262 -    while (merged = collapsedSpanAtStart(cur)) {
  18.263 -      var found = merged.find();
  18.264 -      cur = getLine(doc, found.from.line);
  18.265 -      len += found.from.ch - found.to.ch;
  18.266 -    }
  18.267 -    cur = line;
  18.268 -    while (merged = collapsedSpanAtEnd(cur)) {
  18.269 -      var found = merged.find();
  18.270 -      len -= cur.text.length - found.from.ch;
  18.271 -      cur = getLine(doc, found.to.line);
  18.272 -      len += cur.text.length - found.to.ch;
  18.273 -    }
  18.274 -    return len;
  18.275 -  }
  18.276 -
  18.277 -  function computeMaxLength(view) {
  18.278 -    view.maxLine = getLine(view.doc, 0);
  18.279 -    view.maxLineLength = lineLength(view.doc, view.maxLine);
  18.280 -    view.maxLineChanged = true;
  18.281 -    view.doc.iter(1, view.doc.size, function(line) {
  18.282 -      var len = lineLength(view.doc, line);
  18.283 -      if (len > view.maxLineLength) {
  18.284 -        view.maxLineLength = len;
  18.285 -        view.maxLine = line;
  18.286 -      }
  18.287 -    });
  18.288 -  }
  18.289 -
  18.290 -  // Make sure the gutters options contains the element
  18.291 -  // "CodeMirror-linenumbers" when the lineNumbers option is true.
  18.292 -  function setGuttersForLineNumbers(options) {
  18.293 -    var found = false;
  18.294 -    for (var i = 0; i < options.gutters.length; ++i) {
  18.295 -      if (options.gutters[i] == "CodeMirror-linenumbers") {
  18.296 -        if (options.lineNumbers) found = true;
  18.297 -        else options.gutters.splice(i--, 1);
  18.298 -      }
  18.299 -    }
  18.300 -    if (!found && options.lineNumbers)
  18.301 -      options.gutters.push("CodeMirror-linenumbers");
  18.302 -  }
  18.303 -
  18.304 -  // SCROLLBARS
  18.305 -
  18.306 -  // Re-synchronize the fake scrollbars with the actual size of the
  18.307 -  // content. Optionally force a scrollTop.
  18.308 -  function updateScrollbars(d /* display */, docHeight) {
  18.309 -    var totalHeight = docHeight + 2 * paddingTop(d);
  18.310 -    d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + "px";
  18.311 -    var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);
  18.312 -    var needsH = d.scroller.scrollWidth > d.scroller.clientWidth;
  18.313 -    var needsV = scrollHeight > d.scroller.clientHeight;
  18.314 -    if (needsV) {
  18.315 -      d.scrollbarV.style.display = "block";
  18.316 -      d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + "px" : "0";
  18.317 -      d.scrollbarV.firstChild.style.height = 
  18.318 -        (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + "px";
  18.319 -    } else d.scrollbarV.style.display = "";
  18.320 -    if (needsH) {
  18.321 -      d.scrollbarH.style.display = "block";
  18.322 -      d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + "px" : "0";
  18.323 -      d.scrollbarH.firstChild.style.width =
  18.324 -        (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + "px";
  18.325 -    } else d.scrollbarH.style.display = "";
  18.326 -    if (needsH && needsV) {
  18.327 -      d.scrollbarFiller.style.display = "block";
  18.328 -      d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + "px";
  18.329 -    } else d.scrollbarFiller.style.display = "";
  18.330 -
  18.331 -    if (mac_geLion && scrollbarWidth(d.measure) === 0)
  18.332 -      d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? "18px" : "12px";
  18.333 -  }
  18.334 -
  18.335 -  function visibleLines(display, doc, viewPort) {
  18.336 -    var top = display.scroller.scrollTop, height = display.wrapper.clientHeight;
  18.337 -    if (typeof viewPort == "number") top = viewPort;
  18.338 -    else if (viewPort) {top = viewPort.top; height = viewPort.bottom - viewPort.top;}
  18.339 -    top = Math.floor(top - paddingTop(display));
  18.340 -    var bottom = Math.ceil(top + height);
  18.341 -    return {from: lineAtHeight(doc, top), to: lineAtHeight(doc, bottom)};
  18.342 -  }
  18.343 -
  18.344 -  // LINE NUMBERS
  18.345 -
  18.346 -  function alignHorizontally(cm) {
  18.347 -    var display = cm.display;
  18.348 -    if (!display.alignWidgets && !display.gutters.firstChild) return;
  18.349 -    var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.view.scrollLeft;
  18.350 -    var gutterW = display.gutters.offsetWidth, l = comp + "px";
  18.351 -    for (var n = display.lineDiv.firstChild; n; n = n.nextSibling) if (n.alignable) {
  18.352 -      for (var i = 0, a = n.alignable; i < a.length; ++i) a[i].style.left = l;
  18.353 -    }
  18.354 -    display.gutters.style.left = (comp + gutterW) + "px";
  18.355 -  }
  18.356 -
  18.357 -  function maybeUpdateLineNumberWidth(cm) {
  18.358 -    if (!cm.options.lineNumbers) return false;
  18.359 -    var doc = cm.view.doc, last = lineNumberFor(cm.options, doc.size - 1), display = cm.display;
  18.360 -    if (last.length != display.lineNumChars) {
  18.361 -      var test = display.measure.appendChild(elt("div", [elt("div", last)],
  18.362 -                                                 "CodeMirror-linenumber CodeMirror-gutter-elt"));
  18.363 -      var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
  18.364 -      display.lineGutter.style.width = "";
  18.365 -      display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);
  18.366 -      display.lineNumWidth = display.lineNumInnerWidth + padding;
  18.367 -      display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
  18.368 -      display.lineGutter.style.width = display.lineNumWidth + "px";
  18.369 -      return true;
  18.370 -    }
  18.371 -    return false;
  18.372 -  }
  18.373 -
  18.374 -  function lineNumberFor(options, i) {
  18.375 -    return String(options.lineNumberFormatter(i + options.firstLineNumber));
  18.376 -  }
  18.377 -  function compensateForHScroll(display) {
  18.378 -    return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;
  18.379 -  }
  18.380 -
  18.381 -  // DISPLAY DRAWING
  18.382 -
  18.383 -  function updateDisplay(cm, changes, viewPort) {
  18.384 -    var oldFrom = cm.display.showingFrom, oldTo = cm.display.showingTo;
  18.385 -    var updated = updateDisplayInner(cm, changes, viewPort);
  18.386 -    if (updated) {
  18.387 -      signalLater(cm, cm, "update", cm);
  18.388 -      if (cm.display.showingFrom != oldFrom || cm.display.showingTo != oldTo)
  18.389 -        signalLater(cm, cm, "viewportChange", cm, cm.display.showingFrom, cm.display.showingTo);
  18.390 -    }
  18.391 -    updateSelection(cm);
  18.392 -    updateScrollbars(cm.display, cm.view.doc.height);
  18.393 -
  18.394 -    return updated;
  18.395 -  }
  18.396 -
  18.397 -  // Uses a set of changes plus the current scroll position to
  18.398 -  // determine which DOM updates have to be made, and makes the
  18.399 -  // updates.
  18.400 -  function updateDisplayInner(cm, changes, viewPort) {
  18.401 -    var display = cm.display, doc = cm.view.doc;
  18.402 -    if (!display.wrapper.clientWidth) {
  18.403 -      display.showingFrom = display.showingTo = display.viewOffset = 0;
  18.404 -      return;
  18.405 -    }
  18.406 -
  18.407 -    // Compute the new visible window
  18.408 -    // If scrollTop is specified, use that to determine which lines
  18.409 -    // to render instead of the current scrollbar position.
  18.410 -    var visible = visibleLines(display, doc, viewPort);
  18.411 -    // Bail out if the visible area is already rendered and nothing changed.
  18.412 -    if (changes !== true && changes.length == 0 &&
  18.413 -        visible.from > display.showingFrom && visible.to < display.showingTo)
  18.414 -      return;
  18.415 -
  18.416 -    if (changes && maybeUpdateLineNumberWidth(cm))
  18.417 -      changes = true;
  18.418 -    display.sizer.style.marginLeft = display.scrollbarH.style.left = display.gutters.offsetWidth + "px";
  18.419 -
  18.420 -    // When merged lines are present, the line that needs to be
  18.421 -    // redrawn might not be the one that was changed.
  18.422 -    if (changes !== true && sawCollapsedSpans)
  18.423 -      for (var i = 0; i < changes.length; ++i) {
  18.424 -        var ch = changes[i], merged;
  18.425 -        while (merged = collapsedSpanAtStart(getLine(doc, ch.from))) {
  18.426 -          var from = merged.find().from.line;
  18.427 -          if (ch.diff) ch.diff -= ch.from - from;
  18.428 -          ch.from = from;
  18.429 -        }
  18.430 -      }
  18.431 -
  18.432 -    // Used to determine which lines need their line numbers updated
  18.433 -    var positionsChangedFrom = changes === true ? 0 : Infinity;
  18.434 -    if (cm.options.lineNumbers && changes && changes !== true)
  18.435 -      for (var i = 0; i < changes.length; ++i)
  18.436 -        if (changes[i].diff) { positionsChangedFrom = changes[i].from; break; }
  18.437 -
  18.438 -    var from = Math.max(visible.from - cm.options.viewportMargin, 0);
  18.439 -    var to = Math.min(doc.size, visible.to + cm.options.viewportMargin);
  18.440 -    if (display.showingFrom < from && from - display.showingFrom < 20) from = display.showingFrom;
  18.441 -    if (display.showingTo > to && display.showingTo - to < 20) to = Math.min(doc.size, display.showingTo);
  18.442 -    if (sawCollapsedSpans) {
  18.443 -      from = lineNo(visualLine(doc, getLine(doc, from)));
  18.444 -      while (to < doc.size && lineIsHidden(getLine(doc, to))) ++to;
  18.445 -    }
  18.446 -
  18.447 -    // Create a range of theoretically intact lines, and punch holes
  18.448 -    // in that using the change info.
  18.449 -    var intact = changes === true ? [] :
  18.450 -      computeIntact([{from: display.showingFrom, to: display.showingTo}], changes);
  18.451 -    // Clip off the parts that won't be visible
  18.452 -    var intactLines = 0;
  18.453 -    for (var i = 0; i < intact.length; ++i) {
  18.454 -      var range = intact[i];
  18.455 -      if (range.from < from) range.from = from;
  18.456 -      if (range.to > to) range.to = to;
  18.457 -      if (range.from >= range.to) intact.splice(i--, 1);
  18.458 -      else intactLines += range.to - range.from;
  18.459 -    }
  18.460 -    if (intactLines == to - from && from == display.showingFrom && to == display.showingTo)
  18.461 -      return;
  18.462 -    intact.sort(function(a, b) {return a.from - b.from;});
  18.463 -
  18.464 -    if (intactLines < (to - from) * .7) display.lineDiv.style.display = "none";
  18.465 -    patchDisplay(cm, from, to, intact, positionsChangedFrom);
  18.466 -    display.lineDiv.style.display = "";
  18.467 -
  18.468 -    var different = from != display.showingFrom || to != display.showingTo ||
  18.469 -      display.lastSizeC != display.wrapper.clientHeight;
  18.470 -    // This is just a bogus formula that detects when the editor is
  18.471 -    // resized or the font size changes.
  18.472 -    if (different) display.lastSizeC = display.wrapper.clientHeight;
  18.473 -    display.showingFrom = from; display.showingTo = to;
  18.474 -    startWorker(cm, 100);
  18.475 -
  18.476 -    var prevBottom = display.lineDiv.offsetTop;
  18.477 -    for (var node = display.lineDiv.firstChild, height; node; node = node.nextSibling) if (node.lineObj) {
  18.478 -      if (ie_lt8) {
  18.479 -        var bot = node.offsetTop + node.offsetHeight;
  18.480 -        height = bot - prevBottom;
  18.481 -        prevBottom = bot;
  18.482 -      } else {
  18.483 -        var box = node.getBoundingClientRect();
  18.484 -        height = box.bottom - box.top;
  18.485 -      }
  18.486 -      var diff = node.lineObj.height - height;
  18.487 -      if (height < 2) height = textHeight(display);
  18.488 -      if (diff > .001 || diff < -.001)
  18.489 -        updateLineHeight(node.lineObj, height);
  18.490 -    }
  18.491 -    display.viewOffset = heightAtLine(cm, getLine(doc, from));
  18.492 -    // Position the mover div to align with the current virtual scroll position
  18.493 -    display.mover.style.top = display.viewOffset + "px";
  18.494 -    return true;
  18.495 -  }
  18.496 -
  18.497 -  function computeIntact(intact, changes) {
  18.498 -    for (var i = 0, l = changes.length || 0; i < l; ++i) {
  18.499 -      var change = changes[i], intact2 = [], diff = change.diff || 0;
  18.500 -      for (var j = 0, l2 = intact.length; j < l2; ++j) {
  18.501 -        var range = intact[j];
  18.502 -        if (change.to <= range.from && change.diff) {
  18.503 -          intact2.push({from: range.from + diff, to: range.to + diff});
  18.504 -        } else if (change.to <= range.from || change.from >= range.to) {
  18.505 -          intact2.push(range);
  18.506 -        } else {
  18.507 -          if (change.from > range.from)
  18.508 -            intact2.push({from: range.from, to: change.from});
  18.509 -          if (change.to < range.to)
  18.510 -            intact2.push({from: change.to + diff, to: range.to + diff});
  18.511 -        }
  18.512 -      }
  18.513 -      intact = intact2;
  18.514 -    }
  18.515 -    return intact;
  18.516 -  }
  18.517 -
  18.518 -  function getDimensions(cm) {
  18.519 -    var d = cm.display, left = {}, width = {};
  18.520 -    for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
  18.521 -      left[cm.options.gutters[i]] = n.offsetLeft;
  18.522 -      width[cm.options.gutters[i]] = n.offsetWidth;
  18.523 -    }
  18.524 -    return {fixedPos: compensateForHScroll(d),
  18.525 -            gutterTotalWidth: d.gutters.offsetWidth,
  18.526 -            gutterLeft: left,
  18.527 -            gutterWidth: width,
  18.528 -            wrapperWidth: d.wrapper.clientWidth};
  18.529 -  }
  18.530 -
  18.531 -  function patchDisplay(cm, from, to, intact, updateNumbersFrom) {
  18.532 -    var dims = getDimensions(cm);
  18.533 -    var display = cm.display, lineNumbers = cm.options.lineNumbers;
  18.534 -    // IE does bad things to nodes when .innerHTML = "" is used on a parent
  18.535 -    // we still need widgets and markers intact to add back to the new content later
  18.536 -    if (!intact.length && !ie && (!webkit || !cm.display.currentWheelTarget))
  18.537 -      removeChildren(display.lineDiv);
  18.538 -    var container = display.lineDiv, cur = container.firstChild;
  18.539 -
  18.540 -    function rm(node) {
  18.541 -      var next = node.nextSibling;
  18.542 -      if (webkit && mac && cm.display.currentWheelTarget == node) {
  18.543 -        node.style.display = "none";
  18.544 -        node.lineObj = null;
  18.545 -      } else {
  18.546 -        container.removeChild(node);
  18.547 -      }
  18.548 -      return next;
  18.549 -    }
  18.550 -
  18.551 -    var nextIntact = intact.shift(), lineNo = from;
  18.552 -    cm.view.doc.iter(from, to, function(line) {
  18.553 -      if (nextIntact && nextIntact.to == lineNo) nextIntact = intact.shift();
  18.554 -      if (lineIsHidden(line)) {
  18.555 -        if (line.height != 0) updateLineHeight(line, 0);
  18.556 -      } else if (nextIntact && nextIntact.from <= lineNo && nextIntact.to > lineNo) {
  18.557 -        // This line is intact. Skip to the actual node. Update its
  18.558 -        // line number if needed.
  18.559 -        while (cur.lineObj != line) cur = rm(cur);
  18.560 -        if (lineNumbers && updateNumbersFrom <= lineNo && cur.lineNumber)
  18.561 -          setTextContent(cur.lineNumber, lineNumberFor(cm.options, lineNo));
  18.562 -        cur = cur.nextSibling;
  18.563 -      } else {
  18.564 -        // This line needs to be generated.
  18.565 -        var lineNode = buildLineElement(cm, line, lineNo, dims);
  18.566 -        container.insertBefore(lineNode, cur);
  18.567 -        lineNode.lineObj = line;
  18.568 -      }
  18.569 -      ++lineNo;
  18.570 -    });
  18.571 -    while (cur) cur = rm(cur);
  18.572 -  }
  18.573 -
  18.574 -  function buildLineElement(cm, line, lineNo, dims) {
  18.575 -    var lineElement = lineContent(cm, line);
  18.576 -    var markers = line.gutterMarkers, display = cm.display;
  18.577 -
  18.578 -    if (!cm.options.lineNumbers && !markers && !line.bgClass && !line.wrapClass &&
  18.579 -        (!line.widgets || !line.widgets.length)) return lineElement;
  18.580 -
  18.581 -    // Lines with gutter elements or a background class need
  18.582 -    // to be wrapped again, and have the extra elements added
  18.583 -    // to the wrapper div
  18.584 -
  18.585 -    var wrap = elt("div", null, line.wrapClass, "position: relative");
  18.586 -    if (cm.options.lineNumbers || markers) {
  18.587 -      var gutterWrap = wrap.appendChild(elt("div", null, null, "position: absolute; left: " +
  18.588 -                                            dims.fixedPos + "px"));
  18.589 -      wrap.alignable = [gutterWrap];
  18.590 -      if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
  18.591 -        wrap.lineNumber = gutterWrap.appendChild(
  18.592 -          elt("div", lineNumberFor(cm.options, lineNo),
  18.593 -              "CodeMirror-linenumber CodeMirror-gutter-elt",
  18.594 -              "left: " + dims.gutterLeft["CodeMirror-linenumbers"] + "px; width: "
  18.595 -              + display.lineNumInnerWidth + "px"));
  18.596 -      if (markers)
  18.597 -        for (var k = 0; k < cm.options.gutters.length; ++k) {
  18.598 -          var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];
  18.599 -          if (found)
  18.600 -            gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt", "left: " +
  18.601 -                                       dims.gutterLeft[id] + "px; width: " + dims.gutterWidth[id] + "px"));
  18.602 -        }
  18.603 -    }
  18.604 -    // Kludge to make sure the styled element lies behind the selection (by z-index)
  18.605 -    if (line.bgClass)
  18.606 -      wrap.appendChild(elt("div", "\u00a0", line.bgClass + " CodeMirror-linebackground"));
  18.607 -    wrap.appendChild(lineElement);
  18.608 -    if (line.widgets)
  18.609 -      for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
  18.610 -        var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
  18.611 -        node.widget = widget;
  18.612 -        if (widget.noHScroll) {
  18.613 -          (wrap.alignable || (wrap.alignable = [])).push(node);
  18.614 -          var width = dims.wrapperWidth;
  18.615 -          node.style.left = dims.fixedPos + "px";
  18.616 -          if (!widget.coverGutter) {
  18.617 -            width -= dims.gutterTotalWidth;
  18.618 -            node.style.paddingLeft = dims.gutterTotalWidth + "px";
  18.619 -          }
  18.620 -          node.style.width = width + "px";
  18.621 -        }
  18.622 -        if (widget.coverGutter) {
  18.623 -          node.style.zIndex = 5;
  18.624 -          node.style.position = "relative";
  18.625 -          if (!widget.noHScroll) node.style.marginLeft = -dims.gutterTotalWidth + "px";
  18.626 -        }
  18.627 -        if (widget.above)
  18.628 -          wrap.insertBefore(node, cm.options.lineNumbers && line.height != 0 ? gutterWrap : lineElement);
  18.629 -        else
  18.630 -          wrap.appendChild(node);
  18.631 -      }
  18.632 -
  18.633 -    if (ie_lt8) wrap.style.zIndex = 2;
  18.634 -    return wrap;
  18.635 -  }
  18.636 -
  18.637 -  // SELECTION / CURSOR
  18.638 -
  18.639 -  function updateSelection(cm) {
  18.640 -    var display = cm.display;
  18.641 -    var collapsed = posEq(cm.view.sel.from, cm.view.sel.to);
  18.642 -    if (collapsed || cm.options.showCursorWhenSelecting)
  18.643 -      updateSelectionCursor(cm);
  18.644 -    else
  18.645 -      display.cursor.style.display = display.otherCursor.style.display = "none";
  18.646 -    if (!collapsed)
  18.647 -      updateSelectionRange(cm);
  18.648 -    else
  18.649 -      display.selectionDiv.style.display = "none";
  18.650 -
  18.651 -    // Move the hidden textarea near the cursor to prevent scrolling artifacts
  18.652 -    var headPos = cursorCoords(cm, cm.view.sel.head, "div");
  18.653 -    var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
  18.654 -    display.inputDiv.style.top = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
  18.655 -                                                      headPos.top + lineOff.top - wrapOff.top)) + "px";
  18.656 -    display.inputDiv.style.left = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
  18.657 -                                                       headPos.left + lineOff.left - wrapOff.left)) + "px";
  18.658 -  }
  18.659 -
  18.660 -  // No selection, plain cursor
  18.661 -  function updateSelectionCursor(cm) {
  18.662 -    var display = cm.display, pos = cursorCoords(cm, cm.view.sel.head, "div");
  18.663 -    display.cursor.style.left = pos.left + "px";
  18.664 -    display.cursor.style.top = pos.top + "px";
  18.665 -    display.cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
  18.666 -    display.cursor.style.display = "";
  18.667 -
  18.668 -    if (pos.other) {
  18.669 -      display.otherCursor.style.display = "";
  18.670 -      display.otherCursor.style.left = pos.other.left + "px";
  18.671 -      display.otherCursor.style.top = pos.other.top + "px";
  18.672 -      display.otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
  18.673 -    } else { display.otherCursor.style.display = "none"; }
  18.674 -  }
  18.675 -
  18.676 -  // Highlight selection
  18.677 -  function updateSelectionRange(cm) {
  18.678 -    var display = cm.display, doc = cm.view.doc, sel = cm.view.sel;
  18.679 -    var fragment = document.createDocumentFragment();
  18.680 -    var clientWidth = display.lineSpace.offsetWidth, pl = paddingLeft(cm.display);
  18.681 -
  18.682 -    function add(left, top, width, bottom) {
  18.683 -      if (top < 0) top = 0;
  18.684 -      fragment.appendChild(elt("div", null, "CodeMirror-selected", "position: absolute; left: " + left +
  18.685 -                               "px; top: " + top + "px; width: " + (width == null ? clientWidth - left : width) +
  18.686 -                               "px; height: " + (bottom - top) + "px"));
  18.687 -    }
  18.688 -
  18.689 -    function drawForLine(line, fromArg, toArg, retTop) {
  18.690 -      var lineObj = getLine(doc, line);
  18.691 -      var lineLen = lineObj.text.length, rVal = retTop ? Infinity : -Infinity;
  18.692 -      function coords(ch) {
  18.693 -        return charCoords(cm, {line: line, ch: ch}, "div", lineObj);
  18.694 -      }
  18.695 -
  18.696 -      iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {
  18.697 -        var leftPos = coords(dir == "rtl" ? to - 1 : from);
  18.698 -        var rightPos = coords(dir == "rtl" ? from : to - 1);
  18.699 -        var left = leftPos.left, right = rightPos.right;
  18.700 -        if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
  18.701 -          add(left, leftPos.top, null, leftPos.bottom);
  18.702 -          left = pl;
  18.703 -          if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);
  18.704 -        }
  18.705 -        if (toArg == null && to == lineLen) right = clientWidth;
  18.706 -        if (fromArg == null && from == 0) left = pl;
  18.707 -        rVal = retTop ? Math.min(rightPos.top, rVal) : Math.max(rightPos.bottom, rVal);
  18.708 -        if (left < pl + 1) left = pl;
  18.709 -        add(left, rightPos.top, right - left, rightPos.bottom);
  18.710 -      });
  18.711 -      return rVal;
  18.712 -    }
  18.713 -
  18.714 -    if (sel.from.line == sel.to.line) {
  18.715 -      drawForLine(sel.from.line, sel.from.ch, sel.to.ch);
  18.716 -    } else {
  18.717 -      var fromObj = getLine(doc, sel.from.line);
  18.718 -      var cur = fromObj, merged, path = [sel.from.line, sel.from.ch], singleLine;
  18.719 -      while (merged = collapsedSpanAtEnd(cur)) {
  18.720 -        var found = merged.find();
  18.721 -        path.push(found.from.ch, found.to.line, found.to.ch);
  18.722 -        if (found.to.line == sel.to.line) {
  18.723 -          path.push(sel.to.ch);
  18.724 -          singleLine = true;
  18.725 -          break;
  18.726 -        }
  18.727 -        cur = getLine(doc, found.to.line);
  18.728 -      }
  18.729 -
  18.730 -      // This is a single, merged line
  18.731 -      if (singleLine) {
  18.732 -        for (var i = 0; i < path.length; i += 3)
  18.733 -          drawForLine(path[i], path[i+1], path[i+2]);
  18.734 -      } else {
  18.735 -        var middleTop, middleBot, toObj = getLine(doc, sel.to.line);
  18.736 -        if (sel.from.ch)
  18.737 -          // Draw the first line of selection.
  18.738 -          middleTop = drawForLine(sel.from.line, sel.from.ch, null, false);
  18.739 -        else
  18.740 -          // Simply include it in the middle block.
  18.741 -          middleTop = heightAtLine(cm, fromObj) - display.viewOffset;
  18.742 -
  18.743 -        if (!sel.to.ch)
  18.744 -          middleBot = heightAtLine(cm, toObj) - display.viewOffset;
  18.745 -        else
  18.746 -          middleBot = drawForLine(sel.to.line, collapsedSpanAtStart(toObj) ? null : 0, sel.to.ch, true);
  18.747 -
  18.748 -        if (middleTop < middleBot) add(pl, middleTop, null, middleBot);
  18.749 -      }
  18.750 -    }
  18.751 -
  18.752 -    removeChildrenAndAdd(display.selectionDiv, fragment);
  18.753 -    display.selectionDiv.style.display = "";
  18.754 -  }
  18.755 -
  18.756 -  // Cursor-blinking
  18.757 -  function restartBlink(cm) {
  18.758 -    var display = cm.display;
  18.759 -    clearInterval(display.blinker);
  18.760 -    var on = true;
  18.761 -    display.cursor.style.visibility = display.otherCursor.style.visibility = "";
  18.762 -    display.blinker = setInterval(function() {
  18.763 -      if (!display.cursor.offsetHeight) return;
  18.764 -      display.cursor.style.visibility = display.otherCursor.style.visibility = (on = !on) ? "" : "hidden";
  18.765 -    }, cm.options.cursorBlinkRate);
  18.766 -  }
  18.767 -
  18.768 -  // HIGHLIGHT WORKER
  18.769 -
  18.770 -  function startWorker(cm, time) {
  18.771 -    if (cm.view.frontier < cm.display.showingTo)
  18.772 -      cm.view.highlight.set(time, bind(highlightWorker, cm));
  18.773 -  }
  18.774 -
  18.775 -  function highlightWorker(cm) {
  18.776 -    var view = cm.view, doc = view.doc;
  18.777 -    if (view.frontier >= cm.display.showingTo) return;
  18.778 -    var end = +new Date + cm.options.workTime;
  18.779 -    var state = copyState(view.mode, getStateBefore(cm, view.frontier));
  18.780 -    var changed = [], prevChange;
  18.781 -    doc.iter(view.frontier, Math.min(doc.size, cm.display.showingTo + 500), function(line) {
  18.782 -      if (view.frontier >= cm.display.showingFrom) { // Visible
  18.783 -        if (highlightLine(cm, line, state) && view.frontier >= cm.display.showingFrom) {
  18.784 -          if (prevChange && prevChange.end == view.frontier) prevChange.end++;
  18.785 -          else changed.push(prevChange = {start: view.frontier, end: view.frontier + 1});
  18.786 -        }
  18.787 -        line.stateAfter = copyState(view.mode, state);
  18.788 -      } else {
  18.789 -        processLine(cm, line, state);
  18.790 -        line.stateAfter = view.frontier % 5 == 0 ? copyState(view.mode, state) : null;
  18.791 -      }
  18.792 -      ++view.frontier;
  18.793 -      if (+new Date > end) {
  18.794 -        startWorker(cm, cm.options.workDelay);
  18.795 -        return true;
  18.796 -      }
  18.797 -    });
  18.798 -    if (changed.length)
  18.799 -      operation(cm, function() {
  18.800 -        for (var i = 0; i < changed.length; ++i)
  18.801 -          regChange(this, changed[i].start, changed[i].end);
  18.802 -      })();
  18.803 -  }
  18.804 -
  18.805 -  // Finds the line to start with when starting a parse. Tries to
  18.806 -  // find a line with a stateAfter, so that it can start with a
  18.807 -  // valid state. If that fails, it returns the line with the
  18.808 -  // smallest indentation, which tends to need the least context to
  18.809 -  // parse correctly.
  18.810 -  function findStartLine(cm, n) {
  18.811 -    var minindent, minline, doc = cm.view.doc;
  18.812 -    for (var search = n, lim = n - 100; search > lim; --search) {
  18.813 -      if (search == 0) return 0;
  18.814 -      var line = getLine(doc, search-1);
  18.815 -      if (line.stateAfter) return search;
  18.816 -      var indented = countColumn(line.text, null, cm.options.tabSize);
  18.817 -      if (minline == null || minindent > indented) {
  18.818 -        minline = search - 1;
  18.819 -        minindent = indented;
  18.820 -      }
  18.821 -    }
  18.822 -    return minline;
  18.823 -  }
  18.824 -
  18.825 -  function getStateBefore(cm, n) {
  18.826 -    var view = cm.view;
  18.827 -    var pos = findStartLine(cm, n), state = pos && getLine(view.doc, pos-1).stateAfter;
  18.828 -    if (!state) state = startState(view.mode);
  18.829 -    else state = copyState(view.mode, state);
  18.830 -    view.doc.iter(pos, n, function(line) {
  18.831 -      processLine(cm, line, state);
  18.832 -      var save = pos == n - 1 || pos % 5 == 0 || pos >= view.showingFrom && pos < view.showingTo;
  18.833 -      line.stateAfter = save ? copyState(view.mode, state) : null;
  18.834 -      ++pos;
  18.835 -    });
  18.836 -    return state;
  18.837 -  }
  18.838 -
  18.839 -  // POSITION MEASUREMENT
  18.840 -  
  18.841 -  function paddingTop(display) {return display.lineSpace.offsetTop;}
  18.842 -  function paddingLeft(display) {
  18.843 -    var e = removeChildrenAndAdd(display.measure, elt("pre")).appendChild(elt("span", "x"));
  18.844 -    return e.offsetLeft;
  18.845 -  }
  18.846 -
  18.847 -  function measureChar(cm, line, ch, data) {
  18.848 -    var data = data || measureLine(cm, line), dir = -1;
  18.849 -    for (var pos = ch;; pos += dir) {
  18.850 -      var r = data[pos];
  18.851 -      if (r) break;
  18.852 -      if (dir < 0 && pos == 0) dir = 1;
  18.853 -    }
  18.854 -    return {left: pos < ch ? r.right : r.left,
  18.855 -            right: pos > ch ? r.left : r.right,
  18.856 -            top: r.top, bottom: r.bottom};
  18.857 -  }
  18.858 -
  18.859 -  function measureLine(cm, line) {
  18.860 -    // First look in the cache
  18.861 -    var display = cm.display, cache = cm.display.measureLineCache;
  18.862 -    for (var i = 0; i < cache.length; ++i) {
  18.863 -      var memo = cache[i];
  18.864 -      if (memo.text == line.text && memo.markedSpans == line.markedSpans &&
  18.865 -          display.scroller.clientWidth == memo.width)
  18.866 -        return memo.measure;
  18.867 -    }
  18.868 -    
  18.869 -    var measure = measureLineInner(cm, line);
  18.870 -    // Store result in the cache
  18.871 -    var memo = {text: line.text, width: display.scroller.clientWidth,
  18.872 -                markedSpans: line.markedSpans, measure: measure};
  18.873 -    if (cache.length == 16) cache[++display.measureLineCachePos % 16] = memo;
  18.874 -    else cache.push(memo);
  18.875 -    return measure;
  18.876 -  }
  18.877 -
  18.878 -  function measureLineInner(cm, line) {
  18.879 -    var display = cm.display, measure = emptyArray(line.text.length);
  18.880 -    var pre = lineContent(cm, line, measure);
  18.881 -
  18.882 -    // IE does not cache element positions of inline elements between
  18.883 -    // calls to getBoundingClientRect. This makes the loop below,
  18.884 -    // which gathers the positions of all the characters on the line,
  18.885 -    // do an amount of layout work quadratic to the number of
  18.886 -    // characters. When line wrapping is off, we try to improve things
  18.887 -    // by first subdividing the line into a bunch of inline blocks, so
  18.888 -    // that IE can reuse most of the layout information from caches
  18.889 -    // for those blocks. This does interfere with line wrapping, so it
  18.890 -    // doesn't work when wrapping is on, but in that case the
  18.891 -    // situation is slightly better, since IE does cache line-wrapping
  18.892 -    // information and only recomputes per-line.
  18.893 -    if (ie && !ie_lt8 && !cm.options.lineWrapping && pre.childNodes.length > 100) {
  18.894 -      var fragment = document.createDocumentFragment();
  18.895 -      var chunk = 10, n = pre.childNodes.length;
  18.896 -      for (var i = 0, chunks = Math.ceil(n / chunk); i < chunks; ++i) {
  18.897 -        var wrap = elt("div", null, null, "display: inline-block");
  18.898 -        for (var j = 0; j < chunk && n; ++j) {
  18.899 -          wrap.appendChild(pre.firstChild);
  18.900 -          --n;
  18.901 -        }
  18.902 -        fragment.appendChild(wrap);
  18.903 -      }
  18.904 -      pre.appendChild(fragment);
  18.905 -    }
  18.906 -
  18.907 -    removeChildrenAndAdd(display.measure, pre);
  18.908 -
  18.909 -    var outer = display.lineDiv.getBoundingClientRect();
  18.910 -    var vranges = [], data = emptyArray(line.text.length), maxBot = pre.offsetHeight;
  18.911 -    for (var i = 0, cur; i < measure.length; ++i) if (cur = measure[i]) {
  18.912 -      var size = cur.getBoundingClientRect();
  18.913 -      var top = Math.max(0, size.top - outer.top), bot = Math.min(size.bottom - outer.top, maxBot);
  18.914 -      for (var j = 0; j < vranges.length; j += 2) {
  18.915 -        var rtop = vranges[j], rbot = vranges[j+1];
  18.916 -        if (rtop > bot || rbot < top) continue;
  18.917 -        if (rtop <= top && rbot >= bot ||
  18.918 -            top <= rtop && bot >= rbot ||
  18.919 -            Math.min(bot, rbot) - Math.max(top, rtop) >= (bot - top) >> 1) {
  18.920 -          vranges[j] = Math.min(top, rtop);
  18.921 -          vranges[j+1] = Math.max(bot, rbot);
  18.922 -          break;
  18.923 -        }
  18.924 -      }
  18.925 -      if (j == vranges.length) vranges.push(top, bot);
  18.926 -      data[i] = {left: size.left - outer.left, right: size.right - outer.left, top: j};
  18.927 -    }
  18.928 -    for (var i = 0, cur; i < data.length; ++i) if (cur = data[i]) {
  18.929 -      var vr = cur.top;
  18.930 -      cur.top = vranges[vr]; cur.bottom = vranges[vr+1];
  18.931 -    }
  18.932 -    return data;
  18.933 -  }
  18.934 -
  18.935 -  function clearCaches(cm) {
  18.936 -    cm.display.measureLineCache.length = cm.display.measureLineCachePos = 0;
  18.937 -    cm.display.cachedCharWidth = cm.display.cachedTextHeight = null;
  18.938 -    cm.view.maxLineChanged = true;
  18.939 -  }
  18.940 -
  18.941 -  // Context is one of "line", "div" (display.lineDiv), "local"/null (editor), or "page"
  18.942 -  function intoCoordSystem(cm, lineObj, rect, context) {
  18.943 -    if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {
  18.944 -      var size = lineObj.widgets[i].node.offsetHeight;
  18.945 -      rect.top += size; rect.bottom += size;
  18.946 -    }
  18.947 -    if (context == "line") return rect;
  18.948 -    if (!context) context = "local";
  18.949 -    var yOff = heightAtLine(cm, lineObj);
  18.950 -    if (context != "local") yOff -= cm.display.viewOffset;
  18.951 -    if (context == "page") {
  18.952 -      var lOff = cm.display.lineSpace.getBoundingClientRect();
  18.953 -      yOff += lOff.top + (window.pageYOffset || (document.documentElement || document.body).scrollTop);
  18.954 -      var xOff = lOff.left + (window.pageXOffset || (document.documentElement || document.body).scrollLeft);
  18.955 -      rect.left += xOff; rect.right += xOff;
  18.956 -    }
  18.957 -    rect.top += yOff; rect.bottom += yOff;
  18.958 -    return rect;
  18.959 -  }
  18.960 -
  18.961 -  function charCoords(cm, pos, context, lineObj) {
  18.962 -    if (!lineObj) lineObj = getLine(cm.view.doc, pos.line);
  18.963 -    return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch), context);
  18.964 -  }
  18.965 -
  18.966 -  function cursorCoords(cm, pos, context, lineObj, measurement) {
  18.967 -    lineObj = lineObj || getLine(cm.view.doc, pos.line);
  18.968 -    if (!measurement) measurement = measureLine(cm, lineObj);
  18.969 -    function get(ch, right) {
  18.970 -      var m = measureChar(cm, lineObj, ch, measurement);
  18.971 -      if (right) m.left = m.right; else m.right = m.left;
  18.972 -      return intoCoordSystem(cm, lineObj, m, context);
  18.973 -    }
  18.974 -    var order = getOrder(lineObj), ch = pos.ch;
  18.975 -    if (!order) return get(ch);
  18.976 -    var main, other, linedir = order[0].level;
  18.977 -    for (var i = 0; i < order.length; ++i) {
  18.978 -      var part = order[i], rtl = part.level % 2, nb, here;
  18.979 -      if (part.from < ch && part.to > ch) return get(ch, rtl);
  18.980 -      var left = rtl ? part.to : part.from, right = rtl ? part.from : part.to;
  18.981 -      if (left == ch) {
  18.982 -        // Opera and IE return bogus offsets and widths for edges
  18.983 -        // where the direction flips, but only for the side with the
  18.984 -        // lower level. So we try to use the side with the higher
  18.985 -        // level.
  18.986 -        if (i && part.level < (nb = order[i-1]).level) here = get(nb.level % 2 ? nb.from : nb.to - 1, true);
  18.987 -        else here = get(rtl && part.from != part.to ? ch - 1 : ch);
  18.988 -        if (rtl == linedir) main = here; else other = here;
  18.989 -      } else if (right == ch) {
  18.990 -        var nb = i < order.length - 1 && order[i+1];
  18.991 -        if (!rtl && nb && nb.from == nb.to) continue;
  18.992 -        if (nb && part.level < nb.level) here = get(nb.level % 2 ? nb.to - 1 : nb.from);
  18.993 -        else here = get(rtl ? ch : ch - 1, true);
  18.994 -        if (rtl == linedir) main = here; else other = here;
  18.995 -      }
  18.996 -    }
  18.997 -    if (linedir && !ch) other = get(order[0].to - 1);
  18.998 -    if (!main) return other;
  18.999 -    if (other) main.other = other;
 18.1000 -    return main;
 18.1001 -  }
 18.1002 -
 18.1003 -  // Coords must be lineSpace-local
 18.1004 -  function coordsChar(cm, x, y) {
 18.1005 -    var doc = cm.view.doc;
 18.1006 -    y += cm.display.viewOffset;
 18.1007 -    if (y < 0) return {line: 0, ch: 0, outside: true};
 18.1008 -    var lineNo = lineAtHeight(doc, y);
 18.1009 -    if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc, doc.size - 1).text.length};
 18.1010 -    if (x < 0) x = 0;
 18.1011 -
 18.1012 -    for (;;) {
 18.1013 -      var lineObj = getLine(doc, lineNo);
 18.1014 -      var found = coordsCharInner(cm, lineObj, lineNo, x, y);
 18.1015 -      var merged = collapsedSpanAtEnd(lineObj);
 18.1016 -      if (merged && found.ch == lineRight(lineObj))
 18.1017 -        lineNo = merged.find().to.line;
 18.1018 -      else
 18.1019 -        return found;
 18.1020 -    }
 18.1021 -  }
 18.1022 -
 18.1023 -  function coordsCharInner(cm, lineObj, lineNo, x, y) {
 18.1024 -    var innerOff = y - heightAtLine(cm, lineObj);
 18.1025 -    var wrongLine = false, cWidth = cm.display.wrapper.clientWidth;
 18.1026 -    var measurement = measureLine(cm, lineObj);
 18.1027 -
 18.1028 -    function getX(ch) {
 18.1029 -      var sp = cursorCoords(cm, {line: lineNo, ch: ch}, "line",
 18.1030 -                            lineObj, measurement);
 18.1031 -      wrongLine = true;
 18.1032 -      if (innerOff > sp.bottom) return Math.max(0, sp.left - cWidth);
 18.1033 -      else if (innerOff < sp.top) return sp.left + cWidth;
 18.1034 -      else wrongLine = false;
 18.1035 -      return sp.left;
 18.1036 -    }
 18.1037 -
 18.1038 -    var bidi = getOrder(lineObj), dist = lineObj.text.length;
 18.1039 -    var from = lineLeft(lineObj), to = lineRight(lineObj);
 18.1040 -    var fromX = paddingLeft(cm.display), toX = getX(to);
 18.1041 -
 18.1042 -    if (x > toX) return {line: lineNo, ch: to, outside: wrongLine};
 18.1043 -    // Do a binary search between these bounds.
 18.1044 -    for (;;) {
 18.1045 -      if (bidi ? to == from || to == moveVisually(lineObj, from, 1) : to - from <= 1) {
 18.1046 -        var after = x - fromX < toX - x, ch = after ? from : to;
 18.1047 -        while (isExtendingChar.test(lineObj.text.charAt(ch))) ++ch;
 18.1048 -        return {line: lineNo, ch: ch, after: after, outside: wrongLine};
 18.1049 -      }
 18.1050 -      var step = Math.ceil(dist / 2), middle = from + step;
 18.1051 -      if (bidi) {
 18.1052 -        middle = from;
 18.1053 -        for (var i = 0; i < step; ++i) middle = moveVisually(lineObj, middle, 1);
 18.1054 -      }
 18.1055 -      var middleX = getX(middle);
 18.1056 -      if (middleX > x) {to = middle; toX = middleX; if (wrongLine) toX += 1000; dist -= step;}
 18.1057 -      else {from = middle; fromX = middleX; dist = step;}
 18.1058 -    }
 18.1059 -  }
 18.1060 -
 18.1061 -  var measureText;
 18.1062 -  function textHeight(display) {
 18.1063 -    if (display.cachedTextHeight != null) return display.cachedTextHeight;
 18.1064 -    if (measureText == null) {
 18.1065 -      measureText = elt("pre");
 18.1066 -      // Measure a bunch of lines, for browsers that compute
 18.1067 -      // fractional heights.
 18.1068 -      for (var i = 0; i < 49; ++i) {
 18.1069 -        measureText.appendChild(document.createTextNode("x"));
 18.1070 -        measureText.appendChild(elt("br"));
 18.1071 -      }
 18.1072 -      measureText.appendChild(document.createTextNode("x"));
 18.1073 -    }
 18.1074 -    removeChildrenAndAdd(display.measure, measureText);
 18.1075 -    var height = measureText.offsetHeight / 50;
 18.1076 -    if (height > 3) display.cachedTextHeight = height;
 18.1077 -    removeChildren(display.measure);
 18.1078 -    return height || 1;
 18.1079 -  }
 18.1080 -
 18.1081 -  function charWidth(display) {
 18.1082 -    if (display.cachedCharWidth != null) return display.cachedCharWidth;
 18.1083 -    var anchor = elt("span", "x");
 18.1084 -    var pre = elt("pre", [anchor]);
 18.1085 -    removeChildrenAndAdd(display.measure, pre);
 18.1086 -    var width = anchor.offsetWidth;
 18.1087 -    if (width > 2) display.cachedCharWidth = width;
 18.1088 -    return width || 10;
 18.1089 -  }
 18.1090 -
 18.1091 -  // OPERATIONS
 18.1092 -
 18.1093 -  // Operations are used to wrap changes in such a way that each
 18.1094 -  // change won't have to update the cursor and display (which would
 18.1095 -  // be awkward, slow, and error-prone), but instead updates are
 18.1096 -  // batched and then all combined and executed at once.
 18.1097 -
 18.1098 -  function startOperation(cm) {
 18.1099 -    if (cm.curOp) ++cm.curOp.depth;
 18.1100 -    else cm.curOp = {
 18.1101 -      // Nested operations delay update until the outermost one
 18.1102 -      // finishes.
 18.1103 -      depth: 1,
 18.1104 -      // An array of ranges of lines that have to be updated. See
 18.1105 -      // updateDisplay.
 18.1106 -      changes: [],
 18.1107 -      delayedCallbacks: [],
 18.1108 -      updateInput: null,
 18.1109 -      userSelChange: null,
 18.1110 -      textChanged: null,
 18.1111 -      selectionChanged: false,
 18.1112 -      updateMaxLine: false,
 18.1113 -      id: ++cm.nextOpId
 18.1114 -    };
 18.1115 -  }
 18.1116 -
 18.1117 -  function endOperation(cm) {
 18.1118 -    var op = cm.curOp;
 18.1119 -    if (--op.depth) return;
 18.1120 -    cm.curOp = null;
 18.1121 -    var view = cm.view, display = cm.display;
 18.1122 -    if (op.updateMaxLine) computeMaxLength(view);
 18.1123 -    if (view.maxLineChanged && !cm.options.lineWrapping) {
 18.1124 -      var width = measureChar(cm, view.maxLine, view.maxLine.text.length).right;
 18.1125 -      display.sizer.style.minWidth = (width + 3 + scrollerCutOff) + "px";
 18.1126 -      view.maxLineChanged = false;
 18.1127 -    }
 18.1128 -    var newScrollPos, updated;
 18.1129 -    if (op.selectionChanged) {
 18.1130 -      var coords = cursorCoords(cm, view.sel.head);
 18.1131 -      newScrollPos = calculateScrollPos(cm, coords.left, coords.top, coords.left, coords.bottom);
 18.1132 -    }
 18.1133 -    if (op.changes.length || newScrollPos && newScrollPos.scrollTop != null)
 18.1134 -      updated = updateDisplay(cm, op.changes, newScrollPos && newScrollPos.scrollTop);
 18.1135 -    if (!updated && op.selectionChanged) updateSelection(cm);
 18.1136 -    if (newScrollPos) scrollCursorIntoView(cm);
 18.1137 -    if (op.selectionChanged) restartBlink(cm);
 18.1138 -
 18.1139 -    if (view.focused && op.updateInput)
 18.1140 -      resetInput(cm, op.userSelChange);
 18.1141 -
 18.1142 -    if (op.textChanged)
 18.1143 -      signal(cm, "change", cm, op.textChanged);
 18.1144 -    if (op.selectionChanged) signal(cm, "cursorActivity", cm);
 18.1145 -    for (var i = 0; i < op.delayedCallbacks.length; ++i) op.delayedCallbacks[i](cm);
 18.1146 -  }
 18.1147 -
 18.1148 -  // Wraps a function in an operation. Returns the wrapped function.
 18.1149 -  function operation(cm1, f) {
 18.1150 -    return function() {
 18.1151 -      var cm = cm1 || this;
 18.1152 -      startOperation(cm);
 18.1153 -      try {var result = f.apply(cm, arguments);}
 18.1154 -      finally {endOperation(cm);}
 18.1155 -      return result;
 18.1156 -    };
 18.1157 -  }
 18.1158 -
 18.1159 -  function regChange(cm, from, to, lendiff) {
 18.1160 -    cm.curOp.changes.push({from: from, to: to, diff: lendiff});
 18.1161 -  }
 18.1162 -
 18.1163 -  // INPUT HANDLING
 18.1164 -
 18.1165 -  function slowPoll(cm) {
 18.1166 -    if (cm.view.pollingFast) return;
 18.1167 -    cm.display.poll.set(cm.options.pollInterval, function() {
 18.1168 -      readInput(cm);
 18.1169 -      if (cm.view.focused) slowPoll(cm);
 18.1170 -    });
 18.1171 -  }
 18.1172 -
 18.1173 -  function fastPoll(cm) {
 18.1174 -    var missed = false;
 18.1175 -    cm.display.pollingFast = true;
 18.1176 -    function p() {
 18.1177 -      var changed = readInput(cm);
 18.1178 -      if (!changed && !missed) {missed = true; cm.display.poll.set(60, p);}
 18.1179 -      else {cm.display.pollingFast = false; slowPoll(cm);}
 18.1180 -    }
 18.1181 -    cm.display.poll.set(20, p);
 18.1182 -  }
 18.1183 -
 18.1184 -  // prevInput is a hack to work with IME. If we reset the textarea
 18.1185 -  // on every change, that breaks IME. So we look for changes
 18.1186 -  // compared to the previous content instead. (Modern browsers have
 18.1187 -  // events that indicate IME taking place, but these are not widely
 18.1188 -  // supported or compatible enough yet to rely on.)
 18.1189 -  function readInput(cm) {
 18.1190 -    var input = cm.display.input, prevInput = cm.display.prevInput, view = cm.view, sel = view.sel;
 18.1191 -    if (!view.focused || hasSelection(input) || isReadOnly(cm)) return false;
 18.1192 -    var text = input.value;
 18.1193 -    if (text == prevInput && posEq(sel.from, sel.to)) return false;
 18.1194 -    startOperation(cm);
 18.1195 -    view.sel.shift = false;
 18.1196 -    var same = 0, l = Math.min(prevInput.length, text.length);
 18.1197 -    while (same < l && prevInput[same] == text[same]) ++same;
 18.1198 -    var from = sel.from, to = sel.to;
 18.1199 -    if (same < prevInput.length)
 18.1200 -      from = {line: from.line, ch: from.ch - (prevInput.length - same)};
 18.1201 -    else if (view.overwrite && posEq(from, to) && !cm.display.pasteIncoming)
 18.1202 -      to = {line: to.line, ch: Math.min(getLine(cm.view.doc, to.line).text.length, to.ch + (text.length - same))};
 18.1203 -    var updateInput = cm.curOp.updateInput;
 18.1204 -    updateDoc(cm, from, to, splitLines(text.slice(same)), "end",
 18.1205 -              cm.display.pasteIncoming ? "paste" : "input", {from: from, to: to});
 18.1206 -    cm.curOp.updateInput = updateInput;
 18.1207 -    if (text.length > 1000) input.value = cm.display.prevInput = "";
 18.1208 -    else cm.display.prevInput = text;
 18.1209 -    endOperation(cm);
 18.1210 -    cm.display.pasteIncoming = false;
 18.1211 -    return true;
 18.1212 -  }
 18.1213 -
 18.1214 -  function resetInput(cm, user) {
 18.1215 -    var view = cm.view, minimal, selected;
 18.1216 -    if (!posEq(view.sel.from, view.sel.to)) {
 18.1217 -      cm.display.prevInput = "";
 18.1218 -      minimal = hasCopyEvent &&
 18.1219 -        (view.sel.to.line - view.sel.from.line > 100 || (selected = cm.getSelection()).length > 1000);
 18.1220 -      if (minimal) cm.display.input.value = "-";
 18.1221 -      else cm.display.input.value = selected || cm.getSelection();
 18.1222 -      if (view.focused) selectInput(cm.display.input);
 18.1223 -    } else if (user) cm.display.prevInput = cm.display.input.value = "";
 18.1224 -    cm.display.inaccurateSelection = minimal;
 18.1225 -  }
 18.1226 -
 18.1227 -  function focusInput(cm) {
 18.1228 -    if (cm.options.readOnly != "nocursor" && (ie || document.activeElement != cm.display.input))
 18.1229 -      cm.display.input.focus();
 18.1230 -  }
 18.1231 -
 18.1232 -  function isReadOnly(cm) {
 18.1233 -    return cm.options.readOnly || cm.view.cantEdit;
 18.1234 -  }
 18.1235 -
 18.1236 -  // EVENT HANDLERS
 18.1237 -
 18.1238 -  function registerEventHandlers(cm) {
 18.1239 -    var d = cm.display;
 18.1240 -    on(d.scroller, "mousedown", operation(cm, onMouseDown));
 18.1241 -    on(d.scroller, "dblclick", operation(cm, e_preventDefault));
 18.1242 -    on(d.lineSpace, "selectstart", function(e) {
 18.1243 -      if (!mouseEventInWidget(d, e)) e_preventDefault(e);
 18.1244 -    });
 18.1245 -    // Gecko browsers fire contextmenu *after* opening the menu, at
 18.1246 -    // which point we can't mess with it anymore. Context menu is
 18.1247 -    // handled in onMouseDown for Gecko.
 18.1248 -    if (!gecko) on(d.scroller, "contextmenu", function(e) {onContextMenu(cm, e);});
 18.1249 -
 18.1250 -    on(d.scroller, "scroll", function() {
 18.1251 -      setScrollTop(cm, d.scroller.scrollTop);
 18.1252 -      setScrollLeft(cm, d.scroller.scrollLeft, true);
 18.1253 -      signal(cm, "scroll", cm);
 18.1254 -    });
 18.1255 -    on(d.scrollbarV, "scroll", function() {
 18.1256 -      setScrollTop(cm, d.scrollbarV.scrollTop);
 18.1257 -    });
 18.1258 -    on(d.scrollbarH, "scroll", function() {
 18.1259 -      setScrollLeft(cm, d.scrollbarH.scrollLeft);
 18.1260 -    });
 18.1261 -
 18.1262 -    on(d.scroller, "mousewheel", function(e){onScrollWheel(cm, e);});
 18.1263 -    on(d.scroller, "DOMMouseScroll", function(e){onScrollWheel(cm, e);});
 18.1264 -
 18.1265 -    function reFocus() { if (cm.view.focused) setTimeout(bind(focusInput, cm), 0); }
 18.1266 -    on(d.scrollbarH, "mousedown", reFocus);
 18.1267 -    on(d.scrollbarV, "mousedown", reFocus);
 18.1268 -    // Prevent wrapper from ever scrolling
 18.1269 -    on(d.wrapper, "scroll", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
 18.1270 -    on(window, "resize", function resizeHandler() {
 18.1271 -      // Might be a text scaling operation, clear size caches.
 18.1272 -      d.cachedCharWidth = d.cachedTextHeight = null;
 18.1273 -      clearCaches(cm);
 18.1274 -      if (d.wrapper.parentNode) updateDisplay(cm, true);
 18.1275 -      else off(window, "resize", resizeHandler);
 18.1276 -    });
 18.1277 -
 18.1278 -    on(d.input, "keyup", operation(cm, function(e) {
 18.1279 -      if (cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
 18.1280 -      if (e_prop(e, "keyCode") == 16) cm.view.sel.shift = false;
 18.1281 -    }));
 18.1282 -    on(d.input, "input", bind(fastPoll, cm));
 18.1283 -    on(d.input, "keydown", operation(cm, onKeyDown));
 18.1284 -    on(d.input, "keypress", operation(cm, onKeyPress));
 18.1285 -    on(d.input, "focus", bind(onFocus, cm));
 18.1286 -    on(d.input, "blur", bind(onBlur, cm));
 18.1287 -
 18.1288 -    function drag_(e) {
 18.1289 -      if (cm.options.onDragEvent && cm.options.onDragEvent(cm, addStop(e))) return;
 18.1290 -      e_stop(e);
 18.1291 -    }
 18.1292 -    if (cm.options.dragDrop) {
 18.1293 -      on(d.scroller, "dragstart", function(e){onDragStart(cm, e);});
 18.1294 -      on(d.scroller, "dragenter", drag_);
 18.1295 -      on(d.scroller, "dragover", drag_);
 18.1296 -      on(d.scroller, "drop", operation(cm, onDrop));
 18.1297 -    }
 18.1298 -    on(d.scroller, "paste", function(){focusInput(cm); fastPoll(cm);});
 18.1299 -    on(d.input, "paste", function() {
 18.1300 -      d.pasteIncoming = true;
 18.1301 -      fastPoll(cm);
 18.1302 -    });
 18.1303 -
 18.1304 -    function prepareCopy() {
 18.1305 -      if (d.inaccurateSelection) {
 18.1306 -        d.prevInput = "";
 18.1307 -        d.inaccurateSelection = false;
 18.1308 -        d.input.value = cm.getSelection();
 18.1309 -        selectInput(d.input);
 18.1310 -      }
 18.1311 -    }
 18.1312 -    on(d.input, "cut", prepareCopy);
 18.1313 -    on(d.input, "copy", prepareCopy);
 18.1314 -
 18.1315 -    // Needed to handle Tab key in KHTML
 18.1316 -    if (khtml) on(d.sizer, "mouseup", function() {
 18.1317 -        if (document.activeElement == d.input) d.input.blur();
 18.1318 -        focusInput(cm);
 18.1319 -    });
 18.1320 -  }
 18.1321 -
 18.1322 -  function mouseEventInWidget(display, e) {
 18.1323 -    for (var n = e_target(e); n != display.wrapper; n = n.parentNode)
 18.1324 -      if (/\bCodeMirror-(?:line)?widget\b/.test(n.className) ||
 18.1325 -          n.parentNode == display.sizer && n != display.mover) return true;
 18.1326 -  }
 18.1327 -
 18.1328 -  function posFromMouse(cm, e, liberal) {
 18.1329 -    var display = cm.display;
 18.1330 -    if (!liberal) {
 18.1331 -      var target = e_target(e);
 18.1332 -      if (target == display.scrollbarH || target == display.scrollbarH.firstChild ||
 18.1333 -          target == display.scrollbarV || target == display.scrollbarV.firstChild ||
 18.1334 -          target == display.scrollbarFiller) return null;
 18.1335 -    }
 18.1336 -    var x, y, space = display.lineSpace.getBoundingClientRect();
 18.1337 -    // Fails unpredictably on IE[67] when mouse is dragged around quickly.
 18.1338 -    try { x = e.clientX; y = e.clientY; } catch (e) { return null; }
 18.1339 -    return coordsChar(cm, x - space.left, y - space.top);
 18.1340 -  }
 18.1341 -
 18.1342 -  var lastClick, lastDoubleClick;
 18.1343 -  function onMouseDown(e) {
 18.1344 -    var cm = this, display = cm.display, view = cm.view, sel = view.sel, doc = view.doc;
 18.1345 -    sel.shift = e_prop(e, "shiftKey");
 18.1346 -
 18.1347 -    if (mouseEventInWidget(display, e)) {
 18.1348 -      if (!webkit) {
 18.1349 -        display.scroller.draggable = false;
 18.1350 -        setTimeout(function(){display.scroller.draggable = true;}, 100);
 18.1351 -      }
 18.1352 -      return;
 18.1353 -    }
 18.1354 -    if (clickInGutter(cm, e)) return;
 18.1355 -    var start = posFromMouse(cm, e);
 18.1356 -
 18.1357 -    switch (e_button(e)) {
 18.1358 -    case 3:
 18.1359 -      if (gecko) onContextMenu.call(cm, cm, e);
 18.1360 -      return;
 18.1361 -    case 2:
 18.1362 -      if (start) extendSelection(cm, start);
 18.1363 -      setTimeout(bind(focusInput, cm), 20);
 18.1364 -      e_preventDefault(e);
 18.1365 -      return;
 18.1366 -    }
 18.1367 -    // For button 1, if it was clicked inside the editor
 18.1368 -    // (posFromMouse returning non-null), we have to adjust the
 18.1369 -    // selection.
 18.1370 -    if (!start) {if (e_target(e) == display.scroller) e_preventDefault(e); return;}
 18.1371 -
 18.1372 -    if (!view.focused) onFocus(cm);
 18.1373 -
 18.1374 -    var now = +new Date, type = "single";
 18.1375 -    if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) {
 18.1376 -      type = "triple";
 18.1377 -      e_preventDefault(e);
 18.1378 -      setTimeout(bind(focusInput, cm), 20);
 18.1379 -      selectLine(cm, start.line);
 18.1380 -    } else if (lastClick && lastClick.time > now - 400 && posEq(lastClick.pos, start)) {
 18.1381 -      type = "double";
 18.1382 -      lastDoubleClick = {time: now, pos: start};
 18.1383 -      e_preventDefault(e);
 18.1384 -      var word = findWordAt(getLine(doc, start.line).text, start);
 18.1385 -      extendSelection(cm, word.from, word.to);
 18.1386 -    } else { lastClick = {time: now, pos: start}; }
 18.1387 -
 18.1388 -    var last = start;
 18.1389 -    if (cm.options.dragDrop && dragAndDrop && !isReadOnly(cm) && !posEq(sel.from, sel.to) &&
 18.1390 -        !posLess(start, sel.from) && !posLess(sel.to, start) && type == "single") {
 18.1391 -      var dragEnd = operation(cm, function(e2) {
 18.1392 -        if (webkit) display.scroller.draggable = false;
 18.1393 -        view.draggingText = false;
 18.1394 -        off(document, "mouseup", dragEnd);
 18.1395 -        off(display.scroller, "drop", dragEnd);
 18.1396 -        if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
 18.1397 -          e_preventDefault(e2);
 18.1398 -          extendSelection(cm, start);
 18.1399 -          focusInput(cm);
 18.1400 -        }
 18.1401 -      });
 18.1402 -      // Let the drag handler handle this.
 18.1403 -      if (webkit) display.scroller.draggable = true;
 18.1404 -      view.draggingText = dragEnd;
 18.1405 -      // IE's approach to draggable
 18.1406 -      if (display.scroller.dragDrop) display.scroller.dragDrop();
 18.1407 -      on(document, "mouseup", dragEnd);
 18.1408 -      on(display.scroller, "drop", dragEnd);
 18.1409 -      return;
 18.1410 -    }
 18.1411 -    e_preventDefault(e);
 18.1412 -    if (type == "single") extendSelection(cm, clipPos(doc, start));
 18.1413 -
 18.1414 -    var startstart = sel.from, startend = sel.to;
 18.1415 -
 18.1416 -    function doSelect(cur) {
 18.1417 -      if (type == "single") {
 18.1418 -        extendSelection(cm, clipPos(doc, start), cur);
 18.1419 -        return;
 18.1420 -      }
 18.1421 -
 18.1422 -      startstart = clipPos(doc, startstart);
 18.1423 -      startend = clipPos(doc, startend);
 18.1424 -      if (type == "double") {
 18.1425 -        var word = findWordAt(getLine(doc, cur.line).text, cur);
 18.1426 -        if (posLess(cur, startstart)) extendSelection(cm, word.from, startend);
 18.1427 -        else extendSelection(cm, startstart, word.to);
 18.1428 -      } else if (type == "triple") {
 18.1429 -        if (posLess(cur, startstart)) extendSelection(cm, startend, clipPos(doc, {line: cur.line, ch: 0}));
 18.1430 -        else extendSelection(cm, startstart, clipPos(doc, {line: cur.line + 1, ch: 0}));
 18.1431 -      }
 18.1432 -    }
 18.1433 -
 18.1434 -    var editorSize = display.wrapper.getBoundingClientRect();
 18.1435 -    // Used to ensure timeout re-tries don't fire when another extend
 18.1436 -    // happened in the meantime (clearTimeout isn't reliable -- at
 18.1437 -    // least on Chrome, the timeouts still happen even when cleared,
 18.1438 -    // if the clear happens after their scheduled firing time).
 18.1439 -    var counter = 0;
 18.1440 -
 18.1441 -    function extend(e) {
 18.1442 -      var curCount = ++counter;
 18.1443 -      var cur = posFromMouse(cm, e, true);
 18.1444 -      if (!cur) return;
 18.1445 -      if (!posEq(cur, last)) {
 18.1446 -        if (!view.focused) onFocus(cm);
 18.1447 -        last = cur;
 18.1448 -        doSelect(cur);
 18.1449 -        var visible = visibleLines(display, doc);
 18.1450 -        if (cur.line >= visible.to || cur.line < visible.from)
 18.1451 -          setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);
 18.1452 -      } else {
 18.1453 -        var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
 18.1454 -        if (outside) setTimeout(operation(cm, function() {
 18.1455 -          if (counter != curCount) return;
 18.1456 -          display.scroller.scrollTop += outside;
 18.1457 -          extend(e);
 18.1458 -        }), 50);
 18.1459 -      }
 18.1460 -    }
 18.1461 -
 18.1462 -    function done(e) {
 18.1463 -      counter = Infinity;
 18.1464 -      var cur = posFromMouse(cm, e);
 18.1465 -      if (cur) doSelect(cur);
 18.1466 -      e_preventDefault(e);
 18.1467 -      focusInput(cm);
 18.1468 -      off(document, "mousemove", move);
 18.1469 -      off(document, "mouseup", up);
 18.1470 -    }
 18.1471 -
 18.1472 -    var move = operation(cm, function(e) {
 18.1473 -      if (!ie && !e_button(e)) done(e);
 18.1474 -      else extend(e);
 18.1475 -    });
 18.1476 -    var up = operation(cm, done);
 18.1477 -    on(document, "mousemove", move);
 18.1478 -    on(document, "mouseup", up);
 18.1479 -  }
 18.1480 -
 18.1481 -  function onDrop(e) {
 18.1482 -    var cm = this;
 18.1483 -    if (cm.options.onDragEvent && cm.options.onDragEvent(cm, addStop(e))) return;
 18.1484 -    e_preventDefault(e);
 18.1485 -    var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
 18.1486 -    if (!pos || isReadOnly(cm)) return;
 18.1487 -    if (files && files.length && window.FileReader && window.File) {
 18.1488 -      var n = files.length, text = Array(n), read = 0;
 18.1489 -      var loadFile = function(file, i) {
 18.1490 -        var reader = new FileReader;
 18.1491 -        reader.onload = function() {
 18.1492 -          text[i] = reader.result;
 18.1493 -          if (++read == n) {
 18.1494 -            pos = clipPos(cm.view.doc, pos);
 18.1495 -            operation(cm, function() {
 18.1496 -              var end = replaceRange(cm, text.join(""), pos, pos, "paste");
 18.1497 -              setSelection(cm, pos, end);
 18.1498 -            })();
 18.1499 -          }
 18.1500 -        };
 18.1501 -        reader.readAsText(file);
 18.1502 -      };
 18.1503 -      for (var i = 0; i < n; ++i) loadFile(files[i], i);
 18.1504 -    } else {
 18.1505 -      // Don't do a replace if the drop happened inside of the selected text.
 18.1506 -      if (cm.view.draggingText && !(posLess(pos, cm.view.sel.from) || posLess(cm.view.sel.to, pos))) {
 18.1507 -        cm.view.draggingText(e);
 18.1508 -        if (ie) setTimeout(bind(focusInput, cm), 50);
 18.1509 -        return;
 18.1510 -      }
 18.1511 -      try {
 18.1512 -        var text = e.dataTransfer.getData("Text");
 18.1513 -        if (text) {
 18.1514 -          var curFrom = cm.view.sel.from, curTo = cm.view.sel.to;
 18.1515 -          setSelection(cm, pos, pos);
 18.1516 -          if (cm.view.draggingText) replaceRange(cm, "", curFrom, curTo, "paste");
 18.1517 -          cm.replaceSelection(text, null, "paste");
 18.1518 -          focusInput(cm);
 18.1519 -          onFocus(cm);
 18.1520 -        }
 18.1521 -      }
 18.1522 -      catch(e){}
 18.1523 -    }
 18.1524 -  }
 18.1525 -
 18.1526 -  function clickInGutter(cm, e) {
 18.1527 -    var display = cm.display;
 18.1528 -    try { var mX = e.clientX, mY = e.clientY; }
 18.1529 -    catch(e) { return false; }
 18.1530 -
 18.1531 -    if (mX >= Math.floor(display.gutters.getBoundingClientRect().right)) return false;
 18.1532 -    e_preventDefault(e);
 18.1533 -    if (!hasHandler(cm, "gutterClick")) return true;
 18.1534 -
 18.1535 -    var lineBox = display.lineDiv.getBoundingClientRect();
 18.1536 -    if (mY > lineBox.bottom) return true;
 18.1537 -    mY -= lineBox.top - display.viewOffset;
 18.1538 -
 18.1539 -    for (var i = 0; i < cm.options.gutters.length; ++i) {
 18.1540 -      var g = display.gutters.childNodes[i];
 18.1541 -      if (g && g.getBoundingClientRect().right >= mX) {
 18.1542 -        var line = lineAtHeight(cm.view.doc, mY);
 18.1543 -        var gutter = cm.options.gutters[i];
 18.1544 -        signalLater(cm, cm, "gutterClick", cm, line, gutter, e);
 18.1545 -        break;
 18.1546 -      }
 18.1547 -    }
 18.1548 -    return true;
 18.1549 -  }
 18.1550 -
 18.1551 -  function onDragStart(cm, e) {
 18.1552 -    var txt = cm.getSelection();
 18.1553 -    e.dataTransfer.setData("Text", txt);
 18.1554 -
 18.1555 -    // Use dummy image instead of default browsers image.
 18.1556 -    // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
 18.1557 -    if (e.dataTransfer.setDragImage && !safari)
 18.1558 -      e.dataTransfer.setDragImage(elt('img'), 0, 0);
 18.1559 -  }
 18.1560 -
 18.1561 -  function setScrollTop(cm, val) {
 18.1562 -    if (Math.abs(cm.view.scrollTop - val) < 2) return;
 18.1563 -    cm.view.scrollTop = val;
 18.1564 -    if (!gecko) updateDisplay(cm, [], val);
 18.1565 -    if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val;
 18.1566 -    if (cm.display.scrollbarV.scrollTop != val) cm.display.scrollbarV.scrollTop = val;
 18.1567 -    if (gecko) updateDisplay(cm, []);
 18.1568 -  }
 18.1569 -  function setScrollLeft(cm, val, isScroller) {
 18.1570 -    if (isScroller ? val == cm.view.scrollLeft : Math.abs(cm.view.scrollLeft - val) < 2) return;
 18.1571 -    cm.view.scrollLeft = val;
 18.1572 -    alignHorizontally(cm);
 18.1573 -    if (cm.display.scroller.scrollLeft != val) cm.display.scroller.scrollLeft = val;
 18.1574 -    if (cm.display.scrollbarH.scrollLeft != val) cm.display.scrollbarH.scrollLeft = val;
 18.1575 -  }
 18.1576 -
 18.1577 -  // Since the delta values reported on mouse wheel events are
 18.1578 -  // unstandardized between browsers and even browser versions, and
 18.1579 -  // generally horribly unpredictable, this code starts by measuring
 18.1580 -  // the scroll effect that the first few mouse wheel events have,
 18.1581 -  // and, from that, detects the way it can convert deltas to pixel
 18.1582 -  // offsets afterwards.
 18.1583 -  //
 18.1584 -  // The reason we want to know the amount a wheel event will scroll
 18.1585 -  // is that it gives us a chance to update the display before the
 18.1586 -  // actual scrolling happens, reducing flickering.
 18.1587 -
 18.1588 -  var wheelSamples = 0, wheelDX, wheelDY, wheelStartX, wheelStartY, wheelPixelsPerUnit = null;
 18.1589 -  // Fill in a browser-detected starting value on browsers where we
 18.1590 -  // know one. These don't have to be accurate -- the result of them
 18.1591 -  // being wrong would just be a slight flicker on the first wheel
 18.1592 -  // scroll (if it is large enough).
 18.1593 -  if (ie) wheelPixelsPerUnit = -.53;
 18.1594 -  else if (gecko) wheelPixelsPerUnit = 15;
 18.1595 -  else if (chrome) wheelPixelsPerUnit = -.7;
 18.1596 -  else if (safari) wheelPixelsPerUnit = -1/3;
 18.1597 -
 18.1598 -  function onScrollWheel(cm, e) {
 18.1599 -    var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
 18.1600 -    if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) dx = e.detail;
 18.1601 -    if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) dy = e.detail;
 18.1602 -    else if (dy == null) dy = e.wheelDelta;
 18.1603 -
 18.1604 -    // Webkit browsers on OS X abort momentum scrolls when the target
 18.1605 -    // of the scroll event is removed from the scrollable element.
 18.1606 -    // This hack (see related code in patchDisplay) makes sure the
 18.1607 -    // element is kept around.
 18.1608 -    if (dy && mac && webkit) {
 18.1609 -      for (var cur = e.target; cur != scroll; cur = cur.parentNode) {
 18.1610 -        if (cur.lineObj) {
 18.1611 -          cm.display.currentWheelTarget = cur;
 18.1612 -          break;
 18.1613 -        }
 18.1614 -      }
 18.1615 -    }
 18.1616 -
 18.1617 -    var scroll = cm.display.scroller;
 18.1618 -    // On some browsers, horizontal scrolling will cause redraws to
 18.1619 -    // happen before the gutter has been realigned, causing it to
 18.1620 -    // wriggle around in a most unseemly way. When we have an
 18.1621 -    // estimated pixels/delta value, we just handle horizontal
 18.1622 -    // scrolling entirely here. It'll be slightly off from native, but
 18.1623 -    // better than glitching out.
 18.1624 -    if (dx && !gecko && !opera && wheelPixelsPerUnit != null) {
 18.1625 -      if (dy)
 18.1626 -        setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight)));
 18.1627 -      setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));
 18.1628 -      e_preventDefault(e);
 18.1629 -      wheelStartX = null; // Abort measurement, if in progress
 18.1630 -      return;
 18.1631 -    }
 18.1632 -
 18.1633 -    if (dy && wheelPixelsPerUnit != null) {
 18.1634 -      var pixels = dy * wheelPixelsPerUnit;
 18.1635 -      var top = cm.view.scrollTop, bot = top + cm.display.wrapper.clientHeight;
 18.1636 -      if (pixels < 0) top = Math.max(0, top + pixels - 50);
 18.1637 -      else bot = Math.min(cm.view.doc.height, bot + pixels + 50);
 18.1638 -      updateDisplay(cm, [], {top: top, bottom: bot});
 18.1639 -    }
 18.1640 -
 18.1641 -    if (wheelSamples < 20) {
 18.1642 -      if (wheelStartX == null) {
 18.1643 -        wheelStartX = scroll.scrollLeft; wheelStartY = scroll.scrollTop;
 18.1644 -        wheelDX = dx; wheelDY = dy;
 18.1645 -        setTimeout(function() {
 18.1646 -          if (wheelStartX == null) return;
 18.1647 -          var movedX = scroll.scrollLeft - wheelStartX;
 18.1648 -          var movedY = scroll.scrollTop - wheelStartY;
 18.1649 -          var sample = (movedY && wheelDY && movedY / wheelDY) ||
 18.1650 -            (movedX && wheelDX && movedX / wheelDX);
 18.1651 -          wheelStartX = wheelStartY = null;
 18.1652 -          if (!sample) return;
 18.1653 -          wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
 18.1654 -          ++wheelSamples;
 18.1655 -        }, 200);
 18.1656 -      } else {
 18.1657 -        wheelDX += dx; wheelDY += dy;
 18.1658 -      }
 18.1659 -    }
 18.1660 -  }
 18.1661 -
 18.1662 -  function doHandleBinding(cm, bound, dropShift) {
 18.1663 -    if (typeof bound == "string") {
 18.1664 -      bound = commands[bound];
 18.1665 -      if (!bound) return false;
 18.1666 -    }
 18.1667 -    // Ensure previous input has been read, so that the handler sees a
 18.1668 -    // consistent view of the document
 18.1669 -    if (cm.display.pollingFast && readInput(cm)) cm.display.pollingFast = false;
 18.1670 -    var view = cm.view, prevShift = view.sel.shift;
 18.1671 -    try {
 18.1672 -      if (isReadOnly(cm)) view.suppressEdits = true;
 18.1673 -      if (dropShift) view.sel.shift = false;
 18.1674 -      bound(cm);
 18.1675 -    } catch(e) {
 18.1676 -      if (e != Pass) throw e;
 18.1677 -      return false;
 18.1678 -    } finally {
 18.1679 -      view.sel.shift = prevShift;
 18.1680 -      view.suppressEdits = false;
 18.1681 -    }
 18.1682 -    return true;
 18.1683 -  }
 18.1684 -
 18.1685 -  function allKeyMaps(cm) {
 18.1686 -    var maps = cm.view.keyMaps.slice(0);
 18.1687 -    maps.push(cm.options.keyMap);
 18.1688 -    if (cm.options.extraKeys) maps.unshift(cm.options.extraKeys);
 18.1689 -    return maps;
 18.1690 -  }
 18.1691 -
 18.1692 -  var maybeTransition;
 18.1693 -  function handleKeyBinding(cm, e) {
 18.1694 -    // Handle auto keymap transitions
 18.1695 -    var startMap = getKeyMap(cm.options.keyMap), next = startMap.auto;
 18.1696 -    clearTimeout(maybeTransition);
 18.1697 -    if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() {
 18.1698 -      if (getKeyMap(cm.options.keyMap) == startMap)
 18.1699 -        cm.options.keyMap = (next.call ? next.call(null, cm) : next);
 18.1700 -    }, 50);
 18.1701 -
 18.1702 -    var name = keyNames[e_prop(e, "keyCode")], handled = false;
 18.1703 -    var flipCtrlCmd = mac && (opera || qtwebkit);
 18.1704 -    if (name == null || e.altGraphKey) return false;
 18.1705 -    if (e_prop(e, "altKey")) name = "Alt-" + name;
 18.1706 -    if (e_prop(e, flipCtrlCmd ? "metaKey" : "ctrlKey")) name = "Ctrl-" + name;
 18.1707 -    if (e_prop(e, flipCtrlCmd ? "ctrlKey" : "metaKey")) name = "Cmd-" + name;
 18.1708 -
 18.1709 -    var stopped = false;
 18.1710 -    function stop() { stopped = true; }
 18.1711 -    var keymaps = allKeyMaps(cm);
 18.1712 -
 18.1713 -    if (e_prop(e, "shiftKey")) {
 18.1714 -      handled = lookupKey("Shift-" + name, keymaps,
 18.1715 -                          function(b) {return doHandleBinding(cm, b, true);}, stop)
 18.1716 -        || lookupKey(name, keymaps, function(b) {
 18.1717 -          if (typeof b == "string" && /^go[A-Z]/.test(b)) return doHandleBinding(cm, b);
 18.1718 -        }, stop);
 18.1719 -    } else {
 18.1720 -      handled = lookupKey(name, keymaps,
 18.1721 -                          function(b) { return doHandleBinding(cm, b); }, stop);
 18.1722 -    }
 18.1723 -    if (stopped) handled = false;
 18.1724 -    if (handled) {
 18.1725 -      e_preventDefault(e);
 18.1726 -      restartBlink(cm);
 18.1727 -      if (ie_lt9) { e.oldKeyCode = e.keyCode; e.keyCode = 0; }
 18.1728 -    }
 18.1729 -    return handled;
 18.1730 -  }
 18.1731 -
 18.1732 -  function handleCharBinding(cm, e, ch) {
 18.1733 -    var handled = lookupKey("'" + ch + "'", allKeyMaps(cm),
 18.1734 -                            function(b) { return doHandleBinding(cm, b, true); });
 18.1735 -    if (handled) {
 18.1736 -      e_preventDefault(e);
 18.1737 -      restartBlink(cm);
 18.1738 -    }
 18.1739 -    return handled;
 18.1740 -  }
 18.1741 -
 18.1742 -  var lastStoppedKey = null;
 18.1743 -  function onKeyDown(e) {
 18.1744 -    var cm = this;
 18.1745 -    if (!cm.view.focused) onFocus(cm);
 18.1746 -    if (ie && e.keyCode == 27) { e.returnValue = false; }
 18.1747 -    if (cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
 18.1748 -    var code = e_prop(e, "keyCode");
 18.1749 -    // IE does strange things with escape.
 18.1750 -    cm.view.sel.shift = code == 16 || e_prop(e, "shiftKey");
 18.1751 -    // First give onKeyEvent option a chance to handle this.
 18.1752 -    var handled = handleKeyBinding(cm, e);
 18.1753 -    if (opera) {
 18.1754 -      lastStoppedKey = handled ? code : null;
 18.1755 -      // Opera has no cut event... we try to at least catch the key combo
 18.1756 -      if (!handled && code == 88 && !hasCopyEvent && e_prop(e, mac ? "metaKey" : "ctrlKey"))
 18.1757 -        cm.replaceSelection("");
 18.1758 -    }
 18.1759 -  }
 18.1760 -
 18.1761 -  function onKeyPress(e) {
 18.1762 -    var cm = this;
 18.1763 -    if (cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
 18.1764 -    var keyCode = e_prop(e, "keyCode"), charCode = e_prop(e, "charCode");
 18.1765 -    if (opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}
 18.1766 -    if (((opera && (!e.which || e.which < 10)) || khtml) && handleKeyBinding(cm, e)) return;
 18.1767 -    var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
 18.1768 -    if (this.options.electricChars && this.view.mode.electricChars &&
 18.1769 -        this.options.smartIndent && !isReadOnly(this) &&
 18.1770 -        this.view.mode.electricChars.indexOf(ch) > -1)
 18.1771 -      setTimeout(operation(cm, function() {indentLine(cm, cm.view.sel.to.line, "smart");}), 75);
 18.1772 -    if (handleCharBinding(cm, e, ch)) return;
 18.1773 -    fastPoll(cm);
 18.1774 -  }
 18.1775 -
 18.1776 -  function onFocus(cm) {
 18.1777 -    if (cm.options.readOnly == "nocursor") return;
 18.1778 -    if (!cm.view.focused) {
 18.1779 -      signal(cm, "focus", cm);
 18.1780 -      cm.view.focused = true;
 18.1781 -      if (cm.display.scroller.className.search(/\bCodeMirror-focused\b/) == -1)
 18.1782 -        cm.display.scroller.className += " CodeMirror-focused";
 18.1783 -      resetInput(cm, true);
 18.1784 -    }
 18.1785 -    slowPoll(cm);
 18.1786 -    restartBlink(cm);
 18.1787 -  }
 18.1788 -  function onBlur(cm) {
 18.1789 -    if (cm.view.focused) {
 18.1790 -      signal(cm, "blur", cm);
 18.1791 -      cm.view.focused = false;
 18.1792 -      cm.display.scroller.className = cm.display.scroller.className.replace(" CodeMirror-focused", "");
 18.1793 -    }
 18.1794 -    clearInterval(cm.display.blinker);
 18.1795 -    setTimeout(function() {if (!cm.view.focused) cm.view.sel.shift = false;}, 150);
 18.1796 -  }
 18.1797 -
 18.1798 -  var detectingSelectAll;
 18.1799 -  function onContextMenu(cm, e) {
 18.1800 -    var display = cm.display, sel = cm.view.sel;
 18.1801 -    var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
 18.1802 -    if (!pos || opera) return; // Opera is difficult.
 18.1803 -    if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))
 18.1804 -      operation(cm, setSelection)(cm, pos, pos);
 18.1805 -
 18.1806 -    var oldCSS = display.input.style.cssText;
 18.1807 -    display.inputDiv.style.position = "absolute";
 18.1808 -    display.input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) +
 18.1809 -      "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; outline: none;" +
 18.1810 -      "border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
 18.1811 -    focusInput(cm);
 18.1812 -    resetInput(cm, true);
 18.1813 -    // Adds "Select all" to context menu in FF
 18.1814 -    if (posEq(sel.from, sel.to)) display.input.value = display.prevInput = " ";
 18.1815 -
 18.1816 -    function rehide() {
 18.1817 -      display.inputDiv.style.position = "relative";
 18.1818 -      display.input.style.cssText = oldCSS;
 18.1819 -      if (ie_lt9) display.scrollbarV.scrollTop = display.scroller.scrollTop = scrollPos;
 18.1820 -      slowPoll(cm);
 18.1821 -
 18.1822 -      // Try to detect the user choosing select-all 
 18.1823 -      if (display.input.selectionStart != null) {
 18.1824 -        clearTimeout(detectingSelectAll);
 18.1825 -        var extval = display.input.value = " " + (posEq(sel.from, sel.to) ? "" : display.input.value), i = 0;
 18.1826 -        display.prevInput = " ";
 18.1827 -        display.input.selectionStart = 1; display.input.selectionEnd = extval.length;
 18.1828 -        detectingSelectAll = setTimeout(function poll(){
 18.1829 -          if (display.prevInput == " " && display.input.selectionStart == 0)
 18.1830 -            operation(cm, commands.selectAll)(cm);
 18.1831 -          else if (i++ < 10) detectingSelectAll = setTimeout(poll, 500);
 18.1832 -          else resetInput(cm);
 18.1833 -        }, 200);
 18.1834 -      }
 18.1835 -    }
 18.1836 -
 18.1837 -    if (gecko) {
 18.1838 -      e_stop(e);
 18.1839 -      on(window, "mouseup", function mouseup() {
 18.1840 -        off(window, "mouseup", mouseup);
 18.1841 -        setTimeout(rehide, 20);
 18.1842 -      });
 18.1843 -    } else {
 18.1844 -      setTimeout(rehide, 50);
 18.1845 -    }
 18.1846 -  }
 18.1847 -
 18.1848 -  // UPDATING
 18.1849 -
 18.1850 -  // Replace the range from from to to by the strings in newText.
 18.1851 -  // Afterwards, set the selection to selFrom, selTo.
 18.1852 -  function updateDoc(cm, from, to, newText, selUpdate, origin) {
 18.1853 -    // Possibly split or suppress the update based on the presence
 18.1854 -    // of read-only spans in its range.
 18.1855 -    var split = sawReadOnlySpans &&
 18.1856 -      removeReadOnlyRanges(cm.view.doc, from, to);
 18.1857 -    if (split) {
 18.1858 -      for (var i = split.length - 1; i >= 1; --i)
 18.1859 -        updateDocInner(cm, split[i].from, split[i].to, [""], origin);
 18.1860 -      if (split.length)
 18.1861 -        return updateDocInner(cm, split[0].from, split[0].to, newText, selUpdate, origin);
 18.1862 -    } else {
 18.1863 -      return updateDocInner(cm, from, to, newText, selUpdate, origin);
 18.1864 -    }
 18.1865 -  }
 18.1866 -
 18.1867 -  function updateDocInner(cm, from, to, newText, selUpdate, origin) {
 18.1868 -    if (cm.view.suppressEdits) return;
 18.1869 -
 18.1870 -    var view = cm.view, doc = view.doc, old = [];
 18.1871 -    doc.iter(from.line, to.line + 1, function(line) {
 18.1872 -      old.push(newHL(line.text, line.markedSpans));
 18.1873 -    });
 18.1874 -    var startSelFrom = view.sel.from, startSelTo = view.sel.to;
 18.1875 -    var lines = updateMarkedSpans(hlSpans(old[0]), hlSpans(lst(old)), from.ch, to.ch, newText);
 18.1876 -    var retval = updateDocNoUndo(cm, from, to, lines, selUpdate, origin);
 18.1877 -    if (view.history) addChange(cm, from.line, newText.length, old, origin,
 18.1878 -                                startSelFrom, startSelTo, view.sel.from, view.sel.to);
 18.1879 -    return retval;
 18.1880 -  }
 18.1881 -
 18.1882 -  function unredoHelper(cm, type) {
 18.1883 -    var doc = cm.view.doc, hist = cm.view.history;
 18.1884 -    var set = (type == "undo" ? hist.done : hist.undone).pop();
 18.1885 -    if (!set) return;
 18.1886 -    var anti = {events: [], fromBefore: set.fromAfter, toBefore: set.toAfter,
 18.1887 -                fromAfter: set.fromBefore, toAfter: set.toBefore};
 18.1888 -    for (var i = set.events.length - 1; i >= 0; i -= 1) {
 18.1889 -      hist.dirtyCounter += type == "undo" ? -1 : 1;
 18.1890 -      var change = set.events[i];
 18.1891 -      var replaced = [], end = change.start + change.added;
 18.1892 -      doc.iter(change.start, end, function(line) { replaced.push(newHL(line.text, line.markedSpans)); });
 18.1893 -      anti.events.push({start: change.start, added: change.old.length, old: replaced});
 18.1894 -      var selPos = i ? null : {from: set.fromBefore, to: set.toBefore};
 18.1895 -      updateDocNoUndo(cm, {line: change.start, ch: 0}, {line: end - 1, ch: getLine(doc, end-1).text.length},
 18.1896 -                      change.old, selPos, type);
 18.1897 -    }
 18.1898 -    (type == "undo" ? hist.undone : hist.done).push(anti);
 18.1899 -  }
 18.1900 -
 18.1901 -  function updateDocNoUndo(cm, from, to, lines, selUpdate, origin) {
 18.1902 -    var view = cm.view, doc = view.doc, display = cm.display;
 18.1903 -    if (view.suppressEdits) return;
 18.1904 -
 18.1905 -    var nlines = to.line - from.line, firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
 18.1906 -    var recomputeMaxLength = false, checkWidthStart = from.line;
 18.1907 -    if (!cm.options.lineWrapping) {
 18.1908 -      checkWidthStart = lineNo(visualLine(doc, firstLine));
 18.1909 -      doc.iter(checkWidthStart, to.line + 1, function(line) {
 18.1910 -        if (lineLength(doc, line) == view.maxLineLength) {
 18.1911 -          recomputeMaxLength = true;
 18.1912 -          return true;
 18.1913 -        }
 18.1914 -      });
 18.1915 -    }
 18.1916 -
 18.1917 -    var lastHL = lst(lines), th = textHeight(display);
 18.1918 -
 18.1919 -    // First adjust the line structure
 18.1920 -    if (from.ch == 0 && to.ch == 0 && hlText(lastHL) == "") {
 18.1921 -      // This is a whole-line replace. Treated specially to make
 18.1922 -      // sure line objects move the way they are supposed to.
 18.1923 -      var added = [];
 18.1924 -      for (var i = 0, e = lines.length - 1; i < e; ++i)
 18.1925 -        added.push(makeLine(hlText(lines[i]), hlSpans(lines[i]), th));
 18.1926 -      updateLine(cm, lastLine, lastLine.text, hlSpans(lastHL));
 18.1927 -      if (nlines) doc.remove(from.line, nlines, cm);
 18.1928 -      if (added.length) doc.insert(from.line, added);
 18.1929 -    } else if (firstLine == lastLine) {
 18.1930 -      if (lines.length == 1) {
 18.1931 -        updateLine(cm, firstLine, firstLine.text.slice(0, from.ch) + hlText(lines[0]) +
 18.1932 -                   firstLine.text.slice(to.ch), hlSpans(lines[0]));
 18.1933 -      } else {
 18.1934 -        for (var added = [], i = 1, e = lines.length - 1; i < e; ++i)
 18.1935 -          added.push(makeLine(hlText(lines[i]), hlSpans(lines[i]), th));
 18.1936 -        added.push(makeLine(hlText(lastHL) + firstLine.text.slice(to.ch), hlSpans(lastHL), th));
 18.1937 -        updateLine(cm, firstLine, firstLine.text.slice(0, from.ch) + hlText(lines[0]), hlSpans(lines[0]));
 18.1938 -        doc.insert(from.line + 1, added);
 18.1939 -      }
 18.1940 -    } else if (lines.length == 1) {
 18.1941 -      updateLine(cm, firstLine, firstLine.text.slice(0, from.ch) + hlText(lines[0]) +
 18.1942 -                 lastLine.text.slice(to.ch), hlSpans(lines[0]));
 18.1943 -      doc.remove(from.line + 1, nlines, cm);
 18.1944 -    } else {
 18.1945 -      var added = [];
 18.1946 -      updateLine(cm, firstLine, firstLine.text.slice(0, from.ch) + hlText(lines[0]), hlSpans(lines[0]));
 18.1947 -      updateLine(cm, lastLine, hlText(lastHL) + lastLine.text.slice(to.ch), hlSpans(lastHL));
 18.1948 -      for (var i = 1, e = lines.length - 1; i < e; ++i)
 18.1949 -        added.push(makeLine(hlText(lines[i]), hlSpans(lines[i]), th));
 18.1950 -      if (nlines > 1) doc.remove(from.line + 1, nlines - 1, cm);
 18.1951 -      doc.insert(from.line + 1, added);
 18.1952 -    }
 18.1953 -
 18.1954 -    if (cm.options.lineWrapping) {
 18.1955 -      var perLine = Math.max(5, display.scroller.clientWidth / charWidth(display) - 3);
 18.1956 -      doc.iter(from.line, from.line + lines.length, function(line) {
 18.1957 -        if (line.height == 0) return;
 18.1958 -        var guess = (Math.ceil(line.text.length / perLine) || 1) * th;
 18.1959 -        if (guess != line.height) updateLineHeight(line, guess);
 18.1960 -      });
 18.1961 -    } else {
 18.1962 -      doc.iter(checkWidthStart, from.line + lines.length, function(line) {
 18.1963 -        var len = lineLength(doc, line);
 18.1964 -        if (len > view.maxLineLength) {
 18.1965 -          view.maxLine = line;
 18.1966 -          view.maxLineLength = len;
 18.1967 -          view.maxLineChanged = true;
 18.1968 -          recomputeMaxLength = false;
 18.1969 -        }
 18.1970 -      });
 18.1971 -      if (recomputeMaxLength) cm.curOp.updateMaxLine = true;
 18.1972 -    }
 18.1973 -
 18.1974 -    // Adjust frontier, schedule worker
 18.1975 -    view.frontier = Math.min(view.frontier, from.line);
 18.1976 -    startWorker(cm, 400);
 18.1977 -
 18.1978 -    var lendiff = lines.length - nlines - 1;
 18.1979 -    // Remember that these lines changed, for updating the display
 18.1980 -    regChange(cm, from.line, to.line + 1, lendiff);
 18.1981 -    if (hasHandler(cm, "change")) {
 18.1982 -      // Normalize lines to contain only strings, since that's what
 18.1983 -      // the change event handler expects
 18.1984 -      for (var i = 0; i < lines.length; ++i)
 18.1985 -        if (typeof lines[i] != "string") lines[i] = lines[i].text;
 18.1986 -      var changeObj = {from: from, to: to, text: lines, origin: origin};
 18.1987 -      if (cm.curOp.textChanged) {
 18.1988 -        for (var cur = cm.curOp.textChanged; cur.next; cur = cur.next) {}
 18.1989 -        cur.next = changeObj;
 18.1990 -      } else cm.curOp.textChanged = changeObj;
 18.1991 -    }
 18.1992 -
 18.1993 -    // Update the selection
 18.1994 -    var newSelFrom, newSelTo, end = {line: from.line + lines.length - 1,
 18.1995 -                                     ch: hlText(lastHL).length  + (lines.length == 1 ? from.ch : 0)};
 18.1996 -    if (selUpdate && typeof selUpdate != "string") {
 18.1997 -      if (selUpdate.from) { newSelFrom = selUpdate.from; newSelTo = selUpdate.to; }
 18.1998 -      else newSelFrom = newSelTo = selUpdate;
 18.1999 -    } else if (selUpdate == "end") {
 18.2000 -      newSelFrom = newSelTo = end;
 18.2001 -    } else if (selUpdate == "start") {
 18.2002 -      newSelFrom = newSelTo = from;
 18.2003 -    } else if (selUpdate == "around") {
 18.2004 -      newSelFrom = from; newSelTo = end;
 18.2005 -    } else {
 18.2006 -      var adjustPos = function(pos) {
 18.2007 -        if (posLess(pos, from)) return pos;
 18.2008 -        if (!posLess(to, pos)) return end;
 18.2009 -        var line = pos.line + lendiff;
 18.2010 -        var ch = pos.ch;
 18.2011 -        if (pos.line == to.line)
 18.2012 -          ch += hlText(lastHL).length - (to.ch - (to.line == from.line ? from.ch : 0));
 18.2013 -        return {line: line, ch: ch};
 18.2014 -      };
 18.2015 -      newSelFrom = adjustPos(view.sel.from);
 18.2016 -      newSelTo = adjustPos(view.sel.to);
 18.2017 -    }
 18.2018 -    setSelection(cm, newSelFrom, newSelTo, null, true);
 18.2019 -    return end;
 18.2020 -  }
 18.2021 -
 18.2022 -  function replaceRange(cm, code, from, to, origin) {
 18.2023 -    if (!to) to = from;
 18.2024 -    if (posLess(to, from)) { var tmp = to; to = from; from = tmp; }
 18.2025 -    return updateDoc(cm, from, to, splitLines(code), null, origin);
 18.2026 -  }
 18.2027 -
 18.2028 -  // SELECTION
 18.2029 -
 18.2030 -  function posEq(a, b) {return a.line == b.line && a.ch == b.ch;}
 18.2031 -  function posLess(a, b) {return a.line < b.line || (a.line == b.line && a.ch < b.ch);}
 18.2032 -  function copyPos(x) {return {line: x.line, ch: x.ch};}
 18.2033 -
 18.2034 -  function clipLine(doc, n) {return Math.max(0, Math.min(n, doc.size-1));}
 18.2035 -  function clipPos(doc, pos) {
 18.2036 -    if (pos.line < 0) return {line: 0, ch: 0};
 18.2037 -    if (pos.line >= doc.size) return {line: doc.size-1, ch: getLine(doc, doc.size-1).text.length};
 18.2038 -    var ch = pos.ch, linelen = getLine(doc, pos.line).text.length;
 18.2039 -    if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};
 18.2040 -    else if (ch < 0) return {line: pos.line, ch: 0};
 18.2041 -    else return pos;
 18.2042 -  }
 18.2043 -  function isLine(doc, l) {return l >= 0 && l < doc.size;}
 18.2044 -
 18.2045 -  // If shift is held, this will move the selection anchor. Otherwise,
 18.2046 -  // it'll set the whole selection.
 18.2047 -  function extendSelection(cm, pos, other, bias) {
 18.2048 -    var sel = cm.view.sel;
 18.2049 -    if (sel.shift || sel.extend) {
 18.2050 -      var anchor = sel.anchor;
 18.2051 -      if (other) {
 18.2052 -        var posBefore = posLess(pos, anchor);
 18.2053 -        if (posBefore != posLess(other, anchor)) {
 18.2054 -          anchor = pos;
 18.2055 -          pos = other;
 18.2056 -        } else if (posBefore != posLess(pos, other)) {
 18.2057 -          pos = other;
 18.2058 -        }
 18.2059 -      }
 18.2060 -      setSelection(cm, anchor, pos, bias);
 18.2061 -    } else {
 18.2062 -      setSelection(cm, pos, other || pos, bias);
 18.2063 -    }
 18.2064 -    cm.curOp.userSelChange = true;
 18.2065 -  }
 18.2066 -
 18.2067 -  // Update the selection. Last two args are only used by
 18.2068 -  // updateDoc, since they have to be expressed in the line
 18.2069 -  // numbers before the update.
 18.2070 -  function setSelection(cm, anchor, head, bias, checkAtomic) {
 18.2071 -    cm.view.goalColumn = null;
 18.2072 -    var sel = cm.view.sel;
 18.2073 -    // Skip over atomic spans.
 18.2074 -    if (checkAtomic || !posEq(anchor, sel.anchor))
 18.2075 -      anchor = skipAtomic(cm, anchor, bias, checkAtomic != "push");
 18.2076 -    if (checkAtomic || !posEq(head, sel.head))
 18.2077 -      head = skipAtomic(cm, head, bias, checkAtomic != "push");
 18.2078 -
 18.2079 -    if (posEq(sel.anchor, anchor) && posEq(sel.head, head)) return;
 18.2080 -
 18.2081 -    sel.anchor = anchor; sel.head = head;
 18.2082 -    var inv = posLess(head, anchor);
 18.2083 -    sel.from = inv ? head : anchor;
 18.2084 -    sel.to = inv ? anchor : head;
 18.2085 -
 18.2086 -    cm.curOp.updateInput = true;
 18.2087 -    cm.curOp.selectionChanged = true;
 18.2088 -  }
 18.2089 -
 18.2090 -  function reCheckSelection(cm) {
 18.2091 -    setSelection(cm, cm.view.sel.from, cm.view.sel.to, null, "push");
 18.2092 -  }
 18.2093 -
 18.2094 -  function skipAtomic(cm, pos, bias, mayClear) {
 18.2095 -    var doc = cm.view.doc, flipped = false, curPos = pos;
 18.2096 -    var dir = bias || 1;
 18.2097 -    cm.view.cantEdit = false;
 18.2098 -    search: for (;;) {
 18.2099 -      var line = getLine(doc, curPos.line), toClear;
 18.2100 -      if (line.markedSpans) {
 18.2101 -        for (var i = 0; i < line.markedSpans.length; ++i) {
 18.2102 -          var sp = line.markedSpans[i], m = sp.marker;
 18.2103 -          if ((sp.from == null || (m.inclusiveLeft ? sp.from <= curPos.ch : sp.from < curPos.ch)) &&
 18.2104 -              (sp.to == null || (m.inclusiveRight ? sp.to >= curPos.ch : sp.to > curPos.ch))) {
 18.2105 -            if (mayClear && m.clearOnEnter) {
 18.2106 -              (toClear || (toClear = [])).push(m);
 18.2107 -              continue;
 18.2108 -            } else if (!m.atomic) continue;
 18.2109 -            var newPos = m.find()[dir < 0 ? "from" : "to"];
 18.2110 -            if (posEq(newPos, curPos)) {
 18.2111 -              newPos.ch += dir;
 18.2112 -              if (newPos.ch < 0) {
 18.2113 -                if (newPos.line) newPos = clipPos(doc, {line: newPos.line - 1});
 18.2114 -                else newPos = null;
 18.2115 -              } else if (newPos.ch > line.text.length) {
 18.2116 -                if (newPos.line < doc.size - 1) newPos = {line: newPos.line + 1, ch: 0};
 18.2117 -                else newPos = null;
 18.2118 -              }
 18.2119 -              if (!newPos) {
 18.2120 -                if (flipped) {
 18.2121 -                  // Driven in a corner -- no valid cursor position found at all
 18.2122 -                  // -- try again *with* clearing, if we didn't already
 18.2123 -                  if (!mayClear) return skipAtomic(cm, pos, bias, true);
 18.2124 -                  // Otherwise, turn off editing until further notice, and return the start of the doc
 18.2125 -                  cm.view.cantEdit = true;
 18.2126 -                  return {line: 0, ch: 0};
 18.2127 -                }
 18.2128 -                flipped = true; newPos = pos; dir = -dir;
 18.2129 -              }
 18.2130 -            }
 18.2131 -            curPos = newPos;
 18.2132 -            continue search;
 18.2133 -          }
 18.2134 -        }
 18.2135 -        if (toClear) for (var i = 0; i < toClear.length; ++i) toClear[i].clear();
 18.2136 -      }
 18.2137 -      return curPos;
 18.2138 -    }
 18.2139 -  }
 18.2140 -
 18.2141 -  // SCROLLING
 18.2142 -
 18.2143 -  function scrollCursorIntoView(cm) {
 18.2144 -    var view = cm.view;
 18.2145 -    var coords = scrollPosIntoView(cm, view.sel.head);
 18.2146 -    if (!view.focused) return;
 18.2147 -    var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
 18.2148 -    if (coords.top + box.top < 0) doScroll = true;
 18.2149 -    else if (coords.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false;
 18.2150 -    if (doScroll != null && !phantom) {
 18.2151 -      var hidden = display.cursor.style.display == "none";
 18.2152 -      if (hidden) {
 18.2153 -        display.cursor.style.display = "";
 18.2154 -        display.cursor.style.left = coords.left + "px";
 18.2155 -        display.cursor.style.top = (coords.top - display.viewOffset) + "px";
 18.2156 -      }
 18.2157 -      display.cursor.scrollIntoView(doScroll);
 18.2158 -      if (hidden) display.cursor.style.display = "none";
 18.2159 -    }
 18.2160 -  }
 18.2161 -
 18.2162 -  function scrollPosIntoView(cm, pos) {
 18.2163 -    for (;;) {
 18.2164 -      var changed = false, coords = cursorCoords(cm, pos);
 18.2165 -      var scrollPos = calculateScrollPos(cm, coords.left, coords.top, coords.left, coords.bottom);
 18.2166 -      var startTop = cm.view.scrollTop, startLeft = cm.view.scrollLeft;
 18.2167 -      if (scrollPos.scrollTop != null) {
 18.2168 -        setScrollTop(cm, scrollPos.scrollTop);
 18.2169 -        if (Math.abs(cm.view.scrollTop - startTop) > 1) changed = true;
 18.2170 -      }
 18.2171 -      if (scrollPos.scrollLeft != null) {
 18.2172 -        setScrollLeft(cm, scrollPos.scrollLeft);
 18.2173 -        if (Math.abs(cm.view.scrollLeft - startLeft) > 1) changed = true;
 18.2174 -      }
 18.2175 -      if (!changed) return coords;
 18.2176 -    }
 18.2177 -  }
 18.2178 -
 18.2179 -  function scrollIntoView(cm, x1, y1, x2, y2) {
 18.2180 -    var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);
 18.2181 -    if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);
 18.2182 -    if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);
 18.2183 -  }
 18.2184 -
 18.2185 -  function calculateScrollPos(cm, x1, y1, x2, y2) {
 18.2186 -    var display = cm.display, pt = paddingTop(display);
 18.2187 -    y1 += pt; y2 += pt;
 18.2188 -    var screen = display.scroller.clientHeight - scrollerCutOff, screentop = display.scroller.scrollTop, result = {};
 18.2189 -    var docBottom = cm.view.doc.height + 2 * pt;
 18.2190 -    var atTop = y1 < pt + 10, atBottom = y2 + pt > docBottom - 10;
 18.2191 -    if (y1 < screentop) result.scrollTop = atTop ? 0 : Math.max(0, y1);
 18.2192 -    else if (y2 > screentop + screen) result.scrollTop = (atBottom ? docBottom : y2) - screen;
 18.2193 -
 18.2194 -    var screenw = display.scroller.clientWidth - scrollerCutOff, screenleft = display.scroller.scrollLeft;
 18.2195 -    x1 += display.gutters.offsetWidth; x2 += display.gutters.offsetWidth;
 18.2196 -    var gutterw = display.gutters.offsetWidth;
 18.2197 -    var atLeft = x1 < gutterw + 10;
 18.2198 -    if (x1 < screenleft + gutterw || atLeft) {
 18.2199 -      if (atLeft) x1 = 0;
 18.2200 -      result.scrollLeft = Math.max(0, x1 - 10 - gutterw);
 18.2201 -    } else if (x2 > screenw + screenleft - 3) {
 18.2202 -      result.scrollLeft = x2 + 10 - screenw;
 18.2203 -    }
 18.2204 -    return result;
 18.2205 -  }
 18.2206 -
 18.2207 -  // API UTILITIES
 18.2208 -
 18.2209 -  function indentLine(cm, n, how, aggressive) {
 18.2210 -    var doc = cm.view.doc;
 18.2211 -    if (!how) how = "add";
 18.2212 -    if (how == "smart") {
 18.2213 -      if (!cm.view.mode.indent) how = "prev";
 18.2214 -      else var state = getStateBefore(cm, n);
 18.2215 -    }
 18.2216 -
 18.2217 -    var tabSize = cm.options.tabSize;
 18.2218 -    var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
 18.2219 -    var curSpaceString = line.text.match(/^\s*/)[0], indentation;
 18.2220 -    if (how == "smart") {
 18.2221 -      indentation = cm.view.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
 18.2222 -      if (indentation == Pass) {
 18.2223 -        if (!aggressive) return;
 18.2224 -        how = "prev";
 18.2225 -      }
 18.2226 -    }
 18.2227 -    if (how == "prev") {
 18.2228 -      if (n) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);
 18.2229 -      else indentation = 0;
 18.2230 -    }
 18.2231 -    else if (how == "add") indentation = curSpace + cm.options.indentUnit;
 18.2232 -    else if (how == "subtract") indentation = curSpace - cm.options.indentUnit;
 18.2233 -    indentation = Math.max(0, indentation);
 18.2234 -
 18.2235 -    var indentString = "", pos = 0;
 18.2236 -    if (cm.options.indentWithTabs)
 18.2237 -      for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";}
 18.2238 -    if (pos < indentation) indentString += spaceStr(indentation - pos);
 18.2239 -
 18.2240 -    if (indentString != curSpaceString)
 18.2241 -      replaceRange(cm, indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length}, "input");
 18.2242 -    line.stateAfter = null;
 18.2243 -  }
 18.2244 -
 18.2245 -  function changeLine(cm, handle, op) {
 18.2246 -    var no = handle, line = handle, doc = cm.view.doc;
 18.2247 -    if (typeof handle == "number") line = getLine(doc, clipLine(doc, handle));
 18.2248 -    else no = lineNo(handle);
 18.2249 -    if (no == null) return null;
 18.2250 -    if (op(line, no)) regChange(cm, no, no + 1);
 18.2251 -    else return null;
 18.2252 -    return line;
 18.2253 -  }
 18.2254 -
 18.2255 -  function findPosH(cm, dir, unit, visually) {
 18.2256 -    var doc = cm.view.doc, end = cm.view.sel.head, line = end.line, ch = end.ch;
 18.2257 -    var lineObj = getLine(doc, line);
 18.2258 -    function findNextLine() {
 18.2259 -      var l = line + dir;
 18.2260 -      if (l < 0 || l == doc.size) return false;
 18.2261 -      line = l;
 18.2262 -      return lineObj = getLine(doc, l);
 18.2263 -    }
 18.2264 -    function moveOnce(boundToLine) {
 18.2265 -      var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);
 18.2266 -      if (next == null) {
 18.2267 -        if (!boundToLine && findNextLine()) {
 18.2268 -          if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);
 18.2269 -          else ch = dir < 0 ? lineObj.text.length : 0;
 18.2270 -        } else return false;
 18.2271 -      } else ch = next;
 18.2272 -      return true;
 18.2273 -    }
 18.2274 -    if (unit == "char") moveOnce();
 18.2275 -    else if (unit == "column") moveOnce(true);
 18.2276 -    else if (unit == "word") {
 18.2277 -      var sawWord = false;
 18.2278 -      for (;;) {
 18.2279 -        if (dir < 0) if (!moveOnce()) break;
 18.2280 -        if (isWordChar(lineObj.text.charAt(ch))) sawWord = true;
 18.2281 -        else if (sawWord) {if (dir < 0) {dir = 1; moveOnce();} break;}
 18.2282 -        if (dir > 0) if (!moveOnce()) break;
 18.2283 -      }
 18.2284 -    }
 18.2285 -    return skipAtomic(cm, {line: line, ch: ch}, dir, true);
 18.2286 -  }
 18.2287 -
 18.2288 -  function findWordAt(line, pos) {
 18.2289 -    var start = pos.ch, end = pos.ch;
 18.2290 -    if (line) {
 18.2291 -      if (pos.after === false || end == line.length) --start; else ++end;
 18.2292 -      var startChar = line.charAt(start);
 18.2293 -      var check = isWordChar(startChar) ? isWordChar :
 18.2294 -        /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);} :
 18.2295 -      function(ch) {return !/\s/.test(ch) && !isWordChar(ch);};
 18.2296 -      while (start > 0 && check(line.charAt(start - 1))) --start;
 18.2297 -      while (end < line.length && check(line.charAt(end))) ++end;
 18.2298 -    }
 18.2299 -    return {from: {line: pos.line, ch: start}, to: {line: pos.line, ch: end}};
 18.2300 -  }
 18.2301 -
 18.2302 -  function selectLine(cm, line) {
 18.2303 -    extendSelection(cm, {line: line, ch: 0}, clipPos(cm.view.doc, {line: line + 1, ch: 0}));
 18.2304 -  }
 18.2305 -
 18.2306 -  // PROTOTYPE
 18.2307 -
 18.2308 -  // The publicly visible API. Note that operation(null, f) means
 18.2309 -  // 'wrap f in an operation, performed on its `this` parameter'
 18.2310 -
 18.2311 -  CodeMirror.prototype = {
 18.2312 -    getValue: function(lineSep) {
 18.2313 -      var text = [], doc = this.view.doc;
 18.2314 -      doc.iter(0, doc.size, function(line) { text.push(line.text); });
 18.2315 -      return text.join(lineSep || "\n");
 18.2316 -    },
 18.2317 -
 18.2318 -    setValue: operation(null, function(code) {
 18.2319 -      var doc = this.view.doc, top = {line: 0, ch: 0}, lastLen = getLine(doc, doc.size-1).text.length;
 18.2320 -      updateDocInner(this, top, {line: doc.size - 1, ch: lastLen}, splitLines(code), top, top, "setValue");
 18.2321 -    }),
 18.2322 -
 18.2323 -    getSelection: function(lineSep) { return this.getRange(this.view.sel.from, this.view.sel.to, lineSep); },
 18.2324 -
 18.2325 -    replaceSelection: operation(null, function(code, collapse, origin) {
 18.2326 -      var sel = this.view.sel;
 18.2327 -      updateDoc(this, sel.from, sel.to, splitLines(code), collapse || "around", origin);
 18.2328 -    }),
 18.2329 -
 18.2330 -    focus: function(){window.focus(); focusInput(this); onFocus(this); fastPoll(this);},
 18.2331 -
 18.2332 -    setOption: function(option, value) {
 18.2333 -      var options = this.options, old = options[option];
 18.2334 -      if (options[option] == value && option != "mode") return;
 18.2335 -      options[option] = value;
 18.2336 -      if (optionHandlers.hasOwnProperty(option))
 18.2337 -        operation(this, optionHandlers[option])(this, value, old);
 18.2338 -    },
 18.2339 -
 18.2340 -    getOption: function(option) {return this.options[option];},
 18.2341 -
 18.2342 -    getMode: function() {return this.view.mode;},
 18.2343 -
 18.2344 -    addKeyMap: function(map) {
 18.2345 -      this.view.keyMaps.push(map);
 18.2346 -    },
 18.2347 -
 18.2348 -    removeKeyMap: function(map) {
 18.2349 -      var maps = this.view.keyMaps;
 18.2350 -      for (var i = 0; i < maps.length; ++i)
 18.2351 -        if ((typeof map == "string" ? maps[i].name : maps[i]) == map) {
 18.2352 -          maps.splice(i, 1);
 18.2353 -          return true;
 18.2354 -        }
 18.2355 -    },
 18.2356 -
 18.2357 -    undo: operation(null, function() {unredoHelper(this, "undo");}),
 18.2358 -    redo: operation(null, function() {unredoHelper(this, "redo");}),
 18.2359 -
 18.2360 -    indentLine: operation(null, function(n, dir, aggressive) {
 18.2361 -      if (typeof dir != "string") {
 18.2362 -        if (dir == null) dir = this.options.smartIndent ? "smart" : "prev";
 18.2363 -        else dir = dir ? "add" : "subtract";
 18.2364 -      }
 18.2365 -      if (isLine(this.view.doc, n)) indentLine(this, n, dir, aggressive);
 18.2366 -    }),
 18.2367 -
 18.2368 -    indentSelection: operation(null, function(how) {
 18.2369 -      var sel = this.view.sel;
 18.2370 -      if (posEq(sel.from, sel.to)) return indentLine(this, sel.from.line, how);
 18.2371 -      var e = sel.to.line - (sel.to.ch ? 0 : 1);
 18.2372 -      for (var i = sel.from.line; i <= e; ++i) indentLine(this, i, how);
 18.2373 -    }),
 18.2374 -
 18.2375 -    historySize: function() {
 18.2376 -      var hist = this.view.history;
 18.2377 -      return {undo: hist.done.length, redo: hist.undone.length};
 18.2378 -    },
 18.2379 -
 18.2380 -    clearHistory: function() {this.view.history = makeHistory();},
 18.2381 -
 18.2382 -    markClean: function() {
 18.2383 -      this.view.history.dirtyCounter = 0;
 18.2384 -      this.view.history.lastOp = this.view.history.lastOrigin = null;
 18.2385 -    },
 18.2386 -
 18.2387 -    isClean: function () {return this.view.history.dirtyCounter == 0;},
 18.2388 -      
 18.2389 -    getHistory: function() {
 18.2390 -      var hist = this.view.history;
 18.2391 -      function cp(arr) {
 18.2392 -        for (var i = 0, nw = [], nwelt; i < arr.length; ++i) {
 18.2393 -          var set = arr[i];
 18.2394 -          nw.push({events: nwelt = [], fromBefore: set.fromBefore, toBefore: set.toBefore,
 18.2395 -                   fromAfter: set.fromAfter, toAfter: set.toAfter});
 18.2396 -          for (var j = 0, elt = set.events; j < elt.length; ++j) {
 18.2397 -            var old = [], cur = elt[j];
 18.2398 -            nwelt.push({start: cur.start, added: cur.added, old: old});
 18.2399 -            for (var k = 0; k < cur.old.length; ++k) old.push(hlText(cur.old[k]));
 18.2400 -          }
 18.2401 -        }
 18.2402 -        return nw;
 18.2403 -      }
 18.2404 -      return {done: cp(hist.done), undone: cp(hist.undone)};
 18.2405 -    },
 18.2406 -
 18.2407 -    setHistory: function(histData) {
 18.2408 -      var hist = this.view.history = makeHistory();
 18.2409 -      hist.done = histData.done;
 18.2410 -      hist.undone = histData.undone;
 18.2411 -    },
 18.2412 -
 18.2413 -    // Fetch the parser token for a given character. Useful for hacks
 18.2414 -    // that want to inspect the mode state (say, for completion).
 18.2415 -    getTokenAt: function(pos) {
 18.2416 -      var doc = this.view.doc;
 18.2417 -      pos = clipPos(doc, pos);
 18.2418 -      var state = getStateBefore(this, pos.line), mode = this.view.mode;
 18.2419 -      var line = getLine(doc, pos.line);
 18.2420 -      var stream = new StringStream(line.text, this.options.tabSize);
 18.2421 -      while (stream.pos < pos.ch && !stream.eol()) {
 18.2422 -        stream.start = stream.pos;
 18.2423 -        var style = mode.token(stream, state);
 18.2424 -      }
 18.2425 -      return {start: stream.start,
 18.2426 -              end: stream.pos,
 18.2427 -              string: stream.current(),
 18.2428 -              className: style || null, // Deprecated, use 'type' instead
 18.2429 -              type: style || null,
 18.2430 -              state: state};
 18.2431 -    },
 18.2432 -
 18.2433 -    getStateAfter: function(line) {
 18.2434 -      var doc = this.view.doc;
 18.2435 -      line = clipLine(doc, line == null ? doc.size - 1: line);
 18.2436 -      return getStateBefore(this, line + 1);
 18.2437 -    },
 18.2438 -
 18.2439 -    cursorCoords: function(start, mode) {
 18.2440 -      var pos, sel = this.view.sel;
 18.2441 -      if (start == null) pos = sel.head;
 18.2442 -      else if (typeof start == "object") pos = clipPos(this.view.doc, start);
 18.2443 -      else pos = start ? sel.from : sel.to;
 18.2444 -      return cursorCoords(this, pos, mode || "page");
 18.2445 -    },
 18.2446 -
 18.2447 -    charCoords: function(pos, mode) {
 18.2448 -      return charCoords(this, clipPos(this.view.doc, pos), mode || "page");
 18.2449 -    },
 18.2450 -
 18.2451 -    coordsChar: function(coords) {
 18.2452 -      var off = this.display.lineSpace.getBoundingClientRect();
 18.2453 -      return coordsChar(this, coords.left - off.left, coords.top - off.top);
 18.2454 -    },
 18.2455 -
 18.2456 -    defaultTextHeight: function() { return textHeight(this.display); },
 18.2457 -
 18.2458 -    markText: operation(null, function(from, to, options) {
 18.2459 -      return markText(this, clipPos(this.view.doc, from), clipPos(this.view.doc, to),
 18.2460 -                      options, "range");
 18.2461 -    }),
 18.2462 -
 18.2463 -    setBookmark: operation(null, function(pos, widget) {
 18.2464 -      pos = clipPos(this.view.doc, pos);
 18.2465 -      return markText(this, pos, pos, widget ? {replacedWith: widget} : {}, "bookmark");
 18.2466 -    }),
 18.2467 -
 18.2468 -    findMarksAt: function(pos) {
 18.2469 -      var doc = this.view.doc;
 18.2470 -      pos = clipPos(doc, pos);
 18.2471 -      var markers = [], spans = getLine(doc, pos.line).markedSpans;
 18.2472 -      if (spans) for (var i = 0; i < spans.length; ++i) {
 18.2473 -        var span = spans[i];
 18.2474 -        if ((span.from == null || span.from <= pos.ch) &&
 18.2475 -            (span.to == null || span.to >= pos.ch))
 18.2476 -          markers.push(span.marker);
 18.2477 -      }
 18.2478 -      return markers;
 18.2479 -    },
 18.2480 -
 18.2481 -    setGutterMarker: operation(null, function(line, gutterID, value) {
 18.2482 -      return changeLine(this, line, function(line) {
 18.2483 -        var markers = line.gutterMarkers || (line.gutterMarkers = {});
 18.2484 -        markers[gutterID] = value;
 18.2485 -        if (!value && isEmpty(markers)) line.gutterMarkers = null;
 18.2486 -        return true;
 18.2487 -      });
 18.2488 -    }),
 18.2489 -
 18.2490 -    clearGutter: operation(null, function(gutterID) {
 18.2491 -      var i = 0, cm = this, doc = cm.view.doc;
 18.2492 -      doc.iter(0, doc.size, function(line) {
 18.2493 -        if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
 18.2494 -          line.gutterMarkers[gutterID] = null;
 18.2495 -          regChange(cm, i, i + 1);
 18.2496 -          if (isEmpty(line.gutterMarkers)) line.gutterMarkers = null;
 18.2497 -        }
 18.2498 -        ++i;
 18.2499 -      });
 18.2500 -    }),
 18.2501 -
 18.2502 -    addLineClass: operation(null, function(handle, where, cls) {
 18.2503 -      return changeLine(this, handle, function(line) {
 18.2504 -        var prop = where == "text" ? "textClass" : where == "background" ? "bgClass" : "wrapClass";
 18.2505 -        if (!line[prop]) line[prop] = cls;
 18.2506 -        else if (new RegExp("\\b" + cls + "\\b").test(line[prop])) return false;
 18.2507 -        else line[prop] += " " + cls;
 18.2508 -        return true;
 18.2509 -      });
 18.2510 -    }),
 18.2511 -
 18.2512 -    removeLineClass: operation(null, function(handle, where, cls) {
 18.2513 -      return changeLine(this, handle, function(line) {
 18.2514 -        var prop = where == "text" ? "textClass" : where == "background" ? "bgClass" : "wrapClass";
 18.2515 -        var cur = line[prop];
 18.2516 -        if (!cur) return false;
 18.2517 -        else if (cls == null) line[prop] = null;
 18.2518 -        else {
 18.2519 -          var upd = cur.replace(new RegExp("^" + cls + "\\b\\s*|\\s*\\b" + cls + "\\b"), "");
 18.2520 -          if (upd == cur) return false;
 18.2521 -          line[prop] = upd || null;
 18.2522 -        }
 18.2523 -        return true;
 18.2524 -      });
 18.2525 -    }),
 18.2526 -
 18.2527 -    addLineWidget: operation(null, function(handle, node, options) {
 18.2528 -      var widget = options || {};
 18.2529 -      widget.node = node;
 18.2530 -      if (widget.noHScroll) this.display.alignWidgets = true;
 18.2531 -      changeLine(this, handle, function(line) {
 18.2532 -        (line.widgets || (line.widgets = [])).push(widget);
 18.2533 -        widget.line = line;
 18.2534 -        return true;
 18.2535 -      });
 18.2536 -      return widget;
 18.2537 -    }),
 18.2538 -
 18.2539 -    removeLineWidget: operation(null, function(widget) {
 18.2540 -      var ws = widget.line.widgets, no = lineNo(widget.line);
 18.2541 -      if (no == null) return;
 18.2542 -      for (var i = 0; i < ws.length; ++i) if (ws[i] == widget) ws.splice(i--, 1);
 18.2543 -      regChange(this, no, no + 1);
 18.2544 -    }),
 18.2545 -
 18.2546 -    lineInfo: function(line) {
 18.2547 -      if (typeof line == "number") {
 18.2548 -        if (!isLine(this.view.doc, line)) return null;
 18.2549 -        var n = line;
 18.2550 -        line = getLine(this.view.doc, line);
 18.2551 -        if (!line) return null;
 18.2552 -      } else {
 18.2553 -        var n = lineNo(line);
 18.2554 -        if (n == null) return null;
 18.2555 -      }
 18.2556 -      return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
 18.2557 -              textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
 18.2558 -              widgets: line.widgets};
 18.2559 -    },
 18.2560 -
 18.2561 -    getViewport: function() { return {from: this.display.showingFrom, to: this.display.showingTo};},
 18.2562 -
 18.2563 -    addWidget: function(pos, node, scroll, vert, horiz) {
 18.2564 -      var display = this.display;
 18.2565 -      pos = cursorCoords(this, clipPos(this.view.doc, pos));
 18.2566 -      var top = pos.top, left = pos.left;
 18.2567 -      node.style.position = "absolute";
 18.2568 -      display.sizer.appendChild(node);
 18.2569 -      if (vert == "over") top = pos.top;
 18.2570 -      else if (vert == "near") {
 18.2571 -        var vspace = Math.max(display.wrapper.clientHeight, this.view.doc.height),
 18.2572 -        hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
 18.2573 -        if (pos.bottom + node.offsetHeight > vspace && pos.top > node.offsetHeight)
 18.2574 -          top = pos.top - node.offsetHeight;
 18.2575 -        if (left + node.offsetWidth > hspace)
 18.2576 -          left = hspace - node.offsetWidth;
 18.2577 -      }
 18.2578 -      node.style.top = (top + paddingTop(display)) + "px";
 18.2579 -      node.style.left = node.style.right = "";
 18.2580 -      if (horiz == "right") {
 18.2581 -        left = display.sizer.clientWidth - node.offsetWidth;
 18.2582 -        node.style.right = "0px";
 18.2583 -      } else {
 18.2584 -        if (horiz == "left") left = 0;
 18.2585 -        else if (horiz == "middle") left = (display.sizer.clientWidth - node.offsetWidth) / 2;
 18.2586 -        node.style.left = left + "px";
 18.2587 -      }
 18.2588 -      if (scroll)
 18.2589 -        scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight);
 18.2590 -    },
 18.2591 -
 18.2592 -    lineCount: function() {return this.view.doc.size;},
 18.2593 -
 18.2594 -    clipPos: function(pos) {return clipPos(this.view.doc, pos);},
 18.2595 -
 18.2596 -    getCursor: function(start) {
 18.2597 -      var sel = this.view.sel, pos;
 18.2598 -      if (start == null || start == "head") pos = sel.head;
 18.2599 -      else if (start == "anchor") pos = sel.anchor;
 18.2600 -      else if (start == "end" || start === false) pos = sel.to;
 18.2601 -      else pos = sel.from;
 18.2602 -      return copyPos(pos);
 18.2603 -    },
 18.2604 -
 18.2605 -    somethingSelected: function() {return !posEq(this.view.sel.from, this.view.sel.to);},
 18.2606 -
 18.2607 -    setCursor: operation(null, function(line, ch, extend) {
 18.2608 -      var pos = clipPos(this.view.doc, typeof line == "number" ? {line: line, ch: ch || 0} : line);
 18.2609 -      if (extend) extendSelection(this, pos);
 18.2610 -      else setSelection(this, pos, pos);
 18.2611 -    }),
 18.2612 -
 18.2613 -    setSelection: operation(null, function(anchor, head) {
 18.2614 -      var doc = this.view.doc;
 18.2615 -      setSelection(this, clipPos(doc, anchor), clipPos(doc, head || anchor));
 18.2616 -    }),
 18.2617 -
 18.2618 -    extendSelection: operation(null, function(from, to) {
 18.2619 -      var doc = this.view.doc;
 18.2620 -      extendSelection(this, clipPos(doc, from), to && clipPos(doc, to));
 18.2621 -    }),
 18.2622 -
 18.2623 -    setExtending: function(val) {this.view.sel.extend = val;},
 18.2624 -
 18.2625 -    getLine: function(line) {var l = this.getLineHandle(line); return l && l.text;},
 18.2626 -
 18.2627 -    getLineHandle: function(line) {
 18.2628 -      var doc = this.view.doc;
 18.2629 -      if (isLine(doc, line)) return getLine(doc, line);
 18.2630 -    },
 18.2631 -
 18.2632 -    getLineNumber: function(line) {return lineNo(line);},
 18.2633 -
 18.2634 -    setLine: operation(null, function(line, text) {
 18.2635 -      if (isLine(this.view.doc, line))
 18.2636 -        replaceRange(this, text, {line: line, ch: 0}, {line: line, ch: getLine(this.view.doc, line).text.length});
 18.2637 -    }),
 18.2638 -
 18.2639 -    removeLine: operation(null, function(line) {
 18.2640 -      if (isLine(this.view.doc, line))
 18.2641 -        replaceRange(this, "", {line: line, ch: 0}, clipPos(this.view.doc, {line: line+1, ch: 0}));
 18.2642 -    }),
 18.2643 -
 18.2644 -    replaceRange: operation(null, function(code, from, to) {
 18.2645 -      var doc = this.view.doc;
 18.2646 -      from = clipPos(doc, from);
 18.2647 -      to = to ? clipPos(doc, to) : from;
 18.2648 -      return replaceRange(this, code, from, to);
 18.2649 -    }),
 18.2650 -
 18.2651 -    getRange: function(from, to, lineSep) {
 18.2652 -      var doc = this.view.doc;
 18.2653 -      from = clipPos(doc, from); to = clipPos(doc, to);
 18.2654 -      var l1 = from.line, l2 = to.line;
 18.2655 -      if (l1 == l2) return getLine(doc, l1).text.slice(from.ch, to.ch);
 18.2656 -      var code = [getLine(doc, l1).text.slice(from.ch)];
 18.2657 -      doc.iter(l1 + 1, l2, function(line) { code.push(line.text); });
 18.2658 -      code.push(getLine(doc, l2).text.slice(0, to.ch));
 18.2659 -      return code.join(lineSep || "\n");
 18.2660 -    },
 18.2661 -
 18.2662 -    triggerOnKeyDown: operation(null, onKeyDown),
 18.2663 -
 18.2664 -    execCommand: function(cmd) {return commands[cmd](this);},
 18.2665 -
 18.2666 -    // Stuff used by commands, probably not much use to outside code.
 18.2667 -    moveH: operation(null, function(dir, unit) {
 18.2668 -      var sel = this.view.sel, pos = dir < 0 ? sel.from : sel.to;
 18.2669 -      if (sel.shift || sel.extend || posEq(sel.from, sel.to)) pos = findPosH(this, dir, unit, true);
 18.2670 -      extendSelection(this, pos, pos, dir);
 18.2671 -    }),
 18.2672 -
 18.2673 -    deleteH: operation(null, function(dir, unit) {
 18.2674 -      var sel = this.view.sel;
 18.2675 -      if (!posEq(sel.from, sel.to)) replaceRange(this, "", sel.from, sel.to, "delete");
 18.2676 -      else replaceRange(this, "", sel.from, findPosH(this, dir, unit, false), "delete");
 18.2677 -      this.curOp.userSelChange = true;
 18.2678 -    }),
 18.2679 -
 18.2680 -    moveV: operation(null, function(dir, unit) {
 18.2681 -      var view = this.view, doc = view.doc, display = this.display;
 18.2682 -      var cur = view.sel.head, pos = cursorCoords(this, cur, "div");
 18.2683 -      var x = pos.left, y;
 18.2684 -      if (view.goalColumn != null) x = view.goalColumn;
 18.2685 -      if (unit == "page") {
 18.2686 -        var pageSize = Math.min(display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
 18.2687 -        y = pos.top + dir * pageSize;
 18.2688 -      } else if (unit == "line") {
 18.2689 -        y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
 18.2690 -      }
 18.2691 -      do {
 18.2692 -        var target = coordsChar(this, x, y);
 18.2693 -        y += dir * 5;
 18.2694 -      } while (target.outside && (dir < 0 ? y > 0 : y < doc.height));
 18.2695 -
 18.2696 -      if (unit == "page") display.scrollbarV.scrollTop += charCoords(this, target, "div").top - pos.top;
 18.2697 -      extendSelection(this, target, target, dir);
 18.2698 -      view.goalColumn = x;
 18.2699 -    }),
 18.2700 -
 18.2701 -    toggleOverwrite: function() {
 18.2702 -      if (this.view.overwrite = !this.view.overwrite)
 18.2703 -        this.display.cursor.className += " CodeMirror-overwrite";
 18.2704 -      else
 18.2705 -        this.display.cursor.className = this.display.cursor.className.replace(" CodeMirror-overwrite", "");
 18.2706 -    },
 18.2707 -
 18.2708 -    posFromIndex: function(off) {
 18.2709 -      var lineNo = 0, ch, doc = this.view.doc;
 18.2710 -      doc.iter(0, doc.size, function(line) {
 18.2711 -        var sz = line.text.length + 1;
 18.2712 -        if (sz > off) { ch = off; return true; }
 18.2713 -        off -= sz;
 18.2714 -        ++lineNo;
 18.2715 -      });
 18.2716 -      return clipPos(doc, {line: lineNo, ch: ch});
 18.2717 -    },
 18.2718 -    indexFromPos: function (coords) {
 18.2719 -      if (coords.line < 0 || coords.ch < 0) return 0;
 18.2720 -      var index = coords.ch;
 18.2721 -      this.view.doc.iter(0, coords.line, function (line) {
 18.2722 -        index += line.text.length + 1;
 18.2723 -      });
 18.2724 -      return index;
 18.2725 -    },
 18.2726 -
 18.2727 -    scrollTo: function(x, y) {
 18.2728 -      if (x != null) this.display.scrollbarH.scrollLeft = this.display.scroller.scrollLeft = x;
 18.2729 -      if (y != null) this.display.scrollbarV.scrollTop = this.display.scroller.scrollTop = y;
 18.2730 -      updateDisplay(this, []);
 18.2731 -    },
 18.2732 -    getScrollInfo: function() {
 18.2733 -      var scroller = this.display.scroller, co = scrollerCutOff;
 18.2734 -      return {left: scroller.scrollLeft, top: scroller.scrollTop,
 18.2735 -              height: scroller.scrollHeight - co, width: scroller.scrollWidth - co,
 18.2736 -              clientHeight: scroller.clientHeight - co, clientWidth: scroller.clientWidth - co};
 18.2737 -    },
 18.2738 -
 18.2739 -    scrollIntoView: function(pos) {
 18.2740 -      if (typeof pos == "number") pos = {line: pos, ch: 0};
 18.2741 -      pos = pos ? clipPos(this.view.doc, pos) : this.view.sel.head;
 18.2742 -      scrollPosIntoView(this, pos);
 18.2743 -    },
 18.2744 -
 18.2745 -    setSize: function(width, height) {
 18.2746 -      function interpret(val) {
 18.2747 -        return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val;
 18.2748 -      }
 18.2749 -      if (width != null) this.display.wrapper.style.width = interpret(width);
 18.2750 -      if (height != null) this.display.wrapper.style.height = interpret(height);
 18.2751 -      this.refresh();
 18.2752 -    },
 18.2753 -
 18.2754 -    on: function(type, f) {on(this, type, f);},
 18.2755 -    off: function(type, f) {off(this, type, f);},
 18.2756 -
 18.2757 -    operation: function(f){return operation(this, f)();},
 18.2758 -
 18.2759 -    refresh: function() {
 18.2760 -      clearCaches(this);
 18.2761 -      if (this.display.scroller.scrollHeight > this.view.scrollTop)
 18.2762 -        this.display.scrollbarV.scrollTop = this.display.scroller.scrollTop = this.view.scrollTop;
 18.2763 -      updateDisplay(this, true);
 18.2764 -    },
 18.2765 -
 18.2766 -    getInputField: function(){return this.display.input;},
 18.2767 -    getWrapperElement: function(){return this.display.wrapper;},
 18.2768 -    getScrollerElement: function(){return this.display.scroller;},
 18.2769 -    getGutterElement: function(){return this.display.gutters;}
 18.2770 -  };
 18.2771 -
 18.2772 -  // OPTION DEFAULTS
 18.2773 -
 18.2774 -  var optionHandlers = CodeMirror.optionHandlers = {};
 18.2775 -
 18.2776 -  // The default configuration options.
 18.2777 -  var defaults = CodeMirror.defaults = {};
 18.2778 -
 18.2779 -  function option(name, deflt, handle, notOnInit) {
 18.2780 -    CodeMirror.defaults[name] = deflt;
 18.2781 -    if (handle) optionHandlers[name] =
 18.2782 -      notOnInit ? function(cm, val, old) {if (old != Init) handle(cm, val, old);} : handle;
 18.2783 -  }
 18.2784 -
 18.2785 -  var Init = CodeMirror.Init = {toString: function(){return "CodeMirror.Init";}};
 18.2786 -
 18.2787 -  // These two are, on init, called from the constructor because they
 18.2788 -  // have to be initialized before the editor can start at all.
 18.2789 -  option("value", "", function(cm, val) {cm.setValue(val);}, true);
 18.2790 -  option("mode", null, loadMode, true);
 18.2791 -
 18.2792 -  option("indentUnit", 2, loadMode, true);
 18.2793 -  option("indentWithTabs", false);
 18.2794 -  option("smartIndent", true);
 18.2795 -  option("tabSize", 4, function(cm) {
 18.2796 -    loadMode(cm);
 18.2797 -    clearCaches(cm);
 18.2798 -    updateDisplay(cm, true);
 18.2799 -  }, true);
 18.2800 -  option("electricChars", true);
 18.2801 -
 18.2802 -  option("theme", "default", function(cm) {
 18.2803 -    themeChanged(cm);
 18.2804 -    guttersChanged(cm);
 18.2805 -  }, true);
 18.2806 -  option("keyMap", "default", keyMapChanged);
 18.2807 -  option("extraKeys", null);
 18.2808 -
 18.2809 -  option("onKeyEvent", null);
 18.2810 -  option("onDragEvent", null);
 18.2811 -
 18.2812 -  option("lineWrapping", false, wrappingChanged, true);
 18.2813 -  option("gutters", [], function(cm) {
 18.2814 -    setGuttersForLineNumbers(cm.options);
 18.2815 -    guttersChanged(cm);
 18.2816 -  }, true);
 18.2817 -  option("lineNumbers", false, function(cm) {
 18.2818 -    setGuttersForLineNumbers(cm.options);
 18.2819 -    guttersChanged(cm);
 18.2820 -  }, true);
 18.2821 -  option("firstLineNumber", 1, guttersChanged, true);
 18.2822 -  option("lineNumberFormatter", function(integer) {return integer;}, guttersChanged, true);
 18.2823 -  option("showCursorWhenSelecting", false, updateSelection, true);
 18.2824 -  
 18.2825 -  option("readOnly", false, function(cm, val) {
 18.2826 -    if (val == "nocursor") {onBlur(cm); cm.display.input.blur();}
 18.2827 -    else if (!val) resetInput(cm, true);
 18.2828 -  });
 18.2829 -  option("dragDrop", true);
 18.2830 -
 18.2831 -  option("cursorBlinkRate", 530);
 18.2832 -  option("cursorHeight", 1);
 18.2833 -  option("workTime", 100);
 18.2834 -  option("workDelay", 100);
 18.2835 -  option("flattenSpans", true);
 18.2836 -  option("pollInterval", 100);
 18.2837 -  option("undoDepth", 40);
 18.2838 -  option("viewportMargin", 10, function(cm){cm.refresh();}, true);
 18.2839 -
 18.2840 -  option("tabindex", null, function(cm, val) {
 18.2841 -    cm.display.input.tabIndex = val || "";
 18.2842 -  });
 18.2843 -  option("autofocus", null);
 18.2844 -
 18.2845 -  // MODE DEFINITION AND QUERYING
 18.2846 -
 18.2847 -  // Known modes, by name and by MIME
 18.2848 -  var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {};
 18.2849 -
 18.2850 -  CodeMirror.defineMode = function(name, mode) {
 18.2851 -    if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name;
 18.2852 -    if (arguments.length > 2) {
 18.2853 -      mode.dependencies = [];
 18.2854 -      for (var i = 2; i < arguments.length; ++i) mode.dependencies.push(arguments[i]);
 18.2855 -    }
 18.2856 -    modes[name] = mode;
 18.2857 -  };
 18.2858 -
 18.2859 -  CodeMirror.defineMIME = function(mime, spec) {
 18.2860 -    mimeModes[mime] = spec;
 18.2861 -  };
 18.2862 -
 18.2863 -  CodeMirror.resolveMode = function(spec) {
 18.2864 -    if (typeof spec == "string" && mimeModes.hasOwnProperty(spec))
 18.2865 -      spec = mimeModes[spec];
 18.2866 -    else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec))
 18.2867 -      return CodeMirror.resolveMode("application/xml");
 18.2868 -    if (typeof spec == "string") return {name: spec};
 18.2869 -    else return spec || {name: "null"};
 18.2870 -  };
 18.2871 -
 18.2872 -  CodeMirror.getMode = function(options, spec) {
 18.2873 -    var spec = CodeMirror.resolveMode(spec);
 18.2874 -    var mfactory = modes[spec.name];
 18.2875 -    if (!mfactory) return CodeMirror.getMode(options, "text/plain");
 18.2876 -    var modeObj = mfactory(options, spec);
 18.2877 -    if (modeExtensions.hasOwnProperty(spec.name)) {
 18.2878 -      var exts = modeExtensions[spec.name];
 18.2879 -      for (var prop in exts) {
 18.2880 -        if (!exts.hasOwnProperty(prop)) continue;
 18.2881 -        if (modeObj.hasOwnProperty(prop)) modeObj["_" + prop] = modeObj[prop];
 18.2882 -        modeObj[prop] = exts[prop];
 18.2883 -      }
 18.2884 -    }
 18.2885 -    modeObj.name = spec.name;
 18.2886 -    return modeObj;
 18.2887 -  };
 18.2888 -
 18.2889 -  CodeMirror.defineMode("null", function() {
 18.2890 -    return {token: function(stream) {stream.skipToEnd();}};
 18.2891 -  });
 18.2892 -  CodeMirror.defineMIME("text/plain", "null");
 18.2893 -
 18.2894 -  var modeExtensions = CodeMirror.modeExtensions = {};
 18.2895 -  CodeMirror.extendMode = function(mode, properties) {
 18.2896 -    var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
 18.2897 -    for (var prop in properties) if (properties.hasOwnProperty(prop))
 18.2898 -      exts[prop] = properties[prop];
 18.2899 -  };
 18.2900 -
 18.2901 -  // EXTENSIONS
 18.2902 -
 18.2903 -  CodeMirror.defineExtension = function(name, func) {
 18.2904 -    CodeMirror.prototype[name] = func;
 18.2905 -  };
 18.2906 -
 18.2907 -  CodeMirror.defineOption = option;
 18.2908 -
 18.2909 -  var initHooks = [];
 18.2910 -  CodeMirror.defineInitHook = function(f) {initHooks.push(f);};
 18.2911 -
 18.2912 -  // MODE STATE HANDLING
 18.2913 -
 18.2914 -  // Utility functions for working with state. Exported because modes
 18.2915 -  // sometimes need to do this.
 18.2916 -  function copyState(mode, state) {
 18.2917 -    if (state === true) return state;
 18.2918 -    if (mode.copyState) return mode.copyState(state);
 18.2919 -    var nstate = {};
 18.2920 -    for (var n in state) {
 18.2921 -      var val = state[n];
 18.2922 -      if (val instanceof Array) val = val.concat([]);
 18.2923 -      nstate[n] = val;
 18.2924 -    }
 18.2925 -    return nstate;
 18.2926 -  }
 18.2927 -  CodeMirror.copyState = copyState;
 18.2928 -
 18.2929 -  function startState(mode, a1, a2) {
 18.2930 -    return mode.startState ? mode.startState(a1, a2) : true;
 18.2931 -  }
 18.2932 -  CodeMirror.startState = startState;
 18.2933 -
 18.2934 -  CodeMirror.innerMode = function(mode, state) {
 18.2935 -    while (mode.innerMode) {
 18.2936 -      var info = mode.innerMode(state);
 18.2937 -      state = info.state;
 18.2938 -      mode = info.mode;
 18.2939 -    }
 18.2940 -    return info || {mode: mode, state: state};
 18.2941 -  };
 18.2942 -
 18.2943 -  // STANDARD COMMANDS
 18.2944 -
 18.2945 -  var commands = CodeMirror.commands = {
 18.2946 -    selectAll: function(cm) {cm.setSelection({line: 0, ch: 0}, {line: cm.lineCount() - 1});},
 18.2947 -    killLine: function(cm) {
 18.2948 -      var from = cm.getCursor(true), to = cm.getCursor(false), sel = !posEq(from, to);
 18.2949 -      if (!sel && cm.getLine(from.line).length == from.ch)
 18.2950 -        cm.replaceRange("", from, {line: from.line + 1, ch: 0}, "delete");
 18.2951 -      else cm.replaceRange("", from, sel ? to : {line: from.line}, "delete");
 18.2952 -    },
 18.2953 -    deleteLine: function(cm) {
 18.2954 -      var l = cm.getCursor().line;
 18.2955 -      cm.replaceRange("", {line: l, ch: 0}, {line: l}, "delete");
 18.2956 -    },
 18.2957 -    undo: function(cm) {cm.undo();},
 18.2958 -    redo: function(cm) {cm.redo();},
 18.2959 -    goDocStart: function(cm) {cm.extendSelection({line: 0, ch: 0});},
 18.2960 -    goDocEnd: function(cm) {cm.extendSelection({line: cm.lineCount() - 1});},
 18.2961 -    goLineStart: function(cm) {
 18.2962 -      cm.extendSelection(lineStart(cm, cm.getCursor().line));
 18.2963 -    },
 18.2964 -    goLineStartSmart: function(cm) {
 18.2965 -      var cur = cm.getCursor(), start = lineStart(cm, cur.line);
 18.2966 -      var line = cm.getLineHandle(start.line);
 18.2967 -      var order = getOrder(line);
 18.2968 -      if (!order || order[0].level == 0) {
 18.2969 -        var firstNonWS = Math.max(0, line.text.search(/\S/));
 18.2970 -        var inWS = cur.line == start.line && cur.ch <= firstNonWS && cur.ch;
 18.2971 -        cm.extendSelection({line: start.line, ch: inWS ? 0 : firstNonWS});
 18.2972 -      } else cm.extendSelection(start);
 18.2973 -    },
 18.2974 -    goLineEnd: function(cm) {
 18.2975 -      cm.extendSelection(lineEnd(cm, cm.getCursor().line));
 18.2976 -    },
 18.2977 -    goLineUp: function(cm) {cm.moveV(-1, "line");},
 18.2978 -    goLineDown: function(cm) {cm.moveV(1, "line");},
 18.2979 -    goPageUp: function(cm) {cm.moveV(-1, "page");},
 18.2980 -    goPageDown: function(cm) {cm.moveV(1, "page");},
 18.2981 -    goCharLeft: function(cm) {cm.moveH(-1, "char");},
 18.2982 -    goCharRight: function(cm) {cm.moveH(1, "char");},
 18.2983 -    goColumnLeft: function(cm) {cm.moveH(-1, "column");},
 18.2984 -    goColumnRight: function(cm) {cm.moveH(1, "column");},
 18.2985 -    goWordLeft: function(cm) {cm.moveH(-1, "word");},
 18.2986 -    goWordRight: function(cm) {cm.moveH(1, "word");},
 18.2987 -    delCharBefore: function(cm) {cm.deleteH(-1, "char");},
 18.2988 -    delCharAfter: function(cm) {cm.deleteH(1, "char");},
 18.2989 -    delWordBefore: function(cm) {cm.deleteH(-1, "word");},
 18.2990 -    delWordAfter: function(cm) {cm.deleteH(1, "word");},
 18.2991 -    indentAuto: function(cm) {cm.indentSelection("smart");},
 18.2992 -    indentMore: function(cm) {cm.indentSelection("add");},
 18.2993 -    indentLess: function(cm) {cm.indentSelection("subtract");},
 18.2994 -    insertTab: function(cm) {cm.replaceSelection("\t", "end", "input");},
 18.2995 -    defaultTab: function(cm) {
 18.2996 -      if (cm.somethingSelected()) cm.indentSelection("add");
 18.2997 -      else cm.replaceSelection("\t", "end", "input");
 18.2998 -    },
 18.2999 -    transposeChars: function(cm) {
 18.3000 -      var cur = cm.getCursor(), line = cm.getLine(cur.line);
 18.3001 -      if (cur.ch > 0 && cur.ch < line.length - 1)
 18.3002 -        cm.replaceRange(line.charAt(cur.ch) + line.charAt(cur.ch - 1),
 18.3003 -                        {line: cur.line, ch: cur.ch - 1}, {line: cur.line, ch: cur.ch + 1});
 18.3004 -    },
 18.3005 -    newlineAndIndent: function(cm) {
 18.3006 -      operation(cm, function() {
 18.3007 -        cm.replaceSelection("\n", "end", "input");
 18.3008 -        cm.indentLine(cm.getCursor().line, null, true);
 18.3009 -      })();
 18.3010 -    },
 18.3011 -    toggleOverwrite: function(cm) {cm.toggleOverwrite();}
 18.3012 -  };
 18.3013 -
 18.3014 -  // STANDARD KEYMAPS
 18.3015 -
 18.3016 -  var keyMap = CodeMirror.keyMap = {};
 18.3017 -  keyMap.basic = {
 18.3018 -    "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
 18.3019 -    "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
 18.3020 -    "Delete": "delCharAfter", "Backspace": "delCharBefore", "Tab": "defaultTab", "Shift-Tab": "indentAuto",
 18.3021 -    "Enter": "newlineAndIndent", "Insert": "toggleOverwrite"
 18.3022 -  };
 18.3023 -  // Note that the save and find-related commands aren't defined by
 18.3024 -  // default. Unknown commands are simply ignored.
 18.3025 -  keyMap.pcDefault = {
 18.3026 -    "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
 18.3027 -    "Ctrl-Home": "goDocStart", "Alt-Up": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Down": "goDocEnd",
 18.3028 -    "Ctrl-Left": "goWordLeft", "Ctrl-Right": "goWordRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
 18.3029 -    "Ctrl-Backspace": "delWordBefore", "Ctrl-Delete": "delWordAfter", "Ctrl-S": "save", "Ctrl-F": "find",
 18.3030 -    "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
 18.3031 -    "Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
 18.3032 -    fallthrough: "basic"
 18.3033 -  };
 18.3034 -  keyMap.macDefault = {
 18.3035 -    "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
 18.3036 -    "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goWordLeft",
 18.3037 -    "Alt-Right": "goWordRight", "Cmd-Left": "goLineStart", "Cmd-Right": "goLineEnd", "Alt-Backspace": "delWordBefore",
 18.3038 -    "Ctrl-Alt-Backspace": "delWordAfter", "Alt-Delete": "delWordAfter", "Cmd-S": "save", "Cmd-F": "find",
 18.3039 -    "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
 18.3040 -    "Cmd-[": "indentLess", "Cmd-]": "indentMore",
 18.3041 -    fallthrough: ["basic", "emacsy"]
 18.3042 -  };
 18.3043 -  keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
 18.3044 -  keyMap.emacsy = {
 18.3045 -    "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
 18.3046 -    "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
 18.3047 -    "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
 18.3048 -    "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars"
 18.3049 -  };
 18.3050 -
 18.3051 -  // KEYMAP DISPATCH
 18.3052 -
 18.3053 -  function getKeyMap(val) {
 18.3054 -    if (typeof val == "string") return keyMap[val];
 18.3055 -    else return val;
 18.3056 -  }
 18.3057 -
 18.3058 -  function lookupKey(name, maps, handle, stop) {
 18.3059 -    function lookup(map) {
 18.3060 -      map = getKeyMap(map);
 18.3061 -      var found = map[name];
 18.3062 -      if (found === false) {
 18.3063 -        if (stop) stop();
 18.3064 -        return true;
 18.3065 -      }
 18.3066 -      if (found != null && handle(found)) return true;
 18.3067 -      if (map.nofallthrough) {
 18.3068 -        if (stop) stop();
 18.3069 -        return true;
 18.3070 -      }
 18.3071 -      var fallthrough = map.fallthrough;
 18.3072 -      if (fallthrough == null) return false;
 18.3073 -      if (Object.prototype.toString.call(fallthrough) != "[object Array]")
 18.3074 -        return lookup(fallthrough);
 18.3075 -      for (var i = 0, e = fallthrough.length; i < e; ++i) {
 18.3076 -        if (lookup(fallthrough[i])) return true;
 18.3077 -      }
 18.3078 -      return false;
 18.3079 -    }
 18.3080 -
 18.3081 -    for (var i = 0; i < maps.length; ++i)
 18.3082 -      if (lookup(maps[i])) return true;
 18.3083 -  }
 18.3084 -  function isModifierKey(event) {
 18.3085 -    var name = keyNames[e_prop(event, "keyCode")];
 18.3086 -    return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod";
 18.3087 -  }
 18.3088 -  CodeMirror.isModifierKey = isModifierKey;
 18.3089 -
 18.3090 -  // FROMTEXTAREA
 18.3091 -
 18.3092 -  CodeMirror.fromTextArea = function(textarea, options) {
 18.3093 -    if (!options) options = {};
 18.3094 -    options.value = textarea.value;
 18.3095 -    if (!options.tabindex && textarea.tabindex)
 18.3096 -      options.tabindex = textarea.tabindex;
 18.3097 -    // Set autofocus to true if this textarea is focused, or if it has
 18.3098 -    // autofocus and no other element is focused.
 18.3099 -    if (options.autofocus == null) {
 18.3100 -      var hasFocus = document.body;
 18.3101 -      // doc.activeElement occasionally throws on IE
 18.3102 -      try { hasFocus = document.activeElement; } catch(e) {}
 18.3103 -      options.autofocus = hasFocus == textarea ||
 18.3104 -        textarea.getAttribute("autofocus") != null && hasFocus == document.body;
 18.3105 -    }
 18.3106 -
 18.3107 -    function save() {textarea.value = cm.getValue();}
 18.3108 -    if (textarea.form) {
 18.3109 -      // Deplorable hack to make the submit method do the right thing.
 18.3110 -      on(textarea.form, "submit", save);
 18.3111 -      var form = textarea.form, realSubmit = form.submit;
 18.3112 -      try {
 18.3113 -        form.submit = function wrappedSubmit() {
 18.3114 -          save();
 18.3115 -          form.submit = realSubmit;
 18.3116 -          form.submit();
 18.3117 -          form.submit = wrappedSubmit;
 18.3118 -        };
 18.3119 -      } catch(e) {}
 18.3120 -    }
 18.3121 -
 18.3122 -    textarea.style.display = "none";
 18.3123 -    var cm = CodeMirror(function(node) {
 18.3124 -      textarea.parentNode.insertBefore(node, textarea.nextSibling);
 18.3125 -    }, options);
 18.3126 -    cm.save = save;
 18.3127 -    cm.getTextArea = function() { return textarea; };
 18.3128 -    cm.toTextArea = function() {
 18.3129 -      save();
 18.3130 -      textarea.parentNode.removeChild(cm.getWrapperElement());
 18.3131 -      textarea.style.display = "";
 18.3132 -      if (textarea.form) {
 18.3133 -        off(textarea.form, "submit", save);
 18.3134 -        if (typeof textarea.form.submit == "function")
 18.3135 -          textarea.form.submit = realSubmit;
 18.3136 -      }
 18.3137 -    };
 18.3138 -    return cm;
 18.3139 -  };
 18.3140 -
 18.3141 -  // STRING STREAM
 18.3142 -
 18.3143 -  // Fed to the mode parsers, provides helper functions to make
 18.3144 -  // parsers more succinct.
 18.3145 -
 18.3146 -  // The character stream used by a mode's parser.
 18.3147 -  function StringStream(string, tabSize) {
 18.3148 -    this.pos = this.start = 0;
 18.3149 -    this.string = string;
 18.3150 -    this.tabSize = tabSize || 8;
 18.3151 -  }
 18.3152 -
 18.3153 -  StringStream.prototype = {
 18.3154 -    eol: function() {return this.pos >= this.string.length;},
 18.3155 -    sol: function() {return this.pos == 0;},
 18.3156 -    peek: function() {return this.string.charAt(this.pos) || undefined;},
 18.3157 -    next: function() {
 18.3158 -      if (this.pos < this.string.length)
 18.3159 -        return this.string.charAt(this.pos++);
 18.3160 -    },
 18.3161 -    eat: function(match) {
 18.3162 -      var ch = this.string.charAt(this.pos);
 18.3163 -      if (typeof match == "string") var ok = ch == match;
 18.3164 -      else var ok = ch && (match.test ? match.test(ch) : match(ch));
 18.3165 -      if (ok) {++this.pos; return ch;}
 18.3166 -    },
 18.3167 -    eatWhile: function(match) {
 18.3168 -      var start = this.pos;
 18.3169 -      while (this.eat(match)){}
 18.3170 -      return this.pos > start;
 18.3171 -    },
 18.3172 -    eatSpace: function() {
 18.3173 -      var start = this.pos;
 18.3174 -      while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
 18.3175 -      return this.pos > start;
 18.3176 -    },
 18.3177 -    skipToEnd: function() {this.pos = this.string.length;},
 18.3178 -    skipTo: function(ch) {
 18.3179 -      var found = this.string.indexOf(ch, this.pos);
 18.3180 -      if (found > -1) {this.pos = found; return true;}
 18.3181 -    },
 18.3182 -    backUp: function(n) {this.pos -= n;},
 18.3183 -    column: function() {return countColumn(this.string, this.start, this.tabSize);},
 18.3184 -    indentation: function() {return countColumn(this.string, null, this.tabSize);},
 18.3185 -    match: function(pattern, consume, caseInsensitive) {
 18.3186 -      if (typeof pattern == "string") {
 18.3187 -        var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};
 18.3188 -        if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
 18.3189 -          if (consume !== false) this.pos += pattern.length;
 18.3190 -          return true;
 18.3191 -        }
 18.3192 -      } else {
 18.3193 -        var match = this.string.slice(this.pos).match(pattern);
 18.3194 -        if (match && match.index > 0) return null;
 18.3195 -        if (match && consume !== false) this.pos += match[0].length;
 18.3196 -        return match;
 18.3197 -      }
 18.3198 -    },
 18.3199 -    current: function(){return this.string.slice(this.start, this.pos);}
 18.3200 -  };
 18.3201 -  CodeMirror.StringStream = StringStream;
 18.3202 -
 18.3203 -  // TEXTMARKERS
 18.3204 -
 18.3205 -  function TextMarker(cm, type) {
 18.3206 -    this.lines = [];
 18.3207 -    this.type = type;
 18.3208 -    this.cm = cm;
 18.3209 -  }
 18.3210 -
 18.3211 -  TextMarker.prototype.clear = function() {
 18.3212 -    if (this.explicitlyCleared) return;
 18.3213 -    startOperation(this.cm);
 18.3214 -    var min = null, max = null;
 18.3215 -    for (var i = 0; i < this.lines.length; ++i) {
 18.3216 -      var line = this.lines[i];
 18.3217 -      var span = getMarkedSpanFor(line.markedSpans, this);
 18.3218 -      if (span.to != null) max = lineNo(line);
 18.3219 -      line.markedSpans = removeMarkedSpan(line.markedSpans, span);
 18.3220 -      if (span.from != null)
 18.3221 -        min = lineNo(line);
 18.3222 -      else if (this.collapsed && !lineIsHidden(line))
 18.3223 -        updateLineHeight(line, textHeight(this.cm.display));
 18.3224 -    }
 18.3225 -    if (min != null) regChange(this.cm, min, max + 1);
 18.3226 -    this.lines.length = 0;
 18.3227 -    this.explicitlyCleared = true;
 18.3228 -    if (this.collapsed && this.cm.view.cantEdit) {
 18.3229 -      this.cm.view.cantEdit = false;
 18.3230 -      reCheckSelection(this.cm);
 18.3231 -    }
 18.3232 -    endOperation(this.cm);
 18.3233 -    signalLater(this.cm, this, "clear");
 18.3234 -  };
 18.3235 -
 18.3236 -  TextMarker.prototype.find = function() {
 18.3237 -    var from, to;
 18.3238 -    for (var i = 0; i < this.lines.length; ++i) {
 18.3239 -      var line = this.lines[i];
 18.3240 -      var span = getMarkedSpanFor(line.markedSpans, this);
 18.3241 -      if (span.from != null || span.to != null) {
 18.3242 -        var found = lineNo(line);
 18.3243 -        if (span.from != null) from = {line: found, ch: span.from};
 18.3244 -        if (span.to != null) to = {line: found, ch: span.to};
 18.3245 -      }
 18.3246 -    }
 18.3247 -    if (this.type == "bookmark") return from;
 18.3248 -    return from && {from: from, to: to};
 18.3249 -  };
 18.3250 -
 18.3251 -  function markText(cm, from, to, options, type) {
 18.3252 -    var doc = cm.view.doc;
 18.3253 -    var marker = new TextMarker(cm, type);
 18.3254 -    if (type == "range" && !posLess(from, to)) return marker;
 18.3255 -    if (options) for (var opt in options) if (options.hasOwnProperty(opt))
 18.3256 -      marker[opt] = options[opt];
 18.3257 -    if (marker.replacedWith) {
 18.3258 -      marker.collapsed = true;
 18.3259 -      marker.replacedWith = elt("span", [marker.replacedWith], "CodeMirror-widget");
 18.3260 -    }
 18.3261 -    if (marker.collapsed) sawCollapsedSpans = true;
 18.3262 -
 18.3263 -    var curLine = from.line, size = 0, collapsedAtStart, collapsedAtEnd;
 18.3264 -    doc.iter(curLine, to.line + 1, function(line) {
 18.3265 -      var span = {from: null, to: null, marker: marker};
 18.3266 -      size += line.text.length;
 18.3267 -      if (curLine == from.line) {span.from = from.ch; size -= from.ch;}
 18.3268 -      if (curLine == to.line) {span.to = to.ch; size -= line.text.length - to.ch;}
 18.3269 -      if (marker.collapsed) {
 18.3270 -        if (curLine == to.line) collapsedAtEnd = collapsedSpanAt(line, to.ch);
 18.3271 -        if (curLine == from.line) collapsedAtStart = collapsedSpanAt(line, from.ch);
 18.3272 -        else updateLineHeight(line, 0);
 18.3273 -      }
 18.3274 -      addMarkedSpan(line, span);
 18.3275 -      if (marker.collapsed && curLine == from.line && lineIsHidden(line))
 18.3276 -        updateLineHeight(line, 0);
 18.3277 -      ++curLine;
 18.3278 -    });
 18.3279 -
 18.3280 -    if (marker.readOnly) {
 18.3281 -      sawReadOnlySpans = true;
 18.3282 -      if (cm.view.history.done.length || cm.view.history.undone.length)
 18.3283 -        cm.clearHistory();
 18.3284 -    }
 18.3285 -    if (marker.collapsed) {
 18.3286 -      if (collapsedAtStart != collapsedAtEnd)
 18.3287 -        throw new Error("Inserting collapsed marker overlapping an existing one");
 18.3288 -      marker.size = size;
 18.3289 -      marker.atomic = true;
 18.3290 -    }
 18.3291 -    if (marker.className || marker.startStyle || marker.endStyle || marker.collapsed)
 18.3292 -      regChange(cm, from.line, to.line + 1);
 18.3293 -    if (marker.atomic) reCheckSelection(cm);
 18.3294 -    return marker;
 18.3295 -  }
 18.3296 -
 18.3297 -  // TEXTMARKER SPANS
 18.3298 -
 18.3299 -  function getMarkedSpanFor(spans, marker) {
 18.3300 -    if (spans) for (var i = 0; i < spans.length; ++i) {
 18.3301 -      var span = spans[i];
 18.3302 -      if (span.marker == marker) return span;
 18.3303 -    }
 18.3304 -  }
 18.3305 -  function removeMarkedSpan(spans, span) {
 18.3306 -    for (var r, i = 0; i < spans.length; ++i)
 18.3307 -      if (spans[i] != span) (r || (r = [])).push(spans[i]);
 18.3308 -    return r;
 18.3309 -  }
 18.3310 -  function addMarkedSpan(line, span) {
 18.3311 -    line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
 18.3312 -    span.marker.lines.push(line);
 18.3313 -  }
 18.3314 -
 18.3315 -  function markedSpansBefore(old, startCh) {
 18.3316 -    if (old) for (var i = 0, nw; i < old.length; ++i) {
 18.3317 -      var span = old[i], marker = span.marker;
 18.3318 -      var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
 18.3319 -      if (startsBefore || marker.type == "bookmark" && span.from == startCh) {
 18.3320 -        var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh);
 18.3321 -        (nw || (nw = [])).push({from: span.from,
 18.3322 -                                to: endsAfter ? null : span.to,
 18.3323 -                                marker: marker});
 18.3324 -      }
 18.3325 -    }
 18.3326 -    return nw;
 18.3327 -  }
 18.3328 -
 18.3329 -  function markedSpansAfter(old, startCh, endCh) {
 18.3330 -    if (old) for (var i = 0, nw; i < old.length; ++i) {
 18.3331 -      var span = old[i], marker = span.marker;
 18.3332 -      var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
 18.3333 -      if (endsAfter || marker.type == "bookmark" && span.from == endCh && span.from != startCh) {
 18.3334 -        var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);
 18.3335 -        (nw || (nw = [])).push({from: startsBefore ? null : span.from - endCh,
 18.3336 -                                to: span.to == null ? null : span.to - endCh,
 18.3337 -                                marker: marker});
 18.3338 -      }
 18.3339 -    }
 18.3340 -    return nw;
 18.3341 -  }
 18.3342 -
 18.3343 -  function updateMarkedSpans(oldFirst, oldLast, startCh, endCh, newText) {
 18.3344 -    if (!oldFirst && !oldLast) return newText;
 18.3345 -    // Get the spans that 'stick out' on both sides
 18.3346 -    var first = markedSpansBefore(oldFirst, startCh);
 18.3347 -    var last = markedSpansAfter(oldLast, startCh, endCh);
 18.3348 -
 18.3349 -    // Next, merge those two ends
 18.3350 -    var sameLine = newText.length == 1, offset = lst(newText).length + (sameLine ? startCh : 0);
 18.3351 -    if (first) {
 18.3352 -      // Fix up .to properties of first
 18.3353 -      for (var i = 0; i < first.length; ++i) {
 18.3354 -        var span = first[i];
 18.3355 -        if (span.to == null) {
 18.3356 -          var found = getMarkedSpanFor(last, span.marker);
 18.3357 -          if (!found) span.to = startCh;
 18.3358 -          else if (sameLine) span.to = found.to == null ? null : found.to + offset;
 18.3359 -        }
 18.3360 -      }
 18.3361 -    }
 18.3362 -    if (last) {
 18.3363 -      // Fix up .from in last (or move them into first in case of sameLine)
 18.3364 -      for (var i = 0; i < last.length; ++i) {
 18.3365 -        var span = last[i];
 18.3366 -        if (span.to != null) span.to += offset;
 18.3367 -        if (span.from == null) {
 18.3368 -          var found = getMarkedSpanFor(first, span.marker);
 18.3369 -          if (!found) {
 18.3370 -            span.from = offset;
 18.3371 -            if (sameLine) (first || (first = [])).push(span);
 18.3372 -          }
 18.3373 -        } else {
 18.3374 -          span.from += offset;
 18.3375 -          if (sameLine) (first || (first = [])).push(span);
 18.3376 -        }
 18.3377 -      }
 18.3378 -    }
 18.3379 -
 18.3380 -    var newMarkers = [newHL(newText[0], first)];
 18.3381 -    if (!sameLine) {
 18.3382 -      // Fill gap with whole-line-spans
 18.3383 -      var gap = newText.length - 2, gapMarkers;
 18.3384 -      if (gap > 0 && first)
 18.3385 -        for (var i = 0; i < first.length; ++i)
 18.3386 -          if (first[i].to == null)
 18.3387 -            (gapMarkers || (gapMarkers = [])).push({from: null, to: null, marker: first[i].marker});
 18.3388 -      for (var i = 0; i < gap; ++i)
 18.3389 -        newMarkers.push(newHL(newText[i+1], gapMarkers));
 18.3390 -      newMarkers.push(newHL(lst(newText), last));
 18.3391 -    }
 18.3392 -    return newMarkers;
 18.3393 -  }
 18.3394 -
 18.3395 -  function removeReadOnlyRanges(doc, from, to) {
 18.3396 -    var markers = null;
 18.3397 -    doc.iter(from.line, to.line + 1, function(line) {
 18.3398 -      if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) {
 18.3399 -        var mark = line.markedSpans[i].marker;
 18.3400 -        if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
 18.3401 -          (markers || (markers = [])).push(mark);
 18.3402 -      }
 18.3403 -    });
 18.3404 -    if (!markers) return null;
 18.3405 -    var parts = [{from: from, to: to}];
 18.3406 -    for (var i = 0; i < markers.length; ++i) {
 18.3407 -      var m = markers[i].find();
 18.3408 -      for (var j = 0; j < parts.length; ++j) {
 18.3409 -        var p = parts[j];
 18.3410 -        if (!posLess(m.from, p.to) || posLess(m.to, p.from)) continue;
 18.3411 -        var newParts = [j, 1];
 18.3412 -        if (posLess(p.from, m.from)) newParts.push({from: p.from, to: m.from});
 18.3413 -        if (posLess(m.to, p.to)) newParts.push({from: m.to, to: p.to});
 18.3414 -        parts.splice.apply(parts, newParts);
 18.3415 -        j += newParts.length - 1;
 18.3416 -      }
 18.3417 -    }
 18.3418 -    return parts;
 18.3419 -  }
 18.3420 -
 18.3421 -  function collapsedSpanAt(line, ch) {
 18.3422 -    var sps = sawCollapsedSpans && line.markedSpans, found;
 18.3423 -    if (sps) for (var sp, i = 0; i < sps.length; ++i) {
 18.3424 -      sp = sps[i];
 18.3425 -      if (!sp.marker.collapsed) continue;
 18.3426 -      if ((sp.from == null || sp.from < ch) &&
 18.3427 -          (sp.to == null || sp.to > ch) &&
 18.3428 -          (!found || found.width < sp.marker.width))
 18.3429 -        found = sp.marker;
 18.3430 -    }
 18.3431 -    return found;
 18.3432 -  }
 18.3433 -  function collapsedSpanAtStart(line) { return collapsedSpanAt(line, -1); }
 18.3434 -  function collapsedSpanAtEnd(line) { return collapsedSpanAt(line, line.text.length + 1); }
 18.3435 -
 18.3436 -  function visualLine(doc, line) {
 18.3437 -    var merged;
 18.3438 -    while (merged = collapsedSpanAtStart(line))
 18.3439 -      line = getLine(doc, merged.find().from.line);
 18.3440 -    return line;
 18.3441 -  }
 18.3442 -
 18.3443 -  function lineIsHidden(line) {
 18.3444 -    var sps = sawCollapsedSpans && line.markedSpans;
 18.3445 -    if (sps) for (var sp, i = 0; i < sps.length; ++i) {
 18.3446 -      sp = sps[i];
 18.3447 -      if (!sp.marker.collapsed) continue;
 18.3448 -      if (sp.from == null) return true;
 18.3449 -      if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(line, sp))
 18.3450 -        return true;
 18.3451 -    }
 18.3452 -  }
 18.3453 -  window.lineIsHidden = lineIsHidden;
 18.3454 -  function lineIsHiddenInner(line, span) {
 18.3455 -    if (span.to == null || span.marker.inclusiveRight && span.to == line.text.length)
 18.3456 -      return true;
 18.3457 -    for (var sp, i = 0; i < line.markedSpans.length; ++i) {
 18.3458 -      sp = line.markedSpans[i];
 18.3459 -      if (sp.marker.collapsed && sp.from == span.to &&
 18.3460 -          (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
 18.3461 -          lineIsHiddenInner(line, sp)) return true;
 18.3462 -    }
 18.3463 -  }
 18.3464 -
 18.3465 -  // hl stands for history-line, a data structure that can be either a
 18.3466 -  // string (line without markers) or a {text, markedSpans} object.
 18.3467 -  function hlText(val) { return typeof val == "string" ? val : val.text; }
 18.3468 -  function hlSpans(val) {
 18.3469 -    if (typeof val == "string") return null;
 18.3470 -    var spans = val.markedSpans, out = null;
 18.3471 -    for (var i = 0; i < spans.length; ++i) {
 18.3472 -      if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }
 18.3473 -      else if (out) out.push(spans[i]);
 18.3474 -    }
 18.3475 -    return !out ? spans : out.length ? out : null;
 18.3476 -  }
 18.3477 -  function newHL(text, spans) { return spans ? {text: text, markedSpans: spans} : text; }
 18.3478 -
 18.3479 -  function detachMarkedSpans(line) {
 18.3480 -    var spans = line.markedSpans;
 18.3481 -    if (!spans) return;
 18.3482 -    for (var i = 0; i < spans.length; ++i) {
 18.3483 -      var lines = spans[i].marker.lines;
 18.3484 -      var ix = indexOf(lines, line);
 18.3485 -      lines.splice(ix, 1);
 18.3486 -    }
 18.3487 -    line.markedSpans = null;
 18.3488 -  }
 18.3489 -
 18.3490 -  function attachMarkedSpans(line, spans) {
 18.3491 -    if (!spans) return;
 18.3492 -    for (var i = 0; i < spans.length; ++i)
 18.3493 -      spans[i].marker.lines.push(line);
 18.3494 -    line.markedSpans = spans;
 18.3495 -  }
 18.3496 -
 18.3497 -  // LINE DATA STRUCTURE
 18.3498 -
 18.3499 -  // Line objects. These hold state related to a line, including
 18.3500 -  // highlighting info (the styles array).
 18.3501 -  function makeLine(text, markedSpans, height) {
 18.3502 -    var line = {text: text, height: height};
 18.3503 -    attachMarkedSpans(line, markedSpans);
 18.3504 -    if (lineIsHidden(line)) line.height = 0;
 18.3505 -    return line;
 18.3506 -  }
 18.3507 -
 18.3508 -  function updateLine(cm, line, text, markedSpans) {
 18.3509 -    line.text = text;
 18.3510 -    line.stateAfter = line.styles = null;
 18.3511 -    if (line.order != null) line.order = null;
 18.3512 -    detachMarkedSpans(line);
 18.3513 -    attachMarkedSpans(line, markedSpans);
 18.3514 -    if (lineIsHidden(line)) line.height = 0;
 18.3515 -    else if (!line.height) line.height = textHeight(cm.display);
 18.3516 -    signalLater(cm, line, "change");
 18.3517 -  }
 18.3518 -
 18.3519 -  function cleanUpLine(line) {
 18.3520 -    line.parent = null;
 18.3521 -    detachMarkedSpans(line);
 18.3522 -  }
 18.3523 -
 18.3524 -  // Run the given mode's parser over a line, update the styles
 18.3525 -  // array, which contains alternating fragments of text and CSS
 18.3526 -  // classes.
 18.3527 -  function highlightLine(cm, line, state) {
 18.3528 -    var mode = cm.view.mode, flattenSpans = cm.options.flattenSpans;
 18.3529 -    var changed = !line.styles, pos = 0, curText = "", curStyle = null;
 18.3530 -    var stream = new StringStream(line.text, cm.options.tabSize), st = line.styles || (line.styles = []);
 18.3531 -    if (line.text == "" && mode.blankLine) mode.blankLine(state);
 18.3532 -    while (!stream.eol()) {
 18.3533 -      var style = mode.token(stream, state), substr = stream.current();
 18.3534 -      stream.start = stream.pos;
 18.3535 -      if (!flattenSpans || curStyle != style) {
 18.3536 -        if (curText) {
 18.3537 -          changed = changed || pos >= st.length || curText != st[pos] || curStyle != st[pos+1];
 18.3538 -          st[pos++] = curText; st[pos++] = curStyle;
 18.3539 -        }
 18.3540 -        curText = substr; curStyle = style;
 18.3541 -      } else curText = curText + substr;
 18.3542 -      // Give up when line is ridiculously long
 18.3543 -      if (stream.pos > 5000) break;
 18.3544 -    }
 18.3545 -    if (curText) {
 18.3546 -      changed = changed || pos >= st.length || curText != st[pos] || curStyle != st[pos+1];
 18.3547 -      st[pos++] = curText; st[pos++] = curStyle;
 18.3548 -    }
 18.3549 -    if (stream.pos > 5000) { st[pos++] = line.text.slice(stream.pos); st[pos++] = null; }
 18.3550 -    if (pos != st.length) { st.length = pos; changed = true; }
 18.3551 -    return changed;
 18.3552 -  }
 18.3553 -
 18.3554 -  // Lightweight form of highlight -- proceed over this line and
 18.3555 -  // update state, but don't save a style array.
 18.3556 -  function processLine(cm, line, state) {
 18.3557 -    var mode = cm.view.mode;
 18.3558 -    var stream = new StringStream(line.text, cm.options.tabSize);
 18.3559 -    if (line.text == "" && mode.blankLine) mode.blankLine(state);
 18.3560 -    while (!stream.eol() && stream.pos <= 5000) {
 18.3561 -      mode.token(stream, state);
 18.3562 -      stream.start = stream.pos;
 18.3563 -    }
 18.3564 -  }
 18.3565 -
 18.3566 -  var styleToClassCache = {};
 18.3567 -  function styleToClass(style) {
 18.3568 -    if (!style) return null;
 18.3569 -    return styleToClassCache[style] ||
 18.3570 -      (styleToClassCache[style] = "cm-" + style.replace(/ +/g, " cm-"));
 18.3571 -  }
 18.3572 -
 18.3573 -  function lineContent(cm, realLine, measure) {
 18.3574 -    var merged, line = realLine, lineBefore, sawBefore, simple = true;
 18.3575 -    while (merged = collapsedSpanAtStart(line)) {
 18.3576 -      simple = false;
 18.3577 -      line = getLine(cm.view.doc, merged.find().from.line);
 18.3578 -      if (!lineBefore) lineBefore = line;
 18.3579 -    }
 18.3580 -
 18.3581 -    var builder = {pre: elt("pre"), col: 0, pos: 0, display: !measure,
 18.3582 -                   measure: null, addedOne: false, cm: cm};
 18.3583 -    if (line.textClass) builder.pre.className = line.textClass;
 18.3584 -
 18.3585 -    do {
 18.3586 -      if (!line.styles)
 18.3587 -        highlightLine(cm, line, line.stateAfter = getStateBefore(cm, lineNo(line)));
 18.3588 -      builder.measure = line == realLine && measure;
 18.3589 -      builder.pos = 0;
 18.3590 -      builder.addToken = builder.measure ? buildTokenMeasure : buildToken;
 18.3591 -      if (measure && sawBefore && line != realLine && !builder.addedOne) {
 18.3592 -        measure[0] = builder.pre.appendChild(zeroWidthElement(cm.display.measure));
 18.3593 -        builder.addedOne = true;
 18.3594 -      }
 18.3595 -      var next = insertLineContent(line, builder);
 18.3596 -      sawBefore = line == lineBefore;
 18.3597 -      if (next) {
 18.3598 -        line = getLine(cm.view.doc, next.to.line);
 18.3599 -        simple = false;
 18.3600 -      }
 18.3601 -    } while (next);
 18.3602 -
 18.3603 -    if (measure && !builder.addedOne)
 18.3604 -      measure[0] = builder.pre.appendChild(simple ? elt("span", "\u00a0") : zeroWidthElement(cm.display.measure));
 18.3605 -    if (!builder.pre.firstChild && !lineIsHidden(realLine))
 18.3606 -      builder.pre.appendChild(document.createTextNode("\u00a0"));
 18.3607 -
 18.3608 -    return builder.pre;
 18.3609 -  }
 18.3610 -
 18.3611 -  var tokenSpecialChars = /[\t\u0000-\u0019\u200b\u2028\u2029\uFEFF]/g;
 18.3612 -  function buildToken(builder, text, style, startStyle, endStyle) {
 18.3613 -    if (!text) return;
 18.3614 -    if (!tokenSpecialChars.test(text)) {
 18.3615 -      builder.col += text.length;
 18.3616 -      var content = document.createTextNode(text);
 18.3617 -    } else {
 18.3618 -      var content = document.createDocumentFragment(), pos = 0;
 18.3619 -      while (true) {
 18.3620 -        tokenSpecialChars.lastIndex = pos;
 18.3621 -        var m = tokenSpecialChars.exec(text);
 18.3622 -        var skipped = m ? m.index - pos : text.length - pos;
 18.3623 -        if (skipped) {
 18.3624 -          content.appendChild(document.createTextNode(text.slice(pos, pos + skipped)));
 18.3625 -          builder.col += skipped;
 18.3626 -        }
 18.3627 -        if (!m) break;
 18.3628 -        pos += skipped + 1;
 18.3629 -        if (m[0] == "\t") {
 18.3630 -          var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
 18.3631 -          content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
 18.3632 -          builder.col += tabWidth;
 18.3633 -        } else {
 18.3634 -          var token = elt("span", "\u2022", "cm-invalidchar");
 18.3635 -          token.title = "\\u" + m[0].charCodeAt(0).toString(16);
 18.3636 -          content.appendChild(token);
 18.3637 -          builder.col += 1;
 18.3638 -        }
 18.3639 -      }
 18.3640 -    }
 18.3641 -    if (style || startStyle || endStyle || builder.measure) {
 18.3642 -      var fullStyle = style || "";
 18.3643 -      if (startStyle) fullStyle += startStyle;
 18.3644 -      if (endStyle) fullStyle += endStyle;
 18.3645 -      return builder.pre.appendChild(elt("span", [content], fullStyle));
 18.3646 -    }
 18.3647 -    builder.pre.appendChild(content);
 18.3648 -  }
 18.3649 -
 18.3650 -  function buildTokenMeasure(builder, text, style, startStyle, endStyle) {
 18.3651 -    for (var i = 0; i < text.length; ++i) {
 18.3652 -      if (i && i < text.length - 1 &&
 18.3653 -          builder.cm.options.lineWrapping &&
 18.3654 -          spanAffectsWrapping.test(text.slice(i - 1, i + 1)))
 18.3655 -        builder.pre.appendChild(elt("wbr"));
 18.3656 -      builder.measure[builder.pos++] =
 18.3657 -        buildToken(builder, text.charAt(i), style,
 18.3658 -                   i == 0 && startStyle, i == text.length - 1 && endStyle);
 18.3659 -    }
 18.3660 -    if (text.length) builder.addedOne = true;
 18.3661 -  }
 18.3662 -
 18.3663 -  function buildCollapsedSpan(builder, size, widget) {
 18.3664 -    if (widget) {
 18.3665 -      if (!builder.display) widget = widget.cloneNode(true);
 18.3666 -      builder.pre.appendChild(widget);
 18.3667 -      if (builder.measure && size) {
 18.3668 -        builder.measure[builder.pos] = widget;
 18.3669 -        builder.addedOne = true;
 18.3670 -      }
 18.3671 -    }
 18.3672 -    builder.pos += size;
 18.3673 -  }
 18.3674 -
 18.3675 -  // Outputs a number of spans to make up a line, taking highlighting
 18.3676 -  // and marked text into account.
 18.3677 -  function insertLineContent(line, builder) {
 18.3678 -    var st = line.styles, spans = line.markedSpans;
 18.3679 -    if (!spans) {
 18.3680 -      for (var i = 0; i < st.length; i+=2)
 18.3681 -        builder.addToken(builder, st[i], styleToClass(st[i+1]));
 18.3682 -      return;
 18.3683 -    }
 18.3684 -
 18.3685 -    var allText = line.text, len = allText.length;
 18.3686 -    var pos = 0, i = 0, text = "", style;
 18.3687 -    var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed;
 18.3688 -    for (;;) {
 18.3689 -      if (nextChange == pos) { // Update current marker set
 18.3690 -        spanStyle = spanEndStyle = spanStartStyle = "";
 18.3691 -        collapsed = null; nextChange = Infinity;
 18.3692 -        var foundBookmark = null;
 18.3693 -        for (var j = 0; j < spans.length; ++j) {
 18.3694 -          var sp = spans[j], m = sp.marker;
 18.3695 -          if (sp.from <= pos && (sp.to == null || sp.to > pos)) {
 18.3696 -            if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = ""; }
 18.3697 -            if (m.className) spanStyle += " " + m.className;
 18.3698 -            if (m.startStyle && sp.from == pos) spanStartStyle += " " + m.startStyle;
 18.3699 -            if (m.endStyle && sp.to == nextChange) spanEndStyle += " " + m.endStyle;
 18.3700 -            if (m.collapsed && (!collapsed || collapsed.marker.width < m.width))
 18.3701 -              collapsed = sp;
 18.3702 -          } else if (sp.from > pos && nextChange > sp.from) {
 18.3703 -            nextChange = sp.from;
 18.3704 -          }
 18.3705 -          if (m.type == "bookmark" && sp.from == pos && m.replacedWith)
 18.3706 -            foundBookmark = m.replacedWith;
 18.3707 -        }
 18.3708 -        if (collapsed && (collapsed.from || 0) == pos) {
 18.3709 -          buildCollapsedSpan(builder, (collapsed.to == null ? len : collapsed.to) - pos,
 18.3710 -                             collapsed.from != null && collapsed.marker.replacedWith);
 18.3711 -          if (collapsed.to == null) return collapsed.marker.find();
 18.3712 -        }
 18.3713 -        if (foundBookmark && !collapsed) buildCollapsedSpan(builder, 0, foundBookmark);
 18.3714 -      }
 18.3715 -      if (pos >= len) break;
 18.3716 -
 18.3717 -      var upto = Math.min(len, nextChange);
 18.3718 -      while (true) {
 18.3719 -        if (text) {
 18.3720 -          var end = pos + text.length;
 18.3721 -          if (!collapsed) {
 18.3722 -            var tokenText = end > upto ? text.slice(0, upto - pos) : text;
 18.3723 -            builder.addToken(builder, tokenText, style + spanStyle,
 18.3724 -                             spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "");
 18.3725 -          }
 18.3726 -          if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}
 18.3727 -          pos = end;
 18.3728 -          spanStartStyle = "";
 18.3729 -        }
 18.3730 -        text = st[i++]; style = styleToClass(st[i++]);
 18.3731 -      }
 18.3732 -    }
 18.3733 -  }
 18.3734 -
 18.3735 -  // DOCUMENT DATA STRUCTURE
 18.3736 -
 18.3737 -  function LeafChunk(lines) {
 18.3738 -    this.lines = lines;
 18.3739 -    this.parent = null;
 18.3740 -    for (var i = 0, e = lines.length, height = 0; i < e; ++i) {
 18.3741 -      lines[i].parent = this;
 18.3742 -      height += lines[i].height;
 18.3743 -    }
 18.3744 -    this.height = height;
 18.3745 -  }
 18.3746 -
 18.3747 -  LeafChunk.prototype = {
 18.3748 -    chunkSize: function() { return this.lines.length; },
 18.3749 -    remove: function(at, n, cm) {
 18.3750 -      for (var i = at, e = at + n; i < e; ++i) {
 18.3751 -        var line = this.lines[i];
 18.3752 -        this.height -= line.height;
 18.3753 -        cleanUpLine(line);
 18.3754 -        signalLater(cm, line, "delete");
 18.3755 -      }
 18.3756 -      this.lines.splice(at, n);
 18.3757 -    },
 18.3758 -    collapse: function(lines) {
 18.3759 -      lines.splice.apply(lines, [lines.length, 0].concat(this.lines));
 18.3760 -    },
 18.3761 -    insertHeight: function(at, lines, height) {
 18.3762 -      this.height += height;
 18.3763 -      this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
 18.3764 -      for (var i = 0, e = lines.length; i < e; ++i) lines[i].parent = this;
 18.3765 -    },
 18.3766 -    iterN: function(at, n, op) {
 18.3767 -      for (var e = at + n; at < e; ++at)
 18.3768 -        if (op(this.lines[at])) return true;
 18.3769 -    }
 18.3770 -  };
 18.3771 -
 18.3772 -  function BranchChunk(children) {
 18.3773 -    this.children = children;
 18.3774 -    var size = 0, height = 0;
 18.3775 -    for (var i = 0, e = children.length; i < e; ++i) {
 18.3776 -      var ch = children[i];
 18.3777 -      size += ch.chunkSize(); height += ch.height;
 18.3778 -      ch.parent = this;
 18.3779 -    }
 18.3780 -    this.size = size;
 18.3781 -    this.height = height;
 18.3782 -    this.parent = null;
 18.3783 -  }
 18.3784 -
 18.3785 -  BranchChunk.prototype = {
 18.3786 -    chunkSize: function() { return this.size; },
 18.3787 -    remove: function(at, n, callbacks) {
 18.3788 -      this.size -= n;
 18.3789 -      for (var i = 0; i < this.children.length; ++i) {
 18.3790 -        var child = this.children[i], sz = child.chunkSize();
 18.3791 -        if (at < sz) {
 18.3792 -          var rm = Math.min(n, sz - at), oldHeight = child.height;
 18.3793 -          child.remove(at, rm, callbacks);
 18.3794 -          this.height -= oldHeight - child.height;
 18.3795 -          if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }
 18.3796 -          if ((n -= rm) == 0) break;
 18.3797 -          at = 0;
 18.3798 -        } else at -= sz;
 18.3799 -      }
 18.3800 -      if (this.size - n < 25) {
 18.3801 -        var lines = [];
 18.3802 -        this.collapse(lines);
 18.3803 -        this.children = [new LeafChunk(lines)];
 18.3804 -        this.children[0].parent = this;
 18.3805 -      }
 18.3806 -    },
 18.3807 -    collapse: function(lines) {
 18.3808 -      for (var i = 0, e = this.children.length; i < e; ++i) this.children[i].collapse(lines);
 18.3809 -    },
 18.3810 -    insert: function(at, lines) {
 18.3811 -      var height = 0;
 18.3812 -      for (var i = 0, e = lines.length; i < e; ++i) height += lines[i].height;
 18.3813 -      this.insertHeight(at, lines, height);
 18.3814 -    },
 18.3815 -    insertHeight: function(at, lines, height) {
 18.3816 -      this.size += lines.length;
 18.3817 -      this.height += height;
 18.3818 -      for (var i = 0, e = this.children.length; i < e; ++i) {
 18.3819 -        var child = this.children[i], sz = child.chunkSize();
 18.3820 -        if (at <= sz) {
 18.3821 -          child.insertHeight(at, lines, height);
 18.3822 -          if (child.lines && child.lines.length > 50) {
 18.3823 -            while (child.lines.length > 50) {
 18.3824 -              var spilled = child.lines.splice(child.lines.length - 25, 25);
 18.3825 -              var newleaf = new LeafChunk(spilled);
 18.3826 -              child.height -= newleaf.height;
 18.3827 -              this.children.splice(i + 1, 0, newleaf);
 18.3828 -              newleaf.parent = this;
 18.3829 -            }
 18.3830 -            this.maybeSpill();
 18.3831 -          }
 18.3832 -          break;
 18.3833 -        }
 18.3834 -        at -= sz;
 18.3835 -      }
 18.3836 -    },
 18.3837 -    maybeSpill: function() {
 18.3838 -      if (this.children.length <= 10) return;
 18.3839 -      var me = this;
 18.3840 -      do {
 18.3841 -        var spilled = me.children.splice(me.children.length - 5, 5);
 18.3842 -        var sibling = new BranchChunk(spilled);
 18.3843 -        if (!me.parent) { // Become the parent node
 18.3844 -          var copy = new BranchChunk(me.children);
 18.3845 -          copy.parent = me;
 18.3846 -          me.children = [copy, sibling];
 18.3847 -          me = copy;
 18.3848 -        } else {
 18.3849 -          me.size -= sibling.size;
 18.3850 -          me.height -= sibling.height;
 18.3851 -          var myIndex = indexOf(me.parent.children, me);
 18.3852 -          me.parent.children.splice(myIndex + 1, 0, sibling);
 18.3853 -        }
 18.3854 -        sibling.parent = me.parent;
 18.3855 -      } while (me.children.length > 10);
 18.3856 -      me.parent.maybeSpill();
 18.3857 -    },
 18.3858 -    iter: function(from, to, op) { this.iterN(from, to - from, op); },
 18.3859 -    iterN: function(at, n, op) {
 18.3860 -      for (var i = 0, e = this.children.length; i < e; ++i) {
 18.3861 -        var child = this.children[i], sz = child.chunkSize();
 18.3862 -        if (at < sz) {
 18.3863 -          var used = Math.min(n, sz - at);
 18.3864 -          if (child.iterN(at, used, op)) return true;
 18.3865 -          if ((n -= used) == 0) break;
 18.3866 -          at = 0;
 18.3867 -        } else at -= sz;
 18.3868 -      }
 18.3869 -    }
 18.3870 -  };
 18.3871 -
 18.3872 -  // LINE UTILITIES
 18.3873 -
 18.3874 -  function getLine(chunk, n) {
 18.3875 -    while (!chunk.lines) {
 18.3876 -      for (var i = 0;; ++i) {
 18.3877 -        var child = chunk.children[i], sz = child.chunkSize();
 18.3878 -        if (n < sz) { chunk = child; break; }
 18.3879 -        n -= sz;
 18.3880 -      }
 18.3881 -    }
 18.3882 -    return chunk.lines[n];
 18.3883 -  }
 18.3884 -
 18.3885 -  function updateLineHeight(line, height) {
 18.3886 -    var diff = height - line.height;
 18.3887 -    for (var n = line; n; n = n.parent) n.height += diff;
 18.3888 -  }
 18.3889 -
 18.3890 -  function lineNo(line) {
 18.3891 -    if (line.parent == null) return null;
 18.3892 -    var cur = line.parent, no = indexOf(cur.lines, line);
 18.3893 -    for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
 18.3894 -      for (var i = 0;; ++i) {
 18.3895 -        if (chunk.children[i] == cur) break;
 18.3896 -        no += chunk.children[i].chunkSize();
 18.3897 -      }
 18.3898 -    }
 18.3899 -    return no;
 18.3900 -  }
 18.3901 -
 18.3902 -  function lineAtHeight(chunk, h) {
 18.3903 -    var n = 0;
 18.3904 -    outer: do {
 18.3905 -      for (var i = 0, e = chunk.children.length; i < e; ++i) {
 18.3906 -        var child = chunk.children[i], ch = child.height;
 18.3907 -        if (h < ch) { chunk = child; continue outer; }
 18.3908 -        h -= ch;
 18.3909 -        n += child.chunkSize();
 18.3910 -      }
 18.3911 -      return n;
 18.3912 -    } while (!chunk.lines);
 18.3913 -    for (var i = 0, e = chunk.lines.length; i < e; ++i) {
 18.3914 -      var line = chunk.lines[i], lh = line.height;
 18.3915 -      if (h < lh) break;
 18.3916 -      h -= lh;
 18.3917 -    }
 18.3918 -    return n + i;
 18.3919 -  }
 18.3920 -
 18.3921 -  function heightAtLine(cm, lineObj) {
 18.3922 -    lineObj = visualLine(cm.view.doc, lineObj);
 18.3923 -
 18.3924 -    var h = 0, chunk = lineObj.parent;
 18.3925 -    for (var i = 0; i < chunk.lines.length; ++i) {
 18.3926 -      var line = chunk.lines[i];
 18.3927 -      if (line == lineObj) break;
 18.3928 -      else h += line.height;
 18.3929 -    }
 18.3930 -    for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
 18.3931 -      for (var i = 0; i < p.children.length; ++i) {
 18.3932 -        var cur = p.children[i];
 18.3933 -        if (cur == chunk) break;
 18.3934 -        else h += cur.height;
 18.3935 -      }
 18.3936 -    }
 18.3937 -    return h;
 18.3938 -  }
 18.3939 -
 18.3940 -  function getOrder(line) {
 18.3941 -    var order = line.order;
 18.3942 -    if (order == null) order = line.order = bidiOrdering(line.text);
 18.3943 -    return order;
 18.3944 -  }
 18.3945 -
 18.3946 -  // HISTORY
 18.3947 -
 18.3948 -  function makeHistory() {
 18.3949 -    return {
 18.3950 -      // Arrays of history events. Doing something adds an event to
 18.3951 -      // done and clears undo. Undoing moves events from done to
 18.3952 -      // undone, redoing moves them in the other direction.
 18.3953 -      done: [], undone: [],
 18.3954 -      // Used to track when changes can be merged into a single undo
 18.3955 -      // event
 18.3956 -      lastTime: 0, lastOp: null, lastOrigin: null,
 18.3957 -      // Used by the isClean() method
 18.3958 -      dirtyCounter: 0
 18.3959 -    };
 18.3960 -  }
 18.3961 -
 18.3962 -  function addChange(cm, start, added, old, origin, fromBefore, toBefore, fromAfter, toAfter) {
 18.3963 -    var history = cm.view.history;
 18.3964 -    history.undone.length = 0;
 18.3965 -    var time = +new Date, cur = lst(history.done);
 18.3966 -    
 18.3967 -    if (cur &&
 18.3968 -        (history.lastOp == cm.curOp.id ||
 18.3969 -         history.lastOrigin == origin && (origin == "input" || origin == "delete") &&
 18.3970 -         history.lastTime > time - 600)) {
 18.3971 -      // Merge this change into the last event
 18.3972 -      var last = lst(cur.events);
 18.3973 -      if (last.start > start + old.length || last.start + last.added < start) {
 18.3974 -        // Doesn't intersect with last sub-event, add new sub-event
 18.3975 -        cur.events.push({start: start, added: added, old: old});
 18.3976 -      } else {
 18.3977 -        // Patch up the last sub-event
 18.3978 -        var startBefore = Math.max(0, last.start - start),
 18.3979 -        endAfter = Math.max(0, (start + old.length) - (last.start + last.added));
 18.3980 -        for (var i = startBefore; i > 0; --i) last.old.unshift(old[i - 1]);
 18.3981 -        for (var i = endAfter; i > 0; --i) last.old.push(old[old.length - i]);
 18.3982 -        if (startBefore) last.start = start;
 18.3983 -        last.added += added - (old.length - startBefore - endAfter);
 18.3984 -      }
 18.3985 -      cur.fromAfter = fromAfter; cur.toAfter = toAfter;
 18.3986 -    } else {
 18.3987 -      // Can not be merged, start a new event.
 18.3988 -      cur = {events: [{start: start, added: added, old: old}],
 18.3989 -             fromBefore: fromBefore, toBefore: toBefore, fromAfter: fromAfter, toAfter: toAfter};
 18.3990 -      history.done.push(cur);
 18.3991 -      while (history.done.length > cm.options.undoDepth)
 18.3992 -        history.done.shift();
 18.3993 -      if (history.dirtyCounter < 0)
 18.3994 -          // The user has made a change after undoing past the last clean state. 
 18.3995 -          // We can never get back to a clean state now until markClean() is called.
 18.3996 -          history.dirtyCounter = NaN;
 18.3997 -      else
 18.3998 -        history.dirtyCounter++;
 18.3999 -    }
 18.4000 -    history.lastTime = time;
 18.4001 -    history.lastOp = cm.curOp.id;
 18.4002 -    history.lastOrigin = origin;
 18.4003 -  }
 18.4004 -
 18.4005 -  // EVENT OPERATORS
 18.4006 -
 18.4007 -  function stopMethod() {e_stop(this);}
 18.4008 -  // Ensure an event has a stop method.
 18.4009 -  function addStop(event) {
 18.4010 -    if (!event.stop) event.stop = stopMethod;
 18.4011 -    return event;
 18.4012 -  }
 18.4013 -
 18.4014 -  function e_preventDefault(e) {
 18.4015 -    if (e.preventDefault) e.preventDefault();
 18.4016 -    else e.returnValue = false;
 18.4017 -  }
 18.4018 -  function e_stopPropagation(e) {
 18.4019 -    if (e.stopPropagation) e.stopPropagation();
 18.4020 -    else e.cancelBubble = true;
 18.4021 -  }
 18.4022 -  function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
 18.4023 -  CodeMirror.e_stop = e_stop;
 18.4024 -  CodeMirror.e_preventDefault = e_preventDefault;
 18.4025 -  CodeMirror.e_stopPropagation = e_stopPropagation;
 18.4026 -
 18.4027 -  function e_target(e) {return e.target || e.srcElement;}
 18.4028 -  function e_button(e) {
 18.4029 -    var b = e.which;
 18.4030 -    if (b == null) {
 18.4031 -      if (e.button & 1) b = 1;
 18.4032 -      else if (e.button & 2) b = 3;
 18.4033 -      else if (e.button & 4) b = 2;
 18.4034 -    }
 18.4035 -    if (mac && e.ctrlKey && b == 1) b = 3;
 18.4036 -    return b;
 18.4037 -  }
 18.4038 -
 18.4039 -  // Allow 3rd-party code to override event properties by adding an override
 18.4040 -  // object to an event object.
 18.4041 -  function e_prop(e, prop) {
 18.4042 -    var overridden = e.override && e.override.hasOwnProperty(prop);
 18.4043 -    return overridden ? e.override[prop] : e[prop];
 18.4044 -  }
 18.4045 -
 18.4046 -  // EVENT HANDLING
 18.4047 -
 18.4048 -  function on(emitter, type, f) {
 18.4049 -    if (emitter.addEventListener)
 18.4050 -      emitter.addEventListener(type, f, false);
 18.4051 -    else if (emitter.attachEvent)
 18.4052 -      emitter.attachEvent("on" + type, f);
 18.4053 -    else {
 18.4054 -      var map = emitter._handlers || (emitter._handlers = {});
 18.4055 -      var arr = map[type] || (map[type] = []);
 18.4056 -      arr.push(f);
 18.4057 -    }
 18.4058 -  }
 18.4059 -
 18.4060 -  function off(emitter, type, f) {
 18.4061 -    if (emitter.removeEventListener)
 18.4062 -      emitter.removeEventListener(type, f, false);
 18.4063 -    else if (emitter.detachEvent)
 18.4064 -      emitter.detachEvent("on" + type, f);
 18.4065 -    else {
 18.4066 -      var arr = emitter._handlers && emitter._handlers[type];
 18.4067 -      if (!arr) return;
 18.4068 -      for (var i = 0; i < arr.length; ++i)
 18.4069 -        if (arr[i] == f) { arr.splice(i, 1); break; }
 18.4070 -    }
 18.4071 -  }
 18.4072 -
 18.4073 -  function signal(emitter, type /*, values...*/) {
 18.4074 -    var arr = emitter._handlers && emitter._handlers[type];
 18.4075 -    if (!arr) return;
 18.4076 -    var args = Array.prototype.slice.call(arguments, 2);
 18.4077 -    for (var i = 0; i < arr.length; ++i) arr[i].apply(null, args);
 18.4078 -  }
 18.4079 -
 18.4080 -  function signalLater(cm, emitter, type /*, values...*/) {
 18.4081 -    var arr = emitter._handlers && emitter._handlers[type];
 18.4082 -    if (!arr) return;
 18.4083 -    var args = Array.prototype.slice.call(arguments, 3), flist = cm.curOp && cm.curOp.delayedCallbacks;
 18.4084 -    function bnd(f) {return function(){f.apply(null, args);};};
 18.4085 -    for (var i = 0; i < arr.length; ++i)
 18.4086 -      if (flist) flist.push(bnd(arr[i]));
 18.4087 -      else arr[i].apply(null, args);
 18.4088 -  }
 18.4089 -
 18.4090 -  function hasHandler(emitter, type) {
 18.4091 -    var arr = emitter._handlers && emitter._handlers[type];
 18.4092 -    return arr && arr.length > 0;
 18.4093 -  }
 18.4094 -
 18.4095 -  CodeMirror.on = on; CodeMirror.off = off; CodeMirror.signal = signal;
 18.4096 -
 18.4097 -  // MISC UTILITIES
 18.4098 -
 18.4099 -  // Number of pixels added to scroller and sizer to hide scrollbar
 18.4100 -  var scrollerCutOff = 30;
 18.4101 -
 18.4102 -  // Returned or thrown by various protocols to signal 'I'm not
 18.4103 -  // handling this'.
 18.4104 -  var Pass = CodeMirror.Pass = {toString: function(){return "CodeMirror.Pass";}};
 18.4105 -
 18.4106 -  function Delayed() {this.id = null;}
 18.4107 -  Delayed.prototype = {set: function(ms, f) {clearTimeout(this.id); this.id = setTimeout(f, ms);}};
 18.4108 -
 18.4109 -  // Counts the column offset in a string, taking tabs into account.
 18.4110 -  // Used mostly to find indentation.
 18.4111 -  function countColumn(string, end, tabSize) {
 18.4112 -    if (end == null) {
 18.4113 -      end = string.search(/[^\s\u00a0]/);
 18.4114 -      if (end == -1) end = string.length;
 18.4115 -    }
 18.4116 -    for (var i = 0, n = 0; i < end; ++i) {
 18.4117 -      if (string.charAt(i) == "\t") n += tabSize - (n % tabSize);
 18.4118 -      else ++n;
 18.4119 -    }
 18.4120 -    return n;
 18.4121 -  }
 18.4122 -  CodeMirror.countColumn = countColumn;
 18.4123 -
 18.4124 -  var spaceStrs = [""];
 18.4125 -  function spaceStr(n) {
 18.4126 -    while (spaceStrs.length <= n)
 18.4127 -      spaceStrs.push(lst(spaceStrs) + " ");
 18.4128 -    return spaceStrs[n];
 18.4129 -  }
 18.4130 -
 18.4131 -  function lst(arr) { return arr[arr.length-1]; }
 18.4132 -
 18.4133 -  function selectInput(node) {
 18.4134 -    if (ios) { // Mobile Safari apparently has a bug where select() is broken.
 18.4135 -      node.selectionStart = 0;
 18.4136 -      node.selectionEnd = node.value.length;
 18.4137 -    } else node.select();
 18.4138 -  }
 18.4139 -
 18.4140 -  function indexOf(collection, elt) {
 18.4141 -    if (collection.indexOf) return collection.indexOf(elt);
 18.4142 -    for (var i = 0, e = collection.length; i < e; ++i)
 18.4143 -      if (collection[i] == elt) return i;
 18.4144 -    return -1;
 18.4145 -  }
 18.4146 -
 18.4147 -  function emptyArray(size) {
 18.4148 -    for (var a = [], i = 0; i < size; ++i) a.push(undefined);
 18.4149 -    return a;
 18.4150 -  }
 18.4151 -
 18.4152 -  function bind(f) {
 18.4153 -    var args = Array.prototype.slice.call(arguments, 1);
 18.4154 -    return function(){return f.apply(null, args);};
 18.4155 -  }
 18.4156 -
 18.4157 -  var nonASCIISingleCaseWordChar = /[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc]/;
 18.4158 -  function isWordChar(ch) {
 18.4159 -    return /\w/.test(ch) || ch > "\x80" &&
 18.4160 -      (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch));
 18.4161 -  }
 18.4162 -
 18.4163 -  function isEmpty(obj) {
 18.4164 -    var c = 0;
 18.4165 -    for (var n in obj) if (obj.hasOwnProperty(n) && obj[n]) ++c;
 18.4166 -    return !c;
 18.4167 -  }
 18.4168 -
 18.4169 -  var isExtendingChar = /[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\uA670-\uA672\uA674-\uA67D\uA69F]/;
 18.4170 -
 18.4171 -  // DOM UTILITIES
 18.4172 -
 18.4173 -  function elt(tag, content, className, style) {
 18.4174 -    var e = document.createElement(tag);
 18.4175 -    if (className) e.className = className;
 18.4176 -    if (style) e.style.cssText = style;
 18.4177 -    if (typeof content == "string") setTextContent(e, content);
 18.4178 -    else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]);
 18.4179 -    return e;
 18.4180 -  }
 18.4181 -
 18.4182 -  function removeChildren(e) {
 18.4183 -    e.innerHTML = "";
 18.4184 -    return e;
 18.4185 -  }
 18.4186 -
 18.4187 -  function removeChildrenAndAdd(parent, e) {
 18.4188 -    return removeChildren(parent).appendChild(e);
 18.4189 -  }
 18.4190 -
 18.4191 -  function setTextContent(e, str) {
 18.4192 -    if (ie_lt9) {
 18.4193 -      e.innerHTML = "";
 18.4194 -      e.appendChild(document.createTextNode(str));
 18.4195 -    } else e.textContent = str;
 18.4196 -  }
 18.4197 -
 18.4198 -  // FEATURE DETECTION
 18.4199 -
 18.4200 -  // Detect drag-and-drop
 18.4201 -  var dragAndDrop = function() {
 18.4202 -    // There is *some* kind of drag-and-drop support in IE6-8, but I
 18.4203 -    // couldn't get it to work yet.
 18.4204 -    if (ie_lt9) return false;
 18.4205 -    var div = elt('div');
 18.4206 -    return "draggable" in div || "dragDrop" in div;
 18.4207 -  }();
 18.4208 -
 18.4209 -  // For a reason I have yet to figure out, some browsers disallow
 18.4210 -  // word wrapping between certain characters *only* if a new inline
 18.4211 -  // element is started between them. This makes it hard to reliably
 18.4212 -  // measure the position of things, since that requires inserting an
 18.4213 -  // extra span. This terribly fragile set of regexps matches the
 18.4214 -  // character combinations that suffer from this phenomenon on the
 18.4215 -  // various browsers.
 18.4216 -  var spanAffectsWrapping = /^$/; // Won't match any two-character string
 18.4217 -  if (gecko) spanAffectsWrapping = /$'/;
 18.4218 -  else if (safari) spanAffectsWrapping = /\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/;
 18.4219 -  else if (chrome) spanAffectsWrapping = /\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/;
 18.4220 -
 18.4221 -  var knownScrollbarWidth;
 18.4222 -  function scrollbarWidth(measure) {
 18.4223 -    if (knownScrollbarWidth != null) return knownScrollbarWidth;
 18.4224 -    var test = elt("div", null, null, "width: 50px; height: 50px; overflow-x: scroll");
 18.4225 -    removeChildrenAndAdd(measure, test);
 18.4226 -    if (test.offsetWidth)
 18.4227 -      knownScrollbarWidth = test.offsetHeight - test.clientHeight;
 18.4228 -    return knownScrollbarWidth || 0;
 18.4229 -  }
 18.4230 -
 18.4231 -  var zwspSupported;
 18.4232 -  function zeroWidthElement(measure) {
 18.4233 -    if (zwspSupported == null) {
 18.4234 -      var test = elt("span", "\u200b");
 18.4235 -      removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
 18.4236 -      if (measure.firstChild.offsetHeight != 0)
 18.4237 -        zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !ie_lt8;
 18.4238 -    }
 18.4239 -    if (zwspSupported) return elt("span", "\u200b");
 18.4240 -    else return elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
 18.4241 -  }
 18.4242 -
 18.4243 -  // See if "".split is the broken IE version, if so, provide an
 18.4244 -  // alternative way to split lines.
 18.4245 -  var splitLines = "\n\nb".split(/\n/).length != 3 ? function(string) {
 18.4246 -    var pos = 0, result = [], l = string.length;
 18.4247 -    while (pos <= l) {
 18.4248 -      var nl = string.indexOf("\n", pos);
 18.4249 -      if (nl == -1) nl = string.length;
 18.4250 -      var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
 18.4251 -      var rt = line.indexOf("\r");
 18.4252 -      if (rt != -1) {
 18.4253 -        result.push(line.slice(0, rt));
 18.4254 -        pos += rt + 1;
 18.4255 -      } else {
 18.4256 -        result.push(line);
 18.4257 -        pos = nl + 1;
 18.4258 -      }
 18.4259 -    }
 18.4260 -    return result;
 18.4261 -  } : function(string){return string.split(/\r\n?|\n/);};
 18.4262 -  CodeMirror.splitLines = splitLines;
 18.4263 -
 18.4264 -  var hasSelection = window.getSelection ? function(te) {
 18.4265 -    try { return te.selectionStart != te.selectionEnd; }
 18.4266 -    catch(e) { return false; }
 18.4267 -  } : function(te) {
 18.4268 -    try {var range = te.ownerDocument.selection.createRange();}
 18.4269 -    catch(e) {}
 18.4270 -    if (!range || range.parentElement() != te) return false;
 18.4271 -    return range.compareEndPoints("StartToEnd", range) != 0;
 18.4272 -  };
 18.4273 -
 18.4274 -  var hasCopyEvent = (function() {
 18.4275 -    var e = elt("div");
 18.4276 -    if ("oncopy" in e) return true;
 18.4277 -    e.setAttribute("oncopy", "return;");
 18.4278 -    return typeof e.oncopy == 'function';
 18.4279 -  })();
 18.4280 -
 18.4281 -  // KEY NAMING
 18.4282 -
 18.4283 -  var keyNames = {3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
 18.4284 -                  19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
 18.4285 -                  36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
 18.4286 -                  46: "Delete", 59: ";", 91: "Mod", 92: "Mod", 93: "Mod", 109: "-", 107: "=", 127: "Delete",
 18.4287 -                  186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
 18.4288 -                  221: "]", 222: "'", 63276: "PageUp", 63277: "PageDown", 63275: "End", 63273: "Home",
 18.4289 -                  63234: "Left", 63232: "Up", 63235: "Right", 63233: "Down", 63302: "Insert", 63272: "Delete"};
 18.4290 -  CodeMirror.keyNames = keyNames;
 18.4291 -  (function() {
 18.4292 -    // Number keys
 18.4293 -    for (var i = 0; i < 10; i++) keyNames[i + 48] = String(i);
 18.4294 -    // Alphabetic keys
 18.4295 -    for (var i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i);
 18.4296 -    // Function keys
 18.4297 -    for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i;
 18.4298 -  })();
 18.4299 -
 18.4300 -  // BIDI HELPERS
 18.4301 -
 18.4302 -  function iterateBidiSections(order, from, to, f) {
 18.4303 -    if (!order) return f(from, to, "ltr");
 18.4304 -    for (var i = 0; i < order.length; ++i) {
 18.4305 -      var part = order[i];
 18.4306 -      if (part.from < to && part.to > from)
 18.4307 -        f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr");
 18.4308 -    }
 18.4309 -  }
 18.4310 -
 18.4311 -  function bidiLeft(part) { return part.level % 2 ? part.to : part.from; }
 18.4312 -  function bidiRight(part) { return part.level % 2 ? part.from : part.to; }
 18.4313 -
 18.4314 -  function lineLeft(line) { var order = getOrder(line); return order ? bidiLeft(order[0]) : 0; }
 18.4315 -  function lineRight(line) {
 18.4316 -    var order = getOrder(line);
 18.4317 -    if (!order) return line.text.length;
 18.4318 -    return bidiRight(lst(order));
 18.4319 -  }
 18.4320 -
 18.4321 -  function lineStart(cm, lineN) {
 18.4322 -    var line = getLine(cm.view.doc, lineN);
 18.4323 -    var visual = visualLine(cm.view.doc, line);
 18.4324 -    if (visual != line) lineN = lineNo(visual);
 18.4325 -    var order = getOrder(visual);