/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{ensureOneOfType as t}from"../../core/accessorSupport/ensureType.js";import e from"../elements/AttributeTableAttachmentElement.js";import p from"../elements/AttributeTableElement.js";import r from"../elements/AttributeTableFieldElement.js";import o from"../elements/AttributeTableRelationshipElement.js";const n={base:p,key:"type",typeMap:{attachment:e,field:r,relationship:o}};function i(t){return{typesWithGroup:{base:p,key:"type",typeMap:{attachment:e,field:r,group:t,relationship:o}},typesWithoutGroup:n}}function u(t,e,p=!0){if(!t)return null;const r=p?e.typesWithGroup.typeMap:e.typesWithoutGroup.typeMap;return t.filter(t=>r[t.type]).map(t=>r[t.type].fromJSON(t))}function s(t,e,p=!0){if(!t)return null;const r=p?e.typesWithGroup.typeMap:e.typesWithoutGroup.typeMap;return t.filter(t=>r[t.type]).map(t=>t.toJSON())}function l(e,p,r=!0){return e?e.map(e=>t(r?p.typesWithGroup:p.typesWithoutGroup,e)):null}export{i as buildTypeMaps,l as ensureType,u as fromJSON,s as toJSON,n as typesWithoutGroup};
