a.field.fieldValue=a.field.fieldOptions[d].option_value}))})}}}),angular.module("forms").directive("keyToTruthy",["$rootScope",function(a){return{restrict:"A",scope:{field:"="},link:function(a,b,c){b.bind("keydown keypress",function(b){vard=b.which||b.keyCode,e=c.keyCharTruthy.charCodeAt(0)-32,f=c.keyCharFalsey.charCodeAt(0)-32;d===e?(b.preventDefault(),a.$apply(function(){a.field.fieldValue="true"})):d===f&&(b.preventDefault(),a.$apply(function(){a.field.fieldValue="false"}))})}}}]),angular.module("users").config(["$httpProvider",function(a){a.interceptors.push(["$q","$location",function(a,b){return{responseError:function(c){return"/users/me"!==b.path()&&c.config&&"/users/me"!==c.config.url&&(console.log("intercepted rejection of ",c.config.url,c.status),401===c.status?(console.log(b.path()),b.nextAfterLogin=b.path(),b.path("/signin")):403===c.status&&b.path("/access_denied")),a.reject(c)}}}])}]),angular.module("users").config(["$stateProvider",function(a){varb=function(a,b,c,d,e){varf=a.defer();returne.currentUser&&e.currentUser.email?b(f.resolve):e.currentUser=d.getCurrent(function(){e.login(),b(f.resolve())},function(){e.logout(),b(f.reject()),c.go("signin",{reload:!0})}),f.promise};b.$inject=["$q","$timeout","$state","User","Auth"];varc=function(a,b,c){vard=c.defer();returnb(a.signupDisabled?d.reject():d.resolve()),d.promise};c.$inject=["$window","$timeout","$q"],a.state("profile",{resolve:{loggedin:b},url:"/settings/profile",templateUrl:"modules/users/views/settings/edit-profile.client.view.html"}).state("password",{resolve:{loggedin:b},url:"/settings/password",templateUrl:"modules/users/views/settings/change-password.client.view.html"}).state("accounts",{resolve:{loggedin:b},url:"/settings/accounts",templateUrl:"modules/users/views/settings/social-accounts.client.view.html"}).state("signup",{resolve:{isDisabled:c},url:"/signup",templateUrl:"modules/users/views/authentication/signup.client.view.html"}).state("signup-success",{resolve:{isDisabled:c},url:"/signup-success",templateUrl:"modules/users/views/authentication/signup-success.client.view.html"}).state("signin",{url:"/signin",templateUrl:"modules/users/views/authentication/signin.client.view.html"}).state("access_denied",{url:"/access_denied",templateUrl:"modules/users/views/authentication/access-denied.client.view.html"}).state("verify",{resolve:{isDisabled:c},url:"/verify/:token",templateUrl:"modules/users/views/verify/verify-account.client.view.html"}).state("resendVerifyEmail",{resolve:{isDisabled:c},url:"/verify",templateUrl:"modules/users/views/verify/resend-verify-email.client.view.html"}).state("forgot",{url:"/password/forgot",templateUrl:"modules/users/views/password/forgot-password.client.view.html"}).state("reset-invalid",{url:"/password/reset/invalid",templateUrl:"modules/users/views/password/reset-password-invalid.client.view.html"}).state("reset-success",{url:"/password/reset/success",templateUrl:"modules/users/views/password/reset-password-success.client.view.html"}).state("reset",{url:"/password/reset/:token",templateUrl:"modules/users/views/password/reset-password.client.view.html"})}]),angular.module("users").controller("AuthenticationController",["$scope","$location","$state","$rootScope","User","Auth",function(a,b,c,d,e,f){a=d,a.credentials={},a.error="",a.signin=function(){e.login(a.credentials).then(function(b){f.login(b),a.user=d.user=f.ensureHasCurrentUser(e),"home"!==c.previous.name&&"verify"!==c.previous.name&&""!==c.previous.name?c.go(c.previous.name):c.go("listForms")},function(b){d.user=f.ensureHasCurrentUser(e),a.user=d.user,a.error=b,console.error("loginError: "+b)})},a.signup=function(){e.signup(a.credentials).then(function(a){c.go("signup-success")},function(b){console.error(b),b?(a.error=b,console.error(b)):console.error("No response received")})}}]),angular.module("users").controller("PasswordController",["$scope","$stateParams","$state","User",function(a,b,c,d){a.error="",a.askForPasswordReset=function(){d.askForPasswordReset(a.credentials).then(function(b){a.success=b.message,a.credentials=null},function(b){a.error=
varc=angular.fromJson(a);returnc.visible_form_fields=_.filter(c.form_fields,function(a){returna.deletePreserved===!1}),c}},update:{method:"PUT"},save:{method:"POST"}})}]),function(){functiona(a,b){functionc(a){g.socket=io(a,{transports:["websocket","polling"]})}functiond(a,b){g.socket&&g.socket.emit(a,b)}functione(b,c){g.socket&&g.socket.on(b,function(b){a(function(){c(b)})})}functionf(a){g.socket&&g.socket.removeListener(a)}varg;g={connect:c,emit:d,on:e,removeListener:f,socket:null};varh="";returnh=b.socketPort&&b.socketUrl?b.socketUrl+":"+b.socketPort:b.socketUrl&&!b.socketUrl?b.socketUrl:b.socketPort?window.location.protocol+"//"+window.location.hostname+":"+b.socketPort:window.location.protocol+"//"+window.location.hostname,c(h),g}angular.module("forms").factory("Socket",a),a.$inject=["$timeout","$window"]}(),angular.module("forms").service("TimeCounter",[function(){vara,b=null;this.timeSpent=0,this.restartClock=function(){a=Date.now(),b=null},this.getTimeElapsed=function(){if(a)returnMath.abs(Date.now().valueOf()-a.valueOf())/1e3},this.stopClock=function(){returna&&null===b?(b=Date.now(),this.timeSpent=Math.abs(b.valueOf()-a.valueOf())/1e3,this._startTime=this._endTime=null,this.timeSpent):newError("Clock has not been started")},this.clockStarted=function(){return!!this._startTime}}]),angular.module("users").config(["$translateProvider",function(a){a.translations("en",{ACCESS_DENIED_TEXT:"You need to be logged in to access this page",USERNAME_OR_EMAIL_LABEL:"Username or Email",USERNAME_LABEL:"Username",PASSWORD_LABEL:"Password",CURRENT_PASSWORD_LABEL:"Current Password",NEW_PASSWORD_LABEL:"New Password",VERIFY_PASSWORD_LABEL:"Verify Password",UPDATE_PASSWORD_LABEL:"Update Password",FIRST_NAME_LABEL:"First Name",LAST_NAME_LABEL:"Last Name",LANGUAGE_LABEL:"Language",EMAIL_LABEL:"Email",SIGNUP_ACCOUNT_LINK:"Don't have an account? Sign up here",SIGN_IN_ACCOUNT_LINK:"Already have an account? Sign in here",SIGNUP_HEADER_TEXT:"Sign up",SIGNIN_HEADER_TEXT:"Sign in",SIGNUP_ERROR_TEXT:"Couldn't complete registration due to errors",ENTER_ACCOUNT_EMAIL:"Enter your account email.",RESEND_VERIFICATION_EMAIL:"Resend Verification Email",SAVE_CHANGES:"Save Changes",CANCEL_BTN:"Cancel",EDIT_PROFILE:"Edit your profile",UPDATE_PROFILE_BTN:"Update Profile",PROFILE_SAVE_SUCCESS:"Profile saved successfully",PROFILE_SAVE_ERROR:"Could't Save Your Profile.",CONNECTED_SOCIAL_ACCOUNTS:"Connected social accounts",CONNECT_OTHER_SOCIAL_ACCOUNTS:"Connect other social accounts",FORGOT_PASSWORD_LINK:"Forgot your password?",REVERIFY_ACCOUNT_LINK:"Resend your verification email",SIGNIN_BTN:"Sign in",SIGNUP_BTN:"Sign up",SAVE_PASSWORD_BTN:"Save Password",SUCCESS_HEADER:"Signup Successful",SUCCESS_TEXT:"You’ve successfully registered an account at TellForm.",VERIFICATION_EMAIL_SENT:"Verification Email has been Sent",VERIFICATION_EMAIL_SENT_TO:"A verification email has been sent to",NOT_ACTIVATED_YET:"But your account is not activated yet",BEFORE_YOU_CONTINUE:"Before you continue, make sure to check your email for our verification. If you don’t receive it within 24h drop us a line at ",CHECK_YOUR_EMAIL:"Check your email and click on the activation link to activate your account. If you have any questions drop us a line at",CONTINUE:"Continue",PASSWORD_RESTORE_HEADER:"Restore your password",ENTER_YOUR_EMAIL:"Enter your account email.",SUBMIT_BTN:"Submit",ASK_FOR_NEW_PASSWORD:"Ask for new password reset",PASSWORD_RESET_INVALID:"Password reset is invalid",PASSWORD_RESET_SUCCESS:"Passport successfully reset",PASSWORD_CHANGE_SUCCESS:"Passport successfully changed",RESET_PASSWORD:"Reset your password",CHANGE_PASSWORD:"Change your password",CONTINUE_TO_LOGIN:"Continue to login page",VERIFY_SUCCESS:"Account successfully activated",VERIFY_ERROR:"Verification link is invalid or has expired"}),a.preferredLanguage("en").fallbackLanguage("en").useSanitizeValueStrategy("escape")}]),angular.module("users").config(["$translateProvider",function(a){a.translations("fr",{ACCESS_DENIED_TEXT:"Vouz n’êtes pas autorisé à accéder à cette page.",USERNAME