import{a as m,h as t,b as s,e as v,r as l,f as b,E as c,x as U,M as C,i as g}from"./entry.e097670d.js";const x=m({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=b(),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)},f=()=>{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"]}},{[U.ITEM]:r=>C({validationTranslator:g(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()=>f()}});export{x as default};
