import{h as t,b as s,m as f,p as v,r as l,q as c,S as b,s as C,v as U}from"./entry.83e061d6.js";import{d as g}from"./component.13bf56b8.js";import"./composables.633e7485.js";const S=g({props:{entity:{type:Object,required:!0}},emits:["updated","failed"],setup(i,{emit:R}){if(!i.entity)return()=>t("div",[]);const n=s([]),o=s(""),u=f(),d=v(()=>{const e=new URL("authorize",u.publicUrl);return e.searchParams.set("client_id",i.entity.id),n.value.length>0&&e.searchParams.set("scope",encodeURIComponent(n.value.join(" "))),o.value&&e.searchParams.set("redirect_uri",encodeURIComponent(o.value)),e.href});l("ScopeList");const p=e=>{const a=n.value.indexOf(e);a===-1?n.value.push(e):n.value.splice(a,1)},m=()=>{const e=c({labelContent:"Redirect URL",props:{placeholder:"..."},value:o}),a=c({labelContent:"Generated URL",props:{disabled:!0},value:d}),h=l("ClientScopeList");return t("div",[t("h6","URL Generator"),t("div",{class:"mb-1"},["Generate an authorize url by picking the scopes it needs to function."]),t("hr"),t(h,{withHeader:!1,withSearch:!1,query:{filter:{client_id:i.entity.id},relations:["scope"]}},{[b.ITEM]:r=>C({validationTranslator:U(r.translatorLocale),value:n.value.indexOf(r.data.scope.name)!==-1,onChange(y){p(r.data.scope.name)},label:!0,labelContent:r.data.scope.name})}),t("hr"),e,t("hr"),a])};return()=>m()}});export{S as default};
