function parseOptions(args) {
  const parsedArgs = [];
  const options = {};
  const flags = /* @__PURE__ */ new Set();
  for (const arg of args) {
    if (arg.startsWith("--")) {
      if (arg.includes("=")) {
        const [key, ...valueParts] = arg.slice(2).split("=");
        if (key) {
          options[key] = valueParts.join("=");
        }
      } else {
        flags.add(arg.slice(2));
      }
    } else {
      parsedArgs.push(arg);
    }
  }
  return { parsedArgs, options, flags };
}
function reconstructArgs(parsed) {
  const result = [...parsed.parsedArgs];
  for (const [key, value] of Object.entries(parsed.options)) {
    result.push(`--${key}=${value}`);
  }
  for (const flag of parsed.flags) {
    result.push(`--${flag}`);
  }
  return result;
}
export {
  parseOptions,
  reconstructArgs
};
