import { __name } from './chunk-6AXVLTU5.js';
import { ENV_PREFIXES } from '@stryke/env/types';
import { camelCase } from '@stryke/string-format/camel-case';
import { isString } from '@stryke/type-checks/is-string';

var removeEnvPrefix = /* @__PURE__ */ __name((env) => {
  if (isString(env)) {
    let name = ENV_PREFIXES.reduce((ret, prefix) => {
      if (ret.startsWith(prefix)) {
        ret = ret.slice(prefix.length);
      }
      return ret;
    }, env.toUpperCase());
    while (name.startsWith("_")) {
      name = name.slice(1);
    }
    return name;
  }
  return Object.keys(env).reduce((ret, key) => {
    const name = removeEnvPrefix(key);
    if (name) {
      ret[name] = env[key];
    }
    return ret;
  }, {});
}, "removeEnvPrefix");
var formatEnvField = /* @__PURE__ */ __name((key) => {
  return camelCase(removeEnvPrefix(key));
}, "formatEnvField");

export { formatEnvField, removeEnvPrefix };
//# sourceMappingURL=chunk-3E4HF4K3.js.map
//# sourceMappingURL=chunk-3E4HF4K3.js.map