var __spreadArray=this&&this.__spreadArray||function(e,i){for(var t=0,r=i.length,n=e.length;t<r;t++,n++)e[n]=i[t];return e};import"./index-a1675f50.js";import{R as ReferenceField}from"./index-ef734a5e.js";import{T as TextField}from"./index-336ef773.js";import{a as convertMentornityFieldToDevingenField,l as legacyProfileFields}from"./mentorinty-bridge-api-fc8ad2d8.js";import{a as AttachmentField}from"./attachment-32decf79.js";function convertFieldsToFieldReferences(e){return e.map((function(e){return{fieldId:e.id}}))}function getViewConfigForViewName(e,i){return e.find((function(e){return e.viewName===i}))}function getMembershipFields(e,i,t,r){return __spreadArray(__spreadArray(__spreadArray([],getAvailableLegacyProfileFields(e,i,t)),getAvailableMetadataFields(r,i)),[new ReferenceField("user","User","firstName","imageUrl","users",[new AttachmentField("imageUrl",""),new TextField("firstName","First Name")])])}function getUserDetailFields(e,i,t,r){return __spreadArray(__spreadArray([],getAvailableLegacyProfileFields(e,i,t)),getAvailableMetadataFields(r,i))}function getUserDetailViewFieldConfigs(e,i,t,r,n,a){var s;if(n){s=convertFieldsToFieldReferences(getUserDetailFields(e,i,t,r)).map((function(e){return Object.assign(Object.assign({},e),{lines:1,maxItems:3})}))}else{s=convertFieldsToFieldReferences(getUserDetailFields(e,i,t,r))}if(a){s=s.slice(0,a)}return s}function getAvailableLegacyProfileFields(e,i,t){var r=t==="mentor"?i.profileFieldVisibilities.mentor:i.profileFieldVisibilities.mentee;return legacyProfileFields(e).filter((function(e){return r[e.id]}))}function getAvailableMetadataFields(e,i){var t=i.metadataVisibility[e]!=="none";return(t?(e==="mentor"?i.metadatas.mentee:i.metadatas.mentor)||[]:[]).map((function(e){return convertMentornityFieldToDevingenField(e)}))}function filterUnavailableMetadataFields(e,i,t){var r=e==="mentor"?i.metadatas.mentee:i.metadatas.mentor;var n=r.map((function(e){return e.id}));return t.filter((function(e){var i=e.fieldId;return n.includes(i)}))}function getPairConfigOptionsFromOrganisationConfig(e){var i=e.subscriptionConfig;return{isMentorSelectionOn:i.mentorVisibilityStatus==="showAvailableMentors",canMentorEndSubscription:i.mentorsCanEndSubscription,pairLimitForMentees:e.subscriptionConfig.menteeSubscriptionLimit,selectionLimitForMentees:e.subscriptionConfig.menteeSelectionLimit}}export{getAvailableMetadataFields as a,getPairConfigOptionsFromOrganisationConfig as b,convertFieldsToFieldReferences as c,getMembershipFields as d,getUserDetailViewFieldConfigs as e,filterUnavailableMetadataFields as f,getViewConfigForViewName as g,getAvailableLegacyProfileFields as h};