{"version":3,"file":"escape-string-for-regex.cjs","sources":["../../src/utils/escape-string-for-regex.ts"],"sourcesContent":["/**\n * Escape a string for safe use inside a regular expression that is sent to MongoDB\n * (`$regex` / `new RegExp(...)` used in a query). MongoDB evaluates regular expressions\n * with the PCRE2 engine.\n *\n * Why not `RegExp.escape()`:\n *   Node.js 24's built-in `RegExp.escape()` escapes non-ASCII whitespace\n *   (code points >= U+0100, e.g. U+3000 IDEOGRAPHIC SPACE) into `\\uXXXX` form.\n *   PCRE2 does not support `\\u`, so such a pattern makes MongoDB throw\n *   \"Regular expression is invalid: PCRE2 does not support ... \\u\" (error 51091).\n *\n * This helper instead escapes only regex metacharacters and passes every other\n * character through literally — behaviourally identical to `escape-string-regexp` v5,\n * which is what GROWI used before the v7.5.0 refactor. The output never contains `\\u`,\n * so it is safe to hand to MongoDB.\n *\n * Use this (not `RegExp.escape`) whenever the resulting pattern is sent to MongoDB.\n * For in-process JS regex (`.test()` / `.replace()`), `RegExp.escape` is fine.\n */\nexport const escapeStringForMongoRegex = (str: string): string => {\n  return str.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&').replace(/-/g, '\\\\x2d');\n};\n"],"names":["escapeStringForMongoRegex","str"],"mappings":"gFAmBa,MAAAA,EAA6BC,GACjCA,EAAI,QAAQ,sBAAuB,MAAM,EAAE,QAAQ,KAAM,OAAO"}