function words(e) {
  for (var t = {}, n = e.split(" "), r = 0; r < n.length; ++r) t[n[r]] = true;
  return t;
}
var defaults = {
  keywords: words("DEFINITIONS OBJECTS IF DERIVED INFORMATION ACTION REPLY ANY NAMED CHARACTERIZED BEHAVIOUR REGISTERED WITH AS IDENTIFIED CONSTRAINED BY PRESENT BEGIN IMPORTS FROM UNITS SYNTAX MIN-ACCESS MAX-ACCESS MINACCESS MAXACCESS REVISION STATUS DESCRIPTION SEQUENCE SET COMPONENTS OF CHOICE DistinguishedName ENUMERATED SIZE MODULE END INDEX AUGMENTS EXTENSIBILITY IMPLIED EXPORTS"),
  cmipVerbs: words("ACTIONS ADD GET NOTIFICATIONS REPLACE REMOVE"),
  compareTypes: words("OPTIONAL DEFAULT MANAGED MODULE-TYPE MODULE_IDENTITY MODULE-COMPLIANCE OBJECT-TYPE OBJECT-IDENTITY OBJECT-COMPLIANCE MODE CONFIRMED CONDITIONAL SUBORDINATE SUPERIOR CLASS TRUE FALSE NULL TEXTUAL-CONVENTION"),
  status: words("current deprecated mandatory obsolete"),
  tags: words("APPLICATION AUTOMATIC EXPLICIT IMPLICIT PRIVATE TAGS UNIVERSAL"),
  storage: words("BOOLEAN INTEGER OBJECT IDENTIFIER BIT OCTET STRING UTCTime InterfaceIndex IANAifType CMIP-Attribute REAL PACKAGE PACKAGES IpAddress PhysAddress NetworkAddress BITS BMPString TimeStamp TimeTicks TruthValue RowStatus DisplayString GeneralString GraphicString IA5String NumericString PrintableString SnmpAdminString TeletexString UTF8String VideotexString VisibleString StringStore ISO646String T61String UniversalString Unsigned32 Integer32 Gauge Gauge32 Counter Counter32 Counter64"),
  modifier: words("ATTRIBUTE ATTRIBUTES MANDATORY-GROUP MANDATORY-GROUPS GROUP GROUPS ELEMENTS EQUALITY ORDERING SUBSTRINGS DEFINED"),
  accessTypes: words("not-accessible accessible-for-notify read-only read-create read-write"),
  multiLineStrings: true
};
function asn1(e) {
  var n = e.keywords || defaults.keywords, r = e.cmipVerbs || defaults.cmipVerbs, i = e.compareTypes || defaults.compareTypes, a = e.status || defaults.status, o = e.tags || defaults.tags, s = e.storage || defaults.storage, c = e.modifier || defaults.modifier, l = e.accessTypes || defaults.accessTypes, u = e.multiLineStrings || defaults.multiLineStrings, d = e.indentStatements !== false, f = /[\|\^]/, p;
  function m(e2, t) {
    var u2 = e2.next();
    if (u2 == '"' || u2 == "'") return t.tokenize = h(u2), t.tokenize(e2, t);
    if (/[\[\]\(\){}:=,;]/.test(u2)) return p = u2, "punctuation";
    if (u2 == "-" && e2.eat("-")) return e2.skipToEnd(), "comment";
    if (/\d/.test(u2)) return e2.eatWhile(/[\w\.]/), "number";
    if (f.test(u2)) return e2.eatWhile(f), "operator";
    e2.eatWhile(/[\w\-]/);
    var d2 = e2.current();
    return n.propertyIsEnumerable(d2) ? "keyword" : r.propertyIsEnumerable(d2) ? "variableName" : i.propertyIsEnumerable(d2) ? "atom" : a.propertyIsEnumerable(d2) ? "comment" : o.propertyIsEnumerable(d2) ? "typeName" : s.propertyIsEnumerable(d2) || c.propertyIsEnumerable(d2) || l.propertyIsEnumerable(d2) ? "modifier" : "variableName";
  }
  function h(e2) {
    return function(t, n2) {
      for (var r2 = false, i2, a2 = false; (i2 = t.next()) != null; ) {
        if (i2 == e2 && !r2) {
          var o2 = t.peek();
          o2 && (o2 = o2.toLowerCase(), (o2 == "b" || o2 == "h" || o2 == "o") && t.next()), a2 = true;
          break;
        }
        r2 = !r2 && i2 == "\\";
      }
      return (a2 || !(r2 || u)) && (n2.tokenize = null), "string";
    };
  }
  function g(e2, t, n2, r2, i2) {
    this.indented = e2, this.column = t, this.type = n2, this.align = r2, this.prev = i2;
  }
  function _(e2, t, n2) {
    var r2 = e2.indented;
    return e2.context && e2.context.type == "statement" && (r2 = e2.context.indented), e2.context = new g(r2, t, n2, null, e2.context);
  }
  function v(e2) {
    var t = e2.context.type;
    return (t == ")" || t == "]" || t == "}") && (e2.indented = e2.context.indented), e2.context = e2.context.prev;
  }
  return {
    name: "asn1",
    startState: function() {
      return {
        tokenize: null,
        context: new g(-2, 0, "top", false),
        indented: 0,
        startOfLine: true
      };
    },
    token: function(e2, t) {
      var n2 = t.context;
      if (e2.sol() && (n2.align ?? (n2.align = false), t.indented = e2.indentation(), t.startOfLine = true), e2.eatSpace()) return null;
      p = null;
      var r2 = (t.tokenize || m)(e2, t);
      if (r2 == "comment") return r2;
      if (n2.align ?? (n2.align = true), (p == ";" || p == ":" || p == ",") && n2.type == "statement") v(t);
      else if (p == "{") _(t, e2.column(), "}");
      else if (p == "[") _(t, e2.column(), "]");
      else if (p == "(") _(t, e2.column(), ")");
      else if (p == "}") {
        for (; n2.type == "statement"; ) n2 = v(t);
        for (n2.type == "}" && (n2 = v(t)); n2.type == "statement"; ) n2 = v(t);
      } else p == n2.type ? v(t) : d && ((n2.type == "}" || n2.type == "top") && p != ";" || n2.type == "statement" && p == "newstatement") && _(t, e2.column(), "statement");
      return t.startOfLine = false, r2;
    },
    languageData: {
      indentOnInput: /^\s*[{}]$/,
      commentTokens: { line: "--" }
    }
  };
}
export {
  asn1 as t
};
