f){n=e.find(".backlog-table-body .us-item-row")[i],s(n);break}l.push(void 0)}return l}},c=function(){return e.find(".doom-line").remove()},s=function(t){var e;return e=r.instant("BACKLOG.DOOMLINE"),$(t).before(n({text:e}))},a=function(){var t;return t=e.find(".backlog-table-body .us-item-row"),_.map(t,function(t){return angular.element(t)})},t.$on("userstories:loaded",u),t.$watch("stats",u)},a=function(e,r,n,i){var o,s,a,u,c,p,f;return s=function(){var t;return t=r.find(".backlog-table-body input:checkbox:checked"),_.map(t,function(t){var r;return t=$(t).closest(".tg-scope"),r=t.scope(),r.us.milestone=e.sprints[0].id,r.us})},p=function(n,o){var s,a,u;return u=_(e.userstories),e.userstories=u.without.apply(u,n).value(),s=_.map(n,function(t,e){return t.total_points}),a=_.reduce(s,function(t,e){return t+e}),o.user_stories=_.union(o.user_stories,n),o.total_points+=a,t.saveAll(n).then(function(){return i.loadSprints(),
i.loadProjectStats()}),r.find(".move-to-sprint").hide()},u=function(t){return p(t,e.currentSprint)},c=function(t){return p(t,e.sprints[0])},f=!1,a=null,o=function(t){var n,i;return a=t.closest(".us-item-row"),t.closest(".us-item-row").toggleClass("ui-multisortable-multiple"),n=r.find(".move-to-sprint"),i=r.find(".backlog-table-body input:checkbox:checked"),i.length>0&&e.sprints.length>0?n.show():n.hide()},$(window).on("keydown.shift-pressed keyup.shift-pressed",function(t){return f=!!t.shiftKey,!0}),r.on("change",".backlog-table-body input:checkbox",function(t){var e,r,n,i,s;return a&&f&&(r=[],e=$(t.currentTarget).closest(".us-item-row"),n=a.nextAll(),i=a.prevAll(),_.some(n,function(t){return t===e[0]})?r=a.nextUntil(e):_.some(i,function(t){return t===e[0]})&&(r=a.prevUntil(e)),_.map(r,function(t){var e;return e=$(t).find("input:checkbox"),e.prop("checked",!0),o(e)})),s=angular.element(t.currentTarget),s.closest(".us-item-row").toggleClass("is-checked"),o(s)}),r.on("click","#move-to-latest-sprint",function(t){return function(t){var r;return r=s(),e.$apply(_.partial(c,r))}}(this)),r.on("click","#move-to-current-sprint",function(t){return function(t){var r;return r=s(),e.$apply(_.partial(u,r))}}(this)),r.on("click","#show-tags",function(t){return t.preventDefault(),i.toggleShowTags(),l(i)})},l=function(t){var e,n;return e=angular.element("#show-tags"),t.showTags?(e.addClass("active"),n=r.instant("BACKLOG.TAGS.HIDE"),e.text(n)):(e.removeClass("active"),n=r.instant("BACKLOG.TAGS.SHOW"),e.text(n))},u=function(t,e,r){var n;return n=e.find("sidebar.backlog-filter"),n.addClass("active"),r.activeFilters=!0},c=function(t,n,i){var o,s,a,u;return a=n.find("sidebar.backlog-filter"),a.one("transitionend",function(){return g(150,function(){return e.$broadcast("resize"),$(".burndown").css("visibility","visible")})}),u=angular.element("#show-filters-button"),$(".burndown").css("visibility","hidden"),a.toggleClass("active"),u.toggleClass("active"),o=r.instant("BACKLOG.FILTERS.HIDE"),s=r.instant("BACKLOG.FILTERS.SHOW"),m(u,[o,s]),i.toggleActiveFilters()},s=function(t,e,r,n){return t.filtersSearch={},e.on("click","#show-filters-button",function(r){return r.preventDefault(),t.$apply(function(){return c(t,e,n)})})},i=function(t,e,r,n){var i,c;return i=e.controller(),a(t,e,r,i),s(t,e,r,i),o(t,e,r,i),c=i.location.search(),(c.status||c.tags||c.q||c.assigned_to||c.owner)&&u(t,e,i),t.$on("showTags",function(){return l(i)}),t.$on("$destroy",function(){return e.off(),$(window).off(".shift-pressed")})},{link:i}},f.directive("tgBacklog",["$tgRepo","$rootScope","$translate",e]),s=function(t,e,r,n){var i,o;return o=e.get("backlog/us-role-points-popover.html",!0),i=function(e,i,s){return u(e,"project",function(t){var n,s;return s=_.filter(t.roles,"computable"),n=_.size(s),n>1?i.append(r(o({roles:s}))(e)):(i.find(".icon-arrow-down").remove(),i.find(".header-points").addClass("not-clickable"))}),e.$on("uspoints:select",function(t,e,r){return i.find(".popover").popover().close(),i.find(".header-points").html(r+"/Total")}),e.$on("uspoints:clear-selection",function(t,e){var r;return i.find(".popover").popover().close(),r=n.instant("COMMON.FIELDS.POINTS"),i.find(".header-points").text(r)}),i.on("click",function(t){var e;return e=angular.element(t.target),(e.is("span")||e.is("div"))&&t.stopPropagation(),i.find(".popover").popover().open()}),i.on("click",".clear-selection",function(e){return e.preventDefault(),e.stopPropagation(),t.$broadcast("uspoints:clear-selection")}),i.on("click",".role",function(e){var r,n;return e.preventDefault(),e.stopPropagation(),n=angular.element(e.currentTarget),r=n.scope(),t.$broadcast("uspoints:select",n.data("role-id"),n.text())}),e.$on("$destroy",function(){return i.off()})},{link:i}},f.directive("tgUsRolePointsSelector",["$rootScope","$tgTemplate","$compile","$translate",s]),o=function(t,e,r){var n,i;return i=r.get("common/estimation/us-points-roles-popover.html",!0),n=function(e,n,o){var s,a,u,c,l,p,f;return s=n.controller(),f=null,p=null,c=null,u=null,e.$on("uspoints:select",function(t,r,n){var i;return i=e.$eval(o.tgBacklogUsPoints),p=r,u.render()}),e.$on("uspoints:clear-selection",function(t){var r;return r=e.$eval(o.tgBacklogUsPoints),p=null,u.render()}),e.$watch(o.tgBacklogUsPoints,function(i){var o;if(i)return u=t.create(n,i,e.project),o=u.calculateRoles(),0===o.length?(n.find(".icon-arrow-bottom").remove(),n.find("a.us-points").addClass("not-clickable")):1===o.length&&(p=_.keys(i.points)[0]),u.isEditable&&a(),u.onSelectedPointForRole=function(t,e,r){return i.points=r,u.render(),this.save(t,e).then(function(){return s.loadProjectStats()})},u.render=function(){var t,e,n,i,s,a,u,c,l;return l=this.calculateTotalPoints(),null==p||1===o.length?(u=l,c=l):(i=this.us.points[p],s=this.pointsById[i],u=s.name+" / "+l+"",c=s.name+" / "+l),t={totalPoints:l,roles:this.calculateRoles(),editable:this.isEditable,text:u,title:c},n="common/estimation/us-estimation-total.html",a=r.get(n,!0),e=a(t),this.$el.html(e)},u.render()}),l=function(){var t,e;return e=u.calculateRoles(),t=i({roles:e}),n.append(t),n.find(".pop-role").popover().open(function(){return $(this).remove()})},a=function(){return n.on("click","a.us-points",function(t){var r;return t.preventDefault(),t.stopPropagation(),r=e.$eval(o.tgBacklogUsPoints),f=p,null!=p?u.renderPointsSelector(p):l()}),n.on("click",".role",function(t){var r,i,s;return t.preventDefault(),t.stopPropagation(),i=angular.element(t.currentTarget),s=e.$eval(o.tgBacklogUsPoints),f=i.data("role-id"),r=n.find(".pop-role"),r.find("a").removeClass("active"),r.find("a[data-role-id='"+f+"']").addClass("active"),u.renderPointsSelector(f)})},e.$on("$destroy",function(){return n.off()})},{link:n}},f.directive("tgBacklogUsPoints",["$tgEstimationsService","$tgRepo","$tgTemplate",o]),i=function(t){var e,r,n;return e=function(){return $(".js-burndown-graph").removeClass("shown"),$(".js-toggle-burndown-visibility-button").removeClass("active"),$(".js-burndown-graph").removeClass("open")},n=function(t){return $(".js-toggle-burndown-visibility-button").addClass("active"),t?$(".js-burndown-graph").addClass("shown"):$(".js-burndown-graph").addClass("open")},r=function(r,i,o){var s,a,u;return s=!0,a=c(["is-burndown-grpahs-collapsed"]),r.isBurndownGraphCollapsed=t.get(a)||!1,u=function(){return r.isBurndownGraphCollapsed?e(s):n(s),s=!1},r.$watch("showGraphPlaceholder",function(){if(null!=r.showGraphPlaceholder)return r.isBurndownGraphCollapsed=r.isBurndownGraphCollapsed||r.showGraphPlaceholder,u()}),i.on("click",".js-toggle-burndown-visibility-button",function(){return r.isBurndownGraphCollapsed=!r.isBurndownGraphCollapsed,t.set(a,r.isBurndownGraphCollapsed),u()}),r.$on("$destroy",function(){return i.off()})},{link:r}},f.directive("tgToggleBurndownVisibility",["$tgStorage",i]),r=function(t){var e,r;return r=function(e,r){var n,i,o,s,a,u,c,l,p,f,d;return f=e.width(),e.height(f/6),a=function(){l=[];for(var t=0,e=r.milestones.length-1;0<=e?t<=e:t>=e;0<=e?t++:t--)l.push(t);return l}.apply(this),o=[],d=_.map(r.milestones,function(t){return 0}),o.push({data:_.zip(a,d),lines:{fillColor:"rgba(0,0,0,0)"},points:{show:!1}}),u=_.map(r.milestones,function(t){return t.optimal}),o.push({data:_.zip(a,u),lines:{fillColor:"rgba(120,120,120,0.2)"}}),s=_.filter(_.map(r.milestones,function(t){return t.evolution}),function(t){return null!=t}),o.push({data:_.zip(a,s),lines:{fillColor:"rgba(102,153,51,0.3)"}}),n=_.map(r.milestones,function(t){return-t["team-increment"]-t["client-increment"]}),o.push({data:_.zip(a,n),lines:{fillColor:"rgba(255,51,51,0.3)"}}),p=_.map(r.milestones,function(t){return-t["team-increment"]}),o.push({data:_.zip(a,p),lines:{fillColor:"rgba(153,51,51,0.3)"}}),i=["rgba(0,0,0,1)","rgba(120,120,120,0.2)","rgba(102,153,51,1)","rgba(153,51,51,1)","rgba(255,51,51,1)"],c={grid:{borderWidth:{top:0,right:1,left:0,bottom:0},borderColor:"#ccc",hoverable:!0},xaxis:{ticks:r.milestones.length,axisLabel:t.instant("BACKLOG.CHART.XAXIS_LABEL"),axisLabelUseCanvas:!0,axisLabelFontSizePixels:12,axisLabelFontFamily:"Verdana, Arial, Helvetica, Tahoma, sans-serif",axisLabelPadding:5,tickFormatter:function(t,e){return""}},yaxis:{axisLabel:t.instant("BACKLOG.CHART.YAXIS_LABEL"),axisLabelUseCanvas:!0,axisLabelFontSizePixels:12,axisLabelFontFamily:"Verdana, Arial, Helvetica, Tahoma, sans-serif",axisLabelPadding:5},series:{shadowSize:0,lines:{show:!0,fill:!0},points:{show:!0,fill:!0,radius:4,lineWidth:2}},colors:i,tooltip:!0,tooltipOpts:{content:function(e,n,i,o){var s;return 1===o.seriesIndex?(s={sprintName:r.milestones[n].name,value:Math.abs(i)},t.instant("BACKLOG.CHART.OPTIMAL",s)):2===o.seriesIndex?(s={sprintName:r.milestones[n].name,value:Math.abs(i)},t.instant("BACKLOG.CHART.REAL",s)):3===o.seriesIndex?(s={sprintName:r.milestones[n].name,value:Math.abs(i)},t.instant("BACKLOG.CHART.INCREMENT_CLIENT",s)):(s={sprintName:r.milestones[n].name,value:Math.abs(i)},t.instant("BACKLOG.CHART.INCREMENT_TEAM",s))}}},e.empty(),e.plot(o,c).data("plot")},e=function(t,e,n){var i;return i=angular.element(e),t.$watch("stats",function(e){if(null!=t.stats)return r(i,t.stats),t.$on("resize",function(){return r(i,t.stats)})}),t.$on("$destroy",function(){return e.off()})},{link:e}},f.directive("tgBurndownBacklogGraph",["$translate",r]),n=function(t,e){var r,n,i,o;return o=t.get("backlog/progress-bar.html",!0),i=function(t,r,n,i){var s;return s=o({projectPointsPercentaje:n,closedPointsPercentaje:i}),s=e(s)(t),r.html(s)},r=function(t){var e;return e=_.max([0,t]),e=_.min([100,e]),Math.round(e)},n=function(t,e,n){var o;return o=angular.element(e),t.$watch(n.tgBacklogProgressBar,function(n){var o,s,a,u,c;if(null!=n)return c=n.total_points?n.total_points:n.defined_points,a=n.defined_points,o=n.closed_points,a>c?(u=100*c/a,s=100*o/a):(u=100,s=100*o/c),u=r(u-3),s=r(s-3),i(t,e,u,s)}),t.$on("$destroy",function(){return e.off()})},{link:n}},f.directive("tgBacklogProgressBar",["$tgTemplate","$compile",n])}.call(this),function(){var t,e,r,n,i;i=this.taiga,e=this.taiga.bindOnce,n=angular.module("taigaBacklog"),r=function(t){return $(t).scope().$destroy(),$(t).off(),$(t).remove()},t=function(){var t;return t=function(t,n,i){return e(t,"project",function(e){var i,o,s;if(e.my_permissions.indexOf("modify_us")>-1)return o=!1,i=dragula([n[0],$(".empty-backlog")[0]],{copySortSource:!1,copy:!1,isContainer:function(t){return t.classList.contains("sprint-table")},moves:function(t){return!!$(t).hasClass("row")}}),i.on("drag",function(t,e){var r,n;return n=$(t).parent(),o=n.hasClass("backlog-table-body"),$(document.body).addClass("drag-active"),r=$(t).find("input[type='checkbox']").is(":checked"),window.dragMultiple.start(t,e)}),i.on("cloned",function(t){return $(t).addClass("backlog-us-mirror")}),i.on("dragend",function(e){var n,i,s,a,u,c,l,p;return u=$(e).parent(),$(".doom-line").remove(),u=$(e).parent(),a=u.hasClass("backlog-table-body")||u.hasClass("empty-backlog"),c=o||a?o===a:$(e).scope().sprint.id===u.scope().sprint.id,n=window.dragMultiple.stop(),$(document.body).removeClass("drag-active"),l=null,i=n.length?n[0]:e,a?s=$(i).index(".backlog-table-body .row"):(s=$(i).index(),l=u.scope().sprint.id),c?p=n.length?_.map(n,function(t){return t=$(t).scope().us}):[$(e).scope().us]:(p=n.length?_.map(n,function(t){return t=$(t).scope().us}):[$(e).scope().us],n.length?_.each(n,function(t){return r(t)}):r(e)),t.$emit("sprint:us:move",p,s,l)}),s=autoScroll([window],{margin:20,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&i.dragging}}),t.$on("$destroy",function(){return n.off(),i.destroy()})})},{link:t}},n.directive("tgBacklogSortable",t)}.call(this),function(){var t,e,r,n,i;i=this.taiga,n=angular.module("taigaBacklog"),t=function(t,e){var r,n,i,o;return i=50,n={duration:500,easing:"linear"},o=function(t){return function(t){var e,r;return r=t.find(".sprint-table"),e=t.find(".compact-sprint"),e.toggleClass("active"),r.toggleClass("open")}}(this),r=function(t,r,i){return t.$watch(i.tgBacklogSprint,function(e){return e=t.$eval(i.tgBacklogSprint),e.closed?r.addClass("sprint-closed"):o(r)}),r.on("click",".sprint-name > .compact-sprint",function(t){return t.preventDefault(),o(r),r.find(".sprint-table").slideToggle(n)}),r.on("click",".edit-sprint",function(r){var n;return r.preventDefault(),n=t.$eval(i.tgBacklogSprint),e.$broadcast("sprintform:edit",n)}),t.$on("$destroy",function(){return r.off()})},{link:r}},n.directive("tgBacklogSprint",["$tgRepo","$rootScope",t]),e=function(t,e,r,n){var i,o;return o=e.get("backlog/sprint-header.html"),i=function(e,i,s,a){var u,c,l,p;return l=n.instant("BACKLOG.SPRINTS.DATE"),u=function(){return e.project.my_permissions.indexOf("modify_milestone")!==-1},c=function(){return e.project.my_permissions.indexOf("view_milestones")!==-1},p=function(n){var s,a,p,f,d,h,g;return h=t.resolve("project-taskboard",{project:e.project.slug,sprint:n.slug}),d=moment(n.estimated_start).format(l),f=moment(n.estimated_finish).format(l),p=d+"-"+f,a={name:n.name,taskboardUrl:h,estimatedDateRange:p,closedPoints:n.closed_points||0,totalPoints:n.total_points||0,isVisible:c(),isEditable:u()},g=e.$new(),_.assign(g,a),s=r(o)(g),i.html(s)},e.$watch(s.ngModel,function(t){return p(t)}),e.$on("sprintform:edit:success",function(){return p(a.$modelValue)}),e.$on("$destroy",function(){return i.off()})},{link:i,restrict:"EA",require:"ngModel"}},n.directive("tgBacklogSprintHeader",["$tgNavUrls","$tgTemplate","$compile","$translate",e]),r=function(t,e,r){var n,i;return n=!0,i=function(i,o,s){var a,u;return u=$(""),o.after(u),a=null,o.on("click",function(r){return r.preventDefault(),n=!n,a=e().target(u).start(),n?t.$broadcast("backlog:unload-closed-sprints"):t.$broadcast("backlog:load-closed-sprints")}),i.$on("$destroy",function(){return o.off()}),i.$on("closed-sprints:reloaded",function(t){return function(t,e){var n,i;return a.finish(),n=e.length>0?"BACKLOG.SPRINTS.ACTION_HIDE_CLOSED_SPRINTS":"BACKLOG.SPRINTS.ACTION_SHOW_CLOSED_SPRINTS",i=r.instant(n),o.find(".text").text(i)}}(this))},{link:i}},n.directive("tgBacklogToggleClosedSprintsVisualization",["$rootScope","$tgLoading","$translate",r])}.call(this),function(){var t,e,r,n,i,o,s,a,u;s=this.taiga,n=this.taiga.mixOf,u=this.taiga.toggleText,o=this.taiga.scopeDefer,e=this.taiga.bindOnce,r=this.taiga.groupBy,a=this.taiga.timeout,i=angular.module("taigaTaskboard"),t=function(t){var e,r;return r=function(e,r){var n,i,o,s;return s=e.width(),e.height(240),i=_.map(r,function(t){return moment(t.day)}),n=[],n.unshift({data:_.zip(i,_.map(r,function(t){return t.optimal_points})),lines:{fillColor:"rgba(120,120,120,0.2)"}}),n.unshift({data:_.zip(i,_.map(r,function(t){return t.open_points})),lines:{fillColor:"rgba(102,153,51,0.3)"}}),o={grid:{borderWidth:{top:0,right:1,left:0,bottom:0},borderColor:"#ccc",hoverable:!0},xaxis:{tickSize:[1,"day"],min:i[0],max:_.last(i),mode:"time",daysNames:i,axisLabel:t.instant("TASKBOARD.CHARTS.XAXIS_LABEL"),axisLabelUseCanvas:!0,axisLabelFontSizePixels:12,axisLabelFontFamily:"Verdana, Arial, Helvetica, Tahoma, sans-serif",axisLabelPadding:5},yaxis:{min:0,axisLabel:t.instant("TASKBOARD.CHARTS.YAXIS_LABEL"),axisLabelUseCanvas:!0,axisLabelFontSizePixels:12,axisLabelFontFamily:"Verdana, Arial, Helvetica, Tahoma, sans-serif",axisLabelPadding:5},series:{shadowSize:0,lines:{show:!0,fill:!0},points:{show:!0,fill:!0,radius:4,lineWidth:2}},colors:["rgba(102,153,51,1)","rgba(120,120,120,0.2)"],tooltip:!0,tooltipOpts:{content:function(e,r,n,i){var o,s;return o=moment(r).format(t.instant("TASKBOARD.CHARTS.DATE")),s=Math.round(n),1===i.seriesIndex?t.instant("TASKBOARD.CHARTS.OPTIMAL",{formattedDate:o,roundedValue:s}):t.instant("TASKBOARD.CHARTS.REAL",{formattedDate:o,roundedValue:s})}}},e.empty(),e.plot(n,o).data("plot")},e=function(t,e,n){var i;return i=angular.element(e),t.$on("resize",function(){if(t.stats)return r(i,t.stats.days)}),t.$on("taskboard:graph:toggle-visibility",function(){return e.parent().toggleClass("open"),a(100,function(){if(t.stats)return r(i,t.stats.days)})}),t.$watch("stats",function(e){if(null!=t.stats)return r(i,t.stats.days)}),t.$on("$destroy",function(){return e.off()})},{link:e}},i.directive("tgSprintGraph",["$translate",t])}.call(this),function(){var t,e,r,n,i,o,s,a=[].indexOf||function(t){for(var e=0,r=this.length;e0}),n=_.map(o.assigned_to,function(t){return t.id?t.id=t.id.toString():t.id="null",t.name=t.full_name||"Unassigned",t}),s=_.map(o.owners,function(t){return t.id=t.id.toString(),t.name=t.full_name,t}),e.selectedFilters=[],t.status&&(a=e.formatSelectedFilters("status",u,t.status),e.selectedFilters=e.selectedFilters.concat(a)),t.tags&&(a=e.formatSelectedFilters("tags",c,t.tags),e.selectedFilters=e.selectedFilters.concat(a)),t.assigned_to&&(a=e.formatSelectedFilters("assigned_to",n,t.assigned_to),e.selectedFilters=e.selectedFilters.concat(a)),t.owner&&(a=e.formatSelectedFilters("owner",s,t.owner),e.selectedFilters=e.selectedFilters.concat(a)),e.filterQ=t.q,e.filters=[{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.STATUS"),dataType:"status",content:u},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.TAGS"),dataType:"tags",content:c,hideEmpty:!0,totalTaggedElements:l.length},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.ASSIGNED_TO"),dataType:"assigned_to",content:n},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.CREATED_BY"),dataType:"owner",content:s}],e.customFilters=[],_.forOwn(i,function(t,r){return e.customFilters.push({id:r,name:r,filter:t})})}}(this))},e.prototype._setMeta=function(){var t,e,r;return e=this.translate.instant("BACKLOG.SPRINTS.DATE"),r=this.translate.instant("TASKBOARD.PAGE_TITLE",{projectName:this.scope.project.name,sprintName:this.scope.sprint.name}),t=this.translate.instant("TASKBOARD.PAGE_DESCRIPTION",{projectName:this.scope.project.name,sprintName:this.scope.sprint.name,startDate:moment(this.scope.sprint.estimated_start).format(e),endDate:moment(this.scope.sprint.estimated_finish).format(e),completedPercentage:this.scope.stats.completedPercentage||"0",completedPoints:this.scope.stats.completedPointsSum||"--",totalPoints:this.scope.stats.totalPointsSum||"--",openTasks:this.scope.stats.openTasks||"--",totalTasks:this.scope.stats.total_tasks||"--"}),this.appMetaService.setAll(r,t)},e.prototype.initializeEventHandlers=function(){return this.scope.$on("taskform:bulk:success",function(t){return function(e,r){return t.refreshTagsColors().then(function(){return t.taskboardTasksService.add(r)}),t.analytics.trackEvent("task","create","bulk create task on taskboard",1)}}(this)),this.scope.$on("taskform:new:success",function(t){return function(e,r){return t.refreshTagsColors().then(function(){return t.taskboardTasksService.add(r)}),t.analytics.trackEvent("task","create","create task on taskboard",1)}}(this)),this.scope.$on("taskform:edit:success",function(t){return function(e,r){return t.refreshTagsColors().then(function(){return t.taskboardTasksService.replaceModel(r)})}}(this)),this.scope.$on("taskboard:task:move",this.taskMove),this.scope.$on("assigned-to:added",this.onAssignedToChanged)},e.prototype.onAssignedToChanged=function(t,e,r){var n;return r.assigned_to=e,this.taskboardTasksService.replaceModel(r),n=this.repo.save(r),n.then(null,function(){return console.log("FAIL")})},e.prototype.initializeSubscription=function(){var t,e;return t="changes.project."+this.scope.projectId+".tasks",this.events.subscribe(this.scope,t,function(t){return function(e){return t.loadTaskboard()}}(this)),e="changes.project."+this.scope.projectId+".userstories",this.events.subscribe(this.scope,e,function(t){return function(e){return t.refreshTagsColors(),t.loadSprintStats(),t.loadSprint()}}(this))},e.prototype.loadProject=function(){return this.rs.projects.get(this.scope.projectId).then(function(t){return function(e){return e.is_backlog_activated||t.errorHandlingService.permissionDenied(),t.scope.project=e,t.scope.pointsList=_.sortBy(e.points,"order"),t.scope.pointsById=o(e.points,function(t){return t.id}),t.scope.roleById=o(e.roles,function(t){return t.id}),t.scope.taskStatusList=_.sortBy(e.task_statuses,"order"),t.scope.usStatusList=_.sortBy(e.us_statuses,"order"),t.scope.usStatusById=o(e.us_statuses,function(t){return t.id}),t.scope.$emit("project:loaded",e),t.fillUsersAndRoles(e.members,e.roles),e}}(this))},e.prototype.loadSprintStats=function(){return this.rs.sprints.stats(this.scope.projectId,this.scope.sprintId).then(function(t){return function(e){var r,n,i,o;return o=_.reduce(_.values(e.total_points),function(t,e){return t+e},0),r=_.reduce(_.values(e.completed_points),function(t,e){return t+e},0),n=o-r,i=e.total_tasks-e.completed_tasks,t.scope.stats=e,t.scope.stats.totalPointsSum=o,t.scope.stats.completedPointsSum=r,t.scope.stats.remainingPointsSum=n,t.scope.stats.remainingTasks=i,e.totalPointsSum?t.scope.stats.completedPercentage=Math.round(100*e.completedPointsSum/e.totalPointsSum):t.scope.stats.completedPercentage=0,t.scope.stats.openTasks=e.total_tasks-e.completed_tasks,e}}(this))},e.prototype.refreshTagsColors=function(){return this.rs.projects.tagsColors(this.scope.projectId).then(function(t){return function(e){return t.scope.project.tags_colors=e._attrs}}(this))},e.prototype.loadSprint=function(){return this.rs.sprints.get(this.scope.projectId,this.scope.sprintId).then(function(t){return function(e){return t.scope.sprint=e,t.scope.userstories=_.sortBy(e.user_stories,"sprint_order"),t.taskboardTasksService.setUserstories(t.scope.userstories),e}}(this))},e.prototype.loadTasks=function(){var t;return t={include_attachments:!0},t=_.merge(t,this.location.search()),this.rs.tasks.list(this.scope.projectId,this.scope.sprintId,null,t).then(function(t){return function(e){return t.taskboardTasksService.init(t.scope.project,t.scope.usersById),t.taskboardTasksService.set(e)}}(this))},e.prototype.loadTaskboard=function(){return this.q.all([this.refreshTagsColors(),this.loadSprintStats(),this.loadSprint().then(function(t){return function(){return t.loadTasks()}}(this))])},e.prototype.loadInitialData=function(){var t,e;return t={pslug:this.params.pslug,sslug:this.params.sslug},e=this.repo.resolve(t).then(function(t){return function(e){return t.scope.projectId=e.project,t.scope.sprintId=e.milestone,t.initializeSubscription(),e}}(this)),e.then(function(t){return function(){return t.loadProject()}}(this)).then(function(t){return function(){return t.generateFilters(),t.loadTaskboard().then(function(){return t.setRolePoints()})}}(this))},e.prototype.showPlaceHolder=function(t,e){return!(this.taskboardTasksService.tasksRaw.length||this.scope.taskStatusList[0].id!==t||this.scope.userstories.length&&this.scope.userstories[0].id!==e)},e.prototype.editTask=function(t){var e;return e=this.taskboardTasksService.getTask(t),e=e.set("loading",!0),this.taskboardTasksService.replace(e),this.rs.tasks.getByRef(e.getIn(["model","project"]),e.getIn(["model","ref"])).then(function(t){return function(r){return t.rs2.attachments.list("task",e.get("id"),e.getIn(["model","project"])).then(function(n){return t.rootscope.$broadcast("taskform:edit",r,n.toJS()),e=e.set("loading",!1),t.taskboardTasksService.replace(e)})}}(this))},e.prototype.taskMove=function(t,e,r,n,i,o){var s,a,u,c;return e=this.taskboardTasksService.getTaskModel(e.get("id")),s=this.taskboardTasksService.move(e.id,n,i,o),u={status__is_archived:!1,include_attachments:!0},a={headers:{"set-orders":JSON.stringify(s.set_orders)}},c=this.repo.save(e,!0,u,a,!0).then(function(t){return function(e){var r;return r=e[1],r&&r["taiga-info-order-updated"]&&(o=JSON.parse(r["taiga-info-order-updated"]),t.taskboardTasksService.assignOrders(o)),t.loadSprintStats()}}(this))},e.prototype.addNewTask=function(t,e){switch(t){case"standard":return this.rootscope.$broadcast("taskform:new",this.scope.sprintId,null!=e?e.id:void 0);case"bulk":return this.rootscope.$broadcast("taskform:bulk",this.scope.sprintId,null!=e?e.id:void 0)}},e.prototype.toggleFold=function(t){return this.taskboardTasksService.toggleFold(t)},e.prototype.changeTaskAssignedTo=function(t){var e;return e=this.taskboardTasksService.getTaskModel(t),this.rootscope.$broadcast("assigned-to:add",e)},e.prototype.setRolePoints=function(){var t,e,r,n;return t=_.filter(this.scope.project.roles,"computable"),r=function(e){return function(e){return e=parseInt(e,10),_.find(t,function(t){return t.id===e})}}(this),e=function(t){return function(e){var r;return r=parseInt(e,10),_.find(t.scope.project.points,function(t){return t.id===e})}}(this),n=_.reduce(this.scope.userstories,function(t){return function(t,n,i){
return _.forOwn(n.points,function(n,i){var o,s;return s=r(i),o=e(n),t[s.id]||(t[s.id]=s,t[s.id].points=0),t[s.id].points+=o.value}),t}}(this),{}),this.scope.pointsByRole=Object.keys(n).map(function(t){return n[t]})},e}(s(c.Controller,c.PageMixin,c.FiltersMixin)),a.controller("TaskboardController",t),e=function(t){var e;return e=function(e,r,n){var i,o;return i=r.controller(),r.on("click",".toggle-analytics-visibility",function(e){var r;return e.preventDefault(),r=angular.element(e.currentTarget),r.toggleClass("active"),t.$broadcast("taskboard:graph:toggle-visibility")}),o=r.find(".taskboard-table-body"),o.on("scroll",function(t){var e,n;return n=angular.element(t.currentTarget),e=r.find(".taskboard-table-header .taskboard-table-inner"),e.css("left",-1*n.scrollLeft())}),e.$on("$destroy",function(){return r.off()})},{link:e}},a.directive("tgTaskboard",["$rootScope",e]),r=function(t){var e,r,n;return e=40,n=300,r=function(r,i,o){var s,a,u,c,l;return r.$on("sprint:zoom0",function(t){return function(){return u()}}(this)),r.$on("sprint:task:moved",function(t){return function(){return u()}}(this)),r.$watch("usTasks",function(){if(r.project)return r.statusesFolded=t.tasks.getStatusColumnModes(r.project.id),r.usFolded=t.tasks.getUsRowModes(r.project.id,r.sprintId),u()}),r.foldStatus=function(e){return r.statusesFolded[e.id]=!r.statusesFolded[e.id],t.tasks.storeStatusColumnModes(r.projectId,r.statusesFolded),u()},r.foldUs=function(e){return e?r.usFolded[e.id]=!r.usFolded[e.id]:r.usFolded[null]=!r.usFolded[null],t.tasks.storeUsRowModes(r.projectId,r.sprintId,r.usFolded),u()},s=function(t){return function(t,n){var i,o,s;return i=t?r.usTasks.getIn([t.toString(),n.toString()]).size:r.usTasks.getIn(["null",n.toString()]).size,r.statusesFolded[n]?(i&&r.usFolded[t]?(o=Math.round(Math.sqrt(i)),s=e*o):s=e,s):0}}(this),l=function(t){return function(t,e){var o;return o=i.find(".squish-status-"+t),e?o.css("max-width",e):"0"===r.ctrl.zoomLevel?o.css("max-width",148):o.css("max-width",n)}}(this),c=function(t){return function(){var t,e,r;return t=[],e=i.find(".task-colum-name"),t=_.map(e,function(t){return $(t).outerWidth(!0)}),r=_.reduce(t,function(t,e){return t+e}),i.find(".taskboard-table-inner").css("width",r)}}(this),a=function(t){return function(t){var e;return e=s(null,t),_.forEach(r.userstories,function(r){var n;if(n=s(r.id,t),n>e)return e=n}),l(t,e)}}(this),u=function(t){return function(){_.forEach(r.taskStatusList,function(t){return a(t.id)}),c()}}(this)},{link:r}},a.directive("tgTaskboardSquishColumn",["$tgResources",r])}.call(this),function(){var t,e,r,n,i,o,s,a;s=this.taiga,n=this.taiga.mixOf,a=this.taiga.toggleText,o=this.taiga.scopeDefer,e=this.taiga.bindOnce,r=this.taiga.groupBy,i=angular.module("taigaBacklog"),t=function(t,e,r,n){var i;return i=function(t,e,i){var o;return o=t.$watch("usTasks",function(i){var s,a,u,c,l,p,f,d,h;if(i&&i.size&&(o(),t.project.my_permissions.indexOf("modify_task")>-1))return f=null,p=null,l=null,h=e,c=function(){var t;return t=n.instant("BACKLOG.SORTABLE_FILTER_ERROR"),$tgConfirm.notify("error",t)},a=function(t){return t.scope().$destroy(),t.off(),t.remove()},s=_.map(e.find(".task-column"),function(t){return t}),u=dragula(s,{copySortSource:!1,copy:!1,mirrorContainer:e[0],accepts:function(t,e){return!$(e).hasClass("taskboard-userstory-box")},moves:function(t){return $(t).is("tg-card")}}),u.on("drag",function(t){if(f=$(t).parent().scope(),e.hasClass("active-filters"))return c(),setTimeout(function(){return u.cancel(!0)},0),!1}),u.on("dragend",function(e){var n,i,o,s,u,c,d;return d=$(e).parent(),l=$(e),i=l.scope().task,n=l.index(),p=d.scope(),c=f.us?f.us.id:null,u=f.st.id,s=p.us?p.us.id:null,o=p.st.id,o===u&&s===c||a(l),t.$apply(function(){return r.$broadcast("taskboard:task:move",i,i.getIn(["model","status"]),s,o,n)})}),d=autoScroll([$(".taskboard-table-body")[0]],{margin:100,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&u.dragging}}),t.$on("$destroy",function(){return e.off(),u.destroy()})})},{link:i}},i.directive("tgTaskboardSortable",["$tgRepo","$tgResources","$rootScope","$translate",t])}.call(this),function(){var t,e,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;e=this.taiga.groupBy,t=function(t){function e(){this.reset()}return r(e,t),e.$inject=[],e.prototype.reset=function(){return this.tasksRaw=[],this.foldStatusChanged={},this.usTasks=Immutable.Map()},e.prototype.init=function(t,e){return this.project=t,this.usersById=e},e.prototype.resetFolds=function(){return this.foldStatusChanged={},this.refresh()},e.prototype.toggleFold=function(t){return this.foldStatusChanged[t]=!this.foldStatusChanged[t],this.refresh()},e.prototype.add=function(t){return this.tasksRaw=this.tasksRaw.concat(t),this.refresh()},e.prototype.set=function(t){return this.tasksRaw=t,this.refreshRawOrder(),this.refresh()},e.prototype.setUserstories=function(t){return this.userstories=t},e.prototype.refreshRawOrder=function(){var t,e,r,n,i;for(this.order={},r=this.tasksRaw,n=[],t=0,e=r.length;t1)for(s=0,l=d.length;s1)for(o=0,c=f.length;o
")})}}(this),i&&!i.is_archived&&(t.$on("redraw:wip",n),t.$on("kanban:us:move",n),t.$on("usform:new:success",n),t.$on("usform:bulk:success",n)),t.$on("$destroy",function(){return e.off()})},{link:t}},l.directive("tgKanbanWipLimit",o)}.call(this),function(){var t,e,r,n,i,o,s,a,u;s=this.taiga,n=this.taiga.mixOf,u=this.taiga.toggleText,o=this.taiga.scopeDefer,e=this.taiga.bindOnce,r=this.taiga.groupBy,a=this.taiga.timeout,i=angular.module("taigaKanban"),t=function(t,e,r){var n;return n=function(t,e,n){var i;return i=t.$watch("usByStatus",function(n){var o,s,a,u,c,l,p,f;if(n&&n.size&&(i(),t.project.my_permissions.indexOf("modify_us")>-1))return l=null,c=null,u=null,f=e,s=function(t){return t.scope().$destroy(),t.off(),t.remove()},o=_.map(e.find(".task-column"),function(t){return t}),a=dragula(o,{copySortSource:!1,copy:!1,mirrorContainer:f[0],moves:function(t){return $(t).is("tg-card")}}),a.on("drag",function(t){return l=$(t).parent().scope()}),a.on("dragend",function(e){var n,i,o,a,p;return p=$(e).parent(),u=$(e),i=u.scope().us,n=u.index(),c=p.scope(),o=c.s.id,a=l.s.id,o!==a&&s(u),t.$apply(function(){return r.$broadcast("kanban:us:move",i,i.getIn(["model","status"]),o,n)})}),p=autoScroll(o,{margin:100,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&a.dragging}}),t.$on("$destroy",function(){return e.off(),a.destroy()})})},{link:n}},i.directive("tgKanbanSortable",["$tgRepo","$tgResources","$rootScope",t])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p=function(t,e){function r(){this.constructor=t}for(var n in e)f.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},f={}.hasOwnProperty;c=this.taiga,a=this.taiga.mixOf,l=this.taiga.toString,s=this.taiga.joinStr,o=this.taiga.groupBy,i=this.taiga.bindOnce,n=this.taiga.bindMethods,u=angular.module("taigaEpics"),t=function(t){function e(t,e,r,i,o,s,a,u,c,l,p,f,d,h,g,m){var v;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=i,this.rs=o,this.rs2=s,this.params=a,this.q=u,this.location=c,this.log=l,this.appMetaService=p,this.analytics=f,this.navUrls=d,this.translate=h,this.modelTransform=g,this.errorHandlingService=m,n(this),this.scope.epicRef=this.params.epicref,this.scope.sectionName=this.translate.instant("EPIC.SECTION_NAME"),this.initializeEventHandlers(),v=this.loadInitialData(),v.then(function(t){return function(){return t._setMeta(),t.initializeOnDeleteGoToUrl()}}(this)),v.then(null,this.onInitialDataError.bind(this))}return p(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","tgResources","$routeParams","$q","$tgLocation","$log","tgAppMetaService","$tgAnalytics","$tgNavUrls","$translate","$tgQueueModelTransformation","tgErrorHandlingService"],e.prototype._setMeta=function(){var t,e,r;return r=this.translate.instant("EPIC.PAGE_TITLE",{epicRef:"#"+this.scope.epic.ref,epicSubject:this.scope.epic.subject,projectName:this.scope.project.name}),t=this.translate.instant("EPIC.PAGE_DESCRIPTION",{epicStatus:(null!=(e=this.scope.statusById[this.scope.epic.status])?e.name:void 0)||"--",epicDescription:angular.element(this.scope.epic.description_html||"").text()}),this.appMetaService.setAll(r,t)},e.prototype.initializeEventHandlers=function(){return this.scope.$on("attachment:create",function(t){return function(){return t.analytics.trackEvent("attachment","create","create attachment on epic",1)}}(this)),this.scope.$on("comment:new",function(t){return function(){return t.loadEpic()}}(this)),this.scope.$on("custom-attributes-values:edit",function(t){return function(){return t.rootscope.$broadcast("object:updated")}}(this))},e.prototype.initializeOnDeleteGoToUrl=function(){var t;return t={project:this.scope.project.slug},this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-epics",t)},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return t.scope.projectId=e.id,t.scope.project=e,t.scope.immutableProject=Immutable.fromJS(e._attrs),t.scope.$emit("project:loaded",e),t.scope.statusList=e.epic_statuses,t.scope.statusById=o(e.epic_statuses,function(t){return t.id}),e}}(this))},e.prototype.loadEpic=function(){return this.rs.epics.getByRef(this.scope.projectId,this.params.epicref).then(function(t){return function(e){var r,n,i;if(t.scope.epic=e,t.scope.immutableEpic=Immutable.fromJS(e._attrs),t.scope.epicId=e.id,t.scope.commentModel=e,t.modelTransform.setObject(t.scope,"epic"),null!=(null!=(n=t.scope.epic.neighbors.previous)?n.ref:void 0)&&(r={project:t.scope.project.slug,ref:t.scope.epic.neighbors.previous.ref},t.scope.previousUrl=t.navUrls.resolve("project-epics-detail",r)),null!=(null!=(i=t.scope.epic.neighbors.next)?i.ref:void 0))return r={project:t.scope.project.slug,ref:t.scope.epic.neighbors.next.ref},t.scope.nextUrl=t.navUrls.resolve("project-epics-detail",r)}}(this))},e.prototype.loadUserstories=function(){return this.rs2.userstories.listInEpic(this.scope.epicId).then(function(t){return function(e){return t.scope.userstories=e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(e){return t.fillUsersAndRoles(e.members,e.roles),t.loadEpic().then(function(){return t.loadUserstories()})}}(this))},e.prototype.onUpvote=function(){var t,e;return e=function(t){return function(){return t.loadEpic(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.epics.upvote(this.scope.epicId).then(e,t)},e.prototype.onDownvote=function(){var t,e;return e=function(t){return function(){return t.loadEpic(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.epics.downvote(this.scope.epicId).then(e,t)},e.prototype.onWatch=function(){var t,e;return e=function(t){return function(){return t.loadEpic(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.epics.watch(this.scope.epicId).then(e,t)},e.prototype.onUnwatch=function(){var t,e;return e=function(t){return function(){return t.loadEpic(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.epics.unwatch(this.scope.epicId).then(e,t)},e.prototype.onSelectColor=function(t){var e,r,n;return r=function(t){return function(){return t.rootscope.$broadcast("object:updated"),t.confirm.notify("success")}}(this),e=function(t){return function(){return t.confirm.notify("error")}}(this),n=this.modelTransform.save(function(e){return e.color=t,e}),n.then(r,e)},e}(a(c.Controller,c.PageMixin)),u.controller("EpicDetailController",t),r=function(t,e){var r,n;return n=t.get("common/components/status-display.html",!0),r=function(t,r,i){var o;return o=function(i){var o,s;return s=t.statusById[i.status],o=n({is_closed:s.is_closed,status:s}),o=e(o)(t),r.html(o)},t.$watch(i.ngModel,function(t){if(null!=t)return o(t)}),t.$on("$destroy",function(){return r.off()})},{link:r,restrict:"EA",require:"ngModel"}},u.directive("tgEpicStatusDisplay",["$tgTemplate","$compile",r]),e=function(t,e,r,n,i,o,s,a){var u,c;return c=a.get("common/components/status-button.html",!0),u=function(e,s,a,u){var l,p,f;return l=function(){return e.project.my_permissions.indexOf("modify_epic")!==-1},p=function(t){return function(t){var r,n;return n=e.statusById[t.status],r=o(c({status:n,statuses:e.statusList,editable:l()}))(e),s.html(r)}}(this),f=function(e){var o,a,u,c;return o=n().target(s).start(),c=i.save(function(t){return t.status=e,t}),u=function(){return t.$broadcast("object:updated"),o.finish()},a=function(){return r.notify("error"),o.finish()},c.then(u,a)},s.on("click",".js-edit-status",function(t){if(t.preventDefault(),t.stopPropagation(),l())return s.find(".pop-status").popover().open()}),s.on("click",".status",function(t){var e;if(t.preventDefault(),t.stopPropagation(),l())return e=angular.element(t.currentTarget),$.fn.popover().closeAll(),f(e.data("status-id"))}),e.$watch(function(){var t;return null!=(t=u.$modelValue)?t.status:void 0},function(){var t;if(t=u.$modelValue)return p(t)}),e.$on("$destroy",function(){return s.off()})},{link:u,restrict:"EA",require:"ngModel"}},u.directive("tgEpicStatusButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$compile","$translate","$tgTemplate",e])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p,f,d,h,g=function(t,e){function r(){this.constructor=t}for(var n in e)m.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},m={}.hasOwnProperty;d=this.taiga,p=this.taiga.mixOf,h=this.taiga.toString,l=this.taiga.joinStr,c=this.taiga.groupBy,u=this.taiga.bindOnce,a=this.taiga.bindMethods,f=angular.module("taigaIssues"),t=function(t){function e(t,e,r,n,i,o,s,u,c,l,p,f,d,h,g){var m;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=o,this.q=s,this.location=u,this.log=c,this.appMetaService=l,this.analytics=p,this.navUrls=f,this.translate=d,this.modelTransform=h,this.errorHandlingService=g,a(this),this.scope.issueRef=this.params.issueref,this.scope.sectionName=this.translate.instant("ISSUES.SECTION_NAME"),this.initializeEventHandlers(),m=this.loadInitialData(),m.then(function(t){return function(){return t._setMeta(),t.initializeOnDeleteGoToUrl()}}(this)),m.then(null,this.onInitialDataError.bind(this))}return g(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$log","tgAppMetaService","$tgAnalytics","$tgNavUrls","$translate","$tgQueueModelTransformation","tgErrorHandlingService"],
e.prototype._setMeta=function(){var t,e,r,n,i,o;return o=this.translate.instant("ISSUE.PAGE_TITLE",{issueRef:"#"+this.scope.issue.ref,issueSubject:this.scope.issue.subject,projectName:this.scope.project.name}),t=this.translate.instant("ISSUE.PAGE_DESCRIPTION",{issueStatus:(null!=(e=this.scope.statusById[this.scope.issue.status])?e.name:void 0)||"--",issueType:(null!=(r=this.scope.typeById[this.scope.issue.type])?r.name:void 0)||"--",issueSeverity:(null!=(n=this.scope.severityById[this.scope.issue.severity])?n.name:void 0)||"--",issuePriority:(null!=(i=this.scope.priorityById[this.scope.issue.priority])?i.name:void 0)||"--",issueDescription:angular.element(this.scope.issue.description_html||"").text()}),this.appMetaService.setAll(o,t)},e.prototype.initializeEventHandlers=function(){return this.scope.$on("attachment:create",function(t){return function(){return t.analytics.trackEvent("attachment","create","create attachment on issue",1)}}(this)),this.scope.$on("promote-issue-to-us:success",function(t){return function(){return t.analytics.trackEvent("issue","promoteToUserstory","promote issue to userstory",1),t.rootscope.$broadcast("object:updated"),t.loadIssue()}}(this)),this.scope.$on("comment:new",function(t){return function(){return t.loadIssue()}}(this)),this.scope.$on("custom-attributes-values:edit",function(t){return function(){return t.rootscope.$broadcast("object:updated")}}(this))},e.prototype.initializeOnDeleteGoToUrl=function(){var t;return t={project:this.scope.project.slug},this.scope.project.is_issues_activated?this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-issues",t):this.scope.onDeleteGoToUrl=this.navUrls.resolve("project",t)},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),t.scope.statusList=e.issue_statuses,t.scope.statusById=c(e.issue_statuses,function(t){return t.id}),t.scope.typeById=c(e.issue_types,function(t){return t.id}),t.scope.typeList=_.sortBy(e.issue_types,"order"),t.scope.severityList=e.severities,t.scope.severityById=c(e.severities,function(t){return t.id}),t.scope.priorityList=e.priorities,t.scope.priorityById=c(e.priorities,function(t){return t.id}),e}}(this))},e.prototype.loadIssue=function(){return this.rs.issues.getByRef(this.scope.projectId,this.params.issueref).then(function(t){return function(e){var r,n,i;if(t.scope.issue=e,t.scope.issueId=e.id,t.scope.commentModel=e,t.modelTransform.setObject(t.scope,"issue"),null!=(null!=(n=t.scope.issue.neighbors.previous)?n.ref:void 0)&&(r={project:t.scope.project.slug,ref:t.scope.issue.neighbors.previous.ref},t.scope.previousUrl=t.navUrls.resolve("project-issues-detail",r)),null!=(null!=(i=t.scope.issue.neighbors.next)?i.ref:void 0))return r={project:t.scope.project.slug,ref:t.scope.issue.neighbors.next.ref},t.scope.nextUrl=t.navUrls.resolve("project-issues-detail",r)}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(e){return t.fillUsersAndRoles(e.members,e.roles),t.loadIssue()}}(this))},e.prototype.onUpvote=function(){var t,e;return e=function(t){return function(){return t.loadIssue(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.issues.upvote(this.scope.issueId).then(e,t)},e.prototype.onDownvote=function(){var t,e;return e=function(t){return function(){return t.loadIssue(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.issues.downvote(this.scope.issueId).then(e,t)},e.prototype.onWatch=function(){var t,e;return e=function(t){return function(){return t.loadIssue(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.issues.watch(this.scope.issueId).then(e,t)},e.prototype.onUnwatch=function(){var t,e;return e=function(t){return function(){return t.loadIssue(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.issues.unwatch(this.scope.issueId).then(e,t)},e}(p(d.Controller,d.PageMixin)),f.controller("IssueDetailController",t),i=function(t,e){var r,n;return n=t.get("common/components/status-display.html",!0),r=function(t,r,i){var o;return o=function(i){var o,s;return s=t.statusById[i.status],o=n({is_closed:s.is_closed,status:s}),o=e(o)(t),r.html(o)},t.$watch(i.ngModel,function(t){if(null!=t)return o(t)}),t.$on("$destroy",function(){return r.off()})},{link:r,restrict:"EA",require:"ngModel"}},f.directive("tgIssueStatusDisplay",["$tgTemplate","$compile",i]),n=function(t,e,r,n,i,o,s){var a,u;return u=o.get("common/components/status-button.html",!0),a=function(e,o,a,c){var l,p,f;return l=function(){return e.project.my_permissions.indexOf("modify_issue")!==-1},p=function(t){return function(t){var r,n;return n=e.statusById[t.status],r=u({status:n,statuses:e.statusList,editable:l()}),r=s(r)(e),o.html(r)}}(this),f=function(e){var s,a,u,c;return $.fn.popover().closeAll(),s=n().target(o).start(),c=i.save(function(t){return t.status=e,t}),u=function(){return t.$broadcast("object:updated"),s.finish()},a=function(){return r.notify("error"),s.finish()},c.then(u,a)},o.on("click",".js-edit-status",function(t){if(t.preventDefault(),t.stopPropagation(),l())return o.find(".pop-status").popover().open()}),o.on("click",".status",function(t){var e;if(t.preventDefault(),t.stopPropagation(),l())return e=angular.element(t.currentTarget),f(e.data("status-id"))}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.status:void 0},function(){var t;if(t=c.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},f.directive("tgIssueStatusButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",n]),o=function(t,e,r,n,i,o,s){var a,u;return u=o.get("issue/issue-type-button.html",!0),a=function(e,o,a,c){var l,p,f;return l=function(){return e.project.my_permissions.indexOf("modify_issue")!==-1},p=function(t){return function(t){var r,n;return n=e.typeById[t.type],r=u({type:n,typees:e.typeList,editable:l()}),r=s(r)(e),o.html(r)}}(this),f=function(e){var s,a,u,c;return $.fn.popover().closeAll(),s=n().target(o.find(".level-name")).start(),c=i.save(function(t){return t.type=e,t}),u=function(){return t.$broadcast("object:updated"),s.finish()},a=function(){return r.notify("error"),s.finish()},c.then(u,a)},o.on("click",".type-data",function(t){if(t.preventDefault(),t.stopPropagation(),l())return o.find(".pop-type").popover().open()}),o.on("click",".type",function(t){var e,r;if(t.preventDefault(),t.stopPropagation(),l())return e=angular.element(t.currentTarget),r=e.data("type-id"),f(r)}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.type:void 0},function(){var t;if(t=c.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},f.directive("tgIssueTypeButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",o]),r=function(t,e,r,n,i,o,s){var a,u;return u=o.get("issue/issue-severity-button.html",!0),a=function(e,o,a,c){var l,p,f;return l=function(){return e.project.my_permissions.indexOf("modify_issue")!==-1},p=function(t){return function(t){var r,n;return n=e.severityById[t.severity],r=u({severity:n,severityes:e.severityList,editable:l()}),r=s(r)(e),o.html(r)}}(this),f=function(e){var s,a,u,c;return $.fn.popover().closeAll(),s=n().target(o.find(".level-name")).start(),c=i.save(function(t){return t.severity=e,t}),u=function(){return t.$broadcast("object:updated"),s.finish()},a=function(){return r.notify("error"),s.finish()},c.then(u,a)},o.on("click",".severity-data",function(t){if(t.preventDefault(),t.stopPropagation(),l())return o.find(".pop-severity").popover().open()}),o.on("click",".severity",function(t){var e,r;if(t.preventDefault(),t.stopPropagation(),l())return r=angular.element(t.currentTarget),e=r.data("severity-id"),f(e)}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.severity:void 0},function(){var t;if(t=c.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},f.directive("tgIssueSeverityButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",r]),e=function(t,e,r,n,i,o,s){var a,u;return u=o.get("issue/issue-priority-button.html",!0),a=function(e,o,a,c){var l,p,f;return l=function(){return e.project.my_permissions.indexOf("modify_issue")!==-1},p=function(t){return function(t){var r,n;return n=e.priorityById[t.priority],r=u({priority:n,priorityes:e.priorityList,editable:l()}),r=s(r)(e),o.html(r)}}(this),f=function(e){var s,a,u,c;return $.fn.popover().closeAll(),s=n().target(o.find(".level-name")).start(),c=i.save(function(t){return t.priority=e,t}),u=function(){return t.$broadcast("object:updated"),s.finish()},a=function(){return r.notify("error"),s.finish()},c.then(u,a)},o.on("click",".priority-data",function(t){if(t.preventDefault(),t.stopPropagation(),l())return o.find(".pop-priority").popover().open()}),o.on("click",".priority",function(t){var e,r;if(t.preventDefault(),t.stopPropagation(),l())return r=angular.element(t.currentTarget),e=r.data("priority-id"),f(e)}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.priority:void 0},function(){var t;if(t=c.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},f.directive("tgIssuePriorityButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",e]),s=function(t,e,r,n){var i;return i=function(i,o,s,a){var u;return u=function(n){return function(n,i){var o,s,a;return o={generated_from_issue:n.id,project:n.project,subject:n.subject,description:n.description,tags:n.tags,is_blocked:n.is_blocked,blocked_note:n.blocked_note},a=function(){return i.finish(),r.notify("success"),t.$broadcast("promote-issue-to-us:success")},s=function(){return i.finish(),r.notify("error")},e.create("userstories",o).then(a,s)}}(this),o.on("click","a",function(t){var e,i,o,s;return t.preventDefault(),e=a.$modelValue,s=n.instant("ISSUES.CONFIRM_PROMOTE.TITLE"),i=n.instant("ISSUES.CONFIRM_PROMOTE.MESSAGE"),o=e.subject,r.ask(s,o,i).then(function(t){return function(t){return u(e,t)}}(this))}),i.$on("$destroy",function(){return o.off()})},{restrict:"AE",require:"ngModel",templateUrl:"issue/promote-issue-to-us-button.html",link:i}},f.directive("tgPromoteIssueToUsButton",["$rootScope","$tgRepo","$tgConfirm","$translate",s])}.call(this),function(){var t,e,r,n,i,o,s,a=[].indexOf||function(t){for(var e=0,r=this.length;e0}),n=_.map(o.assigned_to,function(t){return t.id?t.id=t.id.toString():t.id="null",t.name=t.full_name||"Unassigned",t}),s=_.map(o.owners,function(t){return t.id=t.id.toString(),t.name=t.full_name,t}),e.selectedFilters=[],t.status&&(u=e.formatSelectedFilters("status",l,t.status),e.selectedFilters=e.selectedFilters.concat(u)),t.tags&&(u=e.formatSelectedFilters("tags",p,t.tags),e.selectedFilters=e.selectedFilters.concat(u)),t.assigned_to&&(u=e.formatSelectedFilters("assigned_to",n,t.assigned_to),e.selectedFilters=e.selectedFilters.concat(u)),t.owner&&(u=e.formatSelectedFilters("owner",s,t.owner),e.selectedFilters=e.selectedFilters.concat(u)),t.type&&(u=e.formatSelectedFilters("type",d,t.type),e.selectedFilters=e.selectedFilters.concat(u)),t.severity&&(u=e.formatSelectedFilters("severity",c,t.severity),e.selectedFilters=e.selectedFilters.concat(u)),t.priority&&(u=e.formatSelectedFilters("priority",a,t.priority),e.selectedFilters=e.selectedFilters.concat(u)),e.filterQ=t.q,e.filters=[{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.TYPE"),dataType:"type",content:d},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.SEVERITY"),dataType:"severity",content:c},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.PRIORITIES"),dataType:"priority",content:a},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.STATUS"),dataType:"status",content:l},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.TAGS"),dataType:"tags",content:p,hideEmpty:!0,totalTaggedElements:f.length},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.ASSIGNED_TO"),dataType:"assigned_to",content:n},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.CREATED_BY"),dataType:"owner",content:s}],e.customFilters=[],_.forOwn(i,function(t,r){return e.customFilters.push({id:r,name:r,filter:t})})}}(this))},e.prototype.initializeSubscription=function(){var t;return t="changes.project."+this.scope.projectId+".issues",this.events.subscribe(this.scope,t,function(t){return function(e){return t.loadIssues()}}(this))},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.is_issues_activated||t.errorHandlingService.permissionDenied(),t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),t.scope.issueStatusById=a(e.issue_statuses,function(t){return t.id}),t.scope.issueStatusList=_.sortBy(e.issue_statuses,"order"),t.scope.severityById=a(e.severities,function(t){return t.id}),t.scope.severityList=_.sortBy(e.severities,"order"),t.scope.priorityById=a(e.priorities,function(t){return t.id}),t.scope.priorityList=_.sortBy(e.priorities,"order"),t.scope.issueTypes=_.sortBy(e.issue_types,"order"),t.scope.issueTypeById=a(e.issue_types,function(t){return t.id}),e}}(this))},e.prototype.loadIssuesRequests=0,e.prototype.loadIssues=function(){var t,e;return t=this.location.search(),e=this.rs.issues.list(this.scope.projectId,t),this.loadIssuesRequests+=1,e.index=this.loadIssuesRequests,e.then(function(t){return function(r){return e.index===t.loadIssuesRequests&&(t.scope.issues=r.models,t.scope.page=r.current,t.scope.count=r.count,t.scope.paginatedBy=r.paginatedBy),r}}(this)),e},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(e){return t.fillUsersAndRoles(e.members,e.roles),t.initializeSubscription(),t.generateFilters(),t.loadIssues()}}(this))},e.prototype.addNewIssue=function(){return this.rootscope.$broadcast("issueform:new",this.scope.project)},e.prototype.addIssuesInBulk=function(){return this.rootscope.$broadcast("issueform:bulk",this.scope.projectId)},e.prototype.upVoteIssue=function(t){var e,r;return this.voting=t,r=function(t){return function(){return t.loadIssues(),t.voting=null}}(this),e=function(t){return function(){return t.confirm.notify("error"),t.voting=null}}(this),this.rs.issues.upvote(t).then(r,e)},e.prototype.downVoteIssue=function(t){var e,r;return this.voting=t,r=function(t){return function(){return t.loadIssues(),t.voting=null}}(this),e=function(t){return function(){return t.confirm.notify("error"),t.voting=null}}(this),this.rs.issues.downvote(t).then(r,e)},e.prototype.getOrderBy=function(){return _.isString(this.location.search().order_by)?this.location.search().order_by:"created_date"},e}(c(f.Controller,f.PageMixin,f.FiltersMixin)),l.controller("IssuesController",r),n=function(t,e,r,n){var i,o,s,a;return a=r.get("issue/issue-paginator.html",!0),s=function(t,e,r,i){var o,s,u,c,l,p,f;return s=2,l=4,u=2,c=2,o=e.find(".issues-paginator"),p=function(){var e;return e=t.count/t.paginatedBy,e=parseInt(e,10)1,h.showNext=!(t.page===d),e=t.page,i=f=1,m=d;1<=m?f<=m:f>=m;i=1<=m?++f:--f)i===e+s&&d>e+s+c?g.push({classes:"dots",type:"dots"}):i===e-l&&e>u+l?g.push({classes:"dots",type:"dots"}):i>e+s&&i<=d-c||iu||(i===e?g.push({classes:"active",num:i,type:"page-active"}):g.push({classes:"page",num:i,type:"page"}));return r=a(h),r=n(r)(t),o.html(r)},t.$watch("issues",function(t){if(t)return f()}),e.on("click",".issues-paginator a.next",function(e){return e.preventDefault(),t.$apply(function(){return i.selectFilter("page",t.page+1),i.loadIssues()})}),e.on("click",".issues-paginator a.previous",function(e){return e.preventDefault(),t.$apply(function(){return i.selectFilter("page",t.page-1),i.loadIssues()})}),e.on("click",".issues-paginator li.page > a",function(e){var r,n;return e.preventDefault(),n=angular.element(e.currentTarget),r=n.data("pagenum"),t.$apply(function(){return i.selectFilter("page",r),i.loadIssues()})})},o=function(t,r,i,o){var s,a,u,c;return a=o.getOrderBy(),a&&(u=p(a,"-")?"icon-arrow-up":"icon-arrow-down",s=r.find(".row.title > div[data-fieldname='"+h(a,"-")+"']"),c=$("").attr("svg-icon",u),s.append(c),n(s.contents())(t)),r.on("click",".row.title > div",function(i){var s,l,f;return f=angular.element(i.currentTarget),a=o.getOrderBy(),l=f.data("fieldname"),s=a===l?"-"+l:l,t.$apply(function(){return o.replaceFilter("order_by",s),o.storeFilters(o.params.pslug,e.search(),o.filtersHashSuffix),o.loadIssues().then(function(){return r.find(".row.title > div > tg-svg").remove(),u=p(s,"-")?"icon-arrow-up":"icon-arrow-down",c=$("").attr("svg-icon",u),f.append(c),n(f.contents())(t)})})})},i=function(t,e,r){var n;return n=e.controller(),o(t,e,r,n),s(t,e,r,n),t.$on("$destroy",function(){return e.off()})},{link:i}},l.directive("tgIssues",["$log","$tgLocation","$tgTemplate","$compile",n]),e=function(t,e,r){var n,i,o;return i=e.get("issue/issue-status-inline-edition-selection.html",!0),o=function(t,e,r){var n,i,o;if(i=t.find(".issue-status"),n=t.find(".issue-status .issue-status-bind"),o=r[e.status])return n.text(o.name),n.prop("title",o.name),i.css("color",o.color)},n=function(e,r,n){var s,a;return s=r.controller(),a=e.$eval(n.tgIssueStatusInlineEdition),r.on("click",".issue-status",function(t){return t.preventDefault(),t.stopPropagation(),r.find(".pop-status").popover().open()}),r.on("click",".status",function(n){var i;return n.preventDefault(),n.stopPropagation(),i=angular.element(n.currentTarget),a.status=i.data("status-id"),r.find(".pop-status").popover().close(),o(r,a,e.issueStatusById),e.$apply(function(){return t.save(a).then(function(){return s.loadIssues(),s.generateFilters()})})}),f.bindOnce(e,"project",function(t){if(r.append(i({statuses:t.issue_statuses})),o(r,a,e.issueStatusById),t.my_permissions.indexOf("modify_issue")===-1)return r.unbind("click"),r.find("a").addClass("not-clickable")}),e.$watch(n.tgIssueStatusInlineEdition,function(t){return function(t){return o(r,t,e.issueStatusById)}}(this)),e.$on("$destroy",function(){return r.off()})},{link:n}},l.directive("tgIssueStatusInlineEdition",["$tgRepo","$tgTemplate","$rootScope",e]),t=function(t,e,r,n){var i,o;return o=_.template('
\n<%- name %>'),i=function(i,s,a){var u,c,l;return l=function(t){var e,a,u;return a={name:r.instant("COMMON.ASSIGNED_TO.NOT_ASSIGNED"),imgurl:"/"+window._version+"/images/unnamed.png"},u=i.usersById[t.assigned_to],e=n.getAvatar(u),a.imgurl=e.url,a.bg=null,u&&(a.name=u.full_name_display,a.bg=e.bg),s.find(".avatar").html(o(a)),s.find(".issue-assignedto").attr("title",a.name)},u=s.controller(),c=i.$eval(a.tgIssueAssignedToInlineEdition),l(c),s.on("click",".issue-assignedto",function(t){return e.$broadcast("assigned-to:add",c)}),f.bindOnce(i,"project",function(t){if(t.my_permissions.indexOf("modify_issue")===-1)return s.unbind("click"),s.find("a").addClass("not-clickable")}),i.$on("assigned-to:added",function(e){return function(e,r,n){if(n.id===c.id)return n.assigned_to=r,t.save(n),l(n)}}(this)),i.$watch(a.tgIssueAssignedToInlineEdition,function(t){return function(t){return l(t)}}(this)),i.$on("$destroy",function(){return s.off()})},{link:i}},l.directive("tgIssueAssignedToInlineEdition",["$tgRepo","$rootScope","$translate","tgAvatarService",t])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p=function(t,e){function r(){this.constructor=t}for(var n in e)f.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},f={}.hasOwnProperty;l=this.taiga,u=this.taiga.mixOf,a=this.taiga.groupBy,s=this.taiga.bindOnce,o=this.taiga.bindMethods,c=angular.module("taigaUserStories"),i=function(t){function e(t,e,r,n,i,s,a,u,c,l,p,f,d,h,g,m){var v;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=s,this.q=a,this.location=u,this.log=c,this.appMetaService=l,this.navUrls=p,this.analytics=f,this.translate=d,this.modelTransform=h,this.errorHandlingService=g,this.configService=m,o(this),this.scope.usRef=this.params.usref,this.scope.sectionName=this.translate.instant("US.SECTION_NAME"),this.scope.tribeEnabled=this.configService.config.tribeHost,this.initializeEventHandlers(),v=this.loadInitialData(),v.then(function(t){return function(){return t._setMeta(),t.initializeOnDeleteGoToUrl()}}(this)),v.then(null,this.onInitialDataError.bind(this))}return p(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$log","tgAppMetaService","$tgNavUrls","$tgAnalytics","$translate","$tgQueueModelTransformation","tgErrorHandlingService","$tgConfig"],e.prototype._setMeta=function(){var t,e,r,n,i,o;return o=this.scope.tasks.length,t=_.filter(this.scope.tasks,function(t){return function(e){return t.scope.taskStatusById[e.status].is_closed}}(this)).length,r=o>0?Math.round(100*t/o):0,i=this.translate.instant("US.PAGE_TITLE",{userStoryRef:"#"+this.scope.us.ref,userStorySubject:this.scope.us.subject,projectName:this.scope.project.name}),e=this.translate.instant("US.PAGE_DESCRIPTION",{userStoryStatus:(null!=(n=this.scope.statusById[this.scope.us.status])?n.name:void 0)||"--",userStoryPoints:this.scope.us.total_points,userStoryDescription:angular.element(this.scope.us.description_html||"").text(),userStoryClosedTasks:t,userStoryTotalTasks:o,userStoryProgressPercentage:r}),this.appMetaService.setAll(i,e)},e.prototype.initializeEventHandlers=function(){return this.scope.$on("related-tasks:update",function(t){return function(){var e;if(t.scope.tasks=_.clone(t.scope.tasks,!1),e=_.every(t.scope.tasks,function(t){return t.is_closed}),t.scope.us.is_closed!==e)return t.loadUs()}}(this)),this.scope.$on("attachment:create",function(t){return function(){return t.analytics.trackEvent("attachment","create","create attachment on userstory",1)}}(this)),this.scope.$on("comment:new",function(t){return function(){return t.loadUs()}}(this))},e.prototype.initializeOnDeleteGoToUrl=function(){var t;return t={project:this.scope.project.slug},this.scope.onDeleteGoToUrl=this.navUrls.resolve("project",t),this.scope.project.is_backlog_activated?this.scope.us.milestone?(t.sprint=this.scope.sprint.slug,this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-taskboard",t)):this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-backlog",t):this.scope.project.is_kanban_activated?this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-kanban",t):void 0},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),t.scope.statusList=e.us_statuses,t.scope.statusById=a(e.us_statuses,function(t){return t.id}),t.scope.taskStatusById=a(e.task_statuses,function(t){return t.id}),t.scope.pointsList=_.sortBy(e.points,"order"),t.scope.pointsById=a(t.scope.pointsList,function(t){return t.id}),e}}(this))},e.prototype.loadUs=function(){var t,e,r,n;return t=_.pick(this.location.search(),"milestone","no-milestone","kanban-status"),r=t.milestone,r&&this.rs.userstories.storeQueryParams(this.scope.projectId,{milestone:r,order_by:"sprint_order"}),n=t["no-milestone"],n&&this.rs.userstories.storeQueryParams(this.scope.projectId,{milestone:"null",order_by:"backlog_order"}),e=t["kanban-status"],e&&this.rs.userstories.storeQueryParams(this.scope.projectId,{status:e,order_by:"kanban_order"}),this.rs.userstories.getByRef(this.scope.projectId,this.params.usref).then(function(t){return function(e){return t.scope.us=e,t.scope.usId=e.id,t.scope.commentModel=e,t.modelTransform.setObject(t.scope,"us"),e}}(this))},e.prototype.loadSprint=function(){if(this.scope.us.milestone)return this.rs.sprints.get(this.scope.us.project,this.scope.us.milestone).then(function(t){return function(e){return t.scope.sprint=e,e}}(this))},e.prototype.loadTasks=function(){return this.rs.tasks.list(this.scope.projectId,null,this.scope.usId).then(function(t){return function(e){return t.scope.tasks=e,e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(e){return t.fillUsersAndRoles(e.members,e.roles),t.loadUs().then(function(){return t.q.all([t.loadSprint(),t.loadTasks()]);
})}}(this))},e.prototype.onUpvote=function(){var t,e;return e=function(t){return function(){return t.loadUs(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.userstories.upvote(this.scope.usId).then(e,t)},e.prototype.onDownvote=function(){var t,e;return e=function(t){return function(){return t.loadUs(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.userstories.downvote(this.scope.usId).then(e,t)},e.prototype.onWatch=function(){var t,e;return e=function(t){return function(){return t.loadUs(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.userstories.watch(this.scope.usId).then(e,t)},e.prototype.onUnwatch=function(){var t,e;return e=function(t){return function(){return t.loadUs(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.userstories.unwatch(this.scope.usId).then(e,t)},e.prototype.onTribeInfo=function(){var t,e,r,n;return r=this.translate.instant("US.TRIBE.PUBLISH_MORE_INFO_TITLE"),t=$("
").attr({src:"/"+window._version+"/images/monster-fight.png",alt:this.translate.instant("US.TRIBE.PUBLISH_MORE_INFO_TITLE")}),n=this.translate.instant("US.TRIBE.PUBLISH_MORE_INFO_TEXT"),e=$("").append(t).append(n),this.confirm.success(r,e)},e}(u(l.Controller,l.PageMixin)),c.controller("UserStoryDetailController",i),r=function(t,e){var r,n;return n=t.get("common/components/status-display.html",!0),r=function(t,r,i){var o;return o=function(i){var o,s;return s=t.statusById[i.status],o=n({is_closed:i.is_closed,status:s}),o=e(o)(t),r.html(o)},t.$watch(i.ngModel,function(t){if(null!=t)return o(t)}),t.$on("$destroy",function(){return r.off()})},{link:r,restrict:"EA",require:"ngModel"}},c.directive("tgUsStatusDisplay",["$tgTemplate","$compile",r]),e=function(t,e,r,n,i,o,s){var a,u;return u=o.get("common/components/status-button.html",!0),a=function(e,o,a,c){var l,p,f;return l=function(){return e.project.my_permissions.indexOf("modify_us")!==-1},p=function(t){return function(t){var r,n;return n=e.statusById[t.status],r=u({status:n,statuses:e.statusList,editable:l()}),o.html(r),s(o.contents())(e)}}(this),f=function(e){return function(e){var s,a,u,c;return o.find(".pop-status").popover().close(),s=n().target(o.find(".js-edit-status")).start(),c=i.save(function(t){return t.status=e,t}),u=function(){return t.$broadcast("object:updated"),s.finish()},a=function(){return r.notify("error"),s.finish()},c.then(u,a)}}(this),o.on("click",".js-edit-status",function(t){if(t.preventDefault(),t.stopPropagation(),l())return o.find(".pop-status").popover().open()}),o.on("click",".status",function(t){var e,r;if(t.preventDefault(),t.stopPropagation(),l())return r=angular.element(t.currentTarget),e=r.data("status-id"),f(e)}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.status:void 0},function(){var t;if(t=c.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},c.directive("tgUsStatusButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",e]),n=function(t,e,r,n,i,o,s){var a,u;return u=o.get("us/us-team-requirement-button.html",!0),a=function(e,o,a,c){var l,p,f;return l=function(){return e.project.my_permissions.indexOf("modify_us")!==-1},p=function(t){var r,n;return r={canEdit:l(),isRequired:t.team_requirement},n=u(r),n=s(n)(e),o.html(n)},f=function(e){var s,a;return s=n().target(o.find("label")).start(),a=i.save(function(t){return t.team_requirement=e,t}),a.then(function(e){return function(){return s.finish(),t.$broadcast("object:updated")}}(this)),a.then(null,function(){return s.finish(),r.notify("error")})},o.on("click",".team-requirement",function(t){var e;if(l())return e=!c.$modelValue.team_requirement,f(e)}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.team_requirement:void 0},function(){var t;if(t=c.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},c.directive("tgUsTeamRequirementButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",n]),t=function(t,e,r,n,i,o,s){var a,u;return u=o.get("us/us-client-requirement-button.html",!0),a=function(e,o,a,c){var l,p,f;return l=function(){return e.project.my_permissions.indexOf("modify_us")!==-1},p=function(t){var r,n;return r={canEdit:l(),isRequired:t.client_requirement},n=s(u(r))(e),o.html(n)},f=function(e){var s,a;return s=n().target(o.find("label")).start(),a=i.save(function(t){return t.client_requirement=e,t}),a.then(function(e){return function(){return s.finish(),t.$broadcast("object:updated")}}(this)),a.then(null,function(){return r.notify("error")})},o.on("click",".client-requirement",function(t){var e;if(l())return e=!c.$modelValue.client_requirement,f(e)}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.client_requirement:void 0},function(){var t;if(t=c.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},c.directive("tgUsClientRequirementButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",t])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;u=this.taiga,s=this.taiga.mixOf,o=this.taiga.groupBy,i=this.taiga.bindMethods,a=angular.module("taigaTasks"),t=function(t){function e(t,e,r,n,o,s,a,u,c,l,p,f,d,h,g){var m;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=o,this.params=s,this.q=a,this.location=u,this.log=c,this.appMetaService=l,this.navUrls=p,this.analytics=f,this.translate=d,this.modelTransform=h,this.errorHandlingService=g,i(this),this.scope.taskRef=this.params.taskref,this.scope.sectionName=this.translate.instant("TASK.SECTION_NAME"),this.initializeEventHandlers(),m=this.loadInitialData(),m.then(function(t){return function(){return t._setMeta(),t.initializeOnDeleteGoToUrl()}}(this)),m.then(null,this.onInitialDataError.bind(this))}return c(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$log","tgAppMetaService","$tgNavUrls","$tgAnalytics","$translate","$tgQueueModelTransformation","tgErrorHandlingService"],e.prototype._setMeta=function(){var t,e,r;return r=this.translate.instant("TASK.PAGE_TITLE",{taskRef:"#"+this.scope.task.ref,taskSubject:this.scope.task.subject,projectName:this.scope.project.name}),t=this.translate.instant("TASK.PAGE_DESCRIPTION",{taskStatus:(null!=(e=this.scope.statusById[this.scope.task.status])?e.name:void 0)||"--",taskDescription:angular.element(this.scope.task.description_html||"").text()}),this.appMetaService.setAll(r,t)},e.prototype.initializeEventHandlers=function(){return this.scope.$on("attachment:create",function(t){return function(){return t.analytics.trackEvent("attachment","create","create attachment on task",1)}}(this)),this.scope.$on("custom-attributes-values:edit",function(t){return function(){return t.rootscope.$broadcast("object:updated")}}(this)),this.scope.$on("comment:new",function(t){return function(){return t.loadTask()}}(this))},e.prototype.initializeOnDeleteGoToUrl=function(){var t;if(t={project:this.scope.project.slug},this.scope.onDeleteGoToUrl=this.navUrls.resolve("project",t),this.scope.project.is_backlog_activated){if(this.scope.task.milestone)return t.sprint=this.scope.sprint.slug,this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-taskboard",t);if(this.scope.task.us)return t.ref=this.scope.us.ref,this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-userstories-detail",t)}else if(this.scope.project.is_kanban_activated&&this.scope.us)return t.ref=this.scope.us.ref,this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-userstories-detail",t)},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),t.scope.statusList=e.task_statuses,t.scope.statusById=o(e.task_statuses,function(t){return t.id}),e}}(this))},e.prototype.loadTask=function(){return this.rs.tasks.getByRef(this.scope.projectId,this.params.taskref).then(function(t){return function(e){var r,n,i;return t.scope.task=e,t.scope.taskId=e.id,t.scope.commentModel=e,t.modelTransform.setObject(t.scope,"task"),null!=(null!=(n=t.scope.task.neighbors.previous)?n.ref:void 0)&&(r={project:t.scope.project.slug,ref:t.scope.task.neighbors.previous.ref},t.scope.previousUrl=t.navUrls.resolve("project-tasks-detail",r)),null!=(null!=(i=t.scope.task.neighbors.next)?i.ref:void 0)&&(r={project:t.scope.project.slug,ref:t.scope.task.neighbors.next.ref},t.scope.nextUrl=t.navUrls.resolve("project-tasks-detail",r)),e}}(this))},e.prototype.loadSprint=function(){if(this.scope.task.milestone)return this.rs.sprints.get(this.scope.task.project,this.scope.task.milestone).then(function(t){return function(e){return t.scope.sprint=e,e}}(this))},e.prototype.loadUserStory=function(){if(this.scope.task.user_story)return this.rs.userstories.get(this.scope.task.project,this.scope.task.user_story).then(function(t){return function(e){return t.scope.us=e,e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(e){return t.fillUsersAndRoles(e.members,e.roles),t.loadTask().then(function(){return t.q.all([t.loadSprint(),t.loadUserStory()])})}}(this))},e.prototype.onUpvote=function(){var t,e;return e=function(t){return function(){return t.loadTask(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.tasks.upvote(this.scope.taskId).then(e,t)},e.prototype.onDownvote=function(){var t,e;return e=function(t){return function(){return t.loadTask(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.tasks.downvote(this.scope.taskId).then(e,t)},e.prototype.onWatch=function(){var t,e;return e=function(t){return function(){return t.loadTask(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.tasks.watch(this.scope.taskId).then(e,t)},e.prototype.onUnwatch=function(){var t,e;return e=function(t){return function(){return t.loadTask(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.tasks.unwatch(this.scope.taskId).then(e,t)},e}(s(u.Controller,u.PageMixin)),a.controller("TaskDetailController",t),n=function(t,e){var r,n;return n=t.get("common/components/status-display.html",!0),r=function(t,r,i){var o;return o=function(i){var o,s;return s=t.statusById[i.status],o=n({is_closed:s.is_closed,status:s}),o=e(o)(t),r.html(o)},t.$watch(i.ngModel,function(t){if(null!=t)return o(t)}),t.$on("$destroy",function(){return r.off()})},{link:r,restrict:"EA",require:"ngModel"}},a.directive("tgTaskStatusDisplay",["$tgTemplate","$compile",n]),r=function(t,e,r,n,i,o,s,a){var u,c;return c=a.get("common/components/status-button.html",!0),u=function(e,s,a,u){var l,p,f;return l=function(){return e.project.my_permissions.indexOf("modify_task")!==-1},p=function(t){return function(t){var r,n;return n=e.statusById[t.status],r=o(c({status:n,statuses:e.statusList,editable:l()}))(e),s.html(r)}}(this),f=function(e){var o,a,u,c;return o=n().target(s).start(),c=i.save(function(t){return t.status=e,t}),u=function(){return t.$broadcast("object:updated"),o.finish()},a=function(){return r.notify("error"),o.finish()},c.then(u,a)},s.on("click",".js-edit-status",function(t){if(t.preventDefault(),t.stopPropagation(),l())return s.find(".pop-status").popover().open()}),s.on("click",".status",function(t){var e;if(t.preventDefault(),t.stopPropagation(),l())return e=angular.element(t.currentTarget),$.fn.popover().closeAll(),f(e.data("status-id"))}),e.$watch(function(){var t;return null!=(t=u.$modelValue)?t.status:void 0},function(){var t;if(t=u.$modelValue)return p(t)}),e.$on("$destroy",function(){return s.off()})},{link:u,restrict:"EA",require:"ngModel"}},a.directive("tgTaskStatusButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$compile","$translate","$tgTemplate",r]),e=function(t,e,r,n,i,o,s){var a,u;return u=s.get("issue/iocaine-button.html",!0),a=function(e,s,a,c){var l,p,f;return l=function(){return e.project.my_permissions.indexOf("modify_task")!==-1},p=function(t){var r,n;return l()||t.is_iocaine?(r={isIocaine:t.is_iocaine,isEditable:l()},n=o(u(r))(e),s.html(n)):void s.html("")},f=function(e){var o,a;return o=n().target(s.find("label")).start(),a=i.save(function(t){return t.is_iocaine=e,t}),a.then(function(){return t.$broadcast("object:updated")}),a.then(null,function(){return r.notify("error")}),a["finally"](function(){return o.finish()})},s.on("click",".is-iocaine",function(t){var e;if(l())return e=!c.$modelValue.is_iocaine,f(e)}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.is_iocaine:void 0},function(){var t;if(t=c.$modelValue)return p(t)}),e.$on("$destroy",function(){return s.off()})},{link:a,restrict:"EA",require:"ngModel"}},a.directive("tgTaskIsIocaineButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$compile","$tgTemplate",e])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;c=this.taiga,a=this.taiga.mixOf,u=angular.module("taigaTeam"),e=function(t){function e(t,e,r,n,i,o,s,a,u,c,l,p,f){var d;this.scope=t,this.rootscope=e,this.repo=r,this.rs=n,this.params=i,this.q=o,this.location=s,this.navUrls=a,this.appMetaService=u,this.auth=c,this.translate=l,this.projectService=p,this.errorHandlingService=f,this.scope.sectionName="TEAM.SECTION_NAME",d=this.loadInitialData(),d.then(function(t){return function(){var e,r;return r=t.translate.instant("TEAM.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.translate.instant("TEAM.PAGE_DESCRIPTION",{projectName:t.scope.project.name,projectDescription:t.scope.project.description}),t.appMetaService.setAll(r,e)}}(this)),d.then(null,this.onInitialDataError.bind(this))}return l(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgResources","$routeParams","$q","$location","$tgNavUrls","tgAppMetaService","$tgAuth","$translate","tgProjectService","tgErrorHandlingService"],e.prototype.setRole=function(t){return t?this.scope.filtersRole=t:this.scope.filtersRole=null},e.prototype.loadMembers=function(){var t,e,r,n,i;for(i=this.auth.getUser(),this.scope.totals={},n=this.scope.activeUsers,t=0,e=n.length;t=0)})}},u.filter("membersFilter",s)}.call(this),function(){var t,e,r,n,i,o,s,a,u,c=function(t,e){return function(){return t.apply(e,arguments)}},l=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;u=this.taiga,s=this.taiga.mixOf,o=this.taiga.groupBy,n=this.taiga.bindOnce,i=this.taiga.debounce,a=angular.module("taigaWiki"),e=function(t){function e(t,e,r,n,i,o,s,a,u,l,p,f,d,h,g,m){var v;this.scope=t,this.rootscope=e,this.repo=r,this.model=n,this.confirm=i,this.rs=o,this.params=s,this.q=a,this.location=u,this.filter=l,this.log=p,this.appMetaService=f,this.navUrls=d,this.analytics=h,this.translate=g,this.errorHandlingService=m,this.moveLink=c(this.moveLink,this),this.scope.$on("wiki:links:move",this.moveLink),this.scope.projectSlug=this.params.pslug,this.scope.wikiSlug=this.params.slug,this.scope.wikiTitle=this.scope.wikiSlug,this.scope.sectionName="Wiki",this.scope.linksVisible=!1,v=this.loadInitialData(),v.then(function(t){return function(){return t._setMeta()}}(this)),v.then(null,this.onInitialDataError.bind(this))}return l(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgModel","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$filter","$log","tgAppMetaService","$tgNavUrls","$tgAnalytics","$translate","tgErrorHandlingService"],e.prototype._setMeta=function(){var t,e,r,n,i;return i=this.translate.instant("WIKI.PAGE_TITLE",{wikiPageName:this.scope.wikiTitle,projectName:this.scope.project.name}),t=this.translate.instant("WIKI.PAGE_DESCRIPTION",{wikiPageContent:angular.element((null!=(e=this.scope.wiki)?e.html:void 0)||"").text(),totalEditions:(null!=(r=this.scope.wiki)?r.editions:void 0)||0,lastModifiedDate:moment(null!=(n=this.scope.wiki)?n.modified_date:void 0).format(this.translate.instant("WIKI.DATETIME"))}),this.appMetaService.setAll(i,t)},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.is_wiki_activated||t.errorHandlingService.permissionDenied(),t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.loadWiki=function(){var t;return t=this.rs.wiki.getBySlug(this.scope.projectId,this.params.slug),t.then(function(t){return function(e){return t.scope.wiki=e,t.scope.wikiId=e.id,t.scope.wiki}}(this)),t.then(null,function(t){return function(e){var r;return t.scope.wikiId=null,t.scope.project.my_permissions.indexOf("add_wiki_page")===-1?null:(r={project:t.scope.projectId,slug:t.scope.wikiSlug,content:""},t.scope.wiki=t.model.make_model("wiki",r),t.scope.wiki)}}(this))},e.prototype.loadWikiLinks=function(){return this.rs.wiki.listLinks(this.scope.projectId).then(function(t){return function(e){var r,n,i,o,s;for(t.scope.wikiLinks=e,o=t.scope.wikiLinks,r=0,n=o.length;r-1,h=null,g=function(e){var r,l,m,v,y;return d=n.project.my_permissions.indexOf("add_wiki_link")>-1,r=n.project.my_permissions.indexOf("delete_wiki_link")>-1,l=f({wikiLinks:e,projectSlug:n.projectSlug,addWikiLinkPermission:d,deleteWikiLinkPermission:r}),l=u(l)(n),a.off(),d&&h&&h.destroy(),a.html(l),d&&(m=null,y=a.find(".sortable"),h=dragula([y[0]],{direction:"vertical",copySortSource:!1,copy:!1,mirrorContainer:y[0],moves:function(t){return $(t).is("li")}}),h.on("dragend",function(t){var e;return m=$(t),t=m.scope().link,e=m.index(),n.$emit("wiki:links:move",t,e)}),v=autoScroll(window,{margin:20,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&h.dragging}})),a.on("click",".add-button",function(t){return t.preventDefault(),a.find(".new").removeClass("hidden"),a.find(".new input").focus(),a.find(".add-button").hide()}),a.on("click",".js-delete-link",function(e){var r,o,s,a;return e.preventDefault(),e.stopPropagation(),s=angular.element(e.currentTarget),r=s.parents(".wiki-link").data("id"),a=c.instant("WIKI.DELETE_LIGHTBOX_TITLE"),o=n.wikiLinks[r].title,i.askOnDelete(a,o).then(function(e){return function(e){var o;return o=t.remove(n.wikiLinks[r]),o.then(function(){return o=p.loadWikiLinks(),o.then(function(){return e.finish(),g(n.wikiLinks)}),o.then(null,function(){return e.finish()})}),o.then(null,function(){return e.finish(!1),i.notify("error")})}}(this))}),a.on("keyup",".new input",function(e){var r,u,c,l;return e.preventDefault(),13===e.keyCode?(l=angular.element(e.currentTarget),u=l.val(),r=s().target(a.find(".new")).start(),c=t.create("wiki-links",{project:n.projectId,title:u}),c.then(function(){var t;return o.trackEvent("wikilink","create","create wiki link",1),t=p.loadWikiLinks(),t.then(function(){return r.finish(),a.find(".new").addClass("hidden"),a.find(".new input").val(""),a.find(".add-button").show(),g(n.wikiLinks)}),t.then(null,function(){return r.finish(),a.find(".new").addClass("hidden"),a.find(".new input").val(""),a.find(".add-button").show(),i.notify("error","Error loading wiki links")})}),c.then(null,function(t){var e;return r.finish(),a.find(".new input").val(u),a.find(".new input").focus().select(),null!=(null!=t&&null!=(e=t.__all__)?e[0]:void 0)?i.notify("error","The link already exists"):i.notify("error")})):27===e.keyCode?(l=angular.element(e.currentTarget),a.find(".new").addClass("hidden"),a.find(".new input").val(""),a.find(".add-button").show()):void 0})},e(n,l.ngModel,g))},l=function(t,e,r){return p(t,e,r),t.$on("$destroy",function(){return e.off()})},{link:l}},i.directive("tgWikiNav",["$tgRepo","$log","$tgLocation","$tgConfirm","$tgAnalytics","$tgLoading","$tgTemplate","$compile","$translate",t])}.call(this),function(){var t,e,r,n,i=function(t,e){function r(){this.constructor=t}for(var n in e)o.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},o={}.hasOwnProperty;n=this.taiga,e=this.taiga.mixOf,r=angular.module("taigaWiki"),t=function(t){function e(t,e,r,n,i,o,s,a,u,c){var l;this.scope=t,this.rootscope=e,this.repo=r,this.model=n,this.confirm=i,this.rs=o,this.params=s,this.q=a,this.navUrls=u,this.errorHandlingService=c,this.scope.projectSlug=this.params.pslug,this.scope.wikiSlug=this.params.slug,this.scope.wikiTitle=this.scope.wikiSlug,this.scope.sectionName="Wiki",this.scope.linksVisible=!1,l=this.loadInitialData(),l.then(null,this.onInitialDataError.bind(this))}return i(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgModel","$tgConfirm","$tgResources","$routeParams","$q","$tgNavUrls","tgErrorHandlingService"],e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.is_wiki_activated||t.errorHandlingService.permissionDenied(),t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.loadWikiPages=function(){var t;return t=this.rs.wiki.list(this.scope.projectId).then(function(t){return function(e){return t.scope.wikipages=e}}(this))},e.prototype.loadWikiLinks=function(){return this.rs.wiki.listLinks(this.scope.projectId).then(function(t){return function(e){var r,n,i,o,s;for(t.scope.wikiLinks=e,o=t.scope.wikiLinks,r=0,n=o.length;r=this.membersLimit&&(this.canAddUsers=!1),this.showWarningMessage=!this.canAddUsers&&this.project.total_memberships+this.memberInvites.length===this.project.max_memberships},t.prototype.removeSingleMember=function(t){return this.memberInvites.splice(t,1),this.canAddUsers=!0,this.showWarningMessage=1===this.membersLimit},t.prototype.submit=function(){var t;if(this.form.initializeFields(),this.form.reset(),this.form.validate())return this.memberInvites=_.filter(this.memberInvites,function(t){return""!==t.email}),this.submitInvites=!0,t=this.rs.memberships.bulkCreateMemberships(this.project.id,this.memberInvites,this.invitationText),t.then(this._onSuccessInvite.bind(this),this._onErrorInvite.bind(this))},t.prototype._onSuccessInvite=function(){return this.submitInvites=!1,this.rootScope.$broadcast("membersform:new:success"),this.lightboxService.closeAll(),this.confirm.notify("success")},t.prototype._onErrorInvite=function(t){var e;if(this.submitInvites=!1,e={},_.each(t.data.bulk_memberships,function(t){return function(t,r){if(t.email&&(e["email-"+r]=t.email[0]),t.role)return e["role-"+r]=t.role[0]}}(this)),this.form.setErrors(e),t.data._error_message)return this.confirm.notify("error",t.data._error_message)},t}(),u.controller("LbAddMembersController",n),i=function(t){var e;return e=function(e,r,n,i){return t.open(r),i.form=r.find("form").checksley()},{scope:{},bindToController:{project:"="},controller:"LbAddMembersController",controllerAs:"vm",templateUrl:"admin/lightbox-add-members.html",link:e}},u.directive("tgLbAddMembers",["lightboxService",i]),o=function(){return{templateUrl:"admin/memberships-warning-message.html",scope:{project:"="}}},u.directive("tgLightboxAddMembersWarningMessage",[o]),r=function(t,e,r,n){return{link:function(i,o){return t.open(o),i.request=function(){return i.loading=!0,e.projects.transferRequest(i.projectId).then(function(){return i.loading=!1,t.close(o),r.notify("success",n.instant("ADMIN.PROJECT_PROFILE.REQUEST_OWNERSHIP_SUCCESS"))})}},templateUrl:"common/lightbox/lightbox-request-ownership.html"}},u.directive("tgLbRequestOwnership",["lightboxService","tgResources","$tgConfirm","$translate",r]),t=function(){function t(t,e,r,n){this.rs=t,this.lightboxService=e,this.confirm=r,this.translate=n,this.users=[],this.q="",this.commentOpen=!1}return t.prototype.limit=3,t.prototype.normalizeString=function(t){return t=t.replace("Á","A").replace("Ä","A").replace("À","A"),t=t.replace("É","E").replace("Ë","E").replace("È","E"),t=t.replace("Í","I").replace("Ï","I").replace("Ì","I"),t=t.replace("Ó","O").replace("Ö","O").replace("Ò","O"),t=t.replace("Ú","U").replace("Ü","U").replace("Ù","U")},t.prototype.filterUsers=function(t){var e,r;return r=t.full_name_display.toUpperCase(),r=this.normalizeString(r),e=this.q.toUpperCase(),e=this.normalizeString(e),_.includes(r,e)},t.prototype.getUsers=function(){var t;return t=this.users.length||this.q.length?this.users:this.activeUsers,t=t.slice(0,this.limit),t=_.reject(t,{selected:!0}),_.reject(t,{id:this.currentOwnerId})},t.prototype.userSearch=function(){if(this.users=this.activeUsers,this.selected=_.find(this.users,{selected:!0}),this.q)return this.users=_.filter(this.users,this.filterUsers.bind(this))},t.prototype.selectUser=function(t){return this.activeUsers=_.map(this.activeUsers,function(t){return t.selected=!1,t}),t.selected=!0,this.userSearch()},t.prototype.submit=function(){return this.loading=!0,this.rs.projects.transferStart(this.projectId,this.selected.id,this.comment).then(function(t){return function(){var e,r;return t.loading=!1,t.lightboxService.closeAll(),r=t.translate.instant("ADMIN.PROJECT_PROFILE.CHANGE_OWNER_SUCCESS_TITLE"),e=t.translate.instant("ADMIN.PROJECT_PROFILE.CHANGE_OWNER_SUCCESS_DESC"),t.confirm.success(r,e,{type:"svg",name:"icon-speak-up"})}}(this))},t}(),t.$inject=["tgResources","lightboxService","$tgConfirm","$translate"],u.controller("ChangeOwnerLightbox",t),e=function(t,e,r,n){var i;return i=function(e,r){return t.open(r)},{scope:!0,controller:"ChangeOwnerLightbox",controllerAs:"vm",bindToController:{currentOwnerId:"=",projectId:"=",activeUsers:"="},templateUrl:"common/lightbox/lightbox-change-owner.html",link:i}},u.directive("tgLbChangeOwner",["lightboxService","lightboxKeyboardNavigationService","$tgTemplate","$compile",e]),s=function(t){var e;return e=function(e,r){return e.close=function(){return t.close(r)},t.open(r)},{templateUrl:"common/lightbox/lightbox-transfer-project-start-success.html",link:e}},u.directive("tgLbTransferProjectStartSuccess",["lightboxService",s])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p=function(t,e){function r(){this.constructor=t}for(var n in e)f.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},f={}.hasOwnProperty;l=this.taiga,u=this.taiga.mixOf,a=this.taiga.bindMethods,c=angular.module("taigaAdmin"),t=function(t){function e(t,e,r,n,i,o,s,u,c,l,p,f,d,h,g){var m;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=o,this.q=s,this.location=u,this.navUrls=c,this.analytics=l,this.appMetaService=p,this.translate=f,this.auth=d,this.lightboxFactory=h,this.errorHandlingService=g,a(this),this.scope.project={},this.scope.filters={},m=this.loadInitialData(),m.then(function(t){return function(){var e,r;return r=t.translate.instant("ADMIN.MEMBERSHIPS.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(r,e)}}(this)),m.then(null,this.onInitialDataError.bind(this)),this.scope.$on("membersform:new:success",function(t){return function(){return t.loadInitialData(),t.analytics.trackEvent("membership","create","create memberships on admin",1)}}(this))}return p(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$tgAnalytics","tgAppMetaService","$translate","$tgAuth","tgLightboxFactory","tgErrorHandlingService"],e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.i_am_admin||t.errorHandlingService.permissionDenied(),t.scope.projectId=e.id,t.scope.project=e,t.scope.canAddUsers=null===e.max_memberships||e.max_memberships>e.total_memberships,t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.loadMembers=function(){var t;return t=this.getUrlFilters(),this.rs.memberships.list(this.scope.projectId,t).then(function(t){return function(e){return t.scope.memberships=_.filter(e.models,function(t){return null===t.user||t.is_user_active}),t.scope.page=e.current,t.scope.count=e.count,t.scope.paginatedBy=e.paginatedBy,e}}(this))},e.prototype.loadInitialData=function(){return this.loadProject().then(function(t){return function(){return t.q.all([t.loadMembers(),t.auth.refresh()])}}(this))},e.prototype.getUrlFilters=function(){var t;return t=_.pick(this.location.search(),"page"),t.page||(t.page=1),t},e.prototype.addNewMembers=function(){return this.lightboxFactory.create("tg-lb-add-members",{"class":"lightbox lightbox-add-member",project:"project"},{project:this.scope.project})},e.prototype.showLimitUsersWarningMessage=function(){var t,e,r;return r=this.translate.instant("ADMIN.MEMBERSHIPS.LIMIT_USERS_WARNING"),e=this.translate.instant("ADMIN.MEMBERSHIPS.LIMIT_USERS_WARNING_MESSAGE",{members:this.scope.project.max_memberships}),t="/"+window._version+"/svg/icons/team-question.svg",this.confirm.success(r,e,{name:t,type:"img"})},e}(u(l.Controller,l.PageMixin,l.FiltersMixin)),c.controller("MembershipsController",t),e=function(t,e){var r,n,i;return i=t.get("admin/admin-membership-paginator.html",!0),n=function(t,r,n,o){var s,a,u,c,l,p,f;return a=2,l=4,u=2,c=2,s=r.find(".memberships-paginator"),p=function(){var e;return e=t.count/t.paginatedBy,e=parseInt(e,10)1,h.showNext=!(t.page===d),r=t.page,o=f=1,m=d;1<=m?f<=m:f>=m;o=1<=m?++f:--f)o===r+a&&d>r+a+c?g.push({classes:"dots",type:"dots"}):o===r-l&&r>u+l?g.push({classes:"dots",type:"dots"}):o>r+a&&o<=d-c||ou||(o===r?g.push({classes:"active",num:o,type:"page-active"}):g.push({classes:"page",num:o,type:"page"}));return n=i(h),n=e(n)(t),s.html(n),s.show()},t.$watch("memberships",function(t){if(t)return f()}),r.on("click",".memberships-paginator a.next",function(e){return e.preventDefault(),t.$apply(function(){return o.selectFilter("page",t.page+1),o.loadMembers()})}),r.on("click",".memberships-paginator a.previous",function(e){return e.preventDefault(),t.$apply(function(){return o.selectFilter("page",t.page-1),o.loadMembers()})}),r.on("click",".memberships-paginator li.page > a",function(e){var r,n;return e.preventDefault(),n=angular.element(e.currentTarget),r=n.data("pagenum"),t.$apply(function(){return o.selectFilter("page",r),o.loadMembers()})})},r=function(t,e,r){var i;return i=e.controller(),n(t,e,r,i),t.$on("$destroy",function(){return e.off()})},{link:r}},c.directive("tgMemberships",["$tgTemplate","$compile",e]),i=function(t,e,r,n,i){var o,s;return s=e.get("admin/memberships-row-avatar.html",!0),o=function(e,o,a){var u,c,l;return c=r.instant("ADMIN.MEMBERSHIP.STATUS_PENDING"),l=function(t){var r,a,u;return r=i.getAvatar(t),a={full_name:t.full_name?t.full_name:"",email:t.user_email?t.user_email:t.email,imgurl:r.url,bg:r.bg,pending:t.is_user_active?"":c,isOwner:t.is_owner},u=s(a),u=n(u)(e),o.html(u)},null==a.tgMembershipsRowAvatar?t.error("MembershipsRowAvatarDirective: the directive need a member"):(u=e.$eval(a.tgMembershipsRowAvatar),l(u),e.$on("$destroy",function(){return o.off()}))},{link:o}},c.directive("tgMembershipsRowAvatar",["$log","$tgTemplate","$translate","$compile","tgAvatarService",i]),n=function(t,e,r,n,i){var o,s;return s=n.get("admin/admin-memberships-row-checkbox.html",!0),o=function(n,o,a){var u,c,l;return n.$on("$destroy",function(){return o.off()}),null==a.tgMembershipsRowAdminCheckbox?t.error("MembershipsRowAdminCheckboxDirective: the directive need a member"):(c=n.$eval(a.tgMembershipsRowAdminCheckbox),c.is_owner?void o.find(".js-check").remove():(l=function(t){var e,r;return e={inputId:"is-admin-"+t.id},r=s(e),r=i(r)(n),o.html(r)},o.on("click",":checkbox",function(t){return function(t){var n,i,s;return i=function(){return r.notify("success")},n=function(t){return c.revert(),o.find(":checkbox").prop("checked",c.is_admin),r.notify("error",t.is_admin[0])},s=angular.element(t.currentTarget),c.is_admin=s.prop("checked"),e.save(c).then(i,n)}}(this)),u=l(c),c.is_admin?o.find(":checkbox").prop("checked",!0):void 0))},{link:o}},c.directive("tgMembershipsRowAdminCheckbox",["$log","$tgRepo","$tgConfirm","$tgTemplate","$compile",n]),o=function(t,e,r){var n,i;return i=_.template(''),n=function(n,o,s){var a,u,c,l;return l=function(t){var e,r;return e={roleList:n.project.roles,selectedRole:t.role},r=i(e),o.html(r)},null==s.tgMembershipsRowRoleSelector?t.error("MembershipsRowRoleSelectorDirective: the directive need a member"):(a=o.controller(),c=n.$eval(s.tgMembershipsRowRoleSelector),u=l(c),o.on("change","select",function(t){return function(t){var n,i,o,s;if(o=function(){return r.notify("success")},i=function(){return r.notify("error")},s=angular.element(t.currentTarget),n=parseInt(s.val(),10),c.role!==n)return c.role=n,e.save(c).then(o,i)}}(this)),n.$on("$destroy",function(){return o.off()}))},{link:n}},c.directive("tgMembershipsRowRoleSelector",["$log","$tgRepo","$tgConfirm",o]),r=function(t,e,r,n,i,o,s,a,u){var c,l,p;return c='\n
\n\n \n',p='\n\n\n \n',l=function(l,f,d){var h,g,m,v;return v=function(t){var e;return e=t.user?i(c)(l):i(p)(l),f.html(e)},null==d.tgMembershipsRowActions?t.error("MembershipsRowActionsDirective: the directive need a member"):(h=f.controller(),m=l.$eval(d.tgMembershipsRowActions),v(m),f.on("click",".js-resend",function(t){var e,i;return t.preventDefault(),i=function(){var t;return t=o.instant("ADMIN.MEMBERSHIP.SUCCESS_SEND_INVITATION",{email:l.member.email}),n.notify("success",t)},e=function(){var t;return t=o.instant("ADMIM.MEMBERSHIP.ERROR_SEND_INVITATION"),n.notify("error",t)},r.memberships.resendInvitation(l.member.id).then(i,e)}),g=function(){var t,r,i;return i=o.instant("ADMIN.MEMBERSHIP.DELETE_MEMBER"),t=o.instant("ADMIN.MEMBERSHIP.DEFAULT_DELETE_MESSAGE",{email:m.email}),r=m.user?m.full_name:t,n.askOnDelete(i,r).then(function(t){var i,u;return u=function(e){return function(){var e;return t.finish(),m.user!==l.user.id?(l.page>1&&l.count-1<=l.paginatedBy&&h.selectFilter("page",l.page-1),h.loadInitialData()):s.path(a.resolve("home")),e=o.instant("ADMIN.MEMBERSHIP.SUCCESS_DELETE",{message:r}),n.notify("success",e,null,5e3)}}(this),i=function(e){return function(){var e;return t.finish(!1),e=o.instant("ADMIN.MEMBERSHIP.ERROR_DELETE",{message:r}),n.notify("error",e)}}(this),e.remove(m).then(u,i)})},f.on("click",".delete",function(t){var e;return t.preventDefault(),l.project.owner.id===m.user?(e=l.user.id===m.user,u.create("tg-lightbox-leave-project-warning",{"class":"lightbox lightbox-leave-project-warning"},{isCurrentUser:e,project:l.project})):g()}),l.$on("$destroy",function(){return f.off()}))},{link:l}},c.directive("tgMembershipsRowActions",["$log","$tgRepo","$tgResources","$tgConfirm","$compile","$translate","$tgLocation","$tgNavUrls","tgLightboxFactory",r]),s=function(){return{templateUrl:"admin/no-more-memberships-explanation.html",scope:{project:"="}}},c.directive("tgNoMoreMembershipsExplanation",[s])}.call(this),function(){var t,e;t=function(){var t;return t=function(t,e,r){var n;return n=r.tgAdminNavigation,e.find(".active").removeClass("active"),e.find("#adminmenu-"+n+" a").addClass("active"),t.$on("$destroy",function(){return e.off()})},{link:t}},e=angular.module("taigaAdmin"),e.directive("tgAdminNavigation",t)}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p,f,d,h,g,m,v,y,b,S,k,$,j,I,E,T,C,w=function(t,e){function r(){this.constructor=t}for(var n in e)O.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},O={}.hasOwnProperty,A=function(t,e){return function(){return t.apply(e,arguments)}};E=this.taiga,j=this.taiga.mixOf,C=this.taiga.trim,T=this.taiga.toString,$=this.taiga.joinStr,k=this.taiga.groupBy,b=this.taiga.bindOnce,S=this.taiga.debounce,I=angular.module("taigaAdmin"),v=function(t){function e(t,e,r,n,i,o,s,a,u,c,l,p,f,d){var h;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=o,this.q=s,this.location=a,this.navUrls=u,this.appMetaService=c,this.translate=l,this.tgAuth=p,this.currentUserService=f,this.errorHandlingService=d,this.scope.project={},h=this.loadInitialData(),this.scope.projectTags=[],h.then(function(t){return function(){var e,r,n;return r=t.translate.instant(t.scope.sectionName),n=t.translate.instant("ADMIN.PROJECT_PROFILE.PAGE_TITLE",{sectionName:r,projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(n,e),t.fillUsersAndRoles(t.scope.project.members,t.scope.project.roles)}}(this)),h.then(null,this.onInitialDataError.bind(this)),this.scope.$on("project:loaded",function(t){return function(){var e,r,n;return r=t.translate.instant(t.scope.sectionName),n=t.translate.instant("ADMIN.PROJECT_PROFILE.PAGE_TITLE",{sectionName:r,projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(n,e)}}(this))}return w(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","tgAppMetaService","$translate","$tgAuth","tgCurrentUserService","tgErrorHandlingService"],e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.i_am_admin||t.errorHandlingService.permissionDenied(),t.scope.projectId=e.id,t.scope.project=e,t.scope.epicStatusList=_.sortBy(e.epic_statuses,"order"),t.scope.usStatusList=_.sortBy(e.us_statuses,"order"),t.scope.pointsList=_.sortBy(e.points,"order"),t.scope.taskStatusList=_.sortBy(e.task_statuses,"order"),t.scope.issueTypesList=_.sortBy(e.issue_types,"order"),t.scope.issueStatusList=_.sortBy(e.issue_statuses,"order"),t.scope.prioritiesList=_.sortBy(e.priorities,"order"),t.scope.severitiesList=_.sortBy(e.severities,"order"),t.scope.$emit("project:loaded",e),t.scope.projectTags=_.map(t.scope.project.tags,function(e){return[e,t.scope.project.tags_colors[e]]}),e}}(this))},e.prototype.loadInitialData=function(){return this.q.all([this.loadProject(),this.tgAuth.refresh()])},e.prototype.openDeleteLightbox=function(){return this.rootscope.$broadcast("deletelightbox:new",this.scope.project)},e.prototype.addTag=function(t,e){var r;return r=_.clone(this.scope.project.tags),r.push(t),this.scope.projectTags.push([t,null]),this.scope.project.tags=r},e.prototype.deleteTag=function(t){var e;return e=_.clone(this.scope.project.tags),_.pull(e,t[0]),_.remove(this.scope.projectTags,function(e){return function(e){return e[0]===t[0]}}(this)),this.scope.project.tags=e},e}(j(E.Controller,E.PageMixin)),I.controller("ProjectProfileController",v),y=function(t,e,r,n,i,o,s){var a;return a=function(a,u,c){var l,p,f,d;return l=u.controller(),p=u.find("form").checksley({onlyOneErrorElement:!0}),f=S(2e3,function(u){return function(u){var c,f;if(u.preventDefault(),p.validate())return c=r().target(d).start(),f=t.save(a.project),f.then(function(){var t;return c.finish(),e.notify("success"),t=n.resolve("project-admin-project-profile-details",{project:a.project.slug}),i.path(t),l.loadInitialData(),o.fetchProject(),s.loadProjects()}),f.then(null,function(t){if(c.finish(),p.setErrors(t),t._error_message)return e.notify("error",t._error_message)})}}(this)),d=u.find(".submit-button"),u.on("submit","form",f)},{link:a}},I.directive("tgProjectProfile",["$tgRepo","$tgConfirm","$tgLoading","$tgNavUrls","$tgLocation","tgProjectService","tgCurrentUserService",y]),f=function(t,e,r){var n;return n=function(n,i,o){var s,a,u;return s=i.find("form").checksley({onlyOneErrorElement:!0}),a=S(2e3,function(i){return function(i){var o,a;if(i.preventDefault(),s.validate())return o=r().target(u).start(),a=t.save(n.project),a.then(function(){return o.finish(),e.notify("success")}),a.then(null,function(t){if(o.finish(),s.setErrors(t),t._error_message)return e.notify("error",t._error_message)})}}(this)),u=i.find(".submit-button"),i.on("submit","form",a),n.$on("$destroy",function(){return i.off()})},{link:n}},I.directive("tgProjectDefaultValues",["$tgRepo","$tgConfirm","$tgLoading",f]),m=function(t,e,r,n){var i;return i=function(r,i,o){var s;return s=function(o){return function(){var o,s;if(o=i.find("form").checksley(),o.initializeFields(),o.reset(),o.validate())return s=t.save(r.project),s.then(function(){return r.$emit("project:loaded",r.project),e.notify("success"),n.fetchProject()}),s.then(null,function(t){if(o.setErrors(t),t._error_message)return e.notify("error",t._error_message)})}}(this),i.on("change",".module-activation.module-direct-active input",function(t){return t.preventDefault(),r.$applyAsync(s)}),i.on("submit","form",function(t){return t.preventDefault(),s()}),i.on("click",".save",function(t){return t.preventDefault(),s()}),i.on("keydown",".videoconference-attributes input",function(t){return 32!==t.which}),r.$watch("project.videoconferences",function(t,e){if(null!=t&&null!=e&&t!==e)return r.project.videoconferences_extra_data=""}),r.$watch("isVideoconferenceActivated",function(t,e){if(t===!1&&(r.project.videoconferences=null,r.project.videoconferences_extra_data="",e===!0))return s()}),r.$watch("project",function(t){return null!=t.videoconferences?r.isVideoconferenceActivated=!0:r.isVideoconferenceActivated=!1})},{link:i}},I.directive("tgProjectModules",["$tgRepo","$tgConfirm","$tgLoading","tgProjectService",m]),d=function(t,e,r,n){var i;return i=function(i,o,s){var a,u,c,l,p,f,d,h,g,m,v,y,_,b,k,$,j,I,E,T,C,w,O,A,R,P;return u=o.find(".admin-project-export-buttons"),I=function(){return u.removeClass("hidden")},l=function(){return u.addClass("hidden")},g=o.find(".admin-project-export-result"),O=function(){return g.removeClass("hidden")},p=function(){return g.addClass("hidden")},R=o.find(".spin"),A=function(){return R.removeClass("hidden")},f=function(){return R.addClass("hidden")},v=o.find(".result-title"),h=n.instant("ADMIN.PROJECT_EXPORT.LOADING_TITLE"),d=n.instant("ADMIN.PROJECT_EXPORT.LOADING_MESSAGE"),c=function(){return v.html(n.instant("ADMIN.PROJECT_EXPORT.DUMP_READY"))},a=function(){return v.html(n.instant("ADMIN.PROJECT_EXPORT.ASYNC_MESSAGE"))},P=function(t){return v.html(n.instant("ADMIN.PROJECT_EXPORT.SYNC_MESSAGE",{url:t}))},k=function(){return v.html(h)},_=function(){return v.html(d)},j=function(){return v.html(c)},m=o.find(".result-message "),b=function(){return m.html(d)},y=function(){return m.html(a)},$=function(t){return m.html(P(t))},w=function(){return A(),k(),b(),l(),O()},T=function(){return f(),_(),y()},C=function(t){return f(),j(),$(t)},E=function(){return f(),p(),I()},o.on("click","a.button-export",S(2e3,function(o){return function(o){var s,a;return o.preventDefault(),a=function(e){var r;return 202===e.status?T():(r=e.data.url,C(r),t.open(r,"_blank"))},s=function(t){var e,i;return E(),e=n.instant("ADMIN.PROJECT_EXPORT.ERROR"),429===t.status?e=n.instant("ADMIN.PROJECT_EXPORT.ERROR_BUSY"):(null!=(i=t.data)?i._error_message:void 0)&&(e=n.instant("ADMIN.PROJECT_EXPORT.ERROR_BUSY",{message:t.data._error_message})),r.notify("error",e)},w(),e.projects["export"](i.projectId).then(a,s)}}(this)))},{link:i}},I.directive("tgProjectExport",["$window","$tgResources","$tgConfirm","$translate",d]),i=function(t){function e(t,e,r,n,i,o){this.scope=t,this.rootscope=e,this.urls=r,this.confirm=n,this.rs=i,this.translate=o,this._generateUuid=A(this._generateUuid,this),this.setCsvUuid=A(this.setCsvUuid,this),this.rootscope.$on("project:loaded",this.setCsvUuid),this.scope.$watch("csvUuid",function(t){return function(e){return e?t.scope.csvUrl=t.urls.resolveAbsolute(t.type+"-csv",e):t.scope.csvUrl=""}}(this))}return w(e,t),e.$inject=["$scope","$rootScope","$tgUrls","$tgConfirm","$tgResources","$translate"],e.prototype.setCsvUuid=function(){return this.scope.csvUuid=this.scope.project[this.type+"_csv_uuid"]},e.prototype._generateUuid=function(t){var e;return null==t&&(t=null),e=this.rs.projects["regenerate_"+this.type+"_csv_uuid"](this.scope.projectId),e.then(function(t){return function(e){var r;return t.scope.csvUuid=null!=(r=e.data)?r.uuid:void 0}}(this)),e.then(null,function(t){return function(){return t.confirm.notify("error")}}(this)),e["finally"](function(){if(t)return t.finish()}),e},e.prototype.regenerateUuid=function(){var t,e;return this.scope.csvUuid?(e=this.translate.instant("ADMIN.REPORTS.REGENERATE_TITLE"),t=this.translate.instant("ADMIN.REPORTS.REGENERATE_SUBTITLE"),this.confirm.ask(e,t).then(this._generateUuid)):this._generateUuid()},e}(E.Controller),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return w(e,t),e.prototype.type="epics",e}(i),u=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return w(e,t),e.prototype.type="userstories",e}(i),a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return w(e,t),e.prototype.type="tasks",e}(i),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return w(e,t),e.prototype.type="issues",e}(i),I.controller("CsvExporterEpicsController",o),I.controller("CsvExporterUserstoriesController",u),I.controller("CsvExporterTasksController",a),I.controller("CsvExporterIssuesController",s),n=function(t){var e;return e=function(t){return t.sectionTitle="ADMIN.CSV.SECTION_TITLE_EPIC"},{controller:"CsvExporterEpicsController",controllerAs:"ctrl",templateUrl:"admin/project-csv.html",link:e,scope:!0}},I.directive("tgCsvEpic",["$translate",n]),p=function(t){var e;return e=function(t){return t.sectionTitle="ADMIN.CSV.SECTION_TITLE_US"},{controller:"CsvExporterUserstoriesController",controllerAs:"ctrl",templateUrl:"admin/project-csv.html",link:e,scope:!0}},I.directive("tgCsvUs",["$translate",p]),l=function(t){var e;return e=function(t){return t.sectionTitle="ADMIN.CSV.SECTION_TITLE_TASK"},{controller:"CsvExporterTasksController",controllerAs:"ctrl",templateUrl:"admin/project-csv.html",link:e,scope:!0}},I.directive("tgCsvTask",["$translate",l]),c=function(t){var e;return e=function(t){return t.sectionTitle="ADMIN.CSV.SECTION_TITLE_ISSUE"},{controller:"CsvExporterIssuesController",controllerAs:"ctrl",templateUrl:"admin/project-csv.html",link:e,scope:!0}},I.directive("tgCsvIssue",["$translate",c]),h=function(t,e,r,n){var i;return i=function(t,i,o){var s,a,u;return u=function(){return i.find(".size-info").addClass("active")},a=function(r){var o;return o=e.make_model("projects",r.data),t.project=o,i.find(".loading-overlay").removeClass("active"),n.notify("success")},s=function(t){return 413===t.status&&u(),i.find(".loading-overlay").removeClass("active"),n.notify("error",t.data._error_message)},i.on("click",".js-change-logo",function(){return i.find("#logo-field").click()}),i.on("change","#logo-field",function(e){if(t.logoAttachment)return i.find(".loading-overlay").addClass("active"),r.projects.changeLogo(t.project.id,t.logoAttachment).then(a,s)}),i.on("click","a.js-use-default-logo",function(e){return i.find(".loading-overlay").addClass("active"),r.projects.removeLogo(t.project.id).then(a,s)}),t.$on("$destroy",function(){return i.off()})},{link:i}},I.directive("tgProjectLogo",["$tgAuth","$tgModel","$tgResources","$tgConfirm",h]),g=function(t){var e;return e=function(e,r,n){var i,o;return i=t(n.tgProjectLogoModel),o=i.assign,r.bind("change",function(){return e.$apply(function(){return o(e,r[0].files[0])})})},{link:e}},I.directive("tgProjectLogoModel",["$parse",g]),r=function(){return{scope:{project:"="},templateUrl:"admin/admin-project-restrictions.html"}},I.directive("tgAdminProjectRestrictions",[r]),e=function(t){return{link:function(e){return e.requestOwnership=function(){return t.create("tg-lb-request-ownership",{"class":"lightbox lightbox-request-ownership"},{projectId:e.projectId})}},scope:{projectId:"=",owner:"="},templateUrl:"admin/admin-project-request-ownership.html"}},I.directive("tgAdminProjectRequestOwnership",["tgLightboxFactory",e]),t=function(t){return{link:function(e){return e.changeOwner=function(){return t.create("tg-lb-change-owner",{"class":"lightbox lightbox-select-user","project-id":"projectId","active-users":"activeUsers","current-owner-id":"currentOwnerId"},{projectId:e.projectId,activeUsers:e.activeUsers,currentOwnerId:e.owner.id,members:e.members})}},scope:{activeUsers:"=",projectId:"=",owner:"=",members:"="},templateUrl:"admin/admin-project-change-owner.html"}},I.directive("tgAdminProjectChangeOwner",["tgLightboxFactory",t])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p,f,d,h,g,m,v,y,b,S,k,j,I=function(t,e){function r(){this.constructor=t}for(var n in e)E.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},E={}.hasOwnProperty,T=function(t,e){return function(){return t.apply(e,arguments)}};S=this.taiga,y=this.taiga.mixOf,j=this.taiga.trim,k=this.taiga.toString,v=this.taiga.joinStr,m=this.taiga.groupBy,d=this.taiga.bindOnce,h=this.taiga.debounce,g=this.taiga.getDefaulColorList,b=angular.module("taigaAdmin"),c=function(t){function e(t,e,r,n,i,o,s,a,u,c,l,p){var f;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=o,this.q=s,this.location=a,this.navUrls=u,this.appMetaService=c,this.translate=l,this.errorHandlingService=p,this.scope.project={},f=this.loadInitialData(),f.then(function(t){return function(){var e,r,n;return r=t.translate.instant(t.scope.sectionName),n=t.translate.instant("ADMIN.PROJECT_VALUES.PAGE_TITLE",{sectionName:r,projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(n,e)}}(this)),f.then(null,this.onInitialDataError.bind(this))}return I(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","tgAppMetaService","$translate","tgErrorHandlingService"],e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.i_am_admin||t.errorHandlingService.permissionDenied(),t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject()},e}(y(S.Controller,S.PageMixin)),b.controller("ProjectValuesSectionController",c),a=function(t){function e(t,e,r,n,i){this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.moveValue=T(this.moveValue,this),this.loadValues=T(this.loadValues,this),this.scope.$on("admin:project-values:move",this.moveValue),this.rootscope.$on("project:loaded",this.loadValues)}return I(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources"],e.prototype.loadValues=function(){return this.rs[this.scope.resource].listValues(this.scope.projectId,this.scope.type).then(function(t){return function(e){return t.scope.values=e,t.scope.maxValueOrder=_.maxBy(e,"order").order,e}}(this))},e.prototype.moveValue=function(t,e,r){var n,i;return i=this.scope.values,n=i.indexOf(e),i.splice(n,1),i.splice(r,0,e),_.each(i,function(t,e){return t.order=e}),this.repo.saveAll(i)},e}(S.Controller),b.controller("ProjectValuesController",a),u=function(t,e,r,n,i,o,s){var a,u,c;return u=function(t,e,r){var n,i,o,s,a,u;return s=null,o=null,i=null,u=e.find(".sortable"),n=dragula([u[0]],{direction:"vertical",copySortSource:!1,copy:!1,mirrorContainer:u[0],moves:function(t){return $(t).is("div[tg-bind-scope]")}}),n.on("dragend",function(e){var r,n;return i=$(e),n=i.scope().value,r=i.index(),t.$broadcast("admin:project-values:move",n,r)}),a=autoScroll(window,{margin:20,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&n.dragging}}),t.$on("$destroy",function(){return e.off(),n.destroy()})},c=function(t,n,i){var a,u,c,l,p,f,d,g,m;return a=n.controller(),m=i.type,f=i.objname,l=function(){return t.newValue={name:"",is_closed:!1,is_archived:!1}},p=function(){return t.addNewElementText=o.instant("ADMIN.PROJECT_VALUES_"+f.toUpperCase()+".ACTION_ADD")},l(),p(),s.$on("$translateChangeEnd",function(){return t.$evalAsync(p)}),c=function(t){return function(t){var e;if(null==t&&(t=!1),e=n.find(".table-main"),$(document.body).scrollTop(e.offset().top+e.height()),t)return n.find(".new-value input:visible").first().focus()}}(this),g=function(t){var r,n,i,o;if(n=t.parents("form"),r=n.checksley(),r.validate())return o=n.scope().value,i=e.save(o),i.then(function(e){return function(){var e;return e=t.parents(".row.table-main"),e.addClass("hidden"),e.siblings(".visualization").removeClass("hidden")}}(this)),i.then(null,function(t){return r.setErrors(t)})},d=function(r){var n,i,o;if(i=r.parents("form"),n=i.checksley(),n.validate())return t.newValue.project=t.project.id,t.newValue.order=t.maxValueOrder?t.maxValueOrder+1:1,o=e.create(m,t.newValue),o.then(function(e){
return function(e){return r.addClass("hidden"),t.values.push(e),t.maxValueOrder=e.order,l()}}(this)),o.then(null,function(t){return n.setErrors(t)})},u=function(e){var r,n,i;return n=e.parents(".row.table-main"),r=e.parents("form"),i=r.scope().value,t.$apply(function(){return n.addClass("hidden"),i.revert(),n.siblings(".visualization").removeClass("hidden")})},n.on("click",".show-add-new",function(t){return t.preventDefault(),n.find(".new-value").removeClass("hidden"),c(!0)}),n.on("click",".add-new",h(2e3,function(t){var e;return t.preventDefault(),e=n.find(".new-value"),d(e)})),n.on("click",".delete-new",function(t){return t.preventDefault(),n.find(".new-value").addClass("hidden"),l()}),n.on("click",".edit-value",function(t){var e,r,n;return t.preventDefault(),n=angular.element(t.currentTarget),r=n.parents(".row.table-main"),r.addClass("hidden"),e=r.siblings(".edition"),e.removeClass("hidden"),e.find("input:visible").first().focus().select()}),n.on("keyup",".new-value input",function(t){var e;return 13===t.keyCode?(e=n.find(".new-value"),d(e)):27===t.keyCode?(n.find(".new-value").addClass("hidden"),l()):void 0}),n.on("click",".save",function(t){var e;return t.preventDefault(),e=angular.element(t.currentTarget),g(e)}),n.on("click",".cancel",function(t){var e;return t.preventDefault(),e=angular.element(t.currentTarget),u(e)}),n.on("click",".delete-value",function(n){var i,s,u,c,l,p,f;return n.preventDefault(),c=angular.element(n.currentTarget),s=c.parents("form"),f=s.scope().value,i={},_.each(t.values,function(t){if(f.id!==t.id)return i[t.id]=t.name}),u=f.name,0===_.keys(i).length?r.error(o.instant("ADMIN.PROJECT_VALUES.ERROR_DELETE_ALL")):(p=o.instant("ADMIN.COMMON.TITLE_ACTION_DELETE_VALUE"),l=o.instant("ADMIN.PROJECT_VALUES.REPLACEMENT"),r.askChoice(p,u,i,l).then(function(t){var n,i;return i=function(){return a.loadValues()["finally"](function(){return t.finish()})},n=function(){return r.notify("error")},e.remove(f,{moveTo:t.selected}).then(i,n)}))})},a=function(t,e,r){return u(t,e,r),c(t,e,r),t.$on("$destroy",function(){return e.off()})},{link:a}},b.directive("tgProjectValues",["$log","$tgRepo","$tgConfirm","$tgLocation","animationFrame","$translate","$rootScope",u]),t=function(){var t;return t=function(t,e,r,n){var i;return t.colorList=g(),t.allowEmpty=!1,r.tgAllowEmpty&&(t.allowEmpty=!0),i=e.controller(),t.$watch(r.ngModel,function(e){return t.color=e.color}),e.on("click",".current-color",function(t){var r,n;return t.preventDefault(),t.stopPropagation(),n=angular.element(t.currentTarget),$(".select-color").hide(),n.siblings(".select-color").show(),r=angular.element("body"),r.on("click",function(t){return function(t){if(0===angular.element(t.target).parent(".select-color").length)return e.find(".select-color").hide(),r.unbind("click")}}(this))}),e.on("click",".select-color .color",function(r){var i;return r.preventDefault(),i=angular.element(r.currentTarget),t.$apply(function(){return n.$modelValue.color=i.data("color")}),e.find(".select-color").hide()}),e.on("click",".select-color .selected-color",function(r){return r.preventDefault(),t.$apply(function(){return n.$modelValue.color=t.color}),e.find(".select-color").hide()}),e.on("keyup","input",function(r){return r.stopPropagation(),13===r.keyCode?(t.$apply(function(){return n.$modelValue.color=t.color}),e.find(".select-color").hide()):27===r.keyCode?e.find(".select-color").hide():void 0}),t.$on("$destroy",function(){return e.off()})},{link:t,require:"ngModel"}},b.directive("tgColorSelection",t),l="text",r="multiline",e="date",f="url",p=[{key:l,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_TEXT"},{key:r,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_MULTI"},{key:e,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_DATE"},{key:f,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_URL"}],n=function(t){function e(t,e,r,n,i,o,s,a,u,c){this.scope=t,this.rootscope=e,this.repo=r,this.rs=n,this.params=i,this.q=o,this.location=s,this.navUrls=a,this.appMetaService=u,this.translate=c,this.moveCustomAttributes=T(this.moveCustomAttributes,this),this.deleteCustomAttribute=T(this.deleteCustomAttribute,this),this.saveCustomAttribute=T(this.saveCustomAttribute,this),this.createCustomAttribute=T(this.createCustomAttribute,this),this.loadCustomAttributes=T(this.loadCustomAttributes,this),this.scope.TYPE_CHOICES=p,this.scope.project={},this.rootscope.$on("project:loaded",function(t){return function(){var e,r,n;return t.loadCustomAttributes(),r=t.translate.instant(t.scope.sectionName),n=t.translate.instant("ADMIN.CUSTOM_ATTRIBUTES.PAGE_TITLE",{sectionName:r,projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(n,e)}}(this))}return I(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","tgAppMetaService","$translate"],e.prototype.loadCustomAttributes=function(){return this.rs.customAttributes[this.scope.type].list(this.scope.projectId).then(function(t){return function(e){var r;return t.scope.customAttributes=e,t.scope.maxOrder=null!=(r=_.maxBy(e,"order"))?r.order:void 0,e}}(this))},e.prototype.createCustomAttribute=function(t){return this.repo.create("custom-attributes/"+this.scope.type,t)},e.prototype.saveCustomAttribute=function(t){return this.repo.save(t)},e.prototype.deleteCustomAttribute=function(t){return this.repo.remove(t)},e.prototype.moveCustomAttributes=function(t,e){var r,n;return r=this.scope.customAttributes,n=r.indexOf(t),r.splice(n,1),r.splice(e,0,t),_.each(r,function(t,e){return t.order=e}),this.repo.saveAll(r)},e}(y(S.Controller,S.PageMixin)),b.controller("ProjectCustomAttributesController",n),i=function(t,e,r,n){var i;return i=function(t,r,i){var o,s,a,u,c,l,p,f,d,g,m,v,y,_,b,S,k,j;return o=r.controller(),t.$on("$destroy",function(){return r.off()}),k=r.find(".js-sortable"),l=dragula([k[0]],{direction:"vertical",copySortSource:!1,copy:!1,mirrorContainer:k[0],moves:function(t){return $(t).is("div[tg-bind-scope]")}}),l.on("dragend",function(t){var e,r,n;return r=$(t),e=r.scope().attr,n=r.index(),o.moveCustomAttributes(e,n)}),b=function(){return r.find(".js-new-custom-field").removeClass("hidden"),r.find(".js-new-custom-field input:visible").first().focus()},d=function(){return r.find(".js-new-custom-field").addClass("hidden")},y=function(){return r.find(".js-add-custom-field-button").removeClass("hidden")},p=function(){return r.find(".js-add-custom-field-button").addClass("hidden")},_=function(){return r.find(".js-cancel-new-custom-field-button").removeClass("hidden")},f=function(){return r.find(".js-cancel-new-custom-field-button").addClass("hidden")},m=function(){return t.newAttr={}},u=function(r){var n,i,s,a;if(i=r.checksley(),i.validate())return a=function(t){return function(){return o.loadCustomAttributes(),d(),m(),e.notify("success")}}(this),s=function(t){return function(t){return i.setErrors(t)}}(this),n=t.newAttr,n.project=t.projectId,n.order=t.maxOrder?t.maxOrder+1:1,o.createCustomAttribute(n).then(a,s)},s=function(){return d(),m()},t.$watch("customAttributes",function(t){if(t)return 0===t.length?(f(),p(),b()):(d(),y(),_())}),r.on("click",".js-add-custom-field-button",function(t){return t.preventDefault(),b()}),r.on("click",".js-create-custom-field-button",h(2e3,function(t){var e,r;return t.preventDefault(),r=angular.element(t.currentTarget),e=r.closest("form"),u(e)})),r.on("click",".js-cancel-new-custom-field-button",function(t){return t.preventDefault(),s()}),r.on("keyup",".js-new-custom-field input",function(t){var e,r;return 13===t.keyCode?(r=angular.element(t.currentTarget),e=r.closest("form"),u(e)):27===t.keyCode?s():void 0}),S=function(t){return t.find(".js-view-custom-field").addClass("hidden"),t.find(".js-edit-custom-field").removeClass("hidden"),t.find(".js-edit-custom-field input:visible").first().focus().select()},g=function(t){return t.find(".js-edit-custom-field").addClass("hidden"),t.find(".js-view-custom-field").removeClass("hidden")},v=function(e){return t.$apply(function(){return e.scope().attr.revert()})},j=function(t){var r,n,i,s;if(n=t.checksley(),n.validate())return s=function(r){return function(){return o.loadCustomAttributes(),g(t),e.notify("success")}}(this),i=function(t){return function(t){return n.setErrors(t)}}(this),r=t.scope().attr,o.saveCustomAttribute(r).then(s,i)},a=function(t){return g(t),v(t)},r.on("click",".js-edit-custom-field-button",function(t){var e,r;return t.preventDefault(),r=angular.element(t.currentTarget),e=r.closest("form"),S(e)}),r.on("click",".js-update-custom-field-button",h(2e3,function(t){var e,r;return t.preventDefault(),r=angular.element(t.currentTarget),e=r.closest("form"),j(e)})),r.on("click",".js-cancel-edit-custom-field-button",function(t){var e,r;return t.preventDefault(),r=angular.element(t.currentTarget),e=r.closest("form"),a(e)}),r.on("keyup",".js-edit-custom-field input",function(t){var e,r;return 13===t.keyCode?(r=angular.element(t.currentTarget),e=r.closest("form"),j(e)):27===t.keyCode?(r=angular.element(t.currentTarget),e=r.closest("form"),a(e)):void 0}),c=function(t){var r,i,s,a;return r=t.scope().attr,i=r.name,a=n.instant("COMMON.CUSTOM_ATTRIBUTES.DELETE"),s=n.instant("COMMON.CUSTOM_ATTRIBUTES.CONFIRM_DELETE"),e.ask(a,s,i).then(function(t){var n,s;return s=function(){return o.loadCustomAttributes()["finally"](function(){return t.finish()})},n=function(){return e.notify("error",null,"We have not been able to delete '"+i+"'.")},o.deleteCustomAttribute(r).then(s,n)})},r.on("click",".js-delete-custom-field-button",h(2e3,function(t){var e,r;return t.preventDefault(),r=angular.element(t.currentTarget),e=r.closest("form"),c(e)}))},{link:i}},b.directive("tgProjectCustomAttributes",["$log","$tgConfirm","animationFrame","$translate",i]),o=function(t){function e(t,e,r,n,i,o){this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.model=o,this.mixingClass=T(this.mixingClass,this),this.cancelMixingTags=T(this.cancelMixingTags,this),this.confirmMixingTags=T(this.confirmMixingTags,this),this.toggleMixingFromTags=T(this.toggleMixingFromTags,this),this.startMixingTags=T(this.startMixingTags,this),this.deleteTag=T(this.deleteTag,this),this.editTag=T(this.editTag,this),this.createTag=T(this.createTag,this),this.filterAndSortTags=T(this.filterAndSortTags,this),this.loadTags=T(this.loadTags,this),this.loading=!0,this.rootscope.$on("project:loaded",this.loadTags)}return I(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$tgModel"],e.prototype.loadTags=function(){return this.rs.projects.tagsColors(this.scope.projectId).then(function(t){return function(e){return t.scope.projectTagsAll=_.map(e.getAttrs(),function(e,r){return t.model.make_model("tag",{name:r,color:e})}),t.filterAndSortTags(),t.loading=!1}}(this))},e.prototype.filterAndSortTags=function(){return this.scope.projectTags=_.filter(_.sortBy(this.scope.projectTagsAll,"name"),function(t){return function(e){return e.name.indexOf(t.scope.tagsFilter.name)!==-1}}(this))},e.prototype.createTag=function(t,e){return this.rs.projects.createTag(this.scope.projectId,t,e)},e.prototype.editTag=function(t,e,r){return t===e&&(e=null),this.rs.projects.editTag(this.scope.projectId,t,e,r)},e.prototype.deleteTag=function(t){return this.scope.loadingDelete=!0,this.rs.projects.deleteTag(this.scope.projectId,t)["finally"](function(t){return function(){return t.scope.loadingDelete=!1}}(this))},e.prototype.startMixingTags=function(t){return this.scope.mixingTags.toTag=t.name},e.prototype.toggleMixingFromTags=function(t){var e;if(t.name!==this.scope.mixingTags.toTag)return e=this.scope.mixingTags.fromTags.indexOf(t.name),e===-1?this.scope.mixingTags.fromTags.push(t.name):this.scope.mixingTags.fromTags.splice(e,1)},e.prototype.confirmMixingTags=function(){var t,e;return e=this.scope.mixingTags.toTag,t=this.scope.mixingTags.fromTags,this.scope.loadingMixing=!0,this.rs.projects.mixTags(this.scope.projectId,e,t).then(function(t){return function(){return t.cancelMixingTags(),t.loadTags()}}(this))["finally"](function(t){return function(){return t.scope.loadingMixing=!1}}(this))},e.prototype.cancelMixingTags=function(){return this.scope.mixingTags.toTag=null,this.scope.mixingTags.fromTags=[]},e.prototype.mixingClass=function(t){if(null!==this.scope.mixingTags.toTag){if(t.name===this.scope.mixingTags.toTag)return"mixing-tags-to";if(this.scope.mixingTags.fromTags.indexOf(t.name)!==-1)return"mixing-tags-from"}},e}(S.Controller),b.controller("ProjectTagsController",o),s=function(t,e,r,n,i,o,s){var a;return a=function(t,e,n){var i,a,u,c,l,p,f,d,g,m,v,y;return a=$(window),i=e.controller(),y=n.type,g=n.objname,p=function(){return t.newValue={tag:"",color:""}},f=function(){return t.tagsFilter={name:""}},l=function(){return t.mixingTags={toTag:null,fromTags:[]}},d=function(){return t.addNewElementText=o.instant("ADMIN.PROJECT_VALUES_TAGS.ACTION_ADD")},p(),f(),l(),d(),s.$on("$translateChangeEnd",function(){return t.$evalAsync(d)}),c=function(t){return function(t){var r;if(null==t&&(t=!1),r=e.find(".table-main"),$(document.body).scrollTop(r.offset().top+r.height()),t)return e.find(".new-value input:visible").first().focus()}}(this),v=function(e){return function(e){var r,n,o,s,a;if(n=e.parents("form"),r=n.checksley(),r.validate())return a=n.scope().tag,o=a.clone(),o.revert(),t.loadingEdit=!0,s=i.editTag(o.name,a.name,a.color),s.then(function(){return i.loadTags().then(function(){var r;return r=e.parents(".row.table-main"),r.addClass("hidden"),t.loadingEdit=!1,r.siblings(".visualization").removeClass("hidden")})}),s.then(null,function(e){return t.loadingEdit=!1,r.setErrors(e.data)})}}(this),m=function(e){return function(e){var r,n,o;if(n=e.parents("form"),n=e,r=n.checksley(),r.validate())return t.loadingCreate=!0,o=i.createTag(t.newValue.tag,t.newValue.color),o.then(function(r){return i.loadTags().then(function(){return t.loadingCreate=!1,e.addClass("hidden"),p()})}),o.then(null,function(e){return t.loadingCreate=!1,r.setErrors(e.data)})}}(this),u=function(e){var r,n,i;return n=e.parents(".row.table-main"),r=e.parents("form"),i=r.scope().tag,t.$apply(function(){return n.addClass("hidden"),i.revert(),n.siblings(".visualization").removeClass("hidden")})},t.$watch("tagsFilter.name",function(t){return i.filterAndSortTags()}),a.on("keyup",function(e){if(27===e.keyCode)return t.$apply(function(){return l()})}),e.on("click",".show-add-new",function(t){return t.preventDefault(),e.find(".new-value").removeClass("hidden")}),e.on("click",".add-new",h(2e3,function(t){var r;return t.preventDefault(),r=e.find(".new-value"),m(r)})),e.on("click",".delete-new",function(t){return t.preventDefault(),e.find(".new-value").addClass("hidden"),p()}),e.on("click",".mix-tags",function(e){var r;return e.preventDefault(),r=angular.element(e.currentTarget),t.$apply(function(){return i.startMixingTags(r.parents("form").scope().tag)})}),e.on("click",".mixing-row",function(e){var r;return e.preventDefault(),r=angular.element(e.currentTarget),t.$apply(function(){return i.toggleMixingFromTags(r.parents("form").scope().tag)})}),e.on("click",".mixing-confirm",function(e){return e.preventDefault(),e.stopPropagation(),t.$apply(function(){return i.confirmMixingTags()})}),e.on("click",".mixing-cancel",function(e){return e.preventDefault(),e.stopPropagation(),t.$apply(function(){return i.cancelMixingTags()})}),e.on("click",".edit-value",function(t){var e,r,n;return t.preventDefault(),n=angular.element(t.currentTarget),r=n.parents(".row.table-main"),r.addClass("hidden"),e=r.siblings(".edition"),e.removeClass("hidden"),e.find("input:visible").first().focus().select()}),e.on("keyup",".new-value input",function(t){var r;return 13===t.keyCode?(r=e.find(".new-value"),m(r)):27===t.keyCode?(e.find(".new-value").addClass("hidden"),p()):void 0}),e.on("keyup",".status-name input",function(t){var e;return e=angular.element(t.currentTarget),13===t.keyCode?v(e):27===t.keyCode?u(e):void 0}),e.on("click",".save",function(t){var e;return t.preventDefault(),e=angular.element(t.currentTarget),v(e)}),e.on("click",".cancel",function(t){var e;return t.preventDefault(),e=angular.element(t.currentTarget),u(e)}),e.on("click",".delete-tag",function(t){var e,n,s,a;return t.preventDefault(),s=angular.element(t.currentTarget),e=s.parents("form"),n=e.scope().tag,a=o.instant("ADMIN.COMMON.TITLE_ACTION_DELETE_TAG"),r.askOnDelete(a,n.name).then(function(t){var e,o;return o=function(){return i.loadTags()["finally"](function(){return t.finish()})},e=function(){return r.notify("error")},i.deleteTag(n.name).then(o,e)})}),t.$on("$destroy",function(){return e.off(),a.off()})},{link:a}},b.directive("tgProjectTags",["$log","$tgRepo","$tgConfirm","$tgLocation","animationFrame","$translate","$rootScope",s])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p=function(t,e){return function(){return t.apply(e,arguments)}},f=function(t,e){function r(){this.constructor=t}for(var n in e)d.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},d={}.hasOwnProperty,h=[].indexOf||function(t){for(var e=0,r=this.length;e\n\n
<%- category.activePermissions %>/<%- category.permissions.length %>
\n <% _.each(category.permissions, function(permission) { %>\n
\n <% }) %>\n
\n'),o=_.template('\n
\n
\n
\n
\n <% _.each(category.permissions, function(permission) { %>\n
\n
\n
\n
disabled="disabled" <% } %>\n <% if(permission.active) { %> checked="checked" <% } %>/>\n
\n
\n
\n
\n
\n <% }) %>\n
\n
\n
'),i=_.template(''),a=function(a,c,l){var p,f,d,g,m;return p=c.controller(),f=function(t){var e,r,n,i,o,s,u,c,l,p;return s=function(e){return _.map(e,function(e){var r;return _.extend({},e,{active:(r=e.key,h.call(t.permissions,r)>=0)})})},n=function(t,e,r){return!(e.external_user&&!r.is_private&&0===t.key.indexOf("view_"))},u=function(e){return _.map(e,function(e){return e.permissions=e.permissions.map(function(e){return e.editable=n(e,t,a.project),e}),_.extend({},e,{activePermissions:_.filter(e.permissions,"active").length})})},e=[],r=[{key:"view_epics",name:"COMMON.PERMISIONS_CATEGORIES.EPICS.VIEW_EPICS"},{key:"add_epic",name:"COMMON.PERMISIONS_CATEGORIES.EPICS.ADD_EPICS"},{key:"modify_epic",name:"COMMON.PERMISIONS_CATEGORIES.EPICS.MODIFY_EPICS"},{key:"comment_epic",name:"COMMON.PERMISIONS_CATEGORIES.EPICS.COMMENT_EPICS"},{key:"delete_epic",name:"COMMON.PERMISIONS_CATEGORIES.EPICS.DELETE_EPICS"}],e.push({name:"COMMON.PERMISIONS_CATEGORIES.EPICS.NAME",permissions:s(r)}),o=[{key:"view_milestones",name:"COMMON.PERMISIONS_CATEGORIES.SPRINTS.VIEW_SPRINTS"},{key:"add_milestone",name:"COMMON.PERMISIONS_CATEGORIES.SPRINTS.ADD_SPRINTS"},{key:"modify_milestone",name:"COMMON.PERMISIONS_CATEGORIES.SPRINTS.MODIFY_SPRINTS"},{key:"delete_milestone",name:"COMMON.PERMISIONS_CATEGORIES.SPRINTS.DELETE_SPRINTS"}],e.push({name:"COMMON.PERMISIONS_CATEGORIES.SPRINTS.NAME",permissions:s(o)}),l=[{key:"view_us",name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.VIEW_USER_STORIES"},{key:"add_us",name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.ADD_USER_STORIES"},{key:"modify_us",name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.MODIFY_USER_STORIES"},{key:"comment_us",name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.COMMENT_USER_STORIES"},{key:"delete_us",name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.DELETE_USER_STORIES"}],e.push({name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.NAME",permissions:s(l)}),c=[{key:"view_tasks",name:"COMMON.PERMISIONS_CATEGORIES.TASKS.VIEW_TASKS"},{key:"add_task",name:"COMMON.PERMISIONS_CATEGORIES.TASKS.ADD_TASKS"},{key:"modify_task",name:"COMMON.PERMISIONS_CATEGORIES.TASKS.MODIFY_TASKS"},{key:"comment_task",name:"COMMON.PERMISIONS_CATEGORIES.TASKS.COMMENT_TASKS"},{key:"delete_task",name:"COMMON.PERMISIONS_CATEGORIES.TASKS.DELETE_TASKS"}],e.push({name:"COMMON.PERMISIONS_CATEGORIES.TASKS.NAME",permissions:s(c)}),i=[{key:"view_issues",name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.VIEW_ISSUES"},{key:"add_issue",name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.ADD_ISSUES"},{key:"modify_issue",name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.MODIFY_ISSUES"},{key:"comment_issue",name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.COMMENT_ISSUES"},{key:"delete_issue",name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.DELETE_ISSUES"}],e.push({name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.NAME",permissions:s(i)}),p=[{key:"view_wiki_pages",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.VIEW_WIKI_PAGES"},{key:"add_wiki_page",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.ADD_WIKI_PAGES"},{key:"modify_wiki_page",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.MODIFY_WIKI_PAGES"},{key:"delete_wiki_page",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.DELETE_WIKI_PAGES"},{key:"view_wiki_links",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.VIEW_WIKI_LINKS"},{key:"add_wiki_link",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.ADD_WIKI_LINKS"},{key:"delete_wiki_link",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.DELETE_WIKI_LINKS"}],e.push({name:"COMMON.PERMISIONS_CATEGORIES.WIKI.NAME",permissions:s(p)}),u(e)},m=function(t,e){return t.find(".resume").html(n(u({category:e}))(a))},d=function(t,e){var r;return r=o({category:t,index:e}),r=angular.element(r),m(r,t),n(r)(a)},g=function(){var n;return c.off(),n=i(),_.each(f(a.role),function(t,e){return n=angular.element(n).append(d(t,e))}),c.html(n),c.on("click",".resume",function(t){var e;return t.preventDefault(),e=angular.element(t.currentTarget),e.toggleClass("open-drawer"),e.next().toggleClass("open")}),c.on("change",".category-item input",function(n){var i,o,s,u;return i=function(){var t;return t=_.filter(c.find(".category-item input"),function(t){return angular.element(t).is(":checked")}),t=_.sortBy(_.map(t,function(t){var e;return e=angular.element(t).parents(".category-item").data("id")})),t.length&&t.push("view_project"),t},u=angular.element(n.currentTarget),a.role.permissions=i(),s=function(){var e,n;return e=f(a.role),n=u.parents(".category-config").data("id"),m(u.parents(".category-config"),e[n]),t.$broadcast("projects:reload"),r.notify("success"),p.loadProject()},o=function(){return r.notify("error"),u.prop("checked",!u.prop("checked")),a.role.permissions=i()},a.role.external_user?(a.project.public_permissions=a.role.permissions,a.project.anon_permissions=a.role.permissions.filter(function(t){return 0===t.indexOf("view_")}),e.save(a.project).then(s,o)):e.save(a.role).then(s,o)})},a.$on("$destroy",function(){return c.off()}),a.$on("role:changed",function(){return g()}),s(a,l.ngModel,g)},{link:a}},c.directive("tgRolePermissions",["$rootScope","$tgRepo","$tgConfirm","$compile",r])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p,f,d,h,g,m,v,y=function(t,e){function r(){this.constructor=t}for(var n in e)b.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},b={}.hasOwnProperty;m=this.taiga,h=this.taiga.mixOf,f=this.taiga.bindMethods,d=this.taiga.debounce,v=this.taiga.timeout,g=angular.module("taigaAdmin"),p=function(t){function e(t,e,r,n,i,o,s,a,u){var c;this.scope=t,this.repo=e,this.rs=r,this.params=n,this.location=i,this.navUrls=o,this.appMetaService=s,this.translate=a,this.errorHandlingService=u,f(this),this.scope.sectionName="ADMIN.WEBHOOKS.SECTION_NAME",this.scope.project={},c=this.loadInitialData(),c.then(function(t){return function(){var e,r;return r=t.translate.instant("ADMIN.WEBHOOKS.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(r,e)}}(this)),c.then(null,this.onInitialDataError.bind(this)),this.scope.$on("webhooks:reload",this.loadWebhooks)}return y(e,t),e.$inject=["$scope","$tgRepo","$tgResources","$routeParams","$tgLocation","$tgNavUrls","tgAppMetaService","$translate","tgErrorHandlingService"],e.prototype.loadWebhooks=function(){return this.rs.webhooks.list(this.scope.projectId).then(function(t){return function(e){return t.scope.webhooks=e}}(this))},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.i_am_admin||t.errorHandlingService.permissionDenied(),t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(){return t.loadWebhooks()}}(this)),t},e}(h(m.Controller,m.PageMixin,m.FiltersMixin)),g.controller("WebhooksController",p),l=function(t,e,r,n,i){var o;return o=function(n,o,s){var a,u,c,l,p,f,h,g;return g=n.$eval(s.tgWebhook),f=function(){var e;return e=i.instant("ADMIN.WEBHOOKS.DATE"),t.webhooklogs.list(g.id).then(function(t){return function(t){var r,n,i,o;for(r=0,n=t.length;r=1)return s.addClass("hidden")})}),o.on("click",function(t){return s.removeClass("hidden"),s.find("input")[0].focus()})},{link:i}},g.directive("tgNewWebhook",["$tgResources","$tgRepo","$tgConfirm","$tgLoading",a]),r=function(t){function e(t,e,r,n,i,o){var s;this.scope=t,this.repo=e,this.rs=r,this.params=n,this.appMetaService=i,this.translate=o,f(this),this.scope.sectionName=this.translate.instant("ADMIN.GITHUB.SECTION_NAME"),this.scope.project={},s=this.loadInitialData(),s.then(function(t){return function(){var e,r;return r=t.translate.instant("ADMIN.GITHUB.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(r,e)}}(this)),s.then(null,this.onInitialDataError.bind(this))}return y(e,t),e.$inject=["$scope","$tgRepo","$tgResources","$routeParams","tgAppMetaService","$translate"],e.prototype.loadModules=function(){return this.rs.modules.list(this.scope.projectId,"github").then(function(t){return function(e){return t.scope.github=e}}(this))},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(){return t.loadModules()}}(this)),t},e}(h(m.Controller,m.PageMixin,m.FiltersMixin)),g.controller("GithubController",r),i=function(t){function e(t,e,r,n,i,o){var s;this.scope=t,this.repo=e,this.rs=r,this.params=n,this.appMetaService=i,this.translate=o,f(this),this.scope.sectionName=this.translate.instant("ADMIN.GITLAB.SECTION_NAME"),this.scope.project={},s=this.loadInitialData(),s.then(function(t){return function(){var e,r;return r=t.translate.instant("ADMIN.GITLAB.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(r,e)}}(this)),s.then(null,this.onInitialDataError.bind(this)),this.scope.$on("project:modules:reload",function(t){return function(){return t.loadModules()}}(this))}return y(e,t),e.$inject=["$scope","$tgRepo","$tgResources","$routeParams","tgAppMetaService","$translate"],e.prototype.loadModules=function(){return this.rs.modules.list(this.scope.projectId,"gitlab").then(function(t){return function(e){return t.scope.gitlab=e}}(this))},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(){return t.loadModules()}}(this)),t},e}(h(m.Controller,m.PageMixin,m.FiltersMixin)),g.controller("GitlabController",i),t=function(t){function e(t,e,r,n,i,o){var s;this.scope=t,this.repo=e,this.rs=r,this.params=n,this.appMetaService=i,this.translate=o,f(this),this.scope.sectionName=this.translate.instant("ADMIN.BITBUCKET.SECTION_NAME"),this.scope.project={},s=this.loadInitialData(),s.then(function(t){return function(){var e,r;return r=t.translate.instant("ADMIN.BITBUCKET.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(r,e)}}(this)),s.then(null,this.onInitialDataError.bind(this)),this.scope.$on("project:modules:reload",function(t){return function(){return t.loadModules()}}(this))}return y(e,t),e.$inject=["$scope","$tgRepo","$tgResources","$routeParams","tgAppMetaService","$translate"],e.prototype.loadModules=function(){return this.rs.modules.list(this.scope.projectId,"bitbucket").then(function(t){return function(e){return t.scope.bitbucket=e}}(this))},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(){return t.loadModules()}}(this)),t},e}(h(m.Controller,m.PageMixin,m.FiltersMixin)),g.controller("BitbucketController",t),u=function(){var t;return t=function(t,e,r){return e.on("click",".select-input-content",function(){return e.find("input").select(),e.find(".help-copy").addClass("visible")})},{link:t}},g.directive("tgSelectInputText",u),n=function(t,e,r){var n;return n=function(n,i,o){var s,a,u;return s=i.find("form").checksley({onlyOneErrorElement:!0}),a=d(2e3,function(i){return function(i){var o,a;if(i.preventDefault(),s.validate())return o=r().target(u).start(),a=t.saveAttribute(n.github,"github"),a.then(function(){return o.finish(),e.notify("success")}),a.then(null,function(t){if(o.finish(),s.setErrors(t),t._error_message)return e.notify("error",t._error_message)})}}(this)),u=i.find(".submit-button"),i.on("submit","form",a)},{link:n}},g.directive("tgGithubWebhooks",["$tgRepo","$tgConfirm","$tgLoading",n]),o=function(t,e,r){var n;return n=function(n,i,o){var s,a,u;return s=i.find("form").checksley({onlyOneErrorElement:!0}),a=d(2e3,function(i){return function(i){var o,a;if(i.preventDefault(),s.validate())return o=r().target(u).start(),a=t.saveAttribute(n.gitlab,"gitlab"),a.then(function(){return o.finish(),e.notify("success"),n.$emit("project:modules:reload")}),a.then(null,function(t){if(o.finish(),s.setErrors(t),t._error_message)return e.notify("error",t._error_message)})}}(this)),u=i.find(".submit-button"),i.on("submit","form",a)},{link:n}},g.directive("tgGitlabWebhooks",["$tgRepo","$tgConfirm","$tgLoading",o]),e=function(t,e,r){var n;return n=function(n,i,o){var s,a,u;return s=i.find("form").checksley({onlyOneErrorElement:!0}),a=d(2e3,function(i){return function(i){var o,a;if(i.preventDefault(),s.validate())return o=r().target(u).start(),a=t.saveAttribute(n.bitbucket,"bitbucket"),a.then(function(){return o.finish(),e.notify("success"),n.$emit("project:modules:reload")}),a.then(null,function(t){if(o.finish(),s.setErrors(t),t._error_message)return e.notify("error",t._error_message)})}}(this)),u=i.find(".submit-button"),i.on("submit","form",a)},{link:n}},g.directive("tgBitbucketWebhooks",["$tgRepo","$tgConfirm","$tgLoading",e]),c=function(){var t;return t=function(t,e,r,n){return n.$parsers.push(function(t){return t=$.trim(t),""===t?[]:t.split(",")})},{link:t,restrict:"EA",require:"ngModel"}},g.directive("tgValidOriginIps",c),s=function(t){function e(t,e,r,n,i,o){var s;this.scope=t,this.repo=e,this.rs=r,this.params=n,this.appMetaService=i,this.translate=o,f(this),this.scope.sectionName=this.translate.instant("ADMIN.GOGS.SECTION_NAME"),this.scope.project={},s=this.loadInitialData(),s.then(function(t){return function(){var e,r;return r=t.translate.instant("ADMIN.GOGS.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(r,e)}}(this)),s.then(null,this.onInitialDataError.bind(this))}return y(e,t),e.$inject=["$scope","$tgRepo","$tgResources","$routeParams","tgAppMetaService","$translate"],e.prototype.loadModules=function(){return this.rs.modules.list(this.scope.projectId,"gogs").then(function(t){return function(e){return t.scope.gogs=e}}(this))},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(){return t.loadModules()}}(this)),t},e}(h(m.Controller,m.PageMixin,m.FiltersMixin)),g.controller("GogsController",s)}.call(this),function(){var t,e;e=angular.module("taigaProject"),t=function(){return{templateUrl:"project/wizard-restrictions.html"}},e.directive("tgCreateProjectRestriction",[t])}.call(this),function(){var t,e,r,n,i,o,s;o=this.taiga,r=this.taiga.bindOnce,s=this.taiga.timeout,n=this.taiga.debounce,i=angular.module("taigaProject"),t=function(t,e,r,n,i,o,s,a,u,c,l,p,f){var d,h;return h=function(i,d,h){var g,m,v,y,b,S,k;return i.data={},i.templates=[],g=null,m=d.find("form").checksley({onlyOneErrorElement:!0}),y=function(e){return c.get("$http").removeAll(),g.finish(),t.$broadcast("projects:reload"),r.notify("success",l.instant("COMMON.SAVE")),n.url(s.get(e)),u.close(d),p.loadProjects()},v=function(t){var e,r,n,i,o,s;for(g.finish(),m.setErrors(t),s=[],i=_.keys(t),o=[],r=0,n=i.length;rd?(p=a.instant("PROJECT.IMPORT.ERROR_MAX_SIZE_EXCEEDED",{fileName:e.name,fileSize:r(e.size),maxFileSize:r(d)}),h={status:413,data:{_error_message:p}},l.reject(h),l.promise):(v=function(t){return function(t){var e,i;return i=Math.round(t.loaded/t.total*100),e=a.instant("PROJECT.IMPORT.UPLOAD_IN_PROGRESS_MESSAGE",{uploadedSize:r(t.loaded),totalSize:r(t.total)}),n("in-progress",null,e,i)}}(this),g=function(t){return function(t){return n("done",a.instant("PROJECT.IMPORT.TITLE"),a.instant("PROJECT.IMPORT.DESCRIPTION"))}}(this),m=function(t){return function(t){return n("error")}}(this),u=function(t){return function(t){var e;h={};try{h.data=JSON.parse(t.target.responseText)}catch(r){h.data={}}return h.status=t.target.status,t.target.getResponseHeader("Taiga-Info-Project-Is-Private")&&(h.headers={isPrivate:"True"===t.target.getResponseHeader("Taiga-Info-Project-Is-Private"),memberships:parseInt(t.target.getResponseHeader("Taiga-Info-Project-Memberships"))}),201!==(e=h.status)&&202!==e||l.resolve(h),l.reject(h)}}(this),f=function(t){return function(t){return l.reject("fail")}}(this),c=new FormData,c.append("dump",e),y=new XMLHttpRequest,y.upload.addEventListener("progress",v,!1),y.upload.addEventListener("load",g,!1),y.upload.addEventListener("error",m,!1),y.upload.addEventListener("abort",m,!1),y.addEventListener("load",u,!1),y.addEventListener("error",f,!1),y.open("POST",i.resolve("importer")),y.setRequestHeader("Authorization","Bearer "+o.getToken()),y.setRequestHeader("Accept","application/json"),y.send(c),l.promise)},u.changeLogo=function(e,o){var a,u,c,l,p,f;return c=t.get("maxUploadFileSize",null),c&&o.size>c?(p={status:413,data:{_error_message:"'"+o.name+"' ("+r(o.size)+") is too heavy for our oompa loompas, try it with a smaller than ("+r(c)+")"}},u=s.defer(),u.reject(p),u.promise):(a=new FormData,a.append("logo",o),l={transformRequest:angular.identity,headers:{"Content-Type":void 0}},f=i.resolve("projects")+"/"+e+"/change_logo",n.post(f,a,{},l))},u.removeLogo=function(t){var e;return e=i.resolve("projects")+"/"+t+"/remove_logo",n.post(e)},function(t){return t.projects=u}},t=angular.module("taigaResources"),t.factory("$tgProjectsResourcesProvider",["$tgConfig","$tgRepo","$tgHttp","$tgUrls","$tgAuth","$q","$translate",e])}.call(this),function(){var t,e,r;r=this.taiga,e=function(t,e,r){var n;return n={},n.get=function(e){return t.queryOne("roles",e)},n.list=function(e){return t.queryMany("roles",{project:e})},function(t){return t.roles=n}},t=angular.module("taigaResources"),t.factory("$tgRolesResourcesProvider",["$tgRepo","$tgHttp","$tgUrls",e])}.call(this),function(){var t,e,r;r=this.taiga,e=function(t,e,r,n){var i;return i={},i["do"]=function(t,i){var o,s,a,u;return o=n.defer(),u=e.resolve("search"),s={url:u,method:"GET",timeout:o.promise,cancelable:!0,params:{project:t,text:i,get_all:!1}},a=r.request(s).then(function(t){return t.data}),a.abort=function(){return o.resolve()},a["finally"]=function(){return a.abort=angular.noop,o=a=null},a},function(t){return t.search=i}},t=angular.module("taigaResources"),t.factory("$tgSearchResourcesProvider",["$tgRepo","$tgUrls","$tgHttp","$q",e])}.call(this),function(){var t,e,r,n;n=this.taiga,t=n.generateHash,r=function(t,e,r){var n;return n={},n.get=function(r,n){return t.queryOne("milestones",n).then(function(t){var r;return r=t.user_stories,r=_.map(r,function(t){return e.make_model("userstories",t)}),t._attrs.user_stories=r,t})},n.stats=function(e,r){return t.queryOneRaw("milestones",r+"/stats")},n.list=function(r,n){var i;return i={project:r},i=_.extend({},i,n||{}),t.queryMany("milestones",i,{},!0).then(function(t){return function(t){var r,n,i,o,s,a;for(s=t[0],r=t[1],n=0,i=s.length;nu?(l={status:413,data:{_error_message:"'"+e.name+"' ("+r(e.size)+") is too heavy for our oompa loompas, try it with a smaller than ("+r(u)+")"}},a=o.defer(),a.reject(l),a.promise):(s=new FormData,s.append("avatar",e),c={transformRequest:angular.identity,headers:{"Content-Type":void 0}},p=i.resolve("users")+"/change_avatar",n.post(p,s,{},c))},s.removeAvatar=function(){var t;return t=i.resolve("users")+"/remove_avatar",n.post(t)},s.changePassword=function(t,e){var r,o;return o=i.resolve("users")+"/change_password",r={current_password:t,password:e},n.post(o,r)},function(t){return t.userSettings=s}},t=angular.module("taigaResources"),t.factory("$tgUserSettingsResourcesProvider",["$tgConfig","$tgRepo","$tgHttp","$tgUrls","$q",e])}.call(this),function(){var t,e,r,n;n=this.taiga,r=this.taiga.sizeFormat,e=function(t,e){var r;return r={},r.contacts=function(r,n){var i,o;return null==n&&(n={}),o=e.resolve("user-contacts",r),i={headers:{}},n.enablePagination||(i.headers["x-disable-pagination"]="1"),t.get(o,{},i).then(function(t){return t.data})},function(t){return t.users=r}},t=angular.module("taigaResources"),t.factory("$tgUsersResourcesProvider",["$tgHttp","$tgUrls","$q",e])}.call(this),function(){var t,e,r,n;n=this.taiga,t=n.generateHash,r=function(e,r,n,i,o){var s,a;return a={},s="userstories-queryparams",a.get=function(t,r){var n;return n=a.getQueryParams(t),n.project=t,e.queryOne("userstories",r,n)},a.getByRef=function(t,r,n){var i;return null==n&&(n={}),i=a.getQueryParams(t),i.project=t,i.ref=r,i=_.extend({},i,n),e.queryOne("userstories","by_ref",i)},a.listInAllProjects=function(t){return e.queryMany("userstories",t)},a.filtersData=function(t){return e.queryOneRaw("userstories-filters",null,t)},a.listUnassigned=function(t,r,n){var i;return i={project:t,milestone:"null"},i=_.extend({},i,r||{}),a.storeQueryParams(t,i),e.queryMany("userstories",_.extend(i,{page_size:n}),{enablePagination:!0},!0)},a.listAll=function(t,r){var n;return n={project:t},n=_.extend({},n,r||{}),a.storeQueryParams(t,n),e.queryMany("userstories",n)},a.bulkCreate=function(t,e,i){var o,s;return o={project_id:t,status_id:e,bulk_stories:i},s=n.resolve("bulk-create-us"),r.post(s,o)},a.upvote=function(t){var e;return e=n.resolve("userstory-upvote",t),r.post(e)},a.downvote=function(t){var e;return e=n.resolve("userstory-downvote",t),r.post(e)},a.watch=function(t){var e;return e=n.resolve("userstory-watch",t),r.post(e)},a.unwatch=function(t){var e;return e=n.resolve("userstory-unwatch",t),r.post(e)},a.bulkUpdateBacklogOrder=function(t,e){var i,o;return o=n.resolve("bulk-update-us-backlog-order"),i={project_id:t,bulk_stories:e},r.post(o,i)},a.bulkUpdateMilestone=function(t,e,i){var o,s;return s=n.resolve("bulk-update-us-milestone"),o={project_id:t,milestone_id:e,bulk_stories:i},r.post(s,o)},a.bulkUpdateKanbanOrder=function(t,e){var i,o;return o=n.resolve("bulk-update-us-kanban-order"),i={project_id:t,bulk_stories:e},r.post(o,i)},a.listValues=function(t,r){var n;return n={project:t},a.storeQueryParams(t,n),e.queryMany(r,n)},a.storeQueryParams=function(e,r){var n,o;return o=e+":"+s,n=t([e,o]),i.set(n,r)},a.getQueryParams=function(e){var r,n;return n=e+":"+s,r=t([e,n]),i.get(r)||{}},a.storeShowTags=function(e,r){var n;return n=t([e,"showTags"]),i.set(n,r)},a.getShowTags=function(e){var r;return r=t([e,"showTags"]),i.get(r)||null},function(t){return t.userstories=a}},e=angular.module("taigaResources"),e.factory("$tgUserstoriesResourcesProvider",["$tgRepo","$tgHttp","$tgUrls","$tgStorage","$q",r])}.call(this),function(){var t,e;e=function(t,e,r){var n;return n={},n.list=function(e){var r;return r={webhook:e},t.queryMany("webhooklogs",r)},n.resend=function(t){var n;return n=e.resolve("webhooklogs-resend",t),r.post(n)},function(t){return t.webhooklogs=n}},t=angular.module("taigaResources"),t.factory("$tgWebhookLogsResourcesProvider",["$tgRepo","$tgUrls","$tgHttp",e])}.call(this),function(){var t,e;e=function(t,e,r){var n;return n={},n.list=function(e){var r;return r={project:e},t.queryMany("webhooks",r)},n.test=function(t){var n;return n=e.resolve("webhooks-test",t),r.post(n)},function(t){return t.webhooks=n}},t=angular.module("taigaResources"),t.factory("$tgWebhooksResourcesProvider",["$tgRepo","$tgUrls","$tgHttp",e])}.call(this),function(){var t,e,r;r=this.taiga,e=function(t,e,r){var n;return n={},n.get=function(e){return t.queryOne("wiki",e)},n.getBySlug=function(e,r){return t.queryOne("wiki","by_slug?project="+e+"&slug="+r)},n.list=function(e){return t.queryMany("wiki",{project:e})},n.listLinks=function(e){return t.queryMany("wiki-links",{project:e})},function(t){return t.wiki=n}},t=angular.module("taigaResources"),t.factory("$tgWikiResourcesProvider",["$tgRepo","$tgHttp","$tgUrls",e])}.call(this),function(){var t,e,r,n,i,o,s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;o=this.taiga,n=this.taiga.mixOf,r=this.taiga.debounce,i=angular.module("taigaUserSettings"),t=function(t){function e(t,e,r,n,i,o,s,a,u,c,l){this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=o,this.q=s,this.location=a,this.navUrls=u,this.auth=c,this.translate=l,this.scope.sectionName=this.translate.instant("CHANGE_PASSWORD.SECTION_NAME"),this.scope.user=this.auth.getUser()}return s(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$tgAuth","$translate"],e}(n(o.Controller,o.PageMixin)),i.controller("UserChangePasswordController",t),e=function(t,e,n,i){var o;return o=function(o,s,a,u){var c,l,p;return c=new checksley.Form(s.find("form")),l=r(2e3,function(r){return function(r){var s,a;if(r.preventDefault(),c.validate())return o.newPassword1!==o.newPassword2?void e.notify("error",i.instant("CHANGE_PASSWORD.ERROR_PASSWORD_MATCH")):(s=n().target(p).start(),a=t.userSettings.changePassword(o.currentPassword,o.newPassword1),a.then(function(){return s.finish(),e.notify("success")}),a.then(null,function(t){return s.finish(),e.notify("error",t.data._error_message)}))}}(this)),p=s.find(".submit-button"),s.on("submit","form",l),o.$on("$destroy",function(){return s.off()})},{link:o}},i.directive("tgUserChangePassword",["$tgResources","$tgConfirm","$tgLoading","$translate",e])}.call(this),function(){var t,e,r,n,i;i=this.taiga,e=this.taiga.bindOnce,r=this.taiga.debounce,n=angular.module("taigaUserSettings"),t=function(t,e,n,i,o,s,a){var u;return u=function(e,u,c){var l,p;return e.$on("deletelightbox:new",function(t,e){return s.open(u)}),e.$on("$destroy",function(){return u.off()}),l=function(){var r,c;return r=a().target(p).start(),c=t.remove(e.user),c.then(function(t){return r.finish(),s.close(u),n.logout(),i.path(o.resolve("login"))}),c.then(null,function(){return r.finish(),console.log("FAIL")})},u.on("click",".button-green",function(t){return t.preventDefault(),s.close(u)}),u.on("click",".button-red",r(2e3,function(t){return t.preventDefault(),l()})),p=u.find(".button-red")},{link:u,templateUrl:"user/lightbox/lightbox-delete-account.html"}},n.directive("tgLbDeleteUser",["$tgRepo","$rootScope","$tgAuth","$tgLocation","$tgNavUrls","lightboxService","$tgLoading",t])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;u=this.taiga,o=this.taiga.mixOf,a=this.taiga.sizeFormat,s=angular.module("taigaUserSettings"),i=this.taiga.debounce,n=function(t){function e(t,e,r,n,i,o,s,u,c,l,p,f,d){var h,g,m;this.scope=t,this.rootscope=e,this.config=r,this.repo=n,this.confirm=i,this.rs=o,this.params=s,this.q=u,this.location=c,this.navUrls=l,this.auth=p,this.translate=f,this.errorHandlingService=d,this.scope.sectionName="USER_SETTINGS.MENU.SECTION_TITLE",this.scope.project={},this.scope.user=this.auth.getUser(),this.scope.user||this.errorHandlingService.permissionDenied(),this.scope.lang=this.getLan(),this.scope.theme=this.getTheme(),h=this.config.get("maxUploadFileSize",null),h&&(m=this.translate.instant("USER_SETTINGS.AVATAR_MAX_SIZE",{maxFileSize:a(h)}),this.scope.maxFileSizeMsg=m),g=this.loadInitialData(),g.then(null,this.onInitialDataError.bind(this))}return c(e,t),e.$inject=["$scope","$rootScope","$tgConfig","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$tgAuth","$translate","tgErrorHandlingService"],e.prototype.loadInitialData=function(){return this.scope.availableThemes=this.config.get("themes",[]),this.rs.locales.list().then(function(t){return function(e){return t.scope.locales=e,e}}(this))},e.prototype.openDeleteLightbox=function(){return this.rootscope.$broadcast("deletelightbox:new",this.scope.user)},e.prototype.getLan=function(){return this.scope.user.lang||this.translate.preferredLanguage()},e.prototype.getTheme=function(){return this.scope.user.theme||this.config.get("defaultTheme")||"taiga"},e}(o(u.Controller,u.PageMixin)),s.controller("UserSettingsController",n),r=function(t,e,r,n){var o;return o=function(o,s,a){var u;return u=i(2e3,function(i){return function(i){var a,u,c,l;if(i.preventDefault(),u=s.find("form").checksley(),u.validate())return a=o.user.isAttributeModified("email"),o.user.lang=o.lang,o.user.theme=o.theme,l=function(r){var i;return e.setUser(r),a?(i=n.instant("USER_PROFILE.CHANGE_EMAIL_SUCCESS"),t.success(i)):t.notify("success")},c=function(e){return u.setErrors(e),t.notify("error",e._error_message)},r.save(o.user).then(l,c)}}(this)),s.on("submit","form",u),o.$on("$destroy",function(){return s.off()})},{link:o}},s.directive("tgUserProfile",["$tgConfirm","$tgAuth","$tgRepo","$translate",r]),e=function(t,e,r,n){var i;return i=function(i,o,s){var a,u,c;return c=function(){return o.find(".size-info").removeClass("hidden")},u=function(r){var s;return s=e.make_model("users",r.data),t.setUser(s),i.user=s,o.find(".loading-overlay").removeClass("active"),n.notify("success")},a=function(t){return 413===t.status&&c(),o.find(".loading-overlay").removeClass("active"),n.notify("error",t.data._error_message)},o.on("click",".js-change-avatar",function(){return o.find("#avatar-field").click()}),o.on("change","#avatar-field",function(t){if(i.avatarAttachment)return o.find(".loading-overlay").addClass("active"),r.userSettings.changeAvatar(i.avatarAttachment).then(u,a)}),o.on("click","a.js-use-gravatar",function(t){return o.find(".loading-overlay").addClass("active"),r.userSettings.removeAvatar().then(u,a)}),i.$on("$destroy",function(){return o.off()})},{link:i}},s.directive("tgUserAvatar",["$tgAuth","$tgModel","$tgResources","$tgConfirm",e]),t=function(t){var e;return e=function(e,r,n){var i,o;return i=t(n.tgAvatarModel),o=i.assign,r.bind("change",function(){return e.$apply(function(){return o(e,r[0].files[0])})})},{link:e}},s.directive("tgAvatarModel",["$parse",t])}.call(this),function(){var t,e;t=function(){var t;return t=function(t,e,r){var n;return n=r.tgUserSettingsNavigation,e.find(".active").removeClass("active"),e.find("#usersettingsmenu-"+n+" a").addClass("active"),t.$on("$destroy",function(){return e.off()})},{link:t}},e=angular.module("taigaUserSettings"),e.directive("tgUserSettingsNavigation",t)}.call(this),function(){var t,e,r,n,i,o,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=this.taiga,i=this.taiga.mixOf,n=this.taiga.bindOnce,o=angular.module("taigaUserSettings"),t=function(t){function e(t,e,r,n,i,o,s,a,u,c,l){var p;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=o,this.q=s,this.location=a,this.navUrls=u,this.auth=c,this.errorHandlingService=l,this.scope.sectionName="USER_SETTINGS.NOTIFICATIONS.SECTION_NAME",this.scope.user=this.auth.getUser(),p=this.loadInitialData(),p.then(null,this.onInitialDataError.bind(this))}return a(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$tgAuth","tgErrorHandlingService"],e.prototype.loadInitialData=function(){return this.rs.notifyPolicies.list().then(function(t){return function(e){return t.scope.notifyPolicies=e,e}}(this))},e}(i(s.Controller,s.PageMixin)),o.controller("UserNotificationsController",t),e=function(){var t;return t=function(t,e,r){return t.$on("$destroy",function(){return e.off()})},{link:t}},o.directive("tgUserNotifications",e),r=function(t,e,r){var i,o;return o=_.template('<% _.each(notifyPolicies, function (notifyPolicy, index) { %>\n\n
<%- notifyPolicy.project_name %>
\n
\n
\n \n
\n
\n \n
\n
\n \n
\n<% }) %>'),i=function(i,s,a){var u;return u=function(){var n,a;return s.off(),n={notifyPolicies:i.notifyPolicies},a=o(n),s.html(r(a)(i)),s.on("change","input[type=radio]",function(r){var n,o,s,a,u,c;return c=angular.element(r.currentTarget),a=c.parents(".policy-table-row").data("index"),s=i.notifyPolicies[a],u=s.notify_level,s.notify_level=parseInt(c.val(),10),o=function(){return e.notify("success")},n=function(){return e.notify("error"),c.parents(".policy-table-row").find("input[value="+u+"]").prop("checked",!0)},t.save(s).then(o,n)})},i.$on("$destroy",function(){return s.off()}),n(i,a.ngModel,u)},{link:i}},o.directive("tgUserNotificationsList",["$tgRepo","$tgConfirm","$compile",r])}.call(this),function(){angular.module("taigaComponents",[])}.call(this),function(){var t;t=angular.module("taigaDiscover",[])}.call(this),function(){var t;t=angular.module("taigaExternalApps",[])}.call(this),function(){angular.module("taigaHistory",[])}.call(this),function(){var t;t=angular.module("taigaHome",[])}.call(this),function(){angular.module("taigaNavigationBar",[])}.call(this),function(){var t;t=angular.module("taigaProfile",[])}.call(this),function(){angular.module("taigaProjects",[])}.call(this),function(){angular.module("taigaResources2",[])}.call(this),function(){angular.module("taigaUserTimeline",[])}.call(this),function(){var t;t=angular.module("taigaUtils",[])}.call(this),function(){angular.module("taigaWikiHistory",[])}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r){},{templateUrl:"components/assigned-to/assigned-item/assigned-item.html",scope:{member:"="},link:t}},t.$inject=[],angular.module("taigaComponents").directive("tgAssignedItem",t)}.call(this),function(){var t;t=function(){function t(){this.assigned&&this._getAssignedMember(),this._filterAssignedMember()}return t.$inject=[],t.prototype._getAssignedMember=function(){return this.assignedMember=_.filter(this.project.members,function(t){return function(e){return e.id===t.assigned.get("id")}}(this))},t.prototype._filterAssignedMember=function(){return this.assigned?this.nonAssignedMembers=_.filter(this.project.members,function(t){return function(e){return e.id!==t.assigned.get("id")}}(this)):this.nonAssignedMembers=this.project.members},t}(),angular.module("taigaComponents").controller("AssignedToSelectorCtrl",t)}.call(this),function(){var t;t=function(){return{controller:"AssignedToSelectorCtrl",controllerAs:"vm",bindToController:!0,templateUrl:"components/assigned-to/assigned-to-selector/assigned-to-selector.html",
scope:{assigned:"=",project:"=",onRemoveAssigned:"&",onAssignTo:"&"}}},t.$inject=[],angular.module("taigaComponents").directive("tgAssignedToSelector",t)}.call(this),function(){var t;t=function(){function t(t,e){this.lightboxFactory=t,this.lightboxService=e,this.has_permissions=_.includes(this.project.my_permissions,"modify_epic")}return t.$inject=["tgLightboxFactory","lightboxService"],t.prototype._closeAndRemoveAssigned=function(){return this.lightboxService.closeAll(),this.onRemoveAssigned()},t.prototype._closeAndAssign=function(t){return this.lightboxService.closeAll(),this.onAssignTo({member:t})},t.prototype.onSelectAssignedTo=function(t,e){return this.lightboxFactory.create("tg-assigned-to-selector",{"class":"lightbox lightbox-assigned-to-selector open",assigned:"assigned",project:"project","on-remove-assigned":"onRemoveAssigned()","on-assign-to":"assignTo(member)"},{assigned:this.assignedTo,project:this.project,onRemoveAssigned:this._closeAndRemoveAssigned.bind(this),assignTo:this._closeAndAssign.bind(this)})},t}(),angular.module("taigaComponents").controller("AssignedToCtrl",t)}.call(this),function(){var t;t=function(){return{controller:"AssignedToCtrl",controllerAs:"vm",bindToController:!0,templateUrl:"components/assigned-to/assigned-to.html",scope:{assignedTo:"=",project:"=",onRemoveAssigned:"&",onAssignTo:"&"}}},t.$inject=[],angular.module("taigaComponents").directive("tgAssignedToComponent",t)}.call(this),function(){var t;t=function(t,e,r){var n;return n=function(n,i,o){var s;return s=t(o.tgAttachmentLink)(n),i.on("click",function(t){return taiga.isImage(s.getIn(["file","name"]))?(t.preventDefault(),n.$apply(function(){return r.open($("tg-attachments-preview")),e.fileId=s.getIn(["file","id"])})):taiga.isPdf(s.getIn(["file","name"]))?(t.preventDefault(),window.open(s.getIn(["file","url"]))):void 0}),n.$on("$destroy",function(){return i.off()})},{link:n}},t.$inject=["$parse","tgAttachmentsPreviewService","lightboxService"],angular.module("taigaComponents").directive("tgAttachmentLink",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){},{scope:{},bindToController:{attachment:"=",onDelete:"&",onUpdate:"&",type:"="},controller:"Attachment",controllerAs:"vm",templateUrl:"components/attachment/attachment-gallery.html",link:t}},t.$inject=[],angular.module("taigaComponents").directive("tgAttachmentGallery",t)}.call(this),function(){var t;t=function(){function t(t,e){this.attachmentsService=t,this.translate=e,this.form={},this.form.description=this.attachment.getIn(["file","description"]),this.form.is_deprecated=this.attachment.get(["file","is_deprecated"]),this.title=this.translate.instant("ATTACHMENT.TITLE",{fileName:this.attachment.get("name"),date:moment(this.attachment.get("created_date")).format(this.translate.instant("ATTACHMENT.DATE"))})}return t.$inject=["tgAttachmentsService","$translate"],t.prototype.editMode=function(t){var e;return e=this.attachment.set("editable",t),this.onUpdate({attachment:e})},t.prototype["delete"]=function(){return this.onDelete({attachment:this.attachment})},t.prototype.save=function(){var t;return t=this.attachment.set("loading",!0),this.onUpdate({attachment:t}),t=this.attachment.merge({editable:!1,loading:!1}),t=t.mergeIn(["file"],{description:this.form.description,is_deprecated:!!this.form.is_deprecated}),this.onUpdate({attachment:t})},t}(),angular.module("taigaComponents").controller("Attachment",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){},{scope:{},bindToController:{attachment:"=",onDelete:"&",onUpdate:"&",type:"="},controller:"Attachment",controllerAs:"vm",templateUrl:"components/attachment/attachment.html",link:t}},t.$inject=[],angular.module("taigaComponents").directive("tgAttachment",t)}.call(this),function(){var t;t=function(t){var e;return e=function(e,r,n){var i;return i=t(n.tgAttachmentsDrop),r.on("dragover",function(t){return t.preventDefault(),!1}),r.on("drop",function(t){var r;return t.stopPropagation(),t.preventDefault(),r=t.dataTransfer||t.originalEvent&&t.originalEvent.dataTransfer,e.$apply(function(){return i(e,{files:r.files})})}),e.$on("$destroy",function(){return r.off()})},{link:e}},t.$inject=["$parse"],angular.module("taigaComponents").directive("tgAttachmentsDrop",t)}.call(this),function(){var t,e;e=this.taiga.sizeFormat,t=function(){function t(t,r,n,i,o,s,a){this.translate=t,this.confirm=r,this.config=n,this.storage=i,this.attachmentsFullService=o,this.projectService=s,this.attachmentsPreviewService=a,this.mode=this.storage.get("attachment-mode","list"),this.maxFileSize=this.config.get("maxUploadFileSize",null),this.maxFileSize&&(this.maxFileSize=e(this.maxFileSize)),this.maxFileSizeMsg=this.maxFileSize?this.translate.instant("ATTACHMENT.MAX_UPLOAD_SIZE",{maxFileSize:this.maxFileSize}):"",taiga.defineImmutableProperty(this,"attachments",function(t){return function(){return t.attachmentsFullService.attachments}}(this)),taiga.defineImmutableProperty(this,"deprecatedsCount",function(t){return function(){return t.attachmentsFullService.deprecatedsCount}}(this)),taiga.defineImmutableProperty(this,"attachmentsVisible",function(t){return function(){return t.attachmentsFullService.attachmentsVisible}}(this)),taiga.defineImmutableProperty(this,"deprecatedsVisible",function(t){return function(){return t.attachmentsFullService.deprecatedsVisible}}(this))}return t.$inject=["$translate","$tgConfirm","$tgConfig","$tgStorage","tgAttachmentsFullService","tgProjectService","tgAttachmentsPreviewService"],t.prototype.uploadingAttachments=function(){return this.attachmentsFullService.uploadingAttachments},t.prototype.addAttachment=function(t){var e;return e="list"===this.mode,this.attachmentsFullService.addAttachment(this.projectId,this.objId,this.type,t,e)},t.prototype.setMode=function(t){return this.mode=t,this.storage.set("attachment-mode",t)},t.prototype.toggleDeprecatedsVisible=function(){return this.attachmentsFullService.toggleDeprecatedsVisible()},t.prototype.addAttachments=function(t){return _.forEach(t,function(t){return function(e){return t.addAttachment(e)}}(this))},t.prototype.loadAttachments=function(){return this.attachmentsFullService.loadAttachments(this.type,this.objId,this.projectId)},t.prototype.deleteAttachment=function(t){var e,r;return this.attachmentsPreviewService.fileId=null,r=this.translate.instant("ATTACHMENT.TITLE_LIGHTBOX_DELETE_ATTACHMENT"),e=this.translate.instant("ATTACHMENT.MSG_LIGHTBOX_DELETE_ATTACHMENT",{fileName:t.getIn(["file","name"])}),this.confirm.askOnDelete(r,e).then(function(r){return function(n){var i,o;return i=function(){return e=r.translate.instant("ATTACHMENT.ERROR_DELETE_ATTACHMENT",{errorMessage:e}),r.confirm.notify("error",null,e),n.finish(!1)},o=function(){return n.finish()},r.attachmentsFullService.deleteAttachment(t,r.type).then(o,i)}}(this))},t.prototype.reorderAttachment=function(t,e){return this.attachmentsFullService.reorderAttachment(this.type,t,e)},t.prototype.updateAttachment=function(t){return this.attachmentsFullService.updateAttachment(t,this.type)},t.prototype._isEditable=function(){return!!this.projectService.project&&this.projectService.hasPermission(this.editPermission)},t.prototype.showAttachments=function(){return this._isEditable()||this.attachmentsFullService.attachments.size},t}(),angular.module("taigaComponents").controller("AttachmentsFull",t)}.call(this),function(){var t,e;e=this.taiga.bindOnce,t=function(){var t;return t=function(t,r,n,i){return e(t,"vm.objId",function(t){return i.loadAttachments()})},{scope:{},bindToController:{type:"@",objId:"=",projectId:"=",editPermission:"@"},controller:"AttachmentsFull",controllerAs:"vm",templateUrl:"components/attachments-full/attachments-full.html",link:t}},t.$inject=[],angular.module("taigaComponents").directive("tgAttachmentsFull",t)}.call(this),function(){var t,e=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function r(t,e){this.attachmentsService=t,this.rootScope=e,this._attachments=Immutable.List(),this._deprecatedsCount=0,this._attachmentsVisible=Immutable.List(),this._deprecatedsVisible=!1,this.uploadingAttachments=[],taiga.defineImmutableProperty(this,"attachments",function(t){return function(){return t._attachments}}(this)),taiga.defineImmutableProperty(this,"deprecatedsCount",function(t){return function(){return t._deprecatedsCount}}(this)),taiga.defineImmutableProperty(this,"attachmentsVisible",function(t){return function(){return t._attachmentsVisible}}(this)),taiga.defineImmutableProperty(this,"deprecatedsVisible",function(t){return function(){return t._deprecatedsVisible}}(this))}return e(r,t),r.$inject=["tgAttachmentsService","$rootScope"],r.prototype.toggleDeprecatedsVisible=function(){return this._deprecatedsVisible=!this._deprecatedsVisible,this.regenerate()},r.prototype.regenerate=function(){return this._deprecatedsCount=this._attachments.count(function(t){return t.getIn(["file","is_deprecated"])}),this._deprecatedsVisible?this._attachmentsVisible=this._attachments:this._attachmentsVisible=this._attachments.filter(function(t){return!t.getIn(["file","is_deprecated"])})},r.prototype.addAttachment=function(t,e,r,n,i){return null==i&&(i=!0),new Promise(function(o){return function(s,a){var u;return o.attachmentsService.validate(n)?(o.uploadingAttachments.push(n),u=o.attachmentsService.upload(n,e,t,r),u.then(function(t){var e;return o.uploadingAttachments=o.uploadingAttachments.filter(function(e){return e.name!==t.get("name")}),e=Immutable.Map(),e=e.merge({file:t,editable:i,loading:!1}),o._attachments=o._attachments.push(e),o.regenerate(),o.rootScope.$broadcast("attachment:create"),s(e)})):a(new Error(n))}}(this))},r.prototype.loadAttachments=function(t,e,r){return this.attachmentsService.list(t,e,r).then(function(t){return function(e){return t._attachments=e.map(function(t){var e;return e=Immutable.Map(),e.merge({loading:!1,editable:!1,file:t})}),t.regenerate()}}(this))},r.prototype.deleteAttachment=function(t,e){var r;return r=function(e){return function(){return e._attachments=e._attachments.filter(function(e){return e!==t}),e.regenerate()}}(this),this.attachmentsService["delete"](e,t.getIn(["file","id"])).then(r)},r.prototype.reorderAttachment=function(t,e,r){var n,i,o;if(i=this.attachments.findIndex(function(t){return t===e}),i!==r)return n=this.attachments.remove(i),n=n.splice(r,0,e),n=n.map(function(t,e){return t.setIn(["file","order"],e+1)}),o=[],n.forEach(function(e){return function(r){var n;return n={order:r.getIn(["file","order"])},o.push(e.attachmentsService.patch(r.getIn(["file","id"]),t,n))}}(this)),Promise.all(o).then(function(t){return function(){return t._attachments=n,t.regenerate()}}(this))},r.prototype.updateAttachment=function(t,e){var r,n,i;return r=this._attachments.findIndex(function(e){return e.getIn(["file","id"])===t.getIn(["file","id"])}),n=this._attachments.get(r),i=taiga.patch(n.get("file"),t.get("file")),t.get("loading")?(this._attachments=this._attachments.set(r,t),this.regenerate()):this.attachmentsService.patch(t.getIn(["file","id"]),e,i).then(function(e){return function(){return e._attachments=e._attachments.set(r,t),e.regenerate()}}(this))},r}(taiga.Service),angular.module("taigaComponents").service("tgAttachmentsFullService",t)}.call(this),function(){var t;t=function(){function t(t){this.attachmentsPreviewService=t,taiga.defineImmutableProperty(this,"current",function(t){return function(){return t.attachmentsPreviewService.fileId?t.getCurrent():null}}(this))}return t.$inject=["tgAttachmentsPreviewService"],t.prototype.hasPagination=function(){var t;return t=this.attachments.filter(function(t){return function(t){return taiga.isImage(t.getIn(["file","name"]))}}(this)),t.size>1},t.prototype.getCurrent=function(){var t,e;return t=this.attachments.find(function(t){return function(e){return t.attachmentsPreviewService.fileId===e.getIn(["file","id"])}}(this)),e=t.get("file")},t.prototype.getIndex=function(){return this.attachments.findIndex(function(t){return function(e){return t.attachmentsPreviewService.fileId===e.getIn(["file","id"])}}(this))},t.prototype.next=function(){var t,e;return t=this.getIndex(),e=this.attachments.slice(t+1).find(function(t){return taiga.isImage(t.getIn(["file","name"]))}),e||(e=this.attachments.find(function(t){return taiga.isImage(t.getIn(["file","name"]))})),this.attachmentsPreviewService.fileId=e.getIn(["file","id"])},t.prototype.previous=function(){var t,e;return t=this.getIndex(),e=this.attachments.slice(0,t).findLast(function(t){return taiga.isImage(t.getIn(["file","name"]))}),e||(e=this.attachments.findLast(function(t){return taiga.isImage(t.getIn(["file","name"]))})),this.attachmentsPreviewService.fileId=e.getIn(["file","id"])},t}(),angular.module("taigaComponents").controller("AttachmentsPreview",t)}.call(this),function(){var t;t=function(t,e){var r;return r=function(t,r,n,i){return $(document.body).on("keydown.image-preview",function(r){return e.fileId&&(39===r.keyCode?i.next():37===r.keyCode&&i.previous()),t.$digest()}),t.$on("$destroy",function(){return $(document.body).off(".image-preview")})},{scope:{},controller:"AttachmentsPreview",templateUrl:"components/attachments-preview/attachments-preview.html",link:r,controllerAs:"vm",bindToController:{attachments:"="}}},angular.module("taigaComponents").directive("tgAttachmentsPreview",["lightboxService","tgAttachmentsPreviewService",t])}.call(this),function(){var t,e=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function r(){}return e(r,t),r.$inject=[],r}(taiga.Service),angular.module("taigaComponents").service("tgAttachmentsPreviewService",t)}.call(this),function(){var t;t=function(){function t(t){this.attachmentsService=t}return t.$inject=["tgAttachmentsService"],t.prototype.addAttachment=function(t){var e;if(e=Immutable.fromJS({file:t,name:t.name,size:t.size}),this.attachmentsService.validate(t)&&(this.attachments=this.attachments.push(e),this.onAdd))return this.onAdd({attachment:e})},t.prototype.addAttachments=function(t){return _.forEach(t,this.addAttachment.bind(this))},t.prototype.deleteAttachment=function(t){if(this.attachments=this.attachments.filter(function(e){return e!==t}),this.onDelete)return this.onDelete({attachment:t})},t}(),angular.module("taigaComponents").controller("AttachmentsSimple",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){},{scope:{},bindToController:{attachments:"=",onAdd:"&",onDelete:"&"},controller:"AttachmentsSimple",controllerAs:"vm",templateUrl:"components/attachments-simple/attachments-simple.html",link:t}},t.$inject=[],angular.module("taigaComponents").directive("tgAttachmentsSimple",t)}.call(this),function(){var t;t=function(t){var e;return e=function(e,r,n){var i,o,s;return i=t(n.tgAttachmentsSortable),o=dragula([r[0]],{copySortSource:!1,copy:!1,mirrorContainer:r[0],moves:function(t){return $(t).is("div[tg-bind-scope]")}}),o.on("dragend",function(t){var r,n;return t=$(t),r=t.scope().attachment,n=t.index(),e.$apply(function(){return i(e,{attachment:r,index:n})})}),s=autoScroll(window,{margin:20,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&o.dragging}}),e.$on("$destroy",function(){return r.off(),o.destroy()})},{link:e}},t.$inject=["$parse"],angular.module("taigaComponents").directive("tgAttachmentsSortable",t)}.call(this),function(){var t;t=function(t){return{link:function(e,r){return t(function(){return r[0].select()})}}},t.$inject=["$timeout"],angular.module("taigaComponents").directive("tgAutoSelect",t)}.call(this),function(){var t;t=function(t){var e;return e=function(e,r,n){var i;return i=n.tgAvatarBig?"avatarBig":"avatar",e.$watch(i,function(e){var n;if(n=t.getAvatar(e,i),r.attr("src",n.url),n.bg)return r.css("background",n.bg)})},{link:e,scope:{avatar:"=tgAvatar",avatarBig:"=tgAvatarBig"}}},t.$inject=["tgAvatarService"],angular.module("taigaComponents").directive("tgAvatar",t),angular.module("taigaComponents").directive("tgAvatarBig",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(){var t,e;return t=function(t,e,r){return t.$watch("epics",function(e){if(e&&!e.isIterable)return t.epics=Immutable.fromJS(e)})},e=function(t,e){return e.format?"components/belong-to-epics/belong-to-epics-"+e.format+".html":"components/belong-to-epics/belong-to-epics-pill.html"},{link:t,scope:{epics:"="},templateUrl:e}},e.directive("tgBelongToEpics",t)}.call(this),function(){var t;t=function(){return{scope:{levels:"=",value:"="},templateUrl:"components/board-zoom/board-zoom.html"}},angular.module("taigaComponents").directive("tgBoardZoom",[t])}.call(this),function(){var t;t=function(){function t(){this.index=0}return t.$inject=[],t.prototype.next=function(){if(this.index++,this.index>=this.images.size)return this.index=0},t.prototype.previous=function(){if(this.index--,this.index<0)return this.index=this.images.size-1},t}(),angular.module("taigaComponents").controller("CardSlideshow",t)}.call(this),function(){var t,e;e=angular.module("taigaComponents"),t=function(){return{controller:"CardSlideshow",templateUrl:"components/card-slideshow/card-slideshow.html",bindToController:!0,controllerAs:"vm",scope:{images:"="}}},e.directive("tgCardSlideshow",t)}.call(this),function(){var t;t=function(){function t(){}return t.$inject=[],t.prototype.visible=function(t){return this.zoom.indexOf(t)!==-1},t.prototype.toggleFold=function(){return this.onToggleFold({id:this.item.get("id")})},t.prototype.getClosedTasks=function(){return this.item.getIn(["model","tasks"]).filter(function(t){return t.get("is_closed")})},t.prototype.closedTasksPercent=function(){return 100*this.getClosedTasks().size/this.item.getIn(["model","tasks"]).size},t.prototype.getPermissionsKey=function(){return"task"===this.type?"modify_task":"modify_us"},t.prototype._setVisibility=function(){var t;return t={related:this.visible("related_tasks"),slides:this.visible("attachments")},_.isUndefined(this.item.get("foldStatusChanged"))||(this.visible("related_tasks")&&this.visible("attachments")?(t.related=!this.item.get("foldStatusChanged"),t.slides=!this.item.get("foldStatusChanged")):this.visible("attachments")?(t.related=this.item.get("foldStatusChanged"),t.slides=this.item.get("foldStatusChanged")):this.visible("related_tasks")||this.visible("attachments")||(t.related=this.item.get("foldStatusChanged"),t.slides=this.item.get("foldStatusChanged"))),this.item.getIn(["model","tasks"])&&this.item.getIn(["model","tasks"]).size||(t.related=!1),this.item.get("images")&&this.item.get("images").size||(t.slides=!1),t},t.prototype.isRelatedTasksVisible=function(){var t;return t=this._setVisibility(),t.related},t.prototype.isSlideshowVisible=function(){var t;return t=this._setVisibility(),t.slides},t.prototype.getNavKey=function(){return"task"===this.type?"project-tasks-detail":"project-userstories-detail"},t}(),angular.module("taigaComponents").controller("Card",t)}.call(this),function(){var t,e;e=angular.module("taigaComponents"),t=function(){return{link:function(t){},controller:"Card",controllerAs:"vm",bindToController:!0,templateUrl:"components/card/card.html",scope:{onToggleFold:"&",onClickAssignedTo:"&",onClickEdit:"&",project:"=",item:"=",zoom:"=",zoomLevel:"=",archived:"=",type:"@"}}},e.directive("tgCard",t)}.call(this),function(){var t,e,r;r=this.taiga,e=r.getDefaulColorList,t=function(){function t(t){this.projectService=t,this.colorList=e(),this.checkIsColorRequired(),this.displayColorList=!1}return t.$inject=["tgProjectService"],t.prototype.userCanChangeColor=function(){return!this.requiredPerm||this.projectService.hasPermission(this.requiredPerm)},t.prototype.checkIsColorRequired=function(){if(!this.isColorRequired)return this.colorList=_.dropRight(this.colorList)},t.prototype.setColor=function(t){return this.color=this.initColor},t.prototype.resetColor=function(){if(this.isColorRequired&&!this.color)return this.color=this.initColor},t.prototype.toggleColorList=function(){return this.displayColorList=!this.displayColorList,this.resetColor()},t.prototype.onSelectDropdownColor=function(t){return this.color=t,this.onSelectColor({color:t}),this.toggleColorList()},t.prototype.onKeyDown=function(t){if(13===t.which)return!this.color&&this.isColorRequired||this.onSelectDropdownColor(this.color),t.preventDefault()},t}(),angular.module("taigaComponents").controller("ColorSelectorCtrl",t)}.call(this),function(){var t,e;e=this.taiga.bindOnce,t=function(t){var e;return e=function(e,r,n,i){var o,s,a;return o=null,s=function(){return t.cancel(o),o=null},a=function(){if(!o)return o=t(function(){return i.displayColorList=!1,i.resetColor()},400)},r.find(".color-selector").mouseenter(s).mouseleave(a),r.find(".color-selector-dropdown").mouseenter(s).mouseleave(a),e.$watch("vm.initColor",function(t){return i.setColor(t)})},{link:e,templateUrl:"components/color-selector/color-selector.html",controller:"ColorSelectorCtrl",controllerAs:"vm",bindToController:{isColorRequired:"=",onSelectColor:"&",initColor:"=",requiredPerm:"@"},scope:{}}},t.$inject=["$timeout"],angular.module("taigaComponents").directive("tgColorSelector",t)}.call(this),function(){var t,e;e=angular.module("taigaUserStories"),t=function(){function t(t,e,r,n,i){this.rootScope=t,this.confirm=e,this.modelTransform=r,this.navUrls=n,this.window=i,this.editMode=!1,this.loadingSubject=!1,this.originalSubject=this.item.subject}return t.$inject=["$rootScope","$tgConfirm","$tgQueueModelTransformation","$tgNavUrls","$window"],t.prototype._checkNav=function(){var t,e,r;if(null!=(null!=(e=this.item.neighbors.previous)?e.ref:void 0)&&(t={project:this.project.slug,ref:this.item.neighbors.previous.ref},this.previousUrl=this.navUrls.resolve("project-"+this.item._name+"-detail",t)),null!=(null!=(r=this.item.neighbors.next)?r.ref:void 0))return t={project:this.project.slug,ref:this.item.neighbors.next.ref},this.nextUrl=this.navUrls.resolve("project-"+this.item._name+"-detail",t)},t.prototype._checkPermissions=function(){return this.permissions={canEdit:_.includes(this.project.my_permissions,this.requiredPerm)}},t.prototype.editSubject=function(t){var e;if(e=this.window.getSelection(),"Range"!==e.type&&(t&&(this.editMode=!0),!t))return this.editMode=!1},t.prototype.onKeyDown=function(t){if(13===t.which&&this.saveSubject(),27===t.which)return this.item.subject=this.originalSubject,this.editSubject(!1)},t.prototype.saveSubject=function(){var t,e,r,n;return r=function(t){return function(){return t.loadingSubject=!1,t.rootScope.$broadcast("object:updated"),t.confirm.notify("success"),t.originalSubject=t.item.subject}}(this),e=function(t){return function(){return t.loadingSubject=!1,t.confirm.notify("error")}}(this),this.editMode=!1,this.loadingSubject=!0,t=this.item,n=this.modelTransform.save(function(t){return t}),n.then(r,e)},t}(),e.controller("StoryHeaderCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaUserStories"),t=function(){var t;return this.$inject=[],t=function(t,e,r,n){return n._checkPermissions(),n._checkNav()},{link:t,controller:"StoryHeaderCtrl",bindToController:!0,scope:{item:"=",project:"=",requiredPerm:"@"},controllerAs:"vm",templateUrl:"components/detail/header/detail-header.html"}},e.directive("tgDetailHeader",t)}.call(this),function(){var t;t=function(t){var e;return e=function(e,r,n,i){var o;return o=t(n.tgFileChange),r.on("change",function(t){return e.$apply(function(){return o(e,{files:t.currentTarget.files})})}),e.$on("$destroy",function(){return r.off()})},{require:"ngModel",restrict:"A",link:e}},t.$inject=["$parse"],angular.module("taigaComponents").directive("tgFileChange",t)}.call(this),function(){var t,e,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;e=taiga.generateHash,t=function(t){function n(t,e,r){this.q=t,this.urls=e,this.http=r}return r(n,t),n.$inject=["$q","$tgUrls","$tgHttp"],n.prototype.storeFilters=function(t,r,n){var i,o,s,a,u;return i=this.q.defer(),u=this.urls.resolve("user-storage"),s=t+":"+n,o=e([t,s]),_.isEmpty(r)?(a=this.http["delete"](u+"/"+o,{key:o,value:r}),a.then(function(){return i.resolve()}),a.then(null,function(){return i.reject()})):(a=this.http.put(u+"/"+o,{key:o,value:r}),a.then(function(t){return i.resolve()}),a.then(null,function(t){return function(e){var n;return n=t.http.post(""+u,{key:o,value:r}),n.then(function(){return i.resolve()}),n.then(null,function(){return i.reject()})}}(this))),i.promise},n.prototype.getFilters=function(t,r){var n,i,o,s,a;return n=this.q.defer(),a=this.urls.resolve("user-storage"),o=t+":"+r,i=e([t,o]),s=this.http.get(a+"/"+i),s.then(function(t){return n.resolve(t.data.value)}),s.then(null,function(t){return n.resolve({})}),n.promise},n}(taiga.Service),angular.module("taigaComponents").service("tgFilterRemoteStorageService",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){var i;return i=$("tg-filter"),t.$watch(r.ngIf,function(t){var r,n;if(t)return i.find(".filter-list").hide(),n=i.height(),r=0,i.children().each(function(){return r+=$(this).outerHeight(!0)}),$(e.context.nextSibling).css({"max-height":n-r,display:"block"})})},{priority:900,link:t}},angular.module("taigaComponents").directive("tgFilterSlideDown",[t])}.call(this),function(){var t;t=function(){function t(){this.opened=null,this.customFilterForm=!1,this.customFilterName=""}return t.$inject=[],t.prototype.toggleFilterCategory=function(t){return this.opened===t?this.opened=null:this.opened=t},t.prototype.isOpen=function(t){return this.opened===t},t.prototype.saveCustomFilter=function(){return this.onSaveCustomFilter({name:this.customFilterName}),this.customFilterForm=!1,this.opened="custom-filter",this.customFilterName=""},t.prototype.changeQ=function(){return this.onChangeQ({q:this.q})},t.prototype.unselectFilter=function(t){return this.onRemoveFilter({filter:t})},t.prototype.unselectFilter=function(t){return this.onRemoveFilter({filter:t})},t.prototype.selectFilter=function(t,e){return e={category:t,filter:e},this.onAddFilter({filter:e})},t.prototype.removeCustomFilter=function(t){return this.onRemoveCustomFilter({filter:t})},t.prototype.selectCustomFilter=function(t){return this.onSelectCustomFilter({filter:t})},t.prototype.isFilterSelected=function(t,e){return!!_.find(this.selectedFilters,function(r){return e.id===r.id&&t.dataType===r.dataType})},t}(),angular.module("taigaComponents").controller("Filter",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){},{scope:{onChangeQ:"&",onAddFilter:"&",onSelectCustomFilter:"&",onRemoveFilter:"&",onRemoveCustomFilter:"&",onSaveCustomFilter:"&",customFilters:"<",q:"<",filters:"<",customFilters:"<",selectedFilters:"<"},bindToController:!0,controller:"Filter",controllerAs:"vm",templateUrl:"components/filter/filter.html",link:t}},angular.module("taigaComponents").directive("tgFilter",[t])}.call(this),function(){var t,e;e=this.taiga,t=function(t,e,r,n,i){var o;return o=function(n,o,s,a){var u,c,l;return l=null,c=introJs(),c.oncomplete(function(){return $("html,body").scrollTop(0)}),c.onexit(function(){return e.disableJoyRide()}),u=function(t,e){if(e[t.joyride])return c.setOptions({exitOnEsc:!1,exitOnOverlayClick:!1,showStepNumbers:!1,nextLabel:i.instant("JOYRIDE.NAV.NEXT")+" →",prevLabel:"← "+i.instant("JOYRIDE.NAV.BACK"),skipLabel:i.instant("JOYRIDE.NAV.SKIP"),doneLabel:i.instant("JOYRIDE.NAV.DONE"),disableInteraction:!0}),c.setOption("steps",r.get(t.joyride)),c.start()},t.$on("$routeChangeSuccess",function(r,n){return n.joyride&&e.isAuthenticated()?(c.oncomplete(function(){return e.disableJoyRide(n.joyride)}),n.loader?l=t.$on("loader:end",function(){return e.loadJoyRideConfig().then(function(t){return u(n,t)}),l()}):e.loadJoyRideConfig().then(function(t){return u(n,t)})):(c.exit(),void(l&&l()))})},{scope:{},link:o}},t.$inject=["$rootScope","tgCurrentUserService","tgJoyRideService","$location","$translate"],angular.module("taigaComponents").directive("tgJoyRide",t)}.call(this),function(){var t,e=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function r(t,e){this.translate=t,this.checkPermissionsService=e}return e(r,t),r.$inject=["$translate","tgCheckPermissionsService"],r.prototype.getConfig=function(){return{dashboard:function(t){return function(){var e;return e=[{element:".project-list > section:not(.ng-hide)",position:"left",joyride:{title:t.translate.instant("JOYRIDE.DASHBOARD.STEP1.TITLE"),text:t.translate.instant("JOYRIDE.DASHBOARD.STEP1.TEXT")}},{element:".working-on-container",position:"right",joyride:{title:t.translate.instant("JOYRIDE.DASHBOARD.STEP2.TITLE"),text:t.translate.instant("JOYRIDE.DASHBOARD.STEP2.TEXT")}},{element:".watching-container",position:"right",joyride:{title:t.translate.instant("JOYRIDE.DASHBOARD.STEP3.TITLE"),text:[t.translate.instant("JOYRIDE.DASHBOARD.STEP3.TEXT1"),t.translate.instant("JOYRIDE.DASHBOARD.STEP3.TEXT2")]}}],$(".project-list .create-project-button").is(":hidden")||e.push({element:".project-list .create-project-button",position:"bottom",joyride:{title:t.translate.instant("JOYRIDE.DASHBOARD.STEP4.TITLE"),text:[t.translate.instant("JOYRIDE.DASHBOARD.STEP4.TEXT1"),t.translate.instant("JOYRIDE.DASHBOARD.STEP4.TEXT2")]}}),e}}(this),backlog:function(t){return function(){var e;return e=[{element:".summary",position:"bottom",joyride:{title:t.translate.instant("JOYRIDE.BACKLOG.STEP1.TITLE"),text:[t.translate.instant("JOYRIDE.BACKLOG.STEP1.TEXT1"),t.translate.instant("JOYRIDE.BACKLOG.STEP1.TEXT2")]}},{element:".backlog-table-empty",position:"bottom",joyride:{title:t.translate.instant("JOYRIDE.BACKLOG.STEP2.TITLE"),text:t.translate.instant("JOYRIDE.BACKLOG.STEP2.TEXT")}},{element:".sprints",position:"left",joyride:{title:t.translate.instant("JOYRIDE.BACKLOG.STEP3.TITLE"),text:t.translate.instant("JOYRIDE.BACKLOG.STEP3.TEXT")}}],t.checkPermissionsService.check("add_us")&&e.push({element:".new-us",position:"rigth",joyride:{title:t.translate.instant("JOYRIDE.BACKLOG.STEP4.TITLE"),text:t.translate.instant("JOYRIDE.BACKLOG.STEP4.TEXT")}}),e}}(this),kanban:function(t){return function(){var e;return e=[{element:".kanban-table-inner",position:"bottom",joyride:{title:t.translate.instant("JOYRIDE.KANBAN.STEP1.TITLE"),text:t.translate.instant("JOYRIDE.KANBAN.STEP1.TEXT")}},{element:".card-placeholder",position:"right",joyride:{title:t.translate.instant("JOYRIDE.KANBAN.STEP2.TITLE"),text:t.translate.instant("JOYRIDE.KANBAN.STEP2.TEXT")}}],t.checkPermissionsService.check("add_us")&&e.push({element:".add-action",position:"bottom",joyride:{title:t.translate.instant("JOYRIDE.KANBAN.STEP3.TITLE"),text:[t.translate.instant("JOYRIDE.KANBAN.STEP3.TEXT1"),t.translate.instant("JOYRIDE.KANBAN.STEP3.TEXT2")]}}),e}}(this)}},r.prototype.get=function(t){var e,r;return r=this.getConfig(),e=r[t].call(this),_.map(e,function(t){var e;return e="",t.joyride.title&&(e+=""+t.joyride.title+"
"),_.isArray(t.joyride.text)?_.forEach(t.joyride.text,function(t){return e+=""+t+"
"}):e+=""+t.joyride.text+"
",t.intro=e,t})},r}(taiga.Service),angular.module("taigaComponents").service("tgJoyRideService",t)}.call(this),function(){var t;t=function(t,e){var r;return r=function(r,n,i,o){var s,a,u;return r.zoomIndex=t.get("kanban_zoom")||2,r.levels=5,u=[["ref"],["subject"],["owner","tags","extra_info","unfold"],["attachments"],["related_tasks"]],s=function(e){return null==e&&(e=0),t.get("kanban_zoom")!==e&&t.set("kanban_zoom",e),_.reduce(u,function(t,r,n){return n<=e&&(t=t.concat(r)),t})},r.$watch("zoomIndex",function(t){var e;return e=s(t),r.onZoomChange({zoomLevel:t,zoom:e})}),a=r.$watch(function(){return e.project;
},function(t){if(t)return t.get("my_permissions").indexOf("view_tasks")===-1&&(r.levels=4),a()})},{scope:{onZoomChange:"&"},template:'',link:r}},angular.module("taigaComponents").directive("tgKanbanBoardZoom",["$tgStorage","tgProjectService",t])}.call(this),function(){var t;t=function(t){var e;return e=function(t,e,r){},{restrict:"AE",scope:{},controllerAs:"vm",controller:function(){return this.close=function(){return t.open=!1},Object.defineProperties(this,{open:{get:function(){return t.open}},title:{get:function(){return t.title}},desc:{get:function(){return t.desc}}})},link:e,templateUrl:"components/live-announcement/live-announcement.html"}},t.$inject=["tgLiveAnnouncementService"],angular.module("taigaComponents").directive("tgLiveAnnouncement",t)}.call(this),function(){var t,e=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function r(){this.open=!1,this.title="",this.desc=""}return e(r,t),r.prototype.show=function(t,e){return this.open=!0,this.title=t,this.desc=e},r}(taiga.Service),angular.module("taigaComponents").service("tgLiveAnnouncementService",t)}.call(this),function(){var t;t=function(t){var e;return e=function(e,r,n){return e.$watch("project",function(e){var n,i;if(e=Immutable.fromJS(e))return i=e.get("logo_big_url"),i?(r.attr("src",i),r.css("background","")):(n=t.getDefaultProjectLogo(e.get("slug"),e.get("id")),r.attr("src",n.src),r.css("background",n.color))})},{link:e,scope:{project:"=tgProjectLogoBigSrc"}}},t.$inject=["tgProjectLogoService"],angular.module("taigaComponents").directive("tgProjectLogoBigSrc",t)}.call(this),function(){var t;t=function(t){var e;return e=function(e,r,n){return e.$watch("project",function(e){var n,i;if(e=Immutable.fromJS(e))return i=e.get("logo_small_url"),i?(r.attr("src",i),r.css("background","")):(n=t.getDefaultProjectLogo(e.get("slug"),e.get("id")),r.attr("src",n.src),r.css("background",n.color))})},{link:e,scope:{project:"=tgProjectLogoSmallSrc"}}},t.$inject=["tgProjectLogoService"],angular.module("taigaComponents").directive("tgProjectLogoSmallSrc",t)}.call(this),function(){var t;t=function(){function t(t,e){this.projectService=t,this.lightboxFactory=e,this.project=null,this.menu=Immutable.Map()}return t.$inject=["tgProjectService","tgLightboxFactory"],t.prototype.show=function(){return this.project=this.projectService.project,this.active=this._getActiveSection(),this._setVideoConference(),this._setMenuPermissions()},t.prototype.hide=function(){return this.project=null,this.menu={}},t.prototype.search=function(){return this.lightboxFactory.create("tg-search-box",{"class":"lightbox lightbox-search"})},t.prototype._setVideoConference=function(){var t;if(t=this._videoConferenceUrl())return this.project=this.project.set("videoconferenceUrl",t)},t.prototype._setMenuPermissions=function(){if(this.menu=Immutable.Map({epics:!1,backlog:!1,kanban:!1,issues:!1,wiki:!1}),this.project.get("is_epics_activated")&&this.project.get("my_permissions").indexOf("view_epics")!==-1&&(this.menu=this.menu.set("epics",!0)),this.project.get("is_backlog_activated")&&this.project.get("my_permissions").indexOf("view_us")!==-1&&(this.menu=this.menu.set("backlog",!0)),this.project.get("is_kanban_activated")&&this.project.get("my_permissions").indexOf("view_us")!==-1&&(this.menu=this.menu.set("kanban",!0)),this.project.get("is_issues_activated")&&this.project.get("my_permissions").indexOf("view_issues")!==-1&&(this.menu=this.menu.set("issues",!0)),this.project.get("is_wiki_activated")&&this.project.get("my_permissions").indexOf("view_wiki_pages")!==-1)return this.menu=this.menu.set("wiki",!0)},t.prototype._getActiveSection=function(){var t,e,r,n,i;return n=this.projectService.section,i=this.projectService.sectionsBreadcrumb,t=i.lastIndexOf("backlog"),e=i.lastIndexOf("kanban"),t===-1&&e===-1||(r=e===-1||t>e?"backlog":"kanban"),"backlog-kanban"===n&&("backlog"===r||"kanban"===r?n=r:this.project.get("is_backlog_activated")&&!this.project.get("is_kanban_activated")?n="backlog":!this.project.get("is_backlog_activated")&&this.project.get("is_kanban_activated")&&(n="kanban")),n},t.prototype._videoConferenceUrl=function(){var t,e;if("appear-in"===this.project.get("videoconferences"))t="https://appear.in/";else if("talky"===this.project.get("videoconferences"))t="https://talky.io/";else{if("jitsi"!==this.project.get("videoconferences"))return"custom"===this.project.get("videoconferences")?this.project.get("videoconferences_extra_data"):"";t="https://meet.jit.si/"}return e=this.project.get("videoconferences_extra_data")?this.project.get("slug")+"-"+taiga.slugify(this.project.get("videoconferences_extra_data")):this.project.get("slug"),"jitsi"===this.project.get("videoconferences")&&(e=e.replace(/-/g,"")),t+e},t}(),angular.module("taigaComponents").controller("ProjectMenu",t)}.call(this),function(){var t,e;e=this.taiga,t=function(t,e){var r;return r=function(e,r,n,i){var o;return o=function(){return t.project?i.show():i.hide()},e.$watch(function(){return t.project},o),e.vm.fixed=!1,$(window).on("scroll",function(){var t;return t=$(window).scrollTop(),t>100&&e.vm.fixed===!1?(e.vm.fixed=!0,e.$digest()):t<100&&e.vm.fixed===!0?(e.vm.fixed=!1,e.$digest()):void 0})},{scope:{},controller:"ProjectMenu",controllerAs:"vm",templateUrl:"components/project-menu/project-menu.html",link:r}},t.$inject=["tgProjectService","tgLightboxFactory"],angular.module("taigaComponents").directive("tgProjectMenu",t)}.call(this),function(){var t,e;e=angular.module("taigaCommon"),t=function(){var t,e,r,n;return r=function(t){var e,r,n;return t.addClass("selected"),n=t.position().top+t.outerHeight(),e=t.parent().outerHeight(),n>e?(r=n-e,t.parent().scrollTop(t.parent().scrollTop()+r)):t.position().top<0?t.parent().scrollTop(t.parent().scrollTop()+t.position().top):void 0},t=function(t,e,n){var i,o,s;if(i=t.find(".selected"),40===e){if(!i.length)return r(t.find("li:first"));if(o=i.next("li"),o.length)return i.removeClass("selected"),r(o)}else if(38===e){if(!i.length)return r(t.find("li:last"));if(s=i.prev("li"),s.length)return i.removeClass("selected"),r(s)}},n=function(){return $(document).off(".tags-keyboard-navigation")},e=function(e,r){return n(),$(document).on("keydown.tags-keyboard-navigation",function(n){return function(n){var i;if(i=n.keyCode?n.keyCode:n.which,40===i||38===i)return n.preventDefault(),t(r,i,e)}}(this)),e.$on("$destroy",n)},{link:e,templateUrl:"components/tags/tag-dropdown/tag-dropdown.html",scope:{onSelectTag:"&",colorArray:"=",tag:"="}}},e.directive("tgTagsDropdown",t)}.call(this),function(){var t,e,r;r=this.taiga.trim,e=angular.module("taigaCommon"),t=function(){function t(t){this.tagLineService=t,this.disableColorSelection=!1,this.newTag={name:"",color:null},this.colorArray=[],this.addTag=!1}return t.$inject=["tgTagLineService"],t.prototype.checkPermissions=function(){return this.tagLineService.checkPermissions(this.project.my_permissions,this.permissions)},t.prototype._createColorsArray=function(t){return this.colorArray=this.tagLineService.createColorsArray(t)},t.prototype.displayTagInput=function(){return this.addTag=!0},t.prototype.addNewTag=function(t,e){if(this.newTag.name="",this.newTag.color=null,t.length)return this.disableColorSelection?t.length?this.onAddTag({name:t,color:e}):void 0:(this.project.tags_colors[t]&&(e=this.project.tags_colors[t]),this.onAddTag({name:t,color:e}))},t.prototype.selectColor=function(t){return this.newTag.color=t},t}(),e.controller("TagLineCommonCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaCommon"),t=function(){var t;return t=function(t,e,r,n){var i;return _.isUndefined(r.disableColorSelection)||(n.disableColorSelection=!0),i=t.$watch("vm.project",function(t){if(t&&Object.keys(t).length)return i(),n.disableColorSelection?void 0:n.colorArray=n._createColorsArray(n.project.tags_colors)}),e.on("keydown",".tag-input",function(r){var i;return 27===r.keyCode?(n.addTag=!1,n.newTag.name="",n.newTag.color="",r.stopPropagation()):13===r.keyCode&&(r.preventDefault(),e.find(".tags-dropdown .selected").length?(i=$(".tags-dropdown .selected .tags-dropdown-name").text(),n.addNewTag(i,null)):n.addNewTag(n.newTag.name,n.newTag.color)),t.$apply()})},{link:t,scope:{permissions:"@",loadingAddTag:"=",loadingRemoveTag:"=",tags:"=",project:"=",onAddTag:"&",onDeleteTag:"&"},templateUrl:"components/tags/tag-line-common/tag-line-common.html",controller:"TagLineCommonCtrl",controllerAs:"vm",bindToController:!0}},e.directive("tgTagLineCommon",t)}.call(this),function(){var t,e,r;r=this.taiga.trim,e=angular.module("taigaCommon"),t=function(){function t(t,e,r){this.rootScope=t,this.confirm=e,this.modelTransform=r,this.loadingAddTag=!1}return t.$inject=["$rootScope","$tgConfirm","$tgQueueModelTransformation"],t.prototype.onDeleteTag=function(t){var e,n,i,o;return this.loadingRemoveTag=t[0],n=function(t){return function(e){return t.rootScope.$broadcast("object:updated"),t.loadingRemoveTag=!1,e}}(this),e=function(t){return function(){return t.confirm.notify("error"),t.loadingRemoveTag=!1}}(this),i=r(t[0].toLowerCase()),o=this.modelTransform.save(function(t){var e;return e=_.clone(t.tags),_.remove(e,function(t){return t[0]===i}),t.tags=e,t}),o.then(n,e)},t.prototype.onAddTag=function(t,e){var n,i,o;return this.loadingAddTag=!0,i=function(t){return function(e){return t.rootScope.$broadcast("object:updated"),t.addTag=!1,t.loadingAddTag=!1,e}}(this),n=function(t){return function(){return t.loadingAddTag=!1,t.confirm.notify("error")}}(this),o=this.modelTransform.save(function(n){return function(n){var i,o;return o=r(t.toLowerCase()),i=_.clone(n.tags),i.push([t,e]),n.tags=i,n}}(this)),o.then(i,n)},t}(),e.controller("TagLineCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaCommon"),t=function(){return{scope:{item:"=",permissions:"@",project:"="},templateUrl:"components/tags/tag-line-detail/tag-line-detail.html",controller:"TagLineCtrl",controllerAs:"vm",bindToController:!0}},e.directive("tgTagLine",t)}.call(this),function(){var t,e,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;e=angular.module("taigaCommon"),t=function(t){function e(){}return r(e,t),e.$inject=[],e.prototype.checkPermissions=function(t,e){return _.includes(t,e)},e.prototype.createColorsArray=function(t){return _.map(t,function(t,e){return[e,t]})},e}(taiga.Service),e.service("tgTagLineService",t)}.call(this),function(){var t,e;e=angular.module("taigaCommon"),t=function(){return{templateUrl:"components/tags/tag/tag.html",scope:{tag:"<",loadingRemoveTag:"<",onDeleteTag:"&",hasPermissions:"@"}}},e.directive("tgTag",t)}.call(this),function(){var t;t=function(t){var e;return e=function(e,r,n,i){var o,s;return e.zoomIndex=t.get("taskboard_zoom")||2,e.levels=4,s=[["ref"],["subject"],["owner","tags","extra_info","unfold"],["attachments"],["related_tasks"]],o=function(e){return null==e&&(e=0),t.get("taskboard_zoom")!==e&&t.set("taskboard_zoom",e),_.reduce(s,function(t,r,n){return n<=e&&(t=t.concat(r)),t})},e.$watch("zoomIndex",function(t){var r;return r=o(t),e.onZoomChange({zoomLevel:t,zoom:r})})},{scope:{onZoomChange:"&"},template:'',link:e}},angular.module("taigaComponents").directive("tgTaskboardZoom",["$tgStorage",t])}.call(this),function(){var t;t=function(t){var e;return e=function(e,r,n){return e.privacyPolicyUrl=t.get("privacyPolicyUrl"),e.termsOfServiceUrl=t.get("termsOfServiceUrl")},{restrict:"AE",scope:{},link:e,templateUrl:"components/terms-of-service-and-privacy-policy-notice/terms-of-service-and-privacy-policy-notice.html"}},angular.module("taigaComponents").directive("tgTermsOfServiceAndPrivacyPolicyNotice",["$tgConfig",t])}.call(this),function(){var t;t=function(t,e){var r;return r=function(r,n,i){return r.vm={},r.vm.tribeHost=t.config.tribeHost,r.vm.url=e.protocol()+"://"+e.host(),"http"===e.protocol()&&80!==e.port()?r.vm.url=r.vm.url+":"+e.port():"https"===e.protocol()&&443!==e.port()?r.vm.url=r.vm.url+":"+e.port():void 0},{scope:{usId:"=",projectSlug:"="},controllerAs:"vm",templateUrl:"components/tribe-button/tribe-button.html",link:r}},t.$inject=["$tgConfig","$tgLocation"],angular.module("taigaComponents").directive("tgTribeButton",t)}.call(this),function(){var t;t=function(t){var e,r;return r=function(e,r,n){return e.vm={},e.vm.tribeHost=t.config.tribeHost,e.vm.show=function(){return e.vm.open=!0},e.vm.hide=function(t){return e.vm.open=!1}},e={templateUrl:"components/tribe-button/tribe-linked.html",scope:{gigTitle:"=",gigId:"="},link:r}},t.$inject=["$tgConfig"],angular.module("taigaComponents").directive("tgTribeLinked",t)}.call(this),function(){var t;t=function(){function t(t){this.currentUserService=t,this.user=this.currentUserService.getUser(),this.isMouseOver=!1,this.loading=!1}return t.$inject=["tgCurrentUserService"],t.prototype.showTextWhenMouseIsOver=function(){return this.isMouseOver=!0},t.prototype.showTextWhenMouseIsLeave=function(){return this.isMouseOver=!1},t.prototype.toggleVote=function(){var t;return this.loading=!0,t=this.item.is_voter?this._downvote():this._upvote(),t["finally"](function(t){return function(){return t.loading=!1}}(this)),t},t.prototype._upvote=function(){return this.onUpvote().then(function(t){return function(){return t.showTextWhenMouseIsLeave()}}(this))},t.prototype._downvote=function(){return this.onDownvote()},t}(),angular.module("taigaComponents").controller("VoteButton",t)}.call(this),function(){var t;t=function(){return{scope:{},controller:"VoteButton",bindToController:{item:"=",onUpvote:"=",onDownvote:"="},controllerAs:"vm",templateUrl:"components/vote-button/vote-button.html"}},angular.module("taigaComponents").directive("tgVoteButton",t)}.call(this),function(){var t;t=function(){function t(t,e){this.currentUserService=t,this.rootScope=e,this.user=this.currentUserService.getUser(),this.isMouseOver=!1,this.loading=!1}return t.$inject=["tgCurrentUserService","$rootScope"],t.prototype.showTextWhenMouseIsOver=function(){return this.isMouseOver=!0},t.prototype.showTextWhenMouseIsLeave=function(){return this.isMouseOver=!1},t.prototype.openWatchers=function(){return this.rootScope.$broadcast("watcher:add",this.item)},t.prototype.getPerms=function(){var t,e;return this.item?(t=this.item._name,e={userstories:"modify_us",issues:"modify_issue",tasks:"modify_task",epics:"modify_epic"},e[t]):""},t.prototype.toggleWatch=function(){var t;return this.loading=!0,t=this.item.is_watcher?this._unwatch():this._watch(),t["finally"](function(t){return function(){return t.loading=!1}}(this)),t},t.prototype._watch=function(){return this.onWatch().then(function(t){return function(){return t.showTextWhenMouseIsLeave()}}(this))},t.prototype._unwatch=function(){return this.onUnwatch()},t}(),angular.module("taigaComponents").controller("WatchButton",t)}.call(this),function(){var t;t=function(){return{scope:{},controller:"WatchButton",bindToController:{item:"=",onWatch:"=",onUnwatch:"="},controllerAs:"vm",templateUrl:function(t,e){return"components/watch-button/watch-button-"+e.environment+".html"}}},angular.module("taigaComponents").directive("tgWatchButton",t)}.call(this),function(){var t;t=function(){function t(t){this.translate=t,this.is_open=!1,this.texts={week:this.translate.instant("DISCOVER.FILTERS.WEEK"),month:this.translate.instant("DISCOVER.FILTERS.MONTH"),year:this.translate.instant("DISCOVER.FILTERS.YEAR"),all:this.translate.instant("DISCOVER.FILTERS.ALL_TIME")}}return t.$inject=["$translate"],t.prototype.currentText=function(){return this.texts[this.currentOrderBy]},t.prototype.open=function(){return this.is_open=!0},t.prototype.close=function(){return this.is_open=!1},t.prototype.orderBy=function(t){return this.currentOrderBy=t,this.is_open=!1,this.onChange({orderBy:this.currentOrderBy})},t}(),angular.module("taigaDiscover").controller("DiscoverHomeOrderBy",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r){},{controller:"DiscoverHomeOrderBy",controllerAs:"vm",bindToController:!0,templateUrl:"discover/components/discover-home-order-by/discover-home-order-by.html",scope:{currentOrderBy:"=orderBy",onChange:"&"},link:t}},t.$inject=[],angular.module("taigaDiscover").directive("tgDiscoverHomeOrderBy",t)}.call(this),function(){var t;t=function(){function t(t){this.discoverProjectsService=t,taiga.defineImmutableProperty(this,"projects",function(t){return function(){return t.discoverProjectsService.projectsCount}}(this)),this.discoverProjectsService.fetchStats()}return t.$inject=["tgDiscoverProjectsService"],t.prototype.selectFilter=function(t){return this.onChange({filter:t,q:this.q})},t.prototype.submitFilter=function(){return this.onChange({filter:this.filter,q:this.q})},t}(),angular.module("taigaDiscover").controller("DiscoverSearchBar",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){},{controller:"DiscoverSearchBar",controllerAs:"vm",templateUrl:"discover/components/discover-search-bar/discover-search-bar.html",bindToController:!0,scope:{q:"=",filter:"=",onChange:"&"},compile:function(t,e){if(!e.q)return e.q=""},link:t}},t.$inject=[],angular.module("taigaDiscover").directive("tgDiscoverSearchBar",t)}.call(this),function(){var t;t=function(){function t(){this.like_is_open=0===this.orderBy.indexOf("-total_fans"),this.activity_is_open=0===this.orderBy.indexOf("-total_activity")}return t.$inject=[],t.prototype.openLike=function(){return this.like_is_open=!0,this.activity_is_open=!1,this.setOrderBy("-total_fans_last_week")},t.prototype.openActivity=function(){return this.activity_is_open=!0,this.like_is_open=!1,this.setOrderBy("-total_activity_last_week")},t.prototype.setOrderBy=function(t){return null==t&&(t=""),t||(this.like_is_open=!1,this.activity_is_open=!1),this.onChange({orderBy:t})},t}(),angular.module("taigaDiscover").controller("DiscoverSearchListHeader",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r){},{controller:"DiscoverSearchListHeader",controllerAs:"vm",bindToController:!0,templateUrl:"discover/components/discover-search-list-header/discover-search-list-header.html",scope:{onChange:"&",orderBy:"="},link:t}},t.$inject=[],angular.module("taigaDiscover").directive("tgDiscoverSearchListHeader",t)}.call(this),function(){var t;t=function(){function t(t){this.discoverProjectsService=t,taiga.defineImmutableProperty(this,"featured",function(t){return function(){return t.discoverProjectsService.featured}}(this)),this.discoverProjectsService.fetchFeatured()}return t.$inject=["tgDiscoverProjectsService"],t}(),angular.module("taigaDiscover").controller("FeaturedProjects",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r){},{controller:"FeaturedProjects",controllerAs:"vm",templateUrl:"discover/components/featured-projects/featured-projects.html",scope:{},link:t}},t.$inject=[],angular.module("taigaDiscover").directive("tgFeaturedProjects",t)}.call(this),function(){var t;t=function(){return{templateUrl:"discover/components/highlighted/highlighted.html",scope:{loading:"=",highlighted:"=",orderBy:"="}}},t.$inject=[],angular.module("taigaDiscover").directive("tgHighlighted",t)}.call(this),function(){var t;t=function(){function t(t){this.discoverProjectsService=t,taiga.defineImmutableProperty(this,"highlighted",function(t){return function(){return t.discoverProjectsService.mostActive}}(this)),this.currentOrderBy="week",this.order_by=this.getOrderBy()}return t.$inject=["tgDiscoverProjectsService"],t.prototype.fetch=function(){return this.loading=!0,this.order_by=this.getOrderBy(),this.discoverProjectsService.fetchMostActive({order_by:this.order_by}).then(function(t){return function(){return t.loading=!1}}(this))},t.prototype.orderBy=function(t){return this.currentOrderBy=t,this.fetch()},t.prototype.getOrderBy=function(t){return"all"===this.currentOrderBy?"-total_activity":"-total_activity_last_"+this.currentOrderBy},t}(),angular.module("taigaDiscover").controller("MostActive",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){return n.fetch()},{controller:"MostActive",controllerAs:"vm",templateUrl:"discover/components/most-active/most-active.html",scope:{},link:t}},t.$inject=[],angular.module("taigaDiscover").directive("tgMostActive",t)}.call(this),function(){var t;t=function(){function t(t){this.discoverProjectsService=t,taiga.defineImmutableProperty(this,"highlighted",function(t){return function(){return t.discoverProjectsService.mostLiked}}(this)),this.currentOrderBy="week",this.order_by=this.getOrderBy()}return t.$inject=["tgDiscoverProjectsService"],t.prototype.fetch=function(){return this.loading=!0,this.order_by=this.getOrderBy(),this.discoverProjectsService.fetchMostLiked({order_by:this.order_by}).then(function(t){return function(){return t.loading=!1}}(this))},t.prototype.orderBy=function(t){return this.currentOrderBy=t,this.fetch()},t.prototype.getOrderBy=function(){return"all"===this.currentOrderBy?"-total_fans":"-total_fans_last_"+this.currentOrderBy},t}(),angular.module("taigaDiscover").controller("MostLiked",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){return n.fetch()},{controller:"MostLiked",controllerAs:"vm",templateUrl:"discover/components/most-liked/most-liked.html",scope:{},link:t}},t.$inject=[],angular.module("taigaDiscover").directive("tgMostLiked",t)}.call(this),function(){var t;t=function(){function t(t,e,r,n){var i,o;this.location=t,this.navUrls=e,this.appMetaService=r,this.translate=n,o=this.translate.instant("DISCOVER.PAGE_TITLE"),i=this.translate.instant("DISCOVER.PAGE_DESCRIPTION"),this.appMetaService.setAll(o,i)}return t.$inject=["$tgLocation","$tgNavUrls","tgAppMetaService","$translate"],t.prototype.onSubmit=function(t){var e;return e=this.navUrls.resolve("discover-search"),this.location.search("text",t).path(e)},t}(),angular.module("taigaDiscover").controller("DiscoverHome",t)}.call(this),function(){var t;t=function(){function t(t,e,r,n,i){var o,s;this.routeParams=t,this.discoverProjectsService=e,this.route=r,this.appMetaService=n,this.translate=i,this.page=1,taiga.defineImmutableProperty(this,"searchResult",function(t){return function(){return t.discoverProjectsService.searchResult}}(this)),taiga.defineImmutableProperty(this,"nextSearchPage",function(t){return function(){return t.discoverProjectsService.nextSearchPage}}(this)),this.q=this.routeParams.text,this.filter=this.routeParams.filter||"all",this.orderBy=this.routeParams.order_by||"",this.loadingGlobal=!1,this.loadingList=!1,this.loadingPagination=!1,s=this.translate.instant("DISCOVER.SEARCH.PAGE_TITLE"),o=this.translate.instant("DISCOVER.SEARCH.PAGE_DESCRIPTION"),this.appMetaService.setAll(s,o)}return t.$inject=["$routeParams","tgDiscoverProjectsService","$route","tgAppMetaService","$translate"],t.prototype.fetch=function(){return this.page=1,this.discoverProjectsService.resetSearchList(),this.search()},t.prototype.fetchByGlobalSearch=function(){if(!this.loadingGlobal)return this.loadingGlobal=!0,this.fetch().then(function(t){return function(){return t.loadingGlobal=!1}}(this))},t.prototype.fetchByOrderBy=function(){if(!this.loadingList)return this.loadingList=!0,this.fetch().then(function(t){return function(){return t.loadingList=!1}}(this))},t.prototype.showMore=function(){if(!this.loadingPagination)return this.loadingPagination=!0,this.page++,this.search().then(function(t){return function(){return t.loadingPagination=!1}}(this))},t.prototype.search=function(){var t,e;return t=this.getFilter(),e={page:this.page,q:this.q,order_by:this.orderBy},_.assign(e,t),this.discoverProjectsService.fetchSearch(e)},t.prototype.getFilter=function(){return"people"===this.filter?{is_looking_for_people:!0}:"scrum"===this.filter?{is_backlog_activated:!0}:"kanban"===this.filter?{is_kanban_activated:!0}:{}},t.prototype.onChangeFilter=function(t,e){return this.filter=t,this.q=e,this.route.updateParams({filter:this.filter,text:this.q}),this.fetchByGlobalSearch()},t.prototype.onChangeOrder=function(t){return this.orderBy=t,this.route.updateParams({order_by:t}),this.fetchByOrderBy()},t}(),angular.module("taigaDiscover").controller("DiscoverSearch",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){return n.fetch()},{controller:"DiscoverSearch",controllerAs:"vm",link:t}},t.$inject=[],angular.module("taigaDiscover").directive("tgDiscoverSearch",t)}.call(this),function(){var t,e,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;e=this.taiga,t=function(t){function n(t,r){this.rs=t,this.projectsService=r,this._mostLiked=Immutable.List(),this._mostActive=Immutable.List(),this._featured=Immutable.List(),this._searchResult=Immutable.List(),this._projectsCount=0,this.decorate=this.projectsService._decorate.bind(this.projectsService),e.defineImmutableProperty(this,"mostLiked",function(t){return function(){return t._mostLiked}}(this)),e.defineImmutableProperty(this,"mostActive",function(t){return function(){return t._mostActive}}(this)),e.defineImmutableProperty(this,"featured",function(t){return function(){return t._featured}}(this)),e.defineImmutableProperty(this,"searchResult",function(t){return function(){return t._searchResult}}(this)),e.defineImmutableProperty(this,"nextSearchPage",function(t){return function(){return t._nextSearchPage}}(this)),e.defineImmutableProperty(this,"projectsCount",function(t){return function(){return t._projectsCount}}(this))}var i;return r(n,t),n.$inject=["tgResources","tgProjectsService"],i={discover_mode:!0},n.prototype.fetchMostLiked=function(t){var e;return e=_.extend({},i,t),this.rs.projects.getProjects(e,!1).then(function(t){return function(e){var r,n;return r=e.data.slice(0,5),n=Immutable.fromJS(r),n=n.map(t.decorate),t._mostLiked=n}}(this))},n.prototype.fetchMostActive=function(t){var e;return e=_.extend({},i,t),this.rs.projects.getProjects(e,!1).then(function(t){return function(e){var r,n;return r=e.data.slice(0,5),n=Immutable.fromJS(r),n=n.map(t.decorate),t._mostActive=n}}(this))},n.prototype.fetchFeatured=function(){var t;return t=_.extend({},i),t.is_featured=!0,this.rs.projects.getProjects(t,!1).then(function(t){return function(e){var r,n;return r=e.data.slice(0,4),n=Immutable.fromJS(r),n=n.map(t.decorate),t._featured=n}}(this))},n.prototype.resetSearchList=function(){return this._searchResult=Immutable.List()},n.prototype.fetchStats=function(){return this.rs.stats.discover().then(function(t){return function(e){return t._projectsCount=e.getIn(["projects","total"])}}(this))},n.prototype.fetchSearch=function(t){var e;return e=_.extend({},i,t),this.rs.projects.getProjects(e).then(function(t){return function(e){var r;return t._nextSearchPage=!!e.headers("X-Pagination-Next"),r=Immutable.fromJS(e.data),r=r.map(t.decorate),t._searchResult=t._searchResult.concat(r)}}(this))},n}(e.Service),angular.module("taigaDiscover").service("tgDiscoverProjectsService",t)}.call(this),function(){var t,e,r,n;r=this.taiga,n=r.trim,e=r.getRandomDefaultColor,t=function(){function t(t,r,n){this.confirm=t,this.projectService=r,this.epicsService=n,this.project=this.projectService.project.toJS(),this.newEpic={color:e(),status:this.project.default_epic_status,tags:[]},this.attachments=Immutable.List(),this.loading=!1}return t.$inject=["$tgConfirm","tgProjectService","tgEpicsService"],t.prototype.createEpic=function(){if(this.validateForm())return this.loading=!0,this.epicsService.createEpic(this.newEpic,this.attachments).then(function(t){return function(e){return t.onCreateEpic(),t.loading=!1}}(this))["catch"](function(t){return function(e){if(t.loading=!1,t.setFormErrors(e.data),e.data._error_message)return t.confirm.notify("error",e.data._error_message)}}(this))},t.prototype.selectColor=function(t){return this.newEpic.color=t},t.prototype.addTag=function(t,e){if(t=n(t.toLowerCase()),!_.find(this.newEpic.tags,function(e){return e[0]===t}))return this.newEpic.tags.push([t,e])},t.prototype.deleteTag=function(t){return _.remove(this.newEpic.tags,function(e){return e[0]===t[0]})},t.prototype.addAttachment=function(t){return this.attachments.push(t)},t}(),angular.module("taigaEpics").controller("CreateEpicCtrl",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){var i;return i=e.find("form").checksley(),n.validateForm=function(t){return function(){return i.validate()}}(this),n.setFormErrors=function(t){return function(t){return i.setErrors(t)}}(this)},{link:t,templateUrl:"epics/create-epic/create-epic.html",controller:"CreateEpicCtrl",controllerAs:"vm",bindToController:{onCreateEpic:"&"},scope:{}}},angular.module("taigaEpics").directive("tgCreateEpic",t)}.call(this),function(){var t;t=function(){function t(t,e,r){this.confirm=t,this.projectService=e,this.epicsService=r,this.displayUserStories=!1,this.displayAssignedTo=!1,this.displayStatusList=!1,this.loadingStatus=!1,this.project=this.projectService.project.toJS(),this._calculateProgressBar()}return t.$inject=["$tgConfirm","tgProjectService","tgEpicsService"],t.prototype._calculateProgressBar=function(){var t,e,r;return this.epic.getIn(["status_extra_info","is_closed"])===!0?this.percentage="100%":(e=this.epic.getIn(["user_stories_counts","opened"]),t=this.epic.getIn(["user_stories_counts","closed"]),r=e+t,0===r?this.percentage="0%":this.percentage=100*t/r+"%")},t.prototype.canEditEpics=function(){return this.projectService.hasPermission("modify_epic")},t.prototype.toggleUserStoryList=function(){return this.displayUserStories?this.displayUserStories=!1:this.epicsService.listRelatedUserStories(this.epic).then(function(t){return function(e){return t.epicStories=e,t.displayUserStories=!0}}(this))["catch"](function(t){return function(){return t.confirm.notify("error")}}(this))},t.prototype.updateStatus=function(t){return this.displayStatusList=!1,this.loadingStatus=!0,this.epicsService.updateEpicStatus(this.epic,t)["catch"](function(t){return function(){return t.confirm.notify("error")}}(this))["finally"](function(t){return function(){return t.loadingStatus=!1}}(this))},t.prototype.updateAssignedTo=function(t){return this.assignLoader=!0,this.epicsService.updateEpicAssignedTo(this.epic,(null!=t?t.id:void 0)||null)["catch"](function(t){return function(){return t.confirm.notify("error")}}(this)).then(function(t){return function(){return t.assignLoader=!1}}(this))},t}(),angular.module("taigaEpics").controller("EpicRowCtrl",t)}.call(this),function(){var t;t=function(){return{templateUrl:"epics/dashboard/epic-row/epic-row.html",controller:"EpicRowCtrl",controllerAs:"vm",bindToController:!0,scope:{epic:"=",column:"="}}},angular.module("taigaEpics").directive("tgEpicRow",t)}.call(this),function(){var t,e;e=this.taiga,t=function(){function t(t,r,n,i,o,s,a,u,c){this.params=t,this.errorHandlingService=r,this.lightboxFactory=n,this.lightboxService=i,this.confirm=o,this.projectService=s,this.epicsService=a,this.appMetaService=u,this.translate=c,this.sectionName="EPICS.SECTION_NAME",e.defineImmutableProperty(this,"project",function(t){return function(){return t.projectService.project}}(this)),e.defineImmutableProperty(this,"epics",function(t){return function(){return t.epicsService.epics}}(this)),this.appMetaService.setfn(this._setMeta.bind(this))}return t.$inject=["$routeParams","tgErrorHandlingService","tgLightboxFactory","lightboxService","$tgConfirm","tgProjectService","tgEpicsService","tgAppMetaService","$translate"],t.prototype._setMeta=function(){var t;return this.project?(t={projectName:this.project.get("name"),projectDescription:this.project.get("description")},{title:this.translate.instant("EPICS.PAGE_TITLE",t),description:this.translate.instant("EPICS.PAGE_DESCRIPTION",t)
}):null},t.prototype.loadInitialData=function(){return this.epicsService.clear(),this.projectService.setProjectBySlug(this.params.pslug).then(function(t){return function(){return t.projectService.isEpicsDashboardEnabled()?t.projectService.hasPermission("view_epics")?t.epicsService.fetchEpics():t.errorHandlingService.permissionDenied():t.errorHandlingService.notFound()}}(this))},t.prototype.canCreateEpics=function(){return this.projectService.hasPermission("add_epic")},t.prototype.onCreateEpic=function(){var t;return t=function(t){return function(){t.lightboxService.closeAll(),t.confirm.notify("success")}}(this),this.lightboxFactory.create("tg-create-epic",{"class":"lightbox lightbox-create-epic open","on-create-epic":"onCreateEpic()"},{onCreateEpic:t.bind(this)})},t}(),angular.module("taigaEpics").controller("EpicsDashboardCtrl",t)}.call(this),function(){var t;t=function(t,e){var r;return r=function(r,n,i){var o,s,a;if(e.hasPermission("modify_epic"))return o=t(i.tgEpicsSortable),s=dragula([n[0]],{copySortSource:!1,copy:!1,mirrorContainer:n[0],moves:function(t){return $(t).is("div.epics-table-body-row")}}),s.on("dragend",function(t){var e,n,i;return n=$(t),e=n.scope().epic,i=n.index(),r.$apply(function(){return o(r,{epic:e,newIndex:i})})}),a=autoScroll(window,{margin:20,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&s.dragging}}),r.$on("$destroy",function(){return n.off(),s.destroy()})},{link:r}},t.$inject=["$parse","tgProjectService"],angular.module("taigaComponents").directive("tgEpicsSortable",t)}.call(this),function(){var t,e;e=this.taiga,t=function(){function t(t,r,n){this.confirm=t,this.epicsService=r,this.timeout=n,this.displayOptions=!1,this.displayVotes=!0,this.column={votes:!0,name:!0,project:!0,sprint:!0,assigned:!0,status:!0,progress:!0},e.defineImmutableProperty(this,"epics",function(t){return function(){return t.epicsService.epics}}(this))}return t.$inject=["$tgConfirm","tgEpicsService","$timeout"],t.prototype.toggleEpicTableOptions=function(){return this.displayOptions=!this.displayOptions},t.prototype.reorderEpic=function(t,e){return this.epicsService.reorderEpic(t,e).then(null,function(t){return function(){return t.confirm.notify("error")}}(this))},t.prototype.hoverEpicTableOption=function(){if(this.timer)return this.timeout.cancel(this.timer)},t.prototype.hideEpicTableOption=function(){return this.timer=this.timeout(function(t){return function(){return t.displayOptions=!1}}(this),400)},t}(),angular.module("taigaEpics").controller("EpicsTableCtrl",t)}.call(this),function(){var t;t=function(){return{templateUrl:"epics/dashboard/epics-table/epics-table.html",controller:"EpicsTableCtrl",controllerAs:"vm",scope:{}}},angular.module("taigaEpics").directive("tgEpicsTable",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(){function t(){this._calculateProgressBar()}return t.$inject=[],t.prototype._calculateProgressBar=function(){var t,e;return this.story.get("is_closed")===!0?this.percentage="100%":(t=this.story.get("tasks").size,e=this.story.get("tasks").filter(function(t){return t.get("is_closed")}).size,0===t?this.percentage="0%":this.percentage=100*e/t+"%")},t}(),e.controller("StoryRowCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(){return{templateUrl:"epics/dashboard/story-row/story-row.html",controller:"StoryRowCtrl",controllerAs:"vm",bindToController:!0,scope:{story:"=",column:"="}}},e.directive("tgStoryRow",t)}.call(this),function(){var t,e;e=this.taiga,t=function(){function t(t,r,n,i){this.projectService=t,this.attachmentsService=r,this.resources=n,this.xhrError=i,this._epics=Immutable.List(),e.defineImmutableProperty(this,"epics",function(t){return function(){return t._epics}}(this))}return t.$inject=["tgProjectService","tgAttachmentsService","tgResources","tgXhrErrorService"],t.prototype.clear=function(){return this._epics=Immutable.List()},t.prototype.fetchEpics=function(){return this.resources.epics.list(this.projectService.project.get("id")).then(function(t){return function(e){return t._epics=e}}(this))["catch"](function(t){return function(e){return t.xhrError.response(e)}}(this))},t.prototype.listRelatedUserStories=function(t){return this.resources.userstories.listInEpic(t.get("id"))},t.prototype.createEpic=function(t,e){return t.project=this.projectService.project.get("id"),this.resources.epics.post(t).then(function(t){return function(r){var n;return n=_.map(e.toJS(),function(e){return t.attachmentsService.upload(e.file,r.get("id"),r.get("project"),"epic")}),Promise.all(n).then(function(){return t.fetchEpics()})}}(this))},t.prototype.reorderEpic=function(t,e){var r,n,i,o,s,a,u;return u=this.epics.filter(function(e){return function(e){return e.get("id")!==t.get("id")}}(this)),r=u.slice(0,e),o=r.last(),i=o?o.get("epics_order")+1:0,s=r.filter(function(t){return function(t){return t.get("epics_order")===o.get("epics_order")}}(this)),a=_.fromPairs(s.map(function(t){return function(t){return[t.get("id"),t.get("epics_order")]}}(this)).toJS()),n={epics_order:i,version:t.get("version")},this.resources.epics.reorder(t.get("id"),n,a).then(function(t){return function(){return t.fetchEpics()}}(this))},t.prototype.reorderRelatedUserstory=function(t,e,r,n){var i,o,s,a,u,c,l,p,f;return f=e.filter(function(t){return function(t){return t.get("id")!==r.get("id")}}(this)),i=f.slice(0,n),u=i.last(),a=u?u.get("epic_order")+1:0,c=i.filter(function(t){return function(t){return t.get("epic_order")===u.get("epic_order")}}(this)),l=_.fromPairs(c.map(function(t){return function(t){return[t.get("id"),t.get("epic_order")]}}(this)).toJS()),o={order:a},s=t.get("id"),p=r.get("id"),this.resources.epics.reorderRelatedUserstory(s,p,o,l).then(function(e){return function(){return e.listRelatedUserStories(t)}}(this))},t.prototype.updateEpicStatus=function(t,e){var r;return r={status:e,version:t.get("version")},this.resources.epics.patch(t.get("id"),r).then(function(t){return function(){return t.fetchEpics()}}(this))},t.prototype.updateEpicAssignedTo=function(t,e){var r;return r={assigned_to:e,version:t.get("version")},this.resources.epics.patch(t.get("id"),r).then(function(t){return function(){return t.fetchEpics()}}(this))},t}(),angular.module("taigaEpics").service("tgEpicsService",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(){function t(t,e){this.projectService=t,this.epicsService=e,this.sectionName="Epics",this.showCreateRelatedUserstoriesLightbox=!1}return t.$inject=["tgProjectService","tgEpicsService"],t.prototype.showRelatedUserStoriesSection=function(){var t;return this.projectService.hasPermission("modify_epic")||(null!=(t=this.userstories)?t.legth:void 0)>0},t.prototype.userCanSort=function(){return this.projectService.hasPermission("modify_epic")},t.prototype.loadRelatedUserstories=function(){return this.epicsService.listRelatedUserStories(this.epic).then(function(t){return function(e){return t.userstories=e}}(this))},t.prototype.reorderRelatedUserstory=function(t,e){return this.epicsService.reorderRelatedUserstory(this.epic,this.userstories,t,e).then(function(t){return function(e){return t.userstories=e}}(this))},t}(),e.controller("RelatedUserStoriesCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(){function t(t,e,r,n){this.currentUserService=t,this.rs=e,this.confirm=r,this.analytics=n,this.projects=this.currentUserService.projects.get("all"),this.projectUserstories=Immutable.List(),this.loading=!1}return t.$inject=["tgCurrentUserService","tgResources","$tgConfirm","$tgAnalytics"],t.prototype.selectProject=function(t,e){return this.rs.userstories.listAllInProject(t).then(function(t){return function(r){var n,i;if(n=t.epicUserstories.map(function(t){return t.get("id")}),i=r.filter(function(t){return n.indexOf(t.get("id"))===-1}),t.projectUserstories=i,e)return e()}}(this))},t.prototype.saveRelatedUserStory=function(t,e){var r,n,i;if(this.validateExistingUserstoryForm())return this.loading=!0,n=function(t){return function(e){return t.loading=!1,t.confirm.notify("error"),t.setExistingUserstoryFormErrors(e)}}(this),i=function(t){return function(){return t.analytics.trackEvent("epic related user story","create","create related user story on epic",1),t.loading=!1,e&&e(),t.loadRelatedUserstories()}}(this),r=this.epic.get("id"),this.rs.epics.addRelatedUserstory(r,t).then(i,n)},t.prototype.bulkCreateRelatedUserStories=function(t,e,r){var n,i,o;if(this.validateNewUserstoryForm())return this.loading=!0,i=function(t){return function(e){return t.loading=!1,t.confirm.notify("error"),t.setNewUserstoryFormErrors(e)}}(this),o=function(t){return function(){return t.analytics.trackEvent("epic related user story","create","create related user story on epic",1),t.loading=!1,r&&r(),t.loadRelatedUserstories()}}(this),n=this.epic.get("id"),this.rs.epics.bulkCreateRelatedUserStories(n,t,e).then(o,i)},t}(),e.controller("RelatedUserstoriesCreateCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(t){var e;return this.lightboxService=t,e=function(t,e,r,n){var i,o;return o=e.find(".new-user-story-form").checksley(),i=e.find(".existing-user-story-form").checksley(),n.validateNewUserstoryForm=function(t){return function(){return o.validate()}}(this),n.setNewUserstoryFormErrors=function(t){return function(t){return o.setErrors(t)}}(this),n.validateExistingUserstoryForm=function(t){return function(){return i.validate()}}(this),n.setExistingUserstoryFormErrors=function(t){return function(t){return i.setErrors(t)}}(this),t.showLightbox=function(r){return t.selectProject(r).then(function(t){return function(){return lightboxService.open(e.find(".lightbox-create-related-user-stories"))}}(this))},t.closeLightbox=function(){return t.selectedUserstory=null,t.searchUserstory="",t.relatedUserstoriesText="",lightboxService.close(e.find(".lightbox-create-related-user-stories"))},t.$watch("vm.project",function(e){if(null!=e)return t.selectedProject=e.get("id")}),t.selectProject=function(e){return t.selectedUserstory=null,t.searchUserstory="",n.selectProject(e)},t.onUpdateSearchUserstory=function(){return t.selectedUserstory=null}},{link:e,templateUrl:"epics/related-userstories/related-userstories-create/related-userstories-create.html",controller:"RelatedUserstoriesCreateCtrl",controllerAs:"vm",bindToController:!0,scope:{showCreateRelatedUserstoriesLightbox:"=",project:"=",epic:"=",epicUserstories:"=",loadRelatedUserstories:"&"}}},t.$inject=["lightboxService"],e.directive("tgRelatedUserstoriesCreate",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(t,e){var r;return r=function(r,n,i){var o,s,a;if(e.hasPermission("modify_epic"))return o=t(i.tgRelatedUserstoriesSortable),s=dragula([n[0]],{copySortSource:!1,copy:!1,mirrorContainer:n[0],moves:function(t){return $(t).is("tg-related-userstory-row")}}),s.on("dragend",function(t){var e,n,i;return e=$(t),i=e.scope().us,n=e.index(),r.$apply(function(){return o(r,{us:i,newIndex:n})})}),a=autoScroll(window,{margin:20,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&s.dragging}}),r.$on("$destroy",function(){return n.off(),s.destroy()})},{link:r}},t.$inject=["$parse","tgProjectService"],e.directive("tgRelatedUserstoriesSortable",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(){return{templateUrl:"epics/related-userstories/related-userstories.html",controller:"RelatedUserStoriesCtrl",controllerAs:"vm",bindToController:!0,scope:{userstories:"=",project:"=",epic:"="}}},t.$inject=[],e.directive("tgRelatedUserstories",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(){function t(t,e,r,n){this.avatarService=t,this.translate=e,this.confirm=r,this.rs=n}return t.$inject=["tgAvatarService","$translate","$tgConfirm","tgResources"],t.prototype.setAvatarData=function(){var t;return t=this.userstory.get("assigned_to_extra_info"),this.avatar=this.avatarService.getAvatar(t)},t.prototype.getAssignedToFullNameDisplay=function(){return this.userstory.get("assigned_to")?this.userstory.getIn(["assigned_to_extra_info","full_name_display"]):this.translate.instant("COMMON.ASSIGNED_TO.NOT_ASSIGNED")},t.prototype.onDeleteRelatedUserstory=function(){var t,e;return e=this.translate.instant("EPIC.TITLE_LIGHTBOX_UNLINK_RELATED_USERSTORY"),t=this.translate.instant("EPIC.MSG_LIGHTBOX_UNLINK_RELATED_USERSTORY",{subject:this.userstory.get("subject")}),this.confirm.askOnDelete(e,t).then(function(e){return function(r){var n,i,o,s;return i=function(){return t=e.translate.instant("EPIC.ERROR_UNLINK_RELATED_USERSTORY",{errorMessage:t}),e.confirm.notify("error",null,t),r.finish(!1)},o=function(){return e.loadRelatedUserstories(),r.finish()},n=e.epic.get("id"),s=e.userstory.get("id"),e.rs.epics.deleteRelatedUserstory(n,s).then(o,i)}}(this))},t}(),e.controller("RelatedUserstoryRowCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(){var t;return t=function(t,e,r,n){return n.setAvatarData()},{link:t,templateUrl:"epics/related-userstories/related-userstory-row/related-userstory-row.html",controller:"RelatedUserstoryRowCtrl",controllerAs:"vm",bindToController:!0,scope:{userstory:"=",epic:"=",project:"=",loadRelatedUserstories:"&"}}},t.$inject=[],e.directive("tgRelatedUserstoryRow",t)}.call(this),function(){var t,e,r=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function r(){this.constructor=t}for(var n in e)i.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty;e=this.taiga,t=function(t){function i(t,n,i,o,s,a,u,c){var l,p;this.routeParams=t,this.externalAppsService=n,this.window=i,this.currentUserService=o,this.location=s,this.navUrls=a,this.xhrError=u,this.loader=c,this.createApplicationToken=r(this.createApplicationToken,this),this._getApplicationToken=r(this._getApplicationToken,this),this._redirect=r(this._redirect,this),this.loader.start(!1),this._applicationId=this.routeParams.application,this._state=this.routeParams.state,this._getApplicationToken(),this._user=this.currentUserService.getUser(),this._application=null,p=encodeURIComponent(this.location.url()),l=this.navUrls.resolve("login"),this.loginWithAnotherUserUrl=l+"?next="+p,e.defineImmutableProperty(this,"user",function(t){return function(){return t._user}}(this)),e.defineImmutableProperty(this,"application",function(t){return function(){return t._application}}(this))}return n(i,t),i.$inject=["$routeParams","tgExternalAppsService","$window","tgCurrentUserService","$location","$tgNavUrls","tgXhrErrorService","tgLoader"],i.prototype._redirect=function(t){var e;return e=t.get("next_url"),this.window.open(e,"_self")},i.prototype._getApplicationToken=function(){return this.externalAppsService.getApplicationToken(this._applicationId,this._state).then(function(t){return function(e){return t._application=e.get("application"),e.get("auth_code")?t._redirect(e):t.loader.pageLoaded()}}(this))["catch"](function(t){return function(e){return t.loader.pageLoaded(),t.xhrError.response(e)}}(this))},i.prototype.cancel=function(){return this.window.history.back()},i.prototype.createApplicationToken=function(){return this.externalAppsService.authorizeApplicationToken(this._applicationId,this._state).then(function(t){return function(e){return t._redirect(e)}}(this))["catch"](function(t){return function(e){return t.xhrError.response(e)}}(this))},i}(e.Controller),angular.module("taigaExternalApps").controller("ExternalApp",t)}.call(this),function(){var t,e=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function r(t){this.rs=t}return e(r,t),r.$inject=["tgResources"],r.prototype.getApplicationToken=function(t,e){return this.rs.externalapps.getApplicationToken(t,e)},r.prototype.authorizeApplicationToken=function(t,e){return this.rs.externalapps.authorizeApplicationToken(t,e)},r}(taiga.Service),angular.module("taigaExternalApps").service("tgExternalAppsService",t)}.call(this),function(){var t,e=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function r(t){this.lightboxFactory=t}return e(r,t),r.$inject=["tgLightboxFactory"],r.prototype.sendFeedback=function(){return this.lightboxFactory.create("tg-lb-feedback",{"class":"lightbox lightbox-feedback lightbox-generic-form"})},r}(taiga.Service),angular.module("taigaFeedback").service("tgFeedbackService",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){function t(t,e,r){this.currentUserService=t,this.permissionService=e,this.lightboxFactory=r,this.hiddenDeletedComment=!0,this.commentContent=angular.copy(this.comment)}return t.$inject=["tgCurrentUserService","tgCheckPermissionsService","tgLightboxFactory"],t.prototype.showDeletedComment=function(){return this.hiddenDeletedComment=!1},t.prototype.hideDeletedComment=function(){return this.hiddenDeletedComment=!0},t.prototype.checkCancelComment=function(t){if(27===t.keyCode)return this.onEditMode({commentId:this.comment.id})},t.prototype.canEditDeleteComment=function(){if(this.currentUserService.getUser())return this.user=this.currentUserService.getUser(),this.user.get("id")===this.comment.user.pk||this.permissionService.check("modify_project")},t.prototype.displayCommentHistory=function(){return this.lightboxFactory.create("tg-lb-display-historic",{"class":"lightbox lightbox-display-historic",comment:"comment",name:"name",object:"object"},{comment:this.comment,name:this.name,object:this.object})},t}(),e.controller("CommentCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){return{scope:{name:"@",object:"@",comment:"<",type:"<",loading:"<",editing:"<",deleting:"<",objectId:"<",editMode:"<",onEditMode:"&",onDeleteComment:"&",onRestoreDeletedComment:"&",onEditComment:"&"},templateUrl:"history/comments/comment.html",bindToController:!0,controller:"CommentCtrl",controllerAs:"vm"}},e.directive("tgComment",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){function t(){}return t.$inject=[],t.prototype.initializePermissions=function(){return this.canAddCommentPermission="comment_"+this.name},t}(),e.controller("CommentsCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){var t;return t=function(t,e,r,n){return n.initializePermissions()},{scope:{type:"<",name:"@",object:"@",comments:"<",onEditMode:"&",onDeleteComment:"&",onRestoreDeletedComment:"&",onAddComment:"&",onEditComment:"&",editMode:"<",loading:"<",deleting:"<",editing:"<",projectId:"="},templateUrl:"history/comments/comments.html",bindToController:!0,controller:"CommentsCtrl",controllerAs:"vm",link:t}},e.directive("tgComments",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){function t(t){this.rs=t}return t.$inject=["$tgResources"],t.prototype._loadHistoric=function(){var t,e,r;return r=this.name,e=this.object,t=this.comment.id,this.rs.history.getCommentHistory(r,e,t).then(function(t){return function(e){return t.commentHistoryEntries=e}}(this))},t}(),e.controller("LightboxDisplayHistoricCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(t){var e;return e=function(e,r,n,i){return i._loadHistoric(),t.open(r)},{scope:{},bindToController:{name:"=",object:"=",comment:"="},templateUrl:"history/history-lightbox/comment-history-lightbox.html",controller:"LightboxDisplayHistoricCtrl",controllerAs:"vm",link:e}},e.directive("tgLbDisplayHistoric",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(t){return{scope:{entry:"<"},templateUrl:"history/history-lightbox/history-entry.html"}},e.directive("tgHistoryEntry",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){return{templateUrl:"history/history-tabs/history-tabs.html",scope:{showCommentTab:"&",showActivityTab:"&",onActiveComments:"&",onActiveActivities:"&",onOrderComments:"&",activeTab:"<",commentsNum:"<",activitiesNum:"<",onReverse:"<"}}},e.directive("tgHistoryTabs",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){function t(t,e,r,n){this.rs=t,this.repo=e,this.storage=r,this.projectService=n,this.editing=null,this.deleting=null,this.editMode={},this.viewComments=!0,this._loadHistory(),this.reverse=this.storage.get("orderComments")}return t.$inject=["$tgResources","$tgRepo","$tgStorage","tgProjectService"],t.prototype._loadHistory=function(){return this.rs.history.get(this.name,this.id).then(function(t){return function(e){return t._getComments(e),t._getActivities(e)}}(this))},t.prototype._getComments=function(t){return this.comments=_.filter(t,function(t){return""!==t.comment}),this.reverse&&this.comments-_.reverse(this.comments),this.commentsNum=this.comments.length},t.prototype._getActivities=function(t){return this.activities=_.filter(t,function(t){return Object.keys(t.values_diff).length>0}),this.activitiesNum=this.activities.length},t.prototype.showHistorySection=function(){return this.showCommentTab()||this.showActivityTab()},t.prototype.showCommentTab=function(){return this.commentsNum>0||this.projectService.hasPermission("comment_"+this.name)},t.prototype.showActivityTab=function(){return this.activitiesNum>0},t.prototype.toggleEditMode=function(t){return this.editMode[t]=!this.editMode[t]},t.prototype.onActiveHistoryTab=function(t){return this.viewComments=t},t.prototype.deleteComment=function(t){var e,r,n;return n=this.name,r=this.id,e=t,this.deleting=t,this.rs.history.deleteComment(n,r,e).then(function(e){return function(){return e._loadHistory(),e.deleting=t}}(this))},t.prototype.editComment=function(t,e){var r,n,i;return i=this.name,n=this.id,r=t,this.editing=t,this.rs.history.editComment(i,n,r,e).then(function(e){return function(){return e._loadHistory(),e.toggleEditMode(t),e.editing=null}}(this))},t.prototype.restoreDeletedComment=function(t){var e,r,n;return n=this.name,r=this.id,e=t,this.editing=t,this.rs.history.undeleteComment(n,r,e).then(function(t){return function(){return t._loadHistory(),t.editing=null}}(this))},t.prototype.addComment=function(){var t;return t=this.type,this.loading=!0,this.repo.save(this.type).then(function(t){return function(){return t._loadHistory(),t.loading=!1}}(this))},t.prototype.onOrderComments=function(){return this.reverse=!this.reverse,this.storage.set("orderComments",this.reverse),this._loadHistory()},t}(),e.controller("HistorySection",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){var t;return t=function(t,e,r,n){return t.$on("object:updated",function(){return n._loadHistory(t.type,t.id)})},{link:t,templateUrl:"history/history.html",controller:"HistorySection",controllerAs:"vm",bindToController:!0,scope:{type:"=",name:"@",id:"=",projectId:"="}}},t.$inject=[],e.directive("tgHistorySection",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){function t(){}return t.$inject=[],t.prototype.diffTags=function(){if("tags"===this.type)return this.diffRemoveTags=_.difference(this.diff[0],this.diff[1]).toString(),this.diffAddTags=_.difference(this.diff[1],this.diff[0]).toString()},t}(),e.controller("ActivitiesDiffCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){var t;return t=function(t,e,r,n){return n.diffTags()},{scope:{type:"<",diff:"<"},templateUrl:"history/history/history-diff.html",controller:"ActivitiesDiffCtrl",controllerAs:"vm",bindToController:!0,link:t}},e.directive("tgHistoryDiff",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){var t;return t=function(t,e,r){},{scope:{activities:"<"},templateUrl:"history/history/history.html",link:t}},e.directive("tgHistory",t)}.call(this),function(){var t;t=function(t,e){var r;return r=function(t,r,n,i){return t.vm={},t.vm.duty=t.duty,t.vm.type=t.type,t.vm.getDutyType=function(){if(t.vm.duty){if("epics"===t.vm.duty.get("_name"))return e.instant("COMMON.EPIC");if("userstories"===t.vm.duty.get("_name"))return e.instant("COMMON.USER_STORY");if("tasks"===t.vm.duty.get("_name"))return e.instant("COMMON.TASK");if("issues"===t.vm.duty.get("_name"))return e.instant("COMMON.ISSUE")}}},{templateUrl:"home/duties/duty.html",scope:{duty:"=tgDuty",type:"@"},link:r}},t.$inject=["$tgNavUrls","$translate"],angular.module("taigaHome").directive("tgDuty",t)}.call(this),function(){var t;t=function(){function t(t,e,r){this.currentUserService=t,this.location=e,this.navUrls=r,this.currentUserService.getUser()||this.location.path(this.navUrls.resolve("discover"))}return t.$inject=["tgCurrentUserService","$location","$tgNavUrls"],t}(),angular.module("taigaHome").controller("Home",t)}.call(this),function(){var t,e,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;e=this.taiga.groupBy,t=function(t){function n(t,e,r){this.navurls=t,this.rs=e,this.projectsService=r}return r(n,t),n.$inject=["$tgNavUrls","tgResources","tgProjectsService"],n.prototype._attachProjectInfoToWorkInProgress=function(t,e){var r,n,i,o,s;return r=function(t){return function(r,n){var i,o,s;return o=e.get(String(r.get("project"))),i={project:o.get("slug"),ref:r.get("ref")},s=t.navurls.resolve("project-"+n+"-detail",i),r=r.set("url",s),r=r.set("project",o),r=r.set("_name",n)}}(this),i=function(t,n){return t=t.filter(function(t){return e.get(String(t.get("project")))}),t=t.map(function(t){return r(t,n)})},o=t.get("assignedTo"),o.get("epics")&&(n=i(o.get("epics"),"epics"),o=o.set("epics",n)),o.get("userStories")&&(n=i(o.get("userStories"),"userstories"),o=o.set("userStories",n)),o.get("tasks")&&(n=i(o.get("tasks"),"tasks"),o=o.set("tasks",n)),o.get("issues")&&(n=i(o.get("issues"),"issues"),o=o.set("issues",n)),s=t.get("watching"),s.get("epics")&&(n=i(s.get("epics"),"epics"),s=s.set("epics",n)),s.get("userStories")&&(n=i(s.get("userStories"),"userstories"),s=s.set("userStories",n)),s.get("tasks")&&(n=i(s.get("tasks"),"tasks"),s=s.set("tasks",n)),s.get("issues")&&(n=i(s.get("issues"),"issues"),s=s.set("issues",n)),t=t.set("assignedTo",o),t=t.set("watching",s)},n.prototype.getWorkInProgress=function(t){var r,n,i,o,s,a,u,c,l,p,f,d,h,g,m,v;return l=Immutable.Map(),p=this.projectsService.getProjectsByUserId(t).then(function(t){return l=Immutable.fromJS(e(t.toJS(),function(t){return t.id}))}),o=Immutable.Map(),a={status__is_closed:!1,assigned_to:t},c={is_closed:!1,assigned_to:t},u={is_closed:!1,assigned_to:t},r=this.rs.epics.listInAllProjects(u).then(function(t){return o=o.set("epics",t)}),s=this.rs.userstories.listInAllProjects(c).then(function(t){return o=o.set("userStories",t)}),i=this.rs.tasks.listInAllProjects(a).then(function(t){return o=o.set("tasks",t)}),n=this.rs.issues.listInAllProjects(a).then(function(t){return o=o.set("issues",t)}),a={status__is_closed:!1,watchers:t},c={is_closed:!1,watchers:t},u={is_closed:!1,watchers:t},f=Immutable.Map(),d=this.rs.epics.listInAllProjects(u).then(function(t){return f=f.set("epics",t)}),m=this.rs.userstories.listInAllProjects(c).then(function(t){return f=f.set("userStories",t)}),g=this.rs.tasks.listInAllProjects(a).then(function(t){return f=f.set("tasks",t)}),h=this.rs.issues.listInAllProjects(a).then(function(t){return f=f.set("issues",t)}),v=Immutable.Map(),Promise.all([p,r,d,s,m,i,g,n,h]).then(function(t){return function(){return v=v.set("assignedTo",o),v=v.set("watching",f),v=t._attachProjectInfoToWorkInProgress(v,l)}}(this))},n}(taiga.Service),angular.module("taigaHome").service("tgHomeService",t)}.call(this),function(){var t;t=function(t,e){var r,n;return n=function(r,n,i,o){return r.vm={},taiga.defineImmutableProperty(r.vm,"projects",function(){return t.projects.get("recents")}),r.vm.newProject=function(){return e.newProject()}},r={templateUrl:"home/projects/home-project-list.html",scope:{},link:n}},t.$inject=["tgCurrentUserService","tgProjectsService"],angular.module("taigaHome").directive("tgHomeProjectList",t)}.call(this),function(){var t;t=function(){function t(t){this.homeService=t,this.assignedTo=Immutable.Map(),this.watching=Immutable.Map()}return t.$inject=["tgHomeService"],t.prototype._setAssignedTo=function(t){var e,r,n,i;if(e=t.get("assignedTo").get("epics"),i=t.get("assignedTo").get("userStories"),n=t.get("assignedTo").get("tasks"),r=t.get("assignedTo").get("issues"),this.assignedTo=i.concat(n).concat(r).concat(e),this.assignedTo.size>0)return this.assignedTo=this.assignedTo.sortBy(function(t){return t.get("modified_date")}).reverse()},t.prototype._setWatching=function(t){var e,r,n,i;if(e=t.get("watching").get("epics"),i=t.get("watching").get("userStories"),n=t.get("watching").get("tasks"),r=t.get("watching").get("issues"),this.watching=i.concat(n).concat(r).concat(e),this.watching.size>0)return this.watching=this.watching.sortBy(function(t){return t.get("modified_date")}).reverse()},t.prototype.getWorkInProgress=function(t){return this.homeService.getWorkInProgress(t).then(function(t){return function(e){return t._setAssignedTo(e),t._setWatching(e)}}(this))},t}(),angular.module("taigaHome").controller("WorkingOn",t)}.call(this),function(){var t;t=function(t,e){var r;return r=function(t,r,n,i){var o,s;if(o=e.getUser())return s=o.get("id"),i.getWorkInProgress(s)},{controller:"WorkingOn",controllerAs:"vm",templateUrl:"home/working-on/working-on.html",scope:{},link:r}},t.$inject=["tgHomeService","tgCurrentUserService"],angular.module("taigaHome").directive("tgWorkingOn",t)}.call(this),function(){var t;t=function(t,e){var r,n;return n=function(r,n,i,o){return r.vm={},taiga.defineImmutableProperty(r.vm,"projects",function(){return t.projects.get("recents")}),r.vm.newProject=function(){return e.newProject()}},r={templateUrl:"navigation-bar/dropdown-project-list/dropdown-project-list.html",scope:{},link:n}},t.$inject=["tgCurrentUserService","tgProjectsService"],angular.module("taigaNavigationBar").directive("tgDropdownProjectList",t)}.call(this),function(){var t;t=function(t,e,r,n,i,o){var s,a;return a=function(s,a,u,c){return s.vm={},s.vm.isFeedbackEnabled=e.get("feedbackEnabled"),taiga.defineImmutableProperty(s.vm,"user",function(){return t.userData}),s.vm.logout=function(){return t.logout(),r.url(n.resolve("discover")),r.search({})},s.vm.sendFeedback=function(){return i.sendFeedback()},s.vm.userSettingsPlugins=_.filter(o.userSettingsPlugins,{userMenu:!0})},s={templateUrl:"navigation-bar/dropdown-user/dropdown-user.html",scope:{},link:a}},t.$inject=["$tgAuth","$tgConfig","$tgLocation","$tgNavUrls","tgFeedbackService","$rootScope"],angular.module("taigaNavigationBar").directive("tgDropdownUser",t)}.call(this),function(){var t;t=function(t,e,r,n,i){var o,s;return s=function(o,s,a,u){return o.vm={},taiga.defineImmutableProperty(o.vm,"projects",function(){return t.projects.get("recents")}),taiga.defineImmutableProperty(o.vm,"isAuthenticated",function(){return t.isAuthenticated()}),taiga.defineImmutableProperty(o.vm,"isEnabledHeader",function(){return e.isEnabledHeader()}),o.vm.publicRegisterEnabled=i.get("publicRegisterEnabled"),o.vm.login=function(){var t;return t=encodeURIComponent(r.url()),r.url(n.resolve("login")),r.search({next:t})},o.vm.register=function(){var t;return t=encodeURIComponent(r.url()),r.url(n.resolve("register")),r.search({next:t})},o.$on("$routeChangeSuccess",function(){return"/"===r.path()?o.vm.active=!0:o.vm.active=!1})},o={templateUrl:"navigation-bar/navigation-bar.html",scope:{},link:s}},t.$inject=["tgCurrentUserService","tgNavigationBarService","$tgLocation","$tgNavUrls","$tgConfig"],angular.module("taigaNavigationBar").directive("tgNavigationBar",t)}.call(this),function(){var t,e=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,
t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function r(){this.disableHeader()}return e(r,t),r.prototype.enableHeader=function(){return this.enabledHeader=!0},r.prototype.disableHeader=function(){return this.enabledHeader=!1},r.prototype.isEnabledHeader=function(){return this.enabledHeader},r}(taiga.Service),angular.module("taigaNavigationBar").service("tgNavigationBarService",t)}.call(this),function(){var t;t=function(){function t(t){this.userService=t,this.loadStats()}return t.$inject=["tgUserService"],t.prototype.loadStats=function(){return this.userService.getStats(this.user.get("id")).then(function(t){return function(e){return t.stats=e}}(this))},t}(),angular.module("taigaProfile").controller("ProfileBar",t)}.call(this),function(){var t;t=function(){return{templateUrl:"profile/profile-bar/profile-bar.html",controller:"ProfileBar",controllerAs:"vm",scope:{user:"=user",isCurrentUser:"=iscurrentuser"},bindToController:!0}},angular.module("taigaProfile").directive("tgProfileBar",t)}.call(this),function(){var t;t=function(){function t(t,e){this.userService=t,this.currentUserService=e,this.currentUser=this.currentUserService.getUser(),this.isCurrentUser=!1,this.currentUser&&this.currentUser.get("id")===this.user.get("id")&&(this.isCurrentUser=!0)}return t.$inject=["tgUserService","tgCurrentUserService"],t.prototype.loadContacts=function(){return this.userService.getContacts(this.user.get("id")).then(function(t){return function(e){return t.contacts=e}}(this))},t}(),angular.module("taigaProfile").controller("ProfileContacts",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){return n.loadContacts()},{templateUrl:"profile/profile-contacts/profile-contacts.html",scope:{user:"="},controllerAs:"vm",controller:"ProfileContacts",link:t,bindToController:!0}},angular.module("taigaProfile").directive("tgProfileContacts",t)}.call(this),function(){var t;t=function(){var t,e;return t=function(t,e,r,n){return t.vm={item:t.item}},e=function(t,e){return"project"===e.itemType?"profile/profile-favs/items/project.html":"profile/profile-favs/items/ticket.html"},{scope:{item:"=tgFavItem"},link:t,templateUrl:e}},angular.module("taigaProfile").directive("tgFavItem",t)}.call(this),function(){var t,e,r,n,i,o=function(t,e){function r(){this.constructor=t}for(var n in e)s.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=this.taiga.debounceLeading,t=function(){function t(){this._init()}return t.prototype._init=function(){return this.enableFilterByAll=!0,this.enableFilterByProjects=!0,this.enableFilterByEpics=!0,this.enableFilterByUserStories=!0,this.enableFilterByTasks=!0,this.enableFilterByIssues=!0,this.enableFilterByTextQuery=!0,this._resetList(),this.q=null,this.type=null},t.prototype._resetList=function(){return this.items=Immutable.List(),this.scrollDisabled=!1,this._page=1},t.prototype._enableLoadingSpinner=function(){return this.isLoading=!0},t.prototype._disableLoadingSpinner=function(){return this.isLoading=!1},t.prototype._enableScroll=function(){return this.scrollDisabled=!1},t.prototype._disableScroll=function(){return this.scrollDisabled=!0},t.prototype._checkIfHasMorePages=function(t){return t?(this._page+=1,this._enableScroll()):this._disableScroll()},t.prototype._checkIfHasNoResults=function(){return this.hasNoResults=0===this.items.size},t.prototype.loadItems=function(){return this._enableLoadingSpinner(),this._disableScroll(),this._getItems(this.user.get("id"),this._page,this.type,this.q).then(function(t){return function(e){return t.items=t.items.concat(e.get("data")),t._checkIfHasMorePages(e.get("next")),t._checkIfHasNoResults(),t._disableLoadingSpinner(),t.items}}(this))["catch"](function(t){return function(){return t._disableLoadingSpinner(),t.items}}(this))},t.prototype.filterByTextQuery=i(500,function(){return this._resetList(),this.loadItems()}),t.prototype.showAll=function(){if(null!==this.type)return this.type=null,this._resetList(),this.loadItems()},t.prototype.showProjectsOnly=function(){if("project"!==this.type)return this.type="project",this._resetList(),this.loadItems()},t.prototype.showEpicsOnly=function(){if("epic"!==this.type)return this.type="epic",this._resetList(),this.loadItems()},t.prototype.showUserStoriesOnly=function(){if("userstory"!==this.type)return this.type="userstory",this._resetList(),this.loadItems()},t.prototype.showTasksOnly=function(){if("task"!==this.type)return this.type="task",this._resetList(),this.loadItems()},t.prototype.showIssuesOnly=function(){if("issue"!==this.type)return this.type="issue",this._resetList(),this.loadItems()},t}(),e=function(t){function e(t){this.userService=t,e.__super__.constructor.call(this),this.tabName="likes",this.enableFilterByAll=!1,this.enableFilterByProjects=!1,this.enableFilterByEpics=!1,this.enableFilterByUserStories=!1,this.enableFilterByTasks=!1,this.enableFilterByIssues=!1,this.enableFilterByTextQuery=!0,this._getItems=this.userService.getLiked}return o(e,t),e.$inject=["tgUserService"],e}(t),angular.module("taigaProfile").controller("ProfileLiked",e),r=function(t){function e(t){this.userService=t,e.__super__.constructor.call(this),this.tabName="upvotes",this.enableFilterByAll=!0,this.enableFilterByProjects=!1,this.enableFilterByEpics=!0,this.enableFilterByUserStories=!0,this.enableFilterByTasks=!0,this.enableFilterByIssues=!0,this.enableFilterByTextQuery=!0,this._getItems=this.userService.getVoted}return o(e,t),e.$inject=["tgUserService"],e}(t),angular.module("taigaProfile").controller("ProfileVoted",r),n=function(t){function e(t){this.userService=t,e.__super__.constructor.call(this),this.tabName="watchers",this._getItems=this.userService.getWatched}return o(e,t),e.$inject=["tgUserService"],e}(t),angular.module("taigaProfile").controller("ProfileWatched",n)}.call(this),function(){var t,e,r,n;n={scope:{},bindToController:{user:"=",type:"@",q:"@",scrollDisabled:"@",isLoading:"@",hasNoResults:"@"},controller:null,controllerAs:"vm",templateUrl:"profile/profile-favs/profile-favs.html"},t=function(){return _.extend({},n,{controller:"ProfileLiked"})},angular.module("taigaProfile").directive("tgProfileLiked",t),e=function(){return _.extend({},n,{controller:"ProfileVoted"})},angular.module("taigaProfile").directive("tgProfileVoted",e),r=function(){return _.extend({},n,{controller:"ProfileWatched"})},angular.module("taigaProfile").directive("tgProfileWatched",r)}.call(this),function(){var t;t=function(){function t(t){var e;this.translate=t,e=Math.floor(Math.random()*this.HINTS.length)+1,this.hint=this.HINTS[e-1],this.hint.linkText=this.hint.linkText||"HINTS.LINK",this.hint.title=this.translate.instant("HINTS.HINT"+e+"_TITLE"),this.hint.text=this.translate.instant("HINTS.HINT"+e+"_TEXT")}return t.prototype.HINTS=[{url:"https://tree.taiga.io/support/admin/import-export-projects/"},{url:"https://tree.taiga.io/support/admin/custom-fields/"},{},{}],t}(),t.$inject=["$translate"],angular.module("taigaProfile").controller("ProfileHints",t)}.call(this),function(){var t;t=function(t){return{scope:{},controller:"ProfileHints",controllerAs:"vm",templateUrl:"profile/profile-hints/profile-hints.html"}},t.$inject=["$translate"],angular.module("taigaProfile").directive("tgProfileHints",t)}.call(this),function(){var t;t=function(){function t(t,e){this.projectsService=t,this.userService=e}return t.$inject=["tgProjectsService","tgUserService"],t.prototype.loadProjects=function(){return this.projectsService.getProjectsByUserId(this.user.get("id")).then(function(t){return function(e){return t.userService.attachUserContactsToProjects(t.user.get("id"),e)}}(this)).then(function(t){return function(e){return t.projects=e}}(this))},t}(),angular.module("taigaProfile").controller("ProfileProjects",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){return n.loadProjects()},{templateUrl:"profile/profile-projects/profile-projects.html",scope:{user:"="},link:t,bindToController:!0,controllerAs:"vm",controller:"ProfileProjects"}},angular.module("taigaProfile").directive("tgProfileProjects",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n,i){if(t.tab={},r.$observe("tgProfileTab",function(e){return t.tab.name=e}),r.$observe("tabTitle",function(e){return t.tab.title=e}),t.tab.icon=r.tabIcon,t.tab.active=!!r.tabActive,t.$eval(r.tabDisabled)!==!0)return n.addTab(t.tab)},{templateUrl:"profile/profile-tab/profile-tab.html",scope:{},require:"^tgProfileTabs",link:t,transclude:!0}},angular.module("taigaProfile").directive("tgProfileTab",t)}.call(this),function(){var t;t=function(){function t(){this.tabs=[]}return t.prototype.addTab=function(t){return this.tabs.push(t)},t.prototype.toggleTab=function(t){return _.map(this.tabs,function(t){return t.active=!1}),t.active=!0},t}(),angular.module("taigaProfile").controller("ProfileTabs",t)}.call(this),function(){var t;t=function(){return{scope:{},controller:"ProfileTabs",controllerAs:"vm",templateUrl:"profile/profile-tabs/profile-tabs.html",transclude:!0}},angular.module("taigaProfile").directive("tgProfileTabs",t)}.call(this),function(){var t;t=function(){function t(t,e,r,n,i,o){this.appMetaService=t,this.currentUserService=e,this.routeParams=r,this.userService=n,this.xhrError=i,this.translate=o,this.isCurrentUser=!1,this.routeParams.slug?this.userService.getUserByUserName(this.routeParams.slug).then(function(t){return function(e){return e.get("is_active")?(t.user=e,t.isCurrentUser=!1,t._setMeta(t.user),e):t.xhrError.notFound()}}(this))["catch"](function(t){return function(e){return t.xhrError.response(e)}}(this)):(this.user=this.currentUserService.getUser(),this.isCurrentUser=!0,this._setMeta(this.user))}return t.$inject=["tgAppMetaService","tgCurrentUserService","$routeParams","tgUserService","tgXhrErrorService","$translate"],t.prototype._setMeta=function(t){var e,r,n;return e={userFullName:t.get("full_name_display"),userUsername:t.get("username")},n=this.translate.instant("USER.PROFILE.PAGE_TITLE",e),r=t.get("bio"),this.appMetaService.setAll(n,r)},t}(),angular.module("taigaProfile").controller("Profile",t)}.call(this),function(){var t;t=function(){return{templateUrl:"projects/project/blocked-project-explanation.html"}},angular.module("taigaProjects").directive("tgBlockedProjectExplanation",t)}.call(this),function(){var t;t=function(){function t(t,e){this.confirm=t,this.likeButtonService=e,this.isMouseOver=!1,this.loading=!1}return t.$inject=["$tgConfirm","tgLikeProjectButtonService"],t.prototype.showTextWhenMouseIsOver=function(){return this.isMouseOver=!0},t.prototype.showTextWhenMouseIsLeave=function(){return this.isMouseOver=!1},t.prototype.toggleLike=function(){var t;return this.loading=!0,t=this.project.get("is_fan")?this._unlike():this._like(),t["finally"](function(t){return function(){return t.loading=!1}}(this)),t},t.prototype._like=function(){return this.likeButtonService.like(this.project.get("id")).then(function(t){return function(){return t.showTextWhenMouseIsLeave()}}(this))["catch"](function(t){return function(){return t.confirm.notify("error")}}(this))},t.prototype._unlike=function(){return this.likeButtonService.unlike(this.project.get("id"))["catch"](function(t){return function(){return t.confirm.notify("error")}}(this))},t}(),angular.module("taigaProjects").controller("LikeProjectButton",t)}.call(this),function(){var t;t=function(){return{scope:{},controller:"LikeProjectButton",bindToController:{project:"="},controllerAs:"vm",templateUrl:"projects/components/like-project-button/like-project-button.html"}},angular.module("taigaProjects").directive("tgLikeProjectButton",t)}.call(this),function(){var t,e,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;e=this.taiga,t=function(t){function e(t,e,r){this.rs=t,this.currentUserService=e,this.projectService=r}return r(e,t),e.$inject=["tgResources","tgCurrentUserService","tgProjectService"],e.prototype._getProjectIndex=function(t){return this.currentUserService.projects.get("all").findIndex(function(e){return e.get("id")===t})},e.prototype._updateProjects=function(t,e){var r,n;if(r=this._getProjectIndex(t),r!==-1)return n=this.currentUserService.projects.get("all").update(r,function(t){var r;return r=t.get("total_fans"),e?r++:r--,t.merge({is_fan:e,total_fans:r})}),this.currentUserService.setProjects(n)},e.prototype._updateCurrentProject=function(t){var e,r;return r=this.projectService.project.get("total_fans"),t?r++:r--,e=this.projectService.project.merge({is_fan:t,total_fans:r}),this.projectService.setProject(e)},e.prototype.like=function(t){return this.rs.projects.likeProject(t).then(function(e){return function(){return e._updateProjects(t,!0),e._updateCurrentProject(!0)}}(this))},e.prototype.unlike=function(t){return this.rs.projects.unlikeProject(t).then(function(e){return function(){return e._updateProjects(t,!1),e._updateCurrentProject(!1)}}(this))},e}(e.Service),angular.module("taigaProjects").service("tgLikeProjectButtonService",t)}.call(this),function(){var t;t=function(t){var e,r;return r=function(e,r,n,i){var o,s,a;return s=null,o=dragula([r[0]],{copySortSource:!1,copy:!1,mirrorContainer:r[0],moves:function(t){return $(t).hasClass("list-itemtype-project")}}),o.on("dragend",function(r){var n,i,o,a,u,c,l;for(s=$(r),a=s.scope().project,i=s.index(),c=_.map(e.projects.toJS(),function(t){return t.id}),c=_.without(c,a.get("id")),c.splice(i,0,a.get("id")),u=[],i=n=0,o=c.length;nf?(d={status:413,data:{_error_message:"'"+c.name+"' ("+r(c.size)+") is too heavy for our oompa loompas, try it with a smaller than ("+r(f)+")"}},p.reject(d),p.promise):(v=function(t){return function(t){return i.$apply(function(){return c.status="in-progress",c.size=r(t.total),c.progressMessage="upload "+r(t.loaded)+" of "+r(t.total),c.progressPercent=Math.round(t.loaded/t.total*100)+"%"})}}(this),g=function(t){return function(t){return i.$apply(function(){var e,r,n;c.status="done",n=t.target.status;try{e=JSON.parse(t.target.responseText)}catch(i){e={}}return n>=200&&n<400?(e=Immutable.fromJS(e),p.resolve(e)):(d={status:n,data:{_error_message:null!=(r=l.attached_file)?r[0]:void 0}},p.reject(d))})}}(this),m=function(t){return function(t){return i.$apply(function(){return c.status="error",p.reject("fail")})}}(this),l=new FormData,l.append("project",a),l.append("object_id",u),l.append("attached_file",c),b=new XMLHttpRequest,b.upload.addEventListener("progress",v,!1),b.addEventListener("load",g,!1),b.addEventListener("error",m,!1),h=s.get("token"),b.open("POST",y),b.setRequestHeader("Authorization","Bearer "+h),b.setRequestHeader("Accept","application/json"),b.send(l),p.promise))},function(){return{attachments:a}}},t.$inject=["$tgUrls","$tgHttp","$tgConfig","$rootScope","$q","$tgStorage"],e=angular.module("taigaResources2"),e.factory("tgAttachmentsResource",t)}.call(this),function(){var t,e;t=function(t,e){var r;return r={},r.listInAllProjects=function(r){var n,i;return i=t.resolve("epics"),n={headers:{"x-disable-pagination":"1"}},e.get(i,r,n).then(function(t){return Immutable.fromJS(t.data)})},r.list=function(r){var n,i;return i=t.resolve("epics"),n={project:r},e.get(i,n).then(function(t){return Immutable.fromJS(t.data)})},r.patch=function(r,n){var i;return i=t.resolve("epics")+("/"+r),e.patch(i,n).then(function(t){return Immutable.fromJS(t.data)})},r.post=function(r){var n;return n=t.resolve("epics"),e.post(n,r).then(function(t){return Immutable.fromJS(t.data)})},r.reorder=function(r,n,i){var o,s;return s=t.resolve("epics")+("/"+r),o={headers:{"set-orders":JSON.stringify(i)}},e.patch(s,n,null,o)},r.addRelatedUserstory=function(r,n){var i,o;return o=t.resolve("epic-related-userstories",r),i={user_story:n,epic:r},e.post(o,i)},r.reorderRelatedUserstory=function(r,n,i,o){var s,a;return a=t.resolve("epic-related-userstories",r)+("/"+n),s={headers:{"set-orders":JSON.stringify(o)}},e.patch(a,i,null,s)},r.bulkCreateRelatedUserStories=function(r,n,i){var o,s;return s=t.resolve("epic-related-userstories-bulk-create",r),o={bulk_userstories:i,project_id:n},e.post(s,o)},r.deleteRelatedUserstory=function(r,n){var i;return i=t.resolve("epic-related-userstories",r)+("/"+n),e["delete"](i)},function(){return{epics:r}}},t.$inject=["$tgUrls","$tgHttp"],e=angular.module("taigaResources2"),e.factory("tgEpicsResource",t)}.call(this),function(){var t,e;t=function(t,e){var r;return r={},r.getApplicationToken=function(r,n){var i;return i=t.resolve("applications"),i=i+"/"+r+"/token?state="+n,e.get(i).then(function(t){return Immutable.fromJS(t.data)})},r.authorizeApplicationToken=function(r,n){var i,o;return o=t.resolve("application-tokens"),o+="/authorize",i={state:n,application:r},e.post(o,i).then(function(t){return Immutable.fromJS(t.data)})},function(){return{externalapps:r}}},t.$inject=["$tgUrls","$tgHttp"],e=angular.module("taigaResources2"),e.factory("tgExternalAppsResource",t)}.call(this),function(){var t,e;t=function(t,e){var r;return r={},r.listInAllProjects=function(r){var n,i;return i=t.resolve("issues"),n={headers:{"x-disable-pagination":"1"}},e.get(i,r,n).then(function(t){return Immutable.fromJS(t.data)})},function(){return{issues:r}}},t.$inject=["$tgUrls","$tgHttp"],e=angular.module("taigaResources2"),e.factory("tgIssuesResource",t)}.call(this),function(){var t,e,r;r=function(){},t=function(t,e,r){var n;return n={},n.getProjects=function(r,n){var i,o;return null==r&&(r={}),null==n&&(n=!0),o=t.resolve("projects"),i={},n||(i={headers:{"x-lazy-pagination":!0}}),e.get(o,r,i)},n.getProjectBySlug=function(r){var n;return n=t.resolve("projects"),n=n+"/by_slug?slug="+r,e.get(n).then(function(t){return Immutable.fromJS(t.data)})},n.getProjectsByUserId=function(r,n){var i,o,s;return null==n&&(n=!1),s=t.resolve("projects"),i={},n||(i.headers={"x-disable-pagination":"1"}),o={member:r,order_by:"user_order"},e.get(s,o,i).then(function(t){return Immutable.fromJS(t.data)})},n.getProjectStats=function(r){var n;return n=t.resolve("projects"),n=n+"/"+r,e.get(n).then(function(t){return Immutable.fromJS(t.data)})},n.bulkUpdateOrder=function(r){var n;return n=t.resolve("bulk-update-projects-order"),e.post(n,r)},n.getTimeline=function(n,i){var o,s;return o={page:i,only_relevant:!0},s=t.resolve("timeline-project"),s=s+"/"+n,e.get(s,o,{headers:{"x-lazy-pagination":!0}}).then(function(t){return t=Immutable.fromJS(t),r(t)})},n.likeProject=function(r){var n;return n=t.resolve("project-like",r),e.post(n)},n.unlikeProject=function(r){var n;return n=t.resolve("project-unlike",r),e.post(n)},n.watchProject=function(r,n){var i,o;return i={notify_level:n},o=t.resolve("project-watch",r),e.post(o,i)},n.unwatchProject=function(r){var n;return n=t.resolve("project-unwatch",r),e.post(n)},n.transferValidateToken=function(r,n){var i,o;return i={token:n},o=t.resolve("project-transfer-validate-token",r),e.post(o,i)},n.transferAccept=function(r,n,i){var o,s;return o={token:n,reason:i},s=t.resolve("project-transfer-accept",r),e.post(s,o)},n.transferReject=function(r,n,i){var o,s;return o={token:n,reason:i},s=t.resolve("project-transfer-reject",r),e.post(s,o)},n.transferRequest=function(r){var n;return n=t.resolve("project-transfer-request",r),e.post(n)},n.transferStart=function(r,n,i){var o,s;return o={user:n,reason:i},s=t.resolve("project-transfer-start",r),e.post(s,o)},function(){return{projects:n}}},t.$inject=["$tgUrls","$tgHttp","tgPaginateResponseService"],e=angular.module("taigaResources2"),e.factory("tgProjectsResources",t)}.call(this),function(){var t,e;e=["tgProjectsResources","tgUserResources","tgUsersResources","tgUserstoriesResource","tgTasksResource","tgIssuesResource","tgExternalAppsResource","tgAttachmentsResource","tgStatsResource","tgWikiHistory","tgEpicsResource"],t=function(t){var r,n,i,o,s,a,u,c,l;for(r=0,i=e.length;r"),$("head").append(r)),r.text(e||"")):0===t.indexOf("og:")?(r=$("head meta[property='"+t+"']"),0===r.length&&(r=$(""),$("head").append(r)),r.attr("content",e||"")):(r=$("head meta[name='"+t+"']"),0===r.length&&(r=$(""),$("head").append(r)),r.attr("content",e||""))},t.prototype.setTitle=function(t){return this._set("title",t)},t.prototype.setDescription=function(t){return this._set("description",r(t,250))},t.prototype.setTwitterMetas=function(t,e){return this._set("twitter:card","summary"),this._set("twitter:site","@taigaio"),this._set("twitter:title",t),this._set("twitter:description",r(e,300)),this._set("twitter:image",window.location.origin+"/"+window._version+"/images/logo-color.png")},t.prototype.setOpenGraphMetas=function(t,e){return this._set("og:type","object"),this._set("og:site_name","Taiga - Love your projects"),this._set("og:title",t),this._set("og:description",r(e,300)),this._set("og:image",window.location.origin+"/"+window._version+"/images/logo-color.png"),this._set("og:url",window.location.href)},t.prototype.setAll=function(t,e){return this.setTitle(t),this.setDescription(e),this.setTwitterMetas(t,e),this.setOpenGraphMetas(t,e)},t.prototype.addMobileViewport=function(){return $("head").append('')},t.prototype.removeMobileViewport=function(){return $('head meta[name="viewport"]').remove()},t.prototype.setfn=function(t){return this.listener&&this._listener(),this._listener=this.rootScope.$watchCollection(t,function(t){return function(e){if(e)return t.setAll(e.title,e.description),t._listener()}}(this))},t}(),angular.module("taigaCommon").service("tgAppMetaService",t)}.call(this),function(){var t,e;e=this.taiga.sizeFormat,t=function(){function t(t,r,n,i){this.confirm=t,this.config=r,this.translate=n,this.rs=i,this.maxFileSize=this.getMaxFileSize(),this.maxFileSize&&(this.maxFileSizeFormated=e(this.maxFileSize))}return t.$inject=["$tgConfirm","$tgConfig","$translate","tgResources"],t.prototype.sizeError=function(t){var r;return r=this.translate.instant("ATTACHMENT.ERROR_MAX_SIZE_EXCEEDED",{fileName:t.name,fileSize:e(t.size),maxFileSize:this.maxFileSizeFormated}),this.confirm.notify("error",r)},t.prototype.validate=function(t){return!(this.maxFileSize&&t.size>this.maxFileSize)||(this.sizeError(t),!1)},t.prototype.getMaxFileSize=function(){return this.config.get("maxUploadFileSize",null)},t.prototype.list=function(t,e,r){return this.rs.attachments.list(t,e,r).then(function(t){return function(t){return t.sortBy(function(t){return t.get("order")})}}(this))},t.prototype["delete"]=function(t,e){return this.rs.attachments["delete"](t,e)},t.prototype.saveError=function(t,e){var r;return r="",t&&(r=this.translate.instant("ATTACHMENT.ERROR_UPLOAD_ATTACHMENT",{fileName:t.name,errorMessage:e.data._error_message})),this.confirm.notify("error",r)},t.prototype.upload=function(t,e,r,n){var i;return i=this.rs.attachments.create(n,r,e,t),i.then(null,this.saveError.bind(this,t)),i},t.prototype.patch=function(t,e,r){var n;return n=this.rs.attachments.patch(e,t,r),n.then(null,this.saveError.bind(this,null)),n},t}(),angular.module("taigaCommon").service("tgAttachmentsService",t)}.call(this),function(){var t,e=function(t,e){return(+t%(e=+e)+e)%e};t=function(){function t(){var t,e;e=["/"+window._version+"/images/user-avatars/user-avatar-01.png","/"+window._version+"/images/user-avatars/user-avatar-02.png","/"+window._version+"/images/user-avatars/user-avatar-03.png","/"+window._version+"/images/user-avatars/user-avatar-04.png","/"+window._version+"/images/user-avatars/user-avatar-05.png"],t=["rgba( 178, 176, 204, 1 )","rgba( 183, 203, 131, 1 )","rgba( 210, 198, 139, 1 )","rgba( 214, 161, 212, 1 )","rgba( 247, 154, 154, 1 )"],this.logos=_.cartesianProduct(e,t)}return t.prototype.getDefault=function(t){var r,n;return r=e(murmurhash3_32_gc(t,42),this.logos.length),n=this.logos[r],{src:n[0],color:n[1]}},t.prototype.getUnnamed=function(){return{url:"/"+window._version+"/images/unnamed.png"}},t.prototype.getAvatar=function(t,e){var r,n,i,o,s,a;return t?(r="photo","avatarBig"===e&&(r="big_photo"),s=null,t instanceof Immutable.Map?(n=t.get("gravatar_id"),s=t.get(r)):(n=t.gravatar_id,s=t[r]),n?s?{url:s}:location.host.indexOf("localhost")!==-1?(a=location.protocol+"//"+location.host,i=this.getDefault(n),{url:a+i.src,bg:i.color}):(a=location.protocol+"//"+location.host,i=this.getDefault(n),o=encodeURIComponent(a+i.src),{url:"https://www.gravatar.com/avatar/"+n+"?d="+o,bg:i.color}):this.getUnnamed()):this.getUnnamed()},t}(),angular.module("taigaCommon").service("tgAvatarService",t)}.call(this),function(){var t,e;e=this.taiga,t=function(){function t(t){this.projectService=t}return t.$inject=["tgProjectService"],t.prototype.check=function(t){return!!this.projectService.project&&this.projectService.project.get("my_permissions").indexOf(t)!==-1},t}(),angular.module("taigaCommon").service("tgCheckPermissionsService",t)}.call(this),function(){var t,e,r;r=this.taiga,e=this.taiga.groupBy,t=function(){function t(t,e,n){this.projectsService=t,this.storageService=e,this.rs=n,this._user=null,this._projects=Immutable.Map(),this._projectsById=Immutable.Map(),this._joyride=null,r.defineImmutableProperty(this,"projects",function(t){return function(){return t._projects}}(this)),r.defineImmutableProperty(this,"projectsById",function(t){return function(){return t._projectsById}}(this))}return t.$inject=["tgProjectsService","$tgStorage","tgResources"],t.prototype.isAuthenticated=function(){return null!==this.getUser()},t.prototype.getUser=function(){var t;return this._user||(t=this.storageService.get("userInfo"),t&&(t=Immutable.fromJS(t),this.setUser(t))),this._user},t.prototype.removeUser=function(){return this._user=null,this._projects=Immutable.Map(),this._projectsById=Immutable.Map(),this._joyride=null},t.prototype.setUser=function(t){return this._user=t,this._loadUserInfo()},t.prototype.bulkUpdateProjectsOrder=function(t){return this.projectsService.bulkUpdateProjectsOrder(t).then(function(t){return function(){return t.loadProjects()}}(this))},t.prototype.loadProjects=function(){return this.projectsService.getProjectsByUserId(this._user.get("id")).then(function(t){return function(e){return t.setProjects(e)}}(this))},t.prototype.disableJoyRide=function(t){return t?this._joyride[t]=!1:this._joyride={backlog:!1,kanban:!1,dashboard:!1},this.rs.user.setUserStorage("joyride",this._joyride)},t.prototype.loadJoyRideConfig=function(){return new Promise(function(t){return function(e){return null!==t._joyride?void e(t._joyride):t.rs.user.getUserStorage("joyride").then(function(r){return t._joyride=r,e(t._joyride)})["catch"](function(){return t._joyride={backlog:!0,kanban:!0,dashboard:!0},t.rs.user.createUserStorage("joyride",t._joyride),e(t._joyride)})}}(this))},t.prototype._loadUserInfo=function(){return Promise.all([this.loadProjects()])},t.prototype.setProjects=function(t){return this._projects=this._projects.set("all",t),this._projects=this._projects.set("recents",t.slice(0,10)),this._projectsById=Immutable.fromJS(e(t.toJS(),function(t){return t.id})),this.projects},t.prototype.canCreatePrivateProjects=function(){var t;return t=this.getUser(),null!==t.get("max_private_projects")&&t.get("total_private_projects")>=t.get("max_private_projects")?{valid:!1,reason:"max_private_projects",type:"private_project"}:{valid:!0}},t.prototype.canCreatePublicProjects=function(){var t;return t=this.getUser(),null!==t.get("max_public_projects")&&t.get("total_public_projects")>=t.get("max_public_projects")?{valid:!1,reason:"max_public_projects",type:"public_project"}:{valid:!0}},t.prototype.canOwnProject=function(t){var e,r;if(r=this.getUser(),t.get("is_private")){if(e=this.canCreatePrivateProjects(),!e.valid)return e;if(null!==r.get("max_memberships_private_projects")&&t.get("total_memberships")>r.get("max_memberships_private_projects"))return{valid:!1,reason:"max_members_private_projects",type:"private_project"}}else{if(e=this.canCreatePublicProjects(),!e.valid)return e;if(null!==r.get("max_memberships_public_projects")&&t.get("total_memberships")>r.get("max_memberships_public_projects"))return{valid:!1,reason:"max_members_public_projects",type:"public_project"}}return{valid:!0}},t}(),angular.module("taigaCommon").service("tgCurrentUserService",t)}.call(this),function(){var t,e;e=this.taiga,t=function(){function t(t){this.rootScope=t}return t.$inject=["$rootScope"],t.prototype.init=function(){return this.rootScope.errorHandling={}},t.prototype.notfound=function(){return this.rootScope.errorHandling.showingError=!0,this.rootScope.errorHandling.notfound=!0},t.prototype.error=function(){return this.rootScope.errorHandling.showingError=!0,this.rootScope.errorHandling.error=!0},t.prototype.permissionDenied=function(){return this.rootScope.errorHandling.showingError=!0,this.rootScope.errorHandling.permissionDenied=!0},t.prototype.block=function(){return this.rootScope.errorHandling.showingError=!0,this.rootScope.errorHandling.blocked=!0},t}(),angular.module("taigaCommon").service("tgErrorHandlingService",t)}.call(this),function(){var t;t=function(){function t(t,e){this.rootScope=t,this.compile=e}return t.$inject=["$rootScope","$compile"],t.prototype.create=function(t,e,r){var n,i,o;o=this.rootScope.$new(),o=_.merge(o,r),n=$("").attr(t,!0).attr("tg-bind-scope",!0),e&&n.attr(e),n.addClass("remove-on-close"),i=this.compile(n)(o),$(document.body).append(i)},t}(),angular.module("taigaCommon").service("tgLightboxFactory",t)}.call(this),function(){var t;t=function(){return function(t){var e;return e=Immutable.Map({data:t.get("data"),next:!!t.get("headers")("x-pagination-next"),prev:!!t.get("headers")("x-pagination-prev"),current:t.get("headers")("x-pagination-current"),count:t.get("headers")("x-pagination-count")})}},angular.module("taigaCommon").factory("tgPaginateResponseService",t)}.call(this),function(){var t,e=function(t,e){return(+t%(e=+e)+e)%e};t=function(){function t(){var t,e;e=["/"+window._version+"/images/project-logos/project-logo-01.png","/"+window._version+"/images/project-logos/project-logo-02.png","/"+window._version+"/images/project-logos/project-logo-03.png","/"+window._version+"/images/project-logos/project-logo-04.png","/"+window._version+"/images/project-logos/project-logo-05.png"],t=["rgba( 153, 214, 220, 1 )","rgba( 213, 156, 156, 1 )","rgba( 214, 161, 212, 1 )","rgba( 164, 162, 219, 1 )","rgba( 152, 224, 168, 1 )"],this.logos=_.cartesianProduct(e,t)}return t.prototype.getDefaultProjectLogo=function(t,r){var n,i,o;return i=t+"-"+r,n=e(murmurhash3_32_gc(i,42),this.logos.length),o=this.logos[n],{src:o[0],color:o[1]}},t}(),angular.module("taigaCommon").service("tgProjectLogoService",t)}.call(this),function(){var t,e;e=this.taiga,t=function(){function t(t,r){this.projectsService=t,this.xhrError=r,this._project=null,this._section=null,this._sectionsBreadcrumb=Immutable.List(),this._activeMembers=Immutable.List(),e.defineImmutableProperty(this,"project",function(t){return function(){return t._project}}(this)),e.defineImmutableProperty(this,"section",function(t){return function(){return t._section}}(this)),e.defineImmutableProperty(this,"sectionsBreadcrumb",function(t){return function(){return t._sectionsBreadcrumb}}(this)),e.defineImmutableProperty(this,"activeMembers",function(t){return function(){return t._activeMembers}}(this))}return t.$inject=["tgProjectsService","tgXhrErrorService"],t.prototype.cleanProject=function(){return this._project=null,this._activeMembers=Immutable.List(),this._section=null,this._sectionsBreadcrumb=Immutable.List()},t.prototype.setSection=function(t){return this._section=t,t?this._sectionsBreadcrumb=this._sectionsBreadcrumb.push(this._section):this._sectionsBreadcrumb=Immutable.List()},t.prototype.setProject=function(t){return this._project=t,this._activeMembers=this._project.get("members").filter(function(t){return t.get("is_active")})},t.prototype.setProjectBySlug=function(t){return new Promise(function(e){return function(r,n){return e.project&&e.project.get("slug")===t?r():e.projectsService.getProjectBySlug(t).then(function(t){return e.setProject(t),r()})["catch"](function(t){return e.xhrError.response(t)})}}(this))},t.prototype.fetchProject=function(){var t;return t=this.project.get("slug"),this.projectsService.getProjectBySlug(t).then(function(t){return function(e){return t.setProject(e)}}(this))},t.prototype.hasPermission=function(t){return this._project.get("my_permissions").indexOf(t)!==-1},t.prototype.isEpicsDashboardEnabled=function(){return this._project.get("is_epics_activated")},t}(),angular.module("taigaCommon").service("tgProjectService",t)}.call(this),function(){var t,e,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;e=this.taiga,t=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return r(e,t),e}(e.Service=function(){return{use:function(t){var e;return e=$("link[rel='stylesheet']:first"),0===e.length&&(e=$("
"),$("head").append(e)),e.attr("href","/"+window._version+"/styles/theme-"+t+".css")}}}),angular.module("taigaCommon").service("tgThemeService",t)}.call(this),function(){var t,e,r,n=function(t,e){function r(){this.constructor=t}for(var n in e)i.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty;r=this.taiga,e=r.bindMethods,t=function(t){function r(t){this.rs=t,e(this)}return n(r,t),r.$inject=["tgResources"],r.prototype.getUserByUserName=function(t){return this.rs.users.getUserByUsername(t)},r.prototype.getContacts=function(t){return this.rs.users.getContacts(t)},r.prototype.getLiked=function(t,e,r,n){return this.rs.users.getLiked(t,e,r,n)},r.prototype.getVoted=function(t,e,r,n){return this.rs.users.getVoted(t,e,r,n)},r.prototype.getWatched=function(t,e,r,n){return this.rs.users.getWatched(t,e,r,n)},r.prototype.getStats=function(t){return this.rs.users.getStats(t)},r.prototype.attachUserContactsToProjects=function(t,e){return this.getContacts(t).then(function(t){return e=e.map(function(e){var r;return r=t.filter(function(t){var r;return r=t.get("id"),e.get("members").indexOf(r)!==-1}),e=e.set("contacts",r)})})},r}(r.Service),angular.module("taigaCommon").service("tgUserService",t)}.call(this),function(){var t,e=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function r(t,e){this.q=t,this.errorHandlingService=e}return e(r,t),r.$inject=["$q","tgErrorHandlingService"],r.prototype.notFound=function(){return this.errorHandlingService.notfound()},r.prototype.permissionDenied=function(){return this.errorHandlingService.permissionDenied()},r.prototype.response=function(t){return t&&(404===t.status?this.notFound():403===t.status&&this.permissionDenied()),this.q.reject(t)},r}(taiga.Service),angular.module("taigaCommon").service("tgXhrErrorService",t)}.call(this),function(){var t;t=function(t,e){var r,n,i;return i=[".jpg",".jpeg",".bmp",".gif",".png"],r=function(t){return t=t.toLowerCase(),_.some(i,function(e){return t.indexOf(e,t-e.length)!==-1})},n=function(n,i){var o,s;return o=r(n.attachment.get("url")),s=o?t.get("user-timeline/user-timeline-attachment/user-timeline-attachment-image.html"):t.get("user-timeline/user-timeline-attachment/user-timeline-attachment.html"),i.html(s),e(i.contents())(n),i.find("img").error(function(){return this.remove()})},{link:n,scope:{attachment:"=tgUserTimelineAttachment"}}},t.$inject=["$tgTemplate","$compile"],angular.module("taigaUserTimeline").directive("tgUserTimelineAttachment",t)}.call(this),function(){var t,e;e=this.taiga.unslugify,t=function(){function t(t,e){this.translate=t,this.sce=e}return t.$inject=["$translate","$sce"],t.prototype._fieldTranslationKey={status:"COMMON.FIELDS.STATUS",subject:"COMMON.FIELDS.SUBJECT",description_diff:"COMMON.FIELDS.DESCRIPTION",points:"COMMON.FIELDS.POINTS",assigned_to:"COMMON.FIELDS.ASSIGNED_TO",severity:"ISSUES.FIELDS.SEVERITY",priority:"ISSUES.FIELDS.PRIORITY",type:"ISSUES.FIELDS.TYPE",is_iocaine:"TASK.FIELDS.IS_IOCAINE",is_blocked:"COMMON.FIELDS.IS_BLOCKED",color:"COMMON.FIELDS.COLOR"},t.prototype._params={username:function(t,e){var r,n,i;return i=t.getIn(["data","user"]),i.get("is_profile_visible")?(r=this.translate.instant("COMMON.SEE_USER_PROFILE",{username:i.get("username")}),n="user-profile:username=timeline.getIn(['data', 'user', 'username'])",this._getLink(n,i.get("name"),r)):this._getUsernameSpan(i.get("name"))},field_name:function(t,e){var r;return r=t.getIn(["data","value_diff","key"]),this.translate.instant(this._fieldTranslationKey[r])},project_name:function(t,e){var r;return r="project:project=timeline.getIn(['data', 'project', 'slug'])",this._getLink(r,t.getIn(["data","project","name"]))},new_value:function(t,e){var r,n;return _.isArray(t.getIn(["data","value_diff","value"]).toJS())?(n=t.getIn(["data","value_diff","value"]).get(1),null===n&&"assigned_to"===t.getIn(["data","value_diff","key"])&&(n=this.translate.instant("ACTIVITY.VALUES.UNASSIGNED")),r=n):r=t.getIn(["data","value_diff","value"]).first().get(1),_.escape(r)},sprint_name:function(t,e){var r;return r="project-taskboard:project=timeline.getIn(['data', 'project', 'slug']),sprint=timeline.getIn(['data', 'milestone', 'slug'])",this._getLink(r,t.getIn(["data","milestone","name"]))},us_name:function(t,e){var r,n,i,o;return n=this._getTimelineObj(t,e).get("userstory"),r={obj:"parent_userstory"},o=this._getDetailObjUrl(r),i="#"+n.get("ref")+" "+n.get("subject"),this._getLink(o,i)},related_us_name:function(t,e){var r,n,i;return r=t.getIn(["data","userstory"]),i="project-userstories-detail:project=timeline.getIn(['data', 'userstory', 'project', 'slug']),ref=timeline.getIn(['data', 'userstory', 'ref'])",n="#"+r.get("ref")+" "+r.get("subject"),this._getLink(i,n)},epic_name:function(t,e){var r,n,i;return r=t.getIn(["data","epic"]),i="project-epics-detail:project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['data', 'epic', 'ref'])",n="#"+r.get("ref")+" "+r.get("subject"),this._getLink(i,n)},obj_name:function(t,r){var n,i,o;return n=this._getTimelineObj(t,r),o=this._getDetailObjUrl(r),i="wikipage"===r.obj?e(n.get("slug")):"milestone"===r.obj?n.get("name"):"#"+n.get("ref")+" "+n.get("subject"),this._getLink(o,i)},role_name:function(t,e){return _.escape(t.getIn(["data","value_diff","value"]).keySeq().first())}},t.prototype._translateTitleParams=function(t,e,r){return this._params[t].call(this,e,r)},t.prototype._getTimelineObj=function(t,e){return t.getIn(["data",e.obj])},t.prototype._getDetailObjUrl=function(t){var e;return e={issue:["project-issues-detail",":project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['obj', 'ref'])"],wikipage:["project-wiki-page",":project=timeline.getIn(['data', 'project', 'slug']),slug=timeline.getIn(['obj', 'slug'])"],task:["project-tasks-detail",":project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['obj', 'ref'])"],userstory:["project-userstories-detail",":project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['obj', 'ref'])"],parent_userstory:["project-userstories-detail",":project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['obj', 'userstory', 'ref'])"],milestone:["project-taskboard",":project=timeline.getIn(['data', 'project', 'slug']),sprint=timeline.getIn(['obj', 'slug'])"],epic:["project-epics-detail",":project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['obj', 'ref'])"]},e[t.obj][0]+e[t.obj][1]},t.prototype._getLink=function(t,e,r){var n;return r=r||e,n=$("
").attr("ng-non-bindable",!0).text(e),$("").attr("tg-nav",t).attr("title",r).append(n).prop("outerHTML")},t.prototype._getUsernameSpan=function(t){var e;return e=e||t,$("").addClass("username").text(t).prop("outerHTML")},t.prototype._getParams=function(t,e,r){var n;return n={},r.translate_params.forEach(function(r){return function(i){return n[i]=r._translateTitleParams(i,t,e)}}(this)),n},t.prototype.getTitle=function(t,e,r){var n,i,o;return n=this._getParams(t,e,r),i={},Object.keys(n).forEach(function(t){return i[t]="{{"+t+"}}"}),o=this.translate.instant(r.key,i),Object.keys(n).forEach(function(t){var e;return e="{{"+t+"}}",o=o.replace(new RegExp(e,"g"),n[t])}),o},t}(),angular.module("taigaUserTimeline").service("tgUserTimelineItemTitle",t)}.call(this),function(){var t,e;e=function(t,e){var r;return r=[{check:function(t,e){return"membership"===e.obj},key:"TIMELINE.NEW_MEMBER",translate_params:["project_name"],member:function(t){return Immutable.Map({user:t.getIn(["data","user"]),role:t.getIn(["data","role"])})}},{check:function(t,e){return"project"===e.obj&&"create"===e.type},key:"TIMELINE.NEW_PROJECT",translate_params:["username","project_name"],description:function(t){return t.getIn(["data","project","description"])}},{check:function(t,e){return"change"===e.type&&t.hasIn(["data","value_diff"])&&"attachments"===t.getIn(["data","value_diff","key"])},key:"TIMELINE.UPLOAD_ATTACHMENT",translate_params:["username","obj_name"]},{check:function(t,e){return"userstory"===e.obj&&"create"===e.type},key:"TIMELINE.US_CREATED",translate_params:["username","project_name","obj_name"]},{check:function(t,e){return"issue"===e.obj&&"create"===e.type},key:"TIMELINE.ISSUE_CREATED",translate_params:["username","project_name","obj_name"]},{check:function(t,e){return"wikipage"===e.obj&&"create"===e.type},key:"TIMELINE.WIKI_CREATED",translate_params:["username","project_name","obj_name"]},{check:function(t,e){return"task"===e.obj&&"create"===e.type&&!t.getIn(["data","task","userstory"])},key:"TIMELINE.TASK_CREATED",translate_params:["username","project_name","obj_name"]},{check:function(t,e){return"task"===e.obj&&"create"===e.type&&t.getIn(["data","task","userstory"])},key:"TIMELINE.TASK_CREATED_WITH_US",translate_params:["username","project_name","obj_name","us_name"]},{check:function(t,e){return"milestone"===e.obj&&"create"===e.type},key:"TIMELINE.MILESTONE_CREATED",translate_params:["username","project_name","obj_name"]},{check:function(t,e){return"epic"===e.obj&&"create"===e.type},key:"TIMELINE.EPIC_CREATED",translate_params:["username","project_name","obj_name"]},{check:function(t,e){return"relateduserstory"===e.obj&&"create"===e.type},key:"TIMELINE.EPIC_RELATED_USERSTORY_CREATED",translate_params:["username","project_name","related_us_name","epic_name"]},{check:function(t,e){return t.getIn(["data","comment"])&&"userstory"===e.obj},key:"TIMELINE.NEW_COMMENT_US",translate_params:["username","obj_name"],description:function(t){var e;return e=t.getIn(["data","comment_html"]),$($.parseHTML(e)).text()}},{check:function(t,e){return t.getIn(["data","comment"])&&"issue"===e.obj},key:"TIMELINE.NEW_COMMENT_ISSUE",translate_params:["username","obj_name"],description:function(t){var e;return e=t.getIn(["data","comment_html"]),$($.parseHTML(e)).text()}},{check:function(t,e){return t.getIn(["data","comment"])&&"task"===e.obj},key:"TIMELINE.NEW_COMMENT_TASK",translate_params:["username","obj_name"],description:function(t){var e;return e=t.getIn(["data","comment_html"]),$($.parseHTML(e)).text()}},{check:function(t,e){return t.getIn(["data","comment"])&&"epic"===e.obj},key:"TIMELINE.NEW_COMMENT_EPIC",translate_params:["username","obj_name"],description:function(t){var e;return e=t.getIn(["data","comment_html"]),$($.parseHTML(e)).text()}},{check:function(t,e){return t.hasIn(["data","value_diff"])&&"moveInBacklog"===t.getIn(["data","value_diff","key"])&&t.hasIn(["data","value_diff","value","backlog_order"])&&"change"===e.type},key:"TIMELINE.US_MOVED",translate_params:["username","obj_name"]},{check:function(t,e){return!(!t.hasIn(["data","value_diff"])||"moveInBacklog"!==t.getIn(["data","value_diff","key"])||"change"!==e.type||"userstory"!==e.obj)&&null===t.getIn(["data","value_diff","value","milestone"]).get(1)},key:"TIMELINE.US_REMOVED_FROM_MILESTONE",translate_params:["username","obj_name"]},{check:function(t,e){return t.hasIn(["data","value_diff"])&&"moveInBacklog"===t.getIn(["data","value_diff","key"])&&"change"===e.type&&"userstory"===e.obj},key:"TIMELINE.US_ADDED_MILESTONE",translate_params:["username","obj_name","sprint_name"]},{check:function(t,e){return!(!t.hasIn(["data","value_diff"])||"blocked"!==t.getIn(["data","value_diff","key"])||"change"!==e.type)&&t.getIn(["data","value_diff","value","is_blocked"]).get(1)===!0},key:"TIMELINE.BLOCKED",translate_params:["username","obj_name"],description:function(t){var e;return!!t.hasIn(["data","value_diff","value","blocked_note_html"])&&(e=t.getIn(["data","value_diff","value","blocked_note_html"]).get(1),$($.parseHTML(e)).text())}},{check:function(t,e){return!(!t.hasIn(["data","value_diff"])||"blocked"!==t.getIn(["data","value_diff","key"])||"change"!==e.type)&&t.getIn(["data","value_diff","value","is_blocked"]).get(1)===!1},key:"TIMELINE.UNBLOCKED",translate_params:["username","obj_name"]},{check:function(t,e){return"milestone"===e.obj&&"change"===e.type},key:"TIMELINE.MILESTONE_UPDATED",translate_params:["username","obj_name"]},{check:function(t,e){return"wikipage"===e.obj&&"change"===e.type},key:"TIMELINE.WIKI_UPDATED",translate_params:["username","obj_name"]},{check:function(t,e){return"userstory"===e.obj&&"change"===e.type&&t.hasIn(["data","value_diff"])&&"points"===t.getIn(["data","value_diff","key"])},key:"TIMELINE.US_UPDATED_POINTS",translate_params:["username","field_name","obj_name","new_value","role_name"]},{check:function(t,e){return"userstory"===e.obj&&"change"===e.type&&t.hasIn(["data","value_diff"])&&"description_diff"===t.getIn(["data","value_diff","key"])},key:"TIMELINE.US_UPDATED",translate_params:["username","field_name","obj_name"]},{check:function(t,e){return"userstory"===e.obj&&"change"===e.type},key:"TIMELINE.US_UPDATED_WITH_NEW_VALUE",translate_params:["username","field_name","obj_name","new_value"]},{check:function(t,e){return"issue"===e.obj&&"change"===e.type&&t.hasIn(["data","value_diff"])&&"description_diff"===t.getIn(["data","value_diff","key"])},key:"TIMELINE.ISSUE_UPDATED",translate_params:["username","field_name","obj_name"]},{check:function(t,e){return"issue"===e.obj&&"change"===e.type},key:"TIMELINE.ISSUE_UPDATED_WITH_NEW_VALUE",translate_params:["username","field_name","obj_name","new_value"]},{check:function(t,e){return"task"===e.obj&&"change"===e.type&&!t.getIn(["data","task","userstory"])&&t.hasIn(["data","value_diff"])&&"description_diff"===t.getIn(["data","value_diff","key"])},key:"TIMELINE.TASK_UPDATED",translate_params:["username","field_name","obj_name"]},{check:function(t,e){return"task"===e.obj&&"change"===e.type&&t.getIn(["data","task","userstory"])&&t.hasIn(["data","value_diff"])&&"description_diff"===t.getIn(["data","value_diff","key"])},key:"TIMELINE.TASK_UPDATED_WITH_US",translate_params:["username","field_name","obj_name","us_name"]},{check:function(t,e){return"task"===e.obj&&"change"===e.type&&!t.getIn(["data","task","userstory"])},key:"TIMELINE.TASK_UPDATED_WITH_NEW_VALUE",translate_params:["username","field_name","obj_name","new_value"]},{check:function(t,e){return"task"===e.obj&&"change"===e.type&&t.getIn(["data","task","userstory"])},key:"TIMELINE.TASK_UPDATED_WITH_US_NEW_VALUE",translate_params:["username","field_name","obj_name","us_name","new_value"]},{check:function(t,e){return"epic"===e.obj&&"change"===e.type&&t.hasIn(["data","value_diff"])&&"description_diff"===t.getIn(["data","value_diff","key"])},key:"TIMELINE.EPIC_UPDATED",translate_params:["username","field_name","obj_name"]},{check:function(t,e){return"epic"===e.obj&&"change"===e.type&&t.hasIn(["data","value_diff"])&&"color"===t.getIn(["data","value_diff","key"])},key:"TIMELINE.EPIC_UPDATED_WITH_NEW_COLOR",translate_params:["username","field_name","obj_name","new_value"]},{check:function(t,e){return"epic"===e.obj&&"change"===e.type},key:"TIMELINE.EPIC_UPDATED_WITH_NEW_VALUE",translate_params:["username","field_name","obj_name","new_value"]},{check:function(t,e){return"user"===e.obj&&"create"===e.type},key:"TIMELINE.NEW_USER",translate_params:["username"]}],_.find(r,function(r){return r.check(t,e)})},t=function(){function t(){}return t.prototype.getType=function(t,r){return e(t,r)},t}(),angular.module("taigaUserTimeline").service("tgUserTimelineItemType",t)}.call(this),function(){var t;t=function(){return{templateUrl:"user-timeline/user-timeline-item/user-timeline-item.html",scope:{timeline:"=tgUserTimelineItem"}}},angular.module("taigaUserTimeline").directive("tgUserTimelineItem",t)}.call(this),function(){var t;t=function(){var t;return t={},
t.generate=function(t){var e,r,n,i;return i=1,r=Immutable.List(),t.minItems=t.minItems||20,n=function(){return r=Immutable.List(),e()},e=function(){return t.fetch(i).then(function(n){var o;return i++,o=n.get("data"),t.filter&&(o=t.filter(o)),t.map&&(o=o.map(t.map)),r=r.concat(o),r.size