var SubManSignUpController,SignUpEvents;(function(){"use strict";angular.module("subman",["subman.login","subman.manage","subman.signUp","ngSanitize"])})(),function(){"use strict";angular.module("subman.login",["core","dataServices"])}(),function(){"use strict";function n(n,t,i){function f(){r.queryParams=t.parseQueryString(window.location.search.substring(1));r.queryParams.loggedout==="true"&&(r.mainError="We're sorry, your session has expired.  Please log back in by clicking the link in an email you previously received, or use the form below to generate a new login email.")}function e(t){return r.loginFormSubmitting=!0,r.loginSent=!1,r.loginSentError=!1,r.mainError="",n.SendLogin({subscriberEmail:t}).$promise.then(function(){r.loginSent=!0}).catch(function(n){return n.status===404?(r.mainError="Oh no! It looks like we don't have you in our system. Just let us know a little bit about you and you'll be on your way to receiving "+u+" email.",r.showSignUp=!0):r.loginSentError=!0,i.reject(n)}).finally(function(){r.loginFormSubmitting=!1})}function o(){return serverSettings.signUpTemplate&&serverSettings.signUpTemplate!==""?serverSettings.signUpTemplate.indexOf("kexp")>=0?"KEXP":serverSettings.signUpTemplate.indexOf("uwaa")>=0?"UWAA":"UW":"UW"}var r=this,u=o();r.loginEmail="";r.loginFormSubmitting=!1;r.loginSent=!1;r.loginSentError=!1;r.mainError="";r.showSignUp=!1;r.Lead=null;r.queryParams;r.submitLogin=e;f()}angular.module("subman.login").controller("SubManLoginController",n);n.$inject=["LoginService","UTILITIES","$q"]}(),function(){"use strict";function n(n,t){function r(n){return i.save({},n)}var i=n(t.applicationRoot+"SubscriptionManagement/SendLogin",{},{save:{method:"POST"}});return{SendLogin:r}}angular.module("dataServices").factory("LoginService",n);n.$inject=["$resource","ServerSettings"]}(),function(){"use strict";angular.module("subman.signUp",[])}();SubManSignUpController=function(){function n(n,t,i){this.$q=n;this.SignUpService=t;this.SignUpEvents=i;this.signUpFormSubmitting=!1;this.signUpFormSent=!1;this.signUpFormSentError=!1;this.subscriberTokenErrorNotFound=!1;this.mainError="";this.Lead={email:null,firstName:null,lastName:null,SubscriptionID:null,SubscriptionName:null};this.Errors={SubscriptionIdMissing:!1};this._activate()}return n.prototype._activate=function(){this._checkIfNeedToSendConfirmationEvent()},n.prototype.submitSignUp=function(){var n=this;return this.signUpFormSubmitting=!0,this.signUpFormSent=!1,this.signUpFormSentError=!1,this.subscriberTokenErrorNotFound=!1,this.SignUpService.Submit({signUpVM:this.Lead}).$promise.then(function(){n.signUpFormSent=!0;n.SignUpEvents.signUpEvent(n.Lead.SubscriptionID.join(","))}).catch(function(t){return n.signUpFormSentError=!0,n.$q.reject(t)}).finally(function(){n.signUpFormSubmitting=!1})},n.prototype._checkIfNeedToSendConfirmationEvent=function(){var i;try{var r=document.getElementById("signUpConfirmed"),u=r!==null?!0:!1,n=document.getElementById("signUpConfirmedSubscriptionID"),t=n!==null?n.value:null;u&&t!==null&&(i=JSON.parse(t),this.SignUpEvents.signUpConfirmedEvent(i.join(",")))}catch(f){}},n.$inject=["$q","SignUpService","SignUpEvents"],n}();angular.module("subman.signUp").controller("SubManSignUpController",SubManSignUpController),function(){"use strict";function n(n,t){function r(n){return i.save({},n)}var i=n(t.applicationRoot+"SignUp/SignUp",{},{save:{method:"POST"}});return{Submit:r}}angular.module("dataServices").factory("SignUpService",n);n.$inject=["$resource","ServerSettings"]}();SignUpEvents=function(){function n(){this._config={inIframeOverride:!1};this._config.inIframeOverride&&console.error("remember to toggle config.inIframeOverride off")}return n.prototype.signUpEvent=function(n){this.sendToParent({subscriptionIDs:n},"signUpEvent")},n.prototype.signUpConfirmedEvent=function(n){this.sendToParent({subscriptionIDs:n},"signUpConfirmedEvent")},n.prototype.sendToParent=function(n,t){if(this.inIframe()){var i=this.serializePostMessageData(n,t.toString());this.postMessage(i)}},n.prototype.inIframe=function(){if(this._config.inIframeOverride)return!0;try{return window.self!==window.top}catch(n){return!0}},n.prototype.serializePostMessageData=function(n,t){n.MessageType=t;return{token:"0347sdfgj22",message:JSON.stringify(n)}},n.prototype.postMessage=function(n){window.parent.postMessage(n,"*")},n}();angular.module("subman.signUp").service("SignUpEvents",SignUpEvents),function(){"use strict";angular.module("subman.manage",["core","tree","dataServices","ngCookies"])}(),function(){"use strict";function n(n,t,i,r,u){function s(){this.Lead=null;this.SubscriptionID=null;this.MySubscriptions=null;this.AllSubscriptions=null;this.AssociatedInstanceInfo=null;this.BioUpdateFormURL=null;this.SetUpParameters=null;this.managePrefSuccess=!1;this.mySubscriptionsSuccess=!1;this.updateInfoSuccess=!1;this.bioUpdateFormLoadFail=!1;this.requestSuccess=!1;this.manageAllSuccess=!1;this.managePreferences={active:!1,selectedInterest:[]};this.paths={};this.setIndexData=a;this.getMineFromAll=v;this.getSelectedInterestFromID=e;this.clearTabMessaging=y;this.submitPreferences=p;this.globalOptOut=w;this.globalOptIn=b;this.unsubscribe=k;this.updateInfo=d;this.GDPRDeleteRequest=g;this.GDPRInfoRequest=nt;this.GDPRUpdateConsent=tt;this.GDPRDenyConsent=it;this.getBioUpdateURL=c;this.getManageModel=h;this.getAssociatedInstanceInfo=l}function h(){return t.GetModel().$promise.then(function(n){f.manageService.setIndexData(n);f.manageService.MySubscriptions=f.manageService.getMineFromAll(n.AllSubscriptions)}).catch(function(t){return n.reject(t)})}function c(){return t.GetBioUpdateURL().$promise.then(function(t){return f.manageService.BioUpdateFormURL=t.message,n.when()}).catch(function(t){return n.reject(t)})}function l(){return t.GetAssociatedInstanceInfo().$promise.then(function(n){f.manageService.AssociatedInstanceInfo=n}).catch(function(t){return n.reject(t)})}function a(n){this.Lead=n.Lead;this.SubscriptionID=parseInt(n.SubMan.SubscriptionID,10);this.AllSubscriptions=n.AllSubscriptions;this.SetUpParameters=n.SubMan}function e(n){var t=null,i=function i(r){for(var u=0;u<r.length;u++)if(r[u].SubscriptionID===n){t=r[u];break}else r[u].Children&&r[u].Children.length>0&&i(r[u].Children)};return i(f.manageService.AllSubscriptions),t}function v(n){var t=[],i=function i(n){for(var r=0;r<n.length;r++)n[r].LeadSubscribed?t.push(n[r]):n[r].Children&&n[r].Children.length>0&&i(n[r].Children)},r=function(){var i=function(n){for(var t=n,i=[];t.ParentID!==0;)t=e(t.ParentID),i.unshift(t);f.manageService.paths[n.SubscriptionID]=i},n;if(t.length>0)for(n=0;n<t.length;n++)i(t[n])};return i(n),r(),t}function y(){f.manageService.mySubscriptionsSuccess=!1;f.manageService.manageAllSuccess=!1;f.manageService.managePrefSuccess=!1;f.manageService.updateInfoSuccess=!1;f.manageService.bioUpdateFormLoadFail=!1;f.manageService.requestSuccess=!1;i.msg=""}function p(){var t={AllSubscriptions:f.manageService.AllSubscriptions};return f.manageService.clearTabMessaging(),r.Submit(t).$promise.then(function(n){o(n)}).catch(function(t){return i.showDefault(),n.reject(t)})}function w(){return f.manageService.clearTabMessaging(),r.GlobalOptOut().$promise.then(function(n){f.manageService.Lead=n}).catch(function(t){return i.showDefault(),n.reject(t)})}function b(){return f.manageService.clearTabMessaging(),r.GlobalOptIn().$promise.then(function(n){f.manageService.Lead=n}).catch(function(t){return i.showDefault(),n.reject(t)})}function k(t){var u={subscriptionName:t};return f.manageService.clearTabMessaging(),r.Unsubscribe(u).$promise.then(function(n){o(n)}).catch(function(t){return i.showDefault(),n.reject(t)})}function d(){var t={Lead:f.manageService.Lead};return f.manageService.clearTabMessaging(),u.Submit(t).$promise.then(function(n){f.manageService.Lead=n}).catch(function(t){return t.status===304&&t.statusText.toLowerCase()==="pending verification"?n.reject(t):(t.status===304?t.statusText.toLowerCase()==="email exists"?i.msg="We're sorry, the update failed because this email address already exists in our database.":i.showDefault():i.showDefault(),n.reject(t))})}function g(){return f.manageService.clearTabMessaging(),u.GDPRDeleteRequest().$promise.then(function(n){f.manageService.Lead=n}).catch(function(t){return i.msg="We're sorry, we are having trouble sending your request. Please email <a href=\"mailto:emailpref@uw.edu'\"><u>emailpref@uw.edu<\/u><\/a> if this problem persists.",n.reject(t)})}function nt(){return f.manageService.clearTabMessaging(),u.GDPRInfoRequest().$promise.then(function(n){f.manageService.Lead=n}).catch(function(t){return i.msg="We're sorry, we are having trouble sending your request. Please email <a href=\"mailto:emailpref@uw.edu'\"><u>emailpref@uw.edu<\/u><\/a> if this problem persists.",n.reject(t)})}function tt(t){return u.GDPRUpdateConsent(t).$promise.then(function(n){f.manageService.Lead=n}).catch(function(t){return n.reject(t)})}function it(){return f.manageService.GDPRUpdateConsent(!1).then(function(){return f.manageService.globalOptOut()}).catch(function(t){return n.reject(t)})}function o(n){var t;f.manageService.AllSubscriptions=n;f.manageService.MySubscriptions=f.manageService.getMineFromAll(n);f.manageService.managePreferences.active&&(t=f.manageService.getSelectedInterestFromID(f.manageService.managePreferences.selectedInterest[0].SubscriptionID),f.manageService.managePreferences.selectedInterest=[t])}var f={manageService:new s};return f}angular.module("subman.manage").factory("SubManManageViewModel",n);n.$inject=["$q","ManageModelService","ManageErrorService","UpdateSubscriptionService","UpdateInformationService",]}(),function(){"use strict";function n(n,t,i,r,u,f,e){function a(){$(document).on("shown.bs.tab",'a[data-toggle="tab"]',function(){var n=$("ul.manage-tabs li.active").attr("id");k();n==="bioUpdateTab"&&d()});o.manageService.getManageModel().then(function(){if(o.urlHash!=="")l(o.manageService.AllSubscriptions),o.showContent=!0,o.evaluateUrlHash();else if(UTILITIES.getQueryStringValue("bioupdate")&&UTILITIES.getQueryStringValue("bioupdate").toLowerCase()==="true")window.location.hash="#updateBio",o.urlHash=window.location.hash.replace("/",""),o.showContent=!0,o.evaluateUrlHash();else{if(o.manageService.SubscriptionID!==null&&o.manageService.SetUpParameters.ManagePref){var n=o.manageService.getSelectedInterestFromID(o.manageService.SubscriptionID);n!==null&&(e.setExpander(n.SubscriptionID,!0),o.manageService.managePreferences.selectedInterest.push(n),o.manageService.managePreferences.active=!0)}l(o.manageService.AllSubscriptions);o.showContent=!0}g()}).catch(function(){o.modelError=!0;o.showContent=!0});o.manageService.getAssociatedInstanceInfo()}function v(){t(function(){$("#manageTabs a[href='"+o.urlHash+"']").tab("show")})}function y(){i.location.href=u.applicationRoot+"SubscriptionManagement/Logout"}function p(){c();$("#confirmEditModal").modal("hide")}function w(){return o.consentSubmitting=!0,o.consentModalError="",c(),o.manageService.GDPRUpdateConsent(!0).then(function(){$("#consentModal").modal("hide")}).catch(function(){o.consentModalError="We're sorry, there was an issue updating your consent preferences. Please email <a href=\"mailto:emailpref@uw.edu'\"><u>emailpref@uw.edu<\/u><\/a> if this problem persists."}).finally(function(){o.consentSubmitting=!1})}function b(){return o.consentSubmitting=!0,o.consentModalError="",c(),o.manageService.GDPRDenyConsent().then(function(){$("#consentModal").modal("hide")}).catch(function(){o.consentModalError="We're sorry, there was an issue updating your consent preferences. Please email <a href=\"mailto:emailpref@uw.edu'\"><u>emailpref@uw.edu<\/u><\/a> if this problem persists."}).finally(function(){o.consentSubmitting=!1})}function l(n){var i=e.hasCheckedChildren,t=function t(n){for(var r=0;r<n.length;r++)n[r].SubscriptionID===1||o.manageService.managePreferences.active&&n[r].SubscriptionID===o.manageService.managePreferences.selectedInterest[0].SubscriptionID?e.setExpander(n[r].SubscriptionID,!0):e.setExpander(n[r].SubscriptionID,i(n[r])),n[r].Children&&n[r].Children.length>0&&t(n[r].Children)};t(n)}function k(){o.manageService.clearTabMessaging()}function d(){o.manageService.BioUpdateFormURL===null&&(o.manageService.bioUpdateFormLoadFail=!1,o.manageService.getBioUpdateURL().then(function(){$("#bioUpdateFrame").prop("src","https://online.gifts.washington.edu/bioupdate"+o.manageService.BioUpdateFormURL)}).catch(function(){o.manageService.bioUpdateFormLoadFail=!0}))}function g(){function r(n,t){for(var r=!1,i=0;i<n.length;i++)if(n[i]===t){r=!0;break}return r}function u(){return o.manageService.SetUpParameters.GDPRConsentPrompt?!0:o.manageService.Lead.IsGDPR&&o.manageService.Lead.gdprConsentStatus===null?!0:!1}function f(){$("body").addClass("confirm-edit-blur");$("#confirmEditModal").modal({backdrop:"static",keyboard:!1});o.modalShown=!0}function e(){t&&$("body").addClass("confirm-edit-blur");$("#consentModal").modal({backdrop:"static",keyboard:!1})}var t=!1,i=!1;h=o.manageService.Lead.SubscriberToken;s=n.getObject("submanEdit")||[];t=r(s,h)?!1:!0;i=u();i?e():t&&f()}function c(){s.push(h);n.putObject("submanEdit",s)}var o=this,h,s=[];angular.extend(o,f);o.evaluateUrlHash=v;o.mainError=r;o.showContent=!1;o.modelError=!1;o.modalShown=!1;o.consentSubmitting=!1;o.consentModalError="";o.urlHash=window.location.hash.replace("/","");o.cancelLogin=y;o.confirmLogin=p;o.confirmConsent=w;o.denyConsent=b;a();$("#confirmEditModal").on("hidden.bs.modal",function(){$("body").removeClass("confirm-edit-blur")});$("#consentModal").on("hidden.bs.modal",function(){$("body").removeClass("confirm-edit-blur")})}angular.module("subman.manage").controller("SubManManageController",n);n.$inject=["$cookies","$timeout","$window","ManageErrorService","ServerSettings","SubManManageViewModel","TreeService"]}(),function(){"use strict";function n(n){function i(){return t.submitting=!0,t.manageService.submitPreferences().then(function(){t.manageService.manageAllSuccess=!0}).finally(function(){t.submitting=!1})}var t=this;angular.extend(t,n);t.submit=i;t.submitting=!1}angular.module("subman.manage").controller("SubManManageAllController",n);n.$inject=["SubManManageViewModel"]}(),function(){"use strict";function n(n){return{restrict:"A",link:function(t,i,r){var u;r.mySubscription==="true"&&(u=$(i),u.addClass("sub-highlighter"),n(function(){$("html, body").animate({scrollTop:u.offset().top},750)},500))}}}angular.module("tree").directive("mySubscription",n);n.$inject=["$timeout"]}(),function(){"use strict";function n(n){function i(n){return t.submitting[n]=!0,t.manageService.unsubscribe(n).then(function(){t.manageService.mySubscriptionsSuccess=!0}).finally(function(){t.submitting[n]=!1})}function r(n){t.manageService.managePreferences.selectedInterest=[];t.manageService.managePreferences.selectedInterest.push(n);t.manageService.managePreferences.active=!0;t.manageService.clearTabMessaging()}var t=this;angular.extend(t,n);t.unsubscribe=i;t.submitting={};t.paths={};t.setActiveInterest=r}angular.module("subman.manage").controller("SubManMySubscriptionsController",n);n.$inject=["SubManManageViewModel"]}(),function(){"use strict";function n(n){function i(){return t.submitting=!0,t.manageService.submitPreferences().then(function(){t.manageService.managePrefSuccess=!0}).finally(function(){t.submitting=!1})}function r(){t.manageService.managePreferences.selectedInterest=[];t.manageService.managePreferences.active=!1;t.manageService.clearTabMessaging()}function u(n){var r=t.manageService.getSelectedInterestFromID(n),i=function i(n){for(var t=0;t<n.length;t++)n[t].Children&&n[t].Children.length>0?i(n[t].Children):n[t].LeadSubscribed=!1};i(r.Children);t.submit()}var t=this;angular.extend(t,n);t.submitting=!1;t.submit=i;t.backToMySubscriptions=r;t.unsubscribeFromAll=u}angular.module("subman.manage").controller("SubManManagePreferencesController",n);n.$inject=["SubManManageViewModel"]}(),function(){"use strict";function n(n,t){function r(){return i.submitting=!0,i.pending=!1,i.manageService.updateInfo().then(function(){i.manageService.updateInfoSuccess=!0}).catch(function(t){return t.status===304&&t.statusText.toLowerCase()==="pending verification"&&(i.pending=!0),n.reject(t)}).finally(function(){i.submitting=!1})}function u(){$("#confirmDeleteRequestModal").modal("show")}function f(){return $("#confirmDeleteRequestModal").modal("hide"),i.deleteRequestSubmitting=!0,i.manageService.GDPRDeleteRequest().then(function(){i.manageService.requestSuccess=!0}).finally(function(){i.deleteRequestSubmitting=!1})}function e(){$("#confirmInformationRequestModal").modal("show")}function o(){return $("#confirmInformationRequestModal").modal("hide"),i.infoRequestSubmitting=!0,i.manageService.GDPRInfoRequest().then(function(){i.manageService.requestSuccess=!0}).finally(function(){i.infoRequestSubmitting=!1})}var i=this;angular.extend(i,t);i.submitting=!1;i.pending=!1;i.deleteRequestSubmitting=!1;i.infoRequestSubmitting=!1;i.submit=r;i.deleteRequest=u;i.confirmDeleteRequest=f;i.infoRequest=e;i.confirmInfoRequest=o}angular.module("subman.manage").controller("SubManUpdateEmailInfoController",n);n.$inject=["$q","SubManManageViewModel"]}(),function(){"use strict";function n(n,t){function r(){return i.globalOptInSubmitting=!0,i.manageService.clearTabMessaging(),i.manageService.globalOptIn().then(function(){i.manageService.mySubscriptionsSuccess=!0;i.manageService.manageAllSuccess=!0;i.manageService.managePrefSuccess=!0;i.manageService.updateInfoSuccess=!0}).finally(function(){i.globalOptInSubmitting=!1;i.optInSuccess=!0;n(function(){i.optInSuccess=!1},1e3)})}function u(){i.manageService.clearTabMessaging();$("#globalOptOutModal").modal("show")}function f(){$("#globalOptOutModal").modal("hide");i.manageService.gOptOutSubmitting=!0;i.manageService.globalOptOut().finally(function(){i.manageService.gOptOutSubmitting=!1})}var i=this;angular.extend(i,t);i.globalOptInSubmitting=!1;i.optInSuccess=!1;i.globalOptIn=r;i.globalOptOut=u;i.globalOptOutConfirm=f}angular.module("subman.manage").controller("SubManGlobalOptController",n);n.$inject=["$timeout","SubManManageViewModel"]}(),function(){"use strict";function n(){function n(){var n='<div ng-if="vm.manageService.Lead.unsubscribed === true">';return n+='<div class="alert alert-danger">',n+='<span class="icon-remove"><\/span>',n+='You have opted out of all email communication. <a ng-click="gOptCtrl.globalOptIn()" style="text-decoration:underline;cursor:pointer" class="ga-opt-in-global">Click here<\/a> to opt back in and start receiving email again. <span class="spinner" style="position:relative;top:3px;" ng-show="gOptCtrl.globalOptInSubmitting">',n+="<\/span>",n+="<\/div>",n+"<\/div>"}return{restrict:"E",controller:"SubManGlobalOptController",controllerAs:"gOptCtrl",template:n}}angular.module("subman.manage").directive("globalOpt",n)}(),function(){"use strict";function n(){function n(n,t){var i=t.attr("id");$("#"+i).responsiveIframe({xdomain:"*",scrollToTop:!1})}return{restrict:"A",link:n}}angular.module("subman.manage").directive("bioIframe",n)}(),function(){"use strict";function n(){function n(){var n='<div class="alert alert-info" ng-if="assiCtrl.manageService.AssociatedInstanceInfo.length > 1">';return n+='<span class="icon-info-sign"><\/span>Looks like your email address is associated with multiple preference centers. You are currently managing: <select ng-options="instance.InstanceInfo.InstanceID as instance.InstanceInfo.Name for instance in assiCtrl.manageService.AssociatedInstanceInfo" ng-model="assiCtrl.manageService.Lead.InstanceInfo.InstanceID" ng-change="assiCtrl.instanceChange()"><\/select>',n+="<\/span>",n+"<\/div>"}return{restrict:"E",controller:"SubManAssociatedInstancesController",controllerAs:"assiCtrl",template:n}}angular.module("subman.manage").directive("userAssociatedInstances",n)}(),function(){"use strict";function n(n,t,i,r,u){function e(){var t=f.manageService.Lead.InstanceInfo.InstanceID,r=i("filter")(f.manageService.AssociatedInstanceInfo,{InstanceInfo:{InstanceID:t}}),e=r[0].SubscriberToken;u.location.href=n.applicationRoot+"SubscriptionManagement?SubscriberToken="+e}var f=this;angular.extend(f,t);f.instanceChange=e}angular.module("subman.manage").controller("SubManAssociatedInstancesController",n);n.$inject=["ServerSettings","SubManManageViewModel","$filter","$scope","$window"]}(),function(){"use strict";function n(){function t(t){var i=typeof t!="undefined"?t:"emailpref@uw.edu";n.msg="Sorry, we're having trouble updating your record at this time. Please email <a href=\"mailto:"+i+'"><u>'+i+"<\/u><\/a> if this problem persists."}var n={msg:"",showDefault:t};return n}angular.module("subman.manage").factory("ManageErrorService",n)}(),function(){"use strict";function n(n,t){function f(){return u.get()}function e(){return i.get()}function o(){return r.get()}var i=n(t.applicationRoot+"SubscriptionManagement/GetManageModel",{},{get:{method:"GET"}}),r=n(t.applicationRoot+"SubscriptionManagement/GetAssociatedInstanceInfo",{},{get:{method:"GET",isArray:!0}}),u=n(t.applicationRoot+"SubscriptionManagement/EntityToUpdate",{},{get:{method:"GET"}});return{GetBioUpdateURL:f,GetModel:e,GetAssociatedInstanceInfo:o}}angular.module("dataServices").factory("ManageModelService",n);n.$inject=["$resource","ServerSettings",]}(),function(){function n(n,t){return function(i,r,u){i.$watch(u.animateOnChange,function(i,u){i!=u&&n.addClass(r,"change").then(function(){t(function(){n.removeClass(r,"change")},1e3)})})}}angular.module("subman").directive("animateOnChange",n);n.$inject=["$animate","$timeout"]}(),function(){"use strict";function n(n,t,i,r,u){function s(){f.type==="subPrefEditor"&&c()}function h(n){var i,t;if(n.Children&&n.Children.length>0){for(i=!1,t=0;t<n.Children.length;t++)if(n.Children[t].LeadSubscribed!==!0){i=!0;break}return!i}return n.LeadSubscribed?!0:!1}function o(n,t,i){var e=i==="allUW"?$("#allUW-center"):$("#preferences-center"),f=$("input[id='"+n.SubscriptionID+"']",e).is(":checked"),u;if(i==="test"&&(f=!0),f||t)for(r.setExpander(n.SubscriptionID,!0),u=0;u<n.Children.length;u++)n.Children[u].Children&&n.Children[u].Children.length>0?($("input[id='"+n.Children[u].SubscriptionID+"']").attr("checked",!0),o(n.Children[u],!0)):n.Children[u].LeadSubscribed=!0;else if(!f||!t)for(u=0;u<n.Children.length;u++)n.Children[u].Children&&n.Children[u].Children.length>0?($("input[id='"+n.Children[u].SubscriptionID+"']").attr("checked",!1),o(n.Children[u],!1)):n.Children[u].LeadSubscribed=!1}function c(){function h(n,t){n&&n!==t&&t===null&&c()}function c(){var n;e=u.parseQueryString(i.location.search.substring(1));e.id&&(n=r.getNestedPref(parseInt(e.id,10),t.preferences),n===null&&(n="not found"),o(n))}function o(n){r.setNodeToEdit(n)}function l(n){r.insertNewNodeAbove(n)}function a(n){r.insertNewNodeBelow(n)}function v(t){var i=n(t);return i.position>0?!0:!1}function y(t){var i=n(t);return i.position+1===i.siblings.length?!1:!0}function p(t){var i=n(t);s(i.siblings,i.position,i.position-1)}function w(t){var i=n(t);s(i.siblings,i.position,i.position+1)}function n(n){var i;return i=n.ParentID===0?t.preferences:r.getNestedPref(n.ParentID,t.preferences).Children,{position:i.indexOf(n),siblings:i}}function s(n,t,i){if(r.reorderOccurred=!0,i>=n.length)for(var u=i-n.length;u--+1;)n.push(undefined);return n.splice(i,0,n.splice(t,1)[0]),n}f.editPref=o;f.insertPrefAbove=l;f.insertPrefBelow=a;f.prefCanMoveUp=v;f.prefCanMoveDown=y;f.movePrefUp=p;f.movePrefDown=w;t.$watch("preferences",h,!0)}var f=this,e;f.expander=r.getExpanderList();f.hasCheckedChildren=r.hasCheckedChildren;f.allChildrenChecked=h;f.checkChildren=o;f.type=t.type;f.editPref;f.insertPrefAbove;f.insertPrefBelow;f.prefCanMoveUp;f.prefCanMoveDown;f.movePrefUp;f.movePrefDown;s()}angular.module("tree").controller("TreeController",n);n.$inject=["$filter","$scope","$window","TreeService","UTILITIES"]}(),function(){"use strict";function n(){function r(n,t){i[n]=t}function u(){return i}function f(n){var t=!1,i=function i(n){for(var r=0;r<n.length;r++)if(n[r].LeadSubscribed){t=!0;break}else n[r].Children&&n[r].Children.length>0&&i(n[r].Children)};if(n.Children&&n.Children.length>0)i(n.Children);else return!1;return t}function e(){t()}function o(i){t();n.nodeToEdit=i}function s(i){t();n.nodeToInsertAbove=i}function h(i){t();n.nodeToInsertBelow=i}function c(n,t){function u(t){var f,e=t.length;if(i===null)for(f=0;f<e;f++)if(t[f].SubscriptionID===n){i=t[f];r=t.indexOf(i);t.splice(r,1);break}else t[f].Children&&t[f].Children.length>0&&u(t[f].Children)}var i=null,r;u(t)}function l(n,t){function r(t){var u,f=t.length;if(i===null)for(u=0;u<f;u++)if(t[u].SubscriptionID===n){i=t[u];break}else t[u].Children&&t[u].Children.length>0&&r(t[u].Children)}var i=null;return r(t),i}function t(){n.lastNodeChange={nodeToEdit:n.nodeToEdit,nodeToInsertAbove:n.nodeToInsertAbove,nodeToInsertBelow:n.nodeToInsertBelow};n.nodeToEdit=null;n.nodeToInsertAbove=null;n.nodeToInsertBelow=null}var i={},n={setExpander:r,getExpanderList:u,hasCheckedChildren:f,setNodeToEdit:o,insertNewNodeAbove:s,insertNewNodeBelow:h,clearNodeToEditSettings:e,getNestedPref:l,removeNestedPref:c,lastNodeChange:{},nodeToEdit:null,nodeToInsertAbove:null,nodeToInsertBelow:null,reorderOccurred:!1};return n}angular.module("tree").factory("TreeService",n)}(),function(){"use strict";function n(n){return{restrict:"E",templateUrl:n.applicationRoot+"Scripts/app/shared/tree/tree.html",scope:{preferences:"=preferences",lead:"=lead",type:"@treeType",inputsDisabled:"@inputsDisabled",loading:"=loading"},link:function(n,t){var i=$(t),r,u,f;n.$watch("loading",function(n,t){n!==t&&n===!0?(r=$(".pref-box"),u=r.outerHeight(),f=r.outerWidth(),i.addClass("loading"),i.prepend("<div id='treeLoadingBar' style='width:"+f+"px;height:"+u+"px;'><div class='loading-bar'><\/div><\/div>")):($("#treeLoadingBar").remove(),i.removeClass("loading"))})}}}angular.module("tree").directive("subscriptionTree",n);n.$inject=["ServerSettings"]}(),function(){"use strict";function n(){function n(n){n.addClass("highlight")}return{restrict:"A",link:function(t,i,r){var u,f,e,o;if(r.treeType==="subPrefEditor"){u=i;o=u.closest(".pref-box");f=$(".right-click-menu",u.parent());e=$(".dropdown-toggle",f);u.on("click",function(t){var i=u.closest("subscription-tree").hasClass("loading");if(t.preventDefault(),t.stopPropagation(),o.animate({scrollTop:u.position().top-100+o.scrollTop()+"px"}),i)return!1;$(".pref-box label.highlight").removeClass("highlight");n(u);e.dropdown();e.dropdown("toggle");f.one("hide.bs.dropdown",function(){u.removeClass("highlight")})})}}}}angular.module("tree").directive("adminClickTreeNode",n)}(),function(){"use strict";function n(n,t){var i=n(t.applicationRoot+"SubscriptionManagement/UpdateSubscription",{},{save:{method:"POST",isArray:!0}}),r=n(t.applicationRoot+"SubscriptionManagement/Unsubscribe",{},{save:{method:"POST",isArray:!0}}),u=n(t.applicationRoot+"SubscriptionManagement/GlobalOptOut",{},{save:{method:"POST"}}),f=n(t.applicationRoot+"SubscriptionManagement/GlobalOptBackIn",{},{save:{method:"POST"}});return{Submit:function(n){return i.save({},n)},Unsubscribe:function(n){return r.save({},n)},GlobalOptOut:function(){return u.save({})},GlobalOptIn:function(){return f.save({})}}}angular.module("dataServices").factory("UpdateSubscriptionService",n);n.$inject=["$resource","ServerSettings"]}(),function(){"use strict";function n(n,t){var i=n(t.applicationRoot+"SubscriptionManagement/UpdateInformation",{},{save:{method:"POST"}}),r=n(t.applicationRoot+"SubscriptionManagement/GDPRDeleteRequest",{},{save:{method:"POST"}}),u=n(t.applicationRoot+"SubscriptionManagement/GDPRRequestInfo",{},{save:{method:"POST"}}),f=n(t.applicationRoot+"SubscriptionManagement/GDPRUpdateConsent",{},{save:{method:"POST"}});return{Submit:function(n){return i.save({},n)},GDPRDeleteRequest:function(){return r.save({},{})},GDPRInfoRequest:function(){return u.save({},{})},GDPRUpdateConsent:function(n){return f.save({},{consent:n})}}}angular.module("dataServices").factory("UpdateInformationService",n);n.$inject=["$resource","ServerSettings"]}()