export async function load(e){e&&"function"==typeof e.load&&await e.load(),await ready(e)}export async function ready(e){e&&"function"==typeof e.when&&await e.when()}export function getAllFieldInfos(e){const t=Array.isArray(e.content)?e.content.filter((e=>"fields"===e.type)).map((e=>e.fieldInfos||[])):[];return(e.fieldInfos||[]).concat(...t)}const e=/\{(expression[\\/])?[\w.]+\}/g,t=/\{relationships[\\/][\w.]+[\\/][\w.]+\}/g,n=/\$feature\.(\w+)|\$feature\["([^\]]+)"\]|\$feature\['([^\]]+)'\]/g;export function getAllReferencedFieldNames(o){const r=new Set,s=[],i=[];return s.push(o.title),o.expressionInfos&&o.expressionInfos.forEach((e=>{null!=e.expression&&i.push(e.expression),null!=e.title&&i.push(e.title)})),Array.isArray(o.content)?o.content.forEach((e=>{if("type"in e)if(isExpressionContent(e)&&e.expressionInfo&&"string"==typeof e.expressionInfo.expression)i.push(e.expressionInfo.expression);else if(isTextContent(e)&&"string"==typeof e.text)s.push(e.text);else if(isMediaContent(e)){let t=e.mediaInfos||[];t=Array.isArray(t)?t:[t],t.forEach((e=>{s.push(e.title,e.caption),isImageMediaInfo(e)?e.value&&s.push(e.value.linkURL,e.value.sourceURL):e.value&&(r.add(e.value.tooltipField),r.add(e.value.normalizeField),(e.value.fields||[]).forEach((e=>r.add(e))))}))}})):"string"==typeof o.content&&s.push(o.content),i.filter((e=>!!e)).forEach((e=>{const t=e.matchAll(n);for(const e of t){const t=e[1]??e[2]??e[3];t&&r.add(t)}})),s.filter((e=>!!e)).forEach((n=>{let o;const s=new RegExp(e),i=new RegExp(t),p=e=>{const t=new RegExp(e);for(o=t.exec(n);o&&"string"==typeof o[0];)r.add(o[1]??o[0].replace(/\{|\}/g,"").split(":")[0]),o=t.exec(n)};p(s),p(i)})),Array.from(r.values()).filter((e=>!!e))}export function isCodedValueDomain(e){return"esri.layers.support.CodedValueDomain"===e?.declaredClass}export function isColor(e){return"esri.Color"===e?.declaredClass}export function isImageMediaInfo(e){return"esri.popup.content.ImageMediaInfo"===e?.declaredClass}export function isPopupTemplate(e){return"esri.PopupTemplate"===e?.declaredClass}export function isField(e){return"esri.layers.support.Field"===e?.declaredClass}export function isAttachmentsContent(e){return"esri.popup.content.AttachmentsContent"===e?.declaredClass}export function isCustomContent(e){return"esri.popup.content.CustomContent"===e?.declaredClass}export function isExpressionContent(e){return"esri.popup.content.ExpressionContent"===e?.declaredClass}export function isFieldsContent(e){return"esri.popup.content.FieldsContent"===e?.declaredClass}export function isMediaContent(e){return"esri.popup.content.MediaContent"===e?.declaredClass}export function isTextContent(e){return"esri.popup.content.TextContent"===e?.declaredClass}export function isRelationshipContent(e){return"esri.popup.content.RelationshipContent"===e?.declaredClass}export function isPopupContent(e){return isAttachmentsContent(e)||isExpressionContent(e)||isCustomContent(e)||isFieldsContent(e)||isTextContent(e)||isMediaContent(e)||isRelationshipContent(e)}export function isFeatureSet(e){return"esri.rest.support.FeatureSet"===e?.declaredClass}export function isFeatureType(e){return"esri.layers.support.FeatureType"===e?.declaredClass}export function isViewpoint(e){return"esri.Viewpoint"===e?.declaredClass}export function isPortalItem(e){return"esri.portal.PortalItem"===e?.declaredClass}export function isGraphic(e){return"esri.Graphic"===e?.declaredClass}export function isSpatialReference(e){return"esri.geometry.SpatialReference"===e?.declaredClass}export function isEsriObject(e){return!!e?.declaredClass}export function isGeometry(e){return isPoint(e)||isMultipoint(e)||isPolyline(e)||isPolygon(e)||isExtent(e)||isMesh(e)}export function isPoint(e){return isEsriObject(e)&&"point"===e?.type}export function isMultipoint(e){return isEsriObject(e)&&"multipoint"===e?.type}export function isPolyline(e){return isEsriObject(e)&&"polyline"===e?.type}export function isPolygon(e){return isEsriObject(e)&&"polygon"===e?.type}export function isExtent(e){return isEsriObject(e)&&"extent"===e?.type}export function isMesh(e){return isEsriObject(e)&&"mesh"===e?.type}