import {
  a as s,
  c as A
} from "./chunk-IO47FP3U.js";

// ../node_modules/highlight.js/lib/languages/ruby.js
var w = A((B, E) => {
  function M(n) {
    return n ? typeof n == "string" ? n : n.source : null;
  }
  s(M, "source");
  function R(n) {
    return _("(?=", n, ")");
  }
  s(R, "lookahead");
  function _(...n) {
    return n.map((e) => M(e)).join("");
  }
  s(_, "concat");
  function T(n) {
    let c = "([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)", e = {
      keyword: "and then defined module in return redo if BEGIN retry end for self when next until do begin unless END rescue else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor __FILE__",
      built_in: "proc lambda",
      literal: "true false nil"
    }, b = {
      className: "doctag",
      begin: "@[A-Za-z]+"
    }, r = {
      begin: "#<",
      end: ">"
    }, i = [
      n.COMMENT(
        "#",
        "$",
        {
          contains: [b]
        }
      ),
      n.COMMENT(
        "^=begin",
        "^=end",
        {
          contains: [b],
          relevance: 10
        }
      ),
      n.COMMENT("^__END__", "\\n$")
    ], t = {
      className: "subst",
      begin: /#\{/,
      end: /\}/,
      keywords: e
    }, o = {
      className: "string",
      contains: [
        n.BACKSLASH_ESCAPE,
        t
      ],
      variants: [
        {
          begin: /'/,
          end: /'/
        },
        {
          begin: /"/,
          end: /"/
        },
        {
          begin: /`/,
          end: /`/
        },
        {
          begin: /%[qQwWx]?\(/,
          end: /\)/
        },
        {
          begin: /%[qQwWx]?\[/,
          end: /\]/
        },
        {
          begin: /%[qQwWx]?\{/,
          end: /\}/
        },
        {
          begin: /%[qQwWx]?</,
          end: />/
        },
        {
          begin: /%[qQwWx]?\//,
          end: /\//
        },
        {
          begin: /%[qQwWx]?%/,
          end: /%/
        },
        {
          begin: /%[qQwWx]?-/,
          end: /-/
        },
        {
          begin: /%[qQwWx]?\|/,
          end: /\|/
        },
        // in the following expressions, \B in the beginning suppresses recognition of ?-sequences
        // where ? is the last character of a preceding identifier, as in: `func?4`
        {
          begin: /\B\?(\\\d{1,3})/
        },
        {
          begin: /\B\?(\\x[A-Fa-f0-9]{1,2})/
        },
        {
          begin: /\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/
        },
        {
          begin: /\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/
        },
        {
          begin: /\B\?\\(c|C-)[\x20-\x7e]/
        },
        {
          begin: /\B\?\\?\S/
        },
        {
          // heredocs
          begin: /<<[-~]?'?(\w+)\n(?:[^\n]*\n)*?\s*\1\b/,
          returnBegin: !0,
          contains: [
            {
              begin: /<<[-~]?'?/
            },
            n.END_SAME_AS_BEGIN({
              begin: /(\w+)/,
              end: /(\w+)/,
              contains: [
                n.BACKSLASH_ESCAPE,
                t
              ]
            })
          ]
        }
      ]
    }, l = "[1-9](_?[0-9])*|0", d = "[0-9](_?[0-9])*", u = {
      className: "number",
      relevance: 0,
      variants: [
        // decimal integer/float, optionally exponential or rational, optionally imaginary
        {
          begin: `\\b(${l})(\\.(${d}))?([eE][+-]?(${d})|r)?i?\\b`
        },
        // explicit decimal/binary/octal/hexadecimal integer,
        // optionally rational and/or imaginary
        {
          begin: "\\b0[dD][0-9](_?[0-9])*r?i?\\b"
        },
        {
          begin: "\\b0[bB][0-1](_?[0-1])*r?i?\\b"
        },
        {
          begin: "\\b0[oO][0-7](_?[0-7])*r?i?\\b"
        },
        {
          begin: "\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"
        },
        // 0-prefixed implicit octal integer, optionally rational and/or imaginary
        {
          begin: "\\b0(_?[0-7])+r?i?\\b"
        }
      ]
    }, g = {
      className: "params",
      begin: "\\(",
      end: "\\)",
      endsParent: !0,
      keywords: e
    }, a = [
      o,
      {
        className: "class",
        beginKeywords: "class module",
        end: "$|;",
        illegal: /=/,
        contains: [
          n.inherit(n.TITLE_MODE, {
            begin: "[A-Za-z_]\\w*(::\\w+)*(\\?|!)?"
          }),
          {
            begin: "<\\s*",
            contains: [
              {
                begin: "(" + n.IDENT_RE + "::)?" + n.IDENT_RE,
                // we already get points for <, we don't need poitns
                // for the name also
                relevance: 0
              }
            ]
          }
        ].concat(i)
      },
      {
        className: "function",
        // def method_name(
        // def method_name;
        // def method_name (end of line)
        begin: _(/def\s+/, R(c + "\\s*(\\(|;|$)")),
        relevance: 0,
        // relevance comes from kewords
        keywords: "def",
        end: "$|;",
        contains: [
          n.inherit(n.TITLE_MODE, {
            begin: c
          }),
          g
        ].concat(i)
      },
      {
        // swallow namespace qualifiers before symbols
        begin: n.IDENT_RE + "::"
      },
      {
        className: "symbol",
        begin: n.UNDERSCORE_IDENT_RE + "(!|\\?)?:",
        relevance: 0
      },
      {
        className: "symbol",
        begin: ":(?!\\s)",
        contains: [
          o,
          {
            begin: c
          }
        ],
        relevance: 0
      },
      u,
      {
        // negative-look forward attemps to prevent false matches like:
        // @ident@ or $ident$ that might indicate this is not ruby at all
        className: "variable",
        begin: "(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"
      },
      {
        className: "params",
        begin: /\|/,
        end: /\|/,
        relevance: 0,
        // this could be a lot of things (in other languages) other than params
        keywords: e
      },
      {
        // regexp container
        begin: "(" + n.RE_STARTERS_RE + "|unless)\\s*",
        keywords: "unless",
        contains: [
          {
            className: "regexp",
            contains: [
              n.BACKSLASH_ESCAPE,
              t
            ],
            illegal: /\n/,
            variants: [
              {
                begin: "/",
                end: "/[a-z]*"
              },
              {
                begin: /%r\{/,
                end: /\}[a-z]*/
              },
              {
                begin: "%r\\(",
                end: "\\)[a-z]*"
              },
              {
                begin: "%r!",
                end: "![a-z]*"
              },
              {
                begin: "%r\\[",
                end: "\\][a-z]*"
              }
            ]
          }
        ].concat(r, i),
        relevance: 0
      }
    ].concat(r, i);
    t.contains = a, g.contains = a;
    let N = [
      {
        begin: /^\s*=>/,
        starts: {
          end: "$",
          contains: a
        }
      },
      {
        className: "meta",
        begin: "^(" + "[>?]>" + "|" + "[\\w#]+\\(\\w+\\):\\d+:\\d+>" + "|" + "(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>" + ")(?=[ ])",
        starts: {
          end: "$",
          contains: a
        }
      }
    ];
    return i.unshift(r), {
      name: "Ruby",
      aliases: [
        "rb",
        "gemspec",
        "podspec",
        "thor",
        "irb"
      ],
      keywords: e,
      illegal: /\/\*/,
      contains: [
        n.SHEBANG({
          binary: "ruby"
        })
      ].concat(N).concat(i).concat(a)
    };
  }
  s(T, "ruby");
  E.exports = T;
});

export {
  w as a
};
