import{r as o,o as d,g as _,a as e,u,F as z,D as S,c as D,w as h,f,t as L,i as v,b as m,L as F,h as V,d as I,e as J,bb as C}from"./app-BYcXwl4U.js";import{u as O}from"./app-a6cKceqE.js";import{_ as T}from"./app-Ufpj4Ll4.js";import{T as B}from"./app-CrjU8lgK.js";import{T as E}from"./app-D2Wz0BUQ.js";const H=["value"],M={key:0,class:"label-group"},P=["onClick"],j=e("i",{class:"icon pencil tiny"},null,-1),q=[j],G=["onClick"],K=e("i",{class:"icon remove small"},null,-1),Q=[K],W={class:"ui fields inline"},X={class:"ui field"},Y={class:"ui field"},Z={class:"ui field"},ee=e("i",{class:"icon remove small"},null,-1),se=[ee],te={key:1,style:{"margin-top":"1em"}},ie={__name:"HTTPAuthBasicAuthUserBox",props:["v-users"],setup(b){const w=O(),x=b,p=o(),y=o(),{users:a,isAdding:r,updatingIndex:c,username:s,password:t}=function(){let n=x.vUsers;return n==null&&(n=[]),{users:o(n),isAdding:o(!1),updatingIndex:o(-1),username:o(""),password:o("")}}(),A=function(){r.value=!0,s.value="",t.value="",setTimeout(function(){p.value.focus()},100)},k=function(){r.value=!1,c.value=-1},N=function(){if(s.value.length==0){w.warn("请输入用户名",function(){p.value.focus()});return}if(t.value.length==0){w.warn("请输入密码",function(){y.value.focus()});return}c.value<0?a.value.push({username:s.value,password:t.value}):(a.value[c.value].username=s.value,a.value[c.value].password=t.value),k()},U=function(n,l){c.value=n,r.value=!0,s.value=l.username,t.value=l.password,setTimeout(function(){p.value.focus()},100)},R=function(n){a.value.$remove(n)};return(n,l)=>(d(),_("div",null,[e("input",{type:"hidden",name:"httpAuthBasicAuthUsersJSON",value:JSON.stringify(u(a))},null,8,H),u(a).length>0?(d(),_("div",M,[(d(!0),_(z,null,S(u(a),(i,g)=>(d(),D(E,{outlined:""},{default:h(()=>[f(L(i.username)+"  ",1),e("a",{href:"",title:"修改",onClick:v($=>U(g,i),["prevent"])},q,8,P),f("  "),e("a",{href:"",title:"删除",onClick:v($=>R(g),["prevent"])},Q,8,G)]),_:2},1024))),256)),m(F)])):V("",!0),I(e("div",null,[e("div",W,[e("div",X,[m(T,{type:"text",placeholder:"用户名",modelValue:u(s),"onUpdate:modelValue":l[0]||(l[0]=i=>C(s)?s.value=i:null),size:"15",ref_key:"usernameRef",ref:p},null,8,["modelValue"])]),e("div",Y,[m(T,{type:"password",placeholder:"密码",modelValue:u(t),"onUpdate:modelValue":l[1]||(l[1]=i=>C(t)?t.value=i:null),size:"15",ref_key:"passwordRef",ref:y},null,8,["modelValue"])]),e("div",Z,[m(B,{secondary:"",size:"small",type:"button",onClick:v(N,["prevent"])},{default:h(()=>[f("确定")]),_:1}),f("  "),e("a",{href:"",title:"取消",onClick:v(k,["prevent"])},se)])])],512),[[J,u(r)]]),u(r)?V("",!0):(d(),_("div",te,[m(B,{secondary:"",size:"small",type:"button",onClick:v(A,["prevent"])},{default:h(()=>[f("+")]),_:1})]))]))}};export{ie as _};
