(function(n,t){var u=t.module("viSDK.engagement.common",["vi.common"]),r=t.extend({apiEndPoint:""},n.engagementConfig||{}),i=r.apiEndPoint;r.apiEndPoint=i.lastIndexOf("/")==i.length-1?i.substring(0,i.length-1)+"/":i+"/";u.constant("engagementCommonSDKConfig",r)})(window,window.angular),function(){window.viCurrentModule&&window.viCurrentModule.requires.push("viAppEngagementCommentFileDownload");var n=angular.module("viAppEngagementCommentFileDownload",["ngAnimate","ngCookies","ngSanitize","toastr","blockUI","viSDK.engagement.common"])}(),function(n,t){var i=t.module("viAppEngagementCommentFileDownload");i.directive("commentFileDownload",["$compile","$parse","engagementCommonSDKConfig","$http",function(t,i,r,u){return{restrict:"A",replace:!0,scope:{autoTrigger:"=",fileName:"=",fileType:"=",fileCode:"="},link:function(t,i){var f=function(){u({method:"GET",url:r.apiEndPoint+"api/comment/download",params:{code:t.fileCode},responseType:"arraybuffer"}).then(function(i){var e=i.data,a=i.status,r=i.headers,f,s,h;if(e=="No Permission"){alert("You don't have permission to view the document.");return}r=r();var o=t.fileName,c=t.fileType||r["content-type"],u=document.createElement("a");try{f=new Blob([e],{type:c});s=n.URL.createObjectURL(f);u.setAttribute("href",s);u.setAttribute("download",o);navigator.msSaveBlob?navigator.msSaveBlob(f,o):(h=new MouseEvent("click",{view:n,bubbles:!0,cancelable:!1}),u.dispatchEvent(h))}catch(l){console.log(l)}}).catch(function(n){console.log(n.data)})};t.autoTrigger&&f();i.click(function(n){f();n.preventDefault()})}}}])}(window,angular,jQuery),function(n,t){"use strict";t.module("vi.fe.tabs",[]).directive("tabset",["$location",function(n){return{restrict:"E",replace:!0,transclude:!0,scope:!0,controller:["$scope",function(i){i.templateUrl="";var r=i.tabs=[],u=this;this.selectTab=function(n){t.forEach(r,function(n){n.selected=!1});n.selected=!0};this.setTabTemplate=function(n){i.templateUrl=n};this.addTab=function(t){var i=n.path();i&&t.routePath&&i==t.routePath?u.selectTab(t):r.length==0&&u.selectTab(t);r.push(t)}}],template:'<div><div class="vi-fe-tabstrip clearfix"><ul class="vi-fe-tabstrip-items" ng-transclude><\/ul><\/div><div class="vi-fe-tabstrip-content"><ng-include src="templateUrl"><\/ng-include><\/div><\/div>'}}]).directive("tab",function(){return{restrict:"E",replace:!0,require:"^tabset",scope:{title:"@",templateUrl:"@",routePath:"@"},link:function(n,t,i,r){r.addTab(n);n.select=function(){r.selectTab(n)};n.$watch("selected",function(){n.selected&&r.setTabTemplate(n.templateUrl)})},template:'<li ng-class="{\'vi-state-active\': selected}"><a href="#!{{routePath}}" ng-click="select()"><span>{{title}}<\/span><\/a><\/li>'}})}(window,angular),function(n,t){"use strict";var r=t.module("vi.fe.comment",["vi.fe.common","ngSanitize","toastr","ngMessages","infinite-scroll","blockUI","vi.avatar","viValidation","viAppEngagementCommentFileDownload"]),u=t.extend({apiEndPoint:"",maxLevel:3},n.engagementConfig||{}),i=u.apiEndPoint;u.apiEndPoint=i.lastIndexOf("/")==i.length-1?i.substring(0,i.length-1)+"/":i+"/";r.constant("commentConfig",u);r.config(["blockUIConfig",function(n){n.autoBlock=!0}]);r.value("THROTTLE_MILLISECONDS",250)}(window,angular),function(n,t){"use strict";n.viCurrentModule&&n.viCurrentModule.requires.push("vi.fe.blog.list.widget");var u=t.module("vi.fe.blog.list.widget",["vi.fe.common","vi.fe.comment"]),r=t.extend({apiEndPoint:""},n.engagementConfig||{}),i=r.apiEndPoint;r.apiEndPoint=i.lastIndexOf("/")==i.length-1?i.substring(0,i.length-1)+"/":i+"/";u.constant("config",r)}(window,angular),function(n,t){"use strict";var u,r,i;n.viCurrentModule&&n.viCurrentModule.requires.push("vi.fe.topic.grid.widget");u=t.module("vi.fe.topic.grid.widget",["vi.fe.common","vi.fe.tabs","vi.fe.comment","blockUI","vi.ui"]).config(["toastrConfig",function(n){t.extend(n,{positionClass:"toast-top-center",maxOpened:1,autoDismiss:!0})}]);n.needKendoInWidget&&u.requires.push("kendo.directives");r=t.extend({apiEndPoint:""},n.engagementConfig||{});i=r.apiEndPoint;r.apiEndPoint=i.lastIndexOf("/")==i.length-1?i.substring(0,i.length-1)+"/":i+"/";u.constant("config",r)}(window,angular),function(){"use strict"}(window,angular),function(n,t){"use strict";var i=t.module("vi.fe.comment");i.directive("commentBody",function(){return{restrict:"E",replace:!0,template:'<div class="post-body"><div class="comment-header"><span class="byline"><span class="author">{{item.name}}<\/span><span class="mod" ng-if="item.isMod">Mod<\/span><span class="reply-to" ng-show="item.parentID">{{item.replyTo}}<\/span><span class="time-ago-bullet">•<\/span><span class="time-ago">{{item.date}}<\/span><\/span><span class="byline state" ng-if="state.isPending">Hold on, this is waiting to be approved.<\/span><\/div><div class="post-message" ng-bind-html="item.message"><\/div><div class="post-file" ng-if="item.hasFile"><span>Attachment:<\/span><span>{{item.fileName}}<\/span><\/div><div class="comment-footer clearfix"><ul class="comment-footer-menu"><li class="voting" ng-if="showUpVote"><a href="" title="Support" ng-click="upVote()"><span class="count" ng-bind="item.votes" ng-class="{highlight: item.votes}"><\/span><span class="voteicon" ng-class="{highlight: item.votes}">&nbsp;<\/span><span class="text">Support<\/span><\/a><\/li><li class="bullet" ng-if="showReply">•<\/li><li class="reply" ng-if="showReply"><a href="" title="Reply" ng-click="collapseForm()" ng-class="{highlight: item.formShowed}"><span class="text">Reply<\/span><\/a><\/li><li class="bullet" ng-if="showReplies">•<\/li><li class="replies" ng-if="showReplies"><a href="" title="replies" ng-click="collapseChildren()" ng-class="{highlight: item.repliesShowed}"><span class="text">{{item.replies}} {{item.replies==1?"reply":"replies"}}<\/span><\/a><\/li><\/ul><\/div><\/div>'}})}(window,angular),function(n,t){"use strict";var i=t.module("vi.fe.comment");i.directive("commentFile",[function(){return{restrict:"EA",template:'<div class="comment-file">    <div validateinput validateinput-target=".comment-file-item" validateinput-field-name="hiddenCommentFile{{fileIndex}}" validateinput-error-messages-expr="fileErrorMessages">    <div class="comment-file-item" comment-file-item id="commentFileItem{{fileIndex}}">        <label for="fileInput{{fileIndex}}_cus">Choose your attachment:<\/label>        <div class="file_input_item_container">            <div class="file_input_item">                <input type="text" id="fileInput{{fileIndex}}_cus" name="fileInput{{fileIndex}}_cus" autocomplete="off" value="" tabindex="-1" class="file_input_cus" />                <input type="file" id="fileInput{{fileIndex}}" data-file-index="{{fileIndex}}" name="fileInput{{fileIndex}}" class="file_input_ori" accept="{{commentSetting.fileTypes}}" title="Use browse button to fill in" />                <input type="button" value="Browse..." tabindex="-1" class="file_input_cusbtn" />            <\/div>            <a href="javascript:void(0);" class="command form_button cancel_upload_file">Clear<\/a>        <\/div>    <\/div>    <input id="hiddenCommentFile{{fileIndex}}" name="hiddenCommentFile{{fileIndex}}" type="hidden" ng-model="upload.file.hiddenValue" file-size-validator file-extension-validator /><\/div>    <div class="comment-file-tips">        <div class="max-size">Maximum size allowed: {{commentSetting.fileMaxSize}} MB<\/div>        <div class="allowed-types">Allowed types: {{commentSetting.fileTypes}}<\/div>    <\/div><\/div>',link:function(n){n.fileErrorMessages={fileSizeValidator:"The file is too large.",fileExtensionValidator:"The file type is not allowed."}}}}]);i.directive("commentFileFake",[function(){return{restrict:"EA",template:'<div class="comment-file comment-file-fake">    <div>    <div class="comment-file-item">        <label for="fileInput{{fileIndex}}_cus">Choose your attachment:<\/label>        <div class="file_input_item_container">            <div class="file_input_item">                <input type="text" id="fileInput{{fileIndex}}_cus" name="fileInput{{fileIndex}}_cus" ng-click="login(true, \'Please login to your account or create a new one to support attachment.\')" autocomplete="off" value="" tabindex="-1" class="file_input_cus" />                <input type="button" value="Log In" tabindex="-1" class="file_input_cusbtn" ng-click="login(false)" />            <\/div>        <\/div>    <\/div><\/div>    <div class="comment-file-tips">        <div class="max-size">Maximum size allowed: {{commentSetting.fileMaxSize}} MB<\/div>        <div class="allowed-types">Allowed types: {{commentSetting.fileTypes}}<\/div>    <\/div><\/div>',link:function(){}}}]);i.directive("fileSizeValidator",["$compile",function(){return{restrict:"A",require:"ngModel",link:function(n,t,i,r){r.$validators.fileSizeValidator=function(t){if(t){var i=JSON.parse(t).size;if(i||i==0)return i<=n.commentSetting.fileMaxSize*1048576}return!0}}}}]);i.directive("fileExtensionValidator",["$compile",function(){return{restrict:"A",require:"ngModel",link:function(n,t,i,r){r.$validators.fileExtensionValidator=function(t){var r,u,f,i,e;if(t&&(r=JSON.parse(t).ext,r)){for(u=!1,f=n.commentSetting.fileTypes.toLowerCase().split(", "),i=0;i<f.length;i++)e=f[i],e=="."+r.toLowerCase()&&(u=!0);return u}return!0}}}}]);i.directive("commentFileItem",["$compile",function(n){return{restrict:"EA",link:function(t,i){i.on("click",".file_input_cus",function(n){$(this).next("input.file_input_ori").click();n.preventDefault()});i.on("focus",".file_input_cus",function(n){$(this).blur();n.preventDefault()});i.on("change",".file_input_ori",function(n){var r=$(this).val(),u=r.lastIndexOf("\\"),i,f;u>=0&&(r=r.substring(u+1));$(this).prev("input.file_input_cus").val(r);i=n.target.files;f=$(this).attr("data-file-index");i&&i.length==1&&t.$apply(function(){t.upload.file={};t.upload.file.changed=!0;t.upload.file.data=i[0];t.upload.file.name=i[0].name;t.upload.file.size=i[0].size;t.upload.file.type=i[0].type;t.upload.file.hiddenValue=JSON.stringify({size:i[0].size,ext:i[0].name.split(".").pop()});t.postForm["hiddenCommentFile"+f].$setDirty()});n.preventDefault()});i.on("click",".file_input_cusbtn",function(n){$(this).prev("input.file_input_ori").click();$(this).blur();n.preventDefault()});i.on("click","a.cancel_upload_file",function(i){var r=$(this).siblings(".file_input_item"),u;r.html(r.html());n(r.contents())(t);r.find(".file_input_cus").val("");u=$(this).siblings(".file_input_item").find('[type="file"]').attr("data-file-index");t.$apply(function(){t.upload.file={};t.postForm["hiddenCommentFile"+u].$setDirty()});i.preventDefault()})}}}])}(window,window.angular,jQuery),function(n,t){"use strict";var i=t.module("vi.fe.comment");i.directive("commentForm",function(){return{restrict:"E",replace:!0,template:'<form name="postForm" novalidate><div class="post-box" ng-show="formShowed && showReply" ng-class="{\'has-error\': postForm.text.$invalid && postForm.text.$dirty}"><vi-avatar src="{{userProfile.avatar}}" name="{{userProfile.name}}"><\/vi-avatar><div class="editor-wrapper clearfix"><div class="post-text"><div contenteditable="true" name="text" restricted-words restricted-length="2000" required placeholder="{{formPlaceHolder}}" ng-model="message"><\/div><\/div><div class="post-action clearfix" ng-if="userProfile.loggedIn()"><a class="" ng-click="post()" href>Post as <span ng-bind-html="userProfile.name"><\/span><\/a><\/div><div class="post-action clearfix" ng-if="!userProfile.loggedIn() && anonymous.getID()"><a class="" vi-recaptcha-callback="post()" vi-recaptcha-validate="postValidate()" href>Post Comment<\/a><\/div><div class="post-action login-action clearfix" ng-if="!userProfile.loggedIn() && !anonymous.getID()"><a class="" ng-click="login(false)" href="javascript:void(0)">Log In<\/a><\/div><\/div><div class="validation" ng-messages="postForm.text.$error" ng-if="postForm.text.$dirty">  <div ng-message="required">Comments cannot be blank.<\/div>  <div ng-message="restrictedWords">Your comment has not been posted because it has triggered the profanity filter. Please revise your comment and submit again.<\/div>  <div ng-message="restrictedLength">Your comment is too long. Please revise your comment.<\/div><\/div><div class="file-wrapper" ng-if="commentSetting.allowFile">  <comment-file><\/comment-file><\/div><\/div><\/form>'}})}(window,angular),function(n,t){"use strict";var i=t.module("vi.fe.comment");i.directive("commentFormRoot",["currentUser","comment","commentSetting","anonymousUser","$timeout",function(n,t,i,r,u){return{restrict:"E",replace:!0,scope:{refresh:"&"},controller:["$scope",function(f){f.commentSetting=i;f.userProfile=n.profile();f.anonymous=r.data();f.login=function(t,i){n.login(t,i)};f.fileIndex=0;f.upload={file:{}};var e=function(n){if(n&&i.allowFile&&f.upload.file.changed){var r=new FormData;return r.append("data",f.upload.file.data),r.append("name",f.upload.file.name),r.append("size",f.upload.file.size),r.append("type",f.upload.file.type),r.append("commentID",n),t.uploadFile(r)}return $q.resolve({})};f.message="";f.post=function(){f.postValidate()&&t.post({message:f.message,fromID:null,user:n.buildUserParams()}).then(function(n){n&&n.hasRestrictedWords?(f.postForm.text.$setValidity("restrictedWords",!1),f.postForm.text.$setDirty()):e(n.commentID).then(function(){u(function(){$("#commentFileItem"+f.fileIndex+" .cancel_upload_file").click()});f.refresh();f.message="";f.postForm.text.$setPristine();f.userProfile.loggedIn()&&(i.userPosted=!0)})}).catch(function(){f.refresh()})};f.postValidate=function(){if(f.showForm){if(f.postForm.$valid)return!0;f.postForm.text.$setDirty()}return!1};f.$watch("commentSetting",function(){f.showForm=i.multiple||!i.userStats.postCount&&(f.userProfile.loggedIn()||!i.userPosted)},!0);f.formPlaceHolder="Express your thoughts ..."}],template:'<form name="postForm" novalidate><div class="post-box" ng-show="showForm" ng-class="{\'has-error\': postForm.text.$invalid && postForm.text.$dirty}"}"><vi-avatar src="{{userProfile.avatar}}" name="{{userProfile.name}}"><\/vi-avatar><div class="editor-wrapper clearfix"><div class="post-text"><div contenteditable="true" name="text" restricted-words restricted-length="2000" required placeholder="{{formPlaceHolder}}" ng-model="message"><\/div><\/div><div class="post-action clearfix" ng-if="userProfile.loggedIn()"><a class="" ng-click="post()" href>Post as <span ng-bind-html="userProfile.name"><\/span><\/a><\/div><div class="post-action clearfix" ng-if="!userProfile.loggedIn() && anonymous.getID()"><a class="" vi-recaptcha-callback="post()" vi-recaptcha-validate="postValidate()" href>Post Comment<\/a><\/div><div class="post-action login-action clearfix" ng-if="!userProfile.loggedIn() && !anonymous.getID()"><a class="" ng-click="login(false)" href>Log In<\/a><\/div><\/div><div class="validation" ng-messages="postForm.text.$error" ng-if="postForm.text.$dirty">  <div ng-message="required">Comments cannot be blank.<\/div>  <div ng-message="restrictedWords">Your comment has not been posted because it has triggered the profanity filter. Please revise your comment and submit again.<\/div>  <div ng-message="restrictedLength">Your comment is too long. Please revise your comment.<\/div><\/div><div class="file-wrapper" ng-if="commentSetting.allowFile">  <comment-file><\/comment-file><\/div><\/div><\/form>'}}])}(window,angular),function(n,t){"use strict";var i=t.module("vi.fe.comment");i.directive("commentPost",["$compile","$rootScope","comment","commentConfig","currentUser","commentSetting","anonymousUser","$q","$timeout",function(n,i,r,u,f,e,o,s,h){function a(t,i){var r='<div class="post"><div class="post-content"><vi-avatar src="{{item.avatar}}" name="{{item.name}}"><\/vi-avatar><comment-body><\/comment-body><comment-form><\/comment-form><\/div>'+c(t)+"<\/div>";i.append(r);n(i.contents())(t)}function c(n){var i="";return t.isArray(n.item.children)&&n.item.children.length!==0&&(l(n),i='<comment-posts items="item.children" ng-class="{\'stop-level\': item.level == maxLevel - 1 }"><\/comment-posts>'),i}function l(n){t.forEach(n.item.children,function(t){t.level=n.item.level+1})}return{restrict:"E",replace:!0,scope:{item:"="},controller:["$scope",function(n){n.item.level=n.item.level||1;n.maxLevel=u.maxLevel||5;n.userProfile=f.profile();n.anonymous=o.data();n.commentSetting=e;n.fileIndex=n.item.id;n.upload={file:{}};n.login=function(n,t){f.login(n,t)};n.collapseForm=function(){n.formShowed=!n.formShowed};n.upVote=function(){n.showUpVote&&(n.userProfile.loggedIn()||n.anonymous.getID()?r.vote({fromID:n.item.id,user:f.buildUserParams()}).then(function(t){n.item.votes=t||0}).catch(function(){}):n.login(!0))};var t=function(t){if(t&&e.allowFile&&n.upload.file.changed){var i=new FormData;return i.append("data",n.upload.file.data),i.append("name",n.upload.file.name),i.append("size",n.upload.file.size),i.append("type",n.upload.file.type),i.append("commentID",t),r.uploadFile(i)}return s.resolve({})};n.message="";n.post=function(){n.postValidate()&&r.post({fromID:n.item.id,message:n.message,user:f.buildUserParams()}).then(function(i){i&&i.hasRestrictedWords?(n.postForm.text.$setValidity("restrictedWords",!1),n.postForm.text.$setDirty()):t(i.commentID).then(function(){h(function(){$("#commentFileItem"+n.fileIndex+" .cancel_upload_file").click()});n.refreshChildren();n.message="";n.postForm.text.$setPristine();n.formShowed=!1;n.userProfile.loggedIn()&&(e.userPosted=!0)})}).catch(function(){n.refreshChildren();n.formShowed=!1})};n.postValidate=function(){if(n.formShowed&&n.showReply){if(n.postForm.$valid)return!0;n.postForm.text.$setDirty()}return!1};n.state={isPending:n.item.state==="pending"};n.showReplies=n.item.level===1&&n.item.replies&&!n.state.isPending;n.$watch("commentSetting",function(){n.showUpVote=!n.state.isPending&&e.upVote&&e.comment;n.showReply=!n.state.isPending&&e.comment&&(e.multiple||!e.userStats.postCount&&(n.userProfile.loggedIn()||!e.userPosted))},!0);n.formPlaceHolder="Reply to "+n.item.name+" ..."}],link:function(t,i){a(t,i);t.collapseChildren=function(){var e=i.find("> .post"),u=i.find(" > .post > ul.children");u.length===0?r.getChildren({fromID:t.item.id,user:f.buildUserParams()}).then(function(i){t.item.children=i.items;t.item.replies=i.replies;var r=c(t);r?(t.item.repliesShowed=!0,e.append(n(r)(t))):t.item.repliesShowed=!1}):t.item.repliesShowed?(u.hide(),t.item.repliesShowed=!1):(u.show(),t.item.repliesShowed=!0)};t.refreshChildren=function(){r.getChildren({fromID:t.item.id,user:f.buildUserParams()}).then(function(r){var f,u,e;t.item.children=r.items;t.item.replies=r.replies;f=i.find("> .post");u=i.find(" > .post > ul.children");u.length===0?(e=c(t),f.append(n(e)(t))):(l(t),u.show());t.item.repliesShowed=!0})}}}}])}(window,angular),function(n,t){"use strict";var i=t.module("vi.fe.comment");i.directive("commentPosts",function(){return{restrict:"E",replace:!0,scope:{items:"=",isRoot:"="},template:'<ul class="post-list {{isRoot ? \'root\' : \'children\' }}"><li ng-repeat="item in items"><comment-post item="item"><\/comment-post><\/li><\/ul>'}})}(window,angular),function(n,t){"use strict";var i=t.module("vi.fe.comment");i.directive("contenteditable",function(){return{require:"ngModel",link:function(t,i,r,u){function e(t){var i,r;n.getSelection?(i=n.getSelection(),i.getRangeAt&&i.rangeCount&&(r=i.getRangeAt(0),r.deleteContents(),r.insertNode(document.createTextNode(t)))):document.selection&&document.selection.createRange&&(document.selection.createRange().text=t)}var f=r.placeholder;u.$render=function(){f&&!u.$viewValue?i.html(f):i.html(u.$viewValue||"")};i.on("blur keyup change",function(){t.$apply(function(){var n=i.html();n==="<br>"&&(n="");u.$setViewValue(n)})});i.on("blur",function(){u.$viewValue||i.html(f)});i.on("focus",function(){u.$viewValue||i.empty();!t.userProfile||t.userProfile.loggedIn()||t.anonymous.getID()||(i.trigger("blur"),t.login(!0))});i[0].addEventListener("paste",function(t){var i;t.preventDefault();t.clipboardData&&t.clipboardData.getData?(i=t.clipboardData.getData("text/plain"),document.execCommand("insertText",!1,i)):n.clipboardData&&n.clipboardData.getData&&(i=n.clipboardData.getData("Text"),e(i))})}}})}(window,angular),function(n,t){"use strict";var i=t.module("vi.fe.comment");i.directive("feComment",function(){return{restrict:"E",replace:!0,scope:{},controller:["$scope","comment","currentUser","commentSetting",function(n,t,i,r){function u(){n.busy||n.nomore||(n.busy=!0,t.loadNextPage({after:n.after,pageSize:f,user:i.buildUserParams()}).then(function(t){var i,r;if(t&&t.length>0){for(n.nomore=!1,i=0;i<t.length;i++)n.items.push(t[i]);r=n.items.length>0?n.items[n.items.length-1].id:0;n.after=r}else n.nomore=!0;n.busy=!1},function(n){console.error(n)}))}var f=20;n.commentSetting=r;n.items=[];n.refresh=function(){n.nomore=!1;n.after=0;n.items=[];u()};n.nextPage=u;n.nomore=!1;n.busy=!1;n.after=0}],template:'<div class="fe-comment" ng-init="refresh()"><div class="posts" block-ui block-ui-pattern="/.*?api/comment.*/">  <comment-form-root class="first-form" refresh="refresh()" ng-if="commentSetting.comment"><\/comment-form-root>  <div class="list-container">    <div infinite-scroll="nextPage()" infinite-scroll-distance="0" infinite-scroll-disabled="busy || nomore" infinite-scroll-container=\'".list-container"\'>      <comment-posts items="items" is-root="true"><\/comment-posts>    <\/div>  <\/div>  <div ng-show="busy" class="busy">Loading data...<\/div><\/div><\/div>'}})}(window,angular),function(n,t){"use strict";var i=t.module("vi.fe.comment");i.directive("feCommentSetting",["commentContent","currentUser","commentSetting","comment",function(n,i,r,u){return{restrict:"E",replace:!0,link:function(f,e,o){n.contentID=o.contentId;n.contentType=o.contentType;f.commentSetting=r;u.getCommentSetting({user:i.buildUserParams()}).then(function(n){t.extend(r,n)})},template:"<vi-recaptcha-setting><\/vi-recaptcha-setting>"}}])}(window,angular),function(n,t){"use strict";var i=t.module("vi.fe.comment");i.directive("feCommentTabset",function(){return{restrict:"E",replace:!0,scope:{contentId:"@",contentType:"@"},template:'<div><fe-comment-setting content-id="{{contentId}}" content-type="{{contentType}}"><\/fe-comment-setting><div ng-if="commentSetting.showComment()"><tabset class="comment-tabset"><tab title="Public Comments" ng-if="commentSetting.showComment()" template-url="comment.tmpl" class="comment-tab" route-path="/comments"><\/tab><\/tabset><script type="text/ng-template" id="comment.tmpl"><fe-comment><\/fe-comment><\/script><\/div>'}});i.directive("fePreviewCommentTabset",function(){return{restrict:"E",replace:!0,scope:{contentId:"@",contentType:"@",loginUserName:"@"},template:'<div><fe-comment-setting content-id="{{contentId}}" content-type="{{contentType}}"><\/fe-comment-setting><div ng-if="commentSetting.showComment()"><tabset class="comment-tabset"><tab title="Public Comments" template-url="comment.be.tmpl" class="comment-tab" route-path="/comments"><\/tab><\/tabset><script type="text/ng-template" id="comment.be.tmpl"><div class="fe-comment"><div class="posts"><form name="postForm" class="first-form"><div class="post-box"><vi-avatar src="" name="{{loginUserName}}"><\/vi-avatar><div class="editor-wrapper"><div class="post-text"><div contenteditable="true" name="text" placeholder="Express your thoughts ..." ng-model="message" ng-disabled="disabled"><\/div><\/div><div class="post-action clearfix"><a class="" href="javascript:void(0);">Post Comment<\/a><\/div><\/div><\/div><\/form><\/div><\/div><\/script><\/div>'}})}(window,angular),function(n,t){"use strict";var i=t.module("vi.fe.comment");i.directive("restrictedLength",["$compile",function(){return{restrict:"A",require:"ngModel",link:function(n,t,i,r){var u=parseInt(i.restrictedLength);r.$validators.restrictedLength=function(n){return u>n.length}}}}])}(window,angular),function(n,t){"use strict";var i=t.module("vi.fe.comment");i.directive("restrictedWords",["$compile",function(){return{restrict:"A",require:"ngModel",link:function(n,t,i,r){r.$validators.restrictedWords=function(){return!0}}}}])}(window,angular),function(n,t){"use strict";function i(n,i,r,u,f,e,o,s){function h(n){n.user&&!e.profile().loggedIn()&&(n.user.anonymousID=s.data().getID())}function l(i){return h(i),n({method:"POST",url:u.apiEndPoint+"api/comment/getCommentSetting",data:t.extend(i,o)}).then(function(n){return s.anonymous(n.data.allowAnonymous),n.data})}function a(i){return h(i),n({method:"POST",url:u.apiEndPoint+"api/comment/vote",data:t.extend(i,o)}).then(function(n){s.anonymous(n.data.settings.allowAnonymous);t.extend(r,n.data.settings);return n.data.votes})}function v(i){return h(i),n({method:"POST",url:u.apiEndPoint+"api/comment/post",data:t.extend(i,o)}).then(function(n){return s.anonymous(n.data.settings.allowAnonymous),t.extend(r,n.data.settings),n.data})}function y(i){return n({url:u.apiEndPoint+"api/comment/uploadFile",method:"POST",data:i,transformRequest:t.identity,headers:{"Content-Type":undefined}}).then(function(n){return n.data})}function p(i){return h(i),n({method:"POST",url:u.apiEndPoint+"api/comment/loadNextPage",data:t.extend(i,o)}).then(function(n){s.anonymous(n.data.settings.allowAnonymous);t.extend(r,n.data.settings);var i=n.data.items;return c(i),i},function(n){console.error(n)})}function w(i){return h(i),n({method:"POST",url:u.apiEndPoint+"api/comment/getChildren",data:t.extend(i,o)}).then(function(n){s.anonymous(n.data.settings.allowAnonymous);t.extend(r,n.data.settings);var i=n.data.items;return c(i),{items:i,replies:n.data.replies||0}})}function c(n){var r,u,i;if(t.isArray(n))for(r=e.profile(),u=0;u<n.length;u++)i=n[u],!i.isMod&&r.userID&&r.userID==i.siteUserID?(i.name=r.name,i.avatar=r.avatar):(i.name=i.name,i.avatar=i.imgID&&i.imgID>0?i.isMod?f.photoBaseUrl+i.imgID:f.photoBaseUrlForPeople+i.imgID:i.anonymousID?s.data().avatar:""),i.replyTo&&(i.replyTo=r.userID&&r.userID==i.replyTo.siteUserID?r.name:i.replyTo.name),i.children&&c(i.children)}return{getChildren:w,post:v,uploadFile:y,vote:a,loadNextPage:p,getCommentSetting:l}}var r=t.module("vi.fe.comment");r.factory("comment",i);i.$inject=["$http","$q","commentSetting","commentConfig","commonConfig","currentUser","commentContent","anonymousUser"]}(window,angular),function(n,t){"use strict";function i(){return{contentID:0,contentType:""}}var r=t.module("vi.fe.comment");r.factory("commentContent",i);i.$inject=[]}(window,angular),function(n,t){"use strict";function i(){var n={comment:!1,allowAnonymous:!1,upVote:!1,multiple:!1,anyPublicPosts:!1,allowFile:!1,fileTypes:!1,fileMaxSize:5,userStats:{postCount:1},showComment:function(){return this.comment||this.anyPublicPosts}};return Object.defineProperty(n,"userPosted",{get:function(){return localStorage?localStorage.getItem("cms6_comment_user_posted"):!1},set:function(n){localStorage&&localStorage.setItem("cms6_comment_user_posted",n)}}),n}var r=t.module("vi.fe.comment");r.factory("commentSetting",i);i.$inject=[]}(window,angular),function(n,t){"use strict";var i=t.module("vi.fe.blog.list.widget");i.controller("blogListWidgetController",["$scope","toastr","blogListWidgetService","feUtils","$http",function(n,i,r,u,f){n.blogList2Columns={init:function(n,t,i){this.imageUrl=t;this.cmsAjaxLoadImagesUrl=i;this.blogIds=n;this.getBlogModels()},blogIds:[],blogModels:[],cmsImages:[],cmsAjaxLoadImagesUrl:"",imageUrl:"",getBlogModels:function(){var n=this;r.getMultiBlogContent(this.blogIds).then(function(t){var i=t.data;i.blogs&&(n.blogModels=i.blogs,i.blogs.length>0&&n.getCmsImages())}).catch(function(){})},getCmsImages:function(){var r=this,u=Enumerable.From(this.blogModels).Where(function(n){return n.thumbnailImageID!=null}).Select(function(n){return n.thumbnailImageID}).ToArray(),e=Enumerable.From(this.blogModels).Where(function(n){return n.moderatorThumbnailImageID!=null}).Select(function(n){return n.moderatorThumbnailImageID}).ToArray(),n=this.cmsAjaxLoadImagesUrl,i=0;t.forEach(u,function(t){var r=n.indexOf("?")>=0?"&":"?";n=n+r+"imageIds["+i+"]="+t;i++});t.forEach(e,function(t){var r=n.indexOf("?")>=0?"&":"?";n=n+r+"imageIds["+i+"]="+t;i++});f.get(n).then(function(n){r.cmsImages=n.data.Data}).catch(function(){})},getImageFromList:function(n,t){var i,r;return this.cmsImages.length>0&&(i=this.getBlog(n),t=t||!1,i&&(r=t?i.moderatorThumbnailImageID:i.thumbnailImageID,r&&r>0))?Enumerable.From(this.cmsImages).Where(function(n){return n.ID==r}).FirstOrDefault():undefined},generateImageAlt:function(n){var t=this.getImageFromList(n);return t?t.Alt:""},generateImageWidth:function(n){var t=this.getImageFromList(n);return t?t.Width:""},generateImageHeight:function(n){var t=this.getImageFromList(n);return t?t.Height:""},getBlog:function(n){return this.blogModels.length>0?Enumerable.From(this.blogModels).Where(function(t){return t.blogID==n}).FirstOrDefault():undefined},generateAuthorName:function(n){var t=this.getBlog(n);return t?t.moderatorName:""},hasAuthorImage:function(n){var t=this.getBlog(n);return t!=undefined&&t.moderatorThumbnailImageID},generateImageUrl:function(n){var t=this.getBlog(n);return t&&this.imageUrl&&t.moderatorThumbnailImageID?this.imageUrl.indexOf("?")>-1?this.imageUrl.replace("id=0","id="+t.moderatorThumbnailImageID):this.imageUrl.replace("/0","/"+t.moderatorThumbnailImageID):""},generateReadEstimation:function(n){var i=this.getBlog(n),r,t;return i?(r=i.contentLength,t=Math.round(r/200),t<1&&t++,t+" min read"):"1 min read"},formatShortName:function(n){var i=this.generateAuthorName(n),t;return i.length>0?(t=i.split(" "),t.length>1?t[0].toUpperCase()[0]+t[t.length-1].toUpperCase()[0]:t[0].toUpperCase()[0]):i}}}])}(window,angular),function(n,t){"use strict";function i(n,i,r){function u(i){var u=r.apiEndPoint+"api/blog/getmultiblogcontent";return i&&t.forEach(i,function(n,t){var i=u.indexOf("?")>=0?"&":"?";u=u+i+"ids["+t+"]="+n}),n({method:"GET",url:u})}return{getMultiBlogContent:u}}var r=t.module("vi.fe.blog.list.widget");r.factory("blogListWidgetService",i);i.$inject=["$http","$q","config"]}(window,angular),function(n,t){"use strict";var i=t.module("vi.fe.topic.grid.widget");i.directive("pollChart",function(){return{restrict:"E",replace:!0,template:'<div class="chart-view"><ul><li><div kendo-chart="chart1" class="poll-chart-pie" options="chartOption1"><\/div><\/li><li><table class="port-chart-table"><tr><th><\/th><th>COUNT<\/th><th>PERCENT<\/th><\/tr><tr ng-repeat="vote in pollVoteItems"><td><span class="chart-color-box" ng-style=\'{"background": vote.color}\'><\/span> {{vote.category}}<\/td><td class="poll-count">{{vote.value}}<\/td><td class="poll-perc">{{((vote.value/pollTotalItems)*100) | number: 2}}%<\/td><\/tr><tr class="poll-total"><td><\/td><td>{{pollTotalItems}}<\/td><td><\/td><\/table><\/li><\/ul><\/div>'}})}(window,angular),function(n,t){"use strict";function i(i,r,u,f,e,o,s){function tt(n){var t=n;return n>=w&&(t=n%w),u[t]}var c="pollVote",nt=90,l=e.profile(),v=null,h,y,p,w,d,g;l.loggedIn()&&(v=l.userID);i.userLoggedIn=l.loggedIn();i.hasVoted=o.isClosed;i.isCurrent=o.isCurrent;i.answers=[];i.other={};i.completionMessage="";i.checkPassword=!1;i.needSecurity=!1;i.pollSecurities=[];h=0;y=0;i.passFormData={};p="";i.selectTip=function(n){return i.selectTip=n.replace("{0}",h)};i.loginConfirm=function(){if(i.poll.allowAnonymousResponses)return!0;e.login(!0,"Please login to your account or create a new one to vote on this poll.");t.forEach(i.pollAnswers,function(n){n.checked=!1})};i.login=function(){var t=s.loginPage+"?returnUrl="+encodeURIComponent(n.location.href);n.location.href=t};w=u.length;var b=function(){i.hasVoted&&(i.pollVoteItems=[],i.pollTotalItems=0,r.getPollChartData(o.topicID).then(function(n){var t=$.map(n.items,function(n,t){return{category:n.pollResponse,value:n.num,color:tt(t)}}),r;i.pollVoteItems=t;i.pollTotalItems=n.maxCount;r={title:{position:"bottom"},legend:{visible:!1},chartArea:{background:"",height:300},seriesDefaults:{labels:{visible:!1,background:"transparent",template:"${ category }: (${ value } - ${Math.round(value/"+n.maxCount+" *100,2)}%)"},overlay:"none"},series:[{type:"pie",startAngle:150,data:t}],tooltip:{visible:!0,template:"${ category }: (${ value } - ${ ((value /"+n.maxCount+") *100).toFixed(2)}%)"}};i.chartOption1=r}).catch(function(n){var t="Data Retrieve Failed";n.data.message!=null&&(t=n.data.message);f.error(t)}))},a=function(){var n,t;if(i.checkPassword=!1,i.needSecurity)for(i.needSecurity=!1,n=0;n<i.pollSecurities.length;n++)if(!i.pollSecurities[n].passed){i.pollSecurities[n].securityTypeID===1?(i.checkPassword=!0,y=n,i.needSecurity=!0):i.pollSecurities[n].securityTypeID===4?(t=JSON.parse(i.pollSecurities[n].setting),i.pollVoteStatEntryCount>=t.maxEntryAllowed?(i.hasVoted=!0,i.completionMessage=t.quotaReacheMessage,b(t),i.needSecurity=!0):(i.pollSecurities[n].passed=!0,i.needSecurity=!0,a())):(i.pollSecurities[n].passed=!0,i.needSecurity=!0,a());break}},k=function(n){var r=!1,u=!1,i=JSON.parse(n);return i&&(t.forEach(i,function(n,t){var f=new Date((new Date).getTime()-new Date(n.lastModifiedDate).getTime());f.getUTCDate()-1>nt?(u=!0,i.splice(t,1)):o.topicID==n.topicID&&(r=!0)}),u&&(i.length>0?localStorage.setItem(c,JSON.stringify(i)):localStorage.removeItem(c))),r},it=function(){var n=localStorage.getItem(c),i={topicID:o.topicID,lastModifiedDate:new Date},t=[];n?k(n)||(n=JSON.parse(n),n.push(i),t=n):t.push(i);t.length>0&&localStorage.setItem(c,JSON.stringify(t))},rt=function(){return i.poll.allowAnonymousResponses?k(localStorage.getItem(c)):!1};r.getPoll({pollID:o.topicID,userID:v}).then(function(n){i.poll=n.poll;l.loggedIn()&&(i.poll.allowAnonymousResponses=!1);i.pollAnswers=n.pollAnswers;i.pollVoteStatEntryCount=n.pollVoteStatEntryCount;i.hasVoted=n.hasVoted||o.isClosed||rt();i.poll.maxSelectionCount||(i.poll.maxSelectionCount=n.pollAnswers.length);h=i.poll.maxSelectionCount;for(var t=0;t<n.pollSecurities.length;t++)n.pollSecurities[t].disabled||(i.needSecurity=!0,i.pollSecurities.push({securityTypeID:n.pollSecurities[t].securityTypeID,setting:n.pollSecurities[t].setting,passed:!1}),n.pollSecurities[t].securityTypeID==1&&(p=JSON.parse(n.pollSecurities[t].setting).password,i.checkPassword=!0));for(i.answers=[],t=0;t<i.pollAnswers.length;t++)i.pollAnswers[t].checked&&i.answers.push(i.pollAnswers[t]),i.pollAnswers[t].type===1&&(i.other.disabled=(!i.userLoggedIn||!i.pollAnswers[t].checked)&&!(i.poll.allowAnonymousResponses&&i.pollAnswers[t].checked)),i.pollAnswers[t].disabled=!i.userLoggedIn||o.isUpcoming;b();a()}).catch(function(n){var t="Data Retrieve Failed";n.data.message!=null&&(t=n.data.message);f.error(t)});i.valid=!0;d=function(){return i.errorMessages=[],i.multipleSelectionValid=i.answers.length==0,i.valid=i.answers.length>0,i.valid||(i.poll.allowMultipleSelections?i.errorMessages.push("You should select at least one option."):i.errorMessages.push("You must select an option.")),i.valid};g=function(){return i.poll.allowMultipleSelections&&i.answers.length<=h?!0:!i.poll.allowMultipleSelections&&i.answers.length==1?!0:!1};i.multipleSelectionValid=!0;i.multipleSelectionErrorMessage="";i.post=function(n){i.postValidate()&&r.post({pollID:o.topicID,pollAnswers:i.answers,pollOtherAnswer:i.other.otherAnswer,userID:v,IP:n,userAgent:navigator.userAgent,voteDate:new Date,user:e.buildUserParams(),otherInfo:""}).then(function(){i.hasVoted=!0;i.completionMessage=i.poll.completionMessage;b();it()}).catch(function(n){var t="Data Post Failed";n.data&&(t=n.data);f.error(t)})};i.postValidate=function(){if(d()){if(g())return!0;i.multipleSelectionValid=!1;i.multipleSelectionErrorMessage="You cannot select more than "+i.poll.maxSelectionCount+(i.poll.maxSelectionCount>1?" answers.":" answer.")}return!1};i.singleVote=function(n,t){i.valid=!0;i.answers[0]=n;i.other.disabled=(!i.userLoggedIn||t!=1)&&!(i.poll.allowAnonymousResponses&&t==1)};i.multipleVote=function(n,t){if(h!==null){var r=0;if(n){if(i.answers.push(t),i.answers.length==h)for(r=0;r<i.pollAnswers.length;r++)i.pollAnswers[r].disabled=i.pollAnswers[r].checked?!1:!0}else{for(r=0;r<i.answers.length;r++)i.answers[r]===t&&i.answers.splice(r,1);for(r=0;r<i.pollAnswers.length;r++)i.pollAnswers[r].disabled=!1}for(r=0;r<i.pollAnswers.length;r++)i.pollAnswers[r].type===1&&(i.other.disabled=(!i.userLoggedIn||!i.pollAnswers[r].checked)&&!(i.poll.allowAnonymousResponses&&i.pollAnswers[r].checked))}};i.submitPassword=function(){i.valid=i.passFormData.pswd===p;i.valid&&(i.pollSecurities[y].passed=!0,a())}}var r=t.module("vi.fe.topic.grid.widget");r.controller("pollController",i);i.$inject=["$scope","poll","chartColor","toastr","currentUser","sharedInfo","commonConfig"]}(window,angular),function(n,t){"use strict";var i=t.module("vi.fe.topic.grid.widget");i.directive("pollOptions",function(){return{restrict:"E",template:'<ol class="formlist" ng-click="!userLoggedIn && loginConfirm()"><li ng-show="poll.allowMultipleSelections"><div class="poll-vote-selections-tip">You may choose a maximum of {{poll.maxSelectionCount}} selection<span ng-if="poll.maxSelectionCount > 1">s<\/span>.<\/div><\/li><li ng-repeat="pollAnswer in pollAnswers" id="{{pollAnswer.id}}"><input id="pollanswer-{{pollAnswer.id}}" ng-if="!poll.allowMultipleSelections" type="radio" name="pollAnswer" ng-disabled="userLoggedIn && pollAnswer.disabled" ng-click="singleVote(pollAnswer.id, pollAnswer.type)" value="{{pollAnswer.id}}" ng-model="pollAnswer.checked" /><input id="pollanswer-{{pollAnswer.id}}" ng-if="poll.allowMultipleSelections" type="checkbox" name="pollAnswer" value="{{pollAnswer.id}}" ng-change="multipleVote(pollAnswer.checked, pollAnswer.id)" ng-model="pollAnswer.checked" /><label for="pollanswer-{{pollAnswer.id}}">{{pollAnswer.name}}<\/label><\/li><li ng-show="poll.allowOtherAnswer"><input type="text" ng-disabled="other.disabled" class="OtherTextBox" ng-model="other.otherAnswer" /><\/li><\/ol>'}})}(window,angular),function(n,t){"use strict";var i=t.module("vi.fe.topic.grid.widget");i.directive("pollSecurityPassword",function(){return{restrict:"E",replace:!1,template:'<div class="validation-error" ng-if="!valid"><span>The password is not correct.<\/span><\/div><div class="password-security-tips">To access this poll, please enter the required password.<\/div><ol class="formlist"><li><label>Password* <\/label> <input ng-model="passFormData.pswd" type="password" placeholder="Enter password" ng-disabled="!userLoggedIn && !poll.allowAnonymousResponses"" ng-keydown="$event.which === 13 && submitPassword()"}" /><\/li><\/ol><p class="command_box"><input ng-if="userLoggedIn || poll.allowAnonymousResponses" type="button" class="command primary" ng-click="submitPassword()" value="Submit" /><input ng-if="!userLoggedIn && !poll.allowAnonymousResponses" type="button" value="Login" ng-click="login()" /><\/p>'}})}(window,angular),function(n,t){"use strict";function r(n,t,i){function r(t){return n({method:"POST",url:i.apiEndPoint+"api/poll",data:t}).then(function(n){return n.data||[]})}function u(t){return n({method:"POST",contentType:"application/json",url:i.apiEndPoint+"api/poll/getpollmodel",data:t}).then(function(n){return n.data||[]})}function f(n){for(var i=n||[],r=0,t=0,u=i.length;t<u;t++)r+=i[t].num;return r}function e(t){return n({method:"GET",url:i.apiEndPoint+"api/poll/getPollChartData/"+t}).then(function(n){return{maxCount:f(n.data),items:n.data||[]}})}return{getPoll:u,post:r,getPollChartData:function(n){return e(n)}}}var i=t.module("vi.fe.topic.grid.widget");i.value("chartColor",["#17262d","#2f4d5a","#477388","#5f9ab5","#77c1e3","#92cde8","#add9ee","#c8e6f3"]);i.factory("poll",r);r.$inject=["$http","$q","config"]}(window,angular),function(n,t){"use strict";var i=t.module("vi.fe.topic.grid.widget");i.controller("subscribeController",["$scope","toastr","currentUser","sharedInfo","subscribeService","$interval",function(t,i,r,u,f,e){t.subscribeInfo={status:{subscribedStatus:-1,explanationText:""},defautErrorStatus:{subscribedStatus:-1,explanationText:""},isLoggedIn:function(){return this.websiteUser.userID>0},isSubscribed:function(){return this.status.subscribedStatus==2||this.status.subscribedStatus==3},isSubscribedSuccesfully:function(){return this.status.subscribedStatus==2},isWaitingToConfirm:function(){return this.status.subscribedStatus==3},isConfirmationExpire:function(){return this.status.subscribedStatus==5},isUnsubscribeSuccessfully:function(){return this.status.subscribedStatus==6||this.status.subscribedStatus==7},countDownToRefresh:5,websiteUser:{email:r.profile().email,firstName:r.profile().firstName,lastName:r.profile().lastName,userID:r.profile().userID,loggedIn:r.profile().loggedIn},login:r.login,newSubcriberEmail:"",unsubscriberEmail:"",systemInfo:{fromName:"",fromEmail:"",requestUrl:"",confirmationCode:"",unsubscribedCode:""},topicId:null,init:function(n,t){var i=this;i.topicId=n;i.systemInfo=t;t&&t.unsubscribedCode&&t.unsubscribedCode!=""||(i.websiteUser&&i.websiteUser.email!=""?i.getSubscribeStatus():t&&t.confirmationCode&&t.confirmationCode!=""&&i.confirmSubscribeTopic())},getSubscribeStatus:function(){var n=this,t={email:n.websiteUser.email,topicId:n.topicId};f.getSubscribeStatus(t).then(function(t){n.status=t.data}).catch(function(){n.status=n.defautErrorStatus})},validation:{message:"",result:!0},validationInput:function(){var n=this.systemInfo.unsubscribedCode!=""?this.unsubscriberEmail:this.websiteUser.userID>0?this.websiteUser.email:this.newSubcriberEmail,t,i;return n==""?(this.validation={message:"Email is required.",result:!1},!1):(t=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,i=t.test(n),!i)?(this.validation={message:"Email is not valid.",result:!1},!1):!0},validationUnSubscribe:function(){return this.systemInfo.unsubscribedCode!=""&&this.validationInput()},resetValidate:function(){this.validation={message:"",result:!0}},unsubcribeTopic:function(){if(this.validationUnSubscribe()){var t=this,i={topicId:t.topicId,requestUrl:t.systemInfo.requestUrl,unSubscribeCode:t.systemInfo.unsubscribedCode,unSubscribeEmail:t.unsubscriberEmail};f.unsubcribeTopic(i).then(function(i){var r=i.data,u;t.status=r;t.isUnsubscribeSuccessfully()?u=e(function(){t.countDownToRefresh--;t.countDownToRefresh<=0&&(n.location.href=t.systemInfo.requestUrl,e.cancel(u))},1e3):t.validation={message:r.subscribedStatus==9?"Sorry, you've entered the incorrect email. Try again.":"Oop! Unsubscribed failed.",result:!1}}).catch(function(n){var i=n.data;t.status=t.defautErrorStatus;t.validation={message:"Oop! Unsubscribed failed.",result:!1}})}},subcribeFrontendTopic:function(){if(this.validationInput()){var n=this,t={websiteUserID:n.websiteUser.userID>0?n.websiteUser.userID:null,emailAddress:n.websiteUser.userID>0?n.websiteUser.email:n.newSubcriberEmail,topicId:n.topicId,firstName:n.websiteUser.firstName,lastName:n.websiteUser.firstName,orgName:n.systemInfo.orgName,includeInSubject:n.systemInfo.includeInSubject,fromName:n.systemInfo.fromName,fromEmail:n.systemInfo.fromEmail,requestUrl:n.systemInfo.requestUrl};f.subcribeFrontendTopic(t).then(function(t){var i=t.data;n.status=i;i.subscribedStatus==4&&r.login(!0,"This email is already registered with an existing user account. Would you like to login?")}).catch(function(t){var i=t.data;n.status=n.defautErrorStatus;n.validation={message:"Oop! Subscribed topic failed.",result:n.isSubscribedSuccesfully()}})}},confirmSubscribeTopic:function(){var n=this,t={topicId:n.topicId,orgName:n.systemInfo.orgName,includeInSubject:n.systemInfo.includeInSubject,fromName:n.systemInfo.fromName,fromEmail:n.systemInfo.fromEmail,requestUrl:n.systemInfo.requestUrl,confirmationCode:n.systemInfo.confirmationCode};f.confirmSubscribeTopic(t).then(function(t){var i=t.data;n.status=i;n.validation={message:n.isSubscribedSuccesfully()?"":n.isConfirmationExpire()?"Confirmation code expired! Cannot subscribe the topic.":"Oop! Subscribed topic failed.",result:n.isSubscribedSuccesfully()}}).catch(function(t){var i=t.data;n.status=n.defautErrorStatus;n.validation={message:"Oop! Subscribed topic failed.",result:!1}})}}}])}(window,angular),function(n,t){"use strict";function i(n,t,i){function r(t){var r=i.apiEndPoint+"api/topic/getsubscribestatus";return t&&(t.topicId&&(r+="?topicId="+t.topicId),t.email&&(r+=(r.indexOf("?")>=0?"&":"?")+"email="+t.email)),n({method:"GET",url:r})}function u(t){var r=i.apiEndPoint+"api/topic/subcribefrontendtopic";return n({method:"POST",url:r,data:t})}function f(t){var r=i.apiEndPoint+"api/topic/confirmsubscribetopic";return n({method:"POST",url:r,data:t})}function e(t){var r=i.apiEndPoint+"api/topic/unsubcribefrontendtopic";return n({method:"POST",url:r,data:t})}return{getSubscribeStatus:r,subcribeFrontendTopic:u,confirmSubscribeTopic:f,unsubcribeTopic:e}}var r=t.module("vi.fe.topic.grid.widget");r.factory("subscribeService",i);i.$inject=["$http","$q","config","sharedInfo"]}(window,angular),function(n,t){"use strict";function i(){return{topicID:0,poll:!1,isUpcoming:!1,isCurrent:!1,isClosed:!1}}var r=t.module("vi.fe.topic.grid.widget");r.factory("sharedInfo",i);i.$inject=[]}(window,angular),function(n,t){var i=t.module("vi.fe.topic.grid.widget");i.controller("TopicTabs",["$scope","topicTab","sharedInfo","currentUser","commentSetting",function(n,i,r,u,f){n.settingLoaded=!1;n.init=function(u){var e=JSON.parse(u);r.topicID=e.ID;r.isUpcoming=e.Status==1;r.isCurrent=e.Status==2;r.isClosed=e.Status==3;r.fileMaxSize=f.fileMaxSize;i.getTopicSetting(e.ID).then(function(i){t.extend(r,i);n.setting=r;n.settingLoaded=!0})}}])}(window,angular),function(n,t){"use strict";function i(n,t,i){function r(t){return n({method:"GET",url:i.apiEndPoint+"api/topic/getTopicSetting/"+t}).then(function(n){return n.data})}return{getTopicSetting:r}}var r=t.module("vi.fe.topic.grid.widget");r.factory("topicTab",i);i.$inject=["$http","$q","config"]}(window,angular);;
