import{isCodedValueDomain as t}from"../../utilities/esri.js";import{NumberFormat as e,DateFormat as r,TimeFormat as i}from"../../utilities/format/formats.js";import{format as s}from"../../utilities/format/number.js";import{caseInsensitiveEquals as a}from"../../utilities/string.js";const o="\t";export function getSearchableValue(n,m){const u=Array.from(n.attributes.keys()).find((t=>a(t,m.name))),f=n.attributes.get(u);if(null==f)return"";if(t(n.type?.domains?.[u])||t(m.domain))return n.presentableAttributes.get(u);switch(m.type){case"integer":case"small-integer":case"big-integer":case"double":case"single":case"oid":return[n.presentableAttributes.get(u),n.format(`{${u}:#.####################}`),n.format(`{${u}:#,#.####################}`),s(e.ROUND_TRIP,f)].join(o);case"date":case"timestamp-offset":return[n.presentableAttributes.get(u),n.format(`{${u}:${r.FULL}}`),n.format(`{${u}:${r.DATE_SHORT}}`)].join(o);case"date-only":return[n.presentableAttributes.get(u),n.format(`{${u}:${r.DATE_LONG}}`),n.format(`{${u}:${r.DATE_SHORT}}`)].join(o);case"time-only":return[n.presentableAttributes.get(u),n.format(`${u}:${i.TIME_SHORT}`),n.format(`${u}:${i.TIME_LONG}`)].join(o);default:return n.presentableAttributes.get(u)}}