var __defProp = Object.defineProperty;
var __typeError = (msg) => {
  throw TypeError(msg);
};
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
var _executor, _promise;
let wasm;
let WASM_VECTOR_LEN = 0;
let cachedUint8ArrayMemory0 = null;
function getUint8ArrayMemory0() {
  if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
    cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
  }
  return cachedUint8ArrayMemory0;
}
const cachedTextEncoder = typeof TextEncoder !== "undefined" ? new TextEncoder("utf-8") : { encode: () => {
  throw Error("TextEncoder not available");
} };
const encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
  return cachedTextEncoder.encodeInto(arg, view);
} : function(arg, view) {
  const buf = cachedTextEncoder.encode(arg);
  view.set(buf);
  return {
    read: arg.length,
    written: buf.length
  };
};
function passStringToWasm0(arg, malloc, realloc) {
  if (realloc === void 0) {
    const buf = cachedTextEncoder.encode(arg);
    const ptr2 = malloc(buf.length, 1) >>> 0;
    getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
    WASM_VECTOR_LEN = buf.length;
    return ptr2;
  }
  let len = arg.length;
  let ptr = malloc(len, 1) >>> 0;
  const mem = getUint8ArrayMemory0();
  let offset = 0;
  for (; offset < len; offset++) {
    const code = arg.charCodeAt(offset);
    if (code > 127) break;
    mem[ptr + offset] = code;
  }
  if (offset !== len) {
    if (offset !== 0) {
      arg = arg.slice(offset);
    }
    ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
    const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
    const ret = encodeString(arg, view);
    offset += ret.written;
    ptr = realloc(ptr, len, offset, 1) >>> 0;
  }
  WASM_VECTOR_LEN = offset;
  return ptr;
}
let cachedDataViewMemory0 = null;
function getDataViewMemory0() {
  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
    cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
  }
  return cachedDataViewMemory0;
}
function addToExternrefTable0(obj) {
  const idx = wasm.__externref_table_alloc();
  wasm.__wbindgen_export_4.set(idx, obj);
  return idx;
}
function handleError(f, args) {
  try {
    return f.apply(this, args);
  } catch (e) {
    const idx = addToExternrefTable0(e);
    wasm.__wbindgen_exn_store(idx);
  }
}
const cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {
  throw Error("TextDecoder not available");
} };
if (typeof TextDecoder !== "undefined") {
  cachedTextDecoder.decode();
}
function getStringFromWasm0(ptr, len) {
  ptr = ptr >>> 0;
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
}
function getArrayU8FromWasm0(ptr, len) {
  ptr = ptr >>> 0;
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
}
function debugString(val) {
  const type = typeof val;
  if (type == "number" || type == "boolean" || val == null) {
    return `${val}`;
  }
  if (type == "string") {
    return `"${val}"`;
  }
  if (type == "symbol") {
    const description = val.description;
    if (description == null) {
      return "Symbol";
    } else {
      return `Symbol(${description})`;
    }
  }
  if (type == "function") {
    const name = val.name;
    if (typeof name == "string" && name.length > 0) {
      return `Function(${name})`;
    } else {
      return "Function";
    }
  }
  if (Array.isArray(val)) {
    const length = val.length;
    let debug = "[";
    if (length > 0) {
      debug += debugString(val[0]);
    }
    for (let i = 1; i < length; i++) {
      debug += ", " + debugString(val[i]);
    }
    debug += "]";
    return debug;
  }
  const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
  let className;
  if (builtInMatches && builtInMatches.length > 1) {
    className = builtInMatches[1];
  } else {
    return toString.call(val);
  }
  if (className == "Object") {
    try {
      return "Object(" + JSON.stringify(val) + ")";
    } catch (_) {
      return "Object";
    }
  }
  if (val instanceof Error) {
    return `${val.name}: ${val.message}
${val.stack}`;
  }
  return className;
}
function isLikeNone(x) {
  return x === void 0 || x === null;
}
function setup() {
  wasm.setup();
}
function takeFromExternrefTable0(idx) {
  const value = wasm.__wbindgen_export_4.get(idx);
  wasm.__externref_table_dealloc(idx);
  return value;
}
function _assertClass(instance, klass) {
  if (!(instance instanceof klass)) {
    throw new Error(`expected instance of ${klass.name}`);
  }
}
function getArrayJsValueFromWasm0(ptr, len) {
  ptr = ptr >>> 0;
  const mem = getDataViewMemory0();
  const result = [];
  for (let i = ptr; i < ptr + 4 * len; i += 4) {
    result.push(wasm.__wbindgen_export_4.get(mem.getUint32(i, true)));
  }
  wasm.__externref_drop_slice(ptr, len);
  return result;
}
function passArrayJsValueToWasm0(array, malloc) {
  const ptr = malloc(array.length * 4, 4) >>> 0;
  for (let i = 0; i < array.length; i++) {
    const add = addToExternrefTable0(array[i]);
    getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
  }
  WASM_VECTOR_LEN = array.length;
  return ptr;
}
function to_title_case(text) {
  let deferred2_0;
  let deferred2_1;
  try {
    const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    const len0 = WASM_VECTOR_LEN;
    const ret = wasm.to_title_case(ptr0, len0);
    deferred2_0 = ret[0];
    deferred2_1 = ret[1];
    return getStringFromWasm0(ret[0], ret[1]);
  } finally {
    wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
  }
}
function get_default_lint_config_as_json() {
  let deferred1_0;
  let deferred1_1;
  try {
    const ret = wasm.get_default_lint_config_as_json();
    deferred1_0 = ret[0];
    deferred1_1 = ret[1];
    return getStringFromWasm0(ret[0], ret[1]);
  } finally {
    wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
  }
}
function get_default_lint_config() {
  const ret = wasm.get_default_lint_config();
  return ret;
}
const Dialect = Object.freeze({
  American: 0,
  "0": "American",
  British: 1,
  "1": "British",
  Australian: 2,
  "2": "Australian",
  Canadian: 3,
  "3": "Canadian"
});
const Language = Object.freeze({
  Plain: 0,
  "0": "Plain",
  Markdown: 1,
  "1": "Markdown"
});
const SuggestionKind = Object.freeze({
  /**
   * Replace the problematic text.
   */
  Replace: 0,
  "0": "Replace",
  /**
   * Remove the problematic text.
   */
  Remove: 1,
  "1": "Remove",
  /**
   * Insert additional text after the error.
   */
  InsertAfter: 2,
  "2": "InsertAfter"
});
const LintFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
}, unregister: () => {
} } : new FinalizationRegistry((ptr) => wasm.__wbg_lint_free(ptr >>> 0, 1));
class Lint {
  static __wrap(ptr) {
    ptr = ptr >>> 0;
    const obj = Object.create(Lint.prototype);
    obj.__wbg_ptr = ptr;
    LintFinalization.register(obj, obj.__wbg_ptr, obj);
    return obj;
  }
  __destroy_into_raw() {
    const ptr = this.__wbg_ptr;
    this.__wbg_ptr = 0;
    LintFinalization.unregister(this);
    return ptr;
  }
  free() {
    const ptr = this.__destroy_into_raw();
    wasm.__wbg_lint_free(ptr, 0);
  }
  /**
   * @returns {string}
   */
  to_json() {
    let deferred1_0;
    let deferred1_1;
    try {
      const ret = wasm.lint_to_json(this.__wbg_ptr);
      deferred1_0 = ret[0];
      deferred1_1 = ret[1];
      return getStringFromWasm0(ret[0], ret[1]);
    } finally {
      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
    }
  }
  /**
   * @param {string} json
   * @returns {Lint}
   */
  static from_json(json) {
    const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    const len0 = WASM_VECTOR_LEN;
    const ret = wasm.lint_from_json(ptr0, len0);
    if (ret[2]) {
      throw takeFromExternrefTable0(ret[1]);
    }
    return Lint.__wrap(ret[0]);
  }
  /**
   * Get the content of the source material pointed to by [`Self::span`]
   * @returns {string}
   */
  get_problem_text() {
    let deferred1_0;
    let deferred1_1;
    try {
      const ret = wasm.lint_get_problem_text(this.__wbg_ptr);
      deferred1_0 = ret[0];
      deferred1_1 = ret[1];
      return getStringFromWasm0(ret[0], ret[1]);
    } finally {
      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
    }
  }
  /**
   * Get a string representing the general category of the lint.
   * @returns {string}
   */
  lint_kind() {
    let deferred1_0;
    let deferred1_1;
    try {
      const ret = wasm.lint_lint_kind(this.__wbg_ptr);
      deferred1_0 = ret[0];
      deferred1_1 = ret[1];
      return getStringFromWasm0(ret[0], ret[1]);
    } finally {
      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
    }
  }
  /**
   * Get a string representing the general category of the lint.
   * @returns {string}
   */
  lint_kind_pretty() {
    let deferred1_0;
    let deferred1_1;
    try {
      const ret = wasm.lint_lint_kind_pretty(this.__wbg_ptr);
      deferred1_0 = ret[0];
      deferred1_1 = ret[1];
      return getStringFromWasm0(ret[0], ret[1]);
    } finally {
      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
    }
  }
  /**
   * Equivalent to calling `.length` on the result of `suggestions()`.
   * @returns {number}
   */
  suggestion_count() {
    const ret = wasm.lint_suggestion_count(this.__wbg_ptr);
    return ret >>> 0;
  }
  /**
   * Get an array of any suggestions that may resolve the issue.
   * @returns {Suggestion[]}
   */
  suggestions() {
    const ret = wasm.lint_suggestions(this.__wbg_ptr);
    var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
    wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
    return v1;
  }
  /**
   * Get the location of the problematic text.
   * @returns {Span}
   */
  span() {
    const ret = wasm.lint_span(this.__wbg_ptr);
    return Span.__wrap(ret);
  }
  /**
   * Get a description of the error.
   * @returns {string}
   */
  message() {
    let deferred1_0;
    let deferred1_1;
    try {
      const ret = wasm.lint_message(this.__wbg_ptr);
      deferred1_0 = ret[0];
      deferred1_1 = ret[1];
      return getStringFromWasm0(ret[0], ret[1]);
    } finally {
      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
    }
  }
  /**
   * Get a description of the error as HTML.
   * @returns {string}
   */
  message_html() {
    let deferred1_0;
    let deferred1_1;
    try {
      const ret = wasm.lint_message_html(this.__wbg_ptr);
      deferred1_0 = ret[0];
      deferred1_1 = ret[1];
      return getStringFromWasm0(ret[0], ret[1]);
    } finally {
      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
    }
  }
}
const LinterFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
}, unregister: () => {
} } : new FinalizationRegistry((ptr) => wasm.__wbg_linter_free(ptr >>> 0, 1));
class Linter {
  static __wrap(ptr) {
    ptr = ptr >>> 0;
    const obj = Object.create(Linter.prototype);
    obj.__wbg_ptr = ptr;
    LinterFinalization.register(obj, obj.__wbg_ptr, obj);
    return obj;
  }
  __destroy_into_raw() {
    const ptr = this.__wbg_ptr;
    this.__wbg_ptr = 0;
    LinterFinalization.unregister(this);
    return ptr;
  }
  free() {
    const ptr = this.__destroy_into_raw();
    wasm.__wbg_linter_free(ptr, 0);
  }
  /**
   * Construct a new `Linter`.
   * Note that this can mean constructing the curated dictionary, which is the most expensive operation
   * in Harper.
   * @param {Dialect} dialect
   * @returns {Linter}
   */
  static new(dialect) {
    const ret = wasm.linter_new(dialect);
    return Linter.__wrap(ret);
  }
  /**
   * Helper method to quickly check if a plain string is likely intended to be English
   * @param {string} text
   * @returns {boolean}
   */
  is_likely_english(text) {
    const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    const len0 = WASM_VECTOR_LEN;
    const ret = wasm.linter_is_likely_english(this.__wbg_ptr, ptr0, len0);
    return ret !== 0;
  }
  /**
   * Helper method to remove non-English text from a plain English document.
   * @param {string} text
   * @returns {string}
   */
  isolate_english(text) {
    let deferred2_0;
    let deferred2_1;
    try {
      const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
      const len0 = WASM_VECTOR_LEN;
      const ret = wasm.linter_isolate_english(this.__wbg_ptr, ptr0, len0);
      deferred2_0 = ret[0];
      deferred2_1 = ret[1];
      return getStringFromWasm0(ret[0], ret[1]);
    } finally {
      wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
    }
  }
  /**
   * Get a JSON map containing the descriptions of all the linting rules, formatted as HTML.
   * @returns {string}
   */
  get_lint_descriptions_html_as_json() {
    let deferred1_0;
    let deferred1_1;
    try {
      const ret = wasm.linter_get_lint_descriptions_html_as_json(this.__wbg_ptr);
      deferred1_0 = ret[0];
      deferred1_1 = ret[1];
      return getStringFromWasm0(ret[0], ret[1]);
    } finally {
      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
    }
  }
  /**
   * Get a Record containing the descriptions of all the linting rules, formatted as HTML.
   * @returns {any}
   */
  get_lint_descriptions_html_as_object() {
    const ret = wasm.linter_get_lint_descriptions_html_as_object(this.__wbg_ptr);
    return ret;
  }
  /**
   * Get a JSON map containing the descriptions of all the linting rules, formatted as Markdown.
   * @returns {string}
   */
  get_lint_descriptions_as_json() {
    let deferred1_0;
    let deferred1_1;
    try {
      const ret = wasm.linter_get_lint_descriptions_as_json(this.__wbg_ptr);
      deferred1_0 = ret[0];
      deferred1_1 = ret[1];
      return getStringFromWasm0(ret[0], ret[1]);
    } finally {
      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
    }
  }
  /**
   * Get a Record containing the descriptions of all the linting rules, formatted as Markdown.
   * @returns {any}
   */
  get_lint_descriptions_as_object() {
    const ret = wasm.linter_get_lint_descriptions_as_object(this.__wbg_ptr);
    return ret;
  }
  /**
   * @returns {string}
   */
  get_lint_config_as_json() {
    let deferred1_0;
    let deferred1_1;
    try {
      const ret = wasm.linter_get_lint_config_as_json(this.__wbg_ptr);
      deferred1_0 = ret[0];
      deferred1_1 = ret[1];
      return getStringFromWasm0(ret[0], ret[1]);
    } finally {
      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
    }
  }
  /**
   * @param {string} json
   */
  set_lint_config_from_json(json) {
    const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    const len0 = WASM_VECTOR_LEN;
    const ret = wasm.linter_set_lint_config_from_json(this.__wbg_ptr, ptr0, len0);
    if (ret[1]) {
      throw takeFromExternrefTable0(ret[0]);
    }
  }
  /**
   * @param {bigint | null} [start_time]
   * @param {bigint | null} [end_time]
   * @returns {any}
   */
  summarize_stats(start_time, end_time) {
    const ret = wasm.linter_summarize_stats(this.__wbg_ptr, !isLikeNone(start_time), isLikeNone(start_time) ? BigInt(0) : start_time, !isLikeNone(end_time), isLikeNone(end_time) ? BigInt(0) : end_time);
    return ret;
  }
  /**
   * @returns {any}
   */
  get_lint_config_as_object() {
    const ret = wasm.linter_get_lint_config_as_object(this.__wbg_ptr);
    return ret;
  }
  /**
   * @param {any} object
   */
  set_lint_config_from_object(object) {
    const ret = wasm.linter_set_lint_config_from_object(this.__wbg_ptr, object);
    if (ret[1]) {
      throw takeFromExternrefTable0(ret[0]);
    }
  }
  /**
   * @param {string} source_text
   * @param {Lint} lint
   */
  ignore_lint(source_text, lint) {
    const ptr0 = passStringToWasm0(source_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    const len0 = WASM_VECTOR_LEN;
    _assertClass(lint, Lint);
    var ptr1 = lint.__destroy_into_raw();
    wasm.linter_ignore_lint(this.__wbg_ptr, ptr0, len0, ptr1);
  }
  /**
   * Add a specific context hash to the ignored lints list.
   * @param {bigint} hash
   */
  ignore_hash(hash) {
    wasm.linter_ignore_hash(this.__wbg_ptr, hash);
  }
  /**
   * Compute the context hash of a given lint.
   * @param {string} source_text
   * @param {Lint} lint
   * @returns {bigint}
   */
  context_hash(source_text, lint) {
    const ptr0 = passStringToWasm0(source_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    const len0 = WASM_VECTOR_LEN;
    _assertClass(lint, Lint);
    const ret = wasm.linter_context_hash(this.__wbg_ptr, ptr0, len0, lint.__wbg_ptr);
    return BigInt.asUintN(64, ret);
  }
  /**
   * Perform the configured linting on the provided text.
   * @param {string} text
   * @param {Language} language
   * @returns {Lint[]}
   */
  lint(text, language) {
    const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    const len0 = WASM_VECTOR_LEN;
    const ret = wasm.linter_lint(this.__wbg_ptr, ptr0, len0, language);
    var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
    wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
    return v2;
  }
  /**
   * Export the linter's ignored lints as a privacy-respecting JSON list of hashes.
   * @returns {string}
   */
  export_ignored_lints() {
    let deferred1_0;
    let deferred1_1;
    try {
      const ret = wasm.linter_export_ignored_lints(this.__wbg_ptr);
      deferred1_0 = ret[0];
      deferred1_1 = ret[1];
      return getStringFromWasm0(ret[0], ret[1]);
    } finally {
      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
    }
  }
  /**
   * Import into the linter's ignored lints from a privacy-respecting JSON list of hashes.
   * @param {string} json
   */
  import_ignored_lints(json) {
    const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    const len0 = WASM_VECTOR_LEN;
    const ret = wasm.linter_import_ignored_lints(this.__wbg_ptr, ptr0, len0);
    if (ret[1]) {
      throw takeFromExternrefTable0(ret[0]);
    }
  }
  clear_ignored_lints() {
    wasm.linter_clear_ignored_lints(this.__wbg_ptr);
  }
  /**
   * Import words into the dictionary.
   * @param {string[]} additional_words
   */
  import_words(additional_words) {
    const ptr0 = passArrayJsValueToWasm0(additional_words, wasm.__wbindgen_malloc);
    const len0 = WASM_VECTOR_LEN;
    wasm.linter_import_words(this.__wbg_ptr, ptr0, len0);
  }
  /**
   * Export words from the dictionary.
   * Note: this will only return words previously added by [`Self::import_words`].
   * @returns {string[]}
   */
  export_words() {
    const ret = wasm.linter_export_words(this.__wbg_ptr);
    var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
    wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
    return v1;
  }
  /**
   * Get the dialect this struct was constructed for.
   * @returns {Dialect}
   */
  get_dialect() {
    const ret = wasm.linter_get_dialect(this.__wbg_ptr);
    return ret;
  }
  /**
   * Apply a suggestion from a given lint.
   * This action will be logged to the Linter's statistics.
   * @param {string} source_text
   * @param {Lint} lint
   * @param {Suggestion} suggestion
   * @returns {string}
   */
  apply_suggestion(source_text, lint, suggestion) {
    let deferred3_0;
    let deferred3_1;
    try {
      const ptr0 = passStringToWasm0(source_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
      const len0 = WASM_VECTOR_LEN;
      _assertClass(lint, Lint);
      _assertClass(suggestion, Suggestion);
      const ret = wasm.linter_apply_suggestion(this.__wbg_ptr, ptr0, len0, lint.__wbg_ptr, suggestion.__wbg_ptr);
      var ptr2 = ret[0];
      var len2 = ret[1];
      if (ret[3]) {
        ptr2 = 0;
        len2 = 0;
        throw takeFromExternrefTable0(ret[2]);
      }
      deferred3_0 = ptr2;
      deferred3_1 = len2;
      return getStringFromWasm0(ptr2, len2);
    } finally {
      wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
    }
  }
  /**
   * @returns {string}
   */
  generate_stats_file() {
    let deferred1_0;
    let deferred1_1;
    try {
      const ret = wasm.linter_generate_stats_file(this.__wbg_ptr);
      deferred1_0 = ret[0];
      deferred1_1 = ret[1];
      return getStringFromWasm0(ret[0], ret[1]);
    } finally {
      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
    }
  }
  /**
   * @param {string} file
   */
  import_stats_file(file) {
    const ptr0 = passStringToWasm0(file, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    const len0 = WASM_VECTOR_LEN;
    const ret = wasm.linter_import_stats_file(this.__wbg_ptr, ptr0, len0);
    if (ret[1]) {
      throw takeFromExternrefTable0(ret[0]);
    }
  }
}
const SpanFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
}, unregister: () => {
} } : new FinalizationRegistry((ptr) => wasm.__wbg_span_free(ptr >>> 0, 1));
class Span {
  static __wrap(ptr) {
    ptr = ptr >>> 0;
    const obj = Object.create(Span.prototype);
    obj.__wbg_ptr = ptr;
    SpanFinalization.register(obj, obj.__wbg_ptr, obj);
    return obj;
  }
  __destroy_into_raw() {
    const ptr = this.__wbg_ptr;
    this.__wbg_ptr = 0;
    SpanFinalization.unregister(this);
    return ptr;
  }
  free() {
    const ptr = this.__destroy_into_raw();
    wasm.__wbg_span_free(ptr, 0);
  }
  /**
   * @returns {string}
   */
  to_json() {
    let deferred1_0;
    let deferred1_1;
    try {
      const ret = wasm.span_to_json(this.__wbg_ptr);
      deferred1_0 = ret[0];
      deferred1_1 = ret[1];
      return getStringFromWasm0(ret[0], ret[1]);
    } finally {
      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
    }
  }
  /**
   * @param {string} json
   * @returns {Span}
   */
  static from_json(json) {
    const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    const len0 = WASM_VECTOR_LEN;
    const ret = wasm.span_from_json(ptr0, len0);
    if (ret[2]) {
      throw takeFromExternrefTable0(ret[1]);
    }
    return Span.__wrap(ret[0]);
  }
  /**
   * @returns {number}
   */
  get start() {
    const ret = wasm.__wbg_get_span_start(this.__wbg_ptr);
    return ret >>> 0;
  }
  /**
   * @param {number} arg0
   */
  set start(arg0) {
    wasm.__wbg_set_span_start(this.__wbg_ptr, arg0);
  }
  /**
   * @returns {number}
   */
  get end() {
    const ret = wasm.__wbg_get_span_end(this.__wbg_ptr);
    return ret >>> 0;
  }
  /**
   * @param {number} arg0
   */
  set end(arg0) {
    wasm.__wbg_set_span_end(this.__wbg_ptr, arg0);
  }
  /**
   * @param {number} start
   * @param {number} end
   * @returns {Span}
   */
  static new(start, end) {
    const ret = wasm.span_new(start, end);
    return Span.__wrap(ret);
  }
  /**
   * @returns {boolean}
   */
  is_empty() {
    const ret = wasm.span_is_empty(this.__wbg_ptr);
    return ret !== 0;
  }
  /**
   * @returns {number}
   */
  len() {
    const ret = wasm.span_len(this.__wbg_ptr);
    return ret >>> 0;
  }
}
const SuggestionFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
}, unregister: () => {
} } : new FinalizationRegistry((ptr) => wasm.__wbg_suggestion_free(ptr >>> 0, 1));
class Suggestion {
  static __wrap(ptr) {
    ptr = ptr >>> 0;
    const obj = Object.create(Suggestion.prototype);
    obj.__wbg_ptr = ptr;
    SuggestionFinalization.register(obj, obj.__wbg_ptr, obj);
    return obj;
  }
  __destroy_into_raw() {
    const ptr = this.__wbg_ptr;
    this.__wbg_ptr = 0;
    SuggestionFinalization.unregister(this);
    return ptr;
  }
  free() {
    const ptr = this.__destroy_into_raw();
    wasm.__wbg_suggestion_free(ptr, 0);
  }
  /**
   * @returns {string}
   */
  to_json() {
    let deferred1_0;
    let deferred1_1;
    try {
      const ret = wasm.suggestion_to_json(this.__wbg_ptr);
      deferred1_0 = ret[0];
      deferred1_1 = ret[1];
      return getStringFromWasm0(ret[0], ret[1]);
    } finally {
      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
    }
  }
  /**
   * @param {string} json
   * @returns {Suggestion}
   */
  static from_json(json) {
    const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    const len0 = WASM_VECTOR_LEN;
    const ret = wasm.suggestion_from_json(ptr0, len0);
    if (ret[2]) {
      throw takeFromExternrefTable0(ret[1]);
    }
    return Suggestion.__wrap(ret[0]);
  }
  /**
   * Get the text that is going to replace the problematic section.
   * If [`Self::kind`] is `SuggestionKind::Remove`, this will return an empty
   * string.
   * @returns {string}
   */
  get_replacement_text() {
    let deferred1_0;
    let deferred1_1;
    try {
      const ret = wasm.suggestion_get_replacement_text(this.__wbg_ptr);
      deferred1_0 = ret[0];
      deferred1_1 = ret[1];
      return getStringFromWasm0(ret[0], ret[1]);
    } finally {
      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
    }
  }
  /**
   * @returns {SuggestionKind}
   */
  kind() {
    const ret = wasm.suggestion_kind(this.__wbg_ptr);
    return ret;
  }
}
async function __wbg_load(module, imports) {
  if (typeof Response === "function" && module instanceof Response) {
    if (typeof WebAssembly.instantiateStreaming === "function") {
      try {
        return await WebAssembly.instantiateStreaming(module, imports);
      } catch (e) {
        if (module.headers.get("Content-Type") != "application/wasm") {
          console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
        } else {
          throw e;
        }
      }
    }
    const bytes = await module.arrayBuffer();
    return await WebAssembly.instantiate(bytes, imports);
  } else {
    const instance = await WebAssembly.instantiate(module, imports);
    if (instance instanceof WebAssembly.Instance) {
      return { instance, module };
    } else {
      return instance;
    }
  }
}
function __wbg_get_imports() {
  const imports = {};
  imports.wbg = {};
  imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
    const ret = String(arg1);
    const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    const len1 = WASM_VECTOR_LEN;
    getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
    getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
  };
  imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
    const ret = arg0.buffer;
    return ret;
  };
  imports.wbg.__wbg_call_672a4d21634d4a24 = function() {
    return handleError(function(arg0, arg1) {
      const ret = arg0.call(arg1);
      return ret;
    }, arguments);
  };
  imports.wbg.__wbg_done_769e5ede4b31c67b = function(arg0) {
    const ret = arg0.done;
    return ret;
  };
  imports.wbg.__wbg_entries_3265d4158b33e5dc = function(arg0) {
    const ret = Object.entries(arg0);
    return ret;
  };
  imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
    let deferred0_0;
    let deferred0_1;
    try {
      deferred0_0 = arg0;
      deferred0_1 = arg1;
      console.error(getStringFromWasm0(arg0, arg1));
    } finally {
      wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
    }
  };
  imports.wbg.__wbg_getRandomValues_38097e921c2494c3 = function() {
    return handleError(function(arg0, arg1) {
      globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
    }, arguments);
  };
  imports.wbg.__wbg_getTime_46267b1c24877e30 = function(arg0) {
    const ret = arg0.getTime();
    return ret;
  };
  imports.wbg.__wbg_get_67b2ba62fc30de12 = function() {
    return handleError(function(arg0, arg1) {
      const ret = Reflect.get(arg0, arg1);
      return ret;
    }, arguments);
  };
  imports.wbg.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {
    const ret = arg0[arg1 >>> 0];
    return ret;
  };
  imports.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
    let result;
    try {
      result = arg0 instanceof ArrayBuffer;
    } catch (_) {
      result = false;
    }
    const ret = result;
    return ret;
  };
  imports.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {
    let result;
    try {
      result = arg0 instanceof Uint8Array;
    } catch (_) {
      result = false;
    }
    const ret = result;
    return ret;
  };
  imports.wbg.__wbg_iterator_9a24c88df860dc65 = function() {
    const ret = Symbol.iterator;
    return ret;
  };
  imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
    const ret = arg0.length;
    return ret;
  };
  imports.wbg.__wbg_length_e2d2a49132c1b256 = function(arg0) {
    const ret = arg0.length;
    return ret;
  };
  imports.wbg.__wbg_lint_new = function(arg0) {
    const ret = Lint.__wrap(arg0);
    return ret;
  };
  imports.wbg.__wbg_log_0cc1b7768397bcfe = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
    let deferred0_0;
    let deferred0_1;
    try {
      deferred0_0 = arg0;
      deferred0_1 = arg1;
      console.log(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5), getStringFromWasm0(arg6, arg7));
    } finally {
      wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
    }
  };
  imports.wbg.__wbg_log_cb9e190acc5753fb = function(arg0, arg1) {
    let deferred0_0;
    let deferred0_1;
    try {
      deferred0_0 = arg0;
      deferred0_1 = arg1;
      console.log(getStringFromWasm0(arg0, arg1));
    } finally {
      wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
    }
  };
  imports.wbg.__wbg_mark_7438147ce31e9d4b = function(arg0, arg1) {
    performance.mark(getStringFromWasm0(arg0, arg1));
  };
  imports.wbg.__wbg_measure_fb7825c11612c823 = function() {
    return handleError(function(arg0, arg1, arg2, arg3) {
      let deferred0_0;
      let deferred0_1;
      let deferred1_0;
      let deferred1_1;
      try {
        deferred0_0 = arg0;
        deferred0_1 = arg1;
        deferred1_0 = arg2;
        deferred1_1 = arg3;
        performance.measure(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
      } finally {
        wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
        wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
      }
    }, arguments);
  };
  imports.wbg.__wbg_new0_f788a2397c7ca929 = function() {
    const ret = /* @__PURE__ */ new Date();
    return ret;
  };
  imports.wbg.__wbg_new_405e22f390576ce2 = function() {
    const ret = new Object();
    return ret;
  };
  imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
    const ret = /* @__PURE__ */ new Map();
    return ret;
  };
  imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
    const ret = new Error();
    return ret;
  };
  imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
    const ret = new Uint8Array(arg0);
    return ret;
  };
  imports.wbg.__wbg_next_25feadfc0913fea9 = function(arg0) {
    const ret = arg0.next;
    return ret;
  };
  imports.wbg.__wbg_next_6574e1a8a62d1055 = function() {
    return handleError(function(arg0) {
      const ret = arg0.next();
      return ret;
    }, arguments);
  };
  imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
    arg0[arg1] = arg2;
  };
  imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
    arg0.set(arg1, arg2 >>> 0);
  };
  imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) {
    const ret = arg0.set(arg1, arg2);
    return ret;
  };
  imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
    const ret = arg1.stack;
    const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    const len1 = WASM_VECTOR_LEN;
    getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
    getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
  };
  imports.wbg.__wbg_suggestion_new = function(arg0) {
    const ret = Suggestion.__wrap(arg0);
    return ret;
  };
  imports.wbg.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
    const ret = arg0.value;
    return ret;
  };
  imports.wbg.__wbindgen_boolean_get = function(arg0) {
    const v = arg0;
    const ret = typeof v === "boolean" ? v ? 1 : 0 : 2;
    return ret;
  };
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
    const ret = debugString(arg1);
    const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    const len1 = WASM_VECTOR_LEN;
    getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
    getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
  };
  imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
    const ret = new Error(getStringFromWasm0(arg0, arg1));
    return ret;
  };
  imports.wbg.__wbindgen_init_externref_table = function() {
    const table = wasm.__wbindgen_export_4;
    const offset = table.grow(4);
    table.set(0, void 0);
    table.set(offset + 0, void 0);
    table.set(offset + 1, null);
    table.set(offset + 2, true);
    table.set(offset + 3, false);
  };
  imports.wbg.__wbindgen_is_function = function(arg0) {
    const ret = typeof arg0 === "function";
    return ret;
  };
  imports.wbg.__wbindgen_is_object = function(arg0) {
    const val = arg0;
    const ret = typeof val === "object" && val !== null;
    return ret;
  };
  imports.wbg.__wbindgen_is_string = function(arg0) {
    const ret = typeof arg0 === "string";
    return ret;
  };
  imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
    const ret = arg0 == arg1;
    return ret;
  };
  imports.wbg.__wbindgen_memory = function() {
    const ret = wasm.memory;
    return ret;
  };
  imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
    const obj = arg1;
    const ret = typeof obj === "number" ? obj : void 0;
    getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
    getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
  };
  imports.wbg.__wbindgen_number_new = function(arg0) {
    const ret = arg0;
    return ret;
  };
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
    const obj = arg1;
    const ret = typeof obj === "string" ? obj : void 0;
    var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    var len1 = WASM_VECTOR_LEN;
    getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
    getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
  };
  imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
    const ret = getStringFromWasm0(arg0, arg1);
    return ret;
  };
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
    throw new Error(getStringFromWasm0(arg0, arg1));
  };
  return imports;
}
function __wbg_finalize_init(instance, module) {
  wasm = instance.exports;
  __wbg_init.__wbindgen_wasm_module = module;
  cachedDataViewMemory0 = null;
  cachedUint8ArrayMemory0 = null;
  wasm.__wbindgen_start();
  return wasm;
}
function initSync(module) {
  if (wasm !== void 0) return wasm;
  if (typeof module !== "undefined") {
    if (Object.getPrototypeOf(module) === Object.prototype) {
      ({ module } = module);
    } else {
      console.warn("using deprecated parameters for `initSync()`; pass a single object instead");
    }
  }
  const imports = __wbg_get_imports();
  if (!(module instanceof WebAssembly.Module)) {
    module = new WebAssembly.Module(module);
  }
  const instance = new WebAssembly.Instance(module, imports);
  return __wbg_finalize_init(instance, module);
}
async function __wbg_init(module_or_path) {
  if (wasm !== void 0) return wasm;
  if (typeof module_or_path !== "undefined") {
    if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
      ({ module_or_path } = module_or_path);
    } else {
      console.warn("using deprecated parameters for the initialization function; pass a single object instead");
    }
  }
  if (typeof module_or_path === "undefined") {
    module_or_path = new URL();
  }
  const imports = __wbg_get_imports();
  if (typeof module_or_path === "string" || typeof Request === "function" && module_or_path instanceof Request || typeof URL === "function" && module_or_path instanceof URL) {
    module_or_path = fetch(module_or_path);
  }
  const { instance, module } = await __wbg_load(await module_or_path, imports);
  return __wbg_finalize_init(instance, module);
}
const harper_wasm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  Dialect,
  Language,
  Lint,
  Linter,
  Span,
  Suggestion,
  SuggestionKind,
  default: __wbg_init,
  get_default_lint_config,
  get_default_lint_config_as_json,
  initSync,
  setup,
  to_title_case
}, Symbol.toStringTag, { value: "Module" }));
const binaryInlinedUrl = "data:application/wasm;base64,[encoded data, 5557196 characters]";
const binaryUrl = "" + new URL("harper_wasm_bg.wasm", import.meta.url).href;
const _PLazy = class _PLazy extends Promise {
  constructor(executor) {
    super((resolve) => {
      resolve();
    });
    __privateAdd(this, _executor);
    __privateAdd(this, _promise);
    __privateSet(this, _executor, executor);
  }
  static from(function_) {
    return new _PLazy((resolve) => {
      resolve(function_());
    });
  }
  static resolve(value) {
    return new _PLazy((resolve) => {
      resolve(value);
    });
  }
  static reject(error) {
    return new _PLazy((resolve, reject) => {
      reject(error);
    });
  }
  then(onFulfilled, onRejected) {
    __privateGet(this, _promise) ?? __privateSet(this, _promise, new Promise(__privateGet(this, _executor)));
    return __privateGet(this, _promise).then(onFulfilled, onRejected);
  }
  catch(onRejected) {
    __privateGet(this, _promise) ?? __privateSet(this, _promise, new Promise(__privateGet(this, _executor)));
    return __privateGet(this, _promise).catch(onRejected);
  }
  finally(onFinally) {
    __privateGet(this, _promise) ?? __privateSet(this, _promise, new Promise(__privateGet(this, _executor)));
    return __privateGet(this, _promise).finally(onFinally);
  }
};
_executor = new WeakMap();
_promise = new WeakMap();
let PLazy = _PLazy;
const copyProperty = (to, from, property, ignoreNonConfigurable) => {
  if (property === "length" || property === "prototype") {
    return;
  }
  if (property === "arguments" || property === "caller") {
    return;
  }
  const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
  const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
  if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
    return;
  }
  Object.defineProperty(to, property, fromDescriptor);
};
const canCopyProperty = function(toDescriptor, fromDescriptor) {
  return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
};
const changePrototype = (to, from) => {
  const fromPrototype = Object.getPrototypeOf(from);
  if (fromPrototype === Object.getPrototypeOf(to)) {
    return;
  }
  Object.setPrototypeOf(to, fromPrototype);
};
const wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
${fromBody}`;
const toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
const toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
const changeToString = (to, from, name) => {
  const withName = name === "" ? "" : `with ${name.trim()}() `;
  const newToString = wrappedToString.bind(null, withName, from.toString());
  Object.defineProperty(newToString, "name", toStringName);
  Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString });
};
function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
  const { name } = to;
  for (const property of Reflect.ownKeys(from)) {
    copyProperty(to, from, property, ignoreNonConfigurable);
  }
  changePrototype(to, from);
  changeToString(to, from, name);
  return to;
}
const cacheStore = /* @__PURE__ */ new WeakMap();
function pMemoize(fn, { cacheKey = ([firstArgument]) => firstArgument, cache = /* @__PURE__ */ new Map() } = {}) {
  const promiseCache = /* @__PURE__ */ new Map();
  const memoized = function(...arguments_) {
    const key = cacheKey(arguments_);
    if (promiseCache.has(key)) {
      return promiseCache.get(key);
    }
    const promise = (async () => {
      try {
        if (cache && await cache.has(key)) {
          return await cache.get(key);
        }
        const promise2 = fn.apply(this, arguments_);
        const result = await promise2;
        try {
          return result;
        } finally {
          if (cache) {
            await cache.set(key, result);
          }
        }
      } finally {
        promiseCache.delete(key);
      }
    })();
    promiseCache.set(key, promise);
    return promise;
  };
  mimicFunction(memoized, fn, {
    ignoreNonConfigurable: true
  });
  cacheStore.set(memoized, cache);
  return memoized;
}
function assert(condition, message) {
  if (!condition) {
    throw new Error("Assertion failed");
  }
}
const loadBinary = pMemoize(async (binary2) => {
  const exports = await Promise.resolve().then(() => harper_wasm);
  let input;
  if (typeof process !== "undefined" && binary2.startsWith("file://")) {
    const fs = await import(
      /* webpackIgnore: true */
      /* @vite-ignore */
      "fs"
    );
    input = new Promise((resolve, reject) => {
      fs.readFile(new URL(binary2).pathname, (err, data) => {
        if (err) reject(err);
        resolve(data);
      });
    });
  } else {
    input = binary2;
  }
  await exports.default({ module_or_path: input });
  return exports;
});
function isSerializedRequest(v) {
  return typeof v === "object" && v !== null && "procName" in v && "args" in v;
}
class BinaryModule {
  constructor(url) {
    __publicField(this, "url");
    __publicField(this, "inner");
    this.url = url;
    this.inner = PLazy.from(
      () => loadBinary(typeof this.url === "string" ? this.url : this.url.href)
    );
  }
  async getDefaultLintConfigAsJSON() {
    const exported = await this.inner;
    return exported.get_default_lint_config_as_json();
  }
  async getDefaultLintConfig() {
    const exported = await this.inner;
    return exported.get_default_lint_config();
  }
  async toTitleCase(text) {
    const exported = await this.inner;
    return exported.to_title_case(text);
  }
  async setup() {
    const exported = await this.inner;
    exported.setup();
  }
  async createLinter(dialect) {
    const exported = await this.inner;
    return exported.Linter.new(dialect ?? Dialect.American);
  }
  async serializeArg(arg) {
    const { Lint: Lint2, Span: Span2, Suggestion: Suggestion2 } = await this.inner;
    if (Array.isArray(arg)) {
      return {
        json: JSON.stringify(await Promise.all(arg.map((a) => this.serializeArg(a)))),
        type: "Array"
      };
    }
    const argType = typeof arg;
    switch (argType) {
      case "string":
      case "number":
      case "boolean":
      case "undefined":
        return { json: JSON.stringify(arg), type: argType };
      case "bigint":
        return { json: arg.toString(), type: argType };
    }
    if (arg.to_json !== void 0) {
      const json = arg.to_json();
      let type;
      if (arg instanceof Lint2) {
        type = "Lint";
      } else if (arg instanceof Suggestion2) {
        type = "Suggestion";
      } else if (arg instanceof Span2) {
        type = "Span";
      }
      if (type === void 0) {
        throw new Error("Unhandled case: type undefined");
      }
      return { json, type };
    }
    if (argType == "object") {
      return { json: JSON.stringify(arg), type: "object" };
    }
    throw new Error(`Unhandled case: ${arg}`);
  }
  async serialize(req) {
    return {
      procName: req.procName,
      args: await Promise.all(req.args.map((arg) => this.serializeArg(arg)))
    };
  }
  async deserializeArg(requestArg) {
    const { Lint: Lint2, Span: Span2, Suggestion: Suggestion2 } = await this.inner;
    switch (requestArg.type) {
      case "bigint":
        return BigInt(requestArg.json);
      case "undefined":
        return void 0;
      case "boolean":
      case "number":
      case "string":
        return JSON.parse(requestArg.json);
      case "Suggestion":
        return Suggestion2.from_json(requestArg.json);
      case "Lint":
        return Lint2.from_json(requestArg.json);
      case "Span":
        return Span2.from_json(requestArg.json);
      case "Array": {
        const parsed = JSON.parse(requestArg.json);
        assert(Array.isArray(parsed));
        return await Promise.all(parsed.map((arg) => this.deserializeArg(arg)));
      }
      case "object": {
        const parsed = JSON.parse(requestArg.json);
        return parsed;
      }
      default:
        throw new Error(`Unhandled case: ${requestArg.type}`);
    }
  }
  async deserialize(request) {
    return {
      procName: request.procName,
      args: await Promise.all(request.args.map((arg) => this.deserializeArg(arg)))
    };
  }
}
const binary = /* @__PURE__ */ new BinaryModule(binaryUrl);
const binaryInlined = /* @__PURE__ */ new BinaryModule(binaryInlinedUrl);
class LocalLinter {
  constructor(init) {
    __publicField(this, "binary");
    __publicField(this, "inner");
    this.binary = init.binary;
    this.inner = this.createInner(init.dialect);
  }
  createInner(dialect) {
    return PLazy.from(async () => {
      await this.binary.setup();
      return this.binary.createLinter(dialect);
    });
  }
  async setup() {
    await this.lint("", { language: "plaintext" });
    const exported = await this.exportIgnoredLints();
    await this.importIgnoredLints(exported);
  }
  async lint(text, options) {
    const inner = await this.inner;
    const language = (options == null ? void 0 : options.language) === "plaintext" ? Language.Plain : Language.Markdown;
    const lints = inner.lint(text, language);
    return lints;
  }
  async applySuggestion(text, lint, suggestion) {
    const inner = await this.inner;
    return inner.apply_suggestion(text, lint, suggestion);
  }
  async isLikelyEnglish(text) {
    const inner = await this.inner;
    return inner.is_likely_english(text);
  }
  async isolateEnglish(text) {
    const inner = await this.inner;
    return inner.isolate_english(text);
  }
  async getLintConfig() {
    const inner = await this.inner;
    return inner.get_lint_config_as_object();
  }
  async getDefaultLintConfigAsJSON() {
    return this.binary.getDefaultLintConfigAsJSON();
  }
  async getDefaultLintConfig() {
    return this.binary.getDefaultLintConfig();
  }
  async setLintConfig(config) {
    const inner = await this.inner;
    inner.set_lint_config_from_object(config);
  }
  async getLintConfigAsJSON() {
    const inner = await this.inner;
    return inner.get_lint_config_as_json();
  }
  async setLintConfigWithJSON(config) {
    const inner = await this.inner;
    inner.set_lint_config_from_json(config);
  }
  async toTitleCase(text) {
    return this.binary.toTitleCase(text);
  }
  async getLintDescriptions() {
    const inner = await this.inner;
    return inner.get_lint_descriptions_as_object();
  }
  async getLintDescriptionsAsJSON() {
    const inner = await this.inner;
    return inner.get_lint_descriptions_as_json();
  }
  async getLintDescriptionsHTML() {
    const inner = await this.inner;
    return inner.get_lint_descriptions_html_as_object();
  }
  async getLintDescriptionsHTMLAsJSON() {
    const inner = await this.inner;
    return inner.get_lint_descriptions_html_as_json();
  }
  async ignoreLint(source, lint) {
    const inner = await this.inner;
    inner.ignore_lint(source, lint);
  }
  async ignoreLintHash(hash) {
    const inner = await this.inner;
    inner.ignore_hash(hash);
  }
  async exportIgnoredLints() {
    const inner = await this.inner;
    return inner.export_ignored_lints();
  }
  async importIgnoredLints(json) {
    const inner = await this.inner;
    inner.import_ignored_lints(json);
  }
  async contextHash(source, lint) {
    const inner = await this.inner;
    return inner.context_hash(source, lint);
  }
  async clearIgnoredLints() {
    const inner = await this.inner;
    inner.clear_ignored_lints();
  }
  async importWords(words) {
    const inner = await this.inner;
    return inner.import_words(words);
  }
  async exportWords() {
    const inner = await this.inner;
    return inner.export_words();
  }
  async getDialect() {
    const inner = await this.inner;
    return inner.get_dialect();
  }
  async setDialect(dialect) {
    const inner = await this.inner;
    if (inner.get_dialect() !== dialect) {
      this.inner = this.createInner(dialect);
    }
    return Promise.resolve();
  }
  async summarizeStats(start, end) {
    const inner = await this.inner;
    return inner.summarize_stats(start, end);
  }
  async generateStatsFile() {
    const inner = await this.inner;
    return inner.generate_stats_file();
  }
  async importStatsFile(statsFile) {
    const inner = await this.inner;
    return inner.import_stats_file(statsFile);
  }
}
const jsContent = 'var __defProp = Object.defineProperty;\nvar __typeError = (msg) => {\n  throw TypeError(msg);\n};\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);\nvar __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);\nvar __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));\nvar __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\nvar __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);\nvar _executor, _promise;\nlet wasm;\nlet WASM_VECTOR_LEN = 0;\nlet cachedUint8ArrayMemory0 = null;\nfunction getUint8ArrayMemory0() {\n  if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n    cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n  }\n  return cachedUint8ArrayMemory0;\n}\nconst cachedTextEncoder = typeof TextEncoder !== "undefined" ? new TextEncoder("utf-8") : { encode: () => {\n  throw Error("TextEncoder not available");\n} };\nconst encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {\n  return cachedTextEncoder.encodeInto(arg, view);\n} : function(arg, view) {\n  const buf = cachedTextEncoder.encode(arg);\n  view.set(buf);\n  return {\n    read: arg.length,\n    written: buf.length\n  };\n};\nfunction passStringToWasm0(arg, malloc, realloc) {\n  if (realloc === void 0) {\n    const buf = cachedTextEncoder.encode(arg);\n    const ptr2 = malloc(buf.length, 1) >>> 0;\n    getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);\n    WASM_VECTOR_LEN = buf.length;\n    return ptr2;\n  }\n  let len = arg.length;\n  let ptr = malloc(len, 1) >>> 0;\n  const mem = getUint8ArrayMemory0();\n  let offset = 0;\n  for (; offset < len; offset++) {\n    const code = arg.charCodeAt(offset);\n    if (code > 127) break;\n    mem[ptr + offset] = code;\n  }\n  if (offset !== len) {\n    if (offset !== 0) {\n      arg = arg.slice(offset);\n    }\n    ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n    const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n    const ret = encodeString(arg, view);\n    offset += ret.written;\n    ptr = realloc(ptr, len, offset, 1) >>> 0;\n  }\n  WASM_VECTOR_LEN = offset;\n  return ptr;\n}\nlet cachedDataViewMemory0 = null;\nfunction getDataViewMemory0() {\n  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {\n    cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n  }\n  return cachedDataViewMemory0;\n}\nfunction addToExternrefTable0(obj) {\n  const idx = wasm.__externref_table_alloc();\n  wasm.__wbindgen_export_4.set(idx, obj);\n  return idx;\n}\nfunction handleError(f, args) {\n  try {\n    return f.apply(this, args);\n  } catch (e) {\n    const idx = addToExternrefTable0(e);\n    wasm.__wbindgen_exn_store(idx);\n  }\n}\nconst cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {\n  throw Error("TextDecoder not available");\n} };\nif (typeof TextDecoder !== "undefined") {\n  cachedTextDecoder.decode();\n}\nfunction getStringFromWasm0(ptr, len) {\n  ptr = ptr >>> 0;\n  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\nfunction getArrayU8FromWasm0(ptr, len) {\n  ptr = ptr >>> 0;\n  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\nfunction debugString(val) {\n  const type = typeof val;\n  if (type == "number" || type == "boolean" || val == null) {\n    return `${val}`;\n  }\n  if (type == "string") {\n    return `"${val}"`;\n  }\n  if (type == "symbol") {\n    const description = val.description;\n    if (description == null) {\n      return "Symbol";\n    } else {\n      return `Symbol(${description})`;\n    }\n  }\n  if (type == "function") {\n    const name = val.name;\n    if (typeof name == "string" && name.length > 0) {\n      return `Function(${name})`;\n    } else {\n      return "Function";\n    }\n  }\n  if (Array.isArray(val)) {\n    const length = val.length;\n    let debug = "[";\n    if (length > 0) {\n      debug += debugString(val[0]);\n    }\n    for (let i = 1; i < length; i++) {\n      debug += ", " + debugString(val[i]);\n    }\n    debug += "]";\n    return debug;\n  }\n  const builtInMatches = /\\[object ([^\\]]+)\\]/.exec(toString.call(val));\n  let className;\n  if (builtInMatches && builtInMatches.length > 1) {\n    className = builtInMatches[1];\n  } else {\n    return toString.call(val);\n  }\n  if (className == "Object") {\n    try {\n      return "Object(" + JSON.stringify(val) + ")";\n    } catch (_) {\n      return "Object";\n    }\n  }\n  if (val instanceof Error) {\n    return `${val.name}: ${val.message}\n${val.stack}`;\n  }\n  return className;\n}\nfunction isLikeNone(x) {\n  return x === void 0 || x === null;\n}\nfunction setup() {\n  wasm.setup();\n}\nfunction takeFromExternrefTable0(idx) {\n  const value = wasm.__wbindgen_export_4.get(idx);\n  wasm.__externref_table_dealloc(idx);\n  return value;\n}\nfunction _assertClass(instance, klass) {\n  if (!(instance instanceof klass)) {\n    throw new Error(`expected instance of ${klass.name}`);\n  }\n}\nfunction getArrayJsValueFromWasm0(ptr, len) {\n  ptr = ptr >>> 0;\n  const mem = getDataViewMemory0();\n  const result = [];\n  for (let i = ptr; i < ptr + 4 * len; i += 4) {\n    result.push(wasm.__wbindgen_export_4.get(mem.getUint32(i, true)));\n  }\n  wasm.__externref_drop_slice(ptr, len);\n  return result;\n}\nfunction passArrayJsValueToWasm0(array, malloc) {\n  const ptr = malloc(array.length * 4, 4) >>> 0;\n  for (let i = 0; i < array.length; i++) {\n    const add = addToExternrefTable0(array[i]);\n    getDataViewMemory0().setUint32(ptr + 4 * i, add, true);\n  }\n  WASM_VECTOR_LEN = array.length;\n  return ptr;\n}\nfunction to_title_case(text) {\n  let deferred2_0;\n  let deferred2_1;\n  try {\n    const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len0 = WASM_VECTOR_LEN;\n    const ret = wasm.to_title_case(ptr0, len0);\n    deferred2_0 = ret[0];\n    deferred2_1 = ret[1];\n    return getStringFromWasm0(ret[0], ret[1]);\n  } finally {\n    wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);\n  }\n}\nfunction get_default_lint_config_as_json() {\n  let deferred1_0;\n  let deferred1_1;\n  try {\n    const ret = wasm.get_default_lint_config_as_json();\n    deferred1_0 = ret[0];\n    deferred1_1 = ret[1];\n    return getStringFromWasm0(ret[0], ret[1]);\n  } finally {\n    wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n  }\n}\nfunction get_default_lint_config() {\n  const ret = wasm.get_default_lint_config();\n  return ret;\n}\nconst Dialect = Object.freeze({\n  American: 0,\n  "0": "American",\n  British: 1,\n  "1": "British",\n  Australian: 2,\n  "2": "Australian",\n  Canadian: 3,\n  "3": "Canadian"\n});\nconst Language = Object.freeze({\n  Plain: 0,\n  "0": "Plain",\n  Markdown: 1,\n  "1": "Markdown"\n});\nconst SuggestionKind = Object.freeze({\n  /**\n   * Replace the problematic text.\n   */\n  Replace: 0,\n  "0": "Replace",\n  /**\n   * Remove the problematic text.\n   */\n  Remove: 1,\n  "1": "Remove",\n  /**\n   * Insert additional text after the error.\n   */\n  InsertAfter: 2,\n  "2": "InsertAfter"\n});\nconst LintFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {\n}, unregister: () => {\n} } : new FinalizationRegistry((ptr) => wasm.__wbg_lint_free(ptr >>> 0, 1));\nclass Lint {\n  static __wrap(ptr) {\n    ptr = ptr >>> 0;\n    const obj = Object.create(Lint.prototype);\n    obj.__wbg_ptr = ptr;\n    LintFinalization.register(obj, obj.__wbg_ptr, obj);\n    return obj;\n  }\n  __destroy_into_raw() {\n    const ptr = this.__wbg_ptr;\n    this.__wbg_ptr = 0;\n    LintFinalization.unregister(this);\n    return ptr;\n  }\n  free() {\n    const ptr = this.__destroy_into_raw();\n    wasm.__wbg_lint_free(ptr, 0);\n  }\n  /**\n   * @returns {string}\n   */\n  to_json() {\n    let deferred1_0;\n    let deferred1_1;\n    try {\n      const ret = wasm.lint_to_json(this.__wbg_ptr);\n      deferred1_0 = ret[0];\n      deferred1_1 = ret[1];\n      return getStringFromWasm0(ret[0], ret[1]);\n    } finally {\n      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n    }\n  }\n  /**\n   * @param {string} json\n   * @returns {Lint}\n   */\n  static from_json(json) {\n    const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len0 = WASM_VECTOR_LEN;\n    const ret = wasm.lint_from_json(ptr0, len0);\n    if (ret[2]) {\n      throw takeFromExternrefTable0(ret[1]);\n    }\n    return Lint.__wrap(ret[0]);\n  }\n  /**\n   * Get the content of the source material pointed to by [`Self::span`]\n   * @returns {string}\n   */\n  get_problem_text() {\n    let deferred1_0;\n    let deferred1_1;\n    try {\n      const ret = wasm.lint_get_problem_text(this.__wbg_ptr);\n      deferred1_0 = ret[0];\n      deferred1_1 = ret[1];\n      return getStringFromWasm0(ret[0], ret[1]);\n    } finally {\n      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n    }\n  }\n  /**\n   * Get a string representing the general category of the lint.\n   * @returns {string}\n   */\n  lint_kind() {\n    let deferred1_0;\n    let deferred1_1;\n    try {\n      const ret = wasm.lint_lint_kind(this.__wbg_ptr);\n      deferred1_0 = ret[0];\n      deferred1_1 = ret[1];\n      return getStringFromWasm0(ret[0], ret[1]);\n    } finally {\n      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n    }\n  }\n  /**\n   * Get a string representing the general category of the lint.\n   * @returns {string}\n   */\n  lint_kind_pretty() {\n    let deferred1_0;\n    let deferred1_1;\n    try {\n      const ret = wasm.lint_lint_kind_pretty(this.__wbg_ptr);\n      deferred1_0 = ret[0];\n      deferred1_1 = ret[1];\n      return getStringFromWasm0(ret[0], ret[1]);\n    } finally {\n      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n    }\n  }\n  /**\n   * Equivalent to calling `.length` on the result of `suggestions()`.\n   * @returns {number}\n   */\n  suggestion_count() {\n    const ret = wasm.lint_suggestion_count(this.__wbg_ptr);\n    return ret >>> 0;\n  }\n  /**\n   * Get an array of any suggestions that may resolve the issue.\n   * @returns {Suggestion[]}\n   */\n  suggestions() {\n    const ret = wasm.lint_suggestions(this.__wbg_ptr);\n    var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();\n    wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n    return v1;\n  }\n  /**\n   * Get the location of the problematic text.\n   * @returns {Span}\n   */\n  span() {\n    const ret = wasm.lint_span(this.__wbg_ptr);\n    return Span.__wrap(ret);\n  }\n  /**\n   * Get a description of the error.\n   * @returns {string}\n   */\n  message() {\n    let deferred1_0;\n    let deferred1_1;\n    try {\n      const ret = wasm.lint_message(this.__wbg_ptr);\n      deferred1_0 = ret[0];\n      deferred1_1 = ret[1];\n      return getStringFromWasm0(ret[0], ret[1]);\n    } finally {\n      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n    }\n  }\n  /**\n   * Get a description of the error as HTML.\n   * @returns {string}\n   */\n  message_html() {\n    let deferred1_0;\n    let deferred1_1;\n    try {\n      const ret = wasm.lint_message_html(this.__wbg_ptr);\n      deferred1_0 = ret[0];\n      deferred1_1 = ret[1];\n      return getStringFromWasm0(ret[0], ret[1]);\n    } finally {\n      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n    }\n  }\n}\nconst LinterFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {\n}, unregister: () => {\n} } : new FinalizationRegistry((ptr) => wasm.__wbg_linter_free(ptr >>> 0, 1));\nclass Linter {\n  static __wrap(ptr) {\n    ptr = ptr >>> 0;\n    const obj = Object.create(Linter.prototype);\n    obj.__wbg_ptr = ptr;\n    LinterFinalization.register(obj, obj.__wbg_ptr, obj);\n    return obj;\n  }\n  __destroy_into_raw() {\n    const ptr = this.__wbg_ptr;\n    this.__wbg_ptr = 0;\n    LinterFinalization.unregister(this);\n    return ptr;\n  }\n  free() {\n    const ptr = this.__destroy_into_raw();\n    wasm.__wbg_linter_free(ptr, 0);\n  }\n  /**\n   * Construct a new `Linter`.\n   * Note that this can mean constructing the curated dictionary, which is the most expensive operation\n   * in Harper.\n   * @param {Dialect} dialect\n   * @returns {Linter}\n   */\n  static new(dialect) {\n    const ret = wasm.linter_new(dialect);\n    return Linter.__wrap(ret);\n  }\n  /**\n   * Helper method to quickly check if a plain string is likely intended to be English\n   * @param {string} text\n   * @returns {boolean}\n   */\n  is_likely_english(text) {\n    const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len0 = WASM_VECTOR_LEN;\n    const ret = wasm.linter_is_likely_english(this.__wbg_ptr, ptr0, len0);\n    return ret !== 0;\n  }\n  /**\n   * Helper method to remove non-English text from a plain English document.\n   * @param {string} text\n   * @returns {string}\n   */\n  isolate_english(text) {\n    let deferred2_0;\n    let deferred2_1;\n    try {\n      const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n      const len0 = WASM_VECTOR_LEN;\n      const ret = wasm.linter_isolate_english(this.__wbg_ptr, ptr0, len0);\n      deferred2_0 = ret[0];\n      deferred2_1 = ret[1];\n      return getStringFromWasm0(ret[0], ret[1]);\n    } finally {\n      wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);\n    }\n  }\n  /**\n   * Get a JSON map containing the descriptions of all the linting rules, formatted as HTML.\n   * @returns {string}\n   */\n  get_lint_descriptions_html_as_json() {\n    let deferred1_0;\n    let deferred1_1;\n    try {\n      const ret = wasm.linter_get_lint_descriptions_html_as_json(this.__wbg_ptr);\n      deferred1_0 = ret[0];\n      deferred1_1 = ret[1];\n      return getStringFromWasm0(ret[0], ret[1]);\n    } finally {\n      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n    }\n  }\n  /**\n   * Get a Record containing the descriptions of all the linting rules, formatted as HTML.\n   * @returns {any}\n   */\n  get_lint_descriptions_html_as_object() {\n    const ret = wasm.linter_get_lint_descriptions_html_as_object(this.__wbg_ptr);\n    return ret;\n  }\n  /**\n   * Get a JSON map containing the descriptions of all the linting rules, formatted as Markdown.\n   * @returns {string}\n   */\n  get_lint_descriptions_as_json() {\n    let deferred1_0;\n    let deferred1_1;\n    try {\n      const ret = wasm.linter_get_lint_descriptions_as_json(this.__wbg_ptr);\n      deferred1_0 = ret[0];\n      deferred1_1 = ret[1];\n      return getStringFromWasm0(ret[0], ret[1]);\n    } finally {\n      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n    }\n  }\n  /**\n   * Get a Record containing the descriptions of all the linting rules, formatted as Markdown.\n   * @returns {any}\n   */\n  get_lint_descriptions_as_object() {\n    const ret = wasm.linter_get_lint_descriptions_as_object(this.__wbg_ptr);\n    return ret;\n  }\n  /**\n   * @returns {string}\n   */\n  get_lint_config_as_json() {\n    let deferred1_0;\n    let deferred1_1;\n    try {\n      const ret = wasm.linter_get_lint_config_as_json(this.__wbg_ptr);\n      deferred1_0 = ret[0];\n      deferred1_1 = ret[1];\n      return getStringFromWasm0(ret[0], ret[1]);\n    } finally {\n      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n    }\n  }\n  /**\n   * @param {string} json\n   */\n  set_lint_config_from_json(json) {\n    const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len0 = WASM_VECTOR_LEN;\n    const ret = wasm.linter_set_lint_config_from_json(this.__wbg_ptr, ptr0, len0);\n    if (ret[1]) {\n      throw takeFromExternrefTable0(ret[0]);\n    }\n  }\n  /**\n   * @param {bigint | null} [start_time]\n   * @param {bigint | null} [end_time]\n   * @returns {any}\n   */\n  summarize_stats(start_time, end_time) {\n    const ret = wasm.linter_summarize_stats(this.__wbg_ptr, !isLikeNone(start_time), isLikeNone(start_time) ? BigInt(0) : start_time, !isLikeNone(end_time), isLikeNone(end_time) ? BigInt(0) : end_time);\n    return ret;\n  }\n  /**\n   * @returns {any}\n   */\n  get_lint_config_as_object() {\n    const ret = wasm.linter_get_lint_config_as_object(this.__wbg_ptr);\n    return ret;\n  }\n  /**\n   * @param {any} object\n   */\n  set_lint_config_from_object(object) {\n    const ret = wasm.linter_set_lint_config_from_object(this.__wbg_ptr, object);\n    if (ret[1]) {\n      throw takeFromExternrefTable0(ret[0]);\n    }\n  }\n  /**\n   * @param {string} source_text\n   * @param {Lint} lint\n   */\n  ignore_lint(source_text, lint) {\n    const ptr0 = passStringToWasm0(source_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len0 = WASM_VECTOR_LEN;\n    _assertClass(lint, Lint);\n    var ptr1 = lint.__destroy_into_raw();\n    wasm.linter_ignore_lint(this.__wbg_ptr, ptr0, len0, ptr1);\n  }\n  /**\n   * Add a specific context hash to the ignored lints list.\n   * @param {bigint} hash\n   */\n  ignore_hash(hash) {\n    wasm.linter_ignore_hash(this.__wbg_ptr, hash);\n  }\n  /**\n   * Compute the context hash of a given lint.\n   * @param {string} source_text\n   * @param {Lint} lint\n   * @returns {bigint}\n   */\n  context_hash(source_text, lint) {\n    const ptr0 = passStringToWasm0(source_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len0 = WASM_VECTOR_LEN;\n    _assertClass(lint, Lint);\n    const ret = wasm.linter_context_hash(this.__wbg_ptr, ptr0, len0, lint.__wbg_ptr);\n    return BigInt.asUintN(64, ret);\n  }\n  /**\n   * Perform the configured linting on the provided text.\n   * @param {string} text\n   * @param {Language} language\n   * @returns {Lint[]}\n   */\n  lint(text, language) {\n    const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len0 = WASM_VECTOR_LEN;\n    const ret = wasm.linter_lint(this.__wbg_ptr, ptr0, len0, language);\n    var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();\n    wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n    return v2;\n  }\n  /**\n   * Export the linter\'s ignored lints as a privacy-respecting JSON list of hashes.\n   * @returns {string}\n   */\n  export_ignored_lints() {\n    let deferred1_0;\n    let deferred1_1;\n    try {\n      const ret = wasm.linter_export_ignored_lints(this.__wbg_ptr);\n      deferred1_0 = ret[0];\n      deferred1_1 = ret[1];\n      return getStringFromWasm0(ret[0], ret[1]);\n    } finally {\n      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n    }\n  }\n  /**\n   * Import into the linter\'s ignored lints from a privacy-respecting JSON list of hashes.\n   * @param {string} json\n   */\n  import_ignored_lints(json) {\n    const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len0 = WASM_VECTOR_LEN;\n    const ret = wasm.linter_import_ignored_lints(this.__wbg_ptr, ptr0, len0);\n    if (ret[1]) {\n      throw takeFromExternrefTable0(ret[0]);\n    }\n  }\n  clear_ignored_lints() {\n    wasm.linter_clear_ignored_lints(this.__wbg_ptr);\n  }\n  /**\n   * Import words into the dictionary.\n   * @param {string[]} additional_words\n   */\n  import_words(additional_words) {\n    const ptr0 = passArrayJsValueToWasm0(additional_words, wasm.__wbindgen_malloc);\n    const len0 = WASM_VECTOR_LEN;\n    wasm.linter_import_words(this.__wbg_ptr, ptr0, len0);\n  }\n  /**\n   * Export words from the dictionary.\n   * Note: this will only return words previously added by [`Self::import_words`].\n   * @returns {string[]}\n   */\n  export_words() {\n    const ret = wasm.linter_export_words(this.__wbg_ptr);\n    var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();\n    wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n    return v1;\n  }\n  /**\n   * Get the dialect this struct was constructed for.\n   * @returns {Dialect}\n   */\n  get_dialect() {\n    const ret = wasm.linter_get_dialect(this.__wbg_ptr);\n    return ret;\n  }\n  /**\n   * Apply a suggestion from a given lint.\n   * This action will be logged to the Linter\'s statistics.\n   * @param {string} source_text\n   * @param {Lint} lint\n   * @param {Suggestion} suggestion\n   * @returns {string}\n   */\n  apply_suggestion(source_text, lint, suggestion) {\n    let deferred3_0;\n    let deferred3_1;\n    try {\n      const ptr0 = passStringToWasm0(source_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n      const len0 = WASM_VECTOR_LEN;\n      _assertClass(lint, Lint);\n      _assertClass(suggestion, Suggestion);\n      const ret = wasm.linter_apply_suggestion(this.__wbg_ptr, ptr0, len0, lint.__wbg_ptr, suggestion.__wbg_ptr);\n      var ptr2 = ret[0];\n      var len2 = ret[1];\n      if (ret[3]) {\n        ptr2 = 0;\n        len2 = 0;\n        throw takeFromExternrefTable0(ret[2]);\n      }\n      deferred3_0 = ptr2;\n      deferred3_1 = len2;\n      return getStringFromWasm0(ptr2, len2);\n    } finally {\n      wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);\n    }\n  }\n  /**\n   * @returns {string}\n   */\n  generate_stats_file() {\n    let deferred1_0;\n    let deferred1_1;\n    try {\n      const ret = wasm.linter_generate_stats_file(this.__wbg_ptr);\n      deferred1_0 = ret[0];\n      deferred1_1 = ret[1];\n      return getStringFromWasm0(ret[0], ret[1]);\n    } finally {\n      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n    }\n  }\n  /**\n   * @param {string} file\n   */\n  import_stats_file(file) {\n    const ptr0 = passStringToWasm0(file, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len0 = WASM_VECTOR_LEN;\n    const ret = wasm.linter_import_stats_file(this.__wbg_ptr, ptr0, len0);\n    if (ret[1]) {\n      throw takeFromExternrefTable0(ret[0]);\n    }\n  }\n}\nconst SpanFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {\n}, unregister: () => {\n} } : new FinalizationRegistry((ptr) => wasm.__wbg_span_free(ptr >>> 0, 1));\nclass Span {\n  static __wrap(ptr) {\n    ptr = ptr >>> 0;\n    const obj = Object.create(Span.prototype);\n    obj.__wbg_ptr = ptr;\n    SpanFinalization.register(obj, obj.__wbg_ptr, obj);\n    return obj;\n  }\n  __destroy_into_raw() {\n    const ptr = this.__wbg_ptr;\n    this.__wbg_ptr = 0;\n    SpanFinalization.unregister(this);\n    return ptr;\n  }\n  free() {\n    const ptr = this.__destroy_into_raw();\n    wasm.__wbg_span_free(ptr, 0);\n  }\n  /**\n   * @returns {string}\n   */\n  to_json() {\n    let deferred1_0;\n    let deferred1_1;\n    try {\n      const ret = wasm.span_to_json(this.__wbg_ptr);\n      deferred1_0 = ret[0];\n      deferred1_1 = ret[1];\n      return getStringFromWasm0(ret[0], ret[1]);\n    } finally {\n      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n    }\n  }\n  /**\n   * @param {string} json\n   * @returns {Span}\n   */\n  static from_json(json) {\n    const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len0 = WASM_VECTOR_LEN;\n    const ret = wasm.span_from_json(ptr0, len0);\n    if (ret[2]) {\n      throw takeFromExternrefTable0(ret[1]);\n    }\n    return Span.__wrap(ret[0]);\n  }\n  /**\n   * @returns {number}\n   */\n  get start() {\n    const ret = wasm.__wbg_get_span_start(this.__wbg_ptr);\n    return ret >>> 0;\n  }\n  /**\n   * @param {number} arg0\n   */\n  set start(arg0) {\n    wasm.__wbg_set_span_start(this.__wbg_ptr, arg0);\n  }\n  /**\n   * @returns {number}\n   */\n  get end() {\n    const ret = wasm.__wbg_get_span_end(this.__wbg_ptr);\n    return ret >>> 0;\n  }\n  /**\n   * @param {number} arg0\n   */\n  set end(arg0) {\n    wasm.__wbg_set_span_end(this.__wbg_ptr, arg0);\n  }\n  /**\n   * @param {number} start\n   * @param {number} end\n   * @returns {Span}\n   */\n  static new(start, end) {\n    const ret = wasm.span_new(start, end);\n    return Span.__wrap(ret);\n  }\n  /**\n   * @returns {boolean}\n   */\n  is_empty() {\n    const ret = wasm.span_is_empty(this.__wbg_ptr);\n    return ret !== 0;\n  }\n  /**\n   * @returns {number}\n   */\n  len() {\n    const ret = wasm.span_len(this.__wbg_ptr);\n    return ret >>> 0;\n  }\n}\nconst SuggestionFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {\n}, unregister: () => {\n} } : new FinalizationRegistry((ptr) => wasm.__wbg_suggestion_free(ptr >>> 0, 1));\nclass Suggestion {\n  static __wrap(ptr) {\n    ptr = ptr >>> 0;\n    const obj = Object.create(Suggestion.prototype);\n    obj.__wbg_ptr = ptr;\n    SuggestionFinalization.register(obj, obj.__wbg_ptr, obj);\n    return obj;\n  }\n  __destroy_into_raw() {\n    const ptr = this.__wbg_ptr;\n    this.__wbg_ptr = 0;\n    SuggestionFinalization.unregister(this);\n    return ptr;\n  }\n  free() {\n    const ptr = this.__destroy_into_raw();\n    wasm.__wbg_suggestion_free(ptr, 0);\n  }\n  /**\n   * @returns {string}\n   */\n  to_json() {\n    let deferred1_0;\n    let deferred1_1;\n    try {\n      const ret = wasm.suggestion_to_json(this.__wbg_ptr);\n      deferred1_0 = ret[0];\n      deferred1_1 = ret[1];\n      return getStringFromWasm0(ret[0], ret[1]);\n    } finally {\n      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n    }\n  }\n  /**\n   * @param {string} json\n   * @returns {Suggestion}\n   */\n  static from_json(json) {\n    const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len0 = WASM_VECTOR_LEN;\n    const ret = wasm.suggestion_from_json(ptr0, len0);\n    if (ret[2]) {\n      throw takeFromExternrefTable0(ret[1]);\n    }\n    return Suggestion.__wrap(ret[0]);\n  }\n  /**\n   * Get the text that is going to replace the problematic section.\n   * If [`Self::kind`] is `SuggestionKind::Remove`, this will return an empty\n   * string.\n   * @returns {string}\n   */\n  get_replacement_text() {\n    let deferred1_0;\n    let deferred1_1;\n    try {\n      const ret = wasm.suggestion_get_replacement_text(this.__wbg_ptr);\n      deferred1_0 = ret[0];\n      deferred1_1 = ret[1];\n      return getStringFromWasm0(ret[0], ret[1]);\n    } finally {\n      wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n    }\n  }\n  /**\n   * @returns {SuggestionKind}\n   */\n  kind() {\n    const ret = wasm.suggestion_kind(this.__wbg_ptr);\n    return ret;\n  }\n}\nasync function __wbg_load(module, imports) {\n  if (typeof Response === "function" && module instanceof Response) {\n    if (typeof WebAssembly.instantiateStreaming === "function") {\n      try {\n        return await WebAssembly.instantiateStreaming(module, imports);\n      } catch (e) {\n        if (module.headers.get("Content-Type") != "application/wasm") {\n          console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n", e);\n        } else {\n          throw e;\n        }\n      }\n    }\n    const bytes = await module.arrayBuffer();\n    return await WebAssembly.instantiate(bytes, imports);\n  } else {\n    const instance = await WebAssembly.instantiate(module, imports);\n    if (instance instanceof WebAssembly.Instance) {\n      return { instance, module };\n    } else {\n      return instance;\n    }\n  }\n}\nfunction __wbg_get_imports() {\n  const imports = {};\n  imports.wbg = {};\n  imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {\n    const ret = String(arg1);\n    const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len1 = WASM_VECTOR_LEN;\n    getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n    getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n  };\n  imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {\n    const ret = arg0.buffer;\n    return ret;\n  };\n  imports.wbg.__wbg_call_672a4d21634d4a24 = function() {\n    return handleError(function(arg0, arg1) {\n      const ret = arg0.call(arg1);\n      return ret;\n    }, arguments);\n  };\n  imports.wbg.__wbg_done_769e5ede4b31c67b = function(arg0) {\n    const ret = arg0.done;\n    return ret;\n  };\n  imports.wbg.__wbg_entries_3265d4158b33e5dc = function(arg0) {\n    const ret = Object.entries(arg0);\n    return ret;\n  };\n  imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {\n    let deferred0_0;\n    let deferred0_1;\n    try {\n      deferred0_0 = arg0;\n      deferred0_1 = arg1;\n      console.error(getStringFromWasm0(arg0, arg1));\n    } finally {\n      wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);\n    }\n  };\n  imports.wbg.__wbg_getRandomValues_38097e921c2494c3 = function() {\n    return handleError(function(arg0, arg1) {\n      globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));\n    }, arguments);\n  };\n  imports.wbg.__wbg_getTime_46267b1c24877e30 = function(arg0) {\n    const ret = arg0.getTime();\n    return ret;\n  };\n  imports.wbg.__wbg_get_67b2ba62fc30de12 = function() {\n    return handleError(function(arg0, arg1) {\n      const ret = Reflect.get(arg0, arg1);\n      return ret;\n    }, arguments);\n  };\n  imports.wbg.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {\n    const ret = arg0[arg1 >>> 0];\n    return ret;\n  };\n  imports.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {\n    let result;\n    try {\n      result = arg0 instanceof ArrayBuffer;\n    } catch (_) {\n      result = false;\n    }\n    const ret = result;\n    return ret;\n  };\n  imports.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {\n    let result;\n    try {\n      result = arg0 instanceof Uint8Array;\n    } catch (_) {\n      result = false;\n    }\n    const ret = result;\n    return ret;\n  };\n  imports.wbg.__wbg_iterator_9a24c88df860dc65 = function() {\n    const ret = Symbol.iterator;\n    return ret;\n  };\n  imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {\n    const ret = arg0.length;\n    return ret;\n  };\n  imports.wbg.__wbg_length_e2d2a49132c1b256 = function(arg0) {\n    const ret = arg0.length;\n    return ret;\n  };\n  imports.wbg.__wbg_lint_new = function(arg0) {\n    const ret = Lint.__wrap(arg0);\n    return ret;\n  };\n  imports.wbg.__wbg_log_0cc1b7768397bcfe = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {\n    let deferred0_0;\n    let deferred0_1;\n    try {\n      deferred0_0 = arg0;\n      deferred0_1 = arg1;\n      console.log(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5), getStringFromWasm0(arg6, arg7));\n    } finally {\n      wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);\n    }\n  };\n  imports.wbg.__wbg_log_cb9e190acc5753fb = function(arg0, arg1) {\n    let deferred0_0;\n    let deferred0_1;\n    try {\n      deferred0_0 = arg0;\n      deferred0_1 = arg1;\n      console.log(getStringFromWasm0(arg0, arg1));\n    } finally {\n      wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);\n    }\n  };\n  imports.wbg.__wbg_mark_7438147ce31e9d4b = function(arg0, arg1) {\n    performance.mark(getStringFromWasm0(arg0, arg1));\n  };\n  imports.wbg.__wbg_measure_fb7825c11612c823 = function() {\n    return handleError(function(arg0, arg1, arg2, arg3) {\n      let deferred0_0;\n      let deferred0_1;\n      let deferred1_0;\n      let deferred1_1;\n      try {\n        deferred0_0 = arg0;\n        deferred0_1 = arg1;\n        deferred1_0 = arg2;\n        deferred1_1 = arg3;\n        performance.measure(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));\n      } finally {\n        wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);\n        wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n      }\n    }, arguments);\n  };\n  imports.wbg.__wbg_new0_f788a2397c7ca929 = function() {\n    const ret = /* @__PURE__ */ new Date();\n    return ret;\n  };\n  imports.wbg.__wbg_new_405e22f390576ce2 = function() {\n    const ret = new Object();\n    return ret;\n  };\n  imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {\n    const ret = /* @__PURE__ */ new Map();\n    return ret;\n  };\n  imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {\n    const ret = new Error();\n    return ret;\n  };\n  imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {\n    const ret = new Uint8Array(arg0);\n    return ret;\n  };\n  imports.wbg.__wbg_next_25feadfc0913fea9 = function(arg0) {\n    const ret = arg0.next;\n    return ret;\n  };\n  imports.wbg.__wbg_next_6574e1a8a62d1055 = function() {\n    return handleError(function(arg0) {\n      const ret = arg0.next();\n      return ret;\n    }, arguments);\n  };\n  imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {\n    arg0[arg1] = arg2;\n  };\n  imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {\n    arg0.set(arg1, arg2 >>> 0);\n  };\n  imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) {\n    const ret = arg0.set(arg1, arg2);\n    return ret;\n  };\n  imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {\n    const ret = arg1.stack;\n    const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len1 = WASM_VECTOR_LEN;\n    getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n    getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n  };\n  imports.wbg.__wbg_suggestion_new = function(arg0) {\n    const ret = Suggestion.__wrap(arg0);\n    return ret;\n  };\n  imports.wbg.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {\n    const ret = arg0.value;\n    return ret;\n  };\n  imports.wbg.__wbindgen_boolean_get = function(arg0) {\n    const v = arg0;\n    const ret = typeof v === "boolean" ? v ? 1 : 0 : 2;\n    return ret;\n  };\n  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {\n    const ret = debugString(arg1);\n    const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len1 = WASM_VECTOR_LEN;\n    getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n    getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n  };\n  imports.wbg.__wbindgen_error_new = function(arg0, arg1) {\n    const ret = new Error(getStringFromWasm0(arg0, arg1));\n    return ret;\n  };\n  imports.wbg.__wbindgen_init_externref_table = function() {\n    const table = wasm.__wbindgen_export_4;\n    const offset = table.grow(4);\n    table.set(0, void 0);\n    table.set(offset + 0, void 0);\n    table.set(offset + 1, null);\n    table.set(offset + 2, true);\n    table.set(offset + 3, false);\n  };\n  imports.wbg.__wbindgen_is_function = function(arg0) {\n    const ret = typeof arg0 === "function";\n    return ret;\n  };\n  imports.wbg.__wbindgen_is_object = function(arg0) {\n    const val = arg0;\n    const ret = typeof val === "object" && val !== null;\n    return ret;\n  };\n  imports.wbg.__wbindgen_is_string = function(arg0) {\n    const ret = typeof arg0 === "string";\n    return ret;\n  };\n  imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {\n    const ret = arg0 == arg1;\n    return ret;\n  };\n  imports.wbg.__wbindgen_memory = function() {\n    const ret = wasm.memory;\n    return ret;\n  };\n  imports.wbg.__wbindgen_number_get = function(arg0, arg1) {\n    const obj = arg1;\n    const ret = typeof obj === "number" ? obj : void 0;\n    getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);\n    getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);\n  };\n  imports.wbg.__wbindgen_number_new = function(arg0) {\n    const ret = arg0;\n    return ret;\n  };\n  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {\n    const obj = arg1;\n    const ret = typeof obj === "string" ? obj : void 0;\n    var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    var len1 = WASM_VECTOR_LEN;\n    getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n    getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n  };\n  imports.wbg.__wbindgen_string_new = function(arg0, arg1) {\n    const ret = getStringFromWasm0(arg0, arg1);\n    return ret;\n  };\n  imports.wbg.__wbindgen_throw = function(arg0, arg1) {\n    throw new Error(getStringFromWasm0(arg0, arg1));\n  };\n  return imports;\n}\nfunction __wbg_finalize_init(instance, module) {\n  wasm = instance.exports;\n  __wbg_init.__wbindgen_wasm_module = module;\n  cachedDataViewMemory0 = null;\n  cachedUint8ArrayMemory0 = null;\n  wasm.__wbindgen_start();\n  return wasm;\n}\nfunction initSync(module) {\n  if (wasm !== void 0) return wasm;\n  if (typeof module !== "undefined") {\n    if (Object.getPrototypeOf(module) === Object.prototype) {\n      ({ module } = module);\n    } else {\n      console.warn("using deprecated parameters for `initSync()`; pass a single object instead");\n    }\n  }\n  const imports = __wbg_get_imports();\n  if (!(module instanceof WebAssembly.Module)) {\n    module = new WebAssembly.Module(module);\n  }\n  const instance = new WebAssembly.Instance(module, imports);\n  return __wbg_finalize_init(instance, module);\n}\nasync function __wbg_init(module_or_path) {\n  if (wasm !== void 0) return wasm;\n  if (typeof module_or_path !== "undefined") {\n    if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n      ({ module_or_path } = module_or_path);\n    } else {\n      console.warn("using deprecated parameters for the initialization function; pass a single object instead");\n    }\n  }\n  if (typeof module_or_path === "undefined") {\n    module_or_path = new URL();\n  }\n  const imports = __wbg_get_imports();\n  if (typeof module_or_path === "string" || typeof Request === "function" && module_or_path instanceof Request || typeof URL === "function" && module_or_path instanceof URL) {\n    module_or_path = fetch(module_or_path);\n  }\n  const { instance, module } = await __wbg_load(await module_or_path, imports);\n  return __wbg_finalize_init(instance, module);\n}\nvar harper_wasm = /* @__PURE__ */ Object.freeze({\n  __proto__: null,\n  Dialect,\n  Language,\n  Lint,\n  Linter,\n  Span,\n  Suggestion,\n  SuggestionKind,\n  default: __wbg_init,\n  get_default_lint_config,\n  get_default_lint_config_as_json,\n  initSync,\n  setup,\n  to_title_case\n});\nconst _PLazy = class _PLazy extends Promise {\n  constructor(executor) {\n    super((resolve) => {\n      resolve();\n    });\n    __privateAdd(this, _executor);\n    __privateAdd(this, _promise);\n    __privateSet(this, _executor, executor);\n  }\n  static from(function_) {\n    return new _PLazy((resolve) => {\n      resolve(function_());\n    });\n  }\n  static resolve(value) {\n    return new _PLazy((resolve) => {\n      resolve(value);\n    });\n  }\n  static reject(error) {\n    return new _PLazy((resolve, reject) => {\n      reject(error);\n    });\n  }\n  then(onFulfilled, onRejected) {\n    __privateGet(this, _promise) ?? __privateSet(this, _promise, new Promise(__privateGet(this, _executor)));\n    return __privateGet(this, _promise).then(onFulfilled, onRejected);\n  }\n  catch(onRejected) {\n    __privateGet(this, _promise) ?? __privateSet(this, _promise, new Promise(__privateGet(this, _executor)));\n    return __privateGet(this, _promise).catch(onRejected);\n  }\n  finally(onFinally) {\n    __privateGet(this, _promise) ?? __privateSet(this, _promise, new Promise(__privateGet(this, _executor)));\n    return __privateGet(this, _promise).finally(onFinally);\n  }\n};\n_executor = new WeakMap();\n_promise = new WeakMap();\nlet PLazy = _PLazy;\nconst copyProperty = (to, from, property, ignoreNonConfigurable) => {\n  if (property === "length" || property === "prototype") {\n    return;\n  }\n  if (property === "arguments" || property === "caller") {\n    return;\n  }\n  const toDescriptor = Object.getOwnPropertyDescriptor(to, property);\n  const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);\n  if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {\n    return;\n  }\n  Object.defineProperty(to, property, fromDescriptor);\n};\nconst canCopyProperty = function(toDescriptor, fromDescriptor) {\n  return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);\n};\nconst changePrototype = (to, from) => {\n  const fromPrototype = Object.getPrototypeOf(from);\n  if (fromPrototype === Object.getPrototypeOf(to)) {\n    return;\n  }\n  Object.setPrototypeOf(to, fromPrototype);\n};\nconst wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\n${fromBody}`;\nconst toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");\nconst toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");\nconst changeToString = (to, from, name) => {\n  const withName = name === "" ? "" : `with ${name.trim()}() `;\n  const newToString = wrappedToString.bind(null, withName, from.toString());\n  Object.defineProperty(newToString, "name", toStringName);\n  Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString });\n};\nfunction mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {\n  const { name } = to;\n  for (const property of Reflect.ownKeys(from)) {\n    copyProperty(to, from, property, ignoreNonConfigurable);\n  }\n  changePrototype(to, from);\n  changeToString(to, from, name);\n  return to;\n}\nconst cacheStore = /* @__PURE__ */ new WeakMap();\nfunction pMemoize(fn, { cacheKey = ([firstArgument]) => firstArgument, cache = /* @__PURE__ */ new Map() } = {}) {\n  const promiseCache = /* @__PURE__ */ new Map();\n  const memoized = function(...arguments_) {\n    const key = cacheKey(arguments_);\n    if (promiseCache.has(key)) {\n      return promiseCache.get(key);\n    }\n    const promise = (async () => {\n      try {\n        if (cache && await cache.has(key)) {\n          return await cache.get(key);\n        }\n        const promise2 = fn.apply(this, arguments_);\n        const result = await promise2;\n        try {\n          return result;\n        } finally {\n          if (cache) {\n            await cache.set(key, result);\n          }\n        }\n      } finally {\n        promiseCache.delete(key);\n      }\n    })();\n    promiseCache.set(key, promise);\n    return promise;\n  };\n  mimicFunction(memoized, fn, {\n    ignoreNonConfigurable: true\n  });\n  cacheStore.set(memoized, cache);\n  return memoized;\n}\nfunction assert(condition, message) {\n  if (!condition) {\n    throw new Error("Assertion failed");\n  }\n}\nconst loadBinary = pMemoize(async (binary2) => {\n  const exports = await Promise.resolve().then(function() {\n    return harper_wasm;\n  });\n  let input;\n  if (typeof process !== "undefined" && binary2.startsWith("file://")) {\n    const fs = await Promise.resolve().then(function() {\n      return __viteBrowserExternal$1;\n    });\n    input = new Promise((resolve, reject) => {\n      fs.readFile(new URL(binary2).pathname, (err, data) => {\n        if (err) reject(err);\n        resolve(data);\n      });\n    });\n  } else {\n    input = binary2;\n  }\n  await exports.default({ module_or_path: input });\n  return exports;\n});\nfunction isSerializedRequest(v) {\n  return typeof v === "object" && v !== null && "procName" in v && "args" in v;\n}\nclass BinaryModule {\n  constructor(url) {\n    __publicField(this, "url");\n    __publicField(this, "inner");\n    this.url = url;\n    this.inner = PLazy.from(\n      () => loadBinary(typeof this.url === "string" ? this.url : this.url.href)\n    );\n  }\n  async getDefaultLintConfigAsJSON() {\n    const exported = await this.inner;\n    return exported.get_default_lint_config_as_json();\n  }\n  async getDefaultLintConfig() {\n    const exported = await this.inner;\n    return exported.get_default_lint_config();\n  }\n  async toTitleCase(text) {\n    const exported = await this.inner;\n    return exported.to_title_case(text);\n  }\n  async setup() {\n    const exported = await this.inner;\n    exported.setup();\n  }\n  async createLinter(dialect) {\n    const exported = await this.inner;\n    return exported.Linter.new(dialect ?? Dialect.American);\n  }\n  async serializeArg(arg) {\n    const { Lint: Lint2, Span: Span2, Suggestion: Suggestion2 } = await this.inner;\n    if (Array.isArray(arg)) {\n      return {\n        json: JSON.stringify(await Promise.all(arg.map((a) => this.serializeArg(a)))),\n        type: "Array"\n      };\n    }\n    const argType = typeof arg;\n    switch (argType) {\n      case "string":\n      case "number":\n      case "boolean":\n      case "undefined":\n        return { json: JSON.stringify(arg), type: argType };\n      case "bigint":\n        return { json: arg.toString(), type: argType };\n    }\n    if (arg.to_json !== void 0) {\n      const json = arg.to_json();\n      let type;\n      if (arg instanceof Lint2) {\n        type = "Lint";\n      } else if (arg instanceof Suggestion2) {\n        type = "Suggestion";\n      } else if (arg instanceof Span2) {\n        type = "Span";\n      }\n      if (type === void 0) {\n        throw new Error("Unhandled case: type undefined");\n      }\n      return { json, type };\n    }\n    if (argType == "object") {\n      return { json: JSON.stringify(arg), type: "object" };\n    }\n    throw new Error(`Unhandled case: ${arg}`);\n  }\n  async serialize(req) {\n    return {\n      procName: req.procName,\n      args: await Promise.all(req.args.map((arg) => this.serializeArg(arg)))\n    };\n  }\n  async deserializeArg(requestArg) {\n    const { Lint: Lint2, Span: Span2, Suggestion: Suggestion2 } = await this.inner;\n    switch (requestArg.type) {\n      case "bigint":\n        return BigInt(requestArg.json);\n      case "undefined":\n        return void 0;\n      case "boolean":\n      case "number":\n      case "string":\n        return JSON.parse(requestArg.json);\n      case "Suggestion":\n        return Suggestion2.from_json(requestArg.json);\n      case "Lint":\n        return Lint2.from_json(requestArg.json);\n      case "Span":\n        return Span2.from_json(requestArg.json);\n      case "Array": {\n        const parsed = JSON.parse(requestArg.json);\n        assert(Array.isArray(parsed));\n        return await Promise.all(parsed.map((arg) => this.deserializeArg(arg)));\n      }\n      case "object": {\n        const parsed = JSON.parse(requestArg.json);\n        return parsed;\n      }\n      default:\n        throw new Error(`Unhandled case: ${requestArg.type}`);\n    }\n  }\n  async deserialize(request) {\n    return {\n      procName: request.procName,\n      args: await Promise.all(request.args.map((arg) => this.deserializeArg(arg)))\n    };\n  }\n}\nclass LocalLinter {\n  constructor(init) {\n    __publicField(this, "binary");\n    __publicField(this, "inner");\n    this.binary = init.binary;\n    this.inner = this.createInner(init.dialect);\n  }\n  createInner(dialect) {\n    return PLazy.from(async () => {\n      await this.binary.setup();\n      return this.binary.createLinter(dialect);\n    });\n  }\n  async setup() {\n    await this.lint("", { language: "plaintext" });\n    const exported = await this.exportIgnoredLints();\n    await this.importIgnoredLints(exported);\n  }\n  async lint(text, options) {\n    const inner = await this.inner;\n    const language = (options == null ? void 0 : options.language) === "plaintext" ? Language.Plain : Language.Markdown;\n    const lints = inner.lint(text, language);\n    return lints;\n  }\n  async applySuggestion(text, lint, suggestion) {\n    const inner = await this.inner;\n    return inner.apply_suggestion(text, lint, suggestion);\n  }\n  async isLikelyEnglish(text) {\n    const inner = await this.inner;\n    return inner.is_likely_english(text);\n  }\n  async isolateEnglish(text) {\n    const inner = await this.inner;\n    return inner.isolate_english(text);\n  }\n  async getLintConfig() {\n    const inner = await this.inner;\n    return inner.get_lint_config_as_object();\n  }\n  async getDefaultLintConfigAsJSON() {\n    return this.binary.getDefaultLintConfigAsJSON();\n  }\n  async getDefaultLintConfig() {\n    return this.binary.getDefaultLintConfig();\n  }\n  async setLintConfig(config) {\n    const inner = await this.inner;\n    inner.set_lint_config_from_object(config);\n  }\n  async getLintConfigAsJSON() {\n    const inner = await this.inner;\n    return inner.get_lint_config_as_json();\n  }\n  async setLintConfigWithJSON(config) {\n    const inner = await this.inner;\n    inner.set_lint_config_from_json(config);\n  }\n  async toTitleCase(text) {\n    return this.binary.toTitleCase(text);\n  }\n  async getLintDescriptions() {\n    const inner = await this.inner;\n    return inner.get_lint_descriptions_as_object();\n  }\n  async getLintDescriptionsAsJSON() {\n    const inner = await this.inner;\n    return inner.get_lint_descriptions_as_json();\n  }\n  async getLintDescriptionsHTML() {\n    const inner = await this.inner;\n    return inner.get_lint_descriptions_html_as_object();\n  }\n  async getLintDescriptionsHTMLAsJSON() {\n    const inner = await this.inner;\n    return inner.get_lint_descriptions_html_as_json();\n  }\n  async ignoreLint(source, lint) {\n    const inner = await this.inner;\n    inner.ignore_lint(source, lint);\n  }\n  async ignoreLintHash(hash) {\n    const inner = await this.inner;\n    inner.ignore_hash(hash);\n  }\n  async exportIgnoredLints() {\n    const inner = await this.inner;\n    return inner.export_ignored_lints();\n  }\n  async importIgnoredLints(json) {\n    const inner = await this.inner;\n    inner.import_ignored_lints(json);\n  }\n  async contextHash(source, lint) {\n    const inner = await this.inner;\n    return inner.context_hash(source, lint);\n  }\n  async clearIgnoredLints() {\n    const inner = await this.inner;\n    inner.clear_ignored_lints();\n  }\n  async importWords(words) {\n    const inner = await this.inner;\n    return inner.import_words(words);\n  }\n  async exportWords() {\n    const inner = await this.inner;\n    return inner.export_words();\n  }\n  async getDialect() {\n    const inner = await this.inner;\n    return inner.get_dialect();\n  }\n  async setDialect(dialect) {\n    const inner = await this.inner;\n    if (inner.get_dialect() !== dialect) {\n      this.inner = this.createInner(dialect);\n    }\n    return Promise.resolve();\n  }\n  async summarizeStats(start, end) {\n    const inner = await this.inner;\n    return inner.summarize_stats(start, end);\n  }\n  async generateStatsFile() {\n    const inner = await this.inner;\n    return inner.generate_stats_file();\n  }\n  async importStatsFile(statsFile) {\n    const inner = await this.inner;\n    return inner.import_stats_file(statsFile);\n  }\n}\nself.postMessage("ready");\nself.onmessage = (e) => {\n  const [binaryUrl, dialect] = e.data;\n  if (typeof binaryUrl !== "string") {\n    throw new TypeError(`Expected binary to be a string of url but got ${typeof binaryUrl}.`);\n  }\n  const binary = new BinaryModule(binaryUrl);\n  const linter = new LocalLinter({ binary, dialect });\n  async function processRequest(v) {\n    const { procName, args } = await binary.deserialize(v);\n    if (procName in linter) {\n      const res = await linter[procName](...args);\n      postMessage(await binary.serializeArg(res));\n    }\n  }\n  self.onmessage = (e2) => {\n    if (isSerializedRequest(e2.data)) {\n      processRequest(e2.data);\n    }\n  };\n};\nvar __viteBrowserExternal = {};\nvar __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze({\n  __proto__: null,\n  default: __viteBrowserExternal\n});\n';
const blob = typeof self !== "undefined" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", jsContent], { type: "text/javascript;charset=utf-8" });
function WorkerWrapper(options) {
  let objURL;
  try {
    objURL = blob && (self.URL || self.webkitURL).createObjectURL(blob);
    if (!objURL) throw "";
    const worker = new Worker(objURL, {
      type: "module",
      name: options == null ? void 0 : options.name
    });
    worker.addEventListener("error", () => {
      (self.URL || self.webkitURL).revokeObjectURL(objURL);
    });
    return worker;
  } catch (e) {
    return new Worker(
      "data:text/javascript;charset=utf-8," + encodeURIComponent(jsContent),
      {
        type: "module",
        name: options == null ? void 0 : options.name
      }
    );
  }
}
class WorkerLinter {
  constructor(init) {
    __publicField(this, "binary");
    __publicField(this, "dialect");
    __publicField(this, "worker");
    __publicField(this, "requestQueue");
    __publicField(this, "working", true);
    this.binary = init.binary;
    this.dialect = init.dialect;
    this.worker = new WorkerWrapper();
    this.requestQueue = [];
    this.worker.onmessage = () => {
      this.setupMainEventListeners();
      this.worker.postMessage([this.binary.url, this.dialect]);
      this.working = false;
      this.submitRemainingRequests();
    };
  }
  setupMainEventListeners() {
    this.worker.onmessage = (e) => {
      const { resolve } = this.requestQueue.shift();
      this.binary.deserializeArg(e.data).then((v) => {
        resolve(v);
        this.working = false;
        this.submitRemainingRequests();
      });
    };
    this.worker.onmessageerror = (e) => {
      const { reject } = this.requestQueue.shift();
      reject(e.data);
      this.working = false;
      this.submitRemainingRequests();
    };
  }
  setup() {
    return this.rpc("setup", []);
  }
  lint(text, options) {
    return this.rpc("lint", [text, options]);
  }
  applySuggestion(text, lint, suggestion) {
    return this.rpc("applySuggestion", [text, lint, suggestion]);
  }
  isLikelyEnglish(text) {
    return this.rpc("isLikelyEnglish", [text]);
  }
  isolateEnglish(text) {
    return this.rpc("isolateEnglish", [text]);
  }
  async getLintConfig() {
    return JSON.parse(await this.getLintConfigAsJSON());
  }
  setLintConfig(config) {
    return this.setLintConfigWithJSON(JSON.stringify(config));
  }
  getLintConfigAsJSON() {
    return this.rpc("getLintConfigAsJSON", []);
  }
  setLintConfigWithJSON(config) {
    return this.rpc("setLintConfigWithJSON", [config]);
  }
  toTitleCase(text) {
    return this.rpc("toTitleCase", [text]);
  }
  getLintDescriptionsAsJSON() {
    return this.rpc("getLintDescriptionsAsJSON", []);
  }
  async getLintDescriptions() {
    return JSON.parse(await this.getLintDescriptionsAsJSON());
  }
  getLintDescriptionsHTMLAsJSON() {
    return this.rpc("getLintDescriptionsHTMLAsJSON", []);
  }
  async getLintDescriptionsHTML() {
    return JSON.parse(await this.getLintDescriptionsHTMLAsJSON());
  }
  getDefaultLintConfigAsJSON() {
    return this.rpc("getDefaultLintConfigAsJSON", []);
  }
  async getDefaultLintConfig() {
    return JSON.parse(await this.getDefaultLintConfigAsJSON());
  }
  ignoreLint(source, lint) {
    return this.rpc("ignoreLint", [source, lint]);
  }
  ignoreLintHash(hash) {
    return this.rpc("ignoreLintHash", [hash]);
  }
  exportIgnoredLints() {
    return this.rpc("exportIgnoredLints", []);
  }
  importIgnoredLints(json) {
    return this.rpc("importIgnoredLints", [json]);
  }
  contextHash(source, lint) {
    return this.rpc("contextHash", [source, lint]);
  }
  clearIgnoredLints() {
    return this.rpc("clearIgnoredLints", []);
  }
  importWords(words) {
    return this.rpc("importWords", [words]);
  }
  exportWords() {
    return this.rpc("exportWords", []);
  }
  getDialect() {
    return this.rpc("getDialect", []);
  }
  setDialect(dialect) {
    return this.rpc("setDialect", [dialect]);
  }
  summarizeStats(start, end) {
    return this.rpc("summarizeStats", [start, end]);
  }
  generateStatsFile() {
    return this.rpc("generateStatsFile", []);
  }
  importStatsFile(statsFile) {
    return this.rpc("importStatsFile", [statsFile]);
  }
  /** Run a procedure on the remote worker. */
  async rpc(procName, args) {
    const promise = new Promise((resolve, reject) => {
      this.requestQueue.push({
        resolve,
        reject,
        request: { procName, args }
      });
      this.submitRemainingRequests();
    });
    return promise;
  }
  async submitRemainingRequests() {
    if (this.working) {
      return;
    }
    this.working = true;
    if (this.requestQueue.length > 0) {
      const { request } = this.requestQueue[0];
      const serialized = await this.binary.serialize(request);
      this.worker.postMessage(serialized);
    } else {
      this.working = false;
    }
  }
}
export {
  BinaryModule,
  Dialect,
  LocalLinter,
  SuggestionKind,
  WorkerLinter,
  binary,
  binaryInlined,
  isSerializedRequest
};
