import{f as C,V,x as U,y as v,r as h,z as b,B as g,_ as y,l as c,o as k,c as I,b as l,w as a,a as u,d as m,t as F}from"./qGWCsquX.js";const R=C({components:{VCFormInput:V,VCFormInputCheckbox:U,AClientScopes:v},props:{entity:{type:Object,required:!0}},emits:["updated","failed"],setup(e,{emit:s}){const n=h([]),d=h(""),f=g(),_=b(()=>{const t=new URL("authorize",f.public.publicUrl);return t.searchParams.set("client_id",e.entity.id),n.value.length>0&&t.searchParams.set("scope",encodeURIComponent(n.value.join(" "))),d.value&&t.searchParams.set("redirect_uri",encodeURIComponent(d.value)),t.href}),p=t=>{const i=n.value.indexOf(t);i===-1?n.value.push(t):n.value.splice(i,1)},r={filter:{client_id:e.entity.id},relations:["scope"]};return{toggleScope:p,query:r,redirectUri:d,generatedUrl:_,scopes:n}}},"$p4xkk2I3Jk"),x=u("h6",null,"URL Generator",-1),S=u("div",{class:"mb-1"}," Generate an authorize url by picking the scopes it needs to function. ",-1),$=u("hr",null,null,-1),q=u("hr",null,null,-1),G=u("hr",null,null,-1);function L(e,s,n,d,f,_){const p=c("VCFormInputCheckbox"),r=c("VCFormGroup"),t=c("AClientScopes"),i=c("VCFormInput");return k(),I("div",null,[x,S,$,l(t,{header:!1,query:e.query,item:{class:""}},{item:a(o=>[l(r,{"validation-translator":o.translatorLocale},{label:a(()=>[m(F(o.data.scope.name),1)]),default:a(()=>[l(p,{"model-value":e.scopes.indexOf(o.data.scope.name)!==-1,"onUpdate:modelValue":B=>e.toggleScope(o.data.scope.name)},null,8,["model-value","onUpdate:modelValue"])]),_:2},1032,["validation-translator"])]),_:1},8,["query"]),q,l(r,null,{label:a(()=>[m(" Redirect URL ")]),default:a(()=>[l(i,{modelValue:e.redirectUri,"onUpdate:modelValue":s[0]||(s[0]=o=>e.redirectUri=o),placeholder:"..."},null,8,["modelValue"])]),_:1}),G,l(r,null,{label:a(()=>[m(" Generated URL ")]),default:a(()=>[l(i,{modelValue:e.generatedUrl,"onUpdate:modelValue":s[1]||(s[1]=o=>e.generatedUrl=o),disabled:!0},null,8,["modelValue"])]),_:1})])}const w=y(R,[["render",L]]);export{w as default};
