function c(e){const r=e??"",s=r.indexOf("::");return s<=0?{group:null,base:r,raw:r}:{group:r.slice(0,s),base:r.slice(s+2),raw:r}}function d(e){if(!e||!e.pattern)return null;try{return new RegExp(e.pattern,e.flags??"")}catch{return null}}function f(e,r){const s=e??"";let u=null;const i=s,a=d(r);if(a&&r){const n=s.match(a);if(n&&n.groups){const g=r.displayGroup??"service",y=r.valueGroup??"group",l=n.groups[g],p=n.groups[y];if(l&&p){const t=c(l);return{display:t.base,cluster:p,clusterAlias:r.alias,legacyGroup:t.group}}if(l){const t=c(l);return{display:t.base,cluster:null,clusterAlias:null,legacyGroup:t.group}}}}const o=c(i);return u=o.group,{display:o.base,cluster:null,clusterAlias:null,legacyGroup:u}}export{c as p,f as r};
