import{DEFAULT_AUTHENTICATED_TEAM as i}from"../../../constants/common.js";import{unique as s}from"../../../utils/array/unique.js";function d(n,t){return`${n}:${t.join(",")}`}function a(n){const[t,e=""]=n.split(":");return{id:t,adapterIds:e.split(",").filter(Boolean)}}function I(n,t){const{id:e,adapterIds:r}=a(n);return d(e,s([...r,t]))}function _(n,t){if(!t)return n;const{id:e,adapterIds:r}=a(n),{adapterIds:o}=a(t);return d(e,s([...r,...o]))}const f=["given_name","firstName","first_name","FirstName","name"],u=["family_name","lastName","last_name","LastName"];function N(n={}){const t=f.find(e=>e in n&&typeof n[e]=="string")||"given_name";return n[t]||p(n.email)||"Unknown"}function l(n={}){const t=u.find(e=>e in n&&typeof n[e]=="string")||"family_name";return n[t]||m(n.email)||"Unknown"}function p(n){if(!n)return;const[t]=n.split("@");return t.split(/[.-]/)[0]}function m(n){if(!n)return;const[t]=n.split("@");return t.split(/[.-]/)[1]||void 0}function A(n){const t=/^\/?apps\/?$/,e=n?.content;if(!e)return{[i]:"read"};const r=Object.keys(e).find(o=>t.test(o));return r?e[r]||{[i]:"read"}:{[i]:"read"}}export{I as addOrgToId,A as getDevOnboardingRbacConfig,N as getFirstNameFromClaims,l as getLastNameFromClaims,_ as joinOrgsInIds,a as parseCombinedId};
