import scope_manager_1 from "/new/@typescript-eslint/scope-manager@v8.50.0/dist=es2019,mode=imports?from=@typescript-eslint/scope-manager";
import typescript_estree_1 from "/new/@typescript-eslint/typescript-estree@v8.50.0/dist=es2019,mode=imports?from=@typescript-eslint/typescript-estree";
import visitor_keys_1 from "/new/@typescript-eslint/visitor-keys@v8.50.0/dist=es2019,mode=imports?from=@typescript-eslint/visitor-keys";
import require$$0$1 from "/-/debug@v4.4.3-Brh22weuCvWY3rcSd25Q/dist=es2019,mode=imports/optimized/debug.js";
import typescript_1 from "/new/typescript@v5.9.3/dist=es2019,mode=imports?from=typescript";
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
function getDefaultExportFromCjs(x) {
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
}
function createCommonjsModule(fn, basedir, module) {
  return module = {
    path: basedir,
    exports: {},
    require: function(path, base) {
      return commonjsRequire(path, base === void 0 || base === null ? module.path : base);
    }
  }, fn(module, module.exports), module.exports;
}
function commonjsRequire() {
  throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
}
var parser = createCommonjsModule(function(module, exports2) {
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) {
    return mod && mod.__esModule ? mod : {default: mod};
  };
  Object.defineProperty(exports2, "__esModule", {value: true});
  exports2.parse = parse2;
  exports2.parseForESLint = parseForESLint2;
  const debug_1 = __importDefault(require$$0$1);
  const log = (0, debug_1.default)("typescript-eslint:parser:parser");
  function validateBoolean(value, fallback = false) {
    if (typeof value !== "boolean") {
      return fallback;
    }
    return value;
  }
  const LIB_FILENAME_REGEX = /lib\.(.+)\.d\.[cm]?ts$/;
  function getLib(compilerOptions) {
    var _a;
    if (compilerOptions.lib) {
      return compilerOptions.lib.map((lib) => {
        var _a2;
        return (_a2 = LIB_FILENAME_REGEX.exec(lib.toLowerCase())) == null ? void 0 : _a2[1];
      }).filter((lib) => !!lib);
    }
    const target = (_a = compilerOptions.target) != null ? _a : typescript_1.ScriptTarget.ES5;
    switch (target) {
      case typescript_1.ScriptTarget.ES2015:
        return ["es6"];
      case typescript_1.ScriptTarget.ES2016:
        return ["es2016.full"];
      case typescript_1.ScriptTarget.ES2017:
        return ["es2017.full"];
      case typescript_1.ScriptTarget.ES2018:
        return ["es2018.full"];
      case typescript_1.ScriptTarget.ES2019:
        return ["es2019.full"];
      case typescript_1.ScriptTarget.ES2020:
        return ["es2020.full"];
      case typescript_1.ScriptTarget.ES2021:
        return ["es2021.full"];
      case typescript_1.ScriptTarget.ES2022:
        return ["es2022.full"];
      case typescript_1.ScriptTarget.ES2023:
        return ["es2023.full"];
      case typescript_1.ScriptTarget.ES2024:
        return ["es2024.full"];
      case typescript_1.ScriptTarget.ESNext:
        return ["esnext.full"];
      default:
        return ["lib"];
    }
  }
  function parse2(code, options) {
    return parseForESLint2(code, options).ast;
  }
  function parseForESLint2(code, parserOptions) {
    var _a, _b, _c;
    if (!parserOptions || typeof parserOptions !== "object") {
      parserOptions = {};
    } else {
      parserOptions = {...parserOptions};
    }
    if (parserOptions.sourceType !== "module" && parserOptions.sourceType !== "script") {
      parserOptions.sourceType = "script";
    }
    if (typeof parserOptions.ecmaFeatures !== "object") {
      parserOptions.ecmaFeatures = {};
    }
    const warnOnUnsupportedTypeScriptVersion = validateBoolean(parserOptions.warnOnUnsupportedTypeScriptVersion, true);
    const tsestreeOptions = {
      jsx: validateBoolean(parserOptions.ecmaFeatures.jsx),
      ...!warnOnUnsupportedTypeScriptVersion && {loggerFn: false},
      ...parserOptions,
      errorOnTypeScriptSyntacticAndSemanticIssues: false,
      comment: true,
      loc: true,
      range: true,
      tokens: true
    };
    const analyzeOptions = {
      globalReturn: parserOptions.ecmaFeatures.globalReturn,
      jsxFragmentName: parserOptions.jsxFragmentName,
      jsxPragma: parserOptions.jsxPragma,
      lib: parserOptions.lib,
      sourceType: parserOptions.sourceType
    };
    const {ast, services} = (0, typescript_estree_1.parseAndGenerateServices)(code, tsestreeOptions);
    ast.sourceType = parserOptions.sourceType;
    if (services.program) {
      const compilerOptions = services.program.getCompilerOptions();
      if (analyzeOptions.lib == null) {
        analyzeOptions.lib = getLib(compilerOptions);
        log("Resolved libs from program: %o", analyzeOptions.lib);
      }
      if (analyzeOptions.jsxPragma === void 0 && compilerOptions.jsxFactory != null) {
        const factory = compilerOptions.jsxFactory.split(".")[0].trim();
        analyzeOptions.jsxPragma = factory;
        log("Resolved jsxPragma from program: %s", analyzeOptions.jsxPragma);
      }
      if (analyzeOptions.jsxFragmentName === void 0 && compilerOptions.jsxFragmentFactory != null) {
        const fragFactory = compilerOptions.jsxFragmentFactory.split(".")[0].trim();
        analyzeOptions.jsxFragmentName = fragFactory;
        log("Resolved jsxFragmentName from program: %s", analyzeOptions.jsxFragmentName);
      }
    }
    const scopeManager = (0, scope_manager_1.analyze)(ast, analyzeOptions);
    (_a = services.emitDecoratorMetadata) != null ? _a : services.emitDecoratorMetadata = parserOptions.emitDecoratorMetadata === true;
    (_b = services.experimentalDecorators) != null ? _b : services.experimentalDecorators = parserOptions.experimentalDecorators === true;
    (_c = services.isolatedDeclarations) != null ? _c : services.isolatedDeclarations = parserOptions.isolatedDeclarations === true;
    return {ast, scopeManager, services, visitorKeys: visitor_keys_1.visitorKeys};
  }
});
const name = "@typescript-eslint/parser";
const version = "8.50.0";
const description = "An ESLint custom parser which leverages TypeScript ESTree";
const files = [
  "dist",
  "!*.tsbuildinfo",
  "README.md",
  "LICENSE"
];
const type = "commonjs";
const exports = {
  ".": {
    types: "./dist/index.d.ts",
    default: "./dist/index.js"
  },
  "./package.json": "./package.json"
};
const engines = {
  node: "^18.18.0 || ^20.9.0 || >=21.1.0"
};
const repository = {
  type: "git",
  url: "https://github.com/typescript-eslint/typescript-eslint.git",
  directory: "packages/parser"
};
const bugs = {
  url: "https://github.com/typescript-eslint/typescript-eslint/issues"
};
const homepage = "https://typescript-eslint.io/packages/parser";
const license = "MIT";
const keywords = [
  "ast",
  "ecmascript",
  "javascript",
  "typescript",
  "parser",
  "syntax",
  "eslint"
];
const scripts = {
  build: "yarn run -BT nx build",
  clean: "rimraf dist/ coverage/",
  format: "yarn run -T format",
  lint: "yarn run -BT nx lint",
  test: "yarn run -BT nx test",
  typecheck: "yarn run -BT nx typecheck"
};
const peerDependencies = {
  eslint: "^8.57.0 || ^9.0.0",
  typescript: ">=4.8.4 <6.0.0"
};
const dependencies = {
  "@typescript-eslint/scope-manager": "8.50.0",
  "@typescript-eslint/types": "8.50.0",
  "@typescript-eslint/typescript-estree": "8.50.0",
  "@typescript-eslint/visitor-keys": "8.50.0",
  debug: "^4.3.4"
};
const devDependencies = {
  "@vitest/coverage-v8": "^3.1.3",
  eslint: "*",
  glob: "*",
  rimraf: "*",
  typescript: "*",
  vitest: "^3.1.3"
};
const funding = {
  type: "opencollective",
  url: "https://opencollective.com/typescript-eslint"
};
const nx = {
  name: "parser",
  includedScripts: [
    "clean"
  ],
  targets: {
    lint: {
      command: "eslint"
    }
  }
};
var require$$0 = {
  name,
  version,
  description,
  files,
  type,
  exports,
  engines,
  repository,
  bugs,
  homepage,
  license,
  keywords,
  scripts,
  peerDependencies,
  dependencies,
  devDependencies,
  funding,
  nx
};
var dist = createCommonjsModule(function(module, exports2) {
  Object.defineProperty(exports2, "__esModule", {value: true});
  exports2.meta = exports2.version = exports2.withoutProjectParserOptions = exports2.createProgram = exports2.clearCaches = exports2.parseForESLint = exports2.parse = void 0;
  Object.defineProperty(exports2, "parse", {enumerable: true, get: function() {
    return parser.parse;
  }});
  Object.defineProperty(exports2, "parseForESLint", {enumerable: true, get: function() {
    return parser.parseForESLint;
  }});
  Object.defineProperty(exports2, "clearCaches", {enumerable: true, get: function() {
    return typescript_estree_1.clearCaches;
  }});
  Object.defineProperty(exports2, "createProgram", {enumerable: true, get: function() {
    return typescript_estree_1.createProgram;
  }});
  Object.defineProperty(exports2, "withoutProjectParserOptions", {enumerable: true, get: function() {
    return typescript_estree_1.withoutProjectParserOptions;
  }});
  exports2.version = require$$0.version;
  exports2.meta = {
    name: "typescript-eslint/parser",
    version: exports2.version
  };
});
var __pika_web_default_export_for_treeshaking__ = /* @__PURE__ */ getDefaultExportFromCjs(dist);
var clearCaches = dist.clearCaches;
var createProgram = dist.createProgram;
export default __pika_web_default_export_for_treeshaking__;
var meta = dist.meta;
var parse = dist.parse;
var parseForESLint = dist.parseForESLint;
var version$1 = dist.version;
var withoutProjectParserOptions = dist.withoutProjectParserOptions;
export {dist as __moduleExports, clearCaches, createProgram, meta, parse, parseForESLint, version$1 as version, withoutProjectParserOptions};
