var __spreadArray=this&&this.__spreadArray||function(e,i,t){if(t||arguments.length===2)for(var r=0,a=i.length,n;r<a;r++){if(n||!(r in i)){if(!n)n=Array.prototype.slice.call(i,0,r);n[r]=i[r]}}return e.concat(n||Array.prototype.slice.call(i))};import"./index-774783ee.js";import{R as ReferenceField}from"./reference-field-0e7cd534.js";import{T as TextField}from"./index-403101cb.js";import{a as convertMentornityFieldToDevingenField,l as legacyProfileFields}from"./mentorinty-bridge-api-78ab1153.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),true),getAvailableMetadataFields(r,i),true),[new ReferenceField("user","User","firstName","imageUrl","users",[new AttachmentField("imageUrl",""),new TextField("firstName","First Name")])],false)}function getUserDetailFields(e,i,t,r){return __spreadArray(__spreadArray([],getAvailableLegacyProfileFields(e,i,t),true),getAvailableMetadataFields(r,i),true)}function getUserDetailViewFieldConfigs(e,i,t,r,a,n){var s;if(a){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(n){s=s.slice(0,n)}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 a=r.map((function(e){return e.id}));return t.filter((function(e){var i=e.fieldId;return a.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};