import{a as B}from"./chunk-WSDF7BFP.js";import{n as k,t as $}from"./chunk-QHDPBN4J.js";import"./chunk-D2RHA7X2.js";import{d as P}from"./chunk-LV5TYHZ7.js";import{b as V}from"./chunk-EYGXMMT2.js";import{k as y,l as T,n as I,q as O}from"./chunk-NJYCNYHB.js";import{Db as b,Gb as m,Ib as w,La as i,Vb as c,Wa as h,Wb as S,Xb as d,ja as p,lb as f,mb as v,mc as a,nc as s,oa as u,pa as _,rb as g,sb as o,tb as r,ub as C}from"./chunk-ZHRPBG7M.js";function H(e,x){if(e&1){let t=b();o(0,"p",5)(1,"button",6),m("click",function(){u(t);let n=w();return _(n.restartServer())}),c(2),a(3,"translate"),r()()}e&2&&(i(2),d(" ",s(3,1,"menu.linux.label_restart_server")," "))}function D(e,x){if(e&1){let t=b();o(0,"p",5)(1,"button",6),m("click",function(){u(t);let n=w();return _(n.shutdownServer())}),c(2),a(3,"translate"),r()()}e&2&&(i(2),d(" ",s(3,1,"menu.linux.label_shutdown_server")," "))}function R(e,x){if(e&1){let t=b();o(0,"p",5)(1,"button",6),m("click",function(){u(t);let n=w();return _(n.dockerRestartContainer())}),c(2),a(3,"translate"),r()()}e&2&&(i(2),d(" ",s(3,1,"menu.docker.restart_container")," "))}var K=(()=>{class e{$api=p(O);$modal=p(k);$router=p(P);$settings=p(V);$toastr=p(I);$translate=p(y);canShutdownRestartHost=this.$settings.env.canShutdownRestartHost;runningInDocker=this.$settings.env.runningInDocker;restartHomebridge(){this.$router.navigate(["/restart"])}restartHomebridgeService(){this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>{this.$router.navigate(["/restart"])},error:t=>{console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}restartServer(){this.$router.navigate(["/platform-tools/linux/restart-server"])}shutdownServer(){let t=this.$modal.open(B,{size:"lg",backdrop:"static"});t.componentInstance.title=this.$translate.instant("menu.linux.label_shutdown_server"),t.componentInstance.message=this.$translate.instant("menu.linux.label_shutdown_modal"),t.componentInstance.confirmButtonLabel=this.$translate.instant("form.button_continue"),t.componentInstance.faIconClass="fa fa-power-off primary-text",t.result.then(()=>{this.$router.navigate(["/platform-tools/linux/shutdown-server"])}).catch(()=>{})}dockerRestartContainer(){this.$router.navigate(["/platform-tools/docker/restart-container"])}static \u0275fac=function(l){return new(l||e)};static \u0275cmp=h({type:e,selectors:[["ng-component"]],decls:19,vars:16,consts:[[1,"d-flex","justify-content-between"],[1,"primary-text","m-0"],[1,"my-4","align-items-center",2,"max-width","1000px","margin","auto"],[1,"w-100","text-center","primary-text","mb-5"],[1,"fas","fa-power-off",2,"font-size","75px"],[1,"w-100","text-center","my-5"],["type","button",1,"btn","btn-primary","p-3","my-0",2,"width","85%",3,"click"],["type","button","container","body","triggers","hover",1,"btn","btn-primary","p-3","my-0",2,"width","85%",3,"click","openDelay","ngbTooltip"]],template:function(l,n){l&1&&(o(0,"div",0)(1,"h3",1),c(2),a(3,"translate"),r()(),o(4,"div",2)(5,"div",3),C(6,"i",4),r(),o(7,"p",5)(8,"button",6),m("click",function(){return n.restartHomebridge()}),c(9),a(10,"translate"),r()(),o(11,"p",5)(12,"button",7),a(13,"translate"),m("click",function(){return n.restartHomebridgeService()}),c(14),a(15,"translate"),r()(),f(16,H,4,3,"p",5),f(17,D,4,3,"p",5),f(18,R,4,3,"p",5),r()),l&2&&(i(2),S(s(3,8,"menu.restart.title")),i(7),d(" ",s(10,10,"menu.hbrestart.confirm_hb")," "),i(3),g("openDelay",150)("ngbTooltip",s(13,12,"reset.force_restart_hb_help_text")),i(2),d(" ",s(15,14,"menu.hbrestart.confirm_ui")," "),i(2),v(n.canShutdownRestartHost?16:-1),i(),v(n.canShutdownRestartHost?17:-1),i(),v(n.runningInDocker?18:-1))},dependencies:[$,T],encapsulation:2})}return e})();export{K as PowerOptionsComponent};
