You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
gitea/public/js/index.js

2 lines
69 KiB

!function(e){function t(t){for(var n,i,o=t[0],r=t[1],c=0,l=[];c<o.length;c++)i=o[c],Object.prototype.hasOwnProperty.call(a,i)&&a[i]&&l.push(a[i][0]),a[i]=0;for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);for(s&&s(t);l.length;)l.shift()()}var n={},a={1:0};function i(t){if(n[t])return n[t].exports;var a=n[t]={i:t,l:!1,exports:{}};return e[t].call(a.exports,a,a.exports,i),a.l=!0,a.exports}i.e=function(e){var t=[],n=a[e];if(0!==n)if(n)t.push(n[2]);else{var o=new Promise((function(t,i){n=a[e]=[t,i]}));t.push(n[2]=o);var r,c=document.createElement("script");c.charset="utf-8",c.timeout=120,i.nc&&c.setAttribute("nonce",i.nc),c.src=function(e){return i.p+""+({0:"gitgraph"}[e]||e)+".js"}(e);var s=new Error;r=function(t){c.onerror=c.onload=null,clearTimeout(l);var n=a[e];if(0!==n){if(n){var i=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;s.message="Loading chunk "+e+" failed.\n("+i+": "+o+")",s.name="ChunkLoadError",s.type=i,s.request=o,n[1](s)}a[e]=void 0}};var l=setTimeout((function(){r({type:"timeout",target:c})}),12e4);c.onerror=c.onload=r,document.head.appendChild(c)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)i.d(n,a,function(t){return e[t]}.bind(null,a));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i.oe=function(e){throw console.error(e),e};var o=window.webpackJsonp=window.webpackJsonp||[],r=o.push.bind(o);o.push=t,o=o.slice();for(var c=0;c<o.length;c++)t(o[c]);var s=r;i(i.s=2)}([function(e,t,n){e.exports=n(4)},function(e,t,n){var a=n(5),i=n(6),o=n(7);e.exports=function(e,t){return a(e)||i(e,t)||o()}},function(e,t,n){e.exports=n(8)},function(e,t,n){if(document.currentScript&&document.currentScript.src){var a=new URL(document.currentScript.src);n.p="".concat(a.pathname.replace(/\/[^/]*$/,""),"/")}else{var i=document.querySelector('script[src*="/index.js"]');n.p="".concat(i.getAttribute("src").replace(/\/[^/]*$/,""),"/")}},function(e,t,n){var a=function(e){"use strict";var t,n=Object.prototype,a=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",r=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(e,t,n,a){var i=t&&t.prototype instanceof m?t:m,o=Object.create(i.prototype),r=new q(a||[]);return o._invoke=function(e,t,n){var a=d;return function(i,o){if(a===h)throw new Error("Generator is already running");if(a===f){if("throw"===i)throw o;return L()}for(n.method=i,n.arg=o;;){var r=n.delegate;if(r){var c=C(r,n);if(c){if(c===p)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===d)throw a=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=h;var s=l(e,t,n);if("normal"===s.type){if(a=n.done?f:u,s.arg===p)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(a=f,n.method="throw",n.arg=s.arg)}}}(e,n,r),o}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var d="suspendedStart",u="suspendedYield",h="executing",f="completed",p={};function m(){}function v(){}function $(){}var g={};g[o]=function(){return this};var b=Object.getPrototypeOf,w=b&&b(b(T([])));w&&w!==n&&a.call(w,o)&&(g=w);var y=$.prototype=m.prototype=Object.create(g);function k(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function _(e){var t;this._invoke=function(n,i){function o(){return new Promise((function(t,o){!function t(n,i,o,r){var c=l(e[n],e,i);if("throw"!==c.type){var s=c.arg,d=s.value;return d&&"object"==typeof d&&a.call(d,"__await")?Promise.resolve(d.__await).then((function(e){t("next",e,o,r)}),(function(e){t("throw",e,o,r)})):Promise.resolve(d).then((function(e){s.value=e,o(s)}),(function(e){return t("throw",e,o,r)}))}r(c.arg)}(n,i,t,o)}))}return t=t?t.then(o,o):o()}}function C(e,n){var a=e.iterator[n.method];if(a===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,C(e,n),"throw"===n.method))return p;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var i=l(a,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,p;var o=i.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,p):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function q(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function T(e){if(e){var n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,r=function n(){for(;++i<e.length;)if(a.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return r.next=r}}return{next:L}}function L(){return{value:t,done:!0}}return v.prototype=y.constructor=$,$.constructor=v,$[c]=v.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,$):(e.__proto__=$,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},k(_.prototype),_.prototype[r]=function(){return this},e.AsyncIterator=_,e.async=function(t,n,a,i){var o=new _(s(t,n,a,i));return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},k(y),y[c]="Generator",y[o]=function(){return this},y.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var a=t.pop();if(a in e)return n.value=a,n.done=!1,n}return n.done=!0,n}},e.values=T,q.prototype={constructor:q,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(S),!e)for(var n in this)"t"===n.charAt(0)&&a.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(a,i){return c.type="throw",c.arg=e,n.next=a,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var r=this.tryEntries[o],c=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var s=a.call(r,"catchLoc"),l=a.call(r,"finallyLoc");if(s&&l){if(this.prev<r.catchLoc)return i(r.catchLoc,!0);if(this.prev<r.finallyLoc)return i(r.finallyLoc)}else if(s){if(this.prev<r.catchLoc)return i(r.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return i(r.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var a=n.completion;if("throw"===a.type){var i=a.arg;S(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,a){return this.delegate={iterator:T(e),resultName:n,nextLoc:a},"next"===this.method&&(this.arg=t),p}},e}(e.exports);try{regeneratorRuntime=a}catch(e){Function("r","regeneratorRuntime = r")(a)}},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var n=[],a=!0,i=!1,o=void 0;try{for(var r,c=e[Symbol.iterator]();!(a=(r=c.next()).done)&&(n.push(r.value),!t||n.length!==t);a=!0);}catch(e){i=!0,o=e}finally{try{a||null==c.return||c.return()}finally{if(i)throw o}}return n}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(e,t,n){"use strict";n.r(t);n(3);var a,i,o,r,c,s=n(0),l=n.n(s),d=n(1),u=n.n(d);function h(e){return jQuery("<div />").text(e).html()}function f(e){var t=e.find(".tabular.menu");t.find(".item").tab(),t.find('.item[data-tab="'.concat(t.data("preview"),'"]')).click((function(){var n=$(this);$.post(n.data("url"),{_csrf:a,mode:"gfm",context:n.data("context"),text:e.find('.tab.segment[data-tab="'.concat(t.data("write"),'"] textarea')).val()},(function(n){var a=e.find('.tab.segment[data-tab="'.concat(t.data("preview"),'"]'));a.html(n),emojify.run(a[0]),$("pre code",a[0]).each((function(){hljs.highlightBlock(this)}))}))})),x()}function p(){var e,t;0!==$(".edit.form").length&&(!function(e){var t=e.find(".tabular.menu");t.find(".item").tab();var n=t.find('.item[data-tab="'.concat(t.data("preview"),'"]'));n.length&&(o=n.data("preview-file-modes").split(","),n.click((function(){var n=$(this);$.post(n.data("url"),{_csrf:a,mode:"gfm",context:n.data("context"),text:e.find('.tab.segment[data-tab="'.concat(t.data("write"),'"] textarea')).val()},(function(n){var a=e.find('.tab.segment[data-tab="'.concat(t.data("preview"),'"]'));a.html(n),emojify.run(a[0]),$("pre code",a[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 n=$(this);$.post(n.data("url"),{_csrf:a,context:n.data("context"),content:e.find('.tab.segment[data-tab="'.concat(t.data("write"),'"] textarea')).val()},(function(n){var a=e.find('.tab.segment[data-tab="'.concat(t.data("diff"),'"]'));a.html(n),emojify.run(a[0])}))})))}function m(e,t,n,i){return new Promise((function(o){$.ajax({type:"POST",url:e,data:{_csrf:a,action:t,issue_ids:n,id:i},success:o})}))}function v(){window.location.reload()}function g(e){e.each((function(){var e=this;e.addEventListener("paste",(function(t){!function(e,t){if(e.clipboardData){var n=e.clipboardData.items;if(void 0!==n)for(var a=0;a<n.length;a++)if(-1!==n[a].type.indexOf("image")){var i=n[a].getAsFile();"function"==typeof t&&(e.preventDefault(),e.stopPropagation(),t(i))}}}(t,(function(t){var n=t.name.substr(0,t.name.lastIndexOf("."));!function(e,t){if(e.selectionStart||0===e.selectionStart){var n=e.selectionStart,a=e.selectionEnd;e.value=e.value.substring(0,n)+t+e.value.substring(a,e.value.length),e.selectionStart=n+t.length,e.selectionEnd=n+t.length}else e.value+=t}(e,"![".concat(n,"]()")),function(e,t){var n=new XMLHttpRequest;n.onload=function(){200===n.status&&t(n.responseText)},n.open("post","".concat(i,"/attachments"),!0),n.setRequestHeader("X-Csrf-Token",a);var o=new FormData;o.append("file",e,e.name),n.send(o)}(t,(function(t){var a=JSON.parse(t);!function(e,t,n){if(e.selectionStart||0===e.selectionStart){var a=e.selectionStart,i=e.selectionEnd;e.value=e.value.replace(t,n),e.selectionStart=a+n.length-t.length,e.selectionEnd=i+n.length-t.length}else e.value=e.value.replace(t,n)}(e,"![".concat(n,"]()"),"![".concat(n,"](").concat(i,"/attachments/").concat(a.uuid,")"));var o=$('<input id="'.concat(a.uuid,'" name="files" type="hidden">')).val(a.uuid);$(".files").append(o)}))}))}),!1)}))}function b(){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})),f($(".comment.form")),g($(".comment.form textarea")),t("select-label","labels"),t("select-assignees","assignees"),t("select-assignees-modify","assignees"),n(".select-milestone","#milestone_id"),n(".select-assignee","#assignee_id"));function t(e,t){var n=$(".ui.".concat(t,".list")),a=n.find(".no-select"),i=$(".".concat(e," .menu")),o="update"===i.data("action"),r={};$(".".concat(e)).dropdown("setting","onHide",(function(){if(o="update"===i.data("action")){var e=[];Object.keys(r).forEach((function(t){var n=r[t],a=m(n["update-url"],n.action,n["issue-id"],t);e.push(a)})),Promise.all(e).then(v)}})),i.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")),m(i.data("update-url"),"",i.data("issue-id"),$(this).data("id")),i.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":i.data("update-url"),action:"detach","issue-id":i.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":i.data("update-url"),action:"attach","issue-id":i.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?a.removeClass("hide"):a.addClass("hide"),$($(this).parent().data("id")).val(t.join(",")),!1})),i.find(".no-select.item").click((function(){(o||"select-assignees-modify"===e)&&m(i.data("update-url"),"clear",i.data("issue-id"),"").then(v),$(this).parent().find(".item").each((function(){$(this).removeClass("checked"),$(this).find(".octicon").removeClass("octicon-check")})),n.find(".item").each((function(){$(this).addClass("hide")})),a.removeClass("hide"),$($(this).parent().data("id")).val("")}))}function n(e,t){var n=$("".concat(e," .menu")),a=$(".ui".concat(e,".list")),i="update"===n.data("action");n.find(".item:not(.no-select)").click((function(){switch($(this).parent().find(".item").each((function(){$(this).removeClass("selected active")})),$(this).addClass("selected active"),i&&m(n.data("update-url"),"",n.data("issue-id"),$(this).data("id")).then(v),t){case"#milestone_id":a.find(".selected").html('<a class="item" href='.concat($(this).data("href"),">").concat(h($(this).text()),"</a>"));break;case"#assignee_id":a.find(".selected").html('<a class="item" href='.concat($(this).data("href"),">")+'<img class="ui avatar image" src='.concat($(this).data("avatar"),">").concat(h($(this).text()),"</a>"))}$(".ui".concat(e,".list .no-select")).addClass("hide"),$(t).val($(this).data("id"))})),n.find(".no-select.item").click((function(){$(this).parent().find(".item:not(.no-select)").each((function(){$(this).removeClass("selected active")})),i&&m(n.data("update-url"),"",n.data("issue-id"),$(this).data("id")).then(v),a.find(".selected").html(""),a.find(".no-select").removeClass("hide"),$(t).val("")}))}}function w(){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&&l(".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 n=$("#issue-title"),i=$("#edit-title-input input"),o=function(){return n.toggle(),$(".not-in-edit").toggle(),$("#edit-title-input").toggle(),$(".in-edit").toggle(),i.focus(),!1};$("#edit-title").click(o),$("#cancel-edit-title").click(o),$("#save-edit-title").click(o).click((function(){return 0===i.val().length||i.val()===n.text()?(i.val(n.text()),!1):($.post($(this).data("update-url"),{_csrf:a,title:i.val()},(function(e){i.val(e.title),n.text(e.title),v()})),!1)})),$(".context-dropdown").dropdown({action:"hide"}),$(".quote-reply").click((function(e){$(this).closest(".dropdown").find(".menu").toggle("visible");var t,n=$(this).data("target");if($(this).hasClass("quote-reply-diff")){var a=$(this).closest(".comment-code-cloud");a.find("button.comment-form-reply").click(),t=a.find('[name="content"]')}else t=$("#content");var i=$("#comment-".concat(n)).text().replace(/\n/g,"\n> "),o="> ".concat(i,"\n\n");""!==t.val()?t.val("".concat(t.val(),"\n\n").concat(o)):t.val("".concat(o)),t.focus(),e.preventDefault()})),$(".edit-content").click((function(e){$(this).closest(".dropdown").find(".menu").toggle("visible");var t,n=$(this).closest(".header").next(),i=n.find(".edit-content-zone"),o=n.find(".render-content"),r=n.find(".raw-content");if(0===i.html().length){i.html($("#edit-content-form").html()),t=i.find("textarea"),issuesTribute.attach(t.get()),emojiTribute.attach(t.get());var c=i.find(".dropzone");c.data("saved",!1);var s=i.find(".comment-files");if(c.length>0){var l={};c.dropzone({url:c.data("upload-url"),headers:{"X-Csrf-Token":a},maxFiles:c.data("max-file"),maxFilesize:c.data("max-size"),acceptedFiles:"*/*"===c.data("accepts")?null:c.data("accepts"),addRemoveLinks:!0,dictDefaultMessage:c.data("default-message"),dictInvalidFileType:c.data("invalid-input-type"),dictFileTooBig:c.data("file-too-big"),dictRemoveFile:c.data("remove-file"),init:function(){this.on("success",(function(e,t){l[e.name]={uuid:t.uuid,submitted:!1};var n=$('<input id="'.concat(t.uuid,'" name="files" type="hidden">')).val(t.uuid);s.append(n)})),this.on("removedfile",(function(e){e.name in l&&($("#".concat(l[e.name].uuid)).remove(),c.data("remove-url")&&c.data("csrf")&&!l[e.name].submitted&&$.post(c.data("remove-url"),{file:l[e.name].uuid,_csrf:c.data("csrf")}))})),this.on("submit",(function(){$.each(l,(function(e){l[e].submitted=!0}))})),this.on("reload",(function(){$.getJSON(i.data("attachment-url"),(function(e){var t=c.get(0).dropzone;t.removeAllFiles(!0),s.empty(),$.each(e,(function(){var e="".concat(c.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},c.find("img[src='".concat(e,"']")).css("max-width","100%");var n=$('<input id="'.concat(this.uuid,'" name="files" type="hidden">')).val(this.uuid);s.append(n)}))}))}))}}),c.get(0).dropzone.emit("reload")}var d=i.find(".ui.comment.form"),u=d.find(".tabular.menu");u.attr("data-write",i.data("write")),u.attr("data-preview",i.data("preview")),u.find(".write.item").attr("data-tab",i.data("write")),u.find(".preview.item").attr("data-tab",i.data("preview")),d.find(".write.segment").attr("data-tab",i.data("write")),d.find(".preview.segment").attr("data-tab",i.data("preview")),f(d),i.find(".cancel.button").click((function(){o.show(),i.hide(),c.get(0).dropzone.emit("reload")})),i.find(".save.button").click((function(){o.show(),i.hide();var e=s.find("[name=files]").map((function(){return $(this).val()})).get();$.post(i.data("update-url"),{_csrf:a,content:t.val(),context:i.data("context"),files:e},(function(e){0===e.length?o.html($("#no-content").html()):(o.html(e.content),emojify.run(o[0]),$("pre code",o[0]).each((function(){hljs.highlightBlock(this)})));var t=n.parent();t.find(".ui.small.images").length?""===e.attachments?t.find(".ui.small.images").parent().remove():t.find(".ui.small.images").html(e.attachments):""!==e.attachments&&(t.append('<div class="ui bottom attached segment"><div class="ui small images"></div></div>'),t.find(".ui.small.images").html(e.attachments)),c.get(0).dropzone.emit("submit"),c.get(0).dropzone.emit("reload")}))}))}else t=n.find("textarea");i.show(),o.hide(),0===t.val().length&&t.val(r.text()),t.focus(),e.preventDefault()})),$(".delete-comment").click((function(){var e=$(this);return window.confirm(e.data("locale"))&&$.post(e.data("url"),{_csrf:a}).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 c=$(".merge-button > button");c.on("click",(function(e){e.preventDefault(),$(".".concat($(this).data("do"),"-fields")).show(),$(this).parent().hide()})),$(".merge-button > .dropdown").dropdown({onChange:function(e,t,n){n.data("do")&&(c.find(".button-text").text(n.text()),c.data("do",n.data("do")))}}),$(".merge-cancel").on("click",(function(e){e.preventDefault(),$(this).closest(".form").hide(),c.parent().show()})),function e(t){var n="";t||(t=$(document),n=".reactions > "),t.find("".concat(n,"a.label")).popup({position:"bottom left",metadata:{content:"title",title:"none"}}),t.find(".select-reaction > .menu > .item, ".concat(n,"a.label")).on("click",(function(t){var n=this;if(t.preventDefault(),!$(this).hasClass("disabled")){var i=$(this).hasClass("item")?$(this).closest(".select-reaction").data("action-url"):$(this).data("action-url"),o="".concat(i,"/").concat($(this).hasClass("blue")?"unreact":"react");$.ajax({type:"POST",url:o,data:{_csrf:a,content:$(this).data("content")}}).done((function(t){if(t&&(t.html||t.empty)){var a=$(n).closest(".content"),i=a.find(".segment.reactions");if(!t.empty&&i.length>0&&i.remove(),!t.empty){i=$('<div class="ui attached segment reactions"></div>');var o=a.find(".segment.bottom:first");o.length>0?i.insertBefore(o):i.appendTo(a),i.html(t.html);for(var r=i.find(".has-emoji"),c=0;c<r.length;c++)emojify.run(r.get(c));i.find(".dropdown").dropdown(),e(i)}}}))}}))}()}$(".repository.diff").length>0&&$(".diff-counter").each((function(){var e=$(this),t=e.find("span[data-line].add").data("line"),n=e.find("span[data-line].del").data("line"),a=parseFloat(t)/(parseFloat(t)+parseFloat(n))*100;e.find(".bar .add").css("width","".concat(a,"%"))})),$("#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 s=$(".repository.compare.pull");s.length>0&&(l(".choose.branch .dropdown"),s.find("button.show-form").on("click",(function(e){e.preventDefault(),s.find(".pullrequest-form").show(),$(this).parent().hide()}))),$(".repository.settings.branches").length>0&&(l(".protected-branches .dropdown"),$(".enable-protection, .enable-whitelist").change((function(){this.checked?$($(this).data("target")).removeClass("disabled"):$($(this).data("target")).addClass("disabled")})))}function l(e){var t=$(e);t.dropdown({fullTextSearch:!0,selectOnKeydown:!1,onChange:function(e,t,n){n.data("url")&&(window.location.href=n.data("url"))},message:{noResults:t.data("no-results")}})}}function y(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)),f(e.parent(".form")),t}function k(){$(".access-mode.menu .item").click((function(){var e=$(this).parent();$.post(e.data("url"),{_csrf:a,uid:e.data("uid"),mode:$(this).data("value")})}))}function _(){$(".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,n,a=$(".breadcrumb span.section"),i=$(".breadcrumb div.divider");if(8===e.keyCode&&0===$(this).getCursorPosition()&&a.length>0&&(t=a.last().find("a").text(),$(this).val(t+$(this).val()),$(this)[0].setSelectionRange(t.length,t.length),a.last().remove(),i.last().remove()),191===e.keyCode){n=$(this).val().split("/");for(var o=0;o<n.length;++o)t=n[o],o<n.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)}n=[],$(".breadcrumb span.section").each((function(){var e=$(this);e.find("a").length?n.push(e.find("a").text()):n.push(e.text())})),$(this).val()&&n.push($(this).val()),$("#tree_path").val(n.join("/"))})).trigger("keyup");var t=$(".repository.editor textarea#edit_area");if(t.length){var n=t.data("markdown-file-exts").split(","),i=t.data("line-wrap-extensions").split(",");e.on("keyup",(function(){var s,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?(s=v.mode,l=v.mime,f=s):f=d,g.length&&f&&o&&o.length&&o.indexOf(f)>=0?(h=g.data("url"),g.data("url",h.replace(/(.*)\/.*/i,"$1/".concat(s))),g.show()):g.hide(),!(n.indexOf(u)>=0&&function(e){return c&&(c.toTextArea(),c=null),!!r||(r=new SimpleMDE({autoDownloadFontAwesome:!1,element:e[0],forceSync:!0,renderingConfig:{singleLineBreaks:!1},indentWithTabs:!1,tabSize:4,spellChecker:!1,previewRender:function(t,n){return setTimeout((function(){$.post(e.data("url"),{_csrf:a,mode:"gfm",context:e.data("context"),text:t},(function(e){n.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))&&(c||function(e){return r&&(r.toTextArea(),r=null),!!c||((c=CodeMirror.fromTextArea(e[0],{lineNumbers:!0})).on("change",(function(t,n){e.val(t.getValue())})),!0)}(t))){s&&(c.setOption("mode",l),CodeMirror.autoLoadMode(c,s)),i.indexOf(u)>=0?c.setOption("lineWrapping",!0):c.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?(c.setOption("indentWithTabs",!0),c.setOption("extraKeys",{})):(c.setOption("indentWithTabs",!1),c.setOption("extraKeys",{Tab:function(e){var t=Array(parseInt(e.getOption("indentUnit"))+1).join(" ");e.replaceSelection(t)}})),c.setOption("indentUnit",e.indent_size||4),c.setOption("tabSize",e.tab_width||4)})))}})).trigger("keyup");var s=$("#commit-button"),l=$(".ui.edit.form");s.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");s.prop("disabled",!e)}}),s.click((function(e){0===t.val().length&&($("#edit-empty-content-modal").modal({onApprove:function(){$(".edit.form").submit()}}).modal("show"),e.preventDefault())}))}}function C(){$(".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 x(){$(".ui.button").keypress((function(e){13!==e.keyCode&&32!==e.keyCode||$(this).click()}))}function S(){$(".code-view .linenums").length>0&&($(document).on("click",".lines-num span",(function(e){var t=$(this),n=t.parent().siblings(".lines-code").find("ol.linenums > li");A(n,n.filter("[rel=".concat(t.attr("id"),"]")),e.shiftKey?n.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+)$/),n=$(".code-view ol.linenums > li");if(t)return e=n.filter(".".concat(t[1])),A(n,e,n.filter(".".concat(t[2]))),void $("html, body").scrollTop(e.offset().top-200);(t=window.location.hash.match(/^#(L|n)(\d+)$/))&&(e=n.filter(".L".concat(t[2])),A(n,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 n=$(t.target),a=n.parent().parent();$.get("".concat(n.data("url"),"?").concat(n.data("query"),"&anchor=").concat(n.data("anchor")),(function(t){a.replaceWith(t),$('[data-anchor="'.concat(n.data("anchor"),'"]')).on("click",(function(t){e(t)}))}))}(e)}))}function q(e){$.ajax({url:"".concat(i,"/user/u2f/sign"),type:"POST",headers:{"X-Csrf-Token":a},data:JSON.stringify(e),contentType:"application/json; charset=utf-8"}).done((function(e){window.location.replace(e)})).fail((function(){L(1)}))}function T(e){(function(e){if(!("errorCode"in e))return!1;if(0===e.errorCode)return!1;return L(e.errorCode),!0})(e)||$.ajax({url:"".concat(i,"/user/settings/security/u2f/register"),type:"POST",headers:{"X-Csrf-Token":a},data:JSON.stringify(e),contentType:"application/json; charset=utf-8",success:function(){v()},fail:function(){L(1)}})}function L(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(n){n!==e&&t[n].addClass("hide")})),$("#u2f-error").modal("show")}function O(){$.post("".concat(i,"/user/settings/security/u2f/request_register"),{_csrf:a,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(T).catch((function(e){L(void 0!==e?e.metaData.code:1)}))})).fail((function(e){409===e.status&&$("#nickname").closest("div.field").addClass("error")}))}function j(e){window.history.pushState?window.history.pushState(null,null,e):window.location.hash=e}function A(e,t,n){if(e.removeClass("active"),n){var a,i=parseInt(t.attr("rel").substr(1)),o=parseInt(n.attr("rel").substr(1));if(i!==o){i>o&&(a=i,i=o,o=a);for(var r=[],c=i;c<=o;c++)r.push(".L".concat(c));return e.filter(r.join(",")).addClass("active"),void j("#L".concat(i,"-L").concat(o))}}t.addClass("active"),j("#".concat(t.attr("rel")))}function D(){var e=$(this),t="";e.attr("id")&&(t+="#".concat(e.attr("id")));var n=$(".delete.modal".concat(t));return n.find(".name").text(e.data("name")),n.modal({closable:!1,onApprove:function(){"form"!==e.data("type")?$.post(e.data("url"),{_csrf:a,id:e.data("id")}).done((function(e){window.location.href=e.redirect})):$(e.data("form")).submit()}}).modal("show"),!1}function F(){var e=$(this),t="";e.attr("id")&&(t+="#".concat(e.attr("id")));var n=$(".addall.modal".concat(t));return n.find(".name").text(e.data("name")),n.modal({closable:!1,onApprove:function(){"form"!==e.data("type")?$.post(e.data("url"),{_csrf:a,id:e.data("id")}).done((function(e){window.location.href=e.redirect})):$(e.data("form")).submit()}}).modal("show"),!1}$((function(){var e,t,a,i,o;return l.a.async((function(r){for(;;)switch(r.prev=r.next){case 0:if(e=document.getElementById("graph-canvas")){r.next=3;break}return r.abrupt("return");case 3:return r.next=5,l.a.awrap(Promise.all([n.e(0).then(n.bind(null,12)),n.e(0).then(n.t.bind(null,13,7))]));case 5:t=r.sent,a=u()(t,1),i=a[0].default,o=[],$("#graph-raw-list li span.node-relation").each((function(){o.push($(this).text())})),i(e,o);case 11:case"end":return r.stop()}}))})),"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 n=document.selection.createRange(),a=document.selection.createRange().text.length;n.moveStart("character",-e.value.length),t=n.text.length-a}return t},$(document).ready((function(){if(a=$("meta[name=_csrf]").attr("content"),i=$("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 n=$("#dropzone");if(n.length>0){var o={};new Dropzone("#dropzone",{url:n.data("upload-url"),headers:{"X-Csrf-Token":a},maxFiles:n.data("max-file"),maxFilesize:n.data("max-size"),acceptedFiles:"*/*"===n.data("accepts")?null:n.data("accepts"),addRemoveLinks:!0,dictDefaultMessage:n.data("default-message"),dictInvalidFileType:n.data("invalid-input-type"),dictFileTooBig:n.data("file-too-big"),dictRemoveFile:n.data("remove-file"),init:function(){this.on("success",(function(e,t){o[e.name]=t.uuid;var n=$('<input id="'.concat(t.uuid,'" name="files" type="hidden">')).val(t.uuid);$(".files").append(n)})),this.on("removedfile",(function(e){e.name in o&&$("#".concat(o[e.name])).remove(),n.data("remove-url")&&n.data("csrf")&&$.post(n.data("remove-url"),{file:o[e.name],_csrf:n.data("csrf")})}))}})}emojify.setConfig({img_dir:"".concat(i,"/vendor/plugins/emojify/images"),ignore_emoticons:!0});for(var r=document.getElementsByClassName("has-emoji"),c=0;c<r.length;c++){emojify.run(r[c]);for(var s=0;s<r[c].childNodes.length;s++)"A"===r[c].childNodes[s].nodeName&&emojify.run(r[c].childNodes[s])}var l,d,u,f,g,T,j,A,N,R,E,I,z,M,P,B=new Clipboard(".clipboard");if(B.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"))})),B.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(D),$(".add-all-button").click(F),$(".delete-branch-button").click(D),$(".undo-button").click((function(){var e=$(this);$.post(e.data("url"),{_csrf:a,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:a}).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),n=encodeURIComponent(t.text().toLowerCase().replace(/[^\u00C0-\u1FFF\u2C00-\uD7FF\w\- ]/g,"").replace(/[ ]/g,"-")),a=n;e[n]>0&&(a="".concat(n,"-").concat(e[n])),void 0===e[n]?e[n]=1:e[n]+=1,(t=t.wrap('<div id="'.concat(a,'" class="anchor-wrap" ></div>'))).append('<a class="anchor" href="#'.concat(a,'"><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,n=$(".issue-checkbox").children("input:checked").map((function(){return this.dataset.issueId})).get().join(),a=this.dataset.url;"0"===t&&"/assignee"===a.substr(-9)&&(t="",e="clear"),m(a,e,n,t).then((function(){"close"!==e&&"open"!==e||$('.issue-checkbox input[type="checkbox"]').each((function(e,t){t.checked=!1})),v()}))})),$('.issue-checkbox input[type="checkbox"]:checked').first().each((function(e,t){t.checked=!1,$(t).click()})),x(),$("#search-user-box").search({minCharacters:2,apiSettings:{url:"".concat(i,"/api/v1/users/search?q={query}"),onResponse:function(e){var t=[];return $.each(e.data,(function(e,n){var a=n.login;n.full_name&&n.full_name.length>0&&(a+=" (".concat(h(n.full_name),")")),t.push({title:a,image:n.avatar_url})})),{results:t}}},searchFields:["login","full_name"],showNoResults:!1}),(l=$("#search-team-box")).search({minCharacters:2,apiSettings:{url:"".concat(i,"/api/v1/orgs/").concat(l.data("org"),"/teams/search?q={query}"),headers:{"X-Csrf-Token":a},onResponse:function(e){var t=[];return $.each(e.data,(function(e,n){var a="".concat(n.name," (").concat(n.permission," access)");t.push({title:a})})),{results:t}}},searchFields:["name","description"],showNoResults:!1}),(d=$("#search-repo-box")).search({minCharacters:2,apiSettings:{url:"".concat(i,"/api/v1/repos/search?q={query}&uid=").concat(d.data("uid")),onResponse:function(e){var t=[];return $.each(e.data,(function(e,n){t.push({title:n.full_name.split("/")[1],description:n.full_name})})),{results:t}}},searchFields:["full_name"],showNoResults:!1}),b(),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(n,a){if($("#db_host").val()===a)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")}))),w(),(u=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",u),$("#auth_username").on("input",u),$("#mirror").on("change",u),function(){var e=$(".repository.wiki textarea#edit_area"),t=0,n=null;if(e.length>0){var i=new SimpleMDE({autoDownloadFontAwesome:!1,element:e[0],forceSync:!0,previewRender:function(o,r){return setTimeout((function(){var c=function(){t=0,null!=n&&(clearTimeout(n),n=null),$.post(e.data("url"),{_csrf:a,mode:"gfm",context:e.data("context"),text:o},(function(e){r.innerHTML='<div class="markdown ui segment">'.concat(e,"</div>"),emojify.run($(".editor-preview")[0]),$(r).find("pre code").each((function(e,t){hljs.highlightBlock(t)}))}))};i.isSideBySideActive()?(++t>10&&c(),null!=n&&(clearTimeout(n),n=null),n=setTimeout(c,600)):c()}),0),i.isSideBySideActive()?r.innerHTML:"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,n=t.getSelection();if(t.replaceSelection("`".concat(n,"`")),!n){var a=t.getCursor();t.setCursor(a.line,a.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","side-by-side"]});$(i.codemirror.getInputField()).addClass("js-quick-submit"),setTimeout((function(){var e=$('.repository.wiki.new .previewtabs a[data-tab="write"]'),n=$('.repository.wiki.new .previewtabs a[data-tab="preview"]'),a=$(".editor-toolbar"),i=$(".editor-toolbar a.fa-eye"),o=$(".editor-toolbar a.fa-columns");e.on("click",(function(){a.hasClass("disabled-for-preview")&&i.click()})),n.on("click",(function(){a.hasClass("disabled-for-preview")||i.click()})),i.on("click",(function(){setTimeout((function(){a.hasClass("disabled-for-preview")?(e.hasClass("active")&&e.removeClass("active"),n.hasClass("active")||n.addClass("active")):(e.hasClass("active")||e.addClass("active"),n.hasClass("active")&&n.removeClass("active"))}),0)})),o.on("click",(function(){t=10}))}),0)}}(),p(),_(),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()})),0!==$(".edit.githook").length&&CodeMirror.autoLoadMode(CodeMirror.fromTextArea($("#content")[0],{lineNumbers:!0,mode:"shell"}),"shell"),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:a}).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||i(),"2"===e&&o()})),$("#auth_type").change(),$("#security_protocol").change(i),$("#use_paged_search").change(o),$("#oauth2_provider").change(r),$("#oauth2_use_custom_url").change(c)),$(".admin.edit.authentication").length>0){var e=$("#auth_type").val();"2"===e||"5"===e?($("#security_protocol").change(i),"2"===e&&$("#use_paged_search").change(o)):"6"===e&&($("#oauth2_provider").change(r),$("#oauth2_use_custom_url").change(c),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 n=$(".select.table .ui.checkbox");$(".select.action").click((function(){switch($(this).data("action")){case"select-all":n.checkbox("check");break;case"deselect-all":n.checkbox("uncheck");break;case"inverse":n.checkbox("toggle")}})),$("#delete-selection").click((function(){var e=$(this);e.addClass("loading disabled");var t=[];n.each((function(){$(this).checkbox("is checked")&&t.push($(this).data("id"))})),$.post(e.data("link"),{_csrf:a,ids:t}).done((function(){window.location.href=e.data("redirect")}))}))}}function i(){$("#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()}c()}function c(){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("")}}}(),S(),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 n=this.repoTypes[e].searchMode,a=this.searchURL,i=this.searchQuery;$.getJSON(a,(function(o,r,c){if(a===t.searchURL){t.repos=o.data;var s=c.getResponseHeader("X-Total-Count");""===i&&""===n&&(t.reposTotalCount=s),t.repoTypes[e].count=s}})).always((function(){a===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()})),f=$("#navbar"),g=$("#navbar-expand-toggle"),T=!1,g.click((function(){(T=!T)?(f.addClass("shown"),g.addClass("active")):(f.removeClass("shown"),g.removeClass("active"))})),j=$("#manage_topic"),A=$("#topic_edit"),N=$("#repo-topics"),R=$("#save_topic"),E=$("#topic_edit .dropdown"),I=$("#topic_edit.ui.form"),M=$("div.hide#validate_prompt"),P={countPrompt:M.children("#count_prompt").text(),formatPrompt:M.children("#format_prompt").text()},M.remove(),z=P,j.click((function(){N.hide(),A.css("display","")})),R.click((function(){var e=$("input[name=topics]").val();$.post(R.data("link"),{_csrf:a,topics:e},(function(t,n,a){if("ok"===a.responseJSON.status){if(N.children(".topic").remove(),e.length)for(var i=e.split(","),o=N.children("a").last(),r=0;r<i.length;r++)$('<div class="ui small label topic" style="cursor:pointer;">'.concat(i[r],"</div>")).insertBefore(o);A.css("display","none"),N.show()}})).fail((function(t){if(422===t.status)if(t.responseJSON.invalidTopics.length>0){z.formatPrompt=t.responseJSON.message;var n=t.responseJSON.invalidTopics,a=E.children("a.ui.label");e.split(",").forEach((function(e,t){for(var i=0;i<n.length;i++)n[i]===e&&a.eq(t).removeClass("green").addClass("red")}))}else z.countPrompt=t.responseJSON.message})).always((function(){I.form("validate form")}))})),E.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(i,"/api/v1/topics/search?q={query}"),throttle:500,cache:!1,onResponse:function(e){var t={success:!1,results:[]},n=this.urlData.query.trim().replace(/<[^>]*>?/gm,""),a=!1,i=[];if(E.find("div.label.visible.topic,a.label.visible").each((function(e,t){i.push(t.dataset.value)})),e.topics){for(var o=!1,r=0;r<e.topics.length;r++)-1===i.indexOf(e.topics[r].topic_name)&&(e.topics[r].topic_name.toLowerCase()===n.toLowerCase()&&(a=!0),t.results.push({description:e.topics[r].topic_name,"data-value":e.topics[r].topic_name}),o=!0);t.success=o}return n.length>0&&!a?(t.success=!0,t.results.unshift({description:n,"data-value":n})):n.length>0&&a&&t.results.sort((function(e,t){return e.description.toLowerCase()===n.toLowerCase()?-1:t.description.toLowerCase()===n.toLowerCase()?1:e.description>t.description?-1:e.description<t.description?1:0})),t}},onLabelCreate:function(e){return e=e.toLowerCase().trim(),this.attr("data-value",e).contents().first().replaceWith(e),$(this)},onAdd:function(e,t,n){e=e.toLowerCase().trim(),$(n).attr("data-value",e),$(n).attr("data-text",e)}}),$.fn.form.settings.rules.validateTopic=function(e,t){var n=E.children("a.ui.label"),a=0===n.length||n.last().attr("data-value").match(t);return a||n.last().removeClass("green").addClass("red"),a&&0===E.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:z.formatPrompt},{type:"maxCount[25]",prompt:z.countPrompt}]}}}),0!==$("#wait-for-key").length&&u2fApi.ensureSupport().then((function(){$.getJSON("".concat(i,"/user/u2f/challenge")).success((function(e){u2fApi.sign(e.appId,e.challenge,e.registeredKeys,30).then(q).catch((function(e){L(void 0!==e?e.metaData.code:1)}))}))})).catch((function(){window.location.href="".concat(i,"/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(O).catch((function(){L("browser")}))})),function(){var e=$("#repolink").val(),t=$("#repoId").val(),n=$("#crossRepoSearch").val(),a="".concat(i,"/api/v1/repos/").concat(e,"/issues?q={query}");"true"===n&&(a="".concat(i,"/api/v1/repos/issues/search?q={query}&priority_repo_id=").concat(t));$("#new-dependency-drop-list").dropdown({apiSettings:{url:a,onResponse:function(e){var t={success:!0,results:[]},n=$("#new-dependency-drop-list").data("issue-id");return $.each(e,(function(e,a){a.id!==n&&t.results.push({name:"#".concat(a.number," ").concat(h(a.title),'<div class="text small dont-break-out">').concat(h(a.repository.full_name),"</div>"),value:a.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"),n=$(this).data("label-id"),a="labels=(-?[0-9]+%2c)*(".concat(n,")(%2c-?[0-9]+)*&");window.location=t.replace(new RegExp(a),"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 n=$(t[0]),a=n.attr("href"),i=n.data("label-id"),o="labels=(-?[0-9]+%2c)*(".concat(i,")(%2c-?[0-9]+)*&");window.location=a.replace(new RegExp(o),"labels=$1-$2$3&")}}}))}(),$(".title_wip_desc > a").click((function(e){e.preventDefault();var t=$("#issue_title");t.focus();var n=t.val().trim().toUpperCase();for(var a in wipPrefixes)if(n.startsWith(wipPrefixes[a].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"),y(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"),n=$(this).data("side"),a=$(this).data("idx"),i=$(this).data("path"),o=$("#pull_review_add_comment").html(),r=$(this).closest("tr"),c=r.next();c.hasClass("add-comment")||(c=$('<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(c));var s=c.find(".add-comment-".concat(n)),l=s.find(".comment-code-cloud");0===l.length&&(s.html(o),y((l=s.find(".comment-code-cloud")).find(".menu")),s.find("input[name='line']").val(a),s.find("input[name='side']").val("left"===n?"previous":"proposed"),s.find("input[name='path']").val(i)),l.find("textarea").focus()}}))),function e(){var t=$("#repo_migrating");if($("#repo_migrating_failed").hide(),t){var n=t.attr("repo");if(void 0===n)return;$.ajax({type:"GET",url:"".concat(i,"/").concat(n,"/status"),data:{_csrf:a},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"),n=$("#non_template");""!==e.val()?(t.show(),n.hide()):(t.hide(),n.show())};e.change(t),t();var n=function(){$("#repo_template_search").dropdown({apiSettings:{url:"".concat(i,"/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,n){t.results.push({name:h(n.full_name),value:n.id})})),t},cache:!1},fullTextSearch:!0})};$("#uid").change(n),n()}(),$("#repo-clone-url").length>0)switch(localStorage.getItem("repo-clone-protocol")){case"ssh":0===$("#repo-clone-ssh").click().length&&$("#repo-clone-https").click();break;default:$("#repo-clone-https").click()}var J,H={"div.user.settings":C,"div.repository.settings.collaboration":k};for(J in H)if($(J).length>0){H[J]();break}var V=$("#clone_addr");V.change((function(){var e=$("#repo_name");V.val().length>0&&0===e.val().length&&e.val(V.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,n){var a=document.getElementById(e);if(a){(n=n||{}).contributions=n.contributions||"contributions",n.no_contributions=n.no_contributions||"No contributions";var i=["${","}"];Vue.component("activity-heatmap",{delimiters:i,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 n=[],a=0;a<e.length;a++)t.totalContributions+=e[a].contributions,n[a]={date:new Date(1e3*e[a].timestamp),count:e[a].contributions};t.values=n,t.isLoading=!1}))},getColor:function(e){var t=document.createElement("div");t.className="heatmap-color-".concat(e),document.body.appendChild(t);var n=getComputedStyle(t).backgroundColor;return document.body.removeChild(t),n}},template:'<div><div v-show="isLoading"><slot name="loading"></slot></div><h4 class="total-contributions" v-if="!isLoading"><span v-html="totalContributions"></span> total contributions in the last 12 months</h4><calendar-heatmap v-show="!isLoading" :locale="locale" :no-data-text="locale.no_contributions" :tooltip-unit="locale.contributions" :end-date="endDate" :values="values" :range-color="colorRange" />'}),new Vue({delimiters:i,el:a,data:{suburl:document.querySelector("meta[name=_suburl]").content,heatmapUser:t,locale:n}})}},$(".commit-button").click((function(e){e.preventDefault(),$(this).parent().find(".commit-body").toggle()})),window.toggleDeadlineForm=function(){$("#deadlineForm").fadeToggle(150)},window.setDeadline=function(){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 n=Date.parse(e);if(Number.isNaN(n))return $("#deadline-loader").removeClass("loading"),$("#deadline-err-invalid-date").show(),!1;t=new Date(n)}$.ajax("".concat($("#update-issue-deadline-form").attr("action"),"/deadline"),{data:JSON.stringify({due_date:t}),headers:{"X-Csrf-Token":a,"X-Remote":!0},contentType:"application/json",type:"POST",success:function(){v()},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)}}]);
//# sourceMappingURL=index.js.map