2 lines
76 KiB
JavaScript
2 lines
76 KiB
JavaScript
function l(){var e,t,n=arguments[0],r=n,i=arguments;for(labels[n]?r=labels[n]:clabels[n]&&(r=clabels[n]),e=1,t=0;e<i.length;e++,t++)r=r.replace("%{"+t+"}",i[e]);return e=1,i.length>1&&(r=r.replace(/%((%)|s|d)/g,function(t){var n=null;if(t[2])n=t[2];else{switch(n=i[e],t){case"%d":n=parseFloat(n),isNaN(n)&&(n=0)}e++}return n})),r}function hexToRgb(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function contrast(e){var t,n,r=1;if(t=hexToRgb(e)){n=[t.r/255,t.g/255,t.b/255];for(var i=0;i<n.length;++i)n[i]<=.03928?n[i]=n[i]/12.92:n[i]=Math.pow((n[i]+.055)/1.055,2.4);r=.2126*n[0]+.7152*n[1]+.0722*n[2]}return r>.179?"black":"white"}function guid(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return(e()+e()+"-"+e()+"-4"+e().substr(0,3)+"-"+e()+"-"+e()+e()+e()).toLowerCase()}!function(){"use strict";function e(e,t,n,r,i){r.definePalette("sogo-green",{50:"eaf5e9",100:"cbe5c8",200:"aad6a5",300:"88c781",400:"66b86a",500:"56b04c",600:"4da143",700:"388e3c",800:"367d2e",900:"225e1b",A100:"fafafa",A200:"69f0ae",A400:"00e676",A700:"00c853",contrastDefaultColor:"dark",contrastLightColors:["300","400","500","600","700","800","900"]}),r.definePalette("sogo-blue",{50:"f0faf9",100:"e1f5f3",200:"ceebe8",300:"bfe0dd",400:"b2d6d3",500:"a1ccc8",600:"8ebfbb",700:"7db3b0",800:"639997",900:"4d8080",A100:"d4f7fa",A200:"c3f5fa",A400:"53e3f0",A700:"00b0c0",contrastDefaultColor:"light",contrastDarkColors:["50","100","200"]}),r.definePalette("sogo-paper",{50:"fcf7f8",100:"f7f1dc",200:"ede5ca",300:"e6d8ba",400:"e2d2a3",500:"d6c48d",600:"baa870",700:"857545",800:"524517",900:"433809",1000:"000000",A100:"ffffff",A200:"eeeeee",A400:"bdbdbd",A700:"616161",contrastDefaultColor:"dark",contrastLightColors:["800","900"]}),r.theme("default").primaryPalette("sogo-blue",{default:"900","hue-1":"400","hue-2":"800","hue-3":"A700"}).accentPalette("sogo-green",{default:"500","hue-1":"A100","hue-2":"300","hue-3":"A700"}),DebugEnabled||(e.debugEnabled(!1),t.debugInfoEnabled(!1),i.disableWarnings(),r.generateThemesOnDemand(!0)),n.interceptors.push("AuthInterceptor"),n.interceptors.push("ErrorInterceptor")}function t(e,t){return{response:function(n){return n&&/^application\/json/.test(n.config.headers.Accept)&&/^[\n\r ]*<!DOCTYPE html>/.test(n.data)?(e.location.reload(!0),t.reject()):n}}}function n(e,t,n,r){return{responseError:function(i){var o,s;if(/^application\/json/.test(i.config.headers.Accept)){if(t.usesCASAuthentication&&-1==i.status)return o=n.defer(),(s=angular.element('<iframe class="ng-hide" src="'+UserFolderURL+'recover"></iframe>')).on("load",function(){r.get("$http")(i.config).then(o.resolve,o.reject),s.remove()}),document.body.appendChild(s[0]),o.promise;e.$broadcast("http:Error",i)}return n.reject(i)}}}angular.module("SOGo.Common",["ngAnimate","ngMessages","ngSanitize","ngMaterial","mdColors"]).value("sgSettings",{isPopup:document.body.classList.contains("popup"),baseURL:function(){return ApplicationBaseURL||null},resourcesURL:function(){return ResourcesURL||null},activeUser:function(e){var t={login:UserLogin||null,identification:UserIdentification||null,email:UserEmail||null,language:UserLanguage||null,folderURL:UserFolderURL||null,isSuperUser:IsSuperUser||null,path:{calendar:UserCalendarPath||null,contacts:UserContactsPath||null,mail:UserMailPath||null,preferences:UserPreferencesPath||null,administration:IsSuperUser?UserAdministrationPath:null,help:HelpURL||null,logoff:UserLogoffPath||null}};return e?t[e]:t},minimumSearchLength:function(){return angular.isNumber(minimumSearchLength)?minimumSearchLength:2}}).constant("sgColors",{selection:["#FFFFFF","#330033","#C0C0C0","#999999","#666666","#333333","#000000","#FFCCCC","#FF6666","#FF0000","#CC0000","#990000","#660000","#330000","#FFCC99","#FF9966","#FF9900","#FF6600","#CC6600","#993300","#663300","#FFFF99","#FFFF66","#FFCC66","#FFCC33","#CC9933","#996633","#663333","#FFFFCC","#FFFF33","#FFFF00","#FFCC00","#999900","#666600","#333300","#CCCCCC","#66FF99","#33FF33","#33CC00","#009900","#006600","#003300","#99FFFF","#33FFFF","#66CCCC","#00CCCC","#339999","#336666","#003333","#CCFFFF","#66FFFF","#33CCFF","#3366FF","#3333FF","#000099","#000066","#CCCCFF","#9999FF","#6666CC","#6633FF","#6600CC","#333399","#330099","#FFCCFF","#FF99FF","#CC66CC","#CC33CC","#993399","#663366","#99FF99"]}).constant("sgConstant",{xs:"(max-width: 599px)","gt-xs":"(min-width: 600px)",sm:"(min-width: 600px) and (max-width: 959px)","gt-sm":"(min-width: 960px)",md:"(min-width: 960px) and (max-width: 1023px)","gt-md":"(min-width: 1024px)",lg:"(min-width: 1024px) and (max-width: 1279px)","gt-lg":"(min-width: 1280px)",xl:"(min-width: 1920px)",print:"print"}).config(e).factory("AuthInterceptor",t).factory("ErrorInterceptor",n),e.$inject=["$logProvider","$compileProvider","$httpProvider","$mdThemingProvider","$mdAriaProvider"],t.$inject=["$window","$q"],n.$inject=["$rootScope","$window","$q","$injector"]}(),function(){"use strict";function e(e){n=e}function t(e,t,r){function i(e){return e.join("")}function o(e,t,n,r,i,o){if(i){var s={theme:n,palette:r,value:"rgb("+i.value[0]+","+i.value[1]+","+i.value[2]+")",contrast:"rgb("+i.contrast[0]+","+i.contrast[1]+","+i.contrast[2]+")",hue:o};y.insertRule(e(s),v),v+=1,y.insertRule(t(s),v),v+=1}}function s(e,t,n,r,i){if(r){var o="rgb("+r.value[0]+","+r.value[1]+","+r.value[2]+")";y.insertRule(e({theme:t,palette:n,value:o,hue:i}),v),v+=1}}for(var a=e(i([".md-{{theme}}-theme",".md-fg"])+" { color:{{value}};}"),l=e(i([".md-{{theme}}-theme",".md-bg"])+" { background-color:{{value}};}"),c=e(i([".md-{{theme}}-theme",".md-bdr"])+" { border-color:{{value}};}"),u=e(i([".md-{{theme}}-theme",".md-{{hue}}",".md-fg"])+" { color:{{value}};}"),d=e(i([".md-{{theme}}-theme",".md-{{hue}}",".md-bg"])+" { background-color:{{value}};}"),h=e(i([".md-{{theme}}-theme",".md-{{palette}}",".md-fg"])+" { color:{{value}};}"),m=e(i([".md-{{theme}}-theme",".md-{{palette}}",".md-bg"])+" { background-color:{{value}}; color:{{contrast}} !important; }"),g=e(i([".md-{{theme}}-theme",".md-{{palette}}",".md-bdr"])+" { border-color:{{value}};}"),p=e(i([".md-{{theme}}-theme",".md-{{palette}}.md-{{hue}}",".md-fg"])+" { color:{{value}};}"),f=e(i([".md-{{theme}}-theme",".md-{{palette}}.md-{{hue}}",".md-bg"])+" { background-color:{{value}};}"),y=function(){var e=t[0].head.querySelector('style[title="Dynamic-Generated-by-mdColors"]');return null===e&&((e=t[0].createElement("style")).title="Dynamic-Generated-by-mdColors",e.appendChild(t[0].createTextNode("")),t[0].head.appendChild(e)),e.sheet}(),v=0;y.cssRules.length>0;)y.deleteRule(0);angular.forEach(n._THEMES,function(e,t){o(a,l,t,"primary",n._PALETTES[e.colors.primary.name][e.colors.primary.hues.default]),o(u,d,t,"primary",n._PALETTES[e.colors.primary.name][e.colors.primary.hues["hue-2"]],"hue-2"),o(u,d,t,"primary",n._PALETTES[e.colors.primary.name][e.colors.primary.hues["hue-3"]],"hue-3"),o(u,d,t,"primary",n._PALETTES[e.colors.primary.name][e.colors.primary.hues["hue-1"]],"hue-1"),s(c,t,"primary",n._PALETTES[e.colors.primary.name][e.colors.primary.hues.default]),angular.forEach(e.colors,function(e,r){o(h,m,t,r,n._PALETTES[e.name][e.hues.default]),s(g,t,r,n._PALETTES[e.name][e.hues.default]),o(p,f,t,r,n._PALETTES[e.name][e.hues["hue-2"]],"hue-2"),o(p,f,t,r,n._PALETTES[e.name][e.hues["hue-3"]],"hue-3"),o(p,f,t,r,n._PALETTES[e.name][e.hues["hue-1"]],"hue-1")})})}var n;angular.module("mdColors",["ngMaterial"]).config(e).run(t),e.$inject=["$mdThemingProvider"],t.$inject=["$interpolate","$document","$log"]}(),function(){"use strict";function e(e){return e.decodeURIComponent}e.$inject=["$window"],angular.module("SOGo.Common").filter("decodeUri",e)}(),function(){"use strict";function e(e){return e.encodeURIComponent}e.$inject=["$window"],angular.module("SOGo.Common").filter("encodeUri",e)}(),function(){"use strict";function e(e){return function(t){var n=angular.element("<div>"+t+"</div>");return n.find("a").attr("target","_blank"),e.trustAs("html",n.html())}}e.$inject=["$sce"],angular.module("SOGo.Common").filter("ensureTarget",e)}(),function(){"use strict";function e(){return l}angular.module("SOGo.Common").filter("loc",e)}(),function(){"use strict";function e(){return function(e){for(var t=[],n=0;n<parseInt(e);n++)t.push(n);return t}}angular.module("SOGo.Common").filter("range",e)}(),function(){"use strict";function e(e){return function(t){return t?String(e(t," _blank")).replace(/ /gm,"<br>"):void 0}}e.$inject=["linkyFilter"],angular.module("SOGo.Common").filter("txt2html",e)}(),function(){"use strict";function e(e,t,n,r,i,o){function s(e){return i.$filter(e,o.$acl.users)}function a(){o.$acl.$resetUsersRights(),t.hide()}function c(){o.$acl.$saveUsersRights().then(function(){t.hide()},function(e,t){n.alert(l("Warning"),l("An error occured please try again."))})}function u(e){var t=e.$confirmRights(f.folder);t&&(f.confirmation.showing=!0,f.confirmation.message=t)}function d(t){e(function(){o.$acl.$removeUser(t.uid)},500)}function h(e){e&&o.$acl.$addUser(e).then(function(e){f.userToAdd="",f.searchText="",f.selectedUid=null,e&&g(e)})}function m(e){o.$acl.$selectAllRights(e)}function g(e,t){if(t&&t.target.parentNode.classList.contains("md-secondary"))return!1;f.selectedUid==e.uid?f.selectedUid=null:(f.selectedUid=e.uid,f.selectedUser=e,e.inactive||f.selectedUser.$rights())}function p(e){return f.selectedUid==e.uid&&!e.inactive}var f=this;f.users=r,f.folder=o,f.selectedUser=null,f.selectedUid=null,f.userToAdd="",f.searchText="",f.userFilter=s,f.closeModal=a,f.saveModal=c,f.confirmChange=u,f.removeUser=d,f.addUser=h,f.selectAllRights=m,f.selectUser=g,f.showRights=p,f.confirmation={showing:!1,message:""}}e.$inject=["$timeout","$mdDialog","Dialog","usersWithACL","User","folder"],angular.module("SOGo.Common").controller("AclController",e)}(),function(){"use strict";function e(e,t,n,r,i,o,s,a,c,u,d,h,m,g){function p(){return!s("left").isOpen()}function f(e,t){var n;t.data&&t.data.message&&angular.isString(t.data.message)?n=t.data.message:t.status&&(n=t.statusText),n?a.show({template:["<md-toast>",' <div class="md-toast-content">',' <md-icon class="md-warn md-hue-1">error_outline</md-icon>'," <span flex>"+l(n)+"</span>"," </div>","</md-toast>"].join(""),hideDelay:5e3,position:"top right"}):u.debug("untrap error")}var y=new m(h.baseURL(),h.activeUser());this.$onInit=function(){t.isPopup=h.isPopup,t.activeUser=h.activeUser(),t.baseURL=h.baseURL(),t.leftIsClose=!c(d["gt-md"]),t.centerIsClose=!!o.centerIsClose&&!t.leftIsClose,t.currentDay=window.currentDay,n(function(){r(function(){i.get("../date").then(function(e){t.currentDay=e})},864e5)},1e3*window.currentDay.secondsBeforeTomorrow),t.$watch(function(){return c(d["gt-md"])},function(e){t.isGtMedium=e,e&&(t.leftIsClose=!1)}),e.$on("http:Error",f),h.activeUser("path").calendar&&g.getAlarms()},t.toggleLeft=function(){t.isGtMedium?t.leftIsClose=!t.leftIsClose:(t.leftIsClose=p(),t.leftIsClose&&angular.element(o).triggerHandler("resize"),s("left").toggle().then(function(){u.debug("toggle left is done")}))},t.toggleRight=function(){s("right").toggle().then(function(){u.debug("toggle right is done")})},t.toggleCenter=function(e){t.centerIsClose=!t.centerIsClose,e&&e.save&&y.post(null,"saveListState",{state:t.centerIsClose?"collapse":"rise"})}}e.$inject=["$rootScope","$scope","$timeout","$interval","$http","$window","$mdSidenav","$mdToast","$mdMedia","$log","sgConstant","sgSettings","Resource","Alarm"],angular.module("SOGo.Common").controller("navController",e)}(),function(){"use strict";function e(e){this.folderId=e}e.factory=["$q","$timeout","sgSettings","Resource","User",function(t,n,r,i,o){return angular.extend(e,{$q:t,$timeout:n,$$resource:new i(r.activeUser("folderURL"),r.activeUser()),$User:o}),e}],angular.module("SOGo.Common").factory("Acl",e.factory),e.prototype.$users=function(t){var n,r=this,i=e.$q.defer();if(!this.users){return(angular.isDefined(t)?e.$$resource.userResource(t).fetch(this.folderId,"acls"):e.$$resource.fetch(this.folderId,"acls")).then(function(o){return r.users=[],angular.forEach(o.users,function(i){(n=new e.$User(i)).canSubscribeUser=n.isSubscribed,n.wasSubscribed=n.isSubscribed,n.$rights=angular.bind(n,n.$acl,r.folderId,t),r.users.push(n)}),i.resolve(r.users),r.users})}return i.resolve(this.users),i.promise},e.prototype.$addUser=function(t,n){var r=this,i=e.$q.defer(),o={uid:t.uid};if(!t.uid||_.indexOf(_.map(this.users,"uid"),t.uid)>-1)i.resolve();else{(angular.isDefined(n)?e.$$resource.userResource(n).fetch(this.folderId,"addUserInAcls",o):e.$$resource.fetch(this.folderId,"addUserInAcls",o)).then(function(){t.wasSubscribed=!1,t.userClass=t.isGroup?"normal-group":"normal-user",t.$rights=angular.bind(t,t.$acl,r.folderId,n),r.users.push(t),i.resolve(t)},function(e,t){i.reject(l("An error occured please try again."))})}return i.promise},e.prototype.$removeUser=function(t,n){var r=this,i={uid:t};return(angular.isDefined(n)?e.$$resource.userResource(n).fetch(this.folderId,"removeUserFromAcls",i):e.$$resource.fetch(this.folderId,"removeUserFromAcls",i)).then(function(){var e=_.indexOf(_.map(r.users,"uid"),t);e>=0&&(r.users[e].$shadowRights=null,r.users.splice(e,1))})},e.prototype.$selectAllRights=function(e){_.forEach(e.rights,function(t,n){angular.isNumber(e.rights[n])&&(e.rights[n]=1)})},e.prototype.$resetUsersRights=function(){angular.forEach(this.users,function(e){e.$resetRights()})},e.prototype.$saveUsersRights=function(t){var n=this,r=e.$q.defer(),i=e.$q.defer(),o={action:"saveUserRights"},s=[];if(angular.forEach(this.users,function(e){e.$rightsAreDirty()&&s.push(e.$omit())}),s.length){(angular.isDefined(t)?e.$$resource.userResource(t).save(this.folderId,s,o):e.$$resource.save(this.folderId,s,o)).then(function(){angular.forEach(n.users,function(e){e.$rightsAreDirty()&&(e.$shadowRights=angular.copy(e.rights))}),r.resolve()},r.reject)}else r.resolve();return s=[],angular.forEach(this.users,function(e){!e.wasSubscribed&&e.isSubscribed&&s.push(e.uid)}),s.length?(o={uids:s.join(",")},e.$$resource.fetch(this.folderId,"subscribeUsers",o).then(function(){angular.forEach(n.users,function(e){e.wasSubscribed=e.isSubscribed}),i.resolve()},i.reject)):i.resolve(),e.$q.all([r.promise,i.promise])}}(),function(){"use strict";function e(){this.currentAlarm=null}function t(t,n,r,i){return angular.extend(e,{$timeout:t,$$resource:new r(n.activeUser("folderURL")+"Calendar",n.activeUser()),$toast:i}),e}e.getAlarms=function(){var t=this,n=new Date,r=Math.floor(n.getTime()/1e3);this.$$resource.fetch("","alarmslist?browserTime="+r).then(function(n){var r=n.alarms.sort(function(e,t){var n=parseInt(e[2]);return parseInt(t[2])-n});if(r.length>0){var i=r.pop(),o=new Date,s=Math.floor(o.getTime()/1e3),a=i[0]+"/"+i[1],l=parseInt(i[2]),c=l;l>0&&(c-=s);new Date(1e3*l);var u=angular.bind(t,e.showAlarm,a);t.currentAlarm&&t.$timeout.cancel(t.currentAlarm),t.currentAlarm=t.$timeout(u,1e3*c)}})},e.showAlarm=function(e){var t=this;this.$$resource.fetch(e,"?resetAlarm=yes").then(function(n){function r(e,r,i){e.summary=n.summary,e.reminder="10",e.close=function(){r.hide()},e.snooze=function(){t.$$resource.fetch(i,"view?snoozeAlarm="+e.reminder),r.hide()}}t.$toast.show({position:"top right",hideDelay:0,template:["<md-toast>",' <div class="md-toast-content">',' <div layout="column" layout="start end">',' <p class="sg-padded--top">{{ summary }}</p>',' <div layout="row" layout-align="start center">'," <md-input-container>",' <label style="color: white">{{ "Snooze for " | loc }}</label>',' <md-select ng-model="reminder">',' <md-option value="5">',l("5 minutes")," </md-option>",' <md-option value="10">',l("10 minutes")," </md-option>",' <md-option value="15">',l("15 minutes")," </md-option>",' <md-option value="30">',l("30 minutes")," </md-option>",' <md-option value="45">',l("45 minutes")," </md-option>",' <md-option value="60">',l("1 hour")," </md-option>",' <md-option value="1440">',l("1 day")," </md-option>"," </md-select>"," </md-input-container>",' <md-button ng-click="snooze()">',l("Snooze")," </md-button>",' <md-button ng-click="close()">',l("Close")," </md-button>"," </div>"," </div>"," </div>","</md-toast>"].join(""),locals:{url:e},controller:r}),r.$inject=["scope","$mdToast","url"]})},t.$inject=["$timeout","sgSettings","Resource","$mdToast"],angular.module("SOGo.Common").factory("Alarm",t)}(),function(){"use strict";function e(){function e(e,t){var n,r,i,o,s;return n=e,t&&(n+="@"+t.value),r=""+window.location.href,"/"==(i=ApplicationBaseURL+encodeURIComponent(n))[0]&&(s=(o=r.split("/"))[2],i=o[0]+"//"+s+i),r.startsWith(i)&&!r.endsWith("/logoff")?r:i}function t(t,n,r,i){function o(){var e=null,t=r.get("0xHIGHFLYxSOGo");return t&&t.length>8&&(e=decodeURIComponent(t.substr(8)).base64decode().split(":")),e}return{login:function(r){var s,a=t.defer(),c=r.username,u=r.password,d=r.domain,h=r.rememberLogin?1:0;return r.loginSuffix&&!c.endsWith(r.loginSuffix)&&(c+=loginSuffix,d=!1),r.language&&"WONoSelectionString"!=r.language&&(s=r.language),n({method:"POST",url:"/SOGo/connect",data:{userName:c,password:u,domain:d,language:s,rememberLogin:h}}).then(function(t){var n=t.data;o()?void 0!==n.expire&&void 0!==n.grace?n.expire<0&&n.grace>0?a.reject({grace:n.grace}):n.expire>0&&-1==n.grace?a.reject({expire:n.expire}):a.resolve({cn:n.cn,url:e(c,d)}):a.resolve({url:e(c,d)}):a.reject(l("cookiesNotEnabled"))},function(e){var t,n,r=e.data;t=r&&r.LDAPPasswordPolicyError?(n=r.LDAPPasswordPolicyError)==i.PolicyNoError?l("Wrong username or password."):n==i.PolicyAccountLocked?l("Your account was locked due to too many failed attempts."):l("Login failed due to unhandled error case: ")+n:l("Unhandled error response"),a.reject({error:t})}),a.promise},changePassword:function(e){var s=t.defer(),a=o(),c=r.get("XSRF-TOKEN");return r.remove("XSRF-TOKEN",{path:"/SOGo/"}),n({method:"POST",url:"/SOGo/so/changePassword",headers:{"X-XSRF-TOKEN":c},data:{userName:a[0],password:a[1],newPassword:e}}).then(s.resolve,function(e){var t,n=e.data.LDAPPasswordPolicyError;n?n==i.PolicyNoError?t=l("Password change failed"):n==i.PolicyPasswordModNotAllowed?t=l("Password change failed - Permission denied"):n==i.PolicyInsufficientPasswordQuality?t=l("Password change failed - Insufficient password quality"):n==i.PolicyPasswordTooShort?t=l("Password change failed - Password is too short"):n==i.PolicyPasswordTooYoung?t=l("Password change failed - Password is too young"):n==i.PolicyPasswordInHistory?t=l("Password change failed - Password is in history"):(t=l("Unhandled policy error: %{0}").formatted(n),n=i.PolicyPasswordUnknown):(n=i.PolicyPasswordSystemUnknown,t=_("Unhandled error response")),r.put("XSRF-TOKEN",c,{path:"/SOGo/"}),s.reject(t)}),s.promise}}}this.$get=t,t.$inject=["$q","$http","$cookies","passwordPolicyConfig"]}angular.module("SOGo.Authentication",["ngCookies"]).constant("passwordPolicyConfig",{PolicyPasswordChangeUnsupported:-3,PolicyPasswordSystemUnknown:-2,PolicyPasswordUnknown:-1,PolicyPasswordExpired:0,PolicyAccountLocked:1,PolicyChangeAfterReset:2,PolicyPasswordModNotAllowed:3,PolicyMustSupplyOldPassword:4,PolicyInsufficientPasswordQuality:5,PolicyPasswordTooShort:6,PolicyPasswordTooYoung:7,PolicyPasswordInHistory:8,PolicyNoError:65535}).provider("Authentication",e)}(),function(){"use strict";function e(){}function t(t,n){return angular.extend(e,{$q:t,$modal:n}),e}e.alert=function(e,t){var n=this.$modal.alert().title(e).htmlContent(t).ok(l("OK"));this.$modal.show(n)},e.confirm=function(e,t,n){var r=this.$modal.confirm().title(e).htmlContent(t).ok(n&&n.ok?n.ok:l("OK")).cancel(n&&n.cancel?n.cancel:l("Cancel"));return this.$modal.show(r)},e.prompt=function(e,t,n){function r(t,n){t.title=e,t.name="",t.cancel=function(){s.reject(),n.hide()},t.ok=function(){s.resolve(t.name),n.hide()}}var i=n||{},o=e.asCSSIdentifier(),s=this.$q.defer();return this.$modal.show({parent:angular.element(document.body),clickOutsideToClose:!0,escapeToClose:!0,template:['<md-dialog flex="50" flex-xs="90">',' <form name="'+o+'Form" ng-submit="ok()">',' <md-dialog-content class="md-dialog-content" layout="column">',' <h2 class="md-title" ng-bind="title"></h2>'," <md-input-container>"," <label>"+t+"</label>",' <input type="'+(i.inputType||"text")+'"',' aria-label="'+e+'"',' ng-model="name" md-autofocus="true" required />'," </md-input-container>"," </md-dialog-content>"," <md-dialog-actions>",' <md-button ng-click="cancel()">'," "+l("Cancel")," </md-button>",' <md-button type="submit" class="md-primary" ng-disabled="'+o+'Form.$invalid">'," "+l("OK")," </md-button>"," </md-dialog-actions>"," </form>","</md-dialog>"].join(""),controller:r}),r.$inject=["scope","$mdDialog"],s.promise},t.$inject=["$q","$mdDialog"],angular.module("SOGo.Common").factory("Dialog",t)}(),function(){"use strict";function e(){return function(e,t,n,r){var i,o,s,a=t,l=n;return e?((i=e.indexOf("<"))>=0&&(o=e.indexOf(">",i))>i&&(e=e.substring(i+1,o)),t||(a=48),s=e.md5(),l&&"none"!=l||(n=r&&r.no_404?"mm":"404"),"https://www.gravatar.com/avatar/"+s+"?s="+a+"&d="+n):""}}angular.module("SOGo.Common").factory("Gravatar",e)}(),function(){"use strict";function e(e,t,n,r,i){angular.extend(this,{_http:e,_q:t,_path:n,_activeUser:r}),angular.extend(this,i),this._path=this._path.replace(/\/$/,"")}e.$factory=["$http","$q",function(t,n){return function(r,i,o){return new e(t,n,r,i,o)}}],angular.module("SOGo.Common").factory("Resource",e.$factory),e.prototype.userResource=function(t){var n=_.compact(this._activeUser.folderURL.split("/"));return t&&n.splice(n.length-1,1,escape(t)),new e(this._http,this._q,"/"+n.join("/"),this._activeUser)},e.prototype.path=function(){var e=[this._path];return arguments.length>0&&Array.prototype.push.apply(e,Array.prototype.slice.call(arguments)),e.join("/")},e.prototype.fetch=function(e,t,n){var r=this._q.defer(),i=[this._path];return e&&i.push(e.split("/")),t&&i.push(t),i=_.compact(_.flatten(i)).join("/"),this._http({method:"GET",url:i,params:n}).then(function(e){return r.resolve(e.data)},r.reject),r.promise},e.prototype.newguid=function(e){var t=this._q.defer(),n=this._path+"/"+e+"/newguid";return this._http.get(n).then(function(e){return t.resolve(e.data)},t.reject),t.promise},e.prototype.create=function(e,t){var n=this._q.defer(),r=this._path+"/"+e;return this._http.post(r,{name:t}).then(function(e){return n.resolve(e.data)},n.reject),n.promise},e.prototype.post=function(e,t,n){var r=this._q.defer(),i=[this._path];return e&&i.push(e),t&&i.push(t),i=_.compact(_.flatten(i)).join("/"),this._http.post(i,n).then(function(e){return r.resolve(e.data)},r.reject),r.promise},e.prototype.save=function(e,t,n){var r=n&&n.action?n.action:"save";return this.post(e,r,t)},e.prototype.download=function(e,t,n,r){function i(e){return e?e.split(";")[1].trim().split("=")[1].replace(/"/g,""):null}this._q.defer();var o=r&&r.type?r.type:"application/zip",s=[this._path];return e&&s.push(e),t&&s.push(t),s=_.compact(_.flatten(s)).join("/"),this._http({method:"POST",url:s,data:n,headers:{accept:o},responseType:"arraybuffer",cache:!1,transformResponse:function(e,t,n){var s,a=null;if(n<200||n>299)throw new Error("Bad gateway");if(e&&(a=new Blob([e],{type:o})),r&&r.filename?s=r.filename:i(t("content-disposition")),!saveAs)throw new Error("To use Resource.download, FileSaver.js must be loaded.");saveAs(a,s)}})},e.prototype.remove=function(e){var t=this._q.defer(),n=this._path+"/"+e+"/delete";return this._http.get(n).then(function(e){return t.resolve(e.data)},t.reject),t.promise}}(),function(){"use strict";function e(e,t){return function(n){t(function(){e.$broadcast("sgFocusOn",n)})}}e.$inject=["$rootScope","$timeout"],angular.module("SOGo.Common").factory("sgFocus",e)}(),function(){"use strict";function e(){function e(e,r){var i=function(t){return function(n,r){e.$apply(function(){t.call(this,n,r)}.bind(this))}},o=function(e){this.id=e.id||guid(),this.key=e.key,this.description=e.description||null,this.context=e.context||null,this.callback=e.callback,this.preventInClass=e.preventInClass,this.args=e.args,this.onKeyUp=!1,this.key.length>1&&(this.lkey=l("key_"+this.key))};o.prototype.clone=function(){return new o(this)};var s=function(){this._hotkeys={},this._hotkeysUp={},this._preventIn=["INPUT","SELECT","TEXTAREA","MD-OPTION"],this._preventInClass=["md-chip-content"],this._onKeydown=this._onKeydown.bind(this),this._onKeyup=this._onKeyup.bind(this),this._onKeypress=this._onKeypress.bind(this),this.initialize()};return s.prototype.initialize=function(){this.registerHotkey(this.createHotkey({key:"?",description:l("Show or hide this help"),callback:this._toggleCheatSheet.bind(this)})),r.addEventListener("keydown",this._onKeydown,!0),r.addEventListener("keyup",this._onKeyup,!0),r.addEventListener("keypress",this._onKeypress,!0)},s.prototype._invokeHotkeyHandlers=function(e,t,n){for(var r=0,i=n.length;r<i;r++){var o=n[r],s=e.target||e.srcElement,a=s.nodeName.toUpperCase();if(!_.includes(this._preventIn,a)&&0===_.intersection(s.classList,this._preventInClass).length&&0===_.intersection(s.classList,o.preventInClass).length)try{o.callback.call(o.context,e,o.args)}catch(e){console.error("HotKeys: ",o.key,e.message)}}},s.prototype._onKeydown=function(e){var t=this.keyStringFromEvent(e);this._hotkeys[t]&&this._invokeHotkeyHandlers(e,t,this._hotkeys[t])},s.prototype._onKeyup=function(e){var t=this.keyStringFromEvent(e);this._hotkeysUp[t]&&this._invokeHotkeyHandlers(this._hotkeysUp[t],t)},s.prototype._onKeypress=function(e){var t,r;t=e.keyCode||e.which,(r=n[t])&&this._hotkeys[r]&&this._invokeHotkeyHandlers(e,r,this._hotkeys[r])},s.prototype.keyStringFromEvent=function(e){var n=[],r=e.which;return r=t[r]?t[r]:String.fromCharCode(r).toLowerCase(),e.ctrlKey&&n.push("ctrl"),e.altKey&&n.push("alt"),e.shiftKey&&n.push("shift"),e.metaKey&&n.push("meta"),n.push(r),_.uniq(n).join("+")},s.prototype._deregisterHotkey=function(e){var t,n=this._hotkeys;if(e.onKeyUp&&(n=this._hotkeysUp),n[e.key]){for(var r=n[e.key],i=0;i<r.length;++i){var o=r[i];(e.callback===o.callback&&o.context===e.context||e.id===o.id)&&(t=r.splice(i,1))}0===r.length&&delete this._hotkeys[e.key]}return t},s.prototype.deregisterHotkey=function(e){var t=[];if(this._validateHotkey(e),angular.isArray(e.key))for(var n=e.key.length-1;n>=0;n--){var r=e.clone();r.key=e.key[n];var i=this._deregisterHotkey(r);void 0!==i&&t.push(i[0])}else t.push(this._deregisterHotkey(e));return t},s.prototype._validateHotkey=function(e){if(!(e instanceof o))throw new TypeError("Hotkeys: Expected a hotkey object be instance of HotKey")},s.prototype._registerKey=function(e){var t=this._hotkeys;return e.onKeyUp&&(t=this._hotkeysUp),t[e.key]=t[e.key]||[],t[e.key].push(e),e},s.prototype._registerKeys=function(e){var t=[];if(angular.isArray(e.key))for(var n=e.key.length-1;n>=0;n--){var r=e.clone();r.id=guid(),r.key=e.key[n],t.push(this._registerKey(r))}else t.push(this._registerKey(e));return t},s.prototype.registerHotkey=function(e){return this._validateHotkey(e),this._registerKeys(e)},s.prototype.registerHotkeyUp=function(e){this._validateHotkey(e),e.onKeyUp=!0,this._registerKeys(e)},s.prototype.createHotkey=function(e){if(null===e.key||void 0===e.key)throw new TypeError('HotKeys: Argument "key" is required');if(null===e.callback||void 0===e.callback)throw new TypeError('HotKeys: Argument "callback" is required');return e.callback=i(e.callback),new o(e)},s.prototype.match=function(e,t){angular.isArray(t)||(t=[t]);var n=this.keyStringFromEvent(e);return Boolean(~t.indexOf(n))},s.prototype._toggleCheatSheet=function(){function e(e,t){e.hotkeys=t,e.closeDialog=function(){s.$modal.hide()}}var t=this;this._cheatSheet?(s.$modal.hide(),this._cheatSheet=null):this._cheatSheet=s.$modal.show({clickOutsideToClose:!0,escapeToClose:!0,template:["<md-dialog>"," <md-dialog-content>"," <md-list>",' <md-list-item ng-repeat="(hotkey, keys) in hotkeys">',' <div class="sg-hotkey-container">'," <sg-hotkey>{{keys[0].lkey || hotkey}}</sg-hotkey>"," </div>"," {{keys[0].description}}"," </md-list-item>"," </md-list>"," </md-dialog-content>","</md-dialog>"].join(""),controller:e,locals:{hotkeys:t._hotkeys}}).finally(function(){t._cheatSheet=null}),e.$inject=["$scope","hotkeys"]},s}var t={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"caps",27:"escape",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"delete",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12"},n={42:"*",63:"?"};this.$get=e,e.$inject=["$rootScope","$window"]}function t(e,t){return angular.extend(t,{$modal:e}),new t}t.$inject=["$mdDialog","$sgHotkeys"],angular.module("SOGo.Common").service("sgHotkeys",t).provider("$sgHotkeys",e)}(),function(){"use strict";function e(e){e&&this.init(e)}e.factory=["$q","$log","sgSettings","Resource",function(t,n,r,i){return angular.extend(e,{$q:t,$log:n,$$resource:new i(r.activeUser("folderURL"),r.activeUser()),$query:"",$users:[]}),e}],angular.module("SOGo.Common").factory("User",e.factory),e.$filter=function(t,n,r){var i=e.$$resource,o={search:t};if(r&&r.dry)r&&r.uid&&(i=e.$$resource.userResource(r.uid));else{if(!t)return e.$users.splice(0,e.$users.length),e.$q.when(e.$users);if(e.$query==t)return e.$q.when(e.$users);e.$query=t}return i.fetch(null,"usersSearch",o).then(function(t){var i,o,s,a,l=function(e){return this.uid==e.uid};for(r?r.dry?a=[]:r.results&&(a=r.results):a=e.$users,i=n?_.filter(t.users,function(e){return!_.find(n,_.bind(l,e))}):t.users,o=a.length-1;o>=0;o--)s=a[o],_.find(i,_.bind(l,s))||a.splice(o,1);return _.forEach(i,function(t,n){if(_.isUndefined(_.find(a,_.bind(l,t)))){var r=new e(t);a.splice(n,0,r)}}),e.$log.debug(a),a})},e.prototype.init=function(e){angular.extend(this,e),this.$$shortFormat||(this.$$shortFormat=this.$shortFormat()),this.$$image||(this.$$image=this.image),this.$avatarIcon=this.$isGroup()||this.$isSpecial()?"group":"person",this.empty=" "},e.prototype.$fullname=function(){var e=this.cn||this.uid;return this.c_info&&(e+=" ("+this.c_info.split("\n").join("; ")+")"),e},e.prototype.$shortFormat=function(e){var t=this.$fullname(),n=this.c_email;return!(e&&!1===e.email)&&n&&t!=n&&(t+=" <"+n+">"),t},e.prototype.$acl=function(t,n){var r=this,i=e.$q.defer(),o={uid:this.uid};if(this.$shadowRights)i.resolve(this.rights);else{(angular.isDefined(n)?e.$$resource.userResource(n).fetch(t,"userRights",o):e.$$resource.fetch(t,"userRights",o)).then(function(e){return r.rights=e,r.$shadowRights=angular.copy(e),i.resolve(e),e})}return i.promise},e.prototype.$isGroup=function(){return this.isGroup||this.userClass&&"normal-group"==this.userClass},e.prototype.$isAnonymous=function(){return"anonymous"==this.uid},e.prototype.$isSpecial=function(){return this.userClass&&"public-user"==this.userClass},e.prototype.$confirmRights=function(e){var t=!1;return!this.$confirmation&&(_.some(_.values(this.rights))&&("anonymous"==this.uid?"AddressBook"==e.constructor.name?t=l('Potentially anyone on the Internet will be able to access your address book "%{0}", even if they do not have an account on this system. Is this information suitable for the public Internet?',e.name):"Calendar"==e.constructor.name&&(t=l('Potentially anyone on the Internet will be able to access your calendar "%{0}", even if they do not have an account on this system. Is this information suitable for the public Internet?',e.name)):"anyone"!=this.uid&&"<default>"!=this.uid||("AddressBook"==e.constructor.name?t=l('Any user with an account on this system will be able to access your address book "%{0}". Are you certain you trust them all?',e.name):"Calendar"==e.constructor.name?t=l('Any user with an account on this system will be able to access your calendar "%{0}". Are you certain you trust them all?',e.name):"Mailbox"==e.constructor.name&&(t=l('Any user with an account on this system will be able to access your mailbox "%{0}". Are you certain you trust them all?',e.name)))),this.$confirmation=t,t)},e.prototype.$rightsAreDirty=function(){return this.rights&&!_.isEqual(this.rights,this.$shadowRights)},e.prototype.$resetRights=function(e){var t=this;e?_.map(_.keys(this.rights),function(e){angular.isString(t.rights[e])?t.rights[e]="None":t.rights[e]=0}):this.$shadowRights&&(this.rights=angular.copy(this.$shadowRights))},e.prototype.$folders=function(t){var n=this,r=e.$q.defer(),i={type:t};return this.$$folders?r.resolve(this.$$folders):e.$$resource.userResource(this.uid).fetch(null,"foldersSearch",i).then(function(e){n.$$folders=e.folders,r.resolve(e.folders)}),r.promise},e.prototype.$omit=function(){var e={};return angular.forEach(this,function(t,n){"constructor"!=n&&"$"!=n[0]&&(e[n]=t)}),e},e.prototype.toString=function(){return"[User "+this.c_email+"]"}}(),function(){"use strict";function e(){function e(e,t,n,r){var i,o=t.find("img"),s=t.find("md-icon"),a=angular.element(s[0]),l=angular.element(s[1]);n.size&&(o.attr("width",n.size),o.attr("height",n.size),a.css("font-size",n.size+"px"),l.css("font-size",parseInt(.4*n.size)+"px")),angular.isDefined(n.ngDisabled)&&(i=e.$watch(n.ngDisabled,function(e){n.disabled&&l.css({display:"block"}),i()})),r.img=o,r.genericImg=a}return{restrict:"AE",scope:{},bindToController:{size:"@",email:"=sgEmail",src:"=sgSrc"},transclude:!0,template:['<div class="sg-icon-badge-container">'," <md-icon ng-transclude></md-icon>",' <md-icon class="md-warn sg-icon--badge sg-icon--badge-bottom"',' style="display: none">not_interested</md-icon>',' <img class="ng-hide" ng-src="{{vm.url}}">',"</div>"].join(""),link:e,controller:"sgAvatarImageController",controllerAs:"vm"}}function t(e,t,n,r,i,o){function s(e){var t=o(e,u.size,i.defaults.SOGoAlternateAvatar);n({method:"GET",url:t,cache:!0,headers:{Accept:"image/*"}}).then(function(){u.url||(u.url=t,u.urlEmail=e,l())},function(){a()})}function a(){u.url=null,u.urlEmail=null,u.img.addClass("ng-hide"),u.genericImg.removeClass("ng-hide")}function l(){u.genericImg.addClass("ng-hide"),u.img.removeClass("ng-hide")}function c(){t.addClass("sg-avatar-image--zoomable"),d=function(){t.toggleClass("sg-avatar-image--zoom")},t.on("click",d)}var u,d;u=this,e.$on("$destroy",function(){d&&t.off("click",d)}),e.$watch(function(){return u.email},function(e,t){e&&u.urlEmail!=e?(a(),i.defaults.SOGoGravatarEnabled&&s(e)):e||a()}),"sg-src"in t[0].attributes&&e.$watch(function(){return u.src},function(e){e&&(u.url=e,u.urlEmail=""+u.email,c(),l())})}t.$inject=["$scope","$element","$http","$q","Preferences","Gravatar"],angular.module("SOGo.Common").directive("sgAvatarImage",e).controller("sgAvatarImageController",t)}(),function(){"use strict";function e(e,t,n,r){function i(i,s){return i.on("click",function(e){this.hasAttribute("disabled")&&e.stopImmediatePropagation()}),function(i,s,a,l){function c(e,t,n,r,i){var o;if(angular.isDefined(r)){if(!(o=e(r)).constant)throw Error("Expected constant expression for `"+n+"`, but saw `"+r+"`.");return o(t)}return i}function u(e){s[0].hasAttribute("disabled")||i.$apply(function(){var t=l.$viewValue==h?m:h;l.$setViewValue(t,e&&e.type),l.$render()})}function d(){l.$viewValue==h?s.addClass(o):s.removeClass(o)}var h=c(e,i,"sgTrueValue",a.sgTrueValue,!0),m=c(e,i,"sgFalseValue",a.sgFalseValue,!1);l=l||r.fakeNgModel(),n(s),t.expectWithText(s,"aria-label"),s.on("click",u),l.$render=d}}var o="sg-checked";return{restrict:"E",replace:!0,transclude:!0,require:"?ngModel",template:['<button class="md-button sg-checkmark" type="button">'," <md-icon>check</md-icon>"," <span ng-transclude></span","</button>"].join(""),compile:i}}angular.module("SOGo.Common").directive("sgCheckmark",e),e.$inject=["$parse","$mdAria","$mdTheming","$mdUtil"]}(),function(){"use strict";function e(){return{restrict:"E",require:"ngModel",template:[' <md-button class="md-icon-button"',' label:aria-label="Options"',' ng-click="$ctrl.showPicker($event)">'," <md-icon>format_color_fill</md-icon>"," </md-button>"].join(""),controller:t,controllerAs:"$ctrl"}}function t(e,t,n,r){function i(e){a=e,o.buttonIcon.css("color",a)}var o,s,a;this.$onInit=function(){o=this,s=t.controller("ngModel")},this.$postLink=function(){this.buttonIcon=t.find("md-icon"),s.$render=function(){i(s.$viewValue)}},this.showPicker=function(e){function t(e,t,n,r){this.setColor=function(e,t){e&&(_.forEach(e.currentTarget.parentElement.children,function(e){e.classList.remove("selected")}),e.currentTarget.classList.add("selected")),i(t),s.$setViewValue(t)}}for(var l=n.newPanelPosition().relativeTo(o.buttonIcon).addPanelPosition(n.xPosition.ALIGN_START,n.yPosition.ALIGN_TOPS),c=n.newPanelAnimation().openFrom(o.buttonIcon).duration(100).withAnimation(n.animation.FADE),u=[],d="",h=0;h<r.selection.length;h++){var m=r.selection[h],g=contrast(m),p=m==a;h%7==0&&(d.length&&u.push(d),d=""),d+="<span ",p&&(d+='class="selected" '),d+='style="background-color: '+m+'" ng-click="$menuCtrl.setColor($event, \''+m+"')\">",p&&(d+='<md-icon class="icon-check" style="color: '+g+'"></md-icon>'),d+="</span>"}var f={attachTo:angular.element(document.body),bindToController:!0,controller:t,controllerAs:"$menuCtrl",position:l,animation:c,targetEvent:e,template:['<div class="sg-color-picker-panel" md-whiteframe="3">'," <div>"+u.join("</div><div>")+"</div>","</div>"].join(""),trapFocus:!0,clickOutsideToClose:!0,escapeToClose:!0,focusOnOpen:!0};n.open(f).then(function(e){e.panelEl.one("click",function(){e.close()})}),t.$inject=["mdPanelRef","$state","$mdDialog","User"]}}t.$inject=["$scope","$element","$mdPanel","sgColors"],angular.module("SOGo.Common").directive("sgColorPicker",e)}(),function(){"use strict";function e(e){function t(t,n,r){var i=t.$watch(function(e){return e.$eval(r.sgCompile)},function(r){n.html(r),e(n.contents())(t),i()})}return{restrict:"A",link:t}}e.$inject=["$compile"],angular.module("SOGo.Common").directive("sgCompile",e)}(),function(){"use strict";function e(){function e(e,t,n,r){function i(){return t.find("input").eq(0)}var o=e.$watch(i,function(e){e.length&&(o(),e.prop("disabled",!0),e.parent().addClass("sg-datepicker-readonly-input-container"))})}return{link:e,require:"mdDatepicker",restrict:"A"}}angular.module("SOGo.Common").directive("sgDatepickerReadonlyInput",e)}(),function(){"use strict";function e(e,t,n,r,i){function o(o,s,a){function l(e,t,r,i){if(this.$element=e,this.folder=t,this.dragStart=r,this.count=i,this.helper=n.find("sg-draggable-helper"),!this.helper)throw Error("sg-draggable requires a sg-draggable-helper element.");this.bindedOnDragDetect=angular.bind(this,this.onDragDetect),this.bindedOnDrag=angular.bind(this,this.onDrag),this.$element.on("mousedown",this.bindedOnDragDetect)}var c;r(function(){var t,n,r;t=e(a.sgDraggable)(o),n=a.sgDragStart?e(a.sgDragStart):null,r=a.sgDragCount?e(a.sgDragCount):null,c=new l(s,t,n,r)}),o.$on("$destroy",function(){c.$destroy()}),l.prototype={dragHasStarted:!1,$destroy:function(){this.$element.off("mousedown",this.bindedOnDragDetect)},getDistanceFromStart:function(e){var t={x:this.startPosition.clientX-e.clientX,y:this.startPosition.clientY-e.clientY};return Math.sqrt(t.x*t.x+t.y*t.y)},onDragDetect:function(e){e.stopPropagation(),this.dragStart&&!this.dragStart(o)||(n.on("mousemove",this.bindedOnDrag),n.one("mouseup",angular.bind(this,this.onDragEnd)))},onDrag:function(e){var n;this.startPosition?!this.dragHasStarted&&this.getDistanceFromStart(e)>10&&(n=this.helper.find("sg-draggable-helper-counter"),this.dragHasStarted=!0,this.helper.removeClass("ng-hide"),this.count&&this.count(o)>1?n.text(this.count(o)).removeClass("ng-hide"):n.addClass("ng-hide"),i.debug("emit folder:dragstart"),t.$emit("folder:dragstart",this.folder)):this.startPosition={clientX:e.clientX,clientY:e.clientY},this.dragHasStarted&&(e.shiftKey?this.helper.addClass("sg-draggable-helper--copy"):this.helper.removeClass("sg-draggable-helper--copy"),this.helper.css({top:e.pageY+5+"px",left:e.pageX+5+"px"}))},onDragEnd:function(e){this.startPosition=null,n.off("mousemove",this.bindedOnDrag),this.dragHasStarted&&(i.debug("emit folder:dragend"),t.$emit("folder:dragend",this.folder,e.shiftKey?"copy":"move"),this.dragHasStarted=!1,this.helper.addClass("ng-hide"))}}}return{restrict:"A",link:o}}e.$inject=["$parse","$rootScope","$document","$timeout","$log"],angular.module("SOGo.Common").directive("sgDraggable",e)}(),function(){"use strict";function e(e,t,n,r,i){function o(n,r,i){function o(e){d=!0,r.addClass("sg-droppable-over")}function s(e){d=!1,this.classList.remove("sg-droppable-over"),r.off("mousemove")}var a,l,c,u,d=!1;if(!i.sgDrop)throw Error("sg-droppable requires a sg-drop action.");d=!1,l=e(i.sgDroppable),a=e(i.sgDrop),c=t.$on("folder:dragstart",function(e,t){l(n,{dragFolder:t})&&(r.on("mouseenter",o),r.on("mouseleave",s))}),u=t.$on("folder:dragend",function(e,t,i){r.off("mouseenter"),r.off("mouseleave"),d&&(angular.bind(r[0],s)(e),a(n,{dragFolder:t,dragMode:i}))}),n.$on("destroy",function(){c(),u()})}return{restrict:"A",link:o}}e.$inject=["$parse","$rootScope","$document","$timeout","$log"],angular.module("SOGo.Common").directive("sgDroppable",e)}(),function(){"use strict";function e(){return function(e,t,n){t.bind("keydown keypress",function(t){13===t.which&&(e.$apply(n.sgEnter),t.preventDefault())})}}angular.module("SOGo.Common").directive("sgEnter",e)}(),function(){"use strict";function e(){return function(e,t,n){t.bind("keydown",function(t){27===t.keyCode&&e.$apply(n.sgEscape)})}}angular.module("SOGo.Common").directive("sgEscape",e)}(),function(){"use strict";function e(){return function(e,t,n){e.$on("sgFocusOn",function(e,r){r===n.sgFocusOn&&(t[0].focus(),"function"==typeof t[0].select&&t[0].select())})}}angular.module("SOGo.Common").directive("sgFocusOn",e)}(),function(){"use strict";function e(){function e(){var e=this;e.contrast=contrast,e.transparent=function(e,t){var n=hexToRgb(e);return["rgba("+n.r,n.g,n.b,t+")"].join(",")}}return{restrict:"E",require:"ngModel",scope:{ngModel:"="},replace:!0,bindToController:!0,controller:e,controllerAs:"cssCtrl",template:['<style type="text/css">'," .bg-folder{{ cssCtrl.ngModel.id }} {"," background-color: {{ cssCtrl.ngModel.color }} !important;"," color: {{ cssCtrl.contrast(cssCtrl.ngModel.color) }} !important;"," }"," .sg-event.bg-folder{{ cssCtrl.ngModel.id }} md-icon {"," color: {{ cssCtrl.contrast(cssCtrl.ngModel.color) }} !important;"," }"," md-toolbar.bg-folder{{ cssCtrl.ngModel.id }} md-icon:not(.sg-icon-toolbar-bg) {"," color: {{ cssCtrl.contrast(cssCtrl.ngModel.color) }} !important;"," }"," .bg-folder{{ cssCtrl.ngModel.id }} label,"," .bg-folder{{ cssCtrl.ngModel.id }} .md-input {"," color: {{ cssCtrl.contrast(cssCtrl.ngModel.color) }} !important;"," opacity: 0.8;"," }"," .fg-folder{{ cssCtrl.ngModel.id }},"," .sg-event.fg-folder{{ cssCtrl.ngModel.id }} md-icon {"," color: {{ cssCtrl.ngModel.color }} !important;"," }"," .bdr-folder{{ cssCtrl.ngModel.id }} {"," border-color: {{ cssCtrl.ngModel.color }} !important;"," }"," .contrast-bdr-folder{{ cssCtrl.ngModel.id }} {"," border-color: {{ cssCtrl.contrast(cssCtrl.ngModel.color) }} !important;"," }"," .checkbox-folder{{ cssCtrl.ngModel.id }} .md-icon {"," background-color: {{ cssCtrl.ngModel.color }} !important;"," }"," .checkbox-folder{{ cssCtrl.ngModel.id }}.md-checked .md-icon:after {"," border-color: {{ cssCtrl.contrast(cssCtrl.ngModel.color) }} !important;"," }"," .md-switch-folder{{ cssCtrl.ngModel.id }}.md-checked .md-thumb {"," background-color: {{ cssCtrl.ngModel.color }} !important;"," }"," .md-switch-folder{{ cssCtrl.ngModel.id }}.md-checked .md-bar {",' background-color: {{ cssCtrl.transparent(cssCtrl.ngModel.color, "0.5") }} !important;'," }"," .md-switch-folder{{ cssCtrl.ngModel.id }} .md-bar {",' background-color: {{ cssCtrl.transparent(cssCtrl.ngModel.color, "0.3") }} !important;'," }","</style>"].join("")}}angular.module("SOGo.Common").directive("sgFolderStylesheet",e)}(),function(){"use strict";function e(){return{restrict:"A",require:"ngModel",link:function(e,t,n,r){r&&r.$pristine&&!r.$dirty&&(r.$pristine=!1,r.$dirty=!0)}}}angular.module("SOGo.Common").directive("sgNoDirtyCheck",e)}(),function(){"use strict";function e(){return{restrict:"A",scope:{placeholder:"=sgPlaceholder"},link:function(e,t,n){e.$watch("placeholder",function(){t[0].placeholder=e.placeholder})}}}angular.module("SOGo.Common").directive("sgPlaceholder",e)}(),function(){"use strict";function e(){function e(e,t,n,r){function i(){return t.find("input").eq(0)}var o=e.$watch(i,function(e){e.length&&(o(),r.$scope.$watch("ctrl.isDisabled",function(e){e&&r.ngModelCtrl.$invalid&&r.$scope.$emit("md-calendar-change",r.date)}))})}return{link:e,require:"mdDatepicker",restrict:"A"}}angular.module("SOGo.Common").directive("sgResetOnDisabled",e)}(),function(){"use strict";function e(e,t){function n(n,r){return function(n,r,i){function o(e){var n;r[0].hasAttribute("disabled")||(n=e.pageX&&e.pageY?{left:e.pageX,top:e.pageY}:e.target.getBoundingClientRect(),a.classList.contains("ng-hide")?(angular.element(l).css({overflow:"hidden",position:"relative"}),angular.element(a).css({top:l.scrollTop+"px"}),t(function(){s.css({top:n.top-l.offsetTop+l.scrollTop+"px",left:n.left-l.offsetLeft+"px",height:"400vmin",width:"400vmin"}),a.classList.remove("ng-hide")})):(s.css({top:n.top-l.offsetTop+l.scrollTop+"px",left:n.left-l.offsetLeft+"px",height:"0px",width:"0px"}),a.classList.add("ng-hide"),t(function(){angular.element(l).css({overflow:"",position:""})},800)))}var s,a,l,c;for(c=r.attr("sg-ripple-click"),l=r[0].parentNode;l&&l.id!=c;)l=l.parentNode;l?(a=l.querySelector("sg-ripple-content"))?((s=l.querySelector("sg-ripple"))?s=angular.element(s):(s=angular.element('<sg-ripple class="md-default-theme md-bg"></sg-ripple>'),l.appendChild(s[0]),a.classList.contains("ng-hide")||a.classList.add("ng-hide")),r.on("click",o),n.$on("$destroy",function(){r.off("click",o)})):e.error("sg-ripple-content not found inside #"+c):e.error("No parent element found with id "+c)}}return{restrict:"A",compile:n}}angular.module("SOGo.Common").directive("sgRippleClick",e),e.$inject=["$log","$timeout"]}(),function(){"use strict";function e(e){function t(t,n){t.find("md-input-container");var r=t.find("input"),i=t.find("md-select"),o=t.find("md-button");return r.attr("ng-model","$sgSearchController.searchText"),r.attr("ng-model-options","$sgSearchController.searchTextOptions"),r.attr("ng-change","$sgSearchController.onChange()"),i&&(i.attr("ng-model","$sgSearchController.searchField"),i.attr("ng-change","$sgSearchController.onChange()")),o&&o.attr("sg-search-cancel")?(o.attr("ng-click",o.attr("sg-search-cancel")),o.removeAttr("sg-search-cancel")):o=null,function(t,n,i,s){var a=n.find("button");s.formName=n.attr("name"),s.inputName=r.attr("name"),s.allowDot=e(n.attr("sg-allow-dot"))(t),s.doSearch=e(n.attr("sg-search")),o&&a&&a.on("click",s.cancelSearch)}}return{restrict:"A",controller:"sgSearchController",controllerAs:"$sgSearchController",priority:1001,compile:t}}function t(){function e(e,t){return function(e,t,n,r,i){i(function(e){t.append(e)})}}return{restrict:"A",priority:1e3,transclude:!0,compile:e}}function n(e,t,n){var r=this;r.searchText=null,r.searchTextOptions={updateOn:"default blur",debounce:{default:300,blur:0}},r.onChange=function(){var e=t[r.formName],n=e[r.inputName],i=n.$viewValue;(r.allowDot&&"."==i||e.$valid&&i)&&("."==i&&n.$setValidity("minlength",!0),r.doSearch(t,{searchText:i,searchField:r.searchField}))},r.cancelSearch=function(){r.searchText=null}}e.$inject=["$parse"],n.$inject=["$window","$scope","$element"],angular.module("SOGo.Common").controller("sgSearchController",n).directive("sgSearch",e).directive("sgSearch",t)}(),function(){"use strict";function e(){function e(e,t,n,r){function i(){return t.find("input").eq(0)}var o=e.$watch(i,function(t){var n;t.length&&(o(),n=t.controller("ngModel"),t.on("blur",function(){r.scope.selectedItem||e.$applyAsync(n.$setValidity("required",!1))}))})}return{link:e,require:"mdAutocomplete",restrict:"A"}}angular.module("SOGo.Common").directive("sgSelectOnly",e)}(),function(){"use strict";function e(e){return{restrict:"A",scope:{folderType:"@sgSubscribe",onFolderSelect:"&sgSubscribeOnSelect"},replace:!1,bindToController:!0,controller:n,controllerAs:"$sgSubscribeDialogController",link:t}}function t(e,t,n,r){t.find("input");t.on("click",r.showDialog)}function n(e){var t=this;t.showDialog=function(){e.show({templateUrl:"../Contacts/UIxContactsUserFolders",clickOutsideToClose:!0,locals:{folderType:t.folderType,onFolderSelect:t.onFolderSelect},controller:r,controllerAs:"subscribe"})}}function r(e,t,n,r){var i=this;i.selectedUser=null,i.users=[],i.searchTextOptions={updateOn:"default blur",debounce:{default:300,blur:0}},i.onChange=function(e){r.$filter(i.searchText,null,{results:i.users}).then(function(t){e.$setValidity("matches",t.length>0),e.$setTouched(),i.selectedUser&&_.isUndefined(_.find(t,function(e){return e.uid==i.selectedUser.uid}))&&(i.selectedUser=null)})},i.selectUser=function(e){i.selectedUser==i.users[e]?i.selectedUser=null:i.users[e].$folders(t).then(function(){i.selectedUser=i.users[e]})},i.selectFolder=function(e){n({folderData:e})},i.close=function(){e.hide()}}e.$inject=["User"],n.$inject=["$mdDialog"],r.$inject=["$mdDialog","folderType","onFolderSelect","User"],angular.module("SOGo.Common").directive("sgSubscribe",e)}(),function(){"use strict";function e(){return{template:['<div class="sg-time-pane">',' <div class="hours-pane">',' <div ng-repeat="hoursBigLine in hours" layout="row" layout-xs="column">',' <div ng-repeat="hoursLine in hoursBigLine" layout="row" class="hours">',' <md-button class="hourBtn sg-time-selection-indicator" id="{{hour.id}}"'," md-no-ink",' ng-repeat="hour in hoursLine"',' ng-click="hourClickHandler(hour.displayName)">{{hour.displayName}}</md-button>'," </div>"," </div>"," </div>",' <div class="min5" ng-show="is5min()">',' <div layout="row" layout-xs="column">',' <div ng-repeat="minutesLine in min5" layout="row">',' <md-button class="minuteBtn sg-time-selection-indicator" id="{{minute.id}}"'," md-no-ink",' ng-repeat="minute in minutesLine"',' ng-click="minuteClickHandler(minute.displayName)">{{minute.displayName}}</md-button>'," </div>"," </div>"," </div>",' <div class="sg-time-scroll-mask" ng-hide="is5min()">',' <div class="min1" layout="row" layout-xs="column" layout-wrap>',' <div ng-repeat="minutesLine in min1" layout="row" layout-align="space-around center">',' <md-button class="minuteBtn sg-time-selection-indicator" id="{{minute.id}}"'," md-no-ink",' ng-repeat="minute in minutesLine"',' ng-click="minuteClickHandler(minute.displayName)">{{minute.displayName}}</md-button>'," </div>"," </div>"," </div>",' <div flex layout="row" layout-align="center center" md-colors="::{background: \'default-background-200\'}">',' <md-button class="toggleBtn md-fab md-mini" ng-bind="getToggleBtnLbl()" ng-click="toggleManual5min()"></md-button>'," </div>","</div>"].join(""),scope:{},require:["ngModel","sgTimePane","?^mdInputContainer"],controller:t,controllerAs:"ctrl",bindToController:!0,link:function(e,t,n,r){var i=r[0],o=r[1];if(r[2])throw Error("sg-timepicker should not be placed inside md-input-container.");o.configureNgModel(i,o)}}}function t(e,t,r,i,o,s,a,l,c){var u;s(e),this.$element=e,this.$scope=t,this.dateUtil=r,this.$mdUtil=i,this.keyCode=o.KEY_CODE,this.$$rAF=a,this.timePaneElement=e[0].querySelector(".sg-time-pane"),this.ngModelCtrl=null,this.SELECTED_TIME_CLASS="sg-time-selected",this.FOCUSED_TIME_CLASS="md-focus",this.id=n++,this.displayTime=null,this.selectedTime=null,this.isInitialized=!1,t.hours=[],t.hours[0]=[],t.hours[0][0]=[],t.hours[0][1]=[],t.hours[1]=[],t.hours[1][0]=[],t.hours[1][1]=[];for(var d=0;d<6;d++)t.hours[0][0][d]={id:"tp-"+this.id+"-hour-"+d,displayName:d<10?"0"+d:""+d,selected:!1},t.hours[0][1][d]={id:"tp-"+this.id+"-hour-"+(d+6),displayName:d+6<10?"0"+(d+6):""+(d+6),selected:!1},t.hours[1][0][d]={id:"tp-"+this.id+"-hour-"+(d+12),displayName:""+(d+12),selected:!1},t.hours[1][1][d]={id:"tp-"+this.id+"-hour-"+(d+18),displayName:""+(d+18),selected:!1};for(t.min5=[],t.min5[0]=[],t.min5[1]=[],d=0;d<6;d++)u=5*d,t.min5[0][d]={id:"tp-"+this.id+"-minute5-"+u,displayName:u<10?":0"+u:":"+u,selected:!0},t.min5[1][d]={id:"tp-"+this.id+"-minute5-"+(u+30),displayName:":"+(u+30),selected:!1};for(t.min1=[],d=0;d<12;d++){t.min1[d]=[];for(var h=0;h<5;h++)u=5*d+h,t.min1[d][h]={id:"tp-"+this.id+"-minute-"+u,displayName:u<10?":0"+u:":"+u,selected:!0}}t.show5min=!0,t.getToggleBtnLbl=function(){return t.is5min()?">>":"<<"},t.toggleManual5min=function(){t.manual5min=!t.is5min()},t.is5min=function(){return!0===t.manual5min||!1===t.manual5min?t.manual5min:t.show5min},l.tabindex||e.attr("tabindex","-1");var m=this;this.hourClickHandler=function(e){var t=new Date(m.displayTime);t.setHours(Number(e)),m.setNgModelValue(t,"hours")},t.hourClickHandler=this.hourClickHandler,this.minuteClickHandler=function(e){var t=e.substr(1),n=new Date(m.displayTime);n.setMinutes(Number(t)),m.setNgModelValue(n,"minutes")},t.minuteClickHandler=this.minuteClickHandler;var g=angular.bind(this,this.handleKeyEvent);angular.element(document.body).on("keydown",g),t.$on("$destroy",function(){angular.element(document.body).off("keydown",g)})}angular.module("SOGo.Common").directive("sgTimePane",e);var n=0;t.$inject=["$element","$scope","$$mdDateUtil","$mdUtil","$mdConstant","$mdTheming","$$rAF","$attrs","$mdDateLocale"],t.prototype.configureNgModel=function(e,t){var n=this;n.ngModelCtrl=e,n.$mdUtil.nextTick(function(){n.isInitialized=!0}),e.$render=function(){var e=this.$viewValue;n.$mdUtil.nextTick(function(){n.changeSelectedTime(e,t)})}},t.prototype.changeSelectedTime=function(e,t){var n=this.selectedTime;if(this.selectedTime=e,this.displayTime=new Date(e),n){var r=n.getHours(),i=document.getElementById("tp-"+t.id+"-hour-"+r);i&&(i.classList.remove(this.SELECTED_TIME_CLASS),i.setAttribute("aria-selected","false"));var o=n.getMinutes(),s=document.getElementById("tp-"+t.id+"-minute-"+o);s&&(s.classList.remove(this.SELECTED_TIME_CLASS),s.setAttribute("aria-selected","false"));var a=document.getElementById("tp-"+t.id+"-minute5-"+o);a&&(a.classList.remove(this.SELECTED_TIME_CLASS),a.setAttribute("aria-selected","false"))}if(e){var l,c=e.getHours(),u=document.getElementById("tp-"+t.id+"-hour-"+c);u&&(u.classList.add(this.SELECTED_TIME_CLASS),u.setAttribute("aria-selected","true"));var d=e.getMinutes();d%5==0?(t.$scope.show5min=!0,(l=document.getElementById("tp-"+t.id+"-minute5-"+d))&&(l.classList.add(this.SELECTED_TIME_CLASS),l.setAttribute("aria-selected","true"))):t.$scope.show5min=!1,(l=document.getElementById("tp-"+t.id+"-minute-"+d))&&(l.classList.add(this.SELECTED_TIME_CLASS),l.setAttribute("aria-selected","true"))}},t.prototype.setNgModelValue=function(e,t){return this.$scope.$emit("sg-time-pane-change",{date:e,changed:t}),this.ngModelCtrl.$setViewValue(e),this.ngModelCtrl.$render(),e},t.prototype.handleKeyEvent=function(e){var t=this;this.$scope.$apply(function(){return e.which==t.keyCode.ESCAPE||e.which==t.keyCode.TAB?(t.$scope.$emit("md-time-pane-close"),void(e.which==t.keyCode.TAB&&e.preventDefault())):e.which===t.keyCode.ENTER?(t.setNgModelValue(t.displayTime,"enter"),void e.preventDefault()):void 0})},t.prototype.focus=function(e,t){var n=e||this.selectedTime||this.today,r=this.timePaneElement.querySelector(".md-focus");if(r&&r.classList.remove(this.FOCUSED_TIME_CLASS),n){var i=n.getHours(),o=document.getElementById("tp-"+t.id+"-hour-"+i);o&&(o.classList.add(this.FOCUSED_TIME_CLASS),o.focus())}}}(),function(){"use strict";function e(e,n){return{template:function(e,t){var n=t.ariaLabel||t.mdPlaceholder;return['<md-button class="sg-timepicker-button md-icon-button" type="button" ',' tabindex="-1" aria-hidden="true" ',' ng-click="ctrl.openTimePane($event)">',' <md-icon class="sg-timepicker-icon">access_time</md-icon>',"</md-button>",'<div class="md-default-theme sg-timepicker-input-container" '," ng-class=\"{'sg-timepicker-focused': ctrl.isFocused}\">",' <input class="sg-timepicker-input" ',n?'aria-label="'+n+'" ':"",' aria-haspopup="true"',' aria-expanded="{{ctrl.isTimeOpen}}" ',' aria-owns="{{::ctrl.timePaneId}}"',' ng-focus="ctrl.setFocused(true)" ng-blur="ctrl.setFocused(false)">',' <md-button type="button" md-no-ink ',' class="sg-timepicker-triangle-button md-icon-button" ',' ng-click="ctrl.openTimePane($event)" ',' aria-label="{{::ctrl.dateLocale.msgOpenCalendar}}">',' <div class="sg-timepicker-expand-triangle"></div>'," </md-button>","</div>",'<div class="sg-timepicker-time-pane md-whiteframe-z1" id="{{::ctrl.timePaneId}}">',' <div class="sg-timepicker-input-mask">',' <div class="sg-timepicker-input-mask-opaque"></div>'," </div>",' <div class="sg-timepicker-time" md-colors="::{background: \'default-background-A100\'}">',' <sg-time-pane role="dialog" aria-label="{{::ctrl.dateLocale.msgCalendar}}" ',' ng-model="ctrl.time" ng-if="ctrl.isTimeOpen"></sg-time-pane>'," </div>","</div>"].join("")},require:["ngModel","sgTimepicker","?^form"],scope:{placeholder:"@mdPlaceholder"},controller:t,controllerAs:"ctrl",bindToController:!0,link:function(t,n,r,i){var o=i[0],s=i[1],a=i[2];e.parseAttributeBoolean(r.mdNoAsterisk);if(s.configureNgModel(o),a)var l=t.$watch(function(){return a.$submitted},function(e){e&&(s.updateErrorState(),l())})}}}function t(e,t,n,r,o,s,a,l,c,u,d){this.$window=r,this.dateLocale=l,this.dateUtil=c,this.$mdConstant=o,this.$mdUtil=a,this.$$rAF=u,this.$mdMedia=d,this.documentElement=angular.element(document.documentElement),this.ngModelCtrl=null,this.inputElement=t[0].querySelector("input"),this.ngInputElement=angular.element(this.inputElement),this.inputContainer=t[0].querySelector(".sg-timepicker-input-container"),this.timePane=t[0].querySelector(".sg-timepicker-time-pane"),this.timeButton=t[0].querySelector(".sg-timepicker-button"),this.inputMask=angular.element(t[0].querySelector(".sg-timepicker-input-mask-opaque")),this.$element=t,this.$attrs=n,this.$scope=e,this.date=null,this.isFocused=!1,this.isDisabled=!1,this.setDisabled(t[0].disabled||angular.isString(n.disabled)),this.isTimeOpen=!1,this.timePaneOpenedFrom=null,this.timePaneId="sg-time-pane"+a.nextUid(),this.bodyClickHandler=angular.bind(this,this.handleBodyClick),this.windowEventName=i.test(navigator.userAgent||navigator.vendor||window.opera)?"orientationchange":"resize",this.windowEventHandler=a.debounce(angular.bind(this,this.closeTimePane),100),this.windowBlurHandler=angular.bind(this,this.handleWindowBlur),this.leftMargin=20,this.topMargin=null,n.tabindex?(this.ngInputElement.attr("tabindex",n.tabindex),n.$set("tabindex",null)):n.$set("tabindex","-1"),s(t),s(angular.element(this.timePane)),this.installPropertyInterceptors(),this.attachChangeListeners(),this.attachInteractionListeners();var h=this;e.$on("$destroy",function(){h.detachTimePane()})}angular.module("SOGo.Common").directive("sgTimepicker",e),e.$inject=["$mdUtil","$mdAria"];var n={MIN5:{GTXS:192,XS:311},MIN1:{GTXS:384,XS:474}},r={GTXS:530,XS:294},i=/ipad|iphone|ipod|android/i;t.$inject=["$scope","$element","$attrs","$window","$mdConstant","$mdTheming","$mdUtil","$mdDateLocale","$$mdDateUtil","$$rAF","$mdMedia"],t.prototype.configureNgModel=function(e){this.ngModelCtrl=e;var t=this;t.ngModelCtrl.$formatters.push(function(e){if(e&&!(e instanceof Date))throw Error("The ng-model for sg-timepicker must be a Date instance. Currently the model is a: "+typeof e);return t.time=e,t.inputElement.value=t.dateLocale.formatTime(e),t.resizeInputElement(),t.updateErrorState(),e}),e.$viewChangeListeners.unshift(angular.bind(this,this.updateErrorState))},t.prototype.attachChangeListeners=function(){var e=this;e.$scope.$on("sg-time-pane-change",function(t,n){var r=new Date(n.date);e.ngModelCtrl.$setViewValue(r),e.time=r,e.inputElement.value=e.dateLocale.formatTime(r),"minutes"==n.changed&&e.closeTimePane(),e.resizeInputElement(),e.inputContainer.classList.remove("sg-timepicker-invalid")}),e.ngInputElement.on("input",angular.bind(e,e.resizeInputElement));var t=angular.isDefined(this.debounceInterval)?this.debounceInterval:500;e.ngInputElement.on("input",e.$mdUtil.debounce(e.handleInputEvent,t,e))},t.prototype.attachInteractionListeners=function(){var e=this,t=this.$scope,n=this.$mdConstant.KEY_CODE;e.ngInputElement.on("keydown",function(r){r.altKey&&r.keyCode==n.DOWN_ARROW&&(e.openTimePane(r),t.$digest())}),t.$on("md-time-close",function(){e.closeTimePane()})},t.prototype.installPropertyInterceptors=function(){var e=this;if(this.$attrs.ngDisabled){var t=this.$scope.$parent;t&&t.$watch(this.$attrs.ngDisabled,function(t){e.setDisabled(t)})}Object.defineProperty(this,"placeholder",{get:function(){return e.inputElement.placeholder},set:function(t){e.inputElement.placeholder=t||""}})},t.prototype.setDisabled=function(e){this.isDisabled=e,this.inputElement.disabled=e,this.timeButton&&(this.timeButton.disabled=e)},t.prototype.updateErrorState=function(e){var t=e||this.date;this.clearErrorState(),this.dateUtil.isValidDate(t)||this.ngModelCtrl.$setValidity("valid",null===t),this.ngModelCtrl.$valid||this.inputContainer.classList.add("sg-timepicker-invalid")},t.prototype.clearErrorState=function(){this.inputContainer.classList.remove("sg-timepicker-invalid"),["valid"].forEach(function(e){this.ngModelCtrl.$setValidity(e,!0)},this)},t.prototype.resizeInputElement=function(){this.inputElement.size=this.inputElement.value.length+3},t.prototype.handleInputEvent=function(e){var t=this.inputElement.value,n=t?this.dateLocale.parseTime(t):null;if(""===t||this.dateUtil.isValidDate(n)){var r=new Date(this.time);r.setHours(n.getHours()),r.setMinutes(n.getMinutes()),this.ngModelCtrl.$setViewValue(r),this.time=r}this.updateErrorState(n)},t.prototype.attachTimePane=function(){var e=this.timePane,t=document.body;e.style.transform="",this.$element.addClass("sg-timepicker-open"),angular.element(t).addClass("md-datepicker-is-showing");var i=this.inputContainer.getBoundingClientRect(),o=t.getBoundingClientRect();(!this.topMargin||this.topMargin<0)&&(this.topMargin=(this.inputMask.parent().prop("clientHeight")-this.ngInputElement.prop("clientHeight"))/2);var s=i.top-o.top-this.topMargin,a=i.left-o.left-this.leftMargin,l=o.top<0&&0===t.scrollTop?-o.top:document.body.scrollTop,c=o.left<0&&0===t.scrollLeft?-o.left:document.body.scrollLeft,u=l+this.$window.innerHeight,d=c+this.$window.innerWidth;this.inputMask.css({position:"absolute",left:this.leftMargin+"px",top:this.topMargin+"px",width:i.width-1+"px",height:i.height-2+"px"});var h=this.$mdMedia("xs")?r.XS:r.GTXS;if(a+h>d){if(d-h>0)a=d-h;else{a=c;var m=this.$window.innerWidth/h;e.style.transform="scale("+m+")"}e.classList.add("sg-timepicker-pos-adjusted")}var g="object"==typeof this.time&&this.time.getMinutes()%5==0?"MIN5":"MIN1",p=this.$mdMedia("xs")?n[g].XS:n[g].GTXS;s+p>u&&u-p>l&&(s=u-p,e.classList.add("sg-timepicker-pos-adjusted")),e.style.left=a+"px",e.style.top=s+"px",document.body.appendChild(e),this.$$rAF(function(){e.classList.add("md-pane-open")})},t.prototype.detachTimePane=function(){this.$element.removeClass("sg-timepicker-open"),angular.element(document.body).removeClass("md-datepicker-is-showing"),this.timePane.classList.remove("md-pane-open"),this.timePane.classList.remove("md-timepicker-pos-adjusted"),this.isTimeOpen&&this.$mdUtil.enableScrolling(),this.timePane.parentNode&&this.timePane.parentNode.removeChild(this.timePane)},t.prototype.openTimePane=function(e){if(!this.isTimeOpen&&!this.isDisabled){this.isTimeOpen=!0,this.timePaneOpenedFrom=e.target,this.$mdUtil.disableScrollAround(this.timePane),this.attachTimePane(),this.evalAttr("ngFocus");var t=this;this.$mdUtil.nextTick(function(){t.documentElement.on("click touchstart",t.bodyClickHandler)},!1),window.addEventListener(this.windowEventName,this.windowEventHandler)}},t.prototype.closeTimePane=function(){if(this.isTimeOpen){var e=this;e.detachTimePane(),e.ngModelCtrl.$setTouched(),e.evalAttr("ngBlur"),e.documentElement.off("click touchstart",e.bodyClickHandler),window.removeEventListener(e.windowEventName,e.windowEventHandler),e.timePaneOpenedFrom.focus(),e.timePaneOpenedFrom=null,e.isTimeOpen=!1}},t.prototype.getTimePaneCtrl=function(){return angular.element(this.timePane.querySelector("sg-time-pane")).controller("sgTimePane")},t.prototype.focusTime=function(){var e=this;this.$mdUtil.nextTick(function(){var t=e.getTimePaneCtrl();e.getTimePaneCtrl().focus(null,t)},!1)},t.prototype.setFocused=function(e){e||this.ngModelCtrl.$setTouched(),this.evalAttr(e?"ngFocus":"ngBlur"),this.isFocused=e},t.prototype.handleBodyClick=function(e){this.isTimeOpen&&(this.$mdUtil.getClosest(e.target,"sg-time-pane")||this.closeTimePane(),this.$scope.$digest())},t.prototype.handleWindowBlur=function(){this.inputFocusedOnWindowBlur=document.activeElement===this.inputElement},t.prototype.evalAttr=function(e){this.$attrs[e]&&this.$scope.$parent.$eval(this.$attrs[e])}}(),function(){"use strict";function e(e,t,n){function r(e,r){return function(i,o,s,a){function l(){var e=h.$viewValue;y=h.$viewValue,r.sgToggleGridAttr&&(g=r.sgToggleGridAttr,e=_.map(h.$viewValue,r.sgToggleGridAttr)),_.forEach(f,function(t){var n=angular.element(t);_.includes(e,n.attr("value"))&&n.addClass("sg-active")}),h.$validate(),c(h.$invalid)}function c(e){var t=o.parent().children()[0];e?(o.addClass("sg-toggle-grid-invalid"),"LABEL"==t.tagName&&(t.style.color=n.getThemeColor("warn"))):(o.removeClass("sg-toggle-grid-invalid"),"LABEL"==t.tagName&&(t.style.color=""))}function u(e){var t=_.findIndex(y,function(t){return g?t[g]==e:t==e});if(t<0)if(g){var n={};n[g]=e,y.push(n)}else y.push(e);else y.splice(t,1);i.$apply(function(){h.$setViewValue(y),h.$setDirty(),h.$validate(),c(h.$invalid)})}var d,h,m,g,p,f=e.find("md-grid-tile"),y=[];for((h=a[1]||t.fakeNgModel()).$render=l,h.$isEmpty=function(e){return!e||0===e.length},p=function(){var e=angular.element(this),t=e.attr("value");e.toggleClass("sg-active"),u(t)},m=0;m<f.length;m++)(d=angular.element(f[m])).addClass("sg-icon-button"),d.find("figure").addClass("md-icon"),d.on("click",p)}}return{restrict:"A",require:["mdGridList","?ngModel"],compile:r}}e.$inject=["$parse","$mdUtil","$mdColors"],angular.module("SOGo.Common").directive("sgToggleGrid",e)}(),String.prototype.endsWith=function(e){return-1!==this.indexOf(e,this.length-e.length)},String.prototype.startsWith=function(e,t){return t=angular.isNumber(t)?t:0,this.lastIndexOf(e,t)===t},String.prototype.encodeEntities=function(){var e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,t=/([^#-~ |!])/g;return this.replace(/&/g,"&").replace(e,function(e){return"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";"}).replace(t,function(e){return"&#"+e.charCodeAt(0)+";"}).replace(/</g,"<").replace(/>/g,">")},String.prototype._base64_keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",String.prototype.base64encode=function(){for(var e,t,n,r,i,o,s,a="",l=0,c=this.utf8encode();l<c.length;)r=(e=c.charCodeAt(l++))>>2,i=(3&e)<<4|(t=c.charCodeAt(l++))>>4,o=(15&t)<<2|(n=c.charCodeAt(l++))>>6,s=63&n,isNaN(t)?o=s=64:isNaN(n)&&(s=64),a=a+this._base64_keyStr.charAt(r)+this._base64_keyStr.charAt(i)+this._base64_keyStr.charAt(o)+this._base64_keyStr.charAt(s);return a},String.prototype.base64decode=function(){for(var e,t,n,r,i,o,s="",a=0,l=""+this;a<l.length;)e=this._base64_keyStr.indexOf(l.charAt(a++))<<2|(r=this._base64_keyStr.indexOf(l.charAt(a++)))>>4,t=(15&r)<<4|(i=this._base64_keyStr.indexOf(l.charAt(a++)))>>2,n=(3&i)<<6|(o=this._base64_keyStr.indexOf(l.charAt(a++))),s+=String.fromCharCode(e),64!=i&&(s+=String.fromCharCode(t)),64!=o&&(s+=String.fromCharCode(n));return s},String.prototype.md5=function(){if(this.length){return function(e){function t(e,t){return e<<t|e>>>32-t}function n(e,t){var n,r,i,o,s;return i=2147483648&e,o=2147483648&t,n=1073741824&e,r=1073741824&t,s=(1073741823&e)+(1073741823&t),n&r?2147483648^s^i^o:n|r?1073741824&s?3221225472^s^i^o:1073741824^s^i^o:s^i^o}function r(e,t,n){return e&t|~e&n}function i(e,t,n){return e&n|t&~n}function o(e,t,n){return e^t^n}function s(e,t,n){return t^(e|~n)}function a(e,i,o,s,a,l,c){return e=n(e,n(n(r(i,o,s),a),c)),n(t(e,l),i)}function l(e,r,o,s,a,l,c){return e=n(e,n(n(i(r,o,s),a),c)),n(t(e,l),r)}function c(e,r,i,s,a,l,c){return e=n(e,n(n(o(r,i,s),a),c)),n(t(e,l),r)}function u(e,r,i,o,a,l,c){return e=n(e,n(n(s(r,i,o),a),c)),n(t(e,l),r)}function d(e){var t,n="",r="";for(t=0;t<=3;t++)n+=(r="0"+(e>>>8*t&255).toString(16)).substr(r.length-2,2);return n}var h,m,g,p,f,y,v,$,b,C=Array();for(C=function(e){for(var t,n=e.length,r=n+8,i=16*((r-r%64)/64+1),o=Array(i-1),s=0,a=0;a<n;)s=a%4*8,o[t=(a-a%4)/4]=o[t]|e.charCodeAt(a)<<s,a++;return t=(a-a%4)/4,s=a%4*8,o[t]=o[t]|128<<s,o[i-2]=n<<3,o[i-1]=n>>>29,o}(e=function(e){e=e.replace(/rn/g,"n");for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t+=String.fromCharCode(r):r>127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}(e)),y=1732584193,v=4023233417,$=2562383102,b=271733878,h=0;h<C.length;h+=16)m=y,g=v,p=$,f=b,v=u(v=u(v=u(v=u(v=c(v=c(v=c(v=c(v=l(v=l(v=l(v=l(v=a(v=a(v=a(v=a(v,$=a($,b=a(b,y=a(y,v,$,b,C[h+0],7,3614090360),v,$,C[h+1],12,3905402710),y,v,C[h+2],17,606105819),b,y,C[h+3],22,3250441966),$=a($,b=a(b,y=a(y,v,$,b,C[h+4],7,4118548399),v,$,C[h+5],12,1200080426),y,v,C[h+6],17,2821735955),b,y,C[h+7],22,4249261313),$=a($,b=a(b,y=a(y,v,$,b,C[h+8],7,1770035416),v,$,C[h+9],12,2336552879),y,v,C[h+10],17,4294925233),b,y,C[h+11],22,2304563134),$=a($,b=a(b,y=a(y,v,$,b,C[h+12],7,1804603682),v,$,C[h+13],12,4254626195),y,v,C[h+14],17,2792965006),b,y,C[h+15],22,1236535329),$=l($,b=l(b,y=l(y,v,$,b,C[h+1],5,4129170786),v,$,C[h+6],9,3225465664),y,v,C[h+11],14,643717713),b,y,C[h+0],20,3921069994),$=l($,b=l(b,y=l(y,v,$,b,C[h+5],5,3593408605),v,$,C[h+10],9,38016083),y,v,C[h+15],14,3634488961),b,y,C[h+4],20,3889429448),$=l($,b=l(b,y=l(y,v,$,b,C[h+9],5,568446438),v,$,C[h+14],9,3275163606),y,v,C[h+3],14,4107603335),b,y,C[h+8],20,1163531501),$=l($,b=l(b,y=l(y,v,$,b,C[h+13],5,2850285829),v,$,C[h+2],9,4243563512),y,v,C[h+7],14,1735328473),b,y,C[h+12],20,2368359562),$=c($,b=c(b,y=c(y,v,$,b,C[h+5],4,4294588738),v,$,C[h+8],11,2272392833),y,v,C[h+11],16,1839030562),b,y,C[h+14],23,4259657740),$=c($,b=c(b,y=c(y,v,$,b,C[h+1],4,2763975236),v,$,C[h+4],11,1272893353),y,v,C[h+7],16,4139469664),b,y,C[h+10],23,3200236656),$=c($,b=c(b,y=c(y,v,$,b,C[h+13],4,681279174),v,$,C[h+0],11,3936430074),y,v,C[h+3],16,3572445317),b,y,C[h+6],23,76029189),$=c($,b=c(b,y=c(y,v,$,b,C[h+9],4,3654602809),v,$,C[h+12],11,3873151461),y,v,C[h+15],16,530742520),b,y,C[h+2],23,3299628645),$=u($,b=u(b,y=u(y,v,$,b,C[h+0],6,4096336452),v,$,C[h+7],10,1126891415),y,v,C[h+14],15,2878612391),b,y,C[h+5],21,4237533241),$=u($,b=u(b,y=u(y,v,$,b,C[h+12],6,1700485571),v,$,C[h+3],10,2399980690),y,v,C[h+10],15,4293915773),b,y,C[h+1],21,2240044497),$=u($,b=u(b,y=u(y,v,$,b,C[h+8],6,1873313359),v,$,C[h+15],10,4264355552),y,v,C[h+6],15,2734768916),b,y,C[h+13],21,1309151649),$=u($,b=u(b,y=u(y,v,$,b,C[h+4],6,4149444226),v,$,C[h+11],10,3174756917),y,v,C[h+2],15,718787259),b,y,C[h+9],21,3951481745),y=n(y,m),v=n(v,g),$=n($,p),b=n(b,f);return(d(y)+d(v)+d($)+d(b)).toLowerCase()}(this.toLowerCase())}},String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.slice(1)},String.prototype.asDate=function(){var e,t=this.split("/");return 3==t.length?e=new Date(t[2],t[1]-1,t[0]):3==(t=this.split("-")).length?e=new Date(t[0],t[1]-1,t[2]):8==this.length&&(e=new Date(this.substring(0,4),this.substring(4,6)-1,this.substring(6,8))),e},String.prototype.formatted=function(){for(var e=this,t=0;t<arguments.length;t++)e=e.replace("%{"+t+"}",arguments[t],"g");return e},String.prototype.isValidEmail=function(){return/^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i.test(this)},String.prototype.asCSSIdentifier=function(){for(var e=["_","\\.","#","@","\\*",":",","," ","'","&","\\+"],t=["_U_","_D_","_H_","_A_","_S_","_C_","_CO_","_SP_","_SQ_","_AM_","_P_"],n=this,r=0;r<e.length;r++){var i=new RegExp(e[r],"g");n=n.replace(i,t[r])}return n=n.replace(/[^a-zA-Z_\-]/g,""),/^\d+/.test(n)&&(n="_"+n),n},String.prototype.timeInterval=function(){return"once_per_hour"==this?3600:"every_minute"==this?60:60*parseInt(this.substr(6))},String.prototype.parseDate=function(e,t){var n,r,i,o,s,a,c,u,d,h;for(n=""+this,r=/%[dembByYHIMp]/g,s=new Date,a={year:s.getYear()+1900,month:s.getMonth(),day:s.getDate(),hour:0,minute:0},c={"%d":[/\d\d/,function(e){return a.day=parseInt(e),a.day<32}],"%e":[/ ?\d?\d/,function(e){return a.day=parseInt(e),a.day<32}],"%m":[/\d\d/,function(e){return a.month=parseInt(e)-1,a.month<12}],"%b":[/[^\d\s\.\/\-]{2,}/,function(t){var n=_.indexOf(_.map(e.shortMonths,_.toLower),_.toLower(t));return n>=0&&(a.month=n),n>=0}],"%B":[/[^\d\s\.\/\-]{2,}/,function(t){var n=_.indexOf(_.map(e.months,_.toLower),_.toLower(t));return n>=0&&(a.month=n),n>=0}],"%y":[/\d\d/,function(e){var t=parseInt(s.getFullYear().toString().substring(2))+5;return a.year=parseInt(e),a.year<t?a.year+=2e3:a.year+=1900,!0}],"%Y":[/[12]\d\d\d/,function(e){return a.year=parseInt(e),!0}],"%H":[/\d{1,2}/,function(e){return a.hour=parseInt(e),a.hour<24}],"%I":[/\d{1,2}/,function(e){return a.hour=parseInt(e),a.hour<=12}],"%M":[/[0-5]\d/,function(e){return a.minute=parseInt(e),a.minute<60}],"%p":[/[^\d\s\/\-]+/,function(e){var t=_.toLower(e),n=_.toLower(l("AM")),r=_.toLower(l("PM"));return t==r&&(a.hour+=12),t==n||t==r}]},i=t.match(r)||[],h=0,u=0;u<i.length;u++)o=i[u],(d=(n.match(c[o][0])||[])[0])&&(n=n.slice(n.indexOf(d)+d.length),c[o][1](d)&&h++);return i.length===h?new Date(a.year,a.month,a.day,a.hour,a.minute):new Date(NaN)},Date.prototype.daysUpTo=function(e){var t=[],n=this.getTime(),r=e.getTime();if(n>r){var i=n;n=r,r=i}for(var o=Math.round((r-n)/864e5)+1,s=0;s<o;s++){var a=new Date;a.setTime(n+864e5*s),t.push(a)}return t},Date.prototype.minutesTo=function(e){var t,n;return t=Math.floor(e.valueOf()-this.valueOf())/1e3/60,n=e.getTimezoneOffset()-this.getTimezoneOffset(),t-n},Date.prototype.stringWithSeparator=function(e){var t=""+(this.getMonth()+1),n=""+this.getDate(),r=this.getYear();return r<1e3&&(r=""+(r+1900)),1==t.length&&(t="0"+t),1==n.length&&(n="0"+n),str="-"==e?r+"-"+t+"-"+n:n+"/"+t+"/"+r,str},Date.prototype.addDays=function(e){var t,n,r;return n=this.getTime(),t=new Date(n),n+=864e5*e,this.setTime(n),0!==(r=this.getTimezoneOffset()-t.getTimezoneOffset())&&(n=this.getTime()+60*r*1e3,this.setTime(n)),this},Date.prototype.addHours=function(e){var t=this.getTime();t+=36e5*e,this.setTime(t)},Date.prototype.addMinutes=function(e){var t=this.getTime();t+=6e4*e,this.setTime(t)},Date.prototype.beginOfDay=function(){var e=new Date(this.getTime());return e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e},Date.prototype.dayOfWeek=function(e){var t,n;return t=e.firstDayOfWeek,n=this.getDay(),t>n&&(n+=7),n-t},Date.prototype.firstWeekOfYearForDate=function(e){var t,n,r;return t=e.firstWeekOfYear,(r=new Date(this.getTime())).setMonth(0),r.setDate(1),n=r.dayOfWeek(e),"First4DayWeek"==t?n<4?r.beginOfWeek(e.firstDayOfWeek):r.addDays(7).beginOfWeek(e.firstDayOfWeek):"FirstFullWeek"==t?0===n?r.beginOfWeek(e.firstDayOfWeek):r.addDays(7).beginOfWeek(e.firstDayOfWeek):r.beginOfWeek(e.firstDayOfWeek)},Date.prototype.getWeek=function(e){var t,n,r,i;return(i=new Date(this.getTime())).addDays(6),t=i.firstWeekOfYearForDate(e),t.getTime()<i.getTime()?r=1+Math.floor((i.getTime()-t.getTime())/6048e5):((n=new Date(i.getTime())).addDays(-7),t=n.firstWeekOfYearForDate(e),r=2+Math.floor((n.getTime()-t.getTime())/6048e5)),r},Date.prototype.beginOfWeek=function(e){var t=e-this.getDay();t>0&&(t-=7);var n=this.beginOfDay();return n.setHours(12),n.addDays(t),n},Date.prototype.endOfWeek=function(e){var t=this.beginOfWeek(e);return t.addDays(6),t.setHours(23),t.setMinutes(59),t.setSeconds(59),t.setMilliseconds(999),t},Date.prototype.getDayString=function(){var e=this.getYear();e<1e3&&(e+=1900);var t=""+(this.getMonth()+1);1==t.length&&(t="0"+t),e+=t;var n=""+this.getDate();return 1==n.length&&(n="0"+n),e+=n},Date.prototype.getHourString=function(){var e=this.getHours()+"00";return 3==e.length&&(e="0"+e),e},Date.prototype.format=function(e,t){var n,r,i,o,s=[],a=/%[deaAmbByYUHIMp]/g,c={"%d":this.getDate(),"%e":this.getDate(),"%a":e.shortDays[this.getDay()],"%A":e.days[this.getDay()],"%m":this.getMonth()+1,"%b":e.shortMonths[this.getMonth()],"%B":e.months[this.getMonth()],"%y":this.getFullYear().toString().substring(2),"%Y":this.getFullYear(),"%U":this.getWeek(e),"%H":this.getHours(),"%M":this.getMinutes()};for(c["%I"]=c["%H"]>12?c["%H"]%12:c["%H"],c["%p"]=l(c["%H"]<12?"AM":"PM"),c["%d"]=(c["%d"]<10?"0":"")+c["%d"],c["%e"]=(c["%e"]<10?" ":"")+c["%e"],c["%m"]=(c["%m"]<10?"0":"")+c["%m"],c["%H"]=(c["%H"]<10?"0":"")+c["%H"],c["%I"]=(c["%I"]<10?"0":"")+c["%I"],c["%M"]=(c["%M"]<10?"0":"")+c["%M"],n=t.replace(a,"\0").split("\0"),i=0,o=(r=t.match(a)).length;i<=o;i++)n.length&&s.push(n.shift()),s.push(c[r[i]]);return s.join("")};
|
|
//# sourceMappingURL=Common.js.map
|