import{f as k,af as U,z as I,aj as $,a7 as b,a0 as x,q as B,C as D,D as G,L as j,aA as M,U as z,aB as H,aC as O,aD as Q,aE as C,aF as L,aG as S,j as W,r as R,aH as J,aI as K,aJ as Y,g as Z,n as X,aK as ee,B as te,_ as ae,l,o as A,c as w,a as n,b as o,w as d,W as oe,d as P,ay as ne,az as se,t as ie,p as le,e as re}from"./qGWCsquX.js";import{u as de}from"./DjfSO2bY.js";const T=k({props:{listRef:{type:Object},entity:{type:Object,required:!0},modelValue:{type:String}},emits:["update:modelValue"],setup(e,{emit:a}){const s=U(e,"modelValue"),p=I(()=>e.entity.name===$),r=I(()=>!(p.value&&!s.value)&&s.value!==e.entity.id);return()=>r.value?b("button",{class:{"btn btn-xs btn-primary":r.value,"btn btn-xs btn-danger":!r.value},onClick(y){y.preventDefault(),a("update:modelValue",e.entity.id)}},[b("i",{class:{"fa fa-check":r.value,"fa fa-times":!r.value}})]):b("button",{class:"btn btn-xs btn-disabled btn-success",disabled:!0},[b("i",{class:"fa-solid fa-check"})])}},"$BvqHu6TDsR"),ue=""+new URL("Login.CUC6uZaT.svg",import.meta.url).href,me=x({props:{width:{type:[Number,String],default:750},height:{type:[Number,String],default:500}},setup(e){return()=>b("img",{src:ue,width:e.width,height:e.height,style:{maxWidth:"100%"}})}}),ce=k({components:{APagination:B,ASearch:D,ATitle:G,LoginSVG:me,AIdentityProviders:j,AIdentityProviderIcon:M,ARealms:z,RealmSelectAction:T},setup(){const e=H(),a=de(),s=O({name:"",password:"",realm_id:""}),p=Q({name:{required:C,minLength:L(3),maxLength:S(255)},password:{required:C,minLength:L(3),maxLength:S(255)},realm_id:{}},s),r=W(),y=te(),_=R(!1),u=U(s,"realm_id"),m={filters:{realm_id:u.value||"",protocol:`!${J.LDAP}`,enabled:!0}},c=R(null);K(u,async(i,f)=>{i!==f&&c.value&&(m.filters.realm_id=u.value,c.value.load())});const h=async()=>{try{await r.login({name:s.name,password:s.password,realmId:s.realm_id});const i=Z(),{redirect:f,...V}=i.query;X({path:f||"/",query:V})}catch(i){ee(i)&&a&&a.show({variant:"warning",body:i.message})}};Promise.resolve().then(r.logout);const g=i=>e.identityProvider.getAuthorizeUri(y.public.apiUrl,i);return{vuelidate:p,translator:Y(),form:s,submit:h,busy:_,identityProviderQuery:m,identityProviderRef:c,buildIdentityProviderURL:g}}},"$V4hxAv6YfE"),q=e=>(le("data-v-e4c11d78"),e=e(),re(),e),fe={class:"container"},ve=q(()=>n("h4",null,[n("i",{class:"fa-solid fa-arrow-right-to-bracket pe-2"}),P(" Login ")],-1)),be={class:"text-center"},pe={class:"row"},ye={class:"col-8"},he=q(()=>n("hr",null,null,-1)),_e={class:"d-flex flex-row"},ge=["href"],Ve={class:"d-flex flex-column"},Ae={class:"text-center mb-1"},we={class:"col-4"};function Pe(e,a,s,p,r,y){const _=l("LoginSVG"),u=l("VCFormInput"),m=l("VCFormGroup"),c=l("VCFormSubmit"),h=l("APagination"),g=l("AIdentityProviderIcon"),i=l("AIdentityProviders"),f=l("ATitle"),V=l("ASearch"),F=T,N=l("ARealms");return A(),w("div",fe,[ve,n("div",be,[o(_,{height:320})]),n("form",{onSubmit:a[4]||(a[4]=oe((...t)=>e.submit&&e.submit(...t),["prevent"]))},[n("div",pe,[n("div",ye,[o(m,{"validation-result":e.vuelidate.name,"validation-translator":e.translator},{label:d(()=>[P(" Name ")]),default:d(()=>[o(u,{modelValue:e.form.name,"onUpdate:modelValue":a[0]||(a[0]=t=>e.form.name=t)},null,8,["modelValue"])]),_:1},8,["validation-result","validation-translator"]),o(m,{"validation-result":e.vuelidate.password,"validation-translator":e.translator},{label:d(()=>[P(" Password ")]),default:d(()=>[o(u,{modelValue:e.form.password,"onUpdate:modelValue":a[1]||(a[1]=t=>e.form.password=t),type:"password"},null,8,["modelValue"])]),_:1},8,["validation-result","validation-translator"]),o(c,{modelValue:e.busy,"onUpdate:modelValue":a[2]||(a[2]=t=>e.busy=t),"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"]),he,o(i,{ref:"identityProviderRef",query:e.identityProviderQuery,footer:!1},{footer:d(t=>[o(h,{busy:t.busy,meta:t.meta,load:t.load,total:t.total},null,8,["busy","meta","load","total"])]),body:d(t=>[n("div",_e,[(A(!0),w(ne,null,se(t.data,(v,E)=>(A(),w("div",{key:E},[n("a",{href:e.buildIdentityProviderURL(v.id),class:"btn btn-dark btn-xs p-2 me-1 identity-provider-box bg-dark"},[n("div",Ve,[n("div",Ae,[o(g,{class:"fa-2x",entity:v},null,8,["entity"])]),n("div",null,ie(v.name),1)])],8,ge)]))),128))])]),_:1},8,["query"])]),n("div",we,[o(N,null,{header:d(t=>[o(f),o(V,{load:t.load,busy:t.busy},null,8,["load","busy"])]),footer:d(t=>[o(h,{busy:t.busy,meta:t.meta,load:t.load,total:t.total},null,8,["busy","meta","load","total"])]),itemActions:d(t=>[o(F,{modelValue:e.form.realm_id,"onUpdate:modelValue":a[3]||(a[3]=v=>e.form.realm_id=v),"list-ref":e.identityProviderRef,entity:t.data},null,8,["modelValue","list-ref","entity"])]),_:1})])])],32)])}const Le=ae(ce,[["render",Pe],["__scopeId","data-v-e4c11d78"]]);export{Le as default};
