import{f as A,ah as I,l as S,aj as N,aa as v,a3 as T,L as E,B,D as M,M as $,az as D,X as j,aA as G,F as z,aB as H,n as O,aC as Q,aD as J,aE as P,aF as R,aG as k,y as W,k as C,aH as X,aI as Y,q as Z,v as K,aJ as tt,m as et,_ as at,r,o as V,c as w,a as o,b as n,w as b,Z as ot,ax as nt,ay as st,t as it,p as lt,e as rt,d as dt}from"./entry.27446522.js";const F=A({props:{listRef:{type:Object},entity:{type:Object,required:!0},modelValue:{type:String}},emits:["update:modelValue"],setup(t,{emit:a}){const s=I(t,"modelValue");I(t,"listRef");const f=S(()=>t.entity.name===N),l=S(()=>!(f.value&&!s.value)&&s.value!==t.entity.id);return()=>l.value?v("button",{class:{"btn btn-xs btn-primary":l.value,"btn btn-xs btn-danger":!l.value},onClick(y){y.preventDefault(),a("update:modelValue",t.entity.id)}},[v("i",{class:{"fa fa-check":l.value,"fa fa-times":!l.value}})]):v("button",{class:"btn btn-xs btn-disabled btn-success",disabled:!0},[v("i",{class:"fa-solid fa-check"})])}},"$BvqHu6TDsR"),ut=""+new URL("Login.bb43092d.svg",import.meta.url).href,mt=T({props:{width:{type:[Number,String],default:750},height:{type:[Number,String],default:500}},setup(t){return()=>v("img",{src:ut,width:t.width,height:t.height,style:{maxWidth:"100%"}})}}),ct=A({components:{ListPagination:E,ListSearch:B,ListTitle:M,LoginSVG:mt,IdentityProviderList:$,IdentityProviderIcon:D,RealmList:j,RealmSelectAction:F,FormSubmit:G,FormInput:z},setup(){const t=H(),a=O(),s=Q({name:"",password:"",realm_id:""}),f=J({name:{required:P,minLength:R(3),maxLength:k(255)},password:{required:P,minLength:R(3),maxLength:k(255)},realm_id:{}},s),l=W(),y=et(),_=C(!1),d=I(s,"realm_id"),p={filters:{realm_id:d.value||""}},u=C(null);X(d,async(i,m)=>{i!==m&&u.value&&(p.filters.realm_id=d.value,u.value.load())});const h=async()=>{try{await l.login({name:s.name,password:s.password,realmId:s.realm_id});const i=Z(),{redirect:m,...L}=i.query;K({path:m||"/",query:L})}catch(i){tt(i)&&a&&a.warning({body:i.message},{pos:"top-center"})}};Promise.resolve().then(l.logout);const g=i=>t.identityProvider.getAuthorizeUri(y.public.apiUrl,i);return{vuelidate:f,translator:Y(),form:s,submit:h,busy:_,identityProviderQuery:p,identityProviderRef:u,buildIdentityProviderURL:g}}},"$V4hxAv6YfE");const U=t=>(lt("data-v-c48214c9"),t=t(),rt(),t),bt={class:"container"},vt=U(()=>o("h4",null,[o("i",{class:"fa-solid fa-arrow-right-to-bracket pe-2"}),dt(" Login ")],-1)),ft={class:"text-center"},yt={class:"row"},pt={class:"col-8"},_t=U(()=>o("hr",null,null,-1)),ht={class:"d-flex flex-row"},gt=["href"],Lt={class:"d-flex flex-column"},Vt={class:"text-center mb-1"},wt={class:"col-4"};function It(t,a,s,f,l,y){const _=r("LoginSVG"),d=r("FormInput"),p=r("FormSubmit"),u=r("ListPagination"),h=r("IdentityProviderIcon"),g=r("IdentityProviderList"),i=r("ListTitle"),m=r("ListSearch"),L=F,q=r("RealmList");return V(),w("div",bt,[vt,o("div",ft,[n(_,{height:320})]),o("form",{onSubmit:a[4]||(a[4]=ot((...e)=>t.submit&&t.submit(...e),["prevent"]))},[o("div",yt,[o("div",pt,[n(d,{modelValue:t.form.name,"onUpdate:modelValue":a[0]||(a[0]=e=>t.form.name=e),"validation-result":t.vuelidate.name,"validation-translator":t.translator,label:!0,"label-content":"Name"},null,8,["modelValue","validation-result","validation-translator"]),n(d,{modelValue:t.form.password,"onUpdate:modelValue":a[1]||(a[1]=e=>t.form.password=e),type:"password","validation-result":t.vuelidate.password,"validation-translator":t.translator,label:!0,"label-content":"Password"},null,8,["modelValue","validation-result","validation-translator"]),n(p,{modelValue:t.busy,"onUpdate:modelValue":a[2]||(a[2]=e=>t.busy=e),"validation-result":t.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:t.submit},null,8,["modelValue","validation-result","submit"]),_t,n(g,{ref:"identityProviderRef",query:t.identityProviderQuery,footer:!1},{footer:b(e=>[n(u,{busy:e.busy,meta:e.meta,load:e.load,total:e.total},null,8,["busy","meta","load","total"])]),body:b(e=>[o("div",ht,[(V(!0),w(nt,null,st(e.data,(c,x)=>(V(),w("div",{key:x},[o("a",{href:t.buildIdentityProviderURL(c.id),class:"btn btn-dark btn-xs p-2 me-1 identity-provider-box bg-dark"},[o("div",Lt,[o("div",Vt,[n(h,{class:"fa-2x",entity:c},null,8,["entity"])]),o("div",null,it(c.name),1)])],8,gt)]))),128))])]),_:1},8,["query"])]),o("div",wt,[n(q,null,{header:b(e=>[n(i),n(m,{load:e.load,busy:e.busy},null,8,["load","busy"])]),footer:b(e=>[n(u,{busy:e.busy,meta:e.meta,load:e.load,total:e.total},null,8,["busy","meta","load","total"])]),itemActions:b(e=>[n(L,{modelValue:t.form.realm_id,"onUpdate:modelValue":a[3]||(a[3]=c=>t.form.realm_id=c),"list-ref":t.identityProviderRef,entity:e.data},null,8,["modelValue","list-ref","entity"])]),_:1})])])],32)])}const Pt=at(ct,[["render",It],["__scopeId","data-v-c48214c9"]]);export{Pt as default};
