diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..cdce084 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +static/js/lib/* linguist-vendored \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..0e26e3c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,46 @@ +--- +name: 报告缺陷 +about: 报告缺陷以帮助我们改进 +--- + +**请先看[《提问的智慧》](https://hacpai.com/article/1536377163156)**,并尝试到[讨论区](https://hacpai.com/tag/wide)搜寻资料解决问题。 + +---- + +### 描述问题 + +请尽量清晰精准地描述你碰到的问题。 + +### 重现步骤 + +请描述如何重现这个问题: + +1. Go to '...' +2. Click on '...' +3. Scroll down to '...' +4. See error + +### 期待的结果 + +请尽量清晰精准地描述你所期待的结果。 + +### 截屏或录像 + +如果可能,请尽量附加截图或录像来描述你遇到的问题。 + +### 桌面端环境 + +- OS: [e.g. windows, mac, linux] +- Browser [e.g. chrome, safari] +- Version [e.g. 22] + +### 移动端环境 + +- Device: [e.g. iPhone8] +- OS: [e.g. iOS12] +- Browser [e.g. stock browser, safari] +- Version [e.g. 22] + +### 其他信息 + +请提供其他附加信息帮助我们诊断问题。 diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..209c2ef --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: 请求新功能 +about: 提出你期待的功能特性 +--- + +### 你在什么场景下需要该功能? + +请尽量清晰精准地描述你碰到的问题。 + +### 描述可能的解决方案 + +请尽量清晰精准地描述你期待我们要做的,描述你想到的实现方案。 + +### 描述你认为的候选方案 + +请尽量清晰精准地描述你能接受的候选解决方案。 + +### 其他信息 + +请提供关于该功能建议的其他附加信息。 diff --git a/.gitignore b/.gitignore index 3e433b3..7681c88 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,6 @@ /wide.exe /wide -/static/user/admin/style.css - /header /header.exe diff --git a/.header.json b/.header.json index 18247ce..6049e23 100644 --- a/.header.json +++ b/.header.json @@ -10,11 +10,12 @@ ], "Excludes": [ "static/js/lib/*", - "static/user/*" + "static/user/*", + "vendor/**" ], "UseDefaultExcludes": true, "Properties": { - "Year": "2014-2017", + "Year": "2014-2019", "Owner": "b3log.org & hacpai.com" } } \ No newline at end of file diff --git a/.header.txt b/.header.txt index a724058..4b7b389 100644 --- a/.header.txt +++ b/.header.txt @@ -4,7 +4,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/.travis.yml b/.travis.yml index 8c21d14..1c406a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: go go: - - 1.4 + - 1.12 before_install: - go get github.com/axw/gocov/gocov - go get github.com/mattn/goveralls diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 1094903..0000000 --- a/Dockerfile +++ /dev/null @@ -1,32 +0,0 @@ -FROM golang:1.7.4 -MAINTAINER Liang Ding - -RUN apt-get update && apt-get install bzip2 zip unzip - -ENV GOROOT /usr/local/go -RUN cp -r /usr/local/go /usr/local/gobt -ENV GOROOT_BOOTSTRAP=/usr/local/gobt - -RUN cd /usr/local/go/src && export GOOS=darwin && export GOARCH=amd64 && ./make.bash --no-clean -RUN cd /usr/local/go/src && export GOOS=linux && export GOARCH=arm && ./make.bash --no-clean -RUN cd /usr/local/go/src && export GOOS=windows && export GOARCH=amd64 && ./make.bash --no-clean - -ADD . /wide/gogogo/src/github.com/b3log/wide - -RUN unzip /wide/gogogo/src/github.com/b3log/wide/deps/golang.org.zip -d /wide/gogogo/src/ -RUN unzip /wide/gogogo/src/github.com/b3log/wide/deps/github.com.zip -d /wide/gogogo/src/ - -RUN useradd wide && useradd runner - -ENV GOPATH /wide/gogogo - -RUN go build github.com/go-fsnotify/fsnotify -RUN go build github.com/gorilla/sessions -RUN go build github.com/gorilla/websocket - -RUN go install github.com/visualfc/gotools github.com/nsf/gocode github.com/bradfitz/goimports - -WORKDIR /wide/gogogo/src/github.com/b3log/wide -RUN go build -v - -EXPOSE 7070 diff --git a/LICENSE b/LICENSE index 261eeb9..b447376 100644 --- a/LICENSE +++ b/LICENSE @@ -192,7 +192,7 @@ you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/README.md b/README.md index 3a3d8f8..da7b0c4 100644 --- a/README.md +++ b/README.md @@ -1,173 +1,129 @@ -# [Wide](https://github.com/b3log/wide) [![Build Status](https://img.shields.io/travis/b3log/wide.svg?style=flat)](https://travis-ci.org/b3log/wide) [![Coverage Status](https://img.shields.io/coveralls/b3log/wide.svg?style=flat)](https://coveralls.io/r/b3log/wide) [![Apache License](http://img.shields.io/badge/license-apache2-orange.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![API Documentation](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](http://godoc.org/github.com/b3log/wide) [![Download](http://img.shields.io/badge/download-~4.3K-red.svg?style=flat)](http://pan.baidu.com/s/1dD3XwOT) +# [Wide](https://github.com/b3log/wide) [![Build Status](https://img.shields.io/travis/b3log/wide.svg?style=flat)](https://travis-ci.org/b3log/wide) [![Go Report Card](https://goreportcard.com/badge/github.com/b3log/wide)](https://goreportcard.com/report/github.com/b3log/wide) [![Coverage Status](https://img.shields.io/coveralls/b3log/wide.svg?style=flat)](https://coveralls.io/r/b3log/wide) [![Apache License](https://img.shields.io/badge/license-apache2-orange.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0) [![API Documentation](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/b3log/wide) [![Download](https://img.shields.io/badge/download-~4.3K-red.svg?style=flat)](https://pan.baidu.com/s/1dD3XwOT) -_Have a [try](http://wide.b3log.org/signup) first, then [download](http://pan.baidu.com/s/1dD3XwOT) and setup it on your local area network, enjoy yourself!_ +先试试我们搭建好的[在线服务](https://wide.b3log.org/signup),你可以在这里[下载](https://pan.baidu.com/s/1dD3XwOT)并在本地环境运行,然后邀请小伙伴们来玩吧! -先试试我们搭建好的[在线服务](http://wide.b3log.org/signup),你可以在这里[下载](http://pan.baidu.com/s/1dD3XwOT)并在本地环境运行,然后邀请小伙伴们来玩吧! +## 简介 -> * 关于 Wide 的产品定位,请看[这里](http://hacpai.com/article/1438407961481),并欢迎参与讨论~ -> * 加入[**黑客派**](http://hacpai.com/register),与其他程序员、设计师共同成长! +Wide 是一个基于 **W**eb 的 Go 语言 **IDE**。 -## Introduction +![](https://cloud.githubusercontent.com/assets/873584/4606377/d0ca3c2a-521b-11e4-912c-d955ab05850b.png) -A Web-based IDE for Teams using Go programming language/Golang. +## 动机 -![Hello, 世界](https://cloud.githubusercontent.com/assets/873584/4606377/d0ca3c2a-521b-11e4-912c-d955ab05850b.png) +目前较为流行的 Go IDE 都有一些缺陷或遗憾: + * 文本编辑器类(vim/emacs/sublime/Atom 等):对于新手门槛太高,搭建复杂 + * 插件类(goclipse、IDEA 等):需要原 IDE 支持,不够专业 + * LiteIDE 界面不够 modern、goland 收费 + * **缺少网络分享、嵌入网站可运行功能** -## Authors +另外,Go IDE 很少,用 Go 本身开发的 IDE 更是没有,这是一个很好的尝试。关于产品定位的讨论请看[这里](https://hacpai.com/article/1438407961481)。 -[Daniel](https://github.com/88250) and [Vanessa](https://github.com/Vanessa219) are the main authors of Wide, [here](https://github.com/b3log/wide/graphs/contributors) are all contributors. +## 特性 -Wide 的主要作者是 [Daniel](https://github.com/88250) 与 [Vanessa](https://github.com/Vanessa219),所有贡献者可以在[这里](https://github.com/b3log/wide/graphs/contributors)看到。 +基于 Web 的 IDE: -## Motivation - -* **Team** IDE: - * _Safe and reliable_: the project source code stored on the server in real time, the developer's machine crashes without losing any source code - * _Unified environment_: server unified development environment configuration, the developer machine without any additional configuration - * _Out of the box_: 5 minutes to setup a server then open browser to develop, debug - * _Version Control_: each developer has its own source code repository, easy sync with the trunk -* **Web-based** IDE: - * Developer needs a browser only - * Cross-platform, even on mobile devices - * Easy to extend - * Easy to integrate with other systems - * For the geeks -* A try for commercial-open source: versions customized for enterprises, close to their development work flows respectively -* Currently more popular Go IDE has some defects or regrets: - * Text editor (vim/emacs/sublime/Atom, etc.): For the Go newbie is too complex - * Plug-in (goclipse, etc.): the need for the original IDE support, not professional - * LiteIDE: no modern user interface :p - * No team development experience -* There are a few of GO IDEs, and no one developed by Go itself, this is a nice try - -## Features - -* [X] Code Highlight, Folding: Go/HTML/JavaScript/Markdown etc. -* [X] Autocomplete: Go/HTML etc. -* [X] Format: Go/HTML/JSON etc. -* [X] Build & Run -* [X] Multiplayer: a real team development experience -* [X] Navigation, Jump to declaration, Find usages, File search etc. -* [X] Shell: run command on the server -* [X] Web development: HTML/JS/CSS editor with [Emmet](http://emmet.io) integrated -* [X] Go tool: go get/install/fmt etc. -* [X] File Import & Export -* [X] Themes: editor and UI adjust, respectively -* [X] Cross-Compilation -* [ ] Debug -* [ ] Git integration: git command on the web - -## Screenshots - -* **Overview** +* 只需要浏览器就能进行开发、运行 +* 跨平台,甚至在移动设备上 +* 易进行功能扩展 +* 易与其他系统集成 +* 极客体验 - ![Overview](https://cloud.githubusercontent.com/assets/873584/5450620/1d51831e-8543-11e4-930b-670871902425.png) -* **Goto File** - - ![Goto File](https://cloud.githubusercontent.com/assets/873584/5450616/1d495da6-8543-11e4-9285-f9d9c60779ac.png) -* **Autocomplete** - - ![Autocomplete](https://cloud.githubusercontent.com/assets/873584/5450619/1d4d5712-8543-11e4-8fe4-35dbc8348a6e.png) -* **Theme** - - ![4](https://cloud.githubusercontent.com/assets/873584/5450617/1d4c0826-8543-11e4-8b86-f79a4e41550a.png) -* **Show Expression Info** - - ![Show Expression Info](https://cloud.githubusercontent.com/assets/873584/5450618/1d4cd9f4-8543-11e4-950f-121bd3ff4a39.png) -* **Build Error Info** - - ![Build Error Info](https://cloud.githubusercontent.com/assets/873584/5450632/3e51cccc-8543-11e4-8ca8-8d2427aa16b8.png) -* **Git Clone** +核心功能: - ![Git Clone](https://cloud.githubusercontent.com/assets/873584/6545235/2284f230-c5b7-11e4-985e-7e04367921b1.png) -* **Cross-Compilation** - - ![Cross-Compilation](https://cloud.githubusercontent.com/assets/873584/10130037/226d75fc-65f7-11e5-94e4-25ee579ca175.png) +* 代码高亮、折叠:Go/HTML/JavaScript/Markdown 等 +* 自动完成:Go/HTML 等 +* 编译检查:编辑器提示编译错误 +* 格式化:Go/HTML/JSON 等 +* 运行:支持同时运行多个程序 +* 代码导航:跳转到声明,查找使用,文件搜索等 +* Web 开发:前端(HTML/JS/CSS)开发支持 +* go tool:go get/install/fmt 等 +* 项目文件导出 +* UI/编辑器多主题 +* 支持交叉编译 -* **Playground** - ![Playground](https://cloud.githubusercontent.com/assets/873584/21209772/449ecfd2-c2b1-11e6-9aa6-a83477d9f269.gif) - -## Architecture +## 界面 -### Build & Run +### 主界面 + +![Overview](https://cloud.githubusercontent.com/assets/873584/5450620/1d51831e-8543-11e4-930b-670871902425.png) + +### 跳转到文件 + +![Goto File](https://cloud.githubusercontent.com/assets/873584/5450616/1d495da6-8543-11e4-9285-f9d9c60779ac.png) + +### 自动完成 + +![Autocomplete](https://cloud.githubusercontent.com/assets/873584/5450619/1d4d5712-8543-11e4-8fe4-35dbc8348a6e.png) + +### 主题 + +![Theme](https://cloud.githubusercontent.com/assets/873584/5450617/1d4c0826-8543-11e4-8b86-f79a4e41550a.png) + +### 查看表达式 + +![Show Expression Info](https://cloud.githubusercontent.com/assets/873584/5450618/1d4cd9f4-8543-11e4-950f-121bd3ff4a39.png) + +### 构建报错提示 + +![Build Error Info](https://cloud.githubusercontent.com/assets/873584/5450632/3e51cccc-8543-11e4-8ca8-8d2427aa16b8.png) + +### 交叉编译 + +![Cross-Compilation](https://cloud.githubusercontent.com/assets/873584/10130037/226d75fc-65f7-11e5-94e4-25ee579ca175.png) + +### Playground + +![Playground](https://cloud.githubusercontent.com/assets/873584/21209772/449ecfd2-c2b1-11e6-9aa6-a83477d9f269.gif) + +## 架构 + +### 构建与运行 ![Build & Run](https://cloud.githubusercontent.com/assets/873584/4389219/3642bc62-43f3-11e4-8d1f-06d7aaf22784.png) - * A browser tab corresponds to a Wide session - * Execution output push via WebSocket +* 一个浏览器 tab 对应一个 Wide 会话 +* 通过 WebSocket 进行程序执行输出推送 -Flow: - 1. Browser sends ````Build```` request - 2. Server executes ````go build```` command via ````os/exec````
- 2.1. Generates a executable file - 3. Browser sends ````Run```` request - 4. Server executes the file via ````os/exec````
- 4.1. A running process
- 4.2. Execution output push via WebSocket channel - 5. Browser renders with callback function ````ws.onmessage```` +1. 客户端浏览器发送 ````Build```` 请求 +2. 服务器使用 ````os/exec```` 执行 ````go build```` 命令
+ 2.1. 生成可执行文件 +3. 客户端浏览器发送 ````Run```` 请求 +4. 服务器使用 ````os/exec```` 执行文件
+ 4.1. 生成进程
+ 4.2. 运行结果输出到 WebSocket 通道 +5. 客户端浏览器监听 ````ws.onmessage```` 到消息后做展现 -### Code Assist +### 代码辅助 -![Code Assist](https://cloud.githubusercontent.com/assets/873584/4399135/3b80c21c-4463-11e4-8e94-7f7e8d12a4df.png) +![](https://cloud.githubusercontent.com/assets/873584/4399135/3b80c21c-4463-11e4-8e94-7f7e8d12a4df.png) - * Autocompletion - * Find Usages/Jump To Declaration/etc. +* 自动完成 +* 查找使用 -Flow: - 1. Browser sends code assist request - 2. Handler gets user workspace of the request with HTTP session - 3. Server executes ````gocode````/````ide_stub(gotools)````
- 3.1 Sets environment variables (e.g. ${GOPATH})
- 3.2 ````gocode```` with ````lib-path```` parameter +1. 浏览器客户端发送代码辅助请求 +2. Handler 根据请求对应的 HTTP 会话获取用户工作空间 +3. 执行 `gocode`/`ide_stub(gotools)` 命令
+ 3.1 设置环境变量(${GOPATH} 为用户工作空间路径)
+ 3.2 `gocode` 命令需要设置参数 `lib-path` -## Documents +## 文档 -* [用户指南](https://www.gitbook.com/book/88250/wide-user-guide) -* [开发指南](https://www.gitbook.com/book/88250/wide-dev-guide) +* [用户指南](https://hacpai.com/article/1538873544275) +* [开发指南](https://hacpai.com/article/1538876422995) -## Setup +## 社区 -### Download Binary +* [讨论区](https://hacpai.com/tag/wide) +* [报告问题](https://github.com/b3log/wide/issues/new/choose) -We have provided OS-specific executable binary as follows: +## 授权 -* linux-amd64/386 -* windows-amd64/386 -* darwin-amd64/386 +Wide 使用 [Apache License, Version 2](https://www.apache.org/licenses/LICENSE-2.0) 作为开源协议,请务必遵循该开源协议相关约定。 -Download [HERE](http://pan.baidu.com/s/1dD3XwOT)! +## 鸣谢 -### Build Wide for yourself - -1. [Download](https://github.com/b3log/wide/archive/master.zip) source or by `git clone https://github.com/b3log/wide` -2. Get dependencies with - * `go get` - * `go get github.com/visualfc/gotools github.com/nsf/gocode github.com/bradfitz/goimports` -3. Compile wide with `go build` - -### Docker - -1. Get image: `sudo docker pull 88250/wide:latest` -2. Run: `sudo docker run -p 127.0.0.1:7070:7070 88250/wide:latest ./wide -docker=true -channel=ws://127.0.0.1:7070` -3. Open browser: http://127.0.0.1:7070 - -## Known Issues - -* [Shell is not available on Windows](https://github.com/b3log/wide/issues/32) -* [Rename directory](https://github.com/b3log/wide/issues/251) - -## Terms - -* This software is open sourced under the Apache License 2.0 -* You can not get rid of the "Powered by [B3log](http://b3log.org)" from any page, even which you made -* If you want to use this software for commercial purpose, please mail to support@liuyun.io for a commercial license request -* Copyright © b3log.org, all rights reserved - -## Credits - -Wide is made possible by the following open source projects. - -* [golang](http://golang.org) +* [golang](https://golang.org) * [CodeMirror](https://github.com/marijnh/CodeMirror) * [zTree](https://github.com/zTree/zTree_v3) * [LiteIDE](https://github.com/visualfc/liteide) diff --git a/TERMS.md b/TERMS.md index e1ed6ec..5fe3ff3 100644 --- a/TERMS.md +++ b/TERMS.md @@ -1,4 +1,4 @@ * This software is open sourced under the Apache License 2.0 -* You can not get rid of the "Powered by [B3log](http://b3log.org)" from any pages, even the pages are developed by you -* If you want to use this software for commercial purpose, please mail to support@liuyun.io for request a commercial license +* You can not get rid of the "Powered by [B3log](https://b3log.org)" from any pages, even the pages are developed by you +* If you want to use this software for commercial purpose, please mail to os@b3log.org for request a commercial license * Copyright (c) b3log.org, all rights reserved diff --git a/conf/user.go b/conf/user.go index fe5d4fd..eab3e54 100644 --- a/conf/user.go +++ b/conf/user.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -15,9 +15,6 @@ package conf import ( - "crypto/md5" - "crypto/sha1" - "encoding/hex" "encoding/json" "io/ioutil" "os" @@ -25,8 +22,6 @@ import ( "regexp" "strings" "time" - - "github.com/b3log/wide/util" ) // Panel represents a UI panel. @@ -52,11 +47,9 @@ type LatestSessionContent struct { // User configuration. type User struct { + Id string Name string - Password string - Salt string - Email string - Gravatar string // see http://gravatar.com + Avatar string Workspace string // the GOPATH of this user (maybe contain several paths splitted by os.PathListSeparator) Locale string GoFormat string @@ -83,28 +76,7 @@ type editor struct { TabSize string } -// NewUser creates a user with the specified username, password, email and workspace. -func NewUser(username, password, email, workspace string) *User { - md5hash := md5.New() - md5hash.Write([]byte(email)) - gravatar := hex.EncodeToString(md5hash.Sum(nil)) - - salt := util.Rand.String(16) - password = Salt(password, salt) - - now := time.Now().UnixNano() - - return &User{Name: username, Password: password, Salt: salt, Email: email, Gravatar: gravatar, Workspace: workspace, - Locale: Wide.Locale, GoFormat: "gofmt", - GoBuildArgsForLinux: "-i", GoBuildArgsForWindows: "-i", GoBuildArgsForDarwin: "-i", - FontFamily: "Helvetica", FontSize: "13px", Theme: "default", - Keymap: "wide", - Created: now, Updated: now, Lived: now, - Editor: &editor{FontFamily: "Consolas, 'Courier New', monospace", FontSize: "inherit", LineHeight: "17px", - Theme: "wide", TabSize: "4"}} -} - -// Save saves the user's configurations in conf/users/{username}.json. +// Save saves the user's configurations in conf/users/{userId}.json. func (u *User) Save() bool { bytes, err := json.MarshalIndent(u, "", " ") @@ -115,12 +87,12 @@ func (u *User) Save() bool { } if "" == string(bytes) { - logger.Error("Truncated user [" + u.Name + "]") + logger.Error("Truncated user [" + u.Id + "]") return false } - if err = ioutil.WriteFile("conf/users/"+u.Name+".json", bytes, 0644); nil != err { + if err = ioutil.WriteFile(filepath.Join(Wide.Data, "users", u.Id+".json"), bytes, 0644); nil != err { logger.Error(err) return false @@ -129,6 +101,20 @@ func (u *User) Save() bool { return true } +// NewUser creates a user with the specified username and workspace. +func NewUser(id, name, avatar, workspace string) *User { + now := time.Now().UnixNano() + + return &User{Id: id, Name: name, Avatar: avatar, Workspace: workspace, + Locale: Wide.Locale, GoFormat: "gofmt", + GoBuildArgsForLinux: "-i", GoBuildArgsForWindows: "-i", GoBuildArgsForDarwin: "-i", + FontFamily: "Helvetica", FontSize: "13px", Theme: "default", + Keymap: "wide", + Created: now, Updated: now, Lived: now, + Editor: &editor{FontFamily: "Consolas, 'Courier New', monospace", FontSize: "inherit", LineHeight: "17px", + Theme: "wide", TabSize: "4"}} +} + // WorkspacePath gets workspace path of the user. // // Compared to the use of Wide.Workspace, this function will be processed as follows: @@ -136,7 +122,7 @@ func (u *User) Save() bool { // 2. Replace ${GOPATH} with enviorment variable GOPATH // 3. Replace "/" with "\\" (Windows) func (u *User) WorkspacePath() string { - w := strings.Replace(u.Workspace, "{WD}", Wide.WD, 1) + w := u.Workspace w = strings.Replace(w, "${GOPATH}", os.Getenv("GOPATH"), 1) return filepath.FromSlash(w) @@ -168,17 +154,9 @@ func (u *User) BuildArgs(os string) []string { func GetOwner(path string) string { for _, user := range Users { if strings.HasPrefix(path, user.WorkspacePath()) { - return user.Name + return user.Id } } return "" } - -// Salt salts the specified password with the specified salt. -func Salt(password, salt string) string { - sha1hash := sha1.New() - sha1hash.Write([]byte(password + salt)) - - return hex.EncodeToString(sha1hash.Sum(nil)) -} diff --git a/conf/users/admin.json b/conf/users/admin.json deleted file mode 100644 index 99e0f79..0000000 --- a/conf/users/admin.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "Name": "admin", - "Password": "d1bfca21893c908e64fabda01d71294b1ccdcaa7", - "Salt": "dnoyeb", - "Email": "", - "Gravatar": "d41d8cd98f00b204e9800998ecf8427e", - "Workspace": "${GOPATH}", - "Locale": "en_US", - "GoFormat": "gofmt", - "GoBuildArgsForLinux": "-i", - "GoBuildArgsForWindows": "-i", - "GoBuildArgsForDarwin": "-i", - "FontFamily": "Helvetica", - "FontSize": "13px", - "Theme": "default", - "Keymap": "wide", - "Created": 1414080000000000000, - "Updated": 1492963306222604966, - "Lived": 1492963306222604966, - "Editor": { - "FontFamily": "Consolas, 'Courier New', monospace", - "FontSize": "13px", - "LineHeight": "17px", - "Theme": "wide", - "TabSize": "4" - }, - "LatestSessionContent": { - "fileTree": [ - "/Users/Vanessa/Work/Code/GoGoGo/src", - "/Users/Vanessa/Work/Code/GoGoGo/src/github.com", - "/Users/Vanessa/Work/Code/GoGoGo/src/github.com/b3log", - "/Users/Vanessa/Work/Code/GoGoGo/src/github.com/b3log/wide", - "/Users/Vanessa/Work/Code/GoGoGo/src/github.com/b3log/wide/.idea", - "/Users/Vanessa/Work/Code/GoGoGo/src/github.com/b3log/wide/static", - "/Users/Vanessa/Work/Code/GoGoGo/src/github.com/b3log/wide/static/css", - "/Users/Vanessa/Work/Code/GoGoGo/src/github.com/b3log/wide/static/js" - ], - "files": [], - "currentFile": "", - "layout": { - "side": { - "state": "normal", - "size": 200 - }, - "sideRight": { - "state": "normal", - "size": 200 - }, - "bottom": { - "state": "normal", - "size": 100 - } - } - } -} \ No newline at end of file diff --git a/conf/wide.go b/conf/wide.go index da5cf27..d0861e1 100644 --- a/conf/wide.go +++ b/conf/wide.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -39,9 +39,11 @@ const ( PathListSeparator = string(os.PathListSeparator) // WideVersion holds the current Wide's version. - WideVersion = "1.5.2" + WideVersion = "1.5.3" // CodeMirrorVer holds the current editor version. CodeMirrorVer = "5.1" + // UserAgent represents HTTP client user agent. + UserAgent = "Wide/" + WideVersion + "; +https://github.com/b3log/wide" HelloWorld = `package main @@ -55,22 +57,14 @@ func main() { // Configuration. type conf struct { - IP string // server ip, ${ip} - Port string // server port - Context string // server context - Server string // server host and port ({IP}:{Port}) - StaticServer string // static resources server scheme, host and port (http://{IP}:{Port}) + Server string // server LogLevel string // logging level: trace/debug/info/warn/error - Channel string // channel (ws://{IP}:{Port}) + Data string // data directory + RuntimeMode string // runtime mode (dev/prod) HTTPSessionMaxAge int // HTTP session max age (in seciond) StaticResourceVersion string // version of static resources MaxProcs int // Go max procs - RuntimeMode string // runtime mode (dev/prod) - WD string // current working direcitory, ${pwd} Locale string // default locale - Playground string // playground directory - UsersWorkspaces string // users' workspaces directory (admin defaults to ${GOPATH}, others using this) - AllowRegister bool // allow register or not Autocomplete bool // default autocomplete } @@ -83,21 +77,34 @@ var Wide *conf // configurations of users. var Users []*User -// Indicates whether runs via Docker. +// Indicates whether Docker is available. var Docker bool -// Load loads the Wide configurations from wide.json and users' configurations from users/{username}.json. -func Load(confPath, confIP, confPort, confServer, confLogLevel, confStaticServer, confContext, confChannel, - confPlayground string, confDocker bool, confUsersWorkspaces string) { - // XXX: ugly args list.... +// Docker image to run user's program +const DockerImageGo = "golang" - initWide(confPath, confIP, confPort, confServer, confLogLevel, confStaticServer, confContext, confChannel, - confPlayground, confDocker, confUsersWorkspaces) +// Load loads the Wide configurations from wide.json and users' configurations from users/{userId}.json. +func Load(confPath, confData, confServer, confLogLevel string) { + initWide(confPath, confData, confServer, confLogLevel) initUsers() + + cmd := exec.Command("docker", "version") + _, err := cmd.CombinedOutput() + if nil != err { + if !util.OS.IsWindows() { + logger.Errorf("Not found 'docker' installed, running user's code will cause security problem") + + os.Exit(-1) + } + } else { + Docker = true + } } func initUsers() { - f, err := os.Open("conf/users") + os.MkdirAll(Wide.Data+PathSeparator+"users", 0755) + + f, err := os.Open(Wide.Data + PathSeparator + "users") if nil != err { logger.Error(err) @@ -123,8 +130,7 @@ func initUsers() { user := &User{} - bytes, _ := ioutil.ReadFile("conf/users/" + name) - + bytes, _ := ioutil.ReadFile(filepath.Join(Wide.Data, "users", name)) err := json.Unmarshal(bytes, user) if err != nil { logger.Errorf("Parses [%s] error: %v, skip loading this user", name, err) @@ -155,8 +161,7 @@ func initUsers() { initCustomizedConfs() } -func initWide(confPath, confIP, confPort, confServer, confLogLevel, confStaticServer, confContext, confChannel, - confPlayground string, confDocker bool, confUsersWorkspaces string) { +func initWide(confPath, confData, confServer, confLogLevel string) { bytes, err := ioutil.ReadFile(confPath) if nil != err { logger.Error(err) @@ -182,10 +187,6 @@ func initWide(confPath, confIP, confPort, confServer, confLogLevel, confStaticSe logger.Debug("Conf: \n" + string(bytes)) - // Working Directory - Wide.WD = util.OS.Pwd() - logger.Debugf("${pwd} [%s]", Wide.WD) - // User Home home, err := util.OS.Home() if nil != err { @@ -193,82 +194,30 @@ func initWide(confPath, confIP, confPort, confServer, confLogLevel, confStaticSe os.Exit(-1) } - logger.Debugf("${user.home} [%s]", home) - // Playground Directory - Wide.Playground = strings.Replace(Wide.Playground, "${home}", home, 1) - if "" != confPlayground { - Wide.Playground = confPlayground + // Data directory + if "" != confData { + Wide.Data = confData } - - // Users' workspaces Directory - Wide.UsersWorkspaces = strings.Replace(Wide.UsersWorkspaces, "${WD}", Wide.WD, 1) - Wide.UsersWorkspaces = strings.Replace(Wide.UsersWorkspaces, "${home}", home, 1) - if "" != confUsersWorkspaces { - Wide.UsersWorkspaces = confUsersWorkspaces - } - Wide.UsersWorkspaces = filepath.Clean(Wide.UsersWorkspaces) - - if !util.File.IsExist(Wide.Playground) { - if err := os.Mkdir(Wide.Playground, 0775); nil != err { - logger.Errorf("Create Playground [%s] error", err) + Wide.Data = strings.Replace(Wide.Data, "${home}", home, -1) + Wide.Data = filepath.Clean(Wide.Data) + if !util.File.IsExist(Wide.Data) { + if err := os.MkdirAll(Wide.Data, 0775); nil != err { + logger.Errorf("Create data directory [%s] error", err) os.Exit(-1) } } - // IP - if "" != confIP { - Wide.IP = confIP - } else { - ip, err := util.Net.LocalIP() - if nil != err { - logger.Error(err) - - os.Exit(-1) - } - - logger.Debugf("${ip} [%s]", ip) - Wide.IP = strings.Replace(Wide.IP, "${ip}", ip, 1) - } - - if "" != confPort { - Wide.Port = confPort - } - - // Docker flag - Docker = confDocker - // Server - Wide.Server = strings.Replace(Wide.Server, "{IP}", Wide.IP, 1) - Wide.Server = strings.Replace(Wide.Server, "{Port}", Wide.Port, 1) if "" != confServer { Wide.Server = confServer } - // Static Server - Wide.StaticServer = strings.Replace(Wide.StaticServer, "{IP}", Wide.IP, 1) - Wide.StaticServer = strings.Replace(Wide.StaticServer, "{Port}", Wide.Port, 1) - if "" != confStaticServer { - Wide.StaticServer = confStaticServer - } - - // Context - if "" != confContext { - Wide.Context = confContext - } - time := strconv.FormatInt(time.Now().UnixNano(), 10) logger.Debugf("${time} [%s]", time) Wide.StaticResourceVersion = strings.Replace(Wide.StaticResourceVersion, "${time}", time, 1) - - // Channel - Wide.Channel = strings.Replace(Wide.Channel, "{IP}", Wide.IP, 1) - Wide.Channel = strings.Replace(Wide.Channel, "{Port}", Wide.Port, 1) - if "" != confChannel { - Wide.Channel = confChannel - } } // FixedTimeCheckEnv checks Wide runtime enviorment periodically (7 minutes). @@ -279,7 +228,7 @@ func FixedTimeCheckEnv() { checkEnv() // check immediately go func() { - for _ = range time.Tick(time.Minute * 7) { + for _ = range time.Tick(time.Minute*7) { checkEnv() } }() @@ -322,10 +271,10 @@ func checkEnv() { } } -// GetUserWorkspace gets workspace path with the specified username, returns "" if not found. -func GetUserWorkspace(username string) string { +// GetUserWorkspace gets workspace path with the specified user id, returns "" if not found. +func GetUserWorkspace(userId string) string { for _, user := range Users { - if user.Name == username { + if user.Id == userId { return user.WorkspacePath() } } @@ -334,9 +283,9 @@ func GetUserWorkspace(username string) string { } // GetGoFmt gets the path of Go format tool, returns "gofmt" if not found "goimports". -func GetGoFmt(username string) string { +func GetGoFmt(userId string) string { for _, user := range Users { - if user.Name == username { + if user.Id == userId { switch user.GoFormat { case "gofmt": return "gofmt" @@ -352,15 +301,14 @@ func GetGoFmt(username string) string { return "gofmt" } -// GetUser gets configuration of the user specified by the given username, returns nil if not found. -func GetUser(username string) *User { - if "playground" == username { // reserved user for Playground - // mock it - return NewUser("playground", "", "", "") +// GetUser gets configuration of the user specified by the given user id, returns nil if not found. +func GetUser(id string) *User { + if "playground" == id { // reserved user for Playground + return NewUser("playground", "playground", "", "") } for _, user := range Users { - if user.Name == username { + if user.Id == id { return user } } @@ -371,17 +319,17 @@ func GetUser(username string) *User { // initCustomizedConfs initializes the user customized configurations. func initCustomizedConfs() { for _, user := range Users { - UpdateCustomizedConf(user.Name) + UpdateCustomizedConf(user.Id) } } // UpdateCustomizedConf creates (if not exists) or updates user customized configuration files. // -// 1. /static/user/{username}/style.css -func UpdateCustomizedConf(username string) { +// 1. /static/users/{userId}/style.css +func UpdateCustomizedConf(userId string) { var u *User for _, user := range Users { // maybe it is a beauty of the trade-off of the another world between design and implementation - if user.Name == username { + if user.Id == userId { u = user } } @@ -399,8 +347,7 @@ func UpdateCustomizedConf(username string) { os.Exit(-1) } - wd := util.OS.Pwd() - dir := filepath.Clean(wd + "/static/user/" + u.Name) + dir := filepath.Clean(Wide.Data + "/static/users/" + userId) if err := os.MkdirAll(dir, 0755); nil != err { logger.Error(err) diff --git a/conf/wide.json b/conf/wide.json index f75abe1..19aeeba 100644 --- a/conf/wide.json +++ b/conf/wide.json @@ -1,19 +1,11 @@ { - "IP": "${ip}", - "Port": "7070", - "Context": "", - "Server": "{IP}:{Port}", - "StaticServer": "", + "Server": "http://127.0.0.1:7070", "LogLevel": "debug", - "Channel": "ws://{IP}:{Port}", + "Data": "${home}/wide", + "RuntimeMode": "dev", "HTTPSessionMaxAge": 86400, "StaticResourceVersion": "${time}", "MaxProcs": 4, - "RuntimeMode": "dev", - "WD": "${pwd}", "Locale": "en_US", - "Playground": "${home}/playground", - "UsersWorkspaces": "${WD}/workspaces", - "AllowRegister": true, "Autocomplete": true } \ No newline at end of file diff --git a/coverage.sh b/coverage.sh index 378fe42..ec12a36 100755 --- a/coverage.sh +++ b/coverage.sh @@ -8,7 +8,7 @@ set -e echo "mode: count" > profile.cov # Standard go tooling behavior is to ignore dirs with leading underscors -for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d); +for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -not -path './vendor*' -type d); do if ls $dir/*.go &> /dev/null; then go test -covermode=count -coverprofile=$dir/profile.tmp $dir diff --git a/deps/github.com.zip b/deps/github.com.zip deleted file mode 100644 index 61f8792..0000000 Binary files a/deps/github.com.zip and /dev/null differ diff --git a/deps/golang.org.zip b/deps/golang.org.zip deleted file mode 100644 index ab1b2cc..0000000 Binary files a/deps/golang.org.zip and /dev/null differ diff --git a/doc/README.md b/doc/README.md deleted file mode 100644 index 80b655f..0000000 --- a/doc/README.md +++ /dev/null @@ -1,2 +0,0 @@ -* [User Guide](https://www.gitbook.com/book/88250/wide-user-guide) -* [Developer Guide](https://www.gitbook.com/book/88250/wide-dev-guide) diff --git a/editor/editors.go b/editor/editors.go index 390a4a2..64c0e85 100644 --- a/editor/editors.go +++ b/editor/editors.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -41,7 +41,7 @@ var logger = log.NewLogger(os.Stdout) // WSHandler handles request of creating editor channel. // XXX: NOT used at present func WSHandler(w http.ResponseWriter, r *http.Request) { - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) @@ -111,13 +111,13 @@ func AutocompleteHandler(w http.ResponseWriter, r *http.Request) { return } - session, _ := session.HTTPSession.Get(r, "wide-session") + session, _ := session.HTTPSession.Get(r, session.CookieName) if session.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) return } - username := session.Values["username"].(string) + uid := session.Values["uid"].(string) path := args["path"].(string) @@ -147,7 +147,7 @@ func AutocompleteHandler(w http.ResponseWriter, r *http.Request) { logger.Tracef("offset: %d", offset) - userWorkspace := conf.GetUserWorkspace(username) + userWorkspace := conf.GetUserWorkspace(uid) workspaces := filepath.SplitList(userWorkspace) libPath := "" for _, workspace := range workspaces { @@ -182,8 +182,8 @@ func GetExprInfoHandler(w http.ResponseWriter, r *http.Request) { result := util.NewResult() defer util.RetResult(w, r, result) - session, _ := session.HTTPSession.Get(r, "wide-session") - username := session.Values["username"].(string) + session, _ := session.HTTPSession.Get(r, session.CookieName) + uid := session.Values["uid"].(string) var args map[string]interface{} if err := json.NewDecoder(r.Body).Decode(&args); err != nil { @@ -228,7 +228,7 @@ func GetExprInfoHandler(w http.ResponseWriter, r *http.Request) { cmd := exec.Command(ideStub, argv...) cmd.Dir = curDir - setCmdEnv(cmd, username) + setCmdEnv(cmd, uid) output, err := cmd.CombinedOutput() if nil != err { @@ -253,13 +253,13 @@ func FindDeclarationHandler(w http.ResponseWriter, r *http.Request) { result := util.NewResult() defer util.RetResult(w, r, result) - session, _ := session.HTTPSession.Get(r, "wide-session") + session, _ := session.HTTPSession.Get(r, session.CookieName) if session.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) return } - username := session.Values["username"].(string) + uid := session.Values["uid"].(string) var args map[string]interface{} if err := json.NewDecoder(r.Body).Decode(&args); err != nil { @@ -304,7 +304,7 @@ func FindDeclarationHandler(w http.ResponseWriter, r *http.Request) { cmd := exec.Command(ideStub, argv...) cmd.Dir = curDir - setCmdEnv(cmd, username) + setCmdEnv(cmd, uid) output, err := cmd.CombinedOutput() if nil != err { @@ -341,13 +341,13 @@ func FindUsagesHandler(w http.ResponseWriter, r *http.Request) { result := util.NewResult() defer util.RetResult(w, r, result) - session, _ := session.HTTPSession.Get(r, "wide-session") + session, _ := session.HTTPSession.Get(r, session.CookieName) if session.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) return } - username := session.Values["username"].(string) + uid := session.Values["uid"].(string) var args map[string]interface{} @@ -392,7 +392,7 @@ func FindUsagesHandler(w http.ResponseWriter, r *http.Request) { cmd := exec.Command(ideStub, argv...) cmd.Dir = curDir - setCmdEnv(cmd, username) + setCmdEnv(cmd, uid) output, err := cmd.CombinedOutput() if nil != err { @@ -453,8 +453,8 @@ func getCursorOffset(code string, line, ch int) (offset int) { return offset } -func setCmdEnv(cmd *exec.Cmd, username string) { - userWorkspace := conf.GetUserWorkspace(username) +func setCmdEnv(cmd *exec.Cmd, userId string) { + userWorkspace := conf.GetUserWorkspace(userId) cmd.Env = append(cmd.Env, "GOPATH="+userWorkspace, diff --git a/editor/formatter.go b/editor/formatter.go index 2d2b0e2..a550f65 100644 --- a/editor/formatter.go +++ b/editor/formatter.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -34,13 +34,13 @@ func GoFmtHandler(w http.ResponseWriter, r *http.Request) { result := util.NewResult() defer util.RetResult(w, r, result) - session, _ := session.HTTPSession.Get(r, "wide-session") + session, _ := session.HTTPSession.Get(r, session.CookieName) if session.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) return } - username := session.Values["username"].(string) + uid := session.Values["uid"].(string) var args map[string]interface{} @@ -85,7 +85,7 @@ func GoFmtHandler(w http.ResponseWriter, r *http.Request) { result.Data = data - fmt := conf.GetGoFmt(username) + fmt := conf.GetGoFmt(uid) argv := []string{filePath} cmd := exec.Command(fmt, argv...) diff --git a/event/events.go b/event/events.go index b1cfbc4..b3eea21 100644 --- a/event/events.go +++ b/event/events.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/file/decompress.go b/file/decompress.go index 27200b0..70a3349 100644 --- a/file/decompress.go +++ b/file/decompress.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/file/exporter.go b/file/exporter.go index ae10ab2..1dca062 100644 --- a/file/exporter.go +++ b/file/exporter.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/file/files.go b/file/files.go index d0c2ffb..dcf66cd 100644 --- a/file/files.go +++ b/file/files.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -74,18 +74,18 @@ func initAPINode() { // The Go API source code package also as a child node, // so that users can easily view the Go API source code in file tree. func GetFilesHandler(w http.ResponseWriter, r *http.Request) { - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) return } - username := httpSession.Values["username"].(string) + uid := httpSession.Values["uid"].(string) result := util.NewResult() defer util.RetGzResult(w, r, result) - userWorkspace := conf.GetUserWorkspace(username) + userWorkspace := conf.GetUserWorkspace(uid) workspaces := filepath.SplitList(userWorkspace) root := Node{Name: "root", Path: "", IconSkin: "ico-ztree-dir ", Type: "d", IsParent: true, Children: []*Node{}} @@ -123,18 +123,18 @@ func GetFilesHandler(w http.ResponseWriter, r *http.Request) { // RefreshDirectoryHandler handles request of refresh a directory of file tree. func RefreshDirectoryHandler(w http.ResponseWriter, r *http.Request) { - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) return } - username := httpSession.Values["username"].(string) + uid := httpSession.Values["uid"].(string) r.ParseForm() path := r.FormValue("path") - if !util.Go.IsAPI(path) && !session.CanAccess(username, path) { + if !util.Go.IsAPI(path) && !session.CanAccess(uid, path) { http.Error(w, "Forbidden", http.StatusForbidden) return @@ -156,13 +156,13 @@ func RefreshDirectoryHandler(w http.ResponseWriter, r *http.Request) { // GetFileHandler handles request of opening file by editor. func GetFileHandler(w http.ResponseWriter, r *http.Request) { - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) return } - username := httpSession.Values["username"].(string) + uid := httpSession.Values["uid"].(string) result := util.NewResult() defer util.RetResult(w, r, result) @@ -178,7 +178,7 @@ func GetFileHandler(w http.ResponseWriter, r *http.Request) { path := args["path"].(string) - if !util.Go.IsAPI(path) && !session.CanAccess(username, path) { + if !util.Go.IsAPI(path) && !session.CanAccess(uid, path) { http.Error(w, "Forbidden", http.StatusForbidden) return @@ -204,15 +204,15 @@ func GetFileHandler(w http.ResponseWriter, r *http.Request) { data["mode"] = "img" - username := conf.GetOwner(path) - if "" == username { - logger.Warnf("The path [%s] has no owner") + userId := conf.GetOwner(path) + if "" == userId { + logger.Warnf("The path [%s] has no owner", path) data["path"] = "" return } - user := conf.GetUser(username) + user := conf.GetUser(uid) data["path"] = "/workspace/" + user.Name + "/" + strings.Replace(path, user.WorkspacePath(), "", 1) @@ -232,13 +232,13 @@ func GetFileHandler(w http.ResponseWriter, r *http.Request) { // SaveFileHandler handles request of saving file. func SaveFileHandler(w http.ResponseWriter, r *http.Request) { - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) return } - username := httpSession.Values["username"].(string) + uid := httpSession.Values["uid"].(string) result := util.NewResult() defer util.RetResult(w, r, result) @@ -255,7 +255,7 @@ func SaveFileHandler(w http.ResponseWriter, r *http.Request) { filePath := args["file"].(string) sid := args["sid"].(string) - if util.Go.IsAPI(filePath) || !session.CanAccess(username, filePath) { + if util.Go.IsAPI(filePath) || !session.CanAccess(uid, filePath) { http.Error(w, "Forbidden", http.StatusForbidden) return @@ -288,13 +288,13 @@ func SaveFileHandler(w http.ResponseWriter, r *http.Request) { // NewFileHandler handles request of creating file or directory. func NewFileHandler(w http.ResponseWriter, r *http.Request) { - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) return } - username := httpSession.Values["username"].(string) + uid := httpSession.Values["uid"].(string) result := util.NewResult() defer util.RetResult(w, r, result) @@ -310,7 +310,7 @@ func NewFileHandler(w http.ResponseWriter, r *http.Request) { path := args["path"].(string) - if util.Go.IsAPI(path) || !session.CanAccess(username, path) { + if util.Go.IsAPI(path) || !session.CanAccess(uid, path) { http.Error(w, "Forbidden", http.StatusForbidden) return @@ -331,22 +331,22 @@ func NewFileHandler(w http.ResponseWriter, r *http.Request) { } if "f" == fileType { - logger.Debugf("Created a file [%s] by user [%s]", path, wSession.Username) + logger.Debugf("Created a file [%s] by user [%s]", path, wSession.UserId) } else { - logger.Debugf("Created a dir [%s] by user [%s]", path, wSession.Username) + logger.Debugf("Created a dir [%s] by user [%s]", path, wSession.UserId) } } // RemoveFileHandler handles request of removing file or directory. func RemoveFileHandler(w http.ResponseWriter, r *http.Request) { - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) return } - username := httpSession.Values["username"].(string) + uid := httpSession.Values["uid"].(string) result := util.NewResult() defer util.RetResult(w, r, result) @@ -362,7 +362,7 @@ func RemoveFileHandler(w http.ResponseWriter, r *http.Request) { path := args["path"].(string) - if util.Go.IsAPI(path) || !session.CanAccess(username, path) { + if util.Go.IsAPI(path) || !session.CanAccess(uid, path) { http.Error(w, "Forbidden", http.StatusForbidden) return @@ -381,18 +381,18 @@ func RemoveFileHandler(w http.ResponseWriter, r *http.Request) { return } - logger.Debugf("Removed a file [%s] by user [%s]", path, wSession.Username) + logger.Debugf("Removed a file [%s] by user [%s]", path, wSession.UserId) } // RenameFileHandler handles request of renaming file or directory. func RenameFileHandler(w http.ResponseWriter, r *http.Request) { - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) return } - username := httpSession.Values["username"].(string) + uid := httpSession.Values["uid"].(string) result := util.NewResult() defer util.RetResult(w, r, result) @@ -408,14 +408,14 @@ func RenameFileHandler(w http.ResponseWriter, r *http.Request) { oldPath := args["oldPath"].(string) if util.Go.IsAPI(oldPath) || - !session.CanAccess(username, oldPath) { + !session.CanAccess(uid, oldPath) { http.Error(w, "Forbidden", http.StatusForbidden) return } newPath := args["newPath"].(string) - if util.Go.IsAPI(newPath) || !session.CanAccess(username, newPath) { + if util.Go.IsAPI(newPath) || !session.CanAccess(uid, newPath) { http.Error(w, "Forbidden", http.StatusForbidden) return @@ -434,7 +434,7 @@ func RenameFileHandler(w http.ResponseWriter, r *http.Request) { return } - logger.Debugf("Renamed a file [%s] to [%s] by user [%s]", oldPath, newPath, wSession.Username) + logger.Debugf("Renamed a file [%s] to [%s] by user [%s]", oldPath, newPath, wSession.UserId) } // Use to find results sorting. @@ -451,13 +451,13 @@ func (f foundPaths) Less(i, j int) bool { return f[i].score > f[j].score } // FindHandler handles request of find files under the specified directory with the specified filename pattern. func FindHandler(w http.ResponseWriter, r *http.Request) { - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) return } - username := httpSession.Values["username"].(string) + uid := httpSession.Values["uid"].(string) result := util.NewResult() defer util.RetResult(w, r, result) @@ -471,7 +471,7 @@ func FindHandler(w http.ResponseWriter, r *http.Request) { } path := args["path"].(string) // path of selected file in file tree - if !util.Go.IsAPI(path) && !session.CanAccess(username, path) { + if !util.Go.IsAPI(path) && !session.CanAccess(uid, path) { http.Error(w, "Forbidden", http.StatusForbidden) return @@ -479,7 +479,7 @@ func FindHandler(w http.ResponseWriter, r *http.Request) { name := args["name"].(string) - userWorkspace := conf.GetUserWorkspace(username) + userWorkspace := conf.GetUserWorkspace(uid) workspaces := filepath.SplitList(userWorkspace) if "" != path && !util.File.IsDir(path) { @@ -505,7 +505,7 @@ func FindHandler(w http.ResponseWriter, r *http.Request) { // SearchTextHandler handles request of searching files under the specified directory with the specified keyword. func SearchTextHandler(w http.ResponseWriter, r *http.Request) { - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) @@ -536,7 +536,7 @@ func SearchTextHandler(w http.ResponseWriter, r *http.Request) { dir := args["dir"].(string) if "" == dir { - userWorkspace := conf.GetUserWorkspace(wSession.Username) + userWorkspace := conf.GetUserWorkspace(wSession.UserId) workspaces := filepath.SplitList(userWorkspace) dir = workspaces[0] } diff --git a/file/importer.go b/file/importer.go deleted file mode 100644 index 3e69f09..0000000 --- a/file/importer.go +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package file - -import ( - "io" - "mime/multipart" - "net/http" - "os" - "path/filepath" - - "github.com/b3log/wide/util" -) - -type fileInfo struct { - Name string `json:"name"` - Type string `json:"type"` - Error string `json:"error,omitempty"` -} - -func handleUpload(p *multipart.Part, dir string) (fi *fileInfo) { - fi = &fileInfo{ - Name: p.FileName(), - Type: p.Header.Get("Content-Type"), - } - - path := filepath.Clean(dir + "/" + fi.Name) - f, _ := os.Create(path) - - io.Copy(f, p) - - f.Close() - - return -} - -func handleUploads(r *http.Request, dir string) (fileInfos []*fileInfo) { - fileInfos = make([]*fileInfo, 0) - mr, err := r.MultipartReader() - - part, err := mr.NextPart() - - for err == nil { - if name := part.FormName(); name != "" { - if part.FileName() != "" { - fileInfos = append(fileInfos, handleUpload(part, dir)) - } - } - - part, err = mr.NextPart() - } - - return -} - -// UploadHandler handles request of file upload. -func UploadHandler(w http.ResponseWriter, r *http.Request) { - result := util.NewResult() - defer util.RetResult(w, r, result) - - q := r.URL.Query() - dir := q["path"][0] - - result.Data = handleUploads(r, dir) -} diff --git a/file/outline.go b/file/outline.go index 36c786a..cf8a5e3 100755 --- a/file/outline.go +++ b/file/outline.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..7fb6aa7 --- /dev/null +++ b/go.mod @@ -0,0 +1,21 @@ +module github.com/b3log/wide + +go 1.12 + +require ( + github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f // indirect + github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f // indirect + github.com/fsnotify/fsnotify v1.4.7 + github.com/gorilla/context v0.0.0-20141217160251-215affda49ad // indirect + github.com/gorilla/securecookie v0.0.0-20150327155805-8e98dd730fc4 // indirect + github.com/gorilla/sessions v0.0.0-20150417174705-f61c3ec2cf65 + github.com/gorilla/websocket v0.0.0-20150530030352-a3ec486e6a7a + github.com/hashicorp/go-version v1.2.0 + github.com/moul/http2curl v1.0.0 // indirect + github.com/parnurzeal/gorequest v0.2.15 + github.com/pkg/errors v0.8.1 // indirect + github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a // indirect + golang.org/x/net v0.0.0-20190514140710-3ec191127204 // indirect + golang.org/x/sys v0.0.0-20190515190549-87c872767d25 // indirect + golang.org/x/text v0.3.2 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..d104a27 --- /dev/null +++ b/go.sum @@ -0,0 +1,43 @@ +github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f h1:8GDPb0tCY8LQ+OJ3dbHb5sA6YZWXFORQYZx5sdsTlMs= +github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= +github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f h1:AUj1VoZUfhPhOPHULCQQDnGhRelpFWHMLhQVWDsS0v4= +github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v0.0.0-20141217160251-215affda49ad h1:wJwKN6X6iRRVnjdBgrkWjhBOvYm7yw5boqXwFUnBtbE= +github.com/gorilla/context v0.0.0-20141217160251-215affda49ad/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/securecookie v0.0.0-20150327155805-8e98dd730fc4 h1:X0DbEdoaUJT+NZ8mLHRNMSLmogzqLhsA1Eh6gs7Y7Zg= +github.com/gorilla/securecookie v0.0.0-20150327155805-8e98dd730fc4/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= +github.com/gorilla/sessions v0.0.0-20150417174705-f61c3ec2cf65 h1:bDPV+Nh80WIp0U0a/o9wKilWRxH+l8jIySjElU91LeA= +github.com/gorilla/sessions v0.0.0-20150417174705-f61c3ec2cf65/go.mod h1:+WVp8kdw6VhyKExm03PAMRn2ZxnPtm58pV0dBVPdhHE= +github.com/gorilla/websocket v0.0.0-20150530030352-a3ec486e6a7a h1:p/PGT+3UGSK7eULOGHUMCUxI5U976R34HWuKHbFpK3Q= +github.com/gorilla/websocket v0.0.0-20150530030352-a3ec486e6a7a/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs= +github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= +github.com/parnurzeal/gorequest v0.2.15 h1:oPjDCsF5IkD4gUk6vIgsxYNaSgvAnIh1EJeROn3HdJU= +github.com/parnurzeal/gorequest v0.2.15/go.mod h1:3Kh2QUMJoqw3icWAecsyzkpY7UzRfDhbRdTjtNwNiUE= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs= +github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190514140710-3ec191127204 h1:4yG6GqBtw9C+UrLp6s2wtSniayy/Vd/3F7ffLE427XI= +golang.org/x/net v0.0.0-20190514140710-3ec191127204/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190515190549-87c872767d25 h1:SSKQq5sjDoW0L0NaDoVl7d7HmtTxM0ezm0Ef9azs4uQ= +golang.org/x/sys v0.0.0-20190515190549-87c872767d25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= diff --git a/gulpfile.js b/gulpfile.js index b93f6eb..29d5703 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,11 +1,11 @@ /* - * Copyright (c) 2014-2015, b3log.org + * Copyright (c) 2014-2018, b3log.org * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -16,120 +16,135 @@ /** * @file frontend tool. - * + * * @author Liyuan Li - * @version 0.1.0.0, Dec 15, 2015 + * @version 0.2.0.0, Oct 5, 2018 */ -var gulp = require("gulp"); -var concat = require('gulp-concat'); -var minifyCSS = require('gulp-minify-css'); -var uglify = require('gulp-uglify'); -var sourcemaps = require("gulp-sourcemaps"); +var gulp = require('gulp') +var concat = require('gulp-concat') +var minifyCSS = require('gulp-minify-css') +var uglify = require('gulp-uglify') +var sourcemaps = require('gulp-sourcemaps') -gulp.task('cc', function () { - // css - var cssLibs = ['./static/js/lib/jquery-layout/layout-default-latest.css', - './static/js/lib/codemirror-5.1/codemirror.css', - './static/js/lib/codemirror-5.1/addon/hint/show-hint.css', - './static/js/lib/codemirror-5.1/addon/lint/lint.css', - './static/js/lib/codemirror-5.1/addon/fold/foldgutter.css', - './static/js/lib/codemirror-5.1/addon/dialog/dialog.css', - './static/js/overwrite/codemirror/theme/*.css']; - gulp.src(cssLibs) - .pipe(minifyCSS()) - .pipe(concat('lib.min.css')) - .pipe(gulp.dest('./static/css/')); +function minLibCSS () { + // css + var cssLibs = [ + './static/js/lib/jquery-layout/layout-default-latest.css', + './static/js/lib/codemirror-5.1/codemirror.css', + './static/js/lib/codemirror-5.1/addon/hint/show-hint.css', + './static/js/lib/codemirror-5.1/addon/lint/lint.css', + './static/js/lib/codemirror-5.1/addon/fold/foldgutter.css', + './static/js/lib/codemirror-5.1/addon/dialog/dialog.css', + './static/js/overwrite/codemirror/theme/*.css'] + return gulp.src(cssLibs). + pipe(minifyCSS()). + pipe(concat('lib.min.css')). + pipe(gulp.dest('./static/css/')) +} - gulp.src('./static/js/lib/ztree/zTreeStyle.css') - .pipe(minifyCSS()) - .pipe(concat('zTreeStyle.min.css')) - .pipe(gulp.dest('./static/js/lib/ztree/')); +function minZTreeStyleCSS () { + return gulp.src('./static/js/lib/ztree/zTreeStyle.css'). + pipe(minifyCSS()). + pipe(concat('zTreeStyle.min.css')). + pipe(gulp.dest('./static/js/lib/ztree/')) +} - var cssWide = ['./static/css/dialog.css', - './static/css/base.css', - './static/css/wide.css', - './static/css/side.css', - './static/css/start.css', - './static/css/about.css' - ]; +function minWideCSS () { + var cssWide = [ + './static/css/dialog.css', + './static/css/base.css', + './static/css/wide.css', + './static/css/side.css', + './static/css/start.css', + './static/css/about.css', + ] - gulp.src(cssWide) - .pipe(minifyCSS()) - .pipe(concat('wide.min.css')) - .pipe(gulp.dest('./static/css/')); + return gulp.src(cssWide). + pipe(minifyCSS()). + pipe(concat('wide.min.css')). + pipe(gulp.dest('./static/css/')) +} +function minLibJS () { + // js + var jsLibs = [ + './static/js/lib/jquery-2.1.1.min.js', + './static/js/lib/jquery-ui.min.js', + './static/js/lib/jquery-layout/jquery.layout-latest.js', + './static/js/lib/reconnecting-websocket.js', + './static/js/lib/Autolinker.min.js', + './static/js/lib/emmet.js', + './static/js/lib/js-beautify-1.5.4/beautify.js', + './static/js/lib/js-beautify-1.5.4/beautify-html.js', + './static/js/lib/js-beautify-1.5.4/beautify-css.js', + './static/js/lib/jquery-file-upload-9.8.0/vendor/jquery.ui.widget.js', + './static/js/lib/jquery-file-upload-9.8.0/jquery.iframe-transport.js', + './static/js/lib/jquery-file-upload-9.8.0/jquery.fileupload.js', + './static/js/lib/codemirror-5.1/codemirror.min.js', + './static/js/lib/codemirror-5.1/addon/lint/lint.js', + './static/js/lib/codemirror-5.1/addon/lint/json-lint.js', + './static/js/lib/codemirror-5.1/addon/selection/active-line.js', + './static/js/lib/codemirror-5.1/addon/selection/active-line.js', + './static/js/overwrite/codemirror/addon/hint/show-hint.js', + './static/js/lib/codemirror-5.1/addon/hint/anyword-hint.js', + './static/js/lib/codemirror-5.1/addon/display/rulers.js', + './static/js/lib/codemirror-5.1/addon/edit/closebrackets.js', + './static/js/lib/codemirror-5.1/addon/edit/matchbrackets.js', + './static/js/lib/codemirror-5.1/addon/edit/closetag.js', + './static/js/lib/codemirror-5.1/addon/search/searchcursor.js', + './static/js/lib/codemirror-5.1/addon/search/search.js', + './static/js/lib/codemirror-5.1/addon/dialog/dialog.js', + './static/js/lib/codemirror-5.1/addon/search/match-highlighter.js', + './static/js/lib/codemirror-5.1/addon/fold/foldcode.js', + './static/js/lib/codemirror-5.1/addon/fold/foldgutter.js', + './static/js/lib/codemirror-5.1/addon/fold/brace-fold.js', + './static/js/lib/codemirror-5.1/addon/fold/xml-fold.js', + './static/js/lib/codemirror-5.1/addon/fold/markdown-fold.js', + './static/js/lib/codemirror-5.1/addon/fold/comment-fold.js', + './static/js/lib/codemirror-5.1/addon/mode/loadmode.js', + './static/js/lib/codemirror-5.1/addon/comment/comment.js', + './static/js/lib/codemirror-5.1/mode/meta.js', + './static/js/lib/codemirror-5.1/mode/go/go.js', + './static/js/lib/codemirror-5.1/mode/clike/clike.js', + './static/js/lib/codemirror-5.1/mode/xml/xml.js', + './static/js/lib/codemirror-5.1/mode/htmlmixed/htmlmixed.js', + './static/js/lib/codemirror-5.1/mode/javascript/javascript.js', + './static/js/lib/codemirror-5.1/mode/markdown/markdown.js', + './static/js/lib/codemirror-5.1/mode/css/css.js', + './static/js/lib/codemirror-5.1/mode/shell/shell.js', + './static/js/lib/codemirror-5.1/mode/sql/sql.js', + './static/js/lib/codemirror-5.1/keymap/vim.js', + './static/js/lib/lint/json-lint.js', + './static/js/lib/lint/go-lint.js'] + return gulp.src(jsLibs). + pipe(uglify()). + pipe(concat('lib.min.js')). + pipe(gulp.dest('./static/js/')) +} - // js - var jsLibs = ['./static/js/lib/jquery-2.1.1.min.js', - './static/js/lib/jquery-ui.min.js', - './static/js/lib/jquery-layout/jquery.layout-latest.js', - './static/js/lib/reconnecting-websocket.js', - './static/js/lib/Autolinker.min.js', - './static/js/lib/emmet.js', - './static/js/lib/js-beautify-1.5.4/beautify.js', - './static/js/lib/js-beautify-1.5.4/beautify-html.js', - './static/js/lib/js-beautify-1.5.4/beautify-css.js', - './static/js/lib/jquery-file-upload-9.8.0/vendor/jquery.ui.widget.js', - './static/js/lib/jquery-file-upload-9.8.0/jquery.iframe-transport.js', - './static/js/lib/jquery-file-upload-9.8.0/jquery.fileupload.js', - './static/js/lib/codemirror-5.1/codemirror.min.js', - './static/js/lib/codemirror-5.1/addon/lint/lint.js', - './static/js/lib/codemirror-5.1/addon/lint/json-lint.js', - './static/js/lib/codemirror-5.1/addon/selection/active-line.js', - './static/js/lib/codemirror-5.1/addon/selection/active-line.js', - './static/js/overwrite/codemirror/addon/hint/show-hint.js', - './static/js/lib/codemirror-5.1/addon/hint/anyword-hint.js', - './static/js/lib/codemirror-5.1/addon/display/rulers.js', - './static/js/lib/codemirror-5.1/addon/edit/closebrackets.js', - './static/js/lib/codemirror-5.1/addon/edit/matchbrackets.js', - './static/js/lib/codemirror-5.1/addon/edit/closetag.js', - './static/js/lib/codemirror-5.1/addon/search/searchcursor.js', - './static/js/lib/codemirror-5.1/addon/search/search.js', - './static/js/lib/codemirror-5.1/addon/dialog/dialog.js', - './static/js/lib/codemirror-5.1/addon/search/match-highlighter.js', - './static/js/lib/codemirror-5.1/addon/fold/foldcode.js', - './static/js/lib/codemirror-5.1/addon/fold/foldgutter.js', - './static/js/lib/codemirror-5.1/addon/fold/brace-fold.js', - './static/js/lib/codemirror-5.1/addon/fold/xml-fold.js', - './static/js/lib/codemirror-5.1/addon/fold/markdown-fold.js', - './static/js/lib/codemirror-5.1/addon/fold/comment-fold.js', - './static/js/lib/codemirror-5.1/addon/fold/mode/loadmode.js', - './static/js/lib/codemirror-5.1/addon/fold/comment/comment.js', - './static/js/lib/codemirror-5.1/mode/meta.js', - './static/js/lib/codemirror-5.1/mode/go/go.js', - './static/js/lib/codemirror-5.1/mode/clike/clike.js', - './static/js/lib/codemirror-5.1/mode/xml/xml.js', - './static/js/lib/codemirror-5.1/mode/htmlmixed/htmlmixed.js', - './static/js/lib/codemirror-5.1/mode/javascript/javascript.js', - './static/js/lib/codemirror-5.1/mode/markdown/markdown.js', - './static/js/lib/codemirror-5.1/mode/css/css.js', - './static/js/lib/codemirror-5.1/mode/shell/shell.js', - './static/js/lib/codemirror-5.1/mode/sql/sql.js', - './static/js/lib/codemirror-5.1/keymap/vim.js', - './static/js/lib/lint/json-lint.js', - './static/js/lib/lint/go-lint.js']; - gulp.src(jsLibs) - .pipe(uglify()) - .pipe(concat('lib.min.js')) - .pipe(gulp.dest('./static/js/')); +function minWideJS () { + var jsWide = [ + './static/js/tabs.js', + './static/js/tabs.js', + './static/js/dialog.js', + './static/js/editors.js', + './static/js/notification.js', + './static/js/tree.js', + './static/js/wide.js', + './static/js/session.js', + './static/js/menu.js', + './static/js/windows.js', + './static/js/hotkeys.js', + './static/js/bottomGroup.js', + ] + return gulp.src(jsWide). + pipe(sourcemaps.init()). + pipe(uglify()). + pipe(concat('wide.min.js')). + pipe(sourcemaps.write('.')). + pipe(gulp.dest('./static/js/')) +} - var jsWide = ['./static/js/tabs.js', - './static/js/tabs.js', - './static/js/dialog.js', - './static/js/editors.js', - './static/js/notification.js', - './static/js/tree.js', - './static/js/wide.js', - './static/js/session.js', - './static/js/menu.js', - './static/js/windows.js', - './static/js/hotkeys.js', - './static/js/bottomGroup.js' - ]; - gulp.src(jsWide) - .pipe(sourcemaps.init()) - .pipe(uglify()) - .pipe(concat('wide.min.js')) - .pipe(sourcemaps.write(".")) - .pipe(gulp.dest('./static/js/')); -}); \ No newline at end of file +gulp.task('default', + gulp.series( + gulp.parallel(minLibCSS, minZTreeStyleCSS, minWideCSS, minLibJS, minWideJS))) \ No newline at end of file diff --git a/i18n/en_US.json b/i18n/en_US.json index 23f6b94..056934b 100644 --- a/i18n/en_US.json +++ b/i18n/en_US.json @@ -105,8 +105,6 @@ "start-get": "START [go get]", "get-succ": "[go get] SUCCESS", "get-error": "[go get] ERROR", - "start-git_clone": "START [git clone]", - "git_clone-done": "[git clone] DONE", "check_version": "Checking update", "new_version_available": "new version available", "go_env": "Go", @@ -139,7 +137,6 @@ "clearOutput": "Clear Output", "export": "Export", "refresh": "Refresh", - "import": "Import", "theme": "Theme", "tab_size": "Tab Size", "copy_file_path": "Copy File Path", @@ -162,7 +159,6 @@ "no_empty": "Can not Empty!", "change_avatar": "Avatar modify go", "open": "Open", - "pricing": "Pricing", "search_no_match": "No matching files were found.", "outline": "Outline", "govet": "go vet", @@ -174,7 +170,6 @@ "url": "URL", "short_url": "Short URL", "embeded": "Embeded", - "git_clone": "Git Clone", "terms": "Terms", "download": "Download", "decompress": "Decompress", diff --git a/i18n/ja_JP.json b/i18n/ja_JP.json index 0e3c893..862858d 100644 --- a/i18n/ja_JP.json +++ b/i18n/ja_JP.json @@ -105,8 +105,6 @@ "start-get": "[go get] 開始", "get-succ": "[go get] 成功", "get-error": "[go get] 失敗", - "start-git_clone": "[git clone] 開始", - "git_clone-done": "[git clone] 終わった", "check_version": "更新をチェック中", "new_version_available": "新しいバージョンがあります", "go_env": "Go", @@ -139,7 +137,6 @@ "clearOutput": "空の出力", "export": "輸出", "refresh": "リフレッシュ", - "import": "インポート", "theme": "テーマ", "tab_size": "Tab サイズ", "copy_file_path": "ファイルパスをコピー", @@ -162,7 +159,6 @@ "no_empty": "空ではありません", "change_avatar": "アバターの変更は行く", "open": "オープン", - "pricing": "价格", "search_no_match": "一致するファイルが見つかりませんでした。", "outline": "アウトライン", "govet": "go vet", @@ -174,7 +170,6 @@ "url": "リンク", "short_url": "ショートリンク", "embeded": "埋め込む", - "git_clone": "Git クローン", "terms": "利用規約", "download": "ダウンロード", "decompress": "解凍する", diff --git a/i18n/ko_KR.json b/i18n/ko_KR.json index 9006c22..d2d433c 100644 --- a/i18n/ko_KR.json +++ b/i18n/ko_KR.json @@ -105,8 +105,6 @@ "start-get": "시작 [go get]", "get-succ": "[go get] 성공", "get-error": "[go get] 실패", - "start-git_clone": "시작 [git clone]", - "git_clone-done": "[git clone] 완성", "check_version": "최신버전검색중", "new_version_available": "최신업데이트 사용 가능", "go_env": "Go 환경", @@ -139,7 +137,6 @@ "clearOutput": "ouput 클리어", "export": "내보내기", "refresh": "새로고침", - "import": "가져오기", "theme": "주제", "tab_size": "Tab 크기", "copy_file_path": "경로복사", @@ -162,7 +159,6 @@ "no_empty": "값을 입력해 주세요.", "change_avatar": "아이콘변경은 여기로.", "open": "열기", - "pricing": "가격", "search_no_match": "해당 문서를 찾지 못하였습니다.", "outline": "주제", "govet": "go vet", @@ -174,7 +170,6 @@ "url": "하이퍼링크", "short_url": "짧은 링크", "embeded": "삽입", - "git_clone": "Git clone", "terms": "사용계약", "download": "다운로드", "decompress": "압축풀기", diff --git a/i18n/locales.go b/i18n/locales.go index 6431767..0537fca 100644 --- a/i18n/locales.go +++ b/i18n/locales.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/i18n/zh_CN.json b/i18n/zh_CN.json index a928496..01deaa1 100644 --- a/i18n/zh_CN.json +++ b/i18n/zh_CN.json @@ -105,8 +105,6 @@ "start-get": "开始 [go get]", "get-succ": "[go get] 成功", "get-error": "[go get] 失败", - "start-git_clone": "开始 [git clone]", - "git_clone-done": "[git clone] 完成", "check_version": "正在检查更新", "new_version_available": "新版本可用", "go_env": "Go 环境", @@ -139,7 +137,6 @@ "clearOutput": "清空输出", "export": "导出", "refresh": "刷新", - "import": "导入", "theme": "主题", "tab_size": "Tab 大小", "copy_file_path": "复制文件路径", @@ -162,7 +159,6 @@ "no_empty": "不能为空", "change_avatar": "头像修改请到", "open": "打开", - "pricing": "价格", "search_no_match": "没有发现匹配的文件。", "outline": "大纲", "govet": "go vet", @@ -174,7 +170,6 @@ "url": "链接", "short_url": "短链接", "embeded": "嵌入", - "git_clone": "Git 克隆", "terms": "使用条款", "download": "下载", "decompress": "解压缩", diff --git a/i18n/zh_TW.json b/i18n/zh_TW.json index 729cda7..7bccca7 100644 --- a/i18n/zh_TW.json +++ b/i18n/zh_TW.json @@ -105,8 +105,6 @@ "start-get": "開始 [go get]", "get-succ": "[go get] 成功", "get-error": "[go get] 失敗", - "start-git_clone": "開始 [git clone]", - "git_clone-done": "[git clone] 完成", "check_version": "正在檢查更新", "new_version_available": "可用新版本", "go_env": "Go 環境", @@ -139,7 +137,6 @@ "clearOutput": "清空輸出", "export": "導出", "refresh": "刷新", - "import": "導入", "theme": "主題", "tab_size": "Tab 大小", "copy_file_path": "複製檔案位置", @@ -162,7 +159,6 @@ "no_empty": "不能為空", "change_avatar": "修改頭像請到", "open": "開啟", - "pricing": "價格", "search_no_match": "沒有發現匹配的文件。", "outline": "大綱", "govet": "go vet", @@ -174,7 +170,6 @@ "url": "連結", "short_url": "短網址", "embeded": "嵌入", - "git_clone": "Git Clone", "terms": "使用條款", "download": "下載", "decompress": "解壓縮", diff --git a/log/logs.go b/log/logs.go index f57dccb..5cf399f 100755 --- a/log/logs.go +++ b/log/logs.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/log/logs_test.go b/log/logs_test.go index ca4cf03..c7dba69 100644 --- a/log/logs_test.go +++ b/log/logs_test.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/main.go b/main.go index 3ffcbd2..386fbba 100644 --- a/main.go +++ b/main.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -38,7 +38,6 @@ import ( "github.com/b3log/wide/notification" "github.com/b3log/wide/output" "github.com/b3log/wide/playground" - "github.com/b3log/wide/scm/git" "github.com/b3log/wide/session" "github.com/b3log/wide/util" ) @@ -49,34 +48,26 @@ var logger *log.Logger // The only one init function in Wide. func init() { confPath := flag.String("conf", "conf/wide.json", "path of wide.json") - confIP := flag.String("ip", "", "this will overwrite Wide.IP if specified") - confPort := flag.String("port", "", "this will overwrite Wide.Port if specified") + confData := flag.String("data", "", "path of data dir") confServer := flag.String("server", "", "this will overwrite Wide.Server if specified") confLogLevel := flag.String("log_level", "", "this will overwrite Wide.LogLevel if specified") - confStaticServer := flag.String("static_server", "", "this will overwrite Wide.StaticServer if specified") - confContext := flag.String("context", "", "this will overwrite Wide.Context if specified") - confChannel := flag.String("channel", "", "this will overwrite Wide.Channel if specified") confStat := flag.Bool("stat", false, "whether report statistics periodically") - confDocker := flag.Bool("docker", false, "whether run in a docker container") - confPlayground := flag.String("playground", "", "this will overwrite Wide.Playground if specified") - confUsersWorkspaces := flag.String("users_workspaces", "", "this will overwrite Wide.UsersWorkspaces if specified") flag.Parse() log.SetLevel("warn") logger = log.NewLogger(os.Stdout) - wd := util.OS.Pwd() - if strings.HasPrefix(wd, os.TempDir()) { - logger.Error("Don't run Wide in OS' temp directory or with `go run`") - - os.Exit(-1) - } + //wd := util.OS.Pwd() + //if strings.HasPrefix(wd, os.TempDir()) { + // logger.Error("Don't run Wide in OS' temp directory or with `go run`") + // + // os.Exit(-1) + //} i18n.Load() event.Load() - conf.Load(*confPath, *confIP, *confPort, *confServer, *confLogLevel, *confStaticServer, *confContext, *confChannel, - *confPlayground, *confDocker, *confUsersWorkspaces) + conf.Load(*confPath, *confData, *confServer, *confLogLevel) conf.FixedTimeCheckEnv() session.FixedTimeSave() @@ -86,8 +77,7 @@ func init() { session.FixedTimeReport() } - logger.Debug("host ["+runtime.Version()+", "+runtime.GOOS+"_"+runtime.GOARCH+"], cross-compilation ", - util.Go.GetCrossPlatforms()) + logger.Debug("host ["+runtime.Version()+", "+runtime.GOOS+"_"+runtime.GOARCH+"], cross-compilation ", util.Go.GetCrossPlatforms()) } // Main. @@ -98,96 +88,86 @@ func main() { handleSignal() // IDE - http.HandleFunc(conf.Wide.Context+"/", handlerGzWrapper(indexHandler)) - http.HandleFunc(conf.Wide.Context+"/start", handlerWrapper(startHandler)) - http.HandleFunc(conf.Wide.Context+"/about", handlerWrapper(aboutHandler)) - http.HandleFunc(conf.Wide.Context+"/keyboard_shortcuts", handlerWrapper(keyboardShortcutsHandler)) + http.HandleFunc("/", handlerGzWrapper(indexHandler)) + http.HandleFunc("/start", handlerWrapper(startHandler)) + http.HandleFunc("/about", handlerWrapper(aboutHandler)) + http.HandleFunc("/keyboard_shortcuts", handlerWrapper(keyboardShortcutsHandler)) // static resources - http.Handle(conf.Wide.Context+"/static/", http.StripPrefix(conf.Wide.Context+"/static/", http.FileServer(http.Dir("static")))) + http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static")))) + http.Handle("/static/users/", http.StripPrefix("/static/", http.FileServer(http.Dir("C:\\Users\\DL882\\wide\\static\\")))) serveSingle("/favicon.ico", "./static/favicon.ico") - // workspaces - for _, user := range conf.Users { - http.Handle(conf.Wide.Context+"/workspace/"+user.Name+"/", - http.StripPrefix(conf.Wide.Context+"/workspace/"+user.Name+"/", http.FileServer(http.Dir(user.WorkspacePath())))) - } + // oauth + http.HandleFunc("/oauth/github", session.RedirectGitHubHandler) + http.HandleFunc("/oauth/github/callback", session.GithubCallbackHandler) // session - http.HandleFunc(conf.Wide.Context+"/session/ws", handlerWrapper(session.WSHandler)) - http.HandleFunc(conf.Wide.Context+"/session/save", handlerWrapper(session.SaveContentHandler)) + http.HandleFunc("/session/ws", handlerWrapper(session.WSHandler)) + http.HandleFunc("/session/save", handlerWrapper(session.SaveContentHandler)) // run - http.HandleFunc(conf.Wide.Context+"/build", handlerWrapper(output.BuildHandler)) - http.HandleFunc(conf.Wide.Context+"/run", handlerWrapper(output.RunHandler)) - http.HandleFunc(conf.Wide.Context+"/stop", handlerWrapper(output.StopHandler)) - http.HandleFunc(conf.Wide.Context+"/go/test", handlerWrapper(output.GoTestHandler)) - http.HandleFunc(conf.Wide.Context+"/go/vet", handlerWrapper(output.GoVetHandler)) - http.HandleFunc(conf.Wide.Context+"/go/get", handlerWrapper(output.GoGetHandler)) - http.HandleFunc(conf.Wide.Context+"/go/install", handlerWrapper(output.GoInstallHandler)) - http.HandleFunc(conf.Wide.Context+"/output/ws", handlerWrapper(output.WSHandler)) + http.HandleFunc("/build", handlerWrapper(output.BuildHandler)) + http.HandleFunc("/run", handlerWrapper(output.RunHandler)) + http.HandleFunc("/stop", handlerWrapper(output.StopHandler)) + http.HandleFunc("/go/test", handlerWrapper(output.GoTestHandler)) + http.HandleFunc("/go/vet", handlerWrapper(output.GoVetHandler)) + http.HandleFunc("/go/get", handlerWrapper(output.GoGetHandler)) + http.HandleFunc("/go/install", handlerWrapper(output.GoInstallHandler)) + http.HandleFunc("/output/ws", handlerWrapper(output.WSHandler)) // cross-compilation - http.HandleFunc(conf.Wide.Context+"/cross", handlerWrapper(output.CrossCompilationHandler)) + http.HandleFunc("/cross", handlerWrapper(output.CrossCompilationHandler)) // file tree - http.HandleFunc(conf.Wide.Context+"/files", handlerWrapper(file.GetFilesHandler)) - http.HandleFunc(conf.Wide.Context+"/file/refresh", handlerWrapper(file.RefreshDirectoryHandler)) - http.HandleFunc(conf.Wide.Context+"/file", handlerWrapper(file.GetFileHandler)) - http.HandleFunc(conf.Wide.Context+"/file/save", handlerWrapper(file.SaveFileHandler)) - http.HandleFunc(conf.Wide.Context+"/file/new", handlerWrapper(file.NewFileHandler)) - http.HandleFunc(conf.Wide.Context+"/file/remove", handlerWrapper(file.RemoveFileHandler)) - http.HandleFunc(conf.Wide.Context+"/file/rename", handlerWrapper(file.RenameFileHandler)) - http.HandleFunc(conf.Wide.Context+"/file/search/text", handlerWrapper(file.SearchTextHandler)) - http.HandleFunc(conf.Wide.Context+"/file/find/name", handlerWrapper(file.FindHandler)) + http.HandleFunc("/files", handlerWrapper(file.GetFilesHandler)) + http.HandleFunc("/file/refresh", handlerWrapper(file.RefreshDirectoryHandler)) + http.HandleFunc("/file", handlerWrapper(file.GetFileHandler)) + http.HandleFunc("/file/save", handlerWrapper(file.SaveFileHandler)) + http.HandleFunc("/file/new", handlerWrapper(file.NewFileHandler)) + http.HandleFunc("/file/remove", handlerWrapper(file.RemoveFileHandler)) + http.HandleFunc("/file/rename", handlerWrapper(file.RenameFileHandler)) + http.HandleFunc("/file/search/text", handlerWrapper(file.SearchTextHandler)) + http.HandleFunc("/file/find/name", handlerWrapper(file.FindHandler)) // outline - http.HandleFunc(conf.Wide.Context+"/outline", handlerWrapper(file.GetOutlineHandler)) + http.HandleFunc("/outline", handlerWrapper(file.GetOutlineHandler)) // file export/import - http.HandleFunc(conf.Wide.Context+"/file/zip/new", handlerWrapper(file.CreateZipHandler)) - http.HandleFunc(conf.Wide.Context+"/file/zip", handlerWrapper(file.GetZipHandler)) - http.HandleFunc(conf.Wide.Context+"/file/upload", handlerWrapper(file.UploadHandler)) - http.HandleFunc(conf.Wide.Context+"/file/decompress", handlerWrapper(file.DecompressHandler)) + http.HandleFunc("/file/zip/new", handlerWrapper(file.CreateZipHandler)) + http.HandleFunc("/file/zip", handlerWrapper(file.GetZipHandler)) + http.HandleFunc("/file/decompress", handlerWrapper(file.DecompressHandler)) // editor - http.HandleFunc(conf.Wide.Context+"/editor/ws", handlerWrapper(editor.WSHandler)) - http.HandleFunc(conf.Wide.Context+"/go/fmt", handlerWrapper(editor.GoFmtHandler)) - http.HandleFunc(conf.Wide.Context+"/autocomplete", handlerWrapper(editor.AutocompleteHandler)) - http.HandleFunc(conf.Wide.Context+"/exprinfo", handlerWrapper(editor.GetExprInfoHandler)) - http.HandleFunc(conf.Wide.Context+"/find/decl", handlerWrapper(editor.FindDeclarationHandler)) - http.HandleFunc(conf.Wide.Context+"/find/usages", handlerWrapper(editor.FindUsagesHandler)) - - // shell - // http.HandleFunc(conf.Wide.Context+"/shell/ws", handlerWrapper(shell.WSHandler)) - // http.HandleFunc(conf.Wide.Context+"/shell", handlerWrapper(shell.IndexHandler)) + http.HandleFunc("/editor/ws", handlerWrapper(editor.WSHandler)) + http.HandleFunc("/go/fmt", handlerWrapper(editor.GoFmtHandler)) + http.HandleFunc("/autocomplete", handlerWrapper(editor.AutocompleteHandler)) + http.HandleFunc("/exprinfo", handlerWrapper(editor.GetExprInfoHandler)) + http.HandleFunc("/find/decl", handlerWrapper(editor.FindDeclarationHandler)) + http.HandleFunc("/find/usages", handlerWrapper(editor.FindUsagesHandler)) // notification - http.HandleFunc(conf.Wide.Context+"/notification/ws", handlerWrapper(notification.WSHandler)) + http.HandleFunc("/notification/ws", handlerWrapper(notification.WSHandler)) // user - http.HandleFunc(conf.Wide.Context+"/login", handlerWrapper(session.LoginHandler)) - http.HandleFunc(conf.Wide.Context+"/logout", handlerWrapper(session.LogoutHandler)) - http.HandleFunc(conf.Wide.Context+"/signup", handlerWrapper(session.SignUpUserHandler)) - http.HandleFunc(conf.Wide.Context+"/preference", handlerWrapper(session.PreferenceHandler)) + http.HandleFunc("/logout", handlerWrapper(session.LogoutHandler)) + http.HandleFunc("/preference", handlerWrapper(session.PreferenceHandler)) // playground - http.HandleFunc(conf.Wide.Context+"/playground", handlerWrapper(playground.IndexHandler)) - http.HandleFunc(conf.Wide.Context+"/playground/", handlerWrapper(playground.IndexHandler)) - http.HandleFunc(conf.Wide.Context+"/playground/ws", handlerWrapper(playground.WSHandler)) - http.HandleFunc(conf.Wide.Context+"/playground/save", handlerWrapper(playground.SaveHandler)) - http.HandleFunc(conf.Wide.Context+"/playground/short-url", handlerWrapper(playground.ShortURLHandler)) - http.HandleFunc(conf.Wide.Context+"/playground/build", handlerWrapper(playground.BuildHandler)) - http.HandleFunc(conf.Wide.Context+"/playground/run", handlerWrapper(playground.RunHandler)) - http.HandleFunc(conf.Wide.Context+"/playground/stop", handlerWrapper(playground.StopHandler)) - http.HandleFunc(conf.Wide.Context+"/playground/autocomplete", handlerWrapper(playground.AutocompleteHandler)) + http.HandleFunc("/playground", handlerWrapper(playground.IndexHandler)) + http.HandleFunc("/playground/", handlerWrapper(playground.IndexHandler)) + http.HandleFunc("/playground/ws", handlerWrapper(playground.WSHandler)) + http.HandleFunc("/playground/save", handlerWrapper(playground.SaveHandler)) + http.HandleFunc("/playground/short-url", handlerWrapper(playground.ShortURLHandler)) + http.HandleFunc("/playground/build", handlerWrapper(playground.BuildHandler)) + http.HandleFunc("/playground/run", handlerWrapper(playground.RunHandler)) + http.HandleFunc("/playground/stop", handlerWrapper(playground.StopHandler)) + http.HandleFunc("/playground/autocomplete", handlerWrapper(playground.AutocompleteHandler)) - // git - http.HandleFunc(conf.Wide.Context+"/git/clone", handlerWrapper(git.CloneHandler)) + logger.Infof("Wide is running [%s]", conf.Wide.Server) - logger.Infof("Wide is running [%s]", conf.Wide.Server+conf.Wide.Context) - - err := http.ListenAndServe(conf.Wide.Server, nil) + listen := conf.Wide.Server[strings.Index(conf.Wide.Server, "://")+3:] + err := http.ListenAndServe(listen, nil) if err != nil { logger.Error(err) } @@ -195,51 +175,46 @@ func main() { // indexHandler handles request of Wide index. func indexHandler(w http.ResponseWriter, r *http.Request) { - if conf.Wide.Context+"/" != r.RequestURI { - http.Redirect(w, r, conf.Wide.Context+"/", http.StatusFound) + if "/" != r.RequestURI { + http.Redirect(w, r, "/", http.StatusFound) return } - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { - http.Redirect(w, r, conf.Wide.Context+"/login", http.StatusFound) + http.Redirect(w, r, "/login", http.StatusFound) return } - username := httpSession.Values["username"].(string) - if "playground" == username { // reserved user for Playground - http.Redirect(w, r, conf.Wide.Context+"/login", http.StatusFound) + uid := httpSession.Values["uid"].(string) + if "playground" == uid { // reserved user for Playground + http.Redirect(w, r, "/login", http.StatusFound) return } httpSession.Options.MaxAge = conf.Wide.HTTPSessionMaxAge - if "" != conf.Wide.Context { - httpSession.Options.Path = conf.Wide.Context - } httpSession.Save(r, w) - user := conf.GetUser(username) + user := conf.GetUser(uid) if nil == user { - logger.Warnf("Not found user [%s]", username) - - http.Redirect(w, r, conf.Wide.Context+"/login", http.StatusFound) + http.Redirect(w, r, "/login", http.StatusFound) return } locale := user.Locale - wideSessions := session.WideSessions.GetByUsername(username) + wideSessions := session.WideSessions.GetByUserId(uid) model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(locale), "locale": locale, - "username": username, "sid": session.WideSessions.GenId(), "latestSessionContent": user.LatestSessionContent, + "uid": uid, "sid": session.WideSessions.GenId(), "latestSessionContent": user.LatestSessionContent, "pathSeparator": conf.PathSeparator, "codeMirrorVer": conf.CodeMirrorVer, "user": user, "editorThemes": conf.GetEditorThemes(), "crossPlatforms": util.Go.GetCrossPlatforms()} - logger.Debugf("User [%s] has [%d] sessions", username, len(wideSessions)) + logger.Debugf("User [%s] has [%d] sessions", uid, len(wideSessions)) t, err := template.ParseFiles("views/index.html") if nil != err { @@ -277,22 +252,19 @@ func serveSingle(pattern string, filename string) { // startHandler handles request of start page. func startHandler(w http.ResponseWriter, r *http.Request) { - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { - http.Redirect(w, r, conf.Wide.Context+"/login", http.StatusFound) + http.Redirect(w, r, "/s", http.StatusFound) return } httpSession.Options.MaxAge = conf.Wide.HTTPSessionMaxAge - if "" != conf.Wide.Context { - httpSession.Options.Path = conf.Wide.Context - } httpSession.Save(r, w) - username := httpSession.Values["username"].(string) - locale := conf.GetUser(username).Locale - userWorkspace := conf.GetUserWorkspace(username) + uid := httpSession.Values["uid"].(string) + locale := conf.GetUser(uid).Locale + userWorkspace := conf.GetUserWorkspace(uid) sid := r.URL.Query()["sid"][0] wSession := session.WideSessions.Get(sid) @@ -301,7 +273,7 @@ func startHandler(w http.ResponseWriter, r *http.Request) { } model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(locale), "locale": locale, - "username": username, "workspace": userWorkspace, "ver": conf.WideVersion, "sid": sid} + "uid": uid, "workspace": userWorkspace, "ver": conf.WideVersion, "sid": sid} t, err := template.ParseFiles("views/start.html") @@ -317,21 +289,18 @@ func startHandler(w http.ResponseWriter, r *http.Request) { // keyboardShortcutsHandler handles request of keyboard shortcuts page. func keyboardShortcutsHandler(w http.ResponseWriter, r *http.Request) { - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { - http.Redirect(w, r, conf.Wide.Context+"/login", http.StatusFound) + http.Redirect(w, r, "/login", http.StatusFound) return } httpSession.Options.MaxAge = conf.Wide.HTTPSessionMaxAge - if "" != conf.Wide.Context { - httpSession.Options.Path = conf.Wide.Context - } httpSession.Save(r, w) - username := httpSession.Values["username"].(string) - locale := conf.GetUser(username).Locale + uid := httpSession.Values["uid"].(string) + locale := conf.GetUser(uid).Locale model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(locale), "locale": locale} @@ -349,21 +318,18 @@ func keyboardShortcutsHandler(w http.ResponseWriter, r *http.Request) { // aboutHandle handles request of about page. func aboutHandler(w http.ResponseWriter, r *http.Request) { - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { - http.Redirect(w, r, conf.Wide.Context+"/login", http.StatusFound) + http.Redirect(w, r, "/login", http.StatusFound) return } httpSession.Options.MaxAge = conf.Wide.HTTPSessionMaxAge - if "" != conf.Wide.Context { - httpSession.Options.Path = conf.Wide.Context - } httpSession.Save(r, w) - username := httpSession.Values["username"].(string) - locale := conf.GetUser(username).Locale + uid := httpSession.Values["uid"].(string) + locale := conf.GetUser(uid).Locale model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(locale), "locale": locale, "ver": conf.WideVersion, "goos": runtime.GOOS, "goarch": runtime.GOARCH, "gover": runtime.Version()} diff --git a/notification/notifications.go b/notification/notifications.go index 28362fb..580a10c 100644 --- a/notification/notifications.go +++ b/notification/notifications.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -62,9 +62,9 @@ func event2Notification(e *event.Event) { return } - httpSession, _ := session.HTTPSession.Get(wsChannel.Request, "wide-session") - username := httpSession.Values["username"].(string) - locale := conf.GetUser(username).Locale + httpSession, _ := session.HTTPSession.Get(wsChannel.Request, session.CookieName) + uid := httpSession.Values["uid"].(string) + locale := conf.GetUser(uid).Locale var notification *Notification diff --git a/output/build.go b/output/build.go index f4dcbf9..196b822 100644 --- a/output/build.go +++ b/output/build.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -38,14 +38,14 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) { result := util.NewResult() defer util.RetResult(w, r, result) - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) return } - username := httpSession.Values["username"].(string) - user := conf.GetUser(username) + uid := httpSession.Values["uid"].(string) + user := conf.GetUser(uid) locale := user.Locale var args map[string]interface{} @@ -61,7 +61,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) { filePath := args["file"].(string) - if util.Go.IsAPI(filePath) || !session.CanAccess(username, filePath) { + if util.Go.IsAPI(filePath) || !session.CanAccess(uid, filePath) { http.Error(w, "Forbidden", http.StatusForbidden) return @@ -95,13 +95,13 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) { } goBuildArgs := []string{} - goBuildArgs = append(goBuildArgs, "build") + goBuildArgs = append(goBuildArgs, "build", "-i") goBuildArgs = append(goBuildArgs, user.BuildArgs(runtime.GOOS)...) cmd := exec.Command("go", goBuildArgs...) cmd.Dir = curDir - setCmdEnv(cmd, username) + setCmdEnv(cmd, uid) executable := filepath.Base(curDir) + suffix executable = filepath.Join(curDir, executable) @@ -155,8 +155,6 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) { return } - // logger.Debugf("User [%s, %s] is building [id=%d, dir=%s]", username, sid, runningId, curDir) - channelRet["cmd"] = "build" channelRet["executable"] = executable @@ -188,6 +186,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) { err = wsChannel.WriteJSON(&channelRet) if nil != err { logger.Warn(err) + break } @@ -196,7 +195,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) { }() errReader := bufio.NewReader(stderr) - lines := []string{} + var lines []string for { wsChannel := session.OutputWS[sid] if nil == wsChannel { @@ -232,20 +231,6 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) { if nil == cmd.Wait() { channelRet["nextCmd"] = args["nextCmd"] channelRet["output"] = "" + i18n.Get(locale, "build-succ").(string) + "\n" - - go func() { // go install, for subsequent gocode lib-path - defer util.Recover() - - cmd := exec.Command("go", "install") - cmd.Dir = curDir - - setCmdEnv(cmd, username) - - out, _ := cmd.CombinedOutput() - if len(out) > 0 { - logger.Warn(string(out)) - } - }() } else { channelRet["output"] = "" + i18n.Get(locale, "build-error").(string) + "\n" diff --git a/output/cross.go b/output/cross.go index f6f5ae6..a667fd5 100644 --- a/output/cross.go +++ b/output/cross.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -37,14 +37,14 @@ func CrossCompilationHandler(w http.ResponseWriter, r *http.Request) { result := util.NewResult() defer util.RetResult(w, r, result) - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) return } - username := httpSession.Values["username"].(string) - locale := conf.GetUser(username).Locale + uid := httpSession.Values["uid"].(string) + locale := conf.GetUser(uid).Locale var args map[string]interface{} @@ -58,7 +58,7 @@ func CrossCompilationHandler(w http.ResponseWriter, r *http.Request) { sid := args["sid"].(string) filePath := args["path"].(string) - if util.Go.IsAPI(filePath) || !session.CanAccess(username, filePath) { + if util.Go.IsAPI(filePath) || !session.CanAccess(uid, filePath) { http.Error(w, "Forbidden", http.StatusForbidden) return @@ -75,7 +75,7 @@ func CrossCompilationHandler(w http.ResponseWriter, r *http.Request) { suffix = ".exe" } - user := conf.GetUser(username) + user := conf.GetUser(uid) goBuildArgs := []string{} goBuildArgs = append(goBuildArgs, "build") goBuildArgs = append(goBuildArgs, user.BuildArgs(goos)...) @@ -83,7 +83,7 @@ func CrossCompilationHandler(w http.ResponseWriter, r *http.Request) { cmd := exec.Command("go", goBuildArgs...) cmd.Dir = curDir - setCmdEnv(cmd, username) + setCmdEnv(cmd, uid) for i, env := range cmd.Env { if strings.HasPrefix(env, "GOOS=") { @@ -155,8 +155,6 @@ func CrossCompilationHandler(w http.ResponseWriter, r *http.Request) { defer util.Recover() defer cmd.Wait() - // logger.Debugf("User [%s, %s] is building [id=%d, dir=%s]", username, sid, runningId, curDir) - // read all buf, _ := ioutil.ReadAll(reader) @@ -235,8 +233,6 @@ func CrossCompilationHandler(w http.ResponseWriter, r *http.Request) { } if nil != session.OutputWS[sid] { - // logger.Debugf("User [%s, %s] 's build [id=%d, dir=%s] has done", username, sid, runningId, curDir) - wsChannel := session.OutputWS[sid] err := wsChannel.WriteJSON(&channelRet) if nil != err { diff --git a/output/get.go b/output/get.go index b5dd83c..660b1b9 100644 --- a/output/get.go +++ b/output/get.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -35,14 +35,14 @@ func GoGetHandler(w http.ResponseWriter, r *http.Request) { result := util.NewResult() defer util.RetResult(w, r, result) - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) return } - username := httpSession.Values["username"].(string) - locale := conf.GetUser(username).Locale + uid := httpSession.Values["uid"].(string) + locale := conf.GetUser(uid).Locale var args map[string]interface{} if err := json.NewDecoder(r.Body).Decode(&args); err != nil { @@ -60,7 +60,7 @@ func GoGetHandler(w http.ResponseWriter, r *http.Request) { cmd := exec.Command("go", "get") cmd.Dir = curDir - setCmdEnv(cmd, username) + setCmdEnv(cmd, uid) stdout, err := cmd.StdoutPipe() if nil != err { @@ -114,7 +114,7 @@ func GoGetHandler(w http.ResponseWriter, r *http.Request) { defer util.Recover() defer cmd.Wait() - logger.Debugf("User [%s, %s] is running [go get] [runningId=%d]", username, sid, runningId) + logger.Debugf("User [%s, %s] is running [go get] [runningId=%d]", uid, sid, runningId) channelRet := map[string]interface{}{} channelRet["cmd"] = "go get" @@ -123,11 +123,11 @@ func GoGetHandler(w http.ResponseWriter, r *http.Request) { buf, _ := ioutil.ReadAll(reader) if 0 != len(buf) { - logger.Debugf("User [%s, %s] 's [go get] [runningId=%d] has done (with error)", username, sid, runningId) + logger.Debugf("User [%s, %s] 's [go get] [runningId=%d] has done (with error)", uid, sid, runningId) channelRet["output"] = "" + i18n.Get(locale, "get-error").(string) + "\n" + string(buf) } else { - logger.Debugf("User [%s, %s] 's running [go get] [runningId=%d] has done", username, sid, runningId) + logger.Debugf("User [%s, %s] 's running [go get] [runningId=%d] has done", uid, sid, runningId) channelRet["output"] = "" + i18n.Get(locale, "get-succ").(string) + "\n" } diff --git a/output/install.go b/output/install.go index ba4311e..6bb53ae 100644 --- a/output/install.go +++ b/output/install.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -37,14 +37,14 @@ func GoInstallHandler(w http.ResponseWriter, r *http.Request) { result := util.NewResult() defer util.RetResult(w, r, result) - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) return } - username := httpSession.Values["username"].(string) - locale := conf.GetUser(username).Locale + uid := httpSession.Values["uid"].(string) + locale := conf.GetUser(uid).Locale var args map[string]interface{} @@ -63,7 +63,7 @@ func GoInstallHandler(w http.ResponseWriter, r *http.Request) { cmd := exec.Command("go", "install") cmd.Dir = curDir - setCmdEnv(cmd, username) + setCmdEnv(cmd, uid) logger.Debugf("go install %s", curDir) @@ -119,7 +119,7 @@ func GoInstallHandler(w http.ResponseWriter, r *http.Request) { defer util.Recover() defer cmd.Wait() - logger.Debugf("User [%s, %s] is running [go install] [id=%d, dir=%s]", username, sid, runningId, curDir) + logger.Debugf("User [%s, %s] is running [go install] [id=%d, dir=%s]", uid, sid, runningId, curDir) // read all buf, _ := ioutil.ReadAll(reader) @@ -183,7 +183,7 @@ func GoInstallHandler(w http.ResponseWriter, r *http.Request) { } if nil != session.OutputWS[sid] { - logger.Debugf("User [%s, %s] 's running [go install] [id=%d, dir=%s] has done", username, sid, runningId, curDir) + logger.Debugf("User [%s, %s] 's running [go install] [id=%d, dir=%s] has done", uid, sid, runningId, curDir) wsChannel := session.OutputWS[sid] err := wsChannel.WriteJSON(&channelRet) diff --git a/output/namespace.go b/output/namespace.go deleted file mode 100644 index e27e1f1..0000000 --- a/output/namespace.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build !linux - -package output - -import ( - "os/exec" -) - -func SetNamespace(cmd *exec.Cmd) { - // do nothing -} diff --git a/output/namespace_linux.go b/output/namespace_linux.go deleted file mode 100644 index dc3c800..0000000 --- a/output/namespace_linux.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package output - -import ( - "os/exec" - "syscall" -) - -func SetNamespace(cmd *exec.Cmd) { - // XXX: keep move with Go 1.4 and later's - - cmd.SysProcAttr = &syscall.SysProcAttr{} - //cmd.SysProcAttr.Cloneflags = syscall.CLONE_NEWUSER | syscall.CLONE_NEWNS | syscall.CLONE_NEWUTS | syscall.CLONE_NEWPID | syscall.CLONE_NEWIPC | syscall.CLONE_NEWNET - cmd.SysProcAttr.Cloneflags = syscall.CLONE_NEWUSER /*| syscall.CLONE_NEWNS*/ | syscall.CLONE_NEWUTS | syscall.CLONE_NEWPID | syscall.CLONE_NEWIPC /*| syscall.CLONE_NEWNET*/ - cmd.SysProcAttr.Credential = &syscall.Credential{ - Uid: 0, - Gid: 0, - } - - cmd.SysProcAttr.UidMappings = []syscall.SysProcIDMap{{ContainerID: 0, HostID: 1001, Size: 1}} - cmd.SysProcAttr.GidMappings = []syscall.SysProcIDMap{{ContainerID: 0, HostID: 1001, Size: 1}} -} diff --git a/output/outputs.go b/output/outputs.go index f41993f..e5c9a1d 100644 --- a/output/outputs.go +++ b/output/outputs.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -104,18 +104,27 @@ func parsePath(curDir, outputLine string) string { return tagStart + text + tagEnd + msgPart } -func setCmdEnv(cmd *exec.Cmd, username string) { - userWorkspace := conf.GetUserWorkspace(username) +func setCmdEnv(cmd *exec.Cmd, uid string) { + userWorkspace := conf.GetUserWorkspace(uid) + cache, err := os.UserCacheDir() + if nil != err { + logger.Warnf("Get user cache dir failed [" + err.Error() + "]") + cache = os.TempDir() + } cmd.Env = append(cmd.Env, "GOPATH="+userWorkspace, "GOOS="+runtime.GOOS, "GOARCH="+runtime.GOARCH, "GOROOT="+runtime.GOROOT(), + "GOCACHE="+cache, "PATH="+os.Getenv("PATH")) if util.OS.IsWindows() { // FIXME: for some weird issues on Windows, such as: The requested service provider could not be loaded or initialized. cmd.Env = append(cmd.Env, os.Environ()...) + } else { + // 编译链接时找不到依赖的动态库 https://github.com/b3log/wide/issues/352 + cmd.Env = append(cmd.Env, "LD_LIBRARY_PATH="+os.Getenv("LD_LIBRARY_PATH")) } } diff --git a/output/processes.go b/output/processes.go index d1490e2..6926c90 100644 --- a/output/processes.go +++ b/output/processes.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -86,7 +86,7 @@ func (procs *procs) Kill(wSession *session.WideSession, pid int) { for i, p := range userProcesses { if p.Pid == pid { if err := p.Kill(); nil != err { - logger.Errorf("Kill a process [pid=%d] of user [%s, %s] failed [error=%v]", pid, wSession.Username, sid, err) + logger.Errorf("Kill a process [pid=%d] of user [%s, %s] failed [error=%v]", pid, wSession.UserId, sid, err) } else { var newProcesses []*os.Process @@ -96,7 +96,7 @@ func (procs *procs) Kill(wSession *session.WideSession, pid int) { // bind process with wide session wSession.SetProcesses(newProcesses) - logger.Debugf("Killed a process [pid=%d] of user [%s, %s]", pid, wSession.Username, sid) + logger.Debugf("Killed a process [pid=%d] of user [%s, %s]", pid, wSession.UserId, sid) } return diff --git a/output/run.go b/output/run.go index b629ede..ca4194e 100644 --- a/output/run.go +++ b/output/run.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -22,24 +22,12 @@ import ( "os/exec" "path/filepath" "strings" - "time" "github.com/b3log/wide/conf" "github.com/b3log/wide/session" "github.com/b3log/wide/util" ) -const ( - outputBufMax = 1024 // 1024 string(rune) - outputTimeout = 100 // 100ms - outputCountMax = 30 // 30 reads -) - -type outputBuf struct { - content string - millisecond int64 -} - // RunHandler handles request of executing a binary file. func RunHandler(w http.ResponseWriter, r *http.Request) { result := util.NewResult() @@ -59,13 +47,15 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { } filePath := args["executable"].(string) - curDir := filepath.Dir(filePath) - - cmd := exec.Command(filePath) - cmd.Dir = curDir + var cmd *exec.Cmd if conf.Docker { - SetNamespace(cmd) + fileName := filepath.Base(filePath) + cmd = exec.Command("timeout", "5", "docker", "run", "--rm", "-v", filePath+":/"+fileName, conf.DockerImageGo, "/"+fileName) + } else { + cmd = exec.Command(filePath) + curDir := filepath.Dir(filePath) + cmd.Dir = curDir } stdout, err := cmd.StdoutPipe() @@ -87,24 +77,13 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { logger.Error(err) result.Succ = false } - wsChannel := session.OutputWS[sid] - channelRet := map[string]interface{}{} - if !result.Succ { - if nil != wsChannel { - channelRet["cmd"] = "run-done" - channelRet["output"] = "" - - err := wsChannel.WriteJSON(&channelRet) - if nil != err { - logger.Warn(err) - return - } - - wsChannel.Refresh() - } + channelRet["cmd"] = "run-done" + channelRet["output"] = "" + wsChannel.WriteJSON(&channelRet) + wsChannel.Refresh() return } @@ -114,148 +93,76 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { // add the process to user's process set Processes.Add(wSession, cmd.Process) - go func(runningId int) { - defer util.Recover() - defer cmd.Wait() - - logger.Debugf("User [%s, %s] is running [id=%d, file=%s]", wSession.Username, sid, runningId, filePath) - - // push once for front-end to get the 'run' state and pid + // push once for front-end to get the 'run' state and pid + if nil != wsChannel { + channelRet["cmd"] = "run" + channelRet["output"] = "" if nil != wsChannel { - channelRet["cmd"] = "run" - channelRet["output"] = "" - err := wsChannel.WriteJSON(&channelRet) - if nil != err { - logger.Warn(err) - return - } - + wsChannel.WriteJSON(&channelRet) wsChannel.Refresh() } + } + + go func(runningId int) { + defer util.Recover() + + logger.Debugf("User [%s, %s] is running [id=%d, file=%s]", wSession.UserId, sid, runningId, filePath) go func() { defer util.Recover() - buf := outputBuf{} - count := 0 - for { - wsChannel := session.OutputWS[sid] - if nil == wsChannel { - break - } - r, _, err := outReader.ReadRune() - count++ - if nil != err { - // remove the exited process from user's process set - Processes.Remove(wSession, cmd.Process) - - logger.Debugf("User [%s, %s] 's running [id=%d, file=%s] has done [stdout %v], ", - wSession.Username, sid, runningId, filePath, err) - - channelRet["cmd"] = "run-done" - channelRet["output"] = buf.content - err := wsChannel.WriteJSON(&channelRet) - if nil != err { - logger.Warn(err) - break - } - - wsChannel.Refresh() - break } oneRuneStr := string(r) oneRuneStr = strings.Replace(oneRuneStr, "<", "<", -1) oneRuneStr = strings.Replace(oneRuneStr, ">", ">", -1) - - buf.content += oneRuneStr - - now := time.Now().UnixNano() / int64(time.Millisecond) - - if 0 == buf.millisecond { - buf.millisecond = now - } - - flood := count > outputCountMax - - if "\n" == oneRuneStr && !flood { - channelRet["cmd"] = "run" - channelRet["output"] = buf.content - - buf = outputBuf{} // a new buffer - count = 0 // clear count - - err = wsChannel.WriteJSON(&channelRet) - if nil != err { - logger.Warn(err) - break - } - + channelRet["cmd"] = "run" + channelRet["output"] = oneRuneStr + wsChannel := session.OutputWS[sid] + if nil != wsChannel { + wsChannel.WriteJSON(&channelRet) wsChannel.Refresh() - - continue - } - - if now-outputTimeout >= buf.millisecond || len(buf.content) > outputBufMax { - channelRet["cmd"] = "run" - channelRet["output"] = buf.content - - buf = outputBuf{} // a new buffer - count = 0 // clear count - - err = wsChannel.WriteJSON(&channelRet) - if nil != err { - logger.Warn(err) - break - } - - wsChannel.Refresh() - - continue } } }() - buf := outputBuf{} for { r, _, err := errReader.ReadRune() - - wsChannel := session.OutputWS[sid] - if nil != err || nil == wsChannel { + if nil != err { break } oneRuneStr := string(r) oneRuneStr = strings.Replace(oneRuneStr, "<", "<", -1) oneRuneStr = strings.Replace(oneRuneStr, ">", ">", -1) - - buf.content += oneRuneStr - - now := time.Now().UnixNano() / int64(time.Millisecond) - - if 0 == buf.millisecond { - buf.millisecond = now - } - - if now-outputTimeout >= buf.millisecond || len(buf.content) > outputBufMax || oneRuneStr == "\n" { - channelRet["cmd"] = "run" - channelRet["output"] = "" + buf.content + "" - - buf = outputBuf{} // a new buffer - - err = wsChannel.WriteJSON(&channelRet) - if nil != err { - logger.Warn(err) - break - } - + channelRet["cmd"] = "run" + channelRet["output"] = "" + oneRuneStr + "" + wsChannel := session.OutputWS[sid] + if nil != wsChannel { + wsChannel.WriteJSON(&channelRet) wsChannel.Refresh() } } + + cmd.Wait() + + // remove the exited process from user's process set + Processes.Remove(wSession, cmd.Process) + + channelRet["cmd"] = "run-done" + if 124 == cmd.ProcessState.ExitCode() { + channelRet["output"] = "run program timeout in 5s\n" + } else { + channelRet["output"] = "\nrun program complete\n" + } + if nil != wsChannel { + wsChannel.WriteJSON(&channelRet) + wsChannel.Refresh() + } }(rand.Int()) } diff --git a/output/test.go b/output/test.go index 82f5516..0636aab 100644 --- a/output/test.go +++ b/output/test.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -35,14 +35,14 @@ func GoTestHandler(w http.ResponseWriter, r *http.Request) { result := util.NewResult() defer util.RetResult(w, r, result) - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) return } - username := httpSession.Values["username"].(string) - locale := conf.GetUser(username).Locale + uid := httpSession.Values["uid"].(string) + locale := conf.GetUser(uid).Locale var args map[string]interface{} @@ -61,7 +61,7 @@ func GoTestHandler(w http.ResponseWriter, r *http.Request) { cmd := exec.Command("go", "test", "-v") cmd.Dir = curDir - setCmdEnv(cmd, username) + setCmdEnv(cmd, uid) stdout, err := cmd.StdoutPipe() if nil != err { @@ -114,7 +114,7 @@ func GoTestHandler(w http.ResponseWriter, r *http.Request) { go func(runningId int) { defer util.Recover() - logger.Debugf("User [%s, %s] is running [go test] [runningId=%d]", username, sid, runningId) + logger.Debugf("User [%s, %s] is running [go test] [runningId=%d]", uid, sid, runningId) channelRet := map[string]interface{}{} channelRet["cmd"] = "go test" @@ -126,11 +126,11 @@ func GoTestHandler(w http.ResponseWriter, r *http.Request) { cmd.Wait() if !cmd.ProcessState.Success() { - logger.Debugf("User [%s, %s] 's running [go test] [runningId=%d] has done (with error)", username, sid, runningId) + logger.Debugf("User [%s, %s] 's running [go test] [runningId=%d] has done (with error)", uid, sid, runningId) channelRet["output"] = "" + i18n.Get(locale, "test-error").(string) + "\n" + string(buf) } else { - logger.Debugf("User [%s, %s] 's running [go test] [runningId=%d] has done", username, sid, runningId) + logger.Debugf("User [%s, %s] 's running [go test] [runningId=%d] has done", uid, sid, runningId) channelRet["output"] = "" + i18n.Get(locale, "test-succ").(string) + "\n" + string(buf) } diff --git a/output/vet.go b/output/vet.go index 537930f..2b67b37 100644 --- a/output/vet.go +++ b/output/vet.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -35,14 +35,14 @@ func GoVetHandler(w http.ResponseWriter, r *http.Request) { result := util.NewResult() defer util.RetResult(w, r, result) - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) return } - username := httpSession.Values["username"].(string) - locale := conf.GetUser(username).Locale + uid := httpSession.Values["uid"].(string) + locale := conf.GetUser(uid).Locale var args map[string]interface{} @@ -61,7 +61,7 @@ func GoVetHandler(w http.ResponseWriter, r *http.Request) { cmd := exec.Command("go", "vet", ".") cmd.Dir = curDir - setCmdEnv(cmd, username) + setCmdEnv(cmd, uid) stdout, err := cmd.StdoutPipe() if nil != err { @@ -114,7 +114,7 @@ func GoVetHandler(w http.ResponseWriter, r *http.Request) { go func(runningId int) { defer util.Recover() - logger.Debugf("User [%s, %s] is running [go vet] [runningId=%d]", username, sid, runningId) + logger.Debugf("User [%s, %s] is running [go vet] [runningId=%d]", uid, sid, runningId) channelRet := map[string]interface{}{} channelRet["cmd"] = "go vet" @@ -126,11 +126,11 @@ func GoVetHandler(w http.ResponseWriter, r *http.Request) { cmd.Wait() if !cmd.ProcessState.Success() { - logger.Debugf("User [%s, %s] 's running [go vet] [runningId=%d] has done (with error)", username, sid, runningId) + logger.Debugf("User [%s, %s] 's running [go vet] [runningId=%d] has done (with error)", uid, sid, runningId) channelRet["output"] = "" + i18n.Get(locale, "vet-error").(string) + "\n" + string(buf) } else { - logger.Debugf("User [%s, %s] 's running [go vet] [runningId=%d] has done", username, sid, runningId) + logger.Debugf("User [%s, %s] 's running [go vet] [runningId=%d] has done", uid, sid, runningId) channelRet["output"] = "" + i18n.Get(locale, "vet-succ").(string) + "\n" + string(buf) } diff --git a/package.json b/package.json index 906099f..91098ae 100644 --- a/package.json +++ b/package.json @@ -12,22 +12,25 @@ }, "license": "Apache License", "private": true, - "author": "Daniel (http://88250.b3log.org) & Vanessa (http://vanessa.b3log.org)", + "author": "Daniel (http://88250.b3log.org) & Vanessa (http://vanessa.b3log.org)", "maintainers": [ { "name": "Daniel", - "email": "dl88250@gmail.com" + "email": "d@b3log.org" }, { "name": "Vanessa", - "email": "lly219@gmail.com" + "email": "v@b3log.org" } ], + "scripts": { + "build": "gulp" + }, "devDependencies": { - "gulp": "^3.9.1", + "gulp": "^4.0.2", "gulp-concat": "^2.6.1", "gulp-minify-css": "^1.2.4", "gulp-sourcemaps": "^2.6.0", - "gulp-uglify": "^2.1.2" + "gulp-uglify": "^3.0.1" } } diff --git a/playground/autocomplete.go b/playground/autocomplete.go index 55b2c71..81d5af0 100644 --- a/playground/autocomplete.go +++ b/playground/autocomplete.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -37,7 +37,7 @@ func AutocompleteHandler(w http.ResponseWriter, r *http.Request) { return } - session, _ := session.HTTPSession.Get(r, "wide-session") + session, _ := session.HTTPSession.Get(r, session.CookieName) if session.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) diff --git a/playground/build.go b/playground/build.go index 6332fe9..a2bfba5 100644 --- a/playground/build.go +++ b/playground/build.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -32,7 +32,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) { result := util.NewResult() defer util.RetResult(w, r, result) - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) @@ -48,7 +48,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) { } fileName := args["fileName"].(string) - filePath := filepath.Clean(conf.Wide.Playground + "/" + fileName) + filePath := filepath.Clean(conf.Wide.Data + "/playground/" + fileName) suffix := "" if util.OS.IsWindows() { @@ -58,7 +58,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) { data := map[string]interface{}{} result.Data = &data - executable := filepath.Clean(conf.Wide.Playground + "/" + strings.Replace(fileName, ".go", suffix, -1)) + executable := filepath.Clean(conf.Wide.Data + "/playground/" + strings.Replace(fileName, ".go", suffix, -1)) cmd := exec.Command("go", "build", "-o", executable, filePath) out, err := cmd.CombinedOutput() diff --git a/playground/file.go b/playground/file.go index 7f65ad2..50e9b57 100644 --- a/playground/file.go +++ b/playground/file.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -35,7 +35,7 @@ func SaveHandler(w http.ResponseWriter, r *http.Request) { result := util.NewResult() defer util.RetResult(w, r, result) - session, _ := session.HTTPSession.Get(r, "wide-session") + session, _ := session.HTTPSession.Get(r, session.CookieName) if session.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) @@ -85,7 +85,7 @@ func SaveHandler(w http.ResponseWriter, r *http.Request) { data["fileName"] = fileName // Step3. write file - filePath := filepath.Clean(conf.Wide.Playground + "/" + fileName) + filePath := filepath.Clean(conf.Wide.Data + "/playground" + fileName) fout, err := os.Create(filePath) fout.WriteString(code) if err := fout.Close(); nil != err { @@ -101,7 +101,7 @@ func ShortURLHandler(w http.ResponseWriter, r *http.Request) { result := util.NewResult() defer util.RetResult(w, r, result) - session, _ := session.HTTPSession.Get(r, "wide-session") + session, _ := session.HTTPSession.Get(r, session.CookieName) if session.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) diff --git a/playground/playgrounds.go b/playground/playgrounds.go index 1752226..8191bdf 100644 --- a/playground/playgrounds.go +++ b/playground/playgrounds.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -40,19 +40,16 @@ var logger = log.NewLogger(os.Stdout) // IndexHandler handles request of Playground index. func IndexHandler(w http.ResponseWriter, r *http.Request) { // create a HTTP session - httpSession, _ := session.HTTPSession.Get(r, "wide-session") + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { httpSession.Values["id"] = strconv.Itoa(rand.Int()) - httpSession.Values["username"] = "playground" + httpSession.Values["uid"] = "playground" } httpSession.Options.MaxAge = conf.Wide.HTTPSessionMaxAge - if "" != conf.Wide.Context { - httpSession.Options.Path = conf.Wide.Context - } httpSession.Save(r, w) - username := httpSession.Values["username"].(string) + uid := httpSession.Values["uid"].(string) locale := conf.Wide.Locale @@ -62,7 +59,7 @@ func IndexHandler(w http.ResponseWriter, r *http.Request) { if strings.HasSuffix(r.URL.Path, ".go") { fileNameArg := r.URL.Path[len("/playground/"):] - filePath := filepath.Clean(conf.Wide.Playground + "/" + fileNameArg) + filePath := filepath.Clean(conf.Wide.Data+ "/playground" + fileNameArg) bytes, err := ioutil.ReadFile(filePath) if nil != err { @@ -92,9 +89,9 @@ func IndexHandler(w http.ResponseWriter, r *http.Request) { "code": template.HTML(code), "ver": conf.WideVersion, "year": time.Now().Year(), "embed": embed, "disqus": disqus, "fileName": fileName} - wideSessions := session.WideSessions.GetByUsername(username) + wideSessions := session.WideSessions.GetByUserId(uid) - logger.Debugf("User [%s] has [%d] sessions", username, len(wideSessions)) + logger.Debugf("User [%s] has [%d] sessions", uid, len(wideSessions)) t, err := template.ParseFiles("views/playground/index.html") diff --git a/playground/run.go b/playground/run.go index 8ef3694..d9b630e 100644 --- a/playground/run.go +++ b/playground/run.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -20,7 +20,8 @@ import ( "math/rand" "net/http" "os/exec" - "time" + "path/filepath" + "strings" "github.com/b3log/wide/conf" "github.com/b3log/wide/output" @@ -28,17 +29,6 @@ import ( "github.com/b3log/wide/util" ) -const ( - outputBufMax = 1024 // 1024 string(rune) - outputTimeout = 100 // 100ms - outputCountMax = 30 // 30 reads -) - -type outputBuf struct { - content string - millisecond int64 -} - // RunHandler handles request of executing a binary file. func RunHandler(w http.ResponseWriter, r *http.Request) { result := util.NewResult() @@ -59,10 +49,14 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { filePath := args["executable"].(string) - cmd := exec.Command(filePath) - + var cmd *exec.Cmd if conf.Docker { - output.SetNamespace(cmd) + fileName := filepath.Base(filePath) + cmd = exec.Command("timeout", "5", "docker", "run", "--rm", "-v", filePath+":/"+fileName, conf.DockerImageGo, "/"+fileName) + } else { + cmd = exec.Command(filePath) + curDir := filepath.Dir(filePath) + cmd.Dir = curDir } stdout, err := cmd.StdoutPipe() @@ -86,22 +80,12 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { } wsChannel := session.PlaygroundWS[sid] - channelRet := map[string]interface{}{} - if !result.Succ { - if nil != wsChannel { - channelRet["cmd"] = "run-done" - channelRet["output"] = "" - - err := wsChannel.WriteJSON(&channelRet) - if nil != err { - logger.Warn(err) - return - } - - wsChannel.Refresh() - } + channelRet["cmd"] = "run-done" + channelRet["output"] = "" + wsChannel.WriteJSON(&channelRet) + wsChannel.Refresh() return } @@ -111,143 +95,74 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { // add the process to user's process set output.Processes.Add(wSession, cmd.Process) - go func(runningId int) { - defer util.Recover() - defer cmd.Wait() - - logger.Debugf("User [%s, %s] is running [id=%d, file=%s]", wSession.Username, sid, runningId, filePath) - - // push once for front-end to get the 'run' state and pid + // push once for front-end to get the 'run' state and pid + if nil != wsChannel { + channelRet["cmd"] = "run" + channelRet["output"] = "" if nil != wsChannel { - channelRet["cmd"] = "run" - channelRet["output"] = "" - err := wsChannel.WriteJSON(&channelRet) - if nil != err { - logger.Warn(err) - return - } - + wsChannel.WriteJSON(&channelRet) wsChannel.Refresh() } + } + + go func(runningId int) { + defer util.Recover() + + logger.Debugf("User [%s, %s] is running [id=%d, file=%s]", wSession.UserId, sid, runningId, filePath) go func() { defer util.Recover() - buf := outputBuf{} - count := 0 - for { - wsChannel := session.PlaygroundWS[sid] - if nil == wsChannel { - break - } - r, _, err := outReader.ReadRune() - count++ - if nil != err { - // remove the exited process from user process set - output.Processes.Remove(wSession, cmd.Process) - - logger.Debugf("User [%s, %s] 's running [id=%d, file=%s] has done [stdout %v], ", wSession.Username, sid, runningId, filePath, err) - - channelRet["cmd"] = "run-done" - channelRet["output"] = buf.content - err := wsChannel.WriteJSON(&channelRet) - if nil != err { - logger.Warn(err) - break - } - - wsChannel.Refresh() - break } oneRuneStr := string(r) - - buf.content += oneRuneStr - - now := time.Now().UnixNano() / int64(time.Millisecond) - - if 0 == buf.millisecond { - buf.millisecond = now - } - - flood := count > outputCountMax - - if "\n" == oneRuneStr && !flood { - channelRet["cmd"] = "run" - channelRet["output"] = buf.content - - buf = outputBuf{} // a new buffer - count = 0 // clear count - - err = wsChannel.WriteJSON(&channelRet) - if nil != err { - logger.Warn(err) - break - } - + oneRuneStr = strings.Replace(oneRuneStr, "<", "<", -1) + oneRuneStr = strings.Replace(oneRuneStr, ">", ">", -1) + channelRet["cmd"] = "run" + channelRet["output"] = oneRuneStr + wsChannel := session.PlaygroundWS[sid] + if nil != wsChannel { + wsChannel.WriteJSON(&channelRet) wsChannel.Refresh() - - continue - } - - if now-outputTimeout >= buf.millisecond || len(buf.content) > outputBufMax { - channelRet["cmd"] = "run" - channelRet["output"] = buf.content - - buf = outputBuf{} // a new buffer - count = 0 // clear count - - err = wsChannel.WriteJSON(&channelRet) - if nil != err { - logger.Warn(err) - break - } - - wsChannel.Refresh() - - continue } } }() - buf := outputBuf{} for { r, _, err := errReader.ReadRune() - - wsChannel := session.PlaygroundWS[sid] - if nil != err || nil == wsChannel { + if nil != err { break } oneRuneStr := string(r) - - buf.content += oneRuneStr - - now := time.Now().UnixNano() / int64(time.Millisecond) - - if 0 == buf.millisecond { - buf.millisecond = now - } - - if now-outputTimeout >= buf.millisecond || len(buf.content) > outputBufMax || oneRuneStr == "\n" { - channelRet["cmd"] = "run" - channelRet["output"] = buf.content - - buf = outputBuf{} // a new buffer - - err = wsChannel.WriteJSON(&channelRet) - if nil != err { - logger.Warn(err) - break - } - + oneRuneStr = strings.Replace(oneRuneStr, "<", "<", -1) + oneRuneStr = strings.Replace(oneRuneStr, ">", ">", -1) + channelRet["cmd"] = "run" + channelRet["output"] = oneRuneStr + wsChannel := session.PlaygroundWS[sid] + if nil != wsChannel { + wsChannel.WriteJSON(&channelRet) wsChannel.Refresh() } } + + cmd.Wait() + + // remove the exited process from user's process set + output.Processes.Remove(wSession, cmd.Process) + + channelRet["cmd"] = "run-done" + if 124 == cmd.ProcessState.ExitCode() { + channelRet["output"] = "\nrun program timeout in 5s\n" + } + if nil != wsChannel { + wsChannel.WriteJSON(&channelRet) + wsChannel.Refresh() + } }(rand.Int()) } diff --git a/scm/git/clone.go b/scm/git/clone.go deleted file mode 100644 index c949bdc..0000000 --- a/scm/git/clone.go +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package git - -import ( - "bufio" - "encoding/json" - "io" - "io/ioutil" - "math/rand" - "net/http" - "os" - "os/exec" - - "github.com/b3log/wide/conf" - "github.com/b3log/wide/i18n" - "github.com/b3log/wide/log" - "github.com/b3log/wide/session" - "github.com/b3log/wide/util" -) - -// Logger. -var logger = log.NewLogger(os.Stdout) - -// Clone handles request of git clone. -func CloneHandler(w http.ResponseWriter, r *http.Request) { - result := util.NewResult() - defer util.RetResult(w, r, result) - - httpSession, _ := session.HTTPSession.Get(r, "wide-session") - if httpSession.IsNew { - http.Error(w, "Forbidden", http.StatusForbidden) - - return - } - username := httpSession.Values["username"].(string) - locale := conf.GetUser(username).Locale - - var args map[string]interface{} - if err := json.NewDecoder(r.Body).Decode(&args); err != nil { - logger.Error(err) - result.Succ = false - - return - } - - sid := args["sid"].(string) - path := args["path"].(string) - repository := args["repository"].(string) - - cmd := exec.Command("git", "clone", repository) - cmd.Dir = path - - stdout, err := cmd.StdoutPipe() - if nil != err { - logger.Error(err) - result.Succ = false - - return - } - - stderr, err := cmd.StderrPipe() - if nil != err { - logger.Error(err) - result.Succ = false - - return - } - - if !result.Succ { - return - } - - channelRet := map[string]interface{}{} - - if nil != session.OutputWS[sid] { - // display "START [git clone]" in front-end browser - - channelRet["output"] = "" + i18n.Get(locale, "start-git_clone").(string) + "\n" - channelRet["cmd"] = "start-git_clone" - - wsChannel := session.OutputWS[sid] - - err := wsChannel.WriteJSON(&channelRet) - if nil != err { - logger.Warn(err) - return - } - - wsChannel.Refresh() - } - - reader := bufio.NewReader(io.MultiReader(stdout, stderr)) - - if err := cmd.Start(); nil != err { - logger.Error(err) - result.Succ = false - - return - } - - go func(runningId int) { - defer util.Recover() - defer cmd.Wait() - - logger.Debugf("User [%s, %s] is running [git clone] [runningId=%d]", username, sid, runningId) - - channelRet := map[string]interface{}{} - channelRet["cmd"] = "git clone" - - // read all - buf, err := ioutil.ReadAll(reader) - if nil != err { - logger.Warn(err) - - // TODO: handle clone error - } - - logger.Debugf("User [%s, %s] 's running [git clone] [runningId=%d] has done: %s", username, sid, runningId, string(buf)) - - channelRet["output"] = "" + i18n.Get(locale, "git_clone-done").(string) + "\n" - - if nil != session.OutputWS[sid] { - wsChannel := session.OutputWS[sid] - - err := wsChannel.WriteJSON(&channelRet) - if nil != err { - logger.Warn(err) - } - - wsChannel.Refresh() - } - }(rand.Int()) -} diff --git a/session/oauthctl.go b/session/oauthctl.go new file mode 100644 index 0000000..9e4bad3 --- /dev/null +++ b/session/oauthctl.go @@ -0,0 +1,272 @@ +// Copyright (c) 2014-2019, b3log.org & hacpai.com +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package session + +import ( + "crypto/tls" + "math/rand" + "net/http" + "os" + "path/filepath" + "strconv" + "strings" + "time" + + "github.com/b3log/wide/conf" + "github.com/b3log/wide/util" + "github.com/parnurzeal/gorequest" +) + +var states = map[string]string{} + +// RedirectGitHubHandler redirects to GitHub auth page. +func RedirectGitHubHandler(w http.ResponseWriter, r *http.Request) { + requestResult := util.NewResult() + _, _, errs := gorequest.New().TLSClientConfig(&tls.Config{InsecureSkipVerify: true}). + Get("https://hacpai.com/oauth/wide/client"). + Set("user-agent", conf.UserAgent).Timeout(10 * time.Second).EndStruct(requestResult) + if nil != errs { + logger.Errorf("Get oauth client id failed: %+v", errs) + http.Error(w, "Get oauth info failed", http.StatusInternalServerError) + + return + } + if 0 != requestResult.Code { + logger.Errorf("get oauth client id failed [code=%d, msg=%s]", requestResult.Code, requestResult.Msg) + http.Error(w, "Get oauth info failed", http.StatusNotFound) + + return + } + data := requestResult.Data.(map[string]interface{}) + clientId := data["clientId"].(string) + loginAuthURL := data["loginAuthURL"].(string) + + referer := r.URL.Query().Get("referer") + if "" == referer || !strings.Contains(referer, "://") { + referer = conf.Wide.Server + referer + } + if strings.HasSuffix(referer, "/") { + referer = referer[:len(referer)-1] + } + referer += "__1" + state := util.Rand.String(16) + referer + states[state] = state + path := loginAuthURL + "?client_id=" + clientId + "&state=" + state + "&scope=public_repo,read:user,user:follow" + + logger.Infof("redirect to github [" + path + "]") + + http.Redirect(w, r, path, http.StatusSeeOther) +} + +func GithubCallbackHandler(w http.ResponseWriter, r *http.Request) { + logger.Infof("Github callback [" + r.URL.String() + "]") + + state := r.URL.Query().Get("state") + if _, exist := states[state]; !exist { + http.Error(w, "Get state param failed", http.StatusBadRequest) + + return + } + delete(states, state) + + referer := state[16:] + if strings.Contains(referer, "__0") || strings.Contains(referer, "__1") { + referer = referer[:len(referer)-len("__0")] + } + accessToken := r.URL.Query().Get("ak") + githubUser := GitHubUserInfo(accessToken) + if nil == githubUser { + logger.Warnf("Can not get user info with token [" + accessToken + "]") + http.Error(w, "Get user info failed", http.StatusUnauthorized) + + return + } + + githubId := githubUser["userId"].(string) + userName := githubUser["userName"].(string) + avatar := githubUser["userAvatarURL"].(string) + + result := util.NewResult() + defer util.RetResult(w, r, result) + + user := conf.GetUser(githubId) + if nil == user { + msg := addUser(githubId, userName, avatar) + if userCreated != msg { + result.Succ = false + result.Msg = msg + + return + } + } + + // create a HTTP session + httpSession, _ := HTTPSession.Get(r, CookieName) + httpSession.Values["uid"] = githubId + httpSession.Values["id"] = strconv.Itoa(rand.Int()) + httpSession.Options.MaxAge = conf.Wide.HTTPSessionMaxAge + httpSession.Save(r, w) + + logger.Debugf("Created a HTTP session [%s] for user [%s]", httpSession.Values["id"].(string), githubId) +} + +// GitHubUserInfo returns GitHub user info specified by the given access token. +func GitHubUserInfo(accessToken string) (ret map[string]interface{}) { + result := map[string]interface{}{} + response, data, errors := gorequest.New().TLSClientConfig(&tls.Config{InsecureSkipVerify: true}). + Get("https://hacpai.com/github/user?ak="+accessToken).Timeout(7*time.Second). + Set("User-Agent", conf.UserAgent).EndStruct(&result) + if nil != errors || http.StatusOK != response.StatusCode { + logger.Errorf("Get github user info failed: %+v, %s", errors, data) + + return nil + } + + if 0 != result["sc"].(float64) { + return nil + } + + return result["data"].(map[string]interface{}) +} + +// LogoutHandler handles request of user logout (exit). +func LogoutHandler(w http.ResponseWriter, r *http.Request) { + result := util.NewResult() + defer util.RetResult(w, r, result) + + httpSession, _ := HTTPSession.Get(r, CookieName) + + httpSession.Options.MaxAge = -1 + httpSession.Save(r, w) +} + +// addUser add a user with the specified user id, username and avatar. +// +// 1. create the user's workspace +// 2. generate 'Hello, 世界' demo code in the workspace (a console version and a HTTP version) +// 3. update the user customized configurations, such as style.css +// 4. serve files of the user's workspace via HTTP +// +// Note: user [playground] is a reserved mock user +func addUser(userId, userName, userAvatar string) string { + if "playground" == userId { + return userExists + } + + addUserMutex.Lock() + defer addUserMutex.Unlock() + + for _, user := range conf.Users { + if strings.ToLower(user.Id) == strings.ToLower(userId) { + return userExists + } + } + + workspace := filepath.Join(conf.Wide.Data, "workspaces", userId) + newUser := conf.NewUser(userId, userName, userAvatar, workspace) + conf.Users = append(conf.Users, newUser) + if !newUser.Save() { + return userCreateError + } + + conf.CreateWorkspaceDir(workspace) + helloWorld(workspace) + conf.UpdateCustomizedConf(userId) + + logger.Infof("Created a user [%s]", userId) + + return userCreated +} + +// helloWorld generates the 'Hello, 世界' source code. +// 1. src/hello/main.go +// 2. src/web/main.go +func helloWorld(workspace string) { + consoleHello(workspace) + webHello(workspace) +} + +func consoleHello(workspace string) { + dir := workspace + conf.PathSeparator + "src" + conf.PathSeparator + "hello" + if err := os.MkdirAll(dir, 0755); nil != err { + logger.Error(err) + + return + } + + fout, err := os.Create(dir + conf.PathSeparator + "main.go") + if nil != err { + logger.Error(err) + + return + } + + fout.WriteString(conf.HelloWorld) + + fout.Close() +} + +func webHello(workspace string) { + dir := workspace + conf.PathSeparator + "src" + conf.PathSeparator + "web" + if err := os.MkdirAll(dir, 0755); nil != err { + logger.Error(err) + + return + } + + fout, err := os.Create(dir + conf.PathSeparator + "main.go") + if nil != err { + logger.Error(err) + + return + } + + code := `package main + +import ( + "fmt" + "math/rand" + "net/http" + "strconv" + "time" +) + +func main() { + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + w.Write([]byte("Hello, 世界")) + }) + + port := getPort() + + // you may need to change the address + fmt.Println("Open https://wide.b3log.org:" + port + " in your browser to see the result") + + if err := http.ListenAndServe(":"+port, nil); nil != err { + fmt.Println(err) + } +} + +func getPort() string { + rand.Seed(time.Now().UnixNano()) + + return strconv.Itoa(7000 + rand.Intn(8000-7000)) +} + +` + + fout.WriteString(code) + + fout.Close() +} diff --git a/session/sessions.go b/session/sessions.go index d7d51bd..1e2c416 100644 --- a/session/sessions.go +++ b/session/sessions.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -31,6 +31,7 @@ import ( "path/filepath" "sort" "strconv" + "strings" "sync" "time" @@ -38,14 +39,16 @@ import ( "github.com/b3log/wide/event" "github.com/b3log/wide/log" "github.com/b3log/wide/util" - "github.com/go-fsnotify/fsnotify" + "github.com/fsnotify/fsnotify" "github.com/gorilla/sessions" "github.com/gorilla/websocket" ) const ( sessionStateActive = iota - sessionStateClosed // (not used so far) + sessionStateClosed // (not used so far) + + CookieName = "wide-sess" ) // Logger. @@ -74,7 +77,7 @@ var HTTPSession = sessions.NewCookieStore([]byte("BEYOND")) // WideSession represents a session associated with a browser tab. type WideSession struct { ID string // id - Username string // username + UserId string // user id HTTPSession *sessions.Session // HTTP session related Processes []*os.Process // process set EventQueue *event.UserEventQueue // event queue @@ -110,7 +113,7 @@ func FixedTimeRelease() { for _, s := range WideSessions { if s.Updated.Before(threshold) { - logger.Debugf("Removes a invalid session [%s], user [%s]", s.ID, s.Username) + logger.Debugf("Removes a invalid session [%s], user [%s]", s.ID, s.UserId) WideSessions.Remove(s.ID) } @@ -121,7 +124,7 @@ func FixedTimeRelease() { // Online user statistic report. type userReport struct { - username string + userId string sessionCnt int processCnt int updated time.Time @@ -129,7 +132,7 @@ type userReport struct { // report returns a online user statistics in pretty format. func (u *userReport) report() string { - return "[" + u.username + "] has [" + strconv.Itoa(u.sessionCnt) + "] sessions and [" + strconv.Itoa(u.processCnt) + + return "[" + u.userId + "] has [" + strconv.Itoa(u.sessionCnt) + "] sessions and [" + strconv.Itoa(u.processCnt) + "] running processes, latest activity [" + u.updated.Format("2006-01-02 15:04:05") + "]" } @@ -138,7 +141,7 @@ func FixedTimeReport() { go func() { defer util.Recover() - for _ = range time.Tick(10 * time.Minute) { + for _ = range time.Tick(10*time.Minute) { users := userReports{} processSum := 0 @@ -146,7 +149,7 @@ func FixedTimeReport() { processCnt := len(s.Processes) processSum += processCnt - if report, exists := contains(users, s.Username); exists { + if report, exists := contains(users, s.UserId); exists { if s.Updated.After(report.updated) { report.updated = s.Updated } @@ -154,7 +157,7 @@ func FixedTimeReport() { report.sessionCnt++ report.processCnt += processCnt } else { - users = append(users, &userReport{username: s.Username, sessionCnt: 1, processCnt: processCnt, updated: s.Updated}) + users = append(users, &userReport{userId: s.UserId, sessionCnt: 1, processCnt: processCnt, updated: s.Updated}) } } @@ -173,9 +176,9 @@ func FixedTimeReport() { }() } -func contains(reports []*userReport, username string) (*userReport, bool) { +func contains(reports []*userReport, userId string) (*userReport, bool) { for _, ur := range reports { - if username == ur.username { + if userId == ur.userId { return ur, true } } @@ -219,7 +222,7 @@ func WSHandler(w http.ResponseWriter, r *http.Request) { wSession := WideSessions.Get(sid) if nil == wSession { - httpSession, _ := HTTPSession.Get(r, "wide-session") + httpSession, _ := HTTPSession.Get(r, CookieName) if httpSession.IsNew { return @@ -230,7 +233,7 @@ func WSHandler(w http.ResponseWriter, r *http.Request) { wSession = WideSessions.new(httpSession, sid) - logger.Tracef("Created a wide session [%s] for websocket reconnecting, user [%s]", sid, wSession.Username) + logger.Tracef("Created a wide session [%s] for websocket reconnecting, user [%s]", sid, wSession.UserId) } logger.Tracef("Open a new [Session Channel] with session [%s], %d", sid, len(SessionWS)) @@ -262,7 +265,7 @@ func WSHandler(w http.ResponseWriter, r *http.Request) { for { if err := wsChan.ReadJSON(&input); err != nil { - logger.Tracef("[Session Channel] of session [%s] disconnected, releases all resources with it, user [%s]", sid, wSession.Username) + logger.Tracef("[Session Channel] of session [%s] disconnected, releases all resources with it, user [%s]", sid, wSession.UserId) return } @@ -306,7 +309,7 @@ func SaveContentHandler(w http.ResponseWriter, r *http.Request) { wSession.Content = args.LatestSessionContent for _, user := range conf.Users { - if user.Name == wSession.Username { + if user.Id == wSession.UserId { // update the variable in-memory, session.FixedTimeSave() function will persist it periodically user.LatestSessionContent = wSession.Content @@ -375,9 +378,9 @@ func (sessions *wSessions) Remove(sid string) { // kill processes for _, p := range s.Processes { if err := p.Kill(); nil != err { - logger.Errorf("Can't kill process [%d] of session [%s], user [%s]", p.Pid, sid, s.Username) + logger.Errorf("Can't kill process [%d] of session [%s], user [%s]", p.Pid, sid, s.UserId) } else { - logger.Debugf("Killed a process [%d] of session [%s], user [%s]", p.Pid, sid, s.Username) + logger.Debugf("Killed a process [%d] of session [%s], user [%s]", p.Pid, sid, s.UserId) } } @@ -409,12 +412,12 @@ func (sessions *wSessions) Remove(sid string) { cnt := 0 // count wide sessions associated with HTTP session for _, ses := range *sessions { - if ses.Username == s.Username { + if ses.UserId == s.UserId { cnt++ } } - logger.Debugf("Removed a session [%s] of user [%s], it has [%d] sessions currently", sid, s.Username, cnt) + logger.Debugf("Removed a session [%s] of user [%s], it has [%d] sessions currently", sid, s.UserId, cnt) return } @@ -422,14 +425,14 @@ func (sessions *wSessions) Remove(sid string) { } // GetByUsername gets wide sessions. -func (sessions *wSessions) GetByUsername(username string) []*WideSession { +func (sessions *wSessions) GetByUserId(userId string) []*WideSession { mutex.Lock() defer mutex.Unlock() ret := []*WideSession{} for _, s := range *sessions { - if s.Username == username { + if s.UserId == userId { ret = append(ret, s) } } @@ -442,12 +445,12 @@ func (sessions *wSessions) new(httpSession *sessions.Session, sid string) *WideS mutex.Lock() defer mutex.Unlock() - username := httpSession.Values["username"].(string) + uid := httpSession.Values["uid"].(string) now := time.Now() ret := &WideSession{ ID: sid, - Username: username, + UserId: uid, HTTPSession: httpSession, EventQueue: nil, State: sessionStateActive, @@ -458,7 +461,7 @@ func (sessions *wSessions) new(httpSession *sessions.Session, sid string) *WideS *sessions = append(*sessions, ret) - if "playground" == username { + if "playground" == uid { return ret } @@ -479,7 +482,7 @@ func (sessions *wSessions) new(httpSession *sessions.Session, sid string) *WideS for { ch := SessionWS[sid] if nil == ch { - return // release this gorutine + return // release this goroutine } select { @@ -505,17 +508,13 @@ func (sessions *wSessions) new(httpSession *sessions.Session, sid string) *WideS } } - cmd := map[string]interface{}{"path": path, "dir": dir, - "cmd": "create-file", "type": fileType} + cmd := map[string]interface{}{"path": path, "dir": dir, "cmd": "create-file", "type": fileType} ch.WriteJSON(&cmd) } else if event.Op&fsnotify.Remove == fsnotify.Remove { - cmd := map[string]interface{}{"path": path, "dir": dir, - "cmd": "remove-file", "type": ""} + cmd := map[string]interface{}{"path": path, "dir": dir, "cmd": "remove-file", "type": ""} ch.WriteJSON(&cmd) - } else if event.Op&fsnotify.Rename == fsnotify.Rename { - cmd := map[string]interface{}{"path": path, "dir": dir, - "cmd": "rename-file", "type": ""} + cmd := map[string]interface{}{"path": path, "dir": dir, "cmd": "rename-file", "type": ""} ch.WriteJSON(&cmd) } case err := <-watcher.Errors: @@ -529,10 +528,10 @@ func (sessions *wSessions) new(httpSession *sessions.Session, sid string) *WideS go func() { defer util.Recover() - workspaces := filepath.SplitList(conf.GetUserWorkspace(username)) + workspaces := filepath.SplitList(conf.GetUserWorkspace(uid)) for _, workspace := range workspaces { filepath.Walk(filepath.Join(workspace, "src"), func(dirPath string, f os.FileInfo, err error) error { - if ".git" == f.Name() { // XXX: discard other unconcered dirs + if strings.HasPrefix(f.Name(), ".") || "node_modules" == f.Name() || "vendor" == f.Name() { return filepath.SkipDir } diff --git a/session/users.go b/session/users.go index 7203331..5522a0f 100644 --- a/session/users.go +++ b/session/users.go @@ -1,10 +1,10 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com +// Copyright (c) 2014-2019, b3log.org & hacpai.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -15,15 +15,10 @@ package session import ( - "crypto/md5" - "encoding/hex" "encoding/json" - "math/rand" "net/http" - "os" "path/filepath" "runtime" - "strconv" "strings" "sync" "text/template" @@ -38,10 +33,8 @@ const ( // TODO: i18n userExists = "user exists" - emailExists = "email exists" userCreated = "user created" userCreateError = "user create error" - notAllowRegister = "not allow register" ) // Exclusive lock for adding user. @@ -49,22 +42,19 @@ var addUserMutex sync.Mutex // PreferenceHandler handles request of preference page. func PreferenceHandler(w http.ResponseWriter, r *http.Request) { - httpSession, _ := HTTPSession.Get(r, "wide-session") + httpSession, _ := HTTPSession.Get(r, CookieName) if httpSession.IsNew { - http.Redirect(w, r, conf.Wide.Context+"/login", http.StatusFound) + http.Redirect(w, r, "/login", http.StatusFound) return } httpSession.Options.MaxAge = conf.Wide.HTTPSessionMaxAge - if "" != conf.Wide.Context { - httpSession.Options.Path = conf.Wide.Context - } httpSession.Save(r, w) - username := httpSession.Values["username"].(string) - user := conf.GetUser(username) + uid := httpSession.Values["uid"].(string) + user := conf.GetUser(uid) if "GET" == r.Method { tmpLinux := user.GoBuildArgsForLinux @@ -116,8 +106,6 @@ func PreferenceHandler(w http.ResponseWriter, r *http.Request) { Keymap string Workspace string Username string - Password string - Email string Locale string Theme string EditorFontFamily string @@ -143,14 +131,6 @@ func PreferenceHandler(w http.ResponseWriter, r *http.Request) { user.Keymap = args.Keymap // XXX: disallow change workspace at present // user.Workspace = args.Workspace - if user.Password != args.Password { - user.Password = conf.Salt(args.Password, user.Salt) - } - user.Email = args.Email - - hash := md5.New() - hash.Write([]byte(user.Email)) - user.Gravatar = hex.EncodeToString(hash.Sum(nil)) user.Locale = args.Locale user.Theme = args.Theme @@ -160,7 +140,7 @@ func PreferenceHandler(w http.ResponseWriter, r *http.Request) { user.Editor.Theme = args.EditorTheme user.Editor.TabSize = args.EditorTabSize - conf.UpdateCustomizedConf(username) + conf.UpdateCustomizedConf(uid) now := time.Now().UnixNano() user.Lived = now @@ -169,137 +149,6 @@ func PreferenceHandler(w http.ResponseWriter, r *http.Request) { result.Succ = user.Save() } -// LoginHandler handles request of user login. -func LoginHandler(w http.ResponseWriter, r *http.Request) { - if "GET" == r.Method { - // show the login page - - model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(conf.Wide.Locale), - "locale": conf.Wide.Locale, "ver": conf.WideVersion, "year": time.Now().Year()} - - t, err := template.ParseFiles("views/login.html") - - if nil != err { - logger.Error(err) - http.Error(w, err.Error(), 500) - - return - } - - t.Execute(w, model) - - return - } - - // non-GET request as login request - result := util.NewResult() - defer util.RetResult(w, r, result) - - args := struct { - Username string - Password string - }{} - - args.Username = r.FormValue("username") - args.Password = r.FormValue("password") - - result.Succ = false - for _, user := range conf.Users { - if user.Name == args.Username && user.Password == conf.Salt(args.Password, user.Salt) { - result.Succ = true - - break - } - } - - if !result.Succ { - return - } - - // create a HTTP session - httpSession, _ := HTTPSession.Get(r, "wide-session") - httpSession.Values["username"] = args.Username - httpSession.Values["id"] = strconv.Itoa(rand.Int()) - httpSession.Options.MaxAge = conf.Wide.HTTPSessionMaxAge - if "" != conf.Wide.Context { - httpSession.Options.Path = conf.Wide.Context - } - httpSession.Save(r, w) - - logger.Debugf("Created a HTTP session [%s] for user [%s]", httpSession.Values["id"].(string), args.Username) -} - -// LogoutHandler handles request of user logout (exit). -func LogoutHandler(w http.ResponseWriter, r *http.Request) { - result := util.NewResult() - defer util.RetResult(w, r, result) - - httpSession, _ := HTTPSession.Get(r, "wide-session") - - httpSession.Options.MaxAge = -1 - httpSession.Save(r, w) -} - -// SignUpUserHandler handles request of registering user. -func SignUpUserHandler(w http.ResponseWriter, r *http.Request) { - if "GET" == r.Method { - // show the user sign up page - - model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(conf.Wide.Locale), - "locale": conf.Wide.Locale, "ver": conf.WideVersion, "dir": conf.Wide.UsersWorkspaces, - "pathSeparator": conf.PathSeparator, "year": time.Now().Year()} - - t, err := template.ParseFiles("views/sign_up.html") - - if nil != err { - logger.Error(err) - http.Error(w, err.Error(), 500) - - return - } - - t.Execute(w, model) - - return - } - - // non-GET request as add user request - - result := util.NewResult() - defer util.RetResult(w, r, result) - - var args map[string]interface{} - - if err := json.NewDecoder(r.Body).Decode(&args); err != nil { - logger.Error(err) - result.Succ = false - - return - } - - username := args["username"].(string) - password := args["password"].(string) - email := args["email"].(string) - - msg := addUser(username, password, email) - if userCreated != msg { - result.Succ = false - result.Msg = msg - - return - } - - // create a HTTP session - httpSession, _ := HTTPSession.Get(r, "wide-session") - httpSession.Values["username"] = username - httpSession.Values["id"] = strconv.Itoa(rand.Int()) - httpSession.Options.MaxAge = conf.Wide.HTTPSessionMaxAge - if "" != conf.Wide.Context { - httpSession.Options.Path = conf.Wide.Context - } - httpSession.Save(r, w) -} - // FixedTimeSave saves online users' configurations periodically (1 minute). // // Main goal of this function is to save user session content, for restoring session content while user open Wide next time. @@ -313,11 +162,11 @@ func FixedTimeSave() { }() } -// CanAccess determines whether the user specified by the given username can access the specified path. -func CanAccess(username, path string) bool { +// CanAccess determines whether the user specified by the given user id can access the specified path. +func CanAccess(userId, path string) bool { path = filepath.FromSlash(path) - userWorkspace := conf.GetUserWorkspace(username) + userWorkspace := conf.GetUserWorkspace(userId) workspaces := filepath.SplitList(userWorkspace) for _, workspace := range workspaces { @@ -342,20 +191,20 @@ func SaveOnlineUsers() { func getOnlineUsers() []*conf.User { ret := []*conf.User{} - usernames := map[string]string{} // distinct username + uids := map[string]string{} // distinct uid for _, s := range WideSessions { - usernames[s.Username] = s.Username + uids[s.UserId] = s.UserId } - for _, username := range usernames { - u := conf.GetUser(username) + for _, uid := range uids { + u := conf.GetUser(uid) - if "playground" == username { // user [playground] is a reserved mock user + if "playground" == uid { // user [playground] is a reserved mock user continue } if nil == u { - logger.Warnf("Not found user [%s]", username) + logger.Warnf("Not found user [%s]", uid) continue } @@ -365,135 +214,3 @@ func getOnlineUsers() []*conf.User { return ret } - -// addUser add a user with the specified username, password and email. -// -// 1. create the user's workspace -// 2. generate 'Hello, 世界' demo code in the workspace (a console version and a HTTP version) -// 3. update the user customized configurations, such as style.css -// 4. serve files of the user's workspace via HTTP -// -// Note: user [playground] is a reserved mock user -func addUser(username, password, email string) string { - if !conf.Wide.AllowRegister { - return notAllowRegister - } - - if "playground" == username { - return userExists - } - - addUserMutex.Lock() - defer addUserMutex.Unlock() - - for _, user := range conf.Users { - if strings.ToLower(user.Name) == strings.ToLower(username) { - return userExists - } - - if strings.ToLower(user.Email) == strings.ToLower(email) { - return emailExists - } - } - - workspace := filepath.Join(conf.Wide.UsersWorkspaces, username) - - newUser := conf.NewUser(username, password, email, workspace) - conf.Users = append(conf.Users, newUser) - - if !newUser.Save() { - return userCreateError - } - - conf.CreateWorkspaceDir(workspace) - helloWorld(workspace) - conf.UpdateCustomizedConf(username) - - http.Handle("/workspace/"+username+"/", - http.StripPrefix("/workspace/"+username+"/", http.FileServer(http.Dir(newUser.WorkspacePath())))) - - logger.Infof("Created a user [%s]", username) - - return userCreated -} - -// helloWorld generates the 'Hello, 世界' source code. -// 1. src/hello/main.go -// 2. src/web/main.go -func helloWorld(workspace string) { - consoleHello(workspace) - webHello(workspace) -} - -func consoleHello(workspace string) { - dir := workspace + conf.PathSeparator + "src" + conf.PathSeparator + "hello" - if err := os.MkdirAll(dir, 0755); nil != err { - logger.Error(err) - - return - } - - fout, err := os.Create(dir + conf.PathSeparator + "main.go") - if nil != err { - logger.Error(err) - - return - } - - fout.WriteString(conf.HelloWorld) - - fout.Close() -} - -func webHello(workspace string) { - dir := workspace + conf.PathSeparator + "src" + conf.PathSeparator + "web" - if err := os.MkdirAll(dir, 0755); nil != err { - logger.Error(err) - - return - } - - fout, err := os.Create(dir + conf.PathSeparator + "main.go") - if nil != err { - logger.Error(err) - - return - } - - code := `package main - -import ( - "fmt" - "math/rand" - "net/http" - "strconv" - "time" -) - -func main() { - http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("Hello, 世界")) - }) - - port := getPort() - - // you may need to change the address - fmt.Println("Open http://wide.b3log.org:" + port + " in your browser to see the result") - - if err := http.ListenAndServe(":"+port, nil); nil != err { - fmt.Println(err) - } -} - -func getPort() string { - rand.Seed(time.Now().UnixNano()) - - return strconv.Itoa(7000 + rand.Intn(8000-7000)) -} - -` - - fout.WriteString(code) - - fout.Close() -} diff --git a/shell/shells.go b/shell/shells.go deleted file mode 100644 index 3fcb0d7..0000000 --- a/shell/shells.go +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) 2014-2017, b3log.org & hacpai.com -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package shell include shell related mainipulations. -package shell - -import ( - "html/template" - "net/http" - "os" - "os/exec" - "runtime" - "strings" - "time" - - "github.com/b3log/wide/conf" - "github.com/b3log/wide/i18n" - "github.com/b3log/wide/log" - "github.com/b3log/wide/session" - "github.com/b3log/wide/util" - "github.com/gorilla/websocket" -) - -// Shell channel. -// -// > -var ShellWS = map[string]*util.WSChannel{} - -// Logger. -var logger = log.NewLogger(os.Stdout) - -// IndexHandler handles request of Shell index. -func IndexHandler(w http.ResponseWriter, r *http.Request) { - httpSession, _ := session.HTTPSession.Get(r, "wide-session") - if httpSession.IsNew { - http.Redirect(w, r, conf.Wide.Context+"/login", http.StatusFound) - - return - } - - httpSession.Options.MaxAge = conf.Wide.HTTPSessionMaxAge - if "" != conf.Wide.Context { - httpSession.Options.Path = conf.Wide.Context - } - httpSession.Save(r, w) - - username := httpSession.Values["username"].(string) - locale := conf.GetUser(username).Locale - - model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(locale), "locale": locale, - "sid": session.WideSessions.GenId()} - - wideSessions := session.WideSessions.GetByUsername(username) - - logger.Tracef("User [%s] has [%d] sessions", username, len(wideSessions)) - - t, err := template.ParseFiles("views/shell.html") - - if nil != err { - logger.Error(err) - http.Error(w, err.Error(), 500) - - return - } - - t.Execute(w, model) -} - -// WSHandler handles request of creating Shell channel. -func WSHandler(w http.ResponseWriter, r *http.Request) { - httpSession, _ := session.HTTPSession.Get(r, "wide-session") - if httpSession.IsNew { - http.Error(w, "Forbidden", http.StatusForbidden) - - return - } - username := httpSession.Values["username"].(string) - - sid := r.URL.Query()["sid"][0] - - conn, _ := websocket.Upgrade(w, r, nil, 1024, 1024) - wsChan := util.WSChannel{Sid: sid, Conn: conn, Request: r, Time: time.Now()} - - ret := map[string]interface{}{"output": "Shell initialized", "cmd": "init-shell"} - err := wsChan.WriteJSON(&ret) - if nil != err { - return - } - - ShellWS[sid] = &wsChan - - logger.Debugf("Open a new [Shell] with session [%s], %d", sid, len(ShellWS)) - - input := map[string]interface{}{} - - for { - if err := wsChan.ReadJSON(&input); err != nil { - logger.Error("Shell WS ERROR: " + err.Error()) - - return - } - - inputCmd := input["cmd"].(string) - - cmds := strings.Split(inputCmd, "|") - commands := []*exec.Cmd{} - for _, cmdWithArgs := range cmds { - cmdWithArgs = strings.TrimSpace(cmdWithArgs) - cmdWithArgs := strings.Split(cmdWithArgs, " ") - args := []string{} - if len(cmdWithArgs) > 1 { - args = cmdWithArgs[1:] - } - - cmd := exec.Command(cmdWithArgs[0], args...) - commands = append(commands, cmd) - } - - output := "" - if !strings.Contains(inputCmd, "clear") { - output = pipeCommands(username, commands...) - } - - ret = map[string]interface{}{"output": output, "cmd": "shell-output"} - - if err := wsChan.WriteJSON(&ret); err != nil { - logger.Error("Shell WS ERROR: " + err.Error()) - return - } - - wsChan.Refresh() - } -} - -func pipeCommands(username string, commands ...*exec.Cmd) string { - for i, command := range commands[:len(commands)-1] { - setCmdEnv(command, username) - - stdout, err := command.StdoutPipe() - if nil != err { - return err.Error() - } - - command.Start() - - commands[i+1].Stdin = stdout - } - - last := commands[len(commands)-1] - setCmdEnv(last, username) - - out, err := last.CombinedOutput() - - // release resources - for _, command := range commands[:len(commands)-1] { - command.Wait() - } - - if err != nil { - return err.Error() - } - - return string(out) -} - -func setCmdEnv(cmd *exec.Cmd, username string) { - userWorkspace := conf.GetUserWorkspace(username) - - cmd.Env = append(cmd.Env, - "TERM="+os.Getenv("TERM"), - "GOPATH="+userWorkspace, - "GOOS="+runtime.GOOS, - "GOARCH="+runtime.GOARCH, - "GOROOT="+runtime.GOROOT(), - "PATH="+os.Getenv("PATH")) - - cmd.Dir = userWorkspace -} diff --git a/static/css/about.css b/static/css/about.css index f9d3608..02f2540 100644 --- a/static/css/about.css +++ b/static/css/about.css @@ -1,11 +1,11 @@ /* - * Copyright (c) 2014-2017, b3log.org & hacpai.com + * Copyright (c) 2014-2019, b3log.org & hacpai.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/static/css/base.css b/static/css/base.css index ae899e8..688ded1 100644 --- a/static/css/base.css +++ b/static/css/base.css @@ -1,11 +1,11 @@ /* - * Copyright (c) 2014-2017, b3log.org & hacpai.com + * Copyright (c) 2014-2019, b3log.org & hacpai.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -18,7 +18,7 @@ * themes for base. * * @author Liyuan Li - * @version 0.1.0.0, Dec 6, 2015 + * @version 0.2.0.0, Oct 5, 2018 */ /* start reset & function */ ::-webkit-scrollbar { @@ -140,18 +140,24 @@ button { /* start icon */ @font-face { font-family: 'icomoon'; - src:url('fonts/icomoon.eot?35cb2z'); - src:url('fonts/icomoon.eot?#iefix35cb2z') format('embedded-opentype'), - url('fonts/icomoon.woff?35cb2z') format('woff'), - url('fonts/icomoon.ttf?35cb2z') format('truetype'), - url('fonts/icomoon.svg?35cb2z#icomoon') format('svg'); + src: url('fonts/icomoon.eot?lqk80d'); + src: url('fonts/icomoon.eot?lqk80d#iefix') format('embedded-opentype'), + url('fonts/icomoon.ttf?lqk80d') format('truetype'), + url('fonts/icomoon.woff?lqk80d') format('woff'), + url('fonts/icomoon.svg?lqk80d#icomoon') format('svg'); font-weight: normal; font-style: normal; } -.font-ico, -[class^="ico-"] { - font-family: 'icomoon'; +[class^="ico-"], [class*=" ico-"] { + /* use !important to prevent issues with browser extensions that change fonts */ + font-family: 'icomoon' !important; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + /* Better Font Rendering =========== */ -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; @@ -160,177 +166,143 @@ button { line-height: 20px; } -.ico-book:before { - content: "\e623"; +.ico-qqz:before { + content: "\e900"; } - -.ico-price:before { - content: "\e616"; -} - -.ico-start:before { - content: "\e9d7"; -} - -.ico-share:before { - content: "\e61f"; -} - -.ico-github:before { - content: "\f00a"; -} - -.ico-git:before { - content: "\e624"; -} - -.ico-tencent:before { - content: "\e622"; -} - -.ico-weibo:before { - content: "\e621"; -} - -.ico-googleplus:before { - content: "\e61a"; -} - -.ico-twitter:before { - content: "\e61c"; -} - -.ico-email:before { - content: "\e619"; -} - -.ico-facebook:before { - content: "\e61b"; -} - -.ico-moveup:before { - content: "\f148"; -} - -.ico-movedown:before { - content: "\f149"; -} - -.ico-keyboard:before { - content: "\f11c"; -} - -.ico-findfiles:before { - content: "\e603"; -} - .ico-find:before { content: "\e602"; } - +.ico-findfiles:before { + content: "\e603"; +} .ico-editor:before { content: "\e604"; } - -.ico-tree:before { - content: "\e600"; -} - -.ico-build:before { - content: "\e601"; -} - .ico-notification:before { content: "\e607"; } - +.ico-price:before { + content: "\e616"; +} .ico-report:before { content: "\e605"; } - -.ico-comment:before { - content: "\e620"; -} - -.ico-goline:before { - content: "\e61e"; -} - -.ico-info:before { - content: "\e61d"; -} - .ico-signup:before { content: "\e606"; } - -.ico-signout:before { - content: "\e618"; +.ico-git:before { + content: "\e624"; } - -.ico-redo:before { - content: "\e615"; +.ico-book:before { + content: "\e623"; } - -.ico-undo:before { - content: "\e60e"; +.ico-start:before { + content: "\e9d7"; + text-shadow: 0 0 rgba(0, 0, 0, 0.4); } - -.ico-about:before { - content: "\e60d"; +.ico-tree:before { + content: "\e600"; } - -.ico-import:before { - content: "\f0ee"; +.ico-build:before { + content: "\e601"; } - .ico-export:before { content: "\f0ed"; } - -.ico-refresh:before { - content: "\f021"; +.ico-import:before { + content: "\f0ee"; } - -.ico-remove:before { - content: "\e60b"; +.ico-keyboard:before { + content: "\f11c"; } - -.ico-save:before { - content: "\f0c7"; +.ico-moveup:before { + content: "\f148"; +} +.ico-movedown:before { + content: "\f149"; +} +.ico-weibo:before { + content: "\e621"; +} +.ico-uniE608:before { + content: "\e608"; } - .ico-max:before { content: "\e609"; } - -.ico-format:before { - content: "\e612"; +.ico-remove:before { + content: "\e60b"; } - .ico-buildrun:before { content: "\e60c"; } - +.ico-about:before { + content: "\e60d"; +} +.ico-undo:before { + content: "\e60e"; +} .ico-stop:before { content: "\e60f"; } - +.ico-close:before { + content: "\e611"; + text-shadow: 0 0 rgba(0, 0, 0, 0.4); +} +.ico-format:before { + content: "\e612"; +} .ico-restore:before { content: "\e613"; } - .toolbars .ico-restore:before { content: "\e60a"; } - .ico-min:before { content: "\e614"; position: absolute; right: 5px; } - -.ico-close:before { - content: "\e611"; +.ico-redo:before { + content: "\e615"; +} +.ico-uniE617:before { + content: "\e617"; +} +.ico-signout:before { + content: "\e618"; +} +.ico-email:before { + content: "\e619"; +} +.ico-googleplus:before { + content: "\e61a"; +} +.ico-facebook:before { + content: "\e61b"; +} +.ico-twitter:before { + content: "\e61c"; +} +.ico-info:before { + content: "\e61d"; +} +.ico-goline:before { + content: "\e61e"; +} +.ico-share:before { + content: "\e61f"; +} +.ico-comment:before { + content: "\e620"; +} +.ico-github:before { + content: "\f00a"; +} +.ico-refresh:before { + content: "\f021"; +} +.ico-save:before { + content: "\f0c7"; } /* end ico */ \ No newline at end of file diff --git a/static/css/dialog.css b/static/css/dialog.css index ad7fc7d..9dc60b8 100644 --- a/static/css/dialog.css +++ b/static/css/dialog.css @@ -1,11 +1,11 @@ /* - * Copyright (c) 2014-2017, b3log.org & hacpai.com + * Copyright (c) 2014-2019, b3log.org & hacpai.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -17,7 +17,7 @@ /** * dialig style * - * @author Liyuan Li + * @author Liyuan Li * @version 0.0.0.6, Jun 3, 2012 */ diff --git a/static/css/fonts/icomoon.eot b/static/css/fonts/icomoon.eot old mode 100644 new mode 100755 index 1f4beeb..c3041a8 Binary files a/static/css/fonts/icomoon.eot and b/static/css/fonts/icomoon.eot differ diff --git a/static/css/fonts/icomoon.svg b/static/css/fonts/icomoon.svg old mode 100644 new mode 100755 index 4f9ccfd..cb63d86 --- a/static/css/fonts/icomoon.svg +++ b/static/css/fonts/icomoon.svg @@ -6,52 +6,50 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/static/css/fonts/icomoon.ttf b/static/css/fonts/icomoon.ttf old mode 100644 new mode 100755 index 306c022..bc975cf Binary files a/static/css/fonts/icomoon.ttf and b/static/css/fonts/icomoon.ttf differ diff --git a/static/css/fonts/icomoon.woff b/static/css/fonts/icomoon.woff old mode 100644 new mode 100755 index 0e5942d..a289699 Binary files a/static/css/fonts/icomoon.woff and b/static/css/fonts/icomoon.woff differ diff --git a/static/css/playground.css b/static/css/playground.css index 03672dd..3e884a5 100644 --- a/static/css/playground.css +++ b/static/css/playground.css @@ -1,11 +1,11 @@ /* - * Copyright (c) 2014-2017, b3log.org & hacpai.com + * Copyright (c) 2014-2019, b3log.org & hacpai.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/static/css/shell.css b/static/css/shell.css index f1c079a..1a72eba 100644 --- a/static/css/shell.css +++ b/static/css/shell.css @@ -1,11 +1,11 @@ /* - * Copyright (c) 2014-2017, b3log.org & hacpai.com + * Copyright (c) 2014-2019, b3log.org & hacpai.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/static/css/side.css b/static/css/side.css index bdfd61f..924a153 100644 --- a/static/css/side.css +++ b/static/css/side.css @@ -1,11 +1,11 @@ /* - * Copyright (c) 2014-2017, b3log.org & hacpai.com + * Copyright (c) 2014-2019, b3log.org & hacpai.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/static/css/sign.css b/static/css/sign.css index f7452d0..678861b 100644 --- a/static/css/sign.css +++ b/static/css/sign.css @@ -1,11 +1,11 @@ /* - * Copyright (c) 2014-2017, b3log.org & hacpai.com + * Copyright (c) 2014-2019, b3log.org & hacpai.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/static/css/start.css b/static/css/start.css index d6deceb..2029aa9 100644 --- a/static/css/start.css +++ b/static/css/start.css @@ -1,11 +1,11 @@ /* - * Copyright (c) 2014-2017, b3log.org & hacpai.com + * Copyright (c) 2014-2019, b3log.org & hacpai.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/static/css/themes/dark.css b/static/css/themes/dark.css index 49ac534..7946143 100644 --- a/static/css/themes/dark.css +++ b/static/css/themes/dark.css @@ -1,11 +1,11 @@ /* - * Copyright (c) 2014-2017, b3log.org & hacpai.com + * Copyright (c) 2014-2019, b3log.org & hacpai.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/static/css/themes/default.css b/static/css/themes/default.css index ed66a62..b0c9864 100644 --- a/static/css/themes/default.css +++ b/static/css/themes/default.css @@ -1,11 +1,11 @@ /* - * Copyright (c) 2014-2017, b3log.org & hacpai.com + * Copyright (c) 2014-2019, b3log.org & hacpai.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/static/css/wide.css b/static/css/wide.css index dd72a43..50acb37 100644 --- a/static/css/wide.css +++ b/static/css/wide.css @@ -1,11 +1,11 @@ /* - * Copyright (c) 2014-2017, b3log.org & hacpai.com + * Copyright (c) 2014-2019, b3log.org & hacpai.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/static/css/wide.min.css b/static/css/wide.min.css index add073a..459cc83 100644 --- a/static/css/wide.min.css +++ b/static/css/wide.min.css @@ -1,5 +1,5 @@ .dialog-close-icon,.dialog-close-icon:hover{text-decoration:none}.dialog-background{height:100%;left:0;opacity:.3;position:absolute;top:0;width:100%;filter:alpha(opacity=30);display:none;background-color:#000;z-index:99}.dialog-panel{position:absolute;z-index:100;display:none;-moz-user-select:none;user-select:none;box-shadow:0 2px 10px 1px #000}.dialog-title{float:left;line-height:22px;margin-left:3px;font-weight:700}.dialog-header-bg{height:23px;background-color:#bbb;cursor:move;width:100%}.dialog-close-icon{float:right;margin:3px}.dialog-main>div{width:100%}.dialog-footer{padding:10px;text-align:right}#dialogCloseEditor button,.dialog-footer button{margin:0 5px}#dialogAlert,#dialogRemoveConfirm,.dialog-form,.dialog-prompt{padding:10px 15px 0;overflow:hidden}.dialog-main input,.dialog-main select{width:100%;margin:2px auto}#dialogGoFilePrompt>ul{position:relative;height:260px;overflow:auto;margin-top:5px;background-color:#FFF;border:1px solid #919191}#dialogPreference{margin:10px}#dialogPreference .tabs-panel{padding:10px}#dialogPreference .preference{margin-bottom:10px}#dialogPreference img.gravatar{width:48px;height:48px} -body,ul{margin:0}body,button,input{font-family:Helvetica}.list li,body{overflow:hidden}::-webkit-scrollbar{background:0 0;width:16px;height:16px}::-webkit-scrollbar-corner{display:none;background-color:transparent}::-webkit-scrollbar-thumb{border:0 solid transparent;border-right-width:4px;border-left-width:4px;border-radius:9px;box-shadow:inset 0 0 0 1px rgba(128,128,128,.2),inset 0 0 0 4px rgba(128,128,128,.2)}::-webkit-scrollbar-thumb:horizontal{border-bottom-width:4px;border-top-width:4px}body{font-size:13px;color:#000}ul{padding:0;list-style:none}*{box-sizing:border-box}a{color:#4183c4;text-decoration:none}a:hover{text-decoration:underline}img{vertical-align:middle}.fn-left{float:left}.fn-right{float:right}.fn-clear:after,.fn-clear:before{display:table;content:""}.fn-clear:after{clear:both}.fn-none{display:none}.ft-small{color:#999;font-size:12px}.ft-red{color:#9d0000}.list li{cursor:pointer;line-height:20px;padding:0 3px;word-wrap:normal;word-break:normal;white-space:nowrap;text-overflow:ellipsis}.list li.selected,.list li:hover{background-color:#3875d7;color:#FFF}.list li.selected .ft-small,.list li:hover .ft-small{color:#FFF}@font-face{font-family:icomoon;src:url(fonts/icomoon.eot?35cb2z);src:url(fonts/icomoon.eot?#iefix35cb2z) format('embedded-opentype'),url(fonts/icomoon.woff?35cb2z) format('woff'),url(fonts/icomoon.ttf?35cb2z) format('truetype'),url(fonts/icomoon.svg?35cb2z#icomoon) format('svg');font-weight:400;font-style:normal}.font-ico,[class^=ico-]{font-family:icomoon;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;cursor:pointer;font-size:13px;line-height:20px}.ico-book:before{content:"\e623"}.ico-price:before{content:"\e616"}.ico-start:before{content:"\e9d7"}.ico-share:before{content:"\e61f"}.ico-github:before{content:"\f00a"}.ico-git:before{content:"\e624"}.ico-tencent:before{content:"\e622"}.ico-weibo:before{content:"\e621"}.ico-googleplus:before{content:"\e61a"}.ico-twitter:before{content:"\e61c"}.ico-email:before{content:"\e619"}.ico-facebook:before{content:"\e61b"}.ico-moveup:before{content:"\f148"}.ico-movedown:before{content:"\f149"}.ico-keyboard:before{content:"\f11c"}.ico-findfiles:before{content:"\e603"}.ico-find:before{content:"\e602"}.ico-editor:before{content:"\e604"}.ico-tree:before{content:"\e600"}.ico-build:before{content:"\e601"}.ico-notification:before{content:"\e607"}.ico-report:before{content:"\e605"}.ico-comment:before{content:"\e620"}.ico-goline:before{content:"\e61e"}.ico-info:before{content:"\e61d"}.ico-signup:before{content:"\e606"}.ico-signout:before{content:"\e618"}.ico-redo:before{content:"\e615"}.ico-undo:before{content:"\e60e"}.ico-about:before{content:"\e60d"}.ico-import:before{content:"\f0ee"}.ico-export:before{content:"\f0ed"}.ico-refresh:before{content:"\f021"}.ico-remove:before{content:"\e60b"}.ico-save:before{content:"\f0c7"}.ico-max:before{content:"\e609"}.ico-format:before{content:"\e612"}.ico-buildrun:before{content:"\e60c"}.ico-stop:before{content:"\e60f"}.ico-restore:before{content:"\e613"}.toolbars .ico-restore:before{content:"\e60a"}.ico-min:before{content:"\e614";position:absolute;right:5px}.ico-close:before{content:"\e611"} +body,ul{margin:0}body,button,input{font-family:Helvetica}.list li,body{overflow:hidden}::-webkit-scrollbar{background:0 0;width:16px;height:16px}::-webkit-scrollbar-corner{display:none;background-color:transparent}::-webkit-scrollbar-thumb{border:0 solid transparent;border-right-width:4px;border-left-width:4px;border-radius:9px;box-shadow:inset 0 0 0 1px rgba(128,128,128,.2),inset 0 0 0 4px rgba(128,128,128,.2)}::-webkit-scrollbar-thumb:horizontal{border-bottom-width:4px;border-top-width:4px}body{font-size:13px;color:#000}ul{padding:0;list-style:none}*{box-sizing:border-box}a{color:#4183c4;text-decoration:none}a:hover{text-decoration:underline}img{vertical-align:middle}.fn-left{float:left}.fn-right{float:right}.fn-clear:after,.fn-clear:before{display:table;content:""}.fn-clear:after{clear:both}.fn-none{display:none}.ft-small{color:#999;font-size:12px}.ft-red{color:#9d0000}.list li{cursor:pointer;line-height:20px;padding:0 3px;word-wrap:normal;word-break:normal;white-space:nowrap;text-overflow:ellipsis}.list li.selected,.list li:hover{background-color:#3875d7;color:#FFF}.list li.selected .ft-small,.list li:hover .ft-small{color:#FFF}@font-face{font-family:icomoon;src:url(fonts/icomoon.eot?lqk80d);src:url(fonts/icomoon.eot?lqk80d#iefix) format('embedded-opentype'),url(fonts/icomoon.ttf?lqk80d) format('truetype'),url(fonts/icomoon.woff?lqk80d) format('woff'),url(fonts/icomoon.svg?lqk80d#icomoon) format('svg');font-weight:400;font-style:normal}[class*=" ico-"],[class^=ico-]{font-family:icomoon!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;cursor:pointer;font-size:13px;line-height:20px}.ico-qqz:before{content:"\e900"}.ico-find:before{content:"\e602"}.ico-findfiles:before{content:"\e603"}.ico-editor:before{content:"\e604"}.ico-notification:before{content:"\e607"}.ico-price:before{content:"\e616"}.ico-report:before{content:"\e605"}.ico-signup:before{content:"\e606"}.ico-git:before{content:"\e624"}.ico-book:before{content:"\e623"}.ico-start:before{content:"\e9d7";text-shadow:0 0 rgba(0,0,0,.4)}.ico-tree:before{content:"\e600"}.ico-build:before{content:"\e601"}.ico-export:before{content:"\f0ed"}.ico-import:before{content:"\f0ee"}.ico-keyboard:before{content:"\f11c"}.ico-moveup:before{content:"\f148"}.ico-movedown:before{content:"\f149"}.ico-weibo:before{content:"\e621"}.ico-uniE608:before{content:"\e608"}.ico-max:before{content:"\e609"}.ico-remove:before{content:"\e60b"}.ico-buildrun:before{content:"\e60c"}.ico-about:before{content:"\e60d"}.ico-undo:before{content:"\e60e"}.ico-stop:before{content:"\e60f"}.ico-close:before{content:"\e611";text-shadow:0 0 rgba(0,0,0,.4)}.ico-format:before{content:"\e612"}.ico-restore:before{content:"\e613"}.toolbars .ico-restore:before{content:"\e60a"}.ico-min:before{content:"\e614";position:absolute;right:5px}.ico-redo:before{content:"\e615"}.ico-uniE617:before{content:"\e617"}.ico-signout:before{content:"\e618"}.ico-email:before{content:"\e619"}.ico-googleplus:before{content:"\e61a"}.ico-facebook:before{content:"\e61b"}.ico-twitter:before{content:"\e61c"}.ico-info:before{content:"\e61d"}.ico-goline:before{content:"\e61e"}.ico-share:before{content:"\e61f"}.ico-comment:before{content:"\e620"}.ico-github:before{content:"\f00a"}.ico-refresh:before{content:"\f021"}.ico-save:before{content:"\f0c7"} .frame li,.tabs>div{padding:0 5px;cursor:pointer}.footer .cursor,.frame li,.menu>ul>li>span,.notification-count,.tabs>div{cursor:pointer}.ico,.menu .split,.menu>ul>li,.tabs>div{float:left}.frame{position:absolute;width:320px;z-index:21;display:none}.frame li{line-height:25px}.frame li.disabled,.frame li.disabled .font-ico,.frame li.disabled:hover .font-ico{color:#999}.frame a{color:#000;text-decoration:none}.frame a:hover,.frame li:hover a{color:#FFF}.frame .space{display:inline-block;width:20px;height:15px}.frame .font-ico{margin-right:5px;width:15px;display:inline-block;text-align:center}.tabs{height:21px;overflow:hidden;width:100%}.tabs>div{line-height:20px;height:20px}.tabs>div>span.changed{font-weight:700}.tabs-panel{overflow:auto;flex:1;height:100%}.edit-exprinfo,.edit-panel{position:absolute;overflow:hidden}.menu{display:block!important}.menu>ul>li>span{font-size:12px;line-height:21px;padding:4px 7px}.menu .split{border-left:1px solid #919191;height:21px;margin:0 5px 0 0}.menu img.gravatar{float:left;margin:2px 8px;height:17px;width:17px;border-radius:9px}#buildRun{color:#6DB14C;font-size:19px}#buildRun.ico-stop{color:#9d0000;font-size:16px}.share-panel{position:absolute;z-index:20;width:226px;padding:5px 0;right:0;top:21px}.share-panel .font-ico{font-size:20px;transition:all .2s ease-out 0s;margin:0 5px;width:24px}.share-panel .font-ico:hover{transform:rotate(360deg)}.edit-panel{left:20%;width:60%;height:70%;flex-flow:column;display:flex}.toolbars{position:absolute;right:5px;top:1px}.ico{background-image:url(../images/ico-file.png);height:16px;margin:2px 0 0 -2px;width:16px}.edit-exprinfo{z-index:10;list-style:none;margin:0;padding:2px;-webkit-box-shadow:2px 3px 5px rgba(0,0,0,.2);-moz-box-shadow:2px 3px 5px rgba(0,0,0,.2);box-shadow:2px 3px 5px rgba(0,0,0,.2);border-radius:3px;border:1px solid silver;background:#fff;font-size:90%;max-height:20em;overflow-y:auto}.CodeMirror,.CodeMirror-hints{font-family:Consolas,'Courier New',monospace}.CodeMirror-hints .ico{margin:-1px 2px 0 -1px}.CodeMirror-focused .cm-matchhighlight{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFklEQVQI12NgYGBgkKzc8x9CMDAwAAAmhwSbidEoSQAAAABJRU5ErkJggg==);background-position:bottom;background-repeat:repeat-x}.CodeMirror-hint{padding-right:18px;max-width:none}.CodeMirror-hint:hover{background:#08f;color:#fff}.CodeMirror div.CodeMirror-cursor{border-left:2px solid #333}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:transparent}.bottom-window-group{background-color:#fff;flex-flow:column}.bottom-window-group .output{font-family:Consolas,Courier New,monospace;padding:0 5px;line-height:16px;font-size:12px;overflow-x:scroll;outline:0}.bottom-window-group .output pre{margin:0;font-family:Consolas,'Courier New',monospace}.bottom-window-group .output .start-build,.bottom-window-group .output .start-get,.bottom-window-group .output .start-install,.bottom-window-group .output .start-test,.start-vet{color:#999}.bottom-window-group .output .build-succ,.bottom-window-group .output .get-succ,.bottom-window-group .output .install-succ,.bottom-window-group .output .test-succ,.vet-succ{color:#090}.bottom-window-group .output .build-error,.bottom-window-group .output .get-error,.bottom-window-group .output .install-error,.bottom-window-group .output .test-error,.vet-error{color:#9d0000}.bottom-window-group .output .stderr{color:gray;font-style:italic}.bottom-window-group .output .path{text-decoration:underline;cursor:pointer}.bottom-window-group table{width:100%}.bottom-window-group td{border-bottom:1px solid #919191;font-size:12px;line-height:19px}.bottom-window-group .notification{outline:0}.bottom-window-group .notification .severity,.bottom-window-group .notification .type{width:50px;padding:0 5px}.bottom-window-group .search{display:flex;flex-flow:column;outline:0}.footer{box-shadow:0 1px 0 0 rgba(255,255,255,.06) inset;padding-left:5px;line-height:18px;display:block!important}.notification-count{float:right;display:none;background-color:#9d0000;color:#FFF;margin:1px 5px;padding:0 2px;border-radius:3px;line-height:16px} .side{width:20%;position:absolute;height:100%;z-index:8;flex-flow:column;display:flex}.side-max{width:100%;z-index:11}.side-right .tabs-panel>div{overflow:auto}.side-right{flex-flow:column}#outline .ico{margin:1px 5px 0}.ico-func{background-position:-123px -21px}.ico-interface{background-position:-143px -21px}.ico-const{background-position:-103px -21px}.ico-var{background-position:-63px -21px}.ico-struct{background-position:-83px -21px}.ico-type{background-position:-163px -21px}.ico-package{background-position:-183px -21px}.ztree{width:100%;padding:0;outline:0;border:0}.ztree li a.curSelectedNode{background-color:#3875d7;border-width:0;color:#fff;height:18px;opacity:1}.ztree li a:hover{text-decoration:none}.ztree li>a>span.button,.ztree li>a>span.button.ico-ztree-dir,.ztree li>a>span.button.ico-ztree-dir-api,.ztree li>a>span.button.ico-ztree-dir-workspace{margin-right:2px}.ztree li>a>span.button{background-image:url(../images/ico-file.png);margin-right:0}.ico-ztree-dir{background-position:-2px -23px}.ico-ztree-dir-api{background-position:-22px -23px}.ico-ztree-dir-workspace{background-position:-42px -23px}.ico-ztree-html{background-position:-4px -2px}.ico-ztree-go{background-position:-22px -2px}.ico-ztree-css{background-position:-42px -2px}.ico-ztree-img{background-position:-63px -2px}.ico-ztree-other{background-position:-83px -2px}.ico-ztree-text{background-position:-103px -2px}.ico-ztree-sql{background-position:-123px -2px}.ico-ztree-pro{background-position:-142px -2px}.ico-ztree-md{background-position:-162px -2px}.ico-ztree-js{background-position:-182px -2px}.ico-ztree-xml{background-position:-202px -2px} #startPage{padding:50px 70px;line-height:28px;white-space:normal;word-wrap:break-word;overflow:auto}#startPage a{color:#4183c4;text-decoration:none}#startPage a:hover{text-decoration:underline}#startPage .title{background-color:#BBB;border-bottom-width:0!important;border-radius:3px 3px 0 0;font-size:15px;margin-bottom:10px;padding:5px 10px;color:#FFF}#startPage .details li.border,#startPage .news li{border-bottom:1px solid #919191}#startPage .details{width:30%;float:left}#startPage .details label{color:#666}#startPage .details li.border{padding-bottom:5px;margin-bottom:5px}#startPage .details li.border.workspace{line-height:18px;padding-bottom:10px!important;word-wrap:break-word;white-space:normal;word-break:break-all}#startPage .news{width:60%;float:right;border-left:1px solid #f1f1f1;margin-left:10%;padding-left:10%;white-space:nowrap;overflow:hidden}#startPage .date{color:#bbb;font-size:13px;word-wrap:normal;white-space:nowrap} diff --git a/static/js/bottomGroup.js b/static/js/bottomGroup.js index 8c2876f..f1b4688 100644 --- a/static/js/bottomGroup.js +++ b/static/js/bottomGroup.js @@ -1,11 +1,11 @@ /* - * Copyright (c) 2014-2017, b3log.org & hacpai.com + * Copyright (c) 2014-2019, b3log.org & hacpai.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/static/js/dialog.js b/static/js/dialog.js index fc38994..8dc7c51 100644 --- a/static/js/dialog.js +++ b/static/js/dialog.js @@ -1,11 +1,11 @@ /* - * Copyright (c) 2014-2017, b3log.org & hacpai.com + * Copyright (c) 2014-2019, b3log.org & hacpai.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -24,7 +24,7 @@ $.fn.extend({ dialog: { version: "0.0.1.7", - author: "lly219@gmail.com" + author: "v@b3log.org" } }); diff --git a/static/js/editors.js b/static/js/editors.js index c110bd1..83762c5 100644 --- a/static/js/editors.js +++ b/static/js/editors.js @@ -1,11 +1,11 @@ /* - * Copyright (c) 2014-2017, b3log.org & hacpai.com + * Copyright (c) 2014-2019, b3log.org & hacpai.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -246,7 +246,7 @@ var editors = { + '"> ' + config.label.start_page + '', content: '
', after: function () { - $("#startPage").load(config.context + '/start?sid=' + config.wideSessionId); + $("#startPage").load('/start?sid=' + config.wideSessionId); $.ajax({ url: "https://hacpai.com/apis/articles?tags=wide,golang&p=1&size=20", type: "GET", @@ -329,7 +329,7 @@ var editors = { $.ajax({ async: false, // 同步执行 type: 'POST', - url: config.context + '/autocomplete', + url: '/autocomplete', data: JSON.stringify(request), dataType: "json", success: function (data) { @@ -435,7 +435,7 @@ var editors = { $.ajax({ type: 'POST', - url: config.context + '/exprinfo', + url: '/exprinfo', data: JSON.stringify(request), dataType: "json", success: function (result) { @@ -583,7 +583,7 @@ var editors = { $.ajax({ type: 'POST', - url: config.context + '/find/decl', + url: '/find/decl', data: JSON.stringify(request), dataType: "json", success: function (result) { @@ -613,7 +613,7 @@ var editors = { $.ajax({ type: 'POST', - url: config.context + '/find/usages', + url: '/find/usages', data: JSON.stringify(request), dataType: "json", success: function (result) { diff --git a/static/js/hotkeys.js b/static/js/hotkeys.js index 7d739a5..11beb82 100644 --- a/static/js/hotkeys.js +++ b/static/js/hotkeys.js @@ -1,11 +1,11 @@ /* - * Copyright (c) 2014-2017, b3log.org & hacpai.com + * Copyright (c) 2014-2019, b3log.org & hacpai.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/static/js/lib.min.js b/static/js/lib.min.js index 486a985..4701c2e 100644 --- a/static/js/lib.min.js +++ b/static/js/lib.min.js @@ -1,77 +1,47 @@ -!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e){var t=e.length,n=Z.type(e);return"function"===n||Z.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function r(e,t,n){if(Z.isFunction(t))return Z.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return Z.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(ae.test(t))return Z.filter(t,e,n);t=Z.filter(t,e)}return Z.grep(e,function(e){return U.call(t,e)>=0!==n})}function i(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function o(e){var t=he[e]={};return Z.each(e.match(de)||[],function(e,n){t[n]=!0}),t}function s(){J.removeEventListener("DOMContentLoaded",s,!1),e.removeEventListener("load",s,!1),Z.ready()}function a(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=Z.expando+Math.random()}function u(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(be,"-$1").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:xe.test(n)?Z.parseJSON(n):n}catch(i){}ye.set(e,t,n)}else n=void 0;return n}function l(){return!0}function c(){return!1}function f(){try{return J.activeElement}catch(e){}}function p(e,t){return Z.nodeName(e,"table")&&Z.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function d(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function h(e){var t=Pe.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function g(e,t){for(var n=0,r=e.length;r>n;n++)ve.set(e[n],"globalEval",!t||ve.get(t[n],"globalEval"))}function m(e,t){var n,r,i,o,s,a,u,l;if(1===t.nodeType){if(ve.hasData(e)&&(o=ve.access(e),s=ve.set(t,o),l=o.events)){delete s.handle,s.events={};for(i in l)for(n=0,r=l[i].length;r>n;n++)Z.event.add(t,i,l[i][n])}ye.hasData(e)&&(a=ye.access(e),u=Z.extend({},a),ye.set(t,u))}}function v(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&Z.nodeName(e,t)?Z.merge([e],n):n}function y(e,t){var n=t.nodeName.toLowerCase();"input"===n&&Ne.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function x(t,n){var r,i=Z(n.createElement(t)).appendTo(n.body),o=e.getDefaultComputedStyle&&(r=e.getDefaultComputedStyle(i[0]))?r.display:Z.css(i[0],"display");return i.detach(),o}function b(e){var t=J,n=$e[e];return n||(n=x(e,t),"none"!==n&&n||(We=(We||Z("').bind("load",function(){var t,o=e.isArray(r.paramName)?r.paramName:[r.paramName];a.unbind("load").bind("load",function(){var t;try{if(t=a.contents(),!t.length||!t[0].firstChild)throw new Error}catch(r){t=void 0}m(200,"success",{iframe:t}),e('').appendTo(n),window.setTimeout(function(){n.remove()},0)}),n.prop("target",a.prop("name")).prop("action",r.url).prop("method",r.type),r.formData&&e.each(r.formData,function(t,r){e('').prop("name",r.name).val(r.value).appendTo(n)}),r.fileInput&&r.fileInput.length&&"POST"===r.type&&(t=r.fileInput.clone(),r.fileInput.after(function(e){return t[e]}),r.paramName&&r.fileInput.each(function(t){e(this).prop("name",o[t]||r.paramName)}),n.append(r.fileInput).prop("enctype","multipart/form-data").prop("encoding","multipart/form-data"),r.fileInput.removeAttr("form")),n.submit(),t&&t.length&&r.fileInput.each(function(r,n){var a=e(t[r]);e(n).prop("name",a.prop("name")).attr("form",a.attr("form")),a.replaceWith(n)})}),n.append(a).appendTo(document.body)},abort:function(){a&&a.unbind("load").prop("src",i),n&&n.remove()}}}}),e.ajaxSetup({converters:{"iframe text":function(t){return t&&e(t[0].body).text()},"iframe json":function(t){return t&&e.parseJSON(e(t[0].body).text())},"iframe html":function(t){return t&&e(t[0].body).html()},"iframe xml":function(t){var r=t&&t[0];return r&&e.isXMLDoc(r)?r:e.parseXML(r.XMLDocument&&r.XMLDocument.xml||e(r.body).html())},"iframe script":function(t){return t&&e.globalEval(e(t[0].body).text())}}})}); -!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","jquery.ui.widget"],e):e(window.jQuery)}(function(e){"use strict";function t(t){var i="dragover"===t;return function(r){r.dataTransfer=r.originalEvent&&r.originalEvent.dataTransfer;var n=r.dataTransfer;n&&-1!==e.inArray("Files",n.types)&&this._trigger(t,e.Event(t,{delegatedEvent:r}))!==!1&&(r.preventDefault(),i&&(n.dropEffect="copy"))}}e.support.fileInput=!(new RegExp("(Android (1\\.[0156]|2\\.[01]))|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)|(w(eb)?OSBrowser)|(webOS)|(Kindle/(1\\.0|2\\.[05]|3\\.0))").test(window.navigator.userAgent)||e('').prop("disabled")),e.support.xhrFileUpload=!(!window.ProgressEvent||!window.FileReader),e.support.xhrFormDataFileUpload=!!window.FormData,e.support.blobSlice=window.Blob&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice),e.widget("blueimp.fileupload",{options:{dropZone:e(document),pasteZone:void 0,fileInput:void 0,replaceFileInput:!0,paramName:void 0,singleFileUploads:!0,limitMultiFileUploads:void 0,limitMultiFileUploadSize:void 0,limitMultiFileUploadSizeOverhead:512,sequentialUploads:!1,limitConcurrentUploads:void 0,forceIframeTransport:!1,redirect:void 0,redirectParamName:void 0,postMessage:void 0,multipart:!0,maxChunkSize:void 0,uploadedBytes:void 0,recalculateProgress:!0,progressInterval:100,bitrateInterval:500,autoUpload:!0,messages:{uploadedBytes:"Uploaded bytes exceed file size"},i18n:function(t,i){return t=this.messages[t]||t.toString(),i&&e.each(i,function(e,i){t=t.replace("{"+e+"}",i)}),t},formData:function(e){return e.serializeArray()},add:function(t,i){return t.isDefaultPrevented()?!1:void((i.autoUpload||i.autoUpload!==!1&&e(this).fileupload("option","autoUpload"))&&i.process().done(function(){i.submit()}))},processData:!1,contentType:!1,cache:!1},_specialOptions:["fileInput","dropZone","pasteZone","multipart","forceIframeTransport"],_blobSlice:e.support.blobSlice&&function(){var e=this.slice||this.webkitSlice||this.mozSlice;return e.apply(this,arguments)},_BitrateTimer:function(){this.timestamp=Date.now?Date.now():(new Date).getTime(),this.loaded=0,this.bitrate=0,this.getBitrate=function(e,t,i){var r=e-this.timestamp;return(!this.bitrate||!i||r>i)&&(this.bitrate=(t-this.loaded)*(1e3/r)*8,this.loaded=t,this.timestamp=e),this.bitrate}},_isXHRUpload:function(t){return!t.forceIframeTransport&&(!t.multipart&&e.support.xhrFileUpload||e.support.xhrFormDataFileUpload)},_getFormData:function(t){var i;return"function"===e.type(t.formData)?t.formData(t.form):e.isArray(t.formData)?t.formData:"object"===e.type(t.formData)?(i=[],e.each(t.formData,function(e,t){i.push({name:e,value:t})}),i):[]},_getTotal:function(t){var i=0;return e.each(t,function(e,t){i+=t.size||1}),i},_initProgressObject:function(t){var i={loaded:0,total:0,bitrate:0};t._progress?e.extend(t._progress,i):t._progress=i},_initResponseObject:function(e){var t;if(e._response)for(t in e._response)e._response.hasOwnProperty(t)&&delete e._response[t];else e._response={}},_onProgress:function(t,i){if(t.lengthComputable){var r,n=Date.now?Date.now():(new Date).getTime();if(i._time&&i.progressInterval&&n-i._time").prop("href",t.url).prop("host");t.dataType="iframe "+(t.dataType||""),t.formData=this._getFormData(t),t.redirect&&i&&i!==location.host&&t.formData.push({name:t.redirectParamName||"redirect",value:t.redirect})},_initDataSettings:function(e){this._isXHRUpload(e)?(this._chunkedUpload(e,!0)||(e.data||this._initXHRData(e),this._initProgressListener(e)),e.postMessage&&(e.dataType="postmessage "+(e.dataType||""))):this._initIframeSettings(e)},_getParamName:function(t){var i=e(t.fileInput),r=t.paramName;return r?e.isArray(r)||(r=[r]):(r=[],i.each(function(){for(var t=e(this),i=t.prop("name")||"files[]",n=(t.prop("files")||[1]).length;n;)r.push(i),n-=1}),r.length||(r=[i.prop("name")||"files[]"])),r},_initFormSettings:function(t){t.form&&t.form.length||(t.form=e(t.fileInput.prop("form")),t.form.length||(t.form=e(this.options.fileInput.prop("form")))),t.paramName=this._getParamName(t),t.url||(t.url=t.form.prop("action")||location.href),t.type=(t.type||"string"===e.type(t.form.prop("method"))&&t.form.prop("method")||"").toUpperCase(),"POST"!==t.type&&"PUT"!==t.type&&"PATCH"!==t.type&&(t.type="POST"),t.formAcceptCharset||(t.formAcceptCharset=t.form.attr("accept-charset"))},_getAJAXSettings:function(t){var i=e.extend({},this.options,t);return this._initFormSettings(i),this._initDataSettings(i),i},_getDeferredState:function(e){return e.state?e.state():e.isResolved()?"resolved":e.isRejected()?"rejected":"pending"},_enhancePromise:function(e){return e.success=e.done,e.error=e.fail,e.complete=e.always,e},_getXHRPromise:function(t,i,r){var n=e.Deferred(),o=n.promise();return i=i||this.options.context||o,t===!0?n.resolveWith(i,r):t===!1&&n.rejectWith(i,r),o.abort=n.promise,this._enhancePromise(o)},_addConvenienceMethods:function(t,i){var r=this,n=function(t){return e.Deferred().resolveWith(r,t).promise()};i.process=function(t,o){return(t||o)&&(i._processQueue=this._processQueue=(this._processQueue||n([this])).pipe(function(){return i.errorThrown?e.Deferred().rejectWith(r,[i]).promise():n(arguments)}).pipe(t,o)),this._processQueue||n([this])},i.submit=function(){return"pending"!==this.state()&&(i.jqXHR=this.jqXHR=r._trigger("submit",e.Event("submit",{delegatedEvent:t}),this)!==!1&&r._onSend(t,this)),this.jqXHR||r._getXHRPromise()},i.abort=function(){return this.jqXHR?this.jqXHR.abort():(this.errorThrown="abort",r._trigger("fail",null,this),r._getXHRPromise(!1))},i.state=function(){return this.jqXHR?r._getDeferredState(this.jqXHR):this._processQueue?r._getDeferredState(this._processQueue):void 0},i.processing=function(){return!this.jqXHR&&this._processQueue&&"pending"===r._getDeferredState(this._processQueue)},i.progress=function(){return this._progress},i.response=function(){return this._response}},_getUploadedBytes:function(e){var t=e.getResponseHeader("Range"),i=t&&t.split("-"),r=i&&i.length>1&&parseInt(i[1],10);return r&&r+1},_chunkedUpload:function(t,i){t.uploadedBytes=t.uploadedBytes||0;var r,n,o=this,s=t.files[0],a=s.size,l=t.uploadedBytes,p=t.maxChunkSize||a,u=this._blobSlice,d=e.Deferred(),h=d.promise();return this._isXHRUpload(t)&&u&&(l||a>p)&&!t.data?i?!0:l>=a?(s.error=t.i18n("uploadedBytes"),this._getXHRPromise(!1,t.context,[null,"error",s.error])):(n=function(){var i=e.extend({},t),h=i._progress.loaded;i.blob=u.call(s,l,l+p,s.type),i.chunkSize=i.blob.size,i.contentRange="bytes "+l+"-"+(l+i.chunkSize-1)+"/"+a,o._initXHRData(i),o._initProgressListener(i),r=(o._trigger("chunksend",null,i)!==!1&&e.ajax(i)||o._getXHRPromise(!1,i.context)).done(function(r,s,p){l=o._getUploadedBytes(p)||l+i.chunkSize,h+i.chunkSize-i._progress.loaded&&o._onProgress(e.Event("progress",{lengthComputable:!0,loaded:l-i.uploadedBytes,total:l-i.uploadedBytes}),i),t.uploadedBytes=i.uploadedBytes=l,i.result=r,i.textStatus=s,i.jqXHR=p,o._trigger("chunkdone",null,i),o._trigger("chunkalways",null,i),a>l?n():d.resolveWith(i.context,[r,s,p])}).fail(function(e,t,r){i.jqXHR=e,i.textStatus=t,i.errorThrown=r,o._trigger("chunkfail",null,i),o._trigger("chunkalways",null,i),d.rejectWith(i.context,[e,t,r])})},this._enhancePromise(h),h.abort=function(){return r.abort()},n(),h):!1},_beforeSend:function(e,t){0===this._active&&(this._trigger("start"),this._bitrateTimer=new this._BitrateTimer,this._progress.loaded=this._progress.total=0,this._progress.bitrate=0),this._initResponseObject(t),this._initProgressObject(t),t._progress.loaded=t.loaded=t.uploadedBytes||0,t._progress.total=t.total=this._getTotal(t.files)||1,t._progress.bitrate=t.bitrate=0,this._active+=1,this._progress.loaded+=t.loaded,this._progress.total+=t.total},_onDone:function(t,i,r,n){var o=n._progress.total,s=n._response;n._progress.loadeda._sending)for(var r=a._slots.shift();r;){if("pending"===a._getDeferredState(r)){r.resolve();break}r=a._slots.shift()}0===a._active&&a._trigger("stop")})};return this._beforeSend(t,l),this.options.sequentialUploads||this.options.limitConcurrentUploads&&this.options.limitConcurrentUploads<=this._sending?(this.options.limitConcurrentUploads>1?(o=e.Deferred(),this._slots.push(o),s=o.pipe(p)):(this._sequence=this._sequence.pipe(p,p),s=this._sequence),s.abort=function(){return n=[void 0,"abort","abort"],r?r.abort():(o&&o.rejectWith(l.context,n),p())},this._enhancePromise(s)):p()},_onAdd:function(t,i){var r,n,o,s,a=this,l=!0,p=e.extend({},this.options,i),u=i.files,d=u.length,h=p.limitMultiFileUploads,c=p.limitMultiFileUploadSize,f=p.limitMultiFileUploadSizeOverhead,g=0,_=this._getParamName(p),m=0;if(!c||d&&void 0!==u[0].size||(c=void 0),(p.singleFileUploads||h||c)&&this._isXHRUpload(p))if(p.singleFileUploads||c||!h)if(!p.singleFileUploads&&c)for(o=[],r=[],s=0;d>s;s+=1)g+=u[s].size+f,(s+1===d||g+u[s+1].size+f>c||h&&s+1-m>=h)&&(o.push(u.slice(m,s+1)),n=_.slice(m,s+1),n.length||(n=_),r.push(n),m=s+1,g=0);else r=_;else for(o=[],r=[],s=0;d>s;s+=h)o.push(u.slice(s,s+h)),n=_.slice(s,s+h),n.length||(n=_),r.push(n);else o=[u],r=[_];return i.originalFiles=u,e.each(o||u,function(n,s){var p=e.extend({},i);return p.files=o?s:[s],p.paramName=r[n],a._initResponseObject(p),a._initProgressObject(p),a._addConvenienceMethods(t,p),l=a._trigger("add",e.Event("add",{delegatedEvent:t}),p)}),l},_replaceFileInput:function(t){var i=t.fileInput,r=i.clone(!0);t.fileInputClone=r,e("
").append(r)[0].reset(),i.after(r).detach(),e.cleanData(i.unbind("remove")),this.options.fileInput=this.options.fileInput.map(function(e,t){return t===i[0]?r[0]:t}),i[0]===this.element[0]&&(this.element=r)},_handleFileTreeEntry:function(t,i){var r,n=this,o=e.Deferred(),s=function(e){e&&!e.entry&&(e.entry=t),o.resolve([e])},a=function(e){n._handleFileTreeEntries(e,i+t.name+"/").done(function(e){o.resolve(e)}).fail(s)},l=function(){r.readEntries(function(e){e.length?(p=p.concat(e),l()):a(p)},s)},p=[];return i=i||"",t.isFile?t._file?(t._file.relativePath=i,o.resolve(t._file)):t.file(function(e){e.relativePath=i,o.resolve(e)},s):t.isDirectory?(r=t.createReader(),l()):o.resolve([]),o.promise()},_handleFileTreeEntries:function(t,i){var r=this;return e.when.apply(e,e.map(t,function(e){return r._handleFileTreeEntry(e,i)})).pipe(function(){return Array.prototype.concat.apply([],arguments)})},_getDroppedFiles:function(t){t=t||{};var i=t.items;return i&&i.length&&(i[0].webkitGetAsEntry||i[0].getAsEntry)?this._handleFileTreeEntries(e.map(i,function(e){var t;return e.webkitGetAsEntry?(t=e.webkitGetAsEntry(),t&&(t._file=e.getAsFile()),t):e.getAsEntry()})):e.Deferred().resolve(e.makeArray(t.files)).promise()},_getSingleFileInputFiles:function(t){t=e(t);var i,r,n=t.prop("webkitEntries")||t.prop("entries");if(n&&n.length)return this._handleFileTreeEntries(n);if(i=e.makeArray(t.prop("files")),i.length)void 0===i[0].name&&i[0].fileName&&e.each(i,function(e,t){t.name=t.fileName,t.size=t.fileSize});else{if(r=t.prop("value"),!r)return e.Deferred().resolve([]).promise();i=[{name:r.replace(/^.*\\/,"")}]}return e.Deferred().resolve(i).promise()},_getFileInputFiles:function(t){return t instanceof e&&1!==t.length?e.when.apply(e,e.map(t,this._getSingleFileInputFiles)).pipe(function(){return Array.prototype.concat.apply([],arguments)}):this._getSingleFileInputFiles(t)},_onChange:function(t){var i=this,r={fileInput:e(t.target),form:e(t.target.form)};this._getFileInputFiles(r.fileInput).always(function(n){r.files=n,i.options.replaceFileInput&&i._replaceFileInput(r),i._trigger("change",e.Event("change",{delegatedEvent:t}),r)!==!1&&i._onAdd(t,r)})},_onPaste:function(t){var i=t.originalEvent&&t.originalEvent.clipboardData&&t.originalEvent.clipboardData.items,r={files:[]};i&&i.length&&(e.each(i,function(e,t){var i=t.getAsFile&&t.getAsFile();i&&r.files.push(i)}),this._trigger("paste",e.Event("paste",{delegatedEvent:t}),r)!==!1&&this._onAdd(t,r))},_onDrop:function(t){t.dataTransfer=t.originalEvent&&t.originalEvent.dataTransfer;var i=this,r=t.dataTransfer,n={};r&&r.files&&r.files.length&&(t.preventDefault(),this._getDroppedFiles(r).always(function(r){n.files=r,i._trigger("drop",e.Event("drop",{delegatedEvent:t}),n)!==!1&&i._onAdd(t,n)}))},_onDragOver:t("dragover"),_onDragEnter:t("dragenter"),_onDragLeave:t("dragleave"),_initEventHandlers:function(){this._isXHRUpload(this.options)&&(this._on(this.options.dropZone,{dragover:this._onDragOver,drop:this._onDrop,dragenter:this._onDragEnter,dragleave:this._onDragLeave}),this._on(this.options.pasteZone,{paste:this._onPaste})),e.support.fileInput&&this._on(this.options.fileInput,{change:this._onChange})},_destroyEventHandlers:function(){this._off(this.options.dropZone,"dragenter dragleave dragover drop"),this._off(this.options.pasteZone,"paste"),this._off(this.options.fileInput,"change")},_setOption:function(t,i){var r=-1!==e.inArray(t,this._specialOptions);r&&this._destroyEventHandlers(),this._super(t,i),r&&(this._initSpecialOptions(),this._initEventHandlers())},_initSpecialOptions:function(){var t=this.options;void 0===t.fileInput?t.fileInput=this.element.is('input[type="file"]')?this.element:this.element.find('input[type="file"]'):t.fileInput instanceof e||(t.fileInput=e(t.fileInput)),t.dropZone instanceof e||(t.dropZone=e(t.dropZone)),t.pasteZone instanceof e||(t.pasteZone=e(t.pasteZone))},_getRegExp:function(e){var t=e.split("/"),i=t.pop();return t.shift(),new RegExp(t.join("/"),i)},_isRegExpOption:function(t,i){return"url"!==t&&"string"===e.type(i)&&/^\/.*\/[igm]{0,3}$/.test(i)},_initDataAttributes:function(){var t=this,i=this.options,r=e(this.element[0].cloneNode(!1));e.each(r.data(),function(e,n){var o="data-"+e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();r.attr(o)&&(t._isRegExpOption(e,n)&&(n=t._getRegExp(n)),i[e]=n)})},_create:function(){this._initDataAttributes(),this._initSpecialOptions(),this._slots=[],this._sequence=this._getXHRPromise(!0),this._sending=this._active=0,this._initProgressObject(this),this._initEventHandlers()},active:function(){return this._active},progress:function(){return this._progress},add:function(t){var i=this;t&&!this.options.disabled&&(t.fileInput&&!t.files?this._getFileInputFiles(t.fileInput).always(function(e){t.files=e,i._onAdd(null,t)}):(t.files=e.makeArray(t.files),this._onAdd(null,t)))},send:function(t){if(t&&!this.options.disabled){if(t.fileInput&&!t.files){var i,r,n=this,o=e.Deferred(),s=o.promise();return s.abort=function(){return r=!0,i?i.abort():(o.reject(null,"abort","abort"),s)},this._getFileInputFiles(t.fileInput).always(function(e){if(!r){if(!e.length)return void o.reject();t.files=e,i=n._onSend(null,t),i.then(function(e,t,i){o.resolve(e,t,i)},function(e,t,i){o.reject(e,t,i)})}}),this._enhancePromise(s)}if(t.files=e.makeArray(t.files),t.files.length)return this._onSend(null,t)}return this._getXHRPromise(!1,t&&t.context)}})}); -!function(e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else{if("function"==typeof define&&define.amd)return define([],e);this.CodeMirror=e()}}(function(){function e(r,n){if(!(this instanceof e))return new e(r,n);this.options=n=n?Oi(n):{},Oi(jo,n,!1),d(n);var i=n.value;"string"==typeof i&&(i=new gl(i,n.mode)),this.doc=i;var o=new e.inputStyles[n.inputStyle](this),l=this.display=new t(r,i,o);l.wrapper.CodeMirror=this,u(this),s(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),n.autofocus&&!xo&&l.input.focus(),m(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Si,keySeq:null,specialChars:null};var a=this;co&&11>fo&&setTimeout(function(){a.display.input.reset(!0)},20),Rt(this),Vi(),mt(this),this.curOp.forceUpdate=!0,Kn(this,i),n.autofocus&&!xo||a.hasFocus()?setTimeout(Di(cr,this),20):fr(this);for(var c in Xo)Xo.hasOwnProperty(c)&&Xo[c](this,n[c],_o);C(this),n.finishInit&&n.finishInit(this);for(var f=0;ffo&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),ho||so&&xo||(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,r.init(n)}function r(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),n(t)}function n(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,Ee(e,100),e.state.modeGen++,e.curOp&&Dt(e)}function i(e){e.options.lineWrapping?(Gl(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Bl(e.display.wrapper,"CodeMirror-wrap"),h(e)),l(e),Dt(e),it(e),setTimeout(function(){y(e)},100)}function o(e){var t=gt(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/vt(e.display)-3);return function(i){if(vn(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;lt.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function d(e){var t=Mi(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function p(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Ge(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Ve(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}function g(e,t,r){this.cm=r;var n=this.vert=Ei("div",[Ei("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=Ei("div",[Ei("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(i),xl(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),xl(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedOverlay=!1,co&&8>fo&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function v(){}function m(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Bl(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),xl(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,r){"horizontal"==r?Qt(t,e):Zt(t,e)},t),t.display.scrollbars.addClass&&Gl(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=p(e));var r=e.display.barWidth,n=e.display.barHeight;b(e,t);for(var i=0;4>i&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&O(e),b(e,p(e)),r=e.display.barWidth,n=e.display.barHeight}function b(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}function w(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-Be(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=qn(t,n),l=qn(t,i);if(r&&r.ensure){var s=r.ensure.from.line,a=r.ensure.to.line;o>s?(o=s,l=qn(t,Zn(jn(t,s))+e.wrapper.clientHeight)):Math.min(a,t.lastLine())>=l&&(o=qn(t,Zn(jn(t,a))-e.wrapper.clientHeight),l=a)}return{from:o,to:Math.max(l,o+1)}}function x(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=L(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",l=0;l=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Ft(e))return!1;C(e)&&(Pt(e),t.dims=H(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFroml&&r.viewTo-l<20&&(l=Math.min(i,r.viewTo)),No&&(o=pn(e.doc,o),l=gn(e.doc,l));var s=o!=r.viewFrom||l!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;zt(e,o,l),r.viewOffset=Zn(jn(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var a=Ft(e);if(!s&&0==a&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var u=Ri();return a>4&&(r.lineDiv.style.display="none"),P(e,r.updateLineNumbers,t.dims),a>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,u&&Ri()!=u&&u.offsetHeight&&u.focus(),zi(r.cursorDiv),zi(r.selectionDiv),r.gutters.style.height=0,s&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Ee(e,400)),r.updateLineNumbers=null,!0}function N(e,t){for(var r=t.force,n=t.viewport,i=!0;;i=!1){if(i&&e.options.lineWrapping&&t.oldDisplayWidth!=Ke(e))r=!0;else if(r=!1,n&&null!=n.top&&(n={top:Math.min(e.doc.height+Ge(e.display)-je(e),n.top)}),t.visible=w(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!M(e,t))break;O(e);var o=p(e);Oe(e),W(e,o),y(e,o)}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function A(e,t){var r=new k(e,t);if(M(e,r)){O(e),N(e,r);var n=p(e);Oe(e),W(e,n),y(e,n),r.finish()}}function W(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";var r=t.docHeight+e.display.barHeight;e.display.heightForcer.style.top=r+"px",e.display.gutters.style.height=Math.max(r+Ve(e),t.clientHeight)+"px"}function O(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;nfo){var l=o.node.offsetTop+o.node.offsetHeight;i=l-r,r=l}else{var s=o.node.getBoundingClientRect();i=s.bottom-s.top}var a=o.line.height-i;if(2>i&&(i=gt(t)),(a>.001||-.001>a)&&(Yn(o.line,i),D(o.line),o.rest))for(var u=0;u=t&&f.lineNumber;f.changes&&(Mi(f.changes,"gutter")>-1&&(h=!1),I(e,f,u,r)),h&&(zi(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(S(e.options,u)))),s=f.node.nextSibling}else{var d=V(e,f,u,r);l.insertBefore(d,s)}u+=f.size}for(;s;)s=n(s)}function I(e,t,r,n){for(var i=0;ifo&&(e.node.style.zIndex=2)),e.node}function z(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var r=E(e);e.background=r.insertBefore(Ei("div",null,t),r.firstChild)}}function F(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Dn(e,t)}function R(e,t){var r=t.text.className,n=F(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,B(t)):r&&(t.text.className=r)}function B(e){z(e),e.line.wrapClass?E(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function G(e,t,r,n){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null);var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var o=E(t),l=t.gutter=Ei("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px");if(e.display.input.setUneditable(l),o.insertBefore(l,t.text),t.line.gutterClass&&(l.className+=" "+t.line.gutterClass),!e.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(t.lineNumber=l.appendChild(Ei("div",S(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),i)for(var s=0;s1&&(Oo&&Oo.join("\n")==t?l=n.ranges.length%Oo.length==0&&Ni(Oo,Kl):o.length==n.ranges.length&&(l=Ni(o,function(e){return[e]})));for(var s=n.ranges.length-1;s>=0;s--){var a=n.ranges[s],u=a.from(),c=a.to();a.empty()&&(r&&r>0?u=Ao(u.line,u.ch-r):e.state.overwrite&&!e.state.pasteIncoming&&(c=Ao(c.line,Math.min(jn(i,c.line).text.length,c.ch+Ti(o).length))));var f=e.curOp.updateInput,h={from:u,to:c,text:l?l[s%l.length]:o,origin:e.state.pasteIncoming?"paste":e.state.cutIncoming?"cut":"+input"};if(br(e.doc,h),mi(e,"inputRead",e,h),t&&!e.state.pasteIncoming&&e.options.electricChars&&e.options.smartIndent&&a.head.ch<100&&(!s||n.ranges[s-1].head.line!=a.head.line)){var d=e.getModeAt(a.head),p=Ko(h);if(d.electricChars){for(var g=0;g-1){Hr(e,p.line,"smart");break}}else d.electricInput&&d.electricInput.test(jn(i,p.line).text.slice(0,p.ch))&&Hr(e,p.line,"smart")}}Or(e),e.curOp.updateInput=f,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function J(e){for(var t=[],r=[],n=0;ni?u.map:c[i],l=0;li?e.line:e.rest[i]),f=o[l]+n;return(0>n||s!=t)&&(f=o[l+(n?1:0)]),Ao(a,f)}}}var i=e.text.firstChild,o=!1;if(!t||!zl(i,t))return oe(Ao($n(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[r],r=0,!t)){var l=e.rest?Ti(e.rest):e.line;return oe(Ao($n(l),l.text.length),o)}var s=3==t.nodeType?t:null,a=t;for(s||1!=t.childNodes.length||3!=t.firstChild.nodeType||(s=t.firstChild,r&&(r=s.nodeValue.length));a.parentNode!=i;)a=a.parentNode;var u=e.measure,c=u.maps,f=n(s,a,r);if(f)return oe(f,o);for(var h=a.nextSibling,d=s?s.nodeValue.length-r:0;h;h=h.nextSibling){if(f=n(h,h.firstChild,0))return oe(Ao(f.line,f.ch-d),o);d+=h.textContent.length}for(var p=a.previousSibling,d=r;p;p=p.previousSibling){if(f=n(p,p.firstChild,-1))return oe(Ao(f.line,f.ch+d),o);d+=h.textContent.length}}function ae(e,t,r,n,i){function o(e){return function(t){return t.id==e}}function l(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return""==r&&(r=t.textContent.replace(/\u200b/g,"")),void(s+=r);var u,c=t.getAttribute("cm-marker");if(c){var f=e.findMarks(Ao(n,0),Ao(i+1,0),o(+c));return void(f.length&&(u=f[0].find())&&(s+=Xn(e.doc,u.from,u.to).join("\n")))}if("false"==t.getAttribute("contenteditable"))return;for(var h=0;h=0){var l=$(o.from(),i.from()),s=Y(o.to(),i.to()),a=o.empty()?i.from()==i.head:o.from()==o.head;t>=n&&--t,e.splice(--n,2,new ce(a?s:l,a?l:s))}}return new ue(e,t)}function he(e,t){return new ue([new ce(e,t||e)],0)}function de(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function pe(e,t){if(t.liner?Ao(r,jn(e,r).text.length):ge(t,jn(e,t.line).text.length)}function ge(e,t){var r=e.ch;return null==r||r>t?Ao(e.line,t):0>r?Ao(e.line,0):e}function ve(e,t){return t>=e.first&&t=o.ch:u.to>o.ch))){if(n&&(Sl(c,"beforeCursorEnter"),c.explicitlyCleared)){if(s.markedSpans){--a;continue}break}if(!c.atomic)continue;var f=c.find(0>l?-1:1);if(0==Wo(f,o)&&(f.ch+=l,f.ch<0?f=f.line>e.first?pe(e,Ao(f.line-1)):null:f.ch>s.text.length&&(f=f.linet&&(t=0),t=Math.round(t),n=Math.round(n),s.appendChild(Ei("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?c-e:r)+"px; height: "+(n-t)+"px"))}function i(t,r,i){function o(r,n){return ut(e,Ao(t,r),"div",f,n)}var s,a,f=jn(l,t),h=f.text.length;return Yi(Qn(f),r||0,null==i?h:i,function(e,t,l){var f,d,p,g=o(e,"left");if(e==t)f=g,d=p=g.left;else{if(f=o(t-1,"right"),"rtl"==l){var v=g;g=f,f=v}d=g.left,p=f.right}null==r&&0==e&&(d=u),f.top-g.top>3&&(n(d,g.top,null,g.bottom),d=u,g.bottoma.bottom||f.bottom==a.bottom&&f.right>a.right)&&(a=f),u+1>d&&(d=u),n(d,f.top,p-d,f.bottom)}),{start:s,end:a}}var o=e.display,l=e.doc,s=document.createDocumentFragment(),a=Ue(e.display),u=a.left,c=Math.max(o.sizerWidth,Ke(e)-o.sizer.offsetLeft)-a.right,f=t.from(),h=t.to();if(f.line==h.line)i(f.line,f.ch,h.ch);else{var d=jn(l,f.line),p=jn(l,h.line),g=hn(d)==hn(p),v=i(f.line,f.ch,g?d.text.length+1:null).end,m=i(h.line,g?0:null,h.ch).start;g&&(v.top0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Ee(e,t){e.doc.mode.startState&&e.doc.frontier=e.display.viewTo)){var r=+new Date+e.options.workTime,n=Jo(t.mode,Re(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var l=o.styles,s=Nn(e,o,n,!0);o.styles=s.styles;var a=o.styleClasses,u=s.classes;u?o.styleClasses=u:a&&(o.styleClasses=null);for(var c=!l||l.length!=o.styles.length||a!=u&&(!a||!u||a.bgClass!=u.bgClass||a.textClass!=u.textClass),f=0;!c&&fr?(Ee(e,e.options.workDelay),!0):void 0}),i.length&&Tt(e,function(){for(var t=0;tl;--s){if(s<=o.first)return o.first;var a=jn(o,s-1);if(a.stateAfter&&(!r||s<=o.frontier))return s;var u=Wl(a.text,null,e.options.tabSize);(null==i||n>u)&&(i=s-1,n=u)}return i}function Re(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=Fe(e,t,r),l=o>n.first&&jn(n,o-1).stateAfter;return l=l?Jo(n.mode,l):el(n.mode),n.iter(o,t,function(r){Wn(e,r.text,l);var s=o==t-1||o%5==0||o>=i.viewFrom&&o2&&o.push((a.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}function _e(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;nr)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Ye(e,t){t=hn(t);var r=$n(t),n=e.display.externalMeasured=new Wt(e.doc,t,r);n.lineN=r;var i=n.built=Dn(e,n);return n.text=i.pre,Fi(e.display.lineMeasure,i.pre),n}function $e(e,t,r,n){return Qe(e,Ze(e,t),r,n)}function qe(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&tt?(i=0,o=1,l="left"):u>t?(i=t-a,o=i+1):(s==e.length-3||t==u&&e[s+3]>t)&&(o=u-a,i=o-1,t>=u&&(l="right")),null!=i){if(n=e[s+2],a==u&&r==(n.insertLeft?"left":"right")&&(l=r),"left"==r&&0==i)for(;s&&e[s-2]==e[s-3]&&e[s-1].insertLeft;)n=e[(s-=3)+2],l="left";if("right"==r&&i==u-a)for(;sc;c++){for(;s&&Ii(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+afo&&0==s&&a==o.coverEnd-o.coverStart)i=l.parentNode.getBoundingClientRect();else if(co&&e.options.lineWrapping){var f=Hl(l,s,a).getClientRects();i=f.length?f["right"==n?f.length-1:0]:Io}else i=Hl(l,s,a).getBoundingClientRect()||Io;if(i.left||i.right||0==s)break;a=s,s-=1,u="right"}co&&11>fo&&(i=tt(e.display.measure,i))}else{s>0&&(u=n="right");var f;i=e.options.lineWrapping&&(f=l.getClientRects()).length>1?f["right"==n?f.length-1:0]:l.getBoundingClientRect()}if(co&&9>fo&&!s&&(!i||!i.left&&!i.right)){var h=l.parentNode.getClientRects()[0];i=h?{left:h.left,right:h.left+vt(e.display),top:h.top,bottom:h.bottom}:Io}for(var d=i.top-t.rect.top,p=i.bottom-t.rect.top,g=(d+p)/2,v=t.view.measure.heights,c=0;cr.from?l(e-1):l(e,n)}n=n||jn(e.doc,t.line),i||(i=Ze(e,n));var a=Qn(n),u=t.ch;if(!a)return l(u);var c=no(a,u),f=s(u,c);return null!=$l&&(f.other=s(u,$l)),f}function ft(e,t){var r=0,t=pe(e.doc,t);e.options.lineWrapping||(r=vt(e.display)*t.ch);var n=jn(e.doc,t.line),i=Zn(n)+Be(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function ht(e,t,r,n){var i=Ao(e,t);return i.xRel=n,r&&(i.outside=!0),i}function dt(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,0>r)return ht(n.first,0,!0,-1);var i=qn(n,r),o=n.first+n.size-1;if(i>o)return ht(n.first+n.size-1,jn(n,o).text.length,!0,1);0>t&&(t=0);for(var l=jn(n,i);;){var s=pt(e,l,i,t,r),a=cn(l),u=a&&a.find(0,!0);if(!a||!(s.ch>u.from.ch||s.ch==u.from.ch&&s.xRel>0))return s;i=$n(l=u.to.line)}}function pt(e,t,r,n,i){function o(n){var i=ct(e,Ao(r,n),"line",t,u);return s=!0,l>i.bottom?i.left-a:lv)return ht(r,d,m,1);for(;;){if(c?d==h||d==oo(t,h,1):1>=d-h){for(var y=p>n||v-n>=n-p?h:d,b=n-(y==h?p:v);Ii(t.text.charAt(y));)++y;var w=ht(r,y,y==h?g:m,-1>b?-1:b>1?1:0);return w}var x=Math.ceil(f/2),C=h+x;if(c){C=h;for(var S=0;x>S;++S)C=oo(t,C,1)}var L=o(C);L>n?(d=C,v=L,(m=s)&&(v+=1e3),f=x):(h=C,p=L,g=s,f-=x)}}function gt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Do){Do=Ei("pre");for(var t=0;49>t;++t)Do.appendChild(document.createTextNode("x")),Do.appendChild(Ei("br"));Do.appendChild(document.createTextNode("x"))}Fi(e.measure,Do);var r=Do.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),zi(e.measure),r||1}function vt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Ei("span","xxxxxxxxxx"),r=Ei("pre",[t]);Fi(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function mt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++zo},Eo?Eo.ops.push(e.curOp):e.curOp.ownsGroup=Eo={ops:[e.curOp],delayedCallbacks:[]}}function yt(e){var t=e.delayedCallbacks,r=0;do{for(;r=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new k(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Ct(e){e.updatedDisplay=e.mustUpdate&&M(e.cm,e.update)}function St(e){var t=e.cm,r=t.display;e.updatedDisplay&&O(t),e.barMeasure=p(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=$e(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Ve(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Ke(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Lt(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLefto;o=n){var l=new Wt(e.doc,jn(e.doc,o),o);n=o+l.size,i.push(l)}return i}function Dt(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)No&&pn(e.doc,t)i.viewFrom?Pt(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)Pt(e);else if(t<=i.viewFrom){var o=Et(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):Pt(e)}else if(r>=i.viewTo){var o=Et(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):Pt(e)}else{var l=Et(e,t,t,-1),s=Et(e,r,r+n,1);l&&s?(i.view=i.view.slice(0,l.index).concat(Ot(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=n):Pt(e)}var a=i.externalMeasured;a&&(r=i.lineN&&t=n.viewTo)){var o=n.view[It(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==Mi(l,r)&&l.push(r)}}}function Pt(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function It(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var r=e.display.view,n=0;nt)return n}function Et(e,t,r,n){var i,o=It(e,t),l=e.display.view;if(!No||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=0,a=e.display.viewFrom;o>s;s++)a+=l[s].size;if(a!=t){if(n>0){if(o==l.length-1)return null;i=a+l[o].size-t,o++}else i=a-t;t+=i,r+=i}for(;pn(e.doc,r)!=r;){if(o==(0>n?0:l.length-1))return null;r+=n*l[o-(0>n?1:0)].size,o+=n}return{index:o,lineN:r}}function zt(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=Ot(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Ot(e,t,n.viewFrom).concat(n.view):n.viewFromr&&(n.view=n.view.slice(0,It(e,r)))),n.viewTo=r}function Ft(e){for(var t=e.display.view,r=0,n=0;n400}function i(t){bi(e,t)||wl(t)}var o=e.display;xl(o.scroller,"mousedown",Mt(e,Vt)),co&&11>fo?xl(o.scroller,"dblclick",Mt(e,function(t){if(!bi(e,t)){var r=Ut(e,t);if(r&&!Yt(e,t)&&!Gt(e.display,t)){yl(t);var n=e.findWordAt(r);be(e.doc,n.anchor,n.head)}}})):xl(o.scroller,"dblclick",function(t){bi(e,t)||yl(t)}),To||xl(o.scroller,"contextmenu",function(t){hr(e,t)});var l,s={end:0};xl(o.scroller,"touchstart",function(e){if(!r(e)){clearTimeout(l);var t=+new Date;o.activeTouch={start:t,moved:!1,prev:t-s.end<=300?s:null},1==e.touches.length&&(o.activeTouch.left=e.touches[0].pageX,o.activeTouch.top=e.touches[0].pageY)}}),xl(o.scroller,"touchmove",function(){o.activeTouch&&(o.activeTouch.moved=!0)}),xl(o.scroller,"touchend",function(r){var i=o.activeTouch;if(i&&!Gt(o,r)&&null!=i.left&&!i.moved&&new Date-i.start<300){var l,s=e.coordsChar(o.activeTouch,"page");l=!i.prev||n(i,i.prev)?new ce(s,s):!i.prev.prev||n(i,i.prev.prev)?e.findWordAt(s):new ce(Ao(s.line,0),pe(e.doc,Ao(s.line+1,0))),e.setSelection(l.anchor,l.head),e.focus(),yl(r)}t()}),xl(o.scroller,"touchcancel",t),xl(o.scroller,"scroll",function(){o.scroller.clientHeight&&(Zt(e,o.scroller.scrollTop),Qt(e,o.scroller.scrollLeft,!0),Sl(e,"scroll",e))}),xl(o.scroller,"mousewheel",function(t){Jt(e,t)}),xl(o.scroller,"DOMMouseScroll",function(t){Jt(e,t)}),xl(o.wrapper,"scroll",function(){o.wrapper.scrollTop=o.wrapper.scrollLeft=0}),e.options.dragDrop&&(xl(o.scroller,"dragstart",function(t){qt(e,t)}),xl(o.scroller,"dragenter",i),xl(o.scroller,"dragover",i),xl(o.scroller,"drop",Mt(e,$t)));var a=o.input.getField();xl(a,"keyup",function(t){sr.call(e,t)}),xl(a,"keydown",Mt(e,or)),xl(a,"keypress",Mt(e,ar)),xl(a,"focus",Di(cr,e)),xl(a,"blur",Di(fr,e))}function Bt(e){var t=e.display;(t.lastWrapHeight!=t.wrapper.clientHeight||t.lastWrapWidth!=t.wrapper.clientWidth)&&(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Gt(e,t){for(var r=gi(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function Ut(e,t,r,n){var i=e.display;if(!r&&"true"==gi(t).getAttribute("cm-not-content"))return null;var o,l,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,l=t.clientY-s.top}catch(t){return null}var a,u=dt(e,o,l);if(n&&1==u.xRel&&(a=jn(e.doc,u.line).text).length==u.ch){var c=Wl(a,a.length,e.options.tabSize)-a.length;u=Ao(u.line,Math.max(0,Math.round((o-Ue(e.display).left)/vt(e.display))-c))}return u}function Vt(e){var t=this,r=t.display;if(!(r.activeTouch&&r.input.supportsTouch()||bi(t,e))){if(r.shift=e.shiftKey,Gt(r,e))return void(ho||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!Yt(t,e)){var n=Ut(t,e);switch(window.focus(),vi(e)){case 1:n?Kt(t,e,n):gi(e)==r.scroller&&yl(e);break;case 2:ho&&(t.state.lastMiddleDown=+new Date),n&&be(t.doc,n),setTimeout(function(){r.input.focus()},20),yl(e);break;case 3:To?hr(t,e):ur(t)}}}}function Kt(e,t,r){co?setTimeout(Di(q,e),0):q(e);var n,i=+new Date;Po&&Po.time>i-400&&0==Wo(Po.pos,r)?n="triple":Ho&&Ho.time>i-400&&0==Wo(Ho.pos,r)?(n="double",Po={time:i,pos:r}):(n="single",Ho={time:i,pos:r});var o,l=e.doc.sel,s=Co?t.metaKey:t.ctrlKey;e.options.dragDrop&&Vl&&!Z(e)&&"single"==n&&(o=l.contains(r))>-1&&!l.ranges[o].empty()?jt(e,t,r,s):Xt(e,t,r,n,s)}function jt(e,t,r,n){var i=e.display,o=Mt(e,function(l){ho&&(i.scroller.draggable=!1),e.state.draggingText=!1,Cl(document,"mouseup",o),Cl(i.scroller,"drop",o),Math.abs(t.clientX-l.clientX)+Math.abs(t.clientY-l.clientY)<10&&(yl(l),n||be(e.doc,r),ho||co&&9==fo?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())});ho&&(i.scroller.draggable=!0),e.state.draggingText=o,i.scroller.dragDrop&&i.scroller.dragDrop(),xl(document,"mouseup",o),xl(i.scroller,"drop",o)}function Xt(e,t,r,n,i){function o(t){if(0!=Wo(v,t))if(v=t,"rect"==n){for(var i=[],o=e.options.tabSize,l=Wl(jn(u,r.line).text,r.ch,o),s=Wl(jn(u,t.line).text,t.ch,o),a=Math.min(l,s),d=Math.max(l,s),p=Math.min(r.line,t.line),g=Math.min(e.lastLine(),Math.max(r.line,t.line));g>=p;p++){var m=jn(u,p).text,y=Li(m,a,o);a==d?i.push(new ce(Ao(p,y),Ao(p,y))):m.length>y&&i.push(new ce(Ao(p,y),Ao(p,Li(m,d,o))))}i.length||i.push(new ce(r,r)),ke(u,fe(h.ranges.slice(0,f).concat(i),f),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=c,w=b.anchor,x=t;if("single"!=n){if("double"==n)var C=e.findWordAt(t);else var C=new ce(Ao(t.line,0),pe(u,Ao(t.line+1,0)));Wo(C.anchor,w)>0?(x=C.head,w=$(b.from(),C.anchor)):(x=C.anchor,w=Y(b.to(),C.head))}var i=h.ranges.slice(0);i[f]=new ce(pe(u,w),x),ke(u,fe(i,f),Nl)}}function l(t){var r=++y,i=Ut(e,t,!0,"rect"==n);if(i)if(0!=Wo(i,v)){q(e),o(i);var s=w(a,u);(i.line>=s.to||i.linem.bottom?20:0;c&&setTimeout(Mt(e,function(){y==r&&(a.scroller.scrollTop+=c,l(t))}),50)}}function s(e){y=1/0,yl(e),a.input.focus(),Cl(document,"mousemove",b),Cl(document,"mouseup",x),u.history.lastSelOrigin=null}var a=e.display,u=e.doc;yl(t);var c,f,h=u.sel,d=h.ranges;if(i&&!t.shiftKey?(f=u.sel.contains(r),c=f>-1?d[f]:new ce(r,r)):(c=u.sel.primary(),f=u.sel.primIndex),t.altKey)n="rect",i||(c=new ce(r,r)),r=Ut(e,t,!0,!0),f=-1;else if("double"==n){var p=e.findWordAt(r);c=e.display.shift||u.extend?ye(u,c,p.anchor,p.head):p}else if("triple"==n){var g=new ce(Ao(r.line,0),pe(u,Ao(r.line+1,0)));c=e.display.shift||u.extend?ye(u,c,g.anchor,g.head):g}else c=ye(u,c,r);i?-1==f?(f=d.length,ke(u,fe(d.concat([c]),f),{scroll:!1,origin:"*mouse"})):d.length>1&&d[f].empty()&&"single"==n&&!t.shiftKey?(ke(u,fe(d.slice(0,f).concat(d.slice(f+1)),0)),h=u.sel):xe(u,f,c,Nl):(f=0,ke(u,new ue([c],0),Nl),h=u.sel);var v=r,m=a.wrapper.getBoundingClientRect(),y=0,b=Mt(e,function(e){vi(e)?l(e):s(e)}),x=Mt(e,s);xl(document,"mousemove",b),xl(document,"mouseup",x)}function _t(e,t,r,n,i){try{var o=t.clientX,l=t.clientY}catch(t){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&yl(t);var s=e.display,a=s.lineDiv.getBoundingClientRect();if(l>a.bottom||!xi(e,r))return pi(t);l-=a.top-s.viewOffset;for(var u=0;u=o){var f=qn(e.doc,l),h=e.options.gutters[u];return i(e,r,e,f,h,t),pi(t)}}}function Yt(e,t){return _t(e,t,"gutterClick",!0,mi)}function $t(e){var t=this;if(!bi(t,e)&&!Gt(t.display,e)){yl(e),co&&(Fo=+new Date);var r=Ut(t,e,!0),n=e.dataTransfer.files;if(r&&!Z(t))if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),l=0,s=function(e,n){var s=new FileReader;s.onload=Mt(t,function(){if(o[n]=s.result,++l==i){r=pe(t.doc,r);var e={from:r,to:r,text:Kl(o.join("\n")),origin:"paste"};br(t.doc,e),Le(t.doc,he(r,Ko(e)))}}),s.readAsText(e)},a=0;i>a;++a)s(n[a],a);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!(Co?e.metaKey:e.ctrlKey))var u=t.listSelections();if(Te(t.doc,he(r,r)),u)for(var a=0;al.clientWidth||i&&l.scrollHeight>l.clientHeight){if(i&&Co&&ho)e:for(var s=t.target,a=o.view;s!=l;s=s.parentNode)for(var u=0;uc?f=Math.max(0,f+c-50):h=Math.min(e.doc.height,h+c+50),A(e,{top:f,bottom:h})}20>Ro&&(null==o.wheelStartX?(o.wheelStartX=l.scrollLeft,o.wheelStartY=l.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=l.scrollLeft-o.wheelStartX,t=l.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&(Bo=(Bo*Ro+r)/(Ro+1),++Ro)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}function er(e,t,r){if("string"==typeof t&&(t=tl[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{Z(e)&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=Tl}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function tr(e,t,r){for(var n=0;nfo&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=nr(t,e);vo&&(Vo=n?r:null,!n&&88==r&&!Xl&&(Co?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||lr(t)}}function lr(e){function t(e){18!=e.keyCode&&e.altKey||(Bl(r,"CodeMirror-crosshair"),Cl(document,"keyup",t),Cl(document,"mouseover",t))}var r=e.display.lineDiv;Gl(r,"CodeMirror-crosshair"),xl(document,"keyup",t),xl(document,"mouseover",t)}function sr(e){16==e.keyCode&&(this.doc.sel.shift=!1),bi(this,e)}function ar(e){var t=this;if(!(Gt(t.display,e)||bi(t,e)||e.ctrlKey&&!e.altKey||Co&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(vo&&r==Vo)return Vo=null,void yl(e);if(!vo||e.which&&!(e.which<10)||!nr(t,e)){var i=String.fromCharCode(null==n?r:n);ir(t,e,i)||t.display.input.onKeyPress(e)}}}function ur(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,fr(e))},100)}function cr(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Sl(e,"focus",e),e.state.focused=!0,Gl(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),ho&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ie(e))}function fr(e){e.state.delayingBlurEvent||(e.state.focused&&(Sl(e,"blur",e),e.state.focused=!1,Bl(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function hr(e,t){Gt(e.display,t)||dr(e,t)||e.display.input.onContextMenu(t)}function dr(e,t){return xi(e,"gutterContextMenu")?_t(e,t,"gutterContextMenu",!1,Sl):!1}function pr(e,t){if(Wo(e,t.from)<0)return e;if(Wo(e,t.to)<=0)return Ko(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Ko(t).ch-t.to.ch),Ao(r,n)}function gr(e,t){for(var r=[],n=0;n=0;--i)wr(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else wr(e,t)}}function wr(e,t){if(1!=t.text.length||""!=t.text[0]||0!=Wo(t.from,t.to)){var r=gr(e,t);ni(e,t,r,e.cm?e.cm.curOp.id:NaN),Sr(e,t,r,Qr(e,t));var n=[];Vn(e,function(e,r){r||-1!=Mi(n,e.history)||(di(e.history,t),n.push(e.history)),Sr(e,t,null,Qr(e,t))})}}function xr(e,t,r){if(!e.cm||!e.cm.state.suppressEdits){for(var n,i=e.history,o=e.sel,l="undo"==t?i.done:i.undone,s="undo"==t?i.undone:i.done,a=0;a=0;--a){var f=n.changes[a];if(f.origin=t,c&&!yr(e,f,!1))return void(l.length=0);u.push(ei(e,f));var h=a?gr(e,f):Ti(l);Sr(e,f,h,en(e,f)),!a&&e.cm&&e.cm.scrollIntoView({from:f.from,to:Ko(f)});var d=[];Vn(e,function(e,t){t||-1!=Mi(d,e.history)||(di(e.history,f),d.push(e.history)),Sr(e,f,null,en(e,f))})}}}}function Cr(e,t){if(0!=t&&(e.first+=t,e.sel=new ue(Ni(e.sel.ranges,function(e){return new ce(Ao(e.anchor.line+t,e.anchor.ch),Ao(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Dt(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;ne.lastLine())){if(t.from.lineo&&(t={from:t.from,to:Ao(o,jn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Xn(e,t.from,t.to),r||(r=gr(e,t)),e.cm?Lr(e.cm,t,n):Bn(e,t,n),Te(e,r,Ml)}}function Lr(e,t,r){var n=e.doc,i=e.display,l=t.from,s=t.to,a=!1,u=l.line;e.options.lineWrapping||(u=$n(hn(jn(n,l.line))),n.iter(u,s.line+1,function(e){return e==i.maxLine?(a=!0,!0):void 0})),n.sel.contains(t.from,t.to)>-1&&wi(e),Bn(n,t,r,o(e)),e.options.lineWrapping||(n.iter(u,l.line+t.text.length,function(e){var t=f(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,a=!1)}),a&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,l.line),Ee(e,400);var c=t.text.length-(s.line-l.line)-1;t.full?Dt(e):l.line!=s.line||1!=t.text.length||Rn(e.doc,t)?Dt(e,l.line,s.line+1,c):Ht(e,l.line,"text");var h=xi(e,"changes"),d=xi(e,"change");if(d||h){var p={from:l,to:s,text:t.text,removed:t.removed,origin:t.origin};d&&mi(e,"change",e,p),h&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}function kr(e,t,r,n,i){if(n||(n=r),Wo(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=Kl(t)),br(e,{from:r,to:n,text:t,origin:i})}function Tr(e,t){if(!bi(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!bo){var o=Ei("div","​",null,"position: absolute; top: "+(t.top-r.viewOffset-Be(e.display))+"px; height: "+(t.bottom-t.top+Ve(e)+r.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function Mr(e,t,r,n){null==n&&(n=0);for(var i=0;5>i;i++){var o=!1,l=ct(e,t),s=r&&r!=t?ct(e,r):l,a=Ar(e,Math.min(l.left,s.left),Math.min(l.top,s.top)-n,Math.max(l.left,s.left),Math.max(l.bottom,s.bottom)+n),u=e.doc.scrollTop,c=e.doc.scrollLeft;if(null!=a.scrollTop&&(Zt(e,a.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(o=!0)),null!=a.scrollLeft&&(Qt(e,a.scrollLeft),Math.abs(e.doc.scrollLeft-c)>1&&(o=!0)),!o)break}return l}function Nr(e,t,r,n,i){var o=Ar(e,t,r,n,i);null!=o.scrollTop&&Zt(e,o.scrollTop),null!=o.scrollLeft&&Qt(e,o.scrollLeft)}function Ar(e,t,r,n,i){var o=e.display,l=gt(e.display);0>r&&(r=0);var s=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,a=je(e),u={};i-r>a&&(i=r+a);var c=e.doc.height+Ge(o),f=l>r,h=i>c-l;if(s>r)u.scrollTop=f?0:r;else if(i>s+a){var d=Math.min(r,(h?c:i)-a);d!=s&&(u.scrollTop=d)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,g=Ke(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),v=n-t>g;return v&&(n=t+g),10>t?u.scrollLeft=0:p>t?u.scrollLeft=Math.max(0,t-(v?0:10)):n>g+p-3&&(u.scrollLeft=n+(v?0:10)-g),u}function Wr(e,t,r){(null!=t||null!=r)&&Dr(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=r&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+r)}function Or(e){Dr(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?Ao(t.line,t.ch-1):t,n=Ao(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function Dr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=ft(e,t.from),n=ft(e,t.to),i=Ar(e,Math.min(r.left,n.left),Math.min(r.top,n.top)-t.margin,Math.max(r.right,n.right),Math.max(r.bottom,n.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function Hr(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=Re(e,t):r="prev");var l=e.options.tabSize,s=jn(o,t),a=Wl(s.text,null,l);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&(u=o.mode.indent(i,s.text.slice(c.length),s.text),u==Tl||u>150)){if(!n)return;r="prev"}}else u=0,r="not";"prev"==r?u=t>o.first?Wl(jn(o,t-1).text,null,l):0:"add"==r?u=a+e.options.indentUnit:"subtract"==r?u=a-e.options.indentUnit:"number"==typeof r&&(u=a+r),u=Math.max(0,u);var f="",h=0;if(e.options.indentWithTabs)for(var d=Math.floor(u/l);d;--d)h+=l,f+=" ";if(u>h&&(f+=ki(u-h)),f!=c)kr(o,f,Ao(t,0),Ao(t,c.length),"+input");else for(var d=0;d=0;t--)kr(e.doc,"",n[t].from,n[t].to,"+delete");Or(e)})}function Er(e,t,r,n,i){function o(){var t=s+r;return t=e.first+e.size?f=!1:(s=t,c=jn(e,t))}function l(e){var t=(i?oo:lo)(c,a,r,!0);if(null==t){if(e||!o())return f=!1;a=i?(0>r?Qi:Zi)(c):0>r?c.text.length:0}else a=t;return!0}var s=t.line,a=t.ch,u=r,c=jn(e,s),f=!0;if("char"==n)l();else if("column"==n)l(!0);else if("word"==n||"group"==n)for(var h=null,d="group"==n,p=e.cm&&e.cm.getHelper(t,"wordChars"),g=!0;!(0>r)||l(!g);g=!1){var v=c.text.charAt(a)||"\n",m=Hi(v,p)?"w":d&&"\n"==v?"n":!d||/\s/.test(v)?null:"p";if(!d||g||m||(m="s"),h&&h!=m){0>r&&(r=1,l());break}if(m&&(h=m),r>0&&!l(!g))break}var y=We(e,Ao(s,a),u,!0);return f||(y.hitSide=!0),y}function zr(e,t,r,n){var i,o=e.doc,l=t.left;if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+r*(s-(0>r?1.5:.5)*gt(e.display))}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;;){var a=dt(e,l,i);if(!a.outside)break;if(0>r?0>=i:i>=o.height){a.hitSide=!0;break}i+=5*r}return a}function Fr(t,r,n,i){e.defaults[t]=r,n&&(Xo[t]=i?function(e,t,r){r!=_o&&n(e,t,r)}:n)}function Rr(e){for(var t,r,n,i,o=e.split(/-(?!$)/),e=o[o.length-1],l=0;l0||0==l&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Ei("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(fn(e,t.line,t,r,o)||t.line!=r.line&&fn(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");No=!0}o.addToHistory&&ni(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var s,a=t.line,u=e.cm;if(e.iter(a,r.line+1,function(e){u&&o.collapsed&&!u.options.lineWrapping&&hn(e)==u.display.maxLine&&(s=!0),o.collapsed&&a!=t.line&&Yn(e,0),$r(e,new Xr(o,a==t.line?t.ch:null,a==r.line?r.ch:null)),++a}),o.collapsed&&e.iter(t.line,r.line+1,function(t){vn(e,t)&&Yn(t,0)}),o.clearOnEnter&&xl(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Mo=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++sl,o.atomic=!0),u){if(s&&(u.curOp.updateMaxLine=!0),o.collapsed)Dt(u,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var c=t.line;c<=r.line;c++)Ht(u,c,"text");o.atomic&&Ne(u.doc),mi(u,"markerAdded",u,o)}return o}function Ur(e,t,r,n,i){n=Oi(n),n.shared=!1;var o=[Gr(e,t,r,n,i)],l=o[0],s=n.widgetNode;return Vn(e,function(e){s&&(n.widgetNode=s.cloneNode(!0)),o.push(Gr(e,pe(e,t),pe(e,r),n,i));for(var a=0;a=t:o.to>t);(n||(n=[])).push(new Xr(l,o.from,a?null:o.to))}}return n}function Zr(e,t,r){if(e)for(var n,i=0;i=t:o.to>t);if(s||o.from==t&&"bookmark"==l.type&&(!r||o.marker.insertLeft)){var a=null==o.from||(l.inclusiveLeft?o.from<=t:o.from0&&s)for(var f=0;ff;++f)p.push(g);p.push(a)}return p}function Jr(e){for(var t=0;t0)){var c=[a,1],f=Wo(u.from,s.from),h=Wo(u.to,s.to);(0>f||!l.inclusiveLeft&&!f)&&c.push({from:u.from,to:s.from}),(h>0||!l.inclusiveRight&&!h)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),a+=c.length-1}}return i}function rn(e){var t=e.markedSpans;if(t){for(var r=0;r=0&&0>=f||0>=c&&f>=0)&&(0>=c&&(Wo(u.to,r)>0||a.marker.inclusiveRight&&i.inclusiveLeft)||c>=0&&(Wo(u.from,n)<0||a.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function hn(e){for(var t;t=un(e);)e=t.find(-1,!0).line;return e}function dn(e){for(var t,r;t=cn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function pn(e,t){var r=jn(e,t),n=hn(r);return r==n?t:$n(n)}function gn(e,t){if(t>e.lastLine())return t;var r,n=jn(e,t);if(!vn(e,n))return t;for(;r=cn(n);)n=r.find(1,!0).line;return $n(n)+1}function vn(e,t){var r=No&&t.markedSpans;if(r)for(var n,i=0;io;o++){i&&(i[0]=e.innerMode(t,n).mode);var l=t.token(r,n);if(r.pos>r.start)return l}throw new Error("Mode "+t.name+" failed to advance stream.")}function Tn(e,t,r,n){function i(e){return{start:f.start,end:f.pos,string:f.current(),type:o||null,state:e?Jo(l.mode,c):c}}var o,l=e.doc,s=l.mode;t=pe(l,t);var a,u=jn(l,t.line),c=Re(e,t.line,r),f=new ll(u.text,e.options.tabSize);for(n&&(a=[]);(n||f.pose.options.maxHighlightLength?(s=!1,l&&Wn(e,t,n,f.pos),f.pos=t.length,a=null):a=Sn(kn(r,f,n,h),o),h){var d=h[0].name;d&&(a="m-"+(a?d+" "+a:d))}if(!s||c!=a){for(;uu;){var n=i[a];n>e&&i.splice(a,1,e,i[a+1],n),a+=2,u=Math.min(e,n)}if(t)if(s.opaque)i.splice(r,a-r,e,"cm-overlay "+t),a=r+2;else for(;a>r;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function An(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Nn(e,t,t.stateAfter=Re(e,$n(t)));t.styles=n.styles,n.classes?t.styleClasses=n.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.frontier&&e.doc.frontier++}return t.styles}function Wn(e,t,r,n){var i=e.doc.mode,o=new ll(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&Ln(i,r);!o.eol()&&o.pos<=e.options.maxHighlightLength;)kn(i,o,r),o.start=o.pos}function On(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?dl:hl;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Dn(e,t){var r=Ei("span",null,null,ho?"padding-right: .1px":null),n={pre:Ei("pre",[r]),content:r,col:0,pos:0,cm:e,splitSpaces:(co||ho)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,l=i?t.rest[i-1]:t.line;n.pos=0,n.addToken=Pn,Xi(e.display.measure)&&(o=Qn(l))&&(n.addToken=En(n.addToken,o)),n.map=[];var s=t!=e.display.externalMeasured&&$n(l);Fn(l,n,An(e,l,s)),l.styleClasses&&(l.styleClasses.bgClass&&(n.bgClass=Gi(l.styleClasses.bgClass,n.bgClass||"")),l.styleClasses.textClass&&(n.textClass=Gi(l.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(ji(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return ho&&/\bcm-tab\b/.test(n.content.lastChild.className)&&(n.content.className="cm-tab-wrap-hack"),Sl(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=Gi(n.pre.className,n.textClass||"")),n}function Hn(e){var t=Ei("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Pn(e,t,r,n,i,o,l){if(t){var s=e.splitSpaces?t.replace(/ {3,}/g,In):t,a=e.cm.state.specialChars,u=!1;if(a.test(t))for(var c=document.createDocumentFragment(),f=0;;){a.lastIndex=f;var h=a.exec(t),d=h?h.index-f:t.length-f;if(d){var p=document.createTextNode(s.slice(f,f+d));co&&9>fo?c.appendChild(Ei("span",[p])):c.appendChild(p),e.map.push(e.pos,e.pos+d,p),e.col+=d,e.pos+=d}if(!h)break;if(f+=d+1," "==h[0]){var g=e.cm.options.tabSize,v=g-e.col%g,p=c.appendChild(Ei("span",ki(v),"cm-tab"));p.setAttribute("role","presentation"),p.setAttribute("cm-text"," "),e.col+=v}else{var p=e.cm.options.specialCharPlaceholder(h[0]);p.setAttribute("cm-text",h[0]),co&&9>fo?c.appendChild(Ei("span",[p])):c.appendChild(p),e.col+=1}e.map.push(e.pos,e.pos+1,p),e.pos++}else{e.col+=t.length;var c=document.createTextNode(s);e.map.push(e.pos,e.pos+t.length,c),co&&9>fo&&(u=!0),e.pos+=t.length}if(r||n||i||u||l){var m=r||"";n&&(m+=n),i&&(m+=i);var y=Ei("span",[c],m,l);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(c)}}function In(e){for(var t=" ",r=0;ru&&h.from<=u)break}if(h.to>=c)return e(r,n,i,o,l,s,a);e(r,n.slice(0,h.to-u),i,o,null,s,a),o=null,n=n.slice(h.to-u),u=h.to}}}function zn(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t}function Fn(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var l,s,a,u,c,f,h,d=i.length,p=0,g=1,v="",m=0;;){if(m==p){a=u=c=f=s="",h=null,m=1/0;for(var y=[],b=0;bp)?(null!=w.to&&m>w.to&&(m=w.to,u=""),x.className&&(a+=" "+x.className),x.css&&(s=x.css),x.startStyle&&w.from==p&&(c+=" "+x.startStyle),x.endStyle&&w.to==m&&(u+=" "+x.endStyle),x.title&&!f&&(f=x.title),x.collapsed&&(!h||sn(h.marker,x)<0)&&(h=w)):w.from>p&&m>w.from&&(m=w.from),"bookmark"==x.type&&w.from==p&&x.widgetNode&&y.push(x)}if(h&&(h.from||0)==p&&(zn(t,(null==h.to?d+1:h.to)-p,h.marker,null==h.from),null==h.to))return;if(!h&&y.length)for(var b=0;b=d)break;for(var C=Math.min(d,m);;){if(v){var S=p+v.length;if(!h){var L=S>C?v.slice(0,C-p):v;t.addToken(t,L,l?l+a:a,c,p+L.length==m?u:"",f,s)}if(S>=C){v=v.slice(C-p),p=C;break}p=S,c=""}v=i.slice(o,o=r[g++]),l=On(r[g++],t.cm.options)}}else for(var g=1;gr;++r)o.push(new fl(u[r],i(r),n));return o}var s=t.from,a=t.to,u=t.text,c=jn(e,s.line),f=jn(e,a.line),h=Ti(u),d=i(u.length-1),p=a.line-s.line;if(t.full)e.insert(0,l(0,u.length)),e.remove(u.length,e.size-u.length);else if(Rn(e,t)){var g=l(0,u.length-1);o(f,f.text,d),p&&e.remove(s.line,p),g.length&&e.insert(s.line,g)}else if(c==f)if(1==u.length)o(c,c.text.slice(0,s.ch)+h+c.text.slice(a.ch),d);else{var g=l(1,u.length-1);g.push(new fl(h+c.text.slice(a.ch),d,n)),o(c,c.text.slice(0,s.ch)+u[0],i(0)),e.insert(s.line+1,g)}else if(1==u.length)o(c,c.text.slice(0,s.ch)+u[0]+f.text.slice(a.ch),i(0)),e.remove(s.line+1,p);else{o(c,c.text.slice(0,s.ch)+u[0],i(0)),o(f,h+f.text.slice(a.ch),d);var g=l(1,u.length-1);p>1&&e.remove(s.line+1,p-1),e.insert(s.line+1,g)}mi(e,"change",e,t)}function Gn(e){this.lines=e,this.parent=null;for(var t=0,r=0;tt||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(o>t){r=i;break}t-=o}return r.lines[t]}function Xn(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function _n(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function Yn(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function $n(e){if(null==e.parent)return null;for(var t=e.parent,r=Mi(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function qn(e,t){var r=e.first;e:do{for(var n=0;nt){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var n=0;nt)break;t-=s}return r+n}function Zn(e){e=hn(e);for(var t=0,r=e.parent,n=0;n1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Ti(e.done)):void 0}function ni(e,t,r,n){var i=e.history;i.undone.length=0;var o,l=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>l-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=ri(i,i.lastOp==n))){var s=Ti(o.changes);0==Wo(t.from,t.to)&&0==Wo(t.from,s.to)?s.to=Ko(t):o.changes.push(ei(e,t))}else{var a=Ti(i.done);for(a&&a.ranges||li(e.sel,i.done),o={changes:[ei(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,s||Sl(e,"historyAdded")}function ii(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function oi(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||ii(e,o,Ti(i.done),t))?i.done[i.done.length-1]=t:li(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&n.clearRedo!==!1&&ti(i.undone)}function li(e,t){var r=Ti(t);r&&r.ranges&&r.equals(e)||t.push(e)}function si(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function ai(e){if(!e)return null;for(var t,r=0;r-1&&(Ti(s)[f]=c[f],delete c[f])}}}return i}function fi(e,t,r,n){r0}function Ci(e){e.prototype.on=function(e,t){xl(this,e,t)},e.prototype.off=function(e,t){Cl(this,e,t)}}function Si(){this.id=null}function Li(e,t,r){for(var n=0,i=0;;){var o=e.indexOf(" ",n);-1==o&&(o=e.length);var l=o-n;if(o==e.length||i+l>=t)return n+Math.min(l,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}}function ki(e){for(;Ol.length<=e;)Ol.push(Ti(Ol)+" ");return Ol[e]}function Ti(e){return e[e.length-1]}function Mi(e,t){for(var r=0;r-1&&Il(e)?!0:t.test(e):Il(e)}function Pi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Ii(e){return e.charCodeAt(0)>=768&&El.test(e)}function Ei(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o0;--t)e.removeChild(e.firstChild);return e}function Fi(e,t){return zi(e).appendChild(t)}function Ri(){return document.activeElement}function Bi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function Gi(e,t){for(var r=e.split(" "),n=0;n2&&!(co&&8>fo))}var r=Fl?Ei("span","​"):Ei("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Xi(e){if(null!=Rl)return Rl;var t=Fi(e,document.createTextNode("AخA")),r=Hl(t,0,1).getBoundingClientRect();if(!r||r.left==r.right)return!1;var n=Hl(t,1,2).getBoundingClientRect();return Rl=n.right-r.right<3}function _i(e){if(null!=_l)return _l;var t=Fi(e,Ei("span","x")),r=t.getBoundingClientRect(),n=Hl(t,0,1).getBoundingClientRect();return _l=Math.abs(r.left-n.left)>1}function Yi(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;ot||t==r&&l.to==t)&&(n(Math.max(l.from,t),Math.min(l.to,r),1==l.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function $i(e){return e.level%2?e.to:e.from}function qi(e){return e.level%2?e.from:e.to}function Zi(e){var t=Qn(e);return t?$i(t[0]):0}function Qi(e){var t=Qn(e);return t?qi(Ti(t)):e.text.length}function Ji(e,t){var r=jn(e.doc,t),n=hn(r);n!=r&&(t=$n(n));var i=Qn(n),o=i?i[0].level%2?Qi(n):Zi(n):0;return Ao(t,o)}function eo(e,t){for(var r,n=jn(e.doc,t);r=cn(n);)n=r.find(1,!0).line,t=null;var i=Qn(n),o=i?i[0].level%2?Zi(n):Qi(n):n.text.length;return Ao(null==t?$n(n):t,o)}function to(e,t){var r=Ji(e,t.line),n=jn(e.doc,r.line),i=Qn(n);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),l=t.line==r.line&&t.ch<=o&&t.ch;return Ao(r.line,l?0:o)}return r}function ro(e,t,r){var n=e[0].level;return t==n?!0:r==n?!1:r>t}function no(e,t){$l=null;for(var r,n=0;nt)return n;if(i.from==t||i.to==t){if(null!=r)return ro(e,i.level,e[r].level)?(i.from!=i.to&&($l=r),n):(i.from!=i.to&&($l=n),r);r=n}}return r}function io(e,t,r,n){if(!n)return t+r;do t+=r;while(t>0&&Ii(e.text.charAt(t)));return t}function oo(e,t,r,n){var i=Qn(e);if(!i)return lo(e,t,r,n);for(var o=no(i,t),l=i[o],s=io(e,t,l.level%2?-r:r,n);;){if(s>l.from&&s0==l.level%2?l.to:l.from);if(l=i[o+=r],!l)return null;s=r>0==l.level%2?io(e,l.to,-1,n):io(e,l.from,1,n)}}function lo(e,t,r,n){var i=t+r;if(n)for(;i>0&&Ii(e.text.charAt(i));)i+=r;return 0>i||i>e.text.length?null:i}var so=/gecko\/\d/i.test(navigator.userAgent),ao=/MSIE \d/.test(navigator.userAgent),uo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),co=ao||uo,fo=co&&(ao?document.documentMode||6:uo[1]),ho=/WebKit\//.test(navigator.userAgent),po=ho&&/Qt\/\d+\.\d+/.test(navigator.userAgent),go=/Chrome\//.test(navigator.userAgent),vo=/Opera\//.test(navigator.userAgent),mo=/Apple Computer/.test(navigator.vendor),yo=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),bo=/PhantomJS/.test(navigator.userAgent),wo=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),xo=wo||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Co=wo||/Mac/.test(navigator.platform),So=/win/i.test(navigator.platform),Lo=vo&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Lo&&(Lo=Number(Lo[1])),Lo&&Lo>=15&&(vo=!1,ho=!0);var ko=Co&&(po||vo&&(null==Lo||12.11>Lo)),To=so||co&&fo>=9,Mo=!1,No=!1;g.prototype=Oi({update:function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+o+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedOverlay&&e.clientHeight>0&&(0==n&&this.overlayHack(),this.checkedOverlay=!0),{right:r?n:0,bottom:t?n:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e)},overlayHack:function(){var e=Co&&!yo?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=e;var t=this,r=function(e){gi(e)!=t.vert&&gi(e)!=t.horiz&&Mt(t.cm,Vt)(e)};xl(this.vert,"mousedown",r),xl(this.horiz,"mousedown",r)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},g.prototype),v.prototype=Oi({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},v.prototype),e.scrollbarModel={"native":g,"null":v},k.prototype.signal=function(e,t){xi(e,t)&&this.events.push(arguments)},k.prototype.finish=function(){for(var e=0;e=9&&r.hasSelection&&(r.hasSelection=null),r.poll()}),xl(o,"paste",function(){if(ho&&!n.state.fakedLastChar&&!(new Date-n.state.lastMiddleDown<200)){var e=o.selectionStart,t=o.selectionEnd;o.value+="$",o.selectionEnd=t,o.selectionStart=e,n.state.fakedLastChar=!0}n.state.pasteIncoming=!0,r.fastPoll()}),xl(o,"cut",t),xl(o,"copy",t),xl(e.scroller,"paste",function(t){Gt(e,t)||(n.state.pasteIncoming=!0,r.focus())}),xl(e.lineSpace,"selectstart",function(t){Gt(e,t)||yl(t)})},prepareSelection:function(){var e=this.cm,t=e.display,r=e.doc,n=De(e);if(e.options.moveInputWithCursor){var i=ct(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return n},showSelection:function(e){var t=this.cm,r=t.display;Fi(r.cursorDiv,e.cursors),Fi(r.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t,r,n=this.cm,i=n.doc;if(n.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=Xl&&(o.to().line-o.from().line>100||(r=n.getSelection()).length>1e3);var l=t?"-":r||n.getSelection();this.textarea.value=l,n.state.focused&&Dl(this.textarea),co&&fo>=9&&(this.hasSelection=l)}else e||(this.prevInput=this.textarea.value="",co&&fo>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!xo||Ri()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var n=r.poll();n||t?(r.pollingFast=!1,r.slowPoll()):(t=!0,r.polling.set(60,e))}var t=!1,r=this;r.pollingFast=!0,r.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,r=this.prevInput;if(!e.state.focused||jl(t)&&!r||Z(e)||e.options.disableInput||e.state.keySeq)return!1;e.state.pasteIncoming&&e.state.fakedLastChar&&(t.value=t.value.substring(0,t.value.length-1),e.state.fakedLastChar=!1);var n=t.value;if(n==r&&!e.somethingSelected())return!1; -if(co&&fo>=9&&this.hasSelection===n||Co&&/[\uf700-\uf7ff]/.test(n))return e.display.input.reset(),!1;e.doc.sel==e.display.selForContextMenu&&(8203==n.charCodeAt(0)?r||(r="​"):"​"==r&&(n=n.slice(1),r=""));for(var i=0,o=Math.min(r.length,n.length);o>i&&r.charCodeAt(i)==n.charCodeAt(i);)++i;var l=this;return Tt(e,function(){Q(e,n.slice(i),r.length-i),n.length>1e3||n.indexOf("\n")>-1?t.value=l.prevInput="":l.prevInput=n}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){co&&fo>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=l.selectionStart){var e=i.somethingSelected(),t=l.value="​"+(e?l.value:"");n.prevInput=e?"":"​",l.selectionStart=1,l.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function r(){if(n.contextMenuPending=!1,n.wrapper.style.position="relative",l.style.cssText=c,co&&9>fo&&o.scrollbars.setScrollTop(o.scroller.scrollTop=a),null!=l.selectionStart){(!co||co&&9>fo)&&t();var e=0,r=function(){o.selForContextMenu==i.doc.sel&&0==l.selectionStart&&"​"==n.prevInput?Mt(i,tl.selectAll)(i):e++<10?o.detectingSelectAll=setTimeout(r,500):o.input.reset()};o.detectingSelectAll=setTimeout(r,200)}}var n=this,i=n.cm,o=i.display,l=n.textarea,s=Ut(i,e),a=o.scroller.scrollTop;if(s&&!vo){var u=i.options.resetSelectionOnContextMenu;u&&-1==i.doc.sel.contains(s)&&Mt(i,ke)(i.doc,he(s),Ml);var c=l.style.cssText;if(n.wrapper.style.position="absolute",l.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(co?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",ho)var f=window.scrollY;if(o.input.focus(),ho&&window.scrollTo(null,f),o.input.reset(),i.somethingSelected()||(l.value=n.prevInput=" "),n.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),co&&fo>=9&&t(),To){wl(e);var h=function(){Cl(window,"mouseup",h),setTimeout(r,20)};xl(window,"mouseup",h)}else setTimeout(r,50)}},setUneditable:Ai,needsContentAttribute:!1},te.prototype),ne.prototype=Oi({init:function(e){function t(e){if(n.somethingSelected())Oo=n.getSelections(),"cut"==e.type&&n.replaceSelection("",null,"cut");else{var t=J(n);Oo=t.text,"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,Ml),n.replaceSelection("",null,"cut")})}if(e.clipboardData&&!wo)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Oo.join("\n"));else{var r=re(),i=r.firstChild;n.display.lineSpace.insertBefore(r,n.display.lineSpace.firstChild),i.value=Oo.join("\n");var o=document.activeElement;Dl(i),setTimeout(function(){n.display.lineSpace.removeChild(r),o.focus()},50)}}var r=this,n=r.cm,i=r.div=e.lineDiv;i.contentEditable="true",ee(i),xl(i,"paste",function(e){var t=e.clipboardData&&e.clipboardData.getData("text/plain");t&&(e.preventDefault(),n.replaceSelection(t,null,"paste"))}),xl(i,"compositionstart",function(e){var t=e.data;if(r.composing={sel:n.doc.sel,data:t,startData:t},t){var i=n.doc.sel.primary(),o=n.getLine(i.head.line),l=o.indexOf(t,Math.max(0,i.head.ch-t.length));l>-1&&l<=i.head.ch&&(r.composing.sel=he(Ao(i.head.line,l),Ao(i.head.line,l+t.length)))}}),xl(i,"compositionupdate",function(e){r.composing.data=e.data}),xl(i,"compositionend",function(e){var t=r.composing;t&&(e.data==t.startData||/\u200b/.test(e.data)||(t.data=e.data),setTimeout(function(){t.handled||r.applyComposition(t),r.composing==t&&(r.composing=null)},50))}),xl(i,"touchstart",function(){r.forceCompositionEnd()}),xl(i,"input",function(){r.composing||r.pollContent()||Tt(r.cm,function(){Dt(n)})}),xl(i,"copy",t),xl(i,"cut",t)},prepareSelection:function(){var e=De(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e){e&&this.cm.display.view.length&&(e.focus&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),r=le(this.cm,e.anchorNode,e.anchorOffset),n=le(this.cm,e.focusNode,e.focusOffset);if(!r||r.bad||!n||n.bad||0!=Wo($(r,n),t.from())||0!=Wo(Y(r,n),t.to())){var i=ie(this.cm,t.from()),o=ie(this.cm,t.to());if(i||o){var l=this.cm.display.view,s=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var a=l[l.length-1].measure,u=a.maps?a.maps[a.maps.length-1]:a.map;o={node:u[u.length-1],offset:u[u.length-2]-u[u.length-3]}}}else i={node:l[0].measure.map[2],offset:0};try{var c=Hl(i.node,i.offset,o.offset,o.node)}catch(f){}c&&(e.removeAllRanges(),e.addRange(c),s&&null==e.anchorNode?e.addRange(s):so&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){Fi(this.cm.display.cursorDiv,e.cursors),Fi(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return zl(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():Tt(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var r=le(t,e.anchorNode,e.anchorOffset),n=le(t,e.focusNode,e.focusOffset);r&&n&&Tt(t,function(){ke(t.doc,he(r,n),Ml),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}},pollContent:function(){var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),i=r.to();if(n.linet.viewTo-1)return!1;var o;if(n.line==t.viewFrom||0==(o=It(e,n.line)))var l=$n(t.view[0].line),s=t.view[0].node;else var l=$n(t.view[o].line),s=t.view[o-1].node.nextSibling;var a=It(e,i.line);if(a==t.view.length-1)var u=t.viewTo-1,c=t.view[a].node;else var u=$n(t.view[a+1].line)-1,c=t.view[a+1].node.previousSibling;for(var f=Kl(ae(e,s,c,l,u)),h=Xn(e.doc,Ao(l,0),Ao(u,jn(e.doc,u).text.length));f.length>1&&h.length>1;)if(Ti(f)==Ti(h))f.pop(),h.pop(),u--;else{if(f[0]!=h[0])break;f.shift(),h.shift(),l++}for(var d=0,p=0,g=f[0],v=h[0],m=Math.min(g.length,v.length);m>d&&g.charCodeAt(d)==v.charCodeAt(d);)++d;for(var y=Ti(f),b=Ti(h),w=Math.min(y.length-(1==f.length?d:0),b.length-(1==h.length?d:0));w>p&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;f[f.length-1]=y.slice(0,y.length-p),f[0]=f[0].slice(d);var x=Ao(l,d),C=Ao(u,h.length?Ti(h).length-p:0);return f.length>1||f[0]||Wo(x,C)?(kr(e.doc,f,x,C,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){e.data&&e.data!=e.startData&&Mt(this.cm,Q)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.setAttribute("contenteditable","false")},onKeyPress:function(e){e.preventDefault(),Mt(this.cm,Q)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},onContextMenu:Ai,resetPosition:Ai,needsContentAttribute:!0},ne.prototype),e.inputStyles={textarea:te,contenteditable:ne},ue.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t=0&&Wo(e,n.to())<=0)return r}return-1}},ce.prototype={from:function(){return $(this.anchor,this.head)},to:function(){return Y(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Do,Ho,Po,Io={left:0,right:0,top:0,bottom:0},Eo=null,zo=0,Fo=0,Ro=0,Bo=null;co?Bo=-.53:so?Bo=15:go?Bo=-.7:mo&&(Bo=-1/3);var Go=function(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}};e.wheelEventPixels=function(e){var t=Go(e);return t.x*=Bo,t.y*=Bo,t};var Uo=new Si,Vo=null,Ko=e.changeEnd=function(e){return e.text?Ao(e.from.line+e.text.length-1,Ti(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var r=this.options,n=r[e];(r[e]!=t||"mode"==e)&&(r[e]=t,Xo.hasOwnProperty(e)&&Mt(this,Xo[e])(this,t,n))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Br(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;rr&&(Hr(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&Or(this));else{var o=i.from(),l=i.to(),s=Math.max(r,o.line);r=Math.min(this.lastLine(),l.line-(l.ch?0:1))+1;for(var a=s;r>a;++a)Hr(this,a,e);var u=this.doc.sel.ranges;0==o.ch&&t.length==u.length&&u[n].from().ch>0&&xe(this.doc,n,new ce(o,u[n].to()),Ml)}}}),getTokenAt:function(e,t){return Tn(this,e,t)},getLineTokens:function(e,t){return Tn(this,Ao(e),t,!0)},getTokenTypeAt:function(e){e=pe(this.doc,e);var t,r=An(this,jn(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var l=n+i>>1;if((l?r[2*l-1]:0)>=o)i=l;else{if(!(r[2*l+1]s?t:0==s?null:t.slice(0,s-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!Qo.hasOwnProperty(t))return r;var n=Qo[t],i=this.getModeAt(e);if("string"==typeof i[t])n[i[t]]&&r.push(n[i[t]]);else if(i[t])for(var o=0;on&&(e=n,r=!0);var i=jn(this.doc,e);return st(this,i,{top:0,left:0},t||"page").top+(r?this.doc.height-Zn(i):0)},defaultTextHeight:function(){return gt(this.display)},defaultCharWidth:function(){return vt(this.display)},setGutterMarker:Nt(function(e,t,r){return Pr(this.doc,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&Pi(n)&&(e.gutterMarkers=null),!0})}),clearGutter:Nt(function(e){var t=this,r=t.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,Ht(t,n,"gutter"),Pi(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),lineInfo:function(e){if("number"==typeof e){if(!ve(this.doc,e))return null;var t=e;if(e=jn(this.doc,e),!e)return null}else{var t=$n(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display;e=ct(this,pe(this.doc,e));var l=e.bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)l=e.top;else if("above"==n||"near"==n){var a=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>a)&&e.top>t.offsetHeight?l=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=a&&(l=e.bottom),s+t.offsetWidth>u&&(s=u-t.offsetWidth)}t.style.top=l+"px",t.style.left=t.style.right="","right"==i?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),r&&Nr(this,s,l,s+t.offsetWidth,l+t.offsetHeight)},triggerOnKeyDown:Nt(or),triggerOnKeyPress:Nt(ar),triggerOnKeyUp:sr,execCommand:function(e){return tl.hasOwnProperty(e)?tl[e](this):void 0},findPosH:function(e,t,r,n){var i=1;0>t&&(i=-1,t=-t);for(var o=0,l=pe(this.doc,e);t>o&&(l=Er(this.doc,l,i,r,n),!l.hitSide);++o);return l},moveH:Nt(function(e,t){var r=this;r.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?Er(r.doc,n.head,e,t,r.options.rtlMoveVisually):0>e?n.from():n.to()},Al)}),deleteH:Nt(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Ir(this,function(r){var i=Er(n,r.head,e,t,!1);return 0>e?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=1,o=n;0>t&&(i=-1,t=-t);for(var l=0,s=pe(this.doc,e);t>l;++l){var a=ct(this,s,"div");if(null==o?o=a.left:a.left=o,s=zr(this,a,i,r),s.hitSide)break}return s},moveV:Nt(function(e,t){var r=this,n=this.doc,i=[],o=!r.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(l){if(o)return 0>e?l.from():l.to();var s=ct(r,l.head,"div");null!=l.goalColumn&&(s.left=l.goalColumn),i.push(s.left);var a=zr(r,s,e,t);return"page"==t&&l==n.sel.primary()&&Wr(r,null,ut(r,a,"div").top-s.top),a},Al),i.length)for(var l=0;l0&&s(r.charAt(n-1));)--n;for(;i.5)&&l(this),Sl(this,"refresh",this)}),swapDoc:Nt(function(e){var t=this.doc;return t.cm=null,Kn(this,e),it(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,mi(this,"swapDoc",this,t),t}),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}},Ci(e);var jo=e.defaults={},Xo=e.optionHandlers={},_o=e.Init={toString:function(){return"CodeMirror.Init"}};Fr("value","",function(e,t){e.setValue(t)},!0),Fr("mode",null,function(e,t){e.doc.modeOption=t,r(e)},!0),Fr("indentUnit",2,r,!0),Fr("indentWithTabs",!1),Fr("smartIndent",!0),Fr("tabSize",4,function(e){n(e),it(e),Dt(e)},!0),Fr("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,r,n){t.state.specialChars=new RegExp(r.source+(r.test(" ")?"":"| "),"g"),n!=e.Init&&t.refresh()}),Fr("specialCharPlaceholder",Hn,function(e){e.refresh()},!0),Fr("electricChars",!0),Fr("inputStyle",xo?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Fr("rtlMoveVisually",!So),Fr("wholeLineUpdateBefore",!0),Fr("theme","default",function(e){s(e),a(e)},!0),Fr("keyMap","default",function(t,r,n){var i=Br(r),o=n!=e.Init&&Br(n);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),Fr("extraKeys",null),Fr("lineWrapping",!1,i,!0),Fr("gutters",[],function(e){d(e.options),a(e)},!0),Fr("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?L(e.display)+"px":"0",e.refresh()},!0),Fr("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),Fr("scrollbarStyle","native",function(e){m(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Fr("lineNumbers",!1,function(e){d(e.options),a(e)},!0),Fr("firstLineNumber",1,a,!0),Fr("lineNumberFormatter",function(e){return e},a,!0),Fr("showCursorWhenSelecting",!1,Oe,!0),Fr("resetSelectionOnContextMenu",!0),Fr("readOnly",!1,function(e,t){"nocursor"==t?(fr(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||e.display.input.reset())}),Fr("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Fr("dragDrop",!0),Fr("cursorBlinkRate",530),Fr("cursorScrollMargin",0),Fr("cursorHeight",1,Oe,!0),Fr("singleCursorHeightPerLine",!0,Oe,!0),Fr("workTime",100),Fr("workDelay",100),Fr("flattenSpans",!0,n,!0),Fr("addModeClass",!1,n,!0),Fr("pollInterval",100),Fr("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),Fr("historyEventDelay",1250),Fr("viewportMargin",10,function(e){e.refresh()},!0),Fr("maxHighlightLength",1e4,n,!0),Fr("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Fr("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),Fr("autofocus",null);var Yo=e.modes={},$o=e.mimeModes={};e.defineMode=function(t,r){e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2&&(r.dependencies=Array.prototype.slice.call(arguments,2)),Yo[t]=r},e.defineMIME=function(e,t){$o[e]=t},e.resolveMode=function(t){if("string"==typeof t&&$o.hasOwnProperty(t))t=$o[t];else if(t&&"string"==typeof t.name&&$o.hasOwnProperty(t.name)){var r=$o[t.name];"string"==typeof r&&(r={name:r}),t=Wi(r,t),t.name=r.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,r){var r=e.resolveMode(r),n=Yo[r.name];if(!n)return e.getMode(t,"text/plain");var i=n(t,r);if(qo.hasOwnProperty(r.name)){var o=qo[r.name];for(var l in o)o.hasOwnProperty(l)&&(i.hasOwnProperty(l)&&(i["_"+l]=i[l]),i[l]=o[l])}if(i.name=r.name,r.helperType&&(i.helperType=r.helperType),r.modeProps)for(var l in r.modeProps)i[l]=r.modeProps[l];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var qo=e.modeExtensions={};e.extendMode=function(e,t){var r=qo.hasOwnProperty(e)?qo[e]:qo[e]={};Oi(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){gl.prototype[e]=t},e.defineOption=Fr;var Zo=[];e.defineInitHook=function(e){Zo.push(e)};var Qo=e.helpers={};e.registerHelper=function(t,r,n){Qo.hasOwnProperty(t)||(Qo[t]=e[t]={_global:[]}),Qo[t][r]=n},e.registerGlobalHelper=function(t,r,n,i){e.registerHelper(t,r,i),Qo[t]._global.push({pred:n,val:i})};var Jo=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r},el=e.startState=function(e,t,r){return e.startState?e.startState(t,r):!0};e.innerMode=function(e,t){for(;e.innerMode;){var r=e.innerMode(t);if(!r||r.mode==e)break;t=r.state,e=r.mode}return r||{mode:e,state:t}};var tl=e.commands={selectAll:function(e){e.setSelection(Ao(e.firstLine(),0),Ao(e.lastLine()),Ml)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ml)},killLine:function(e){Ir(e,function(t){if(t.empty()){var r=jn(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)i=new Ao(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),Ao(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=jn(e.doc,i.line-1).text;l&&e.replaceRange(o.charAt(0)+"\n"+l.charAt(l.length-1),Ao(i.line-1,l.length-1),Ao(i.line,1),"+transpose")}r.push(new ce(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){Tt(e,function(){for(var t=e.listSelections().length,r=0;t>r;r++){var n=e.listSelections()[r];e.replaceRange("\n",n.anchor,n.head,"+input"),e.indentLine(n.from().line+1,null,!0),Or(e)}})},toggleOverwrite:function(e){e.toggleOverwrite()}},rl=e.keyMap={};rl.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"},rl.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"},rl.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"},rl.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"]},rl["default"]=Co?rl.macDefault:rl.pcDefault,e.normalizeKeyMap=function(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=Ni(r.split(" "),Rr),o=0;o=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.post},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var sl=0,al=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++sl};Ci(al),al.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&mt(e),xi(this,"clear")){var r=this.find();r&&mi(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=a,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&Dt(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ne(e.doc)),e&&mi(e,"markerCleared",e,this),t&&bt(e),this.parent&&this.parent.clear()}},al.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var r,n,i=0;ir;++r){var i=this.lines[r];this.height-=i.height,Cn(i),mi(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;ne;++e)if(r(this.lines[e]))return!0}},Un.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;re){var o=Math.min(t,i-e),l=n.height;if(n.removeInner(e,o),this.height-=l-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Gn))){var s=[];this.collapse(s),this.children=[new Gn(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t=e){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(;i.lines.length>50;){var l=i.lines.splice(i.lines.length-25,25),s=new Gn(l);i.height-=s.height,this.children.splice(n+1,0,s),s.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Un(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=Mi(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new Un(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;ne){var l=Math.min(t,o-e);if(i.iterN(e,l,r))return!0;if(0==(t-=l))break;e=0}else e-=o}}};var pl=0,gl=e.Doc=function(e,t,r){if(!(this instanceof gl))return new gl(e,t,r);null==r&&(r=0),Un.call(this,[new Gn([new fl("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=r;var n=Ao(r,0);this.sel=he(n),this.history=new Jn(null),this.id=++pl,this.modeOption=t,"string"==typeof e&&(e=Kl(e)),Bn(this,{from:n,to:n,text:e}),ke(this,he(n),Ml)};gl.prototype=Wi(Un.prototype,{constructor:gl,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n=0;o--)br(this,n[o]);s?Le(this,s):this.cm&&Or(this.cm)}),undo:At(function(){xr(this,"undo")}),redo:At(function(){xr(this,"redo")}),undoSelection:At(function(){xr(this,"undo",!0)}),redoSelection:At(function(){xr(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=pe(this,e),t=pe(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var l=o.markedSpans;if(l)for(var s=0;sa.to||null==a.from&&i!=e.line||i==t.line&&a.from>t.ch||r&&!r(a.marker)||n.push(a.marker.parent||a.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;ne?(t=e,!0):(e-=i,void++r)}),pe(this,Ao(r,t))},indexFromPos:function(e){e=pe(this,e);var t=e.ch;return e.linet&&(t=e.from),null!=e.to&&e.tos||s>=t)return l+(t-o);l+=s-o,l+=r-l%r,o=s+1}},Ol=[""],Dl=function(e){e.select()};wo?Dl=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:co&&(Dl=function(e){try{e.select()}catch(t){}});var Hl,Pl=/[\u00df\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Il=e.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Pl.test(e))},El=/[\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]/;Hl=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(i){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var zl=e.contains=function(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do if(11==t.nodeType&&(t=t.host),t==e)return!0;while(t=t.parentNode)};co&&11>fo&&(Ri=function(){try{return document.activeElement}catch(e){return document.body}});var Fl,Rl,Bl=e.rmClass=function(e,t){var r=e.className,n=Bi(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}},Gl=e.addClass=function(e,t){var r=e.className;Bi(t).test(r)||(e.className+=(r?" ":"")+t)},Ul=!1,Vl=function(){if(co&&9>fo)return!1;var e=Ei("div");return"draggable"in e||"dragDrop"in e}(),Kl=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;n>=t;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),t+=l+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},jl=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(r){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},Xl=function(){var e=Ei("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),_l=null,Yl={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",107:"=",109:"-",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"};e.keyNames=Yl,function(){for(var e=0;10>e;e++)Yl[e+48]=Yl[e+96]=String(e);for(var e=65;90>=e;e++)Yl[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)Yl[e+111]=Yl[e+63235]="F"+e}();var $l,ql=function(){function e(e){return 247>=e?r.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?n.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,r){this.level=e,this.from=t,this.to=r}var r="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,l=/[LRr]/,s=/[Lb1n]/,a=/[1n]/,u="L";return function(r){if(!i.test(r))return!1;for(var n,c=r.length,f=[],h=0;c>h;++h)f.push(n=e(r.charCodeAt(h)));for(var h=0,d=u;c>h;++h){var n=f[h];"m"==n?f[h]=d:d=n}for(var h=0,p=u;c>h;++h){var n=f[h];"1"==n&&"r"==p?f[h]="n":l.test(n)&&(p=n,"r"==n&&(f[h]="R"))}for(var h=1,d=f[0];c-1>h;++h){var n=f[h];"+"==n&&"1"==d&&"1"==f[h+1]?f[h]="1":","!=n||d!=f[h+1]||"1"!=d&&"n"!=d||(f[h]=d),d=n}for(var h=0;c>h;++h){var n=f[h];if(","==n)f[h]="N";else if("%"==n){for(var g=h+1;c>g&&"%"==f[g];++g);for(var v=h&&"!"==f[h-1]||c>g&&"1"==f[g]?"1":"N",m=h;g>m;++m)f[m]=v;h=g-1}}for(var h=0,p=u;c>h;++h){var n=f[h];"L"==p&&"1"==n?f[h]="L":l.test(n)&&(p=n)}for(var h=0;c>h;++h)if(o.test(f[h])){for(var g=h+1;c>g&&o.test(f[g]);++g);for(var y="L"==(h?f[h-1]:u),b="L"==(c>g?f[g]:u),v=y||b?"L":"R",m=h;g>m;++m)f[m]=v;h=g-1}for(var w,x=[],h=0;c>h;)if(s.test(f[h])){var C=h;for(++h;c>h&&s.test(f[h]);++h);x.push(new t(0,C,h))}else{var S=h,L=x.length;for(++h;c>h&&"L"!=f[h];++h);for(var m=S;h>m;)if(a.test(f[m])){m>S&&x.splice(L,0,new t(1,S,m));var k=m;for(++m;h>m&&a.test(f[m]);++m);x.splice(L,0,new t(2,k,m)),S=m}else++m;h>S&&x.splice(L,0,new t(1,S,h))}return 1==x[0].level&&(w=r.match(/^\s+/))&&(x[0].from=w[0].length,x.unshift(new t(0,0,w[0].length))),1==Ti(x).level&&(w=r.match(/\s+$/))&&(Ti(x).to-=w[0].length,x.push(new t(0,c-w[0].length,c))),x[0].level!=Ti(x).level&&x.push(new t(x[0].level,c,c)),x}}();return e.version="5.1.0",e}); -!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";function e(e,n){function o(e){return r.parentNode?(r.style.top=Math.max(0,e.clientY-r.offsetHeight-5)+"px",void(r.style.left=e.clientX+5+"px")):t.off(document,"mousemove",o)}var r=document.createElement("div");return r.className="CodeMirror-lint-tooltip",r.appendChild(n.cloneNode(!0)),document.body.appendChild(r),t.on(document,"mousemove",o),o(e),null!=r.style.opacity&&(r.style.opacity=1),r}function n(t){t.parentNode&&t.parentNode.removeChild(t)}function o(t){t.parentNode&&(null==t.style.opacity&&n(t),t.style.opacity=0,setTimeout(function(){n(t)},600))}function r(n,r,i){function a(){t.off(i,"mouseout",a),s&&(o(s),s=null)}var s=e(n,r),u=setInterval(function(){if(s)for(var t=i;;t=t.parentNode){if(t&&11==t.nodeType&&(t=t.host),t==document.body)return;if(!t){a();break}}return s?void 0:clearInterval(u)},400);t.on(i,"mouseout",a)}function i(t,e,n){this.marked=[],this.options=e,this.timeout=null,this.hasGutter=n,this.onMouseOver=function(e){g(t,e)}}function a(e,n){if(n instanceof Function)return{getAnnotations:n};if(n&&n!==!0||(n={}),n.getAnnotations||(n.getAnnotations=e.getHelper(t.Pos(0,0),"lint")),!n.getAnnotations)throw new Error("Required option 'getAnnotations' missing (lint addon)");return n}function s(t){var e=t.state.lint;e.hasGutter&&t.clearGutter(h);for(var n=0;n1,n.options.tooltips))}}o.onUpdateLinting&&o.onUpdateLinting(e,r,t)}function p(t){var e=t.state.lint;e&&(clearTimeout(e.timeout),e.timeout=setTimeout(function(){m(t)},e.options.delay||500))}function v(t,e){var n=e.target||e.srcElement;r(e,f(t),n)}function g(t,e){var n=e.target||e.srcElement;if(/\bCodeMirror-lint-mark-/.test(n.className))for(var o=n.getBoundingClientRect(),r=(o.left+o.right)/2,i=(o.top+o.bottom)/2,a=t.findMarksAt(t.coordsChar({left:r,top:i},"client")),s=0;s0){var A=b.bottom-b.top,x=g.top-(g.bottom-b.top);if(x-A>0)a.style.top=(w=g.top-A)+"px",y=!1;else if(A>H){a.style.height=H-5+"px",a.style.top=(w=g.bottom-b.top)+"px";var T=h.getCursor();s.from.ch!=T.ch&&(g=h.cursorCoords(T),a.style.left=(v=g.left)+"px",b=a.getBoundingClientRect())}}var O=b.left-C;if(O>0&&(b.right-b.left>C&&(a.style.width=C-5+"px",O-=b.right-b.left-C),a.style.left=(v=g.left-O)+"px"),h.addKeyMap(this.keyMap=n(e,{moveFocus:function(t,e){r.changeActive(r.selectedHint+t,e)},setFocus:function(t){r.changeActive(t)},menuSize:function(){return r.screenAmount()},length:f.length,close:function(){e.close()},pick:function(){r.pick()},data:s})),e.options.closeOnUnfocus){var S;h.on("blur",this.onBlur=function(){S=setTimeout(function(){e.close()},100)}),h.on("focus",this.onFocus=function(){clearTimeout(S)})}var N=h.getScrollInfo();return h.on("scroll",this.onScroll=function(){var t=h.getScrollInfo(),i=h.getWrapperElement().getBoundingClientRect(),n=w+N.top-t.top,o=n-(window.pageYOffset||(document.documentElement||document.body).scrollTop);return y||(o+=a.offsetHeight),o<=i.top||o>=i.bottom?e.close():(a.style.top=n+"px",void(a.style.left=v+N.left-t.left+"px"))}),t.on(a,"dblclick",function(t){var e=o(a,t.target||t.srcElement);e&&null!=e.hintId&&(r.changeActive(e.hintId),r.pick())}),t.on(a,"click",function(t){var i=o(a,t.target||t.srcElement);i&&null!=i.hintId&&(r.changeActive(i.hintId),e.options.completeOnSingleClick&&r.pick())}),t.on(a,"mousedown",function(){setTimeout(function(){h.focus()},20)}),t.signal(s,"select",f[0],a.firstChild),!0}var c="CodeMirror-hint",l="CodeMirror-hint-active";t.showHint=function(t,e,i){if(!e)return t.showHint(i);i&&i.async&&(e.async=!0);var n={hint:e};if(i)for(var o in i)n[o]=i[o];return t.showHint(n)},t.defineExtension("showHint",function(i){if(!(this.listSelections().length>1||this.somethingSelected())){this.state.completionActive&&this.state.completionActive.close();var n=this.state.completionActive=new e(this,i),o=n.options.hint;if(o)return t.signal(this,"startCompletion",this),o.async?void o(this,function(t){n.showHints(t)},n.options):n.showHints(o(this,n.options))}}),e.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.widget&&this.widget.close(),this.onClose&&this.onClose(),t.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(e,n){var o=e.list[n];o.hint?o.hint(this.cm,e,o):this.cm.replaceRange(i(o),o.from||e.from,o.to||e.to,"complete"),t.signal(e,"pick",o),this.close();var s=this.cm.getCursor(),c=this.cm.getTokenAt(s);c&&")"===c.string&&this.cm.setCursor(t.Pos(s.line,s.ch-1))},showHints:function(t){return t&&t.list.length&&this.active()?void(this.options.completeSingle&&1==t.list.length?this.pick(t,0):this.showWidget(t)):this.close()},showWidget:function(e){function i(){r||(r=!0,a.close(),a.cm.off("cursorActivity",l),e&&t.signal(e,"close"))}function n(){if(!r){t.signal(e,"update");var i=a.options.hint;i.async?i(a.cm,o,a.options):o(i(a.cm,a.options))}}function o(t){if(e=t,!r){if(!e||!e.list.length)return i();a.widget&&a.widget.close(),a.widget=new s(a,e)}}function c(){h&&(m(h),h=0)}function l(){c();var t=a.cm.getCursor(),e=a.cm.getLine(t.line);t.line!=u.line||e.length-t.ch!=p-u.ch||t.ch=this.data.list.length?e=i?this.data.list.length-1:0:0>e&&(e=i?0:this.data.list.length-1),this.selectedHint!=e){var n=this.hints.childNodes[this.selectedHint];n.className=n.className.replace(" "+l,""),n=this.hints.childNodes[this.selectedHint=e],n.className+=" "+l,n.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=n.offsetTop+n.offsetHeight-this.hints.clientHeight+3),t.signal(this.data,"select",this.data.list[this.selectedHint],n)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},t.registerHelper("hint","auto",function(e,i){var n,o=e.getHelpers(e.getCursor(),"hint");if(o.length)for(var s=0;s,]/,closeOnUnfocus:!0,completeOnSingleClick:!1,container:null,customKeys:null,extraKeys:null};t.defineOption("hintOptions",null)}); -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var r=/[\w$]+/,o=500;e.registerHelper("hint","anyword",function(t,i){for(var n=i&&i.word||r,f=i&&i.range||o,a=t.getCursor(),c=t.getLine(a.line),s=a.ch,l=s;l&&n.test(c.charAt(l-1));)--l;for(var d=l!=s&&c.slice(l,s),u=[],p={},g=new RegExp(n.source,"g"),h=-1;1>=h;h+=2)for(var m=a.line,y=Math.min(Math.max(m+h*f,t.firstLine()),t.lastLine())+h;m!=y;m+=h)for(var b,v=t.getLine(m);b=g.exec(v);)(m!=a.line||b[0]!==d)&&(d&&0!=b[0].lastIndexOf(d,0)||Object.prototype.hasOwnProperty.call(p,b[0])||(p[b[0]]=!0,u.push(b[0])));return{list:u,from:e.Pos(a.line,l),to:e.Pos(a.line,s)}})}); -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function r(e){for(var r=e.display.lineSpace.childNodes.length-1;r>=0;r--){var o=e.display.lineSpace.childNodes[r];/(^|\s)CodeMirror-ruler($|\s)/.test(o.className)&&o.parentNode.removeChild(o)}}function o(r){for(var o=r.getOption("rulers"),t=r.defaultCharWidth(),l=r.charCoords(e.Pos(r.firstLine(),0),"div").left,i=r.display.scroller.offsetHeight+30,s=0;s=0;s--){var f=o[s].head;n.replaceRange("",u(f.line,f.ch-1),u(f.line,f.ch+1))}}function a(n){var i=r(n),a=i&&t(i,"explode");if(!a||n.getOption("disableInput"))return e.Pass;for(var o=n.listSelections(),s=0;s1&&d.indexOf(i)>=0&&n.getRange(u(C.line,C.ch-2),C)==i+i&&(C.ch<=2||n.getRange(u(C.line,C.ch-3),u(C.line,C.ch-2))!=i))b="addFour";else if(p){if(e.isWordChar(h)||!c(n,C,i))return e.Pass;b="both"}else{if(!v||n.getLine(C.line).length!=C.ch&&!s(h,o)&&!/\s/.test(h))return e.Pass;b="both"}else b=d.indexOf(i)>=0&&n.getRange(C,u(C.line,C.ch+3))==i+i+i?"skipThree":"skip";if(f){if(f!=b)return e.Pass}else f=b}var k=l%2?o.charAt(l-1):i,P=l%2?i:o.charAt(l+1);n.operation(function(){if("skip"==f)n.execCommand("goCharRight");else if("skipThree"==f)for(var e=0;3>e;e++)n.execCommand("goCharRight");else if("surround"==f){for(var t=n.getSelections(),e=0;e-1&&n%2==1}function l(e,t){var n=e.getRange(u(t.line,t.ch-1),u(t.line,t.ch+1));return 2==n.length?n:null}function c(t,n,r){var i=t.getLine(n.line),a=t.getTokenAt(n);if(/\bstring2?\b/.test(a.type))return!1;var o=new e.StringStream(i.slice(0,n.ch)+r+i.slice(n.ch),4);for(o.pos=o.start=a.start;;){var s=t.getMode().token(o,a.state);if(o.pos>=n.ch+1)return/\bstring2?\b/.test(s);o.start=o.pos}}var f={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},u=e.Pos;e.defineOption("autoCloseBrackets",!1,function(t,n,r){r&&r!=e.Init&&(t.removeKeyMap(d),t.state.closeBrackets=null),n&&(t.state.closeBrackets=n,t.addKeyMap(d))});for(var h=f.pairs+"`",d={Backspace:i,Enter:a},p=0;p=0&&c[o.text.charAt(f)]||c[o.text.charAt(++f)];if(!l)return null;var u=">"==l.charAt(1)?1:-1;if(i&&u>0!=(f==t.ch))return null;var h=e.getTokenTypeAt(a(t.line,f+1)),s=n(e,a(t.line,f+(u>0?1:0)),u,h||null,r);return null==s?null:{from:a(t.line,f),to:s&&s.pos,match:s&&s.ch==l.charAt(0),forward:u>0}}function n(e,t,n,i,r){for(var o=r&&r.maxScanLineLength||1e4,f=r&&r.maxScanLines||1e3,l=[],u=r&&r.bracketRegex?r.bracketRegex:/[(){}[\]]/,h=n>0?Math.min(t.line+f,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-f),s=t.line;s!=h;s+=n){var m=e.getLine(s);if(m){var d=n>0?0:m.length-1,g=n>0?m.length:-1;if(!(m.length>o))for(s==t.line&&(d=t.ch-(0>n?1:0));d!=g;d+=n){var p=m.charAt(d);if(u.test(p)&&(void 0===i||e.getTokenTypeAt(a(s,d+1))==i)){var v=c[p];if(">"==v.charAt(1)==n>0)l.push(p);else{if(!l.length)return{pos:a(s,d),ch:p};l.pop()}}}}}return s-n==(n>0?e.lastLine():e.firstLine())?!1:null}function i(e,n,i){for(var r=e.state.matchBrackets.maxHighlightLineLength||1e3,c=[],f=e.listSelections(),l=0;l",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},f=null;e.defineOption("matchBrackets",!1,function(t,n,i){i&&i!=e.Init&&t.off("cursorActivity",r),n&&(t.state.matchBrackets="object"==typeof n?n:{},t.on("cursorActivity",r))}),e.defineExtension("matchBrackets",function(){i(this,!0)}),e.defineExtension("findMatchingBracket",function(e,n,i){return t(this,e,n,i)}),e.defineExtension("scanForBracket",function(e,t,i,r){return n(this,e,t,i,r)})}); -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],e):e(CodeMirror)}(function(e){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var n=t.listSelections(),o=[],l=0;lc.ch&&(v=v.slice(0,v.length-d.end+c.ch));var b=v.toLowerCase();if(!v||"string"==d.type&&(d.end!=c.ch||!/[\"\']/.test(d.string.charAt(d.string.length-1))||1==d.string.length)||"tag"==d.type&&"closeTag"==g.type||d.string.indexOf("/")==d.string.length-1||h&&r(h,b)>-1||a(t,v,c,g,!0))return e.Pass;var y=p&&r(p,b)>-1;o[l]={indent:y,text:">"+(y?"\n\n":"")+"",newPos:y?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var l=n.length-1;l>=0;l--){var x=o[l];t.replaceRange(x.text,n[l].head,n[l].anchor,"+insert");var P=t.listSelections().slice(0);P[l]={head:x.newPos,anchor:x.newPos},t.setSelections(P),x.indent&&(t.indentLine(x.newPos.line,null,!0),t.indentLine(x.newPos.line+1,null,!0))}}function n(t,n){for(var o=t.listSelections(),r=[],i=n?"/":"";else{if("htmlmixed"!=t.getMode().name||"css"!=d.mode.name)return e.Pass;r[s]=i+"style>"}else{if(!f.context||!f.context.tagName||a(t,f.context.tagName,l,f))return e.Pass;r[s]=i+f.context.tagName+">"}}t.replaceSelections(r),o=t.listSelections();for(var s=0;sn;++n)if(e[n]==t)return n;return-1}function a(t,n,o,r,a){if(!e.scanForClosingTag)return!1;var i=Math.min(t.lastLine()+1,o.line+500),s=e.scanForClosingTag(t,o,null,i);if(!s||s.tag!=n)return!1;for(var l=r.context,c=a?1:0;l&&l.tagName==n;l=l.prev)++c;o=s.to;for(var d=1;c>d;d++){var f=e.scanForClosingTag(t,o,null,i);if(!f||f.tag!=n)return!1;o=f.to}return!0}e.defineOption("autoCloseTags",!1,function(n,r,a){if(a!=e.Init&&a&&n.removeKeyMap("autoCloseTags"),r){var i={name:"autoCloseTags"};("object"!=typeof r||r.whenClosing)&&(i["'/'"]=function(e){return o(e)}),("object"!=typeof r||r.whenOpening)&&(i["'>'"]=function(e){return t(e)}),n.addKeyMap(i)}});var i=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],s=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];e.commands.closeTag=function(e){return n(e)}}); -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r,o){if(this.atOccurrence=!1,this.doc=e,null==o&&"string"==typeof t&&(o=!1),r=r?e.clipPos(r):i(0,0),this.pos={from:r,to:r},"string"!=typeof t)t.global||(t=new RegExp(t.source,t.ignoreCase?"ig":"g")),this.matches=function(n,r){if(n){t.lastIndex=0;for(var o,s,l=e.getLine(r.line).slice(0,r.ch),h=0;;){t.lastIndex=h;var c=t.exec(l);if(!c)break;if(o=c,s=o.index,h=o.index+(o[0].length||1),h==l.length)break}var f=o&&o[0].length||0;f||(0==s&&0==l.length?o=void 0:s!=e.getLine(r.line).length&&f++)}else{t.lastIndex=r.ch;var l=e.getLine(r.line),o=t.exec(l),f=o&&o[0].length||0,s=o&&o.index;s+f==l.length||f||(f=1)}return o&&f?{from:i(r.line,s),to:i(r.line,s+f),match:o}:void 0};else{var s=t;o&&(t=t.toLowerCase());var l=o?function(e){return e.toLowerCase()}:function(e){return e},h=t.split("\n");if(1==h.length)t.length?this.matches=function(r,o){if(r){var h=e.getLine(o.line).slice(0,o.ch),c=l(h),f=c.lastIndexOf(t);if(f>-1)return f=n(h,c,f),{from:i(o.line,f),to:i(o.line,f+s.length)}}else{var h=e.getLine(o.line).slice(o.ch),c=l(h),f=c.indexOf(t);if(f>-1)return f=n(h,c,f)+o.ch,{from:i(o.line,f),to:i(o.line,f+s.length)}}}:this.matches=function(){};else{var c=s.split("\n");this.matches=function(t,n){var r=h.length-1;if(t){if(n.line-(h.length-1)=1;--f,--s)if(h[f]!=l(e.getLine(s)))return;var u=e.getLine(s),a=u.length-c[0].length;if(l(u.slice(a))!=h[0])return;return{from:i(s,a),to:o}}if(!(n.line+(h.length-1)>e.lastLine())){var u=e.getLine(n.line),a=u.length-c[0].length;if(l(u.slice(a))==h[0]){for(var g=i(n.line,a),s=n.line+1,f=1;r>f;++f,++s)if(h[f]!=l(e.getLine(s)))return;if(l(e.getLine(s).slice(0,c[r].length))==h[r])return{from:g,to:i(s,c[r].length)}}}}}}}function n(e,t,n){if(e.length==t.length)return n;for(var i=Math.min(n,e.length);;){var r=e.slice(0,i).toLowerCase().length;if(n>r)++i;else{if(!(r>n))return i;--i}}}var i=e.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){function t(e){var t=i(e,0);return n.pos={from:t,to:t},n.atOccurrence=!1,!1}for(var n=this,r=this.doc.clipPos(e?this.pos.from:this.pos.to);;){if(this.pos=this.matches(e,r))return this.atOccurrence=!0,this.pos.match||!0;if(e){if(!r.line)return t(0);r=i(r.line-1,this.doc.getLine(r.line-1).length)}else{var o=this.doc.lineCount();if(r.line==o-1)return t(o);r=i(r.line+1,0)}}},from:function(){return this.atOccurrence?this.pos.from:void 0},to:function(){return this.atOccurrence?this.pos.to:void 0},replace:function(t){if(this.atOccurrence){var n=e.splitLines(t);this.doc.replaceRange(n,this.pos.from,this.pos.to),this.pos.to=i(this.pos.from.line+n.length-1,n[n.length-1].length+(1==n.length?this.pos.from.ch:0))}}},e.defineExtension("getSearchCursor",function(e,n,i){return new t(this.doc,e,n,i)}),e.defineDocExtension("getSearchCursor",function(e,n,i){return new t(this,e,n,i)}),e.defineExtension("selectMatches",function(t,n){for(var i,r=[],o=this.getSearchCursor(t,this.getCursor("from"),n);(i=o.findNext())&&!(e.cmpPos(o.to(),this.getCursor("to"))>0);)r.push({anchor:o.from(),head:o.to()});r.length&&this.setSelections(r,0)})}); -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function o(e,o){return"string"==typeof e?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),o?"gi":"g"):e.global||(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(o){e.lastIndex=o.pos;var r=e.exec(o.string);return r&&r.index==o.pos?(o.pos+=r[0].length,"searching"):void(r?o.pos=r.index:o.skipToEnd())}}}function r(){this.posFrom=this.posTo=this.query=null,this.overlay=null}function n(e){return e.state.search||(e.state.search=new r)}function t(e){return"string"==typeof e&&e==e.toLowerCase()}function i(e,o,r){return e.getSearchCursor(o,r,t(o))}function a(e,o,r,n,t){e.openDialog?e.openDialog(o,t,{value:n}):t(prompt(r,n))}function c(e,o,r,n){e.openConfirm?e.openConfirm(o,n):confirm(r)&&n[0]()}function s(e){var o=e.match(/^\/(.*)\/([a-z]*)$/);if(o)try{e=new RegExp(o[1],-1==o[2].indexOf("i")?"":"i")}catch(r){}return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function l(e,r){var i=n(e);return i.query?u(e,r):void a(e,d,"Search for:",e.getSelection(),function(n){e.operation(function(){n&&!i.query&&(i.query=s(n),e.removeOverlay(i.overlay,t(i.query)),i.overlay=o(i.query,t(i.query)),e.addOverlay(i.overlay),e.showMatchesOnScrollbar&&(i.annotate&&(i.annotate.clear(),i.annotate=null),i.annotate=e.showMatchesOnScrollbar(i.query,t(i.query))),i.posFrom=i.posTo=e.getCursor(),u(e,r))})})}function u(o,r){o.operation(function(){var t=n(o),a=i(o,t.query,r?t.posFrom:t.posTo);(a.find(r)||(a=i(o,t.query,r?e.Pos(o.lastLine()):e.Pos(o.firstLine(),0)),a.find(r)))&&(o.setSelection(a.from(),a.to()),o.scrollIntoView({from:a.from(),to:a.to()}),t.posFrom=a.from(),t.posTo=a.to())})}function f(e){e.operation(function(){var o=n(e);o.query&&(o.query=null,e.removeOverlay(o.overlay),o.annotate&&(o.annotate.clear(),o.annotate=null))})}function p(e,o){e.getOption("readOnly")||a(e,m,"Replace:",e.getSelection(),function(r){r&&(r=s(r),a(e,y,"Replace with:","",function(n){if(o)e.operation(function(){for(var o=i(e,r);o.findNext();)if("string"!=typeof r){var t=e.getRange(o.from(),o.to()).match(r);o.replace(n.replace(/\$(\d)/g,function(e,o){return t[o]}))}else o.replace(n)});else{f(e);var t=i(e,r,e.getCursor()),a=function(){var o,n=t.from();!(o=t.findNext())&&(t=i(e,r),!(o=t.findNext())||n&&t.from().line==n.line&&t.from().ch==n.ch)||(e.setSelection(t.from(),t.to()),e.scrollIntoView({from:t.from(),to:t.to()}),c(e,h,"Replace?",[function(){s(o)},a]))},s=function(e){t.replace("string"==typeof r?n:n.replace(/\$(\d)/g,function(o,r){return e[r]})),a()};a()}}))})}var d='Search: (Use /re/ syntax for regexp search)',m='Replace: (Use /re/ syntax for regexp search)',y='With: ',h="Replace? ";e.commands.find=function(e){f(e),l(e)},e.commands.findNext=l,e.commands.findPrev=function(e){l(e,!0)},e.commands.clearSearch=f,e.commands.replace=p,e.commands.replaceAll=function(e){p(e,!0)}}); -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function o(e,o,n){var t,i=e.getWrapperElement();return t=i.appendChild(document.createElement("div")),n?t.className="CodeMirror-dialog CodeMirror-dialog-bottom":t.className="CodeMirror-dialog CodeMirror-dialog-top","string"==typeof o?t.innerHTML=o:t.appendChild(o),t}function n(e,o){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=o}e.defineExtension("openDialog",function(t,i,r){function u(e){if("string"==typeof e)s.value=e;else{if(f)return;f=!0,c.parentNode.removeChild(c),a.focus(),r.onClose&&r.onClose(c)}}r||(r={}),n(this,null);var l,c=o(this,t,r.bottom),f=!1,a=this,s=c.getElementsByTagName("input")[0];return s?(r.value&&(s.value=r.value,r.selectValueOnOpen!==!1&&s.select()),r.onInput&&e.on(s,"input",function(e){r.onInput(e,s.value,u)}),r.onKeyUp&&e.on(s,"keyup",function(e){r.onKeyUp(e,s.value,u)}),e.on(s,"keydown",function(o){r&&r.onKeyDown&&r.onKeyDown(o,s.value,u)||((27==o.keyCode||r.closeOnEnter!==!1&&13==o.keyCode)&&(s.blur(),e.e_stop(o),u()),13==o.keyCode&&i(s.value,o))}),r.closeOnBlur!==!1&&e.on(s,"blur",u),s.focus()):(l=c.getElementsByTagName("button")[0])&&(e.on(l,"click",function(){u(),a.focus()}),r.closeOnBlur!==!1&&e.on(l,"blur",u),l.focus()),u}),e.defineExtension("openConfirm",function(t,i,r){function u(){f||(f=!0,l.parentNode.removeChild(l),a.focus())}n(this,null);var l=o(this,t,r&&r.bottom),c=l.getElementsByTagName("button"),f=!1,a=this,s=1;c[0].focus();for(var d=0;d=s&&u()},200)}),e.on(p,"focus",function(){++s})}}),e.defineExtension("openNotification",function(t,i){function r(){c||(c=!0,clearTimeout(u),l.parentNode.removeChild(l))}n(this,r);var u,l=o(this,t,i&&i.bottom),c=!1,f=i&&"undefined"!=typeof i.duration?i.duration:5e3;return e.on(l,"click",function(o){e.e_preventDefault(o),r()}),f&&(u=setTimeout(r,f)),r})}); -!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";function e(t){"object"==typeof t&&(this.minChars=t.minChars,this.style=t.style,this.showToken=t.showToken,this.delay=t.delay,this.wordsOnly=t.wordsOnly),null==this.style&&(this.style=s),null==this.minChars&&(this.minChars=h),null==this.delay&&(this.delay=a),null==this.wordsOnly&&(this.wordsOnly=c),this.overlay=this.timeout=null}function i(t){var e=t.state.matchHighlighter;clearTimeout(e.timeout),e.timeout=setTimeout(function(){r(t)},e.delay)}function r(t){t.operation(function(){var e=t.state.matchHighlighter;if(e.overlay&&(t.removeOverlay(e.overlay),e.overlay=null),!t.somethingSelected()&&e.showToken){for(var i=e.showToken===!0?/[\w$]/:e.showToken,r=t.getCursor(),o=t.getLine(r.line),h=r.ch,s=h;h&&i.test(o.charAt(h-1));)--h;for(;sh&&t.addOverlay(e.overlay=l(o.slice(h,s),i,e.style)))}var a=t.getCursor("from"),c=t.getCursor("to");if(a.line==c.line&&(!e.wordsOnly||n(t,a,c))){var u=t.getRange(a,c).replace(/^\s+|\s+$/g,"");u.length>=e.minChars&&t.addOverlay(e.overlay=l(u,!1,e.style))}})}function n(t,e,i){var r=t.getRange(e,i);if(null!==r.match(/^\w+$/)){if(e.ch>0){var n={line:e.line,ch:e.ch-1},o=t.getRange(n,e);if(null===o.match(/\W/))return!1}if(i.cho.firstLine();)i=n.Pos(i.line-1,0),a=l(!1);if(a&&!a.cleared&&"unfold"!==f){var c=e(o,t);n.on(c,"mousedown",function(o){s.clear(),n.e_preventDefault(o)});var s=o.markText(a.from,a.to,{replacedWith:c,clearOnEnter:!0,__isFold:!0});s.on("clear",function(e,r){n.signal(o,"unfold",o,e,r)}),n.signal(o,"fold",o,a.from,a.to)}}function e(n,o){var e=r(n,o,"widget");if("string"==typeof e){var i=document.createTextNode(e);e=document.createElement("span"),e.appendChild(i),e.className="CodeMirror-foldmarker"}return e}function r(n,o,e){if(o&&void 0!==o[e])return o[e];var r=n.options.foldOptions;return r&&void 0!==r[e]?r[e]:i[e]}n.newFoldFunction=function(n,e){return function(r,i){o(r,i,{rangeFinder:n,widget:e})}},n.defineExtension("foldCode",function(n,e,r){o(this,n,e,r)}),n.defineExtension("isFolded",function(n){for(var o=this.findMarksAt(n),e=0;e=e;e++)o.foldCode(n.Pos(e,0),null,"fold")})},n.commands.unfoldAll=function(o){o.operation(function(){for(var e=o.firstLine(),r=o.lastLine();r>=e;e++)o.foldCode(n.Pos(e,0),null,"unfold")})},n.registerHelper("fold","combine",function(){var n=Array.prototype.slice.call(arguments,0);return function(o,e){for(var r=0;r=d&&(e=n(i.indicatorOpen))}o.setGutterMarker(t,i.gutter,e),++f})}function f(o){var t=o.getViewport(),e=o.state.foldGutter;e&&(o.operation(function(){i(o,t.from,t.to)}),e.from=t.from,e.to=t.to)}function d(o,t,e){var n=o.state.foldGutter;if(n){var i=n.options;if(e==i.gutter){var f=r(o,t);f?f.clear():o.foldCode(c(t,0),i.rangeFinder)}}}function a(o){var t=o.state.foldGutter;if(t){var e=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){f(o)},e.foldOnChangeTimeSpan||600)}}function u(o){var t=o.state.foldGutter;if(t){var e=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var e=o.getViewport();t.from==t.to||e.from-t.to>20||t.from-e.to>20?f(o):o.operation(function(){e.fromt.to&&(i(o,t.to,e.to),t.to=e.to)})},e.updateViewportTimeSpan||400)}}function l(o,t){var e=o.state.foldGutter;if(e){var r=t.line;r>=e.from&&r=i?-1:f.lastIndexOf(t,i-1);if(-1!=u){if(1==s&&u=v;++v)for(var p=r.getLine(v),m=v==l?i:0;;){var P=p.indexOf(s,m),k=p.indexOf(u,m);if(0>P&&(P=p.length),0>k&&(k=p.length),m=Math.min(P,k),m==p.length)break;if(r.getTokenTypeAt(e.Pos(v,m+1))==o)if(m==P)++c;else if(!--c){a=v,d=m;break e}++m}if(null!=a&&(l!=a||d!=i))return{from:e.Pos(l,i),to:e.Pos(a,d)}}}),e.registerHelper("fold","import",function(r,n){function t(n){if(nr.lastLine())return null;var t=r.getTokenAt(e.Pos(n,1));if(/\S/.test(t.string)||(t=r.getTokenAt(e.Pos(n,t.end+1))),"keyword"!=t.type||"import"!=t.string)return null;for(var i=n,o=Math.min(r.lastLine(),n+10);o>=i;++i){var l=r.getLine(i),f=l.indexOf(";");if(-1!=f)return{startCh:t.end,end:e.Pos(i,f)}}}var i,n=n.line,o=t(n);if(!o||t(n-1)||(i=t(n-2))&&i.end.line==n-1)return null;for(var l=o.end;;){var f=t(l.line+1);if(null==f)break;l=f.end}return{from:r.clipPos(e.Pos(n,o.startCh+1)),to:l}}),e.registerHelper("fold","include",function(r,n){function t(n){if(nr.lastLine())return null;var t=r.getTokenAt(e.Pos(n,1));return/\S/.test(t.string)||(t=r.getTokenAt(e.Pos(n,t.end+1))),"meta"==t.type&&"#include"==t.string.slice(0,8)?t.start+8:void 0}var n=n.line,i=t(n);if(null==i||null!=t(n-1))return null;for(var o=n;;){var l=t(o+1);if(null==l)break;++o}return{from:e.Pos(n,i+1),to:r.clipPos(e.Pos(o))}})}); -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function n(e,n){return e.line-n.line||e.ch-n.ch}function t(e,n,t,i){this.line=n,this.ch=t,this.cm=e,this.text=e.getLine(n),this.min=i?i.from:e.firstLine(),this.max=i?i.to-1:e.lastLine()}function i(e,n){var t=e.cm.getTokenTypeAt(h(e.line,n));return t&&/\btag\b/.test(t)}function r(e){return e.line>=e.max?void 0:(e.ch=0,e.text=e.cm.getLine(++e.line),!0)}function f(e){return e.line<=e.min?void 0:(e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0)}function o(e){for(;;){var n=e.text.indexOf(">",e.ch);if(-1==n){if(r(e))continue;return}{if(i(e,n+1)){var t=e.text.lastIndexOf("/",n),f=t>-1&&!/\S/.test(e.text.slice(t+1,n));return e.ch=n+1,f?"selfClose":"regular"}e.ch=n+1}}}function u(e){for(;;){var n=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==n){if(f(e))continue;return}if(i(e,n+1)){g.lastIndex=n,e.ch=n;var t=g.exec(e.text);if(t&&t.index==n)return t}else e.ch=n}}function c(e){for(;;){g.lastIndex=e.ch;var n=g.exec(e.text);if(!n){if(r(e))continue;return}{if(i(e,n.index+1))return e.ch=n.index+n[0].length,n;e.ch=n.index+1}}}function l(e){for(;;){var n=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==n){if(f(e))continue;return}{if(i(e,n+1)){var t=e.text.lastIndexOf("/",n),r=t>-1&&!/\S/.test(e.text.slice(t+1,n));return e.ch=n+1,r?"selfClose":"regular"}e.ch=n}}}function a(e,n){for(var t=[];;){var i,r=c(e),f=e.line,u=e.ch-(r?r[0].length:0);if(!r||!(i=o(e)))return;if("selfClose"!=i)if(r[1]){for(var l=t.length-1;l>=0;--l)if(t[l]==r[2]){t.length=l;break}if(0>l&&(!n||n==r[2]))return{tag:r[2],from:h(f,u),to:h(e.line,e.ch)}}else t.push(r[2])}}function s(e,n){for(var t=[];;){var i=l(e);if(!i)return;if("selfClose"!=i){var r=e.line,f=e.ch,o=u(e);if(!o)return;if(o[1])t.push(o[2]);else{for(var c=t.length-1;c>=0;--c)if(t[c]==o[2]){t.length=c;break}if(0>c&&(!n||n==o[2]))return{tag:o[2],from:h(e.line,e.ch),to:h(r,f)}}}else u(e)}}var h=e.Pos,x="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",v=x+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",g=new RegExp("<(/?)(["+x+"]["+v+"]*)","g");e.registerHelper("fold","xml",function(e,n){for(var i=new t(e,n.line,0);;){var r,f=c(i);if(!f||i.line!=n.line||!(r=o(i)))return;if(!f[1]&&"selfClose"!=r){var n=h(i.line,i.ch),u=a(i,f[2]);return u&&{from:n,to:u.from}}}}),e.findMatchingTag=function(e,i,r){var f=new t(e,i.line,i.ch,r);if(-1!=f.text.indexOf(">")||-1!=f.text.indexOf("<")){var c=o(f),l=c&&h(f.line,f.ch),x=c&&u(f);if(c&&x&&!(n(f,i)>0)){var v={from:h(f.line,f.ch),to:l,tag:x[2]};return"selfClose"==c?{open:v,close:null,at:"open"}:x[1]?{open:s(f,x[2]),close:v,at:"close"}:(f=new t(e,l.line,l.ch,r),{open:v,close:a(f,x[2]),at:"open"})}}},e.findEnclosingTag=function(e,n,i){for(var r=new t(e,n.line,n.ch,i);;){var f=s(r);if(!f)break;var o=new t(e,n.line,n.ch,i),u=a(o,f.tag);if(u)return{open:f,close:u}}},e.scanForClosingTag=function(e,n,i,r){var f=new t(e,n.line,n.ch,r?{from:0,to:r}:null);return a(f,i)}}); -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("fold","markdown",function(n,t){function r(t){var r=n.getTokenTypeAt(e.Pos(t,0));return r&&/\bheader\b/.test(r)}function i(e,n,t){var i=n&&n.match(/^#+/);return i&&r(e)?i[0].length:(i=t&&t.match(/^[=\-]+\s*$/),i&&r(e+1)?"="==t[0]?1:2:o)}var o=100,f=n.getLine(t.line),l=n.getLine(t.line+1),c=i(t.line,f,l);if(c!==o){for(var u=n.lastLine(),d=t.line,a=n.getLine(d+2);u>d&&!(i(d+1,l,a)<=c);)++d,l=a,a=n.getLine(d+2);return{from:e.Pos(t.line,f.length),to:e.Pos(d,n.getLine(d).length)}}})}); -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerGlobalHelper("fold","comment",function(e){return e.blockCommentStart&&e.blockCommentEnd},function(t,n){var o=t.getModeAt(n),r=o.blockCommentStart,i=o.blockCommentEnd;if(r&&i){for(var f,l=n.line,c=t.getLine(l),m=n.ch,a=0;;){var d=0>=m?-1:c.lastIndexOf(r,m-1);if(-1!=d){if(1==a&&d=h;++h)for(var k=t.getLine(h),v=h==l?f:0;;){var p=k.indexOf(r,v),C=k.indexOf(i,v);if(0>p&&(p=k.length),0>C&&(C=k.length),v=Math.min(p,C),v==k.length)break;if(v==p)++s;else if(!--s){u=h,b=v;break e}++v}if(null!=u&&(l!=u||b!=f))return{from:e.Pos(l,f),to:e.Pos(u,b)}}})}); -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror")):"function"==typeof define&&define.amd?define(["../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["pgp"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists.txt$/},{name:"CoffeeScript",mime:"text/x-coffeescript",mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history).md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy"]},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Jade",mime:"text/x-jade",mode:"jade",ext:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"Jinja2",mime:"null",mode:"jinja2"},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"kotlin",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NTriples",mime:"text/n-triples",mode:"ntriples",ext:["nt"]},{name:"Objective C",mime:"text/x-objectivec",mode:"clike",ext:["m","mm"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mime:"application/x-httpd-php",mode:"php",ext:["php","php3","php4","php5","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["py","pyw"]},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mime:"text/x-sh",mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"]},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"MariaDB",mime:"text/x-mariadb",mode:"sql"},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki ",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"YAML",mime:"text/x-yaml",mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]}];for(var m=0;m-1&&m.substring(i+1,m.length);return x?e.findModeByExtension(x):void 0},e.findModeByName=function(m){m=m.toLowerCase();for(var t=0;t!|\/]/;return{startState:function(e){return{tokenize:null,context:new i((e||0)-u,0,"top",!1),indented:0,startOfLine:!0}},token:function(e,n){var r=n.context;if(e.sol()&&(null==r.align&&(r.align=!1),n.indented=e.indentation(),n.startOfLine=!0,"case"==r.type&&(r.type="}")),e.eatSpace())return null;c=null;var i=(n.tokenize||t)(e,n);return"comment"==i?i:(null==r.align&&(r.align=!0),"{"==c?o(n,e.column(),"}"):"["==c?o(n,e.column(),"]"):"("==c?o(n,e.column(),")"):"case"==c?r.type="case":"}"==c&&"}"==r.type?r=a(n):c==r.type&&a(n),n.startOfLine=!1,i)},indent:function(e,n){if(e.tokenize!=t&&null!=e.tokenize)return 0;var r=e.context,i=n&&n.charAt(0);if("case"==r.type&&/^(?:case|default)\b/.test(n))return e.context.type="}",r.indented;var o=i==r.type;return r.align?r.column+(o?0:1):r.indented+(o?0:u)},electricChars:"{}):",fold:"brace",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//"}}),e.defineMIME("text/x-go","go")}); -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=e.split(" "),n=0;n!?|\/]/;return{startState:function(e){return{tokenize:null,context:new i((e||0)-u,0,"top",!1),indented:0,startOfLine:!0}},token:function(e,t){var r=t.context;if(e.sol()&&(null==r.align&&(r.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return null;c=null;var o=(t.tokenize||n)(e,t);if("comment"==o||"meta"==o)return o;if(null==r.align&&(r.align=!0),";"!=c&&":"!=c&&","!=c||"statement"!=r.type)if("{"==c)l(t,e.column(),"}");else if("["==c)l(t,e.column(),"]");else if("("==c)l(t,e.column(),")");else if("}"==c){for(;"statement"==r.type;)r=s(t);for("}"==r.type&&(r=s(t));"statement"==r.type;)r=s(t)}else c==r.type?s(t):b&&(("}"==r.type||"top"==r.type)&&";"!=c||"statement"==r.type&&"newstatement"==c)&&l(t,e.column(),"statement");else s(t);return t.startOfLine=!1,o},indent:function(t,r){if(t.tokenize!=n&&null!=t.tokenize)return e.Pass;var o=t.context,a=r&&r.charAt(0);"statement"==o.type&&"}"==a&&(o=o.prev);var i=a==o.type;return"statement"==o.type?o.indented+("{"==a?0:d):!o.align||f&&")"==o.type?")"!=o.type||i?o.indented+(i?0:u):o.indented+d:o.column+(i?0:1)},electricChars:"{}",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}});var s="auto if break int case long char register continue return default short do sizeof double static else struct entry switch extern typedef float union for unsigned goto while enum void const signed volatile";i(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:t(s),blockKeywords:t("case do else for if switch while struct"),atoms:t("null"),hooks:{"#":r},modeProps:{fold:["brace","include"]}}),i(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:t(s+" asm dynamic_cast namespace reinterpret_cast try bool explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected wchar_t alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),blockKeywords:t("catch class do else finally for if struct switch try while"),atoms:t("true false null"),hooks:{"#":r,u:n,U:n,L:n,R:n},modeProps:{fold:["brace","include"]}}),i("text/x-java",{name:"clike",keywords:t("abstract assert boolean break byte case catch char class const continue default do double else enum extends final finally float for goto if implements import instanceof int interface long native new package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while"),blockKeywords:t("catch class do else finally for if switch try while"),atoms:t("true false null"),hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"}},modeProps:{fold:["brace","import"]}}),i("text/x-csharp",{name:"clike",keywords:t("abstract as base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),blockKeywords:t("catch class do else finally for foreach if struct switch try while"),builtin:t("Boolean Byte Char DateTime DateTimeOffset Decimal Double Guid Int16 Int32 Int64 Object SByte Single String TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),atoms:t("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=o,o(e,t)):(e.eatWhile(/[\w\$_]/),"meta")}}}),i("text/x-scala",{name:"clike",keywords:t("abstract case catch class def do else extends false final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try trye type val var while with yield _ : = => <- <: <% >: # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector :: #:: Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:t("catch class do else finally for forSome if match switch try while"),atoms:t("true false null"),indentStatements:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return e.match('""')?(t.tokenize=l,t.tokenize(e,t)):!1},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"}},modeProps:{closeBrackets:{triples:'"'}}}),i(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:t("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4 sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),blockKeywords:t("for while do if else struct"),builtin:t("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:t("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),hooks:{"#":r},modeProps:{fold:["brace","include"]}}),i("text/x-nesc",{name:"clike",keywords:t(s+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),blockKeywords:t("case do else for if switch while struct"),atoms:t("null"),hooks:{"#":r},modeProps:{fold:["brace","include"]}}),i("text/x-objectivec",{name:"clike",keywords:t(s+"inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),atoms:t("YES NO NULL NILL ON OFF"),hooks:{"@":function(e){return e.eatWhile(/[\w\$]/),"keyword"},"#":r},modeProps:{fold:"brace"}})}); -!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";t.defineMode("xml",function(e,n){function r(t,e){function n(n){return e.tokenize=n,n(t,e)}var r=t.next();if("<"==r)return t.eat("!")?t.eat("[")?t.match("CDATA[")?n(i("atom","]]>")):null:t.match("--")?n(i("comment","-->")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),n(l(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),e.tokenize=i("meta","?>"),"meta"):(z=t.eat("/")?"closeTag":"openTag",e.tokenize=o,"tag bracket");if("&"==r){var a;return a=t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"),a?"atom":"error"}return t.eatWhile(/[^&<]/),null}function o(t,e){var n=t.next();if(">"==n||"/"==n&&t.eat(">"))return e.tokenize=r,z=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return z="equals",null;if("<"==n){e.tokenize=r,e.state=f,e.tagName=e.tagStart=null;var o=e.tokenize(t,e);return o?o+" tag error":"tag error"}return/[\'\"]/.test(n)?(e.tokenize=a(n),e.stringStartCol=t.column(),e.tokenize(t,e)):(t.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function a(t){var e=function(e,n){for(;!e.eol();)if(e.next()==t){n.tokenize=o;break}return"string"};return e.isInAttribute=!0,e}function i(t,e){return function(n,o){for(;!n.eol();){if(n.match(e)){o.tokenize=r;break}n.next()}return t}}function l(t){return function(e,n){for(var o;null!=(o=e.next());){if("<"==o)return n.tokenize=l(t+1),n.tokenize(e,n);if(">"==o){if(1==t){n.tokenize=r;break}return n.tokenize=l(t-1),n.tokenize(e,n)}}return"meta"}}function u(t,e,n){this.prev=t.context,this.tagName=e,this.indent=t.indented,this.startOfLine=n,(T.doNotIndent.hasOwnProperty(e)||t.context&&t.context.noIndent)&&(this.noIndent=!0)}function d(t){t.context&&(t.context=t.context.prev)}function c(t,e){for(var n;;){if(!t.context)return;if(n=t.context.tagName,!T.contextGrabbers.hasOwnProperty(n)||!T.contextGrabbers[n].hasOwnProperty(e))return;d(t)}}function f(t,e,n){return"openTag"==t?(n.tagStart=e.column(),s):"closeTag"==t?m:f}function s(t,e,n){return"word"==t?(n.tagName=e.current(),N="tag",h):(N="error",s)}function m(t,e,n){if("word"==t){var r=e.current();return n.context&&n.context.tagName!=r&&T.implicitlyClosed.hasOwnProperty(n.context.tagName)&&d(n),n.context&&n.context.tagName==r?(N="tag",g):(N="tag error",p)}return N="error",p}function g(t,e,n){return"endTag"!=t?(N="error",g):(d(n),f)}function p(t,e,n){return N="error",g(t,e,n)}function h(t,e,n){if("word"==t)return N="attribute",x;if("endTag"==t||"selfcloseTag"==t){var r=n.tagName,o=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==t||T.autoSelfClosers.hasOwnProperty(r)?c(n,r):(c(n,r),n.context=new u(n,r,o==n.indented)),f}return N="error",h}function x(t,e,n){return"equals"==t?b:(T.allowMissing||(N="error"),h(t,e,n))}function b(t,e,n){return"string"==t?k:"word"==t&&T.allowUnquoted?(N="string",h):(N="error",h(t,e,n))}function k(t,e,n){return"string"==t?k:h(t,e,n)}var w=e.indentUnit,v=n.multilineTagIndentFactor||1,y=n.multilineTagIndentPastTag;null==y&&(y=!0);var z,N,T=n.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},C=n.alignCDATA;return{startState:function(){return{tokenize:r,state:f,indented:0,tagName:null,tagStart:null,context:null}},token:function(t,e){if(!e.tagName&&t.sol()&&(e.indented=t.indentation()),t.eatSpace())return null;z=null;var n=e.tokenize(t,e);return(n||z)&&"comment"!=n&&(N=null,e.state=e.state(z||n,t,e),N&&(n="error"==N?n+" error":N)),n},indent:function(e,n,a){var i=e.context;if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+w;if(i&&i.noIndent)return t.Pass;if(e.tokenize!=o&&e.tokenize!=r)return a?a.match(/^(\s*)/)[0].length:0;if(e.tagName)return y?e.tagStart+e.tagName.length+2:e.tagStart+w*v;if(C&&/$/,blockCommentStart:"",configuration:n.htmlMode?"html":"xml",helperType:n.htmlMode?"html":"xml"}}),t.defineMIME("text/xml","xml"),t.defineMIME("application/xml","xml"),t.mimeModes.hasOwnProperty("text/html")||t.defineMIME("text/html",{name:"xml",htmlMode:!0})}); -!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],t):t(CodeMirror)}(function(t){"use strict";t.defineMode("htmlmixed",function(e,a){function o(t,e){var a=e.htmlState.tagName;a&&(a=a.toLowerCase());var o=r.token(t,e.htmlState);if("script"==a&&/\btag\b/.test(o)&&">"==t.current()){var l=t.string.slice(Math.max(0,t.pos-100),t.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);l=l?l[1]:"",l&&/[\"\']/.test(l.charAt(0))&&(l=l.slice(1,l.length-1));for(var m=0;m"==t.current()&&(e.token=c,e.localMode=s,e.localState=s.startState(r.indent(e.htmlState,"")));return o}function l(t,e,a){var o,l=t.current(),n=l.search(e);return n>-1?t.backUp(l.length-n):(o=l.match(/<\/?$/))&&(t.backUp(l.length),t.match(e,!1)||t.match(l)),a}function n(t,e){return t.match(/^<\/\s*script\s*>/i,!1)?(e.token=o,e.localState=e.localMode=null,null):l(t,/<\/\s*script\s*>/,e.localMode.token(t,e.localState))}function c(t,e){return t.match(/^<\/\s*style\s*>/i,!1)?(e.token=o,e.localState=e.localMode=null,null):l(t,/<\/\s*style\s*>/,s.token(t,e.localState))}var r=t.getMode(e,{name:"xml",htmlMode:!0,multilineTagIndentFactor:a.multilineTagIndentFactor,multilineTagIndentPastTag:a.multilineTagIndentPastTag}),s=t.getMode(e,"css"),i=[],m=a&&a.scriptTypes;if(i.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:t.getMode(e,"javascript")}),m)for(var d=0;d"))return a("=>","operator");if("0"==r&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),a("number","number");if(/\d/.test(r))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),a("number","number");if("/"==r)return e.eat("*")?(t.tokenize=c,c(e,t)):e.eat("/")?(e.skipToEnd(),a("comment","comment")):"operator"==t.lastType||"keyword c"==t.lastType||"sof"==t.lastType||/^[\[{}\(,;:]$/.test(t.lastType)?(n(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),a("regexp","string-2")):(e.eatWhile(Me),a("operator","operator",e.current()));if("`"==r)return t.tokenize=u,u(e,t);if("#"==r)return e.skipToEnd(),a("error","error");if(Me.test(r))return e.eatWhile(Me),a("operator","operator",e.current());if(we.test(r)){e.eatWhile(we);var i=e.current(),l=je.propertyIsEnumerable(i)&&je[i];return l&&"."!=t.lastType?a(l.type,l.style,i):a("variable","variable",i)}}function o(e){return function(t,r){var n,o=!1;if(xe&&"@"==t.peek()&&t.match(Ve))return r.tokenize=i,a("jsonld-keyword","meta");for(;null!=(n=t.next())&&(n!=e||o);)o=!o&&"\\"==n;return o||(r.tokenize=i),a("string","string")}}function c(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=i;break}n="*"==r}return a("comment","comment")}function u(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=i;break}n=!n&&"\\"==r}return a("quasi","string-2",e.current())}function l(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(0>r)){for(var n=0,a=!1,i=r-1;i>=0;--i){var o=e.string.charAt(i),c=Ee.indexOf(o);if(c>=0&&3>c){if(!n){++i;break}if(0==--n)break}else if(c>=3&&6>c)++n;else if(we.test(o))a=!0;else{if(/["'\/]/.test(o))return;if(a&&!n){++i;break}}}a&&!n&&(t.fatArrowAt=i)}}function s(e,t,r,n,a,i){this.indented=e,this.column=t,this.type=r,this.prev=a,this.info=i,null!=n&&(this.align=n)}function f(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function d(e,t,r,n,a){var i=e.cc;for(ze.state=e,ze.stream=a,ze.marked=null,ze.cc=i,ze.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var o=i.length?i.pop():he?w:g;if(o(r,n)){for(;i.length&&i[i.length-1].lex;)i.pop()();return ze.marked?ze.marked:"variable"==r&&f(e,n)?"variable-2":t}}}function p(){for(var e=arguments.length-1;e>=0;e--)ze.cc.push(arguments[e])}function v(){return p.apply(null,arguments),!0}function m(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var n=ze.state;if(n.context){if(ze.marked="def",t(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(t(n.globalVars))return;r.globalVars&&(n.globalVars={name:e,next:n.globalVars})}}function y(){ze.state.context={prev:ze.state.context,vars:ze.state.localVars},ze.state.localVars=Te}function k(){ze.state.localVars=ze.state.context.vars,ze.state.context=ze.state.context.prev}function b(e,t){var r=function(){var r=ze.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var a=r.lexical;a&&")"==a.type&&a.align;a=a.prev)n=a.indented;r.lexical=new s(n,ze.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function x(){var e=ze.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function h(e){function t(r){return r==e?v():";"==e?p():v(t)}return t}function g(e,t){return"var"==e?v(b("vardef",t.length),F,h(";"),x):"keyword a"==e?v(b("form"),w,g,x):"keyword b"==e?v(b("form"),g,x):"{"==e?v(b("}"),H,x):";"==e?v():"if"==e?("else"==ze.state.lexical.info&&ze.state.cc[ze.state.cc.length-1]==x&&ze.state.cc.pop()(),v(b("form"),w,g,x,Q)):"function"==e?v(ee):"for"==e?v(b("form"),R,g,x):"variable"==e?v(b("stat"),q):"switch"==e?v(b("form"),w,b("}","switch"),h("{"),H,x,x):"case"==e?v(w,h(":")):"default"==e?v(h(":")):"catch"==e?v(b("form"),y,h("("),te,h(")"),g,x,k):"module"==e?v(b("form"),y,oe,k,x):"class"==e?v(b("form"),re,x):"export"==e?v(b("form"),ce,x):"import"==e?v(b("form"),ue,x):p(b("stat"),w,h(";"),x)}function w(e){return M(e,!1)}function j(e){return M(e,!0)}function M(e,t){if(ze.state.fatArrowAt==ze.stream.start){var r=t?$:C;if("("==e)return v(y,b(")"),N(G,")"),x,h("=>"),r,k);if("variable"==e)return p(y,G,h("=>"),r,k)}var n=t?z:I;return Ie.hasOwnProperty(e)?v(n):"function"==e?v(ee,n):"keyword c"==e?v(t?E:V):"("==e?v(b(")"),V,pe,h(")"),x,n):"operator"==e||"spread"==e?v(t?j:w):"["==e?v(b("]"),fe,x,n):"{"==e?B(P,"}",null,n):"quasi"==e?p(T,n):v()}function V(e){return e.match(/[;\}\)\],]/)?p():p(w)}function E(e){return e.match(/[;\}\)\],]/)?p():p(j)}function I(e,t){return","==e?v(w):z(e,t,!1)}function z(e,t,r){var n=0==r?I:z,a=0==r?w:j;return"=>"==e?v(y,r?$:C,k):"operator"==e?/\+\+|--/.test(t)?v(n):"?"==t?v(w,h(":"),a):v(a):"quasi"==e?p(T,n):";"!=e?"("==e?B(j,")","call",n):"."==e?v(O,n):"["==e?v(b("]"),V,h("]"),x,n):void 0:void 0}function T(e,t){return"quasi"!=e?p():"${"!=t.slice(t.length-2)?v(T):v(w,A)}function A(e){return"}"==e?(ze.marked="string-2",ze.state.tokenize=u,v(T)):void 0}function C(e){return l(ze.stream,ze.state),p("{"==e?g:w)}function $(e){return l(ze.stream,ze.state),p("{"==e?g:j)}function q(e){return":"==e?v(x,g):p(I,h(";"),x)}function O(e){return"variable"==e?(ze.marked="property",v()):void 0}function P(e,t){return"variable"==e||"keyword"==ze.style?(ze.marked="property",v("get"==t||"set"==t?S:W)):"number"==e||"string"==e?(ze.marked=xe?"property":ze.style+" property",v(W)):"jsonld-keyword"==e?v(W):"["==e?v(w,h("]"),W):void 0}function S(e){return"variable"!=e?p(W):(ze.marked="property",v(ee))}function W(e){return":"==e?v(j):"("==e?p(ee):void 0}function N(e,t){function r(n){if(","==n){var a=ze.state.lexical;return"call"==a.info&&(a.pos=(a.pos||0)+1),v(e,r)}return n==t?v():v(h(t))}return function(n){return n==t?v():p(e,r)}}function B(e,t,r){for(var n=3;n!?|~^]/,Ve=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Ee="([{}])",Ie={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},ze={state:null,column:null,marked:null,cc:null},Te={name:"this",next:{name:"arguments"}};return x.lex=!0,{startState:function(e){var t={tokenize:i,lastType:"sof",cc:[],lexical:new s((e||0)-ke,0,"block",!1),localVars:r.localVars,context:r.localVars&&{vars:r.localVars},indented:0};return r.globalVars&&"object"==typeof r.globalVars&&(t.globalVars=r.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),l(e,t)),t.tokenize!=c&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==me?r:(t.lastType="operator"!=me||"++"!=ye&&"--"!=ye?me:"incdec",d(t,r,me,ye,e))},indent:function(t,n){if(t.tokenize==c)return e.Pass;if(t.tokenize!=i)return 0;var a=n&&n.charAt(0),o=t.lexical;if(!/^\s*else\b/.test(n))for(var u=t.cc.length-1;u>=0;--u){var l=t.cc[u];if(l==x)o=o.prev;else if(l!=Q)break}"stat"==o.type&&"}"==a&&(o=o.prev),be&&")"==o.type&&"stat"==o.prev.type&&(o=o.prev);var s=o.type,f=a==s;return"vardef"==s?o.indented+("operator"==t.lastType||","==t.lastType?o.info+1:0):"form"==s&&"{"==a?o.indented:"form"==s?o.indented+ke:"stat"==s?o.indented+(ve(t,n)?be||ke:0):"switch"!=o.info||f||0==r.doubleIndentSwitch?o.align?o.column+(f?0:1):o.indented+(f?0:ke):o.indented+(/^(?:case|default)\b/.test(n)?ke:2*ke)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:he?null:"/*",blockCommentEnd:he?null:"*/",lineComment:he?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:he?"json":"javascript",jsonldMode:xe,jsonMode:he}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}); -!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("../xml/xml"),require("../meta")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],t):t(CodeMirror)}(function(t){"use strict";t.defineMode("markdown",function(e,i){function n(i){if(t.findModeByName){var n=t.findModeByName(i);n&&(i=n.mime||n.mimes[0])}var r=t.getMode(e,i);return"null"==r.name?null:r}function r(t,e,i){return e.f=e.inline=i,i(t,e)}function a(t,e,i){return e.f=e.block=i,i(t,e)}function o(t){return t.linkTitle=!1,t.em=!1,t.strong=!1,t.strikethrough=!1,t.quote=0,L||t.f!=h||(t.f=m,t.block=l),t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.thisLineHasContent=!1,null}function l(t,e){var a=t.sol(),o=e.list!==!1;e.list!==!1&&e.indentationDiff>=0?(e.indentationDiff<4&&(e.indentation-=e.indentationDiff),e.list=null):e.list!==!1&&e.indentation>0?(e.list=null,e.listDepth=Math.floor(e.indentation/4)):e.list!==!1&&(e.list=!1,e.listDepth=0);var l=null;if(e.indentationDiff>=4)return e.indentation-=4,t.skipToEnd(),M;if(t.eatSpace())return null;if(l=t.match(P))return e.header=l[0].length<=6?l[0].length:6,i.highlightFormatting&&(e.formatting="header"),e.f=e.inline,f(e);if(e.prevLineHasContent&&(l=t.match(z)))return e.header="="==l[0].charAt(0)?1:2,i.highlightFormatting&&(e.formatting="header"),e.f=e.inline,f(e);if(t.eat(">"))return e.indentation++,e.quote=a?1:e.quote+1,i.highlightFormatting&&(e.formatting="quote"),t.eatSpace(),f(e);if("["===t.peek())return r(t,e,p);if(t.match(U,!0))return T;if((!e.prevLineHasContent||o)&&(t.match(R,!1)||t.match(A,!1))){var h=null;return t.match(R,!0)?h="ul":(t.match(A,!0),h="ol"),e.indentation+=4,e.list=!0,e.listDepth++,i.taskLists&&t.match(I,!1)&&(e.taskList=!0),e.f=e.inline,i.highlightFormatting&&(e.formatting=["list","list-"+h]),f(e)}return i.fencedCodeBlocks&&t.match(/^```[ \t]*([\w+#]*)/,!0)?(e.localMode=n(RegExp.$1),e.localMode&&(e.localState=e.localMode.startState()),e.f=e.block=g,i.highlightFormatting&&(e.formatting="code-block"),e.code=!0,f(e)):r(t,e,e.inline)}function h(t,e){var i=F.token(t,e.htmlState);return(L&&null===e.htmlState.tagStart&&!e.htmlState.context||e.md_inside&&t.current().indexOf(">")>-1)&&(e.f=m,e.block=l,e.htmlState=null),i}function g(t,e){return t.sol()&&t.match("```",!1)?(e.localMode=e.localState=null,e.f=e.block=s,null):e.localMode?e.localMode.token(t,e.localState):(t.skipToEnd(),M)}function s(t,e){t.match("```"),e.block=l,e.f=m,i.highlightFormatting&&(e.formatting="code-block"),e.code=!0;var n=f(e);return e.code=!1,n}function f(t){var e=[];if(t.formatting){e.push(y),"string"==typeof t.formatting&&(t.formatting=[t.formatting]);for(var n=0;n=t.quote?e.push(y+"-"+t.formatting[n]+"-"+t.quote):e.push("error"))}if(t.taskOpen)return e.push("meta"),e.length?e.join(" "):null;if(t.taskClosed)return e.push("property"),e.length?e.join(" "):null;if(t.linkHref)return e.push(O),e.length?e.join(" "):null;if(t.strong&&e.push(E),t.em&&e.push(j),t.strikethrough&&e.push(W),t.linkText&&e.push(N),t.code&&e.push(M),t.header&&(e.push(q),e.push(q+"-"+t.header)),t.quote&&(e.push(w),!i.maxBlockquoteDepth||i.maxBlockquoteDepth>=t.quote?e.push(w+"-"+t.quote):e.push(w+"-"+i.maxBlockquoteDepth)),t.list!==!1){var r=(t.listDepth-1)%3;r?1===r?e.push(D):e.push(H):e.push(C)}return t.trailingSpaceNewLine?e.push("trailing-space-new-line"):t.trailingSpace&&e.push("trailing-space-"+(t.trailingSpace%2?"a":"b")),e.length?e.join(" "):null}function u(t,e){return t.match(G,!0)?f(e):void 0}function m(e,n){var r=n.text(e,n);if("undefined"!=typeof r)return r;if(n.list)return n.list=null,f(n);if(n.taskList){var o="x"!==e.match(I,!0)[1];return o?n.taskOpen=!0:n.taskClosed=!0,i.highlightFormatting&&(n.formatting="task"),n.taskList=!1,f(n)}if(n.taskOpen=!1,n.taskClosed=!1,n.header&&e.match(/^#+$/,!0))return i.highlightFormatting&&(n.formatting="header"),f(n);var l=e.sol(),g=e.next();if("\\"===g&&(e.next(),i.highlightFormatting)){var s=f(n);return s?s+" formatting-escape":"formatting-escape"}if(n.linkTitle){n.linkTitle=!1;var u=g;"("===g&&(u=")"),u=(u+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var m="^\\s*(?:[^"+u+"\\\\]+|\\\\\\\\|\\\\.)"+u;if(e.match(new RegExp(m),!0))return O}if("`"===g){var k=n.formatting;i.highlightFormatting&&(n.formatting="code");var p=f(n),v=e.pos;e.eatWhile("`");var x=1+e.pos-v;return n.code?x===b?(n.code=!1,p):(n.formatting=k,f(n)):(b=x,n.code=!0,f(n))}if(n.code)return f(n);if("!"===g&&e.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return e.match(/\[[^\]]*\]/),n.inline=n.f=d,B;if("["===g&&e.match(/.*\](\(.*\)| ?\[.*\])/,!1))return n.linkText=!0,i.highlightFormatting&&(n.formatting="link"),f(n);if("]"===g&&n.linkText&&e.match(/\(.*\)| ?\[.*\]/,!1)){i.highlightFormatting&&(n.formatting="link");var s=f(n);return n.linkText=!1,n.inline=n.f=d,s}if("<"===g&&e.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=c,i.highlightFormatting&&(n.formatting="link");var s=f(n);return s?s+=" ":s="",s+_}if("<"===g&&e.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=c,i.highlightFormatting&&(n.formatting="link");var s=f(n);return s?s+=" ":s="",s+$}if("<"===g&&e.match(/^\w/,!1)){if(-1!=e.string.indexOf(">")){var S=e.string.substring(1,e.string.indexOf(">"));/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(S)&&(n.md_inside=!0)}return e.backUp(1),n.htmlState=t.startState(F),a(e,n,h)}if("<"===g&&e.match(/^\/\w*?>/))return n.md_inside=!1,"tag";var L=!1;if(!i.underscoresBreakWords&&"_"===g&&"_"!==e.peek()&&e.match(/(\w)/,!1)){var q=e.pos-2;if(q>=0){var M=e.string.charAt(q);"_"!==M&&M.match(/(\w)/,!1)&&(L=!0)}}if("*"===g||"_"===g&&!L)if(l&&" "===e.peek());else{if(n.strong===g&&e.eat(g)){i.highlightFormatting&&(n.formatting="strong");var p=f(n);return n.strong=!1,p}if(!n.strong&&e.eat(g))return n.strong=g,i.highlightFormatting&&(n.formatting="strong"),f(n);if(n.em===g){i.highlightFormatting&&(n.formatting="em");var p=f(n);return n.em=!1,p}if(!n.em)return n.em=g,i.highlightFormatting&&(n.formatting="em"),f(n)}else if(" "===g&&(e.eat("*")||e.eat("_"))){if(" "===e.peek())return f(n);e.backUp(1)}if(i.strikethrough)if("~"===g&&e.eatWhile(g)){if(n.strikethrough){i.highlightFormatting&&(n.formatting="strikethrough");var p=f(n);return n.strikethrough=!1,p}if(e.match(/^[^\s]/,!1))return n.strikethrough=!0,i.highlightFormatting&&(n.formatting="strikethrough"),f(n)}else if(" "===g&&e.match(/^~~/,!0)){if(" "===e.peek())return f(n);e.backUp(2)}return" "===g&&(e.match(/ +$/,!1)?n.trailingSpace++:n.trailingSpace&&(n.trailingSpaceNewLine=!0)),f(n)}function c(t,e){var n=t.next();if(">"===n){e.f=e.inline=m,i.highlightFormatting&&(e.formatting="link");var r=f(e);return r?r+=" ":r="",r+_}return t.match(/^[^>]+/,!0),_}function d(t,e){if(t.eatSpace())return null;var n=t.next();return"("===n||"["===n?(e.f=e.inline=k("("===n?")":"]"),i.highlightFormatting&&(e.formatting="link-string"),e.linkHref=!0,f(e)):"error"}function k(t){return function(e,n){var r=e.next();if(r===t){n.f=n.inline=m,i.highlightFormatting&&(n.formatting="link-string");var a=f(n);return n.linkHref=!1,a}return e.match(S(t),!0)&&e.backUp(1),n.linkHref=!0,f(n)}}function p(t,e){return t.match(/^[^\]]*\]:/,!1)?(e.f=v,t.next(),i.highlightFormatting&&(e.formatting="link"),e.linkText=!0,f(e)):r(t,e,m)}function v(t,e){if(t.match(/^\]:/,!0)){e.f=e.inline=x,i.highlightFormatting&&(e.formatting="link");var n=f(e);return e.linkText=!1,n}return t.match(/^[^\]]+/,!0),N}function x(t,e){return t.eatSpace()?null:(t.match(/^[^\s]+/,!0),void 0===t.peek()?e.linkTitle=!0:t.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),e.f=e.inline=m,O)}function S(t){return J[t]||(t=(t+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),J[t]=new RegExp("^(?:[^\\\\]|\\\\.)*?("+t+")")),J[t]}var L=t.modes.hasOwnProperty("xml"),F=t.getMode(e,L?{name:"xml",htmlMode:!0}:"text/plain");void 0===i.highlightFormatting&&(i.highlightFormatting=!1),void 0===i.maxBlockquoteDepth&&(i.maxBlockquoteDepth=0),void 0===i.underscoresBreakWords&&(i.underscoresBreakWords=!0),void 0===i.fencedCodeBlocks&&(i.fencedCodeBlocks=!1),void 0===i.taskLists&&(i.taskLists=!1),void 0===i.strikethrough&&(i.strikethrough=!1);var b=0,q="header",M="comment",w="quote",C="variable-2",D="variable-3",H="keyword",T="hr",B="tag",y="formatting",_="link",$="link",N="link",O="string",j="em",E="strong",W="strikethrough",U=/^([*\-=_])(?:\s*\1){2,}\s*$/,R=/^[*\-+]\s+/,A=/^[0-9]+\.\s+/,I=/^\[(x| )\](?=\s)/,P=/^#+/,z=/^(?:\={1,}|-{1,})$/,G=/^[^#!\[\]*_\\<>` "'(~]+/,J=[],K={startState:function(){return{f:l,prevLineHasContent:!1,thisLineHasContent:!1,block:l,htmlState:null,indentation:0,inline:m,text:u,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,em:!1,strong:!1,header:0,taskList:!1,list:!1,listDepth:0,quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1}},copyState:function(e){return{f:e.f,prevLineHasContent:e.prevLineHasContent,thisLineHasContent:e.thisLineHasContent,block:e.block,htmlState:e.htmlState&&t.copyState(F,e.htmlState),indentation:e.indentation,localMode:e.localMode,localState:e.localMode?t.copyState(e.localMode,e.localState):null,inline:e.inline,text:e.text,formatting:!1,linkTitle:e.linkTitle,em:e.em,strong:e.strong,strikethrough:e.strikethrough,header:e.header,taskList:e.taskList,list:e.list,listDepth:e.listDepth,quote:e.quote,trailingSpace:e.trailingSpace,trailingSpaceNewLine:e.trailingSpaceNewLine,md_inside:e.md_inside}},token:function(t,e){if(e.formatting=!1,t.sol()){var i=!!e.header;if(e.header=0,t.match(/^\s*$/,!0)||i)return e.prevLineHasContent=!1,o(e),i?this.token(t,e):null;e.prevLineHasContent=e.thisLineHasContent,e.thisLineHasContent=!0,e.taskList=!1,e.code=!1,e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.f=e.block;var n=t.match(/^\s*/,!0)[0].replace(/\t/g," ").length,r=4*Math.floor((n-e.indentation)/4);r>4&&(r=4);var a=e.indentation+r;if(e.indentationDiff=a-e.indentation,e.indentation=a,n>0)return null}return e.f(t,e)},innerMode:function(t){return t.block==h?{state:t.htmlState,mode:F}:t.localState?{state:t.localState,mode:t.localMode}:{state:t,mode:K}},blankLine:o,getType:f,fold:"markdown"};return K},"xml"),t.defineMIME("text/x-markdown","markdown")}); -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=0;r")?(e.match("-->"),t.tokenize=null):e.skipToEnd(),["comment","comment"]}e.defineMode("css",function(t,r){function o(e,t){return m=t,e}function a(e,t){var r=e.next();if(b[r]){var a=b[r](e,t);if(a!==!1)return a}return"@"==r?(e.eatWhile(/[\w\\\-]/),o("def",e.current())):"="==r||("~"==r||"|"==r)&&e.eat("=")?o(null,"compare"):'"'==r||"'"==r?(t.tokenize=i(r),t.tokenize(e,t)):"#"==r?(e.eatWhile(/[\w\\\-]/),o("atom","hash")):"!"==r?(e.match(/^\s*\w*/),o("keyword","important")):/\d/.test(r)||"."==r&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),o("number","unit")):"-"!==r?/[,+>*\/]/.test(r)?o(null,"select-op"):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?o("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?o(null,r):"u"==r&&e.match(/rl(-prefix)?\(/)||"d"==r&&e.match("omain(")||"r"==r&&e.match("egexp(")?(e.backUp(1),t.tokenize=n,o("property","word")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),o("property","word")):o(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),o("number","unit")):e.match(/^-[\w\\\-]+/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?o("variable-2","variable-definition"):o("variable-2","variable")):e.match(/^\w+-/)?o("meta","meta"):void 0}function i(e){return function(t,r){for(var a,i=!1;null!=(a=t.next());){if(a==e&&!i){")"==e&&t.backUp(1);break}i=!i&&"\\"==a}return(a==e||!i&&")"!=e)&&(r.tokenize=null),o("string","string")}}function n(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=i(")"),o(null,"(")}function l(e,t,r){this.type=e,this.indent=t,this.prev=r}function s(e,t,r){return e.context=new l(r,t.indentation()+g,e.context),r}function c(e){return e.context=e.context.prev,e.context.type}function d(e,t,r){return K[r.context.type](e,t,r)}function u(e,t,r,o){for(var a=o||1;a>0;a--)r.context=r.context.prev;return d(e,t,r)}function p(e){var t=e.current().toLowerCase();h=j.hasOwnProperty(t)?"atom":q.hasOwnProperty(t)?"keyword":"variable"}r.propertyKeywords||(r=e.resolveMode("text/css"));var m,h,g=t.indentUnit,b=r.tokenHooks,f=r.documentTypes||{},k=r.mediaTypes||{},y=r.mediaFeatures||{},w=r.propertyKeywords||{},v=r.nonStandardPropertyKeywords||{},x=r.fontProperties||{},z=r.counterDescriptors||{},q=r.colorKeywords||{},j=r.valueKeywords||{},P=r.allowNested,K={};return K.top=function(e,t,r){if("{"==e)return s(r,t,"block");if("}"==e&&r.context.prev)return c(r);if(/@(media|supports|(-moz-)?document)/.test(e))return s(r,t,"atBlock");if(/@(font-face|counter-style)/.test(e))return r.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return s(r,t,"at");if("hash"==e)h="builtin";else if("word"==e)h="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return s(r,t,"interpolation");if(":"==e)return"pseudo";if(P&&"("==e)return s(r,t,"parens")}return r.context.type},K.block=function(e,t,r){if("word"==e){var o=t.current().toLowerCase();return w.hasOwnProperty(o)?(h="property","maybeprop"):v.hasOwnProperty(o)?(h="string-2","maybeprop"):P?(h=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(h+=" error","maybeprop")}return"meta"==e?"block":P||"hash"!=e&&"qualifier"!=e?K.top(e,t,r):(h="error","block")},K.maybeprop=function(e,t,r){return":"==e?s(r,t,"prop"):d(e,t,r)},K.prop=function(e,t,r){if(";"==e)return c(r);if("{"==e&&P)return s(r,t,"propBlock");if("}"==e||"{"==e)return u(e,t,r);if("("==e)return s(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t.current())){if("word"==e)p(t);else if("interpolation"==e)return s(r,t,"interpolation")}else h+=" error";return"prop"},K.propBlock=function(e,t,r){return"}"==e?c(r):"word"==e?(h="property","maybeprop"):r.context.type},K.parens=function(e,t,r){return"{"==e||"}"==e?u(e,t,r):")"==e?c(r):"("==e?s(r,t,"parens"):"interpolation"==e?s(r,t,"interpolation"):("word"==e&&p(t),"parens")},K.pseudo=function(e,t,r){return"word"==e?(h="variable-3",r.context.type):d(e,t,r)},K.atBlock=function(e,t,r){if("("==e)return s(r,t,"atBlock_parens");if("}"==e)return u(e,t,r);if("{"==e)return c(r)&&s(r,t,P?"block":"top");if("word"==e){var o=t.current().toLowerCase();h="only"==o||"not"==o||"and"==o||"or"==o?"keyword":f.hasOwnProperty(o)?"tag":k.hasOwnProperty(o)?"attribute":y.hasOwnProperty(o)?"property":w.hasOwnProperty(o)?"property":v.hasOwnProperty(o)?"string-2":j.hasOwnProperty(o)?"atom":"error"}return r.context.type},K.atBlock_parens=function(e,t,r){return")"==e?c(r):"{"==e||"}"==e?u(e,t,r,2):K.atBlock(e,t,r)},K.restricted_atBlock_before=function(e,t,r){return"{"==e?s(r,t,"restricted_atBlock"):"word"==e&&"@counter-style"==r.stateArg?(h="variable","restricted_atBlock_before"):d(e,t,r)},K.restricted_atBlock=function(e,t,r){return"}"==e?(r.stateArg=null,c(r)):"word"==e?(h="@font-face"==r.stateArg&&!x.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==r.stateArg&&!z.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},K.keyframes=function(e,t,r){return"word"==e?(h="variable","keyframes"):"{"==e?s(r,t,"top"):d(e,t,r)},K.at=function(e,t,r){return";"==e?c(r):"{"==e||"}"==e?u(e,t,r):("word"==e?h="tag":"hash"==e&&(h="builtin"),"at")},K.interpolation=function(e,t,r){return"}"==e?c(r):"{"==e||";"==e?u(e,t,r):("variable"!=e&&(h="error"),"interpolation")},{startState:function(e){return{tokenize:null,state:"top",stateArg:null,context:new l("top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var r=(t.tokenize||a)(e,t);return r&&"object"==typeof r&&(m=r[1],r=r[0]),h=r,t.state=K[t.state](m,e,t),h},indent:function(e,t){var r=e.context,o=t&&t.charAt(0),a=r.indent;return"prop"!=r.type||"}"!=o&&")"!=o||(r=r.prev),!r.prev||("}"!=o||"block"!=r.type&&"top"!=r.type&&"interpolation"!=r.type&&"restricted_atBlock"!=r.type)&&(")"!=o||"parens"!=r.type&&"atBlock_parens"!=r.type)&&("{"!=o||"at"!=r.type&&"atBlock"!=r.type)||(a=r.indent-g,r=r.prev),a},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var a=["domain","regexp","url","url-prefix"],i=t(a),n=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],l=t(n),s=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],c=t(s),d=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],u=t(d),p=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],m=t(p),h=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],g=t(h),b=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],f=t(b),k=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],y=t(k),w=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small"],v=t(w),x=a.concat(n).concat(s).concat(d).concat(p).concat(k).concat(w);e.registerHelper("hintWords","css",x),e.defineMIME("text/css",{documentTypes:i,mediaTypes:l,mediaFeatures:c,propertyKeywords:u,nonStandardPropertyKeywords:m,fontProperties:g,counterDescriptors:f,colorKeywords:y,valueKeywords:v,tokenHooks:{"<":function(e,t){return e.match("!--")?(t.tokenize=o,o(e,t)):!1},"/":function(e,t){return e.eat("*")?(t.tokenize=r,r(e,t)):!1}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:l,mediaFeatures:c,propertyKeywords:u,nonStandardPropertyKeywords:m,colorKeywords:y,valueKeywords:v,fontProperties:g,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},":":function(e){return e.match(/\s*\{/)?[null,"{"]:!1},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return e.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:l,mediaFeatures:c,propertyKeywords:u,nonStandardPropertyKeywords:m,colorKeywords:y,valueKeywords:v,fontProperties:g,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},"@":function(e){return e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)?!1:(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})}); -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("shell",function(){function e(e,t){for(var n=t.split(" "),r=0;r1&&e.eat("$");var i=e.next(),o=/\w/;return"{"===i&&(o=/[^}]/),"("===i?(t.tokens[0]=n(")"),r(e,t)):(/\d/.test(i)||(e.eatWhile(o),e.eat("}")),t.tokens.shift(),"def")};return{startState:function(){return{tokens:[]}},token:function(e,t){return r(e,t)},lineComment:"#",fold:"brace"}}),e.defineMIME("text/x-sh","shell")}); -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("sql",function(t,r){function a(e,t){var r=e.next();if(b[r]){var a=b[r](e,t);if(a!==!1)return a}if(1==p.hexNumber&&("0"==r&&e.match(/^[xX][0-9a-fA-F]+/)||("x"==r||"X"==r)&&e.match(/^'[0-9a-fA-F]+'/)))return"number";if(1==p.binaryNumber&&(("b"==r||"B"==r)&&e.match(/^'[01]+'/)||"0"==r&&e.match(/^b[01]+/)))return"number";if(r.charCodeAt(0)>47&&r.charCodeAt(0)<58)return e.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/),1==p.decimallessFloat&&e.eat("."),"number";if("?"==r&&(e.eatSpace()||e.eol()||e.eat(";")))return"variable-3";if("'"==r||'"'==r&&p.doubleQuote)return t.tokenize=n(r),t.tokenize(e,t);if((1==p.nCharCast&&("n"==r||"N"==r)||1==p.charsetCast&&"_"==r&&e.match(/[a-z][a-z0-9]*/i))&&("'"==e.peek()||'"'==e.peek()))return"keyword";if(/^[\(\),\;\[\]]/.test(r))return null;if(p.commentSlashSlash&&"/"==r&&e.eat("/"))return e.skipToEnd(),"comment";if(p.commentHash&&"#"==r||"-"==r&&e.eat("-")&&(!p.commentSpaceRequired||e.eat(" ")))return e.skipToEnd(),"comment";if("/"==r&&e.eat("*"))return t.tokenize=i,t.tokenize(e,t);if("."!=r){if(m.test(r))return e.eatWhile(m),null;if("{"==r&&(e.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||e.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";e.eatWhile(/^[_\w\d]/);var o=e.current().toLowerCase();return h.hasOwnProperty(o)&&(e.match(/^( )+'[^']*'/)||e.match(/^( )+"[^"]*"/))?"number":c.hasOwnProperty(o)?"atom":u.hasOwnProperty(o)?"builtin":d.hasOwnProperty(o)?"keyword":l.hasOwnProperty(o)?"string-2":null}return 1==p.zerolessFloat&&e.match(/^(?:\d+(?:e[+-]?\d+)?)/i)?"number":1==p.ODBCdotTable&&e.match(/^[a-zA-Z_]+/)?"variable-2":void 0}function n(e){return function(t,r){for(var n,i=!1;null!=(n=t.next());){if(n==e&&!i){r.tokenize=a;break}i=!i&&"\\"==n}return"string"}}function i(e,t){for(;;){if(!e.skipTo("*")){e.skipToEnd();break}if(e.next(),e.eat("/")){t.tokenize=a;break}}return"comment"}function o(e,t,r){t.context={prev:t.context,indent:e.indentation(),col:e.column(),type:r}}function s(e){e.indent=e.context.indent,e.context=e.context.prev}var l=r.client||{},c=r.atoms||{"false":!0,"true":!0,"null":!0},u=r.builtin||{},d=r.keywords||{},m=r.operatorChars||/^[*+\-%<>!=&|~^]/,p=r.support||{},b=r.hooks||{},h=r.dateSQL||{date:!0,time:!0,timestamp:!0};return{startState:function(){return{tokenize:a,context:null}},token:function(e,t){if(e.sol()&&t.context&&null==t.context.align&&(t.context.align=!1),e.eatSpace())return null;var r=t.tokenize(e,t);if("comment"==r)return r;t.context&&null==t.context.align&&(t.context.align=!0);var a=e.current();return"("==a?o(e,t,")"):"["==a?o(e,t,"]"):t.context&&t.context.type==a&&s(t),r},indent:function(r,a){var n=r.context;if(!n)return e.Pass;var i=a.charAt(0)==n.type;return n.align?n.col+(i?0:1):n.indent+(i?0:t.indentUnit)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:p.commentSlashSlash?"//":p.commentHash?"#":null}}),function(){function t(e){for(var t;null!=(t=e.next());)if("`"==t&&!e.eat("`"))return"variable-2";return e.backUp(e.current().length-1),e.eatWhile(/\w/)?"variable-2":null}function r(e){return e.eat("@")&&(e.match(/^session\./),e.match(/^local\./),e.match(/^global\./)),e.eat("'")?(e.match(/^.*'/),"variable-2"):e.eat('"')?(e.match(/^.*"/),"variable-2"):e.eat("`")?(e.match(/^.*`/),"variable-2"):e.match(/^[0-9a-zA-Z$\.\_]+/)?"variable-2":null}function a(e){return e.eat("N")?"atom":e.match(/^[a-zA-Z.#!?]/)?"variable-2":null}function n(e){for(var t={},r=e.split(" "),a=0;a!=]/,dateSQL:n("date time timestamp"),support:n("ODBCdotTable doubleQuote binaryNumber hexNumber")}),e.defineMIME("text/x-mssql",{name:"sql",client:n("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:n(i+"begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered"),builtin:n("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),atoms:n("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:n("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":r}}),e.defineMIME("text/x-mysql",{name:"sql",client:n("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:n(i+"accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group groupby_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:n("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:n("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:n("date time timestamp"),support:n("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":r,"`":t,"\\":a}}),e.defineMIME("text/x-mariadb",{name:"sql",client:n("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:n(i+"accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:n("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:n("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:n("date time timestamp"),support:n("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":r,"`":t,"\\":a}}),e.defineMIME("text/x-cassandra",{name:"sql",client:{},keywords:n("use select from using consistency where limit first reversed first and in insert into values using consistency ttl update set delete truncate begin batch apply create keyspace with columnfamily primary key index on drop alter type add any one quorum all local_quorum each_quorum"),builtin:n("ascii bigint blob boolean counter decimal double float int text timestamp uuid varchar varint"),atoms:n("false true"),operatorChars:/^[<>=]/,dateSQL:{},support:n("commentSlashSlash decimallessFloat"),hooks:{}}),e.defineMIME("text/x-plsql",{name:"sql",client:n("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),keywords:n("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),builtin:n("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least lenght lenghtb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),operatorChars:/^[*+\-%<>!=~]/,dateSQL:n("date time timestamp"),support:n("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")}),e.defineMIME("text/x-hive",{name:"sql",keywords:n("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),builtin:n("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),atoms:n("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:n("date timestamp"),support:n("ODBCdotTable doubleQuote binaryNumber hexNumber")})}()}); -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/dialog/dialog"),require("../addon/edit/matchbrackets.js")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/dialog/dialog","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(e){"use strict";var t=[{keys:"",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"",type:"keyToKey",toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"xi",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"dcc",context:"visual"},{keys:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0}},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"",type:"action",action:"redo"},{keys:"m",type:"action",action:"setMark"},{keys:'"',type:"action",action:"setRegister"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],r=e.Pos,n=function(){function n(t){t.setOption("disableInput",!0),t.setOption("showCursorWhenSelecting",!1),e.signal(t,"vim-mode-change",{mode:"normal"}),t.on("cursorActivity",Ye),x(t),e.on(t.getInputField(),"paste",c(t))}function o(t){t.setOption("disableInput",!1),t.off("cursorActivity",Ye),e.off(t.getInputField(),"paste",c(t)),t.state.vim=null}function i(t,r){this==e.keyMap.vim&&e.rmClass(t.getWrapperElement(),"cm-fat-cursor"),r&&r.attach==a||o(t,!1)}function a(t,r){this==e.keyMap.vim&&e.addClass(t.getWrapperElement(),"cm-fat-cursor"),r&&r.attach==a||n(t)}function s(t,r){if(r){var n=l(t);if(!n)return!1;var o=e.Vim.findKey(r,n);return"function"==typeof o&&e.signal(r,"vim-keypress",n),o}}function l(e){if("'"==e.charAt(0))return e.charAt(1);var t=e.split("-");/-$/.test(e)&&t.splice(-2,2,"-");var r=t[t.length-1];if(1==t.length&&1==t[0].length)return!1;if(2==t.length&&"Shift"==t[0]&&1==r.length)return!1;for(var n=!1,o=0;o"):!1}function c(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(N(e.getCursor(),0,1)),St.enterInsertMode(e,{},t))}),t.onPasteFn}function u(e,t){for(var r=[],n=e;e+t>n;n++)r.push(String.fromCharCode(n));return r}function h(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function p(e){return/^[a-z]$/.test(e)}function d(e){return-1!="()[]{}".indexOf(e)}function f(e){return st.test(e)}function m(e){return/^[A-Z]$/.test(e)}function v(e){return/^\s*$/.test(e)}function g(e,t){for(var r=0;rn;n++)r.push(e);return r}function B(e,t){Mt[e]=t}function I(e,t){St[e]=t}function O(e,t,n){var o=Math.min(Math.max(e.firstLine(),t.line),e.lastLine()),i=q(e,o)-1;i=n?i+1:i;var a=Math.min(Math.max(0,t.ch),i);return r(o,a)}function K(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}function N(e,t,n){return"object"==typeof t&&(n=t.ch,t=t.line),r(e.line+t,e.ch+n)}function P(e,t){return{line:t.line-e.line,ch:t.line-e.line}}function j(e,t,r,n){for(var o,i=[],a=[],s=0;s"==t.slice(-11)){var r=t.length-11,n=e.slice(0,r),o=t.slice(0,r);return n==o&&e.length>r?"full":0==o.indexOf(n)?"partial":!1}return e==t?"full":0==t.indexOf(e)?"partial":!1}function F(e){var t=/^.*(<[\w\-]+>)$/.exec(e),r=t?t[1]:e.slice(-1);if(r.length>1)switch(r){case"":r="\n";break;case"":r=" "}return r}function W(e,t,r){return function(){for(var n=0;r>n;n++)t(e)}}function D(e){return r(e.line,e.ch)}function _(e,t){return e.ch==t.ch&&e.line==t.line}function V(e,t){return e.line2&&(t=J.apply(void 0,Array.prototype.slice.call(arguments,1))),V(e,t)?e:t}function U(e,t){return arguments.length>2&&(t=U.apply(void 0,Array.prototype.slice.call(arguments,1))),V(e,t)?t:e}function $(e,t,r){var n=V(e,t),o=V(t,r);return n&&o}function q(e,t){return e.getLine(t).length}function Q(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function z(e){return e.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function Z(e,t,n){var o=q(e,t),i=new Array(n-o+1).join(" ");e.setCursor(r(t,o)),e.replaceRange(i,e.getCursor())}function G(e,t){var n=[],o=e.listSelections(),i=D(e.clipPos(t)),a=!_(t,i),s=e.getCursor("head"),l=X(o,s),c=_(o[l].head,o[l].anchor),u=o.length-1,h=u-l>l?u:0,p=o[h].anchor,d=Math.min(p.line,i.line),f=Math.max(p.line,i.line),m=p.ch,v=i.ch,g=o[h].head.ch-m,y=v-m;g>0&&0>=y?(m++,a||v--):0>g&&y>=0?(m--,c||v++):0>g&&-1==y&&(m--,v++);for(var k=d;f>=k;k++){var C={anchor:new r(k,m),head:new r(k,v)};n.push(C)}return l=i.line==f?n.length-1:0,e.setSelections(n),t.ch=v,p.ch=m,p}function Y(e,t,r){for(var n=[],o=0;r>o;o++){var i=N(t,o,0);n.push({anchor:i,head:i})}e.setSelections(n,0)}function X(e,t,r){for(var n=0;nc&&(i.line=c),i.ch=q(e,i.line)}return{ranges:[{anchor:a,head:i}],primary:0}}if("block"==n){for(var u=Math.min(a.line,i.line),h=Math.min(a.ch,i.ch),p=Math.max(a.line,i.line),d=Math.max(a.ch,i.ch)+1,f=p-u+1,m=i.line==u?0:f-1,v=[],g=0;f>g;g++)v.push({anchor:r(u+g,h),head:r(u+g,d)});return{ranges:v,primary:m}}}function ie(e){var t=e.getCursor("head");return 1==e.getSelection().length&&(t=J(t,e.getCursor("anchor"))),t}function ae(t,r){var n=t.state.vim;r!==!1&&t.setCursor(O(t,n.sel.head)),te(t,n),n.visualMode=!1,n.visualLine=!1,n.visualBlock=!1,e.signal(t,"vim-mode-change",{mode:"normal"}),n.fakeCursor&&n.fakeCursor.clear()}function se(e,t,r){var n=e.getRange(t,r);if(/\n\s*$/.test(n)){var o=n.split("\n");o.pop();for(var i,i=o.pop();o.length>0&&i&&v(i);i=o.pop())r.line--,r.ch=0;i?(r.line--,r.ch=q(e,r.line)):r.ch=0}}function le(e,t,r){t.ch=0,r.ch=0,r.line++}function ce(e){if(!e)return 0;var t=e.search(/\S/);return-1==t?e.length:t}function ue(e,t,n,o,i){for(var a=ie(e),s=e.getLine(a.line),l=a.ch,c=i?lt[0]:ct[0];!c(s.charAt(l));)if(l++,l>=s.length)return null;o?c=ct[0]:(c=lt[0],c(s.charAt(l))||(c=lt[1]));for(var u=l,h=l;c(s.charAt(u))&&u=0;)h--;if(h++,t){for(var p=u;/\s/.test(s.charAt(u))&&u0;)h--;h||(h=d)}}return{start:r(a.line,h),end:r(a.line,u)}}function he(e,t,r){_(t,r)||yt.jumpList.add(e,t,r)}function pe(e,t){yt.lastChararacterSearch.increment=e,yt.lastChararacterSearch.forward=t.forward,yt.lastChararacterSearch.selectedCharacter=t.selectedCharacter}function de(e,t,n,o){var i=D(e.getCursor()),a=n?1:-1,s=n?e.lineCount():-1,l=i.ch,c=i.line,u=e.getLine(c),h={lineText:u,nextCh:u.charAt(l),lastCh:null,index:l,symb:o,reverseSymb:(n?{")":"(","}":"{"}:{"(":")","{":"}"})[o],forward:n,depth:0,curMoveThrough:!1},p=At[o];if(!p)return i;var d=bt[p].init,f=bt[p].isComplete;for(d&&d(h);c!==s&&t;){if(h.index+=a,h.nextCh=h.lineText.charAt(h.index),!h.nextCh){if(c+=a,h.lineText=e.getLine(c)||"",a>0)h.index=0;else{var m=h.lineText.length;h.index=m>0?m-1:0}h.nextCh=h.lineText.charAt(h.index)}f(h)&&(i.line=c,i.ch=h.index,t--)}return h.nextCh||h.curMoveThrough?r(c,h.index):i}function fe(e,t,r,n,o){var i=t.line,a=t.ch,s=e.getLine(i),l=r?1:-1,c=n?ct:lt;if(o&&""==s){if(i+=l,s=e.getLine(i),!h(e,i))return null;a=r?0:s.length}for(;;){if(o&&""==s)return{from:0,to:0,line:i};for(var u=l>0?s.length:-1,p=u,d=u;a!=u;){for(var f=!1,m=0;m0?0:s.length}throw new Error("The impossible happened.")}function me(e,t,n,o,i,a){var s=D(t),l=[];(o&&!i||!o&&i)&&n++;for(var c=!(o&&i),u=0;n>u;u++){var h=fe(e,t,o,a,c);if(!h){var p=q(e,e.lastLine());l.push(o?{line:e.lastLine(),from:p,to:p}:{line:0,from:0,to:0});break}l.push(h),t=r(h.line,o?h.to-1:h.from)}var d=l.length!=n,f=l[0],m=l.pop();return o&&!i?(d||f.from==s.ch&&f.line==s.line||(m=l.pop()),r(m.line,m.from)):o&&i?r(m.line,m.to-1):!o&&i?(d||f.to==s.ch&&f.line==s.line||(m=l.pop()),r(m.line,m.to)):r(m.line,m.from)}function ve(e,t,n,o){for(var i,a=e.getCursor(),s=a.ch,l=0;t>l;l++){var c=e.getLine(a.line);if(i=ke(s,c,o,n,!0),-1==i)return null;s=i}return r(e.getCursor().line,i)}function ge(e,t){var n=e.getCursor().line;return O(e,r(n,t-1))}function ye(e,t,r,n){g(r,dt)&&(t.marks[r]&&t.marks[r].clear(),t.marks[r]=e.setBookmark(n))}function ke(e,t,r,n,o){var i;return n?(i=t.indexOf(r,e+1),-1==i||o||(i-=1)):(i=t.lastIndexOf(r,e-1),-1==i||o||(i+=1)),i}function Ce(e,t,n,o,i){function a(t){return!e.getLine(t)}function s(e,t,r){return r?a(e)!=a(e+t):!a(e)&&a(e+t)}var l,c,u=t.line,h=e.firstLine(),p=e.lastLine(),d=u;if(o){for(;d>=h&&p>=d&&n>0;)s(d,o)&&n--,d+=o;return new r(d,0)}var f=e.state.vim;if(f.visualLine&&s(u,1,!0)){var m=f.sel.anchor;s(m.line,-1,!0)&&(i&&m.line==u||(u+=1))}var v=a(u);for(d=u;p>=d&&n;d++)s(d,1,!0)&&(i&&a(d)==v||n--);for(c=new r(d,0),d>p&&!v?v=!0:i=!1,d=u;d>h&&(i&&a(d)!=v&&d!=u||!s(d,-1,!0));d--);return l=new r(d,0),{start:l,end:c}}function we(e,t,n,o){var i,a,s=t,l={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/}[n],c={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{"}[n],u=e.getLine(s.line).charAt(s.ch),h=u===c?1:0;if(i=e.scanForBracket(r(s.line,s.ch+h),-1,null,{bracketRegex:l}),a=e.scanForBracket(r(s.line,s.ch+h),1,null,{bracketRegex:l}),!i||!a)return{start:s,end:s};if(i=i.pos,a=a.pos,i.line==a.line&&i.ch>a.ch||i.line>a.line){var p=i;i=a,a=p}return o?a.ch+=1:i.ch+=1,{start:i,end:a}}function xe(e,t,n,o){var i,a,s,l,c=D(t),u=e.getLine(c.line),h=u.split(""),p=h.indexOf(n);if(c.ch-1&&!i;s--)h[s]==n&&(i=s+1);else i=c.ch+1;if(i&&!a)for(s=i,l=h.length;l>s&&!a;s++)h[s]==n&&(a=s);return i&&a?(o&&(--i,++a),{start:r(c.line,i),end:r(c.line,a)}):{start:c,end:c}}function Me(){}function Se(e){var t=e.state.vim;return t.searchState_||(t.searchState_=new Me)}function Ae(e,t,r,n,o){e.openDialog?e.openDialog(t,n,{bottom:!0,value:o.value,onKeyDown:o.onKeyDown,onKeyUp:o.onKeyUp,selectValueOnOpen:!1}):n(prompt(r,""))}function be(e){var t=Le(e)||[];if(!t.length)return[];var r=[];if(0===t[0]){for(var n=0;n'+t+"",{bottom:!0,duration:5e3}):alert(t)}function Oe(e,t){var r="";return e&&(r+=''+e+""),r+=' ',t&&(r+='',r+=t,r+=""),r}function Ke(e,t){var r=(t.prefix||"")+" "+(t.desc||""),n=Oe(t.prefix,t.desc);Ae(e,n,r,t.onClose,t)}function Ne(e,t){if(e instanceof RegExp&&t instanceof RegExp){for(var r=["global","multiline","ignoreCase","source"],n=0;ns;s++){var l=a.find(t);if(0==s&&l&&_(a.from(),i)&&(l=a.find(t)),!l&&(a=e.getSearchCursor(n,t?r(e.lastLine()):r(e.firstLine(),0)),!a.find(t)))return}return a.from()})}function We(e){var t=Se(e);e.removeOverlay(Se(e).getOverlay()),t.setOverlay(null),t.getScrollbarAnnotate()&&(t.getScrollbarAnnotate().clear(),t.setScrollbarAnnotate(null))}function De(e,t,r){return"number"!=typeof e&&(e=e.line),t instanceof Array?g(e,t):r?e>=t&&r>=e:e==t}function _e(e){var t=e.getScrollInfo(),r=6,n=10,o=e.coordsChar({left:0,top:r+t.top},"local"),i=t.clientHeight-n+t.top,a=e.coordsChar({left:0,top:i},"local");return{top:o.line,bottom:a.line}}function Ve(t,r,n,o,i,a,s,l,c){function u(){t.operation(function(){for(;!m;)h(),p();d()})}function h(){var e=t.getRange(a.from(),a.to()),r=e.replace(s,l);a.replace(r)}function p(){for(var e;e=a.findNext()&&De(a.from(),o,i);)if(n||!v||a.from().line!=v.line)return t.scrollIntoView(a.from(),30),t.setSelection(a.from(),a.to()),v=a.from(),void(m=!1);m=!0}function d(e){if(e&&e(),t.focus(),v){t.setCursor(v);var r=t.state.vim;r.exMode=!1,r.lastHPos=r.lastHSPos=v.ch}c&&c()}function f(r,n,o){e.e_stop(r);var i=e.keyName(r);switch(i){case"Y":h(),p();break;case"N":p();break;case"A":var a=c;c=void 0,t.operation(u),c=a;break;case"L":h();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":d(o)}return m&&d(o),!0}t.state.vim.exMode=!0;var m=!1,v=a.from();return p(),m?void Ie(t,"No matches for "+s.source):r?void Ke(t,{prefix:"replace with "+l+" (y/n/a/q/l)",onKeyDown:f}):(u(),void(c&&c()))}function Je(t){var r=t.state.vim,n=yt.macroModeState,o=yt.registerController.getRegister("."),i=n.isPlaying,a=n.lastInsertModeChanges,s=[];if(!i){for(var l=a.inVisualBlock?r.lastSelection.visualBlock.height:1,c=a.changes,s=[],u=0;u1&&(nt(t,r,r.insertModeRepeat-1,!0),r.lastEditInputState.repeatOverride=r.insertModeRepeat),delete r.insertModeRepeat,r.insertMode=!1,t.setCursor(t.getCursor().line,t.getCursor().ch-1),t.setOption("keyMap","vim"),t.setOption("disableInput",!0),t.toggleOverwrite(!1),o.setText(a.changes.join("")),e.signal(t,"vim-mode-change",{mode:"normal"}),n.isRecording&&ze(n)}function Ue(e){t.push(e)}function $e(e,t,r,n,o){var i={keys:e,type:t};i[t]=r,i[t+"Args"]=n;for(var a in o)i[a]=o[a];Ue(i)}function qe(t,r,n,o){var i=yt.registerController.getRegister(o),a=i.keyBuffer,s=0;n.isPlaying=!0,n.replaySearchQueries=i.searchQueries.slice(0);for(var l=0;l|<\w+>|./.exec(h),u=c[0],h=h.substring(c.index+u.length),e.Vim.handleKey(t,u,"macro"),r.insertMode){var p=i.insertModeChanges[s++].changes;yt.macroModeState.lastInsertModeChanges.changes=p,ot(t,p,1),Je(t)}n.isPlaying=!1}function Qe(e,t){if(!e.isPlaying){var r=e.latestRegister,n=yt.registerController.getRegister(r);n&&n.pushText(t)}}function ze(e){if(!e.isPlaying){var t=e.latestRegister,r=yt.registerController.getRegister(t);r&&r.pushInsertModeChanges(e.lastInsertModeChanges)}}function Ze(e,t){if(!e.isPlaying){var r=e.latestRegister,n=yt.registerController.getRegister(r);n&&n.pushSearchQuery(t)}}function Ge(e,t){var r=yt.macroModeState,n=r.lastInsertModeChanges;if(!r.isPlaying)for(;t;){if(n.expectCursorActivityForChange=!0,"+input"==t.origin||"paste"==t.origin||void 0===t.origin){var o=t.text.join("\n");n.changes.push(o)}t=t.next}}function Ye(e){var t=e.state.vim;if(t.insertMode){var r=yt.macroModeState;if(r.isPlaying)return;var n=r.lastInsertModeChanges;n.expectCursorActivityForChange?n.expectCursorActivityForChange=!1:n.changes=[]}else e.curOp.isVimOp||et(e,t);t.visualMode&&Xe(e)}function Xe(e){var t=e.state.vim,r=D(t.sel.head),n=N(r,0,1);t.fakeCursor&&t.fakeCursor.clear(),t.fakeCursor=e.markText(r,n,{className:"cm-animate-fat-cursor"})}function et(t,r){var n=t.getCursor("anchor"),o=t.getCursor("head");if(r.visualMode&&!t.somethingSelected()?ae(t,!1):r.visualMode||r.insertMode||!t.somethingSelected()||(r.visualMode=!0,r.visualLine=!1,e.signal(t,"vim-mode-change",{mode:"visual"})),r.visualMode){var i=V(o,n)?0:-1,a=V(o,n)?-1:0;o=N(o,0,i),n=N(n,0,a),r.sel={anchor:n,head:o},ye(t,r,"<",J(o,n)), -ye(t,r,">",U(o,n))}else r.insertMode||(r.lastHPos=t.getCursor().ch)}function tt(e){this.keyName=e}function rt(t){function r(){return o.changes.push(new tt(i)),!0}var n=yt.macroModeState,o=n.lastInsertModeChanges,i=e.keyName(t);i&&(-1!=i.indexOf("Delete")||-1!=i.indexOf("Backspace"))&&e.lookupKey(i,"vim-insert",r)}function nt(e,t,r,n){function o(){s?wt.processAction(e,t,t.lastEditActionCommand):wt.evalInput(e,t)}function i(r){if(a.lastInsertModeChanges.changes.length>0){r=t.lastEditActionCommand?r:1;var n=a.lastInsertModeChanges;ot(e,n.changes,r)}}var a=yt.macroModeState;a.isPlaying=!0;var s=!!t.lastEditActionCommand,l=t.inputState;if(t.inputState=t.lastEditInputState,s&&t.lastEditActionCommand.interlaceInsertRepeat)for(var c=0;r>c;c++)o(),i(1);else n||o(),i(r);t.inputState=l,t.insertMode&&!n&&Je(e),a.isPlaying=!1}function ot(t,r,n){function o(r){return"string"==typeof r?e.commands[r](t):r(t),!0}var i=t.getCursor("head"),a=yt.macroModeState.lastInsertModeChanges.inVisualBlock;if(a){var s=t.state.vim,l=s.lastSelection,c=P(l.anchor,l.head);Y(t,i,c.line+1),n=t.listSelections().length,t.setCursor(i)}for(var u=0;n>u;u++){a&&t.setCursor(N(i,u,0));for(var h=0;h"]),ft=[].concat(ut,ht,pt,["-",'"',".",":","/"]),mt={},vt=function(){function e(e,t,s){function l(t){var o=++n%r,i=a[o];i&&i.clear(),a[o]=e.setBookmark(t)}var c=n%r,u=a[c];if(u){var h=u.find();h&&!_(h,t)&&l(t)}else l(t);l(s),o=n,i=n-r+1,0>i&&(i=0)}function t(e,t){n+=t,n>o?n=o:i>n&&(n=i);var s=a[(r+n)%r];if(s&&!s.find()){var l,c=t>0?1:-1,u=e.getCursor();do if(n+=c,s=a[(r+n)%r],s&&(l=s.find())&&!_(u,l))break;while(o>n&&n>i)}return s}var r=100,n=-1,o=0,i=0,a=new Array(r);return{cachedCursor:void 0,add:e,move:t}},gt=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};w.prototype={exitMacroRecordMode:function(){var e=yt.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1},enterMacroRecordMode:function(e,t){var r=yt.registerController.getRegister(t);r&&(r.clear(),this.latestRegister=t,e.openDialog&&(this.onRecordingDone=e.openDialog("(recording)["+t+"]",null,{bottom:!0})),this.isRecording=!0)}};var yt,kt,Ct={buildKeyMap:function(){},getRegisterController:function(){return yt.registerController},resetVimGlobalState_:M,getVimGlobalState_:function(){return yt},maybeInitVimState_:x,suppressErrorLogging:!1,InsertModeKey:tt,map:function(e,t,r){Bt.map(e,t,r)},setOption:k,getOption:C,defineOption:y,defineEx:function(e,t,r){if(0!==e.indexOf(t))throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered');Et[e]=r,Bt.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,r){var n=this.findKey(e,t,r);return"function"==typeof n?n():void 0},findKey:function(r,n,o){function i(){var e=yt.macroModeState;if(e.isRecording){if("q"==n)return e.exitMacroRecordMode(),A(r),!0;"mapping"!=o&&Qe(e,n)}}function a(){return""==n?(A(r),h.visualMode?ae(r):h.insertMode&&Je(r),!0):void 0}function s(t){for(var o;t;)o=/<\w+-.+?>|<\w+>|./.exec(t),n=o[0],t=t.substring(o.index+n.length),e.Vim.handleKey(r,n,"mapping")}function l(){if(a())return!0;for(var e=h.inputState.keyBuffer=h.inputState.keyBuffer+n,o=1==n.length,i=wt.matchCommand(e,t,h.inputState,"insert");e.length>1&&"full"!=i.type;){var e=h.inputState.keyBuffer=e.slice(1),s=wt.matchCommand(e,t,h.inputState,"insert");"none"!=s.type&&(i=s)}if("none"==i.type)return A(r),!1;if("partial"==i.type)return kt&&window.clearTimeout(kt),kt=window.setTimeout(function(){h.insertMode&&h.inputState.keyBuffer&&A(r)},C("insertModeEscKeysTimeout")),!o;if(kt&&window.clearTimeout(kt),o){var l=r.getCursor();r.replaceRange("",N(l,0,-(e.length-1)),l,"+input")}return A(r),i.command}function c(){if(i()||a())return!0;var e=h.inputState.keyBuffer=h.inputState.keyBuffer+n;if(/^[1-9]\d*$/.test(e))return!0;var o=/^(\d*)(.*)$/.exec(e);if(!o)return A(r),!1;var s=h.visualMode?"visual":"normal",l=wt.matchCommand(o[2]||o[1],t,h.inputState,s);if("none"==l.type)return A(r),!1;if("partial"==l.type)return!0;h.inputState.keyBuffer="";var o=/^(\d*)(.*)$/.exec(e);return o[1]&&"0"!=o[1]&&h.inputState.pushRepeatDigit(o[1]),l.command}var u,h=x(r);return u=h.insertMode?l():c(),u===!1?void 0:u===!0?function(){}:function(){return r.operation(function(){r.curOp.isVimOp=!0;try{"keyToKey"==u.type?s(u.toKeys):wt.processCommand(r,h,u)}catch(t){throw r.state.vim=void 0,x(r),e.Vim.suppressErrorLogging||console.log(t),t}return!0})}},handleEx:function(e,t){Bt.processCommand(e,t)},defineMotion:R,defineAction:I,defineOperator:B,mapCommand:$e,_mapCommand:Ue,exitVisualMode:ae,exitInsertMode:Je};S.prototype.pushRepeatDigit=function(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)},S.prototype.getRepeat=function(){var e=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(e=1,this.prefixRepeat.length>0&&(e*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(e*=parseInt(this.motionRepeat.join(""),10))),e},b.prototype={setText:function(e,t,r){this.keyBuffer=[e||""],this.linewise=!!t,this.blockwise=!!r},pushText:function(e,t){t&&(this.linewise||this.keyBuffer.push("\n"),this.linewise=!0),this.keyBuffer.push(e)},pushInsertModeChanges:function(e){this.insertModeChanges.push(gt(e))},pushSearchQuery:function(e){this.searchQueries.push(e)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}},L.prototype={pushText:function(e,t,r,n,o){n&&"\n"==r.charAt(0)&&(r=r.slice(1)+"\n"),n&&"\n"!==r.charAt(r.length-1)&&(r+="\n");var i=this.isValidRegister(e)?this.getRegister(e):null;if(!i){switch(t){case"yank":this.registers[0]=new b(r,n,o);break;case"delete":case"change":-1==r.indexOf("\n")?this.registers["-"]=new b(r,n):(this.shiftNumericRegisters_(),this.registers[1]=new b(r,n))}return void this.unnamedRegister.setText(r,n,o)}var a=m(e);a?i.pushText(r,n):i.setText(r,n,o),this.unnamedRegister.setText(i.toString(),n)},getRegister:function(e){return this.isValidRegister(e)?(e=e.toLowerCase(),this.registers[e]||(this.registers[e]=new b),this.registers[e]):this.unnamedRegister},isValidRegister:function(e){return e&&g(e,ft)},shiftNumericRegisters_:function(){for(var e=9;e>=2;e--)this.registers[e]=this.getRegister(""+(e-1))}},T.prototype={nextMatch:function(e,t){var r=this.historyBuffer,n=t?-1:1;null===this.initialPrefix&&(this.initialPrefix=e);for(var o=this.iterator+n;t?o>=0:o=r.length?(this.iterator=r.length,this.initialPrefix):0>o?e:void 0},pushInput:function(e){var t=this.historyBuffer.indexOf(e);t>-1&&this.historyBuffer.splice(t,1),e.length&&this.historyBuffer.push(e)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var wt={matchCommand:function(e,t,r,n){var o=j(e,t,n,r);if(!o.full&&!o.partial)return{type:"none"};if(!o.full&&o.partial)return{type:"partial"};for(var i,a=0;a"==i.keys.slice(-11)&&(r.selectedCharacter=F(e)),{type:"full",command:i}},processCommand:function(e,t,r){switch(t.inputState.repeatOverride=r.repeatOverride,r.type){case"motion":this.processMotion(e,t,r);break;case"operator":this.processOperator(e,t,r);break;case"operatorMotion":this.processOperatorMotion(e,t,r);break;case"action":this.processAction(e,t,r);break;case"search":this.processSearch(e,t,r);break;case"ex":case"keyToEx":this.processEx(e,t,r)}},processMotion:function(e,t,r){t.inputState.motion=r.motion,t.inputState.motionArgs=K(r.motionArgs),this.evalInput(e,t)},processOperator:function(e,t,r){var n=t.inputState;if(n.operator){if(n.operator==r.operator)return n.motion="expandToLine",n.motionArgs={linewise:!0},void this.evalInput(e,t);A(e)}n.operator=r.operator,n.operatorArgs=K(r.operatorArgs),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,r){var n=t.visualMode,o=K(r.operatorMotionArgs);o&&n&&o.visualLine&&(t.visualLine=!0),this.processOperator(e,t,r),n||this.processMotion(e,t,r)},processAction:function(e,t,r){var n=t.inputState,o=n.getRepeat(),i=!!o,a=K(r.actionArgs)||{};n.selectedCharacter&&(a.selectedCharacter=n.selectedCharacter),r.operator&&this.processOperator(e,t,r),r.motion&&this.processMotion(e,t,r),(r.motion||r.operator)&&this.evalInput(e,t),a.repeat=o||1,a.repeatIsExplicit=i,a.registerName=n.registerName,A(e),t.lastMotion=null,r.isEdit&&this.recordLastEdit(t,n,r),St[r.action](e,a,t)},processSearch:function(t,r,n){function o(e,o,i){yt.searchHistoryController.pushInput(e),yt.searchHistoryController.reset();try{Pe(t,e,o,i)}catch(a){return Ie(t,"Invalid regex: "+e),void A(t)}wt.processMotion(t,r,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:n.searchArgs.toJumplist}})}function i(e){t.scrollTo(p.left,p.top),o(e,!0,!0);var r=yt.macroModeState;r.isRecording&&Ze(r,e)}function a(r,n,o){var i,a=e.keyName(r);"Up"==a||"Down"==a?(i="Up"==a?!0:!1,n=yt.searchHistoryController.nextMatch(n,i)||"",o(n)):"Left"!=a&&"Right"!=a&&"Ctrl"!=a&&"Alt"!=a&&"Shift"!=a&&yt.searchHistoryController.reset();var s;try{s=Pe(t,n,!0,!0)}catch(r){}s?t.scrollIntoView(Fe(t,!l,s),30):(We(t),t.scrollTo(p.left,p.top))}function s(r,n,o){var i=e.keyName(r);("Esc"==i||"Ctrl-C"==i||"Ctrl-["==i)&&(yt.searchHistoryController.pushInput(n),yt.searchHistoryController.reset(),Pe(t,h),We(t),t.scrollTo(p.left,p.top),e.e_stop(r),A(t),o(),t.focus())}if(t.getSearchCursor){var l=n.searchArgs.forward,c=n.searchArgs.wholeWordOnly;Se(t).setReversed(!l);var u=l?"/":"?",h=Se(t).getQuery(),p=t.getScrollInfo();switch(n.searchArgs.querySrc){case"prompt":var d=yt.macroModeState;if(d.isPlaying){var f=d.replaySearchQueries.shift();o(f,!0,!1)}else Ke(t,{onClose:i,prefix:u,desc:Lt,onKeyUp:a,onKeyDown:s});break;case"wordUnderCursor":var m=ue(t,!1,!0,!1,!0),v=!0;if(m||(m=ue(t,!1,!0,!1,!1),v=!1),!m)return;var f=t.getLine(m.start.line).substring(m.start.ch,m.end.ch);f=v&&c?"\\b"+f+"\\b":z(f),yt.jumpList.cachedCursor=t.getCursor(),t.setCursor(m.start),o(f,!0,!1)}}},processEx:function(t,r,n){function o(e){yt.exCommandHistoryController.pushInput(e),yt.exCommandHistoryController.reset(),Bt.processCommand(t,e)}function i(r,n,o){var i,a=e.keyName(r);("Esc"==a||"Ctrl-C"==a||"Ctrl-["==a)&&(yt.exCommandHistoryController.pushInput(n),yt.exCommandHistoryController.reset(),e.e_stop(r),A(t),o(),t.focus()),"Up"==a||"Down"==a?(i="Up"==a?!0:!1,n=yt.exCommandHistoryController.nextMatch(n,i)||"",o(n)):"Left"!=a&&"Right"!=a&&"Ctrl"!=a&&"Alt"!=a&&"Shift"!=a&&yt.exCommandHistoryController.reset()}"keyToEx"==n.type?Bt.processCommand(t,n.exArgs.input):r.visualMode?Ke(t,{onClose:o,prefix:":",value:"'<,'>",onKeyDown:i}):Ke(t,{onClose:o,prefix:":",onKeyDown:i})},evalInput:function(e,t){var n,o,i,a=t.inputState,s=a.motion,l=a.motionArgs||{},c=a.operator,u=a.operatorArgs||{},h=a.registerName,p=t.sel,d=D(t.visualMode?p.head:e.getCursor("head")),f=D(t.visualMode?p.anchor:e.getCursor("anchor")),m=D(d),v=D(f);if(c&&this.recordLastEdit(t,a),i=void 0!==a.repeatOverride?a.repeatOverride:a.getRepeat(),i>0&&l.explicitRepeat?l.repeatIsExplicit=!0:(l.noRepeat||!l.explicitRepeat&&0===i)&&(i=1,l.repeatIsExplicit=!1),a.selectedCharacter&&(l.selectedCharacter=u.selectedCharacter=a.selectedCharacter),l.repeat=i,A(e),s){var g=xt[s](e,d,l,t);if(t.lastMotion=xt[s],!g)return;if(l.toJumplist){var y=yt.jumpList,k=y.cachedCursor;k?(he(e,k,g),delete y.cachedCursor):he(e,d,g)}g instanceof Array?(o=g[0],n=g[1]):n=g,n||(n=D(d)),t.visualMode?(t.visualBlock&&n.ch===1/0||(n=O(e,n,t.visualBlock)),o&&(o=O(e,o,!0)),o=o||v,p.anchor=o,p.head=n,ne(e),ye(e,t,"<",V(o,n)?o:n),ye(e,t,">",V(o,n)?n:o)):c||(n=O(e,n),e.setCursor(n.line,n.ch))}if(c){if(u.lastSel){o=v;var C=u.lastSel,w=Math.abs(C.head.line-C.anchor.line),x=Math.abs(C.head.ch-C.anchor.ch);n=C.visualLine?r(v.line+w,v.ch):C.visualBlock?r(v.line+w,v.ch+x):C.head.line==C.anchor.line?r(v.line,v.ch+x):r(v.line+w,v.ch),t.visualMode=!0,t.visualLine=C.visualLine,t.visualBlock=C.visualBlock,p=t.sel={anchor:o,head:n},ne(e)}else t.visualMode&&(u.lastSel={anchor:D(p.anchor),head:D(p.head),visualBlock:t.visualBlock,visualLine:t.visualLine});var M,S,b,L,T;if(t.visualMode){if(M=J(p.head,p.anchor),S=U(p.head,p.anchor),b=t.visualLine||u.linewise,L=t.visualBlock?"block":b?"line":"char",T=oe(e,{anchor:M,head:S},L),b){var R=T.ranges;if("block"==L)for(var E=0;El&&i.line==c||l>u&&i.line==u?void 0:(n.toFirstChar&&(a=ce(e.getLine(l)),o.lastHPos=a),o.lastHSPos=e.charCoords(r(l,a),"div").left,r(l,a))},moveByDisplayLines:function(e,t,n,o){var i=t;switch(o.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:o.lastHSPos=e.charCoords(i,"div").left}var a=n.repeat,s=e.findPosV(i,n.forward?a:-a,"line",o.lastHSPos);if(s.hitSide)if(n.forward)var l=e.charCoords(s,"div"),c={top:l.top+8,left:o.lastHSPos},s=e.coordsChar(c,"div");else{var u=e.charCoords(r(e.firstLine(),0),"div");u.left=o.lastHSPos,s=e.coordsChar(u,"div")}return o.lastHPos=s.ch,s},moveByPage:function(e,t,r){var n=t,o=r.repeat;return e.findPosV(n,r.forward?o:-o,"page")},moveByParagraph:function(e,t,r){var n=r.forward?1:-1;return Ce(e,t,r.repeat,n)},moveByScroll:function(e,t,r,n){var o=e.getScrollInfo(),i=null,a=r.repeat;a||(a=o.clientHeight/(2*e.defaultTextHeight()));var s=e.charCoords(t,"local");r.repeat=a;var i=xt.moveByDisplayLines(e,t,r,n);if(!i)return null;var l=e.charCoords(i,"local");return e.scrollTo(null,o.top+l.top-s.top),i},moveByWords:function(e,t,r){return me(e,t,r.repeat,!!r.forward,!!r.wordEnd,!!r.bigWord)},moveTillCharacter:function(e,t,r){var n=r.repeat,o=ve(e,n,r.forward,r.selectedCharacter),i=r.forward?-1:1;return pe(i,r),o?(o.ch+=i,o):null},moveToCharacter:function(e,t,r){var n=r.repeat;return pe(0,r),ve(e,n,r.forward,r.selectedCharacter)||t},moveToSymbol:function(e,t,r){var n=r.repeat;return de(e,n,r.forward,r.selectedCharacter)||t},moveToColumn:function(e,t,r,n){var o=r.repeat;return n.lastHPos=o-1,n.lastHSPos=e.charCoords(t,"div").left,ge(e,o)},moveToEol:function(e,t,n,o){var i=t;o.lastHPos=1/0;var a=r(i.line+n.repeat-1,1/0),s=e.clipPos(a);return s.ch--,o.lastHSPos=e.charCoords(s,"div").left,a},moveToFirstNonWhiteSpaceCharacter:function(e,t){var n=t;return r(n.line,ce(e.getLine(n.line)))},moveToMatchedSymbol:function(e,t){var n,o=t,i=o.line,a=o.ch,s=e.getLine(i);do if(n=s.charAt(a++),n&&d(n)){var l=e.getTokenTypeAt(r(i,a));if("string"!==l&&"comment"!==l)break}while(n);if(n){var c=e.findMatchingBracket(r(i,a));return c.to}return o},moveToStartOfLine:function(e,t){return r(t.line,0)},moveToLineOrEdgeOfDocument:function(e,t,n){var o=n.forward?e.lastLine():e.firstLine();return n.repeatIsExplicit&&(o=n.repeat-e.getOption("firstLineNumber")),r(o,ce(e.getLine(o)))},textObjectManipulation:function(e,t,r,n){var o={"(":")",")":"(","{":"}","}":"{","[":"]","]":"["},i={"'":!0,'"':!0},a=r.selectedCharacter;"b"==a?a="(":"B"==a&&(a="{");var s,l=!r.textObjectInner;if(o[a])s=we(e,t,a,l);else if(i[a])s=xe(e,t,a,l);else if("W"===a)s=ue(e,l,!0,!0);else if("w"===a)s=ue(e,l,!0,!1);else{if("p"!==a)return null;if(s=Ce(e,t,r.repeat,0,l),r.linewise=!0,n.visualMode)n.visualLine||(n.visualLine=!0);else{var c=n.inputState.operatorArgs;c&&(c.linewise=!0),s.end.line--}}return e.state.vim.visualMode?re(e,s.start,s.end):[s.start,s.end]},repeatLastCharacterSearch:function(e,t,r){var n=yt.lastChararacterSearch,o=r.repeat,i=r.forward===n.forward,a=(n.increment?1:0)*(i?-1:1);e.moveH(-a,"char"),r.inclusive=i?!0:!1;var s=ve(e,o,i,n.selectedCharacter);return s?(s.ch+=a,s):(e.moveH(a,"char"),t)}},Mt={change:function(t,r,n){var o,i,a=t.state.vim;if(yt.macroModeState.lastInsertModeChanges.inVisualBlock=a.visualBlock,a.visualMode){i=t.getSelection();var s=E("",n.length);t.replaceSelections(s),o=J(n[0].head,n[0].anchor)}else{var l=n[0].anchor,c=n[0].head;if(i=t.getRange(l,c),!v(i)){var u=/\s+$/.exec(i);u&&(c=N(c,0,-u[0].length),i=i.slice(0,-u[0].length))}var h=c.line-1==t.lastLine();t.replaceRange("",l,c),r.linewise&&!h&&(e.commands.newlineAndIndent(t),l.ch=null),o=l}yt.registerController.pushText(r.registerName,"change",i,r.linewise,n.length>1),St.enterInsertMode(t,{head:o},t.state.vim)},"delete":function(e,t,n){var o,i,a=e.state.vim;if(a.visualBlock){i=e.getSelection();var s=E("",n.length);e.replaceSelections(s),o=n[0].anchor}else{var l=n[0].anchor,c=n[0].head;t.linewise&&c.line!=e.firstLine()&&l.line==e.lastLine()&&l.line==c.line-1&&(l.line==e.firstLine()?l.ch=0:l=r(l.line-1,q(e,l.line-1))),i=e.getRange(l,c),e.replaceRange("",l,c),o=l,t.linewise&&(o=xt.moveToFirstNonWhiteSpaceCharacter(e,l))}return yt.registerController.pushText(t.registerName,"delete",i,t.linewise,a.visualBlock),O(e,o)},indent:function(e,t,r){var n=e.state.vim,o=r[0].anchor.line,i=n.visualBlock?r[r.length-1].anchor.line:r[0].head.line,a=n.visualMode?t.repeat:1;t.linewise&&i--;for(var s=o;i>=s;s++)for(var l=0;a>l;l++)e.indentLine(s,t.indentRight);return xt.moveToFirstNonWhiteSpaceCharacter(e,r[0].anchor)},changeCase:function(e,t,r,n,o){for(var i=e.getSelections(),a=[],s=t.toLower,l=0;lc.top?(l.line+=(s-c.top)/o,l.line=Math.ceil(l.line),e.setCursor(l),c=e.charCoords(l,"local"),e.scrollTo(null,c.top)):e.scrollTo(null,s);else{var u=s+e.getScrollInfo().clientHeight;u=a.anchor.line?N(a.head,0,1):r(a.anchor.line,0);else if("inplace"==i&&o.visualMode)return;t.setOption("keyMap","vim-insert"),t.setOption("disableInput",!1),n&&n.replace?(t.toggleOverwrite(!0),t.setOption("keyMap","vim-replace"),e.signal(t,"vim-mode-change",{mode:"replace"})):(t.setOption("keyMap","vim-insert"),e.signal(t,"vim-mode-change",{mode:"insert"})),yt.macroModeState.isPlaying||(t.on("change",Ge),e.on(t.getInputField(),"keydown",rt)),o.visualMode&&ae(t),Y(t,s,l)}},toggleVisualMode:function(t,n,o){var i,a=n.repeat,s=t.getCursor();o.visualMode?o.visualLine^n.linewise||o.visualBlock^n.blockwise?(o.visualLine=!!n.linewise,o.visualBlock=!!n.blockwise,e.signal(t,"vim-mode-change",{mode:"visual",subMode:o.visualLine?"linewise":o.visualBlock?"blockwise":""}),ne(t)):ae(t):(o.visualMode=!0,o.visualLine=!!n.linewise,o.visualBlock=!!n.blockwise,i=O(t,r(s.line,s.ch+a-1),!0),o.sel={anchor:s,head:i},e.signal(t,"vim-mode-change",{mode:"visual",subMode:o.visualLine?"linewise":o.visualBlock?"blockwise":""}),ne(t),ye(t,o,"<",J(s,i)),ye(t,o,">",U(s,i)))},reselectLastSelection:function(t,r,n){var o=n.lastSelection;if(n.visualMode&&te(t,n),o){var i=o.anchorMark.find(),a=o.headMark.find();if(!i||!a)return;n.sel={anchor:i,head:a},n.visualMode=!0,n.visualLine=o.visualLine,n.visualBlock=o.visualBlock,ne(t),ye(t,n,"<",J(i,a)),ye(t,n,">",U(i,a)),e.signal(t,"vim-mode-change",{mode:"visual",subMode:n.visualLine?"linewise":n.visualBlock?"blockwise":""})}},joinLines:function(e,t,n){var o,i;if(n.visualMode){if(o=e.getCursor("anchor"),i=e.getCursor("head"),V(i,o)){var a=i;i=o,o=a}i.ch=q(e,i.line)-1}else{var s=Math.max(t.repeat,2);o=e.getCursor(),i=O(e,r(o.line+s-1,1/0))}for(var l=0,c=o.line;cr)return"";if(e.getOption("indentWithTabs")){var n=Math.floor(r/s);return Array(n+1).join(" ")}return Array(r+1).join(" ")});a+=p?"\n":""}if(t.repeat>1)var a=Array(t.repeat+1).join(a);var f=i.linewise,m=i.blockwise;if(f)n.visualMode?a=n.visualLine?a.slice(0,-1):"\n"+a.slice(0,a.length-1)+"\n":t.after?(a="\n"+a.slice(0,a.length-1),o.ch=q(e,o.line)):o.ch=0;else{if(m){a=a.split("\n");for(var v=0;ve.lastLine()&&e.replaceRange("\n",r(b,0));var L=q(e,b);Lu.length&&(i=u.length),a=r(l.line,i)}if("\n"==s)o.visualMode||t.replaceRange("",l,a),(e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent)(t);else{var h=t.getRange(l,a);if(h=h.replace(/[^\n]/g,s),o.visualBlock){var p=new Array(t.getOption("tabSize")+1).join(" ");h=t.getSelection(),h=h.replace(/\t/g,p).replace(/[^\n]/g,s).split("\n"),t.replaceSelections(h)}else t.replaceRange(h,l,a);o.visualMode?(l=V(c[0].anchor,c[0].head)?c[0].anchor:c[0].head,t.setCursor(l),ae(t,!1)):t.setCursor(N(a,0,-1))}},incrementNumberToken:function(e,t){for(var n,o,i,a,s,l=e.getCursor(),c=e.getLine(l.line),u=/-?\d+/g;null!==(n=u.exec(c))&&(s=n[0],o=n.index,i=o+s.length,!(l.ch=1)return!0}else e.nextCh===e.reverseSymb&&e.depth--;return!1}},section:{init:function(e){e.curMoveThrough=!0,e.symb=(e.forward?"]":"[")===e.symb?"{":"}"},isComplete:function(e){return 0===e.index&&e.nextCh===e.symb}},comment:{isComplete:function(e){var t="*"===e.lastCh&&"/"===e.nextCh;return e.lastCh=e.nextCh,t}},method:{init:function(e){e.symb="m"===e.symb?"{":"}",e.reverseSymb="{"===e.symb?"}":"{"},isComplete:function(e){return e.nextCh===e.symb?!0:!1}},preprocess:{init:function(e){e.index=0},isComplete:function(e){if("#"===e.nextCh){var t=e.lineText.match(/#(\w+)/)[1];if("endif"===t){if(e.forward&&0===e.depth)return!0;e.depth++}else if("if"===t){if(!e.forward&&0===e.depth)return!0;e.depth--}if("else"===t&&0===e.depth)return!0}return!1}}};y("pcre",!0,"boolean"),Me.prototype={getQuery:function(){return yt.query},setQuery:function(e){yt.query=e},getOverlay:function(){return this.searchOverlay},setOverlay:function(e){this.searchOverlay=e},isReversed:function(){return yt.isReversed},setReversed:function(e){yt.isReversed=e},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(e){this.annotate=e}};var Lt="(Javascript regexp)",Tt=[{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"set"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"global",shortName:"g"}],Rt=function(){this.buildCommandMap_()};Rt.prototype={processCommand:function(e,t,r){var n=this;e.operation(function(){e.curOp.isVimOp=!0,n._processCommand(e,t,r)})},_processCommand:function(t,r,n){var o=t.state.vim,i=yt.registerController.getRegister(":"),a=i.toString();o.visualMode&&ae(t);var s=new e.StringStream(r);i.setText(r);var l=n||{};l.input=r;try{this.parseInput_(t,s,l)}catch(c){throw Ie(t,c),c}var u,h;if(l.commandName){if(u=this.matchCommand_(l.commandName)){if(h=u.name,u.excludeFromCommandHistory&&i.setText(a),this.parseCommandArgs_(s,l,u),"exToKey"==u.type){for(var p=0;p0;t--){ -var r=e.substring(0,t);if(this.commandMap_[r]){var n=this.commandMap_[r];if(0===n.name.indexOf(e))return n}}return null},buildCommandMap_:function(){this.commandMap_={};for(var e=0;e
";if(r){var i;r=r.join("");for(var a=0;a"}}else for(var i in n){var l=n[i].toString();l.length&&(o+='"'+i+" "+l+"
")}Ie(e,o)},sort:function(t,n){function o(){if(n.argString){var t=new e.StringStream(n.argString);if(t.eat("!")&&(a=!0),t.eol())return;if(!t.eatSpace())return"Invalid arguments";var r=t.match(/[a-z]+/);if(r){r=r[0],s=-1!=r.indexOf("i"),l=-1!=r.indexOf("u");var o=-1!=r.indexOf("d")&&1,i=-1!=r.indexOf("x")&&1,u=-1!=r.indexOf("o")&&1;if(o+i+u>1)return"Invalid arguments";c=o&&"decimal"||i&&"hex"||u&&"octal"}t.eatSpace()&&t.match(/\/.*\//)}}function i(e,t){if(a){var r;r=e,e=t,t=r}s&&(e=e.toLowerCase(),t=t.toLowerCase());var n=c&&v.exec(e),o=c&&v.exec(t);return n?(n=parseInt((n[1]+n[2]).toLowerCase(),g),o=parseInt((o[1]+o[2]).toLowerCase(),g),n-o):t>e?-1:1}var a,s,l,c,u=o();if(u)return void Ie(t,u+": "+n.argString);var h=n.line||t.firstLine(),p=n.lineEnd||n.line||t.lastLine();if(h!=p){var d=r(h,0),f=r(p,q(t,p)),m=t.getRange(d,f).split("\n"),v="decimal"==c?/(-?)([\d]+)/:"hex"==c?/(-?)(?:0x)?([0-9a-f]+)/i:"octal"==c?/([0-7]+)/:null,g="decimal"==c?10:"hex"==c?16:"octal"==c?8:null,y=[],k=[];if(c)for(var C=0;C=p;p++){var d=c.test(e.getLine(p));d&&(u.push(p+1),h+=e.getLine(p)+"
")}if(!n)return void Ie(e,h);var f=0,m=function(){if(f=u)return void Ie(t,"Invalid argument: "+r.argString.substring(i));for(var h=0;u-c>=h;h++){var d=String.fromCharCode(c+h);delete n.marks[d]}}else delete n.marks[a]}}},Bt=new Rt;return e.keyMap.vim={attach:a,detach:i,call:s},y("insertModeEscKeysTimeout",200,"number"),e.keyMap["vim-insert"]={"Ctrl-N":"autocomplete","Ctrl-P":"autocomplete",Enter:function(t){var r=e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent;r(t)},fallthrough:["default"],attach:a,detach:i,call:s},e.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:a,detach:i,call:s},M(),Ct};e.Vim=n()}); -var jsonlint=function(){var t={trace:function(){},yy:{},symbols_:{error:2,JSONString:3,STRING:4,JSONNumber:5,NUMBER:6,JSONNullLiteral:7,NULL:8,JSONBooleanLiteral:9,TRUE:10,FALSE:11,JSONText:12,JSONValue:13,EOF:14,JSONObject:15,JSONArray:16,"{":17,"}":18,JSONMemberList:19,JSONMember:20,":":21,",":22,"[":23,"]":24,JSONElementList:25,$accept:0,$end:1},terminals_:{2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},productions_:[0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],performAction:function(t,e,i,n,r,s,h){var l=s.length-1;switch(r){case 1:this.$=t.replace(/\\(\\|")/g,"$1").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g," ").replace(/\\v/g,"\x0B").replace(/\\f/g,"\f").replace(/\\b/g,"\b");break;case 2:this.$=Number(t);break;case 3:this.$=null;break;case 4:this.$=!0;break;case 5:this.$=!1;break;case 6:return this.$=s[l-1];case 13:this.$={};break;case 14:this.$=s[l-1];break;case 15:this.$=[s[l-2],s[l]];break;case 16:this.$={},this.$[s[l][0]]=s[l][1];break;case 17:this.$=s[l-2],s[l-2][s[l][0]]=s[l][1];break;case 18:this.$=[];break;case 19:this.$=s[l-1];break;case 20:this.$=[s[l]];break;case 21:this.$=s[l-2],s[l-2].push(s[l])}},table:[{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],12:1,13:2,15:7,16:8,17:[1,14],23:[1,15]},{1:[3]},{14:[1,16]},{14:[2,7],18:[2,7],22:[2,7],24:[2,7]},{14:[2,8],18:[2,8],22:[2,8],24:[2,8]},{14:[2,9],18:[2,9],22:[2,9],24:[2,9]},{14:[2,10],18:[2,10],22:[2,10],24:[2,10]},{14:[2,11],18:[2,11],22:[2,11],24:[2,11]},{14:[2,12],18:[2,12],22:[2,12],24:[2,12]},{14:[2,3],18:[2,3],22:[2,3],24:[2,3]},{14:[2,4],18:[2,4],22:[2,4],24:[2,4]},{14:[2,5],18:[2,5],22:[2,5],24:[2,5]},{14:[2,1],18:[2,1],21:[2,1],22:[2,1],24:[2,1]},{14:[2,2],18:[2,2],22:[2,2],24:[2,2]},{3:20,4:[1,12],18:[1,17],19:18,20:19},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:23,15:7,16:8,17:[1,14],23:[1,15],24:[1,21],25:22},{1:[2,6]},{14:[2,13],18:[2,13],22:[2,13],24:[2,13]},{18:[1,24],22:[1,25]},{18:[2,16],22:[2,16]},{21:[1,26]},{14:[2,18],18:[2,18],22:[2,18],24:[2,18]},{22:[1,28],24:[1,27]},{22:[2,20],24:[2,20]},{14:[2,14],18:[2,14],22:[2,14],24:[2,14]},{3:20,4:[1,12],20:29},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:30,15:7,16:8,17:[1,14],23:[1,15]},{14:[2,19],18:[2,19],22:[2,19],24:[2,19]},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:31,15:7,16:8,17:[1,14],23:[1,15]},{18:[2,17],22:[2,17]},{18:[2,15],22:[2,15]},{22:[2,21],24:[2,21]}],defaultActions:{16:[2,6]},parseError:function(t,e){throw new Error(t)},parse:function(t){function e(t){r.length=r.length-2*t,s.length=s.length-t,h.length=h.length-t}function i(){var t;return t=n.lexer.lex()||1,"number"!=typeof t&&(t=n.symbols_[t]||t),t}var n=this,r=[0],s=[null],h=[],l=this.table,o="",a=0,c=0,u=0,y=2,p=1;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var f=this.lexer.yylloc;h.push(f),"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var g,d,m,x,_,b,E,S,k,v={};;){if(m=r[r.length-1],this.defaultActions[m]?x=this.defaultActions[m]:(null==g&&(g=i()),x=l[m]&&l[m][g]),"undefined"==typeof x||!x.length||!x[0]){if(!u){k=[];for(b in l[m])this.terminals_[b]&&b>2&&k.push("'"+this.terminals_[b]+"'");var $="";$=this.lexer.showPosition?"Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+k.join(", ")+", got '"+this.terminals_[g]+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==g?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError($,{text:this.lexer.match,token:this.terminals_[g]||g,line:this.lexer.yylineno,loc:f,expected:k})}if(3==u){if(g==p)throw new Error($||"Parsing halted.");c=this.lexer.yyleng,o=this.lexer.yytext,a=this.lexer.yylineno,f=this.lexer.yylloc,g=i()}for(;;){if(y.toString()in l[m])break;if(0==m)throw new Error($||"Parsing halted.");e(1),m=r[r.length-1]}d=g,g=y,m=r[r.length-1],x=l[m]&&l[m][y],u=3}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+g);switch(x[0]){case 1:r.push(g),s.push(this.lexer.yytext),h.push(this.lexer.yylloc),r.push(x[1]),g=null,d?(g=d,d=null):(c=this.lexer.yyleng,o=this.lexer.yytext,a=this.lexer.yylineno,f=this.lexer.yylloc,u>0&&u--);break;case 2:if(E=this.productions_[x[1]][1],v.$=s[s.length-E],v._$={first_line:h[h.length-(E||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(E||1)].first_column,last_column:h[h.length-1].last_column},_=this.performAction.call(v,o,c,a,this.yy,x[1],s,h),"undefined"!=typeof _)return _;E&&(r=r.slice(0,-1*E*2),s=s.slice(0,-1*E),h=h.slice(0,-1*E)),r.push(this.productions_[x[1]][0]),s.push(v.$),h.push(v._$),S=l[r[r.length-2]][r[r.length-1]],r.push(S);break;case 3:return!0}}return!0}},e=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parseError)throw new Error(t);this.yy.parseError(t,e)},setInput:function(t){return this._input=t,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.match+=t,this.matched+=t;var e=t.match(/\n/);return e&&this.yylineno++,this._input=this._input.slice(1),t},unput:function(t){return this._input=t+this._input,this},more:function(){return this._more=!0,this},less:function(t){this._input=this.match.slice(t)+this._input},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var t,e,i,n,r;this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),h=0;he[0].length)||(e=i,n=h,this.options.flex));h++);return e?(r=e[0].match(/\n.*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-1:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],t=this.performAction.call(this,this.yy,this,s[n],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t?t:void 0):""===this._input?this.EOF:void this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return"undefined"!=typeof t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)}};return t.options={},t.performAction=function(t,e,i,n){switch(i){case 0:break;case 1:return 6;case 2:return e.yytext=e.yytext.substr(1,e.yyleng-2),4;case 3:return 17;case 4:return 18;case 5:return 23;case 6:return 24;case 7:return 22;case 8:return 21;case 9:return 10;case 10:return 11;case 11:return 8;case 12:return 14;case 13:return"INVALID"}},t.rules=[/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt\/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/],t.conditions={INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}},t}();return t.lexer=e,t}();"undefined"!=typeof require&&"undefined"!=typeof exports&&(exports.parser=jsonlint,exports.parse=function(){return jsonlint.parse.apply(jsonlint,arguments)},exports.main=function(t){if(!t[1])throw new Error("Usage: "+t[0]+" FILE");if("undefined"!=typeof process)var e=require("fs").readFileSync(require("path").join(process.cwd(),t[1]),"utf8");else var i=require("file").path(require("file").cwd()),e=i.join(t[1]).read({charset:"utf-8"});return exports.parser.parse(e)},"undefined"!=typeof module&&require.main===module&&exports.main("undefined"!=typeof process?process.argv.slice(1):require("system").args)); -goLintFound=[],function(n){n(CodeMirror)}(function(n){"use strict";n.registerHelper("lint","go",function(n){return goLintFound})}); \ No newline at end of file +!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(h,e){var t=[],c=t.slice,g=t.concat,a=t.push,i=t.indexOf,n={},r=n.toString,m=n.hasOwnProperty,v={},y=h.document,o="2.1.1",C=function(e,t){return new C.fn.init(e,t)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,u=/^-ms-/,l=/-([\da-z])/gi,f=function(e,t){return t.toUpperCase()};function p(e){var t=e.length,n=C.type(e);return"function"!==n&&!C.isWindow(e)&&(!(1!==e.nodeType||!t)||("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),X=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),U=new RegExp(B),V=new RegExp("^"+W+"$"),Y={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R.replace("w","w*")+")"),ATTR:new RegExp("^"+$),PSEUDO:new RegExp("^"+B),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,J=/^[^{]+\{\s*\[native \w/,K=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Z=/[+~]/,ee=/'|\\/g,te=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ne=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)};try{H.apply(t=O.call(k.childNodes),k.childNodes),t[k.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){q.apply(e,O.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}function re(e,t,n,r){var i,o,s,a,u,l,c,f,p,d;if((t?t.ownerDocument||t:k)!==T&&v(t),n=n||[],!e||"string"!=typeof e)return n;if(1!==(a=(t=t||T).nodeType)&&9!==a)return[];if(y&&!r){if(i=K.exec(e))if(s=i[1]){if(9===a){if(!(o=t.getElementById(s))||!o.parentNode)return n;if(o.id===s)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(s))&&C(t,o)&&o.id===s)return n.push(o),n}else{if(i[2])return H.apply(n,t.getElementsByTagName(e)),n;if((s=i[3])&&h.getElementsByClassName&&t.getElementsByClassName)return H.apply(n,t.getElementsByClassName(s)),n}if(h.qsa&&(!x||!x.test(e))){if(f=c=N,p=t,d=9===a&&e,1===a&&"object"!==t.nodeName.toLowerCase()){for(l=g(e),(c=t.getAttribute("id"))?f=c.replace(ee,"\\$&"):t.setAttribute("id",f),f="[id='"+f+"'] ",u=l.length;u--;)l[u]=f+he(l[u]);p=Z.test(e)&&pe(t.parentNode)||t,d=l.join(",")}if(d)try{return H.apply(n,p.querySelectorAll(d)),n}catch(e){}finally{c||t.removeAttribute("id")}}}return m(e.replace(I,"$1"),t,n,r)}function ie(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function oe(e){return e[N]=!0,e}function se(e){var t=T.createElement("div");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ae(e,t){for(var n=e.split("|"),r=e.length;r--;)b.attrHandle[n[r]]=t}function ue(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||1<<31)-(~e.sourceIndex||1<<31);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function le(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function ce(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function fe(s){return oe(function(o){return o=+o,oe(function(e,t){for(var n,r=s([],e.length,o),i=r.length;i--;)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function pe(e){return e&&typeof e.getElementsByTagName!==D&&e}for(e in h=re.support={},r=re.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},v=re.setDocument=function(e){var t,u=e?e.ownerDocument||e:k,n=u.defaultView;return u!==T&&9===u.nodeType&&u.documentElement?(i=(T=u).documentElement,y=!r(u),n&&n!==n.top&&(n.addEventListener?n.addEventListener("unload",function(){v()},!1):n.attachEvent&&n.attachEvent("onunload",function(){v()})),h.attributes=se(function(e){return e.className="i",!e.getAttribute("className")}),h.getElementsByTagName=se(function(e){return e.appendChild(u.createComment("")),!e.getElementsByTagName("*").length}),h.getElementsByClassName=J.test(u.getElementsByClassName)&&se(function(e){return e.innerHTML="
",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),h.getById=se(function(e){return i.appendChild(e).id=N,!u.getElementsByName||!u.getElementsByName(N).length}),h.getById?(b.find.ID=function(e,t){if(typeof t.getElementById!==D&&y){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}}):(delete b.find.ID,b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t=typeof e.getAttributeNode!==D&&e.getAttributeNode("id");return t&&t.value===n}}),b.find.TAG=h.getElementsByTagName?function(e,t){return typeof t.getElementsByTagName!==D?t.getElementsByTagName(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"!==e)return o;for(;n=o[i++];)1===n.nodeType&&r.push(n);return r},b.find.CLASS=h.getElementsByClassName&&function(e,t){return typeof t.getElementsByClassName!==D&&y?t.getElementsByClassName(e):void 0},s=[],x=[],(h.qsa=J.test(u.querySelectorAll))&&(se(function(e){e.innerHTML="",e.querySelectorAll("[msallowclip^='']").length&&x.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||x.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll(":checked").length||x.push(":checked")}),se(function(e){var t=u.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&x.push("name"+M+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||x.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),x.push(",.*:")})),(h.matchesSelector=J.test(a=i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.oMatchesSelector||i.msMatchesSelector))&&se(function(e){h.disconnectedMatch=a.call(e,"div"),a.call(e,"[s!='']:x"),s.push("!=",B)}),x=x.length&&new RegExp(x.join("|")),s=s.length&&new RegExp(s.join("|")),t=J.test(i.compareDocumentPosition),C=t||J.test(i.contains)?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)for(;t=t.parentNode;)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return c=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!h.sortDetached&&t.compareDocumentPosition(e)===n?e===u||e.ownerDocument===k&&C(k,e)?-1:t===u||t.ownerDocument===k&&C(k,t)?1:l?F.call(l,e)-F.call(l,t):0:4&n?-1:1)}:function(e,t){if(e===t)return c=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,s=[e],a=[t];if(!i||!o)return e===u?-1:t===u?1:i?-1:o?1:l?F.call(l,e)-F.call(l,t):0;if(i===o)return ue(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)a.unshift(n);for(;s[r]===a[r];)r++;return r?ue(s[r],a[r]):s[r]===k?-1:a[r]===k?1:0},u):T},re.matches=function(e,t){return re(e,null,null,t)},re.matchesSelector=function(e,t){if((e.ownerDocument||e)!==T&&v(e),t=t.replace(X,"='$1']"),!(!h.matchesSelector||!y||s&&s.test(t)||x&&x.test(t)))try{var n=a.call(e,t);if(n||h.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===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]||re.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]&&re.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return Y.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&U.test(n)&&(t=g(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=u[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&u(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==D&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=re.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function T(e,n,r){if(C.isFunction(n))return C.grep(e,function(e,t){return!!n.call(e,t,e)!==r});if(n.nodeType)return C.grep(e,function(e){return e===n!==r});if("string"==typeof n){if(w.test(n))return C.filter(n,e,r);n=C.filter(n,e)}return C.grep(e,function(e){return 0<=i.call(n,e)!==r})}C.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?C.find.matchesSelector(r,e)?[r]:[]:C.find.matches(e,C.grep(t,function(e){return 1===e.nodeType}))},C.fn.extend({find:function(e){var t,n=this.length,r=[],i=this;if("string"!=typeof e)return this.pushStack(C(e).filter(function(){for(t=0;t)[^>]*|#([\w-]*))$/;(C.fn.init=function(e,t){var n,r;if(!e)return this;if("string"!=typeof e)return e.nodeType?(this.context=this[0]=e,this.length=1,this):C.isFunction(e)?void 0!==N.ready?N.ready(e):e(C):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),C.makeArray(e,this));if(!(n="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:k.exec(e))||!n[1]&&t)return!t||t.jquery?(t||N).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof C?t[0]:t,C.merge(this,C.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:y,!0)),b.test(n[1])&&C.isPlainObject(t))for(n in t)C.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}return(r=y.getElementById(n[2]))&&r.parentNode&&(this.length=1,this[0]=r),this.context=y,this.selector=e,this}).prototype=C.fn,N=C(y);var E=/^(?:parents|prev(?:Until|All))/,S={children:!0,contents:!0,next:!0,prev:!0};function j(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}C.extend({dir:function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&C(e).is(n))break;r.push(e)}return r},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}}),C.fn.extend({has:function(e){var t=C(e,this),n=t.length;return this.filter(function(){for(var e=0;ex",v.noCloneChecked=!!$.cloneNode(!0).lastChild.defaultValue;var U="undefined";v.focusinBubbles="onfocusin"in h;var V=/^key/,Y=/^(?:mouse|pointer|contextmenu)|click/,G=/^(?:focusinfocus|focusoutblur)$/,Q=/^([^.]*)(?:\.(.+)|)$/;function J(){return!0}function K(){return!1}function Z(){try{return y.activeElement}catch(e){}}C.event={global:{},add:function(t,e,n,r,i){var o,s,a,u,l,c,f,p,d,h,g,m=F.get(t);if(m)for(n.handler&&(n=(o=n).handler,i=o.selector),n.guid||(n.guid=C.guid++),(u=m.events)||(u=m.events={}),(s=m.handle)||(s=m.handle=function(e){return typeof C!==U&&C.event.triggered!==e.type?C.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(A)||[""]).length;l--;)d=g=(a=Q.exec(e[l])||[])[1],h=(a[2]||"").split(".").sort(),d&&(f=C.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=C.event.special[d]||{},c=C.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&C.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,s)||t.addEventListener&&t.addEventListener(d,s,!1)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),C.event.global[d]=!0)},remove:function(e,t,n,r,i){var o,s,a,u,l,c,f,p,d,h,g,m=F.hasData(e)&&F.get(e);if(m&&(u=m.events)){for(l=(t=(t||"").match(A)||[""]).length;l--;)if(d=g=(a=Q.exec(t[l])||[])[1],h=(a[2]||"").split(".").sort(),d){for(f=C.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],a=a[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=p.length;o--;)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));s&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,m.handle)||C.removeEvent(e,d,m.handle),delete u[d])}else for(d in u)C.event.remove(e,d+t[l],n,r,!0);C.isEmptyObject(u)&&(delete m.handle,F.remove(e,"events"))}},trigger:function(e,t,n,r){var i,o,s,a,u,l,c,f=[n||y],p=m.call(e,"type")?e.type:e,d=m.call(e,"namespace")?e.namespace.split("."):[];if(o=s=n=n||y,3!==n.nodeType&&8!==n.nodeType&&!G.test(p+C.event.triggered)&&(0<=p.indexOf(".")&&(p=(d=p.split(".")).shift(),d.sort()),u=p.indexOf(":")<0&&"on"+p,(e=e[C.expando]?e:new C.Event(p,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=d.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:C.makeArray(t,[e]),c=C.event.special[p]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!C.isWindow(n)){for(a=c.delegateType||p,G.test(a+p)||(o=o.parentNode);o;o=o.parentNode)f.push(o),s=o;s===(n.ownerDocument||y)&&f.push(s.defaultView||s.parentWindow||h)}for(i=0;(o=f[i++])&&!e.isPropagationStopped();)e.type=1]*)\/>/gi,te=/<([\w:]+)/,ne=/<|&#?\w+;/,re=/<(?:script|style|link)/i,ie=/checked\s*(?:[^=]|=\s*.checked.)/i,oe=/^$|\/(?:java|ecma)script/i,se=/^true\/(.*)/,ae=/^\s*\s*$/g,ue={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function le(e,t){return C.nodeName(e,"table")&&C.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ce(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function fe(e){var t=se.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function pe(e,t){for(var n=0,r=e.length;n")+a[2],l=a[0];l--;)o=o.lastChild;C.merge(f,o.childNodes),(o=c.firstChild).textContent=""}else f.push(t.createTextNode(i));for(c.textContent="",p=0;i=f[p++];)if((!r||-1===C.inArray(i,r))&&(u=C.contains(i.ownerDocument,i),o=he(c.appendChild(i),"script"),u&&pe(o),n))for(l=0;i=o[l++];)oe.test(i.type||"")&&n.push(i);return c},cleanData:function(e){for(var t,n,r,i,o=C.event.special,s=0;void 0!==(n=e[s]);s++){if(C.acceptData(n)&&((i=n[F.expando])&&(t=F.cache[i]))){if(t.events)for(r in t.events)o[r]?C.event.remove(n,r):C.removeEvent(n,r,t.handle);F.cache[i]&&delete F.cache[i]}delete P.cache[n[P.expando]]}}}),C.fn.extend({text:function(e){return H(this,function(e){return void 0===e?C.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=e)})},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||le(this,e).appendChild(e)})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=le(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){for(var n,r=e?C.filter(e,this):this,i=0;null!=(n=r[i]);i++)t||1!==n.nodeType||C.cleanData(he(n)),n.parentNode&&(t&&C.contains(n.ownerDocument,n)&&pe(he(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(C.cleanData(he(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return C.clone(this,e,t)})},html:function(e){return H(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!re.test(e)&&!ue[(te.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(ee,"<$1>");try{for(;n")).appendTo(t.documentElement))[0].contentDocument).write(),t.close(),n=ve(e,t),ge.detach()),me[e]=n),n}var xe=/^margin/,be=new RegExp("^("+I+")(?!px)[a-z%]+$","i"),we=function(e){return e.ownerDocument.defaultView.getComputedStyle(e,null)};function Te(e,t,n){var r,i,o,s,a=e.style;return(n=n||we(e))&&(s=n.getPropertyValue(t)||n[t]),n&&(""!==s||C.contains(e.ownerDocument,e)||(s=C.style(e,t)),be.test(s)&&xe.test(t)&&(r=a.width,i=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=s,s=n.width,a.width=r,a.minWidth=i,a.maxWidth=o)),void 0!==s?s+"":s}function Ce(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}!function(){var t,n,r=y.documentElement,i=y.createElement("div"),o=y.createElement("div");if(o.style){function e(){o.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",o.innerHTML="",r.appendChild(i);var e=h.getComputedStyle(o,null);t="1%"!==e.top,n="4px"===e.width,r.removeChild(i)}o.style.backgroundClip="content-box",o.cloneNode(!0).style.backgroundClip="",v.clearCloneStyle="content-box"===o.style.backgroundClip,i.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",i.appendChild(o),h.getComputedStyle&&C.extend(v,{pixelPosition:function(){return e(),t},boxSizingReliable:function(){return null==n&&e(),n},reliableMarginRight:function(){var e,t=o.appendChild(y.createElement("div"));return t.style.cssText=o.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",t.style.marginRight=t.style.width="0",o.style.width="1px",r.appendChild(i),e=!parseFloat(h.getComputedStyle(t,null).marginRight),r.removeChild(i),e}})}}(),C.swap=function(e,t,n,r){var i,o,s={};for(o in t)s[o]=e.style[o],e.style[o]=t[o];for(o in i=n.apply(e,r||[]),t)e.style[o]=s[o];return i};var Ne=/^(none|table(?!-c[ea]).+)/,ke=new RegExp("^("+I+")(.*)$","i"),Ee=new RegExp("^([+-])=("+I+")","i"),Se={position:"absolute",visibility:"hidden",display:"block"},je={letterSpacing:"0",fontWeight:"400"},De=["Webkit","O","Moz","ms"];function Ae(e,t){if(t in e)return t;for(var n=t[0].toUpperCase()+t.slice(1),r=t,i=De.length;i--;)if((t=De[i]+n)in e)return t;return r}function Le(e,t,n){var r=ke.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function qe(e,t,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===t?1:0,s=0;o<4;o+=2)"margin"===n&&(s+=C.css(e,n+_[o],!0,i)),r?("content"===n&&(s-=C.css(e,"padding"+_[o],!0,i)),"margin"!==n&&(s-=C.css(e,"border"+_[o]+"Width",!0,i))):(s+=C.css(e,"padding"+_[o],!0,i),"padding"!==n&&(s+=C.css(e,"border"+_[o]+"Width",!0,i)));return s}function He(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=we(e),s="border-box"===C.css(e,"boxSizing",!1,o);if(i<=0||null==i){if(((i=Te(e,t,o))<0||null==i)&&(i=e.style[t]),be.test(i))return i;r=s&&(v.boxSizingReliable()||i===e.style[t]),i=parseFloat(i)||0}return i+qe(e,t,n||(s?"border":"content"),r,o)+"px"}function Oe(e,t){for(var n,r,i,o=[],s=0,a=e.length;s").prop({async:!0,charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),y.head.appendChild(r[0])},abort:function(){i&&i()}}});var St=[],jt=/(=)\?(?=&|$)|\?\?/;C.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=St.pop()||C.expando+"_"+tt++;return this[e]=!0,e}}),C.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,s=!1!==e.jsonp&&(jt.test(e.url)?"url":"string"==typeof e.data&&!(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&jt.test(e.data)&&"data");return s||"jsonp"===e.dataTypes[0]?(r=e.jsonpCallback=C.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,s?e[s]=e[s].replace(jt,"$1"+r):!1!==e.jsonp&&(e.url+=(nt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||C.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=h[r],h[r]=function(){o=arguments},n.always(function(){h[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,St.push(r)),o&&C.isFunction(i)&&i(o[0]),o=i=void 0}),"script"):void 0}),C.parseHTML=function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||y;var r=b.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=C.buildFragment([e],t,i),i&&i.length&&C(i).remove(),C.merge([],r.childNodes))};var Dt=C.fn.load;C.fn.load=function(e,t,n){if("string"!=typeof e&&Dt)return Dt.apply(this,arguments);var r,i,o,s=this,a=e.indexOf(" ");return 0<=a&&(r=C.trim(e.slice(a)),e=e.slice(0,a)),C.isFunction(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),0").append(C.parseHTML(e)).find(r):e)}).complete(n&&function(e,t){s.each(n,o||[e.responseText,t,e])}),this},C.expr.filters.animated=function(t){return C.grep(C.timers,function(e){return t===e.elem}).length};var At=h.document.documentElement;function Lt(e){return C.isWindow(e)?e:9===e.nodeType&&e.defaultView}C.offset={setOffset:function(e,t,n){var r,i,o,s,a,u,l=C.css(e,"position"),c=C(e),f={};"static"===l&&(e.style.position="relative"),a=c.offset(),o=C.css(e,"top"),u=C.css(e,"left"),i=("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(s=(r=c.position()).top,r.left):(s=parseFloat(o)||0,parseFloat(u)||0),C.isFunction(t)&&(t=t.call(e,n,a)),null!=t.top&&(f.top=t.top-a.top+s),null!=t.left&&(f.left=t.left-a.left+i),"using"in t?t.using.call(e,f):c.css(f)}},C.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){C.offset.setOffset(this,t,e)});var e,n,r=this[0],i={top:0,left:0},o=r&&r.ownerDocument;return o?(e=o.documentElement,C.contains(e,r)?(typeof r.getBoundingClientRect!==U&&(i=r.getBoundingClientRect()),n=Lt(o),{top:i.top+n.pageYOffset-e.clientTop,left:i.left+n.pageXOffset-e.clientLeft}):i):void 0},position:function(){if(this[0]){var e,t,n=this[0],r={top:0,left:0};return"fixed"===C.css(n,"position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),C.nodeName(e[0],"html")||(r=e.offset()),r.top+=C.css(e[0],"borderTopWidth",!0),r.left+=C.css(e[0],"borderLeftWidth",!0)),{top:t.top-r.top-C.css(n,"marginTop",!0),left:t.left-r.left-C.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||At;e&&!C.nodeName(e,"html")&&"static"===C.css(e,"position");)e=e.offsetParent;return e||At})}}),C.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;C.fn[t]=function(e){return H(this,function(e,t,n){var r=Lt(e);return void 0===n?r?r[i]:e[t]:void(r?r.scrollTo(o?h.pageXOffset:n,o?n:h.pageYOffset):e[t]=n)},t,e,arguments.length,null)}}),C.each(["top","left"],function(e,n){C.cssHooks[n]=Ce(v.pixelPosition,function(e,t){return t?(t=Te(e,n),be.test(t)?C(e).position()[n]+"px":t):void 0})}),C.each({Height:"height",Width:"width"},function(o,s){C.each({padding:"inner"+o,content:s,"":"outer"+o},function(r,e){C.fn[e]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return H(this,function(e,t,n){var r;return C.isWindow(e)?e.document.documentElement["client"+o]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+o],r["scroll"+o],e.body["offset"+o],r["offset"+o],r["client"+o])):void 0===n?C.css(e,t,i):C.style(e,t,n,i)},s,n?e:void 0,n,null)}})}),C.fn.size=function(){return this.length},C.fn.andSelf=C.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return C});var qt=h.jQuery,Ht=h.$;return C.noConflict=function(e){return h.$===C&&(h.$=Ht),e&&h.jQuery===C&&(h.jQuery=qt),C},typeof e===U&&(h.jQuery=h.$=C),C}); +!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(P){function s(t,e){var i,s,n,o=t.nodeName.toLowerCase();return"area"===o?(s=(i=t.parentNode).name,!(!t.href||!s||"map"!==i.nodeName.toLowerCase())&&(!!(n=P("img[usemap='#"+s+"']")[0])&&a(n))):(/^(input|select|textarea|button|object)$/.test(o)?!t.disabled:"a"===o&&t.href||e)&&a(t)}function a(t){return P.expr.filters.visible(t)&&!P(t).parents().addBack().filter(function(){return"hidden"===P.css(this,"visibility")}).length}function t(){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},P.extend(this._defaults,this.regional[""]),this.regional.en=P.extend(!0,{},this.regional[""]),this.regional["en-US"]=P.extend(!0,{},this.regional.en),this.dpDiv=i(P("
"))}function i(t){var e="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(e,"mouseout",function(){P(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&P(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&P(this).removeClass("ui-datepicker-next-hover")}).delegate(e,"mouseover",o)}function o(){P.datepicker._isDisabledDatepicker(g.inline?g.dpDiv.parent()[0]:g.input[0])||(P(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),P(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&P(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&P(this).addClass("ui-datepicker-next-hover"))}function u(t,e){for(var i in P.extend(t,e),e)null==e[i]&&(t[i]=e[i]);return t}function e(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}var n,r,h,l;P.ui=P.ui||{},P.extend(P.ui,{version:"1.11.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),P.fn.extend({scrollParent:function(t){var e=this.css("position"),i="absolute"===e,s=t?/(auto|scroll|hidden)/:/(auto|scroll)/,n=this.parents().filter(function(){var t=P(this);return(!i||"static"!==t.css("position"))&&s.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==e&&n.length?n:P(this[0].ownerDocument||document)},uniqueId:(l=0,function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++l)})}),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&P(this).removeAttr("id")})}}),P.extend(P.expr[":"],{data:P.expr.createPseudo?P.expr.createPseudo(function(e){return function(t){return!!P.data(t,e)}}):function(t,e,i){return!!P.data(t,i[3])},focusable:function(t){return s(t,!isNaN(P.attr(t,"tabindex")))},tabbable:function(t){var e=P.attr(t,"tabindex"),i=isNaN(e);return(i||0<=e)&&s(t,!i)}}),P("").outerWidth(1).jquery||P.each(["Width","Height"],function(t,i){function s(t,e,i,s){return P.each(n,function(){e-=parseFloat(P.css(t,"padding"+this))||0,i&&(e-=parseFloat(P.css(t,"border"+this+"Width"))||0),s&&(e-=parseFloat(P.css(t,"margin"+this))||0)}),e}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:P.fn.innerWidth,innerHeight:P.fn.innerHeight,outerWidth:P.fn.outerWidth,outerHeight:P.fn.outerHeight};P.fn["inner"+i]=function(t){return void 0===t?a["inner"+i].call(this):this.each(function(){P(this).css(o,s(this,t)+"px")})},P.fn["outer"+i]=function(t,e){return"number"!=typeof t?a["outer"+i].call(this,t):this.each(function(){P(this).css(o,s(this,t,!0,e)+"px")})}}),P.fn.addBack||(P.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),P("").data("a-b","a").removeData("a-b").data("a-b")&&(P.fn.removeData=(h=P.fn.removeData,function(t){return arguments.length?h.call(this,P.camelCase(t)):h.call(this)})),P.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),P.fn.extend({focus:(r=P.fn.focus,function(e,i){return"number"==typeof e?this.each(function(){var t=this;setTimeout(function(){P(t).focus(),i&&i.call(t)},e)}):r.apply(this,arguments)}),disableSelection:(n="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.bind(n+".ui-disableSelection",function(t){t.preventDefault()})}),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var e,i,s=P(this[0]);s.length&&s[0]!==document;){if(("absolute"===(e=s.css("position"))||"relative"===e||"fixed"===e)&&(i=parseInt(s.css("zIndex"),10),!isNaN(i)&&0!==i))return i;s=s.parent()}return 0}}),P.ui.plugin={add:function(t,e,i){var s,n=P.ui[t].prototype;for(s in i)n.plugins[s]=n.plugins[s]||[],n.plugins[s].push([e,i[s]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}};var c,d=0,p=Array.prototype.slice;P.cleanData=(c=P.cleanData,function(t){var e,i,s;for(s=0;null!=(i=t[s]);s++)try{(e=P._data(i,"events"))&&e.remove&&P(i).triggerHandler("remove")}catch(t){}c(t)}),P.widget=function(t,i,e){var s,n,o,a,r={},h=t.split(".")[0];return t=t.split(".")[1],s=h+"-"+t,e||(e=i,i=P.Widget),P.expr[":"][s.toLowerCase()]=function(t){return!!P.data(t,s)},P[h]=P[h]||{},n=P[h][t],o=P[h][t]=function(t,e){return this._createWidget?void(arguments.length&&this._createWidget(t,e)):new o(t,e)},P.extend(o,n,{version:e.version,_proto:P.extend({},e),_childConstructors:[]}),(a=new i).options=P.widget.extend({},a.options),P.each(e,function(e,s){return P.isFunction(s)?void(r[e]=(n=function(){return i.prototype[e].apply(this,arguments)},o=function(t){return i.prototype[e].apply(this,t)},function(){var t,e=this._super,i=this._superApply;return this._super=n,this._superApply=o,t=s.apply(this,arguments),this._super=e,this._superApply=i,t})):void(r[e]=s);var n,o}),o.prototype=P.widget.extend(a,{widgetEventPrefix:n&&a.widgetEventPrefix||t},r,{constructor:o,namespace:h,widgetName:t,widgetFullName:s}),n?(P.each(n._childConstructors,function(t,e){var i=e.prototype;P.widget(i.namespace+"."+i.widgetName,o,e._proto)}),delete n._childConstructors):i._childConstructors.push(o),P.widget.bridge(t,o),o},P.widget.extend=function(t){for(var e,i,s=p.call(arguments,1),n=0,o=s.length;n",options:{disabled:!1,create:null},_createWidget:function(t,e){e=P(e||this.defaultElement||this)[0],this.element=P(e),this.uuid=d++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=P(),this.hoverable=P(),this.focusable=P(),e!==this&&(P.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=P(e.style?e.ownerDocument:e.document||e),this.window=P(this.document[0].defaultView||this.document[0].parentWindow)),this.options=P.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:P.noop,_getCreateEventData:P.noop,_create:P.noop,_init:P.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(P.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:P.noop,widget:function(){return this.element},option:function(t,e){var i,s,n,o=t;if(0===arguments.length)return P.widget.extend({},this.options);if("string"==typeof t)if(o={},t=(i=t.split(".")).shift(),i.length){for(s=o[t]=P.widget.extend({},this.options[t]),n=0;i.length-1>n;n++)s[i[n]]=s[i[n]]||{},s=s[i[n]];if(t=i.pop(),1===arguments.length)return void 0===s[t]?null:s[t];s[t]=e}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=e}return this._setOptions(o),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return this.options[t]=e,"disabled"===t&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!e),e&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(a,r,t){var h,l=this;"boolean"!=typeof a&&(t=r,r=a,a=!1),t?(r=h=P(r),this.bindings=this.bindings.add(r)):(t=r,r=this.element,h=this.widget()),P.each(t,function(t,e){function i(){return a||!0!==l.options.disabled&&!P(this).hasClass("ui-state-disabled")?("string"==typeof e?l[e]:e).apply(l,arguments):void 0}"string"!=typeof e&&(i.guid=e.guid=e.guid||i.guid||P.guid++);var s=t.match(/^([\w:-]*)\s*(.*)$/),n=s[1]+l.eventNamespace,o=s[2];o?h.delegate(o,n,i):r.bind(n,i)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(e).undelegate(e),this.bindings=P(this.bindings.not(t).get()),this.focusable=P(this.focusable.not(t).get()),this.hoverable=P(this.hoverable.not(t).get())},_delay:function(t,e){var i=this;return setTimeout(function(){return("string"==typeof t?i[t]:t).apply(i,arguments)},e||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){P(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){P(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){P(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){P(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,e,i){var s,n,o=this.options[t];if(i=i||{},(e=P.Event(e)).type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),e.target=this.element[0],n=e.originalEvent)for(s in n)s in e||(e[s]=n[s]);return this.element.trigger(e,i),!(P.isFunction(o)&&!1===o.apply(this.element[0],[e].concat(i))||e.isDefaultPrevented())}},P.each({show:"fadeIn",hide:"fadeOut"},function(o,a){P.Widget.prototype["_"+o]=function(e,t,i){"string"==typeof t&&(t={effect:t});var s,n=t?!0===t||"number"==typeof t?a:t.effect||a:o;"number"==typeof(t=t||{})&&(t={duration:t}),s=!P.isEmptyObject(t),t.complete=i,t.delay&&e.delay(t.delay),s&&P.effects&&P.effects.effect[n]?e[o](t):n!==o&&e[n]?e[n](t.duration,t.easing,i):e.queue(function(t){P(this)[o](),i&&i.call(e[0]),t()})}}),P.widget;var f=!1;P(document).mouseup(function(){f=!1}),P.widget("ui.mouse",{version:"1.11.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.bind("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).bind("click."+this.widgetName,function(t){return!0===P.data(t.target,e.widgetName+".preventClickEvent")?(P.removeData(t.target,e.widgetName+".preventClickEvent"),t.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!f){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var e=this,i=1===t.which,s=!("string"!=typeof this.options.cancel||!t.target.nodeName)&&P(t.target).closest(this.options.cancel).length;return i&&!s&&this._mouseCapture(t)&&(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){e.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=!1!==this._mouseStart(t),!this._mouseStarted)?t.preventDefault():(!0===P.data(t.target,this.widgetName+".preventClickEvent")&&P.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return e._mouseMove(t)},this._mouseUpDelegate=function(t){return e._mouseUp(t)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),f=!0)),!0}},_mouseMove:function(t){if(this._mouseMoved){if(P.ui.ie&&(!document.documentMode||document.documentMode<9)&&!t.button)return this._mouseUp(t);if(!t.which)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,t),this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&P.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),f=!1},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function x(t,e,i){return[parseFloat(t[0])*(h.test(t[0])?e/100:1),parseFloat(t[1])*(h.test(t[1])?i/100:1)]}function k(t,e){return parseInt(P.css(t,e),10)||0}P.ui=P.ui||{};var n,C,D=Math.max,I=Math.abs,T=Math.round,s=/left|center|right/,o=/top|center|bottom/,a=/[\+\-]\d+(\.[\d]+)?%?/,r=/^\w+/,h=/%$/,l=P.fn.position;P.position={scrollbarWidth:function(){if(void 0!==n)return n;var t,e,i=P("
"),s=i.children()[0];return P("body").append(i),t=s.offsetWidth,i.css("overflow","scroll"),t===(e=s.offsetWidth)&&(e=i[0].clientWidth),i.remove(),n=t-e},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),s="scroll"===e||"auto"===e&&t.widthI(e+i)&&(o.horizontal="center"),fI(s+n)&&(o.vertical="middle"),o.important=D(I(e),I(i))>D(I(s),I(n))?"horizontal":"vertical",u.using.call(this,t,o)}),a.offset(P.extend(l,{using:t}))})},P.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,o=s.width,a=t.left-e.collisionPosition.marginLeft,r=n-a,h=a+e.collisionWidth-o-n;e.collisionWidth>o?0o?0i)&&(t.left+=u+d+p):0I(s))&&(t.left+=u+d+p))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,a=n.height,r=n.isWindow?n.scrollTop:n.offset.top,h=t.top-e.collisionPosition.marginTop,l=h-r,c=h+e.collisionHeight-a-r,u="top"===e.my[1]?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,d="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,p=-2*e.offset[1];l<0?((s=t.top+u+d+p+e.collisionHeight-a-o)<0||I(l)>s)&&(t.top+=u+d+p):0I(i))&&(t.top+=u+d+p))}},flipfit:{left:function(){P.ui.position.flip.left.apply(this,arguments),P.ui.position.fit.left.apply(this,arguments)},top:function(){P.ui.position.flip.top.apply(this,arguments),P.ui.position.fit.top.apply(this,arguments)}}},function(){var t,e,i,s,n,o=document.getElementsByTagName("body")[0],a=document.createElement("div");for(n in t=document.createElement(o?"div":"body"),i={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},o&&P.extend(i,{position:"absolute",left:"-1000px",top:"-1000px"}),i)t.style[n]=i[n];t.appendChild(a),(e=o||document.documentElement).insertBefore(t,e.firstChild),a.style.cssText="position: absolute; left: 10.7432222px;",s=P(a).offset().left,C=10").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var e=this.document[0];if(this.handleElement.is(t.target))try{e.activeElement&&"body"!==e.activeElement.nodeName.toLowerCase()&&P(e.activeElement).blur()}catch(t){}},_mouseStart:function(t){var e=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),P.ui.ddmanager&&(P.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=0i[2]&&(h=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,h=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o),"y"===a.axis&&(h=this.originalPageX),"x"===a.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0: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,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(t,e,i){return i=i||this._uiHash(),P.ui.plugin.call(this,t,[e,i,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),i.offset=this.positionAbs),P.Widget.prototype._trigger.call(this,t,e,i)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),P.ui.plugin.add("draggable","connectToSortable",{start:function(e,t,i){var s=P.extend({},t,{item:i.element});i.sortables=[],P(i.options.connectToSortable).each(function(){var t=P(this).sortable("instance");t&&!t.options.disabled&&(i.sortables.push(t),t.refreshPositions(),t._trigger("activate",e,s))})},stop:function(e,t,i){var s=P.extend({},t,{item:i.element});i.cancelHelperRemoval=!1,P.each(i.sortables,function(){var t=this;t.isOver?(t.isOver=0,i.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,s))})},drag:function(i,s,n){P.each(n.sortables,function(){var t=!1,e=this;e.positionAbs=n.positionAbs,e.helperProportions=n.helperProportions,e.offset.click=n.offset.click,e._intersectsWith(e.containerCache)&&(t=!0,P.each(n.sortables,function(){return this.positionAbs=n.positionAbs,this.helperProportions=n.helperProportions,this.offset.click=n.offset.click,this!==e&&this._intersectsWith(this.containerCache)&&P.contains(e.element[0],this.element[0])&&(t=!1),t})),t?(e.isOver||(e.isOver=1,n._parent=s.helper.parent(),e.currentItem=s.helper.appendTo(e.element).data("ui-sortable-item",!0),e.options._helper=e.options.helper,e.options.helper=function(){return s.helper[0]},i.target=e.currentItem[0],e._mouseCapture(i,!0),e._mouseStart(i,!0,!0),e.offset.click.top=n.offset.click.top,e.offset.click.left=n.offset.click.left,e.offset.parent.left-=n.offset.parent.left-e.offset.parent.left,e.offset.parent.top-=n.offset.parent.top-e.offset.parent.top,n._trigger("toSortable",i),n.dropped=e.element,P.each(n.sortables,function(){this.refreshPositions()}),n.currentItem=n.element,e.fromOutside=n),e.currentItem&&(e._mouseDrag(i),s.position=e.position)):e.isOver&&(e.isOver=0,e.cancelHelperRemoval=!0,e.options._revert=e.options.revert,e.options.revert=!1,e._trigger("out",i,e._uiHash(e)),e._mouseStop(i,!0),e.options.revert=e.options._revert,e.options.helper=e.options._helper,e.placeholder&&e.placeholder.remove(),s.helper.appendTo(n._parent),n._refreshOffsets(i),s.position=n._generatePosition(i,!0),n._trigger("fromSortable",i),n.dropped=!1,P.each(n.sortables,function(){this.refreshPositions()}))})}}),P.ui.plugin.add("draggable","cursor",{start:function(t,e,i){var s=P("body"),n=i.options;s.css("cursor")&&(n._cursor=s.css("cursor")),s.css("cursor",n.cursor)},stop:function(t,e,i){var s=i.options;s._cursor&&P("body").css("cursor",s._cursor)}}),P.ui.plugin.add("draggable","opacity",{start:function(t,e,i){var s=P(e.helper),n=i.options;s.css("opacity")&&(n._opacity=s.css("opacity")),s.css("opacity",n.opacity)},stop:function(t,e,i){var s=i.options;s._opacity&&P(e.helper).css("opacity",s._opacity)}}),P.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(t,e,i){var s=i.options,n=!1,o=i.scrollParentNotHidden[0],a=i.document[0];o!==a&&"HTML"!==o.tagName?(s.axis&&"x"===s.axis||(i.overflowOffset.top+o.offsetHeight-t.pageY=Math.abs(l-_),n=f>=Math.abs(c-v),o=f>=Math.abs(r-g),a=f>=Math.abs(h-m),s&&(e.position.top=i._convertPositionTo("relative",{top:l-i.helperProportions.height,left:0}).top),n&&(e.position.top=i._convertPositionTo("relative",{top:c,left:0}).top),o&&(e.position.left=i._convertPositionTo("relative",{top:0,left:r-i.helperProportions.width}).left),a&&(e.position.left=i._convertPositionTo("relative",{top:0,left:h}).left)),d=s||n||o||a,"outer"!==p.snapMode&&(s=f>=Math.abs(l-v),n=f>=Math.abs(c-_),o=f>=Math.abs(r-m),a=f>=Math.abs(h-g),s&&(e.position.top=i._convertPositionTo("relative",{top:l,left:0}).top),n&&(e.position.top=i._convertPositionTo("relative",{top:c-i.helperProportions.height,left:0}).top),o&&(e.position.left=i._convertPositionTo("relative",{top:0,left:r}).left),a&&(e.position.left=i._convertPositionTo("relative",{top:0,left:h-i.helperProportions.width}).left)),!i.snapElements[u].snapping&&(s||n||o||a||d)&&i.options.snap.snap&&i.options.snap.snap.call(i.element,t,P.extend(i._uiHash(),{snapItem:i.snapElements[u].item})),i.snapElements[u].snapping=s||n||o||a||d)}}),P.ui.plugin.add("draggable","stack",{start:function(t,e,i){var s,n=i.options,o=P.makeArray(P(n.stack)).sort(function(t,e){return(parseInt(P(t).css("zIndex"),10)||0)-(parseInt(P(e).css("zIndex"),10)||0)});o.length&&(s=parseInt(P(o[0]).css("zIndex"),10)||0,P(o).each(function(t){P(this).css("zIndex",s+t)}),this.css("zIndex",s+o.length))}}),P.ui.plugin.add("draggable","zIndex",{start:function(t,e,i){var s=P(e.helper),n=i.options;s.css("zIndex")&&(n._zIndex=s.css("zIndex")),s.css("zIndex",n.zIndex)},stop:function(t,e,i){var s=i.options;s._zIndex&&P(e.helper).css("zIndex",s._zIndex)}}),P.ui.draggable,P.widget("ui.droppable",{version:"1.11.4",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,e=this.options,i=e.accept;this.isover=!1,this.isout=!0,this.accept=P.isFunction(i)?i:function(t){return t.is(i)},this.proportions=function(){return arguments.length?void(t=arguments[0]):t||(t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight})},this._addToManager(e.scope),e.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){P.ui.ddmanager.droppables[t]=P.ui.ddmanager.droppables[t]||[],P.ui.ddmanager.droppables[t].push(this)},_splice:function(t){for(var e=0;t.length>e;e++)t[e]===this&&t.splice(e,1)},_destroy:function(){var t=P.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,e){if("accept"===t)this.accept=P.isFunction(e)?e:function(t){return t.is(e)};else if("scope"===t){var i=P.ui.ddmanager.droppables[this.options.scope];this._splice(i),this._addToManager(e)}this._super(t,e)},_activate:function(t){var e=P.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),e&&this._trigger("activate",t,this.ui(e))},_deactivate:function(t){var e=P.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),e&&this._trigger("deactivate",t,this.ui(e))},_over:function(t){var e=P.ui.ddmanager.current;e&&(e.currentItem||e.element)[0]!==this.element[0]&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(e)))},_out:function(t){var e=P.ui.ddmanager.current;e&&(e.currentItem||e.element)[0]!==this.element[0]&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(e)))},_drop:function(e,t){var i=t||P.ui.ddmanager.current,s=!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=P(this).droppable("instance");return t.options.greedy&&!t.options.disabled&&t.options.scope===i.options.scope&&t.accept.call(t.element[0],i.currentItem||i.element)&&P.ui.intersect(i,P.extend(t,{offset:t.element.offset()}),t.options.tolerance,e)?!(s=!0):void 0}),!s&&(!!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",e,this.ui(i)),this.element)))},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}}}),P.ui.intersect=function(){function d(t,e,i){return e<=t&&th&&c>a-t.helperProportions.width/2&&o+t.helperProportions.height/2>l&&u>r-t.helperProportions.height/2;case"pointer":return d(s.pageY,l,e.proportions().height)&&d(s.pageX,h,e.proportions().width);case"touch":return(l<=o&&o<=u||l<=r&&r<=u||oi;i++)if(!(n[i].options.disabled||t&&!n[i].accept.call(n[i].element[0],t.currentItem||t.element))){for(s=0;a.length>s;s++)if(a[s]===n[i].element[0]){n[i].proportions().height=0;continue t}n[i].visible="none"!==n[i].element.css("display"),n[i].visible&&("mousedown"===o&&n[i]._activate.call(n[i],e),n[i].offset=n[i].element.offset(),n[i].proportions({width:n[i].element[0].offsetWidth,height:n[i].element[0].offsetHeight}))}},drop:function(t,e){var i=!1;return P.each((P.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&P.ui.intersect(t,this,this.options.tolerance,e)&&(i=this._drop.call(this,e)||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,e)))}),i},dragStart:function(t,e){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||P.ui.ddmanager.prepareOffsets(t,e)})},drag:function(o,a){o.options.refreshPositions&&P.ui.ddmanager.prepareOffsets(o,a),P.each(P.ui.ddmanager.droppables[o.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var t,e,i,s=P.ui.intersect(o,this,this.options.tolerance,a),n=!s&&this.isover?"isout":s&&!this.isover?"isover":null;n&&(this.options.greedy&&(e=this.options.scope,(i=this.element.parents(":data(ui-droppable)").filter(function(){return P(this).droppable("instance").options.scope===e})).length&&((t=P(i[0]).droppable("instance")).greedyChild="isover"===n)),t&&"isover"===n&&(t.isover=!1,t.isout=!0,t._out.call(t,a)),this[n]=!0,this["isout"===n?"isover":"isout"]=!1,this["isover"===n?"_over":"_out"].call(this,a),t&&"isout"===n&&(t.isout=!1,t.isover=!0,t._over.call(t,a)))}})},dragStop:function(t,e){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||P.ui.ddmanager.prepareOffsets(t,e)}},P.ui.droppable,P.widget("ui.resizable",P.ui.mouse,{version:"1.11.4",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},_num:function(t){return parseInt(t,10)||0},_isNumber:function(t){return!isNaN(parseInt(t,10))},_hasScroll:function(t,e){if("hidden"===P(t).css("overflow"))return!1;var i=e&&"left"===e?"scrollLeft":"scrollTop",s=!1;return 0").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.resizable("instance")),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=n.handles||(P(".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=P(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},e=0;t.length>e;e++)i=P.trim(t[e]),(s=P("
")).css({zIndex:n.zIndex}),"se"===i&&s.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[i]=".ui-resizable-"+i,this.element.append(s);this._renderAxis=function(t){var e,i,s,n;for(e in t=t||this.element,this.handles)this.handles[e].constructor===String?this.handles[e]=this.element.children(this.handles[e]).first().show():(this.handles[e].jquery||this.handles[e].nodeType)&&(this.handles[e]=P(this.handles[e]),this._on(this.handles[e],{mousedown:o._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(i=P(this.handles[e],this.element),n=/sw|ne|nw|se|n|s/.test(e)?i.outerHeight():i.outerWidth(),s=["padding",/ne|nw|n/.test(e)?"Top":/se|sw|s/.test(e)?"Bottom":/^e$/.test(e)?"Right":"Left"].join(""),t.css(s,n),this._proportionallyResize()),this._handles=this._handles.add(this.handles[e])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(s=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=s&&s[1]?s[1]:"se")}),n.autoHide&&(this._handles.hide(),P(this.element).addClass("ui-resizable-autohide").mouseenter(function(){n.disabled||(P(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){n.disabled||o.resizing||(P(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,e=function(t){P(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&&(e(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),e(this.originalElement),this},_mouseCapture:function(t){var e,i,s=!1;for(e in this.handles)((i=P(this.handles[e])[0])===t.target||P.contains(i,t.target))&&(s=!0);return!this.options.disabled&&s},_mouseStart:function(t){var e,i,s,n=this.options,o=this.element;return this.resizing=!0,this._renderProxy(),e=this._num(this.helper.css("left")),i=this._num(this.helper.css("top")),n.containment&&(e+=P(n.containment).scrollLeft()||0,i+=P(n.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:e,top:i},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:o.width(),height:o.height()},this.originalSize=this._helper?{width:o.outerWidth(),height:o.outerHeight()}:{width:o.width(),height:o.height()},this.sizeDiff={width:o.outerWidth()-o.width(),height:o.outerHeight()-o.height()},this.originalPosition={left:e,top:i},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof n.aspectRatio?n.aspectRatio:this.originalSize.width/this.originalSize.height||1,s=P(".ui-resizable-"+this.axis).css("cursor"),P("body").css("cursor","auto"===s?this.axis+"-resize":s),o.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var e,i,s=this.originalMousePosition,n=this.axis,o=t.pageX-s.left||0,a=t.pageY-s.top||0,r=this._change[n];return this._updatePrevProperties(),r&&(e=r.apply(this,[t,o,a]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(e=this._updateRatio(e,t)),e=this._respectSize(e,t),this._updateCache(e),this._propagate("resize",t),i=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),P.isEmptyObject(i)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges())),!1},_mouseStop:function(t){this.resizing=!1;var e,i,s,n,o,a,r,h=this.options,l=this;return this._helper&&(s=(i=(e=this._proportionallyResizeElements).length&&/textarea/i.test(e[0].nodeName))&&this._hasScroll(e[0],"left")?0:l.sizeDiff.height,n=i?0:l.sizeDiff.width,o={width:l.helper.width()-n,height:l.helper.height()-s},a=parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left)||null,r=parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top)||null,h.animate||this.element.css(P.extend(o,{top:r,left:a})),l.helper.height(l.size.height),l.helper.width(l.size.width),this._helper&&!h.animate&&this._proportionallyResize()),P("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidtht.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,h=this.position.top+this.size.height,l=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=r-e.minWidth),s&&l&&(t.left=r-e.maxWidth),a&&c&&(t.top=h-e.minHeight),n&&c&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];e<4;e++)i[e]=parseInt(s[e],10)||0,i[e]+=parseInt(n[e],10)||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,e=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||P("
"),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:++e.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize;return{left:this.originalPosition.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize;return{top:this.originalPosition.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(t,e,i){return P.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},sw:function(t,e,i){return P.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,e,i]))},ne:function(t,e,i){return P.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},nw:function(t,e,i){return P.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,e,i]))}},_propagate:function(t,e){P.ui.plugin.call(this,t,[e,this.ui()]),"resize"!==t&&this._trigger(t,e,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}}}),P.ui.plugin.add("resizable","animate",{stop:function(e){var i=P(this).resizable("instance"),t=i.options,s=i._proportionallyResizeElements,n=s.length&&/textarea/i.test(s[0].nodeName),o=n&&i._hasScroll(s[0],"left")?0:i.sizeDiff.height,a=n?0:i.sizeDiff.width,r={width:i.size.width-a,height:i.size.height-o},h=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,l=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(P.extend(r,l&&h?{top:l,left:h}:{}),{duration:t.animateDuration,easing:t.animateEasing,step:function(){var t={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)};s&&s.length&&P(s[0]).css({width:t.width,height:t.height}),i._updateCache(t),i._propagate("resize",e)}})}}),P.ui.plugin.add("resizable","containment",{start:function(){var i,s,t,e,n,o,a,r=P(this).resizable("instance"),h=r.options,l=r.element,c=h.containment,u=c instanceof P?c.get(0):/parent/.test(c)?l.parent().get(0):c;u&&(r.containerElement=P(u),/document/.test(c)||c===document?(r.containerOffset={left:0,top:0},r.containerPosition={left:0,top:0},r.parentData={element:P(document),left:0,top:0,width:P(document).width(),height:P(document).height()||document.body.parentNode.scrollHeight}):(i=P(u),s=[],P(["Top","Right","Left","Bottom"]).each(function(t,e){s[t]=r._num(i.css("padding"+e))}),r.containerOffset=i.offset(),r.containerPosition=i.position(),r.containerSize={height:i.innerHeight()-s[3],width:i.innerWidth()-s[1]},t=r.containerOffset,e=r.containerSize.height,n=r.containerSize.width,o=r._hasScroll(u,"left")?u.scrollWidth:n,a=r._hasScroll(u)?u.scrollHeight:e,r.parentData={element:u,left:t.left,top:t.top,width:o,height:a}))},resize:function(t){var e,i,s,n,o=P(this).resizable("instance"),a=o.options,r=o.containerOffset,h=o.position,l=o._aspectRatio||t.shiftKey,c={top:0,left:0},u=o.containerElement,d=!0;u[0]!==document&&/static/.test(u.css("position"))&&(c=r),h.left<(o._helper?r.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-r.left:o.position.left-c.left),l&&(o.size.height=o.size.width/o.aspectRatio,d=!1),o.position.left=a.helper?r.left:0),h.top<(o._helper?r.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-r.top:o.position.top),l&&(o.size.width=o.size.height*o.aspectRatio,d=!1),o.position.top=o._helper?r.top:0),s=o.containerElement.get(0)===o.element.parent().get(0),n=/relative|absolute/.test(o.containerElement.css("position")),o.offset.top=s&&n?(o.offset.left=o.parentData.left+o.position.left,o.parentData.top+o.position.top):(o.offset.left=o.element.offset().left,o.element.offset().top),e=Math.abs(o.sizeDiff.width+(o._helper?o.offset.left-c.left:o.offset.left-r.left)),i=Math.abs(o.sizeDiff.height+(o._helper?o.offset.top-c.top:o.offset.top-r.top)),e+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-e,l&&(o.size.height=o.size.width/o.aspectRatio,d=!1)),i+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-i,l&&(o.size.width=o.size.height*o.aspectRatio,d=!1)),d||(o.position.left=o.prevPosition.left,o.position.top=o.prevPosition.top,o.size.width=o.prevSize.width,o.size.height=o.prevSize.height)},stop:function(){var t=P(this).resizable("instance"),e=t.options,i=t.containerOffset,s=t.containerPosition,n=t.containerElement,o=P(t.helper),a=o.offset(),r=o.outerWidth()-t.sizeDiff.width,h=o.outerHeight()-t.sizeDiff.height;t._helper&&!e.animate&&/relative/.test(n.css("position"))&&P(this).css({left:a.left-s.left-i.left,width:r,height:h}),t._helper&&!e.animate&&/static/.test(n.css("position"))&&P(this).css({left:a.left-s.left-i.left,width:r,height:h})}}),P.ui.plugin.add("resizable","alsoResize",{start:function(){var t=P(this).resizable("instance").options;P(t.alsoResize).each(function(){var t=P(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)})})},resize:function(t,i){var e=P(this).resizable("instance"),s=e.options,n=e.originalSize,o=e.originalPosition,a={height:e.size.height-n.height||0,width:e.size.width-n.width||0,top:e.position.top-o.top||0,left:e.position.left-o.left||0};P(s.alsoResize).each(function(){var t=P(this),s=P(this).data("ui-resizable-alsoresize"),n={},e=t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];P.each(e,function(t,e){var i=(s[e]||0)+(a[e]||0);i&&0<=i&&(n[e]=i||null)}),t.css(n)})},stop:function(){P(this).removeData("resizable-alsoresize")}}),P.ui.plugin.add("resizable","ghost",{start:function(){var t=P(this).resizable("instance"),e=t.options,i=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof e.ghost?e.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=P(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=P(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),P.ui.plugin.add("resizable","grid",{resize:function(){var t,e=P(this).resizable("instance"),i=e.options,s=e.size,n=e.originalSize,o=e.originalPosition,a=e.axis,r="number"==typeof i.grid?[i.grid,i.grid]:i.grid,h=r[0]||1,l=r[1]||1,c=Math.round((s.width-n.width)/h)*h,u=Math.round((s.height-n.height)/l)*l,d=n.width+c,p=n.height+u,f=i.maxWidth&&d>i.maxWidth,m=i.maxHeight&&p>i.maxHeight,g=i.minWidth&&i.minWidth>d,v=i.minHeight&&i.minHeight>p;i.grid=r,g&&(d+=h),v&&(p+=l),f&&(d-=h),m&&(p-=l),/^(se|s|e)$/.test(a)?(e.size.width=d,e.size.height=p):/^(ne)$/.test(a)?(e.size.width=d,e.size.height=p,e.position.top=o.top-u):/^(sw)$/.test(a)?(e.size.width=d,e.size.height=p,e.position.left=o.left-c):((p-l<=0||d-h<=0)&&(t=e._getPaddingPlusBorderDimensions(this)),e.position.top=0")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(i){var s=this,t=this.options;this.opos=[i.pageX,i.pageY],this.options.disabled||(this.selectees=P(t.filter,this.element[0]),this._trigger("start",i),P(t.appendTo).append(this.helper),this.helper.css({left:i.pageX,top:i.pageY,width:0,height:0}),t.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var t=P.data(this,"selectable-item");t.startselected=!0,i.metaKey||i.ctrlKey||(t.$element.removeClass("ui-selected"),t.selected=!1,t.$element.addClass("ui-unselecting"),t.unselecting=!0,s._trigger("unselecting",i,{unselecting:t.element}))}),P(i.target).parents().addBack().each(function(){var t,e=P.data(this,"selectable-item");return e?(t=!i.metaKey&&!i.ctrlKey||!e.$element.hasClass("ui-selected"),e.$element.removeClass(t?"ui-unselecting":"ui-selected").addClass(t?"ui-selecting":"ui-unselecting"),e.unselecting=!t,e.selecting=t,(e.selected=t)?s._trigger("selecting",i,{selecting:e.element}):s._trigger("unselecting",i,{unselecting:e.element}),!1):void 0}))},_mouseDrag:function(i){if(this.dragged=!0,!this.options.disabled){var t,s=this,n=this.options,o=this.opos[0],a=this.opos[1],r=i.pageX,h=i.pageY;return rr||o>t.right||t.top>h||a>t.bottom):"fit"===n.tolerance&&(e=t.left>o&&r>t.right&&t.top>a&&h>t.bottom),e?(t.selected&&(t.$element.removeClass("ui-selected"),t.selected=!1),t.unselecting&&(t.$element.removeClass("ui-unselecting"),t.unselecting=!1),t.selecting||(t.$element.addClass("ui-selecting"),t.selecting=!0,s._trigger("selecting",i,{selecting:t.element}))):(t.selecting&&((i.metaKey||i.ctrlKey)&&t.startselected?(t.$element.removeClass("ui-selecting"),t.selecting=!1,t.$element.addClass("ui-selected"),t.selected=!0):(t.$element.removeClass("ui-selecting"),t.selecting=!1,t.startselected&&(t.$element.addClass("ui-unselecting"),t.unselecting=!0),s._trigger("unselecting",i,{unselecting:t.element}))),t.selected&&(i.metaKey||i.ctrlKey||t.startselected||(t.$element.removeClass("ui-selected"),t.selected=!1,t.$element.addClass("ui-unselecting"),t.unselecting=!0,s._trigger("unselecting",i,{unselecting:t.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,P(".ui-unselecting",this.element[0]).each(function(){var t=P.data(this,"selectable-item");t.$element.removeClass("ui-unselecting"),t.unselecting=!1,t.startselected=!1,i._trigger("unselected",e,{unselected:t.element})}),P(".ui-selecting",this.element[0]).each(function(){var t=P.data(this,"selectable-item");t.$element.removeClass("ui-selecting").addClass("ui-selected"),t.selecting=!1,t.selected=!0,t.startselected=!0,i._trigger("selected",e,{selected:t.element})}),this._trigger("stop",e),this.helper.remove(),!1}}),P.widget("ui.sortable",P.ui.mouse,{version:"1.11.4",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},_isOverAxis:function(t,e,i){return e<=t&&t*{ cursor: "+o.cursor+" !important; }").appendTo(n)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!i)for(s=this.containers.length-1;0<=s;s--)this.containers[s]._trigger("activate",t,this._uiHash(this));return P.ui.ddmanager&&(P.ui.ddmanager.current=this),P.ui.ddmanager&&!o.dropBehaviour&&P.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var e,i,s,n,o=this.options,a=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageYt[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var e="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),i="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),s=e&&i,n=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return!!s&&(this.floating?o&&"right"===o||"down"===n?2:1:n&&("down"===n?2:1))},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(0e;e++)if(i[e]===t.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var e,i,s,n,o,a,r,h,l=this.items,c=[[P.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):P(this.options.items,this.element),this]],u=this._connectWith();if(u&&this.ready)for(e=u.length-1;0<=e;e--)for(i=(s=P(u[e],this.document[0])).length-1;0<=i;i--)(n=P.data(s[i],this.widgetFullName))&&n!==this&&!n.options.disabled&&(c.push([P.isFunction(n.options.items)?n.options.items.call(n.element[0],t,{item:this.currentItem}):P(n.options.items,n.element),n]),this.containers.push(n));for(e=c.length-1;0<=e;e--)for(o=c[e][1],i=0,h=(a=c[e][0]).length;i",i.document[0]).addClass(s||i.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tbody"===t?i._createTrPlaceholder(i.currentItem.find("tr").eq(0),P("",i.document[0]).appendTo(e)):"tr"===t?i._createTrPlaceholder(i.currentItem,e):"img"===t&&e.attr("src",i.currentItem.attr("src")),s||e.css("visibility","hidden"),e},update:function(t,e){(!s||n.forcePlaceholderSize)&&(e.height()||e.height(i.currentItem.innerHeight()-parseInt(i.currentItem.css("paddingTop")||0,10)-parseInt(i.currentItem.css("paddingBottom")||0,10)),e.width()||e.width(i.currentItem.innerWidth()-parseInt(i.currentItem.css("paddingLeft")||0,10)-parseInt(i.currentItem.css("paddingRight")||0,10)))}}),i.placeholder=P(n.placeholder.element.call(i.element,i.currentItem)),i.currentItem.after(i.placeholder),n.placeholder.update(i,i.placeholder)},_createTrPlaceholder:function(t,e){var i=this;t.children().each(function(){P(" ",i.document[0]).attr("colspan",P(this).attr("colspan")||1).appendTo(e)})},_contactContainers:function(t){var e,i,s,n,o,a,r,h,l,c,u=null,d=null;for(e=this.containers.length-1;0<=e;e--)if(!P.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(u&&P.contains(this.containers[e].element[0],u.element[0]))continue;u=this.containers[e],d=e}else this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",t,this._uiHash(this)),this.containers[e].containerCache.over=0);if(u)if(1===this.containers.length)this.containers[d].containerCache.over||(this.containers[d]._trigger("over",t,this._uiHash(this)),this.containers[d].containerCache.over=1);else{for(s=1e4,n=null,o=(l=u.floating||this._isFloating(this.currentItem))?"left":"top",a=l?"width":"height",c=l?"clientX":"clientY",i=this.items.length-1;0<=i;i--)P.contains(this.containers[d].element[0],this.items[i].item[0])&&this.items[i].item[0]!==this.currentItem[0]&&(r=this.items[i].item.offset()[o],h=!1,t[c]-r>this.items[i][a]/2&&(h=!0),s>Math.abs(t[c]-r)&&(s=Math.abs(t[c]-r),n=this.items[i],this.direction=h?"up":"down"));if(!n&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[d])return void(this.currentContainer.containerCache.over||(this.containers[d]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1));n?this._rearrange(t,n,null,!0):this._rearrange(t,null,this.containers[d].element,!0),this._trigger("change",t,this._uiHash()),this.containers[d]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[d],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[d]._trigger("over",t,this._uiHash(this)),this.containers[d].containerCache.over=1}},_createHelper:function(t){var e=this.options,i=P.isFunction(e.helper)?P(e.helper.apply(this.element[0],[t,this.currentItem])):"clone"===e.helper?this.currentItem.clone():this.currentItem;return i.parents("body").length||P("parent"!==e.appendTo?e.appendTo:this.currentItem[0].parentNode)[0].appendChild(i[0]),i[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")}),(!i[0].style.width||e.forceHelperSize)&&i.width(this.currentItem.width()),(!i[0].style.height||e.forceHelperSize)&&i.height(this.currentItem.height()),i},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),P.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]!==this.document[0]&&P.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&P.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)return{top:0,left:0};var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}},_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,e,i,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,"document"===s.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===s.containment?this.document.width():this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(s.containment)||(t=P(s.containment)[0],e=P(s.containment).offset(),i="hidden"!==P(t).css("overflow"),this.containment=[e.left+(parseInt(P(t).css("borderLeftWidth"),10)||0)+(parseInt(P(t).css("paddingLeft"),10)||0)-this.margins.left,e.top+(parseInt(P(t).css("borderTopWidth"),10)||0)+(parseInt(P(t).css("paddingTop"),10)||0)-this.margins.top,e.left+(i?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(P(t).css("borderLeftWidth"),10)||0)-(parseInt(P(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,e.top+(i?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(P(t).css("borderTopWidth"),10)||0)-(parseInt(P(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,e){e||(e=this.position);var i="absolute"===t?1:-1,s="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&P.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,n=/(html|body)/i.test(s[0].tagName);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():n?0:s.scrollTop())*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():n?0:s.scrollLeft())*i}},_generatePosition:function(t){var e,i,s=this.options,n=t.pageX,o=t.pageY,a="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&P.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,r=/(html|body)/i.test(a[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.leftthis.containment[2]&&(n=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),s.grid&&(e=this.originalPageY+Math.round((o-this.originalPageY)/s.grid[1])*s.grid[1],o=this.containment?e-this.offset.click.top>=this.containment[1]&&e-this.offset.click.top<=this.containment[3]?e:e-this.offset.click.top>=this.containment[1]?e-s.grid[1]:e+s.grid[1]:e,i=this.originalPageX+Math.round((n-this.originalPageX)/s.grid[0])*s.grid[0],n=this.containment?i-this.offset.click.left>=this.containment[0]&&i-this.offset.click.left<=this.containment[2]?i:i-this.offset.click.left>=this.containment[0]?i-s.grid[0]:i+s.grid[0]:i)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():r?0:a.scrollTop()),left:n-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():r?0:a.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){function i(e,i,s){return function(t){s._trigger(e,t,i._uiHash(i))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;0<=s;s--)e||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].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,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(s=0;n.length>s;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){!1===P.Widget.prototype._trigger.apply(this,arguments)&&this.cancel()},_uiHash:function(t){var e=t||this;return{helper:e.helper,placeholder:e.placeholder||P([]),position:e.position,originalPosition:e.originalPosition,offset:e.positionAbs,item:e.currentItem,sender:t?t.element:null}}}),P.widget("ui.accordion",{version:"1.11.4",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},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=P(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||!1!==t.active&&null!=t.active||(t.active=0),this._processPanels(),t.active<0&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():P()}},_createIcons:function(){var t=this.options.icons;t&&(P("").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 t;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){return"active"===t?void this._activate(e):("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||!1!==this.options.active||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons()),void("disabled"===t&&(this.element.toggleClass("ui-state-disabled",!!e).attr("aria-disabled",e),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!e))))},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var e=P.ui.keyCode,i=this.headers.length,s=this.headers.index(t.target),n=!1;switch(t.keyCode){case e.RIGHT:case e.DOWN:n=this.headers[(s+1)%i];break;case e.LEFT:case e.UP:n=this.headers[(s-1+i)%i];break;case e.SPACE:case e.ENTER:this._eventHandler(t);break;case e.HOME:n=this.headers[0];break;case e.END:n=this.headers[i-1]}n&&(P(t.target).attr("tabIndex",-1),P(n).attr("tabIndex",0),n.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===P.ui.keyCode.UP&&t.ctrlKey&&P(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),!1===t.active&&!0===t.collapsible||!this.headers.length?(t.active=!1,this.active=P()):!1===t.active?this._activate(0):this.active.length&&!P.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=P()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.panels=this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide(),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var i,t=this.options,e=t.heightStyle,s=this.element.parent();this.active=this._findActive(t.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(){var t=P(this),e=t.uniqueId().attr("id"),i=t.next(),s=i.uniqueId().attr("id");t.attr("aria-controls",s),i.attr("aria-labelledby",e)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(t.event),"fill"===e?(i=s.height(),this.element.siblings(":visible").each(function(){var t=P(this),e=t.css("position");"absolute"!==e&&"fixed"!==e&&(i-=t.outerHeight(!0))}),this.headers.each(function(){i-=P(this).outerHeight(!0)}),this.headers.next().each(function(){P(this).height(Math.max(0,i-P(this).innerHeight()+P(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.headers.next().each(function(){i=Math.max(i,P(this).css("height","").height())}).height(i))},_activate:function(t){var e=this._findActive(t)[0];e!==this.active[0]&&(e=e||this.active[0],this._eventHandler({target:e,currentTarget:e,preventDefault:P.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):P()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&P.each(t.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var e=this.options,i=this.active,s=P(t.currentTarget),n=s[0]===i[0],o=n&&e.collapsible,a=o?P():s.next(),r=i.next(),h={oldHeader:i,oldPanel:r,newHeader:o?P():s,newPanel:a};t.preventDefault(),n&&!e.collapsible||!1===this._trigger("beforeActivate",t,h)||(e.active=!o&&this.headers.index(s),this.active=n?P():s,this._toggle(h),i.removeClass("ui-accordion-header-active ui-state-active"),e.icons&&i.children(".ui-accordion-header-icon").removeClass(e.icons.activeHeader).addClass(e.icons.header),n||(s.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),e.icons&&s.children(".ui-accordion-header-icon").removeClass(e.icons.header).addClass(e.icons.activeHeader),s.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var e=t.newPanel,i=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=e,this.prevHide=i,this.options.animate?this._animate(e,i,t):(i.hide(),e.show(),this._toggleComplete(t)),i.attr({"aria-hidden":"true"}),i.prev().attr({"aria-selected":"false","aria-expanded":"false"}),e.length&&i.length?i.prev().attr({tabIndex:-1,"aria-expanded":"false"}):e.length&&this.headers.filter(function(){return 0===parseInt(P(this).attr("tabIndex"),10)}).attr("tabIndex",-1),e.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,i,e){var s,n,o,a=this,r=0,h=t.css("box-sizing"),l=t.length&&(!i.length||t.index()",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 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").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(t){var e=P(t.target);!this.mouseHandled&&e.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),e.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&P(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){if(!this.previousFilter){var e=P(t.currentTarget);e.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(t,e)}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,i)},blur:function(t){this._delay(function(){P.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&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-menu-icons ui-front").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").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=P(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){var e,i,s,n,o=!0;switch(t.keyCode){case P.ui.keyCode.PAGE_UP:this.previousPage(t);break;case P.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case P.ui.keyCode.HOME:this._move("first","first",t);break;case P.ui.keyCode.END:this._move("last","last",t);break;case P.ui.keyCode.UP:this.previous(t);break;case P.ui.keyCode.DOWN:this.next(t);break;case P.ui.keyCode.LEFT:this.collapse(t);break;case P.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case P.ui.keyCode.ENTER:case P.ui.keyCode.SPACE:this._activate(t);break;case P.ui.keyCode.ESCAPE:this.collapse(t);break;default:o=!1,i=this.previousFilter||"",s=String.fromCharCode(t.keyCode),n=!1,clearTimeout(this.filterTimer),s===i?n=!0:s=i+s,e=this._filterMenuItems(s),(e=n&&-1!==e.index(this.active.next())?this.active.nextAll(".ui-menu-item"):e).length||(s=String.fromCharCode(t.keyCode),e=this._filterMenuItems(s)),e.length?(this.focus(t,e),this.previousFilter=s,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}o&&t.preventDefault()},_activate:function(t){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(t):this.select(t))},refresh:function(){var t,e=this,s=this.options.icons.submenu,i=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),i.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=P(this),e=t.parent(),i=P("").addClass("ui-menu-icon ui-icon "+s).data("ui-menu-submenu-carat",!0);e.attr("aria-haspopup","true").prepend(i),t.attr("aria-labelledby",e.attr("id"))}),(t=i.add(this.element).find(this.options.items)).not(".ui-menu-item").each(function(){var t=P(this);e._isDivider(t)&&t.addClass("ui-widget-content ui-menu-divider")}),t.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),t.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!P.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){"icons"===t&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(e.submenu),"disabled"===t&&this.element.toggleClass("ui-state-disabled",!!e).attr("aria-disabled",e),this._super(t,e)},focus:function(t,e){var i,s;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),(i=e.children(".ui-menu")).length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(t){var e,i,s,n,o,a;this._hasScroll()&&(e=parseFloat(P.css(this.activeMenu[0],"borderTopWidth"))||0,i=parseFloat(P.css(this.activeMenu[0],"paddingTop"))||0,s=t.offset().top-this.activeMenu.offset().top-e-i,n=this.activeMenu.scrollTop(),o=this.activeMenu.height(),a=t.outerHeight(),s<0?this.activeMenu.scrollTop(n+s):o",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},requestIndex:0,pending:0,_create:function(){var i,s,n,t=this.element[0].nodeName.toLowerCase(),e="textarea"===t,o="input"===t;this.isMultiLine=!!e||!o&&this.element.prop("isContentEditable"),this.valueMethod=this.element[e||o?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(t){if(this.element.prop("readOnly"))s=n=i=!0;else{s=n=i=!1;var e=P.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:i=!0,this._move("previousPage",t);break;case e.PAGE_DOWN:i=!0,this._move("nextPage",t);break;case e.UP:i=!0,this._keyEvent("previous",t);break;case e.DOWN:i=!0,this._keyEvent("next",t);break;case e.ENTER:this.menu.active&&(i=!0,t.preventDefault(),this.menu.select(t));break;case e.TAB:this.menu.active&&this.menu.select(t);break;case e.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(t),t.preventDefault());break;default:s=!0,this._searchTimeout(t)}}},keypress:function(t){if(i)return i=!1,void((!this.isMultiLine||this.menu.element.is(":visible"))&&t.preventDefault());if(!s){var e=P.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:this._move("previousPage",t);break;case e.PAGE_DOWN:this._move("nextPage",t);break;case e.UP:this._keyEvent("previous",t);break;case e.DOWN:this._keyEvent("next",t)}}},input:function(t){return n?(n=!1,void t.preventDefault()):void this._searchTimeout(t)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?void delete this.cancelBlur:(clearTimeout(this.searching),this.close(t),void this._change(t))}}),this._initSource(),this.menu=P("
    ").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),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];P(t.target).closest(".ui-menu-item").length||this._delay(function(){var e=this;this.document.one("mousedown",function(t){t.target===e.element[0]||t.target===i||P.contains(i,t.target)||e.close()})})},menufocus:function(t,e){var i,s;return this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type))?(this.menu.blur(),void this.document.one("mousemove",function(){P(t.target).trigger(t.originalEvent)})):(s=e.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:s})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(s.value),void((i=e.item.attr("aria-label")||s.value)&&P.trim(i).length&&(this.liveRegion.children().hide(),P("
    ").text(i).appendTo(this.liveRegion))))},menuselect:function(t,e){var i=e.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",t,{item:i})&&this._value(i.value),this.term=this._value(),this.close(t),this.selectedItem=i}}),this.liveRegion=P("",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body),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(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?P(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var i,s,n=this;P.isArray(this.options.source)?(i=this.options.source,this.source=function(t,e){e(P.ui.autocomplete.filter(i,t.term))}):"string"==typeof this.options.source?(s=this.options.source,this.source=function(t,e){n.xhr&&n.xhr.abort(),n.xhr=P.ajax({url:s,data:t,dataType:"json",success:function(t){e(t)},error:function(){e([])}})}):this.source=this.options.source},_searchTimeout:function(s){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),e=this.menu.element.is(":visible"),i=s.altKey||s.ctrlKey||s.metaKey||s.shiftKey;(!t||t&&!e&&!i)&&(this.selectedItem=null,this.search(null,s))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length").text(e.label).appendTo(t)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),void this.menu.blur()):void this.menu[t](e):void this.search(null,e)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())}}),P.extend(P.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,e){var i=RegExp(P.ui.autocomplete.escapeRegex(e),"i");return P.grep(t,function(t){return i.test(t.label||t.value||t)})}}),P.widget("ui.autocomplete",P.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(1").text(e).appendTo(this.liveRegion))}}),P.ui.autocomplete;var m,g,v,_="ui-button ui-widget ui-state-default ui-corner-all",b="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",y=function(){var t=P(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},w=function(t){var e=t.name,i=t.form,s=P([]);return e&&(e=e.replace(/'/g,"\\'"),s=i?P(i).find("[name='"+e+"'][type=radio]"):P("[name='"+e+"'][type=radio]",t.ownerDocument).filter(function(){return!this.form})),s};P.widget("ui.button",{version:"1.11.4",defaultElement:"").addClass(this._triggerClass).html(n?P("").attr({src:n,alt:s,title:s}):s)),t[a?"before":"after"](e.trigger),e.trigger.click(function(){return P.datepicker._datepickerShowing&&P.datepicker._lastInput===t[0]?P.datepicker._hideDatepicker():(P.datepicker._datepickerShowing&&P.datepicker._lastInput!==t[0]&&P.datepicker._hideDatepicker(),P.datepicker._showDatepicker(t[0])),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,s,n,o=new Date(2009,11,20),a=this._get(t,"dateFormat");a.match(/[DM]/)&&(e=function(t){for(n=s=i=0;t.length>n;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length)}},_inlineDatepicker:function(t,e){var i=P(t);i.hasClass(this.markerClassName)||(i.addClass(this.markerClassName).append(e.dpDiv),P.data(t,"datepicker",e),this._setDate(e,this._getDefaultDate(e),!0),this._updateDatepicker(e),this._updateAlternate(e),e.settings.disabled&&this._disableDatepicker(t),e.dpDiv.css("display","block"))},_dialogDatepicker:function(t,e,i,s,n){var o,a,r,h,l,c=this._dialogInst;return c||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=P(""),this._dialogInput.keydown(this._doKeyDown),P("body").append(this._dialogInput),(c=this._dialogInst=this._newInst(this._dialogInput,!1)).settings={},P.data(this._dialogInput[0],"datepicker",c)),u(c.settings,s||{}),e=e&&e.constructor===Date?this._formatDate(c,e):e,this._dialogInput.val(e),this._pos=n?n.length?n:[n.pageX,n.pageY]:null,this._pos||(a=document.documentElement.clientWidth,r=document.documentElement.clientHeight,h=document.documentElement.scrollLeft||document.body.scrollLeft,l=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[a/2-100+h,r/2-150+l]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),c.settings.onSelect=i,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),P.blockUI&&P.blockUI(this.dpDiv),P.data(this._dialogInput[0],"datepicker",c),this},_destroyDatepicker:function(t){var e,i=P(t),s=P.data(t,"datepicker");i.hasClass(this.markerClassName)&&(e=t.nodeName.toLowerCase(),P.removeData(t,"datepicker"),"input"===e?(s.append.remove(),s.trigger.remove(),i.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===e||"span"===e)&&i.removeClass(this.markerClassName).empty(),g===s&&(g=null))},_enableDatepicker:function(e){var t,i,s=P(e),n=P.data(e,"datepicker");s.hasClass(this.markerClassName)&&("input"===(t=e.nodeName.toLowerCase())?(e.disabled=!1,n.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===t||"span"===t)&&((i=s.children("."+this._inlineClass)).children().removeClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=P.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var t,i,s=P(e),n=P.data(e,"datepicker");s.hasClass(this.markerClassName)&&("input"===(t=e.nodeName.toLowerCase())?(e.disabled=!0,n.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===t||"span"===t)&&((i=s.children("."+this._inlineClass)).children().addClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=P.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(t){try{return P.data(t,"datepicker")}catch(t){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,e,i){var s,n,o,a,r=this._getInst(t);return 2===arguments.length&&"string"==typeof e?"defaults"===e?P.extend({},P.datepicker._defaults):r?"all"===e?P.extend({},r.settings):this._get(r,e):null:(s=e||{},"string"==typeof e&&((s={})[e]=i),void(r&&(this._curInst===r&&this._hideDatepicker(),n=this._getDateDatepicker(t,!0),o=this._getMinMaxDate(r,"min"),a=this._getMinMaxDate(r,"max"),u(r.settings,s),null!==o&&void 0!==s.dateFormat&&void 0===s.minDate&&(r.settings.minDate=this._formatDate(r,o)),null!==a&&void 0!==s.dateFormat&&void 0===s.maxDate&&(r.settings.maxDate=this._formatDate(r,a)),"disabled"in s&&(s.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(P(t),r),this._autoSize(r),this._setDate(r,n),this._updateAlternate(r),this._updateDatepicker(r))))},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(t){var e,i,s,n=P.datepicker._getInst(t.target),o=!0,a=n.dpDiv.is(".ui-datepicker-rtl");if(n._keyEvent=!0,P.datepicker._datepickerShowing)switch(t.keyCode){case 9:P.datepicker._hideDatepicker(),o=!1;break;case 13:return(s=P("td."+P.datepicker._dayOverClass+":not(."+P.datepicker._currentClass+")",n.dpDiv))[0]&&P.datepicker._selectDay(t.target,n.selectedMonth,n.selectedYear,s[0]),(e=P.datepicker._get(n,"onSelect"))?(i=P.datepicker._formatDate(n),e.apply(n.input?n.input[0]:null,[i,n])):P.datepicker._hideDatepicker(),!1;case 27:P.datepicker._hideDatepicker();break;case 33:P.datepicker._adjustDate(t.target,t.ctrlKey?-P.datepicker._get(n,"stepBigMonths"):-P.datepicker._get(n,"stepMonths"),"M");break;case 34:P.datepicker._adjustDate(t.target,t.ctrlKey?+P.datepicker._get(n,"stepBigMonths"):+P.datepicker._get(n,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&P.datepicker._clearDate(t.target),o=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&P.datepicker._gotoToday(t.target),o=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&P.datepicker._adjustDate(t.target,a?1:-1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&P.datepicker._adjustDate(t.target,t.ctrlKey?-P.datepicker._get(n,"stepBigMonths"):-P.datepicker._get(n,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&P.datepicker._adjustDate(t.target,-7,"D"),o=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&P.datepicker._adjustDate(t.target,a?-1:1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&P.datepicker._adjustDate(t.target,t.ctrlKey?+P.datepicker._get(n,"stepBigMonths"):+P.datepicker._get(n,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&P.datepicker._adjustDate(t.target,7,"D"),o=t.ctrlKey||t.metaKey;break;default:o=!1}else 36===t.keyCode&&t.ctrlKey?P.datepicker._showDatepicker(this):o=!1;o&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var e,i,s=P.datepicker._getInst(t.target);return P.datepicker._get(s,"constrainInput")?(e=P.datepicker._possibleChars(P.datepicker._get(s,"dateFormat")),i=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||i<" "||!e||-1r&&sh&&ns+1&&i.charAt(s+1)===t;return e&&s++,e},y=function(t){var e=b(t),i="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,s=RegExp("^\\d{"+("y"===t?i:1)+","+i+"}"),n=o.substring(r).match(s);if(!n)throw"Missing number at position "+r;return r+=n[0].length,parseInt(n[0],10)},w=function(t,e,i){var s=-1,n=P.map(b(t)?i:e,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(P.each(n,function(t,e){var i=e[1];return o.substr(r,i.length).toLowerCase()===i.toLowerCase()?(s=e[0],r+=i.length,!1):void 0}),-1!==s)return s+1;throw"Unknown name at position "+r},x=function(){if(o.charAt(r)!==i.charAt(s))throw"Unexpected literal at position "+r;r++};for(s=0;i.length>s;s++)if(_)"'"!==i.charAt(s)||b("'")?x():_=!1;else switch(i.charAt(s)){case"d":g=y("d");break;case"D":w("D",c,u);break;case"o":v=y("o");break;case"m":m=y("m");break;case"M":m=w("M",d,p);break;case"y":f=y("y");break;case"@":f=(a=new Date(y("@"))).getFullYear(),m=a.getMonth()+1,g=a.getDate();break;case"!":f=(a=new Date((y("!")-this._ticksTo1970)/1e4)).getFullYear(),m=a.getMonth()+1,g=a.getDate();break;case"'":b("'")?x():_=!0;break;default:x()}if(o.length>r&&(n=o.substr(r),!/^\s+/.test(n)))throw"Extra/unparsed characters found in date: "+n;if(-1===f?f=(new Date).getFullYear():f<100&&(f+=(new Date).getFullYear()-(new Date).getFullYear()%100+(f<=l?0:-100)),-1s+1&&i.charAt(s+1)===t;return e&&s++,e},l=function(t,e,i){var s=""+e;if(h(t))for(;i>s.length;)s="0"+s;return s},c=function(t,e,i,s){return h(t)?s[e]:i[e]},u="",d=!1;if(t)for(s=0;i.length>s;s++)if(d)"'"!==i.charAt(s)||h("'")?u+=i.charAt(s):d=!1;else switch(i.charAt(s)){case"d":u+=l("d",t.getDate(),2);break;case"D":u+=c("D",t.getDay(),n,o);break;case"o":u+=l("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=l("m",t.getMonth()+1,2);break;case"M":u+=c("M",t.getMonth(),a,r);break;case"y":u+=h("y")?t.getFullYear():(t.getYear()%100<10?"0":"")+t.getYear()%100;break;case"@":u+=t.getTime();break;case"!":u+=1e4*t.getTime()+this._ticksTo1970;break;case"'":h("'")?u+="'":d=!0;break;default:u+=i.charAt(s)}return u},_possibleChars:function(i){var s,t="",e=!1,n=function(t){var e=i.length>s+1&&i.charAt(s+1)===t;return e&&s++,e};for(s=0;i.length>s;s++)if(e)"'"!==i.charAt(s)||n("'")?t+=i.charAt(s):e=!1;else switch(i.charAt(s)){case"d":case"m":case"y":case"@":t+="0123456789";break;case"D":case"M":return null;case"'":n("'")?t+="'":e=!0;break;default:t+=i.charAt(s)}return t},_get:function(t,e){return void 0!==t.settings[e]?t.settings[e]:this._defaults[e]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(t){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(r,t,e){var i,s,n=null==t||""===t?e:"string"==typeof t?function(t){try{return P.datepicker.parseDate(P.datepicker._get(r,"dateFormat"),t,P.datepicker._getFormatConfig(r))}catch(t){}for(var e=(t.toLowerCase().match(/^c/)?P.datepicker._getDate(r):null)||new Date,i=e.getFullYear(),s=e.getMonth(),n=e.getDate(),o=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,a=o.exec(t);a;){switch(a[2]||"d"){case"d":case"D":n+=parseInt(a[1],10);break;case"w":case"W":n+=7*parseInt(a[1],10);break;case"m":case"M":s+=parseInt(a[1],10),n=Math.min(n,P.datepicker._getDaysInMonth(i,s));break;case"y":case"Y":i+=parseInt(a[1],10),n=Math.min(n,P.datepicker._getDaysInMonth(i,s))}a=o.exec(t)}return new Date(i,s,n)}(t):"number"==typeof t?isNaN(t)?e:(i=t,(s=new Date).setDate(s.getDate()+i),s):new Date(t.getTime());return(n=n&&"Invalid Date"==""+n?e:n)&&(n.setHours(0),n.setMinutes(0),n.setSeconds(0),n.setMilliseconds(0)),this._daylightSavingAdjust(n)},_daylightSavingAdjust:function(t){return t?(t.setHours(12e;)--Z<0&&(Z=11,tt--);for(t.drawMonth=Z,t.drawYear=tt,i=this._get(t,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(tt,Z-X,1)),this._getFormatConfig(t)):i,s=this._canAdjustMonth(t,-1,tt,Z)?""+i+"":q?"":""+i+"",n=this._get(t,"nextText"),n=K?this.formatDate(n,this._daylightSavingAdjust(new Date(tt,Z+X,1)),this._getFormatConfig(t)):n,o=this._canAdjustMonth(t,1,tt,Z)?""+n+"":q?"":""+n+"",a=this._get(t,"currentText"),r=this._get(t,"gotoCurrent")&&t.currentDay?G:Y,a=K?this.formatDate(a,r,this._getFormatConfig(t)):a,h=t.inline?"":"",l=j?"
    "+(B?h:"")+(this._isInRange(t,r)?"":"")+(B?"":h)+"
    ":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),m=this._get(t,"monthNamesShort"),g=this._get(t,"beforeShowDay"),v=this._get(t,"showOtherMonths"),_=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),y="",x=0;U[0]>x;x++){for(k="",this.maxRows=4,C=0;U[1]>C;C++){if(D=this._daylightSavingAdjust(new Date(tt,Z,t.selectedDay)),I=" ui-corner-all",T="",$){if(T+="
    "}for(T+="
    "+(/all|left/.test(I)&&0===x?B?o:s:"")+(/all|right/.test(I)&&0===x?B?s:o:"")+this._generateMonthYearHeader(t,Z,tt,Q,J,0",P=u?"":"",w=0;w<7;w++)P+="";for(T+=P+"",S=this._getDaysInMonth(tt,Z),tt===t.selectedYear&&Z===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,S)),z=(this._getFirstDayOfMonth(tt,Z)-c+7)%7,H=Math.ceil((z+S)/7),A=$&&this.maxRows>H?this.maxRows:H,this.maxRows=A,N=this._daylightSavingAdjust(new Date(tt,Z,1-z)),E=0;E",W=u?"":"",w=0;w<7;w++)O=g?g.apply(t.input?t.input[0]:null,[N]):[!0,""],R=(F=N.getMonth()!==Z)&&!_||!O[0]||Q&&N"+(F&&!v?" ":R?""+N.getDate()+"":""+N.getDate()+"")+"",N.setDate(N.getDate()+1),N=this._daylightSavingAdjust(N);T+=W+""}11<++Z&&(Z=0,tt++),k+=T+="
    "+this._get(t,"weekHeader")+""+p[M]+"
    "+this._get(t,"calculateWeek")(N)+"
    "+($?"
    "+(0
    ":""):"")}y+=k}return y+=l,t._keyEvent=!1,y},_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var h,l,c,u,d,p,f,m,g=this._get(t,"changeMonth"),v=this._get(t,"changeYear"),_=this._get(t,"showMonthAfterYear"),b="
    ",y="";if(o||!g)y+=""+a[e]+"";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,y+=""}if(_||(b+=y+(!o&&g&&v?"":" ")),!t.yearshtml)if(t.yearshtml="",o||!v)b+=""+i+"";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),f=(p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(e)?d:e})(u[0]),m=Math.max(f,p(u[1]||"")),f=s?Math.max(f,s.getFullYear()):f,m=n?Math.min(m,n.getFullYear()):m,t.yearshtml+="",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),_&&(b+=(!o&&g&&v?"":" ")+y),b+"
    "},_adjustInstDate:function(t,e,i){var s=t.drawYear+("Y"===i?e:0),n=t.drawMonth+("M"===i?e:0),o=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),a=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,o)));t.selectedDay=a.getDate(),t.drawMonth=t.selectedMonth=a.getMonth(),t.drawYear=t.selectedYear=a.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=i&&e=n.getTime())&&(!o||e.getTime()<=o.getTime())&&(!a||e.getFullYear()>=a)&&(!r||r>=e.getFullYear())},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return{shortYearCutoff:e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var n=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),n,this._getFormatConfig(t))}}),P.fn.datepicker=function(t){if(!this.length)return this;P.datepicker.initialized||(P(document).mousedown(P.datepicker._checkExternalClick),P.datepicker.initialized=!0),0===P("#"+P.datepicker._mainDivId).length&&P("body").append(P.datepicker.dpDiv);var e=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]?P.datepicker["_"+t+"Datepicker"].apply(P.datepicker,[this[0]].concat(e)):this.each(function(){"string"==typeof t?P.datepicker["_"+t+"Datepicker"].apply(P.datepicker,[this].concat(e)):P.datepicker._attachDatepicker(this,t)}):P.datepicker["_"+t+"Datepicker"].apply(P.datepicker,[this[0]].concat(e))},P.datepicker=new t,P.datepicker.initialized=!1,P.datepicker.uuid=(new Date).getTime(),P.datepicker.version="1.11.4",P.datepicker,P.widget("ui.dialog",{version:"1.11.4",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 e=P(this).css(t).offset().top;e<0&&P(this).css("top",t.top-e)}},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},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_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&&P.fn.draggable&&this._makeDraggable(),this.options.resizable&&P.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?P(t):this.document.find(t||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._untrackInstance(),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),(t=e.parent.children().eq(e.index)).length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog},disable:P.noop,enable:P.noop,close:function(t){var e,i=this;if(this._isOpen&&!1!==this._trigger("beforeClose",t)){if(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),!this.opener.filter(":focusable").focus().length)try{(e=this.document[0].activeElement)&&"body"!==e.nodeName.toLowerCase()&&P(e).blur()}catch(t){}this._hide(this.uiDialog,this.options.hide,function(){i._trigger("close",t)})}},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,e){var i=!1,s=this.uiDialog.siblings(".ui-front:visible").map(function(){return+P(this).css("z-index")}).get(),n=Math.max.apply(null,s);return n>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",n+1),i=!0),i&&!e&&this._trigger("focus",t),i},open:function(){var t=this;return this._isOpen?void(this._moveToTop()&&this._focusTabbable()):(this._isOpen=!0,this.opener=P(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._makeFocusTarget(),void this._trigger("open"))},_focusTabbable:function(){var t=this._focusedElement;t||(t=this.element.find("[autofocus]")),t.length||(t=this.element.find(":tabbable")),t.length||(t=this.uiDialogButtonPane.find(":tabbable")),t.length||(t=this.uiDialogTitlebarClose.filter(":tabbable")),t.length||(t=this.uiDialog),t.eq(0).focus()},_keepFocus:function(t){function e(){var t=this.document[0].activeElement;this.uiDialog[0]===t||P.contains(this.uiDialog[0],t)||this._focusTabbable()}t.preventDefault(),e.call(this),this._delay(e)},_createWrapper:function(){this.uiDialog=P("
    ").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===P.ui.keyCode.ESCAPE)return t.preventDefault(),void this.close(t);if(t.keyCode===P.ui.keyCode.TAB&&!t.isDefaultPrevented()){var e=this.uiDialog.find(":tabbable"),i=e.filter(":first"),s=e.filter(":last");t.target!==s[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==i[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){s.focus()}),t.preventDefault()):(this._delay(function(){i.focus()}),t.preventDefault())}},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=P("
    ").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){P(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=P("").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(t){t.preventDefault(),this.close(t)}}),t=P("").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(t){this.options.title||t.html(" "),t.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=P("
    ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=P("
    ").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var n=this,t=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),P.isEmptyObject(t)||P.isArray(t)&&!t.length?void this.uiDialog.removeClass("ui-dialog-buttons"):(P.each(t,function(t,e){var i,s;e=P.isFunction(e)?{click:e,text:t}:e,e=P.extend({type:"button"},e),i=e.click,e.click=function(){i.apply(n.element[0],arguments)},s={icons:e.icons,text:e.showText},delete e.icons,delete e.showText,P("",e).button(s).appendTo(n.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),void this.uiDialogButtonPane.appendTo(this.uiDialog))},_makeDraggable:function(){function n(t){return{position:t.position,offset:t.offset}}var o=this,a=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(t,e){P(this).addClass("ui-dialog-dragging"),o._blockFrames(),o._trigger("dragStart",t,n(e))},drag:function(t,e){o._trigger("drag",t,n(e))},stop:function(t,e){var i=e.offset.left-o.document.scrollLeft(),s=e.offset.top-o.document.scrollTop();a.position={my:"left top",at:"left"+(0<=i?"+":"")+i+" top"+(0<=s?"+":"")+s,of:o.window},P(this).removeClass("ui-dialog-dragging"),o._unblockFrames(),o._trigger("dragStop",t,n(e))}})},_makeResizable:function(){function o(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}}var a=this,r=this.options,t=r.resizable,e=this.uiDialog.css("position"),i="string"==typeof t?t:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:r.maxWidth,maxHeight:r.maxHeight,minWidth:r.minWidth,minHeight:this._minHeight(),handles:i,start:function(t,e){P(this).addClass("ui-dialog-resizing"),a._blockFrames(),a._trigger("resizeStart",t,o(e))},resize:function(t,e){a._trigger("resize",t,o(e))},stop:function(t,e){var i=a.uiDialog.offset(),s=i.left-a.document.scrollLeft(),n=i.top-a.document.scrollTop();r.height=a.uiDialog.height(),r.width=a.uiDialog.width(),r.position={my:"left top",at:"left"+(0<=s?"+":"")+s+" top"+(0<=n?"+":"")+n,of:a.window},P(this).removeClass("ui-dialog-resizing"),a._unblockFrames(),a._trigger("resizeStop",t,o(e))}}).css("position",e)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._makeFocusTarget(),this._focusedElement=P(t.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var t=this._trackingInstances(),e=P.inArray(this,t);-1!==e&&t.splice(e,1)},_trackingInstances:function(){var t=this.document.data("ui-dialog-instances");return t||(t=[],this.document.data("ui-dialog-instances",t)),t},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(t){var i=this,s=!1,n={};P.each(t,function(t,e){i._setOption(t,e),t in i.sizeRelatedOptions&&(s=!0),t in i.resizableRelatedOptions&&(n[t]=e)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(t,e){var i,s,n=this.uiDialog;"dialogClass"===t&&n.removeClass(this.options.dialogClass).addClass(e),"disabled"!==t&&(this._super(t,e),"appendTo"===t&&this.uiDialog.appendTo(this._appendTo()),"buttons"===t&&this._createButtons(),"closeText"===t&&this.uiDialogTitlebarClose.button({label:""+e}),"draggable"===t&&((i=n.is(":data(ui-draggable)"))&&!e&&n.draggable("destroy"),!i&&e&&this._makeDraggable()),"position"===t&&this._position(),"resizable"===t&&((s=n.is(":data(ui-resizable)"))&&!e&&n.resizable("destroy"),s&&"string"==typeof e&&n.resizable("option","handles",e),s||!1===e||this._makeResizable()),"title"===t&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),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=P(this);return P("
    ").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!!P(t.target).closest(".ui-dialog").length||!!P(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var e=!0;this._delay(function(){e=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(t){e||this._allowInteraction(t)||(t.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=P("
    ").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var t=this.document.data("ui-dialog-overlays")-1;t?this.document.data("ui-dialog-overlays",t):this.document.unbind("focusin").removeData("ui-dialog-overlays"),this.overlay.remove(),this.overlay=null}}}),P.widget("ui.progressbar",{version:"1.11.4",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=P("
    ").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(t){return void 0===t?this.options.value:(this.options.value=this._constrainedValue(t),void this._refreshValue())},_constrainedValue:function(t){return void 0===t&&(t=this.options.value),this.indeterminate=!1===t,"number"!=typeof t&&(t=0),!this.indeterminate&&Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),"disabled"===t&&this.element.toggleClass("ui-state-disabled",!!e).attr("aria-disabled",e),this._super(t,e)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,e=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(e.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=P("
    ").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")}}),P.widget("ui.selectmenu",{version:"1.11.4",defaultElement:"