
angular.module("Wizdom365.Manual",[]);
angular.module("Wizdom365.Manual").directive("wizdom365ManualPageInfo",function(){return{controller:"wizdom365ManualPageInfo"}}).controller("wizdom365ManualPageInfo",["$scope","contextInfo","configuration","manualApi",function(e,a,n,i){if(e.socialFeatureEnabled=n.Manual?$.parseJSON(n.Manual.SocialFeature.Enabled):!1,e.socialEnabledOnItem=a.pageColumns.newsEnableSocial,e.socialId=a.pageColumns.pageInstanceId||a.pageItemId+a.pageListId,e.socialFeatureEnabled&&e.socialEnabledOnItem){var o={pageListId:a.pageListId,pageItemId:a.pageItemId,webServerRelativeUrl:window.encodeURIComponent(a.webServerRelativeUrl)};i.getSocialOverview(o).then(function(n){e.item=n.item,e.item&&(e.item.id=e.socialId),e.pageListId=a.pageListId,e.pageItemId=a.pageItemId})}}]);
angular.module("Wizdom365.Manual").directive("wizdom365ManualAtoz",[function(){return{scope:{},template:'<div class="bootstrap-wrapper">\n                            <div class="webpart-edit-button-container" ng-if="editMode">\n                                <button class="editWebpartButton btn" ng-click="editWebpart()" type="button" title=\'{{"Edit Webpart" | translate}}\'>\n                                    <span class="ms-Icon ms-Icon--Edit"></span><span class="editWebpartButtonText">{{"Edit" | translate}}</span>\n                                </button>\n                            </div>\n                        	<div wizdom-include=\'webpartProperties.templateUrl\'></div>\n                        	<div wizdom365-spinner="" loading="loading"></div>    \n                        </div>',link:function(e,t,a){},controller:["$scope","$element","$attrs","webpartPropertiesService","$filter","$http","contextInfo","manualApi","$window","$modal","log",function(e,t,a,r,i,n,l,p,s,o,d){function u(){"FirstUsedLetter"==e.webpartProperties.defaultView?e.tab=e.letterPages[0].firstLetter:"All"==e.webpartProperties.defaultView?e.tab="All":"SpecificLetter"==e.webpartProperties.defaultView?e.tab=e.webpartProperties.startDisplayLetter.toUpperCase():d("Unkown View")}r.hideEditCode(t),e.webpartId=r.getWebpartId(t),e.editMode=r.isInEditMode(t),e.pages=[],e.searchPage={title:void 0},e.search=function(){e.searchPage.title?e.tab="All":u()};var c=a.webpartProperties?JSON.parse(a.webpartProperties):null;e.webpartProperties={siteUrl:c&&c.siteUrl||"",alphabet:c&&c.alphabet||i("translate")("#ABCDEFGHIJKLMNOPQRSTUVWXYZ"),templateUrl:c&&c.templateUrl||"Manual/Templates/ViewTemplates/AtoZ/AtoZ.html",defaultView:c&&c.defaultView||"FirstUsedLetter",startDisplayLetter:c&&c.startDisplayLetter||"A"};l.pageListId,l.pageItemId,l.webServerRelativeUrl;e.spHostUrl=l.spHostUrl,e.loading=!0,e.editWebpart=function(){p.clearCache().then(function(e){d("cache cleard")}),o.open({templateUrl:"Manual/Templates/Dialogs/EditWebpartAZ.html",controller:"azpagesEditCtrl",windowClass:"bootstrap-wrapper",resolve:{webpartId:function(){return e.webpartId},webpartProperties:function(){return e.webpartProperties}}}).result.then(function(t){t&&(e.webpartProperties=t,b())})};var b=function(){var t=e.webpartProperties.siteUrl,a=e.webpartProperties.alphabet;p.getAtoZPages(encodeURIComponent(t)).then(function(t){if(!t.manualPages||0==t.manualPages.length)return void(e.loading=!1);e.pages=t.manualPages;var r=a.split("");e.charArray=r.filter(function(e,t){return r.indexOf(e)===t}),e.webpartProperties.alphabet=e.charArray.toString().replaceAll(",",""),e.letterPages=_(t.manualPages).groupBy("firstLetter").pairs().map(function(e){return _.zipObject(["firstLetter","pages"],e)}).value(),u(),e.updateTab=function(t){e.tab=t},e.hasPages=function(t){return-1!==_.findIndex(e.letterPages,{firstLetter:t})},e.loading=!1})};b()}]}}]);
angular.module("Wizdom365.Manual").directive("wizdom365Markasread",function(){return{scope:{},template:"<div wizdom-include='::templateUrl'></div>",link:function(e,a,r){},controller:["$scope","$http","contextInfo","manualApi","$window","configuration",function(e,a,r,t,n,s){var i=r.pageListId,o=r.pageItemId,l=r.pageFileVersionForDisplay,d=r.webServerRelativeUrl;e.spHostUrl=r.spHostUrl,e.templateUrl=s.MarkAsRead.SelectedTemplate||"Manual/Templates/ViewTemplates/MarkAsRead/MarkAsRead.html",e.canMarkAsRead=!1,e.successMarked=!1,e.markAsRead=function(){var a={pageID:o,pageListId:i,pageVersion:l,webServerRelativeUrl:d,spHostUrl:e.spHostUrl};t.markAsRead(a).then(function(){e.canMarkAsRead=!1,e.successMarked=!0})};var p=function(){var a={pageListId:i,pageItemId:o,pageVersion:l,webServerRelativeUrl:window.encodeURIComponent(d)};t.canMarkAsRead(a).then(function(a){e.canMarkAsRead=a})};p()}]}});
angular.module("Wizdom365.Manual").directive("wizdom365ManualMustread",[function(){return{scope:{},template:'<div class="bootstrap-wrapper">\n                            <div class="webpart-edit-button-container" ng-if="editMode">\n                                <button class="editWebpartButton btn" ng-click="editWebpart()" type="button" title=\'{{"Edit Webpart" | translate}}\'>\n                                    <span class="ms-Icon ms-Icon--Edit"></span><span class="editWebpartButtonText">{{"Edit" | translate}}</span>\n                                </button>\n                            </div>\n                        	<div wizdom-include=\'webpartProperties.templateUrl\'></div>\n                        	<div wizdom365-spinner="" loading="loading"></div>    \n                        </div>',link:function(e,t,a){},controller:["$scope","$element","$attrs","webpartPropertiesService","$http","contextInfo","manualApi","$window","$modal",function(e,t,a,r,n,i,o,s,l){r.hideEditCode(t),e.webpartId=r.getWebpartId(t),e.editMode=r.isInEditMode(t);var p=a.webpartProperties?JSON.parse(a.webpartProperties):null;e.webpartProperties={siteUrl:p&&p.siteUrl||"",templateUrl:p&&p.templateUrl||"Manual/Templates/ViewTemplates/MustRead/MustRead.html"};i.pageListId,i.pageItemId,i.webServerRelativeUrl;e.spHostUrl=i.spHostUrl,e.loading=!0,e.editWebpart=function(){l.open({templateUrl:"Manual/Templates/Dialogs/EditWebpartMustRead.html",controller:"mustreadEditCtrl",windowClass:"bootstrap-wrapper",resolve:{webpartId:function(){return e.webpartId},webpartProperties:function(){return e.webpartProperties}}}).result.then(function(t){t&&(e.webpartProperties=t,d())})};var d=function(){var t=e.webpartProperties.siteUrl;o.getMustReadPages(encodeURIComponent(t)).then(function(t){t.manualPages&&t.manualPages.length>0&&(e.manualPages=t.manualPages),e.loading=!1})};d()}]}}]);
angular.module("Wizdom365.Manual").directive("wizdom365Pageactive",function(){return{scope:{},template:'<div ng-if="pageActive.isNotActive" class="ms-webpart-chrome revisiondate ms-webpartzone-cell ms-status-yellow"><div class="ms-wpContentDivSpace"><div class="ms-WPBody"><div class="wtsite-revisiondate-outer"><div class="wtsite-revisiondate-line1">{{ "Content on this page is no longer valid! The reason may be that the content is no longer relevant or valid, but retained for historical reasons" | translate }}</div></div></div><div class="ms-clear"></div></div></div>',link:function(e,t,i){},controller:["$scope","$http","contextInfo","manualApi","$window",function(e,t,i,a,n){var o=i.pageListId,s=i.pageItemId,r=i.pageFileVersionForDisplay,l=i.webServerRelativeUrl;e.spHostUrl=i.spHostUrl;var v={pageListId:o,pageItemId:s,pageVersion:r,webServerRelativeUrl:window.encodeURIComponent(l)};a.getPageActive(v).then(function(t){e.pageActive=t})}]}});
angular.module("Wizdom365.Manual").directive("wizdom365Pageresponsible",function(){return{scope:{},template:'<div class="wizdom-bootstrap-wrapper ms-webpart-chrome manualpageresponsible ms-webpartzone-cell" ng-if="showPageresponsible && (pageResponsible.primaryWizdomUser || pageResponsible.secondaryWizdomUser)"><div class="ms-webpart-chrome-title"><span title="Responsible for content"><h2 style="text-align:justify;" class="ms-webpart-titletext"><nobr><span>{{ "Responsible for content" | translate }}</span></nobr></h2></span></div><div class="ms-wpContentDivSpace wizdom-pageInfo"><div ng-if="pageResponsible.primaryWizdomUser" class="primaryWizdomUser"><div class="ms-WPBody wizdom-pageInfo-container"><div class="wizdom-pageInfo-row"><div class="wizdom-pageInfo-imgColumn"><div wizdom365-presence-picture size="AVATAR" email="pageResponsible.primaryWizdomUser.email" accountname="pageResponsible.primaryWizdomUser.accountName" name="pageResponsible.primaryWizdomUser.name" url="pageResponsible.primaryWizdomUser.publicUrl" image="pageResponsible.primaryWizdomUser.pictureURL"></div></div><div class="wizdom-pageInfo-textColumn"><div class="heading">{{ "Primary responsible" | translate }}</div><div class="name"><a href="{{ pageResponsible.primaryWizdomUser.publicUrl }}">{{ pageResponsible.primaryWizdomUser.name }}</a></div><div class="email"><a href="mailto:{{ pageResponsible.primaryWizdomUser.email }}">{{ pageResponsible.primaryWizdomUser.email }}</a></div></div></div><div class="ms-clear"></div></div></div><div ng-if="pageResponsible.secondaryWizdomUser"><div class="ms-WPBody wizdom-pageInfo-container"><div class="wizdom-pageInfo-row"><div class="wizdom-pageInfo-imgColumn"><div wizdom365-presence-picture size="AVATAR" email="pageResponsible.secondaryWizdomUser.email" accountname="pageResponsible.secondaryWizdomUser.accountName" name="pageResponsible.secondaryWizdomUser.name" url="pageResponsible.secondaryWizdomUser.publicUrl" image="pageResponsible.secondaryWizdomUser.pictureURL"></div></div><div class="wizdom-pageInfo-textColumn"><div class="heading">{{ "Secondary responsible" | translate }}</div><div class="name"><a href="{{ pageResponsible.secondaryWizdomUser.publicUrl }}">{{ pageResponsible.secondaryWizdomUser.name }}</a></div><div class="email"><a href="mailto:{{ pageResponsible.secondaryWizdomUser.email }}">{{ pageResponsible.secondaryWizdomUser.email }}</a></div></div></div><div class="ms-clear"></div></div></div></div></div>',link:function(e,i,s){},controller:["$scope","$http","contextInfo","manualApi",function(e,i,s,a){var o=s.pageListId,r=s.pageItemId,n=s.pageFileVersionForDisplay,p=s.webServerRelativeUrl;e.showPageresponsible=!1,e.spHostUrl=s.spHostUrl;var l={pageListId:o,pageItemId:r,pageVersion:n,webServerRelativeUrl:window.encodeURIComponent(p)};a.getPageResponsible(l).then(function(i){e.pageResponsible=i,e.showPageresponsible=i.showPageresponsible})}]}});
angular.module("Wizdom365.Manual").directive("wizdom365Pageversions",function(){return{scope:{},template:"<select ng-show=\"dataReady\" ng-model=\"selectedVersion\" ng-options=\"version as (version.versionLabel + ' (' + (version.id == 0 ? ('Current published' | translate) : ('Published' | translate)) + (' ') + (version.date | wizdom365DefaultDate) + ')') for version in pageVersions.versions track by version.id\" ng-change=\"changeVersion()\"></select>",link:function(e,n,r){},controller:["$scope","$http","contextInfo","manualApi","$window","queryString","log",function(e,n,r,i,o,s,t){function a(){var n=r.pageListId,s=r.pageItemId,a=r.pageFileVersionForDisplay,p=r.webServerRelativeUrl;if(e.spHostUrl=r.spHostUrl,e.dataReady=!1,e.editMode=r.pageIsInEditMode,!e.editMode){var u={pageListId:n,pageItemId:s,pageVersion:a,webServerRelativeUrl:window.encodeURIComponent(p)};i.getPageVersions(u).then(function(n){e.pageVersions=n;var r=c("PageVersion",o.location.href);""!==r?e.selectedVersion=d(e.pageVersions.versions,r):e.selectedVersion=e.pageVersions.versions[0],e.dataReady=!0,e.changeVersion=function(){t(e.selectedVersion.id),void 0!==typeof e.selectedVersion&&0!==e.selectedVersion.id?o.location.href=l("PageVersion",e.selectedVersion.id,o.location.href):o.location.href=l("PageVersion",null,o.location.href)};var i="enOutdated",s="enDraft";e.selectedVersion.id===e.pageVersions.versions[0].id&&e.selectedVersion.id!==e.pageVersions.majorVersionId?angular.element(".shadowContent").addClass(s):e.selectedVersion.id!==e.pageVersions.versions[0].id&&e.selectedVersion.id!==e.pageVersions.majorVersionId&&angular.element(".shadowContent").addClass(i)})}}function d(e,n){try{for(var r=e.length,i=parseInt(n),o=0;r>o;o++)if(e[o].id==i)return e[o]}catch(s){}return e[0]}var l=function(e,n,r){var i=new RegExp("([?&])"+e+"=.*?(&|#|$)(.*)","gi");if(i.test(r)){if("undefined"!=typeof n&&null!==n)return r.replace(i,"$1"+e+"="+n+"$2$3");var o=r.split("#");return r=o[0].replace(i,"$1$3").replace(/(&|\?)$/,""),"undefined"!=typeof o[1]&&null!==o[1]&&(r+="#"+o[1]),r}if("undefined"!=typeof n&&null!==n){var s=-1!==r.indexOf("?")?"&":"?",o=r.split("#");return r=o[0]+s+e+"="+n,"undefined"!=typeof o[1]&&null!==o[1]&&(r+="#"+o[1]),r}return r},c=function(e,n){try{for(var r=n.split("?")[1].split("&"),i=0;i<r.length;i+=1){var o=r[i].split("=");if(o[0]==e)return o[1]}}catch(s){return""}};a()}]}});
angular.module("Wizdom365.Manual").directive("wizdom365ManualRelevant",[function(){return{scope:{},template:'<div class="bootstrap-wrapper">\n                            <div class="webpart-edit-button-container" ng-if="editMode">\n                                <button class="editWebpartButton btn" ng-click="editWebpart()" type="button" title=\'{{"Edit Webpart" | translate}}\'>\n                                    <span class="ms-Icon ms-Icon--Edit"></span><span class="editWebpartButtonText">{{"Edit" | translate}}</span>\n                                </button>\n                            </div>\n                        	<div wizdom-include=\'webpartProperties.templateUrl\'></div>\n                        	<div wizdom365-spinner="" loading="loading"></div>    \n                        </div>',link:function(e,t,a){},controller:["$scope","$element","$attrs","webpartPropertiesService","$http","contextInfo","manualApi","$window","$modal",function(e,t,a,n,r,i,l,o,p){n.hideEditCode(t),e.webpartId=n.getWebpartId(t);var s=a.webpartProperties?JSON.parse(a.webpartProperties):null;e.webpartProperties={siteUrl:s&&s.siteUrl||"",templateUrl:s&&s.templateUrl||"Manual/Templates/ViewTemplates/Relevant/Relevant.html"},e.editMode=n.isInEditMode(t);i.pageListId,i.pageItemId,i.webServerRelativeUrl;e.spHostUrl=i.spHostUrl,e.loading=!0,e.editWebpart=function(){p.open({templateUrl:"Manual/Templates/Dialogs/EditWebpartRelevant.html",controller:"relevantpagesEditCtrl",windowClass:"bootstrap-wrapper",resolve:{webpartId:function(){return e.webpartId},webpartProperties:function(){return e.webpartProperties}}}).result.then(function(t){t&&(e.webpartProperties=t,d())})};var d=function(){var t=e.webpartProperties.siteUrl;l.getRelevantPages(encodeURIComponent(t)).then(function(t){t.manualPages&&t.manualPages.length>0&&(e.manualPages=t.manualPages),e.loading=!1})};d()}]}}]);
!function(){function e(e){var r={baseUrl:"api/wizdom/manual",getAtoZPages:function(r){return e.get(this.baseUrl+"/atoz?siteUrl="+r)},markAsRead:function(r){return e.post(this.baseUrl+"/markasread",r)},canMarkAsRead:function(r){return e.get(this.baseUrl+"/canmarkasread/"+r.pageListId+"/"+r.pageItemId+"/"+r.pageVersion+"/?webServerRelativeUrl="+r.webServerRelativeUrl)},getMustReadPages:function(r){return e.get(this.baseUrl+"/mustread/?siteUrl="+r)},getPageActive:function(r){return e.get(this.baseUrl+"/pageactive/"+r.pageListId+"/"+r.pageItemId+"/"+(r.pageVersion?r.pageVersion.replace(".","_"):"current")+"/?webServerRelativeUrl="+r.webServerRelativeUrl)},getPageResponsible:function(r){return e.get(this.baseUrl+"/pageresponsible/"+r.pageListId+"/"+r.pageItemId+"/"+(r.pageVersion?r.pageVersion.replace(".","_"):"current")+"/?webServerRelativeUrl="+r.webServerRelativeUrl)},getPageVersions:function(r){return e.get(this.baseUrl+"/pageversions/"+r.pageListId+"/"+r.pageItemId+"/"+(r.pageVersion?r.pageVersion.replace(".","_"):"current")+"/?webServerRelativeUrl="+r.webServerRelativeUrl)},getRelevantPages:function(r){return e.get(this.baseUrl+"/relevantpages?siteUrl="+r)},clearCache:function(){return e.get(this.baseUrl+"/clearcache")},getSocialOverview:function(r){return e.get(this.baseUrl+"/social/overview/"+r.pageListId+"/"+r.pageItemId+"/?webServerRelativeUrl="+r.webServerRelativeUrl)}};return r}angular.module("Wizdom365.Manual").factory("manualApi",e),e.$inject=["webapiService"]}();
angular.module("Wizdom365").requires.push("Wizdom365.Manual");