import CJS_COMPAT_NODE_URL_dgnqbwwscw from 'node:url';
import CJS_COMPAT_NODE_PATH_dgnqbwwscw from 'node:path';
import CJS_COMPAT_NODE_MODULE_dgnqbwwscw from "node:module";

var __filename = CJS_COMPAT_NODE_URL_dgnqbwwscw.fileURLToPath(import.meta.url);
var __dirname = CJS_COMPAT_NODE_PATH_dgnqbwwscw.dirname(__filename);
var require = CJS_COMPAT_NODE_MODULE_dgnqbwwscw.createRequire(import.meta.url);

// ------------------------------------------------------------
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
// ------------------------------------------------------------

// ../../node_modules/unicorn-magic/node.js
import { promisify } from "node:util";
import { execFile as execFileCallback, execFileSync as execFileSyncOriginal } from "node:child_process";
import path from "node:path";
import { fileURLToPath } from "node:url";
var execFileOriginal = promisify(execFileCallback);
function toPath(urlOrPath) {
  return urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
}
function traversePathUp(startPath) {
  return {
    *[Symbol.iterator]() {
      let currentPath = path.resolve(toPath(startPath)), previousPath;
      for (; previousPath !== currentPath; )
        yield currentPath, previousPath = currentPath, currentPath = path.resolve(currentPath, "..");
    }
  };
}
var TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;

export {
  toPath,
  traversePathUp
};
