import{u as e,bE as i,R as t,ak as s,P as a}from"./utils-lib.js?v=1761009159";import{s as o,j as n}from"./base-lib.js?v=1761009159";import{a8 as l,a9 as p,Q as g}from"./config.js?v=1761009159";const r=n("CONFIG-STORE1",{state:()=>({tabActive:"message",settingSearch:"",openPortPopup:!1,openSSLPopup:!1,isRefreshList:!1,panelConfig:{panelClose:!1,loginOrigin:!1,listenIpv6:!1,offlineMode:!1,debugMode:!1,apiInterface:!1,onlineService:!1,improvement:!1,webname:"",leftTitle:"",session_timeout:"1天",session_timeout_source:86400,sites_path:"",backup_path:"",serverIp:"",systemdate:"",username:"",account:"",menuHide:"无配置",requestType:"",checkTwoStep:!1,sslVerify:!1,requestLine:"",panelNode:"--",panelNodeId:0},safeConfig:{panelAlarm:!1,panelSSl:!1,basicAuth:!1,pawComplexity:!1,uaAstrict:!1,domain:"",limitip:"",port:8888,admin_path:"/",statusCode:0,pawExpireTime:""},limitArea:{}}),getters:{},actions:{async getGlobalConfig(){const{getGlobalInfo:i}=e(),t=await i();this.setConfig(t),this.setSafeConfig(t)},async getConfigData(){await this.getGlobalConfig()},async getMenuListEvent(){const{data:e}=await i();t(e)&&(this.panelConfig.menuHide=e.filter(e=>!e.show).map(e=>e.title).join("、"))},async getLimitUaInfo(){},setConfig(e){this.panelConfig.listenIpv6="checked"===e.ipv6,this.panelConfig.offlineMode="checked"===e.is_local,this.panelConfig.debugMode="checked"===e.debug,this.panelConfig.apiInterface="checked"===e.api,this.panelConfig.onlineService=e.show_workorder,this.panelConfig.improvement=e.improvement,this.panelConfig.loginOrigin=e.login_origin,this.panelConfig.webname=e.webname||"宝塔Linux面板",this.panelConfig.leftTitle=e.left_title||"",this.panelConfig.session_timeout=e.session_timeout||"1天",this.panelConfig.session_timeout_source=e.session_timeout_source||86400,this.panelConfig.sites_path=e.sites_path||"",this.panelConfig.backup_path=e.backup_path||"",this.panelConfig.systemdate=e.systemdate||"",this.panelConfig.username=e.username||"",this.panelConfig.requestType=e.request_type||"",this.panelConfig.requestLine=e.request_iptype||"";const{panel:i,user_info:t}=e;s(i)&&(this.panelConfig.serverIp=i.address||""),s(t)&&(this.panelConfig.account=t.data.username)},setSafeConfig(e){var i;const{panel:t,SSL:a}=e;this.safeConfig.panelSSl=a||location.protocol.indexOf("https:")>-1,this.safeConfig.basicAuth=(null==(i=e.basic_auth)?void 0:i.open)||!1,this.safeConfig.statusCode=e.status_code||404,s(t)&&(this.safeConfig.domain=t.domain||"",this.safeConfig.limitip=t.limitip||"",this.safeConfig.port=t.listen_port||"",this.safeConfig.admin_path=t.admin_path||"/")},async savaPanelTheme(i){const{globalTheme:t}=e();await a({loading:i,message:!0,request:l({data:JSON.stringify(t.value)})})},async getPanelTheme(){return await a({request:p(),success:e=>{e.status&&this.setPanelTheme(null==e?void 0:e.data.data)}})},setPanelTheme(i){const{globalTheme:t}=e();i&&"object"==typeof i&&(t.value={theme:i.theme||{dark:!1,color:"#20a53a",view:"default"},logo:i.logo||{image:"",favicon:""},sidebar:i.sidebar||{dark:!1,color:"#3c444d",opacity:1},interface:i.interface||{rounded:"small",is_show_bg:!1,bg_image:"",bg_image_opacity:1,content_opacity:1,shadow_color:"#000",shadow_opacity:.2},home:i.home||{overview_view:"default",overview_size:14},login:i.login||{logo:"",is_show_logo:!1,bg_image:"",is_show_bg:!1,bg_image_opacity:1},...i})},async saveConfig(e,i){const t=i&&i.session_timeout?i.session_timeout:this.panelConfig.session_timeout_source,s=await a({loading:e,message:!0,request:g({webname:this.panelConfig.webname||"宝塔Linux面板",session_timeout:t||86400,domain:this.safeConfig.domain,limitip:this.safeConfig.limitip,sites_path:this.panelConfig.sites_path,backup_path:this.panelConfig.backup_path,address:this.panelConfig.serverIp,systemdate:this.panelConfig.systemdate})});if(!(!i||void 0===i.isReturn)&&i.isReturn)return s;setTimeout(()=>{window.location.reload()},1e3)}},persist:[{storage:localStorage,paths:["tabActive"]}]}),f=()=>{const e=r();return{refs:o(e),...e}};export{f as g};
