import{r as e}from"./lib-MoKmYgcO.js";var t=e({system:{id:`skills.scope.system`,defaultMessage:`System`,description:`Indicates a system scoped skill`},repo:{id:`skills.scope.repo`,defaultMessage:`Repo`,description:`Indicates a skill scoped to the current repository`},user:{id:`skills.scope.user`,defaultMessage:`User`,description:`Indicates a skill scoped to the user`},admin:{id:`skills.scope.admin`,defaultMessage:`Admin`,description:`Indicates a skill scoped to the admin`}});function n(e,n){return n.formatMessage(t[e])}function r(e){let t=e.replace(/[\\/]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n===-1?t:t.slice(n+1)}var i=e({system:{id:`skills.scope.builtIn`,defaultMessage:`System`,description:`Label for system skills`},repo:{id:`skills.scope.team`,defaultMessage:`Team`,description:`Label for team skills`},user:{id:`skills.scope.personal`,defaultMessage:`Personal`,description:`Label for personal skills`},admin:{id:`skills.scope.adminInstalled`,defaultMessage:`Admin installed`,description:`Label for admin installed skills`}});function a({scope:e,intl:t,repoLabel:r,adminLabel:a}){if(e===`repo`)return r??t.formatMessage(i.repo);if(e===`admin`)return a??t.formatMessage(i.admin);let o=i[e];return o?t.formatMessage(o):n(e,t)}function o({skillPath:e,roots:t,fallbackLabel:n}){let i=t.reduce((t,n)=>e.startsWith(n)&&(!t||n.length>t.length)?n:t,null);if(!i)return n;let a=r(i);return a.length>0?a:n}function s({skill:e,roots:t,intl:n,fallbackRepoLabel:r,adminLabel:i}){return a({scope:e.scope,intl:n,repoLabel:o({skillPath:e.path,roots:t,fallbackLabel:r??a({scope:`repo`,intl:n})}),adminLabel:i})}export{o as n,s as r,a as t};
//# sourceMappingURL=format-skill-scope-dUPIMEuf.js.map