const DEFAULT_PREFIXES = ["cf_", "cf:"];
function collectCustomFieldValues(values, options = {}) {
  const {
    prefixes = DEFAULT_PREFIXES,
    stripPrefix = true,
    transform,
    accept,
    omitUndefined = true
  } = options;
  const result = {};
  for (const [rawKey, rawValue] of Object.entries(values)) {
    const prefix = prefixes.find((candidate) => rawKey.startsWith(candidate));
    if (!prefix) continue;
    const fieldId = stripPrefix ? rawKey.slice(prefix.length) : rawKey;
    if (!fieldId) continue;
    if (accept && !accept(fieldId, rawKey, rawValue)) continue;
    const nextValue = transform ? transform(rawValue, fieldId, rawKey) : rawValue;
    if (omitUndefined && nextValue === void 0) continue;
    result[fieldId] = nextValue;
  }
  return result;
}
export {
  collectCustomFieldValues
};
//# sourceMappingURL=customFieldValues.js.map
