"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }


var _chunkSCFUDB74cjs = require('./chunk-SCFUDB74.cjs');

// src/utilities/find-up.ts
_chunkSCFUDB74cjs.init_cjs_shims.call(void 0, );
var _fs = require('fs');
var _path = require('path');
var MAX_PATH_SEARCH_DEPTH = 30;
var depth = 0;
function findFolderUp(startPath, endFileNames) {
  const _startPath = _nullishCoalesce(startPath, () => ( process.cwd()));
  if (endFileNames.some((endFileName) => _fs.existsSync.call(void 0, _path.join.call(void 0, _startPath, endFileName)))) {
    return _startPath;
  }
  if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
    const parent = _path.join.call(void 0, _startPath, "..");
    return findFolderUp(parent, endFileNames);
  }
  return void 0;
}
_chunkSCFUDB74cjs.__name.call(void 0, findFolderUp, "findFolderUp");



exports.findFolderUp = findFolderUp;
