",""].join(""),locals:{url:e},controller:r}),r.$inject=["scope","$mdToast","url"];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.$inject=["$timeout","sgSettings","Resource","$mdToast"];function t(t,n,r,i){return angular.extend(e,{$timeout:t,$$resource:new r(n.activeUser("folderURL")+"Calendar",n.activeUser()),$toast:i}),e}angular.module("SOGo.Common").factory("Alarm",t)}(),function(){"use strict";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",function(){function e(e,t){var n,r,i,o,s,a;return n=e,t&&(n+="@"+t.value),r=""+window.location.href,"/"==(i=ApplicationBaseURL+encodeURIComponent(n))[0]&&(o=r.split("/"),s=o[2],a=o[0],i=a+"//"+s+i),r.startsWith(i)&&!r.endsWith("/logoff")?r:i}this.$get=t,t.$inject=["$q","$http","$cookies","passwordPolicyConfig"];function t(t,n,r,i){function o(){var e,t=null,n=r.get("0xHIGHFLYxSOGo");return n&&n.length>8&&(e=decodeURIComponent(n.substr(8)),t=e.base64decode().split(":")),t}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,r=o();r?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;r&&r.LDAPPasswordPolicyError?(n=r.LDAPPasswordPolicyError,t=n==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):t=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,o=n.LDAPPasswordPolicyError;o?o==i.PolicyNoError?t=l("Password change failed"):o==i.PolicyPasswordModNotAllowed?t=l("Password change failed - Permission denied"):o==i.PolicyInsufficientPasswordQuality?t=l("Password change failed - Insufficient password quality"):o==i.PolicyPasswordTooShort?t=l("Password change failed - Password is too short"):o==i.PolicyPasswordTooYoung?t=l("Password change failed - Password is too young"):o==i.PolicyPasswordInHistory?t=l("Password change failed - Password is in history"):(t=l("Unhandled policy error: %{0}").formatted(o),o=i.PolicyPasswordUnknown):(o=i.PolicyPasswordSystemUnknown,t=_("Unhandled error response")),r.put("XSRF-TOKEN",c,{path:"/SOGo/"}),s.reject(t)}),s.promise}}}})}(),function(){"use strict";function e(){}e.alert=function(e,t){var n=this.$modal.alert().title(e).htmlContent(t).ok(l("OK")).multiple(!0);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){var r=n||{},i=e.asCSSIdentifier(),o=this.$q.defer();this.$modal.show({parent:angular.element(document.body),clickOutsideToClose:!0,escapeToClose:!0,template:['',' ",""].join(""),controller:s}),s.$inject=["scope","$mdDialog"];function s(t,n){t.title=e,t.name="",t.cancel=function(){o.reject(),n.hide()},t.ok=function(){o.resolve(t.name),n.hide()}}return o.promise},t.$inject=["$q","$mdDialog"];function t(t,n){return angular.extend(e,{$q:t,$modal:n}),e}angular.module("SOGo.Common").factory("Dialog",t)}(),function(){"use strict";angular.module("SOGo.Common").factory("Gravatar",function(){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):""}})}(),function(){"use strict";function e(e,t,n,r,i,o){angular.extend(this,{_http:e,_q:t,_window:n,_path:r,_activeUser:i}),angular.extend(this,o),this._path=this._path.replace(/\/$/,"")}e.$factory=["$http","$q","$window",function(t,n,r){return function(i,o,s){return new e(t,n,r,i,o,s)}}],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){this._q.defer();var i=r&&r.type?r.type:"application/zip",o=[this._path];e&&o.push(e),t&&o.push(t),o=_.compact(_.flatten(o)).join("/");return this._http({method:"POST",url:o,data:n,headers:{accept:i},responseType:"arraybuffer",cache:!1,transformResponse:function(e,t,n){var o,s=null;if(n<200||n>299)throw new Error("Bad gateway");e&&(s=new Blob([e],{type:i})),r&&r.filename?o=r.filename:(a=t("content-disposition"))&&a.split(";")[1].trim().split("=")[1].replace(/"/g,"");var a;if(!saveAs)throw new Error("To use Resource.download, FileSaver.js must be loaded.");saveAs(s,o)}})},e.prototype.open=function(e,t){var n=[this._path];e&&n.push(e),t&&n.push(t),n=_.compact(_.flatten(n)).join("/"),this._window.location.href=n},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";e.$inject=["$rootScope","$timeout"];function e(e,t){return function(n){t(function(){e.$broadcast("sgFocusOn",n)})}}angular.module("SOGo.Common").factory("sgFocus",e)}(),function(){"use strict";e.$inject=["$mdDialog","$sgHotkeys"];function e(e,t){return angular.extend(t,{$modal:e}),new t}angular.module("SOGo.Common").service("sgHotkeys",e).provider("$sgHotkeys",function(){var e={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"},t={42:"*",63:"?"};this.$get=n,n.$inject=["$rootScope","$window"];function n(n,r){var i=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))};i.prototype.clone=function(){return new i(this)};var o=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 o.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)},o.prototype._invokeHotkeyHandlers=function(e,t,n){for(var r=0,i=n.length;r=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},o.prototype._validateHotkey=function(e){if(!(e instanceof i))throw new TypeError("Hotkeys: Expected a hotkey object be instance of HotKey")},o.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},o.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},o.prototype.registerHotkey=function(e){return this._validateHotkey(e),this._registerKeys(e)},o.prototype.registerHotkeyUp=function(e){this._validateHotkey(e),e.onKeyUp=!0,this._registerKeys(e)},o.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');e.callback=(t=e.callback,function(e,r){n.$apply(function(){t.call(this,e,r)}.bind(this))});var t;return new i(e)},o.prototype.match=function(e,t){angular.isArray(t)||(t=[t]);var n=this.keyStringFromEvent(e);return Boolean(~t.indexOf(n))},o.prototype._toggleCheatSheet=function(){var e=this;this._cheatSheet?(o.$modal.hide(),this._cheatSheet=null):this._cheatSheet=o.$modal.show({clickOutsideToClose:!0,escapeToClose:!0,template:[""," "," ",' ','
'," {{keys[0].lkey || hotkey}}","
"," {{keys[0].description}}"," "," "," ",""].join(""),controller:t,locals:{hotkeys:e._hotkeys}}).finally(function(){e._cheatSheet=null}),t.$inject=["$scope","hotkeys"];function t(e,t){e.hotkeys=t,e.closeDialog=function(){o.$modal.hide()}}},o}})}(),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&&""!=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";e.$inject=["$scope","$element","$http","$q","Preferences","Gravatar"];function e(e,t,n,r,i,o){var s,a;s=this,e.$on("$destroy",function(){a&&t.off("click",a)}),e.$watch(function(){return s.email},function(e,t){e&&s.urlEmail!=e?(l(),i.defaults.SOGoGravatarEnabled&&function(e){var t=o(e,s.size,i.defaults.SOGoAlternateAvatar);n({method:"GET",url:t,cache:!0,headers:{Accept:"image/*"}}).then(function(){s.url||(s.url=t,s.urlEmail=e,c())},function(){l()})}(e)):e||l()}),"sg-src"in t[0].attributes&&e.$watch(function(){return s.src},function(e){e&&(s.url=e,s.urlEmail=""+s.email,t.addClass("sg-avatar-image--zoomable"),a=function(){t.toggleClass("sg-avatar-image--zoom")},t.on("click",a),c())});function l(){s.url=null,s.urlEmail=null,s.img.addClass("ng-hide"),s.genericImg.removeClass("ng-hide")}function c(){s.genericImg.addClass("ng-hide"),s.img.removeClass("ng-hide")}}angular.module("SOGo.Common").directive("sgAvatarImage",function(){return{restrict:"AE",scope:{},bindToController:{size:"@",email:"=sgEmail",src:"=sgSrc"},transclude:!0,template:['