/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import{a as o}from"./NFOSWP5Q.js";import{b as l}from"./FES7B3SJ.js";import"./EXBEKVP5.js";function c(i){return i.reduce((t,n)=>Object.entries(n.roles).reduce((e,[r,a])=>{if(a.value===l)return e;let s;return n.key==="public"?s={collaborationType:r==="authenticated"?o.authenticated:o.anonymous,collaborationId:null}:n.entityType==="group"?s={collaborationType:r==="admin"?o.groupAdmin:o.group,collaborationId:n.entityId}:n.entityType==="organization"?s={collaborationType:r==="admin"?o.orgAdmin:o.org,collaborationId:n.entityId}:n.entityType==="user"&&(s={collaborationType:o.user,collaborationId:n.entityId}),s?[...e,Object.assign(Object.assign({},s),{permission:a.value,id:a.id})]:e},t),[])}function b(i){let t=[...i.publicConfigs,...i.orgConfigs,...i.groupConfigs,...i.userConfigs];return{name:i.name,blockWords:i.blockWords.split(",").map(n=>n.trim()),allowAsAnonymous:i.allowAsAnonymous,permissions:c(t)}}export{b as transformEditorToEntity};
