"use strict";
/* Socket Lib - Built with esbuild */
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var internal_exports = {};
__export(internal_exports, {
  MATCHER_CACHE_MAX_SIZE: () => MATCHER_CACHE_MAX_SIZE,
  defaultIgnore: () => import_defaults.defaultIgnore,
  getFastGlob: () => getFastGlob,
  getFs: () => import_fs.getNodeFs,
  getFsPromises: () => import_fs_promises.getNodeFsPromises,
  getPicomatch: () => getPicomatch,
  matcherCache: () => matcherCache,
  normalizeGlobResults: () => normalizeGlobResults,
  normalizeIgnorePatterns: () => normalizeIgnorePatterns,
  stripTrailingSlash: () => stripTrailingSlash
});
module.exports = __toCommonJS(internal_exports);
var import_array = require("../primordials/array");
var import_map_set = require("../primordials/map-set");
var import_string = require("../primordials/string");
var import_normalize = require("../paths/normalize");
var import_defaults = require("./defaults");
var import_fs = require("../node/fs");
var import_fs_promises = require("../node/fs-promises");
const MATCHER_CACHE_MAX_SIZE = 100;
const matcherCache = new import_map_set.MapCtor();
let _fastGlob;
let _picomatch;
// @__NO_SIDE_EFFECTS__
function getFastGlob() {
  if (_fastGlob === void 0) {
    _fastGlob = require("../external/fast-glob.js");
  }
  return _fastGlob;
}
// @__NO_SIDE_EFFECTS__
function getPicomatch() {
  if (_picomatch === void 0) {
    _picomatch = require("../external/picomatch.js");
  }
  return _picomatch;
}
function normalizeGlobResults(out) {
  for (let i = 0; i < out.length; i += 1) {
    out[i] = (0, import_normalize.normalizePath)(out[i]);
  }
  return out;
}
function normalizeIgnorePatterns(ignore) {
  if (!(0, import_array.ArrayIsArray)(ignore)) {
    return void 0;
  }
  const source = ignore;
  const { length } = source;
  const normalized = new import_array.ArrayCtor(length);
  for (let i = 0; i < length; i++) {
    normalized[i] = stripTrailingSlash(source[i]);
  }
  return normalized;
}
function stripTrailingSlash(pattern) {
  if (pattern.length > 1 && (0, import_string.StringPrototypeCharCodeAt)(pattern, pattern.length - 1) === 47) {
    return pattern.slice(0, -1);
  }
  return pattern;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  MATCHER_CACHE_MAX_SIZE,
  defaultIgnore,
  getFastGlob,
  getFs,
  getFsPromises,
  getPicomatch,
  matcherCache,
  normalizeGlobResults,
  normalizeIgnorePatterns,
  stripTrailingSlash
});
