var $url="/install",$routeUnCheckedList="unCheckedList",$sqlite="SQLite",data=utils.init({forbidden:!1,version:null,frameworkDescription:null,osDescription:null,contentRootPath:null,webRootPath:null,rootWritable:null,siteFilesWritable:null,databaseTypes:null,adminUrl:null,containerized:!1,databaseType:null,databaseConnectionString:null,redisConnectionString:null,databaseNames:null,pageIndex:0,agreement:!1,passwordLevel:null,errorMessage:null,databaseForm:{databaseType:"MySql",databaseHost:null,isDatabaseDefaultPort:!0,databasePort:null,databaseUserName:null,databasePassword:null,databaseName:null},redisForm:{isRedis:!1,redisHost:"localhost",isRedisDefaultPort:!0,redisPort:6379,isSsl:!1,redisPassword:null},adminForm:{userName:null,adminPassword:null,email:null,mobile:null,confirmPassword:null,isProtectData:!1}}),methods={apiGet:function(){var t=this;this.errorMessage=null,utils.loading(this,!0),$api.get($url).then(function(e){var a=e.data;t.forbidden=a.forbidden,t.version=a.version,t.frameworkDescription=a.frameworkDescription,t.osDescription=a.osDescription,t.contentRootPath=a.contentRootPath,t.webRootPath=a.webRootPath,t.rootWritable=a.rootWritable,t.siteFilesWritable=a.siteFilesWritable,t.databaseTypes=a.databaseTypes,t.adminUrl=a.adminUrl,t.containerized=a.containerized,t.databaseType=a.databaseType,t.databaseConnectionString=a.databaseConnectionString,t.redisConnectionString=a.redisConnectionString}).catch(function(e){t.errorMessage=utils.getErrorMessage(e)}).then(function(){utils.loading(t,!1)})},apiDatabaseConnect:function(){var t=this;this.errorMessage=null,utils.loading(this,!0),$api.post($url+"/actions/databaseConnect",this.databaseForm).then(function(e){var a=e.data;t.containerized?t.pageIndex++:t.databaseNames=a.databaseNames}).catch(function(e){t.errorMessage=utils.getErrorMessage(e)}).then(function(){utils.loading(t,!1)})},apiRedisConnect:function(){var t=this;this.errorMessage=null,utils.loading(this,!0),$api.post($url+"/actions/redisConnect",this.redisForm).then(function(e){e.data;t.pageIndex++}).catch(function(e){t.errorMessage=utils.getErrorMessage(e)}).then(function(){utils.loading(t,!1)})},apiPrepare:function(){var t=this;this.errorMessage=null,utils.loading(this,!0),$api.post($url+"/actions/prepare",_.assign({},this.databaseForm,this.redisForm,this.adminForm)).then(function(e){var a=e.data;setTimeout(function(){t.apiInstall(a.value)},2e3)}).catch(function(e){utils.loading(t,!1),t.errorMessage=utils.getErrorMessage(e)})},apiInstall:function(t){var e=this;this.errorMessage=null,utils.loading(this,!0),$api.post($url+"/actions/install",_.assign({securityKey:t},this.databaseForm,this.redisForm,this.adminForm)).then(function(t){t.data;e.pageIndex++}).catch(function(t){e.errorMessage=utils.getErrorMessage(t)}).then(function(){utils.loading(e,!1)})},getDocsUrl:function(){return cloud.getDocsUrl("")},validatePass:function(t,e,a){""===e?a(new Error("请再次输入密码")):e!==this.adminForm.adminPassword?a(new Error("两次输入密码不一致!")):a()},checkPasswordLevel:function(t){var e=0;0==t.length?e+=0:t.length<8&&t.length>0?e+=5:t.length>10?e+=25:e+=10;var a=!1,i=!1,n=t.match(/[A-Z]{1}/),s=t.match(/[a-z]{1}/);null==n&&null==s?(e+=0,a=!1):null!=n&&null!=s?(e+=20,i=!0):(e+=10,i=!0);for(var r=!1,o=0,l=0;l<t.length;l++)t.charAt(l)<="9"&&t.charAt(l)>="0"&&(r=!0,o+=1);0==o?(e+=0,r=!1):o>2?(e+=20,r=!0):(e+=10,r=!0);var d=!1,c=0;for(l=0;l<t.length;l++)t.charAt(l)>="0"&&t.charAt(l)<="9"||t.charAt(l)>="A"&&t.charAt(l)<="Z"||t.charAt(l)>="a"&&t.charAt(l)<="z"||(c+=1,d=!0);0==c?(e+=0,d=!1):c>1?(e+=25,d=!0):(e+=10,d=!0),i&&r&&d?e+=5:a&&r&&d?e+=3:a&&r&&(e+=2),this.passwordLevel=e/100*5},btnNextClick:function(){this.databaseNames=null,this.pageIndex++},btnPreviousClick:function(){this.pageIndex--},btnDatabaseConnectClick:function(){var t=this;if(this.containerized)return this.databaseType===$sqlite?void this.pageIndex++:void t.apiDatabaseConnect();this.databaseNames&&this.databaseForm.databaseName||this.databaseForm.databaseType===$sqlite?this.pageIndex++:this.$refs.databaseForm.validate(function(e){e&&t.apiDatabaseConnect()})},btnRedisConnectClick:function(){var t=this;if(this.containerized){if(!this.redisConnectionString)return void this.pageIndex++;t.apiRedisConnect()}else{if(!this.redisForm.isRedis)return void this.pageIndex++;this.$refs.redisForm.validate(function(e){e&&t.apiRedisConnect()})}},btnInstallClick:function(){var t=this;this.$refs.adminForm.validate(function(e){e&&t.apiPrepare()})},btnEnterClick:function(){location.href=utils.getIndexUrl()}},$vue=new Vue({el:"#main",data:data,methods:methods,created:function(){this.apiGet()}});