tour: delete the web pages

“A Tour of Go” moved to golang.org/x/website in CL 322790.
The supporting packages stay.

We may also use this repo for some other tours in the future.

Change-Id: Icb60bb9c1e4fe2e9b532108e3aefab24715c7c91
Reviewed-on: https://go-review.googlesource.com/c/tour/+/324309
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/.gcloudignore b/.gcloudignore
deleted file mode 100644
index 0030d4f..0000000
--- a/.gcloudignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.gcloudignore
-.git
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index fc23135..d0485e8 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -17,13 +17,6 @@
 General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker.
 The gophers there will answer or ask you to file an issue if you've tripped over a bug.
 
-## Verifying changes during development
-
-In order to verify changes to the slides or code examples while developing
-locally compile with your local toolchain:
-
-    $ go run golang.org/x/tour
-
 ## Contributing code
 
 Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html)
diff --git a/README.md b/README.md
index a186565..09d3b94 100644
--- a/README.md
+++ b/README.md
@@ -1,65 +1,7 @@
 # Go Tour
 
-[![Go Reference](https://pkg.go.dev/badge/golang.org/x/tour.svg)](https://pkg.go.dev/golang.org/x/tour)
+The actual web pages for
+“A Tour of Go” moved to [golang.org/x/website](https://golang.org/x/website).
 
-A Tour of Go is an introduction to the Go programming language. Visit
-https://tour.golang.org to start the tour.
-
-## Download/Install
-
-To install the tour from source, first
-[install Go](https://golang.org/doc/install) and then run:
-
-	$ go get golang.org/x/tour
-
-This will place a `tour` binary in your
-[workspace](https://golang.org/doc/code.html#Workspaces)'s `bin` directory.
-The tour program can be run offline.
-
-## Contributing
-
-Contributions should follow the same procedure as for the Go project:
-https://golang.org/doc/contribute.html
-
-To run the tour server locally:
-
-```sh
-go run .
-```
-
-Your browser should now open. If not, please visit [http://localhost:3999/](http://localhost:3999).
-
-
-## Report Issues / Send Patches
-
-This repository uses Gerrit for code changes. To learn how to submit changes to
-this repository, see https://golang.org/doc/contribute.html.
-
-The issue tracker for the tour's code is located at https://github.com/golang/go/issues.
-Prefix your issue with "x/tour:" in the subject line, so it is easy to find.
-
-Issues with the tour's content itself should be reported in the issue tracker
-at https://github.com/golang/tour/issues.
-
-## Deploying
-
-1.	To deploy tour.golang.org, run:
-
-	```
-	GO111MODULE=on gcloud --project=golang-org app deploy --no-promote app.yaml
-	```
-
-	This will create a new version, which can be viewed within the
-	[golang-org GCP project](https://console.cloud.google.com/appengine/versions?project=golang-org&serviceId=tour).
-
-2.	Check that the deployed version looks OK (click the version link in GCP).
-
-3.	If all is well, click "Migrate Traffic" to move 100% of the tour.golang.org
-	traffic to the new version.
-
-4.	You're done.
-
-## License
-
-Unless otherwise noted, the go-tour source files are distributed
-under the BSD-style license found in the LICENSE file.
+This repo still holds the supporting packages like
+[golang.org/x/tour/pic](https://golang.org/x/tour/pic).
diff --git a/TODO b/TODO
deleted file mode 100644
index 8eb78bd..0000000
--- a/TODO
+++ /dev/null
@@ -1,104 +0,0 @@
-This file lists topics that already exist (prefixed by *) and topics that
-should be added (prefixed by -). It should be kept up-to-date with tour.article.
-
-* Hello, 世界
-* Go local
-* Packages
-* Imports
-- "Imported but not used" errors (later perhaps)
-* Exported names
-* Functions
-* Functions continued
-* Multiple results
-* Named results
-- Variables (single declaration first)
-* Variables
-* Variables with initializers
-* Short variable declarations
-* Basic types
-* Type inference
-* Type conversions
-* Zero values
-* Constants
-* Numeric Constants
-* For
-* For continued
-* For is Go's "while"
-* Forever
-* If
-* If with a short statement
-* If and else
-* Exercise: Loops and Functions
-* Structs
-* Struct Fields
-* Pointers
-* Struct Literals
-* The new function
-* Arrays
-* Slices
-* Slicing slices
-* Making slices
-* Append
-- Copy
-* Nil slices
-* Range
-* Range continued
-- The blank identifier
-- Slices of slices.
-* Exercise: Slices
-* Maps
-* Map literals
-* Map literals continued
-* Mutating Maps
-- Maps and range
-* Exercise: Maps
-* Function values
-* Function closures
-* Exercise: Fibonacci closure
-* Switch
-* Switch evaluation order
-* Switch with no condition
-- Complex numbers
-* Advanced Exercise: Complex cube roots
-- the type keyword
-* Methods and Interfaces
-* Methods
-* Methods continued
-* Methods with pointer receivers
-* Interfaces
-* Interfaces are satisfied implicitly
-- Interface assignment
-- Empty interface
-* Errors
-* Exercise: Errors
-* Web servers
-* Exercise: HTTP Handlers
-* Images
-* Exercise: Images
-* Exercise: Rot13 Reader
-- Sort (see sort package examples)
-- Exercise: Sort
-- Embedding
-- Exercise: Embedding (sort by different fields)
-- Type assertion
-- Type switch
-- Exercise: Visitor (walk a tree?)
-* Concurrency
-* Goroutines
-* Channels
-* Buffered Channels
-* Range and Close
-* Select
-* Default Selection
-* Exercise: Equivalent Binary Trees
-* Exercise: Equivalent Binary Trees
-* Exercise: Web Crawler
-- More language features
-* Defer
-- Panic and recover
-- init functions
-- Tools
-- Godoc
-- Gofmt
-* Where to Go from here...
-
diff --git a/TRANSLATE b/TRANSLATE
deleted file mode 100644
index fa39dba..0000000
--- a/TRANSLATE
+++ /dev/null
@@ -1,33 +0,0 @@
-Translating the Tour
-
-A Tour of Go is a Go program that runs as a stand-alone web server or
-an App Engine app. The version available at tour.golang.org is run from
-App Engine. There are several localized versions of the tour, such as
-this Chinese translation, also running on App Engine:
-
-	https://go-tour-zh.appspot.com
-
-The Tour contains a slide named "Go local", which lists several of
-these translations. If you are a native speaker of a language not on
-that list and have some experience with Go, please consider providing
-a translation of the Tour in your own language.
-
-To translate the tour:
-
-1. Translate the files in content/
-2. Provide localized version for the UI strings in static/js/values.js
-3. Sign up to App Engine and create an app named go-tour-LL,
-   where LL is the two-letter country code that applies best
-   to your chosen language. (This shouldn't cost you anything;
-   the Tour App usually runs inside App Engine's free quota.)
-4. Deploy your version of the Tour to that app.
-5. Announce to golang-nuts@googlegroups.com
-
-The Tour content changes occasionally, and you should keep your
-translation up to date. To follow the development of the tour,
-you can subscribe to the feed at
-
-	https://github.com/golang/tour/commits/master.atom
-
-Finally, if you have any questions about the Tour or Go,
-please mail golang-nuts@googlegroups.com.
diff --git a/app.yaml b/app.yaml
deleted file mode 100644
index 3af97ec..0000000
--- a/app.yaml
+++ /dev/null
@@ -1,36 +0,0 @@
-service: tour
-runtime: go114
-
-env_variables:
-  TOUR_ANALYTICS: |
-    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-11222381-5"></script>
-    <script>
-    window.dataLayer = window.dataLayer || [];
-    function gtag(){dataLayer.push(arguments);}
-    gtag("js", new Date());
-    gtag("config", "UA-11222381-5");
-    gtag("config", "UA-49880327-6");
-    </script>
-
-default_expiration: "7d"
-
-handlers:
-
-# Keep these static file handlers in sync with local.go.
-# They're here for improved latency across global regions.
-- url: /favicon.ico
-  static_files: static/img/favicon.ico
-  upload: static/img/favicon.ico
-  secure: always
-- url: /content/img
-  static_dir: content/img
-  secure: always
-- url: /static
-  static_dir: static
-  secure: always
-
-# This is here to redirect all HTTP traffic to an HTTPS URL
-# with the same path.
-- url: /.*
-  script: auto
-  secure: always
diff --git a/appengine.go b/appengine.go
deleted file mode 100644
index c6201a3..0000000
--- a/appengine.go
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2011 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package main
-
-import (
-	"bufio"
-	"bytes"
-	"html/template"
-	"io"
-	"log"
-	"net/http"
-	"os"
-
-	_ "golang.org/x/tools/playground"
-)
-
-func gaeMain() {
-	prepContent = gaePrepContent
-	socketAddr = gaeSocketAddr
-	analyticsHTML = template.HTML(os.Getenv("TOUR_ANALYTICS"))
-
-	if err := initTour(".", "HTTPTransport"); err != nil {
-		log.Fatal(err)
-	}
-
-	http.Handle("/", hstsHandler(rootHandler))
-	http.Handle("/lesson/", hstsHandler(lessonHandler))
-
-	registerStatic(".")
-
-	port := os.Getenv("PORT")
-	if port == "" {
-		port = "8080"
-	}
-	log.Fatal(http.ListenAndServe(":"+port, nil))
-}
-
-// gaePrepContent returns a Reader that produces the content from the given
-// Reader, but strips the prefix "#appengine:", optionally followed by a space, from each line.
-// It also drops any non-blank line that follows a series of 1 or more lines with the prefix.
-func gaePrepContent(in io.Reader) io.Reader {
-	var prefix = []byte("#appengine:")
-	out, w := io.Pipe()
-	go func() {
-		r := bufio.NewReader(in)
-		drop := false
-		for {
-			b, err := r.ReadBytes('\n')
-			if err != nil && err != io.EOF {
-				w.CloseWithError(err)
-				return
-			}
-			if bytes.HasPrefix(b, prefix) {
-				b = b[len(prefix):]
-				if b[0] == ' ' {
-					// Consume a single space after the prefix.
-					b = b[1:]
-				}
-				drop = true
-			} else if drop {
-				if len(b) > 1 {
-					b = nil
-				}
-				drop = false
-			}
-			if len(b) > 0 {
-				w.Write(b)
-			}
-			if err == io.EOF {
-				w.Close()
-				return
-			}
-		}
-	}()
-	return out
-}
-
-// gaeSocketAddr returns the WebSocket handler address.
-// The App Engine version does not provide a WebSocket handler.
-func gaeSocketAddr() string { return "" }
-
-// hstsHandler wraps an http.HandlerFunc such that it sets the HSTS header.
-func hstsHandler(fn http.HandlerFunc) http.Handler {
-	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
-		w.Header().Set("Strict-Transport-Security", "max-age=31536000; preload")
-		fn(w, r)
-	})
-}
diff --git a/content/basics.article b/content/basics.article
deleted file mode 100644
index 082a6ab..0000000
--- a/content/basics.article
+++ /dev/null
@@ -1,235 +0,0 @@
-Packages, variables, and functions.
-Learn the basic components of any Go program.
-
-The Go Authors
-https://golang.org
-
-* Packages
-
-Every Go program is made up of packages.
-
-Programs start running in package `main`.
-
-This program is using the packages with import paths `"fmt"` and `"math/rand"`.
-
-By convention, the package name is the same as the last element of the import path. For instance, the `"math/rand"` package comprises files that begin with the statement `package`rand`.
-
-#appengine: *Note:* The environment in which these programs are executed is
-#appengine: deterministic, so each time you run the example program
-#appengine: `rand.Intn` will return the same number.
-#appengine:
-#appengine: (To see a different number, seed the number generator; see [[https://golang.org/pkg/math/rand/#Seed][`rand.Seed`]].
-#appengine: Time is constant in the playground, so you will need to use something else as the seed.)
-
-.play basics/packages.go
-
-* Imports
-
-This code groups the imports into a parenthesized, "factored" import statement.
-
-You can also write multiple import statements, like:
-
-	import "fmt"
-	import "math"
-
-But it is good style to use the factored import statement.
-
-.play basics/imports.go
-
-* Exported names
-
-In Go, a name is exported if it begins with a capital letter.
-For example, `Pizza` is an exported name, as is `Pi`, which is exported from
-the `math` package.
-
-`pizza` and `pi` do not start with a capital letter, so they are not exported.
-
-When importing a package, you can refer only to its exported names.
-Any "unexported" names are not accessible from outside the package.
-
-Run the code. Notice the error message.
-
-To fix the error, rename `math.pi` to `math.Pi` and try it again.
-
-.play basics/exported-names.go
-
-* Functions
-
-A function can take zero or more arguments.
-
-In this example, `add` takes two parameters of type `int`.
-
-Notice that the type comes _after_ the variable name.
-
-(For more about why types look the way they do, see the [[https://blog.golang.org/gos-declaration-syntax][article on Go's declaration syntax]].)
-
-.play basics/functions.go
-
-* Functions continued
-
-When two or more consecutive named function parameters share a type, you can omit the type from all but the last.
-
-In this example, we shortened
-
-	x int, y int
-
-to
-
-	x, y int
-
-.play basics/functions-continued.go
-
-* Multiple results
-
-A function can return any number of results.
-
-The `swap` function returns two strings.
-
-.play basics/multiple-results.go
-
-* Named return values
-
-Go's return values may be named. If so, they are treated as variables defined at the top of the function.
-
-These names should be used to document the meaning of the return values.
-
-A `return` statement without arguments returns the named return values. This is known as a "naked" return.
-
-Naked return statements should be used only in short functions, as with the example shown here. They can harm readability in longer functions.
-
-.play basics/named-results.go
-
-* Variables
-
-The `var` statement declares a list of variables; as in function argument lists, the type is last.
-
-A `var` statement can be at package or function level. We see both in this example.
-
-.play basics/variables.go
-
-* Variables with initializers
-
-A var declaration can include initializers, one per variable.
-
-If an initializer is present, the type can be omitted; the variable will take the type of the initializer.
-
-.play basics/variables-with-initializers.go
-
-* Short variable declarations
-
-Inside a function, the `:=` short assignment statement can be used in place of a `var` declaration with implicit type.
-
-Outside a function, every statement begins with a keyword (`var`, `func`, and so on) and so the `:=` construct is not available.
-
-.play basics/short-variable-declarations.go
-
-* Basic types
-
-Go's basic types are
-
-	bool
-
-	string
-
-	int  int8  int16  int32  int64
-	uint uint8 uint16 uint32 uint64 uintptr
-
-	byte // alias for uint8
-
-	rune // alias for int32
-	     // represents a Unicode code point
-
-	float32 float64
-
-	complex64 complex128
-
-The example shows variables of several types,
-and also that variable declarations may be "factored" into blocks,
-as with import statements.
-
-The `int`, `uint`, and `uintptr` types are usually 32 bits wide on 32-bit systems and 64 bits wide on 64-bit systems.
-When you need an integer value you should use `int` unless you have a specific reason to use a sized or unsigned integer type.
-
-.play basics/basic-types.go
-
-* Zero values
-
-Variables declared without an explicit initial value are given their
-_zero_value_.
-
-The zero value is:
-
-- `0` for numeric types,
-- `false` for the boolean type, and
-- `""` (the empty string) for strings.
-
-.play basics/zero.go
-
-* Type conversions
-
-The expression `T(v)` converts the value `v` to the type `T`.
-
-Some numeric conversions:
-
-	var i int = 42
-	var f float64 = float64(i)
-	var u uint = uint(f)
-
-Or, put more simply:
-
-	i := 42
-	f := float64(i)
-	u := uint(f)
-
-Unlike in C, in Go assignment between items of different type requires an
-explicit conversion.
-Try removing the `float64` or `uint` conversions in the example and see what happens.
-
-.play basics/type-conversions.go
-
-* Type inference
-
-When declaring a variable without specifying an explicit type (either by using the `:=` syntax or `var`=` expression syntax), the variable's type is inferred from the value on the right hand side.
-
-When the right hand side of the declaration is typed, the new variable is of that same type:
-
-	var i int
-	j := i // j is an int
-
-But when the right hand side contains an untyped numeric constant, the new variable may be an `int`, `float64`, or `complex128` depending on the precision of the constant:
-
-	i := 42           // int
-	f := 3.142        // float64
-	g := 0.867 + 0.5i // complex128
-
-Try changing the initial value of `v` in the example code and observe how its type is affected.
-
-.play basics/type-inference.go
-
-* Constants
-
-Constants are declared like variables, but with the `const` keyword.
-
-Constants can be character, string, boolean, or numeric values.
-
-Constants cannot be declared using the `:=` syntax.
-
-.play basics/constants.go
-
-* Numeric Constants
-
-Numeric constants are high-precision _values_.
-
-An untyped constant takes the type needed by its context.
-
-Try printing `needInt(Big)` too.
-
-(An `int` can store at maximum a 64-bit integer, and sometimes less.)
-
-.play basics/numeric-constants.go
-
-* Congratulations!
-
-You finished this lesson!
-
-You can go back to the list of [[/list][modules]] to find what to learn next, or continue with the [[javascript:click('.next-page')][next lesson]].
diff --git a/content/basics/basic-types.go b/content/basics/basic-types.go
deleted file mode 100644
index 99becee..0000000
--- a/content/basics/basic-types.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math/cmplx"
-)
-
-var (
-	ToBe   bool       = false
-	MaxInt uint64     = 1<<64 - 1
-	z      complex128 = cmplx.Sqrt(-5 + 12i)
-)
-
-func main() {
-	fmt.Printf("Type: %T Value: %v\n", ToBe, ToBe)
-	fmt.Printf("Type: %T Value: %v\n", MaxInt, MaxInt)
-	fmt.Printf("Type: %T Value: %v\n", z, z)
-}
diff --git a/content/basics/constants.go b/content/basics/constants.go
deleted file mode 100644
index 21eb716..0000000
--- a/content/basics/constants.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-const Pi = 3.14
-
-func main() {
-	const World = "世界"
-	fmt.Println("Hello", World)
-	fmt.Println("Happy", Pi, "Day")
-
-	const Truth = true
-	fmt.Println("Go rules?", Truth)
-}
diff --git a/content/basics/exported-names.go b/content/basics/exported-names.go
deleted file mode 100644
index 1eec5cb..0000000
--- a/content/basics/exported-names.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build no-build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-func main() {
-	fmt.Println(math.pi)
-}
diff --git a/content/basics/functions-continued.go b/content/basics/functions-continued.go
deleted file mode 100644
index 432d47f..0000000
--- a/content/basics/functions-continued.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func add(x, y int) int {
-	return x + y
-}
-
-func main() {
-	fmt.Println(add(42, 13))
-}
diff --git a/content/basics/functions.go b/content/basics/functions.go
deleted file mode 100644
index 5b71184..0000000
--- a/content/basics/functions.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func add(x int, y int) int {
-	return x + y
-}
-
-func main() {
-	fmt.Println(add(42, 13))
-}
diff --git a/content/basics/imports.go b/content/basics/imports.go
deleted file mode 100644
index 8424aca..0000000
--- a/content/basics/imports.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-func main() {
-	fmt.Printf("Now you have %g problems.\n", math.Sqrt(7))
-}
diff --git a/content/basics/multiple-results.go b/content/basics/multiple-results.go
deleted file mode 100644
index 1b86fd7..0000000
--- a/content/basics/multiple-results.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func swap(x, y string) (string, string) {
-	return y, x
-}
-
-func main() {
-	a, b := swap("hello", "world")
-	fmt.Println(a, b)
-}
diff --git a/content/basics/named-results.go b/content/basics/named-results.go
deleted file mode 100644
index 0047872..0000000
--- a/content/basics/named-results.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func split(sum int) (x, y int) {
-	x = sum * 4 / 9
-	y = sum - x
-	return
-}
-
-func main() {
-	fmt.Println(split(17))
-}
diff --git a/content/basics/numeric-constants.go b/content/basics/numeric-constants.go
deleted file mode 100644
index 59784b5..0000000
--- a/content/basics/numeric-constants.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-const (
-	// Create a huge number by shifting a 1 bit left 100 places.
-	// In other words, the binary number that is 1 followed by 100 zeroes.
-	Big = 1 << 100
-	// Shift it right again 99 places, so we end up with 1<<1, or 2.
-	Small = Big >> 99
-)
-
-func needInt(x int) int { return x*10 + 1 }
-func needFloat(x float64) float64 {
-	return x * 0.1
-}
-
-func main() {
-	fmt.Println(needInt(Small))
-	fmt.Println(needFloat(Small))
-	fmt.Println(needFloat(Big))
-}
diff --git a/content/basics/packages.go b/content/basics/packages.go
deleted file mode 100644
index 8b5ddac..0000000
--- a/content/basics/packages.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math/rand"
-)
-
-func main() {
-	fmt.Println("My favorite number is", rand.Intn(10))
-}
diff --git a/content/basics/short-variable-declarations.go b/content/basics/short-variable-declarations.go
deleted file mode 100644
index c6edd9f..0000000
--- a/content/basics/short-variable-declarations.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	var i, j int = 1, 2
-	k := 3
-	c, python, java := true, false, "no!"
-
-	fmt.Println(i, j, k, c, python, java)
-}
diff --git a/content/basics/type-conversions.go b/content/basics/type-conversions.go
deleted file mode 100644
index 0ce3537..0000000
--- a/content/basics/type-conversions.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-func main() {
-	var x, y int = 3, 4
-	var f float64 = math.Sqrt(float64(x*x + y*y))
-	var z uint = uint(f)
-	fmt.Println(x, y, z)
-}
diff --git a/content/basics/type-inference.go b/content/basics/type-inference.go
deleted file mode 100644
index b311933..0000000
--- a/content/basics/type-inference.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	v := 42 // change me!
-	fmt.Printf("v is of type %T\n", v)
-}
diff --git a/content/basics/variables-with-initializers.go b/content/basics/variables-with-initializers.go
deleted file mode 100644
index d27f855..0000000
--- a/content/basics/variables-with-initializers.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-var i, j int = 1, 2
-
-func main() {
-	var c, python, java = true, false, "no!"
-	fmt.Println(i, j, c, python, java)
-}
diff --git a/content/basics/variables.go b/content/basics/variables.go
deleted file mode 100644
index cd4c26a..0000000
--- a/content/basics/variables.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-var c, python, java bool
-
-func main() {
-	var i int
-	fmt.Println(i, c, python, java)
-}
diff --git a/content/basics/zero.go b/content/basics/zero.go
deleted file mode 100644
index eb95a07..0000000
--- a/content/basics/zero.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	var i int
-	var f float64
-	var b bool
-	var s string
-	fmt.Printf("%v %v %v %q\n", i, f, b, s)
-}
diff --git a/content/concurrency.article b/content/concurrency.article
deleted file mode 100644
index 9cb5f69..0000000
--- a/content/concurrency.article
+++ /dev/null
@@ -1,208 +0,0 @@
-Concurrency
-Go provides concurrency constructions as part of the core language. This lesson presents them and gives some examples on how they can be used.
-
-The Go Authors
-https://golang.org
-
-* Goroutines
-
-A _goroutine_ is a lightweight thread managed by the Go runtime.
-
-	go f(x, y, z)
-
-starts a new goroutine running
-
-	f(x, y, z)
-
-The evaluation of `f`, `x`, `y`, and `z` happens in the current goroutine and the execution of `f` happens in the new goroutine.
-
-Goroutines run in the same address space, so access to shared memory must be synchronized. The [[https://golang.org/pkg/sync/][`sync`]] package provides useful primitives, although you won't need them much in Go as there are other primitives. (See the next slide.)
-
-.play concurrency/goroutines.go
-
-* Channels
-
-Channels are a typed conduit through which you can send and receive values with the channel operator, `<-`.
-
-	ch <- v    // Send v to channel ch.
-	v := <-ch  // Receive from ch, and
-	           // assign value to v.
-
-(The data flows in the direction of the arrow.)
-
-Like maps and slices, channels must be created before use:
-
-	ch := make(chan int)
-
-By default, sends and receives block until the other side is ready. This allows goroutines to synchronize without explicit locks or condition variables.
-
-The example code sums the numbers in a slice, distributing the work between two goroutines.
-Once both goroutines have completed their computation, it calculates the final result.
-
-.play concurrency/channels.go
-
-* Buffered Channels
-
-Channels can be _buffered_.  Provide the buffer length as the second argument to `make` to initialize a buffered channel:
-
-	ch := make(chan int, 100)
-
-Sends to a buffered channel block only when the buffer is full. Receives block when the buffer is empty.
-
-Modify the example to overfill the buffer and see what happens.
-
-.play concurrency/buffered-channels.go
-
-* Range and Close
-
-A sender can `close` a channel to indicate that no more values will be sent. Receivers can test whether a channel has been closed by assigning a second parameter to the receive expression: after
-
-	v, ok := <-ch
-
-`ok` is `false` if there are no more values to receive and the channel is closed.
-
-The loop `for`i`:=`range`c` receives values from the channel repeatedly until it is closed.
-
-*Note:* Only the sender should close a channel, never the receiver. Sending on a closed channel will cause a panic.
-
-*Another*note:* Channels aren't like files; you don't usually need to close them. Closing is only necessary when the receiver must be told there are no more values coming, such as to terminate a `range` loop.
-
-.play concurrency/range-and-close.go
-
-* Select
-
-The `select` statement lets a goroutine wait on multiple communication operations.
-
-A `select` blocks until one of its cases can run, then it executes that case.  It chooses one at random if multiple are ready.
-
-.play concurrency/select.go
-
-* Default Selection
-
-The `default` case in a `select` is run if no other case is ready.
-
-Use a `default` case to try a send or receive without blocking:
-
-	select {
-	case i := <-c:
-		// use i
-	default:
-		// receiving from c would block
-	}
-
-.play concurrency/default-selection.go
-
-* Exercise: Equivalent Binary Trees
-
-There can be many different binary trees with the same sequence of values stored in it. For example, here are two binary trees storing the sequence 1, 1, 2, 3, 5, 8, 13.
-
-.image /content/img/tree.png
-
-A function to check whether two binary trees store the same sequence is quite complex in most languages. We'll use Go's concurrency and channels to write a simple solution.
-
-This example uses the `tree` package, which defines the type:
-
-	type Tree struct {
-		Left  *Tree
-		Value int
-		Right *Tree
-	}
-
-
-Continue description on [[javascript:click('.next-page')][next page]].
-
-* Exercise: Equivalent Binary Trees
-
-*1.* Implement the `Walk` function.
-
-*2.* Test the `Walk` function.
-
-The function `tree.New(k)` constructs a randomly-structured (but always sorted) binary tree holding the values `k`, `2k`, `3k`, ..., `10k`.
-
-Create a new channel `ch` and kick off the walker:
-
-	go Walk(tree.New(1), ch)
-
-Then read and print 10 values from the channel. It should be the numbers 1, 2, 3, ..., 10.
-
-*3.* Implement the `Same` function using `Walk` to determine whether `t1` and `t2` store the same values.
-
-*4.* Test the `Same` function.
-
-`Same(tree.New(1),`tree.New(1))` should return true, and `Same(tree.New(1),`tree.New(2))` should return false.
-
-The documentation for `Tree` can be found [[https://godoc.org/golang.org/x/tour/tree#Tree][here]].
-
-.play concurrency/exercise-equivalent-binary-trees.go
-
-* sync.Mutex
-
-We've seen how channels are great for communication among goroutines.
-
-But what if we don't need communication? What if we just want to make sure only
-one goroutine can access a variable at a time to avoid conflicts?
-
-This concept is called _mutual_exclusion_, and the conventional name for the data structure that provides it is _mutex_.
-
-Go's standard library provides mutual exclusion with
-[[https://golang.org/pkg/sync/#Mutex][`sync.Mutex`]] and its two methods:
-
-- `Lock`
-- `Unlock`
-
-We can define a block of code to be executed in mutual exclusion by surrounding it
-with a call to `Lock` and `Unlock` as shown on the `Inc` method.
-
-We can also use `defer` to ensure the mutex will be unlocked as in the `Value` method.
-
-.play concurrency/mutex-counter.go
-
-* Exercise: Web Crawler
-
-In this exercise you'll use Go's concurrency features to parallelize a web crawler.
-
-Modify the `Crawl` function to fetch URLs in parallel without fetching the same URL twice.
-
-_Hint_: you can keep a cache of the URLs that have been fetched on a map, but maps alone are not
-safe for concurrent use!
-
-.play concurrency/exercise-web-crawler.go
-
-* Where to Go from here...
-
-#appengine: You can get started by
-#appengine: [[https://golang.org/dl/][installing Go]].
-
-#appengine: Once you have Go installed, the
-The
-[[https://golang.org/doc/][Go Documentation]] is a great place to
-#appengine: continue.
-start.
-It contains references, tutorials, videos, and more.
-
-To learn how to organize and work with Go code, read [[https://golang.org/doc/code][How to Write Go Code]].
-
-If you need help with the standard library, see the [[https://golang.org/pkg/][package reference]]. For help with the language itself, you might be surprised to find the [[https://golang.org/ref/spec][Language Spec]] is quite readable.
-
-To further explore Go's concurrency model, watch
-[[https://www.youtube.com/watch?v=f6kdp27TYZs][Go Concurrency Patterns]]
-([[https://talks.golang.org/2012/concurrency.slide][slides]])
-and
-[[https://www.youtube.com/watch?v=QDDwwePbDtw][Advanced Go Concurrency Patterns]]
-([[https://talks.golang.org/2013/advconc.slide][slides]])
-and read the
-[[https://golang.org/doc/codewalk/sharemem/][Share Memory by Communicating]]
-codewalk.
-
-To get started writing web applications, watch
-[[https://vimeo.com/53221558][A simple programming environment]]
-([[https://talks.golang.org/2012/simple.slide][slides]])
-and read the
-[[https://golang.org/doc/articles/wiki/][Writing Web Applications]] tutorial.
-
-The [[https://golang.org/doc/codewalk/functions/][First Class Functions in Go]] codewalk gives an interesting perspective on Go's function types.
-
-The [[https://blog.golang.org/][Go Blog]] has a large archive of informative Go articles.
-
-Visit [[https://golang.org][golang.org]] for more.
-
diff --git a/content/concurrency/buffered-channels.go b/content/concurrency/buffered-channels.go
deleted file mode 100644
index b5abf10..0000000
--- a/content/concurrency/buffered-channels.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	ch := make(chan int, 2)
-	ch <- 1
-	ch <- 2
-	fmt.Println(<-ch)
-	fmt.Println(<-ch)
-}
diff --git a/content/concurrency/channels.go b/content/concurrency/channels.go
deleted file mode 100644
index 60fc324..0000000
--- a/content/concurrency/channels.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func sum(s []int, c chan int) {
-	sum := 0
-	for _, v := range s {
-		sum += v
-	}
-	c <- sum // send sum to c
-}
-
-func main() {
-	s := []int{7, 2, 8, -9, 4, 0}
-
-	c := make(chan int)
-	go sum(s[:len(s)/2], c)
-	go sum(s[len(s)/2:], c)
-	x, y := <-c, <-c // receive from c
-
-	fmt.Println(x, y, x+y)
-}
diff --git a/content/concurrency/default-selection.go b/content/concurrency/default-selection.go
deleted file mode 100644
index 8e0d2a5..0000000
--- a/content/concurrency/default-selection.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"time"
-)
-
-func main() {
-	tick := time.Tick(100 * time.Millisecond)
-	boom := time.After(500 * time.Millisecond)
-	for {
-		select {
-		case <-tick:
-			fmt.Println("tick.")
-		case <-boom:
-			fmt.Println("BOOM!")
-			return
-		default:
-			fmt.Println("    .")
-			time.Sleep(50 * time.Millisecond)
-		}
-	}
-}
diff --git a/content/concurrency/exercise-equivalent-binary-trees.go b/content/concurrency/exercise-equivalent-binary-trees.go
deleted file mode 100644
index 56d98a7..0000000
--- a/content/concurrency/exercise-equivalent-binary-trees.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// +build no-build OMIT
-
-package main
-
-import "golang.org/x/tour/tree"
-
-// Walk walks the tree t sending all values
-// from the tree to the channel ch.
-func Walk(t *tree.Tree, ch chan int)
-
-// Same determines whether the trees
-// t1 and t2 contain the same values.
-func Same(t1, t2 *tree.Tree) bool
-
-func main() {
-}
diff --git a/content/concurrency/exercise-web-crawler.go b/content/concurrency/exercise-web-crawler.go
deleted file mode 100644
index c426e05..0000000
--- a/content/concurrency/exercise-web-crawler.go
+++ /dev/null
@@ -1,87 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-)
-
-type Fetcher interface {
-	// Fetch returns the body of URL and
-	// a slice of URLs found on that page.
-	Fetch(url string) (body string, urls []string, err error)
-}
-
-// Crawl uses fetcher to recursively crawl
-// pages starting with url, to a maximum of depth.
-func Crawl(url string, depth int, fetcher Fetcher) {
-	// TODO: Fetch URLs in parallel.
-	// TODO: Don't fetch the same URL twice.
-	// This implementation doesn't do either:
-	if depth <= 0 {
-		return
-	}
-	body, urls, err := fetcher.Fetch(url)
-	if err != nil {
-		fmt.Println(err)
-		return
-	}
-	fmt.Printf("found: %s %q\n", url, body)
-	for _, u := range urls {
-		Crawl(u, depth-1, fetcher)
-	}
-	return
-}
-
-func main() {
-	Crawl("https://golang.org/", 4, fetcher)
-}
-
-// fakeFetcher is Fetcher that returns canned results.
-type fakeFetcher map[string]*fakeResult
-
-type fakeResult struct {
-	body string
-	urls []string
-}
-
-func (f fakeFetcher) Fetch(url string) (string, []string, error) {
-	if res, ok := f[url]; ok {
-		return res.body, res.urls, nil
-	}
-	return "", nil, fmt.Errorf("not found: %s", url)
-}
-
-// fetcher is a populated fakeFetcher.
-var fetcher = fakeFetcher{
-	"https://golang.org/": &fakeResult{
-		"The Go Programming Language",
-		[]string{
-			"https://golang.org/pkg/",
-			"https://golang.org/cmd/",
-		},
-	},
-	"https://golang.org/pkg/": &fakeResult{
-		"Packages",
-		[]string{
-			"https://golang.org/",
-			"https://golang.org/cmd/",
-			"https://golang.org/pkg/fmt/",
-			"https://golang.org/pkg/os/",
-		},
-	},
-	"https://golang.org/pkg/fmt/": &fakeResult{
-		"Package fmt",
-		[]string{
-			"https://golang.org/",
-			"https://golang.org/pkg/",
-		},
-	},
-	"https://golang.org/pkg/os/": &fakeResult{
-		"Package os",
-		[]string{
-			"https://golang.org/",
-			"https://golang.org/pkg/",
-		},
-	},
-}
diff --git a/content/concurrency/goroutines.go b/content/concurrency/goroutines.go
deleted file mode 100644
index 9efc833..0000000
--- a/content/concurrency/goroutines.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"time"
-)
-
-func say(s string) {
-	for i := 0; i < 5; i++ {
-		time.Sleep(100 * time.Millisecond)
-		fmt.Println(s)
-	}
-}
-
-func main() {
-	go say("world")
-	say("hello")
-}
diff --git a/content/concurrency/mutex-counter.go b/content/concurrency/mutex-counter.go
deleted file mode 100644
index b1483d6..0000000
--- a/content/concurrency/mutex-counter.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"sync"
-	"time"
-)
-
-// SafeCounter is safe to use concurrently.
-type SafeCounter struct {
-	mu sync.Mutex
-	v  map[string]int
-}
-
-// Inc increments the counter for the given key.
-func (c *SafeCounter) Inc(key string) {
-	c.mu.Lock()
-	// Lock so only one goroutine at a time can access the map c.v.
-	c.v[key]++
-	c.mu.Unlock()
-}
-
-// Value returns the current value of the counter for the given key.
-func (c *SafeCounter) Value(key string) int {
-	c.mu.Lock()
-	// Lock so only one goroutine at a time can access the map c.v.
-	defer c.mu.Unlock()
-	return c.v[key]
-}
-
-func main() {
-	c := SafeCounter{v: make(map[string]int)}
-	for i := 0; i < 1000; i++ {
-		go c.Inc("somekey")
-	}
-
-	time.Sleep(time.Second)
-	fmt.Println(c.Value("somekey"))
-}
diff --git a/content/concurrency/range-and-close.go b/content/concurrency/range-and-close.go
deleted file mode 100644
index 6e5a3b8..0000000
--- a/content/concurrency/range-and-close.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-)
-
-func fibonacci(n int, c chan int) {
-	x, y := 0, 1
-	for i := 0; i < n; i++ {
-		c <- x
-		x, y = y, x+y
-	}
-	close(c)
-}
-
-func main() {
-	c := make(chan int, 10)
-	go fibonacci(cap(c), c)
-	for i := range c {
-		fmt.Println(i)
-	}
-}
diff --git a/content/concurrency/select.go b/content/concurrency/select.go
deleted file mode 100644
index d657f01..0000000
--- a/content/concurrency/select.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func fibonacci(c, quit chan int) {
-	x, y := 0, 1
-	for {
-		select {
-		case c <- x:
-			x, y = y, x+y
-		case <-quit:
-			fmt.Println("quit")
-			return
-		}
-	}
-}
-
-func main() {
-	c := make(chan int)
-	quit := make(chan int)
-	go func() {
-		for i := 0; i < 10; i++ {
-			fmt.Println(<-c)
-		}
-		quit <- 0
-	}()
-	fibonacci(c, quit)
-}
diff --git a/content/content_test.go b/content/content_test.go
deleted file mode 100644
index 4c0ff2a..0000000
--- a/content/content_test.go
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2016 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package content
-
-import (
-	"bytes"
-	"errors"
-	"fmt"
-	"io/ioutil"
-	"os"
-	"os/exec"
-	"path/filepath"
-	"strings"
-	"testing"
-)
-
-// Test that all the .go files inside the content file build
-// and execute (without checking for output correctness).
-// Files that contain the string "// +build no-build" are not built.
-// Files that contain the string "// +build no-run" are not executed.
-func TestContent(t *testing.T) {
-	if _, err := exec.LookPath("go"); err != nil {
-		t.Skipf("skipping because 'go' executable not available: %v", err)
-	}
-
-	scratch, err := ioutil.TempDir("", "tour-content-test")
-	if err != nil {
-		t.Fatal(err)
-	}
-	defer os.RemoveAll(scratch)
-
-	err = filepath.Walk(".", func(path string, fi os.FileInfo, err error) error {
-		if filepath.Ext(path) != ".go" {
-			return nil
-		}
-		if filepath.Base(path) == "content_test.go" {
-			return nil
-		}
-		if err := testSnippet(t, path, scratch); err != nil {
-			t.Errorf("%v: %v", path, err)
-		}
-		return nil
-	})
-	if err != nil {
-		t.Error(err)
-	}
-}
-
-func testSnippet(t *testing.T, path, scratch string) error {
-	b, err := ioutil.ReadFile(path)
-	if err != nil {
-		return err
-	}
-
-	build := string(bytes.SplitN(b, []byte{'\n'}, 2)[0])
-	if !strings.HasPrefix(build, "// +build ") {
-		return errors.New("first line is not a +build comment")
-	}
-	if !strings.Contains(build, "OMIT") {
-		return errors.New(`+build comment does not contain "OMIT"`)
-	}
-
-	if strings.Contains(build, "no-build") {
-		return nil
-	}
-	bin := filepath.Join(scratch, filepath.Base(path)+".exe")
-	out, err := exec.Command("go", "build", "-o", bin, path).CombinedOutput()
-	if err != nil {
-		return fmt.Errorf("build error: %v\noutput:\n%s", err, out)
-	}
-	defer os.Remove(bin)
-
-	if strings.Contains(build, "no-run") {
-		return nil
-	}
-	out, err = exec.Command(bin).CombinedOutput()
-	if err != nil {
-		return fmt.Errorf("%v\nOutput:\n%s", err, out)
-	}
-	return nil
-}
diff --git a/content/flowcontrol.article b/content/flowcontrol.article
deleted file mode 100644
index 0f25ab4..0000000
--- a/content/flowcontrol.article
+++ /dev/null
@@ -1,178 +0,0 @@
-Flow control statements: for, if, else, switch and defer
-Learn how to control the flow of your code with conditionals, loops, switches and defers.
-
-The Go Authors
-https://golang.org
-
-* For
-
-Go has only one looping construct, the `for` loop.
-
-The basic `for` loop has three components separated by semicolons:
-
-- the init statement: executed before the first iteration
-- the condition expression: evaluated before every iteration
-- the post statement: executed at the end of every iteration
-
-The init statement will often be a short variable declaration, and the
-variables declared there are visible only in the scope of the `for`
-statement.
-
-The loop will stop iterating once the boolean condition evaluates to `false`.
-
-*Note:* Unlike other languages like C, Java, or JavaScript there are no parentheses
-surrounding the three components of the `for` statement and the braces `{`}` are
-always required.
-
-.play flowcontrol/for.go
-
-* For continued
-
-The init and post statements are optional.
-
-.play flowcontrol/for-continued.go
-
-* For is Go's "while"
-
-At that point you can drop the semicolons: C's `while` is spelled `for` in Go.
-
-.play flowcontrol/for-is-gos-while.go
-
-* Forever
-
-If you omit the loop condition it loops forever, so an infinite loop is compactly expressed.
-
-.play flowcontrol/forever.go
-
-* If
-
-Go's `if` statements are like its `for` loops; the expression need not be
-surrounded by parentheses `(`)` but the braces `{`}` are required.
-
-.play flowcontrol/if.go
-
-* If with a short statement
-
-Like `for`, the `if` statement can start with a short statement to execute before the condition.
-
-Variables declared by the statement are only in scope until the end of the `if`.
-
-(Try using `v` in the last `return` statement.)
-
-.play flowcontrol/if-with-a-short-statement.go
-
-* If and else
-
-Variables declared inside an `if` short statement are also available inside any
-of the `else` blocks.
-
-(Both calls to `pow` return their results before the call to `fmt.Println`
-in `main` begins.)
-
-.play flowcontrol/if-and-else.go
-
-* Exercise: Loops and Functions
-
-As a way to play with functions and loops, let's implement a square root function: given a number x, we want to find the number z for which z² is most nearly x.
-
-Computers typically compute the square root of x using a loop.
-Starting with some guess z, we can adjust z based on how close z² is to x,
-producing a better guess:
-
-	z -= (z*z - x) / (2*z)
-
-Repeating this adjustment makes the guess better and better
-until we reach an answer that is as close to the actual square root as can be.
-
-Implement this in the `func`Sqrt` provided.
-A decent starting guess for z is 1, no matter what the input.
-To begin with, repeat the calculation 10 times and print each z along the way.
-See how close you get to the answer for various values of x (1, 2, 3, ...)
-and how quickly the guess improves.
-
-Hint: To declare and initialize a floating point value,
-give it floating point syntax or use a conversion:
-
-	z := 1.0
-	z := float64(1)
-
-Next, change the loop condition to stop once the value has stopped
-changing (or only changes by a very small amount).
-See if that's more or fewer than 10 iterations.
-Try other initial guesses for z, like x, or x/2.
-How close are your function's results to the [[https://golang.org/pkg/math/#Sqrt][math.Sqrt]] in the standard library?
-
-(*Note:* If you are interested in the details of the algorithm, the z² − x above
-is how far away z² is from where it needs to be (x), and the division by 2z is the derivative
-of z², to scale how much we adjust z by how quickly z² is changing.
-This general approach is called [[https://en.wikipedia.org/wiki/Newton%27s_method][Newton's method]].
-It works well for many functions but especially well for square root.)
-
-.play flowcontrol/exercise-loops-and-functions.go
-
-* Switch
-
-A `switch` statement is a shorter way to write a sequence of `if`-`else` statements.
-It runs the first case whose value is equal to the condition expression.
-
-Go's switch is like the one in C, C++, Java, JavaScript, and PHP,
-except that Go only runs the selected case, not all the cases that follow.
-In effect, the `break` statement that is needed at the end of each case in those
-languages is provided automatically in Go.
-Another important difference is that Go's switch cases need not
-be constants, and the values involved need not be integers.
-
-.play flowcontrol/switch.go
-
-* Switch evaluation order
-
-Switch cases evaluate cases from top to bottom, stopping when a case succeeds.
-
-(For example,
-
-	switch i {
-	case 0:
-	case f():
-	}
-
-does not call `f` if `i==0`.)
-
-#appengine: *Note:* Time in the Go playground always appears to start at
-#appengine: 2009-11-10 23:00:00 UTC, a value whose significance is left as an
-#appengine: exercise for the reader.
-
-.play flowcontrol/switch-evaluation-order.go
-
-* Switch with no condition
-
-Switch without a condition is the same as `switch`true`.
-
-This construct can be a clean way to write long if-then-else chains.
-
-.play flowcontrol/switch-with-no-condition.go
-
-* Defer
-
-A defer statement defers the execution of a function until the surrounding
-function returns.
-
-The deferred call's arguments are evaluated immediately, but the function call
-is not executed until the surrounding function returns.
-
-.play flowcontrol/defer.go
-
-* Stacking defers
-
-Deferred function calls are pushed onto a stack. When a function returns, its
-deferred calls are executed in last-in-first-out order.
-
-To learn more about defer statements read this
-[[https://blog.golang.org/defer-panic-and-recover][blog post]].
-
-.play flowcontrol/defer-multi.go
-
-* Congratulations!
-
-You finished this lesson!
-
-You can go back to the list of [[/list][modules]] to find what to learn next, or continue with the [[javascript:click('.next-page')][next lesson]].
diff --git a/content/flowcontrol/defer-multi.go b/content/flowcontrol/defer-multi.go
deleted file mode 100644
index 82419d5..0000000
--- a/content/flowcontrol/defer-multi.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	fmt.Println("counting")
-
-	for i := 0; i < 10; i++ {
-		defer fmt.Println(i)
-	}
-
-	fmt.Println("done")
-}
diff --git a/content/flowcontrol/defer.go b/content/flowcontrol/defer.go
deleted file mode 100644
index 3314c05..0000000
--- a/content/flowcontrol/defer.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	defer fmt.Println("world")
-
-	fmt.Println("hello")
-}
diff --git a/content/flowcontrol/exercise-loops-and-functions.go b/content/flowcontrol/exercise-loops-and-functions.go
deleted file mode 100644
index 68c334d..0000000
--- a/content/flowcontrol/exercise-loops-and-functions.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// +build no-build OMIT
-
-package main
-
-import (
-	"fmt"
-)
-
-func Sqrt(x float64) float64 {
-}
-
-func main() {
-	fmt.Println(Sqrt(2))
-}
diff --git a/content/flowcontrol/for-continued.go b/content/flowcontrol/for-continued.go
deleted file mode 100644
index 71c9686..0000000
--- a/content/flowcontrol/for-continued.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	sum := 1
-	for ; sum < 1000; {
-		sum += sum
-	}
-	fmt.Println(sum)
-}
diff --git a/content/flowcontrol/for-is-gos-while.go b/content/flowcontrol/for-is-gos-while.go
deleted file mode 100644
index 5f6fce4..0000000
--- a/content/flowcontrol/for-is-gos-while.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	sum := 1
-	for sum < 1000 {
-		sum += sum
-	}
-	fmt.Println(sum)
-}
diff --git a/content/flowcontrol/for.go b/content/flowcontrol/for.go
deleted file mode 100644
index 0bf8713..0000000
--- a/content/flowcontrol/for.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	sum := 0
-	for i := 0; i < 10; i++ {
-		sum += i
-	}
-	fmt.Println(sum)
-}
diff --git a/content/flowcontrol/forever.go b/content/flowcontrol/forever.go
deleted file mode 100644
index d3a9c9d..0000000
--- a/content/flowcontrol/forever.go
+++ /dev/null
@@ -1,8 +0,0 @@
-// +build no-run OMIT
-
-package main
-
-func main() {
-	for {
-	}
-}
diff --git a/content/flowcontrol/if-and-else.go b/content/flowcontrol/if-and-else.go
deleted file mode 100644
index 32f92a9..0000000
--- a/content/flowcontrol/if-and-else.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-func pow(x, n, lim float64) float64 {
-	if v := math.Pow(x, n); v < lim {
-		return v
-	} else {
-		fmt.Printf("%g >= %g\n", v, lim)
-	}
-	// can't use v here, though
-	return lim
-}
-
-func main() {
-	fmt.Println(
-		pow(3, 2, 10),
-		pow(3, 3, 20),
-	)
-}
diff --git a/content/flowcontrol/if-with-a-short-statement.go b/content/flowcontrol/if-with-a-short-statement.go
deleted file mode 100644
index 30a0cbf..0000000
--- a/content/flowcontrol/if-with-a-short-statement.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-func pow(x, n, lim float64) float64 {
-	if v := math.Pow(x, n); v < lim {
-		return v
-	}
-	return lim
-}
-
-func main() {
-	fmt.Println(
-		pow(3, 2, 10),
-		pow(3, 3, 20),
-	)
-}
diff --git a/content/flowcontrol/if.go b/content/flowcontrol/if.go
deleted file mode 100644
index 1d6d841..0000000
--- a/content/flowcontrol/if.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-func sqrt(x float64) string {
-	if x < 0 {
-		return sqrt(-x) + "i"
-	}
-	return fmt.Sprint(math.Sqrt(x))
-}
-
-func main() {
-	fmt.Println(sqrt(2), sqrt(-4))
-}
diff --git a/content/flowcontrol/switch-evaluation-order.go b/content/flowcontrol/switch-evaluation-order.go
deleted file mode 100644
index 71eb3c3..0000000
--- a/content/flowcontrol/switch-evaluation-order.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"time"
-)
-
-func main() {
-	fmt.Println("When's Saturday?")
-	today := time.Now().Weekday()
-	switch time.Saturday {
-	case today + 0:
-		fmt.Println("Today.")
-	case today + 1:
-		fmt.Println("Tomorrow.")
-	case today + 2:
-		fmt.Println("In two days.")
-	default:
-		fmt.Println("Too far away.")
-	}
-}
diff --git a/content/flowcontrol/switch-with-no-condition.go b/content/flowcontrol/switch-with-no-condition.go
deleted file mode 100644
index e9f001c..0000000
--- a/content/flowcontrol/switch-with-no-condition.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"time"
-)
-
-func main() {
-	t := time.Now()
-	switch {
-	case t.Hour() < 12:
-		fmt.Println("Good morning!")
-	case t.Hour() < 17:
-		fmt.Println("Good afternoon.")
-	default:
-		fmt.Println("Good evening.")
-	}
-}
diff --git a/content/flowcontrol/switch.go b/content/flowcontrol/switch.go
deleted file mode 100644
index 065db3d..0000000
--- a/content/flowcontrol/switch.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"runtime"
-)
-
-func main() {
-	fmt.Print("Go runs on ")
-	switch os := runtime.GOOS; os {
-	case "darwin":
-		fmt.Println("OS X.")
-	case "linux":
-		fmt.Println("Linux.")
-	default:
-		// freebsd, openbsd,
-		// plan9, windows...
-		fmt.Printf("%s.\n", os)
-	}
-}
diff --git a/content/img/tree.png b/content/img/tree.png
deleted file mode 100644
index a140421..0000000
--- a/content/img/tree.png
+++ /dev/null
Binary files differ
diff --git a/content/methods.article b/content/methods.article
deleted file mode 100644
index 34aa673..0000000
--- a/content/methods.article
+++ /dev/null
@@ -1,422 +0,0 @@
-Methods and interfaces
-This lesson covers methods and interfaces, the constructs that define objects and their behavior.
-
-The Go Authors
-https://golang.org
-
-* Methods
-
-Go does not have classes.
-However, you can define methods on types.
-
-A method is a function with a special _receiver_ argument.
-
-The receiver appears in its own argument list between the `func` keyword and
-the method name.
-
-In this example, the `Abs` method has a receiver of type `Vertex` named `v`.
-
-.play methods/methods.go
-
-* Methods are functions
-
-Remember: a method is just a function with a receiver argument.
-
-Here's `Abs` written as a regular function with no change in functionality.
-
-.play methods/methods-funcs.go
-
-* Methods continued
-
-You can declare a method on non-struct types, too.
-
-In this example we see a numeric type `MyFloat` with an `Abs` method.
-
-You can only declare a method with a receiver whose type is defined in the same
-package as the method.
-You cannot declare a method with a receiver whose type is defined in another
-package (which includes the built-in types such as `int`).
-
-.play methods/methods-continued.go
-
-* Pointer receivers
-
-You can declare methods with pointer receivers.
-
-This means the receiver type has the literal syntax `*T` for some type `T`.
-(Also, `T` cannot itself be a pointer such as `*int`.)
-
-For example, the `Scale` method here is defined on `*Vertex`.
-
-Methods with pointer receivers can modify the value to which the receiver
-points (as `Scale` does here).
-Since methods often need to modify their receiver, pointer receivers are more
-common than value receivers.
-
-Try removing the `*` from the declaration of the `Scale` function on line 16
-and observe how the program's behavior changes.
-
-With a value receiver, the `Scale` method operates on a copy of the original
-`Vertex` value.
-(This is the same behavior as for any other function argument.)
-The `Scale` method must have a pointer receiver to change the `Vertex` value
-declared in the `main` function.
-
-.play methods/methods-pointers.go
-
-* Pointers and functions
-
-Here we see the `Abs` and `Scale` methods rewritten as functions.
-
-Again, try removing the `*` from line 16.
-Can you see why the behavior changes?
-What else did you need to change for the example to compile?
-
-(If you're not sure, continue to the next page.)
-
-.play methods/methods-pointers-explained.go
-
-* Methods and pointer indirection
-
-Comparing the previous two programs, you might notice that
-functions with a pointer argument must take a pointer:
-
-	var v Vertex
-	ScaleFunc(v, 5)  // Compile error!
-	ScaleFunc(&v, 5) // OK
-
-while methods with pointer receivers take either a value or a pointer as the
-receiver when they are called:
-
-	var v Vertex
-	v.Scale(5)  // OK
-	p := &v
-	p.Scale(10) // OK
-
-For the statement `v.Scale(5)`, even though `v` is a value and not a pointer,
-the method with the pointer receiver is called automatically.
-That is, as a convenience, Go interprets the statement `v.Scale(5)` as
-`(&v).Scale(5)` since the `Scale` method has a pointer receiver.
-
-.play methods/indirection.go
-
-* Methods and pointer indirection (2)
-
-The equivalent thing happens in the reverse direction.
-
-Functions that take a value argument must take a value of that specific type:
-
-	var v Vertex
-	fmt.Println(AbsFunc(v))  // OK
-	fmt.Println(AbsFunc(&v)) // Compile error!
-
-while methods with value receivers take either a value or a pointer as the
-receiver when they are called:
-
-	var v Vertex
-	fmt.Println(v.Abs()) // OK
-	p := &v
-	fmt.Println(p.Abs()) // OK
-
-In this case, the method call `p.Abs()` is interpreted as `(*p).Abs()`.
-
-.play methods/indirection-values.go
-
-* Choosing a value or pointer receiver
-
-There are two reasons to use a pointer receiver.
-
-The first is so that the method can modify the value that its receiver points to.
-
-The second is to avoid copying the value on each method call.
-This can be more efficient if the receiver is a large struct, for example.
-
-In this example, both `Scale` and `Abs` are with receiver type `*Vertex`,
-even though the `Abs` method needn't modify its receiver.
-
-In general, all methods on a given type should have either value or pointer
-receivers, but not a mixture of both.
-(We'll see why over the next few pages.)
-
-.play methods/methods-with-pointer-receivers.go
-
-* Interfaces
-
-An _interface_type_ is defined as a set of method signatures.
-
-A value of interface type can hold any value that implements those methods.
-
-*Note:* There is an error in the example code on line 22.
-`Vertex` (the value type) doesn't implement `Abser` because
-the `Abs` method is defined only on `*Vertex` (the pointer type).
-
-.play methods/interfaces.go
-
-* Interfaces are implemented implicitly
-
-A type implements an interface by implementing its methods.
-There is no explicit declaration of intent, no "implements" keyword.
-
-Implicit interfaces decouple the definition of an interface from its
-implementation, which could then appear in any package without prearrangement.
-
-.play methods/interfaces-are-satisfied-implicitly.go
-
-* Interface values
-
-Under the hood, interface values can be thought of as a tuple of a value and a
-concrete type:
-
-	(value, type)
-
-An interface value holds a value of a specific underlying concrete type.
-
-Calling a method on an interface value executes the method of the same name on
-its underlying type.
-
-.play methods/interface-values.go
-
-* Interface values with nil underlying values
-
-If the concrete value inside the interface itself is nil,
-the method will be called with a nil receiver.
-
-In some languages this would trigger a null pointer exception,
-but in Go it is common to write methods that gracefully handle being called
-with a nil receiver (as with the method `M` in this example.)
-
-Note that an interface value that holds a nil concrete value is itself non-nil.
-
-.play methods/interface-values-with-nil.go
-
-* Nil interface values
-
-A nil interface value holds neither value nor concrete type.
-
-Calling a method on a nil interface is a run-time error because there is no
-type inside the interface tuple to indicate which _concrete_ method to call.
-
-.play methods/nil-interface-values.go
-
-* The empty interface
-
-The interface type that specifies zero methods is known as the _empty_interface_:
-
-	interface{}
-
-An empty interface may hold values of any type.
-(Every type implements at least zero methods.)
-
-Empty interfaces are used by code that handles values of unknown type.
-For example, `fmt.Print` takes any number of arguments of type `interface{}`.
-
-.play methods/empty-interface.go
-
-* Type assertions
-
-A _type_assertion_ provides access to an interface value's underlying concrete value.
-
-	t := i.(T)
-
-This statement asserts that the interface value `i` holds the concrete type `T`
-and assigns the underlying `T` value to the variable `t`.
-
-If `i` does not hold a `T`, the statement will trigger a panic.
-
-To _test_ whether an interface value holds a specific type,
-a type assertion can return two values: the underlying value
-and a boolean value that reports whether the assertion succeeded.
-
-	t, ok := i.(T)
-
-If `i` holds a `T`, then `t` will be the underlying value and `ok` will be true.
-
-If not, `ok` will be false and `t` will be the zero value of type `T`,
-and no panic occurs.
-
-Note the similarity between this syntax and that of reading from a map.
-
-.play methods/type-assertions.go
-
-* Type switches
-
-A _type_switch_ is a construct that permits several type assertions in series.
-
-A type switch is like a regular switch statement, but the cases in a type
-switch specify types (not values), and those values are compared against
-the type of the value held by the given interface value.
-
-	switch v := i.(type) {
-	case T:
-		// here v has type T
-	case S:
-		// here v has type S
-	default:
-		// no match; here v has the same type as i
-	}
-
-The declaration in a type switch has the same syntax as a type assertion `i.(T)`,
-but the specific type `T` is replaced with the keyword `type`.
-
-This switch statement tests whether the interface value `i`
-holds a value of type `T` or `S`.
-In each of the `T` and `S` cases, the variable `v` will be of type
-`T` or `S` respectively and hold the value held by `i`.
-In the default case (where there is no match), the variable `v` is
-of the same interface type and value as `i`.
-
-.play methods/type-switches.go
-
-* Stringers
-
-One of the most ubiquitous interfaces is [[//golang.org/pkg/fmt/#Stringer][`Stringer`]] defined by the [[//golang.org/pkg/fmt/][`fmt`]] package.
-
-	type Stringer interface {
-		String() string
-	}
-
-A `Stringer` is a type that can describe itself as a string. The `fmt` package
-(and many others) look for this interface to print values.
-
-.play methods/stringer.go
-
-* Exercise: Stringers
-
-Make the `IPAddr` type implement `fmt.Stringer` to print the address as
-a dotted quad.
-
-For instance, `IPAddr{1,`2,`3,`4}` should print as `"1.2.3.4"`.
-
-.play methods/exercise-stringer.go
-
-* Errors
-
-Go programs express error state with `error` values.
-
-The `error` type is a built-in interface similar to `fmt.Stringer`:
-
-	type error interface {
-		Error() string
-	}
-
-(As with `fmt.Stringer`, the `fmt` package looks for the `error` interface when
-printing values.)
-
-Functions often return an `error` value, and calling code should handle errors
-by testing whether the error equals `nil`.
-
-	i, err := strconv.Atoi("42")
-	if err != nil {
-		fmt.Printf("couldn't convert number: %v\n", err)
-		return
-	}
-	fmt.Println("Converted integer:", i)
-
-A nil `error` denotes success; a non-nil `error` denotes failure.
-
-.play methods/errors.go
-
-* Exercise: Errors
-
-Copy your `Sqrt` function from the [[/flowcontrol/8][earlier exercise]] and modify it to return an `error` value.
-
-`Sqrt` should return a non-nil error value when given a negative number, as it doesn't support complex numbers.
-
-Create a new type
-
-	type ErrNegativeSqrt float64
-
-and make it an `error` by giving it a
-
-	func (e ErrNegativeSqrt) Error() string
-
-method such that `ErrNegativeSqrt(-2).Error()` returns `"cannot`Sqrt`negative`number:`-2"`.
-
-*Note:* A call to `fmt.Sprint(e)` inside the `Error` method will send the program into an infinite loop. You can avoid this by converting `e` first: `fmt.Sprint(float64(e))`. Why?
-
-Change your `Sqrt` function to return an `ErrNegativeSqrt` value when given a negative number.
-
-.play methods/exercise-errors.go
-
-* Readers
-
-The `io` package specifies the `io.Reader` interface,
-which represents the read end of a stream of data.
-
-The Go standard library contains [[https://golang.org/search?q=Read#Global][many implementations]] of this interface, including files, network connections, compressors, ciphers, and others.
-
-The `io.Reader` interface has a `Read` method:
-
-	func (T) Read(b []byte) (n int, err error)
-
-`Read` populates the given byte slice with data and returns the number of bytes
-populated and an error value. It returns an `io.EOF` error when the stream
-ends.
-
-The example code creates a
-[[//golang.org/pkg/strings/#Reader][`strings.Reader`]]
-and consumes its output 8 bytes at a time.
-
-.play methods/reader.go
-
-* Exercise: Readers
-
-Implement a `Reader` type that emits an infinite stream of the ASCII character
-`'A'`.
-
-.play methods/exercise-reader.go
-
-* Exercise: rot13Reader
-
-A common pattern is an [[https://golang.org/pkg/io/#Reader][io.Reader]] that wraps another `io.Reader`, modifying the stream in some way.
-
-For example, the [[https://golang.org/pkg/compress/gzip/#NewReader][gzip.NewReader]] function takes an `io.Reader` (a stream of compressed data) and returns a `*gzip.Reader` that also implements `io.Reader` (a stream of the decompressed data).
-
-Implement a `rot13Reader` that implements `io.Reader` and reads from an `io.Reader`, modifying the stream by applying the [[https://en.wikipedia.org/wiki/ROT13][rot13]] substitution cipher to all alphabetical characters.
-
-The `rot13Reader` type is provided for you.
-Make it an `io.Reader` by implementing its `Read` method.
-
-.play methods/exercise-rot-reader.go
-
-* Images
-
-[[https://golang.org/pkg/image/#Image][Package image]] defines the `Image` interface:
-
-	package image
-
-	type Image interface {
-		ColorModel() color.Model
-		Bounds() Rectangle
-		At(x, y int) color.Color
-	}
-
-*Note*: the `Rectangle` return value of the `Bounds` method is actually an
-[[https://golang.org/pkg/image/#Rectangle][`image.Rectangle`]], as the
-declaration is inside package `image`.
-
-(See [[https://golang.org/pkg/image/#Image][the documentation]] for all the details.)
-
-The `color.Color` and `color.Model` types are also interfaces, but we'll ignore that by using the predefined implementations `color.RGBA` and `color.RGBAModel`. These interfaces and types are specified by the [[https://golang.org/pkg/image/color/][image/color package]]
-
-.play methods/images.go
-
-* Exercise: Images
-
-Remember the [[/moretypes/18][picture generator]] you wrote earlier? Let's write another one, but this time it will return an implementation of `image.Image` instead of a slice of data.
-
-Define your own `Image` type, implement [[https://golang.org/pkg/image/#Image][the necessary methods]], and call `pic.ShowImage`.
-
-`Bounds` should return a `image.Rectangle`, like `image.Rect(0,`0,`w,`h)`.
-
-`ColorModel` should return `color.RGBAModel`.
-
-`At` should return a color; the value `v` in the last picture generator corresponds to `color.RGBA{v,`v,`255,`255}` in this one.
-
-.play methods/exercise-images.go
-
-* Congratulations!
-
-You finished this lesson!
-
-You can go back to the list of [[/list][modules]] to find what to learn next, or continue with the [[javascript:click('.next-page')][next lesson]].
diff --git a/content/methods/empty-interface.go b/content/methods/empty-interface.go
deleted file mode 100644
index 10e9861..0000000
--- a/content/methods/empty-interface.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	var i interface{}
-	describe(i)
-
-	i = 42
-	describe(i)
-
-	i = "hello"
-	describe(i)
-}
-
-func describe(i interface{}) {
-	fmt.Printf("(%v, %T)\n", i, i)
-}
diff --git a/content/methods/errors.go b/content/methods/errors.go
deleted file mode 100644
index 7ea0aed..0000000
--- a/content/methods/errors.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"time"
-)
-
-type MyError struct {
-	When time.Time
-	What string
-}
-
-func (e *MyError) Error() string {
-	return fmt.Sprintf("at %v, %s",
-		e.When, e.What)
-}
-
-func run() error {
-	return &MyError{
-		time.Now(),
-		"it didn't work",
-	}
-}
-
-func main() {
-	if err := run(); err != nil {
-		fmt.Println(err)
-	}
-}
diff --git a/content/methods/exercise-errors.go b/content/methods/exercise-errors.go
deleted file mode 100644
index 22e933b..0000000
--- a/content/methods/exercise-errors.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-)
-
-func Sqrt(x float64) (float64, error) {
-	return 0, nil
-}
-
-func main() {
-	fmt.Println(Sqrt(2))
-	fmt.Println(Sqrt(-2))
-}
diff --git a/content/methods/exercise-images.go b/content/methods/exercise-images.go
deleted file mode 100644
index 5b93246..0000000
--- a/content/methods/exercise-images.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build no-build OMIT
-
-package main
-
-import "golang.org/x/tour/pic"
-
-type Image struct{}
-
-func main() {
-	m := Image{}
-	pic.ShowImage(m)
-}
diff --git a/content/methods/exercise-reader.go b/content/methods/exercise-reader.go
deleted file mode 100644
index e1394b2..0000000
--- a/content/methods/exercise-reader.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build no-build OMIT
-
-package main
-
-import "golang.org/x/tour/reader"
-
-type MyReader struct{}
-
-// TODO: Add a Read([]byte) (int, error) method to MyReader.
-
-func main() {
-	reader.Validate(MyReader{})
-}
diff --git a/content/methods/exercise-rot-reader.go b/content/methods/exercise-rot-reader.go
deleted file mode 100644
index 21aead5..0000000
--- a/content/methods/exercise-rot-reader.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// +build no-build OMIT
-
-package main
-
-import (
-	"io"
-	"os"
-	"strings"
-)
-
-type rot13Reader struct {
-	r io.Reader
-}
-
-func main() {
-	s := strings.NewReader("Lbh penpxrq gur pbqr!")
-	r := rot13Reader{s}
-	io.Copy(os.Stdout, &r)
-}
diff --git a/content/methods/exercise-stringer.go b/content/methods/exercise-stringer.go
deleted file mode 100644
index bd9fed5..0000000
--- a/content/methods/exercise-stringer.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type IPAddr [4]byte
-
-// TODO: Add a "String() string" method to IPAddr.
-
-func main() {
-	hosts := map[string]IPAddr{
-		"loopback":  {127, 0, 0, 1},
-		"googleDNS": {8, 8, 8, 8},
-	}
-	for name, ip := range hosts {
-		fmt.Printf("%v: %v\n", name, ip)
-	}
-}
diff --git a/content/methods/images.go b/content/methods/images.go
deleted file mode 100644
index 6305e26..0000000
--- a/content/methods/images.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"image"
-)
-
-func main() {
-	m := image.NewRGBA(image.Rect(0, 0, 100, 100))
-	fmt.Println(m.Bounds())
-	fmt.Println(m.At(0, 0).RGBA())
-}
diff --git a/content/methods/indirection-values.go b/content/methods/indirection-values.go
deleted file mode 100644
index 04e022b..0000000
--- a/content/methods/indirection-values.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type Vertex struct {
-	X, Y float64
-}
-
-func (v Vertex) Abs() float64 {
-	return math.Sqrt(v.X*v.X + v.Y*v.Y)
-}
-
-func AbsFunc(v Vertex) float64 {
-	return math.Sqrt(v.X*v.X + v.Y*v.Y)
-}
-
-func main() {
-	v := Vertex{3, 4}
-	fmt.Println(v.Abs())
-	fmt.Println(AbsFunc(v))
-
-	p := &Vertex{4, 3}
-	fmt.Println(p.Abs())
-	fmt.Println(AbsFunc(*p))
-}
diff --git a/content/methods/indirection.go b/content/methods/indirection.go
deleted file mode 100644
index 6b69828..0000000
--- a/content/methods/indirection.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type Vertex struct {
-	X, Y float64
-}
-
-func (v *Vertex) Scale(f float64) {
-	v.X = v.X * f
-	v.Y = v.Y * f
-}
-
-func ScaleFunc(v *Vertex, f float64) {
-	v.X = v.X * f
-	v.Y = v.Y * f
-}
-
-func main() {
-	v := Vertex{3, 4}
-	v.Scale(2)
-	ScaleFunc(&v, 10)
-
-	p := &Vertex{4, 3}
-	p.Scale(3)
-	ScaleFunc(p, 8)
-
-	fmt.Println(v, p)
-}
diff --git a/content/methods/interface-values-with-nil.go b/content/methods/interface-values-with-nil.go
deleted file mode 100644
index 9c4773a..0000000
--- a/content/methods/interface-values-with-nil.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type I interface {
-	M()
-}
-
-type T struct {
-	S string
-}
-
-func (t *T) M() {
-	if t == nil {
-		fmt.Println("<nil>")
-		return
-	}
-	fmt.Println(t.S)
-}
-
-func main() {
-	var i I
-
-	var t *T
-	i = t
-	describe(i)
-	i.M()
-
-	i = &T{"hello"}
-	describe(i)
-	i.M()
-}
-
-func describe(i I) {
-	fmt.Printf("(%v, %T)\n", i, i)
-}
diff --git a/content/methods/interface-values.go b/content/methods/interface-values.go
deleted file mode 100644
index 82d096f..0000000
--- a/content/methods/interface-values.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type I interface {
-	M()
-}
-
-type T struct {
-	S string
-}
-
-func (t *T) M() {
-	fmt.Println(t.S)
-}
-
-type F float64
-
-func (f F) M() {
-	fmt.Println(f)
-}
-
-func main() {
-	var i I
-
-	i = &T{"Hello"}
-	describe(i)
-	i.M()
-
-	i = F(math.Pi)
-	describe(i)
-	i.M()
-}
-
-func describe(i I) {
-	fmt.Printf("(%v, %T)\n", i, i)
-}
diff --git a/content/methods/interfaces-are-satisfied-implicitly.go b/content/methods/interfaces-are-satisfied-implicitly.go
deleted file mode 100644
index 23f4539..0000000
--- a/content/methods/interfaces-are-satisfied-implicitly.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type I interface {
-	M()
-}
-
-type T struct {
-	S string
-}
-
-// This method means type T implements the interface I,
-// but we don't need to explicitly declare that it does so.
-func (t T) M() {
-	fmt.Println(t.S)
-}
-
-func main() {
-	var i I = T{"hello"}
-	i.M()
-}
diff --git a/content/methods/interfaces.go b/content/methods/interfaces.go
deleted file mode 100644
index a6eda32..0000000
--- a/content/methods/interfaces.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// +build no-build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type Abser interface {
-	Abs() float64
-}
-
-func main() {
-	var a Abser
-	f := MyFloat(-math.Sqrt2)
-	v := Vertex{3, 4}
-
-	a = f  // a MyFloat implements Abser
-	a = &v // a *Vertex implements Abser
-
-	// In the following line, v is a Vertex (not *Vertex)
-	// and does NOT implement Abser.
-	a = v
-
-	fmt.Println(a.Abs())
-}
-
-type MyFloat float64
-
-func (f MyFloat) Abs() float64 {
-	if f < 0 {
-		return float64(-f)
-	}
-	return float64(f)
-}
-
-type Vertex struct {
-	X, Y float64
-}
-
-func (v *Vertex) Abs() float64 {
-	return math.Sqrt(v.X*v.X + v.Y*v.Y)
-}
diff --git a/content/methods/methods-continued.go b/content/methods/methods-continued.go
deleted file mode 100644
index 6710d1b..0000000
--- a/content/methods/methods-continued.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type MyFloat float64
-
-func (f MyFloat) Abs() float64 {
-	if f < 0 {
-		return float64(-f)
-	}
-	return float64(f)
-}
-
-func main() {
-	f := MyFloat(-math.Sqrt2)
-	fmt.Println(f.Abs())
-}
diff --git a/content/methods/methods-funcs.go b/content/methods/methods-funcs.go
deleted file mode 100644
index 476f0cf..0000000
--- a/content/methods/methods-funcs.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type Vertex struct {
-	X, Y float64
-}
-
-func Abs(v Vertex) float64 {
-	return math.Sqrt(v.X*v.X + v.Y*v.Y)
-}
-
-func main() {
-	v := Vertex{3, 4}
-	fmt.Println(Abs(v))
-}
diff --git a/content/methods/methods-pointers-explained.go b/content/methods/methods-pointers-explained.go
deleted file mode 100644
index db9107a..0000000
--- a/content/methods/methods-pointers-explained.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type Vertex struct {
-	X, Y float64
-}
-
-func Abs(v Vertex) float64 {
-	return math.Sqrt(v.X*v.X + v.Y*v.Y)
-}
-
-func Scale(v *Vertex, f float64) {
-	v.X = v.X * f
-	v.Y = v.Y * f
-}
-
-func main() {
-	v := Vertex{3, 4}
-	Scale(&v, 10)
-	fmt.Println(Abs(v))
-}
diff --git a/content/methods/methods-pointers.go b/content/methods/methods-pointers.go
deleted file mode 100644
index cd88f46..0000000
--- a/content/methods/methods-pointers.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type Vertex struct {
-	X, Y float64
-}
-
-func (v Vertex) Abs() float64 {
-	return math.Sqrt(v.X*v.X + v.Y*v.Y)
-}
-
-func (v *Vertex) Scale(f float64) {
-	v.X = v.X * f
-	v.Y = v.Y * f
-}
-
-func main() {
-	v := Vertex{3, 4}
-	v.Scale(10)
-	fmt.Println(v.Abs())
-}
diff --git a/content/methods/methods-with-pointer-receivers.go b/content/methods/methods-with-pointer-receivers.go
deleted file mode 100644
index 28acc2b..0000000
--- a/content/methods/methods-with-pointer-receivers.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type Vertex struct {
-	X, Y float64
-}
-
-func (v *Vertex) Scale(f float64) {
-	v.X = v.X * f
-	v.Y = v.Y * f
-}
-
-func (v *Vertex) Abs() float64 {
-	return math.Sqrt(v.X*v.X + v.Y*v.Y)
-}
-
-func main() {
-	v := &Vertex{3, 4}
-	fmt.Printf("Before scaling: %+v, Abs: %v\n", v, v.Abs())
-	v.Scale(5)
-	fmt.Printf("After scaling: %+v, Abs: %v\n", v, v.Abs())
-}
diff --git a/content/methods/methods.go b/content/methods/methods.go
deleted file mode 100644
index 692a095..0000000
--- a/content/methods/methods.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type Vertex struct {
-	X, Y float64
-}
-
-func (v Vertex) Abs() float64 {
-	return math.Sqrt(v.X*v.X + v.Y*v.Y)
-}
-
-func main() {
-	v := Vertex{3, 4}
-	fmt.Println(v.Abs())
-}
diff --git a/content/methods/nil-interface-values.go b/content/methods/nil-interface-values.go
deleted file mode 100644
index 55dbf86..0000000
--- a/content/methods/nil-interface-values.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// +build no-run OMIT
-
-package main
-
-import "fmt"
-
-type I interface {
-	M()
-}
-
-func main() {
-	var i I
-	describe(i)
-	i.M()
-}
-
-func describe(i I) {
-	fmt.Printf("(%v, %T)\n", i, i)
-}
diff --git a/content/methods/reader.go b/content/methods/reader.go
deleted file mode 100644
index 4c97eb4..0000000
--- a/content/methods/reader.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"io"
-	"strings"
-)
-
-func main() {
-	r := strings.NewReader("Hello, Reader!")
-
-	b := make([]byte, 8)
-	for {
-		n, err := r.Read(b)
-		fmt.Printf("n = %v err = %v b = %v\n", n, err, b)
-		fmt.Printf("b[:n] = %q\n", b[:n])
-		if err == io.EOF {
-			break
-		}
-	}
-}
diff --git a/content/methods/stringer.go b/content/methods/stringer.go
deleted file mode 100644
index 10944b9..0000000
--- a/content/methods/stringer.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type Person struct {
-	Name string
-	Age  int
-}
-
-func (p Person) String() string {
-	return fmt.Sprintf("%v (%v years)", p.Name, p.Age)
-}
-
-func main() {
-	a := Person{"Arthur Dent", 42}
-	z := Person{"Zaphod Beeblebrox", 9001}
-	fmt.Println(a, z)
-}
diff --git a/content/methods/type-assertions.go b/content/methods/type-assertions.go
deleted file mode 100644
index 7e81499..0000000
--- a/content/methods/type-assertions.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// +build no-run OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	var i interface{} = "hello"
-
-	s := i.(string)
-	fmt.Println(s)
-
-	s, ok := i.(string)
-	fmt.Println(s, ok)
-
-	f, ok := i.(float64)
-	fmt.Println(f, ok)
-
-	f = i.(float64) // panic
-	fmt.Println(f)
-}
diff --git a/content/methods/type-switches.go b/content/methods/type-switches.go
deleted file mode 100644
index 12d879d..0000000
--- a/content/methods/type-switches.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func do(i interface{}) {
-	switch v := i.(type) {
-	case int:
-		fmt.Printf("Twice %v is %v\n", v, v*2)
-	case string:
-		fmt.Printf("%q is %v bytes long\n", v, len(v))
-	default:
-		fmt.Printf("I don't know about type %T!\n", v)
-	}
-}
-
-func main() {
-	do(21)
-	do("hello")
-	do(true)
-}
diff --git a/content/moretypes.article b/content/moretypes.article
deleted file mode 100644
index 5fe9401..0000000
--- a/content/moretypes.article
+++ /dev/null
@@ -1,361 +0,0 @@
-More types: structs, slices, and maps.
-Learn how to define types based on existing ones: this lesson covers structs, arrays, slices, and maps.
-
-The Go Authors
-https://golang.org
-
-* Pointers
-
-Go has pointers.
-A pointer holds the memory address of a value.
-
-The type `*T` is a pointer to a `T` value. Its zero value is `nil`.
-
-	var p *int
-
-The `&` operator generates a pointer to its operand.
-
-	i := 42
-	p = &i
-
-The `*` operator denotes the pointer's underlying value.
-
-	fmt.Println(*p) // read i through the pointer p
-	*p = 21         // set i through the pointer p
-
-This is known as "dereferencing" or "indirecting".
-
-Unlike C, Go has no pointer arithmetic.
-
-.play moretypes/pointers.go
-
-* Structs
-
-A `struct` is a collection of fields.
-
-.play moretypes/structs.go
-
-* Struct Fields
-
-Struct fields are accessed using a dot.
-
-.play moretypes/struct-fields.go
-
-* Pointers to structs
-
-Struct fields can be accessed through a struct pointer.
-
-To access the field `X` of a struct when we have the struct pointer `p` we could
-write `(*p).X`.
-However, that notation is cumbersome, so the language permits us instead to
-write just `p.X`, without the explicit dereference.
-
-.play moretypes/struct-pointers.go
-
-* Struct Literals
-
-A struct literal denotes a newly allocated struct value by listing the values of its fields.
-
-You can list just a subset of fields by using the `Name:` syntax. (And the order of named fields is irrelevant.)
-
-The special prefix `&` returns a pointer to the struct value.
-
-.play moretypes/struct-literals.go
-
-
-* Arrays
-
-The type `[n]T` is an array of `n` values of type `T`.
-
-The expression
-
-	var a [10]int
-
-declares a variable `a` as an array of ten integers.
-
-An array's length is part of its type, so arrays cannot be resized.
-This seems limiting, but don't worry;
-Go provides a convenient way of working with arrays.
-
-.play moretypes/array.go
-
-
-* Slices
-
-An array has a fixed size.
-A slice, on the other hand, is a dynamically-sized,
-flexible view into the elements of an array.
-In practice, slices are much more common than arrays.
-
-The type `[]T` is a slice with elements of type `T`.
-
-A slice is formed by specifying two indices, a low and
-high bound, separated by a colon:
-
-	a[low : high]
-
-This selects a half-open range which includes the first
-element, but excludes the last one.
-
-The following expression creates a slice which includes
-elements 1 through 3 of `a`:
-
-	a[1:4]
-
-.play moretypes/slices.go
-
-
-* Slices are like references to arrays
-
-A slice does not store any data,
-it just describes a section of an underlying array.
-
-Changing the elements of a slice modifies the
-corresponding elements of its underlying array.
-
-Other slices that share the same underlying array will see those changes.
-
-.play moretypes/slices-pointers.go
-
-
-* Slice literals
-
-A slice literal is like an array literal without the length.
-
-This is an array literal:
-
-	[3]bool{true, true, false}
-
-And this creates the same array as above,
-then builds a slice that references it:
-
-	[]bool{true, true, false}
-
-.play moretypes/slice-literals.go
-
-
-* Slice defaults
-
-When slicing, you may omit the high or low bounds to use their defaults instead.
-
-The default is zero for the low bound and the length of the slice for the high bound.
-
-For the array
-
-	var a [10]int
-
-these slice expressions are equivalent:
-
-	a[0:10]
-	a[:10]
-	a[0:]
-	a[:]
-
-.play moretypes/slice-bounds.go
-
-
-* Slice length and capacity
-
-A slice has both a _length_ and a _capacity_.
-
-The length of a slice is the number of elements it contains.
-
-The capacity of a slice is the number of elements in the underlying array,
-counting from the first element in the slice.
-
-The length and capacity of a slice `s` can be obtained using the expressions
-`len(s)` and `cap(s)`.
-
-You can extend a slice's length by re-slicing it,
-provided it has sufficient capacity.
-Try changing one of the slice operations in the example program to extend it
-beyond its capacity and see what happens.
-
-.play moretypes/slice-len-cap.go
-
-
-* Nil slices
-
-The zero value of a slice is `nil`.
-
-A nil slice has a length and capacity of 0
-and has no underlying array.
-
-.play moretypes/nil-slices.go
-
-
-* Creating a slice with make
-
-Slices can be created with the built-in `make` function;
-this is how you create dynamically-sized arrays.
-
-The `make` function allocates a zeroed array
-and returns a slice that refers to that array:
-
-	a := make([]int, 5)  // len(a)=5
-
-To specify a capacity, pass a third argument to `make`:
-
-	b := make([]int, 0, 5) // len(b)=0, cap(b)=5
-
-	b = b[:cap(b)] // len(b)=5, cap(b)=5
-	b = b[1:]      // len(b)=4, cap(b)=4
-
-.play moretypes/making-slices.go
-
-
-* Slices of slices
-
-Slices can contain any type, including other slices.
-
-.play moretypes/slices-of-slice.go
-
-
-* Appending to a slice
-
-It is common to append new elements to a slice, and so Go provides a built-in
-`append` function. The [[https://golang.org/pkg/builtin/#append][documentation]]
-of the built-in package describes `append`.
-
-	func append(s []T, vs ...T) []T
-
-The first parameter `s` of `append` is a slice of type `T`, and the rest are
-`T` values to append to the slice.
-
-The resulting value of `append` is a slice containing all the elements of the
-original slice plus the provided values.
-
-If the backing array of `s` is too small to fit all the given values a bigger
-array will be allocated. The returned slice will point to the newly allocated
-array.
-
-(To learn more about slices, read the [[https://blog.golang.org/go-slices-usage-and-internals][Slices: usage and internals]] article.)
-
-.play moretypes/append.go
-
-
-* Range
-
-The `range` form of the `for` loop iterates over a slice or map.
-
-When ranging over a slice, two values are returned for each iteration.
-The first is the index, and the second is a copy of the element at that index.
-
-.play moretypes/range.go
-
-* Range continued
-
-You can skip the index or value by assigning to `_`.
-
-    for i, _ := range pow
-    for _, value := range pow
-
-If you only want the index, you can omit the second variable.
-
-    for i := range pow
-
-.play moretypes/range-continued.go
-
-* Exercise: Slices
-
-Implement `Pic`. It should return a slice of length `dy`, each element of which is a slice of `dx` 8-bit unsigned integers. When you run the program, it will display your picture, interpreting the integers as grayscale (well, bluescale) values.
-
-The choice of image is up to you. Interesting functions include `(x+y)/2`, `x*y`, and `x^y`.
-
-(You need to use a loop to allocate each `[]uint8` inside the `[][]uint8`.)
-
-(Use `uint8(intValue)` to convert between types.)
-
-.play moretypes/exercise-slices.go
-
-* Maps
-
-A map maps keys to values.
-
-The zero value of a map is `nil`.
-A `nil` map has no keys, nor can keys be added.
-
-The `make` function returns a map of the given type,
-initialized and ready for use.
-
-.play moretypes/maps.go
-
-* Map literals
-
-Map literals are like struct literals, but the keys are required.
-
-.play moretypes/map-literals.go
-
-* Map literals continued
-
-If the top-level type is just a type name, you can omit it from the elements of the literal.
-
-.play moretypes/map-literals-continued.go
-
-* Mutating Maps
-
-Insert or update an element in map `m`:
-
-	m[key] = elem
-
-Retrieve an element:
-
-	elem = m[key]
-
-Delete an element:
-
-	delete(m, key)
-
-Test that a key is present with a two-value assignment:
-
-	elem, ok = m[key]
-
-If `key` is in `m`, `ok` is `true`. If not, `ok` is `false`.
-
-If `key` is not in the map, then `elem` is the zero value for the map's element type.
-
-*Note:* If `elem` or `ok` have not yet been declared you could use a short declaration form:
-
-	elem, ok := m[key]
-
-.play moretypes/mutating-maps.go
-
-* Exercise: Maps
-
-Implement `WordCount`.  It should return a map of the counts of each “word” in the string `s`. The `wc.Test` function runs a test suite against the provided function and prints success or failure.
-
-You might find [[https://golang.org/pkg/strings/#Fields][strings.Fields]] helpful.
-
-.play moretypes/exercise-maps.go
-
-* Function values
-
-Functions are values too. They can be passed around just like other values.
-
-Function values may be used as function arguments and return values.
-
-.play moretypes/function-values.go
-
-* Function closures
-
-Go functions may be closures. A closure is a function value that references variables from outside its body. The function may access and assign to the referenced variables; in this sense the function is "bound" to the variables.
-
-For example, the `adder` function returns a closure. Each closure is bound to its own `sum` variable.
-
-.play moretypes/function-closures.go
-
-* Exercise: Fibonacci closure
-
-Let's have some fun with functions.
-
-Implement a `fibonacci` function that returns a function (a closure) that
-returns successive [[https://en.wikipedia.org/wiki/Fibonacci_number][fibonacci numbers]]
-(0, 1, 1, 2, 3, 5, ...).
-
-.play moretypes/exercise-fibonacci-closure.go
-
-* Congratulations!
-
-You finished this lesson!
-
-You can go back to the list of [[/list][modules]] to find what to learn next, or continue with the [[javascript:click('.next-page')][next lesson]].
diff --git a/content/moretypes/append.go b/content/moretypes/append.go
deleted file mode 100644
index f13b9d6..0000000
--- a/content/moretypes/append.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	var s []int
-	printSlice(s)
-
-	// append works on nil slices.
-	s = append(s, 0)
-	printSlice(s)
-
-	// The slice grows as needed.
-	s = append(s, 1)
-	printSlice(s)
-
-	// We can add more than one element at a time.
-	s = append(s, 2, 3, 4)
-	printSlice(s)
-}
-
-func printSlice(s []int) {
-	fmt.Printf("len=%d cap=%d %v\n", len(s), cap(s), s)
-}
diff --git a/content/moretypes/array.go b/content/moretypes/array.go
deleted file mode 100644
index 8d73573..0000000
--- a/content/moretypes/array.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	var a [2]string
-	a[0] = "Hello"
-	a[1] = "World"
-	fmt.Println(a[0], a[1])
-	fmt.Println(a)
-
-	primes := [6]int{2, 3, 5, 7, 11, 13}
-	fmt.Println(primes)
-}
diff --git a/content/moretypes/exercise-fibonacci-closure.go b/content/moretypes/exercise-fibonacci-closure.go
deleted file mode 100644
index d5a4e00..0000000
--- a/content/moretypes/exercise-fibonacci-closure.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// +build no-build OMIT
-
-package main
-
-import "fmt"
-
-// fibonacci is a function that returns
-// a function that returns an int.
-func fibonacci() func() int {
-}
-
-func main() {
-	f := fibonacci()
-	for i := 0; i < 10; i++ {
-		fmt.Println(f())
-	}
-}
diff --git a/content/moretypes/exercise-maps.go b/content/moretypes/exercise-maps.go
deleted file mode 100644
index e48e48a..0000000
--- a/content/moretypes/exercise-maps.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"golang.org/x/tour/wc"
-)
-
-func WordCount(s string) map[string]int {
-	return map[string]int{"x": 1}
-}
-
-func main() {
-	wc.Test(WordCount)
-}
diff --git a/content/moretypes/exercise-slices.go b/content/moretypes/exercise-slices.go
deleted file mode 100644
index 094ec09..0000000
--- a/content/moretypes/exercise-slices.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build no-build OMIT
-
-package main
-
-import "golang.org/x/tour/pic"
-
-func Pic(dx, dy int) [][]uint8 {
-}
-
-func main() {
-	pic.Show(Pic)
-}
diff --git a/content/moretypes/function-closures.go b/content/moretypes/function-closures.go
deleted file mode 100644
index df09995..0000000
--- a/content/moretypes/function-closures.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func adder() func(int) int {
-	sum := 0
-	return func(x int) int {
-		sum += x
-		return sum
-	}
-}
-
-func main() {
-	pos, neg := adder(), adder()
-	for i := 0; i < 10; i++ {
-		fmt.Println(
-			pos(i),
-			neg(-2*i),
-		)
-	}
-}
diff --git a/content/moretypes/function-values.go b/content/moretypes/function-values.go
deleted file mode 100644
index 0527d71..0000000
--- a/content/moretypes/function-values.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-func compute(fn func(float64, float64) float64) float64 {
-	return fn(3, 4)
-}
-
-func main() {
-	hypot := func(x, y float64) float64 {
-		return math.Sqrt(x*x + y*y)
-	}
-	fmt.Println(hypot(5, 12))
-
-	fmt.Println(compute(hypot))
-	fmt.Println(compute(math.Pow))
-}
diff --git a/content/moretypes/making-slices.go b/content/moretypes/making-slices.go
deleted file mode 100644
index 2dae8de..0000000
--- a/content/moretypes/making-slices.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	a := make([]int, 5)
-	printSlice("a", a)
-
-	b := make([]int, 0, 5)
-	printSlice("b", b)
-
-	c := b[:2]
-	printSlice("c", c)
-
-	d := c[2:5]
-	printSlice("d", d)
-}
-
-func printSlice(s string, x []int) {
-	fmt.Printf("%s len=%d cap=%d %v\n",
-		s, len(x), cap(x), x)
-}
diff --git a/content/moretypes/map-literals-continued.go b/content/moretypes/map-literals-continued.go
deleted file mode 100644
index 3a78844..0000000
--- a/content/moretypes/map-literals-continued.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type Vertex struct {
-	Lat, Long float64
-}
-
-var m = map[string]Vertex{
-	"Bell Labs": {40.68433, -74.39967},
-	"Google":    {37.42202, -122.08408},
-}
-
-func main() {
-	fmt.Println(m)
-}
diff --git a/content/moretypes/map-literals.go b/content/moretypes/map-literals.go
deleted file mode 100644
index 9aca19a..0000000
--- a/content/moretypes/map-literals.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type Vertex struct {
-	Lat, Long float64
-}
-
-var m = map[string]Vertex{
-	"Bell Labs": Vertex{
-		40.68433, -74.39967,
-	},
-	"Google": Vertex{
-		37.42202, -122.08408,
-	},
-}
-
-func main() {
-	fmt.Println(m)
-}
diff --git a/content/moretypes/maps.go b/content/moretypes/maps.go
deleted file mode 100644
index 17727b7..0000000
--- a/content/moretypes/maps.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type Vertex struct {
-	Lat, Long float64
-}
-
-var m map[string]Vertex
-
-func main() {
-	m = make(map[string]Vertex)
-	m["Bell Labs"] = Vertex{
-		40.68433, -74.39967,
-	}
-	fmt.Println(m["Bell Labs"])
-}
diff --git a/content/moretypes/mutating-maps.go b/content/moretypes/mutating-maps.go
deleted file mode 100644
index 2c3d048..0000000
--- a/content/moretypes/mutating-maps.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	m := make(map[string]int)
-
-	m["Answer"] = 42
-	fmt.Println("The value:", m["Answer"])
-
-	m["Answer"] = 48
-	fmt.Println("The value:", m["Answer"])
-
-	delete(m, "Answer")
-	fmt.Println("The value:", m["Answer"])
-
-	v, ok := m["Answer"]
-	fmt.Println("The value:", v, "Present?", ok)
-}
diff --git a/content/moretypes/nil-slices.go b/content/moretypes/nil-slices.go
deleted file mode 100644
index a317027..0000000
--- a/content/moretypes/nil-slices.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	var s []int
-	fmt.Println(s, len(s), cap(s))
-	if s == nil {
-		fmt.Println("nil!")
-	}
-}
diff --git a/content/moretypes/pointers.go b/content/moretypes/pointers.go
deleted file mode 100644
index 9909b3c..0000000
--- a/content/moretypes/pointers.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	i, j := 42, 2701
-
-	p := &i         // point to i
-	fmt.Println(*p) // read i through the pointer
-	*p = 21         // set i through the pointer
-	fmt.Println(i)  // see the new value of i
-
-	p = &j         // point to j
-	*p = *p / 37   // divide j through the pointer
-	fmt.Println(j) // see the new value of j
-}
diff --git a/content/moretypes/range-continued.go b/content/moretypes/range-continued.go
deleted file mode 100644
index feae06b..0000000
--- a/content/moretypes/range-continued.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	pow := make([]int, 10)
-	for i := range pow {
-		pow[i] = 1 << uint(i) // == 2**i
-	}
-	for _, value := range pow {
-		fmt.Printf("%d\n", value)
-	}
-}
diff --git a/content/moretypes/range.go b/content/moretypes/range.go
deleted file mode 100644
index 193c961..0000000
--- a/content/moretypes/range.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-var pow = []int{1, 2, 4, 8, 16, 32, 64, 128}
-
-func main() {
-	for i, v := range pow {
-		fmt.Printf("2**%d = %d\n", i, v)
-	}
-}
diff --git a/content/moretypes/slice-bounds.go b/content/moretypes/slice-bounds.go
deleted file mode 100644
index 1ba3963..0000000
--- a/content/moretypes/slice-bounds.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	s := []int{2, 3, 5, 7, 11, 13}
-
-	s = s[1:4]
-	fmt.Println(s)
-
-	s = s[:2]
-	fmt.Println(s)
-
-	s = s[1:]
-	fmt.Println(s)
-}
diff --git a/content/moretypes/slice-len-cap.go b/content/moretypes/slice-len-cap.go
deleted file mode 100644
index a1c5764..0000000
--- a/content/moretypes/slice-len-cap.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	s := []int{2, 3, 5, 7, 11, 13}
-	printSlice(s)
-
-	// Slice the slice to give it zero length.
-	s = s[:0]
-	printSlice(s)
-
-	// Extend its length.
-	s = s[:4]
-	printSlice(s)
-
-	// Drop its first two values.
-	s = s[2:]
-	printSlice(s)
-}
-
-func printSlice(s []int) {
-	fmt.Printf("len=%d cap=%d %v\n", len(s), cap(s), s)
-}
diff --git a/content/moretypes/slice-literals.go b/content/moretypes/slice-literals.go
deleted file mode 100644
index 5a98010..0000000
--- a/content/moretypes/slice-literals.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	q := []int{2, 3, 5, 7, 11, 13}
-	fmt.Println(q)
-
-	r := []bool{true, false, true, true, false, true}
-	fmt.Println(r)
-
-	s := []struct {
-		i int
-		b bool
-	}{
-		{2, true},
-		{3, false},
-		{5, true},
-		{7, true},
-		{11, false},
-		{13, true},
-	}
-	fmt.Println(s)
-}
diff --git a/content/moretypes/slices-of-slice.go b/content/moretypes/slices-of-slice.go
deleted file mode 100644
index 8f5cbc8..0000000
--- a/content/moretypes/slices-of-slice.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"strings"
-)
-
-func main() {
-	// Create a tic-tac-toe board.
-	board := [][]string{
-		[]string{"_", "_", "_"},
-		[]string{"_", "_", "_"},
-		[]string{"_", "_", "_"},
-	}
-
-	// The players take turns.
-	board[0][0] = "X"
-	board[2][2] = "O"
-	board[1][2] = "X"
-	board[1][0] = "O"
-	board[0][2] = "X"
-
-	for i := 0; i < len(board); i++ {
-		fmt.Printf("%s\n", strings.Join(board[i], " "))
-	}
-}
diff --git a/content/moretypes/slices-pointers.go b/content/moretypes/slices-pointers.go
deleted file mode 100644
index 193b463..0000000
--- a/content/moretypes/slices-pointers.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	names := [4]string{
-		"John",
-		"Paul",
-		"George",
-		"Ringo",
-	}
-	fmt.Println(names)
-
-	a := names[0:2]
-	b := names[1:3]
-	fmt.Println(a, b)
-
-	b[0] = "XXX"
-	fmt.Println(a, b)
-	fmt.Println(names)
-}
diff --git a/content/moretypes/slices.go b/content/moretypes/slices.go
deleted file mode 100644
index 7720f84..0000000
--- a/content/moretypes/slices.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	primes := [6]int{2, 3, 5, 7, 11, 13}
-
-	var s []int = primes[1:4]
-	fmt.Println(s)
-}
diff --git a/content/moretypes/struct-fields.go b/content/moretypes/struct-fields.go
deleted file mode 100644
index b85607f..0000000
--- a/content/moretypes/struct-fields.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type Vertex struct {
-	X int
-	Y int
-}
-
-func main() {
-	v := Vertex{1, 2}
-	v.X = 4
-	fmt.Println(v.X)
-}
diff --git a/content/moretypes/struct-literals.go b/content/moretypes/struct-literals.go
deleted file mode 100644
index 5a96b2c..0000000
--- a/content/moretypes/struct-literals.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type Vertex struct {
-	X, Y int
-}
-
-var (
-	v1 = Vertex{1, 2}  // has type Vertex
-	v2 = Vertex{X: 1}  // Y:0 is implicit
-	v3 = Vertex{}      // X:0 and Y:0
-	p  = &Vertex{1, 2} // has type *Vertex
-)
-
-func main() {
-	fmt.Println(v1, p, v2, v3)
-}
diff --git a/content/moretypes/struct-pointers.go b/content/moretypes/struct-pointers.go
deleted file mode 100644
index 901f003..0000000
--- a/content/moretypes/struct-pointers.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type Vertex struct {
-	X int
-	Y int
-}
-
-func main() {
-	v := Vertex{1, 2}
-	p := &v
-	p.X = 1e9
-	fmt.Println(v)
-}
diff --git a/content/moretypes/structs.go b/content/moretypes/structs.go
deleted file mode 100644
index 253a4fd..0000000
--- a/content/moretypes/structs.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type Vertex struct {
-	X int
-	Y int
-}
-
-func main() {
-	fmt.Println(Vertex{1, 2})
-}
diff --git a/content/welcome.article b/content/welcome.article
deleted file mode 100644
index e96256a..0000000
--- a/content/welcome.article
+++ /dev/null
@@ -1,107 +0,0 @@
-Welcome!
-Learn how to use this tour: including how to navigate the different lessons and how to run code.
-
-The Go Authors
-https://golang.org
-
-* Hello, 世界
-
-Welcome to a tour of the [[https://golang.org/][Go programming language]].
-
-The tour is divided into a list of modules that you can
-access by clicking on
-[[javascript:highlight(".logo")][A Tour of Go]] on the top left of the page.
-
-You can also view the table of contents at any time by clicking on the [[javascript:highlightAndClick(".nav")][menu]] on the top right of the page.
-
-Throughout the tour you will find a series of slides and exercises for you
-to complete.
-
-You can navigate through them using
-
-- [[javascript:highlight(".prev-page")]["previous"]] or `PageUp` to go to the previous page,
-
-- [[javascript:highlight(".next-page")]["next"]] or `PageDown` to go to the next page.
-
-The tour is interactive. Click the
-[[javascript:highlightAndClick("#run")][Run]] button now
-(or press `Shift` + `Enter`) to compile and run the program on
-#appengine: a remote server.
-your computer.
-The result is displayed below the code.
-
-These example programs demonstrate different aspects of Go. The programs in the tour are meant to be starting points for your own experimentation.
-
-Edit the program and run it again.
-
-When you click on [[javascript:highlightAndClick("#format")][Format]]
-(shortcut: `Ctrl` + `Enter`), the text in the editor is formatted using the
-[[https://golang.org/cmd/gofmt/][gofmt]] tool. You can switch syntax highlighting on and off
-by clicking on the [[javascript:highlightAndClick(".syntax-checkbox")][syntax]] button.
-
-When you're ready to move on, click the [[javascript:highlightAndClick(".next-page")][right arrow]] below or type the `PageDown` key.
-
-.play welcome/hello.go
-
-* Go local
-
-The tour is available in other languages:
-
-- [[https://go-tour-br.appspot.com/][Brazilian Portuguese — Português do Brasil]]
-- [[https://go-tour-ca.appspot.com/][Catalan — Català]]
-- [[https://tour.go-zh.org/][Simplified Chinese — 中文(简体)]]
-- [[https://go-tour-cz.appspot.com/][Czech — Česky]]
-- [[https://go-tour-fr.appspot.com/][French — Français]]
-- [[https://go-tour-id2.appspot.com/][Indonesian — Bahasa Indonesia]]
-- [[https://go-tour-jp.appspot.com/][Japanese — 日本語]]
-- [[https://go-tour-ko.appspot.com/][Korean — 한국어]]
-- [[https://go-tour-pl1.appspot.com/][Polish — Polski]]
-- [[https://go-tour-th.appspot.com/][Thai — ภาษาไทย]]
-- [[https://go-tour-uz.appspot.com/][Uzbek — Ўзбекча]]
-
-Click the [[javascript:highlightAndClick(".next-page")]["next"]] button or type `PageDown` to continue.
-
-#appengine: * Go offline (optional)
-#appengine:
-#appengine: This tour is also available as a stand-alone program that you can use
-#appengine: without access to the internet. It builds and runs the code samples on
-#appengine: your own machine.
-#appengine:
-#appengine: To run the tour locally, you'll need to first
-#appengine: [[https://golang.org/doc/install][install Go]] and then run:
-#appengine:
-#appengine:   go get golang.org/x/tour
-#appengine:
-#appengine: This will place a `tour` binary in your
-#appengine: [[https://golang.org/doc/code.html#Workspaces][workspace]]'s `bin` directory.
-#appengine: When you run the tour program, it will open a web browser displaying
-#appengine: your local version of the tour.
-#appengine:
-#appengine: Of course, you can continue to take the tour through this web site.
-
-#appengine: * The Go Playground
-#appengine:
-#appengine: This tour is built atop the [[https://play.golang.org/][Go Playground]], a
-#appengine: web service that runs on [[https://golang.org/][golang.org]]'s servers.
-#appengine:
-#appengine: The service receives a Go program, compiles, links, and runs the program inside
-#appengine: a sandbox, then returns the output.
-#appengine:
-#appengine: There are limitations to the programs that can be run in the playground:
-#appengine:
-#appengine: - In the playground the time begins at 2009-11-10 23:00:00 UTC (determining the significance of this date is an exercise for the reader). This makes it easier to cache programs by giving them deterministic output.
-#appengine:
-#appengine: - There are also limits on execution time and on CPU and memory usage, and the program cannot access external network hosts.
-#appengine:
-#appengine: The playground uses the latest stable release of Go.
-#appengine:
-#appengine: Read "[[https://blog.golang.org/playground][Inside the Go Playground]]" to learn more.
-#appengine:
-#appengine: .play welcome/sandbox.go
-
-* Congratulations
-
-You've finished the first module of the tour!
-
-Now click on [[javascript:highlightAndClick(".logo")][A Tour of Go]] to find out what else
-you can learn about Go, or go directly to the [[javascript:click('.next-page')][next lesson]].
diff --git a/content/welcome/hello.go b/content/welcome/hello.go
deleted file mode 100644
index b480451..0000000
--- a/content/welcome/hello.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	fmt.Println("Hello, 世界")
-}
diff --git a/content/welcome/sandbox.go b/content/welcome/sandbox.go
deleted file mode 100644
index 398a9ef..0000000
--- a/content/welcome/sandbox.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"time"
-)
-
-func main() {
-	fmt.Println("Welcome to the playground!")
-
-	fmt.Println("The time is", time.Now())
-}
diff --git a/fmt.go b/fmt.go
deleted file mode 100644
index 0a0be16..0000000
--- a/fmt.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package main
-
-import (
-	"bytes"
-	"encoding/json"
-	"go/ast"
-	"go/parser"
-	"go/printer"
-	"go/token"
-	"net/http"
-
-	"golang.org/x/tools/imports"
-)
-
-func init() {
-	http.HandleFunc("/fmt", fmtHandler)
-}
-
-type fmtResponse struct {
-	Body  string
-	Error string
-}
-
-func fmtHandler(w http.ResponseWriter, r *http.Request) {
-	resp := new(fmtResponse)
-	var body string
-	var err error
-	if r.FormValue("imports") == "true" {
-		var b []byte
-		b, err = imports.Process("prog.go", []byte(r.FormValue("body")), nil)
-		body = string(b)
-	} else {
-		body, err = gofmt(r.FormValue("body"))
-	}
-	if err != nil {
-		resp.Error = err.Error()
-	} else {
-		resp.Body = body
-	}
-	json.NewEncoder(w).Encode(resp)
-}
-
-func gofmt(body string) (string, error) {
-	fset := token.NewFileSet()
-	f, err := parser.ParseFile(fset, "prog.go", body, parser.ParseComments)
-	if err != nil {
-		return "", err
-	}
-	ast.SortImports(fset, f)
-	var buf bytes.Buffer
-	config := &printer.Config{Mode: printer.UseSpaces | printer.TabIndent, Tabwidth: 8}
-	err = config.Fprint(&buf, fset, f)
-	if err != nil {
-		return "", err
-	}
-	return buf.String(), nil
-}
diff --git a/go.mod b/go.mod
index ceb57a7..593d3e7 100644
--- a/go.mod
+++ b/go.mod
@@ -1,5 +1,3 @@
 module golang.org/x/tour
 
-go 1.11
-
-require golang.org/x/tools v0.1.3-0.20210525215409-a3eb095d6aee
+go 1.16
diff --git a/go.sum b/go.sum
deleted file mode 100644
index f2eedd1..0000000
--- a/go.sum
+++ /dev/null
@@ -1,29 +0,0 @@
-github.com/yuin/goldmark v1.3.5 h1:dPmz1Snjq0kmkz159iL7S6WzdahUTHnHB5M56WFVifs=
-github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
-golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
-golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
-golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
-golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=
-golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
-golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
-golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
-golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
-golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
-golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
-golang.org/x/tools v0.1.3-0.20210525215409-a3eb095d6aee h1:qoXIhA/wpnHg2z8RiA/rZb66+iiULmKyO9olVAU+GfU=
-golang.org/x/tools v0.1.3-0.20210525215409-a3eb095d6aee/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
-golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
-golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
diff --git a/gotour/main.go b/gotour/main.go
deleted file mode 100644
index b0b2d50..0000000
--- a/gotour/main.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package main
-
-import (
-	"io"
-	"os"
-)
-
-func main() {
-	io.WriteString(os.Stderr, "golang.org/x/tour/gotour has moved to golang.org/x/tour\n")
-	os.Exit(1)
-}
diff --git a/local.go b/local.go
deleted file mode 100644
index 076cf94..0000000
--- a/local.go
+++ /dev/null
@@ -1,227 +0,0 @@
-// Copyright 2011 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package main
-
-import (
-	"encoding/json"
-	"flag"
-	"go/build"
-	"html/template"
-	"io"
-	"log"
-	"net"
-	"net/http"
-	"net/url"
-	"os"
-	"os/exec"
-	"path/filepath"
-	"runtime"
-	"runtime/debug"
-	"strings"
-	"time"
-
-	"golang.org/x/tools/playground/socket"
-
-	// Imports so that go build/install automatically installs them.
-	_ "golang.org/x/tour/pic"
-	_ "golang.org/x/tour/tree"
-	_ "golang.org/x/tour/wc"
-)
-
-const (
-	socketPath = "/socket"
-)
-
-var (
-	httpListen  = flag.String("http", "127.0.0.1:3999", "host:port to listen on")
-	openBrowser = flag.Bool("openbrowser", true, "open browser automatically")
-)
-
-var (
-	httpAddr string
-)
-
-// isRoot reports whether path is the root directory of the tour tree.
-// To be the root, it must have content and template subdirectories.
-func isRoot(path string) bool {
-	_, err := os.Stat(filepath.Join(path, "content", "welcome.article"))
-	if err == nil {
-		_, err = os.Stat(filepath.Join(path, "template", "index.tmpl"))
-	}
-	return err == nil
-}
-
-// findRoot is a best-effort attempt to find a tour directory
-// that contains the files it needs. It may not always work.
-//
-// TODO: Delete after Go 1.17 is out and we can just use embed; see CL 291849.
-func findRoot() (string, bool) {
-	// Try finding the golang.org/x/tour package in the
-	// legacy GOPATH mode workspace or in build list.
-	p, err := build.Import("golang.org/x/tour", "", build.FindOnly)
-	if err == nil && isRoot(p.Dir) {
-		return p.Dir, true
-	}
-	// If that didn't work, perhaps we're not inside any module
-	// and the binary was built in module mode (e.g., 'go install
-	// golang.org/x/tour@latest' or 'go get golang.org/x/tour'
-	// outside a module).
-	// In that's the case, find out what version it is,
-	// and access its content from the module cache.
-	if info, ok := debug.ReadBuildInfo(); ok &&
-		info.Main.Path == "golang.org/x/tour" &&
-		info.Main.Replace == nil &&
-		info.Main.Version != "(devel)" {
-		// Make some assumptions for brevity:
-		// • the 'go' binary is in $PATH
-		// • the main module isn't replaced
-		// • the version isn't "(devel)"
-		// They should hold for the use cases we care about, until this
-		// entire mechanism is obsoleted by file embedding.
-		out, execError := exec.Command("go", "mod", "download", "-json", "--", "golang.org/x/tour@"+info.Main.Version).Output()
-		var tourRoot struct{ Dir string }
-		jsonError := json.Unmarshal(out, &tourRoot)
-		if execError == nil && jsonError == nil && isRoot(tourRoot.Dir) {
-			return tourRoot.Dir, true
-		}
-	}
-	return "", false
-}
-
-func main() {
-	flag.Parse()
-
-	if os.Getenv("GAE_ENV") == "standard" {
-		log.Println("running in App Engine Standard mode")
-		gaeMain()
-		return
-	}
-
-	// find and serve the go tour files
-	root, ok := findRoot()
-	if !ok {
-		log.Fatalln("Couldn't find files for the Go tour. Try reinstalling it.")
-	}
-
-	log.Println("Serving content from", root)
-
-	host, port, err := net.SplitHostPort(*httpListen)
-	if err != nil {
-		log.Fatal(err)
-	}
-	if host == "" {
-		host = "localhost"
-	}
-	if host != "127.0.0.1" && host != "localhost" {
-		log.Print(localhostWarning)
-	}
-	httpAddr = host + ":" + port
-
-	if err := initTour(root, "SocketTransport"); err != nil {
-		log.Fatal(err)
-	}
-
-	http.HandleFunc("/", rootHandler)
-	http.HandleFunc("/lesson/", lessonHandler)
-
-	origin := &url.URL{Scheme: "http", Host: host + ":" + port}
-	http.Handle(socketPath, socket.NewHandler(origin))
-
-	registerStatic(root)
-
-	go func() {
-		url := "http://" + httpAddr
-		if waitServer(url) && *openBrowser && startBrowser(url) {
-			log.Printf("A browser window should open. If not, please visit %s", url)
-		} else {
-			log.Printf("Please open your web browser and visit %s", url)
-		}
-	}()
-	log.Fatal(http.ListenAndServe(httpAddr, nil))
-}
-
-// registerStatic registers handlers to serve static content
-// from the directory root.
-func registerStatic(root string) {
-	// Keep these static file handlers in sync with app.yaml.
-	http.Handle("/favicon.ico", http.FileServer(http.Dir(filepath.Join(root, "static", "img"))))
-	static := http.FileServer(http.Dir(root))
-	http.Handle("/content/img/", static)
-	http.Handle("/static/", static)
-}
-
-// rootHandler returns a handler for all the requests except the ones for lessons.
-func rootHandler(w http.ResponseWriter, r *http.Request) {
-	if err := renderUI(w); err != nil {
-		log.Println(err)
-	}
-}
-
-// lessonHandler handler the HTTP requests for lessons.
-func lessonHandler(w http.ResponseWriter, r *http.Request) {
-	lesson := strings.TrimPrefix(r.URL.Path, "/lesson/")
-	if err := writeLesson(lesson, w); err != nil {
-		if err == lessonNotFound {
-			http.NotFound(w, r)
-		} else {
-			log.Println(err)
-		}
-	}
-}
-
-const localhostWarning = `
-WARNING!  WARNING!  WARNING!
-
-The tour server appears to be listening on an address that is
-not localhost and is configured to run code snippets locally.
-Anyone with access to this address and port will have access
-to this machine as the user running gotour.
-
-If you don't understand this message, hit Control-C to terminate this process.
-
-WARNING!  WARNING!  WARNING!
-`
-
-// waitServer waits some time for the http Server to start
-// serving url. The return value reports whether it starts.
-func waitServer(url string) bool {
-	tries := 20
-	for tries > 0 {
-		resp, err := http.Get(url)
-		if err == nil {
-			resp.Body.Close()
-			return true
-		}
-		time.Sleep(100 * time.Millisecond)
-		tries--
-	}
-	return false
-}
-
-// startBrowser tries to open the URL in a browser, and returns
-// whether it succeed.
-func startBrowser(url string) bool {
-	// try to start the browser
-	var args []string
-	switch runtime.GOOS {
-	case "darwin":
-		args = []string{"open"}
-	case "windows":
-		args = []string{"cmd", "/c", "start"}
-	default:
-		args = []string{"xdg-open"}
-	}
-	cmd := exec.Command(args[0], append(args[1:], url)...)
-	return cmd.Start() == nil
-}
-
-// prepContent for the local tour simply returns the content as-is.
-var prepContent = func(r io.Reader) io.Reader { return r }
-
-// socketAddr returns the WebSocket handler address.
-var socketAddr = func() string { return "ws://" + httpAddr + socketPath }
-
-// analyticsHTML is optional analytics HTML to insert at the beginning of <head>.
-var analyticsHTML template.HTML
diff --git a/solutions/README b/solutions/README
deleted file mode 100644
index 4915dc7..0000000
--- a/solutions/README
+++ /dev/null
@@ -1,8 +0,0 @@
-This directory contains the solutions to the exercises presented in the Go tour.
-
-IMPORTANT: The main point of the Go tour is to challenge you, so please try to
-solve all problems by yourself before reading these solutions!!!
-
-In any case, these are not the only valid solutions. But they have been reviewed
-by the Go team. Therefore you can use them as a guide on how to solve the
-most basic problems in Go.
diff --git a/solutions/binarytrees.go b/solutions/binarytrees.go
deleted file mode 100644
index 2ba3604..0000000
--- a/solutions/binarytrees.go
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"fmt"
-
-	"golang.org/x/tour/tree"
-)
-
-func walkImpl(t *tree.Tree, ch chan int) {
-	if t == nil {
-		return
-	}
-	walkImpl(t.Left, ch)
-	ch <- t.Value
-	walkImpl(t.Right, ch)
-}
-
-// Walk walks the tree t sending all values
-// from the tree to the channel ch.
-func Walk(t *tree.Tree, ch chan int) {
-	walkImpl(t, ch)
-	// Need to close the channel here
-	close(ch)
-}
-
-// Same determines whether the trees
-// t1 and t2 contain the same values.
-// NOTE: The implementation leaks goroutines when trees are different.
-// See binarytrees_quit.go for a better solution.
-func Same(t1, t2 *tree.Tree) bool {
-	w1, w2 := make(chan int), make(chan int)
-
-	go Walk(t1, w1)
-	go Walk(t2, w2)
-
-	for {
-		v1, ok1 := <-w1
-		v2, ok2 := <-w2
-		if !ok1 || !ok2 {
-			return ok1 == ok2
-		}
-		if v1 != v2 {
-			return false
-		}
-	}
-}
-
-func main() {
-	fmt.Print("tree.New(1) == tree.New(1): ")
-	if Same(tree.New(1), tree.New(1)) {
-		fmt.Println("PASSED")
-	} else {
-		fmt.Println("FAILED")
-	}
-
-	fmt.Print("tree.New(1) != tree.New(2): ")
-	if !Same(tree.New(1), tree.New(2)) {
-		fmt.Println("PASSED")
-	} else {
-		fmt.Println("FAILED")
-	}
-}
diff --git a/solutions/binarytrees_quit.go b/solutions/binarytrees_quit.go
deleted file mode 100644
index 076bd66..0000000
--- a/solutions/binarytrees_quit.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2015 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"fmt"
-
-	"golang.org/x/tour/tree"
-)
-
-func walkImpl(t *tree.Tree, ch, quit chan int) {
-	if t == nil {
-		return
-	}
-	walkImpl(t.Left, ch, quit)
-	select {
-	case ch <- t.Value:
-		// Value successfully sent.
-	case <-quit:
-		return
-	}
-	walkImpl(t.Right, ch, quit)
-}
-
-// Walk walks the tree t sending all values
-// from the tree to the channel ch.
-func Walk(t *tree.Tree, ch, quit chan int) {
-	walkImpl(t, ch, quit)
-	close(ch)
-}
-
-// Same determines whether the trees
-// t1 and t2 contain the same values.
-func Same(t1, t2 *tree.Tree) bool {
-	w1, w2 := make(chan int), make(chan int)
-	quit := make(chan int)
-	defer close(quit)
-
-	go Walk(t1, w1, quit)
-	go Walk(t2, w2, quit)
-
-	for {
-		v1, ok1 := <-w1
-		v2, ok2 := <-w2
-		if !ok1 || !ok2 {
-			return ok1 == ok2
-		}
-		if v1 != v2 {
-			return false
-		}
-	}
-}
-
-func main() {
-	fmt.Print("tree.New(1) == tree.New(1): ")
-	if Same(tree.New(1), tree.New(1)) {
-		fmt.Println("PASSED")
-	} else {
-		fmt.Println("FAILED")
-	}
-
-	fmt.Print("tree.New(1) != tree.New(2): ")
-	if !Same(tree.New(1), tree.New(2)) {
-		fmt.Println("PASSED")
-	} else {
-		fmt.Println("FAILED")
-	}
-}
diff --git a/solutions/errors.go b/solutions/errors.go
deleted file mode 100644
index e8de49e..0000000
--- a/solutions/errors.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type ErrNegativeSqrt float64
-
-func (e ErrNegativeSqrt) Error() string {
-	return fmt.Sprintf("Sqrt: negative number %g", e)
-}
-
-const delta = 1e-10
-
-func Sqrt(f float64) (float64, error) {
-	if f < 0 {
-		return 0, ErrNegativeSqrt(f)
-	}
-	z := f
-	for {
-		n := z - (z*z-f)/(2*z)
-		if math.Abs(n-z) < delta {
-			break
-		}
-		z = n
-	}
-	return z, nil
-}
-
-func main() {
-	fmt.Println(Sqrt(2))
-	fmt.Println(Sqrt(-2))
-}
diff --git a/solutions/fib.go b/solutions/fib.go
deleted file mode 100644
index 0f3959a..0000000
--- a/solutions/fib.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import "fmt"
-
-// fibonacci is a function that returns
-// a function that returns an int.
-func fibonacci() func() int {
-	f, g := 1, 0
-	return func() int {
-		f, g = g, f+g
-		return f
-	}
-}
-
-func main() {
-	f := fibonacci()
-	for i := 0; i < 10; i++ {
-		fmt.Println(f())
-	}
-}
diff --git a/solutions/http.go b/solutions/http.go
deleted file mode 100644
index 9fe3d5f..0000000
--- a/solutions/http.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2014 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"fmt"
-	"log"
-	"net/http"
-)
-
-type String string
-
-func (s String) ServeHTTP(w http.ResponseWriter, r *http.Request) {
-	fmt.Fprint(w, s)
-}
-
-type Struct struct {
-	Greeting string
-	Punct    string
-	Who      string
-}
-
-func (s *Struct) ServeHTTP(w http.ResponseWriter, r *http.Request) {
-	fmt.Fprintf(w, "%s%s %s", s.Greeting, s.Punct, s.Who)
-}
-
-func main() {
-	http.Handle("/string", String("I'm a frayed knot."))
-	http.Handle("/struct", &Struct{"Hello", ":", "Gophers!"})
-	err := http.ListenAndServe("localhost:4000", nil)
-	if err != nil {
-		log.Fatal(err)
-	}
-}
diff --git a/solutions/image.go b/solutions/image.go
deleted file mode 100644
index 60d9c5e..0000000
--- a/solutions/image.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"image"
-	"image/color"
-
-	"golang.org/x/tour/pic"
-)
-
-type Image struct {
-	Height, Width int
-}
-
-func (m Image) ColorModel() color.Model {
-	return color.RGBAModel
-}
-
-func (m Image) Bounds() image.Rectangle {
-	return image.Rect(0, 0, m.Height, m.Width)
-}
-
-func (m Image) At(x, y int) color.Color {
-	c := uint8(x ^ y)
-	return color.RGBA{c, c, 255, 255}
-}
-
-func main() {
-	m := Image{256, 256}
-	pic.ShowImage(m)
-}
diff --git a/solutions/loops.go b/solutions/loops.go
deleted file mode 100644
index 296138f..0000000
--- a/solutions/loops.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-const delta = 1e-6
-
-func Sqrt(x float64) float64 {
-	z := x
-	n := 0.0
-	for math.Abs(n-z) > delta {
-		n, z = z, z-(z*z-x)/(2*z)
-	}
-	return z
-}
-
-func main() {
-	const x = 2
-	mine, theirs := Sqrt(x), math.Sqrt(x)
-	fmt.Println(mine, theirs, mine-theirs)
-}
diff --git a/solutions/maps.go b/solutions/maps.go
deleted file mode 100644
index ddd6b52..0000000
--- a/solutions/maps.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"strings"
-
-	"golang.org/x/tour/wc"
-)
-
-func WordCount(s string) map[string]int {
-	m := make(map[string]int)
-	for _, f := range strings.Fields(s) {
-		m[f]++
-	}
-	return m
-}
-
-func main() {
-	wc.Test(WordCount)
-}
diff --git a/solutions/readers.go b/solutions/readers.go
deleted file mode 100644
index 278cd65..0000000
--- a/solutions/readers.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import "golang.org/x/tour/reader"
-
-type MyReader struct{}
-
-func (r MyReader) Read(b []byte) (int, error) {
-	for i := range b {
-		b[i] = 'A'
-	}
-	return len(b), nil
-}
-
-func main() {
-	reader.Validate(MyReader{})
-}
diff --git a/solutions/rot13.go b/solutions/rot13.go
deleted file mode 100644
index 84315a4..0000000
--- a/solutions/rot13.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"io"
-	"os"
-	"strings"
-)
-
-func rot13(b byte) byte {
-	var a, z byte
-	switch {
-	case 'a' <= b && b <= 'z':
-		a, z = 'a', 'z'
-	case 'A' <= b && b <= 'Z':
-		a, z = 'A', 'Z'
-	default:
-		return b
-	}
-	return (b-a+13)%(z-a+1) + a
-}
-
-type rot13Reader struct {
-	r io.Reader
-}
-
-func (r rot13Reader) Read(p []byte) (n int, err error) {
-	n, err = r.r.Read(p)
-	for i := 0; i < n; i++ {
-		p[i] = rot13(p[i])
-	}
-	return
-}
-
-func main() {
-	s := strings.NewReader(
-		"Lbh penpxrq gur pbqr!")
-	r := rot13Reader{s}
-	io.Copy(os.Stdout, &r)
-}
diff --git a/solutions/slices.go b/solutions/slices.go
deleted file mode 100644
index 37bf9b3..0000000
--- a/solutions/slices.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import "golang.org/x/tour/pic"
-
-func Pic(dx, dy int) [][]uint8 {
-	p := make([][]uint8, dy)
-	for i := range p {
-		p[i] = make([]uint8, dx)
-	}
-
-	for y, row := range p {
-		for x := range row {
-			row[x] = uint8(x * y)
-		}
-	}
-
-	return p
-}
-
-func main() {
-	pic.Show(Pic)
-}
diff --git a/solutions/stringers.go b/solutions/stringers.go
deleted file mode 100644
index 7462f4c..0000000
--- a/solutions/stringers.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2015 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import "fmt"
-
-type IPAddr [4]byte
-
-func (ip IPAddr) String() string {
-	return fmt.Sprintf("%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3])
-}
-
-func main() {
-	addrs := map[string]IPAddr{
-		"loopback":  {127, 0, 0, 1},
-		"googleDNS": {8, 8, 8, 8},
-	}
-	for n, a := range addrs {
-		fmt.Printf("%v: %v\n", n, a)
-	}
-}
diff --git a/solutions/webcrawler.go b/solutions/webcrawler.go
deleted file mode 100644
index 89b86a8..0000000
--- a/solutions/webcrawler.go
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"errors"
-	"fmt"
-	"sync"
-)
-
-type Fetcher interface {
-	// Fetch returns the body of URL and
-	// a slice of URLs found on that page.
-	Fetch(url string) (body string, urls []string, err error)
-}
-
-// fetched tracks URLs that have been (or are being) fetched.
-// The lock must be held while reading from or writing to the map.
-// See https://golang.org/ref/spec#Struct_types section on embedded types.
-var fetched = struct {
-	m map[string]error
-	sync.Mutex
-}{m: make(map[string]error)}
-
-var loading = errors.New("url load in progress") // sentinel value
-
-// Crawl uses fetcher to recursively crawl
-// pages starting with url, to a maximum of depth.
-func Crawl(url string, depth int, fetcher Fetcher) {
-	if depth <= 0 {
-		fmt.Printf("<- Done with %v, depth 0.\n", url)
-		return
-	}
-
-	fetched.Lock()
-	if _, ok := fetched.m[url]; ok {
-		fetched.Unlock()
-		fmt.Printf("<- Done with %v, already fetched.\n", url)
-		return
-	}
-	// We mark the url to be loading to avoid others reloading it at the same time.
-	fetched.m[url] = loading
-	fetched.Unlock()
-
-	// We load it concurrently.
-	body, urls, err := fetcher.Fetch(url)
-
-	// And update the status in a synced zone.
-	fetched.Lock()
-	fetched.m[url] = err
-	fetched.Unlock()
-
-	if err != nil {
-		fmt.Printf("<- Error on %v: %v\n", url, err)
-		return
-	}
-	fmt.Printf("Found: %s %q\n", url, body)
-	done := make(chan bool)
-	for i, u := range urls {
-		fmt.Printf("-> Crawling child %v/%v of %v : %v.\n", i, len(urls), url, u)
-		go func(url string) {
-			Crawl(url, depth-1, fetcher)
-			done <- true
-		}(u)
-	}
-	for i, u := range urls {
-		fmt.Printf("<- [%v] %v/%v Waiting for child %v.\n", url, i, len(urls), u)
-		<-done
-	}
-	fmt.Printf("<- Done with %v\n", url)
-}
-
-func main() {
-	Crawl("https://golang.org/", 4, fetcher)
-
-	fmt.Println("Fetching stats\n--------------")
-	for url, err := range fetched.m {
-		if err != nil {
-			fmt.Printf("%v failed: %v\n", url, err)
-		} else {
-			fmt.Printf("%v was fetched\n", url)
-		}
-	}
-}
-
-// fakeFetcher is Fetcher that returns canned results.
-type fakeFetcher map[string]*fakeResult
-
-type fakeResult struct {
-	body string
-	urls []string
-}
-
-func (f *fakeFetcher) Fetch(url string) (string, []string, error) {
-	if res, ok := (*f)[url]; ok {
-		return res.body, res.urls, nil
-	}
-	return "", nil, fmt.Errorf("not found: %s", url)
-}
-
-// fetcher is a populated fakeFetcher.
-var fetcher = &fakeFetcher{
-	"https://golang.org/": &fakeResult{
-		"The Go Programming Language",
-		[]string{
-			"https://golang.org/pkg/",
-			"https://golang.org/cmd/",
-		},
-	},
-	"https://golang.org/pkg/": &fakeResult{
-		"Packages",
-		[]string{
-			"https://golang.org/",
-			"https://golang.org/cmd/",
-			"https://golang.org/pkg/fmt/",
-			"https://golang.org/pkg/os/",
-		},
-	},
-	"https://golang.org/pkg/fmt/": &fakeResult{
-		"Package fmt",
-		[]string{
-			"https://golang.org/",
-			"https://golang.org/pkg/",
-		},
-	},
-	"https://golang.org/pkg/os/": &fakeResult{
-		"Package os",
-		[]string{
-			"https://golang.org/",
-			"https://golang.org/pkg/",
-		},
-	},
-}
diff --git a/static/css/app.css b/static/css/app.css
deleted file mode 100755
index e2f2ffd..0000000
--- a/static/css/app.css
+++ /dev/null
@@ -1,529 +0,0 @@
-/* Generic elements */
-html, body {
-    margin: 0;
-    padding: 0;
-    font-size: 16px;
-    height: 100%;
-    font-family: sans-serif;
-    line-height: 24px;
-    word-wrap: break-word;
-    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-    /* Prevent font scaling in landscape */
-    -webkit-text-size-adjust: none;
-    -webkit-font-smoothing: antialiased;
-}
-* {
-    outline: none;
-}
-a {
-    color: #375eab;
-    text-decoration: none;
-}
-a.logo, .toc a {
-    color: inherit;
-}
-h1, h2, h3, h4 {
-    color: #333;
-    line-height: 32px;
-    margin: 0;
-}
-pre, code {
-    font-family: 'Inconsolata', monospace;
-    border-radius: 4px;
-    color: #333;
-    background-color: #fafafa;
-}
-pre {
-    padding: 10px;
-}
-code {
-    padding: 2px;
-}
-.left {
-    display: block;
-    float: left;
-    margin-right: 10px;
-}
-.right {
-    display: block;
-    float: right;
-    margin-left: 10px;
-}
-.bar {
-    display: block;
-    overflow: hidden;
-    -moz-user-select: none;
-    -webkit-user-select: none;
-    -ms-user-select: none;
-    user-select: none;
-}
-.wrapper {
-    position: fixed;
-    overflow: auto;
-    top: 48px;
-    bottom: 0;
-    left: 0;
-    right: 0;
-}
-.container {
-    max-width: 800px;
-    width: 90%;
-    margin: 0 auto 36px auto;
-    padding: 16px 5%;
-    background: #ffffff;
-}
-.container a {
-    color: #375eab;
-}
-.relative-content {
-    display: block;
-    position: relative;
-    height: 100%;
-}
-.highlight {
-    background: #b5533b !important;
-    color: yellow !important;
-}
-.hidden {
-    display: none;
-}
-p {
-    margin: 16px 0;
-}
-li {
-    margin: 8px 0;
-}
-ul {
-    list-style: none;
-    margin: 0;
-    padding-left: 32px;
-}
-/* Navigation bars */
-.top-bar {
-    position: fixed;
-    left: 0;
-    right: 0;
-    top: 0;
-    z-index: 1000;
-    font-size: 1.4em;
-    padding: 8px 24px;
-    line-height: 32px;
-    color: #222;
-    background: #E0EBF5;
-}
-.nav {
-    float: right;
-    padding: 2px;
-    height: 25px;
-    width: 25px;
-    margin-left: 10px;
-    cursor: pointer;
-    fill: #375eab;
-}
-.nav:hover {
-    fill: #ffffff;
-}
-/* Module list */
-.page-header {
-    font-size: 1.2em;
-    line-height: 32px;
-    margin: 32px 0;
-}
-@media (max-width: 515px) {
-    .page-header {
-        font-size: 0.75em;
-    }
-}
-.module {
-    margin: 32px 0;
-}
-.module-title {
-    font-size: 1.3em;
-    font-weight: bold;
-    color: #333;
-    margin: 0;
-}
-.lesson {
-    background: #E0EBF5;
-    padding: 8px 16px;
-    margin: 16px 0;
-    position: relative;
-}
-.lesson-title {
-    display: inline-block;
-    font-size: 1.2em;
-    font-weight: bold;
-    margin: 16px 0 0 0;
-    padding-right: 48px;
-}
-/* Lesson viewer */
-.slide-content {
-    padding: 16px;
-    background: #fff;
-}
-.module-bar {
-    font-size: 1.5em;
-    padding: 8px 0;
-    text-align: center;
-    line-height: 24px;
-    font-size: 24px;
-}
-.module-bar a {
-    color: #375eab;
-    position: relative;
-    font-weight: bold;
-    margin: 5px;
-}
-.menu-button {
-    display: inline-block;
-    text-decoration: none;
-    cursor: pointer;
-    font-size: 0.9em;
-    border-radius: 2px;
-    background-color: #E0EBF5;
-    border: 1px solid rgba(0, 0, 0, 0.1);
-    margin: 2px;
-    height: 24px;
-    padding: 1px 8px;
-    line-height: 24px;
-    color: #444;
-    -moz-user-select: none;
-    -webkit-user-select: none;
-    -ms-user-select: none;
-    user-select: none;
-}
-.menu-button:hover:not(.active) {
-    border: 1px solid #C6C6C6;
-    background-color: #fafafa;
-}
-.menu-button.active {
-    background: #fff;
-}
-.menu-button[imports-checkbox]:after {
-    content: ' off';
-}
-.menu-button[imports-checkbox].active:after {
-    content: ' on';
-}
-.menu-button[syntax-checkbox]:after {
-    content: ' off';
-}
-.menu-button[syntax-checkbox].active:after {
-    content: ' on';
-}
-#file-menu .menu-button {
-    float: right;
-}
-a#run, a#kill {
-    background-color: #375eab;
-    color: #fff;
-    width: 40px;
-    text-align: center;
-}
-#run:hover:not(:active), #kill:hover:not(:active) {
-    background-color: #fff;
-    color: #375eab;
-}
-.output:not(.active) {
-    display: none;
-}
-.output > pre {
-    font-family: 'Inconsolata', monospace;
-    background: #fafafa;
-    margin: 0;
-}
-.output .system {
-    color: #888;
-}
-.output .stderr {
-    color: #D00A0A;
-}
-.output-menu .menu-button {
-    float: left;
-}
-.output-menu, #file-menu {
-    background: #fafafa;
-}
-#explorer {
-    height: 32px;
-    padding-left: 30px;
-    background: #fafafa;
-}
-#explorer .imports-checkbox {
-    float: right;
-}
-#explorer .menu-button.active {
-    cursor: default;
-}
-#explorer .syntax-checkbox {
-    float: right;
-}
-/* CodeMirror */
-#file-editor {
-    background: #FFFFD8;
-    overflow: auto;
-}
-#file-editor > textarea {
-    display: none;
-}
-#file-editor .CodeMirror {
-    height: 100%;
-    background: #FFFFD8;
-}
-#file-editor .CodeMirror-lines, #file-editor .CodeMirror-gutters {
-    background: #FFFFD8;
-    font-family: 'Inconsolata', monospace;
-    line-height: 1.2em;
-}
-.CodeMirror-code > .line-error {
-    background: #FF8080;
-}
-.CodeMirror-code > .line-error .CodeMirror-linenumber {
-    color: #FF5555;
-    font-weight: bolder;
-}
-#file-editor .CodeMirror-gutters {
-    width: 32px;
-}
-@media (min-width: 601px) {
-    #editor-container {
-        position: fixed;
-        top: 48px;
-        left: 0px;
-        right: 0px;
-        bottom: 0px;
-        overflow: hidden;
-        background: #fff;
-    }
-    #left-side {
-        position: absolute;
-        top: 0;
-        bottom: 0;
-        left: 0;
-        width: 50%;
-        overflow: hidden;
-    }
-    .output {
-        background-image: url(/static/img/gopher.png);
-        background-repeat: no-repeat;
-        background-position: bottom;
-        background-color: #fff;
-    }
-    div[vertical-slide] {
-        position: absolute;
-        top: 0px;
-        bottom: 0px;
-        width: 5px;
-        background: #e0ebf5;
-        left: 50%;
-        right: 50%;
-        z-index: 100;
-        cursor: move;
-    }
-    #right-side {
-        position: absolute;
-        top: 0;
-        bottom: 0;
-        right: 0;
-        left: 50%;
-        background: #fff;
-    }
-    .slide-content {
-        position: absolute;
-        left: 0;
-        right: 0;
-        top: 0;
-        bottom: 30px;
-        overflow: auto;
-    }
-    .module-bar {
-        position: absolute;
-        left: 0;
-        right: 0;
-        bottom: 0;
-        padding: 4px 0;
-        margin: 0;
-    }
-    #top-part {
-        position: absolute;
-        left: 0;
-        right: 0;
-        top: 0;
-        bottom: 33%;
-        background: #e0ebf5;
-    }
-    #file-editor {
-        position: absolute;
-        left: 0;
-        right: 0;
-        top: 0;
-        bottom: 0;
-    }
-    div[horizontal-slide] {
-        position: absolute;
-        left: 0;
-        right: 0;
-        bottom: 33%;
-        height: 5px;
-        background: #e0ebf5;
-        z-index: 100;
-        cursor: move;
-    }
-    #bottom-part {
-        position: absolute;
-        left: 0;
-        right: 0;
-        bottom: 0;
-        top: 67%;
-        min-height: 100px;
-        z-index: 50;
-    }
-    #explorer {
-        position: absolute;
-        top: 0;
-        left: 0;
-        right: 0;
-    }
-    #explorer + div {
-        top: 32px;
-    }
-    #file-menu {
-        position: absolute;
-        top: 0;
-        right: 0;
-        left: 0;
-        background: #fafafa;
-    }
-    .output {
-        position: absolute;
-        top: 34px;
-        bottom: 0;
-        left: 0;
-        right: 0;
-        margin: 0;
-        padding: 0;
-        overflow: auto;
-    }
-}
-@media (max-width: 600px) {
-    #top-part {
-        border: 1px solid #ccc;
-    }
-    #left-side {
-        background: #e0ebf5;
-    }
-    #right-side {
-        padding-top: 48px;
-    }
-    #file-menu {
-        height: 32px;
-    }
-    .output {
-        background: white;
-        max-height: 300px;
-        overflow: auto;
-    }
-    #editor-container {
-        padding-bottom: 40px;
-    }
-    .module-bar {
-        position: fixed;
-        background: #e0ebf5;
-        left: 0;
-        right: 0;
-        bottom: 0;
-        z-index: 10;
-        height: 42px;
-        padding: 0;
-        overflow: hidden;
-        text-align: center;
-    }
-    .module-bar * {
-        display: inline-block;
-        width: 25%;
-        font-size: 1.1em;
-        padding: 8px 0;
-    }
-    div[horizontal-slide], div[vertical-slide] {
-        display: none;
-    }
-}
-/* Table of contents */
-.toc {
-    display: none;
-    position: fixed;
-    z-index: 200;
-    font-size: 1.3em;
-    top: 48px;
-    bottom: 0;
-    right: 0;
-    width: 500px;
-    background: #e0ebf5;
-    color: black;
-    overflow-y: auto;
-    padding: 0;
-    margin: 0;
-    border-left: 4px solid #e0ebf5;
-    border-bottom: 4px solid #e0ebf5;
-    -moz-user-select: none;
-    -webkit-user-select: none;
-    -ms-user-select: none;
-    user-select: none;
-}
-.click-catcher {
-    position: fixed;
-    z-index: -100;
-    top: 0;
-    bottom: 0;
-    left: 0;
-    right: 10px; /* avoid covering the TOC scroller */
-    background: rgba(0, 0, 0, 0);
-}
-.toc * {
-    margin: 0;
-    padding: 0;
-    font-size: 0.95em;
-    display: block;
-}
-.toc span, .toc a {
-    padding: 4px;
-}
-.toc-module {
-    color: #375eab;
-    background: #e0ebf5;
-}
-.toc-lesson {
-    background: #fafafa;
-    color: #333;
-    margin: 1px 0;
-    cursor: pointer;
-}
-.toc-page {
-    background: #fff;
-    color: #333;
-    padding-left: 4px;
-    display: list-item;
-}
-.toc-lesson.active .toc-page {
-    display: list-item;
-}
-.toc-page.active {
-    color: #375eab;
-    font-weight: bold;
-}
-@media (max-width: 600px) {
-    .toc {
-        position: absolute;
-        left: 0;
-        right: 0;
-        bottom: 0;
-        width: 100%;
-        border: none;
-    }
-    .toc ul {
-        width: 100%;
-    }
-    .click-catcher {
-        display: none;
-    }
-}
diff --git a/static/img/favicon.ico b/static/img/favicon.ico
deleted file mode 100644
index 8d22584..0000000
--- a/static/img/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/static/img/gopher.png b/static/img/gopher.png
deleted file mode 100644
index 11d01ae..0000000
--- a/static/img/gopher.png
+++ /dev/null
Binary files differ
diff --git a/static/js/app.js b/static/js/app.js
deleted file mode 100755
index 7127bfc..0000000
--- a/static/js/app.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright 2012 The Go Authors.   All rights reserved.
- * Use of this source code is governed by a BSD-style
- * license that can be found in the LICENSE file.
- */
-'use strict';
-
-angular.module('tour', ['ui', 'tour.services', 'tour.controllers', 'tour.directives', 'tour.values', 'ng']).
-
-config(['$routeProvider', '$locationProvider',
-    function($routeProvider, $locationProvider) {
-        $routeProvider.
-        when('/', {
-            redirectTo: '/welcome/1'
-        }).
-        when('/list', {
-            templateUrl: '/static/partials/list.html',
-        }).
-        when('/:lessonId/:pageNumber', {
-            templateUrl: '/static/partials/editor.html',
-            controller: 'EditorCtrl'
-        }).
-        when('/:lessonId', {
-            redirectTo: '/:lessonId/1'
-        }).
-        otherwise({
-            redirectTo: '/'
-        });
-
-        $locationProvider.html5Mode(true).hashPrefix('!');
-    }
-]).
-
-// handle mapping from old paths (#42) to the new organization.
-run(function($rootScope, $location, mapping) {
-    $rootScope.$on( "$locationChangeStart", function(event, next) {
-        var url = document.createElement('a');
-        url.href = next; 
-        if (url.pathname != '/' || url.hash == '') {
-            return;
-        }
-        $location.hash('');
-        var m = mapping[url.hash];
-        if (m === undefined) {
-            console.log('unknown url, redirecting home');
-            $location.path('/welcome/1');
-            return;
-        }
-        $location.path(m);
-    });         
-});
diff --git a/static/js/controllers.js b/static/js/controllers.js
deleted file mode 100755
index f3b9cf7..0000000
--- a/static/js/controllers.js
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Copyright 2012 The Go Authors.   All rights reserved.
- * Use of this source code is governed by a BSD-style
- * license that can be found in the LICENSE file.
- */
-'use strict';
-
-/* Controllers */
-
-
-angular.module('tour.controllers', []).
-
-// Navigation controller
-controller('EditorCtrl', ['$scope', '$routeParams', '$location', 'toc', 'i18n', 'run', 'fmt', 'editor', 'analytics', 'storage',
-    function($scope, $routeParams, $location, toc, i18n, run, fmt, editor, analytics, storage) {
-        var lessons = [];
-        toc.lessons.then(function(v) {
-            lessons = v;
-            $scope.gotoPage($scope.curPage);
-
-            // Store changes on the current file to local storage.
-            $scope.$watch(function() {
-                var f = file();
-                return f && f.Content;
-            }, function(val) {
-                if (val) storage.set(file().Hash, val);
-            });
-        });
-
-        $scope.toc = toc;
-        $scope.lessonId = $routeParams.lessonId;
-        $scope.curPage = parseInt($routeParams.pageNumber);
-        $scope.curFile = 0;
-        $scope.job = null;
-
-        $scope.nextPageClick = function(event) {
-            event.preventDefault();
-            $scope.nextPage();
-        };
-        $scope.prevPageClick = function(event) {
-            event.preventDefault();
-            $scope.prevPage();
-        };
-        $scope.nextPage = function() {
-            $scope.gotoPage($scope.curPage + 1);
-        };
-        $scope.prevPage = function() {
-            $scope.gotoPage($scope.curPage - 1);
-        };
-        $scope.gotoPage = function(page) {
-            $scope.kill();
-            var l = $routeParams.lessonId;
-            if (page >= 1 && page <= lessons[$scope.lessonId].Pages.length) {
-                $scope.curPage = page;
-            } else {
-                l = (page < 1) ? toc.prevLesson(l) : toc.nextLesson(l);
-                if (l === '') { // If there's not previous or next
-                    $location.path('/list');
-                    return;
-                }
-                page = (page < 1) ? lessons[l].Pages.length : 1;
-            }
-            $location.path('/' + l + '/' + page);
-            $scope.openFile($scope.curFile);
-            analytics.trackView();
-        };
-        $scope.openFile = function(file) {
-            $scope.curFile = file;
-            editor.paint();
-        };
-
-        function log(mode, text) {
-            $('.output.active').html('<pre class="' + mode + '">' + text + '</pre>');
-        }
-
-        function clearOutput() {
-            $('.output.active').html('');
-        }
-
-        function file() {
-            return lessons[$scope.lessonId].Pages[$scope.curPage - 1].Files[$scope.curFile];
-        }
-
-        $scope.run = function() {
-            log('info', i18n.l('waiting'));
-            var f = file();
-            $scope.job = run(f.Content, $('.output.active > pre')[0], {
-                path: f.Name
-            }, function() {
-                $scope.job = null;
-                $scope.$apply();
-            });
-        };
-
-        $scope.kill = function() {
-            if ($scope.job !== null) $scope.job.Kill();
-        };
-
-        $scope.format = function() {
-            log('info', i18n.l('waiting'));
-            fmt(file().Content, editor.imports).then(
-                function(data) {
-                    if (data.data.Error !== '') {
-                        log('stderr', data.data.Error);
-                        return;
-                    }
-                    clearOutput();
-                    file().Content = data.data.Body;
-                },
-                function(error) {
-                    log('stderr', error);
-                });
-        };
-
-        $scope.reset = function() {
-            file().Content = file().OrigContent;
-        };
-    }
-]);
diff --git a/static/js/directives.js b/static/js/directives.js
deleted file mode 100755
index d7eb9bc..0000000
--- a/static/js/directives.js
+++ /dev/null
@@ -1,237 +0,0 @@
-/* Copyright 2012 The Go Authors.   All rights reserved.
- * Use of this source code is governed by a BSD-style
- * license that can be found in the LICENSE file.
- */
-'use strict';
-
-/* Directives */
-
-angular.module('tour.directives', []).
-
-// onpageup executes the given expression when Page Up is released.
-directive('onpageup', function() {
-    return function(scope, elm, attrs) {
-        elm.attr('tabindex', 0);
-        elm.keyup(function(evt) {
-            var key = evt.which || evt.keyCode;
-            if (key == 33 && !evt.ctrlKey) {
-                scope.$apply(attrs.onpageup);
-                evt.preventDefault();
-            }
-        });
-    };
-}).
-
-// onpagedown executes the given expression when Page Down is released.
-directive('onpagedown', function() {
-    return function(scope, elm, attrs) {
-        elm.attr('tabindex', 0);
-        elm.keyup(function(evt) {
-            var key = evt.which || evt.keyCode;
-            if (key == 34 && !evt.ctrlKey) {
-                scope.$apply(attrs.onpagedown);
-                evt.preventDefault();
-            }
-        });
-    };
-}).
-
-// autofocus sets the focus on the given element when the condition is true.
-directive('autofocus', function() {
-    return function(scope, elm, attrs) {
-        elm.attr('tabindex', 0);
-        scope.$watch(function() {
-            return scope.$eval(attrs.autofocus);
-        }, function(val) {
-            if (val === true) $(elm).focus();
-        });
-    };
-}).
-
-// imports-checkbox activates and deactivates
-directive('importsCheckbox', ['editor',
-    function(editor) {
-        return function(scope, elm) {
-            elm.click(function() {
-                editor.toggleImports();
-                scope.$digest();
-            });
-            scope.editor = editor;
-        };
-    }
-]).
-
-// syntax-checkbox activates and deactivates
-directive('syntaxCheckbox', ['editor',
-    function(editor) {
-        return function(scope, elm) {
-            elm.click(function() {
-                editor.toggleSyntax();
-                scope.$digest();
-            });
-            scope.editor = editor;
-        };
-    }
-]).
-
-// verticalSlide creates a sliding separator between the left and right elements.
-// e.g.:
-// <div id="header">Some content</div>
-// <div vertical-slide top="#header" bottom="#footer"></div>
-// <div id="footer">Some footer</div>
-directive('verticalSlide', ['editor',
-    function(editor) {
-        return function(scope, elm, attrs) {
-            var moveTo = function(x) {
-                if (x < 0) {
-                    x = 0;
-                }
-                if (x > $(window).width()) {
-                    x = $(window).width();
-                }
-                elm.css('left', x);
-                $(attrs.left).width(x);
-                $(attrs.right).offset({
-                    left: x
-                });
-                editor.x = x;
-            };
-
-            elm.draggable({
-                axis: 'x',
-                drag: function(event) {
-                    moveTo(event.clientX);
-                    return true;
-                },
-                containment: 'parent',
-            });
-
-            if (editor.x !== undefined) {
-                moveTo(editor.x);
-            }
-        };
-    }
-]).
-
-// horizontalSlide creates a sliding separator between the top and bottom elements.
-// <div id="menu">Some menu</div>
-// <div vertical-slide left="#menu" bottom="#content"></div>
-// <div id="content">Some content</div>
-directive('horizontalSlide', ['editor',
-    function(editor) {
-        return function(scope, elm, attrs) {
-            var moveTo = function(y) {
-                var top = $(attrs.top).offset().top;
-                if (y < top) {
-                    y = top;
-                }
-                elm.css('top', y - top);
-                $(attrs.top).height(y - top);
-                $(attrs.bottom).offset({
-                    top: y,
-                    height: 0
-                });
-                editor.y = y;
-            };
-            elm.draggable({
-                axis: 'y',
-                drag: function(event) {
-                    moveTo(event.clientY);
-                    return true;
-                },
-                containment: 'parent',
-            });
-
-            if (editor.y !== undefined) {
-                moveTo(editor.y);
-            }
-        };
-    }
-]).
-
-directive('tableOfContentsButton', ['i18n', function(i18n) {
-    var speed = 250;
-    return {
-        restrict: 'A',
-        templateUrl: '/static/partials/toc-button.html',
-        link: function(scope, elm, attrs) {
-            scope.tocMessage = i18n.l('toc');
-            elm.on('click', function() {
-                var toc = $(attrs.tableOfContentsButton);
-                // hide all non active lessons before displaying the toc.
-                var visible = toc.css('display') != 'none';
-                if (!visible) {
-                    toc.find('.toc-lesson:not(.active) .toc-page').hide();
-                    toc.find('.toc-lesson.active .toc-page').show();
-                }
-                toc.toggle('slide', {
-                    direction: 'right'
-                }, speed);
-
-                // if fullscreen hide the rest of the content when showing the atoc.
-                var fullScreen = toc.width() == $(window).width();
-                if (fullScreen) $('#editor-container')[visible ? 'show' : 'hide']();
-            });
-        }
-    };
-}]).
-
-// side bar with dynamic table of contents
-directive('tableOfContents', ['$routeParams', 'toc',
-    function($routeParams, toc) {
-        var speed = 250;
-        return {
-            restrict: 'A',
-            templateUrl: '/static/partials/toc.html',
-            link: function(scope, elm) {
-                scope.toc = toc;
-                scope.params = $routeParams;
-
-                scope.toggleLesson = function(id) {
-                    var l = $('#toc-l-' + id + ' .toc-page');
-                    l[l.css('display') == 'none' ? 'slideDown' : 'slideUp']();
-                };
-
-                scope.$watch(function() {
-                    return scope.params.lessonId + scope.params.lessonId;
-                }, function() {
-                    $('.toc-lesson:not(#toc-l-' + scope.params.lessonId + ') .toc-page').slideUp(speed);
-                });
-
-                scope.hideTOC = function(fullScreenOnly) {
-                    var fullScreen = elm.find('.toc').width() == $(window).width();
-                    if (fullScreenOnly && !fullScreen) {
-                        return;
-                    }
-                    $('.toc').toggle('slide', {
-                        direction: 'right'
-                    }, speed);
-                    $('#editor-container').show();
-                };
-            }
-        };
-    }
-]).
-
-directive('feedbackButton', ['i18n', function(i18n) {
-    return {
-        restrict: 'A',
-        templateUrl: '/static/partials/feedback-button.html',
-        link: function(scope, elm, attrs) {
-            scope.feedbackMessage = i18n.l('submit-feedback');
-
-            elm.on('click', function() {
-                var context = window.location.pathname === '/list'
-                    ? '/list'
-                    : '/' + scope.params.lessonId + '/' + scope.params.pageNumber;
-	        context = window.location.protocol + '//' + window.location.host + context;
-                var title = i18n.l('issue-title');
-                var body = i18n.l('context') + ': '+ context + '\n\n'+ i18n.l('issue-message');
-                var url = 'https://' + i18n.l('github-repo') + '/issues/new'
-                    + '?title=' + encodeURIComponent(title)
-                    + '&body=' + encodeURIComponent(body);
-                window.open(url);
-            });
-        }
-    };
-}]);
diff --git a/static/js/services.js b/static/js/services.js
deleted file mode 100755
index da5f79c..0000000
--- a/static/js/services.js
+++ /dev/null
@@ -1,249 +0,0 @@
-/* Copyright 2012 The Go Authors.   All rights reserved.
- * Use of this source code is governed by a BSD-style
- * license that can be found in the LICENSE file.
- */
-'use strict';
-
-/* Services */
-
-angular.module('tour.services', []).
-
-// Google Analytics
-factory('analytics', ['$window',
-    function(win) {
-        var track = win.trackPageview || (function() {});
-        return {
-            trackView: track
-        };
-    }
-]).
-
-// Internationalization
-factory('i18n', ['translation',
-    function(translation) {
-        return {
-            l: function(key) {
-                if (translation[key]) return translation[key];
-                return '(no translation for ' + key + ')';
-            }
-        };
-    }
-]).
-
-// Running code
-factory('run', ['$window', 'editor',
-    function(win, editor) {
-        var writeInterceptor = function(writer, done) {
-            return function(write) {
-                if (write.Kind == 'stderr') {
-                    var lines = write.Body.split('\n');
-                    for (var i in lines) {
-                        var match = lines[i].match(/.*\.go:([0-9]+): ([^\n]*)/);
-                        if (match !== null) {
-                            editor.highlight(match[1], match[2]);
-                        }
-                    }
-                }
-                writer(write);
-                if (write.Kind == 'end') done();
-            };
-        };
-        return function(code, output, options, done) {
-            // We want to build tour snippets in module mode, so append
-            // a default go.mod file when it is not already included in
-            // the txtar archive.
-            //
-            // The exercises use golang.org/x/tour/{pic,reader,tree,wc}
-            // packages, so include the golang.org/x/tour module in the
-            // build list.
-            const hasGoMod = code.indexOf('\n-- go.mod --\n') !== -1 || code.startsWith('-- go.mod --\n');
-            if (!hasGoMod) {
-                code += '\n' +
-                    '-- go.mod --\n' +
-                    'module example\n' +
-                    'require golang.org/x/tour v0.0.0-20201207214521-004403599411\n' +
-                    '-- go.sum --\n' +
-                    'golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=\n' +
-                    'golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=\n' +
-                    'golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\n' +
-                    'golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=\n' +
-                    'golang.org/x/tools v0.0.0-20190312164927-7b79afddac43/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=\n' +
-                    'golang.org/x/tour v0.0.0-20201207214521-004403599411 h1:dJ4kVwSGlrLZXW6eo2IOer4Pm3wl2GIG4fytRziMgL8=\n' +
-                    'golang.org/x/tour v0.0.0-20201207214521-004403599411/go.mod h1:qMugOFWX59KzC8Nx7f2uvXxKxAqJfi1J6ZUHAWKnrRA=\n';
-            }
-
-            // PlaygroundOutput is defined in playground.js which is prepended
-            // to the generated script.js in gotour/tour.go.
-            // The next line removes the jshint warning.
-            // global PlaygroundOutput
-            return win.transport.Run(code, writeInterceptor(PlaygroundOutput(output), done), options);
-        };
-    }
-]).
-
-// Formatting code
-factory('fmt', ['$http',
-    function($http) {
-        return function(body, imports) {
-            var params = $.param({
-                'body': body,
-                'imports': imports,
-            });
-            var headers = {
-                'Content-Type': 'application/x-www-form-urlencoded'
-            };
-            return $http.post('/fmt', params, {
-                headers: headers
-            });
-        };
-    }
-]).
-
-// Local storage, persistent to page refreshing.
-factory('storage', ['$window',
-    function(win) {
-        try {
-            // This will raise an exception if cookies are disabled.
-            win.localStorage = win.localStorage;
-            return {
-                get: function(key) {
-                    return win.localStorage.getItem(key);
-                },
-                set: function(key, val) {
-                    win.localStorage.setItem(key, val);
-                }
-            };
-        } catch (e) {
-            return {
-                get: function() {
-                    return null;
-                },
-                set: function() {}
-            };
-        }
-    }
-]).
-
-// Editor context service, kept through the whole app.
-factory('editor', ['$window', 'storage',
-    function(win, storage) {
-        var ctx = {
-            imports: storage.get('imports') === 'true',
-            toggleImports: function() {
-                ctx.imports = !ctx.imports;
-                storage.set('imports', ctx.imports);
-            },
-            syntax: storage.get('syntax') === 'true',
-            toggleSyntax: function() {
-                ctx.syntax = !ctx.syntax;
-                storage.set('syntax', ctx.syntax);
-                ctx.paint();
-            },
-            paint: function() {
-                var mode = ctx.syntax && 'text/x-go' || 'text/x-go-comment';
-                // Wait for codemirror to start.
-                var set = function() {
-                    if ($('.CodeMirror').length > 0) {
-                        var cm = $('.CodeMirror')[0].CodeMirror;
-                        if (cm.getOption('mode') == mode) {
-                            cm.refresh();
-                            return;
-                        }
-                        cm.setOption('mode', mode);
-                    }
-                    win.setTimeout(set, 10);
-                };
-                set();
-            },
-            highlight: function(line, message) {
-                $('.CodeMirror-code > div:nth-child(' + line + ')')
-                    .addClass('line-error').attr('title', message);
-            },
-            onChange: function() {
-                $('.line-error').removeClass('line-error').attr('title', null);
-            }
-        };
-        // Set in the window so the onChange function in the codemirror config
-        // can call it.
-        win.codeChanged = ctx.onChange;
-        return ctx;
-    }
-]).
-
-// Table of contents management and navigation
-factory('toc', ['$http', '$q', '$log', 'tableOfContents', 'storage',
-    function($http, $q, $log, tableOfContents, storage) {
-        var modules = tableOfContents;
-
-        var lessons = {};
-
-        var prevLesson = function(id) {
-            var mod = lessons[id].module;
-            var idx = mod.lessons.indexOf(id);
-            if (idx < 0) return '';
-            if (idx > 0) return mod.lessons[idx - 1];
-
-            idx = modules.indexOf(mod);
-            if (idx <= 0) return '';
-            mod = modules[idx - 1];
-            return mod.lessons[mod.lessons.length - 1];
-        };
-
-        var nextLesson = function(id) {
-            var mod = lessons[id].module;
-            var idx = mod.lessons.indexOf(id);
-            if (idx < 0) return '';
-            if (idx + 1 < mod.lessons.length) return mod.lessons[idx + 1];
-
-            idx = modules.indexOf(mod);
-            if (idx < 0 || modules.length <= idx + 1) return '';
-            mod = modules[idx + 1];
-            return mod.lessons[0];
-        };
-
-        $http.get('/lesson/').then(
-            function(data) {
-                lessons = data.data;
-                for (var m = 0; m < modules.length; m++) {
-                    var module = modules[m];
-                    module.lesson = {};
-                    for (var l = 0; l < modules[m].lessons.length; l++) {
-                        var lessonName = module.lessons[l];
-                        var lesson = lessons[lessonName];
-                        lesson.module = module;
-                        module.lesson[lessonName] = lesson;
-
-                        // replace file contents with locally stored copies.
-                        for (var p = 0; p < lesson.Pages.length; p++) {
-                            var page = lesson.Pages[p];
-                            for (var f = 0; f < page.Files.length; f++) {
-                                page.Files[f].OrigContent = page.Files[f].Content;
-                                var val = storage.get(page.Files[f].Hash);
-                                if (val !== null) {
-                                    page.Files[f].Content = val;
-                                }
-                            }
-                        }
-                    }
-                }
-                moduleQ.resolve(modules);
-                lessonQ.resolve(lessons);
-            },
-            function(error) {
-                $log.error('error loading lessons : ', error);
-                moduleQ.reject(error);
-                lessonQ.reject(error);
-            }
-        );
-
-        var moduleQ = $q.defer();
-        var lessonQ = $q.defer();
-
-        return {
-            modules: moduleQ.promise,
-            lessons: lessonQ.promise,
-            prevLesson: prevLesson,
-            nextLesson: nextLesson
-        };
-    }
-]);
diff --git a/static/js/values.js b/static/js/values.js
deleted file mode 100644
index 1c24ddc..0000000
--- a/static/js/values.js
+++ /dev/null
@@ -1,167 +0,0 @@
-/* Copyright 2012 The Go Authors.   All rights reserved.
- * Use of this source code is governed by a BSD-style
- * license that can be found in the LICENSE file.
- */
-'use strict';
-
-angular.module('tour.values', []).
-
-// List of modules with description and lessons in it.
-value('tableOfContents', [{
-    'id': 'mechanics',
-    'title': 'Using the tour',
-    'description': '<p>Welcome to a tour of the <a href="https://golang.org">Go programming language</a>. The tour covers the most important features of the language, mainly:</p>',
-    'lessons': ['welcome']
-}, {
-    'id': 'basics',
-    'title': 'Basics',
-    'description': '<p>The starting point, learn all the basics of the language.</p><p>Declaring variables, calling functions, and all the things you need to know before moving to the next lessons.</p>',
-    'lessons': ['basics', 'flowcontrol', 'moretypes']
-}, {
-    'id': 'methods',
-    'title': 'Methods and interfaces',
-    'description': '<p>Learn how to define methods on types, how to declare interfaces, and how to put everything together.</p>',
-    'lessons': ['methods']
-}, {
-    'id': 'concurrency',
-    'title': 'Concurrency',
-    'description': '<p>Go provides concurrency features as part of the core language.</p><p>This module goes over goroutines and channels, and how they are used to implement different concurrency patterns.</p>',
-    'lessons': ['concurrency']
-}]).
-
-// translation
-value('translation', {
-    'off': 'off',
-    'on': 'on',
-    'syntax': 'Syntax-Highlighting',
-    'lineno': 'Line-Numbers',
-    'reset': 'Reset Slide',
-    'format': 'Format Source Code',
-    'kill': 'Kill Program',
-    'run': 'Run',
-    'compile': 'Compile and Run',
-    'more': 'Options',
-    'toc': 'Table of Contents',
-    'prev': 'Previous',
-    'next': 'Next',
-    'waiting': 'Waiting for remote server...',
-    'errcomm': 'Error communicating with remote server.',
-    'submit-feedback': 'Send feedback about this page',
-
-    // GitHub issue template: update repo and messaging when translating.
-    'github-repo': 'github.com/golang/tour',
-    'issue-title': 'tour: [REPLACE WITH SHORT DESCRIPTION]',
-    'issue-message': 'Change the title above to describe your issue and add your feedback here, including code if necessary',
-    'context': 'Context',
-}).
-
-// Config for codemirror plugin
-value('ui.config', {
-    codemirror: {
-        mode: 'text/x-go',
-        matchBrackets: true,
-        lineNumbers: true,
-        autofocus: true,
-        indentWithTabs: true,
-        indentUnit: 4,
-        tabSize: 4,
-        lineWrapping: true,
-        extraKeys: {
-            'Shift-Enter': function() {
-                $('#run').click();
-            },
-            'Ctrl-Enter': function() {
-                $('#format').click();
-            },
-            'PageDown': function() {
-                return false;
-            },
-            'PageUp': function() {
-                return false;
-            },
-        },
-        // TODO: is there a better way to do this?
-        // AngularJS values can't depend on factories.
-        onChange: function() {
-            if (window.codeChanged !== null) window.codeChanged();
-        }
-    }
-}).
-
-// mapping from the old paths (#42) to the new organization.
-// The values have been generated with the map.sh script in the tools directory.
-value('mapping', {
-    '#1': '/welcome/1', // Hello, 世界
-    '#2': '/welcome/2', // Go local
-    '#3': '/basics/1', // Packages
-    '#4': '/basics/2', // Imports
-    '#5': '/basics/3', // Exported names
-    '#6': '/basics/4', // Functions
-    '#7': '/basics/5', // Functions continued
-    '#8': '/basics/6', // Multiple results
-    '#9': undefined, // Named results
-    '#10': '/basics/8', // Variables
-    '#11': '/basics/9', // Variables with initializers
-    '#12': '/basics/10', // Short variable declarations
-    '#13': '/basics/11', // Basic types
-    '#14': '/basics/13', // Type conversions
-    '#15': '/basics/15', // Constants
-    '#16': '/basics/16', // Numeric Constants
-    '#17': '/flowcontrol/1', // For
-    '#18': '/flowcontrol/2', // For continued
-    '#19': '/flowcontrol/3', // For is Go's "while"
-    '#20': '/flowcontrol/4', // Forever
-    '#21': '/flowcontrol/5', // If
-    '#22': '/flowcontrol/6', // If with a short statement
-    '#23': '/flowcontrol/7', // If and else
-    '#24': '/flowcontrol/8', // Exercise: Loops and Functions
-    '#25': '/moretypes/2', // Structs
-    '#26': '/moretypes/3', // Struct Fields
-    '#27': '/moretypes/1', // Pointers
-    '#28': '/moretypes/5', // Struct Literals
-    '#29': undefined, // The new function
-    '#30': '/moretypes/6', // Arrays
-    '#31': '/moretypes/7', // Slices
-    '#32': '/moretypes/8', // Slicing slices
-    '#33': '/moretypes/9', // Making slices
-    '#34': '/moretypes/10', // Nil slices
-    '#35': '/moretypes/12', // Range
-    '#36': '/moretypes/13', // Range continued
-    '#37': '/moretypes/14', // Exercise: Slices
-    '#38': '/moretypes/15', // Maps
-    '#39': '/moretypes/16', // Map literals
-    '#40': '/moretypes/17', // Map literals continued
-    '#41': '/moretypes/18', // Mutating Maps
-    '#42': '/moretypes/19', // Exercise: Maps
-    '#43': '/moretypes/20', // Function values
-    '#44': '/moretypes/21', // Function closures
-    '#45': '/moretypes/22', // Exercise: Fibonacci closure
-    '#46': '/flowcontrol/9', // Switch
-    '#47': '/flowcontrol/10', // Switch evaluation order
-    '#48': '/flowcontrol/11', // Switch with no condition
-    '#49': undefined, // Advanced Exercise: Complex cube roots
-    '#50': undefined, // Methods and Interfaces
-    '#51': '/methods/1', // Methods
-    '#52': '/methods/2', // Methods continued
-    '#53': '/methods/3', // Methods with pointer receivers
-    '#54': '/methods/4', // Interfaces
-    '#55': '/methods/5', // Interfaces are satisfied implicitly
-    '#56': '/methods/8', // Errors
-    '#57': '/methods/9', // Exercise: Errors
-    '#58': '/methods/13', // Web servers
-    '#59': '/methods/14', // Exercise: HTTP Handlers
-    '#60': '/methods/15', // Images
-    '#61': '/methods/16', // Exercise: Images
-    '#62': undefined, // Exercise: Rot13 Reader
-    '#63': undefined, // Concurrency
-    '#64': '/concurrency/1', // Goroutines
-    '#65': '/concurrency/2', // Channels
-    '#66': '/concurrency/3', // Buffered Channels
-    '#67': '/concurrency/4', // Range and Close
-    '#68': '/concurrency/5', // Select
-    '#69': '/concurrency/6', // Default Selection
-    '#70': '/concurrency/7', // Exercise: Equivalent Binary Trees
-    '#71': '/concurrency/8', // Exercise: Equivalent Binary Trees
-    '#72': '/concurrency/9', // Exercise: Web Crawler
-    '#73': '/concurrency/10', // Where to Go from here...
-});
diff --git a/static/lib/angular-ui.min.js b/static/lib/angular-ui.min.js
deleted file mode 100644
index 6b031ab..0000000
--- a/static/lib/angular-ui.min.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * AngularUI - The companion suite for AngularJS
- * @version v0.4.0 - 2013-02-15
- * @link http://angular-ui.github.com
- * @license MIT License, http://www.opensource.org/licenses/MIT
- */
-angular.module("ui.config",[]).value("ui.config",{}),angular.module("ui.filters",["ui.config"]),angular.module("ui.directives",["ui.config"]),angular.module("ui",["ui.filters","ui.directives","ui.config"]),angular.module("ui.directives").directive("uiAnimate",["ui.config","$timeout",function(e,t){var n={};return angular.isString(e.animate)?n["class"]=e.animate:e.animate&&(n=e.animate),{restrict:"A",link:function(e,r,i){var s={};i.uiAnimate&&(s=e.$eval(i.uiAnimate),angular.isString(s)&&(s={"class":s})),s=angular.extend({"class":"ui-animate"},n,s),r.addClass(s["class"]),t(function(){r.removeClass(s["class"])},20,!1)}}}]),angular.module("ui.directives").directive("uiCalendar",["ui.config","$parse",function(e,t){return e.uiCalendar=e.uiCalendar||{},{require:"ngModel",restrict:"A",link:function(t,n,r,i){function a(){t.calendar=n.html("");var i=t.calendar.fullCalendar("getView");i&&(i=i.name);var o,u={defaultView:i,eventSources:s};r.uiCalendar?o=t.$eval(r.uiCalendar):o={},angular.extend(u,e.uiCalendar,o),t.calendar.fullCalendar(u)}var s=t.$eval(r.ngModel),o=0,u=function(){var e=t.$eval(r.equalsTracker);return o=0,angular.forEach(s,function(e,t){angular.isArray(e)&&(o+=e.length)}),angular.isNumber(e)?o+s.length+e:o+s.length};a(),t.$watch(u,function(e,t){a()})}}}]),angular.module("ui.directives").directive("uiCodemirror",["ui.config","$timeout",function(e,t){"use strict";var n=["cursorActivity","viewportChange","gutterClick","focus","blur","scroll","update"];return{restrict:"A",require:"ngModel",link:function(r,i,s,o){var u,a,f,l,c;if(i[0].type!=="textarea")throw new Error("uiCodemirror3 can only be applied to a textarea element");u=e.codemirror||{},a=angular.extend({},u,r.$eval(s.uiCodemirror)),f=function(e){return function(t,n){var i=t.getValue();i!==o.$viewValue&&(o.$setViewValue(i),r.$apply()),typeof e=="function"&&e(t,n)}},l=function(){c=CodeMirror.fromTextArea(i[0],a),c.on("change",f(a.onChange));for(var e=0,u=n.length,l;e<u;++e){l=a["on"+n[e].charAt(0).toUpperCase()+n[e].slice(1)];if(l===void 0)continue;if(typeof l!="function")continue;c.on(n[e],l)}o.$formatters.push(function(e){if(angular.isUndefined(e)||e===null)return"";if(angular.isObject(e)||angular.isArray(e))throw new Error("ui-codemirror cannot use an object or an array as a model");return e}),o.$render=function(){c.setValue(o.$viewValue)},s.uiRefresh&&r.$watch(s.uiRefresh,function(e,n){e!==n&&t(c.refresh)})},t(l)}}}]),angular.module("ui.directives").directive("uiCurrency",["ui.config","currencyFilter",function(e,t){var n={pos:"ui-currency-pos",neg:"ui-currency-neg",zero:"ui-currency-zero"};return e.currency&&angular.extend(n,e.currency),{restrict:"EAC",require:"ngModel",link:function(e,r,i,s){var o,u,a;o=angular.extend({},n,e.$eval(i.uiCurrency)),u=function(e){var n;return n=e*1,r.toggleClass(o.pos,n>0),r.toggleClass(o.neg,n<0),r.toggleClass(o.zero,n===0),e===""?r.text(""):r.text(t(n,o.symbol)),!0},s.$render=function(){a=s.$viewValue,r.val(a),u(a)}}}}]),angular.module("ui.directives").directive("uiDate",["ui.config",function(e){"use strict";var t;return t={},angular.isObject(e.date)&&angular.extend(t,e.date),{require:"?ngModel",link:function(t,n,r,i){var s=function(){return angular.extend({},e.date,t.$eval(r.uiDate))},o=function(){var e=s();if(i){var r=function(){t.$apply(function(){var e=n.datepicker("getDate");n.datepicker("setDate",n.val()),i.$setViewValue(e),n.blur()})};if(e.onSelect){var o=e.onSelect;e.onSelect=function(e,n){r(),t.$apply(function(){o(e,n)})}}else e.onSelect=r;n.bind("change",r),i.$render=function(){var e=i.$viewValue;if(angular.isDefined(e)&&e!==null&&!angular.isDate(e))throw new Error("ng-Model value must be a Date object - currently it is a "+typeof e+" - use ui-date-format to convert it from a string");n.datepicker("setDate",e)}}n.datepicker("destroy"),n.datepicker(e),i&&i.$render()};t.$watch(s,o,!0)}}}]).directive("uiDateFormat",["ui.config",function(e){var t={require:"ngModel",link:function(t,n,r,i){var s=r.uiDateFormat||e.dateFormat;s?(i.$formatters.push(function(e){if(angular.isString(e))return $.datepicker.parseDate(s,e)}),i.$parsers.push(function(e){if(e)return $.datepicker.formatDate(s,e)})):(i.$formatters.push(function(e){if(angular.isString(e))return new Date(e)}),i.$parsers.push(function(e){if(e)return e.toISOString()}))}};return t}]),angular.module("ui.directives").directive("uiEvent",["$parse",function(e){return function(t,n,r){var i=t.$eval(r.uiEvent);angular.forEach(i,function(r,i){var s=e(r);n.bind(i,function(e){var n=Array.prototype.slice.call(arguments);n=n.splice(1),t.$apply(function(){s(t,{$event:e,$params:n})})})})}}]),angular.module("ui.directives").directive("uiIf",[function(){return{transclude:"element",priority:1e3,terminal:!0,restrict:"A",compile:function(e,t,n){return function(e,t,r){var i,s;e.$watch(r.uiIf,function(r){i&&(i.remove(),i=undefined),s&&(s.$destroy(),s=undefined),r&&(s=e.$new(),n(s,function(e){i=e,t.after(e)}))})}}}}]),angular.module("ui.directives").directive("uiJq",["ui.config","$timeout",function(t,n){return{restrict:"A",compile:function(r,i){if(!angular.isFunction(r[i.uiJq]))throw new Error('ui-jq: The "'+i.uiJq+'" function does not exist');var s=t.jq&&t.jq[i.uiJq];return function(t,r,i){function u(){n(function(){r[i.uiJq].apply(r,o)},0,!1)}var o=[];i.uiOptions?(o=t.$eval("["+i.uiOptions+"]"),angular.isObject(s)&&angular.isObject(o[0])&&(o[0]=angular.extend({},s,o[0]))):s&&(o=[s]),i.ngModel&&r.is("select,input,textarea")&&r.on("change",function(){r.trigger("input")}),i.uiRefresh&&t.$watch(i.uiRefresh,function(e){u()}),u()}}}}]),angular.module("ui.directives").factory("keypressHelper",["$parse",function(t){var n={8:"backspace",9:"tab",13:"enter",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"delete"},r=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};return function(e,i,s,o){var u,a=[];u=i.$eval(o["ui"+r(e)]),angular.forEach(u,function(e,n){var r,i;i=t(e),angular.forEach(n.split(" "),function(e){r={expression:i,keys:{}},angular.forEach(e.split("-"),function(e){r.keys[e]=!0}),a.push(r)})}),s.bind(e,function(t){var r=t.metaKey||t.altKey,s=t.ctrlKey,o=t.shiftKey,u=t.keyCode;e==="keypress"&&!o&&u>=97&&u<=122&&(u-=32),angular.forEach(a,function(e){var u=e.keys[n[t.keyCode]]||e.keys[t.keyCode.toString()]||!1,a=e.keys.alt||!1,f=e.keys.ctrl||!1,l=e.keys.shift||!1;u&&a==r&&f==s&&l==o&&i.$apply(function(){e.expression(i,{$event:t})})})})}}]),angular.module("ui.directives").directive("uiKeydown",["keypressHelper",function(e){return{link:function(t,n,r){e("keydown",t,n,r)}}}]),angular.module("ui.directives").directive("uiKeypress",["keypressHelper",function(e){return{link:function(t,n,r){e("keypress",t,n,r)}}}]),angular.module("ui.directives").directive("uiKeyup",["keypressHelper",function(e){return{link:function(t,n,r){e("keyup",t,n,r)}}}]),function(){function t(e,t,n,r){angular.forEach(t.split(" "),function(t){var i={type:"map-"+t};google.maps.event.addListener(n,t,function(t){r.triggerHandler(angular.extend({},i,t)),e.$$phase||e.$apply()})})}function n(n,r){e.directive(n,[function(){return{restrict:"A",link:function(e,i,s){e.$watch(s[n],function(n){t(e,r,n,i)})}}}])}var e=angular.module("ui.directives");e.directive("uiMap",["ui.config","$parse",function(e,n){var r="bounds_changed center_changed click dblclick drag dragend dragstart heading_changed idle maptypeid_changed mousemove mouseout mouseover projection_changed resize rightclick tilesloaded tilt_changed zoom_changed",i=e.map||{};return{restrict:"A",link:function(e,s,o){var u=angular.extend({},i,e.$eval(o.uiOptions)),a=new google.maps.Map(s[0],u),f=n(o.uiMap);f.assign(e,a),t(e,r,a,s)}}}]),e.directive("uiMapInfoWindow",["ui.config","$parse","$compile",function(e,n,r){var i="closeclick content_change domready position_changed zindex_changed",s=e.mapInfoWindow||{};return{link:function(e,o,u){var a=angular.extend({},s,e.$eval(u.uiOptions));a.content=o[0];var f=n(u.uiMapInfoWindow),l=f(e);l||(l=new google.maps.InfoWindow(a),f.assign(e,l)),t(e,i,l,o),o.replaceWith("<div></div>");var c=l.open;l.open=function(n,i,s,u,a,f){r(o.contents())(e),c.call(l,n,i,s,u,a,f)}}}}]),n("uiMapMarker","animation_changed click clickable_changed cursor_changed dblclick drag dragend draggable_changed dragstart flat_changed icon_changed mousedown mouseout mouseover mouseup position_changed rightclick shadow_changed shape_changed title_changed visible_changed zindex_changed"),n("uiMapPolyline","click dblclick mousedown mousemove mouseout mouseover mouseup rightclick"),n("uiMapPolygon","click dblclick mousedown mousemove mouseout mouseover mouseup rightclick"),n("uiMapRectangle","bounds_changed click dblclick mousedown mousemove mouseout mouseover mouseup rightclick"),n("uiMapCircle","center_changed click dblclick mousedown mousemove mouseout mouseover mouseup radius_changed rightclick"),n("uiMapGroundOverlay","click dblclick")}(),angular.module("ui.directives").directive("uiMask",[function(){return{require:"ngModel",link:function(e,t,n,r){r.$render=function(){var i=r.$viewValue||"";t.val(i),t.mask(e.$eval(n.uiMask))},r.$parsers.push(function(e){var n=t.isMaskValid()||angular.isUndefined(t.isMaskValid())&&t.val().length>0;return r.$setValidity("mask",n),n?e:undefined}),t.bind("keyup",function(){e.$apply(function(){r.$setViewValue(t.mask())})})}}}]),angular.module("ui.directives").directive("uiReset",["ui.config",function(e){var t=null;return e.reset!==undefined&&(t=e.reset),{require:"ngModel",link:function(e,n,r,i){var s;s=angular.element('<a class="ui-reset" />'),n.wrap('<span class="ui-resetwrap" />').after(s),s.bind("click",function(n){n.preventDefault(),e.$apply(function(){r.uiReset?i.$setViewValue(e.$eval(r.uiReset)):i.$setViewValue(t),i.$render()})})}}}]),angular.module("ui.directives").directive("uiRoute",["$location","$parse",function(e,t){return{restrict:"AC",compile:function(n,r){var i;if(r.uiRoute)i="uiRoute";else if(r.ngHref)i="ngHref";else{if(!r.href)throw new Error("uiRoute missing a route or href property on "+n[0]);i="href"}return function(n,r,s){function a(t){(hash=t.indexOf("#"))>-1&&(t=t.substr(hash+1)),u=function(){o(n,e.path().indexOf(t)>-1)},u()}function f(t){(hash=t.indexOf("#"))>-1&&(t=t.substr(hash+1)),u=function(){var i=new RegExp("^"+t+"$",["i"]);o(n,i.test(e.path()))},u()}var o=t(s.ngModel||s.routeModel||"$uiRoute").assign,u=angular.noop;switch(i){case"uiRoute":s.uiRoute?f(s.uiRoute):s.$observe("uiRoute",f);break;case"ngHref":s.ngHref?a(s.ngHref):s.$observe("ngHref",a);break;case"href":a(s.href)}n.$on("$routeChangeSuccess",function(){u()})}}}}]),angular.module("ui.directives").directive("uiScrollfix",["$window",function(e){"use strict";return{link:function(t,n,r){var i=n.offset().top;r.uiScrollfix?r.uiScrollfix.charAt(0)==="-"?r.uiScrollfix=i-r.uiScrollfix.substr(1):r.uiScrollfix.charAt(0)==="+"&&(r.uiScrollfix=i+parseFloat(r.uiScrollfix.substr(1))):r.uiScrollfix=i,angular.element(e).on("scroll.ui-scrollfix",function(){var t;if(angular.isDefined(e.pageYOffset))t=e.pageYOffset;else{var i=document.compatMode&&document.compatMode!=="BackCompat"?document.documentElement:document.body;t=i.scrollTop}!n.hasClass("ui-scrollfix")&&t>r.uiScrollfix?n.addClass("ui-scrollfix"):n.hasClass("ui-scrollfix")&&t<r.uiScrollfix&&n.removeClass("ui-scrollfix")})}}}]),angular.module("ui.directives").directive("uiSelect2",["ui.config","$timeout",function(e,t){var n={};return e.select2&&angular.extend(n,e.select2),{require:"?ngModel",compile:function(e,r){var i,s,o,u=e.is("select"),a=r.multiple!==undefined;return e.is("select")&&(s=e.find("option[ng-repeat], option[data-ng-repeat]"),s.length&&(o=s.attr("ng-repeat")||s.attr("data-ng-repeat"),i=jQuery.trim(o.split("|")[0]).split(" ").pop())),function(e,r,s,o){var f=angular.extend({},n,e.$eval(s.uiSelect2));u?(delete f.multiple,delete f.initSelection):a&&(f.multiple=!0);if(o){o.$render=function(){u?r.select2("val",o.$modelValue):a?o.$modelValue?angular.isArray(o.$modelValue)?r.select2("data",o.$modelValue):r.select2("val",o.$modelValue):r.select2("data",[]):angular.isObject(o.$modelValue)?r.select2("data",o.$modelValue):r.select2("val",o.$modelValue)},i&&e.$watch(i,function(e,n,i){if(!e)return;t(function(){r.select2("val",o.$viewValue),r.trigger("change")})});if(!u){r.bind("change",function(){e.$apply(function(){o.$setViewValue(r.select2("data"))})});if(f.initSelection){var l=f.initSelection;f.initSelection=function(e,t){l(e,function(e){o.$setViewValue(e),t(e)})}}}}s.$observe("disabled",function(e){r.select2(e&&"disable"||"enable")}),s.ngMultiple&&e.$watch(s.ngMultiple,function(e){r.select2(f)}),r.val(e.$eval(s.ngModel)),t(function(){r.select2(f),!f.initSelection&&!u&&o.$setViewValue(r.select2("data"))})}}}}]),angular.module("ui.directives").directive("uiShow",[function(){return function(e,t,n){e.$watch(n.uiShow,function(e,n){e?t.addClass("ui-show"):t.removeClass("ui-show")})}}]).directive("uiHide",[function(){return function(e,t,n){e.$watch(n.uiHide,function(e,n){e?t.addClass("ui-hide"):t.removeClass("ui-hide")})}}]).directive("uiToggle",[function(){return function(e,t,n){e.$watch(n.uiToggle,function(e,n){e?t.removeClass("ui-hide").addClass("ui-show"):t.removeClass("ui-show").addClass("ui-hide")})}}]),angular.module("ui.directives").directive("uiSortable",["ui.config",function(e){return{require:"?ngModel",link:function(t,n,r,i){var s,o,u,a,f,l,c,h,p;f=angular.extend({},e.sortable,t.$eval(r.uiSortable)),i&&(i.$render=function(){n.sortable("refresh")},u=function(e,t){t.item.sortable={index:t.item.index()}},a=function(e,t){t.item.sortable.resort=i},s=function(e,t){t.item.sortable.relocate=!0,i.$modelValue.splice(t.item.index(),0,t.item.sortable.moved)},o=function(e,t){i.$modelValue.length===1?t.item.sortable.moved=i.$modelValue.splice(0,1)[0]:t.item.sortable.moved=i.$modelValue.splice(t.item.sortable.index,1)[0]},onStop=function(e,n){if(n.item.sortable.resort&&!n.item.sortable.relocate){var r,i;i=n.item.sortable.index,r=n.item.index(),i<r&&r--,n.item.sortable.resort.$modelValue.splice(r,0,n.item.sortable.resort.$modelValue.splice(i,1)[0])}(n.item.sortable.resort||n.item.sortable.relocate)&&t.$apply()},h=f.start,f.start=function(e,t){u(e,t),typeof h=="function"&&h(e,t)},_stop=f.stop,f.stop=function(e,t){onStop(e,t),typeof _stop=="function"&&_stop(e,t)},p=f.update,f.update=function(e,t){a(e,t),typeof p=="function"&&p(e,t)},l=f.receive,f.receive=function(e,t){s(e,t),typeof l=="function"&&l(e,t)},c=f.remove,f.remove=function(e,t){o(e,t),typeof c=="function"&&c(e,t)}),n.sortable(f)}}}]),angular.module("ui.directives").directive("uiTinymce",["ui.config",function(e){return e.tinymce=e.tinymce||{},{require:"ngModel",link:function(t,n,r,i){var s,o={onchange_callback:function(e){e.isDirty()&&(e.save(),i.$setViewValue(n.val()),t.$$phase||t.$apply())},handle_event_callback:function(e){return this.isDirty()&&(this.save(),i.$setViewValue(n.val()),t.$$phase||t.$apply()),!0},setup:function(e){e.onSetContent.add(function(e,r){e.isDirty()&&(e.save(),i.$setViewValue(n.val()),t.$$phase||t.$apply())})}};r.uiTinymce?s=t.$eval(r.uiTinymce):s={},angular.extend(o,e.tinymce,s),setTimeout(function(){n.tinymce(o)})}}}]),angular.module("ui.directives").directive("uiValidate",function(){return{restrict:"A",require:"ngModel",link:function(e,t,n,r){var i,s,o={},u=e.$eval(n.uiValidate);if(!u)return;angular.isString(u)&&(u={validator:u}),angular.forEach(u,function(t,n){i=function(i){return e.$eval(t,{$value:i})?(r.$setValidity(n,!0),i):(r.$setValidity(n,!1),undefined)},o[n]=i,r.$formatters.push(i),r.$parsers.push(i)}),n.uiValidateWatch&&(s=e.$eval(n.uiValidateWatch),angular.isString(s)?e.$watch(s,function(){angular.forEach(o,function(e,t){e(r.$modelValue)})}):angular.forEach(s,function(t,n){e.$watch(t,function(){o[n](r.$modelValue)})}))}}}),angular.module("ui.filters").filter("format",function(){return function(e,t){if(!e)return e;var n=e.toString(),r;return t===undefined?n:!angular.isArray(t)&&!angular.isObject(t)?n.split("$0").join(t):(r=angular.isArray(t)&&"$"||":",angular.forEach(t,function(e,t){n=n.split(r+t).join(e)}),n)}}),angular.module("ui.filters").filter("highlight",function(){return function(e,t,n){return t||angular.isNumber(t)?(e=e.toString(),t=t.toString(),n?e.split(t).join('<span class="ui-match">'+t+"</span>"):e.replace(new RegExp(t,"gi"),'<span class="ui-match">$&</span>')):e}}),angular.module("ui.filters").filter("inflector",function(){function e(e){return e.replace(/^([a-z])|\s+([a-z])/g,function(e){return e.toUpperCase()})}function t(e,t){return e.replace(/[A-Z]/g,function(e){return t+e})}var n={humanize:function(n){return e(t(n," ").split("_").join(" "))},underscore:function(e){return e.substr(0,1).toLowerCase()+t(e.substr(1),"_").toLowerCase().split(" ").join("_")},variable:function(t){return t=t.substr(0,1).toLowerCase()+e(t.split("_").join(" ")).substr(1).split(" ").join(""),t}};return function(e,t,r){return t!==!1&&angular.isString(e)?(t=t||"humanize",n[t](e)):e}}),angular.module("ui.filters").filter("unique",function(){return function(e,t){if(t===!1)return e;if((t||angular.isUndefined(t))&&angular.isArray(e)){var n={},r=[],i=function(e){return angular.isObject(e)&&angular.isString(t)?e[t]:e};angular.forEach(e,function(e){var t,n=!1;for(var s=0;s<r.length;s++)if(angular.equals(i(r[s]),i(e))){n=!0;break}n||r.push(e)}),e=r}return e}});
\ No newline at end of file
diff --git a/static/lib/angular.min.js b/static/lib/angular.min.js
deleted file mode 100644
index 1068a6a..0000000
--- a/static/lib/angular.min.js
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- AngularJS v1.0.6
- (c) 2010-2012 Google, Inc. http://angularjs.org
- License: MIT
-*/
-(function(N,Y,q){'use strict';function n(b,a,c){var d;if(b)if(H(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!==n)b.forEach(a,c);else if(!b||typeof b.length!=="number"?0:typeof b.hasOwnProperty!="function"&&typeof b.constructor!="function"||b instanceof K||ca&&b instanceof ca||xa.call(b)!=="[object Object]"||typeof b.callee==="function")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 nb(b){var a=[],c;for(c in b)b.hasOwnProperty(c)&&a.push(c);return a.sort()}function fc(b,a,c){for(var d=nb(b),e=0;e<d.length;e++)a.call(c,b[d[e]],d[e]);return d}function ob(b){return function(a,c){b(c,a)}}function ya(){for(var b=aa.length,a;b;){b--;a=aa[b].charCodeAt(0);if(a==57)return aa[b]="A",aa.join("");if(a==90)aa[b]="0";else return aa[b]=String.fromCharCode(a+1),aa.join("")}aa.unshift("0");return aa.join("")}function v(b){n(arguments,function(a){a!==b&&n(a,function(a,d){b[d]=
-a})});return b}function G(b){return parseInt(b,10)}function za(b,a){return v(new (v(function(){},{prototype:b})),a)}function w(){}function na(b){return b}function I(b){return function(){return b}}function x(b){return typeof b=="undefined"}function y(b){return typeof b!="undefined"}function L(b){return b!=null&&typeof b=="object"}function B(b){return typeof b=="string"}function Ra(b){return typeof b=="number"}function oa(b){return xa.apply(b)=="[object Date]"}function E(b){return xa.apply(b)=="[object Array]"}
-function H(b){return typeof b=="function"}function pa(b){return b&&b.document&&b.location&&b.alert&&b.setInterval}function O(b){return B(b)?b.replace(/^\s*/,"").replace(/\s*$/,""):b}function gc(b){return b&&(b.nodeName||b.bind&&b.find)}function Sa(b,a,c){var d=[];n(b,function(b,g,h){d.push(a.call(c,b,g,h))});return d}function Aa(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 Ta(b,a){var c=Aa(b,a);c>=0&&b.splice(c,1);return a}function V(b,a){if(pa(b)||
-b&&b.$evalAsync&&b.$watch)throw Error("Can't copy Window or Scope");if(a){if(b===a)throw Error("Can't copy equivalent objects or arrays");if(E(b))for(var c=a.length=0;c<b.length;c++)a.push(V(b[c]));else for(c in n(a,function(b,c){delete a[c]}),b)a[c]=V(b[c])}else(a=b)&&(E(b)?a=V(b,[]):oa(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 ga(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&&c=="object")if(E(b)){if((c=b.length)==a.length){for(d=0;d<c;d++)if(!ga(b[d],a[d]))return!1;return!0}}else if(oa(b))return oa(a)&&b.getTime()==a.getTime();else{if(b&&b.$evalAsync&&b.$watch||a&&a.$evalAsync&&a.$watch||pa(b)||pa(a))return!1;c={};for(d in b)if(!(d.charAt(0)==="$"||H(b[d]))){if(!ga(b[d],a[d]))return!1;c[d]=!0}for(d in a)if(!c[d]&&d.charAt(0)!=="$"&&a[d]!==q&&!H(a[d]))return!1;return!0}return!1}function Ua(b,a){var c=
-arguments.length>2?ha.call(arguments,2):[];return H(a)&&!(a instanceof RegExp)?c.length?function(){return arguments.length?a.apply(b,c.concat(ha.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=q:pa(a)?c="$WINDOW":a&&Y===a?c="$DOCUMENT":a&&a.$evalAsync&&a.$watch&&(c="$SCOPE");return c}function da(b,a){return JSON.stringify(b,ic,a?"  ":null)}function pb(b){return B(b)?JSON.parse(b):b}function Va(b){b&&b.length!==
-0?(b=A(""+b),b=!(b=="f"||b=="0"||b=="false"||b=="no"||b=="n"||b=="[]")):b=!1;return b}function qa(b){b=u(b).clone();try{b.html("")}catch(a){}var c=u("<div>").append(b).html();try{return b[0].nodeType===3?A(c):c.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(a,b){return"<"+A(b)})}catch(d){return A(c)}}function Wa(b){var a={},c,d;n((b||"").split("&"),function(b){b&&(c=b.split("="),d=decodeURIComponent(c[0]),a[d]=y(c[1])?decodeURIComponent(c[1]):!0)});return a}function qb(b){var a=[];n(b,function(b,
-d){a.push(Xa(d,!0)+(b===!0?"":"="+Xa(b,!0)))});return a.length?a.join("&"):""}function Ya(b){return Xa(b,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function Xa(b,a){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,a?"%20":"+")}function jc(b,a){function c(a){a&&d.push(a)}var d=[b],e,g,h=["ng:app","ng-app","x-ng-app","data-ng-app"],f=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;n(h,function(a){h[a]=!0;c(Y.getElementById(a));
-a=a.replace(":","\\:");b.querySelectorAll&&(n(b.querySelectorAll("."+a),c),n(b.querySelectorAll("."+a+"\\:"),c),n(b.querySelectorAll("["+a+"]"),c))});n(d,function(a){if(!e){var b=f.exec(" "+a.className+" ");b?(e=a,g=(b[2]||"").replace(/\s+/g,",")):n(a.attributes,function(b){if(!e&&h[b.name])e=a,g=b.value})}});e&&a(e,g?[g]:[])}function rb(b,a){var c=function(){b=u(b);a=a||[];a.unshift(["$provide",function(a){a.value("$rootElement",b)}]);a.unshift("ng");var c=sb(a);c.invoke(["$rootScope","$rootElement",
-"$compile","$injector",function(a,b,c,d){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return c},d=/^NG_DEFER_BOOTSTRAP!/;if(N&&!d.test(N.name))return c();N.name=N.name.replace(d,"");Za.resumeBootstrap=function(b){n(b,function(b){a.push(b)});c()}}function $a(b,a){a=a||"_";return b.replace(kc,function(b,d){return(d?a:"")+b.toLowerCase()})}function ab(b,a,c){if(!b)throw Error("Argument '"+(a||"?")+"' is "+(c||"required"));return b}function ra(b,a,c){c&&E(b)&&(b=b[b.length-1]);ab(H(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,d,e){return function(){b[e||"push"]([c,d,arguments]);return k}}if(!e)throw Error("No module: "+d);var b=[],c=[],i=a("$injector","invoke"),k={_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:i,run:function(a){c.push(a);return this}};g&&i(g);return k})}})}function tb(b){return b.replace(mc,function(a,b,d,e){return e?d.toUpperCase():d}).replace(nc,"Moz$1")}function bb(b,a){function c(){var e;for(var b=[this],c=a,h,f,j,
-i,k,m;b.length;){h=b.shift();f=0;for(j=h.length;f<j;f++){i=u(h[f]);c?i.triggerHandler("$destroy"):c=!c;k=0;for(e=(m=i.children()).length,i=e;k<i;k++)b.push(ca(m[k]))}}return d.apply(this,arguments)}var d=ca.fn[b],d=d.$original||d;c.$original=d;ca.fn[b]=c}function K(b){if(b instanceof K)return b;if(!(this instanceof K)){if(B(b)&&b.charAt(0)!="<")throw Error("selectors not implemented");return new K(b)}if(B(b)){var a=Y.createElement("div");a.innerHTML="<div>&#160;</div>"+b;a.removeChild(a.firstChild);
-cb(this,a.childNodes);this.remove()}else cb(this,b)}function db(b){return b.cloneNode(!0)}function sa(b){ub(b);for(var a=0,b=b.childNodes||[];a<b.length;a++)sa(b[a])}function vb(b,a,c){var d=ba(b,"events");ba(b,"handle")&&(x(a)?n(d,function(a,c){eb(b,c,a);delete d[c]}):x(c)?(eb(b,a,d[a]),delete d[a]):Ta(d[a],c))}function ub(b){var a=b[Ba],c=Ca[a];c&&(c.handle&&(c.events.$destroy&&c.handle({},"$destroy"),vb(b)),delete Ca[a],b[Ba]=q)}function ba(b,a,c){var d=b[Ba],d=Ca[d||-1];if(y(c))d||(b[Ba]=d=++oc,
-d=Ca[d]={}),d[a]=c;else return d&&d[a]}function wb(b,a,c){var d=ba(b,"data"),e=y(c),g=!e&&y(a),h=g&&!L(a);!d&&!h&&ba(b,"data",d={});if(e)d[a]=c;else if(g)if(h)return d&&d[a];else v(d,a);else return d}function Da(b,a){return(" "+b.className+" ").replace(/[\n\t]/g," ").indexOf(" "+a+" ")>-1}function xb(b,a){a&&n(a.split(" "),function(a){b.className=O((" "+b.className+" ").replace(/[\n\t]/g," ").replace(" "+O(a)+" "," "))})}function yb(b,a){a&&n(a.split(" "),function(a){if(!Da(b,a))b.className=O(b.className+
-" "+O(a))})}function cb(b,a){if(a)for(var a=!a.nodeName&&y(a.length)&&!pa(a)?a:[a],c=0;c<a.length;c++)b.push(a[c])}function zb(b,a){return Ea(b,"$"+(a||"ngController")+"Controller")}function Ea(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 Ab(b,a){var c=Fa[a.toLowerCase()];return c&&Bb[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||Y;if(x(c.defaultPrevented)){var g=c.preventDefault;c.preventDefault=function(){c.defaultPrevented=!0;g.call(c)};c.defaultPrevented=!1}c.isDefaultPrevented=function(){return c.defaultPrevented};n(a[e||c.type],function(a){a.call(b,c)});Z<=8?(c.preventDefault=null,c.stopPropagation=null,c.isDefaultPrevented=null):(delete c.preventDefault,delete c.stopPropagation,delete c.isDefaultPrevented)};c.elem=b;return c}function fa(b){var a=typeof b,
-c;if(a=="object"&&b!==null)if(typeof(c=b.$$hashKey)=="function")c=b.$$hashKey();else{if(c===q)c=b.$$hashKey=ya()}else c=b;return a+":"+c}function Ga(b){n(b,this.put,this)}function fb(){}function Cb(b){var a,c;if(typeof b=="function"){if(!(a=b.$inject))a=[],c=b.toString().replace(qc,""),c=c.match(rc),n(c[1].split(sc),function(b){b.replace(tc,function(b,c,d){a.push(d)})}),b.$inject=a}else E(b)?(c=b.length-1,ra(b[c],"fn"),a=b.slice(0,c)):ra(b,"fn",!0);return a}function sb(b){function a(a){return function(b,
-c){if(L(b))n(b,ob(a));else return a(b,c)}}function c(a,b){if(H(b)||E(b))b=m.instantiate(b);if(!b.$get)throw Error("Provider "+a+" must define $get factory method.");return k[a+f]=b}function d(a,b){return c(a,{$get:b})}function e(a){var b=[];n(a,function(a){if(!i.get(a))if(i.put(a,!0),B(a)){var c=ta(a);b=b.concat(e(c.requires)).concat(c._runBlocks);try{for(var d=c._invokeQueue,c=0,f=d.length;c<f;c++){var g=d[c],j=g[0]=="$injector"?m:m.get(g[0]);j[g[1]].apply(j,g[2])}}catch(h){throw h.message&&(h.message+=
-" from "+a),h;}}else if(H(a))try{b.push(m.invoke(a))}catch(o){throw o.message&&(o.message+=" from "+a),o;}else if(E(a))try{b.push(m.invoke(a))}catch(k){throw k.message&&(k.message+=" from "+String(a[a.length-1])),k;}else ra(a,"module")});return b}function g(a,b){function c(d){if(typeof d!=="string")throw Error("Service name expected");if(a.hasOwnProperty(d)){if(a[d]===h)throw Error("Circular dependency: "+j.join(" <- "));return a[d]}else try{return j.unshift(d),a[d]=h,a[d]=b(d)}finally{j.shift()}}
-function d(a,b,e){var f=[],i=Cb(a),g,h,j;h=0;for(g=i.length;h<g;h++)j=i[h],f.push(e&&e.hasOwnProperty(j)?e[j]:c(j));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],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=(E(a)?a[a.length-1]:a).prototype;c=new c;e=d(a,c,b);return L(e)?e:c},get:c,annotate:Cb}}var h={},f="Provider",j=[],i=new Ga,k={$provide:{provider:a(c),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){k[a]=b;l[a]=b}),decorator:function(a,b){var c=m.get(a+f),d=c.$get;c.$get=function(){var a=t.invoke(d,c);return t.invoke(b,null,{$delegate:a})}}}},m=g(k,function(){throw Error("Unknown provider: "+j.join(" <- "));}),l={},t=l.$injector=g(l,function(a){a=m.get(a+f);return t.invoke(a.$get,a)});n(e(b),function(a){t.invoke(a||w)});return t}function uc(){var b=!0;this.disableAutoScrolling=function(){b=!1};this.$get=["$window","$location","$rootScope",function(a,c,d){function e(a){var b=
-null;n(a,function(a){!b&&A(a.nodeName)==="a"&&(b=a)});return b}function g(){var b=c.hash(),d;b?(d=h.getElementById(b))?d.scrollIntoView():(d=e(h.getElementsByName(b)))?d.scrollIntoView():b==="top"&&a.scrollTo(0,0):a.scrollTo(0,0)}var h=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,ha.call(arguments,1))}finally{if(o--,o===0)for(;p.length;)try{p.pop()()}catch(b){c.error(b)}}}function g(a,b){(function S(){n(s,
-function(a){a()});P=b(S,a)})()}function h(){C!=f.url()&&(C=f.url(),n(W,function(a){a(f.url())}))}var f=this,j=a[0],i=b.location,k=b.history,m=b.setTimeout,l=b.clearTimeout,t={};f.isMock=!1;var o=0,p=[];f.$$completeOutstandingRequest=e;f.$$incOutstandingRequestCount=function(){o++};f.notifyWhenNoOutstandingRequests=function(a){n(s,function(a){a()});o===0?a():p.push(a)};var s=[],P;f.addPollFn=function(a){x(P)&&g(100,m);s.push(a);return a};var C=i.href,z=a.find("base");f.url=function(a,b){if(a){if(C!=
-a)return C=a,d.history?b?k.replaceState(null,"",a):(k.pushState(null,"",a),z.attr("href",z.attr("href"))):b?i.replace(a):i.href=a,f}else return i.href.replace(/%27/g,"'")};var W=[],J=!1;f.onUrlChange=function(a){J||(d.history&&u(b).bind("popstate",h),d.hashchange?u(b).bind("hashchange",h):f.addPollFn(h),J=!0);W.push(a);return a};f.baseHref=function(){var a=z.attr("href");return a?a.replace(/^https?\:\/\/[^\/]*/,""):""};var r={},$="",Q=f.baseHref();f.cookies=function(a,b){var d,e,f,i;if(a)if(b===q)j.cookie=
-escape(a)+"=;path="+Q+";expires=Thu, 01 Jan 1970 00:00:00 GMT";else{if(B(b))d=(j.cookie=escape(a)+"="+escape(b)+";path="+Q).length+1,d>4096&&c.warn("Cookie '"+a+"' possibly not set or overflowed because it was too large ("+d+" > 4096 bytes)!")}else{if(j.cookie!==$){$=j.cookie;d=$.split("; ");r={};for(f=0;f<d.length;f++)e=d[f],i=e.indexOf("="),i>0&&(r[unescape(e.substring(0,i))]=unescape(e.substring(i+1)))}return r}};f.defer=function(a,b){var c;o++;c=m(function(){delete t[c];e(a)},b||0);t[c]=!0;return c};
-f.defer.cancel=function(a){return t[a]?(delete t[a],l(a),e(w),!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,d){function e(a){if(a!=m){if(l){if(l==a)l=a.n}else l=a;g(a.n,a.p);g(a,m);m=a;m.n=null}}function g(a,b){if(a!=b){if(a)a.p=b;if(b)b.n=a}}if(b in a)throw Error("cacheId "+b+" taken");var h=0,f=v({},d,{id:b}),j={},i=d&&d.capacity||Number.MAX_VALUE,k={},m=null,l=null;return a[b]=
-{put:function(a,b){var c=k[a]||(k[a]={key:a});e(c);x(b)||(a in j||h++,j[a]=b,h>i&&this.remove(l.key))},get:function(a){var b=k[a];if(b)return e(b),j[a]},remove:function(a){var b=k[a];if(b){if(b==m)m=b.p;if(b==l)l=b.n;g(b.n,b.p);delete k[a];delete j[a];h--}},removeAll:function(){j={};h=0;k={};m=l=null},destroy:function(){k=f=j=null;delete a[b]},info:function(){return v({},f,{size:h})}}}var a={};b.info=function(){var b={};n(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 Db(b){var a={},c="Directive",d=/^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,e=/(([\d\w\-_]+)(?:\:([^;]+))?;?)/,g="Template must have exactly one root element. was: ",h=/^\s*(https?|ftp|mailto|file):/;this.directive=function j(d,e){B(d)?(ab(e,"directive"),a.hasOwnProperty(d)||(a[d]=[],b.factory(d+c,["$injector","$exceptionHandler",function(b,c){var e=[];n(a[d],function(a){try{var g=b.invoke(a);if(H(g))g={compile:I(g)};
-else if(!g.compile&&g.link)g.compile=I(g.link);g.priority=g.priority||0;g.name=g.name||d;g.require=g.require||g.controller&&g.name;g.restrict=g.restrict||"A";e.push(g)}catch(h){c(h)}});return e}])),a[d].push(e)):n(d,ob(j));return this};this.urlSanitizationWhitelist=function(a){return y(a)?(h=a,this):h};this.$get=["$injector","$interpolate","$exceptionHandler","$http","$templateCache","$parse","$controller","$rootScope","$document",function(b,i,k,m,l,t,o,p,s){function P(a,b,c){a instanceof u||(a=u(a));
-n(a,function(b,c){b.nodeType==3&&b.nodeValue.match(/\S+/)&&(a[c]=u(b).wrap("<span></span>").parent()[0])});var d=z(a,b,a,c);return function(b,c){ab(b,"scope");for(var e=c?va.clone.call(a):a,g=0,i=e.length;g<i;g++){var h=e[g];(h.nodeType==1||h.nodeType==9)&&e.eq(g).data("$scope",b)}C(e,"ng-scope");c&&c(e,b);d&&d(b,e,e);return e}}function C(a,b){try{a.addClass(b)}catch(c){}}function z(a,b,c,d){function e(a,c,d,i){var h,j,k,o,l,m,t,s=[];l=0;for(m=c.length;l<m;l++)s.push(c[l]);t=l=0;for(m=g.length;l<
-m;t++)j=s[t],c=g[l++],h=g[l++],c?(c.scope?(k=a.$new(L(c.scope)),u(j).data("$scope",k)):k=a,(o=c.transclude)||!i&&b?c(h,k,j,d,function(b){return function(c){var d=a.$new();d.$$transcluded=!0;return b(d,c).bind("$destroy",Ua(d,d.$destroy))}}(o||b)):c(h,k,j,q,i)):h&&h(a,j.childNodes,q,i)}for(var g=[],i,h,j,k=0;k<a.length;k++)h=new ia,i=W(a[k],[],h,d),h=(i=i.length?J(i,a[k],h,b,c):null)&&i.terminal||!a[k].childNodes||!a[k].childNodes.length?null:z(a[k].childNodes,i?i.transclude:b),g.push(i),g.push(h),
-j=j||i||h;return j?e:null}function W(a,b,c,i){var g=c.$attr,h;switch(a.nodeType){case 1:r(b,ea(gb(a).toLowerCase()),"E",i);var j,k,l;h=a.attributes;for(var o=0,m=h&&h.length;o<m;o++)if(j=h[o],j.specified)k=j.name,l=ea(k.toLowerCase()),g[l]=k,c[l]=j=O(Z&&k=="href"?decodeURIComponent(a.getAttribute(k,2)):j.value),Ab(a,l)&&(c[l]=!0),S(a,b,j,l),r(b,l,"A",i);a=a.className;if(B(a)&&a!=="")for(;h=e.exec(a);)l=ea(h[2]),r(b,l,"C",i)&&(c[l]=O(h[3])),a=a.substr(h.index+h[0].length);break;case 3:y(b,a.nodeValue);
-break;case 8:try{if(h=d.exec(a.nodeValue))l=ea(h[1]),r(b,l,"M",i)&&(c[l]=O(h[2]))}catch(t){}}b.sort(F);return b}function J(a,b,c,d,e){function i(a,b){if(a)a.require=r.require,m.push(a);if(b)b.require=r.require,s.push(b)}function h(a,b){var c,d="data",e=!1;if(B(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 Error("No controller: "+a);}else E(a)&&(c=[],n(a,function(a){c.push(h(a,b))}));return c}function j(a,d,e,
-i,g){var l,p,r,D,C;l=b===e?c:hc(c,new ia(u(e),c.$attr));p=l.$$element;if(J){var P=/^\s*([@=&])\s*(\w*)\s*$/,ja=d.$parent||d;n(J.scope,function(a,b){var c=a.match(P)||[],e=c[2]||b,c=c[1],i,g,h;d.$$isolateBindings[b]=c+e;switch(c){case "@":l.$observe(e,function(a){d[b]=a});l.$$observers[e].$$scope=ja;break;case "=":g=t(l[e]);h=g.assign||function(){i=d[b]=g(ja);throw Error(Eb+l[e]+" (directive: "+J.name+")");};i=d[b]=g(ja);d.$watch(function(){var a=g(ja);a!==d[b]&&(a!==i?i=d[b]=a:h(ja,a=i=d[b]));return a});
-break;case "&":g=t(l[e]);d[b]=function(a){return g(ja,a)};break;default:throw Error("Invalid isolate scope definition for directive "+J.name+": "+a);}})}y&&n(y,function(a){var b={$scope:d,$element:p,$attrs:l,$transclude:g};C=a.controller;C=="@"&&(C=l[a.name]);p.data("$"+a.name+"Controller",o(C,b))});i=0;for(r=m.length;i<r;i++)try{D=m[i],D(d,p,l,D.require&&h(D.require,p))}catch(z){k(z,qa(p))}a&&a(d,e.childNodes,q,g);i=0;for(r=s.length;i<r;i++)try{D=s[i],D(d,p,l,D.require&&h(D.require,p))}catch(zc){k(zc,
-qa(p))}}for(var l=-Number.MAX_VALUE,m=[],s=[],p=null,J=null,z=null,D=c.$$element=u(b),r,F,T,ka,S=d,y,x,X,v=0,A=a.length;v<A;v++){r=a[v];T=q;if(l>r.priority)break;if(X=r.scope)ua("isolated scope",J,r,D),L(X)&&(C(D,"ng-isolate-scope"),J=r),C(D,"ng-scope"),p=p||r;F=r.name;if(X=r.controller)y=y||{},ua("'"+F+"' controller",y[F],r,D),y[F]=r;if(X=r.transclude)ua("transclusion",ka,r,D),ka=r,l=r.priority,X=="element"?(T=u(b),D=c.$$element=u(Y.createComment(" "+F+": "+c[F]+" ")),b=D[0],w(e,u(T[0]),b),S=P(T,
-d,l)):(T=u(db(b)).contents(),D.html(""),S=P(T,d));if(X=r.template)if(ua("template",z,r,D),z=r,X=Fb(X),r.replace){T=u("<div>"+O(X)+"</div>").contents();b=T[0];if(T.length!=1||b.nodeType!==1)throw Error(g+X);w(e,D,b);F={$attr:{}};a=a.concat(W(b,a.splice(v+1,a.length-(v+1)),F));$(c,F);A=a.length}else D.html(X);if(r.templateUrl)ua("template",z,r,D),z=r,j=Q(a.splice(v,a.length-v),j,D,c,e,r.replace,S),A=a.length;else if(r.compile)try{x=r.compile(D,c,S),H(x)?i(null,x):x&&i(x.pre,x.post)}catch(G){k(G,qa(D))}if(r.terminal)j.terminal=
-!0,l=Math.max(l,r.priority)}j.scope=p&&p.scope;j.transclude=ka&&S;return j}function r(d,e,i,g){var h=!1;if(a.hasOwnProperty(e))for(var l,e=b.get(e+c),o=0,m=e.length;o<m;o++)try{if(l=e[o],(g===q||g>l.priority)&&l.restrict.indexOf(i)!=-1)d.push(l),h=!0}catch(t){k(t)}return h}function $(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;n(a,function(d,e){e.charAt(0)!="$"&&(b[e]&&(d+=(e==="style"?";":" ")+b[e]),a.$set(e,d,!0,c[e]))});n(b,function(b,i){i=="class"?(C(e,b),a["class"]=(a["class"]?a["class"]+" ":
-"")+b):i=="style"?e.attr("style",e.attr("style")+";"+b):i.charAt(0)!="$"&&!a.hasOwnProperty(i)&&(a[i]=b,d[i]=c[i])})}function Q(a,b,c,d,e,i,h){var j=[],k,o,t=c[0],s=a.shift(),p=v({},s,{controller:null,templateUrl:null,transclude:null,scope:null});c.html("");m.get(s.templateUrl,{cache:l}).success(function(l){var m,s,l=Fb(l);if(i){s=u("<div>"+O(l)+"</div>").contents();m=s[0];if(s.length!=1||m.nodeType!==1)throw Error(g+l);l={$attr:{}};w(e,c,m);W(m,a,l);$(d,l)}else m=t,c.html(l);a.unshift(p);k=J(a,m,
-d,h);for(o=z(c[0].childNodes,h);j.length;){var ia=j.pop(),l=j.pop();s=j.pop();var r=j.pop(),D=m;s!==t&&(D=db(m),w(l,u(s),D));k(function(){b(o,r,D,e,ia)},r,D,e,ia)}j=null}).error(function(a,b,c,d){throw Error("Failed to load template: "+d.url);});return function(a,c,d,e,i){j?(j.push(c),j.push(d),j.push(e),j.push(i)):k(function(){b(o,c,d,e,i)},c,d,e,i)}}function F(a,b){return b.priority-a.priority}function ua(a,b,c,d){if(b)throw Error("Multiple directives ["+b.name+", "+c.name+"] asking for "+a+" on: "+
-qa(d));}function y(a,b){var c=i(b,!0);c&&a.push({priority:0,compile:I(function(a,b){var d=b.parent(),e=d.data("$binding")||[];e.push(c);C(d.data("$binding",e),"ng-binding");a.$watch(c,function(a){b[0].nodeValue=a})})})}function S(a,b,c,d){var e=i(c,!0);e&&b.push({priority:100,compile:I(function(a,b,c){b=c.$$observers||(c.$$observers={});d==="class"&&(e=i(c[d],!0));c[d]=q;(b[d]||(b[d]=[])).$$inter=!0;(c.$$observers&&c.$$observers[d].$$scope||a).$watch(e,function(a){c.$set(d,a)})})})}function w(a,b,
-c){var d=b[0],e=d.parentNode,i,g;if(a){i=0;for(g=a.length;i<g;i++)if(a[i]==d){a[i]=c;break}}e&&e.replaceChild(c,d);c[u.expando]=d[u.expando];b[0]=c}var ia=function(a,b){this.$$element=a;this.$attr=b||{}};ia.prototype={$normalize:ea,$set:function(a,b,c,d){var e=Ab(this.$$element[0],a),i=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,"-"));if(gb(this.$$element[0])==="A"&&a==="href")D.setAttribute("href",b),e=D.href,e.match(h)||
-(this[a]=b="unsafe:"+e);c!==!1&&(b===null||b===q?this.$$element.removeAttr(d):this.$$element.attr(d,b));i&&n(i[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);p.$evalAsync(function(){e.$$inter||b(c[a])});return b}};var D=s[0].createElement("a"),T=i.startSymbol(),ka=i.endSymbol(),Fb=T=="{{"||ka=="}}"?na:function(a){return a.replace(/\{\{/g,T).replace(/}}/g,ka)};return P}]}function ea(b){return tb(b.replace(Ac,
-""))}function Bc(){var b={};this.register=function(a,c){L(a)?v(b,a):b[a]=c};this.$get=["$injector","$window",function(a,c){return function(d,e){if(B(d)){var g=d,d=b.hasOwnProperty(g)?b[g]:hb(e.$scope,g,!0)||hb(c,g,!0);ra(d,g,!0)}return a.instantiate(d,e)}}]}function Cc(){this.$get=["$window",function(b){return u(b.document)}]}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 j,i,k=0,m=[],l=d.length,t=!1,o=[];k<l;)(j=d.indexOf(b,k))!=-1&&(i=d.indexOf(a,j+e))!=-1?(k!=j&&m.push(d.substring(k,j)),m.push(k=c(t=d.substring(j+e,i))),k.exp=t,k=i+g,t=!0):(k!=l&&m.push(d.substring(k)),k=l);if(!(l=m.length))m.push(""),l=1;if(!f||t)return o.length=l,k=function(a){for(var b=0,c=l,d;b<c;b++){if(typeof(d=m[b])=="function")d=d(a),d==null||d==q?d="":typeof d!="string"&&(d=da(d));
-o[b]=d}return o.join("")},k.exp=d,k.parts=m,k}var e=b.length,g=a.length;d.startSymbol=function(){return b};d.endSymbol=function(){return a};return d}]}function Gb(b){for(var b=b.split("/"),a=b.length;a--;)b[a]=Ya(b[a]);return b.join("/")}function wa(b,a){var c=Hb.exec(b),c={protocol:c[1],host:c[3],port:G(c[5])||Ib[c[1]]||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 la(b,a,c){return b+"://"+a+(c==Ib[b]?"":":"+c)}function Fc(b,
-a,c){var d=wa(b);return decodeURIComponent(d.path)!=a||x(d.hash)||d.hash.indexOf(c)!==0?b:la(d.protocol,d.host,d.port)+a.substr(0,a.lastIndexOf("/"))+d.hash.substr(c.length)}function Gc(b,a,c){var d=wa(b);if(decodeURIComponent(d.path)==a&&!x(d.hash)&&d.hash.indexOf(c)===0)return b;else{var e=d.search&&"?"+d.search||"",g=d.hash&&"#"+d.hash||"",h=a.substr(0,a.lastIndexOf("/")),f=d.path.substr(h.length);if(d.path.indexOf(h)!==0)throw Error('Invalid url "'+b+'", missing path prefix "'+h+'" !');return la(d.protocol,
-d.host,d.port)+a+"#"+c+f+e+g}}function ib(b,a,c){a=a||"";this.$$parse=function(b){var c=wa(b,this);if(c.path.indexOf(a)!==0)throw Error('Invalid url "'+b+'", missing path prefix "'+a+'" !');this.$$path=decodeURIComponent(c.path.substr(a.length));this.$$search=Wa(c.search);this.$$hash=c.hash&&decodeURIComponent(c.hash)||"";this.$$compose()};this.$$compose=function(){var b=qb(this.$$search),c=this.$$hash?"#"+Ya(this.$$hash):"";this.$$url=Gb(this.$$path)+(b?"?"+b:"")+c;this.$$absUrl=la(this.$$protocol,
-this.$$host,this.$$port)+a+this.$$url};this.$$rewriteAppUrl=function(a){if(a.indexOf(c)==0)return a};this.$$parse(b)}function Ha(b,a,c){var d;this.$$parse=function(b){var c=wa(b,this);if(c.hash&&c.hash.indexOf(a)!==0)throw Error('Invalid url "'+b+'", missing hash prefix "'+a+'" !');d=c.path+(c.search?"?"+c.search:"");c=Hc.exec((c.hash||"").substr(a.length));this.$$path=c[1]?(c[1].charAt(0)=="/"?"":"/")+decodeURIComponent(c[1]):"";this.$$search=Wa(c[3]);this.$$hash=c[5]&&decodeURIComponent(c[5])||
-"";this.$$compose()};this.$$compose=function(){var b=qb(this.$$search),c=this.$$hash?"#"+Ya(this.$$hash):"";this.$$url=Gb(this.$$path)+(b?"?"+b:"")+c;this.$$absUrl=la(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 Jb(b,a,c,d){Ha.apply(this,arguments);this.$$rewriteAppUrl=function(b){if(b.indexOf(c)==0)return c+d+"#"+a+b.substr(c.length)}}function Ia(b){return function(){return this[b]}}
-function Kb(b,a){return function(c){if(x(c))return this[b];this[b]=a(c);this.$$compose();return this}}function Ic(){var b="",a=!1;this.hashPrefix=function(a){return y(a)?(b=a,this):b};this.html5Mode=function(b){return y(b)?(a=b,this):a};this.$get=["$rootScope","$browser","$sniffer","$rootElement",function(c,d,e,g){function h(a){c.$broadcast("$locationChangeSuccess",f.absUrl(),a)}var f,j,i,k=d.url(),m=wa(k);a?(j=d.baseHref()||"/",i=j.substr(0,j.lastIndexOf("/")),m=la(m.protocol,m.host,m.port)+i+"/",
-f=e.history?new ib(Fc(k,j,b),i,m):new Jb(Gc(k,j,b),b,m,j.substr(i.length+1))):(m=la(m.protocol,m.host,m.port)+(m.path||"")+(m.search?"?"+m.search:"")+"#"+b+"/",f=new Ha(k,b,m));g.bind("click",function(a){if(!a.ctrlKey&&!(a.metaKey||a.which==2)){for(var b=u(a.target);A(b[0].nodeName)!=="a";)if(b[0]===g[0]||!(b=b.parent())[0])return;var d=b.prop("href"),e=f.$$rewriteAppUrl(d);d&&!b.attr("target")&&e&&(f.$$parse(e),c.$apply(),a.preventDefault(),N.angular["ff-684208-preventDefault"]=!0)}});f.absUrl()!=
-k&&d.url(f.absUrl(),!0);d.onUrlChange(function(a){f.absUrl()!=a&&(c.$evalAsync(function(){var b=f.absUrl();f.$$parse(a);h(b)}),c.$$phase||c.$digest())});var l=0;c.$watch(function(){var a=d.url(),b=f.$$replace;if(!l||a!=f.absUrl())l++,c.$evalAsync(function(){c.$broadcast("$locationChangeStart",f.absUrl(),a).defaultPrevented?f.$$parse(a):(d.url(f.absUrl(),b),h(a))});f.$$replace=!1;return l});return f}]}function Jc(){this.$get=["$window",function(b){function a(a){a instanceof Error&&(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||w;return g.apply?function(){var b=[];n(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,a){function c(a){return a.indexOf(s)!=-1}function d(){return o+1<b.length?b.charAt(o+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 h(a){return"a"<=a&&a<="z"||"A"<=a&&a<="Z"||"_"==a||a=="$"}function f(a){return a=="-"||a=="+"||e(a)}function j(a,c,d){d=d||o;throw Error("Lexer Error: "+a+" at column"+(y(c)?"s "+c+"-"+o+" ["+b.substring(c,d)+"]":" "+d)+" in expression ["+b+"].");}function i(){for(var a="",c=o;o<b.length;){var i=A(b.charAt(o));if(i=="."||e(i))a+=i;else{var g=d();if(i=="e"&&f(g))a+=i;else if(f(i)&&g&&e(g)&&a.charAt(a.length-
-1)=="e")a+=i;else if(f(i)&&(!g||!e(g))&&a.charAt(a.length-1)=="e")j("Invalid exponent");else break}o++}a*=1;l.push({index:c,text:a,json:!0,fn:function(){return a}})}function k(){for(var c="",d=o,f,i,j;o<b.length;){var k=b.charAt(o);if(k=="."||h(k)||e(k))k=="."&&(f=o),c+=k;else break;o++}if(f)for(i=o;i<b.length;){k=b.charAt(i);if(k=="("){j=c.substr(f-d+1);c=c.substr(0,f-d);o=i;break}if(g(k))i++;else break}d={index:d,text:c};if(Ja.hasOwnProperty(c))d.fn=d.json=Ja[c];else{var m=Lb(c,a);d.fn=v(function(a,
-b){return m(a,b)},{assign:function(a,b){return Mb(a,c,b)}})}l.push(d);j&&(l.push({index:f,text:".",json:!1}),l.push({index:f+1,text:j,json:!1}))}function m(a){var c=o;o++;for(var d="",e=a,f=!1;o<b.length;){var i=b.charAt(o);e+=i;if(f)i=="u"?(i=b.substring(o+1,o+5),i.match(/[\da-f]{4}/i)||j("Invalid unicode escape [\\u"+i+"]"),o+=4,d+=String.fromCharCode(parseInt(i,16))):(f=Lc[i],d+=f?f:i),f=!1;else if(i=="\\")f=!0;else if(i==a){o++;l.push({index:c,text:e,string:d,json:!0,fn:function(){return d}});
-return}else d+=i;o++}j("Unterminated quote",c)}for(var l=[],t,o=0,p=[],s,P=":";o<b.length;){s=b.charAt(o);if(c("\"'"))m(s);else if(e(s)||c(".")&&e(d()))i();else if(h(s)){if(k(),"{,".indexOf(P)!=-1&&p[0]=="{"&&(t=l[l.length-1]))t.json=t.text.indexOf(".")==-1}else if(c("(){}[].,;:"))l.push({index:o,text:s,json:":[,".indexOf(P)!=-1&&c("{[")||c("}]:,")}),c("{[")&&p.unshift(s),c("}]")&&p.shift(),o++;else if(g(s)){o++;continue}else{var n=s+d(),z=Ja[s],W=Ja[n];W?(l.push({index:o,text:n,fn:W}),o+=2):z?(l.push({index:o,
-text:s,fn:z,json:"[,:".indexOf(P)!=-1&&c("+-")}),o+=1):j("Unexpected next character ",o,o+1)}P=s}return l}function Mc(b,a,c,d){function e(a,c){throw Error("Syntax Error: Token '"+c.text+"' "+a+" at column "+(c.index+1)+" of the expression ["+b+"] starting at ["+b.substring(c.index)+"].");}function g(){if(Q.length===0)throw Error("Unexpected end of expression: "+b);return Q[0]}function h(a,b,c,d){if(Q.length>0){var e=Q[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=h(b,c,d,f))?(a&&!b.json&&e("is not valid json",b),Q.shift(),b):!1}function j(a){f(a)||e("is unexpected, expecting ["+a+"]",h())}function i(a,b){return function(c,d){return a(c,d,b)}}function k(a,b,c){return function(d,e){return b(d,e,a,c)}}function m(){for(var a=[];;)if(Q.length>0&&!h("}",")",";","]")&&a.push(x()),!f(";"))return a.length==1?a[0]:function(b,c){for(var d,e=0;e<a.length;e++){var f=a[e];f&&(d=f(b,c))}return d}}function l(){for(var a=f(),b=c(a.text),d=[];;)if(a=f(":"))d.push(F());
-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 t(){for(var a=o(),b;;)if(b=f("||"))a=k(a,b.fn,o());else return a}function o(){var a=p(),b;if(b=f("&&"))a=k(a,b.fn,o());return a}function p(){var a=s(),b;if(b=f("==","!="))a=k(a,b.fn,p());return a}function s(){var a;a=n();for(var b;b=f("+","-");)a=k(a,b.fn,n());if(b=f("<",">","<=",">="))a=k(a,b.fn,s());return a}function n(){for(var a=C(),b;b=f("*","/","%");)a=k(a,
-b.fn,C());return a}function C(){var a;return f("+")?z():(a=f("-"))?k(r,a.fn,C()):(a=f("!"))?i(a.fn,C()):z()}function z(){var a;if(f("("))a=x(),j(")");else if(f("["))a=W();else if(f("{"))a=J();else{var b=f();(a=b.fn)||e("not a primary expression",b)}for(var c;b=f("(","[",".");)b.text==="("?(a=y(a,c),c=null):b.text==="["?(c=a,a=S(a)):b.text==="."?(c=a,a=u(a)):e("IMPOSSIBLE");return a}function W(){var a=[];if(g().text!="]"){do a.push(F());while(f(","))}j("]");return function(b,c){for(var d=[],e=0;e<
-a.length;e++)d.push(a[e](b,c));return d}}function J(){var a=[];if(g().text!="}"){do{var b=f(),b=b.string||b.text;j(":");var c=F();a.push({key:b,value:c})}while(f(","))}j("}");return function(b,c){for(var d={},e=0;e<a.length;e++){var f=a[e],i=f.value(b,c);d[f.key]=i}return d}}var r=I(0),$,Q=Kc(b,d),F=function(){var a=t(),c,d;return(d=f("="))?(a.assign||e("implies assignment but ["+b.substring(0,d.index)+"] can not be assigned to",d),c=t(),function(b,d){return a.assign(b,c(b,d),d)}):a},y=function(a,
-b){var c=[];if(g().text!=")"){do c.push(F());while(f(","))}j(")");return function(d,e){for(var f=[],i=b?b(d,e):d,g=0;g<c.length;g++)f.push(c[g](d,e));g=a(d,e)||w;return g.apply?g.apply(i,f):g(f[0],f[1],f[2],f[3],f[4])}},u=function(a){var b=f().text,c=Lb(b,d);return v(function(b,d){return c(a(b,d),d)},{assign:function(c,d,e){return Mb(a(c,e),b,d)}})},S=function(a){var b=F();j("]");return v(function(c,d){var e=a(c,d),f=b(c,d),i;if(!e)return q;if((e=e[f])&&e.then){i=e;if(!("$$v"in e))i.$$v=q,i.then(function(a){i.$$v=
-a});e=e.$$v}return e},{assign:function(c,d,e){return a(c,e)[b(c,e)]=d}})},x=function(){for(var a=F(),b;;)if(b=f("|"))a=k(a,b.fn,l());else return a};a?(F=t,y=u=S=x=function(){e("is not valid json",{text:b,index:0})},$=z()):$=m();Q.length!==0&&e("is an unexpected token",Q[0]);return $}function Mb(b,a,c){for(var a=a.split("."),d=0;a.length>1;d++){var e=a.shift(),g=b[e];g||(g={},b[e]=g);b=g}return b[a.shift()]=c}function hb(b,a,c){if(!a)return b;for(var a=a.split("."),d,e=b,g=a.length,h=0;h<g;h++)d=a[h],
-b&&(b=(e=b)[d]);return!c&&H(b)?Ua(e,b):b}function Nb(b,a,c,d,e){return function(g,h){var f=h&&h.hasOwnProperty(b)?h:g,j;if(f===null||f===q)return f;if((f=f[b])&&f.then){if(!("$$v"in f))j=f,j.$$v=q,j.then(function(a){j.$$v=a});f=f.$$v}if(!a||f===null||f===q)return f;if((f=f[a])&&f.then){if(!("$$v"in f))j=f,j.$$v=q,j.then(function(a){j.$$v=a});f=f.$$v}if(!c||f===null||f===q)return f;if((f=f[c])&&f.then){if(!("$$v"in f))j=f,j.$$v=q,j.then(function(a){j.$$v=a});f=f.$$v}if(!d||f===null||f===q)return f;
-if((f=f[d])&&f.then){if(!("$$v"in f))j=f,j.$$v=q,j.then(function(a){j.$$v=a});f=f.$$v}if(!e||f===null||f===q)return f;if((f=f[e])&&f.then){if(!("$$v"in f))j=f,j.$$v=q,j.then(function(a){j.$$v=a});f=f.$$v}return f}}function Lb(b,a){if(jb.hasOwnProperty(b))return jb[b];var c=b.split("."),d=c.length,e;if(a)e=d<6?Nb(c[0],c[1],c[2],c[3],c[4]):function(a,b){var e=0,i;do i=Nb(c[e++],c[e++],c[e++],c[e++],c[e++])(a,b),b=q,a=i;while(e<d);return i};else{var g="var l, fn, p;\n";n(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 jb[b]=e}function Nc(){var b={};this.$get=["$filter","$sniffer",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 w}}}]}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 h(a)}var e=function(){var f=[],j,i;return i={resolve:function(a){if(f){var c=f;f=q;j=g(a);c.length&&b(function(){for(var a,b=0,d=c.length;b<d;b++)a=c[b],j.then(a[0],a[1])})}},reject:function(a){i.resolve(h(a))},promise:{then:function(b,i){var g=e(),h=function(d){try{g.resolve((b||c)(d))}catch(e){a(e),g.reject(e)}},o=function(b){try{g.resolve((i||
-d)(b))}catch(c){a(c),g.reject(c)}};f?f.push([h,o]):j.then(h,o);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}}},h=function(a){return{then:function(c,i){var g=e();b(function(){g.resolve((i||d)(a))});return g.promise}}};return{defer:e,reject:h,when:function(f,j,i){var k=e(),m,l=function(b){try{return(j||c)(b)}catch(d){return a(d),h(d)}},t=function(b){try{return(i||d)(b)}catch(c){return a(c),h(c)}};b(function(){g(f).then(function(a){m||
-(m=!0,k.resolve(g(a).then(l,t)))},function(a){m||(m=!0,k.resolve(t(a)))})});return k.promise},all:function(a){var b=e(),c=a.length,d=[];c?n(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=function(a,c){b[a]=v({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,h,f){function j(a,b){for(var b="^"+b.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"$",c="",d=[],e={},f=/:(\w+)/g,i,g=0;(i=f.exec(b))!==null;)c+=b.slice(g,i.index),c+="([^\\/]*)",d.push(i[1]),g=f.lastIndex;c+=b.substr(g);var h=a.match(RegExp(c));h&&n(d,function(a,b){e[a]=h[b+1]});return h?e:null}function i(){var b=k(),i=t.current;if(b&&i&&b.$$route===i.$$route&&ga(b.pathParams,i.pathParams)&&
-!b.reloadOnSearch&&!l)i.params=b.params,V(i.params,d),a.$broadcast("$routeUpdate",i);else if(b||i)l=!1,a.$broadcast("$routeChangeStart",b,i),(t.current=b)&&b.redirectTo&&(B(b.redirectTo)?c.path(m(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;n(b.resolve||{},function(b,d){a.push(d);c.push(B(b)?g.get(b):g.invoke(b))});if(!y(d=b.template))if(y(d=b.templateUrl))d=h.get(d,{cache:f}).then(function(a){return a.data});
-y(d)&&(a.push("$template"),c.push(d));return e.all(c).then(function(b){var c={};n(b,function(b,d){c[a[d]]=b});return c})}}).then(function(c){if(b==t.current){if(b)b.locals=c,V(b.params,d);a.$broadcast("$routeChangeSuccess",b,i)}},function(c){b==t.current&&a.$broadcast("$routeChangeError",b,i,c)})}function k(){var a,d;n(b,function(b,e){if(!d&&(a=j(c.path(),e)))d=za(b,{params:v({},c.search(),a),pathParams:a}),d.$$route=b});return d||b[null]&&za(b[null],{params:{},pathParams:{}})}function m(a,b){var c=
-[];n((a||"").split(":"),function(a,d){if(d==0)c.push(a);else{var e=a.match(/(\w+)(.*)/),f=e[1];c.push(b[f]);c.push(e[2]||"");delete b[f]}});return c.join("")}var l=!1,t={routes:b,reload:function(){l=!0;a.$evalAsync(i)}};a.$on("$locationChangeSuccess",i);return t}]}function Rc(){this.$get=I({})}function Sc(){var b=10;this.digestTtl=function(a){arguments.length&&(b=a);return b};this.$get=["$injector","$exceptionHandler","$parse",function(a,c,d){function e(){this.$id=ya();this.$$phase=this.$parent=this.$$watchers=
-this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null;this["this"]=this.$root=this;this.$$destroyed=!1;this.$$asyncQueue=[];this.$$listeners={};this.$$isolateBindings={}}function g(a){if(j.$$phase)throw Error(j.$$phase+" already in progress");j.$$phase=a}function h(a,b){var c=d(a);ra(c,b);return c}function f(){}e.prototype={$new:function(a){if(H(a))throw Error("API-CHANGE: Use $controller to instantiate controllers.");a?(a=new e,a.$root=this.$root):(a=function(){},a.prototype=
-this,a=new a,a.$id=ya());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=h(a,"watch"),e=this.$$watchers,g={fn:b,last:f,get:d,exp:a,eq:!!c};if(!H(b)){var j=h(b||w,"listener");g.fn=function(a,b,c){j(c)}}if(!e)e=this.$$watchers=[];e.unshift(g);return function(){Ta(e,
-g)}},$digest:function(){var a,d,e,h,t,o,p,s=b,n,C=[],z,q;g("$digest");do{p=!1;n=this;do{for(t=n.$$asyncQueue;t.length;)try{n.$eval(t.shift())}catch(J){c(J)}if(h=n.$$watchers)for(o=h.length;o--;)try{if(a=h[o],(d=a.get(n))!==(e=a.last)&&!(a.eq?ga(d,e):typeof d=="number"&&typeof e=="number"&&isNaN(d)&&isNaN(e)))p=!0,a.last=a.eq?V(d):d,a.fn(d,e===f?d:e,n),s<5&&(z=4-s,C[z]||(C[z]=[]),q=H(a.exp)?"fn: "+(a.exp.name||a.exp.toString()):a.exp,q+="; newVal: "+da(d)+"; oldVal: "+da(e),C[z].push(q))}catch(r){c(r)}if(!(h=
-n.$$childHead||n!==this&&n.$$nextSibling))for(;n!==this&&!(h=n.$$nextSibling);)n=n.$parent}while(n=h);if(p&&!s--)throw j.$$phase=null,Error(b+" $digest() iterations reached. Aborting!\nWatchers fired in the last 5 iterations: "+da(C));}while(p||t.length);j.$$phase=null},$destroy:function(){if(!(j==this||this.$$destroyed)){var a=this.$parent;this.$broadcast("$destroy");this.$$destroyed=!0;if(a.$$childHead==this)a.$$childHead=this.$$nextSibling;if(a.$$childTail==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{j.$$phase=null;try{j.$digest()}catch(d){throw c(d),d;}}},$on:function(a,b){var c=this.$$listeners[a];
-c||(this.$$listeners[a]=c=[]);c.push(b);return function(){c[Aa(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},j=[h].concat(ha.call(arguments,1)),n,C;do{e=f.$$listeners[a]||d;h.currentScope=f;n=0;for(C=e.length;n<C;n++)if(e[n])try{if(e[n].apply(null,j),g)return h}catch(z){c(z)}else e.splice(n,1),n--,C--;f=f.$parent}while(f);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(ha.call(arguments,1)),h,j;do{d=e;f.currentScope=d;e=d.$$listeners[a]||[];h=0;for(j=e.length;h<j;h++)if(e[h])try{e[h].apply(null,g)}catch(n){c(n)}else e.splice(h,1),h--,j--;if(!(e=d.$$childHead||d!==this&&d.$$nextSibling))for(;d!==this&&!(e=d.$$nextSibling);)d=d.$parent}while(d=e);return f}};var j=new e;return j}]}function Tc(){this.$get=["$window",function(b){var a={},c=G((/android (\d+)/.exec(A(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"&&Z==9)return!1;if(x(a[c])){var e=b.document.createElement("div");a[c]="on"+c in e}return a[c]},csp:!1}}]}function Uc(){this.$get=I(N)}function Ob(b){var a={},c,d,e;if(!b)return a;n(b.split("\n"),function(b){e=b.indexOf(":");c=A(O(b.substr(0,e)));d=O(b.substr(e+1));c&&(a[c]?a[c]+=", "+d:a[c]=d)});return a}function Pb(b){var a=
-L(b)?b:q;return function(c){a||(a=Ob(b));return c?a[A(c)]||null:a}}function Qb(b,a,c){if(H(c))return c(b,a);n(c,function(c){b=c(b,a)});return b}function Vc(){var b=/^\s*(\[|\{[^\{])/,a=/[\}\]]\s*$/,c=/^\)\]\}',?\n/,d=this.defaults={transformResponse:[function(d){B(d)&&(d=d.replace(c,""),b.test(d)&&a.test(d)&&(d=pb(d,!0)));return d}],transformRequest:[function(a){return L(a)&&xa.apply(a)!=="[object File]"?da(a):a}],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,j,i,k){function m(a){function c(a){var b=v({},a,{data:Qb(a.data,a.headers,f)});return 200<=a.status&&a.status<300?b:i.reject(b)}a.method=ma(a.method);var e=a.transformRequest||d.transformRequest,f=a.transformResponse||d.transformResponse,g=d.headers,g=v({"X-XSRF-TOKEN":b.cookies()["XSRF-TOKEN"]},
-g.common,g[A(a.method)],a.headers),e=Qb(a.data,Pb(g),e),j;x(a.data)&&delete g["Content-Type"];j=l(a,e,g);j=j.then(c,c);n(p,function(a){j=a(j)});j.success=function(b){j.then(function(c){b(c.data,c.status,c.headers,a)});return j};j.error=function(b){j.then(null,function(c){b(c.data,c.status,c.headers,a)});return j};return j}function l(b,c,d){function e(a,b,c){n&&(200<=a&&a<300?n.put(q,[a,b,Ob(c)]):n.remove(q));f(b,a,c);j.$apply()}function f(a,c,d){c=Math.max(c,0);(200<=c&&c<300?k.resolve:k.reject)({data:a,
-status:c,headers:Pb(d),config:b})}function h(){var a=Aa(m.pendingRequests,b);a!==-1&&m.pendingRequests.splice(a,1)}var k=i.defer(),l=k.promise,n,p,q=t(b.url,b.params);m.pendingRequests.push(b);l.then(h,h);b.cache&&b.method=="GET"&&(n=L(b.cache)?b.cache:o);if(n)if(p=n.get(q))if(p.then)return p.then(h,h),p;else E(p)?f(p[1],p[0],V(p[2])):f(p,200,{});else n.put(q,l);p||a(b.method,q,c,e,d,b.timeout,b.withCredentials);return l}function t(a,b){if(!b)return a;var c=[];fc(b,function(a,b){a==null||a==q||(L(a)&&
-(a=da(a)),c.push(encodeURIComponent(b)+"="+encodeURIComponent(a)))});return a+(a.indexOf("?")==-1?"?":"&")+c.join("&")}var o=c("$http"),p=[];n(e,function(a){p.push(B(a)?k.get(a):k.invoke(a))});m.pendingRequests=[];(function(a){n(arguments,function(a){m[a]=function(b,c){return m(v(c||{},{method:a,url:b}))}})})("get","delete","head","jsonp");(function(a){n(arguments,function(a){m[a]=function(b,c,d){return m(v(d||{},{method:a,url:b,data:c}))}})})("post","put");m.defaults=d;return m}]}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 h(a,b){var c=e.createElement("script"),d=function(){e.body.removeChild(c);b&&b()};c.type="text/javascript";c.src=a;Z?c.onreadystatechange=function(){/loaded|complete/.test(c.readyState)&&d()}:c.onload=c.onerror=d;e.body.appendChild(c)}return function(e,j,i,k,m,l,t){function o(a,c,d,e){c=(j.match(Hb)||["",g])[1]=="file"?d?200:404:
-c;a(c==1223?204:c,d,e);b.$$completeOutstandingRequest(w)}b.$$incOutstandingRequestCount();j=j||b.url();if(A(e)=="jsonp"){var p="_"+(d.counter++).toString(36);d[p]=function(a){d[p].data=a};h(j.replace("JSON_CALLBACK","angular.callbacks."+p),function(){d[p].data?o(k,200,d[p].data):o(k,-2);delete d[p]})}else{var s=new a;s.open(e,j,!0);n(m,function(a,b){a&&s.setRequestHeader(b,a)});var q;s.onreadystatechange=function(){if(s.readyState==4){var a=s.getAllResponseHeaders(),b=["Cache-Control","Content-Language",
-"Content-Type","Expires","Last-Modified","Pragma"];a||(a="",n(b,function(b){var c=s.getResponseHeader(b);c&&(a+=b+": "+c+"\n")}));o(k,q||s.status,s.responseText,a)}};if(t)s.withCredentials=!0;s.send(i||"");l>0&&c(function(){q=-1;s.abort()},l)}}}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:"$"},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",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,j){var i=c.defer(),k=i.promise,m=y(j)&&!j,f=a.defer(function(){try{i.resolve(e())}catch(a){i.reject(a),d(a)}m||b.$apply()},f),j=function(){delete g[k.$$timeoutId]};k.$$timeoutId=f;g[f]=i;k.then(j,j);return k}var g={};e.cancel=function(b){return b&&b.$$timeoutId in g?(g[b.$$timeoutId].reject("canceled"),
-a.defer.cancel(b.$$timeoutId)):!1};return e}]}function Rb(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",Sb);a("date",Tb);a("filter",ad);a("json",bd);a("limitTo",cd);a("lowercase",dd);a("number",Ub);a("orderBy",Vb);a("uppercase",ed)}function ad(){return function(b,a){if(!E(b))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)==="!")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=(""+a[e]).toLowerCase();f&&c.push(function(a){return d(hb(a,b),f)})}();break;case "function":c.push(a);break;default:return b}for(var g=[],h=0;h<b.length;h++){var f=b[h];c.check(f)&&g.push(f)}return g}}function Sb(b){var a=b.NUMBER_FORMATS;return function(b,d){if(x(d))d=a.CURRENCY_SYM;return Wb(b,a.PATTERNS[1],a.GROUP_SEP,a.DECIMAL_SEP,2).replace(/\u00A4/g,d)}}function Ub(b){var a=b.NUMBER_FORMATS;return function(b,d){return Wb(b,a.PATTERNS[0],a.GROUP_SEP,a.DECIMAL_SEP,d)}}function Wb(b,a,c,d,
-e){if(isNaN(b)||!isFinite(b))return"";var g=b<0,b=Math.abs(b),h=b+"",f="",j=[],i=!1;if(h.indexOf("e")!==-1){var k=h.match(/([\d\.]+)e(-?)(\d+)/);k&&k[2]=="-"&&k[3]>e+1?h="0":(f=h,i=!0)}if(!i){h=(h.split(Xb)[1]||"").length;x(e)&&(e=Math.min(Math.max(a.minFrac,h),a.maxFrac));var h=Math.pow(10,e),b=Math.round(b*h)/h,b=(""+b).split(Xb),h=b[0],b=b[1]||"",i=0,k=a.lgSize,m=a.gSize;if(h.length>=k+m)for(var i=h.length-k,l=0;l<i;l++)(i-l)%m===0&&l!==0&&(f+=c),f+=h.charAt(l);for(l=i;l<h.length;l++)(h.length-
-l)%k===0&&l!==0&&(f+=c),f+=h.charAt(l);for(;b.length<e;)b+="0";e&&e!=="0"&&(f+=d+b.substr(0,e))}j.push(g?a.negPre:a.posPre);j.push(f);j.push(g?a.negSuf:a.posSuf);return j.join("")}function kb(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 M(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 kb(e,a,d)}}function Ka(b,a){return function(c,d){var e=c["get"+b](),g=ma(a?"SHORT"+b:b);return d[g][e]}}
-function Tb(b){function a(a){var b;if(b=a.match(c)){var a=new Date(0),g=0,h=0;b[9]&&(g=G(b[9]+b[10]),h=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)-h,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="",h=[],f,j,e=e||"mediumDate",e=b.DATETIME_FORMATS[e]||e;B(c)&&(c=fd.test(c)?G(c):a(c));Ra(c)&&(c=new Date(c));if(!oa(c))return c;for(;e;)(j=
-gd.exec(e))?(h=h.concat(ha.call(j,1)),e=h.pop()):(h.push(e),e=null);n(h,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 Vb(b){return function(a,
-c,d){function e(a,b){return Va(b)?function(b,c){return a(c,b)}:a}if(!E(a))return a;if(!c)return a;for(var c=E(c)?c:[c],c=Sa(c,function(a){var c=!1,d=a||na;if(B(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=[],h=0;h<a.length;h++)g.push(a[h]);return g.sort(e(function(a,b){for(var d=
-0;d<c.length;d++){var e=c[d](a,b);if(e!==0)return e}return 0},d))}}function R(b){H(b)&&(b={link:b});b.restrict=b.restrict||"AC";return I(b)}function Yb(b,a){function c(a,c){c=c?"-"+$a(c,"-"):"";b.removeClass((a?La:Ma)+c).addClass((a?Ma:La)+c)}var d=this,e=b.parent().controller("form")||Na,g=0,h=d.$error={};d.$name=a.name;d.$dirty=!1;d.$pristine=!0;d.$valid=!0;d.$invalid=!1;e.$addControl(d);b.addClass(Oa);c(!0);d.$addControl=function(a){a.$name&&!d.hasOwnProperty(a.$name)&&(d[a.$name]=a)};d.$removeControl=
-function(a){a.$name&&d[a.$name]===a&&delete d[a.$name];n(h,function(b,c){d.$setValidity(c,!0,a)})};d.$setValidity=function(a,b,i){var k=h[a];if(b){if(k&&(Ta(k,i),!k.length)){g--;if(!g)c(b),d.$valid=!0,d.$invalid=!1;h[a]=!1;c(!0,a);e.$setValidity(a,!0,d)}}else{g||c(b);if(k){if(Aa(k,i)!=-1)return}else h[a]=k=[],g++,c(!1,a),e.$setValidity(a,!1,d);k.push(i);d.$valid=!1;d.$invalid=!0}};d.$setDirty=function(){b.removeClass(Oa).addClass(Zb);d.$dirty=!0;d.$pristine=!1;e.$setDirty()}}function U(b){return x(b)||
-b===""||b===null||b!==b}function Pa(b,a,c,d,e,g){var h=function(){var c=O(a.val());d.$viewValue!==c&&b.$apply(function(){d.$setViewValue(c)})};if(e.hasEvent("input"))a.bind("input",h);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(){h();f=null}))});a.bind("change",h)}d.$render=function(){a.val(U(d.$viewValue)?"":d.$viewValue)};var j=c.ngPattern,i=function(a,b){return U(b)||a.test(b)?(d.$setValidity("pattern",!0),b):(d.$setValidity("pattern",
-!1),q)};j&&(j.match(/^\/(.*)\/$/)?(j=RegExp(j.substr(1,j.length-2)),e=function(a){return i(j,a)}):e=function(a){var c=b.$eval(j);if(!c||!c.test)throw Error("Expected "+j+" to be a RegExp but was "+c);return i(c,a)},d.$formatters.push(e),d.$parsers.push(e));if(c.ngMinlength){var k=G(c.ngMinlength),e=function(a){return!U(a)&&a.length<k?(d.$setValidity("minlength",!1),q):(d.$setValidity("minlength",!0),a)};d.$parsers.push(e);d.$formatters.push(e)}if(c.ngMaxlength){var m=G(c.ngMaxlength),c=function(a){return!U(a)&&
-a.length>m?(d.$setValidity("maxlength",!1),q):(d.$setValidity("maxlength",!0),a)};d.$parsers.push(c);d.$formatters.push(c)}}function lb(b,a){b="ngClass"+b;return R(function(c,d,e){function g(b){if(a===!0||c.$index%2===a)j&&b!==j&&h(j),f(b);j=b}function h(a){L(a)&&!E(a)&&(a=Sa(a,function(a,b){if(a)return b}));d.removeClass(E(a)?a.join(" "):a)}function f(a){L(a)&&!E(a)&&(a=Sa(a,function(a,b){if(a)return b}));a&&d.addClass(E(a)?a.join(" "):a)}var j=q;c.$watch(e[b],g,!0);e.$observe("class",function(){var a=
-c.$eval(e[b]);g(a,a)});b!=="ngClass"&&c.$watch("$index",function(d,g){var j=d%2;j!==g%2&&(j==a?f(c.$eval(e[b])):h(c.$eval(e[b])))})})}var A=function(b){return B(b)?b.toLowerCase():b},ma=function(b){return B(b)?b.toUpperCase():b},Z=G((/msie (\d+)/.exec(A(navigator.userAgent))||[])[1]),u,ca,ha=[].slice,Qa=[].push,xa=Object.prototype.toString,Za=N.angular||(N.angular={}),ta,gb,aa=["0","0","0"];w.$inject=[];na.$inject=[];gb=Z<9?function(b){b=b.nodeName?b:b[0];return b.scopeName&&b.scopeName!="HTML"?ma(b.scopeName+
-":"+b.nodeName):b.nodeName}:function(b){return b.nodeName?b.nodeName:b[0].nodeName};var kc=/[A-Z]/g,id={full:"1.0.6",major:1,minor:0,dot:6,codeName:"universal-irreversibility"},Ca=K.cache={},Ba=K.expando="ng-"+(new Date).getTime(),oc=1,$b=N.document.addEventListener?function(b,a,c){b.addEventListener(a,c,!1)}:function(b,a,c){b.attachEvent("on"+a,c)},eb=N.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])/,
-va=K.prototype={ready:function(b){function a(){c||(c=!0,b())}var c=!1;this.bind("DOMContentLoaded",a);K(N).bind("load",a)},toString:function(){var b=[];n(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:Qa,sort:[].sort,splice:[].splice},Fa={};n("multiple,selected,checked,disabled,readOnly,required".split(","),function(b){Fa[A(b)]=b});var Bb={};n("input,select,option,textarea,button,form".split(","),function(b){Bb[ma(b)]=
-!0});n({data:wb,inheritedData:Ea,scope:function(b){return Ea(b,"$scope")},controller:zb,injector:function(b){return Ea(b,"$injector")},removeAttr:function(b,a){b.removeAttribute(a)},hasClass:Da,css:function(b,a,c){a=tb(a);if(y(c))b.style[a]=c;else{var d;Z<=8&&(d=b.currentStyle&&b.currentStyle[a],d===""&&(d="auto"));d=d||b.style[a];Z<=8&&(d=d===""?q:d);return d}},attr:function(b,a,c){var d=A(a);if(Fa[d])if(y(c))c?(b[a]=!0,b.setAttribute(a,d)):(b[a]=!1,b.removeAttribute(d));else return b[a]||(b.attributes.getNamedItem(a)||
-w).specified?d:q;else if(y(c))b.setAttribute(a,c);else if(b.getAttribute)return b=b.getAttribute(a,2),b===null?q:b},prop:function(b,a,c){if(y(c))b[a]=c;else return b[a]},text:v(Z<9?function(b,a){if(b.nodeType==1){if(x(a))return b.innerText;b.innerText=a}else{if(x(a))return b.nodeValue;b.nodeValue=a}}:function(b,a){if(x(a))return b.textContent;b.textContent=a},{$dv:""}),val:function(b,a){if(x(a))return b.value;b.value=a},html:function(b,a){if(x(a))return b.innerHTML;for(var c=0,d=b.childNodes;c<d.length;c++)sa(d[c]);
-b.innerHTML=a}},function(b,a){K.prototype[a]=function(a,d){var e,g;if((b.length==2&&b!==Da&&b!==zb?a:d)===q)if(L(a)){for(e=0;e<this.length;e++)if(b===wb)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}});n({removeData:ub,dealoc:sa,bind:function a(c,d,e){var g=ba(c,"events"),h=ba(c,"handle");g||ba(c,"events",g={});h||ba(c,"handle",h=pc(c,g));n(d.split(" "),function(d){var j=g[d];
-if(!j){if(d=="mouseenter"||d=="mouseleave"){var i=0;g.mouseenter=[];g.mouseleave=[];a(c,"mouseover",function(a){i++;i==1&&h(a,"mouseenter")});a(c,"mouseout",function(a){i--;i==0&&h(a,"mouseleave")})}else $b(c,d,h),g[d]=[];j=g[d]}j.push(e)})},unbind:vb,replaceWith:function(a,c){var d,e=a.parentNode;sa(a);n(new K(c),function(c){d?e.insertBefore(c,d.nextSibling):e.replaceChild(c,a);d=c})},children:function(a){var c=[];n(a.childNodes,function(a){a.nodeType===1&&c.push(a)});return c},contents:function(a){return a.childNodes||
-[]},append:function(a,c){n(new K(c),function(c){a.nodeType===1&&a.appendChild(c)})},prepend:function(a,c){if(a.nodeType===1){var d=a.firstChild;n(new K(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;n(new K(c),function(a){e.insertBefore(a,d.nextSibling);d=a})},addClass:yb,removeClass:xb,
-toggleClass:function(a,c,d){x(d)&&(d=!Da(a,c));(d?yb:xb)(a,c)},parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},next:function(a){if(a.nextElementSibling)return a.nextElementSibling;for(a=a.nextSibling;a!=null&&a.nodeType!==1;)a=a.nextSibling;return a},find:function(a,c){return a.getElementsByTagName(c)},clone:db,triggerHandler:function(a,c){var d=(ba(a,"events")||{})[c];n(d,function(c){c.call(a,null)})}},function(a,c){K.prototype[c]=function(c,e){for(var g,h=0;h<this.length;h++)g==
-q?(g=a(this[h],c,e),g!==q&&(g=u(g))):cb(g,a(this[h],c,e));return g==q?this:g}});Ga.prototype={put:function(a,c){this[fa(a)]=c},get:function(a){return this[fa(a)]},remove:function(a){var c=this[a=fa(a)];delete this[a];return c}};fb.prototype={push:function(a,c){var d=this[a=fa(a)];d?d.push(c):this[a]=[c]},shift:function(a){var c=this[a=fa(a)];if(c)return c.length==1?(delete this[a],c[0]):c.shift()},peek:function(a){if(a=this[fa(a)])return a[0]}};var rc=/^function\s*[^\(]*\(\s*([^\)]*)\)/m,sc=/,/,tc=
-/^\s*(_?)(\S+?)\1\s*$/,qc=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Eb="Non-assignable model expression: ";Db.$inject=["$provide"];var Ac=/^(x[\:\-_]|data[\:\-_])/i,Hb=/^([^:]+):\/\/(\w+:{0,1}\w*@)?(\{?[\w\.-]*\}?)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,ac=/^([^\?#]*)?(\?([^#]*))?(#(.*))?$/,Hc=ac,Ib={http:80,https:443,ftp:21};ib.prototype={$$replace:!1,absUrl:Ia("$$absUrl"),url:function(a,c){if(x(a))return this.$$url;var d=ac.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:Ia("$$protocol"),host:Ia("$$host"),port:Ia("$$port"),path:Kb("$$path",function(a){return a.charAt(0)=="/"?a:"/"+a}),search:function(a,c){if(x(a))return this.$$search;y(c)?c===null?delete this.$$search[a]:this.$$search[a]=c:this.$$search=B(a)?Wa(a):a;this.$$compose();return this},hash:Kb("$$hash",na),replace:function(){this.$$replace=!0;return this}};Ha.prototype=za(ib.prototype);Jb.prototype=za(Ha.prototype);var Ja={"null":function(){return null},"true":function(){return!0},
-"false":function(){return!1},undefined:w,"+":function(a,c,d,e){d=d(a,c);e=e(a,c);return y(d)?y(e)?d+e:d:y(e)?e:q},"-":function(a,c,d,e){d=d(a,c);e=e(a,c);return(y(d)?d:0)-(y(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)},"=":w,"==":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,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","'":"'",'"':'"'},jb={},Yc=N.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 Error("This browser does not support XMLHttpRequest.");
-};Rb.$inject=["$provide"];Sb.$inject=["$locale"];Ub.$inject=["$locale"];var Xb=".",hd={yyyy:M("FullYear",4),yy:M("FullYear",2,0,!0),y:M("FullYear",1),MMMM:Ka("Month"),MMM:Ka("Month",!0),MM:M("Month",2,1),M:M("Month",1,1),dd:M("Date",2),d:M("Date",1),HH:M("Hours",2),H:M("Hours",1),hh:M("Hours",2,-12),h:M("Hours",1,-12),mm:M("Minutes",2),m:M("Minutes",1),ss:M("Seconds",2),s:M("Seconds",1),EEEE:Ka("Day"),EEE:Ka("Day",!0),a:function(a,c){return a.getHours()<12?c.AMPMS[0]:c.AMPMS[1]},Z:function(a){var a=
--1*a.getTimezoneOffset(),c=a>=0?"+":"";c+=kb(Math[a>0?"floor":"ceil"](a/60),2)+kb(Math.abs(a%60),2);return c}},gd=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,fd=/^\d+$/;Tb.$inject=["$locale"];var dd=I(A),ed=I(ma);Vb.$inject=["$parse"];var jd=I({restrict:"E",compile:function(a,c){Z<=8&&(!c.href&&!c.name&&c.$set("href",""),a.append(Y.createComment("IE fix")));return function(a,c){c.bind("click",function(a){c.attr("href")||a.preventDefault()})}}}),mb={};n(Fa,function(a,
-c){var d=ea("ng-"+c);mb[d]=function(){return{priority:100,compile:function(){return function(a,g,h){a.$watch(h[d],function(a){h.$set(c,!!a)})}}}}});n(["src","href"],function(a){var c=ea("ng-"+a);mb[c]=function(){return{priority:99,link:function(d,e,g){g.$observe(c,function(c){c&&(g.$set(a,c),Z&&e.prop(a,g[a]))})}}}});var Na={$addControl:w,$removeControl:w,$setValidity:w,$setDirty:w};Yb.$inject=["$element","$attrs","$scope"];var Qa=function(a){return["$timeout",function(c){var d={name:"form",restrict:"E",
-controller:Yb,compile:function(){return{pre:function(a,d,h,f){if(!h.action){var j=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1};$b(d[0],"submit",j);d.bind("$destroy",function(){c(function(){eb(d[0],"submit",j)},0,!1)})}var i=d.parent().controller("form"),k=h.name||h.ngForm;k&&(a[k]=f);i&&d.bind("$destroy",function(){i.$removeControl(f);k&&(a[k]=q);v(f,Na)})}}}};return a?v(V(d),{restrict:"EAC"}):d}]},kd=Qa(),ld=Qa(!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*$/,bc={text:Pa,number:function(a,c,d,e,g,h){Pa(a,c,d,e,g,h);e.$parsers.push(function(a){var c=U(a);return c||od.test(a)?(e.$setValidity("number",!0),a===""?null:c?a:parseFloat(a)):(e.$setValidity("number",!1),q)});e.$formatters.push(function(a){return U(a)?"":""+a});if(d.min){var f=parseFloat(d.min),a=function(a){return!U(a)&&a<f?(e.$setValidity("min",!1),q):(e.$setValidity("min",!0),a)};e.$parsers.push(a);
-e.$formatters.push(a)}if(d.max){var j=parseFloat(d.max),d=function(a){return!U(a)&&a>j?(e.$setValidity("max",!1),q):(e.$setValidity("max",!0),a)};e.$parsers.push(d);e.$formatters.push(d)}e.$formatters.push(function(a){return U(a)||Ra(a)?(e.$setValidity("number",!0),a):(e.$setValidity("number",!1),q)})},url:function(a,c,d,e,g,h){Pa(a,c,d,e,g,h);a=function(a){return U(a)||md.test(a)?(e.$setValidity("url",!0),a):(e.$setValidity("url",!1),q)};e.$formatters.push(a);e.$parsers.push(a)},email:function(a,
-c,d,e,g,h){Pa(a,c,d,e,g,h);a=function(a){return U(a)||nd.test(a)?(e.$setValidity("email",!0),a):(e.$setValidity("email",!1),q)};e.$formatters.push(a);e.$parsers.push(a)},radio:function(a,c,d,e){x(d.name)&&c.attr("name",ya());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,h=d.ngFalseValue;B(g)||(g=!0);B(h)||(h=!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===g});e.$parsers.push(function(a){return a?g:h})},hidden:w,button:w,submit:w,reset:w},cc=["$browser","$sniffer",function(a,c){return{restrict:"E",require:"?ngModel",link:function(d,e,g,h){h&&(bc[A(g.type)]||bc.text)(d,e,g,h,c,a)}}}],Ma="ng-valid",La="ng-invalid",Oa="ng-pristine",Zb="ng-dirty",pd=["$scope","$exceptionHandler","$attrs","$element","$parse",
-function(a,c,d,e,g){function h(a,c){c=c?"-"+$a(c,"-"):"";e.removeClass((a?La:Ma)+c).addClass((a?Ma:La)+c)}this.$modelValue=this.$viewValue=Number.NaN;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),j=f.assign;if(!j)throw Error(Eb+d.ngModel+" ("+qa(e)+")");this.$render=w;var i=e.inheritedData("$formController")||Na,k=0,m=this.$error={};e.addClass(Oa);h(!0);this.$setValidity=function(a,
-c){if(m[a]!==!c){if(c){if(m[a]&&k--,!k)h(!0),this.$valid=!0,this.$invalid=!1}else h(!1),this.$invalid=!0,this.$valid=!1,k++;m[a]=!c;h(c,a);i.$setValidity(a,c,this)}};this.$setViewValue=function(d){this.$viewValue=d;if(this.$pristine)this.$dirty=!0,this.$pristine=!1,e.removeClass(Oa).addClass(Zb),i.$setDirty();n(this.$parsers,function(a){d=a(d)});if(this.$modelValue!==d)this.$modelValue=d,j(a,d),n(this.$viewChangeListeners,function(a){try{a()}catch(d){c(d)}})};var l=this;a.$watch(function(){var c=
-f(a);if(l.$modelValue!==c){var d=l.$formatters,e=d.length;for(l.$modelValue=c;e--;)c=d[e](c);if(l.$viewValue!==c)l.$viewValue=c,l.$render()}})}],qd=function(){return{require:["ngModel","^?form"],controller:pd,link:function(a,c,d,e){var g=e[0],h=e[1]||Na;h.$addControl(g);c.bind("$destroy",function(){h.$removeControl(g)})}}},rd=I({require:"ngModel",link:function(a,c,d,e){e.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),dc=function(){return{require:"?ngModel",link:function(a,c,d,e){if(e){d.required=
-!0;var g=function(a){if(d.required&&(U(a)||a===!1))e.$setValidity("required",!1);else return e.$setValidity("required",!0),a};e.$formatters.push(g);e.$parsers.unshift(g);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&&n(a.split(g),function(a){a&&c.push(O(a))});return c});e.$formatters.push(function(a){return E(a)?a.join(", "):
-q})}}},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,c,g){a.$watch(g.ngValue,function(a){g.$set("value",a,!1)})}}}},vd=R(function(a,c,d){c.addClass("ng-binding").data("$binding",d.ngBind);a.$watch(d.ngBind,function(a){c.text(a==q?"":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,function(a){c.html(a||"")})}}],yd=lb("",!0),zd=lb("Odd",0),Ad=lb("Even",1),Bd=R({compile:function(a,c){c.$set("ngCloak",q);a.removeClass("ng-cloak")}}),Cd=[function(){return{scope:!0,controller:"@"}}],Dd=["$sniffer",function(a){return{priority:1E3,compile:function(){a.csp=!0}}}],ec={};n("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave".split(" "),
-function(a){var c=ea("ng-"+a);ec[c]=["$parse",function(d){return function(e,g,h){var f=d(h[c]);g.bind(A(a),function(a){e.$apply(function(){f(e,{$event:a})})})}}]});var Ed=R(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,h){var f=h.ngInclude||h.src,j=h.onload||"",i=h.autoscroll;return function(g,h){var l=0,n,o=function(){n&&(n.$destroy(),n=null);h.html("")};
-g.$watch(f,function(f){var s=++l;f?a.get(f,{cache:c}).success(function(a){s===l&&(n&&n.$destroy(),n=g.$new(),h.html(a),e(h.contents())(n),y(i)&&(!i||g.$eval(i))&&d(),n.$emit("$includeContentLoaded"),g.$eval(j))}).error(function(){s===l&&o()}):o()})}}}}],Gd=R({compile:function(){return{pre:function(a,c,d){a.$eval(d.ngInit)}}}}),Hd=R({terminal:!0,priority:1E3}),Id=["$locale","$interpolate",function(a,c){var d=/{}/g;return{restrict:"EA",link:function(e,g,h){var f=h.count,j=g.attr(h.$attr.when),i=h.offset||
-0,k=e.$eval(j),m={},l=c.startSymbol(),t=c.endSymbol();n(k,function(a,e){m[e]=c(a.replace(d,l+f+"-"+i+t))});e.$watch(function(){var c=parseFloat(e.$eval(f));return isNaN(c)?"":(k[c]||(c=a.pluralCat(c-i)),m[c](e,g,!0))},function(a){g.text(a)})}}}],Jd=R({transclude:"element",priority:1E3,terminal:!0,compile:function(a,c,d){return function(a,c,h){var f=h.ngRepeat,h=f.match(/^\s*(.+)\s+in\s+(.*)\s*$/),j,i,k;if(!h)throw Error("Expected ngRepeat in form of '_item_ in _collection_' but got '"+f+"'.");f=h[1];
-j=h[2];h=f.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);if(!h)throw Error("'item' in 'item in collection' should be identifier or (key, value) but got '"+f+"'.");i=h[3]||h[1];k=h[2];var m=new fb;a.$watch(function(a){var e,f,h=a.$eval(j),n=c,q=new fb,y,z,u,x,r,v;if(E(h))r=h||[];else{r=[];for(u in h)h.hasOwnProperty(u)&&u.charAt(0)!="$"&&r.push(u);r.sort()}y=r.length-1;e=0;for(f=r.length;e<f;e++){u=h===r?e:r[e];x=h[u];if(v=m.shift(x)){z=v.scope;q.push(x,v);if(e!==v.index)v.index=e,n.after(v.element);
-n=v.element}else z=a.$new();z[i]=x;k&&(z[k]=u);z.$index=e;z.$first=e===0;z.$last=e===y;z.$middle=!(z.$first||z.$last);v||d(z,function(a){n.after(a);v={scope:z,element:n=a,index:e};q.push(x,v)})}for(u in m)if(m.hasOwnProperty(u))for(r=m[u];r.length;)x=r.pop(),x.element.remove(),x.scope.$destroy();m=q})}}}),Kd=R(function(a,c,d){a.$watch(d.ngShow,function(a){c.css("display",Va(a)?"":"none")})}),Ld=R(function(a,c,d){a.$watch(d.ngHide,function(a){c.css("display",Va(a)?"none":"")})}),Md=R(function(a,c,
-d){a.$watch(d.ngStyle,function(a,d){d&&a!==d&&n(d,function(a,d){c.css(d,"")});a&&c.css(a)},!0)}),Nd=I({restrict:"EA",require:"ngSwitch",controller:["$scope",function(){this.cases={}}],link:function(a,c,d,e){var g,h,f;a.$watch(d.ngSwitch||d.on,function(j){h&&(f.$destroy(),h.remove(),h=f=null);if(g=e.cases["!"+j]||e.cases["?"])a.$eval(d.change),f=a.$new(),g(f,function(a){h=a;c.append(a)})})}}),Od=R({transclude:"element",priority:500,require:"^ngSwitch",compile:function(a,c,d){return function(a,g,h,
-f){f.cases["!"+c.ngSwitchWhen]=d}}}),Pd=R({transclude:"element",priority:500,require:"^ngSwitch",compile:function(a,c,d){return function(a,c,h,f){f.cases["?"]=d}}}),Qd=R({controller:["$transclude","$element",function(a,c){a(function(a){c.append(a)})}]}),Rd=["$http","$templateCache","$route","$anchorScroll","$compile","$controller",function(a,c,d,e,g,h){return{restrict:"ECA",terminal:!0,link:function(a,c,i){function k(){var i=d.current&&d.current.locals,k=i&&i.$template;if(k){c.html(k);m&&(m.$destroy(),
-m=null);var k=g(c.contents()),n=d.current;m=n.scope=a.$new();if(n.controller)i.$scope=m,i=h(n.controller,i),c.children().data("$ngControllerController",i);k(m);m.$emit("$viewContentLoaded");m.$eval(l);e()}else c.html(""),m&&(m.$destroy(),m=null)}var m,l=i.onload||"";a.$on("$routeChangeSuccess",k);k()}}}],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:w};return{restrict:"E",require:["select","?ngModel"],controller:["$element","$scope","$attrs",function(a,c,d){var j=this,i={},k=e,m;j.databound=d.ngModel;j.init=function(a,c,d){k=a;m=d};j.addOption=function(c){i[c]=!0;k.$viewValue==c&&(a.val(c),m.parent()&&m.remove())};j.removeOption=function(a){this.hasOption(a)&&(delete i[a],
-k.$viewValue==a&&this.renderUnknownOption(a))};j.renderUnknownOption=function(c){c="? "+fa(c)+" ?";m.val(c);a.prepend(m);a.val(c);m.prop("selected",!0)};j.hasOption=function(a){return i.hasOwnProperty(a)};c.$on("$destroy",function(){j.renderUnknownOption=w})}],link:function(e,h,f,j){function i(a,c,d,e){d.$render=function(){var a=d.$viewValue;e.hasOption(a)?(w.parent()&&w.remove(),c.val(a),a===""&&v.prop("selected",!0)):x(a)&&v?c.val(""):e.renderUnknownOption(a)};c.bind("change",function(){a.$apply(function(){w.parent()&&
-w.remove();d.$setViewValue(c.val())})})}function k(a,c,d){var e;d.$render=function(){var a=new Ga(d.$viewValue);n(c.find("option"),function(c){c.selected=y(a.get(c.value))})};a.$watch(function(){ga(e,d.$viewValue)||(e=V(d.$viewValue),d.$render())});c.bind("change",function(){a.$apply(function(){var a=[];n(c.find("option"),function(c){c.selected&&a.push(c.value)});d.$setViewValue(a)})})}function m(e,f,g){function h(){var a={"":[]},c=[""],d,i,p,u,v;p=g.$modelValue;u=t(e)||[];var x=l?nb(u):u,y,w,A;w=
-{};v=!1;var B,E;if(o)v=new Ga(p);else if(p===null||s)a[""].push({selected:p===null,id:"",label:""}),v=!0;for(A=0;y=x.length,A<y;A++){w[k]=u[l?w[l]=x[A]:A];d=m(e,w)||"";if(!(i=a[d]))i=a[d]=[],c.push(d);o?d=v.remove(n(e,w))!=q:(d=p===n(e,w),v=v||d);B=j(e,w);B=B===q?"":B;i.push({id:l?x[A]:A,label:B,selected:d})}!o&&!v&&a[""].unshift({id:"?",label:"",selected:!0});w=0;for(x=c.length;w<x;w++){d=c[w];i=a[d];if(r.length<=w)p={element:z.clone().attr("label",d),label:i.label},u=[p],r.push(u),f.append(p.element);
-else if(u=r[w],p=u[0],p.label!=d)p.element.attr("label",p.label=d);B=null;A=0;for(y=i.length;A<y;A++)if(d=i[A],v=u[A+1]){B=v.element;if(v.label!==d.label)B.text(v.label=d.label);if(v.id!==d.id)B.val(v.id=d.id);if(v.element.selected!==d.selected)B.prop("selected",v.selected=d.selected)}else d.id===""&&s?E=s:(E=C.clone()).val(d.id).attr("selected",d.selected).text(d.label),u.push({element:E,label:d.label,id:d.id,selected:d.selected}),B?B.after(E):p.element.append(E),B=E;for(A++;u.length>A;)u.pop().element.remove()}for(;r.length>
-w;)r.pop()[0].element.remove()}var i;if(!(i=p.match(d)))throw Error("Expected ngOptions in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '"+p+"'.");var j=c(i[2]||i[1]),k=i[4]||i[6],l=i[5],m=c(i[3]||""),n=c(i[2]?i[1]:k),t=c(i[7]),r=[[{element:f,label:""}]];s&&(a(s)(e),s.removeClass("ng-scope"),s.remove());f.html("");f.bind("change",function(){e.$apply(function(){var a,c=t(e)||[],d={},h,i,j,m,p,s;if(o){i=[];m=0;for(s=r.length;m<s;m++){a=r[m];j=1;for(p=a.length;j<p;j++)if((h=
-a[j].element)[0].selected)h=h.val(),l&&(d[l]=h),d[k]=c[h],i.push(n(e,d))}}else h=f.val(),h=="?"?i=q:h==""?i=null:(d[k]=c[h],l&&(d[l]=h),i=n(e,d));g.$setViewValue(i)})});g.$render=h;e.$watch(h)}if(j[1]){for(var l=j[0],t=j[1],o=f.multiple,p=f.ngOptions,s=!1,v,C=u(Y.createElement("option")),z=u(Y.createElement("optgroup")),w=C.clone(),j=0,A=h.children(),r=A.length;j<r;j++)if(A[j].value==""){v=s=A.eq(j);break}l.init(t,s,w);if(o&&(f.required||f.ngRequired)){var B=function(a){t.$setValidity("required",
-!f.required||a&&a.length);return a};t.$parsers.push(B);t.$formatters.unshift(B);f.$observe("required",function(){B(t.$viewValue)})}p?m(e,h,t):o?k(e,h,t):i(e,h,t,l)}}}}],Vd=["$interpolate",function(a){var c={addOption:w,removeOption:w};return{restrict:"E",priority:100,compile:function(d,e){if(x(e.value)){var g=a(d.text(),!0);g||e.$set("value",d.text())}return function(a,d,e){var i=d.parent(),k=i.data("$selectController")||i.parent().data("$selectController");k&&k.databound?d.prop("selected",!1):k=
-c;g?a.$watch(g,function(a,c){e.$set("value",a);a!==c&&k.removeOption(c);k.addOption(a)}):k.addOption(e.value);d.bind("$destroy",function(){k.removeOption(e.value)})}}}}],Wd=I({restrict:"E",terminal:!0});(ca=N.jQuery)?(u=ca,v(ca.fn,{scope:va.scope,controller:va.controller,injector:va.injector,inheritedData:va.inheritedData}),bb("remove",!0),bb("empty"),bb("html")):u=K;Za.element=u;(function(a){v(a,{bootstrap:rb,copy:V,extend:v,equals:ga,element:u,forEach:n,injector:sb,noop:w,bind:Ua,toJson:da,fromJson:pb,
-identity:na,isUndefined:x,isDefined:y,isString:B,isFunction:H,isObject:L,isNumber:Ra,isElement:gc,isArray:E,version:id,isDate:oa,lowercase:A,uppercase:ma,callbacks:{counter:0}});ta=lc(N);try{ta("ngLocale")}catch(c){ta("ngLocale",[]).provider("$locale",Zc)}ta("ng",["ngLocale"],["$provide",function(a){a.provider("$compile",Db).directive({a:jd,input:cc,textarea:cc,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,ngModel:qd,ngList:sd,ngChange:rd,required:dc,ngRequired:dc,ngValue:ud}).directive(mb).directive(ec);a.provider({$anchorScroll:uc,$browser:wc,$cacheFactory:xc,$controller:Bc,$document:Cc,$exceptionHandler:Dc,$filter:Rb,$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})}])})(Za);u(Y).ready(function(){jc(Y,rb)})})(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>');
diff --git a/static/lib/codemirror/AUTHORS b/static/lib/codemirror/AUTHORS
deleted file mode 100644
index 2ac995f..0000000
--- a/static/lib/codemirror/AUTHORS
+++ /dev/null
@@ -1,647 +0,0 @@
-List of CodeMirror contributors. Updated before every release.
-
-4r2r
-Aaron Brooks
-Abdelouahab
-Abe Fettig
-Adam Ahmed
-Adam King
-Adam Particka
-adanlobato
-Adán Lobato
-Adrian Aichner
-Adrian Heine
-Adrien Bertrand
-aeroson
-Ahmad Amireh
-Ahmad M. Zawawi
-ahoward
-Akeksandr Motsjonov
-Alasdair Smith
-Alberto González Palomo
-Alberto Pose
-Albert Xing
-Alexander Pavlov
-Alexander Schepanovski
-Alexander Shvets
-Alexander Solovyov
-Alexandre Bique
-alexey-k
-Alex Piggott
-Aliaksei Chapyzhenka
-Allen Sarkisyan
-Ami Fischman
-Amin Shali
-Amin Ullah Khan
-amshali@google.com
-Amsul
-amuntean
-Amy
-Ananya Sen
-anaran
-AndersMad
-Anders Nawroth
-Anderson Mesquita
-Anders Wåglund
-Andrea G
-Andreas Reischuck
-Andres Taylor
-Andre von Houck
-Andrew Cheng
-Andrey Fedorov
-Andrey Klyuchnikov
-Andrey Lushnikov
-Andrey Shchekin
-Andy Joslin
-Andy Kimball
-Andy Li
-Angelo
-angelozerr
-angelo.zerr@gmail.com
-Ankit
-Ankit Ahuja
-Ansel Santosa
-Anthony Dugois
-anthonygego
-Anthony Gégo
-Anthony Grimes
-Anton Kovalyov
-Apollo Zhu
-AQNOUCH Mohammed
-areos
-Arnab Bose
-Arthur Müller
-Arun Narasani
-as3boyan
-atelierbram
-AtomicPages LLC
-Atul Bhouraskar
-Aurelian Oancea
-Axel Lewenhaupt
-Barret Rennie
-Basarat Ali Syed
-Bastian Müller
-belhaj
-Bem Jones-Bey
-benbro
-Beni Cherniavsky-Paskin
-Benjamin DeCoste
-Ben Keen
-Ben Miller
-Ben Mosher
-Bernhard Sirlinger
-Bert Chang
-Bharad
-BigBlueHat
-Billy Moon
-binny
-B Krishna Chaitanya
-Blaine G
-blukat29
-boomyjee
-borawjm
-Brad Metcalf
-Brandon Frohs
-Brandon Wamboldt
-Brett Zamir
-Brian Grinstead
-Brian Sletten
-brrd
-Bruce Mitchener
-Bryan Massoth
-Caitlin Potter
-Calin Barbat
-callodacity
-Camilo Roca
-Chad Jolly
-Chandra Sekhar Pydi
-Charles Skelton
-Cheah Chu Yeow
-Chris Coyier
-Chris Ford
-Chris Granger
-Chris Houseknecht
-Chris Lohfink
-Chris Morgan
-Chris Smith
-Christian Oyarzun
-Christian Petrov
-Christopher Brown
-Christopher Kramer
-Christopher Mitchell
-Christopher Pfohl
-Chunliang Lyu
-ciaranj
-CodeAnimal
-coderaiser
-Cole R Lawrence
-ComFreek
-Curtis Gagliardi
-dagsta
-daines
-Dale Jung
-Dan Bentley
-Dan Heberden
-Daniel, Dao Quang Minh
-Daniele Di Sarli
-Daniel Faust
-Daniel Huigens
-Daniel Kesler
-Daniel KJ
-Daniel Neel
-Daniel Parnell
-Danny Yoo
-darealshinji
-Darius Roberts
-Dave Brondsema
-Dave Myers
-David Barnett
-David H. Bronke
-David Mignot
-David Pathakjee
-David Vázquez
-David Whittington
-deebugger
-Deep Thought
-Devin Abbott
-Devon Carew
-Dick Choi
-dignifiedquire
-Dimage Sapelkin
-Dmitry Kiselyov
-domagoj412
-Dominator008
-Domizio Demichelis
-Doug Wikle
-Drew Bratcher
-Drew Hintz
-Drew Khoury
-Drini Cami
-Dror BG
-duralog
-eborden
-edsharp
-ekhaled
-Elisée
-Emmanuel Schanzer
-Enam Mijbah Noor
-Eric Allam
-Erik Welander
-eustas
-Fabien Dubosson
-Fabien O'Carroll
-Fabio Zendhi Nagao
-Faiza Alsaied
-Fauntleroy
-fbuchinger
-feizhang365
-Felipe Lalanne
-Felix Raab
-ficristo
-Filip Noetzel
-Filip Stollár
-flack
-Florian Felten
-ForbesLindesay
-Forbes Lindesay
-Ford_Lawnmower
-Forrest Oliphant
-Frank Wiegand
-Gabriel Gheorghian
-Gabriel Horner
-Gabriel Nahmias
-galambalazs
-Gary Sheng
-Gautam Mehta
-Gavin Douglas
-gekkoe
-Geordie Hall
-geowarin
-Gerard Braad
-Gergely Hegykozi
-Giovanni Calò
-Glebov Boris
-Glenn Jorde
-Glenn Ruehle
-Golevka
-Google Inc.
-Gordon Smith
-Grant Skinner
-greengiant
-Gregory Koberger
-Grzegorz Mazur
-Guillaume Massé
-Guillaume Massé
-guraga
-Gustavo Rodrigues
-Hakan Tunc
-Hans Engel
-Hardest
-Harshvardhan Gupta
-Hasan Karahan
-Hector Oswaldo Caballero
-Hendrik Wallbaum
-Herculano Campos
-Hiroyuki Makino
-hitsthings
-Hocdoc
-Hugues Malphettes
-Ian Beck
-Ian Dickinson
-Ian Wehrman
-Ian Wetherbee
-Ice White
-ICHIKAWA, Yuji
-idleberg
-ilvalle
-Ingo Richter
-Irakli Gozalishvili
-Ivan Kurnosov
-Ivoah
-Jacob Lee
-Jake Peyser
-Jakob Miland
-Jakub Vrana
-Jakub Vrána
-James Campos
-James Howard
-James Thorne
-Jamie Hill
-Jamie Morris
-Jan Jongboom
-jankeromnes
-Jan Keromnes
-Jan Odvarko
-Jan Schär
-Jan T. Sott
-Jared Dean
-Jared Forsyth
-Jared Jacobs
-Jason
-Jason Barnabe
-Jason Grout
-Jason Johnston
-Jason San Jose
-Jason Siefken
-Jaydeep Solanki
-Jean Boussier
-Jeff Blaisdell
-Jeff Jenkins
-jeffkenton
-Jeff Pickhardt
-jem (graphite)
-Jeremy Parmenter
-Jim
-Jim Avery
-JobJob
-jochenberger
-Jochen Berger
-Joel Einbinder
-joelpinheiro
-Johan Ask
-John Connor
-John-David Dalton
-John Engler
-John Lees-Miller
-John Snelson
-John Van Der Loo
-Jon Ander Peñalba
-Jonas Döbertin
-Jonathan Malmaud
-Jon Gacnik
-jongalloway
-Jon Malmaud
-Jon Sangster
-Joost-Wim Boekesteijn
-Joseph Pecoraro
-Josh Barnes
-Josh Cohen
-Josh Soref
-Joshua Newman
-Josh Watzman
-jots
-jsoojeon
-ju1ius
-Juan Benavides Romero
-Jucovschi Constantin
-Juho Vuori
-Julien Rebetez
-Justin Andresen
-Justin Hileman
-jwallers@gmail.com
-kaniga
-karevn
-Kayur Patel
-Kazuhito Hokamura
-Ken Newman
-ken restivo
-Ken Rockot
-Kevin Earls
-Kevin Muret
-Kevin Sawicki
-Kevin Ushey
-Klaus Silveira
-Koh Zi Han, Cliff
-komakino
-Konstantin Lopuhin
-koops
-Kris Ciccarello
-ks-ifware
-kubelsmieci
-KwanEsq
-Kyle Kelley
-Lanfei
-Lanny
-Laszlo Vidacs
-leaf corcoran
-Leonid Khachaturov
-Leon Sorokin
-Leonya Khachaturov
-Liam Newman
-Libo Cannici
-LloydMilligan
-LM
-lochel
-Lorenzo Stoakes
-Luca Fabbri
-Luciano Longo
-Lu Fangjian
-Luke Browning
-Luke Granger-Brown
-Luke Stagner
-lynschinzer
-M1cha
-Madhura Jayaratne
-Maksim Lin
-Maksym Taran
-Malay Majithia
-Manideep
-Manuel Rego Casasnovas
-Marat Dreizin
-Marcel Gerber
-Marcelo Camargo
-Marco Aurélio
-Marco Munizaga
-Marcus Bointon
-Marek Rudnicki
-Marijn Haverbeke
-Mário Gonçalves
-Mario Pietsch
-Mark Anderson
-Mark Lentczner
-Marko Bonaci
-Mark Peace
-Markus Bordihn
-Martin Balek
-Martín Gaitán
-Martin Hasoň
-Martin Hunt
-Martin Laine
-Martin Zagora
-Mason Malone
-Mateusz Paprocki
-Mathias Bynens
-mats cronqvist
-Matt Gaide
-Matthew Bauer
-Matthew Beale
-matthewhayes
-Matthew Rathbone
-Matthias Bussonnier
-Matthias BUSSONNIER
-Matt McDonald
-Matt Pass
-Matt Sacks
-mauricio
-Maximilian Hils
-Maxim Kraev
-Max Kirsch
-Max Schaefer
-Max Xiantu
-mbarkhau
-McBrainy
-mce2
-melpon
-Metatheos
-Micah Dubinko
-Michael
-Michael Goderbauer
-Michael Grey
-Michael Kaminsky
-Michael Lehenbauer
-Michael Zhou
-Michal Dorner
-Mighty Guava
-Miguel Castillo
-mihailik
-Mike
-Mike Brevoort
-Mike Diaz
-Mike Ivanov
-Mike Kadin
-Mike Kobit
-MinRK
-Miraculix87
-misfo
-mkaminsky11
-mloginov
-Moritz Schwörer
-mps
-ms
-mtaran-google
-Mu-An Chiou
-Narciso Jaramillo
-Nathan Williams
-ndr
-nerbert
-nextrevision
-ngn
-nguillaumin
-Ng Zhi An
-Nicholas Bollweg
-Nicholas Bollweg (Nick)
-Nick Kreeger
-Nick Small
-Nicolò Ribaudo
-Niels van Groningen
-nightwing
-Nikita Beloglazov
-Nikita Vasilyev
-Nikolay Kostov
-nilp0inter
-Nisarg Jhaveri
-nlwillia
-noragrossman
-Norman Rzepka
-Oreoluwa Onatemowo
-Oskar Segersvärd
-pablo
-pabloferz
-Pablo Zubieta
-Page
-Panupong Pasupat
-paris
-Paris
-Paris Kasidiaris
-Patil Arpith
-Patrick Stoica
-Patrick Strawderman
-Paul Garvin
-Paul Ivanov
-Paul Masson
-Pavel
-Pavel Feldman
-Pavel Petržela
-Pavel Strashkin
-Paweł Bartkiewicz
-peteguhl
-peter
-Peter Flynn
-peterkroon
-Peter Kroon
-Philipp A
-Philip Stadermann
-Pierre Gerold
-Piët Delport
-Pontus Melke
-prasanthj
-Prasanth J
-Prayag Verma
-Radek Piórkowski
-Rahul
-Rahul Anand
-ramwin1
-Randall Mason
-Randy Burden
-Randy Edmunds
-Rasmus Erik Voel Jensen
-ray ratchup
-Ray Ratchup
-Remi Nyborg
-Renaud Durlin
-Richard Denton
-Richard van der Meer
-Richard Z.H. Wang
-Rishi Goomar
-Robert Crossfield
-Roberto Abdelkader Martínez Pérez
-robertop23
-Robert Plummer
-Rrandom
-Rrrandom
-Ruslan Osmanov
-Ryan Petrello
-Ryan Prior
-sabaca
-Sam Lee
-Samuel Ainsworth
-Sam Wilson
-sandeepshetty
-Sander AKA Redsandro
-Sander Verweij
-santec
-Sascha Peilicke
-satamas
-satchmorun
-sathyamoorthi
-Saul Costa
-S. Chris Colbert
-SCLINIC\jdecker
-Scott Aikin
-Scott Goodhew
-Sebastian Zaha
-Sergey Goder
-Sergey Tselovalnikov
-Se-Won Kim
-shaund
-shaun gilchrist
-Shawn A
-Shea Bunge
-sheopory
-Shiv Deepak
-Shmuel Englard
-Shubham Jain
-Siamak Mokhtari
-silverwind
-sinkuu
-snasa
-soliton4
-sonson
-spastorelli
-srajanpaliwal
-Stanislav Oaserele
-Stas Kobzar
-Stefan Borsje
-Steffen Beyer
-Steffen Bruchmann
-Stephen Lavelle
-Steve Champagne
-Steve Hoover
-Steve O'Hara
-stoskov
-Stu Kennedy
-Sungho Kim
-sverweij
-Taha Jahangir
-takamori
-Tako Schotanus
-Takuji Shimokawa
-Tarmil
-TDaglis
-tel
-tfjgeorge
-Thaddee Tyl
-thanasis
-TheHowl
-themrmax
-think
-Thomas Dvornik
-Thomas Kluyver
-Thomas Schmid
-Tim Alby
-Tim Baumann
-Timothy Farrell
-Timothy Gu
-Timothy Hatcher
-TobiasBg
-Todd Berman
-Tomas-A
-Tomas Varaneckas
-Tom Erik Støwer
-Tom Klancer
-Tom MacWright
-Tony Jian
-Travis Heppe
-Triangle717
-Tristan Tarrant
-TSUYUSATO Kitsune
-twifkak
-VapidWorx
-Vestimir Markov
-vf
-Victor Bocharsky
-Vincent Woo
-Volker Mische
-Weiyan Shao
-wenli
-Wes Cossick
-Wesley Wiser
-Will Binns-Smith
-Will Dean
-William Jamieson
-William Stein
-Willy
-Wojtek Ptak
-Wu Cheng-Han
-Xavier Mendez
-Yassin N. Hassan
-YNH Webdev
-Yunchi Luo
-Yuvi Panda
-Zac Anger
-Zachary Dremann
-Zeno Rocha
-Zhang Hao
-Ziv
-zziuni
-魏鹏刚
diff --git a/static/lib/codemirror/LICENSE b/static/lib/codemirror/LICENSE
deleted file mode 100644
index ff7db4b..0000000
--- a/static/lib/codemirror/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/static/lib/codemirror/README.md b/static/lib/codemirror/README.md
deleted file mode 100644
index 3328e3b..0000000
--- a/static/lib/codemirror/README.md
+++ /dev/null
@@ -1,34 +0,0 @@
-# CodeMirror
-[![Build Status](https://travis-ci.org/codemirror/CodeMirror.svg)](https://travis-ci.org/codemirror/CodeMirror)
-[![NPM version](https://img.shields.io/npm/v/codemirror.svg)](https://www.npmjs.org/package/codemirror)
-[![Join the chat at https://gitter.im/codemirror/CodeMirror](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/codemirror/CodeMirror)  
-[Funding status: ![maintainer happiness](https://marijnhaverbeke.nl/fund/status_s.png?again)](https://marijnhaverbeke.nl/fund/)
-
-CodeMirror is a versatile text editor implemented in JavaScript for
-the browser. It is specialized for editing code, and comes with over
-100 language modes and various addons that implement more advanced
-editing functionality.
-
-A rich programming API and a CSS theming system are available for
-customizing CodeMirror to fit your application, and extending it with
-new functionality.
-
-You can find more information (and the
-[manual](http://codemirror.net/doc/manual.html)) on the [project
-page](http://codemirror.net). For questions and discussion, use the
-[discussion forum](https://discuss.codemirror.net/).
-
-See
-[CONTRIBUTING.md](https://github.com/codemirror/CodeMirror/blob/master/CONTRIBUTING.md)
-for contributing guidelines.
-
-The CodeMirror community aims to be welcoming to everybody. We use the
-[Contributor Covenant
-(1.1)](http://contributor-covenant.org/version/1/1/0/) as our code of
-conduct.
-
-### Quickstart
-
-To build the project, make sure you have Node.js installed (at least version 6)
-and then `npm install`. To run, just open `index.html` in your
-browser (you don't need to run a webserver). Run the tests with `npm test`.
diff --git a/static/lib/codemirror/lib/codemirror.css b/static/lib/codemirror/lib/codemirror.css
deleted file mode 100644
index b962b38..0000000
--- a/static/lib/codemirror/lib/codemirror.css
+++ /dev/null
@@ -1,340 +0,0 @@
-/* BASICS */
-
-.CodeMirror {
-  /* Set height, width, borders, and global font properties here */
-  font-family: monospace;
-  height: 300px;
-  color: black;
-}
-
-/* PADDING */
-
-.CodeMirror-lines {
-  padding: 4px 0; /* Vertical padding around content */
-}
-.CodeMirror pre {
-  padding: 0 4px; /* Horizontal padding of content */
-}
-
-.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
-  background-color: white; /* The little square between H and V scrollbars */
-}
-
-/* GUTTER */
-
-.CodeMirror-gutters {
-  border-right: 1px solid #ddd;
-  background-color: #f7f7f7;
-  white-space: nowrap;
-}
-.CodeMirror-linenumbers {}
-.CodeMirror-linenumber {
-  padding: 0 3px 0 5px;
-  min-width: 20px;
-  text-align: right;
-  color: #999;
-  white-space: nowrap;
-}
-
-.CodeMirror-guttermarker { color: black; }
-.CodeMirror-guttermarker-subtle { color: #999; }
-
-/* CURSOR */
-
-.CodeMirror-cursor {
-  border-left: 1px solid black;
-  border-right: none;
-  width: 0;
-}
-/* Shown when moving in bi-directional text */
-.CodeMirror div.CodeMirror-secondarycursor {
-  border-left: 1px solid silver;
-}
-.cm-fat-cursor .CodeMirror-cursor {
-  width: auto;
-  border: 0 !important;
-  background: #7e7;
-}
-.cm-fat-cursor div.CodeMirror-cursors {
-  z-index: 1;
-}
-
-.cm-animate-fat-cursor {
-  width: auto;
-  border: 0;
-  -webkit-animation: blink 1.06s steps(1) infinite;
-  -moz-animation: blink 1.06s steps(1) infinite;
-  animation: blink 1.06s steps(1) infinite;
-  background-color: #7e7;
-}
-@-moz-keyframes blink {
-  0% {}
-  50% { background-color: transparent; }
-  100% {}
-}
-@-webkit-keyframes blink {
-  0% {}
-  50% { background-color: transparent; }
-  100% {}
-}
-@keyframes blink {
-  0% {}
-  50% { background-color: transparent; }
-  100% {}
-}
-
-/* Can style cursor different in overwrite (non-insert) mode */
-.CodeMirror-overwrite .CodeMirror-cursor {}
-
-.cm-tab { display: inline-block; text-decoration: inherit; }
-
-.CodeMirror-rulers {
-  position: absolute;
-  left: 0; right: 0; top: -50px; bottom: -20px;
-  overflow: hidden;
-}
-.CodeMirror-ruler {
-  border-left: 1px solid #ccc;
-  top: 0; bottom: 0;
-  position: absolute;
-}
-
-/* DEFAULT THEME */
-
-.cm-s-default .cm-header {color: blue;}
-.cm-s-default .cm-quote {color: #090;}
-.cm-negative {color: #d44;}
-.cm-positive {color: #292;}
-.cm-header, .cm-strong {font-weight: bold;}
-.cm-em {font-style: italic;}
-.cm-link {text-decoration: underline;}
-.cm-strikethrough {text-decoration: line-through;}
-
-.cm-s-default .cm-keyword {color: #708;}
-.cm-s-default .cm-atom {color: #219;}
-.cm-s-default .cm-number {color: #164;}
-.cm-s-default .cm-def {color: #00f;}
-.cm-s-default .cm-variable,
-.cm-s-default .cm-punctuation,
-.cm-s-default .cm-property,
-.cm-s-default .cm-operator {}
-.cm-s-default .cm-variable-2 {color: #05a;}
-.cm-s-default .cm-variable-3 {color: #085;}
-.cm-s-default .cm-comment {color: #a50;}
-.cm-s-default .cm-string {color: #a11;}
-.cm-s-default .cm-string-2 {color: #f50;}
-.cm-s-default .cm-meta {color: #555;}
-.cm-s-default .cm-qualifier {color: #555;}
-.cm-s-default .cm-builtin {color: #30a;}
-.cm-s-default .cm-bracket {color: #997;}
-.cm-s-default .cm-tag {color: #170;}
-.cm-s-default .cm-attribute {color: #00c;}
-.cm-s-default .cm-hr {color: #999;}
-.cm-s-default .cm-link {color: #00c;}
-
-.cm-s-default .cm-error {color: #f00;}
-.cm-invalidchar {color: #f00;}
-
-.CodeMirror-composing { border-bottom: 2px solid; }
-
-/* Default styles for common addons */
-
-div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
-div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
-.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
-.CodeMirror-activeline-background {background: #e8f2ff;}
-
-/* STOP */
-
-/* The rest of this file contains styles related to the mechanics of
-   the editor. You probably shouldn't touch them. */
-
-.CodeMirror {
-  position: relative;
-  overflow: hidden;
-  background: white;
-}
-
-.CodeMirror-scroll {
-  overflow: scroll !important; /* Things will break if this is overridden */
-  /* 30px is the magic margin used to hide the element's real scrollbars */
-  /* See overflow: hidden in .CodeMirror */
-  margin-bottom: -30px; margin-right: -30px;
-  padding-bottom: 30px;
-  height: 100%;
-  outline: none; /* Prevent dragging from highlighting the element */
-  position: relative;
-}
-.CodeMirror-sizer {
-  position: relative;
-  border-right: 30px solid transparent;
-}
-
-/* The fake, visible scrollbars. Used to force redraw during scrolling
-   before actual scrolling happens, thus preventing shaking and
-   flickering artifacts. */
-.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
-  position: absolute;
-  z-index: 6;
-  display: none;
-}
-.CodeMirror-vscrollbar {
-  right: 0; top: 0;
-  overflow-x: hidden;
-  overflow-y: scroll;
-}
-.CodeMirror-hscrollbar {
-  bottom: 0; left: 0;
-  overflow-y: hidden;
-  overflow-x: scroll;
-}
-.CodeMirror-scrollbar-filler {
-  right: 0; bottom: 0;
-}
-.CodeMirror-gutter-filler {
-  left: 0; bottom: 0;
-}
-
-.CodeMirror-gutters {
-  position: absolute; left: 0; top: 0;
-  min-height: 100%;
-  z-index: 3;
-}
-.CodeMirror-gutter {
-  white-space: normal;
-  height: 100%;
-  display: inline-block;
-  vertical-align: top;
-  margin-bottom: -30px;
-}
-.CodeMirror-gutter-wrapper {
-  position: absolute;
-  z-index: 4;
-  background: none !important;
-  border: none !important;
-}
-.CodeMirror-gutter-background {
-  position: absolute;
-  top: 0; bottom: 0;
-  z-index: 4;
-}
-.CodeMirror-gutter-elt {
-  position: absolute;
-  cursor: default;
-  z-index: 4;
-}
-.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
-.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
-
-.CodeMirror-lines {
-  cursor: text;
-  min-height: 1px; /* prevents collapsing before first draw */
-}
-.CodeMirror pre {
-  /* Reset some styles that the rest of the page might have set */
-  -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
-  border-width: 0;
-  background: transparent;
-  font-family: inherit;
-  font-size: inherit;
-  margin: 0;
-  white-space: pre;
-  word-wrap: normal;
-  line-height: inherit;
-  color: inherit;
-  z-index: 2;
-  position: relative;
-  overflow: visible;
-  -webkit-tap-highlight-color: transparent;
-  -webkit-font-variant-ligatures: contextual;
-  font-variant-ligatures: contextual;
-}
-.CodeMirror-wrap pre {
-  word-wrap: break-word;
-  white-space: pre-wrap;
-  word-break: normal;
-}
-
-.CodeMirror-linebackground {
-  position: absolute;
-  left: 0; right: 0; top: 0; bottom: 0;
-  z-index: 0;
-}
-
-.CodeMirror-linewidget {
-  position: relative;
-  z-index: 2;
-  overflow: auto;
-}
-
-.CodeMirror-widget {}
-
-.CodeMirror-rtl pre { direction: rtl; }
-
-.CodeMirror-code {
-  outline: none;
-}
-
-/* Force content-box sizing for the elements where we expect it */
-.CodeMirror-scroll,
-.CodeMirror-sizer,
-.CodeMirror-gutter,
-.CodeMirror-gutters,
-.CodeMirror-linenumber {
-  -moz-box-sizing: content-box;
-  box-sizing: content-box;
-}
-
-.CodeMirror-measure {
-  position: absolute;
-  width: 100%;
-  height: 0;
-  overflow: hidden;
-  visibility: hidden;
-}
-
-.CodeMirror-cursor {
-  position: absolute;
-  pointer-events: none;
-}
-.CodeMirror-measure pre { position: static; }
-
-div.CodeMirror-cursors {
-  visibility: hidden;
-  position: relative;
-  z-index: 3;
-}
-div.CodeMirror-dragcursors {
-  visibility: visible;
-}
-
-.CodeMirror-focused div.CodeMirror-cursors {
-  visibility: visible;
-}
-
-.CodeMirror-selected { background: #d9d9d9; }
-.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
-.CodeMirror-crosshair { cursor: crosshair; }
-.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
-.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
-
-.cm-searching {
-  background: #ffa;
-  background: rgba(255, 255, 0, .4);
-}
-
-/* Used to force a border model for a node */
-.cm-force-border { padding-right: .1px; }
-
-@media print {
-  /* Hide the cursor when printing */
-  .CodeMirror div.CodeMirror-cursors {
-    visibility: hidden;
-  }
-}
-
-/* See issue #2901 */
-.cm-tab-wrap-hack:after { content: ''; }
-
-/* Help users use markselection to safely style text background */
-span.CodeMirror-selectedtext { background: none; }
diff --git a/static/lib/codemirror/lib/codemirror.js b/static/lib/codemirror/lib/codemirror.js
deleted file mode 100644
index 8f2e33d..0000000
--- a/static/lib/codemirror/lib/codemirror.js
+++ /dev/null
@@ -1,9331 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-// This is CodeMirror (http://codemirror.net), a code editor
-// implemented in JavaScript on top of the browser's DOM.
-//
-// You can find some technical background for some of the code below
-// at http://marijnhaverbeke.nl/blog/#cm-internals .
-
-(function (global, factory) {
-  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
-  typeof define === 'function' && define.amd ? define(factory) :
-  (global.CodeMirror = factory());
-}(this, (function () { 'use strict';
-
-// Kludges for bugs and behavior differences that can't be feature
-// detected are enabled based on userAgent etc sniffing.
-var userAgent = navigator.userAgent
-var platform = navigator.platform
-
-var gecko = /gecko\/\d/i.test(userAgent)
-var ie_upto10 = /MSIE \d/.test(userAgent)
-var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent)
-var edge = /Edge\/(\d+)/.exec(userAgent)
-var ie = ie_upto10 || ie_11up || edge
-var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1])
-var webkit = !edge && /WebKit\//.test(userAgent)
-var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent)
-var chrome = !edge && /Chrome\//.test(userAgent)
-var presto = /Opera\//.test(userAgent)
-var safari = /Apple Computer/.test(navigator.vendor)
-var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent)
-var phantom = /PhantomJS/.test(userAgent)
-
-var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent)
-var android = /Android/.test(userAgent)
-// This is woefully incomplete. Suggestions for alternative methods welcome.
-var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent)
-var mac = ios || /Mac/.test(platform)
-var chromeOS = /\bCrOS\b/.test(userAgent)
-var windows = /win/i.test(platform)
-
-var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/)
-if (presto_version) { presto_version = Number(presto_version[1]) }
-if (presto_version && presto_version >= 15) { presto = false; webkit = true }
-// Some browsers use the wrong event properties to signal cmd/ctrl on OS X
-var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11))
-var captureRightClick = gecko || (ie && ie_version >= 9)
-
-function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
-
-var rmClass = function(node, cls) {
-  var current = node.className
-  var match = classTest(cls).exec(current)
-  if (match) {
-    var after = current.slice(match.index + match[0].length)
-    node.className = current.slice(0, match.index) + (after ? match[1] + after : "")
-  }
-}
-
-function removeChildren(e) {
-  for (var count = e.childNodes.length; count > 0; --count)
-    { e.removeChild(e.firstChild) }
-  return e
-}
-
-function removeChildrenAndAdd(parent, e) {
-  return removeChildren(parent).appendChild(e)
-}
-
-function elt(tag, content, className, style) {
-  var e = document.createElement(tag)
-  if (className) { e.className = className }
-  if (style) { e.style.cssText = style }
-  if (typeof content == "string") { e.appendChild(document.createTextNode(content)) }
-  else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]) } }
-  return e
-}
-// wrapper for elt, which removes the elt from the accessibility tree
-function eltP(tag, content, className, style) {
-  var e = elt(tag, content, className, style)
-  e.setAttribute("role", "presentation")
-  return e
-}
-
-var range
-if (document.createRange) { range = function(node, start, end, endNode) {
-  var r = document.createRange()
-  r.setEnd(endNode || node, end)
-  r.setStart(node, start)
-  return r
-} }
-else { range = function(node, start, end) {
-  var r = document.body.createTextRange()
-  try { r.moveToElementText(node.parentNode) }
-  catch(e) { return r }
-  r.collapse(true)
-  r.moveEnd("character", end)
-  r.moveStart("character", start)
-  return r
-} }
-
-function contains(parent, child) {
-  if (child.nodeType == 3) // Android browser always returns false when child is a textnode
-    { child = child.parentNode }
-  if (parent.contains)
-    { return parent.contains(child) }
-  do {
-    if (child.nodeType == 11) { child = child.host }
-    if (child == parent) { return true }
-  } while (child = child.parentNode)
-}
-
-function activeElt() {
-  // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
-  // IE < 10 will throw when accessed while the page is loading or in an iframe.
-  // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
-  var activeElement
-  try {
-    activeElement = document.activeElement
-  } catch(e) {
-    activeElement = document.body || null
-  }
-  while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
-    { activeElement = activeElement.shadowRoot.activeElement }
-  return activeElement
-}
-
-function addClass(node, cls) {
-  var current = node.className
-  if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls }
-}
-function joinClasses(a, b) {
-  var as = a.split(" ")
-  for (var i = 0; i < as.length; i++)
-    { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i] } }
-  return b
-}
-
-var selectInput = function(node) { node.select() }
-if (ios) // Mobile Safari apparently has a bug where select() is broken.
-  { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length } }
-else if (ie) // Suppress mysterious IE10 errors
-  { selectInput = function(node) { try { node.select() } catch(_e) {} } }
-
-function bind(f) {
-  var args = Array.prototype.slice.call(arguments, 1)
-  return function(){return f.apply(null, args)}
-}
-
-function copyObj(obj, target, overwrite) {
-  if (!target) { target = {} }
-  for (var prop in obj)
-    { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
-      { target[prop] = obj[prop] } }
-  return target
-}
-
-// Counts the column offset in a string, taking tabs into account.
-// Used mostly to find indentation.
-function countColumn(string, end, tabSize, startIndex, startValue) {
-  if (end == null) {
-    end = string.search(/[^\s\u00a0]/)
-    if (end == -1) { end = string.length }
-  }
-  for (var i = startIndex || 0, n = startValue || 0;;) {
-    var nextTab = string.indexOf("\t", i)
-    if (nextTab < 0 || nextTab >= end)
-      { return n + (end - i) }
-    n += nextTab - i
-    n += tabSize - (n % tabSize)
-    i = nextTab + 1
-  }
-}
-
-var Delayed = function() {this.id = null};
-Delayed.prototype.set = function (ms, f) {
-  clearTimeout(this.id)
-  this.id = setTimeout(f, ms)
-};
-
-function indexOf(array, elt) {
-  for (var i = 0; i < array.length; ++i)
-    { if (array[i] == elt) { return i } }
-  return -1
-}
-
-// Number of pixels added to scroller and sizer to hide scrollbar
-var scrollerGap = 30
-
-// Returned or thrown by various protocols to signal 'I'm not
-// handling this'.
-var Pass = {toString: function(){return "CodeMirror.Pass"}}
-
-// Reused option objects for setSelection & friends
-var sel_dontScroll = {scroll: false};
-var sel_mouse = {origin: "*mouse"};
-var sel_move = {origin: "+move"};
-// The inverse of countColumn -- find the offset that corresponds to
-// a particular column.
-function findColumn(string, goal, tabSize) {
-  for (var pos = 0, col = 0;;) {
-    var nextTab = string.indexOf("\t", pos)
-    if (nextTab == -1) { nextTab = string.length }
-    var skipped = nextTab - pos
-    if (nextTab == string.length || col + skipped >= goal)
-      { return pos + Math.min(skipped, goal - col) }
-    col += nextTab - pos
-    col += tabSize - (col % tabSize)
-    pos = nextTab + 1
-    if (col >= goal) { return pos }
-  }
-}
-
-var spaceStrs = [""]
-function spaceStr(n) {
-  while (spaceStrs.length <= n)
-    { spaceStrs.push(lst(spaceStrs) + " ") }
-  return spaceStrs[n]
-}
-
-function lst(arr) { return arr[arr.length-1] }
-
-function map(array, f) {
-  var out = []
-  for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i) }
-  return out
-}
-
-function insertSorted(array, value, score) {
-  var pos = 0, priority = score(value)
-  while (pos < array.length && score(array[pos]) <= priority) { pos++ }
-  array.splice(pos, 0, value)
-}
-
-function nothing() {}
-
-function createObj(base, props) {
-  var inst
-  if (Object.create) {
-    inst = Object.create(base)
-  } else {
-    nothing.prototype = base
-    inst = new nothing()
-  }
-  if (props) { copyObj(props, inst) }
-  return inst
-}
-
-var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/
-function isWordCharBasic(ch) {
-  return /\w/.test(ch) || ch > "\x80" &&
-    (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
-}
-function isWordChar(ch, helper) {
-  if (!helper) { return isWordCharBasic(ch) }
-  if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true }
-  return helper.test(ch)
-}
-
-function isEmpty(obj) {
-  for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }
-  return true
-}
-
-// Extending unicode characters. A series of a non-extending char +
-// any number of extending chars is treated as a single unit as far
-// as editing and measuring is concerned. This is not fully correct,
-// since some scripts/fonts/browsers also treat other configurations
-// of code points as a group.
-var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/
-function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }
-
-// Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
-function skipExtendingChars(str, pos, dir) {
-  while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir }
-  return pos
-}
-
-// Returns the value from the range [`from`; `to`] that satisfies
-// `pred` and is closest to `from`. Assumes that at least `to` satisfies `pred`.
-function findFirst(pred, from, to) {
-  for (;;) {
-    if (Math.abs(from - to) <= 1) { return pred(from) ? from : to }
-    var mid = Math.floor((from + to) / 2)
-    if (pred(mid)) { to = mid }
-    else { from = mid }
-  }
-}
-
-// The display handles the DOM integration, both for input reading
-// and content drawing. It holds references to DOM nodes and
-// display-related state.
-
-function Display(place, doc, input) {
-  var d = this
-  this.input = input
-
-  // Covers bottom-right square when both scrollbars are present.
-  d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler")
-  d.scrollbarFiller.setAttribute("cm-not-content", "true")
-  // Covers bottom of gutter when coverGutterNextToScrollbar is on
-  // and h scrollbar is present.
-  d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler")
-  d.gutterFiller.setAttribute("cm-not-content", "true")
-  // Will contain the actual code, positioned to cover the viewport.
-  d.lineDiv = eltP("div", null, "CodeMirror-code")
-  // Elements are added to these to represent selection and cursors.
-  d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1")
-  d.cursorDiv = elt("div", null, "CodeMirror-cursors")
-  // A visibility: hidden element used to find the size of things.
-  d.measure = elt("div", null, "CodeMirror-measure")
-  // When lines outside of the viewport are measured, they are drawn in this.
-  d.lineMeasure = elt("div", null, "CodeMirror-measure")
-  // Wraps everything that needs to exist inside the vertically-padded coordinate system
-  d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
-                    null, "position: relative; outline: none")
-  var lines = eltP("div", [d.lineSpace], "CodeMirror-lines")
-  // Moved around its parent to cover visible view.
-  d.mover = elt("div", [lines], null, "position: relative")
-  // Set to the height of the document, allowing scrolling.
-  d.sizer = elt("div", [d.mover], "CodeMirror-sizer")
-  d.sizerWidth = null
-  // Behavior of elts with overflow: auto and padding is
-  // inconsistent across browsers. This is used to ensure the
-  // scrollable area is big enough.
-  d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;")
-  // Will contain the gutters, if any.
-  d.gutters = elt("div", null, "CodeMirror-gutters")
-  d.lineGutter = null
-  // Actual scrollable element.
-  d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll")
-  d.scroller.setAttribute("tabIndex", "-1")
-  // The element in which the editor lives.
-  d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror")
-
-  // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
-  if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0 }
-  if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true }
-
-  if (place) {
-    if (place.appendChild) { place.appendChild(d.wrapper) }
-    else { place(d.wrapper) }
-  }
-
-  // Current rendered range (may be bigger than the view window).
-  d.viewFrom = d.viewTo = doc.first
-  d.reportedViewFrom = d.reportedViewTo = doc.first
-  // Information about the rendered lines.
-  d.view = []
-  d.renderedView = null
-  // Holds info about a single rendered line when it was rendered
-  // for measurement, while not in view.
-  d.externalMeasured = null
-  // Empty space (in pixels) above the view
-  d.viewOffset = 0
-  d.lastWrapHeight = d.lastWrapWidth = 0
-  d.updateLineNumbers = null
-
-  d.nativeBarWidth = d.barHeight = d.barWidth = 0
-  d.scrollbarsClipped = false
-
-  // Used to only resize the line number gutter when necessary (when
-  // the amount of lines crosses a boundary that makes its width change)
-  d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null
-  // Set to true when a non-horizontal-scrolling line widget is
-  // added. As an optimization, line widget aligning is skipped when
-  // this is false.
-  d.alignWidgets = false
-
-  d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null
-
-  // Tracks the maximum line length so that the horizontal scrollbar
-  // can be kept static when scrolling.
-  d.maxLine = null
-  d.maxLineLength = 0
-  d.maxLineChanged = false
-
-  // Used for measuring wheel scrolling granularity
-  d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null
-
-  // True when shift is held down.
-  d.shift = false
-
-  // Used to track whether anything happened since the context menu
-  // was opened.
-  d.selForContextMenu = null
-
-  d.activeTouch = null
-
-  input.init(d)
-}
-
-// Find the line object corresponding to the given line number.
-function getLine(doc, n) {
-  n -= doc.first
-  if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
-  var chunk = doc
-  while (!chunk.lines) {
-    for (var i = 0;; ++i) {
-      var child = chunk.children[i], sz = child.chunkSize()
-      if (n < sz) { chunk = child; break }
-      n -= sz
-    }
-  }
-  return chunk.lines[n]
-}
-
-// Get the part of a document between two positions, as an array of
-// strings.
-function getBetween(doc, start, end) {
-  var out = [], n = start.line
-  doc.iter(start.line, end.line + 1, function (line) {
-    var text = line.text
-    if (n == end.line) { text = text.slice(0, end.ch) }
-    if (n == start.line) { text = text.slice(start.ch) }
-    out.push(text)
-    ++n
-  })
-  return out
-}
-// Get the lines between from and to, as array of strings.
-function getLines(doc, from, to) {
-  var out = []
-  doc.iter(from, to, function (line) { out.push(line.text) }) // iter aborts when callback returns truthy value
-  return out
-}
-
-// Update the height of a line, propagating the height change
-// upwards to parent nodes.
-function updateLineHeight(line, height) {
-  var diff = height - line.height
-  if (diff) { for (var n = line; n; n = n.parent) { n.height += diff } }
-}
-
-// Given a line object, find its line number by walking up through
-// its parent links.
-function lineNo(line) {
-  if (line.parent == null) { return null }
-  var cur = line.parent, no = indexOf(cur.lines, line)
-  for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
-    for (var i = 0;; ++i) {
-      if (chunk.children[i] == cur) { break }
-      no += chunk.children[i].chunkSize()
-    }
-  }
-  return no + cur.first
-}
-
-// Find the line at the given vertical position, using the height
-// information in the document tree.
-function lineAtHeight(chunk, h) {
-  var n = chunk.first
-  outer: do {
-    for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
-      var child = chunk.children[i$1], ch = child.height
-      if (h < ch) { chunk = child; continue outer }
-      h -= ch
-      n += child.chunkSize()
-    }
-    return n
-  } while (!chunk.lines)
-  var i = 0
-  for (; i < chunk.lines.length; ++i) {
-    var line = chunk.lines[i], lh = line.height
-    if (h < lh) { break }
-    h -= lh
-  }
-  return n + i
-}
-
-function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
-
-function lineNumberFor(options, i) {
-  return String(options.lineNumberFormatter(i + options.firstLineNumber))
-}
-
-// A Pos instance represents a position within the text.
-function Pos(line, ch, sticky) {
-  if ( sticky === void 0 ) sticky = null;
-
-  if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }
-  this.line = line
-  this.ch = ch
-  this.sticky = sticky
-}
-
-// Compare two positions, return 0 if they are the same, a negative
-// number when a is less, and a positive number otherwise.
-function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
-
-function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
-
-function copyPos(x) {return Pos(x.line, x.ch)}
-function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
-function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
-
-// Most of the external API clips given positions to make sure they
-// actually exist within the document.
-function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
-function clipPos(doc, pos) {
-  if (pos.line < doc.first) { return Pos(doc.first, 0) }
-  var last = doc.first + doc.size - 1
-  if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
-  return clipToLen(pos, getLine(doc, pos.line).text.length)
-}
-function clipToLen(pos, linelen) {
-  var ch = pos.ch
-  if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }
-  else if (ch < 0) { return Pos(pos.line, 0) }
-  else { return pos }
-}
-function clipPosArray(doc, array) {
-  var out = []
-  for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]) }
-  return out
-}
-
-// Optimize some code when these features are not used.
-var sawReadOnlySpans = false;
-var sawCollapsedSpans = false;
-function seeReadOnlySpans() {
-  sawReadOnlySpans = true
-}
-
-function seeCollapsedSpans() {
-  sawCollapsedSpans = true
-}
-
-// TEXTMARKER SPANS
-
-function MarkedSpan(marker, from, to) {
-  this.marker = marker
-  this.from = from; this.to = to
-}
-
-// Search an array of spans for a span matching the given marker.
-function getMarkedSpanFor(spans, marker) {
-  if (spans) { for (var i = 0; i < spans.length; ++i) {
-    var span = spans[i]
-    if (span.marker == marker) { return span }
-  } }
-}
-// Remove a span from an array, returning undefined if no spans are
-// left (we don't store arrays for lines without spans).
-function removeMarkedSpan(spans, span) {
-  var r
-  for (var i = 0; i < spans.length; ++i)
-    { if (spans[i] != span) { (r || (r = [])).push(spans[i]) } }
-  return r
-}
-// Add a span to a line.
-function addMarkedSpan(line, span) {
-  line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]
-  span.marker.attachLine(line)
-}
-
-// Used for the algorithm that adjusts markers for a change in the
-// document. These functions cut an array of spans at a given
-// character position, returning an array of remaining chunks (or
-// undefined if nothing remains).
-function markedSpansBefore(old, startCh, isInsert) {
-  var nw
-  if (old) { for (var i = 0; i < old.length; ++i) {
-    var span = old[i], marker = span.marker
-    var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh)
-    if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
-      var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)
-      ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to))
-    }
-  } }
-  return nw
-}
-function markedSpansAfter(old, endCh, isInsert) {
-  var nw
-  if (old) { for (var i = 0; i < old.length; ++i) {
-    var span = old[i], marker = span.marker
-    var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh)
-    if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
-      var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)
-      ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
-                                            span.to == null ? null : span.to - endCh))
-    }
-  } }
-  return nw
-}
-
-// Given a change object, compute the new set of marker spans that
-// cover the line in which the change took place. Removes spans
-// entirely within the change, reconnects spans belonging to the
-// same marker that appear on both sides of the change, and cuts off
-// spans partially within the change. Returns an array of span
-// arrays with one element for each line in (after) the change.
-function stretchSpansOverChange(doc, change) {
-  if (change.full) { return null }
-  var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans
-  var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans
-  if (!oldFirst && !oldLast) { return null }
-
-  var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0
-  // Get the spans that 'stick out' on both sides
-  var first = markedSpansBefore(oldFirst, startCh, isInsert)
-  var last = markedSpansAfter(oldLast, endCh, isInsert)
-
-  // Next, merge those two ends
-  var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0)
-  if (first) {
-    // Fix up .to properties of first
-    for (var i = 0; i < first.length; ++i) {
-      var span = first[i]
-      if (span.to == null) {
-        var found = getMarkedSpanFor(last, span.marker)
-        if (!found) { span.to = startCh }
-        else if (sameLine) { span.to = found.to == null ? null : found.to + offset }
-      }
-    }
-  }
-  if (last) {
-    // Fix up .from in last (or move them into first in case of sameLine)
-    for (var i$1 = 0; i$1 < last.length; ++i$1) {
-      var span$1 = last[i$1]
-      if (span$1.to != null) { span$1.to += offset }
-      if (span$1.from == null) {
-        var found$1 = getMarkedSpanFor(first, span$1.marker)
-        if (!found$1) {
-          span$1.from = offset
-          if (sameLine) { (first || (first = [])).push(span$1) }
-        }
-      } else {
-        span$1.from += offset
-        if (sameLine) { (first || (first = [])).push(span$1) }
-      }
-    }
-  }
-  // Make sure we didn't create any zero-length spans
-  if (first) { first = clearEmptySpans(first) }
-  if (last && last != first) { last = clearEmptySpans(last) }
-
-  var newMarkers = [first]
-  if (!sameLine) {
-    // Fill gap with whole-line-spans
-    var gap = change.text.length - 2, gapMarkers
-    if (gap > 0 && first)
-      { for (var i$2 = 0; i$2 < first.length; ++i$2)
-        { if (first[i$2].to == null)
-          { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)) } } }
-    for (var i$3 = 0; i$3 < gap; ++i$3)
-      { newMarkers.push(gapMarkers) }
-    newMarkers.push(last)
-  }
-  return newMarkers
-}
-
-// Remove spans that are empty and don't have a clearWhenEmpty
-// option of false.
-function clearEmptySpans(spans) {
-  for (var i = 0; i < spans.length; ++i) {
-    var span = spans[i]
-    if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
-      { spans.splice(i--, 1) }
-  }
-  if (!spans.length) { return null }
-  return spans
-}
-
-// Used to 'clip' out readOnly ranges when making a change.
-function removeReadOnlyRanges(doc, from, to) {
-  var markers = null
-  doc.iter(from.line, to.line + 1, function (line) {
-    if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
-      var mark = line.markedSpans[i].marker
-      if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
-        { (markers || (markers = [])).push(mark) }
-    } }
-  })
-  if (!markers) { return null }
-  var parts = [{from: from, to: to}]
-  for (var i = 0; i < markers.length; ++i) {
-    var mk = markers[i], m = mk.find(0)
-    for (var j = 0; j < parts.length; ++j) {
-      var p = parts[j]
-      if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
-      var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to)
-      if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
-        { newParts.push({from: p.from, to: m.from}) }
-      if (dto > 0 || !mk.inclusiveRight && !dto)
-        { newParts.push({from: m.to, to: p.to}) }
-      parts.splice.apply(parts, newParts)
-      j += newParts.length - 3
-    }
-  }
-  return parts
-}
-
-// Connect or disconnect spans from a line.
-function detachMarkedSpans(line) {
-  var spans = line.markedSpans
-  if (!spans) { return }
-  for (var i = 0; i < spans.length; ++i)
-    { spans[i].marker.detachLine(line) }
-  line.markedSpans = null
-}
-function attachMarkedSpans(line, spans) {
-  if (!spans) { return }
-  for (var i = 0; i < spans.length; ++i)
-    { spans[i].marker.attachLine(line) }
-  line.markedSpans = spans
-}
-
-// Helpers used when computing which overlapping collapsed span
-// counts as the larger one.
-function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
-function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }
-
-// Returns a number indicating which of two overlapping collapsed
-// spans is larger (and thus includes the other). Falls back to
-// comparing ids when the spans cover exactly the same range.
-function compareCollapsedMarkers(a, b) {
-  var lenDiff = a.lines.length - b.lines.length
-  if (lenDiff != 0) { return lenDiff }
-  var aPos = a.find(), bPos = b.find()
-  var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b)
-  if (fromCmp) { return -fromCmp }
-  var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b)
-  if (toCmp) { return toCmp }
-  return b.id - a.id
-}
-
-// Find out whether a line ends or starts in a collapsed span. If
-// so, return the marker for that span.
-function collapsedSpanAtSide(line, start) {
-  var sps = sawCollapsedSpans && line.markedSpans, found
-  if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
-    sp = sps[i]
-    if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
-        (!found || compareCollapsedMarkers(found, sp.marker) < 0))
-      { found = sp.marker }
-  } }
-  return found
-}
-function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
-function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
-
-// Test whether there exists a collapsed span that partially
-// overlaps (covers the start or end, but not both) of a new span.
-// Such overlap is not allowed.
-function conflictingCollapsedRange(doc, lineNo, from, to, marker) {
-  var line = getLine(doc, lineNo)
-  var sps = sawCollapsedSpans && line.markedSpans
-  if (sps) { for (var i = 0; i < sps.length; ++i) {
-    var sp = sps[i]
-    if (!sp.marker.collapsed) { continue }
-    var found = sp.marker.find(0)
-    var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker)
-    var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker)
-    if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
-    if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
-        fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
-      { return true }
-  } }
-}
-
-// A visual line is a line as drawn on the screen. Folding, for
-// example, can cause multiple logical lines to appear on the same
-// visual line. This finds the start of the visual line that the
-// given line is part of (usually that is the line itself).
-function visualLine(line) {
-  var merged
-  while (merged = collapsedSpanAtStart(line))
-    { line = merged.find(-1, true).line }
-  return line
-}
-
-function visualLineEnd(line) {
-  var merged
-  while (merged = collapsedSpanAtEnd(line))
-    { line = merged.find(1, true).line }
-  return line
-}
-
-// Returns an array of logical lines that continue the visual line
-// started by the argument, or undefined if there are no such lines.
-function visualLineContinued(line) {
-  var merged, lines
-  while (merged = collapsedSpanAtEnd(line)) {
-    line = merged.find(1, true).line
-    ;(lines || (lines = [])).push(line)
-  }
-  return lines
-}
-
-// Get the line number of the start of the visual line that the
-// given line number is part of.
-function visualLineNo(doc, lineN) {
-  var line = getLine(doc, lineN), vis = visualLine(line)
-  if (line == vis) { return lineN }
-  return lineNo(vis)
-}
-
-// Get the line number of the start of the next visual line after
-// the given line.
-function visualLineEndNo(doc, lineN) {
-  if (lineN > doc.lastLine()) { return lineN }
-  var line = getLine(doc, lineN), merged
-  if (!lineIsHidden(doc, line)) { return lineN }
-  while (merged = collapsedSpanAtEnd(line))
-    { line = merged.find(1, true).line }
-  return lineNo(line) + 1
-}
-
-// Compute whether a line is hidden. Lines count as hidden when they
-// are part of a visual line that starts with another line, or when
-// they are entirely covered by collapsed, non-widget span.
-function lineIsHidden(doc, line) {
-  var sps = sawCollapsedSpans && line.markedSpans
-  if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
-    sp = sps[i]
-    if (!sp.marker.collapsed) { continue }
-    if (sp.from == null) { return true }
-    if (sp.marker.widgetNode) { continue }
-    if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
-      { return true }
-  } }
-}
-function lineIsHiddenInner(doc, line, span) {
-  if (span.to == null) {
-    var end = span.marker.find(1, true)
-    return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
-  }
-  if (span.marker.inclusiveRight && span.to == line.text.length)
-    { return true }
-  for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {
-    sp = line.markedSpans[i]
-    if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
-        (sp.to == null || sp.to != span.from) &&
-        (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
-        lineIsHiddenInner(doc, line, sp)) { return true }
-  }
-}
-
-// Find the height above the given line.
-function heightAtLine(lineObj) {
-  lineObj = visualLine(lineObj)
-
-  var h = 0, chunk = lineObj.parent
-  for (var i = 0; i < chunk.lines.length; ++i) {
-    var line = chunk.lines[i]
-    if (line == lineObj) { break }
-    else { h += line.height }
-  }
-  for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
-    for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
-      var cur = p.children[i$1]
-      if (cur == chunk) { break }
-      else { h += cur.height }
-    }
-  }
-  return h
-}
-
-// Compute the character length of a line, taking into account
-// collapsed ranges (see markText) that might hide parts, and join
-// other lines onto it.
-function lineLength(line) {
-  if (line.height == 0) { return 0 }
-  var len = line.text.length, merged, cur = line
-  while (merged = collapsedSpanAtStart(cur)) {
-    var found = merged.find(0, true)
-    cur = found.from.line
-    len += found.from.ch - found.to.ch
-  }
-  cur = line
-  while (merged = collapsedSpanAtEnd(cur)) {
-    var found$1 = merged.find(0, true)
-    len -= cur.text.length - found$1.from.ch
-    cur = found$1.to.line
-    len += cur.text.length - found$1.to.ch
-  }
-  return len
-}
-
-// Find the longest line in the document.
-function findMaxLine(cm) {
-  var d = cm.display, doc = cm.doc
-  d.maxLine = getLine(doc, doc.first)
-  d.maxLineLength = lineLength(d.maxLine)
-  d.maxLineChanged = true
-  doc.iter(function (line) {
-    var len = lineLength(line)
-    if (len > d.maxLineLength) {
-      d.maxLineLength = len
-      d.maxLine = line
-    }
-  })
-}
-
-// BIDI HELPERS
-
-function iterateBidiSections(order, from, to, f) {
-  if (!order) { return f(from, to, "ltr") }
-  var found = false
-  for (var i = 0; i < order.length; ++i) {
-    var part = order[i]
-    if (part.from < to && part.to > from || from == to && part.to == from) {
-      f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr")
-      found = true
-    }
-  }
-  if (!found) { f(from, to, "ltr") }
-}
-
-var bidiOther = null
-function getBidiPartAt(order, ch, sticky) {
-  var found
-  bidiOther = null
-  for (var i = 0; i < order.length; ++i) {
-    var cur = order[i]
-    if (cur.from < ch && cur.to > ch) { return i }
-    if (cur.to == ch) {
-      if (cur.from != cur.to && sticky == "before") { found = i }
-      else { bidiOther = i }
-    }
-    if (cur.from == ch) {
-      if (cur.from != cur.to && sticky != "before") { found = i }
-      else { bidiOther = i }
-    }
-  }
-  return found != null ? found : bidiOther
-}
-
-// Bidirectional ordering algorithm
-// See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
-// that this (partially) implements.
-
-// One-char codes used for character types:
-// L (L):   Left-to-Right
-// R (R):   Right-to-Left
-// r (AL):  Right-to-Left Arabic
-// 1 (EN):  European Number
-// + (ES):  European Number Separator
-// % (ET):  European Number Terminator
-// n (AN):  Arabic Number
-// , (CS):  Common Number Separator
-// m (NSM): Non-Spacing Mark
-// b (BN):  Boundary Neutral
-// s (B):   Paragraph Separator
-// t (S):   Segment Separator
-// w (WS):  Whitespace
-// N (ON):  Other Neutrals
-
-// Returns null if characters are ordered as they appear
-// (left-to-right), or an array of sections ({from, to, level}
-// objects) in the order in which they occur visually.
-var bidiOrdering = (function() {
-  // Character types for codepoints 0 to 0xff
-  var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN"
-  // Character types for codepoints 0x600 to 0x6f9
-  var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111"
-  function charType(code) {
-    if (code <= 0xf7) { return lowTypes.charAt(code) }
-    else if (0x590 <= code && code <= 0x5f4) { return "R" }
-    else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }
-    else if (0x6ee <= code && code <= 0x8ac) { return "r" }
-    else if (0x2000 <= code && code <= 0x200b) { return "w" }
-    else if (code == 0x200c) { return "b" }
-    else { return "L" }
-  }
-
-  var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/
-  var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/
-
-  function BidiSpan(level, from, to) {
-    this.level = level
-    this.from = from; this.to = to
-  }
-
-  return function(str, direction) {
-    var outerType = direction == "ltr" ? "L" : "R"
-
-    if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false }
-    var len = str.length, types = []
-    for (var i = 0; i < len; ++i)
-      { types.push(charType(str.charCodeAt(i))) }
-
-    // W1. Examine each non-spacing mark (NSM) in the level run, and
-    // change the type of the NSM to the type of the previous
-    // character. If the NSM is at the start of the level run, it will
-    // get the type of sor.
-    for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {
-      var type = types[i$1]
-      if (type == "m") { types[i$1] = prev }
-      else { prev = type }
-    }
-
-    // W2. Search backwards from each instance of a European number
-    // until the first strong type (R, L, AL, or sor) is found. If an
-    // AL is found, change the type of the European number to Arabic
-    // number.
-    // W3. Change all ALs to R.
-    for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {
-      var type$1 = types[i$2]
-      if (type$1 == "1" && cur == "r") { types[i$2] = "n" }
-      else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R" } }
-    }
-
-    // W4. A single European separator between two European numbers
-    // changes to a European number. A single common separator between
-    // two numbers of the same type changes to that type.
-    for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {
-      var type$2 = types[i$3]
-      if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1" }
-      else if (type$2 == "," && prev$1 == types[i$3+1] &&
-               (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1 }
-      prev$1 = type$2
-    }
-
-    // W5. A sequence of European terminators adjacent to European
-    // numbers changes to all European numbers.
-    // W6. Otherwise, separators and terminators change to Other
-    // Neutral.
-    for (var i$4 = 0; i$4 < len; ++i$4) {
-      var type$3 = types[i$4]
-      if (type$3 == ",") { types[i$4] = "N" }
-      else if (type$3 == "%") {
-        var end = (void 0)
-        for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {}
-        var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N"
-        for (var j = i$4; j < end; ++j) { types[j] = replace }
-        i$4 = end - 1
-      }
-    }
-
-    // W7. Search backwards from each instance of a European number
-    // until the first strong type (R, L, or sor) is found. If an L is
-    // found, then change the type of the European number to L.
-    for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {
-      var type$4 = types[i$5]
-      if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L" }
-      else if (isStrong.test(type$4)) { cur$1 = type$4 }
-    }
-
-    // N1. A sequence of neutrals takes the direction of the
-    // surrounding strong text if the text on both sides has the same
-    // direction. European and Arabic numbers act as if they were R in
-    // terms of their influence on neutrals. Start-of-level-run (sor)
-    // and end-of-level-run (eor) are used at level run boundaries.
-    // N2. Any remaining neutrals take the embedding direction.
-    for (var i$6 = 0; i$6 < len; ++i$6) {
-      if (isNeutral.test(types[i$6])) {
-        var end$1 = (void 0)
-        for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}
-        var before = (i$6 ? types[i$6-1] : outerType) == "L"
-        var after = (end$1 < len ? types[end$1] : outerType) == "L"
-        var replace$1 = before == after ? (before ? "L" : "R") : outerType
-        for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1 }
-        i$6 = end$1 - 1
-      }
-    }
-
-    // Here we depart from the documented algorithm, in order to avoid
-    // building up an actual levels array. Since there are only three
-    // levels (0, 1, 2) in an implementation that doesn't take
-    // explicit embedding into account, we can build up the order on
-    // the fly, without following the level-based algorithm.
-    var order = [], m
-    for (var i$7 = 0; i$7 < len;) {
-      if (countsAsLeft.test(types[i$7])) {
-        var start = i$7
-        for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}
-        order.push(new BidiSpan(0, start, i$7))
-      } else {
-        var pos = i$7, at = order.length
-        for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {}
-        for (var j$2 = pos; j$2 < i$7;) {
-          if (countsAsNum.test(types[j$2])) {
-            if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)) }
-            var nstart = j$2
-            for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
-            order.splice(at, 0, new BidiSpan(2, nstart, j$2))
-            pos = j$2
-          } else { ++j$2 }
-        }
-        if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)) }
-      }
-    }
-    if (order[0].level == 1 && (m = str.match(/^\s+/))) {
-      order[0].from = m[0].length
-      order.unshift(new BidiSpan(0, 0, m[0].length))
-    }
-    if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
-      lst(order).to -= m[0].length
-      order.push(new BidiSpan(0, len - m[0].length, len))
-    }
-
-    return direction == "rtl" ? order.reverse() : order
-  }
-})()
-
-// Get the bidi ordering for the given line (and cache it). Returns
-// false for lines that are fully left-to-right, and an array of
-// BidiSpan objects otherwise.
-function getOrder(line, direction) {
-  var order = line.order
-  if (order == null) { order = line.order = bidiOrdering(line.text, direction) }
-  return order
-}
-
-function moveCharLogically(line, ch, dir) {
-  var target = skipExtendingChars(line.text, ch + dir, dir)
-  return target < 0 || target > line.text.length ? null : target
-}
-
-function moveLogically(line, start, dir) {
-  var ch = moveCharLogically(line, start.ch, dir)
-  return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
-}
-
-function endOfLine(visually, cm, lineObj, lineNo, dir) {
-  if (visually) {
-    var order = getOrder(lineObj, cm.doc.direction)
-    if (order) {
-      var part = dir < 0 ? lst(order) : order[0]
-      var moveInStorageOrder = (dir < 0) == (part.level == 1)
-      var sticky = moveInStorageOrder ? "after" : "before"
-      var ch
-      // With a wrapped rtl chunk (possibly spanning multiple bidi parts),
-      // it could be that the last bidi part is not on the last visual line,
-      // since visual lines contain content order-consecutive chunks.
-      // Thus, in rtl, we are looking for the first (content-order) character
-      // in the rtl chunk that is on the last line (that is, the same line
-      // as the last (content-order) character).
-      if (part.level > 0) {
-        var prep = prepareMeasureForLine(cm, lineObj)
-        ch = dir < 0 ? lineObj.text.length - 1 : 0
-        var targetTop = measureCharPrepared(cm, prep, ch).top
-        ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch)
-        if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1, true) }
-      } else { ch = dir < 0 ? part.to : part.from }
-      return new Pos(lineNo, ch, sticky)
-    }
-  }
-  return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after")
-}
-
-function moveVisually(cm, line, start, dir) {
-  var bidi = getOrder(line, cm.doc.direction)
-  if (!bidi) { return moveLogically(line, start, dir) }
-  if (start.ch >= line.text.length) {
-    start.ch = line.text.length
-    start.sticky = "before"
-  } else if (start.ch <= 0) {
-    start.ch = 0
-    start.sticky = "after"
-  }
-  var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos]
-  if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {
-    // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,
-    // nothing interesting happens.
-    return moveLogically(line, start, dir)
-  }
-
-  var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); }
-  var prep
-  var getWrappedLineExtent = function (ch) {
-    if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }
-    prep = prep || prepareMeasureForLine(cm, line)
-    return wrappedLineExtentChar(cm, line, prep, ch)
-  }
-  var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch)
-
-  if (cm.doc.direction == "rtl" || part.level == 1) {
-    var moveInStorageOrder = (part.level == 1) == (dir < 0)
-    var ch = mv(start, moveInStorageOrder ? 1 : -1)
-    if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {
-      // Case 2: We move within an rtl part or in an rtl editor on the same visual line
-      var sticky = moveInStorageOrder ? "before" : "after"
-      return new Pos(start.line, ch, sticky)
-    }
-  }
-
-  // Case 3: Could not move within this bidi part in this visual line, so leave
-  // the current bidi part
-
-  var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {
-    var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder
-      ? new Pos(start.line, mv(ch, 1), "before")
-      : new Pos(start.line, ch, "after"); }
-
-    for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {
-      var part = bidi[partPos]
-      var moveInStorageOrder = (dir > 0) == (part.level != 1)
-      var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1)
-      if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }
-      ch = moveInStorageOrder ? part.from : mv(part.to, -1)
-      if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }
-    }
-  }
-
-  // Case 3a: Look for other bidi parts on the same visual line
-  var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent)
-  if (res) { return res }
-
-  // Case 3b: Look for other bidi parts on the next visual line
-  var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1)
-  if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {
-    res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh))
-    if (res) { return res }
-  }
-
-  // Case 4: Nowhere to move
-  return null
-}
-
-// EVENT HANDLING
-
-// Lightweight event framework. on/off also work on DOM nodes,
-// registering native DOM handlers.
-
-var noHandlers = []
-
-var on = function(emitter, type, f) {
-  if (emitter.addEventListener) {
-    emitter.addEventListener(type, f, false)
-  } else if (emitter.attachEvent) {
-    emitter.attachEvent("on" + type, f)
-  } else {
-    var map = emitter._handlers || (emitter._handlers = {})
-    map[type] = (map[type] || noHandlers).concat(f)
-  }
-}
-
-function getHandlers(emitter, type) {
-  return emitter._handlers && emitter._handlers[type] || noHandlers
-}
-
-function off(emitter, type, f) {
-  if (emitter.removeEventListener) {
-    emitter.removeEventListener(type, f, false)
-  } else if (emitter.detachEvent) {
-    emitter.detachEvent("on" + type, f)
-  } else {
-    var map = emitter._handlers, arr = map && map[type]
-    if (arr) {
-      var index = indexOf(arr, f)
-      if (index > -1)
-        { map[type] = arr.slice(0, index).concat(arr.slice(index + 1)) }
-    }
-  }
-}
-
-function signal(emitter, type /*, values...*/) {
-  var handlers = getHandlers(emitter, type)
-  if (!handlers.length) { return }
-  var args = Array.prototype.slice.call(arguments, 2)
-  for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args) }
-}
-
-// The DOM events that CodeMirror handles can be overridden by
-// registering a (non-DOM) handler on the editor for the event name,
-// and preventDefault-ing the event in that handler.
-function signalDOMEvent(cm, e, override) {
-  if (typeof e == "string")
-    { e = {type: e, preventDefault: function() { this.defaultPrevented = true }} }
-  signal(cm, override || e.type, cm, e)
-  return e_defaultPrevented(e) || e.codemirrorIgnore
-}
-
-function signalCursorActivity(cm) {
-  var arr = cm._handlers && cm._handlers.cursorActivity
-  if (!arr) { return }
-  var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = [])
-  for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)
-    { set.push(arr[i]) } }
-}
-
-function hasHandler(emitter, type) {
-  return getHandlers(emitter, type).length > 0
-}
-
-// Add on and off methods to a constructor's prototype, to make
-// registering events on such objects more convenient.
-function eventMixin(ctor) {
-  ctor.prototype.on = function(type, f) {on(this, type, f)}
-  ctor.prototype.off = function(type, f) {off(this, type, f)}
-}
-
-// Due to the fact that we still support jurassic IE versions, some
-// compatibility wrappers are needed.
-
-function e_preventDefault(e) {
-  if (e.preventDefault) { e.preventDefault() }
-  else { e.returnValue = false }
-}
-function e_stopPropagation(e) {
-  if (e.stopPropagation) { e.stopPropagation() }
-  else { e.cancelBubble = true }
-}
-function e_defaultPrevented(e) {
-  return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
-}
-function e_stop(e) {e_preventDefault(e); e_stopPropagation(e)}
-
-function e_target(e) {return e.target || e.srcElement}
-function e_button(e) {
-  var b = e.which
-  if (b == null) {
-    if (e.button & 1) { b = 1 }
-    else if (e.button & 2) { b = 3 }
-    else if (e.button & 4) { b = 2 }
-  }
-  if (mac && e.ctrlKey && b == 1) { b = 3 }
-  return b
-}
-
-// Detect drag-and-drop
-var dragAndDrop = function() {
-  // There is *some* kind of drag-and-drop support in IE6-8, but I
-  // couldn't get it to work yet.
-  if (ie && ie_version < 9) { return false }
-  var div = elt('div')
-  return "draggable" in div || "dragDrop" in div
-}()
-
-var zwspSupported
-function zeroWidthElement(measure) {
-  if (zwspSupported == null) {
-    var test = elt("span", "\u200b")
-    removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]))
-    if (measure.firstChild.offsetHeight != 0)
-      { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8) }
-  }
-  var node = zwspSupported ? elt("span", "\u200b") :
-    elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px")
-  node.setAttribute("cm-text", "")
-  return node
-}
-
-// Feature-detect IE's crummy client rect reporting for bidi text
-var badBidiRects
-function hasBadBidiRects(measure) {
-  if (badBidiRects != null) { return badBidiRects }
-  var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"))
-  var r0 = range(txt, 0, 1).getBoundingClientRect()
-  var r1 = range(txt, 1, 2).getBoundingClientRect()
-  removeChildren(measure)
-  if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)
-  return badBidiRects = (r1.right - r0.right < 3)
-}
-
-// See if "".split is the broken IE version, if so, provide an
-// alternative way to split lines.
-var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) {
-  var pos = 0, result = [], l = string.length
-  while (pos <= l) {
-    var nl = string.indexOf("\n", pos)
-    if (nl == -1) { nl = string.length }
-    var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl)
-    var rt = line.indexOf("\r")
-    if (rt != -1) {
-      result.push(line.slice(0, rt))
-      pos += rt + 1
-    } else {
-      result.push(line)
-      pos = nl + 1
-    }
-  }
-  return result
-} : function (string) { return string.split(/\r\n?|\n/); }
-
-var hasSelection = window.getSelection ? function (te) {
-  try { return te.selectionStart != te.selectionEnd }
-  catch(e) { return false }
-} : function (te) {
-  var range
-  try {range = te.ownerDocument.selection.createRange()}
-  catch(e) {}
-  if (!range || range.parentElement() != te) { return false }
-  return range.compareEndPoints("StartToEnd", range) != 0
-}
-
-var hasCopyEvent = (function () {
-  var e = elt("div")
-  if ("oncopy" in e) { return true }
-  e.setAttribute("oncopy", "return;")
-  return typeof e.oncopy == "function"
-})()
-
-var badZoomedRects = null
-function hasBadZoomedRects(measure) {
-  if (badZoomedRects != null) { return badZoomedRects }
-  var node = removeChildrenAndAdd(measure, elt("span", "x"))
-  var normal = node.getBoundingClientRect()
-  var fromRange = range(node, 0, 1).getBoundingClientRect()
-  return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
-}
-
-var modes = {};
-var mimeModes = {};
-// Extra arguments are stored as the mode's dependencies, which is
-// used by (legacy) mechanisms like loadmode.js to automatically
-// load a mode. (Preferred mechanism is the require/define calls.)
-function defineMode(name, mode) {
-  if (arguments.length > 2)
-    { mode.dependencies = Array.prototype.slice.call(arguments, 2) }
-  modes[name] = mode
-}
-
-function defineMIME(mime, spec) {
-  mimeModes[mime] = spec
-}
-
-// Given a MIME type, a {name, ...options} config object, or a name
-// string, return a mode config object.
-function resolveMode(spec) {
-  if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
-    spec = mimeModes[spec]
-  } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
-    var found = mimeModes[spec.name]
-    if (typeof found == "string") { found = {name: found} }
-    spec = createObj(found, spec)
-    spec.name = found.name
-  } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
-    return resolveMode("application/xml")
-  } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
-    return resolveMode("application/json")
-  }
-  if (typeof spec == "string") { return {name: spec} }
-  else { return spec || {name: "null"} }
-}
-
-// Given a mode spec (anything that resolveMode accepts), find and
-// initialize an actual mode object.
-function getMode(options, spec) {
-  spec = resolveMode(spec)
-  var mfactory = modes[spec.name]
-  if (!mfactory) { return getMode(options, "text/plain") }
-  var modeObj = mfactory(options, spec)
-  if (modeExtensions.hasOwnProperty(spec.name)) {
-    var exts = modeExtensions[spec.name]
-    for (var prop in exts) {
-      if (!exts.hasOwnProperty(prop)) { continue }
-      if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop] }
-      modeObj[prop] = exts[prop]
-    }
-  }
-  modeObj.name = spec.name
-  if (spec.helperType) { modeObj.helperType = spec.helperType }
-  if (spec.modeProps) { for (var prop$1 in spec.modeProps)
-    { modeObj[prop$1] = spec.modeProps[prop$1] } }
-
-  return modeObj
-}
-
-// This can be used to attach properties to mode objects from
-// outside the actual mode definition.
-var modeExtensions = {}
-function extendMode(mode, properties) {
-  var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {})
-  copyObj(properties, exts)
-}
-
-function copyState(mode, state) {
-  if (state === true) { return state }
-  if (mode.copyState) { return mode.copyState(state) }
-  var nstate = {}
-  for (var n in state) {
-    var val = state[n]
-    if (val instanceof Array) { val = val.concat([]) }
-    nstate[n] = val
-  }
-  return nstate
-}
-
-// Given a mode and a state (for that mode), find the inner mode and
-// state at the position that the state refers to.
-function innerMode(mode, state) {
-  var info
-  while (mode.innerMode) {
-    info = mode.innerMode(state)
-    if (!info || info.mode == mode) { break }
-    state = info.state
-    mode = info.mode
-  }
-  return info || {mode: mode, state: state}
-}
-
-function startState(mode, a1, a2) {
-  return mode.startState ? mode.startState(a1, a2) : true
-}
-
-// STRING STREAM
-
-// Fed to the mode parsers, provides helper functions to make
-// parsers more succinct.
-
-var StringStream = function(string, tabSize) {
-  this.pos = this.start = 0
-  this.string = string
-  this.tabSize = tabSize || 8
-  this.lastColumnPos = this.lastColumnValue = 0
-  this.lineStart = 0
-};
-
-StringStream.prototype.eol = function () {return this.pos >= this.string.length};
-StringStream.prototype.sol = function () {return this.pos == this.lineStart};
-StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
-StringStream.prototype.next = function () {
-  if (this.pos < this.string.length)
-    { return this.string.charAt(this.pos++) }
-};
-StringStream.prototype.eat = function (match) {
-  var ch = this.string.charAt(this.pos)
-  var ok
-  if (typeof match == "string") { ok = ch == match }
-  else { ok = ch && (match.test ? match.test(ch) : match(ch)) }
-  if (ok) {++this.pos; return ch}
-};
-StringStream.prototype.eatWhile = function (match) {
-  var start = this.pos
-  while (this.eat(match)){}
-  return this.pos > start
-};
-StringStream.prototype.eatSpace = function () {
-    var this$1 = this;
-
-  var start = this.pos
-  while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this$1.pos }
-  return this.pos > start
-};
-StringStream.prototype.skipToEnd = function () {this.pos = this.string.length};
-StringStream.prototype.skipTo = function (ch) {
-  var found = this.string.indexOf(ch, this.pos)
-  if (found > -1) {this.pos = found; return true}
-};
-StringStream.prototype.backUp = function (n) {this.pos -= n};
-StringStream.prototype.column = function () {
-  if (this.lastColumnPos < this.start) {
-    this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue)
-    this.lastColumnPos = this.start
-  }
-  return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
-};
-StringStream.prototype.indentation = function () {
-  return countColumn(this.string, null, this.tabSize) -
-    (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
-};
-StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
-  if (typeof pattern == "string") {
-    var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; }
-    var substr = this.string.substr(this.pos, pattern.length)
-    if (cased(substr) == cased(pattern)) {
-      if (consume !== false) { this.pos += pattern.length }
-      return true
-    }
-  } else {
-    var match = this.string.slice(this.pos).match(pattern)
-    if (match && match.index > 0) { return null }
-    if (match && consume !== false) { this.pos += match[0].length }
-    return match
-  }
-};
-StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
-StringStream.prototype.hideFirstChars = function (n, inner) {
-  this.lineStart += n
-  try { return inner() }
-  finally { this.lineStart -= n }
-};
-
-// Compute a style array (an array starting with a mode generation
-// -- for invalidation -- followed by pairs of end positions and
-// style strings), which is used to highlight the tokens on the
-// line.
-function highlightLine(cm, line, state, forceToEnd) {
-  // A styles array always starts with a number identifying the
-  // mode/overlays that it is based on (for easy invalidation).
-  var st = [cm.state.modeGen], lineClasses = {}
-  // Compute the base array of styles
-  runMode(cm, line.text, cm.doc.mode, state, function (end, style) { return st.push(end, style); },
-    lineClasses, forceToEnd)
-
-  // Run overlays, adjust style array.
-  var loop = function ( o ) {
-    var overlay = cm.state.overlays[o], i = 1, at = 0
-    runMode(cm, line.text, overlay.mode, true, function (end, style) {
-      var start = i
-      // Ensure there's a token end at the current position, and that i points at it
-      while (at < end) {
-        var i_end = st[i]
-        if (i_end > end)
-          { st.splice(i, 1, end, st[i+1], i_end) }
-        i += 2
-        at = Math.min(end, i_end)
-      }
-      if (!style) { return }
-      if (overlay.opaque) {
-        st.splice(start, i - start, end, "overlay " + style)
-        i = start + 2
-      } else {
-        for (; start < i; start += 2) {
-          var cur = st[start+1]
-          st[start+1] = (cur ? cur + " " : "") + "overlay " + style
-        }
-      }
-    }, lineClasses)
-  };
-
-  for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );
-
-  return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}
-}
-
-function getLineStyles(cm, line, updateFrontier) {
-  if (!line.styles || line.styles[0] != cm.state.modeGen) {
-    var state = getStateBefore(cm, lineNo(line))
-    var result = highlightLine(cm, line, line.text.length > cm.options.maxHighlightLength ? copyState(cm.doc.mode, state) : state)
-    line.stateAfter = state
-    line.styles = result.styles
-    if (result.classes) { line.styleClasses = result.classes }
-    else if (line.styleClasses) { line.styleClasses = null }
-    if (updateFrontier === cm.doc.frontier) { cm.doc.frontier++ }
-  }
-  return line.styles
-}
-
-function getStateBefore(cm, n, precise) {
-  var doc = cm.doc, display = cm.display
-  if (!doc.mode.startState) { return true }
-  var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter
-  if (!state) { state = startState(doc.mode) }
-  else { state = copyState(doc.mode, state) }
-  doc.iter(pos, n, function (line) {
-    processLine(cm, line.text, state)
-    var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo
-    line.stateAfter = save ? copyState(doc.mode, state) : null
-    ++pos
-  })
-  if (precise) { doc.frontier = pos }
-  return state
-}
-
-// Lightweight form of highlight -- proceed over this line and
-// update state, but don't save a style array. Used for lines that
-// aren't currently visible.
-function processLine(cm, text, state, startAt) {
-  var mode = cm.doc.mode
-  var stream = new StringStream(text, cm.options.tabSize)
-  stream.start = stream.pos = startAt || 0
-  if (text == "") { callBlankLine(mode, state) }
-  while (!stream.eol()) {
-    readToken(mode, stream, state)
-    stream.start = stream.pos
-  }
-}
-
-function callBlankLine(mode, state) {
-  if (mode.blankLine) { return mode.blankLine(state) }
-  if (!mode.innerMode) { return }
-  var inner = innerMode(mode, state)
-  if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }
-}
-
-function readToken(mode, stream, state, inner) {
-  for (var i = 0; i < 10; i++) {
-    if (inner) { inner[0] = innerMode(mode, state).mode }
-    var style = mode.token(stream, state)
-    if (stream.pos > stream.start) { return style }
-  }
-  throw new Error("Mode " + mode.name + " failed to advance stream.")
-}
-
-// Utility for getTokenAt and getLineTokens
-function takeToken(cm, pos, precise, asArray) {
-  var getObj = function (copy) { return ({
-    start: stream.start, end: stream.pos,
-    string: stream.current(),
-    type: style || null,
-    state: copy ? copyState(doc.mode, state) : state
-  }); }
-
-  var doc = cm.doc, mode = doc.mode, style
-  pos = clipPos(doc, pos)
-  var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise)
-  var stream = new StringStream(line.text, cm.options.tabSize), tokens
-  if (asArray) { tokens = [] }
-  while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
-    stream.start = stream.pos
-    style = readToken(mode, stream, state)
-    if (asArray) { tokens.push(getObj(true)) }
-  }
-  return asArray ? tokens : getObj()
-}
-
-function extractLineClasses(type, output) {
-  if (type) { for (;;) {
-    var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/)
-    if (!lineClass) { break }
-    type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length)
-    var prop = lineClass[1] ? "bgClass" : "textClass"
-    if (output[prop] == null)
-      { output[prop] = lineClass[2] }
-    else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop]))
-      { output[prop] += " " + lineClass[2] }
-  } }
-  return type
-}
-
-// Run the given mode's parser over a line, calling f for each token.
-function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) {
-  var flattenSpans = mode.flattenSpans
-  if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans }
-  var curStart = 0, curStyle = null
-  var stream = new StringStream(text, cm.options.tabSize), style
-  var inner = cm.options.addModeClass && [null]
-  if (text == "") { extractLineClasses(callBlankLine(mode, state), lineClasses) }
-  while (!stream.eol()) {
-    if (stream.pos > cm.options.maxHighlightLength) {
-      flattenSpans = false
-      if (forceToEnd) { processLine(cm, text, state, stream.pos) }
-      stream.pos = text.length
-      style = null
-    } else {
-      style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses)
-    }
-    if (inner) {
-      var mName = inner[0].name
-      if (mName) { style = "m-" + (style ? mName + " " + style : mName) }
-    }
-    if (!flattenSpans || curStyle != style) {
-      while (curStart < stream.start) {
-        curStart = Math.min(stream.start, curStart + 5000)
-        f(curStart, curStyle)
-      }
-      curStyle = style
-    }
-    stream.start = stream.pos
-  }
-  while (curStart < stream.pos) {
-    // Webkit seems to refuse to render text nodes longer than 57444
-    // characters, and returns inaccurate measurements in nodes
-    // starting around 5000 chars.
-    var pos = Math.min(stream.pos, curStart + 5000)
-    f(pos, curStyle)
-    curStart = pos
-  }
-}
-
-// Finds the line to start with when starting a parse. Tries to
-// find a line with a stateAfter, so that it can start with a
-// valid state. If that fails, it returns the line with the
-// smallest indentation, which tends to need the least context to
-// parse correctly.
-function findStartLine(cm, n, precise) {
-  var minindent, minline, doc = cm.doc
-  var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100)
-  for (var search = n; search > lim; --search) {
-    if (search <= doc.first) { return doc.first }
-    var line = getLine(doc, search - 1)
-    if (line.stateAfter && (!precise || search <= doc.frontier)) { return search }
-    var indented = countColumn(line.text, null, cm.options.tabSize)
-    if (minline == null || minindent > indented) {
-      minline = search - 1
-      minindent = indented
-    }
-  }
-  return minline
-}
-
-// LINE DATA STRUCTURE
-
-// Line objects. These hold state related to a line, including
-// highlighting info (the styles array).
-var Line = function(text, markedSpans, estimateHeight) {
-  this.text = text
-  attachMarkedSpans(this, markedSpans)
-  this.height = estimateHeight ? estimateHeight(this) : 1
-};
-
-Line.prototype.lineNo = function () { return lineNo(this) };
-eventMixin(Line)
-
-// Change the content (text, markers) of a line. Automatically
-// invalidates cached information and tries to re-estimate the
-// line's height.
-function updateLine(line, text, markedSpans, estimateHeight) {
-  line.text = text
-  if (line.stateAfter) { line.stateAfter = null }
-  if (line.styles) { line.styles = null }
-  if (line.order != null) { line.order = null }
-  detachMarkedSpans(line)
-  attachMarkedSpans(line, markedSpans)
-  var estHeight = estimateHeight ? estimateHeight(line) : 1
-  if (estHeight != line.height) { updateLineHeight(line, estHeight) }
-}
-
-// Detach a line from the document tree and its markers.
-function cleanUpLine(line) {
-  line.parent = null
-  detachMarkedSpans(line)
-}
-
-// Convert a style as returned by a mode (either null, or a string
-// containing one or more styles) to a CSS style. This is cached,
-// and also looks for line-wide styles.
-var styleToClassCache = {};
-var styleToClassCacheWithMode = {};
-function interpretTokenStyle(style, options) {
-  if (!style || /^\s*$/.test(style)) { return null }
-  var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache
-  return cache[style] ||
-    (cache[style] = style.replace(/\S+/g, "cm-$&"))
-}
-
-// Render the DOM representation of the text of a line. Also builds
-// up a 'line map', which points at the DOM nodes that represent
-// specific stretches of text, and is used by the measuring code.
-// The returned object contains the DOM node, this map, and
-// information about line-wide styles that were set by the mode.
-function buildLineContent(cm, lineView) {
-  // The padding-right forces the element to have a 'border', which
-  // is needed on Webkit to be able to get line-level bounding
-  // rectangles for it (in measureChar).
-  var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null)
-  var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
-                 col: 0, pos: 0, cm: cm,
-                 trailingSpace: false,
-                 splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")}
-  lineView.measure = {}
-
-  // Iterate over the logical lines that make up this visual line.
-  for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
-    var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0)
-    builder.pos = 0
-    builder.addToken = buildToken
-    // Optionally wire in some hacks into the token-rendering
-    // algorithm, to deal with browser quirks.
-    if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
-      { builder.addToken = buildTokenBadBidi(builder.addToken, order) }
-    builder.map = []
-    var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line)
-    insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate))
-    if (line.styleClasses) {
-      if (line.styleClasses.bgClass)
-        { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || "") }
-      if (line.styleClasses.textClass)
-        { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || "") }
-    }
-
-    // Ensure at least a single node is present, for measuring.
-    if (builder.map.length == 0)
-      { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))) }
-
-    // Store the map and a cache object for the current logical line
-    if (i == 0) {
-      lineView.measure.map = builder.map
-      lineView.measure.cache = {}
-    } else {
-      ;(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
-      ;(lineView.measure.caches || (lineView.measure.caches = [])).push({})
-    }
-  }
-
-  // See issue #2901
-  if (webkit) {
-    var last = builder.content.lastChild
-    if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
-      { builder.content.className = "cm-tab-wrap-hack" }
-  }
-
-  signal(cm, "renderLine", cm, lineView.line, builder.pre)
-  if (builder.pre.className)
-    { builder.textClass = joinClasses(builder.pre.className, builder.textClass || "") }
-
-  return builder
-}
-
-function defaultSpecialCharPlaceholder(ch) {
-  var token = elt("span", "\u2022", "cm-invalidchar")
-  token.title = "\\u" + ch.charCodeAt(0).toString(16)
-  token.setAttribute("aria-label", token.title)
-  return token
-}
-
-// Build up the DOM representation for a single token, and add it to
-// the line map. Takes care to render special characters separately.
-function buildToken(builder, text, style, startStyle, endStyle, title, css) {
-  if (!text) { return }
-  var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text
-  var special = builder.cm.state.specialChars, mustWrap = false
-  var content
-  if (!special.test(text)) {
-    builder.col += text.length
-    content = document.createTextNode(displayText)
-    builder.map.push(builder.pos, builder.pos + text.length, content)
-    if (ie && ie_version < 9) { mustWrap = true }
-    builder.pos += text.length
-  } else {
-    content = document.createDocumentFragment()
-    var pos = 0
-    while (true) {
-      special.lastIndex = pos
-      var m = special.exec(text)
-      var skipped = m ? m.index - pos : text.length - pos
-      if (skipped) {
-        var txt = document.createTextNode(displayText.slice(pos, pos + skipped))
-        if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])) }
-        else { content.appendChild(txt) }
-        builder.map.push(builder.pos, builder.pos + skipped, txt)
-        builder.col += skipped
-        builder.pos += skipped
-      }
-      if (!m) { break }
-      pos += skipped + 1
-      var txt$1 = (void 0)
-      if (m[0] == "\t") {
-        var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize
-        txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"))
-        txt$1.setAttribute("role", "presentation")
-        txt$1.setAttribute("cm-text", "\t")
-        builder.col += tabWidth
-      } else if (m[0] == "\r" || m[0] == "\n") {
-        txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"))
-        txt$1.setAttribute("cm-text", m[0])
-        builder.col += 1
-      } else {
-        txt$1 = builder.cm.options.specialCharPlaceholder(m[0])
-        txt$1.setAttribute("cm-text", m[0])
-        if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])) }
-        else { content.appendChild(txt$1) }
-        builder.col += 1
-      }
-      builder.map.push(builder.pos, builder.pos + 1, txt$1)
-      builder.pos++
-    }
-  }
-  builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32
-  if (style || startStyle || endStyle || mustWrap || css) {
-    var fullStyle = style || ""
-    if (startStyle) { fullStyle += startStyle }
-    if (endStyle) { fullStyle += endStyle }
-    var token = elt("span", [content], fullStyle, css)
-    if (title) { token.title = title }
-    return builder.content.appendChild(token)
-  }
-  builder.content.appendChild(content)
-}
-
-function splitSpaces(text, trailingBefore) {
-  if (text.length > 1 && !/  /.test(text)) { return text }
-  var spaceBefore = trailingBefore, result = ""
-  for (var i = 0; i < text.length; i++) {
-    var ch = text.charAt(i)
-    if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
-      { ch = "\u00a0" }
-    result += ch
-    spaceBefore = ch == " "
-  }
-  return result
-}
-
-// Work around nonsense dimensions being reported for stretches of
-// right-to-left text.
-function buildTokenBadBidi(inner, order) {
-  return function (builder, text, style, startStyle, endStyle, title, css) {
-    style = style ? style + " cm-force-border" : "cm-force-border"
-    var start = builder.pos, end = start + text.length
-    for (;;) {
-      // Find the part that overlaps with the start of this text
-      var part = (void 0)
-      for (var i = 0; i < order.length; i++) {
-        part = order[i]
-        if (part.to > start && part.from <= start) { break }
-      }
-      if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, title, css) }
-      inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css)
-      startStyle = null
-      text = text.slice(part.to - start)
-      start = part.to
-    }
-  }
-}
-
-function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
-  var widget = !ignoreWidget && marker.widgetNode
-  if (widget) { builder.map.push(builder.pos, builder.pos + size, widget) }
-  if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
-    if (!widget)
-      { widget = builder.content.appendChild(document.createElement("span")) }
-    widget.setAttribute("cm-marker", marker.id)
-  }
-  if (widget) {
-    builder.cm.display.input.setUneditable(widget)
-    builder.content.appendChild(widget)
-  }
-  builder.pos += size
-  builder.trailingSpace = false
-}
-
-// Outputs a number of spans to make up a line, taking highlighting
-// and marked text into account.
-function insertLineContent(line, builder, styles) {
-  var spans = line.markedSpans, allText = line.text, at = 0
-  if (!spans) {
-    for (var i$1 = 1; i$1 < styles.length; i$1+=2)
-      { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)) }
-    return
-  }
-
-  var len = allText.length, pos = 0, i = 1, text = "", style, css
-  var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed
-  for (;;) {
-    if (nextChange == pos) { // Update current marker set
-      spanStyle = spanEndStyle = spanStartStyle = title = css = ""
-      collapsed = null; nextChange = Infinity
-      var foundBookmarks = [], endStyles = (void 0)
-      for (var j = 0; j < spans.length; ++j) {
-        var sp = spans[j], m = sp.marker
-        if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
-          foundBookmarks.push(m)
-        } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
-          if (sp.to != null && sp.to != pos && nextChange > sp.to) {
-            nextChange = sp.to
-            spanEndStyle = ""
-          }
-          if (m.className) { spanStyle += " " + m.className }
-          if (m.css) { css = (css ? css + ";" : "") + m.css }
-          if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle }
-          if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to) }
-          if (m.title && !title) { title = m.title }
-          if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
-            { collapsed = sp }
-        } else if (sp.from > pos && nextChange > sp.from) {
-          nextChange = sp.from
-        }
-      }
-      if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)
-        { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1] } } }
-
-      if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)
-        { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]) } }
-      if (collapsed && (collapsed.from || 0) == pos) {
-        buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
-                           collapsed.marker, collapsed.from == null)
-        if (collapsed.to == null) { return }
-        if (collapsed.to == pos) { collapsed = false }
-      }
-    }
-    if (pos >= len) { break }
-
-    var upto = Math.min(len, nextChange)
-    while (true) {
-      if (text) {
-        var end = pos + text.length
-        if (!collapsed) {
-          var tokenText = end > upto ? text.slice(0, upto - pos) : text
-          builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
-                           spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css)
-        }
-        if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
-        pos = end
-        spanStartStyle = ""
-      }
-      text = allText.slice(at, at = styles[i++])
-      style = interpretTokenStyle(styles[i++], builder.cm.options)
-    }
-  }
-}
-
-
-// These objects are used to represent the visible (currently drawn)
-// part of the document. A LineView may correspond to multiple
-// logical lines, if those are connected by collapsed ranges.
-function LineView(doc, line, lineN) {
-  // The starting line
-  this.line = line
-  // Continuing lines, if any
-  this.rest = visualLineContinued(line)
-  // Number of logical lines in this visual line
-  this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1
-  this.node = this.text = null
-  this.hidden = lineIsHidden(doc, line)
-}
-
-// Create a range of LineView objects for the given lines.
-function buildViewArray(cm, from, to) {
-  var array = [], nextPos
-  for (var pos = from; pos < to; pos = nextPos) {
-    var view = new LineView(cm.doc, getLine(cm.doc, pos), pos)
-    nextPos = pos + view.size
-    array.push(view)
-  }
-  return array
-}
-
-var operationGroup = null
-
-function pushOperation(op) {
-  if (operationGroup) {
-    operationGroup.ops.push(op)
-  } else {
-    op.ownsGroup = operationGroup = {
-      ops: [op],
-      delayedCallbacks: []
-    }
-  }
-}
-
-function fireCallbacksForOps(group) {
-  // Calls delayed callbacks and cursorActivity handlers until no
-  // new ones appear
-  var callbacks = group.delayedCallbacks, i = 0
-  do {
-    for (; i < callbacks.length; i++)
-      { callbacks[i].call(null) }
-    for (var j = 0; j < group.ops.length; j++) {
-      var op = group.ops[j]
-      if (op.cursorActivityHandlers)
-        { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
-          { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm) } }
-    }
-  } while (i < callbacks.length)
-}
-
-function finishOperation(op, endCb) {
-  var group = op.ownsGroup
-  if (!group) { return }
-
-  try { fireCallbacksForOps(group) }
-  finally {
-    operationGroup = null
-    endCb(group)
-  }
-}
-
-var orphanDelayedCallbacks = null
-
-// Often, we want to signal events at a point where we are in the
-// middle of some work, but don't want the handler to start calling
-// other methods on the editor, which might be in an inconsistent
-// state or simply not expect any other events to happen.
-// signalLater looks whether there are any handlers, and schedules
-// them to be executed when the last operation ends, or, if no
-// operation is active, when a timeout fires.
-function signalLater(emitter, type /*, values...*/) {
-  var arr = getHandlers(emitter, type)
-  if (!arr.length) { return }
-  var args = Array.prototype.slice.call(arguments, 2), list
-  if (operationGroup) {
-    list = operationGroup.delayedCallbacks
-  } else if (orphanDelayedCallbacks) {
-    list = orphanDelayedCallbacks
-  } else {
-    list = orphanDelayedCallbacks = []
-    setTimeout(fireOrphanDelayed, 0)
-  }
-  var loop = function ( i ) {
-    list.push(function () { return arr[i].apply(null, args); })
-  };
-
-  for (var i = 0; i < arr.length; ++i)
-    loop( i );
-}
-
-function fireOrphanDelayed() {
-  var delayed = orphanDelayedCallbacks
-  orphanDelayedCallbacks = null
-  for (var i = 0; i < delayed.length; ++i) { delayed[i]() }
-}
-
-// When an aspect of a line changes, a string is added to
-// lineView.changes. This updates the relevant part of the line's
-// DOM structure.
-function updateLineForChanges(cm, lineView, lineN, dims) {
-  for (var j = 0; j < lineView.changes.length; j++) {
-    var type = lineView.changes[j]
-    if (type == "text") { updateLineText(cm, lineView) }
-    else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims) }
-    else if (type == "class") { updateLineClasses(cm, lineView) }
-    else if (type == "widget") { updateLineWidgets(cm, lineView, dims) }
-  }
-  lineView.changes = null
-}
-
-// Lines with gutter elements, widgets or a background class need to
-// be wrapped, and have the extra elements added to the wrapper div
-function ensureLineWrapped(lineView) {
-  if (lineView.node == lineView.text) {
-    lineView.node = elt("div", null, null, "position: relative")
-    if (lineView.text.parentNode)
-      { lineView.text.parentNode.replaceChild(lineView.node, lineView.text) }
-    lineView.node.appendChild(lineView.text)
-    if (ie && ie_version < 8) { lineView.node.style.zIndex = 2 }
-  }
-  return lineView.node
-}
-
-function updateLineBackground(cm, lineView) {
-  var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass
-  if (cls) { cls += " CodeMirror-linebackground" }
-  if (lineView.background) {
-    if (cls) { lineView.background.className = cls }
-    else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null }
-  } else if (cls) {
-    var wrap = ensureLineWrapped(lineView)
-    lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild)
-    cm.display.input.setUneditable(lineView.background)
-  }
-}
-
-// Wrapper around buildLineContent which will reuse the structure
-// in display.externalMeasured when possible.
-function getLineContent(cm, lineView) {
-  var ext = cm.display.externalMeasured
-  if (ext && ext.line == lineView.line) {
-    cm.display.externalMeasured = null
-    lineView.measure = ext.measure
-    return ext.built
-  }
-  return buildLineContent(cm, lineView)
-}
-
-// Redraw the line's text. Interacts with the background and text
-// classes because the mode may output tokens that influence these
-// classes.
-function updateLineText(cm, lineView) {
-  var cls = lineView.text.className
-  var built = getLineContent(cm, lineView)
-  if (lineView.text == lineView.node) { lineView.node = built.pre }
-  lineView.text.parentNode.replaceChild(built.pre, lineView.text)
-  lineView.text = built.pre
-  if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
-    lineView.bgClass = built.bgClass
-    lineView.textClass = built.textClass
-    updateLineClasses(cm, lineView)
-  } else if (cls) {
-    lineView.text.className = cls
-  }
-}
-
-function updateLineClasses(cm, lineView) {
-  updateLineBackground(cm, lineView)
-  if (lineView.line.wrapClass)
-    { ensureLineWrapped(lineView).className = lineView.line.wrapClass }
-  else if (lineView.node != lineView.text)
-    { lineView.node.className = "" }
-  var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass
-  lineView.text.className = textClass || ""
-}
-
-function updateLineGutter(cm, lineView, lineN, dims) {
-  if (lineView.gutter) {
-    lineView.node.removeChild(lineView.gutter)
-    lineView.gutter = null
-  }
-  if (lineView.gutterBackground) {
-    lineView.node.removeChild(lineView.gutterBackground)
-    lineView.gutterBackground = null
-  }
-  if (lineView.line.gutterClass) {
-    var wrap = ensureLineWrapped(lineView)
-    lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
-                                    ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px"))
-    cm.display.input.setUneditable(lineView.gutterBackground)
-    wrap.insertBefore(lineView.gutterBackground, lineView.text)
-  }
-  var markers = lineView.line.gutterMarkers
-  if (cm.options.lineNumbers || markers) {
-    var wrap$1 = ensureLineWrapped(lineView)
-    var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"))
-    cm.display.input.setUneditable(gutterWrap)
-    wrap$1.insertBefore(gutterWrap, lineView.text)
-    if (lineView.line.gutterClass)
-      { gutterWrap.className += " " + lineView.line.gutterClass }
-    if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
-      { lineView.lineNumber = gutterWrap.appendChild(
-        elt("div", lineNumberFor(cm.options, lineN),
-            "CodeMirror-linenumber CodeMirror-gutter-elt",
-            ("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))) }
-    if (markers) { for (var k = 0; k < cm.options.gutters.length; ++k) {
-      var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id]
-      if (found)
-        { gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
-                                   ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))) }
-    } }
-  }
-}
-
-function updateLineWidgets(cm, lineView, dims) {
-  if (lineView.alignable) { lineView.alignable = null }
-  for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
-    next = node.nextSibling
-    if (node.className == "CodeMirror-linewidget")
-      { lineView.node.removeChild(node) }
-  }
-  insertLineWidgets(cm, lineView, dims)
-}
-
-// Build a line's DOM representation from scratch
-function buildLineElement(cm, lineView, lineN, dims) {
-  var built = getLineContent(cm, lineView)
-  lineView.text = lineView.node = built.pre
-  if (built.bgClass) { lineView.bgClass = built.bgClass }
-  if (built.textClass) { lineView.textClass = built.textClass }
-
-  updateLineClasses(cm, lineView)
-  updateLineGutter(cm, lineView, lineN, dims)
-  insertLineWidgets(cm, lineView, dims)
-  return lineView.node
-}
-
-// A lineView may contain multiple logical lines (when merged by
-// collapsed spans). The widgets for all of them need to be drawn.
-function insertLineWidgets(cm, lineView, dims) {
-  insertLineWidgetsFor(cm, lineView.line, lineView, dims, true)
-  if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
-    { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false) } }
-}
-
-function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
-  if (!line.widgets) { return }
-  var wrap = ensureLineWrapped(lineView)
-  for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
-    var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget")
-    if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true") }
-    positionLineWidget(widget, node, lineView, dims)
-    cm.display.input.setUneditable(node)
-    if (allowAbove && widget.above)
-      { wrap.insertBefore(node, lineView.gutter || lineView.text) }
-    else
-      { wrap.appendChild(node) }
-    signalLater(widget, "redraw")
-  }
-}
-
-function positionLineWidget(widget, node, lineView, dims) {
-  if (widget.noHScroll) {
-    ;(lineView.alignable || (lineView.alignable = [])).push(node)
-    var width = dims.wrapperWidth
-    node.style.left = dims.fixedPos + "px"
-    if (!widget.coverGutter) {
-      width -= dims.gutterTotalWidth
-      node.style.paddingLeft = dims.gutterTotalWidth + "px"
-    }
-    node.style.width = width + "px"
-  }
-  if (widget.coverGutter) {
-    node.style.zIndex = 5
-    node.style.position = "relative"
-    if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px" }
-  }
-}
-
-function widgetHeight(widget) {
-  if (widget.height != null) { return widget.height }
-  var cm = widget.doc.cm
-  if (!cm) { return 0 }
-  if (!contains(document.body, widget.node)) {
-    var parentStyle = "position: relative;"
-    if (widget.coverGutter)
-      { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;" }
-    if (widget.noHScroll)
-      { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;" }
-    removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle))
-  }
-  return widget.height = widget.node.parentNode.offsetHeight
-}
-
-// Return true when the given mouse event happened in a widget
-function eventInWidget(display, e) {
-  for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
-    if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
-        (n.parentNode == display.sizer && n != display.mover))
-      { return true }
-  }
-}
-
-// POSITION MEASUREMENT
-
-function paddingTop(display) {return display.lineSpace.offsetTop}
-function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
-function paddingH(display) {
-  if (display.cachedPaddingH) { return display.cachedPaddingH }
-  var e = removeChildrenAndAdd(display.measure, elt("pre", "x"))
-  var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle
-  var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)}
-  if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data }
-  return data
-}
-
-function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
-function displayWidth(cm) {
-  return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
-}
-function displayHeight(cm) {
-  return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
-}
-
-// Ensure the lineView.wrapping.heights array is populated. This is
-// an array of bottom offsets for the lines that make up a drawn
-// line. When lineWrapping is on, there might be more than one
-// height.
-function ensureLineHeights(cm, lineView, rect) {
-  var wrapping = cm.options.lineWrapping
-  var curWidth = wrapping && displayWidth(cm)
-  if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
-    var heights = lineView.measure.heights = []
-    if (wrapping) {
-      lineView.measure.width = curWidth
-      var rects = lineView.text.firstChild.getClientRects()
-      for (var i = 0; i < rects.length - 1; i++) {
-        var cur = rects[i], next = rects[i + 1]
-        if (Math.abs(cur.bottom - next.bottom) > 2)
-          { heights.push((cur.bottom + next.top) / 2 - rect.top) }
-      }
-    }
-    heights.push(rect.bottom - rect.top)
-  }
-}
-
-// Find a line map (mapping character offsets to text nodes) and a
-// measurement cache for the given line number. (A line view might
-// contain multiple lines when collapsed ranges are present.)
-function mapFromLineView(lineView, line, lineN) {
-  if (lineView.line == line)
-    { return {map: lineView.measure.map, cache: lineView.measure.cache} }
-  for (var i = 0; i < lineView.rest.length; i++)
-    { if (lineView.rest[i] == line)
-      { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
-  for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
-    { if (lineNo(lineView.rest[i$1]) > lineN)
-      { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
-}
-
-// Render a line into the hidden node display.externalMeasured. Used
-// when measurement is needed for a line that's not in the viewport.
-function updateExternalMeasurement(cm, line) {
-  line = visualLine(line)
-  var lineN = lineNo(line)
-  var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN)
-  view.lineN = lineN
-  var built = view.built = buildLineContent(cm, view)
-  view.text = built.pre
-  removeChildrenAndAdd(cm.display.lineMeasure, built.pre)
-  return view
-}
-
-// Get a {top, bottom, left, right} box (in line-local coordinates)
-// for a given character.
-function measureChar(cm, line, ch, bias) {
-  return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
-}
-
-// Find a line view that corresponds to the given line number.
-function findViewForLine(cm, lineN) {
-  if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
-    { return cm.display.view[findViewIndex(cm, lineN)] }
-  var ext = cm.display.externalMeasured
-  if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
-    { return ext }
-}
-
-// Measurement can be split in two steps, the set-up work that
-// applies to the whole line, and the measurement of the actual
-// character. Functions like coordsChar, that need to do a lot of
-// measurements in a row, can thus ensure that the set-up work is
-// only done once.
-function prepareMeasureForLine(cm, line) {
-  var lineN = lineNo(line)
-  var view = findViewForLine(cm, lineN)
-  if (view && !view.text) {
-    view = null
-  } else if (view && view.changes) {
-    updateLineForChanges(cm, view, lineN, getDimensions(cm))
-    cm.curOp.forceUpdate = true
-  }
-  if (!view)
-    { view = updateExternalMeasurement(cm, line) }
-
-  var info = mapFromLineView(view, line, lineN)
-  return {
-    line: line, view: view, rect: null,
-    map: info.map, cache: info.cache, before: info.before,
-    hasHeights: false
-  }
-}
-
-// Given a prepared measurement object, measures the position of an
-// actual character (or fetches it from the cache).
-function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
-  if (prepared.before) { ch = -1 }
-  var key = ch + (bias || ""), found
-  if (prepared.cache.hasOwnProperty(key)) {
-    found = prepared.cache[key]
-  } else {
-    if (!prepared.rect)
-      { prepared.rect = prepared.view.text.getBoundingClientRect() }
-    if (!prepared.hasHeights) {
-      ensureLineHeights(cm, prepared.view, prepared.rect)
-      prepared.hasHeights = true
-    }
-    found = measureCharInner(cm, prepared, ch, bias)
-    if (!found.bogus) { prepared.cache[key] = found }
-  }
-  return {left: found.left, right: found.right,
-          top: varHeight ? found.rtop : found.top,
-          bottom: varHeight ? found.rbottom : found.bottom}
-}
-
-var nullRect = {left: 0, right: 0, top: 0, bottom: 0}
-
-function nodeAndOffsetInLineMap(map, ch, bias) {
-  var node, start, end, collapse, mStart, mEnd
-  // First, search the line map for the text node corresponding to,
-  // or closest to, the target character.
-  for (var i = 0; i < map.length; i += 3) {
-    mStart = map[i]
-    mEnd = map[i + 1]
-    if (ch < mStart) {
-      start = 0; end = 1
-      collapse = "left"
-    } else if (ch < mEnd) {
-      start = ch - mStart
-      end = start + 1
-    } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {
-      end = mEnd - mStart
-      start = end - 1
-      if (ch >= mEnd) { collapse = "right" }
-    }
-    if (start != null) {
-      node = map[i + 2]
-      if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
-        { collapse = bias }
-      if (bias == "left" && start == 0)
-        { while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {
-          node = map[(i -= 3) + 2]
-          collapse = "left"
-        } }
-      if (bias == "right" && start == mEnd - mStart)
-        { while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {
-          node = map[(i += 3) + 2]
-          collapse = "right"
-        } }
-      break
-    }
-  }
-  return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
-}
-
-function getUsefulRect(rects, bias) {
-  var rect = nullRect
-  if (bias == "left") { for (var i = 0; i < rects.length; i++) {
-    if ((rect = rects[i]).left != rect.right) { break }
-  } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {
-    if ((rect = rects[i$1]).left != rect.right) { break }
-  } }
-  return rect
-}
-
-function measureCharInner(cm, prepared, ch, bias) {
-  var place = nodeAndOffsetInLineMap(prepared.map, ch, bias)
-  var node = place.node, start = place.start, end = place.end, collapse = place.collapse
-
-  var rect
-  if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
-    for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned
-      while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start }
-      while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end }
-      if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
-        { rect = node.parentNode.getBoundingClientRect() }
-      else
-        { rect = getUsefulRect(range(node, start, end).getClientRects(), bias) }
-      if (rect.left || rect.right || start == 0) { break }
-      end = start
-      start = start - 1
-      collapse = "right"
-    }
-    if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect) }
-  } else { // If it is a widget, simply get the box for the whole widget.
-    if (start > 0) { collapse = bias = "right" }
-    var rects
-    if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
-      { rect = rects[bias == "right" ? rects.length - 1 : 0] }
-    else
-      { rect = node.getBoundingClientRect() }
-  }
-  if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
-    var rSpan = node.parentNode.getClientRects()[0]
-    if (rSpan)
-      { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom} }
-    else
-      { rect = nullRect }
-  }
-
-  var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top
-  var mid = (rtop + rbot) / 2
-  var heights = prepared.view.measure.heights
-  var i = 0
-  for (; i < heights.length - 1; i++)
-    { if (mid < heights[i]) { break } }
-  var top = i ? heights[i - 1] : 0, bot = heights[i]
-  var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
-                right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
-                top: top, bottom: bot}
-  if (!rect.left && !rect.right) { result.bogus = true }
-  if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot }
-
-  return result
-}
-
-// Work around problem with bounding client rects on ranges being
-// returned incorrectly when zoomed on IE10 and below.
-function maybeUpdateRectForZooming(measure, rect) {
-  if (!window.screen || screen.logicalXDPI == null ||
-      screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
-    { return rect }
-  var scaleX = screen.logicalXDPI / screen.deviceXDPI
-  var scaleY = screen.logicalYDPI / screen.deviceYDPI
-  return {left: rect.left * scaleX, right: rect.right * scaleX,
-          top: rect.top * scaleY, bottom: rect.bottom * scaleY}
-}
-
-function clearLineMeasurementCacheFor(lineView) {
-  if (lineView.measure) {
-    lineView.measure.cache = {}
-    lineView.measure.heights = null
-    if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
-      { lineView.measure.caches[i] = {} } }
-  }
-}
-
-function clearLineMeasurementCache(cm) {
-  cm.display.externalMeasure = null
-  removeChildren(cm.display.lineMeasure)
-  for (var i = 0; i < cm.display.view.length; i++)
-    { clearLineMeasurementCacheFor(cm.display.view[i]) }
-}
-
-function clearCaches(cm) {
-  clearLineMeasurementCache(cm)
-  cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null
-  if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true }
-  cm.display.lineNumChars = null
-}
-
-function pageScrollX() {
-  // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206
-  // which causes page_Offset and bounding client rects to use
-  // different reference viewports and invalidate our calculations.
-  if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) }
-  return window.pageXOffset || (document.documentElement || document.body).scrollLeft
-}
-function pageScrollY() {
-  if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) }
-  return window.pageYOffset || (document.documentElement || document.body).scrollTop
-}
-
-// Converts a {top, bottom, left, right} box from line-local
-// coordinates into another coordinate system. Context may be one of
-// "line", "div" (display.lineDiv), "local"./null (editor), "window",
-// or "page".
-function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
-  if (!includeWidgets && lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above) {
-    var size = widgetHeight(lineObj.widgets[i])
-    rect.top += size; rect.bottom += size
-  } } }
-  if (context == "line") { return rect }
-  if (!context) { context = "local" }
-  var yOff = heightAtLine(lineObj)
-  if (context == "local") { yOff += paddingTop(cm.display) }
-  else { yOff -= cm.display.viewOffset }
-  if (context == "page" || context == "window") {
-    var lOff = cm.display.lineSpace.getBoundingClientRect()
-    yOff += lOff.top + (context == "window" ? 0 : pageScrollY())
-    var xOff = lOff.left + (context == "window" ? 0 : pageScrollX())
-    rect.left += xOff; rect.right += xOff
-  }
-  rect.top += yOff; rect.bottom += yOff
-  return rect
-}
-
-// Coverts a box from "div" coords to another coordinate system.
-// Context may be "window", "page", "div", or "local"./null.
-function fromCoordSystem(cm, coords, context) {
-  if (context == "div") { return coords }
-  var left = coords.left, top = coords.top
-  // First move into "page" coordinate system
-  if (context == "page") {
-    left -= pageScrollX()
-    top -= pageScrollY()
-  } else if (context == "local" || !context) {
-    var localBox = cm.display.sizer.getBoundingClientRect()
-    left += localBox.left
-    top += localBox.top
-  }
-
-  var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect()
-  return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
-}
-
-function charCoords(cm, pos, context, lineObj, bias) {
-  if (!lineObj) { lineObj = getLine(cm.doc, pos.line) }
-  return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
-}
-
-// Returns a box for a given cursor position, which may have an
-// 'other' property containing the position of the secondary cursor
-// on a bidi boundary.
-// A cursor Pos(line, char, "before") is on the same visual line as `char - 1`
-// and after `char - 1` in writing order of `char - 1`
-// A cursor Pos(line, char, "after") is on the same visual line as `char`
-// and before `char` in writing order of `char`
-// Examples (upper-case letters are RTL, lower-case are LTR):
-//     Pos(0, 1, ...)
-//     before   after
-// ab     a|b     a|b
-// aB     a|B     aB|
-// Ab     |Ab     A|b
-// AB     B|A     B|A
-// Every position after the last character on a line is considered to stick
-// to the last character on the line.
-function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
-  lineObj = lineObj || getLine(cm.doc, pos.line)
-  if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj) }
-  function get(ch, right) {
-    var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight)
-    if (right) { m.left = m.right; } else { m.right = m.left }
-    return intoCoordSystem(cm, lineObj, m, context)
-  }
-  var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky
-  if (ch >= lineObj.text.length) {
-    ch = lineObj.text.length
-    sticky = "before"
-  } else if (ch <= 0) {
-    ch = 0
-    sticky = "after"
-  }
-  if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") }
-
-  function getBidi(ch, partPos, invert) {
-    var part = order[partPos], right = (part.level % 2) != 0
-    return get(invert ? ch - 1 : ch, right != invert)
-  }
-  var partPos = getBidiPartAt(order, ch, sticky)
-  var other = bidiOther
-  var val = getBidi(ch, partPos, sticky == "before")
-  if (other != null) { val.other = getBidi(ch, other, sticky != "before") }
-  return val
-}
-
-// Used to cheaply estimate the coordinates for a position. Used for
-// intermediate scroll updates.
-function estimateCoords(cm, pos) {
-  var left = 0
-  pos = clipPos(cm.doc, pos)
-  if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch }
-  var lineObj = getLine(cm.doc, pos.line)
-  var top = heightAtLine(lineObj) + paddingTop(cm.display)
-  return {left: left, right: left, top: top, bottom: top + lineObj.height}
-}
-
-// Positions returned by coordsChar contain some extra information.
-// xRel is the relative x position of the input coordinates compared
-// to the found position (so xRel > 0 means the coordinates are to
-// the right of the character position, for example). When outside
-// is true, that means the coordinates lie outside the line's
-// vertical range.
-function PosWithInfo(line, ch, sticky, outside, xRel) {
-  var pos = Pos(line, ch, sticky)
-  pos.xRel = xRel
-  if (outside) { pos.outside = true }
-  return pos
-}
-
-// Compute the character position closest to the given coordinates.
-// Input must be lineSpace-local ("div" coordinate system).
-function coordsChar(cm, x, y) {
-  var doc = cm.doc
-  y += cm.display.viewOffset
-  if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }
-  var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1
-  if (lineN > last)
-    { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }
-  if (x < 0) { x = 0 }
-
-  var lineObj = getLine(doc, lineN)
-  for (;;) {
-    var found = coordsCharInner(cm, lineObj, lineN, x, y)
-    var merged = collapsedSpanAtEnd(lineObj)
-    var mergedPos = merged && merged.find(0, true)
-    if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))
-      { lineN = lineNo(lineObj = mergedPos.to.line) }
-    else
-      { return found }
-  }
-}
-
-function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
-  var measure = function (ch) { return intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line"); }
-  var end = lineObj.text.length
-  var begin = findFirst(function (ch) { return measure(ch - 1).bottom <= y; }, end, 0)
-  end = findFirst(function (ch) { return measure(ch).top > y; }, begin, end)
-  return {begin: begin, end: end}
-}
-
-function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
-  var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top
-  return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
-}
-
-function coordsCharInner(cm, lineObj, lineNo, x, y) {
-  y -= heightAtLine(lineObj)
-  var begin = 0, end = lineObj.text.length
-  var preparedMeasure = prepareMeasureForLine(cm, lineObj)
-  var pos
-  var order = getOrder(lineObj, cm.doc.direction)
-  if (order) {
-    if (cm.options.lineWrapping) {
-      ;var assign;
-      ((assign = wrappedLineExtent(cm, lineObj, preparedMeasure, y), begin = assign.begin, end = assign.end, assign))
-    }
-    pos = new Pos(lineNo, begin)
-    var beginLeft = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left
-    var dir = beginLeft < x ? 1 : -1
-    var prevDiff, diff = beginLeft - x, prevPos
-    do {
-      prevDiff = diff
-      prevPos = pos
-      pos = moveVisually(cm, lineObj, pos, dir)
-      if (pos == null || pos.ch < begin || end <= (pos.sticky == "before" ? pos.ch - 1 : pos.ch)) {
-        pos = prevPos
-        break
-      }
-      diff = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left - x
-    } while ((dir < 0) != (diff < 0) && (Math.abs(diff) <= Math.abs(prevDiff)))
-    if (Math.abs(diff) > Math.abs(prevDiff)) {
-      if ((diff < 0) == (prevDiff < 0)) { throw new Error("Broke out of infinite loop in coordsCharInner") }
-      pos = prevPos
-    }
-  } else {
-    var ch = findFirst(function (ch) {
-      var box = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line")
-      if (box.top > y) {
-        // For the cursor stickiness
-        end = Math.min(ch, end)
-        return true
-      }
-      else if (box.bottom <= y) { return false }
-      else if (box.left > x) { return true }
-      else if (box.right < x) { return false }
-      else { return (x - box.left < box.right - x) }
-    }, begin, end)
-    ch = skipExtendingChars(lineObj.text, ch, 1)
-    pos = new Pos(lineNo, ch, ch == end ? "before" : "after")
-  }
-  var coords = cursorCoords(cm, pos, "line", lineObj, preparedMeasure)
-  if (y < coords.top || coords.bottom < y) { pos.outside = true }
-  pos.xRel = x < coords.left ? -1 : (x > coords.right ? 1 : 0)
-  return pos
-}
-
-var measureText
-// Compute the default text height.
-function textHeight(display) {
-  if (display.cachedTextHeight != null) { return display.cachedTextHeight }
-  if (measureText == null) {
-    measureText = elt("pre")
-    // Measure a bunch of lines, for browsers that compute
-    // fractional heights.
-    for (var i = 0; i < 49; ++i) {
-      measureText.appendChild(document.createTextNode("x"))
-      measureText.appendChild(elt("br"))
-    }
-    measureText.appendChild(document.createTextNode("x"))
-  }
-  removeChildrenAndAdd(display.measure, measureText)
-  var height = measureText.offsetHeight / 50
-  if (height > 3) { display.cachedTextHeight = height }
-  removeChildren(display.measure)
-  return height || 1
-}
-
-// Compute the default character width.
-function charWidth(display) {
-  if (display.cachedCharWidth != null) { return display.cachedCharWidth }
-  var anchor = elt("span", "xxxxxxxxxx")
-  var pre = elt("pre", [anchor])
-  removeChildrenAndAdd(display.measure, pre)
-  var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10
-  if (width > 2) { display.cachedCharWidth = width }
-  return width || 10
-}
-
-// Do a bulk-read of the DOM positions and sizes needed to draw the
-// view, so that we don't interleave reading and writing to the DOM.
-function getDimensions(cm) {
-  var d = cm.display, left = {}, width = {}
-  var gutterLeft = d.gutters.clientLeft
-  for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
-    left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft
-    width[cm.options.gutters[i]] = n.clientWidth
-  }
-  return {fixedPos: compensateForHScroll(d),
-          gutterTotalWidth: d.gutters.offsetWidth,
-          gutterLeft: left,
-          gutterWidth: width,
-          wrapperWidth: d.wrapper.clientWidth}
-}
-
-// Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
-// but using getBoundingClientRect to get a sub-pixel-accurate
-// result.
-function compensateForHScroll(display) {
-  return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
-}
-
-// Returns a function that estimates the height of a line, to use as
-// first approximation until the line becomes visible (and is thus
-// properly measurable).
-function estimateHeight(cm) {
-  var th = textHeight(cm.display), wrapping = cm.options.lineWrapping
-  var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3)
-  return function (line) {
-    if (lineIsHidden(cm.doc, line)) { return 0 }
-
-    var widgetsHeight = 0
-    if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {
-      if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height }
-    } }
-
-    if (wrapping)
-      { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }
-    else
-      { return widgetsHeight + th }
-  }
-}
-
-function estimateLineHeights(cm) {
-  var doc = cm.doc, est = estimateHeight(cm)
-  doc.iter(function (line) {
-    var estHeight = est(line)
-    if (estHeight != line.height) { updateLineHeight(line, estHeight) }
-  })
-}
-
-// Given a mouse event, find the corresponding position. If liberal
-// is false, it checks whether a gutter or scrollbar was clicked,
-// and returns null if it was. forRect is used by rectangular
-// selections, and tries to estimate a character position even for
-// coordinates beyond the right of the text.
-function posFromMouse(cm, e, liberal, forRect) {
-  var display = cm.display
-  if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null }
-
-  var x, y, space = display.lineSpace.getBoundingClientRect()
-  // Fails unpredictably on IE[67] when mouse is dragged around quickly.
-  try { x = e.clientX - space.left; y = e.clientY - space.top }
-  catch (e) { return null }
-  var coords = coordsChar(cm, x, y), line
-  if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
-    var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length
-    coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff))
-  }
-  return coords
-}
-
-// Find the view element corresponding to a given line. Return null
-// when the line isn't visible.
-function findViewIndex(cm, n) {
-  if (n >= cm.display.viewTo) { return null }
-  n -= cm.display.viewFrom
-  if (n < 0) { return null }
-  var view = cm.display.view
-  for (var i = 0; i < view.length; i++) {
-    n -= view[i].size
-    if (n < 0) { return i }
-  }
-}
-
-function updateSelection(cm) {
-  cm.display.input.showSelection(cm.display.input.prepareSelection())
-}
-
-function prepareSelection(cm, primary) {
-  var doc = cm.doc, result = {}
-  var curFragment = result.cursors = document.createDocumentFragment()
-  var selFragment = result.selection = document.createDocumentFragment()
-
-  for (var i = 0; i < doc.sel.ranges.length; i++) {
-    if (primary === false && i == doc.sel.primIndex) { continue }
-    var range = doc.sel.ranges[i]
-    if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue }
-    var collapsed = range.empty()
-    if (collapsed || cm.options.showCursorWhenSelecting)
-      { drawSelectionCursor(cm, range.head, curFragment) }
-    if (!collapsed)
-      { drawSelectionRange(cm, range, selFragment) }
-  }
-  return result
-}
-
-// Draws a cursor for the given range
-function drawSelectionCursor(cm, head, output) {
-  var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine)
-
-  var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"))
-  cursor.style.left = pos.left + "px"
-  cursor.style.top = pos.top + "px"
-  cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px"
-
-  if (pos.other) {
-    // Secondary cursor, shown when on a 'jump' in bi-directional text
-    var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"))
-    otherCursor.style.display = ""
-    otherCursor.style.left = pos.other.left + "px"
-    otherCursor.style.top = pos.other.top + "px"
-    otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px"
-  }
-}
-
-// Draws the given range as a highlighted selection
-function drawSelectionRange(cm, range, output) {
-  var display = cm.display, doc = cm.doc
-  var fragment = document.createDocumentFragment()
-  var padding = paddingH(cm.display), leftSide = padding.left
-  var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right
-
-  function add(left, top, width, bottom) {
-    if (top < 0) { top = 0 }
-    top = Math.round(top)
-    bottom = Math.round(bottom)
-    fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n                             top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n                             height: " + (bottom - top) + "px")))
-  }
-
-  function drawForLine(line, fromArg, toArg) {
-    var lineObj = getLine(doc, line)
-    var lineLen = lineObj.text.length
-    var start, end
-    function coords(ch, bias) {
-      return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
-    }
-
-    iterateBidiSections(getOrder(lineObj, doc.direction), fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir) {
-      var leftPos = coords(from, "left"), rightPos, left, right
-      if (from == to) {
-        rightPos = leftPos
-        left = right = leftPos.left
-      } else {
-        rightPos = coords(to - 1, "right")
-        if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp }
-        left = leftPos.left
-        right = rightPos.right
-      }
-      if (fromArg == null && from == 0) { left = leftSide }
-      if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
-        add(left, leftPos.top, null, leftPos.bottom)
-        left = leftSide
-        if (leftPos.bottom < rightPos.top) { add(left, leftPos.bottom, null, rightPos.top) }
-      }
-      if (toArg == null && to == lineLen) { right = rightSide }
-      if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)
-        { start = leftPos }
-      if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)
-        { end = rightPos }
-      if (left < leftSide + 1) { left = leftSide }
-      add(left, rightPos.top, right - left, rightPos.bottom)
-    })
-    return {start: start, end: end}
-  }
-
-  var sFrom = range.from(), sTo = range.to()
-  if (sFrom.line == sTo.line) {
-    drawForLine(sFrom.line, sFrom.ch, sTo.ch)
-  } else {
-    var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line)
-    var singleVLine = visualLine(fromLine) == visualLine(toLine)
-    var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end
-    var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start
-    if (singleVLine) {
-      if (leftEnd.top < rightStart.top - 2) {
-        add(leftEnd.right, leftEnd.top, null, leftEnd.bottom)
-        add(leftSide, rightStart.top, rightStart.left, rightStart.bottom)
-      } else {
-        add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom)
-      }
-    }
-    if (leftEnd.bottom < rightStart.top)
-      { add(leftSide, leftEnd.bottom, null, rightStart.top) }
-  }
-
-  output.appendChild(fragment)
-}
-
-// Cursor-blinking
-function restartBlink(cm) {
-  if (!cm.state.focused) { return }
-  var display = cm.display
-  clearInterval(display.blinker)
-  var on = true
-  display.cursorDiv.style.visibility = ""
-  if (cm.options.cursorBlinkRate > 0)
-    { display.blinker = setInterval(function () { return display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; },
-      cm.options.cursorBlinkRate) }
-  else if (cm.options.cursorBlinkRate < 0)
-    { display.cursorDiv.style.visibility = "hidden" }
-}
-
-function ensureFocus(cm) {
-  if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm) }
-}
-
-function delayBlurEvent(cm) {
-  cm.state.delayingBlurEvent = true
-  setTimeout(function () { if (cm.state.delayingBlurEvent) {
-    cm.state.delayingBlurEvent = false
-    onBlur(cm)
-  } }, 100)
-}
-
-function onFocus(cm, e) {
-  if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false }
-
-  if (cm.options.readOnly == "nocursor") { return }
-  if (!cm.state.focused) {
-    signal(cm, "focus", cm, e)
-    cm.state.focused = true
-    addClass(cm.display.wrapper, "CodeMirror-focused")
-    // This test prevents this from firing when a context
-    // menu is closed (since the input reset would kill the
-    // select-all detection hack)
-    if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
-      cm.display.input.reset()
-      if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20) } // Issue #1730
-    }
-    cm.display.input.receivedFocus()
-  }
-  restartBlink(cm)
-}
-function onBlur(cm, e) {
-  if (cm.state.delayingBlurEvent) { return }
-
-  if (cm.state.focused) {
-    signal(cm, "blur", cm, e)
-    cm.state.focused = false
-    rmClass(cm.display.wrapper, "CodeMirror-focused")
-  }
-  clearInterval(cm.display.blinker)
-  setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false } }, 150)
-}
-
-// Re-align line numbers and gutter marks to compensate for
-// horizontal scrolling.
-function alignHorizontally(cm) {
-  var display = cm.display, view = display.view
-  if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
-  var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft
-  var gutterW = display.gutters.offsetWidth, left = comp + "px"
-  for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
-    if (cm.options.fixedGutter) {
-      if (view[i].gutter)
-        { view[i].gutter.style.left = left }
-      if (view[i].gutterBackground)
-        { view[i].gutterBackground.style.left = left }
-    }
-    var align = view[i].alignable
-    if (align) { for (var j = 0; j < align.length; j++)
-      { align[j].style.left = left } }
-  } }
-  if (cm.options.fixedGutter)
-    { display.gutters.style.left = (comp + gutterW) + "px" }
-}
-
-// Used to ensure that the line number gutter is still the right
-// size for the current document size. Returns true when an update
-// is needed.
-function maybeUpdateLineNumberWidth(cm) {
-  if (!cm.options.lineNumbers) { return false }
-  var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display
-  if (last.length != display.lineNumChars) {
-    var test = display.measure.appendChild(elt("div", [elt("div", last)],
-                                               "CodeMirror-linenumber CodeMirror-gutter-elt"))
-    var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW
-    display.lineGutter.style.width = ""
-    display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1
-    display.lineNumWidth = display.lineNumInnerWidth + padding
-    display.lineNumChars = display.lineNumInnerWidth ? last.length : -1
-    display.lineGutter.style.width = display.lineNumWidth + "px"
-    updateGutterSpace(cm)
-    return true
-  }
-  return false
-}
-
-// Read the actual heights of the rendered lines, and update their
-// stored heights to match.
-function updateHeightsInViewport(cm) {
-  var display = cm.display
-  var prevBottom = display.lineDiv.offsetTop
-  for (var i = 0; i < display.view.length; i++) {
-    var cur = display.view[i], height = (void 0)
-    if (cur.hidden) { continue }
-    if (ie && ie_version < 8) {
-      var bot = cur.node.offsetTop + cur.node.offsetHeight
-      height = bot - prevBottom
-      prevBottom = bot
-    } else {
-      var box = cur.node.getBoundingClientRect()
-      height = box.bottom - box.top
-    }
-    var diff = cur.line.height - height
-    if (height < 2) { height = textHeight(display) }
-    if (diff > .001 || diff < -.001) {
-      updateLineHeight(cur.line, height)
-      updateWidgetHeight(cur.line)
-      if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
-        { updateWidgetHeight(cur.rest[j]) } }
-    }
-  }
-}
-
-// Read and store the height of line widgets associated with the
-// given line.
-function updateWidgetHeight(line) {
-  if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)
-    { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight } }
-}
-
-// Compute the lines that are visible in a given viewport (defaults
-// the the current scroll position). viewport may contain top,
-// height, and ensure (see op.scrollToPos) properties.
-function visibleLines(display, doc, viewport) {
-  var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop
-  top = Math.floor(top - paddingTop(display))
-  var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight
-
-  var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom)
-  // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
-  // forces those lines into the viewport (if possible).
-  if (viewport && viewport.ensure) {
-    var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line
-    if (ensureFrom < from) {
-      from = ensureFrom
-      to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)
-    } else if (Math.min(ensureTo, doc.lastLine()) >= to) {
-      from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight)
-      to = ensureTo
-    }
-  }
-  return {from: from, to: Math.max(to, from + 1)}
-}
-
-// Sync the scrollable area and scrollbars, ensure the viewport
-// covers the visible area.
-function setScrollTop(cm, val) {
-  if (Math.abs(cm.doc.scrollTop - val) < 2) { return }
-  cm.doc.scrollTop = val
-  if (!gecko) { updateDisplaySimple(cm, {top: val}) }
-  if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val }
-  cm.display.scrollbars.setScrollTop(val)
-  if (gecko) { updateDisplaySimple(cm) }
-  startWorker(cm, 100)
-}
-// Sync scroller and scrollbar, ensure the gutter elements are
-// aligned.
-function setScrollLeft(cm, val, isScroller) {
-  if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) { return }
-  val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth)
-  cm.doc.scrollLeft = val
-  alignHorizontally(cm)
-  if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val }
-  cm.display.scrollbars.setScrollLeft(val)
-}
-
-// Since the delta values reported on mouse wheel events are
-// unstandardized between browsers and even browser versions, and
-// generally horribly unpredictable, this code starts by measuring
-// the scroll effect that the first few mouse wheel events have,
-// and, from that, detects the way it can convert deltas to pixel
-// offsets afterwards.
-//
-// The reason we want to know the amount a wheel event will scroll
-// is that it gives us a chance to update the display before the
-// actual scrolling happens, reducing flickering.
-
-var wheelSamples = 0;
-var wheelPixelsPerUnit = null;
-// Fill in a browser-detected starting value on browsers where we
-// know one. These don't have to be accurate -- the result of them
-// being wrong would just be a slight flicker on the first wheel
-// scroll (if it is large enough).
-if (ie) { wheelPixelsPerUnit = -.53 }
-else if (gecko) { wheelPixelsPerUnit = 15 }
-else if (chrome) { wheelPixelsPerUnit = -.7 }
-else if (safari) { wheelPixelsPerUnit = -1/3 }
-
-function wheelEventDelta(e) {
-  var dx = e.wheelDeltaX, dy = e.wheelDeltaY
-  if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail }
-  if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail }
-  else if (dy == null) { dy = e.wheelDelta }
-  return {x: dx, y: dy}
-}
-function wheelEventPixels(e) {
-  var delta = wheelEventDelta(e)
-  delta.x *= wheelPixelsPerUnit
-  delta.y *= wheelPixelsPerUnit
-  return delta
-}
-
-function onScrollWheel(cm, e) {
-  var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y
-
-  var display = cm.display, scroll = display.scroller
-  // Quit if there's nothing to scroll here
-  var canScrollX = scroll.scrollWidth > scroll.clientWidth
-  var canScrollY = scroll.scrollHeight > scroll.clientHeight
-  if (!(dx && canScrollX || dy && canScrollY)) { return }
-
-  // Webkit browsers on OS X abort momentum scrolls when the target
-  // of the scroll event is removed from the scrollable element.
-  // This hack (see related code in patchDisplay) makes sure the
-  // element is kept around.
-  if (dy && mac && webkit) {
-    outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
-      for (var i = 0; i < view.length; i++) {
-        if (view[i].node == cur) {
-          cm.display.currentWheelTarget = cur
-          break outer
-        }
-      }
-    }
-  }
-
-  // On some browsers, horizontal scrolling will cause redraws to
-  // happen before the gutter has been realigned, causing it to
-  // wriggle around in a most unseemly way. When we have an
-  // estimated pixels/delta value, we just handle horizontal
-  // scrolling entirely here. It'll be slightly off from native, but
-  // better than glitching out.
-  if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
-    if (dy && canScrollY)
-      { setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight))) }
-    setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)))
-    // Only prevent default scrolling if vertical scrolling is
-    // actually possible. Otherwise, it causes vertical scroll
-    // jitter on OSX trackpads when deltaX is small and deltaY
-    // is large (issue #3579)
-    if (!dy || (dy && canScrollY))
-      { e_preventDefault(e) }
-    display.wheelStartX = null // Abort measurement, if in progress
-    return
-  }
-
-  // 'Project' the visible viewport to cover the area that is being
-  // scrolled into view (if we know enough to estimate it).
-  if (dy && wheelPixelsPerUnit != null) {
-    var pixels = dy * wheelPixelsPerUnit
-    var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight
-    if (pixels < 0) { top = Math.max(0, top + pixels - 50) }
-    else { bot = Math.min(cm.doc.height, bot + pixels + 50) }
-    updateDisplaySimple(cm, {top: top, bottom: bot})
-  }
-
-  if (wheelSamples < 20) {
-    if (display.wheelStartX == null) {
-      display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop
-      display.wheelDX = dx; display.wheelDY = dy
-      setTimeout(function () {
-        if (display.wheelStartX == null) { return }
-        var movedX = scroll.scrollLeft - display.wheelStartX
-        var movedY = scroll.scrollTop - display.wheelStartY
-        var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
-          (movedX && display.wheelDX && movedX / display.wheelDX)
-        display.wheelStartX = display.wheelStartY = null
-        if (!sample) { return }
-        wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1)
-        ++wheelSamples
-      }, 200)
-    } else {
-      display.wheelDX += dx; display.wheelDY += dy
-    }
-  }
-}
-
-// SCROLLBARS
-
-// Prepare DOM reads needed to update the scrollbars. Done in one
-// shot to minimize update/measure roundtrips.
-function measureForScrollbars(cm) {
-  var d = cm.display, gutterW = d.gutters.offsetWidth
-  var docH = Math.round(cm.doc.height + paddingVert(cm.display))
-  return {
-    clientHeight: d.scroller.clientHeight,
-    viewHeight: d.wrapper.clientHeight,
-    scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
-    viewWidth: d.wrapper.clientWidth,
-    barLeft: cm.options.fixedGutter ? gutterW : 0,
-    docHeight: docH,
-    scrollHeight: docH + scrollGap(cm) + d.barHeight,
-    nativeBarWidth: d.nativeBarWidth,
-    gutterWidth: gutterW
-  }
-}
-
-var NativeScrollbars = function(place, scroll, cm) {
-  this.cm = cm
-  var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar")
-  var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar")
-  place(vert); place(horiz)
-
-  on(vert, "scroll", function () {
-    if (vert.clientHeight) { scroll(vert.scrollTop, "vertical") }
-  })
-  on(horiz, "scroll", function () {
-    if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal") }
-  })
-
-  this.checkedZeroWidth = false
-  // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
-  if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px" }
-};
-
-NativeScrollbars.prototype.update = function (measure) {
-  var needsH = measure.scrollWidth > measure.clientWidth + 1
-  var needsV = measure.scrollHeight > measure.clientHeight + 1
-  var sWidth = measure.nativeBarWidth
-
-  if (needsV) {
-    this.vert.style.display = "block"
-    this.vert.style.bottom = needsH ? sWidth + "px" : "0"
-    var totalHeight = measure.viewHeight - (needsH ? sWidth : 0)
-    // A bug in IE8 can cause this value to be negative, so guard it.
-    this.vert.firstChild.style.height =
-      Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px"
-  } else {
-    this.vert.style.display = ""
-    this.vert.firstChild.style.height = "0"
-  }
-
-  if (needsH) {
-    this.horiz.style.display = "block"
-    this.horiz.style.right = needsV ? sWidth + "px" : "0"
-    this.horiz.style.left = measure.barLeft + "px"
-    var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0)
-    this.horiz.firstChild.style.width =
-      Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px"
-  } else {
-    this.horiz.style.display = ""
-    this.horiz.firstChild.style.width = "0"
-  }
-
-  if (!this.checkedZeroWidth && measure.clientHeight > 0) {
-    if (sWidth == 0) { this.zeroWidthHack() }
-    this.checkedZeroWidth = true
-  }
-
-  return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
-};
-
-NativeScrollbars.prototype.setScrollLeft = function (pos) {
-  if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos }
-  if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz, "horiz") }
-};
-
-NativeScrollbars.prototype.setScrollTop = function (pos) {
-  if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos }
-  if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert, "vert") }
-};
-
-NativeScrollbars.prototype.zeroWidthHack = function () {
-  var w = mac && !mac_geMountainLion ? "12px" : "18px"
-  this.horiz.style.height = this.vert.style.width = w
-  this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none"
-  this.disableHoriz = new Delayed
-  this.disableVert = new Delayed
-};
-
-NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {
-  bar.style.pointerEvents = "auto"
-  function maybeDisable() {
-    // To find out whether the scrollbar is still visible, we
-    // check whether the element under the pixel in the bottom
-    // right corner of the scrollbar box is the scrollbar box
-    // itself (when the bar is still visible) or its filler child
-    // (when the bar is hidden). If it is still visible, we keep
-    // it enabled, if it's hidden, we disable pointer events.
-    var box = bar.getBoundingClientRect()
-    var elt = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)
-        : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1)
-    if (elt != bar) { bar.style.pointerEvents = "none" }
-    else { delay.set(1000, maybeDisable) }
-  }
-  delay.set(1000, maybeDisable)
-};
-
-NativeScrollbars.prototype.clear = function () {
-  var parent = this.horiz.parentNode
-  parent.removeChild(this.horiz)
-  parent.removeChild(this.vert)
-};
-
-var NullScrollbars = function () {};
-
-NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };
-NullScrollbars.prototype.setScrollLeft = function () {};
-NullScrollbars.prototype.setScrollTop = function () {};
-NullScrollbars.prototype.clear = function () {};
-
-function updateScrollbars(cm, measure) {
-  if (!measure) { measure = measureForScrollbars(cm) }
-  var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight
-  updateScrollbarsInner(cm, measure)
-  for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
-    if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
-      { updateHeightsInViewport(cm) }
-    updateScrollbarsInner(cm, measureForScrollbars(cm))
-    startWidth = cm.display.barWidth; startHeight = cm.display.barHeight
-  }
-}
-
-// Re-synchronize the fake scrollbars with the actual size of the
-// content.
-function updateScrollbarsInner(cm, measure) {
-  var d = cm.display
-  var sizes = d.scrollbars.update(measure)
-
-  d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px"
-  d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px"
-  d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent"
-
-  if (sizes.right && sizes.bottom) {
-    d.scrollbarFiller.style.display = "block"
-    d.scrollbarFiller.style.height = sizes.bottom + "px"
-    d.scrollbarFiller.style.width = sizes.right + "px"
-  } else { d.scrollbarFiller.style.display = "" }
-  if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
-    d.gutterFiller.style.display = "block"
-    d.gutterFiller.style.height = sizes.bottom + "px"
-    d.gutterFiller.style.width = measure.gutterWidth + "px"
-  } else { d.gutterFiller.style.display = "" }
-}
-
-var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars}
-
-function initScrollbars(cm) {
-  if (cm.display.scrollbars) {
-    cm.display.scrollbars.clear()
-    if (cm.display.scrollbars.addClass)
-      { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass) }
-  }
-
-  cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
-    cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller)
-    // Prevent clicks in the scrollbars from killing focus
-    on(node, "mousedown", function () {
-      if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0) }
-    })
-    node.setAttribute("cm-not-content", "true")
-  }, function (pos, axis) {
-    if (axis == "horizontal") { setScrollLeft(cm, pos) }
-    else { setScrollTop(cm, pos) }
-  }, cm)
-  if (cm.display.scrollbars.addClass)
-    { addClass(cm.display.wrapper, cm.display.scrollbars.addClass) }
-}
-
-// SCROLLING THINGS INTO VIEW
-
-// If an editor sits on the top or bottom of the window, partially
-// scrolled out of view, this ensures that the cursor is visible.
-function maybeScrollWindow(cm, rect) {
-  if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
-
-  var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null
-  if (rect.top + box.top < 0) { doScroll = true }
-  else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false }
-  if (doScroll != null && !phantom) {
-    var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n                         top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n                         height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n                         left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;"))
-    cm.display.lineSpace.appendChild(scrollNode)
-    scrollNode.scrollIntoView(doScroll)
-    cm.display.lineSpace.removeChild(scrollNode)
-  }
-}
-
-// Scroll a given position into view (immediately), verifying that
-// it actually became visible (as line heights are accurately
-// measured, the position of something may 'drift' during drawing).
-function scrollPosIntoView(cm, pos, end, margin) {
-  if (margin == null) { margin = 0 }
-  var rect
-  for (var limit = 0; limit < 5; limit++) {
-    var changed = false
-    var coords = cursorCoords(cm, pos)
-    var endCoords = !end || end == pos ? coords : cursorCoords(cm, end)
-    rect = {left: Math.min(coords.left, endCoords.left),
-            top: Math.min(coords.top, endCoords.top) - margin,
-            right: Math.max(coords.left, endCoords.left),
-            bottom: Math.max(coords.bottom, endCoords.bottom) + margin}
-    var scrollPos = calculateScrollPos(cm, rect)
-    var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft
-    if (scrollPos.scrollTop != null) {
-      setScrollTop(cm, scrollPos.scrollTop)
-      if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true }
-    }
-    if (scrollPos.scrollLeft != null) {
-      setScrollLeft(cm, scrollPos.scrollLeft)
-      if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true }
-    }
-    if (!changed) { break }
-  }
-  return rect
-}
-
-// Scroll a given set of coordinates into view (immediately).
-function scrollIntoView(cm, rect) {
-  var scrollPos = calculateScrollPos(cm, rect)
-  if (scrollPos.scrollTop != null) { setScrollTop(cm, scrollPos.scrollTop) }
-  if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft) }
-}
-
-// Calculate a new scroll position needed to scroll the given
-// rectangle into view. Returns an object with scrollTop and
-// scrollLeft properties. When these are undefined, the
-// vertical/horizontal position does not need to be adjusted.
-function calculateScrollPos(cm, rect) {
-  var display = cm.display, snapMargin = textHeight(cm.display)
-  if (rect.top < 0) { rect.top = 0 }
-  var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop
-  var screen = displayHeight(cm), result = {}
-  if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen }
-  var docBottom = cm.doc.height + paddingVert(display)
-  var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin
-  if (rect.top < screentop) {
-    result.scrollTop = atTop ? 0 : rect.top
-  } else if (rect.bottom > screentop + screen) {
-    var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen)
-    if (newTop != screentop) { result.scrollTop = newTop }
-  }
-
-  var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft
-  var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0)
-  var tooWide = rect.right - rect.left > screenw
-  if (tooWide) { rect.right = rect.left + screenw }
-  if (rect.left < 10)
-    { result.scrollLeft = 0 }
-  else if (rect.left < screenleft)
-    { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)) }
-  else if (rect.right > screenw + screenleft - 3)
-    { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw }
-  return result
-}
-
-// Store a relative adjustment to the scroll position in the current
-// operation (to be applied when the operation finishes).
-function addToScrollPos(cm, left, top) {
-  if (left != null || top != null) { resolveScrollToPos(cm) }
-  if (left != null)
-    { cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left }
-  if (top != null)
-    { cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top }
-}
-
-// Make sure that at the end of the operation the current cursor is
-// shown.
-function ensureCursorVisible(cm) {
-  resolveScrollToPos(cm)
-  var cur = cm.getCursor(), from = cur, to = cur
-  if (!cm.options.lineWrapping) {
-    from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur
-    to = Pos(cur.line, cur.ch + 1)
-  }
-  cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin}
-}
-
-// When an operation has its scrollToPos property set, and another
-// scroll action is applied before the end of the operation, this
-// 'simulates' scrolling that position into view in a cheap way, so
-// that the effect of intermediate scroll commands is not ignored.
-function resolveScrollToPos(cm) {
-  var range = cm.curOp.scrollToPos
-  if (range) {
-    cm.curOp.scrollToPos = null
-    var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to)
-    var sPos = calculateScrollPos(cm, {
-      left: Math.min(from.left, to.left),
-      top: Math.min(from.top, to.top) - range.margin,
-      right: Math.max(from.right, to.right),
-      bottom: Math.max(from.bottom, to.bottom) + range.margin
-    })
-    cm.scrollTo(sPos.scrollLeft, sPos.scrollTop)
-  }
-}
-
-// Operations are used to wrap a series of changes to the editor
-// state in such a way that each change won't have to update the
-// cursor and display (which would be awkward, slow, and
-// error-prone). Instead, display updates are batched and then all
-// combined and executed at once.
-
-var nextOpId = 0
-// Start a new operation.
-function startOperation(cm) {
-  cm.curOp = {
-    cm: cm,
-    viewChanged: false,      // Flag that indicates that lines might need to be redrawn
-    startHeight: cm.doc.height, // Used to detect need to update scrollbar
-    forceUpdate: false,      // Used to force a redraw
-    updateInput: null,       // Whether to reset the input textarea
-    typing: false,           // Whether this reset should be careful to leave existing text (for compositing)
-    changeObjs: null,        // Accumulated changes, for firing change events
-    cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
-    cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
-    selectionChanged: false, // Whether the selection needs to be redrawn
-    updateMaxLine: false,    // Set when the widest line needs to be determined anew
-    scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
-    scrollToPos: null,       // Used to scroll to a specific position
-    focus: false,
-    id: ++nextOpId           // Unique ID
-  }
-  pushOperation(cm.curOp)
-}
-
-// Finish an operation, updating the display and signalling delayed events
-function endOperation(cm) {
-  var op = cm.curOp
-  finishOperation(op, function (group) {
-    for (var i = 0; i < group.ops.length; i++)
-      { group.ops[i].cm.curOp = null }
-    endOperations(group)
-  })
-}
-
-// The DOM updates done when an operation finishes are batched so
-// that the minimum number of relayouts are required.
-function endOperations(group) {
-  var ops = group.ops
-  for (var i = 0; i < ops.length; i++) // Read DOM
-    { endOperation_R1(ops[i]) }
-  for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
-    { endOperation_W1(ops[i$1]) }
-  for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
-    { endOperation_R2(ops[i$2]) }
-  for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)
-    { endOperation_W2(ops[i$3]) }
-  for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM
-    { endOperation_finish(ops[i$4]) }
-}
-
-function endOperation_R1(op) {
-  var cm = op.cm, display = cm.display
-  maybeClipScrollbars(cm)
-  if (op.updateMaxLine) { findMaxLine(cm) }
-
-  op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
-    op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
-                       op.scrollToPos.to.line >= display.viewTo) ||
-    display.maxLineChanged && cm.options.lineWrapping
-  op.update = op.mustUpdate &&
-    new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate)
-}
-
-function endOperation_W1(op) {
-  op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update)
-}
-
-function endOperation_R2(op) {
-  var cm = op.cm, display = cm.display
-  if (op.updatedDisplay) { updateHeightsInViewport(cm) }
-
-  op.barMeasure = measureForScrollbars(cm)
-
-  // If the max line changed since it was last measured, measure it,
-  // and ensure the document's width matches it.
-  // updateDisplay_W2 will use these properties to do the actual resizing
-  if (display.maxLineChanged && !cm.options.lineWrapping) {
-    op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3
-    cm.display.sizerWidth = op.adjustWidthTo
-    op.barMeasure.scrollWidth =
-      Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth)
-    op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm))
-  }
-
-  if (op.updatedDisplay || op.selectionChanged)
-    { op.preparedSelection = display.input.prepareSelection(op.focus) }
-}
-
-function endOperation_W2(op) {
-  var cm = op.cm
-
-  if (op.adjustWidthTo != null) {
-    cm.display.sizer.style.minWidth = op.adjustWidthTo + "px"
-    if (op.maxScrollLeft < cm.doc.scrollLeft)
-      { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true) }
-    cm.display.maxLineChanged = false
-  }
-
-  var takeFocus = op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus())
-  if (op.preparedSelection)
-    { cm.display.input.showSelection(op.preparedSelection, takeFocus) }
-  if (op.updatedDisplay || op.startHeight != cm.doc.height)
-    { updateScrollbars(cm, op.barMeasure) }
-  if (op.updatedDisplay)
-    { setDocumentHeight(cm, op.barMeasure) }
-
-  if (op.selectionChanged) { restartBlink(cm) }
-
-  if (cm.state.focused && op.updateInput)
-    { cm.display.input.reset(op.typing) }
-  if (takeFocus) { ensureFocus(op.cm) }
-}
-
-function endOperation_finish(op) {
-  var cm = op.cm, display = cm.display, doc = cm.doc
-
-  if (op.updatedDisplay) { postUpdateDisplay(cm, op.update) }
-
-  // Abort mouse wheel delta measurement, when scrolling explicitly
-  if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
-    { display.wheelStartX = display.wheelStartY = null }
-
-  // Propagate the scroll position to the actual DOM scroller
-  if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) {
-    doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop))
-    display.scrollbars.setScrollTop(doc.scrollTop)
-    display.scroller.scrollTop = doc.scrollTop
-  }
-  if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) {
-    doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft))
-    display.scrollbars.setScrollLeft(doc.scrollLeft)
-    display.scroller.scrollLeft = doc.scrollLeft
-    alignHorizontally(cm)
-  }
-  // If we need to scroll a specific position into view, do so.
-  if (op.scrollToPos) {
-    var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
-                                 clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin)
-    maybeScrollWindow(cm, rect)
-  }
-
-  // Fire events for markers that are hidden/unidden by editing or
-  // undoing
-  var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers
-  if (hidden) { for (var i = 0; i < hidden.length; ++i)
-    { if (!hidden[i].lines.length) { signal(hidden[i], "hide") } } }
-  if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)
-    { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide") } } }
-
-  if (display.wrapper.offsetHeight)
-    { doc.scrollTop = cm.display.scroller.scrollTop }
-
-  // Fire change events, and delayed event handlers
-  if (op.changeObjs)
-    { signal(cm, "changes", cm, op.changeObjs) }
-  if (op.update)
-    { op.update.finish() }
-}
-
-// Run the given function in an operation
-function runInOp(cm, f) {
-  if (cm.curOp) { return f() }
-  startOperation(cm)
-  try { return f() }
-  finally { endOperation(cm) }
-}
-// Wraps a function in an operation. Returns the wrapped function.
-function operation(cm, f) {
-  return function() {
-    if (cm.curOp) { return f.apply(cm, arguments) }
-    startOperation(cm)
-    try { return f.apply(cm, arguments) }
-    finally { endOperation(cm) }
-  }
-}
-// Used to add methods to editor and doc instances, wrapping them in
-// operations.
-function methodOp(f) {
-  return function() {
-    if (this.curOp) { return f.apply(this, arguments) }
-    startOperation(this)
-    try { return f.apply(this, arguments) }
-    finally { endOperation(this) }
-  }
-}
-function docMethodOp(f) {
-  return function() {
-    var cm = this.cm
-    if (!cm || cm.curOp) { return f.apply(this, arguments) }
-    startOperation(cm)
-    try { return f.apply(this, arguments) }
-    finally { endOperation(cm) }
-  }
-}
-
-// Updates the display.view data structure for a given change to the
-// document. From and to are in pre-change coordinates. Lendiff is
-// the amount of lines added or subtracted by the change. This is
-// used for changes that span multiple lines, or change the way
-// lines are divided into visual lines. regLineChange (below)
-// registers single-line changes.
-function regChange(cm, from, to, lendiff) {
-  if (from == null) { from = cm.doc.first }
-  if (to == null) { to = cm.doc.first + cm.doc.size }
-  if (!lendiff) { lendiff = 0 }
-
-  var display = cm.display
-  if (lendiff && to < display.viewTo &&
-      (display.updateLineNumbers == null || display.updateLineNumbers > from))
-    { display.updateLineNumbers = from }
-
-  cm.curOp.viewChanged = true
-
-  if (from >= display.viewTo) { // Change after
-    if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
-      { resetView(cm) }
-  } else if (to <= display.viewFrom) { // Change before
-    if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
-      resetView(cm)
-    } else {
-      display.viewFrom += lendiff
-      display.viewTo += lendiff
-    }
-  } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
-    resetView(cm)
-  } else if (from <= display.viewFrom) { // Top overlap
-    var cut = viewCuttingPoint(cm, to, to + lendiff, 1)
-    if (cut) {
-      display.view = display.view.slice(cut.index)
-      display.viewFrom = cut.lineN
-      display.viewTo += lendiff
-    } else {
-      resetView(cm)
-    }
-  } else if (to >= display.viewTo) { // Bottom overlap
-    var cut$1 = viewCuttingPoint(cm, from, from, -1)
-    if (cut$1) {
-      display.view = display.view.slice(0, cut$1.index)
-      display.viewTo = cut$1.lineN
-    } else {
-      resetView(cm)
-    }
-  } else { // Gap in the middle
-    var cutTop = viewCuttingPoint(cm, from, from, -1)
-    var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1)
-    if (cutTop && cutBot) {
-      display.view = display.view.slice(0, cutTop.index)
-        .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
-        .concat(display.view.slice(cutBot.index))
-      display.viewTo += lendiff
-    } else {
-      resetView(cm)
-    }
-  }
-
-  var ext = display.externalMeasured
-  if (ext) {
-    if (to < ext.lineN)
-      { ext.lineN += lendiff }
-    else if (from < ext.lineN + ext.size)
-      { display.externalMeasured = null }
-  }
-}
-
-// Register a change to a single line. Type must be one of "text",
-// "gutter", "class", "widget"
-function regLineChange(cm, line, type) {
-  cm.curOp.viewChanged = true
-  var display = cm.display, ext = cm.display.externalMeasured
-  if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
-    { display.externalMeasured = null }
-
-  if (line < display.viewFrom || line >= display.viewTo) { return }
-  var lineView = display.view[findViewIndex(cm, line)]
-  if (lineView.node == null) { return }
-  var arr = lineView.changes || (lineView.changes = [])
-  if (indexOf(arr, type) == -1) { arr.push(type) }
-}
-
-// Clear the view.
-function resetView(cm) {
-  cm.display.viewFrom = cm.display.viewTo = cm.doc.first
-  cm.display.view = []
-  cm.display.viewOffset = 0
-}
-
-function viewCuttingPoint(cm, oldN, newN, dir) {
-  var index = findViewIndex(cm, oldN), diff, view = cm.display.view
-  if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
-    { return {index: index, lineN: newN} }
-  var n = cm.display.viewFrom
-  for (var i = 0; i < index; i++)
-    { n += view[i].size }
-  if (n != oldN) {
-    if (dir > 0) {
-      if (index == view.length - 1) { return null }
-      diff = (n + view[index].size) - oldN
-      index++
-    } else {
-      diff = n - oldN
-    }
-    oldN += diff; newN += diff
-  }
-  while (visualLineNo(cm.doc, newN) != newN) {
-    if (index == (dir < 0 ? 0 : view.length - 1)) { return null }
-    newN += dir * view[index - (dir < 0 ? 1 : 0)].size
-    index += dir
-  }
-  return {index: index, lineN: newN}
-}
-
-// Force the view to cover a given range, adding empty view element
-// or clipping off existing ones as needed.
-function adjustView(cm, from, to) {
-  var display = cm.display, view = display.view
-  if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
-    display.view = buildViewArray(cm, from, to)
-    display.viewFrom = from
-  } else {
-    if (display.viewFrom > from)
-      { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view) }
-    else if (display.viewFrom < from)
-      { display.view = display.view.slice(findViewIndex(cm, from)) }
-    display.viewFrom = from
-    if (display.viewTo < to)
-      { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)) }
-    else if (display.viewTo > to)
-      { display.view = display.view.slice(0, findViewIndex(cm, to)) }
-  }
-  display.viewTo = to
-}
-
-// Count the number of lines in the view whose DOM representation is
-// out of date (or nonexistent).
-function countDirtyView(cm) {
-  var view = cm.display.view, dirty = 0
-  for (var i = 0; i < view.length; i++) {
-    var lineView = view[i]
-    if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty }
-  }
-  return dirty
-}
-
-// HIGHLIGHT WORKER
-
-function startWorker(cm, time) {
-  if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo)
-    { cm.state.highlight.set(time, bind(highlightWorker, cm)) }
-}
-
-function highlightWorker(cm) {
-  var doc = cm.doc
-  if (doc.frontier < doc.first) { doc.frontier = doc.first }
-  if (doc.frontier >= cm.display.viewTo) { return }
-  var end = +new Date + cm.options.workTime
-  var state = copyState(doc.mode, getStateBefore(cm, doc.frontier))
-  var changedLines = []
-
-  doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {
-    if (doc.frontier >= cm.display.viewFrom) { // Visible
-      var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength
-      var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true)
-      line.styles = highlighted.styles
-      var oldCls = line.styleClasses, newCls = highlighted.classes
-      if (newCls) { line.styleClasses = newCls }
-      else if (oldCls) { line.styleClasses = null }
-      var ischange = !oldStyles || oldStyles.length != line.styles.length ||
-        oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass)
-      for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i] }
-      if (ischange) { changedLines.push(doc.frontier) }
-      line.stateAfter = tooLong ? state : copyState(doc.mode, state)
-    } else {
-      if (line.text.length <= cm.options.maxHighlightLength)
-        { processLine(cm, line.text, state) }
-      line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null
-    }
-    ++doc.frontier
-    if (+new Date > end) {
-      startWorker(cm, cm.options.workDelay)
-      return true
-    }
-  })
-  if (changedLines.length) { runInOp(cm, function () {
-    for (var i = 0; i < changedLines.length; i++)
-      { regLineChange(cm, changedLines[i], "text") }
-  }) }
-}
-
-// DISPLAY DRAWING
-
-var DisplayUpdate = function(cm, viewport, force) {
-  var display = cm.display
-
-  this.viewport = viewport
-  // Store some values that we'll need later (but don't want to force a relayout for)
-  this.visible = visibleLines(display, cm.doc, viewport)
-  this.editorIsHidden = !display.wrapper.offsetWidth
-  this.wrapperHeight = display.wrapper.clientHeight
-  this.wrapperWidth = display.wrapper.clientWidth
-  this.oldDisplayWidth = displayWidth(cm)
-  this.force = force
-  this.dims = getDimensions(cm)
-  this.events = []
-};
-
-DisplayUpdate.prototype.signal = function (emitter, type) {
-  if (hasHandler(emitter, type))
-    { this.events.push(arguments) }
-};
-DisplayUpdate.prototype.finish = function () {
-    var this$1 = this;
-
-  for (var i = 0; i < this.events.length; i++)
-    { signal.apply(null, this$1.events[i]) }
-};
-
-function maybeClipScrollbars(cm) {
-  var display = cm.display
-  if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
-    display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth
-    display.heightForcer.style.height = scrollGap(cm) + "px"
-    display.sizer.style.marginBottom = -display.nativeBarWidth + "px"
-    display.sizer.style.borderRightWidth = scrollGap(cm) + "px"
-    display.scrollbarsClipped = true
-  }
-}
-
-// Does the actual updating of the line display. Bails out
-// (returning false) when there is nothing to be done and forced is
-// false.
-function updateDisplayIfNeeded(cm, update) {
-  var display = cm.display, doc = cm.doc
-
-  if (update.editorIsHidden) {
-    resetView(cm)
-    return false
-  }
-
-  // Bail out if the visible area is already rendered and nothing changed.
-  if (!update.force &&
-      update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
-      (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
-      display.renderedView == display.view && countDirtyView(cm) == 0)
-    { return false }
-
-  if (maybeUpdateLineNumberWidth(cm)) {
-    resetView(cm)
-    update.dims = getDimensions(cm)
-  }
-
-  // Compute a suitable new viewport (from & to)
-  var end = doc.first + doc.size
-  var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first)
-  var to = Math.min(end, update.visible.to + cm.options.viewportMargin)
-  if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom) }
-  if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo) }
-  if (sawCollapsedSpans) {
-    from = visualLineNo(cm.doc, from)
-    to = visualLineEndNo(cm.doc, to)
-  }
-
-  var different = from != display.viewFrom || to != display.viewTo ||
-    display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth
-  adjustView(cm, from, to)
-
-  display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom))
-  // Position the mover div to align with the current scroll position
-  cm.display.mover.style.top = display.viewOffset + "px"
-
-  var toUpdate = countDirtyView(cm)
-  if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
-      (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
-    { return false }
-
-  // For big changes, we hide the enclosing element during the
-  // update, since that speeds up the operations on most browsers.
-  var focused = activeElt()
-  if (toUpdate > 4) { display.lineDiv.style.display = "none" }
-  patchDisplay(cm, display.updateLineNumbers, update.dims)
-  if (toUpdate > 4) { display.lineDiv.style.display = "" }
-  display.renderedView = display.view
-  // There might have been a widget with a focused element that got
-  // hidden or updated, if so re-focus it.
-  if (focused && activeElt() != focused && focused.offsetHeight) { focused.focus() }
-
-  // Prevent selection and cursors from interfering with the scroll
-  // width and height.
-  removeChildren(display.cursorDiv)
-  removeChildren(display.selectionDiv)
-  display.gutters.style.height = display.sizer.style.minHeight = 0
-
-  if (different) {
-    display.lastWrapHeight = update.wrapperHeight
-    display.lastWrapWidth = update.wrapperWidth
-    startWorker(cm, 400)
-  }
-
-  display.updateLineNumbers = null
-
-  return true
-}
-
-function postUpdateDisplay(cm, update) {
-  var viewport = update.viewport
-
-  for (var first = true;; first = false) {
-    if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
-      // Clip forced viewport to actual scrollable area.
-      if (viewport && viewport.top != null)
-        { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)} }
-      // Updated line heights might result in the drawn area not
-      // actually covering the viewport. Keep looping until it does.
-      update.visible = visibleLines(cm.display, cm.doc, viewport)
-      if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
-        { break }
-    }
-    if (!updateDisplayIfNeeded(cm, update)) { break }
-    updateHeightsInViewport(cm)
-    var barMeasure = measureForScrollbars(cm)
-    updateSelection(cm)
-    updateScrollbars(cm, barMeasure)
-    setDocumentHeight(cm, barMeasure)
-  }
-
-  update.signal(cm, "update", cm)
-  if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
-    update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo)
-    cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo
-  }
-}
-
-function updateDisplaySimple(cm, viewport) {
-  var update = new DisplayUpdate(cm, viewport)
-  if (updateDisplayIfNeeded(cm, update)) {
-    updateHeightsInViewport(cm)
-    postUpdateDisplay(cm, update)
-    var barMeasure = measureForScrollbars(cm)
-    updateSelection(cm)
-    updateScrollbars(cm, barMeasure)
-    setDocumentHeight(cm, barMeasure)
-    update.finish()
-  }
-}
-
-// Sync the actual display DOM structure with display.view, removing
-// nodes for lines that are no longer in view, and creating the ones
-// that are not there yet, and updating the ones that are out of
-// date.
-function patchDisplay(cm, updateNumbersFrom, dims) {
-  var display = cm.display, lineNumbers = cm.options.lineNumbers
-  var container = display.lineDiv, cur = container.firstChild
-
-  function rm(node) {
-    var next = node.nextSibling
-    // Works around a throw-scroll bug in OS X Webkit
-    if (webkit && mac && cm.display.currentWheelTarget == node)
-      { node.style.display = "none" }
-    else
-      { node.parentNode.removeChild(node) }
-    return next
-  }
-
-  var view = display.view, lineN = display.viewFrom
-  // Loop over the elements in the view, syncing cur (the DOM nodes
-  // in display.lineDiv) with the view as we go.
-  for (var i = 0; i < view.length; i++) {
-    var lineView = view[i]
-    if (lineView.hidden) {
-    } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
-      var node = buildLineElement(cm, lineView, lineN, dims)
-      container.insertBefore(node, cur)
-    } else { // Already drawn
-      while (cur != lineView.node) { cur = rm(cur) }
-      var updateNumber = lineNumbers && updateNumbersFrom != null &&
-        updateNumbersFrom <= lineN && lineView.lineNumber
-      if (lineView.changes) {
-        if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false }
-        updateLineForChanges(cm, lineView, lineN, dims)
-      }
-      if (updateNumber) {
-        removeChildren(lineView.lineNumber)
-        lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)))
-      }
-      cur = lineView.node.nextSibling
-    }
-    lineN += lineView.size
-  }
-  while (cur) { cur = rm(cur) }
-}
-
-function updateGutterSpace(cm) {
-  var width = cm.display.gutters.offsetWidth
-  cm.display.sizer.style.marginLeft = width + "px"
-}
-
-function setDocumentHeight(cm, measure) {
-  cm.display.sizer.style.minHeight = measure.docHeight + "px"
-  cm.display.heightForcer.style.top = measure.docHeight + "px"
-  cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px"
-}
-
-// Rebuild the gutter elements, ensure the margin to the left of the
-// code matches their width.
-function updateGutters(cm) {
-  var gutters = cm.display.gutters, specs = cm.options.gutters
-  removeChildren(gutters)
-  var i = 0
-  for (; i < specs.length; ++i) {
-    var gutterClass = specs[i]
-    var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass))
-    if (gutterClass == "CodeMirror-linenumbers") {
-      cm.display.lineGutter = gElt
-      gElt.style.width = (cm.display.lineNumWidth || 1) + "px"
-    }
-  }
-  gutters.style.display = i ? "" : "none"
-  updateGutterSpace(cm)
-}
-
-// Make sure the gutters options contains the element
-// "CodeMirror-linenumbers" when the lineNumbers option is true.
-function setGuttersForLineNumbers(options) {
-  var found = indexOf(options.gutters, "CodeMirror-linenumbers")
-  if (found == -1 && options.lineNumbers) {
-    options.gutters = options.gutters.concat(["CodeMirror-linenumbers"])
-  } else if (found > -1 && !options.lineNumbers) {
-    options.gutters = options.gutters.slice(0)
-    options.gutters.splice(found, 1)
-  }
-}
-
-// Selection objects are immutable. A new one is created every time
-// the selection changes. A selection is one or more non-overlapping
-// (and non-touching) ranges, sorted, and an integer that indicates
-// which one is the primary selection (the one that's scrolled into
-// view, that getCursor returns, etc).
-var Selection = function(ranges, primIndex) {
-  this.ranges = ranges
-  this.primIndex = primIndex
-};
-
-Selection.prototype.primary = function () { return this.ranges[this.primIndex] };
-
-Selection.prototype.equals = function (other) {
-    var this$1 = this;
-
-  if (other == this) { return true }
-  if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
-  for (var i = 0; i < this.ranges.length; i++) {
-    var here = this$1.ranges[i], there = other.ranges[i]
-    if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
-  }
-  return true
-};
-
-Selection.prototype.deepCopy = function () {
-    var this$1 = this;
-
-  var out = []
-  for (var i = 0; i < this.ranges.length; i++)
-    { out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)) }
-  return new Selection(out, this.primIndex)
-};
-
-Selection.prototype.somethingSelected = function () {
-    var this$1 = this;
-
-  for (var i = 0; i < this.ranges.length; i++)
-    { if (!this$1.ranges[i].empty()) { return true } }
-  return false
-};
-
-Selection.prototype.contains = function (pos, end) {
-    var this$1 = this;
-
-  if (!end) { end = pos }
-  for (var i = 0; i < this.ranges.length; i++) {
-    var range = this$1.ranges[i]
-    if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
-      { return i }
-  }
-  return -1
-};
-
-var Range = function(anchor, head) {
-  this.anchor = anchor; this.head = head
-};
-
-Range.prototype.from = function () { return minPos(this.anchor, this.head) };
-Range.prototype.to = function () { return maxPos(this.anchor, this.head) };
-Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };
-
-// Take an unsorted, potentially overlapping set of ranges, and
-// build a selection out of it. 'Consumes' ranges array (modifying
-// it).
-function normalizeSelection(ranges, primIndex) {
-  var prim = ranges[primIndex]
-  ranges.sort(function (a, b) { return cmp(a.from(), b.from()); })
-  primIndex = indexOf(ranges, prim)
-  for (var i = 1; i < ranges.length; i++) {
-    var cur = ranges[i], prev = ranges[i - 1]
-    if (cmp(prev.to(), cur.from()) >= 0) {
-      var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to())
-      var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head
-      if (i <= primIndex) { --primIndex }
-      ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to))
-    }
-  }
-  return new Selection(ranges, primIndex)
-}
-
-function simpleSelection(anchor, head) {
-  return new Selection([new Range(anchor, head || anchor)], 0)
-}
-
-// Compute the position of the end of a change (its 'to' property
-// refers to the pre-change end).
-function changeEnd(change) {
-  if (!change.text) { return change.to }
-  return Pos(change.from.line + change.text.length - 1,
-             lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
-}
-
-// Adjust a position to refer to the post-change position of the
-// same text, or the end of the change if the change covers it.
-function adjustForChange(pos, change) {
-  if (cmp(pos, change.from) < 0) { return pos }
-  if (cmp(pos, change.to) <= 0) { return changeEnd(change) }
-
-  var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch
-  if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch }
-  return Pos(line, ch)
-}
-
-function computeSelAfterChange(doc, change) {
-  var out = []
-  for (var i = 0; i < doc.sel.ranges.length; i++) {
-    var range = doc.sel.ranges[i]
-    out.push(new Range(adjustForChange(range.anchor, change),
-                       adjustForChange(range.head, change)))
-  }
-  return normalizeSelection(out, doc.sel.primIndex)
-}
-
-function offsetPos(pos, old, nw) {
-  if (pos.line == old.line)
-    { return Pos(nw.line, pos.ch - old.ch + nw.ch) }
-  else
-    { return Pos(nw.line + (pos.line - old.line), pos.ch) }
-}
-
-// Used by replaceSelections to allow moving the selection to the
-// start or around the replaced test. Hint may be "start" or "around".
-function computeReplacedSel(doc, changes, hint) {
-  var out = []
-  var oldPrev = Pos(doc.first, 0), newPrev = oldPrev
-  for (var i = 0; i < changes.length; i++) {
-    var change = changes[i]
-    var from = offsetPos(change.from, oldPrev, newPrev)
-    var to = offsetPos(changeEnd(change), oldPrev, newPrev)
-    oldPrev = change.to
-    newPrev = to
-    if (hint == "around") {
-      var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0
-      out[i] = new Range(inv ? to : from, inv ? from : to)
-    } else {
-      out[i] = new Range(from, from)
-    }
-  }
-  return new Selection(out, doc.sel.primIndex)
-}
-
-// Used to get the editor into a consistent state again when options change.
-
-function loadMode(cm) {
-  cm.doc.mode = getMode(cm.options, cm.doc.modeOption)
-  resetModeState(cm)
-}
-
-function resetModeState(cm) {
-  cm.doc.iter(function (line) {
-    if (line.stateAfter) { line.stateAfter = null }
-    if (line.styles) { line.styles = null }
-  })
-  cm.doc.frontier = cm.doc.first
-  startWorker(cm, 100)
-  cm.state.modeGen++
-  if (cm.curOp) { regChange(cm) }
-}
-
-// DOCUMENT DATA STRUCTURE
-
-// By default, updates that start and end at the beginning of a line
-// are treated specially, in order to make the association of line
-// widgets and marker elements with the text behave more intuitive.
-function isWholeLineUpdate(doc, change) {
-  return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
-    (!doc.cm || doc.cm.options.wholeLineUpdateBefore)
-}
-
-// Perform a change on the document data structure.
-function updateDoc(doc, change, markedSpans, estimateHeight) {
-  function spansFor(n) {return markedSpans ? markedSpans[n] : null}
-  function update(line, text, spans) {
-    updateLine(line, text, spans, estimateHeight)
-    signalLater(line, "change", line, change)
-  }
-  function linesFor(start, end) {
-    var result = []
-    for (var i = start; i < end; ++i)
-      { result.push(new Line(text[i], spansFor(i), estimateHeight)) }
-    return result
-  }
-
-  var from = change.from, to = change.to, text = change.text
-  var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line)
-  var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line
-
-  // Adjust the line structure
-  if (change.full) {
-    doc.insert(0, linesFor(0, text.length))
-    doc.remove(text.length, doc.size - text.length)
-  } else if (isWholeLineUpdate(doc, change)) {
-    // This is a whole-line replace. Treated specially to make
-    // sure line objects move the way they are supposed to.
-    var added = linesFor(0, text.length - 1)
-    update(lastLine, lastLine.text, lastSpans)
-    if (nlines) { doc.remove(from.line, nlines) }
-    if (added.length) { doc.insert(from.line, added) }
-  } else if (firstLine == lastLine) {
-    if (text.length == 1) {
-      update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans)
-    } else {
-      var added$1 = linesFor(1, text.length - 1)
-      added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight))
-      update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))
-      doc.insert(from.line + 1, added$1)
-    }
-  } else if (text.length == 1) {
-    update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0))
-    doc.remove(from.line + 1, nlines)
-  } else {
-    update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))
-    update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans)
-    var added$2 = linesFor(1, text.length - 1)
-    if (nlines > 1) { doc.remove(from.line + 1, nlines - 1) }
-    doc.insert(from.line + 1, added$2)
-  }
-
-  signalLater(doc, "change", doc, change)
-}
-
-// Call f for all linked documents.
-function linkedDocs(doc, f, sharedHistOnly) {
-  function propagate(doc, skip, sharedHist) {
-    if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {
-      var rel = doc.linked[i]
-      if (rel.doc == skip) { continue }
-      var shared = sharedHist && rel.sharedHist
-      if (sharedHistOnly && !shared) { continue }
-      f(rel.doc, shared)
-      propagate(rel.doc, doc, shared)
-    } }
-  }
-  propagate(doc, null, true)
-}
-
-// Attach a document to an editor.
-function attachDoc(cm, doc) {
-  if (doc.cm) { throw new Error("This document is already in use.") }
-  cm.doc = doc
-  doc.cm = cm
-  estimateLineHeights(cm)
-  loadMode(cm)
-  setDirectionClass(cm)
-  if (!cm.options.lineWrapping) { findMaxLine(cm) }
-  cm.options.mode = doc.modeOption
-  regChange(cm)
-}
-
-function setDirectionClass(cm) {
-  ;(cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl")
-}
-
-function directionChanged(cm) {
-  runInOp(cm, function () {
-    setDirectionClass(cm)
-    regChange(cm)
-  })
-}
-
-function History(startGen) {
-  // Arrays of change events and selections. Doing something adds an
-  // event to done and clears undo. Undoing moves events from done
-  // to undone, redoing moves them in the other direction.
-  this.done = []; this.undone = []
-  this.undoDepth = Infinity
-  // Used to track when changes can be merged into a single undo
-  // event
-  this.lastModTime = this.lastSelTime = 0
-  this.lastOp = this.lastSelOp = null
-  this.lastOrigin = this.lastSelOrigin = null
-  // Used by the isClean() method
-  this.generation = this.maxGeneration = startGen || 1
-}
-
-// Create a history change event from an updateDoc-style change
-// object.
-function historyChangeFromChange(doc, change) {
-  var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}
-  attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1)
-  linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true)
-  return histChange
-}
-
-// Pop all selection events off the end of a history array. Stop at
-// a change event.
-function clearSelectionEvents(array) {
-  while (array.length) {
-    var last = lst(array)
-    if (last.ranges) { array.pop() }
-    else { break }
-  }
-}
-
-// Find the top change event in the history. Pop off selection
-// events that are in the way.
-function lastChangeEvent(hist, force) {
-  if (force) {
-    clearSelectionEvents(hist.done)
-    return lst(hist.done)
-  } else if (hist.done.length && !lst(hist.done).ranges) {
-    return lst(hist.done)
-  } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
-    hist.done.pop()
-    return lst(hist.done)
-  }
-}
-
-// Register a change in the history. Merges changes that are within
-// a single operation, or are close together with an origin that
-// allows merging (starting with "+") into a single event.
-function addChangeToHistory(doc, change, selAfter, opId) {
-  var hist = doc.history
-  hist.undone.length = 0
-  var time = +new Date, cur
-  var last
-
-  if ((hist.lastOp == opId ||
-       hist.lastOrigin == change.origin && change.origin &&
-       ((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||
-        change.origin.charAt(0) == "*")) &&
-      (cur = lastChangeEvent(hist, hist.lastOp == opId))) {
-    // Merge this change into the last event
-    last = lst(cur.changes)
-    if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
-      // Optimized case for simple insertion -- don't want to add
-      // new changesets for every character typed
-      last.to = changeEnd(change)
-    } else {
-      // Add new sub-event
-      cur.changes.push(historyChangeFromChange(doc, change))
-    }
-  } else {
-    // Can not be merged, start a new event.
-    var before = lst(hist.done)
-    if (!before || !before.ranges)
-      { pushSelectionToHistory(doc.sel, hist.done) }
-    cur = {changes: [historyChangeFromChange(doc, change)],
-           generation: hist.generation}
-    hist.done.push(cur)
-    while (hist.done.length > hist.undoDepth) {
-      hist.done.shift()
-      if (!hist.done[0].ranges) { hist.done.shift() }
-    }
-  }
-  hist.done.push(selAfter)
-  hist.generation = ++hist.maxGeneration
-  hist.lastModTime = hist.lastSelTime = time
-  hist.lastOp = hist.lastSelOp = opId
-  hist.lastOrigin = hist.lastSelOrigin = change.origin
-
-  if (!last) { signal(doc, "historyAdded") }
-}
-
-function selectionEventCanBeMerged(doc, origin, prev, sel) {
-  var ch = origin.charAt(0)
-  return ch == "*" ||
-    ch == "+" &&
-    prev.ranges.length == sel.ranges.length &&
-    prev.somethingSelected() == sel.somethingSelected() &&
-    new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
-}
-
-// Called whenever the selection changes, sets the new selection as
-// the pending selection in the history, and pushes the old pending
-// selection into the 'done' array when it was significantly
-// different (in number of selected ranges, emptiness, or time).
-function addSelectionToHistory(doc, sel, opId, options) {
-  var hist = doc.history, origin = options && options.origin
-
-  // A new event is started when the previous origin does not match
-  // the current, or the origins don't allow matching. Origins
-  // starting with * are always merged, those starting with + are
-  // merged when similar and close together in time.
-  if (opId == hist.lastSelOp ||
-      (origin && hist.lastSelOrigin == origin &&
-       (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
-        selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
-    { hist.done[hist.done.length - 1] = sel }
-  else
-    { pushSelectionToHistory(sel, hist.done) }
-
-  hist.lastSelTime = +new Date
-  hist.lastSelOrigin = origin
-  hist.lastSelOp = opId
-  if (options && options.clearRedo !== false)
-    { clearSelectionEvents(hist.undone) }
-}
-
-function pushSelectionToHistory(sel, dest) {
-  var top = lst(dest)
-  if (!(top && top.ranges && top.equals(sel)))
-    { dest.push(sel) }
-}
-
-// Used to store marked span information in the history.
-function attachLocalSpans(doc, change, from, to) {
-  var existing = change["spans_" + doc.id], n = 0
-  doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {
-    if (line.markedSpans)
-      { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans }
-    ++n
-  })
-}
-
-// When un/re-doing restores text containing marked spans, those
-// that have been explicitly cleared should not be restored.
-function removeClearedSpans(spans) {
-  if (!spans) { return null }
-  var out
-  for (var i = 0; i < spans.length; ++i) {
-    if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i) } }
-    else if (out) { out.push(spans[i]) }
-  }
-  return !out ? spans : out.length ? out : null
-}
-
-// Retrieve and filter the old marked spans stored in a change event.
-function getOldSpans(doc, change) {
-  var found = change["spans_" + doc.id]
-  if (!found) { return null }
-  var nw = []
-  for (var i = 0; i < change.text.length; ++i)
-    { nw.push(removeClearedSpans(found[i])) }
-  return nw
-}
-
-// Used for un/re-doing changes from the history. Combines the
-// result of computing the existing spans with the set of spans that
-// existed in the history (so that deleting around a span and then
-// undoing brings back the span).
-function mergeOldSpans(doc, change) {
-  var old = getOldSpans(doc, change)
-  var stretched = stretchSpansOverChange(doc, change)
-  if (!old) { return stretched }
-  if (!stretched) { return old }
-
-  for (var i = 0; i < old.length; ++i) {
-    var oldCur = old[i], stretchCur = stretched[i]
-    if (oldCur && stretchCur) {
-      spans: for (var j = 0; j < stretchCur.length; ++j) {
-        var span = stretchCur[j]
-        for (var k = 0; k < oldCur.length; ++k)
-          { if (oldCur[k].marker == span.marker) { continue spans } }
-        oldCur.push(span)
-      }
-    } else if (stretchCur) {
-      old[i] = stretchCur
-    }
-  }
-  return old
-}
-
-// Used both to provide a JSON-safe object in .getHistory, and, when
-// detaching a document, to split the history in two
-function copyHistoryArray(events, newGroup, instantiateSel) {
-  var copy = []
-  for (var i = 0; i < events.length; ++i) {
-    var event = events[i]
-    if (event.ranges) {
-      copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event)
-      continue
-    }
-    var changes = event.changes, newChanges = []
-    copy.push({changes: newChanges})
-    for (var j = 0; j < changes.length; ++j) {
-      var change = changes[j], m = (void 0)
-      newChanges.push({from: change.from, to: change.to, text: change.text})
-      if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
-        if (indexOf(newGroup, Number(m[1])) > -1) {
-          lst(newChanges)[prop] = change[prop]
-          delete change[prop]
-        }
-      } } }
-    }
-  }
-  return copy
-}
-
-// The 'scroll' parameter given to many of these indicated whether
-// the new cursor position should be scrolled into view after
-// modifying the selection.
-
-// If shift is held or the extend flag is set, extends a range to
-// include a given position (and optionally a second position).
-// Otherwise, simply returns the range between the given positions.
-// Used for cursor motion and such.
-function extendRange(doc, range, head, other) {
-  if (doc.cm && doc.cm.display.shift || doc.extend) {
-    var anchor = range.anchor
-    if (other) {
-      var posBefore = cmp(head, anchor) < 0
-      if (posBefore != (cmp(other, anchor) < 0)) {
-        anchor = head
-        head = other
-      } else if (posBefore != (cmp(head, other) < 0)) {
-        head = other
-      }
-    }
-    return new Range(anchor, head)
-  } else {
-    return new Range(other || head, head)
-  }
-}
-
-// Extend the primary selection range, discard the rest.
-function extendSelection(doc, head, other, options) {
-  setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options)
-}
-
-// Extend all selections (pos is an array of selections with length
-// equal the number of selections)
-function extendSelections(doc, heads, options) {
-  var out = []
-  for (var i = 0; i < doc.sel.ranges.length; i++)
-    { out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null) }
-  var newSel = normalizeSelection(out, doc.sel.primIndex)
-  setSelection(doc, newSel, options)
-}
-
-// Updates a single range in the selection.
-function replaceOneSelection(doc, i, range, options) {
-  var ranges = doc.sel.ranges.slice(0)
-  ranges[i] = range
-  setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options)
-}
-
-// Reset the selection to a single range.
-function setSimpleSelection(doc, anchor, head, options) {
-  setSelection(doc, simpleSelection(anchor, head), options)
-}
-
-// Give beforeSelectionChange handlers a change to influence a
-// selection update.
-function filterSelectionChange(doc, sel, options) {
-  var obj = {
-    ranges: sel.ranges,
-    update: function(ranges) {
-      var this$1 = this;
-
-      this.ranges = []
-      for (var i = 0; i < ranges.length; i++)
-        { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
-                                   clipPos(doc, ranges[i].head)) }
-    },
-    origin: options && options.origin
-  }
-  signal(doc, "beforeSelectionChange", doc, obj)
-  if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj) }
-  if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }
-  else { return sel }
-}
-
-function setSelectionReplaceHistory(doc, sel, options) {
-  var done = doc.history.done, last = lst(done)
-  if (last && last.ranges) {
-    done[done.length - 1] = sel
-    setSelectionNoUndo(doc, sel, options)
-  } else {
-    setSelection(doc, sel, options)
-  }
-}
-
-// Set a new selection.
-function setSelection(doc, sel, options) {
-  setSelectionNoUndo(doc, sel, options)
-  addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options)
-}
-
-function setSelectionNoUndo(doc, sel, options) {
-  if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
-    { sel = filterSelectionChange(doc, sel, options) }
-
-  var bias = options && options.bias ||
-    (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1)
-  setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true))
-
-  if (!(options && options.scroll === false) && doc.cm)
-    { ensureCursorVisible(doc.cm) }
-}
-
-function setSelectionInner(doc, sel) {
-  if (sel.equals(doc.sel)) { return }
-
-  doc.sel = sel
-
-  if (doc.cm) {
-    doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true
-    signalCursorActivity(doc.cm)
-  }
-  signalLater(doc, "cursorActivity", doc)
-}
-
-// Verify that the selection does not partially select any atomic
-// marked ranges.
-function reCheckSelection(doc) {
-  setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll)
-}
-
-// Return a selection that does not partially select any atomic
-// ranges.
-function skipAtomicInSelection(doc, sel, bias, mayClear) {
-  var out
-  for (var i = 0; i < sel.ranges.length; i++) {
-    var range = sel.ranges[i]
-    var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]
-    var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear)
-    var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear)
-    if (out || newAnchor != range.anchor || newHead != range.head) {
-      if (!out) { out = sel.ranges.slice(0, i) }
-      out[i] = new Range(newAnchor, newHead)
-    }
-  }
-  return out ? normalizeSelection(out, sel.primIndex) : sel
-}
-
-function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
-  var line = getLine(doc, pos.line)
-  if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
-    var sp = line.markedSpans[i], m = sp.marker
-    if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
-        (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
-      if (mayClear) {
-        signal(m, "beforeCursorEnter")
-        if (m.explicitlyCleared) {
-          if (!line.markedSpans) { break }
-          else {--i; continue}
-        }
-      }
-      if (!m.atomic) { continue }
-
-      if (oldPos) {
-        var near = m.find(dir < 0 ? 1 : -1), diff = (void 0)
-        if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)
-          { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null) }
-        if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
-          { return skipAtomicInner(doc, near, pos, dir, mayClear) }
-      }
-
-      var far = m.find(dir < 0 ? -1 : 1)
-      if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)
-        { far = movePos(doc, far, dir, far.line == pos.line ? line : null) }
-      return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
-    }
-  } }
-  return pos
-}
-
-// Ensure a given position is not inside an atomic range.
-function skipAtomic(doc, pos, oldPos, bias, mayClear) {
-  var dir = bias || 1
-  var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
-      (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
-      skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
-      (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true))
-  if (!found) {
-    doc.cantEdit = true
-    return Pos(doc.first, 0)
-  }
-  return found
-}
-
-function movePos(doc, pos, dir, line) {
-  if (dir < 0 && pos.ch == 0) {
-    if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }
-    else { return null }
-  } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
-    if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }
-    else { return null }
-  } else {
-    return new Pos(pos.line, pos.ch + dir)
-  }
-}
-
-function selectAll(cm) {
-  cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll)
-}
-
-// UPDATING
-
-// Allow "beforeChange" event handlers to influence a change
-function filterChange(doc, change, update) {
-  var obj = {
-    canceled: false,
-    from: change.from,
-    to: change.to,
-    text: change.text,
-    origin: change.origin,
-    cancel: function () { return obj.canceled = true; }
-  }
-  if (update) { obj.update = function (from, to, text, origin) {
-    if (from) { obj.from = clipPos(doc, from) }
-    if (to) { obj.to = clipPos(doc, to) }
-    if (text) { obj.text = text }
-    if (origin !== undefined) { obj.origin = origin }
-  } }
-  signal(doc, "beforeChange", doc, obj)
-  if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj) }
-
-  if (obj.canceled) { return null }
-  return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
-}
-
-// Apply a change to a document, and add it to the document's
-// history, and propagating it to all linked documents.
-function makeChange(doc, change, ignoreReadOnly) {
-  if (doc.cm) {
-    if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }
-    if (doc.cm.state.suppressEdits) { return }
-  }
-
-  if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
-    change = filterChange(doc, change, true)
-    if (!change) { return }
-  }
-
-  // Possibly split or suppress the update based on the presence
-  // of read-only spans in its range.
-  var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to)
-  if (split) {
-    for (var i = split.length - 1; i >= 0; --i)
-      { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}) }
-  } else {
-    makeChangeInner(doc, change)
-  }
-}
-
-function makeChangeInner(doc, change) {
-  if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return }
-  var selAfter = computeSelAfterChange(doc, change)
-  addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN)
-
-  makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change))
-  var rebased = []
-
-  linkedDocs(doc, function (doc, sharedHist) {
-    if (!sharedHist && indexOf(rebased, doc.history) == -1) {
-      rebaseHist(doc.history, change)
-      rebased.push(doc.history)
-    }
-    makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change))
-  })
-}
-
-// Revert a change stored in a document's history.
-function makeChangeFromHistory(doc, type, allowSelectionOnly) {
-  if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) { return }
-
-  var hist = doc.history, event, selAfter = doc.sel
-  var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done
-
-  // Verify that there is a useable event (so that ctrl-z won't
-  // needlessly clear selection events)
-  var i = 0
-  for (; i < source.length; i++) {
-    event = source[i]
-    if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
-      { break }
-  }
-  if (i == source.length) { return }
-  hist.lastOrigin = hist.lastSelOrigin = null
-
-  for (;;) {
-    event = source.pop()
-    if (event.ranges) {
-      pushSelectionToHistory(event, dest)
-      if (allowSelectionOnly && !event.equals(doc.sel)) {
-        setSelection(doc, event, {clearRedo: false})
-        return
-      }
-      selAfter = event
-    }
-    else { break }
-  }
-
-  // Build up a reverse change object to add to the opposite history
-  // stack (redo when undoing, and vice versa).
-  var antiChanges = []
-  pushSelectionToHistory(selAfter, dest)
-  dest.push({changes: antiChanges, generation: hist.generation})
-  hist.generation = event.generation || ++hist.maxGeneration
-
-  var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")
-
-  var loop = function ( i ) {
-    var change = event.changes[i]
-    change.origin = type
-    if (filter && !filterChange(doc, change, false)) {
-      source.length = 0
-      return {}
-    }
-
-    antiChanges.push(historyChangeFromChange(doc, change))
-
-    var after = i ? computeSelAfterChange(doc, change) : lst(source)
-    makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change))
-    if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}) }
-    var rebased = []
-
-    // Propagate to the linked documents
-    linkedDocs(doc, function (doc, sharedHist) {
-      if (!sharedHist && indexOf(rebased, doc.history) == -1) {
-        rebaseHist(doc.history, change)
-        rebased.push(doc.history)
-      }
-      makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change))
-    })
-  };
-
-  for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {
-    var returned = loop( i$1 );
-
-    if ( returned ) return returned.v;
-  }
-}
-
-// Sub-views need their line numbers shifted when text is added
-// above or below them in the parent document.
-function shiftDoc(doc, distance) {
-  if (distance == 0) { return }
-  doc.first += distance
-  doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
-    Pos(range.anchor.line + distance, range.anchor.ch),
-    Pos(range.head.line + distance, range.head.ch)
-  ); }), doc.sel.primIndex)
-  if (doc.cm) {
-    regChange(doc.cm, doc.first, doc.first - distance, distance)
-    for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
-      { regLineChange(doc.cm, l, "gutter") }
-  }
-}
-
-// More lower-level change function, handling only a single document
-// (not linked ones).
-function makeChangeSingleDoc(doc, change, selAfter, spans) {
-  if (doc.cm && !doc.cm.curOp)
-    { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }
-
-  if (change.to.line < doc.first) {
-    shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line))
-    return
-  }
-  if (change.from.line > doc.lastLine()) { return }
-
-  // Clip the change to the size of this doc
-  if (change.from.line < doc.first) {
-    var shift = change.text.length - 1 - (doc.first - change.from.line)
-    shiftDoc(doc, shift)
-    change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
-              text: [lst(change.text)], origin: change.origin}
-  }
-  var last = doc.lastLine()
-  if (change.to.line > last) {
-    change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
-              text: [change.text[0]], origin: change.origin}
-  }
-
-  change.removed = getBetween(doc, change.from, change.to)
-
-  if (!selAfter) { selAfter = computeSelAfterChange(doc, change) }
-  if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans) }
-  else { updateDoc(doc, change, spans) }
-  setSelectionNoUndo(doc, selAfter, sel_dontScroll)
-}
-
-// Handle the interaction of a change to a document with the editor
-// that this document is part of.
-function makeChangeSingleDocInEditor(cm, change, spans) {
-  var doc = cm.doc, display = cm.display, from = change.from, to = change.to
-
-  var recomputeMaxLength = false, checkWidthStart = from.line
-  if (!cm.options.lineWrapping) {
-    checkWidthStart = lineNo(visualLine(getLine(doc, from.line)))
-    doc.iter(checkWidthStart, to.line + 1, function (line) {
-      if (line == display.maxLine) {
-        recomputeMaxLength = true
-        return true
-      }
-    })
-  }
-
-  if (doc.sel.contains(change.from, change.to) > -1)
-    { signalCursorActivity(cm) }
-
-  updateDoc(doc, change, spans, estimateHeight(cm))
-
-  if (!cm.options.lineWrapping) {
-    doc.iter(checkWidthStart, from.line + change.text.length, function (line) {
-      var len = lineLength(line)
-      if (len > display.maxLineLength) {
-        display.maxLine = line
-        display.maxLineLength = len
-        display.maxLineChanged = true
-        recomputeMaxLength = false
-      }
-    })
-    if (recomputeMaxLength) { cm.curOp.updateMaxLine = true }
-  }
-
-  // Adjust frontier, schedule worker
-  doc.frontier = Math.min(doc.frontier, from.line)
-  startWorker(cm, 400)
-
-  var lendiff = change.text.length - (to.line - from.line) - 1
-  // Remember that these lines changed, for updating the display
-  if (change.full)
-    { regChange(cm) }
-  else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
-    { regLineChange(cm, from.line, "text") }
-  else
-    { regChange(cm, from.line, to.line + 1, lendiff) }
-
-  var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change")
-  if (changeHandler || changesHandler) {
-    var obj = {
-      from: from, to: to,
-      text: change.text,
-      removed: change.removed,
-      origin: change.origin
-    }
-    if (changeHandler) { signalLater(cm, "change", cm, obj) }
-    if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj) }
-  }
-  cm.display.selForContextMenu = null
-}
-
-function replaceRange(doc, code, from, to, origin) {
-  if (!to) { to = from }
-  if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp }
-  if (typeof code == "string") { code = doc.splitLines(code) }
-  makeChange(doc, {from: from, to: to, text: code, origin: origin})
-}
-
-// Rebasing/resetting history to deal with externally-sourced changes
-
-function rebaseHistSelSingle(pos, from, to, diff) {
-  if (to < pos.line) {
-    pos.line += diff
-  } else if (from < pos.line) {
-    pos.line = from
-    pos.ch = 0
-  }
-}
-
-// Tries to rebase an array of history events given a change in the
-// document. If the change touches the same lines as the event, the
-// event, and everything 'behind' it, is discarded. If the change is
-// before the event, the event's positions are updated. Uses a
-// copy-on-write scheme for the positions, to avoid having to
-// reallocate them all on every rebase, but also avoid problems with
-// shared position objects being unsafely updated.
-function rebaseHistArray(array, from, to, diff) {
-  for (var i = 0; i < array.length; ++i) {
-    var sub = array[i], ok = true
-    if (sub.ranges) {
-      if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true }
-      for (var j = 0; j < sub.ranges.length; j++) {
-        rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff)
-        rebaseHistSelSingle(sub.ranges[j].head, from, to, diff)
-      }
-      continue
-    }
-    for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {
-      var cur = sub.changes[j$1]
-      if (to < cur.from.line) {
-        cur.from = Pos(cur.from.line + diff, cur.from.ch)
-        cur.to = Pos(cur.to.line + diff, cur.to.ch)
-      } else if (from <= cur.to.line) {
-        ok = false
-        break
-      }
-    }
-    if (!ok) {
-      array.splice(0, i + 1)
-      i = 0
-    }
-  }
-}
-
-function rebaseHist(hist, change) {
-  var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1
-  rebaseHistArray(hist.done, from, to, diff)
-  rebaseHistArray(hist.undone, from, to, diff)
-}
-
-// Utility for applying a change to a line by handle or number,
-// returning the number and optionally registering the line as
-// changed.
-function changeLine(doc, handle, changeType, op) {
-  var no = handle, line = handle
-  if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)) }
-  else { no = lineNo(handle) }
-  if (no == null) { return null }
-  if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType) }
-  return line
-}
-
-// The document is represented as a BTree consisting of leaves, with
-// chunk of lines in them, and branches, with up to ten leaves or
-// other branch nodes below them. The top node is always a branch
-// node, and is the document object itself (meaning it has
-// additional methods and properties).
-//
-// All nodes have parent links. The tree is used both to go from
-// line numbers to line objects, and to go from objects to numbers.
-// It also indexes by height, and is used to convert between height
-// and line object, and to find the total height of the document.
-//
-// See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
-
-var LeafChunk = function(lines) {
-  var this$1 = this;
-
-  this.lines = lines
-  this.parent = null
-  var height = 0
-  for (var i = 0; i < lines.length; ++i) {
-    lines[i].parent = this$1
-    height += lines[i].height
-  }
-  this.height = height
-};
-
-LeafChunk.prototype.chunkSize = function () { return this.lines.length };
-
-// Remove the n lines at offset 'at'.
-LeafChunk.prototype.removeInner = function (at, n) {
-    var this$1 = this;
-
-  for (var i = at, e = at + n; i < e; ++i) {
-    var line = this$1.lines[i]
-    this$1.height -= line.height
-    cleanUpLine(line)
-    signalLater(line, "delete")
-  }
-  this.lines.splice(at, n)
-};
-
-// Helper used to collapse a small branch into a single leaf.
-LeafChunk.prototype.collapse = function (lines) {
-  lines.push.apply(lines, this.lines)
-};
-
-// Insert the given array of lines at offset 'at', count them as
-// having the given height.
-LeafChunk.prototype.insertInner = function (at, lines, height) {
-    var this$1 = this;
-
-  this.height += height
-  this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at))
-  for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1 }
-};
-
-// Used to iterate over a part of the tree.
-LeafChunk.prototype.iterN = function (at, n, op) {
-    var this$1 = this;
-
-  for (var e = at + n; at < e; ++at)
-    { if (op(this$1.lines[at])) { return true } }
-};
-
-var BranchChunk = function(children) {
-  var this$1 = this;
-
-  this.children = children
-  var size = 0, height = 0
-  for (var i = 0; i < children.length; ++i) {
-    var ch = children[i]
-    size += ch.chunkSize(); height += ch.height
-    ch.parent = this$1
-  }
-  this.size = size
-  this.height = height
-  this.parent = null
-};
-
-BranchChunk.prototype.chunkSize = function () { return this.size };
-
-BranchChunk.prototype.removeInner = function (at, n) {
-    var this$1 = this;
-
-  this.size -= n
-  for (var i = 0; i < this.children.length; ++i) {
-    var child = this$1.children[i], sz = child.chunkSize()
-    if (at < sz) {
-      var rm = Math.min(n, sz - at), oldHeight = child.height
-      child.removeInner(at, rm)
-      this$1.height -= oldHeight - child.height
-      if (sz == rm) { this$1.children.splice(i--, 1); child.parent = null }
-      if ((n -= rm) == 0) { break }
-      at = 0
-    } else { at -= sz }
-  }
-  // If the result is smaller than 25 lines, ensure that it is a
-  // single leaf node.
-  if (this.size - n < 25 &&
-      (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
-    var lines = []
-    this.collapse(lines)
-    this.children = [new LeafChunk(lines)]
-    this.children[0].parent = this
-  }
-};
-
-BranchChunk.prototype.collapse = function (lines) {
-    var this$1 = this;
-
-  for (var i = 0; i < this.children.length; ++i) { this$1.children[i].collapse(lines) }
-};
-
-BranchChunk.prototype.insertInner = function (at, lines, height) {
-    var this$1 = this;
-
-  this.size += lines.length
-  this.height += height
-  for (var i = 0; i < this.children.length; ++i) {
-    var child = this$1.children[i], sz = child.chunkSize()
-    if (at <= sz) {
-      child.insertInner(at, lines, height)
-      if (child.lines && child.lines.length > 50) {
-        // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.
-        // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.
-        var remaining = child.lines.length % 25 + 25
-        for (var pos = remaining; pos < child.lines.length;) {
-          var leaf = new LeafChunk(child.lines.slice(pos, pos += 25))
-          child.height -= leaf.height
-          this$1.children.splice(++i, 0, leaf)
-          leaf.parent = this$1
-        }
-        child.lines = child.lines.slice(0, remaining)
-        this$1.maybeSpill()
-      }
-      break
-    }
-    at -= sz
-  }
-};
-
-// When a node has grown, check whether it should be split.
-BranchChunk.prototype.maybeSpill = function () {
-  if (this.children.length <= 10) { return }
-  var me = this
-  do {
-    var spilled = me.children.splice(me.children.length - 5, 5)
-    var sibling = new BranchChunk(spilled)
-    if (!me.parent) { // Become the parent node
-      var copy = new BranchChunk(me.children)
-      copy.parent = me
-      me.children = [copy, sibling]
-      me = copy
-   } else {
-      me.size -= sibling.size
-      me.height -= sibling.height
-      var myIndex = indexOf(me.parent.children, me)
-      me.parent.children.splice(myIndex + 1, 0, sibling)
-    }
-    sibling.parent = me.parent
-  } while (me.children.length > 10)
-  me.parent.maybeSpill()
-};
-
-BranchChunk.prototype.iterN = function (at, n, op) {
-    var this$1 = this;
-
-  for (var i = 0; i < this.children.length; ++i) {
-    var child = this$1.children[i], sz = child.chunkSize()
-    if (at < sz) {
-      var used = Math.min(n, sz - at)
-      if (child.iterN(at, used, op)) { return true }
-      if ((n -= used) == 0) { break }
-      at = 0
-    } else { at -= sz }
-  }
-};
-
-// Line widgets are block elements displayed above or below a line.
-
-var LineWidget = function(doc, node, options) {
-  var this$1 = this;
-
-  if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
-    { this$1[opt] = options[opt] } } }
-  this.doc = doc
-  this.node = node
-};
-
-LineWidget.prototype.clear = function () {
-    var this$1 = this;
-
-  var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line)
-  if (no == null || !ws) { return }
-  for (var i = 0; i < ws.length; ++i) { if (ws[i] == this$1) { ws.splice(i--, 1) } }
-  if (!ws.length) { line.widgets = null }
-  var height = widgetHeight(this)
-  updateLineHeight(line, Math.max(0, line.height - height))
-  if (cm) {
-    runInOp(cm, function () {
-      adjustScrollWhenAboveVisible(cm, line, -height)
-      regLineChange(cm, no, "widget")
-    })
-    signalLater(cm, "lineWidgetCleared", cm, this, no)
-  }
-};
-
-LineWidget.prototype.changed = function () {
-    var this$1 = this;
-
-  var oldH = this.height, cm = this.doc.cm, line = this.line
-  this.height = null
-  var diff = widgetHeight(this) - oldH
-  if (!diff) { return }
-  updateLineHeight(line, line.height + diff)
-  if (cm) {
-    runInOp(cm, function () {
-      cm.curOp.forceUpdate = true
-      adjustScrollWhenAboveVisible(cm, line, diff)
-      signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line))
-    })
-  }
-};
-eventMixin(LineWidget)
-
-function adjustScrollWhenAboveVisible(cm, line, diff) {
-  if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
-    { addToScrollPos(cm, null, diff) }
-}
-
-function addLineWidget(doc, handle, node, options) {
-  var widget = new LineWidget(doc, node, options)
-  var cm = doc.cm
-  if (cm && widget.noHScroll) { cm.display.alignWidgets = true }
-  changeLine(doc, handle, "widget", function (line) {
-    var widgets = line.widgets || (line.widgets = [])
-    if (widget.insertAt == null) { widgets.push(widget) }
-    else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget) }
-    widget.line = line
-    if (cm && !lineIsHidden(doc, line)) {
-      var aboveVisible = heightAtLine(line) < doc.scrollTop
-      updateLineHeight(line, line.height + widgetHeight(widget))
-      if (aboveVisible) { addToScrollPos(cm, null, widget.height) }
-      cm.curOp.forceUpdate = true
-    }
-    return true
-  })
-  signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle))
-  return widget
-}
-
-// TEXTMARKERS
-
-// Created with markText and setBookmark methods. A TextMarker is a
-// handle that can be used to clear or find a marked position in the
-// document. Line objects hold arrays (markedSpans) containing
-// {from, to, marker} object pointing to such marker objects, and
-// indicating that such a marker is present on that line. Multiple
-// lines may point to the same marker when it spans across lines.
-// The spans will have null for their from/to properties when the
-// marker continues beyond the start/end of the line. Markers have
-// links back to the lines they currently touch.
-
-// Collapsed markers have unique ids, in order to be able to order
-// them, which is needed for uniquely determining an outer marker
-// when they overlap (they may nest, but not partially overlap).
-var nextMarkerId = 0
-
-var TextMarker = function(doc, type) {
-  this.lines = []
-  this.type = type
-  this.doc = doc
-  this.id = ++nextMarkerId
-};
-
-// Clear the marker.
-TextMarker.prototype.clear = function () {
-    var this$1 = this;
-
-  if (this.explicitlyCleared) { return }
-  var cm = this.doc.cm, withOp = cm && !cm.curOp
-  if (withOp) { startOperation(cm) }
-  if (hasHandler(this, "clear")) {
-    var found = this.find()
-    if (found) { signalLater(this, "clear", found.from, found.to) }
-  }
-  var min = null, max = null
-  for (var i = 0; i < this.lines.length; ++i) {
-    var line = this$1.lines[i]
-    var span = getMarkedSpanFor(line.markedSpans, this$1)
-    if (cm && !this$1.collapsed) { regLineChange(cm, lineNo(line), "text") }
-    else if (cm) {
-      if (span.to != null) { max = lineNo(line) }
-      if (span.from != null) { min = lineNo(line) }
-    }
-    line.markedSpans = removeMarkedSpan(line.markedSpans, span)
-    if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm)
-      { updateLineHeight(line, textHeight(cm.display)) }
-  }
-  if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
-    var visual = visualLine(this$1.lines[i$1]), len = lineLength(visual)
-    if (len > cm.display.maxLineLength) {
-      cm.display.maxLine = visual
-      cm.display.maxLineLength = len
-      cm.display.maxLineChanged = true
-    }
-  } }
-
-  if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1) }
-  this.lines.length = 0
-  this.explicitlyCleared = true
-  if (this.atomic && this.doc.cantEdit) {
-    this.doc.cantEdit = false
-    if (cm) { reCheckSelection(cm.doc) }
-  }
-  if (cm) { signalLater(cm, "markerCleared", cm, this, min, max) }
-  if (withOp) { endOperation(cm) }
-  if (this.parent) { this.parent.clear() }
-};
-
-// Find the position of the marker in the document. Returns a {from,
-// to} object by default. Side can be passed to get a specific side
-// -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
-// Pos objects returned contain a line object, rather than a line
-// number (used to prevent looking up the same line twice).
-TextMarker.prototype.find = function (side, lineObj) {
-    var this$1 = this;
-
-  if (side == null && this.type == "bookmark") { side = 1 }
-  var from, to
-  for (var i = 0; i < this.lines.length; ++i) {
-    var line = this$1.lines[i]
-    var span = getMarkedSpanFor(line.markedSpans, this$1)
-    if (span.from != null) {
-      from = Pos(lineObj ? line : lineNo(line), span.from)
-      if (side == -1) { return from }
-    }
-    if (span.to != null) {
-      to = Pos(lineObj ? line : lineNo(line), span.to)
-      if (side == 1) { return to }
-    }
-  }
-  return from && {from: from, to: to}
-};
-
-// Signals that the marker's widget changed, and surrounding layout
-// should be recomputed.
-TextMarker.prototype.changed = function () {
-    var this$1 = this;
-
-  var pos = this.find(-1, true), widget = this, cm = this.doc.cm
-  if (!pos || !cm) { return }
-  runInOp(cm, function () {
-    var line = pos.line, lineN = lineNo(pos.line)
-    var view = findViewForLine(cm, lineN)
-    if (view) {
-      clearLineMeasurementCacheFor(view)
-      cm.curOp.selectionChanged = cm.curOp.forceUpdate = true
-    }
-    cm.curOp.updateMaxLine = true
-    if (!lineIsHidden(widget.doc, line) && widget.height != null) {
-      var oldHeight = widget.height
-      widget.height = null
-      var dHeight = widgetHeight(widget) - oldHeight
-      if (dHeight)
-        { updateLineHeight(line, line.height + dHeight) }
-    }
-    signalLater(cm, "markerChanged", cm, this$1)
-  })
-};
-
-TextMarker.prototype.attachLine = function (line) {
-  if (!this.lines.length && this.doc.cm) {
-    var op = this.doc.cm.curOp
-    if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
-      { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this) }
-  }
-  this.lines.push(line)
-};
-
-TextMarker.prototype.detachLine = function (line) {
-  this.lines.splice(indexOf(this.lines, line), 1)
-  if (!this.lines.length && this.doc.cm) {
-    var op = this.doc.cm.curOp
-    ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this)
-  }
-};
-eventMixin(TextMarker)
-
-// Create a marker, wire it up to the right lines, and
-function markText(doc, from, to, options, type) {
-  // Shared markers (across linked documents) are handled separately
-  // (markTextShared will call out to this again, once per
-  // document).
-  if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
-  // Ensure we are in an operation.
-  if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }
-
-  var marker = new TextMarker(doc, type), diff = cmp(from, to)
-  if (options) { copyObj(options, marker, false) }
-  // Don't connect empty markers unless clearWhenEmpty is false
-  if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
-    { return marker }
-  if (marker.replacedWith) {
-    // Showing up as a widget implies collapsed (widget replaces text)
-    marker.collapsed = true
-    marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget")
-    if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true") }
-    if (options.insertLeft) { marker.widgetNode.insertLeft = true }
-  }
-  if (marker.collapsed) {
-    if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
-        from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
-      { throw new Error("Inserting collapsed marker partially overlapping an existing one") }
-    seeCollapsedSpans()
-  }
-
-  if (marker.addToHistory)
-    { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN) }
-
-  var curLine = from.line, cm = doc.cm, updateMaxLine
-  doc.iter(curLine, to.line + 1, function (line) {
-    if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
-      { updateMaxLine = true }
-    if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0) }
-    addMarkedSpan(line, new MarkedSpan(marker,
-                                       curLine == from.line ? from.ch : null,
-                                       curLine == to.line ? to.ch : null))
-    ++curLine
-  })
-  // lineIsHidden depends on the presence of the spans, so needs a second pass
-  if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {
-    if (lineIsHidden(doc, line)) { updateLineHeight(line, 0) }
-  }) }
-
-  if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }) }
-
-  if (marker.readOnly) {
-    seeReadOnlySpans()
-    if (doc.history.done.length || doc.history.undone.length)
-      { doc.clearHistory() }
-  }
-  if (marker.collapsed) {
-    marker.id = ++nextMarkerId
-    marker.atomic = true
-  }
-  if (cm) {
-    // Sync editor state
-    if (updateMaxLine) { cm.curOp.updateMaxLine = true }
-    if (marker.collapsed)
-      { regChange(cm, from.line, to.line + 1) }
-    else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css)
-      { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text") } }
-    if (marker.atomic) { reCheckSelection(cm.doc) }
-    signalLater(cm, "markerAdded", cm, marker)
-  }
-  return marker
-}
-
-// SHARED TEXTMARKERS
-
-// A shared marker spans multiple linked documents. It is
-// implemented as a meta-marker-object controlling multiple normal
-// markers.
-var SharedTextMarker = function(markers, primary) {
-  var this$1 = this;
-
-  this.markers = markers
-  this.primary = primary
-  for (var i = 0; i < markers.length; ++i)
-    { markers[i].parent = this$1 }
-};
-
-SharedTextMarker.prototype.clear = function () {
-    var this$1 = this;
-
-  if (this.explicitlyCleared) { return }
-  this.explicitlyCleared = true
-  for (var i = 0; i < this.markers.length; ++i)
-    { this$1.markers[i].clear() }
-  signalLater(this, "clear")
-};
-
-SharedTextMarker.prototype.find = function (side, lineObj) {
-  return this.primary.find(side, lineObj)
-};
-eventMixin(SharedTextMarker)
-
-function markTextShared(doc, from, to, options, type) {
-  options = copyObj(options)
-  options.shared = false
-  var markers = [markText(doc, from, to, options, type)], primary = markers[0]
-  var widget = options.widgetNode
-  linkedDocs(doc, function (doc) {
-    if (widget) { options.widgetNode = widget.cloneNode(true) }
-    markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type))
-    for (var i = 0; i < doc.linked.length; ++i)
-      { if (doc.linked[i].isParent) { return } }
-    primary = lst(markers)
-  })
-  return new SharedTextMarker(markers, primary)
-}
-
-function findSharedMarkers(doc) {
-  return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })
-}
-
-function copySharedMarkers(doc, markers) {
-  for (var i = 0; i < markers.length; i++) {
-    var marker = markers[i], pos = marker.find()
-    var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to)
-    if (cmp(mFrom, mTo)) {
-      var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type)
-      marker.markers.push(subMark)
-      subMark.parent = marker
-    }
-  }
-}
-
-function detachSharedMarkers(markers) {
-  var loop = function ( i ) {
-    var marker = markers[i], linked = [marker.primary.doc]
-    linkedDocs(marker.primary.doc, function (d) { return linked.push(d); })
-    for (var j = 0; j < marker.markers.length; j++) {
-      var subMarker = marker.markers[j]
-      if (indexOf(linked, subMarker.doc) == -1) {
-        subMarker.parent = null
-        marker.markers.splice(j--, 1)
-      }
-    }
-  };
-
-  for (var i = 0; i < markers.length; i++) loop( i );
-}
-
-var nextDocId = 0
-var Doc = function(text, mode, firstLine, lineSep, direction) {
-  if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
-  if (firstLine == null) { firstLine = 0 }
-
-  BranchChunk.call(this, [new LeafChunk([new Line("", null)])])
-  this.first = firstLine
-  this.scrollTop = this.scrollLeft = 0
-  this.cantEdit = false
-  this.cleanGeneration = 1
-  this.frontier = firstLine
-  var start = Pos(firstLine, 0)
-  this.sel = simpleSelection(start)
-  this.history = new History(null)
-  this.id = ++nextDocId
-  this.modeOption = mode
-  this.lineSep = lineSep
-  this.direction = (direction == "rtl") ? "rtl" : "ltr"
-  this.extend = false
-
-  if (typeof text == "string") { text = this.splitLines(text) }
-  updateDoc(this, {from: start, to: start, text: text})
-  setSelection(this, simpleSelection(start), sel_dontScroll)
-}
-
-Doc.prototype = createObj(BranchChunk.prototype, {
-  constructor: Doc,
-  // Iterate over the document. Supports two forms -- with only one
-  // argument, it calls that for each line in the document. With
-  // three, it iterates over the range given by the first two (with
-  // the second being non-inclusive).
-  iter: function(from, to, op) {
-    if (op) { this.iterN(from - this.first, to - from, op) }
-    else { this.iterN(this.first, this.first + this.size, from) }
-  },
-
-  // Non-public interface for adding and removing lines.
-  insert: function(at, lines) {
-    var height = 0
-    for (var i = 0; i < lines.length; ++i) { height += lines[i].height }
-    this.insertInner(at - this.first, lines, height)
-  },
-  remove: function(at, n) { this.removeInner(at - this.first, n) },
-
-  // From here, the methods are part of the public interface. Most
-  // are also available from CodeMirror (editor) instances.
-
-  getValue: function(lineSep) {
-    var lines = getLines(this, this.first, this.first + this.size)
-    if (lineSep === false) { return lines }
-    return lines.join(lineSep || this.lineSeparator())
-  },
-  setValue: docMethodOp(function(code) {
-    var top = Pos(this.first, 0), last = this.first + this.size - 1
-    makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
-                      text: this.splitLines(code), origin: "setValue", full: true}, true)
-    if (this.cm) { this.cm.scrollTo(0, 0) }
-    setSelection(this, simpleSelection(top), sel_dontScroll)
-  }),
-  replaceRange: function(code, from, to, origin) {
-    from = clipPos(this, from)
-    to = to ? clipPos(this, to) : from
-    replaceRange(this, code, from, to, origin)
-  },
-  getRange: function(from, to, lineSep) {
-    var lines = getBetween(this, clipPos(this, from), clipPos(this, to))
-    if (lineSep === false) { return lines }
-    return lines.join(lineSep || this.lineSeparator())
-  },
-
-  getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},
-
-  getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},
-  getLineNumber: function(line) {return lineNo(line)},
-
-  getLineHandleVisualStart: function(line) {
-    if (typeof line == "number") { line = getLine(this, line) }
-    return visualLine(line)
-  },
-
-  lineCount: function() {return this.size},
-  firstLine: function() {return this.first},
-  lastLine: function() {return this.first + this.size - 1},
-
-  clipPos: function(pos) {return clipPos(this, pos)},
-
-  getCursor: function(start) {
-    var range = this.sel.primary(), pos
-    if (start == null || start == "head") { pos = range.head }
-    else if (start == "anchor") { pos = range.anchor }
-    else if (start == "end" || start == "to" || start === false) { pos = range.to() }
-    else { pos = range.from() }
-    return pos
-  },
-  listSelections: function() { return this.sel.ranges },
-  somethingSelected: function() {return this.sel.somethingSelected()},
-
-  setCursor: docMethodOp(function(line, ch, options) {
-    setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options)
-  }),
-  setSelection: docMethodOp(function(anchor, head, options) {
-    setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options)
-  }),
-  extendSelection: docMethodOp(function(head, other, options) {
-    extendSelection(this, clipPos(this, head), other && clipPos(this, other), options)
-  }),
-  extendSelections: docMethodOp(function(heads, options) {
-    extendSelections(this, clipPosArray(this, heads), options)
-  }),
-  extendSelectionsBy: docMethodOp(function(f, options) {
-    var heads = map(this.sel.ranges, f)
-    extendSelections(this, clipPosArray(this, heads), options)
-  }),
-  setSelections: docMethodOp(function(ranges, primary, options) {
-    var this$1 = this;
-
-    if (!ranges.length) { return }
-    var out = []
-    for (var i = 0; i < ranges.length; i++)
-      { out[i] = new Range(clipPos(this$1, ranges[i].anchor),
-                         clipPos(this$1, ranges[i].head)) }
-    if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex) }
-    setSelection(this, normalizeSelection(out, primary), options)
-  }),
-  addSelection: docMethodOp(function(anchor, head, options) {
-    var ranges = this.sel.ranges.slice(0)
-    ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)))
-    setSelection(this, normalizeSelection(ranges, ranges.length - 1), options)
-  }),
-
-  getSelection: function(lineSep) {
-    var this$1 = this;
-
-    var ranges = this.sel.ranges, lines
-    for (var i = 0; i < ranges.length; i++) {
-      var sel = getBetween(this$1, ranges[i].from(), ranges[i].to())
-      lines = lines ? lines.concat(sel) : sel
-    }
-    if (lineSep === false) { return lines }
-    else { return lines.join(lineSep || this.lineSeparator()) }
-  },
-  getSelections: function(lineSep) {
-    var this$1 = this;
-
-    var parts = [], ranges = this.sel.ranges
-    for (var i = 0; i < ranges.length; i++) {
-      var sel = getBetween(this$1, ranges[i].from(), ranges[i].to())
-      if (lineSep !== false) { sel = sel.join(lineSep || this$1.lineSeparator()) }
-      parts[i] = sel
-    }
-    return parts
-  },
-  replaceSelection: function(code, collapse, origin) {
-    var dup = []
-    for (var i = 0; i < this.sel.ranges.length; i++)
-      { dup[i] = code }
-    this.replaceSelections(dup, collapse, origin || "+input")
-  },
-  replaceSelections: docMethodOp(function(code, collapse, origin) {
-    var this$1 = this;
-
-    var changes = [], sel = this.sel
-    for (var i = 0; i < sel.ranges.length; i++) {
-      var range = sel.ranges[i]
-      changes[i] = {from: range.from(), to: range.to(), text: this$1.splitLines(code[i]), origin: origin}
-    }
-    var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse)
-    for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
-      { makeChange(this$1, changes[i$1]) }
-    if (newSel) { setSelectionReplaceHistory(this, newSel) }
-    else if (this.cm) { ensureCursorVisible(this.cm) }
-  }),
-  undo: docMethodOp(function() {makeChangeFromHistory(this, "undo")}),
-  redo: docMethodOp(function() {makeChangeFromHistory(this, "redo")}),
-  undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true)}),
-  redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true)}),
-
-  setExtending: function(val) {this.extend = val},
-  getExtending: function() {return this.extend},
-
-  historySize: function() {
-    var hist = this.history, done = 0, undone = 0
-    for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done } }
-    for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone } }
-    return {undo: done, redo: undone}
-  },
-  clearHistory: function() {this.history = new History(this.history.maxGeneration)},
-
-  markClean: function() {
-    this.cleanGeneration = this.changeGeneration(true)
-  },
-  changeGeneration: function(forceSplit) {
-    if (forceSplit)
-      { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null }
-    return this.history.generation
-  },
-  isClean: function (gen) {
-    return this.history.generation == (gen || this.cleanGeneration)
-  },
-
-  getHistory: function() {
-    return {done: copyHistoryArray(this.history.done),
-            undone: copyHistoryArray(this.history.undone)}
-  },
-  setHistory: function(histData) {
-    var hist = this.history = new History(this.history.maxGeneration)
-    hist.done = copyHistoryArray(histData.done.slice(0), null, true)
-    hist.undone = copyHistoryArray(histData.undone.slice(0), null, true)
-  },
-
-  setGutterMarker: docMethodOp(function(line, gutterID, value) {
-    return changeLine(this, line, "gutter", function (line) {
-      var markers = line.gutterMarkers || (line.gutterMarkers = {})
-      markers[gutterID] = value
-      if (!value && isEmpty(markers)) { line.gutterMarkers = null }
-      return true
-    })
-  }),
-
-  clearGutter: docMethodOp(function(gutterID) {
-    var this$1 = this;
-
-    this.iter(function (line) {
-      if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
-        changeLine(this$1, line, "gutter", function () {
-          line.gutterMarkers[gutterID] = null
-          if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null }
-          return true
-        })
-      }
-    })
-  }),
-
-  lineInfo: function(line) {
-    var n
-    if (typeof line == "number") {
-      if (!isLine(this, line)) { return null }
-      n = line
-      line = getLine(this, line)
-      if (!line) { return null }
-    } else {
-      n = lineNo(line)
-      if (n == null) { return null }
-    }
-    return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
-            textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
-            widgets: line.widgets}
-  },
-
-  addLineClass: docMethodOp(function(handle, where, cls) {
-    return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
-      var prop = where == "text" ? "textClass"
-               : where == "background" ? "bgClass"
-               : where == "gutter" ? "gutterClass" : "wrapClass"
-      if (!line[prop]) { line[prop] = cls }
-      else if (classTest(cls).test(line[prop])) { return false }
-      else { line[prop] += " " + cls }
-      return true
-    })
-  }),
-  removeLineClass: docMethodOp(function(handle, where, cls) {
-    return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
-      var prop = where == "text" ? "textClass"
-               : where == "background" ? "bgClass"
-               : where == "gutter" ? "gutterClass" : "wrapClass"
-      var cur = line[prop]
-      if (!cur) { return false }
-      else if (cls == null) { line[prop] = null }
-      else {
-        var found = cur.match(classTest(cls))
-        if (!found) { return false }
-        var end = found.index + found[0].length
-        line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null
-      }
-      return true
-    })
-  }),
-
-  addLineWidget: docMethodOp(function(handle, node, options) {
-    return addLineWidget(this, handle, node, options)
-  }),
-  removeLineWidget: function(widget) { widget.clear() },
-
-  markText: function(from, to, options) {
-    return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range")
-  },
-  setBookmark: function(pos, options) {
-    var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
-                    insertLeft: options && options.insertLeft,
-                    clearWhenEmpty: false, shared: options && options.shared,
-                    handleMouseEvents: options && options.handleMouseEvents}
-    pos = clipPos(this, pos)
-    return markText(this, pos, pos, realOpts, "bookmark")
-  },
-  findMarksAt: function(pos) {
-    pos = clipPos(this, pos)
-    var markers = [], spans = getLine(this, pos.line).markedSpans
-    if (spans) { for (var i = 0; i < spans.length; ++i) {
-      var span = spans[i]
-      if ((span.from == null || span.from <= pos.ch) &&
-          (span.to == null || span.to >= pos.ch))
-        { markers.push(span.marker.parent || span.marker) }
-    } }
-    return markers
-  },
-  findMarks: function(from, to, filter) {
-    from = clipPos(this, from); to = clipPos(this, to)
-    var found = [], lineNo = from.line
-    this.iter(from.line, to.line + 1, function (line) {
-      var spans = line.markedSpans
-      if (spans) { for (var i = 0; i < spans.length; i++) {
-        var span = spans[i]
-        if (!(span.to != null && lineNo == from.line && from.ch >= span.to ||
-              span.from == null && lineNo != from.line ||
-              span.from != null && lineNo == to.line && span.from >= to.ch) &&
-            (!filter || filter(span.marker)))
-          { found.push(span.marker.parent || span.marker) }
-      } }
-      ++lineNo
-    })
-    return found
-  },
-  getAllMarks: function() {
-    var markers = []
-    this.iter(function (line) {
-      var sps = line.markedSpans
-      if (sps) { for (var i = 0; i < sps.length; ++i)
-        { if (sps[i].from != null) { markers.push(sps[i].marker) } } }
-    })
-    return markers
-  },
-
-  posFromIndex: function(off) {
-    var ch, lineNo = this.first, sepSize = this.lineSeparator().length
-    this.iter(function (line) {
-      var sz = line.text.length + sepSize
-      if (sz > off) { ch = off; return true }
-      off -= sz
-      ++lineNo
-    })
-    return clipPos(this, Pos(lineNo, ch))
-  },
-  indexFromPos: function (coords) {
-    coords = clipPos(this, coords)
-    var index = coords.ch
-    if (coords.line < this.first || coords.ch < 0) { return 0 }
-    var sepSize = this.lineSeparator().length
-    this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value
-      index += line.text.length + sepSize
-    })
-    return index
-  },
-
-  copy: function(copyHistory) {
-    var doc = new Doc(getLines(this, this.first, this.first + this.size),
-                      this.modeOption, this.first, this.lineSep, this.direction)
-    doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft
-    doc.sel = this.sel
-    doc.extend = false
-    if (copyHistory) {
-      doc.history.undoDepth = this.history.undoDepth
-      doc.setHistory(this.getHistory())
-    }
-    return doc
-  },
-
-  linkedDoc: function(options) {
-    if (!options) { options = {} }
-    var from = this.first, to = this.first + this.size
-    if (options.from != null && options.from > from) { from = options.from }
-    if (options.to != null && options.to < to) { to = options.to }
-    var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction)
-    if (options.sharedHist) { copy.history = this.history
-    ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist})
-    copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}]
-    copySharedMarkers(copy, findSharedMarkers(this))
-    return copy
-  },
-  unlinkDoc: function(other) {
-    var this$1 = this;
-
-    if (other instanceof CodeMirror) { other = other.doc }
-    if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
-      var link = this$1.linked[i]
-      if (link.doc != other) { continue }
-      this$1.linked.splice(i, 1)
-      other.unlinkDoc(this$1)
-      detachSharedMarkers(findSharedMarkers(this$1))
-      break
-    } }
-    // If the histories were shared, split them again
-    if (other.history == this.history) {
-      var splitIds = [other.id]
-      linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true)
-      other.history = new History(null)
-      other.history.done = copyHistoryArray(this.history.done, splitIds)
-      other.history.undone = copyHistoryArray(this.history.undone, splitIds)
-    }
-  },
-  iterLinkedDocs: function(f) {linkedDocs(this, f)},
-
-  getMode: function() {return this.mode},
-  getEditor: function() {return this.cm},
-
-  splitLines: function(str) {
-    if (this.lineSep) { return str.split(this.lineSep) }
-    return splitLinesAuto(str)
-  },
-  lineSeparator: function() { return this.lineSep || "\n" },
-
-  setDirection: docMethodOp(function (dir) {
-    if (dir != "rtl") { dir = "ltr" }
-    if (dir == this.direction) { return }
-    this.direction = dir
-    this.iter(function (line) { return line.order = null; })
-    if (this.cm) { directionChanged(this.cm) }
-  })
-})
-
-// Public alias.
-Doc.prototype.eachLine = Doc.prototype.iter
-
-// Kludge to work around strange IE behavior where it'll sometimes
-// re-fire a series of drag-related events right after the drop (#1551)
-var lastDrop = 0
-
-function onDrop(e) {
-  var cm = this
-  clearDragCursor(cm)
-  if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
-    { return }
-  e_preventDefault(e)
-  if (ie) { lastDrop = +new Date }
-  var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files
-  if (!pos || cm.isReadOnly()) { return }
-  // Might be a file drop, in which case we simply extract the text
-  // and insert it.
-  if (files && files.length && window.FileReader && window.File) {
-    var n = files.length, text = Array(n), read = 0
-    var loadFile = function (file, i) {
-      if (cm.options.allowDropFileTypes &&
-          indexOf(cm.options.allowDropFileTypes, file.type) == -1)
-        { return }
-
-      var reader = new FileReader
-      reader.onload = operation(cm, function () {
-        var content = reader.result
-        if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { content = "" }
-        text[i] = content
-        if (++read == n) {
-          pos = clipPos(cm.doc, pos)
-          var change = {from: pos, to: pos,
-                        text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),
-                        origin: "paste"}
-          makeChange(cm.doc, change)
-          setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)))
-        }
-      })
-      reader.readAsText(file)
-    }
-    for (var i = 0; i < n; ++i) { loadFile(files[i], i) }
-  } else { // Normal drop
-    // Don't do a replace if the drop happened inside of the selected text.
-    if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
-      cm.state.draggingText(e)
-      // Ensure the editor is re-focused
-      setTimeout(function () { return cm.display.input.focus(); }, 20)
-      return
-    }
-    try {
-      var text$1 = e.dataTransfer.getData("Text")
-      if (text$1) {
-        var selected
-        if (cm.state.draggingText && !cm.state.draggingText.copy)
-          { selected = cm.listSelections() }
-        setSelectionNoUndo(cm.doc, simpleSelection(pos, pos))
-        if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)
-          { replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag") } }
-        cm.replaceSelection(text$1, "around", "paste")
-        cm.display.input.focus()
-      }
-    }
-    catch(e){}
-  }
-}
-
-function onDragStart(cm, e) {
-  if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }
-  if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }
-
-  e.dataTransfer.setData("Text", cm.getSelection())
-  e.dataTransfer.effectAllowed = "copyMove"
-
-  // Use dummy image instead of default browsers image.
-  // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
-  if (e.dataTransfer.setDragImage && !safari) {
-    var img = elt("img", null, null, "position: fixed; left: 0; top: 0;")
-    img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
-    if (presto) {
-      img.width = img.height = 1
-      cm.display.wrapper.appendChild(img)
-      // Force a relayout, or Opera won't use our image for some obscure reason
-      img._top = img.offsetTop
-    }
-    e.dataTransfer.setDragImage(img, 0, 0)
-    if (presto) { img.parentNode.removeChild(img) }
-  }
-}
-
-function onDragOver(cm, e) {
-  var pos = posFromMouse(cm, e)
-  if (!pos) { return }
-  var frag = document.createDocumentFragment()
-  drawSelectionCursor(cm, pos, frag)
-  if (!cm.display.dragCursor) {
-    cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors")
-    cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv)
-  }
-  removeChildrenAndAdd(cm.display.dragCursor, frag)
-}
-
-function clearDragCursor(cm) {
-  if (cm.display.dragCursor) {
-    cm.display.lineSpace.removeChild(cm.display.dragCursor)
-    cm.display.dragCursor = null
-  }
-}
-
-// These must be handled carefully, because naively registering a
-// handler for each editor will cause the editors to never be
-// garbage collected.
-
-function forEachCodeMirror(f) {
-  if (!document.body.getElementsByClassName) { return }
-  var byClass = document.body.getElementsByClassName("CodeMirror")
-  for (var i = 0; i < byClass.length; i++) {
-    var cm = byClass[i].CodeMirror
-    if (cm) { f(cm) }
-  }
-}
-
-var globalsRegistered = false
-function ensureGlobalHandlers() {
-  if (globalsRegistered) { return }
-  registerGlobalHandlers()
-  globalsRegistered = true
-}
-function registerGlobalHandlers() {
-  // When the window resizes, we need to refresh active editors.
-  var resizeTimer
-  on(window, "resize", function () {
-    if (resizeTimer == null) { resizeTimer = setTimeout(function () {
-      resizeTimer = null
-      forEachCodeMirror(onResize)
-    }, 100) }
-  })
-  // When the window loses focus, we want to show the editor as blurred
-  on(window, "blur", function () { return forEachCodeMirror(onBlur); })
-}
-// Called when the window resizes
-function onResize(cm) {
-  var d = cm.display
-  if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)
-    { return }
-  // Might be a text scaling operation, clear size caches.
-  d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null
-  d.scrollbarsClipped = false
-  cm.setSize()
-}
-
-var keyNames = {
-  3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
-  19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
-  36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
-  46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod",
-  106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete",
-  173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
-  221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
-  63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
-}
-
-// Number keys
-for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i) }
-// Alphabetic keys
-for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1) }
-// Function keys
-for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2 }
-
-var keyMap = {}
-
-keyMap.basic = {
-  "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
-  "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
-  "Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore",
-  "Tab": "defaultTab", "Shift-Tab": "indentAuto",
-  "Enter": "newlineAndIndent", "Insert": "toggleOverwrite",
-  "Esc": "singleSelection"
-}
-// Note that the save and find-related commands aren't defined by
-// default. User code or addons can define them. Unknown commands
-// are simply ignored.
-keyMap.pcDefault = {
-  "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
-  "Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown",
-  "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
-  "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
-  "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
-  "Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
-  "Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection",
-  fallthrough: "basic"
-}
-// Very basic readline/emacs-style bindings, which are standard on Mac.
-keyMap.emacsy = {
-  "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
-  "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
-  "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
-  "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars",
-  "Ctrl-O": "openLine"
-}
-keyMap.macDefault = {
-  "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
-  "Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
-  "Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore",
-  "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
-  "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
-  "Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight",
-  "Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd",
-  fallthrough: ["basic", "emacsy"]
-}
-keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault
-
-// KEYMAP DISPATCH
-
-function normalizeKeyName(name) {
-  var parts = name.split(/-(?!$)/)
-  name = parts[parts.length - 1]
-  var alt, ctrl, shift, cmd
-  for (var i = 0; i < parts.length - 1; i++) {
-    var mod = parts[i]
-    if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true }
-    else if (/^a(lt)?$/i.test(mod)) { alt = true }
-    else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true }
-    else if (/^s(hift)?$/i.test(mod)) { shift = true }
-    else { throw new Error("Unrecognized modifier name: " + mod) }
-  }
-  if (alt) { name = "Alt-" + name }
-  if (ctrl) { name = "Ctrl-" + name }
-  if (cmd) { name = "Cmd-" + name }
-  if (shift) { name = "Shift-" + name }
-  return name
-}
-
-// This is a kludge to keep keymaps mostly working as raw objects
-// (backwards compatibility) while at the same time support features
-// like normalization and multi-stroke key bindings. It compiles a
-// new normalized keymap, and then updates the old object to reflect
-// this.
-function normalizeKeyMap(keymap) {
-  var copy = {}
-  for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {
-    var value = keymap[keyname]
-    if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }
-    if (value == "...") { delete keymap[keyname]; continue }
-
-    var keys = map(keyname.split(" "), normalizeKeyName)
-    for (var i = 0; i < keys.length; i++) {
-      var val = (void 0), name = (void 0)
-      if (i == keys.length - 1) {
-        name = keys.join(" ")
-        val = value
-      } else {
-        name = keys.slice(0, i + 1).join(" ")
-        val = "..."
-      }
-      var prev = copy[name]
-      if (!prev) { copy[name] = val }
-      else if (prev != val) { throw new Error("Inconsistent bindings for " + name) }
-    }
-    delete keymap[keyname]
-  } }
-  for (var prop in copy) { keymap[prop] = copy[prop] }
-  return keymap
-}
-
-function lookupKey(key, map, handle, context) {
-  map = getKeyMap(map)
-  var found = map.call ? map.call(key, context) : map[key]
-  if (found === false) { return "nothing" }
-  if (found === "...") { return "multi" }
-  if (found != null && handle(found)) { return "handled" }
-
-  if (map.fallthrough) {
-    if (Object.prototype.toString.call(map.fallthrough) != "[object Array]")
-      { return lookupKey(key, map.fallthrough, handle, context) }
-    for (var i = 0; i < map.fallthrough.length; i++) {
-      var result = lookupKey(key, map.fallthrough[i], handle, context)
-      if (result) { return result }
-    }
-  }
-}
-
-// Modifier key presses don't count as 'real' key presses for the
-// purpose of keymap fallthrough.
-function isModifierKey(value) {
-  var name = typeof value == "string" ? value : keyNames[value.keyCode]
-  return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"
-}
-
-// Look up the name of a key as indicated by an event object.
-function keyName(event, noShift) {
-  if (presto && event.keyCode == 34 && event["char"]) { return false }
-  var base = keyNames[event.keyCode], name = base
-  if (name == null || event.altGraphKey) { return false }
-  if (event.altKey && base != "Alt") { name = "Alt-" + name }
-  if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name }
-  if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Cmd") { name = "Cmd-" + name }
-  if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name }
-  return name
-}
-
-function getKeyMap(val) {
-  return typeof val == "string" ? keyMap[val] : val
-}
-
-// Helper for deleting text near the selection(s), used to implement
-// backspace, delete, and similar functionality.
-function deleteNearSelection(cm, compute) {
-  var ranges = cm.doc.sel.ranges, kill = []
-  // Build up a set of ranges to kill first, merging overlapping
-  // ranges.
-  for (var i = 0; i < ranges.length; i++) {
-    var toKill = compute(ranges[i])
-    while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
-      var replaced = kill.pop()
-      if (cmp(replaced.from, toKill.from) < 0) {
-        toKill.from = replaced.from
-        break
-      }
-    }
-    kill.push(toKill)
-  }
-  // Next, remove those actual ranges.
-  runInOp(cm, function () {
-    for (var i = kill.length - 1; i >= 0; i--)
-      { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete") }
-    ensureCursorVisible(cm)
-  })
-}
-
-// Commands are parameter-less actions that can be performed on an
-// editor, mostly used for keybindings.
-var commands = {
-  selectAll: selectAll,
-  singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); },
-  killLine: function (cm) { return deleteNearSelection(cm, function (range) {
-    if (range.empty()) {
-      var len = getLine(cm.doc, range.head.line).text.length
-      if (range.head.ch == len && range.head.line < cm.lastLine())
-        { return {from: range.head, to: Pos(range.head.line + 1, 0)} }
-      else
-        { return {from: range.head, to: Pos(range.head.line, len)} }
-    } else {
-      return {from: range.from(), to: range.to()}
-    }
-  }); },
-  deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({
-    from: Pos(range.from().line, 0),
-    to: clipPos(cm.doc, Pos(range.to().line + 1, 0))
-  }); }); },
-  delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({
-    from: Pos(range.from().line, 0), to: range.from()
-  }); }); },
-  delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {
-    var top = cm.charCoords(range.head, "div").top + 5
-    var leftPos = cm.coordsChar({left: 0, top: top}, "div")
-    return {from: leftPos, to: range.from()}
-  }); },
-  delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {
-    var top = cm.charCoords(range.head, "div").top + 5
-    var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
-    return {from: range.from(), to: rightPos }
-  }); },
-  undo: function (cm) { return cm.undo(); },
-  redo: function (cm) { return cm.redo(); },
-  undoSelection: function (cm) { return cm.undoSelection(); },
-  redoSelection: function (cm) { return cm.redoSelection(); },
-  goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },
-  goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },
-  goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },
-    {origin: "+move", bias: 1}
-  ); },
-  goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },
-    {origin: "+move", bias: 1}
-  ); },
-  goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },
-    {origin: "+move", bias: -1}
-  ); },
-  goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {
-    var top = cm.charCoords(range.head, "div").top + 5
-    return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
-  }, sel_move); },
-  goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {
-    var top = cm.charCoords(range.head, "div").top + 5
-    return cm.coordsChar({left: 0, top: top}, "div")
-  }, sel_move); },
-  goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {
-    var top = cm.charCoords(range.head, "div").top + 5
-    var pos = cm.coordsChar({left: 0, top: top}, "div")
-    if (pos.ch < cm.getLine(pos.line).search(/\S/)) { return lineStartSmart(cm, range.head) }
-    return pos
-  }, sel_move); },
-  goLineUp: function (cm) { return cm.moveV(-1, "line"); },
-  goLineDown: function (cm) { return cm.moveV(1, "line"); },
-  goPageUp: function (cm) { return cm.moveV(-1, "page"); },
-  goPageDown: function (cm) { return cm.moveV(1, "page"); },
-  goCharLeft: function (cm) { return cm.moveH(-1, "char"); },
-  goCharRight: function (cm) { return cm.moveH(1, "char"); },
-  goColumnLeft: function (cm) { return cm.moveH(-1, "column"); },
-  goColumnRight: function (cm) { return cm.moveH(1, "column"); },
-  goWordLeft: function (cm) { return cm.moveH(-1, "word"); },
-  goGroupRight: function (cm) { return cm.moveH(1, "group"); },
-  goGroupLeft: function (cm) { return cm.moveH(-1, "group"); },
-  goWordRight: function (cm) { return cm.moveH(1, "word"); },
-  delCharBefore: function (cm) { return cm.deleteH(-1, "char"); },
-  delCharAfter: function (cm) { return cm.deleteH(1, "char"); },
-  delWordBefore: function (cm) { return cm.deleteH(-1, "word"); },
-  delWordAfter: function (cm) { return cm.deleteH(1, "word"); },
-  delGroupBefore: function (cm) { return cm.deleteH(-1, "group"); },
-  delGroupAfter: function (cm) { return cm.deleteH(1, "group"); },
-  indentAuto: function (cm) { return cm.indentSelection("smart"); },
-  indentMore: function (cm) { return cm.indentSelection("add"); },
-  indentLess: function (cm) { return cm.indentSelection("subtract"); },
-  insertTab: function (cm) { return cm.replaceSelection("\t"); },
-  insertSoftTab: function (cm) {
-    var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize
-    for (var i = 0; i < ranges.length; i++) {
-      var pos = ranges[i].from()
-      var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize)
-      spaces.push(spaceStr(tabSize - col % tabSize))
-    }
-    cm.replaceSelections(spaces)
-  },
-  defaultTab: function (cm) {
-    if (cm.somethingSelected()) { cm.indentSelection("add") }
-    else { cm.execCommand("insertTab") }
-  },
-  // Swap the two chars left and right of each selection's head.
-  // Move cursor behind the two swapped characters afterwards.
-  //
-  // Doesn't consider line feeds a character.
-  // Doesn't scan more than one line above to find a character.
-  // Doesn't do anything on an empty line.
-  // Doesn't do anything with non-empty selections.
-  transposeChars: function (cm) { return runInOp(cm, function () {
-    var ranges = cm.listSelections(), newSel = []
-    for (var i = 0; i < ranges.length; i++) {
-      if (!ranges[i].empty()) { continue }
-      var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text
-      if (line) {
-        if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1) }
-        if (cur.ch > 0) {
-          cur = new Pos(cur.line, cur.ch + 1)
-          cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),
-                          Pos(cur.line, cur.ch - 2), cur, "+transpose")
-        } else if (cur.line > cm.doc.first) {
-          var prev = getLine(cm.doc, cur.line - 1).text
-          if (prev) {
-            cur = new Pos(cur.line, 1)
-            cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +
-                            prev.charAt(prev.length - 1),
-                            Pos(cur.line - 1, prev.length - 1), cur, "+transpose")
-          }
-        }
-      }
-      newSel.push(new Range(cur, cur))
-    }
-    cm.setSelections(newSel)
-  }); },
-  newlineAndIndent: function (cm) { return runInOp(cm, function () {
-    var sels = cm.listSelections()
-    for (var i = sels.length - 1; i >= 0; i--)
-      { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input") }
-    sels = cm.listSelections()
-    for (var i$1 = 0; i$1 < sels.length; i$1++)
-      { cm.indentLine(sels[i$1].from().line, null, true) }
-    ensureCursorVisible(cm)
-  }); },
-  openLine: function (cm) { return cm.replaceSelection("\n", "start"); },
-  toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }
-}
-
-
-function lineStart(cm, lineN) {
-  var line = getLine(cm.doc, lineN)
-  var visual = visualLine(line)
-  if (visual != line) { lineN = lineNo(visual) }
-  return endOfLine(true, cm, visual, lineN, 1)
-}
-function lineEnd(cm, lineN) {
-  var line = getLine(cm.doc, lineN)
-  var visual = visualLineEnd(line)
-  if (visual != line) { lineN = lineNo(visual) }
-  return endOfLine(true, cm, line, lineN, -1)
-}
-function lineStartSmart(cm, pos) {
-  var start = lineStart(cm, pos.line)
-  var line = getLine(cm.doc, start.line)
-  var order = getOrder(line, cm.doc.direction)
-  if (!order || order[0].level == 0) {
-    var firstNonWS = Math.max(0, line.text.search(/\S/))
-    var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch
-    return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)
-  }
-  return start
-}
-
-// Run a handler that was bound to a key.
-function doHandleBinding(cm, bound, dropShift) {
-  if (typeof bound == "string") {
-    bound = commands[bound]
-    if (!bound) { return false }
-  }
-  // Ensure previous input has been read, so that the handler sees a
-  // consistent view of the document
-  cm.display.input.ensurePolled()
-  var prevShift = cm.display.shift, done = false
-  try {
-    if (cm.isReadOnly()) { cm.state.suppressEdits = true }
-    if (dropShift) { cm.display.shift = false }
-    done = bound(cm) != Pass
-  } finally {
-    cm.display.shift = prevShift
-    cm.state.suppressEdits = false
-  }
-  return done
-}
-
-function lookupKeyForEditor(cm, name, handle) {
-  for (var i = 0; i < cm.state.keyMaps.length; i++) {
-    var result = lookupKey(name, cm.state.keyMaps[i], handle, cm)
-    if (result) { return result }
-  }
-  return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))
-    || lookupKey(name, cm.options.keyMap, handle, cm)
-}
-
-var stopSeq = new Delayed
-function dispatchKey(cm, name, e, handle) {
-  var seq = cm.state.keySeq
-  if (seq) {
-    if (isModifierKey(name)) { return "handled" }
-    stopSeq.set(50, function () {
-      if (cm.state.keySeq == seq) {
-        cm.state.keySeq = null
-        cm.display.input.reset()
-      }
-    })
-    name = seq + " " + name
-  }
-  var result = lookupKeyForEditor(cm, name, handle)
-
-  if (result == "multi")
-    { cm.state.keySeq = name }
-  if (result == "handled")
-    { signalLater(cm, "keyHandled", cm, name, e) }
-
-  if (result == "handled" || result == "multi") {
-    e_preventDefault(e)
-    restartBlink(cm)
-  }
-
-  if (seq && !result && /\'$/.test(name)) {
-    e_preventDefault(e)
-    return true
-  }
-  return !!result
-}
-
-// Handle a key from the keydown event.
-function handleKeyBinding(cm, e) {
-  var name = keyName(e, true)
-  if (!name) { return false }
-
-  if (e.shiftKey && !cm.state.keySeq) {
-    // First try to resolve full name (including 'Shift-'). Failing
-    // that, see if there is a cursor-motion command (starting with
-    // 'go') bound to the keyname without 'Shift-'.
-    return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); })
-        || dispatchKey(cm, name, e, function (b) {
-             if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
-               { return doHandleBinding(cm, b) }
-           })
-  } else {
-    return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })
-  }
-}
-
-// Handle a key from the keypress event
-function handleCharBinding(cm, e, ch) {
-  return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); })
-}
-
-var lastStoppedKey = null
-function onKeyDown(e) {
-  var cm = this
-  cm.curOp.focus = activeElt()
-  if (signalDOMEvent(cm, e)) { return }
-  // IE does strange things with escape.
-  if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false }
-  var code = e.keyCode
-  cm.display.shift = code == 16 || e.shiftKey
-  var handled = handleKeyBinding(cm, e)
-  if (presto) {
-    lastStoppedKey = handled ? code : null
-    // Opera has no cut event... we try to at least catch the key combo
-    if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
-      { cm.replaceSelection("", null, "cut") }
-  }
-
-  // Turn mouse into crosshair when Alt is held on Mac.
-  if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
-    { showCrossHair(cm) }
-}
-
-function showCrossHair(cm) {
-  var lineDiv = cm.display.lineDiv
-  addClass(lineDiv, "CodeMirror-crosshair")
-
-  function up(e) {
-    if (e.keyCode == 18 || !e.altKey) {
-      rmClass(lineDiv, "CodeMirror-crosshair")
-      off(document, "keyup", up)
-      off(document, "mouseover", up)
-    }
-  }
-  on(document, "keyup", up)
-  on(document, "mouseover", up)
-}
-
-function onKeyUp(e) {
-  if (e.keyCode == 16) { this.doc.sel.shift = false }
-  signalDOMEvent(this, e)
-}
-
-function onKeyPress(e) {
-  var cm = this
-  if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }
-  var keyCode = e.keyCode, charCode = e.charCode
-  if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}
-  if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }
-  var ch = String.fromCharCode(charCode == null ? keyCode : charCode)
-  // Some browsers fire keypress events for backspace
-  if (ch == "\x08") { return }
-  if (handleCharBinding(cm, e, ch)) { return }
-  cm.display.input.onKeyPress(e)
-}
-
-// A mouse down can be a single click, double click, triple click,
-// start of selection drag, start of text drag, new cursor
-// (ctrl-click), rectangle drag (alt-drag), or xwin
-// middle-click-paste. Or it might be a click on something we should
-// not interfere with, such as a scrollbar or widget.
-function onMouseDown(e) {
-  var cm = this, display = cm.display
-  if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }
-  display.input.ensurePolled()
-  display.shift = e.shiftKey
-
-  if (eventInWidget(display, e)) {
-    if (!webkit) {
-      // Briefly turn off draggability, to allow widgets to do
-      // normal dragging things.
-      display.scroller.draggable = false
-      setTimeout(function () { return display.scroller.draggable = true; }, 100)
-    }
-    return
-  }
-  if (clickInGutter(cm, e)) { return }
-  var start = posFromMouse(cm, e)
-  window.focus()
-
-  switch (e_button(e)) {
-  case 1:
-    // #3261: make sure, that we're not starting a second selection
-    if (cm.state.selectingText)
-      { cm.state.selectingText(e) }
-    else if (start)
-      { leftButtonDown(cm, e, start) }
-    else if (e_target(e) == display.scroller)
-      { e_preventDefault(e) }
-    break
-  case 2:
-    if (webkit) { cm.state.lastMiddleDown = +new Date }
-    if (start) { extendSelection(cm.doc, start) }
-    setTimeout(function () { return display.input.focus(); }, 20)
-    e_preventDefault(e)
-    break
-  case 3:
-    if (captureRightClick) { onContextMenu(cm, e) }
-    else { delayBlurEvent(cm) }
-    break
-  }
-}
-
-var lastClick;
-var lastDoubleClick;
-function leftButtonDown(cm, e, start) {
-  if (ie) { setTimeout(bind(ensureFocus, cm), 0) }
-  else { cm.curOp.focus = activeElt() }
-
-  var now = +new Date, type
-  if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) {
-    type = "triple"
-  } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) {
-    type = "double"
-    lastDoubleClick = {time: now, pos: start}
-  } else {
-    type = "single"
-    lastClick = {time: now, pos: start}
-  }
-
-  var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained
-  if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
-      type == "single" && (contained = sel.contains(start)) > -1 &&
-      (cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) &&
-      (cmp(contained.to(), start) > 0 || start.xRel < 0))
-    { leftButtonStartDrag(cm, e, start, modifier) }
-  else
-    { leftButtonSelect(cm, e, start, type, modifier) }
-}
-
-// Start a text drag. When it ends, see if any dragging actually
-// happen, and treat as a click if it didn't.
-function leftButtonStartDrag(cm, e, start, modifier) {
-  var display = cm.display, moved = false
-  var dragEnd = operation(cm, function (e) {
-    if (webkit) { display.scroller.draggable = false }
-    cm.state.draggingText = false
-    off(document, "mouseup", dragEnd)
-    off(document, "mousemove", mouseMove)
-    off(display.scroller, "dragstart", dragStart)
-    off(display.scroller, "drop", dragEnd)
-    if (!moved) {
-      e_preventDefault(e)
-      if (!modifier)
-        { extendSelection(cm.doc, start) }
-      // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
-      if (webkit || ie && ie_version == 9)
-        { setTimeout(function () {document.body.focus(); display.input.focus()}, 20) }
-      else
-        { display.input.focus() }
-    }
-  })
-  var mouseMove = function(e2) {
-    moved = moved || Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) >= 10
-  }
-  var dragStart = function () { return moved = true; }
-  // Let the drag handler handle this.
-  if (webkit) { display.scroller.draggable = true }
-  cm.state.draggingText = dragEnd
-  dragEnd.copy = mac ? e.altKey : e.ctrlKey
-  // IE's approach to draggable
-  if (display.scroller.dragDrop) { display.scroller.dragDrop() }
-  on(document, "mouseup", dragEnd)
-  on(document, "mousemove", mouseMove)
-  on(display.scroller, "dragstart", dragStart)
-  on(display.scroller, "drop", dragEnd)
-
-  delayBlurEvent(cm)
-  setTimeout(function () { return display.input.focus(); }, 20)
-}
-
-// Normal selection, as opposed to text dragging.
-function leftButtonSelect(cm, e, start, type, addNew) {
-  var display = cm.display, doc = cm.doc
-  e_preventDefault(e)
-
-  var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges
-  if (addNew && !e.shiftKey) {
-    ourIndex = doc.sel.contains(start)
-    if (ourIndex > -1)
-      { ourRange = ranges[ourIndex] }
-    else
-      { ourRange = new Range(start, start) }
-  } else {
-    ourRange = doc.sel.primary()
-    ourIndex = doc.sel.primIndex
-  }
-
-  if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {
-    type = "rect"
-    if (!addNew) { ourRange = new Range(start, start) }
-    start = posFromMouse(cm, e, true, true)
-    ourIndex = -1
-  } else if (type == "double") {
-    var word = cm.findWordAt(start)
-    if (cm.display.shift || doc.extend)
-      { ourRange = extendRange(doc, ourRange, word.anchor, word.head) }
-    else
-      { ourRange = word }
-  } else if (type == "triple") {
-    var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)))
-    if (cm.display.shift || doc.extend)
-      { ourRange = extendRange(doc, ourRange, line.anchor, line.head) }
-    else
-      { ourRange = line }
-  } else {
-    ourRange = extendRange(doc, ourRange, start)
-  }
-
-  if (!addNew) {
-    ourIndex = 0
-    setSelection(doc, new Selection([ourRange], 0), sel_mouse)
-    startSel = doc.sel
-  } else if (ourIndex == -1) {
-    ourIndex = ranges.length
-    setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),
-                 {scroll: false, origin: "*mouse"})
-  } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == "single" && !e.shiftKey) {
-    setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
-                 {scroll: false, origin: "*mouse"})
-    startSel = doc.sel
-  } else {
-    replaceOneSelection(doc, ourIndex, ourRange, sel_mouse)
-  }
-
-  var lastPos = start
-  function extendTo(pos) {
-    if (cmp(lastPos, pos) == 0) { return }
-    lastPos = pos
-
-    if (type == "rect") {
-      var ranges = [], tabSize = cm.options.tabSize
-      var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize)
-      var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize)
-      var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol)
-      for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
-           line <= end; line++) {
-        var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize)
-        if (left == right)
-          { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))) }
-        else if (text.length > leftPos)
-          { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))) }
-      }
-      if (!ranges.length) { ranges.push(new Range(start, start)) }
-      setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
-                   {origin: "*mouse", scroll: false})
-      cm.scrollIntoView(pos)
-    } else {
-      var oldRange = ourRange
-      var anchor = oldRange.anchor, head = pos
-      if (type != "single") {
-        var range
-        if (type == "double")
-          { range = cm.findWordAt(pos) }
-        else
-          { range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))) }
-        if (cmp(range.anchor, anchor) > 0) {
-          head = range.head
-          anchor = minPos(oldRange.from(), range.anchor)
-        } else {
-          head = range.anchor
-          anchor = maxPos(oldRange.to(), range.head)
-        }
-      }
-      var ranges$1 = startSel.ranges.slice(0)
-      ranges$1[ourIndex] = new Range(clipPos(doc, anchor), head)
-      setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse)
-    }
-  }
-
-  var editorSize = display.wrapper.getBoundingClientRect()
-  // Used to ensure timeout re-tries don't fire when another extend
-  // happened in the meantime (clearTimeout isn't reliable -- at
-  // least on Chrome, the timeouts still happen even when cleared,
-  // if the clear happens after their scheduled firing time).
-  var counter = 0
-
-  function extend(e) {
-    var curCount = ++counter
-    var cur = posFromMouse(cm, e, true, type == "rect")
-    if (!cur) { return }
-    if (cmp(cur, lastPos) != 0) {
-      cm.curOp.focus = activeElt()
-      extendTo(cur)
-      var visible = visibleLines(display, doc)
-      if (cur.line >= visible.to || cur.line < visible.from)
-        { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e) }}), 150) }
-    } else {
-      var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0
-      if (outside) { setTimeout(operation(cm, function () {
-        if (counter != curCount) { return }
-        display.scroller.scrollTop += outside
-        extend(e)
-      }), 50) }
-    }
-  }
-
-  function done(e) {
-    cm.state.selectingText = false
-    counter = Infinity
-    e_preventDefault(e)
-    display.input.focus()
-    off(document, "mousemove", move)
-    off(document, "mouseup", up)
-    doc.history.lastSelOrigin = null
-  }
-
-  var move = operation(cm, function (e) {
-    if (!e_button(e)) { done(e) }
-    else { extend(e) }
-  })
-  var up = operation(cm, done)
-  cm.state.selectingText = up
-  on(document, "mousemove", move)
-  on(document, "mouseup", up)
-}
-
-
-// Determines whether an event happened in the gutter, and fires the
-// handlers for the corresponding event.
-function gutterEvent(cm, e, type, prevent) {
-  var mX, mY
-  try { mX = e.clientX; mY = e.clientY }
-  catch(e) { return false }
-  if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }
-  if (prevent) { e_preventDefault(e) }
-
-  var display = cm.display
-  var lineBox = display.lineDiv.getBoundingClientRect()
-
-  if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }
-  mY -= lineBox.top - display.viewOffset
-
-  for (var i = 0; i < cm.options.gutters.length; ++i) {
-    var g = display.gutters.childNodes[i]
-    if (g && g.getBoundingClientRect().right >= mX) {
-      var line = lineAtHeight(cm.doc, mY)
-      var gutter = cm.options.gutters[i]
-      signal(cm, type, cm, line, gutter, e)
-      return e_defaultPrevented(e)
-    }
-  }
-}
-
-function clickInGutter(cm, e) {
-  return gutterEvent(cm, e, "gutterClick", true)
-}
-
-// CONTEXT MENU HANDLING
-
-// To make the context menu work, we need to briefly unhide the
-// textarea (making it as unobtrusive as possible) to let the
-// right-click take effect on it.
-function onContextMenu(cm, e) {
-  if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }
-  if (signalDOMEvent(cm, e, "contextmenu")) { return }
-  cm.display.input.onContextMenu(e)
-}
-
-function contextMenuInGutter(cm, e) {
-  if (!hasHandler(cm, "gutterContextMenu")) { return false }
-  return gutterEvent(cm, e, "gutterContextMenu", false)
-}
-
-function themeChanged(cm) {
-  cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
-    cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-")
-  clearCaches(cm)
-}
-
-var Init = {toString: function(){return "CodeMirror.Init"}}
-
-var defaults = {}
-var optionHandlers = {}
-
-function defineOptions(CodeMirror) {
-  var optionHandlers = CodeMirror.optionHandlers
-
-  function option(name, deflt, handle, notOnInit) {
-    CodeMirror.defaults[name] = deflt
-    if (handle) { optionHandlers[name] =
-      notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old) }} : handle }
-  }
-
-  CodeMirror.defineOption = option
-
-  // Passed to option handlers when there is no old value.
-  CodeMirror.Init = Init
-
-  // These two are, on init, called from the constructor because they
-  // have to be initialized before the editor can start at all.
-  option("value", "", function (cm, val) { return cm.setValue(val); }, true)
-  option("mode", null, function (cm, val) {
-    cm.doc.modeOption = val
-    loadMode(cm)
-  }, true)
-
-  option("indentUnit", 2, loadMode, true)
-  option("indentWithTabs", false)
-  option("smartIndent", true)
-  option("tabSize", 4, function (cm) {
-    resetModeState(cm)
-    clearCaches(cm)
-    regChange(cm)
-  }, true)
-  option("lineSeparator", null, function (cm, val) {
-    cm.doc.lineSep = val
-    if (!val) { return }
-    var newBreaks = [], lineNo = cm.doc.first
-    cm.doc.iter(function (line) {
-      for (var pos = 0;;) {
-        var found = line.text.indexOf(val, pos)
-        if (found == -1) { break }
-        pos = found + val.length
-        newBreaks.push(Pos(lineNo, found))
-      }
-      lineNo++
-    })
-    for (var i = newBreaks.length - 1; i >= 0; i--)
-      { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)) }
-  })
-  option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g, function (cm, val, old) {
-    cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g")
-    if (old != Init) { cm.refresh() }
-  })
-  option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true)
-  option("electricChars", true)
-  option("inputStyle", mobile ? "contenteditable" : "textarea", function () {
-    throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME
-  }, true)
-  option("spellcheck", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true)
-  option("rtlMoveVisually", !windows)
-  option("wholeLineUpdateBefore", true)
-
-  option("theme", "default", function (cm) {
-    themeChanged(cm)
-    guttersChanged(cm)
-  }, true)
-  option("keyMap", "default", function (cm, val, old) {
-    var next = getKeyMap(val)
-    var prev = old != Init && getKeyMap(old)
-    if (prev && prev.detach) { prev.detach(cm, next) }
-    if (next.attach) { next.attach(cm, prev || null) }
-  })
-  option("extraKeys", null)
-
-  option("lineWrapping", false, wrappingChanged, true)
-  option("gutters", [], function (cm) {
-    setGuttersForLineNumbers(cm.options)
-    guttersChanged(cm)
-  }, true)
-  option("fixedGutter", true, function (cm, val) {
-    cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0"
-    cm.refresh()
-  }, true)
-  option("coverGutterNextToScrollbar", false, function (cm) { return updateScrollbars(cm); }, true)
-  option("scrollbarStyle", "native", function (cm) {
-    initScrollbars(cm)
-    updateScrollbars(cm)
-    cm.display.scrollbars.setScrollTop(cm.doc.scrollTop)
-    cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft)
-  }, true)
-  option("lineNumbers", false, function (cm) {
-    setGuttersForLineNumbers(cm.options)
-    guttersChanged(cm)
-  }, true)
-  option("firstLineNumber", 1, guttersChanged, true)
-  option("lineNumberFormatter", function (integer) { return integer; }, guttersChanged, true)
-  option("showCursorWhenSelecting", false, updateSelection, true)
-
-  option("resetSelectionOnContextMenu", true)
-  option("lineWiseCopyCut", true)
-
-  option("readOnly", false, function (cm, val) {
-    if (val == "nocursor") {
-      onBlur(cm)
-      cm.display.input.blur()
-      cm.display.disabled = true
-    } else {
-      cm.display.disabled = false
-    }
-    cm.display.input.readOnlyChanged(val)
-  })
-  option("disableInput", false, function (cm, val) {if (!val) { cm.display.input.reset() }}, true)
-  option("dragDrop", true, dragDropChanged)
-  option("allowDropFileTypes", null)
-
-  option("cursorBlinkRate", 530)
-  option("cursorScrollMargin", 0)
-  option("cursorHeight", 1, updateSelection, true)
-  option("singleCursorHeightPerLine", true, updateSelection, true)
-  option("workTime", 100)
-  option("workDelay", 100)
-  option("flattenSpans", true, resetModeState, true)
-  option("addModeClass", false, resetModeState, true)
-  option("pollInterval", 100)
-  option("undoDepth", 200, function (cm, val) { return cm.doc.history.undoDepth = val; })
-  option("historyEventDelay", 1250)
-  option("viewportMargin", 10, function (cm) { return cm.refresh(); }, true)
-  option("maxHighlightLength", 10000, resetModeState, true)
-  option("moveInputWithCursor", true, function (cm, val) {
-    if (!val) { cm.display.input.resetPosition() }
-  })
-
-  option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; })
-  option("autofocus", null)
-  option("direction", "ltr", function (cm, val) { return cm.doc.setDirection(val); }, true)
-}
-
-function guttersChanged(cm) {
-  updateGutters(cm)
-  regChange(cm)
-  alignHorizontally(cm)
-}
-
-function dragDropChanged(cm, value, old) {
-  var wasOn = old && old != Init
-  if (!value != !wasOn) {
-    var funcs = cm.display.dragFunctions
-    var toggle = value ? on : off
-    toggle(cm.display.scroller, "dragstart", funcs.start)
-    toggle(cm.display.scroller, "dragenter", funcs.enter)
-    toggle(cm.display.scroller, "dragover", funcs.over)
-    toggle(cm.display.scroller, "dragleave", funcs.leave)
-    toggle(cm.display.scroller, "drop", funcs.drop)
-  }
-}
-
-function wrappingChanged(cm) {
-  if (cm.options.lineWrapping) {
-    addClass(cm.display.wrapper, "CodeMirror-wrap")
-    cm.display.sizer.style.minWidth = ""
-    cm.display.sizerWidth = null
-  } else {
-    rmClass(cm.display.wrapper, "CodeMirror-wrap")
-    findMaxLine(cm)
-  }
-  estimateLineHeights(cm)
-  regChange(cm)
-  clearCaches(cm)
-  setTimeout(function () { return updateScrollbars(cm); }, 100)
-}
-
-// A CodeMirror instance represents an editor. This is the object
-// that user code is usually dealing with.
-
-function CodeMirror(place, options) {
-  var this$1 = this;
-
-  if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }
-
-  this.options = options = options ? copyObj(options) : {}
-  // Determine effective options based on given values and defaults.
-  copyObj(defaults, options, false)
-  setGuttersForLineNumbers(options)
-
-  var doc = options.value
-  if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction) }
-  this.doc = doc
-
-  var input = new CodeMirror.inputStyles[options.inputStyle](this)
-  var display = this.display = new Display(place, doc, input)
-  display.wrapper.CodeMirror = this
-  updateGutters(this)
-  themeChanged(this)
-  if (options.lineWrapping)
-    { this.display.wrapper.className += " CodeMirror-wrap" }
-  initScrollbars(this)
-
-  this.state = {
-    keyMaps: [],  // stores maps added by addKeyMap
-    overlays: [], // highlighting overlays, as added by addOverlay
-    modeGen: 0,   // bumped when mode/overlay changes, used to invalidate highlighting info
-    overwrite: false,
-    delayingBlurEvent: false,
-    focused: false,
-    suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
-    pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll
-    selectingText: false,
-    draggingText: false,
-    highlight: new Delayed(), // stores highlight worker timeout
-    keySeq: null,  // Unfinished key sequence
-    specialChars: null
-  }
-
-  if (options.autofocus && !mobile) { display.input.focus() }
-
-  // Override magic textarea content restore that IE sometimes does
-  // on our hidden textarea on reload
-  if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20) }
-
-  registerEventHandlers(this)
-  ensureGlobalHandlers()
-
-  startOperation(this)
-  this.curOp.forceUpdate = true
-  attachDoc(this, doc)
-
-  if ((options.autofocus && !mobile) || this.hasFocus())
-    { setTimeout(bind(onFocus, this), 20) }
-  else
-    { onBlur(this) }
-
-  for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))
-    { optionHandlers[opt](this$1, options[opt], Init) } }
-  maybeUpdateLineNumberWidth(this)
-  if (options.finishInit) { options.finishInit(this) }
-  for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1) }
-  endOperation(this)
-  // Suppress optimizelegibility in Webkit, since it breaks text
-  // measuring on line wrapping boundaries.
-  if (webkit && options.lineWrapping &&
-      getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
-    { display.lineDiv.style.textRendering = "auto" }
-}
-
-// The default configuration options.
-CodeMirror.defaults = defaults
-// Functions to run when options are changed.
-CodeMirror.optionHandlers = optionHandlers
-
-// Attach the necessary event handlers when initializing the editor
-function registerEventHandlers(cm) {
-  var d = cm.display
-  on(d.scroller, "mousedown", operation(cm, onMouseDown))
-  // Older IE's will not fire a second mousedown for a double click
-  if (ie && ie_version < 11)
-    { on(d.scroller, "dblclick", operation(cm, function (e) {
-      if (signalDOMEvent(cm, e)) { return }
-      var pos = posFromMouse(cm, e)
-      if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }
-      e_preventDefault(e)
-      var word = cm.findWordAt(pos)
-      extendSelection(cm.doc, word.anchor, word.head)
-    })) }
-  else
-    { on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }) }
-  // Some browsers fire contextmenu *after* opening the menu, at
-  // which point we can't mess with it anymore. Context menu is
-  // handled in onMouseDown for these browsers.
-  if (!captureRightClick) { on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); }) }
-
-  // Used to suppress mouse event handling when a touch happens
-  var touchFinished, prevTouch = {end: 0}
-  function finishTouch() {
-    if (d.activeTouch) {
-      touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000)
-      prevTouch = d.activeTouch
-      prevTouch.end = +new Date
-    }
-  }
-  function isMouseLikeTouchEvent(e) {
-    if (e.touches.length != 1) { return false }
-    var touch = e.touches[0]
-    return touch.radiusX <= 1 && touch.radiusY <= 1
-  }
-  function farAway(touch, other) {
-    if (other.left == null) { return true }
-    var dx = other.left - touch.left, dy = other.top - touch.top
-    return dx * dx + dy * dy > 20 * 20
-  }
-  on(d.scroller, "touchstart", function (e) {
-    if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e)) {
-      d.input.ensurePolled()
-      clearTimeout(touchFinished)
-      var now = +new Date
-      d.activeTouch = {start: now, moved: false,
-                       prev: now - prevTouch.end <= 300 ? prevTouch : null}
-      if (e.touches.length == 1) {
-        d.activeTouch.left = e.touches[0].pageX
-        d.activeTouch.top = e.touches[0].pageY
-      }
-    }
-  })
-  on(d.scroller, "touchmove", function () {
-    if (d.activeTouch) { d.activeTouch.moved = true }
-  })
-  on(d.scroller, "touchend", function (e) {
-    var touch = d.activeTouch
-    if (touch && !eventInWidget(d, e) && touch.left != null &&
-        !touch.moved && new Date - touch.start < 300) {
-      var pos = cm.coordsChar(d.activeTouch, "page"), range
-      if (!touch.prev || farAway(touch, touch.prev)) // Single tap
-        { range = new Range(pos, pos) }
-      else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap
-        { range = cm.findWordAt(pos) }
-      else // Triple tap
-        { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))) }
-      cm.setSelection(range.anchor, range.head)
-      cm.focus()
-      e_preventDefault(e)
-    }
-    finishTouch()
-  })
-  on(d.scroller, "touchcancel", finishTouch)
-
-  // Sync scrolling between fake scrollbars and real scrollable
-  // area, ensure viewport is updated when scrolling.
-  on(d.scroller, "scroll", function () {
-    if (d.scroller.clientHeight) {
-      setScrollTop(cm, d.scroller.scrollTop)
-      setScrollLeft(cm, d.scroller.scrollLeft, true)
-      signal(cm, "scroll", cm)
-    }
-  })
-
-  // Listen to wheel events in order to try and update the viewport on time.
-  on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); })
-  on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); })
-
-  // Prevent wrapper from ever scrolling
-  on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; })
-
-  d.dragFunctions = {
-    enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e) }},
-    over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e) }},
-    start: function (e) { return onDragStart(cm, e); },
-    drop: operation(cm, onDrop),
-    leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm) }}
-  }
-
-  var inp = d.input.getField()
-  on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); })
-  on(inp, "keydown", operation(cm, onKeyDown))
-  on(inp, "keypress", operation(cm, onKeyPress))
-  on(inp, "focus", function (e) { return onFocus(cm, e); })
-  on(inp, "blur", function (e) { return onBlur(cm, e); })
-}
-
-var initHooks = []
-CodeMirror.defineInitHook = function (f) { return initHooks.push(f); }
-
-// Indent the given line. The how parameter can be "smart",
-// "add"/null, "subtract", or "prev". When aggressive is false
-// (typically set to true for forced single-line indents), empty
-// lines are not indented, and places where the mode returns Pass
-// are left alone.
-function indentLine(cm, n, how, aggressive) {
-  var doc = cm.doc, state
-  if (how == null) { how = "add" }
-  if (how == "smart") {
-    // Fall back to "prev" when the mode doesn't have an indentation
-    // method.
-    if (!doc.mode.indent) { how = "prev" }
-    else { state = getStateBefore(cm, n) }
-  }
-
-  var tabSize = cm.options.tabSize
-  var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize)
-  if (line.stateAfter) { line.stateAfter = null }
-  var curSpaceString = line.text.match(/^\s*/)[0], indentation
-  if (!aggressive && !/\S/.test(line.text)) {
-    indentation = 0
-    how = "not"
-  } else if (how == "smart") {
-    indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text)
-    if (indentation == Pass || indentation > 150) {
-      if (!aggressive) { return }
-      how = "prev"
-    }
-  }
-  if (how == "prev") {
-    if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize) }
-    else { indentation = 0 }
-  } else if (how == "add") {
-    indentation = curSpace + cm.options.indentUnit
-  } else if (how == "subtract") {
-    indentation = curSpace - cm.options.indentUnit
-  } else if (typeof how == "number") {
-    indentation = curSpace + how
-  }
-  indentation = Math.max(0, indentation)
-
-  var indentString = "", pos = 0
-  if (cm.options.indentWithTabs)
-    { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t"} }
-  if (pos < indentation) { indentString += spaceStr(indentation - pos) }
-
-  if (indentString != curSpaceString) {
-    replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input")
-    line.stateAfter = null
-    return true
-  } else {
-    // Ensure that, if the cursor was in the whitespace at the start
-    // of the line, it is moved to the end of that space.
-    for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {
-      var range = doc.sel.ranges[i$1]
-      if (range.head.line == n && range.head.ch < curSpaceString.length) {
-        var pos$1 = Pos(n, curSpaceString.length)
-        replaceOneSelection(doc, i$1, new Range(pos$1, pos$1))
-        break
-      }
-    }
-  }
-}
-
-// This will be set to a {lineWise: bool, text: [string]} object, so
-// that, when pasting, we know what kind of selections the copied
-// text was made out of.
-var lastCopied = null
-
-function setLastCopied(newLastCopied) {
-  lastCopied = newLastCopied
-}
-
-function applyTextInput(cm, inserted, deleted, sel, origin) {
-  var doc = cm.doc
-  cm.display.shift = false
-  if (!sel) { sel = doc.sel }
-
-  var paste = cm.state.pasteIncoming || origin == "paste"
-  var textLines = splitLinesAuto(inserted), multiPaste = null
-  // When pasing N lines into N selections, insert one line per selection
-  if (paste && sel.ranges.length > 1) {
-    if (lastCopied && lastCopied.text.join("\n") == inserted) {
-      if (sel.ranges.length % lastCopied.text.length == 0) {
-        multiPaste = []
-        for (var i = 0; i < lastCopied.text.length; i++)
-          { multiPaste.push(doc.splitLines(lastCopied.text[i])) }
-      }
-    } else if (textLines.length == sel.ranges.length) {
-      multiPaste = map(textLines, function (l) { return [l]; })
-    }
-  }
-
-  var updateInput
-  // Normal behavior is to insert the new text into every selection
-  for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {
-    var range = sel.ranges[i$1]
-    var from = range.from(), to = range.to()
-    if (range.empty()) {
-      if (deleted && deleted > 0) // Handle deletion
-        { from = Pos(from.line, from.ch - deleted) }
-      else if (cm.state.overwrite && !paste) // Handle overwrite
-        { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)) }
-      else if (lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == inserted)
-        { from = to = Pos(from.line, 0) }
-    }
-    updateInput = cm.curOp.updateInput
-    var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,
-                       origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")}
-    makeChange(cm.doc, changeEvent)
-    signalLater(cm, "inputRead", cm, changeEvent)
-  }
-  if (inserted && !paste)
-    { triggerElectric(cm, inserted) }
-
-  ensureCursorVisible(cm)
-  cm.curOp.updateInput = updateInput
-  cm.curOp.typing = true
-  cm.state.pasteIncoming = cm.state.cutIncoming = false
-}
-
-function handlePaste(e, cm) {
-  var pasted = e.clipboardData && e.clipboardData.getData("Text")
-  if (pasted) {
-    e.preventDefault()
-    if (!cm.isReadOnly() && !cm.options.disableInput)
-      { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }) }
-    return true
-  }
-}
-
-function triggerElectric(cm, inserted) {
-  // When an 'electric' character is inserted, immediately trigger a reindent
-  if (!cm.options.electricChars || !cm.options.smartIndent) { return }
-  var sel = cm.doc.sel
-
-  for (var i = sel.ranges.length - 1; i >= 0; i--) {
-    var range = sel.ranges[i]
-    if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) { continue }
-    var mode = cm.getModeAt(range.head)
-    var indented = false
-    if (mode.electricChars) {
-      for (var j = 0; j < mode.electricChars.length; j++)
-        { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
-          indented = indentLine(cm, range.head.line, "smart")
-          break
-        } }
-    } else if (mode.electricInput) {
-      if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))
-        { indented = indentLine(cm, range.head.line, "smart") }
-    }
-    if (indented) { signalLater(cm, "electricInput", cm, range.head.line) }
-  }
-}
-
-function copyableRanges(cm) {
-  var text = [], ranges = []
-  for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
-    var line = cm.doc.sel.ranges[i].head.line
-    var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)}
-    ranges.push(lineRange)
-    text.push(cm.getRange(lineRange.anchor, lineRange.head))
-  }
-  return {text: text, ranges: ranges}
-}
-
-function disableBrowserMagic(field, spellcheck) {
-  field.setAttribute("autocorrect", "off")
-  field.setAttribute("autocapitalize", "off")
-  field.setAttribute("spellcheck", !!spellcheck)
-}
-
-function hiddenTextarea() {
-  var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none")
-  var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;")
-  // The textarea is kept positioned near the cursor to prevent the
-  // fact that it'll be scrolled into view on input from scrolling
-  // our fake cursor out of view. On webkit, when wrap=off, paste is
-  // very slow. So make the area wide instead.
-  if (webkit) { te.style.width = "1000px" }
-  else { te.setAttribute("wrap", "off") }
-  // If border: 0; -- iOS fails to open keyboard (issue #1287)
-  if (ios) { te.style.border = "1px solid black" }
-  disableBrowserMagic(te)
-  return div
-}
-
-// The publicly visible API. Note that methodOp(f) means
-// 'wrap f in an operation, performed on its `this` parameter'.
-
-// This is not the complete set of editor methods. Most of the
-// methods defined on the Doc type are also injected into
-// CodeMirror.prototype, for backwards compatibility and
-// convenience.
-
-function addEditorMethods(CodeMirror) {
-  var optionHandlers = CodeMirror.optionHandlers
-
-  var helpers = CodeMirror.helpers = {}
-
-  CodeMirror.prototype = {
-    constructor: CodeMirror,
-    focus: function(){window.focus(); this.display.input.focus()},
-
-    setOption: function(option, value) {
-      var options = this.options, old = options[option]
-      if (options[option] == value && option != "mode") { return }
-      options[option] = value
-      if (optionHandlers.hasOwnProperty(option))
-        { operation(this, optionHandlers[option])(this, value, old) }
-      signal(this, "optionChange", this, option)
-    },
-
-    getOption: function(option) {return this.options[option]},
-    getDoc: function() {return this.doc},
-
-    addKeyMap: function(map, bottom) {
-      this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map))
-    },
-    removeKeyMap: function(map) {
-      var maps = this.state.keyMaps
-      for (var i = 0; i < maps.length; ++i)
-        { if (maps[i] == map || maps[i].name == map) {
-          maps.splice(i, 1)
-          return true
-        } }
-    },
-
-    addOverlay: methodOp(function(spec, options) {
-      var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec)
-      if (mode.startState) { throw new Error("Overlays may not be stateful.") }
-      insertSorted(this.state.overlays,
-                   {mode: mode, modeSpec: spec, opaque: options && options.opaque,
-                    priority: (options && options.priority) || 0},
-                   function (overlay) { return overlay.priority; })
-      this.state.modeGen++
-      regChange(this)
-    }),
-    removeOverlay: methodOp(function(spec) {
-      var this$1 = this;
-
-      var overlays = this.state.overlays
-      for (var i = 0; i < overlays.length; ++i) {
-        var cur = overlays[i].modeSpec
-        if (cur == spec || typeof spec == "string" && cur.name == spec) {
-          overlays.splice(i, 1)
-          this$1.state.modeGen++
-          regChange(this$1)
-          return
-        }
-      }
-    }),
-
-    indentLine: methodOp(function(n, dir, aggressive) {
-      if (typeof dir != "string" && typeof dir != "number") {
-        if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev" }
-        else { dir = dir ? "add" : "subtract" }
-      }
-      if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive) }
-    }),
-    indentSelection: methodOp(function(how) {
-      var this$1 = this;
-
-      var ranges = this.doc.sel.ranges, end = -1
-      for (var i = 0; i < ranges.length; i++) {
-        var range = ranges[i]
-        if (!range.empty()) {
-          var from = range.from(), to = range.to()
-          var start = Math.max(end, from.line)
-          end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1
-          for (var j = start; j < end; ++j)
-            { indentLine(this$1, j, how) }
-          var newRanges = this$1.doc.sel.ranges
-          if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
-            { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll) }
-        } else if (range.head.line > end) {
-          indentLine(this$1, range.head.line, how, true)
-          end = range.head.line
-          if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1) }
-        }
-      }
-    }),
-
-    // Fetch the parser token for a given character. Useful for hacks
-    // that want to inspect the mode state (say, for completion).
-    getTokenAt: function(pos, precise) {
-      return takeToken(this, pos, precise)
-    },
-
-    getLineTokens: function(line, precise) {
-      return takeToken(this, Pos(line), precise, true)
-    },
-
-    getTokenTypeAt: function(pos) {
-      pos = clipPos(this.doc, pos)
-      var styles = getLineStyles(this, getLine(this.doc, pos.line))
-      var before = 0, after = (styles.length - 1) / 2, ch = pos.ch
-      var type
-      if (ch == 0) { type = styles[2] }
-      else { for (;;) {
-        var mid = (before + after) >> 1
-        if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid }
-        else if (styles[mid * 2 + 1] < ch) { before = mid + 1 }
-        else { type = styles[mid * 2 + 2]; break }
-      } }
-      var cut = type ? type.indexOf("overlay ") : -1
-      return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)
-    },
-
-    getModeAt: function(pos) {
-      var mode = this.doc.mode
-      if (!mode.innerMode) { return mode }
-      return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode
-    },
-
-    getHelper: function(pos, type) {
-      return this.getHelpers(pos, type)[0]
-    },
-
-    getHelpers: function(pos, type) {
-      var this$1 = this;
-
-      var found = []
-      if (!helpers.hasOwnProperty(type)) { return found }
-      var help = helpers[type], mode = this.getModeAt(pos)
-      if (typeof mode[type] == "string") {
-        if (help[mode[type]]) { found.push(help[mode[type]]) }
-      } else if (mode[type]) {
-        for (var i = 0; i < mode[type].length; i++) {
-          var val = help[mode[type][i]]
-          if (val) { found.push(val) }
-        }
-      } else if (mode.helperType && help[mode.helperType]) {
-        found.push(help[mode.helperType])
-      } else if (help[mode.name]) {
-        found.push(help[mode.name])
-      }
-      for (var i$1 = 0; i$1 < help._global.length; i$1++) {
-        var cur = help._global[i$1]
-        if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)
-          { found.push(cur.val) }
-      }
-      return found
-    },
-
-    getStateAfter: function(line, precise) {
-      var doc = this.doc
-      line = clipLine(doc, line == null ? doc.first + doc.size - 1: line)
-      return getStateBefore(this, line + 1, precise)
-    },
-
-    cursorCoords: function(start, mode) {
-      var pos, range = this.doc.sel.primary()
-      if (start == null) { pos = range.head }
-      else if (typeof start == "object") { pos = clipPos(this.doc, start) }
-      else { pos = start ? range.from() : range.to() }
-      return cursorCoords(this, pos, mode || "page")
-    },
-
-    charCoords: function(pos, mode) {
-      return charCoords(this, clipPos(this.doc, pos), mode || "page")
-    },
-
-    coordsChar: function(coords, mode) {
-      coords = fromCoordSystem(this, coords, mode || "page")
-      return coordsChar(this, coords.left, coords.top)
-    },
-
-    lineAtHeight: function(height, mode) {
-      height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top
-      return lineAtHeight(this.doc, height + this.display.viewOffset)
-    },
-    heightAtLine: function(line, mode, includeWidgets) {
-      var end = false, lineObj
-      if (typeof line == "number") {
-        var last = this.doc.first + this.doc.size - 1
-        if (line < this.doc.first) { line = this.doc.first }
-        else if (line > last) { line = last; end = true }
-        lineObj = getLine(this.doc, line)
-      } else {
-        lineObj = line
-      }
-      return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top +
-        (end ? this.doc.height - heightAtLine(lineObj) : 0)
-    },
-
-    defaultTextHeight: function() { return textHeight(this.display) },
-    defaultCharWidth: function() { return charWidth(this.display) },
-
-    getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},
-
-    addWidget: function(pos, node, scroll, vert, horiz) {
-      var display = this.display
-      pos = cursorCoords(this, clipPos(this.doc, pos))
-      var top = pos.bottom, left = pos.left
-      node.style.position = "absolute"
-      node.setAttribute("cm-ignore-events", "true")
-      this.display.input.setUneditable(node)
-      display.sizer.appendChild(node)
-      if (vert == "over") {
-        top = pos.top
-      } else if (vert == "above" || vert == "near") {
-        var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
-        hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth)
-        // Default to positioning above (if specified and possible); otherwise default to positioning below
-        if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
-          { top = pos.top - node.offsetHeight }
-        else if (pos.bottom + node.offsetHeight <= vspace)
-          { top = pos.bottom }
-        if (left + node.offsetWidth > hspace)
-          { left = hspace - node.offsetWidth }
-      }
-      node.style.top = top + "px"
-      node.style.left = node.style.right = ""
-      if (horiz == "right") {
-        left = display.sizer.clientWidth - node.offsetWidth
-        node.style.right = "0px"
-      } else {
-        if (horiz == "left") { left = 0 }
-        else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2 }
-        node.style.left = left + "px"
-      }
-      if (scroll)
-        { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}) }
-    },
-
-    triggerOnKeyDown: methodOp(onKeyDown),
-    triggerOnKeyPress: methodOp(onKeyPress),
-    triggerOnKeyUp: onKeyUp,
-
-    execCommand: function(cmd) {
-      if (commands.hasOwnProperty(cmd))
-        { return commands[cmd].call(null, this) }
-    },
-
-    triggerElectric: methodOp(function(text) { triggerElectric(this, text) }),
-
-    findPosH: function(from, amount, unit, visually) {
-      var this$1 = this;
-
-      var dir = 1
-      if (amount < 0) { dir = -1; amount = -amount }
-      var cur = clipPos(this.doc, from)
-      for (var i = 0; i < amount; ++i) {
-        cur = findPosH(this$1.doc, cur, dir, unit, visually)
-        if (cur.hitSide) { break }
-      }
-      return cur
-    },
-
-    moveH: methodOp(function(dir, unit) {
-      var this$1 = this;
-
-      this.extendSelectionsBy(function (range) {
-        if (this$1.display.shift || this$1.doc.extend || range.empty())
-          { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }
-        else
-          { return dir < 0 ? range.from() : range.to() }
-      }, sel_move)
-    }),
-
-    deleteH: methodOp(function(dir, unit) {
-      var sel = this.doc.sel, doc = this.doc
-      if (sel.somethingSelected())
-        { doc.replaceSelection("", null, "+delete") }
-      else
-        { deleteNearSelection(this, function (range) {
-          var other = findPosH(doc, range.head, dir, unit, false)
-          return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}
-        }) }
-    }),
-
-    findPosV: function(from, amount, unit, goalColumn) {
-      var this$1 = this;
-
-      var dir = 1, x = goalColumn
-      if (amount < 0) { dir = -1; amount = -amount }
-      var cur = clipPos(this.doc, from)
-      for (var i = 0; i < amount; ++i) {
-        var coords = cursorCoords(this$1, cur, "div")
-        if (x == null) { x = coords.left }
-        else { coords.left = x }
-        cur = findPosV(this$1, coords, dir, unit)
-        if (cur.hitSide) { break }
-      }
-      return cur
-    },
-
-    moveV: methodOp(function(dir, unit) {
-      var this$1 = this;
-
-      var doc = this.doc, goals = []
-      var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected()
-      doc.extendSelectionsBy(function (range) {
-        if (collapse)
-          { return dir < 0 ? range.from() : range.to() }
-        var headPos = cursorCoords(this$1, range.head, "div")
-        if (range.goalColumn != null) { headPos.left = range.goalColumn }
-        goals.push(headPos.left)
-        var pos = findPosV(this$1, headPos, dir, unit)
-        if (unit == "page" && range == doc.sel.primary())
-          { addToScrollPos(this$1, null, charCoords(this$1, pos, "div").top - headPos.top) }
-        return pos
-      }, sel_move)
-      if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)
-        { doc.sel.ranges[i].goalColumn = goals[i] } }
-    }),
-
-    // Find the word at the given position (as returned by coordsChar).
-    findWordAt: function(pos) {
-      var doc = this.doc, line = getLine(doc, pos.line).text
-      var start = pos.ch, end = pos.ch
-      if (line) {
-        var helper = this.getHelper(pos, "wordChars")
-        if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end }
-        var startChar = line.charAt(start)
-        var check = isWordChar(startChar, helper)
-          ? function (ch) { return isWordChar(ch, helper); }
-          : /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); }
-          : function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); }
-        while (start > 0 && check(line.charAt(start - 1))) { --start }
-        while (end < line.length && check(line.charAt(end))) { ++end }
-      }
-      return new Range(Pos(pos.line, start), Pos(pos.line, end))
-    },
-
-    toggleOverwrite: function(value) {
-      if (value != null && value == this.state.overwrite) { return }
-      if (this.state.overwrite = !this.state.overwrite)
-        { addClass(this.display.cursorDiv, "CodeMirror-overwrite") }
-      else
-        { rmClass(this.display.cursorDiv, "CodeMirror-overwrite") }
-
-      signal(this, "overwriteToggle", this, this.state.overwrite)
-    },
-    hasFocus: function() { return this.display.input.getField() == activeElt() },
-    isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },
-
-    scrollTo: methodOp(function(x, y) {
-      if (x != null || y != null) { resolveScrollToPos(this) }
-      if (x != null) { this.curOp.scrollLeft = x }
-      if (y != null) { this.curOp.scrollTop = y }
-    }),
-    getScrollInfo: function() {
-      var scroller = this.display.scroller
-      return {left: scroller.scrollLeft, top: scroller.scrollTop,
-              height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,
-              width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,
-              clientHeight: displayHeight(this), clientWidth: displayWidth(this)}
-    },
-
-    scrollIntoView: methodOp(function(range, margin) {
-      if (range == null) {
-        range = {from: this.doc.sel.primary().head, to: null}
-        if (margin == null) { margin = this.options.cursorScrollMargin }
-      } else if (typeof range == "number") {
-        range = {from: Pos(range, 0), to: null}
-      } else if (range.from == null) {
-        range = {from: range, to: null}
-      }
-      if (!range.to) { range.to = range.from }
-      range.margin = margin || 0
-
-      if (range.from.line != null) {
-        resolveScrollToPos(this)
-        this.curOp.scrollToPos = range
-      } else {
-        var sPos = calculateScrollPos(this, {
-          left: Math.min(range.from.left, range.to.left),
-          top: Math.min(range.from.top, range.to.top) - range.margin,
-          right: Math.max(range.from.right, range.to.right),
-          bottom: Math.max(range.from.bottom, range.to.bottom) + range.margin
-        })
-        this.scrollTo(sPos.scrollLeft, sPos.scrollTop)
-      }
-    }),
-
-    setSize: methodOp(function(width, height) {
-      var this$1 = this;
-
-      var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; }
-      if (width != null) { this.display.wrapper.style.width = interpret(width) }
-      if (height != null) { this.display.wrapper.style.height = interpret(height) }
-      if (this.options.lineWrapping) { clearLineMeasurementCache(this) }
-      var lineNo = this.display.viewFrom
-      this.doc.iter(lineNo, this.display.viewTo, function (line) {
-        if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)
-          { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, "widget"); break } } }
-        ++lineNo
-      })
-      this.curOp.forceUpdate = true
-      signal(this, "refresh", this)
-    }),
-
-    operation: function(f){return runInOp(this, f)},
-
-    refresh: methodOp(function() {
-      var oldHeight = this.display.cachedTextHeight
-      regChange(this)
-      this.curOp.forceUpdate = true
-      clearCaches(this)
-      this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop)
-      updateGutterSpace(this)
-      if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)
-        { estimateLineHeights(this) }
-      signal(this, "refresh", this)
-    }),
-
-    swapDoc: methodOp(function(doc) {
-      var old = this.doc
-      old.cm = null
-      attachDoc(this, doc)
-      clearCaches(this)
-      this.display.input.reset()
-      this.scrollTo(doc.scrollLeft, doc.scrollTop)
-      this.curOp.forceScroll = true
-      signalLater(this, "swapDoc", this, old)
-      return old
-    }),
-
-    getInputField: function(){return this.display.input.getField()},
-    getWrapperElement: function(){return this.display.wrapper},
-    getScrollerElement: function(){return this.display.scroller},
-    getGutterElement: function(){return this.display.gutters}
-  }
-  eventMixin(CodeMirror)
-
-  CodeMirror.registerHelper = function(type, name, value) {
-    if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []} }
-    helpers[type][name] = value
-  }
-  CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {
-    CodeMirror.registerHelper(type, name, value)
-    helpers[type]._global.push({pred: predicate, val: value})
-  }
-}
-
-// Used for horizontal relative motion. Dir is -1 or 1 (left or
-// right), unit can be "char", "column" (like char, but doesn't
-// cross line boundaries), "word" (across next word), or "group" (to
-// the start of next group of word or non-word-non-whitespace
-// chars). The visually param controls whether, in right-to-left
-// text, direction 1 means to move towards the next index in the
-// string, or towards the character to the right of the current
-// position. The resulting position will have a hitSide=true
-// property if it reached the end of the document.
-function findPosH(doc, pos, dir, unit, visually) {
-  var oldPos = pos
-  var origDir = dir
-  var lineObj = getLine(doc, pos.line)
-  function findNextLine() {
-    var l = pos.line + dir
-    if (l < doc.first || l >= doc.first + doc.size) { return false }
-    pos = new Pos(l, pos.ch, pos.sticky)
-    return lineObj = getLine(doc, l)
-  }
-  function moveOnce(boundToLine) {
-    var next
-    if (visually) {
-      next = moveVisually(doc.cm, lineObj, pos, dir)
-    } else {
-      next = moveLogically(lineObj, pos, dir)
-    }
-    if (next == null) {
-      if (!boundToLine && findNextLine())
-        { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir) }
-      else
-        { return false }
-    } else {
-      pos = next
-    }
-    return true
-  }
-
-  if (unit == "char") {
-    moveOnce()
-  } else if (unit == "column") {
-    moveOnce(true)
-  } else if (unit == "word" || unit == "group") {
-    var sawType = null, group = unit == "group"
-    var helper = doc.cm && doc.cm.getHelper(pos, "wordChars")
-    for (var first = true;; first = false) {
-      if (dir < 0 && !moveOnce(!first)) { break }
-      var cur = lineObj.text.charAt(pos.ch) || "\n"
-      var type = isWordChar(cur, helper) ? "w"
-        : group && cur == "\n" ? "n"
-        : !group || /\s/.test(cur) ? null
-        : "p"
-      if (group && !first && !type) { type = "s" }
-      if (sawType && sawType != type) {
-        if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after"}
-        break
-      }
-
-      if (type) { sawType = type }
-      if (dir > 0 && !moveOnce(!first)) { break }
-    }
-  }
-  var result = skipAtomic(doc, pos, oldPos, origDir, true)
-  if (equalCursorPos(oldPos, result)) { result.hitSide = true }
-  return result
-}
-
-// For relative vertical movement. Dir may be -1 or 1. Unit can be
-// "page" or "line". The resulting position will have a hitSide=true
-// property if it reached the end of the document.
-function findPosV(cm, pos, dir, unit) {
-  var doc = cm.doc, x = pos.left, y
-  if (unit == "page") {
-    var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight)
-    var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3)
-    y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount
-
-  } else if (unit == "line") {
-    y = dir > 0 ? pos.bottom + 3 : pos.top - 3
-  }
-  var target
-  for (;;) {
-    target = coordsChar(cm, x, y)
-    if (!target.outside) { break }
-    if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }
-    y += dir * 5
-  }
-  return target
-}
-
-// CONTENTEDITABLE INPUT STYLE
-
-var ContentEditableInput = function(cm) {
-  this.cm = cm
-  this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null
-  this.polling = new Delayed()
-  this.composing = null
-  this.gracePeriod = false
-  this.readDOMTimeout = null
-};
-
-ContentEditableInput.prototype.init = function (display) {
-    var this$1 = this;
-
-  var input = this, cm = input.cm
-  var div = input.div = display.lineDiv
-  disableBrowserMagic(div, cm.options.spellcheck)
-
-  on(div, "paste", function (e) {
-    if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
-    // IE doesn't fire input events, so we schedule a read for the pasted content in this way
-    if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20) }
-  })
-
-  on(div, "compositionstart", function (e) {
-    this$1.composing = {data: e.data, done: false}
-  })
-  on(div, "compositionupdate", function (e) {
-    if (!this$1.composing) { this$1.composing = {data: e.data, done: false} }
-  })
-  on(div, "compositionend", function (e) {
-    if (this$1.composing) {
-      if (e.data != this$1.composing.data) { this$1.readFromDOMSoon() }
-      this$1.composing.done = true
-    }
-  })
-
-  on(div, "touchstart", function () { return input.forceCompositionEnd(); })
-
-  on(div, "input", function () {
-    if (!this$1.composing) { this$1.readFromDOMSoon() }
-  })
-
-  function onCopyCut(e) {
-    if (signalDOMEvent(cm, e)) { return }
-    if (cm.somethingSelected()) {
-      setLastCopied({lineWise: false, text: cm.getSelections()})
-      if (e.type == "cut") { cm.replaceSelection("", null, "cut") }
-    } else if (!cm.options.lineWiseCopyCut) {
-      return
-    } else {
-      var ranges = copyableRanges(cm)
-      setLastCopied({lineWise: true, text: ranges.text})
-      if (e.type == "cut") {
-        cm.operation(function () {
-          cm.setSelections(ranges.ranges, 0, sel_dontScroll)
-          cm.replaceSelection("", null, "cut")
-        })
-      }
-    }
-    if (e.clipboardData) {
-      e.clipboardData.clearData()
-      var content = lastCopied.text.join("\n")
-      // iOS exposes the clipboard API, but seems to discard content inserted into it
-      e.clipboardData.setData("Text", content)
-      if (e.clipboardData.getData("Text") == content) {
-        e.preventDefault()
-        return
-      }
-    }
-    // Old-fashioned briefly-focus-a-textarea hack
-    var kludge = hiddenTextarea(), te = kludge.firstChild
-    cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild)
-    te.value = lastCopied.text.join("\n")
-    var hadFocus = document.activeElement
-    selectInput(te)
-    setTimeout(function () {
-      cm.display.lineSpace.removeChild(kludge)
-      hadFocus.focus()
-      if (hadFocus == div) { input.showPrimarySelection() }
-    }, 50)
-  }
-  on(div, "copy", onCopyCut)
-  on(div, "cut", onCopyCut)
-};
-
-ContentEditableInput.prototype.prepareSelection = function () {
-  var result = prepareSelection(this.cm, false)
-  result.focus = this.cm.state.focused
-  return result
-};
-
-ContentEditableInput.prototype.showSelection = function (info, takeFocus) {
-  if (!info || !this.cm.display.view.length) { return }
-  if (info.focus || takeFocus) { this.showPrimarySelection() }
-  this.showMultipleSelections(info)
-};
-
-ContentEditableInput.prototype.showPrimarySelection = function () {
-  var sel = window.getSelection(), cm = this.cm, prim = cm.doc.sel.primary()
-  var from = prim.from(), to = prim.to()
-
-  if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) {
-    sel.removeAllRanges()
-    return
-  }
-
-  var curAnchor = domToPos(cm, sel.anchorNode, sel.anchorOffset)
-  var curFocus = domToPos(cm, sel.focusNode, sel.focusOffset)
-  if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&
-      cmp(minPos(curAnchor, curFocus), from) == 0 &&
-      cmp(maxPos(curAnchor, curFocus), to) == 0)
-    { return }
-
-  var view = cm.display.view
-  var start = (from.line >= cm.display.viewFrom && posToDOM(cm, from)) ||
-      {node: view[0].measure.map[2], offset: 0}
-  var end = to.line < cm.display.viewTo && posToDOM(cm, to)
-  if (!end) {
-    var measure = view[view.length - 1].measure
-    var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map
-    end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]}
-  }
-
-  if (!start || !end) {
-    sel.removeAllRanges()
-    return
-  }
-
-  var old = sel.rangeCount && sel.getRangeAt(0), rng
-  try { rng = range(start.node, start.offset, end.offset, end.node) }
-  catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
-  if (rng) {
-    if (!gecko && cm.state.focused) {
-      sel.collapse(start.node, start.offset)
-      if (!rng.collapsed) {
-        sel.removeAllRanges()
-        sel.addRange(rng)
-      }
-    } else {
-      sel.removeAllRanges()
-      sel.addRange(rng)
-    }
-    if (old && sel.anchorNode == null) { sel.addRange(old) }
-    else if (gecko) { this.startGracePeriod() }
-  }
-  this.rememberSelection()
-};
-
-ContentEditableInput.prototype.startGracePeriod = function () {
-    var this$1 = this;
-
-  clearTimeout(this.gracePeriod)
-  this.gracePeriod = setTimeout(function () {
-    this$1.gracePeriod = false
-    if (this$1.selectionChanged())
-      { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }) }
-  }, 20)
-};
-
-ContentEditableInput.prototype.showMultipleSelections = function (info) {
-  removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors)
-  removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection)
-};
-
-ContentEditableInput.prototype.rememberSelection = function () {
-  var sel = window.getSelection()
-  this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset
-  this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset
-};
-
-ContentEditableInput.prototype.selectionInEditor = function () {
-  var sel = window.getSelection()
-  if (!sel.rangeCount) { return false }
-  var node = sel.getRangeAt(0).commonAncestorContainer
-  return contains(this.div, node)
-};
-
-ContentEditableInput.prototype.focus = function () {
-  if (this.cm.options.readOnly != "nocursor") {
-    if (!this.selectionInEditor())
-      { this.showSelection(this.prepareSelection(), true) }
-    this.div.focus()
-  }
-};
-ContentEditableInput.prototype.blur = function () { this.div.blur() };
-ContentEditableInput.prototype.getField = function () { return this.div };
-
-ContentEditableInput.prototype.supportsTouch = function () { return true };
-
-ContentEditableInput.prototype.receivedFocus = function () {
-  var input = this
-  if (this.selectionInEditor())
-    { this.pollSelection() }
-  else
-    { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }) }
-
-  function poll() {
-    if (input.cm.state.focused) {
-      input.pollSelection()
-      input.polling.set(input.cm.options.pollInterval, poll)
-    }
-  }
-  this.polling.set(this.cm.options.pollInterval, poll)
-};
-
-ContentEditableInput.prototype.selectionChanged = function () {
-  var sel = window.getSelection()
-  return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||
-    sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset
-};
-
-ContentEditableInput.prototype.pollSelection = function () {
-  if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }
-  var sel = window.getSelection(), cm = this.cm
-  // On Android Chrome (version 56, at least), backspacing into an
-  // uneditable block element will put the cursor in that element,
-  // and then, because it's not editable, hide the virtual keyboard.
-  // Because Android doesn't allow us to actually detect backspace
-  // presses in a sane way, this code checks for when that happens
-  // and simulates a backspace press in this case.
-  if (android && chrome && this.cm.options.gutters.length && isInGutter(sel.anchorNode)) {
-    this.cm.triggerOnKeyDown({type: "keydown", keyCode: 8, preventDefault: Math.abs})
-    this.blur()
-    this.focus()
-    return
-  }
-  if (this.composing) { return }
-  this.rememberSelection()
-  var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset)
-  var head = domToPos(cm, sel.focusNode, sel.focusOffset)
-  if (anchor && head) { runInOp(cm, function () {
-    setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll)
-    if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true }
-  }) }
-};
-
-ContentEditableInput.prototype.pollContent = function () {
-  if (this.readDOMTimeout != null) {
-    clearTimeout(this.readDOMTimeout)
-    this.readDOMTimeout = null
-  }
-
-  var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary()
-  var from = sel.from(), to = sel.to()
-  if (from.ch == 0 && from.line > cm.firstLine())
-    { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length) }
-  if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())
-    { to = Pos(to.line + 1, 0) }
-  if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }
-
-  var fromIndex, fromLine, fromNode
-  if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {
-    fromLine = lineNo(display.view[0].line)
-    fromNode = display.view[0].node
-  } else {
-    fromLine = lineNo(display.view[fromIndex].line)
-    fromNode = display.view[fromIndex - 1].node.nextSibling
-  }
-  var toIndex = findViewIndex(cm, to.line)
-  var toLine, toNode
-  if (toIndex == display.view.length - 1) {
-    toLine = display.viewTo - 1
-    toNode = display.lineDiv.lastChild
-  } else {
-    toLine = lineNo(display.view[toIndex + 1].line) - 1
-    toNode = display.view[toIndex + 1].node.previousSibling
-  }
-
-  if (!fromNode) { return false }
-  var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine))
-  var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length))
-  while (newText.length > 1 && oldText.length > 1) {
-    if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine-- }
-    else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++ }
-    else { break }
-  }
-
-  var cutFront = 0, cutEnd = 0
-  var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length)
-  while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))
-    { ++cutFront }
-  var newBot = lst(newText), oldBot = lst(oldText)
-  var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),
-                           oldBot.length - (oldText.length == 1 ? cutFront : 0))
-  while (cutEnd < maxCutEnd &&
-         newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))
-    { ++cutEnd }
-  // Try to move start of change to start of selection if ambiguous
-  if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {
-    while (cutFront && cutFront > from.ch &&
-           newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {
-      cutFront--
-      cutEnd++
-    }
-  }
-
-  newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, "")
-  newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, "")
-
-  var chFrom = Pos(fromLine, cutFront)
-  var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0)
-  if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {
-    replaceRange(cm.doc, newText, chFrom, chTo, "+input")
-    return true
-  }
-};
-
-ContentEditableInput.prototype.ensurePolled = function () {
-  this.forceCompositionEnd()
-};
-ContentEditableInput.prototype.reset = function () {
-  this.forceCompositionEnd()
-};
-ContentEditableInput.prototype.forceCompositionEnd = function () {
-  if (!this.composing) { return }
-  clearTimeout(this.readDOMTimeout)
-  this.composing = null
-  this.updateFromDOM()
-  this.div.blur()
-  this.div.focus()
-};
-ContentEditableInput.prototype.readFromDOMSoon = function () {
-    var this$1 = this;
-
-  if (this.readDOMTimeout != null) { return }
-  this.readDOMTimeout = setTimeout(function () {
-    this$1.readDOMTimeout = null
-    if (this$1.composing) {
-      if (this$1.composing.done) { this$1.composing = null }
-      else { return }
-    }
-    this$1.updateFromDOM()
-  }, 80)
-};
-
-ContentEditableInput.prototype.updateFromDOM = function () {
-    var this$1 = this;
-
-  if (this.cm.isReadOnly() || !this.pollContent())
-    { runInOp(this.cm, function () { return regChange(this$1.cm); }) }
-};
-
-ContentEditableInput.prototype.setUneditable = function (node) {
-  node.contentEditable = "false"
-};
-
-ContentEditableInput.prototype.onKeyPress = function (e) {
-  if (e.charCode == 0) { return }
-  e.preventDefault()
-  if (!this.cm.isReadOnly())
-    { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0) }
-};
-
-ContentEditableInput.prototype.readOnlyChanged = function (val) {
-  this.div.contentEditable = String(val != "nocursor")
-};
-
-ContentEditableInput.prototype.onContextMenu = function () {};
-ContentEditableInput.prototype.resetPosition = function () {};
-
-ContentEditableInput.prototype.needsContentAttribute = true
-
-function posToDOM(cm, pos) {
-  var view = findViewForLine(cm, pos.line)
-  if (!view || view.hidden) { return null }
-  var line = getLine(cm.doc, pos.line)
-  var info = mapFromLineView(view, line, pos.line)
-
-  var order = getOrder(line, cm.doc.direction), side = "left"
-  if (order) {
-    var partPos = getBidiPartAt(order, pos.ch)
-    side = partPos % 2 ? "right" : "left"
-  }
-  var result = nodeAndOffsetInLineMap(info.map, pos.ch, side)
-  result.offset = result.collapse == "right" ? result.end : result.start
-  return result
-}
-
-function isInGutter(node) {
-  for (var scan = node; scan; scan = scan.parentNode)
-    { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }
-  return false
-}
-
-function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }
-
-function domTextBetween(cm, from, to, fromLine, toLine) {
-  var text = "", closing = false, lineSep = cm.doc.lineSeparator()
-  function recognizeMarker(id) { return function (marker) { return marker.id == id; } }
-  function close() {
-    if (closing) {
-      text += lineSep
-      closing = false
-    }
-  }
-  function addText(str) {
-    if (str) {
-      close()
-      text += str
-    }
-  }
-  function walk(node) {
-    if (node.nodeType == 1) {
-      var cmText = node.getAttribute("cm-text")
-      if (cmText != null) {
-        addText(cmText || node.textContent.replace(/\u200b/g, ""))
-        return
-      }
-      var markerID = node.getAttribute("cm-marker"), range
-      if (markerID) {
-        var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID))
-        if (found.length && (range = found[0].find()))
-          { addText(getBetween(cm.doc, range.from, range.to).join(lineSep)) }
-        return
-      }
-      if (node.getAttribute("contenteditable") == "false") { return }
-      var isBlock = /^(pre|div|p)$/i.test(node.nodeName)
-      if (isBlock) { close() }
-      for (var i = 0; i < node.childNodes.length; i++)
-        { walk(node.childNodes[i]) }
-      if (isBlock) { closing = true }
-    } else if (node.nodeType == 3) {
-      addText(node.nodeValue)
-    }
-  }
-  for (;;) {
-    walk(from)
-    if (from == to) { break }
-    from = from.nextSibling
-  }
-  return text
-}
-
-function domToPos(cm, node, offset) {
-  var lineNode
-  if (node == cm.display.lineDiv) {
-    lineNode = cm.display.lineDiv.childNodes[offset]
-    if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }
-    node = null; offset = 0
-  } else {
-    for (lineNode = node;; lineNode = lineNode.parentNode) {
-      if (!lineNode || lineNode == cm.display.lineDiv) { return null }
-      if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }
-    }
-  }
-  for (var i = 0; i < cm.display.view.length; i++) {
-    var lineView = cm.display.view[i]
-    if (lineView.node == lineNode)
-      { return locateNodeInLineView(lineView, node, offset) }
-  }
-}
-
-function locateNodeInLineView(lineView, node, offset) {
-  var wrapper = lineView.text.firstChild, bad = false
-  if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }
-  if (node == wrapper) {
-    bad = true
-    node = wrapper.childNodes[offset]
-    offset = 0
-    if (!node) {
-      var line = lineView.rest ? lst(lineView.rest) : lineView.line
-      return badPos(Pos(lineNo(line), line.text.length), bad)
-    }
-  }
-
-  var textNode = node.nodeType == 3 ? node : null, topNode = node
-  if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
-    textNode = node.firstChild
-    if (offset) { offset = textNode.nodeValue.length }
-  }
-  while (topNode.parentNode != wrapper) { topNode = topNode.parentNode }
-  var measure = lineView.measure, maps = measure.maps
-
-  function find(textNode, topNode, offset) {
-    for (var i = -1; i < (maps ? maps.length : 0); i++) {
-      var map = i < 0 ? measure.map : maps[i]
-      for (var j = 0; j < map.length; j += 3) {
-        var curNode = map[j + 2]
-        if (curNode == textNode || curNode == topNode) {
-          var line = lineNo(i < 0 ? lineView.line : lineView.rest[i])
-          var ch = map[j] + offset
-          if (offset < 0 || curNode != textNode) { ch = map[j + (offset ? 1 : 0)] }
-          return Pos(line, ch)
-        }
-      }
-    }
-  }
-  var found = find(textNode, topNode, offset)
-  if (found) { return badPos(found, bad) }
-
-  // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems
-  for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {
-    found = find(after, after.firstChild, 0)
-    if (found)
-      { return badPos(Pos(found.line, found.ch - dist), bad) }
-    else
-      { dist += after.textContent.length }
-  }
-  for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {
-    found = find(before, before.firstChild, -1)
-    if (found)
-      { return badPos(Pos(found.line, found.ch + dist$1), bad) }
-    else
-      { dist$1 += before.textContent.length }
-  }
-}
-
-// TEXTAREA INPUT STYLE
-
-var TextareaInput = function(cm) {
-  this.cm = cm
-  // See input.poll and input.reset
-  this.prevInput = ""
-
-  // Flag that indicates whether we expect input to appear real soon
-  // now (after some event like 'keypress' or 'input') and are
-  // polling intensively.
-  this.pollingFast = false
-  // Self-resetting timeout for the poller
-  this.polling = new Delayed()
-  // Tracks when input.reset has punted to just putting a short
-  // string into the textarea instead of the full selection.
-  this.inaccurateSelection = false
-  // Used to work around IE issue with selection being forgotten when focus moves away from textarea
-  this.hasSelection = false
-  this.composing = null
-};
-
-TextareaInput.prototype.init = function (display) {
-    var this$1 = this;
-
-  var input = this, cm = this.cm
-
-  // Wraps and hides input textarea
-  var div = this.wrapper = hiddenTextarea()
-  // The semihidden textarea that is focused when the editor is
-  // focused, and receives input.
-  var te = this.textarea = div.firstChild
-  display.wrapper.insertBefore(div, display.wrapper.firstChild)
-
-  // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
-  if (ios) { te.style.width = "0px" }
-
-  on(te, "input", function () {
-    if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null }
-    input.poll()
-  })
-
-  on(te, "paste", function (e) {
-    if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
-
-    cm.state.pasteIncoming = true
-    input.fastPoll()
-  })
-
-  function prepareCopyCut(e) {
-    if (signalDOMEvent(cm, e)) { return }
-    if (cm.somethingSelected()) {
-      setLastCopied({lineWise: false, text: cm.getSelections()})
-      if (input.inaccurateSelection) {
-        input.prevInput = ""
-        input.inaccurateSelection = false
-        te.value = lastCopied.text.join("\n")
-        selectInput(te)
-      }
-    } else if (!cm.options.lineWiseCopyCut) {
-      return
-    } else {
-      var ranges = copyableRanges(cm)
-      setLastCopied({lineWise: true, text: ranges.text})
-      if (e.type == "cut") {
-        cm.setSelections(ranges.ranges, null, sel_dontScroll)
-      } else {
-        input.prevInput = ""
-        te.value = ranges.text.join("\n")
-        selectInput(te)
-      }
-    }
-    if (e.type == "cut") { cm.state.cutIncoming = true }
-  }
-  on(te, "cut", prepareCopyCut)
-  on(te, "copy", prepareCopyCut)
-
-  on(display.scroller, "paste", function (e) {
-    if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }
-    cm.state.pasteIncoming = true
-    input.focus()
-  })
-
-  // Prevent normal selection in the editor (we handle our own)
-  on(display.lineSpace, "selectstart", function (e) {
-    if (!eventInWidget(display, e)) { e_preventDefault(e) }
-  })
-
-  on(te, "compositionstart", function () {
-    var start = cm.getCursor("from")
-    if (input.composing) { input.composing.range.clear() }
-    input.composing = {
-      start: start,
-      range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
-    }
-  })
-  on(te, "compositionend", function () {
-    if (input.composing) {
-      input.poll()
-      input.composing.range.clear()
-      input.composing = null
-    }
-  })
-};
-
-TextareaInput.prototype.prepareSelection = function () {
-  // Redraw the selection and/or cursor
-  var cm = this.cm, display = cm.display, doc = cm.doc
-  var result = prepareSelection(cm)
-
-  // Move the hidden textarea near the cursor to prevent scrolling artifacts
-  if (cm.options.moveInputWithCursor) {
-    var headPos = cursorCoords(cm, doc.sel.primary().head, "div")
-    var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect()
-    result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
-                                        headPos.top + lineOff.top - wrapOff.top))
-    result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
-                                         headPos.left + lineOff.left - wrapOff.left))
-  }
-
-  return result
-};
-
-TextareaInput.prototype.showSelection = function (drawn) {
-  var cm = this.cm, display = cm.display
-  removeChildrenAndAdd(display.cursorDiv, drawn.cursors)
-  removeChildrenAndAdd(display.selectionDiv, drawn.selection)
-  if (drawn.teTop != null) {
-    this.wrapper.style.top = drawn.teTop + "px"
-    this.wrapper.style.left = drawn.teLeft + "px"
-  }
-};
-
-// Reset the input to correspond to the selection (or to be empty,
-// when not typing and nothing is selected)
-TextareaInput.prototype.reset = function (typing) {
-  if (this.contextMenuPending) { return }
-  var minimal, selected, cm = this.cm, doc = cm.doc
-  if (cm.somethingSelected()) {
-    this.prevInput = ""
-    var range = doc.sel.primary()
-    minimal = hasCopyEvent &&
-      (range.to().line - range.from().line > 100 || (selected = cm.getSelection()).length > 1000)
-    var content = minimal ? "-" : selected || cm.getSelection()
-    this.textarea.value = content
-    if (cm.state.focused) { selectInput(this.textarea) }
-    if (ie && ie_version >= 9) { this.hasSelection = content }
-  } else if (!typing) {
-    this.prevInput = this.textarea.value = ""
-    if (ie && ie_version >= 9) { this.hasSelection = null }
-  }
-  this.inaccurateSelection = minimal
-};
-
-TextareaInput.prototype.getField = function () { return this.textarea };
-
-TextareaInput.prototype.supportsTouch = function () { return false };
-
-TextareaInput.prototype.focus = function () {
-  if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) {
-    try { this.textarea.focus() }
-    catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
-  }
-};
-
-TextareaInput.prototype.blur = function () { this.textarea.blur() };
-
-TextareaInput.prototype.resetPosition = function () {
-  this.wrapper.style.top = this.wrapper.style.left = 0
-};
-
-TextareaInput.prototype.receivedFocus = function () { this.slowPoll() };
-
-// Poll for input changes, using the normal rate of polling. This
-// runs as long as the editor is focused.
-TextareaInput.prototype.slowPoll = function () {
-    var this$1 = this;
-
-  if (this.pollingFast) { return }
-  this.polling.set(this.cm.options.pollInterval, function () {
-    this$1.poll()
-    if (this$1.cm.state.focused) { this$1.slowPoll() }
-  })
-};
-
-// When an event has just come in that is likely to add or change
-// something in the input textarea, we poll faster, to ensure that
-// the change appears on the screen quickly.
-TextareaInput.prototype.fastPoll = function () {
-  var missed = false, input = this
-  input.pollingFast = true
-  function p() {
-    var changed = input.poll()
-    if (!changed && !missed) {missed = true; input.polling.set(60, p)}
-    else {input.pollingFast = false; input.slowPoll()}
-  }
-  input.polling.set(20, p)
-};
-
-// Read input from the textarea, and update the document to match.
-// When something is selected, it is present in the textarea, and
-// selected (unless it is huge, in which case a placeholder is
-// used). When nothing is selected, the cursor sits after previously
-// seen text (can be empty), which is stored in prevInput (we must
-// not reset the textarea when typing, because that breaks IME).
-TextareaInput.prototype.poll = function () {
-    var this$1 = this;
-
-  var cm = this.cm, input = this.textarea, prevInput = this.prevInput
-  // Since this is called a *lot*, try to bail out as cheaply as
-  // possible when it is clear that nothing happened. hasSelection
-  // will be the case when there is a lot of text in the textarea,
-  // in which case reading its value would be expensive.
-  if (this.contextMenuPending || !cm.state.focused ||
-      (hasSelection(input) && !prevInput && !this.composing) ||
-      cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
-    { return false }
-
-  var text = input.value
-  // If nothing changed, bail.
-  if (text == prevInput && !cm.somethingSelected()) { return false }
-  // Work around nonsensical selection resetting in IE9/10, and
-  // inexplicable appearance of private area unicode characters on
-  // some key combos in Mac (#2689).
-  if (ie && ie_version >= 9 && this.hasSelection === text ||
-      mac && /[\uf700-\uf7ff]/.test(text)) {
-    cm.display.input.reset()
-    return false
-  }
-
-  if (cm.doc.sel == cm.display.selForContextMenu) {
-    var first = text.charCodeAt(0)
-    if (first == 0x200b && !prevInput) { prevInput = "\u200b" }
-    if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") }
-  }
-  // Find the part of the input that is actually new
-  var same = 0, l = Math.min(prevInput.length, text.length)
-  while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same }
-
-  runInOp(cm, function () {
-    applyTextInput(cm, text.slice(same), prevInput.length - same,
-                   null, this$1.composing ? "*compose" : null)
-
-    // Don't leave long text in the textarea, since it makes further polling slow
-    if (text.length > 1000 || text.indexOf("\n") > -1) { input.value = this$1.prevInput = "" }
-    else { this$1.prevInput = text }
-
-    if (this$1.composing) {
-      this$1.composing.range.clear()
-      this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"),
-                                         {className: "CodeMirror-composing"})
-    }
-  })
-  return true
-};
-
-TextareaInput.prototype.ensurePolled = function () {
-  if (this.pollingFast && this.poll()) { this.pollingFast = false }
-};
-
-TextareaInput.prototype.onKeyPress = function () {
-  if (ie && ie_version >= 9) { this.hasSelection = null }
-  this.fastPoll()
-};
-
-TextareaInput.prototype.onContextMenu = function (e) {
-  var input = this, cm = input.cm, display = cm.display, te = input.textarea
-  var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop
-  if (!pos || presto) { return } // Opera is difficult.
-
-  // Reset the current text selection only if the click is done outside of the selection
-  // and 'resetSelectionOnContextMenu' option is true.
-  var reset = cm.options.resetSelectionOnContextMenu
-  if (reset && cm.doc.sel.contains(pos) == -1)
-    { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll) }
-
-  var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText
-  input.wrapper.style.cssText = "position: absolute"
-  var wrapperBox = input.wrapper.getBoundingClientRect()
-  te.style.cssText = "position: absolute; width: 30px; height: 30px;\n      top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n      z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"
-  var oldScrollY
-  if (webkit) { oldScrollY = window.scrollY } // Work around Chrome issue (#2712)
-  display.input.focus()
-  if (webkit) { window.scrollTo(null, oldScrollY) }
-  display.input.reset()
-  // Adds "Select all" to context menu in FF
-  if (!cm.somethingSelected()) { te.value = input.prevInput = " " }
-  input.contextMenuPending = true
-  display.selForContextMenu = cm.doc.sel
-  clearTimeout(display.detectingSelectAll)
-
-  // Select-all will be greyed out if there's nothing to select, so
-  // this adds a zero-width space so that we can later check whether
-  // it got selected.
-  function prepareSelectAllHack() {
-    if (te.selectionStart != null) {
-      var selected = cm.somethingSelected()
-      var extval = "\u200b" + (selected ? te.value : "")
-      te.value = "\u21da" // Used to catch context-menu undo
-      te.value = extval
-      input.prevInput = selected ? "" : "\u200b"
-      te.selectionStart = 1; te.selectionEnd = extval.length
-      // Re-set this, in case some other handler touched the
-      // selection in the meantime.
-      display.selForContextMenu = cm.doc.sel
-    }
-  }
-  function rehide() {
-    input.contextMenuPending = false
-    input.wrapper.style.cssText = oldWrapperCSS
-    te.style.cssText = oldCSS
-    if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos) }
-
-    // Try to detect the user choosing select-all
-    if (te.selectionStart != null) {
-      if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack() }
-      var i = 0, poll = function () {
-        if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&
-            te.selectionEnd > 0 && input.prevInput == "\u200b") {
-          operation(cm, selectAll)(cm)
-        } else if (i++ < 10) {
-          display.detectingSelectAll = setTimeout(poll, 500)
-        } else {
-          display.selForContextMenu = null
-          display.input.reset()
-        }
-      }
-      display.detectingSelectAll = setTimeout(poll, 200)
-    }
-  }
-
-  if (ie && ie_version >= 9) { prepareSelectAllHack() }
-  if (captureRightClick) {
-    e_stop(e)
-    var mouseup = function () {
-      off(window, "mouseup", mouseup)
-      setTimeout(rehide, 20)
-    }
-    on(window, "mouseup", mouseup)
-  } else {
-    setTimeout(rehide, 50)
-  }
-};
-
-TextareaInput.prototype.readOnlyChanged = function (val) {
-  if (!val) { this.reset() }
-};
-
-TextareaInput.prototype.setUneditable = function () {};
-
-TextareaInput.prototype.needsContentAttribute = false
-
-function fromTextArea(textarea, options) {
-  options = options ? copyObj(options) : {}
-  options.value = textarea.value
-  if (!options.tabindex && textarea.tabIndex)
-    { options.tabindex = textarea.tabIndex }
-  if (!options.placeholder && textarea.placeholder)
-    { options.placeholder = textarea.placeholder }
-  // Set autofocus to true if this textarea is focused, or if it has
-  // autofocus and no other element is focused.
-  if (options.autofocus == null) {
-    var hasFocus = activeElt()
-    options.autofocus = hasFocus == textarea ||
-      textarea.getAttribute("autofocus") != null && hasFocus == document.body
-  }
-
-  function save() {textarea.value = cm.getValue()}
-
-  var realSubmit
-  if (textarea.form) {
-    on(textarea.form, "submit", save)
-    // Deplorable hack to make the submit method do the right thing.
-    if (!options.leaveSubmitMethodAlone) {
-      var form = textarea.form
-      realSubmit = form.submit
-      try {
-        var wrappedSubmit = form.submit = function () {
-          save()
-          form.submit = realSubmit
-          form.submit()
-          form.submit = wrappedSubmit
-        }
-      } catch(e) {}
-    }
-  }
-
-  options.finishInit = function (cm) {
-    cm.save = save
-    cm.getTextArea = function () { return textarea; }
-    cm.toTextArea = function () {
-      cm.toTextArea = isNaN // Prevent this from being ran twice
-      save()
-      textarea.parentNode.removeChild(cm.getWrapperElement())
-      textarea.style.display = ""
-      if (textarea.form) {
-        off(textarea.form, "submit", save)
-        if (typeof textarea.form.submit == "function")
-          { textarea.form.submit = realSubmit }
-      }
-    }
-  }
-
-  textarea.style.display = "none"
-  var cm = CodeMirror(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },
-    options)
-  return cm
-}
-
-function addLegacyProps(CodeMirror) {
-  CodeMirror.off = off
-  CodeMirror.on = on
-  CodeMirror.wheelEventPixels = wheelEventPixels
-  CodeMirror.Doc = Doc
-  CodeMirror.splitLines = splitLinesAuto
-  CodeMirror.countColumn = countColumn
-  CodeMirror.findColumn = findColumn
-  CodeMirror.isWordChar = isWordCharBasic
-  CodeMirror.Pass = Pass
-  CodeMirror.signal = signal
-  CodeMirror.Line = Line
-  CodeMirror.changeEnd = changeEnd
-  CodeMirror.scrollbarModel = scrollbarModel
-  CodeMirror.Pos = Pos
-  CodeMirror.cmpPos = cmp
-  CodeMirror.modes = modes
-  CodeMirror.mimeModes = mimeModes
-  CodeMirror.resolveMode = resolveMode
-  CodeMirror.getMode = getMode
-  CodeMirror.modeExtensions = modeExtensions
-  CodeMirror.extendMode = extendMode
-  CodeMirror.copyState = copyState
-  CodeMirror.startState = startState
-  CodeMirror.innerMode = innerMode
-  CodeMirror.commands = commands
-  CodeMirror.keyMap = keyMap
-  CodeMirror.keyName = keyName
-  CodeMirror.isModifierKey = isModifierKey
-  CodeMirror.lookupKey = lookupKey
-  CodeMirror.normalizeKeyMap = normalizeKeyMap
-  CodeMirror.StringStream = StringStream
-  CodeMirror.SharedTextMarker = SharedTextMarker
-  CodeMirror.TextMarker = TextMarker
-  CodeMirror.LineWidget = LineWidget
-  CodeMirror.e_preventDefault = e_preventDefault
-  CodeMirror.e_stopPropagation = e_stopPropagation
-  CodeMirror.e_stop = e_stop
-  CodeMirror.addClass = addClass
-  CodeMirror.contains = contains
-  CodeMirror.rmClass = rmClass
-  CodeMirror.keyNames = keyNames
-}
-
-// EDITOR CONSTRUCTOR
-
-defineOptions(CodeMirror)
-
-addEditorMethods(CodeMirror)
-
-// Set up methods on CodeMirror's prototype to redirect to the editor's document.
-var dontDelegate = "iter insert remove copy getEditor constructor".split(" ")
-for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
-  { CodeMirror.prototype[prop] = (function(method) {
-    return function() {return method.apply(this.doc, arguments)}
-  })(Doc.prototype[prop]) } }
-
-eventMixin(Doc)
-
-// INPUT HANDLING
-
-CodeMirror.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput}
-
-// MODE DEFINITION AND QUERYING
-
-// Extra arguments are stored as the mode's dependencies, which is
-// used by (legacy) mechanisms like loadmode.js to automatically
-// load a mode. (Preferred mechanism is the require/define calls.)
-CodeMirror.defineMode = function(name/*, mode, …*/) {
-  if (!CodeMirror.defaults.mode && name != "null") { CodeMirror.defaults.mode = name }
-  defineMode.apply(this, arguments)
-}
-
-CodeMirror.defineMIME = defineMIME
-
-// Minimal default mode.
-CodeMirror.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); })
-CodeMirror.defineMIME("text/plain", "null")
-
-// EXTENSIONS
-
-CodeMirror.defineExtension = function (name, func) {
-  CodeMirror.prototype[name] = func
-}
-CodeMirror.defineDocExtension = function (name, func) {
-  Doc.prototype[name] = func
-}
-
-CodeMirror.fromTextArea = fromTextArea
-
-addLegacyProps(CodeMirror)
-
-CodeMirror.version = "5.25.2"
-
-return CodeMirror;
-
-})));
\ No newline at end of file
diff --git a/static/lib/codemirror/mode/go/go.js b/static/lib/codemirror/mode/go/go.js
deleted file mode 100644
index 8896b57..0000000
--- a/static/lib/codemirror/mode/go/go.js
+++ /dev/null
@@ -1,187 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-(function(mod) {
-  if (typeof exports == "object" && typeof module == "object") // CommonJS
-    mod(require("../../lib/codemirror"));
-  else if (typeof define == "function" && define.amd) // AMD
-    define(["../../lib/codemirror"], mod);
-  else // Plain browser env
-    mod(CodeMirror);
-})(function(CodeMirror) {
-"use strict";
-
-CodeMirror.defineMode("go", function(config) {
-  var indentUnit = config.indentUnit;
-
-  var keywords = {
-    "break":true, "case":true, "chan":true, "const":true, "continue":true,
-    "default":true, "defer":true, "else":true, "fallthrough":true, "for":true,
-    "func":true, "go":true, "goto":true, "if":true, "import":true,
-    "interface":true, "map":true, "package":true, "range":true, "return":true,
-    "select":true, "struct":true, "switch":true, "type":true, "var":true,
-    "bool":true, "byte":true, "complex64":true, "complex128":true,
-    "float32":true, "float64":true, "int8":true, "int16":true, "int32":true,
-    "int64":true, "string":true, "uint8":true, "uint16":true, "uint32":true,
-    "uint64":true, "int":true, "uint":true, "uintptr":true, "error": true,
-    "rune":true
-  };
-
-  var atoms = {
-    "true":true, "false":true, "iota":true, "nil":true, "append":true,
-    "cap":true, "close":true, "complex":true, "copy":true, "delete":true, "imag":true,
-    "len":true, "make":true, "new":true, "panic":true, "print":true,
-    "println":true, "real":true, "recover":true
-  };
-
-  var isOperatorChar = /[+\-*&^%:=<>!|\/]/;
-
-  var curPunc;
-
-  function tokenBase(stream, state) {
-    var ch = stream.next();
-    if (ch == '"' || ch == "'" || ch == "`") {
-      state.tokenize = tokenString(ch);
-      return state.tokenize(stream, state);
-    }
-    if (/[\d\.]/.test(ch)) {
-      if (ch == ".") {
-        stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/);
-      } else if (ch == "0") {
-        stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/);
-      } else {
-        stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/);
-      }
-      return "number";
-    }
-    if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
-      curPunc = ch;
-      return null;
-    }
-    if (ch == "/") {
-      if (stream.eat("*")) {
-        state.tokenize = tokenComment;
-        return tokenComment(stream, state);
-      }
-      if (stream.eat("/")) {
-        stream.skipToEnd();
-        return "comment";
-      }
-    }
-    if (isOperatorChar.test(ch)) {
-      stream.eatWhile(isOperatorChar);
-      return "operator";
-    }
-    stream.eatWhile(/[\w\$_\xa1-\uffff]/);
-    var cur = stream.current();
-    if (keywords.propertyIsEnumerable(cur)) {
-      if (cur == "case" || cur == "default") curPunc = "case";
-      return "keyword";
-    }
-    if (atoms.propertyIsEnumerable(cur)) return "atom";
-    return "variable";
-  }
-
-  function tokenString(quote) {
-    return function(stream, state) {
-      var escaped = false, next, end = false;
-      while ((next = stream.next()) != null) {
-        if (next == quote && !escaped) {end = true; break;}
-        escaped = !escaped && quote != "`" && next == "\\";
-      }
-      if (end || !(escaped || quote == "`"))
-        state.tokenize = tokenBase;
-      return "string";
-    };
-  }
-
-  function tokenComment(stream, state) {
-    var maybeEnd = false, ch;
-    while (ch = stream.next()) {
-      if (ch == "/" && maybeEnd) {
-        state.tokenize = tokenBase;
-        break;
-      }
-      maybeEnd = (ch == "*");
-    }
-    return "comment";
-  }
-
-  function Context(indented, column, type, align, prev) {
-    this.indented = indented;
-    this.column = column;
-    this.type = type;
-    this.align = align;
-    this.prev = prev;
-  }
-  function pushContext(state, col, type) {
-    return state.context = new Context(state.indented, col, type, null, state.context);
-  }
-  function popContext(state) {
-    if (!state.context.prev) return;
-    var t = state.context.type;
-    if (t == ")" || t == "]" || t == "}")
-      state.indented = state.context.indented;
-    return state.context = state.context.prev;
-  }
-
-  // Interface
-
-  return {
-    startState: function(basecolumn) {
-      return {
-        tokenize: null,
-        context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
-        indented: 0,
-        startOfLine: true
-      };
-    },
-
-    token: function(stream, state) {
-      var ctx = state.context;
-      if (stream.sol()) {
-        if (ctx.align == null) ctx.align = false;
-        state.indented = stream.indentation();
-        state.startOfLine = true;
-        if (ctx.type == "case") ctx.type = "}";
-      }
-      if (stream.eatSpace()) return null;
-      curPunc = null;
-      var style = (state.tokenize || tokenBase)(stream, state);
-      if (style == "comment") return style;
-      if (ctx.align == null) ctx.align = true;
-
-      if (curPunc == "{") pushContext(state, stream.column(), "}");
-      else if (curPunc == "[") pushContext(state, stream.column(), "]");
-      else if (curPunc == "(") pushContext(state, stream.column(), ")");
-      else if (curPunc == "case") ctx.type = "case";
-      else if (curPunc == "}" && ctx.type == "}") ctx = popContext(state);
-      else if (curPunc == ctx.type) popContext(state);
-      state.startOfLine = false;
-      return style;
-    },
-
-    indent: function(state, textAfter) {
-      if (state.tokenize != tokenBase && state.tokenize != null) return 0;
-      var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
-      if (ctx.type == "case" && /^(?:case|default)\b/.test(textAfter)) {
-        state.context.type = "}";
-        return ctx.indented;
-      }
-      var closing = firstChar == ctx.type;
-      if (ctx.align) return ctx.column + (closing ? 0 : 1);
-      else return ctx.indented + (closing ? 0 : indentUnit);
-    },
-
-    electricChars: "{}):",
-    closeBrackets: "()[]{}''\"\"``",
-    fold: "brace",
-    blockCommentStart: "/*",
-    blockCommentEnd: "*/",
-    lineComment: "//"
-  };
-});
-
-CodeMirror.defineMIME("text/x-go", "go");
-
-});
diff --git a/static/lib/jquery-ui.min.js b/static/lib/jquery-ui.min.js
deleted file mode 100644
index 115fdfd..0000000
--- a/static/lib/jquery-ui.min.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/*! jQuery UI - v1.10.3 - 2013-09-26
-* http://jqueryui.com
-* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.menu.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js, jquery.ui.effect.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js
-* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
-
-(function(e,t){function i(t,i){var s,o,u,r=t.nodeName.toLowerCase();return"area"===r?(s=t.parentNode,o=s.name,t.href&&o&&"map"===s.nodeName.toLowerCase()?(u=e("img[usemap=#"+o+"]")[0],!!u&&n(u)):!1):(/input|select|textarea|button|object/.test(r)?!t.disabled:"a"===r?t.href||i:i)&&n(t)}function n(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}var s=0,o=/^ui-id-\d+$/;e.ui=e.ui||{},e.extend(e.ui,{version:"1.10.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({focus:function(t){return function(i,n){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),n&&n.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),scrollParent:function(){var t;return t=e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(i){if(i!==t)return this.css("zIndex",i);if(this.length)for(var n,s,o=e(this[0]);o.length&&o[0]!==document;){if(n=o.css("position"),("absolute"===n||"relative"===n||"fixed"===n)&&(s=parseInt(o.css("zIndex"),10),!isNaN(s)&&0!==s))return s;o=o.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++s)})},removeUniqueId:function(){return this.each(function(){o.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,n){return!!e.data(t,n[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var n=e.attr(t,"tabindex"),s=isNaN(n);return(s||n>=0)&&i(t,!s)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(i,n){function s(t,i,n,s){return e.each(o,function(){i-=parseFloat(e.css(t,"padding"+this))||0,n&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var o="Width"===n?["Left","Right"]:["Top","Bottom"],u=n.toLowerCase(),r={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+n]=function(i){return i===t?r["inner"+n].call(this):this.each(function(){e(this).css(u,s(this,i)+"px")})},e.fn["outer"+n]=function(t,i){return"number"!=typeof t?r["outer"+n].call(this,t):this.each(function(){e(this).css(u,s(this,t,!0,i)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.support.selectstart="onselectstart"in document.createElement("div"),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,i,n){var s,o=e.ui[t].prototype;for(s in n)o.plugins[s]=o.plugins[s]||[],o.plugins[s].push([i,n[s]])},call:function(e,t,i){var n,s=e.plugins[t];if(s&&e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType)for(n=0;s.length>n;n++)e.options[s[n][0]]&&s[n][1].apply(e.element,i)}},hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var n=i&&"left"===i?"scrollLeft":"scrollTop",s=!1;return t[n]>0?!0:(t[n]=1,s=t[n]>0,t[n]=0,s)}})})(jQuery);(function(e,t){var i=0,n=Array.prototype.slice,s=e.cleanData;e.cleanData=function(t){for(var i,n=0;null!=(i=t[n]);n++)try{e(i).triggerHandler("remove")}catch(o){}s(t)},e.widget=function(i,n,s){var o,r,a,u,l={},h=i.split(".")[0];i=i.split(".")[1],o=h+"-"+i,s||(s=n,n=e.Widget),e.expr[":"][o.toLowerCase()]=function(t){return!!e.data(t,o)},e[h]=e[h]||{},r=e[h][i],a=e[h][i]=function(e,i){return this._createWidget?(arguments.length&&this._createWidget(e,i),t):new a(e,i)},e.extend(a,r,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),u=new n,u.options=e.widget.extend({},u.options),e.each(s,function(i,s){return e.isFunction(s)?(l[i]=function(){var e=function(){return n.prototype[i].apply(this,arguments)},t=function(e){return n.prototype[i].apply(this,e)};return function(){var i,n=this._super,o=this._superApply;return this._super=e,this._superApply=t,i=s.apply(this,arguments),this._super=n,this._superApply=o,i}}(),t):(l[i]=s,t)}),a.prototype=e.widget.extend(u,{widgetEventPrefix:r?u.widgetEventPrefix:i},l,{constructor:a,namespace:h,widgetName:i,widgetFullName:o}),r?(e.each(r._childConstructors,function(t,i){var n=i.prototype;e.widget(n.namespace+"."+n.widgetName,a,i._proto)}),delete r._childConstructors):n._childConstructors.push(a),e.widget.bridge(i,a)},e.widget.extend=function(i){for(var s,o,r=n.call(arguments,1),a=0,u=r.length;u>a;a++)for(s in r[a])o=r[a][s],r[a].hasOwnProperty(s)&&o!==t&&(i[s]=e.isPlainObject(o)?e.isPlainObject(i[s])?e.widget.extend({},i[s],o):e.widget.extend({},o):o);return i},e.widget.bridge=function(i,s){var o=s.prototype.widgetFullName||i;e.fn[i]=function(r){var a="string"==typeof r,u=n.call(arguments,1),l=this;return r=!a&&u.length?e.widget.extend.apply(null,[r].concat(u)):r,a?this.each(function(){var n,s=e.data(this,o);return s?e.isFunction(s[r])&&"_"!==r.charAt(0)?(n=s[r].apply(s,u),n!==s&&n!==t?(l=n&&n.jquery?l.pushStack(n.get()):n,!1):t):e.error("no such method '"+r+"' for "+i+" widget instance"):e.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+r+"'")}):this.each(function(){var t=e.data(this,o);t?t.option(r||{})._init():e.data(this,o,new s(r,this))}),l}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,n){n=e(n||this.defaultElement||this)[0],this.element=e(n),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),n!==this&&(e.data(n,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===n&&this.destroy()}}),this.document=e(n.style?n.ownerDocument:n.document||n),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(i,n){var s,o,r,a=i;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof i)if(a={},s=i.split("."),i=s.shift(),s.length){for(o=a[i]=e.widget.extend({},this.options[i]),r=0;s.length-1>r;r++)o[s[r]]=o[s[r]]||{},o=o[s[r]];if(i=s.pop(),n===t)return o[i]===t?null:o[i];o[i]=n}else{if(n===t)return this.options[i]===t?null:this.options[i];a[i]=n}return this._setOptions(a),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,n,s){var o,r=this;"boolean"!=typeof i&&(s=n,n=i,i=!1),s?(n=o=e(n),this.bindings=this.bindings.add(n)):(s=n,n=this.element,o=this.widget()),e.each(s,function(s,a){function u(){return i||r.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof a?r[a]:a).apply(r,arguments):t}"string"!=typeof a&&(u.guid=a.guid=a.guid||u.guid||e.guid++);var l=s.match(/^(\w+)\s*(.*)$/),h=l[1]+r.eventNamespace,c=l[2];c?o.delegate(c,h,u):n.bind(h,u)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function i(){return("string"==typeof e?n[e]:e).apply(n,arguments)}var n=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,n){var s,o,r=this.options[t];if(n=n||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(s in o)s in i||(i[s]=o[s]);return this.element.trigger(i,n),!(e.isFunction(r)&&r.apply(this.element[0],[i].concat(n))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(n,s,o){"string"==typeof s&&(s={effect:s});var r,a=s?s===!0||"number"==typeof s?i:s.effect||i:t;s=s||{},"number"==typeof s&&(s={duration:s}),r=!e.isEmptyObject(s),s.complete=o,s.delay&&n.delay(s.delay),r&&e.effects&&e.effects.effect[a]?n[t](s):a!==t&&n[a]?n[a](s.duration,s.easing,o):n.queue(function(i){e(this)[t](),o&&o.call(n[0]),i()})}})})(jQuery);(function(e){var t=!1;e(document).mouseup(function(){t=!1}),e.widget("ui.mouse",{version:"1.10.3",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(a){return!0===e.data(a.target,t.widgetName+".preventClickEvent")?(e.removeData(a.target,t.widgetName+".preventClickEvent"),a.stopImmediatePropagation(),!1):undefined}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(a){if(!t){this._mouseStarted&&this._mouseUp(a),this._mouseDownEvent=a;var i=this,r=1===a.which,n="string"==typeof this.options.cancel&&a.target.nodeName?e(a.target).closest(this.options.cancel).length:!1;return r&&!n&&this._mouseCapture(a)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(a)&&this._mouseDelayMet(a)&&(this._mouseStarted=this._mouseStart(a)!==!1,!this._mouseStarted)?(a.preventDefault(),!0):(!0===e.data(a.target,this.widgetName+".preventClickEvent")&&e.removeData(a.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),a.preventDefault(),t=!0,!0)):!0}},_mouseMove:function(t){return e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button?this._mouseUp(t):this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(jQuery);(function(e,t){function i(e,t,i){return[parseFloat(e[0])*(f.test(e[0])?t/100:1),parseFloat(e[1])*(f.test(e[1])?i/100:1)]}function n(t,i){return parseInt(e.css(t,i),10)||0}function s(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var o,r=Math.max,a=Math.abs,l=Math.round,u=/left|center|right/,h=/top|center|bottom/,c=/[\+\-]\d+(\.[\d]+)?%?/,d=/^\w+/,f=/%$/,m=e.fn.position;e.position={scrollbarWidth:function(){if(o!==t)return o;var i,n,s=e("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),r=s.children()[0];return e("body").append(s),i=r.offsetWidth,s.css("overflow","scroll"),n=r.offsetWidth,i===n&&(n=s[0].clientWidth),s.remove(),o=i-n},getScrollInfo:function(t){var i=t.isWindow?"":t.element.css("overflow-x"),n=t.isWindow?"":t.element.css("overflow-y"),s="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth,o="scroll"===n||"auto"===n&&t.height<t.element[0].scrollHeight;return{width:o?e.position.scrollbarWidth():0,height:s?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var i=e(t||window),n=e.isWindow(i[0]);return{element:i,isWindow:n,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:n?i.width():i.outerWidth(),height:n?i.height():i.outerHeight()}}},e.fn.position=function(t){if(!t||!t.of)return m.apply(this,arguments);t=e.extend({},t);var o,f,p,v,g,_,b=e(t.of),y=e.position.getWithinInfo(t.within),x=e.position.getScrollInfo(y),w=(t.collision||"flip").split(" "),C={};return _=s(b),b[0].preventDefault&&(t.at="left top"),f=_.width,p=_.height,v=_.offset,g=e.extend({},v),e.each(["my","at"],function(){var e,i,n=(t[this]||"").split(" ");1===n.length&&(n=u.test(n[0])?n.concat(["center"]):h.test(n[0])?["center"].concat(n):["center","center"]),n[0]=u.test(n[0])?n[0]:"center",n[1]=h.test(n[1])?n[1]:"center",e=c.exec(n[0]),i=c.exec(n[1]),C[this]=[e?e[0]:0,i?i[0]:0],t[this]=[d.exec(n[0])[0],d.exec(n[1])[0]]}),1===w.length&&(w[1]=w[0]),"right"===t.at[0]?g.left+=f:"center"===t.at[0]&&(g.left+=f/2),"bottom"===t.at[1]?g.top+=p:"center"===t.at[1]&&(g.top+=p/2),o=i(C.at,f,p),g.left+=o[0],g.top+=o[1],this.each(function(){var s,u,h=e(this),c=h.outerWidth(),d=h.outerHeight(),m=n(this,"marginLeft"),_=n(this,"marginTop"),T=c+m+n(this,"marginRight")+x.width,k=d+_+n(this,"marginBottom")+x.height,E=e.extend({},g),A=i(C.my,h.outerWidth(),h.outerHeight());"right"===t.my[0]?E.left-=c:"center"===t.my[0]&&(E.left-=c/2),"bottom"===t.my[1]?E.top-=d:"center"===t.my[1]&&(E.top-=d/2),E.left+=A[0],E.top+=A[1],e.support.offsetFractions||(E.left=l(E.left),E.top=l(E.top)),s={marginLeft:m,marginTop:_},e.each(["left","top"],function(i,n){e.ui.position[w[i]]&&e.ui.position[w[i]][n](E,{targetWidth:f,targetHeight:p,elemWidth:c,elemHeight:d,collisionPosition:s,collisionWidth:T,collisionHeight:k,offset:[o[0]+A[0],o[1]+A[1]],my:t.my,at:t.at,within:y,elem:h})}),t.using&&(u=function(e){var i=v.left-E.left,n=i+f-c,s=v.top-E.top,o=s+p-d,l={target:{element:b,left:v.left,top:v.top,width:f,height:p},element:{element:h,left:E.left,top:E.top,width:c,height:d},horizontal:0>n?"left":i>0?"right":"center",vertical:0>o?"top":s>0?"bottom":"middle"};c>f&&f>a(i+n)&&(l.horizontal="center"),d>p&&p>a(s+o)&&(l.vertical="middle"),l.important=r(a(i),a(n))>r(a(s),a(o))?"horizontal":"vertical",t.using.call(this,e,l)}),h.offset(e.extend(E,{using:u}))})},e.ui.position={fit:{left:function(e,t){var i,n=t.within,s=n.isWindow?n.scrollLeft:n.offset.left,o=n.width,a=e.left-t.collisionPosition.marginLeft,l=s-a,u=a+t.collisionWidth-o-s;t.collisionWidth>o?l>0&&0>=u?(i=e.left+l+t.collisionWidth-o-s,e.left+=l-i):e.left=u>0&&0>=l?s:l>u?s+o-t.collisionWidth:s:l>0?e.left+=l:u>0?e.left-=u:e.left=r(e.left-a,e.left)},top:function(e,t){var i,n=t.within,s=n.isWindow?n.scrollTop:n.offset.top,o=t.within.height,a=e.top-t.collisionPosition.marginTop,l=s-a,u=a+t.collisionHeight-o-s;t.collisionHeight>o?l>0&&0>=u?(i=e.top+l+t.collisionHeight-o-s,e.top+=l-i):e.top=u>0&&0>=l?s:l>u?s+o-t.collisionHeight:s:l>0?e.top+=l:u>0?e.top-=u:e.top=r(e.top-a,e.top)}},flip:{left:function(e,t){var i,n,s=t.within,o=s.offset.left+s.scrollLeft,r=s.width,l=s.isWindow?s.scrollLeft:s.offset.left,u=e.left-t.collisionPosition.marginLeft,h=u-l,c=u+t.collisionWidth-r-l,d="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,f="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,m=-2*t.offset[0];0>h?(i=e.left+d+f+m+t.collisionWidth-r-o,(0>i||a(h)>i)&&(e.left+=d+f+m)):c>0&&(n=e.left-t.collisionPosition.marginLeft+d+f+m-l,(n>0||c>a(n))&&(e.left+=d+f+m))},top:function(e,t){var i,n,s=t.within,o=s.offset.top+s.scrollTop,r=s.height,l=s.isWindow?s.scrollTop:s.offset.top,u=e.top-t.collisionPosition.marginTop,h=u-l,c=u+t.collisionHeight-r-l,d="top"===t.my[1],f=d?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,m="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,p=-2*t.offset[1];0>h?(n=e.top+f+m+p+t.collisionHeight-r-o,e.top+f+m+p>h&&(0>n||a(h)>n)&&(e.top+=f+m+p)):c>0&&(i=e.top-t.collisionPosition.marginTop+f+m+p-l,e.top+f+m+p>c&&(i>0||c>a(i))&&(e.top+=f+m+p))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,n,s,o,r=document.getElementsByTagName("body")[0],a=document.createElement("div");t=document.createElement(r?"div":"body"),n={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},r&&e.extend(n,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in n)t.style[o]=n[o];t.appendChild(a),i=r||document.documentElement,i.insertBefore(t,i.firstChild),a.style.cssText="position: absolute; left: 10.7432222px;",s=e(a).offset().left,e.support.offsetFractions=s>10&&11>s,t.innerHTML="",i.removeChild(t)}()})(jQuery);(function(e){e.widget("ui.draggable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(t){var a=this.options;return this.helper||a.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(e(a.iframeFix===!0?"iframe":a.iframeFix).each(function(){e("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var a=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!a.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,a){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),!a){var i=this._uiHash();if(this._trigger("drag",t,i)===!1)return this._mouseUp({}),!1;this.position=i.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var a=this,i=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(i=e.ui.ddmanager.drop(this,t)),this.dropped&&(i=this.dropped,this.dropped=!1),"original"!==this.options.helper||e.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!i||"valid"===this.options.revert&&i||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,i)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){a._trigger("stop",t)!==!1&&a._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1):!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(t){var a=this.options,i=e.isFunction(a.helper)?e(a.helper.apply(this.element[0],[t])):"clone"===a.helper?this.element.clone().removeAttr("id"):this.element;return i.parents("body").length||i.appendTo("parent"===a.appendTo?this.element[0].parentNode:a.appendTo),i[0]===this.element[0]||/(fixed|absolute)/.test(i.css("position"))||i.css("position","absolute"),i},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,a,i,r=this.options;return r.containment?"window"===r.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):"document"===r.containment?(this.containment=[0,0,e(document).width()-this.helperProportions.width-this.margins.left,(e(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):r.containment.constructor===Array?(this.containment=r.containment,undefined):("parent"===r.containment&&(r.containment=this.helper[0].parentNode),a=e(r.containment),i=a[0],i&&(t="hidden"!==a.css("overflow"),this.containment=[(parseInt(a.css("borderLeftWidth"),10)||0)+(parseInt(a.css("paddingLeft"),10)||0),(parseInt(a.css("borderTopWidth"),10)||0)+(parseInt(a.css("paddingTop"),10)||0),(t?Math.max(i.scrollWidth,i.offsetWidth):i.offsetWidth)-(parseInt(a.css("borderRightWidth"),10)||0)-(parseInt(a.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(i.scrollHeight,i.offsetHeight):i.offsetHeight)-(parseInt(a.css("borderBottomWidth"),10)||0)-(parseInt(a.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=a),undefined):(this.containment=null,undefined)},_convertPositionTo:function(t,a){a||(a=this.position);var i="absolute"===t?1:-1,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:r.scrollTop(),left:r.scrollLeft()}),{top:a.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*i,left:a.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*i}},_generatePosition:function(t){var a,i,r,n,s=this.options,o="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,d=t.pageX,u=t.pageY;return this.offset.scroll||(this.offset.scroll={top:o.scrollTop(),left:o.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(i=this.relative_container.offset(),a=[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]):a=this.containment,t.pageX-this.offset.click.left<a[0]&&(d=a[0]+this.offset.click.left),t.pageY-this.offset.click.top<a[1]&&(u=a[1]+this.offset.click.top),t.pageX-this.offset.click.left>a[2]&&(d=a[2]+this.offset.click.left),t.pageY-this.offset.click.top>a[3]&&(u=a[3]+this.offset.click.top)),s.grid&&(r=s.grid[1]?this.originalPageY+Math.round((u-this.originalPageY)/s.grid[1])*s.grid[1]:this.originalPageY,u=a?r-this.offset.click.top>=a[1]||r-this.offset.click.top>a[3]?r:r-this.offset.click.top>=a[1]?r-s.grid[1]:r+s.grid[1]:r,n=s.grid[0]?this.originalPageX+Math.round((d-this.originalPageX)/s.grid[0])*s.grid[0]:this.originalPageX,d=a?n-this.offset.click.left>=a[0]||n-this.offset.click.left>a[2]?n:n-this.offset.click.left>=a[0]?n-s.grid[0]:n+s.grid[0]:n)),{top:u-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(t,a,i){return i=i||this._uiHash(),e.ui.plugin.call(this,t,[a,i]),"drag"===t&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,a,i)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,a){var i=e(this).data("ui-draggable"),r=i.options,n=e.extend({},a,{item:i.element});i.sortables=[],e(r.connectToSortable).each(function(){var a=e.data(this,"ui-sortable");a&&!a.options.disabled&&(i.sortables.push({instance:a,shouldRevert:a.options.revert}),a.refreshPositions(),a._trigger("activate",t,n))})},stop:function(t,a){var i=e(this).data("ui-draggable"),r=e.extend({},a,{item:i.element});e.each(i.sortables,function(){this.instance.isOver?(this.instance.isOver=0,i.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,"original"===i.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,r))})},drag:function(t,a){var i=e(this).data("ui-draggable"),r=this;e.each(i.sortables,function(){var n=!1,s=this;this.instance.positionAbs=i.positionAbs,this.instance.helperProportions=i.helperProportions,this.instance.offset.click=i.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(n=!0,e.each(i.sortables,function(){return this.instance.positionAbs=i.positionAbs,this.instance.helperProportions=i.helperProportions,this.instance.offset.click=i.offset.click,this!==s&&this.instance._intersectsWith(this.instance.containerCache)&&e.contains(s.instance.element[0],this.instance.element[0])&&(n=!1),n})),n?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(r).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return a.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=i.offset.click.top,this.instance.offset.click.left=i.offset.click.left,this.instance.offset.parent.left-=i.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=i.offset.parent.top-this.instance.offset.parent.top,i._trigger("toSortable",t),i.dropped=this.instance.element,i.currentItem=i.element,this.instance.fromOutside=i),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),i._trigger("fromSortable",t),i.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(){var t=e("body"),a=e(this).data("ui-draggable").options;t.css("cursor")&&(a._cursor=t.css("cursor")),t.css("cursor",a.cursor)},stop:function(){var t=e(this).data("ui-draggable").options;t._cursor&&e("body").css("cursor",t._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,a){var i=e(a.helper),r=e(this).data("ui-draggable").options;i.css("opacity")&&(r._opacity=i.css("opacity")),i.css("opacity",r.opacity)},stop:function(t,a){var i=e(this).data("ui-draggable").options;i._opacity&&e(a.helper).css("opacity",i._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(){var t=e(this).data("ui-draggable");t.scrollParent[0]!==document&&"HTML"!==t.scrollParent[0].tagName&&(t.overflowOffset=t.scrollParent.offset())},drag:function(t){var a=e(this).data("ui-draggable"),i=a.options,r=!1;a.scrollParent[0]!==document&&"HTML"!==a.scrollParent[0].tagName?(i.axis&&"x"===i.axis||(a.overflowOffset.top+a.scrollParent[0].offsetHeight-t.pageY<i.scrollSensitivity?a.scrollParent[0].scrollTop=r=a.scrollParent[0].scrollTop+i.scrollSpeed:t.pageY-a.overflowOffset.top<i.scrollSensitivity&&(a.scrollParent[0].scrollTop=r=a.scrollParent[0].scrollTop-i.scrollSpeed)),i.axis&&"y"===i.axis||(a.overflowOffset.left+a.scrollParent[0].offsetWidth-t.pageX<i.scrollSensitivity?a.scrollParent[0].scrollLeft=r=a.scrollParent[0].scrollLeft+i.scrollSpeed:t.pageX-a.overflowOffset.left<i.scrollSensitivity&&(a.scrollParent[0].scrollLeft=r=a.scrollParent[0].scrollLeft-i.scrollSpeed))):(i.axis&&"x"===i.axis||(t.pageY-e(document).scrollTop()<i.scrollSensitivity?r=e(document).scrollTop(e(document).scrollTop()-i.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<i.scrollSensitivity&&(r=e(document).scrollTop(e(document).scrollTop()+i.scrollSpeed))),i.axis&&"y"===i.axis||(t.pageX-e(document).scrollLeft()<i.scrollSensitivity?r=e(document).scrollLeft(e(document).scrollLeft()-i.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<i.scrollSensitivity&&(r=e(document).scrollLeft(e(document).scrollLeft()+i.scrollSpeed)))),r!==!1&&e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(a,t)}}),e.ui.plugin.add("draggable","snap",{start:function(){var t=e(this).data("ui-draggable"),a=t.options;t.snapElements=[],e(a.snap.constructor!==String?a.snap.items||":data(ui-draggable)":a.snap).each(function(){var a=e(this),i=a.offset();this!==t.element[0]&&t.snapElements.push({item:this,width:a.outerWidth(),height:a.outerHeight(),top:i.top,left:i.left})})},drag:function(t,a){var i,r,n,s,o,d,u,l,h,c,m=e(this).data("ui-draggable"),p=m.options,f=p.snapTolerance,g=a.offset.left,y=g+m.helperProportions.width,v=a.offset.top,x=v+m.helperProportions.height;for(h=m.snapElements.length-1;h>=0;h--)o=m.snapElements[h].left,d=o+m.snapElements[h].width,u=m.snapElements[h].top,l=u+m.snapElements[h].height,o-f>y||g>d+f||u-f>x||v>l+f||!e.contains(m.snapElements[h].item.ownerDocument,m.snapElements[h].item)?(m.snapElements[h].snapping&&m.options.snap.release&&m.options.snap.release.call(m.element,t,e.extend(m._uiHash(),{snapItem:m.snapElements[h].item})),m.snapElements[h].snapping=!1):("inner"!==p.snapMode&&(i=f>=Math.abs(u-x),r=f>=Math.abs(l-v),n=f>=Math.abs(o-y),s=f>=Math.abs(d-g),i&&(a.position.top=m._convertPositionTo("relative",{top:u-m.helperProportions.height,left:0}).top-m.margins.top),r&&(a.position.top=m._convertPositionTo("relative",{top:l,left:0}).top-m.margins.top),n&&(a.position.left=m._convertPositionTo("relative",{top:0,left:o-m.helperProportions.width}).left-m.margins.left),s&&(a.position.left=m._convertPositionTo("relative",{top:0,left:d}).left-m.margins.left)),c=i||r||n||s,"outer"!==p.snapMode&&(i=f>=Math.abs(u-v),r=f>=Math.abs(l-x),n=f>=Math.abs(o-g),s=f>=Math.abs(d-y),i&&(a.position.top=m._convertPositionTo("relative",{top:u,left:0}).top-m.margins.top),r&&(a.position.top=m._convertPositionTo("relative",{top:l-m.helperProportions.height,left:0}).top-m.margins.top),n&&(a.position.left=m._convertPositionTo("relative",{top:0,left:o}).left-m.margins.left),s&&(a.position.left=m._convertPositionTo("relative",{top:0,left:d-m.helperProportions.width}).left-m.margins.left)),!m.snapElements[h].snapping&&(i||r||n||s||c)&&m.options.snap.snap&&m.options.snap.snap.call(m.element,t,e.extend(m._uiHash(),{snapItem:m.snapElements[h].item})),m.snapElements[h].snapping=i||r||n||s||c)}}),e.ui.plugin.add("draggable","stack",{start:function(){var t,a=this.data("ui-draggable").options,i=e.makeArray(e(a.stack)).sort(function(t,a){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(a).css("zIndex"),10)||0)});i.length&&(t=parseInt(e(i[0]).css("zIndex"),10)||0,e(i).each(function(a){e(this).css("zIndex",t+a)}),this.css("zIndex",t+i.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,a){var i=e(a.helper),r=e(this).data("ui-draggable").options;i.css("zIndex")&&(r._zIndex=i.css("zIndex")),i.css("zIndex",r.zIndex)},stop:function(t,a){var i=e(this).data("ui-draggable").options;i._zIndex&&e(a.helper).css("zIndex",i._zIndex)}})})(jQuery);(function(e){function t(e,t,a){return e>t&&t+a>e}e.widget("ui.droppable",{version:"1.10.3",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t=this.options,a=t.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(a)?a:function(e){return e.is(a)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},e.ui.ddmanager.droppables[t.scope]=e.ui.ddmanager.droppables[t.scope]||[],e.ui.ddmanager.droppables[t.scope].push(this),t.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var t=0,a=e.ui.ddmanager.droppables[this.options.scope];a.length>t;t++)a[t]===this&&a.splice(t,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,a){"accept"===t&&(this.accept=e.isFunction(a)?a:function(e){return e.is(a)}),e.Widget.prototype._setOption.apply(this,arguments)},_activate:function(t){var a=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),a&&this._trigger("activate",t,this.ui(a))},_deactivate:function(t){var a=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),a&&this._trigger("deactivate",t,this.ui(a))},_over:function(t){var a=e.ui.ddmanager.current;a&&(a.currentItem||a.element)[0]!==this.element[0]&&this.accept.call(this.element[0],a.currentItem||a.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(a)))},_out:function(t){var a=e.ui.ddmanager.current;a&&(a.currentItem||a.element)[0]!==this.element[0]&&this.accept.call(this.element[0],a.currentItem||a.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(a)))},_drop:function(t,a){var i=a||e.ui.ddmanager.current,r=!1;return i&&(i.currentItem||i.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=e.data(this,"ui-droppable");return t.options.greedy&&!t.options.disabled&&t.options.scope===i.options.scope&&t.accept.call(t.element[0],i.currentItem||i.element)&&e.ui.intersect(i,e.extend(t,{offset:t.element.offset()}),t.options.tolerance)?(r=!0,!1):undefined}),r?!1:this.accept.call(this.element[0],i.currentItem||i.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(i)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(e,a,i){if(!a.offset)return!1;var r,s,n=(e.positionAbs||e.position.absolute).left,o=n+e.helperProportions.width,d=(e.positionAbs||e.position.absolute).top,u=d+e.helperProportions.height,l=a.offset.left,h=l+a.proportions.width,c=a.offset.top,m=c+a.proportions.height;switch(i){case"fit":return n>=l&&h>=o&&d>=c&&m>=u;case"intersect":return n+e.helperProportions.width/2>l&&h>o-e.helperProportions.width/2&&d+e.helperProportions.height/2>c&&m>u-e.helperProportions.height/2;case"pointer":return r=(e.positionAbs||e.position.absolute).left+(e.clickOffset||e.offset.click).left,s=(e.positionAbs||e.position.absolute).top+(e.clickOffset||e.offset.click).top,t(s,c,a.proportions.height)&&t(r,l,a.proportions.width);case"touch":return(d>=c&&m>=d||u>=c&&m>=u||c>d&&u>m)&&(n>=l&&h>=n||o>=l&&h>=o||l>n&&o>h);default:return!1}},e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,a){var i,r,s=e.ui.ddmanager.droppables[t.options.scope]||[],n=a?a.type:null,o=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(i=0;s.length>i;i++)if(!(s[i].options.disabled||t&&!s[i].accept.call(s[i].element[0],t.currentItem||t.element))){for(r=0;o.length>r;r++)if(o[r]===s[i].element[0]){s[i].proportions.height=0;continue e}s[i].visible="none"!==s[i].element.css("display"),s[i].visible&&("mousedown"===n&&s[i]._activate.call(s[i],a),s[i].offset=s[i].element.offset(),s[i].proportions={width:s[i].element[0].offsetWidth,height:s[i].element[0].offsetHeight})}},drop:function(t,a){var i=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance)&&(i=this._drop.call(this,a)||i),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,a)))}),i},dragStart:function(t,a){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,a)})},drag:function(t,a){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,a),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var i,r,s,n=e.ui.intersect(t,this,this.options.tolerance),o=!n&&this.isover?"isout":n&&!this.isover?"isover":null;o&&(this.options.greedy&&(r=this.options.scope,s=this.element.parents(":data(ui-droppable)").filter(function(){return e.data(this,"ui-droppable").options.scope===r}),s.length&&(i=e.data(s[0],"ui-droppable"),i.greedyChild="isover"===o)),i&&"isover"===o&&(i.isover=!1,i.isout=!0,i._out.call(i,a)),this[o]=!0,this["isout"===o?"isover":"isout"]=!1,this["isover"===o?"_over":"_out"].call(this,a),i&&"isout"===o&&(i.isout=!1,i.isover=!0,i._over.call(i,a)))}})},dragStop:function(t,a){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,a)}}})(jQuery);(function(e){function t(e){return parseInt(e,10)||0}function i(e){return!isNaN(parseInt(e,10))}e.widget("ui.resizable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_create:function(){var t,i,a,r,s,n=this,o=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!o.aspectRatio,aspectRatio:o.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:o.helper||o.ghost||o.animate?o.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.data("ui-resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=o.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++)a=e.trim(t[i]),s="ui-resizable-"+a,r=e("<div class='ui-resizable-handle "+s+"'></div>"),r.css({zIndex:o.zIndex}),"se"===a&&r.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[a]=".ui-resizable-"+a,this.element.append(r);this._renderAxis=function(t){var i,a,r,s;t=t||this.element;for(i in this.handles)this.handles[i].constructor===String&&(this.handles[i]=e(this.handles[i],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(a=e(this.handles[i],this.element),s=/sw|ne|nw|se|n|s/.test(i)?a.outerHeight():a.outerWidth(),r=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(r,s),this._proportionallyResize()),e(this.handles[i]).length},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){n.resizing||(this.className&&(r=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),n.axis=r&&r[1]?r[1]:"se")}),o.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){o.disabled||(e(this).removeClass("ui-resizable-autohide"),n._handles.show())}).mouseleave(function(){o.disabled||n.resizing||(e(this).addClass("ui-resizable-autohide"),n._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,a,r=!1;for(i in this.handles)a=e(this.handles[i])[0],(a===t.target||e.contains(a,t.target))&&(r=!0);return!this.options.disabled&&r},_mouseStart:function(i){var a,r,s,n=this.options,o=this.element.position(),d=this.element;return this.resizing=!0,/absolute/.test(d.css("position"))?d.css({position:"absolute",top:d.css("top"),left:d.css("left")}):d.is(".ui-draggable")&&d.css({position:"absolute",top:o.top,left:o.left}),this._renderProxy(),a=t(this.helper.css("left")),r=t(this.helper.css("top")),n.containment&&(a+=e(n.containment).scrollLeft()||0,r+=e(n.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:a,top:r},this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()},this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()},this.originalPosition={left:a,top:r},this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()},this.originalMousePosition={left:i.pageX,top:i.pageY},this.aspectRatio="number"==typeof n.aspectRatio?n.aspectRatio:this.originalSize.width/this.originalSize.height||1,s=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===s?this.axis+"-resize":s),d.addClass("ui-resizable-resizing"),this._propagate("start",i),!0},_mouseDrag:function(t){var i,a=this.helper,r={},s=this.originalMousePosition,n=this.axis,o=this.position.top,d=this.position.left,u=this.size.width,h=this.size.height,l=t.pageX-s.left||0,c=t.pageY-s.top||0,m=this._change[n];return m?(i=m.apply(this,[t,l,c]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),this.position.top!==o&&(r.top=this.position.top+"px"),this.position.left!==d&&(r.left=this.position.left+"px"),this.size.width!==u&&(r.width=this.size.width+"px"),this.size.height!==h&&(r.height=this.size.height+"px"),a.css(r),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(r)||this._trigger("resize",t,this.ui()),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,a,r,s,n,o,d,u=this.options,h=this;return this._helper&&(i=this._proportionallyResizeElements,a=i.length&&/textarea/i.test(i[0].nodeName),r=a&&e.ui.hasScroll(i[0],"left")?0:h.sizeDiff.height,s=a?0:h.sizeDiff.width,n={width:h.helper.width()-s,height:h.helper.height()-r},o=parseInt(h.element.css("left"),10)+(h.position.left-h.originalPosition.left)||null,d=parseInt(h.element.css("top"),10)+(h.position.top-h.originalPosition.top)||null,u.animate||this.element.css(e.extend(n,{top:d,left:o})),h.helper.height(h.size.height),h.helper.width(h.size.width),this._helper&&!u.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(e){var t,a,r,s,n,o=this.options;n={minWidth:i(o.minWidth)?o.minWidth:0,maxWidth:i(o.maxWidth)?o.maxWidth:1/0,minHeight:i(o.minHeight)?o.minHeight:0,maxHeight:i(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||e)&&(t=n.minHeight*this.aspectRatio,r=n.minWidth/this.aspectRatio,a=n.maxHeight*this.aspectRatio,s=n.maxWidth/this.aspectRatio,t>n.minWidth&&(n.minWidth=t),r>n.minHeight&&(n.minHeight=r),n.maxWidth>a&&(n.maxWidth=a),n.maxHeight>s&&(n.maxHeight=s)),this._vBoundaries=n},_updateCache:function(e){this.offset=this.helper.offset(),i(e.left)&&(this.position.left=e.left),i(e.top)&&(this.position.top=e.top),i(e.height)&&(this.size.height=e.height),i(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,a=this.size,r=this.axis;return i(e.height)?e.width=e.height*this.aspectRatio:i(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===r&&(e.left=t.left+(a.width-e.width),e.top=null),"nw"===r&&(e.top=t.top+(a.height-e.height),e.left=t.left+(a.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,a=this.axis,r=i(e.width)&&t.maxWidth&&t.maxWidth<e.width,s=i(e.height)&&t.maxHeight&&t.maxHeight<e.height,n=i(e.width)&&t.minWidth&&t.minWidth>e.width,o=i(e.height)&&t.minHeight&&t.minHeight>e.height,d=this.originalPosition.left+this.originalSize.width,u=this.position.top+this.size.height,h=/sw|nw|w/.test(a),l=/nw|ne|n/.test(a);return n&&(e.width=t.minWidth),o&&(e.height=t.minHeight),r&&(e.width=t.maxWidth),s&&(e.height=t.maxHeight),n&&h&&(e.left=d-t.minWidth),r&&h&&(e.left=d-t.maxWidth),o&&l&&(e.top=u-t.minHeight),s&&l&&(e.top=u-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_proportionallyResize:function(){if(this._proportionallyResizeElements.length){var e,t,i,a,r,s=this.helper||this.element;for(e=0;this._proportionallyResizeElements.length>e;e++){if(r=this._proportionallyResizeElements[e],!this.borderDif)for(this.borderDif=[],i=[r.css("borderTopWidth"),r.css("borderRightWidth"),r.css("borderBottomWidth"),r.css("borderLeftWidth")],a=[r.css("paddingTop"),r.css("paddingRight"),r.css("paddingBottom"),r.css("paddingLeft")],t=0;i.length>t;t++)this.borderDif[t]=(parseInt(i[t],10)||0)+(parseInt(a[t],10)||0);r.css({height:s.height()-this.borderDif[0]-this.borderDif[2]||0,width:s.width()-this.borderDif[1]-this.borderDif[3]||0})}}},_renderProxy:function(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize,a=this.originalPosition;return{left:a.left+t,width:i.width-t}},n:function(e,t,i){var a=this.originalSize,r=this.originalPosition;return{top:r.top+i,height:a.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,a){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,a]))},sw:function(t,i,a){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,a]))},ne:function(t,i,a){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,a]))},nw:function(t,i,a){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,a]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).data("ui-resizable"),a=i.options,r=i._proportionallyResizeElements,s=r.length&&/textarea/i.test(r[0].nodeName),n=s&&e.ui.hasScroll(r[0],"left")?0:i.sizeDiff.height,o=s?0:i.sizeDiff.width,d={width:i.size.width-o,height:i.size.height-n},u=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,h=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(d,h&&u?{top:h,left:u}:{}),{duration:a.animateDuration,easing:a.animateEasing,step:function(){var a={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};r&&r.length&&e(r[0]).css({width:a.width,height:a.height}),i._updateCache(a),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var i,a,r,s,n,o,d,u=e(this).data("ui-resizable"),h=u.options,l=u.element,c=h.containment,m=c instanceof e?c.get(0):/parent/.test(c)?l.parent().get(0):c;m&&(u.containerElement=e(m),/document/.test(c)||c===document?(u.containerOffset={left:0,top:0},u.containerPosition={left:0,top:0},u.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(i=e(m),a=[],e(["Top","Right","Left","Bottom"]).each(function(e,r){a[e]=t(i.css("padding"+r))}),u.containerOffset=i.offset(),u.containerPosition=i.position(),u.containerSize={height:i.innerHeight()-a[3],width:i.innerWidth()-a[1]},r=u.containerOffset,s=u.containerSize.height,n=u.containerSize.width,o=e.ui.hasScroll(m,"left")?m.scrollWidth:n,d=e.ui.hasScroll(m)?m.scrollHeight:s,u.parentData={element:m,left:r.left,top:r.top,width:o,height:d}))},resize:function(t){var i,a,r,s,n=e(this).data("ui-resizable"),o=n.options,d=n.containerOffset,u=n.position,h=n._aspectRatio||t.shiftKey,l={top:0,left:0},c=n.containerElement;c[0]!==document&&/static/.test(c.css("position"))&&(l=d),u.left<(n._helper?d.left:0)&&(n.size.width=n.size.width+(n._helper?n.position.left-d.left:n.position.left-l.left),h&&(n.size.height=n.size.width/n.aspectRatio),n.position.left=o.helper?d.left:0),u.top<(n._helper?d.top:0)&&(n.size.height=n.size.height+(n._helper?n.position.top-d.top:n.position.top),h&&(n.size.width=n.size.height*n.aspectRatio),n.position.top=n._helper?d.top:0),n.offset.left=n.parentData.left+n.position.left,n.offset.top=n.parentData.top+n.position.top,i=Math.abs((n._helper?n.offset.left-l.left:n.offset.left-l.left)+n.sizeDiff.width),a=Math.abs((n._helper?n.offset.top-l.top:n.offset.top-d.top)+n.sizeDiff.height),r=n.containerElement.get(0)===n.element.parent().get(0),s=/relative|absolute/.test(n.containerElement.css("position")),r&&s&&(i-=n.parentData.left),i+n.size.width>=n.parentData.width&&(n.size.width=n.parentData.width-i,h&&(n.size.height=n.size.width/n.aspectRatio)),a+n.size.height>=n.parentData.height&&(n.size.height=n.parentData.height-a,h&&(n.size.width=n.size.height*n.aspectRatio))},stop:function(){var t=e(this).data("ui-resizable"),i=t.options,a=t.containerOffset,r=t.containerPosition,s=t.containerElement,n=e(t.helper),o=n.offset(),d=n.outerWidth()-t.sizeDiff.width,u=n.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(s.css("position"))&&e(this).css({left:o.left-r.left-a.left,width:d,height:u}),t._helper&&!i.animate&&/static/.test(s.css("position"))&&e(this).css({left:o.left-r.left-a.left,width:d,height:u})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).data("ui-resizable"),i=t.options,a=function(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};"object"!=typeof i.alsoResize||i.alsoResize.parentNode?a(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],a(i.alsoResize)):e.each(i.alsoResize,function(e){a(e)})},resize:function(t,i){var a=e(this).data("ui-resizable"),r=a.options,s=a.originalSize,n=a.originalPosition,o={height:a.size.height-s.height||0,width:a.size.width-s.width||0,top:a.position.top-n.top||0,left:a.position.left-n.left||0},d=function(t,a){e(t).each(function(){var t=e(this),r=e(this).data("ui-resizable-alsoresize"),s={},n=a&&a.length?a:t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(n,function(e,t){var i=(r[t]||0)+(o[t]||0);i&&i>=0&&(s[t]=i||null)}),t.css(s)})};"object"!=typeof r.alsoResize||r.alsoResize.nodeType?d(r.alsoResize):e.each(r.alsoResize,function(e,t){d(e,t)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).data("ui-resizable"),i=t.options,a=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:a.height,width:a.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).data("ui-resizable");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).data("ui-resizable");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t=e(this).data("ui-resizable"),i=t.options,a=t.size,r=t.originalSize,s=t.originalPosition,n=t.axis,o="number"==typeof i.grid?[i.grid,i.grid]:i.grid,d=o[0]||1,u=o[1]||1,h=Math.round((a.width-r.width)/d)*d,l=Math.round((a.height-r.height)/u)*u,c=r.width+h,m=r.height+l,p=i.maxWidth&&c>i.maxWidth,f=i.maxHeight&&m>i.maxHeight,g=i.minWidth&&i.minWidth>c,y=i.minHeight&&i.minHeight>m;i.grid=o,g&&(c+=d),y&&(m+=u),p&&(c-=d),f&&(m-=u),/^(se|s|e)$/.test(n)?(t.size.width=c,t.size.height=m):/^(ne)$/.test(n)?(t.size.width=c,t.size.height=m,t.position.top=s.top-l):/^(sw)$/.test(n)?(t.size.width=c,t.size.height=m,t.position.left=s.left-h):(t.size.width=c,t.size.height=m,t.position.top=s.top-l,t.position.left=s.left-h)}})})(jQuery);(function(e){e.widget("ui.selectable",e.ui.mouse,{version:"1.10.3",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,a=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(a.filter,this.element[0]),this._trigger("start",t),e(a.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),a.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var a=e.data(this,"selectable-item");a.startselected=!0,t.metaKey||t.ctrlKey||(a.$element.removeClass("ui-selected"),a.selected=!1,a.$element.addClass("ui-unselecting"),a.unselecting=!0,i._trigger("unselecting",t,{unselecting:a.element}))}),e(t.target).parents().addBack().each(function(){var a,r=e.data(this,"selectable-item");return r?(a=!t.metaKey&&!t.ctrlKey||!r.$element.hasClass("ui-selected"),r.$element.removeClass(a?"ui-unselecting":"ui-selected").addClass(a?"ui-selecting":"ui-unselecting"),r.unselecting=!a,r.selecting=a,r.selected=a,a?i._trigger("selecting",t,{selecting:r.element}):i._trigger("unselecting",t,{unselecting:r.element}),!1):undefined}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,a=this,r=this.options,s=this.opos[0],n=this.opos[1],o=t.pageX,d=t.pageY;return s>o&&(i=o,o=s,s=i),n>d&&(i=d,d=n,n=i),this.helper.css({left:s,top:n,width:o-s,height:d-n}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),u=!1;i&&i.element!==a.element[0]&&("touch"===r.tolerance?u=!(i.left>o||s>i.right||i.top>d||n>i.bottom):"fit"===r.tolerance&&(u=i.left>s&&o>i.right&&i.top>n&&d>i.bottom),u?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,a._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),a._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,a._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var a=e.data(this,"selectable-item");a.$element.removeClass("ui-unselecting"),a.unselecting=!1,a.startselected=!1,i._trigger("unselected",t,{unselected:a.element})}),e(".ui-selecting",this.element[0]).each(function(){var a=e.data(this,"selectable-item");a.$element.removeClass("ui-selecting").addClass("ui-selected"),a.selecting=!1,a.selected=!0,a.startselected=!0,i._trigger("selected",t,{selected:a.element})}),this._trigger("stop",t),this.helper.remove(),!1}})})(jQuery);(function(e){function t(e,t,i){return e>t&&t+i>e}function i(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))}e.widget("ui.sortable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===e.axis||i(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_setOption:function(t,i){"disabled"===t?(this.options[t]=i,this.widget().toggleClass("ui-sortable-disabled",!!i)):e.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(t,i){var a=null,s=!1,r=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,r.widgetName+"-item")===r?(a=e(this),!1):undefined}),e.data(t.target,r.widgetName+"-item")===r&&(a=e(t.target)),a?!this.options.handle||i||(e(this.options.handle,a).find("*").addBack().each(function(){this===t.target&&(s=!0)}),s)?(this.currentItem=a,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,i,a){var s,r,n=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,n.cursorAt&&this._adjustOffsetFromHelper(n.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),n.containment&&this._setContainment(),n.cursor&&"auto"!==n.cursor&&(r=this.document.find("body"),this.storedCursor=r.css("cursor"),r.css("cursor",n.cursor),this.storedStylesheet=e("<style>*{ cursor: "+n.cursor+" !important; }</style>").appendTo(r)),n.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",n.opacity)),n.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",n.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!a)for(s=this.containers.length-1;s>=0;s--)this.containers[s]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,a,s,r,n=this.options,o=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<n.scrollSensitivity?this.scrollParent[0].scrollTop=o=this.scrollParent[0].scrollTop+n.scrollSpeed:t.pageY-this.overflowOffset.top<n.scrollSensitivity&&(this.scrollParent[0].scrollTop=o=this.scrollParent[0].scrollTop-n.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<n.scrollSensitivity?this.scrollParent[0].scrollLeft=o=this.scrollParent[0].scrollLeft+n.scrollSpeed:t.pageX-this.overflowOffset.left<n.scrollSensitivity&&(this.scrollParent[0].scrollLeft=o=this.scrollParent[0].scrollLeft-n.scrollSpeed)):(t.pageY-e(document).scrollTop()<n.scrollSensitivity?o=e(document).scrollTop(e(document).scrollTop()-n.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<n.scrollSensitivity&&(o=e(document).scrollTop(e(document).scrollTop()+n.scrollSpeed)),t.pageX-e(document).scrollLeft()<n.scrollSensitivity?o=e(document).scrollLeft(e(document).scrollLeft()-n.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<n.scrollSensitivity&&(o=e(document).scrollLeft(e(document).scrollLeft()+n.scrollSpeed))),o!==!1&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(a=this.items[i],s=a.item[0],r=this._intersectsWithPointer(a),r&&a.instance===this.currentContainer&&s!==this.currentItem[0]&&this.placeholder[1===r?"next":"prev"]()[0]!==s&&!e.contains(this.placeholder[0],s)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],s):!0)){if(this.direction=1===r?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(a))break;this._rearrange(t,a),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var a=this,s=this.placeholder.offset(),r=this.options.axis,n={};r&&"x"!==r||(n.left=s.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),r&&"y"!==r||(n.top=s.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(n,parseInt(this.options.revert,10)||500,function(){a._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),a=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&a.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!a.length&&t.key&&a.push(t.key+"="),a.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),a=[];return t=t||{},i.each(function(){a.push(e(t.item||this).attr(t.attribute||"id")||"")}),a},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,a=this.positionAbs.top,s=a+this.helperProportions.height,r=e.left,n=r+e.width,o=e.top,h=o+e.height,l=this.offset.click.top,u=this.offset.click.left,d="x"===this.options.axis||a+l>o&&h>a+l,c="y"===this.options.axis||t+u>r&&n>t+u,p=d&&c;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>r&&n>i-this.helperProportions.width/2&&a+this.helperProportions.height/2>o&&h>s-this.helperProportions.height/2},_intersectsWithPointer:function(e){var i="x"===this.options.axis||t(this.positionAbs.top+this.offset.click.top,e.top,e.height),a="y"===this.options.axis||t(this.positionAbs.left+this.offset.click.left,e.left,e.width),s=i&&a,r=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return s?this.floating?n&&"right"===n||"down"===r?2:1:r&&("down"===r?2:1):!1},_intersectsWithSides:function(e){var i=t(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),a=t(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),s=this._getDragVerticalDirection(),r=this._getDragHorizontalDirection();return this.floating&&r?"right"===r&&a||"left"===r&&!a:s&&("down"===s&&i||"up"===s&&!i)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){var i,a,s,r,n=[],o=[],h=this._connectWith();if(h&&t)for(i=h.length-1;i>=0;i--)for(s=e(h[i]),a=s.length-1;a>=0;a--)r=e.data(s[a],this.widgetFullName),r&&r!==this&&!r.options.disabled&&o.push([e.isFunction(r.options.items)?r.options.items.call(r.element):e(r.options.items,r.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),r]);for(o.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),i=o.length-1;i>=0;i--)o[i][0].each(function(){n.push(this)});return e(n)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,a,s,r,n,o,h,l,u=this.items,d=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],c=this._connectWith();if(c&&this.ready)for(i=c.length-1;i>=0;i--)for(s=e(c[i]),a=s.length-1;a>=0;a--)r=e.data(s[a],this.widgetFullName),r&&r!==this&&!r.options.disabled&&(d.push([e.isFunction(r.options.items)?r.options.items.call(r.element[0],t,{item:this.currentItem}):e(r.options.items,r.element),r]),this.containers.push(r));for(i=d.length-1;i>=0;i--)for(n=d[i][1],o=d[i][0],a=0,l=o.length;l>a;a++)h=e(o[a]),h.data(this.widgetName+"-item",n),u.push({item:h,instance:n,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,a,s,r;for(i=this.items.length-1;i>=0;i--)a=this.items[i],a.instance!==this.currentContainer&&this.currentContainer&&a.item[0]!==this.currentItem[0]||(s=this.options.toleranceElement?e(this.options.toleranceElement,a.item):a.item,t||(a.width=s.outerWidth(),a.height=s.outerHeight()),r=s.offset(),a.left=r.left,a.top=r.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)r=this.containers[i].element.offset(),this.containers[i].containerCache.left=r.left,this.containers[i].containerCache.top=r.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var i,a=t.options;a.placeholder&&a.placeholder.constructor!==String||(i=a.placeholder,a.placeholder={element:function(){var a=t.currentItem[0].nodeName.toLowerCase(),s=e("<"+a+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===a?t.currentItem.children().each(function(){e("<td>&#160;</td>",t.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(s)}):"img"===a&&s.attr("src",t.currentItem.attr("src")),i||s.css("visibility","hidden"),s},update:function(e,s){(!i||a.forcePlaceholderSize)&&(s.height()||s.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),s.width()||s.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(a.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),a.placeholder.update(t,t.placeholder)},_contactContainers:function(a){var s,r,n,o,h,l,u,d,c,p,m=null,f=null;for(s=this.containers.length-1;s>=0;s--)if(!e.contains(this.currentItem[0],this.containers[s].element[0]))if(this._intersectsWith(this.containers[s].containerCache)){if(m&&e.contains(this.containers[s].element[0],m.element[0]))continue;m=this.containers[s],f=s}else this.containers[s].containerCache.over&&(this.containers[s]._trigger("out",a,this._uiHash(this)),this.containers[s].containerCache.over=0);if(m)if(1===this.containers.length)this.containers[f].containerCache.over||(this.containers[f]._trigger("over",a,this._uiHash(this)),this.containers[f].containerCache.over=1);else{for(n=1e4,o=null,p=m.floating||i(this.currentItem),h=p?"left":"top",l=p?"width":"height",u=this.positionAbs[h]+this.offset.click[h],r=this.items.length-1;r>=0;r--)e.contains(this.containers[f].element[0],this.items[r].item[0])&&this.items[r].item[0]!==this.currentItem[0]&&(!p||t(this.positionAbs.top+this.offset.click.top,this.items[r].top,this.items[r].height))&&(d=this.items[r].item.offset()[h],c=!1,Math.abs(d-u)>Math.abs(d+this.items[r][l]-u)&&(c=!0,d+=this.items[r][l]),n>Math.abs(d-u)&&(n=Math.abs(d-u),o=this.items[r],this.direction=c?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[f])return;o?this._rearrange(a,o,null,!0):this._rearrange(a,null,this.containers[f].element,!0),this._trigger("change",a,this._uiHash()),this.containers[f]._trigger("change",a,this._uiHash(this)),this.currentContainer=this.containers[f],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[f]._trigger("over",a,this._uiHash(this)),this.containers[f].containerCache.over=1}},_createHelper:function(t){var i=this.options,a=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return a.parents("body").length||e("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(a[0]),a[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!a[0].style.width||i.forceHelperSize)&&a.width(this.currentItem.width()),(!a[0].style.height||i.forceHelperSize)&&a.height(this.currentItem.height()),a},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,a,s=this.options;"parent"===s.containment&&(s.containment=this.helper[0].parentNode),("document"===s.containment||"window"===s.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,e("document"===s.containment?document:window).width()-this.helperProportions.width-this.margins.left,(e("document"===s.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(s.containment)||(t=e(s.containment)[0],i=e(s.containment).offset(),a="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(a?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(a?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var a="absolute"===t?1:-1,s="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,r=/(html|body)/i.test(s[0].tagName);return{top:i.top+this.offset.relative.top*a+this.offset.parent.top*a-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():r?0:s.scrollTop())*a,left:i.left+this.offset.relative.left*a+this.offset.parent.left*a-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():r?0:s.scrollLeft())*a}},_generatePosition:function(t){var i,a,s=this.options,r=t.pageX,n=t.pageY,o="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(o[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(r=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(n=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(r=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(n=this.containment[3]+this.offset.click.top)),s.grid&&(i=this.originalPageY+Math.round((n-this.originalPageY)/s.grid[1])*s.grid[1],n=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-s.grid[1]:i+s.grid[1]:i,a=this.originalPageX+Math.round((r-this.originalPageX)/s.grid[0])*s.grid[0],r=this.containment?a-this.offset.click.left>=this.containment[0]&&a-this.offset.click.left<=this.containment[2]?a:a-this.offset.click.left>=this.containment[0]?a-s.grid[0]:a+s.grid[0]:a)),{top:n-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:o.scrollTop()),left:r-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:o.scrollLeft())}},_rearrange:function(e,t,i,a){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var s=this.counter;this._delay(function(){s===this.counter&&this.refreshPositions(!a)})},_clear:function(e,t){this.reverting=!1;var i,a=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)("auto"===this._storedCSS[i]||"static"===this._storedCSS[i])&&(this._storedCSS[i]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&a.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||a.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(a.push(function(e){this._trigger("remove",e,this._uiHash())}),a.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),a.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;i>=0;i--)t||a.push(function(e){return function(t){e._trigger("deactivate",t,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over&&(a.push(function(e){return function(t){e._trigger("out",t,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!t){for(this._trigger("beforeStop",e,this._uiHash()),i=0;a.length>i;i++)a[i].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!1}if(t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!t){for(i=0;a.length>i;i++)a[i].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}})})(jQuery);(function(e){var t=0,a={},r={};a.height=a.paddingTop=a.paddingBottom=a.borderTopWidth=a.borderBottomWidth="hide",r.height=r.paddingTop=r.paddingBottom=r.borderTopWidth=r.borderBottomWidth="show",e.widget("ui.accordion",{version:"1.10.3",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e(),content:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),this._destroyIcons(),e=this.headers.next().css("display","").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),undefined):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),"disabled"===e&&this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t),undefined)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var a=e.ui.keyCode,r=this.headers.length,i=this.headers.index(t.target),n=!1;switch(t.keyCode){case a.RIGHT:case a.DOWN:n=this.headers[(i+1)%r];break;case a.LEFT:case a.UP:n=this.headers[(i-1+r)%r];break;case a.SPACE:case a.ENTER:this._eventHandler(t);break;case a.HOME:n=this.headers[0];break;case a.END:n=this.headers[r-1]}n&&(e(t.target).attr("tabIndex",-1),e(n).attr("tabIndex",0),n.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"),this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide()},_refresh:function(){var a,r=this.options,i=r.heightStyle,n=this.element.parent(),s=this.accordionId="ui-accordion-"+(this.element.attr("id")||++t);this.active=this._findActive(r.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(t){var a=e(this),r=a.attr("id"),i=a.next(),n=i.attr("id");r||(r=s+"-header-"+t,a.attr("id",r)),n||(n=s+"-panel-"+t,i.attr("id",n)),a.attr("aria-controls",n),i.attr("aria-labelledby",r)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false",tabIndex:-1}).next().attr({"aria-expanded":"false","aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true",tabIndex:0}).next().attr({"aria-expanded":"true","aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(r.event),"fill"===i?(a=n.height(),this.element.siblings(":visible").each(function(){var t=e(this),r=t.css("position");"absolute"!==r&&"fixed"!==r&&(a-=t.outerHeight(!0))}),this.headers.each(function(){a-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,a-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===i&&(a=0,this.headers.next().each(function(){a=Math.max(a,e(this).css("height","").height())}).height(a))},_activate:function(t){var a=this._findActive(t)[0];a!==this.active[0]&&(a=a||this.active[0],this._eventHandler({target:a,currentTarget:a,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var a={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){a[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,a),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var a=this.options,r=this.active,i=e(t.currentTarget),n=i[0]===r[0],s=n&&a.collapsible,o=s?e():i.next(),d=r.next(),u={oldHeader:r,oldPanel:d,newHeader:s?e():i,newPanel:o};t.preventDefault(),n&&!a.collapsible||this._trigger("beforeActivate",t,u)===!1||(a.active=s?!1:this.headers.index(i),this.active=n?e():i,this._toggle(u),r.removeClass("ui-accordion-header-active ui-state-active"),a.icons&&r.children(".ui-accordion-header-icon").removeClass(a.icons.activeHeader).addClass(a.icons.header),n||(i.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),a.icons&&i.children(".ui-accordion-header-icon").removeClass(a.icons.header).addClass(a.icons.activeHeader),i.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var a=t.newPanel,r=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=a,this.prevHide=r,this.options.animate?this._animate(a,r,t):(r.hide(),a.show(),this._toggleComplete(t)),r.attr({"aria-expanded":"false","aria-hidden":"true"}),r.prev().attr("aria-selected","false"),a.length&&r.length?r.prev().attr("tabIndex",-1):a.length&&this.headers.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),a.attr({"aria-expanded":"true","aria-hidden":"false"}).prev().attr({"aria-selected":"true",tabIndex:0})},_animate:function(e,t,i){var n,s,o,d=this,u=0,c=e.length&&(!t.length||e.index()<t.index()),l=this.options.animate||{},h=c&&l.down||l,m=function(){d._toggleComplete(i)};return"number"==typeof h&&(o=h),"string"==typeof h&&(s=h),s=s||h.easing||l.easing,o=o||h.duration||l.duration,t.length?e.length?(n=e.show().outerHeight(),t.animate(a,{duration:o,easing:s,step:function(e,t){t.now=Math.round(e)}}),e.hide().animate(r,{duration:o,easing:s,complete:m,step:function(e,a){a.now=Math.round(e),"height"!==a.prop?u+=a.now:"content"!==d.options.heightStyle&&(a.now=Math.round(n-t.outerHeight()-u),u=0)}}),undefined):t.animate(a,o,s,m):e.animate(r,o,s,m)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}})})(jQuery);(function(e){var t=0;e.widget("ui.autocomplete",{version:"1.10.3",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var t,i,n,s=this.element[0].nodeName.toLowerCase(),u="textarea"===s,o="input"===s;this.isMultiLine=u?!0:o?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[u||o?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(s){if(this.element.prop("readOnly"))return t=!0,n=!0,i=!0,undefined;t=!1,n=!1,i=!1;var u=e.ui.keyCode;switch(s.keyCode){case u.PAGE_UP:t=!0,this._move("previousPage",s);break;case u.PAGE_DOWN:t=!0,this._move("nextPage",s);break;case u.UP:t=!0,this._keyEvent("previous",s);break;case u.DOWN:t=!0,this._keyEvent("next",s);break;case u.ENTER:case u.NUMPAD_ENTER:this.menu.active&&(t=!0,s.preventDefault(),this.menu.select(s));break;case u.TAB:this.menu.active&&this.menu.select(s);break;case u.ESCAPE:this.menu.element.is(":visible")&&(this._value(this.term),this.close(s),s.preventDefault());break;default:i=!0,this._searchTimeout(s)}},keypress:function(n){if(t)return t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&n.preventDefault(),undefined;if(!i){var s=e.ui.keyCode;switch(n.keyCode){case s.PAGE_UP:this._move("previousPage",n);break;case s.PAGE_DOWN:this._move("nextPage",n);break;case s.UP:this._keyEvent("previous",n);break;case s.DOWN:this._keyEvent("next",n)}}},input:function(e){return n?(n=!1,e.preventDefault(),undefined):(this._searchTimeout(e),undefined)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,undefined):(clearTimeout(this.searching),this.close(e),this._change(e),undefined)}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().data("ui-menu"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(n){n.target===t.element[0]||n.target===i||e.contains(i,n.target)||t.close()})})},menufocus:function(t,i){if(this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type)))return this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)}),undefined;var n=i.item.data("ui-autocomplete-item");!1!==this._trigger("focus",t,{item:n})?t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(n.value):this.liveRegion.text(n.value)},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item"),n=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=n,this._delay(function(){this.previous=n,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value(),this.close(e),this.selectedItem=i}}),this.liveRegion=e("<span>",{role:"status","aria-live":"polite"}).addClass("ui-helper-hidden-accessible").insertBefore(this.element),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this._appendTo()),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var t,i,n=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(i,n){n(e.ui.autocomplete.filter(t,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(t,s){n.xhr&&n.xhr.abort(),n.xhr=e.ajax({url:i,data:t,dataType:"json",success:function(e){s(e)},error:function(){s([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){this.term!==this._value()&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length<this.options.minLength?this.close(t):this._trigger("search",t)!==!1?this._search(e):undefined},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var e=this,i=++t;return function(n){i===t&&e.__response(n),e.pending--,e.pending||e.element.removeClass("ui-autocomplete-loading")}},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return"string"==typeof t?{label:t,value:t}:e.extend({label:t.label||t.value,value:t.value||t.label},t)})},_suggest:function(t){var i=this.menu.element.empty();this._renderMenu(i,t),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,i){var n=this;e.each(i,function(e,i){n._renderItemData(t,i)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,i){return e("<li>").append(e("<a>").text(i.label)).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this._value(this.term),this.menu.blur(),undefined):(this.menu[e](t),undefined):(this.search(null,t),undefined)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault())}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,i){var n=RegExp(e.ui.autocomplete.escapeRegex(i),"i");return e.grep(t,function(e){return n.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var t;this._superApply(arguments),this.options.disabled||this.cancelSearch||(t=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.text(t))}})})(jQuery);(function(e){var t,a,r,i,n="ui-button ui-widget ui-state-default ui-corner-all",s="ui-state-hover ui-state-active ",o="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",d=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},u=function(t){var a=t.name,r=t.form,i=e([]);return a&&(a=a.replace(/'/g,"\\'"),i=r?e(r).find("[name='"+a+"']"):e("[name='"+a+"']",t.ownerDocument).filter(function(){return!this.form})),i};e.widget("ui.button",{version:"1.10.3",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,d),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var s=this,o=this.options,l="checkbox"===this.type||"radio"===this.type,h=l?"":"ui-state-active",c="ui-state-focus";null===o.label&&(o.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(n).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){o.disabled||this===t&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){o.disabled||e(this).removeClass(h)}).bind("click"+this.eventNamespace,function(e){o.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this.element.bind("focus"+this.eventNamespace,function(){s.buttonElement.addClass(c)}).bind("blur"+this.eventNamespace,function(){s.buttonElement.removeClass(c)}),l&&(this.element.bind("change"+this.eventNamespace,function(){i||s.refresh()}),this.buttonElement.bind("mousedown"+this.eventNamespace,function(e){o.disabled||(i=!1,a=e.pageX,r=e.pageY)}).bind("mouseup"+this.eventNamespace,function(e){o.disabled||(a!==e.pageX||r!==e.pageY)&&(i=!0)})),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return o.disabled||i?!1:undefined}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(o.disabled||i)return!1;e(this).addClass("ui-state-active"),s.buttonElement.attr("aria-pressed","true");var t=s.element[0];u(t).not(t).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return o.disabled?!1:(e(this).addClass("ui-state-active"),t=this,s.document.one("mouseup",function(){t=null}),undefined)}).bind("mouseup"+this.eventNamespace,function(){return o.disabled?!1:(e(this).removeClass("ui-state-active"),undefined)}).bind("keydown"+this.eventNamespace,function(t){return o.disabled?!1:((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"),undefined)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",o.disabled),this._resetButton()},_determineButtonType:function(){var e,t,a;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),a=this.element.is(":checked"),a&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",a)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(n+" "+s+" "+o).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?(t?this.element.prop("disabled",!0):this.element.prop("disabled",!1),undefined):(this._resetButton(),undefined)},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?u(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),undefined;var t=this.buttonElement.removeClass(o),a=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),r=this.options.icons,i=r.primary&&r.secondary,n=[];r.primary||r.secondary?(this.options.text&&n.push("ui-button-text-icon"+(i?"s":r.primary?"-primary":"-secondary")),r.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+r.primary+"'></span>"),r.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+r.secondary+"'></span>"),this.options.text||(n.push(i?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(a)))):n.push("ui-button-text-only"),t.addClass(n.join(" "))}}),e.widget("ui.buttonset",{version:"1.10.3",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t="rtl"===this.element.css("direction");this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}})})(jQuery);(function(e,t){function i(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.dpDiv=a(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function a(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",function(){e.datepicker._isDisabledDatepicker(s.inline?t.parent()[0]:s.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))})}function n(t,i){e.extend(t,i);for(var a in i)null==i[a]&&(t[a]=i[a]);return t}e.extend(e.ui,{datepicker:{version:"1.10.3"}});var s,r="datepicker";e.extend(i.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return n(this._defaults,e||{}),this},_attachDatepicker:function(t,i){var a,n,s;a=t.nodeName.toLowerCase(),n="div"===a||"span"===a,t.id||(this.uuid+=1,t.id="dp"+this.uuid),s=this._newInst(e(t),n),s.settings=e.extend({},i||{}),"input"===a?this._connectDatepicker(t,s):n&&this._inlineDatepicker(t,s)},_newInst:function(t,i){var n=t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:n,input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?a(e("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,i){var a=e(t);i.append=e([]),i.trigger=e([]),a.hasClass(this.markerClassName)||(this._attachments(a,i),a.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),e.data(t,r,i),i.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,i){var a,n,s,r=this._get(i,"appendText"),o=this._get(i,"isRTL");i.append&&i.append.remove(),r&&(i.append=e("<span class='"+this._appendClass+"'>"+r+"</span>"),t[o?"before":"after"](i.append)),t.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),a=this._get(i,"showOn"),("focus"===a||"both"===a)&&t.focus(this._showDatepicker),("button"===a||"both"===a)&&(n=this._get(i,"buttonText"),s=this._get(i,"buttonImage"),i.trigger=e(this._get(i,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:s,alt:n,title:n}):e("<button type='button'></button>").addClass(this._triggerClass).html(s?e("<img/>").attr({src:s,alt:n,title:n}):n)),t[o?"before":"after"](i.trigger),i.trigger.click(function(){return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker():e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker(),e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,i,a,n,s=new Date(2009,11,20),r=this._get(e,"dateFormat");r.match(/[DM]/)&&(t=function(e){for(i=0,a=0,n=0;e.length>n;n++)e[n].length>i&&(i=e[n].length,a=n);return a},s.setMonth(t(this._get(e,r.match(/MM/)?"monthNames":"monthNamesShort"))),s.setDate(t(this._get(e,r.match(/DD/)?"dayNames":"dayNamesShort"))+20-s.getDay())),e.input.attr("size",this._formatDate(e,s).length)}},_inlineDatepicker:function(t,i){var a=e(t);a.hasClass(this.markerClassName)||(a.addClass(this.markerClassName).append(i.dpDiv),e.data(t,r,i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(t),i.dpDiv.css("display","block"))},_dialogDatepicker:function(t,i,a,s,o){var l,u,c,h,d,p=this._dialogInst;return p||(this.uuid+=1,l="dp"+this.uuid,this._dialogInput=e("<input type='text' id='"+l+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),p=this._dialogInst=this._newInst(this._dialogInput,!1),p.settings={},e.data(this._dialogInput[0],r,p)),n(p.settings,s||{}),i=i&&i.constructor===Date?this._formatDate(p,i):i,this._dialogInput.val(i),this._pos=o?o.length?o:[o.pageX,o.pageY]:null,this._pos||(u=document.documentElement.clientWidth,c=document.documentElement.clientHeight,h=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[u/2-100+h,c/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),p.settings.onSelect=a,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],r,p),this},_destroyDatepicker:function(t){var i,a=e(t),n=e.data(t,r);a.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),e.removeData(t,r),"input"===i?(n.append.remove(),n.trigger.remove(),a.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&a.removeClass(this.markerClassName).empty())},_enableDatepicker:function(t){var i,a,n=e(t),s=e.data(t,r);n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!1,s.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(a=n.children("."+this._inlineClass),a.children().removeClass("ui-state-disabled"),a.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var i,a,n=e(t),s=e.data(t,r);n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!0,s.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(a=n.children("."+this._inlineClass),a.children().addClass("ui-state-disabled"),a.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;this._disabledInputs.length>t;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,r)}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(i,a,s){var r,o,l,u,c=this._getInst(i);return 2===arguments.length&&"string"==typeof a?"defaults"===a?e.extend({},e.datepicker._defaults):c?"all"===a?e.extend({},c.settings):this._get(c,a):null:(r=a||{},"string"==typeof a&&(r={},r[a]=s),c&&(this._curInst===c&&this._hideDatepicker(),o=this._getDateDatepicker(i,!0),l=this._getMinMaxDate(c,"min"),u=this._getMinMaxDate(c,"max"),n(c.settings,r),null!==l&&r.dateFormat!==t&&r.minDate===t&&(c.settings.minDate=this._formatDate(c,l)),null!==u&&r.dateFormat!==t&&r.maxDate===t&&(c.settings.maxDate=this._formatDate(c,u)),"disabled"in r&&(r.disabled?this._disableDatepicker(i):this._enableDatepicker(i)),this._attachments(e(i),c),this._autoSize(c),this._setDate(c,o),this._updateAlternate(c),this._updateDatepicker(c)),t)},_changeDatepicker:function(e,t,i){this._optionDatepicker(e,t,i)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var i=this._getInst(e);i&&(this._setDate(i,t),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(e,t){var i=this._getInst(e);return i&&!i.inline&&this._setDateFromField(i,t),i?this._getDate(i):null},_doKeyDown:function(t){var i,a,n,s=e.datepicker._getInst(t.target),r=!0,o=s.dpDiv.is(".ui-datepicker-rtl");if(s._keyEvent=!0,e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker(),r=!1;break;case 13:return n=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",s.dpDiv),n[0]&&e.datepicker._selectDay(t.target,s.selectedMonth,s.selectedYear,n[0]),i=e.datepicker._get(s,"onSelect"),i?(a=e.datepicker._formatDate(s),i.apply(s.input?s.input[0]:null,[a,s])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(s,"stepBigMonths"):-e.datepicker._get(s,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(s,"stepBigMonths"):+e.datepicker._get(s,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),r=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),r=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,o?1:-1,"D"),r=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(s,"stepBigMonths"):-e.datepicker._get(s,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),r=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,o?-1:1,"D"),r=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(s,"stepBigMonths"):+e.datepicker._get(s,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),r=t.ctrlKey||t.metaKey;break;default:r=!1}else 36===t.keyCode&&t.ctrlKey?e.datepicker._showDatepicker(this):r=!1;r&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(i){var a,n,s=e.datepicker._getInst(i.target);return e.datepicker._get(s,"constrainInput")?(a=e.datepicker._possibleChars(e.datepicker._get(s,"dateFormat")),n=String.fromCharCode(null==i.charCode?i.keyCode:i.charCode),i.ctrlKey||i.metaKey||" ">n||!a||a.indexOf(n)>-1):t},_doKeyUp:function(t){var i,a=e.datepicker._getInst(t.target);if(a.input.val()!==a.lastVal)try{i=e.datepicker.parseDate(e.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,e.datepicker._getFormatConfig(a)),i&&(e.datepicker._setDateFromField(a),e.datepicker._updateAlternate(a),e.datepicker._updateDatepicker(a))}catch(n){}return!0},_showDatepicker:function(t){if(t=t.target||t,"input"!==t.nodeName.toLowerCase()&&(t=e("input",t.parentNode)[0]),!e.datepicker._isDisabledDatepicker(t)&&e.datepicker._lastInput!==t){var i,a,s,r,o,l,u;i=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==i&&(e.datepicker._curInst.dpDiv.stop(!0,!0),i&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),a=e.datepicker._get(i,"beforeShow"),s=a?a.apply(t,[t,i]):{},s!==!1&&(n(i.settings,s),i.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(i),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),r=!1,e(t).parents().each(function(){return r|="fixed"===e(this).css("position"),!r}),o={left:e.datepicker._pos[0],top:e.datepicker._pos[1]},e.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(i),o=e.datepicker._checkOffset(i,o,r),i.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":r?"fixed":"absolute",display:"none",left:o.left+"px",top:o.top+"px"}),i.inline||(l=e.datepicker._get(i,"showAnim"),u=e.datepicker._get(i,"duration"),i.dpDiv.zIndex(e(t).zIndex()+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[l]?i.dpDiv.show(l,e.datepicker._get(i,"showOptions"),u):i.dpDiv[l||"show"](l?u:null),e.datepicker._shouldFocusInput(i)&&i.input.focus(),e.datepicker._curInst=i))}},_updateDatepicker:function(t){this.maxRows=4,s=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t),t.dpDiv.find("."+this._dayOverClass+" a").mouseover();var i,a=this._getNumberOfMonths(t),n=a[1],r=17;t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&t.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",r*n+"em"),t.dpDiv[(1!==a[0]||1!==a[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus(),t.yearshtml&&(i=t.yearshtml,setTimeout(function(){i===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),i=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,i,a){var n=t.dpDiv.outerWidth(),s=t.dpDiv.outerHeight(),r=t.input?t.input.outerWidth():0,o=t.input?t.input.outerHeight():0,l=document.documentElement.clientWidth+(a?0:e(document).scrollLeft()),u=document.documentElement.clientHeight+(a?0:e(document).scrollTop());return i.left-=this._get(t,"isRTL")?n-r:0,i.left-=a&&i.left===t.input.offset().left?e(document).scrollLeft():0,i.top-=a&&i.top===t.input.offset().top+o?e(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>l&&l>n?Math.abs(i.left+n-l):0),i.top-=Math.min(i.top,i.top+s>u&&u>s?Math.abs(s+o):0),i},_findPos:function(t){for(var i,a=this._getInst(t),n=this._get(a,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[n?"previousSibling":"nextSibling"];return i=e(t).offset(),[i.left,i.top]},_hideDatepicker:function(t){var i,a,n,s,o=this._curInst;!o||t&&o!==e.data(t,r)||this._datepickerShowing&&(i=this._get(o,"showAnim"),a=this._get(o,"duration"),n=function(){e.datepicker._tidyDialog(o)},e.effects&&(e.effects.effect[i]||e.effects[i])?o.dpDiv.hide(i,e.datepicker._get(o,"showOptions"),a,n):o.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?a:null,n),i||n(),this._datepickerShowing=!1,s=this._get(o,"onClose"),s&&s.apply(o.input?o.input[0]:null,[o.input?o.input.val():"",o]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(e.datepicker._curInst){var i=e(t.target),a=e.datepicker._getInst(i[0]);(i[0].id!==e.datepicker._mainDivId&&0===i.parents("#"+e.datepicker._mainDivId).length&&!i.hasClass(e.datepicker.markerClassName)&&!i.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||i.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==a)&&e.datepicker._hideDatepicker()}},_adjustDate:function(t,i,a){var n=e(t),s=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(s,i+("M"===a?this._get(s,"showCurrentAtPos"):0),a),this._updateDatepicker(s))},_gotoToday:function(t){var i,a=e(t),n=this._getInst(a[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(a)},_selectMonthYear:function(t,i,a){var n=e(t),s=this._getInst(n[0]);s["selected"+("M"===a?"Month":"Year")]=s["draw"+("M"===a?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(s),this._adjustDate(n)},_selectDay:function(t,i,a,n){var s,r=e(t);e(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(r[0])||(s=this._getInst(r[0]),s.selectedDay=s.currentDay=e("a",n).html(),s.selectedMonth=s.currentMonth=i,s.selectedYear=s.currentYear=a,this._selectDate(t,this._formatDate(s,s.currentDay,s.currentMonth,s.currentYear)))},_clearDate:function(t){var i=e(t);this._selectDate(i,"")},_selectDate:function(t,i){var a,n=e(t),s=this._getInst(n[0]);i=null!=i?i:this._formatDate(s),s.input&&s.input.val(i),this._updateAlternate(s),a=this._get(s,"onSelect"),a?a.apply(s.input?s.input[0]:null,[i,s]):s.input&&s.input.trigger("change"),s.inline?this._updateDatepicker(s):(this._hideDatepicker(),this._lastInput=s.input[0],"object"!=typeof s.input[0]&&s.input.focus(),this._lastInput=null)},_updateAlternate:function(t){var i,a,n,s=this._get(t,"altField");s&&(i=this._get(t,"altFormat")||this._get(t,"dateFormat"),a=this._getDate(t),n=this.formatDate(i,a,this._getFormatConfig(t)),e(s).each(function(){e(this).val(n)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t,i=new Date(e.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),t=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((t-i)/864e5)/7)+1},parseDate:function(i,a,n){if(null==i||null==a)throw"Invalid arguments";if(a="object"==typeof a?""+a:a+"",""===a)return null;var s,r,o,l,u=0,c=(n?n.shortYearCutoff:null)||this._defaults.shortYearCutoff,h="string"!=typeof c?c:(new Date).getFullYear()%100+parseInt(c,10),d=(n?n.dayNamesShort:null)||this._defaults.dayNamesShort,p=(n?n.dayNames:null)||this._defaults.dayNames,f=(n?n.monthNamesShort:null)||this._defaults.monthNamesShort,g=(n?n.monthNames:null)||this._defaults.monthNames,m=-1,_=-1,v=-1,y=-1,k=!1,D=function(e){var t=i.length>s+1&&i.charAt(s+1)===e;return t&&s++,t},b=function(e){var t=D(e),i="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,n=RegExp("^\\d{1,"+i+"}"),s=a.substring(u).match(n);if(!s)throw"Missing number at position "+u;return u+=s[0].length,parseInt(s[0],10)},w=function(i,n,s){var r=-1,o=e.map(D(i)?s:n,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(o,function(e,i){var n=i[1];return a.substr(u,n.length).toLowerCase()===n.toLowerCase()?(r=i[0],u+=n.length,!1):t}),-1!==r)return r+1;throw"Unknown name at position "+u},M=function(){if(a.charAt(u)!==i.charAt(s))throw"Unexpected literal at position "+u;u++};for(s=0;i.length>s;s++)if(k)"'"!==i.charAt(s)||D("'")?M():k=!1;else switch(i.charAt(s)){case"d":v=b("d");break;case"D":w("D",d,p);break;case"o":y=b("o");break;case"m":_=b("m");break;case"M":_=w("M",f,g);break;case"y":m=b("y");break;case"@":l=new Date(b("@")),m=l.getFullYear(),_=l.getMonth()+1,v=l.getDate();break;case"!":l=new Date((b("!")-this._ticksTo1970)/1e4),m=l.getFullYear(),_=l.getMonth()+1,v=l.getDate();break;case"'":D("'")?M():k=!0;break;default:M()}if(a.length>u&&(o=a.substr(u),!/^\s+/.test(o)))throw"Extra/unparsed characters found in date: "+o;if(-1===m?m=(new Date).getFullYear():100>m&&(m+=(new Date).getFullYear()-(new Date).getFullYear()%100+(h>=m?0:-100)),y>-1)for(_=1,v=y;;){if(r=this._getDaysInMonth(m,_-1),r>=v)break;_++,v-=r}if(l=this._daylightSavingAdjust(new Date(m,_-1,v)),l.getFullYear()!==m||l.getMonth()+1!==_||l.getDate()!==v)throw"Invalid date";return l},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(e,t,i){if(!t)return"";var a,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,s=(i?i.dayNames:null)||this._defaults.dayNames,r=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,o=(i?i.monthNames:null)||this._defaults.monthNames,l=function(t){var i=e.length>a+1&&e.charAt(a+1)===t;return i&&a++,i},u=function(e,t,i){var a=""+t;if(l(e))for(;i>a.length;)a="0"+a;return a},c=function(e,t,i,a){return l(e)?a[t]:i[t]},h="",d=!1;if(t)for(a=0;e.length>a;a++)if(d)"'"!==e.charAt(a)||l("'")?h+=e.charAt(a):d=!1;else switch(e.charAt(a)){case"d":h+=u("d",t.getDate(),2);break;case"D":h+=c("D",t.getDay(),n,s);break;case"o":h+=u("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":h+=u("m",t.getMonth()+1,2);break;case"M":h+=c("M",t.getMonth(),r,o);break;case"y":h+=l("y")?t.getFullYear():(10>t.getYear()%100?"0":"")+t.getYear()%100;break;case"@":h+=t.getTime();break;case"!":h+=1e4*t.getTime()+this._ticksTo1970;break;case"'":l("'")?h+="'":d=!0;break;default:h+=e.charAt(a)}return h},_possibleChars:function(e){var t,i="",a=!1,n=function(i){var a=e.length>t+1&&e.charAt(t+1)===i;return a&&t++,a};for(t=0;e.length>t;t++)if(a)"'"!==e.charAt(t)||n("'")?i+=e.charAt(t):a=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":a=!0;break;default:i+=e.charAt(t)}return i},_get:function(e,i){return e.settings[i]!==t?e.settings[i]:this._defaults[i]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var i=this._get(e,"dateFormat"),a=e.lastVal=e.input?e.input.val():null,n=this._getDefaultDate(e),s=n,r=this._getFormatConfig(e);try{s=this.parseDate(i,a,r)||n}catch(o){a=t?"":a}e.selectedDay=s.getDate(),e.drawMonth=e.selectedMonth=s.getMonth(),e.drawYear=e.selectedYear=s.getFullYear(),e.currentDay=a?s.getDate():0,e.currentMonth=a?s.getMonth():0,e.currentYear=a?s.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,i,a){var n=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},s=function(i){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),i,e.datepicker._getFormatConfig(t))}catch(a){}for(var n=(i.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,s=n.getFullYear(),r=n.getMonth(),o=n.getDate(),l=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,u=l.exec(i);u;){switch(u[2]||"d"){case"d":case"D":o+=parseInt(u[1],10);break;case"w":case"W":o+=7*parseInt(u[1],10);break;case"m":case"M":r+=parseInt(u[1],10),o=Math.min(o,e.datepicker._getDaysInMonth(s,r));break;case"y":case"Y":s+=parseInt(u[1],10),o=Math.min(o,e.datepicker._getDaysInMonth(s,r))}u=l.exec(i)}return new Date(s,r,o)},r=null==i||""===i?a:"string"==typeof i?s(i):"number"==typeof i?isNaN(i)?a:n(i):new Date(i.getTime());return r=r&&"Invalid Date"==""+r?a:r,r&&(r.setHours(0),r.setMinutes(0),r.setSeconds(0),r.setMilliseconds(0)),this._daylightSavingAdjust(r)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,i){var a=!t,n=e.selectedMonth,s=e.selectedYear,r=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=r.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=r.getMonth(),e.drawYear=e.selectedYear=e.currentYear=r.getFullYear(),n===e.selectedMonth&&s===e.selectedYear||i||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(a?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&""===e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(t){var i=this._get(t,"stepMonths"),a="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(a,-i,"M")},next:function(){e.datepicker._adjustDate(a,+i,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(a)},selectDay:function(){return e.datepicker._selectDay(a,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(a,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(a,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,i,a,n,s,r,o,l,u,c,h,d,p,f,g,m,_,v,y,k,D,b,w,M,x,C,I,T,N,A,F,S,E,Y,W,P,O,j,L,H=new Date,R=this._daylightSavingAdjust(new Date(H.getFullYear(),H.getMonth(),H.getDate())),K=this._get(e,"isRTL"),U=this._get(e,"showButtonPanel"),B=this._get(e,"hideIfNoPrevNext"),z=this._get(e,"navigationAsDateFormat"),q=this._getNumberOfMonths(e),G=this._get(e,"showCurrentAtPos"),$=this._get(e,"stepMonths"),V=1!==q[0]||1!==q[1],Q=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),J=this._getMinMaxDate(e,"min"),X=this._getMinMaxDate(e,"max"),Z=e.drawMonth-G,et=e.drawYear;if(0>Z&&(Z+=12,et--),X)for(t=this._daylightSavingAdjust(new Date(X.getFullYear(),X.getMonth()-q[0]*q[1]+1,X.getDate())),t=J&&J>t?J:t;this._daylightSavingAdjust(new Date(et,Z,1))>t;)Z--,0>Z&&(Z=11,et--);for(e.drawMonth=Z,e.drawYear=et,i=this._get(e,"prevText"),i=z?this.formatDate(i,this._daylightSavingAdjust(new Date(et,Z-$,1)),this._getFormatConfig(e)):i,a=this._canAdjustMonth(e,-1,et,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(K?"e":"w")+"'>"+i+"</span></a>":B?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(K?"e":"w")+"'>"+i+"</span></a>",n=this._get(e,"nextText"),n=z?this.formatDate(n,this._daylightSavingAdjust(new Date(et,Z+$,1)),this._getFormatConfig(e)):n,s=this._canAdjustMonth(e,1,et,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(K?"w":"e")+"'>"+n+"</span></a>":B?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(K?"w":"e")+"'>"+n+"</span></a>",r=this._get(e,"currentText"),o=this._get(e,"gotoCurrent")&&e.currentDay?Q:R,r=z?this.formatDate(r,o,this._getFormatConfig(e)):r,l=e.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(e,"closeText")+"</button>",u=U?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(K?l:"")+(this._isInRange(e,o)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+r+"</button>":"")+(K?"":l)+"</div>":"",c=parseInt(this._get(e,"firstDay"),10),c=isNaN(c)?0:c,h=this._get(e,"showWeek"),d=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),f=this._get(e,"monthNames"),g=this._get(e,"monthNamesShort"),m=this._get(e,"beforeShowDay"),_=this._get(e,"showOtherMonths"),v=this._get(e,"selectOtherMonths"),y=this._getDefaultDate(e),k="",b=0;q[0]>b;b++){for(w="",this.maxRows=4,M=0;q[1]>M;M++){if(x=this._daylightSavingAdjust(new Date(et,Z,e.selectedDay)),C=" ui-corner-all",I="",V){if(I+="<div class='ui-datepicker-group",q[1]>1)switch(M){case 0:I+=" ui-datepicker-group-first",C=" ui-corner-"+(K?"right":"left");break;case q[1]-1:I+=" ui-datepicker-group-last",C=" ui-corner-"+(K?"left":"right");break;default:I+=" ui-datepicker-group-middle",C=""}I+="'>"}for(I+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+C+"'>"+(/all|left/.test(C)&&0===b?K?s:a:"")+(/all|right/.test(C)&&0===b?K?a:s:"")+this._generateMonthYearHeader(e,Z,et,J,X,b>0||M>0,f,g)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",T=h?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",D=0;7>D;D++)N=(D+c)%7,T+="<th"+((D+c+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+d[N]+"'>"+p[N]+"</span></th>";for(I+=T+"</tr></thead><tbody>",A=this._getDaysInMonth(et,Z),et===e.selectedYear&&Z===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,A)),F=(this._getFirstDayOfMonth(et,Z)-c+7)%7,S=Math.ceil((F+A)/7),E=V?this.maxRows>S?this.maxRows:S:S,this.maxRows=E,Y=this._daylightSavingAdjust(new Date(et,Z,1-F)),W=0;E>W;W++){for(I+="<tr>",P=h?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(Y)+"</td>":"",D=0;7>D;D++)O=m?m.apply(e.input?e.input[0]:null,[Y]):[!0,""],j=Y.getMonth()!==Z,L=j&&!v||!O[0]||J&&J>Y||X&&Y>X,P+="<td class='"+((D+c+6)%7>=5?" ui-datepicker-week-end":"")+(j?" ui-datepicker-other-month":"")+(Y.getTime()===x.getTime()&&Z===e.selectedMonth&&e._keyEvent||y.getTime()===Y.getTime()&&y.getTime()===x.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(j&&!_?"":" "+O[1]+(Y.getTime()===Q.getTime()?" "+this._currentClass:"")+(Y.getTime()===R.getTime()?" ui-datepicker-today":""))+"'"+(j&&!_||!O[2]?"":" title='"+O[2].replace(/'/g,"&#39;")+"'")+(L?"":" data-handler='selectDay' data-event='click' data-month='"+Y.getMonth()+"' data-year='"+Y.getFullYear()+"'")+">"+(j&&!_?"&#xa0;":L?"<span class='ui-state-default'>"+Y.getDate()+"</span>":"<a class='ui-state-default"+(Y.getTime()===R.getTime()?" ui-state-highlight":"")+(Y.getTime()===Q.getTime()?" ui-state-active":"")+(j?" ui-priority-secondary":"")+"' href='#'>"+Y.getDate()+"</a>")+"</td>",Y.setDate(Y.getDate()+1),Y=this._daylightSavingAdjust(Y);I+=P+"</tr>"}Z++,Z>11&&(Z=0,et++),I+="</tbody></table>"+(V?"</div>"+(q[0]>0&&M===q[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),w+=I}k+=w}return k+=u,e._keyEvent=!1,k},_generateMonthYearHeader:function(e,t,i,a,n,s,r,o){var l,u,c,h,d,p,f,g,m=this._get(e,"changeMonth"),_=this._get(e,"changeYear"),v=this._get(e,"showMonthAfterYear"),y="<div class='ui-datepicker-title'>",k="";if(s||!m)k+="<span class='ui-datepicker-month'>"+r[t]+"</span>";else{for(l=a&&a.getFullYear()===i,u=n&&n.getFullYear()===i,k+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",c=0;12>c;c++)(!l||c>=a.getMonth())&&(!u||n.getMonth()>=c)&&(k+="<option value='"+c+"'"+(c===t?" selected='selected'":"")+">"+o[c]+"</option>");k+="</select>"}if(v||(y+=k+(!s&&m&&_?"":"&#xa0;")),!e.yearshtml)if(e.yearshtml="",s||!_)y+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(h=this._get(e,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(e){var t=e.match(/c[+\-].*/)?i+parseInt(e.substring(1),10):e.match(/[+\-].*/)?d+parseInt(e,10):parseInt(e,10);
-return isNaN(t)?d:t},f=p(h[0]),g=Math.max(f,p(h[1]||"")),f=a?Math.max(f,a.getFullYear()):f,g=n?Math.min(g,n.getFullYear()):g,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";g>=f;f++)e.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";e.yearshtml+="</select>",y+=e.yearshtml,e.yearshtml=null}return y+=this._get(e,"yearSuffix"),v&&(y+=(!s&&m&&_?"":"&#xa0;")+k),y+="</div>"},_adjustInstDate:function(e,t,i){var a=e.drawYear+("Y"===i?t:0),n=e.drawMonth+("M"===i?t:0),s=Math.min(e.selectedDay,this._getDaysInMonth(a,n))+("D"===i?t:0),r=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(a,n,s)));e.selectedDay=r.getDate(),e.drawMonth=e.selectedMonth=r.getMonth(),e.drawYear=e.selectedYear=r.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var i=this._getMinMaxDate(e,"min"),a=this._getMinMaxDate(e,"max"),n=i&&i>t?i:t;return a&&n>a?a:n},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay()},_canAdjustMonth:function(e,t,i,a){var n=this._getNumberOfMonths(e),s=this._daylightSavingAdjust(new Date(i,a+(0>t?t:n[0]*n[1]),1));return 0>t&&s.setDate(this._getDaysInMonth(s.getFullYear(),s.getMonth())),this._isInRange(e,s)},_isInRange:function(e,t){var i,a,n=this._getMinMaxDate(e,"min"),s=this._getMinMaxDate(e,"max"),r=null,o=null,l=this._get(e,"yearRange");return l&&(i=l.split(":"),a=(new Date).getFullYear(),r=parseInt(i[0],10),o=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(r+=a),i[1].match(/[+\-].*/)&&(o+=a)),(!n||t.getTime()>=n.getTime())&&(!s||t.getTime()<=s.getTime())&&(!r||t.getFullYear()>=r)&&(!o||o>=t.getFullYear())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,i,a){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var n=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(a,i,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),n,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(i)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i))},e.datepicker=new i,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.10.3"})(jQuery);(function(e){var t={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},a={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};e.widget("ui.dialog",{version:"1.10.3",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var a=e(this).css(t).offset().top;0>a&&e(this).css("top",t.top-a)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var a=this;this._isOpen&&this._trigger("beforeClose",t)!==!1&&(this._isOpen=!1,this._destroyOverlay(),this.opener.filter(":focusable").focus().length||e(this.document[0].activeElement).blur(),this._hide(this.uiDialog,this.options.hide,function(){a._trigger("close",t)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(e,t){var a=!!this.uiDialog.nextAll(":visible").insertBefore(this.uiDialog).length;return a&&!t&&this._trigger("focus",e),a},open:function(){var t=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),undefined):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._trigger("open"),undefined)},_focusTabbable:function(){var e=this.element.find("[autofocus]");e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus()},_keepFocus:function(t){function a(){var t=this.document[0].activeElement,a=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);a||this._focusTabbable()}t.preventDefault(),a.call(this),this._delay(a)},_createWrapper:function(){this.uiDialog=e("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault(),this.close(t),undefined;if(t.keyCode===e.ui.keyCode.TAB){var a=this.uiDialog.find(":tabbable"),i=a.filter(":first"),r=a.filter(":last");t.target!==r[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==i[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(r.focus(1),t.preventDefault()):(i.focus(1),t.preventDefault())}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("<button></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html("&#160;"),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,a=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(a)||e.isArray(a)&&!a.length?(this.uiDialog.removeClass("ui-dialog-buttons"),undefined):(e.each(a,function(a,i){var r,n;i=e.isFunction(i)?{click:i,text:a}:i,i=e.extend({type:"button"},i),r=i.click,i.click=function(){r.apply(t.element[0],arguments)},n={icons:i.icons,text:i.showText},delete i.icons,delete i.showText,e("<button></button>",i).button(n).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),undefined)},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var a=this,i=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(i,r){e(this).addClass("ui-dialog-dragging"),a._blockFrames(),a._trigger("dragStart",i,t(r))},drag:function(e,i){a._trigger("drag",e,t(i))},stop:function(r,n){i.position=[n.position.left-a.document.scrollLeft(),n.position.top-a.document.scrollTop()],e(this).removeClass("ui-dialog-dragging"),a._unblockFrames(),a._trigger("dragStop",r,t(n))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var a=this,i=this.options,r=i.resizable,n=this.uiDialog.css("position"),s="string"==typeof r?r:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:i.maxWidth,maxHeight:i.maxHeight,minWidth:i.minWidth,minHeight:this._minHeight(),handles:s,start:function(i,r){e(this).addClass("ui-dialog-resizing"),a._blockFrames(),a._trigger("resizeStart",i,t(r))},resize:function(e,i){a._trigger("resize",e,t(i))},stop:function(r,n){i.height=e(this).height(),i.width=e(this).width(),e(this).removeClass("ui-dialog-resizing"),a._unblockFrames(),a._trigger("resizeStop",r,t(n))}}).css("position",n)},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(i){var r=this,n=!1,s={};e.each(i,function(e,i){r._setOption(e,i),e in t&&(n=!0),e in a&&(s[e]=i)}),n&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",s)},_setOption:function(e,t){var a,i,r=this.uiDialog;"dialogClass"===e&&r.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&(a=r.is(":data(ui-draggable)"),a&&!t&&r.draggable("destroy"),!a&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(i=r.is(":data(ui-resizable)"),i&&!t&&r.resizable("destroy"),i&&"string"==typeof t&&r.resizable("option","handles",t),i||t===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,a,i=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),i.minWidth>i.width&&(i.width=i.minWidth),e=this.uiDialog.css({height:"auto",width:i.width}).outerHeight(),t=Math.max(0,i.minHeight-e),a="number"==typeof i.maxHeight?Math.max(0,i.maxHeight-e):"none","auto"===i.height?this.element.css({minHeight:t,maxHeight:a,height:"auto"}):this.element.height(Math.max(0,i.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var t=this,a=this.widgetFullName;e.ui.dialog.overlayInstances||this._delay(function(){e.ui.dialog.overlayInstances&&this.document.bind("focusin.dialog",function(i){t._allowInteraction(i)||(i.preventDefault(),e(".ui-dialog:visible:last .ui-dialog-content").data(a)._focusTabbable())})}),this.overlay=e("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),e.ui.dialog.overlayInstances++}},_destroyOverlay:function(){this.options.modal&&this.overlay&&(e.ui.dialog.overlayInstances--,e.ui.dialog.overlayInstances||this.document.unbind("focusin.dialog"),this.overlay.remove(),this.overlay=null)}}),e.ui.dialog.overlayInstances=0,e.uiBackCompat!==!1&&e.widget("ui.dialog",e.ui.dialog,{_position:function(){var t,a=this.options.position,i=[],r=[0,0];a?(("string"==typeof a||"object"==typeof a&&"0"in a)&&(i=a.split?a.split(" "):[a[0],a[1]],1===i.length&&(i[1]=i[0]),e.each(["left","top"],function(e,t){+i[e]===i[e]&&(r[e]=i[e],i[e]=t)}),a={my:i[0]+(0>r[0]?r[0]:"+"+r[0])+" "+i[1]+(0>r[1]?r[1]:"+"+r[1]),at:i.join(" ")}),a=e.extend({},e.ui.dialog.prototype.options.position,a)):a=e.ui.dialog.prototype.options.position,t=this.uiDialog.is(":visible"),t||this.uiDialog.show(),this.uiDialog.position(a),t||this.uiDialog.hide()}})})(jQuery);(function(e){e.widget("ui.menu",{version:"1.10.3",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content ui-corner-all").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}).bind("click"+this.eventNamespace,e.proxy(function(e){this.options.disabled&&e.preventDefault()},this)),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item > a":function(e){e.preventDefault()},"click .ui-state-disabled > a":function(e){e.preventDefault()},"click .ui-menu-item:has(a)":function(t){var i=e(t.target).closest(".ui-menu-item");!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.mouseHandled=!0,this.select(t),i.has(".ui-menu").length?this.expand(t):this.element.is(":focus")||(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){var i=e(t.currentTarget);i.siblings().children(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.children(".ui-menu-item").eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){e(t.target).closest(".ui-menu").length||this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").children("a").removeUniqueId().removeClass("ui-corner-all ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){function i(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var n,s,u,a,o,r=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:r=!1,s=this.previousFilter||"",u=String.fromCharCode(t.keyCode),a=!1,clearTimeout(this.filterTimer),u===s?a=!0:u=s+u,o=RegExp("^"+i(u),"i"),n=this.activeMenu.children(".ui-menu-item").filter(function(){return o.test(e(this).children("a").text())}),n=a&&-1!==n.index(this.active.next())?this.active.nextAll(".ui-menu-item"):n,n.length||(u=String.fromCharCode(t.keyCode),o=RegExp("^"+i(u),"i"),n=this.activeMenu.children(".ui-menu-item").filter(function(){return o.test(e(this).children("a").text())})),n.length?(this.focus(t,n),n.length>1?(this.previousFilter=u,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter):delete this.previousFilter}r&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.children("a[aria-haspopup='true']").length?this.expand(e):this.select(e))},refresh:function(){var t,i=this.options.icons.submenu,n=this.element.find(this.options.menus);n.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-corner-all").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),n=t.prev("a"),s=e("<span>").addClass("ui-menu-icon ui-icon "+i).data("ui-menu-submenu-carat",!0);n.attr("aria-haspopup","true").prepend(s),t.attr("aria-labelledby",n.attr("id"))}),t=n.add(this.element),t.children(":not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","presentation").children("a").uniqueId().addClass("ui-corner-all").attr({tabIndex:-1,role:this._itemRole()}),t.children(":not(.ui-menu-item)").each(function(){var t=e(this);/[^\-\u2014\u2013\s]/.test(t.text())||t.addClass("ui-widget-content ui-menu-divider")}),t.children(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),this._super(e,t)},focus:function(e,t){var i,n;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),n=this.active.children("a").addClass("ui-state-focus"),this.options.role&&this.element.attr("aria-activedescendant",n.attr("id")),this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=t.children(".ui-menu"),i.length&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,n,s,u,a,o;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,n=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,s=t.offset().top-this.activeMenu.offset().top-i-n,u=this.activeMenu.scrollTop(),a=this.activeMenu.height(),o=t.height(),0>s?this.activeMenu.scrollTop(u+s):s+o>a&&this.activeMenu.scrollTop(u+s-a+o))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.children("a").removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var i=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var n=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));n.length||(n=this.element),this._close(n),this.blur(t),this.activeMenu=n},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find("a.ui-state-active").removeClass("ui-state-active")},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").children(".ui-menu-item").first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,i){var n;this.active&&(n="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),n&&n.length&&this.active||(n=this.activeMenu.children(".ui-menu-item")[t]()),this.focus(i,n)},nextPage:function(t){var i,n,s;return this.active?(this.isLastItem()||(this._hasScroll()?(n=this.active.offset().top,s=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=e(this),0>i.offset().top-n-s}),this.focus(t,i)):this.focus(t,this.activeMenu.children(".ui-menu-item")[this.active?"last":"first"]())),undefined):(this.next(t),undefined)},previousPage:function(t){var i,n,s;return this.active?(this.isFirstItem()||(this._hasScroll()?(n=this.active.offset().top,s=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=e(this),i.offset().top-n+s>0}),this.focus(t,i)):this.focus(t,this.activeMenu.children(".ui-menu-item").first())),undefined):(this.next(t),undefined)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,i)}})})(jQuery);(function(e,t){e.widget("ui.progressbar",{version:"1.10.3",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return e===t?this.options.value:(this.options.value=this._constrainedValue(e),this._refreshValue(),t)},_constrainedValue:function(e){return e===t&&(e=this.options.value),this.indeterminate=e===!1,"number"!=typeof e&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){"max"===e&&(t=Math.max(this.min,t)),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,a=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(a.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}})})(jQuery);(function(e){var t=5;e.widget("ui.slider",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,i,a=this.options,s=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),r="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",n=[];for(i=a.values&&a.values.length||1,s.length>i&&(s.slice(i).remove(),s=s.slice(0,i)),t=s.length;i>t;t++)n.push(r);this.handles=s.add(e(n.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)})},_createRange:function(){var t=this.options,i="";t.range?(t.range===!0&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:e.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=e("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===t.range||"max"===t.range?" ui-slider-range-"+t.range:""))):this.range=e([])},_setupEvents:function(){var e=this.handles.add(this.range).filter("a");this._off(e),this._on(e,this._handleEvents),this._hoverable(e),this._focusable(e)},_destroy:function(){this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var i,a,s,r,n,o,l,h,u=this,d=this.options;return d.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:t.pageX,y:t.pageY},a=this._normValueFromMouse(i),s=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var i=Math.abs(a-u.values(t));(s>i||s===i&&(t===u._lastChangedValue||u.values(t)===d.min))&&(s=i,r=e(this),n=t)}),o=this._start(t,n),o===!1?!1:(this._mouseSliding=!0,this._handleIndex=n,r.addClass("ui-state-active").focus(),l=r.offset(),h=!e(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=h?{left:0,top:0}:{left:t.pageX-l.left-r.width()/2,top:t.pageY-l.top-r.height()/2-(parseInt(r.css("borderTopWidth"),10)||0)-(parseInt(r.css("borderBottomWidth"),10)||0)+(parseInt(r.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,n,a),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,i),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,i,a,s,r;return"horizontal"===this.orientation?(t=this.elementSize.width,i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),a=i/t,a>1&&(a=1),0>a&&(a=0),"vertical"===this.orientation&&(a=1-a),s=this._valueMax()-this._valueMin(),r=this._valueMin()+a*s,this._trimAlignValue(r)},_start:function(e,t){var i={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("start",e,i)},_slide:function(e,t,i){var a,s,r;this.options.values&&this.options.values.length?(a=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&i>a||1===t&&a>i)&&(i=a),i!==this.values(t)&&(s=this.values(),s[t]=i,r=this._trigger("slide",e,{handle:this.handles[t],value:i,values:s}),a=this.values(t?0:1),r!==!1&&this.values(t,i,!0))):i!==this.value()&&(r=this._trigger("slide",e,{handle:this.handles[t],value:i}),r!==!1&&this.value(i))},_stop:function(e,t){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("stop",e,i)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._lastChangedValue=t,this._trigger("change",e,i)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0),undefined):this._value()},values:function(t,i){var a,s,r;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(i),this._refreshValue(),this._change(null,t),undefined;if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();for(a=this.options.values,s=arguments[0],r=0;a.length>r;r+=1)a[r]=this._trimAlignValue(s[r]),this._change(null,r);this._refreshValue()},_setOption:function(t,i){var a,s=0;switch("range"===t&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),e.isArray(this.options.values)&&(s=this.options.values.length),e.Widget.prototype._setOption.apply(this,arguments),t){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),a=0;s>a;a+=1)this._change(null,a);this._animateOff=!1;break;case"min":case"max":this._animateOff=!0,this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e)},_values:function(e){var t,i,a;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),a=0;i.length>a;a+=1)i[a]=this._trimAlignValue(i[a]);return i}return[]},_trimAlignValue:function(e){if(this._valueMin()>=e)return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,i=(e-this._valueMin())%t,a=e-i;return 2*Math.abs(i)>=t&&(a+=i>0?t:-t),parseFloat(a.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var t,i,a,s,r,n=this.options.range,o=this.options,l=this,h=this._animateOff?!1:o.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(a){i=100*((l.values(a)-l._valueMin())/(l._valueMax()-l._valueMin())),u["horizontal"===l.orientation?"left":"bottom"]=i+"%",e(this).stop(1,1)[h?"animate":"css"](u,o.animate),l.options.range===!0&&("horizontal"===l.orientation?(0===a&&l.range.stop(1,1)[h?"animate":"css"]({left:i+"%"},o.animate),1===a&&l.range[h?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:o.animate})):(0===a&&l.range.stop(1,1)[h?"animate":"css"]({bottom:i+"%"},o.animate),1===a&&l.range[h?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:o.animate}))),t=i}):(a=this.value(),s=this._valueMin(),r=this._valueMax(),i=r!==s?100*((a-s)/(r-s)):0,u["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[h?"animate":"css"](u,o.animate),"min"===n&&"horizontal"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({width:i+"%"},o.animate),"max"===n&&"horizontal"===this.orientation&&this.range[h?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:o.animate}),"min"===n&&"vertical"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({height:i+"%"},o.animate),"max"===n&&"vertical"===this.orientation&&this.range[h?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:o.animate}))},_handleEvents:{keydown:function(i){var a,s,r,n,o=e(i.target).data("ui-slider-handle-index");switch(i.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(i.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(i.target).addClass("ui-state-active"),a=this._start(i,o),a===!1))return}switch(n=this.options.step,s=r=this.options.values&&this.options.values.length?this.values(o):this.value(),i.keyCode){case e.ui.keyCode.HOME:r=this._valueMin();break;case e.ui.keyCode.END:r=this._valueMax();break;case e.ui.keyCode.PAGE_UP:r=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/t);break;case e.ui.keyCode.PAGE_DOWN:r=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/t);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(s===this._valueMax())return;r=this._trimAlignValue(s+n);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(s===this._valueMin())return;r=this._trimAlignValue(s-n)}this._slide(i,o,r)},click:function(e){e.preventDefault()},keyup:function(t){var i=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,i),this._change(t,i),e(t.target).removeClass("ui-state-active"))}}})})(jQuery);(function(e){function t(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.widget("ui.spinner",{version:"1.10.3",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},i=this.element;return e.each(["min","max","step"],function(e,a){var s=i.attr(a);void 0!==s&&s.length&&(t[a]=s)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",e),void 0)},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()}},"mousedown .ui-spinner-button":function(t){function i(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=a,this._delay(function(){this.previous=a}))}var a;a=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(t)!==!1&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?this._start(t)===!1?!1:(this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*e.height())&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var i=this.options,a=e.ui.keyCode;switch(t.keyCode){case a.UP:return this._repeat(null,1,t),!0;case a.DOWN:return this._repeat(null,-1,t),!0;case a.PAGE_UP:return this._repeat(null,i.page,t),!0;case a.PAGE_DOWN:return this._repeat(null,-i.page,t),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>&#9650;</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>&#9660;</span>"+"</a>"},_start:function(e){return this.spinning||this._trigger("start",e)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(e,t,i){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,i)},e),this._spin(t*this.options.step,i)},_spin:function(e,t){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?e.isFunction(i)?i(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(e){var t,i,a=this.options;return t=null!==a.min?a.min:0,i=e-t,i=Math.round(i/a.step)*a.step,e=t+i,e=parseFloat(e.toFixed(this._precision())),null!==a.max&&e>a.max?a.max:null!==a.min&&a.min>e?a.min:e},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var i=this._parse(this.element.val());return this.options[e]=t,this.element.val(this._format(i)),void 0}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),"icons"===e&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),"disabled"===e&&(t?(this.element.prop("disabled",!0),this.buttons.button("disable")):(this.element.prop("disabled",!1),this.buttons.button("enable")))},_setOptions:t(function(e){this._super(e),this._value(this.element.val())}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},_value:function(e,t){var i;""!==e&&(i=this._parse(e),null!==i&&(t||(i=this._adjustValue(i)),e=this._format(i))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:t(function(e){this._stepUp(e)}),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:t(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:t(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:t(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?(t(this._value).call(this,e),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}})})(jQuery);(function(e,t){function i(){return++s}function a(e){return e.hash.length>1&&decodeURIComponent(e.href.replace(r,""))===decodeURIComponent(location.href.replace(r,""))}var s=0,r=/#.*$/;e.widget("ui.tabs",{version:"1.10.3",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_create:function(){var t=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible).delegate(".ui-tabs-nav > li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this._processTabs(),i.active=this._initialActive(),e.isArray(i.disabled)&&(i.disabled=e.unique(i.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):e(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var i=this.options.active,a=this.options.collapsible,s=location.hash.substring(1);return null===i&&(s&&this.tabs.each(function(a,r){return e(r).attr("aria-controls")===s?(i=a,!1):t}),null===i&&(i=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===i||-1===i)&&(i=this.tabs.length?0:!1)),i!==!1&&(i=this.tabs.index(this.tabs.eq(i)),-1===i&&(i=a?!1:0)),!a&&i===!1&&this.anchors.length&&(i=0),i},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(i){var a=e(this.document[0].activeElement).closest("li"),s=this.tabs.index(a),r=!0;if(!this._handlePageNav(i)){switch(i.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:s++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:r=!1,s--;break;case e.ui.keyCode.END:s=this.anchors.length-1;break;case e.ui.keyCode.HOME:s=0;break;case e.ui.keyCode.SPACE:return i.preventDefault(),clearTimeout(this.activating),this._activate(s),t;case e.ui.keyCode.ENTER:return i.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),t;default:return}i.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,r),i.ctrlKey||(a.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(i){return i.altKey&&i.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):i.altKey&&i.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):t},_findNextTab:function(t,i){function a(){return t>s&&(t=0),0>t&&(t=s),t}for(var s=this.tabs.length-1;-1!==e.inArray(a(),this.options.disabled);)t=i?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,i){return"active"===e?(this._activate(i),t):"disabled"===e?(this._setupDisabled(i),t):(this._super(e,i),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",i),i||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(i),"heightStyle"===e&&this._setupHeightStyle(i),t)},_tabId:function(e){return e.attr("aria-controls")||"ui-tabs-"+i()},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.index(e)}),this._processTabs(),t.active!==!1&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-expanded":"false","aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-expanded":"true","aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist"),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(i,s){var r,n,o,h=e(s).uniqueId().attr("id"),l=e(s).closest("li"),u=l.attr("aria-controls");a(s)?(r=s.hash,n=t.element.find(t._sanitizeSelector(r))):(o=t._tabId(l),r="#"+o,n=t.element.find(r),n.length||(n=t._createPanel(o),n.insertAfter(t.panels[i-1]||t.tablist)),n.attr("aria-live","polite")),n.length&&(t.panels=t.panels.add(n)),u&&l.data("ui-tabs-aria-controls",u),l.attr({"aria-controls":r.substring(1),"aria-labelledby":h}),n.attr("aria-labelledby",h)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel")},_getList:function(){return this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var i,a=0;i=this.tabs[a];a++)t===!0||-1!==e.inArray(a,t)?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={click:function(e){e.preventDefault()}};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,a=this.element.parent();"fill"===t?(i=a.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),a=t.css("position");"absolute"!==a&&"fixed"!==a&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,e(this).height("").height())}).height(i))},_eventHandler:function(t){var i=this.options,a=this.active,s=e(t.currentTarget),r=s.closest("li"),n=r[0]===a[0],o=n&&i.collapsible,h=o?e():this._getPanelForTab(r),l=a.length?this._getPanelForTab(a):e(),u={oldTab:a,oldPanel:l,newTab:o?e():r,newPanel:h};t.preventDefault(),r.hasClass("ui-state-disabled")||r.hasClass("ui-tabs-loading")||this.running||n&&!i.collapsible||this._trigger("beforeActivate",t,u)===!1||(i.active=o?!1:this.tabs.index(r),this.active=n?e():r,this.xhr&&this.xhr.abort(),l.length||h.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(r),t),this._toggle(t,u))},_toggle:function(t,i){function a(){r.running=!1,r._trigger("activate",t,i)}function s(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),n.length&&r.options.show?r._show(n,r.options.show,a):(n.show(),a())}var r=this,n=i.newPanel,o=i.oldPanel;this.running=!0,o.length&&this.options.hide?this._hide(o,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),s()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),o.hide(),s()),o.attr({"aria-expanded":"false","aria-hidden":"true"}),i.oldTab.attr("aria-selected","false"),n.length&&o.length?i.oldTab.attr("tabIndex",-1):n.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),n.attr({"aria-expanded":"true","aria-hidden":"false"}),i.newTab.attr({"aria-selected":"true",tabIndex:0})},_activate:function(t){var i,a=this._findActive(t);a[0]!==this.active[0]&&(a.length||(a=this.active),i=a.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(i){var a=this.options.disabled;a!==!1&&(i===t?a=!1:(i=this._getIndex(i),a=e.isArray(a)?e.map(a,function(e){return e!==i?e:null}):e.map(this.tabs,function(e,t){return t!==i?t:null})),this._setupDisabled(a))},disable:function(i){var a=this.options.disabled;if(a!==!0){if(i===t)a=!0;else{if(i=this._getIndex(i),-1!==e.inArray(i,a))return;a=e.isArray(a)?e.merge([i],a).sort():[i]}this._setupDisabled(a)}},load:function(t,i){t=this._getIndex(t);var s=this,r=this.tabs.eq(t),n=r.find(".ui-tabs-anchor"),o=this._getPanelForTab(r),h={tab:r,panel:o};a(n[0])||(this.xhr=e.ajax(this._ajaxSettings(n,i,h)),this.xhr&&"canceled"!==this.xhr.statusText&&(r.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.success(function(e){setTimeout(function(){o.html(e),s._trigger("load",i,h)},1)}).complete(function(e,t){setTimeout(function(){"abort"===t&&s.panels.stop(!1,!0),r.removeClass("ui-tabs-loading"),o.removeAttr("aria-busy"),e===s.xhr&&delete s.xhr},1)})))},_ajaxSettings:function(t,i,a){var s=this;return{url:t.attr("href"),beforeSend:function(t,r){return s._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:r},a))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}})})(jQuery);(function(e){function t(t,i){var a=(t.attr("aria-describedby")||"").split(/\s+/);a.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",e.trim(a.join(" ")))}function i(t){var i=t.data("ui-tooltip-id"),a=(t.attr("aria-describedby")||"").split(/\s+/),s=e.inArray(i,a);-1!==s&&a.splice(s,1),t.removeData("ui-tooltip-id"),a=e.trim(a.join(" ")),a?t.attr("aria-describedby",a):t.removeAttr("aria-describedby")}var a=0;e.widget("ui.tooltip",{version:"1.10.3",options:{content:function(){var t=e(this).attr("title")||"";return e("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable()},_setOption:function(t,i){var a=this;return"disabled"===t?(this[i?"_disable":"_enable"](),this.options[t]=i,void 0):(this._super(t,i),"content"===t&&e.each(this.tooltips,function(e,t){a._updateContent(t)}),void 0)},_disable:function(){var t=this;e.each(this.tooltips,function(i,a){var s=e.Event("blur");s.target=s.currentTarget=a[0],t.close(s,!0)}),this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).attr("title","")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var i=this,a=e(t?t.target:this.element).closest(this.options.items);a.length&&!a.data("ui-tooltip-id")&&(a.attr("title")&&a.data("ui-tooltip-title",a.attr("title")),a.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&a.parents().each(function(){var t,a=e(this);a.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,i.close(t,!0)),a.attr("title")&&(a.uniqueId(),i.parents[this.id]={element:this,title:a.attr("title")},a.attr("title",""))}),this._updateContent(a,t))},_updateContent:function(e,t){var i,a=this.options.content,s=this,n=t?t.type:null;return"string"==typeof a?this._open(t,e,a):(i=a.call(e[0],function(i){e.data("ui-tooltip-open")&&s._delay(function(){t&&(t.type=n),this._open(t,e,i)})}),i&&this._open(t,e,i),void 0)},_open:function(i,a,s){function n(e){l.of=e,r.is(":hidden")||r.position(l)}var r,o,h,l=e.extend({},this.options.position);if(s){if(r=this._find(a),r.length)return r.find(".ui-tooltip-content").html(s),void 0;a.is("[title]")&&(i&&"mouseover"===i.type?a.attr("title",""):a.removeAttr("title")),r=this._tooltip(a),t(a,r.attr("id")),r.find(".ui-tooltip-content").html(s),this.options.track&&i&&/^mouse/.test(i.type)?(this._on(this.document,{mousemove:n}),n(i)):r.position(e.extend({of:a},this.options.position)),r.hide(),this._show(r,this.options.show),this.options.show&&this.options.show.delay&&(h=this.delayedShow=setInterval(function(){r.is(":visible")&&(n(l.of),clearInterval(h))},e.fx.interval)),this._trigger("open",i,{tooltip:r}),o={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var i=e.Event(t);i.currentTarget=a[0],this.close(i,!0)}},remove:function(){this._removeTooltip(r)}},i&&"mouseover"!==i.type||(o.mouseleave="close"),i&&"focusin"!==i.type||(o.focusout="close"),this._on(!0,a,o)}},close:function(t){var a=this,s=e(t?t.currentTarget:this.element),n=this._find(s);this.closing||(clearInterval(this.delayedShow),s.data("ui-tooltip-title")&&s.attr("title",s.data("ui-tooltip-title")),i(s),n.stop(!0),this._hide(n,this.options.hide,function(){a._removeTooltip(e(this))}),s.removeData("ui-tooltip-open"),this._off(s,"mouseleave focusout keyup"),s[0]!==this.element[0]&&this._off(s,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,i){e(i.element).attr("title",i.title),delete a.parents[t]}),this.closing=!0,this._trigger("close",t,{tooltip:n}),this.closing=!1)},_tooltip:function(t){var i="ui-tooltip-"+a++,s=e("<div>").attr({id:i,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return e("<div>").addClass("ui-tooltip-content").appendTo(s),s.appendTo(this.document[0].body),this.tooltips[i]=t,s},_find:function(t){var i=t.data("ui-tooltip-id");return i?e("#"+i):e()},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(i,a){var s=e.Event("blur");s.target=s.currentTarget=a[0],t.close(s,!0),e("#"+i).remove(),a.data("ui-tooltip-title")&&(a.attr("title",a.data("ui-tooltip-title")),a.removeData("ui-tooltip-title"))})}})})(jQuery);(function(e,t){var a="ui-effects-";e.effects={effect:{}},function(e,t){function a(e,t,a){var i=h[t.type]||{};return null==e?a||!t.def?null:t.def:(e=i.floor?~~e:parseFloat(e),isNaN(e)?t.def:i.mod?(e+i.mod)%i.mod:0>e?0:e>i.max?i.max:e)}function i(a){var i=u(),r=i._rgba=[];return a=a.toLowerCase(),p(d,function(e,n){var s,o=n.re.exec(a),d=o&&n.parse(o),u=n.space||"rgba";return d?(s=i[u](d),i[l[u].cache]=s[l[u].cache],r=i._rgba=s._rgba,!1):t}),r.length?("0,0,0,0"===r.join()&&e.extend(r,n.transparent),i):n[a]}function r(e,t,a){return a=(a+1)%1,1>6*a?e+6*(t-e)*a:1>2*a?t:2>3*a?e+6*(t-e)*(2/3-a):e}var n,s="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",o=/^([\-+])=\s*(\d+\.?\d*)/,d=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],u=e.Color=function(t,a,i,r){return new e.Color.fn.parse(t,a,i,r)},l={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},h={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},c=u.support={},m=e("<p>")[0],p=e.each;m.style.cssText="background-color:rgba(1,1,1,.5)",c.rgba=m.style.backgroundColor.indexOf("rgba")>-1,p(l,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),u.fn=e.extend(u.prototype,{parse:function(r,s,o,d){if(r===t)return this._rgba=[null,null,null,null],this;(r.jquery||r.nodeType)&&(r=e(r).css(s),s=t);var h=this,c=e.type(r),m=this._rgba=[];return s!==t&&(r=[r,s,o,d],c="array"),"string"===c?this.parse(i(r)||n._default):"array"===c?(p(l.rgba.props,function(e,t){m[t.idx]=a(r[t.idx],t)}),this):"object"===c?(r instanceof u?p(l,function(e,t){r[t.cache]&&(h[t.cache]=r[t.cache].slice())}):p(l,function(t,i){var n=i.cache;p(i.props,function(e,t){if(!h[n]&&i.to){if("alpha"===e||null==r[e])return;h[n]=i.to(h._rgba)}h[n][t.idx]=a(r[e],t,!0)}),h[n]&&0>e.inArray(null,h[n].slice(0,3))&&(h[n][3]=1,i.from&&(h._rgba=i.from(h[n])))}),this):t},is:function(e){var a=u(e),i=!0,r=this;return p(l,function(e,n){var s,o=a[n.cache];return o&&(s=r[n.cache]||n.to&&n.to(r._rgba)||[],p(n.props,function(e,a){return null!=o[a.idx]?i=o[a.idx]===s[a.idx]:t})),i}),i},_space:function(){var e=[],t=this;return p(l,function(a,i){t[i.cache]&&e.push(a)}),e.pop()},transition:function(e,t){var i=u(e),r=i._space(),n=l[r],s=0===this.alpha()?u("transparent"):this,o=s[n.cache]||n.to(s._rgba),d=o.slice();return i=i[n.cache],p(n.props,function(e,r){var n=r.idx,s=o[n],u=i[n],l=h[r.type]||{};null!==u&&(null===s?d[n]=u:(l.mod&&(u-s>l.mod/2?s+=l.mod:s-u>l.mod/2&&(s-=l.mod)),d[n]=a((u-s)*t+s,r)))}),this[r](d)},blend:function(t){if(1===this._rgba[3])return this;var a=this._rgba.slice(),i=a.pop(),r=u(t)._rgba;return u(e.map(a,function(e,t){return(1-i)*r[t]+i*e}))},toRgbaString:function(){var t="rgba(",a=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===a[3]&&(a.pop(),t="rgb("),t+a.join()+")"},toHslaString:function(){var t="hsla(",a=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===a[3]&&(a.pop(),t="hsl("),t+a.join()+")"},toHexString:function(t){var a=this._rgba.slice(),i=a.pop();return t&&a.push(~~(255*i)),"#"+e.map(a,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),u.fn.parse.prototype=u.fn,l.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,a,i=e[0]/255,r=e[1]/255,n=e[2]/255,s=e[3],o=Math.max(i,r,n),d=Math.min(i,r,n),u=o-d,l=o+d,h=.5*l;return t=d===o?0:i===o?60*(r-n)/u+360:r===o?60*(n-i)/u+120:60*(i-r)/u+240,a=0===u?0:.5>=h?u/l:u/(2-l),[Math.round(t)%360,a,h,null==s?1:s]},l.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,a=e[1],i=e[2],n=e[3],s=.5>=i?i*(1+a):i+a-i*a,o=2*i-s;return[Math.round(255*r(o,s,t+1/3)),Math.round(255*r(o,s,t)),Math.round(255*r(o,s,t-1/3)),n]},p(l,function(i,r){var n=r.props,s=r.cache,d=r.to,l=r.from;u.fn[i]=function(i){if(d&&!this[s]&&(this[s]=d(this._rgba)),i===t)return this[s].slice();var r,o=e.type(i),h="array"===o||"object"===o?i:arguments,c=this[s].slice();return p(n,function(e,t){var i=h["object"===o?e:t.idx];null==i&&(i=c[t.idx]),c[t.idx]=a(i,t)}),l?(r=u(l(c)),r[s]=c,r):u(c)},p(n,function(t,a){u.fn[t]||(u.fn[t]=function(r){var n,s=e.type(r),d="alpha"===t?this._hsla?"hsla":"rgba":i,u=this[d](),l=u[a.idx];return"undefined"===s?l:("function"===s&&(r=r.call(this,l),s=e.type(r)),null==r&&a.empty?this:("string"===s&&(n=o.exec(r),n&&(r=l+parseFloat(n[2])*("+"===n[1]?1:-1))),u[a.idx]=r,this[d](u)))})})}),u.hook=function(t){var a=t.split(" ");p(a,function(t,a){e.cssHooks[a]={set:function(t,r){var n,s,o="";if("transparent"!==r&&("string"!==e.type(r)||(n=i(r)))){if(r=u(n||r),!c.rgba&&1!==r._rgba[3]){for(s="backgroundColor"===a?t.parentNode:t;(""===o||"transparent"===o)&&s&&s.style;)try{o=e.css(s,"backgroundColor"),s=s.parentNode}catch(d){}r=r.blend(o&&"transparent"!==o?o:"_default")}r=r.toRgbaString()}try{t.style[a]=r}catch(d){}}},e.fx.step[a]=function(t){t.colorInit||(t.start=u(t.elem,a),t.end=u(t.end),t.colorInit=!0),e.cssHooks[a].set(t.elem,t.start.transition(t.end,t.pos))}})},u.hook(s),e.cssHooks.borderColor={expand:function(e){var t={};return p(["Top","Right","Bottom","Left"],function(a,i){t["border"+i+"Color"]=e}),t}},n=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function a(t){var a,i,r=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,n={};if(r&&r.length&&r[0]&&r[r[0]])for(i=r.length;i--;)a=r[i],"string"==typeof r[a]&&(n[e.camelCase(a)]=r[a]);else for(a in r)"string"==typeof r[a]&&(n[a]=r[a]);return n}function i(t,a){var i,r,s={};for(i in a)r=a[i],t[i]!==r&&(n[i]||(e.fx.step[i]||!isNaN(parseFloat(r)))&&(s[i]=r));return s}var r=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,a){e.fx.step[a]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(jQuery.style(e.elem,a,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(t,n,s,o){var d=e.speed(n,s,o);return this.queue(function(){var n,s=e(this),o=s.attr("class")||"",u=d.children?s.find("*").addBack():s;u=u.map(function(){var t=e(this);return{el:t,start:a(this)}}),n=function(){e.each(r,function(e,a){t[a]&&s[a+"Class"](t[a])})},n(),u=u.map(function(){return this.end=a(this.el[0]),this.diff=i(this.start,this.end),this}),s.attr("class",o),u=u.map(function(){var t=this,a=e.Deferred(),i=e.extend({},d,{queue:!1,complete:function(){a.resolve(t)}});return this.el.animate(this.diff,i),a.promise()}),e.when.apply(e,u.get()).done(function(){n(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),d.complete.call(s[0])})})},e.fn.extend({addClass:function(t){return function(a,i,r,n){return i?e.effects.animateClass.call(this,{add:a},i,r,n):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(a,i,r,n){return arguments.length>1?e.effects.animateClass.call(this,{remove:a},i,r,n):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(a){return function(i,r,n,s,o){return"boolean"==typeof r||r===t?n?e.effects.animateClass.call(this,r?{add:i}:{remove:i},n,s,o):a.apply(this,arguments):e.effects.animateClass.call(this,{toggle:i},r,n,s)}}(e.fn.toggleClass),switchClass:function(t,a,i,r,n){return e.effects.animateClass.call(this,{add:a,remove:t},i,r,n)}})}(),function(){function i(t,a,i,r){return e.isPlainObject(t)&&(a=t,t=t.effect),t={effect:t},null==a&&(a={}),e.isFunction(a)&&(r=a,i=null,a={}),("number"==typeof a||e.fx.speeds[a])&&(r=i,i=a,a={}),e.isFunction(i)&&(r=i,i=null),a&&e.extend(t,a),i=i||a.duration,t.duration=e.fx.off?0:"number"==typeof i?i:i in e.fx.speeds?e.fx.speeds[i]:e.fx.speeds._default,t.complete=r||a.complete,t}function r(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.10.3",save:function(e,t){for(var i=0;t.length>i;i++)null!==t[i]&&e.data(a+t[i],e[0].style[t[i]])},restore:function(e,i){var r,n;for(n=0;i.length>n;n++)null!==i[n]&&(r=e.data(a+i[n]),r===t&&(r=""),e.css(i[n],r))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var a,i;switch(e[0]){case"top":a=0;break;case"middle":a=.5;break;case"bottom":a=1;break;default:a=e[0]/t.height}switch(e[1]){case"left":i=0;break;case"center":i=.5;break;case"right":i=1;break;default:i=e[1]/t.width}return{x:i,y:a}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var a={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},i=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),r={width:t.width(),height:t.height()},n=document.activeElement;try{n.id}catch(s){n=document.body}return t.wrap(i),(t[0]===n||e.contains(t[0],n))&&e(n).focus(),i=t.parent(),"static"===t.css("position")?(i.css({position:"relative"}),t.css({position:"relative"})):(e.extend(a,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,i){a[i]=t.css(i),isNaN(parseInt(a[i],10))&&(a[i]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(r),i.css(a).show()},removeWrapper:function(t){var a=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===a||e.contains(t[0],a))&&e(a).focus()),t},setTransition:function(t,a,i,r){return r=r||{},e.each(a,function(e,a){var n=t.cssUnit(a);n[0]>0&&(r[a]=n[0]*i+n[1])}),r}}),e.fn.extend({effect:function(){function t(t){function i(){e.isFunction(n)&&n.call(r[0]),e.isFunction(t)&&t()}var r=e(this),n=a.complete,o=a.mode;(r.is(":hidden")?"hide"===o:"show"===o)?(r[o](),i()):s.call(r[0],a,i)}var a=i.apply(this,arguments),r=a.mode,n=a.queue,s=e.effects.effect[a.effect];return e.fx.off||!s?r?this[r](a.duration,a.complete):this.each(function(){a.complete&&a.complete.call(this)}):n===!1?this.each(t):this.queue(n||"fx",t)},show:function(e){return function(t){if(r(t))return e.apply(this,arguments);var a=i.apply(this,arguments);return a.mode="show",this.effect.call(this,a)}}(e.fn.show),hide:function(e){return function(t){if(r(t))return e.apply(this,arguments);var a=i.apply(this,arguments);return a.mode="hide",this.effect.call(this,a)}}(e.fn.hide),toggle:function(e){return function(t){if(r(t)||"boolean"==typeof t)return e.apply(this,arguments);var a=i.apply(this,arguments);return a.mode="toggle",this.effect.call(this,a)}}(e.fn.toggle),cssUnit:function(t){var a=this.css(t),i=[];return e.each(["em","px","%","pt"],function(e,t){a.indexOf(t)>0&&(i=[parseFloat(a),t])}),i}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,a){t[a]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,a=4;((t=Math.pow(2,--a))-1)/11>e;);return 1/Math.pow(4,3-a)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,a){e.easing["easeIn"+t]=a,e.easing["easeOut"+t]=function(e){return 1-a(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?a(2*e)/2:1-a(-2*e+2)/2}})}()})(jQuery);(function(e){var t=/up|down|vertical/,a=/up|left|vertical|horizontal/;e.effects.effect.blind=function(i,r){var s,n,o,d=e(this),u=["position","top","bottom","left","right","height","width"],l=e.effects.setMode(d,i.mode||"hide"),h=i.direction||"up",c=t.test(h),m=c?"height":"width",p=c?"top":"left",f=a.test(h),g={},y="show"===l;d.parent().is(".ui-effects-wrapper")?e.effects.save(d.parent(),u):e.effects.save(d,u),d.show(),s=e.effects.createWrapper(d).css({overflow:"hidden"}),n=s[m](),o=parseFloat(s.css(p))||0,g[m]=y?n:0,f||(d.css(c?"bottom":"right",0).css(c?"top":"left","auto").css({position:"absolute"}),g[p]=y?o:n+o),y&&(s.css(m,0),f||s.css(p,o+n)),s.animate(g,{duration:i.duration,easing:i.easing,queue:!1,complete:function(){"hide"===l&&d.hide(),e.effects.restore(d,u),e.effects.removeWrapper(d),r()}})}})(jQuery);(function(e){e.effects.effect.bounce=function(t,a){var i,r,s,n=e(this),o=["position","top","bottom","left","right","height","width"],d=e.effects.setMode(n,t.mode||"effect"),u="hide"===d,l="show"===d,h=t.direction||"up",c=t.distance,m=t.times||5,p=2*m+(l||u?1:0),f=t.duration/p,g=t.easing,y="up"===h||"down"===h?"top":"left",v="up"===h||"left"===h,x=n.queue(),k=x.length;for((l||u)&&o.push("opacity"),e.effects.save(n,o),n.show(),e.effects.createWrapper(n),c||(c=n["top"===y?"outerHeight":"outerWidth"]()/3),l&&(s={opacity:1},s[y]=0,n.css("opacity",0).css(y,v?2*-c:2*c).animate(s,f,g)),u&&(c/=Math.pow(2,m-1)),s={},s[y]=0,i=0;m>i;i++)r={},r[y]=(v?"-=":"+=")+c,n.animate(r,f,g).animate(s,f,g),c=u?2*c:c/2;u&&(r={opacity:0},r[y]=(v?"-=":"+=")+c,n.animate(r,f,g)),n.queue(function(){u&&n.hide(),e.effects.restore(n,o),e.effects.removeWrapper(n),a()}),k>1&&x.splice.apply(x,[1,0].concat(x.splice(k,p+1))),n.dequeue()}})(jQuery);(function(e){e.effects.effect.clip=function(t,a){var i,r,s,n=e(this),o=["position","top","bottom","left","right","height","width"],d=e.effects.setMode(n,t.mode||"hide"),u="show"===d,l=t.direction||"vertical",h="vertical"===l,c=h?"height":"width",m=h?"top":"left",p={};e.effects.save(n,o),n.show(),i=e.effects.createWrapper(n).css({overflow:"hidden"}),r="IMG"===n[0].tagName?i:n,s=r[c](),u&&(r.css(c,0),r.css(m,s/2)),p[c]=u?s:0,p[m]=u?0:s/2,r.animate(p,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){u||n.hide(),e.effects.restore(n,o),e.effects.removeWrapper(n),a()}})}})(jQuery);(function(e){e.effects.effect.drop=function(t,a){var i,r=e(this),s=["position","top","bottom","left","right","opacity","height","width"],n=e.effects.setMode(r,t.mode||"hide"),o="show"===n,d=t.direction||"left",u="up"===d||"down"===d?"top":"left",l="up"===d||"left"===d?"pos":"neg",h={opacity:o?1:0};e.effects.save(r,s),r.show(),e.effects.createWrapper(r),i=t.distance||r["top"===u?"outerHeight":"outerWidth"](!0)/2,o&&r.css("opacity",0).css(u,"pos"===l?-i:i),h[u]=(o?"pos"===l?"+=":"-=":"pos"===l?"-=":"+=")+i,r.animate(h,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===n&&r.hide(),e.effects.restore(r,s),e.effects.removeWrapper(r),a()}})}})(jQuery);(function(e){e.effects.effect.explode=function(t,a){function i(){x.push(this),x.length===h*c&&r()}function r(){m.css({visibility:"visible"}),e(x).remove(),f||m.hide(),a()}var s,n,o,d,u,l,h=t.pieces?Math.round(Math.sqrt(t.pieces)):3,c=h,m=e(this),p=e.effects.setMode(m,t.mode||"hide"),f="show"===p,g=m.show().css("visibility","hidden").offset(),y=Math.ceil(m.outerWidth()/c),v=Math.ceil(m.outerHeight()/h),x=[];for(s=0;h>s;s++)for(d=g.top+s*v,l=s-(h-1)/2,n=0;c>n;n++)o=g.left+n*y,u=n-(c-1)/2,m.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-n*y,top:-s*v}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:y,height:v,left:o+(f?u*y:0),top:d+(f?l*v:0),opacity:f?0:1}).animate({left:o+(f?0:u*y),top:d+(f?0:l*v),opacity:f?1:0},t.duration||500,t.easing,i)}})(jQuery);(function(e){e.effects.effect.fade=function(t,a){var i=e(this),r=e.effects.setMode(i,t.mode||"toggle");i.animate({opacity:r},{queue:!1,duration:t.duration,easing:t.easing,complete:a})}})(jQuery);(function(e){e.effects.effect.fold=function(t,a){var i,r,s=e(this),n=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(s,t.mode||"hide"),d="show"===o,u="hide"===o,l=t.size||15,h=/([0-9]+)%/.exec(l),c=!!t.horizFirst,m=d!==c,p=m?["width","height"]:["height","width"],f=t.duration/2,g={},y={};e.effects.save(s,n),s.show(),i=e.effects.createWrapper(s).css({overflow:"hidden"}),r=m?[i.width(),i.height()]:[i.height(),i.width()],h&&(l=parseInt(h[1],10)/100*r[u?0:1]),d&&i.css(c?{height:0,width:l}:{height:l,width:0}),g[p[0]]=d?r[0]:l,y[p[1]]=d?r[1]:0,i.animate(g,f,t.easing).animate(y,f,t.easing,function(){u&&s.hide(),e.effects.restore(s,n),e.effects.removeWrapper(s),a()})}})(jQuery);(function(e){e.effects.effect.highlight=function(t,a){var i=e(this),r=["backgroundImage","backgroundColor","opacity"],s=e.effects.setMode(i,t.mode||"show"),n={backgroundColor:i.css("backgroundColor")};"hide"===s&&(n.opacity=0),e.effects.save(i,r),i.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(n,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===s&&i.hide(),e.effects.restore(i,r),a()}})}})(jQuery);(function(e){e.effects.effect.pulsate=function(t,a){var i,r=e(this),s=e.effects.setMode(r,t.mode||"show"),n="show"===s,o="hide"===s,d=n||"hide"===s,u=2*(t.times||5)+(d?1:0),l=t.duration/u,h=0,c=r.queue(),m=c.length;for((n||!r.is(":visible"))&&(r.css("opacity",0).show(),h=1),i=1;u>i;i++)r.animate({opacity:h},l,t.easing),h=1-h;r.animate({opacity:h},l,t.easing),r.queue(function(){o&&r.hide(),a()}),m>1&&c.splice.apply(c,[1,0].concat(c.splice(m,u+1))),r.dequeue()}})(jQuery);(function(e){e.effects.effect.puff=function(t,a){var i=e(this),r=e.effects.setMode(i,t.mode||"hide"),s="hide"===r,n=parseInt(t.percent,10)||150,o=n/100,d={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:r,complete:a,percent:s?n:100,from:s?d:{height:d.height*o,width:d.width*o,outerHeight:d.outerHeight*o,outerWidth:d.outerWidth*o}}),i.effect(t)},e.effects.effect.scale=function(t,a){var i=e(this),r=e.extend(!0,{},t),s=e.effects.setMode(i,t.mode||"effect"),n=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===s?0:100),o=t.direction||"both",d=t.origin,u={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()},l={y:"horizontal"!==o?n/100:1,x:"vertical"!==o?n/100:1};r.effect="size",r.queue=!1,r.complete=a,"effect"!==s&&(r.origin=d||["middle","center"],r.restore=!0),r.from=t.from||("show"===s?{height:0,width:0,outerHeight:0,outerWidth:0}:u),r.to={height:u.height*l.y,width:u.width*l.x,outerHeight:u.outerHeight*l.y,outerWidth:u.outerWidth*l.x},r.fade&&("show"===s&&(r.from.opacity=0,r.to.opacity=1),"hide"===s&&(r.from.opacity=1,r.to.opacity=0)),i.effect(r)},e.effects.effect.size=function(t,a){var i,r,s,n=e(this),o=["position","top","bottom","left","right","width","height","overflow","opacity"],d=["position","top","bottom","left","right","overflow","opacity"],u=["width","height","overflow"],l=["fontSize"],h=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],c=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],m=e.effects.setMode(n,t.mode||"effect"),p=t.restore||"effect"!==m,f=t.scale||"both",g=t.origin||["middle","center"],y=n.css("position"),v=p?o:d,x={height:0,width:0,outerHeight:0,outerWidth:0};"show"===m&&n.show(),i={height:n.height(),width:n.width(),outerHeight:n.outerHeight(),outerWidth:n.outerWidth()},"toggle"===t.mode&&"show"===m?(n.from=t.to||x,n.to=t.from||i):(n.from=t.from||("show"===m?x:i),n.to=t.to||("hide"===m?x:i)),s={from:{y:n.from.height/i.height,x:n.from.width/i.width},to:{y:n.to.height/i.height,x:n.to.width/i.width}},("box"===f||"both"===f)&&(s.from.y!==s.to.y&&(v=v.concat(h),n.from=e.effects.setTransition(n,h,s.from.y,n.from),n.to=e.effects.setTransition(n,h,s.to.y,n.to)),s.from.x!==s.to.x&&(v=v.concat(c),n.from=e.effects.setTransition(n,c,s.from.x,n.from),n.to=e.effects.setTransition(n,c,s.to.x,n.to))),("content"===f||"both"===f)&&s.from.y!==s.to.y&&(v=v.concat(l).concat(u),n.from=e.effects.setTransition(n,l,s.from.y,n.from),n.to=e.effects.setTransition(n,l,s.to.y,n.to)),e.effects.save(n,v),n.show(),e.effects.createWrapper(n),n.css("overflow","hidden").css(n.from),g&&(r=e.effects.getBaseline(g,i),n.from.top=(i.outerHeight-n.outerHeight())*r.y,n.from.left=(i.outerWidth-n.outerWidth())*r.x,n.to.top=(i.outerHeight-n.to.outerHeight)*r.y,n.to.left=(i.outerWidth-n.to.outerWidth)*r.x),n.css(n.from),("content"===f||"both"===f)&&(h=h.concat(["marginTop","marginBottom"]).concat(l),c=c.concat(["marginLeft","marginRight"]),u=o.concat(h).concat(c),n.find("*[width]").each(function(){var a=e(this),i={height:a.height(),width:a.width(),outerHeight:a.outerHeight(),outerWidth:a.outerWidth()};p&&e.effects.save(a,u),a.from={height:i.height*s.from.y,width:i.width*s.from.x,outerHeight:i.outerHeight*s.from.y,outerWidth:i.outerWidth*s.from.x},a.to={height:i.height*s.to.y,width:i.width*s.to.x,outerHeight:i.height*s.to.y,outerWidth:i.width*s.to.x},s.from.y!==s.to.y&&(a.from=e.effects.setTransition(a,h,s.from.y,a.from),a.to=e.effects.setTransition(a,h,s.to.y,a.to)),s.from.x!==s.to.x&&(a.from=e.effects.setTransition(a,c,s.from.x,a.from),a.to=e.effects.setTransition(a,c,s.to.x,a.to)),a.css(a.from),a.animate(a.to,t.duration,t.easing,function(){p&&e.effects.restore(a,u)})})),n.animate(n.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===n.to.opacity&&n.css("opacity",n.from.opacity),"hide"===m&&n.hide(),e.effects.restore(n,v),p||("static"===y?n.css({position:"relative",top:n.to.top,left:n.to.left}):e.each(["top","left"],function(e,t){n.css(t,function(t,a){var i=parseInt(a,10),r=e?n.to.left:n.to.top;return"auto"===a?r+"px":i+r+"px"})})),e.effects.removeWrapper(n),a()}})}})(jQuery);(function(e){e.effects.effect.shake=function(t,a){var i,r=e(this),s=["position","top","bottom","left","right","height","width"],n=e.effects.setMode(r,t.mode||"effect"),o=t.direction||"left",d=t.distance||20,u=t.times||3,l=2*u+1,h=Math.round(t.duration/l),c="up"===o||"down"===o?"top":"left",m="up"===o||"left"===o,p={},f={},g={},y=r.queue(),v=y.length;for(e.effects.save(r,s),r.show(),e.effects.createWrapper(r),p[c]=(m?"-=":"+=")+d,f[c]=(m?"+=":"-=")+2*d,g[c]=(m?"-=":"+=")+2*d,r.animate(p,h,t.easing),i=1;u>i;i++)r.animate(f,h,t.easing).animate(g,h,t.easing);r.animate(f,h,t.easing).animate(p,h/2,t.easing).queue(function(){"hide"===n&&r.hide(),e.effects.restore(r,s),e.effects.removeWrapper(r),a()}),v>1&&y.splice.apply(y,[1,0].concat(y.splice(v,l+1))),r.dequeue()}})(jQuery);(function(e){e.effects.effect.slide=function(t,a){var i,r=e(this),s=["position","top","bottom","left","right","width","height"],n=e.effects.setMode(r,t.mode||"show"),o="show"===n,d=t.direction||"left",u="up"===d||"down"===d?"top":"left",l="up"===d||"left"===d,h={};e.effects.save(r,s),r.show(),i=t.distance||r["top"===u?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(r).css({overflow:"hidden"}),o&&r.css(u,l?isNaN(i)?"-"+i:-i:i),h[u]=(o?l?"+=":"-=":l?"-=":"+=")+i,r.animate(h,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===n&&r.hide(),e.effects.restore(r,s),e.effects.removeWrapper(r),a()}})}})(jQuery);(function(e){e.effects.effect.transfer=function(t,a){var i=e(this),r=e(t.to),s="fixed"===r.css("position"),n=e("body"),o=s?n.scrollTop():0,d=s?n.scrollLeft():0,u=r.offset(),l={top:u.top-o,left:u.left-d,height:r.innerHeight(),width:r.innerWidth()},h=i.offset(),c=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:h.top-o,left:h.left-d,height:i.innerHeight(),width:i.innerWidth(),position:s?"fixed":"absolute"}).animate(l,t.duration,t.easing,function(){c.remove(),a()})}})(jQuery);
\ No newline at end of file
diff --git a/static/lib/jquery.min.js b/static/lib/jquery.min.js
deleted file mode 100644
index da41706..0000000
--- a/static/lib/jquery.min.js
+++ /dev/null
@@ -1,6 +0,0 @@
-/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
-//@ sourceMappingURL=jquery-1.10.2.min.map
-*/
-(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+yt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[r]]=t}function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return pt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},o.pseudos.nth=o.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=ft(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=dt(n);function gt(){}gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=xt(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[vt(bt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}return bt(f)}function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt(e)),n=t.length;while(n--)o=Tt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ut(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!l||i&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t
-}({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=x(this),a=e.match(T)||[];while(t=a[r++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Ct=/^(?:checkbox|radio)$/i,Nt=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:x.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle);
-u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e))return this.each(function(t){x(this).wrapAll(e.call(this,t))});if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=x.css(e,n[s],!1,o);return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){nn(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:u[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{u[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),Pt.detach()),Gt[e]=n),n}function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(x.css(e,"display"))?x.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=x.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===x.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,n){return n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,n){x.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?x(e).position()[n]+"px":r):t}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!x.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||x.css(e,"display"))},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(x.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Ct.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),x.param=function(e,n){var r,i=[],o=function(e,t){t=x.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,yn,vn=x.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Cn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Nn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=x.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=o.href}catch(Ln){yn=a.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(l){var u;return o[l]=!0,x.each(e[l]||[],function(e,l){var c=l(n,r,i);return"string"!=typeof c||a||o[c]?a?!(u=c):t:(n.dataTypes.unshift(c),s(c),!1)}),u}return s(n.dataTypes[0])||!o["*"]&&s("*")}function _n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,l=e.indexOf(" ");return l>=0&&(i=e.slice(l,e.length),e=e.slice(0,l)),x.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&x.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?x("<div>").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);
diff --git a/static/partials/editor.html b/static/partials/editor.html
deleted file mode 100644
index 15b6e20..0000000
--- a/static/partials/editor.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<div id="editor-container" onpageup="prevPage()" onpagedown="nextPage()">
-    <div class="relative-content" ng->
-        <div vertical-slide left="#left-side" right="#right-side"></div>
-        <div id="left-side">
-            <div class="relative-content" autofocus="toc.lessons[lessonId].Pages[curPage-1].Files.length==0">
-                <div class="slide-content" ng-bind-html-unsafe="toc.lessons[lessonId].Pages[curPage-1].Content"></div>
-
-                <div class="bar module-bar">
-                    <a href="#" class="prev-page" ng-click="prevPageClick($event)">&lt;</a>
-                    <span>{{curPage}}/{{toc.lessons[lessonId].Pages.length}}</span>
-                    <a href="#" class="next-page" ng-click="nextPageClick($event)">&gt;</a>
-                </div>
-            </div>
-        </div>
-
-        <div id="right-side" class="relative-content">
-            <div id="explorer" ng-class="{hidden: toc.lessons[lessonId].Pages[curPage-1].Files.length==0}">
-                <a class="menu-button" ng-repeat="f in toc.lessons[lessonId].Pages[curPage-1].Files" ng-click="openFile($index)" ng-class="{active: $index==curFile}">{{f.Name}}</a>
-                <a syntax-checkbox ng-class="{active: editor.syntax}" class="menu-button syntax-checkbox">Syntax</a>
-                <a imports-checkbox ng-class="{active: editor.imports}" class="menu-button imports-checkbox">Imports</a>
-            </div>
-
-            <div class="relative-content" ng-class="{hidden: toc.lessons[lessonId].Pages[curPage-1].Files.length==0}">
-
-                <div id="top-part">
-                    <div class="relative-content">
-                        <div id="file-editor">
-                            <textarea ui-codemirror ng-model="toc.lessons[lessonId].Pages[curPage-1].Files[curFile].Content"></textarea>
-                        </div>
-                    </div>
-                </div>
-
-                <div horizontal-slide top="#top-part" bottom="#bottom-part"></div>
-
-                <div id="bottom-part">
-                    <div class="relative-content">
-                        <!--div id="file-menu" ng-controller="OutputCtrl"-->
-                        <div id="file-menu">
-                            <a ng-show="job == null" class="menu-button" id="run" ng-click="run()">Run</a>
-                            <a ng-show="job != null" class="menu-button" id="kill" ng-click="kill()">Kill</a>
-                            <a class="menu-button" id="format" ng-click="format()">Format</a>
-                            <a class="menu-button" id="reset" ng-click="reset()">Reset</a>
-                        </div>
-
-                        <div class="output" ng-repeat="f in toc.lessons[lessonId].Pages[curPage-1].Files" ng-class="{active: $index==curFile}" ng-bind-html-unsafe="f.Output">
-                        </div>
-                    </div>
-                </div>
-            </div>
-        </div>
-
-    </div>
-</div>
diff --git a/static/partials/feedback-button.html b/static/partials/feedback-button.html
deleted file mode 100644
index b32c5a5..0000000
--- a/static/partials/feedback-button.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<span class="nav" title="{{feedbackMessage}}">
-	<svg id="feedback-button" viewBox="0 0 24 24" height="100%" width="100%" preserveAspectRatio="xMidYMid meet" fit="" style="pointer-events: none; display: block;"><g><path d="M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z"></path></g></svg>
-</span>
\ No newline at end of file
diff --git a/static/partials/lesson.html b/static/partials/lesson.html
deleted file mode 100644
index 49399a0..0000000
--- a/static/partials/lesson.html
+++ /dev/null
@@ -1,4 +0,0 @@
-<div class="lesson">
-    <a href="/{{name}}" class="lesson-title">{{title}}</a>
-    <p>{{description}}</p>
-</div>
diff --git a/static/partials/list.html b/static/partials/list.html
deleted file mode 100644
index 7cf93cf..0000000
--- a/static/partials/list.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<div class="wrapper">
-    <div class="container">
-
-        <div class="page-header">
-            <h1>Welcome to a tour of Go</h1>
-        </div>
-
-        <div class="module" ng-repeat="m in toc.modules">
-            <p id="{{m.id}}" class="module-title">{{m.title}}</p>
-            <div ng-bind-html-unsafe="m.description"></div>
-
-            <div class="lesson" ng-repeat="l in m.lessons">
-                <a href="/{{l}}" class="lesson-title">{{m.lesson[l].Title}}</a>
-                <p>{{m.lesson[l].Description}}</p>
-            </div>
-        </div>
-
-    </div>
-</div>
diff --git a/static/partials/toc-button.html b/static/partials/toc-button.html
deleted file mode 100644
index 3e70742..0000000
--- a/static/partials/toc-button.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<span class="nav" title="{{tocMessage}}">
-	<svg viewBox="0 0 24 24" height="100%" width="100%" preserveAspectRatio="xMidYMid meet" fit="" style="pointer-events: none; display: block;"><g><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"></path></g></svg>
-</span>
\ No newline at end of file
diff --git a/static/partials/toc.html b/static/partials/toc.html
deleted file mode 100644
index 293ab82..0000000
--- a/static/partials/toc.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<div class="toc">
-    <ul>
-        <li ng-repeat="m in toc.modules" class="toc-module" id="toc-m-{{m.id}}">
-            <span>{{m.title}}</span>
-            <ul>
-                <li ng-repeat="l in m.lessons" class="toc-lesson" id="toc-l-{{l}}" ng-class="{active: l==params.lessonId}">
-                    <span ng-click="toggleLesson(l)">{{m.lesson[l].Title}}</span>
-                    <ul>
-                        <li ng-repeat="p in m.lesson[l].Pages" class="toc-page" ng-class="{active: l==params.lessonId && $index+1==params.pageNumber}">
-                            <a href="/{{l}}/{{$index+1}}" ng-click="hideTOC(true)">{{p.Title}}</a>
-                        </li>
-                    </ul>
-                </li>
-            </ul>
-        </li>
-    </ul>
-    <div class="click-catcher" ng-click="hideTOC(false)"></div>
-</div>
diff --git a/template/action.tmpl b/template/action.tmpl
deleted file mode 100644
index 29bb047..0000000
--- a/template/action.tmpl
+++ /dev/null
@@ -1,50 +0,0 @@
-{{/*{
-This is the action template.
-It determines how the formatting actions are rendered.
-*/}}
-
-{{define "section"}}
-  <h2>{{.Title}}</h2>
-  {{range .Elem}}{{elem $.Template .}}{{end}}
-{{end}}
-
-{{define "list"}}
-  <ul>
-  {{range .Bullet}}
-    <li>{{style .}}</li>
-  {{end}}
-  </ul>
-{{end}}
-
-{{define "text"}}
-  {{if .Pre}}
-  <pre>{{range .Lines}}{{.}}{{end}}</pre>
-  {{else}}
-  <p>
-    {{range $i, $l := .Lines}}{{if $i}}{{template "newline"}}
-    {{end}}{{style $l}}{{end}}
-  </p>
-  {{end}}
-{{end}}
-
-{{define "code"}}
-	{{if .Play}}
-		{{/* playable code is not displayed in the slides */}}
-	{{else}}
-		<div>{{.Text}}</div>
-	{{end}}
-{{end}}
-
-{{define "image"}}
-  <img src="{{.URL}}"{{with .Height}} height="{{.}}"{{end}}{{with .Width}} width="{{.}}"{{end}}>
-{{end}}
-
-{{define "link"}}
-  <p class="link"><a href="{{.URL}}" target="_blank">{{style .Label}}</a></p>
-{{end}}
-
-{{define "html"}}{{.HTML}}{{end}}
-
-{{define "newline"}}
-{{/* No automatic line break. Paragraphs are free-form. */}}
-{{end}}
diff --git a/template/index.tmpl b/template/index.tmpl
deleted file mode 100755
index 837dc77..0000000
--- a/template/index.tmpl
+++ /dev/null
@@ -1,55 +0,0 @@
-<!doctype html>
-<html lang="en" ng-app="tour">
-
-<head>
-{{.AnalyticsHTML}}    <meta charset="utf-8">
-    <title>A Tour of Go</title>
-    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
-    <meta name="apple-mobile-web-app-capable" content="yes">
-    <meta name="mobile-web-app-capable" content="yes">
-    <link rel="shortcut icon" sizes="196x196" href="/favicon.ico">
-    <link rel="stylesheet" href="/static/css/app.css" />
-    <link rel="stylesheet" href="/static/lib/codemirror/lib/codemirror.css">
-    <link href='//fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css'>
-</head>
-
-<body>
-    <div class="bar top-bar">
-        <a class="left logo" href="/list">A Tour of Go</a>
-        <div table-of-contents-button=".toc"></div>
-        <div feedback-button></div>
-    </div>
-
-    <div table-of-contents></div>
-
-    <div ng-view ng-cloak class="ng-cloak"></div>
-
-    <script src="/script.js"></script>
-    <script>
-    window.transport = {{.Transport}}();
-    window.socketAddr = "{{.SocketAddr}}";
-
-    function highlight(selector) {
-        var speed = 50;
-        var obj = $(selector).stop(true, true)
-        for (var i = 0; i < 5; i++) {
-            obj.addClass("highlight", speed)
-            obj.delay(speed)
-            obj.removeClass("highlight", speed)
-        }
-    }
-
-    function highlightAndClick(selector) {
-        highlight(selector);
-        setTimeout(function() {
-            $(selector)[0].click()
-        }, 750);
-    }
-
-    function click(selector) {
-        $(selector)[0].click();
-    }
-    </script>
-</body>
-
-</html>
diff --git a/tools/map.sh b/tools/map.sh
deleted file mode 100755
index 49e3e51..0000000
--- a/tools/map.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh
-
-# Copyright 2011 The Go Authors.  All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-# This code parses mapping.old and finds a correspondance from the old
-# urls (e.g. #42) to the corresponding path (e.g. /concurrency/3).
-
-function findURL {
-	title="$1"
-	file=$(grep -l "* $title\$" *.article)
-	if [[ -z $file ]]
-	then
-		echo "undefined"
-		return 1
-	fi
-	titles=$(grep "^* " $file | awk '{print NR, $0}')
-	page=$(echo "$titles" | grep "* $title\$" | awk '{print $1}')
-	if [[ $(echo "$page" | wc -l) -gt "1" ]]
-	then
-		echo "multiple matches found for $title; find 'CHOOSE BETWEEN' in the output" 1>&2
-		page="CHOOSE BETWEEN $page"
-	fi
-
-	page=$(echo $page)
-	lesson=$(echo "$file" | rev | cut -c 9- | rev)
-	echo "'/$lesson/$page'"
-	return 0
-}
-
-mapping=`cat mapping.old`
-
-pushd ../content
-echo "$mapping" | while read page; do
-	num=$(echo "$page" | awk '{print $1}')
-	title=$(echo "$page" | sed "s/[0-9]* //")
-	url=$(findURL "$title")
-	echo "    '#$num': $url, // $title"
-done
-popd > /dev/null
diff --git a/tools/mapping.old b/tools/mapping.old
deleted file mode 100644
index aeb7461..0000000
--- a/tools/mapping.old
+++ /dev/null
@@ -1,73 +0,0 @@
-1 Hello, 世界
-2 Go local
-3 Packages
-4 Imports
-5 Exported names
-6 Functions
-7 Functions continued
-8 Multiple results
-9 Named results
-10 Variables
-11 Variables with initializers
-12 Short variable declarations
-13 Basic types
-14 Type conversions
-15 Constants
-16 Numeric Constants
-17 For
-18 For continued
-19 For is Go's "while"
-20 Forever
-21 If
-22 If with a short statement
-23 If and else
-24 Exercise: Loops and Functions
-25 Structs
-26 Struct Fields
-27 Pointers
-28 Struct Literals
-29 The new function
-30 Arrays
-31 Slices
-32 Slicing slices
-33 Making slices
-34 Nil slices
-35 Range
-36 Range continued
-37 Exercise: Slices
-38 Maps
-39 Map literals
-40 Map literals continued
-41 Mutating Maps
-42 Exercise: Maps
-43 Function values
-44 Function closures
-45 Exercise: Fibonacci closure
-46 Switch
-47 Switch evaluation order
-48 Switch with no condition
-49 Advanced Exercise: Complex cube roots
-50 Methods and Interfaces
-51 Methods
-52 Methods continued
-53 Methods with pointer receivers
-54 Interfaces
-55 Interfaces are satisfied implicitly
-56 Errors
-57 Exercise: Errors
-58 Web servers
-59 Exercise: HTTP Handlers
-60 Images
-61 Exercise: Images
-62 Exercise: Rot13 Reader
-63 Concurrency
-64 Goroutines
-65 Channels
-66 Buffered Channels
-67 Range and Close
-68 Select
-69 Default Selection
-70 Exercise: Equivalent Binary Trees
-71 Exercise: Equivalent Binary Trees
-72 Exercise: Web Crawler
-73 Where to Go from here...
diff --git a/tour.go b/tour.go
deleted file mode 100644
index b27fc50..0000000
--- a/tour.go
+++ /dev/null
@@ -1,272 +0,0 @@
-// Copyright 2013 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package main // import "golang.org/x/tour"
-
-import (
-	"bytes"
-	"crypto/sha1"
-	"encoding/base64"
-	"encoding/json"
-	"fmt"
-	"html/template"
-	"io"
-	"io/ioutil"
-	"net/http"
-	"os"
-	"path/filepath"
-	"strings"
-	"time"
-
-	"golang.org/x/tools/godoc/static"
-	"golang.org/x/tools/present"
-)
-
-var (
-	uiContent      []byte
-	lessons        = make(map[string][]byte)
-	lessonNotFound = fmt.Errorf("lesson not found")
-)
-
-// initTour loads tour.article and the relevant HTML templates from the given
-// tour root, and renders the template to the tourContent global variable.
-func initTour(root, transport string) error {
-	// Make sure playground is enabled before rendering.
-	present.PlayEnabled = true
-
-	// Set up templates.
-	action := filepath.Join(root, "template", "action.tmpl")
-	tmpl, err := present.Template().ParseFiles(action)
-	if err != nil {
-		return fmt.Errorf("parse templates: %v", err)
-	}
-
-	// Init lessons.
-	contentPath := filepath.Join(root, "content")
-	if err := initLessons(tmpl, contentPath); err != nil {
-		return fmt.Errorf("init lessons: %v", err)
-	}
-
-	// Init UI
-	index := filepath.Join(root, "template", "index.tmpl")
-	ui, err := template.ParseFiles(index)
-	if err != nil {
-		return fmt.Errorf("parse index.tmpl: %v", err)
-	}
-	buf := new(bytes.Buffer)
-
-	data := struct {
-		AnalyticsHTML template.HTML
-		SocketAddr    string
-		Transport     template.JS
-	}{analyticsHTML, socketAddr(), template.JS(transport)}
-
-	if err := ui.Execute(buf, data); err != nil {
-		return fmt.Errorf("render UI: %v", err)
-	}
-	uiContent = buf.Bytes()
-
-	return initScript(root)
-}
-
-// initLessonss finds all the lessons in the passed directory, renders them,
-// using the given template and saves the content in the lessons map.
-func initLessons(tmpl *template.Template, content string) error {
-	dir, err := os.Open(content)
-	if err != nil {
-		return err
-	}
-	files, err := dir.Readdirnames(0)
-	if err != nil {
-		return err
-	}
-	for _, f := range files {
-		if filepath.Ext(f) != ".article" {
-			continue
-		}
-		content, err := parseLesson(tmpl, filepath.Join(content, f))
-		if err != nil {
-			return fmt.Errorf("parsing %v: %v", f, err)
-		}
-		name := strings.TrimSuffix(f, ".article")
-		lessons[name] = content
-	}
-	return nil
-}
-
-// File defines the JSON form of a code file in a page.
-type File struct {
-	Name    string
-	Content string
-	Hash    string
-}
-
-// Page defines the JSON form of a tour lesson page.
-type Page struct {
-	Title   string
-	Content string
-	Files   []File
-}
-
-// Lesson defines the JSON form of a tour lesson.
-type Lesson struct {
-	Title       string
-	Description string
-	Pages       []Page
-}
-
-// parseLesson parses and returns a lesson content given its name and
-// the template to render it.
-func parseLesson(tmpl *template.Template, path string) ([]byte, error) {
-	f, err := os.Open(path)
-	if err != nil {
-		return nil, err
-	}
-	defer f.Close()
-	doc, err := present.Parse(prepContent(f), path, 0)
-	if err != nil {
-		return nil, err
-	}
-
-	lesson := Lesson{
-		doc.Title,
-		doc.Subtitle,
-		make([]Page, len(doc.Sections)),
-	}
-
-	for i, sec := range doc.Sections {
-		p := &lesson.Pages[i]
-		w := new(bytes.Buffer)
-		if err := sec.Render(w, tmpl); err != nil {
-			return nil, fmt.Errorf("render section: %v", err)
-		}
-		p.Title = sec.Title
-		p.Content = w.String()
-		codes := findPlayCode(sec)
-		p.Files = make([]File, len(codes))
-		for i, c := range codes {
-			f := &p.Files[i]
-			f.Name = c.FileName
-			f.Content = string(c.Raw)
-			hash := sha1.Sum(c.Raw)
-			f.Hash = base64.StdEncoding.EncodeToString(hash[:])
-		}
-	}
-
-	w := new(bytes.Buffer)
-	if err := json.NewEncoder(w).Encode(lesson); err != nil {
-		return nil, fmt.Errorf("encode lesson: %v", err)
-	}
-	return w.Bytes(), nil
-}
-
-// findPlayCode returns a slide with all the Code elements in the given
-// Elem with Play set to true.
-func findPlayCode(e present.Elem) []*present.Code {
-	var r []*present.Code
-	switch v := e.(type) {
-	case present.Code:
-		if v.Play {
-			r = append(r, &v)
-		}
-	case present.Section:
-		for _, s := range v.Elem {
-			r = append(r, findPlayCode(s)...)
-		}
-	}
-	return r
-}
-
-// writeLesson writes the tour content to the provided Writer.
-func writeLesson(name string, w io.Writer) error {
-	if uiContent == nil {
-		panic("writeLesson called before successful initTour")
-	}
-	if len(name) == 0 {
-		return writeAllLessons(w)
-	}
-	l, ok := lessons[name]
-	if !ok {
-		return lessonNotFound
-	}
-	_, err := w.Write(l)
-	return err
-}
-
-func writeAllLessons(w io.Writer) error {
-	if _, err := fmt.Fprint(w, "{"); err != nil {
-		return err
-	}
-	nLessons := len(lessons)
-	for k, v := range lessons {
-		if _, err := fmt.Fprintf(w, "%q:%s", k, v); err != nil {
-			return err
-		}
-		nLessons--
-		if nLessons != 0 {
-			if _, err := fmt.Fprint(w, ","); err != nil {
-				return err
-			}
-		}
-	}
-	_, err := fmt.Fprint(w, "}")
-	return err
-}
-
-// renderUI writes the tour UI to the provided Writer.
-func renderUI(w io.Writer) error {
-	if uiContent == nil {
-		panic("renderUI called before successful initTour")
-	}
-	_, err := w.Write(uiContent)
-	return err
-}
-
-// initScript concatenates all the javascript files needed to render
-// the tour UI and serves the result on /script.js.
-func initScript(root string) error {
-	modTime := time.Now()
-	b := new(bytes.Buffer)
-
-	content, ok := static.Files["playground.js"]
-	if !ok {
-		return fmt.Errorf("playground.js not found in static files")
-	}
-	b.WriteString(content)
-
-	// Keep this list in dependency order
-	files := []string{
-		"static/lib/jquery.min.js",
-		"static/lib/jquery-ui.min.js",
-		"static/lib/angular.min.js",
-		"static/lib/codemirror/lib/codemirror.js",
-		"static/lib/codemirror/mode/go/go.js",
-		"static/lib/angular-ui.min.js",
-		"static/js/app.js",
-		"static/js/controllers.js",
-		"static/js/directives.js",
-		"static/js/services.js",
-		"static/js/values.js",
-	}
-
-	for _, file := range files {
-		f, err := ioutil.ReadFile(filepath.Join(root, file))
-		if err != nil {
-			return fmt.Errorf("couldn't open %v: %v", file, err)
-		}
-		_, err = b.Write(f)
-		if err != nil {
-			return fmt.Errorf("error concatenating %v: %v", file, err)
-		}
-	}
-
-	http.HandleFunc("/script.js", func(w http.ResponseWriter, r *http.Request) {
-		w.Header().Set("Content-type", "application/javascript")
-		// Set expiration time in one week.
-		w.Header().Set("Cache-control", "max-age=604800")
-		http.ServeContent(w, r, "", modTime, bytes.NewReader(b.Bytes()))
-	})
-
-	return nil
-}