]> source.dussan.org Git - gitea.git/commitdiff
Move index.js to web_src and use webpack to pack them (#8598)
authorLunny Xiao <xiaolunwen@gmail.com>
Wed, 13 Nov 2019 14:52:13 +0000 (22:52 +0800)
committerAntoine GIRARD <sapk@users.noreply.github.com>
Wed, 13 Nov 2019 14:52:13 +0000 (15:52 +0100)
* Move index.js to web_src and use webpack

* Fix initHeatMap

* update eslint and move webpack to devDependencies

* update index.js

* add eslint env node

12 files changed:
.eslintrc
Makefile
package-lock.json
package.json
public/js/index.js
public/js/index.js.map [new file with mode: 0644]
templates/base/footer.tmpl
templates/repo/diff/comment_form.tmpl
templates/repo/issue/view_content/sidebar.tmpl
templates/user/auth/signin_inner.tmpl
web_src/js/index.js [new file with mode: 0644]
webpack.config.js [new file with mode: 0644]

index c7013f278540a8765072f765660865db7505bd4d..fa2c16614f1d278fa3912bf606cf482e85a74377 100644 (file)
--- a/.eslintrc
+++ b/.eslintrc
@@ -10,6 +10,7 @@ env:
   browser: true
   jquery: true
   es6: true
+  node: true
 
 globals:
   Clipboard: false
index 69eb088ba778236213511ea1bfeffe03423b97ec..a87de5b6f9a0e111ccc15d425aa8c548e2f90cd4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -434,7 +434,8 @@ npm-update: npm-check
 
 .PHONY: js
 js: npm
-       npx eslint public/js
+       npx eslint web_src/js webpack.config.js
+       npx webpack
 
 .PHONY: css
 css: npm
index d2aa604203f20a52a26a30d7e26f6c7878a419ee..f5a95b5752e4cc67724f63d4b70dde2f97aabe79 100644 (file)
         "@types/unist": "*"
       }
     },
+    "@webassemblyjs/ast": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.8.5.tgz",
+      "integrity": "sha512-aJMfngIZ65+t71C3y2nBBg5FFG0Okt9m0XEgWZ7Ywgn1oMAT8cNwx00Uv1cQyHtidq0Xn94R4TAywO+LCQ+ZAQ==",
+      "requires": {
+        "@webassemblyjs/helper-module-context": "1.8.5",
+        "@webassemblyjs/helper-wasm-bytecode": "1.8.5",
+        "@webassemblyjs/wast-parser": "1.8.5"
+      }
+    },
+    "@webassemblyjs/floating-point-hex-parser": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.8.5.tgz",
+      "integrity": "sha512-9p+79WHru1oqBh9ewP9zW95E3XAo+90oth7S5Re3eQnECGq59ly1Ri5tsIipKGpiStHsUYmY3zMLqtk3gTcOtQ=="
+    },
+    "@webassemblyjs/helper-api-error": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.8.5.tgz",
+      "integrity": "sha512-Za/tnzsvnqdaSPOUXHyKJ2XI7PDX64kWtURyGiJJZKVEdFOsdKUCPTNEVFZq3zJ2R0G5wc2PZ5gvdTRFgm81zA=="
+    },
+    "@webassemblyjs/helper-buffer": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.8.5.tgz",
+      "integrity": "sha512-Ri2R8nOS0U6G49Q86goFIPNgjyl6+oE1abW1pS84BuhP1Qcr5JqMwRFT3Ah3ADDDYGEgGs1iyb1DGX+kAi/c/Q=="
+    },
+    "@webassemblyjs/helper-code-frame": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.8.5.tgz",
+      "integrity": "sha512-VQAadSubZIhNpH46IR3yWO4kZZjMxN1opDrzePLdVKAZ+DFjkGD/rf4v1jap744uPVU6yjL/smZbRIIJTOUnKQ==",
+      "requires": {
+        "@webassemblyjs/wast-printer": "1.8.5"
+      }
+    },
+    "@webassemblyjs/helper-fsm": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.8.5.tgz",
+      "integrity": "sha512-kRuX/saORcg8se/ft6Q2UbRpZwP4y7YrWsLXPbbmtepKr22i8Z4O3V5QE9DbZK908dh5Xya4Un57SDIKwB9eow=="
+    },
+    "@webassemblyjs/helper-module-context": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.8.5.tgz",
+      "integrity": "sha512-/O1B236mN7UNEU4t9X7Pj38i4VoU8CcMHyy3l2cV/kIF4U5KoHXDVqcDuOs1ltkac90IM4vZdHc52t1x8Yfs3g==",
+      "requires": {
+        "@webassemblyjs/ast": "1.8.5",
+        "mamacro": "^0.0.3"
+      }
+    },
+    "@webassemblyjs/helper-wasm-bytecode": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.8.5.tgz",
+      "integrity": "sha512-Cu4YMYG3Ddl72CbmpjU/wbP6SACcOPVbHN1dI4VJNJVgFwaKf1ppeFJrwydOG3NDHxVGuCfPlLZNyEdIYlQ6QQ=="
+    },
+    "@webassemblyjs/helper-wasm-section": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.8.5.tgz",
+      "integrity": "sha512-VV083zwR+VTrIWWtgIUpqfvVdK4ff38loRmrdDBgBT8ADXYsEZ5mPQ4Nde90N3UYatHdYoDIFb7oHzMncI02tA==",
+      "requires": {
+        "@webassemblyjs/ast": "1.8.5",
+        "@webassemblyjs/helper-buffer": "1.8.5",
+        "@webassemblyjs/helper-wasm-bytecode": "1.8.5",
+        "@webassemblyjs/wasm-gen": "1.8.5"
+      }
+    },
+    "@webassemblyjs/ieee754": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.8.5.tgz",
+      "integrity": "sha512-aaCvQYrvKbY/n6wKHb/ylAJr27GglahUO89CcGXMItrOBqRarUMxWLJgxm9PJNuKULwN5n1csT9bYoMeZOGF3g==",
+      "requires": {
+        "@xtuc/ieee754": "^1.2.0"
+      }
+    },
+    "@webassemblyjs/leb128": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.8.5.tgz",
+      "integrity": "sha512-plYUuUwleLIziknvlP8VpTgO4kqNaH57Y3JnNa6DLpu/sGcP6hbVdfdX5aHAV716pQBKrfuU26BJK29qY37J7A==",
+      "requires": {
+        "@xtuc/long": "4.2.2"
+      }
+    },
+    "@webassemblyjs/utf8": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.8.5.tgz",
+      "integrity": "sha512-U7zgftmQriw37tfD934UNInokz6yTmn29inT2cAetAsaU9YeVCveWEwhKL1Mg4yS7q//NGdzy79nlXh3bT8Kjw=="
+    },
+    "@webassemblyjs/wasm-edit": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.8.5.tgz",
+      "integrity": "sha512-A41EMy8MWw5yvqj7MQzkDjU29K7UJq1VrX2vWLzfpRHt3ISftOXqrtojn7nlPsZ9Ijhp5NwuODuycSvfAO/26Q==",
+      "requires": {
+        "@webassemblyjs/ast": "1.8.5",
+        "@webassemblyjs/helper-buffer": "1.8.5",
+        "@webassemblyjs/helper-wasm-bytecode": "1.8.5",
+        "@webassemblyjs/helper-wasm-section": "1.8.5",
+        "@webassemblyjs/wasm-gen": "1.8.5",
+        "@webassemblyjs/wasm-opt": "1.8.5",
+        "@webassemblyjs/wasm-parser": "1.8.5",
+        "@webassemblyjs/wast-printer": "1.8.5"
+      }
+    },
+    "@webassemblyjs/wasm-gen": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.8.5.tgz",
+      "integrity": "sha512-BCZBT0LURC0CXDzj5FXSc2FPTsxwp3nWcqXQdOZE4U7h7i8FqtFK5Egia6f9raQLpEKT1VL7zr4r3+QX6zArWg==",
+      "requires": {
+        "@webassemblyjs/ast": "1.8.5",
+        "@webassemblyjs/helper-wasm-bytecode": "1.8.5",
+        "@webassemblyjs/ieee754": "1.8.5",
+        "@webassemblyjs/leb128": "1.8.5",
+        "@webassemblyjs/utf8": "1.8.5"
+      }
+    },
+    "@webassemblyjs/wasm-opt": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.8.5.tgz",
+      "integrity": "sha512-HKo2mO/Uh9A6ojzu7cjslGaHaUU14LdLbGEKqTR7PBKwT6LdPtLLh9fPY33rmr5wcOMrsWDbbdCHq4hQUdd37Q==",
+      "requires": {
+        "@webassemblyjs/ast": "1.8.5",
+        "@webassemblyjs/helper-buffer": "1.8.5",
+        "@webassemblyjs/wasm-gen": "1.8.5",
+        "@webassemblyjs/wasm-parser": "1.8.5"
+      }
+    },
+    "@webassemblyjs/wasm-parser": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.8.5.tgz",
+      "integrity": "sha512-pi0SYE9T6tfcMkthwcgCpL0cM9nRYr6/6fjgDtL6q/ZqKHdMWvxitRi5JcZ7RI4SNJJYnYNaWy5UUrHQy998lw==",
+      "requires": {
+        "@webassemblyjs/ast": "1.8.5",
+        "@webassemblyjs/helper-api-error": "1.8.5",
+        "@webassemblyjs/helper-wasm-bytecode": "1.8.5",
+        "@webassemblyjs/ieee754": "1.8.5",
+        "@webassemblyjs/leb128": "1.8.5",
+        "@webassemblyjs/utf8": "1.8.5"
+      }
+    },
+    "@webassemblyjs/wast-parser": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.8.5.tgz",
+      "integrity": "sha512-daXC1FyKWHF1i11obK086QRlsMsY4+tIOKgBqI1lxAnkp9xe9YMcgOxm9kLe+ttjs5aWV2KKE1TWJCN57/Btsg==",
+      "requires": {
+        "@webassemblyjs/ast": "1.8.5",
+        "@webassemblyjs/floating-point-hex-parser": "1.8.5",
+        "@webassemblyjs/helper-api-error": "1.8.5",
+        "@webassemblyjs/helper-code-frame": "1.8.5",
+        "@webassemblyjs/helper-fsm": "1.8.5",
+        "@xtuc/long": "4.2.2"
+      }
+    },
+    "@webassemblyjs/wast-printer": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.8.5.tgz",
+      "integrity": "sha512-w0U0pD4EhlnvRyeJzBqaVSJAo9w/ce7/WPogeXLzGkO6hzhr4GnQIZ4W4uUt5b9ooAaXPtnXlj0gzsXEOUNYMg==",
+      "requires": {
+        "@webassemblyjs/ast": "1.8.5",
+        "@webassemblyjs/wast-parser": "1.8.5",
+        "@xtuc/long": "4.2.2"
+      }
+    },
+    "@xtuc/ieee754": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
+      "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA=="
+    },
+    "@xtuc/long": {
+      "version": "4.2.2",
+      "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz",
+      "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ=="
+    },
     "acorn": {
       "version": "7.0.0",
       "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.0.0.tgz",
       "version": "6.10.2",
       "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz",
       "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==",
-      "dev": true,
       "requires": {
         "fast-deep-equal": "^2.0.1",
         "fast-json-stable-stringify": "^2.0.0",
         "uri-js": "^4.2.2"
       }
     },
+    "ajv-errors": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz",
+      "integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ=="
+    },
+    "ajv-keywords": {
+      "version": "3.4.1",
+      "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.4.1.tgz",
+      "integrity": "sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ=="
+    },
     "amdefine": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz",
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz",
       "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==",
-      "dev": true,
       "requires": {
         "micromatch": "^3.1.4",
         "normalize-path": "^2.1.1"
           "version": "2.1.1",
           "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz",
           "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=",
-          "dev": true,
           "requires": {
             "remove-trailing-separator": "^1.0.1"
           }
     "aproba": {
       "version": "1.2.0",
       "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
-      "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==",
-      "dev": true
+      "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw=="
     },
     "argparse": {
       "version": "1.0.10",
     "arr-diff": {
       "version": "4.0.0",
       "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",
-      "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=",
-      "dev": true
+      "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA="
     },
     "arr-flatten": {
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz",
-      "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==",
-      "dev": true
+      "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg=="
     },
     "arr-union": {
       "version": "3.1.0",
       "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz",
-      "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=",
-      "dev": true
+      "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ="
     },
     "array-find-index": {
       "version": "1.0.2",
     "array-unique": {
       "version": "0.3.2",
       "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz",
-      "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=",
-      "dev": true
+      "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg="
     },
     "arrify": {
       "version": "1.0.1",
         "safer-buffer": "~2.1.0"
       }
     },
+    "asn1.js": {
+      "version": "4.10.1",
+      "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz",
+      "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==",
+      "requires": {
+        "bn.js": "^4.0.0",
+        "inherits": "^2.0.1",
+        "minimalistic-assert": "^1.0.0"
+      }
+    },
+    "assert": {
+      "version": "1.5.0",
+      "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz",
+      "integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==",
+      "requires": {
+        "object-assign": "^4.1.1",
+        "util": "0.10.3"
+      },
+      "dependencies": {
+        "inherits": {
+          "version": "2.0.1",
+          "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
+          "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE="
+        },
+        "util": {
+          "version": "0.10.3",
+          "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz",
+          "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=",
+          "requires": {
+            "inherits": "2.0.1"
+          }
+        }
+      }
+    },
     "assert-plus": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
     "assign-symbols": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz",
-      "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=",
-      "dev": true
+      "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c="
     },
     "astral-regex": {
       "version": "1.0.0",
     "async-each": {
       "version": "1.0.3",
       "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz",
-      "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==",
-      "dev": true
+      "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ=="
     },
     "asynckit": {
       "version": "0.4.0",
     "atob": {
       "version": "2.1.2",
       "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
-      "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
-      "dev": true
+      "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg=="
     },
     "autoprefixer": {
       "version": "9.6.1",
     "balanced-match": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
-      "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
-      "dev": true
+      "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
     },
     "base": {
       "version": "0.11.2",
       "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz",
       "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==",
-      "dev": true,
       "requires": {
         "cache-base": "^1.0.1",
         "class-utils": "^0.3.5",
           "version": "1.0.0",
           "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
           "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
-          "dev": true,
           "requires": {
             "is-descriptor": "^1.0.0"
           }
           "version": "1.0.0",
           "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
           "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
-          "dev": true,
           "requires": {
             "kind-of": "^6.0.0"
           }
           "version": "1.0.0",
           "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
           "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
-          "dev": true,
           "requires": {
             "kind-of": "^6.0.0"
           }
           "version": "1.0.2",
           "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
           "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
-          "dev": true,
           "requires": {
             "is-accessor-descriptor": "^1.0.0",
             "is-data-descriptor": "^1.0.0",
         }
       }
     },
+    "base64-js": {
+      "version": "1.3.1",
+      "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
+      "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g=="
+    },
     "bcrypt-pbkdf": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
         "tweetnacl": "^0.14.3"
       }
     },
+    "big.js": {
+      "version": "5.2.2",
+      "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
+      "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ=="
+    },
     "binary-extensions": {
       "version": "1.13.1",
       "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz",
-      "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==",
-      "dev": true
+      "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw=="
     },
     "bluebird": {
       "version": "3.5.5",
       "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.5.tgz",
-      "integrity": "sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w==",
-      "dev": true
+      "integrity": "sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w=="
+    },
+    "bn.js": {
+      "version": "4.11.8",
+      "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz",
+      "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA=="
     },
     "brace-expansion": {
       "version": "1.1.11",
       "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
       "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
-      "dev": true,
       "requires": {
         "balanced-match": "^1.0.0",
         "concat-map": "0.0.1"
       "version": "2.3.2",
       "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz",
       "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
-      "dev": true,
       "requires": {
         "arr-flatten": "^1.1.0",
         "array-unique": "^0.3.2",
           "version": "2.0.1",
           "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
           "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
-          "dev": true,
           "requires": {
             "is-extendable": "^0.1.0"
           }
         }
       }
     },
+    "brorand": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz",
+      "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8="
+    },
+    "browserify-aes": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
+      "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==",
+      "requires": {
+        "buffer-xor": "^1.0.3",
+        "cipher-base": "^1.0.0",
+        "create-hash": "^1.1.0",
+        "evp_bytestokey": "^1.0.3",
+        "inherits": "^2.0.1",
+        "safe-buffer": "^5.0.1"
+      }
+    },
+    "browserify-cipher": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz",
+      "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==",
+      "requires": {
+        "browserify-aes": "^1.0.4",
+        "browserify-des": "^1.0.0",
+        "evp_bytestokey": "^1.0.0"
+      }
+    },
+    "browserify-des": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz",
+      "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==",
+      "requires": {
+        "cipher-base": "^1.0.1",
+        "des.js": "^1.0.0",
+        "inherits": "^2.0.1",
+        "safe-buffer": "^5.1.2"
+      }
+    },
+    "browserify-rsa": {
+      "version": "4.0.1",
+      "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz",
+      "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=",
+      "requires": {
+        "bn.js": "^4.1.0",
+        "randombytes": "^2.0.1"
+      }
+    },
+    "browserify-sign": {
+      "version": "4.0.4",
+      "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz",
+      "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=",
+      "requires": {
+        "bn.js": "^4.1.1",
+        "browserify-rsa": "^4.0.0",
+        "create-hash": "^1.1.0",
+        "create-hmac": "^1.1.2",
+        "elliptic": "^6.0.0",
+        "inherits": "^2.0.1",
+        "parse-asn1": "^5.0.0"
+      }
+    },
+    "browserify-zlib": {
+      "version": "0.2.0",
+      "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz",
+      "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==",
+      "requires": {
+        "pako": "~1.0.5"
+      }
+    },
     "browserslist": {
       "version": "4.7.0",
       "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.7.0.tgz",
         "node-releases": "^1.1.29"
       }
     },
+    "buffer": {
+      "version": "4.9.2",
+      "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz",
+      "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==",
+      "requires": {
+        "base64-js": "^1.0.2",
+        "ieee754": "^1.1.4",
+        "isarray": "^1.0.0"
+      }
+    },
     "buffer-from": {
       "version": "1.1.1",
       "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
-      "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
-      "dev": true
+      "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A=="
+    },
+    "buffer-xor": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz",
+      "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk="
+    },
+    "builtin-status-codes": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz",
+      "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug="
     },
     "cacache": {
       "version": "12.0.3",
       "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.3.tgz",
       "integrity": "sha512-kqdmfXEGFepesTuROHMs3MpFLWrPkSSpRqOw80RCflZXy/khxaArvFrQ7uJxSUduzAufc6G0g1VUCOZXxWavPw==",
-      "dev": true,
       "requires": {
         "bluebird": "^3.5.5",
         "chownr": "^1.1.1",
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz",
       "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==",
-      "dev": true,
       "requires": {
         "collection-visit": "^1.0.0",
         "component-emitter": "^1.2.1",
       "version": "2.1.8",
       "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
       "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==",
-      "dev": true,
       "requires": {
         "anymatch": "^2.0.0",
         "async-each": "^1.0.1",
           "version": "3.1.0",
           "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz",
           "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=",
-          "dev": true,
           "requires": {
             "is-glob": "^3.1.0",
             "path-dirname": "^1.0.0"
               "version": "3.1.0",
               "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz",
               "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=",
-              "dev": true,
               "requires": {
                 "is-extglob": "^2.1.0"
               }
     "chownr": {
       "version": "1.1.2",
       "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.2.tgz",
-      "integrity": "sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A==",
-      "dev": true
+      "integrity": "sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A=="
+    },
+    "chrome-trace-event": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz",
+      "integrity": "sha512-9e/zx1jw7B4CO+c/RXoCsfg/x1AfUBioy4owYH0bJprEYAx5hRFLRhWBqHAG57D0ZM4H7vxbP7bPe0VwhQRYDQ==",
+      "requires": {
+        "tslib": "^1.9.0"
+      }
+    },
+    "cipher-base": {
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz",
+      "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==",
+      "requires": {
+        "inherits": "^2.0.1",
+        "safe-buffer": "^5.0.1"
+      }
     },
     "class-utils": {
       "version": "0.3.6",
       "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz",
       "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==",
-      "dev": true,
       "requires": {
         "arr-union": "^3.1.0",
         "define-property": "^0.2.5",
           "version": "0.2.5",
           "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
           "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
-          "dev": true,
           "requires": {
             "is-descriptor": "^0.1.0"
           }
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz",
       "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=",
-      "dev": true,
       "requires": {
         "map-visit": "^1.0.0",
         "object-visit": "^1.0.0"
         "graceful-readlink": ">= 1.0.0"
       }
     },
+    "commondir": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
+      "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs="
+    },
     "component-emitter": {
       "version": "1.3.0",
       "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
-      "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==",
-      "dev": true
+      "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg=="
     },
     "concat-map": {
       "version": "0.0.1",
       "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
-      "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
-      "dev": true
+      "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
     },
     "concat-stream": {
       "version": "1.6.2",
       "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
       "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
-      "dev": true,
       "requires": {
         "buffer-from": "^1.0.0",
         "inherits": "^2.0.3",
         "typedarray": "^0.0.6"
       }
     },
+    "console-browserify": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz",
+      "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA=="
+    },
+    "constants-browserify": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz",
+      "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U="
+    },
     "convert-source-map": {
       "version": "1.6.0",
       "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz",
       "version": "1.0.5",
       "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz",
       "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==",
-      "dev": true,
       "requires": {
         "aproba": "^1.1.1",
         "fs-write-stream-atomic": "^1.0.8",
     "copy-descriptor": {
       "version": "0.1.1",
       "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz",
-      "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=",
-      "dev": true
+      "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40="
     },
     "core-util-is": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
-      "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
-      "dev": true
+      "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
     },
     "cosmiconfig": {
       "version": "5.2.1",
         }
       }
     },
+    "create-ecdh": {
+      "version": "4.0.3",
+      "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz",
+      "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==",
+      "requires": {
+        "bn.js": "^4.1.0",
+        "elliptic": "^6.0.0"
+      }
+    },
+    "create-hash": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
+      "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==",
+      "requires": {
+        "cipher-base": "^1.0.1",
+        "inherits": "^2.0.1",
+        "md5.js": "^1.3.4",
+        "ripemd160": "^2.0.1",
+        "sha.js": "^2.4.0"
+      }
+    },
+    "create-hmac": {
+      "version": "1.1.7",
+      "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
+      "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==",
+      "requires": {
+        "cipher-base": "^1.0.3",
+        "create-hash": "^1.1.0",
+        "inherits": "^2.0.1",
+        "ripemd160": "^2.0.0",
+        "safe-buffer": "^5.0.1",
+        "sha.js": "^2.4.8"
+      }
+    },
     "cross-spawn": {
       "version": "6.0.5",
       "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
         "which": "^1.2.9"
       }
     },
+    "crypto-browserify": {
+      "version": "3.12.0",
+      "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz",
+      "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==",
+      "requires": {
+        "browserify-cipher": "^1.0.0",
+        "browserify-sign": "^4.0.0",
+        "create-ecdh": "^4.0.0",
+        "create-hash": "^1.1.0",
+        "create-hmac": "^1.1.0",
+        "diffie-hellman": "^5.0.0",
+        "inherits": "^2.0.1",
+        "pbkdf2": "^3.0.3",
+        "public-encrypt": "^4.0.0",
+        "randombytes": "^2.0.0",
+        "randomfill": "^1.0.3"
+      }
+    },
     "currently-unhandled": {
       "version": "0.4.1",
       "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz",
     "cyclist": {
       "version": "0.2.2",
       "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-0.2.2.tgz",
-      "integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=",
-      "dev": true
+      "integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA="
     },
     "dashdash": {
       "version": "1.14.1",
     "decode-uri-component": {
       "version": "0.2.0",
       "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
-      "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=",
-      "dev": true
+      "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU="
     },
     "deep-extend": {
       "version": "0.6.0",
       "version": "2.0.2",
       "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz",
       "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==",
-      "dev": true,
       "requires": {
         "is-descriptor": "^1.0.2",
         "isobject": "^3.0.1"
           "version": "1.0.0",
           "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
           "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
-          "dev": true,
           "requires": {
             "kind-of": "^6.0.0"
           }
           "version": "1.0.0",
           "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
           "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
-          "dev": true,
           "requires": {
             "kind-of": "^6.0.0"
           }
           "version": "1.0.2",
           "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
           "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
-          "dev": true,
           "requires": {
             "is-accessor-descriptor": "^1.0.0",
             "is-data-descriptor": "^1.0.0",
       "integrity": "sha512-DCvzSq2UiMsuLnj/9AL484ummEgLtZIcRS7YvtO38QnpX3vqh9nJ8P+zhu8Ja+SmLrBHO2iDbva20jq38qvBkQ==",
       "dev": true
     },
+    "des.js": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz",
+      "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=",
+      "requires": {
+        "inherits": "^2.0.1",
+        "minimalistic-assert": "^1.0.0"
+      }
+    },
+    "detect-file": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz",
+      "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=",
+      "dev": true
+    },
+    "diffie-hellman": {
+      "version": "5.0.3",
+      "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz",
+      "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==",
+      "requires": {
+        "bn.js": "^4.1.0",
+        "miller-rabin": "^4.0.0",
+        "randombytes": "^2.0.0"
+      }
+    },
     "dir-glob": {
       "version": "2.2.2",
       "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.2.2.tgz",
         }
       }
     },
+    "domain-browser": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz",
+      "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA=="
+    },
     "domelementtype": {
       "version": "1.3.1",
       "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz",
       "version": "3.7.1",
       "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz",
       "integrity": "sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g==",
-      "dev": true,
       "requires": {
         "end-of-stream": "^1.0.0",
         "inherits": "^2.0.1",
       "integrity": "sha512-BSNKVkF67cfgwCOJD3/eyIFi001+8mRoazPJYZRpxxtabToCDCef1vhZMDjA6CPfAdgOI0QMOiGLELgJVYP76Q==",
       "dev": true
     },
+    "elliptic": {
+      "version": "6.5.1",
+      "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.1.tgz",
+      "integrity": "sha512-xvJINNLbTeWQjrl6X+7eQCrIy/YPv5XCpKW6kB5mKvtnGILoLDcySuwomfdzt0BMdLNVnuRNTuzKNHj0bva1Cg==",
+      "requires": {
+        "bn.js": "^4.4.0",
+        "brorand": "^1.0.1",
+        "hash.js": "^1.0.0",
+        "hmac-drbg": "^1.0.0",
+        "inherits": "^2.0.1",
+        "minimalistic-assert": "^1.0.0",
+        "minimalistic-crypto-utils": "^1.0.0"
+      }
+    },
     "emoji-regex": {
       "version": "7.0.3",
       "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
       "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
       "dev": true
     },
+    "emojis-list": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz",
+      "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k="
+    },
     "encoding": {
       "version": "0.1.12",
       "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz",
       "version": "1.4.1",
       "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz",
       "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==",
-      "dev": true,
       "requires": {
         "once": "^1.4.0"
       }
     },
+    "enhanced-resolve": {
+      "version": "4.1.0",
+      "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz",
+      "integrity": "sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==",
+      "requires": {
+        "graceful-fs": "^4.1.2",
+        "memory-fs": "^0.4.0",
+        "tapable": "^1.0.0"
+      }
+    },
     "entities": {
       "version": "1.1.2",
       "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
       "version": "0.1.7",
       "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz",
       "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==",
-      "dev": true,
-      "optional": true,
       "requires": {
         "prr": "~1.0.1"
       }
       "version": "4.2.1",
       "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz",
       "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==",
-      "dev": true,
       "requires": {
         "estraverse": "^4.1.0"
       }
     "estraverse": {
       "version": "4.3.0",
       "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
-      "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
-      "dev": true
+      "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw=="
     },
     "esutils": {
       "version": "2.0.3",
       "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
       "dev": true
     },
+    "events": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/events/-/events-3.0.0.tgz",
+      "integrity": "sha512-Dc381HFWJzEOhQ+d8pkNon++bk9h6cdAoAj4iE6Q4y6xgTzySWXlKn05/TVNpjnfRqi/X0EpJEJohPjNI3zpVA=="
+    },
+    "evp_bytestokey": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz",
+      "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==",
+      "requires": {
+        "md5.js": "^1.3.4",
+        "safe-buffer": "^5.1.1"
+      }
+    },
     "execa": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
       "version": "2.1.4",
       "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz",
       "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=",
-      "dev": true,
       "requires": {
         "debug": "^2.3.3",
         "define-property": "^0.2.5",
           "version": "2.6.9",
           "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
           "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
-          "dev": true,
           "requires": {
             "ms": "2.0.0"
           }
           "version": "0.2.5",
           "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
           "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
-          "dev": true,
           "requires": {
             "is-descriptor": "^0.1.0"
           }
           "version": "2.0.1",
           "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
           "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
-          "dev": true,
           "requires": {
             "is-extendable": "^0.1.0"
           }
         "ms": {
           "version": "2.0.0",
           "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
-          "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
-          "dev": true
+          "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
         }
       }
     },
+    "expand-tilde": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz",
+      "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=",
+      "dev": true,
+      "requires": {
+        "homedir-polyfill": "^1.0.1"
+      }
+    },
     "extend": {
       "version": "3.0.2",
       "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
       "version": "3.0.2",
       "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz",
       "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=",
-      "dev": true,
       "requires": {
         "assign-symbols": "^1.0.0",
         "is-extendable": "^1.0.1"
           "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
           "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==",
-          "dev": true,
           "requires": {
             "is-plain-object": "^2.0.4"
           }
       "version": "2.0.4",
       "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz",
       "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==",
-      "dev": true,
       "requires": {
         "array-unique": "^0.3.2",
         "define-property": "^1.0.0",
           "version": "1.0.0",
           "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
           "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
-          "dev": true,
           "requires": {
             "is-descriptor": "^1.0.0"
           }
           "version": "2.0.1",
           "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
           "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
-          "dev": true,
           "requires": {
             "is-extendable": "^0.1.0"
           }
           "version": "1.0.0",
           "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
           "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
-          "dev": true,
           "requires": {
             "kind-of": "^6.0.0"
           }
           "version": "1.0.0",
           "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
           "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
-          "dev": true,
           "requires": {
             "kind-of": "^6.0.0"
           }
           "version": "1.0.2",
           "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
           "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
-          "dev": true,
           "requires": {
             "is-accessor-descriptor": "^1.0.0",
             "is-data-descriptor": "^1.0.0",
     "fast-deep-equal": {
       "version": "2.0.1",
       "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
-      "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=",
-      "dev": true
+      "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk="
     },
     "fast-glob": {
       "version": "2.2.7",
     "fast-json-stable-stringify": {
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
-      "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=",
-      "dev": true
+      "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I="
     },
     "fast-levenshtein": {
       "version": "2.0.6",
     "figgy-pudding": {
       "version": "3.5.1",
       "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.1.tgz",
-      "integrity": "sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w==",
-      "dev": true
+      "integrity": "sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w=="
     },
     "figures": {
       "version": "2.0.0",
       "version": "4.0.0",
       "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
       "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=",
-      "dev": true,
       "requires": {
         "extend-shallow": "^2.0.1",
         "is-number": "^3.0.0",
           "version": "2.0.1",
           "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
           "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
-          "dev": true,
           "requires": {
             "is-extendable": "^0.1.0"
           }
         }
       }
     },
+    "find-cache-dir": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz",
+      "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==",
+      "requires": {
+        "commondir": "^1.0.1",
+        "make-dir": "^2.0.0",
+        "pkg-dir": "^3.0.0"
+      }
+    },
     "find-up": {
       "version": "3.0.0",
       "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
       "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
-      "dev": true,
       "requires": {
         "locate-path": "^3.0.0"
       }
     },
+    "findup-sync": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-3.0.0.tgz",
+      "integrity": "sha512-YbffarhcicEhOrm4CtrwdKBdCuz576RLdhJDsIfvNtxUuhdRet1qZcsMjqbePtAseKdAnDyM/IyXbu7PRPRLYg==",
+      "dev": true,
+      "requires": {
+        "detect-file": "^1.0.0",
+        "is-glob": "^4.0.0",
+        "micromatch": "^3.0.4",
+        "resolve-dir": "^1.0.1"
+      }
+    },
     "flat-cache": {
       "version": "2.0.1",
       "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz",
       "version": "1.1.1",
       "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz",
       "integrity": "sha512-3Z4XhFZ3992uIq0XOqb9AreonueSYphE6oYbpt5+3u06JWklbsPkNv3ZKkP9Bz/r+1MWCaMoSQ28P85+1Yc77w==",
-      "dev": true,
       "requires": {
         "inherits": "^2.0.3",
         "readable-stream": "^2.3.6"
     "for-in": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
-      "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=",
-      "dev": true
+      "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA="
     },
     "forever-agent": {
       "version": "0.6.1",
       "version": "0.2.1",
       "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz",
       "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=",
-      "dev": true,
       "requires": {
         "map-cache": "^0.2.2"
       }
       "version": "2.3.0",
       "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz",
       "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=",
-      "dev": true,
       "requires": {
         "inherits": "^2.0.1",
         "readable-stream": "^2.0.0"
       "version": "1.0.10",
       "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz",
       "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=",
-      "dev": true,
       "requires": {
         "graceful-fs": "^4.1.2",
         "iferr": "^0.1.5",
     "fs.realpath": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
-      "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
-      "dev": true
+      "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
     },
     "fsevents": {
       "version": "1.2.9",
       "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.9.tgz",
       "integrity": "sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw==",
-      "dev": true,
       "optional": true,
       "requires": {
         "nan": "^2.12.1",
         "abbrev": {
           "version": "1.1.1",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "ansi-regex": {
           "version": "2.1.1",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "aproba": {
           "version": "1.2.0",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "are-we-there-yet": {
           "version": "1.1.5",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "delegates": "^1.0.0",
         "balanced-match": {
           "version": "1.0.0",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "brace-expansion": {
           "version": "1.1.11",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "balanced-match": "^1.0.0",
         "chownr": {
           "version": "1.1.1",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "code-point-at": {
           "version": "1.1.0",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "concat-map": {
           "version": "0.0.1",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "console-control-strings": {
           "version": "1.1.0",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "core-util-is": {
           "version": "1.0.2",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "debug": {
           "version": "4.1.1",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "ms": "^2.1.1"
         "deep-extend": {
           "version": "0.6.0",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "delegates": {
           "version": "1.0.0",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "detect-libc": {
           "version": "1.0.3",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "fs-minipass": {
           "version": "1.2.5",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "minipass": "^2.2.1"
         "fs.realpath": {
           "version": "1.0.0",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "gauge": {
           "version": "2.7.4",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "aproba": "^1.0.3",
         "glob": {
           "version": "7.1.3",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "fs.realpath": "^1.0.0",
         "has-unicode": {
           "version": "2.0.1",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "iconv-lite": {
           "version": "0.4.24",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "safer-buffer": ">= 2.1.2 < 3"
         "ignore-walk": {
           "version": "3.0.1",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "minimatch": "^3.0.4"
         "inflight": {
           "version": "1.0.6",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "once": "^1.3.0",
         "inherits": {
           "version": "2.0.3",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "ini": {
           "version": "1.3.5",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "is-fullwidth-code-point": {
           "version": "1.0.0",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "number-is-nan": "^1.0.0"
         "isarray": {
           "version": "1.0.0",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "minimatch": {
           "version": "3.0.4",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "brace-expansion": "^1.1.7"
         "minimist": {
           "version": "0.0.8",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "minipass": {
           "version": "2.3.5",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "safe-buffer": "^5.1.2",
         "minizlib": {
           "version": "1.2.1",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "minipass": "^2.2.1"
         "mkdirp": {
           "version": "0.5.1",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "minimist": "0.0.8"
         "ms": {
           "version": "2.1.1",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "needle": {
           "version": "2.3.0",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "debug": "^4.1.0",
         "node-pre-gyp": {
           "version": "0.12.0",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "detect-libc": "^1.0.2",
         "nopt": {
           "version": "4.0.1",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "abbrev": "1",
         "npm-bundled": {
           "version": "1.0.6",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "npm-packlist": {
           "version": "1.4.1",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "ignore-walk": "^3.0.1",
         "npmlog": {
           "version": "4.1.2",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "are-we-there-yet": "~1.1.2",
         "number-is-nan": {
           "version": "1.0.1",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "object-assign": {
           "version": "4.1.1",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "once": {
           "version": "1.4.0",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "wrappy": "1"
         "os-homedir": {
           "version": "1.0.2",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "os-tmpdir": {
           "version": "1.0.2",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "osenv": {
           "version": "0.1.5",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "os-homedir": "^1.0.0",
         "path-is-absolute": {
           "version": "1.0.1",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "process-nextick-args": {
           "version": "2.0.0",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "rc": {
           "version": "1.2.8",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "deep-extend": "^0.6.0",
             "minimist": {
               "version": "1.2.0",
               "bundled": true,
-              "dev": true,
               "optional": true
             }
           }
         "readable-stream": {
           "version": "2.3.6",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "core-util-is": "~1.0.0",
         "rimraf": {
           "version": "2.6.3",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "glob": "^7.1.3"
         "safe-buffer": {
           "version": "5.1.2",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "safer-buffer": {
           "version": "2.1.2",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "sax": {
           "version": "1.2.4",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "semver": {
           "version": "5.7.0",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "set-blocking": {
           "version": "2.0.0",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "signal-exit": {
           "version": "3.0.2",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "string-width": {
           "version": "1.0.2",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "code-point-at": "^1.0.0",
         "string_decoder": {
           "version": "1.1.1",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "safe-buffer": "~5.1.0"
         "strip-ansi": {
           "version": "3.0.1",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "ansi-regex": "^2.0.0"
         "strip-json-comments": {
           "version": "2.0.1",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "tar": {
           "version": "4.4.8",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "chownr": "^1.1.1",
         "util-deprecate": {
           "version": "1.0.2",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "wide-align": {
           "version": "1.1.3",
           "bundled": true,
-          "dev": true,
           "optional": true,
           "requires": {
             "string-width": "^1.0.2 || 2"
         "wrappy": {
           "version": "1.0.2",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "yallist": {
           "version": "3.0.3",
           "bundled": true,
-          "dev": true,
           "optional": true
         }
       }
     "get-value": {
       "version": "2.0.6",
       "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz",
-      "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=",
-      "dev": true
+      "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg="
     },
     "getpass": {
       "version": "0.1.7",
       "version": "7.1.4",
       "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz",
       "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==",
-      "dev": true,
       "requires": {
         "fs.realpath": "^1.0.0",
         "inflight": "^1.0.4",
     "graceful-fs": {
       "version": "4.2.2",
       "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.2.tgz",
-      "integrity": "sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==",
-      "dev": true
+      "integrity": "sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q=="
     },
     "graceful-readlink": {
       "version": "1.0.1",
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz",
       "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=",
-      "dev": true,
       "requires": {
         "get-value": "^2.0.6",
         "has-values": "^1.0.0",
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz",
       "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=",
-      "dev": true,
       "requires": {
         "is-number": "^3.0.0",
         "kind-of": "^4.0.0"
           "version": "4.0.0",
           "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz",
           "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=",
-          "dev": true,
           "requires": {
             "is-buffer": "^1.1.5"
           }
         }
       }
     },
+    "hash-base": {
+      "version": "3.0.4",
+      "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz",
+      "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=",
+      "requires": {
+        "inherits": "^2.0.1",
+        "safe-buffer": "^5.0.1"
+      }
+    },
+    "hash.js": {
+      "version": "1.1.7",
+      "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz",
+      "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==",
+      "requires": {
+        "inherits": "^2.0.3",
+        "minimalistic-assert": "^1.0.1"
+      }
+    },
+    "hmac-drbg": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
+      "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=",
+      "requires": {
+        "hash.js": "^1.0.3",
+        "minimalistic-assert": "^1.0.0",
+        "minimalistic-crypto-utils": "^1.0.1"
+      }
+    },
+    "homedir-polyfill": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz",
+      "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==",
+      "dev": true,
+      "requires": {
+        "parse-passwd": "^1.0.0"
+      }
+    },
     "hosted-git-info": {
       "version": "2.8.4",
       "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.4.tgz",
         "sshpk": "^1.7.0"
       }
     },
+    "https-browserify": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz",
+      "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM="
+    },
     "https-proxy-agent": {
       "version": "2.2.2",
       "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz",
         "safer-buffer": ">= 2.1.2 < 3"
       }
     },
+    "ieee754": {
+      "version": "1.1.13",
+      "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz",
+      "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg=="
+    },
     "iferr": {
       "version": "0.1.5",
       "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz",
-      "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=",
-      "dev": true
+      "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE="
     },
     "ignore": {
       "version": "4.0.6",
       "integrity": "sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==",
       "dev": true
     },
+    "import-local": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz",
+      "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==",
+      "dev": true,
+      "requires": {
+        "pkg-dir": "^3.0.0",
+        "resolve-cwd": "^2.0.0"
+      }
+    },
     "imurmurhash": {
       "version": "0.1.4",
       "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
-      "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
-      "dev": true
+      "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o="
     },
     "indent-string": {
       "version": "3.2.0",
     "infer-owner": {
       "version": "1.0.4",
       "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz",
-      "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==",
-      "dev": true
+      "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A=="
     },
     "inflight": {
       "version": "1.0.6",
       "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
       "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
-      "dev": true,
       "requires": {
         "once": "^1.3.0",
         "wrappy": "1"
     "inherits": {
       "version": "2.0.4",
       "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
-      "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
-      "dev": true
+      "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
     },
     "ini": {
       "version": "1.3.5",
         "through": "^2.3.6"
       }
     },
+    "interpret": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz",
+      "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==",
+      "dev": true
+    },
     "invert-kv": {
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz",
       "version": "0.1.6",
       "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz",
       "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=",
-      "dev": true,
       "requires": {
         "kind-of": "^3.0.2"
       },
           "version": "3.2.2",
           "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
           "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
-          "dev": true,
           "requires": {
             "is-buffer": "^1.1.5"
           }
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz",
       "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=",
-      "dev": true,
       "requires": {
         "binary-extensions": "^1.0.0"
       }
     "is-buffer": {
       "version": "1.1.6",
       "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
-      "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
-      "dev": true
+      "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
     },
     "is-data-descriptor": {
       "version": "0.1.4",
       "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz",
       "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=",
-      "dev": true,
       "requires": {
         "kind-of": "^3.0.2"
       },
           "version": "3.2.2",
           "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
           "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
-          "dev": true,
           "requires": {
             "is-buffer": "^1.1.5"
           }
       "version": "0.1.6",
       "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
       "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==",
-      "dev": true,
       "requires": {
         "is-accessor-descriptor": "^0.1.6",
         "is-data-descriptor": "^0.1.4",
         "kind-of": {
           "version": "5.1.0",
           "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
-          "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
-          "dev": true
+          "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw=="
         }
       }
     },
     "is-extendable": {
       "version": "0.1.1",
       "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
-      "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=",
-      "dev": true
+      "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik="
     },
     "is-extglob": {
       "version": "2.1.1",
       "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
-      "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
-      "dev": true
+      "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI="
     },
     "is-fullwidth-code-point": {
       "version": "2.0.0",
       "version": "4.0.1",
       "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
       "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
-      "dev": true,
       "requires": {
         "is-extglob": "^2.1.1"
       }
       "version": "3.0.0",
       "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
       "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
-      "dev": true,
       "requires": {
         "kind-of": "^3.0.2"
       },
           "version": "3.2.2",
           "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
           "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
-          "dev": true,
           "requires": {
             "is-buffer": "^1.1.5"
           }
       "version": "2.0.4",
       "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
       "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
-      "dev": true,
       "requires": {
         "isobject": "^3.0.1"
       }
     "is-windows": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz",
-      "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==",
-      "dev": true
+      "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA=="
     },
     "is-word-character": {
       "version": "1.0.3",
       "integrity": "sha512-0wfcrFgOOOBdgRNT9H33xe6Zi6yhX/uoc4U8NBZGeQQB0ctU1dnlNTyL9JM2646bHDTpsDm1Brb3VPoCIMrd/A==",
       "dev": true
     },
+    "is-wsl": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz",
+      "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0="
+    },
     "isarray": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
-      "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
-      "dev": true
+      "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
     },
     "isexe": {
       "version": "2.0.0",
     "isobject": {
       "version": "3.0.1",
       "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
-      "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
-      "dev": true
+      "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8="
     },
     "isstream": {
       "version": "0.1.2",
     "json-parse-better-errors": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
-      "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
-      "dev": true
+      "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw=="
     },
     "json-schema": {
       "version": "0.2.3",
     "json-schema-traverse": {
       "version": "0.4.1",
       "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
-      "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
-      "dev": true
+      "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
     },
     "json-stable-stringify-without-jsonify": {
       "version": "1.0.1",
     "kind-of": {
       "version": "6.0.2",
       "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
-      "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",
-      "dev": true
+      "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA=="
     },
     "known-css-properties": {
       "version": "0.14.0",
         }
       }
     },
+    "loader-runner": {
+      "version": "2.4.0",
+      "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.4.0.tgz",
+      "integrity": "sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw=="
+    },
+    "loader-utils": {
+      "version": "1.2.3",
+      "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.2.3.tgz",
+      "integrity": "sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA==",
+      "requires": {
+        "big.js": "^5.2.2",
+        "emojis-list": "^2.0.0",
+        "json5": "^1.0.1"
+      },
+      "dependencies": {
+        "json5": {
+          "version": "1.0.1",
+          "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
+          "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
+          "requires": {
+            "minimist": "^1.2.0"
+          }
+        },
+        "minimist": {
+          "version": "1.2.0",
+          "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+          "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
+        }
+      }
+    },
     "locate-path": {
       "version": "3.0.0",
       "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
       "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
-      "dev": true,
       "requires": {
         "p-locate": "^3.0.0",
         "path-exists": "^3.0.0"
       "version": "5.1.1",
       "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
       "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
-      "dev": true,
       "requires": {
         "yallist": "^3.0.2"
       }
     },
+    "make-dir": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz",
+      "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==",
+      "requires": {
+        "pify": "^4.0.1",
+        "semver": "^5.6.0"
+      }
+    },
     "make-fetch-happen": {
       "version": "5.0.0",
       "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-5.0.0.tgz",
         "ssri": "^6.0.0"
       }
     },
+    "mamacro": {
+      "version": "0.0.3",
+      "resolved": "https://registry.npmjs.org/mamacro/-/mamacro-0.0.3.tgz",
+      "integrity": "sha512-qMEwh+UujcQ+kbz3T6V+wAmO2U8veoq2w+3wY8MquqwVA3jChfwY+Tk52GZKDfACEPjuZ7r2oJLejwpt8jtwTA=="
+    },
     "map-age-cleaner": {
       "version": "0.1.3",
       "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz",
     "map-cache": {
       "version": "0.2.2",
       "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz",
-      "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=",
-      "dev": true
+      "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8="
     },
     "map-obj": {
       "version": "2.0.0",
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz",
       "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=",
-      "dev": true,
       "requires": {
         "object-visit": "^1.0.0"
       }
       "integrity": "sha512-pWB896KPGSGkp1XtyzRBftpTzwSOL0Gfk0wLvxt4f2mgzjY19o0LxJ3U25vNWTzsh7da+KTbuXQoQ3lOJZ8WHw==",
       "dev": true
     },
+    "md5.js": {
+      "version": "1.3.5",
+      "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz",
+      "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==",
+      "requires": {
+        "hash-base": "^3.0.0",
+        "inherits": "^2.0.1",
+        "safe-buffer": "^5.1.2"
+      }
+    },
     "mdast-util-compact": {
       "version": "1.0.3",
       "resolved": "https://registry.npmjs.org/mdast-util-compact/-/mdast-util-compact-1.0.3.tgz",
         }
       }
     },
+    "memory-fs": {
+      "version": "0.4.1",
+      "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz",
+      "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=",
+      "requires": {
+        "errno": "^0.1.3",
+        "readable-stream": "^2.0.1"
+      }
+    },
     "meow": {
       "version": "5.0.0",
       "resolved": "https://registry.npmjs.org/meow/-/meow-5.0.0.tgz",
       "version": "3.1.10",
       "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
       "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==",
-      "dev": true,
       "requires": {
         "arr-diff": "^4.0.0",
         "array-unique": "^0.3.2",
         "to-regex": "^3.0.2"
       }
     },
+    "miller-rabin": {
+      "version": "4.0.1",
+      "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz",
+      "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==",
+      "requires": {
+        "bn.js": "^4.0.0",
+        "brorand": "^1.0.1"
+      }
+    },
     "mime": {
       "version": "1.6.0",
       "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
       "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==",
       "dev": true
     },
+    "minimalistic-assert": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
+      "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A=="
+    },
+    "minimalistic-crypto-utils": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz",
+      "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo="
+    },
     "minimatch": {
       "version": "3.0.4",
       "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
       "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
-      "dev": true,
       "requires": {
         "brace-expansion": "^1.1.7"
       }
     "minimist": {
       "version": "0.0.8",
       "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
-      "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
-      "dev": true
+      "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
     },
     "minimist-options": {
       "version": "3.0.2",
       "version": "3.0.0",
       "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-3.0.0.tgz",
       "integrity": "sha512-x471SsVjUtBRtcvd4BzKE9kFC+/2TeWgKCgw0bZcw1b9l2X3QX5vCWgF+KaZaYm87Ss//rHnWryupDrgLvmSkA==",
-      "dev": true,
       "requires": {
         "concat-stream": "^1.5.0",
         "duplexify": "^3.4.2",
       "version": "1.3.2",
       "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
       "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==",
-      "dev": true,
       "requires": {
         "for-in": "^1.0.2",
         "is-extendable": "^1.0.1"
           "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
           "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==",
-          "dev": true,
           "requires": {
             "is-plain-object": "^2.0.4"
           }
       "version": "0.5.1",
       "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
       "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
-      "dev": true,
       "requires": {
         "minimist": "0.0.8"
       }
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
       "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=",
-      "dev": true,
       "requires": {
         "aproba": "^1.1.1",
         "copy-concurrently": "^1.0.0",
       "version": "2.14.0",
       "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
       "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==",
-      "dev": true,
       "optional": true
     },
     "nanomatch": {
       "version": "1.2.13",
       "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz",
       "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==",
-      "dev": true,
       "requires": {
         "arr-diff": "^4.0.0",
         "array-unique": "^0.3.2",
       "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
       "dev": true
     },
+    "neo-async": {
+      "version": "2.6.1",
+      "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz",
+      "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw=="
+    },
     "nice-try": {
       "version": "1.0.5",
       "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
         "safe-buffer": "^5.1.1"
       }
     },
+    "node-libs-browser": {
+      "version": "2.2.1",
+      "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.2.1.tgz",
+      "integrity": "sha512-h/zcD8H9kaDZ9ALUWwlBUDo6TKF8a7qBSCSEGfjTVIYeqsioSKaAX+BN7NgiMGp6iSIXZ3PxgCu8KS3b71YK5Q==",
+      "requires": {
+        "assert": "^1.1.1",
+        "browserify-zlib": "^0.2.0",
+        "buffer": "^4.3.0",
+        "console-browserify": "^1.1.0",
+        "constants-browserify": "^1.0.0",
+        "crypto-browserify": "^3.11.0",
+        "domain-browser": "^1.1.1",
+        "events": "^3.0.0",
+        "https-browserify": "^1.0.0",
+        "os-browserify": "^0.3.0",
+        "path-browserify": "0.0.1",
+        "process": "^0.11.10",
+        "punycode": "^1.2.4",
+        "querystring-es3": "^0.2.0",
+        "readable-stream": "^2.3.3",
+        "stream-browserify": "^2.0.1",
+        "stream-http": "^2.7.2",
+        "string_decoder": "^1.0.0",
+        "timers-browserify": "^2.0.4",
+        "tty-browserify": "0.0.0",
+        "url": "^0.11.0",
+        "util": "^0.11.0",
+        "vm-browserify": "^1.0.1"
+      },
+      "dependencies": {
+        "punycode": {
+          "version": "1.4.1",
+          "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
+          "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4="
+        }
+      }
+    },
     "node-releases": {
       "version": "1.1.29",
       "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.29.tgz",
     "normalize-path": {
       "version": "3.0.0",
       "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
-      "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
-      "dev": true
+      "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="
     },
     "normalize-range": {
       "version": "0.1.2",
       "dev": true,
       "optional": true
     },
+    "object-assign": {
+      "version": "4.1.1",
+      "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+      "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
+    },
     "object-copy": {
       "version": "0.1.0",
       "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz",
       "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=",
-      "dev": true,
       "requires": {
         "copy-descriptor": "^0.1.0",
         "define-property": "^0.2.5",
           "version": "0.2.5",
           "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
           "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
-          "dev": true,
           "requires": {
             "is-descriptor": "^0.1.0"
           }
           "version": "3.2.2",
           "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
           "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
-          "dev": true,
           "requires": {
             "is-buffer": "^1.1.5"
           }
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz",
       "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=",
-      "dev": true,
       "requires": {
         "isobject": "^3.0.0"
       }
       "version": "1.3.0",
       "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz",
       "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=",
-      "dev": true,
       "requires": {
         "isobject": "^3.0.1"
       }
       "version": "1.4.0",
       "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
       "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
-      "dev": true,
       "requires": {
         "wrappy": "1"
       }
         "wordwrap": "~1.0.0"
       }
     },
+    "os-browserify": {
+      "version": "0.3.0",
+      "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz",
+      "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc="
+    },
     "os-locale": {
       "version": "3.1.0",
       "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz",
       "version": "2.2.1",
       "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz",
       "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==",
-      "dev": true,
       "requires": {
         "p-try": "^2.0.0"
       }
       "version": "3.0.0",
       "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
       "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
-      "dev": true,
       "requires": {
         "p-limit": "^2.0.0"
       }
     "p-try": {
       "version": "2.2.0",
       "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
-      "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
-      "dev": true
+      "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
+    },
+    "pako": {
+      "version": "1.0.10",
+      "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.10.tgz",
+      "integrity": "sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw=="
     },
     "parallel-transform": {
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.1.0.tgz",
       "integrity": "sha1-1BDwZbBdojCB/NEPKIVMKb2jOwY=",
-      "dev": true,
       "requires": {
         "cyclist": "~0.2.2",
         "inherits": "^2.0.3",
         "callsites": "^3.0.0"
       }
     },
+    "parse-asn1": {
+      "version": "5.1.5",
+      "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.5.tgz",
+      "integrity": "sha512-jkMYn1dcJqF6d5CpU689bq7w/b5ALS9ROVSpQDPrZsqqesUJii9qutvoT5ltGedNXMO2e16YUWIghG9KxaViTQ==",
+      "requires": {
+        "asn1.js": "^4.0.0",
+        "browserify-aes": "^1.0.0",
+        "create-hash": "^1.1.0",
+        "evp_bytestokey": "^1.0.0",
+        "pbkdf2": "^3.0.3",
+        "safe-buffer": "^5.1.1"
+      }
+    },
     "parse-entities": {
       "version": "1.2.2",
       "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz",
         "json-parse-better-errors": "^1.0.1"
       }
     },
+    "parse-passwd": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz",
+      "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=",
+      "dev": true
+    },
     "pascalcase": {
       "version": "0.1.1",
       "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz",
-      "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=",
-      "dev": true
+      "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ="
+    },
+    "path-browserify": {
+      "version": "0.0.1",
+      "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz",
+      "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ=="
     },
     "path-dirname": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz",
-      "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=",
-      "dev": true
+      "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA="
     },
     "path-exists": {
       "version": "3.0.0",
       "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
-      "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
-      "dev": true
+      "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU="
     },
     "path-is-absolute": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
-      "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
-      "dev": true
+      "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
     },
     "path-key": {
       "version": "2.0.1",
         }
       }
     },
+    "pbkdf2": {
+      "version": "3.0.17",
+      "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz",
+      "integrity": "sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA==",
+      "requires": {
+        "create-hash": "^1.1.2",
+        "create-hmac": "^1.1.4",
+        "ripemd160": "^2.0.1",
+        "safe-buffer": "^5.0.1",
+        "sha.js": "^2.4.8"
+      }
+    },
     "performance-now": {
       "version": "2.1.0",
       "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
     "pify": {
       "version": "4.0.1",
       "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
-      "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==",
-      "dev": true
+      "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g=="
+    },
+    "pkg-dir": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz",
+      "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==",
+      "requires": {
+        "find-up": "^3.0.0"
+      }
     },
     "posix-character-classes": {
       "version": "0.1.1",
       "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
-      "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=",
-      "dev": true
+      "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs="
     },
     "postcss": {
       "version": "7.0.17",
       "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=",
       "dev": true
     },
+    "process": {
+      "version": "0.11.10",
+      "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
+      "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI="
+    },
     "process-nextick-args": {
       "version": "2.0.1",
       "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
-      "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
-      "dev": true
+      "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
     },
     "progress": {
       "version": "2.0.3",
     "promise-inflight": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz",
-      "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=",
-      "dev": true
+      "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM="
     },
     "promise-retry": {
       "version": "1.1.1",
     "prr": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
-      "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=",
-      "dev": true,
-      "optional": true
+      "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY="
     },
     "psl": {
       "version": "1.3.0",
       "dev": true,
       "optional": true
     },
+    "public-encrypt": {
+      "version": "4.0.3",
+      "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz",
+      "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==",
+      "requires": {
+        "bn.js": "^4.1.0",
+        "browserify-rsa": "^4.0.0",
+        "create-hash": "^1.1.0",
+        "parse-asn1": "^5.0.0",
+        "randombytes": "^2.0.1",
+        "safe-buffer": "^5.1.2"
+      }
+    },
     "pump": {
       "version": "3.0.0",
       "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
       "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
-      "dev": true,
       "requires": {
         "end-of-stream": "^1.1.0",
         "once": "^1.3.1"
       "version": "1.5.1",
       "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz",
       "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==",
-      "dev": true,
       "requires": {
         "duplexify": "^3.6.0",
         "inherits": "^2.0.3",
           "version": "2.0.1",
           "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz",
           "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==",
-          "dev": true,
           "requires": {
             "end-of-stream": "^1.1.0",
             "once": "^1.3.1"
     "punycode": {
       "version": "2.1.1",
       "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
-      "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
-      "dev": true
+      "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
     },
     "qs": {
       "version": "6.5.2",
       "dev": true,
       "optional": true
     },
+    "querystring": {
+      "version": "0.2.0",
+      "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz",
+      "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA="
+    },
+    "querystring-es3": {
+      "version": "0.2.1",
+      "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz",
+      "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM="
+    },
     "quick-lru": {
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz",
       "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=",
       "dev": true
     },
+    "randombytes": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
+      "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
+      "requires": {
+        "safe-buffer": "^5.1.0"
+      }
+    },
+    "randomfill": {
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz",
+      "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==",
+      "requires": {
+        "randombytes": "^2.0.5",
+        "safe-buffer": "^5.1.0"
+      }
+    },
     "rc": {
       "version": "1.2.8",
       "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
       "version": "2.3.6",
       "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
       "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
-      "dev": true,
       "requires": {
         "core-util-is": "~1.0.0",
         "inherits": "~2.0.3",
         "safe-buffer": {
           "version": "5.1.2",
           "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
-          "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
-          "dev": true
+          "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
         }
       }
     },
       "version": "2.2.1",
       "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz",
       "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==",
-      "dev": true,
       "requires": {
         "graceful-fs": "^4.1.11",
         "micromatch": "^3.1.10",
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz",
       "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==",
-      "dev": true,
       "requires": {
         "extend-shallow": "^3.0.2",
         "safe-regex": "^1.1.0"
     "remove-trailing-separator": {
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz",
-      "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=",
-      "dev": true
+      "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8="
     },
     "repeat-element": {
       "version": "1.1.3",
       "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz",
-      "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==",
-      "dev": true
+      "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g=="
     },
     "repeat-string": {
       "version": "1.6.1",
       "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",
-      "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=",
-      "dev": true
+      "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc="
     },
     "replace-ext": {
       "version": "1.0.0",
         "path-parse": "^1.0.6"
       }
     },
+    "resolve-cwd": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz",
+      "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=",
+      "dev": true,
+      "requires": {
+        "resolve-from": "^3.0.0"
+      },
+      "dependencies": {
+        "resolve-from": {
+          "version": "3.0.0",
+          "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz",
+          "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=",
+          "dev": true
+        }
+      }
+    },
+    "resolve-dir": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz",
+      "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=",
+      "dev": true,
+      "requires": {
+        "expand-tilde": "^2.0.0",
+        "global-modules": "^1.0.0"
+      },
+      "dependencies": {
+        "global-modules": {
+          "version": "1.0.0",
+          "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz",
+          "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==",
+          "dev": true,
+          "requires": {
+            "global-prefix": "^1.0.1",
+            "is-windows": "^1.0.1",
+            "resolve-dir": "^1.0.0"
+          }
+        },
+        "global-prefix": {
+          "version": "1.0.2",
+          "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz",
+          "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=",
+          "dev": true,
+          "requires": {
+            "expand-tilde": "^2.0.2",
+            "homedir-polyfill": "^1.0.1",
+            "ini": "^1.3.4",
+            "is-windows": "^1.0.1",
+            "which": "^1.2.14"
+          }
+        }
+      }
+    },
     "resolve-from": {
       "version": "4.0.0",
       "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
     "resolve-url": {
       "version": "0.2.1",
       "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz",
-      "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=",
-      "dev": true
+      "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo="
     },
     "restore-cursor": {
       "version": "2.0.0",
     "ret": {
       "version": "0.1.15",
       "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz",
-      "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==",
-      "dev": true
+      "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg=="
     },
     "retry": {
       "version": "0.10.1",
       "version": "2.6.3",
       "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",
       "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
-      "dev": true,
       "requires": {
         "glob": "^7.1.3"
       }
     },
+    "ripemd160": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz",
+      "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==",
+      "requires": {
+        "hash-base": "^3.0.0",
+        "inherits": "^2.0.1"
+      }
+    },
     "run-async": {
       "version": "2.3.0",
       "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz",
       "version": "1.0.3",
       "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz",
       "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=",
-      "dev": true,
       "requires": {
         "aproba": "^1.1.1"
       }
     "safe-buffer": {
       "version": "5.2.0",
       "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
-      "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==",
-      "dev": true
+      "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg=="
     },
     "safe-regex": {
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
       "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=",
-      "dev": true,
       "requires": {
         "ret": "~0.1.10"
       }
       "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
       "dev": true
     },
+    "schema-utils": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz",
+      "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==",
+      "requires": {
+        "ajv": "^6.1.0",
+        "ajv-errors": "^1.0.0",
+        "ajv-keywords": "^3.1.0"
+      }
+    },
     "semver": {
       "version": "5.7.1",
       "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
-      "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
-      "dev": true
+      "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
+    },
+    "serialize-javascript": {
+      "version": "1.9.1",
+      "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.9.1.tgz",
+      "integrity": "sha512-0Vb/54WJ6k5v8sSWN09S0ora+Hnr+cX40r9F170nT+mSkaxltoE/7R3OrIdBSUv1OoiobH1QoWQbCnAO+e8J1A=="
     },
     "set-blocking": {
       "version": "2.0.0",
       "version": "2.0.1",
       "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
       "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==",
-      "dev": true,
       "requires": {
         "extend-shallow": "^2.0.1",
         "is-extendable": "^0.1.1",
           "version": "2.0.1",
           "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
           "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
-          "dev": true,
           "requires": {
             "is-extendable": "^0.1.0"
           }
         }
       }
     },
+    "setimmediate": {
+      "version": "1.0.5",
+      "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
+      "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
+    },
+    "sha.js": {
+      "version": "2.4.11",
+      "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
+      "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
+      "requires": {
+        "inherits": "^2.0.1",
+        "safe-buffer": "^5.0.1"
+      }
+    },
     "shebang-command": {
       "version": "1.2.0",
       "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
       "version": "0.8.2",
       "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
       "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==",
-      "dev": true,
       "requires": {
         "base": "^0.11.1",
         "debug": "^2.2.0",
           "version": "2.6.9",
           "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
           "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
-          "dev": true,
           "requires": {
             "ms": "2.0.0"
           }
           "version": "0.2.5",
           "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
           "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
-          "dev": true,
           "requires": {
             "is-descriptor": "^0.1.0"
           }
           "version": "2.0.1",
           "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
           "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
-          "dev": true,
           "requires": {
             "is-extendable": "^0.1.0"
           }
         "ms": {
           "version": "2.0.0",
           "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
-          "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
-          "dev": true
+          "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
         },
         "source-map": {
           "version": "0.5.7",
           "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
-          "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
-          "dev": true
+          "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w="
         }
       }
     },
       "version": "2.1.1",
       "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz",
       "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==",
-      "dev": true,
       "requires": {
         "define-property": "^1.0.0",
         "isobject": "^3.0.0",
           "version": "1.0.0",
           "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
           "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
-          "dev": true,
           "requires": {
             "is-descriptor": "^1.0.0"
           }
           "version": "1.0.0",
           "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
           "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
-          "dev": true,
           "requires": {
             "kind-of": "^6.0.0"
           }
           "version": "1.0.0",
           "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
           "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
-          "dev": true,
           "requires": {
             "kind-of": "^6.0.0"
           }
           "version": "1.0.2",
           "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
           "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
-          "dev": true,
           "requires": {
             "is-accessor-descriptor": "^1.0.0",
             "is-data-descriptor": "^1.0.0",
       "version": "3.0.1",
       "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz",
       "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==",
-      "dev": true,
       "requires": {
         "kind-of": "^3.2.0"
       },
           "version": "3.2.2",
           "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
           "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
-          "dev": true,
           "requires": {
             "is-buffer": "^1.1.5"
           }
         }
       }
     },
+    "source-list-map": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz",
+      "integrity": "sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw=="
+    },
     "source-map": {
       "version": "0.6.1",
       "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
-      "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
-      "dev": true
+      "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
     },
     "source-map-resolve": {
       "version": "0.5.2",
       "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz",
       "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==",
-      "dev": true,
       "requires": {
         "atob": "^2.1.1",
         "decode-uri-component": "^0.2.0",
         "urix": "^0.1.0"
       }
     },
+    "source-map-support": {
+      "version": "0.5.16",
+      "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz",
+      "integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==",
+      "requires": {
+        "buffer-from": "^1.0.0",
+        "source-map": "^0.6.0"
+      }
+    },
     "source-map-url": {
       "version": "0.4.0",
       "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz",
-      "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=",
-      "dev": true
+      "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM="
     },
     "spdx-correct": {
       "version": "3.1.0",
       "version": "3.1.0",
       "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
       "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==",
-      "dev": true,
       "requires": {
         "extend-shallow": "^3.0.0"
       }
       "version": "6.0.1",
       "resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz",
       "integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==",
-      "dev": true,
       "requires": {
         "figgy-pudding": "^3.5.1"
       }
       "version": "0.1.2",
       "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz",
       "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=",
-      "dev": true,
       "requires": {
         "define-property": "^0.2.5",
         "object-copy": "^0.1.0"
           "version": "0.2.5",
           "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
           "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
-          "dev": true,
           "requires": {
             "is-descriptor": "^0.1.0"
           }
         }
       }
     },
+    "stream-browserify": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz",
+      "integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==",
+      "requires": {
+        "inherits": "~2.0.1",
+        "readable-stream": "^2.0.2"
+      }
+    },
     "stream-each": {
       "version": "1.2.3",
       "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz",
       "integrity": "sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw==",
-      "dev": true,
       "requires": {
         "end-of-stream": "^1.1.0",
         "stream-shift": "^1.0.0"
       }
     },
+    "stream-http": {
+      "version": "2.8.3",
+      "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz",
+      "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==",
+      "requires": {
+        "builtin-status-codes": "^3.0.0",
+        "inherits": "^2.0.1",
+        "readable-stream": "^2.3.6",
+        "to-arraybuffer": "^1.0.0",
+        "xtend": "^4.0.0"
+      }
+    },
     "stream-shift": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz",
-      "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=",
-      "dev": true
+      "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI="
     },
     "string-width": {
       "version": "2.1.1",
       "version": "1.1.1",
       "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
       "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
-      "dev": true,
       "requires": {
         "safe-buffer": "~5.1.0"
       },
         "safe-buffer": {
           "version": "5.1.2",
           "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
-          "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
-          "dev": true
+          "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
         }
       }
     },
         }
       }
     },
+    "tapable": {
+      "version": "1.1.3",
+      "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz",
+      "integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA=="
+    },
+    "terser": {
+      "version": "4.3.10",
+      "resolved": "https://registry.npmjs.org/terser/-/terser-4.3.10.tgz",
+      "integrity": "sha512-3xXfyqHzUr8WZ+UvvwUQ/uHNgDu3FsdTTAL5p9UAWxlnAsoIMlCM3BPuFSx5Kb4/Hr+/xnMf6rt1DhRpKYohhw==",
+      "requires": {
+        "commander": "^2.20.0",
+        "source-map": "~0.6.1",
+        "source-map-support": "~0.5.12"
+      },
+      "dependencies": {
+        "commander": {
+          "version": "2.20.3",
+          "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
+          "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="
+        }
+      }
+    },
+    "terser-webpack-plugin": {
+      "version": "1.4.1",
+      "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz",
+      "integrity": "sha512-ZXmmfiwtCLfz8WKZyYUuuHf3dMYEjg8NrjHMb0JqHVHVOSkzp3cW2/XG1fP3tRhqEqSzMwzzRQGtAPbs4Cncxg==",
+      "requires": {
+        "cacache": "^12.0.2",
+        "find-cache-dir": "^2.1.0",
+        "is-wsl": "^1.1.0",
+        "schema-utils": "^1.0.0",
+        "serialize-javascript": "^1.7.0",
+        "source-map": "^0.6.1",
+        "terser": "^4.1.2",
+        "webpack-sources": "^1.4.0",
+        "worker-farm": "^1.7.0"
+      }
+    },
     "text-table": {
       "version": "0.2.0",
       "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
       "version": "2.0.5",
       "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz",
       "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==",
-      "dev": true,
       "requires": {
         "readable-stream": "~2.3.6",
         "xtend": "~4.0.1"
       }
     },
+    "timers-browserify": {
+      "version": "2.0.11",
+      "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.11.tgz",
+      "integrity": "sha512-60aV6sgJ5YEbzUdn9c8kYGIqOubPoUdqQCul3SBAsRCZ40s6Y5cMcrW4dt3/k/EsbLVJNl9n6Vz3fTc+k2GeKQ==",
+      "requires": {
+        "setimmediate": "^1.0.4"
+      }
+    },
     "tmp": {
       "version": "0.0.33",
       "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
         "os-tmpdir": "~1.0.2"
       }
     },
+    "to-arraybuffer": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz",
+      "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M="
+    },
     "to-fast-properties": {
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
       "version": "0.3.0",
       "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz",
       "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=",
-      "dev": true,
       "requires": {
         "kind-of": "^3.0.2"
       },
           "version": "3.2.2",
           "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
           "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
-          "dev": true,
           "requires": {
             "is-buffer": "^1.1.5"
           }
       "version": "3.0.2",
       "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz",
       "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==",
-      "dev": true,
       "requires": {
         "define-property": "^2.0.2",
         "extend-shallow": "^3.0.2",
       "version": "2.1.1",
       "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz",
       "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=",
-      "dev": true,
       "requires": {
         "is-number": "^3.0.0",
         "repeat-string": "^1.6.1"
     "tslib": {
       "version": "1.10.0",
       "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
-      "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
-      "dev": true
+      "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ=="
+    },
+    "tty-browserify": {
+      "version": "0.0.0",
+      "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz",
+      "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY="
     },
     "tunnel-agent": {
       "version": "0.6.0",
     "typedarray": {
       "version": "0.0.6",
       "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
-      "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
-      "dev": true
+      "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
     },
     "unherit": {
       "version": "1.1.2",
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",
       "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==",
-      "dev": true,
       "requires": {
         "arr-union": "^3.1.0",
         "get-value": "^2.0.6",
       "version": "1.1.1",
       "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz",
       "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==",
-      "dev": true,
       "requires": {
         "unique-slug": "^2.0.0"
       }
       "version": "2.0.2",
       "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz",
       "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==",
-      "dev": true,
       "requires": {
         "imurmurhash": "^0.1.4"
       }
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz",
       "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=",
-      "dev": true,
       "requires": {
         "has-value": "^0.3.1",
         "isobject": "^3.0.0"
           "version": "0.3.1",
           "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz",
           "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=",
-          "dev": true,
           "requires": {
             "get-value": "^2.0.3",
             "has-values": "^0.1.4",
               "version": "2.1.0",
               "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz",
               "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=",
-              "dev": true,
               "requires": {
                 "isarray": "1.0.0"
               }
         "has-values": {
           "version": "0.1.4",
           "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz",
-          "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=",
-          "dev": true
+          "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E="
         }
       }
     },
     "upath": {
       "version": "1.1.2",
       "resolved": "https://registry.npmjs.org/upath/-/upath-1.1.2.tgz",
-      "integrity": "sha512-kXpym8nmDmlCBr7nKdIx8P2jNBa+pBpIUFRnKJ4dr8htyYGJFokkr2ZvERRtUN+9SY+JqXouNgUPtv6JQva/2Q==",
-      "dev": true
+      "integrity": "sha512-kXpym8nmDmlCBr7nKdIx8P2jNBa+pBpIUFRnKJ4dr8htyYGJFokkr2ZvERRtUN+9SY+JqXouNgUPtv6JQva/2Q=="
     },
     "updates": {
       "version": "8.5.3",
       "version": "4.2.2",
       "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
       "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
-      "dev": true,
       "requires": {
         "punycode": "^2.1.0"
       }
     "urix": {
       "version": "0.1.0",
       "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz",
-      "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=",
-      "dev": true
+      "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI="
+    },
+    "url": {
+      "version": "0.11.0",
+      "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz",
+      "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=",
+      "requires": {
+        "punycode": "1.3.2",
+        "querystring": "0.2.0"
+      },
+      "dependencies": {
+        "punycode": {
+          "version": "1.3.2",
+          "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz",
+          "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0="
+        }
+      }
     },
     "use": {
       "version": "3.1.1",
       "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz",
-      "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==",
-      "dev": true
+      "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ=="
+    },
+    "util": {
+      "version": "0.11.1",
+      "resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz",
+      "integrity": "sha512-HShAsny+zS2TZfaXxD9tYj4HQGlBezXZMZuM/S5PKLLoZkShZiGk9o5CzukI1LVHZvjdvZ2Sj1aW/Ndn2NB/HQ==",
+      "requires": {
+        "inherits": "2.0.3"
+      },
+      "dependencies": {
+        "inherits": {
+          "version": "2.0.3",
+          "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
+          "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
+        }
+      }
     },
     "util-deprecate": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
-      "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
-      "dev": true
+      "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
     },
     "uuid": {
       "version": "3.3.3",
         "unist-util-stringify-position": "^1.1.1"
       }
     },
+    "vm-browserify": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz",
+      "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ=="
+    },
+    "watchpack": {
+      "version": "1.6.0",
+      "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz",
+      "integrity": "sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA==",
+      "requires": {
+        "chokidar": "^2.0.2",
+        "graceful-fs": "^4.1.2",
+        "neo-async": "^2.5.0"
+      }
+    },
+    "webpack": {
+      "version": "4.41.2",
+      "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.41.2.tgz",
+      "integrity": "sha512-Zhw69edTGfbz9/8JJoyRQ/pq8FYUoY0diOXqW0T6yhgdhCv6wr0hra5DwwWexNRns2Z2+gsnrNcbe9hbGBgk/A==",
+      "requires": {
+        "@webassemblyjs/ast": "1.8.5",
+        "@webassemblyjs/helper-module-context": "1.8.5",
+        "@webassemblyjs/wasm-edit": "1.8.5",
+        "@webassemblyjs/wasm-parser": "1.8.5",
+        "acorn": "^6.2.1",
+        "ajv": "^6.10.2",
+        "ajv-keywords": "^3.4.1",
+        "chrome-trace-event": "^1.0.2",
+        "enhanced-resolve": "^4.1.0",
+        "eslint-scope": "^4.0.3",
+        "json-parse-better-errors": "^1.0.2",
+        "loader-runner": "^2.4.0",
+        "loader-utils": "^1.2.3",
+        "memory-fs": "^0.4.1",
+        "micromatch": "^3.1.10",
+        "mkdirp": "^0.5.1",
+        "neo-async": "^2.6.1",
+        "node-libs-browser": "^2.2.1",
+        "schema-utils": "^1.0.0",
+        "tapable": "^1.1.3",
+        "terser-webpack-plugin": "^1.4.1",
+        "watchpack": "^1.6.0",
+        "webpack-sources": "^1.4.1"
+      },
+      "dependencies": {
+        "acorn": {
+          "version": "6.3.0",
+          "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.3.0.tgz",
+          "integrity": "sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA=="
+        },
+        "eslint-scope": {
+          "version": "4.0.3",
+          "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz",
+          "integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==",
+          "requires": {
+            "esrecurse": "^4.1.0",
+            "estraverse": "^4.1.1"
+          }
+        }
+      }
+    },
+    "webpack-cli": {
+      "version": "3.3.10",
+      "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.3.10.tgz",
+      "integrity": "sha512-u1dgND9+MXaEt74sJR4PR7qkPxXUSQ0RXYq8x1L6Jg1MYVEmGPrH6Ah6C4arD4r0J1P5HKjRqpab36k0eIzPqg==",
+      "dev": true,
+      "requires": {
+        "chalk": "2.4.2",
+        "cross-spawn": "6.0.5",
+        "enhanced-resolve": "4.1.0",
+        "findup-sync": "3.0.0",
+        "global-modules": "2.0.0",
+        "import-local": "2.0.0",
+        "interpret": "1.2.0",
+        "loader-utils": "1.2.3",
+        "supports-color": "6.1.0",
+        "v8-compile-cache": "2.0.3",
+        "yargs": "13.2.4"
+      },
+      "dependencies": {
+        "cliui": {
+          "version": "5.0.0",
+          "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
+          "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
+          "dev": true,
+          "requires": {
+            "string-width": "^3.1.0",
+            "strip-ansi": "^5.2.0",
+            "wrap-ansi": "^5.1.0"
+          }
+        },
+        "get-caller-file": {
+          "version": "2.0.5",
+          "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+          "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+          "dev": true
+        },
+        "require-main-filename": {
+          "version": "2.0.0",
+          "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
+          "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
+          "dev": true
+        },
+        "string-width": {
+          "version": "3.1.0",
+          "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
+          "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
+          "dev": true,
+          "requires": {
+            "emoji-regex": "^7.0.1",
+            "is-fullwidth-code-point": "^2.0.0",
+            "strip-ansi": "^5.1.0"
+          }
+        },
+        "supports-color": {
+          "version": "6.1.0",
+          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
+          "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
+          "dev": true,
+          "requires": {
+            "has-flag": "^3.0.0"
+          }
+        },
+        "v8-compile-cache": {
+          "version": "2.0.3",
+          "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.0.3.tgz",
+          "integrity": "sha512-CNmdbwQMBjwr9Gsmohvm0pbL954tJrNzf6gWL3K+QMQf00PF7ERGrEiLgjuU3mKreLC2MeGhUsNV9ybTbLgd3w==",
+          "dev": true
+        },
+        "wrap-ansi": {
+          "version": "5.1.0",
+          "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
+          "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
+          "dev": true,
+          "requires": {
+            "ansi-styles": "^3.2.0",
+            "string-width": "^3.0.0",
+            "strip-ansi": "^5.0.0"
+          }
+        },
+        "yargs": {
+          "version": "13.2.4",
+          "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.4.tgz",
+          "integrity": "sha512-HG/DWAJa1PAnHT9JAhNa8AbAv3FPaiLzioSjCcmuXXhP8MlpHO5vwls4g4j6n30Z74GVQj8Xa62dWVx1QCGklg==",
+          "dev": true,
+          "requires": {
+            "cliui": "^5.0.0",
+            "find-up": "^3.0.0",
+            "get-caller-file": "^2.0.1",
+            "os-locale": "^3.1.0",
+            "require-directory": "^2.1.1",
+            "require-main-filename": "^2.0.0",
+            "set-blocking": "^2.0.0",
+            "string-width": "^3.0.0",
+            "which-module": "^2.0.0",
+            "y18n": "^4.0.0",
+            "yargs-parser": "^13.1.0"
+          }
+        },
+        "yargs-parser": {
+          "version": "13.1.1",
+          "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz",
+          "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==",
+          "dev": true,
+          "requires": {
+            "camelcase": "^5.0.0",
+            "decamelize": "^1.2.0"
+          }
+        }
+      }
+    },
+    "webpack-sources": {
+      "version": "1.4.3",
+      "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz",
+      "integrity": "sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==",
+      "requires": {
+        "source-list-map": "^2.0.0",
+        "source-map": "~0.6.1"
+      }
+    },
     "which": {
       "version": "1.3.1",
       "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
       "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=",
       "dev": true
     },
+    "worker-farm": {
+      "version": "1.7.0",
+      "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz",
+      "integrity": "sha512-rvw3QTZc8lAxyVrqcSGVm5yP/IJ2UcB3U0graE3LCFoZ0Yn2x4EoVSqJKdB/T5M+FLcRPjz4TDacRf3OCfNUzw==",
+      "requires": {
+        "errno": "~0.1.7"
+      }
+    },
     "wrap-ansi": {
       "version": "2.1.0",
       "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
     "wrappy": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
-      "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
-      "dev": true
+      "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
     },
     "write": {
       "version": "1.0.3",
     "xtend": {
       "version": "4.0.2",
       "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
-      "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
-      "dev": true
+      "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
     },
     "y18n": {
       "version": "4.0.0",
       "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
-      "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==",
-      "dev": true
+      "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w=="
     },
     "yallist": {
       "version": "3.0.3",
       "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz",
-      "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==",
-      "dev": true
+      "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A=="
     },
     "yargs": {
       "version": "12.0.5",
index 376ae89b67095415e5a28783dbaa2f7ea980941c..60764c88069058611fb6b3de560ff37d8b613a54 100644 (file)
@@ -12,7 +12,9 @@
     "postcss-cli": "6.1.3",
     "stylelint": "10.1.0",
     "stylelint-config-standard": "18.3.0",
-    "updates": "8.5.3"
+    "updates": "8.5.3",
+    "webpack": "4.41.2",
+    "webpack-cli": "3.3.10"
   },
   "browserslist": [
     "> 1%",
index af314183714245e418f11b99f6c80af05ea4a3aa..34b95ac0d932ba71aaded06d863ba14250f7476b 100644 (file)
-/* globals wipPrefixes, issuesTribute, emojiTribute */
-/* exported timeAddManual, toggleStopwatch, cancelStopwatch, initHeatmap */
-/* exported toggleDeadlineForm, setDeadline, deleteDependencyModal, cancelCodeComment, onOAuthLoginClick */
-'use strict';
-
-function htmlEncode(text) {
-   return jQuery('<div />').text(text).html()
-}
-
-let csrf;
-let suburl;
-let previewFileModes;
-let simpleMDEditor;
-let codeMirrorEditor;
-
-// Disable Dropzone auto-discover because it's manually initialized
-if (typeof(Dropzone) !== "undefined") {
-    Dropzone.autoDiscover = false;
-}
-
-// Polyfill for IE9+ support (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from)
-if (!Array.from) {
-    Array.from = (function () {
-        const toStr = Object.prototype.toString;
-        const isCallable = function (fn) {
-            return typeof fn === 'function' || toStr.call(fn) === '[object Function]';
-        };
-        const toInteger = function (value) {
-            const number = Number(value);
-            if (isNaN(number)) { return 0; }
-            if (number === 0 || !isFinite(number)) { return number; }
-            return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
-        };
-        const maxSafeInteger = Math.pow(2, 53) - 1;
-        const toLength = function (value) {
-            const len = toInteger(value);
-            return Math.min(Math.max(len, 0), maxSafeInteger);
-        };
-
-        // The length property of the from method is 1.
-        return function from(arrayLike/*, mapFn, thisArg */) {
-            // 1. Let C be the this value.
-            const C = this;
-
-            // 2. Let items be ToObject(arrayLike).
-            const items = Object(arrayLike);
-
-            // 3. ReturnIfAbrupt(items).
-            if (arrayLike == null) {
-                throw new TypeError("Array.from requires an array-like object - not null or undefined");
-            }
-
-            // 4. If mapfn is undefined, then let mapping be false.
-            const mapFn = arguments.length > 1 ? arguments[1] : void undefined;
-            let T;
-            if (typeof mapFn !== 'undefined') {
-                // 5. else
-                // 5. a If IsCallable(mapfn) is false, throw a TypeError exception.
-                if (!isCallable(mapFn)) {
-                    throw new TypeError('Array.from: when provided, the second argument must be a function');
-                }
-
-                // 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.
-                if (arguments.length > 2) {
-                    T = arguments[2];
-                }
-            }
-
-            // 10. Let lenValue be Get(items, "length").
-            // 11. Let len be ToLength(lenValue).
-            const len = toLength(items.length);
-
-            // 13. If IsConstructor(C) is true, then
-            // 13. a. Let A be the result of calling the [[Construct]] internal method of C with an argument list containing the single item len.
-            // 14. a. Else, Let A be ArrayCreate(len).
-            const A = isCallable(C) ? Object(new C(len)) : new Array(len);
-
-            // 16. Let k be 0.
-            let k = 0;
-            // 17. Repeat, while k < len… (also steps a - h)
-            let kValue;
-            while (k < len) {
-                kValue = items[k];
-                if (mapFn) {
-                    A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k);
-                } else {
-                    A[k] = kValue;
-                }
-                k += 1;
-            }
-            // 18. Let putStatus be Put(A, "length", len, true).
-            A.length = len;
-            // 20. Return A.
-            return A;
-        };
-    }());
-}
-
-// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
-if (typeof Object.assign != 'function') {
-    // Must be writable: true, enumerable: false, configurable: true
-    Object.defineProperty(Object, "assign", {
-        value: function assign(target, _varArgs) { // .length of function is 2
-            'use strict';
-            if (target == null) { // TypeError if undefined or null
-                throw new TypeError('Cannot convert undefined or null to object');
-            }
-
-            const to = Object(target);
-
-            for (let index = 1; index < arguments.length; index++) {
-                const nextSource = arguments[index];
-
-                if (nextSource != null) { // Skip over if undefined or null
-                    for (const nextKey in nextSource) {
-                        // Avoid bugs when hasOwnProperty is shadowed
-                        if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
-                            to[nextKey] = nextSource[nextKey];
-                        }
-                    }
-                }
-            }
-            return to;
-        },
-        writable: true,
-        configurable: true
-    });
-}
-
-function initCommentPreviewTab($form) {
-    const $tabMenu = $form.find('.tabular.menu');
-    $tabMenu.find('.item').tab();
-    $tabMenu.find('.item[data-tab="' + $tabMenu.data('preview') + '"]').click(function () {
-        const $this = $(this);
-        $.post($this.data('url'), {
-                "_csrf": csrf,
-                "mode": "gfm",
-                "context": $this.data('context'),
-                "text": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
-            },
-            function (data) {
-                const $previewPanel = $form.find('.tab.segment[data-tab="' + $tabMenu.data('preview') + '"]');
-                $previewPanel.html(data);
-                emojify.run($previewPanel[0]);
-                $('pre code', $previewPanel[0]).each(function () {
-                    hljs.highlightBlock(this);
-                });
-            }
-        );
-    });
-
-    buttonsClickOnEnter();
-}
-
-function initEditPreviewTab($form) {
-    const $tabMenu = $form.find('.tabular.menu');
-    $tabMenu.find('.item').tab();
-    const $previewTab = $tabMenu.find('.item[data-tab="' + $tabMenu.data('preview') + '"]');
-    if ($previewTab.length) {
-        previewFileModes = $previewTab.data('preview-file-modes').split(',');
-        $previewTab.click(function () {
-            const $this = $(this);
-            $.post($this.data('url'), {
-                    "_csrf": csrf,
-                    "mode": "gfm",
-                    "context": $this.data('context'),
-                    "text": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
-                },
-                function (data) {
-                    const $previewPanel = $form.find('.tab.segment[data-tab="' + $tabMenu.data('preview') + '"]');
-                    $previewPanel.html(data);
-                    emojify.run($previewPanel[0]);
-                    $('pre code', $previewPanel[0]).each(function () {
-                        hljs.highlightBlock(this);
-                    });
-                }
-            );
-        });
-    }
-}
-
-function initEditDiffTab($form) {
-    const $tabMenu = $form.find('.tabular.menu');
-    $tabMenu.find('.item').tab();
-    $tabMenu.find('.item[data-tab="' + $tabMenu.data('diff') + '"]').click(function () {
-        const $this = $(this);
-        $.post($this.data('url'), {
-                "_csrf": csrf,
-                "context": $this.data('context'),
-                "content": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
-            },
-            function (data) {
-                const $diffPreviewPanel = $form.find('.tab.segment[data-tab="' + $tabMenu.data('diff') + '"]');
-                $diffPreviewPanel.html(data);
-                emojify.run($diffPreviewPanel[0]);
-            }
-        );
-    });
-}
-
-
-function initEditForm() {
-    if ($('.edit.form').length == 0) {
-        return;
-    }
-
-    initEditPreviewTab($('.edit.form'));
-    initEditDiffTab($('.edit.form'));
-}
-
-function initBranchSelector() {
-    const $selectBranch = $('.ui.select-branch')
-    const $branchMenu = $selectBranch.find('.reference-list-menu');
-    $branchMenu.find('.item:not(.no-select)').click(function () {
-        const selectedValue = $(this).data('id');
-        $($(this).data('id-selector')).val(selectedValue);
-        $selectBranch.find('.ui .branch-name').text(selectedValue);
-    });
-    $selectBranch.find('.reference.column').click(function () {
-        $selectBranch.find('.scrolling.reference-list-menu').css('display', 'none');
-        $selectBranch.find('.reference .text').removeClass('black');
-        $($(this).data('target')).css('display', 'block');
-        $(this).find('.text').addClass('black');
-        return false;
-    });
-}
-
-function updateIssuesMeta(url, action, issueIds, elementId) {
-    return new Promise(function(resolve) {
-        $.ajax({
-            type: "POST",
-            url: url,
-            data: {
-                "_csrf": csrf,
-                "action": action,
-                "issue_ids": issueIds,
-                "id": elementId
-            },
-            success: resolve
-        })
-    })
-}
-
-function initRepoStatusChecker() {
-    const migrating = $("#repo_migrating");
-    $('#repo_migrating_failed').hide();
-    if (migrating) {
-        const repo_name = migrating.attr('repo');
-        if (typeof repo_name === 'undefined') {
-            return
-        }
-        $.ajax({
-            type: "GET",
-            url: suburl +"/"+repo_name+"/status",
-            data: {
-                "_csrf": csrf,
-            },
-            complete: function(xhr) {
-                if (xhr.status == 200) {
-                    if (xhr.responseJSON) {
-                        if (xhr.responseJSON["status"] == 0) {
-                            location.reload();
-                            return
-                        }
-
-                        setTimeout(function () {
-                            initRepoStatusChecker()
-                        }, 2000);
-                        return
-                    }
-                }
-                $('#repo_migrating_progress').hide();
-                $('#repo_migrating_failed').show();
-            }
-        })
-    }
-}
-
-function initReactionSelector(parent) {
-    let reactions = '';
-    if (!parent) {
-        parent = $(document);
-        reactions = '.reactions > ';
-    }
-
-    parent.find(reactions + 'a.label').popup({'position': 'bottom left', 'metadata': {'content': 'title', 'title': 'none'}});
-
-    parent.find('.select-reaction > .menu > .item, ' + reactions + 'a.label').on('click', function(e){
-        const vm = this;
-        e.preventDefault();
-
-        if ($(this).hasClass('disabled')) return;
-
-        const actionURL = $(this).hasClass('item') ?
-                $(this).closest('.select-reaction').data('action-url') :
-                $(this).data('action-url');
-        const url = actionURL + '/' + ($(this).hasClass('blue') ? 'unreact' : 'react');
-        $.ajax({
-            type: 'POST',
-            url: url,
-            data: {
-                '_csrf': csrf,
-                'content': $(this).data('content')
-            }
-        }).done(function(resp) {
-            if (resp && (resp.html || resp.empty)) {
-                const content = $(vm).closest('.content');
-                let react = content.find('.segment.reactions');
-                if (!resp.empty && react.length > 0) {
-                    react.remove();
-                }
-                if (!resp.empty) {
-                    react = $('<div class="ui attached segment reactions"></div>');
-                    const attachments = content.find('.segment.bottom:first');
-                    if (attachments.length > 0) {
-                        react.insertBefore(attachments);
-                    } else {
-                        react.appendTo(content);
-                    }
-                    react.html(resp.html);
-                    const hasEmoji = react.find('.has-emoji');
-                    for (let i = 0; i < hasEmoji.length; i++) {
-                        emojify.run(hasEmoji.get(i));
-                    }
-                    react.find('.dropdown').dropdown();
-                    initReactionSelector(react);
-                }
-            }
-        });
-    });
-}
-
-function insertAtCursor(field, value) {
-    if (field.selectionStart || field.selectionStart === 0) {
-        const startPos = field.selectionStart;
-        const endPos = field.selectionEnd;
-        field.value = field.value.substring(0, startPos)
-            + value
-            + field.value.substring(endPos, field.value.length);
-        field.selectionStart = startPos + value.length;
-        field.selectionEnd = startPos + value.length;
-    } else {
-        field.value += value;
-    }
-}
-
-function replaceAndKeepCursor(field, oldval, newval) {
-    if (field.selectionStart || field.selectionStart === 0) {
-        const startPos = field.selectionStart;
-        const endPos = field.selectionEnd;
-        field.value = field.value.replace(oldval, newval);
-        field.selectionStart = startPos + newval.length - oldval.length;
-        field.selectionEnd = endPos + newval.length - oldval.length;
-    } else {
-        field.value = field.value.replace(oldval, newval);
-    }
-}
-
-function retrieveImageFromClipboardAsBlob(pasteEvent, callback){
-    if (!pasteEvent.clipboardData) {
-        return;
-    }
-
-    const items = pasteEvent.clipboardData.items;
-    if (typeof(items) === "undefined") {
-        return;
-    }
-
-    for (let i = 0; i < items.length; i++) {
-        if (items[i].type.indexOf("image") === -1) continue;
-        const blob = items[i].getAsFile();
-
-        if (typeof(callback) === "function") {
-            pasteEvent.preventDefault();
-            pasteEvent.stopPropagation();
-            callback(blob);
-        }
-    }
-}
-
-function uploadFile(file, callback) {
-    const xhr = new XMLHttpRequest();
-
-    xhr.onload = function() {
-        if (xhr.status == 200) {
-            callback(xhr.responseText);
-        }
-    };
-
-    xhr.open("post", suburl + "/attachments", true);
-    xhr.setRequestHeader("X-Csrf-Token", csrf);
-    const formData = new FormData();
-    formData.append('file', file, file.name);
-    xhr.send(formData);
-}
-
-function reload() {
-    window.location.reload();
-}
-
-function initImagePaste(target) {
-    target.each(function() {
-        const field = this;
-        field.addEventListener('paste', function(event){
-            retrieveImageFromClipboardAsBlob(event, function(img) {
-                const name = img.name.substr(0, img.name.lastIndexOf('.'));
-                insertAtCursor(field, '![' + name + ']()');
-                uploadFile(img, function(res) {
-                    const data = JSON.parse(res);
-                    replaceAndKeepCursor(field, '![' + name + ']()', '![' + name + '](' + suburl + '/attachments/' + data.uuid + ')');
-                    const input = $('<input id="' + data.uuid + '" name="files" type="hidden">').val(data.uuid);
-                    $('.files').append(input);
-                });
-            });
-        }, false);
-    });
-}
-
-function initCommentForm() {
-    if ($('.comment.form').length == 0) {
-        return
-    }
-
-    initBranchSelector();
-    initCommentPreviewTab($('.comment.form'));
-    initImagePaste($('.comment.form textarea'));
-
-    // Listsubmit
-    function initListSubmits(selector, outerSelector) {
-        const $list = $('.ui.' + outerSelector + '.list');
-        const $noSelect = $list.find('.no-select');
-        const $listMenu = $('.' + selector + ' .menu');
-        let hasLabelUpdateAction = $listMenu.data('action') == 'update';
-        const labels = {};
-
-        $('.' + selector).dropdown('setting', 'onHide', function(){
-            hasLabelUpdateAction = $listMenu.data('action') == 'update'; // Update the var
-            if (hasLabelUpdateAction) {
-                const promises = [];
-                Object.keys(labels).forEach(function(elementId) {
-                    const label = labels[elementId];
-                    const promise = updateIssuesMeta(
-                        label["update-url"],
-                        label["action"],
-                        label["issue-id"],
-                        elementId
-                    );
-                    promises.push(promise);
-                });
-                Promise.all(promises).then(reload);
-            }
-        });
-
-        $listMenu.find('.item:not(.no-select)').click(function () {
-
-            // we don't need the action attribute when updating assignees
-            if (selector == 'select-assignees-modify') {
-
-                // UI magic. We need to do this here, otherwise it would destroy the functionality of
-                // adding/removing labels
-                if ($(this).hasClass('checked')) {
-                    $(this).removeClass('checked');
-                    $(this).find('.octicon').removeClass('octicon-check');
-                } else {
-                    $(this).addClass('checked');
-                    $(this).find('.octicon').addClass('octicon-check');
-                }
-
-                updateIssuesMeta(
-                    $listMenu.data('update-url'),
-                    "",
-                    $listMenu.data('issue-id'),
-                    $(this).data('id')
-                );
-                $listMenu.data('action', 'update'); // Update to reload the page when we updated items
-                return false;
-            }
-
-            if ($(this).hasClass('checked')) {
-                $(this).removeClass('checked');
-                $(this).find('.octicon').removeClass('octicon-check');
-                if (hasLabelUpdateAction) {
-                    if (!($(this).data('id') in labels)) {
-                        labels[$(this).data('id')] = {
-                            "update-url": $listMenu.data('update-url'),
-                            "action": "detach",
-                            "issue-id": $listMenu.data('issue-id'),
-                        };
-                    } else {
-                        delete labels[$(this).data('id')];
-                    }
-                }
-            } else {
-                $(this).addClass('checked');
-                $(this).find('.octicon').addClass('octicon-check');
-                if (hasLabelUpdateAction) {
-                    if (!($(this).data('id') in labels)) {
-                        labels[$(this).data('id')] = {
-                            "update-url": $listMenu.data('update-url'),
-                            "action": "attach",
-                            "issue-id": $listMenu.data('issue-id'),
-                        };
-                    } else {
-                        delete labels[$(this).data('id')];
-                    }
-                }
-            }
-
-            const listIds = [];
-            $(this).parent().find('.item').each(function () {
-                if ($(this).hasClass('checked')) {
-                    listIds.push($(this).data('id'));
-                    $($(this).data('id-selector')).removeClass('hide');
-                } else {
-                    $($(this).data('id-selector')).addClass('hide');
-                }
-            });
-            if (listIds.length == 0) {
-                $noSelect.removeClass('hide');
-            } else {
-                $noSelect.addClass('hide');
-            }
-            $($(this).parent().data('id')).val(listIds.join(","));
-            return false;
-        });
-        $listMenu.find('.no-select.item').click(function () {
-            if (hasLabelUpdateAction || selector == 'select-assignees-modify') {
-                updateIssuesMeta(
-                    $listMenu.data('update-url'),
-                    "clear",
-                    $listMenu.data('issue-id'),
-                    ""
-                ).then(reload);
-            }
-
-            $(this).parent().find('.item').each(function () {
-                $(this).removeClass('checked');
-                $(this).find('.octicon').removeClass('octicon-check');
-            });
-
-            $list.find('.item').each(function () {
-                $(this).addClass('hide');
-            });
-            $noSelect.removeClass('hide');
-            $($(this).parent().data('id')).val('');
-
-        });
-    }
-
-    // Init labels and assignees
-    initListSubmits('select-label', 'labels');
-    initListSubmits('select-assignees', 'assignees');
-    initListSubmits('select-assignees-modify', 'assignees');
-
-    function selectItem(select_id, input_id) {
-        const $menu = $(select_id + ' .menu');
-        const $list = $('.ui' + select_id + '.list');
-        const hasUpdateAction = $menu.data('action') == 'update';
-
-        $menu.find('.item:not(.no-select)').click(function () {
-            $(this).parent().find('.item').each(function () {
-                $(this).removeClass('selected active')
-            });
-
-            $(this).addClass('selected active');
-            if (hasUpdateAction) {
-                updateIssuesMeta(
-                    $menu.data('update-url'),
-                    "",
-                    $menu.data('issue-id'),
-                    $(this).data('id')
-                ).then(reload);
-            }
-            switch (input_id) {
-                case '#milestone_id':
-                    $list.find('.selected').html('<a class="item" href=' + $(this).data('href') + '>' +
-                        htmlEncode($(this).text()) + '</a>');
-                    break;
-                case '#assignee_id':
-                    $list.find('.selected').html('<a class="item" href=' + $(this).data('href') + '>' +
-                        '<img class="ui avatar image" src=' + $(this).data('avatar') + '>' +
-                        htmlEncode($(this).text()) + '</a>');
-            }
-            $('.ui' + select_id + '.list .no-select').addClass('hide');
-            $(input_id).val($(this).data('id'));
-        });
-        $menu.find('.no-select.item').click(function () {
-            $(this).parent().find('.item:not(.no-select)').each(function () {
-                $(this).removeClass('selected active')
-            });
-
-            if (hasUpdateAction) {
-                updateIssuesMeta(
-                    $menu.data('update-url'),
-                    "",
-                    $menu.data('issue-id'),
-                    $(this).data('id')
-                ).then(reload);
-            }
-
-            $list.find('.selected').html('');
-            $list.find('.no-select').removeClass('hide');
-            $(input_id).val('');
-        });
-    }
-
-    // Milestone and assignee
-    selectItem('.select-milestone', '#milestone_id');
-    selectItem('.select-assignee', '#assignee_id');
-}
-
-function initInstall() {
-    if ($('.install').length == 0) {
-        return;
-    }
-
-    if ($('#db_host').val()=="") {
-        $('#db_host').val("127.0.0.1:3306");
-        $('#db_user').val("gitea");
-        $('#db_name').val("gitea");
-    }
-
-    // Database type change detection.
-    $("#db_type").change(function () {
-        const sqliteDefault = 'data/gitea.db';
-        const tidbDefault = 'data/gitea_tidb';
-
-        const dbType = $(this).val();
-        if (dbType === "SQLite3") {
-            $('#sql_settings').hide();
-            $('#pgsql_settings').hide();
-            $('#mysql_settings').hide();
-            $('#sqlite_settings').show();
-
-            if (dbType === "SQLite3" && $('#db_path').val() == tidbDefault) {
-                $('#db_path').val(sqliteDefault);
-            }
-            return;
-        }
-
-        const dbDefaults = {
-            "MySQL": "127.0.0.1:3306",
-            "PostgreSQL": "127.0.0.1:5432",
-            "MSSQL": "127.0.0.1:1433"
-        };
-
-        $('#sqlite_settings').hide();
-        $('#sql_settings').show();
-
-        $('#pgsql_settings').toggle(dbType === "PostgreSQL");
-        $('#mysql_settings').toggle(dbType === "MySQL");
-        $.each(dbDefaults, function(_type, defaultHost) {
-            if ($('#db_host').val() == defaultHost) {
-                $('#db_host').val(dbDefaults[dbType]);
-                return false;
-            }
-        });
-    });
-
-    // TODO: better handling of exclusive relations.
-    $('#offline-mode input').change(function () {
-        if ($(this).is(':checked')) {
-            $('#disable-gravatar').checkbox('check');
-            $('#federated-avatar-lookup').checkbox('uncheck');
-        }
-    });
-    $('#disable-gravatar input').change(function () {
-        if ($(this).is(':checked')) {
-            $('#federated-avatar-lookup').checkbox('uncheck');
-        } else {
-            $('#offline-mode').checkbox('uncheck');
-        }
-    });
-    $('#federated-avatar-lookup input').change(function () {
-        if ($(this).is(':checked')) {
-            $('#disable-gravatar').checkbox('uncheck');
-            $('#offline-mode').checkbox('uncheck');
-        }
-    });
-    $('#enable-openid-signin input').change(function () {
-        if ($(this).is(':checked')) {
-            if (!$('#disable-registration input').is(':checked')) {
-                $('#enable-openid-signup').checkbox('check');
-            }
-        } else {
-            $('#enable-openid-signup').checkbox('uncheck');
-        }
-    });
-    $('#disable-registration input').change(function () {
-        if ($(this).is(':checked')) {
-            $('#enable-captcha').checkbox('uncheck');
-            $('#enable-openid-signup').checkbox('uncheck');
-        } else {
-            $('#enable-openid-signup').checkbox('check');
-        }
-    });
-    $('#enable-captcha input').change(function () {
-        if ($(this).is(':checked')) {
-            $('#disable-registration').checkbox('uncheck');
-        }
-    });
-}
-
-function initRepository() {
-    if ($('.repository').length == 0) {
-        return;
-    }
-
-    function initFilterSearchDropdown(selector) {
-        const $dropdown = $(selector);
-        $dropdown.dropdown({
-            fullTextSearch: true,
-            selectOnKeydown: false,
-            onChange: function (_text, _value, $choice) {
-                if ($choice.data('url')) {
-                    window.location.href = $choice.data('url');
-                }
-            },
-            message: {noResults: $dropdown.data('no-results')}
-        });
-    }
-
-    // File list and commits
-    if ($('.repository.file.list').length > 0 ||
-        ('.repository.commits').length > 0) {
-        initFilterBranchTagDropdown('.choose.reference .dropdown');
-    }
-
-    // Wiki
-    if ($('.repository.wiki.view').length > 0) {
-        initFilterSearchDropdown('.choose.page .dropdown');
-    }
-
-    // Options
-    if ($('.repository.settings.options').length > 0) {
-        $('#repo_name').keyup(function () {
-            const $prompt = $('#repo-name-change-prompt');
-            if ($(this).val().toString().toLowerCase() != $(this).data('name').toString().toLowerCase()) {
-                $prompt.show();
-            } else {
-                $prompt.hide();
-            }
-        });
-
-        // Enable or select internal/external wiki system and issue tracker.
-        $('.enable-system').change(function () {
-            if (this.checked) {
-                $($(this).data('target')).removeClass('disabled');
-                if (!$(this).data('context')) $($(this).data('context')).addClass('disabled');
-            } else {
-                $($(this).data('target')).addClass('disabled');
-                if (!$(this).data('context')) $($(this).data('context')).removeClass('disabled');
-            }
-        });
-        $('.enable-system-radio').change(function () {
-            if (this.value == 'false') {
-                $($(this).data('target')).addClass('disabled');
-                if (typeof $(this).data('context') !== 'undefined') $($(this).data('context')).removeClass('disabled');
-            } else if (this.value == 'true') {
-                $($(this).data('target')).removeClass('disabled');
-                if (typeof $(this).data('context') !== 'undefined')  $($(this).data('context')).addClass('disabled');
-            }
-        });
-    }
-
-    // Labels
-    if ($('.repository.labels').length > 0) {
-        // Create label
-        const $newLabelPanel = $('.new-label.segment');
-        $('.new-label.button').click(function () {
-            $newLabelPanel.show();
-        });
-        $('.new-label.segment .cancel').click(function () {
-            $newLabelPanel.hide();
-        });
-
-        $('.color-picker').each(function () {
-            $(this).minicolors();
-        });
-        $('.precolors .color').click(function () {
-            const color_hex = $(this).data('color-hex');
-            $('.color-picker').val(color_hex);
-            $('.minicolors-swatch-color').css("background-color", color_hex);
-        });
-        $('.edit-label-button').click(function () {
-            $('#label-modal-id').val($(this).data('id'));
-            $('.edit-label .new-label-input').val($(this).data('title'));
-            $('.edit-label .new-label-desc-input').val($(this).data('description'));
-            $('.edit-label .color-picker').val($(this).data('color'));
-            $('.minicolors-swatch-color').css("background-color", $(this).data('color'));
-            $('.edit-label.modal').modal({
-                onApprove: function () {
-                    $('.edit-label.form').submit();
-                }
-            }).modal('show');
-            return false;
-        });
-    }
-
-    // Milestones
-    if ($('.repository.new.milestone').length > 0) {
-        const $datepicker = $('.milestone.datepicker');
-        $datepicker.datetimepicker({
-            lang: $datepicker.data('lang'),
-            inline: true,
-            timepicker: false,
-            startDate: $datepicker.data('start-date'),
-            formatDate: 'Y-m-d',
-            onSelectDate: function (ct) {
-                $('#deadline').val(ct.dateFormat('Y-m-d'));
-            }
-        });
-        $('#clear-date').click(function () {
-            $('#deadline').val('');
-            return false;
-        });
-    }
-
-    // Issues
-    if ($('.repository.view.issue').length > 0) {
-        // Edit issue title
-        const $issueTitle = $('#issue-title');
-        const $editInput = $('#edit-title-input input');
-        const editTitleToggle = function () {
-            $issueTitle.toggle();
-            $('.not-in-edit').toggle();
-            $('#edit-title-input').toggle();
-            $('.in-edit').toggle();
-            $editInput.focus();
-            return false;
-        };
-        $('#edit-title').click(editTitleToggle);
-        $('#cancel-edit-title').click(editTitleToggle);
-        $('#save-edit-title').click(editTitleToggle).click(function () {
-            if ($editInput.val().length == 0 ||
-                $editInput.val() == $issueTitle.text()) {
-                $editInput.val($issueTitle.text());
-                return false;
-            }
-
-            $.post($(this).data('update-url'), {
-                    "_csrf": csrf,
-                    "title": $editInput.val()
-                },
-                function (data) {
-                    $editInput.val(data.title);
-                    $issueTitle.text(data.title);
-                    reload();
-                });
-            return false;
-        });
-
-        // Edit issue or comment content
-        $('.edit-content').click(function () {
-            const $segment = $(this).parent().parent().parent().next();
-            const $editContentZone = $segment.find('.edit-content-zone');
-            const $renderContent = $segment.find('.render-content');
-            const $rawContent = $segment.find('.raw-content');
-            let $textarea;
-
-            // Setup new form
-            if ($editContentZone.html().length == 0) {
-                $editContentZone.html($('#edit-content-form').html());
-                $textarea = $editContentZone.find('textarea');
-                issuesTribute.attach($textarea.get());
-                emojiTribute.attach($textarea.get());
-
-                const $dropzone = $editContentZone.find('.dropzone');
-                $dropzone.data("saved", false);
-                const $files = $editContentZone.find('.comment-files');
-                if ($dropzone.length > 0) {
-                    const filenameDict = {};
-                    $dropzone.dropzone({
-                        url: $dropzone.data('upload-url'),
-                        headers: {"X-Csrf-Token": csrf},
-                        maxFiles: $dropzone.data('max-file'),
-                        maxFilesize: $dropzone.data('max-size'),
-                        acceptedFiles: ($dropzone.data('accepts') === '*/*') ? null : $dropzone.data('accepts'),
-                        addRemoveLinks: true,
-                        dictDefaultMessage: $dropzone.data('default-message'),
-                        dictInvalidFileType: $dropzone.data('invalid-input-type'),
-                        dictFileTooBig: $dropzone.data('file-too-big'),
-                        dictRemoveFile: $dropzone.data('remove-file'),
-                        init: function () {
-                            this.on("success", function (file, data) {
-                                filenameDict[file.name] = {
-                                    "uuid": data.uuid,
-                                    "submitted": false
-                                }
-                                const input = $('<input id="' + data.uuid + '" name="files" type="hidden">').val(data.uuid);
-                                $files.append(input);
-                            });
-                            this.on("removedfile", function (file) {
-                                if (!(file.name in filenameDict)) {
-                                    return;
-                                }
-                                $('#' + filenameDict[file.name].uuid).remove();
-                                if ($dropzone.data('remove-url') && $dropzone.data('csrf') && !filenameDict[file.name].submitted) {
-                                    $.post($dropzone.data('remove-url'), {
-                                        file: filenameDict[file.name].uuid,
-                                        _csrf: $dropzone.data('csrf')
-                                    });
-                                }
-                            });
-                            this.on("submit", function () {
-                                $.each(filenameDict, function(name){
-                                    filenameDict[name].submitted = true;
-                                });
-                            });
-                            this.on("reload", function (){
-                                $.getJSON($editContentZone.data('attachment-url'), function(data){
-                                    const drop = $dropzone.get(0).dropzone;
-                                    drop.removeAllFiles(true);
-                                    $files.empty();
-                                    $.each(data, function(){
-                                        const imgSrc =  $dropzone.data('upload-url') + "/" + this.uuid;
-                                        drop.emit("addedfile", this);
-                                        drop.emit("thumbnail", this, imgSrc);
-                                        drop.emit("complete", this);
-                                        drop.files.push(this);
-                                        filenameDict[this.name] = {
-                                            "submitted": true,
-                                            "uuid": this.uuid
-                                        }
-                                        $dropzone.find("img[src='" + imgSrc + "']").css("max-width", "100%");
-                                        const input = $('<input id="' + this.uuid + '" name="files" type="hidden">').val(this.uuid);
-                                        $files.append(input);
-                                    });
-                                });
-                            });
-                        }
-                    });
-                    $dropzone.get(0).dropzone.emit("reload");
-                }
-                // Give new write/preview data-tab name to distinguish from others
-                const $editContentForm = $editContentZone.find('.ui.comment.form');
-                const $tabMenu = $editContentForm.find('.tabular.menu');
-                $tabMenu.attr('data-write', $editContentZone.data('write'));
-                $tabMenu.attr('data-preview', $editContentZone.data('preview'));
-                $tabMenu.find('.write.item').attr('data-tab', $editContentZone.data('write'));
-                $tabMenu.find('.preview.item').attr('data-tab', $editContentZone.data('preview'));
-                $editContentForm.find('.write.segment').attr('data-tab', $editContentZone.data('write'));
-                $editContentForm.find('.preview.segment').attr('data-tab', $editContentZone.data('preview'));
-
-                initCommentPreviewTab($editContentForm);
-
-                $editContentZone.find('.cancel.button').click(function () {
-                    $renderContent.show();
-                    $editContentZone.hide();
-                    $dropzone.get(0).dropzone.emit("reload");
-                });
-                $editContentZone.find('.save.button').click(function () {
-                    $renderContent.show();
-                    $editContentZone.hide();
-                    const $attachments = $files.find("[name=files]").map(function(){
-                        return $(this).val();
-                    }).get();
-                    $.post($editContentZone.data('update-url'), {
-                        "_csrf": csrf,
-                        "content": $textarea.val(),
-                        "context": $editContentZone.data('context'),
-                        "files": $attachments
-                    },
-                    function (data) {
-                        if (data.length == 0) {
-                            $renderContent.html($('#no-content').html());
-                        } else {
-                            $renderContent.html(data.content);
-                            emojify.run($renderContent[0]);
-                            $('pre code', $renderContent[0]).each(function () {
-                                hljs.highlightBlock(this);
-                            });
-                        }
-                        const $content = $segment.parent();
-                        if(!$content.find(".ui.small.images").length){
-                            if(data.attachments != ""){
-                                $content.append(
-                                '<div class="ui bottom attached segment">' +
-                                '    <div class="ui small images">' +
-                                '    </div>' +
-                                '</div>'
-                                );
-                                $content.find(".ui.small.images").html(data.attachments);
-                            }
-                        } else if (data.attachments == "") {
-                            $content.find(".ui.small.images").parent().remove();
-                        } else {
-                            $content.find(".ui.small.images").html(data.attachments);
-                        }
-                        $dropzone.get(0).dropzone.emit("submit");
-                        $dropzone.get(0).dropzone.emit("reload");
-                    });
-                });
-            } else {
-                $textarea = $segment.find('textarea');
-            }
-
-            // Show write/preview tab and copy raw content as needed
-            $editContentZone.show();
-            $renderContent.hide();
-            if ($textarea.val().length == 0) {
-                $textarea.val($rawContent.text());
-            }
-            $textarea.focus();
-            return false;
-        });
-
-        // Delete comment
-        $('.delete-comment').click(function () {
-            const $this = $(this);
-            if (confirm($this.data('locale'))) {
-                $.post($this.data('url'), {
-                    "_csrf": csrf
-                }).success(function () {
-                    $('#' + $this.data('comment-id')).remove();
-                });
-            }
-            return false;
-        });
-
-        // Change status
-        const $statusButton = $('#status-button');
-        $('#comment-form .edit_area').keyup(function () {
-            if ($(this).val().length == 0) {
-                $statusButton.text($statusButton.data('status'))
-            } else {
-                $statusButton.text($statusButton.data('status-and-comment'))
-            }
-        });
-        $statusButton.click(function () {
-            $('#status').val($statusButton.data('status-val'));
-            $('#comment-form').submit();
-        });
-
-        // Pull Request merge button
-        const $mergeButton = $('.merge-button > button');
-        $mergeButton.on('click', function(e) {
-            e.preventDefault();
-            $('.' + $(this).data('do') + '-fields').show();
-            $(this).parent().hide();
-        });
-        $('.merge-button > .dropdown').dropdown({
-            onChange: function (_text, _value, $choice) {
-                if ($choice.data('do')) {
-                    $mergeButton.find('.button-text').text($choice.text());
-                    $mergeButton.data('do', $choice.data('do'));
-                }
-            }
-        });
-        $('.merge-cancel').on('click', function(e) {
-            e.preventDefault();
-            $(this).closest('.form').hide();
-            $mergeButton.parent().show();
-        });
-
-        initReactionSelector();
-    }
-
-    // Diff
-    if ($('.repository.diff').length > 0) {
-        $('.diff-counter').each(function () {
-            const $item = $(this);
-            const addLine = $item.find('span[data-line].add').data("line");
-            const delLine = $item.find('span[data-line].del').data("line");
-            const addPercent = parseFloat(addLine) / (parseFloat(addLine) + parseFloat(delLine)) * 100;
-            $item.find(".bar .add").css("width", addPercent + "%");
-        });
-    }
-
-    // Quick start and repository home
-    $('#repo-clone-ssh').click(function () {
-        $('.clone-url').text($(this).data('link'));
-        $('#repo-clone-url').val($(this).data('link'));
-        $(this).addClass('blue');
-        $('#repo-clone-https').removeClass('blue');
-        localStorage.setItem('repo-clone-protocol', 'ssh');
-    });
-    $('#repo-clone-https').click(function () {
-        $('.clone-url').text($(this).data('link'));
-        $('#repo-clone-url').val($(this).data('link'));
-        $(this).addClass('blue');
-        $('#repo-clone-ssh').removeClass('blue');
-        localStorage.setItem('repo-clone-protocol', 'https');
-    });
-    $('#repo-clone-url').click(function () {
-        $(this).select();
-    });
-
-    // Pull request
-    const $repoComparePull = $('.repository.compare.pull');
-    if ($repoComparePull.length > 0) {
-        initFilterSearchDropdown('.choose.branch .dropdown');
-        // show pull request form
-        $repoComparePull.find('button.show-form').on('click', function(e) {
-            e.preventDefault();
-            $repoComparePull.find('.pullrequest-form').show();
-            $(this).parent().hide();
-        });
-    }
-
-    // Branches
-    if ($('.repository.settings.branches').length > 0) {
-        initFilterSearchDropdown('.protected-branches .dropdown');
-        $('.enable-protection, .enable-whitelist').change(function () {
-            if (this.checked) {
-                $($(this).data('target')).removeClass('disabled');
-            } else {
-                $($(this).data('target')).addClass('disabled');
-            }
-        });
-    }
-}
-
-function initMigration() {
-    const toggleMigrations = function() {
-        const authUserName = $('#auth_username').val();
-        const cloneAddr = $('#clone_addr').val();
-        if (!$('#mirror').is(":checked") && (authUserName!=undefined && authUserName.length > 0)
-        && (cloneAddr!=undefined && (cloneAddr.startsWith("https://github.com") || cloneAddr.startsWith("http://github.com")))) {
-            $('#migrate_items').show();
-        } else {
-            $('#migrate_items').hide();
-        }
-    }
-
-    toggleMigrations();
-
-    $('#clone_addr').on('input', toggleMigrations)
-    $('#auth_username').on('input', toggleMigrations)
-    $('#mirror').on('change', toggleMigrations)
-}
-
-function initPullRequestReview() {
-    $('.show-outdated').on('click', function (e) {
-        e.preventDefault();
-        const id = $(this).data('comment');
-        $(this).addClass("hide");
-        $("#code-comments-" + id).removeClass('hide');
-        $("#code-preview-" + id).removeClass('hide');
-        $("#hide-outdated-" + id).removeClass('hide');
-    });
-
-    $('.hide-outdated').on('click', function (e) {
-        e.preventDefault();
-        const id = $(this).data('comment');
-        $(this).addClass("hide");
-        $("#code-comments-" + id).addClass('hide');
-        $("#code-preview-" + id).addClass('hide');
-        $("#show-outdated-" + id).removeClass('hide');
-    });
-
-    $('button.comment-form-reply').on('click', function (e) {
-        e.preventDefault();
-        $(this).hide();
-        const form = $(this).parent().find('.comment-form')
-        form.removeClass('hide');
-        assingMenuAttributes(form.find('.menu'));
-    });
-    // The following part is only for diff views
-    if ($('.repository.pull.diff').length == 0) {
-        return;
-    }
-
-    $('.diff-detail-box.ui.sticky').sticky();
-
-    $('.btn-review').on('click', function(e) {
-        e.preventDefault();
-        $(this).closest('.dropdown').find('.menu').toggle('visible');
-    }).closest('.dropdown').find('.link.close').on('click', function(e) {
-        e.preventDefault();
-        $(this).closest('.menu').toggle('visible');
-    });
-
-    $('.code-view .lines-code,.code-view .lines-num')
-        .on('mouseenter', function() {
-            const parent = $(this).closest('td');
-            $(this).closest('tr').addClass(
-                parent.hasClass('lines-num-old') || parent.hasClass('lines-code-old')
-                    ? 'focus-lines-old' : 'focus-lines-new'
-            );
-        })
-        .on('mouseleave', function() {
-            $(this).closest('tr').removeClass('focus-lines-new focus-lines-old');
-        });
-    $('.add-code-comment').on('click', function(e) {
-        // https://github.com/go-gitea/gitea/issues/4745
-        if ($(e.target).hasClass('btn-add-single')) {
-          return;
-        }
-        e.preventDefault();
-        const isSplit = $(this).closest('.code-diff').hasClass('code-diff-split');
-        const side = $(this).data('side');
-        const idx = $(this).data('idx');
-        const path = $(this).data('path');
-        const form = $('#pull_review_add_comment').html();
-        const tr = $(this).closest('tr');
-        let ntr = tr.next();
-        if (!ntr.hasClass('add-comment')) {
-            ntr = $('<tr class="add-comment">'
-                    + (isSplit ? '<td class="lines-num"></td><td class="lines-type-marker"></td><td class="add-comment-left"></td><td class="lines-num"></td><td class="lines-type-marker"></td><td class="add-comment-right"></td>'
-                               : '<td class="lines-num"></td><td class="lines-num"></td><td class="lines-type-marker"></td><td class="add-comment-left add-comment-right"></td>')
-                    + '</tr>');
-            tr.after(ntr);
-        }
-        const td = ntr.find('.add-comment-' + side);
-        let commentCloud = td.find('.comment-code-cloud');
-        if (commentCloud.length === 0) {
-            td.html(form);
-            commentCloud = td.find('.comment-code-cloud');
-            assingMenuAttributes(commentCloud.find('.menu'));
-
-            td.find("input[name='line']").val(idx);
-            td.find("input[name='side']").val(side === "left" ? "previous":"proposed");
-            td.find("input[name='path']").val(path);
-        }
-        commentCloud.find('textarea').focus();
-    });
-}
-
-function assingMenuAttributes(menu) {
-    const id = Math.floor(Math.random() * Math.floor(1000000));
-    menu.attr('data-write', menu.attr('data-write') + id);
-    menu.attr('data-preview', menu.attr('data-preview') + id);
-    menu.find('.item').each(function() {
-        const tab = $(this).attr('data-tab') + id;
-        $(this).attr('data-tab', tab);
-    });
-    menu.parent().find("*[data-tab='write']").attr('data-tab', 'write' + id);
-    menu.parent().find("*[data-tab='preview']").attr('data-tab', 'preview' + id);
-    initCommentPreviewTab(menu.parent(".form"));
-    return id;
-}
-
-function initRepositoryCollaboration() {
-    // Change collaborator access mode
-    $('.access-mode.menu .item').click(function () {
-        const $menu = $(this).parent();
-        $.post($menu.data('url'), {
-            "_csrf": csrf,
-            "uid": $menu.data('uid'),
-            "mode": $(this).data('value')
-        })
-    });
-}
-
-function initTeamSettings() {
-    // Change team access mode
-    $('.organization.new.team input[name=permission]').change(function () {
-        const val = $('input[name=permission]:checked', '.organization.new.team').val()
-        if (val === 'admin') {
-            $('.organization.new.team .team-units').hide();
-        } else {
-            $('.organization.new.team .team-units').show();
-        }
-    });
-}
-
-function initWikiForm() {
-    const $editArea = $('.repository.wiki textarea#edit_area');
-    if ($editArea.length > 0) {
-        const simplemde = new SimpleMDE({
-            autoDownloadFontAwesome: false,
-            element: $editArea[0],
-            forceSync: true,
-            previewRender: function (plainText, preview) { // Async method
-                setTimeout(function () {
-                    // FIXME: still send render request when return back to edit mode
-                    $.post($editArea.data('url'), {
-                            "_csrf": csrf,
-                            "mode": "gfm",
-                            "context": $editArea.data('context'),
-                            "text": plainText
-                        },
-                        function (data) {
-                            preview.innerHTML = '<div class="markdown ui segment">' + data + '</div>';
-                            emojify.run($('.editor-preview')[0]);
-                        }
-                    );
-                }, 0);
-
-                return "Loading...";
-            },
-            renderingConfig: {
-                singleLineBreaks: false
-            },
-            indentWithTabs: false,
-            tabSize: 4,
-            spellChecker: false,
-            toolbar: ["bold", "italic", "strikethrough", "|",
-                "heading-1", "heading-2", "heading-3", "heading-bigger", "heading-smaller", "|",
-                {
-                    name: "code-inline",
-                    action: function(e){
-                        const cm = e.codemirror;
-                        const selection = cm.getSelection();
-                        cm.replaceSelection("`" + selection + "`");
-                        if (!selection) {
-                            const cursorPos = cm.getCursor();
-                            cm.setCursor(cursorPos.line, cursorPos.ch - 1);
-                        }
-                        cm.focus();
-                    },
-                    className: "fa fa-angle-right",
-                    title: "Add Inline Code",
-                },"code", "quote", "|", {
-                    name: "checkbox-empty",
-                    action: function(e){
-                        const cm = e.codemirror;
-                        cm.replaceSelection("\n- [ ] " + cm.getSelection());
-                        cm.focus();
-                    },
-                    className: "fa fa-square-o",
-                    title: "Add Checkbox (empty)",
-                },
-                {
-                    name: "checkbox-checked",
-                    action: function(e){
-                        const cm = e.codemirror;
-                        cm.replaceSelection("\n- [x] " + cm.getSelection());
-                        cm.focus();
-                    },
-                    className: "fa fa-check-square-o",
-                    title: "Add Checkbox (checked)",
-                }, "|",
-                "unordered-list", "ordered-list", "|",
-                "link", "image", "table", "horizontal-rule", "|",
-                "clean-block", "preview", "fullscreen"]
-        })
-        $(simplemde.codemirror.getInputField()).addClass("js-quick-submit");
-    }
-}
-
-// For IE
-String.prototype.endsWith = function (pattern) {
-    const d = this.length - pattern.length;
-    return d >= 0 && this.lastIndexOf(pattern) === d;
-};
-
-// Adding function to get the cursor position in a text field to jQuery object.
-$.fn.getCursorPosition = function () {
-    const el = $(this).get(0);
-    let pos = 0;
-    if ('selectionStart' in el) {
-        pos = el.selectionStart;
-    } else if ('selection' in document) {
-        el.focus();
-        const Sel = document.selection.createRange();
-        const SelLength = document.selection.createRange().text.length;
-        Sel.moveStart('character', -el.value.length);
-        pos = Sel.text.length - SelLength;
-    }
-    return pos;
-}
-
-function setSimpleMDE($editArea) {
-    if (codeMirrorEditor) {
-        codeMirrorEditor.toTextArea();
-        codeMirrorEditor = null;
-    }
-
-    if (simpleMDEditor) {
-        return true;
-    }
-
-    simpleMDEditor = new SimpleMDE({
-        autoDownloadFontAwesome: false,
-        element: $editArea[0],
-        forceSync: true,
-        renderingConfig: {
-            singleLineBreaks: false
-        },
-        indentWithTabs: false,
-        tabSize: 4,
-        spellChecker: false,
-        previewRender: function (plainText, preview) { // Async method
-            setTimeout(function () {
-                // FIXME: still send render request when return back to edit mode
-                $.post($editArea.data('url'), {
-                        "_csrf": csrf,
-                        "mode": "gfm",
-                        "context": $editArea.data('context'),
-                        "text": plainText
-                    },
-                    function (data) {
-                        preview.innerHTML = '<div class="markdown ui segment">' + data + '</div>';
-                        emojify.run($('.editor-preview')[0]);
-                    }
-                );
-            }, 0);
-
-            return "Loading...";
-        },
-        toolbar: ["bold", "italic", "strikethrough", "|",
-            "heading-1", "heading-2", "heading-3", "heading-bigger", "heading-smaller", "|",
-            "code", "quote", "|",
-            "unordered-list", "ordered-list", "|",
-            "link", "image", "table", "horizontal-rule", "|",
-            "clean-block", "preview", "fullscreen", "side-by-side"]
-    });
-
-    return true;
-}
-
-function setCodeMirror($editArea) {
-    if (simpleMDEditor) {
-        simpleMDEditor.toTextArea();
-        simpleMDEditor = null;
-    }
-
-    if (codeMirrorEditor) {
-        return true;
-    }
-
-    codeMirrorEditor = CodeMirror.fromTextArea($editArea[0], {
-        lineNumbers: true
-    });
-    codeMirrorEditor.on("change", function (cm, _change) {
-        $editArea.val(cm.getValue());
-    });
-
-    return true;
-}
-
-function initEditor() {
-    $('.js-quick-pull-choice-option').change(function () {
-        if ($(this).val() == 'commit-to-new-branch') {
-            $('.quick-pull-branch-name').show();
-            $('.quick-pull-branch-name input').prop('required',true);
-        } else {
-            $('.quick-pull-branch-name').hide();
-            $('.quick-pull-branch-name input').prop('required',false);
-        }
-        $('#commit-button').text($(this).attr('button_text'));
-    });
-
-    const $editFilename = $("#file-name");
-    $editFilename.keyup(function (e) {
-        const $section = $('.breadcrumb span.section');
-        const $divider = $('.breadcrumb div.divider');
-        let value;
-        let parts;
-
-        if (e.keyCode == 8) {
-            if ($(this).getCursorPosition() == 0) {
-                if ($section.length > 0) {
-                    value = $section.last().find('a').text();
-                    $(this).val(value + $(this).val());
-                    $(this)[0].setSelectionRange(value.length, value.length);
-                    $section.last().remove();
-                    $divider.last().remove();
-                }
-            }
-        }
-        if (e.keyCode == 191) {
-            parts = $(this).val().split('/');
-            for (let i = 0; i < parts.length; ++i) {
-                value = parts[i];
-                if (i < parts.length - 1) {
-                    if (value.length) {
-                        $('<span class="section"><a href="#">' + value + '</a></span>').insertBefore($(this));
-                        $('<div class="divider"> / </div>').insertBefore($(this));
-                    }
-                }
-                else {
-                    $(this).val(value);
-                }
-                $(this)[0].setSelectionRange(0, 0);
-            }
-        }
-        parts = [];
-        $('.breadcrumb span.section').each(function () {
-            const element = $(this);
-            if (element.find('a').length) {
-                parts.push(element.find('a').text());
-            } else {
-                parts.push(element.text());
-            }
-        });
-        if ($(this).val())
-            parts.push($(this).val());
-        $('#tree_path').val(parts.join('/'));
-    }).trigger('keyup');
-
-    const $editArea = $('.repository.editor textarea#edit_area');
-    if (!$editArea.length)
-        return;
-
-    const markdownFileExts = $editArea.data("markdown-file-exts").split(",");
-    const lineWrapExtensions = $editArea.data("line-wrap-extensions").split(",");
-
-    $editFilename.on("keyup", function () {
-        const val = $editFilename.val();
-        let mode, spec, extension, extWithDot, dataUrl, apiCall;
-
-        extension = extWithDot = "";
-        const m = /.+\.([^.]+)$/.exec(val);
-        if (m) {
-            extension = m[1];
-            extWithDot = "." + extension;
-        }
-
-        const info = CodeMirror.findModeByExtension(extension);
-        const previewLink = $('a[data-tab=preview]');
-        if (info) {
-            mode = info.mode;
-            spec = info.mime;
-            apiCall = mode;
-        }
-        else {
-            apiCall = extension
-        }
-
-        if (previewLink.length && apiCall && previewFileModes && previewFileModes.length && previewFileModes.indexOf(apiCall) >= 0) {
-            dataUrl = previewLink.data('url');
-            previewLink.data('url', dataUrl.replace(/(.*)\/.*/i, '$1/' + mode));
-            previewLink.show();
-        }
-        else {
-            previewLink.hide();
-        }
-
-        // If this file is a Markdown extensions, we will load that editor and return
-        if (markdownFileExts.indexOf(extWithDot) >= 0) {
-            if (setSimpleMDE($editArea)) {
-                return;
-            }
-        }
-
-        // Else we are going to use CodeMirror
-        if (!codeMirrorEditor && !setCodeMirror($editArea)) {
-            return;
-        }
-
-        if (mode) {
-            codeMirrorEditor.setOption("mode", spec);
-            CodeMirror.autoLoadMode(codeMirrorEditor, mode);
-        }
-
-        if (lineWrapExtensions.indexOf(extWithDot) >= 0) {
-            codeMirrorEditor.setOption("lineWrapping", true);
-        }
-        else {
-            codeMirrorEditor.setOption("lineWrapping", false);
-        }
-
-        // get the filename without any folder
-        let value = $editFilename.val();
-        if (value.length === 0) {
-            return;
-        }
-        value = value.split('/');
-        value = value[value.length - 1];
-
-        $.getJSON($editFilename.data('ec-url-prefix')+value, function(editorconfig) {
-            if (editorconfig.indent_style === 'tab') {
-                codeMirrorEditor.setOption("indentWithTabs", true);
-                codeMirrorEditor.setOption('extraKeys', {});
-            } else {
-                codeMirrorEditor.setOption("indentWithTabs", false);
-                // required because CodeMirror doesn't seems to use spaces correctly for {"indentWithTabs": false}:
-                // - https://github.com/codemirror/CodeMirror/issues/988
-                // - https://codemirror.net/doc/manual.html#keymaps
-                codeMirrorEditor.setOption('extraKeys', {
-                    Tab: function(cm) {
-                        const spaces = Array(parseInt(cm.getOption("indentUnit")) + 1).join(" ");
-                        cm.replaceSelection(spaces);
-                    }
-                });
-            }
-            codeMirrorEditor.setOption("indentUnit", editorconfig.indent_size || 4);
-            codeMirrorEditor.setOption("tabSize", editorconfig.tab_width || 4);
-        });
-    }).trigger('keyup');
-
-    // Using events from https://github.com/codedance/jquery.AreYouSure#advanced-usage
-    // to enable or disable the commit button
-    const $commitButton = $('#commit-button');
-    const $editForm = $('.ui.edit.form');
-    const dirtyFileClass = 'dirty-file';
-
-    // Disabling the button at the start
-    $commitButton.prop('disabled', true);
-
-    // Registering a custom listener for the file path and the file content
-    $editForm.areYouSure({
-        silent: true,
-        dirtyClass: dirtyFileClass,
-        fieldSelector: ':input:not(.commit-form-wrapper :input)',
-        change: function () {
-            const dirty = $(this).hasClass(dirtyFileClass);
-            $commitButton.prop('disabled', !dirty);
-        }
-    });
-
-    $commitButton.click(function (event) {
-        // A modal which asks if an empty file should be committed
-        if ($editArea.val().length === 0) {
-            $('#edit-empty-content-modal').modal({
-                onApprove: function () {
-                    $('.edit.form').submit();
-                }
-            }).modal('show');
-            event.preventDefault();
-        }
-    });
-}
-
-function initOrganization() {
-    if ($('.organization').length == 0) {
-        return;
-    }
-
-    // Options
-    if ($('.organization.settings.options').length > 0) {
-        $('#org_name').keyup(function () {
-            const $prompt = $('#org-name-change-prompt');
-            if ($(this).val().toString().toLowerCase() != $(this).data('org-name').toString().toLowerCase()) {
-                $prompt.show();
-            } else {
-                $prompt.hide();
-            }
-        });
-    }
-}
-
-function initUserSettings() {
-    // Options
-    if ($('.user.settings.profile').length > 0) {
-        $('#username').keyup(function () {
-            const $prompt = $('#name-change-prompt');
-            if ($(this).val().toString().toLowerCase() != $(this).data('name').toString().toLowerCase()) {
-                $prompt.show();
-            } else {
-                $prompt.hide();
-            }
-        });
-    }
-}
-
-function initWebhook() {
-    if ($('.new.webhook').length == 0) {
-        return;
-    }
-
-    $('.events.checkbox input').change(function () {
-        if ($(this).is(':checked')) {
-            $('.events.fields').show();
-        }
-    });
-    $('.non-events.checkbox input').change(function () {
-        if ($(this).is(':checked')) {
-            $('.events.fields').hide();
-        }
-    });
-
-    const updateContentType = function () {
-        const visible = $('#http_method').val() === 'POST';
-        $('#content_type').parent().parent()[visible ? 'show' : 'hide']();
-    };
-    updateContentType();
-    $('#http_method').change(function () {
-        updateContentType();
-    });
-
-    // Test delivery
-    $('#test-delivery').click(function () {
-        const $this = $(this);
-        $this.addClass('loading disabled');
-        $.post($this.data('link'), {
-            "_csrf": csrf
-        }).done(
-            setTimeout(function () {
-                window.location.href = $this.data('redirect');
-            }, 5000)
-        )
-    });
-}
-
-function initAdmin() {
-    if ($('.admin').length == 0) {
-        return;
-    }
-
-    // New user
-    if ($('.admin.new.user').length > 0 ||
-        $('.admin.edit.user').length > 0) {
-        $('#login_type').change(function () {
-            if ($(this).val().substring(0, 1) == '0') {
-                $('#login_name').removeAttr('required');
-                $('.non-local').hide();
-                $('.local').show();
-                $('#user_name').focus();
-
-                if ($(this).data('password') == "required") {
-                    $('#password').attr('required', 'required');
-                }
-
-            } else {
-                $('#login_name').attr('required', 'required');
-                $('.non-local').show();
-                $('.local').hide();
-                $('#login_name').focus();
-
-                $('#password').removeAttr('required');
-            }
-        });
-    }
-
-    function onSecurityProtocolChange() {
-        if ($('#security_protocol').val() > 0) {
-            $('.has-tls').show();
-        } else {
-            $('.has-tls').hide();
-        }
-    }
-
-    function onUsePagedSearchChange() {
-        if ($('#use_paged_search').prop('checked')) {
-            $('.search-page-size').show()
-                .find('input').attr('required', 'required');
-        } else {
-            $('.search-page-size').hide()
-                .find('input').removeAttr('required');
-        }
-    }
-
-    function onOAuth2Change() {
-        $('.open_id_connect_auto_discovery_url, .oauth2_use_custom_url').hide();
-        $('.open_id_connect_auto_discovery_url input[required]').removeAttr('required');
-
-        const provider = $('#oauth2_provider').val();
-        switch (provider) {
-            case 'github':
-            case 'gitlab':
-            case 'gitea':
-                $('.oauth2_use_custom_url').show();
-                break;
-            case 'openidConnect':
-                $('.open_id_connect_auto_discovery_url input').attr('required', 'required');
-                $('.open_id_connect_auto_discovery_url').show();
-                break;
-        }
-        onOAuth2UseCustomURLChange();
-    }
-
-    function onOAuth2UseCustomURLChange() {
-        const provider = $('#oauth2_provider').val();
-        $('.oauth2_use_custom_url_field').hide();
-        $('.oauth2_use_custom_url_field input[required]').removeAttr('required');
-
-        if ($('#oauth2_use_custom_url').is(':checked')) {
-            if (!$('#oauth2_token_url').val()) {
-                $('#oauth2_token_url').val($('#' + provider + '_token_url').val());
-            }
-            if (!$('#oauth2_auth_url').val()) {
-                $('#oauth2_auth_url').val($('#' + provider + '_auth_url').val());
-            }
-            if (!$('#oauth2_profile_url').val()) {
-                $('#oauth2_profile_url').val($('#' + provider + '_profile_url').val());
-            }
-            if (!$('#oauth2_email_url').val()) {
-                $('#oauth2_email_url').val($('#' + provider + '_email_url').val());
-            }
-            switch (provider) {
-                case 'github':
-                    $('.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input, .oauth2_email_url input').attr('required', 'required');
-                    $('.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url, .oauth2_email_url').show();
-                    break;
-                case 'gitea':
-                case 'gitlab':
-                    $('.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input').attr('required', 'required');
-                    $('.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url').show();
-                    $('#oauth2_email_url').val('');
-                    break;
-            }
-        }
-    }
-
-    // New authentication
-    if ($('.admin.new.authentication').length > 0) {
-        $('#auth_type').change(function () {
-            $('.ldap, .dldap, .smtp, .pam, .oauth2, .has-tls .search-page-size').hide();
-
-            $('.ldap input[required], .binddnrequired input[required], .dldap input[required], .smtp input[required], .pam input[required], .oauth2 input[required], .has-tls input[required]').removeAttr('required');
-            $('.binddnrequired').removeClass("required");
-
-            const authType = $(this).val();
-            switch (authType) {
-                case '2':     // LDAP
-                    $('.ldap').show();
-                    $('.binddnrequired input, .ldap div.required:not(.dldap) input').attr('required', 'required');
-                    $('.binddnrequired').addClass("required");
-                    break;
-                case '3':     // SMTP
-                    $('.smtp').show();
-                    $('.has-tls').show();
-                    $('.smtp div.required input, .has-tls').attr('required', 'required');
-                    break;
-                case '4':     // PAM
-                    $('.pam').show();
-                    $('.pam input').attr('required', 'required');
-                    break;
-                case '5':     // LDAP
-                    $('.dldap').show();
-                    $('.dldap div.required:not(.ldap) input').attr('required', 'required');
-                    break;
-                case '6':     // OAuth2
-                    $('.oauth2').show();
-                    $('.oauth2 div.required:not(.oauth2_use_custom_url,.oauth2_use_custom_url_field,.open_id_connect_auto_discovery_url) input').attr('required', 'required');
-                    onOAuth2Change();
-                    break;
-            }
-            if (authType == '2' || authType == '5') {
-                onSecurityProtocolChange()
-            }
-            if (authType == '2') {
-                onUsePagedSearchChange();
-            }
-        });
-        $('#auth_type').change();
-        $('#security_protocol').change(onSecurityProtocolChange);
-        $('#use_paged_search').change(onUsePagedSearchChange);
-        $('#oauth2_provider').change(onOAuth2Change);
-        $('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange);
-    }
-    // Edit authentication
-    if ($('.admin.edit.authentication').length > 0) {
-        const authType = $('#auth_type').val();
-        if (authType == '2' || authType == '5') {
-            $('#security_protocol').change(onSecurityProtocolChange);
-            if (authType == '2') {
-                $('#use_paged_search').change(onUsePagedSearchChange);
-            }
-        } else if (authType == '6') {
-            $('#oauth2_provider').change(onOAuth2Change);
-            $('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange);
-            onOAuth2Change();
-        }
-    }
-
-    // Notice
-    if ($('.admin.notice')) {
-        const $detailModal = $('#detail-modal');
-
-        // Attach view detail modals
-        $('.view-detail').click(function () {
-            $detailModal.find('.content p').text($(this).data('content'));
-            $detailModal.modal('show');
-            return false;
-        });
-
-        // Select actions
-        const $checkboxes = $('.select.table .ui.checkbox');
-        $('.select.action').click(function () {
-            switch ($(this).data('action')) {
-                case 'select-all':
-                    $checkboxes.checkbox('check');
-                    break;
-                case 'deselect-all':
-                    $checkboxes.checkbox('uncheck');
-                    break;
-                case 'inverse':
-                    $checkboxes.checkbox('toggle');
-                    break;
-            }
-        });
-        $('#delete-selection').click(function () {
-            const $this = $(this);
-            $this.addClass("loading disabled");
-            const ids = [];
-            $checkboxes.each(function () {
-                if ($(this).checkbox('is checked')) {
-                    ids.push($(this).data('id'));
-                }
-            });
-            $.post($this.data('link'), {
-                "_csrf": csrf,
-                "ids": ids
-            }).done(function () {
-                window.location.href = $this.data('redirect');
-            });
-        });
-    }
-}
-
-function buttonsClickOnEnter() {
-    $('.ui.button').keypress(function (e) {
-        if (e.keyCode == 13 || e.keyCode == 32) // enter key or space bar
-            $(this).click();
-    });
-}
-
-function searchUsers() {
-    const $searchUserBox = $('#search-user-box');
-    $searchUserBox.search({
-        minCharacters: 2,
-        apiSettings: {
-            url: suburl + '/api/v1/users/search?q={query}',
-            onResponse: function(response) {
-                const items = [];
-                $.each(response.data, function (_i, item) {
-                    let title = item.login;
-                    if (item.full_name && item.full_name.length > 0) {
-                        title += ' (' + htmlEncode(item.full_name) + ')';
-                    }
-                    items.push({
-                        title: title,
-                        image: item.avatar_url
-                    })
-                });
-
-                return { results: items }
-            }
-        },
-        searchFields: ['login', 'full_name'],
-        showNoResults: false
-    });
-}
-
-function searchTeams() {
-    const $searchTeamBox = $('#search-team-box');
-    $searchTeamBox.search({
-        minCharacters: 2,
-        apiSettings: {
-            url: suburl + '/api/v1/orgs/' + $searchTeamBox.data('org') + '/teams/search?q={query}',
-            headers: {"X-Csrf-Token": csrf},
-            onResponse: function(response) {
-                const items = [];
-                $.each(response.data, function (_i, item) {
-                    const title = item.name + ' (' + item.permission + ' access)';
-                    items.push({
-                        title: title,
-                    })
-                });
-
-                return { results: items }
-            }
-        },
-        searchFields: ['name', 'description'],
-        showNoResults: false
-    });
-}
-
-function searchRepositories() {
-    const $searchRepoBox = $('#search-repo-box');
-    $searchRepoBox.search({
-        minCharacters: 2,
-        apiSettings: {
-            url: suburl + '/api/v1/repos/search?q={query}&uid=' + $searchRepoBox.data('uid'),
-            onResponse: function(response) {
-                const items = [];
-                $.each(response.data, function (_i, item) {
-                    items.push({
-                        title: item.full_name.split("/")[1],
-                        description: item.full_name
-                    })
-                });
-
-                return { results: items }
-            }
-        },
-        searchFields: ['full_name'],
-        showNoResults: false
-    });
-}
-
-function initCodeView() {
-    if ($('.code-view .linenums').length > 0) {
-        $(document).on('click', '.lines-num span', function (e) {
-            const $select = $(this);
-            const $list = $select.parent().siblings('.lines-code').find('ol.linenums > li');
-            selectRange($list, $list.filter('[rel=' + $select.attr('id') + ']'), (e.shiftKey ? $list.filter('.active').eq(0) : null));
-            deSelect();
-        });
-
-        $(window).on('hashchange', function () {
-            let m = window.location.hash.match(/^#(L\d+)-(L\d+)$/);
-            const $list = $('.code-view ol.linenums > li');
-            let $first;
-            if (m) {
-                $first = $list.filter('.' + m[1]);
-                selectRange($list, $first, $list.filter('.' + m[2]));
-                $("html, body").scrollTop($first.offset().top - 200);
-                return;
-            }
-            m = window.location.hash.match(/^#(L|n)(\d+)$/);
-            if (m) {
-                $first = $list.filter('.L' + m[2]);
-                selectRange($list, $first);
-                $("html, body").scrollTop($first.offset().top - 200);
-            }
-        }).trigger('hashchange');
-    }
-}
-
-function initU2FAuth() {
-    if($('#wait-for-key').length === 0) {
-        return
-    }
-    u2fApi.ensureSupport()
-        .then(function () {
-            $.getJSON(suburl + '/user/u2f/challenge').success(function(req) {
-                u2fApi.sign(req.appId, req.challenge, req.registeredKeys, 30)
-                    .then(u2fSigned)
-                    .catch(function (err) {
-                        if(err === undefined) {
-                            u2fError(1);
-                            return
-                        }
-                        u2fError(err.metaData.code);
-                    });
-            });
-        }).catch(function () {
-            // Fallback in case browser do not support U2F
-            window.location.href = suburl + "/user/two_factor"
-        })
-}
-function u2fSigned(resp) {
-    $.ajax({
-        url: suburl + '/user/u2f/sign',
-        type: "POST",
-        headers: {"X-Csrf-Token": csrf},
-        data: JSON.stringify(resp),
-        contentType: "application/json; charset=utf-8",
-    }).done(function(res){
-        window.location.replace(res);
-    }).fail(function () {
-        u2fError(1);
-    });
-}
-
-function u2fRegistered(resp) {
-    if (checkError(resp)) {
-        return;
-    }
-    $.ajax({
-        url: suburl + '/user/settings/security/u2f/register',
-        type: "POST",
-        headers: {"X-Csrf-Token": csrf},
-        data: JSON.stringify(resp),
-        contentType: "application/json; charset=utf-8",
-        success: function(){
-            reload();
-        },
-        fail: function () {
-            u2fError(1);
-        }
-    });
-}
-
-function checkError(resp) {
-    if (!('errorCode' in resp)) {
-        return false;
-    }
-    if (resp.errorCode === 0) {
-        return false;
-    }
-    u2fError(resp.errorCode);
-    return true;
-}
-
-
-function u2fError(errorType) {
-    const u2fErrors = {
-        'browser': $('#unsupported-browser'),
-        1: $('#u2f-error-1'),
-        2: $('#u2f-error-2'),
-        3: $('#u2f-error-3'),
-        4: $('#u2f-error-4'),
-        5: $('.u2f-error-5')
-    };
-    u2fErrors[errorType].removeClass('hide');
-    for(const type in u2fErrors){
-        if(type != errorType){
-            u2fErrors[type].addClass('hide');
-        }
-    }
-    $('#u2f-error').modal('show');
-}
-
-function initU2FRegister() {
-    $('#register-device').modal({allowMultiple: false});
-    $('#u2f-error').modal({allowMultiple: false});
-    $('#register-security-key').on('click', function(e) {
-        e.preventDefault();
-        u2fApi.ensureSupport()
-            .then(u2fRegisterRequest)
-            .catch(function() {
-                u2fError('browser');
-            })
-    })
-}
-
-function u2fRegisterRequest() {
-    $.post(suburl + "/user/settings/security/u2f/request_register", {
-        "_csrf": csrf,
-        "name": $('#nickname').val()
-    }).success(function(req) {
-        $("#nickname").closest("div.field").removeClass("error");
-        $('#register-device').modal('show');
-        if(req.registeredKeys === null) {
-            req.registeredKeys = []
-        }
-        u2fApi.register(req.appId, req.registerRequests, req.registeredKeys, 30)
-            .then(u2fRegistered)
-            .catch(function (reason) {
-                if(reason === undefined) {
-                    u2fError(1);
-                    return
-                }
-                u2fError(reason.metaData.code);
-            });
-    }).fail(function(xhr) {
-        if(xhr.status === 409) {
-            $("#nickname").closest("div.field").addClass("error");
-        }
-    });
-}
-
-function initWipTitle() {
-    $(".title_wip_desc > a").click(function (e) {
-        e.preventDefault();
-
-        const $issueTitle = $("#issue_title");
-        $issueTitle.focus();
-        const value = $issueTitle.val().trim().toUpperCase();
-
-        for (const i in wipPrefixes) {
-            if (value.startsWith(wipPrefixes[i].toUpperCase())) {
-                return;
-            }
-        }
-
-        $issueTitle.val(wipPrefixes[0] + " " + $issueTitle.val());
-    });
-}
-
-function initTemplateSearch() {
-    const $repoTemplate = $("#repo_template");
-    const checkTemplate = function() {
-        const $templateUnits = $("#template_units");
-        const $nonTemplate = $("#non_template");
-        if ($repoTemplate.val() !== "") {
-            $templateUnits.show();
-            $nonTemplate.hide();
-        } else {
-            $templateUnits.hide();
-            $nonTemplate.show();
-        }
-    };
-    $repoTemplate.change(checkTemplate);
-    checkTemplate();
-
-    const changeOwner = function() {
-        $("#repo_template_search")
-            .dropdown({
-                apiSettings: {
-                    url: suburl + '/api/v1/repos/search?q={query}&template=true&priority_owner_id=' + $("#uid").val(),
-                    onResponse: function(response) {
-                        const filteredResponse = {'success': true, 'results': []};
-                        filteredResponse.results.push({
-                            'name': '',
-                            'value': ''
-                        });
-                        // Parse the response from the api to work with our dropdown
-                        $.each(response.data, function(_r, repo) {
-                            filteredResponse.results.push({
-                                'name'  : htmlEncode(repo.full_name) ,
-                                'value' : repo.id
-                            });
-                        });
-                        return filteredResponse;
-                    },
-                    cache: false,
-                },
-
-                fullTextSearch: true
-            });
-    };
-    $("#uid").change(changeOwner);
-    changeOwner();
-}
-
-$(document).ready(function () {
-    csrf = $('meta[name=_csrf]').attr("content");
-    suburl = $('meta[name=_suburl]').attr("content");
-
-    // Show exact time
-    $('.time-since').each(function () {
-        $(this).addClass('poping up').attr('data-content', $(this).attr('title')).attr('data-variation', 'inverted tiny').attr('title', '');
-    });
-
-    // Semantic UI modules.
-    $('.dropdown:not(.custom)').dropdown();
-    $('.jump.dropdown').dropdown({
-        action: 'hide',
-        onShow: function () {
-            $('.poping.up').popup('hide');
-        }
-    });
-    $('.slide.up.dropdown').dropdown({
-        transition: 'slide up'
-    });
-    $('.upward.dropdown').dropdown({
-        direction: 'upward'
-    });
-    $('.ui.accordion').accordion();
-    $('.ui.checkbox').checkbox();
-    $('.ui.progress').progress({
-        showActivity: false
-    });
-    $('.poping.up').popup();
-    $('.top.menu .poping.up').popup({
-        onShow: function () {
-            if ($('.top.menu .menu.transition').hasClass('visible')) {
-                return false;
-            }
-        }
-    });
-    $('.tabular.menu .item').tab();
-    $('.tabable.menu .item').tab();
-
-    $('.toggle.button').click(function () {
-        $($(this).data('target')).slideToggle(100);
-    });
-
-    // make table <tr> element clickable like a link
-    $('tr[data-href]').click(function() {
-        window.location = $(this).data('href');
-    });
-
-    // Highlight JS
-    if (typeof hljs != 'undefined') {
-        const nodes = [].slice.call(document.querySelectorAll('pre code') || []);
-        for (let i = 0; i < nodes.length; i++) {
-            hljs.highlightBlock(nodes[i]);
-        }
-    }
-
-    // Dropzone
-    const $dropzone = $('#dropzone');
-    if ($dropzone.length > 0) {
-        const filenameDict = {};
-
-        new Dropzone("#dropzone", {
-            url: $dropzone.data('upload-url'),
-            headers: {"X-Csrf-Token": csrf},
-            maxFiles: $dropzone.data('max-file'),
-            maxFilesize: $dropzone.data('max-size'),
-            acceptedFiles: ($dropzone.data('accepts') === '*/*') ? null : $dropzone.data('accepts'),
-            addRemoveLinks: true,
-            dictDefaultMessage: $dropzone.data('default-message'),
-            dictInvalidFileType: $dropzone.data('invalid-input-type'),
-            dictFileTooBig: $dropzone.data('file-too-big'),
-            dictRemoveFile: $dropzone.data('remove-file'),
-            init: function () {
-                this.on("success", function (file, data) {
-                    filenameDict[file.name] = data.uuid;
-                    const input = $('<input id="' + data.uuid + '" name="files" type="hidden">').val(data.uuid);
-                    $('.files').append(input);
-                });
-                this.on("removedfile", function (file) {
-                    if (file.name in filenameDict) {
-                        $('#' + filenameDict[file.name]).remove();
-                    }
-                    if ($dropzone.data('remove-url') && $dropzone.data('csrf')) {
-                        $.post($dropzone.data('remove-url'), {
-                            file: filenameDict[file.name],
-                            _csrf: $dropzone.data('csrf')
-                        });
-                    }
-                })
-            },
-        });
-    }
-
-    // Emojify
-    emojify.setConfig({
-        img_dir: suburl + '/vendor/plugins/emojify/images',
-        ignore_emoticons: true
-    });
-    const hasEmoji = document.getElementsByClassName('has-emoji');
-    for (let i = 0; i < hasEmoji.length; i++) {
-        emojify.run(hasEmoji[i]);
-        for (let j = 0; j < hasEmoji[i].childNodes.length; j++) {
-            if (hasEmoji[i].childNodes[j].nodeName === "A") {
-                emojify.run(hasEmoji[i].childNodes[j])
-            }
-        }
-    }
-
-    // Clipboard JS
-    const clipboard = new Clipboard('.clipboard');
-    clipboard.on('success', function (e) {
-        e.clearSelection();
-
-        $('#' + e.trigger.getAttribute('id')).popup('destroy');
-        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-success'))
-        $('#' + e.trigger.getAttribute('id')).popup('show');
-        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original'))
-    });
-
-    clipboard.on('error', function (e) {
-        $('#' + e.trigger.getAttribute('id')).popup('destroy');
-        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-error'))
-        $('#' + e.trigger.getAttribute('id')).popup('show');
-        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original'))
-    });
-
-    // Helpers.
-    $('.delete-button').click(showDeletePopup);
-    $('.add-all-button').click(showAddAllPopup);
-
-    $('.delete-branch-button').click(showDeletePopup);
-
-    $('.undo-button').click(function() {
-        const $this = $(this);
-        $.post($this.data('url'), {
-            "_csrf": csrf,
-            "id": $this.data("id")
-        }).done(function(data) {
-            window.location.href = data.redirect;
-        });
-    });
-    $('.show-panel.button').click(function () {
-        $($(this).data('panel')).show();
-    });
-    $('.show-modal.button').click(function () {
-        $($(this).data('modal')).modal('show');
-    });
-    $('.delete-post.button').click(function () {
-        const $this = $(this);
-        $.post($this.data('request-url'), {
-            "_csrf": csrf
-        }).done(function () {
-            window.location.href = $this.data('done-url');
-        });
-    });
-
-    // Set anchor.
-    $('.markdown').each(function () {
-        const headers = {};
-        $(this).find('h1, h2, h3, h4, h5, h6').each(function () {
-            let node = $(this);
-            const val = encodeURIComponent(node.text().toLowerCase().replace(/[^\u00C0-\u1FFF\u2C00-\uD7FF\w\- ]/g, '').replace(/[ ]/g, '-'));
-            let name = val;
-            if (headers[val] > 0) {
-                name = val + '-' + headers[val];
-            }
-            if (headers[val] == undefined) {
-                headers[val] = 1;
-            } else {
-                headers[val] += 1;
-            }
-            node = node.wrap('<div id="' + name + '" class="anchor-wrap" ></div>');
-            node.append('<a class="anchor" href="#' + name + '"><span class="octicon octicon-link"></span></a>');
-        });
-    });
-
-    $('.issue-checkbox').click(function() {
-        const numChecked = $('.issue-checkbox').children('input:checked').length;
-        if (numChecked > 0) {
-            $('#issue-filters').addClass("hide");
-            $('#issue-actions').removeClass("hide");
-        } else {
-            $('#issue-filters').removeClass("hide");
-            $('#issue-actions').addClass("hide");
-        }
-    });
-
-    $('.issue-action').click(function () {
-        let action = this.dataset.action;
-        let elementId = this.dataset.elementId;
-        const issueIDs = $('.issue-checkbox').children('input:checked').map(function() {
-            return this.dataset.issueId;
-        }).get().join();
-        const url = this.dataset.url;
-        if (elementId === '0' && url.substr(-9) === '/assignee'){
-            elementId = '';
-            action = 'clear';
-        }
-        updateIssuesMeta(url, action, issueIDs, elementId).then(function() {
-            // NOTICE: This reset of checkbox state targets Firefox caching behaviour, as the checkboxes stay checked after reload
-            if (action === "close" || action === "open" ){
-                //uncheck all checkboxes
-                $('.issue-checkbox input[type="checkbox"]').each(function(_,e){ e.checked = false; });
-            }
-            reload();
-        });
-    });
-
-    // NOTICE: This event trigger targets Firefox caching behaviour, as the checkboxes stay checked after reload
-    // trigger ckecked event, if checkboxes are checked on load
-    $('.issue-checkbox input[type="checkbox"]:checked').first().each(function(_,e) {
-        e.checked = false;
-        $(e).click();
-    });
-
-    buttonsClickOnEnter();
-    searchUsers();
-    searchTeams();
-    searchRepositories();
-
-    initCommentForm();
-    initInstall();
-    initRepository();
-    initMigration();
-    initWikiForm();
-    initEditForm();
-    initEditor();
-    initOrganization();
-    initWebhook();
-    initAdmin();
-    initCodeView();
-    initVueApp();
-    initTeamSettings();
-    initCtrlEnterSubmit();
-    initNavbarContentToggle();
-    initTopicbar();
-    initU2FAuth();
-    initU2FRegister();
-    initIssueList();
-    initWipTitle();
-    initPullRequestReview();
-    initRepoStatusChecker();
-    initTemplateSearch();
-
-    // Repo clone url.
-    if ($('#repo-clone-url').length > 0) {
-        switch (localStorage.getItem('repo-clone-protocol')) {
-            case 'ssh':
-                if ($('#repo-clone-ssh').click().length === 0) {
-                    $('#repo-clone-https').click();
-                }
-                break;
-            default:
-                $('#repo-clone-https').click();
-                break;
-        }
-    }
-
-    const routes = {
-        'div.user.settings': initUserSettings,
-        'div.repository.settings.collaboration': initRepositoryCollaboration
-    };
-
-    let selector;
-    for (selector in routes) {
-        if ($(selector).length > 0) {
-            routes[selector]();
-            break;
-        }
-    }
-
-    const $cloneAddr = $('#clone_addr');
-    $cloneAddr.change(function() {
-        const $repoName = $('#repo_name');
-        if ($cloneAddr.val().length > 0 && $repoName.val().length === 0) { // Only modify if repo_name input is blank
-            $repoName.val($cloneAddr.val().match(/^(.*\/)?((.+?)(\.git)?)$/)[3]);
-        }
-    });
-});
-
-function changeHash(hash) {
-    if (history.pushState) {
-        history.pushState(null, null, hash);
-    }
-    else {
-        location.hash = hash;
-    }
-}
-
-function deSelect() {
-    if (window.getSelection) {
-        window.getSelection().removeAllRanges();
-    } else {
-        document.selection.empty();
-    }
-}
-
-function selectRange($list, $select, $from) {
-    $list.removeClass('active');
-    if ($from) {
-        let a = parseInt($select.attr('rel').substr(1));
-        let b = parseInt($from.attr('rel').substr(1));
-        let c;
-        if (a != b) {
-            if (a > b) {
-                c = a;
-                a = b;
-                b = c;
-            }
-            const classes = [];
-            for (let i = a; i <= b; i++) {
-                classes.push('.L' + i);
-            }
-            $list.filter(classes.join(',')).addClass('active');
-            changeHash('#L' + a + '-' + 'L' + b);
-            return
-        }
-    }
-    $select.addClass('active');
-    changeHash('#' + $select.attr('rel'));
-}
-
-$(function () {
-    // Warn users that try to leave a page after entering data into a form.
-    // Except on sign-in pages, and for forms marked as 'ignore-dirty'.
-    if ($('.user.signin').length === 0) {
-      $('form:not(.ignore-dirty)').areYouSure();
-    }
-
-    // Parse SSH Key
-    $("#ssh-key-content").on('change paste keyup',function(){
-        const arrays = $(this).val().split(" ");
-        const $title = $("#ssh-key-title")
-        if ($title.val() === "" && arrays.length === 3 && arrays[2] !== "") {
-            $title.val(arrays[2]);
-        }
-    });
-});
-
-function showDeletePopup() {
-    const $this = $(this);
-    let filter = "";
-    if ($this.attr("id")) {
-        filter += "#" + $this.attr("id")
-    }
-
-    const dialog = $('.delete.modal' + filter);
-    dialog.find('.name').text($this.data('name'));
-
-    dialog.modal({
-        closable: false,
-        onApprove: function() {
-            if ($this.data('type') == "form") {
-                $($this.data('form')).submit();
-                return;
-            }
-
-            $.post($this.data('url'), {
-                "_csrf": csrf,
-                "id": $this.data("id")
-            }).done(function(data) {
-                window.location.href = data.redirect;
-            });
-        }
-    }).modal('show');
-    return false;
-}
-
-function showAddAllPopup() {
-    const $this = $(this);
-    let filter = "";
-    if ($this.attr("id")) {
-        filter += "#" + $this.attr("id")
-    }
-
-    const dialog = $('.addall.modal' + filter);
-    dialog.find('.name').text($this.data('name'));
-
-    dialog.modal({
-        closable: false,
-        onApprove: function() {
-            if ($this.data('type') == "form") {
-                $($this.data('form')).submit();
-                return;
-            }
-
-            $.post($this.data('url'), {
-                "_csrf": csrf,
-                "id": $this.data("id")
-            }).done(function(data) {
-                window.location.href = data.redirect;
-            });
-        }
-    }).modal('show');
-    return false;
-}
-
-function initVueComponents(){
-    const vueDelimeters = ['${', '}'];
-
-    Vue.component('repo-search', {
-        delimiters: vueDelimeters,
-
-        props: {
-            searchLimit: {
-                type: Number,
-                default: 10
-            },
-            suburl: {
-                type: String,
-                required: true
-            },
-            uid: {
-                type: Number,
-                required: true
-            },
-            organizations: {
-                type: Array,
-                default: []
-            },
-            isOrganization: {
-                type: Boolean,
-                default: true
-            },
-            canCreateOrganization: {
-                type: Boolean,
-                default: false
-            },
-            organizationsTotalCount: {
-                type: Number,
-                default: 0
-            },
-            moreReposLink: {
-                type: String,
-                default: ''
-            }
-        },
-
-        data: function() {
-            return {
-                tab: 'repos',
-                repos: [],
-                reposTotalCount: 0,
-                reposFilter: 'all',
-                searchQuery: '',
-                isLoading: false,
-                repoTypes: {
-                    'all': {
-                        count: 0,
-                        searchMode: '',
-                    },
-                    'forks': {
-                        count: 0,
-                        searchMode: 'fork',
-                    },
-                    'mirrors': {
-                        count: 0,
-                        searchMode: 'mirror',
-                    },
-                    'sources': {
-                        count: 0,
-                        searchMode: 'source',
-                    },
-                    'collaborative': {
-                        count: 0,
-                        searchMode: 'collaborative',
-                    },
-                }
-            }
-        },
-
-        computed: {
-            showMoreReposLink: function() {
-                return this.repos.length > 0 && this.repos.length < this.repoTypes[this.reposFilter].count;
-            },
-            searchURL: function() {
-                return this.suburl + '/api/v1/repos/search?sort=updated&order=desc&uid=' + this.uid + '&q=' + this.searchQuery
-                                   + '&limit=' + this.searchLimit + '&mode=' + this.repoTypes[this.reposFilter].searchMode
-                                   + (this.reposFilter !== 'all' ? '&exclusive=1' : '');
-            },
-            repoTypeCount: function() {
-                return this.repoTypes[this.reposFilter].count;
-            }
-        },
-
-        mounted: function() {
-            this.searchRepos(this.reposFilter);
-
-            const self = this;
-            Vue.nextTick(function() {
-                self.$refs.search.focus();
-            });
-        },
-
-        methods: {
-            changeTab: function(t) {
-                this.tab = t;
-            },
-
-            changeReposFilter: function(filter) {
-                this.reposFilter = filter;
-                this.repos = [];
-                this.repoTypes[filter].count = 0;
-                this.searchRepos(filter);
-            },
-
-            showRepo: function(repo, filter) {
-                switch (filter) {
-                    case 'sources':
-                        return repo.owner.id == this.uid && !repo.mirror && !repo.fork;
-                    case 'forks':
-                        return repo.owner.id == this.uid && !repo.mirror && repo.fork;
-                    case 'mirrors':
-                        return repo.mirror;
-                    case 'collaborative':
-                        return repo.owner.id != this.uid && !repo.mirror;
-                    default:
-                        return true;
-                }
-            },
-
-            searchRepos: function(reposFilter) {
-                const self = this;
-
-                this.isLoading = true;
-
-                const searchedMode = this.repoTypes[reposFilter].searchMode;
-                const searchedURL = this.searchURL;
-                const searchedQuery = this.searchQuery;
-
-                $.getJSON(searchedURL, function(result, _textStatus, request) {
-                    if (searchedURL == self.searchURL) {
-                        self.repos = result.data;
-                        const count = request.getResponseHeader('X-Total-Count');
-                        if (searchedQuery === '' && searchedMode === '') {
-                            self.reposTotalCount = count;
-                        }
-                        self.repoTypes[reposFilter].count = count;
-                    }
-                }).always(function() {
-                    if (searchedURL == self.searchURL) {
-                        self.isLoading = false;
-                    }
-                });
-            },
-
-            repoClass: function(repo) {
-                if (repo.fork) {
-                    return 'octicon octicon-repo-forked';
-                } else if (repo.mirror) {
-                    return 'octicon octicon-repo-clone';
-                } else if (repo.private) {
-                    return 'octicon octicon-lock';
-                } else {
-                    return 'octicon octicon-repo';
-                }
-            }
-        }
-    })
-}
-
-function initCtrlEnterSubmit() {
-    $(".js-quick-submit").keydown(function(e) {
-        if (((e.ctrlKey && !e.altKey) || e.metaKey) && (e.keyCode == 13 || e.keyCode == 10)) {
-            $(this).closest("form").submit();
-        }
-    });
-}
-
-function initVueApp() {
-    const el = document.getElementById('app');
-    if (!el) {
-        return;
-    }
-
-    initVueComponents();
-
-    new Vue({
-        delimiters: ['${', '}'],
-        el: el,
-
-        data: {
-            searchLimit: document.querySelector('meta[name=_search_limit]').content,
-            suburl: document.querySelector('meta[name=_suburl]').content,
-            uid: document.querySelector('meta[name=_context_uid]').content,
-        },
-    });
-}
-
-function timeAddManual() {
-    $('.mini.modal')
-        .modal({
-            duration: 200,
-            onApprove: function() {
-                $('#add_time_manual_form').submit();
-            }
-        }).modal('show')
-    ;
-}
-
-function toggleStopwatch() {
-    $("#toggle_stopwatch_form").submit();
-}
-function cancelStopwatch() {
-    $("#cancel_stopwatch_form").submit();
-}
-
-function initHeatmap(appElementId, heatmapUser, locale) {
-    const el = document.getElementById(appElementId);
-    if (!el) {
-        return;
-    }
-
-    locale = locale || {};
-
-    locale.contributions = locale.contributions || 'contributions';
-    locale.no_contributions = locale.no_contributions || 'No contributions';
-
-    const vueDelimeters = ['${', '}'];
-
-    Vue.component('activity-heatmap', {
-        delimiters: vueDelimeters,
-
-        props: {
-            user: {
-                type: String,
-                required: true
-            },
-            suburl: {
-                type: String,
-                required: true
-            },
-            locale: {
-                type: Object,
-                required: true
-            }
-        },
-
-        data: function () {
-            return {
-                isLoading: true,
-                colorRange: [],
-                endDate: null,
-                values: [],
-                totalContributions: 0,
-            };
-        },
-
-        mounted: function() {
-            this.colorRange = [
-                this.getColor(0),
-                this.getColor(1),
-                this.getColor(2),
-                this.getColor(3),
-                this.getColor(4),
-                this.getColor(5)
-            ];
-            this.endDate = new Date();
-            this.loadHeatmap(this.user);
-        },
-
-        methods: {
-            loadHeatmap: function(userName) {
-                const self = this;
-                $.get(this.suburl + '/api/v1/users/' + userName + '/heatmap', function(chartRawData) {
-                    const chartData = [];
-                    for (let i = 0; i < chartRawData.length; i++) {
-                        self.totalContributions += chartRawData[i].contributions;
-                        chartData[i] = { date: new Date(chartRawData[i].timestamp * 1000), count: chartRawData[i].contributions };
-                    }
-                    self.values = chartData;
-                    self.isLoading = false;
-                });
-            },
-
-            getColor: function(idx) {
-                const el = document.createElement('div');
-                el.className = 'heatmap-color-' + idx;
-                document.body.appendChild(el);
-
-                const color = getComputedStyle(el).backgroundColor;
-
-                document.body.removeChild(el);
-
-                return color;
-            }
-        },
-
-        template: '<div><div v-show="isLoading"><slot name="loading"></slot></div><h4 class="total-contributions" v-if="!isLoading"><span v-html="totalContributions"></span> total contributions in the last 12 months</h4><calendar-heatmap v-show="!isLoading" :locale="locale" :no-data-text="locale.no_contributions" :tooltip-unit="locale.contributions" :end-date="endDate" :values="values" :range-color="colorRange" />'
-    });
-
-    new Vue({
-        delimiters: vueDelimeters,
-        el: el,
-
-        data: {
-            suburl: document.querySelector('meta[name=_suburl]').content,
-            heatmapUser: heatmapUser,
-            locale: locale
-        },
-    });
-}
-
-function initFilterBranchTagDropdown(selector) {
-    $(selector).each(function() {
-        const $dropdown = $(this);
-        const $data = $dropdown.find('.data');
-        const data = {
-            items: [],
-            mode: $data.data('mode'),
-            searchTerm: '',
-            noResults: '',
-            canCreateBranch: false,
-            menuVisible: false,
-            active: 0
-        };
-        $data.find('.item').each(function() {
-            data.items.push({
-                name: $(this).text(),
-                url: $(this).data('url'),
-                branch: $(this).hasClass('branch'),
-                tag: $(this).hasClass('tag'),
-                selected: $(this).hasClass('selected')
-            });
-        });
-        $data.remove();
-        new Vue({
-            delimiters: ['${', '}'],
-            el: this,
-            data: data,
-
-            beforeMount: function () {
-                const vm = this;
-
-                this.noResults = vm.$el.getAttribute('data-no-results');
-                this.canCreateBranch = vm.$el.getAttribute('data-can-create-branch') === 'true';
-
-                document.body.addEventListener('click', function(event) {
-                    if (vm.$el.contains(event.target)) {
-                        return;
-                    }
-                    if (vm.menuVisible) {
-                        Vue.set(vm, 'menuVisible', false);
-                    }
-                });
-            },
-
-            watch: {
-                menuVisible: function(visible) {
-                    if (visible) {
-                        this.focusSearchField();
-                    }
-                }
-            },
-
-            computed: {
-                filteredItems: function() {
-                    const vm = this;
-
-                    const items = vm.items.filter(function (item) {
-                        return ((vm.mode === 'branches' && item.branch)
-                                || (vm.mode === 'tags' && item.tag))
-                            && (!vm.searchTerm
-                                || item.name.toLowerCase().indexOf(vm.searchTerm.toLowerCase()) >= 0);
-                    });
-
-                    vm.active = (items.length === 0 && vm.showCreateNewBranch ? 0 : -1);
-
-                    return items;
-                },
-                showNoResults: function() {
-                    return this.filteredItems.length === 0
-                            && !this.showCreateNewBranch;
-                },
-                showCreateNewBranch: function() {
-                    const vm = this;
-                    if (!this.canCreateBranch || !vm.searchTerm || vm.mode === 'tags') {
-                        return false;
-                    }
-
-                    return vm.items.filter(function (item) {
-                        return item.name.toLowerCase() === vm.searchTerm.toLowerCase()
-                    }).length === 0;
-                }
-            },
-
-            methods: {
-                selectItem: function(item) {
-                    const prev = this.getSelected();
-                    if (prev !== null) {
-                        prev.selected = false;
-                    }
-                    item.selected = true;
-                    window.location.href = item.url;
-                },
-                createNewBranch: function() {
-                    if (!this.showCreateNewBranch) {
-                        return;
-                    }
-                    this.$refs.newBranchForm.submit();
-                },
-                focusSearchField: function() {
-                    const vm = this;
-                    Vue.nextTick(function() {
-                        vm.$refs.searchField.focus();
-                    });
-                },
-                getSelected: function() {
-                    for (let i = 0, j = this.items.length; i < j; ++i) {
-                        if (this.items[i].selected)
-                            return this.items[i];
-                    }
-                    return null;
-                },
-                getSelectedIndexInFiltered: function() {
-                    for (let i = 0, j = this.filteredItems.length; i < j; ++i) {
-                        if (this.filteredItems[i].selected)
-                            return i;
-                    }
-                    return -1;
-                },
-                scrollToActive: function() {
-                    let el = this.$refs['listItem' + this.active];
-                    if (!el || el.length === 0) {
-                        return;
-                    }
-                    if (Array.isArray(el)) {
-                        el = el[0];
-                    }
-
-                    const cont = this.$refs.scrollContainer;
-
-                     if (el.offsetTop < cont.scrollTop) {
-                         cont.scrollTop = el.offsetTop;
-                     }
-                     else if (el.offsetTop + el.clientHeight > cont.scrollTop + cont.clientHeight) {
-                        cont.scrollTop = el.offsetTop + el.clientHeight - cont.clientHeight;
-                    }
-                },
-                keydown: function(event) {
-                    const vm = this;
-                    if (event.keyCode === 40) {
-                        // arrow down
-                        event.preventDefault();
-
-                        if (vm.active === -1) {
-                            vm.active = vm.getSelectedIndexInFiltered();
-                        }
-
-                        if (vm.active + (vm.showCreateNewBranch ? 0 : 1) >= vm.filteredItems.length) {
-                            return;
-                        }
-                        vm.active++;
-                        vm.scrollToActive();
-                    }
-                    if (event.keyCode === 38) {
-                        // arrow up
-                        event.preventDefault();
-
-                         if (vm.active === -1) {
-                            vm.active = vm.getSelectedIndexInFiltered();
-                        }
-
-                         if (vm.active <= 0) {
-                            return;
-                        }
-                        vm.active--;
-                        vm.scrollToActive();
-                    }
-                    if (event.keyCode == 13) {
-                        // enter
-                        event.preventDefault();
-
-                         if (vm.active >= vm.filteredItems.length) {
-                            vm.createNewBranch();
-                        } else if (vm.active >= 0) {
-                            vm.selectItem(vm.filteredItems[vm.active]);
-                        }
-                    }
-                    if (event.keyCode == 27) {
-                        // escape
-                        event.preventDefault();
-                        vm.menuVisible = false;
-                    }
-                }
-            }
-        });
-    });
-}
-
-$(".commit-button").click(function(e) {
-    e.preventDefault();
-    $(this).parent().find('.commit-body').toggle();
-});
-
-function initNavbarContentToggle() {
-    const content = $('#navbar');
-    const toggle = $('#navbar-expand-toggle');
-    let isExpanded = false;
-    toggle.click(function() {
-        isExpanded = !isExpanded;
-        if (isExpanded) {
-            content.addClass('shown');
-            toggle.addClass('active');
-        }
-        else {
-            content.removeClass('shown');
-            toggle.removeClass('active');
-        }
-    });
-}
-
-function initTopicbar() {
-    const mgrBtn = $("#manage_topic");
-    const editDiv = $("#topic_edit");
-    const viewDiv = $("#repo-topics");
-    const saveBtn = $("#save_topic");
-    const topicDropdown = $('#topic_edit .dropdown');
-    const topicForm = $('#topic_edit.ui.form');
-    const topicPrompts = getPrompts();
-
-    mgrBtn.click(function() {
-        viewDiv.hide();
-        editDiv.css('display', ''); // show Semantic UI Grid
-    });
-
-    function getPrompts() {
-        const hidePrompt = $("div.hide#validate_prompt"),
-            prompts = {
-                countPrompt: hidePrompt.children('#count_prompt').text(),
-                formatPrompt: hidePrompt.children('#format_prompt').text()
-            };
-        hidePrompt.remove();
-        return prompts;
-    }
-
-    saveBtn.click(function() {
-        const topics = $("input[name=topics]").val();
-
-        $.post(saveBtn.data('link'), {
-            "_csrf": csrf,
-            "topics": topics
-        }, function(_data, _textStatus, xhr){
-            if (xhr.responseJSON.status === 'ok') {
-                viewDiv.children(".topic").remove();
-                if (topics.length) {
-                    const topicArray = topics.split(",");
-
-                    const last = viewDiv.children("a").last();
-                    for (let i=0; i < topicArray.length; i++) {
-                        $('<div class="ui small label topic" style="cursor:pointer;">'+topicArray[i]+'</div>').insertBefore(last)
-                    }
-                }
-                editDiv.css('display', 'none');
-                viewDiv.show();
-            }
-        }).fail(function(xhr){
-            if (xhr.status === 422) {
-                if (xhr.responseJSON.invalidTopics.length > 0) {
-                    topicPrompts.formatPrompt = xhr.responseJSON.message;
-
-                    const invalidTopics = xhr.responseJSON.invalidTopics,
-                        topicLables = topicDropdown.children('a.ui.label');
-
-                    topics.split(',').forEach(function(value, index) {
-                        for (let i=0; i < invalidTopics.length; i++) {
-                            if (invalidTopics[i] === value) {
-                                topicLables.eq(index).removeClass("green").addClass("red");
-                            }
-                        }
-                    });
-                } else {
-                    topicPrompts.countPrompt = xhr.responseJSON.message;
-                }
-            }
-        }).always(function() {
-            topicForm.form('validate form');
-        });
-    });
-
-    topicDropdown.dropdown({
-        allowAdditions: true,
-        forceSelection: false,
-        fields: { name: "description", value: "data-value" },
-        saveRemoteData: false,
-        label: {
-            transition : 'horizontal flip',
-            duration   : 200,
-            variation  : false,
-            blue : true,
-            basic: true,
-        },
-        className: {
-            label: 'ui small label'
-        },
-        apiSettings: {
-            url: suburl + '/api/v1/topics/search?q={query}',
-            throttle: 500,
-            cache: false,
-            onResponse: function(res) {
-                const formattedResponse = {
-                    success: false,
-                    results: [],
-                };
-                const stripTags = function (text) {
-                    return text.replace(/<[^>]*>?/gm, "");
-                };
-
-                const query = stripTags(this.urlData.query.trim());
-                let found_query = false;
-                const current_topics = [];
-                topicDropdown.find('div.label.visible.topic,a.label.visible').each(function(_,e){ current_topics.push(e.dataset.value); });
-
-                if (res.topics) {
-                    let found = false;
-                    for (let i=0;i < res.topics.length;i++) {
-                        // skip currently added tags
-                        if (current_topics.indexOf(res.topics[i].topic_name) != -1){
-                            continue;
-                        }
-
-                        if (res.topics[i].topic_name.toLowerCase() === query.toLowerCase()){
-                            found_query = true;
-                        }
-                        formattedResponse.results.push({"description": res.topics[i].topic_name, "data-value": res.topics[i].topic_name});
-                        found = true;
-                    }
-                    formattedResponse.success = found;
-                }
-
-                if (query.length > 0 && !found_query){
-                    formattedResponse.success = true;
-                    formattedResponse.results.unshift({"description": query, "data-value": query});
-                } else if (query.length > 0 && found_query) {
-                    formattedResponse.results.sort(function(a, b){
-                        if (a.description.toLowerCase() === query.toLowerCase()) return -1;
-                        if (b.description.toLowerCase() === query.toLowerCase()) return 1;
-                        if (a.description > b.description) return -1;
-                        if (a.description < b.description) return 1;
-                        return 0;
-                    });
-                }
-
-
-                return formattedResponse;
-            },
-        },
-        onLabelCreate: function(value) {
-            value = value.toLowerCase().trim();
-            this.attr("data-value", value).contents().first().replaceWith(value);
-            return $(this);
-        },
-        onAdd: function(addedValue, _addedText, $addedChoice) {
-            addedValue = addedValue.toLowerCase().trim();
-            $($addedChoice).attr('data-value', addedValue);
-            $($addedChoice).attr('data-text', addedValue);
-        }
-    });
-
-    $.fn.form.settings.rules.validateTopic = function(_values, regExp) {
-        const topics = topicDropdown.children('a.ui.label'),
-            status = topics.length === 0 || topics.last().attr("data-value").match(regExp);
-        if (!status) {
-            topics.last().removeClass("green").addClass("red");
-        }
-        return status && topicDropdown.children('a.ui.label.red').length === 0;
-    };
-
-    topicForm.form({
-            on: 'change',
-            inline : true,
-            fields: {
-                topics: {
-                    identifier: 'topics',
-                    rules: [
-                        {
-                            type: 'validateTopic',
-                            value: /^[a-z0-9][a-z0-9-]{1,35}$/,
-                            prompt: topicPrompts.formatPrompt
-                        },
-                        {
-                            type: 'maxCount[25]',
-                            prompt: topicPrompts.countPrompt
-                        }
-                    ]
-                },
-            }
-        });
-}
-function toggleDeadlineForm() {
-    $('#deadlineForm').fadeToggle(150);
-}
-
-function setDeadline() {
-    const deadline = $('#deadlineDate').val();
-    updateDeadline(deadline);
-}
-
-function updateDeadline(deadlineString) {
-    $('#deadline-err-invalid-date').hide();
-    $('#deadline-loader').addClass('loading');
-
-    let realDeadline = null;
-    if (deadlineString !== '') {
-
-        const newDate = Date.parse(deadlineString)
-
-        if (isNaN(newDate)) {
-            $('#deadline-loader').removeClass('loading');
-            $('#deadline-err-invalid-date').show();
-            return false;
-        }
-        realDeadline = new Date(newDate);
-    }
-
-    $.ajax($('#update-issue-deadline-form').attr('action') + '/deadline', {
-        data: JSON.stringify({
-            'due_date': realDeadline,
-        }),
-        headers: {
-            'X-Csrf-Token': csrf,
-            'X-Remote': true,
-        },
-        contentType: 'application/json',
-        type: 'POST',
-        success: function () {
-            reload();
-        },
-        error: function () {
-            $('#deadline-loader').removeClass('loading');
-            $('#deadline-err-invalid-date').show();
-        }
-    });
-}
-
-function deleteDependencyModal(id, type) {
-    $('.remove-dependency')
-        .modal({
-            closable: false,
-            duration: 200,
-            onApprove: function () {
-                $('#removeDependencyID').val(id);
-                $('#dependencyType').val(type);
-                $('#removeDependencyForm').submit();
-            }
-        }).modal('show')
-    ;
-}
-
-function initIssueList() {
-    const repolink = $('#repolink').val();
-    const repoId = $('#repoId').val();
-    const crossRepoSearch = $('#crossRepoSearch').val();
-    let issueSearchUrl = suburl + '/api/v1/repos/' + repolink + '/issues?q={query}';
-    if (crossRepoSearch === 'true') {
-        issueSearchUrl = suburl + '/api/v1/repos/issues/search?q={query}&priority_repo_id=' + repoId;
-    }
-    $('#new-dependency-drop-list')
-        .dropdown({
-            apiSettings: {
-                url: issueSearchUrl,
-                onResponse: function(response) {
-                    const filteredResponse = {'success': true, 'results': []};
-                    const currIssueId = $('#new-dependency-drop-list').data('issue-id');
-                    // Parse the response from the api to work with our dropdown
-                    $.each(response, function(_i, issue) {
-                        // Don't list current issue in the dependency list.
-                        if(issue.id === currIssueId) {
-                            return;
-                        }
-                        filteredResponse.results.push({
-                            'name'  : '#' + issue.number + ' ' + htmlEncode(issue.title) +
-                                '<div class="text small dont-break-out">' + htmlEncode(issue.repository.full_name) + '</div>',
-                            'value' : issue.id
-                        });
-                    });
-                    return filteredResponse;
-                },
-                cache: false,
-            },
-
-            fullTextSearch: true
-        });
-
-    $(".menu a.label-filter-item").each(function() {
-        $(this).click(function(e) {
-            if (e.altKey) {
-                e.preventDefault();
-
-                const href = $(this).attr("href");
-                const id = $(this).data("label-id");
-
-                const regStr = "labels=(-?[0-9]+%2c)*(" + id + ")(%2c-?[0-9]+)*&";
-                const newStr = "labels=$1-$2$3&";
-
-                window.location = href.replace(new RegExp(regStr), newStr);
-            }
-        });
-    });
-
-    $(".menu .ui.dropdown.label-filter").keydown(function(e) {
-        if (e.altKey && e.keyCode == 13) {
-            const selectedItems = $(".menu .ui.dropdown.label-filter .menu .item.selected");
-
-            if (selectedItems.length > 0) {
-                const item = $(selectedItems[0]);
-
-                const href = item.attr("href");
-                const id = item.data("label-id");
-
-                const regStr = "labels=(-?[0-9]+%2c)*(" + id + ")(%2c-?[0-9]+)*&";
-                const newStr = "labels=$1-$2$3&";
-
-                window.location = href.replace(new RegExp(regStr), newStr);
-            }
-        }
-    });
-}
-function cancelCodeComment(btn) {
-    const form = $(btn).closest("form");
-    if(form.length > 0 && form.hasClass('comment-form')) {
-        form.addClass('hide');
-        form.parent().find('button.comment-form-reply').show();
-    } else {
-        form.closest('.comment-code-cloud').remove()
-    }
-}
-function onOAuthLoginClick() {
-    const oauthLoader = $('#oauth2-login-loader');
-    const oauthNav = $('#oauth2-login-navigator');
-
-    oauthNav.hide();
-    oauthLoader.removeClass('disabled');
-
-    setTimeout(function(){
-        // recover previous content to let user try again
-        // usually redirection will be performed before this action
-        oauthLoader.addClass('disabled');
-        oauthNav.show();
-    },5000);
-}
+!function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function i(e){return jQuery("<div />").text(e).html()}let o,a,s,r,c;function l(e){const t=e.find(".tabular.menu");t.find(".item").tab(),t.find('.item[data-tab="'+t.data("preview")+'"]').click((function(){const n=$(this);$.post(n.data("url"),{_csrf:o,mode:"gfm",context:n.data("context"),text:e.find('.tab.segment[data-tab="'+t.data("write")+'"] textarea').val()},(function(n){const i=e.find('.tab.segment[data-tab="'+t.data("preview")+'"]');i.html(n),emojify.run(i[0]),$("pre code",i[0]).each((function(){hljs.highlightBlock(this)}))}))})),k()}function d(){0!=$(".edit.form").length&&(function(e){const t=e.find(".tabular.menu");t.find(".item").tab();const n=t.find('.item[data-tab="'+t.data("preview")+'"]');n.length&&(s=n.data("preview-file-modes").split(","),n.click((function(){const n=$(this);$.post(n.data("url"),{_csrf:o,mode:"gfm",context:n.data("context"),text:e.find('.tab.segment[data-tab="'+t.data("write")+'"] textarea').val()},(function(n){const i=e.find('.tab.segment[data-tab="'+t.data("preview")+'"]');i.html(n),emojify.run(i[0]),$("pre code",i[0]).each((function(){hljs.highlightBlock(this)}))}))})))}($(".edit.form")),function(e){const t=e.find(".tabular.menu");t.find(".item").tab(),t.find('.item[data-tab="'+t.data("diff")+'"]').click((function(){const n=$(this);$.post(n.data("url"),{_csrf:o,context:n.data("context"),content:e.find('.tab.segment[data-tab="'+t.data("write")+'"] textarea').val()},(function(n){const i=e.find('.tab.segment[data-tab="'+t.data("diff")+'"]');i.html(n),emojify.run(i[0])}))}))}($(".edit.form")))}function u(e,t,n,i){return new Promise((function(a){$.ajax({type:"POST",url:e,data:{_csrf:o,action:t,issue_ids:n,id:i},success:a})}))}function h(){window.location.reload()}function f(e){e.each((function(){const e=this;e.addEventListener("paste",(function(t){!function(e,t){if(!e.clipboardData)return;const n=e.clipboardData.items;if(void 0!==n)for(let i=0;i<n.length;i++){if(-1===n[i].type.indexOf("image"))continue;const o=n[i].getAsFile();"function"==typeof t&&(e.preventDefault(),e.stopPropagation(),t(o))}}(t,(function(t){const n=t.name.substr(0,t.name.lastIndexOf("."));!function(e,t){if(e.selectionStart||0===e.selectionStart){const n=e.selectionStart,i=e.selectionEnd;e.value=e.value.substring(0,n)+t+e.value.substring(i,e.value.length),e.selectionStart=n+t.length,e.selectionEnd=n+t.length}else e.value+=t}(e,"!["+n+"]()"),function(e,t){const n=new XMLHttpRequest;n.onload=function(){200==n.status&&t(n.responseText)},n.open("post",a+"/attachments",!0),n.setRequestHeader("X-Csrf-Token",o);const i=new FormData;i.append("file",e,e.name),n.send(i)}(t,(function(t){const i=JSON.parse(t);!function(e,t,n){if(e.selectionStart||0===e.selectionStart){const i=e.selectionStart,o=e.selectionEnd;e.value=e.value.replace(t,n),e.selectionStart=i+n.length-t.length,e.selectionEnd=o+n.length-t.length}else e.value=e.value.replace(t,n)}(e,"!["+n+"]()","!["+n+"]("+a+"/attachments/"+i.uuid+")");const o=$('<input id="'+i.uuid+'" name="files" type="hidden">').val(i.uuid);$(".files").append(o)}))}))}),!1)}))}function p(){function e(e,t){const n=$(".ui."+t+".list"),i=n.find(".no-select"),o=$("."+e+" .menu");let a="update"==o.data("action");const s={};$("."+e).dropdown("setting","onHide",(function(){if(a="update"==o.data("action")){const e=[];Object.keys(s).forEach((function(t){const n=s[t],i=u(n["update-url"],n.action,n["issue-id"],t);e.push(i)})),Promise.all(e).then(h)}})),o.find(".item:not(.no-select)").click((function(){if("select-assignees-modify"==e)return $(this).hasClass("checked")?($(this).removeClass("checked"),$(this).find(".octicon").removeClass("octicon-check")):($(this).addClass("checked"),$(this).find(".octicon").addClass("octicon-check")),u(o.data("update-url"),"",o.data("issue-id"),$(this).data("id")),o.data("action","update"),!1;$(this).hasClass("checked")?($(this).removeClass("checked"),$(this).find(".octicon").removeClass("octicon-check"),a&&($(this).data("id")in s?delete s[$(this).data("id")]:s[$(this).data("id")]={"update-url":o.data("update-url"),action:"detach","issue-id":o.data("issue-id")})):($(this).addClass("checked"),$(this).find(".octicon").addClass("octicon-check"),a&&($(this).data("id")in s?delete s[$(this).data("id")]:s[$(this).data("id")]={"update-url":o.data("update-url"),action:"attach","issue-id":o.data("issue-id")}));const t=[];return $(this).parent().find(".item").each((function(){$(this).hasClass("checked")?(t.push($(this).data("id")),$($(this).data("id-selector")).removeClass("hide")):$($(this).data("id-selector")).addClass("hide")})),0==t.length?i.removeClass("hide"):i.addClass("hide"),$($(this).parent().data("id")).val(t.join(",")),!1})),o.find(".no-select.item").click((function(){(a||"select-assignees-modify"==e)&&u(o.data("update-url"),"clear",o.data("issue-id"),"").then(h),$(this).parent().find(".item").each((function(){$(this).removeClass("checked"),$(this).find(".octicon").removeClass("octicon-check")})),n.find(".item").each((function(){$(this).addClass("hide")})),i.removeClass("hide"),$($(this).parent().data("id")).val("")}))}function t(e,t){const n=$(e+" .menu"),o=$(".ui"+e+".list"),a="update"==n.data("action");n.find(".item:not(.no-select)").click((function(){switch($(this).parent().find(".item").each((function(){$(this).removeClass("selected active")})),$(this).addClass("selected active"),a&&u(n.data("update-url"),"",n.data("issue-id"),$(this).data("id")).then(h),t){case"#milestone_id":o.find(".selected").html('<a class="item" href='+$(this).data("href")+">"+i($(this).text())+"</a>");break;case"#assignee_id":o.find(".selected").html('<a class="item" href='+$(this).data("href")+'><img class="ui avatar image" src='+$(this).data("avatar")+">"+i($(this).text())+"</a>")}$(".ui"+e+".list .no-select").addClass("hide"),$(t).val($(this).data("id"))})),n.find(".no-select.item").click((function(){$(this).parent().find(".item:not(.no-select)").each((function(){$(this).removeClass("selected active")})),a&&u(n.data("update-url"),"",n.data("issue-id"),$(this).data("id")).then(h),o.find(".selected").html(""),o.find(".no-select").removeClass("hide"),$(t).val("")}))}0!=$(".comment.form").length&&(!function(){const e=$(".ui.select-branch");e.find(".reference-list-menu").find(".item:not(.no-select)").click((function(){const t=$(this).data("id");$($(this).data("id-selector")).val(t),e.find(".ui .branch-name").text(t)})),e.find(".reference.column").click((function(){return e.find(".scrolling.reference-list-menu").css("display","none"),e.find(".reference .text").removeClass("black"),$($(this).data("target")).css("display","block"),$(this).find(".text").addClass("black"),!1}))}(),l($(".comment.form")),f($(".comment.form textarea")),e("select-label","labels"),e("select-assignees","assignees"),e("select-assignees-modify","assignees"),t(".select-milestone","#milestone_id"),t(".select-assignee","#assignee_id"))}function m(){if(0==$(".repository").length)return;function e(e){const t=$(e);t.dropdown({fullTextSearch:!0,selectOnKeydown:!1,onChange:function(e,t,n){n.data("url")&&(window.location.href=n.data("url"))},message:{noResults:t.data("no-results")}})}if(($(".repository.file.list").length>0||".repository.commits".length>0)&&$(".choose.reference .dropdown").each((function(){const e=$(this).find(".data"),t={items:[],mode:e.data("mode"),searchTerm:"",noResults:"",canCreateBranch:!1,menuVisible:!1,active:0};e.find(".item").each((function(){t.items.push({name:$(this).text(),url:$(this).data("url"),branch:$(this).hasClass("branch"),tag:$(this).hasClass("tag"),selected:$(this).hasClass("selected")})})),e.remove(),new Vue({delimiters:["${","}"],el:this,data:t,beforeMount:function(){const e=this;this.noResults=e.$el.getAttribute("data-no-results"),this.canCreateBranch="true"===e.$el.getAttribute("data-can-create-branch"),document.body.addEventListener("click",(function(t){e.$el.contains(t.target)||e.menuVisible&&Vue.set(e,"menuVisible",!1)}))},watch:{menuVisible:function(e){e&&this.focusSearchField()}},computed:{filteredItems:function(){const e=this,t=e.items.filter((function(t){return("branches"===e.mode&&t.branch||"tags"===e.mode&&t.tag)&&(!e.searchTerm||t.name.toLowerCase().indexOf(e.searchTerm.toLowerCase())>=0)}));return e.active=0===t.length&&e.showCreateNewBranch?0:-1,t},showNoResults:function(){return 0===this.filteredItems.length&&!this.showCreateNewBranch},showCreateNewBranch:function(){const e=this;return!(!this.canCreateBranch||!e.searchTerm||"tags"===e.mode)&&0===e.items.filter((function(t){return t.name.toLowerCase()===e.searchTerm.toLowerCase()})).length}},methods:{selectItem:function(e){const t=this.getSelected();null!==t&&(t.selected=!1),e.selected=!0,window.location.href=e.url},createNewBranch:function(){this.showCreateNewBranch&&this.$refs.newBranchForm.submit()},focusSearchField:function(){const e=this;Vue.nextTick((function(){e.$refs.searchField.focus()}))},getSelected:function(){for(let e=0,t=this.items.length;e<t;++e)if(this.items[e].selected)return this.items[e];return null},getSelectedIndexInFiltered:function(){for(let e=0,t=this.filteredItems.length;e<t;++e)if(this.filteredItems[e].selected)return e;return-1},scrollToActive:function(){let e=this.$refs["listItem"+this.active];if(!e||0===e.length)return;Array.isArray(e)&&(e=e[0]);const t=this.$refs.scrollContainer;e.offsetTop<t.scrollTop?t.scrollTop=e.offsetTop:e.offsetTop+e.clientHeight>t.scrollTop+t.clientHeight&&(t.scrollTop=e.offsetTop+e.clientHeight-t.clientHeight)},keydown:function(e){const t=this;if(40===e.keyCode){if(e.preventDefault(),-1===t.active&&(t.active=t.getSelectedIndexInFiltered()),t.active+(t.showCreateNewBranch?0:1)>=t.filteredItems.length)return;t.active++,t.scrollToActive()}if(38===e.keyCode){if(e.preventDefault(),-1===t.active&&(t.active=t.getSelectedIndexInFiltered()),t.active<=0)return;t.active--,t.scrollToActive()}13==e.keyCode&&(e.preventDefault(),t.active>=t.filteredItems.length?t.createNewBranch():t.active>=0&&t.selectItem(t.filteredItems[t.active])),27==e.keyCode&&(e.preventDefault(),t.menuVisible=!1)}}})})),$(".repository.wiki.view").length>0&&e(".choose.page .dropdown"),$(".repository.settings.options").length>0&&($("#repo_name").keyup((function(){const e=$("#repo-name-change-prompt");$(this).val().toString().toLowerCase()!=$(this).data("name").toString().toLowerCase()?e.show():e.hide()})),$(".enable-system").change((function(){this.checked?($($(this).data("target")).removeClass("disabled"),$(this).data("context")||$($(this).data("context")).addClass("disabled")):($($(this).data("target")).addClass("disabled"),$(this).data("context")||$($(this).data("context")).removeClass("disabled"))})),$(".enable-system-radio").change((function(){"false"==this.value?($($(this).data("target")).addClass("disabled"),void 0!==$(this).data("context")&&$($(this).data("context")).removeClass("disabled")):"true"==this.value&&($($(this).data("target")).removeClass("disabled"),void 0!==$(this).data("context")&&$($(this).data("context")).addClass("disabled"))}))),$(".repository.labels").length>0){const e=$(".new-label.segment");$(".new-label.button").click((function(){e.show()})),$(".new-label.segment .cancel").click((function(){e.hide()})),$(".color-picker").each((function(){$(this).minicolors()})),$(".precolors .color").click((function(){const e=$(this).data("color-hex");$(".color-picker").val(e),$(".minicolors-swatch-color").css("background-color",e)})),$(".edit-label-button").click((function(){return $("#label-modal-id").val($(this).data("id")),$(".edit-label .new-label-input").val($(this).data("title")),$(".edit-label .new-label-desc-input").val($(this).data("description")),$(".edit-label .color-picker").val($(this).data("color")),$(".minicolors-swatch-color").css("background-color",$(this).data("color")),$(".edit-label.modal").modal({onApprove:function(){$(".edit-label.form").submit()}}).modal("show"),!1}))}if($(".repository.new.milestone").length>0){const e=$(".milestone.datepicker");e.datetimepicker({lang:e.data("lang"),inline:!0,timepicker:!1,startDate:e.data("start-date"),formatDate:"Y-m-d",onSelectDate:function(e){$("#deadline").val(e.dateFormat("Y-m-d"))}}),$("#clear-date").click((function(){return $("#deadline").val(""),!1}))}if($(".repository.view.issue").length>0){const e=$("#issue-title"),t=$("#edit-title-input input"),n=function(){return e.toggle(),$(".not-in-edit").toggle(),$("#edit-title-input").toggle(),$(".in-edit").toggle(),t.focus(),!1};$("#edit-title").click(n),$("#cancel-edit-title").click(n),$("#save-edit-title").click(n).click((function(){return 0==t.val().length||t.val()==e.text()?(t.val(e.text()),!1):($.post($(this).data("update-url"),{_csrf:o,title:t.val()},(function(n){t.val(n.title),e.text(n.title),h()})),!1)})),$(".edit-content").click((function(){const e=$(this).parent().parent().parent().next(),t=e.find(".edit-content-zone"),n=e.find(".render-content"),i=e.find(".raw-content");let a;if(0==t.html().length){t.html($("#edit-content-form").html()),a=t.find("textarea"),issuesTribute.attach(a.get()),emojiTribute.attach(a.get());const i=t.find(".dropzone");i.data("saved",!1);const s=t.find(".comment-files");if(i.length>0){const e={};i.dropzone({url:i.data("upload-url"),headers:{"X-Csrf-Token":o},maxFiles:i.data("max-file"),maxFilesize:i.data("max-size"),acceptedFiles:"*/*"===i.data("accepts")?null:i.data("accepts"),addRemoveLinks:!0,dictDefaultMessage:i.data("default-message"),dictInvalidFileType:i.data("invalid-input-type"),dictFileTooBig:i.data("file-too-big"),dictRemoveFile:i.data("remove-file"),init:function(){this.on("success",(function(t,n){e[t.name]={uuid:n.uuid,submitted:!1};const i=$('<input id="'+n.uuid+'" name="files" type="hidden">').val(n.uuid);s.append(i)})),this.on("removedfile",(function(t){t.name in e&&($("#"+e[t.name].uuid).remove(),i.data("remove-url")&&i.data("csrf")&&!e[t.name].submitted&&$.post(i.data("remove-url"),{file:e[t.name].uuid,_csrf:i.data("csrf")}))})),this.on("submit",(function(){$.each(e,(function(t){e[t].submitted=!0}))})),this.on("reload",(function(){$.getJSON(t.data("attachment-url"),(function(t){const n=i.get(0).dropzone;n.removeAllFiles(!0),s.empty(),$.each(t,(function(){const t=i.data("upload-url")+"/"+this.uuid;n.emit("addedfile",this),n.emit("thumbnail",this,t),n.emit("complete",this),n.files.push(this),e[this.name]={submitted:!0,uuid:this.uuid},i.find("img[src='"+t+"']").css("max-width","100%");const o=$('<input id="'+this.uuid+'" name="files" type="hidden">').val(this.uuid);s.append(o)}))}))}))}}),i.get(0).dropzone.emit("reload")}const r=t.find(".ui.comment.form"),c=r.find(".tabular.menu");c.attr("data-write",t.data("write")),c.attr("data-preview",t.data("preview")),c.find(".write.item").attr("data-tab",t.data("write")),c.find(".preview.item").attr("data-tab",t.data("preview")),r.find(".write.segment").attr("data-tab",t.data("write")),r.find(".preview.segment").attr("data-tab",t.data("preview")),l(r),t.find(".cancel.button").click((function(){n.show(),t.hide(),i.get(0).dropzone.emit("reload")})),t.find(".save.button").click((function(){n.show(),t.hide();const r=s.find("[name=files]").map((function(){return $(this).val()})).get();$.post(t.data("update-url"),{_csrf:o,content:a.val(),context:t.data("context"),files:r},(function(t){0==t.length?n.html($("#no-content").html()):(n.html(t.content),emojify.run(n[0]),$("pre code",n[0]).each((function(){hljs.highlightBlock(this)})));const o=e.parent();o.find(".ui.small.images").length?""==t.attachments?o.find(".ui.small.images").parent().remove():o.find(".ui.small.images").html(t.attachments):""!=t.attachments&&(o.append('<div class="ui bottom attached segment">    <div class="ui small images">    </div></div>'),o.find(".ui.small.images").html(t.attachments)),i.get(0).dropzone.emit("submit"),i.get(0).dropzone.emit("reload")}))}))}else a=e.find("textarea");return t.show(),n.hide(),0==a.val().length&&a.val(i.text()),a.focus(),!1})),$(".delete-comment").click((function(){const e=$(this);return confirm(e.data("locale"))&&$.post(e.data("url"),{_csrf:o}).success((function(){$("#"+e.data("comment-id")).remove()})),!1}));const i=$("#status-button");$("#comment-form .edit_area").keyup((function(){0==$(this).val().length?i.text(i.data("status")):i.text(i.data("status-and-comment"))})),i.click((function(){$("#status").val(i.data("status-val")),$("#comment-form").submit()}));const a=$(".merge-button > button");a.on("click",(function(e){e.preventDefault(),$("."+$(this).data("do")+"-fields").show(),$(this).parent().hide()})),$(".merge-button > .dropdown").dropdown({onChange:function(e,t,n){n.data("do")&&(a.find(".button-text").text(n.text()),a.data("do",n.data("do")))}}),$(".merge-cancel").on("click",(function(e){e.preventDefault(),$(this).closest(".form").hide(),a.parent().show()})),function e(t){let n="";t||(t=$(document),n=".reactions > "),t.find(n+"a.label").popup({position:"bottom left",metadata:{content:"title",title:"none"}}),t.find(".select-reaction > .menu > .item, "+n+"a.label").on("click",(function(t){const n=this;if(t.preventDefault(),$(this).hasClass("disabled"))return;const i=($(this).hasClass("item")?$(this).closest(".select-reaction").data("action-url"):$(this).data("action-url"))+"/"+($(this).hasClass("blue")?"unreact":"react");$.ajax({type:"POST",url:i,data:{_csrf:o,content:$(this).data("content")}}).done((function(t){if(t&&(t.html||t.empty)){const i=$(n).closest(".content");let o=i.find(".segment.reactions");if(!t.empty&&o.length>0&&o.remove(),!t.empty){o=$('<div class="ui attached segment reactions"></div>');const n=i.find(".segment.bottom:first");n.length>0?o.insertBefore(n):o.appendTo(i),o.html(t.html);const a=o.find(".has-emoji");for(let e=0;e<a.length;e++)emojify.run(a.get(e));o.find(".dropdown").dropdown(),e(o)}}}))}))}()}$(".repository.diff").length>0&&$(".diff-counter").each((function(){const e=$(this),t=e.find("span[data-line].add").data("line"),n=e.find("span[data-line].del").data("line"),i=parseFloat(t)/(parseFloat(t)+parseFloat(n))*100;e.find(".bar .add").css("width",i+"%")})),$("#repo-clone-ssh").click((function(){$(".clone-url").text($(this).data("link")),$("#repo-clone-url").val($(this).data("link")),$(this).addClass("blue"),$("#repo-clone-https").removeClass("blue"),localStorage.setItem("repo-clone-protocol","ssh")})),$("#repo-clone-https").click((function(){$(".clone-url").text($(this).data("link")),$("#repo-clone-url").val($(this).data("link")),$(this).addClass("blue"),$("#repo-clone-ssh").removeClass("blue"),localStorage.setItem("repo-clone-protocol","https")})),$("#repo-clone-url").click((function(){$(this).select()}));const t=$(".repository.compare.pull");t.length>0&&(e(".choose.branch .dropdown"),t.find("button.show-form").on("click",(function(e){e.preventDefault(),t.find(".pullrequest-form").show(),$(this).parent().hide()}))),$(".repository.settings.branches").length>0&&(e(".protected-branches .dropdown"),$(".enable-protection, .enable-whitelist").change((function(){this.checked?$($(this).data("target")).removeClass("disabled"):$($(this).data("target")).addClass("disabled")})))}function g(e){const t=Math.floor(Math.random()*Math.floor(1e6));return e.attr("data-write",e.attr("data-write")+t),e.attr("data-preview",e.attr("data-preview")+t),e.find(".item").each((function(){const e=$(this).attr("data-tab")+t;$(this).attr("data-tab",e)})),e.parent().find("*[data-tab='write']").attr("data-tab","write"+t),e.parent().find("*[data-tab='preview']").attr("data-tab","preview"+t),l(e.parent(".form")),t}function v(){$(".access-mode.menu .item").click((function(){const e=$(this).parent();$.post(e.data("url"),{_csrf:o,uid:e.data("uid"),mode:$(this).data("value")})}))}function b(){$(".js-quick-pull-choice-option").change((function(){"commit-to-new-branch"==$(this).val()?($(".quick-pull-branch-name").show(),$(".quick-pull-branch-name input").prop("required",!0)):($(".quick-pull-branch-name").hide(),$(".quick-pull-branch-name input").prop("required",!1)),$("#commit-button").text($(this).attr("button_text"))}));const e=$("#file-name");e.keyup((function(e){const t=$(".breadcrumb span.section"),n=$(".breadcrumb div.divider");let i,o;if(8==e.keyCode&&0==$(this).getCursorPosition()&&t.length>0&&(i=t.last().find("a").text(),$(this).val(i+$(this).val()),$(this)[0].setSelectionRange(i.length,i.length),t.last().remove(),n.last().remove()),191==e.keyCode){o=$(this).val().split("/");for(let e=0;e<o.length;++e)i=o[e],e<o.length-1?i.length&&($('<span class="section"><a href="#">'+i+"</a></span>").insertBefore($(this)),$('<div class="divider"> / </div>').insertBefore($(this))):$(this).val(i),$(this)[0].setSelectionRange(0,0)}o=[],$(".breadcrumb span.section").each((function(){const e=$(this);e.find("a").length?o.push(e.find("a").text()):o.push(e.text())})),$(this).val()&&o.push($(this).val()),$("#tree_path").val(o.join("/"))})).trigger("keyup");const t=$(".repository.editor textarea#edit_area");if(!t.length)return;const n=t.data("markdown-file-exts").split(","),i=t.data("line-wrap-extensions").split(",");e.on("keyup",(function(){const a=e.val();let l,d,u,h,f,p;u=h="";const m=/.+\.([^.]+)$/.exec(a);m&&(h="."+(u=m[1]));const g=CodeMirror.findModeByExtension(u),v=$("a[data-tab=preview]");if(g?(l=g.mode,d=g.mime,p=l):p=u,v.length&&p&&s&&s.length&&s.indexOf(p)>=0?(f=v.data("url"),v.data("url",f.replace(/(.*)\/.*/i,"$1/"+l)),v.show()):v.hide(),n.indexOf(h)>=0&&function(e){return c&&(c.toTextArea(),c=null),!!r||(r=new SimpleMDE({autoDownloadFontAwesome:!1,element:e[0],forceSync:!0,renderingConfig:{singleLineBreaks:!1},indentWithTabs:!1,tabSize:4,spellChecker:!1,previewRender:function(t,n){return setTimeout((function(){$.post(e.data("url"),{_csrf:o,mode:"gfm",context:e.data("context"),text:t},(function(e){n.innerHTML='<div class="markdown ui segment">'+e+"</div>",emojify.run($(".editor-preview")[0])}))}),0),"Loading..."},toolbar:["bold","italic","strikethrough","|","heading-1","heading-2","heading-3","heading-bigger","heading-smaller","|","code","quote","|","unordered-list","ordered-list","|","link","image","table","horizontal-rule","|","clean-block","preview","fullscreen","side-by-side"]}),!0)}(t))return;if(!c&&!function(e){return r&&(r.toTextArea(),r=null),!!c||((c=CodeMirror.fromTextArea(e[0],{lineNumbers:!0})).on("change",(function(t,n){e.val(t.getValue())})),!0)}(t))return;l&&(c.setOption("mode",d),CodeMirror.autoLoadMode(c,l)),i.indexOf(h)>=0?c.setOption("lineWrapping",!0):c.setOption("lineWrapping",!1);let b=e.val();0!==b.length&&(b=(b=b.split("/"))[b.length-1],$.getJSON(e.data("ec-url-prefix")+b,(function(e){"tab"===e.indent_style?(c.setOption("indentWithTabs",!0),c.setOption("extraKeys",{})):(c.setOption("indentWithTabs",!1),c.setOption("extraKeys",{Tab:function(e){const t=Array(parseInt(e.getOption("indentUnit"))+1).join(" ");e.replaceSelection(t)}})),c.setOption("indentUnit",e.indent_size||4),c.setOption("tabSize",e.tab_width||4)})))})).trigger("keyup");const a=$("#commit-button"),l=$(".ui.edit.form");a.prop("disabled",!0),l.areYouSure({silent:!0,dirtyClass:"dirty-file",fieldSelector:":input:not(.commit-form-wrapper :input)",change:function(){const e=$(this).hasClass("dirty-file");a.prop("disabled",!e)}}),a.click((function(e){0===t.val().length&&($("#edit-empty-content-modal").modal({onApprove:function(){$(".edit.form").submit()}}).modal("show"),e.preventDefault())}))}function w(){$(".user.settings.profile").length>0&&$("#username").keyup((function(){const e=$("#name-change-prompt");$(this).val().toString().toLowerCase()!=$(this).data("name").toString().toLowerCase()?e.show():e.hide()}))}function k(){$(".ui.button").keypress((function(e){13!=e.keyCode&&32!=e.keyCode||$(this).click()}))}function _(){$(".code-view .linenums").length>0&&($(document).on("click",".lines-num span",(function(e){const t=$(this),n=t.parent().siblings(".lines-code").find("ol.linenums > li");T(n,n.filter("[rel="+t.attr("id")+"]"),e.shiftKey?n.filter(".active").eq(0):null),window.getSelection?window.getSelection().removeAllRanges():document.selection.empty()})),$(window).on("hashchange",(function(){let e=window.location.hash.match(/^#(L\d+)-(L\d+)$/);const t=$(".code-view ol.linenums > li");let n;if(e)return n=t.filter("."+e[1]),T(t,n,t.filter("."+e[2])),void $("html, body").scrollTop(n.offset().top-200);(e=window.location.hash.match(/^#(L|n)(\d+)$/))&&(n=t.filter(".L"+e[2]),T(t,n),$("html, body").scrollTop(n.offset().top-200))})).trigger("hashchange"))}function y(e){$.ajax({url:a+"/user/u2f/sign",type:"POST",headers:{"X-Csrf-Token":o},data:JSON.stringify(e),contentType:"application/json; charset=utf-8"}).done((function(e){window.location.replace(e)})).fail((function(){x(1)}))}function C(e){(function(e){if(!("errorCode"in e))return!1;if(0===e.errorCode)return!1;return x(e.errorCode),!0})(e)||$.ajax({url:a+"/user/settings/security/u2f/register",type:"POST",headers:{"X-Csrf-Token":o},data:JSON.stringify(e),contentType:"application/json; charset=utf-8",success:function(){h()},fail:function(){x(1)}})}function x(e){const t={browser:$("#unsupported-browser"),1:$("#u2f-error-1"),2:$("#u2f-error-2"),3:$("#u2f-error-3"),4:$("#u2f-error-4"),5:$(".u2f-error-5")};t[e].removeClass("hide");for(const n in t)n!=e&&t[n].addClass("hide");$("#u2f-error").modal("show")}function S(){$.post(a+"/user/settings/security/u2f/request_register",{_csrf:o,name:$("#nickname").val()}).success((function(e){$("#nickname").closest("div.field").removeClass("error"),$("#register-device").modal("show"),null===e.registeredKeys&&(e.registeredKeys=[]),u2fApi.register(e.appId,e.registerRequests,e.registeredKeys,30).then(C).catch((function(e){x(void 0!==e?e.metaData.code:1)}))})).fail((function(e){409===e.status&&$("#nickname").closest("div.field").addClass("error")}))}function q(e){history.pushState?history.pushState(null,null,e):location.hash=e}function T(e,t,n){if(e.removeClass("active"),n){let i,o=parseInt(t.attr("rel").substr(1)),a=parseInt(n.attr("rel").substr(1));if(o!=a){o>a&&(i=o,o=a,a=i);const t=[];for(let e=o;e<=a;e++)t.push(".L"+e);return e.filter(t.join(",")).addClass("active"),void q("#L"+o+"-L"+a)}}t.addClass("active"),q("#"+t.attr("rel"))}function L(){const e=$(this);let t="";e.attr("id")&&(t+="#"+e.attr("id"));const n=$(".delete.modal"+t);return n.find(".name").text(e.data("name")),n.modal({closable:!1,onApprove:function(){"form"!=e.data("type")?$.post(e.data("url"),{_csrf:o,id:e.data("id")}).done((function(e){window.location.href=e.redirect})):$(e.data("form")).submit()}}).modal("show"),!1}function O(){const e=$(this);let t="";e.attr("id")&&(t+="#"+e.attr("id"));const n=$(".addall.modal"+t);return n.find(".name").text(e.data("name")),n.modal({closable:!1,onApprove:function(){"form"!=e.data("type")?$.post(e.data("url"),{_csrf:o,id:e.data("id")}).done((function(e){window.location.href=e.redirect})):$(e.data("form")).submit()}}).modal("show"),!1}"undefined"!=typeof Dropzone&&(Dropzone.autoDiscover=!1),Array.from||(Array.from=function(){const e=Object.prototype.toString,t=function(t){return"function"==typeof t||"[object Function]"===e.call(t)},n=Math.pow(2,53)-1,i=function(e){const t=function(e){const t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),n)};return function(e){const n=this,o=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");const a=arguments.length>1?arguments[1]:void 0;let s;if(void 0!==a){if(!t(a))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(s=arguments[2])}const r=i(o.length),c=t(n)?Object(new n(r)):new Array(r);let l,d=0;for(;d<r;)l=o[d],c[d]=a?void 0===s?a(l,d):a.call(s,l,d):l,d+=1;return c.length=r,c}}()),"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");const n=Object(e);for(let e=1;e<arguments.length;e++){const t=arguments[e];if(null!=t)for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])}return n},writable:!0,configurable:!0}),String.prototype.endsWith=function(e){const t=this.length-e.length;return t>=0&&this.lastIndexOf(e)===t},$.fn.getCursorPosition=function(){const e=$(this).get(0);let t=0;if("selectionStart"in e)t=e.selectionStart;else if("selection"in document){e.focus();const n=document.selection.createRange(),i=document.selection.createRange().text.length;n.moveStart("character",-e.value.length),t=n.text.length-i}return t},$(document).ready((function(){if(o=$("meta[name=_csrf]").attr("content"),a=$("meta[name=_suburl]").attr("content"),$(".time-since").each((function(){$(this).addClass("poping up").attr("data-content",$(this).attr("title")).attr("data-variation","inverted tiny").attr("title","")})),$(".dropdown:not(.custom)").dropdown(),$(".jump.dropdown").dropdown({action:"hide",onShow:function(){$(".poping.up").popup("hide")}}),$(".slide.up.dropdown").dropdown({transition:"slide up"}),$(".upward.dropdown").dropdown({direction:"upward"}),$(".ui.accordion").accordion(),$(".ui.checkbox").checkbox(),$(".ui.progress").progress({showActivity:!1}),$(".poping.up").popup(),$(".top.menu .poping.up").popup({onShow:function(){if($(".top.menu .menu.transition").hasClass("visible"))return!1}}),$(".tabular.menu .item").tab(),$(".tabable.menu .item").tab(),$(".toggle.button").click((function(){$($(this).data("target")).slideToggle(100)})),$("tr[data-href]").click((function(){window.location=$(this).data("href")})),"undefined"!=typeof hljs){const e=[].slice.call(document.querySelectorAll("pre code")||[]);for(let t=0;t<e.length;t++)hljs.highlightBlock(e[t])}const e=$("#dropzone");if(e.length>0){const t={};new Dropzone("#dropzone",{url:e.data("upload-url"),headers:{"X-Csrf-Token":o},maxFiles:e.data("max-file"),maxFilesize:e.data("max-size"),acceptedFiles:"*/*"===e.data("accepts")?null:e.data("accepts"),addRemoveLinks:!0,dictDefaultMessage:e.data("default-message"),dictInvalidFileType:e.data("invalid-input-type"),dictFileTooBig:e.data("file-too-big"),dictRemoveFile:e.data("remove-file"),init:function(){this.on("success",(function(e,n){t[e.name]=n.uuid;const i=$('<input id="'+n.uuid+'" name="files" type="hidden">').val(n.uuid);$(".files").append(i)})),this.on("removedfile",(function(n){n.name in t&&$("#"+t[n.name]).remove(),e.data("remove-url")&&e.data("csrf")&&$.post(e.data("remove-url"),{file:t[n.name],_csrf:e.data("csrf")})}))}})}emojify.setConfig({img_dir:a+"/vendor/plugins/emojify/images",ignore_emoticons:!0});const t=document.getElementsByClassName("has-emoji");for(let e=0;e<t.length;e++){emojify.run(t[e]);for(let n=0;n<t[e].childNodes.length;n++)"A"===t[e].childNodes[n].nodeName&&emojify.run(t[e].childNodes[n])}const n=new Clipboard(".clipboard");if(n.on("success",(function(e){e.clearSelection(),$("#"+e.trigger.getAttribute("id")).popup("destroy"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-success")),$("#"+e.trigger.getAttribute("id")).popup("show"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-original"))})),n.on("error",(function(e){$("#"+e.trigger.getAttribute("id")).popup("destroy"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-error")),$("#"+e.trigger.getAttribute("id")).popup("show"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-original"))})),$(".delete-button").click(L),$(".add-all-button").click(O),$(".delete-branch-button").click(L),$(".undo-button").click((function(){const e=$(this);$.post(e.data("url"),{_csrf:o,id:e.data("id")}).done((function(e){window.location.href=e.redirect}))})),$(".show-panel.button").click((function(){$($(this).data("panel")).show()})),$(".show-modal.button").click((function(){$($(this).data("modal")).modal("show")})),$(".delete-post.button").click((function(){const e=$(this);$.post(e.data("request-url"),{_csrf:o}).done((function(){window.location.href=e.data("done-url")}))})),$(".markdown").each((function(){const e={};$(this).find("h1, h2, h3, h4, h5, h6").each((function(){let t=$(this);const n=encodeURIComponent(t.text().toLowerCase().replace(/[^\u00C0-\u1FFF\u2C00-\uD7FF\w\- ]/g,"").replace(/[ ]/g,"-"));let i=n;e[n]>0&&(i=n+"-"+e[n]),null==e[n]?e[n]=1:e[n]+=1,(t=t.wrap('<div id="'+i+'" class="anchor-wrap" ></div>')).append('<a class="anchor" href="#'+i+'"><span class="octicon octicon-link"></span></a>')}))})),$(".issue-checkbox").click((function(){$(".issue-checkbox").children("input:checked").length>0?($("#issue-filters").addClass("hide"),$("#issue-actions").removeClass("hide")):($("#issue-filters").removeClass("hide"),$("#issue-actions").addClass("hide"))})),$(".issue-action").click((function(){let e=this.dataset.action,t=this.dataset.elementId;const n=$(".issue-checkbox").children("input:checked").map((function(){return this.dataset.issueId})).get().join(),i=this.dataset.url;"0"===t&&"/assignee"===i.substr(-9)&&(t="",e="clear"),u(i,e,n,t).then((function(){"close"!==e&&"open"!==e||$('.issue-checkbox input[type="checkbox"]').each((function(e,t){t.checked=!1})),h()}))})),$('.issue-checkbox input[type="checkbox"]:checked').first().each((function(e,t){t.checked=!1,$(t).click()})),k(),$("#search-user-box").search({minCharacters:2,apiSettings:{url:a+"/api/v1/users/search?q={query}",onResponse:function(e){const t=[];return $.each(e.data,(function(e,n){let o=n.login;n.full_name&&n.full_name.length>0&&(o+=" ("+i(n.full_name)+")"),t.push({title:o,image:n.avatar_url})})),{results:t}}},searchFields:["login","full_name"],showNoResults:!1}),function(){const e=$("#search-team-box");e.search({minCharacters:2,apiSettings:{url:a+"/api/v1/orgs/"+e.data("org")+"/teams/search?q={query}",headers:{"X-Csrf-Token":o},onResponse:function(e){const t=[];return $.each(e.data,(function(e,n){const i=n.name+" ("+n.permission+" access)";t.push({title:i})})),{results:t}}},searchFields:["name","description"],showNoResults:!1})}(),function(){const e=$("#search-repo-box");e.search({minCharacters:2,apiSettings:{url:a+"/api/v1/repos/search?q={query}&uid="+e.data("uid"),onResponse:function(e){const t=[];return $.each(e.data,(function(e,n){t.push({title:n.full_name.split("/")[1],description:n.full_name})})),{results:t}}},searchFields:["full_name"],showNoResults:!1})}(),p(),0!=$(".install").length&&(""==$("#db_host").val()&&($("#db_host").val("127.0.0.1:3306"),$("#db_user").val("gitea"),$("#db_name").val("gitea")),$("#db_type").change((function(){const e=$(this).val();if("SQLite3"===e)return $("#sql_settings").hide(),$("#pgsql_settings").hide(),$("#mysql_settings").hide(),$("#sqlite_settings").show(),void("SQLite3"===e&&"data/gitea_tidb"==$("#db_path").val()&&$("#db_path").val("data/gitea.db"));const t={MySQL:"127.0.0.1:3306",PostgreSQL:"127.0.0.1:5432",MSSQL:"127.0.0.1:1433"};$("#sqlite_settings").hide(),$("#sql_settings").show(),$("#pgsql_settings").toggle("PostgreSQL"===e),$("#mysql_settings").toggle("MySQL"===e),$.each(t,(function(n,i){if($("#db_host").val()==i)return $("#db_host").val(t[e]),!1}))})),$("#offline-mode input").change((function(){$(this).is(":checked")&&($("#disable-gravatar").checkbox("check"),$("#federated-avatar-lookup").checkbox("uncheck"))})),$("#disable-gravatar input").change((function(){$(this).is(":checked")?$("#federated-avatar-lookup").checkbox("uncheck"):$("#offline-mode").checkbox("uncheck")})),$("#federated-avatar-lookup input").change((function(){$(this).is(":checked")&&($("#disable-gravatar").checkbox("uncheck"),$("#offline-mode").checkbox("uncheck"))})),$("#enable-openid-signin input").change((function(){$(this).is(":checked")?$("#disable-registration input").is(":checked")||$("#enable-openid-signup").checkbox("check"):$("#enable-openid-signup").checkbox("uncheck")})),$("#disable-registration input").change((function(){$(this).is(":checked")?($("#enable-captcha").checkbox("uncheck"),$("#enable-openid-signup").checkbox("uncheck")):$("#enable-openid-signup").checkbox("check")})),$("#enable-captcha input").change((function(){$(this).is(":checked")&&$("#disable-registration").checkbox("uncheck")}))),m(),function(){const e=function(){const e=$("#auth_username").val(),t=$("#clone_addr").val();!$("#mirror").is(":checked")&&null!=e&&e.length>0&&null!=t&&(t.startsWith("https://github.com")||t.startsWith("http://github.com"))?$("#migrate_items").show():$("#migrate_items").hide()};e(),$("#clone_addr").on("input",e),$("#auth_username").on("input",e),$("#mirror").on("change",e)}(),function(){const e=$(".repository.wiki textarea#edit_area");if(e.length>0){const t=new SimpleMDE({autoDownloadFontAwesome:!1,element:e[0],forceSync:!0,previewRender:function(t,n){return setTimeout((function(){$.post(e.data("url"),{_csrf:o,mode:"gfm",context:e.data("context"),text:t},(function(e){n.innerHTML='<div class="markdown ui segment">'+e+"</div>",emojify.run($(".editor-preview")[0])}))}),0),"Loading..."},renderingConfig:{singleLineBreaks:!1},indentWithTabs:!1,tabSize:4,spellChecker:!1,toolbar:["bold","italic","strikethrough","|","heading-1","heading-2","heading-3","heading-bigger","heading-smaller","|",{name:"code-inline",action:function(e){const t=e.codemirror,n=t.getSelection();if(t.replaceSelection("`"+n+"`"),!n){const e=t.getCursor();t.setCursor(e.line,e.ch-1)}t.focus()},className:"fa fa-angle-right",title:"Add Inline Code"},"code","quote","|",{name:"checkbox-empty",action:function(e){const t=e.codemirror;t.replaceSelection("\n- [ ] "+t.getSelection()),t.focus()},className:"fa fa-square-o",title:"Add Checkbox (empty)"},{name:"checkbox-checked",action:function(e){const t=e.codemirror;t.replaceSelection("\n- [x] "+t.getSelection()),t.focus()},className:"fa fa-check-square-o",title:"Add Checkbox (checked)"},"|","unordered-list","ordered-list","|","link","image","table","horizontal-rule","|","clean-block","preview","fullscreen"]});$(t.codemirror.getInputField()).addClass("js-quick-submit")}}(),d(),b(),0!=$(".organization").length&&$(".organization.settings.options").length>0&&$("#org_name").keyup((function(){const e=$("#org-name-change-prompt");$(this).val().toString().toLowerCase()!=$(this).data("org-name").toString().toLowerCase()?e.show():e.hide()})),function(){if(0==$(".new.webhook").length)return;$(".events.checkbox input").change((function(){$(this).is(":checked")&&$(".events.fields").show()})),$(".non-events.checkbox input").change((function(){$(this).is(":checked")&&$(".events.fields").hide()}));const e=function(){const e="POST"===$("#http_method").val();$("#content_type").parent().parent()[e?"show":"hide"]()};e(),$("#http_method").change((function(){e()})),$("#test-delivery").click((function(){const e=$(this);e.addClass("loading disabled"),$.post(e.data("link"),{_csrf:o}).done(setTimeout((function(){window.location.href=e.data("redirect")}),5e3))}))}(),function(){if(0!=$(".admin").length){if(($(".admin.new.user").length>0||$(".admin.edit.user").length>0)&&$("#login_type").change((function(){"0"==$(this).val().substring(0,1)?($("#login_name").removeAttr("required"),$(".non-local").hide(),$(".local").show(),$("#user_name").focus(),"required"==$(this).data("password")&&$("#password").attr("required","required")):($("#login_name").attr("required","required"),$(".non-local").show(),$(".local").hide(),$("#login_name").focus(),$("#password").removeAttr("required"))})),$(".admin.new.authentication").length>0&&($("#auth_type").change((function(){$(".ldap, .dldap, .smtp, .pam, .oauth2, .has-tls .search-page-size").hide(),$(".ldap input[required], .binddnrequired input[required], .dldap input[required], .smtp input[required], .pam input[required], .oauth2 input[required], .has-tls input[required]").removeAttr("required"),$(".binddnrequired").removeClass("required");const i=$(this).val();switch(i){case"2":$(".ldap").show(),$(".binddnrequired input, .ldap div.required:not(.dldap) input").attr("required","required"),$(".binddnrequired").addClass("required");break;case"3":$(".smtp").show(),$(".has-tls").show(),$(".smtp div.required input, .has-tls").attr("required","required");break;case"4":$(".pam").show(),$(".pam input").attr("required","required");break;case"5":$(".dldap").show(),$(".dldap div.required:not(.ldap) input").attr("required","required");break;case"6":$(".oauth2").show(),$(".oauth2 div.required:not(.oauth2_use_custom_url,.oauth2_use_custom_url_field,.open_id_connect_auto_discovery_url) input").attr("required","required"),n()}"2"!=i&&"5"!=i||e(),"2"==i&&t()})),$("#auth_type").change(),$("#security_protocol").change(e),$("#use_paged_search").change(t),$("#oauth2_provider").change(n),$("#oauth2_use_custom_url").change(i)),$(".admin.edit.authentication").length>0){const o=$("#auth_type").val();"2"==o||"5"==o?($("#security_protocol").change(e),"2"==o&&$("#use_paged_search").change(t)):"6"==o&&($("#oauth2_provider").change(n),$("#oauth2_use_custom_url").change(i),n())}if($(".admin.notice")){const e=$("#detail-modal");$(".view-detail").click((function(){return e.find(".content p").text($(this).data("content")),e.modal("show"),!1}));const t=$(".select.table .ui.checkbox");$(".select.action").click((function(){switch($(this).data("action")){case"select-all":t.checkbox("check");break;case"deselect-all":t.checkbox("uncheck");break;case"inverse":t.checkbox("toggle")}})),$("#delete-selection").click((function(){const e=$(this);e.addClass("loading disabled");const n=[];t.each((function(){$(this).checkbox("is checked")&&n.push($(this).data("id"))})),$.post(e.data("link"),{_csrf:o,ids:n}).done((function(){window.location.href=e.data("redirect")}))}))}}function e(){$("#security_protocol").val()>0?$(".has-tls").show():$(".has-tls").hide()}function t(){$("#use_paged_search").prop("checked")?$(".search-page-size").show().find("input").attr("required","required"):$(".search-page-size").hide().find("input").removeAttr("required")}function n(){switch($(".open_id_connect_auto_discovery_url, .oauth2_use_custom_url").hide(),$(".open_id_connect_auto_discovery_url input[required]").removeAttr("required"),$("#oauth2_provider").val()){case"github":case"gitlab":case"gitea":$(".oauth2_use_custom_url").show();break;case"openidConnect":$(".open_id_connect_auto_discovery_url input").attr("required","required"),$(".open_id_connect_auto_discovery_url").show()}i()}function i(){const e=$("#oauth2_provider").val();if($(".oauth2_use_custom_url_field").hide(),$(".oauth2_use_custom_url_field input[required]").removeAttr("required"),$("#oauth2_use_custom_url").is(":checked"))switch($("#oauth2_token_url").val()||$("#oauth2_token_url").val($("#"+e+"_token_url").val()),$("#oauth2_auth_url").val()||$("#oauth2_auth_url").val($("#"+e+"_auth_url").val()),$("#oauth2_profile_url").val()||$("#oauth2_profile_url").val($("#"+e+"_profile_url").val()),$("#oauth2_email_url").val()||$("#oauth2_email_url").val($("#"+e+"_email_url").val()),e){case"github":$(".oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input, .oauth2_email_url input").attr("required","required"),$(".oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url, .oauth2_email_url").show();break;case"gitea":case"gitlab":$(".oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input").attr("required","required"),$(".oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url").show(),$("#oauth2_email_url").val("")}}}(),_(),function(){const e=document.getElementById("app");if(!e)return;Vue.component("repo-search",{delimiters:["${","}"],props:{searchLimit:{type:Number,default:10},suburl:{type:String,required:!0},uid:{type:Number,required:!0},organizations:{type:Array,default:[]},isOrganization:{type:Boolean,default:!0},canCreateOrganization:{type:Boolean,default:!1},organizationsTotalCount:{type:Number,default:0},moreReposLink:{type:String,default:""}},data:function(){return{tab:"repos",repos:[],reposTotalCount:0,reposFilter:"all",searchQuery:"",isLoading:!1,repoTypes:{all:{count:0,searchMode:""},forks:{count:0,searchMode:"fork"},mirrors:{count:0,searchMode:"mirror"},sources:{count:0,searchMode:"source"},collaborative:{count:0,searchMode:"collaborative"}}}},computed:{showMoreReposLink:function(){return this.repos.length>0&&this.repos.length<this.repoTypes[this.reposFilter].count},searchURL:function(){return this.suburl+"/api/v1/repos/search?sort=updated&order=desc&uid="+this.uid+"&q="+this.searchQuery+"&limit="+this.searchLimit+"&mode="+this.repoTypes[this.reposFilter].searchMode+("all"!==this.reposFilter?"&exclusive=1":"")},repoTypeCount:function(){return this.repoTypes[this.reposFilter].count}},mounted:function(){this.searchRepos(this.reposFilter);const e=this;Vue.nextTick((function(){e.$refs.search.focus()}))},methods:{changeTab:function(e){this.tab=e},changeReposFilter:function(e){this.reposFilter=e,this.repos=[],this.repoTypes[e].count=0,this.searchRepos(e)},showRepo:function(e,t){switch(t){case"sources":return e.owner.id==this.uid&&!e.mirror&&!e.fork;case"forks":return e.owner.id==this.uid&&!e.mirror&&e.fork;case"mirrors":return e.mirror;case"collaborative":return e.owner.id!=this.uid&&!e.mirror;default:return!0}},searchRepos:function(e){const t=this;this.isLoading=!0;const n=this.repoTypes[e].searchMode,i=this.searchURL,o=this.searchQuery;$.getJSON(i,(function(a,s,r){if(i==t.searchURL){t.repos=a.data;const i=r.getResponseHeader("X-Total-Count");""===o&&""===n&&(t.reposTotalCount=i),t.repoTypes[e].count=i}})).always((function(){i==t.searchURL&&(t.isLoading=!1)}))},repoClass:function(e){return e.fork?"octicon octicon-repo-forked":e.mirror?"octicon octicon-repo-clone":e.private?"octicon octicon-lock":"octicon octicon-repo"}}}),new Vue({delimiters:["${","}"],el:e,data:{searchLimit:document.querySelector("meta[name=_search_limit]").content,suburl:document.querySelector("meta[name=_suburl]").content,uid:document.querySelector("meta[name=_context_uid]").content}})}(),$(".organization.new.team input[name=permission]").change((function(){"admin"===$("input[name=permission]:checked",".organization.new.team").val()?$(".organization.new.team .team-units").hide():$(".organization.new.team .team-units").show()})),$(".js-quick-submit").keydown((function(e){!(e.ctrlKey&&!e.altKey||e.metaKey)||13!=e.keyCode&&10!=e.keyCode||$(this).closest("form").submit()})),function(){const e=$("#navbar"),t=$("#navbar-expand-toggle");let n=!1;t.click((function(){(n=!n)?(e.addClass("shown"),t.addClass("active")):(e.removeClass("shown"),t.removeClass("active"))}))}(),function(){const e=$("#manage_topic"),t=$("#topic_edit"),n=$("#repo-topics"),i=$("#save_topic"),s=$("#topic_edit .dropdown"),r=$("#topic_edit.ui.form"),c=function(){const e=$("div.hide#validate_prompt"),t={countPrompt:e.children("#count_prompt").text(),formatPrompt:e.children("#format_prompt").text()};return e.remove(),t}();e.click((function(){n.hide(),t.css("display","")})),i.click((function(){const e=$("input[name=topics]").val();$.post(i.data("link"),{_csrf:o,topics:e},(function(i,o,a){if("ok"===a.responseJSON.status){if(n.children(".topic").remove(),e.length){const t=e.split(","),i=n.children("a").last();for(let e=0;e<t.length;e++)$('<div class="ui small label topic" style="cursor:pointer;">'+t[e]+"</div>").insertBefore(i)}t.css("display","none"),n.show()}})).fail((function(t){if(422===t.status)if(t.responseJSON.invalidTopics.length>0){c.formatPrompt=t.responseJSON.message;const n=t.responseJSON.invalidTopics,i=s.children("a.ui.label");e.split(",").forEach((function(e,t){for(let o=0;o<n.length;o++)n[o]===e&&i.eq(t).removeClass("green").addClass("red")}))}else c.countPrompt=t.responseJSON.message})).always((function(){r.form("validate form")}))})),s.dropdown({allowAdditions:!0,forceSelection:!1,fields:{name:"description",value:"data-value"},saveRemoteData:!1,label:{transition:"horizontal flip",duration:200,variation:!1,blue:!0,basic:!0},className:{label:"ui small label"},apiSettings:{url:a+"/api/v1/topics/search?q={query}",throttle:500,cache:!1,onResponse:function(e){const t={success:!1,results:[]},n=this.urlData.query.trim().replace(/<[^>]*>?/gm,"");let i=!1;const o=[];if(s.find("div.label.visible.topic,a.label.visible").each((function(e,t){o.push(t.dataset.value)})),e.topics){let a=!1;for(let s=0;s<e.topics.length;s++)-1==o.indexOf(e.topics[s].topic_name)&&(e.topics[s].topic_name.toLowerCase()===n.toLowerCase()&&(i=!0),t.results.push({description:e.topics[s].topic_name,"data-value":e.topics[s].topic_name}),a=!0);t.success=a}return n.length>0&&!i?(t.success=!0,t.results.unshift({description:n,"data-value":n})):n.length>0&&i&&t.results.sort((function(e,t){return e.description.toLowerCase()===n.toLowerCase()?-1:t.description.toLowerCase()===n.toLowerCase()?1:e.description>t.description?-1:e.description<t.description?1:0})),t}},onLabelCreate:function(e){return e=e.toLowerCase().trim(),this.attr("data-value",e).contents().first().replaceWith(e),$(this)},onAdd:function(e,t,n){e=e.toLowerCase().trim(),$(n).attr("data-value",e),$(n).attr("data-text",e)}}),$.fn.form.settings.rules.validateTopic=function(e,t){const n=s.children("a.ui.label"),i=0===n.length||n.last().attr("data-value").match(t);return i||n.last().removeClass("green").addClass("red"),i&&0===s.children("a.ui.label.red").length},r.form({on:"change",inline:!0,fields:{topics:{identifier:"topics",rules:[{type:"validateTopic",value:/^[a-z0-9][a-z0-9-]{1,35}$/,prompt:c.formatPrompt},{type:"maxCount[25]",prompt:c.countPrompt}]}}})}(),0!==$("#wait-for-key").length&&u2fApi.ensureSupport().then((function(){$.getJSON(a+"/user/u2f/challenge").success((function(e){u2fApi.sign(e.appId,e.challenge,e.registeredKeys,30).then(y).catch((function(e){x(void 0!==e?e.metaData.code:1)}))}))})).catch((function(){window.location.href=a+"/user/two_factor"})),$("#register-device").modal({allowMultiple:!1}),$("#u2f-error").modal({allowMultiple:!1}),$("#register-security-key").on("click",(function(e){e.preventDefault(),u2fApi.ensureSupport().then(S).catch((function(){x("browser")}))})),function(){const e=$("#repolink").val(),t=$("#repoId").val(),n=$("#crossRepoSearch").val();let o=a+"/api/v1/repos/"+e+"/issues?q={query}";"true"===n&&(o=a+"/api/v1/repos/issues/search?q={query}&priority_repo_id="+t);$("#new-dependency-drop-list").dropdown({apiSettings:{url:o,onResponse:function(e){const t={success:!0,results:[]},n=$("#new-dependency-drop-list").data("issue-id");return $.each(e,(function(e,o){o.id!==n&&t.results.push({name:"#"+o.number+" "+i(o.title)+'<div class="text small dont-break-out">'+i(o.repository.full_name)+"</div>",value:o.id})})),t},cache:!1},fullTextSearch:!0}),$(".menu a.label-filter-item").each((function(){$(this).click((function(e){if(e.altKey){e.preventDefault();const t=$(this).attr("href"),n="labels=(-?[0-9]+%2c)*("+$(this).data("label-id")+")(%2c-?[0-9]+)*&",i="labels=$1-$2$3&";window.location=t.replace(new RegExp(n),i)}}))})),$(".menu .ui.dropdown.label-filter").keydown((function(e){if(e.altKey&&13==e.keyCode){const e=$(".menu .ui.dropdown.label-filter .menu .item.selected");if(e.length>0){const t=$(e[0]),n=t.attr("href"),i="labels=(-?[0-9]+%2c)*("+t.data("label-id")+")(%2c-?[0-9]+)*&",o="labels=$1-$2$3&";window.location=n.replace(new RegExp(i),o)}}}))}(),$(".title_wip_desc > a").click((function(e){e.preventDefault();const t=$("#issue_title");t.focus();const n=t.val().trim().toUpperCase();for(const e in wipPrefixes)if(n.startsWith(wipPrefixes[e].toUpperCase()))return;t.val(wipPrefixes[0]+" "+t.val())})),$(".show-outdated").on("click",(function(e){e.preventDefault();const t=$(this).data("comment");$(this).addClass("hide"),$("#code-comments-"+t).removeClass("hide"),$("#code-preview-"+t).removeClass("hide"),$("#hide-outdated-"+t).removeClass("hide")})),$(".hide-outdated").on("click",(function(e){e.preventDefault();const t=$(this).data("comment");$(this).addClass("hide"),$("#code-comments-"+t).addClass("hide"),$("#code-preview-"+t).addClass("hide"),$("#show-outdated-"+t).removeClass("hide")})),$("button.comment-form-reply").on("click",(function(e){e.preventDefault(),$(this).hide();const t=$(this).parent().find(".comment-form");t.removeClass("hide"),g(t.find(".menu"))})),0!=$(".repository.pull.diff").length&&($(".diff-detail-box.ui.sticky").sticky(),$(".btn-review").on("click",(function(e){e.preventDefault(),$(this).closest(".dropdown").find(".menu").toggle("visible")})).closest(".dropdown").find(".link.close").on("click",(function(e){e.preventDefault(),$(this).closest(".menu").toggle("visible")})),$(".code-view .lines-code,.code-view .lines-num").on("mouseenter",(function(){const e=$(this).closest("td");$(this).closest("tr").addClass(e.hasClass("lines-num-old")||e.hasClass("lines-code-old")?"focus-lines-old":"focus-lines-new")})).on("mouseleave",(function(){$(this).closest("tr").removeClass("focus-lines-new focus-lines-old")})),$(".add-code-comment").on("click",(function(e){if($(e.target).hasClass("btn-add-single"))return;e.preventDefault();const t=$(this).closest(".code-diff").hasClass("code-diff-split"),n=$(this).data("side"),i=$(this).data("idx"),o=$(this).data("path"),a=$("#pull_review_add_comment").html(),s=$(this).closest("tr");let r=s.next();r.hasClass("add-comment")||(r=$('<tr class="add-comment">'+(t?'<td class="lines-num"></td><td class="lines-type-marker"></td><td class="add-comment-left"></td><td class="lines-num"></td><td class="lines-type-marker"></td><td class="add-comment-right"></td>':'<td class="lines-num"></td><td class="lines-num"></td><td class="lines-type-marker"></td><td class="add-comment-left add-comment-right"></td>')+"</tr>"),s.after(r));const c=r.find(".add-comment-"+n);let l=c.find(".comment-code-cloud");0===l.length&&(c.html(a),g((l=c.find(".comment-code-cloud")).find(".menu")),c.find("input[name='line']").val(i),c.find("input[name='side']").val("left"===n?"previous":"proposed"),c.find("input[name='path']").val(o)),l.find("textarea").focus()}))),function e(){const t=$("#repo_migrating");if($("#repo_migrating_failed").hide(),t){const n=t.attr("repo");if(void 0===n)return;$.ajax({type:"GET",url:a+"/"+n+"/status",data:{_csrf:o},complete:function(t){if(200==t.status&&t.responseJSON)return 0==t.responseJSON.status?void location.reload():void setTimeout((function(){e()}),2e3);$("#repo_migrating_progress").hide(),$("#repo_migrating_failed").show()}})}}(),function(){const e=$("#repo_template"),t=function(){const t=$("#template_units"),n=$("#non_template");""!==e.val()?(t.show(),n.hide()):(t.hide(),n.show())};e.change(t),t();const n=function(){$("#repo_template_search").dropdown({apiSettings:{url:a+"/api/v1/repos/search?q={query}&template=true&priority_owner_id="+$("#uid").val(),onResponse:function(e){const t={success:!0,results:[]};return t.results.push({name:"",value:""}),$.each(e.data,(function(e,n){t.results.push({name:i(n.full_name),value:n.id})})),t},cache:!1},fullTextSearch:!0})};$("#uid").change(n),n()}(),$("#repo-clone-url").length>0)switch(localStorage.getItem("repo-clone-protocol")){case"ssh":0===$("#repo-clone-ssh").click().length&&$("#repo-clone-https").click();break;default:$("#repo-clone-https").click()}const s={"div.user.settings":w,"div.repository.settings.collaboration":v};let r;for(r in s)if($(r).length>0){s[r]();break}const c=$("#clone_addr");c.change((function(){const e=$("#repo_name");c.val().length>0&&0===e.val().length&&e.val(c.val().match(/^(.*\/)?((.+?)(\.git)?)$/)[3])}))})),$((function(){0===$(".user.signin").length&&$("form:not(.ignore-dirty)").areYouSure(),$("#ssh-key-content").on("change paste keyup",(function(){const e=$(this).val().split(" "),t=$("#ssh-key-title");""===t.val()&&3===e.length&&""!==e[2]&&t.val(e[2])}))})),window.timeAddManual=function(){$(".mini.modal").modal({duration:200,onApprove:function(){$("#add_time_manual_form").submit()}}).modal("show")},window.toggleStopwatch=function(){$("#toggle_stopwatch_form").submit()},window.cancelStopwatch=function(){$("#cancel_stopwatch_form").submit()},window.initHeatmap=function(e,t,n){const i=document.getElementById(e);if(!i)return;(n=n||{}).contributions=n.contributions||"contributions",n.no_contributions=n.no_contributions||"No contributions";const o=["${","}"];Vue.component("activity-heatmap",{delimiters:o,props:{user:{type:String,required:!0},suburl:{type:String,required:!0},locale:{type:Object,required:!0}},data:function(){return{isLoading:!0,colorRange:[],endDate:null,values:[],totalContributions:0}},mounted:function(){this.colorRange=[this.getColor(0),this.getColor(1),this.getColor(2),this.getColor(3),this.getColor(4),this.getColor(5)],this.endDate=new Date,this.loadHeatmap(this.user)},methods:{loadHeatmap:function(e){const t=this;$.get(this.suburl+"/api/v1/users/"+e+"/heatmap",(function(e){const n=[];for(let i=0;i<e.length;i++)t.totalContributions+=e[i].contributions,n[i]={date:new Date(1e3*e[i].timestamp),count:e[i].contributions};t.values=n,t.isLoading=!1}))},getColor:function(e){const t=document.createElement("div");t.className="heatmap-color-"+e,document.body.appendChild(t);const n=getComputedStyle(t).backgroundColor;return document.body.removeChild(t),n}},template:'<div><div v-show="isLoading"><slot name="loading"></slot></div><h4 class="total-contributions" v-if="!isLoading"><span v-html="totalContributions"></span> total contributions in the last 12 months</h4><calendar-heatmap v-show="!isLoading" :locale="locale" :no-data-text="locale.no_contributions" :tooltip-unit="locale.contributions" :end-date="endDate" :values="values" :range-color="colorRange" />'}),new Vue({delimiters:o,el:i,data:{suburl:document.querySelector("meta[name=_suburl]").content,heatmapUser:t,locale:n}})},$(".commit-button").click((function(e){e.preventDefault(),$(this).parent().find(".commit-body").toggle()})),window.toggleDeadlineForm=function(){$("#deadlineForm").fadeToggle(150)},window.setDeadline=function(){!function(e){$("#deadline-err-invalid-date").hide(),$("#deadline-loader").addClass("loading");let t=null;if(""!==e){const n=Date.parse(e);if(isNaN(n))return $("#deadline-loader").removeClass("loading"),$("#deadline-err-invalid-date").show(),!1;t=new Date(n)}$.ajax($("#update-issue-deadline-form").attr("action")+"/deadline",{data:JSON.stringify({due_date:t}),headers:{"X-Csrf-Token":o,"X-Remote":!0},contentType:"application/json",type:"POST",success:function(){h()},error:function(){$("#deadline-loader").removeClass("loading"),$("#deadline-err-invalid-date").show()}})}($("#deadlineDate").val())},window.deleteDependencyModal=function(e,t){$(".remove-dependency").modal({closable:!1,duration:200,onApprove:function(){$("#removeDependencyID").val(e),$("#dependencyType").val(t),$("#removeDependencyForm").submit()}}).modal("show")},window.cancelCodeComment=function(e){const t=$(e).closest("form");t.length>0&&t.hasClass("comment-form")?(t.addClass("hide"),t.parent().find("button.comment-form-reply").show()):t.closest(".comment-code-cloud").remove()},window.onOAuthLoginClick=function(){const e=$("#oauth2-login-loader"),t=$("#oauth2-login-navigator");t.hide(),e.removeClass("disabled"),setTimeout((function(){e.addClass("disabled"),t.show()}),5e3)}}]);
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/public/js/index.js.map b/public/js/index.js.map
new file mode 100644 (file)
index 0000000..3d675c2
--- /dev/null
@@ -0,0 +1 @@
+{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./web_src/js/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","htmlEncode","text","jQuery","html","csrf","suburl","previewFileModes","simpleMDEditor","codeMirrorEditor","initCommentPreviewTab","$form","$tabMenu","find","tab","data","click","$this","$","this","post","val","$previewPanel","emojify","run","each","hljs","highlightBlock","buttonsClickOnEnter","initEditForm","length","$previewTab","split","initEditPreviewTab","$diffPreviewPanel","initEditDiffTab","updateIssuesMeta","url","action","issueIds","elementId","Promise","resolve","ajax","type","success","reload","window","location","initImagePaste","target","field","addEventListener","event","pasteEvent","callback","clipboardData","items","indexOf","blob","getAsFile","preventDefault","stopPropagation","retrieveImageFromClipboardAsBlob","img","substr","lastIndexOf","selectionStart","startPos","endPos","selectionEnd","substring","insertAtCursor","file","xhr","XMLHttpRequest","onload","status","responseText","open","setRequestHeader","formData","FormData","append","send","uploadFile","res","JSON","parse","oldval","newval","replace","replaceAndKeepCursor","uuid","input","initCommentForm","initListSubmits","selector","outerSelector","$list","$noSelect","$listMenu","hasLabelUpdateAction","labels","dropdown","promises","keys","forEach","label","promise","push","all","then","hasClass","removeClass","addClass","listIds","parent","join","selectItem","select_id","input_id","$menu","hasUpdateAction","$selectBranch","selectedValue","css","initBranchSelector","initRepository","initFilterSearchDropdown","$dropdown","fullTextSearch","selectOnKeydown","onChange","_text","_value","$choice","href","message","noResults","$data","searchTerm","canCreateBranch","menuVisible","active","branch","tag","selected","remove","Vue","delimiters","el","beforeMount","vm","$el","getAttribute","document","body","contains","set","watch","visible","focusSearchField","computed","filteredItems","filter","item","toLowerCase","showCreateNewBranch","showNoResults","methods","prev","getSelected","createNewBranch","$refs","newBranchForm","submit","nextTick","searchField","focus","j","getSelectedIndexInFiltered","scrollToActive","Array","isArray","cont","scrollContainer","offsetTop","scrollTop","clientHeight","keydown","keyCode","keyup","$prompt","toString","show","hide","change","checked","$newLabelPanel","minicolors","color_hex","modal","onApprove","$datepicker","datetimepicker","lang","inline","timepicker","startDate","formatDate","onSelectDate","ct","dateFormat","$issueTitle","$editInput","editTitleToggle","toggle","title","$segment","next","$editContentZone","$renderContent","$rawContent","$textarea","issuesTribute","attach","emojiTribute","$dropzone","$files","filenameDict","dropzone","headers","maxFiles","maxFilesize","acceptedFiles","addRemoveLinks","dictDefaultMessage","dictInvalidFileType","dictFileTooBig","dictRemoveFile","init","on","submitted","_csrf","getJSON","drop","removeAllFiles","empty","imgSrc","emit","files","$editContentForm","attr","$attachments","map","content","$content","attachments","confirm","$statusButton","$mergeButton","e","closest","initReactionSelector","reactions","popup","done","resp","react","insertBefore","appendTo","hasEmoji","$item","addLine","delLine","addPercent","parseFloat","localStorage","setItem","select","$repoComparePull","assingMenuAttributes","menu","id","Math","floor","random","initRepositoryCollaboration","initEditor","prop","$editFilename","$section","$divider","parts","getCursorPosition","last","setSelectionRange","element","trigger","$editArea","markdownFileExts","lineWrapExtensions","spec","extension","extWithDot","dataUrl","apiCall","exec","info","CodeMirror","findModeByExtension","previewLink","mime","toTextArea","SimpleMDE","autoDownloadFontAwesome","forceSync","renderingConfig","singleLineBreaks","indentWithTabs","tabSize","spellChecker","previewRender","plainText","preview","setTimeout","innerHTML","toolbar","setSimpleMDE","fromTextArea","lineNumbers","cm","_change","getValue","setCodeMirror","setOption","autoLoadMode","editorconfig","indent_style","Tab","spaces","parseInt","getOption","replaceSelection","indent_size","tab_width","$commitButton","$editForm","areYouSure","silent","dirtyClass","fieldSelector","dirty","initUserSettings","keypress","initCodeView","$select","siblings","selectRange","shiftKey","eq","getSelection","removeAllRanges","selection","hash","match","$first","offset","top","u2fSigned","stringify","contentType","fail","u2fError","u2fRegistered","errorCode","checkError","errorType","u2fErrors","1","2","3","4","5","u2fRegisterRequest","req","registeredKeys","u2fApi","register","appId","registerRequests","catch","reason","undefined","metaData","code","changeHash","history","pushState","$from","a","b","classes","showDeletePopup","dialog","closable","redirect","showAddAllPopup","Dropzone","autoDiscover","from","toStr","isCallable","fn","maxSafeInteger","pow","toLength","len","number","Number","isNaN","isFinite","abs","toInteger","min","max","arrayLike","C","TypeError","mapFn","arguments","T","A","kValue","k","assign","_varArgs","to","index","nextSource","nextKey","writable","configurable","String","endsWith","pattern","pos","Sel","createRange","SelLength","moveStart","ready","onShow","transition","direction","accordion","checkbox","progress","showActivity","slideToggle","nodes","slice","querySelectorAll","setConfig","img_dir","ignore_emoticons","getElementsByClassName","childNodes","nodeName","clipboard","Clipboard","clearSelection","setAttribute","node","encodeURIComponent","wrap","children","dataset","issueIDs","issueId","_","first","search","minCharacters","apiSettings","onResponse","response","_i","login","full_name","image","avatar_url","results","searchFields","$searchTeamBox","permission","searchTeams","$searchRepoBox","description","searchRepositories","dbType","dbDefaults","_type","defaultHost","is","toggleMigrations","authUserName","cloneAddr","startsWith","initMigration","simplemde","codemirror","cursorPos","getCursor","setCursor","line","ch","className","getInputField","initWikiForm","updateContentType","initWebhook","removeAttr","authType","onOAuth2Change","onSecurityProtocolChange","onUsePagedSearchChange","onOAuth2UseCustomURLChange","$detailModal","$checkboxes","ids","provider","initAdmin","getElementById","component","props","searchLimit","default","required","uid","organizations","isOrganization","Boolean","canCreateOrganization","organizationsTotalCount","moreReposLink","repos","reposTotalCount","reposFilter","searchQuery","isLoading","repoTypes","count","searchMode","showMoreReposLink","searchURL","repoTypeCount","mounted","searchRepos","self","changeTab","changeReposFilter","showRepo","repo","owner","mirror","fork","searchedMode","searchedURL","searchedQuery","result","_textStatus","request","getResponseHeader","always","repoClass","private","querySelector","initVueApp","ctrlKey","altKey","metaKey","isExpanded","initNavbarContentToggle","mgrBtn","editDiv","viewDiv","saveBtn","topicDropdown","topicForm","topicPrompts","hidePrompt","prompts","countPrompt","formatPrompt","getPrompts","topics","_data","responseJSON","topicArray","invalidTopics","topicLables","form","allowAdditions","forceSelection","fields","saveRemoteData","duration","variation","blue","basic","throttle","cache","formattedResponse","query","urlData","trim","found_query","current_topics","found","topic_name","unshift","sort","onLabelCreate","contents","replaceWith","onAdd","addedValue","_addedText","$addedChoice","settings","rules","validateTopic","_values","regExp","identifier","prompt","initTopicbar","ensureSupport","sign","challenge","err","allowMultiple","repolink","repoId","crossRepoSearch","issueSearchUrl","filteredResponse","currIssueId","issue","repository","regStr","newStr","RegExp","selectedItems","initIssueList","toUpperCase","wipPrefixes","sticky","isSplit","side","idx","path","tr","ntr","after","td","commentCloud","initRepoStatusChecker","migrating","repo_name","complete","$repoTemplate","checkTemplate","$templateUnits","$nonTemplate","changeOwner","_r","initTemplateSearch","getItem","routes","$cloneAddr","$repoName","arrays","$title","timeAddManual","toggleStopwatch","cancelStopwatch","initHeatmap","appElementId","heatmapUser","locale","contributions","no_contributions","vueDelimeters","user","colorRange","endDate","values","totalContributions","getColor","Date","loadHeatmap","userName","chartRawData","chartData","date","timestamp","createElement","appendChild","color","getComputedStyle","backgroundColor","removeChild","template","toggleDeadlineForm","fadeToggle","setDeadline","deadlineString","realDeadline","newDate","error","updateDeadline","deleteDependencyModal","cancelCodeComment","btn","onOAuthLoginClick","oauthLoader","oauthNav"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB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a,mBACbxU,KAAM,OACNC,QAAS,WACLC,KAEJoqB,MAAO,WACHhsB,EAAE,oBAAoBgG,YAAY,WAClChG,EAAE,8BAA8BiL,UAnCxCghB,CADiBjsB,EAAE,iBAAiBG,QAyCxC0B,OAAOqqB,sBAAwB,SAASxb,EAAIhP,GACxC1B,EAAE,sBACGwL,MAAM,CACH4M,UAAU,EACV0M,SAAU,IACVrZ,UAAW,WACPzL,EAAE,uBAAuBG,IAAIuQ,GAC7B1Q,EAAE,mBAAmBG,IAAIuB,GACzB1B,EAAE,yBAAyB8J,YAEhC0B,MAAM,SAyEjB3J,OAAOsqB,kBAAoB,SAASC,GAChC,MAAM3H,EAAOzkB,EAAEosB,GAAK/c,QAAQ,QACzBoV,EAAK7jB,OAAS,GAAK6jB,EAAK1e,SAAS,iBAChC0e,EAAKxe,SAAS,QACdwe,EAAKte,SAASxG,KAAK,6BAA6BsL,QAEhDwZ,EAAKpV,QAAQ,uBAAuBnH,UAG5CrG,OAAOwqB,kBAAoB,WACvB,MAAMC,EAActsB,EAAE,wBAChBusB,EAAWvsB,EAAE,2BAEnBusB,EAASrhB,OACTohB,EAAYtmB,YAAY,YAExBoN,YAAW,WAGPkZ,EAAYrmB,SAAS,YACrBsmB,EAASthB,SACX","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","/* globals wipPrefixes, issuesTribute, emojiTribute */\n/* exported timeAddManual, toggleStopwatch, cancelStopwatch, initHeatmap */\n/* exported toggleDeadlineForm, setDeadline, deleteDependencyModal, cancelCodeComment, onOAuthLoginClick */\n'use strict';\n\nfunction htmlEncode(text) {\n   return jQuery('<div />').text(text).html()\n}\n\nlet csrf;\nlet suburl;\nlet previewFileModes;\nlet simpleMDEditor;\nlet codeMirrorEditor;\n\n// Disable Dropzone auto-discover because it's manually initialized\nif (typeof(Dropzone) !== \"undefined\") {\n    Dropzone.autoDiscover = false;\n}\n\n// Polyfill for IE9+ support (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from)\nif (!Array.from) {\n    Array.from = (function () {\n        const toStr = Object.prototype.toString;\n        const isCallable = function (fn) {\n            return typeof fn === 'function' || toStr.call(fn) === '[object Function]';\n        };\n        const toInteger = function (value) {\n            const number = Number(value);\n            if (isNaN(number)) { return 0; }\n            if (number === 0 || !isFinite(number)) { return number; }\n            return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));\n        };\n        const maxSafeInteger = Math.pow(2, 53) - 1;\n        const toLength = function (value) {\n            const len = toInteger(value);\n            return Math.min(Math.max(len, 0), maxSafeInteger);\n        };\n\n        // The length property of the from method is 1.\n        return function from(arrayLike/*, mapFn, thisArg */) {\n            // 1. Let C be the this value.\n            const C = this;\n\n            // 2. Let items be ToObject(arrayLike).\n            const items = Object(arrayLike);\n\n            // 3. ReturnIfAbrupt(items).\n            if (arrayLike == null) {\n                throw new TypeError(\"Array.from requires an array-like object - not null or undefined\");\n            }\n\n            // 4. If mapfn is undefined, then let mapping be false.\n            const mapFn = arguments.length > 1 ? arguments[1] : void undefined;\n            let T;\n            if (typeof mapFn !== 'undefined') {\n                // 5. else\n                // 5. a If IsCallable(mapfn) is false, throw a TypeError exception.\n                if (!isCallable(mapFn)) {\n                    throw new TypeError('Array.from: when provided, the second argument must be a function');\n                }\n\n                // 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.\n                if (arguments.length > 2) {\n                    T = arguments[2];\n                }\n            }\n\n            // 10. Let lenValue be Get(items, \"length\").\n            // 11. Let len be ToLength(lenValue).\n            const len = toLength(items.length);\n\n            // 13. If IsConstructor(C) is true, then\n            // 13. a. Let A be the result of calling the [[Construct]] internal method of C with an argument list containing the single item len.\n            // 14. a. Else, Let A be ArrayCreate(len).\n            const A = isCallable(C) ? Object(new C(len)) : new Array(len);\n\n            // 16. Let k be 0.\n            let k = 0;\n            // 17. Repeat, while k < len… (also steps a - h)\n            let kValue;\n            while (k < len) {\n                kValue = items[k];\n                if (mapFn) {\n                    A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k);\n                } else {\n                    A[k] = kValue;\n                }\n                k += 1;\n            }\n            // 18. Let putStatus be Put(A, \"length\", len, true).\n            A.length = len;\n            // 20. Return A.\n            return A;\n        };\n    }());\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\nif (typeof Object.assign != 'function') {\n    // Must be writable: true, enumerable: false, configurable: true\n    Object.defineProperty(Object, \"assign\", {\n        value: function assign(target, _varArgs) { // .length of function is 2\n            'use strict';\n            if (target == null) { // TypeError if undefined or null\n                throw new TypeError('Cannot convert undefined or null to object');\n            }\n\n            const to = Object(target);\n\n            for (let index = 1; index < arguments.length; index++) {\n                const nextSource = arguments[index];\n\n                if (nextSource != null) { // Skip over if undefined or null\n                    for (const nextKey in nextSource) {\n                        // Avoid bugs when hasOwnProperty is shadowed\n                        if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {\n                            to[nextKey] = nextSource[nextKey];\n                        }\n                    }\n                }\n            }\n            return to;\n        },\n        writable: true,\n        configurable: true\n    });\n}\n\nfunction initCommentPreviewTab($form) {\n    const $tabMenu = $form.find('.tabular.menu');\n    $tabMenu.find('.item').tab();\n    $tabMenu.find('.item[data-tab=\"' + $tabMenu.data('preview') + '\"]').click(function () {\n        const $this = $(this);\n        $.post($this.data('url'), {\n                \"_csrf\": csrf,\n                \"mode\": \"gfm\",\n                \"context\": $this.data('context'),\n                \"text\": $form.find('.tab.segment[data-tab=\"' + $tabMenu.data('write') + '\"] textarea').val()\n            },\n            function (data) {\n                const $previewPanel = $form.find('.tab.segment[data-tab=\"' + $tabMenu.data('preview') + '\"]');\n                $previewPanel.html(data);\n                emojify.run($previewPanel[0]);\n                $('pre code', $previewPanel[0]).each(function () {\n                    hljs.highlightBlock(this);\n                });\n            }\n        );\n    });\n\n    buttonsClickOnEnter();\n}\n\nfunction initEditPreviewTab($form) {\n    const $tabMenu = $form.find('.tabular.menu');\n    $tabMenu.find('.item').tab();\n    const $previewTab = $tabMenu.find('.item[data-tab=\"' + $tabMenu.data('preview') + '\"]');\n    if ($previewTab.length) {\n        previewFileModes = $previewTab.data('preview-file-modes').split(',');\n        $previewTab.click(function () {\n            const $this = $(this);\n            $.post($this.data('url'), {\n                    \"_csrf\": csrf,\n                    \"mode\": \"gfm\",\n                    \"context\": $this.data('context'),\n                    \"text\": $form.find('.tab.segment[data-tab=\"' + $tabMenu.data('write') + '\"] textarea').val()\n                },\n                function (data) {\n                    const $previewPanel = $form.find('.tab.segment[data-tab=\"' + $tabMenu.data('preview') + '\"]');\n                    $previewPanel.html(data);\n                    emojify.run($previewPanel[0]);\n                    $('pre code', $previewPanel[0]).each(function () {\n                        hljs.highlightBlock(this);\n                    });\n                }\n            );\n        });\n    }\n}\n\nfunction initEditDiffTab($form) {\n    const $tabMenu = $form.find('.tabular.menu');\n    $tabMenu.find('.item').tab();\n    $tabMenu.find('.item[data-tab=\"' + $tabMenu.data('diff') + '\"]').click(function () {\n        const $this = $(this);\n        $.post($this.data('url'), {\n                \"_csrf\": csrf,\n                \"context\": $this.data('context'),\n                \"content\": $form.find('.tab.segment[data-tab=\"' + $tabMenu.data('write') + '\"] textarea').val()\n            },\n            function (data) {\n                const $diffPreviewPanel = $form.find('.tab.segment[data-tab=\"' + $tabMenu.data('diff') + '\"]');\n                $diffPreviewPanel.html(data);\n                emojify.run($diffPreviewPanel[0]);\n            }\n        );\n    });\n}\n\n\nfunction initEditForm() {\n    if ($('.edit.form').length == 0) {\n        return;\n    }\n\n    initEditPreviewTab($('.edit.form'));\n    initEditDiffTab($('.edit.form'));\n}\n\nfunction initBranchSelector() {\n    const $selectBranch = $('.ui.select-branch')\n    const $branchMenu = $selectBranch.find('.reference-list-menu');\n    $branchMenu.find('.item:not(.no-select)').click(function () {\n        const selectedValue = $(this).data('id');\n        $($(this).data('id-selector')).val(selectedValue);\n        $selectBranch.find('.ui .branch-name').text(selectedValue);\n    });\n    $selectBranch.find('.reference.column').click(function () {\n        $selectBranch.find('.scrolling.reference-list-menu').css('display', 'none');\n        $selectBranch.find('.reference .text').removeClass('black');\n        $($(this).data('target')).css('display', 'block');\n        $(this).find('.text').addClass('black');\n        return false;\n    });\n}\n\nfunction updateIssuesMeta(url, action, issueIds, elementId) {\n    return new Promise(function(resolve) {\n        $.ajax({\n            type: \"POST\",\n            url: url,\n            data: {\n                \"_csrf\": csrf,\n                \"action\": action,\n                \"issue_ids\": issueIds,\n                \"id\": elementId\n            },\n            success: resolve\n        })\n    })\n}\n\nfunction initRepoStatusChecker() {\n    const migrating = $(\"#repo_migrating\");\n    $('#repo_migrating_failed').hide();\n    if (migrating) {\n        const repo_name = migrating.attr('repo');\n        if (typeof repo_name === 'undefined') {\n            return\n        }\n        $.ajax({\n            type: \"GET\",\n            url: suburl +\"/\"+repo_name+\"/status\",\n            data: {\n                \"_csrf\": csrf,\n            },\n            complete: function(xhr) {\n                if (xhr.status == 200) {\n                    if (xhr.responseJSON) {\n                        if (xhr.responseJSON[\"status\"] == 0) {\n                            location.reload();\n                            return\n                        }\n\n                        setTimeout(function () {\n                            initRepoStatusChecker()\n                        }, 2000);\n                        return\n                    }\n                }\n                $('#repo_migrating_progress').hide();\n                $('#repo_migrating_failed').show();\n            }\n        })\n    }\n}\n\nfunction initReactionSelector(parent) {\n    let reactions = '';\n    if (!parent) {\n        parent = $(document);\n        reactions = '.reactions > ';\n    }\n\n    parent.find(reactions + 'a.label').popup({'position': 'bottom left', 'metadata': {'content': 'title', 'title': 'none'}});\n\n    parent.find('.select-reaction > .menu > .item, ' + reactions + 'a.label').on('click', function(e){\n        const vm = this;\n        e.preventDefault();\n\n        if ($(this).hasClass('disabled')) return;\n\n        const actionURL = $(this).hasClass('item') ?\n                $(this).closest('.select-reaction').data('action-url') :\n                $(this).data('action-url');\n        const url = actionURL + '/' + ($(this).hasClass('blue') ? 'unreact' : 'react');\n        $.ajax({\n            type: 'POST',\n            url: url,\n            data: {\n                '_csrf': csrf,\n                'content': $(this).data('content')\n            }\n        }).done(function(resp) {\n            if (resp && (resp.html || resp.empty)) {\n                const content = $(vm).closest('.content');\n                let react = content.find('.segment.reactions');\n                if (!resp.empty && react.length > 0) {\n                    react.remove();\n                }\n                if (!resp.empty) {\n                    react = $('<div class=\"ui attached segment reactions\"></div>');\n                    const attachments = content.find('.segment.bottom:first');\n                    if (attachments.length > 0) {\n                        react.insertBefore(attachments);\n                    } else {\n                        react.appendTo(content);\n                    }\n                    react.html(resp.html);\n                    const hasEmoji = react.find('.has-emoji');\n                    for (let i = 0; i < hasEmoji.length; i++) {\n                        emojify.run(hasEmoji.get(i));\n                    }\n                    react.find('.dropdown').dropdown();\n                    initReactionSelector(react);\n                }\n            }\n        });\n    });\n}\n\nfunction insertAtCursor(field, value) {\n    if (field.selectionStart || field.selectionStart === 0) {\n        const startPos = field.selectionStart;\n        const endPos = field.selectionEnd;\n        field.value = field.value.substring(0, startPos)\n            + value\n            + field.value.substring(endPos, field.value.length);\n        field.selectionStart = startPos + value.length;\n        field.selectionEnd = startPos + value.length;\n    } else {\n        field.value += value;\n    }\n}\n\nfunction replaceAndKeepCursor(field, oldval, newval) {\n    if (field.selectionStart || field.selectionStart === 0) {\n        const startPos = field.selectionStart;\n        const endPos = field.selectionEnd;\n        field.value = field.value.replace(oldval, newval);\n        field.selectionStart = startPos + newval.length - oldval.length;\n        field.selectionEnd = endPos + newval.length - oldval.length;\n    } else {\n        field.value = field.value.replace(oldval, newval);\n    }\n}\n\nfunction retrieveImageFromClipboardAsBlob(pasteEvent, callback){\n    if (!pasteEvent.clipboardData) {\n        return;\n    }\n\n    const items = pasteEvent.clipboardData.items;\n    if (typeof(items) === \"undefined\") {\n        return;\n    }\n\n    for (let i = 0; i < items.length; i++) {\n        if (items[i].type.indexOf(\"image\") === -1) continue;\n        const blob = items[i].getAsFile();\n\n        if (typeof(callback) === \"function\") {\n            pasteEvent.preventDefault();\n            pasteEvent.stopPropagation();\n            callback(blob);\n        }\n    }\n}\n\nfunction uploadFile(file, callback) {\n    const xhr = new XMLHttpRequest();\n\n    xhr.onload = function() {\n        if (xhr.status == 200) {\n            callback(xhr.responseText);\n        }\n    };\n\n    xhr.open(\"post\", suburl + \"/attachments\", true);\n    xhr.setRequestHeader(\"X-Csrf-Token\", csrf);\n    const formData = new FormData();\n    formData.append('file', file, file.name);\n    xhr.send(formData);\n}\n\nfunction reload() {\n    window.location.reload();\n}\n\nfunction initImagePaste(target) {\n    target.each(function() {\n        const field = this;\n        field.addEventListener('paste', function(event){\n            retrieveImageFromClipboardAsBlob(event, function(img) {\n                const name = img.name.substr(0, img.name.lastIndexOf('.'));\n                insertAtCursor(field, '![' + name + ']()');\n                uploadFile(img, function(res) {\n                    const data = JSON.parse(res);\n                    replaceAndKeepCursor(field, '![' + name + ']()', '![' + name + '](' + suburl + '/attachments/' + data.uuid + ')');\n                    const input = $('<input id=\"' + data.uuid + '\" name=\"files\" type=\"hidden\">').val(data.uuid);\n                    $('.files').append(input);\n                });\n            });\n        }, false);\n    });\n}\n\nfunction initCommentForm() {\n    if ($('.comment.form').length == 0) {\n        return\n    }\n\n    initBranchSelector();\n    initCommentPreviewTab($('.comment.form'));\n    initImagePaste($('.comment.form textarea'));\n\n    // Listsubmit\n    function initListSubmits(selector, outerSelector) {\n        const $list = $('.ui.' + outerSelector + '.list');\n        const $noSelect = $list.find('.no-select');\n        const $listMenu = $('.' + selector + ' .menu');\n        let hasLabelUpdateAction = $listMenu.data('action') == 'update';\n        const labels = {};\n\n        $('.' + selector).dropdown('setting', 'onHide', function(){\n            hasLabelUpdateAction = $listMenu.data('action') == 'update'; // Update the var\n            if (hasLabelUpdateAction) {\n                const promises = [];\n                Object.keys(labels).forEach(function(elementId) {\n                    const label = labels[elementId];\n                    const promise = updateIssuesMeta(\n                        label[\"update-url\"],\n                        label[\"action\"],\n                        label[\"issue-id\"],\n                        elementId\n                    );\n                    promises.push(promise);\n                });\n                Promise.all(promises).then(reload);\n            }\n        });\n\n        $listMenu.find('.item:not(.no-select)').click(function () {\n\n            // we don't need the action attribute when updating assignees\n            if (selector == 'select-assignees-modify') {\n\n                // UI magic. We need to do this here, otherwise it would destroy the functionality of\n                // adding/removing labels\n                if ($(this).hasClass('checked')) {\n                    $(this).removeClass('checked');\n                    $(this).find('.octicon').removeClass('octicon-check');\n                } else {\n                    $(this).addClass('checked');\n                    $(this).find('.octicon').addClass('octicon-check');\n                }\n\n                updateIssuesMeta(\n                    $listMenu.data('update-url'),\n                    \"\",\n                    $listMenu.data('issue-id'),\n                    $(this).data('id')\n                );\n                $listMenu.data('action', 'update'); // Update to reload the page when we updated items\n                return false;\n            }\n\n            if ($(this).hasClass('checked')) {\n                $(this).removeClass('checked');\n                $(this).find('.octicon').removeClass('octicon-check');\n                if (hasLabelUpdateAction) {\n                    if (!($(this).data('id') in labels)) {\n                        labels[$(this).data('id')] = {\n                            \"update-url\": $listMenu.data('update-url'),\n                            \"action\": \"detach\",\n                            \"issue-id\": $listMenu.data('issue-id'),\n                        };\n                    } else {\n                        delete labels[$(this).data('id')];\n                    }\n                }\n            } else {\n                $(this).addClass('checked');\n                $(this).find('.octicon').addClass('octicon-check');\n                if (hasLabelUpdateAction) {\n                    if (!($(this).data('id') in labels)) {\n                        labels[$(this).data('id')] = {\n                            \"update-url\": $listMenu.data('update-url'),\n                            \"action\": \"attach\",\n                            \"issue-id\": $listMenu.data('issue-id'),\n                        };\n                    } else {\n                        delete labels[$(this).data('id')];\n                    }\n                }\n            }\n\n            const listIds = [];\n            $(this).parent().find('.item').each(function () {\n                if ($(this).hasClass('checked')) {\n                    listIds.push($(this).data('id'));\n                    $($(this).data('id-selector')).removeClass('hide');\n                } else {\n                    $($(this).data('id-selector')).addClass('hide');\n                }\n            });\n            if (listIds.length == 0) {\n                $noSelect.removeClass('hide');\n            } else {\n                $noSelect.addClass('hide');\n            }\n            $($(this).parent().data('id')).val(listIds.join(\",\"));\n            return false;\n        });\n        $listMenu.find('.no-select.item').click(function () {\n            if (hasLabelUpdateAction || selector == 'select-assignees-modify') {\n                updateIssuesMeta(\n                    $listMenu.data('update-url'),\n                    \"clear\",\n                    $listMenu.data('issue-id'),\n                    \"\"\n                ).then(reload);\n            }\n\n            $(this).parent().find('.item').each(function () {\n                $(this).removeClass('checked');\n                $(this).find('.octicon').removeClass('octicon-check');\n            });\n\n            $list.find('.item').each(function () {\n                $(this).addClass('hide');\n            });\n            $noSelect.removeClass('hide');\n            $($(this).parent().data('id')).val('');\n\n        });\n    }\n\n    // Init labels and assignees\n    initListSubmits('select-label', 'labels');\n    initListSubmits('select-assignees', 'assignees');\n    initListSubmits('select-assignees-modify', 'assignees');\n\n    function selectItem(select_id, input_id) {\n        const $menu = $(select_id + ' .menu');\n        const $list = $('.ui' + select_id + '.list');\n        const hasUpdateAction = $menu.data('action') == 'update';\n\n        $menu.find('.item:not(.no-select)').click(function () {\n            $(this).parent().find('.item').each(function () {\n                $(this).removeClass('selected active')\n            });\n\n            $(this).addClass('selected active');\n            if (hasUpdateAction) {\n                updateIssuesMeta(\n                    $menu.data('update-url'),\n                    \"\",\n                    $menu.data('issue-id'),\n                    $(this).data('id')\n                ).then(reload);\n            }\n            switch (input_id) {\n                case '#milestone_id':\n                    $list.find('.selected').html('<a class=\"item\" href=' + $(this).data('href') + '>' +\n                        htmlEncode($(this).text()) + '</a>');\n                    break;\n                case '#assignee_id':\n                    $list.find('.selected').html('<a class=\"item\" href=' + $(this).data('href') + '>' +\n                        '<img class=\"ui avatar image\" src=' + $(this).data('avatar') + '>' +\n                        htmlEncode($(this).text()) + '</a>');\n            }\n            $('.ui' + select_id + '.list .no-select').addClass('hide');\n            $(input_id).val($(this).data('id'));\n        });\n        $menu.find('.no-select.item').click(function () {\n            $(this).parent().find('.item:not(.no-select)').each(function () {\n                $(this).removeClass('selected active')\n            });\n\n            if (hasUpdateAction) {\n                updateIssuesMeta(\n                    $menu.data('update-url'),\n                    \"\",\n                    $menu.data('issue-id'),\n                    $(this).data('id')\n                ).then(reload);\n            }\n\n            $list.find('.selected').html('');\n            $list.find('.no-select').removeClass('hide');\n            $(input_id).val('');\n        });\n    }\n\n    // Milestone and assignee\n    selectItem('.select-milestone', '#milestone_id');\n    selectItem('.select-assignee', '#assignee_id');\n}\n\nfunction initInstall() {\n    if ($('.install').length == 0) {\n        return;\n    }\n\n    if ($('#db_host').val()==\"\") {\n        $('#db_host').val(\"127.0.0.1:3306\");\n        $('#db_user').val(\"gitea\");\n        $('#db_name').val(\"gitea\");\n    }\n\n    // Database type change detection.\n    $(\"#db_type\").change(function () {\n        const sqliteDefault = 'data/gitea.db';\n        const tidbDefault = 'data/gitea_tidb';\n\n        const dbType = $(this).val();\n        if (dbType === \"SQLite3\") {\n            $('#sql_settings').hide();\n            $('#pgsql_settings').hide();\n            $('#mysql_settings').hide();\n            $('#sqlite_settings').show();\n\n            if (dbType === \"SQLite3\" && $('#db_path').val() == tidbDefault) {\n                $('#db_path').val(sqliteDefault);\n            }\n            return;\n        }\n\n        const dbDefaults = {\n            \"MySQL\": \"127.0.0.1:3306\",\n            \"PostgreSQL\": \"127.0.0.1:5432\",\n            \"MSSQL\": \"127.0.0.1:1433\"\n        };\n\n        $('#sqlite_settings').hide();\n        $('#sql_settings').show();\n\n        $('#pgsql_settings').toggle(dbType === \"PostgreSQL\");\n        $('#mysql_settings').toggle(dbType === \"MySQL\");\n        $.each(dbDefaults, function(_type, defaultHost) {\n            if ($('#db_host').val() == defaultHost) {\n                $('#db_host').val(dbDefaults[dbType]);\n                return false;\n            }\n        });\n    });\n\n    // TODO: better handling of exclusive relations.\n    $('#offline-mode input').change(function () {\n        if ($(this).is(':checked')) {\n            $('#disable-gravatar').checkbox('check');\n            $('#federated-avatar-lookup').checkbox('uncheck');\n        }\n    });\n    $('#disable-gravatar input').change(function () {\n        if ($(this).is(':checked')) {\n            $('#federated-avatar-lookup').checkbox('uncheck');\n        } else {\n            $('#offline-mode').checkbox('uncheck');\n        }\n    });\n    $('#federated-avatar-lookup input').change(function () {\n        if ($(this).is(':checked')) {\n            $('#disable-gravatar').checkbox('uncheck');\n            $('#offline-mode').checkbox('uncheck');\n        }\n    });\n    $('#enable-openid-signin input').change(function () {\n        if ($(this).is(':checked')) {\n            if (!$('#disable-registration input').is(':checked')) {\n                $('#enable-openid-signup').checkbox('check');\n            }\n        } else {\n            $('#enable-openid-signup').checkbox('uncheck');\n        }\n    });\n    $('#disable-registration input').change(function () {\n        if ($(this).is(':checked')) {\n            $('#enable-captcha').checkbox('uncheck');\n            $('#enable-openid-signup').checkbox('uncheck');\n        } else {\n            $('#enable-openid-signup').checkbox('check');\n        }\n    });\n    $('#enable-captcha input').change(function () {\n        if ($(this).is(':checked')) {\n            $('#disable-registration').checkbox('uncheck');\n        }\n    });\n}\n\nfunction initRepository() {\n    if ($('.repository').length == 0) {\n        return;\n    }\n\n    function initFilterSearchDropdown(selector) {\n        const $dropdown = $(selector);\n        $dropdown.dropdown({\n            fullTextSearch: true,\n            selectOnKeydown: false,\n            onChange: function (_text, _value, $choice) {\n                if ($choice.data('url')) {\n                    window.location.href = $choice.data('url');\n                }\n            },\n            message: {noResults: $dropdown.data('no-results')}\n        });\n    }\n\n    // File list and commits\n    if ($('.repository.file.list').length > 0 ||\n        ('.repository.commits').length > 0) {\n        initFilterBranchTagDropdown('.choose.reference .dropdown');\n    }\n\n    // Wiki\n    if ($('.repository.wiki.view').length > 0) {\n        initFilterSearchDropdown('.choose.page .dropdown');\n    }\n\n    // Options\n    if ($('.repository.settings.options').length > 0) {\n        $('#repo_name').keyup(function () {\n            const $prompt = $('#repo-name-change-prompt');\n            if ($(this).val().toString().toLowerCase() != $(this).data('name').toString().toLowerCase()) {\n                $prompt.show();\n            } else {\n                $prompt.hide();\n            }\n        });\n\n        // Enable or select internal/external wiki system and issue tracker.\n        $('.enable-system').change(function () {\n            if (this.checked) {\n                $($(this).data('target')).removeClass('disabled');\n                if (!$(this).data('context')) $($(this).data('context')).addClass('disabled');\n            } else {\n                $($(this).data('target')).addClass('disabled');\n                if (!$(this).data('context')) $($(this).data('context')).removeClass('disabled');\n            }\n        });\n        $('.enable-system-radio').change(function () {\n            if (this.value == 'false') {\n                $($(this).data('target')).addClass('disabled');\n                if (typeof $(this).data('context') !== 'undefined') $($(this).data('context')).removeClass('disabled');\n            } else if (this.value == 'true') {\n                $($(this).data('target')).removeClass('disabled');\n                if (typeof $(this).data('context') !== 'undefined')  $($(this).data('context')).addClass('disabled');\n            }\n        });\n    }\n\n    // Labels\n    if ($('.repository.labels').length > 0) {\n        // Create label\n        const $newLabelPanel = $('.new-label.segment');\n        $('.new-label.button').click(function () {\n            $newLabelPanel.show();\n        });\n        $('.new-label.segment .cancel').click(function () {\n            $newLabelPanel.hide();\n        });\n\n        $('.color-picker').each(function () {\n            $(this).minicolors();\n        });\n        $('.precolors .color').click(function () {\n            const color_hex = $(this).data('color-hex');\n            $('.color-picker').val(color_hex);\n            $('.minicolors-swatch-color').css(\"background-color\", color_hex);\n        });\n        $('.edit-label-button').click(function () {\n            $('#label-modal-id').val($(this).data('id'));\n            $('.edit-label .new-label-input').val($(this).data('title'));\n            $('.edit-label .new-label-desc-input').val($(this).data('description'));\n            $('.edit-label .color-picker').val($(this).data('color'));\n            $('.minicolors-swatch-color').css(\"background-color\", $(this).data('color'));\n            $('.edit-label.modal').modal({\n                onApprove: function () {\n                    $('.edit-label.form').submit();\n                }\n            }).modal('show');\n            return false;\n        });\n    }\n\n    // Milestones\n    if ($('.repository.new.milestone').length > 0) {\n        const $datepicker = $('.milestone.datepicker');\n        $datepicker.datetimepicker({\n            lang: $datepicker.data('lang'),\n            inline: true,\n            timepicker: false,\n            startDate: $datepicker.data('start-date'),\n            formatDate: 'Y-m-d',\n            onSelectDate: function (ct) {\n                $('#deadline').val(ct.dateFormat('Y-m-d'));\n            }\n        });\n        $('#clear-date').click(function () {\n            $('#deadline').val('');\n            return false;\n        });\n    }\n\n    // Issues\n    if ($('.repository.view.issue').length > 0) {\n        // Edit issue title\n        const $issueTitle = $('#issue-title');\n        const $editInput = $('#edit-title-input input');\n        const editTitleToggle = function () {\n            $issueTitle.toggle();\n            $('.not-in-edit').toggle();\n            $('#edit-title-input').toggle();\n            $('.in-edit').toggle();\n            $editInput.focus();\n            return false;\n        };\n        $('#edit-title').click(editTitleToggle);\n        $('#cancel-edit-title').click(editTitleToggle);\n        $('#save-edit-title').click(editTitleToggle).click(function () {\n            if ($editInput.val().length == 0 ||\n                $editInput.val() == $issueTitle.text()) {\n                $editInput.val($issueTitle.text());\n                return false;\n            }\n\n            $.post($(this).data('update-url'), {\n                    \"_csrf\": csrf,\n                    \"title\": $editInput.val()\n                },\n                function (data) {\n                    $editInput.val(data.title);\n                    $issueTitle.text(data.title);\n                    reload();\n                });\n            return false;\n        });\n\n        // Edit issue or comment content\n        $('.edit-content').click(function () {\n            const $segment = $(this).parent().parent().parent().next();\n            const $editContentZone = $segment.find('.edit-content-zone');\n            const $renderContent = $segment.find('.render-content');\n            const $rawContent = $segment.find('.raw-content');\n            let $textarea;\n\n            // Setup new form\n            if ($editContentZone.html().length == 0) {\n                $editContentZone.html($('#edit-content-form').html());\n                $textarea = $editContentZone.find('textarea');\n                issuesTribute.attach($textarea.get());\n                emojiTribute.attach($textarea.get());\n\n                const $dropzone = $editContentZone.find('.dropzone');\n                $dropzone.data(\"saved\", false);\n                const $files = $editContentZone.find('.comment-files');\n                if ($dropzone.length > 0) {\n                    const filenameDict = {};\n                    $dropzone.dropzone({\n                        url: $dropzone.data('upload-url'),\n                        headers: {\"X-Csrf-Token\": csrf},\n                        maxFiles: $dropzone.data('max-file'),\n                        maxFilesize: $dropzone.data('max-size'),\n                        acceptedFiles: ($dropzone.data('accepts') === '*/*') ? null : $dropzone.data('accepts'),\n                        addRemoveLinks: true,\n                        dictDefaultMessage: $dropzone.data('default-message'),\n                        dictInvalidFileType: $dropzone.data('invalid-input-type'),\n                        dictFileTooBig: $dropzone.data('file-too-big'),\n                        dictRemoveFile: $dropzone.data('remove-file'),\n                        init: function () {\n                            this.on(\"success\", function (file, data) {\n                                filenameDict[file.name] = {\n                                    \"uuid\": data.uuid,\n                                    \"submitted\": false\n                                }\n                                const input = $('<input id=\"' + data.uuid + '\" name=\"files\" type=\"hidden\">').val(data.uuid);\n                                $files.append(input);\n                            });\n                            this.on(\"removedfile\", function (file) {\n                                if (!(file.name in filenameDict)) {\n                                    return;\n                                }\n                                $('#' + filenameDict[file.name].uuid).remove();\n                                if ($dropzone.data('remove-url') && $dropzone.data('csrf') && !filenameDict[file.name].submitted) {\n                                    $.post($dropzone.data('remove-url'), {\n                                        file: filenameDict[file.name].uuid,\n                                        _csrf: $dropzone.data('csrf')\n                                    });\n                                }\n                            });\n                            this.on(\"submit\", function () {\n                                $.each(filenameDict, function(name){\n                                    filenameDict[name].submitted = true;\n                                });\n                            });\n                            this.on(\"reload\", function (){\n                                $.getJSON($editContentZone.data('attachment-url'), function(data){\n                                    const drop = $dropzone.get(0).dropzone;\n                                    drop.removeAllFiles(true);\n                                    $files.empty();\n                                    $.each(data, function(){\n                                        const imgSrc =  $dropzone.data('upload-url') + \"/\" + this.uuid;\n                                        drop.emit(\"addedfile\", this);\n                                        drop.emit(\"thumbnail\", this, imgSrc);\n                                        drop.emit(\"complete\", this);\n                                        drop.files.push(this);\n                                        filenameDict[this.name] = {\n                                            \"submitted\": true,\n                                            \"uuid\": this.uuid\n                                        }\n                                        $dropzone.find(\"img[src='\" + imgSrc + \"']\").css(\"max-width\", \"100%\");\n                                        const input = $('<input id=\"' + this.uuid + '\" name=\"files\" type=\"hidden\">').val(this.uuid);\n                                        $files.append(input);\n                                    });\n                                });\n                            });\n                        }\n                    });\n                    $dropzone.get(0).dropzone.emit(\"reload\");\n                }\n                // Give new write/preview data-tab name to distinguish from others\n                const $editContentForm = $editContentZone.find('.ui.comment.form');\n                const $tabMenu = $editContentForm.find('.tabular.menu');\n                $tabMenu.attr('data-write', $editContentZone.data('write'));\n                $tabMenu.attr('data-preview', $editContentZone.data('preview'));\n                $tabMenu.find('.write.item').attr('data-tab', $editContentZone.data('write'));\n                $tabMenu.find('.preview.item').attr('data-tab', $editContentZone.data('preview'));\n                $editContentForm.find('.write.segment').attr('data-tab', $editContentZone.data('write'));\n                $editContentForm.find('.preview.segment').attr('data-tab', $editContentZone.data('preview'));\n\n                initCommentPreviewTab($editContentForm);\n\n                $editContentZone.find('.cancel.button').click(function () {\n                    $renderContent.show();\n                    $editContentZone.hide();\n                    $dropzone.get(0).dropzone.emit(\"reload\");\n                });\n                $editContentZone.find('.save.button').click(function () {\n                    $renderContent.show();\n                    $editContentZone.hide();\n                    const $attachments = $files.find(\"[name=files]\").map(function(){\n                        return $(this).val();\n                    }).get();\n                    $.post($editContentZone.data('update-url'), {\n                        \"_csrf\": csrf,\n                        \"content\": $textarea.val(),\n                        \"context\": $editContentZone.data('context'),\n                        \"files\": $attachments\n                    },\n                    function (data) {\n                        if (data.length == 0) {\n                            $renderContent.html($('#no-content').html());\n                        } else {\n                            $renderContent.html(data.content);\n                            emojify.run($renderContent[0]);\n                            $('pre code', $renderContent[0]).each(function () {\n                                hljs.highlightBlock(this);\n                            });\n                        }\n                        const $content = $segment.parent();\n                        if(!$content.find(\".ui.small.images\").length){\n                            if(data.attachments != \"\"){\n                                $content.append(\n                                '<div class=\"ui bottom attached segment\">' +\n                                '    <div class=\"ui small images\">' +\n                                '    </div>' +\n                                '</div>'\n                                );\n                                $content.find(\".ui.small.images\").html(data.attachments);\n                            }\n                        } else if (data.attachments == \"\") {\n                            $content.find(\".ui.small.images\").parent().remove();\n                        } else {\n                            $content.find(\".ui.small.images\").html(data.attachments);\n                        }\n                        $dropzone.get(0).dropzone.emit(\"submit\");\n                        $dropzone.get(0).dropzone.emit(\"reload\");\n                    });\n                });\n            } else {\n                $textarea = $segment.find('textarea');\n            }\n\n            // Show write/preview tab and copy raw content as needed\n            $editContentZone.show();\n            $renderContent.hide();\n            if ($textarea.val().length == 0) {\n                $textarea.val($rawContent.text());\n            }\n            $textarea.focus();\n            return false;\n        });\n\n        // Delete comment\n        $('.delete-comment').click(function () {\n            const $this = $(this);\n            if (confirm($this.data('locale'))) {\n                $.post($this.data('url'), {\n                    \"_csrf\": csrf\n                }).success(function () {\n                    $('#' + $this.data('comment-id')).remove();\n                });\n            }\n            return false;\n        });\n\n        // Change status\n        const $statusButton = $('#status-button');\n        $('#comment-form .edit_area').keyup(function () {\n            if ($(this).val().length == 0) {\n                $statusButton.text($statusButton.data('status'))\n            } else {\n                $statusButton.text($statusButton.data('status-and-comment'))\n            }\n        });\n        $statusButton.click(function () {\n            $('#status').val($statusButton.data('status-val'));\n            $('#comment-form').submit();\n        });\n\n        // Pull Request merge button\n        const $mergeButton = $('.merge-button > button');\n        $mergeButton.on('click', function(e) {\n            e.preventDefault();\n            $('.' + $(this).data('do') + '-fields').show();\n            $(this).parent().hide();\n        });\n        $('.merge-button > .dropdown').dropdown({\n            onChange: function (_text, _value, $choice) {\n                if ($choice.data('do')) {\n                    $mergeButton.find('.button-text').text($choice.text());\n                    $mergeButton.data('do', $choice.data('do'));\n                }\n            }\n        });\n        $('.merge-cancel').on('click', function(e) {\n            e.preventDefault();\n            $(this).closest('.form').hide();\n            $mergeButton.parent().show();\n        });\n\n        initReactionSelector();\n    }\n\n    // Diff\n    if ($('.repository.diff').length > 0) {\n        $('.diff-counter').each(function () {\n            const $item = $(this);\n            const addLine = $item.find('span[data-line].add').data(\"line\");\n            const delLine = $item.find('span[data-line].del').data(\"line\");\n            const addPercent = parseFloat(addLine) / (parseFloat(addLine) + parseFloat(delLine)) * 100;\n            $item.find(\".bar .add\").css(\"width\", addPercent + \"%\");\n        });\n    }\n\n    // Quick start and repository home\n    $('#repo-clone-ssh').click(function () {\n        $('.clone-url').text($(this).data('link'));\n        $('#repo-clone-url').val($(this).data('link'));\n        $(this).addClass('blue');\n        $('#repo-clone-https').removeClass('blue');\n        localStorage.setItem('repo-clone-protocol', 'ssh');\n    });\n    $('#repo-clone-https').click(function () {\n        $('.clone-url').text($(this).data('link'));\n        $('#repo-clone-url').val($(this).data('link'));\n        $(this).addClass('blue');\n        $('#repo-clone-ssh').removeClass('blue');\n        localStorage.setItem('repo-clone-protocol', 'https');\n    });\n    $('#repo-clone-url').click(function () {\n        $(this).select();\n    });\n\n    // Pull request\n    const $repoComparePull = $('.repository.compare.pull');\n    if ($repoComparePull.length > 0) {\n        initFilterSearchDropdown('.choose.branch .dropdown');\n        // show pull request form\n        $repoComparePull.find('button.show-form').on('click', function(e) {\n            e.preventDefault();\n            $repoComparePull.find('.pullrequest-form').show();\n            $(this).parent().hide();\n        });\n    }\n\n    // Branches\n    if ($('.repository.settings.branches').length > 0) {\n        initFilterSearchDropdown('.protected-branches .dropdown');\n        $('.enable-protection, .enable-whitelist').change(function () {\n            if (this.checked) {\n                $($(this).data('target')).removeClass('disabled');\n            } else {\n                $($(this).data('target')).addClass('disabled');\n            }\n        });\n    }\n}\n\nfunction initMigration() {\n    const toggleMigrations = function() {\n        const authUserName = $('#auth_username').val();\n        const cloneAddr = $('#clone_addr').val();\n        if (!$('#mirror').is(\":checked\") && (authUserName!=undefined && authUserName.length > 0)\n        && (cloneAddr!=undefined && (cloneAddr.startsWith(\"https://github.com\") || cloneAddr.startsWith(\"http://github.com\")))) {\n            $('#migrate_items').show();\n        } else {\n            $('#migrate_items').hide();\n        }\n    }\n\n    toggleMigrations();\n\n    $('#clone_addr').on('input', toggleMigrations)\n    $('#auth_username').on('input', toggleMigrations)\n    $('#mirror').on('change', toggleMigrations)\n}\n\nfunction initPullRequestReview() {\n    $('.show-outdated').on('click', function (e) {\n        e.preventDefault();\n        const id = $(this).data('comment');\n        $(this).addClass(\"hide\");\n        $(\"#code-comments-\" + id).removeClass('hide');\n        $(\"#code-preview-\" + id).removeClass('hide');\n        $(\"#hide-outdated-\" + id).removeClass('hide');\n    });\n\n    $('.hide-outdated').on('click', function (e) {\n        e.preventDefault();\n        const id = $(this).data('comment');\n        $(this).addClass(\"hide\");\n        $(\"#code-comments-\" + id).addClass('hide');\n        $(\"#code-preview-\" + id).addClass('hide');\n        $(\"#show-outdated-\" + id).removeClass('hide');\n    });\n\n    $('button.comment-form-reply').on('click', function (e) {\n        e.preventDefault();\n        $(this).hide();\n        const form = $(this).parent().find('.comment-form')\n        form.removeClass('hide');\n        assingMenuAttributes(form.find('.menu'));\n    });\n    // The following part is only for diff views\n    if ($('.repository.pull.diff').length == 0) {\n        return;\n    }\n\n    $('.diff-detail-box.ui.sticky').sticky();\n\n    $('.btn-review').on('click', function(e) {\n        e.preventDefault();\n        $(this).closest('.dropdown').find('.menu').toggle('visible');\n    }).closest('.dropdown').find('.link.close').on('click', function(e) {\n        e.preventDefault();\n        $(this).closest('.menu').toggle('visible');\n    });\n\n    $('.code-view .lines-code,.code-view .lines-num')\n        .on('mouseenter', function() {\n            const parent = $(this).closest('td');\n            $(this).closest('tr').addClass(\n                parent.hasClass('lines-num-old') || parent.hasClass('lines-code-old')\n                    ? 'focus-lines-old' : 'focus-lines-new'\n            );\n        })\n        .on('mouseleave', function() {\n            $(this).closest('tr').removeClass('focus-lines-new focus-lines-old');\n        });\n    $('.add-code-comment').on('click', function(e) {\n        // https://github.com/go-gitea/gitea/issues/4745\n        if ($(e.target).hasClass('btn-add-single')) {\n          return;\n        }\n        e.preventDefault();\n        const isSplit = $(this).closest('.code-diff').hasClass('code-diff-split');\n        const side = $(this).data('side');\n        const idx = $(this).data('idx');\n        const path = $(this).data('path');\n        const form = $('#pull_review_add_comment').html();\n        const tr = $(this).closest('tr');\n        let ntr = tr.next();\n        if (!ntr.hasClass('add-comment')) {\n            ntr = $('<tr class=\"add-comment\">'\n                    + (isSplit ? '<td class=\"lines-num\"></td><td class=\"lines-type-marker\"></td><td class=\"add-comment-left\"></td><td class=\"lines-num\"></td><td class=\"lines-type-marker\"></td><td class=\"add-comment-right\"></td>'\n                               : '<td class=\"lines-num\"></td><td class=\"lines-num\"></td><td class=\"lines-type-marker\"></td><td class=\"add-comment-left add-comment-right\"></td>')\n                    + '</tr>');\n            tr.after(ntr);\n        }\n        const td = ntr.find('.add-comment-' + side);\n        let commentCloud = td.find('.comment-code-cloud');\n        if (commentCloud.length === 0) {\n            td.html(form);\n            commentCloud = td.find('.comment-code-cloud');\n            assingMenuAttributes(commentCloud.find('.menu'));\n\n            td.find(\"input[name='line']\").val(idx);\n            td.find(\"input[name='side']\").val(side === \"left\" ? \"previous\":\"proposed\");\n            td.find(\"input[name='path']\").val(path);\n        }\n        commentCloud.find('textarea').focus();\n    });\n}\n\nfunction assingMenuAttributes(menu) {\n    const id = Math.floor(Math.random() * Math.floor(1000000));\n    menu.attr('data-write', menu.attr('data-write') + id);\n    menu.attr('data-preview', menu.attr('data-preview') + id);\n    menu.find('.item').each(function() {\n        const tab = $(this).attr('data-tab') + id;\n        $(this).attr('data-tab', tab);\n    });\n    menu.parent().find(\"*[data-tab='write']\").attr('data-tab', 'write' + id);\n    menu.parent().find(\"*[data-tab='preview']\").attr('data-tab', 'preview' + id);\n    initCommentPreviewTab(menu.parent(\".form\"));\n    return id;\n}\n\nfunction initRepositoryCollaboration() {\n    // Change collaborator access mode\n    $('.access-mode.menu .item').click(function () {\n        const $menu = $(this).parent();\n        $.post($menu.data('url'), {\n            \"_csrf\": csrf,\n            \"uid\": $menu.data('uid'),\n            \"mode\": $(this).data('value')\n        })\n    });\n}\n\nfunction initTeamSettings() {\n    // Change team access mode\n    $('.organization.new.team input[name=permission]').change(function () {\n        const val = $('input[name=permission]:checked', '.organization.new.team').val()\n        if (val === 'admin') {\n            $('.organization.new.team .team-units').hide();\n        } else {\n            $('.organization.new.team .team-units').show();\n        }\n    });\n}\n\nfunction initWikiForm() {\n    const $editArea = $('.repository.wiki textarea#edit_area');\n    if ($editArea.length > 0) {\n        const simplemde = new SimpleMDE({\n            autoDownloadFontAwesome: false,\n            element: $editArea[0],\n            forceSync: true,\n            previewRender: function (plainText, preview) { // Async method\n                setTimeout(function () {\n                    // FIXME: still send render request when return back to edit mode\n                    $.post($editArea.data('url'), {\n                            \"_csrf\": csrf,\n                            \"mode\": \"gfm\",\n                            \"context\": $editArea.data('context'),\n                            \"text\": plainText\n                        },\n                        function (data) {\n                            preview.innerHTML = '<div class=\"markdown ui segment\">' + data + '</div>';\n                            emojify.run($('.editor-preview')[0]);\n                        }\n                    );\n                }, 0);\n\n                return \"Loading...\";\n            },\n            renderingConfig: {\n                singleLineBreaks: false\n            },\n            indentWithTabs: false,\n            tabSize: 4,\n            spellChecker: false,\n            toolbar: [\"bold\", \"italic\", \"strikethrough\", \"|\",\n                \"heading-1\", \"heading-2\", \"heading-3\", \"heading-bigger\", \"heading-smaller\", \"|\",\n                {\n                    name: \"code-inline\",\n                    action: function(e){\n                        const cm = e.codemirror;\n                        const selection = cm.getSelection();\n                        cm.replaceSelection(\"`\" + selection + \"`\");\n                        if (!selection) {\n                            const cursorPos = cm.getCursor();\n                            cm.setCursor(cursorPos.line, cursorPos.ch - 1);\n                        }\n                        cm.focus();\n                    },\n                    className: \"fa fa-angle-right\",\n                    title: \"Add Inline Code\",\n                },\"code\", \"quote\", \"|\", {\n                    name: \"checkbox-empty\",\n                    action: function(e){\n                        const cm = e.codemirror;\n                        cm.replaceSelection(\"\\n- [ ] \" + cm.getSelection());\n                        cm.focus();\n                    },\n                    className: \"fa fa-square-o\",\n                    title: \"Add Checkbox (empty)\",\n                },\n                {\n                    name: \"checkbox-checked\",\n                    action: function(e){\n                        const cm = e.codemirror;\n                        cm.replaceSelection(\"\\n- [x] \" + cm.getSelection());\n                        cm.focus();\n                    },\n                    className: \"fa fa-check-square-o\",\n                    title: \"Add Checkbox (checked)\",\n                }, \"|\",\n                \"unordered-list\", \"ordered-list\", \"|\",\n                \"link\", \"image\", \"table\", \"horizontal-rule\", \"|\",\n                \"clean-block\", \"preview\", \"fullscreen\"]\n        })\n        $(simplemde.codemirror.getInputField()).addClass(\"js-quick-submit\");\n    }\n}\n\n// For IE\nString.prototype.endsWith = function (pattern) {\n    const d = this.length - pattern.length;\n    return d >= 0 && this.lastIndexOf(pattern) === d;\n};\n\n// Adding function to get the cursor position in a text field to jQuery object.\n$.fn.getCursorPosition = function () {\n    const el = $(this).get(0);\n    let pos = 0;\n    if ('selectionStart' in el) {\n        pos = el.selectionStart;\n    } else if ('selection' in document) {\n        el.focus();\n        const Sel = document.selection.createRange();\n        const SelLength = document.selection.createRange().text.length;\n        Sel.moveStart('character', -el.value.length);\n        pos = Sel.text.length - SelLength;\n    }\n    return pos;\n}\n\nfunction setSimpleMDE($editArea) {\n    if (codeMirrorEditor) {\n        codeMirrorEditor.toTextArea();\n        codeMirrorEditor = null;\n    }\n\n    if (simpleMDEditor) {\n        return true;\n    }\n\n    simpleMDEditor = new SimpleMDE({\n        autoDownloadFontAwesome: false,\n        element: $editArea[0],\n        forceSync: true,\n        renderingConfig: {\n            singleLineBreaks: false\n        },\n        indentWithTabs: false,\n        tabSize: 4,\n        spellChecker: false,\n        previewRender: function (plainText, preview) { // Async method\n            setTimeout(function () {\n                // FIXME: still send render request when return back to edit mode\n                $.post($editArea.data('url'), {\n                        \"_csrf\": csrf,\n                        \"mode\": \"gfm\",\n                        \"context\": $editArea.data('context'),\n                        \"text\": plainText\n                    },\n                    function (data) {\n                        preview.innerHTML = '<div class=\"markdown ui segment\">' + data + '</div>';\n                        emojify.run($('.editor-preview')[0]);\n                    }\n                );\n            }, 0);\n\n            return \"Loading...\";\n        },\n        toolbar: [\"bold\", \"italic\", \"strikethrough\", \"|\",\n            \"heading-1\", \"heading-2\", \"heading-3\", \"heading-bigger\", \"heading-smaller\", \"|\",\n            \"code\", \"quote\", \"|\",\n            \"unordered-list\", \"ordered-list\", \"|\",\n            \"link\", \"image\", \"table\", \"horizontal-rule\", \"|\",\n            \"clean-block\", \"preview\", \"fullscreen\", \"side-by-side\"]\n    });\n\n    return true;\n}\n\nfunction setCodeMirror($editArea) {\n    if (simpleMDEditor) {\n        simpleMDEditor.toTextArea();\n        simpleMDEditor = null;\n    }\n\n    if (codeMirrorEditor) {\n        return true;\n    }\n\n    codeMirrorEditor = CodeMirror.fromTextArea($editArea[0], {\n        lineNumbers: true\n    });\n    codeMirrorEditor.on(\"change\", function (cm, _change) {\n        $editArea.val(cm.getValue());\n    });\n\n    return true;\n}\n\nfunction initEditor() {\n    $('.js-quick-pull-choice-option').change(function () {\n        if ($(this).val() == 'commit-to-new-branch') {\n            $('.quick-pull-branch-name').show();\n            $('.quick-pull-branch-name input').prop('required',true);\n        } else {\n            $('.quick-pull-branch-name').hide();\n            $('.quick-pull-branch-name input').prop('required',false);\n        }\n        $('#commit-button').text($(this).attr('button_text'));\n    });\n\n    const $editFilename = $(\"#file-name\");\n    $editFilename.keyup(function (e) {\n        const $section = $('.breadcrumb span.section');\n        const $divider = $('.breadcrumb div.divider');\n        let value;\n        let parts;\n\n        if (e.keyCode == 8) {\n            if ($(this).getCursorPosition() == 0) {\n                if ($section.length > 0) {\n                    value = $section.last().find('a').text();\n                    $(this).val(value + $(this).val());\n                    $(this)[0].setSelectionRange(value.length, value.length);\n                    $section.last().remove();\n                    $divider.last().remove();\n                }\n            }\n        }\n        if (e.keyCode == 191) {\n            parts = $(this).val().split('/');\n            for (let i = 0; i < parts.length; ++i) {\n                value = parts[i];\n                if (i < parts.length - 1) {\n                    if (value.length) {\n                        $('<span class=\"section\"><a href=\"#\">' + value + '</a></span>').insertBefore($(this));\n                        $('<div class=\"divider\"> / </div>').insertBefore($(this));\n                    }\n                }\n                else {\n                    $(this).val(value);\n                }\n                $(this)[0].setSelectionRange(0, 0);\n            }\n        }\n        parts = [];\n        $('.breadcrumb span.section').each(function () {\n            const element = $(this);\n            if (element.find('a').length) {\n                parts.push(element.find('a').text());\n            } else {\n                parts.push(element.text());\n            }\n        });\n        if ($(this).val())\n            parts.push($(this).val());\n        $('#tree_path').val(parts.join('/'));\n    }).trigger('keyup');\n\n    const $editArea = $('.repository.editor textarea#edit_area');\n    if (!$editArea.length)\n        return;\n\n    const markdownFileExts = $editArea.data(\"markdown-file-exts\").split(\",\");\n    const lineWrapExtensions = $editArea.data(\"line-wrap-extensions\").split(\",\");\n\n    $editFilename.on(\"keyup\", function () {\n        const val = $editFilename.val();\n        let mode, spec, extension, extWithDot, dataUrl, apiCall;\n\n        extension = extWithDot = \"\";\n        const m = /.+\\.([^.]+)$/.exec(val);\n        if (m) {\n            extension = m[1];\n            extWithDot = \".\" + extension;\n        }\n\n        const info = CodeMirror.findModeByExtension(extension);\n        const previewLink = $('a[data-tab=preview]');\n        if (info) {\n            mode = info.mode;\n            spec = info.mime;\n            apiCall = mode;\n        }\n        else {\n            apiCall = extension\n        }\n\n        if (previewLink.length && apiCall && previewFileModes && previewFileModes.length && previewFileModes.indexOf(apiCall) >= 0) {\n            dataUrl = previewLink.data('url');\n            previewLink.data('url', dataUrl.replace(/(.*)\\/.*/i, '$1/' + mode));\n            previewLink.show();\n        }\n        else {\n            previewLink.hide();\n        }\n\n        // If this file is a Markdown extensions, we will load that editor and return\n        if (markdownFileExts.indexOf(extWithDot) >= 0) {\n            if (setSimpleMDE($editArea)) {\n                return;\n            }\n        }\n\n        // Else we are going to use CodeMirror\n        if (!codeMirrorEditor && !setCodeMirror($editArea)) {\n            return;\n        }\n\n        if (mode) {\n            codeMirrorEditor.setOption(\"mode\", spec);\n            CodeMirror.autoLoadMode(codeMirrorEditor, mode);\n        }\n\n        if (lineWrapExtensions.indexOf(extWithDot) >= 0) {\n            codeMirrorEditor.setOption(\"lineWrapping\", true);\n        }\n        else {\n            codeMirrorEditor.setOption(\"lineWrapping\", false);\n        }\n\n        // get the filename without any folder\n        let value = $editFilename.val();\n        if (value.length === 0) {\n            return;\n        }\n        value = value.split('/');\n        value = value[value.length - 1];\n\n        $.getJSON($editFilename.data('ec-url-prefix')+value, function(editorconfig) {\n            if (editorconfig.indent_style === 'tab') {\n                codeMirrorEditor.setOption(\"indentWithTabs\", true);\n                codeMirrorEditor.setOption('extraKeys', {});\n            } else {\n                codeMirrorEditor.setOption(\"indentWithTabs\", false);\n                // required because CodeMirror doesn't seems to use spaces correctly for {\"indentWithTabs\": false}:\n                // - https://github.com/codemirror/CodeMirror/issues/988\n                // - https://codemirror.net/doc/manual.html#keymaps\n                codeMirrorEditor.setOption('extraKeys', {\n                    Tab: function(cm) {\n                        const spaces = Array(parseInt(cm.getOption(\"indentUnit\")) + 1).join(\" \");\n                        cm.replaceSelection(spaces);\n                    }\n                });\n            }\n            codeMirrorEditor.setOption(\"indentUnit\", editorconfig.indent_size || 4);\n            codeMirrorEditor.setOption(\"tabSize\", editorconfig.tab_width || 4);\n        });\n    }).trigger('keyup');\n\n    // Using events from https://github.com/codedance/jquery.AreYouSure#advanced-usage\n    // to enable or disable the commit button\n    const $commitButton = $('#commit-button');\n    const $editForm = $('.ui.edit.form');\n    const dirtyFileClass = 'dirty-file';\n\n    // Disabling the button at the start\n    $commitButton.prop('disabled', true);\n\n    // Registering a custom listener for the file path and the file content\n    $editForm.areYouSure({\n        silent: true,\n        dirtyClass: dirtyFileClass,\n        fieldSelector: ':input:not(.commit-form-wrapper :input)',\n        change: function () {\n            const dirty = $(this).hasClass(dirtyFileClass);\n            $commitButton.prop('disabled', !dirty);\n        }\n    });\n\n    $commitButton.click(function (event) {\n        // A modal which asks if an empty file should be committed\n        if ($editArea.val().length === 0) {\n            $('#edit-empty-content-modal').modal({\n                onApprove: function () {\n                    $('.edit.form').submit();\n                }\n            }).modal('show');\n            event.preventDefault();\n        }\n    });\n}\n\nfunction initOrganization() {\n    if ($('.organization').length == 0) {\n        return;\n    }\n\n    // Options\n    if ($('.organization.settings.options').length > 0) {\n        $('#org_name').keyup(function () {\n            const $prompt = $('#org-name-change-prompt');\n            if ($(this).val().toString().toLowerCase() != $(this).data('org-name').toString().toLowerCase()) {\n                $prompt.show();\n            } else {\n                $prompt.hide();\n            }\n        });\n    }\n}\n\nfunction initUserSettings() {\n    // Options\n    if ($('.user.settings.profile').length > 0) {\n        $('#username').keyup(function () {\n            const $prompt = $('#name-change-prompt');\n            if ($(this).val().toString().toLowerCase() != $(this).data('name').toString().toLowerCase()) {\n                $prompt.show();\n            } else {\n                $prompt.hide();\n            }\n        });\n    }\n}\n\nfunction initWebhook() {\n    if ($('.new.webhook').length == 0) {\n        return;\n    }\n\n    $('.events.checkbox input').change(function () {\n        if ($(this).is(':checked')) {\n            $('.events.fields').show();\n        }\n    });\n    $('.non-events.checkbox input').change(function () {\n        if ($(this).is(':checked')) {\n            $('.events.fields').hide();\n        }\n    });\n\n    const updateContentType = function () {\n        const visible = $('#http_method').val() === 'POST';\n        $('#content_type').parent().parent()[visible ? 'show' : 'hide']();\n    };\n    updateContentType();\n    $('#http_method').change(function () {\n        updateContentType();\n    });\n\n    // Test delivery\n    $('#test-delivery').click(function () {\n        const $this = $(this);\n        $this.addClass('loading disabled');\n        $.post($this.data('link'), {\n            \"_csrf\": csrf\n        }).done(\n            setTimeout(function () {\n                window.location.href = $this.data('redirect');\n            }, 5000)\n        )\n    });\n}\n\nfunction initAdmin() {\n    if ($('.admin').length == 0) {\n        return;\n    }\n\n    // New user\n    if ($('.admin.new.user').length > 0 ||\n        $('.admin.edit.user').length > 0) {\n        $('#login_type').change(function () {\n            if ($(this).val().substring(0, 1) == '0') {\n                $('#login_name').removeAttr('required');\n                $('.non-local').hide();\n                $('.local').show();\n                $('#user_name').focus();\n\n                if ($(this).data('password') == \"required\") {\n                    $('#password').attr('required', 'required');\n                }\n\n            } else {\n                $('#login_name').attr('required', 'required');\n                $('.non-local').show();\n                $('.local').hide();\n                $('#login_name').focus();\n\n                $('#password').removeAttr('required');\n            }\n        });\n    }\n\n    function onSecurityProtocolChange() {\n        if ($('#security_protocol').val() > 0) {\n            $('.has-tls').show();\n        } else {\n            $('.has-tls').hide();\n        }\n    }\n\n    function onUsePagedSearchChange() {\n        if ($('#use_paged_search').prop('checked')) {\n            $('.search-page-size').show()\n                .find('input').attr('required', 'required');\n        } else {\n            $('.search-page-size').hide()\n                .find('input').removeAttr('required');\n        }\n    }\n\n    function onOAuth2Change() {\n        $('.open_id_connect_auto_discovery_url, .oauth2_use_custom_url').hide();\n        $('.open_id_connect_auto_discovery_url input[required]').removeAttr('required');\n\n        const provider = $('#oauth2_provider').val();\n        switch (provider) {\n            case 'github':\n            case 'gitlab':\n            case 'gitea':\n                $('.oauth2_use_custom_url').show();\n                break;\n            case 'openidConnect':\n                $('.open_id_connect_auto_discovery_url input').attr('required', 'required');\n                $('.open_id_connect_auto_discovery_url').show();\n                break;\n        }\n        onOAuth2UseCustomURLChange();\n    }\n\n    function onOAuth2UseCustomURLChange() {\n        const provider = $('#oauth2_provider').val();\n        $('.oauth2_use_custom_url_field').hide();\n        $('.oauth2_use_custom_url_field input[required]').removeAttr('required');\n\n        if ($('#oauth2_use_custom_url').is(':checked')) {\n            if (!$('#oauth2_token_url').val()) {\n                $('#oauth2_token_url').val($('#' + provider + '_token_url').val());\n            }\n            if (!$('#oauth2_auth_url').val()) {\n                $('#oauth2_auth_url').val($('#' + provider + '_auth_url').val());\n            }\n            if (!$('#oauth2_profile_url').val()) {\n                $('#oauth2_profile_url').val($('#' + provider + '_profile_url').val());\n            }\n            if (!$('#oauth2_email_url').val()) {\n                $('#oauth2_email_url').val($('#' + provider + '_email_url').val());\n            }\n            switch (provider) {\n                case 'github':\n                    $('.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input, .oauth2_email_url input').attr('required', 'required');\n                    $('.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url, .oauth2_email_url').show();\n                    break;\n                case 'gitea':\n                case 'gitlab':\n                    $('.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input').attr('required', 'required');\n                    $('.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url').show();\n                    $('#oauth2_email_url').val('');\n                    break;\n            }\n        }\n    }\n\n    // New authentication\n    if ($('.admin.new.authentication').length > 0) {\n        $('#auth_type').change(function () {\n            $('.ldap, .dldap, .smtp, .pam, .oauth2, .has-tls .search-page-size').hide();\n\n            $('.ldap input[required], .binddnrequired input[required], .dldap input[required], .smtp input[required], .pam input[required], .oauth2 input[required], .has-tls input[required]').removeAttr('required');\n            $('.binddnrequired').removeClass(\"required\");\n\n            const authType = $(this).val();\n            switch (authType) {\n                case '2':     // LDAP\n                    $('.ldap').show();\n                    $('.binddnrequired input, .ldap div.required:not(.dldap) input').attr('required', 'required');\n                    $('.binddnrequired').addClass(\"required\");\n                    break;\n                case '3':     // SMTP\n                    $('.smtp').show();\n                    $('.has-tls').show();\n                    $('.smtp div.required input, .has-tls').attr('required', 'required');\n                    break;\n                case '4':     // PAM\n                    $('.pam').show();\n                    $('.pam input').attr('required', 'required');\n                    break;\n                case '5':     // LDAP\n                    $('.dldap').show();\n                    $('.dldap div.required:not(.ldap) input').attr('required', 'required');\n                    break;\n                case '6':     // OAuth2\n                    $('.oauth2').show();\n                    $('.oauth2 div.required:not(.oauth2_use_custom_url,.oauth2_use_custom_url_field,.open_id_connect_auto_discovery_url) input').attr('required', 'required');\n                    onOAuth2Change();\n                    break;\n            }\n            if (authType == '2' || authType == '5') {\n                onSecurityProtocolChange()\n            }\n            if (authType == '2') {\n                onUsePagedSearchChange();\n            }\n        });\n        $('#auth_type').change();\n        $('#security_protocol').change(onSecurityProtocolChange);\n        $('#use_paged_search').change(onUsePagedSearchChange);\n        $('#oauth2_provider').change(onOAuth2Change);\n        $('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange);\n    }\n    // Edit authentication\n    if ($('.admin.edit.authentication').length > 0) {\n        const authType = $('#auth_type').val();\n        if (authType == '2' || authType == '5') {\n            $('#security_protocol').change(onSecurityProtocolChange);\n            if (authType == '2') {\n                $('#use_paged_search').change(onUsePagedSearchChange);\n            }\n        } else if (authType == '6') {\n            $('#oauth2_provider').change(onOAuth2Change);\n            $('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange);\n            onOAuth2Change();\n        }\n    }\n\n    // Notice\n    if ($('.admin.notice')) {\n        const $detailModal = $('#detail-modal');\n\n        // Attach view detail modals\n        $('.view-detail').click(function () {\n            $detailModal.find('.content p').text($(this).data('content'));\n            $detailModal.modal('show');\n            return false;\n        });\n\n        // Select actions\n        const $checkboxes = $('.select.table .ui.checkbox');\n        $('.select.action').click(function () {\n            switch ($(this).data('action')) {\n                case 'select-all':\n                    $checkboxes.checkbox('check');\n                    break;\n                case 'deselect-all':\n                    $checkboxes.checkbox('uncheck');\n                    break;\n                case 'inverse':\n                    $checkboxes.checkbox('toggle');\n                    break;\n            }\n        });\n        $('#delete-selection').click(function () {\n            const $this = $(this);\n            $this.addClass(\"loading disabled\");\n            const ids = [];\n            $checkboxes.each(function () {\n                if ($(this).checkbox('is checked')) {\n                    ids.push($(this).data('id'));\n                }\n            });\n            $.post($this.data('link'), {\n                \"_csrf\": csrf,\n                \"ids\": ids\n            }).done(function () {\n                window.location.href = $this.data('redirect');\n            });\n        });\n    }\n}\n\nfunction buttonsClickOnEnter() {\n    $('.ui.button').keypress(function (e) {\n        if (e.keyCode == 13 || e.keyCode == 32) // enter key or space bar\n            $(this).click();\n    });\n}\n\nfunction searchUsers() {\n    const $searchUserBox = $('#search-user-box');\n    $searchUserBox.search({\n        minCharacters: 2,\n        apiSettings: {\n            url: suburl + '/api/v1/users/search?q={query}',\n            onResponse: function(response) {\n                const items = [];\n                $.each(response.data, function (_i, item) {\n                    let title = item.login;\n                    if (item.full_name && item.full_name.length > 0) {\n                        title += ' (' + htmlEncode(item.full_name) + ')';\n                    }\n                    items.push({\n                        title: title,\n                        image: item.avatar_url\n                    })\n                });\n\n                return { results: items }\n            }\n        },\n        searchFields: ['login', 'full_name'],\n        showNoResults: false\n    });\n}\n\nfunction searchTeams() {\n    const $searchTeamBox = $('#search-team-box');\n    $searchTeamBox.search({\n        minCharacters: 2,\n        apiSettings: {\n            url: suburl + '/api/v1/orgs/' + $searchTeamBox.data('org') + '/teams/search?q={query}',\n            headers: {\"X-Csrf-Token\": csrf},\n            onResponse: function(response) {\n                const items = [];\n                $.each(response.data, function (_i, item) {\n                    const title = item.name + ' (' + item.permission + ' access)';\n                    items.push({\n                        title: title,\n                    })\n                });\n\n                return { results: items }\n            }\n        },\n        searchFields: ['name', 'description'],\n        showNoResults: false\n    });\n}\n\nfunction searchRepositories() {\n    const $searchRepoBox = $('#search-repo-box');\n    $searchRepoBox.search({\n        minCharacters: 2,\n        apiSettings: {\n            url: suburl + '/api/v1/repos/search?q={query}&uid=' + $searchRepoBox.data('uid'),\n            onResponse: function(response) {\n                const items = [];\n                $.each(response.data, function (_i, item) {\n                    items.push({\n                        title: item.full_name.split(\"/\")[1],\n                        description: item.full_name\n                    })\n                });\n\n                return { results: items }\n            }\n        },\n        searchFields: ['full_name'],\n        showNoResults: false\n    });\n}\n\nfunction initCodeView() {\n    if ($('.code-view .linenums').length > 0) {\n        $(document).on('click', '.lines-num span', function (e) {\n            const $select = $(this);\n            const $list = $select.parent().siblings('.lines-code').find('ol.linenums > li');\n            selectRange($list, $list.filter('[rel=' + $select.attr('id') + ']'), (e.shiftKey ? $list.filter('.active').eq(0) : null));\n            deSelect();\n        });\n\n        $(window).on('hashchange', function () {\n            let m = window.location.hash.match(/^#(L\\d+)-(L\\d+)$/);\n            const $list = $('.code-view ol.linenums > li');\n            let $first;\n            if (m) {\n                $first = $list.filter('.' + m[1]);\n                selectRange($list, $first, $list.filter('.' + m[2]));\n                $(\"html, body\").scrollTop($first.offset().top - 200);\n                return;\n            }\n            m = window.location.hash.match(/^#(L|n)(\\d+)$/);\n            if (m) {\n                $first = $list.filter('.L' + m[2]);\n                selectRange($list, $first);\n                $(\"html, body\").scrollTop($first.offset().top - 200);\n            }\n        }).trigger('hashchange');\n    }\n}\n\nfunction initU2FAuth() {\n    if($('#wait-for-key').length === 0) {\n        return\n    }\n    u2fApi.ensureSupport()\n        .then(function () {\n            $.getJSON(suburl + '/user/u2f/challenge').success(function(req) {\n                u2fApi.sign(req.appId, req.challenge, req.registeredKeys, 30)\n                    .then(u2fSigned)\n                    .catch(function (err) {\n                        if(err === undefined) {\n                            u2fError(1);\n                            return\n                        }\n                        u2fError(err.metaData.code);\n                    });\n            });\n        }).catch(function () {\n            // Fallback in case browser do not support U2F\n            window.location.href = suburl + \"/user/two_factor\"\n        })\n}\nfunction u2fSigned(resp) {\n    $.ajax({\n        url: suburl + '/user/u2f/sign',\n        type: \"POST\",\n        headers: {\"X-Csrf-Token\": csrf},\n        data: JSON.stringify(resp),\n        contentType: \"application/json; charset=utf-8\",\n    }).done(function(res){\n        window.location.replace(res);\n    }).fail(function () {\n        u2fError(1);\n    });\n}\n\nfunction u2fRegistered(resp) {\n    if (checkError(resp)) {\n        return;\n    }\n    $.ajax({\n        url: suburl + '/user/settings/security/u2f/register',\n        type: \"POST\",\n        headers: {\"X-Csrf-Token\": csrf},\n        data: JSON.stringify(resp),\n        contentType: \"application/json; charset=utf-8\",\n        success: function(){\n            reload();\n        },\n        fail: function () {\n            u2fError(1);\n        }\n    });\n}\n\nfunction checkError(resp) {\n    if (!('errorCode' in resp)) {\n        return false;\n    }\n    if (resp.errorCode === 0) {\n        return false;\n    }\n    u2fError(resp.errorCode);\n    return true;\n}\n\n\nfunction u2fError(errorType) {\n    const u2fErrors = {\n        'browser': $('#unsupported-browser'),\n        1: $('#u2f-error-1'),\n        2: $('#u2f-error-2'),\n        3: $('#u2f-error-3'),\n        4: $('#u2f-error-4'),\n        5: $('.u2f-error-5')\n    };\n    u2fErrors[errorType].removeClass('hide');\n    for(const type in u2fErrors){\n        if(type != errorType){\n            u2fErrors[type].addClass('hide');\n        }\n    }\n    $('#u2f-error').modal('show');\n}\n\nfunction initU2FRegister() {\n    $('#register-device').modal({allowMultiple: false});\n    $('#u2f-error').modal({allowMultiple: false});\n    $('#register-security-key').on('click', function(e) {\n        e.preventDefault();\n        u2fApi.ensureSupport()\n            .then(u2fRegisterRequest)\n            .catch(function() {\n                u2fError('browser');\n            })\n    })\n}\n\nfunction u2fRegisterRequest() {\n    $.post(suburl + \"/user/settings/security/u2f/request_register\", {\n        \"_csrf\": csrf,\n        \"name\": $('#nickname').val()\n    }).success(function(req) {\n        $(\"#nickname\").closest(\"div.field\").removeClass(\"error\");\n        $('#register-device').modal('show');\n        if(req.registeredKeys === null) {\n            req.registeredKeys = []\n        }\n        u2fApi.register(req.appId, req.registerRequests, req.registeredKeys, 30)\n            .then(u2fRegistered)\n            .catch(function (reason) {\n                if(reason === undefined) {\n                    u2fError(1);\n                    return\n                }\n                u2fError(reason.metaData.code);\n            });\n    }).fail(function(xhr) {\n        if(xhr.status === 409) {\n            $(\"#nickname\").closest(\"div.field\").addClass(\"error\");\n        }\n    });\n}\n\nfunction initWipTitle() {\n    $(\".title_wip_desc > a\").click(function (e) {\n        e.preventDefault();\n\n        const $issueTitle = $(\"#issue_title\");\n        $issueTitle.focus();\n        const value = $issueTitle.val().trim().toUpperCase();\n\n        for (const i in wipPrefixes) {\n            if (value.startsWith(wipPrefixes[i].toUpperCase())) {\n                return;\n            }\n        }\n\n        $issueTitle.val(wipPrefixes[0] + \" \" + $issueTitle.val());\n    });\n}\n\nfunction initTemplateSearch() {\n    const $repoTemplate = $(\"#repo_template\");\n    const checkTemplate = function() {\n        const $templateUnits = $(\"#template_units\");\n        const $nonTemplate = $(\"#non_template\");\n        if ($repoTemplate.val() !== \"\") {\n            $templateUnits.show();\n            $nonTemplate.hide();\n        } else {\n            $templateUnits.hide();\n            $nonTemplate.show();\n        }\n    };\n    $repoTemplate.change(checkTemplate);\n    checkTemplate();\n\n    const changeOwner = function() {\n        $(\"#repo_template_search\")\n            .dropdown({\n                apiSettings: {\n                    url: suburl + '/api/v1/repos/search?q={query}&template=true&priority_owner_id=' + $(\"#uid\").val(),\n                    onResponse: function(response) {\n                        const filteredResponse = {'success': true, 'results': []};\n                        filteredResponse.results.push({\n                            'name': '',\n                            'value': ''\n                        });\n                        // Parse the response from the api to work with our dropdown\n                        $.each(response.data, function(_r, repo) {\n                            filteredResponse.results.push({\n                                'name'  : htmlEncode(repo.full_name) ,\n                                'value' : repo.id\n                            });\n                        });\n                        return filteredResponse;\n                    },\n                    cache: false,\n                },\n\n                fullTextSearch: true\n            });\n    };\n    $(\"#uid\").change(changeOwner);\n    changeOwner();\n}\n\n$(document).ready(function () {\n    csrf = $('meta[name=_csrf]').attr(\"content\");\n    suburl = $('meta[name=_suburl]').attr(\"content\");\n\n    // Show exact time\n    $('.time-since').each(function () {\n        $(this).addClass('poping up').attr('data-content', $(this).attr('title')).attr('data-variation', 'inverted tiny').attr('title', '');\n    });\n\n    // Semantic UI modules.\n    $('.dropdown:not(.custom)').dropdown();\n    $('.jump.dropdown').dropdown({\n        action: 'hide',\n        onShow: function () {\n            $('.poping.up').popup('hide');\n        }\n    });\n    $('.slide.up.dropdown').dropdown({\n        transition: 'slide up'\n    });\n    $('.upward.dropdown').dropdown({\n        direction: 'upward'\n    });\n    $('.ui.accordion').accordion();\n    $('.ui.checkbox').checkbox();\n    $('.ui.progress').progress({\n        showActivity: false\n    });\n    $('.poping.up').popup();\n    $('.top.menu .poping.up').popup({\n        onShow: function () {\n            if ($('.top.menu .menu.transition').hasClass('visible')) {\n                return false;\n            }\n        }\n    });\n    $('.tabular.menu .item').tab();\n    $('.tabable.menu .item').tab();\n\n    $('.toggle.button').click(function () {\n        $($(this).data('target')).slideToggle(100);\n    });\n\n    // make table <tr> element clickable like a link\n    $('tr[data-href]').click(function() {\n        window.location = $(this).data('href');\n    });\n\n    // Highlight JS\n    if (typeof hljs != 'undefined') {\n        const nodes = [].slice.call(document.querySelectorAll('pre code') || []);\n        for (let i = 0; i < nodes.length; i++) {\n            hljs.highlightBlock(nodes[i]);\n        }\n    }\n\n    // Dropzone\n    const $dropzone = $('#dropzone');\n    if ($dropzone.length > 0) {\n        const filenameDict = {};\n\n        new Dropzone(\"#dropzone\", {\n            url: $dropzone.data('upload-url'),\n            headers: {\"X-Csrf-Token\": csrf},\n            maxFiles: $dropzone.data('max-file'),\n            maxFilesize: $dropzone.data('max-size'),\n            acceptedFiles: ($dropzone.data('accepts') === '*/*') ? null : $dropzone.data('accepts'),\n            addRemoveLinks: true,\n            dictDefaultMessage: $dropzone.data('default-message'),\n            dictInvalidFileType: $dropzone.data('invalid-input-type'),\n            dictFileTooBig: $dropzone.data('file-too-big'),\n            dictRemoveFile: $dropzone.data('remove-file'),\n            init: function () {\n                this.on(\"success\", function (file, data) {\n                    filenameDict[file.name] = data.uuid;\n                    const input = $('<input id=\"' + data.uuid + '\" name=\"files\" type=\"hidden\">').val(data.uuid);\n                    $('.files').append(input);\n                });\n                this.on(\"removedfile\", function (file) {\n                    if (file.name in filenameDict) {\n                        $('#' + filenameDict[file.name]).remove();\n                    }\n                    if ($dropzone.data('remove-url') && $dropzone.data('csrf')) {\n                        $.post($dropzone.data('remove-url'), {\n                            file: filenameDict[file.name],\n                            _csrf: $dropzone.data('csrf')\n                        });\n                    }\n                })\n            },\n        });\n    }\n\n    // Emojify\n    emojify.setConfig({\n        img_dir: suburl + '/vendor/plugins/emojify/images',\n        ignore_emoticons: true\n    });\n    const hasEmoji = document.getElementsByClassName('has-emoji');\n    for (let i = 0; i < hasEmoji.length; i++) {\n        emojify.run(hasEmoji[i]);\n        for (let j = 0; j < hasEmoji[i].childNodes.length; j++) {\n            if (hasEmoji[i].childNodes[j].nodeName === \"A\") {\n                emojify.run(hasEmoji[i].childNodes[j])\n            }\n        }\n    }\n\n    // Clipboard JS\n    const clipboard = new Clipboard('.clipboard');\n    clipboard.on('success', function (e) {\n        e.clearSelection();\n\n        $('#' + e.trigger.getAttribute('id')).popup('destroy');\n        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-success'))\n        $('#' + e.trigger.getAttribute('id')).popup('show');\n        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original'))\n    });\n\n    clipboard.on('error', function (e) {\n        $('#' + e.trigger.getAttribute('id')).popup('destroy');\n        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-error'))\n        $('#' + e.trigger.getAttribute('id')).popup('show');\n        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original'))\n    });\n\n    // Helpers.\n    $('.delete-button').click(showDeletePopup);\n    $('.add-all-button').click(showAddAllPopup);\n\n    $('.delete-branch-button').click(showDeletePopup);\n\n    $('.undo-button').click(function() {\n        const $this = $(this);\n        $.post($this.data('url'), {\n            \"_csrf\": csrf,\n            \"id\": $this.data(\"id\")\n        }).done(function(data) {\n            window.location.href = data.redirect;\n        });\n    });\n    $('.show-panel.button').click(function () {\n        $($(this).data('panel')).show();\n    });\n    $('.show-modal.button').click(function () {\n        $($(this).data('modal')).modal('show');\n    });\n    $('.delete-post.button').click(function () {\n        const $this = $(this);\n        $.post($this.data('request-url'), {\n            \"_csrf\": csrf\n        }).done(function () {\n            window.location.href = $this.data('done-url');\n        });\n    });\n\n    // Set anchor.\n    $('.markdown').each(function () {\n        const headers = {};\n        $(this).find('h1, h2, h3, h4, h5, h6').each(function () {\n            let node = $(this);\n            const val = encodeURIComponent(node.text().toLowerCase().replace(/[^\\u00C0-\\u1FFF\\u2C00-\\uD7FF\\w\\- ]/g, '').replace(/[ ]/g, '-'));\n            let name = val;\n            if (headers[val] > 0) {\n                name = val + '-' + headers[val];\n            }\n            if (headers[val] == undefined) {\n                headers[val] = 1;\n            } else {\n                headers[val] += 1;\n            }\n            node = node.wrap('<div id=\"' + name + '\" class=\"anchor-wrap\" ></div>');\n            node.append('<a class=\"anchor\" href=\"#' + name + '\"><span class=\"octicon octicon-link\"></span></a>');\n        });\n    });\n\n    $('.issue-checkbox').click(function() {\n        const numChecked = $('.issue-checkbox').children('input:checked').length;\n        if (numChecked > 0) {\n            $('#issue-filters').addClass(\"hide\");\n            $('#issue-actions').removeClass(\"hide\");\n        } else {\n            $('#issue-filters').removeClass(\"hide\");\n            $('#issue-actions').addClass(\"hide\");\n        }\n    });\n\n    $('.issue-action').click(function () {\n        let action = this.dataset.action;\n        let elementId = this.dataset.elementId;\n        const issueIDs = $('.issue-checkbox').children('input:checked').map(function() {\n            return this.dataset.issueId;\n        }).get().join();\n        const url = this.dataset.url;\n        if (elementId === '0' && url.substr(-9) === '/assignee'){\n            elementId = '';\n            action = 'clear';\n        }\n        updateIssuesMeta(url, action, issueIDs, elementId).then(function() {\n            // NOTICE: This reset of checkbox state targets Firefox caching behaviour, as the checkboxes stay checked after reload\n            if (action === \"close\" || action === \"open\" ){\n                //uncheck all checkboxes\n                $('.issue-checkbox input[type=\"checkbox\"]').each(function(_,e){ e.checked = false; });\n            }\n            reload();\n        });\n    });\n\n    // NOTICE: This event trigger targets Firefox caching behaviour, as the checkboxes stay checked after reload\n    // trigger ckecked event, if checkboxes are checked on load\n    $('.issue-checkbox input[type=\"checkbox\"]:checked').first().each(function(_,e) {\n        e.checked = false;\n        $(e).click();\n    });\n\n    buttonsClickOnEnter();\n    searchUsers();\n    searchTeams();\n    searchRepositories();\n\n    initCommentForm();\n    initInstall();\n    initRepository();\n    initMigration();\n    initWikiForm();\n    initEditForm();\n    initEditor();\n    initOrganization();\n    initWebhook();\n    initAdmin();\n    initCodeView();\n    initVueApp();\n    initTeamSettings();\n    initCtrlEnterSubmit();\n    initNavbarContentToggle();\n    initTopicbar();\n    initU2FAuth();\n    initU2FRegister();\n    initIssueList();\n    initWipTitle();\n    initPullRequestReview();\n    initRepoStatusChecker();\n    initTemplateSearch();\n\n    // Repo clone url.\n    if ($('#repo-clone-url').length > 0) {\n        switch (localStorage.getItem('repo-clone-protocol')) {\n            case 'ssh':\n                if ($('#repo-clone-ssh').click().length === 0) {\n                    $('#repo-clone-https').click();\n                }\n                break;\n            default:\n                $('#repo-clone-https').click();\n                break;\n        }\n    }\n\n    const routes = {\n        'div.user.settings': initUserSettings,\n        'div.repository.settings.collaboration': initRepositoryCollaboration\n    };\n\n    let selector;\n    for (selector in routes) {\n        if ($(selector).length > 0) {\n            routes[selector]();\n            break;\n        }\n    }\n\n    const $cloneAddr = $('#clone_addr');\n    $cloneAddr.change(function() {\n        const $repoName = $('#repo_name');\n        if ($cloneAddr.val().length > 0 && $repoName.val().length === 0) { // Only modify if repo_name input is blank\n            $repoName.val($cloneAddr.val().match(/^(.*\\/)?((.+?)(\\.git)?)$/)[3]);\n        }\n    });\n});\n\nfunction changeHash(hash) {\n    if (history.pushState) {\n        history.pushState(null, null, hash);\n    }\n    else {\n        location.hash = hash;\n    }\n}\n\nfunction deSelect() {\n    if (window.getSelection) {\n        window.getSelection().removeAllRanges();\n    } else {\n        document.selection.empty();\n    }\n}\n\nfunction selectRange($list, $select, $from) {\n    $list.removeClass('active');\n    if ($from) {\n        let a = parseInt($select.attr('rel').substr(1));\n        let b = parseInt($from.attr('rel').substr(1));\n        let c;\n        if (a != b) {\n            if (a > b) {\n                c = a;\n                a = b;\n                b = c;\n            }\n            const classes = [];\n            for (let i = a; i <= b; i++) {\n                classes.push('.L' + i);\n            }\n            $list.filter(classes.join(',')).addClass('active');\n            changeHash('#L' + a + '-' + 'L' + b);\n            return\n        }\n    }\n    $select.addClass('active');\n    changeHash('#' + $select.attr('rel'));\n}\n\n$(function () {\n    // Warn users that try to leave a page after entering data into a form.\n    // Except on sign-in pages, and for forms marked as 'ignore-dirty'.\n    if ($('.user.signin').length === 0) {\n      $('form:not(.ignore-dirty)').areYouSure();\n    }\n\n    // Parse SSH Key\n    $(\"#ssh-key-content\").on('change paste keyup',function(){\n        const arrays = $(this).val().split(\" \");\n        const $title = $(\"#ssh-key-title\")\n        if ($title.val() === \"\" && arrays.length === 3 && arrays[2] !== \"\") {\n            $title.val(arrays[2]);\n        }\n    });\n});\n\nfunction showDeletePopup() {\n    const $this = $(this);\n    let filter = \"\";\n    if ($this.attr(\"id\")) {\n        filter += \"#\" + $this.attr(\"id\")\n    }\n\n    const dialog = $('.delete.modal' + filter);\n    dialog.find('.name').text($this.data('name'));\n\n    dialog.modal({\n        closable: false,\n        onApprove: function() {\n            if ($this.data('type') == \"form\") {\n                $($this.data('form')).submit();\n                return;\n            }\n\n            $.post($this.data('url'), {\n                \"_csrf\": csrf,\n                \"id\": $this.data(\"id\")\n            }).done(function(data) {\n                window.location.href = data.redirect;\n            });\n        }\n    }).modal('show');\n    return false;\n}\n\nfunction showAddAllPopup() {\n    const $this = $(this);\n    let filter = \"\";\n    if ($this.attr(\"id\")) {\n        filter += \"#\" + $this.attr(\"id\")\n    }\n\n    const dialog = $('.addall.modal' + filter);\n    dialog.find('.name').text($this.data('name'));\n\n    dialog.modal({\n        closable: false,\n        onApprove: function() {\n            if ($this.data('type') == \"form\") {\n                $($this.data('form')).submit();\n                return;\n            }\n\n            $.post($this.data('url'), {\n                \"_csrf\": csrf,\n                \"id\": $this.data(\"id\")\n            }).done(function(data) {\n                window.location.href = data.redirect;\n            });\n        }\n    }).modal('show');\n    return false;\n}\n\nfunction initVueComponents(){\n    const vueDelimeters = ['${', '}'];\n\n    Vue.component('repo-search', {\n        delimiters: vueDelimeters,\n\n        props: {\n            searchLimit: {\n                type: Number,\n                default: 10\n            },\n            suburl: {\n                type: String,\n                required: true\n            },\n            uid: {\n                type: Number,\n                required: true\n            },\n            organizations: {\n                type: Array,\n                default: []\n            },\n            isOrganization: {\n                type: Boolean,\n                default: true\n            },\n            canCreateOrganization: {\n                type: Boolean,\n                default: false\n            },\n            organizationsTotalCount: {\n                type: Number,\n                default: 0\n            },\n            moreReposLink: {\n                type: String,\n                default: ''\n            }\n        },\n\n        data: function() {\n            return {\n                tab: 'repos',\n                repos: [],\n                reposTotalCount: 0,\n                reposFilter: 'all',\n                searchQuery: '',\n                isLoading: false,\n                repoTypes: {\n                    'all': {\n                        count: 0,\n                        searchMode: '',\n                    },\n                    'forks': {\n                        count: 0,\n                        searchMode: 'fork',\n                    },\n                    'mirrors': {\n                        count: 0,\n                        searchMode: 'mirror',\n                    },\n                    'sources': {\n                        count: 0,\n                        searchMode: 'source',\n                    },\n                    'collaborative': {\n                        count: 0,\n                        searchMode: 'collaborative',\n                    },\n                }\n            }\n        },\n\n        computed: {\n            showMoreReposLink: function() {\n                return this.repos.length > 0 && this.repos.length < this.repoTypes[this.reposFilter].count;\n            },\n            searchURL: function() {\n                return this.suburl + '/api/v1/repos/search?sort=updated&order=desc&uid=' + this.uid + '&q=' + this.searchQuery\n                                   + '&limit=' + this.searchLimit + '&mode=' + this.repoTypes[this.reposFilter].searchMode\n                                   + (this.reposFilter !== 'all' ? '&exclusive=1' : '');\n            },\n            repoTypeCount: function() {\n                return this.repoTypes[this.reposFilter].count;\n            }\n        },\n\n        mounted: function() {\n            this.searchRepos(this.reposFilter);\n\n            const self = this;\n            Vue.nextTick(function() {\n                self.$refs.search.focus();\n            });\n        },\n\n        methods: {\n            changeTab: function(t) {\n                this.tab = t;\n            },\n\n            changeReposFilter: function(filter) {\n                this.reposFilter = filter;\n                this.repos = [];\n                this.repoTypes[filter].count = 0;\n                this.searchRepos(filter);\n            },\n\n            showRepo: function(repo, filter) {\n                switch (filter) {\n                    case 'sources':\n                        return repo.owner.id == this.uid && !repo.mirror && !repo.fork;\n                    case 'forks':\n                        return repo.owner.id == this.uid && !repo.mirror && repo.fork;\n                    case 'mirrors':\n                        return repo.mirror;\n                    case 'collaborative':\n                        return repo.owner.id != this.uid && !repo.mirror;\n                    default:\n                        return true;\n                }\n            },\n\n            searchRepos: function(reposFilter) {\n                const self = this;\n\n                this.isLoading = true;\n\n                const searchedMode = this.repoTypes[reposFilter].searchMode;\n                const searchedURL = this.searchURL;\n                const searchedQuery = this.searchQuery;\n\n                $.getJSON(searchedURL, function(result, _textStatus, request) {\n                    if (searchedURL == self.searchURL) {\n                        self.repos = result.data;\n                        const count = request.getResponseHeader('X-Total-Count');\n                        if (searchedQuery === '' && searchedMode === '') {\n                            self.reposTotalCount = count;\n                        }\n                        self.repoTypes[reposFilter].count = count;\n                    }\n                }).always(function() {\n                    if (searchedURL == self.searchURL) {\n                        self.isLoading = false;\n                    }\n                });\n            },\n\n            repoClass: function(repo) {\n                if (repo.fork) {\n                    return 'octicon octicon-repo-forked';\n                } else if (repo.mirror) {\n                    return 'octicon octicon-repo-clone';\n                } else if (repo.private) {\n                    return 'octicon octicon-lock';\n                } else {\n                    return 'octicon octicon-repo';\n                }\n            }\n        }\n    })\n}\n\nfunction initCtrlEnterSubmit() {\n    $(\".js-quick-submit\").keydown(function(e) {\n        if (((e.ctrlKey && !e.altKey) || e.metaKey) && (e.keyCode == 13 || e.keyCode == 10)) {\n            $(this).closest(\"form\").submit();\n        }\n    });\n}\n\nfunction initVueApp() {\n    const el = document.getElementById('app');\n    if (!el) {\n        return;\n    }\n\n    initVueComponents();\n\n    new Vue({\n        delimiters: ['${', '}'],\n        el: el,\n\n        data: {\n            searchLimit: document.querySelector('meta[name=_search_limit]').content,\n            suburl: document.querySelector('meta[name=_suburl]').content,\n            uid: document.querySelector('meta[name=_context_uid]').content,\n        },\n    });\n}\n\nwindow.timeAddManual = function() {\n    $('.mini.modal')\n        .modal({\n            duration: 200,\n            onApprove: function() {\n                $('#add_time_manual_form').submit();\n            }\n        }).modal('show')\n    ;\n}\n\nwindow.toggleStopwatch = function() {\n    $(\"#toggle_stopwatch_form\").submit();\n}\nwindow.cancelStopwatch = function() {\n    $(\"#cancel_stopwatch_form\").submit();\n}\n\nwindow.initHeatmap = function(appElementId, heatmapUser, locale) {\n    const el = document.getElementById(appElementId);\n    if (!el) {\n        return;\n    }\n\n    locale = locale || {};\n\n    locale.contributions = locale.contributions || 'contributions';\n    locale.no_contributions = locale.no_contributions || 'No contributions';\n\n    const vueDelimeters = ['${', '}'];\n\n    Vue.component('activity-heatmap', {\n        delimiters: vueDelimeters,\n\n        props: {\n            user: {\n                type: String,\n                required: true\n            },\n            suburl: {\n                type: String,\n                required: true\n            },\n            locale: {\n                type: Object,\n                required: true\n            }\n        },\n\n        data: function () {\n            return {\n                isLoading: true,\n                colorRange: [],\n                endDate: null,\n                values: [],\n                totalContributions: 0,\n            };\n        },\n\n        mounted: function() {\n            this.colorRange = [\n                this.getColor(0),\n                this.getColor(1),\n                this.getColor(2),\n                this.getColor(3),\n                this.getColor(4),\n                this.getColor(5)\n            ];\n            this.endDate = new Date();\n            this.loadHeatmap(this.user);\n        },\n\n        methods: {\n            loadHeatmap: function(userName) {\n                const self = this;\n                $.get(this.suburl + '/api/v1/users/' + userName + '/heatmap', function(chartRawData) {\n                    const chartData = [];\n                    for (let i = 0; i < chartRawData.length; i++) {\n                        self.totalContributions += chartRawData[i].contributions;\n                        chartData[i] = { date: new Date(chartRawData[i].timestamp * 1000), count: chartRawData[i].contributions };\n                    }\n                    self.values = chartData;\n                    self.isLoading = false;\n                });\n            },\n\n            getColor: function(idx) {\n                const el = document.createElement('div');\n                el.className = 'heatmap-color-' + idx;\n                document.body.appendChild(el);\n\n                const color = getComputedStyle(el).backgroundColor;\n\n                document.body.removeChild(el);\n\n                return color;\n            }\n        },\n\n        template: '<div><div v-show=\"isLoading\"><slot name=\"loading\"></slot></div><h4 class=\"total-contributions\" v-if=\"!isLoading\"><span v-html=\"totalContributions\"></span> total contributions in the last 12 months</h4><calendar-heatmap v-show=\"!isLoading\" :locale=\"locale\" :no-data-text=\"locale.no_contributions\" :tooltip-unit=\"locale.contributions\" :end-date=\"endDate\" :values=\"values\" :range-color=\"colorRange\" />'\n    });\n\n    new Vue({\n        delimiters: vueDelimeters,\n        el: el,\n\n        data: {\n            suburl: document.querySelector('meta[name=_suburl]').content,\n            heatmapUser: heatmapUser,\n            locale: locale\n        },\n    });\n}\n\nfunction initFilterBranchTagDropdown(selector) {\n    $(selector).each(function() {\n        const $dropdown = $(this);\n        const $data = $dropdown.find('.data');\n        const data = {\n            items: [],\n            mode: $data.data('mode'),\n            searchTerm: '',\n            noResults: '',\n            canCreateBranch: false,\n            menuVisible: false,\n            active: 0\n        };\n        $data.find('.item').each(function() {\n            data.items.push({\n                name: $(this).text(),\n                url: $(this).data('url'),\n                branch: $(this).hasClass('branch'),\n                tag: $(this).hasClass('tag'),\n                selected: $(this).hasClass('selected')\n            });\n        });\n        $data.remove();\n        new Vue({\n            delimiters: ['${', '}'],\n            el: this,\n            data: data,\n\n            beforeMount: function () {\n                const vm = this;\n\n                this.noResults = vm.$el.getAttribute('data-no-results');\n                this.canCreateBranch = vm.$el.getAttribute('data-can-create-branch') === 'true';\n\n                document.body.addEventListener('click', function(event) {\n                    if (vm.$el.contains(event.target)) {\n                        return;\n                    }\n                    if (vm.menuVisible) {\n                        Vue.set(vm, 'menuVisible', false);\n                    }\n                });\n            },\n\n            watch: {\n                menuVisible: function(visible) {\n                    if (visible) {\n                        this.focusSearchField();\n                    }\n                }\n            },\n\n            computed: {\n                filteredItems: function() {\n                    const vm = this;\n\n                    const items = vm.items.filter(function (item) {\n                        return ((vm.mode === 'branches' && item.branch)\n                                || (vm.mode === 'tags' && item.tag))\n                            && (!vm.searchTerm\n                                || item.name.toLowerCase().indexOf(vm.searchTerm.toLowerCase()) >= 0);\n                    });\n\n                    vm.active = (items.length === 0 && vm.showCreateNewBranch ? 0 : -1);\n\n                    return items;\n                },\n                showNoResults: function() {\n                    return this.filteredItems.length === 0\n                            && !this.showCreateNewBranch;\n                },\n                showCreateNewBranch: function() {\n                    const vm = this;\n                    if (!this.canCreateBranch || !vm.searchTerm || vm.mode === 'tags') {\n                        return false;\n                    }\n\n                    return vm.items.filter(function (item) {\n                        return item.name.toLowerCase() === vm.searchTerm.toLowerCase()\n                    }).length === 0;\n                }\n            },\n\n            methods: {\n                selectItem: function(item) {\n                    const prev = this.getSelected();\n                    if (prev !== null) {\n                        prev.selected = false;\n                    }\n                    item.selected = true;\n                    window.location.href = item.url;\n                },\n                createNewBranch: function() {\n                    if (!this.showCreateNewBranch) {\n                        return;\n                    }\n                    this.$refs.newBranchForm.submit();\n                },\n                focusSearchField: function() {\n                    const vm = this;\n                    Vue.nextTick(function() {\n                        vm.$refs.searchField.focus();\n                    });\n                },\n                getSelected: function() {\n                    for (let i = 0, j = this.items.length; i < j; ++i) {\n                        if (this.items[i].selected)\n                            return this.items[i];\n                    }\n                    return null;\n                },\n                getSelectedIndexInFiltered: function() {\n                    for (let i = 0, j = this.filteredItems.length; i < j; ++i) {\n                        if (this.filteredItems[i].selected)\n                            return i;\n                    }\n                    return -1;\n                },\n                scrollToActive: function() {\n                    let el = this.$refs['listItem' + this.active];\n                    if (!el || el.length === 0) {\n                        return;\n                    }\n                    if (Array.isArray(el)) {\n                        el = el[0];\n                    }\n\n                    const cont = this.$refs.scrollContainer;\n\n                     if (el.offsetTop < cont.scrollTop) {\n                         cont.scrollTop = el.offsetTop;\n                     }\n                     else if (el.offsetTop + el.clientHeight > cont.scrollTop + cont.clientHeight) {\n                        cont.scrollTop = el.offsetTop + el.clientHeight - cont.clientHeight;\n                    }\n                },\n                keydown: function(event) {\n                    const vm = this;\n                    if (event.keyCode === 40) {\n                        // arrow down\n                        event.preventDefault();\n\n                        if (vm.active === -1) {\n                            vm.active = vm.getSelectedIndexInFiltered();\n                        }\n\n                        if (vm.active + (vm.showCreateNewBranch ? 0 : 1) >= vm.filteredItems.length) {\n                            return;\n                        }\n                        vm.active++;\n                        vm.scrollToActive();\n                    }\n                    if (event.keyCode === 38) {\n                        // arrow up\n                        event.preventDefault();\n\n                         if (vm.active === -1) {\n                            vm.active = vm.getSelectedIndexInFiltered();\n                        }\n\n                         if (vm.active <= 0) {\n                            return;\n                        }\n                        vm.active--;\n                        vm.scrollToActive();\n                    }\n                    if (event.keyCode == 13) {\n                        // enter\n                        event.preventDefault();\n\n                         if (vm.active >= vm.filteredItems.length) {\n                            vm.createNewBranch();\n                        } else if (vm.active >= 0) {\n                            vm.selectItem(vm.filteredItems[vm.active]);\n                        }\n                    }\n                    if (event.keyCode == 27) {\n                        // escape\n                        event.preventDefault();\n                        vm.menuVisible = false;\n                    }\n                }\n            }\n        });\n    });\n}\n\n$(\".commit-button\").click(function(e) {\n    e.preventDefault();\n    $(this).parent().find('.commit-body').toggle();\n});\n\nfunction initNavbarContentToggle() {\n    const content = $('#navbar');\n    const toggle = $('#navbar-expand-toggle');\n    let isExpanded = false;\n    toggle.click(function() {\n        isExpanded = !isExpanded;\n        if (isExpanded) {\n            content.addClass('shown');\n            toggle.addClass('active');\n        }\n        else {\n            content.removeClass('shown');\n            toggle.removeClass('active');\n        }\n    });\n}\n\nfunction initTopicbar() {\n    const mgrBtn = $(\"#manage_topic\");\n    const editDiv = $(\"#topic_edit\");\n    const viewDiv = $(\"#repo-topics\");\n    const saveBtn = $(\"#save_topic\");\n    const topicDropdown = $('#topic_edit .dropdown');\n    const topicForm = $('#topic_edit.ui.form');\n    const topicPrompts = getPrompts();\n\n    mgrBtn.click(function() {\n        viewDiv.hide();\n        editDiv.css('display', ''); // show Semantic UI Grid\n    });\n\n    function getPrompts() {\n        const hidePrompt = $(\"div.hide#validate_prompt\"),\n            prompts = {\n                countPrompt: hidePrompt.children('#count_prompt').text(),\n                formatPrompt: hidePrompt.children('#format_prompt').text()\n            };\n        hidePrompt.remove();\n        return prompts;\n    }\n\n    saveBtn.click(function() {\n        const topics = $(\"input[name=topics]\").val();\n\n        $.post(saveBtn.data('link'), {\n            \"_csrf\": csrf,\n            \"topics\": topics\n        }, function(_data, _textStatus, xhr){\n            if (xhr.responseJSON.status === 'ok') {\n                viewDiv.children(\".topic\").remove();\n                if (topics.length) {\n                    const topicArray = topics.split(\",\");\n\n                    const last = viewDiv.children(\"a\").last();\n                    for (let i=0; i < topicArray.length; i++) {\n                        $('<div class=\"ui small label topic\" style=\"cursor:pointer;\">'+topicArray[i]+'</div>').insertBefore(last)\n                    }\n                }\n                editDiv.css('display', 'none');\n                viewDiv.show();\n            }\n        }).fail(function(xhr){\n            if (xhr.status === 422) {\n                if (xhr.responseJSON.invalidTopics.length > 0) {\n                    topicPrompts.formatPrompt = xhr.responseJSON.message;\n\n                    const invalidTopics = xhr.responseJSON.invalidTopics,\n                        topicLables = topicDropdown.children('a.ui.label');\n\n                    topics.split(',').forEach(function(value, index) {\n                        for (let i=0; i < invalidTopics.length; i++) {\n                            if (invalidTopics[i] === value) {\n                                topicLables.eq(index).removeClass(\"green\").addClass(\"red\");\n                            }\n                        }\n                    });\n                } else {\n                    topicPrompts.countPrompt = xhr.responseJSON.message;\n                }\n            }\n        }).always(function() {\n            topicForm.form('validate form');\n        });\n    });\n\n    topicDropdown.dropdown({\n        allowAdditions: true,\n        forceSelection: false,\n        fields: { name: \"description\", value: \"data-value\" },\n        saveRemoteData: false,\n        label: {\n            transition : 'horizontal flip',\n            duration   : 200,\n            variation  : false,\n            blue : true,\n            basic: true,\n        },\n        className: {\n            label: 'ui small label'\n        },\n        apiSettings: {\n            url: suburl + '/api/v1/topics/search?q={query}',\n            throttle: 500,\n            cache: false,\n            onResponse: function(res) {\n                const formattedResponse = {\n                    success: false,\n                    results: [],\n                };\n                const stripTags = function (text) {\n                    return text.replace(/<[^>]*>?/gm, \"\");\n                };\n\n                const query = stripTags(this.urlData.query.trim());\n                let found_query = false;\n                const current_topics = [];\n                topicDropdown.find('div.label.visible.topic,a.label.visible').each(function(_,e){ current_topics.push(e.dataset.value); });\n\n                if (res.topics) {\n                    let found = false;\n                    for (let i=0;i < res.topics.length;i++) {\n                        // skip currently added tags\n                        if (current_topics.indexOf(res.topics[i].topic_name) != -1){\n                            continue;\n                        }\n\n                        if (res.topics[i].topic_name.toLowerCase() === query.toLowerCase()){\n                            found_query = true;\n                        }\n                        formattedResponse.results.push({\"description\": res.topics[i].topic_name, \"data-value\": res.topics[i].topic_name});\n                        found = true;\n                    }\n                    formattedResponse.success = found;\n                }\n\n                if (query.length > 0 && !found_query){\n                    formattedResponse.success = true;\n                    formattedResponse.results.unshift({\"description\": query, \"data-value\": query});\n                } else if (query.length > 0 && found_query) {\n                    formattedResponse.results.sort(function(a, b){\n                        if (a.description.toLowerCase() === query.toLowerCase()) return -1;\n                        if (b.description.toLowerCase() === query.toLowerCase()) return 1;\n                        if (a.description > b.description) return -1;\n                        if (a.description < b.description) return 1;\n                        return 0;\n                    });\n                }\n\n\n                return formattedResponse;\n            },\n        },\n        onLabelCreate: function(value) {\n            value = value.toLowerCase().trim();\n            this.attr(\"data-value\", value).contents().first().replaceWith(value);\n            return $(this);\n        },\n        onAdd: function(addedValue, _addedText, $addedChoice) {\n            addedValue = addedValue.toLowerCase().trim();\n            $($addedChoice).attr('data-value', addedValue);\n            $($addedChoice).attr('data-text', addedValue);\n        }\n    });\n\n    $.fn.form.settings.rules.validateTopic = function(_values, regExp) {\n        const topics = topicDropdown.children('a.ui.label'),\n            status = topics.length === 0 || topics.last().attr(\"data-value\").match(regExp);\n        if (!status) {\n            topics.last().removeClass(\"green\").addClass(\"red\");\n        }\n        return status && topicDropdown.children('a.ui.label.red').length === 0;\n    };\n\n    topicForm.form({\n            on: 'change',\n            inline : true,\n            fields: {\n                topics: {\n                    identifier: 'topics',\n                    rules: [\n                        {\n                            type: 'validateTopic',\n                            value: /^[a-z0-9][a-z0-9-]{1,35}$/,\n                            prompt: topicPrompts.formatPrompt\n                        },\n                        {\n                            type: 'maxCount[25]',\n                            prompt: topicPrompts.countPrompt\n                        }\n                    ]\n                },\n            }\n        });\n}\nwindow.toggleDeadlineForm = function() {\n    $('#deadlineForm').fadeToggle(150);\n}\n\nwindow.setDeadline = function() {\n    const deadline = $('#deadlineDate').val();\n    updateDeadline(deadline);\n}\n\nfunction updateDeadline(deadlineString) {\n    $('#deadline-err-invalid-date').hide();\n    $('#deadline-loader').addClass('loading');\n\n    let realDeadline = null;\n    if (deadlineString !== '') {\n\n        const newDate = Date.parse(deadlineString)\n\n        if (isNaN(newDate)) {\n            $('#deadline-loader').removeClass('loading');\n            $('#deadline-err-invalid-date').show();\n            return false;\n        }\n        realDeadline = new Date(newDate);\n    }\n\n    $.ajax($('#update-issue-deadline-form').attr('action') + '/deadline', {\n        data: JSON.stringify({\n            'due_date': realDeadline,\n        }),\n        headers: {\n            'X-Csrf-Token': csrf,\n            'X-Remote': true,\n        },\n        contentType: 'application/json',\n        type: 'POST',\n        success: function () {\n            reload();\n        },\n        error: function () {\n            $('#deadline-loader').removeClass('loading');\n            $('#deadline-err-invalid-date').show();\n        }\n    });\n}\n\nwindow.deleteDependencyModal = function(id, type) {\n    $('.remove-dependency')\n        .modal({\n            closable: false,\n            duration: 200,\n            onApprove: function () {\n                $('#removeDependencyID').val(id);\n                $('#dependencyType').val(type);\n                $('#removeDependencyForm').submit();\n            }\n        }).modal('show')\n    ;\n}\n\nfunction initIssueList() {\n    const repolink = $('#repolink').val();\n    const repoId = $('#repoId').val();\n    const crossRepoSearch = $('#crossRepoSearch').val();\n    let issueSearchUrl = suburl + '/api/v1/repos/' + repolink + '/issues?q={query}';\n    if (crossRepoSearch === 'true') {\n        issueSearchUrl = suburl + '/api/v1/repos/issues/search?q={query}&priority_repo_id=' + repoId;\n    }\n    $('#new-dependency-drop-list')\n        .dropdown({\n            apiSettings: {\n                url: issueSearchUrl,\n                onResponse: function(response) {\n                    const filteredResponse = {'success': true, 'results': []};\n                    const currIssueId = $('#new-dependency-drop-list').data('issue-id');\n                    // Parse the response from the api to work with our dropdown\n                    $.each(response, function(_i, issue) {\n                        // Don't list current issue in the dependency list.\n                        if(issue.id === currIssueId) {\n                            return;\n                        }\n                        filteredResponse.results.push({\n                            'name'  : '#' + issue.number + ' ' + htmlEncode(issue.title) +\n                                '<div class=\"text small dont-break-out\">' + htmlEncode(issue.repository.full_name) + '</div>',\n                            'value' : issue.id\n                        });\n                    });\n                    return filteredResponse;\n                },\n                cache: false,\n            },\n\n            fullTextSearch: true\n        });\n\n    $(\".menu a.label-filter-item\").each(function() {\n        $(this).click(function(e) {\n            if (e.altKey) {\n                e.preventDefault();\n\n                const href = $(this).attr(\"href\");\n                const id = $(this).data(\"label-id\");\n\n                const regStr = \"labels=(-?[0-9]+%2c)*(\" + id + \")(%2c-?[0-9]+)*&\";\n                const newStr = \"labels=$1-$2$3&\";\n\n                window.location = href.replace(new RegExp(regStr), newStr);\n            }\n        });\n    });\n\n    $(\".menu .ui.dropdown.label-filter\").keydown(function(e) {\n        if (e.altKey && e.keyCode == 13) {\n            const selectedItems = $(\".menu .ui.dropdown.label-filter .menu .item.selected\");\n\n            if (selectedItems.length > 0) {\n                const item = $(selectedItems[0]);\n\n                const href = item.attr(\"href\");\n                const id = item.data(\"label-id\");\n\n                const regStr = \"labels=(-?[0-9]+%2c)*(\" + id + \")(%2c-?[0-9]+)*&\";\n                const newStr = \"labels=$1-$2$3&\";\n\n                window.location = href.replace(new RegExp(regStr), newStr);\n            }\n        }\n    });\n}\nwindow.cancelCodeComment = function(btn) {\n    const form = $(btn).closest(\"form\");\n    if(form.length > 0 && form.hasClass('comment-form')) {\n        form.addClass('hide');\n        form.parent().find('button.comment-form-reply').show();\n    } else {\n        form.closest('.comment-code-cloud').remove()\n    }\n}\nwindow.onOAuthLoginClick = function() {\n    const oauthLoader = $('#oauth2-login-loader');\n    const oauthNav = $('#oauth2-login-navigator');\n\n    oauthNav.hide();\n    oauthLoader.removeClass('disabled');\n\n    setTimeout(function(){\n        // recover previous content to let user try again\n        // usually redirection will be performed before this action\n        oauthLoader.addClass('disabled');\n        oauthNav.show();\n    },5000);\n}\n"],"sourceRoot":""}
\ No newline at end of file
index bed8eea01953a35f137c310431d0f4d948f6e5ac..770fcf005e8d82a0a38a90471ef1f026fbf2fcfd 100644 (file)
        <script src="{{StaticUrlPrefix}}/vendor/plugins/moment/moment.min.js" charset="utf-8"></script>
        <script src="{{StaticUrlPrefix}}/vendor/plugins/vue-calendar-heatmap/vue-calendar-heatmap.browser.js" charset="utf-8"></script>
        <script type="text/javascript">
-               initHeatmap('user-heatmap', '{{.HeatmapUser}}');
+               window.initHeatmap('user-heatmap', '{{.HeatmapUser}}');
        </script>
 {{end}}
 {{template "custom/footer" .}}
index 38fd3fa7fb4eb4240368a44aa278a1bee410c85b..573e7d463830fb836fc4559abf531550f79923bb 100644 (file)
@@ -39,7 +39,7 @@
                                        {{end}}
                                {{end}}
                                {{if or (not $.HasComments) $.hidden}}
-                                       <button type="button" class="ui submit tiny basic button btn-cancel" onclick="cancelCodeComment(this);">{{$.root.i18n.Tr "cancel"}}</button>
+                                       <button type="button" class="ui submit tiny basic button btn-cancel" onclick="window.cancelCodeComment(this);">{{$.root.i18n.Tr "cancel"}}</button>
                                {{end}}
                        </div>
                </div>
index 637d4ad04aef03e3b501749bbdaf71b2f13787f1..5a812d4fbf5fd76ee7c1dcfab6bf246288f8c243 100644 (file)
                                                </form>
                                                {{if  $.IsStopwatchRunning}}
                                                        <div class="ui buttons fluid stop-cancel">
-                                                               <button onclick="this.disabled=true;toggleStopwatch()" class="ui button stop">{{.i18n.Tr "repo.issues.stop_tracking"}}</button>
-                                                               <button onclick="this.disabled=true;cancelStopwatch()" class="ui negative button cancel">{{.i18n.Tr "repo.issues.cancel_tracking"}}</button>
+                                                               <button onclick="this.disabled=true;window.toggleStopwatch()" class="ui button stop">{{.i18n.Tr "repo.issues.stop_tracking"}}</button>
+                                                               <button onclick="this.disabled=true;window.cancelStopwatch()" class="ui negative button cancel">{{.i18n.Tr "repo.issues.cancel_tracking"}}</button>
                                                        </div>
                                                {{else}}
                                                        {{if .HasUserStopwatch}}
                                                                </div>
                                                        {{end}}
                                                        <div class="ui buttons two fluid start-add">
-                                                               <button onclick="this.disabled=true;toggleStopwatch()" class="ui button poping up start" data-content='{{.i18n.Tr "repo.issues.start_tracking"}}' data-position="top center" data-variation="small inverted">{{.i18n.Tr "repo.issues.start_tracking_short"}}</button>
-                                                               <button onclick="timeAddManual()" class="ui button green poping up add-time" data-content='{{.i18n.Tr "repo.issues.add_time"}}' data-position="top center" data-variation="small inverted">{{.i18n.Tr "repo.issues.add_time_short"}}</button>
+                                                               <button onclick="this.disabled=true;window.toggleStopwatch()" class="ui button poping up start" data-content='{{.i18n.Tr "repo.issues.start_tracking"}}' data-position="top center" data-variation="small inverted">{{.i18n.Tr "repo.issues.start_tracking_short"}}</button>
+                                                               <button onclick="window.timeAddManual()" class="ui button green poping up add-time" data-content='{{.i18n.Tr "repo.issues.add_time"}}' data-position="top center" data-variation="small inverted">{{.i18n.Tr "repo.issues.add_time_short"}}</button>
                                                                <div class="ui mini modal">
                                                                        <div class="header">{{.i18n.Tr "repo.issues.add_time"}}</div>
                                                                        <div class="content">
                                        {{end}}
                                        {{if and .IsIssueWriter (not .Repository.IsArchived)}}
                                                <br/>
-                                               <a style="cursor:pointer;" onclick="toggleDeadlineForm();"><i class="edit icon"></i>{{$.i18n.Tr "repo.issues.due_date_form_edit"}}</a> -
+                                               <a style="cursor:pointer;" onclick="window.toggleDeadlineForm();"><i class="edit icon"></i>{{$.i18n.Tr "repo.issues.due_date_form_edit"}}</a> -
                                                <a style="cursor:pointer;" onclick="updateDeadline('');"><i class="remove icon"></i>{{$.i18n.Tr "repo.issues.due_date_form_remove"}}</a>
                                        {{end}}
                                </p>
 
                        {{if and .IsIssueWriter (not .Repository.IsArchived)}}
                                <div {{if ne .Issue.DeadlineUnix 0}} style="display: none;"{{end}} id="deadlineForm">
-                                       <form class="ui fluid action input" action="{{AppSubUrl}}/api/v1/repos/{{.Repository.Owner.Name}}/{{.Repository.Name}}/issues/{{.Issue.Index}}" method="post" id="update-issue-deadline-form" onsubmit="setDeadline();return false;">
+                                       <form class="ui fluid action input" action="{{AppSubUrl}}/api/v1/repos/{{.Repository.Owner.Name}}/{{.Repository.Name}}/issues/{{.Issue.Index}}" method="post" id="update-issue-deadline-form" onsubmit="window.setDeadline();return false;">
                                                {{$.CsrfTokenHtml}}
                                                <input required placeholder="{{.i18n.Tr "repo.issues.due_date_form"}}" {{if gt .Issue.DeadlineUnix 0}}value="{{.Issue.DeadlineUnix.Format "2006-01-02"}}"{{end}} type="date" name="deadlineDate" id="deadlineDate">
                                                <button class="ui green icon button">
                                                                <div class="text small">{{.Repository.OwnerName}}/{{.Repository.Name}}</div>
                                                                <div class="ui transparent label right floated nopadding">
                                                                        {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}}
-                                                                               <a class="delete-dependency-button" onclick="deleteDependencyModal({{.Issue.ID}}, 'blocking');"
+                                                                               <a class="delete-dependency-button" onclick="window.deleteDependencyModal({{.Issue.ID}}, 'blocking');"
                                                                                        data-tooltip="{{$.i18n.Tr "repo.issues.dependency.remove_info"}}" data-inverted="">
                                                                                        <i class="delete icon text red nopadding nomargin"></i>
                                                                                </a>
                                                                <div class="text small">{{.Repository.OwnerName}}/{{.Repository.Name}}</div>
                                                                <div class="ui transparent label right floated nopadding">
                                                                        {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}}
-                                                                               <a class="delete-dependency-button" onclick="deleteDependencyModal({{.Issue.ID}}, 'blockedBy');"
+                                                                               <a class="delete-dependency-button" onclick="window.deleteDependencyModal({{.Issue.ID}}, 'blockedBy');"
                                                                                        data-tooltip="{{$.i18n.Tr "repo.issues.dependency.remove_info"}}" data-inverted="">
                                                                                        <i class="delete icon text red nopadding nomargin"></i>
                                                                                </a>
index 07f85c954f614397160ac92abacc150287f17c61..90519c439c7687fe60cc77f6fd08861962c1666b 100644 (file)
@@ -65,7 +65,7 @@
                                                                                title="{{$provider.DisplayName}}{{if eq $provider.Name "openidConnect"}} ({{$key}}){{end}}"
                                                                                class="{{$provider.Name}}"
                                                                                src="{{AppSubUrl}}{{$provider.Image}}"
-                                                                               onclick="onOAuthLoginClick()"
+                                                                               onclick="window.onOAuthLoginClick()"
                                                                        ></a>
                                                        {{end}}
                                                </div>
diff --git a/web_src/js/index.js b/web_src/js/index.js
new file mode 100644 (file)
index 0000000..900b589
--- /dev/null
@@ -0,0 +1,3424 @@
+/* globals wipPrefixes, issuesTribute, emojiTribute */
+/* exported timeAddManual, toggleStopwatch, cancelStopwatch, initHeatmap */
+/* exported toggleDeadlineForm, setDeadline, deleteDependencyModal, cancelCodeComment, onOAuthLoginClick */
+'use strict';
+
+function htmlEncode(text) {
+   return jQuery('<div />').text(text).html()
+}
+
+let csrf;
+let suburl;
+let previewFileModes;
+let simpleMDEditor;
+let codeMirrorEditor;
+
+// Disable Dropzone auto-discover because it's manually initialized
+if (typeof(Dropzone) !== "undefined") {
+    Dropzone.autoDiscover = false;
+}
+
+// Polyfill for IE9+ support (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from)
+if (!Array.from) {
+    Array.from = (function () {
+        const toStr = Object.prototype.toString;
+        const isCallable = function (fn) {
+            return typeof fn === 'function' || toStr.call(fn) === '[object Function]';
+        };
+        const toInteger = function (value) {
+            const number = Number(value);
+            if (isNaN(number)) { return 0; }
+            if (number === 0 || !isFinite(number)) { return number; }
+            return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
+        };
+        const maxSafeInteger = Math.pow(2, 53) - 1;
+        const toLength = function (value) {
+            const len = toInteger(value);
+            return Math.min(Math.max(len, 0), maxSafeInteger);
+        };
+
+        // The length property of the from method is 1.
+        return function from(arrayLike/*, mapFn, thisArg */) {
+            // 1. Let C be the this value.
+            const C = this;
+
+            // 2. Let items be ToObject(arrayLike).
+            const items = Object(arrayLike);
+
+            // 3. ReturnIfAbrupt(items).
+            if (arrayLike == null) {
+                throw new TypeError("Array.from requires an array-like object - not null or undefined");
+            }
+
+            // 4. If mapfn is undefined, then let mapping be false.
+            const mapFn = arguments.length > 1 ? arguments[1] : void undefined;
+            let T;
+            if (typeof mapFn !== 'undefined') {
+                // 5. else
+                // 5. a If IsCallable(mapfn) is false, throw a TypeError exception.
+                if (!isCallable(mapFn)) {
+                    throw new TypeError('Array.from: when provided, the second argument must be a function');
+                }
+
+                // 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.
+                if (arguments.length > 2) {
+                    T = arguments[2];
+                }
+            }
+
+            // 10. Let lenValue be Get(items, "length").
+            // 11. Let len be ToLength(lenValue).
+            const len = toLength(items.length);
+
+            // 13. If IsConstructor(C) is true, then
+            // 13. a. Let A be the result of calling the [[Construct]] internal method of C with an argument list containing the single item len.
+            // 14. a. Else, Let A be ArrayCreate(len).
+            const A = isCallable(C) ? Object(new C(len)) : new Array(len);
+
+            // 16. Let k be 0.
+            let k = 0;
+            // 17. Repeat, while k < len… (also steps a - h)
+            let kValue;
+            while (k < len) {
+                kValue = items[k];
+                if (mapFn) {
+                    A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k);
+                } else {
+                    A[k] = kValue;
+                }
+                k += 1;
+            }
+            // 18. Let putStatus be Put(A, "length", len, true).
+            A.length = len;
+            // 20. Return A.
+            return A;
+        };
+    }());
+}
+
+// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
+if (typeof Object.assign != 'function') {
+    // Must be writable: true, enumerable: false, configurable: true
+    Object.defineProperty(Object, "assign", {
+        value: function assign(target, _varArgs) { // .length of function is 2
+            'use strict';
+            if (target == null) { // TypeError if undefined or null
+                throw new TypeError('Cannot convert undefined or null to object');
+            }
+
+            const to = Object(target);
+
+            for (let index = 1; index < arguments.length; index++) {
+                const nextSource = arguments[index];
+
+                if (nextSource != null) { // Skip over if undefined or null
+                    for (const nextKey in nextSource) {
+                        // Avoid bugs when hasOwnProperty is shadowed
+                        if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
+                            to[nextKey] = nextSource[nextKey];
+                        }
+                    }
+                }
+            }
+            return to;
+        },
+        writable: true,
+        configurable: true
+    });
+}
+
+function initCommentPreviewTab($form) {
+    const $tabMenu = $form.find('.tabular.menu');
+    $tabMenu.find('.item').tab();
+    $tabMenu.find('.item[data-tab="' + $tabMenu.data('preview') + '"]').click(function () {
+        const $this = $(this);
+        $.post($this.data('url'), {
+                "_csrf": csrf,
+                "mode": "gfm",
+                "context": $this.data('context'),
+                "text": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
+            },
+            function (data) {
+                const $previewPanel = $form.find('.tab.segment[data-tab="' + $tabMenu.data('preview') + '"]');
+                $previewPanel.html(data);
+                emojify.run($previewPanel[0]);
+                $('pre code', $previewPanel[0]).each(function () {
+                    hljs.highlightBlock(this);
+                });
+            }
+        );
+    });
+
+    buttonsClickOnEnter();
+}
+
+function initEditPreviewTab($form) {
+    const $tabMenu = $form.find('.tabular.menu');
+    $tabMenu.find('.item').tab();
+    const $previewTab = $tabMenu.find('.item[data-tab="' + $tabMenu.data('preview') + '"]');
+    if ($previewTab.length) {
+        previewFileModes = $previewTab.data('preview-file-modes').split(',');
+        $previewTab.click(function () {
+            const $this = $(this);
+            $.post($this.data('url'), {
+                    "_csrf": csrf,
+                    "mode": "gfm",
+                    "context": $this.data('context'),
+                    "text": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
+                },
+                function (data) {
+                    const $previewPanel = $form.find('.tab.segment[data-tab="' + $tabMenu.data('preview') + '"]');
+                    $previewPanel.html(data);
+                    emojify.run($previewPanel[0]);
+                    $('pre code', $previewPanel[0]).each(function () {
+                        hljs.highlightBlock(this);
+                    });
+                }
+            );
+        });
+    }
+}
+
+function initEditDiffTab($form) {
+    const $tabMenu = $form.find('.tabular.menu');
+    $tabMenu.find('.item').tab();
+    $tabMenu.find('.item[data-tab="' + $tabMenu.data('diff') + '"]').click(function () {
+        const $this = $(this);
+        $.post($this.data('url'), {
+                "_csrf": csrf,
+                "context": $this.data('context'),
+                "content": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
+            },
+            function (data) {
+                const $diffPreviewPanel = $form.find('.tab.segment[data-tab="' + $tabMenu.data('diff') + '"]');
+                $diffPreviewPanel.html(data);
+                emojify.run($diffPreviewPanel[0]);
+            }
+        );
+    });
+}
+
+
+function initEditForm() {
+    if ($('.edit.form').length == 0) {
+        return;
+    }
+
+    initEditPreviewTab($('.edit.form'));
+    initEditDiffTab($('.edit.form'));
+}
+
+function initBranchSelector() {
+    const $selectBranch = $('.ui.select-branch')
+    const $branchMenu = $selectBranch.find('.reference-list-menu');
+    $branchMenu.find('.item:not(.no-select)').click(function () {
+        const selectedValue = $(this).data('id');
+        $($(this).data('id-selector')).val(selectedValue);
+        $selectBranch.find('.ui .branch-name').text(selectedValue);
+    });
+    $selectBranch.find('.reference.column').click(function () {
+        $selectBranch.find('.scrolling.reference-list-menu').css('display', 'none');
+        $selectBranch.find('.reference .text').removeClass('black');
+        $($(this).data('target')).css('display', 'block');
+        $(this).find('.text').addClass('black');
+        return false;
+    });
+}
+
+function updateIssuesMeta(url, action, issueIds, elementId) {
+    return new Promise(function(resolve) {
+        $.ajax({
+            type: "POST",
+            url: url,
+            data: {
+                "_csrf": csrf,
+                "action": action,
+                "issue_ids": issueIds,
+                "id": elementId
+            },
+            success: resolve
+        })
+    })
+}
+
+function initRepoStatusChecker() {
+    const migrating = $("#repo_migrating");
+    $('#repo_migrating_failed').hide();
+    if (migrating) {
+        const repo_name = migrating.attr('repo');
+        if (typeof repo_name === 'undefined') {
+            return
+        }
+        $.ajax({
+            type: "GET",
+            url: suburl +"/"+repo_name+"/status",
+            data: {
+                "_csrf": csrf,
+            },
+            complete: function(xhr) {
+                if (xhr.status == 200) {
+                    if (xhr.responseJSON) {
+                        if (xhr.responseJSON["status"] == 0) {
+                            location.reload();
+                            return
+                        }
+
+                        setTimeout(function () {
+                            initRepoStatusChecker()
+                        }, 2000);
+                        return
+                    }
+                }
+                $('#repo_migrating_progress').hide();
+                $('#repo_migrating_failed').show();
+            }
+        })
+    }
+}
+
+function initReactionSelector(parent) {
+    let reactions = '';
+    if (!parent) {
+        parent = $(document);
+        reactions = '.reactions > ';
+    }
+
+    parent.find(reactions + 'a.label').popup({'position': 'bottom left', 'metadata': {'content': 'title', 'title': 'none'}});
+
+    parent.find('.select-reaction > .menu > .item, ' + reactions + 'a.label').on('click', function(e){
+        const vm = this;
+        e.preventDefault();
+
+        if ($(this).hasClass('disabled')) return;
+
+        const actionURL = $(this).hasClass('item') ?
+                $(this).closest('.select-reaction').data('action-url') :
+                $(this).data('action-url');
+        const url = actionURL + '/' + ($(this).hasClass('blue') ? 'unreact' : 'react');
+        $.ajax({
+            type: 'POST',
+            url: url,
+            data: {
+                '_csrf': csrf,
+                'content': $(this).data('content')
+            }
+        }).done(function(resp) {
+            if (resp && (resp.html || resp.empty)) {
+                const content = $(vm).closest('.content');
+                let react = content.find('.segment.reactions');
+                if (!resp.empty && react.length > 0) {
+                    react.remove();
+                }
+                if (!resp.empty) {
+                    react = $('<div class="ui attached segment reactions"></div>');
+                    const attachments = content.find('.segment.bottom:first');
+                    if (attachments.length > 0) {
+                        react.insertBefore(attachments);
+                    } else {
+                        react.appendTo(content);
+                    }
+                    react.html(resp.html);
+                    const hasEmoji = react.find('.has-emoji');
+                    for (let i = 0; i < hasEmoji.length; i++) {
+                        emojify.run(hasEmoji.get(i));
+                    }
+                    react.find('.dropdown').dropdown();
+                    initReactionSelector(react);
+                }
+            }
+        });
+    });
+}
+
+function insertAtCursor(field, value) {
+    if (field.selectionStart || field.selectionStart === 0) {
+        const startPos = field.selectionStart;
+        const endPos = field.selectionEnd;
+        field.value = field.value.substring(0, startPos)
+            + value
+            + field.value.substring(endPos, field.value.length);
+        field.selectionStart = startPos + value.length;
+        field.selectionEnd = startPos + value.length;
+    } else {
+        field.value += value;
+    }
+}
+
+function replaceAndKeepCursor(field, oldval, newval) {
+    if (field.selectionStart || field.selectionStart === 0) {
+        const startPos = field.selectionStart;
+        const endPos = field.selectionEnd;
+        field.value = field.value.replace(oldval, newval);
+        field.selectionStart = startPos + newval.length - oldval.length;
+        field.selectionEnd = endPos + newval.length - oldval.length;
+    } else {
+        field.value = field.value.replace(oldval, newval);
+    }
+}
+
+function retrieveImageFromClipboardAsBlob(pasteEvent, callback){
+    if (!pasteEvent.clipboardData) {
+        return;
+    }
+
+    const items = pasteEvent.clipboardData.items;
+    if (typeof(items) === "undefined") {
+        return;
+    }
+
+    for (let i = 0; i < items.length; i++) {
+        if (items[i].type.indexOf("image") === -1) continue;
+        const blob = items[i].getAsFile();
+
+        if (typeof(callback) === "function") {
+            pasteEvent.preventDefault();
+            pasteEvent.stopPropagation();
+            callback(blob);
+        }
+    }
+}
+
+function uploadFile(file, callback) {
+    const xhr = new XMLHttpRequest();
+
+    xhr.onload = function() {
+        if (xhr.status == 200) {
+            callback(xhr.responseText);
+        }
+    };
+
+    xhr.open("post", suburl + "/attachments", true);
+    xhr.setRequestHeader("X-Csrf-Token", csrf);
+    const formData = new FormData();
+    formData.append('file', file, file.name);
+    xhr.send(formData);
+}
+
+function reload() {
+    window.location.reload();
+}
+
+function initImagePaste(target) {
+    target.each(function() {
+        const field = this;
+        field.addEventListener('paste', function(event){
+            retrieveImageFromClipboardAsBlob(event, function(img) {
+                const name = img.name.substr(0, img.name.lastIndexOf('.'));
+                insertAtCursor(field, '![' + name + ']()');
+                uploadFile(img, function(res) {
+                    const data = JSON.parse(res);
+                    replaceAndKeepCursor(field, '![' + name + ']()', '![' + name + '](' + suburl + '/attachments/' + data.uuid + ')');
+                    const input = $('<input id="' + data.uuid + '" name="files" type="hidden">').val(data.uuid);
+                    $('.files').append(input);
+                });
+            });
+        }, false);
+    });
+}
+
+function initCommentForm() {
+    if ($('.comment.form').length == 0) {
+        return
+    }
+
+    initBranchSelector();
+    initCommentPreviewTab($('.comment.form'));
+    initImagePaste($('.comment.form textarea'));
+
+    // Listsubmit
+    function initListSubmits(selector, outerSelector) {
+        const $list = $('.ui.' + outerSelector + '.list');
+        const $noSelect = $list.find('.no-select');
+        const $listMenu = $('.' + selector + ' .menu');
+        let hasLabelUpdateAction = $listMenu.data('action') == 'update';
+        const labels = {};
+
+        $('.' + selector).dropdown('setting', 'onHide', function(){
+            hasLabelUpdateAction = $listMenu.data('action') == 'update'; // Update the var
+            if (hasLabelUpdateAction) {
+                const promises = [];
+                Object.keys(labels).forEach(function(elementId) {
+                    const label = labels[elementId];
+                    const promise = updateIssuesMeta(
+                        label["update-url"],
+                        label["action"],
+                        label["issue-id"],
+                        elementId
+                    );
+                    promises.push(promise);
+                });
+                Promise.all(promises).then(reload);
+            }
+        });
+
+        $listMenu.find('.item:not(.no-select)').click(function () {
+
+            // we don't need the action attribute when updating assignees
+            if (selector == 'select-assignees-modify') {
+
+                // UI magic. We need to do this here, otherwise it would destroy the functionality of
+                // adding/removing labels
+                if ($(this).hasClass('checked')) {
+                    $(this).removeClass('checked');
+                    $(this).find('.octicon').removeClass('octicon-check');
+                } else {
+                    $(this).addClass('checked');
+                    $(this).find('.octicon').addClass('octicon-check');
+                }
+
+                updateIssuesMeta(
+                    $listMenu.data('update-url'),
+                    "",
+                    $listMenu.data('issue-id'),
+                    $(this).data('id')
+                );
+                $listMenu.data('action', 'update'); // Update to reload the page when we updated items
+                return false;
+            }
+
+            if ($(this).hasClass('checked')) {
+                $(this).removeClass('checked');
+                $(this).find('.octicon').removeClass('octicon-check');
+                if (hasLabelUpdateAction) {
+                    if (!($(this).data('id') in labels)) {
+                        labels[$(this).data('id')] = {
+                            "update-url": $listMenu.data('update-url'),
+                            "action": "detach",
+                            "issue-id": $listMenu.data('issue-id'),
+                        };
+                    } else {
+                        delete labels[$(this).data('id')];
+                    }
+                }
+            } else {
+                $(this).addClass('checked');
+                $(this).find('.octicon').addClass('octicon-check');
+                if (hasLabelUpdateAction) {
+                    if (!($(this).data('id') in labels)) {
+                        labels[$(this).data('id')] = {
+                            "update-url": $listMenu.data('update-url'),
+                            "action": "attach",
+                            "issue-id": $listMenu.data('issue-id'),
+                        };
+                    } else {
+                        delete labels[$(this).data('id')];
+                    }
+                }
+            }
+
+            const listIds = [];
+            $(this).parent().find('.item').each(function () {
+                if ($(this).hasClass('checked')) {
+                    listIds.push($(this).data('id'));
+                    $($(this).data('id-selector')).removeClass('hide');
+                } else {
+                    $($(this).data('id-selector')).addClass('hide');
+                }
+            });
+            if (listIds.length == 0) {
+                $noSelect.removeClass('hide');
+            } else {
+                $noSelect.addClass('hide');
+            }
+            $($(this).parent().data('id')).val(listIds.join(","));
+            return false;
+        });
+        $listMenu.find('.no-select.item').click(function () {
+            if (hasLabelUpdateAction || selector == 'select-assignees-modify') {
+                updateIssuesMeta(
+                    $listMenu.data('update-url'),
+                    "clear",
+                    $listMenu.data('issue-id'),
+                    ""
+                ).then(reload);
+            }
+
+            $(this).parent().find('.item').each(function () {
+                $(this).removeClass('checked');
+                $(this).find('.octicon').removeClass('octicon-check');
+            });
+
+            $list.find('.item').each(function () {
+                $(this).addClass('hide');
+            });
+            $noSelect.removeClass('hide');
+            $($(this).parent().data('id')).val('');
+
+        });
+    }
+
+    // Init labels and assignees
+    initListSubmits('select-label', 'labels');
+    initListSubmits('select-assignees', 'assignees');
+    initListSubmits('select-assignees-modify', 'assignees');
+
+    function selectItem(select_id, input_id) {
+        const $menu = $(select_id + ' .menu');
+        const $list = $('.ui' + select_id + '.list');
+        const hasUpdateAction = $menu.data('action') == 'update';
+
+        $menu.find('.item:not(.no-select)').click(function () {
+            $(this).parent().find('.item').each(function () {
+                $(this).removeClass('selected active')
+            });
+
+            $(this).addClass('selected active');
+            if (hasUpdateAction) {
+                updateIssuesMeta(
+                    $menu.data('update-url'),
+                    "",
+                    $menu.data('issue-id'),
+                    $(this).data('id')
+                ).then(reload);
+            }
+            switch (input_id) {
+                case '#milestone_id':
+                    $list.find('.selected').html('<a class="item" href=' + $(this).data('href') + '>' +
+                        htmlEncode($(this).text()) + '</a>');
+                    break;
+                case '#assignee_id':
+                    $list.find('.selected').html('<a class="item" href=' + $(this).data('href') + '>' +
+                        '<img class="ui avatar image" src=' + $(this).data('avatar') + '>' +
+                        htmlEncode($(this).text()) + '</a>');
+            }
+            $('.ui' + select_id + '.list .no-select').addClass('hide');
+            $(input_id).val($(this).data('id'));
+        });
+        $menu.find('.no-select.item').click(function () {
+            $(this).parent().find('.item:not(.no-select)').each(function () {
+                $(this).removeClass('selected active')
+            });
+
+            if (hasUpdateAction) {
+                updateIssuesMeta(
+                    $menu.data('update-url'),
+                    "",
+                    $menu.data('issue-id'),
+                    $(this).data('id')
+                ).then(reload);
+            }
+
+            $list.find('.selected').html('');
+            $list.find('.no-select').removeClass('hide');
+            $(input_id).val('');
+        });
+    }
+
+    // Milestone and assignee
+    selectItem('.select-milestone', '#milestone_id');
+    selectItem('.select-assignee', '#assignee_id');
+}
+
+function initInstall() {
+    if ($('.install').length == 0) {
+        return;
+    }
+
+    if ($('#db_host').val()=="") {
+        $('#db_host').val("127.0.0.1:3306");
+        $('#db_user').val("gitea");
+        $('#db_name').val("gitea");
+    }
+
+    // Database type change detection.
+    $("#db_type").change(function () {
+        const sqliteDefault = 'data/gitea.db';
+        const tidbDefault = 'data/gitea_tidb';
+
+        const dbType = $(this).val();
+        if (dbType === "SQLite3") {
+            $('#sql_settings').hide();
+            $('#pgsql_settings').hide();
+            $('#mysql_settings').hide();
+            $('#sqlite_settings').show();
+
+            if (dbType === "SQLite3" && $('#db_path').val() == tidbDefault) {
+                $('#db_path').val(sqliteDefault);
+            }
+            return;
+        }
+
+        const dbDefaults = {
+            "MySQL": "127.0.0.1:3306",
+            "PostgreSQL": "127.0.0.1:5432",
+            "MSSQL": "127.0.0.1:1433"
+        };
+
+        $('#sqlite_settings').hide();
+        $('#sql_settings').show();
+
+        $('#pgsql_settings').toggle(dbType === "PostgreSQL");
+        $('#mysql_settings').toggle(dbType === "MySQL");
+        $.each(dbDefaults, function(_type, defaultHost) {
+            if ($('#db_host').val() == defaultHost) {
+                $('#db_host').val(dbDefaults[dbType]);
+                return false;
+            }
+        });
+    });
+
+    // TODO: better handling of exclusive relations.
+    $('#offline-mode input').change(function () {
+        if ($(this).is(':checked')) {
+            $('#disable-gravatar').checkbox('check');
+            $('#federated-avatar-lookup').checkbox('uncheck');
+        }
+    });
+    $('#disable-gravatar input').change(function () {
+        if ($(this).is(':checked')) {
+            $('#federated-avatar-lookup').checkbox('uncheck');
+        } else {
+            $('#offline-mode').checkbox('uncheck');
+        }
+    });
+    $('#federated-avatar-lookup input').change(function () {
+        if ($(this).is(':checked')) {
+            $('#disable-gravatar').checkbox('uncheck');
+            $('#offline-mode').checkbox('uncheck');
+        }
+    });
+    $('#enable-openid-signin input').change(function () {
+        if ($(this).is(':checked')) {
+            if (!$('#disable-registration input').is(':checked')) {
+                $('#enable-openid-signup').checkbox('check');
+            }
+        } else {
+            $('#enable-openid-signup').checkbox('uncheck');
+        }
+    });
+    $('#disable-registration input').change(function () {
+        if ($(this).is(':checked')) {
+            $('#enable-captcha').checkbox('uncheck');
+            $('#enable-openid-signup').checkbox('uncheck');
+        } else {
+            $('#enable-openid-signup').checkbox('check');
+        }
+    });
+    $('#enable-captcha input').change(function () {
+        if ($(this).is(':checked')) {
+            $('#disable-registration').checkbox('uncheck');
+        }
+    });
+}
+
+function initRepository() {
+    if ($('.repository').length == 0) {
+        return;
+    }
+
+    function initFilterSearchDropdown(selector) {
+        const $dropdown = $(selector);
+        $dropdown.dropdown({
+            fullTextSearch: true,
+            selectOnKeydown: false,
+            onChange: function (_text, _value, $choice) {
+                if ($choice.data('url')) {
+                    window.location.href = $choice.data('url');
+                }
+            },
+            message: {noResults: $dropdown.data('no-results')}
+        });
+    }
+
+    // File list and commits
+    if ($('.repository.file.list').length > 0 ||
+        ('.repository.commits').length > 0) {
+        initFilterBranchTagDropdown('.choose.reference .dropdown');
+    }
+
+    // Wiki
+    if ($('.repository.wiki.view').length > 0) {
+        initFilterSearchDropdown('.choose.page .dropdown');
+    }
+
+    // Options
+    if ($('.repository.settings.options').length > 0) {
+        $('#repo_name').keyup(function () {
+            const $prompt = $('#repo-name-change-prompt');
+            if ($(this).val().toString().toLowerCase() != $(this).data('name').toString().toLowerCase()) {
+                $prompt.show();
+            } else {
+                $prompt.hide();
+            }
+        });
+
+        // Enable or select internal/external wiki system and issue tracker.
+        $('.enable-system').change(function () {
+            if (this.checked) {
+                $($(this).data('target')).removeClass('disabled');
+                if (!$(this).data('context')) $($(this).data('context')).addClass('disabled');
+            } else {
+                $($(this).data('target')).addClass('disabled');
+                if (!$(this).data('context')) $($(this).data('context')).removeClass('disabled');
+            }
+        });
+        $('.enable-system-radio').change(function () {
+            if (this.value == 'false') {
+                $($(this).data('target')).addClass('disabled');
+                if (typeof $(this).data('context') !== 'undefined') $($(this).data('context')).removeClass('disabled');
+            } else if (this.value == 'true') {
+                $($(this).data('target')).removeClass('disabled');
+                if (typeof $(this).data('context') !== 'undefined')  $($(this).data('context')).addClass('disabled');
+            }
+        });
+    }
+
+    // Labels
+    if ($('.repository.labels').length > 0) {
+        // Create label
+        const $newLabelPanel = $('.new-label.segment');
+        $('.new-label.button').click(function () {
+            $newLabelPanel.show();
+        });
+        $('.new-label.segment .cancel').click(function () {
+            $newLabelPanel.hide();
+        });
+
+        $('.color-picker').each(function () {
+            $(this).minicolors();
+        });
+        $('.precolors .color').click(function () {
+            const color_hex = $(this).data('color-hex');
+            $('.color-picker').val(color_hex);
+            $('.minicolors-swatch-color').css("background-color", color_hex);
+        });
+        $('.edit-label-button').click(function () {
+            $('#label-modal-id').val($(this).data('id'));
+            $('.edit-label .new-label-input').val($(this).data('title'));
+            $('.edit-label .new-label-desc-input').val($(this).data('description'));
+            $('.edit-label .color-picker').val($(this).data('color'));
+            $('.minicolors-swatch-color').css("background-color", $(this).data('color'));
+            $('.edit-label.modal').modal({
+                onApprove: function () {
+                    $('.edit-label.form').submit();
+                }
+            }).modal('show');
+            return false;
+        });
+    }
+
+    // Milestones
+    if ($('.repository.new.milestone').length > 0) {
+        const $datepicker = $('.milestone.datepicker');
+        $datepicker.datetimepicker({
+            lang: $datepicker.data('lang'),
+            inline: true,
+            timepicker: false,
+            startDate: $datepicker.data('start-date'),
+            formatDate: 'Y-m-d',
+            onSelectDate: function (ct) {
+                $('#deadline').val(ct.dateFormat('Y-m-d'));
+            }
+        });
+        $('#clear-date').click(function () {
+            $('#deadline').val('');
+            return false;
+        });
+    }
+
+    // Issues
+    if ($('.repository.view.issue').length > 0) {
+        // Edit issue title
+        const $issueTitle = $('#issue-title');
+        const $editInput = $('#edit-title-input input');
+        const editTitleToggle = function () {
+            $issueTitle.toggle();
+            $('.not-in-edit').toggle();
+            $('#edit-title-input').toggle();
+            $('.in-edit').toggle();
+            $editInput.focus();
+            return false;
+        };
+        $('#edit-title').click(editTitleToggle);
+        $('#cancel-edit-title').click(editTitleToggle);
+        $('#save-edit-title').click(editTitleToggle).click(function () {
+            if ($editInput.val().length == 0 ||
+                $editInput.val() == $issueTitle.text()) {
+                $editInput.val($issueTitle.text());
+                return false;
+            }
+
+            $.post($(this).data('update-url'), {
+                    "_csrf": csrf,
+                    "title": $editInput.val()
+                },
+                function (data) {
+                    $editInput.val(data.title);
+                    $issueTitle.text(data.title);
+                    reload();
+                });
+            return false;
+        });
+
+        // Edit issue or comment content
+        $('.edit-content').click(function () {
+            const $segment = $(this).parent().parent().parent().next();
+            const $editContentZone = $segment.find('.edit-content-zone');
+            const $renderContent = $segment.find('.render-content');
+            const $rawContent = $segment.find('.raw-content');
+            let $textarea;
+
+            // Setup new form
+            if ($editContentZone.html().length == 0) {
+                $editContentZone.html($('#edit-content-form').html());
+                $textarea = $editContentZone.find('textarea');
+                issuesTribute.attach($textarea.get());
+                emojiTribute.attach($textarea.get());
+
+                const $dropzone = $editContentZone.find('.dropzone');
+                $dropzone.data("saved", false);
+                const $files = $editContentZone.find('.comment-files');
+                if ($dropzone.length > 0) {
+                    const filenameDict = {};
+                    $dropzone.dropzone({
+                        url: $dropzone.data('upload-url'),
+                        headers: {"X-Csrf-Token": csrf},
+                        maxFiles: $dropzone.data('max-file'),
+                        maxFilesize: $dropzone.data('max-size'),
+                        acceptedFiles: ($dropzone.data('accepts') === '*/*') ? null : $dropzone.data('accepts'),
+                        addRemoveLinks: true,
+                        dictDefaultMessage: $dropzone.data('default-message'),
+                        dictInvalidFileType: $dropzone.data('invalid-input-type'),
+                        dictFileTooBig: $dropzone.data('file-too-big'),
+                        dictRemoveFile: $dropzone.data('remove-file'),
+                        init: function () {
+                            this.on("success", function (file, data) {
+                                filenameDict[file.name] = {
+                                    "uuid": data.uuid,
+                                    "submitted": false
+                                }
+                                const input = $('<input id="' + data.uuid + '" name="files" type="hidden">').val(data.uuid);
+                                $files.append(input);
+                            });
+                            this.on("removedfile", function (file) {
+                                if (!(file.name in filenameDict)) {
+                                    return;
+                                }
+                                $('#' + filenameDict[file.name].uuid).remove();
+                                if ($dropzone.data('remove-url') && $dropzone.data('csrf') && !filenameDict[file.name].submitted) {
+                                    $.post($dropzone.data('remove-url'), {
+                                        file: filenameDict[file.name].uuid,
+                                        _csrf: $dropzone.data('csrf')
+                                    });
+                                }
+                            });
+                            this.on("submit", function () {
+                                $.each(filenameDict, function(name){
+                                    filenameDict[name].submitted = true;
+                                });
+                            });
+                            this.on("reload", function (){
+                                $.getJSON($editContentZone.data('attachment-url'), function(data){
+                                    const drop = $dropzone.get(0).dropzone;
+                                    drop.removeAllFiles(true);
+                                    $files.empty();
+                                    $.each(data, function(){
+                                        const imgSrc =  $dropzone.data('upload-url') + "/" + this.uuid;
+                                        drop.emit("addedfile", this);
+                                        drop.emit("thumbnail", this, imgSrc);
+                                        drop.emit("complete", this);
+                                        drop.files.push(this);
+                                        filenameDict[this.name] = {
+                                            "submitted": true,
+                                            "uuid": this.uuid
+                                        }
+                                        $dropzone.find("img[src='" + imgSrc + "']").css("max-width", "100%");
+                                        const input = $('<input id="' + this.uuid + '" name="files" type="hidden">').val(this.uuid);
+                                        $files.append(input);
+                                    });
+                                });
+                            });
+                        }
+                    });
+                    $dropzone.get(0).dropzone.emit("reload");
+                }
+                // Give new write/preview data-tab name to distinguish from others
+                const $editContentForm = $editContentZone.find('.ui.comment.form');
+                const $tabMenu = $editContentForm.find('.tabular.menu');
+                $tabMenu.attr('data-write', $editContentZone.data('write'));
+                $tabMenu.attr('data-preview', $editContentZone.data('preview'));
+                $tabMenu.find('.write.item').attr('data-tab', $editContentZone.data('write'));
+                $tabMenu.find('.preview.item').attr('data-tab', $editContentZone.data('preview'));
+                $editContentForm.find('.write.segment').attr('data-tab', $editContentZone.data('write'));
+                $editContentForm.find('.preview.segment').attr('data-tab', $editContentZone.data('preview'));
+
+                initCommentPreviewTab($editContentForm);
+
+                $editContentZone.find('.cancel.button').click(function () {
+                    $renderContent.show();
+                    $editContentZone.hide();
+                    $dropzone.get(0).dropzone.emit("reload");
+                });
+                $editContentZone.find('.save.button').click(function () {
+                    $renderContent.show();
+                    $editContentZone.hide();
+                    const $attachments = $files.find("[name=files]").map(function(){
+                        return $(this).val();
+                    }).get();
+                    $.post($editContentZone.data('update-url'), {
+                        "_csrf": csrf,
+                        "content": $textarea.val(),
+                        "context": $editContentZone.data('context'),
+                        "files": $attachments
+                    },
+                    function (data) {
+                        if (data.length == 0) {
+                            $renderContent.html($('#no-content').html());
+                        } else {
+                            $renderContent.html(data.content);
+                            emojify.run($renderContent[0]);
+                            $('pre code', $renderContent[0]).each(function () {
+                                hljs.highlightBlock(this);
+                            });
+                        }
+                        const $content = $segment.parent();
+                        if(!$content.find(".ui.small.images").length){
+                            if(data.attachments != ""){
+                                $content.append(
+                                '<div class="ui bottom attached segment">' +
+                                '    <div class="ui small images">' +
+                                '    </div>' +
+                                '</div>'
+                                );
+                                $content.find(".ui.small.images").html(data.attachments);
+                            }
+                        } else if (data.attachments == "") {
+                            $content.find(".ui.small.images").parent().remove();
+                        } else {
+                            $content.find(".ui.small.images").html(data.attachments);
+                        }
+                        $dropzone.get(0).dropzone.emit("submit");
+                        $dropzone.get(0).dropzone.emit("reload");
+                    });
+                });
+            } else {
+                $textarea = $segment.find('textarea');
+            }
+
+            // Show write/preview tab and copy raw content as needed
+            $editContentZone.show();
+            $renderContent.hide();
+            if ($textarea.val().length == 0) {
+                $textarea.val($rawContent.text());
+            }
+            $textarea.focus();
+            return false;
+        });
+
+        // Delete comment
+        $('.delete-comment').click(function () {
+            const $this = $(this);
+            if (confirm($this.data('locale'))) {
+                $.post($this.data('url'), {
+                    "_csrf": csrf
+                }).success(function () {
+                    $('#' + $this.data('comment-id')).remove();
+                });
+            }
+            return false;
+        });
+
+        // Change status
+        const $statusButton = $('#status-button');
+        $('#comment-form .edit_area').keyup(function () {
+            if ($(this).val().length == 0) {
+                $statusButton.text($statusButton.data('status'))
+            } else {
+                $statusButton.text($statusButton.data('status-and-comment'))
+            }
+        });
+        $statusButton.click(function () {
+            $('#status').val($statusButton.data('status-val'));
+            $('#comment-form').submit();
+        });
+
+        // Pull Request merge button
+        const $mergeButton = $('.merge-button > button');
+        $mergeButton.on('click', function(e) {
+            e.preventDefault();
+            $('.' + $(this).data('do') + '-fields').show();
+            $(this).parent().hide();
+        });
+        $('.merge-button > .dropdown').dropdown({
+            onChange: function (_text, _value, $choice) {
+                if ($choice.data('do')) {
+                    $mergeButton.find('.button-text').text($choice.text());
+                    $mergeButton.data('do', $choice.data('do'));
+                }
+            }
+        });
+        $('.merge-cancel').on('click', function(e) {
+            e.preventDefault();
+            $(this).closest('.form').hide();
+            $mergeButton.parent().show();
+        });
+
+        initReactionSelector();
+    }
+
+    // Diff
+    if ($('.repository.diff').length > 0) {
+        $('.diff-counter').each(function () {
+            const $item = $(this);
+            const addLine = $item.find('span[data-line].add').data("line");
+            const delLine = $item.find('span[data-line].del').data("line");
+            const addPercent = parseFloat(addLine) / (parseFloat(addLine) + parseFloat(delLine)) * 100;
+            $item.find(".bar .add").css("width", addPercent + "%");
+        });
+    }
+
+    // Quick start and repository home
+    $('#repo-clone-ssh').click(function () {
+        $('.clone-url').text($(this).data('link'));
+        $('#repo-clone-url').val($(this).data('link'));
+        $(this).addClass('blue');
+        $('#repo-clone-https').removeClass('blue');
+        localStorage.setItem('repo-clone-protocol', 'ssh');
+    });
+    $('#repo-clone-https').click(function () {
+        $('.clone-url').text($(this).data('link'));
+        $('#repo-clone-url').val($(this).data('link'));
+        $(this).addClass('blue');
+        $('#repo-clone-ssh').removeClass('blue');
+        localStorage.setItem('repo-clone-protocol', 'https');
+    });
+    $('#repo-clone-url').click(function () {
+        $(this).select();
+    });
+
+    // Pull request
+    const $repoComparePull = $('.repository.compare.pull');
+    if ($repoComparePull.length > 0) {
+        initFilterSearchDropdown('.choose.branch .dropdown');
+        // show pull request form
+        $repoComparePull.find('button.show-form').on('click', function(e) {
+            e.preventDefault();
+            $repoComparePull.find('.pullrequest-form').show();
+            $(this).parent().hide();
+        });
+    }
+
+    // Branches
+    if ($('.repository.settings.branches').length > 0) {
+        initFilterSearchDropdown('.protected-branches .dropdown');
+        $('.enable-protection, .enable-whitelist').change(function () {
+            if (this.checked) {
+                $($(this).data('target')).removeClass('disabled');
+            } else {
+                $($(this).data('target')).addClass('disabled');
+            }
+        });
+    }
+}
+
+function initMigration() {
+    const toggleMigrations = function() {
+        const authUserName = $('#auth_username').val();
+        const cloneAddr = $('#clone_addr').val();
+        if (!$('#mirror').is(":checked") && (authUserName!=undefined && authUserName.length > 0)
+        && (cloneAddr!=undefined && (cloneAddr.startsWith("https://github.com") || cloneAddr.startsWith("http://github.com")))) {
+            $('#migrate_items').show();
+        } else {
+            $('#migrate_items').hide();
+        }
+    }
+
+    toggleMigrations();
+
+    $('#clone_addr').on('input', toggleMigrations)
+    $('#auth_username').on('input', toggleMigrations)
+    $('#mirror').on('change', toggleMigrations)
+}
+
+function initPullRequestReview() {
+    $('.show-outdated').on('click', function (e) {
+        e.preventDefault();
+        const id = $(this).data('comment');
+        $(this).addClass("hide");
+        $("#code-comments-" + id).removeClass('hide');
+        $("#code-preview-" + id).removeClass('hide');
+        $("#hide-outdated-" + id).removeClass('hide');
+    });
+
+    $('.hide-outdated').on('click', function (e) {
+        e.preventDefault();
+        const id = $(this).data('comment');
+        $(this).addClass("hide");
+        $("#code-comments-" + id).addClass('hide');
+        $("#code-preview-" + id).addClass('hide');
+        $("#show-outdated-" + id).removeClass('hide');
+    });
+
+    $('button.comment-form-reply').on('click', function (e) {
+        e.preventDefault();
+        $(this).hide();
+        const form = $(this).parent().find('.comment-form')
+        form.removeClass('hide');
+        assingMenuAttributes(form.find('.menu'));
+    });
+    // The following part is only for diff views
+    if ($('.repository.pull.diff').length == 0) {
+        return;
+    }
+
+    $('.diff-detail-box.ui.sticky').sticky();
+
+    $('.btn-review').on('click', function(e) {
+        e.preventDefault();
+        $(this).closest('.dropdown').find('.menu').toggle('visible');
+    }).closest('.dropdown').find('.link.close').on('click', function(e) {
+        e.preventDefault();
+        $(this).closest('.menu').toggle('visible');
+    });
+
+    $('.code-view .lines-code,.code-view .lines-num')
+        .on('mouseenter', function() {
+            const parent = $(this).closest('td');
+            $(this).closest('tr').addClass(
+                parent.hasClass('lines-num-old') || parent.hasClass('lines-code-old')
+                    ? 'focus-lines-old' : 'focus-lines-new'
+            );
+        })
+        .on('mouseleave', function() {
+            $(this).closest('tr').removeClass('focus-lines-new focus-lines-old');
+        });
+    $('.add-code-comment').on('click', function(e) {
+        // https://github.com/go-gitea/gitea/issues/4745
+        if ($(e.target).hasClass('btn-add-single')) {
+          return;
+        }
+        e.preventDefault();
+        const isSplit = $(this).closest('.code-diff').hasClass('code-diff-split');
+        const side = $(this).data('side');
+        const idx = $(this).data('idx');
+        const path = $(this).data('path');
+        const form = $('#pull_review_add_comment').html();
+        const tr = $(this).closest('tr');
+        let ntr = tr.next();
+        if (!ntr.hasClass('add-comment')) {
+            ntr = $('<tr class="add-comment">'
+                    + (isSplit ? '<td class="lines-num"></td><td class="lines-type-marker"></td><td class="add-comment-left"></td><td class="lines-num"></td><td class="lines-type-marker"></td><td class="add-comment-right"></td>'
+                               : '<td class="lines-num"></td><td class="lines-num"></td><td class="lines-type-marker"></td><td class="add-comment-left add-comment-right"></td>')
+                    + '</tr>');
+            tr.after(ntr);
+        }
+        const td = ntr.find('.add-comment-' + side);
+        let commentCloud = td.find('.comment-code-cloud');
+        if (commentCloud.length === 0) {
+            td.html(form);
+            commentCloud = td.find('.comment-code-cloud');
+            assingMenuAttributes(commentCloud.find('.menu'));
+
+            td.find("input[name='line']").val(idx);
+            td.find("input[name='side']").val(side === "left" ? "previous":"proposed");
+            td.find("input[name='path']").val(path);
+        }
+        commentCloud.find('textarea').focus();
+    });
+}
+
+function assingMenuAttributes(menu) {
+    const id = Math.floor(Math.random() * Math.floor(1000000));
+    menu.attr('data-write', menu.attr('data-write') + id);
+    menu.attr('data-preview', menu.attr('data-preview') + id);
+    menu.find('.item').each(function() {
+        const tab = $(this).attr('data-tab') + id;
+        $(this).attr('data-tab', tab);
+    });
+    menu.parent().find("*[data-tab='write']").attr('data-tab', 'write' + id);
+    menu.parent().find("*[data-tab='preview']").attr('data-tab', 'preview' + id);
+    initCommentPreviewTab(menu.parent(".form"));
+    return id;
+}
+
+function initRepositoryCollaboration() {
+    // Change collaborator access mode
+    $('.access-mode.menu .item').click(function () {
+        const $menu = $(this).parent();
+        $.post($menu.data('url'), {
+            "_csrf": csrf,
+            "uid": $menu.data('uid'),
+            "mode": $(this).data('value')
+        })
+    });
+}
+
+function initTeamSettings() {
+    // Change team access mode
+    $('.organization.new.team input[name=permission]').change(function () {
+        const val = $('input[name=permission]:checked', '.organization.new.team').val()
+        if (val === 'admin') {
+            $('.organization.new.team .team-units').hide();
+        } else {
+            $('.organization.new.team .team-units').show();
+        }
+    });
+}
+
+function initWikiForm() {
+    const $editArea = $('.repository.wiki textarea#edit_area');
+    if ($editArea.length > 0) {
+        const simplemde = new SimpleMDE({
+            autoDownloadFontAwesome: false,
+            element: $editArea[0],
+            forceSync: true,
+            previewRender: function (plainText, preview) { // Async method
+                setTimeout(function () {
+                    // FIXME: still send render request when return back to edit mode
+                    $.post($editArea.data('url'), {
+                            "_csrf": csrf,
+                            "mode": "gfm",
+                            "context": $editArea.data('context'),
+                            "text": plainText
+                        },
+                        function (data) {
+                            preview.innerHTML = '<div class="markdown ui segment">' + data + '</div>';
+                            emojify.run($('.editor-preview')[0]);
+                        }
+                    );
+                }, 0);
+
+                return "Loading...";
+            },
+            renderingConfig: {
+                singleLineBreaks: false
+            },
+            indentWithTabs: false,
+            tabSize: 4,
+            spellChecker: false,
+            toolbar: ["bold", "italic", "strikethrough", "|",
+                "heading-1", "heading-2", "heading-3", "heading-bigger", "heading-smaller", "|",
+                {
+                    name: "code-inline",
+                    action: function(e){
+                        const cm = e.codemirror;
+                        const selection = cm.getSelection();
+                        cm.replaceSelection("`" + selection + "`");
+                        if (!selection) {
+                            const cursorPos = cm.getCursor();
+                            cm.setCursor(cursorPos.line, cursorPos.ch - 1);
+                        }
+                        cm.focus();
+                    },
+                    className: "fa fa-angle-right",
+                    title: "Add Inline Code",
+                },"code", "quote", "|", {
+                    name: "checkbox-empty",
+                    action: function(e){
+                        const cm = e.codemirror;
+                        cm.replaceSelection("\n- [ ] " + cm.getSelection());
+                        cm.focus();
+                    },
+                    className: "fa fa-square-o",
+                    title: "Add Checkbox (empty)",
+                },
+                {
+                    name: "checkbox-checked",
+                    action: function(e){
+                        const cm = e.codemirror;
+                        cm.replaceSelection("\n- [x] " + cm.getSelection());
+                        cm.focus();
+                    },
+                    className: "fa fa-check-square-o",
+                    title: "Add Checkbox (checked)",
+                }, "|",
+                "unordered-list", "ordered-list", "|",
+                "link", "image", "table", "horizontal-rule", "|",
+                "clean-block", "preview", "fullscreen"]
+        })
+        $(simplemde.codemirror.getInputField()).addClass("js-quick-submit");
+    }
+}
+
+// For IE
+String.prototype.endsWith = function (pattern) {
+    const d = this.length - pattern.length;
+    return d >= 0 && this.lastIndexOf(pattern) === d;
+};
+
+// Adding function to get the cursor position in a text field to jQuery object.
+$.fn.getCursorPosition = function () {
+    const el = $(this).get(0);
+    let pos = 0;
+    if ('selectionStart' in el) {
+        pos = el.selectionStart;
+    } else if ('selection' in document) {
+        el.focus();
+        const Sel = document.selection.createRange();
+        const SelLength = document.selection.createRange().text.length;
+        Sel.moveStart('character', -el.value.length);
+        pos = Sel.text.length - SelLength;
+    }
+    return pos;
+}
+
+function setSimpleMDE($editArea) {
+    if (codeMirrorEditor) {
+        codeMirrorEditor.toTextArea();
+        codeMirrorEditor = null;
+    }
+
+    if (simpleMDEditor) {
+        return true;
+    }
+
+    simpleMDEditor = new SimpleMDE({
+        autoDownloadFontAwesome: false,
+        element: $editArea[0],
+        forceSync: true,
+        renderingConfig: {
+            singleLineBreaks: false
+        },
+        indentWithTabs: false,
+        tabSize: 4,
+        spellChecker: false,
+        previewRender: function (plainText, preview) { // Async method
+            setTimeout(function () {
+                // FIXME: still send render request when return back to edit mode
+                $.post($editArea.data('url'), {
+                        "_csrf": csrf,
+                        "mode": "gfm",
+                        "context": $editArea.data('context'),
+                        "text": plainText
+                    },
+                    function (data) {
+                        preview.innerHTML = '<div class="markdown ui segment">' + data + '</div>';
+                        emojify.run($('.editor-preview')[0]);
+                    }
+                );
+            }, 0);
+
+            return "Loading...";
+        },
+        toolbar: ["bold", "italic", "strikethrough", "|",
+            "heading-1", "heading-2", "heading-3", "heading-bigger", "heading-smaller", "|",
+            "code", "quote", "|",
+            "unordered-list", "ordered-list", "|",
+            "link", "image", "table", "horizontal-rule", "|",
+            "clean-block", "preview", "fullscreen", "side-by-side"]
+    });
+
+    return true;
+}
+
+function setCodeMirror($editArea) {
+    if (simpleMDEditor) {
+        simpleMDEditor.toTextArea();
+        simpleMDEditor = null;
+    }
+
+    if (codeMirrorEditor) {
+        return true;
+    }
+
+    codeMirrorEditor = CodeMirror.fromTextArea($editArea[0], {
+        lineNumbers: true
+    });
+    codeMirrorEditor.on("change", function (cm, _change) {
+        $editArea.val(cm.getValue());
+    });
+
+    return true;
+}
+
+function initEditor() {
+    $('.js-quick-pull-choice-option').change(function () {
+        if ($(this).val() == 'commit-to-new-branch') {
+            $('.quick-pull-branch-name').show();
+            $('.quick-pull-branch-name input').prop('required',true);
+        } else {
+            $('.quick-pull-branch-name').hide();
+            $('.quick-pull-branch-name input').prop('required',false);
+        }
+        $('#commit-button').text($(this).attr('button_text'));
+    });
+
+    const $editFilename = $("#file-name");
+    $editFilename.keyup(function (e) {
+        const $section = $('.breadcrumb span.section');
+        const $divider = $('.breadcrumb div.divider');
+        let value;
+        let parts;
+
+        if (e.keyCode == 8) {
+            if ($(this).getCursorPosition() == 0) {
+                if ($section.length > 0) {
+                    value = $section.last().find('a').text();
+                    $(this).val(value + $(this).val());
+                    $(this)[0].setSelectionRange(value.length, value.length);
+                    $section.last().remove();
+                    $divider.last().remove();
+                }
+            }
+        }
+        if (e.keyCode == 191) {
+            parts = $(this).val().split('/');
+            for (let i = 0; i < parts.length; ++i) {
+                value = parts[i];
+                if (i < parts.length - 1) {
+                    if (value.length) {
+                        $('<span class="section"><a href="#">' + value + '</a></span>').insertBefore($(this));
+                        $('<div class="divider"> / </div>').insertBefore($(this));
+                    }
+                }
+                else {
+                    $(this).val(value);
+                }
+                $(this)[0].setSelectionRange(0, 0);
+            }
+        }
+        parts = [];
+        $('.breadcrumb span.section').each(function () {
+            const element = $(this);
+            if (element.find('a').length) {
+                parts.push(element.find('a').text());
+            } else {
+                parts.push(element.text());
+            }
+        });
+        if ($(this).val())
+            parts.push($(this).val());
+        $('#tree_path').val(parts.join('/'));
+    }).trigger('keyup');
+
+    const $editArea = $('.repository.editor textarea#edit_area');
+    if (!$editArea.length)
+        return;
+
+    const markdownFileExts = $editArea.data("markdown-file-exts").split(",");
+    const lineWrapExtensions = $editArea.data("line-wrap-extensions").split(",");
+
+    $editFilename.on("keyup", function () {
+        const val = $editFilename.val();
+        let mode, spec, extension, extWithDot, dataUrl, apiCall;
+
+        extension = extWithDot = "";
+        const m = /.+\.([^.]+)$/.exec(val);
+        if (m) {
+            extension = m[1];
+            extWithDot = "." + extension;
+        }
+
+        const info = CodeMirror.findModeByExtension(extension);
+        const previewLink = $('a[data-tab=preview]');
+        if (info) {
+            mode = info.mode;
+            spec = info.mime;
+            apiCall = mode;
+        }
+        else {
+            apiCall = extension
+        }
+
+        if (previewLink.length && apiCall && previewFileModes && previewFileModes.length && previewFileModes.indexOf(apiCall) >= 0) {
+            dataUrl = previewLink.data('url');
+            previewLink.data('url', dataUrl.replace(/(.*)\/.*/i, '$1/' + mode));
+            previewLink.show();
+        }
+        else {
+            previewLink.hide();
+        }
+
+        // If this file is a Markdown extensions, we will load that editor and return
+        if (markdownFileExts.indexOf(extWithDot) >= 0) {
+            if (setSimpleMDE($editArea)) {
+                return;
+            }
+        }
+
+        // Else we are going to use CodeMirror
+        if (!codeMirrorEditor && !setCodeMirror($editArea)) {
+            return;
+        }
+
+        if (mode) {
+            codeMirrorEditor.setOption("mode", spec);
+            CodeMirror.autoLoadMode(codeMirrorEditor, mode);
+        }
+
+        if (lineWrapExtensions.indexOf(extWithDot) >= 0) {
+            codeMirrorEditor.setOption("lineWrapping", true);
+        }
+        else {
+            codeMirrorEditor.setOption("lineWrapping", false);
+        }
+
+        // get the filename without any folder
+        let value = $editFilename.val();
+        if (value.length === 0) {
+            return;
+        }
+        value = value.split('/');
+        value = value[value.length - 1];
+
+        $.getJSON($editFilename.data('ec-url-prefix')+value, function(editorconfig) {
+            if (editorconfig.indent_style === 'tab') {
+                codeMirrorEditor.setOption("indentWithTabs", true);
+                codeMirrorEditor.setOption('extraKeys', {});
+            } else {
+                codeMirrorEditor.setOption("indentWithTabs", false);
+                // required because CodeMirror doesn't seems to use spaces correctly for {"indentWithTabs": false}:
+                // - https://github.com/codemirror/CodeMirror/issues/988
+                // - https://codemirror.net/doc/manual.html#keymaps
+                codeMirrorEditor.setOption('extraKeys', {
+                    Tab: function(cm) {
+                        const spaces = Array(parseInt(cm.getOption("indentUnit")) + 1).join(" ");
+                        cm.replaceSelection(spaces);
+                    }
+                });
+            }
+            codeMirrorEditor.setOption("indentUnit", editorconfig.indent_size || 4);
+            codeMirrorEditor.setOption("tabSize", editorconfig.tab_width || 4);
+        });
+    }).trigger('keyup');
+
+    // Using events from https://github.com/codedance/jquery.AreYouSure#advanced-usage
+    // to enable or disable the commit button
+    const $commitButton = $('#commit-button');
+    const $editForm = $('.ui.edit.form');
+    const dirtyFileClass = 'dirty-file';
+
+    // Disabling the button at the start
+    $commitButton.prop('disabled', true);
+
+    // Registering a custom listener for the file path and the file content
+    $editForm.areYouSure({
+        silent: true,
+        dirtyClass: dirtyFileClass,
+        fieldSelector: ':input:not(.commit-form-wrapper :input)',
+        change: function () {
+            const dirty = $(this).hasClass(dirtyFileClass);
+            $commitButton.prop('disabled', !dirty);
+        }
+    });
+
+    $commitButton.click(function (event) {
+        // A modal which asks if an empty file should be committed
+        if ($editArea.val().length === 0) {
+            $('#edit-empty-content-modal').modal({
+                onApprove: function () {
+                    $('.edit.form').submit();
+                }
+            }).modal('show');
+            event.preventDefault();
+        }
+    });
+}
+
+function initOrganization() {
+    if ($('.organization').length == 0) {
+        return;
+    }
+
+    // Options
+    if ($('.organization.settings.options').length > 0) {
+        $('#org_name').keyup(function () {
+            const $prompt = $('#org-name-change-prompt');
+            if ($(this).val().toString().toLowerCase() != $(this).data('org-name').toString().toLowerCase()) {
+                $prompt.show();
+            } else {
+                $prompt.hide();
+            }
+        });
+    }
+}
+
+function initUserSettings() {
+    // Options
+    if ($('.user.settings.profile').length > 0) {
+        $('#username').keyup(function () {
+            const $prompt = $('#name-change-prompt');
+            if ($(this).val().toString().toLowerCase() != $(this).data('name').toString().toLowerCase()) {
+                $prompt.show();
+            } else {
+                $prompt.hide();
+            }
+        });
+    }
+}
+
+function initWebhook() {
+    if ($('.new.webhook').length == 0) {
+        return;
+    }
+
+    $('.events.checkbox input').change(function () {
+        if ($(this).is(':checked')) {
+            $('.events.fields').show();
+        }
+    });
+    $('.non-events.checkbox input').change(function () {
+        if ($(this).is(':checked')) {
+            $('.events.fields').hide();
+        }
+    });
+
+    const updateContentType = function () {
+        const visible = $('#http_method').val() === 'POST';
+        $('#content_type').parent().parent()[visible ? 'show' : 'hide']();
+    };
+    updateContentType();
+    $('#http_method').change(function () {
+        updateContentType();
+    });
+
+    // Test delivery
+    $('#test-delivery').click(function () {
+        const $this = $(this);
+        $this.addClass('loading disabled');
+        $.post($this.data('link'), {
+            "_csrf": csrf
+        }).done(
+            setTimeout(function () {
+                window.location.href = $this.data('redirect');
+            }, 5000)
+        )
+    });
+}
+
+function initAdmin() {
+    if ($('.admin').length == 0) {
+        return;
+    }
+
+    // New user
+    if ($('.admin.new.user').length > 0 ||
+        $('.admin.edit.user').length > 0) {
+        $('#login_type').change(function () {
+            if ($(this).val().substring(0, 1) == '0') {
+                $('#login_name').removeAttr('required');
+                $('.non-local').hide();
+                $('.local').show();
+                $('#user_name').focus();
+
+                if ($(this).data('password') == "required") {
+                    $('#password').attr('required', 'required');
+                }
+
+            } else {
+                $('#login_name').attr('required', 'required');
+                $('.non-local').show();
+                $('.local').hide();
+                $('#login_name').focus();
+
+                $('#password').removeAttr('required');
+            }
+        });
+    }
+
+    function onSecurityProtocolChange() {
+        if ($('#security_protocol').val() > 0) {
+            $('.has-tls').show();
+        } else {
+            $('.has-tls').hide();
+        }
+    }
+
+    function onUsePagedSearchChange() {
+        if ($('#use_paged_search').prop('checked')) {
+            $('.search-page-size').show()
+                .find('input').attr('required', 'required');
+        } else {
+            $('.search-page-size').hide()
+                .find('input').removeAttr('required');
+        }
+    }
+
+    function onOAuth2Change() {
+        $('.open_id_connect_auto_discovery_url, .oauth2_use_custom_url').hide();
+        $('.open_id_connect_auto_discovery_url input[required]').removeAttr('required');
+
+        const provider = $('#oauth2_provider').val();
+        switch (provider) {
+            case 'github':
+            case 'gitlab':
+            case 'gitea':
+                $('.oauth2_use_custom_url').show();
+                break;
+            case 'openidConnect':
+                $('.open_id_connect_auto_discovery_url input').attr('required', 'required');
+                $('.open_id_connect_auto_discovery_url').show();
+                break;
+        }
+        onOAuth2UseCustomURLChange();
+    }
+
+    function onOAuth2UseCustomURLChange() {
+        const provider = $('#oauth2_provider').val();
+        $('.oauth2_use_custom_url_field').hide();
+        $('.oauth2_use_custom_url_field input[required]').removeAttr('required');
+
+        if ($('#oauth2_use_custom_url').is(':checked')) {
+            if (!$('#oauth2_token_url').val()) {
+                $('#oauth2_token_url').val($('#' + provider + '_token_url').val());
+            }
+            if (!$('#oauth2_auth_url').val()) {
+                $('#oauth2_auth_url').val($('#' + provider + '_auth_url').val());
+            }
+            if (!$('#oauth2_profile_url').val()) {
+                $('#oauth2_profile_url').val($('#' + provider + '_profile_url').val());
+            }
+            if (!$('#oauth2_email_url').val()) {
+                $('#oauth2_email_url').val($('#' + provider + '_email_url').val());
+            }
+            switch (provider) {
+                case 'github':
+                    $('.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input, .oauth2_email_url input').attr('required', 'required');
+                    $('.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url, .oauth2_email_url').show();
+                    break;
+                case 'gitea':
+                case 'gitlab':
+                    $('.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input').attr('required', 'required');
+                    $('.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url').show();
+                    $('#oauth2_email_url').val('');
+                    break;
+            }
+        }
+    }
+
+    // New authentication
+    if ($('.admin.new.authentication').length > 0) {
+        $('#auth_type').change(function () {
+            $('.ldap, .dldap, .smtp, .pam, .oauth2, .has-tls .search-page-size').hide();
+
+            $('.ldap input[required], .binddnrequired input[required], .dldap input[required], .smtp input[required], .pam input[required], .oauth2 input[required], .has-tls input[required]').removeAttr('required');
+            $('.binddnrequired').removeClass("required");
+
+            const authType = $(this).val();
+            switch (authType) {
+                case '2':     // LDAP
+                    $('.ldap').show();
+                    $('.binddnrequired input, .ldap div.required:not(.dldap) input').attr('required', 'required');
+                    $('.binddnrequired').addClass("required");
+                    break;
+                case '3':     // SMTP
+                    $('.smtp').show();
+                    $('.has-tls').show();
+                    $('.smtp div.required input, .has-tls').attr('required', 'required');
+                    break;
+                case '4':     // PAM
+                    $('.pam').show();
+                    $('.pam input').attr('required', 'required');
+                    break;
+                case '5':     // LDAP
+                    $('.dldap').show();
+                    $('.dldap div.required:not(.ldap) input').attr('required', 'required');
+                    break;
+                case '6':     // OAuth2
+                    $('.oauth2').show();
+                    $('.oauth2 div.required:not(.oauth2_use_custom_url,.oauth2_use_custom_url_field,.open_id_connect_auto_discovery_url) input').attr('required', 'required');
+                    onOAuth2Change();
+                    break;
+            }
+            if (authType == '2' || authType == '5') {
+                onSecurityProtocolChange()
+            }
+            if (authType == '2') {
+                onUsePagedSearchChange();
+            }
+        });
+        $('#auth_type').change();
+        $('#security_protocol').change(onSecurityProtocolChange);
+        $('#use_paged_search').change(onUsePagedSearchChange);
+        $('#oauth2_provider').change(onOAuth2Change);
+        $('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange);
+    }
+    // Edit authentication
+    if ($('.admin.edit.authentication').length > 0) {
+        const authType = $('#auth_type').val();
+        if (authType == '2' || authType == '5') {
+            $('#security_protocol').change(onSecurityProtocolChange);
+            if (authType == '2') {
+                $('#use_paged_search').change(onUsePagedSearchChange);
+            }
+        } else if (authType == '6') {
+            $('#oauth2_provider').change(onOAuth2Change);
+            $('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange);
+            onOAuth2Change();
+        }
+    }
+
+    // Notice
+    if ($('.admin.notice')) {
+        const $detailModal = $('#detail-modal');
+
+        // Attach view detail modals
+        $('.view-detail').click(function () {
+            $detailModal.find('.content p').text($(this).data('content'));
+            $detailModal.modal('show');
+            return false;
+        });
+
+        // Select actions
+        const $checkboxes = $('.select.table .ui.checkbox');
+        $('.select.action').click(function () {
+            switch ($(this).data('action')) {
+                case 'select-all':
+                    $checkboxes.checkbox('check');
+                    break;
+                case 'deselect-all':
+                    $checkboxes.checkbox('uncheck');
+                    break;
+                case 'inverse':
+                    $checkboxes.checkbox('toggle');
+                    break;
+            }
+        });
+        $('#delete-selection').click(function () {
+            const $this = $(this);
+            $this.addClass("loading disabled");
+            const ids = [];
+            $checkboxes.each(function () {
+                if ($(this).checkbox('is checked')) {
+                    ids.push($(this).data('id'));
+                }
+            });
+            $.post($this.data('link'), {
+                "_csrf": csrf,
+                "ids": ids
+            }).done(function () {
+                window.location.href = $this.data('redirect');
+            });
+        });
+    }
+}
+
+function buttonsClickOnEnter() {
+    $('.ui.button').keypress(function (e) {
+        if (e.keyCode == 13 || e.keyCode == 32) // enter key or space bar
+            $(this).click();
+    });
+}
+
+function searchUsers() {
+    const $searchUserBox = $('#search-user-box');
+    $searchUserBox.search({
+        minCharacters: 2,
+        apiSettings: {
+            url: suburl + '/api/v1/users/search?q={query}',
+            onResponse: function(response) {
+                const items = [];
+                $.each(response.data, function (_i, item) {
+                    let title = item.login;
+                    if (item.full_name && item.full_name.length > 0) {
+                        title += ' (' + htmlEncode(item.full_name) + ')';
+                    }
+                    items.push({
+                        title: title,
+                        image: item.avatar_url
+                    })
+                });
+
+                return { results: items }
+            }
+        },
+        searchFields: ['login', 'full_name'],
+        showNoResults: false
+    });
+}
+
+function searchTeams() {
+    const $searchTeamBox = $('#search-team-box');
+    $searchTeamBox.search({
+        minCharacters: 2,
+        apiSettings: {
+            url: suburl + '/api/v1/orgs/' + $searchTeamBox.data('org') + '/teams/search?q={query}',
+            headers: {"X-Csrf-Token": csrf},
+            onResponse: function(response) {
+                const items = [];
+                $.each(response.data, function (_i, item) {
+                    const title = item.name + ' (' + item.permission + ' access)';
+                    items.push({
+                        title: title,
+                    })
+                });
+
+                return { results: items }
+            }
+        },
+        searchFields: ['name', 'description'],
+        showNoResults: false
+    });
+}
+
+function searchRepositories() {
+    const $searchRepoBox = $('#search-repo-box');
+    $searchRepoBox.search({
+        minCharacters: 2,
+        apiSettings: {
+            url: suburl + '/api/v1/repos/search?q={query}&uid=' + $searchRepoBox.data('uid'),
+            onResponse: function(response) {
+                const items = [];
+                $.each(response.data, function (_i, item) {
+                    items.push({
+                        title: item.full_name.split("/")[1],
+                        description: item.full_name
+                    })
+                });
+
+                return { results: items }
+            }
+        },
+        searchFields: ['full_name'],
+        showNoResults: false
+    });
+}
+
+function initCodeView() {
+    if ($('.code-view .linenums').length > 0) {
+        $(document).on('click', '.lines-num span', function (e) {
+            const $select = $(this);
+            const $list = $select.parent().siblings('.lines-code').find('ol.linenums > li');
+            selectRange($list, $list.filter('[rel=' + $select.attr('id') + ']'), (e.shiftKey ? $list.filter('.active').eq(0) : null));
+            deSelect();
+        });
+
+        $(window).on('hashchange', function () {
+            let m = window.location.hash.match(/^#(L\d+)-(L\d+)$/);
+            const $list = $('.code-view ol.linenums > li');
+            let $first;
+            if (m) {
+                $first = $list.filter('.' + m[1]);
+                selectRange($list, $first, $list.filter('.' + m[2]));
+                $("html, body").scrollTop($first.offset().top - 200);
+                return;
+            }
+            m = window.location.hash.match(/^#(L|n)(\d+)$/);
+            if (m) {
+                $first = $list.filter('.L' + m[2]);
+                selectRange($list, $first);
+                $("html, body").scrollTop($first.offset().top - 200);
+            }
+        }).trigger('hashchange');
+    }
+}
+
+function initU2FAuth() {
+    if($('#wait-for-key').length === 0) {
+        return
+    }
+    u2fApi.ensureSupport()
+        .then(function () {
+            $.getJSON(suburl + '/user/u2f/challenge').success(function(req) {
+                u2fApi.sign(req.appId, req.challenge, req.registeredKeys, 30)
+                    .then(u2fSigned)
+                    .catch(function (err) {
+                        if(err === undefined) {
+                            u2fError(1);
+                            return
+                        }
+                        u2fError(err.metaData.code);
+                    });
+            });
+        }).catch(function () {
+            // Fallback in case browser do not support U2F
+            window.location.href = suburl + "/user/two_factor"
+        })
+}
+function u2fSigned(resp) {
+    $.ajax({
+        url: suburl + '/user/u2f/sign',
+        type: "POST",
+        headers: {"X-Csrf-Token": csrf},
+        data: JSON.stringify(resp),
+        contentType: "application/json; charset=utf-8",
+    }).done(function(res){
+        window.location.replace(res);
+    }).fail(function () {
+        u2fError(1);
+    });
+}
+
+function u2fRegistered(resp) {
+    if (checkError(resp)) {
+        return;
+    }
+    $.ajax({
+        url: suburl + '/user/settings/security/u2f/register',
+        type: "POST",
+        headers: {"X-Csrf-Token": csrf},
+        data: JSON.stringify(resp),
+        contentType: "application/json; charset=utf-8",
+        success: function(){
+            reload();
+        },
+        fail: function () {
+            u2fError(1);
+        }
+    });
+}
+
+function checkError(resp) {
+    if (!('errorCode' in resp)) {
+        return false;
+    }
+    if (resp.errorCode === 0) {
+        return false;
+    }
+    u2fError(resp.errorCode);
+    return true;
+}
+
+
+function u2fError(errorType) {
+    const u2fErrors = {
+        'browser': $('#unsupported-browser'),
+        1: $('#u2f-error-1'),
+        2: $('#u2f-error-2'),
+        3: $('#u2f-error-3'),
+        4: $('#u2f-error-4'),
+        5: $('.u2f-error-5')
+    };
+    u2fErrors[errorType].removeClass('hide');
+    for(const type in u2fErrors){
+        if(type != errorType){
+            u2fErrors[type].addClass('hide');
+        }
+    }
+    $('#u2f-error').modal('show');
+}
+
+function initU2FRegister() {
+    $('#register-device').modal({allowMultiple: false});
+    $('#u2f-error').modal({allowMultiple: false});
+    $('#register-security-key').on('click', function(e) {
+        e.preventDefault();
+        u2fApi.ensureSupport()
+            .then(u2fRegisterRequest)
+            .catch(function() {
+                u2fError('browser');
+            })
+    })
+}
+
+function u2fRegisterRequest() {
+    $.post(suburl + "/user/settings/security/u2f/request_register", {
+        "_csrf": csrf,
+        "name": $('#nickname').val()
+    }).success(function(req) {
+        $("#nickname").closest("div.field").removeClass("error");
+        $('#register-device').modal('show');
+        if(req.registeredKeys === null) {
+            req.registeredKeys = []
+        }
+        u2fApi.register(req.appId, req.registerRequests, req.registeredKeys, 30)
+            .then(u2fRegistered)
+            .catch(function (reason) {
+                if(reason === undefined) {
+                    u2fError(1);
+                    return
+                }
+                u2fError(reason.metaData.code);
+            });
+    }).fail(function(xhr) {
+        if(xhr.status === 409) {
+            $("#nickname").closest("div.field").addClass("error");
+        }
+    });
+}
+
+function initWipTitle() {
+    $(".title_wip_desc > a").click(function (e) {
+        e.preventDefault();
+
+        const $issueTitle = $("#issue_title");
+        $issueTitle.focus();
+        const value = $issueTitle.val().trim().toUpperCase();
+
+        for (const i in wipPrefixes) {
+            if (value.startsWith(wipPrefixes[i].toUpperCase())) {
+                return;
+            }
+        }
+
+        $issueTitle.val(wipPrefixes[0] + " " + $issueTitle.val());
+    });
+}
+
+function initTemplateSearch() {
+    const $repoTemplate = $("#repo_template");
+    const checkTemplate = function() {
+        const $templateUnits = $("#template_units");
+        const $nonTemplate = $("#non_template");
+        if ($repoTemplate.val() !== "") {
+            $templateUnits.show();
+            $nonTemplate.hide();
+        } else {
+            $templateUnits.hide();
+            $nonTemplate.show();
+        }
+    };
+    $repoTemplate.change(checkTemplate);
+    checkTemplate();
+
+    const changeOwner = function() {
+        $("#repo_template_search")
+            .dropdown({
+                apiSettings: {
+                    url: suburl + '/api/v1/repos/search?q={query}&template=true&priority_owner_id=' + $("#uid").val(),
+                    onResponse: function(response) {
+                        const filteredResponse = {'success': true, 'results': []};
+                        filteredResponse.results.push({
+                            'name': '',
+                            'value': ''
+                        });
+                        // Parse the response from the api to work with our dropdown
+                        $.each(response.data, function(_r, repo) {
+                            filteredResponse.results.push({
+                                'name'  : htmlEncode(repo.full_name) ,
+                                'value' : repo.id
+                            });
+                        });
+                        return filteredResponse;
+                    },
+                    cache: false,
+                },
+
+                fullTextSearch: true
+            });
+    };
+    $("#uid").change(changeOwner);
+    changeOwner();
+}
+
+$(document).ready(function () {
+    csrf = $('meta[name=_csrf]').attr("content");
+    suburl = $('meta[name=_suburl]').attr("content");
+
+    // Show exact time
+    $('.time-since').each(function () {
+        $(this).addClass('poping up').attr('data-content', $(this).attr('title')).attr('data-variation', 'inverted tiny').attr('title', '');
+    });
+
+    // Semantic UI modules.
+    $('.dropdown:not(.custom)').dropdown();
+    $('.jump.dropdown').dropdown({
+        action: 'hide',
+        onShow: function () {
+            $('.poping.up').popup('hide');
+        }
+    });
+    $('.slide.up.dropdown').dropdown({
+        transition: 'slide up'
+    });
+    $('.upward.dropdown').dropdown({
+        direction: 'upward'
+    });
+    $('.ui.accordion').accordion();
+    $('.ui.checkbox').checkbox();
+    $('.ui.progress').progress({
+        showActivity: false
+    });
+    $('.poping.up').popup();
+    $('.top.menu .poping.up').popup({
+        onShow: function () {
+            if ($('.top.menu .menu.transition').hasClass('visible')) {
+                return false;
+            }
+        }
+    });
+    $('.tabular.menu .item').tab();
+    $('.tabable.menu .item').tab();
+
+    $('.toggle.button').click(function () {
+        $($(this).data('target')).slideToggle(100);
+    });
+
+    // make table <tr> element clickable like a link
+    $('tr[data-href]').click(function() {
+        window.location = $(this).data('href');
+    });
+
+    // Highlight JS
+    if (typeof hljs != 'undefined') {
+        const nodes = [].slice.call(document.querySelectorAll('pre code') || []);
+        for (let i = 0; i < nodes.length; i++) {
+            hljs.highlightBlock(nodes[i]);
+        }
+    }
+
+    // Dropzone
+    const $dropzone = $('#dropzone');
+    if ($dropzone.length > 0) {
+        const filenameDict = {};
+
+        new Dropzone("#dropzone", {
+            url: $dropzone.data('upload-url'),
+            headers: {"X-Csrf-Token": csrf},
+            maxFiles: $dropzone.data('max-file'),
+            maxFilesize: $dropzone.data('max-size'),
+            acceptedFiles: ($dropzone.data('accepts') === '*/*') ? null : $dropzone.data('accepts'),
+            addRemoveLinks: true,
+            dictDefaultMessage: $dropzone.data('default-message'),
+            dictInvalidFileType: $dropzone.data('invalid-input-type'),
+            dictFileTooBig: $dropzone.data('file-too-big'),
+            dictRemoveFile: $dropzone.data('remove-file'),
+            init: function () {
+                this.on("success", function (file, data) {
+                    filenameDict[file.name] = data.uuid;
+                    const input = $('<input id="' + data.uuid + '" name="files" type="hidden">').val(data.uuid);
+                    $('.files').append(input);
+                });
+                this.on("removedfile", function (file) {
+                    if (file.name in filenameDict) {
+                        $('#' + filenameDict[file.name]).remove();
+                    }
+                    if ($dropzone.data('remove-url') && $dropzone.data('csrf')) {
+                        $.post($dropzone.data('remove-url'), {
+                            file: filenameDict[file.name],
+                            _csrf: $dropzone.data('csrf')
+                        });
+                    }
+                })
+            },
+        });
+    }
+
+    // Emojify
+    emojify.setConfig({
+        img_dir: suburl + '/vendor/plugins/emojify/images',
+        ignore_emoticons: true
+    });
+    const hasEmoji = document.getElementsByClassName('has-emoji');
+    for (let i = 0; i < hasEmoji.length; i++) {
+        emojify.run(hasEmoji[i]);
+        for (let j = 0; j < hasEmoji[i].childNodes.length; j++) {
+            if (hasEmoji[i].childNodes[j].nodeName === "A") {
+                emojify.run(hasEmoji[i].childNodes[j])
+            }
+        }
+    }
+
+    // Clipboard JS
+    const clipboard = new Clipboard('.clipboard');
+    clipboard.on('success', function (e) {
+        e.clearSelection();
+
+        $('#' + e.trigger.getAttribute('id')).popup('destroy');
+        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-success'))
+        $('#' + e.trigger.getAttribute('id')).popup('show');
+        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original'))
+    });
+
+    clipboard.on('error', function (e) {
+        $('#' + e.trigger.getAttribute('id')).popup('destroy');
+        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-error'))
+        $('#' + e.trigger.getAttribute('id')).popup('show');
+        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original'))
+    });
+
+    // Helpers.
+    $('.delete-button').click(showDeletePopup);
+    $('.add-all-button').click(showAddAllPopup);
+
+    $('.delete-branch-button').click(showDeletePopup);
+
+    $('.undo-button').click(function() {
+        const $this = $(this);
+        $.post($this.data('url'), {
+            "_csrf": csrf,
+            "id": $this.data("id")
+        }).done(function(data) {
+            window.location.href = data.redirect;
+        });
+    });
+    $('.show-panel.button').click(function () {
+        $($(this).data('panel')).show();
+    });
+    $('.show-modal.button').click(function () {
+        $($(this).data('modal')).modal('show');
+    });
+    $('.delete-post.button').click(function () {
+        const $this = $(this);
+        $.post($this.data('request-url'), {
+            "_csrf": csrf
+        }).done(function () {
+            window.location.href = $this.data('done-url');
+        });
+    });
+
+    // Set anchor.
+    $('.markdown').each(function () {
+        const headers = {};
+        $(this).find('h1, h2, h3, h4, h5, h6').each(function () {
+            let node = $(this);
+            const val = encodeURIComponent(node.text().toLowerCase().replace(/[^\u00C0-\u1FFF\u2C00-\uD7FF\w\- ]/g, '').replace(/[ ]/g, '-'));
+            let name = val;
+            if (headers[val] > 0) {
+                name = val + '-' + headers[val];
+            }
+            if (headers[val] == undefined) {
+                headers[val] = 1;
+            } else {
+                headers[val] += 1;
+            }
+            node = node.wrap('<div id="' + name + '" class="anchor-wrap" ></div>');
+            node.append('<a class="anchor" href="#' + name + '"><span class="octicon octicon-link"></span></a>');
+        });
+    });
+
+    $('.issue-checkbox').click(function() {
+        const numChecked = $('.issue-checkbox').children('input:checked').length;
+        if (numChecked > 0) {
+            $('#issue-filters').addClass("hide");
+            $('#issue-actions').removeClass("hide");
+        } else {
+            $('#issue-filters').removeClass("hide");
+            $('#issue-actions').addClass("hide");
+        }
+    });
+
+    $('.issue-action').click(function () {
+        let action = this.dataset.action;
+        let elementId = this.dataset.elementId;
+        const issueIDs = $('.issue-checkbox').children('input:checked').map(function() {
+            return this.dataset.issueId;
+        }).get().join();
+        const url = this.dataset.url;
+        if (elementId === '0' && url.substr(-9) === '/assignee'){
+            elementId = '';
+            action = 'clear';
+        }
+        updateIssuesMeta(url, action, issueIDs, elementId).then(function() {
+            // NOTICE: This reset of checkbox state targets Firefox caching behaviour, as the checkboxes stay checked after reload
+            if (action === "close" || action === "open" ){
+                //uncheck all checkboxes
+                $('.issue-checkbox input[type="checkbox"]').each(function(_,e){ e.checked = false; });
+            }
+            reload();
+        });
+    });
+
+    // NOTICE: This event trigger targets Firefox caching behaviour, as the checkboxes stay checked after reload
+    // trigger ckecked event, if checkboxes are checked on load
+    $('.issue-checkbox input[type="checkbox"]:checked').first().each(function(_,e) {
+        e.checked = false;
+        $(e).click();
+    });
+
+    buttonsClickOnEnter();
+    searchUsers();
+    searchTeams();
+    searchRepositories();
+
+    initCommentForm();
+    initInstall();
+    initRepository();
+    initMigration();
+    initWikiForm();
+    initEditForm();
+    initEditor();
+    initOrganization();
+    initWebhook();
+    initAdmin();
+    initCodeView();
+    initVueApp();
+    initTeamSettings();
+    initCtrlEnterSubmit();
+    initNavbarContentToggle();
+    initTopicbar();
+    initU2FAuth();
+    initU2FRegister();
+    initIssueList();
+    initWipTitle();
+    initPullRequestReview();
+    initRepoStatusChecker();
+    initTemplateSearch();
+
+    // Repo clone url.
+    if ($('#repo-clone-url').length > 0) {
+        switch (localStorage.getItem('repo-clone-protocol')) {
+            case 'ssh':
+                if ($('#repo-clone-ssh').click().length === 0) {
+                    $('#repo-clone-https').click();
+                }
+                break;
+            default:
+                $('#repo-clone-https').click();
+                break;
+        }
+    }
+
+    const routes = {
+        'div.user.settings': initUserSettings,
+        'div.repository.settings.collaboration': initRepositoryCollaboration
+    };
+
+    let selector;
+    for (selector in routes) {
+        if ($(selector).length > 0) {
+            routes[selector]();
+            break;
+        }
+    }
+
+    const $cloneAddr = $('#clone_addr');
+    $cloneAddr.change(function() {
+        const $repoName = $('#repo_name');
+        if ($cloneAddr.val().length > 0 && $repoName.val().length === 0) { // Only modify if repo_name input is blank
+            $repoName.val($cloneAddr.val().match(/^(.*\/)?((.+?)(\.git)?)$/)[3]);
+        }
+    });
+});
+
+function changeHash(hash) {
+    if (history.pushState) {
+        history.pushState(null, null, hash);
+    }
+    else {
+        location.hash = hash;
+    }
+}
+
+function deSelect() {
+    if (window.getSelection) {
+        window.getSelection().removeAllRanges();
+    } else {
+        document.selection.empty();
+    }
+}
+
+function selectRange($list, $select, $from) {
+    $list.removeClass('active');
+    if ($from) {
+        let a = parseInt($select.attr('rel').substr(1));
+        let b = parseInt($from.attr('rel').substr(1));
+        let c;
+        if (a != b) {
+            if (a > b) {
+                c = a;
+                a = b;
+                b = c;
+            }
+            const classes = [];
+            for (let i = a; i <= b; i++) {
+                classes.push('.L' + i);
+            }
+            $list.filter(classes.join(',')).addClass('active');
+            changeHash('#L' + a + '-' + 'L' + b);
+            return
+        }
+    }
+    $select.addClass('active');
+    changeHash('#' + $select.attr('rel'));
+}
+
+$(function () {
+    // Warn users that try to leave a page after entering data into a form.
+    // Except on sign-in pages, and for forms marked as 'ignore-dirty'.
+    if ($('.user.signin').length === 0) {
+      $('form:not(.ignore-dirty)').areYouSure();
+    }
+
+    // Parse SSH Key
+    $("#ssh-key-content").on('change paste keyup',function(){
+        const arrays = $(this).val().split(" ");
+        const $title = $("#ssh-key-title")
+        if ($title.val() === "" && arrays.length === 3 && arrays[2] !== "") {
+            $title.val(arrays[2]);
+        }
+    });
+});
+
+function showDeletePopup() {
+    const $this = $(this);
+    let filter = "";
+    if ($this.attr("id")) {
+        filter += "#" + $this.attr("id")
+    }
+
+    const dialog = $('.delete.modal' + filter);
+    dialog.find('.name').text($this.data('name'));
+
+    dialog.modal({
+        closable: false,
+        onApprove: function() {
+            if ($this.data('type') == "form") {
+                $($this.data('form')).submit();
+                return;
+            }
+
+            $.post($this.data('url'), {
+                "_csrf": csrf,
+                "id": $this.data("id")
+            }).done(function(data) {
+                window.location.href = data.redirect;
+            });
+        }
+    }).modal('show');
+    return false;
+}
+
+function showAddAllPopup() {
+    const $this = $(this);
+    let filter = "";
+    if ($this.attr("id")) {
+        filter += "#" + $this.attr("id")
+    }
+
+    const dialog = $('.addall.modal' + filter);
+    dialog.find('.name').text($this.data('name'));
+
+    dialog.modal({
+        closable: false,
+        onApprove: function() {
+            if ($this.data('type') == "form") {
+                $($this.data('form')).submit();
+                return;
+            }
+
+            $.post($this.data('url'), {
+                "_csrf": csrf,
+                "id": $this.data("id")
+            }).done(function(data) {
+                window.location.href = data.redirect;
+            });
+        }
+    }).modal('show');
+    return false;
+}
+
+function initVueComponents(){
+    const vueDelimeters = ['${', '}'];
+
+    Vue.component('repo-search', {
+        delimiters: vueDelimeters,
+
+        props: {
+            searchLimit: {
+                type: Number,
+                default: 10
+            },
+            suburl: {
+                type: String,
+                required: true
+            },
+            uid: {
+                type: Number,
+                required: true
+            },
+            organizations: {
+                type: Array,
+                default: []
+            },
+            isOrganization: {
+                type: Boolean,
+                default: true
+            },
+            canCreateOrganization: {
+                type: Boolean,
+                default: false
+            },
+            organizationsTotalCount: {
+                type: Number,
+                default: 0
+            },
+            moreReposLink: {
+                type: String,
+                default: ''
+            }
+        },
+
+        data: function() {
+            return {
+                tab: 'repos',
+                repos: [],
+                reposTotalCount: 0,
+                reposFilter: 'all',
+                searchQuery: '',
+                isLoading: false,
+                repoTypes: {
+                    'all': {
+                        count: 0,
+                        searchMode: '',
+                    },
+                    'forks': {
+                        count: 0,
+                        searchMode: 'fork',
+                    },
+                    'mirrors': {
+                        count: 0,
+                        searchMode: 'mirror',
+                    },
+                    'sources': {
+                        count: 0,
+                        searchMode: 'source',
+                    },
+                    'collaborative': {
+                        count: 0,
+                        searchMode: 'collaborative',
+                    },
+                }
+            }
+        },
+
+        computed: {
+            showMoreReposLink: function() {
+                return this.repos.length > 0 && this.repos.length < this.repoTypes[this.reposFilter].count;
+            },
+            searchURL: function() {
+                return this.suburl + '/api/v1/repos/search?sort=updated&order=desc&uid=' + this.uid + '&q=' + this.searchQuery
+                                   + '&limit=' + this.searchLimit + '&mode=' + this.repoTypes[this.reposFilter].searchMode
+                                   + (this.reposFilter !== 'all' ? '&exclusive=1' : '');
+            },
+            repoTypeCount: function() {
+                return this.repoTypes[this.reposFilter].count;
+            }
+        },
+
+        mounted: function() {
+            this.searchRepos(this.reposFilter);
+
+            const self = this;
+            Vue.nextTick(function() {
+                self.$refs.search.focus();
+            });
+        },
+
+        methods: {
+            changeTab: function(t) {
+                this.tab = t;
+            },
+
+            changeReposFilter: function(filter) {
+                this.reposFilter = filter;
+                this.repos = [];
+                this.repoTypes[filter].count = 0;
+                this.searchRepos(filter);
+            },
+
+            showRepo: function(repo, filter) {
+                switch (filter) {
+                    case 'sources':
+                        return repo.owner.id == this.uid && !repo.mirror && !repo.fork;
+                    case 'forks':
+                        return repo.owner.id == this.uid && !repo.mirror && repo.fork;
+                    case 'mirrors':
+                        return repo.mirror;
+                    case 'collaborative':
+                        return repo.owner.id != this.uid && !repo.mirror;
+                    default:
+                        return true;
+                }
+            },
+
+            searchRepos: function(reposFilter) {
+                const self = this;
+
+                this.isLoading = true;
+
+                const searchedMode = this.repoTypes[reposFilter].searchMode;
+                const searchedURL = this.searchURL;
+                const searchedQuery = this.searchQuery;
+
+                $.getJSON(searchedURL, function(result, _textStatus, request) {
+                    if (searchedURL == self.searchURL) {
+                        self.repos = result.data;
+                        const count = request.getResponseHeader('X-Total-Count');
+                        if (searchedQuery === '' && searchedMode === '') {
+                            self.reposTotalCount = count;
+                        }
+                        self.repoTypes[reposFilter].count = count;
+                    }
+                }).always(function() {
+                    if (searchedURL == self.searchURL) {
+                        self.isLoading = false;
+                    }
+                });
+            },
+
+            repoClass: function(repo) {
+                if (repo.fork) {
+                    return 'octicon octicon-repo-forked';
+                } else if (repo.mirror) {
+                    return 'octicon octicon-repo-clone';
+                } else if (repo.private) {
+                    return 'octicon octicon-lock';
+                } else {
+                    return 'octicon octicon-repo';
+                }
+            }
+        }
+    })
+}
+
+function initCtrlEnterSubmit() {
+    $(".js-quick-submit").keydown(function(e) {
+        if (((e.ctrlKey && !e.altKey) || e.metaKey) && (e.keyCode == 13 || e.keyCode == 10)) {
+            $(this).closest("form").submit();
+        }
+    });
+}
+
+function initVueApp() {
+    const el = document.getElementById('app');
+    if (!el) {
+        return;
+    }
+
+    initVueComponents();
+
+    new Vue({
+        delimiters: ['${', '}'],
+        el: el,
+
+        data: {
+            searchLimit: document.querySelector('meta[name=_search_limit]').content,
+            suburl: document.querySelector('meta[name=_suburl]').content,
+            uid: document.querySelector('meta[name=_context_uid]').content,
+        },
+    });
+}
+
+window.timeAddManual = function() {
+    $('.mini.modal')
+        .modal({
+            duration: 200,
+            onApprove: function() {
+                $('#add_time_manual_form').submit();
+            }
+        }).modal('show')
+    ;
+}
+
+window.toggleStopwatch = function() {
+    $("#toggle_stopwatch_form").submit();
+}
+window.cancelStopwatch = function() {
+    $("#cancel_stopwatch_form").submit();
+}
+
+window.initHeatmap = function(appElementId, heatmapUser, locale) {
+    const el = document.getElementById(appElementId);
+    if (!el) {
+        return;
+    }
+
+    locale = locale || {};
+
+    locale.contributions = locale.contributions || 'contributions';
+    locale.no_contributions = locale.no_contributions || 'No contributions';
+
+    const vueDelimeters = ['${', '}'];
+
+    Vue.component('activity-heatmap', {
+        delimiters: vueDelimeters,
+
+        props: {
+            user: {
+                type: String,
+                required: true
+            },
+            suburl: {
+                type: String,
+                required: true
+            },
+            locale: {
+                type: Object,
+                required: true
+            }
+        },
+
+        data: function () {
+            return {
+                isLoading: true,
+                colorRange: [],
+                endDate: null,
+                values: [],
+                totalContributions: 0,
+            };
+        },
+
+        mounted: function() {
+            this.colorRange = [
+                this.getColor(0),
+                this.getColor(1),
+                this.getColor(2),
+                this.getColor(3),
+                this.getColor(4),
+                this.getColor(5)
+            ];
+            this.endDate = new Date();
+            this.loadHeatmap(this.user);
+        },
+
+        methods: {
+            loadHeatmap: function(userName) {
+                const self = this;
+                $.get(this.suburl + '/api/v1/users/' + userName + '/heatmap', function(chartRawData) {
+                    const chartData = [];
+                    for (let i = 0; i < chartRawData.length; i++) {
+                        self.totalContributions += chartRawData[i].contributions;
+                        chartData[i] = { date: new Date(chartRawData[i].timestamp * 1000), count: chartRawData[i].contributions };
+                    }
+                    self.values = chartData;
+                    self.isLoading = false;
+                });
+            },
+
+            getColor: function(idx) {
+                const el = document.createElement('div');
+                el.className = 'heatmap-color-' + idx;
+                document.body.appendChild(el);
+
+                const color = getComputedStyle(el).backgroundColor;
+
+                document.body.removeChild(el);
+
+                return color;
+            }
+        },
+
+        template: '<div><div v-show="isLoading"><slot name="loading"></slot></div><h4 class="total-contributions" v-if="!isLoading"><span v-html="totalContributions"></span> total contributions in the last 12 months</h4><calendar-heatmap v-show="!isLoading" :locale="locale" :no-data-text="locale.no_contributions" :tooltip-unit="locale.contributions" :end-date="endDate" :values="values" :range-color="colorRange" />'
+    });
+
+    new Vue({
+        delimiters: vueDelimeters,
+        el: el,
+
+        data: {
+            suburl: document.querySelector('meta[name=_suburl]').content,
+            heatmapUser: heatmapUser,
+            locale: locale
+        },
+    });
+}
+
+function initFilterBranchTagDropdown(selector) {
+    $(selector).each(function() {
+        const $dropdown = $(this);
+        const $data = $dropdown.find('.data');
+        const data = {
+            items: [],
+            mode: $data.data('mode'),
+            searchTerm: '',
+            noResults: '',
+            canCreateBranch: false,
+            menuVisible: false,
+            active: 0
+        };
+        $data.find('.item').each(function() {
+            data.items.push({
+                name: $(this).text(),
+                url: $(this).data('url'),
+                branch: $(this).hasClass('branch'),
+                tag: $(this).hasClass('tag'),
+                selected: $(this).hasClass('selected')
+            });
+        });
+        $data.remove();
+        new Vue({
+            delimiters: ['${', '}'],
+            el: this,
+            data: data,
+
+            beforeMount: function () {
+                const vm = this;
+
+                this.noResults = vm.$el.getAttribute('data-no-results');
+                this.canCreateBranch = vm.$el.getAttribute('data-can-create-branch') === 'true';
+
+                document.body.addEventListener('click', function(event) {
+                    if (vm.$el.contains(event.target)) {
+                        return;
+                    }
+                    if (vm.menuVisible) {
+                        Vue.set(vm, 'menuVisible', false);
+                    }
+                });
+            },
+
+            watch: {
+                menuVisible: function(visible) {
+                    if (visible) {
+                        this.focusSearchField();
+                    }
+                }
+            },
+
+            computed: {
+                filteredItems: function() {
+                    const vm = this;
+
+                    const items = vm.items.filter(function (item) {
+                        return ((vm.mode === 'branches' && item.branch)
+                                || (vm.mode === 'tags' && item.tag))
+                            && (!vm.searchTerm
+                                || item.name.toLowerCase().indexOf(vm.searchTerm.toLowerCase()) >= 0);
+                    });
+
+                    vm.active = (items.length === 0 && vm.showCreateNewBranch ? 0 : -1);
+
+                    return items;
+                },
+                showNoResults: function() {
+                    return this.filteredItems.length === 0
+                            && !this.showCreateNewBranch;
+                },
+                showCreateNewBranch: function() {
+                    const vm = this;
+                    if (!this.canCreateBranch || !vm.searchTerm || vm.mode === 'tags') {
+                        return false;
+                    }
+
+                    return vm.items.filter(function (item) {
+                        return item.name.toLowerCase() === vm.searchTerm.toLowerCase()
+                    }).length === 0;
+                }
+            },
+
+            methods: {
+                selectItem: function(item) {
+                    const prev = this.getSelected();
+                    if (prev !== null) {
+                        prev.selected = false;
+                    }
+                    item.selected = true;
+                    window.location.href = item.url;
+                },
+                createNewBranch: function() {
+                    if (!this.showCreateNewBranch) {
+                        return;
+                    }
+                    this.$refs.newBranchForm.submit();
+                },
+                focusSearchField: function() {
+                    const vm = this;
+                    Vue.nextTick(function() {
+                        vm.$refs.searchField.focus();
+                    });
+                },
+                getSelected: function() {
+                    for (let i = 0, j = this.items.length; i < j; ++i) {
+                        if (this.items[i].selected)
+                            return this.items[i];
+                    }
+                    return null;
+                },
+                getSelectedIndexInFiltered: function() {
+                    for (let i = 0, j = this.filteredItems.length; i < j; ++i) {
+                        if (this.filteredItems[i].selected)
+                            return i;
+                    }
+                    return -1;
+                },
+                scrollToActive: function() {
+                    let el = this.$refs['listItem' + this.active];
+                    if (!el || el.length === 0) {
+                        return;
+                    }
+                    if (Array.isArray(el)) {
+                        el = el[0];
+                    }
+
+                    const cont = this.$refs.scrollContainer;
+
+                     if (el.offsetTop < cont.scrollTop) {
+                         cont.scrollTop = el.offsetTop;
+                     }
+                     else if (el.offsetTop + el.clientHeight > cont.scrollTop + cont.clientHeight) {
+                        cont.scrollTop = el.offsetTop + el.clientHeight - cont.clientHeight;
+                    }
+                },
+                keydown: function(event) {
+                    const vm = this;
+                    if (event.keyCode === 40) {
+                        // arrow down
+                        event.preventDefault();
+
+                        if (vm.active === -1) {
+                            vm.active = vm.getSelectedIndexInFiltered();
+                        }
+
+                        if (vm.active + (vm.showCreateNewBranch ? 0 : 1) >= vm.filteredItems.length) {
+                            return;
+                        }
+                        vm.active++;
+                        vm.scrollToActive();
+                    }
+                    if (event.keyCode === 38) {
+                        // arrow up
+                        event.preventDefault();
+
+                         if (vm.active === -1) {
+                            vm.active = vm.getSelectedIndexInFiltered();
+                        }
+
+                         if (vm.active <= 0) {
+                            return;
+                        }
+                        vm.active--;
+                        vm.scrollToActive();
+                    }
+                    if (event.keyCode == 13) {
+                        // enter
+                        event.preventDefault();
+
+                         if (vm.active >= vm.filteredItems.length) {
+                            vm.createNewBranch();
+                        } else if (vm.active >= 0) {
+                            vm.selectItem(vm.filteredItems[vm.active]);
+                        }
+                    }
+                    if (event.keyCode == 27) {
+                        // escape
+                        event.preventDefault();
+                        vm.menuVisible = false;
+                    }
+                }
+            }
+        });
+    });
+}
+
+$(".commit-button").click(function(e) {
+    e.preventDefault();
+    $(this).parent().find('.commit-body').toggle();
+});
+
+function initNavbarContentToggle() {
+    const content = $('#navbar');
+    const toggle = $('#navbar-expand-toggle');
+    let isExpanded = false;
+    toggle.click(function() {
+        isExpanded = !isExpanded;
+        if (isExpanded) {
+            content.addClass('shown');
+            toggle.addClass('active');
+        }
+        else {
+            content.removeClass('shown');
+            toggle.removeClass('active');
+        }
+    });
+}
+
+function initTopicbar() {
+    const mgrBtn = $("#manage_topic");
+    const editDiv = $("#topic_edit");
+    const viewDiv = $("#repo-topics");
+    const saveBtn = $("#save_topic");
+    const topicDropdown = $('#topic_edit .dropdown');
+    const topicForm = $('#topic_edit.ui.form');
+    const topicPrompts = getPrompts();
+
+    mgrBtn.click(function() {
+        viewDiv.hide();
+        editDiv.css('display', ''); // show Semantic UI Grid
+    });
+
+    function getPrompts() {
+        const hidePrompt = $("div.hide#validate_prompt"),
+            prompts = {
+                countPrompt: hidePrompt.children('#count_prompt').text(),
+                formatPrompt: hidePrompt.children('#format_prompt').text()
+            };
+        hidePrompt.remove();
+        return prompts;
+    }
+
+    saveBtn.click(function() {
+        const topics = $("input[name=topics]").val();
+
+        $.post(saveBtn.data('link'), {
+            "_csrf": csrf,
+            "topics": topics
+        }, function(_data, _textStatus, xhr){
+            if (xhr.responseJSON.status === 'ok') {
+                viewDiv.children(".topic").remove();
+                if (topics.length) {
+                    const topicArray = topics.split(",");
+
+                    const last = viewDiv.children("a").last();
+                    for (let i=0; i < topicArray.length; i++) {
+                        $('<div class="ui small label topic" style="cursor:pointer;">'+topicArray[i]+'</div>').insertBefore(last)
+                    }
+                }
+                editDiv.css('display', 'none');
+                viewDiv.show();
+            }
+        }).fail(function(xhr){
+            if (xhr.status === 422) {
+                if (xhr.responseJSON.invalidTopics.length > 0) {
+                    topicPrompts.formatPrompt = xhr.responseJSON.message;
+
+                    const invalidTopics = xhr.responseJSON.invalidTopics,
+                        topicLables = topicDropdown.children('a.ui.label');
+
+                    topics.split(',').forEach(function(value, index) {
+                        for (let i=0; i < invalidTopics.length; i++) {
+                            if (invalidTopics[i] === value) {
+                                topicLables.eq(index).removeClass("green").addClass("red");
+                            }
+                        }
+                    });
+                } else {
+                    topicPrompts.countPrompt = xhr.responseJSON.message;
+                }
+            }
+        }).always(function() {
+            topicForm.form('validate form');
+        });
+    });
+
+    topicDropdown.dropdown({
+        allowAdditions: true,
+        forceSelection: false,
+        fields: { name: "description", value: "data-value" },
+        saveRemoteData: false,
+        label: {
+            transition : 'horizontal flip',
+            duration   : 200,
+            variation  : false,
+            blue : true,
+            basic: true,
+        },
+        className: {
+            label: 'ui small label'
+        },
+        apiSettings: {
+            url: suburl + '/api/v1/topics/search?q={query}',
+            throttle: 500,
+            cache: false,
+            onResponse: function(res) {
+                const formattedResponse = {
+                    success: false,
+                    results: [],
+                };
+                const stripTags = function (text) {
+                    return text.replace(/<[^>]*>?/gm, "");
+                };
+
+                const query = stripTags(this.urlData.query.trim());
+                let found_query = false;
+                const current_topics = [];
+                topicDropdown.find('div.label.visible.topic,a.label.visible').each(function(_,e){ current_topics.push(e.dataset.value); });
+
+                if (res.topics) {
+                    let found = false;
+                    for (let i=0;i < res.topics.length;i++) {
+                        // skip currently added tags
+                        if (current_topics.indexOf(res.topics[i].topic_name) != -1){
+                            continue;
+                        }
+
+                        if (res.topics[i].topic_name.toLowerCase() === query.toLowerCase()){
+                            found_query = true;
+                        }
+                        formattedResponse.results.push({"description": res.topics[i].topic_name, "data-value": res.topics[i].topic_name});
+                        found = true;
+                    }
+                    formattedResponse.success = found;
+                }
+
+                if (query.length > 0 && !found_query){
+                    formattedResponse.success = true;
+                    formattedResponse.results.unshift({"description": query, "data-value": query});
+                } else if (query.length > 0 && found_query) {
+                    formattedResponse.results.sort(function(a, b){
+                        if (a.description.toLowerCase() === query.toLowerCase()) return -1;
+                        if (b.description.toLowerCase() === query.toLowerCase()) return 1;
+                        if (a.description > b.description) return -1;
+                        if (a.description < b.description) return 1;
+                        return 0;
+                    });
+                }
+
+
+                return formattedResponse;
+            },
+        },
+        onLabelCreate: function(value) {
+            value = value.toLowerCase().trim();
+            this.attr("data-value", value).contents().first().replaceWith(value);
+            return $(this);
+        },
+        onAdd: function(addedValue, _addedText, $addedChoice) {
+            addedValue = addedValue.toLowerCase().trim();
+            $($addedChoice).attr('data-value', addedValue);
+            $($addedChoice).attr('data-text', addedValue);
+        }
+    });
+
+    $.fn.form.settings.rules.validateTopic = function(_values, regExp) {
+        const topics = topicDropdown.children('a.ui.label'),
+            status = topics.length === 0 || topics.last().attr("data-value").match(regExp);
+        if (!status) {
+            topics.last().removeClass("green").addClass("red");
+        }
+        return status && topicDropdown.children('a.ui.label.red').length === 0;
+    };
+
+    topicForm.form({
+            on: 'change',
+            inline : true,
+            fields: {
+                topics: {
+                    identifier: 'topics',
+                    rules: [
+                        {
+                            type: 'validateTopic',
+                            value: /^[a-z0-9][a-z0-9-]{1,35}$/,
+                            prompt: topicPrompts.formatPrompt
+                        },
+                        {
+                            type: 'maxCount[25]',
+                            prompt: topicPrompts.countPrompt
+                        }
+                    ]
+                },
+            }
+        });
+}
+window.toggleDeadlineForm = function() {
+    $('#deadlineForm').fadeToggle(150);
+}
+
+window.setDeadline = function() {
+    const deadline = $('#deadlineDate').val();
+    updateDeadline(deadline);
+}
+
+function updateDeadline(deadlineString) {
+    $('#deadline-err-invalid-date').hide();
+    $('#deadline-loader').addClass('loading');
+
+    let realDeadline = null;
+    if (deadlineString !== '') {
+
+        const newDate = Date.parse(deadlineString)
+
+        if (isNaN(newDate)) {
+            $('#deadline-loader').removeClass('loading');
+            $('#deadline-err-invalid-date').show();
+            return false;
+        }
+        realDeadline = new Date(newDate);
+    }
+
+    $.ajax($('#update-issue-deadline-form').attr('action') + '/deadline', {
+        data: JSON.stringify({
+            'due_date': realDeadline,
+        }),
+        headers: {
+            'X-Csrf-Token': csrf,
+            'X-Remote': true,
+        },
+        contentType: 'application/json',
+        type: 'POST',
+        success: function () {
+            reload();
+        },
+        error: function () {
+            $('#deadline-loader').removeClass('loading');
+            $('#deadline-err-invalid-date').show();
+        }
+    });
+}
+
+window.deleteDependencyModal = function(id, type) {
+    $('.remove-dependency')
+        .modal({
+            closable: false,
+            duration: 200,
+            onApprove: function () {
+                $('#removeDependencyID').val(id);
+                $('#dependencyType').val(type);
+                $('#removeDependencyForm').submit();
+            }
+        }).modal('show')
+    ;
+}
+
+function initIssueList() {
+    const repolink = $('#repolink').val();
+    const repoId = $('#repoId').val();
+    const crossRepoSearch = $('#crossRepoSearch').val();
+    let issueSearchUrl = suburl + '/api/v1/repos/' + repolink + '/issues?q={query}';
+    if (crossRepoSearch === 'true') {
+        issueSearchUrl = suburl + '/api/v1/repos/issues/search?q={query}&priority_repo_id=' + repoId;
+    }
+    $('#new-dependency-drop-list')
+        .dropdown({
+            apiSettings: {
+                url: issueSearchUrl,
+                onResponse: function(response) {
+                    const filteredResponse = {'success': true, 'results': []};
+                    const currIssueId = $('#new-dependency-drop-list').data('issue-id');
+                    // Parse the response from the api to work with our dropdown
+                    $.each(response, function(_i, issue) {
+                        // Don't list current issue in the dependency list.
+                        if(issue.id === currIssueId) {
+                            return;
+                        }
+                        filteredResponse.results.push({
+                            'name'  : '#' + issue.number + ' ' + htmlEncode(issue.title) +
+                                '<div class="text small dont-break-out">' + htmlEncode(issue.repository.full_name) + '</div>',
+                            'value' : issue.id
+                        });
+                    });
+                    return filteredResponse;
+                },
+                cache: false,
+            },
+
+            fullTextSearch: true
+        });
+
+    $(".menu a.label-filter-item").each(function() {
+        $(this).click(function(e) {
+            if (e.altKey) {
+                e.preventDefault();
+
+                const href = $(this).attr("href");
+                const id = $(this).data("label-id");
+
+                const regStr = "labels=(-?[0-9]+%2c)*(" + id + ")(%2c-?[0-9]+)*&";
+                const newStr = "labels=$1-$2$3&";
+
+                window.location = href.replace(new RegExp(regStr), newStr);
+            }
+        });
+    });
+
+    $(".menu .ui.dropdown.label-filter").keydown(function(e) {
+        if (e.altKey && e.keyCode == 13) {
+            const selectedItems = $(".menu .ui.dropdown.label-filter .menu .item.selected");
+
+            if (selectedItems.length > 0) {
+                const item = $(selectedItems[0]);
+
+                const href = item.attr("href");
+                const id = item.data("label-id");
+
+                const regStr = "labels=(-?[0-9]+%2c)*(" + id + ")(%2c-?[0-9]+)*&";
+                const newStr = "labels=$1-$2$3&";
+
+                window.location = href.replace(new RegExp(regStr), newStr);
+            }
+        }
+    });
+}
+window.cancelCodeComment = function(btn) {
+    const form = $(btn).closest("form");
+    if(form.length > 0 && form.hasClass('comment-form')) {
+        form.addClass('hide');
+        form.parent().find('button.comment-form-reply').show();
+    } else {
+        form.closest('.comment-code-cloud').remove()
+    }
+}
+window.onOAuthLoginClick = function() {
+    const oauthLoader = $('#oauth2-login-loader');
+    const oauthNav = $('#oauth2-login-navigator');
+
+    oauthNav.hide();
+    oauthLoader.removeClass('disabled');
+
+    setTimeout(function(){
+        // recover previous content to let user try again
+        // usually redirection will be performed before this action
+        oauthLoader.addClass('disabled');
+        oauthNav.show();
+    },5000);
+}
diff --git a/webpack.config.js b/webpack.config.js
new file mode 100644 (file)
index 0000000..750ee4c
--- /dev/null
@@ -0,0 +1,20 @@
+const path = require('path');
+const TerserPlugin = require('terser-webpack-plugin');
+
+module.exports = {
+  mode: 'production',
+  entry: {
+    index: './web_src/js/index.js',
+  },
+  devtool: 'source-map',
+  output: {
+    path: path.resolve(__dirname, 'public/js'),
+    filename: "[name].js"
+  },
+  optimization: {
+    minimize: true,
+    minimizer: [new TerserPlugin({ 
+        sourceMap: true
+     })],
+  },
+};