]> source.dussan.org Git - gitea.git/commitdiff
Expand/Collapse Files and Blob Excerpt while Reviewing/Comparing code (#8924)
authorBenno <blueworrybear@gmail.com>
Fri, 15 Nov 2019 02:52:59 +0000 (10:52 +0800)
committerLunny Xiao <xiaolunwen@gmail.com>
Fri, 15 Nov 2019 02:52:59 +0000 (10:52 +0800)
* update #8659 fold/unfold code diffs

* add fold button style

* update #8659 implement expand up/down codes (blob excerpt)

* fix golint errors

* fix expand direction

* remove debug message

* update css style for blob exceprt

* fix typo in comment

* update style sheet with less

* update expect diff (add SectionInfo)

* update #8942 accept suggested change (fix typo)

* close reader and check file type before get tail section

* adjust button position and check file type before insert fold button

* move index js to web_src

* merge index.js with master

* generate index.js

* update js coding style

16 files changed:
modules/git/blob.go
modules/repofiles/diff_test.go
public/css/index.css
public/js/index.js
public/js/index.js.map
routers/repo/commit.go
routers/repo/compare.go
routers/repo/pull.go
routers/routes/routes.go
services/gitdiff/gitdiff.go
templates/repo/diff/blob_excerpt.tmpl [new file with mode: 0644]
templates/repo/diff/box.tmpl
templates/repo/diff/section_unified.tmpl
web_src/js/index.js
web_src/less/_repository.less
web_src/less/_review.less

index 68147673a35bedd092a64bff4b4106db76640a7d..df88ac2ede9494f01528eeca3bc1ee980230d322 100644 (file)
@@ -6,6 +6,7 @@
 package git
 
 import (
+       "bytes"
        "encoding/base64"
        "io"
        "io/ioutil"
@@ -50,6 +51,28 @@ func (b *Blob) GetBlobContent() (string, error) {
        return string(buf), nil
 }
 
+// GetBlobLineCount gets line count of lob as raw text
+func (b *Blob) GetBlobLineCount() (int, error) {
+       reader, err := b.DataAsync()
+       if err != nil {
+               return 0, err
+       }
+       defer reader.Close()
+       buf := make([]byte, 32*1024)
+       count := 0
+       lineSep := []byte{'\n'}
+       for {
+               c, err := reader.Read(buf)
+               count += bytes.Count(buf[:c], lineSep)
+               switch {
+               case err == io.EOF:
+                       return count, nil
+               case err != nil:
+                       return count, err
+               }
+       }
+}
+
 // GetBlobContentBase64 Reads the content of the blob with a base64 encode and returns the encoded string
 func (b *Blob) GetBlobContentBase64() (string, error) {
        dataRc, err := b.DataAsync()
index db2c7552c4ffe58aa05e5ae1d932a4377c6806da..4e1d5b13ebda6a1821ea76ba5b54930c6218c573 100644 (file)
@@ -55,6 +55,15 @@ func TestGetDiffPreview(t *testing.T) {
                                                                Type:     4,
                                                                Content:  "@@ -1,3 +1,4 @@",
                                                                Comments: nil,
+                                                               SectionInfo: &gitdiff.DiffLineSectionInfo{
+                                                                       Path:          "README.md",
+                                                                       LastLeftIdx:   0,
+                                                                       LastRightIdx:  0,
+                                                                       LeftIdx:       1,
+                                                                       RightIdx:      1,
+                                                                       LeftHunkSize:  3,
+                                                                       RightHunkSize: 4,
+                                                               },
                                                        },
                                                        {
                                                                LeftIdx:  1,
index a6bed125e5d58d03f540243bf31ebca1cc604d12..100870c1b24bf6636c65c632becd88932c946000 100644 (file)
@@ -898,6 +898,7 @@ tbody.commit-list{vertical-align:baseline}
 .repo-buttons .disabled-repo-button a.button:hover{background:0 0!important;color:rgba(0,0,0,.6)!important;box-shadow:0 0 0 1px rgba(34,36,38,.15) inset!important}
 .repo-buttons .ui.labeled.button>.label{border-left:0!important;margin:0!important}
 .tag-code,.tag-code td{background-color:#f0f0f0!important;border-color:#d3cfcf!important;padding-top:8px;padding-bottom:8px}
+td.blob-excerpt{background-color:#fafafa}
 .issue-keyword{border-bottom:1px dotted #959da5;display:inline-block}
 .file-header{display:flex;justify-content:space-between;align-items:center;padding:8px 12px!important}
 .file-info{display:flex;align-items:center}
@@ -1068,4 +1069,8 @@ tbody.commit-list{vertical-align:baseline}
 .comment-code-cloud .footer:after{clear:both;content:"";display:block}
 .comment-code-cloud button.comment-form-reply{margin:.5em .5em .5em 4.5em}
 .comment-code-cloud form.comment-form-reply{margin:0 0 0 4em}
-.file-comment{font:12px 'SF Mono',Consolas,Menlo,'Liberation Mono',Monaco,'Lucida Console',monospace;color:rgba(0,0,0,.87)}
\ No newline at end of file
+.file-comment{font:12px 'SF Mono',Consolas,Menlo,'Liberation Mono',Monaco,'Lucida Console',monospace;color:rgba(0,0,0,.87)}
+.ui.fold-code{margin-right:1em;padding-left:5px;cursor:pointer;width:22px;font-size:12px}
+.ui.fold-code:hover{color:#428bca}
+.ui.blob-excerpt{display:block;line-height:20px;font-size:16px;cursor:pointer}
+.ui.blob-excerpt:hover{color:#428bca}
\ No newline at end of file
index 53f9a32dffb358f16cc3e2581bda5c327f066cda..353a4fd19b90b32028ebebbf13e66bb6e1e009da 100644 (file)
@@ -1,2 +1,2 @@
-!function(e){var t={};function a(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=t,a.d=function(e,t,i){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(a.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(i,n,function(t){return e[t]}.bind(null,n));return i},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=0)}([function(e,t,a){a(1),e.exports=a(2)},function(e,t){function a(e){return jQuery("<div />").text(e).html()}var i,n,o,r,s;function c(e){var t=e.find(".tabular.menu");t.find(".item").tab(),t.find('.item[data-tab="'.concat(t.data("preview"),'"]')).click((function(){var a=$(this);$.post(a.data("url"),{_csrf:i,mode:"gfm",context:a.data("context"),text:e.find('.tab.segment[data-tab="'.concat(t.data("write"),'"] textarea')).val()},(function(a){var i=e.find('.tab.segment[data-tab="'.concat(t.data("preview"),'"]'));i.html(a),emojify.run(i[0]),$("pre code",i[0]).each((function(){hljs.highlightBlock(this)}))}))})),w()}function l(){var e,t;0!==$(".edit.form").length&&(!function(e){var t=e.find(".tabular.menu");t.find(".item").tab();var a=t.find('.item[data-tab="'.concat(t.data("preview"),'"]'));a.length&&(o=a.data("preview-file-modes").split(","),a.click((function(){var a=$(this);$.post(a.data("url"),{_csrf:i,mode:"gfm",context:a.data("context"),text:e.find('.tab.segment[data-tab="'.concat(t.data("write"),'"] textarea')).val()},(function(a){var i=e.find('.tab.segment[data-tab="'.concat(t.data("preview"),'"]'));i.html(a),emojify.run(i[0]),$("pre code",i[0]).each((function(){hljs.highlightBlock(this)}))}))})))}($(".edit.form")),e=$(".edit.form"),(t=e.find(".tabular.menu")).find(".item").tab(),t.find('.item[data-tab="'.concat(t.data("diff"),'"]')).click((function(){var a=$(this);$.post(a.data("url"),{_csrf:i,context:a.data("context"),content:e.find('.tab.segment[data-tab="'.concat(t.data("write"),'"] textarea')).val()},(function(a){var i=e.find('.tab.segment[data-tab="'.concat(t.data("diff"),'"]'));i.html(a),emojify.run(i[0])}))})))}function d(e,t,a,n){return new Promise((function(o){$.ajax({type:"POST",url:e,data:{_csrf:i,action:t,issue_ids:a,id:n},success:o})}))}function u(){window.location.reload()}function h(e){e.each((function(){var e=this;e.addEventListener("paste",(function(t){!function(e,t){if(e.clipboardData){var a=e.clipboardData.items;if(void 0!==a)for(var i=0;i<a.length;i++)if(-1!==a[i].type.indexOf("image")){var n=a[i].getAsFile();"function"==typeof t&&(e.preventDefault(),e.stopPropagation(),t(n))}}}(t,(function(t){var a=t.name.substr(0,t.name.lastIndexOf("."));!function(e,t){if(e.selectionStart||0===e.selectionStart){var a=e.selectionStart,i=e.selectionEnd;e.value=e.value.substring(0,a)+t+e.value.substring(i,e.value.length),e.selectionStart=a+t.length,e.selectionEnd=a+t.length}else e.value+=t}(e,"![".concat(a,"]()")),function(e,t){var a=new XMLHttpRequest;a.onload=function(){200===a.status&&t(a.responseText)},a.open("post","".concat(n,"/attachments"),!0),a.setRequestHeader("X-Csrf-Token",i);var o=new FormData;o.append("file",e,e.name),a.send(o)}(t,(function(t){var i=JSON.parse(t);!function(e,t,a){if(e.selectionStart||0===e.selectionStart){var i=e.selectionStart,n=e.selectionEnd;e.value=e.value.replace(t,a),e.selectionStart=i+a.length-t.length,e.selectionEnd=n+a.length-t.length}else e.value=e.value.replace(t,a)}(e,"![".concat(a,"]()"),"![".concat(a,"](").concat(n,"/attachments/").concat(i.uuid,")"));var o=$('<input id="'.concat(i.uuid,'" name="files" type="hidden">')).val(i.uuid);$(".files").append(o)}))}))}),!1)}))}function f(){var e;0!==$(".comment.form").length&&((e=$(".ui.select-branch")).find(".reference-list-menu").find(".item:not(.no-select)").click((function(){var 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})),c($(".comment.form")),h($(".comment.form textarea")),t("select-label","labels"),t("select-assignees","assignees"),t("select-assignees-modify","assignees"),i(".select-milestone","#milestone_id"),i(".select-assignee","#assignee_id"));function t(e,t){var a=$(".ui.".concat(t,".list")),i=a.find(".no-select"),n=$(".".concat(e," .menu")),o="update"===n.data("action"),r={};$(".".concat(e)).dropdown("setting","onHide",(function(){if(o="update"===n.data("action")){var e=[];Object.keys(r).forEach((function(t){var a=r[t],i=d(a["update-url"],a.action,a["issue-id"],t);e.push(i)})),Promise.all(e).then(u)}})),n.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")),d(n.data("update-url"),"",n.data("issue-id"),$(this).data("id")),n.data("action","update"),!1;$(this).hasClass("checked")?($(this).removeClass("checked"),$(this).find(".octicon").removeClass("octicon-check"),o&&($(this).data("id")in r?delete r[$(this).data("id")]:r[$(this).data("id")]={"update-url":n.data("update-url"),action:"detach","issue-id":n.data("issue-id")})):($(this).addClass("checked"),$(this).find(".octicon").addClass("octicon-check"),o&&($(this).data("id")in r?delete r[$(this).data("id")]:r[$(this).data("id")]={"update-url":n.data("update-url"),action:"attach","issue-id":n.data("issue-id")}));var 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})),n.find(".no-select.item").click((function(){(o||"select-assignees-modify"===e)&&d(n.data("update-url"),"clear",n.data("issue-id"),"").then(u),$(this).parent().find(".item").each((function(){$(this).removeClass("checked"),$(this).find(".octicon").removeClass("octicon-check")})),a.find(".item").each((function(){$(this).addClass("hide")})),i.removeClass("hide"),$($(this).parent().data("id")).val("")}))}function i(e,t){var i=$("".concat(e," .menu")),n=$(".ui".concat(e,".list")),o="update"===i.data("action");i.find(".item:not(.no-select)").click((function(){switch($(this).parent().find(".item").each((function(){$(this).removeClass("selected active")})),$(this).addClass("selected active"),o&&d(i.data("update-url"),"",i.data("issue-id"),$(this).data("id")).then(u),t){case"#milestone_id":n.find(".selected").html('<a class="item" href='.concat($(this).data("href"),">").concat(a($(this).text()),"</a>"));break;case"#assignee_id":n.find(".selected").html('<a class="item" href='.concat($(this).data("href"),">")+'<img class="ui avatar image" src='.concat($(this).data("avatar"),">").concat(a($(this).text()),"</a>"))}$(".ui".concat(e,".list .no-select")).addClass("hide"),$(t).val($(this).data("id"))})),i.find(".no-select.item").click((function(){$(this).parent().find(".item:not(.no-select)").each((function(){$(this).removeClass("selected active")})),o&&d(i.data("update-url"),"",i.data("issue-id"),$(this).data("id")).then(u),n.find(".selected").html(""),n.find(".no-select").removeClass("hide"),$(t).val("")}))}}function p(){if(0!==$(".repository").length){if(($(".repository.file.list").length>0||".repository.commits".length>0)&&$(".choose.reference .dropdown").each((function(){var 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(){var 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(){var 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(){var 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){var 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(){var e=this;Vue.nextTick((function(){e.$refs.searchField.focus()}))},getSelected:function(){for(var e=0,t=this.items.length;e<t;++e)if(this.items[e].selected)return this.items[e];return null},getSelectedIndexInFiltered:function(){for(var e=0,t=this.filteredItems.length;e<t;++e)if(this.filteredItems[e].selected)return e;return-1},scrollToActive:function(){var e=this.$refs["listItem".concat(this.active)];if(e&&0!==e.length){Array.isArray(e)&&(e=e[0]);var 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){var 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&&d(".choose.page .dropdown"),$(".repository.settings.options").length>0&&($("#repo_name").keyup((function(){var 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){var 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(){var 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){var t=$(".milestone.datepicker");t.datetimepicker({lang:t.data("lang"),inline:!0,timepicker:!1,startDate:t.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){var a=$("#issue-title"),n=$("#edit-title-input input"),o=function(){return a.toggle(),$(".not-in-edit").toggle(),$("#edit-title-input").toggle(),$(".in-edit").toggle(),n.focus(),!1};$("#edit-title").click(o),$("#cancel-edit-title").click(o),$("#save-edit-title").click(o).click((function(){return 0===n.val().length||n.val()===a.text()?(n.val(a.text()),!1):($.post($(this).data("update-url"),{_csrf:i,title:n.val()},(function(e){n.val(e.title),a.text(e.title),u()})),!1)})),$(".edit-content").click((function(){var e,t=$(this).parent().parent().parent().next(),a=t.find(".edit-content-zone"),n=t.find(".render-content"),o=t.find(".raw-content");if(0===a.html().length){a.html($("#edit-content-form").html()),e=a.find("textarea"),issuesTribute.attach(e.get()),emojiTribute.attach(e.get());var r=a.find(".dropzone");r.data("saved",!1);var s=a.find(".comment-files");if(r.length>0){var l={};r.dropzone({url:r.data("upload-url"),headers:{"X-Csrf-Token":i},maxFiles:r.data("max-file"),maxFilesize:r.data("max-size"),acceptedFiles:"*/*"===r.data("accepts")?null:r.data("accepts"),addRemoveLinks:!0,dictDefaultMessage:r.data("default-message"),dictInvalidFileType:r.data("invalid-input-type"),dictFileTooBig:r.data("file-too-big"),dictRemoveFile:r.data("remove-file"),init:function(){this.on("success",(function(e,t){l[e.name]={uuid:t.uuid,submitted:!1};var a=$('<input id="'.concat(t.uuid,'" name="files" type="hidden">')).val(t.uuid);s.append(a)})),this.on("removedfile",(function(e){e.name in l&&($("#".concat(l[e.name].uuid)).remove(),r.data("remove-url")&&r.data("csrf")&&!l[e.name].submitted&&$.post(r.data("remove-url"),{file:l[e.name].uuid,_csrf:r.data("csrf")}))})),this.on("submit",(function(){$.each(l,(function(e){l[e].submitted=!0}))})),this.on("reload",(function(){$.getJSON(a.data("attachment-url"),(function(e){var t=r.get(0).dropzone;t.removeAllFiles(!0),s.empty(),$.each(e,(function(){var e="".concat(r.data("upload-url"),"/").concat(this.uuid);t.emit("addedfile",this),t.emit("thumbnail",this,e),t.emit("complete",this),t.files.push(this),l[this.name]={submitted:!0,uuid:this.uuid},r.find("img[src='".concat(e,"']")).css("max-width","100%");var a=$('<input id="'.concat(this.uuid,'" name="files" type="hidden">')).val(this.uuid);s.append(a)}))}))}))}}),r.get(0).dropzone.emit("reload")}var d=a.find(".ui.comment.form"),u=d.find(".tabular.menu");u.attr("data-write",a.data("write")),u.attr("data-preview",a.data("preview")),u.find(".write.item").attr("data-tab",a.data("write")),u.find(".preview.item").attr("data-tab",a.data("preview")),d.find(".write.segment").attr("data-tab",a.data("write")),d.find(".preview.segment").attr("data-tab",a.data("preview")),c(d),a.find(".cancel.button").click((function(){n.show(),a.hide(),r.get(0).dropzone.emit("reload")})),a.find(".save.button").click((function(){n.show(),a.hide();var o=s.find("[name=files]").map((function(){return $(this).val()})).get();$.post(a.data("update-url"),{_csrf:i,content:e.val(),context:a.data("context"),files:o},(function(e){0===e.length?n.html($("#no-content").html()):(n.html(e.content),emojify.run(n[0]),$("pre code",n[0]).each((function(){hljs.highlightBlock(this)})));var a=t.parent();a.find(".ui.small.images").length?""===e.attachments?a.find(".ui.small.images").parent().remove():a.find(".ui.small.images").html(e.attachments):""!==e.attachments&&(a.append('<div class="ui bottom attached segment"><div class="ui small images"></div></div>'),a.find(".ui.small.images").html(e.attachments)),r.get(0).dropzone.emit("submit"),r.get(0).dropzone.emit("reload")}))}))}else e=t.find("textarea");return a.show(),n.hide(),0===e.val().length&&e.val(o.text()),e.focus(),!1})),$(".delete-comment").click((function(){var e=$(this);return window.confirm(e.data("locale"))&&$.post(e.data("url"),{_csrf:i}).success((function(){$("#".concat(e.data("comment-id"))).remove()})),!1}));var r=$("#status-button");$("#comment-form .edit_area").keyup((function(){0===$(this).val().length?r.text(r.data("status")):r.text(r.data("status-and-comment"))})),r.click((function(){$("#status").val(r.data("status-val")),$("#comment-form").submit()}));var s=$(".merge-button > button");s.on("click",(function(e){e.preventDefault(),$(".".concat($(this).data("do"),"-fields")).show(),$(this).parent().hide()})),$(".merge-button > .dropdown").dropdown({onChange:function(e,t,a){a.data("do")&&(s.find(".button-text").text(a.text()),s.data("do",a.data("do")))}}),$(".merge-cancel").on("click",(function(e){e.preventDefault(),$(this).closest(".form").hide(),s.parent().show()})),function e(t){var a="";t||(t=$(document),a=".reactions > "),t.find("".concat(a,"a.label")).popup({position:"bottom left",metadata:{content:"title",title:"none"}}),t.find(".select-reaction > .menu > .item, ".concat(a,"a.label")).on("click",(function(t){var a=this;if(t.preventDefault(),!$(this).hasClass("disabled")){var n=$(this).hasClass("item")?$(this).closest(".select-reaction").data("action-url"):$(this).data("action-url"),o="".concat(n,"/").concat($(this).hasClass("blue")?"unreact":"react");$.ajax({type:"POST",url:o,data:{_csrf:i,content:$(this).data("content")}}).done((function(t){if(t&&(t.html||t.empty)){var i=$(a).closest(".content"),n=i.find(".segment.reactions");if(!t.empty&&n.length>0&&n.remove(),!t.empty){n=$('<div class="ui attached segment reactions"></div>');var o=i.find(".segment.bottom:first");o.length>0?n.insertBefore(o):n.appendTo(i),n.html(t.html);for(var r=n.find(".has-emoji"),s=0;s<r.length;s++)emojify.run(r.get(s));n.find(".dropdown").dropdown(),e(n)}}}))}}))}()}$(".repository.diff").length>0&&$(".diff-counter").each((function(){var e=$(this),t=e.find("span[data-line].add").data("line"),a=e.find("span[data-line].del").data("line"),i=parseFloat(t)/(parseFloat(t)+parseFloat(a))*100;e.find(".bar .add").css("width","".concat(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()}));var l=$(".repository.compare.pull");l.length>0&&(d(".choose.branch .dropdown"),l.find("button.show-form").on("click",(function(e){e.preventDefault(),l.find(".pullrequest-form").show(),$(this).parent().hide()}))),$(".repository.settings.branches").length>0&&(d(".protected-branches .dropdown"),$(".enable-protection, .enable-whitelist").change((function(){this.checked?$($(this).data("target")).removeClass("disabled"):$($(this).data("target")).addClass("disabled")})))}function d(e){var t=$(e);t.dropdown({fullTextSearch:!0,selectOnKeydown:!1,onChange:function(e,t,a){a.data("url")&&(window.location.href=a.data("url"))},message:{noResults:t.data("no-results")}})}}function m(e){var 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(){var e=$(this).attr("data-tab")+t;$(this).attr("data-tab",e)})),e.parent().find("*[data-tab='write']").attr("data-tab","write".concat(t)),e.parent().find("*[data-tab='preview']").attr("data-tab","preview".concat(t)),c(e.parent(".form")),t}function v(){$(".access-mode.menu .item").click((function(){var e=$(this).parent();$.post(e.data("url"),{_csrf:i,uid:e.data("uid"),mode:$(this).data("value")})}))}function g(){$(".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"))}));var e=$("#file-name");e.keyup((function(e){var t,a,i=$(".breadcrumb span.section"),n=$(".breadcrumb div.divider");if(8===e.keyCode&&0===$(this).getCursorPosition()&&i.length>0&&(t=i.last().find("a").text(),$(this).val(t+$(this).val()),$(this)[0].setSelectionRange(t.length,t.length),i.last().remove(),n.last().remove()),191===e.keyCode){a=$(this).val().split("/");for(var o=0;o<a.length;++o)t=a[o],o<a.length-1?t.length&&($('<span class="section"><a href="#">'.concat(t,"</a></span>")).insertBefore($(this)),$('<div class="divider"> / </div>').insertBefore($(this))):$(this).val(t),$(this)[0].setSelectionRange(0,0)}a=[],$(".breadcrumb span.section").each((function(){var e=$(this);e.find("a").length?a.push(e.find("a").text()):a.push(e.text())})),$(this).val()&&a.push($(this).val()),$("#tree_path").val(a.join("/"))})).trigger("keyup");var t=$(".repository.editor textarea#edit_area");if(t.length){var a=t.data("markdown-file-exts").split(","),n=t.data("line-wrap-extensions").split(",");e.on("keyup",(function(){var c,l,d,u,h,f,p=e.val();d=u="";var m=/.+\.([^.]+)$/.exec(p);m&&(d=m[1],u=".".concat(d));var v=CodeMirror.findModeByExtension(d),g=$("a[data-tab=preview]");if(v?(c=v.mode,l=v.mime,f=c):f=d,g.length&&f&&o&&o.length&&o.indexOf(f)>=0?(h=g.data("url"),g.data("url",h.replace(/(.*)\/.*/i,"$1/".concat(c))),g.show()):g.hide(),!(a.indexOf(u)>=0&&function(e){return s&&(s.toTextArea(),s=null),!!r||(r=new SimpleMDE({autoDownloadFontAwesome:!1,element:e[0],forceSync:!0,renderingConfig:{singleLineBreaks:!1},indentWithTabs:!1,tabSize:4,spellChecker:!1,previewRender:function(t,a){return setTimeout((function(){$.post(e.data("url"),{_csrf:i,mode:"gfm",context:e.data("context"),text:t},(function(e){a.innerHTML='<div class="markdown ui segment">'.concat(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))&&(s||function(e){return r&&(r.toTextArea(),r=null),!!s||((s=CodeMirror.fromTextArea(e[0],{lineNumbers:!0})).on("change",(function(t,a){e.val(t.getValue())})),!0)}(t))){c&&(s.setOption("mode",l),CodeMirror.autoLoadMode(s,c)),n.indexOf(u)>=0?s.setOption("lineWrapping",!0):s.setOption("lineWrapping",!1);var 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?(s.setOption("indentWithTabs",!0),s.setOption("extraKeys",{})):(s.setOption("indentWithTabs",!1),s.setOption("extraKeys",{Tab:function(e){var t=Array(parseInt(e.getOption("indentUnit"))+1).join(" ");e.replaceSelection(t)}})),s.setOption("indentUnit",e.indent_size||4),s.setOption("tabSize",e.tab_width||4)})))}})).trigger("keyup");var c=$("#commit-button"),l=$(".ui.edit.form");c.prop("disabled",!0),l.areYouSure({silent:!0,dirtyClass:"dirty-file",fieldSelector:":input:not(.commit-form-wrapper :input)",change:function(){var e=$(this).hasClass("dirty-file");c.prop("disabled",!e)}}),c.click((function(e){0===t.val().length&&($("#edit-empty-content-modal").modal({onApprove:function(){$(".edit.form").submit()}}).modal("show"),e.preventDefault())}))}}function b(){$(".user.settings.profile").length>0&&$("#username").keyup((function(){var e=$("#name-change-prompt");$(this).val().toString().toLowerCase()!==$(this).data("name").toString().toLowerCase()?e.show():e.hide()}))}function w(){$(".ui.button").keypress((function(e){13!==e.keyCode&&32!==e.keyCode||$(this).click()}))}function k(){$(".code-view .linenums").length>0&&($(document).on("click",".lines-num span",(function(e){var t=$(this),a=t.parent().siblings(".lines-code").find("ol.linenums > li");q(a,a.filter("[rel=".concat(t.attr("id"),"]")),e.shiftKey?a.filter(".active").eq(0):null),window.getSelection?window.getSelection().removeAllRanges():document.selection.empty()})),$(window).on("hashchange",(function(){var e,t=window.location.hash.match(/^#(L\d+)-(L\d+)$/),a=$(".code-view ol.linenums > li");if(t)return e=a.filter(".".concat(t[1])),q(a,e,a.filter(".".concat(t[2]))),void $("html, body").scrollTop(e.offset().top-200);(t=window.location.hash.match(/^#(L|n)(\d+)$/))&&(e=a.filter(".L".concat(t[2])),q(a,e),$("html, body").scrollTop(e.offset().top-200))})).trigger("hashchange"))}function _(e){$.ajax({url:"".concat(n,"/user/u2f/sign"),type:"POST",headers:{"X-Csrf-Token":i},data:JSON.stringify(e),contentType:"application/json; charset=utf-8"}).done((function(e){window.location.replace(e)})).fail((function(){C(1)}))}function y(e){(function(e){if(!("errorCode"in e))return!1;if(0===e.errorCode)return!1;return C(e.errorCode),!0})(e)||$.ajax({url:"".concat(n,"/user/settings/security/u2f/register"),type:"POST",headers:{"X-Csrf-Token":i},data:JSON.stringify(e),contentType:"application/json; charset=utf-8",success:function(){u()},fail:function(){C(1)}})}function C(e){var 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"),Object.keys(t).forEach((function(a){a!==e&&t[a].addClass("hide")})),$("#u2f-error").modal("show")}function x(){$.post("".concat(n,"/user/settings/security/u2f/request_register"),{_csrf:i,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(y).catch((function(e){C(void 0!==e?e.metaData.code:1)}))})).fail((function(e){409===e.status&&$("#nickname").closest("div.field").addClass("error")}))}function S(e){window.history.pushState?window.history.pushState(null,null,e):window.location.hash=e}function q(e,t,a){if(e.removeClass("active"),a){var i,n=parseInt(t.attr("rel").substr(1)),o=parseInt(a.attr("rel").substr(1));if(n!==o){n>o&&(i=n,n=o,o=i);for(var r=[],s=n;s<=o;s++)r.push(".L".concat(s));return e.filter(r.join(",")).addClass("active"),void S("#L".concat(n,"-L").concat(o))}}t.addClass("active"),S("#".concat(t.attr("rel")))}function T(){var e=$(this),t="";e.attr("id")&&(t+="#".concat(e.attr("id")));var a=$(".delete.modal".concat(t));return a.find(".name").text(e.data("name")),a.modal({closable:!1,onApprove:function(){"form"!==e.data("type")?$.post(e.data("url"),{_csrf:i,id:e.data("id")}).done((function(e){window.location.href=e.redirect})):$(e.data("form")).submit()}}).modal("show"),!1}function L(){var e=$(this),t="";e.attr("id")&&(t+="#".concat(e.attr("id")));var a=$(".addall.modal".concat(t));return a.find(".name").text(e.data("name")),a.modal({closable:!1,onApprove:function(){"form"!==e.data("type")?$.post(e.data("url"),{_csrf:i,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),$.fn.getCursorPosition=function(){var e=$(this).get(0),t=0;if("selectionStart"in e)t=e.selectionStart;else if("selection"in document){e.focus();var a=document.selection.createRange(),i=document.selection.createRange().text.length;a.moveStart("character",-e.value.length),t=a.text.length-i}return t},$(document).ready((function(){if(i=$("meta[name=_csrf]").attr("content"),n=$("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)for(var e=[].slice.call(document.querySelectorAll("pre code")||[]),t=0;t<e.length;t++)hljs.highlightBlock(e[t]);var o=$("#dropzone");if(o.length>0){var r={};new Dropzone("#dropzone",{url:o.data("upload-url"),headers:{"X-Csrf-Token":i},maxFiles:o.data("max-file"),maxFilesize:o.data("max-size"),acceptedFiles:"*/*"===o.data("accepts")?null:o.data("accepts"),addRemoveLinks:!0,dictDefaultMessage:o.data("default-message"),dictInvalidFileType:o.data("invalid-input-type"),dictFileTooBig:o.data("file-too-big"),dictRemoveFile:o.data("remove-file"),init:function(){this.on("success",(function(e,t){r[e.name]=t.uuid;var a=$('<input id="'.concat(t.uuid,'" name="files" type="hidden">')).val(t.uuid);$(".files").append(a)})),this.on("removedfile",(function(e){e.name in r&&$("#".concat(r[e.name])).remove(),o.data("remove-url")&&o.data("csrf")&&$.post(o.data("remove-url"),{file:r[e.name],_csrf:o.data("csrf")})}))}})}emojify.setConfig({img_dir:"".concat(n,"/vendor/plugins/emojify/images"),ignore_emoticons:!0});for(var s=document.getElementsByClassName("has-emoji"),c=0;c<s.length;c++){emojify.run(s[c]);for(var h=0;h<s[c].childNodes.length;h++)"A"===s[c].childNodes[h].nodeName&&emojify.run(s[c].childNodes[h])}var y,S,q,D,A,O,j,F,R,N,z,I,M,B,P,E=new Clipboard(".clipboard");if(E.on("success",(function(e){e.clearSelection(),$("#".concat(e.trigger.getAttribute("id"))).popup("destroy"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-success")),$("#".concat(e.trigger.getAttribute("id"))).popup("show"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-original"))})),E.on("error",(function(e){$("#".concat(e.trigger.getAttribute("id"))).popup("destroy"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-error")),$("#".concat(e.trigger.getAttribute("id"))).popup("show"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-original"))})),$(".delete-button").click(T),$(".add-all-button").click(L),$(".delete-branch-button").click(T),$(".undo-button").click((function(){var e=$(this);$.post(e.data("url"),{_csrf:i,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(){var e=$(this);$.post(e.data("request-url"),{_csrf:i}).done((function(){window.location.href=e.data("done-url")}))})),$(".markdown").each((function(){var e={};$(this).find("h1, h2, h3, h4, h5, h6").each((function(){var t=$(this),a=encodeURIComponent(t.text().toLowerCase().replace(/[^\u00C0-\u1FFF\u2C00-\uD7FF\w\- ]/g,"").replace(/[ ]/g,"-")),i=a;e[a]>0&&(i="".concat(a,"-").concat(e[a])),void 0===e[a]?e[a]=1:e[a]+=1,(t=t.wrap('<div id="'.concat(i,'" class="anchor-wrap" ></div>'))).append('<a class="anchor" href="#'.concat(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(){var e=this.dataset.action,t=this.dataset.elementId,a=$(".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"),d(i,e,a,t).then((function(){"close"!==e&&"open"!==e||$('.issue-checkbox input[type="checkbox"]').each((function(e,t){t.checked=!1})),u()}))})),$('.issue-checkbox input[type="checkbox"]:checked').first().each((function(e,t){t.checked=!1,$(t).click()})),w(),$("#search-user-box").search({minCharacters:2,apiSettings:{url:"".concat(n,"/api/v1/users/search?q={query}"),onResponse:function(e){var t=[];return $.each(e.data,(function(e,i){var n=i.login;i.full_name&&i.full_name.length>0&&(n+=" (".concat(a(i.full_name),")")),t.push({title:n,image:i.avatar_url})})),{results:t}}},searchFields:["login","full_name"],showNoResults:!1}),(y=$("#search-team-box")).search({minCharacters:2,apiSettings:{url:"".concat(n,"/api/v1/orgs/").concat(y.data("org"),"/teams/search?q={query}"),headers:{"X-Csrf-Token":i},onResponse:function(e){var t=[];return $.each(e.data,(function(e,a){var i="".concat(a.name," (").concat(a.permission," access)");t.push({title:i})})),{results:t}}},searchFields:["name","description"],showNoResults:!1}),(S=$("#search-repo-box")).search({minCharacters:2,apiSettings:{url:"".concat(n,"/api/v1/repos/search?q={query}&uid=").concat(S.data("uid")),onResponse:function(e){var t=[];return $.each(e.data,(function(e,a){t.push({title:a.full_name.split("/")[1],description:a.full_name})})),{results:t}}},searchFields:["full_name"],showNoResults:!1}),f(),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(){var 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"));var 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(a,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")}))),p(),(q=function(){var e=$("#auth_username").val(),t=$("#clone_addr").val();!$("#mirror").is(":checked")&&e&&e.length>0&&void 0!==t&&(t.startsWith("https://github.com")||t.startsWith("http://github.com"))?$("#migrate_items").show():$("#migrate_items").hide()})(),$("#clone_addr").on("input",q),$("#auth_username").on("input",q),$("#mirror").on("change",q),function(){var e=$(".repository.wiki textarea#edit_area");if(e.length>0){var t=new SimpleMDE({autoDownloadFontAwesome:!1,element:e[0],forceSync:!0,previewRender:function(t,a){return setTimeout((function(){$.post(e.data("url"),{_csrf:i,mode:"gfm",context:e.data("context"),text:t},(function(e){a.innerHTML='<div class="markdown ui segment">'.concat(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){var t=e.codemirror,a=t.getSelection();if(t.replaceSelection("`".concat(a,"`")),!a){var i=t.getCursor();t.setCursor(i.line,i.ch-1)}t.focus()},className:"fa fa-angle-right",title:"Add Inline Code"},"code","quote","|",{name:"checkbox-empty",action:function(e){var t=e.codemirror;t.replaceSelection("\n- [ ] ".concat(t.getSelection())),t.focus()},className:"fa fa-square-o",title:"Add Checkbox (empty)"},{name:"checkbox-checked",action:function(e){var t=e.codemirror;t.replaceSelection("\n- [x] ".concat(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")}}(),l(),g(),0!==$(".organization").length&&$(".organization.settings.options").length>0&&$("#org_name").keyup((function(){var 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){$(".events.checkbox input").change((function(){$(this).is(":checked")&&$(".events.fields").show()})),$(".non-events.checkbox input").change((function(){$(this).is(":checked")&&$(".events.fields").hide()}));var e=function(){var e="POST"===$("#http_method").val();$("#content_type").parent().parent()[e?"show":"hide"]()};e(),$("#http_method").change((function(){e()})),$("#test-delivery").click((function(){var e=$(this);e.addClass("loading disabled"),$.post(e.data("link"),{_csrf:i}).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");var e=$(this).val();switch(e){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"),r()}"2"!==e&&"5"!==e||n(),"2"===e&&o()})),$("#auth_type").change(),$("#security_protocol").change(n),$("#use_paged_search").change(o),$("#oauth2_provider").change(r),$("#oauth2_use_custom_url").change(s)),$(".admin.edit.authentication").length>0){var e=$("#auth_type").val();"2"===e||"5"===e?($("#security_protocol").change(n),"2"===e&&$("#use_paged_search").change(o)):"6"===e&&($("#oauth2_provider").change(r),$("#oauth2_use_custom_url").change(s),r())}if($(".admin.notice")){var t=$("#detail-modal");$(".view-detail").click((function(){return t.find(".content p").text($(this).data("content")),t.modal("show"),!1}));var a=$(".select.table .ui.checkbox");$(".select.action").click((function(){switch($(this).data("action")){case"select-all":a.checkbox("check");break;case"deselect-all":a.checkbox("uncheck");break;case"inverse":a.checkbox("toggle")}})),$("#delete-selection").click((function(){var e=$(this);e.addClass("loading disabled");var t=[];a.each((function(){$(this).checkbox("is checked")&&t.push($(this).data("id"))})),$.post(e.data("link"),{_csrf:i,ids:t}).done((function(){window.location.href=e.data("redirect")}))}))}}function n(){$("#security_protocol").val()>0?$(".has-tls").show():$(".has-tls").hide()}function o(){$("#use_paged_search").prop("checked")?$(".search-page-size").show().find("input").attr("required","required"):$(".search-page-size").hide().find("input").removeAttr("required")}function r(){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()}s()}function s(){var 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($("#".concat(e,"_token_url")).val()),$("#oauth2_auth_url").val()||$("#oauth2_auth_url").val($("#".concat(e,"_auth_url")).val()),$("#oauth2_profile_url").val()||$("#oauth2_profile_url").val($("#".concat(e,"_profile_url")).val()),$("#oauth2_email_url").val()||$("#oauth2_email_url").val($("#".concat(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("")}}}(),k(),function(){var 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"".concat(this.suburl,"/api/v1/repos/search?sort=updated&order=desc&uid=").concat(this.uid,"&q=").concat(this.searchQuery,"&limit=").concat(this.searchLimit,"&mode=").concat(this.repoTypes[this.reposFilter].searchMode).concat("all"!==this.reposFilter?"&exclusive=1":"")},repoTypeCount:function(){return this.repoTypes[this.reposFilter].count}},mounted:function(){this.searchRepos(this.reposFilter);var 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){var t=this;this.isLoading=!0;var a=this.repoTypes[e].searchMode,i=this.searchURL,n=this.searchQuery;$.getJSON(i,(function(o,r,s){if(i===t.searchURL){t.repos=o.data;var c=s.getResponseHeader("X-Total-Count");""===n&&""===a&&(t.reposTotalCount=c),t.repoTypes[e].count=c}})).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()})),D=$("#navbar"),A=$("#navbar-expand-toggle"),O=!1,A.click((function(){(O=!O)?(D.addClass("shown"),A.addClass("active")):(D.removeClass("shown"),A.removeClass("active"))})),j=$("#manage_topic"),F=$("#topic_edit"),R=$("#repo-topics"),N=$("#save_topic"),z=$("#topic_edit .dropdown"),I=$("#topic_edit.ui.form"),B=$("div.hide#validate_prompt"),P={countPrompt:B.children("#count_prompt").text(),formatPrompt:B.children("#format_prompt").text()},B.remove(),M=P,j.click((function(){R.hide(),F.css("display","")})),N.click((function(){var e=$("input[name=topics]").val();$.post(N.data("link"),{_csrf:i,topics:e},(function(t,a,i){if("ok"===i.responseJSON.status){if(R.children(".topic").remove(),e.length)for(var n=e.split(","),o=R.children("a").last(),r=0;r<n.length;r++)$('<div class="ui small label topic" style="cursor:pointer;">'.concat(n[r],"</div>")).insertBefore(o);F.css("display","none"),R.show()}})).fail((function(t){if(422===t.status)if(t.responseJSON.invalidTopics.length>0){M.formatPrompt=t.responseJSON.message;var a=t.responseJSON.invalidTopics,i=z.children("a.ui.label");e.split(",").forEach((function(e,t){for(var n=0;n<a.length;n++)a[n]===e&&i.eq(t).removeClass("green").addClass("red")}))}else M.countPrompt=t.responseJSON.message})).always((function(){I.form("validate form")}))})),z.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:"".concat(n,"/api/v1/topics/search?q={query}"),throttle:500,cache:!1,onResponse:function(e){var t={success:!1,results:[]},a=this.urlData.query.trim().replace(/<[^>]*>?/gm,""),i=!1,n=[];if(z.find("div.label.visible.topic,a.label.visible").each((function(e,t){n.push(t.dataset.value)})),e.topics){for(var o=!1,r=0;r<e.topics.length;r++)-1===n.indexOf(e.topics[r].topic_name)&&(e.topics[r].topic_name.toLowerCase()===a.toLowerCase()&&(i=!0),t.results.push({description:e.topics[r].topic_name,"data-value":e.topics[r].topic_name}),o=!0);t.success=o}return a.length>0&&!i?(t.success=!0,t.results.unshift({description:a,"data-value":a})):a.length>0&&i&&t.results.sort((function(e,t){return e.description.toLowerCase()===a.toLowerCase()?-1:t.description.toLowerCase()===a.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,a){e=e.toLowerCase().trim(),$(a).attr("data-value",e),$(a).attr("data-text",e)}}),$.fn.form.settings.rules.validateTopic=function(e,t){var a=z.children("a.ui.label"),i=0===a.length||a.last().attr("data-value").match(t);return i||a.last().removeClass("green").addClass("red"),i&&0===z.children("a.ui.label.red").length},I.form({on:"change",inline:!0,fields:{topics:{identifier:"topics",rules:[{type:"validateTopic",value:/^[a-z0-9][a-z0-9-]{1,35}$/,prompt:M.formatPrompt},{type:"maxCount[25]",prompt:M.countPrompt}]}}}),0!==$("#wait-for-key").length&&u2fApi.ensureSupport().then((function(){$.getJSON("".concat(n,"/user/u2f/challenge")).success((function(e){u2fApi.sign(e.appId,e.challenge,e.registeredKeys,30).then(_).catch((function(e){C(void 0!==e?e.metaData.code:1)}))}))})).catch((function(){window.location.href="".concat(n,"/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(x).catch((function(){C("browser")}))})),function(){var e=$("#repolink").val(),t=$("#repoId").val(),i=$("#crossRepoSearch").val(),o="".concat(n,"/api/v1/repos/").concat(e,"/issues?q={query}");"true"===i&&(o="".concat(n,"/api/v1/repos/issues/search?q={query}&priority_repo_id=").concat(t));$("#new-dependency-drop-list").dropdown({apiSettings:{url:o,onResponse:function(e){var t={success:!0,results:[]},i=$("#new-dependency-drop-list").data("issue-id");return $.each(e,(function(e,n){n.id!==i&&t.results.push({name:"#".concat(n.number," ").concat(a(n.title),'<div class="text small dont-break-out">').concat(a(n.repository.full_name),"</div>"),value:n.id})})),t},cache:!1},fullTextSearch:!0}),$(".menu a.label-filter-item").each((function(){$(this).click((function(e){if(e.altKey){e.preventDefault();var t=$(this).attr("href"),a=$(this).data("label-id"),i="labels=(-?[0-9]+%2c)*(".concat(a,")(%2c-?[0-9]+)*&");window.location=t.replace(new RegExp(i),"labels=$1-$2$3&")}}))})),$(".menu .ui.dropdown.label-filter").keydown((function(e){if(e.altKey&&13===e.keyCode){var t=$(".menu .ui.dropdown.label-filter .menu .item.selected");if(t.length>0){var a=$(t[0]),i=a.attr("href"),n=a.data("label-id"),o="labels=(-?[0-9]+%2c)*(".concat(n,")(%2c-?[0-9]+)*&");window.location=i.replace(new RegExp(o),"labels=$1-$2$3&")}}}))}(),$(".title_wip_desc > a").click((function(e){e.preventDefault();var t=$("#issue_title");t.focus();var a=t.val().trim().toUpperCase();for(var i in wipPrefixes)if(a.startsWith(wipPrefixes[i].toUpperCase()))return;t.val("".concat(wipPrefixes[0]," ").concat(t.val()))})),$(".show-outdated").on("click",(function(e){e.preventDefault();var t=$(this).data("comment");$(this).addClass("hide"),$("#code-comments-".concat(t)).removeClass("hide"),$("#code-preview-".concat(t)).removeClass("hide"),$("#hide-outdated-".concat(t)).removeClass("hide")})),$(".hide-outdated").on("click",(function(e){e.preventDefault();var t=$(this).data("comment");$(this).addClass("hide"),$("#code-comments-".concat(t)).addClass("hide"),$("#code-preview-".concat(t)).addClass("hide"),$("#show-outdated-".concat(t)).removeClass("hide")})),$("button.comment-form-reply").on("click",(function(e){e.preventDefault(),$(this).hide();var t=$(this).parent().find(".comment-form");t.removeClass("hide"),m(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(){var 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")){e.preventDefault();var t=$(this).closest(".code-diff").hasClass("code-diff-split"),a=$(this).data("side"),i=$(this).data("idx"),n=$(this).data("path"),o=$("#pull_review_add_comment").html(),r=$(this).closest("tr"),s=r.next();s.hasClass("add-comment")||(s=$('<tr class="add-comment">'.concat(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>")),r.after(s));var c=s.find(".add-comment-".concat(a)),l=c.find(".comment-code-cloud");0===l.length&&(c.html(o),m((l=c.find(".comment-code-cloud")).find(".menu")),c.find("input[name='line']").val(i),c.find("input[name='side']").val("left"===a?"previous":"proposed"),c.find("input[name='path']").val(n)),l.find("textarea").focus()}}))),function e(){var t=$("#repo_migrating");if($("#repo_migrating_failed").hide(),t){var a=t.attr("repo");if(void 0===a)return;$.ajax({type:"GET",url:"".concat(n,"/").concat(a,"/status"),data:{_csrf:i},complete:function(t){if(200===t.status&&t.responseJSON)return 0===t.responseJSON.status?void window.location.reload():void setTimeout((function(){e()}),2e3);$("#repo_migrating_progress").hide(),$("#repo_migrating_failed").show()}})}}(),function(){var e=$("#repo_template"),t=function(){var t=$("#template_units"),a=$("#non_template");""!==e.val()?(t.show(),a.hide()):(t.hide(),a.show())};e.change(t),t();var i=function(){$("#repo_template_search").dropdown({apiSettings:{url:"".concat(n,"/api/v1/repos/search?q={query}&template=true&priority_owner_id=").concat($("#uid").val()),onResponse:function(e){var t={success:!0,results:[]};return t.results.push({name:"",value:""}),$.each(e.data,(function(e,i){t.results.push({name:a(i.full_name),value:i.id})})),t},cache:!1},fullTextSearch:!0})};$("#uid").change(i),i()}(),$("#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()}var J,V={"div.user.settings":b,"div.repository.settings.collaboration":v};for(J in V)if($(J).length>0){V[J]();break}var H=$("#clone_addr");H.change((function(){var e=$("#repo_name");H.val().length>0&&0===e.val().length&&e.val(H.val().match(/^(.*\/)?((.+?)(\.git)?)$/)[3])}))})),$((function(){0===$(".user.signin").length&&$("form:not(.ignore-dirty)").areYouSure(),$("#ssh-key-content").on("change paste keyup",(function(){var 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,a){var i=document.getElementById(e);if(i){(a=a||{}).contributions=a.contributions||"contributions",a.no_contributions=a.no_contributions||"No contributions";var n=["${","}"];Vue.component("activity-heatmap",{delimiters:n,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){var t=this;$.get("".concat(this.suburl,"/api/v1/users/").concat(e,"/heatmap"),(function(e){for(var a=[],i=0;i<e.length;i++)t.totalContributions+=e[i].contributions,a[i]={date:new Date(1e3*e[i].timestamp),count:e[i].contributions};t.values=a,t.isLoading=!1}))},getColor:function(e){var t=document.createElement("div");t.className="heatmap-color-".concat(e),document.body.appendChild(t);var a=getComputedStyle(t).backgroundColor;return document.body.removeChild(t),a}},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:n,el:i,data:{suburl:document.querySelector("meta[name=_suburl]").content,heatmapUser:t,locale:a}})}},$(".commit-button").click((function(e){e.preventDefault(),$(this).parent().find(".commit-body").toggle()})),window.toggleDeadlineForm=function(){$("#deadlineForm").fadeToggle(150)},window.setDeadline=function(){var e=$("#deadlineDate").val();window.updateDeadline(e)},window.updateDeadline=function(e){$("#deadline-err-invalid-date").hide(),$("#deadline-loader").addClass("loading");var t=null;if(""!==e){var a=Date.parse(e);if(Number.isNaN(a))return $("#deadline-loader").removeClass("loading"),$("#deadline-err-invalid-date").show(),!1;t=new Date(a)}$.ajax("".concat($("#update-issue-deadline-form").attr("action"),"/deadline"),{data:JSON.stringify({due_date:t}),headers:{"X-Csrf-Token":i,"X-Remote":!0},contentType:"application/json",type:"POST",success:function(){u()},error:function(){$("#deadline-loader").removeClass("loading"),$("#deadline-err-invalid-date").show()}})},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){var 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(){var e=$("#oauth2-login-loader"),t=$("#oauth2-login-navigator");t.hide(),e.removeClass("disabled"),setTimeout((function(){e.addClass("disabled"),t.show()}),5e3)}},function(e,t){$((function(){var e=[];document.getElementById("graph-canvas")&&($("#graph-raw-list li span.node-relation").each((function(){e.push($(this).text())})),gitGraph(document.getElementById("graph-canvas"),e))}))}]);
+!function(e){var t={};function a(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=t,a.d=function(e,t,i){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(a.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(i,n,function(t){return e[t]}.bind(null,n));return i},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=0)}([function(e,t,a){a(1),e.exports=a(2)},function(e,t){function a(e){return jQuery("<div />").text(e).html()}var i,n,o,r,s;function c(e){var t=e.find(".tabular.menu");t.find(".item").tab(),t.find('.item[data-tab="'.concat(t.data("preview"),'"]')).click((function(){var a=$(this);$.post(a.data("url"),{_csrf:i,mode:"gfm",context:a.data("context"),text:e.find('.tab.segment[data-tab="'.concat(t.data("write"),'"] textarea')).val()},(function(a){var i=e.find('.tab.segment[data-tab="'.concat(t.data("preview"),'"]'));i.html(a),emojify.run(i[0]),$("pre code",i[0]).each((function(){hljs.highlightBlock(this)}))}))})),w()}function l(){var e,t;0!==$(".edit.form").length&&(!function(e){var t=e.find(".tabular.menu");t.find(".item").tab();var a=t.find('.item[data-tab="'.concat(t.data("preview"),'"]'));a.length&&(o=a.data("preview-file-modes").split(","),a.click((function(){var a=$(this);$.post(a.data("url"),{_csrf:i,mode:"gfm",context:a.data("context"),text:e.find('.tab.segment[data-tab="'.concat(t.data("write"),'"] textarea')).val()},(function(a){var i=e.find('.tab.segment[data-tab="'.concat(t.data("preview"),'"]'));i.html(a),emojify.run(i[0]),$("pre code",i[0]).each((function(){hljs.highlightBlock(this)}))}))})))}($(".edit.form")),e=$(".edit.form"),(t=e.find(".tabular.menu")).find(".item").tab(),t.find('.item[data-tab="'.concat(t.data("diff"),'"]')).click((function(){var a=$(this);$.post(a.data("url"),{_csrf:i,context:a.data("context"),content:e.find('.tab.segment[data-tab="'.concat(t.data("write"),'"] textarea')).val()},(function(a){var i=e.find('.tab.segment[data-tab="'.concat(t.data("diff"),'"]'));i.html(a),emojify.run(i[0])}))})))}function d(e,t,a,n){return new Promise((function(o){$.ajax({type:"POST",url:e,data:{_csrf:i,action:t,issue_ids:a,id:n},success:o})}))}function u(){window.location.reload()}function h(e){e.each((function(){var e=this;e.addEventListener("paste",(function(t){!function(e,t){if(e.clipboardData){var a=e.clipboardData.items;if(void 0!==a)for(var i=0;i<a.length;i++)if(-1!==a[i].type.indexOf("image")){var n=a[i].getAsFile();"function"==typeof t&&(e.preventDefault(),e.stopPropagation(),t(n))}}}(t,(function(t){var a=t.name.substr(0,t.name.lastIndexOf("."));!function(e,t){if(e.selectionStart||0===e.selectionStart){var a=e.selectionStart,i=e.selectionEnd;e.value=e.value.substring(0,a)+t+e.value.substring(i,e.value.length),e.selectionStart=a+t.length,e.selectionEnd=a+t.length}else e.value+=t}(e,"![".concat(a,"]()")),function(e,t){var a=new XMLHttpRequest;a.onload=function(){200===a.status&&t(a.responseText)},a.open("post","".concat(n,"/attachments"),!0),a.setRequestHeader("X-Csrf-Token",i);var o=new FormData;o.append("file",e,e.name),a.send(o)}(t,(function(t){var i=JSON.parse(t);!function(e,t,a){if(e.selectionStart||0===e.selectionStart){var i=e.selectionStart,n=e.selectionEnd;e.value=e.value.replace(t,a),e.selectionStart=i+a.length-t.length,e.selectionEnd=n+a.length-t.length}else e.value=e.value.replace(t,a)}(e,"![".concat(a,"]()"),"![".concat(a,"](").concat(n,"/attachments/").concat(i.uuid,")"));var o=$('<input id="'.concat(i.uuid,'" name="files" type="hidden">')).val(i.uuid);$(".files").append(o)}))}))}),!1)}))}function f(){var e;0!==$(".comment.form").length&&((e=$(".ui.select-branch")).find(".reference-list-menu").find(".item:not(.no-select)").click((function(){var 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})),c($(".comment.form")),h($(".comment.form textarea")),t("select-label","labels"),t("select-assignees","assignees"),t("select-assignees-modify","assignees"),i(".select-milestone","#milestone_id"),i(".select-assignee","#assignee_id"));function t(e,t){var a=$(".ui.".concat(t,".list")),i=a.find(".no-select"),n=$(".".concat(e," .menu")),o="update"===n.data("action"),r={};$(".".concat(e)).dropdown("setting","onHide",(function(){if(o="update"===n.data("action")){var e=[];Object.keys(r).forEach((function(t){var a=r[t],i=d(a["update-url"],a.action,a["issue-id"],t);e.push(i)})),Promise.all(e).then(u)}})),n.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")),d(n.data("update-url"),"",n.data("issue-id"),$(this).data("id")),n.data("action","update"),!1;$(this).hasClass("checked")?($(this).removeClass("checked"),$(this).find(".octicon").removeClass("octicon-check"),o&&($(this).data("id")in r?delete r[$(this).data("id")]:r[$(this).data("id")]={"update-url":n.data("update-url"),action:"detach","issue-id":n.data("issue-id")})):($(this).addClass("checked"),$(this).find(".octicon").addClass("octicon-check"),o&&($(this).data("id")in r?delete r[$(this).data("id")]:r[$(this).data("id")]={"update-url":n.data("update-url"),action:"attach","issue-id":n.data("issue-id")}));var 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})),n.find(".no-select.item").click((function(){(o||"select-assignees-modify"===e)&&d(n.data("update-url"),"clear",n.data("issue-id"),"").then(u),$(this).parent().find(".item").each((function(){$(this).removeClass("checked"),$(this).find(".octicon").removeClass("octicon-check")})),a.find(".item").each((function(){$(this).addClass("hide")})),i.removeClass("hide"),$($(this).parent().data("id")).val("")}))}function i(e,t){var i=$("".concat(e," .menu")),n=$(".ui".concat(e,".list")),o="update"===i.data("action");i.find(".item:not(.no-select)").click((function(){switch($(this).parent().find(".item").each((function(){$(this).removeClass("selected active")})),$(this).addClass("selected active"),o&&d(i.data("update-url"),"",i.data("issue-id"),$(this).data("id")).then(u),t){case"#milestone_id":n.find(".selected").html('<a class="item" href='.concat($(this).data("href"),">").concat(a($(this).text()),"</a>"));break;case"#assignee_id":n.find(".selected").html('<a class="item" href='.concat($(this).data("href"),">")+'<img class="ui avatar image" src='.concat($(this).data("avatar"),">").concat(a($(this).text()),"</a>"))}$(".ui".concat(e,".list .no-select")).addClass("hide"),$(t).val($(this).data("id"))})),i.find(".no-select.item").click((function(){$(this).parent().find(".item:not(.no-select)").each((function(){$(this).removeClass("selected active")})),o&&d(i.data("update-url"),"",i.data("issue-id"),$(this).data("id")).then(u),n.find(".selected").html(""),n.find(".no-select").removeClass("hide"),$(t).val("")}))}}function p(){if(0!==$(".repository").length){if(($(".repository.file.list").length>0||".repository.commits".length>0)&&$(".choose.reference .dropdown").each((function(){var 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(){var 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(){var 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(){var 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){var 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(){var e=this;Vue.nextTick((function(){e.$refs.searchField.focus()}))},getSelected:function(){for(var e=0,t=this.items.length;e<t;++e)if(this.items[e].selected)return this.items[e];return null},getSelectedIndexInFiltered:function(){for(var e=0,t=this.filteredItems.length;e<t;++e)if(this.filteredItems[e].selected)return e;return-1},scrollToActive:function(){var e=this.$refs["listItem".concat(this.active)];if(e&&0!==e.length){Array.isArray(e)&&(e=e[0]);var 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){var 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&&d(".choose.page .dropdown"),$(".repository.settings.options").length>0&&($("#repo_name").keyup((function(){var 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){var 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(){var 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){var t=$(".milestone.datepicker");t.datetimepicker({lang:t.data("lang"),inline:!0,timepicker:!1,startDate:t.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){var a=$("#issue-title"),n=$("#edit-title-input input"),o=function(){return a.toggle(),$(".not-in-edit").toggle(),$("#edit-title-input").toggle(),$(".in-edit").toggle(),n.focus(),!1};$("#edit-title").click(o),$("#cancel-edit-title").click(o),$("#save-edit-title").click(o).click((function(){return 0===n.val().length||n.val()===a.text()?(n.val(a.text()),!1):($.post($(this).data("update-url"),{_csrf:i,title:n.val()},(function(e){n.val(e.title),a.text(e.title),u()})),!1)})),$(".edit-content").click((function(){var e,t=$(this).parent().parent().parent().next(),a=t.find(".edit-content-zone"),n=t.find(".render-content"),o=t.find(".raw-content");if(0===a.html().length){a.html($("#edit-content-form").html()),e=a.find("textarea"),issuesTribute.attach(e.get()),emojiTribute.attach(e.get());var r=a.find(".dropzone");r.data("saved",!1);var s=a.find(".comment-files");if(r.length>0){var l={};r.dropzone({url:r.data("upload-url"),headers:{"X-Csrf-Token":i},maxFiles:r.data("max-file"),maxFilesize:r.data("max-size"),acceptedFiles:"*/*"===r.data("accepts")?null:r.data("accepts"),addRemoveLinks:!0,dictDefaultMessage:r.data("default-message"),dictInvalidFileType:r.data("invalid-input-type"),dictFileTooBig:r.data("file-too-big"),dictRemoveFile:r.data("remove-file"),init:function(){this.on("success",(function(e,t){l[e.name]={uuid:t.uuid,submitted:!1};var a=$('<input id="'.concat(t.uuid,'" name="files" type="hidden">')).val(t.uuid);s.append(a)})),this.on("removedfile",(function(e){e.name in l&&($("#".concat(l[e.name].uuid)).remove(),r.data("remove-url")&&r.data("csrf")&&!l[e.name].submitted&&$.post(r.data("remove-url"),{file:l[e.name].uuid,_csrf:r.data("csrf")}))})),this.on("submit",(function(){$.each(l,(function(e){l[e].submitted=!0}))})),this.on("reload",(function(){$.getJSON(a.data("attachment-url"),(function(e){var t=r.get(0).dropzone;t.removeAllFiles(!0),s.empty(),$.each(e,(function(){var e="".concat(r.data("upload-url"),"/").concat(this.uuid);t.emit("addedfile",this),t.emit("thumbnail",this,e),t.emit("complete",this),t.files.push(this),l[this.name]={submitted:!0,uuid:this.uuid},r.find("img[src='".concat(e,"']")).css("max-width","100%");var a=$('<input id="'.concat(this.uuid,'" name="files" type="hidden">')).val(this.uuid);s.append(a)}))}))}))}}),r.get(0).dropzone.emit("reload")}var d=a.find(".ui.comment.form"),u=d.find(".tabular.menu");u.attr("data-write",a.data("write")),u.attr("data-preview",a.data("preview")),u.find(".write.item").attr("data-tab",a.data("write")),u.find(".preview.item").attr("data-tab",a.data("preview")),d.find(".write.segment").attr("data-tab",a.data("write")),d.find(".preview.segment").attr("data-tab",a.data("preview")),c(d),a.find(".cancel.button").click((function(){n.show(),a.hide(),r.get(0).dropzone.emit("reload")})),a.find(".save.button").click((function(){n.show(),a.hide();var o=s.find("[name=files]").map((function(){return $(this).val()})).get();$.post(a.data("update-url"),{_csrf:i,content:e.val(),context:a.data("context"),files:o},(function(e){0===e.length?n.html($("#no-content").html()):(n.html(e.content),emojify.run(n[0]),$("pre code",n[0]).each((function(){hljs.highlightBlock(this)})));var a=t.parent();a.find(".ui.small.images").length?""===e.attachments?a.find(".ui.small.images").parent().remove():a.find(".ui.small.images").html(e.attachments):""!==e.attachments&&(a.append('<div class="ui bottom attached segment"><div class="ui small images"></div></div>'),a.find(".ui.small.images").html(e.attachments)),r.get(0).dropzone.emit("submit"),r.get(0).dropzone.emit("reload")}))}))}else e=t.find("textarea");return a.show(),n.hide(),0===e.val().length&&e.val(o.text()),e.focus(),!1})),$(".delete-comment").click((function(){var e=$(this);return window.confirm(e.data("locale"))&&$.post(e.data("url"),{_csrf:i}).success((function(){$("#".concat(e.data("comment-id"))).remove()})),!1}));var r=$("#status-button");$("#comment-form .edit_area").keyup((function(){0===$(this).val().length?r.text(r.data("status")):r.text(r.data("status-and-comment"))})),r.click((function(){$("#status").val(r.data("status-val")),$("#comment-form").submit()}));var s=$(".merge-button > button");s.on("click",(function(e){e.preventDefault(),$(".".concat($(this).data("do"),"-fields")).show(),$(this).parent().hide()})),$(".merge-button > .dropdown").dropdown({onChange:function(e,t,a){a.data("do")&&(s.find(".button-text").text(a.text()),s.data("do",a.data("do")))}}),$(".merge-cancel").on("click",(function(e){e.preventDefault(),$(this).closest(".form").hide(),s.parent().show()})),function e(t){var a="";t||(t=$(document),a=".reactions > "),t.find("".concat(a,"a.label")).popup({position:"bottom left",metadata:{content:"title",title:"none"}}),t.find(".select-reaction > .menu > .item, ".concat(a,"a.label")).on("click",(function(t){var a=this;if(t.preventDefault(),!$(this).hasClass("disabled")){var n=$(this).hasClass("item")?$(this).closest(".select-reaction").data("action-url"):$(this).data("action-url"),o="".concat(n,"/").concat($(this).hasClass("blue")?"unreact":"react");$.ajax({type:"POST",url:o,data:{_csrf:i,content:$(this).data("content")}}).done((function(t){if(t&&(t.html||t.empty)){var i=$(a).closest(".content"),n=i.find(".segment.reactions");if(!t.empty&&n.length>0&&n.remove(),!t.empty){n=$('<div class="ui attached segment reactions"></div>');var o=i.find(".segment.bottom:first");o.length>0?n.insertBefore(o):n.appendTo(i),n.html(t.html);for(var r=n.find(".has-emoji"),s=0;s<r.length;s++)emojify.run(r.get(s));n.find(".dropdown").dropdown(),e(n)}}}))}}))}()}$(".repository.diff").length>0&&$(".diff-counter").each((function(){var e=$(this),t=e.find("span[data-line].add").data("line"),a=e.find("span[data-line].del").data("line"),i=parseFloat(t)/(parseFloat(t)+parseFloat(a))*100;e.find(".bar .add").css("width","".concat(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()}));var l=$(".repository.compare.pull");l.length>0&&(d(".choose.branch .dropdown"),l.find("button.show-form").on("click",(function(e){e.preventDefault(),l.find(".pullrequest-form").show(),$(this).parent().hide()}))),$(".repository.settings.branches").length>0&&(d(".protected-branches .dropdown"),$(".enable-protection, .enable-whitelist").change((function(){this.checked?$($(this).data("target")).removeClass("disabled"):$($(this).data("target")).addClass("disabled")})))}function d(e){var t=$(e);t.dropdown({fullTextSearch:!0,selectOnKeydown:!1,onChange:function(e,t,a){a.data("url")&&(window.location.href=a.data("url"))},message:{noResults:t.data("no-results")}})}}function m(e){var 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(){var e=$(this).attr("data-tab")+t;$(this).attr("data-tab",e)})),e.parent().find("*[data-tab='write']").attr("data-tab","write".concat(t)),e.parent().find("*[data-tab='preview']").attr("data-tab","preview".concat(t)),c(e.parent(".form")),t}function v(){$(".access-mode.menu .item").click((function(){var e=$(this).parent();$.post(e.data("url"),{_csrf:i,uid:e.data("uid"),mode:$(this).data("value")})}))}function g(){$(".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"))}));var e=$("#file-name");e.keyup((function(e){var t,a,i=$(".breadcrumb span.section"),n=$(".breadcrumb div.divider");if(8===e.keyCode&&0===$(this).getCursorPosition()&&i.length>0&&(t=i.last().find("a").text(),$(this).val(t+$(this).val()),$(this)[0].setSelectionRange(t.length,t.length),i.last().remove(),n.last().remove()),191===e.keyCode){a=$(this).val().split("/");for(var o=0;o<a.length;++o)t=a[o],o<a.length-1?t.length&&($('<span class="section"><a href="#">'.concat(t,"</a></span>")).insertBefore($(this)),$('<div class="divider"> / </div>').insertBefore($(this))):$(this).val(t),$(this)[0].setSelectionRange(0,0)}a=[],$(".breadcrumb span.section").each((function(){var e=$(this);e.find("a").length?a.push(e.find("a").text()):a.push(e.text())})),$(this).val()&&a.push($(this).val()),$("#tree_path").val(a.join("/"))})).trigger("keyup");var t=$(".repository.editor textarea#edit_area");if(t.length){var a=t.data("markdown-file-exts").split(","),n=t.data("line-wrap-extensions").split(",");e.on("keyup",(function(){var c,l,d,u,h,f,p=e.val();d=u="";var m=/.+\.([^.]+)$/.exec(p);m&&(d=m[1],u=".".concat(d));var v=CodeMirror.findModeByExtension(d),g=$("a[data-tab=preview]");if(v?(c=v.mode,l=v.mime,f=c):f=d,g.length&&f&&o&&o.length&&o.indexOf(f)>=0?(h=g.data("url"),g.data("url",h.replace(/(.*)\/.*/i,"$1/".concat(c))),g.show()):g.hide(),!(a.indexOf(u)>=0&&function(e){return s&&(s.toTextArea(),s=null),!!r||(r=new SimpleMDE({autoDownloadFontAwesome:!1,element:e[0],forceSync:!0,renderingConfig:{singleLineBreaks:!1},indentWithTabs:!1,tabSize:4,spellChecker:!1,previewRender:function(t,a){return setTimeout((function(){$.post(e.data("url"),{_csrf:i,mode:"gfm",context:e.data("context"),text:t},(function(e){a.innerHTML='<div class="markdown ui segment">'.concat(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))&&(s||function(e){return r&&(r.toTextArea(),r=null),!!s||((s=CodeMirror.fromTextArea(e[0],{lineNumbers:!0})).on("change",(function(t,a){e.val(t.getValue())})),!0)}(t))){c&&(s.setOption("mode",l),CodeMirror.autoLoadMode(s,c)),n.indexOf(u)>=0?s.setOption("lineWrapping",!0):s.setOption("lineWrapping",!1);var 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?(s.setOption("indentWithTabs",!0),s.setOption("extraKeys",{})):(s.setOption("indentWithTabs",!1),s.setOption("extraKeys",{Tab:function(e){var t=Array(parseInt(e.getOption("indentUnit"))+1).join(" ");e.replaceSelection(t)}})),s.setOption("indentUnit",e.indent_size||4),s.setOption("tabSize",e.tab_width||4)})))}})).trigger("keyup");var c=$("#commit-button"),l=$(".ui.edit.form");c.prop("disabled",!0),l.areYouSure({silent:!0,dirtyClass:"dirty-file",fieldSelector:":input:not(.commit-form-wrapper :input)",change:function(){var e=$(this).hasClass("dirty-file");c.prop("disabled",!e)}}),c.click((function(e){0===t.val().length&&($("#edit-empty-content-modal").modal({onApprove:function(){$(".edit.form").submit()}}).modal("show"),e.preventDefault())}))}}function b(){$(".user.settings.profile").length>0&&$("#username").keyup((function(){var e=$("#name-change-prompt");$(this).val().toString().toLowerCase()!==$(this).data("name").toString().toLowerCase()?e.show():e.hide()}))}function w(){$(".ui.button").keypress((function(e){13!==e.keyCode&&32!==e.keyCode||$(this).click()}))}function k(){$(".code-view .linenums").length>0&&($(document).on("click",".lines-num span",(function(e){var t=$(this),a=t.parent().siblings(".lines-code").find("ol.linenums > li");q(a,a.filter("[rel=".concat(t.attr("id"),"]")),e.shiftKey?a.filter(".active").eq(0):null),window.getSelection?window.getSelection().removeAllRanges():document.selection.empty()})),$(window).on("hashchange",(function(){var e,t=window.location.hash.match(/^#(L\d+)-(L\d+)$/),a=$(".code-view ol.linenums > li");if(t)return e=a.filter(".".concat(t[1])),q(a,e,a.filter(".".concat(t[2]))),void $("html, body").scrollTop(e.offset().top-200);(t=window.location.hash.match(/^#(L|n)(\d+)$/))&&(e=a.filter(".L".concat(t[2])),q(a,e),$("html, body").scrollTop(e.offset().top-200))})).trigger("hashchange")),$(".ui.fold-code").on("click",(function(e){var t=$(e.target);t.hasClass("fa-chevron-down")?$(e.target).parent().next().slideUp("fast",(function(){t.removeClass("fa-chevron-down").addClass("fa-chevron-right")})):$(e.target).parent().next().slideDown("fast",(function(){t.removeClass("fa-chevron-right").addClass("fa-chevron-down")}))})),$(".ui.blob-excerpt").on("click",(function(e){!function e(t){var a=$(t.target),i=a.parent().parent();$.get("".concat(a.data("url"),"?").concat(a.data("query"),"&anchor=").concat(a.data("anchor")),(function(t){i.replaceWith(t),$('[data-anchor="'.concat(a.data("anchor"),'"]')).on("click",(function(t){e(t)}))}))}(e)}))}function _(e){$.ajax({url:"".concat(n,"/user/u2f/sign"),type:"POST",headers:{"X-Csrf-Token":i},data:JSON.stringify(e),contentType:"application/json; charset=utf-8"}).done((function(e){window.location.replace(e)})).fail((function(){C(1)}))}function y(e){(function(e){if(!("errorCode"in e))return!1;if(0===e.errorCode)return!1;return C(e.errorCode),!0})(e)||$.ajax({url:"".concat(n,"/user/settings/security/u2f/register"),type:"POST",headers:{"X-Csrf-Token":i},data:JSON.stringify(e),contentType:"application/json; charset=utf-8",success:function(){u()},fail:function(){C(1)}})}function C(e){var 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"),Object.keys(t).forEach((function(a){a!==e&&t[a].addClass("hide")})),$("#u2f-error").modal("show")}function x(){$.post("".concat(n,"/user/settings/security/u2f/request_register"),{_csrf:i,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(y).catch((function(e){C(void 0!==e?e.metaData.code:1)}))})).fail((function(e){409===e.status&&$("#nickname").closest("div.field").addClass("error")}))}function S(e){window.history.pushState?window.history.pushState(null,null,e):window.location.hash=e}function q(e,t,a){if(e.removeClass("active"),a){var i,n=parseInt(t.attr("rel").substr(1)),o=parseInt(a.attr("rel").substr(1));if(n!==o){n>o&&(i=n,n=o,o=i);for(var r=[],s=n;s<=o;s++)r.push(".L".concat(s));return e.filter(r.join(",")).addClass("active"),void S("#L".concat(n,"-L").concat(o))}}t.addClass("active"),S("#".concat(t.attr("rel")))}function T(){var e=$(this),t="";e.attr("id")&&(t+="#".concat(e.attr("id")));var a=$(".delete.modal".concat(t));return a.find(".name").text(e.data("name")),a.modal({closable:!1,onApprove:function(){"form"!==e.data("type")?$.post(e.data("url"),{_csrf:i,id:e.data("id")}).done((function(e){window.location.href=e.redirect})):$(e.data("form")).submit()}}).modal("show"),!1}function L(){var e=$(this),t="";e.attr("id")&&(t+="#".concat(e.attr("id")));var a=$(".addall.modal".concat(t));return a.find(".name").text(e.data("name")),a.modal({closable:!1,onApprove:function(){"form"!==e.data("type")?$.post(e.data("url"),{_csrf:i,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),$.fn.getCursorPosition=function(){var e=$(this).get(0),t=0;if("selectionStart"in e)t=e.selectionStart;else if("selection"in document){e.focus();var a=document.selection.createRange(),i=document.selection.createRange().text.length;a.moveStart("character",-e.value.length),t=a.text.length-i}return t},$(document).ready((function(){if(i=$("meta[name=_csrf]").attr("content"),n=$("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)for(var e=[].slice.call(document.querySelectorAll("pre code")||[]),t=0;t<e.length;t++)hljs.highlightBlock(e[t]);var o=$("#dropzone");if(o.length>0){var r={};new Dropzone("#dropzone",{url:o.data("upload-url"),headers:{"X-Csrf-Token":i},maxFiles:o.data("max-file"),maxFilesize:o.data("max-size"),acceptedFiles:"*/*"===o.data("accepts")?null:o.data("accepts"),addRemoveLinks:!0,dictDefaultMessage:o.data("default-message"),dictInvalidFileType:o.data("invalid-input-type"),dictFileTooBig:o.data("file-too-big"),dictRemoveFile:o.data("remove-file"),init:function(){this.on("success",(function(e,t){r[e.name]=t.uuid;var a=$('<input id="'.concat(t.uuid,'" name="files" type="hidden">')).val(t.uuid);$(".files").append(a)})),this.on("removedfile",(function(e){e.name in r&&$("#".concat(r[e.name])).remove(),o.data("remove-url")&&o.data("csrf")&&$.post(o.data("remove-url"),{file:r[e.name],_csrf:o.data("csrf")})}))}})}emojify.setConfig({img_dir:"".concat(n,"/vendor/plugins/emojify/images"),ignore_emoticons:!0});for(var s=document.getElementsByClassName("has-emoji"),c=0;c<s.length;c++){emojify.run(s[c]);for(var h=0;h<s[c].childNodes.length;h++)"A"===s[c].childNodes[h].nodeName&&emojify.run(s[c].childNodes[h])}var y,S,q,D,A,O,j,F,R,N,z,I,M,B,P,E=new Clipboard(".clipboard");if(E.on("success",(function(e){e.clearSelection(),$("#".concat(e.trigger.getAttribute("id"))).popup("destroy"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-success")),$("#".concat(e.trigger.getAttribute("id"))).popup("show"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-original"))})),E.on("error",(function(e){$("#".concat(e.trigger.getAttribute("id"))).popup("destroy"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-error")),$("#".concat(e.trigger.getAttribute("id"))).popup("show"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-original"))})),$(".delete-button").click(T),$(".add-all-button").click(L),$(".delete-branch-button").click(T),$(".undo-button").click((function(){var e=$(this);$.post(e.data("url"),{_csrf:i,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(){var e=$(this);$.post(e.data("request-url"),{_csrf:i}).done((function(){window.location.href=e.data("done-url")}))})),$(".markdown").each((function(){var e={};$(this).find("h1, h2, h3, h4, h5, h6").each((function(){var t=$(this),a=encodeURIComponent(t.text().toLowerCase().replace(/[^\u00C0-\u1FFF\u2C00-\uD7FF\w\- ]/g,"").replace(/[ ]/g,"-")),i=a;e[a]>0&&(i="".concat(a,"-").concat(e[a])),void 0===e[a]?e[a]=1:e[a]+=1,(t=t.wrap('<div id="'.concat(i,'" class="anchor-wrap" ></div>'))).append('<a class="anchor" href="#'.concat(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(){var e=this.dataset.action,t=this.dataset.elementId,a=$(".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"),d(i,e,a,t).then((function(){"close"!==e&&"open"!==e||$('.issue-checkbox input[type="checkbox"]').each((function(e,t){t.checked=!1})),u()}))})),$('.issue-checkbox input[type="checkbox"]:checked').first().each((function(e,t){t.checked=!1,$(t).click()})),w(),$("#search-user-box").search({minCharacters:2,apiSettings:{url:"".concat(n,"/api/v1/users/search?q={query}"),onResponse:function(e){var t=[];return $.each(e.data,(function(e,i){var n=i.login;i.full_name&&i.full_name.length>0&&(n+=" (".concat(a(i.full_name),")")),t.push({title:n,image:i.avatar_url})})),{results:t}}},searchFields:["login","full_name"],showNoResults:!1}),(y=$("#search-team-box")).search({minCharacters:2,apiSettings:{url:"".concat(n,"/api/v1/orgs/").concat(y.data("org"),"/teams/search?q={query}"),headers:{"X-Csrf-Token":i},onResponse:function(e){var t=[];return $.each(e.data,(function(e,a){var i="".concat(a.name," (").concat(a.permission," access)");t.push({title:i})})),{results:t}}},searchFields:["name","description"],showNoResults:!1}),(S=$("#search-repo-box")).search({minCharacters:2,apiSettings:{url:"".concat(n,"/api/v1/repos/search?q={query}&uid=").concat(S.data("uid")),onResponse:function(e){var t=[];return $.each(e.data,(function(e,a){t.push({title:a.full_name.split("/")[1],description:a.full_name})})),{results:t}}},searchFields:["full_name"],showNoResults:!1}),f(),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(){var 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"));var 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(a,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")}))),p(),(q=function(){var e=$("#auth_username").val(),t=$("#clone_addr").val();!$("#mirror").is(":checked")&&e&&e.length>0&&void 0!==t&&(t.startsWith("https://github.com")||t.startsWith("http://github.com"))?$("#migrate_items").show():$("#migrate_items").hide()})(),$("#clone_addr").on("input",q),$("#auth_username").on("input",q),$("#mirror").on("change",q),function(){var e=$(".repository.wiki textarea#edit_area");if(e.length>0){var t=new SimpleMDE({autoDownloadFontAwesome:!1,element:e[0],forceSync:!0,previewRender:function(t,a){return setTimeout((function(){$.post(e.data("url"),{_csrf:i,mode:"gfm",context:e.data("context"),text:t},(function(e){a.innerHTML='<div class="markdown ui segment">'.concat(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){var t=e.codemirror,a=t.getSelection();if(t.replaceSelection("`".concat(a,"`")),!a){var i=t.getCursor();t.setCursor(i.line,i.ch-1)}t.focus()},className:"fa fa-angle-right",title:"Add Inline Code"},"code","quote","|",{name:"checkbox-empty",action:function(e){var t=e.codemirror;t.replaceSelection("\n- [ ] ".concat(t.getSelection())),t.focus()},className:"fa fa-square-o",title:"Add Checkbox (empty)"},{name:"checkbox-checked",action:function(e){var t=e.codemirror;t.replaceSelection("\n- [x] ".concat(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")}}(),l(),g(),0!==$(".organization").length&&$(".organization.settings.options").length>0&&$("#org_name").keyup((function(){var 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){$(".events.checkbox input").change((function(){$(this).is(":checked")&&$(".events.fields").show()})),$(".non-events.checkbox input").change((function(){$(this).is(":checked")&&$(".events.fields").hide()}));var e=function(){var e="POST"===$("#http_method").val();$("#content_type").parent().parent()[e?"show":"hide"]()};e(),$("#http_method").change((function(){e()})),$("#test-delivery").click((function(){var e=$(this);e.addClass("loading disabled"),$.post(e.data("link"),{_csrf:i}).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");var e=$(this).val();switch(e){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"),r()}"2"!==e&&"5"!==e||n(),"2"===e&&o()})),$("#auth_type").change(),$("#security_protocol").change(n),$("#use_paged_search").change(o),$("#oauth2_provider").change(r),$("#oauth2_use_custom_url").change(s)),$(".admin.edit.authentication").length>0){var e=$("#auth_type").val();"2"===e||"5"===e?($("#security_protocol").change(n),"2"===e&&$("#use_paged_search").change(o)):"6"===e&&($("#oauth2_provider").change(r),$("#oauth2_use_custom_url").change(s),r())}if($(".admin.notice")){var t=$("#detail-modal");$(".view-detail").click((function(){return t.find(".content p").text($(this).data("content")),t.modal("show"),!1}));var a=$(".select.table .ui.checkbox");$(".select.action").click((function(){switch($(this).data("action")){case"select-all":a.checkbox("check");break;case"deselect-all":a.checkbox("uncheck");break;case"inverse":a.checkbox("toggle")}})),$("#delete-selection").click((function(){var e=$(this);e.addClass("loading disabled");var t=[];a.each((function(){$(this).checkbox("is checked")&&t.push($(this).data("id"))})),$.post(e.data("link"),{_csrf:i,ids:t}).done((function(){window.location.href=e.data("redirect")}))}))}}function n(){$("#security_protocol").val()>0?$(".has-tls").show():$(".has-tls").hide()}function o(){$("#use_paged_search").prop("checked")?$(".search-page-size").show().find("input").attr("required","required"):$(".search-page-size").hide().find("input").removeAttr("required")}function r(){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()}s()}function s(){var 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($("#".concat(e,"_token_url")).val()),$("#oauth2_auth_url").val()||$("#oauth2_auth_url").val($("#".concat(e,"_auth_url")).val()),$("#oauth2_profile_url").val()||$("#oauth2_profile_url").val($("#".concat(e,"_profile_url")).val()),$("#oauth2_email_url").val()||$("#oauth2_email_url").val($("#".concat(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("")}}}(),k(),function(){var 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"".concat(this.suburl,"/api/v1/repos/search?sort=updated&order=desc&uid=").concat(this.uid,"&q=").concat(this.searchQuery,"&limit=").concat(this.searchLimit,"&mode=").concat(this.repoTypes[this.reposFilter].searchMode).concat("all"!==this.reposFilter?"&exclusive=1":"")},repoTypeCount:function(){return this.repoTypes[this.reposFilter].count}},mounted:function(){this.searchRepos(this.reposFilter);var 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){var t=this;this.isLoading=!0;var a=this.repoTypes[e].searchMode,i=this.searchURL,n=this.searchQuery;$.getJSON(i,(function(o,r,s){if(i===t.searchURL){t.repos=o.data;var c=s.getResponseHeader("X-Total-Count");""===n&&""===a&&(t.reposTotalCount=c),t.repoTypes[e].count=c}})).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()})),D=$("#navbar"),A=$("#navbar-expand-toggle"),O=!1,A.click((function(){(O=!O)?(D.addClass("shown"),A.addClass("active")):(D.removeClass("shown"),A.removeClass("active"))})),j=$("#manage_topic"),F=$("#topic_edit"),R=$("#repo-topics"),N=$("#save_topic"),z=$("#topic_edit .dropdown"),I=$("#topic_edit.ui.form"),B=$("div.hide#validate_prompt"),P={countPrompt:B.children("#count_prompt").text(),formatPrompt:B.children("#format_prompt").text()},B.remove(),M=P,j.click((function(){R.hide(),F.css("display","")})),N.click((function(){var e=$("input[name=topics]").val();$.post(N.data("link"),{_csrf:i,topics:e},(function(t,a,i){if("ok"===i.responseJSON.status){if(R.children(".topic").remove(),e.length)for(var n=e.split(","),o=R.children("a").last(),r=0;r<n.length;r++)$('<div class="ui small label topic" style="cursor:pointer;">'.concat(n[r],"</div>")).insertBefore(o);F.css("display","none"),R.show()}})).fail((function(t){if(422===t.status)if(t.responseJSON.invalidTopics.length>0){M.formatPrompt=t.responseJSON.message;var a=t.responseJSON.invalidTopics,i=z.children("a.ui.label");e.split(",").forEach((function(e,t){for(var n=0;n<a.length;n++)a[n]===e&&i.eq(t).removeClass("green").addClass("red")}))}else M.countPrompt=t.responseJSON.message})).always((function(){I.form("validate form")}))})),z.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:"".concat(n,"/api/v1/topics/search?q={query}"),throttle:500,cache:!1,onResponse:function(e){var t={success:!1,results:[]},a=this.urlData.query.trim().replace(/<[^>]*>?/gm,""),i=!1,n=[];if(z.find("div.label.visible.topic,a.label.visible").each((function(e,t){n.push(t.dataset.value)})),e.topics){for(var o=!1,r=0;r<e.topics.length;r++)-1===n.indexOf(e.topics[r].topic_name)&&(e.topics[r].topic_name.toLowerCase()===a.toLowerCase()&&(i=!0),t.results.push({description:e.topics[r].topic_name,"data-value":e.topics[r].topic_name}),o=!0);t.success=o}return a.length>0&&!i?(t.success=!0,t.results.unshift({description:a,"data-value":a})):a.length>0&&i&&t.results.sort((function(e,t){return e.description.toLowerCase()===a.toLowerCase()?-1:t.description.toLowerCase()===a.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,a){e=e.toLowerCase().trim(),$(a).attr("data-value",e),$(a).attr("data-text",e)}}),$.fn.form.settings.rules.validateTopic=function(e,t){var a=z.children("a.ui.label"),i=0===a.length||a.last().attr("data-value").match(t);return i||a.last().removeClass("green").addClass("red"),i&&0===z.children("a.ui.label.red").length},I.form({on:"change",inline:!0,fields:{topics:{identifier:"topics",rules:[{type:"validateTopic",value:/^[a-z0-9][a-z0-9-]{1,35}$/,prompt:M.formatPrompt},{type:"maxCount[25]",prompt:M.countPrompt}]}}}),0!==$("#wait-for-key").length&&u2fApi.ensureSupport().then((function(){$.getJSON("".concat(n,"/user/u2f/challenge")).success((function(e){u2fApi.sign(e.appId,e.challenge,e.registeredKeys,30).then(_).catch((function(e){C(void 0!==e?e.metaData.code:1)}))}))})).catch((function(){window.location.href="".concat(n,"/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(x).catch((function(){C("browser")}))})),function(){var e=$("#repolink").val(),t=$("#repoId").val(),i=$("#crossRepoSearch").val(),o="".concat(n,"/api/v1/repos/").concat(e,"/issues?q={query}");"true"===i&&(o="".concat(n,"/api/v1/repos/issues/search?q={query}&priority_repo_id=").concat(t));$("#new-dependency-drop-list").dropdown({apiSettings:{url:o,onResponse:function(e){var t={success:!0,results:[]},i=$("#new-dependency-drop-list").data("issue-id");return $.each(e,(function(e,n){n.id!==i&&t.results.push({name:"#".concat(n.number," ").concat(a(n.title),'<div class="text small dont-break-out">').concat(a(n.repository.full_name),"</div>"),value:n.id})})),t},cache:!1},fullTextSearch:!0}),$(".menu a.label-filter-item").each((function(){$(this).click((function(e){if(e.altKey){e.preventDefault();var t=$(this).attr("href"),a=$(this).data("label-id"),i="labels=(-?[0-9]+%2c)*(".concat(a,")(%2c-?[0-9]+)*&");window.location=t.replace(new RegExp(i),"labels=$1-$2$3&")}}))})),$(".menu .ui.dropdown.label-filter").keydown((function(e){if(e.altKey&&13===e.keyCode){var t=$(".menu .ui.dropdown.label-filter .menu .item.selected");if(t.length>0){var a=$(t[0]),i=a.attr("href"),n=a.data("label-id"),o="labels=(-?[0-9]+%2c)*(".concat(n,")(%2c-?[0-9]+)*&");window.location=i.replace(new RegExp(o),"labels=$1-$2$3&")}}}))}(),$(".title_wip_desc > a").click((function(e){e.preventDefault();var t=$("#issue_title");t.focus();var a=t.val().trim().toUpperCase();for(var i in wipPrefixes)if(a.startsWith(wipPrefixes[i].toUpperCase()))return;t.val("".concat(wipPrefixes[0]," ").concat(t.val()))})),$(".show-outdated").on("click",(function(e){e.preventDefault();var t=$(this).data("comment");$(this).addClass("hide"),$("#code-comments-".concat(t)).removeClass("hide"),$("#code-preview-".concat(t)).removeClass("hide"),$("#hide-outdated-".concat(t)).removeClass("hide")})),$(".hide-outdated").on("click",(function(e){e.preventDefault();var t=$(this).data("comment");$(this).addClass("hide"),$("#code-comments-".concat(t)).addClass("hide"),$("#code-preview-".concat(t)).addClass("hide"),$("#show-outdated-".concat(t)).removeClass("hide")})),$("button.comment-form-reply").on("click",(function(e){e.preventDefault(),$(this).hide();var t=$(this).parent().find(".comment-form");t.removeClass("hide"),m(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(){var 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")){e.preventDefault();var t=$(this).closest(".code-diff").hasClass("code-diff-split"),a=$(this).data("side"),i=$(this).data("idx"),n=$(this).data("path"),o=$("#pull_review_add_comment").html(),r=$(this).closest("tr"),s=r.next();s.hasClass("add-comment")||(s=$('<tr class="add-comment">'.concat(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>")),r.after(s));var c=s.find(".add-comment-".concat(a)),l=c.find(".comment-code-cloud");0===l.length&&(c.html(o),m((l=c.find(".comment-code-cloud")).find(".menu")),c.find("input[name='line']").val(i),c.find("input[name='side']").val("left"===a?"previous":"proposed"),c.find("input[name='path']").val(n)),l.find("textarea").focus()}}))),function e(){var t=$("#repo_migrating");if($("#repo_migrating_failed").hide(),t){var a=t.attr("repo");if(void 0===a)return;$.ajax({type:"GET",url:"".concat(n,"/").concat(a,"/status"),data:{_csrf:i},complete:function(t){if(200===t.status&&t.responseJSON)return 0===t.responseJSON.status?void window.location.reload():void setTimeout((function(){e()}),2e3);$("#repo_migrating_progress").hide(),$("#repo_migrating_failed").show()}})}}(),function(){var e=$("#repo_template"),t=function(){var t=$("#template_units"),a=$("#non_template");""!==e.val()?(t.show(),a.hide()):(t.hide(),a.show())};e.change(t),t();var i=function(){$("#repo_template_search").dropdown({apiSettings:{url:"".concat(n,"/api/v1/repos/search?q={query}&template=true&priority_owner_id=").concat($("#uid").val()),onResponse:function(e){var t={success:!0,results:[]};return t.results.push({name:"",value:""}),$.each(e.data,(function(e,i){t.results.push({name:a(i.full_name),value:i.id})})),t},cache:!1},fullTextSearch:!0})};$("#uid").change(i),i()}(),$("#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()}var J,V={"div.user.settings":b,"div.repository.settings.collaboration":v};for(J in V)if($(J).length>0){V[J]();break}var H=$("#clone_addr");H.change((function(){var e=$("#repo_name");H.val().length>0&&0===e.val().length&&e.val(H.val().match(/^(.*\/)?((.+?)(\.git)?)$/)[3])}))})),$((function(){0===$(".user.signin").length&&$("form:not(.ignore-dirty)").areYouSure(),$("#ssh-key-content").on("change paste keyup",(function(){var 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,a){var i=document.getElementById(e);if(i){(a=a||{}).contributions=a.contributions||"contributions",a.no_contributions=a.no_contributions||"No contributions";var n=["${","}"];Vue.component("activity-heatmap",{delimiters:n,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){var t=this;$.get("".concat(this.suburl,"/api/v1/users/").concat(e,"/heatmap"),(function(e){for(var a=[],i=0;i<e.length;i++)t.totalContributions+=e[i].contributions,a[i]={date:new Date(1e3*e[i].timestamp),count:e[i].contributions};t.values=a,t.isLoading=!1}))},getColor:function(e){var t=document.createElement("div");t.className="heatmap-color-".concat(e),document.body.appendChild(t);var a=getComputedStyle(t).backgroundColor;return document.body.removeChild(t),a}},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:n,el:i,data:{suburl:document.querySelector("meta[name=_suburl]").content,heatmapUser:t,locale:a}})}},$(".commit-button").click((function(e){e.preventDefault(),$(this).parent().find(".commit-body").toggle()})),window.toggleDeadlineForm=function(){$("#deadlineForm").fadeToggle(150)},window.setDeadline=function(){var e=$("#deadlineDate").val();window.updateDeadline(e)},window.updateDeadline=function(e){$("#deadline-err-invalid-date").hide(),$("#deadline-loader").addClass("loading");var t=null;if(""!==e){var a=Date.parse(e);if(Number.isNaN(a))return $("#deadline-loader").removeClass("loading"),$("#deadline-err-invalid-date").show(),!1;t=new Date(a)}$.ajax("".concat($("#update-issue-deadline-form").attr("action"),"/deadline"),{data:JSON.stringify({due_date:t}),headers:{"X-Csrf-Token":i,"X-Remote":!0},contentType:"application/json",type:"POST",success:function(){u()},error:function(){$("#deadline-loader").removeClass("loading"),$("#deadline-err-invalid-date").show()}})},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){var 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(){var e=$("#oauth2-login-loader"),t=$("#oauth2-login-navigator");t.hide(),e.removeClass("disabled"),setTimeout((function(){e.addClass("disabled"),t.show()}),5e3)}},function(e,t){$((function(){var e=[];document.getElementById("graph-canvas")&&($("#graph-raw-list li span.node-relation").each((function(){e.push($(this).text())})),gitGraph(document.getElementById("graph-canvas"),e))}))}]);
 //# sourceMappingURL=index.js.map
\ No newline at end of file
index 49746a3c5b9bfaaac775c7727a33a879813af773..3cbf582ed58b00e1e5c032ae0ddf2dd73bf9c7bc 100644 (file)
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./web_src/js/index.js","webpack:///./web_src/js/draw.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","_csrf","context","val","$previewPanel","emojify","run","each","hljs","highlightBlock","buttonsClickOnEnter","initEditForm","length","$previewTab","split","initEditPreviewTab","content","$diffPreviewPanel","updateIssuesMeta","url","action","issueIds","elementId","Promise","resolve","ajax","type","issue_ids","id","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","$selectBranch","selectedValue","css","removeClass","addClass","initListSubmits","selectItem","selector","outerSelector","$list","$noSelect","$listMenu","hasLabelUpdateAction","labels","dropdown","promises","keys","forEach","label","promise","push","all","then","hasClass","listIds","parent","join","select_id","input_id","$menu","hasUpdateAction","initRepository","$data","searchTerm","noResults","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","href","createNewBranch","$refs","newBranchForm","submit","nextTick","searchField","focus","j","getSelectedIndexInFiltered","scrollToActive","Array","isArray","cont","scrollContainer","offsetTop","scrollTop","clientHeight","keydown","keyCode","initFilterSearchDropdown","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","$textarea","$segment","next","$editContentZone","$renderContent","$rawContent","issuesTribute","attach","emojiTribute","$dropzone","$files","filenameDict","dropzone","headers","maxFiles","maxFilesize","acceptedFiles","addRemoveLinks","dictDefaultMessage","dictInvalidFileType","dictFileTooBig","dictRemoveFile","init","on","submitted","getJSON","drop","removeAllFiles","empty","imgSrc","emit","files","$editContentForm","attr","$attachments","map","$content","attachments","confirm","$statusButton","$mergeButton","e","onChange","_text","_value","$choice","closest","initReactionSelector","reactions","popup","position","metadata","actionURL","done","resp","react","insertBefore","appendTo","hasEmoji","$item","addLine","delLine","addPercent","parseFloat","localStorage","setItem","select","$repoComparePull","$dropdown","fullTextSearch","selectOnKeydown","message","assingMenuAttributes","menu","Math","floor","random","initRepositoryCollaboration","uid","initEditor","prop","$editFilename","parts","$section","$divider","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","$first","hash","match","offset","top","u2fSigned","stringify","contentType","fail","u2fError","u2fRegistered","errorCode","checkError","errorType","u2fErrors","browser","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","fn","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","$searchTeamBox","$searchRepoBox","toggleMigrations","isExpanded","mgrBtn","editDiv","viewDiv","saveBtn","topicDropdown","topicForm","topicPrompts","hidePrompt","prompts","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","permission","description","dbType","dbDefaults","MySQL","PostgreSQL","MSSQL","_type","defaultHost","is","authUserName","cloneAddr","startsWith","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","Number","default","String","required","organizations","isOrganization","Boolean","canCreateOrganization","organizationsTotalCount","moreReposLink","repos","reposTotalCount","reposFilter","searchQuery","isLoading","repoTypes","count","searchMode","forks","mirrors","sources","collaborative","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","countPrompt","formatPrompt","topics","_data","responseJSON","topicArray","invalidTopics","topicLables","index","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","ensureSupport","sign","challenge","err","allowMultiple","repolink","repoId","crossRepoSearch","issueSearchUrl","filteredResponse","currIssueId","issue","number","repository","regStr","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","deadline","updateDeadline","deadlineString","realDeadline","newDate","isNaN","due_date","error","deleteDependencyModal","cancelCodeComment","btn","onOAuthLoginClick","oauthLoader","oauthNav","graphList","gitGraph"],"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,EA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igB,EAAYzlB,YAAY,YAExBmO,YAAW,WAGTsX,EAAYxlB,SAAS,YACrBylB,EAASngB,SACR,O,cCxsGL5K,GAAE,WACA,IAAMgrB,EAAY,GAEb7iB,SAAS6W,eAAe,kBAI7Bhf,EAAE,yCAAyCS,MAAK,WAC9CuqB,EAAU1kB,KAAKtG,EAAEC,MAAMjB,WAGzBisB,SAAS9iB,SAAS6W,eAAe,gBAAiBgM","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, updateDeadline, deleteDependencyModal, cancelCodeComment, onOAuthLoginClick */\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\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    }, (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  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      }, (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\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    }, (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\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(((resolve) => {\n    $.ajax({\n      type: 'POST',\n      url,\n      data: {\n        _csrf: csrf,\n        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(xhr) {\n        if (xhr.status === 200) {\n          if (xhr.responseJSON) {\n            if (xhr.responseJSON.status === 0) {\n              window.location.reload();\n              return;\n            }\n\n            setTimeout(() => {\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,\n      data: {\n        _csrf: csrf,\n        content: $(this).data('content')\n      }\n    }).done((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;\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', (event) => {\n      retrieveImageFromClipboardAsBlob(event, (img) => {\n        const name = img.name.substr(0, img.name.lastIndexOf('.'));\n        insertAtCursor(field, `![${name}]()`);\n        uploadFile(img, (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', () => {\n      hasLabelUpdateAction = $listMenu.data('action') === 'update'; // Update the var\n      if (hasLabelUpdateAction) {\n        const promises = [];\n        Object.keys(labels).forEach((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      // we don't need the action attribute when updating assignees\n      if (selector === 'select-assignees-modify') {\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  // 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, (_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(_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 || ('.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(() => {\n      $newLabelPanel.show();\n    });\n    $('.new-label.segment .cancel').click(() => {\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() {\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(ct) {\n        $('#deadline').val(ct.dateFormat('Y-m-d'));\n      }\n    });\n    $('#clear-date').click(() => {\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 || $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      (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()\n        .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() {\n              this.on('success', (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', (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', () => {\n                $.each(filenameDict, (name) => {\n                  filenameDict[name].submitted = true;\n                });\n              });\n              this.on('reload', () => {\n                $.getJSON($editContentZone.data('attachment-url'), (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(() => {\n          $renderContent.show();\n          $editContentZone.hide();\n          $dropzone.get(0).dropzone.emit('reload');\n        });\n        $editContentZone.find('.save.button').click(() => {\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          }, (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\"><div class=\"ui small images\"></div></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 (window.confirm($this.data('locale'))) {\n        $.post($this.data('url'), {\n          _csrf: csrf\n        }).success(() => {\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(() => {\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(_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 && 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')\n    .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(() => {\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(plainText, preview) { // Async method\n        setTimeout(() => {\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          }, (data) => {\n            preview.innerHTML = `<div class=\"markdown ui segment\">${data}</div>`;\n            emojify.run($('.editor-preview')[0]);\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(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(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(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// 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(plainText, preview) { // Async method\n      setTimeout(() => {\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        (data) => {\n          preview.innerHTML = `<div class=\"markdown ui segment\">${data}</div>`;\n          emojify.run($('.editor-preview')[0]);\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', (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        } 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()) 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) 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', () => {\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    } 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    } 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    } 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, (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(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() {\n      const dirty = $(this).hasClass(dirtyFileClass);\n      $commitButton.prop('disabled', !dirty);\n    }\n  });\n\n  $commitButton.click((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() {\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(() => {\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(() => {\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 || $('.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      } 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\n      }).done(() => {\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}\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(response) {\n        const items = [];\n        $.each(response.data, (_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,\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(response) {\n        const items = [];\n        $.each(response.data, (_i, item) => {\n          const title = `${item.name} (${item.permission} access)`;\n          items.push({\n            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(response) {\n        const items = [];\n        $.each(response.data, (_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', () => {\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(() => {\n      $.getJSON(`${suburl}/user/u2f/challenge`).success((req) => {\n        u2fApi.sign(req.appId, req.challenge, req.registeredKeys, 30)\n          .then(u2fSigned)\n          .catch((err) => {\n            if (err === undefined) {\n              u2fError(1);\n              return;\n            }\n            u2fError(err.metaData.code);\n          });\n      });\n    }).catch(() => {\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((res) => {\n    window.location.replace(res);\n  }).fail(() => {\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() {\n      reload();\n    },\n    fail() {\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\n  Object.keys(u2fErrors).forEach((type) => {\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', (e) => {\n    e.preventDefault();\n    u2fApi.ensureSupport()\n      .then(u2fRegisterRequest)\n      .catch(() => {\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((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((reason) => {\n        if (reason === undefined) {\n          u2fError(1);\n          return;\n        }\n        u2fError(reason.metaData.code);\n      });\n  }).fail((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((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(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, (_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(() => {\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)\n      .addClass('poping up')\n      .attr('data-content', $(this).attr('title'))\n      .attr('data-variation', 'inverted tiny')\n      .attr('title', '');\n  });\n\n  // Semantic UI modules.\n  $('.dropdown:not(.custom)').dropdown();\n  $('.jump.dropdown').dropdown({\n    action: 'hide',\n    onShow() {\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() {\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() {\n        this.on('success', (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', (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', (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', (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((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(() => {\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(() => {\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;\n    let { elementId } = this.dataset;\n    const issueIDs = $('.issue-checkbox').children('input:checked').map(function () {\n      return this.dataset.issueId;\n    }).get().join();\n    const { url } = this.dataset;\n    if (elementId === '0' && url.substr(-9) === '/assignee') {\n      elementId = '';\n      action = 'clear';\n    }\n    updateIssuesMeta(url, action, issueIDs, elementId).then(() => {\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((_, 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((_, 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(() => {\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 (window.history.pushState) {\n    window.history.pushState(null, null, hash);\n  } else {\n    window.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$(() => {\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() {\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((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() {\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((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() {\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() {\n        return this.repos.length > 0 && this.repos.length < this.repoTypes[this.reposFilter].count;\n      },\n      searchURL() {\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() {\n        return this.repoTypes[this.reposFilter].count;\n      }\n    },\n\n    mounted() {\n      this.searchRepos(this.reposFilter);\n\n      const self = this;\n      Vue.nextTick(() => {\n        self.$refs.search.focus();\n      });\n    },\n\n    methods: {\n      changeTab(t) {\n        this.tab = t;\n      },\n\n      changeReposFilter(filter) {\n        this.reposFilter = filter;\n        this.repos = [];\n        this.repoTypes[filter].count = 0;\n        this.searchRepos(filter);\n      },\n\n      showRepo(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(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, (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(() => {\n          if (searchedURL === self.searchURL) {\n            self.isLoading = false;\n          }\n        });\n      },\n\n      repoClass(repo) {\n        if (repo.fork) {\n          return 'octicon octicon-repo-forked';\n        } if (repo.mirror) {\n          return 'octicon octicon-repo-clone';\n        } if (repo.private) {\n          return 'octicon octicon-lock';\n        }\n        return 'octicon octicon-repo';\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,\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() {\n        $('#add_time_manual_form').submit();\n      }\n    }).modal('show');\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() {\n      return {\n        isLoading: true,\n        colorRange: [],\n        endDate: null,\n        values: [],\n        totalContributions: 0,\n      };\n    },\n\n    mounted() {\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(userName) {\n        const self = this;\n        $.get(`${this.suburl}/api/v1/users/${userName}/heatmap`, (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(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,\n\n    data: {\n      suburl: document.querySelector('meta[name=_suburl]').content,\n      heatmapUser,\n      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,\n\n      beforeMount() {\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', (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(visible) {\n          if (visible) {\n            this.focusSearchField();\n          }\n        }\n      },\n\n      computed: {\n        filteredItems() {\n          const vm = this;\n\n          const items = vm.items.filter((item) => {\n            return ((vm.mode === 'branches' && item.branch) || (vm.mode === 'tags' && item.tag))\n              && (!vm.searchTerm || 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() {\n          return this.filteredItems.length === 0 && !this.showCreateNewBranch;\n        },\n        showCreateNewBranch() {\n          const vm = this;\n          if (!this.canCreateBranch || !vm.searchTerm || vm.mode === 'tags') {\n            return false;\n          }\n\n          return vm.items.filter((item) => item.name.toLowerCase() === vm.searchTerm.toLowerCase()).length === 0;\n        }\n      },\n\n      methods: {\n        selectItem(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() {\n          if (!this.showCreateNewBranch) {\n            return;\n          }\n          this.$refs.newBranchForm.submit();\n        },\n        focusSearchField() {\n          const vm = this;\n          Vue.nextTick(() => {\n            vm.$refs.searchField.focus();\n          });\n        },\n        getSelected() {\n          for (let i = 0, j = this.items.length; i < j; ++i) {\n            if (this.items[i].selected) return this.items[i];\n          }\n          return null;\n        },\n        getSelectedIndexInFiltered() {\n          for (let i = 0, j = this.filteredItems.length; i < j; ++i) {\n            if (this.filteredItems[i].selected) return i;\n          }\n          return -1;\n        },\n        scrollToActive() {\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          } else if (el.offsetTop + el.clientHeight > cont.scrollTop + cont.clientHeight) {\n            cont.scrollTop = el.offsetTop + el.clientHeight - cont.clientHeight;\n          }\n        },\n        keydown(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(() => {\n    isExpanded = !isExpanded;\n    if (isExpanded) {\n      content.addClass('shown');\n      toggle.addClass('active');\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(() => {\n    viewDiv.hide();\n    editDiv.css('display', ''); // show Semantic UI Grid\n  });\n\n  function getPrompts() {\n    const hidePrompt = $('div.hide#validate_prompt');\n    const 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(() => {\n    const topics = $('input[name=topics]').val();\n\n    $.post(saveBtn.data('link'), {\n      _csrf: csrf,\n      topics\n    }, (_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((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;\n          const topicLables = topicDropdown.children('a.ui.label');\n\n          topics.split(',').forEach((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(() => {\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(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((_, 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((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(value) {\n      value = value.toLowerCase().trim();\n      this.attr('data-value', value).contents().first().replaceWith(value);\n      return $(this);\n    },\n    onAdd(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    const 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}\n\nwindow.toggleDeadlineForm = function () {\n  $('#deadlineForm').fadeToggle(150);\n};\n\nwindow.setDeadline = function () {\n  const deadline = $('#deadlineDate').val();\n  window.updateDeadline(deadline);\n};\n\nwindow.updateDeadline = function (deadlineString) {\n  $('#deadline-err-invalid-date').hide();\n  $('#deadline-loader').addClass('loading');\n\n  let realDeadline = null;\n  if (deadlineString !== '') {\n    const newDate = Date.parse(deadlineString);\n\n    if (Number.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() {\n      reload();\n    },\n    error() {\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() {\n        $('#removeDependencyID').val(id);\n        $('#dependencyType').val(type);\n        $('#removeDependencyForm').submit();\n      }\n    }).modal('show');\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(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, (_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((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(() => {\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","/* globals gitGraph */\n\n$(() => {\n  const graphList = [];\n\n  if (!document.getElementById('graph-canvas')) {\n    return;\n  }\n\n  $('#graph-raw-list li span.node-relation').each(function () {\n    graphList.push($(this).text());\n  });\n\n  gitGraph(document.getElementById('graph-canvas'), graphList);\n});\n"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./web_src/js/index.js","webpack:///./web_src/js/draw.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","_csrf","context","val","$previewPanel","emojify","run","each","hljs","highlightBlock","buttonsClickOnEnter","initEditForm","length","$previewTab","split","initEditPreviewTab","content","$diffPreviewPanel","updateIssuesMeta","url","action","issueIds","elementId","Promise","resolve","ajax","type","issue_ids","id","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","$selectBranch","selectedValue","css","removeClass","addClass","initListSubmits","selectItem","selector","outerSelector","$list","$noSelect","$listMenu","hasLabelUpdateAction","labels","dropdown","promises","keys","forEach","label","promise","push","all","then","hasClass","listIds","parent","join","select_id","input_id","$menu","hasUpdateAction","initRepository","$data","searchTerm","noResults","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","href","createNewBranch","$refs","newBranchForm","submit","nextTick","searchField","focus","j","getSelectedIndexInFiltered","scrollToActive","Array","isArray","cont","scrollContainer","offsetTop","scrollTop","clientHeight","keydown","keyCode","initFilterSearchDropdown","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","$textarea","$segment","next","$editContentZone","$renderContent","$rawContent","issuesTribute","attach","emojiTribute","$dropzone","$files","filenameDict","dropzone","headers","maxFiles","maxFilesize","acceptedFiles","addRemoveLinks","dictDefaultMessage","dictInvalidFileType","dictFileTooBig","dictRemoveFile","init","on","submitted","getJSON","drop","removeAllFiles","empty","imgSrc","emit","files","$editContentForm","attr","$attachments","map","$content","attachments","confirm","$statusButton","$mergeButton","e","onChange","_text","_value","$choice","closest","initReactionSelector","reactions","popup","position","metadata","actionURL","done","resp","react","insertBefore","appendTo","hasEmoji","$item","addLine","delLine","addPercent","parseFloat","localStorage","setItem","select","$repoComparePull","$dropdown","fullTextSearch","selectOnKeydown","message","assingMenuAttributes","menu","Math","floor","random","initRepositoryCollaboration","uid","initEditor","prop","$editFilename","parts","$section","$divider","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","$first","hash","match","offset","top","$foldButton","slideUp","slideDown","insertBlobExcerpt","$blob","$row","replaceWith","u2fSigned","stringify","contentType","fail","u2fError","u2fRegistered","errorCode","checkError","errorType","u2fErrors","browser","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","fn","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","$searchTeamBox","$searchRepoBox","toggleMigrations","isExpanded","mgrBtn","editDiv","viewDiv","saveBtn","topicDropdown","topicForm","topicPrompts","hidePrompt","prompts","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","permission","description","dbType","dbDefaults","MySQL","PostgreSQL","MSSQL","_type","defaultHost","is","authUserName","cloneAddr","startsWith","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","Number","default","String","required","organizations","isOrganization","Boolean","canCreateOrganization","organizationsTotalCount","moreReposLink","repos","reposTotalCount","reposFilter","searchQuery","isLoading","repoTypes","count","searchMode","forks","mirrors","sources","collaborative","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","countPrompt","formatPrompt","topics","_data","responseJSON","topicArray","invalidTopics","topicLables","index","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","onAdd","addedValue","_addedText","$addedChoice","settings","rules","validateTopic","_values","regExp","identifier","prompt","ensureSupport","sign","challenge","err","allowMultiple","repolink","repoId","crossRepoSearch","issueSearchUrl","filteredResponse","currIssueId","issue","number","repository","regStr","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","deadline","updateDeadline","deadlineString","realDeadline","newDate","isNaN","due_date","error","deleteDependencyModal","cancelCodeComment","btn","onOAuthLoginClick","oauthLoader","oauthNav","graphList","gitGraph"],"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,EA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AClCrF,EAAE,8BAA8B4K,WAKtC3I,OAAO+oB,sBAAwB,SAAUlpB,EAAIF,GAC3C5B,EAAE,sBACCmL,MAAM,CACL6N,UAAU,EACV2K,SAAU,IACVvY,UAHK,WAIHpL,EAAE,uBAAuBK,IAAIyB,GAC7B9B,EAAE,mBAAmBK,IAAIuB,GACzB5B,EAAE,yBAAyBwJ,YAE5B2B,MAAM,SAwEblJ,OAAOgpB,kBAAoB,SAAUC,GACnC,IAAM5H,EAAOtjB,EAAEkrB,GAAKhc,QAAQ,QACxBoU,EAAKxiB,OAAS,GAAKwiB,EAAK7c,SAAS,iBACnC6c,EAAKhe,SAAS,QACdge,EAAK3c,SAAShH,KAAK,6BAA6BiL,QAEhD0Y,EAAKpU,QAAQ,uBAAuBvH,UAGxC1F,OAAOkpB,kBAAoB,WACzB,IAAMC,EAAcprB,EAAE,wBAChBqrB,EAAWrrB,EAAE,2BAEnBqrB,EAASxgB,OACTugB,EAAY/lB,YAAY,YAExBmO,YAAW,WAGT4X,EAAY9lB,SAAS,YACrB+lB,EAASzgB,SACR,O,cC7tGL5K,GAAE,WACA,IAAMsrB,EAAY,GAEbnjB,SAASoX,eAAe,kBAI7Bvf,EAAE,yCAAyCS,MAAK,WAC9C6qB,EAAUhlB,KAAKtG,EAAEC,MAAMjB,WAGzBusB,SAASpjB,SAASoX,eAAe,gBAAiB+L","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, updateDeadline, deleteDependencyModal, cancelCodeComment, onOAuthLoginClick */\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\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    }, (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  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      }, (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\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    }, (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\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(((resolve) => {\n    $.ajax({\n      type: 'POST',\n      url,\n      data: {\n        _csrf: csrf,\n        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(xhr) {\n        if (xhr.status === 200) {\n          if (xhr.responseJSON) {\n            if (xhr.responseJSON.status === 0) {\n              window.location.reload();\n              return;\n            }\n\n            setTimeout(() => {\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,\n      data: {\n        _csrf: csrf,\n        content: $(this).data('content')\n      }\n    }).done((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;\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', (event) => {\n      retrieveImageFromClipboardAsBlob(event, (img) => {\n        const name = img.name.substr(0, img.name.lastIndexOf('.'));\n        insertAtCursor(field, `![${name}]()`);\n        uploadFile(img, (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', () => {\n      hasLabelUpdateAction = $listMenu.data('action') === 'update'; // Update the var\n      if (hasLabelUpdateAction) {\n        const promises = [];\n        Object.keys(labels).forEach((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      // we don't need the action attribute when updating assignees\n      if (selector === 'select-assignees-modify') {\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  // 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, (_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(_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 || ('.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(() => {\n      $newLabelPanel.show();\n    });\n    $('.new-label.segment .cancel').click(() => {\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() {\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(ct) {\n        $('#deadline').val(ct.dateFormat('Y-m-d'));\n      }\n    });\n    $('#clear-date').click(() => {\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 || $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      (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()\n        .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() {\n              this.on('success', (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', (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', () => {\n                $.each(filenameDict, (name) => {\n                  filenameDict[name].submitted = true;\n                });\n              });\n              this.on('reload', () => {\n                $.getJSON($editContentZone.data('attachment-url'), (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(() => {\n          $renderContent.show();\n          $editContentZone.hide();\n          $dropzone.get(0).dropzone.emit('reload');\n        });\n        $editContentZone.find('.save.button').click(() => {\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          }, (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\"><div class=\"ui small images\"></div></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 (window.confirm($this.data('locale'))) {\n        $.post($this.data('url'), {\n          _csrf: csrf\n        }).success(() => {\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(() => {\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(_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 && 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')\n    .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(() => {\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(plainText, preview) { // Async method\n        setTimeout(() => {\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          }, (data) => {\n            preview.innerHTML = `<div class=\"markdown ui segment\">${data}</div>`;\n            emojify.run($('.editor-preview')[0]);\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(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(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(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// 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(plainText, preview) { // Async method\n      setTimeout(() => {\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        (data) => {\n          preview.innerHTML = `<div class=\"markdown ui segment\">${data}</div>`;\n          emojify.run($('.editor-preview')[0]);\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', (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        } 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()) 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) 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', () => {\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    } 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    } 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    } 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, (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(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() {\n      const dirty = $(this).hasClass(dirtyFileClass);\n      $commitButton.prop('disabled', !dirty);\n    }\n  });\n\n  $commitButton.click((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() {\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(() => {\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(() => {\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 || $('.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      } 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\n      }).done(() => {\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}\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(response) {\n        const items = [];\n        $.each(response.data, (_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,\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(response) {\n        const items = [];\n        $.each(response.data, (_i, item) => {\n          const title = `${item.name} (${item.permission} access)`;\n          items.push({\n            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(response) {\n        const items = [];\n        $.each(response.data, (_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', () => {\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  $('.ui.fold-code').on('click', (e) => {\n    const $foldButton = $(e.target);\n    if ($foldButton.hasClass('fa-chevron-down')) {\n      $(e.target).parent().next().slideUp('fast', () => {\n        $foldButton.removeClass('fa-chevron-down').addClass('fa-chevron-right');\n      });\n    } else {\n      $(e.target).parent().next().slideDown('fast', () => {\n        $foldButton.removeClass('fa-chevron-right').addClass('fa-chevron-down');\n      });\n    }\n  });\n  function insertBlobExcerpt(e) {\n    const $blob = $(e.target);\n    const $row = $blob.parent().parent();\n    $.get(`${$blob.data('url')}?${$blob.data('query')}&anchor=${$blob.data('anchor')}`, (blob) => {\n      $row.replaceWith(blob);\n      $(`[data-anchor=\"${$blob.data('anchor')}\"]`).on('click', (e) => { insertBlobExcerpt(e); });\n    });\n  }\n  $('.ui.blob-excerpt').on('click', (e) => { insertBlobExcerpt(e); });\n}\n\nfunction initU2FAuth() {\n  if ($('#wait-for-key').length === 0) {\n    return;\n  }\n  u2fApi.ensureSupport()\n    .then(() => {\n      $.getJSON(`${suburl}/user/u2f/challenge`).success((req) => {\n        u2fApi.sign(req.appId, req.challenge, req.registeredKeys, 30)\n          .then(u2fSigned)\n          .catch((err) => {\n            if (err === undefined) {\n              u2fError(1);\n              return;\n            }\n            u2fError(err.metaData.code);\n          });\n      });\n    }).catch(() => {\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((res) => {\n    window.location.replace(res);\n  }).fail(() => {\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() {\n      reload();\n    },\n    fail() {\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\n  Object.keys(u2fErrors).forEach((type) => {\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', (e) => {\n    e.preventDefault();\n    u2fApi.ensureSupport()\n      .then(u2fRegisterRequest)\n      .catch(() => {\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((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((reason) => {\n        if (reason === undefined) {\n          u2fError(1);\n          return;\n        }\n        u2fError(reason.metaData.code);\n      });\n  }).fail((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((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(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, (_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(() => {\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)\n      .addClass('poping up')\n      .attr('data-content', $(this).attr('title'))\n      .attr('data-variation', 'inverted tiny')\n      .attr('title', '');\n  });\n\n  // Semantic UI modules.\n  $('.dropdown:not(.custom)').dropdown();\n  $('.jump.dropdown').dropdown({\n    action: 'hide',\n    onShow() {\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() {\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() {\n        this.on('success', (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', (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', (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', (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((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(() => {\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(() => {\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;\n    let { elementId } = this.dataset;\n    const issueIDs = $('.issue-checkbox').children('input:checked').map(function () {\n      return this.dataset.issueId;\n    }).get().join();\n    const { url } = this.dataset;\n    if (elementId === '0' && url.substr(-9) === '/assignee') {\n      elementId = '';\n      action = 'clear';\n    }\n    updateIssuesMeta(url, action, issueIDs, elementId).then(() => {\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((_, 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((_, 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(() => {\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 (window.history.pushState) {\n    window.history.pushState(null, null, hash);\n  } else {\n    window.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$(() => {\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() {\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((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() {\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((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() {\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() {\n        return this.repos.length > 0 && this.repos.length < this.repoTypes[this.reposFilter].count;\n      },\n      searchURL() {\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() {\n        return this.repoTypes[this.reposFilter].count;\n      }\n    },\n\n    mounted() {\n      this.searchRepos(this.reposFilter);\n\n      const self = this;\n      Vue.nextTick(() => {\n        self.$refs.search.focus();\n      });\n    },\n\n    methods: {\n      changeTab(t) {\n        this.tab = t;\n      },\n\n      changeReposFilter(filter) {\n        this.reposFilter = filter;\n        this.repos = [];\n        this.repoTypes[filter].count = 0;\n        this.searchRepos(filter);\n      },\n\n      showRepo(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(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, (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(() => {\n          if (searchedURL === self.searchURL) {\n            self.isLoading = false;\n          }\n        });\n      },\n\n      repoClass(repo) {\n        if (repo.fork) {\n          return 'octicon octicon-repo-forked';\n        } if (repo.mirror) {\n          return 'octicon octicon-repo-clone';\n        } if (repo.private) {\n          return 'octicon octicon-lock';\n        }\n        return 'octicon octicon-repo';\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,\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() {\n        $('#add_time_manual_form').submit();\n      }\n    }).modal('show');\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() {\n      return {\n        isLoading: true,\n        colorRange: [],\n        endDate: null,\n        values: [],\n        totalContributions: 0,\n      };\n    },\n\n    mounted() {\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(userName) {\n        const self = this;\n        $.get(`${this.suburl}/api/v1/users/${userName}/heatmap`, (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(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,\n\n    data: {\n      suburl: document.querySelector('meta[name=_suburl]').content,\n      heatmapUser,\n      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,\n\n      beforeMount() {\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', (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(visible) {\n          if (visible) {\n            this.focusSearchField();\n          }\n        }\n      },\n\n      computed: {\n        filteredItems() {\n          const vm = this;\n\n          const items = vm.items.filter((item) => {\n            return ((vm.mode === 'branches' && item.branch) || (vm.mode === 'tags' && item.tag))\n              && (!vm.searchTerm || 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() {\n          return this.filteredItems.length === 0 && !this.showCreateNewBranch;\n        },\n        showCreateNewBranch() {\n          const vm = this;\n          if (!this.canCreateBranch || !vm.searchTerm || vm.mode === 'tags') {\n            return false;\n          }\n\n          return vm.items.filter((item) => item.name.toLowerCase() === vm.searchTerm.toLowerCase()).length === 0;\n        }\n      },\n\n      methods: {\n        selectItem(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() {\n          if (!this.showCreateNewBranch) {\n            return;\n          }\n          this.$refs.newBranchForm.submit();\n        },\n        focusSearchField() {\n          const vm = this;\n          Vue.nextTick(() => {\n            vm.$refs.searchField.focus();\n          });\n        },\n        getSelected() {\n          for (let i = 0, j = this.items.length; i < j; ++i) {\n            if (this.items[i].selected) return this.items[i];\n          }\n          return null;\n        },\n        getSelectedIndexInFiltered() {\n          for (let i = 0, j = this.filteredItems.length; i < j; ++i) {\n            if (this.filteredItems[i].selected) return i;\n          }\n          return -1;\n        },\n        scrollToActive() {\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          } else if (el.offsetTop + el.clientHeight > cont.scrollTop + cont.clientHeight) {\n            cont.scrollTop = el.offsetTop + el.clientHeight - cont.clientHeight;\n          }\n        },\n        keydown(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(() => {\n    isExpanded = !isExpanded;\n    if (isExpanded) {\n      content.addClass('shown');\n      toggle.addClass('active');\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(() => {\n    viewDiv.hide();\n    editDiv.css('display', ''); // show Semantic UI Grid\n  });\n\n  function getPrompts() {\n    const hidePrompt = $('div.hide#validate_prompt');\n    const 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(() => {\n    const topics = $('input[name=topics]').val();\n\n    $.post(saveBtn.data('link'), {\n      _csrf: csrf,\n      topics\n    }, (_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((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;\n          const topicLables = topicDropdown.children('a.ui.label');\n\n          topics.split(',').forEach((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(() => {\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(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((_, 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((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(value) {\n      value = value.toLowerCase().trim();\n      this.attr('data-value', value).contents().first().replaceWith(value);\n      return $(this);\n    },\n    onAdd(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    const 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}\n\nwindow.toggleDeadlineForm = function () {\n  $('#deadlineForm').fadeToggle(150);\n};\n\nwindow.setDeadline = function () {\n  const deadline = $('#deadlineDate').val();\n  window.updateDeadline(deadline);\n};\n\nwindow.updateDeadline = function (deadlineString) {\n  $('#deadline-err-invalid-date').hide();\n  $('#deadline-loader').addClass('loading');\n\n  let realDeadline = null;\n  if (deadlineString !== '') {\n    const newDate = Date.parse(deadlineString);\n\n    if (Number.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() {\n      reload();\n    },\n    error() {\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() {\n        $('#removeDependencyID').val(id);\n        $('#dependencyType').val(type);\n        $('#removeDependencyForm').submit();\n      }\n    }).modal('show');\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(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, (_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((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(() => {\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","/* globals gitGraph */\n\n$(() => {\n  const graphList = [];\n\n  if (!document.getElementById('graph-canvas')) {\n    return;\n  }\n\n  $('#graph-raw-list li span.node-relation').each(function () {\n    graphList.push($(this).text());\n  });\n\n  gitGraph(document.getElementById('graph-canvas'), graphList);\n});\n"],"sourceRoot":""}
\ No newline at end of file
index f067729ca94de34a2106a1fba0ac947e931f224e..2a123a2eb9b676e9f46463b562e20baa453dbac5 100644 (file)
@@ -245,6 +245,7 @@ func Diff(ctx *context.Context) {
        }
 
        ctx.Data["CommitID"] = commitID
+       ctx.Data["AfterCommitID"] = commitID
        ctx.Data["Username"] = userName
        ctx.Data["Reponame"] = repoName
 
index e45f0464353c84aafab61fec31c6c6ee3a882855..203b740082d0e7de3cb22b59e41bccc82fc9110f 100644 (file)
@@ -5,21 +5,26 @@
 package repo
 
 import (
+       "bufio"
        "fmt"
+       "html"
        "path"
+       "path/filepath"
        "strings"
 
        "code.gitea.io/gitea/models"
        "code.gitea.io/gitea/modules/base"
        "code.gitea.io/gitea/modules/context"
        "code.gitea.io/gitea/modules/git"
+       "code.gitea.io/gitea/modules/highlight"
        "code.gitea.io/gitea/modules/log"
        "code.gitea.io/gitea/modules/setting"
        "code.gitea.io/gitea/services/gitdiff"
 )
 
 const (
-       tplCompare base.TplName = "repo/diff/compare"
+       tplCompare     base.TplName = "repo/diff/compare"
+       tplBlobExcerpt base.TplName = "repo/diff/blob_excerpt"
 )
 
 // setPathsCompareContext sets context data for source and raw paths
@@ -434,3 +439,109 @@ func CompareDiff(ctx *context.Context) {
 
        ctx.HTML(200, tplCompare)
 }
+
+// ExcerptBlob render blob excerpt contents
+func ExcerptBlob(ctx *context.Context) {
+       commitID := ctx.Params("sha")
+       lastLeft := ctx.QueryInt("last_left")
+       lastRight := ctx.QueryInt("last_right")
+       idxLeft := ctx.QueryInt("left")
+       idxRight := ctx.QueryInt("right")
+       leftHunkSize := ctx.QueryInt("left_hunk_size")
+       rightHunkSize := ctx.QueryInt("right_hunk_size")
+       anchor := ctx.Query("anchor")
+       direction := ctx.Query("direction")
+       filePath := ctx.Query("path")
+       gitRepo := ctx.Repo.GitRepo
+       chunkSize := gitdiff.BlobExceprtChunkSize
+       commit, err := gitRepo.GetCommit(commitID)
+       if err != nil {
+               ctx.Error(500, "GetCommit")
+               return
+       }
+       section := &gitdiff.DiffSection{
+               Name: filePath,
+       }
+       if direction == "up" && (idxLeft-lastLeft) > chunkSize {
+               idxLeft -= chunkSize
+               idxRight -= chunkSize
+               leftHunkSize += chunkSize
+               rightHunkSize += chunkSize
+               section.Lines, err = getExcerptLines(commit, filePath, idxLeft-1, idxRight-1, chunkSize)
+       } else if direction == "down" && (idxLeft-lastLeft) > chunkSize {
+               section.Lines, err = getExcerptLines(commit, filePath, lastLeft, lastRight, chunkSize)
+               lastLeft += chunkSize
+               lastRight += chunkSize
+       } else {
+               section.Lines, err = getExcerptLines(commit, filePath, lastLeft, lastRight, idxRight-lastRight-1)
+               leftHunkSize = 0
+               rightHunkSize = 0
+               idxLeft = lastLeft
+               idxRight = lastRight
+       }
+       if err != nil {
+               ctx.Error(500, "getExcerptLines")
+               return
+       }
+       if idxRight > lastRight {
+               lineText := " "
+               if rightHunkSize > 0 || leftHunkSize > 0 {
+                       lineText = fmt.Sprintf("@@ -%d,%d +%d,%d @@\n", idxLeft, leftHunkSize, idxRight, rightHunkSize)
+               }
+               lineText = html.EscapeString(lineText)
+               lineSection := &gitdiff.DiffLine{
+                       Type:    gitdiff.DiffLineSection,
+                       Content: lineText,
+                       SectionInfo: &gitdiff.DiffLineSectionInfo{
+                               Path:          filePath,
+                               LastLeftIdx:   lastLeft,
+                               LastRightIdx:  lastRight,
+                               LeftIdx:       idxLeft,
+                               RightIdx:      idxRight,
+                               LeftHunkSize:  leftHunkSize,
+                               RightHunkSize: rightHunkSize,
+                       }}
+               if direction == "up" {
+                       section.Lines = append([]*gitdiff.DiffLine{lineSection}, section.Lines...)
+               } else if direction == "down" {
+                       section.Lines = append(section.Lines, lineSection)
+               }
+       }
+       ctx.Data["section"] = section
+       ctx.Data["fileName"] = filePath
+       ctx.Data["highlightClass"] = highlight.FileNameToHighlightClass(filepath.Base(filePath))
+       ctx.Data["AfterCommitID"] = commitID
+       ctx.Data["Anchor"] = anchor
+       ctx.HTML(200, tplBlobExcerpt)
+}
+
+func getExcerptLines(commit *git.Commit, filePath string, idxLeft int, idxRight int, chunkSize int) ([]*gitdiff.DiffLine, error) {
+       blob, err := commit.Tree.GetBlobByPath(filePath)
+       if err != nil {
+               return nil, err
+       }
+       reader, err := blob.DataAsync()
+       if err != nil {
+               return nil, err
+       }
+       defer reader.Close()
+       scanner := bufio.NewScanner(reader)
+       var diffLines []*gitdiff.DiffLine
+       for line := 0; line < idxRight+chunkSize; line++ {
+               if ok := scanner.Scan(); !ok {
+                       break
+               }
+               if line < idxRight {
+                       continue
+               }
+               lineText := scanner.Text()
+               diffLine := &gitdiff.DiffLine{
+                       LeftIdx:  idxLeft + (line - idxRight) + 1,
+                       RightIdx: line + 1,
+                       Type:     gitdiff.DiffLinePlain,
+                       Content:  " " + lineText,
+               }
+               diffLines = append(diffLines, diffLine)
+       }
+       return diffLines, nil
+}
index 67849f33e12f4bb0387a052297cef90784b86e4c..a1a4e5e2bbe1a324d0091e711386eb2cc1078c58 100644 (file)
@@ -552,6 +552,7 @@ func ViewPullFiles(ctx *context.Context) {
                ctx.Data["Username"] = pull.MustHeadUserName()
                ctx.Data["Reponame"] = pull.HeadRepo.Name
        }
+       ctx.Data["AfterCommitID"] = endCommitID
 
        diff, err := gitdiff.GetDiffRangeWithWhitespaceBehavior(diffRepoPath,
                startCommitID, endCommitID, setting.Git.MaxGitDiffLines,
index 13a5bb27084d0dfcc81fa01bf22f36c03e2bc556..48bba16bf6f96be82cebff7da8bd166f0102dd76 100644 (file)
@@ -864,6 +864,10 @@ func RegisterRoutes(m *macaron.Macaron) {
                        m.Get("", repo.Branches)
                }, repo.MustBeNotEmpty, context.RepoRef(), reqRepoCodeReader)
 
+               m.Group("/blob_excerpt", func() {
+                       m.Get("/:sha", repo.SetEditorconfigIfExists, repo.SetDiffViewStyle, repo.ExcerptBlob)
+               }, repo.MustBeNotEmpty, context.RepoRef(), reqRepoCodeReader)
+
                m.Group("/pulls/:index", func() {
                        m.Get(".diff", repo.DownloadPullDiff)
                        m.Get(".patch", repo.DownloadPullPatch)
index 9c2aef5c97ce1a6d6b6ba44fcc5a14c0d9d4ad73..69c8f5603ab5401cd4443d2d07e1e621676241e0 100644 (file)
@@ -13,6 +13,7 @@ import (
        "html/template"
        "io"
        "io/ioutil"
+       "net/url"
        "os"
        "os/exec"
        "regexp"
@@ -56,15 +57,42 @@ const (
        DiffFileRename
 )
 
+// DiffLineExpandDirection represents the DiffLineSection expand direction
+type DiffLineExpandDirection uint8
+
+// DiffLineExpandDirection possible values.
+const (
+       DiffLineExpandNone DiffLineExpandDirection = iota + 1
+       DiffLineExpandSingle
+       DiffLineExpandUpDown
+       DiffLineExpandUp
+       DiffLineExpandDown
+)
+
 // DiffLine represents a line difference in a DiffSection.
 type DiffLine struct {
-       LeftIdx  int
-       RightIdx int
-       Type     DiffLineType
-       Content  string
-       Comments []*models.Comment
+       LeftIdx     int
+       RightIdx    int
+       Type        DiffLineType
+       Content     string
+       Comments    []*models.Comment
+       SectionInfo *DiffLineSectionInfo
+}
+
+// DiffLineSectionInfo represents diff line section meta data
+type DiffLineSectionInfo struct {
+       Path          string
+       LastLeftIdx   int
+       LastRightIdx  int
+       LeftIdx       int
+       RightIdx      int
+       LeftHunkSize  int
+       RightHunkSize int
 }
 
+// BlobExceprtChunkSize represent max lines of excerpt
+const BlobExceprtChunkSize = 20
+
 // GetType returns the type of a DiffLine.
 func (d *DiffLine) GetType() int {
        return int(d.Type)
@@ -91,6 +119,71 @@ func (d *DiffLine) GetLineTypeMarker() string {
        return ""
 }
 
+// GetBlobExcerptQuery builds query string to get blob excerpt
+func (d *DiffLine) GetBlobExcerptQuery() string {
+       query := fmt.Sprintf(
+               "last_left=%d&last_right=%d&"+
+                       "left=%d&right=%d&"+
+                       "left_hunk_size=%d&right_hunk_size=%d&"+
+                       "path=%s",
+               d.SectionInfo.LastLeftIdx, d.SectionInfo.LastRightIdx,
+               d.SectionInfo.LeftIdx, d.SectionInfo.RightIdx,
+               d.SectionInfo.LeftHunkSize, d.SectionInfo.RightHunkSize,
+               url.QueryEscape(d.SectionInfo.Path))
+       return query
+}
+
+// GetExpandDirection gets DiffLineExpandDirection
+func (d *DiffLine) GetExpandDirection() DiffLineExpandDirection {
+       if d.Type != DiffLineSection || d.SectionInfo == nil || d.SectionInfo.RightIdx-d.SectionInfo.LastRightIdx <= 1 {
+               return DiffLineExpandNone
+       }
+       if d.SectionInfo.LastLeftIdx <= 0 && d.SectionInfo.LastRightIdx <= 0 {
+               return DiffLineExpandUp
+       } else if d.SectionInfo.RightIdx-d.SectionInfo.LastRightIdx > BlobExceprtChunkSize && d.SectionInfo.RightHunkSize > 0 {
+               return DiffLineExpandUpDown
+       } else if d.SectionInfo.LeftHunkSize <= 0 && d.SectionInfo.RightHunkSize <= 0 {
+               return DiffLineExpandDown
+       }
+       return DiffLineExpandSingle
+}
+
+func getDiffLineSectionInfo(curFile *DiffFile, line string, lastLeftIdx, lastRightIdx int) *DiffLineSectionInfo {
+       var (
+               leftLine  int
+               leftHunk  int
+               rightLine int
+               righHunk  int
+       )
+       ss := strings.Split(line, "@@")
+       ranges := strings.Split(ss[1][1:], " ")
+       leftRange := strings.Split(ranges[0], ",")
+       leftLine, _ = com.StrTo(leftRange[0][1:]).Int()
+       if len(leftRange) > 1 {
+               leftHunk, _ = com.StrTo(leftRange[1]).Int()
+       }
+       if len(ranges) > 1 {
+               rightRange := strings.Split(ranges[1], ",")
+               rightLine, _ = com.StrTo(rightRange[0]).Int()
+               if len(rightRange) > 1 {
+                       righHunk, _ = com.StrTo(rightRange[1]).Int()
+               }
+       } else {
+               log.Warn("Parse line number failed: %v", line)
+               rightLine = leftLine
+               righHunk = leftHunk
+       }
+       return &DiffLineSectionInfo{
+               Path:          curFile.Name,
+               LastLeftIdx:   lastLeftIdx,
+               LastRightIdx:  lastRightIdx,
+               LeftIdx:       leftLine,
+               RightIdx:      rightLine,
+               LeftHunkSize:  leftHunk,
+               RightHunkSize: righHunk,
+       }
+}
+
 // escape a line's content or return <br> needed for copy/paste purposes
 func getLineContent(content string) string {
        if len(content) > 0 {
@@ -248,6 +341,53 @@ func (diffFile *DiffFile) GetHighlightClass() string {
        return highlight.FileNameToHighlightClass(diffFile.Name)
 }
 
+// GetTailSection creates a fake DiffLineSection if the last section is not the end of the file
+func (diffFile *DiffFile) GetTailSection(gitRepo *git.Repository, leftCommitID, rightCommitID string) *DiffSection {
+       if diffFile.Type != DiffFileChange || diffFile.IsBin || diffFile.IsLFSFile {
+               return nil
+       }
+       leftCommit, err := gitRepo.GetCommit(leftCommitID)
+       if err != nil {
+               return nil
+       }
+       rightCommit, err := gitRepo.GetCommit(rightCommitID)
+       if err != nil {
+               return nil
+       }
+       lastSection := diffFile.Sections[len(diffFile.Sections)-1]
+       lastLine := lastSection.Lines[len(lastSection.Lines)-1]
+       leftLineCount := getCommitFileLineCount(leftCommit, diffFile.Name)
+       rightLineCount := getCommitFileLineCount(rightCommit, diffFile.Name)
+       if leftLineCount <= lastLine.LeftIdx || rightLineCount <= lastLine.RightIdx {
+               return nil
+       }
+       tailDiffLine := &DiffLine{
+               Type:    DiffLineSection,
+               Content: " ",
+               SectionInfo: &DiffLineSectionInfo{
+                       Path:         diffFile.Name,
+                       LastLeftIdx:  lastLine.LeftIdx,
+                       LastRightIdx: lastLine.RightIdx,
+                       LeftIdx:      leftLineCount,
+                       RightIdx:     rightLineCount,
+               }}
+       tailSection := &DiffSection{Lines: []*DiffLine{tailDiffLine}}
+       return tailSection
+
+}
+
+func getCommitFileLineCount(commit *git.Commit, filePath string) int {
+       blob, err := commit.GetBlobByPath(filePath)
+       if err != nil {
+               return 0
+       }
+       lineCount, err := blob.GetBlobLineCount()
+       if err != nil {
+               return 0
+       }
+       return lineCount
+}
+
 // Diff represents a difference between two git trees.
 type Diff struct {
        TotalAddition, TotalDeletion int
@@ -510,19 +650,16 @@ func ParsePatch(maxLines, maxLineCharacters, maxFiles int, reader io.Reader) (*D
                case line[0] == '@':
                        curSection = &DiffSection{}
                        curFile.Sections = append(curFile.Sections, curSection)
-                       ss := strings.Split(line, "@@")
-                       diffLine := &DiffLine{Type: DiffLineSection, Content: line}
-                       curSection.Lines = append(curSection.Lines, diffLine)
-
-                       // Parse line number.
-                       ranges := strings.Split(ss[1][1:], " ")
-                       leftLine, _ = com.StrTo(strings.Split(ranges[0], ",")[0][1:]).Int()
-                       if len(ranges) > 1 {
-                               rightLine, _ = com.StrTo(strings.Split(ranges[1], ",")[0]).Int()
-                       } else {
-                               log.Warn("Parse line number failed: %v", line)
-                               rightLine = leftLine
+                       lineSectionInfo := getDiffLineSectionInfo(curFile, line, leftLine-1, rightLine-1)
+                       diffLine := &DiffLine{
+                               Type:        DiffLineSection,
+                               Content:     line,
+                               SectionInfo: lineSectionInfo,
                        }
+                       curSection.Lines = append(curSection.Lines, diffLine)
+                       // update line number.
+                       leftLine = lineSectionInfo.LeftIdx
+                       rightLine = lineSectionInfo.RightIdx
                        continue
                case line[0] == '+':
                        curFile.Addition++
@@ -599,6 +736,8 @@ func ParsePatch(maxLines, maxLineCharacters, maxFiles int, reader io.Reader) (*D
                                break
                        }
                        curFileLinesCount = 0
+                       leftLine = 1
+                       rightLine = 1
                        curFileLFSPrefix = false
 
                        // Check file diff type and is submodule.
@@ -701,6 +840,7 @@ func GetDiffRangeWithWhitespaceBehavior(repoPath, beforeCommitID, afterCommitID
                diffArgs = append(diffArgs, actualBeforeCommitID)
                diffArgs = append(diffArgs, afterCommitID)
                cmd = exec.Command(git.GitExecutable, diffArgs...)
+               beforeCommitID = actualBeforeCommitID
        }
        cmd.Dir = repoPath
        cmd.Stderr = os.Stderr
@@ -721,6 +861,12 @@ func GetDiffRangeWithWhitespaceBehavior(repoPath, beforeCommitID, afterCommitID
        if err != nil {
                return nil, fmt.Errorf("ParsePatch: %v", err)
        }
+       for _, diffFile := range diff.Files {
+               tailSection := diffFile.GetTailSection(gitRepo, beforeCommitID, afterCommitID)
+               if tailSection != nil {
+                       diffFile.Sections = append(diffFile.Sections, tailSection)
+               }
+       }
 
        if err = cmd.Wait(); err != nil {
                return nil, fmt.Errorf("Wait: %v", err)
diff --git a/templates/repo/diff/blob_excerpt.tmpl b/templates/repo/diff/blob_excerpt.tmpl
new file mode 100644 (file)
index 0000000..5f0cd30
--- /dev/null
@@ -0,0 +1,50 @@
+{{if $.IsSplitStyle}}
+  {{range $k, $line := $.section.Lines}}
+  <tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
+    {{if eq .GetType 4}}
+    <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}">
+      {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
+      <i class="ui blob-excerpt fa fa-caret-down" data-url="{{$.RepoLink}}/blob_excerpt/{{$.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=down" data-anchor="{{$.Anchor}}"></i>
+      {{end}}
+      {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
+      <i class="ui blob-excerpt fa fa-caret-up" data-url="{{$.RepoLink}}/blob_excerpt/{{$.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=up" data-anchor="{{$.Anchor}}"></i>
+      {{end}}
+      {{if or (eq $line.GetExpandDirection 2)}}
+      <i class="ui blob-excerpt octicon octicon-fold" data-url="{{$.RepoLink}}/blob_excerpt/{{$.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=" data-anchor="{{$.Anchor}}"></i>
+      {{end}}
+    </td>
+    <td colspan="5" class="lines-code lines-code-old "><span class="mono wrap{{if $.highlightClass}} language-{{$.highlightClass}}{{else}} nohighlight{{end}}">{{$.section.GetComputedInlineDiffFor $line}}</span></td>
+    {{else}}
+    <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{Sha1 $.fileName}}L{{$line.LeftIdx}}{{end}}"></span></td>
+    <td class="blob-excerpt lines-type-marker lines-type-marker-old">{{if $line.LeftIdx}}<span class="mono" data-type-marker=""></span>{{end}}</td>
+    <td class="blob-excerpt lines-code lines-code-old halfwidth"><span class="mono wrap{{if $.highlightClass}} language-{{$.highlightClass}}{{else}} nohighlight{{end}}">{{if $line.LeftIdx}}{{$.section.GetComputedInlineDiffFor $line}}{{end}}</span></td>
+    <td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{Sha1 $.fileName}}R{{$line.RightIdx}}{{end}}"></span></td>
+    <td class="blob-excerpt lines-type-marker lines-type-marker-new">{{if $line.RightIdx}}<span class="mono" data-type-marker=""></span>{{end}}</td>
+    <td class="blob-excerpt lines-code lines-code-new halfwidth"><span class="mono wrap{{if $.highlightClass}} language-{{$.highlightClass}}{{else}} nohighlight{{end}}">{{if $line.RightIdx}}{{$.section.GetComputedInlineDiffFor $line}}{{end}}</span></td>
+    {{end}}
+  </tr>
+  {{end}}
+{{else}}
+  {{range $k, $line := $.section.Lines}}
+  <tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
+    {{if eq .GetType 4}}
+    <td colspan="2" class="lines-num">
+      {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
+      <i class="ui blob-excerpt fa fa-caret-up" data-url="{{$.RepoLink}}/blob_excerpt/{{$.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=up" data-anchor="{{$.Anchor}}"></i>
+      {{end}}
+      {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
+      <i class="ui blob-excerpt fa fa-caret-down" data-url="{{$.RepoLink}}/blob_excerpt/{{$.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=down" data-anchor="{{$.Anchor}}"></i>
+      {{end}}
+      {{if or (eq $line.GetExpandDirection 2)}}
+      <i class="ui blob-excerpt octicon octicon-fold" data-url="{{$.RepoLink}}/blob_excerpt/{{$.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=" data-anchor="{{$.Anchor}}"></i>
+      {{end}}
+    </td>
+    {{else}}
+    <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{Sha1 $.fileName}}L{{$line.LeftIdx}}{{end}}"></span></td>
+    <td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{Sha1 $.fileName}}R{{$line.RightIdx}}{{end}}"></span></td>
+    {{end}}
+    <td class="blob-excerpt lines-type-marker"><span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td>
+    <td class="blob-excerpt lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}"><span class="mono wrap{{if $.highlightClass}} language-{{$.highlightClass}}{{else}} nohighlight{{end}}">{{$.section.GetComputedInlineDiffFor $line}}</span></td>
+  </tr>
+  {{end}}
+{{end}}
\ No newline at end of file
index a12fc9bd4b71ede8f4612c928d75ddcb6481f140..088dc5718ddbe17a0137b2372e4cd9ae14b49008 100644 (file)
                        {{else}}
                                <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}" id="diff-{{.Index}}">
                                        <h4 class="ui top attached normal header">
+                                               {{$isImage := false}}
+                                               {{if $file.IsDeleted}}
+                                                       {{$isImage = (call $.IsImageFileInBase $file.Name)}}
+                                               {{else}}
+                                                       {{$isImage = (call $.IsImageFileInHead $file.Name)}}
+                                               {{end}}
+                                               {{if or (not $file.IsBin) $isImage}}
+                                               <i class="ui fold-code grey fa fa-chevron-down"></i>
+                                               {{end}}
                                                <div class="diff-counter count">
                                                        {{if $file.IsBin}}
                                                                {{$.i18n.Tr "repo.diff.bin"}}
                                        </h4>
                                        <div class="ui attached unstackable table segment">
                                                {{if ne $file.Type 4}}
-                                                       {{$isImage := false}}
-                                                       {{if $file.IsDeleted}}
-                                                               {{$isImage = (call $.IsImageFileInBase $file.Name)}}
-                                                       {{else}}
-                                                               {{$isImage = (call $.IsImageFileInHead $file.Name)}}
-                                                       {{end}}
                                                        <div class="file-body file-code code-view code-diff {{if $.IsSplitStyle}}code-diff-split{{else}}code-diff-unified{{end}}">
                                                                <table>
                                                                        <tbody>
                                                                                                {{range $j, $section := $file.Sections}}
                                                                                                        {{range $k, $line := $section.Lines}}
                                                                                                                <tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
-                                                                                                                       <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}"></span></td>
-                                                                                                                       <td class="lines-type-marker lines-type-marker-old">{{if $line.LeftIdx}}<span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</td>
-                                                                                                                       <td class="lines-code lines-code-old halfwidth">{{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 2))}}<a class="ui green button add-code-comment add-code-comment-left" data-path="{{$file.Name}}" data-side="left" data-idx="{{$line.LeftIdx}}">+</a>{{end}}<span class="mono wrap{{if $highlightClass}} language-{{$highlightClass}}{{else}} nohighlight{{end}}">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</span></td>
-                                                                                                                       <td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}"></span></td>
-                                                                                                                       <td class="lines-type-marker lines-type-marker-new">{{if $line.RightIdx}}<span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</td>
-                                                                                                                       <td class="lines-code lines-code-new halfwidth">{{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 3))}}<a class="ui green button add-code-comment add-code-comment-right" data-path="{{$file.Name}}" data-side="right" data-idx="{{$line.RightIdx}}">+</a>{{end}}<span class="mono wrap{{if $highlightClass}} language-{{$highlightClass}}{{else}} nohighlight{{end}}">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</span></td>
+                                                                                                                       {{if eq .GetType 4}}
+                                                                                                                               <td class="lines-num lines-num-old">
+                                                                                                                                       {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
+                                                                                                                                               <i class="ui blob-excerpt fa fa-caret-down" data-url="{{$.RepoLink}}/blob_excerpt/{{$.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=down" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}"></i>
+                                                                                                                                       {{end}}
+                                                                                                                                       {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
+                                                                                                                                               <i class="ui blob-excerpt fa fa-caret-up" data-url="{{$.RepoLink}}/blob_excerpt/{{$.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=up" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}"></i>
+                                                                                                                                       {{end}}
+                                                                                                                                       {{if or (eq $line.GetExpandDirection 2)}}
+                                                                                                                                               <i class="ui blob-excerpt octicon octicon-fold" data-url="{{$.RepoLink}}/blob_excerpt/{{$.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}"></i>
+                                                                                                                                       {{end}}
+                                                                                                                               </td>
+                                                                                                                               <td colspan="5" class="lines-code lines-code-old "><span class="mono wrap{{if $highlightClass}} language-{{$highlightClass}}{{else}} nohighlight{{end}}">{{$section.GetComputedInlineDiffFor $line}}</span></td>
+                                                                                                                       {{else}}
+                                                                                                                               <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}"></span></td>
+                                                                                                                               <td class="lines-type-marker lines-type-marker-old">{{if $line.LeftIdx}}<span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</td>
+                                                                                                                               <td class="lines-code lines-code-old halfwidth">{{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 2))}}<a class="ui green button add-code-comment add-code-comment-left" data-path="{{$file.Name}}" data-side="left" data-idx="{{$line.LeftIdx}}">+</a>{{end}}<span class="mono wrap{{if $highlightClass}} language-{{$highlightClass}}{{else}} nohighlight{{end}}">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</span></td>
+                                                                                                                               <td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}"></span></td>
+                                                                                                                               <td class="lines-type-marker lines-type-marker-new">{{if $line.RightIdx}}<span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</td>
+                                                                                                                               <td class="lines-code lines-code-new halfwidth">{{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 3))}}<a class="ui green button add-code-comment add-code-comment-right" data-path="{{$file.Name}}" data-side="right" data-idx="{{$line.RightIdx}}">+</a>{{end}}<span class="mono wrap{{if $highlightClass}} language-{{$highlightClass}}{{else}} nohighlight{{end}}">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</span></td>
+                                                                                                                       {{end}}
                                                                                                                </tr>
                                                                                                                {{if gt (len $line.Comments) 0}}
                                                                                                                        <tr class="add-code-comment">
index 9a60c238dcf124f782d57a016dfc3f8475ee3a71..fcc511af75eb293d88b9799660dcc6d88edadbe9 100644 (file)
@@ -4,9 +4,17 @@
        {{range $k, $line := $section.Lines}}
                <tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
                        {{if eq .GetType 4}}
-                       <td colspan="2" class="lines-num">
-                               {{/* {{if gt $j 0}}<span class="fold octicon octicon-fold"></span>{{end}} */}}
-                       </td>
+                               <td colspan="2" class="lines-num">
+                               {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
+                                       <i class="ui blob-excerpt fa fa-caret-down" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=down" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}"></i>
+                               {{end}}
+                               {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
+                                       <i class="ui blob-excerpt fa fa-caret-up" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=up" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}"></i>
+                               {{end}}
+                               {{if or (eq $line.GetExpandDirection 2)}}
+                                       <i class="ui blob-excerpt octicon octicon-fold" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}"></i>
+                               {{end}}
+                               </td>
                        {{else}}
                        <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}"></span></td>
                        <td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}"></span></td>
index 4e53494eb000d552a5d26ab2a5ef1e44b796b5b8..69d2aafcc9526ddf6ca52b0c5fd824e74e29db3d 100644 (file)
@@ -1852,6 +1852,27 @@ function initCodeView() {
       }
     }).trigger('hashchange');
   }
+  $('.ui.fold-code').on('click', (e) => {
+    const $foldButton = $(e.target);
+    if ($foldButton.hasClass('fa-chevron-down')) {
+      $(e.target).parent().next().slideUp('fast', () => {
+        $foldButton.removeClass('fa-chevron-down').addClass('fa-chevron-right');
+      });
+    } else {
+      $(e.target).parent().next().slideDown('fast', () => {
+        $foldButton.removeClass('fa-chevron-right').addClass('fa-chevron-down');
+      });
+    }
+  });
+  function insertBlobExcerpt(e) {
+    const $blob = $(e.target);
+    const $row = $blob.parent().parent();
+    $.get(`${$blob.data('url')}?${$blob.data('query')}&anchor=${$blob.data('anchor')}`, (blob) => {
+      $row.replaceWith(blob);
+      $(`[data-anchor="${$blob.data('anchor')}"]`).on('click', (e) => { insertBlobExcerpt(e); });
+    });
+  }
+  $('.ui.blob-excerpt').on('click', (e) => { insertBlobExcerpt(e); });
 }
 
 function initU2FAuth() {
index 84d59bbe91e54787df3f15b80560f2b20a43b922..974dd571ccd860e3742c2b730d1f1c1b1e8f01f7 100644 (file)
@@ -2438,6 +2438,10 @@ tbody.commit-list {
     padding-bottom: 8px;
 }
 
+td.blob-excerpt {
+    background-color: #fafafa;
+}
+
 .issue-keyword {
     border-bottom: 1px dotted #959da5;
     display: inline-block;
index c01e7533b401c3bdccea42ec622574133b6f5491..d838c09c2d7ab56ffdae9250b59b2482d166e252 100644 (file)
     font: 12px @monospaced-fonts, monospace;
     color: rgba(0, 0, 0, 0.87);
 }
+
+.ui.fold-code {
+    margin-right: 1em;
+    padding-left: 5px;
+    cursor: pointer;
+    width: 22px;
+    font-size: 12px;
+}
+
+.ui.fold-code:hover {
+    color: #428bca;
+}
+
+.ui.blob-excerpt {
+    display: block;
+    line-height: 20px;
+    font-size: 16px;
+    cursor: pointer;
+}
+
+.ui.blob-excerpt:hover {
+    color: #428bca;
+}