import{f as C,aa as w,l as I,ac as U,a5 as f,a1 as q,K as F,as as N,S as B,at as E,F as $,B as M,au as T,av as D,aw as R,ax as S,ay as P,x as G,k,az as j,aA as z,n as O,s as Q,aB as W,m as H,_ as K,r as l,o as h,c as g,a,b as i,w as V,W as Y,aq as J,ar as X,t as Z,p as ee,e as te,d as ae}from"./entry.cc52a3f2.js";const A=C({props:{listRef:{type:Object},entity:{type:Object,required:!0},modelValue:{type:String}},emits:["update:modelValue"],setup(e,{emit:t}){const d=w(e,"modelValue");w(e,"listRef");const u=I(()=>e.entity.name===U),s=I(()=>!(u.value&&!d.value)&&d.value!==e.entity.id);return()=>s.value?f("button",{class:{"btn btn-xs btn-primary":s.value,"btn btn-xs btn-danger":!s.value},onClick(b){b.preventDefault(),t("update:modelValue",e.entity.id)}},[f("i",{class:{"fa fa-check":s.value,"fa fa-times":!s.value}})]):f("button",{class:"btn btn-xs btn-disabled btn-success",disabled:!0},[f("i",{class:"fa-solid fa-check"})])}},"$BvqHu6TDsR"),ne=""+new URL("Login.bb43092d.svg",import.meta.url).href,oe=q({props:{width:{type:[Number,String],default:750},height:{type:[Number,String],default:500}},setup(e){return()=>f("img",{src:ne,width:e.width,height:e.height,style:{maxWidth:"100%"}})}}),se=C({components:{LoginSVG:oe,IdentityProviderList:F,IdentityProviderIcon:N,RealmList:B,RealmSelectAction:A,FormSubmit:E,FormInput:$},setup(){const e=M(),t=T({name:"",password:"",realm_id:""}),d=D({name:{required:R,minLength:S(3),maxLength:P(255)},password:{required:R,minLength:S(3),maxLength:P(255)},realm_id:{}},t),u=G(),s=H(),b=k(!1),m=w(t,"realm_id"),c={filters:{realm_id:m.value||""}},p=k(null);j(m,async(o,r)=>{o!==r&&p.value&&(c.filters.realm_id=m.value,p.value.load())});const y=async()=>{try{await u.login({name:t.name,password:t.password,realmId:t.realm_id});const o=O(),{redirect:r,...n}=o.query;Q({path:r||"/",query:n})}catch(o){W(o)&&e&&e.warning({body:o.message},{pos:"top-center"})}};Promise.resolve().then(u.logout);const _=o=>useAPIClient().identityProvider.getAuthorizeUri(s.public.apiUrl,o);return{vuelidate:d,translator:z(),form:t,submit:y,busy:b,identityProviderQuery:c,identityProviderRef:p,buildIdentityProviderURL:_}}},"$V4hxAv6YfE");const L=e=>(ee("data-v-271d6527"),e=e(),te(),e),ie={class:"container"},re=L(()=>a("h4",null,[a("i",{class:"fa-solid fa-arrow-right-to-bracket pe-2"}),ae(" Login ")],-1)),le={class:"text-center"},de={class:"row"},ue={class:"col-8"},me=L(()=>a("hr",null,null,-1)),ce=L(()=>a("h6",null,"IdentityProvider",-1)),pe={class:"d-flex flex-row"},ve=["href"],fe={class:"d-flex flex-column"},be={class:"text-center mb-1"},ye={class:"col-4"};function _e(e,t,d,u,s,b){const m=l("LoginSVG"),c=l("FormInput"),p=l("FormSubmit"),y=l("IdentityProviderIcon"),_=l("IdentityProviderList"),o=A,r=l("RealmList");return h(),g("div",ie,[re,a("div",le,[i(m,{height:320})]),a("form",{onSubmit:t[4]||(t[4]=Y((...n)=>e.submit&&e.submit(...n),["prevent"]))},[a("div",de,[a("div",ue,[i(c,{modelValue:e.form.name,"onUpdate:modelValue":t[0]||(t[0]=n=>e.form.name=n),"validation-result":e.vuelidate.name,"validation-translator":e.translator,label:!0,"label-content":"Name"},null,8,["modelValue","validation-result","validation-translator"]),i(c,{modelValue:e.form.password,"onUpdate:modelValue":t[1]||(t[1]=n=>e.form.password=n),type:"password","validation-result":e.vuelidate.password,"validation-translator":e.translator,label:!0,"label-content":"Password"},null,8,["modelValue","validation-result","validation-translator"]),i(p,{modelValue:e.busy,"onUpdate:modelValue":t[2]||(t[2]=n=>e.busy=n),"validation-result":e.vuelidate,"create-text":"Login","create-button-class":{value:"btn btn-sm btn-dark btn-block",presets:{bootstrap:!1}},"create-icon-class":"fa-solid fa-right-to-bracket",submit:e.submit},null,8,["modelValue","validation-result","submit"]),me,i(_,{ref:"identityProviderRef",query:e.identityProviderQuery,"footer-pagination":!1},{header:V(()=>[ce]),body:V(n=>[a("div",pe,[(h(!0),g(J,null,X(n.data,(v,x)=>(h(),g("div",{key:x},[a("a",{href:e.buildIdentityProviderURL(v.id),class:"btn btn-dark btn-xs p-2 me-1 identity-provider-box bg-dark"},[a("div",fe,[a("div",be,[i(y,{class:"fa-2x",entity:v},null,8,["entity"])]),a("div",null,Z(v.name),1)])],8,ve)]))),128))])]),_:1},8,["query"])]),a("div",ye,[i(r,null,{itemActions:V(n=>[i(o,{modelValue:e.form.realm_id,"onUpdate:modelValue":t[3]||(t[3]=v=>e.form.realm_id=v),"list-ref":e.identityProviderRef,entity:n.data},null,8,["modelValue","list-ref","entity"])]),_:1})])])],32)])}const ge=K(se,[["render",_e],["__scopeId","data-v-271d6527"]]);export{ge as default};
