(function(){var t,e,r,n,i,o,s,a;this.taiga=a={},a.emojis=window.emojis,this.taigaContribPlugins=this.taigaContribPlugins||window.taigaContribPlugins||[],a.generateHash=function(t){return null==t&&(t=[]),t=_.map(t,function(t){return JSON.stringify(t)}),hex_sha1(t.join(":"))},a.generateUniqueSessionIdentifier=function(){var t,e;return t=(new Date).getTime(),e=Math.floor(150994944*Math.random()),a.generateHash([t,e])},a.sessionId=a.generateUniqueSessionIdentifier(),t=function(t,e,r,n,i,o,s,c,u){var l,p,d,f,h,g,m,v,y;return u.classNameFilter(/^(?:(?!ng-animate-disabled).)*$/),g=t.when,t.when=function(e,r){return r.resolve||(r.resolve={}),angular.extend(r.resolve,{languageLoad:["$q","$translate",function(t,e){var r;return r=t.defer(),e().then(function(){return r.resolve()}),r.promise}],projectLoaded:["$q","tgProjectService","$route",function(t,e,r){var n,i;return n=t.defer(),e.setSection(null!=(i=r.current.$$route)?i.section:void 0),r.current.params.pslug?e.setProjectBySlug(r.current.params.pslug).then(n.resolve):(e.cleanProject(),n.resolve()),n.promise}]}),g.call(t,e,r)},t.when("/",{templateUrl:"home/home.html",controller:"Home",controllerAs:"vm",loader:!0,title:"HOME.PAGE_TITLE",loader:!0,description:"HOME.PAGE_DESCRIPTION",joyride:"dashboard"}),t.when("/discover",{templateUrl:"discover/discover-home/discover-home.html",controller:"DiscoverHome",controllerAs:"vm",title:"PROJECT.NAVIGATION.DISCOVER",loader:!0}),t.when("/discover/search",{templateUrl:"discover/discover-search/discover-search.html",title:"PROJECT.NAVIGATION.DISCOVER",loader:!0,controller:"DiscoverSearch",controllerAs:"vm",reloadOnSearch:!1}),t.when("/projects/",{templateUrl:"projects/listing/projects-listing.html",access:{requiresLogin:!0},title:"PROJECTS.PAGE_TITLE",description:"PROJECTS.PAGE_DESCRIPTION",loader:!0,controller:"ProjectsListing",controllerAs:"vm"}),t.when("/project/new",{title:"PROJECT.CREATE.TITLE",templateUrl:"projects/create/create-project.html",loader:!0,controller:"CreateProjectCtrl",controllerAs:"vm"}),t.when("/project/new/scrum",{title:"PROJECT.CREATE.TITLE",template:'',loader:!0}),t.when("/project/new/kanban",{title:"PROJECT.CREATE.TITLE",template:'',loader:!0}),t.when("/project/new/duplicate",{title:"PROJECT.CREATE.TITLE",template:"",loader:!0}),t.when("/project/new/import/:platform?",{title:"PROJECT.CREATE.TITLE",template:"",loader:!0}),t.when("/project/:pslug/",{template:"",loader:!0,controller:"ProjectRouter"}),t.when("/project/:pslug/timeline",{templateUrl:"projects/project/project.html",loader:!0,controller:"Project",controllerAs:"vm",section:"project-timeline"}),t.when("/project/:pslug/t/:ref",{loader:!0,controller:"DetailController",template:""}),t.when("/project/:pslug/search",{templateUrl:"search/search.html",reloadOnSearch:!1,section:"search",loader:!0}),t.when("/project/:pslug/epics",{section:"epics",templateUrl:"epics/dashboard/epics-dashboard.html",loader:!0,controller:"EpicsDashboardCtrl",controllerAs:"vm"}),t.when("/project/:pslug/epic/:epicref",{templateUrl:"epic/epic-detail.html",loader:!0,section:"epics"}),t.when("/project/:pslug/backlog",{templateUrl:"backlog/backlog.html",loader:!0,section:"backlog",joyride:"backlog"}),t.when("/project/:pslug/kanban",{templateUrl:"kanban/kanban.html",loader:!0,section:"kanban",joyride:"kanban"}),t.when("/project/:pslug/taskboard/:sslug",{templateUrl:"taskboard/taskboard.html",loader:!0,section:"backlog"}),t.when("/project/:pslug/us/:usref",{templateUrl:"us/us-detail.html",loader:!0,section:"backlog-kanban"}),t.when("/project/:pslug/task/:taskref",{templateUrl:"task/task-detail.html",loader:!0,section:"backlog-kanban"}),t.when("/project/:pslug/wiki",{redirectTo:function(t){return"/project/"+t.pslug+"/wiki/home"}}),t.when("/project/:pslug/wiki-list",{templateUrl:"wiki/wiki-list.html",loader:!0,section:"wiki"}),t.when("/project/:pslug/wiki/:slug",{templateUrl:"wiki/wiki.html",loader:!0,section:"wiki"}),t.when("/project/:pslug/team",{templateUrl:"team/team.html",loader:!0,section:"team"}),t.when("/project/:pslug/issues",{templateUrl:"issue/issues.html",loader:!0,section:"issues"}),t.when("/project/:pslug/issue/:issueref",{templateUrl:"issue/issues-detail.html",loader:!0,section:"issues"}),t.when("/project/:pslug/admin/project-profile/details",{templateUrl:"admin/admin-project-profile.html",section:"admin"}),t.when("/project/:pslug/admin/project-profile/default-values",{templateUrl:"admin/admin-project-default-values.html",section:"admin"}),t.when("/project/:pslug/admin/project-profile/modules",{templateUrl:"admin/admin-project-modules.html",section:"admin"}),t.when("/project/:pslug/admin/project-profile/export",{templateUrl:"admin/admin-project-export.html",section:"admin"}),t.when("/project/:pslug/admin/project-profile/reports",{templateUrl:"admin/admin-project-reports.html",section:"admin"}),t.when("/project/:pslug/admin/project-values/status",{templateUrl:"admin/admin-project-values-status.html",section:"admin"}),t.when("/project/:pslug/admin/project-values/points",{templateUrl:"admin/admin-project-values-points.html",section:"admin"}),t.when("/project/:pslug/admin/project-values/priorities",{templateUrl:"admin/admin-project-values-priorities.html",section:"admin"}),t.when("/project/:pslug/admin/project-values/severities",{templateUrl:"admin/admin-project-values-severities.html",section:"admin"}),t.when("/project/:pslug/admin/project-values/types",{templateUrl:"admin/admin-project-values-types.html",section:"admin"}),t.when("/project/:pslug/admin/project-values/custom-fields",{templateUrl:"admin/admin-project-values-custom-fields.html",section:"admin"}),t.when("/project/:pslug/admin/project-values/tags",{templateUrl:"admin/admin-project-values-tags.html",section:"admin"}),t.when("/project/:pslug/admin/project-values/due-dates",{templateUrl:"admin/admin-project-values-due-dates.html",section:"admin"}),t.when("/project/:pslug/admin/memberships",{templateUrl:"admin/admin-memberships.html",section:"admin"}),t.when("/project/:pslug/admin/roles",{templateUrl:"admin/admin-roles.html",section:"admin"}),t.when("/project/:pslug/admin/third-parties/webhooks",{templateUrl:"admin/admin-third-parties-webhooks.html",section:"admin"}),t.when("/project/:pslug/admin/third-parties/github",{templateUrl:"admin/admin-third-parties-github.html",section:"admin"}),t.when("/project/:pslug/admin/third-parties/gitlab",{templateUrl:"admin/admin-third-parties-gitlab.html",section:"admin"}),t.when("/project/:pslug/admin/third-parties/bitbucket",{templateUrl:"admin/admin-third-parties-bitbucket.html",section:"admin"}),t.when("/project/:pslug/admin/third-parties/gogs",{templateUrl:"admin/admin-third-parties-gogs.html",section:"admin"}),t.when("/project/:pslug/admin/contrib/:plugin",{templateUrl:"contrib/main.html"}),t.when("/project/:pslug/transfer/:token",{templateUrl:"projects/transfer/transfer-page.html",loader:!0,controller:"Project",controllerAs:"vm"}),t.when("/user-settings/user-profile",{templateUrl:"user/user-profile.html"}),t.when("/user-settings/user-change-password",{templateUrl:"user/user-change-password.html"}),t.when("/user-settings/user-project-settings",{templateUrl:"user/user-project-settings.html"}),t.when("/user-settings/mail-notifications",{templateUrl:"user/mail-notifications.html"}),t.when("/user-settings/live-notifications",{templateUrl:"user/live-notifications.html"}),t.when("/user-settings/web-notifications",{templateUrl:"user/web-notifications.html"}),t.when("/change-email/:email_token",{templateUrl:"user/change-email.html"}),t.when("/cancel-account/:cancel_token",{templateUrl:"user/cancel-account.html"}),t.when("/user-settings/contrib/:plugin",{templateUrl:"contrib/user-settings.html"}),t.when("/profile",{templateUrl:"profile/profile.html",loader:!0,access:{requiresLogin:!0},controller:"Profile",controllerAs:"vm"}),t.when("/notifications",{templateUrl:"notifications/notifications.html",loader:!0,access:{requiresLogin:!0},controller:"Notifications",controllerAs:"vm"}),t.when("/profile/:slug",{templateUrl:"profile/profile.html",loader:!0,controller:"Profile",controllerAs:"vm"}),t.when("/login",{templateUrl:"auth/login.html",title:"LOGIN.PAGE_TITLE",description:"LOGIN.PAGE_DESCRIPTION",disableHeader:!0,controller:"LoginPage"}),t.when("/register",{templateUrl:"auth/register.html",title:"REGISTER.PAGE_TITLE",description:"REGISTER.PAGE_DESCRIPTION",disableHeader:!0}),t.when("/forgot-password",{templateUrl:"auth/forgot-password.html",title:"FORGOT_PASSWORD.PAGE_TITLE",description:"FORGOT_PASSWORD.PAGE_DESCRIPTION",disableHeader:!0}),t.when("/change-password/:token",{templateUrl:"auth/change-password-from-recovery.html",title:"CHANGE_PASSWORD.PAGE_TITLE",description:"CHANGE_PASSWORD.PAGE_TITLE",disableHeader:!0}),t.when("/invitation/:token",{templateUrl:"auth/invitation.html",title:"INVITATION.PAGE_TITLE",description:"INVITATION.PAGE_DESCRIPTION",disableHeader:!0}),t.when("/external-apps",{templateUrl:"external-apps/external-app.html",title:"EXTERNAL_APP.PAGE_TITLE",description:"EXTERNAL_APP.PAGE_DESCRIPTION",controller:"ExternalApp",controllerAs:"vm",disableHeader:!0,mobileViewport:!0}),t.when("/blocked-project/:pslug/",{templateUrl:"projects/project/blocked-project.html",loader:!0}),t.when("/error",{templateUrl:"error/error.html"}),t.when("/not-found",{templateUrl:"error/not-found.html"}),t.when("/permission-denied",{templateUrl:"error/permission-denied.html"}),t.otherwise({templateUrl:"error/not-found.html"}),e.html5Mode({enabled:!0,requireBase:!1}),f={"Content-Type":"application/json","Accept-Language":window.taigaConfig.defaultLanguage||"en","X-Session-Id":a.sessionId},r.defaults.headers["delete"]=f,r.defaults.headers.patch=f,r.defaults.headers.post=f,r.defaults.headers.put=f,r.defaults.headers.get={"X-Session-Id":a.sessionId},r.useApplyAsync(!0),i.setSessionId(a.sessionId),l=function(t,e,r,n,i){var o;return o=function(o){var s,a;return 0===o.status||o.status===-1&&!o.config.cancelable?(n.closeAll(),i.error()):401===o.status&&e.url().indexOf("/login")===-1&&(s=e.url(),a=e.search(),a.force_next?e.url(r.resolve("login")).search("force_next",a.force_next):e.url(r.resolve("login")).search({unauthorized:!0,next:s})),t.reject(o)},{responseError:o}},n.factory("authHttpIntercept",["$q","$location","$tgNavUrls","lightboxService","tgErrorHandlingService",l]),r.interceptors.push("authHttpIntercept"),h=function(t,e){return{request:function(t){return e.logRequest(),t},requestError:function(r){return e.logResponse(),t.reject(r)},responseError:function(r){return e.logResponse(),t.reject(r)},response:function(t){return e.logResponse(),t}}},n.factory("loaderIntercept",["$q","tgLoader",h]),r.interceptors.push("loaderIntercept"),y=function(t){var e;return e=function(e){var r;return 400===e.status&&e.data.version&&(r=angular.element("body").injector(),r.invoke(["$tgConfirm","$translate",function(t){return function(t,e){var r;return r=e.instant("ERROR.VERSION_ERROR"),t.notify("error",r,null,1e4)}}(this)])),t.reject(e)},{responseError:e}},n.factory("versionCheckHttpIntercept",["$q",y]),r.interceptors.push("versionCheckHttpIntercept"),p=function(t,e){var r,n,i;return r=function(){return e.block()},i=function(t){return t.data.blocked_code&&r(),t},n=function(e){return 451===e.status&&r(),t.reject(e)},{response:i,responseError:n}},n.factory("blockingIntercept",["$q","tgErrorHandlingService",p]),r.interceptors.push("blockingIntercept"),o.debugInfoEnabled(window.taigaConfig.debugInfo||!1),localStorage.userInfo&&(v=JSON.parse(localStorage.userInfo)),m=(null!=v?v.lang:void 0)||window.taigaConfig.defaultLanguage||"en",c.addPart("taiga"),s.useLoader("$translatePartialLoader",{urlTemplate:"/"+window._version+"/locales/{part}/locale-{lang}.json"}).useSanitizeValueStrategy("escapeParameters").addInterpolation("$translateMessageFormatInterpolation").preferredLanguage(m),s.fallbackLanguage(m),d=window.getDecorators(),_.each(d,function(t){return n.decorator(t.provider,t.decorator)})},e=function(t,e){var r;return moment.locale(t),"en"!==t&&ljs.load("/"+window._version+"/locales/moment-locales/"+t+".js"),r={defaultMessage:e.instant("COMMON.FORM_ERRORS.DEFAULT_MESSAGE"),type:{email:e.instant("COMMON.FORM_ERRORS.TYPE_EMAIL"),url:e.instant("COMMON.FORM_ERRORS.TYPE_URL"),urlstrict:e.instant("COMMON.FORM_ERRORS.TYPE_URLSTRICT"),number:e.instant("COMMON.FORM_ERRORS.TYPE_NUMBER"),digits:e.instant("COMMON.FORM_ERRORS.TYPE_DIGITS"),dateIso:e.instant("COMMON.FORM_ERRORS.TYPE_DATEISO"),alphanum:e.instant("COMMON.FORM_ERRORS.TYPE_ALPHANUM"),phone:e.instant("COMMON.FORM_ERRORS.TYPE_PHONE")},notnull:e.instant("COMMON.FORM_ERRORS.NOTNULL"),notblank:e.instant("COMMON.FORM_ERRORS.NOT_BLANK"),required:e.instant("COMMON.FORM_ERRORS.REQUIRED"),regexp:e.instant("COMMON.FORM_ERRORS.REGEXP"),min:e.instant("COMMON.FORM_ERRORS.MIN"),max:e.instant("COMMON.FORM_ERRORS.MAX"),range:e.instant("COMMON.FORM_ERRORS.RANGE"),minlength:e.instant("COMMON.FORM_ERRORS.MIN_LENGTH"),maxlength:e.instant("COMMON.FORM_ERRORS.MAX_LENGTH"),rangelength:e.instant("COMMON.FORM_ERRORS.RANGE_LENGTH"),mincheck:e.instant("COMMON.FORM_ERRORS.MIN_CHECK"),maxcheck:e.instant("COMMON.FORM_ERRORS.MAX_CHECK"),rangecheck:e.instant("COMMON.FORM_ERRORS.RANGE_CHECK"),equalto:e.instant("COMMON.FORM_ERRORS.EQUAL_TO"),linewidth:e.instant("COMMON.FORM_ERRORS.LINEWIDTH"),pikaday:e.instant("COMMON.FORM_ERRORS.PIKADAY")},checksley.updateMessages("default",r)},r=function(t,r,n,i,o,s,c,u,l,p,d,f,h,g,m){var v,y,b;return t.debug("Initialize application"),r.$on("$translatePartialLoaderStructureChanged",function(){return s.refresh()}),b={linewidth:function(t,e){var r,n;return r=a.nl2br(t).split("
"),n=_.every(r,function(t){return t.length-1}),Promise.setScheduler(function(t){return r.$evalAsync(t)}),i.setupConnection(),n.isAuthenticated()&&(y=n.getUser(),n.showTerms()),o.initialize(),r.$on("$locationChangeStart",function(t){var e;if(f.init(),(null!=(e=m.project)?e.get("blocked_code"):void 0)&&(m.setProject(null),f.block()),h.getLightboxOpen().length)return t.preventDefault(),h.closeAll()}),v=r.$on("$routeChangeStart",function(t,e){return e.loader&&p.start(!0),v()}),r.$on("$routeChangeSuccess",function(t,e){var r,i;return e.loader&&p.start(!0),e.access&&e.access.requiresLogin&&(n.isAuthenticated()||c.path(u.resolve("login"))),(e.title||e.description)&&(i=s.instant(e.title||""),r=s.instant(e.description||""),l.setAll(i,r)),e.mobileViewport?l.addMobileViewport():l.removeMobileViewport(),e.disableHeader?d.disableHeader():d.enableHeader()})},angular.module("infinite-scroll").value("THROTTLE_MILLISECONDS",500),s=_.filter(this.taigaContribPlugins,function(t){return t.module}),o=_.map(s,function(t){return t.module}),i=["taigaBase","taigaCommon","taigaResources","taigaResources2","taigaAuth","taigaEvents","taigaHome","taigaNavigationBar","taigaProjects","taigaRelatedTasks","taigaBacklog","taigaTaskboard","taigaKanban","taigaIssues","taigaUserStories","taigaTasks","taigaTeam","taigaWiki","taigaSearch","taigaAdmin","taigaProject","taigaUserSettings","taigaFeedback","taigaPlugins","taigaIntegrations","taigaComponents","taigaProfile","taigaHome","taigaUserTimeline","taigaExternalApps","taigaDiscover","taigaHistory","taigaNotifications","taigaWikiHistory","taigaEpics","taigaUtils","templates","ngSanitize","ngRoute","ngAnimate","ngAria","pascalprecht.translate","infinite-scroll","tgRepeat"].concat(o),n=angular.module("taiga",i),n.config(["$routeProvider","$locationProvider","$httpProvider","$provide","$tgEventsProvider","$compileProvider","$translateProvider","$translatePartialLoaderProvider","$animateProvider",t]),n.run(["$log","$rootScope","$tgAuth","$tgEvents","$tgAnalytics","$translate","$tgLocation","$tgNavUrls","tgAppMetaService","tgLoader","tgNavigationBarService","tgErrorHandlingService","lightboxService","$tgConfig","tgProjectService",r])}).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,o=function(t,e){return function(){return t.apply(e,arguments)}};t=function(){function t(){}return t}(),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return n(e,t),e}(t),e=function(t){function e(){return this.onInitialDataError=o(this.onInitialDataError,this),e.__super__.constructor.apply(this,arguments)}return n(e,t),e.prototype.onInitialDataError=function(t){return t&&(404===t.status?this.errorHandlingService.notfound():403===t.status&&this.errorHandlingService.permissionDenied()),this.q.reject(t)},e}(t),this.taiga.Base=t,this.taiga.Service=r,this.taiga.Controller=e}.call(this),function(){var t,e,r,n,i,o,s,a,c,u,l,p,d,f,h,g,m,v,y,b,S,j,k,$,I,T,E,C,P,w,A,O,R,M,U=[].indexOf||function(t){for(var e=0,r=this.length;e\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1"+e+"$2")}}(this),r=function(t){return function(t){var e,r;return e=_.keys(t),r=[],_.forIn(t,function(t,n){if(U.call(e,n)<0&&_.isFunction(t))return r.push(n)}),_.bindAll(t,r)}}(this),n=function(t){return function(t,e,r){var n,i;return i=t.$eval(e),void 0!==i?r(i):(n=null,n=t.$watch(e,function(t){if(void 0!==t)return r(t),n?n():void 0}))}}(this),m=function(){var t,e,r,n,i,o,s,a;for(e=arguments[0],o=2<=arguments.length?N.call(arguments,1):[],t=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,t),e}(e),r=o.length-1;r>=0;r+=-1){i=o[r],a=i.prototype;for(s in a)n=a[s],t.prototype[s]=n}return t},O=function(t,e){return _.trim(t,e)},I=function(t){return t.toString().toLowerCase().trim().replace(/\s+/g,"-").replace(/&/g,"-and-").replace(/[^\w\-]+/g,"").replace(/\-\-+/g,"-")},M=function(t){return t?_.capitalize(t.replace(/-/g," ")):t},A=function(t,e){var r,n;return r=t.data("nextTextPosition"),(null==r||r>=e.length)&&(r=0),n=e[r],t.data("nextTextPosition",r+1),t.text(n)},p=function(t,e){var r,n,i,o;for(o={},r=0,i=t.length;re&&(n=n.substring(0,e+1),n=n.substring(0,Math.min(n.length,n.lastIndexOf(" "))),n+=r),n):t},$=function(t,e){var r,n,i;return null==e&&(e=1),isNaN(parseFloat(t))||!isFinite(t)?"-":0===t?"0 bytes":(i=["bytes","KB","MB","GB","TB","PB"],r=Math.floor(Math.log(t)/Math.log(1024)),r>5&&(r=5),n=(t/Math.pow(1024,r)).toFixed(e),n+" "+i[r])},E=function(t,e){var r;return e?(r=new RegExp("<(?!"+e+"s*/?)[^>]+>","gi"),String(t).replace(r,"")):String(t).replace(/<\/?[^>]+>/g,"")},j=function(t,e,r){var n;return n=new RegExp("<("+e+")>","gi"),t=t.replace(n,"<"+r+">"),n=new RegExp("","gi"),t=t.replace(n,"")},a=function(t){return function(t,e,r){return Object.defineProperty(t,e,{get:function(){var t;if(!_.isFunction(r))throw"defineImmutableProperty third param must be a function";if(t=r(),t&&_.isObject(t)&&void 0===t.size)throw"defineImmutableProperty must return immutable data";return t}})}}(this),_.mixin({removeKeys:function(t,e){return _.chain([e]).flatten().reduce(function(t,e){return delete t[e],t},t).value()},cartesianProduct:function(){return _.reduceRight(arguments,function(t,e){return _.flatten(_.map(t,function(t){return _.map(e,function(e){return[e].concat(t)})}),!0)},[[]])}}),f=function(t){return null!==t.match(/\.(jpe?g|png|gif|gifv|webm|svg|psd)/i)},d=function(t){return null!=t&&null!==t.match(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)},h=function(t){return null!==t.match(/\.(pdf)/i)},b=function(t,e){var r;return r={},e.forEach(function(e,n){if(e!==t.get(n))return e.toJS?r[n]=e.toJS():r[n]=e}),r},t=["#fce94f","#edd400","#c4a000","#8ae234","#73d216","#4e9a06","#d3d7cf","#fcaf3e","#f57900","#ce5c00","#729fcf","#3465a4","#204a87","#888a85","#ad7fa8","#75507b","#5c3566","#ef2929","#cc0000","#a40000","#222222"],l=function(){return _.sample(t)},c=function(){return _.clone(t)},u=function(t,e,r){var n,i;for(r||(r=1),i=[],n=null;n=e.exec(t);)r===-1?i.push(n):i.push(n[r]);return i},S=function(t,e){var r;return r=e-t,t+Math.floor(Math.random()*(r+1))},y=function(t){var e;return e=t,e=e.replace("Á","A").replace("Ä","A").replace("À","A"),e=e.replace("É","E").replace("Ë","E").replace("È","E"),e=e.replace("Í","I").replace("Ï","I").replace("Ì","I"),e=e.replace("Ó","O").replace("Ö","O").replace("Ò","O"),e=e.replace("Ú","U").replace("Ü","U").replace("Ù","U")},C=this.taiga,C.addClass=e,C.nl2br=v,C.bindMethods=r,C.bindOnce=n,C.mixOf=m,C.trim=O,C.slugify=I,C.unslugify=M,C.toggleText=A,C.groupBy=p,C.timeout=P,C.cancelTimeout=i,C.scopeDefer=k,C.toString=w,C.joinStr=g,C.truncate=R,C.debounce=o,C.debounceLeading=s,C.startswith=T,C.sizeFormat=$,C.stripTags=E,C.replaceTags=j,C.defineImmutableProperty=a,C.isImage=f,C.isEmail=d,C.isPdf=h,C.patch=b,C.getRandomDefaultColor=l,C.getDefaulColorList=c,C.getMatches=u,C.randomInt=S,C.normalizeString=y}.call(this),function(){var t,e,r,n,i,o,s,a;o=this.taiga,n=this.taiga.groupBy,i=this.taiga.joinStr,a=this.taiga.trim,s=this.taiga.toString,e=function(){function t(){}return t.prototype.fillUsersAndRoles=function(t,e){var r,i;return r=_.filter(t,function(t){return function(t){return t.is_active}}(this)),this.scope.activeUsers=_.sortBy(r,"full_name_display"),this.scope.activeUsersById=n(this.scope.activeUsers,function(t){return t.id}),this.scope.users=_.sortBy(t,"full_name_display"),this.scope.usersById=n(t,function(t){return t.id}),this.scope.roles=_.sortBy(e,"order"),i=_(this.scope.project.members).map("role").uniq().value(),this.scope.computableRoles=_(e).filter("computable").filter(function(t){return _.includes(i,t.id)}).value()},t.prototype.loadUsersAndRoles=function(){var t;return t=this.q.all([this.rs.projects.usersList(this.scope.projectId),this.rs.projects.rolesList(this.scope.projectId)]),t.then(function(t){return function(e){var r,n;return n=e[0],r=e[1],t.fillUsersAndRoles(n,r),e}}(this))},t}(),o.PageMixin=e,t=function(){function t(){}return t.prototype.excludePrefix="exclude_",t.prototype.selectFilter=function(t,e,r,n){var s,c,u;if(null==r&&(r=!1),null==n&&(n="include"),u=this.location.search(),"exclude"===n&&(t=this.excludePrefix.concat(t)),void 0!==u[t]&&"page"!==t&&(s=_.map(o.toString(u[t]).split(","),function(t){return a(t)}),s.push(o.toString(e)),s=_.compact(s),e=i(",",_.uniq(s))),!this.location.isInCurrentRouteParams(t,e))return c=r?this.location:this.location.noreload(this.scope),c.search(t,e)},t.prototype.replaceFilter=function(t,e,r){var n;if(null==r&&(r=!1),!this.location.isInCurrentRouteParams(t,e))return n=r?this.location:this.location.noreload(this.scope),n.search(t,e)},t.prototype.replaceAllFilters=function(t,e){var r;return null==e&&(e=!1),r=e?this.location:this.location.noreload(this.scope),r.search(t)},t.prototype.unselectFilter=function(t,e,r,n){var s,c,u,l;if(null==r&&(r=!1),null==n&&(n="include"),u=this.location.search(),"exclude"===n&&(t=this.excludePrefix.concat(t)),void 0!==u[t])return void 0!==e&&null!==e||delete u[t],l=_.map(o.toString(u[t]).split(","),function(t){return a(t)}),c=_.reject(l,function(t){return t===o.toString(e)}),c=_.compact(c),e=_.isEmpty(c)?null:i(",",_.uniq(c)),s=r?this.location:this.location.noreload(this.scope),s.search(t,e)},t.prototype.applyStoredFilters=function(t,e){var r;return!(!_.isEmpty(this.location.search())||(r=this.getFilters(t,e),!Object.keys(r).length))&&(this.location.search(r),this.location.replace(),!0)},t.prototype.storeFilters=function(t,e,r){var n,i;return i=t+":"+r,n=o.generateHash([t,i]),this.storage.set(n,e)},t.prototype.getFilters=function(t,e){var r,n;return n=t+":"+e,r=o.generateHash([t,n]),this.storage.get(r)||{}},t.prototype.formatSelectedFilters=function(t,e,r,n){var i,o,s,a,c;return null==n&&(n="include"),a=r.split(","),s=_.filter(e,function(t){return a.indexOf(_.toString(t.id))!==-1}),o=_.filter(a,function(t){return!_.find(s,function(e){return _.toString(e.id)===t})}),i=_.map(o,function(e){return{id:e,key:t+":"+e,dataType:t,name:e,mode:n}}),c=_.map(s,function(e){return{id:e.id,key:t+":"+e.id,dataType:t,name:e.name,color:e.color,mode:n}}),i.concat(c)},t}(),o.FiltersMixin=t,r=function(){function t(){}return t.prototype.excludePrefix="exclude_",t.prototype.filterCategories=["tags","status","assigned_users","assigned_to","owner","epic","role"],t.prototype.changeQ=function(t){return this.replaceFilter("q",t),this.filtersReloadContent(),this.generateFilters()},t.prototype.removeFilter=function(t){return this.unselectFilter(t.dataType,t.id,!1,t.mode),this.filtersReloadContent(),this.generateFilters()},t.prototype.addFilter=function(t){return this.selectFilter(t.category.dataType,t.filter.id,!1,t.mode),this.filtersReloadContent(),this.generateFilters()},t.prototype.selectCustomFilter=function(t){return this.replaceAllFilters(t.filter),this.filtersReloadContent(),this.generateFilters()},t.prototype.saveCustomFilter=function(t){var e,r,n,i,o,s,a;for(r={},a=this.location.search(),s=this.filterCategories,n=0,o=s.length;n0}),a.assigned_users=_.map(s.assigned_users,function(t){return t.id?t.id=t.id.toString():t.id="null",t.name=t.full_name||"Unassigned",t}),a.assigned_to=_.map(s.assigned_to,function(t){return t.id?t.id=t.id.toString():t.id="null",t.name=t.full_name||"Unassigned",t}),a.role=_.map(s.roles,function(t){return t.id?t.id=t.id.toString():t.id="null",t.name=t.name||"Unassigned",t}),a.owner=_.map(s.owners,function(t){return t.id=t.id.toString(),t.name=t.full_name,t}),a.epic=_.map(s.epics,function(t){return t.id?(t.id=t.id.toString(),t.name="#"+t.ref+" "+t.subject):(t.id="null",t.name="Not in an epic"),t}),t.selectedFilters=[],l=t.filterCategories,c=0,u=l.length;c-1,{i18n:{previousMonth:t.instant("COMMON.PICKERDATE.PREV_MONTH"),nextMonth:t.instant("COMMON.PICKERDATE.NEXT_MONTH"),months:[t.instant("COMMON.PICKERDATE.MONTHS.JAN"),t.instant("COMMON.PICKERDATE.MONTHS.FEB"),t.instant("COMMON.PICKERDATE.MONTHS.MAR"),t.instant("COMMON.PICKERDATE.MONTHS.APR"),t.instant("COMMON.PICKERDATE.MONTHS.MAY"),t.instant("COMMON.PICKERDATE.MONTHS.JUN"),t.instant("COMMON.PICKERDATE.MONTHS.JUL"),t.instant("COMMON.PICKERDATE.MONTHS.AUG"),t.instant("COMMON.PICKERDATE.MONTHS.SEP"),t.instant("COMMON.PICKERDATE.MONTHS.OCT"),t.instant("COMMON.PICKERDATE.MONTHS.NOV"),t.instant("COMMON.PICKERDATE.MONTHS.DEC")],weekdays:[t.instant("COMMON.PICKERDATE.WEEK_DAYS.SUN"),t.instant("COMMON.PICKERDATE.WEEK_DAYS.MON"),t.instant("COMMON.PICKERDATE.WEEK_DAYS.TUE"),t.instant("COMMON.PICKERDATE.WEEK_DAYS.WED"),t.instant("COMMON.PICKERDATE.WEEK_DAYS.THU"),t.instant("COMMON.PICKERDATE.WEEK_DAYS.FRI"),t.instant("COMMON.PICKERDATE.WEEK_DAYS.SAT")],weekdaysShort:[t.instant("COMMON.PICKERDATE.WEEK_DAYS_SHORT.SUN"),t.instant("COMMON.PICKERDATE.WEEK_DAYS_SHORT.MON"),t.instant("COMMON.PICKERDATE.WEEK_DAYS_SHORT.TUE"),t.instant("COMMON.PICKERDATE.WEEK_DAYS_SHORT.WED"),t.instant("COMMON.PICKERDATE.WEEK_DAYS_SHORT.THU"),t.instant("COMMON.PICKERDATE.WEEK_DAYS_SHORT.FRI"),t.instant("COMMON.PICKERDATE.WEEK_DAYS_SHORT.SAT")]},isRTL:n,firstDay:parseInt(t.instant("COMMON.PICKERDATE.FIRST_DAY_OF_WEEK"),10),format:t.instant("COMMON.PICKERDATE.FORMAT")}}}},g.factory("tgDatePickerConfigService",["$translate","$tgConfig","$tgAuth",s]),p=function(t,e){var r;return r=function(){return t.getSelection?t.getSelection().toString():e.selection?e.selection.createRange().text:""},{get:r}},g.factory("$selectedText",["$window","$document",p]),n=function(t){var e,r;return r=function(t,e,r){if(e&&r&&e.get("my_permissions").indexOf(r)>-1)return t.removeClass("hidden")},e=function(e,n,i){var o,s,a;return n.addClass("hidden"),o=i.tgCheckPermission,a=e.$watch(function(){return t.project},function(){if(t.project)return r(n,t.project,o),a()}),s=i.$observe("tgCheckPermission",function(e){if(e)return r(n,t.project,e),s()}),e.$on("$destroy",function(){return n.off()})},{link:e}},n.$inject=["tgProjectService"],g.directive("tgCheckPermission",n),i=function(){var t,e;return e="tgClassPermission",t=function(t,r,n){var i,o,s;return i=function(t,e,n){var i;return i="!"===n[0],i&&(n=n.slice(1)),i&&t.my_permissions.indexOf(n)===-1?r.addClass(e):i||t.my_permissions.indexOf(n)===-1?r.removeClass(e):r.addClass(e)},o=function(r){var o,a,c,u;if(r){s(),a=t.$eval(n[e]),u=[];for(o in a)c=a[o],u.push(i(r,o,c));return u}},s=t.$watch("project",o)},{link:t}},g.directive("tgClassPermission",i),t=function(){var t,e,r,n;return e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame,r=function(t){return function(t){var i;if(i=n.shift(),i(),n.length)return e(r)}}(this),n=[],t=function(){var t,i,o,s;for(s=[],i=0,o=arguments.length;i-1?t.resolve("project-backlog",r):e.is_kanban_activated&&e.my_permissions.indexOf("view_us")>-1?t.resolve("project-kanban",r):e.is_wiki_activated&&e.my_permissions.indexOf("view_wiki_pages")>-1?t.resolve("project-wiki",r):e.is_issues_activated&&e.my_permissions.indexOf("view_issues")>-1?t.resolve("project-issues",r):t.resolve("project",r)},{get:e}},g.factory("$projectUrl",["$tgNavUrls",c]),u=function(t){var e,r,n;return e=t.defer(),e.resolve(),r=e.promise,n={bindAdd:function(t){return function(e){return function(){var n;return n=1<=arguments.length?v.call(arguments,0):[],r=r.then(function(){return e.apply(t,n)})}}}(this),add:function(t){return function(t){return r=r?r.then(t):t(),n}}(this)}},g.factory("$tgQqueue",["$q",u]),l=function(t){function e(t,e,r,n){this.qqueue=t,this.repo=e,this.q=r,this.model=n}return y(e,t),e.$inject=["$tgQqueue","$tgRepo","$q","$tgModel"],e.prototype.setObject=function(t,e){this.scope=t,this.prop=e},e.prototype.clone=function(){var t,e;return t=_.cloneDeep(this.scope[this.prop]._attrs),e=this.model.make_model(this.scope[this.prop]._name,t)},e.prototype.getObj=function(){return this.scope[this.prop]},e.prototype.save=function(t){var e;return e=this.q.defer(),this.qqueue.add(function(r){return function(){var n,i,o,s,a;return s=r.getObj(),i=s.comment,s.comment="",n=r.clone(),o=_.omit(s._modifiedAttrs,["version"]),n=_.assign(n,o),t(n),i.length&&(n.comment=i),a=function(){return r.scope[r.prop]=n,e.resolve.apply(null,arguments)},r.repo.save(n).then(a,e.reject)}}(this)),e.promise},e}(m.Service),g.service("$tgQueueModelTransformation",l),f=function(t){return{get:function(e){return function(e,r){var n;return null==r&&(r=!1),n=t.get(e),r&&(n=_.template(n)),n}}(this)}},g.factory("$tgTemplate",["$templateCache",f]),r=function(){var t;return t="",{template:t}},g.directive("tgCapslock",[r]),a=function(){var t,e;return e='\n \n',t=function(t,e,r){},{scope:{onClose:"&"},link:t,template:e}},g.directive("tgLightboxClose",[a]),d=function(){var t;return t='\n \n {{svgTitle}}\n {{svgTitleTranslate | translate: svgTitleTranslateValues}}\n \n',{scope:{svgIcon:"@",svgTitle:"@",svgTitleTranslate:"@",svgTitleTranslateValues:"=",svgFill:"="},template:t}},g.directive("tgSvg",[d]),e=function(t,e,r){return{restrict:"A",link:function(r,n,i){var o;return i.ngShow?(o=e(i.ngShow),r.$watch(o,function(e){if(e===!0)return t(function(){return n[0].focus()})})):t(function(){return n[0].focus()})}}},g.directive("tgAutofocus",["$timeout","$parse","animationFrame",e]),g.directive("tgPreloadImage",function(){var t,e,r;return e="loading...",r="
\n \n
",t=function(t,e){var r;return r=new Image,r.onload=e,r.src=t,r},{template:r,transclude:!0,replace:!0,link:function(r,n,i){var o,s,a;return o=n.find("img:last"),a=null,s=function(){if(n.find(".loading-spinner").remove(),o.show(),a)return clearTimeout(a),a=null},i.$observe("preloadSrc",function(r){return a&&clearTimeout(a),n.find(".loading-spinner").remove(),a=setTimeout(function(){return n.prepend(e)},200),o.hide(),t(r,s)})}}}),o=function(){var t;return t=function(t,e,r){return e.on("click",function(t){if(t.ctrlKey||t.metaKey)return t.preventDefault()})},{link:t}},g.directive("tgCtrlClickDisable",o)}.call(this),function(){var t,e,r,n,i,o,s,a,c;a=this.taiga,o=this.taiga.mixOf,c=this.taiga.toString,i=this.taiga.joinStr,n=this.taiga.groupBy,r=this.taiga.bindOnce,e=this.taiga.bindMethods,s=angular.module("taigaCommon"),t=function(){function t(t,e,r,n,i){this.params=t,this.repo=e,this.projectService=r,this.navurls=n,this.location=i,this.repo.resolve({pslug:this.params.pslug,ref:this.params.ref}).then(function(t){return function(e){var r;return e.issue?r=t.navurls.resolve("project-issues-detail",{project:t.projectService.project.get("slug"),ref:t.params.ref}):e.task?r=t.navurls.resolve("project-tasks-detail",{project:t.projectService.project.get("slug"),ref:t.params.ref}):e.us?r=t.navurls.resolve("project-userstories-detail",{project:t.projectService.project.get("slug"),ref:t.params.ref}):e.epic?r=t.navurls.resolve("project-epics-detail",{project:t.projectService.project.get("slug"),ref:t.params.ref}):e.wikipage&&(r=t.navurls.resolve("project-wiki-page",{project:t.projectService.project.get("slug"),slug:t.params.ref})),t.location.path(r)}}(this))}return t.$inject=["$routeParams","$tgRepo","tgProjectService","$tgNavUrls","$location"],t}(),s.controller("DetailController",t)}.call(this),function(){var t;t=angular.module("taigaEpics",[])}.call(this),function(){var t,e,r,n,i,o,s=function(t,e){return function(){return t.apply(e,arguments)}};o=this.taiga,i=this.taiga.startswith,r=this.taiga.bindMethods,n=angular.module("taigaEvents",[]),e=function(){function t(t,e,n,i,o,a){this.win=t,this.log=e,this.config=n,this.auth=i,this.liveAnnouncementService=o,this.rootScope=a,this.processMessage=s(this.processMessage,this),r(this)}return t.prototype.initialize=function(t){if(this.sessionId=t,this.subscriptions={},this.connected=!1,this.error=!1,this.pendingMessages=[],this.missedHeartbeats=0,this.heartbeatInterval=null,void 0===this.win.WebSocket)return this.log.info("WebSockets not supported on your browser")},t.prototype.setupConnection=function(){var t,e,r,n;if(this.stopExistingConnection(),n=this.config.get("eventsUrl"))return i(n,"ws:")||i(n,"wss:")||(t=this.win.location,r="https:"===t.protocol?"wss:":"ws:",e=_.trimStart(n,"/"),n=r+"//"+t.host+"/"+e),this.error=!1,this.ws=new this.win.WebSocket(n),this.ws.addEventListener("open",this.onOpen),this.ws.addEventListener("message",this.onMessage),this.ws.addEventListener("error",this.onError),this.ws.addEventListener("close",this.onClose)},t.prototype.stopExistingConnection=function(){if(void 0!==this.ws)return this.ws.removeEventListener("open",this.onOpen),this.ws.removeEventListener("close",this.onClose),this.ws.removeEventListener("error",this.onError),this.ws.removeEventListener("message",this.onMessage),this.stopHeartBeatMessages(),this.ws.close(),delete this.ws},t.prototype.notifications=function(){return this.subscribe(null,"notifications",function(t){return function(e){return t.liveAnnouncementService.show(e.title,e.desc),t.rootScope.$digest()}}(this))},t.prototype.liveNotifications=function(){var t,e;if(null!=this.auth.userData)return e=this.auth.userData.get("id"),t=function(t){return function(){return t.subscribe(null,"live_notifications."+e,function(t){var e;if(e=new Notification(t.title,{icon:"/"+window._version+"/images/favicon.png",body:t.body,tag:t.id}),e.onshow=function(){if(t.timeout&&t.timeout>0)return setTimeout(function(){return e.close()},t.timeout)},t.url)return e.onclick=function(){return window.open(t.url)}})}}(this),Notification?"granted"===Notification.permission?t():"denied"!==Notification.permission?Notification.requestPermission(function(e){return function(e){if("granted"===e)return t()}}(this)):void 0:console.log("This browser does not support desktop notification")},t.prototype.webNotifications=function(){var t,e,r;if(null!=this.auth.userData)return r=this.auth.userData.get("id"),e="web_notifications."+r,t=o.randomInt(700,1e3),this.subscribe(null,e,function(t){return function(e){return t.rootScope.$broadcast("notifications:new")}}(this))},t.prototype.startHeartBeatMessages=function(){var t,e,r;if(!this.heartbeatInterval)return e=this.config.get("eventsMaxMissedHeartbeats",5),t=this.config.get("eventsHeartbeatIntervalTime",6e4),r=this.config.get("eventsReconnectTryInterval",1e4),this.missedHeartbeats=0,this.heartbeatInterval=setInterval(function(t){return function(){var r;try{if(t.missedHeartbeats>=e)throw new Error("Too many missed heartbeats PINGs.");return t.missedHeartbeats++,t.sendMessage({cmd:"ping"}),t.log.debug("HeartBeat send PING")}catch(n){return r=n,t.log.error("HeartBeat error: "+r.message),t.setupConnection()}}}(this),t),this.log.debug("HeartBeat enabled")},t.prototype.stopHeartBeatMessages=function(){if(this.heartbeatInterval)return clearInterval(this.heartbeatInterval),this.heartbeatInterval=null,this.log.debug("HeartBeat disabled")},t.prototype.processHeartBeatPongMessage=function(t){return this.missedHeartbeats=0,this.log.debug("HeartBeat recived PONG")},t.prototype.serialize=function(t){return _.isObject(t)?JSON.stringify(t):t},t.prototype.sendMessage=function(t){var e,r,n,i,o;if(this.pendingMessages.push(t),this.connected){for(n=_.map(this.pendingMessages,this.serialize),this.pendingMessages=[],o=[],e=0,r=n.length;e\n
<%- name %>
'),i=function(i,c,u){var l,p,d,f,h;return h=function(t){var e,o,a;return o={name:r.instant("COMMON.ASSIGNED_TO.NOT_ASSIGNED")},a=i.usersById[t.assigned_to],e=n.getAvatar(a),o.imgurl=e.url,o.bg=e.bg,a&&(o.name=a.full_name_display),c.find(".avatar").html(s(o)),c.find(".task-assignedto").attr("title",o.name)},l=c.controller(),f=i.$eval(u.tgRelatedTaskAssignedToInlineEdition),d=i.$eval(u.notAutoSave),p=!d,i.$watch(u.tgRelatedTaskAssignedToInlineEdition,function(){return f=i.$eval(u.tgRelatedTaskAssignedToInlineEdition),h(f)}),h(f),c.on("click",".task-assignedto",function(t){return e.$broadcast("assigned-to:add",f)}),a.bindOnce(i,"project",function(t){if(t.my_permissions.indexOf("modify_task")===-1)return c.unbind("click"),c.find("a").addClass("not-clickable")}),i.$on("assigned-to:added",o(2e3,function(e){return function(e,r,n){if(n.id===f.id)return n.assigned_to=r,p&&t.save(n).then(function(){return i.$emit("related-tasks:assigned-to-changed")}),h(n)}}(this))),i.$on("$destroy",function(){return c.off()})},{link:i}},s.directive("tgRelatedTaskAssignedToInlineEdition",["$tgRepo","$rootScope","$translate","tgAvatarService",t])}.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;i=this.taiga,t=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e}(i.Service),o={auth:"/auth","auth-register":"/auth/register",invitations:"/invitations",users:"/users",by_username:"/users/by_username","users-password-recovery":"/users/password_recovery","users-change-password-from-recovery":"/users/change_password_from_recovery","users-change-password":"/users/change_password","users-change-email":"/users/change_email","users-cancel-account":"/users/cancel","users-export":"/users/export","user-stats":"/users/%s/stats","user-liked":"/users/%s/liked","user-voted":"/users/%s/voted","user-watched":"/users/%s/watched","user-contacts":"/users/%s/contacts","user-me":"/users/me",permissions:"/permissions","notify-policies":"/notify-policies",notifications:"/web-notifications","user-project-settings":"/user-project-settings","user-storage":"/user-storage",memberships:"/memberships","bulk-create-memberships":"/memberships/bulk_create",roles:"/roles",permissions:"/permissions",resolver:"/resolver",projects:"/projects","project-templates":"/project-templates","project-modules":"/projects/%s/modules","bulk-update-projects-order":"/projects/bulk_update_order","project-like":"/projects/%s/like","project-unlike":"/projects/%s/unlike","project-watch":"/projects/%s/watch","project-unwatch":"/projects/%s/unwatch","project-contact":"contact","project-transfer-validate-token":"/projects/%s/transfer_validate_token","project-transfer-accept":"/projects/%s/transfer_accept","project-transfer-reject":"/projects/%s/transfer_reject","project-transfer-request":"/projects/%s/transfer_request","project-transfer-start":"/projects/%s/transfer_start","epic-statuses":"/epic-statuses","userstory-statuses":"/userstory-statuses","userstory-due-dates":"/userstory-due-dates","userstory-due-dates-create-default":"/userstory-due-dates/create_default",points:"/points","task-statuses":"/task-statuses","task-due-dates":"/task-due-dates","task-due-dates-create-default":"/task-due-dates/create_default","issue-statuses":"/issue-statuses","issue-due-dates":"/issue-due-dates","issue-due-dates-create-default":"/issue-due-dates/create_default","issue-types":"/issue-types",priorities:"/priorities",severities:"/severities",milestones:"/milestones","move-userstories-to-milestone":"/milestones/%s/move_userstories_to_sprint","move-tasks-to-milestone":"/milestones/%s/move_tasks_to_sprint","move-issues-to-milestone":"/milestones/%s/move_issues_to_sprint",epics:"/epics","epic-upvote":"/epics/%s/upvote","epic-downvote":"/epics/%s/downvote","epic-watch":"/epics/%s/watch","epic-unwatch":"/epics/%s/unwatch","epic-related-userstories":"/epics/%s/related_userstories","epic-related-userstories-bulk-create":"/epics/%s/related_userstories/bulk_create",userstories:"/userstories","bulk-create-us":"/userstories/bulk_create","bulk-update-us-backlog-order":"/userstories/bulk_update_backlog_order","bulk-update-us-milestone":"/userstories/bulk_update_milestone","bulk-update-us-miles-order":"/userstories/bulk_update_sprint_order","bulk-update-us-kanban-order":"/userstories/bulk_update_kanban_order","userstories-filters":"/userstories/filters_data","userstory-upvote":"/userstories/%s/upvote","userstory-downvote":"/userstories/%s/downvote","userstory-watch":"/userstories/%s/watch","userstory-unwatch":"/userstories/%s/unwatch",tasks:"/tasks","bulk-create-tasks":"/tasks/bulk_create","bulk-update-task-taskboard-order":"/tasks/bulk_update_taskboard_order","bulk-update-task-milestone":"/tasks/bulk_update_milestone","task-upvote":"/tasks/%s/upvote","task-downvote":"/tasks/%s/downvote","task-watch":"/tasks/%s/watch","task-unwatch":"/tasks/%s/unwatch","task-filters":"/tasks/filters_data",issues:"/issues","bulk-create-issues":"/issues/bulk_create","bulk-update-issue-milestone":"/issues/bulk_update_milestone","issues-filters":"/issues/filters_data","issue-upvote":"/issues/%s/upvote","issue-downvote":"/issues/%s/downvote","issue-watch":"/issues/%s/watch","issue-unwatch":"/issues/%s/unwatch",wiki:"/wiki","wiki-restore":"/wiki/%s/restore","wiki-links":"/wiki-links","history/epic":"/history/epic","history/us":"/history/userstory","history/issue":"/history/issue","history/task":"/history/task","history/wiki":"/history/wiki","attachments/epic":"/epics/attachments","attachments/us":"/userstories/attachments","attachments/issue":"/issues/attachments","attachments/task":"/tasks/attachments","attachments/wiki_page":"/wiki/attachments","custom-attributes/epic":"/epic-custom-attributes","custom-attributes/userstory":"/userstory-custom-attributes","custom-attributes/task":"/task-custom-attributes","custom-attributes/issue":"/issue-custom-attributes","custom-attributes-values/epic":"/epics/custom-attributes-values","custom-attributes-values/userstory":"/userstories/custom-attributes-values","custom-attributes-values/task":"/tasks/custom-attributes-values","custom-attributes-values/issue":"/issues/custom-attributes-values",webhooks:"/webhooks","webhooks-test":"/webhooks/%s/test",webhooklogs:"/webhooklogs","webhooklogs-resend":"/webhooklogs/%s/resend","epics-csv":"/epics/csv?uuid=%s","userstories-csv":"/userstories/csv?uuid=%s","tasks-csv":"/tasks/csv?uuid=%s","issues-csv":"/issues/csv?uuid=%s","timeline-profile":"/timeline/profile","timeline-user":"/timeline/user","timeline-project":"/timeline/project",search:"/search",exporter:"/exporter",importer:"/importer/load_dump",feedback:"/feedback",locales:"/locales",applications:"/applications","application-tokens":"/application-tokens","stats-discover":"/stats/discover","importers-trello-auth-url":"/importers/trello/auth_url","importers-trello-authorize":"/importers/trello/authorize","importers-trello-list-projects":"/importers/trello/list_projects","importers-trello-list-users":"/importers/trello/list_users","importers-trello-import-project":"/importers/trello/import_project","importers-jira-auth-url":"/importers/jira/auth_url","importers-jira-authorize":"/importers/jira/authorize","importers-jira-list-projects":"/importers/jira/list_projects","importers-jira-list-users":"/importers/jira/list_users","importers-jira-import-project":"/importers/jira/import_project","importers-github-auth-url":"/importers/github/auth_url","importers-github-authorize":"/importers/github/authorize","importers-github-list-projects":"/importers/github/list_projects","importers-github-list-users":"/importers/github/list_users","importers-github-import-project":"/importers/github/import_project","importers-asana-auth-url":"/importers/asana/auth_url","importers-asana-authorize":"/importers/asana/authorize","importers-asana-list-projects":"/importers/asana/list_projects","importers-asana-list-users":"/importers/asana/list_users","importers-asana-import-project":"/importers/asana/import_project"},r=function(t,e){return t.debug("Initialize api urls"),e.update(o)},e=function(t,e){var r,n,i,o,s;for(t.debug("Initialize resources"),o=_.toArray(arguments).slice(2),s=[],r=0,n=o.length;rn){n=a.length,s.name=i,s.value=a;break}return 0===n?s:s},h=function(t){var e,r,n;r=[];for(e in t)n=t[e],m.find("li."+e).show(),r.push(m.find("li."+e+" .num").html(n.length));return r},f=function(t){return m.find("a.active").removeClass("active"),m.find("li."+t.name+" a").addClass("active"),u=!1,c=t.name},v={epics:r.get("search-epics"),issues:r.get("search-issues"),tasks:r.get("search-tasks"),userstories:r.get("search-userstories"),wikipages:r.get("search-wikipages")},g=function(r){var i,o,s,a,c;return o=n.find(".search-result-table").children(),s=o.scope(),s&&(s.$destroy(),o.remove()),a=t.$new(),a[r.name]=r.value,c=angular.element.parseHTML(l(v[r.name])),i=e(c)(a),n.find(".search-result-table").html(i)},t.$watch("searchResults",function(t){var e;if(p=t)return e=d(t),h(t),g(e),f(e)}),t.$watch("searchTerm",function(t){return void 0!==t&&i.search("text",t),o.trackPage(i.url(),"Search")}),n.on("click",".search-filter li > a",function(e){var r,n,i,o;return e.preventDefault(),o=angular.element(e.currentTarget),i=o.parent().data("name"),n=p?p[i]:[],r={name:i,value:n},t.$apply(function(){return g(r),f(r)})})},s=function(t,e,r){var i,o;return i=e.controller(),a(t,e,r,i),o=n.text,t.$watch("projectId",function(e){if(null!=e)return t.searchTerm=o})},{link:s}},c.directive("tgSearch",["$log","$compile","$templateCache","$routeParams","$tgLocation","$tgAnalytics",r])}.call(this),function(){var t;t=angular.module("taigaTaskboard",[])}.call(this),function(){var t;t=angular.module("taigaTasks",[])}.call(this),function(){var t;t=angular.module("taigaTeam",[])}.call(this),function(){var t;t=angular.module("taigaUserSettings",[])}.call(this),function(){var t;t=angular.module("taigaUserStories",[])}.call(this),function(){var t;t=angular.module("taigaWiki",[])}.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=angular.module("taigaCommon"),t=function(t){function e(t,e,r,n,i,o){var s;this.rootscope=t,this.log=e,this.config=r,this.win=n,this.doc=i,this.location=o,this.initialized=!1,s=this.config.get("analytics",{}),this.accountId=s.accountId,this.pageEvent=s.pageEvent||"$routeChangeSuccess",this.trackRoutes=s.trackRoutes||!0,this.ignoreFirstPageLoad=s.ignoreFirstPageLoad||!1}return n(e,t),e.$inject=["$rootScope","$log","$tgConfig","$window","$document","$location"],e.prototype.initialize=function(){return this.accountId?(this.injectAnalytics(),this.win.ga("create",this.accountId,"auto"),this.win.ga("require","ec"),this.win.ga("require","displayfeatures"),this.trackRoutes&&!this.ignoreFirstPageLoad&&this.win.ga("send","pageview",this.getUrl()),this.trackRoutes&&this.rootscope.$on(this.pageEvent,function(t){return function(){return t.trackPage(t.getUrl(),"Taiga")}}(this)),this.initialized=!0,this.setUserId()):void this.log.debug("Analytics: no acount id provided. Disabling.")},e.prototype.setUserId=function(){var t,e;if(this.initialized&&this.win.ga)return this.win.ga("set","userId",null!=(t=this.rootscope)&&null!=(e=t.user)?e.uuid:void 0)},e.prototype.getUrl=function(){return this.location.path()},e.prototype.injectAnalytics=function(){var t;return(t=function(t,e,r,n,i,o,s){t.GoogleAnalyticsObject=i,t[i]=t[i]||function(){(t[i].q=t[i].q||[]).push(arguments)},t[i].l=1*new Date,o=e.createElement(r),s=e.getElementsByTagName(r)[0],o.async=1,o.src=n,s.parentNode.insertBefore(o,s)})(window,document,"script","//www.google-analytics.com/analytics.js","ga")},e.prototype.trackPage=function(t,e){if(this.initialized&&this.win.ga)return e=e||this.doc[0].title,this.win.ga("send","pageview",{page:t,title:e})},e.prototype.trackEvent=function(t,e,r,n){if(this.initialized&&this.win.ga)return this.win.ga("send","event",t,e,r,n)},e.prototype.ecViewPlan=function(t){if(this.initialized&&this.win.ga)return this.win.ga("ec:addProduct",{id:t.plan_id,name:t.name,category:"plans",quantity:1,position:1}),this.win.ga("ec:setAction","detail"),this.trackEvent("ecommerce","view-product-detail",t.name,t.plan_id)},e.prototype.ecClickPlan=function(t){if(this.initialized&&this.win.ga)return this.win.ga("ec:addProduct",{id:t.plan_id,name:t.name,category:"plans",quantity:1,position:1}),this.win.ga("ec:setAction","click"),this.trackEvent("ecommerce","click-product",t.name,t.plan_id)},e.prototype.ecListPlans=function(t,e){var r,n,i,o,s;if(o=t[0],this.initialized&&this.win.ga){for(s=1,r=0,n=o.length;r"+t+""))}),u.on("click.confirm-dialog","a.button-green",i(2e3,function(t){return function(e){var r,n;return e.preventDefault(),n=angular.element(e.currentTarget),r=t.loading().target(n).start(),c.resolve({selected:a.val(),finish:function(e){if(null==e&&(e=!0),r.finish(),e)return t.hide(u)}})}}(this))),u.on("click.confirm-dialog",".button-red",function(t){return function(e){return e.preventDefault(),c.reject(),t.hide(u)}}(this)),this.lightboxService.open(u),c.promise},o.prototype.error=function(t){var e,r;return e=this.q.defer(),r=angular.element(".lightbox-generic-error"),r.find(".title").html(t),r.on("click.confirm-dialog",".button-green",function(t){return function(n){return n.preventDefault(),e.resolve(),t.hide(r)}}(this)),r.on("click.confirm-dialog",".close",function(t){return function(n){return n.preventDefault(),e.resolve(),t.hide(r)}}(this)),this.lightboxService.open(r),e.promise},o.prototype.success=function(t,e,r,n){var i,o,a,c,u;return i=this.q.defer(),a=angular.element(".lightbox-generic-success"),a.find("img").remove(),a.find("svg").remove(),r&&("img"===r.type?o=$("").addClass("lb-icon").attr("src",r.name):"svg"===r.type&&(o=document.createElement("div"),s.addClass(o,"icon"),s.addClass(o,r.name),s.addClass(o,"lb-icon"),c=document.createElementNS("http://www.w3.org/2000/svg","svg"),u=document.createElementNS("http://www.w3.org/2000/svg","use"),u.setAttributeNS("http://www.w3.org/1999/xlink","href","#"+r.name),o.appendChild(c).appendChild(u)),o&&a.find("section").prepend(o)),t&&a.find(".title").html(t),e&&a.find(".message").html(e),n&&(a.find(".button-green").html(n),a.find(".button-green").attr("title",n)),a.on("click.confirm-dialog",".button-green",function(t){return function(e){return e.preventDefault(),i.resolve(),t.hide(a)}}(this)),a.on("click.confirm-dialog",".close",function(t){return function(e){return e.preventDefault(),i.resolve(),t.hide(a)}}(this)),this.lightboxService.open(a),i.promise},o.prototype.loader=function(t,e,r){var n;return null==r&&(r=!1),n=angular.element(".lightbox-generic-loading"),t&&n.find(".title").html(t),e&&n.find(".message").html(e),r&&n.find(".spin").removeClass("hidden"),{start:function(t){return function(){return t.lightboxService.open(n)}}(this),stop:function(t){return function(){return t.lightboxService.close(n)}}(this),update:function(t){return function(t,e,r,i){return e&&n.find(".title").html(e),r&&n.find(".message").html(r),i?(n.find(".spin").addClass("hidden"),n.find(".progress-bar-wrapper").removeClass("hidden"),n.find(".progress-bar-wrapper > .bar").width(i+"%"),n.find(".progress-bar-wrapper > span").html(i+"%").css("left",i-9+"%")):(n.find(".spin").removeClass("hidden"),n.find(".progress-bar-wrapper").addClass("hidden"))}}(this)}},o.prototype.notify=function(t,r,i,o){var s,c,u;if(u=".notification-message-"+t,c=angular.element(u),!c.hasClass("active"))return i?c.find("h4").html(i):c.find("h4").html(this.translate.instant(e[t].title)),r?c.find("p").html(r):c.find("p").html(this.translate.instant(e[t].message)),s=angular.element("body"),s.find(".notification-message .notification-light").removeClass("active").addClass("inactive"),s.find(u).removeClass("inactive").addClass("active"),this.tsem&&n(this.tsem),o||(o="error"===t||"light-error"===t?3500:1500),this.tsem=a(o,function(t){return function(){return s.find(u).removeClass("active").addClass("inactive").one("animationend",function(){return $(this).removeClass("inactive")}),delete t.tsem}}(this)),c.on("click",".icon-close, .close",function(t){return function(t){return s.find(u).removeClass("active").addClass("inactive")}}(this))},o}(s.Service),o=angular.module("taigaCommon"),o.service("$tgConfirm",t)}.call(this),function(){var t,e,r,n,i,o,s,a,c,u,l,p,d,f,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;v=this.taiga,d=this.taiga.bindMethods,f=this.taiga.bindOnce,h=this.taiga.debounce,g=v.generateHash,m=angular.module("taigaCommon"),u="text",c="url",s="multiline",i="date",p="url",o="dropdown",t="checkbox",a="number",l=[{key:u,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_TEXT"},{key:s,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_MULTI"},{key:i,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_DATE"},{key:p,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_URL"},{key:c,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_RICHTEXT"},{key:o,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_DROPDOWN"},{key:t,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_CHECKBOX"},{key:a,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_NUMBER"}],r=function(t){function e(t,e,r,n,i,o){this.scope=t,this.rootscope=e,this.repo=r,this.rs=n,this.confirm=i,this.q=o,d(this),this.type=null,this.objectId=null,this.projectId=null,this.customAttributes=[],this.customAttributesValues=null}return y(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgResources","$tgConfirm","$q"],e.prototype.initialize=function(t,e){return this.project=this.scope.project,this.type=t,this.objectId=e,this.projectId=this.scope.projectId},e.prototype.loadCustomAttributesValues=function(){return this.objectId?this.rs.customAttributesValues[this.type].get(this.objectId).then(function(t){return function(e){return t.customAttributes=t.project[t.type+"_custom_attributes"],t.customAttributesValues=e,e}}(this)):this.customAttributesValues},e.prototype.getAttributeValue=function(t){var e;return e=_.clone(t,!1),e.value=this.customAttributesValues.attributes_values[t.id],e},e.prototype.updateAttributeValue=function(t){var e,r,n;return n=function(t){return function(){return t.rootscope.$broadcast("custom-attributes-values:edit")}}(this),r=function(t){return function(e){return t.confirm.notify("error"),t.q.reject()}}(this),e=_.clone(this.customAttributesValues.attributes_values,!0),e[t.id]=t.value,this.customAttributesValues.attributes_values=e,this.customAttributesValues.id=this.objectId,this.repo.save(this.customAttributesValues).then(n,r)},e}(v.Controller),n=function(t,e){var n,i,o,s;return o=t.get("custom-attributes/custom-attributes-values.html",!0),n=function(t){return g(["custom-attributes-collapsed",t])},i=function(t,r,i,o){var s,a,c;return s=o[0],a=o[1],c=n(i.type),t.collapsed=e.get(c)||!1,f(t,i.ngModel,function(t){return s.initialize(i.type,t.id),s.loadCustomAttributesValues()}),t.toggleCollapse=function(){return t.collapsed=!t.collapsed,e.set(c,t.collapsed)},t.$on("$destroy",function(){return r.off()})},s=function(t,e){return o({requiredEditionPerm:e.requiredEditionPerm})},{require:["tgCustomAttributesValues","ngModel"],controller:r,controllerAs:"ctrl",restrict:"AE",scope:!0,link:i,template:s}},m.directive("tgCustomAttributesValues",["$tgTemplate","$tgStorage","$translate",n]),e=function(e,r,n,s,c,u){var l,p,d;return p=e.get("custom-attributes/custom-attribute-value.html",!0),d=e.get("custom-attributes/custom-attribute-value-edit.html",!0),l=function(e,l,f,g){var m,v,y,b,S,j;return y=s.instant("COMMON.PICKERDATE.FORMAT"),b=function(t,r){var o,s,f,h,g,m;return null==r&&(r=!1),t.type===i&&t.value&&(m=moment(t.value,"YYYY-MM-DD").format(y)),m=t.type===a&&t.value?parseFloat(t.value):t.value,f=v(),o={id:t.id,name:t.name,description:t.description,value:m,type:t.type,isEditable:f},g=e.$new(),g.attributeHtml=u.getHTML(m),g.extra=t.extra,g.model=m,!f||!r&&m?(h=p(o),h=n(h)(g),l.html(h)):(h=d(o),h=n(h)(g),l.html(h),t.type===i?(s=c.get(),_.merge(s,{field:l.find("input[name=value]")[0],onSelect:function(t){return function(t){var e;return e=t}}(this),onOpen:function(t){return function(){if("undefined"!=typeof selectedDate&&null!==selectedDate)return l.picker.setDate(selectedDate)}}(this)}),l.picker=new Pikaday(s)):void 0)},v=function(){var t,r;return t=e.project.my_permissions,r=f.requiredEditionPerm,t.indexOf(r)>-1},e.saveCustomRichText=function(t){return function(t,e){return m.value=t,g.updateAttributeValue(m).then(function(){return e(),b(m,!1)})}}(this),e.cancelCustomRichText=function(t){return function(){return b(m,!1),null}}(this),j=h(2e3,function(r){return function(r){var n,s;if(r.preventDefault(),n=l.find("form").checksley(),n.validate())return m.type===o?(s=l.find("select[name='value']"),m.value=s.val()):m.type===t?(s=l.find("input[name=value]"),m.value=s[0].checked):(s=l.find("input[name=value], textarea[name='value']"),m.value=s.val(),m.type===i&&moment(m.value,y).isValid()&&(m.value=moment(m.value,y).format("YYYY-MM-DD")),m.type===a&&(m.value=parseFloat(m.value))),e.$apply(function(){return g.updateAttributeValue(m).then(function(){return b(m,!1)})})}}(this)),S=function(){return l.find("input[name='value'], textarea[name='value']").focus().select()},m=e.$eval(f.tgCustomAttributeValue),null!==m.value&&void 0!==m.value||(m.value=""),e.customAttributeValue=m,b(m),l.on("click",".js-value-view-mode span a",function(t){return t.stopPropagation()}),l.on("click",".js-value-view-mode",function(){if(v()&&!r.get().length)return b(m,!0),S()}),l.on("click",".js-edit-description",function(t){return t.preventDefault(),b(m,!0),S()}),l.on("keyup","input[name=value], textarea[name='value']",function(t){return 13===t.keyCode&&"textarea"!==t.currentTarget.type?j(t):27===t.keyCode?b(m,!1):void 0}),l.on("submit","form",j),l.on("click",".js-save-description",j),e.$on("$destroy",function(){return l.off()})},{link:l,require:"^tgCustomAttributesValues",restrict:"AE"}},m.directive("tgCustomAttributeValue",["$tgTemplate","$selectedText","$compile","$translate","tgDatePickerConfigService","tgWysiwygService",e])}.call(this),function(){var t,e,r,n=function(t,e){return function(){return t.apply(e,arguments)}},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;r=this.taiga,e=angular.module("taigaCommon"),t=function(t){function e(){this.replaceEmojiNameByHtmlImgs=n(this.replaceEmojiNameByHtmlImgs,this),this.replaceEmojiNameByImgs=n(this.replaceEmojiNameByImgs,this),this.replaceImgsByEmojiName=n(this.replaceImgsByEmojiName,this),this.getEmojiByName=n(this.getEmojiByName,this),this.getEmojiById=n(this.getEmojiById,this),this.searchByName=n(this.searchByName,this),this.emojis=_.map(r.emojis,function(t){return t.image="/"+window._version+"/emojis/"+t.image,t}),this.emojisById=_.keyBy(this.emojis,"id"),this.emojisByName=_.keyBy(this.emojis,"name")}return i(e,t),e.$inject=[],e.prototype.searchByName=function(t){return _.filter(this.emojis,function(e){return e.name.indexOf(t)!==-1})},e.prototype.getEmojiById=function(t){return this.emojisById[t]},e.prototype.getEmojiByName=function(t){return this.emojisByName[t]},e.prototype.replaceImgsByEmojiName=function(t){var e,n,i,o,s,a;for(i=r.getMatches(t,/emojis\/([^"]+).png"/gi),o=0,s=i.length;o]+>","g"),e=this.getEmojiById(n),t=t.replace(a,":"+e.name+":");return t},e.prototype.replaceEmojiNameByImgs=function(t){var e,n,i,o,s,a;for(i=r.getMatches(t,/:([\w +-]*):/g),o=0,s=i.length;o'));return t},e}(r.Service),e.service("$tgEmojis",t)}.call(this),function(){var t,e,r,n,i,o,s=function(t,e){return function(){return t.apply(e,arguments)}};o=this.taiga,n=this.taiga.groupBy,i=angular.module("taigaCommon"),e=function(t,e,r,n,i){var o;return o=function(e,r,o,s){return e.$watch(o.ngModel,function(o){var a;if(o)return a=t.create(r,o,e.project),a.onSelectedPointForRole=function(t,r,n){return o.points=n,a.render(),e.$apply(function(){return s.$setViewValue(o)})},a.render=function(){var t,r,o,s;return t={totalPoints:this.calculateTotalPoints(),roles:this.calculateRoles(),editable:this.isEditable,loading:!1},o="common/estimation/us-estimation-points-per-role.html",s=n.get(o,!0),r=s(t),r=i(r)(e),this.$el.html(r)},a.render()}),e.$on("$destroy",function(){return r.off()})},{link:o,restrict:"EA",require:"ngModel"}},i.directive("tgLbUsEstimation",["$tgEstimationsService","$rootScope","$tgRepo","$tgTemplate","$compile",e]),r=function(t,e,r,n,i,o,s){var a;return a=function(r,a,c,u){var l;return l=function(t){var e,r;return r=o.save(function(e){return function(e){return e.points=t,e}}(this)),e=function(t){return function(){return s.notify("error")}}(this),r.then(null,e)},r.$watchCollection(function(){return u.$modelValue&&u.$modelValue.points},function(){var o,s;if(s=u.$modelValue)return o=t.create(a,s,r.project),o.onSelectedPointForRole=function(t,r,n){return o.loading=t,o.render(),l(n).then(function(){return o.loading=!1,e.$broadcast("object:updated"),o.render()})},o.render=function(){var t,e,s,a;return t={totalPoints:this.calculateTotalPoints(),roles:this.calculateRoles(),editable:this.isEditable,loading:o.loading},s="common/estimation/us-estimation-points-per-role.html",a=n.get(s,!0),e=a(t),e=i(e)(r),this.$el.html(e)},o.render()}),r.$on("$destroy",function(){return a.off()})},{link:a,restrict:"EA",require:"ngModel"}},i.directive("tgUsEstimation",["$tgEstimationsService","$rootScope","$tgRepo","$tgTemplate","$compile","$tgQueueModelTransformation","$tgConfirm",r]),t=function(t,e,r,i,o){var a,c,u;return u=t.get("common/estimation/us-estimation-points.html",!0),a=function(){function t(t,e,r){this.$el=t,this.us=e,this.project=r,this.bindClickEvents=s(this.bindClickEvents,this),this.isEditable=this.project.my_permissions.indexOf("modify_us")!==-1,this.roles=this.project.roles,this.points=this.project.points,this.loading=!1,this.pointsById=n(this.points,function(t){return t.id}),this.onSelectedPointForRole=function(t,e){},this.render=function(){}}return t.prototype.save=function(t,n){var s;return s=i.defer(),o.add(function(t){return function(){var n,i;return i=function(){return s.resolve(),t.render()},n=function(){return r.notify("error"),t.us.revert(),t.render(),s.reject()},e.save(t.us).then(i,n)}}(this)),s.promise},t.prototype.calculateTotalPoints=function(){var t,e;return e=_.map(this.us.points,function(t){return function(e,r){var n;return null!=(n=t.pointsById[e])?n.value:void 0}}(this)),0===e.length?"?":(t=_.filter(e,function(t){return null!=t}),0===t.length?"?":_.reduce(t,function(t,e){return t+e}))},t.prototype.calculateRoles=function(){var t,e;return t=_.filter(this.project.roles,"computable"),e=_.map(t,function(t){return function(e){var r,n;return r=t.us.points[e.id],n=t.pointsById[r],e=_.clone(e,!0),e.points=null!=n&&null!=n.name?n.name:"?",e}}(this))},t.prototype.bindClickEvents=function(){return this.$el.on("click",".total.clickable",function(t){return function(e){var r,n;return e.preventDefault(),e.stopPropagation(),n=angular.element(e.currentTarget),r=n.data("role-id"),t.renderPointsSelector(r,n),n.siblings().removeClass("active"),n.addClass("active")}}(this)),this.$el.on("click",".point",function(t){return function(e){var r,n,i,o;return e.preventDefault(),e.stopPropagation(),o=angular.element(e.currentTarget),i=o.data("role-id"),r=o.data("point-id"),t.$el.find(".popover").popover().close(),n=_.clone(t.us.points,!0),n[i]=r,t.onSelectedPointForRole(i,r,n)}}(this))},t.prototype.renderPointsSelector=function(t,e){var r,n,i,o,s;if(o=_.map(this.points,function(e){return function(r){return r=_.clone(r,!0),r.selected=e.us.points[t]!==r.id,r}}(this)),i=5,r=_.some(o,function(t){return function(t){return t.name.length>i}}(this)),n=u({points:o,roleId:t,horizontal:r}),this.$el.find(".popover").popover().close(),this.$el.find(".pop-points-open").remove(),null!=e?this.$el.find(e).append(n):this.$el.append(n),this.$el.find(".pop-points-open").popover().open(function(){return $(this).removeClass("active").closest("li").removeClass("active")}),this.$el.find(".pop-points-open").show(),s=this.$el.find(".pop-points-open"),s.offset().top+s.height()>document.body.clientHeight)return s.addClass("pop-bottom")},t}(),c=function(t,e,r){var n;return t.unbind("click"),n=new a(t,e,r),n.isEditable&&n.bindClickEvents(),n},{create:c}},i.factory("$tgEstimationsService",["$tgTemplate","$tgRepo","$tgConfirm","$q","$tgQqueue",t])}.call(this),function(){var t,e,r,n,i,o,s,a,c,u,l,p,d,f,h;l=this.taiga,s=angular.module("taigaCommon"),r=function(){return function(t,e){return t===[null,void 0]?e:t}},s.filter("default",r),h=function(t){return function(e){return e?t.instant("COMMON.YES"):t.instant("COMMON.NO")}},s.filter("yesNo",["$translate",h]),f=function(){return l.unslugify},s.filter("unslugify",f),a=function(){return function(t,e){return t?moment(t).format(e):""}},s.filter("momentFormat",a),c=function(){return function(t,e){return t?moment(t).fromNow(e||!1):""}},s.filter("momentFromNow",c),u=function(t){return function(){return t.taiga.sizeFormat}}(this),s.filter("sizeFormat",u),d=function(){var t,e;return e=function(t){return t.toJS()},t=_.memoize(e),function(e){return e instanceof Immutable.List?t(e):e}},s.filter("toMutable",d),t=function(t){return function(e,r){var n;return(null!=r?r.startsWith("#"):void 0)?(n=r.substr(1),_.filter(e,function(t){return function(t){return String(t.ref).startsWith(n)}}(this))):t(e,r)}},s.filter("byRef",["filterFilter",t]),e=function(){return function(t,e){var r,n,i,o,s,a,c,u;for(t=new String(t).replace(/[^0-9a-f]/gi,""),t.length<6&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),e=e||0,a="#",n=0,i=0,r=0,u=255,c=[0,1,2],o=0,s=c.length;o/g,""):""}},s.filter("textToHTML",["$filter",p])}.call(this),function(){var t,e,r,n,i,o,s,a,c,u,l,p,d,f,h,g,m,v,y,b,S,j,k=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,T=[].indexOf||function(t){for(var e=0,r=this.length;e5},c=f(r),c=n(c)(s),a.find(".assigned-to-list").html(c)},u=function(){return e.stop(),t.close(a)},s.$on("assigned-to:add",function(r,n){var i;return p=n,i=n.assigned_to,d=s.usersById[i],l(d),t.open(a).then(function(){return a.find("input").focus(),e.init(a)})}),s.$watch("usersSearch",function(t){if(null!=t)return l(d,t),a.find("input").focus()}),a.on("click",".user-list-single",function(t){var e;return t.preventDefault(),e=angular.element(t.currentTarget),u(),s.$apply(function(){return s.$broadcast("assigned-to:added",e.data("user-id"),p),s.usersSearch=null})}),a.on("click",".remove-assigned-to",function(t){return t.preventDefault(),t.stopPropagation(),u(),s.$apply(function(){return s.usersSearch=null,s.$broadcast("assigned-to:added",null,p)})}),a.on("click",".close",function(t){return t.preventDefault(),u(),s.$apply(function(){return s.usersSearch=null})}),s.$on("$destroy",function(){return a.off()})},{templateUrl:"common/lightbox/lightbox-assigned-to.html",link:s}},v.directive("tgLbAssignedto",["lightboxService","lightboxKeyboardNavigationService","$tgTemplate","$compile","tgAvatarService","tgUserListService",t]),e=function(t,e,r,n,i,o,s){var a;return a=function(t,a,c){var u,l,p,d,f;return d=[],p=null,f=n.get("common/lightbox/lightbox-assigned-users-users.html",!0),l=function(e,r){var n,c,u,l,p;return l=s.searchUsers(r),u=[],_.map(l,function(t){var r;if(r=t.id,T.call(e,r)>=0)return t.avatar=o.getAvatar(t),u.push(t)}),p=[],_.map(l,function(t){var r;if(r=t.id,T.call(e,r)<0)return t.avatar=o.getAvatar(t),p.push(t)}),n={selected:u,users:_.slice(p,0,5),showMore:l.length>5},c=f(n),c=i(c)(t),a.find(".assigned-to-list").html(c)},u=function(){return r.stop(),e.close(a)},t.$on("assigned-user:add",function(t,n){return p=n,d=n.assigned_users,l(d),e.open(a).then(function(){return a.find("input").focus(),r.init(a)})}),t.$watch("usersSearch",function(t){if(null!=t)return l(d,t),a.find("input").focus()}),a.on("click",".user-list-single",h(200,function(e){var r;return u(),e.preventDefault(),r=angular.element(e.currentTarget),t.$apply(function(){return t.usersSearch=null,t.$broadcast("assigned-user:added",r.data("user-id"),p)})})),a.on("click",".remove-assigned-to",function(e){var r;return e.preventDefault(),r=angular.element(e.currentTarget),e.stopPropagation(),t.$apply(function(){return t.usersSearch=null,t.$broadcast("assigned-user:deleted",r.data("user-id"),p)}),u()}),a.on("click",".close",function(t){return t.preventDefault(),u()}),t.$on("$destroy",function(){return a.off()})},{templateUrl:"common/lightbox/lightbox-assigned-users.html",link:a}},v.directive("tgLbAssignedUsers",["$tgRepo","lightboxService","lightboxKeyboardNavigationService","$tgTemplate","$compile","tgAvatarService","tgUserListService",e]),d=function(t,e,r,n,i,o){ var s;return s=function(t,s,a){var c,u,l,p,d;return p=null,d=n.get("common/lightbox/lightbox-assigned-to-users.html",!0),u=function(e){var r,n;return null==e&&(e=""),r=function(t,e){var r;return(!p||!_.find(p.watchers,function(t){return t===e.id}))&&(r=e.full_name_display.toUpperCase(),t=t.toUpperCase(),_.includes(r,t))},n=_.clone(t.activeUsers,!0),n=_.filter(n,_.partial(r,e))},l=function(e){var r,n,a;return a=_.slice(e,0,5),a=_.map(a,function(t){return t.avatar=o.getAvatar(t),t}),r={selected:!1,users:a,showMore:e.length>5},n=d(r),n=i(n)(t),s.find(".ticket-watchers").html(n)},c=function(){return r.stop(),e.close(s)},t.$on("watcher:add",function(t,n){var i;return p=n,i=u(),l(i),e.open(s).then(function(){return s.find("input").focus(),r.init(s)})}),t.$watch("usersSearch",function(t){var e;if(null!=t)return e=u(t),l(e),s.find("input").focus()}),s.on("click",".user-list-single",h(200,function(e){var r;return c(),e.preventDefault(),r=angular.element(e.currentTarget),t.$apply(function(){return t.usersSearch=null,t.$broadcast("watcher:added",r.data("user-id"))})})),s.on("click",".close",function(e){return e.preventDefault(),c(),t.$apply(function(){return t.usersSearch=null})}),t.$on("$destroy",function(){return s.off()})},{templateUrl:"common/lightbox/lightbox-users.html",link:s}},v.directive("tgLbWatchers",["$tgRepo","lightboxService","lightboxKeyboardNavigationService","$tgTemplate","$compile","tgAvatarService",d]),c=function(t,e,r){var n;return n=function(e,r,n){return t.open(r)},{templateUrl:"common/lightbox/lightbox-leave-project-warning.html",link:n,scope:!0}},v.directive("tgLightboxLeaveProjectWarning",["lightboxService",c]),p=function(t,e,r,n,i,o){var s;return s=function(s,a,c){var u,l,p;return u=n.instant("COMMON.PICKERDATE.FORMAT"),e.open(a),s.object.due_date&&(s.new_due_date=moment(s.object.due_date).format(u)),a.on("click",".suggestion",function(t){var e,r,n,i;return r=angular.element(t.currentTarget),e=r.data("quantity"),n=r.data("unit"),i=moment().add(e,n).format(u),a.find(".due-date").val(i)}),p=function(){var n,c,l;return n=r().target(a.find(".submit-button")).start(),s.notAutoSave?(c=$(".due-date").val(),s.object.due_date=c?moment(c,u).format("YYYY-MM-DD"):null,s.$apply(),n.finish(),void e.close(a)):(l=o.save(function(t){return c=$(".due-date").val(),t.due_date=c?moment(c,u).format("YYYY-MM-DD"):null,t}),l.then(function(){return i.notify("success")}),l.then(null,function(){return i.notify("error")}),l["finally"](function(){return n.finish(),e.close(a),t.$broadcast("object:updated")}))},a.on("click",".submit-button",function(t){return t.preventDefault(),p()}),l=function(){var t,r,o;return o=n.instant("LIGHTBOX.DELETE_DUE_DATE.TITLE"),r=n.instant("LIGHTBOX.DELETE_DUE_DATE.SUBTITLE"),t=moment(s.object.due_date).format(u),i.askOnDelete(o,t,r).then(function(t){return t.finish(),$(".due-date").val(null),s.object.due_date_reason=null,s.notAutoSave?(s.object.due_date=null,e.close(a)):p()})},a.on("click",".delete-due-date",function(t){return t.preventDefault(),l()})},{templateUrl:"common/lightbox/lightbox-due-date.html",link:s,scope:!0}},v.directive("tgLbSetDueDate",["$rootScope","lightboxService","$tgLoading","$translate","$tgConfirm","$tgQueueModelTransformation",p]),m=this.taiga.groupBy,o=function(t,e,r,n,i,o,s,a,c,u,l,p,d){var f;return f=function(f,g,v){var y,b,S,k,$,I,E,C,P,w,A,O,R,M,U,N,D,x,L,F,B;return D=null,R=null,P=null,b=Immutable.List(),S=Immutable.List(),x={us:{objName:"User Story",model:"userstories",params:{include_attachments:!0,include_tasks:!0},data:function(t){return{translationID:"US",translationIDPlural:"US",statusList:_.sortBy(t.us_statuses,"order")}},initialData:function(t){return{project:t.project.id,subject:"",description:"",tags:[],points:{},status:t.statusId?t.statusId:t.project.default_us_status,is_archived:!1}}},task:{objName:"Task",model:"tasks",params:{include_attachments:!0},data:function(t){return{translationID:"TASK",translationIDPlural:"TASKS",statusList:_.sortBy(t.task_statuses,"order")}},initialData:function(t){return{project:t.project.id,subject:"",description:"",assigned_to:null,tags:[],milestone:t.sprintId,status:t.project.default_task_status,user_story:t.usId,is_archived:!1}}},issue:{objName:"Issue",model:"issues",params:{include_attachments:!0},data:function(t){return{translationID:"ISSUE",translationIDPlural:"ISSUES",project:t,statusList:_.sortBy(t.issue_statuses,"order"),typeById:m(t.issue_types,function(t){return t.id}),typeList:_.sortBy(t.issue_types,"order"),severityById:m(t.severities,function(t){return t.id}),severityList:_.sortBy(t.severities,"order"),priorityById:m(t.priorities,function(t){return t.id}),priorityList:_.sortBy(t.priorities,"order"),milestonesById:m(t.milestones,function(t){return t.id})}},initialData:function(t){return{assigned_to:null,milestone:t.sprintId,priority:t.project.default_priority,project:t.project.id,severity:t.project.default_severity,status:t.project.default_issue_status,subject:"",tags:[],type:t.project.default_issue_type}}}},f.setMode=function(t){return f.mode=t},f.$on("genericform:new",function(t,e){return w(e),f.mode="new",f.getOrCreate=!1,O(e)}),f.$on("genericform:new-or-existing",function(t,e){return w(e),f.mode="add-existing",f.getOrCreate=!0,f.existingFilterText="",n[D.model].listInAllProjects({project:f.project.id},!0).then(function(t){return f.existingItems=angular.copy(t)}),O(e)}),f.$on("genericform:edit",function(t,e){return w(e),f.mode="edit",f.getOrCreate=!1,O(e)}),w=function(e){return _.map(e,function(t,e){return f[e]=t}),f.objType&&x[f.objType]?D=x[f.objType]:t.error("Invalid objType `"+f.objType+"` for `genericform` event")},O=function(t){return f.objName=D.objName,"edit"===f.mode?(f.obj=t.obj,f.attachments=Immutable.fromJS(t.attachments)):(f.obj=r.make_model(D.model,D.initialData(t)),f.attachments=Immutable.List()),_.map(D.data(f.project),function(t,e){return f[e]=t}),P&&P.reset(),U(),L(f.obj.status),M(),f.lightboxOpen=!0,o.open(g,null,null,!0)},U=function(){return b=Immutable.List(),S=Immutable.List()},f.addAttachment=function(t){return b=b.push(t)},f.deleteAttachment=function(t){if(b=b.filter(function(e){return e.get("name")!==t.get("name")}),t.get("id"))return S=S.push(t)},f.addTag=function(t,e){var r,n,i,o,s;if(s=j(t.toLowerCase()),o=f.project.tags,i=f.project.tags_colors,null==o&&(o=[]),null==i&&(i={}),T.call(o,s)<0&&o.push(s),i[t]=e||null,f.project.tags=o,n=_.clone(f.obj.tags),r=_.find(n,function(t){return t[0]===s}),!r)return n.push([s,e]),f.obj.tags=n},f.deleteTag=function(t){var e,r,n;return n=j(t[0].toLowerCase()),r=f.project.tags,e=_.clone(f.obj.tags),_.remove(e,function(t){return t[0]===n}),f.obj.tags=e,_.pull(f.obj.tags,n)},I=function(t){var e;return e=_.map(b.toJS(),function(e){return l.upload(e.file,t.id,f.obj.project,f.objType)}),u.all(e)},E=function(t){var e;return e=_.map(S.toJS(),function(t){return l["delete"](f.objType,t.id)}),u.all(e)},y=function(t){var e,r,n;return e=s().target(g.find(".add-existing-button")).start(),t.milestone?F(t):(n=function(){return $(),i.$broadcast(f.objType+"form:add:success",t)},r=function(){return $()},N(t,n,r))},F=function(t){var e,r,n,s;return n=f.milestonesById[t.milestone].name,r=f.milestonesById[f.relatedObjectId].name,s=a.instant("ISSUES.CONFIRM_CHANGE_FROM_SPRINT.TITLE"),e=a.instant("ISSUES.CONFIRM_CHANGE_FROM_SPRINT.MESSAGE",{issue:t.subject,oldSprintName:n,newSprintName:r}),c.ask(s,null,e).then(function(e){var r,n;return n=function(){return e.finish(),o.closeAll(),f.lightboxOpen=!1,i.$broadcast(f.objType+"form:add:success",t)},r=function(){return e.finish(!1),c.notify("error")},N(t,n,r)})},N=function(t,r,n){return t.setAttr(f.relatedField,f.relatedObjectId),e.save(t,!0).then(r,n)},A=function(t){return t&&t[f.relatedField]===f.relatedObjectId},f.isDisabledExisting=function(t){return A(t)},f.addExistingToSprint=function(t){return y(t)},B=h(2e3,function(t){var r,o,u,l;if(P=g.find("form").checksley(),P.validate())return o=s().target(g.find(".submit-button")).start(),"new"===f.mode?(l=e.create(D.model,f.obj),r=f.objType+"form:new:success"):(f.obj.due_date instanceof moment&&(u=a.instant("COMMON.PICKERDATE.FORMAT"),f.obj.due_date=f.obj.due_date.format("YYYY-MM-DD")),l=e.save(f.obj,!0),r=f.objType+"form:edit:success"),l.then(function(t){return E(t).then(function(){return I(t).then(function(){if(o.finish(),$(),t.ref)return n[D.model].getByRef(t.project,t.ref,D.params).then(function(t){return i.$broadcast(r,t)})})})}),l.then(null,function(t){if(o.finish(),P.setErrors(t),t._error_message)return c.notify("error",t._error_message)})}),k=function(){return f.obj.isModified()?c.ask(a.instant("LIGHTBOX.CREATE_EDIT.CONFIRM_CLOSE")).then(function(t){return t.finish(),$()}):($(),f.$apply(function(){return f.obj.revert()}))},$=function(){return o.closeAll(),f.lightboxOpen=!1},C=angular.element(document),C.on("keydown.lightbox-create-edit",function(t){var e;if(f.lightboxOpen&&(t.stopPropagation(),e=t.keyCode?t.keyCode:t.which,27===e))return k()}),g.on("submit","form",B),g.find(".close").on("click",function(t){return t.preventDefault(),t.stopPropagation(),k()}),g.on("click",".status-dropdown",function(t){return t.preventDefault(),t.stopPropagation(),g.find(".pop-status").popover().open()}),g.on("click",".status",function(t){return t.preventDefault(),t.stopPropagation(),L(angular.element(t.currentTarget).data("status-id")),f.$apply(),f.$broadcast("status:changed",f.obj.status),g.find(".pop-status").popover().close()}),g.on("click",".team-requirement",function(t){return f.obj.team_requirement=!f.obj.team_requirement,f.$apply()}),g.on("click",".client-requirement",function(t){return f.obj.client_requirement=!f.obj.client_requirement,f.$apply()}),g.on("click",".is-blocked",function(t){return f.obj.is_blocked=!f.obj.is_blocked,f.$apply()}),g.on("click",".iocaine",function(t){return f.obj.is_iocaine=!f.obj.is_iocaine,f.$broadcast("isiocaine:changed",f.obj)}),f.isTeamRequirement=function(){var t;return null!=(t=f.obj)?t.team_requirement:void 0},f.isClientRequirement=function(){var t;return null!=(t=f.obj)?t.client_requirement:void 0},L=function(t){return f.obj.status=t,f.selectedStatus=_.find(f.statusList,function(e){return e.id===t}),f.obj.is_closed=f.selectedStatus.is_closed},M=function(t){var e,r,n;return r=p.get("common/lightbox/lightbox-create-edit/lb-create-edit.html"),n=f.$new(),e=d(r)(n),g.html(e)}},{link:f}},v.directive("tgLbCreateEdit",["$log","$tgRepo","$tgModel","$tgResources","$rootScope","lightboxService","$tgLoading","$translate","$tgConfirm","$q","tgAttachmentsService","$tgTemplate","$compile",o]),g=this.taiga.debounceLeading,l=function(t,e,r,n,i,o,s,a){var c;return c=function(o,c,u){var l,p,d,f,h,m;return m=null,o.projects=null,o.projectEpics=Immutable.List(),o.loading=!1,o.selectedProject=o.project.id,f=c.find(".new-epic-form").checksley(),l=c.find(".existing-epic-form").checksley(),d=function(){if(null===o.projects)return o.projects=n.projects.get("unblocked")},p=function(t,e){return i.epics.listInAllProjects({is_epics_activated:!0,project__blocked_code:"null",project:t,q:e},!0).then(function(t){var e,r;return e=[],m.epics&&(e=m.epics.map(function(t){return t.id})),r=t.filter(function(t){return e.indexOf(t.get("id"))===-1}),o.projectEpics=r})},h=function(t){return o.selectedEpic=null,o.searchEpic="",p(t,o.searchEpic)},c.on("click",".close",function(t){return t.preventDefault(),r.close(c)}),o.$on("relate-to-epic:add",function(t,e){return m=e,o.selectedEpic=null,o.searchEpic="",d(),p(o.selectedProject,o.searchEpic).then(function(){return r.open(c).then(function(){return c.find("input").focus})})}),o.$on("$destroy",function(){return c.off()}),o.selectProject=function(t){return h(t)},o.onUpdateSearchEpic=g(300,function(){return o.selectedEpic=null,p(o.selectedProject,o.searchEpic)}),o.saveRelatedEpic=function(n,s){var u,p,d;if(l.validate())return o.loading=!0,u=function(t){return o.loading=!1,e.notify("error"),l.setErrors(t)},p=function(e){return a.trackEvent("user story related epic","create","create related epic on user story",1),o.loading=!1,t.$broadcast("related-epics:changed",m),r.close(c)},d=m.id,i.epics.addRelatedUserstory(n,d).then(p,u)},o.createEpic=function(n,u){var l,p,d;if(f.validate())return this.loading=!0,p=function(t){return o.loading=!1,e.notify("error"),f.setErrors(errors)},d=function(){return a.trackEvent("user story related epic","create","create related epic on user story",1),o.loading=!1,t.$broadcast("related-epics:changed",m),r.close(c)},l=function(t){var e,r;return e=t.get("id"),r=m.id,i.epics.addRelatedUserstory(e,r).then(d,p)},s.createEpic({subject:u},null,n).then(l,p)}},{templateUrl:"common/lightbox/lightbox-relate-to-epic.html",link:c}},v.directive("tgLbRelatetoepic",["$rootScope","$tgConfirm","lightboxService","tgCurrentUserService","tgResources","$tgResources","tgEpicsService","$tgAnalytics",l])}.call(this),function(){var t,e,r,n,i,o;i=this.taiga,n=this.taiga.sizeFormat,o=this.taiga.timeout,r=angular.module("taigaCommon"),e=function(t,e){var r;return r=function(e,r,n){return t.onStart(function(){return $(document.body).addClass("loader-active"),r.addClass("active")}),t.onEnd(function(){return $(document.body).removeClass("loader-active"),r.removeClass("active")})},{link:r}},r.directive("tgLoader",["tgLoader","$rootScope",e]),t=function(t){var e,r,n,i,s,a,c,u;return r={minTime:300},i=!1,u=0,a=0,n=0,s=function(e){var s,c,l;return null==e&&(e=!1),u&&(l=0,e||(c=(new Date).getTime(),s=c-u,s",function(){var r;return r={settings:{target:null,scope:null,classes:[],timeout:0,template:null},target:function(t){return r.settings.target=t,r},scope:function(t){return r.settings.scope=t,r},template:function(t){return r.settings.template=t,r},removeClasses:function(){var t;return t=1<=arguments.length?n.call(arguments,0):[],r.settings.classes=t,r},timeout:function(t){return r.settings.timeout=t,r},start:function(){var t,n;return t=r.settings.target,r.settings.classes.map(function(e){return t.removeClass(e)}),t.hasClass("loading")||r.settings.template||(r.settings.template=t.html()),n=setTimeout(function(){if(!t.hasClass("loading"))return t.addClass("loading"),t.html(e)},r.settings.timeout),r.settings.timeoutId=n,r},finish:function(){var e,n,i;return n=r.settings.target,i=r.settings.timeoutId,i&&(clearTimeout(i),e=r.settings.classes,e.map(function(t){return r.settings.target.addClass(t)}),n.html(r.settings.template),n.removeClass("loading"),r.settings.scope&&t(n.contents())(r.settings.scope)),r}}}},e.$inject=["$compile"],r.factory("$tgLoading",e),t=function(t){var e;return e=function(e,r,n){var i,o;return i=null,o=r.html(),e.$watch(n.tgLoading,function(n){return function(n){return n?i=t().target(r).timeout(100).template(o).scope(e).start():i?i.finish():void 0}}(this))},{priority:99999,link:e}},r.directive("tgLoading",["$tgLoading",t])}.call(this),function(){var t,e,r,n,i,o;o=this.taiga,r=this.taiga.bindOnce,n=this.taiga.debounce,i=angular.module("taigaCommon"),e=function(t,e){var i,o;return o=e.get("common/popover/popover-us-status.html",!0),i=function(e,i,s){var a,c,u;return a=i.controller(),c=function(t){var r,n,o;if(o=i.find(".us-status"),n=i.find(".us-status .us-status-bind"),r=e.usStatusById,r[t.status])return n.text(r[t.status].name),o.css("color",r[t.status].color)},i.on("click",".us-status",function(t){return t.preventDefault(),t.stopPropagation(),i.find(".pop-status").popover().open()}),i.on("click",".status",n(2e3,function(r){var n,o;return r.preventDefault(),r.stopPropagation(),n=angular.element(r.currentTarget),o=e.$eval(s.tgUsStatus),o.status=n.data("status-id"),c(o),i.find(".pop-status").popover().close(),e.$apply(function(){return t.save(o).then(function(){return e.$eval(s.onUpdate)})})})),e.$on("userstories:loaded",function(){return c(e.$eval(s.tgUsStatus))}),e.$on("$destroy",function(){return i.off()}),u=e.$eval(s.tgUsStatus),c(u),r(e,"project",function(t){var r;if(r=o({statuses:t.us_statuses}),i.append(r),e.project.my_permissions.indexOf("modify_us")===-1)return i.unbind("click"),i.find("a").addClass("not-clickable")})},{link:i}},i.directive("tgUsStatus",["$tgRepo","$tgTemplate",e]),t=function(t,e){var r,i,s;return i=e.get("common/popover/popover-related-task-status.html",!0),s=function(t,e,r){var n,i;if(i=t.find(".us-status"),n=t.find(".task-status .task-status-bind"),r[e.status])return n.text(r[e.status].name),i.css("color",r[e.status].color)},r=function(e,r,a){var c,u,l,p;return c=r.controller(),p=e.$eval(a.tgRelatedTaskStatus),l=e.$eval(a.notAutoSave),u=!l,r.on("click",".task-status",function(t){return t.preventDefault(),t.stopPropagation(),r.find(".pop-status").popover().open()}),r.on("click",".status",n(2e3,function(n){var i;if(n.preventDefault(),n.stopPropagation(),i=angular.element(n.currentTarget),p.status=i.data("status-id"),r.find(".pop-status").popover().close(),s(r,p,e.taskStatusById),u)return e.$apply(function(){return t.save(p).then(function(){return e.$eval(a.onUpdate),e.$emit("related-tasks:status-changed")})})})),e.$watch(a.tgRelatedTaskStatus,function(){return p=e.$eval(a.tgRelatedTaskStatus),s(r,p,e.taskStatusById)}),o.bindOnce(e,"project",function(t){if(r.append(i({statuses:t.task_statuses})),s(r,p,e.taskStatusById),t.my_permissions.indexOf("modify_task")===-1)return r.unbind("click"),r.find("a").addClass("not-clickable")}),e.$on("$destroy",function(){return r.off()})},{link:r}},i.directive("tgRelatedTaskStatus",["$tgRepo","$tgTemplate",t]),$.fn.popover=function(){var t,e,r,n,i,o;return t=this,i=function(e){return function(){var e,r,n,i,o,s,a,c,u,l;return t.css({display:"block",visibility:"hidden"}),i=$(window).scrollTop(),e=i+$(window).height(),o=$(window).width(),n=o,r=0,u=t.offset().top,s=u+t.height(),l=t.width(),a=t.offset().left,c=t.offset().left+l,t.css({display:"none",visibility:"visible"}),s<=e&&u>=i&&a>=r&&c<=n}}(this),n=function(e){return function(e){return e&&e.call(t),t.fadeOut(function(){return t.removeClass("active").removeClass("fix")}),t.off("popup:close")}}(this),r=function(t){return function(){return $(".popover.active").each(function(){return $(this).trigger("popup:close")})}}(this),o=function(o){return function(o){return t.hasClass("active")?e():(r(),i()||t.addClass("fix"),t.fadeIn(function(){return t.addClass("active"),$(document.body).off("popover"),$(document.body).one("click.popover",function(){return r()})}),t.on("popup:close",function(t){return n(o)}))}}(this),e=function(e){return function(){return t.trigger("popup:close")}}(this),{open:o,close:e,closeAll:r}}}.call(this),function(){var t,e,r;r=this.taiga,e=angular.module("taigaCommon"),t=function(t,e){var r;return this.config=e,r=this.config.get("ravenConfig",null),r?(t.debug("Using the RavenJS exception handler."),Raven.config(r).install(),function(e,r){return t.error.apply(t,arguments),Raven.captureException(e)}):(t.debug("Using the default logging exception handler."),function(e,r){return t.error.apply(t,arguments)})},e.factory("$exceptionHandler",["$log","$tgConfig",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(t,r){this.translate=t,this.currentUserService=r,e.__super__.constructor.call(this),_.map(n,function(t){return function(e){return e.title=t.translate.instant("PROJECT.SECTION."+e.title)}}(this))}var n;return r(e,t),e.$inject=["$translate","tgCurrentUserService"],n={1:{id:1,title:"TIMELINE",path:"timeline",enabled:""},2:{id:2,title:"EPICS",path:"epics",enabled:"is_epics_activated"},3:{id:3,title:"BACKLOG",path:"backlog",enabled:"is_backlog_activated"},4:{id:4,title:"KANBAN",path:"kanban",enabled:"is_kanban_activated"},5:{id:5,title:"ISSUES",path:"issues",enabled:"is_issues_activated"},6:{id:6,title:"WIKI",path:"wiki",enabled:"is_wiki_activated"}},e.prototype.list=function(){return n},e.prototype.getPath=function(t,e){var r,i,o,s,a;return r="timeline",(o=null!=(s=this.currentUserService.projects)?s.get("all"):void 0)&&(i=o.find(function(e){return e.get("slug")===t}))?(e||(e=i.get("my_homepage")),a=_.find(n,{id:e}),a&&(null!=i?i.get(a.enabled):void 0)!==!1?a.path:r):r},e}(taiga.Service),e.service("$tgSections",t)}.call(this),function(){var e,r,n,i,o,s,a,c=[].indexOf||function(t){for(var e=0,r=this.length;e\n <% if (tag[1] !== null) { %>\n \n <%= emojify(tag[0]) %>\n \n <% } %>\n<% }) %>\n<% _.each(tags, function(tag) { %>\n <% if (tag[1] === null) { %>\n \n <%= emojify(tag[0]) %>\n \n <% } %>\n<% }) %>'),e=function(e,n,i,o){var s;return s=function(e){var i;return i=r({tags:e,emojify:function(e){return t.replaceEmojiNameByHtmlImgs(_.escape(e))}}),n.html(i)},e.$watch(i.tgColorizeBacklogTags,function(t){if(null!=t)return s(t)}),e.$on("$destroy",function(){return n.off()})},{link:e}},o.directive("tgColorizeBacklogTags",["$tgEmojis",e]),r=function(e,r,n){var o,s,u,l,p;return s=13,o=188,p=r.get("common/tag/lb-tag-line-tags.html",!0),u=null,l=function(e,r,o,l){var d,f,h,g,m,v,y,b;return b=_.has(o,"withoutColors"),g=function(i,o){var s,a,c;return null==o&&(o=[]),s=b?null:o[t],a={tags:_.map(i,function(t){return{name:t,style:s?"border-left: 5px solid "+s:""}})},c=n(p(a))(e),r.find(".tags-container").html(c)},y=function(){return r.find(".save").removeClass("hidden")},h=function(){return r.find(".save").addClass("hidden")},m=function(){return r.find("input").val(""),u.close()},d=function(t){var r;if(t=a(t.toLowerCase()),0!==t.length)return r=_.clone(l.$modelValue,!1),null==r&&(r=[]),c.call(r,t)<0&&r.push(t),e.$apply(function(){return l.$setViewValue(r)}),h()},f=function(t){var r;if(t=a(t.toLowerCase()),0!==t.length)return r=_.clone(l.$modelValue,!1),r=_.pull(r,t),e.$apply(function(){return l.$setViewValue(r)})},v=function(){var t;return t=r.find("input").val(),d(t),m()},r.on("keypress","input",function(t){var e;return e=angular.element(t.currentTarget),t.keyCode===s?(t.preventDefault(),v()):","===String.fromCharCode(t.keyCode)?(t.preventDefault(),v()):e.val().length?y():h()}),r.on("click",".save",function(t){return t.preventDefault(),v()}),r.on("click",".remove-tag",function(t){var e,r;return t.preventDefault(),e=angular.element(t.currentTarget),r=e.siblings(".tag-name").text(),f(r)}),i(e,"project",function(t){var e;return e=r.find("input"),u=new Awesomplete(e[0],{list:_.keys(t.tags_colors)}),e.on("awesomplete-selectcomplete",function(){return d(e.val()),e.val("")})}),e.$watch(o.ngModel,function(t){var r,n;return n=(null!=(r=e.project)?r.tags_colors:void 0)||[],g(t,n)}),e.$on("$destroy",function(){return r.off()})},{link:l,require:"ngModel",templateUrl:"common/tag/lb-tag-line.html"}},o.directive("tgLbTagLine",["$tgResources","$tgTemplate","$compile",r])}.call(this),function(){var t,e,r,n,i;i=this.taiga,e=this.taiga.bindOnce,r=this.taiga.debounce,n=angular.module("taigaBacklog"),t=function(t,e,n,i,o,s,a){var c;return c=function(n,c,u){var l,p,d,f,h,g,m,v;return f=!1,l=!0,p=null,n.newSprint={},v=null,g=function(){return p&&p.reset(),n.newSprint={project:null,name:null,estimated_start:null,estimated_finish:null}},m=r(2e3,function(r){return function(r){var u,d,h,g,m,y,b,S,j;return r.preventDefault(),j=angular.element(r.currentTarget),y=a.instant("COMMON.PICKERDATE.FORMAT"),S=c.find(".submit-button"),p=c.find("form").checksley(),p.validate()?(f=!1,u=null,g=$(".date-start").val(),h=$(".date-end").val(),l?(m=angular.copy(n.newSprint),m.estimated_start=moment(g,y).format("YYYY-MM-DD"),m.estimated_finish=moment(h,y).format("YYYY-MM-DD"),b=t.create("milestones",m),u="sprintform:create:success"):(m=n.newSprint.realClone(),m.estimated_start=moment(g,y).format("YYYY-MM-DD"),m.estimated_finish=moment(h,y).format("YYYY-MM-DD"),b=t.save(m),u="sprintform:edit:success"),d=s().target(S).start(),b.then(function(t){return d.finish(),l&&(n.sprintsCounter+=1),n.sprints=_.map(n.sprints,function(e){return e.id===t.id?t:e}),"sprintform:create:success"===u&&v?i.$broadcast(u,t,v):i.$broadcast(u,t),o.close(c)}),b.then(null,function(t){return d.finish(),p.setErrors(t),t._error_message?e.notify("light-error",t._error_message):t.__all__?e.notify("light-error",t.__all__[0]):void 0})):(f=!0,void c.find(".last-sprint-name").addClass("disappear"))}}(this)),h=function(){var r,s;return s=a.instant("LIGHTBOX.DELETE_SPRINT.TITLE"),r=n.newSprint.name,e.askOnDelete(s,r).then(function(r){return function(r){var s,a;return a=function(){return r.finish(),n.milestonesCounter-=1,o.close(c),i.$broadcast("sprintform:remove:success",n.newSprint)},s=function(){return r.finish(!1),e.notify("error")},t.remove(n.newSprint).then(a,s)}}(this))},d=function(){var t,e;return t=_.filter(n.sprints,function(t){return!t.closed}),e=_.sortBy(t,function(t){return moment(t.estimated_finish,"YYYY-MM-DD").format("X")}),e[e.length-1]},n.$on("sprintform:create",function(t,e,r){var i,s,u,f,h,m;return v=r,g(),p=c.find("form").checksley(),p.reset(),l=!0,h=a.instant("COMMON.PICKERDATE.FORMAT"),n.newSprint.project=e,n.newSprint.name=null,n.newSprint.slug=null,u=d(),s=moment(),u?s=moment(u.estimated_finish):n.newSprint.estimated_start&&(s=moment(n.newSprint.estimated_start)),n.newSprint.estimated_start=s.format(h),i=moment().add(2,"weeks"),u?i=moment(u.estimated_finish).add(2,"weeks"):n.newSprint.estimated_finish&&(i=moment(n.newSprint.estimated_finish)),n.newSprint.estimated_finish=i.format(h),f=c.find(".last-sprint-name"),null!=(null!=u?u.name:void 0)&&(m=a.instant("LIGHTBOX.ADD_EDIT_SPRINT.LAST_SPRINT_NAME",{lastSprint:u.name}),f.html(m)),c.find(".delete-sprint").addClass("hidden"),m=a.instant("LIGHTBOX.ADD_EDIT_SPRINT.TITLE"),c.find(".title").text(m),m=a.instant("COMMON.CREATE"),c.find(".button-green").text(m),o.open(c),c.find(".sprint-name").focus(),c.find(".last-sprint-name").removeClass("disappear")}),n.$on("sprintform:edit",function(t,e){var r,i,s;return g(),l=!1,i=a.instant("COMMON.PICKERDATE.FORMAT"),n.$apply(function(){return n.newSprint=e.realClone(),n.newSprint.estimated_start=moment(n.newSprint.estimated_start).format(i),n.newSprint.estimated_finish=moment(n.newSprint.estimated_finish).format(i)}),c.find(".delete-sprint").removeClass("hidden"),r=a.instant("BACKLOG.EDIT_SPRINT"),c.find(".title").text(r),s=a.instant("COMMON.SAVE"),c.find(".button-green").text(s),o.open(c),c.find(".sprint-name").focus().select(),c.find(".last-sprint-name").addClass("disappear")}),c.on("keyup",".sprint-name",function(t){return c.find(".sprint-name").val().length>0||f?c.find(".last-sprint-name").addClass("disappear"):c.find(".last-sprint-name").removeClass("disappear")}),c.on("submit","form",m),c.on("click",".delete-sprint",function(t){return t.preventDefault(),h()}),n.$on("$destroy",function(){return c.off()}),g()},{link:c}},n.directive("tgLbCreateEditSprint",["$tgRepo","$tgConfirm","$tgResources","$rootScope","lightboxService","$tgLoading","$translate",t])}.call(this),function(){var t,e,r,n,i,o,s,a,c,u,l,p,d,f,h,g,m,v=function(t,e){function r(){this.constructor=t}for(var n in e)y.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},y={}.hasOwnProperty;h=this.taiga,p=this.taiga.mixOf,m=this.taiga.toggleText,f=this.taiga.scopeDefer,c=this.taiga.bindOnce,l=this.taiga.groupBy,g=this.taiga.timeout,a=this.taiga.bindMethods,u=this.taiga.generateHash,d=angular.module("taigaBacklog"),t=function(t){function e(t,e,r,n,i,o,s,c,u,l,p,d,f,h,g,m,v,y,_,b){var S;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=o,this.q=s,this.location=c,this.appMetaService=u,this.navUrls=l,this.events=p,this.analytics=d,this.translate=f,this.loading=h,this.rs2=g,this.modelTransform=m,this.errorHandlingService=v,this.storage=y,this.filterRemoteStorageService=_,this.projectService=b,a(this),this.backlogOrder={},this.milestonesOrder={},this.page=1,this.disablePagination=!1,this.firstLoadComplete=!1,this.scope.userstories=[],this.applyStoredFilters(this.params.pslug,"backlog-filters")||(this.scope.sectionName=this.translate.instant("BACKLOG.SECTION_NAME"),this.showTags=!1,this.activeFilters=!1,this.scope.showGraphPlaceholder=null,this.displayVelocity=!1,this.initializeEventHandlers(),S=this.loadInitialData(),S.then(function(t){return function(){var e,r;if(t.firstLoadComplete=!0,r=t.translate.instant("BACKLOG.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.translate.instant("BACKLOG.PAGE_DESCRIPTION",{projectName:t.scope.project.name,projectDescription:t.scope.project.description}),t.appMetaService.setAll(r,e),t.rs.userstories.getShowTags(t.scope.projectId))return t.showTags=!0,t.scope.$broadcast("showTags",t.showTags)}}(this)),S.then(null,this.onInitialDataError.bind(this)))}return v(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","tgAppMetaService","$tgNavUrls","$tgEvents","$tgAnalytics","$translate","$tgLoading","tgResources","$tgQueueModelTransformation","tgErrorHandlingService","$tgStorage","tgFilterRemoteStorageService","tgProjectService"],e.prototype.storeCustomFiltersName="backlog-custom-filters",e.prototype.storeFiltersName="backlog-filters",e.prototype.backlogOrder={},e.prototype.milestonesOrder={},e.prototype.filtersReloadContent=function(){return this.loadUserstories(!0)},e.prototype.initializeEventHandlers=function(){return this.scope.$on("usform:bulk:success",function(t){return function(){return t.loadUserstories(!0),t.loadProjectStats(),t.confirm.notify("success"),t.analytics.trackEvent("userstory","create","bulk create userstory on backlog",1)}}(this)),this.scope.$on("sprintform:create:success",function(t){return function(e,r,n){return t.loadSprints().then(function(){return t.scope.$broadcast("sprintform:create:success:callback",n)}),t.loadProjectStats(),t.confirm.notify("success"),t.analytics.trackEvent("sprint","create","create sprint on backlog",1)}}(this)),this.scope.$on("usform:new:success",function(t){return function(){return t.loadUserstories(!0),t.loadProjectStats(),t.rootscope.$broadcast("filters:update"),t.confirm.notify("success"),t.analytics.trackEvent("userstory","create","create userstory on backlog",1)}}(this)),this.scope.$on("sprintform:edit:success",function(t){return function(){return t.loadProjectStats()}}(this)),this.scope.$on("sprintform:remove:success",function(t){return function(e,r){return t.loadSprints(),t.loadProjectStats(),t.loadUserstories(!0),r.closed&&t.loadClosedSprints(),t.rootscope.$broadcast("filters:update")}}(this)),this.scope.$on("usform:edit:success",function(t){ return function(e,r){var n;return n=_.findIndex(t.scope.userstories,function(t){return t.id===r.id}),t.scope.userstories[n]=r,t.rootscope.$broadcast("filters:update")}}(this)),this.scope.$on("sprint:us:move",this.moveUs),this.scope.$on("sprint:us:moved",function(t){return function(){return t.loadSprints(),t.loadProjectStats()}}(this)),this.scope.$on("backlog:load-closed-sprints",this.loadClosedSprints),this.scope.$on("backlog:unload-closed-sprints",this.unloadClosedSprints)},e.prototype.initializeSubscription=function(){var t,e;return t="changes.project."+this.scope.projectId+".userstories",this.events.subscribe(this.scope,t,function(t){return function(e){return t.loadAllPaginatedUserstories(),t.loadSprints()}}(this)),e="changes.project."+this.scope.projectId+".milestones",this.events.subscribe(this.scope,e,function(t){return function(e){return t.loadSprints()}}(this))},e.prototype.toggleShowTags=function(){return this.scope.$apply(function(t){return function(){return t.showTags=!t.showTags,t.rs.userstories.storeShowTags(t.scope.projectId,t.showTags)}}(this))},e.prototype.toggleActiveFilters=function(){return this.activeFilters=!this.activeFilters},e.prototype.toggleVelocityForecasting=function(){return this.displayVelocity=!this.displayVelocity,this.displayVelocity?this.scope.visibleUserStories=_.map(this.forecastedStories,function(t){return t.ref}):this.scope.visibleUserStories=_.map(this.scope.userstories,function(t){return t.ref}),f(this.scope,function(t){return function(){return t.scope.$broadcast("userstories:loaded")}}(this))},e.prototype.loadProjectStats=function(){return this.rs.projects.stats(this.scope.projectId).then(function(t){return function(e){var r;return t.scope.stats=e,r=e.total_points?e.total_points:e.defined_points,r?t.scope.stats.completedPercentage=Math.round(100*e.closed_points/r):t.scope.stats.completedPercentage=0,t.scope.showGraphPlaceholder=!(null!=e.total_points&&null!=e.total_milestones),t.calculateForecasting(),e}}(this))},e.prototype.setMilestonesOrder=function(t){var e,r,n,i,o;for(i=[],r=0,n=t.length;r0&&t>s.speed));r++)o.push(void 0);return o},e.prototype.loadProject=function(){var t;return t=this.projectService.project.toJS(),t.is_backlog_activated||this.errorHandlingService.permissionDenied(),this.scope.projectId=t.id,this.scope.project=t,this.scope.closedMilestones=!!t.total_closed_milestones,this.scope.$emit("project:loaded",t),this.scope.points=_.sortBy(t.points,"order"),this.scope.pointsById=l(t.points,function(t){return t.id}),this.scope.usStatusById=l(t.us_statuses,function(t){return t.id}),this.scope.usStatusList=_.sortBy(t.us_statuses,"id"),t},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),this.fillUsersAndRoles(t.members,t.roles),this.initializeSubscription(),this.loadBacklog().then(function(t){return function(){var e;return t.generateFilters(e="null")}}(this)).then(function(t){return function(){return t.scope.$emit("backlog:loaded")}}(this))},e.prototype.prepareBulkUpdateData=function(t,e){return null==e&&(e="backlog_order"),_.map(t,function(t){return{us_id:t.id,order:t[e]}})},e.prototype.moveUs=function(t,e,r,n){var i,o,s,a,c,u,l,p,d,f,h,g,m,v,y,b,S,j,k,$,I,T,E,C,P,w,A,O,R,M,U,N,D,x,L,F,B,H,q,G,V;if(E=e[0].milestone,M=e[0].project,E&&(q=this.scope.sprintsById[E]||this.scope.closedSprintsById[E]),n&&(I=this.scope.sprintsById[n]||this.scope.closedSprintsById[n]),s=n!==E?n:E,w=null,P="",n!==E)if(null===n){for(l=u=0,d=e.length;u1&&(H=_.map(R,function(t){return{us_id:t.id,order:w[t.id]}}))):G=0,k=[],l=j=0,h=e.length;j1&&n!==E)a=k.concat(H,F),U=this.rs.userstories.bulkUpdateMilestone(M,n,a);else if(e.length>1)a=k.concat(H,F),U=this.rs.userstories.bulkUpdateBacklogOrder(M,a);else{for(B={},N=0,y=H.length;N=n&&t<=r})},e}(p(h.Controller,h.PageMixin,h.FiltersMixin,h.UsFiltersMixin)),d.controller("BacklogController",t),e=function(t,e,r,n){var i,o,s,a,c,u,l,p;return i=_.template('
<%- text %>
'),s=function(t,e,n,o){var s,a,c,u;return c=function(){var r,n,i,o,a,c,l,p,d,f;if(t.displayVelocity&&u(),null!=t.stats&&null!=t.stats.total_points&&0!==t.stats.total_points&&null==t.displayVelocity){if(u(),p=t.stats,d=p.total_points,r=p.assigned_points,!t.userstories)return;for(c=t.userstories,l=[],i=o=0,a=c.length;od){n=e.find(".backlog-table-body .us-item-row")[i],s(n);break}l.push(void 0)}return l}},u=function(){return e.find(".doom-line").remove()},s=function(t){var e;return e=r.instant("BACKLOG.DOOMLINE"),$(t).before(i({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",c),t.$on("userstories:forecast",u),t.$watch("stats",c)},c=function(t,r,i,o){var s,a,c,u,l,d,f;return a=function(){var e;return e=r.find(".backlog-table-body input:checkbox:checked"),_.map(e,function(e){var r;return e=$(e).closest(".tg-scope"),r=e.scope(),r.us.milestone=t.sprints[0].id,r.us})},d=function(e,i){var s,a,c,u;return u=_(t.userstories),t.userstories=u.without.apply(u,e).value(),a=_.map(e,function(t,e){return t.total_points}),c=_.reduce(a,function(t,e){return t+e}),i.user_stories=_.union(i.user_stories,e),i.total_points+=c,s=_.map(e,function(t){return{us_id:t.id,order:t.sprint_order}}),n.userstories.bulkUpdateMilestone(t.project.id,t.sprints[0].id,s).then(function(t){return function(){return o.loadSprints(),o.loadProjectStats(),o.toggleVelocityForecasting(),o.calculateForecasting()}}(this)),r.find(".move-to-sprint").hide()},u=function(e){return d(e,t.currentSprint)},l=function(e){return d(e,t.sprints[0])},t.$on("sprintform:create:success:callback",function(t,e){return _.partial(u,e)()}),f=!1,c=null,s=function(e){var n,i;return c=e.closest(".us-item-row"),e.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&&t.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,o;return c&&f&&(r=[],e=$(t.currentTarget).closest(".us-item-row"),n=c.nextAll(),i=c.prevAll(),_.some(n,function(t){return t===e[0]})?r=c.nextUntil(e):_.some(i,function(t){return t===e[0]})&&(r=c.prevUntil(e)),_.map(r,function(t){var e;return e=$(t).find("input:checkbox"),e.prop("checked",!0),s(e)})),o=angular.element(t.currentTarget),o.closest(".us-item-row").toggleClass("is-checked"),s(o)}),r.on("click","#move-to-latest-sprint",function(e){return function(e){var r;return r=a(),t.$apply(_.partial(l,r))}}(this)),r.on("click","#move-to-current-sprint",function(e){return function(e){var r;return r=a(),t.$apply(_.partial(u,r))}}(this)),r.on("click","#show-tags",function(t){return t.preventDefault(),o.toggleShowTags(),p(o)}),r.on("click",".forecasting-add-sprint",function(r){var n,i;return i=o.forecastedStories,t.currentSprint?(n=_.map(i,function(e,r){return e.milestone=t.currentSprint.id,e.order=r,e}),t.$apply(_.partial(u,n))):(n=_.map(i,function(t,e){return t.order=e,t}),e.$broadcast("sprintform:create",t.projectId,n))})},p=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},l=function(t,n,i){var o,s,a,c;return a=n.find("sidebar.backlog-filter"),a.one("transitionend",function(){return g(150,function(){return e.$broadcast("resize"),$(".burndown").css("visibility","visible")})}),c=angular.element("#show-filters-button"),$(".burndown").css("visibility","hidden"),a.toggleClass("active"),c.toggleClass("active"),o=r.instant("BACKLOG.FILTERS.HIDE"),s=r.instant("BACKLOG.FILTERS.SHOW"),m(c,[o,s]),i.toggleActiveFilters()},a=function(t,e,r,n){return t.filtersSearch={},e.on("click","#show-filters-button",function(r){return r.preventDefault(),t.$apply(function(){return l(t,e,n)})})},o=function(t,e,r,n){var i,o;return i=e.controller(),c(t,e,r,i),a(t,e,r,i),s(t,e,r,i),o=i.location.search(),(o.status||o.tags||o.q||o.assigned_to||o.owner)&&u(t,e,i),t.$on("showTags",function(){return p(i)}),t.$on("$destroy",function(){return e.off(),$(window).off(".shift-pressed")})},{link:o}},d.directive("tgBacklog",["$tgRepo","$rootScope","$translate","$tgResources",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 c(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}},d.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,c,u,l,p,d;return s=n.controller(),d=null,p=null,u=null,c=null,e.$on("uspoints:select",function(t,r,n){var i;return i=e.$eval(o.tgBacklogUsPoints),p=r,c.render()}),e.$on("uspoints:clear-selection",function(t){var r;return r=e.$eval(o.tgBacklogUsPoints),p=null,c.render()}),e.$watch(o.tgBacklogUsPoints,function(i){var o;if(i)return c=t.create(n,i,e.project),o=c.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]),c.isEditable&&a(),c.onSelectedPointForRole=function(t,e,r){return i.points=r,c.render(),this.save(t,e).then(function(){return s.loadProjectStats()})},c.render=function(){var t,e,n,i,s,a,c,u,l;return l=this.calculateTotalPoints(),null==p||1===o.length?(c=l,u=l):(i=this.us.points[p],s=this.pointsById[i],c=s.name+" / "+l+"",u=s.name+" / "+l),t={totalPoints:l,roles:this.calculateRoles(),editable:this.isEditable,text:c,title:u},n="common/estimation/us-estimation-total.html",a=r.get(n,!0),e=a(t),this.$el.html(e)},c.render()}),l=function(){var t,e;return e=c.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),d=p,null!=p?c.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),d=i.data("role-id"),r=n.find(".pop-role"),r.find("a").removeClass("active"),r.find("a[data-role-id='"+d+"']").addClass("active"),c.renderPointsSelector(d)})},e.$on("$destroy",function(){return n.off()})},{link:n}},d.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,c;return s=!0,a=u(["is-burndown-grpahs-collapsed"]),r.isBurndownGraphCollapsed=t.get(a)||!1,c=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,c()}),i.on("click",".js-toggle-burndown-visibility-button",function(){return r.isBurndownGraphCollapsed=!r.isBurndownGraphCollapsed,t.set(a,r.isBurndownGraphCollapsed),c()}),r.$on("$destroy",function(){return i.off()})},{link:r}},d.directive("tgToggleBurndownVisibility",["$tgStorage",i]),r=function(t){var e,r;return r=function(e,r){var n,i,o,s,a,c,u,l,p,d,f;return d=e.width(),e.height(d/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=[],f=_.map(r.milestones,function(t){return 0}),o.push({data:_.zip(a,f),lines:{fillColor:"rgba(0,0,0,0)"},points:{show:!1}}),c=_.map(r.milestones,function(t){return t.optimal}),o.push({data:_.zip(a,c),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)"],u={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,u).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}},d.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,c,u;if(null!=n)return u=n.total_points?n.total_points:n.defined_points,a=n.defined_points,o=n.closed_points,a>u?(c=100*u/a,s=100*o/a):(c=100,s=100*o/u),c=r(c-3),s=r(s-3),i(t,e,c,s)}),t.$on("$destroy",function(){return e.off()})},{link:n}},d.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],$(".js-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("multiple-drag-mirror")}),i.on("dragend",function(e){var n,i,s,a,c,u,l,p;return c=$(e).parent(),$(".doom-line").remove(),c=$(e).parent(),a=c.hasClass("backlog-table-body")||c.hasClass("js-empty-backlog"),u=o||a?o===a:$(e).scope().sprint.id===c.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=c.scope().sprint.id),u?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 c,u,l,p;return l=n.instant("BACKLOG.SPRINTS.DATE"),c=function(){return e.project.my_permissions.indexOf("modify_milestone")!==-1},u=function(){return e.project.my_permissions.indexOf("view_milestones")!==-1},p=function(n){var s,a,p,d,f,h,g;return h=t.resolve("project-taskboard",{project:e.project.slug,sprint:n.slug}),f=moment(n.estimated_start).format(l),d=moment(n.estimated_finish).format(l),p=f+"-"+d,a={name:n.name,taskboardUrl:h,estimatedDateRange:p,closedPoints:n.closed_points||0,totalPoints:n.total_points||0,isVisible:u(),isEditable:c()},g=e.$new(),_.assign(g,a),s=r(o)(g),i.html(s)},e.$watch("sprint",function(t){return p(t)}),e.$on("$destroy",function(){return i.off()})},{link:i,restrict:"EA"}},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,c;return c=$("
"),o.after(c),a=null,o.on("click",function(r){return r.preventDefault(),n=!n,a=e().target(c).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,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)})},{link:i}},n.directive("tgBacklogToggleClosedSprintsVisualization",["$rootScope","$tgLoading","$translate",r])}.call(this),function(){var t,e,r,n,i,o,s,a,c;s=this.taiga,n=this.taiga.mixOf,c=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.utc(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;i=this.taiga,e=this.taiga.bindOnce,r=this.taiga.debounce,o=this.taiga.trim,n=angular.module("taigaTaskboard"),t=function(t,e,n,i,o,s){var a;return a=function(t,a,c){var u,l;return t.form={data:"",usId:null},u=r(2e3,function(r){return function(r){var c,u,p,d,f,h,g;if(r.preventDefault(),p=a.find("form").checksley(),p.validate())return c=i().target(l).start(),u=t.form.data,d=t.projectId,h=t.form.sprintId,g=t.form.usId,f=e.tasks.bulkCreate(d,h,g,u),f.then(function(t){return t=_.map(t,function(t){return function(t){return s.make_model("tasks",t)}}(this)),c.finish(),n.$broadcast("taskform:bulk:success",t),o.close(a)}),f.then(null,function(){return c.finish()})}}(this)),t.$on("taskform:bulk",function(e,r,n){return o.open(a),t.form={data:"",sprintId:r,usId:n}}),l=a.find(".submit-button"),a.on("submit","form",u),t.$on("$destroy",function(){return a.off()})},{link:a}},n.directive("tgLbCreateBulkTasks",["$tgRepo","$tgResources","$rootScope","$tgLoading","lightboxService","$tgModel",t])}.call(this),function(){var t,e,r,n,i,o,s,a,c,u,l,p,d,f=function(t,e){function r(){this.constructor=t}for(var n in e)h.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},h={}.hasOwnProperty;l=this.taiga,d=this.taiga.toggleText,a=this.taiga.mixOf,s=this.taiga.groupBy,i=this.taiga.bindOnce,u=this.taiga.scopeDefer,p=this.taiga.timeout,n=this.taiga.bindMethods,o=this.taiga.debounceLeading,c=angular.module("taigaTaskboard"),t=function(t){function e(t,e,r,i,o,s,a,c,u,p,d,f,h,g,m,v,y,_,b){this.scope=t,this.rootscope=e,this.repo=r,this.confirm=i,this.rs=o,this.rs2=s,this.params=a,this.q=c,this.appMetaService=u,this.location=p,this.navUrls=d,this.events=f,this.analytics=h,this.translate=g,this.errorHandlingService=m,this.taskboardTasksService=v,this.taskboardIssuesService=y,this.storage=_,this.filterRemoteStorageService=b,n(this),this.taskboardTasksService.reset(),this.scope.userstories=[],this.openFilter=!1,this.applyStoredFilters(this.params.pslug,"tasks-filters")||(this.scope.sectionName=this.translate.instant("TASKBOARD.SECTION_NAME"),this.initializeEventHandlers(),l.defineImmutableProperty(this.scope,"usTasks",function(t){return function(){return t.taskboardTasksService.usTasks}}(this)),l.defineImmutableProperty(this.scope,"milestoneIssues",function(t){return function(){return t.taskboardIssuesService.milestoneIssues}}(this)))}return f(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","tgResources","$routeParams","$q","tgAppMetaService","$tgLocation","$tgNavUrls","$tgEvents","$tgAnalytics","$translate","tgErrorHandlingService","tgTaskboardTasks","tgTaskboardIssues","$tgStorage","tgFilterRemoteStorageService"],e.prototype.excludePrefix="exclude_",e.prototype.filterCategories=["tags","status","assigned_to","owner","role"],e.prototype.firstLoad=function(){var t;return t=this.loadInitialData(),t.then(function(t){return function(){ return t._setMeta()}}(this)),t.then(null,this.onInitialDataError.bind(this))},e.prototype.setZoom=function(t,e){var r;return this.zoomLevel===t?null:(this.isFirstLoad=!this.zoomLevel,r=this.zoomLevel,this.zoomLevel=t,this.zoom=e,this.isFirstLoad?this.firstLoad().then(function(t){return function(){return t.isFirstLoad=!1,t.taskboardTasksService.resetFolds()}}(this)):this.zoomLevel>1&&r<=1&&(this.zoomLoading=!0,this.q.all([this.loadTasks(),this.loadIssues()]).then(function(t){return function(){return t.zoomLoading=!1,t.taskboardTasksService.resetFolds()}}(this))),"0"===this.zoomLevel?this.rootscope.$broadcast("sprint:zoom0"):void 0)},e.prototype.changeQ=function(t){return this.replaceFilter("q",t),this.loadTasks(),this.generateFilters()},e.prototype.removeFilter=function(t){return this.unselectFilter(t.dataType,t.id,!1,t.mode),this.loadTasks(),this.generateFilters()},e.prototype.addFilter=function(t){return this.selectFilter(t.category.dataType,t.filter.id,!1,t.mode),this.loadTasks(),this.generateFilters()},e.prototype.selectCustomFilter=function(t){return this.replaceAllFilters(t.filter),this.loadTasks(),this.generateFilters()},e.prototype.removeCustomFilter=function(t){return this.filterRemoteStorageService.getFilters(this.scope.projectId,"tasks-custom-filters").then(function(e){return function(r){return delete r[t.id],e.filterRemoteStorageService.storeFilters(e.scope.projectId,r,"tasks-custom-filters").then(e.generateFilters)}}(this))},e.prototype.isFilterDataTypeSelected=function(t){var e,r,n,i;for(i=this.selectedFilters,r=0,n=i.length;r0}),a.assigned_to=_.map(s.assigned_to,function(t){return t.id?t.id=t.id.toString():t.id="null",t.name=t.full_name||"Unassigned",t}),a.role=_.map(s.roles,function(t){return t.id?t.id=t.id.toString():t.id="null",t.name=t.name||"Unassigned",t}),a.owner=_.map(s.owners,function(t){return t.id=t.id.toString(),t.name=t.full_name,t}),e.selectedFilters=[],l=e.filterCategories,c=0,u=l.length;c1&&(t.include_attachments=1),t=_.merge(t,this.location.search()),this.rs.issues.listInProject(this.scope.projectId,this.scope.sprintId,t).then(function(t){return function(e){return t.taskboardIssuesService.init(t.scope.project,t.scope.usersById,t.scope.issueStatusById),t.taskboardIssuesService.set(e),t.scope.taskBoardLoading=!1}}(this))},e.prototype.loadTasks=function(){var t;return t={},this.zoomLevel>1&&(t.include_attachments=1),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(),t.loadIssues()}}(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-edit",!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("genericform:edit",{objType:"task",obj:r,project:t.scope.project,sprintId:t.scope.sprintId,attachments:n.toJS()}),e=e.set("loading-edit",!1),t.taskboardTasksService.replace(e)})}}(this))},e.prototype.editIssue=function(t){var e;return e=this.taskboardIssuesService.getIssue(t),e=e.set("loading-edit",!0),this.rs.issues.getByRef(e.getIn(["model","project"]),e.getIn(["model","ref"])).then(function(t){return function(r){return t.rs2.attachments.list("issue",e.get("id"),e.getIn(["model","project"])).then(function(n){return t.rootscope.$broadcast("genericform:edit",{objType:"issue",obj:r,project:t.scope.project,sprintId:t.scope.sprintId,attachments:n.toJS()}),e=e.set("loading-edit",!1)})}}(this))},e.prototype.deleteTask=function(t){var e;return e=this.taskboardTasksService.getTask(t),e=e.set("loading-delete",!0),this.rs.tasks.getByRef(e.getIn(["model","project"]),e.getIn(["model","ref"])).then(function(t){return function(r){var n,i;return e=e.set("loading-delete",!1),i=t.translate.instant("TASK.TITLE_DELETE_ACTION"),n=r.subject,t.confirm.askOnDelete(i,n).then(function(e){var n;return n=t.repo.remove(r),n.then(function(){return t.scope.$broadcast("taskboard:task:deleted"),e.finish()}),n.then(null,function(){return e.finish(!1),this.confirm.notify("error")})})}}(this))},e.prototype.deleteIssue=function(t){var e;return e=this.taskboardIssuesService.getIssue(t),e=e.set("loading-delete",!0),this.rs.issues.getByRef(e.getIn(["model","project"]),e.getIn(["model","ref"])).then(function(t){return function(r){var n,i;return e=e.set("loading-delete",!1),i=t.translate.instant("ISSUES.ACTION_DELETE"),n=r.subject,t.confirm.askOnDelete(i,n).then(function(e){var n;return n=t.repo.remove(r),n.then(function(){return t.scope.$broadcast("taskboard:issue:deleted"),e.finish()}),n.then(null,function(){return e.finish(!1),this.confirm.notify("error")})})}}(this))},e.prototype.removeIssueFromSprint=function(t){var e;return e=this.taskboardIssuesService.getIssue(t),e=e.set("loading-delete",!0),this.rs.issues.getByRef(e.getIn(["model","project"]),e.getIn(["model","ref"])).then(function(t){return function(r){var n,i;return e=e.set("loading-delete",!1),i=t.translate.instant("ISSUES.CONFIRM_DETACH_FROM_SPRINT.TITLE"),n=t.translate.instant("ISSUES.CONFIRM_DETACH_FROM_SPRINT.MESSAGE"),n=t.translate.instant("ISSUES.CONFIRM_DETACH_FROM_SPRINT.MESSAGE",{sprintName:t.scope.sprint.name}),t.confirm.ask(i,null,n).then(function(e){var n;return r.milestone=null,n=t.repo.save(r),n.then(function(){return t.taskboardIssuesService.remove(r),e.finish()}),n.then(null,function(){return e.finish(!1),this.confirm.notify("error")})})}}(this))},e.prototype.taskMove=function(t,e,r,n,i,o){var s,a,c,u;return this.scope.movingTask=!0,e=this.taskboardTasksService.getTaskModel(e.get("id")),s=this.taskboardTasksService.move(e.id,n,i,o),c={status__is_archived:!1,include_attachments:!0},a={headers:{"set-orders":JSON.stringify(s.set_orders)}},u=this.repo.save(e,!0,c,a,!0).then(function(t){return function(e){var r;if(e[0].user_story&&t.reloadUserStory(e[0].user_story),t.scope.movingTask=!1,r=e[1],r&&r["taiga-info-order-updated"]&&(o=JSON.parse(r["taiga-info-order-updated"]),t.taskboardTasksService.assignOrders(o)),t.loadSprintStats(),t.generateFilters(),t.isFilterDataTypeSelected("status"))return t.loadTasks()}}(this))},e.prototype.reloadUserStory=function(t){return this.rs.userstories.get(this.scope.project.id,t).then(function(t){return function(e){return t.scope.userstories=_.map(t.scope.userstories,function(t){return t.id===e.id?e:t})}}(this))},e.prototype.addNewTask=function(t,e){switch(t){case"standard":return this.rootscope.$broadcast("genericform:new",{objType:"task",project:this.scope.project,sprintId:this.scope.sprintId,usId: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.addNewIssue=function(t,e){switch(t){case"standard":return this.rootscope.$broadcast("genericform:new-or-existing",{objType:"issue",project:this.scope.project,sprintId:this.scope.sprintId,relatedField:"milestone",relatedObjectId:this.scope.sprintId,targetName:this.scope.sprint.name});case"standard":return this.rootscope.$broadcast("taskform:new",this.scope.sprintId,null!=e?e.id:void 0);case"bulk":return this.rootscope.$broadcast("issueform:bulk",this.scope.projectId,this.scope.sprintId)}},e.prototype.toggleFold=function(t,e){return"issues"===e?this.taskboardIssuesService.toggleFold(t):"tasks"===e?this.taskboardTasksService.toggleFold(t):void 0},e.prototype.changeTaskAssignedTo=function(t){var e;return e=this.taskboardTasksService.getTaskModel(t),this.rootscope.$broadcast("assigned-to:add",e)},e.prototype.changeIssueAssignedTo=function(t){var e;return e=this.taskboardIssuesService.getIssueModel(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}(a(l.Controller,l.PageMixin,l.FiltersMixin)),c.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}},c.directive("tgTaskboard",["$rootScope",e]),r=function(t){var e,r,n;return e=40,n=300,r=function(r,i,o){var s,a,c,u,l;return r.$on("sprint:zoom0",function(t){return function(){return c()}}(this)),r.$on("sprint:task:moved",function(t){return function(){return c()}}(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),c()}),r.foldStatus=function(e){return r.statusesFolded[e.id]=!r.statusesFolded[e.id],t.tasks.storeStatusColumnModes(r.projectId,r.statusesFolded),c()},r.foldUs=function(e){return r.usFolded[e]=!r.usFolded[e],t.tasks.storeUsRowModes(r.projectId,r.sprintId,r.usFolded),c()},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),u=function(t){return function(){var t,e,n,o,s;return t=[],e=i.find(".task-colum-name"),t=_.map(e,function(t){return $(t).outerWidth(!0)}),s=_.reduce(t,function(t,e){return t+e}),i.find(".taskboard-table-inner").css("width",s),o=i.find(".issues-row .taskboard-row-title-box").outerWidth(!0),i.find(".issues-row").css("width",s-t.pop()),n="0"===r.ctrl.zoomLevel?128:280,i.find(".issues-row .taskboard-cards-box .card").css("max-width",n)}}(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),c=function(t){return function(){_.forEach(r.taskStatusList,function(t){return a(t.id)}),u()}}(this)},{link:r}},c.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,c,u,l,p,d,f,h;if(i&&i.size&&(o(),t.project.my_permissions.indexOf("modify_task")>-1))return d=null,p=null,l=null,h=e,u=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(".taskboard-column"),function(t){return t}),c=dragula(s,{copySortSource:!1,copy:!1,accepts:function(t,e){return!$(e).hasClass("taskboard-row-title-box")},moves:function(t){return $(t).is("tg-card")}}),c.on("drag",function(t){if(d=$(t).parent().scope(),e.hasClass("active-filters"))return u(),setTimeout(function(){return c.cancel(!0)},0),!1}),c.on("dragend",function(e){var n,i,o,s,c,u,f;return f=$(e).parent(),l=$(e),i=l.scope().task,n=l.index(),p=f.scope(),u=d.us?d.us.id:null,c=d.st.id,s=p.us?p.us.id:null,o=p.st.id,o===c&&s===u||a(l),t.$apply(function(){return r.$broadcast("taskboard:task:move",i,i.getIn(["model","status"]),s,o,n)})}),f=autoScroll([$(".taskboard-table-body")[0]],{margin:100,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&c.dragging}}),t.$on("$destroy",function(){return e.off(),c.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.foldStatusChanged={},this.issuesRaw=[]},e.prototype.init=function(t,e,r){return this.issueStatusById=r,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.issuesRaw=this.issuesRaw.concat(t),this.refresh()},e.prototype.remove=function(t){var e,r,n;n=this.issuesRaw;for(r in n)if(e=n[r],t.id===e.id)return this.issuesRaw.splice(r,1),void this.refresh()},e.prototype.set=function(t){return this.issuesRaw=t,this.refresh()},e.prototype.getIssue=function(t){return this.milestoneIssues.find(function(e){return e.get("id")===t})},e.prototype.getIssueModel=function(t){return _.find(this.issuesRaw,function(e){return e.id===t})},e.prototype.replaceModel=function(t){return this.issuesRaw=_.map(this.issuesRaw,function(e){return t.id===e.id?t:e}),this.refresh()},e.prototype.refresh=function(){var t,e,r,n,i,o;for(n=[],o=this.issuesRaw,t=0,i=o.length;t1)for(s=0,l=f.length;s1)for(o=0,f=b.length;o1&&(k=_.map(b,function(t){return function(e){return{us_id:e.id,order:t.order[e.id]}}}(this)))}}else{for($=0,p=u=0,h=n.length;u1&&r<=1?(this.zoomLoading=!0,this.loadUserstories().then(function(t){return function(){return t.zoomLoading=!1,t.kanbanUserstoriesService.resetFolds()}}(this))):void 0)},e.prototype.filtersReloadContent=function(){return this.loadUserstories().then(function(t){return function(){var e,r,n,i,o;if(n=_.difference(t.kanbanUserstoriesService.archivedStatus,t.kanbanUserstoriesService.statusHide),n.length){for(i=[],e=0,r=n.length;e0&&(r.assigned_to=n[0]),0===n.length&&(r.assigned_to=null),this.kanbanUserstoriesService.replaceModel(r),this.repo.save(r).then(function(t){return function(){if(t.generateFilters(),t.isFilterDataTypeSelected("assigned_users")||t.isFilterDataTypeSelected("role"))return t.filtersReloadContent()}}(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.loadUserstories=function(){var t,e;return t={status__is_archived:!1},this.zoomLevel>1&&(t.include_attachments=1,t.include_tasks=1),t=_.merge(t,this.location.search()),e=this.rs.userstories.listAll(this.scope.projectId,t).then(function(t){return function(e){return t.kanbanUserstoriesService.init(t.scope.project,t.scope.usersById),t.kanbanUserstoriesService.set(e),d(t.scope,function(){return t.scope.$broadcast("userstories:loaded",e)}),e}}(this)),e.then(function(t){return function(){return t.scope.$broadcast("redraw:wip")}}(this)),e},e.prototype.loadUserStoriesForStatus=function(t,e){var r,n;if(r=this.location.search().status,!r||(r=r.split(",").map(function(t){return parseInt(t,10)}),r.indexOf(e)!==-1))return n={status:e,include_attachments:!0,include_tasks:!0},n=_.merge(n,this.location.search()),this.rs.userstories.listAll(this.scope.projectId,n).then(function(t){return function(r){return t.scope.$broadcast("kanban:shown-userstories-for-status",e,r),r}}(this))},e.prototype.hideUserStoriesForStatus=function(t,e){return this.scope.$broadcast("kanban:hidden-userstories-for-status",e)},e.prototype.loadKanban=function(){return this.q.all([this.refreshTagsColors(),this.loadUserstories()])},e.prototype.loadProject=function(){var t;return t=this.projectService.project.toJS(),t.is_kanban_activated||this.errorHandlingService.permissionDenied(),this.scope.projectId=t.id,this.scope.project=t,this.scope.projectId=t.id,this.scope.points=_.sortBy(t.points,"order"),this.scope.pointsById=u(t.points,function(t){return t.id}),this.scope.usStatusById=u(t.us_statuses,function(t){return t.id}),this.scope.usStatusList=_.sortBy(t.us_statuses,"order"),this.scope.$emit("project:loaded",t),t},e.prototype.initializeSubscription=function(){var t,e;return e="changes.project."+this.scope.projectId+".userstories",t=f.randomInt(700,1e3),this.events.subscribe(this.scope,e,c(t,function(t){return function(e){return t.loadUserstories()}}(this)))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),this.fillUsersAndRoles(t.members,t.roles),this.initializeSubscription(),this.loadKanban(),this.generateFilters()},e.prototype.prepareBulkUpdateData=function(t,e){return null==e&&(e="kanban_order"),_.map(t,function(t){return{us_id:t.id,order:t[e]}})},e.prototype.moveUs=function(t,e,r,n){var i,o;return this.cleanSelectedUss(),e=_.map(e,function(t){return function(e){return t.kanbanUserstoriesService.getUsModel(e.id)}}(this)),i=this.kanbanUserstoriesService.move(e,r,n),o=this.rs.userstories.bulkUpdateKanbanOrder(this.scope.projectId,r,i.bulkOrders),o.then(function(t){return function(){var r,n,s;return r={headers:{"set-orders":JSON.stringify(i.setOrders)}},n={include_attachments:!0,include_tasks:!0},s=_.map(e,function(e){return t.repo.save(e,!0,n,r,!0)}),o=t.q.all(s),o.then(function(e){var r,n;return r=e[1],r&&r["taiga-info-order-updated"]&&(n=JSON.parse(r["taiga-info-order-updated"]),t.kanbanUserstoriesService.assignOrders(n)),t.scope.$broadcast("redraw:wip"),t.generateFilters(),t.isFilterDataTypeSelected("status")&&t.filtersReloadContent(),o})}}(this))},e}(l(f.Controller,f.PageMixin,f.FiltersMixin,f.UsFiltersMixin)),p.controller("KanbanController",r),n=function(t,e){var r;return r=function(t,e,r){var n;return n=e.find(".kanban-table-body"),n.on("scroll",function(t){var r,n;return n=angular.element(t.currentTarget),r=e.find(".kanban-table-header .kanban-table-inner"),r.css("left",-1*n.scrollLeft())}),t.$on("$destroy",function(){return e.off()})},{link:r}},p.directive("tgKanban",["$tgRepo","$rootScope",n]),t=function(t,e,r){var n,i,o;return o=e.instant("KANBAN.ACTION_SHOW_ARCHIVED"),n=e.instant("KANBAN.ACTION_HIDE_ARCHIVED"),i=function(e,i,s){var a,c;return c=e.$eval(s.tgKanbanArchivedStatusHeader),a=!0,r.addArchivedStatus(c.id),r.hideStatus(c.id),e["class"]="icon-watch",e.title=o,i.on("click",function(i){return a=!a,e.$apply(function(){return a?(e["class"]="icon-watch",e.title=o,t.$broadcast("kanban:hide-userstories-for-status",c.id),r.hideStatus(c.id)):(e["class"]="icon-unwatch",e.title=n,t.$broadcast("kanban:show-userstories-for-status",c.id),r.showStatus(c.id))})}),e.$on("$destroy",function(){return i.off()})},{link:i}},p.directive("tgKanbanArchivedStatusHeader",["$rootScope","$translate","tgKanbanUserstories",t]),e=function(t,e){var r,n;return n=[],r=function(r,n,i){var o,s,a;return o=t.instant("KANBAN.HIDDEN_USER_STORIES"),s=r.$eval(i.tgKanbanArchivedStatusIntro),n.text(o),a=function(t){return t?n.text(""):n.text(o)},r.$on("kanban:us:move",function(t,r,n,i,o){var s;return s=!!e.getStatus(i).length,a(s)}),r.$on("kanban:shown-userstories-for-status",function(t,r,n){var i;if(r===s.id)return e.deleteStatus(r),e.add(n),i=!!e.getStatus(r).length,a(i)}),r.$on("kanban:hidden-userstories-for-status",function(t,e){if(e===s.id)return a(!1)}),r.$on("$destroy",function(){return n.off()})},{link:r}},p.directive("tgKanbanArchivedStatusIntro",["$translate","tgKanbanUserstories",e]),i=function(t,e){var r;return r=function(r,n,i){var o,s;return r.foldStatus=function(e){r.folds[e.id]=!r.folds[e.id],t.kanban.storeStatusColumnModes(r.projectId,r.folds),s()},s=function(){var t,e;return t=_.map(r.usStatusList,function(t){return r.folds[t.id]?40:310}),e=_.reduce(t,function(t,e){return t+e}),n.find(".kanban-table-inner").css("width",e)},o=r.$watch("usByStatus",function(n){if(n.size)return r.folds=t.kanban.getStatusColumnModes(e.project.get("id")),s(),o()})},{link:r}},p.directive("tgKanbanSquishColumn",["$tgResources","tgProjectService",i]),o=function(t){var e;return e=function(e,r,n){var i,o;return o=e.$eval(n.tgKanbanWipLimit),i=function(e){return function(){return r.find(".kanban-wip-limit").remove(),t(function(){var t;if(t=r.find("tg-card")[o.wip_limit])return angular.element(t).before("
")})}}(this),o&&!o.is_archived&&(e.$on("redraw:wip",i),e.$on("kanban:us:move",i),e.$on("usform:new:success",i),e.$on("usform:bulk:success",i)),e.$on("$destroy",function(){return r.off()})},{link:e}},p.directive("tgKanbanWipLimit",["$timeout",o])}.call(this),function(){var t,e,r,n,i,o,s,a,c;s=this.taiga,n=this.taiga.mixOf,c=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,c,u,l,p;if(n&&n.size&&(i(),t.project.my_permissions.indexOf("modify_us")>-1))return u=null,c=null,p=e,s=function(t){return t.scope().$destroy(),t.off(),t.remove()},o=_.map(e.find(".taskboard-column"),function(t){return t}),a=dragula(o,{copySortSource:!1,copy:!1,moves:function(t){return $(t).is("tg-card")}}),a.on("drag",function(t){return window.dragMultiple.start(t,o)}),a.on("cloned",function(t,e){return $(t).addClass("multiple-drag-mirror")}),a.on("dragend",function(e){var n,i,o,a,l,p,d,f;return d=$(e).parent(),u=d.scope(),p=u.s.id,n=window.dragMultiple.stop(),n.length||(n=[e]),o=n[0],a=$(d).find("tg-card").index(o),l=u.s.id,f=_.map(n,function(t){return $(t).scope().us}),i=_.map(f,function(t){return{id:t.get("id"),oldStatusId:t.getIn(["model","status"])}}),t.$apply(function(){return _.each(f,function(t){return function(t,e){var r,i;if(r=t.getIn(["model","status"]),i=l===r,!i)return c=$(n[e]),s(c)}}(this)),r.$broadcast("kanban:us:move",i,l,a)})}),l=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,c,u,l,p=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;u=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,c=angular.module("taigaEpics"),t=function(t){function e(t,e,r,i,o,s,a,c,u,l,p,d,f,h,g,m,v){var y;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=i,this.rs=o,this.rs2=s,this.params=a,this.q=c,this.location=u,this.log=l,this.appMetaService=p,this.analytics=d,this.navUrls=f,this.translate=h,this.modelTransform=g,this.errorHandlingService=m,this.projectService=v,n(this),this.scope.epicRef=this.params.epicref,this.scope.sectionName=this.translate.instant("EPIC.SECTION_NAME"),this.initializeEventHandlers(),y=this.loadInitialData(),y.then(function(t){return function(){return t._setMeta(),t.initializeOnDeleteGoToUrl()}}(this)),y.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","tgProjectService"],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(){var t;return t=this.projectService.project.toJS(),this.scope.projectId=t.id,this.scope.project=t,this.scope.immutableProject=this.projectService.project,this.scope.$emit("project:loaded",t),this.scope.statusList=t.epic_statuses,this.scope.statusById=o(t.epic_statuses,function(t){return t.id}),t},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(),this.fillUsersAndRoles(t.members,t.roles),this.loadEpic().then(function(t){return 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(u.Controller,u.PageMixin)),c.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"}},c.directive("tgEpicStatusDisplay",["$tgTemplate","$compile",r]),e=function(t,e,r,n,i,o,s,a){var c,u;return u=a.get("common/components/status-button.html",!0),c=function(e,s,a,c){var l,p,d;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(u({status:n,statuses:e.statusList,editable:l()}))(e),s.html(r)}}(this),d=function(e){var o,a,c,u;return o=n().target(s).start(),u=i.save(function(t){return t.status=e,t}),c=function(){return t.$broadcast("object:updated"),o.finish()},a=function(){return r.notify("error"),o.finish()},u.then(c,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(),d(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 s.off()})},{link:c,restrict:"EA",require:"ngModel"}},c.directive("tgEpicStatusButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$compile","$translate","$tgTemplate",e])}.call(this),function(){var t,e,r,n,i,o,s,a,c,u,l,p,d,f,h,g,m=function(t,e){function r(){this.constructor=t}for(var n in e)v.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},v={}.hasOwnProperty;h=this.taiga,p=this.taiga.mixOf,g=this.taiga.toString,l=this.taiga.joinStr,u=this.taiga.groupBy,c=this.taiga.bindOnce,a=this.taiga.bindMethods,f=this.taiga.normalizeString,d=angular.module("taigaIssues"),e=function(t){function e(t,e,r,n,i,o,s,c,u,l,p,d,f,h,g,m){var v;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=o,this.q=s,this.location=c,this.log=u,this.appMetaService=l,this.analytics=p,this.navUrls=d,this.translate=f,this.modelTransform=h,this.errorHandlingService=g,this.projectService=m,a(this),this.scope.issueRef=this.params.issueref,this.scope.sectionName=this.translate.instant("ISSUES.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 m(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$log","tgAppMetaService","$tgAnalytics","$tgNavUrls","$translate","$tgQueueModelTransformation","tgErrorHandlingService","tgProjectService"],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)),this.scope.$on("assign-sprint-to-issue:success",function(t){return function(e,r){return t.scope.issue.milestone=r,t.rootscope.$broadcast("object:updated"),r?t.loadSprint():t.scope.sprint=null}}(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(){var t;return t=this.projectService.project.toJS(),this.scope.projectId=t.id,this.scope.project=t,this.scope.$emit("project:loaded",t),this.scope.statusList=t.issue_statuses,this.scope.statusById=u(t.issue_statuses,function(t){return t.id}),this.scope.typeById=u(t.issue_types,function(t){return t.id}),this.scope.typeList=_.sortBy(t.issue_types,"order"),this.scope.severityList=t.severities,this.scope.severityById=u(t.severities,function(t){return t.id}),this.scope.priorityList=t.priorities,this.scope.priorityById=u(t.priorities,function(t){return t.id}),t},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.loadSprint=function(){if(this.scope.issue.milestone)return this.rs.sprints.get(this.scope.issue.project,this.scope.issue.milestone).then(function(t){return function(e){return t.scope.sprint=e,e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),this.fillUsersAndRoles(t.members,t.roles),this.loadIssue().then(function(t){return function(){return t.loadSprint()}}(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(h.Controller,h.PageMixin)),d.controller("IssueDetailController",e),o=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"}},d.directive("tgIssueStatusDisplay",["$tgTemplate","$compile",o]),i=function(t,e,r,n,i,o,s){var a,c;return c=o.get("common/components/status-button.html",!0),a=function(e,o,a,u){var l,p,d;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=c({status:n,statuses:e.statusList,editable:l()}),r=s(r)(e),o.html(r)}}(this),d=function(e){var s,a,c,u;return $.fn.popover().closeAll(),s=n().target(o).start(),u=i.save(function(t){return t.status=e,t}),c=function(){return t.$broadcast("object:updated"),s.finish()},a=function(){return r.notify("error"),s.finish()},u.then(c,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),d(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 o.off()})},{link:a,restrict:"EA",require:"ngModel"}},d.directive("tgIssueStatusButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",i]),s=function(t,e,r,n,i,o,s){var a,c;return c=o.get("issue/issue-type-button.html",!0),a=function(e,o,a,u){var l,p,d,f;return p=e.$eval(a.notAutoSave),l=function(){return e.project.my_permissions.indexOf("modify_issue")!==-1},d=function(t){var r,n;return n=e.typeById[t.type],r=c({type:n,typees:e.typeList,editable:l()}),r=s(r)(e),o.html(r)},f=function(s){var a,c,l,d;return $.fn.popover().closeAll(),p?(u.$modelValue.type=s,void e.$apply()):(a=n().target(o.find(".level-name")).start(),d=i.save(function(t){return t.type=s,t}),l=function(){return t.$broadcast("object:updated"),a.finish()},c=function(){return r.notify("error"),a.finish()},d.then(l,c))},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=u.$modelValue)?t.type:void 0},function(){var t;if(t=u.$modelValue)return d(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},d.directive("tgIssueTypeButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",s]),n=function(t,e,r,n,i,o,s){var a,c;return c=o.get("issue/issue-severity-button.html",!0),a=function(e,o,a,u){var l,p,d,f;return p=e.$eval(a.notAutoSave),l=function(){return e.project.my_permissions.indexOf("modify_issue")!==-1},d=function(t){var r,n;return n=e.severityById[t.severity],r=c({severity:n,severityes:e.severityList,editable:l()}),r=s(r)(e),o.html(r)},f=function(s){var a,c,l,d;return $.fn.popover().closeAll(),p?(u.$modelValue.severity=s,void e.$apply()):(a=n().target(o.find(".level-name")).start(),d=i.save(function(t){return t.severity=s,t}),l=function(){return t.$broadcast("object:updated"),a.finish()},c=function(){ return r.notify("error"),a.finish()},d.then(l,c))},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=u.$modelValue)?t.severity:void 0},function(){var t;if(t=u.$modelValue)return d(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},d.directive("tgIssueSeverityButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",n]),r=function(t,e,r,n,i,o,s){var a,c;return c=o.get("issue/issue-priority-button.html",!0),a=function(e,o,a,u){var l,p,d,f;return p=e.$eval(a.notAutoSave),l=function(){return e.project.my_permissions.indexOf("modify_issue")!==-1},d=function(t){var r,n;return n=e.priorityById[t.priority],r=c({priority:n,priorityes:e.priorityList,editable:l()}),r=s(r)(e),o.html(r)},f=function(s){var a,c,l,d;return $.fn.popover().closeAll(),p?(u.$modelValue.priority=s,void e.$apply()):(a=n().target(o.find(".level-name")).start(),d=i.save(function(t){return t.priority=s,t}),l=function(){return t.$broadcast("object:updated"),a.finish()},c=function(){return r.notify("error"),a.finish()},d.then(l,c))},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=u.$modelValue)?t.priority:void 0},function(){var t;if(t=u.$modelValue)return d(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},d.directive("tgIssuePriorityButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",r]),t=function(t,e,r,n,i,o,s,a){var c;return c=function(r,c,u,l){var p,d,h;return p=[],h=null,r.$watch(u.ngModel,function(t){if(t)return t.milestone?(c.find(".assign-issue-button.button-unset").removeClass("is-active"),c.find(".assign-issue-button.button-set").addClass("is-active")):(c.find(".assign-issue-button.button-set").removeClass("is-active"),c.find(".assign-issue-button.button-unset").addClass("is-active"))}),c.on("click",".assign-issue-button.button-unset",function(t){var n;return t.preventDefault(),t.stopPropagation(),n=i.instant("ISSUES.ACTION_ATTACH_SPRINT"),h=l.$modelValue,e.sprints.list(r.projectId,null).then(function(t){return r.milestones=t.milestones,r.selectedSprint=h.milestone,p=angular.copy(r.milestones),o.open(c.find(".lightbox-assign-sprint-to-issue"))})}),c.on("click",".assign-issue-button.button-set",function(n){return n.preventDefault(),n.stopPropagation(),h=l.$modelValue,e.sprints.list(r.projectId,null).then(function(e){var r,n,u;return r=_.find(e.milestones,{id:h.milestone}),u=i.instant("ISSUES.CONFIRM_DETACH_FROM_SPRINT.TITLE"),n=i.instant("ISSUES.CONFIRM_DETACH_FROM_SPRINT.MESSAGE",{sprintName:r.name}),a.ask(u,null,n).then(function(e){var r,n,i;return n=function(){return t.$broadcast("assign-sprint-to-issue:success",null),e.finish(),o.close(c)},r=function(){return e.finish(!1),a.notify("error")},i=s.save(function(t){return t.setAttr("milestone",null),t}),i.then(n,r)})})}),r.$on("$destroy",function(){return c.off()}),d=function(t,e){return e=f(e.toUpperCase()),t=f(t.toUpperCase()),_.includes(e,t)},r.filterMilestones=function(t){return r.milestones=p.filter(function(e){return d(t,e.name)})},r.saveIssueToSprint=function(e,r){var i,a;return i=n().target($(r.currentTarget)).start(),h.setAttr("milestone",e.id),a=s.save(function(t){return h.setAttr("milestone",e.id),t}),a.then(function(){return i.finish(),o.close(c.find(".lightbox-assign-sprint-to-issue")),t.$broadcast("assign-sprint-to-issue:success",e.id)})}},{link:c,restrict:"EA",require:"ngModel",templateUrl:"issue/assign-sprint-to-issue-button.html"}},d.directive("tgAssignSprintToIssueButton",["$rootScope","$tgResources","$tgRepo","$tgLoading","$translate","lightboxService","$tgQueueModelTransformation","$tgConfirm",t])}.call(this),function(){var t,e,r,n,i,o;i=this.taiga,e=this.taiga.bindOnce,r=this.taiga.debounce,o=this.taiga.trim,n=angular.module("taigaIssues"),t=function(t,e,n,i,o,s,a){var c;return c=function(t,c,u){var l,p,d;return l=null,t.$on("issueform:bulk",function(e,r,n,i){return l&&l.reset(),s.open(c),t["new"]={projectId:r,milestoneId:n,bulk:""}}),p=r(2e3,function(r){var u,p,f,h,g;if(r.preventDefault(),l=c.find("form").checksley(),l.validate())return u=o().target(d).start(),p=t["new"].bulk,h=t["new"].projectId,f=t["new"].milestoneId,g=e.issues.bulkCreate(h,f,p),g.then(function(t){return t=_.map(t.data,function(t){return a.make_model("issues",t)}),u.finish(),i.$broadcast("issueform:new:success",t),s.close(c),n.notify("success")}),g.then(null,function(){return u.finish(),n.notify("error")})}),d=c.find(".submit-button"),c.on("submit","form",p),t.$on("$destroy",function(){return c.off()})},{link:c}},n.directive("tgLbCreateBulkIssues",["$tgRepo","$tgResources","$tgConfirm","$rootScope","$tgLoading","lightboxService","$tgModel",t])}.call(this),function(){var t,e,r,n,i,o,s,a,c,u,l,p,d,f,h,g=function(t,e){return function(){return t.apply(e,arguments)}},m=function(t,e){function r(){this.constructor=t}for(var n in e)v.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},v={}.hasOwnProperty;d=this.taiga,u=this.taiga.mixOf,h=this.taiga.trim,f=this.taiga.toString,c=this.taiga.joinStr,a=this.taiga.groupBy,o=this.taiga.bindOnce,s=this.taiga.debounceLeading,p=this.taiga.startswith,i=this.taiga.bindMethods,s=this.taiga.debounceLeading,l=angular.module("taigaIssues"),r=function(t){function e(t,e,r,n,o,s,a,c,u,l,p,d,f,h,m,v,y,_){var b;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=o,this.urls=s,this.params=a,this.q=c,this.location=u,this.appMetaService=l,this.navUrls=p,this.events=d,this.analytics=f,this.translate=h,this.errorHandlingService=m,this.storage=v,this.filterRemoteStorageService=y,this.projectService=_,this.loadIssues=g(this.loadIssues,this),i(this),this.scope.sectionName=this.translate.instant("PROJECT.SECTION.ISSUES"),this.voting=!1,this.applyStoredFilters(this.params.pslug,this.filtersHashSuffix)||(b=this.loadInitialData(),b.then(function(t){return function(){var e,r;return r=t.translate.instant("ISSUES.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.translate.instant("ISSUES.PAGE_DESCRIPTION",{projectName:t.scope.project.name,projectDescription:t.scope.project.description}),t.appMetaService.setAll(r,e)}}(this)),b.then(null,this.onInitialDataError.bind(this)),this.scope.$on("issueform:new:success",function(t){return function(){return t.analytics.trackEvent("issue","create","create issue on issues list",1),t.loadIssues()}}(this)),this.scope.$on("assigned-to:changed",function(t){return function(){if(t.generateFilters(),t.isFilterDataTypeSelected("assigned_to")||t.isFilterDataTypeSelected("role")||t.isOrderedBy("assigned_to")||t.isOrderedBy("modified"))return t.loadIssues()}}(this)),this.scope.$on("status:changed",function(t){return function(){if(t.generateFilters(),t.isFilterDataTypeSelected("status")||t.isOrderedBy("status")||t.isOrderedBy("modified"))return t.loadIssues()}}(this)))}return m(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$tgUrls","$routeParams","$q","$tgLocation","tgAppMetaService","$tgNavUrls","$tgEvents","$tgAnalytics","$translate","tgErrorHandlingService","$tgStorage","tgFilterRemoteStorageService","tgProjectService","tgUserActivityService"],e.prototype.filtersHashSuffix="issues-filters",e.prototype.myFiltersHashSuffix="issues-my-filters",e.prototype.excludePrefix="exclude_",e.prototype.filterCategories=["tags","status","type","severity","priority","assigned_to","owner","role"],e.prototype.isOrderedBy=function(t){var e;return e=new RegExp("-*"+t),e.test(this.location.search().order_by)},e.prototype.changeQ=function(t){return this.unselectFilter("page"),this.replaceFilter("q",t),this.loadIssues(),this.generateFilters()},e.prototype.removeFilter=function(t){return this.unselectFilter("page"),this.unselectFilter(t.dataType,t.id,!1,t.mode),this.loadIssues(),this.generateFilters()},e.prototype.addFilter=function(t){return this.unselectFilter("page"),this.selectFilter(t.category.dataType,t.filter.id,!1,t.mode),this.loadIssues(),this.generateFilters()},e.prototype.selectCustomFilter=function(t){var e;return e=this.location.search().order_by,e&&(t.filter.order_by=e),this.unselectFilter("page"),this.replaceAllFilters(t.filter),this.loadIssues(),this.generateFilters()},e.prototype.removeCustomFilter=function(t){return this.filterRemoteStorageService.getFilters(this.scope.projectId,this.myFiltersHashSuffix).then(function(e){return function(r){return delete r[t.id],e.filterRemoteStorageService.storeFilters(e.scope.projectId,r,e.myFiltersHashSuffix).then(e.generateFilters)}}(this))},e.prototype.isFilterDataTypeSelected=function(t){var e,r,n,i;for(i=this.selectedFilters,r=0,n=i.length;r0}),a.assigned_to=_.map(s.assigned_to,function(t){return t.id?t.id=t.id.toString():t.id="null",t.name=t.full_name||"Unassigned",t}),a.owner=_.map(s.owners,function(t){return t.id=t.id.toString(),t.name=t.full_name,t}),a.role=_.map(s.roles,function(t){return t.id?t.id=t.id.toString():t.id="null",t.name=t.name||"Unassigned",t}),e.selectedFilters=[],l=e.filterCategories,c=0,u=l.length;c1,h.showNext=!(t.page===f),e=t.page,i=d=1,m=f;1<=m?d<=m:d>=m;i=1<=m?++d:--d)i===e+s&&f>e+s+u?g.push({classes:"dots",type:"dots"}):i===e-l&&e>c+l?g.push({classes:"dots",type:"dots"}):i>e+s&&i<=f-u||ic||(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 d()}),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,c,u;return a=o.getOrderBy(),a&&(c=p(a,"-")?"icon-arrow-up":"icon-arrow-down",s=r.find(".row.title > div[data-fieldname='"+h(a,"-")+"']"),u=$("").attr("svg-icon",c),s.append(u),n(s.contents())(t)),r.on("click",".row.title > div",function(i){var s,l,d;return d=angular.element(i.currentTarget),a=o.getOrderBy(),l=d.data("fieldname"),"total_voters"===l&&"-total_voters"!==a&&(a="total_voters"),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(),c=p(s,"-")?"icon-arrow-up":"icon-arrow-down",u=$("").attr("svg-icon",c),d.append(u),n(d.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,n,s){var a,c;return a=n.controller(),c=e.$eval(s.tgIssueStatusInlineEdition),n.on("click",".issue-status",function(t){return t.preventDefault(),t.stopPropagation(),n.find(".pop-status").popover().open()}),n.on("click",".status",function(i){var s;return i.preventDefault(),i.stopPropagation(),s=angular.element(i.currentTarget),c.status=s.data("status-id"),n.find(".pop-status").popover().close(),o(n,c,e.issueStatusById),e.$apply(function(){return t.save(c).then(function(t){return r.$broadcast("status:changed",t)})})}),d.bindOnce(e,"project",function(t){if(n.append(i({statuses:t.issue_statuses})),o(n,c,e.issueStatusById),t.my_permissions.indexOf("modify_issue")===-1)return n.unbind("click"),n.find("a").addClass("not-clickable")}),e.$watch(s.tgIssueStatusInlineEdition,function(t){return function(t){return o(n,t,e.issueStatusById)}}(this)),e.$on("$destroy",function(){return n.off()})},{link:n}},l.directive("tgIssueStatusInlineEdition",["$tgRepo","$tgTemplate","$rootScope",e]),t=function(t,e,r,n){var i,o;return o=_.template('<%- name %>\n
<%- name %>
'),i=function(i,s,a){var c,u,l;return l=function(t){var e,a,c;return a={name:r.instant("COMMON.ASSIGNED_TO.NOT_ASSIGNED"),imgurl:"/"+window._version+"/images/unnamed.png"},c=i.usersById[t.assigned_to],e=n.getAvatar(c),a.imgurl=e.url,a.bg=null,c&&(a.name=c.full_name_display,a.bg=e.bg),s.find(".avatar").html(o(a)),s.find(".issue-assignedto").attr("title",a.name)},c=s.controller(),u=i.$eval(a.tgIssueAssignedToInlineEdition),l(u),s.on("click",".issue-assignedto",function(t){return e.$broadcast("assigned-to:add",u)}),d.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(r,n,i){if(i.id===u.id)return i.assigned_to=n,t.save(u).then(function(){return l(i),e.$broadcast("assigned-to:changed",i)})}),i.$watch(a.tgIssueAssignedToInlineEdition,function(t){return l(t)}),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,c,u,l,p=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;l=this.taiga,c=this.taiga.mixOf,a=this.taiga.groupBy,s=this.taiga.bindOnce,o=this.taiga.bindMethods,u=angular.module("taigaUserStories"),i=function(t){function e(t,e,r,n,i,s,a,c,u,l,p,d,f,h,g,m,v,y){var _;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=s,this.q=a,this.location=c,this.log=u,this.appMetaService=l,this.navUrls=p,this.analytics=d,this.translate=f,this.modelTransform=h,this.errorHandlingService=g,this.configService=m,this.projectService=v,this.wysiwigService=y,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(),_=this.loadInitialData(),_.then(function(t){return function(){return t._setMeta(),t.initializeOnDeleteGoToUrl()}}(this)),_.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","tgProjectService","tgWysiwygService"],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.wysiwigService.getHTML(this.scope.us.description)||"").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.loadTasks(),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("task:reorder",function(t){return function(e,r,n){return t.reorderTask(r,n)}}(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(){var t;return t=this.projectService.project.toJS(),this.scope.projectId=t.id,this.scope.project=t,this.scope.$emit("project:loaded",t),this.scope.statusList=t.us_statuses,this.scope.statusById=a(t.us_statuses,function(t){return t.id}),this.scope.taskStatusById=a(t.task_statuses,function(t){return t.id}),this.scope.pointsList=_.sortBy(t.points,"order"),this.scope.pointsById=a(this.scope.pointsList,function(t){return t.id}),t},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(),this.fillUsersAndRoles(t.members,t.roles),this.loadUs().then(function(t){return 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.prototype.reorderTask=function(t,e){var r,n,i,o,s,a,c,u,l;return s={},this.scope.tasks.forEach(function(t){return s[t.id]=t.us_order}),l=this.scope.tasks.filter(function(e){return e.id!==t.id}),n=l.slice(0,e),r=l.slice(e),a=n[n.length-1],o=a?a.us_order+1:0,s[t.id]=o,c=n.filter(function(t){return t.us_order===a.us_order}),u=_.fromPairs(c.map(function(t){return[t.id,t.us_order]})),r.forEach(function(t){return s[t.id]=t.us_order+1}),this.scope.tasks=_.map(this.scope.tasks,function(t){return t.us_order=s[t.id],t}),this.scope.tasks=_.sortBy(this.scope.tasks,"us_order"),i={us_order:o,version:t.version},this.rs.tasks.reorder(t.id,i,u).then(function(t){return function(e){return t.scope.tasks=_.map(t.scope.tasks,function(t){return t.id===e.id?e:t}),t.rootscope.$broadcast("related-tasks:reordered")}}(this))},e}(c(l.Controller,l.PageMixin)),u.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"}},u.directive("tgUsStatusDisplay",["$tgTemplate","$compile",r]),e=function(t,e,r,n,i,o,s){var a,c;return c=o.get("common/components/status-button.html",!0),a=function(e,o,a,u){var l,p,d;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=c({status:n,statuses:e.statusList,editable:l()}),o.html(r),s(o.contents())(e)}}(this),d=function(e){return function(e){var s,a,c,u;return o.find(".pop-status").popover().close(),s=n().target(o.find(".js-edit-status")).start(),u=i.save(function(t){return t.status=e,t}),c=function(){return t.$broadcast("object:updated"),s.finish()},a=function(){return r.notify("error"),s.finish()},u.then(c,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"),d(e)}),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 o.off()})},{link:a,restrict:"EA",require:"ngModel"}},u.directive("tgUsStatusButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",e]),n=function(t,e,r,n,i,o,s){var a,c;return c=o.get("us/us-team-requirement-button.html",!0),a=function(e,o,a,u){var l,p,d;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=c(r),n=s(n)(e),o.html(n)},d=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=!u.$modelValue.team_requirement,d(e)}),e.$watch(function(){var t;return null!=(t=u.$modelValue)?t.team_requirement:void 0},function(){var t;if(t=u.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},u.directive("tgUsTeamRequirementButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",n]),t=function(t,e,r,n,i,o,s){var a,c;return c=o.get("us/us-client-requirement-button.html",!0),a=function(e,o,a,u){var l,p,d;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(c(r))(e),o.html(n)},d=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=!u.$modelValue.client_requirement,d(e)}),e.$watch(function(){var t;return null!=(t=u.$modelValue)?t.client_requirement:void 0},function(){var t;if(t=u.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},u.directive("tgUsClientRequirementButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",t])}.call(this),function(){var t,e,r,n,i,o,s,a,c,u=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;c=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,c,u,l,p,d,f,h,g,m){var v;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=o,this.params=s,this.q=a,this.location=c,this.log=u,this.appMetaService=l,this.navUrls=p,this.analytics=d,this.translate=f,this.modelTransform=h,this.errorHandlingService=g,this.projectService=m,i(this),this.scope.taskRef=this.params.taskref,this.scope.sectionName=this.translate.instant("TASK.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 u(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$log","tgAppMetaService","$tgNavUrls","$tgAnalytics","$translate","$tgQueueModelTransformation","tgErrorHandlingService","tgProjectService"], 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("promote-task-to-us:success",function(t){return function(){return t.analytics.trackEvent("task","promoteToUserstory","promote task to userstory",1),t.rootscope.$broadcast("object:updated"),t.loadTask()}}(this)),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(){var t;return t=this.projectService.project.toJS(),this.scope.projectId=t.id,this.scope.project=t,this.scope.$emit("project:loaded",t),this.scope.statusList=t.task_statuses,this.scope.statusById=o(t.task_statuses,function(t){return t.id}),t},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(),this.fillUsersAndRoles(t.members,t.roles),this.loadTask().then(function(t){return 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(c.Controller,c.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 c,u;return u=a.get("common/components/status-button.html",!0),c=function(e,s,a,c){var l,p,d;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(u({status:n,statuses:e.statusList,editable:l()}))(e),s.html(r)}}(this),d=function(e){var o,a,c,u;return o=n().target(s).start(),u=i.save(function(t){return t.status=e,t}),c=function(){return t.$broadcast("object:updated"),o.finish()},a=function(){return r.notify("error"),o.finish()},u.then(c,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(),d(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 s.off()})},{link:c,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,c;return c=s.get("issue/iocaine-button.html",!0),a=function(e,s,a,u){var l,p,d;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(c(r))(e),s.html(n)):void s.html("")},d=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=!u.$modelValue.is_iocaine,d(e)}),e.$watch(function(){var t;return null!=(t=u.$modelValue)?t.is_iocaine:void 0},function(){var t;if(t=u.$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,c,u,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,a=this.taiga.mixOf,c=angular.module("taigaTeam"),e=function(t){function e(t,e,r,n,i,o,s,a,c,u,l,p,d){var f;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=c,this.auth=u,this.translate=l,this.projectService=p,this.errorHandlingService=d,this.scope.sectionName="TEAM.SECTION_NAME",f=this.loadInitialData(),f.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)),f.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)})}},c.filter("membersFilter",s)}.call(this),function(){var t,e,r,n,i,o,s,a,c,u=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;c=this.taiga,s=this.taiga.mixOf,o=this.taiga.groupBy,n=this.taiga.bindOnce,i=this.taiga.debounce,a=angular.module("taigaWiki"),t=function(t){function e(t,e,r,n,i,o,s,a,c,l,p,d,f,h,g,m,v){var y;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=c,this.filter=l,this.log=p,this.appMetaService=d,this.navUrls=f,this.analytics=h,this.translate=g,this.errorHandlingService=m,this.projectService=v,this.moveLink=u(this.moveLink,this),this.loadWiki=u(this.loadWiki,this),this.scope.$on("wiki:links:move",this.moveLink),this.scope.$on("wikipage:add",this.loadWiki),this.scope.projectSlug=this.params.pslug,this.scope.wikiSlug=this.params.slug,this.scope.sectionName="Wiki",this.scope.linksVisible=!1,y=this.loadInitialData(),y.then(function(t){return function(){return t._setMeta()}}(this)),y.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","tgProjectService"],e.prototype._setMeta=function(){var t,e,r,n,i;return i=this.translate.instant("WIKI.PAGE_TITLE",{wikiPageName:this.scope.wikiSlug,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(){var t;return t=this.projectService.project.toJS(),t.is_wiki_activated||this.errorHandlingService.permissionDenied(),this.scope.projectId=t.id,this.scope.project=t,this.scope.$emit("project:loaded",t),t},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\n \n \n\n
\n\n \n {{'COMMON.DESCRIPTION.NO_DESCRIPTION' | translate}}\n \n"}},a.directive("tgWikiWysiwyg",["$tgQueueModelTransformation","$rootScope","$tgConfirm","tgAttachmentsFullService","$tgQqueue","$tgRepo","$tgAnalytics","tgActivityService",r])}.call(this),function(){var t,e,r,n,i,o;o=this.taiga,n=this.taiga.mixOf,r=this.taiga.groupBy,e=this.taiga.bindOnce,i=angular.module("taigaWiki"),t=function(t,r,n,i,o,s,a,c,u){var l,p,d;return d=a.get("wiki/wiki-nav.html",!0),p=function(n,a,l){var p,f,h,g;return p=a.controller(),null==l.ngModel?r.error("WikiNavDirective: no ng-model attr is defined"):(f=n.project.my_permissions.indexOf("add_wiki_link")>-1,h=null,g=function(e){var r,l,m,v,y;return f=n.project.my_permissions.indexOf("add_wiki_link")>-1,r=n.project.my_permissions.indexOf("delete_wiki_link")>-1,l=d({wikiLinks:e,projectSlug:n.projectSlug,addWikiLinkPermission:f,deleteWikiLinkPermission:r}),l=c(l)(n),a.off(),f&&h&&h.destroy(),a.html(l),f&&(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=u.instant("WIKI.DELETE_LINK_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,c,u,l;return e.preventDefault(),13===e.keyCode?(l=angular.element(e.currentTarget),c=l.val(),r=s().target(a.find(".new")).start(),u=t.create("wiki-links",{project:n.projectId,title:c}),u.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")})}),u.then(null,function(t){var e;return r.finish(),a.find(".new input").val(c),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,c,u,l){var p;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=c,this.errorHandlingService=u,this.projectService=l,this.scope.projectSlug=this.params.pslug,this.scope.wikiSlug=this.params.slug,this.scope.sectionName="Wiki",this.scope.linksVisible=!1,p=this.loadInitialData(),p.then(null,this.onInitialDataError.bind(this))}return i(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgModel","$tgConfirm","$tgResources","$routeParams","$q","$tgNavUrls","tgErrorHandlingService","tgProjectService"],e.prototype.loadProject=function(){var t;return t=this.projectService.project.toJS(),t.is_wiki_activated||this.errorHandlingService.permissionDenied(),this.scope.projectId=t.id,this.scope.project=t,this.scope.$emit("project:loaded",t),t},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;rt.total_memberships,this.scope.$emit("project:loaded",t),t},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}),_.map(t.scope.memberships,function(e){if(e.is_owner)return t.scope.projectOwnerEmail=e.user_email}),t.scope.page=e.current,t.scope.count=e.count,t.scope.paginatedBy=e.paginatedBy,e}}(this))},e.prototype.loadInitialData=function(){return this.loadProject(),this.q.all([this.loadMembers(),this.auth.refresh()])},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}(c(l.Controller,l.PageMixin,l.FiltersMixin)),u.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,c,u,l,p,d;return a=2,l=4,c=2,u=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===f),r=t.page,o=d=1,m=f;1<=m?d<=m:d>=m;o=1<=m?++d:--d)o===r+a&&f>r+a+u?g.push({classes:"dots",type:"dots"}):o===r-l&&r>c+l?g.push({classes:"dots",type:"dots"}):o>r+a&&o<=f-u||oc||(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 d()}),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}},u.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 c,u,l;return u=r.instant("ADMIN.MEMBERSHIP.STATUS_PENDING"), l=function(t){var r,a,c;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?"":u,isOwner:t.is_owner},c=s(a),c=n(c)(e),o.html(c)},null==a.tgMembershipsRowAvatar?t.error("MembershipsRowAvatarDirective: the directive need a member"):(c=e.$eval(a.tgMembershipsRowAvatar),l(c),e.$on("$destroy",function(){return o.off()}))},{link:o}},u.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 c,u,l;return n.$on("$destroy",function(){return o.off()}),null==a.tgMembershipsRowAdminCheckbox?t.error("MembershipsRowAdminCheckboxDirective: the directive need a member"):(u=n.$eval(a.tgMembershipsRowAdminCheckbox),u.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 u.revert(),o.find(":checkbox").prop("checked",u.is_admin),r.notify("error",t.is_admin[0])},s=angular.element(t.currentTarget),u.is_admin=s.prop("checked"),e.save(u).then(i,n)}}(this)),c=l(u),u.is_admin?o.find(":checkbox").prop("checked",!0):void 0))},{link:o}},u.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,c,u,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(),u=n.$eval(s.tgMembershipsRowRoleSelector),c=l(u),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),u.role!==n)return u.role=n,e.save(u).then(o,i)}}(this)),n.$on("$destroy",function(){return o.off()}))},{link:n}},u.directive("tgMembershipsRowRoleSelector",["$log","$tgRepo","$tgConfirm",o]),r=function(t,e,r,n,i,o,s,a,c,u){var l,p,d;return l='
\n
\n\n \n',d='\n\n\n \n',p=function(p,f,h){var g,m,v,y;return y=function(t){var e;return e=t.user?i(l)(p):i(d)(p),f.html(e)},null==h.tgMembershipsRowActions?t.error("MembershipsRowActionsDirective: the directive need a member"):(g=f.controller(),v=p.$eval(h.tgMembershipsRowActions),y(v),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:p.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(p.member.id).then(i,e)}),m=function(){var t,r,i;return i=o.instant("ADMIN.MEMBERSHIP.DELETE_MEMBER"),t=o.instant("ADMIN.MEMBERSHIP.DEFAULT_DELETE_MESSAGE",{email:v.email}),r=v.user?v.full_name:t,n.askOnDelete(i,r).then(function(t){var i,c;return c=function(e){return function(){var e;return t.finish(),v.user!==p.user.id?(p.page>1&&p.count-1<=p.paginatedBy&&g.selectFilter("page",p.page-1),u.fetchProject().then(function(){return g.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(v).then(c,i)})},f.on("click",".delete",function(t){var e;return t.preventDefault(),p.project.owner.id===v.user?(e=p.user.id===v.user,c.create("tg-lightbox-leave-project-warning",{"class":"lightbox lightbox-leave-project-warning"},{isCurrentUser:e,project:p.project})):m()}),p.$on("$destroy",function(){return f.off()}))},{link:p}},u.directive("tgMembershipsRowActions",["$log","$tgRepo","$tgResources","$tgConfirm","$compile","$translate","$tgLocation","$tgNavUrls","tgLightboxFactory","tgProjectService",r]),s=function(){return{templateUrl:"admin/no-more-memberships-explanation.html",scope:{project:"=",ownerEmail:"="}}},u.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,c,u,l,p,d,f,h,g,m,v,y,b,S,j,k,$,I,T,E,C,P,w=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=function(t,e){return function(){return t.apply(e,arguments)}};E=this.taiga,$=this.taiga.mixOf,T=this.taiga.scopeDefer,P=this.taiga.trim,C=this.taiga.toString,k=this.taiga.joinStr,j=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,c,u,l,p,d,f,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=a,this.navUrls=c,this.appMetaService=u,this.translate=l,this.tgAuth=p,this.currentUserService=d,this.errorHandlingService=f,this.projectService=h,this.model=g,this.scope.project={},this.scope.projectTags=[],m=this.loadInitialData(),m.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)),m.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","tgProjectService","$tgModel"],e.prototype.loadProject=function(){var t;return t=this.projectService.project.toJS(),t=this.model.make_model("projects",t),t.i_am_admin||this.errorHandlingService.permissionDenied(),this.scope.projectId=t.id,this.scope.project=t,this.scope.epicStatusList=_.sortBy(t.epic_statuses,"order"),this.scope.usStatusList=_.sortBy(t.us_statuses,"order"),this.scope.pointsList=_.sortBy(t.points,"order"),this.scope.taskStatusList=_.sortBy(t.task_statuses,"order"),this.scope.issueTypesList=_.sortBy(t.issue_types,"order"),this.scope.issueStatusList=_.sortBy(t.issue_statuses,"order"),this.scope.prioritiesList=_.sortBy(t.priorities,"order"),this.scope.severitiesList=_.sortBy(t.severities,"order"),T(this.scope,function(e){return function(){return e.scope.$emit("project:loaded",t)}}(this)),this.scope.projectTags=_.map(this.scope.project.tags,function(t){return function(e){return[e,t.scope.project.tags_colors[e]]}}(this)),t},e.prototype.loadInitialData=function(){return 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}($(E.Controller,E.PageMixin)),I.controller("ProjectProfileController",v),y=function(t,e,r,n,i,o,s,a){var c;return c=function(c,u,l){var p,d,f,h;return p=u.controller(),d=u.find("form").checksley({onlyOneErrorElement:!0}),f=S(2e3,function(u){return function(u){var l,f,g;if(u.preventDefault(),d.validate())return l=r().target(h).start(),f=c.project.isAttributeModified("is_private"),g=t.save(c.project),g.then(function(){var t;return l.finish(),f&&c.project.is_private?a.trackEvent("project-privacy-changed","from-public-to-private","Change project privacy from public to private",1):f&&!c.project.is_private&&a.trackEvent("project-privacy-changed","from-private-to-public","Change project privacy from private to public",1),e.notify("success"),t=n.resolve("project-admin-project-profile-details",{project:c.project.slug}),i.path(t),o.fetchProject().then(function(t){return function(){return p.loadInitialData()}}(this)),s.loadProjects()}),g.then(null,function(t){if(l.finish(),d.setErrors(t),t._error_message)return e.notify("error",t._error_message)})}}(this)),h=u.find(".submit-button"),u.on("submit","form",f)},{link:c}},I.directive("tgProjectProfile",["$tgRepo","$tgConfirm","$tgLoading","$tgNavUrls","$tgLocation","tgProjectService","tgCurrentUserService","$tgAnalytics",y]),d=function(t,e,r,n){var i;return i=function(i,o,s){var a,c,u;return a=o.find("form").checksley({onlyOneErrorElement:!0}),c=S(2e3,function(o){return function(o){var s,c;if(o.preventDefault(),a.validate())return s=n().target(u).start(),c=e.save(i.project),c.then(function(){return s.finish(),r.notify("success"),t.$broadcast("admin:project-default-values:updated")}),c.then(null,function(t){if(s.finish(),a.setErrors(t),t._error_message)return r.notify("error",t._error_message)})}}(this)),u=o.find(".submit-button"),o.on("submit","form",c),i.$on("$destroy",function(){return o.off()})},{link:i}},I.directive("tgProjectDefaultValues",["$rootScope","$tgRepo","$tgConfirm","$tgLoading",d]),m=function(t,e,r,n){var i;return i=function(n,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=e.save(n.project),s.then(function(){return n.$emit("project:loaded",n.project),t.$broadcast("admin:project-modules:updated"),r.notify("success")}),s.then(null,function(t){if(o.setErrors(t),t._error_message)return r.notify("error",t._error_message)})}}(this),i.on("change",".module-activation.module-direct-active input",function(t){return t.preventDefault(),n.$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}),n.$watch("project.videoconferences",function(t,e){if(null!=t&&null!=e&&t!==e)return n.project.videoconferences_extra_data=""}),n.$watch("isVideoconferenceActivated",function(t,e){if(t===!1&&(n.project.videoconferences=null,n.project.videoconferences_extra_data="",e===!0))return s()}),n.$watch("project",function(t){return null!=t.videoconferences?n.isVideoconferenceActivated=!0:n.isVideoconferenceActivated=!1})},{link:i}},I.directive("tgProjectModules",["$rootScope","$tgRepo","$tgConfirm","$tgLoading",m]),f=function(t,e,r,n,i){var o;return o=function(o,s,a){var c,u,l,p,d,f,h,g,m,v,y,_,b,j,k,$,I,T,E,C,P,w,A,O,R,M;return u=s.find(".admin-project-export-buttons"),T=function(){return u.removeClass("hidden")},p=function(){return u.addClass("hidden")},m=s.find(".admin-project-export-result"),A=function(){return m.removeClass("hidden")},d=function(){return m.addClass("hidden")},R=s.find(".spin"),O=function(){return R.removeClass("hidden")},f=function(){return R.addClass("hidden")},y=s.find(".result-title"),g=n.instant("ADMIN.PROJECT_EXPORT.LOADING_TITLE"),h=n.instant("ADMIN.PROJECT_EXPORT.LOADING_MESSAGE"),l=function(){return y.html(n.instant("ADMIN.PROJECT_EXPORT.DUMP_READY"))},c=function(){return y.html(n.instant("ADMIN.PROJECT_EXPORT.ASYNC_MESSAGE"))},M=function(t){return y.html(n.instant("ADMIN.PROJECT_EXPORT.SYNC_MESSAGE",{url:t}))},k=function(){return y.html(g)},b=function(){return y.html(h)},I=function(){return y.html(l)},v=s.find(".result-message "),j=function(){return v.html(h)},_=function(){return v.html(c)},$=function(t){return v.html(M(t))},w=function(){return O(),k(),j(),p(),A()},C=function(){return f(),b(),_()},P=function(t){return f(),I(),$(t)},E=function(){return f(),d(),T()},s.on("click","a.button-export",S(2e3,function(s){return function(s){var a,c;return s.preventDefault(),c=function(e){var r;return i.trackEvent("exporter","export-project","Exported project",1),202===e.status?C():(r=e.data.url,P(r),t.open(r,"_blank"))},a=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"](o.projectId).then(c,a)}}(this)))},{link:o}},I.directive("tgProjectExport",["$window","$tgResources","$tgConfirm","$translate","$tgAnalytics",f]),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._deleteUuid=O(this._deleteUuid,this),this._generateUuid=O(this._generateUuid,this),this.setCsvUuid=O(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._deleteUuid=function(t){var e;return null==t&&(t=null),e=this.rs.projects["delete_"+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.prototype.deleteUuid=function(){var t,e;return this.scope.csvUuid?(e=this.translate.instant("ADMIN.REPORTS.DELETE_TITLE"),t=this.translate.instant("ADMIN.REPORTS.DELETE_SUBTITLE"),this.confirm.ask(e,t).then(this._deleteUuid)):this._deleteUuid()},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),c=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",c),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]),u=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",u]),h=function(t,e,r,n){var i;return i=function(t,i,o){var s,a,c;return c=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&&c(),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,c,u,l,p,d,f,h,g,m,v,y,b,S,j,k,I,T,E,C,P,w,A=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,R=function(t,e){return function(){return t.apply(e,arguments)}};C=this.taiga,T=this.taiga.mixOf,w=this.taiga.trim,P=this.taiga.toString,I=this.taiga.joinStr,k=this.taiga.groupBy,b=this.taiga.bindOnce,S=this.taiga.debounce,j=this.taiga.getDefaulColorList,E=angular.module("taigaAdmin"),h=function(t){function e(t,e,r,n,i,o,s,a,c,u,l,p,d){var f,h,g;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=c,this.appMetaService=u,this.translate=l,this.errorHandlingService=p,this.projectService=d,this.scope.project={},this.loadInitialData(),h=this.translate.instant(this.scope.sectionName),g=this.translate.instant("ADMIN.PROJECT_VALUES.PAGE_TITLE",{sectionName:h,projectName:this.scope.project.name}),f=this.scope.project.description,this.appMetaService.setAll(g,f)}return A(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","tgAppMetaService","$translate","tgErrorHandlingService","tgProjectService"],e.prototype.loadProject=function(){var t;return t=this.projectService.project.toJS(),t.i_am_admin||this.errorHandlingService.permissionDenied(),this.scope.projectId=t.id,this.scope.project=t,this.scope.$emit("project:loaded",t),t},e.prototype.loadInitialData=function(){var t;return t=this.loadProject()},e}(T(C.Controller,C.PageMixin)),E.controller("ProjectValuesSectionController",h),d=function(t){function e(t,e,r,n,i){var o;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.moveValue=R(this.moveValue,this),this.loadValues=R(this.loadValues,this),this.scope.$on("admin:project-values:move",this.moveValue),o=this.scope.$watch("resource",function(t){return function(e){if(e)return t.loadValues(),o()}}(this))}return A(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 e.length&&(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).then(function(t){return function(){return t.rootscope.$broadcast("admin:project-values:updated")}}(this))},e}(C.Controller),E.controller("ProjectValuesController",d),u=function(t){function e(){return this.displayValues=R(this.displayValues,this),this.createDefaultValues=R(this.createDefaultValues,this),this.loadValues=R(this.loadValues,this),e.__super__.constructor.apply(this,arguments)}return A(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 e.length?(t.scope.maxValueOrder=_.maxBy(e,"order").order,t.displayValues(e)):t.createDefaultValues(),e}}(this))},e.prototype.createDefaultValues=function(){if(null!=this.rs[this.scope.resource].createDefaultValues)return this.rs[this.scope.resource].createDefaultValues(this.scope.projectId,this.scope.type).then(function(t){return function(e){var r;return t.rootscope.$broadcast("admin:project-values:updated"),r=e.data,r.length&&(t.scope.maxValueOrder=_.maxBy(r,"order").order,t.displayValues(r)),r}}(this))},e.prototype.displayValues=function(t){return _.each(t,function(t,e){return t.days_to_due_abs=null!==t.days_to_due?Math.abs(t.days_to_due):null,t.sign=t.days_to_due>=0?1:-1}),this.scope.values=t},e}(d),E.controller("ProjectDueDatesValuesController",u),f=function(t,e,r,n,i,o,s,a){var c,u,l;return u=function(t,e,r){var n,i,o,s,a,c;return s=null,o=null,i=null,c=e.find(".sortable"),n=dragula([c[0]],{direction:"vertical",copySortSource:!1,copy:!1,mirrorContainer:c[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()})},l=function(t,n,i){var c,u,l,p,d,f,h,g,m;return c=n.controller(),m=i.type,f=i.objname,p=function(){return t.newValue={name:"",is_closed:!1,is_archived:!1}},d=function(){return t.addNewElementText=o.instant("ADMIN.PROJECT_VALUES_"+f.toUpperCase()+".ACTION_ADD")},p(),d(),s.$on("$translateChangeEnd",function(){return t.$evalAsync(d)}),l=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(){var e;return e=t.parents(".row.table-main"),e.addClass("hidden"),e.siblings(".visualization").removeClass("hidden"),s.$broadcast("admin:project-values:updated"),a.fetchProject()}),i.then(null,function(t){return r.setErrors(t)})},h=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 r.addClass("hidden"),t.values.push(e),t.maxValueOrder=e.order,p(),s.$broadcast("admin:project-values:updated")}),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"),l(!0)}),n.on("click",".add-new",S(2e3,function(t){var e;return t.preventDefault(),e=n.find(".new-value"),h(e)})),n.on("click",".delete-new",function(t){return t.preventDefault(),n.find(".new-value").addClass("hidden"),p()}),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"),h(e)):27===t.keyCode?(n.find(".new-value").addClass("hidden"),p()):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,a,u,l,p,d,f;return n.preventDefault(),l=angular.element(n.currentTarget),a=l.parents("form"),f=a.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")):(d=o.instant("ADMIN.COMMON.TITLE_ACTION_DELETE_VALUE"),p=o.instant("ADMIN.PROJECT_VALUES.REPLACEMENT"),r.askChoice(d,u,i,p).then(function(t){var n,i;return i=function(){return c.loadValues()["finally"](function(){return s.$broadcast("admin:project-values:updated"),t.finish()})},n=function(){return r.notify("error")},e.remove(f,{moveTo:t.selected}).then(i,n)}))})},c=function(t,e,r){return u(t,e,r),l(t,e,r),t.$on("$destroy",function(){return e.off()})},{link:c}},E.directive("tgProjectValues",["$log","$tgRepo","$tgConfirm","$tgLocation","animationFrame","$translate","$rootScope","tgProjectService",f]),c=function(t,e,r,n,i,o,s,a){var c,u;return u=f(t,e,r,n,i,o,s,a),c=function(t,n,i,a){var c,u,l,p,d;return a=n.controller(),d=i.type,l=function(){return t.newValue={name:"",days_to_due:0,sign:1}},l(),c=function(t){return t.days_to_due=t.days_to_due_abs*t.sign},u=function(t){var e,r,n;return n=angular.element(t.currentTarget),r=n.parents(".row.table-main"),e=n.parents("form"),e.scope().value?e.scope().value:e.scope().newValue},p=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(d,t.newValue),o.then(function(e){return r.addClass("hidden"),e.sign=t.newValue.sign,e.days_to_due_abs=t.newValue.days_to_due_abs,t.values.push(e),s.$broadcast("admin:project-values:updated"),l()}),o.then(null,function(t){return n.setErrors(t)})},n.on("input",".days-to-due-abs",function(e){var r;return e.preventDefault(),r=u(e),t.$apply(function(){return c(r)})}),n.on("click",".days-to-due-sign",function(e){var r;return e.preventDefault(),r=u(e),t.$apply(function(){return r.sign=r.sign*-1,c(r)})}),n.on("click",".add-new-due-date",S(2e3,function(t){var e;return t.preventDefault(),e=n.find(".new-value"),p(e)})),n.on("click",".delete-due-date",function(t){var n,i,c,u,l;return t.preventDefault(),c=angular.element(t.currentTarget),n=c.parents("form"),l=n.scope().value,u=o.instant("LIGHTBOX.ADMIN_DUE_DATES.TITLE_ACTION_DELETE_DUE_DATE"),i=o.instant("LIGHTBOX.ADMIN_DUE_DATES.SUBTITLE_ACTION_DELETE_DUE_DATE",{due_date_status_name:l.name}),r.ask(u,i).then(function(t){var n,i;return i=function(){return a.loadValues()["finally"](function(){return s.$broadcast("admin:project-values:updated"),t.finish()})},n=function(){return r.notify("error")},e.remove(l).then(i,n)})})},{link:function(t,e,r){return u.link(t,e,r),c(t,e,r)}}},E.directive("tgProjectDueDatesValues",["$log","$tgRepo","$tgConfirm","$tgLocation","animationFrame","$translate","$rootScope","tgProjectService",c]),e=function(){var t;return t=function(t,e,r,n){var i;return t.colorList=j(),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"}},E.directive("tgColorSelection",e),m="text",i="multiline",g="richtext",r="date",y="url",n="dropdown",t="checkbox",o="number",v=[{key:m,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_TEXT"},{key:i,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_MULTI"},{key:g,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_RICHTEXT"},{key:r,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_DATE"},{key:y,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_URL"},{key:n,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_DROPDOWN"},{key:t,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_CHECKBOX"},{key:o,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_NUMBER"}],s=function(t){function e(t,e,r,n,i,o,s,a,c,u,l){var p,d,f;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=c,this.translate=u,this.projectService=l,this.moveCustomAttributes=R(this.moveCustomAttributes,this),this.deleteCustomAttribute=R(this.deleteCustomAttribute,this),this.saveCustomAttribute=R(this.saveCustomAttribute,this),this.createCustomAttribute=R(this.createCustomAttribute,this),this.loadCustomAttributes=R(this.loadCustomAttributes,this), this._onCustomAttributesModified=R(this._onCustomAttributesModified,this),this.scope.TYPE_CHOICES=v,this.scope.project=this.projectService.project.toJS(),this.scope.projectId=this.scope.project.id,d=this.translate.instant(this.scope.sectionName),f=this.translate.instant("ADMIN.CUSTOM_ATTRIBUTES.PAGE_TITLE",{sectionName:d,projectName:this.scope.project.name}),p=this.scope.project.description,this.appMetaService.setAll(f,p),this.scope.init=function(t){return function(e){return t.scope.type=e,t.loadCustomAttributes()}}(this)}return A(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","tgAppMetaService","$translate","tgProjectService"],e.prototype._parseAttributesExtra=function(){return this.scope.customAttributes=_.map(this.scope.customAttributes,function(t){return function(e){return t._parseAttributeExtra(e)}}(this))},e.prototype._parseAttributeExtra=function(t){return"dropdown"!==t.type||t.extra||(t.extra=[""]),t},e.prototype._onCustomAttributesModified=function(){return this.rootscope.$broadcast("admin:project-custom-attributes:updated")},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,t._parseAttributesExtra(),e}}(this))},e.prototype.createCustomAttribute=function(t){return this.repo.create("custom-attributes/"+this.scope.type,t).then(function(t){return function(){return t._onCustomAttributesModified()}}(this))},e.prototype.saveCustomAttribute=function(t){return this.repo.save(t).then(function(t){return function(){return t._onCustomAttributesModified()}}(this))},e.prototype.deleteCustomAttribute=function(t){return this.repo.remove(t).then(function(t){return function(){return t._onCustomAttributesModified()}}(this))},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).then(function(t){return function(){return t._onCustomAttributesModified()}}(this))},e}(T(C.Controller,C.PageMixin)),E.controller("ProjectCustomAttributesController",s),a=function(t,e,r,n){var i;return i=function(t,r,i){var o,s,a,c,u,l,p,d,f,h,g,m,v,y,_,b,j,k,I,T,E,C,P,w;return o=r.controller(),t.$on("$destroy",function(){return r.off()}),t.isExtraVisible={},a=function(t,e){var r;return t.preventDefault(),r=angular.element(t.currentTarget).closest("form"),e(r)},_=function(){var t,n,i,s,a,c,u;for(u=r.find(".js-sortable"),t=dragula([u[0]],{direction:"vertical",copySortSource:!1,copy:!1,mirrorContainer:u[0],moves:function(t,e,r){var n;return n=$(r).closest(".js-child-sortable"),!n[0]&&$(t).is("div[tg-bind-scope]")}}),t.on("dragend",function(t){var e,r,n;return r=$(t),e=r.scope().attr,n=r.index(),o.moveCustomAttributes(e,n)}),c=r.find(".js-child-sortable"),a=[],i=0,s=c.length;i\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,u,l){var p,d,f,g,m;return p=u.controller(),d=function(t){var e,r,n,i,o,s,c,u,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_"))},c=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)}),u=[{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(u)}),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)}),c(e)},m=function(t,e){return t.find(".resume").html(n(c({category:e}))(a))},f=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 u.off(),n=i(),_.each(d(a.role),function(t,e){return n=angular.element(n).append(f(t,e))}),u.html(n),u.on("click",".resume",function(t){var e;return t.preventDefault(),e=angular.element(t.currentTarget),e.toggleClass("open-drawer"),e.next().toggleClass("open")}),u.on("change",".category-item input",function(n){var i,o,s,c;return i=function(){var t;return t=_.filter(u.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},c=angular.element(n.currentTarget),a.role.permissions=i(),s=function(){var e,n;return e=d(a.role),n=c.parents(".category-config").data("id"),m(c.parents(".category-config"),e[n]),t.$broadcast("projects:reload"),r.notify("success"),p.forceLoadProject()},o=function(){return r.notify("error"),c.prop("checked",!c.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 u.off()}),a.$on("role:changed",function(){return g()}),s(a,l.ngModel,g)},{link:a}},u.directive("tgRolePermissions",["$rootScope","$tgRepo","$tgConfirm","$compile",r])}.call(this),function(){var t,e,r,n,i,o,s,a,c,u,l,p,d,f,h,g,m,v,y,b=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;v=this.taiga,g=this.taiga.mixOf,f=this.taiga.bindMethods,h=this.taiga.debounce,y=this.taiga.timeout,m=angular.module("taigaAdmin"),d=function(t){function e(t,e,r,n,i,o,s,a,c,u){var l;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=c,this.projectService=u,f(this),this.scope.sectionName="ADMIN.WEBHOOKS.SECTION_NAME",this.scope.project={},l=this.loadInitialData(),l.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)),l.then(null,this.onInitialDataError.bind(this)),this.scope.$on("webhooks:reload",this.loadWebhooks)}return b(e,t),e.$inject=["$scope","$tgRepo","$tgResources","$routeParams","$tgLocation","$tgNavUrls","tgAppMetaService","$translate","tgErrorHandlingService","tgProjectService"],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(){var t;return t=this.projectService.project.toJS(),t.i_am_admin||this.errorHandlingService.permissionDenied(),this.scope.projectId=t.id,this.scope.project=t,this.scope.$emit("project:loaded",t),t},e.prototype.loadInitialData=function(){return this.loadProject(),this.loadWebhooks()},e}(g(v.Controller,v.PageMixin,v.FiltersMixin)),m.controller("WebhooksController",d),p=function(t,e,r,n,i){var o;return o=function(n,o,s){var a,c,u,l,p,d,f,g;return g=n.$eval(s.tgWebhook),d=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 a.addClass("hidden")})}),s.on("click",function(t){return a.removeClass("hidden"),a.find("input")[0].focus()})},{link:o}},m.directive("tgNewWebhook",["$tgResources","$tgRepo","$tgConfirm","$tgLoading","$tgAnalytics",c]),r=function(t){function e(t,e,r,n,i,o,s){var a;this.scope=t,this.repo=e,this.rs=r,this.params=n,this.appMetaService=i,this.translate=o,this.projectService=s,f(this),this.scope.sectionName=this.translate.instant("ADMIN.GITHUB.SECTION_NAME"),this.scope.project={},a=this.loadInitialData(),a.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)),a.then(null,this.onInitialDataError.bind(this))}return b(e,t),e.$inject=["$scope","$tgRepo","$tgResources","$routeParams","tgAppMetaService","$translate","tgProjectService"],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(){var t;return t=this.projectService.project.toJS(),this.scope.projectId=t.id,this.scope.project=t,this.scope.$emit("project:loaded",t),t},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),this.loadModules()},e}(g(v.Controller,v.PageMixin,v.FiltersMixin)),m.controller("GithubController",r),i=function(t){function e(t,e,r,n,i,o,s){var a;this.scope=t,this.repo=e,this.rs=r,this.params=n,this.appMetaService=i,this.translate=o,this.projectService=s,f(this),this.scope.sectionName=this.translate.instant("ADMIN.GITLAB.SECTION_NAME"),this.scope.project={},a=this.loadInitialData(),a.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)),a.then(null,this.onInitialDataError.bind(this)),this.scope.$on("project:modules:reload",function(t){return function(){return t.loadModules()}}(this))}return b(e,t),e.$inject=["$scope","$tgRepo","$tgResources","$routeParams","tgAppMetaService","$translate","tgProjectService"],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(){var t;return t=this.projectService.project.toJS(),this.scope.projectId=t.id,this.scope.project=t,this.scope.$emit("project:loaded",t),t},e.prototype.loadInitialData=function(){return this.loadProject(),this.loadModules()},e}(g(v.Controller,v.PageMixin,v.FiltersMixin)),m.controller("GitlabController",i),t=function(t){function e(t,e,r,n,i,o,s){var a;this.scope=t,this.repo=e,this.rs=r,this.params=n,this.appMetaService=i,this.translate=o,this.projectService=s,f(this),this.scope.sectionName=this.translate.instant("ADMIN.BITBUCKET.SECTION_NAME"),this.scope.project={},a=this.loadInitialData(),a.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)),a.then(null,this.onInitialDataError.bind(this)),this.scope.$on("project:modules:reload",function(t){return function(){return t.loadModules()}}(this))}return b(e,t),e.$inject=["$scope","$tgRepo","$tgResources","$routeParams","tgAppMetaService","$translate","tgProjectService"],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(){var t;return t=this.projectService.project.toJS(),this.scope.projectId=t.id,this.scope.project=t,this.scope.$emit("project:loaded",t),t},e.prototype.loadInitialData=function(){return this.loadProject(),this.loadModules()},e}(g(v.Controller,v.PageMixin,v.FiltersMixin)),m.controller("BitbucketController",t),u=function(t,e){var r;return r=function(r,n,i){return n.on("click",".select-input-content",function(){var r;if(r=n.find("input"),r.val())return r.select(),document.execCommand("copy"),e.notify("success",t.instant("COMMON.COPIED_TO_CLIPBOARD"))})},{link:r}},m.directive("tgSelectInputText",["$translate","$tgConfirm",u]),n=function(t,e,r,n){var i;return i=function(i,o,s){var a,c,u;return a=o.find("form").checksley({onlyOneErrorElement:!0}),c=h(2e3,function(o){return function(o){var s,c;if(o.preventDefault(),a.validate())return s=r().target(u).start(),c=t.saveAttribute(i.github,"github"),c.then(function(){return n.trackEvent("github-webhook","created-or-changed","Create or changed github webhook",1),s.finish(),e.notify("success")}),c.then(null,function(t){if(s.finish(),a.setErrors(t),t._error_message)return e.notify("error",t._error_message)})}}(this)),u=o.find(".submit-button"),o.on("submit","form",c)},{link:i}},m.directive("tgGithubWebhooks",["$tgRepo","$tgConfirm","$tgLoading","$tgAnalytics",n]),o=function(t,e,r,n){var i;return i=function(i,o,s){var a,c,u;return a=o.find("form").checksley({onlyOneErrorElement:!0}),c=h(2e3,function(o){return function(o){var s,c;if(o.preventDefault(),a.validate())return s=r().target(u).start(),c=t.saveAttribute(i.gitlab,"gitlab"),c.then(function(){return n.trackEvent("gitlab-webhook","created-or-changed","Create or changed gitlab webhook",1),s.finish(),e.notify("success"),i.$emit("project:modules:reload")}),c.then(null,function(t){if(s.finish(),a.setErrors(t),t._error_message)return e.notify("error",t._error_message)})}}(this)),u=o.find(".submit-button"),o.on("submit","form",c)},{link:i}},m.directive("tgGitlabWebhooks",["$tgRepo","$tgConfirm","$tgLoading","$tgAnalytics",o]),e=function(t,e,r,n){var i;return i=function(i,o,s){var a,c,u;return a=o.find("form").checksley({onlyOneErrorElement:!0}),c=h(2e3,function(o){return function(o){var s,c;if(o.preventDefault(),a.validate())return s=r().target(u).start(),c=t.saveAttribute(i.bitbucket,"bitbucket"),c.then(function(){return n.trackEvent("bitbucket-webhook","created-or-changed","Create or changed bitbucket webhook",1),s.finish(),e.notify("success"),i.$emit("project:modules:reload")}),c.then(null,function(t){if(s.finish(),a.setErrors(t),t._error_message)return e.notify("error",t._error_message)})}}(this)),u=o.find(".submit-button"),o.on("submit","form",c)},{link:i}},m.directive("tgBitbucketWebhooks",["$tgRepo","$tgConfirm","$tgLoading","$tgAnalytics",e]),l=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"}},m.directive("tgValidOriginIps",l),s=function(t){function e(t,e,r,n,i,o,s){var a;this.scope=t,this.repo=e,this.rs=r,this.params=n,this.appMetaService=i,this.translate=o,this.projectService=s,f(this),this.scope.sectionName=this.translate.instant("ADMIN.GOGS.SECTION_NAME"),this.scope.project={},a=this.loadInitialData(),a.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)),a.then(null,this.onInitialDataError.bind(this))}return b(e,t),e.$inject=["$scope","$tgRepo","$tgResources","$routeParams","tgAppMetaService","$translate","tgProjectService"],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(){var t;return t=this.projectService.project.toJS(),this.scope.projectId=t.id,this.scope.project=t,this.scope.$emit("project:loaded",t),t},e.prototype.loadInitialData=function(){return this.loadProject(),this.loadModules()},e}(g(v.Controller,v.PageMixin,v.FiltersMixin)),a=function(t,e,r,n){var i;return i=function(i,o,s){var a,c,u;return a=o.find("form").checksley({onlyOneErrorElement:!0}),c=h(2e3,function(o){return function(o){var s,c;if(o.preventDefault(),a.validate())return s=r().target(u).start(),c=t.saveAttribute(i.gogs,"gogs"),c.then(function(){return n.trackEvent("gogs-webhook","create-or-change","Create or change gogs webhook",1),s.finish(),e.notify("success"),i.$emit("project:modules:reload")}),c.then(null,function(t){if(s.finish(),a.setErrors(t),t._error_message)return e.notify("error",t._error_message)})}}(this)),u=o.find(".submit-button"),o.on("submit","form",c),o.on("click",".submit-button",c)},{link:i}},m.controller("GogsController",s),m.directive("tgGogsWebhooks",["$tgRepo","$tgConfirm","$tgLoading","$tgAnalytics",a])}.call(this),function(){var t,e,r,n,i,o;i=this.taiga,e=this.taiga.bindOnce,o=this.taiga.timeout,r=this.taiga.debounce,n=angular.module("taigaProject"),t=function(t,e,r,n,i,o,s,a,c,u){var l;return l=function(r,l,p){var d,f;return d=null,r.$on("deletelightbox:new",function(t,e){return s.open(l),d=e}),r.$on("$destroy",function(){return l.off()}),f=function(){var r;return a.start(),s.close(l),r=t.remove(d),r.then(function(t){return u.trackEvent("projects","delete","Delete project",1),a.pageLoaded(),e.$broadcast("projects:reload"),n.path(i.resolve("home")),o.notify("success"),c.loadProjects()}),r.then(null,function(){return o.notify("error"),s.close(l)})},l.on("click",".button-red",function(t){return t.preventDefault(),s.close(l)}),l.on("click",".button-green",function(t){return t.preventDefault(),f()})},{link:l}},n.directive("tgLbDeleteProject",["$tgRepo","$rootScope","$tgAuth","$tgLocation","$tgNavUrls","$tgConfirm","lightboxService","tgLoader","tgCurrentUserService","$tgAnalytics",t])}.call(this),function(){var t,e,r,n,i,o,s,a,c,u,l;u=this.taiga.bindOnce,r=function(){var t;return t=function(t,e,r){return u(t,r.tgBoBind,function(t){return e.text(t)})},{link:t}},i=function(){var t;return t=function(t,e,r){return u(t,r.tgBoHtml,function(t){return e.html(t)})},{link:t}},o=function(){var t;return t=function(t,e,r){return u(t,r.tgBoRef,function(t){return e.html("#"+t+" ")})},{link:t}},s=function(){var t;return t=function(t,e,r){return u(t,r.tgBoSrc,function(t){return e.attr("src",t)})},{link:t}},n=function(){var t;return t=function(t,e,r){return u(t,r.tgBoHref,function(t){return e.attr("href",t)})},{link:t}},e=function(){var t;return t=function(t,e,r){return u(t,r.tgBoAlt,function(t){return e.attr("alt",t)})},{link:t}},a=function(){var t;return t=function(t,e,r){return u(t,r.tgBoTitle,function(t){return e.attr("title",t)})},{link:t}},c=function(){var t;return t=function(t,e,r){return t.$watch(r.tgTitleHtml,function(t){if(null!=t)return e.attr("title",t)})},{link:t}},t=function(){var t;return t=function(t,e,r){return t.$watch(r.tgBindHtml,function(t){if(null!=t)return e.html(t)})},{link:t}},l=angular.module("taigaBase"),l.directive("tgBoBind",r),l.directive("tgBoHtml",i),l.directive("tgBoRef",o),l.directive("tgBoSrc",s),l.directive("tgBoHref",n),l.directive("tgBoAlt",e),l.directive("tgBoTitle",a),l.directive("tgBindTitle",c),l.directive("tgBindHtml",t)}.call(this),function(){var t,e;t=function(){function t(){this.config=window.taigaConfig}return t.prototype.get=function(t,e){return null==e&&(e=null),_.has(this.config,t)?this.config[t]:e},t}(),e=angular.module("taigaBase"),e.service("$tgConfig",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=angular.module("taigaBase"),t=function(t){function e(t,e,r,n,i,o,s){this.rootScope=t,this.scope=e,this.params=r,this.repo=n,this.rs=i,this.confirm=o,this.projectService=s,this.scope.currentPlugin=_.head(_.filter(this.rootScope.adminPlugins,{slug:this.params.plugin})),this.scope.projectSlug=this.params.pslug,this.loadInitialData()}return n(e,t),e.$inject=["$rootScope","$scope","$routeParams","$tgRepo","$tgResources","$tgConfirm","tgProjectService"],e.prototype.loadProject=function(){var t;return t=this.projectService.project.toJS(),this.scope.projectId=t.id,this.scope.project=t,this.scope.$emit("project:loaded",t),this.scope.$broadcast("project:loaded",t),t},e.prototype.loadInitialData=function(){return this.loadProject()},e}(taiga.Controller),r.controller("ContribController",t),e=function(t){function e(t,e,r){this.rootScope=t,this.scope=e,this.params=r,this.scope.currentPlugin=_.head(_.filter(this.rootScope.userSettingsPlugins,{slug:this.params.plugin}))}return n(e,t),e.$inject=["$rootScope","$scope","$routeParams"],e}(taiga.Controller),r.controller("ContribUserSettingsController",e)}.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){this.storage=t,this.params=e}return r(e,t),e.$inject=["$tgStorage","$routeParams"],e.prototype.generateHash=function(t){return null==t&&(t=[]),t=_.map(t,function(t){return JSON.stringify(t)}),hex_sha1(t.join(":"))},e}(e.Service)}.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,t=function(t){function e(t,r,n,i,o,s){this.http=t,this.q=r,this.storage=n,this.rootScope=i,this.cacheFactory=o,this.translate=s,e.__super__.constructor.call(this),this.cache=this.cacheFactory("httpget")}return n(e,t),e.$inject=["$http","$q","$tgStorage","$rootScope","$cacheFactory","$translate"],e.prototype.headers=function(){var t,e,r;return t={},r=this.storage.get("token"),r&&(t.Authorization="Bearer "+r),e=this.translate.preferredLanguage(),e&&(t["Accept-Language"]=e),t},e.prototype.request=function(t){return t.headers=_.assign({},t.headers||{},this.headers()),this.http(t)},e.prototype.get=function(t,e,r){return r=_.assign({method:"GET",url:t},r),e&&(r.params=e),r.cache=this.cache,this.request(r)["finally"](function(t){return function(e){return t.cache.removeAll()}}(this))},e.prototype.post=function(t,e,r,n){return n=_.assign({method:"POST",url:t},n),e&&(n.data=e),r&&(n.params=r),this.request(n)},e.prototype.put=function(t,e,r,n){return n=_.assign({method:"PUT",url:t},n),e&&(n.data=e),r&&(n.params=r),this.request(n)},e.prototype.patch=function(t,e,r,n){return n=_.assign({method:"PATCH",url:t},n),e&&(n.data=e),r&&(n.params=r),this.request(n)},e.prototype["delete"]=function(t,e,r,n){return n=_.assign({method:"DELETE",url:t},n),e&&(n.data=e),r&&(n.params=r),this.request(n)},e}(r.Service),e=angular.module("taigaBase"),e.service("$tgHttp",t)}.call(this),function(){var t,e;t=function(t,e,r){return t.noreload=function(r){var n,i;return n=e.current,i=r.$on("$locationChangeSuccess",function(){return e.current=n,i()}),t},t.isInCurrentRouteParams=function(e,r){var n;return n=t.search()||{},n[e]===r},t},e=angular.module("taigaBase"),e.factory("$tgLocation",["$location","$route","$rootScope",t])}.call(this),function(){var t,e,r,n,i,o=[].indexOf||function(t){for(var e=0,r=this.length;ef?(p=a.instant("PROJECT.IMPORT.ERROR_MAX_SIZE_EXCEEDED",{fileName:e.name,fileSize:r(e.size),maxFileSize:r(f)}),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),c=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),d=function(t){return function(t){return l.reject("fail")}}(this),u=new FormData,u.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",c,!1),y.addEventListener("error",d,!1),y.open("POST",i.resolve("importer")),y.setRequestHeader("Authorization","Bearer "+o.getToken()),y.setRequestHeader("Accept","application/json"),y.send(u),l.promise)},c.changeLogo=function(e,o){var a,c,u,l,p,d;return u=t.get("maxUploadFileSize",null),u&&o.size>u?(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(u)+")"}},c=s.defer(),c.reject(p),c.promise):(a=new FormData,a.append("logo",o),l={transformRequest:angular.identity,headers:{"Content-Type":void 0}},d=i.resolve("projects")+"/"+e+"/change_logo",n.post(d,a,{},l))},c.removeLogo=function(t){var e;return e=i.resolve("projects")+"/"+t+"/remove_logo",n.post(e)},function(t){return t.projects=c}},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,c;return o=n.defer(),c=e.resolve("search"),s={url:c,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,n,i){var o;return o={},o.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})},o.stats=function(e,r){return t.queryOneRaw("milestones",r+"/stats")},o.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;nc?(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(c)+")"}},a=o.defer(),a.reject(l),a.promise):(s=new FormData,s.append("avatar",e),u={transformRequest:angular.identity,headers:{"Content-Type":void 0}},p=i.resolve("users")+"/change_avatar",n.post(p,s,{},u))},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,n){var i;return i=a.getQueryParams(t),i.project=t,i=_.extend({},i,n),e.queryOne("userstories",r,i)},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,i){var o,s;return s=n.resolve("bulk-update-us-kanban-order"),o={project_id:t,status_id:e,bulk_stories:i},r.post(s,o)},a.listValues=function(t,r){var n;return n={project:t},a.storeQueryParams(t,n),e.queryMany(r,n)},a.createDefaultValues=function(t,e){var i,o;return i={project_id:t},o=n.resolve(e+"-create-default"),r.post(o,i)},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,c,u,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=c,this.auth=u,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,c){var u,l,p;return u=new checksley.Form(s.find("form")),l=r(2e3,function(r){return function(r){var s,a;if(r.preventDefault(),u.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 c;return c=function(e,c,u){var l,p;return e.$on("deletelightbox:new",function(t,e){return s.open(c)}),e.$on("$destroy",function(){return c.off()}),l=function(){var r,u;return r=a().target(p).start(),u=t.remove(e.user),u.then(function(t){return r.finish(),s.close(c),n.logout(),i.path(o.resolve("login"))}),u.then(null,function(){return r.finish(),console.log("FAIL")})},c.on("click",".button-green",function(t){return t.preventDefault(),s.close(c)}),c.on("click",".button-red",r(2e3,function(t){return t.preventDefault(),l()})),p=c.find(".button-red")},{link:c,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=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.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,c,u,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=c,this.auth=u,this.errorHandlingService=l,this.scope.sectionName="USER_SETTINGS.NOTIFICATIONS.LIVE_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("UserLiveNotificationsController",t),e=function(){var t;return t=function(t,e,r){return t.$on("$destroy",function(){return e.off()})},{link:t}},o.directive("tgUserLiveNotifications",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 checked="checked"<% } %>/>\n \n
\n
\n
\n
\n checked="checked"<% } %> />\n \n
\n
\n
\n
\n checked="checked"<% } %> />\n \n
\n
\n
\n<% }) %>'),i=function(i,s,a){var c;return c=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,c,u;return u=angular.element(r.currentTarget),a=u.parents(".policy-table-row").data("index"),s=i.notifyPolicies[a],c=s.live_notify_level,s.live_notify_level=parseInt(u.val(),10),o=function(){return e.notify("success")},n=function(){return e.notify("error"),u.parents(".policy-table-row").find("input[value="+c+"]").prop("checked",!0)},t.save(s).then(o,n)})},i.$on("$destroy",function(){return s.off()}),n(i,a.ngModel,c)},{link:i}},o.directive("tgUserLiveNotificationsList",["$tgRepo","$tgConfirm","$compile",r])}.call(this),function(){var t,e,r,n,i,o,s,a,c,u=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;c=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,c,u,l,p,d,f,h){var g,m,v;this.scope=t,this.rootscope=e,this.config=r,this.repo=n,this.confirm=i,this.rs=o,this.params=s,this.q=c,this.location=u,this.navUrls=l,this.auth=p,this.translate=d,this.errorHandlingService=f,this.window=h,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(),g=this.config.get("maxUploadFileSize",null),g&&(v=this.translate.instant("USER_SETTINGS.AVATAR_MAX_SIZE",{maxFileSize:a(g)}),this.scope.maxFileSizeMsg=v),m=this.loadInitialData(),m.then(null,this.onInitialDataError.bind(this))}return u(e,t),e.$inject=["$scope","$rootScope","$tgConfig","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$tgAuth","$translate","tgErrorHandlingService","$window"],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.prototype.exportProfile=function(){var t,e;return e=function(t){var e;return e=t.data.url,this.window.open(e,"_blank")},t=function(t){return function(e){var r;if(null!=(r=e.data)?r._error_message:void 0)return t.confirm.notify("error",e.data._error_message)}}(this),this.auth.exportProfile().then(e,t)},e}(o(c.Controller,c.PageMixin)),s.controller("UserSettingsController",n),r=function(t,e,r,n){var o;return o=function(o,s,a){var c;return c=i(2e3,function(i){return function(i){var a,c,u,l;if(i.preventDefault(),c=s.find("form").checksley(),c.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")},u=function(e){return c.setErrors(e),t.notify("error",e._error_message)},r.save(o.user).then(l,u)}}(this)),s.on("submit","form",c),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,c,u;return u=function(){return o.find(".size-info").removeClass("hidden")},c=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&&u(),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(c,a)}),o.on("click","a.js-use-gravatar",function(t){return o.find(".loading-overlay").addClass("active"),r.userSettings.removeAvatar().then(c,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)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.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,c,u,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=c,this.auth=u,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 checked="checked"<% } %>/>\n \n
\n
\n
\n
\n checked="checked"<% } %> />\n \n
\n
\n
\n
\n checked="checked"<% } %> />\n \n
\n
\n
\n<% }) %>'),i=function(i,s,a){var c;return c=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,c,u;return u=angular.element(r.currentTarget),a=u.parents(".policy-table-row").data("index"),s=i.notifyPolicies[a],c=s.notify_level,s.notify_level=parseInt(u.val(),10),o=function(){return e.notify("success")},n=function(){return e.notify("error"),u.parents(".policy-table-row").find("input[value="+c+"]").prop("checked",!0)},t.save(s).then(o,n)})},i.$on("$destroy",function(){return s.off()}),n(i,a.ngModel,c)},{link:i}},o.directive("tgUserNotificationsList",["$tgRepo","$tgConfirm","$compile",r])}.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,a=[].indexOf||function(t){for(var e=0,r=this.length;e=0})},e}(r(i.Controller,i.PageMixin)),n.controller("UserProjectSettingsController",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)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;s=this.taiga,i=this.taiga.mixOf,n=this.taiga.bindOnce,o=angular.module("taigaUserSettings"),t=function(t){function e(t,e,r){var n;this.scope=t,this.rs=e,this.auth=r,this.scope.sectionName="USER_SETTINGS.EVENTS.SECTION_NAME",this.scope.user=this.auth.getUser(),n=this.loadInitialData(),n.then(null,this.onInitialDataError.bind(this))}return a(e,t),e.$inject=["$scope","$tgResources","$tgAuth"],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("UserWebNotificationsController",t),e=function(){var t;return t=function(t,e,r){return t.$on("$destroy",function(){return e.off()})},{link:t}},o.directive("tgUserWebNotifications",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 checked="checked" <% } %>\n name="policy-<%- notifyPolicy.id %>" id="policy-<%- notifyPolicy.id %>"/>\n
\n \n \n
\n
\n
\n<% }) %>'),i=function(i,s,a){var c;return c=function(){var n,a;return s.off(),n={notifyPolicies:i.notifyPolicies},a=o(n),s.html(r(a)(i)),s.on("click",".check",function(r){var n,o,s,a,c;return c=angular.element(r.currentTarget),a=c.data("index"),s=i.notifyPolicies[a],s.web_notify_level=!s.web_notify_level,o=function(){return e.notify("success"),c.find("input").prop("checked",s.web_notify_level)},n=function(){return e.notify("error")},t.save(s).then(o,n)})},i.$on("$destroy",function(){return s.off()}),n(i,a.ngModel,c)},{link:i}},o.directive("tgUserWebNotificationsList",["$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(){angular.module("taigaNotifications",[])}.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,n,i,o,s,a,c,u,l){var p;return p=function(t,e,r,n){var i,o,a;return i=function(){var e,n;return(null!=(e=t.project)&&null!=(n=e.my_permissions)?n.indexOf(r.requiredPerm):void 0)!==-1},a=function(e){var r,i,o;return r=n.$modelValue.assigned_to,i=l.searchUsers(e),r&&(i=_.reject(i,{id:r})),o=_.slice(i,0,5),o=_.map(o,function(t){return t.avatar=u.getAvatar(t)}),t.users=_.slice(i,0,5),t.showMore=i.length>5},o=function(e){var r;return(null!=e?e.assigned_to:void 0)?(t.selected=e.assigned_to,r=t.usersById[t.selected],t.fullName=null!=r?r.full_name_display:void 0,t.isUnassigned=!1,t.avatar=u.getAvatar(r),t.bg=t.avatar.bg,t.isIocaine=null!=e?e.is_iocaine:void 0):(t.fullName=s.instant("COMMON.ASSIGNED_TO.ASSIGN"),t.isUnassigned=!0,t.avatar=u.getAvatar(null),t.bg=null,t.isIocaine=!1),t.fullNameVisible=!(t.isUnassigned&&!c.isAuthenticated()),t.isEditable=i()},e.on("click",".users-search",function(t){return t.stopPropagation()}),e.on("click",".users-dropdown",function(r){return r.preventDefault(),r.stopPropagation(),t.usersSearch="",a(),t.$apply(),e.find(".pop-users").popover().open()}),t.selfAssign=function(){return n.$modelValue.assigned_to=c.getUser().get("id"),o(n.$modelValue)},t.unassign=function(){return n.$modelValue.assigned_to=null,o()},t.$watch("usersSearch",function(t){if(null!=t)return a(t),e.find("input").focus()}),e.on("click",".user-list-single",function(e){var r;return e.preventDefault(),r=angular.element(e.currentTarget),n.$modelValue.assigned_to=r.data("user-id"),o(n.$modelValue),t.$apply()}),t.$watch(r.ngModel,function(t){return o(t)}),t.$on("isiocaine:changed",function(t,e){return o(e)}),t.$on("$destroy",function(){return e.off()})},{link:p,templateUrl:"common/components/assigned-to-inline.html",require:"ngModel"}},angular.module("taigaComponents").directive("tgAssignedToInline",["$rootScope","$tgConfirm","$tgRepo","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$translate","$compile","tgCurrentUserService","tgAvatarService","tgUserListService",t])}.call(this),function(){var t;t=function(t,e,r,n,i,o,s,a,c,u){var l,p;return p=o.get("common/components/assigned-to.html",!0),l=function(r,l,d,f){var h,g,m;return h=function(){var t,e;return(null!=(t=r.project)&&null!=(e=t.my_permissions)?e.indexOf(d.requiredPerm):void 0)!==-1},m=function(r){var o,s,a;return s=f.$modelValue.clone(),s.assigned_to=r,o=n().target(l).start(),a=i.save(function(t){return t.assigned_to=r,t}),a.then(function(e){return o.finish(),t.$broadcast("object:updated")}),a.then(null,function(){return e.notify("error"),o.finish()}),a},g=function(){var t,e;return p=o.get("common/components/assigned-to.html"),e=r.$new(),t=a(p)(e),l.html(t)},r.assign=function(){return t.$broadcast("assigned-to:add",f.$modelValue)},r.unassign=function(){var t;return t=s.instant("COMMON.ASSIGNED_TO.CONFIRM_UNASSIGNED"),e.ask(t).then(function(t){return t.finish(),m(null)})},r.selfAssign=function(){var t;return t=c.getUser().get("id"),m(t)},r.$on("assigned-to:added",function(t,e,r){if(r.id===f.$modelValue.id)return m(e)}),r.$watch(d.ngModel,function(t){var e;return(null!=t?t.assigned_to:void 0)?(r.selected=t.assigned_to,e=r.usersById[r.selected],r.fullName=null!=e?e.full_name_display:void 0,r.isUnassigned=!1,r.avatar=u.getAvatar(e),r.bg=r.avatar.bg,r.isIocaine=null!=t?t.is_iocaine:void 0):(r.fullName=s.instant("COMMON.ASSIGNED_TO.ASSIGN"),r.isUnassigned=!0,r.avatar=u.getAvatar(null),r.bg=null,r.isIocaine=!1),r.fullNameVisible=!(r.isUnassigned&&!c.isAuthenticated()),r.isEditable=h(),g()}),r.$on("$destroy",function(){return l.off()})},{link:l,require:"ngModel"}},angular.module("taigaComponents").directive("tgAssignedTo",["$rootScope","$tgConfirm","$tgRepo","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$translate","$compile","tgCurrentUserService","tgAvatarService",t])}.call(this),function(){var t,e=[].indexOf||function(t){for(var e=0,r=this.length;e0},f=function(r){var n,i,o;return i=p.searchUsers(r),n=[],_.map(i,function(t){var r;if(r=t.id,e.call(s,r)>=0)return t.avatar=l.getAvatar(t),n.push(t)}),o=[],_.map(i,function(t){var r;if(r=t.id,e.call(s,r)<0)return t.avatar=l.getAvatar(t),o.push(t)}),t.selected=_.slice(n,0,5),t.selected.length<5?t.users=_.slice(o,0,5-t.selected.length):t.users=[],t.showMore=i.length>5},d=function(){var e;return e=_.map(s,function(e){return t.usersById[e]}),e=_.filter(e,function(t){return!!t}),t.hiddenUsers=s.length>3?s.length-3:0,t.assignedUsers=_.slice(e,0,3),t.isAssigned=c()},o=function(){return _.map(s,function(e){if(!t.usersById[e])return s.splice(s.indexOf(e),1)}),0===s.length?a=null:s.indexOf(a)!==-1&&a||(a=s[0]),i.$modelValue.setAttr("assigned_users",s),i.$modelValue.assigned_to=a},r.on("click",".users-dropdown",function(e){return e.preventDefault(),e.stopPropagation(),t.usersSearch=null,f(),t.$apply(),r.find(".pop-users").popover().open()}),t.assign=function(t){return s.push(t.id),d(),o()},t.selfAssign=function(){return s.push(u.getUser().get("id")),d(),o()},t.unassign=function(t){var e;return e=s.indexOf(t.id),s.splice(e,1),d(),o()},r.on("click",".users-search",function(t){return t.stopPropagation()}),t.$watch("usersSearch",function(t){if(null!=t)return f(t),r.find("input").focus()}),t.$watch(n.ngModel,function(t){var e;if(null!=t)return s=[],e=null,null!=t.assigned_users&&(s=t.assigned_users),e=t.assigned_to,d()}),t.$on("$destroy",function(){return r.off()})},{scope:!0,link:d,templateUrl:"common/components/assigned-users-inline.html",require:"ngModel"}},angular.module("taigaComponents").directive("tgAssignedUsersInline",["$rootScope","$tgConfirm","$tgRepo","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$translate","$compile","tgCurrentUserService","tgAvatarService","tgUserListService",t])}.call(this),function(){var t,e=[].indexOf||function(t){for(var e=0,r=this.length;e0},g=function(e,o){var s;return s=i.save(function(t){return t.assigned_users=e,t.assigned_to||(t.assigned_to=o),t}),s.then(function(){var r;return e=_.map(e,function(t){return n.usersById[t]}),h(e),r=t.$broadcast("object:updated")}),s.then(null,function(){return r.notify("error")})},f=function(){var e;return e=_.clone(u.$modelValue,!1),t.$broadcast("assigned-user:add",e)},n.selfAssign=function(){var t,e;if(d())return e=c.getUser().get("id"),t=_.clone(u.$modelValue.assigned_users,!1),t.push(e),t=_.uniq(t),g(t,e)},n.unassign=function(t){var e,i,o;if(d())return e=t.id,o=a.instant("COMMON.ASSIGNED_USERS.TITLE_LIGHTBOX_DELETE_ASSIGNED"),i=n.usersById[e].full_name_display,r.askOnDelete(o,i).then(function(t){var r;return t.finish(),r=_.clone(u.$modelValue.assigned_users,!1),r=_.pull(r,e),l(r)})},l=function(o){var s;return s=i.save(function(t){var r;return t.assigned_users=o,r=t.assigned_to,e.call(o,r)<0&&o.length>0&&(t.assigned_to=o[0]),0===o.length&&(t.assigned_to=null),t}),s.then(function(){var e,r;return r=i.getObj(),e=_.map(r.assignedUsers,function(t){return n.usersById[t]}),h(e),t.$broadcast("object:updated")}),s.then(null,function(){return item.revert(),r.notify("error")})},h=function(t){return n.assignedUsers=t,n.isEditable=d(),n.isAssigned=p(),n.openAssignedUsers=f},n.$on("assigned-user:deleted",function(t,e){var r;return r=_.clone(u.$modelValue.assigned_users,!1),r=_.pull(r,e),r=_.uniq(r),l(r)}),n.$on("assigned-user:added",function(t,e){var r;return r=_.clone(u.$modelValue.assigned_users,!1),r.push(e),r=_.uniq(r),g(r,e)}),n.$watch(s.ngModel,function(t){var e;if(null!=t)return e=_.map(t.assigned_users,function(t){return n.usersById[t]}),e=_.filter(e,function(t){return!!t}),h(e)}),n.$on("$destroy",function(){return o.off()})},{scope:!0,templateUrl:"common/components/assigned-users.html",link:u,require:"ngModel"}},angular.module("taigaComponents").directive("tgAssignedUsers",["$rootScope","$tgConfirm","$tgRepo","$tgQueueModelTransformation","$tgTemplate","$compile","$translate","tgCurrentUserService",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,o){return null==i&&(i=!0),null==o&&(o=!1),new Promise(function(s){return function(a,c){var u;return s.attachmentsService.validate(n)?(s.uploadingAttachments.push(n),u=s.attachmentsService.upload(n,e,t,r,o),u.then(function(t){var e;return s.uploadingAttachments=s.uploadingAttachments.filter(function(e){return e.name!==t.get("name")}),e=Immutable.Map(),e=e.merge({file:t,editable:i,loading:!1,from_comment:o}),s._attachments=s._attachments.push(e),s.regenerate(),s.rootScope.$broadcast("attachment:create"),a(e)})):c(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;return n=t.getAvatar(e,i),r.attr("src",n.url),r.attr("title",""+n.username),r.attr("alt",""+n.username),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(t,e,r,n,i){var o,s;return o=function(i,o,s){var a;return i.$watch("epics",function(t){return a(t)}),i.$on("related-epics:changed",function(t,e){return r.userstories.getByRef(e.project,e.ref,{}).then(function(t){return i.item.epics=t.epics,a(t.epics)})}),i.removeEpicRelationship=function(r){var o,s;return s=t.instant("LIGHTBOX.REMOVE_RELATIONSHIP_WITH_EPIC.TITLE"),o=t.instant("LIGHTBOX.REMOVE_RELATIONSHIP_WITH_EPIC.MESSAGE",{epicSubject:r.get("subject")}),e.ask(s,null,o).then(function(t){var o,s,a,c;return a=function(){return t.finish(),i.$broadcast("related-epics:changed",i.item)},s=function(){return t.finish(!1),e.notify("error")},o=r.get("id"),c=i.item.id,n.epics.deleteRelatedUserstory(o,c).then(a,s)})},a=function(t){if(i.epicsLength=0,i.immutable_epics=[],t&&!t.isIterable)return i.epicsLength=t.length,i.immutable_epics=Immutable.fromJS(t)}},s=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:o,scope:{epics:"=",item:"="},templateUrl:s}},e.directive("tgBelongToEpics",["$translate","$tgConfirm","$tgResources","tgResources","lightboxService",t])}.call(this),function(){var t;t=function(t,e,r,n,i){return{restrict:"A",compile:function(o,s){var a,c;return a=e(s.tgBindCode),c=e(s.tgBindCode,function(t){return(t||"").toString()}),r.$$addBindingClass(o),function(e,o,s){return r.$$addBindingInfo(o,s.tgBindCode),e.$watch(c,function(){var r;return r=n.getHTML(a(e)),o.html(t.getTrustedHtml(r)||""),i.addHightlighter(o)})}}}},angular.module("taigaComponents").directive("tgBindCode",["$sce","$parse","$compile","tgWysiwygService","tgWysiwygCodeHightlighterService",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.hasTasks=function(){var t;return t=this.item.getIn(["model","tasks"]),t&&t.size>0},t.prototype.hasMultipleAssignedUsers=function(){var t;return t=this.item.getIn(["model","assigned_users"]),t&&t.size>1},t.prototype.hasVisibleAttachments=function(){return this.item.get("images").size>0},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.getModifyPermisionKey=function(){return"task"===this.type?"modify_task":"modify_us"},t.prototype.getDeletePermisionKey=function(){return"task"===this.type?"delete_task":"delete_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":"issue"===this.type?"project-issues-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:"&",onClickRemove:"&",onClickDelete:"&",project:"=",item:"=",zoom:"=",zoomLevel:"=",archived:"=",type:"@"}}},e.directive("tgCard",t)}.call(this),function(){var t;t=function(){return{link:function(t,e){return e.on("click",function(t){var r;if(!$(t.target).is("input"))return t.preventDefault(),r=e.find('input[type="file"]'),r.val(""),r.trigger("click")}),t.$on("$destroy",function(){return e.off()})}}},angular.module("taigaComponents").directive("tgClickInputFile",[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=t,this.customColor=t},t.prototype.resetColor=function(){if(this.isColorRequired&&!this.color)return this.color=this.initColor},t.prototype.toggleColorList=function(){return this.displayColorList=!this.displayColorList,this.customColor=this.color,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.customColor&&this.isColorRequired||this.onSelectDropdownColor(this.customColor),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,this.objType={tasks:"task",issues:"issue",userstories:"us"}[this.item._name]}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.cancelEdit=function(){return this.editMode=!1,this.item.subject=this.originalSubject},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.prototype.relateToEpic=function(t){return this.rootScope.$broadcast("relate-to-epic:add",t)},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(){function t(t,e,r,n){this.translate=t,this.tgLightboxFactory=e,this.projectService=r,this.rootscope=n,this.defaultConfig=[{color:"#9dce0a",name:"normal due",days_to_due:null,by_default:!0},{color:"#ff9900",name:"due soon",days_to_due:14,by_default:!1},{color:"#ff8a84",name:"past due",days_to_due:0,by_default:!1}]}return t.$inject=["$translate","tgLightboxFactory","tgProjectService","$rootScope"],t.prototype.visible=function(){return"button"===this.format||null!=this.dueDate},t.prototype.disabled=function(){return this.isClosed},t.prototype.color=function(){var t;return(null!=(t=this.getStatus())?t.color:void 0)||null},t.prototype.title=function(){return this.dueDate?this._formatTitle():"button"===this.format?this.translate.instant("COMMON.DUE_DATE.TITLE_ACTION_SET_DUE_DATE"):""},t.prototype.getStatus=function(t){var e;return this.dueDate?(e=this.projectService.project.toJS(),t=e[this.objType+"_duedates"],t||(t=this.defaultConfig),this._getAppearance(t)):null},t.prototype._getDefaultAppearance=function(t){var e;return e=null,_.map(t,function(t){if(t.by_default===!0)return e=t}),e},t.prototype._getAppearance=function(t){var e,r,n;return e=this._getDefaultAppearance(t),t=_.sortBy(t,function(t){return-t.days_to_due}),r=moment(this.dueDate),n=moment(),_.map(t,function(t){var i;if(null!==t.days_to_due)return i=moment(r-moment.duration(t.days_to_due,"days")),n>=i?e=t:void 0}),e},t.prototype._formatTitle=function(){var t,e,r;return e=this.translate.instant("COMMON.PICKERDATE.FORMAT"),t=moment(this.dueDate).format(e),r=this.getStatus(),(null!=r?r.name:void 0)?t+" ("+r.name+")":t},t.prototype.setDueDate=function(){if(!this.disabled())return this.tgLightboxFactory.create("tg-lb-set-due-date",{"class":"lightbox lightbox-set-due-date"},{object:this.item,notAutoSave:this.notAutoSave})},t}(),angular.module("taigaComponents").controller("DueDateCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaComponents"),t=function(t,e){return{link:function(t,r,n,i){var o;return t.open=!1,o=e.get(),_.merge(o,{field:r.find(".due-date-button")[0],container:r.find(".date-picker-container")[0],bound:!0,onClose:function(){return t.open=!1,t.$apply()},onSelect:function(){return i.dueDate=this.getMoment().format("YYYY-MM-DD")}}),r.picker=new Pikaday(o),r.on("click",".due-date-button",function(e){return t.open?void r.picker.hide():(!r.picker.getDate()&&i.dueDate&&r.picker.setDate(moment(i.dueDate).format("YYYY-MM-DD")),r.picker.show(),t.open=!0,t.$apply())}),r.on("click",".date-picker-clean",function(e){return e.preventDefault(),e.stopPropagation(),i.dueDate=null,r.picker.setDate(i.dueDate),t.open=!1,r.picker.hide(),t.$apply()}),t.$on("status:changed",function(t,e){return i.isClosed=i.item.is_closed})},controller:"DueDateCtrl",controllerAs:"vm",bindToController:!0,templateUrl:"components/due-date/due-date-popover.html",scope:{dueDate:"=",isClosed:"=",item:"=",objType:"@",format:"@",notAutoSave:"="}}},e.directive("tgDueDatePopover",["$translate","tgDatePickerConfigService",t])}.call(this),function(){var t,e;e=angular.module("taigaComponents"),t=function(t,e){var r;return r=function(t,e){return e.format?"components/due-date/due-date-"+e.format+".html":"components/due-date/due-date-icon.html"},{link:function(r,n,i,o){var s;if(s=function(){var i,s;return s=t.instant("COMMON.PICKERDATE.FORMAT"),o.dueDate&&(o.dueDate=moment(o.dueDate,s)),n.on("click",".date-picker-popover-trigger",function(t){if(!o.disabled())return t.preventDefault(),t.stopPropagation(),n.find(".date-picker-popover").popover().open()}),n.on("click",".date-picker-clean",function(t){return t.preventDefault(),t.stopPropagation(),o.dueDate=null,r.$apply(),n.find(".date-picker-popover").popover().close()}),i=e.get(),_.merge(i,{field:n.find("input.due-date")[0],container:n.find(".date-picker-container")[0],bound:!1,onSelect:function(){return o.dueDate=this.getMoment().format("YYYY-MM-DD"),n.find(".date-picker-popover").popover().close(),r.$apply()}}),n.picker=new Pikaday(i)},"button-popover"===i.format)return s()},controller:"DueDateCtrl",controllerAs:"vm",bindToController:!0,templateUrl:r,scope:{dueDate:"=",isClosed:"=",item:"=",objType:"@",format:"@",notAutoSave:"="}}},e.directive("tgDueDate",["$translate","tgDatePickerConfigService",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()})},{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,c;return i=this.q.defer(),c=this.urls.resolve("user-storage"),s=t+":"+n,o=e([t,s]),_.isEmpty(r)?(a=this.http["delete"](c+"/"+o,{key:o,value:r}),a.then(function(){return i.resolve()}),a.then(null,function(){return i.reject()})):(a=this.http.put(c+"/"+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(""+c,{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({display:"block"})})},{priority:900,link:t}},angular.module("taigaComponents").directive("tgFilterSlideDown",[t])}.call(this),function(){var t;t=function(){function t(t){this.translate=t,this.opened=null,this.filterModeOptions=["include","exclude"],this.filterModeLabels={include:this.translate.instant("COMMON.FILTERS.ADVANCED_FILTERS.INCLUDE"),exclude:this.translate.instant("COMMON.FILTERS.ADVANCED_FILTERS.EXCLUDE")},this.filterMode="include",this.showAdvancedFilter=!1,this.customFilterForm=!1,this.customFilterName=""}return t.$inject=["$translate"],t.prototype.toggleAdvancedFilter=function(){return this.showAdvancedFilter=!this.showAdvancedFilter},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,mode:this.filterMode},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){var i;return i=t.$watch("vm.defaultQ",function(e){return e&&!t.vm.filtersForm.$dirty?(t.vm.q=e,i()):t.vm.filtersForm.$dirty?i():void 0}),r.$observe("open",function(r){return r=t.$eval(r),r?e.addClass("open"):e.removeClass("open")})},{scope:{onChangeQ:"&",onAddFilter:"&",onSelectCustomFilter:"&",onRemoveFilter:"&",onRemoveCustomFilter:"&",onSaveCustomFilter:"&",customFilters:"<",defaultQ:"=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 c,u,l;return l=null,u=introJs(),u.oncomplete(function(){return $("html,body").scrollTop(0)}),u.onexit(function(){return e.disableJoyRide()}),c=function(t,e){if(e[t.joyride])return u.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}),u.setOption("steps",r.get(t.joyride)),u.start()},t.$on("$routeChangeSuccess",function(r,n){return n.joyride&&e.isAuthenticated()?(u.oncomplete(function(){return e.disableJoyRide(n.joyride)}),n.loader?l=t.$on("loader:end",function(){return e.loadJoyRideConfig().then(function(t){return c(n,t)}),l()}):e.loadJoyRideConfig().then(function(t){return c(n,t)})):(u.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,c;return r.zoomIndex=t.get("kanban_zoom")||2,r.levels=5,c=[["ref"],["subject"],["owner","tags","extra_info","unfold"],["attachments"],["related_tasks","empty_extra_info"]],s=function(e){return null==e&&(e=0),t.get("kanban_zoom")!==e&&t.set("kanban_zoom",e),_.reduce(c,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,e;e=angular.module("taigaComponents"),t=function(){function t(t,e,r,n,i,o,s){this.rootScope=t,this.scope=e,this.rs=r,this.projectService=n,this.translate=i,this.lightboxService=o,this.confirm=s,this.projectId=this.projectService.project.get("id"),this.loading=!1,this.someSelected=!1,this.selectedSprintId=null,this.typesSelected={uss:!1,tasks:!1,issues:!1},this.itemsToMove={},this._loadSprints(),this.scope.$watch("vm.openItems",function(t){return function(e){if(e)return t._init(e)}}(this))}return t.$inject=["$rootScope","$scope","$tgResources","tgProjectService","$translate","lightboxService","$tgConfirm"],t.prototype._init=function(t){var e,r,n;return this.hasManyItemTypes=_.size(this.openItems)>1,this.ussCount=parseInt(null!=(e=t.uss)?e.length:void 0),this.updateSelected("uss",this.ussCount>0),this.tasksCount=parseInt(null!=(r=t.tasks)?r.length:void 0),this.updateSelected("tasks",this.tasksCount>0),this.issuesCount=parseInt(null!=(n=t.issues)?n.length:void 0),this.updateSelected("issues",this.issuesCount>0)},t.prototype._loadSprints=function(){return this.rs.sprints.list(this.projectId,{closed:!1}).then(function(t){return function(e){return t.sprints=_.filter(e.milestones,function(e){return e.id!==t.sprint.id})}}(this))},t.prototype.updateSelected=function(t,e){return this.typesSelected[t]=e,this.someSelected=_.some(this.typesSelected),e===!0?this.itemsToMove[t]=this.openItems[t]:this.itemsToMove[t]?delete this.itemsToMove[t]:void 0},t.prototype.submit=function(){var t;return t={},_.map(this.openItems,function(e){return function(r,n){if(!e.itemsToMove[n])return t[n]=!0}}(this)),this.loading=!0,this.moveItems().then(function(e){return function(){if(e.rootScope.$broadcast("taskboard:items:move",e.typesSelected),e.lightboxService.closeAll(),e.loading=!1,_.size(t)>0)return e.displayWarning(t)}}(this))},t.prototype.moveItems=function(){var t;return t=[],this.itemsToMove.uss&&t.push(this.rs.sprints.moveUserStoriesMilestone(this.sprint.id,this.projectId,this.selectedSprintId,this.itemsToMove.uss)),this.itemsToMove.tasks&&t.push(this.rs.sprints.moveTasksMilestone(this.sprint.id,this.projectId,this.selectedSprintId,this.itemsToMove.tasks)),this.itemsToMove.issues&&t.push(this.rs.sprints.moveIssuesMilestone(this.sprint.id,this.projectId,this.selectedSprintId,this.itemsToMove.issues)),Promise.all(t)},t.prototype.displayWarning=function(t){var e,r,n,i,o;return e=this.translate.instant("COMMON.I_GET_IT"),1===_.size(t)&&t.issues===!0?(i=this.translate.instant("TASKBOARD.MOVE_TO_SPRINT.WARNING_ISSUES_NOT_MOVED_TITLE"),r=this.translate.instant("TASKBOARD.MOVE_TO_SPRINT.WARNING_ISSUES_NOT_MOVED")):(o=0,_.map(this.itemsToMove,function(t,e){return o+=t.length}),i=this.translate.instant("TASKBOARD.MOVE_TO_SPRINT.WARNING_SPRINT_STILL_OPEN_TITLE",{total:o},"messageformat"),r=this.translate.instant("TASKBOARD.MOVE_TO_SPRINT.WARNING_SPRINT_STILL_OPEN",{sprintName:null!=(n=this.sprint)?n.name:void 0})),this.confirm.success(i,r,null,e)},t}(),e.controller("MoveToSprintLbCtrl",t)}.call(this),function(){var t,e;t=angular.module("taigaComponents"),e=function(t){var e;return e=function(e,r,n,i){return t.open(r)},{scope:{},bindToController:{openItems:"=",sprint:"="},templateUrl:"components/move-to-sprint/move-to-sprint-lb/move-to-sprint-lb.html",controller:"MoveToSprintLbCtrl",controllerAs:"vm",link:e}},e.$inject=["lightboxService"],t.directive("tgLbMoveToSprint",e)}.call(this),function(){var t,e;e=this.taiga,t=function(){function t(t,e,r){this.scope=t,this.lightboxFactory=e,this.projectService=r,this.permissions=this.projectService.project.get("my_permissions"),this.hasOpenItems=!1,this.disabled=!1,this.openItems={uss:[],tasks:[],issues:[]},this.scope.$watch("vm.uss",function(t){return function(){return t.getOpenUss()}}(this)),this.scope.$watch("vm.unnasignedTasks",function(t){return function(){return t.getOpenStorylessTasks()}}(this)),this.scope.$watch("vm.issues",function(t){return function(){return t.getOpenIssues()}}(this))}return t.$inject=["$scope","tgLightboxFactory","tgProjectService"],t.prototype.checkOpenItems=function(){return _.some(Object.keys(this.openItems),function(t){return function(e){return t.openItems[e].length>0}}(this))},t.prototype.openLightbox=function(){var t;if(this.disabled===!1&&this.hasOpenItems)return t={},_.map(this.openItems,function(e,r){if(e.length)return t[r]=e}),this.lightboxFactory.create("tg-lb-move-to-sprint",{"class":"lightbox lightbox-move-to-sprint",sprint:"sprint","open-items":"openItems"},{sprint:this.sprint,openItems:t})},t.prototype.getOpenUss=function(){if(this.uss&&this.permissions.indexOf("modify_us")!==-1)return this.openItems.uss=[],this.uss.map(function(t){return function(e){if(e.is_closed===!1)return t.openItems.uss.push({us_id:e.id,order:e.sprint_order})}}(this)),this.hasOpenItems=this.checkOpenItems()},t.prototype.getOpenStorylessTasks=function(){if(this.unnasignedTasks&&this.permissions.indexOf("modify_task")!==-1)return this.openItems.tasks=[],this.unnasignedTasks.map(function(t){return function(e){return e.map(function(e){if(e.get("model").get("is_closed")===!1)return t.openItems.tasks.push({task_id:e.get("model").get("id"),order:e.get("model").get("taskboard_order")})})}}(this)),this.hasOpenItems=this.checkOpenItems()},t.prototype.getOpenIssues=function(){if(this.issues&&this.permissions.indexOf("modify_issue")!==-1)return this.openItems.issues=[],this.issues.map(function(t){return function(e){if(e.get("status").get("is_closed")===!1)return t.openItems.issues.push({issue_id:e.get("id")})}}(this)),this.hasOpenItems=this.checkOpenItems()},t}(),angular.module("taigaComponents").controller("MoveToSprintCtrl",t)}.call(this),function(){var t,e;t=angular.module("taigaComponents"),e=function(t){return{controller:"MoveToSprintCtrl",controllerAs:"vm",bindToController:!0,templateUrl:"components/move-to-sprint/move-to-sprint.html",scope:{sprint:"=",uss:"=",unnasignedTasks:"=",issues:"=",disabled:"="}}},e.$inject=["tgTaskboardTasks"],t.directive("tgMoveToSprint",[e])}.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(){var t;return this.project=this.projectService.project,this.sprints=null!=(t=this.project.get("milestones"))?t.toJS():void 0,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;t=function(t,e,r,n){var i;return i=function(i,o,s,a){var c,u;return c=null,u=function(n,i){var o,s,a,u;return s={},s["generated_from_"+c]=n.id,s.project=n.project,s.subject=n.subject,s.description=n.description,s.tags=n.tags,s.is_blocked=n.is_blocked,s.blocked_note=n.blocked_note,s.due_date=n.due_date,o=s,u=function(){return i.finish(),r.notify("success"),t.$broadcast("promote-"+c+"-to-us:success")},a=function(){return i.finish(),r.notify("error")},e.create("userstories",o).then(u,a)},o.on("click","a",function(t){var e,i,o,s,l;return t.preventDefault(),i=a.$modelValue,c=_.get({tasks:"task",issues:"issue"},i._name),e="COMMON.CONFIRM_PROMOTE."+c.toUpperCase(),l=n.instant(e+".TITLE"),o=n.instant(e+".MESSAGE"),s=i.subject,r.ask(l,s,o).then(function(t){return u(i,t)})}),i.$on("$destroy",function(){return o.off()})},{restrict:"AE",require:"ngModel",templateUrl:"components/promote-to-us/promote-to-us.html",link:i}},angular.module("taigaComponents").directive("tgPromoteToUsButton",["$rootScope","$tgRepo","$tgConfirm","$translate",t])}.call(this),function(){var t,e,r,n;e=angular.module("taigaComponents"),r=this.taiga.normalizeString,t=this.taiga.groupBy,n=function(e){var n;return n=function(n,i,o,s){var a,c,u,l,p,d,f;return n.templateUrl="components/search-list/search-list-"+n.itemType+"-choice.html",n.currentSelected=null,c=!1,a=[],l={},"issue"===n.itemType&&(n.milestonesById=t(n.project.milestones,function(t){return t.id})),n.filterClosed&&(n.showClosed=!1,"sprint"===n.itemType&&(n.textShowClosed=e.instant("BACKLOG.SPRINTS.ACTION_SHOW_CLOSED_SPRINTS"),n.textHideClosed=e.instant("BACKLOG.SPRINTS.ACTION_HIDE_CLOSED_SPRINTS"))),i.on("click",".choice",function(t){var e,r,i;return e=parseInt($(t.currentTarget).data("choice-id")),i=(null!=(r=o.ngModel)?r.id:void 0)!==e?l[e]:null,s.$setViewValue(i),n.currentSelected=i,n.$apply()}),u=function(t,e){return _.includes(p(e),p(t))},p=function(t){return"string"!=typeof t&&(t=t.toString()),r(t.toUpperCase())},f=function(){return n.currentSelected=null,s.$setViewValue(null)},d=function(){return f(),n.searchText="",a=angular.copy(n.items),l=t(a,function(t){return t.id})},n.isVisible=function(t){var e;return!(n.filterClosed&&!n.showClosed)||("sprint"!==n.itemType||!t.closed&&!t.is_closed||((null!=(e=n.currentSelected)?e.id:void 0)===t.id&&f(),!1))},n.toggleShowClosed=function(t){return n.showClosed=!n.showClosed},n.filterItems=function(t){if(n.filtering=!0,n.items=_.filter(a,function(e){var r;return r=e.getAttrs(),Array.isArray(n.filterBy)?_.some(n.filterBy,function(e){return u(t,r[e])}):u(t,r[n.filterBy])}),!_.find(n.items,n.currentSelected))return f()},n.$watch("items",function(t){if(!n.filtering&&t)return d()})},{link:n,templateUrl:"components/search-list/search-list.html",require:"ngModel",scope:{label:"@",placeholder:"@",project:"=",filterBy:"=",items:"=",itemType:"@",filterClosed:"=",itemDisabled:"="}}},e.directive("tgSearchList",["$translate",n])}.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(),$(r).parent().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.rootScope.$broadcast("tags: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","empty_extra_info"],["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,e){var r;return r=function(r,n,i){var o,s,a;if(e.hasPermission("modify_task"))return o=t(i.tgTasksSortable),s=dragula([n[0]],{copySortSource:!1,copy:!1,mirrorContainer:n[0],moves:function(t){return $(t).is("div.single-related-task.js-related-task")}}),s.on("dragend",function(t){var e,n,i;return e=$(t),i=e.scope().task,n=e.index(),r.$apply(function(){return o(r,{task: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"],angular.module("taigaComponents").directive("tgTasksSortable",t)}.call(this),function(){var t;t=function(t,e,r,n,i){var o;return o=function(t,e,r){return t.privacyPolicyUrl=n.get("privacyPolicyUrl"),t.termsOfServiceUrl=n.get("termsOfServiceUrl"),t.GDPRUrl=n.get("GDPRUrl")},{restrict:"AE",scope:{},controllerAs:"vm",controller:function(){return this.close=function(){var n,o,s;return t.open=!1,o=r.getUser(),void 0===o.read_new_terms&&(s=o.getAttrs(),s.read_new_terms=!1,o=i.make_model("users",s)),o.read_new_terms=!0,n=function(t){return r.setUser(t)},e.save(o).then(n)},Object.defineProperties(this,{open:{get:function(){return t.open}}})},link:o,templateUrl:"components/terms-announcement/terms-announcement.html"}},t.$inject=["tgTermsAnnouncementService","$tgRepo","$tgAuth","$tgConfig","$tgModel"],angular.module("taigaComponents").directive("tgTermsAnnouncement",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}return e(r,t),r.prototype.show=function(){return this.open=!0},r}(taiga.Service),angular.module("taigaComponents").service("tgTermsAnnouncementService",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"),e.target=!1,e.privacyPolicyUrl&&e.termsOfServiceUrl||(e.target=!0),r.on("change","input[name='accepted_terms']",function(t){var r;return r=angular.element(t.currentTarget),e.target=r.is(":checked"),e.$apply()})},{restrict:"AE",link:e,scope:{target:"="},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,e,r;e=this.taiga.timeout,t=angular.module("taigaComponents"),r=function(t,r){var n,i,o;return o=[{contentType:"icon",icon:"icon-project",message:"PROJECTS_ORDER"},{contentType:"icon",icon:"icon-upvote",message:"VOTING"},{contentType:"icon",icon:"icon-attach",message:"ISSUES_TO_SPRINT"},{contentType:"icon",icon:"icon-clock",message:"DUE_DATE"},{contentType:"icon",icon:"icon-iocaine",message:"IOCAIN"},{contentType:"icon",icon:"icon-blocked-project",message:"BLOCKED"},{contentType:"icon",icon:"icon-promote",message:"PROMOTE"},{contentType:"icon",icon:"icon-bulk",message:"BULK"},{contentType:"range",message:"ZOOM"},{contentType:"icon",icon:"icon-settings",message:"CUSTOM_FIELDS"},{contentType:"arrows",message:"SLIDE_ARROWS"}],i=function(t){return Math.floor(Math.random()*t)+1},n=function(r,n,s){var a,c;return r.tipLoaded=!1,c=null,t.onStart(function(){return c=e(1e3,function(){return a()})}),t.onEnd(function(){return clearTimeout(c),r.tipLoaded=!1}),a=function(){var t;return r.tipLoaded=!0,t=o[i(o.length-1)],r.tip={contentType:t.contentType,message:"TIPS.TIP_"+t.message,icon:t.icon,color:"tip-color-"+i(5)}}},{link:n,scope:!0,templateUrl:"components/tips/tip.html"}},t.directive("tgTips",["tgLoader","$translate",r])}.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(t){var e;return e=function(e,r,n){var i,o;return i={epics:"epic",userstories:"us",issues:"issue",tasks:"task"},o=function(r,n){return t.addAttachment(e.vm.projectId,e.vm.comment.comment.id,i[e.vm.comment.comment._name],r,!0,!0).then(function(t){return n(t.getIn(["file","name"]),t.getIn(["file","url"]))})},e.uploadFiles=function(t,e){var r,n,i,s;for(s=[],n=0,i=t.length;n\n \n \n"}},angular.module("taigaComponents").directive("tgCommentEditWysiwyg",["tgAttachmentsFullService",t])}.call(this),function(){var t;t=function(t,e,r){var n;return n=function(n,i,o){var s,a;return n.editableDescription=!1,n.saveComment=function(r,i){var o;return n.content="",n.vm.type.comment=r,o=t.save(function(t){}),o.then(function(){return n.vm.onAddComment&&n.vm.onAddComment(),e.$broadcast("object:updated")}),o["finally"](i)},s={epics:"epic",userstories:"us",issues:"issue",tasks:"task"},a=function(t,e){return r.addAttachment(n.vm.projectId,n.vm.type.id,s[n.vm.type._name],t,!0,!0).then(function(t){return e(t.getIn(["file","name"]),t.getIn(["file","url"]))})},n.onChange=function(t){return n.vm.type.comment=t},n.uploadFiles=function(t,e){var r,n,i,o;for(o=[],n=0,i=t.length;n\n \n \n"}},angular.module("taigaComponents").directive("tgCommentWysiwyg",["$tgQueueModelTransformation","$rootScope","tgAttachmentsFullService",t])}.call(this),function(){var t;t=function(t){var e;return e=function(e,r,n){var i,o;return i={userstories:"us",issues:"issue",tasks:"task"},o=function(r,n){return t.addAttachment(e.vm.projectId,e.vm.comment.comment.id,i[e.vm.comment.comment._name],r).then(function(t){return n(t.getIn(["file","name"]),t.getIn(["file","url"]))})},e.uploadFiles=function(t,e){var r,n,i,s;for(s=[],n=0,i=t.length;n\n \n \n"}},angular.module("taigaComponents").directive("tgCustomFieldEditWysiwyg",["tgAttachmentsFullService",t])}.call(this),function(){var t;t=function(t,e,r,n,i){var o;return o=function(i,o,s){var a;return i.editableDescription=!1,i.saveDescription=function(n,i){var o;return o=t.save(function(t){return t.description=n,t}),o.then(function(){return r.notify("success"),e.$broadcast("object:updated")}),o.then(null,function(){return r.notify("error")}),o["finally"](i)},a=function(t,e){return n.addAttachment(i.project.id,i.item.id,s.type,t).then(function(t){return e(t.getIn(["file","name"]),t.getIn(["file","url"]))})},i.uploadFiles=function(t,e){var r,n,i,o;for(o=[],n=0,i=t.length;n\n \n \n\n \n\n \n {{'COMMON.DESCRIPTION.NO_DESCRIPTION' | translate}}\n \n"}},angular.module("taigaComponents").directive("tgItemWysiwyg",["$tgQueueModelTransformation","$rootScope","$tgConfirm","tgAttachmentsFullService","$translate",t])}.call(this),function(){var t;t=function(){function t(){Prism.plugins.customClass.prefix("prism-"),Prism.plugins.customClass.map({})}return t.prototype.getLanguages=function(){return new Promise(function(t){return function(e,r){return t.languages?e(t.languages):t.loadPromise?t.loadPromise.then(function(){return e(t.languages)}):t.loadPromise=$.getJSON("/"+window._version+"/prism/prism-languages.json").then(function(r){return t.loadPromise=null,t.languages=_.map(r,function(t){return t.url="/"+window._version+"/prism/"+t.file,t}),e(t.languages)})}}(this))},t.prototype.getLanguageInClassList=function(t){var e;return e=_.find(this.languages,function(e){return!!_.find(t,function(t){return"language-"+e.name===t})}),e?e.name:null},t.prototype.loadLanguage=function(t){return new Promise(function(e){return Prism.languages[t]?e():ljs.load("/"+window._version+"/prism/prism-"+t+".min.js",e)})},t.prototype.replaceCodeBrToNl=function(t){return $(t).find("br").replaceWith("\n")},t.prototype.hightlightCode=function(t){var e;if(this.replaceCodeBrToNl(t),e=this.getLanguageInClassList(t.classList))return this.loadLanguage(e).then(function(){return Prism.highlightElement(t)})},t.prototype.addHightlighter=function(t){var e;return e=$(t).find("code"),e.each(function(t){return function(e,r){return t.hightlightCode(r)}}(this))},t}(),angular.module("taigaComponents").service("tgWysiwygCodeHightlighterService",t)}.call(this),function(){var t;t=function(t){var e;return e=function(e,r,n,i){return e.$watch("visible",function(n){return n&&!r.hasClass("open")?(e.open=!0,t.open(r,null,e.onClose),e.$applyAsync(function(){var t;if(t=r[0].querySelector("textarea"))return t.select()})):!n&&r.hasClass("open")?(e.open=!1,t.close(r)):void 0})},{scope:{languages:"<",codeLanguage:"<",code:"<",visible:"<",onClose:"&",onSave:"&"},link:e,templateUrl:"components/wysiwyg/wysiwyg-code-lightbox/wysiwyg-code-lightbox.html"}},angular.module("taigaComponents").directive("tgWysiwygCodeLightbox",["lightboxService",t])}.call(this),function(){var t;t=function(){function t(t,e,r,n){this.projectService=t,this.wysiwygService=e,this.navurls=r,this.rs=n,this.cancelablePromise=null,this.projectSlug=this.projectService.project.get("slug")}return t.$inject=["tgProjectService","tgWysiwygService","$tgNavUrls","$tgResources"],t.prototype.search=function(t){return new Promise(function(e){return function(r){return"#".indexOf(t[0])!==-1?e.searchItem(t.replace("#","")).then(r):"@".indexOf(t[0])!==-1?e.searchUser(t.replace("@",""),r):":".indexOf(t[0])!==-1?e.searchEmoji(t.replace(":",""),r):void 0}}(this))},t.prototype.searchItem=function(t){return new Promise(function(e){return function(r,n){var i;return t=taiga.slugify(t),i=function(e){return["subject","ref"].some(function(r){return taiga.slugify(e[r]).indexOf(t)>=0})},e.rs.search["do"](e.projectService.project.get("id"),t).then(function(t){var n,o,s,a,c,u,l;if(c=[],t.count&&t.count!==t.wikipages.length){for(l={issues:"project-issues-detail",userstories:"project-userstories-detail",tasks:"project-tasks-detail"},a=["issues","tasks","userstories"],n=0,s=a.length;n=0||e[r].indexOf(t)>=0})}),r=r.slice(0,10).map(function(t){return function(e){return e.url=t.navurls.resolve("user-profile",{project:t.projectSlug,username:e.username}),e}}(this)),e(r)},t.prototype.searchEmoji=function(t,e){var r;return r=this.wysiwygService.searchEmojiByName(t),r=r.slice(0,10),e(r)},t}(),angular.module("taigaComponents").service("tgWysiwygMentionService",t)}.call(this),function(){var t,e,r;r=this.taiga,e=this.taiga.bindOnce,t=function(t,e,n,i,o,s,a,c,u,l){var p,d,f,h,g,m,v,y,b,S,j,k;return k=function(){if(window.getSelection){if(window.getSelection().empty)return window.getSelection().empty()}else{if(window.getSelection().removeAllRanges)return window.getSelection().removeAllRanges();if(document.selection)return document.selection.empty()}},m=function(t){return $(t.endContainer).parentsUntil(".editor","code")},v=function(t){return!!m(t).length},j=function(t,e){var r,n,i;return r=$(t).is("code")?t:$(t).closest("code")[0],i=r.parentNode,n=document.createElement("p"),n.innerText=r.innerText,i.parentNode.replaceChild(n,i),e.checkContentChanged(e.elements[0])},h=function(t,e){var r,n,i,o;return i=document.createElement("pre"),r=document.createElement("code"),t.startContainer.parentNode.nextSibling||$("
").insertAfter(t.startContainer.parentNode),o=t.endContainer.parentNode.nextSibling,n=t.extractContents(),r.appendChild(n),i.appendChild(r),o.parentNode.insertBefore(i,o),S(e),e.checkContentChanged(e.elements[0])},S=function(e){var r,n,i,o,s,a,c,u,l,p;if(e){for(l=e.elements[0].children,r=0,i=l.length;rRTL",this.button.title="RTL",this.on(this.button,"click",this.handleClick.bind(this))},getButton:function(){return this.button},handleClick:function(t){var e;return e=MediumEditor.selection.getSelectionRange(document),"right"===e.commonAncestorContainer.parentNode.style.textAlign?document.execCommand("justifyLeft",!1):document.execCommand("justifyRight",!1)}}),g=function(t){return'\n \n'},d=MediumEditor.extensions.button.extend({name:"code",init:function(){var t;return t=_.find(this.base.options.toolbar.buttons,function(t){return"code"===t.name}),this.button=this.document.createElement("button"),this.button.classList.add("medium-editor-action"), this.button.innerHTML=t.contentDefault||"Code",this.button.title="Code",this.on(this.button,"click",this.handleClick.bind(this))},getButton:function(){return this.button},tagNames:["code"],handleClick:function(t){var e,r;if(e=MediumEditor.selection.getSelectionRange(self.document),v(e,this.base)?j(e.endContainer,this.base):(h(e,this.base),k()),r=this.base.getExtensionByName("toolbar"))return r.hideToolbar()}}),f=MediumEditor.extensions.paste.extend({doPaste:function(t,e,r){var n;return n=MediumEditor.util.htmlEntities(e),MediumEditor.util.insertHTMLCommand(this.document,n)}}),b=MediumEditor.util.isBlockContainer,MediumEditor.util.isBlockContainer=function(t){var e;return t?(e=t.tagName?t.tagName:t.parentNode.tagName,"code"===e.toLowerCase()||b(t)):b(t)},y=function(o,h,m){var v,y,b,k,I,T,E,C,P,w,A,O,R,M,U,N,D,x,L,F,B,H;return R=null,E=h.find(".medium"),T=h.find(".markdown"),b=null,w=!!m.$attr.editonly,M=!!m.$attr.notPersist,o.required=!!m.$attr.required,o.editMode=w||!1,o.mode=n.get("editor-mode","html"),o.markdown="",o.codeEditorVisible=!1,o.codeLans=[],a.getLanguages().then(function(t){return o.codeLans=t}),D=function(t){return o.editMode=t},x=function(t){var e;if(e=i.getHTML(t),E.html(e),a.addHightlighter(R.elements[0]),o.editMode)return S(R)},o.saveSnippet=function(t,e){var r;return o.codeEditorVisible=!1,b.innerText=e,r=b.parentNode,"remove-formating"===t?(b.className="",r.className="",j(b,R)):_.trim(e).length?(t?(b.className="language-"+t,r.className="language-"+t):(b.className="",r.className=""),a.hightlightCode(b),R.checkContentChanged(R.elements[0])):(b.parentNode.parentNode.removeChild(b.parentNode),R.checkContentChanged(R.elements[0])),L(),null},o.setMode=function(t){return n.set("editor-mode",t),"markdown"===t?B():x(o.markdown),o.mode=t,R.trigger("editableBlur",{},E[0])},o.save=function(t){t&&t.preventDefault(),"html"===o.mode&&B(),x(o.markdown),o.required&&!o.markdown.length||(o.saving=!0,o.outdated=!1,o.onSave({text:o.markdown,cb:N}))},o.cancel=function(t){t&&t.preventDefault(),w||D(!1),M?y():"html"===o.mode&&x(o.content||null),o.markdown=o.content,I(),R.trigger("blur",{},E[0]),o.outdated=!1,S(R),o.onCancel()},y=function(){return o.markdown="",E.html("")},N=function(){return o.saving=!1,w||D(!1),M&&y(),I(),R.trigger("blur",{},E[0]),u.trackEvent("develop","save wysiwyg",o.mode,1)},H=function(t,e){return r.isImage(t)?R.pasteHTML("
"):(t=$("
").text(t).html(),R.pasteHTML(""+t+"
"))},A=function(){var t;return t=n.get(o.storageKey),!(!t||!t.version||t.version===o.version)},P=function(){var t;return t=n.get(o.storageKey),!!t},C=function(){var t;return t=n.get(o.storageKey),t?t.text:o.content},I=function(){return n.remove(o.storageKey)},o.cancelWithConfirmation=function(){var r,n;return o.content===o.markdown?(o.cancel(),document.activeElement.blur(),document.body.click(),null):(n=t.instant("COMMON.CONFIRM_CLOSE_EDIT_MODE_TITLE"),r=t.instant("COMMON.CONFIRM_CLOSE_EDIT_MODE_MESSAGE"),e.ask(n,null,r).then(function(t){return o.cancel(),t.finish()}))},U=function(){var t;return t=$("
").html(E.html()),t.find("code br").replaceWith("\n"),t.html()},B=function(){var t;return t=U(),o.markdown=i.getMarkdown(t)},O=function(t){var e;if(o.storageKey)return e={},e.version=o.version||0,e.text=t,n.set(o.storageKey,e)},v=function(){return"html"===o.mode&&B(),O(o.markdown),o.onChange({markdown:o.markdown})},L=_.throttle(v,200),k=function(t,e){var r;return null==e&&(e=!1),t.length&&(r=i.getHTML(t),E.html(r)),R=new MediumEditor(E[0],{imageDragging:!1,placeholder:{text:o.placeholder},toolbar:{buttons:[{name:"bold",contentDefault:g("editor-bold")},{name:"italic",contentDefault:g("editor-italic")},{name:"strikethrough",contentDefault:g("editor-cross-out")},{name:"anchor",contentDefault:g("editor-link")},{name:"image",contentDefault:g("editor-image")},{name:"orderedlist",contentDefault:g("editor-list-n")},{name:"unorderedlist",contentDefault:g("editor-list-o")},{name:"h1",contentDefault:g("editor-h1")},{name:"h2",contentDefault:g("editor-h2")},{name:"h3",contentDefault:g("editor-h3")},{name:"quote",contentDefault:g("editor-quote")},{name:"removeFormat",contentDefault:g("editor-no-format")},{name:"rtl",contentDefault:g("editor-rtl")},{name:"code",contentDefault:g("editor-code")}]},extensions:{paste:new f,code:new d,autolist:new AutoList,alignright:new p,mediumMention:new MentionExtension({getItems:function(t,e){return c.search(t).then(e)}})}}),o.changeMarkdown=L,R.subscribe("editableInput",function(t){return o.$applyAsync(L)}),R.subscribe("editableClick",function(t){var e;if(e=new RegExp("^(?:[a-z]+:)?//","i"),t.target.href)return e.test(t.target.getAttribute("href"))||"_blank"===t.target.getAttribute("target")?(t.stopPropagation(),window.open(t.target.href)):l.url(t.target.href)}),R.subscribe("editableDrop",function(t){return o.onUploadFile({files:t.dataTransfer.files,cb:H})}),R.subscribe("editableKeydown",function(t){var e,r;return e=t.keyCode?t.keyCode:t.which,r=$(".medium-mention"),40!==e&&38!==e||!r.length?o.editMode&&27===e?(t.stopPropagation(),o.$applyAsync(o.cancelWithConfirmation)):27===e?E.blur():void 0:(t.stopPropagation(),void t.preventDefault())}),D(e),o.$applyAsync(function(){return a.addHightlighter(R.elements[0]),S(R)})},$(E[0]).on("mousedown",function(t){return t.target.href?(t.preventDefault(),t.stopPropagation()):o.$applyAsync(function(){if(!o.editMode)return D(!0),S(R)})}),$(E[0]).on("dblclick","pre",function(t){return o.$applyAsync(function(){return o.codeEditorVisible=!0,b=t.currentTarget.querySelector("code"),o.currentCodeLanguage=a.getLanguageInClassList(b.classList),o.code=b.innerText})}),F=o.$watch("content",function(t){var e;if(!_.isUndefined(t)){if(o.outdated=A(),!R&&P()&&D(!0),(o.markdown.length||t.length)&&o.markdown===t)return;return t=C(),o.markdown=t,R&&R.destroy(),s.open()?e=s.onEnd(function(){return k(t,o.editMode),e()}):k(t,o.editMode),F()}}),o.$on("$destroy",function(){if(R)return E.length&&$(E[0]).off(),R.destroy()})},{templateUrl:"common/components/wysiwyg-toolbar.html",scope:{placeholder:"@",version:"<",storageKey:"<",content:"<",onCancel:"&",onSave:"&",onUploadFile:"&",onChange:"&"},link:y}},angular.module("taigaComponents").directive("tgWysiwyg",["$translate","$tgConfirm","$tgStorage","tgWysiwygService","animationFrame","tgLoader","tgWysiwygCodeHightlighterService","tgWysiwygMentionService","$tgAnalytics","$location",t])}.call(this),function(){var t;t=function(){function t(t,e,r,n){this.wysiwygCodeHightlighterService=t,this.projectService=e,this.navurls=r,this.emojis=n}return t.$inject=["tgWysiwygCodeHightlighterService","tgProjectService","$tgNavUrls","$tgEmojis"],t.prototype.searchEmojiByName=function(t){return this.emojis.searchByName(t)},t.prototype.pipeLinks=function(t){return t.replace(/\[\[(.*?)\]\]/g,function(t,e,r,n){var i,o,s;return o=e.split("|"),i=o[0],s=o[1]||o[0],"["+s+"]("+i+")"})},t.prototype.replaceUrls=function(t){var e,r,n,i,o;for(e=document.createElement("html"),e.innerHTML=t,o=e.querySelectorAll("a"),r=0,n=o.length;r(.*?)
<\/li>/g,"
  • $1
  • ")},t.prototype.getMarkdown=function(t){var e,r,n;return e={filter:["html","body","span","div"],replacement:function(t){return t}},r={filter:function(t){return function(t){return"PRE"===t.nodeName&&t.firstChild&&"CODE"===t.firstChild.nodeName}}(this),replacement:function(t){return function(e,r){var n;return n=t.wysiwygCodeHightlighterService.getLanguageInClassList(r.firstChild.classList),n||(n=""),"\n\n```"+n+"\n"+_.trim(r.firstChild.textContent)+"\n```\n\n"}}(this)},t=t.replace(/ (<\/.*>)/g,"$1"),t=this.emojis.replaceImgsByEmojiName(t),t=this.replaceUrls(t),t=this.removeTrailingListBr(t),n=toMarkdown(t,{gfm:!0,converters:[e,r]})},t.prototype.parseMentionMatches=function(t){var e,r,n,i,o,s,a;for(s="twitter",a=this.tagBuilder,r=[],o=/@[^\s]{1,50}[^.\s]/g,e=o.exec(t);null!==e;)n=e.index,i=t.charAt(n-1),e.index===o.lastIndex&&o.lastIndex++,e.forEach(function(t,e){return r.push(new Autolinker.match.Mention({tagBuilder:a,matchedText:t,offset:n,serviceName:s,mention:t.slice(1)}))}),e=o.exec(t);return r},t.prototype.autoLinkHTML=function(t){var e,r;return r=String(Autolinker.matcher.Mention.prototype.matcherRegexes.twitter),r.indexOf(".")===-1&&(r="@[^s]{1,50}[^.s]"),e=new Autolinker({mention:"twitter",hashtag:"twitter",replaceFn:function(t){return function(e){var r,n;return"mention"===e.getType()?(r=t.navurls.resolve("user-profile",{project:t.projectService.project.get("slug"),username:e.getMention()}),'@'+e.getMention()+""):"hashtag"===e.getType()?(n=t.navurls.resolve("project-detail-ref",{project:t.projectService.project.get("slug"),ref:e.getHashtag()}),'#'+e.getHashtag()+""):void 0}}(this)}),Autolinker.matcher.Mention.prototype.parseMatches=this.parseMentionMatches.bind(e),e.link(t)},t.prototype.getHTML=function(t){var e,r,n;return t&&t.length?(r={breaks:!0},t=this.emojis.replaceEmojiNameByImgs(t),t=this.pipeLinks(t),e=window.markdownit({breaks:!0}),e.use(window.markdownitLazyHeaders),n=e.render(t),n=this.searchWikiLinks(n),n=this.autoLinkHTML(n)):""},t}(),angular.module("taigaComponents").service("tgWysiwygService",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,o,s){var a,c;this.routeParams=t,this.discoverProjectsService=e,this.route=r,this.location=n,this.analytics=i,this.appMetaService=o,this.translate=s,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,c=this.translate.instant("DISCOVER.SEARCH.PAGE_TITLE"),a=this.translate.instant("DISCOVER.SEARCH.PAGE_DESCRIPTION"),this.appMetaService.setAll(c,a),this.analytics.trackPage(this.location.url(),"Discover Search")}return t.$inject=["$routeParams","tgDiscoverProjectsService","$route","$tgLocation","$tgAnalytics","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.analytics.trackPage(this.location.url(),"Discover Search"),this.fetchByGlobalSearch()},t.prototype.onChangeOrder=function(t){return this.orderBy=t,this.route.updateParams({order_by:t}),this.analytics.trackPage(this.location.url(),"Discover Search"),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,i){this.confirm=t,this.projectService=r,this.epicsService=n,this.analytics=i,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","$tgAnalytics"],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.analytics.trackEvent("epic","create","create epic",1),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;return this.epic.getIn(["status_extra_info","is_closed"])===!0?this.percentage="100%":(t=this.epic.getIn(["user_stories_counts","progress"]),e=this.epic.getIn(["user_stories_counts","total"]),0===e?this.percentage="0%":this.percentage=100*t/e+"%")},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:"=",options:"="}}},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,c,u){this.params=t,this.errorHandlingService=r,this.lightboxFactory=n,this.lightboxService=i,this.confirm=o,this.projectService=s,this.epicsService=a,this.appMetaService=c,this.translate=u,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,r;r=this.taiga,e=this.taiga.generateHash,t=function(){function t(t,n,i,o,s){this.confirm=t,this.epicsService=n,this.timeout=i,this.storage=o,this.projectService=s,this.hash=e([this.projectService.project.get("id"),"epics"]),this.displayOptions=!1,this.displayVotes=!0,this.options=this.storage.get(this.hash,{votes:!0,name:!0,project:!0,sprint:!0,assigned:!0,status:!0,progress:!0,closed:!0,closed_us:!0}),r.defineImmutableProperty(this,"epics",function(t){return function(){return t.epicsService.epics}}(this)),r.defineImmutableProperty(this,"disabledEpicsPagination",function(t){return function(){return t.epicsService._disablePagination}}(this)),r.defineImmutableProperty(this,"loadingEpics",function(t){return function(){return t.epicsService._loadingEpics}}(this))}return t.$inject=["$tgConfirm","tgEpicsService","$timeout","$tgStorage","tgProjectService"],t.prototype.toggleEpicTableOptions=function(){return this.displayOptions=!this.displayOptions},t.prototype.reorderEpic=function(t,e){return t.get("epics_order")===e?null:this.epicsService.reorderEpic(t,e).then(null,function(t){return function(){return t.confirm.notify("error")}}(this))},t.prototype.nextPage=function(){return this.epicsService.nextPage()},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.prototype.updateViewOptions=function(){return this.storage.set(this.hash,this.options)},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:"=",options:"="}}},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.clear(),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._loadingEpics=!1,this._disablePagination=!1,this._page=1,this._epics=Immutable.List()},t.prototype.fetchEpics=function(t){return null==t&&(t=!1),this._loadingEpics=!0,this._disablePagination=!0,this.resources.epics.list(this.projectService.project.get("id"),this._page).then(function(e){return function(r){return t?(e.clear(),e._epics=r.list):e._epics=e._epics.concat(r.list),e._loadingEpics=!1,e._disablePagination=!r.headers("x-pagination-next")}}(this))["catch"](function(t){return function(e){return t.xhrError.response(e)}}(this))},t.prototype.nextPage=function(){return this._page++,this.fetchEpics(); },t.prototype.listRelatedUserStories=function(t){return this.resources.userstories.listInEpic(t.get("id"))},t.prototype.createEpic=function(t,e,r){return r?t.project=r:t.project=this.projectService.project.get("id"),this.resources.epics.post(t).then(function(t){return function(r){var n;return e?(n=_.map(e.toJS(),function(e){return t.attachmentsService.upload(e.file,r.get("id"),r.get("project"),"epic")}),Promise.all(n).then(t.fetchEpics.bind(t,!0))):r}}(this))},t.prototype.reorderEpic=function(t,e){var r,n,i,o,s,a,c,u,l;return s={},this._epics.forEach(function(t){return s[t.get("id")]=t.get("epics_order")}),l=this.epics.filter(function(e){return function(e){return e.get("id")!==t.get("id")}}(this)),n=l.slice(0,e),r=l.slice(e),a=n.last(),o=a?a.get("epics_order")+1:0,s[t.get("id")]=o,c=n.filter(function(t){return function(t){return t.get("epics_order")===a.get("epics_order")}}(this)),u=_.fromPairs(c.map(function(t){return function(t){return[t.get("id"),t.get("epics_order")]}}(this)).toJS()),r.forEach(function(t){return s[t.get("id")]=t.get("epics_order")+1}),this._epics=this._epics.map(function(t){return t.set("epics_order",s[t.get("id")])}),this._epics=this._epics.sortBy(function(t){return t.get("epics_order")}),i={epics_order:o,version:t.get("version")},this.resources.epics.reorder(t.get("id"),i,u).then(function(t){return function(e){return t._epics=t._epics.map(function(t){return t.get("id")===e.get("id")?e:t})}}(this))},t.prototype.reorderRelatedUserstory=function(t,e,r,n){var i,o,s,a,c,u,l,p,d;return d=e.filter(function(t){return function(t){return t.get("id")!==r.get("id")}}(this)),i=d.slice(0,n),c=i.last(),a=c?c.get("epic_order")+1:0,u=i.filter(function(t){return function(t){return t.get("epic_order")===c.get("epic_order")}}(this)),l=_.fromPairs(u.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.replaceEpic=function(t){return this._epics=this._epics.map(function(e){return e.get("id")===t.get("id")?t:e})},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(this.replaceEpic.bind(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(this.replaceEpic.bind(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("view_epics")||(null!=(t=this.userstories)?t.length: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=null,this.projectUserstories=Immutable.List(),this.loading=!1}return t.$inject=["tgCurrentUserService","tgResources","$tgConfirm","$tgAnalytics"],t.prototype.loadProjects=function(){if(null===this.projects)return this.projects=this.currentUserService.projects.get("unblocked")},t.prototype.filterUss=function(t,e){var r;return r=this.rs.userstories.listInAllProjects({project:t,q:e},!0).then(function(t){return function(e){var r,n;return r=t.epicUserstories.map(function(t){return t.get("id")}),n=e.filter(function(t){return r.indexOf(t.get("id"))===-1}),t.projectUserstories=n}}(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,r;r=angular.module("taigaEpics"),e=this.taiga.debounceLeading,t=function(t){var r;return this.lightboxService=t,r=function(t,r,n,i){var o,s;return s=r.find(".new-user-story-form").checksley(),o=r.find(".existing-user-story-form").checksley(),i.validateNewUserstoryForm=function(t){return function(){return s.validate()}}(this),i.setNewUserstoryFormErrors=function(t){return function(t){return s.setErrors(t)}}(this),i.validateExistingUserstoryForm=function(t){return function(){return o.validate()}}(this),i.setExistingUserstoryFormErrors=function(t){return function(t){return o.setErrors(t)}}(this),t.showLightbox=function(e){return i.loadProjects(),t.selectProject(e).then(function(t){return function(){return lightboxService.open(r.find(".lightbox-create-related-user-stories"))}}(this))},t.closeLightbox=function(){return t.selectedUserstory=null,t.searchUserstory="",t.relatedUserstoriesText="",lightboxService.close(r.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="",i.filterUss(e,t.searchUserstory)},t.onUpdateSearchUserstory=e(300,function(){return t.selectedUserstory=null,i.filterUss(t.selectedProject,t.searchUserstory)})},{link:r,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"],r.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("LIGHTBOX.REMOVE_RELATIONSHIP_WITH_EPIC.TITLE"),t=this.translate.instant("LIGHTBOX.REMOVE_RELATIONSHIP_WITH_EPIC.MESSAGE",{epicSubject:this.epic.get("subject")}),this.confirm.ask(e,null,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,c,u){var l,p;this.routeParams=t,this.externalAppsService=n,this.window=i,this.currentUserService=o,this.location=s,this.navUrls=a,this.xhrError=c,this.loader=u,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=this.taiga,t=function(){function t(t,e){this.rs=t,this.xhrError=e,this._contentType=null,this._objectId=null,this.clear()}return t.$inject=["tgResources","tgXhrErrorService"],t.prototype.clear=function(){return this.page=1,this.loadingEntries=!1,this.disablePagination=!1,this.entries=Immutable.List(),this.count=null},t.prototype.fetchEntries=function(t){return null==t&&(t=!1),t&&(this.page=1),this.loadingEntries=!0,this.disablePagination=!0,this.rs.history.getHistory("activity",this._contentType,this._objectId,this.page).then(function(e){return function(r){return t?(e.clear(),e.entries=r.list):e.entries=e.entries.concat(r.list),e.loadingEntries=!1,e.disablePagination=!r.headers("x-pagination-next"),e.count=r.headers("x-pagination-count"),e.entries}}(this))["catch"](function(t){return function(e){return t.xhrError.response(t.entries)}}(this))},t.prototype.nextPage=function(t){return null==t&&(t="comment"),this.page++,this.fetchEntries()},t.prototype.init=function(t,e){return this._contentType=t,this._objectId=e,this.clear()},t}(),angular.module("taigaHistory").service("tgActivityService",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}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.saveComment=function(t,e){return this.onEditComment({commentId:this.comment.id,commentData:t,callback:e})},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;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}},t.$inject=["lightboxService"],angular.module("taigaHistory").directive("tgLbDisplayHistoric",t)}.call(this),function(){var t;t=function(){return{scope:{entry:"<"},templateUrl:"history/history-lightbox/history-entry.html"}},angular.module("taigaHistory").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,i){this.rs=t,this.repo=e,this.storage=r,this.projectService=n,this.activityService=i,this.editing=null,this.deleting=null,this.editMode={},this.viewComments=!0,this.reverse=this.storage.get("orderComments"),taiga.defineImmutableProperty(this,"disabledActivityPagination",function(t){return function(){return t.activityService.disablePagination}}(this)),taiga.defineImmutableProperty(this,"loadingActivity",function(t){return function(){return t.activityService.loading}}(this))}return t.$inject=["$tgResources","$tgRepo","$tgStorage","tgProjectService","tgActivityService"],t.prototype._loadHistory=function(){return this._loadComments(),this._loadActivity()},t.prototype._loadActivity=function(){return this.activityService.init(this.name,this.id),this.activityService.fetchEntries().then(function(t){return function(e){return t.activitiesNum=t.activityService.count,t.activities=e.toJS()}}(this))},t.prototype._loadComments=function(){return this.rs.history.get(this.name,this.id).then(function(t){return function(e){return t.comments=_.filter(e,function(t){return""!==t.comment}),t.reverse&&t.comments-_.reverse(t.comments),t.commentsNum=t.comments.length}}(this))},t.prototype.nextActivityPage=function(){return this.activityService.nextPage().then(function(t){return function(e){return t.activities=e.toJS()}}(this))},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(t){return function(){return t._loadComments(),t.deleting=null}}(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._loadComments(),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._loadComments(),t.editing=null}}(this))},t.prototype.addComment=function(){return this.editMode={},this.editing=null,this._loadComments()},t.prototype.onOrderComments=function(){return this.reverse=!this.reverse,this.storage.set("orderComments",this.reverse),this._loadComments()},t}(),e.controller("HistorySection",t)}.call(this),function(){var t,e,r;r=angular.module("taigaHistory"),e=this.taiga.bindOnce,t=function(){var t;return t=function(t,e,r,n){return t.$on("object:updated",function(){return n._loadActivity()}),t.$watch("vm.id",function(t){return n._loadHistory()})},{link:t,templateUrl:"history/history.html",controller:"HistorySection",controllerAs:"vm",bindToController:!0,scope:{type:"=",name:"@",id:"=",projectId:"="}}},t.$inject=[],r.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,c,u,l,p,d,f,h,g,m,v,y;return p=Immutable.Map(),d=this.projectsService.getProjectsByUserId(t).then(function(t){return p=Immutable.fromJS(e(t.toJS(),function(t){return t.id}))}),o=Immutable.Map(),a={status__is_closed:!1,assigned_to:t},l={is_closed:!1,assigned_users:t},u={status__is_closed:!1,assigned_to:t},c={status__is_closed:!1,assigned_to:t},r=this.rs.epics.listInAllProjects(a).then(function(t){return o=o.set("epics",t)}),s=this.rs.userstories.listInAllProjects(l).then(function(t){return o=o.set("userStories",t)}),i=this.rs.tasks.listInAllProjects(u).then(function(t){return o=o.set("tasks",t)}),n=this.rs.issues.listInAllProjects(c).then(function(t){return o=o.set("issues",t)}),a={status__is_closed:!1,watchers:t},l={is_closed:!1,watchers:t},u={status__is_closed:!1,watchers:t},c={status__is_closed:!1,watchers:t},f=Immutable.Map(),h=this.rs.epics.listInAllProjects(a).then(function(t){return f=f.set("epics",t)}),v=this.rs.userstories.listInAllProjects(l).then(function(t){return f=f.set("userStories",t)}),m=this.rs.tasks.listInAllProjects(u).then(function(t){return f=f.set("tasks",t)}),g=this.rs.issues.listInAllProjects(c).then(function(t){return f=f.set("issues",t)}),y=Immutable.Map(),Promise.all([d,r,h,s,v,i,m,n,g]).then(function(t){return function(){return y=y.set("assignedTo",o),y=y.set("watching",f),y=t._attachProjectInfoToWorkInProgress(y,p)}}(this))},n}(taiga.Service),angular.module("taigaHome").service("tgHomeService",t)}.call(this),function(){var t;t=function(t){var e,r;return r=function(e,r,n,i){return e.vm={},taiga.defineImmutableProperty(e.vm,"projects",function(){return t.projects.get("recents")})},e={templateUrl:"home/projects/home-project-list.html",scope:{},link:r}},t.$inject=["tgCurrentUserService"],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,e;e=this.taiga,t=function(){function t(t,e,r,n,i){this.projectService=t,this.rs=e,this.lightboxService=r,this.confirm=n,this.rootScope=i,this.project=this.projectService.project,this.roles=this.projectService.project.get("roles"),this.rolesValues={},this.loading=!1,this.defaultMaxInvites=4}return t.$inject=["tgProjectService","$tgResources","lightboxService","$tgConfirm","$rootScope"],t.prototype._areRolesValidated=function(){return Object.defineProperty(this,"areRolesValidated",{get:function(t){return function(){var e;return e=_.filter(Object.values(t.rolesValues),function(t){return t}),e.length===t.contactsToInvite.size+t.emailsToInvite.size}}(this)})},t.prototype._checkLimitMemberships=function(){var t;return null===this.project.get("max_memberships")?this.membersLimit=this.defaultMaxInvites:(t=Math.max(this.project.get("max_memberships")-this.project.get("total_memberships"),0),this.membersLimit=Math.min(t,this.defaultMaxInvites)),this.showWarningMessage=this.membersLimitn.total?(n.newEvent=!0,e(100,function(){return n.total=r,n.$apply()}),e(2e3,function(){return n.newEvent=!1})):n.total=r}),n.$on("notifications:loading",function(){return n.loading=!0}),n.setAllAsRead=function(){return r.setNotificationsAsRead().then(function(){return t.$emit("notifications:dismiss-all")})}},i={templateUrl:"navigation-bar/dropdown-notifications/dropdown-notifications.html",scope:{active:"="},link:o}},angular.module("taigaNavigationBar").directive("tgDropdownNotifications",["$rootScope","tgNotificationsService","tgCurrentUserService",t])}.call(this),function(){var t;t=function(t,e,r){var n,i;return i=function(n,i,o,s){var a;return n.vm={},taiga.defineImmutableProperty(n.vm,"projects",function(){return e.projects.get("recents")}),n.vm.newProject=function(){return r.newProject()},a=function(){return i.find(".dropdown-project-list ul li a").data("fullUrl","")},t.$on("dropdown-project-list:updated",a)},n={templateUrl:"navigation-bar/dropdown-project-list/dropdown-project-list.html",scope:{active:"="},link:i}},t.$inject=["$rootScope","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,c,u){return s.vm={},s.vm.isFeedbackEnabled=e.get("feedbackEnabled"),s.vm.customSupportUrl=e.get("supportUrl"),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,c){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.customSupportUrl=i.get("supportUrl"),o.vm.login=function(){var t;return t=encodeURIComponent(r.url()),r.url(n.resolve("login")),r.search({next:t})},o.$on("$routeChangeSuccess",function(){switch(o.vm.active=null,r.path()){case"/":return o.vm.active="dashboard";case"/discover":return o.vm.active="discover";case"/notifications":return o.vm.active="notifications";case"/projects/":return o.vm.active="projects"}})},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(){return{templateUrl:"notifications/notifications-list/notifications-list.html",controller:"Notifications",controllerAs:"vm",bindToController:!0,scope:{infiniteScrollContainer:"@",infiniteScrollDistance:"=",onlyUnread:"=onlyUnread"}}},angular.module("taigaNotifications").directive("tgNotificationsList",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,r=this.taiga.mixOf,e=this.taiga.debounceLeading,t=function(t){function e(t,e,r,n,i,o,s){this.rootScope=t,this.scope=e,this.notificationsService=r,this.currentUserService=n,this.events=i,this.location=o,this.window=s,this.total=0,this.user=this.currentUserService.getUser(),this.scrollDisabled=!1,this.initList(),this.loadNotifications(),this.rootScope.$on("notifications:dismiss",function(t){return function(e){if(t.onlyUnread)return t.reloadList()}}(this)),this.rootScope.$on("notifications:new",function(t){return function(e){return t.reloadList()}}(this)),this.rootScope.$on("notifications:dismiss-all",function(t){return function(e){return t.reloadList()}}(this))}return i(e,t),e.$inject=["$rootScope","$scope","tgNotificationsService","tgCurrentUserService","$tgEvents","$location","$window"],e.prototype.initList=function(){return this.notificationsList=Immutable.List(),this.list=this.notificationsService.getNotificationsList(this.user.get("id"),null!=this.onlyUnread),this.loading=null==this.list},e.prototype.reloadList=function(){return this.initList(),this.loadNotifications()},e.prototype.loadNotifications=function(){return this.scrollDisabled=!0,this.loading=!0,this.scope.$emit("notifications:loading"),this.list.next().then(function(t){return function(e){return t.notificationsList=t.notificationsList.concat(e.get("items")),e.get("next")&&(t.scrollDisabled=!1),t.total=e.get("total"),t.scope.$emit("notifications:loaded",t.total),t.loading=!1,t.notificationsList}}(this))},e.prototype.setAsRead=function(t,e){return this.notificationsService.setNotificationAsRead(t.get("id")).then(function(t){return function(){return t.location.$$url===e?t.window.location.reload():t.location.path(e),t.rootScope.$broadcast("notifications:dismiss")}}(this))},e.prototype.setAllAsRead=function(){return this.notificationsService.setNotificationsAsRead().then(function(t){return function(){return t.rootScope.$broadcast("notifications:dismiss-all")}}(this))},e}(r(n.Controller,n.PageMixin,n.FiltersMixin)),angular.module("taigaNotifications").controller("Notifications",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,n,i){this.rs=t,this.userTimelinePaginationSequenceService=e,this.translate=r,this.navUrls=n,this.tgSections=i}var n,i;return r(e,t),e.$inject=["tgResources","tgUserTimelinePaginationSequenceService","$translate","$tgNavUrls","$tgSections"],n=[{check:function(t){return 1===t.get("event_type")},key:"EVENTS.ASSIGNED_YOU",translate_params:["username","obj_name"]},{check:function(t){return 2===t.get("event_type")},key:"EVENTS.MENTIONED_YOU",translate_params:["username","obj_name"]},{check:function(t){return 3===t.get("event_type")},key:"EVENTS.ADDED_YOU_AS_WATCHER",translate_params:["username","obj_name"]},{check:function(t){return 4===t.get("event_type")},key:"EVENTS.ADDED_YOU_AS_MEMBER",translate_params:["username"]},{check:function(t){return 5===t.get("event_type")},key:"EVENTS.COMMENTED",translate_params:["username","obj_name"]},{check:function(t){return 6===t.get("event_type")},key:"EVENTS.MENTIONED_YOU_IN_COMMENT",translate_params:["username","obj_name"]}],i={username:function(t){var e,r,n;return n=t.getIn(["data","user"]),n.get("is_profile_visible")?(e=this.translate.instant("COMMON.SEE_USER_PROFILE",{username:n.get("username")}),r=this.navUrls.resolve("user-profile",{username:t.getIn(["data","user","username"])}),this._getLink(t,r,n.get("name"),"user-link",e)):this._getUsernameSpan(n.get("name"))},project_name:function(t){var e;return e=this.navUrls.resolve("project",{project:t.getIn(["data","project","slug"])}),this._getLink(t,e,t.getIn(["data","project","name"]),"project-link")},obj_name:function(t){var e,r,n;return e=this._getNotificationObject(t),n=this._getDetailObjUrl(t,e.get("content_type")),r="#"+e.get("ref")+" "+e.get("subject"),this._getLink(t,n,r,"object-link")}},e.prototype.getNotificationsList=function(t,e){var r,n;return n=0,r={},r.fetch=function(r){return function(n){return r.rs.users.getNotifications(t,n,e).then(function(t){return t})}}(this),r.map=function(t){return function(e){return t._addNotificationAttributes(e)}}(this),this.userTimelinePaginationSequenceService.generate(r)},e.prototype.setNotificationAsRead=function(t){return this.rs.users.setNotificationAsRead(t)},e.prototype.setNotificationsAsRead=function(){return this.rs.users.setNotificationsAsRead()},e.prototype._getNotificationObject=function(t){if(t.get("data").get("obj"))return t.get("data").get("obj")},e.prototype._getType=function(t){return _.find(n,function(e){return e.check(t)})},e.prototype._addNotificationAttributes=function(t){var e,r,n,i,o,s;return e=t.get("event_type"),s=this._getType(t),o=this._getTitle(t,e,s),t=t.set("title_html",o),n=t.getIn(["data","project","slug"]),r=this.tgSections.getPath(n),i=this.navUrls.resolve("project-"+r,{project:n}),t=t.set("projectUrl",i),t=t.set("obj",this._getNotificationObject(t))},e.prototype._translateTitleParams=function(t,e,r){return i[t].call(this,e,r)},e.prototype._getDetailObjUrl=function(t,e){var r,n;return n={issue:"project-issues-detail",task:"project-tasks-detail",userstory:"project-userstories-detail"},r=this.navUrls.resolve(n[e],{project:t.getIn(["data","project","slug"]),ref:t.getIn(["data","obj","ref"])})},e.prototype._getLink=function(t,e,r,n,i){var o;return i=i||r,o=$("").attr("ng-non-bindable",!0).text(r),$('').attr("title",i).attr("class",n).attr("ng-click",'vm.setAsRead(notification, "'+e+'")').append(o).prop("outerHTML")},e.prototype._getUsernameSpan=function(t){var e;return e=e||t,$("").addClass("username").text(t).prop("outerHTML")},e.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},e.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},e}(e.Service),angular.module("taigaNotifications").service("tgNotificationsService",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){this.lightboxFactory=t}return t.$inject=["tgLightboxFactory"],t.prototype.launchContactForm=function(){return this.lightboxFactory.create("tg-lb-contact-project",{"class":"lightbox lightbox-contact-project e2e-lightbox-contact-project",project:"project"},{project:this.project})},t}(),angular.module("taigaProjects").controller("ContactProjectButtonCtrl",t)}.call(this),function(){var t;t=function(){return{scope:{},controller:"ContactProjectButtonCtrl",bindToController:{project:"=",layout:"@"},controllerAs:"vm",templateUrl:"projects/components/contact-project-button/contact-project-button.html"}},angular.module("taigaProjects").directive("tgContactProjectButton",t)}.call(this),function(){var t;t=function(){function t(t,e,r){this.lightboxService=t,this.rs=e,this.confirm=r,this.contact={}}return t.$inject=["lightboxService","tgResources","$tgConfirm"],t.prototype.contactProject=function(){var t,e,r;return e=this.project.get("id"),t=this.contact.message,r=this.rs.projects.contactProject(e,t),this.sendingFeedback=!0,r.then(function(t){return function(){return t.lightboxService.closeAll(),t.sendingFeedback=!1,t.confirm.notify("success")}}(this))},t}(),angular.module("taigaProjects").controller("ContactProjectLbCtrl",t)}.call(this),function(){var t;t=function(t){var e;return this.inject=["lightboxService"],e=function(e,r){return t.open(r)},{controller:"ContactProjectLbCtrl",bindToController:{project:"="},controllerAs:"vm",templateUrl:"projects/components/lb-contact-project/lb-contact-project.html",link:e}},angular.module("taigaProjects").directive("tgLbContactProject",["lightboxService",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,c,u,l;for(s=$(r),a=s.scope().project,i=s.index(),u=_.map(e.projects.toJS(),function(t){return t.id}),u=_.without(u,a.get("id")),u.splice(i,0,a.get("id")),c=[],i=n=0,o=u.length;n=s.get("max_memberships_private_projects"),i&&n?(e="private-space-members",r=s.get("max_memberships_private_projects")):i?e="private-space":n&&(e="private-members",r=s.get("max_memberships_private_projects"))):(o=!this.currentUserService.canCreatePublicProjects().valid,n=null!==s.get("max_memberships_public_projects")&&t.headers.memberships>=s.get("max_memberships_public_projects"),o&&n?(e="public-space-members",r=s.get("max_memberships_public_projects")):o?e="public-space":n&&(e="public-members",r=s.get("max_memberships_public_projects"))),!!e&&{key:e,values:{max_memberships:r,members:t.headers.memberships}})},r}(taiga.Service),angular.module("taigaProjects").service("tgImportProjectService",t)}.call(this),function(){var t;t=function(){function t(){}return t.$inject=[],t.prototype.isDisabled=function(t){return this.invitedMembers.indexOf(t)===-1},t}(),angular.module("taigaProjects").controller("InviteMembersCtrl",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){},{link:t,templateUrl:"projects/create/invite-members/invite-members.html",controller:"InviteMembersCtrl",controllerAs:"vm",bindToController:!0,scope:{invitedMembers:"<",members:"<",onToggleInvitedMember:"&"}}},t.$inject=[],angular.module("taigaProjects").directive("tgInviteMembers",t)}.call(this),function(){var t;t=function(){return{templateUrl:"projects/create/invite-members/single-member/single-member.html",scope:{disabled:"<",avatar:"="}}},t.$inject=[],angular.module("taigaProjects").directive("tgSingleMember",t)}.call(this),function(){var t;t=function(){function t(t){this.currentUserService=t,this.canCreatePublicProjects=this.currentUserService.canCreatePublicProjects(),this.canCreatePrivateProjects=this.currentUserService.canCreatePrivateProjects(),this.projectForm=this.project.toJS(),this.projectForm.is_private=!1,this.projectForm.keepExternalReference=!1,"agile"===this.projectForm.importer_type?this.projectForm.project_type=null:this.projectForm.project_type="scrum",this.projectForm.create_subissues=!0,!this.canCreatePublicProjects.valid&&this.canCreatePrivateProjects.valid&&(this.projectForm.is_private=!0)}return t.$inject=["tgCurrentUserService"],t.prototype.checkUsersLimit=function(){return this.limitMembersPrivateProject=this.currentUserService.canAddMembersPrivateProject(this.members.size),this.limitMembersPublicProject=this.currentUserService.canAddMembersPublicProject(this.members.size)},t.prototype.saveForm=function(){return this.onSaveProjectDetails({project:Immutable.fromJS(this.projectForm)})},t.prototype.canCreateProject=function(){return this.projectForm.is_private?this.canCreatePrivateProjects.valid:this.canCreatePublicProjects.valid},t.prototype.isDisabled=function(){return!this.canCreateProject()},t}(),angular.module("taigaProjects").controller("JiraImportProjectFormCtrl",t)}.call(this),function(){var t;t=function(){return{link:function(t,e,r,n){return t.$watch("vm.members",n.checkUsersLimit.bind(n))},templateUrl:"projects/create/jira-import/jira-import-project-form/jira-import-project-form.html",controller:"JiraImportProjectFormCtrl",controllerAs:"vm",bindToController:!0,scope:{members:"<",project:"<",onSaveProjectDetails:"&",onCancelForm:"&",fetchingUsers:"<"}}},t.$inject=[],angular.module("taigaProjects").directive("tgJiraImportProjectForm",t)}.call(this),function(){var t;t=function(){function t(t,e,r,n){this.jiraImportService=t,this.confirm=e,this.translate=r,this.importProjectService=n,this.step="autorization-jira",this.project=null,taiga.defineImmutableProperty(this,"projects",function(t){return function(){return t.jiraImportService.projects}}(this)),taiga.defineImmutableProperty(this,"members",function(t){return function(){return t.jiraImportService.projectUsers}}(this))}return t.$inject=["tgJiraImportService","$tgConfirm","$translate","tgImportProjectService"],t.prototype.startProjectSelector=function(){return this.step="project-select-jira",this.jiraImportService.fetchProjects()},t.prototype.onSelectProject=function(t){return this.step="project-form-jira",this.project=t,this.fetchingUsers=!0,this.jiraImportService.fetchUsers(this.project.get("id")).then(function(t){return function(){return t.fetchingUsers=!1}}(this))},t.prototype.onSaveProjectDetails=function(t){return this.project=t,this.step="project-members-jira"},t.prototype.onCancelMemberSelection=function(){return this.step="project-form-jira"},t.prototype.startImport=function(t){var e,r,n;return e=this.confirm.loader(this.translate.instant("PROJECT.IMPORT.IN_PROGRESS.TITLE"),this.translate.instant("PROJECT.IMPORT.IN_PROGRESS.DESCRIPTION"),!0),e.start(),r=this.project.get("project_type"),"issues"===r&&this.project.get("create_subissues")&&(r="issues-with-subissues"),n=this.jiraImportService.importProject(this.project.get("name"),this.project.get("description"),this.project.get("id"),t,this.project.get("keepExternalReference"),this.project.get("is_private"),r,this.project.get("importer_type")),this.importProjectService.importPromise(n).then(function(t){return function(){return e.stop()}}(this))},t.prototype.submitUserSelection=function(t){return this.startImport(t),null},t}(),angular.module("taigaProjects").controller("JiraImportCtrl",t)}.call(this),function(){var t;t=function(){return{link:function(t,e,r,n){return n.startProjectSelector()},templateUrl:"projects/create/jira-import/jira-import.html",controller:"JiraImportCtrl",controllerAs:"vm",bindToController:!0,scope:{onCancel:"&"}}},t.$inject=[],angular.module("taigaProjects").directive("tgJiraImport",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.resources=t,this.location=e,this.projects=Immutable.List(),this.projectUsers=Immutable.List()}return e(r,t),r.$inject=["tgResources","$location"],r.prototype.setToken=function(t,e){return this.token=t,this.url=e},r.prototype.fetchProjects=function(){return this.resources.jiraImporter.listProjects(this.url,this.token).then(function(t){return function(e){return t.projects=e}}(this))},r.prototype.fetchUsers=function(t){return this.resources.jiraImporter.listUsers(this.url,this.token,t).then(function(t){return function(e){return t.projectUsers=e}}(this))},r.prototype.importProject=function(t,e,r,n,i,o,s,a){return this.resources.jiraImporter.importProject(this.url,this.token,t,e,r,n,i,o,s,a)},r.prototype.getAuthUrl=function(t){return new Promise(function(e){return function(r,n){return e.resources.jiraImporter.getAuthUrl(t).then(function(t){return e.authUrl=t.data.url,r(e.authUrl)},function(t){return n(t.data._error_message)})}}(this))},r.prototype.authorize=function(t){return new Promise(function(e){return function(r,n){return e.resources.jiraImporter.authorize(t).then(function(t){return e.token=t.data.token,e.url=t.data.url,r(t.data)},function(t){return n(new Error(t.status))})}}(this))},r}(taiga.Service),angular.module("taigaProjects").service("tgJiraImportService",t)}.call(this),function(){var t;t=function(){function t(){}return t.$inject=[],t.prototype.start=function(){return this.mode="search",this.invalid=!1},t.prototype.assignUser=function(){return this.onSelectUser({user:this.user,taigaUser:this.userEmail})},t.prototype.selectUser=function(t){return this.onSelectUser({user:this.user,taigaUser:Immutable.fromJS(t)})},t}(),angular.module("taigaProjects").controller("SelectImportUserLightboxCtrl",t)}.call(this),function(){var t;t=function(t,e){var r;return r=function(r,n,i,o){return r.$watch("vm.visible",function(i){return i&&!n.hasClass("open")?(o.start(),t.open(n,null,r.vm.onClose).then(function(){return n.find("input").focus(),e.init(n)})):!i&&n.hasClass("open")?t.close(n).then(function(){return o.userEmail="",o.usersSearch=""}):void 0})},{controller:"SelectImportUserLightboxCtrl",controllerAs:"vm",bindToController:!0,scope:{user:"<",visible:"<",onClose:"&",onSelectUser:"&",selectableUsers:"<",isPrivate:"<",limitMembersPrivateProject:"<",limitMembersPublicProject:"<",displayEmailSelector:"<"},templateUrl:"projects/create/select-import-user-lightbox/select-import-user-lightbox.html",link:r}},t.$inject=["lightboxService","lightboxKeyboardNavigationService"],angular.module("taigaProjects").directive("tgSelectImportUserLightbox",t)}.call(this),function(){var t;t=function(){function t(t){this.currentUserService=t,this.canCreatePublicProjects=this.currentUserService.canCreatePublicProjects(),this.canCreatePrivateProjects=this.currentUserService.canCreatePrivateProjects(),this.projectForm=this.project.toJS(),this.platformName="Trello",this.projectForm.is_private=!1,this.projectForm.keepExternalReference=!1,!this.canCreatePublicProjects.valid&&this.canCreatePrivateProjects.valid&&(this.projectForm.is_private=!0)}return t.$inject=["tgCurrentUserService"],t.prototype.checkUsersLimit=function(){return this.limitMembersPrivateProject=this.currentUserService.canAddMembersPrivateProject(this.members.size),this.limitMembersPublicProject=this.currentUserService.canAddMembersPublicProject(this.members.size)},t.prototype.saveForm=function(){return this.onSaveProjectDetails({project:Immutable.fromJS(this.projectForm)})},t.prototype.canCreateProject=function(){return this.projectForm.is_private?this.canCreatePrivateProjects.valid:this.canCreatePublicProjects.valid},t.prototype.isDisabled=function(){return!this.canCreateProject()},t}(),angular.module("taigaProjects").controller("TrelloImportProjectFormCtrl",t)}.call(this),function(){var t;t=function(){return{link:function(t,e,r,n){return t.$watch("vm.members",n.checkUsersLimit.bind(n))},templateUrl:"projects/create/trello-import/trello-import-project-form/trello-import-project-form.html",controller:"TrelloImportProjectFormCtrl",controllerAs:"vm",bindToController:!0,scope:{members:"<",project:"<",onSaveProjectDetails:"&",onCancelForm:"&",fetchingUsers:"<"}}},t.$inject=[],angular.module("taigaProjects").directive("tgTrelloImportProjectForm",t)}.call(this),function(){var t;t=function(){function t(t,e,r,n){this.trelloImportService=t,this.confirm=e,this.translate=r,this.importProjectService=n,this.project=null,taiga.defineImmutableProperty(this,"projects",function(t){return function(){return t.trelloImportService.projects}}(this)),taiga.defineImmutableProperty(this,"members",function(t){return function(){return t.trelloImportService.projectUsers}}(this))}return t.$inject=["tgTrelloImportService","$tgConfirm","$translate","tgImportProjectService"],t.prototype.startProjectSelector=function(){return this.trelloImportService.fetchProjects().then(function(t){return function(){return t.step="project-select-trello"}}(this))},t.prototype.onSelectProject=function(t){return this.step="project-form-trello",this.project=t,this.fetchingUsers=!0,this.trelloImportService.fetchUsers(this.project.get("id")).then(function(t){return function(){return t.fetchingUsers=!1}}(this))},t.prototype.onSaveProjectDetails=function(t){return this.project=t,this.step="project-members-trello"},t.prototype.onCancelMemberSelection=function(){return this.step="project-form-trello"},t.prototype.startImport=function(t){var e,r;return e=this.confirm.loader(this.translate.instant("PROJECT.IMPORT.IN_PROGRESS.TITLE"),this.translate.instant("PROJECT.IMPORT.IN_PROGRESS.DESCRIPTION"),!0),e.start(),r=this.trelloImportService.importProject(this.project.get("name"),this.project.get("description"),this.project.get("id"),t,this.project.get("keepExternalReference"),this.project.get("is_private")),this.importProjectService.importPromise(r).then(function(t){return function(){return e.stop()}}(this))},t.prototype.submitUserSelection=function(t){return this.startImport(t),null},t}(),angular.module("taigaProjects").controller("TrelloImportCtrl",t)}.call(this),function(){var t;t=function(){return{link:function(t,e,r,n){return n.startProjectSelector()},templateUrl:"projects/create/trello-import/trello-import.html",controller:"TrelloImportCtrl",controllerAs:"vm",bindToController:!0,scope:{onCancel:"&"}}},t.$inject=[],angular.module("taigaProjects").directive("tgTrelloImport",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.resources=t,this.projects=Immutable.List(),this.projectUsers=Immutable.List(),this.token=null}return e(r,t),r.$inject=["tgResources"],r.prototype.setToken=function(t){return this.token=t},r.prototype.fetchProjects=function(){return this.resources.trelloImporter.listProjects(this.token).then(function(t){return function(e){return t.projects=e}}(this))},r.prototype.fetchUsers=function(t){return this.resources.trelloImporter.listUsers(this.token,t).then(function(t){return function(e){return t.projectUsers=e}}(this))},r.prototype.importProject=function(t,e,r,n,i,o){return this.resources.trelloImporter.importProject(this.token,t,e,r,n,i,o)},r.prototype.getAuthUrl=function(){return new Promise(function(t){return function(e){return t.resources.trelloImporter.getAuthUrl().then(function(r){return t.authUrl=r.data.url,e(t.authUrl)})}}(this))},r.prototype.authorize=function(t){return new Promise(function(e){return function(r,n){return e.resources.trelloImporter.authorize(t).then(function(t){return e.token=t.data.token,r(e.token)},function(t){return n(new Error(t.status))})}}(this))},r}(taiga.Service),angular.module("taigaProjects").service("tgTrelloImportService",t)}.call(this),function(){var t;t=function(t,e){return{link:function(r,n,i){return r.$watch("visible",function(i){return i&&!n.hasClass("open")?t.open(n,r.onClose).then(function(){return n.find("input").focus(),e.init(n)}):!i&&n.hasClass("open")?t.close(n):void 0})},templateUrl:"projects/create/warning-user-import-lightbox/warning-user-import-lightbox.html",scope:{visible:"<",onClose:"&",onConfirm:"&"}}},t.$inject=["lightboxService","lightboxKeyboardNavigationService"],angular.module("taigaProjects").directive("tgWarningUserImportLightbox",t)}.call(this),function(){var t;t=function(){function t(t){this.currentUserService=t,taiga.defineImmutableProperty(this,"projects",function(t){return function(){return t.currentUserService.projects.get("all")}}(this))}return t.$inject=["tgCurrentUserService"],t}(),angular.module("taigaProjects").controller("ProjectsListing",t)}.call(this),function(){var t;t=function(){function t(t,e,r,n,i){this.routeParams=t,this.location=e,this.projectService=r,this.rs=n,this.tgSections=i,this.getProjectHomepage().then(function(t){return function(e){return e?t.location.url("project/"+t.routeParams.pslug+"/"+e):t.gotoDefaultProjectHomepage()}}(this)).then(null,function(){return this.gotoDefaultProjectHomepage()})}return t.$inject=["$routeParams","$location","tgProjectService","$tgResources","$tgSections"],t.prototype.gotoDefaultProjectHomepage=function(){return this.location.url("project/"+this.routeParams.pslug+"/timeline")},t.prototype.getProjectHomepage=function(){var t;return t=this.projectService.project.toJS(),this.rs.userProjectSettings.list({project:t.id}).then(function(e){return function(r){var n;if(n=_.find(r,{project:t.id}))return e.tgSections.getPath(t.slug,n.homepage)}}(this))},t}(),angular.module("taigaProjects").controller("ProjectRouter",t)}.call(this),function(){var t;t=function(){function t(t,e,r,n,i){this.routeParams=t,this.appMetaService=e,this.auth=r,this.translate=n,this.projectService=i,this.user=this.auth.userData,taiga.defineImmutableProperty(this,"project",function(t){return function(){return t.projectService.project}}(this)),taiga.defineImmutableProperty(this,"members",function(t){return function(){return t.projectService.activeMembers}}(this)),this.appMetaService.setfn(this._setMeta.bind(this))}return t.$inject=["$routeParams","tgAppMetaService","$tgAuth","$translate","tgProjectService"],t.prototype._setMeta=function(){var t;return this.project?(t={projectName:this.project.get("name")},{title:this.translate.instant("PROJECT.PAGE_TITLE",t),description:this.project.get("description")}):null},t}(),angular.module("taigaProjects").controller("Project",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=this.taiga.groupBy,t=function(t){function e(t,e){this.rs=t,this.projectUrl=e}return n(e,t),e.$inject=["tgResources","$projectUrl"],e.prototype.create=function(t){return this.rs.projects.create(t)},e.prototype.duplicate=function(t,e){return this.rs.projects.duplicate(t,e)},e.prototype.getProjectBySlug=function(t){return this.rs.projects.getProjectBySlug(t).then(function(t){return function(e){return t._decorate(e)}}(this))},e.prototype.getProjectStats=function(t){return this.rs.projects.getProjectStats(t)},e.prototype.getProjectsByUserId=function(t,e){return this.rs.projects.getProjectsByUserId(t,e).then(function(t){return function(e){return e.map(t._decorate.bind(t))}}(this))},e.prototype._decorate=function(t){var e;return e=this.projectUrl.get(t.toJS()),t=t.set("url",e)},e.prototype.bulkUpdateProjectsOrder=function(t){return this.rs.projects.bulkUpdateOrder(t)},e.prototype.transferValidateToken=function(t,e){return this.rs.projects.transferValidateToken(t,e)},e.prototype.transferAccept=function(t,e,r){return this.rs.projects.transferAccept(t,e,r)},e.prototype.transferReject=function(t,e,r){return this.rs.projects.transferReject(t,e,r)},e}(r.Service),angular.module("taigaProjects").service("tgProjectsService",t)}.call(this),function(){var t;t=function(){return{templateUrl:"projects/transfer/cant-own-project-explanation.html"}},angular.module("taigaProjects").directive("tgCantOwnProjectExplanation",t)}.call(this),function(){var t,e;e=angular.module("taigaProjects"),t=function(){function t(t,e,r,n,i,o,s,a,c){this.routeParams=t,this.projectService=e,this.location=r,this.authService=n,this.currentUserService=i,this.navUrls=o,this.translate=s,this.confirmService=a,this.errorHandlingService=c}return t.$inject=["$routeParams","tgProjectsService","$location","$tgAuth","tgCurrentUserService","$tgNavUrls","$translate","$tgConfirm","tgErrorHandlingService"],t.prototype.initialize=function(){return this.projectId=this.project.get("id"),this.token=this.routeParams.token,this.showAddComment=!1,this._refreshUserData()},t.prototype._validateToken=function(){return this.projectService.transferValidateToken(this.projectId,this.token).then(null,function(t){return function(e,r){return t.errorHandlingService.notfound()}}(this))},t.prototype._refreshUserData=function(){return this.authService.refresh().then(function(t){return function(){return t._validateToken(),t._setProjectData(),t._checkOwnerData()}}(this))},t.prototype._setProjectData=function(){return this.canBeOwnedByUser=this.currentUserService.canOwnProject(this.project)},t.prototype._checkOwnerData=function(){var t,e;return t=this.currentUserService.getUser(),this.project.get("is_private")?(this.ownerMessage="ADMIN.PROJECT_TRANSFER.OWNER_MESSAGE.PRIVATE",this.maxProjects=t.get("max_private_projects"),null===this.maxProjects&&(this.maxProjects=this.translate.instant("ADMIN.PROJECT_TRANSFER.UNLIMITED_PROJECTS")),this.currentProjects=t.get("total_private_projects"),e=t.get("max_memberships_private_projects")):(this.ownerMessage="ADMIN.PROJECT_TRANSFER.OWNER_MESSAGE.PUBLIC",this.maxProjects=t.get("max_public_projects"),null===this.maxProjects&&(this.maxProjects=this.translate.instant("ADMIN.PROJECT_TRANSFER.UNLIMITED_PROJECTS")),this.currentProjects=t.get("total_public_projects"),e=t.get("max_memberships_public_projects")),this.validNumberOfMemberships=null===e||this.project.get("total_memberships")<=e},t.prototype.transferAccept=function(t,e){return this.loadingAccept=!0,this.projectService.transferAccept(this.project.get("id"),t,e).then(function(t){return function(){var e;e=t.navUrls.resolve("project-admin-project-profile-details",{project:t.project.get("slug")}),t.loadingAccept=!1,t.location.path(e),t.confirmService.notify("success",t.translate.instant("ADMIN.PROJECT_TRANSFER.ACCEPTED_PROJECT_OWNERNSHIP"),"",5e3)}}(this))},t.prototype.transferReject=function(t,e){return this.loadingReject=!0,this.projectService.transferReject(this.project.get("id"),t,e).then(function(t){return function(){var e;e=t.navUrls.resolve("home",{project:t.project.get("slug")}),t.loadingReject=!1,t.location.path(e),t.confirmService.notify("success",t.translate.instant("ADMIN.PROJECT_TRANSFER.REJECTED_PROJECT_OWNERNSHIP"),"",5e3)}}(this))},t.prototype.addComment=function(){return this.showAddComment=!0},t.prototype.hideComment=function(){return this.showAddComment=!1,this.reason=""},t}(),e.controller("TransferProjectController",t)}.call(this),function(){var t,e;e=angular.module("taigaProjects"),t=function(){var t;return t=function(t,e,r,n){return n.initialize()},{link:t,scope:{},bindToController:{project:"="},templateUrl:"projects/transfer/transfer-project.html",controller:"TransferProjectController",controllerAs:"vm"}},e.directive("tgTransferProject",t)}.call(this),function(){var t,e,r,n;n=this.taiga,r=this.taiga.sizeFormat,t=function(t,e,n,i,o,s){var a;return a={},a.list=function(r,n,i){var o,s,a,c;return c="attachments/"+r,s={object_id:n,project:i},o={headers:{"x-disable-pagination":"1"}},a=t.resolve(c),e.get(a,s,o).then(function(t){return Immutable.fromJS(t.data)})},a["delete"]=function(r,n){var i,o;return o="attachments/"+r,i=t.resolve(o)+("/"+n),e["delete"](i)},a.patch=function(r,n,i){var o,s;return s="attachments/"+r,o=t.resolve(s)+("/"+n),e.patch(o,i)},a.create=function(e,a,c,u,l){var p,d,f,h,g,m,v,y,_,b,S;return b="attachments/"+e,_=t.resolve(b),d=o.defer(),void 0===u?(d.reject(null),d.promise):(f=n.get("maxUploadFileSize",null),f&&u.size>f?(h={status:413,data:{_error_message:"'"+u.name+"' ("+r(u.size)+") is too heavy for our oompa loompas, try it with a smaller than ("+r(f)+")"}},d.reject(h),d.promise):(y=function(t){return function(t){return i.$apply(function(){return u.status="in-progress",u.size=r(t.total),u.progressMessage="upload "+r(t.loaded)+" of "+r(t.total),u.progressPercent=Math.round(t.loaded/t.total*100)+"%"})}}(this),m=function(t){return function(t){return i.$apply(function(){var e,r,n;u.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),d.resolve(e)):(h={status:n,data:{_error_message:null!=(r=p.attached_file)?r[0]:void 0}},d.reject(h))})}}(this),v=function(t){return function(t){return i.$apply(function(){return u.status="error",d.reject("fail")})}}(this),p=new FormData,p.append("project",a),p.append("object_id",c),p.append("attached_file",u),p.append("from_comment",l),S=new XMLHttpRequest,S.upload.addEventListener("progress",y,!1),S.addEventListener("load",m,!1),S.addEventListener("error",v,!1),g=s.get("token"),S.open("POST",_),S.setRequestHeader("Authorization","Bearer "+g),S.setRequestHeader("Accept","application/json"),S.send(p),d.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,n){var i,o;return null==n&&(n=0),o=t.resolve("epics"),i={project:r,page:n},e.get(o,i).then(function(t){return{list:Immutable.fromJS(t.data),headers:t.headers}})},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).then(function(t){return Immutable.fromJS(t.data)})},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.getHistory=function(r,n,i,o){var s;return s=t.resolve("history/"+n),e.get(s+"/"+i,{page:o,type:r}).then(function(t){return{list:Immutable.fromJS(t.data),headers:t.headers}})},function(){return{history:r}}},t.$inject=["$tgUrls","$tgHttp"],e=angular.module("taigaResources2"),e.factory("tgHistory",t)}.call(this),function(){var t,e,r,n,i,o;o=this.taiga,n=function(t,e){var r;return r={},r.getAuthUrl=function(r){return r=t.resolve("importers-trello-auth-url"),e.get(r)},r.authorize=function(r){var n;return n=t.resolve("importers-trello-authorize"),e.post(n,{code:r})},r.listProjects=function(r){var n;return n=t.resolve("importers-trello-list-projects"),e.post(n,{token:r}).then(function(t){return Immutable.fromJS(t.data)})},r.listUsers=function(r,n){var i;return i=t.resolve("importers-trello-list-users"),e.post(i,{token:r,project:n}).then(function(t){return Immutable.fromJS(t.data)})},r.importProject=function(r,n,i,o,s,a,c){var u,l;return l=t.resolve("importers-trello-import-project"),u={token:r,name:n,description:i,project:o,users_bindings:s.toJS(),keep_external_reference:a,is_private:c,template:"kanban"},e.post(l,u)},function(){return{trelloImporter:r}}},n.$inject=["$tgUrls","$tgHttp"],r=function(t,e){var r;return r={},r.getAuthUrl=function(r){var n;return n=t.resolve("importers-jira-auth-url")+"?url="+r,e.get(n)},r.authorize=function(r){var n;return n=t.resolve("importers-jira-authorize"),e.post(n,{oauth_verifier:r})},r.listProjects=function(r,n){var i;return i=t.resolve("importers-jira-list-projects"),e.post(i,{url:r,token:n}).then(function(t){return Immutable.fromJS(t.data)})},r.listUsers=function(r,n,i){var o;return o=t.resolve("importers-jira-list-users"),e.post(o,{url:r,token:n,project:i}).then(function(t){return Immutable.fromJS(t.data)})},r.importProject=function(r,n,i,o,s,a,c,u,l,p){var d,f,h;return h=t.resolve("importers-jira-import-project"),f="kanban","kanban"!==l&&(f="scrum"),d={url:r,token:n,name:i,description:o,project:s,users_bindings:a.toJS(),keep_external_reference:c,is_private:u,project_type:l,importer_type:p,template:f},e.post(h,d)},function(){return{jiraImporter:r}}},r.$inject=["$tgUrls","$tgHttp"],e=function(t,e){var r;return r={},r.getAuthUrl=function(r){var n;return n=t.resolve("importers-github-auth-url")+"?uri="+r,e.get(n)},r.authorize=function(r){var n;return n=t.resolve("importers-github-authorize"),e.post(n,{code:r})},r.listProjects=function(r){var n;return n=t.resolve("importers-github-list-projects"),e.post(n,{token:r}).then(function(t){return Immutable.fromJS(t.data)})},r.listUsers=function(r,n){var i;return i=t.resolve("importers-github-list-users"),e.post(i,{token:r,project:n}).then(function(t){return Immutable.fromJS(t.data)})},r.importProject=function(r,n,i,o,s,a,c,u){var l,p;return p=t.resolve("importers-github-import-project"),l={token:r,name:n,description:i,project:o,users_bindings:s.toJS(),keep_external_reference:a,is_private:c,template:u},e.post(p,l)},function(){return{githubImporter:r}}},e.$inject=["$tgUrls","$tgHttp"],t=function(t,e){var r;return r={},r.getAuthUrl=function(){var r;return r=t.resolve("importers-asana-auth-url"),e.get(r)},r.authorize=function(r){var n;return n=t.resolve("importers-asana-authorize"),e.post(n,{code:r})},r.listProjects=function(r){var n;return n=t.resolve("importers-asana-list-projects"),e.post(n,{token:r}).then(function(t){return Immutable.fromJS(t.data)})},r.listUsers=function(r,n){var i;return i=t.resolve("importers-asana-list-users"),e.post(i,{token:r,project:n}).then(function(t){return Immutable.fromJS(t.data)})},r.importProject=function(r,n,i,o,s,a,c,u){var l,p;return p=t.resolve("importers-asana-import-project"),l={token:r,name:n,description:i,project:o,users_bindings:s.toJS(),keep_external_reference:a,is_private:c,template:u},e.post(p,l)},function(){return{asanaImporter:r}}},t.$inject=["$tgUrls","$tgHttp"],i=angular.module("taigaResources2"),i.factory("tgTrelloImportResource",n),i.factory("tgJiraImportResource",r),i.factory("tgGithubImportResource",e),i.factory("tgAsanaImportResource",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.create=function(r){var n;return n=t.resolve("projects"),e.post(n,JSON.stringify(r)).then(function(t){return function(t){return Immutable.fromJS(t.data)}}(this))},n.duplicate=function(r,n){var i,o,s;return s=t.resolve("projects"),s=s+"/"+r+"/duplicate",i=n.users.map(function(t){return function(t){return{id:t}}}(this)),o={name:n.name,description:n.description,is_private:n.is_private,users:i},e.post(s,o)},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,live_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.contactProject=function(r,n){var i,o;return i={project:r,comment:n},o=t.resolve("project-contact"),e.post(o,i)},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","tgHistory","tgEpicsResource","tgTrelloImportResource","tgJiraImportResource","tgGithubImportResource","tgAsanaImportResource"],t=function(t){var r,n,i,o,s,a,c,u,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,i){var o;return null==i&&(i=!1),o=this.rs.attachments.create(n,r,e,t,i),o.then(null,this.saveError.bind(this,t)),o},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(t){var e,r;this.config=t,r=["/"+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"],e=["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(r,e)}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",username:""}},t.prototype.getAvatar=function(t,e){var r,n,i,o,s,a,c;return t?(r="photo","avatarBig"===e&&(r="big_photo"),s=null,t instanceof Immutable.Map?(n=t.get("gravatar_id"),s=t.get(r),c="@"+t.get("username")):(n=t.gravatar_id,s=t[r],c="@"+t.username),n?s?{url:s,username:c}:location.host.indexOf("localhost")===-1&&this.config.get("gravatar",!0)?(a=location.protocol+"//"+location.host,i=this.getDefault(n),o=encodeURIComponent(a+i.src),{url:"https://www.gravatar.com/avatar/"+n+"?s=200&d="+o,bg:i.color,username:c}):(a=location.protocol+"//"+location.host,i=this.getDefault(n),{url:a+i.src,bg:i.color,username:c}):this.getUnnamed()):this.getUnnamed()},t}(),angular.module("taigaCommon").service("tgAvatarService",["$tgConfig",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){if(this.isAuthenticated())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._projects=this._projects.set("unblocked",t.filter(function(t){return null===t.toJS().blocked_code})),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",current:t.get("total_private_projects"),max:t.get("max_private_projects")}:{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",current:t.get("total_public_projects"),max:t.get("max_public_projects")}:{valid:!0}},t.prototype.canAddMembersPublicProject=function(t){var e;return e=this.getUser(),null!==e.get("max_memberships_public_projects")&&t>e.get("max_memberships_public_projects")?{valid:!1,reason:"max_members_public_projects",type:"public_project",current:t,max:e.get("max_memberships_public_projects")}:{valid:!0}},t.prototype.canAddMembersPrivateProject=function(t){var e;return e=this.getUser(),null!==e.get("max_memberships_private_projects")&&t>e.get("max_memberships_private_projects")?{valid:!1,reason:"max_members_private_projects",type:"private_project",current:t,max:e.get("max_memberships_private_projects")}:{valid:!0}},t.prototype.canOwnProject=function(t){var e,r,n;if(n=this.getUser(),t.get("is_private")){if(r=this.canCreatePrivateProjects(),!r.valid)return r;if(e=this.canAddMembersPrivateProject(t.get("total_memberships")),!e.valid)return e}else{if(r=this.canCreatePublicProjects(),!r.valid)return r;if(e=this.canAddMembersPublicProject(t.get("total_memberships")),!e.valid)return e}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,r=function(t,e){return function(){return t.apply(e,arguments)}};e=this.taiga,t=function(){function t(t,n,i,o,s){this.rootScope=t,this.projectsService=n,this.xhrError=i,this.userActivityService=o,this.interval=s,this.manageProjectSignal=r(this.manageProjectSignal,this),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)),window.localStorage.e2e||this.autoRefresh(),this.watchSignals()}return t.$inject=["$rootScope","tgProjectsService","tgXhrErrorService","tgUserActivityService","$interval"],t.prototype.watchSignals=function(){var t,e,r,n,i;for(t=["admin:project-modules:updated","admin:project-roles:updated","admin:project-default-values:updated","admin:project-values:updated","admin:project-values:move","admin:project-custom-attributes:updated","sprintform:create:success","sprintform:edit:success","sprintform:remove:success","tags:updated"],n=[],e=0,r=t.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;r=this.taiga,e=this.taiga.groupBy,t=function(){function t(t){return this.timeout=t,window.localStorage.e2e?null:(window.addEventListener("mousemove",this.resetTimer.bind(this),!1),window.addEventListener("mousedown",this.resetTimer.bind(this),!1),window.addEventListener("keypress",this.resetTimer.bind(this),!1),window.addEventListener("mousewheel",this.resetTimer.bind(this),!1),window.addEventListener("touchmove",this.resetTimer.bind(this),!1),this.subscriptionsActive=[],this.subscriptionsInactive=[],this.isActive=!0,void this.startTimer())}return t.$inject=["$timeout"],t.prototype.idleTimeout=3e5,t.prototype.startTimer=function(){return this.timerId=this.timeout(this._fireInactive.bind(this),this.idleTimeout)},t.prototype.resetTimer=function(){return this.isActive||this._fireActive(),this.timeout.cancel(this.timerId),this.startTimer(),this.isActive=!0},t.prototype.onActive=function(t){return this.subscriptionsActive.push(t),this._unSubscriptionsActive.bind(this,t)},t.prototype.onInactive=function(t){return this.subscriptionsInactive.push(t),this._unSubscriptionsInactive.bind(this,t)},t.prototype._fireActive=function(){return this.subscriptionsActive.forEach(function(t){return t()})},t.prototype._fireInactive=function(){return this.isActive=!1,this.subscriptionsInactive.forEach(function(t){return t()})},t.prototype._unSubscriptionsActive=function(t){return this.subscriptionsActive=this.subscriptionsActive.filter(function(e){return e!==t})},t.prototype._unSubscriptionsInactive=function(t){return this.subscriptionsInactive=this.subscriptionsInactive.filter(function(e){return e!==t})},t}(),angular.module("taigaCommon").service("tgUserActivityService",t)}.call(this),function(){var t,e,r;r=this.taiga,e=this.taiga.normalizeString,t=function(){function t(t,e){this.currentUserService=t,this.projectService=e}return t.$inject=["tgCurrentUserService","tgProjectService"],t.prototype.filterUsers=function(t,r){var n;return n=r.full_name_display.toUpperCase(),n=e(n),t=t.toUpperCase(),t=e(t),_.includes(n,t)},t.prototype.searchUsers=function(t,e){var r;return this.currentUser=this.currentUserService.getUser(),r=_.clone(this.projectService.activeMembers.toJS(),!0),e&&(r=_.reject(r,{id:e.id})),r=_.sortBy(r,function(t){return function(e){var r;return e.id===(null!=(r=t.currentUser)?r.get("id"):void 0)?0:e.id}}(this)),null!=t&&(r=_.filter(r,_.partial(this.filterUsers,t))),r},t}(),angular.module("taigaCommon").service("tgUserListService",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,e){return this.rs.users.getContacts(t,e)},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",assigned_users:"COMMON.FIELDS.ASSIGNED_USERS",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",due_date:"COMMON.FIELDS.DUE_DATE",due_date_reason:"COMMON.FIELDS.DUE_DATE_REASON",milestone:"COMMON.FIELDS.SPRINT"},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,i;return _.isArray(t.getIn(["data","value_diff","value"]).toJS())?(i=t.getIn(["data","value_diff","value"]).get(1),null===i&&"assigned_to"===t.getIn(["data","value_diff","key"])&&(i=this.translate.instant("ACTIVITY.VALUES.UNASSIGNED")),null===i&&"assigned_users"===t.getIn(["data","value_diff","key"])?i=this.translate.instant("ACTIVITY.VALUES.UNASSIGNED"):"due_date"===t.getIn(["data","value_diff","key"])&&(i?(n=this.translate.instant("COMMON.PICKERDATE.FORMAT"),i=moment(i,"YYYY-MM-DD").format(n)):i=this.translate.instant("ACTIVITY.VALUES.NOT_SET")),r=i):r=t.getIn(["data","value_diff","value"]).first().get(1),$("").attr("ng-non-bindable",!0).text(r).prop("outerHTML")},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).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,s;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