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); // src/index.ts var index_exports = {}; __export(index_exports, { createIsBot: () => createIsBot, createIsBotFromList: () => createIsBotFromList, createIsbot: () => createIsbot, createIsbotFromList: () => createIsbotFromList, findBotMatch: () => findBotMatch, findBotMatches: () => findBotMatches, findBotPattern: () => findBotPattern, findBotPatterns: () => findBotPatterns, getPattern: () => getPattern, isBot: () => isBot, isBotNaive: () => isBotNaive, isbot: () => isbot, isbotMatch: () => isbotMatch, isbotMatches: () => isbotMatches, isbotNaive: () => isbotNaive, isbotPattern: () => isbotPattern, isbotPatterns: () => isbotPatterns, list: () => list }); module.exports = __toCommonJS(index_exports); // src/patterns.json var patterns_default = [ " daum[ /]", " deusu/", "(?:^|[^g])news(?!sapphire)", "(? typeof value === "string" && value !== ""; var list = patterns_default; function isBot(userAgent) { return isNonEmptyString(userAgent) && getPattern().test(userAgent); } var isBotNaive = (userAgent) => isNonEmptyString(userAgent) && naivePattern.test(userAgent); var createIsBot = (customPattern) => (userAgent) => isNonEmptyString(userAgent) && customPattern.test(userAgent); var createIsBotFromList = (list2) => { const pattern2 = new RegExp(list2.join("|"), "i"); return (userAgent) => isNonEmptyString(userAgent) && pattern2.test(userAgent); }; var findBotMatch = (userAgent) => { var _a, _b; return (_b = (_a = userAgent == null ? void 0 : userAgent.match(getPattern())) == null ? void 0 : _a[0]) != null ? _b : null; }; var findBotMatches = (userAgent) => list.map((part) => { var _a; return (_a = userAgent == null ? void 0 : userAgent.match(new RegExp(part, "i"))) == null ? void 0 : _a[0]; }).filter(isNonEmptyString); var findBotPattern = (userAgent) => { var _a; return userAgent ? (_a = list.find((pattern2) => new RegExp(pattern2, "i").test(userAgent))) != null ? _a : null : null; }; var findBotPatterns = (userAgent) => userAgent ? list.filter((pattern2) => new RegExp(pattern2, "i").test(userAgent)) : []; var isbot = isBot; var isbotNaive = isBotNaive; var createIsbot = createIsBot; var createIsbotFromList = createIsBotFromList; var isbotMatch = findBotMatch; var isbotMatches = findBotMatches; var isbotPattern = findBotPattern; var isbotPatterns = findBotPatterns; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { createIsBot, createIsBotFromList, createIsbot, createIsbotFromList, findBotMatch, findBotMatches, findBotPattern, findBotPatterns, getPattern, isBot, isBotNaive, isbot, isbotMatch, isbotMatches, isbotNaive, isbotPattern, isbotPatterns, list });