/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{ensureOneOfType as t}from"../../core/accessorSupport/ensureType.js";import e from"../elements/AttachmentElement.js";import o from"../elements/Element.js";import p from"../elements/FieldElement.js";import r from"../elements/RelationshipElement.js";import i from"../elements/TextElement.js";import n from"../elements/UtilityNetworkAssociationsElement.js";const s=t=>"field"===t.type,u=t=>"group"===t.type,m=t=>"text"===t.type,y=t=>"attachment"===t.type,l=t=>"relationship"===t.type,a=t=>"utilityNetworkAssociations"===t.type;function f(t){return c(t)||h(t)}function c(t){return"text-area"===t.type}function h(t){return"text-box"===t.type}function x(t){return{typesWithGroup:{base:o,key:"type",typeMap:{attachment:e,field:p,group:t,relationship:r,text:i,utilityNetworkAssociations:n}},typesWithoutGroup:{base:o,key:"type",typeMap:{attachment:e,field:p,relationship:r,text:i,utilityNetworkAssociations:n}}}}function G(t,e,o=!0){if(!t)return null;const p=o?e.typesWithGroup.typeMap:e.typesWithoutGroup.typeMap;return t.filter(t=>p[t.type]).map(t=>p[t.type].fromJSON(t))}function W(t,e,o=!0){if(!t)return null;const p=o?e.typesWithGroup.typeMap:e.typesWithoutGroup.typeMap;return t.filter(t=>p[t.type]).map(t=>t.toJSON())}function j(e,o,p=!0){return e?e.map(e=>t(p?o.typesWithGroup:o.typesWithoutGroup,e)):null}export{x as buildTypeMaps,j as ensureType,G as fromJSON,y as isAttachmentElement,s as isFieldElement,u as isGroupElement,l as isRelationshipElement,c as isTextAreaInput,h as isTextBoxInput,m as isTextElement,f as isTextInput,a as isUtilityNetworkAssociationsElement,W as toJSON};
