import{_ as k,i as j,r as p,q as _,s as C,m as T,d as q,w as c,f as r,e as B,g as e,H as f,P as F,j as D,t as S,J as $,K as v,A,L as G}from"./index-BV0H45HW.js";import"./index-BtHEBb5f.js";import{B as H}from"./index-CBHeC2k-.js";import{_ as J}from"./m-field-password-h91Wshz0.js";import{C as K}from"./index-BRaRnE7I.js";import{P as L}from"./index-C4X6YiFO.js";import"./index-B7M1Z4gS.js";import{F as z}from"./index-CvTKOhUw.js";import{r as E}from"./regexp-BgFXjrDy.js";import{F as M}from"./index-DV1z_BeD.js";import"./use-id-B-gQUfBT.js";const O={class:"button-container"},Q={__name:"index",setup(W){const a=j.global.t;let l=p(!1),d=p(!1),i=_({hasRunningProject:!1});const t=_({cameraIp:"",cameraPassword:"",cameraUser:"",robotName:"",robotType:""}),w=[{text:"saturn_is",value:"saturn_is"},{text:"saturn_gs",value:"saturn_gs"},{text:"x30",value:"x30"},{text:"d1",value:"d1"},{text:"x20_new",value:"x20_new"},{text:"x20_old",value:"x20_old"},{text:"sim_robot",value:"sim_robot"},{text:"shanmao",value:"shanmao"}];let m;const g=p([]),x=({selectedValues:s,selectedOptions:o})=>{t.robotType=o[0].value,g.value=s,l.value=!1};async function y(){d.value=!0,await G(t),d.value=!1,m=v({type:"success",message:a("config.updateSuccess"),className:"bottom-notify",position:"bottom"})}async function P(){const{data:s}=await $();s?(i.hasRunningProject=!0,m=v({type:"primary",message:a("config.projectRunningNotify"),duration:0,className:"bottom-notify",position:"bottom"})):i.hasRunningProject=!1}P();async function V(){const{data:s}=await A();t.robotName=s.robotName,t.cameraIp=s.cameraIp,t.cameraUser=s.cameraUser,t.cameraPassword=s.cameraPassword,t.robotType=s.robotType}return V(),C(()=>{m==null||m.close()}),(s,o)=>{const u=z,N=L,R=F,b=K,U=J,h=H,I=M;return q(),T(I,{readonly:e(i).hasRunningProject,disabled:e(i).hasRunningProject},{default:c(()=>[r(b,{title:e(a)("config.basicInfo"),inset:""},{default:c(()=>[r(u,{modelValue:t.robotName,"onUpdate:modelValue":o[0]||(o[0]=n=>t.robotName=n),name:"robotName",label:e(a)("config.deviceName"),placeholder:e(a)("config.deviceName"),rules:[{required:!0,message:e(a)("config.deviceNameRequired")}]},null,8,["modelValue","label","placeholder","rules"]),r(u,{modelValue:t.robotType,"onUpdate:modelValue":o[1]||(o[1]=n=>t.robotType=n),"is-link":!e(i).hasRunningProject,readonly:"",name:"picker",label:e(a)("config.deviceType"),placeholder:e(a)("config.selectDeviceType"),onClick:o[2]||(o[2]=n=>e(i).hasRunningProject?null:f(l)?l.value=!0:l=!0)},null,8,["modelValue","is-link","label","placeholder"]),r(R,{show:e(l),"onUpdate:show":o[4]||(o[4]=n=>f(l)?l.value=n:l=n),"destroy-on-close":"",position:"bottom"},{default:c(()=>[r(N,{title:e(a)("config.selectDeviceTypeTitle"),columns:w,"model-value":g.value,"show-toolbar":"","confirm-button-text":e(a)("toolsCenter.confirm"),"cancel-button-text":e(a)("toolsCenter.cancel"),onConfirm:x,onCancel:o[3]||(o[3]=n=>f(l)?l.value=!1:l=!1)},null,8,["title","model-value","confirm-button-text","cancel-button-text"])]),_:1},8,["show"])]),_:1},8,["title"]),r(b,{title:e(a)("config.cameraConfig"),inset:""},{default:c(()=>[r(u,{modelValue:t.cameraIp,"onUpdate:modelValue":o[5]||(o[5]=n=>t.cameraIp=n),name:"cameraIp",label:e(a)("config.cameraIp"),placeholder:e(a)("config.cameraIp"),rules:[{required:!0,message:e(a)("config.cameraIpRequired")},{pattern:e(E).ip,message:e(a)("config.invalidIpFormat")}]},null,8,["modelValue","label","placeholder","rules"]),r(u,{modelValue:t.cameraUser,"onUpdate:modelValue":o[6]||(o[6]=n=>t.cameraUser=n),name:"cameraUser",label:e(a)("config.cameraUsername"),placeholder:e(a)("config.cameraUsername"),rules:[{required:!0,message:e(a)("config.cameraUsernameRequired")}],autocomplete:"new-password"},null,8,["modelValue","label","placeholder","rules"]),r(U,{modelValue:t.cameraPassword,"onUpdate:modelValue":o[7]||(o[7]=n=>t.cameraPassword=n),name:"cameraPassword",label:e(a)("config.cameraPassword"),placeholder:e(a)("config.cameraPassword"),rules:[{required:!0,message:e(a)("config.cameraPasswordRequired")}],autocomplete:"new-password"},null,8,["modelValue","label","placeholder","rules"])]),_:1},8,["title"]),B("div",O,[r(h,{round:"",block:"",type:"primary","native-type":"submit",class:"confirm-button",onClick:y,disabled:e(i).hasRunningProject,loading:e(d),"loading-text":e(a)("config.submitting")},{default:c(()=>[D(S(e(a)("config.submit")),1)]),_:1},8,["disabled","loading","loading-text"])])]),_:1},8,["readonly","disabled"])}}},ie=k(Q,[["__scopeId","data-v-75f14b6c"]]);export{ie as default};
