{"version":3,"file":"index.mjs","names":[],"sources":["../src/BitSet.ts","../src/Chunk.ts","../src/SourceMap.ts","../src/utils/getLocator.ts","../src/utils/getRelativePath.ts","../src/utils/guessIndent.ts","../src/utils/isObject.ts","../src/utils/Mappings.ts","../src/MagicString.ts","../src/Bundle.ts"],"sourcesContent":["export default class BitSet {\n  declare bits: number[]\n\n  constructor(arg?: BitSet) {\n    this.bits = arg instanceof BitSet ? arg.bits.slice() : []\n  }\n\n  add(n: number): void {\n    this.bits[n >> 5] |= 1 << (n & 31)\n  }\n\n  has(n: number): boolean {\n    return !!(this.bits[n >> 5] & (1 << (n & 31)))\n  }\n}\n","declare const DEBUG: boolean\n\nexport default class Chunk {\n  declare start: number\n  declare end: number\n  declare original: string\n  declare intro: string\n  declare outro: string\n  declare content: string\n  declare storeName: boolean | undefined\n  declare edited: boolean\n  declare previous: Chunk | null\n  declare next: Chunk | null\n\n  constructor(start: number, end: number, content: string) {\n    this.start = start\n    this.end = end\n    this.original = content\n\n    this.intro = ''\n    this.outro = ''\n\n    this.content = content\n    this.storeName = false\n    this.edited = false\n\n    if (DEBUG) {\n      // we make these non-enumerable, for sanity while debugging\n      Object.defineProperties(this, {\n        previous: { writable: true, value: null },\n        next: { writable: true, value: null },\n      })\n    }\n    else {\n      this.previous = null\n      this.next = null\n    }\n  }\n\n  appendLeft(content: string): void {\n    this.outro += content\n  }\n\n  appendRight(content: string): void {\n    this.intro = this.intro + content\n  }\n\n  clone(): Chunk {\n    const chunk = new Chunk(this.start, this.end, this.original)\n\n    chunk.intro = this.intro\n    chunk.outro = this.outro\n    chunk.content = this.content\n    chunk.storeName = this.storeName\n    chunk.edited = this.edited\n\n    return chunk\n  }\n\n  contains(index: number): boolean {\n    return this.start < index && index < this.end\n  }\n\n  eachNext(fn: (chunk: Chunk) => void): void {\n    fn(this)\n\n    let chunk = this.next\n    while (chunk) {\n      fn(chunk)\n      chunk = chunk.next\n    }\n  }\n\n  eachPrevious(fn: (chunk: Chunk) => void): void {\n    fn(this)\n\n    let chunk = this.previous\n    while (chunk) {\n      fn(chunk)\n      chunk = chunk.previous\n    }\n  }\n\n  edit(content: string, storeName?: boolean, contentOnly?: boolean): this {\n    this.content = content\n    if (!contentOnly) {\n      this.intro = ''\n      this.outro = ''\n    }\n    this.storeName = storeName\n\n    this.edited = true\n\n    return this\n  }\n\n  prependLeft(content: string): void {\n    this.outro = content + this.outro\n  }\n\n  prependRight(content: string): void {\n    this.intro = content + this.intro\n  }\n\n  reset(): void {\n    this.intro = ''\n    this.outro = ''\n    if (this.edited) {\n      this.content = this.original\n      this.storeName = false\n      this.edited = false\n    }\n  }\n\n  split(index: number): Chunk {\n    const sliceIndex = index - this.start\n\n    const originalBefore = this.original.slice(0, sliceIndex)\n    const originalAfter = this.original.slice(sliceIndex)\n\n    this.original = originalBefore\n\n    const newChunk = new Chunk(index, this.end, originalAfter)\n    newChunk.outro = this.outro\n    this.outro = ''\n\n    this.end = index\n\n    if (this.edited) {\n      // after split we should save the edit content record into the correct chunk\n      // to make sure sourcemap correct\n      // For example:\n      // '  test'.trim()\n      //     split   -> '  ' + 'test'\n      //   ✔️ edit    -> '' + 'test'\n      //   ✖️ edit    -> 'test' + ''\n      // TODO is this block necessary?...\n      newChunk.edit('', false)\n      this.content = ''\n    }\n    else {\n      this.content = originalBefore\n    }\n\n    newChunk.next = this.next\n    if (newChunk.next)\n      newChunk.next.previous = newChunk\n    newChunk.previous = this\n    this.next = newChunk\n\n    return newChunk\n  }\n\n  toString(): string {\n    return this.intro + this.content + this.outro\n  }\n\n  trimEnd(rx: RegExp): boolean | undefined {\n    this.outro = this.outro.replace(rx, '')\n    if (this.outro.length)\n      return true\n\n    const trimmed = this.content.replace(rx, '')\n\n    if (trimmed.length) {\n      if (trimmed !== this.content) {\n        this.split(this.start + trimmed.length).edit('', undefined, true)\n        if (this.edited) {\n          // save the change, if it has been edited\n          this.edit(trimmed, this.storeName, true)\n        }\n      }\n      return true\n    }\n    else {\n      this.edit('', undefined, true)\n\n      this.intro = this.intro.replace(rx, '')\n      if (this.intro.length)\n        return true\n    }\n  }\n\n  trimStart(rx: RegExp): boolean | undefined {\n    this.intro = this.intro.replace(rx, '')\n    if (this.intro.length)\n      return true\n\n    const trimmed = this.content.replace(rx, '')\n\n    if (trimmed.length) {\n      if (trimmed !== this.content) {\n        const newChunk = this.split(this.end - trimmed.length)\n        if (this.edited) {\n          // save the change, if it has been edited\n          newChunk.edit(trimmed, this.storeName, true)\n        }\n        this.edit('', undefined, true)\n      }\n      return true\n    }\n    else {\n      this.edit('', undefined, true)\n\n      this.outro = this.outro.replace(rx, '')\n      if (this.outro.length)\n        return true\n    }\n  }\n}\n","import { encode } from '@jridgewell/sourcemap-codec'\n\ntype Btoa = (str: string) => string\n\ninterface GlobalBuffer {\n  from: (str: string, encoding: 'utf-8') => {\n    toString: (encoding: 'base64') => string\n  }\n}\n\nexport interface SourceMapOptions {\n  /**\n   * Whether the mapping should be high-resolution.\n   * Hi-res mappings map every single character, meaning (for example) your devtools will always\n   * be able to pinpoint the exact location of function calls and so on.\n   * With lo-res mappings, devtools may only be able to identify the correct\n   * line - but they're quicker to generate and less bulky.\n   * You can also set `\"boundary\"` to generate a semi-hi-res mappings segmented per word boundary\n   * instead of per character, suitable for string semantics that are separated by words.\n   * If sourcemap locations have been specified with s.addSourceMapLocation(), they will be used here.\n   */\n  hires?: boolean | 'boundary'\n  /**\n   * The filename where you plan to write the sourcemap.\n   */\n  file?: string\n  /**\n   * The filename of the file containing the original source.\n   */\n  source?: string\n  /**\n   * Whether to include the original content in the map's sourcesContent array.\n   */\n  includeContent?: boolean\n}\n\nexport type SourceMapSegment\n  = | [number]\n    | [number, number, number, number]\n    | [number, number, number, number, number]\n\nexport interface DecodedSourceMap {\n  file?: string\n  sources: string[]\n  sourcesContent?: Array<string | null>\n  names: string[]\n  mappings: SourceMapSegment[][]\n  x_google_ignoreList?: number[]\n  debugId?: string\n}\n\nfunction getBtoa(): Btoa {\n  if (typeof globalThis !== 'undefined' && typeof globalThis.btoa === 'function') {\n    return str => globalThis.btoa(unescape(encodeURIComponent(str)))\n  }\n\n  const bufferKey = 'Buffer'\n  const buffer = (globalThis as typeof globalThis & Record<string, GlobalBuffer | undefined>)[bufferKey]\n  if (buffer) {\n    return str => buffer.from(str, 'utf-8').toString('base64')\n  }\n\n  return () => {\n    throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.')\n  }\n}\n\nconst btoa = /* #__PURE__ */ getBtoa()\n\nexport default class SourceMap {\n  declare version: number\n  declare file: string | undefined\n  declare sources: string[]\n  declare sourcesContent: Array<string | null> | undefined\n  declare names: string[]\n  declare mappings: string\n  declare x_google_ignoreList: number[] | undefined\n  declare debugId: string | undefined\n\n  constructor(properties: DecodedSourceMap) {\n    this.version = 3\n    this.file = properties.file\n    this.sources = properties.sources\n    this.sourcesContent = properties.sourcesContent\n    this.names = properties.names\n    this.mappings = encode(properties.mappings)\n    if (typeof properties.x_google_ignoreList !== 'undefined') {\n      this.x_google_ignoreList = properties.x_google_ignoreList\n    }\n    if (typeof properties.debugId !== 'undefined') {\n      this.debugId = properties.debugId\n    }\n  }\n\n  /**\n   * Returns the equivalent of `JSON.stringify(map)`\n   */\n  toString(): string {\n    return JSON.stringify(this)\n  }\n\n  /**\n   * Returns a DataURI containing the sourcemap. Useful for doing this sort of thing:\n   * `generateMap(options?: SourceMapOptions): SourceMap;`\n   */\n  toUrl(): string {\n    return `data:application/json;charset=utf-8;base64,${btoa(this.toString())}`\n  }\n}\n","export interface SourceLocation {\n  line: number\n  column: number\n}\n\nexport default function getLocator(source: string): (index: number) => SourceLocation {\n  const originalLines = source.split('\\n')\n  const lineOffsets = []\n\n  for (let i = 0, pos = 0; i < originalLines.length; i++) {\n    lineOffsets.push(pos)\n    pos += originalLines[i].length + 1\n  }\n\n  return function locate(index: number): SourceLocation {\n    let i = 0\n    let j = lineOffsets.length\n    while (i < j) {\n      const m = (i + j) >> 1\n      if (index < lineOffsets[m]) {\n        j = m\n      }\n      else {\n        i = m + 1\n      }\n    }\n    const line = i - 1\n    const column = index - lineOffsets[line]\n    return { line, column }\n  }\n}\n","export default function getRelativePath(from: string, to: string): string {\n  const fromParts = from.split(/[/\\\\]/)\n  const toParts = to.split(/[/\\\\]/)\n\n  fromParts.pop() // get dirname\n\n  while (fromParts[0] === toParts[0]) {\n    fromParts.shift()\n    toParts.shift()\n  }\n\n  if (fromParts.length) {\n    let i = fromParts.length\n    while (i--) fromParts[i] = '..'\n  }\n\n  return fromParts.concat(toParts).join('/')\n}\n","export default function guessIndent(code: string): string | null {\n  const lines = code.split('\\n')\n\n  const tabbed = lines.filter(line => /^\\t+/.test(line))\n  const spaced = lines.filter(line => /^ {2,}/.test(line))\n\n  if (tabbed.length === 0 && spaced.length === 0) {\n    return null\n  }\n\n  // More lines tabbed than spaced? Assume tabs, and\n  // default to tabs in the case of a tie (or nothing\n  // to go on)\n  if (tabbed.length >= spaced.length) {\n    return '\\t'\n  }\n\n  // Otherwise, we need to guess the multiple\n  const min = spaced.reduce((previous, current) => {\n    const numSpaces = /^ +/.exec(current)![0].length\n    return Math.min(numSpaces, previous)\n  }, Infinity)\n\n  return ' '.repeat(min)\n}\n","const toString = Object.prototype.toString\n\nexport default function isObject(thing: unknown): thing is Record<string, any> {\n  return toString.call(thing) === '[object Object]'\n}\n","import type BitSet from '../BitSet.ts'\nimport type Chunk from '../Chunk.ts'\nimport type { SourceMapOptions, SourceMapSegment } from '../SourceMap.ts'\nimport type { SourceLocation } from './getLocator.ts'\n\nconst wordRegex = /\\w/\n\nexport default class Mappings {\n  declare hires: SourceMapOptions['hires']\n  declare generatedCodeLine: number\n  declare generatedCodeColumn: number\n  declare raw: SourceMapSegment[][]\n  declare rawSegments: SourceMapSegment[]\n  declare pending: SourceMapSegment | null\n\n  constructor(hires: SourceMapOptions['hires']) {\n    this.hires = hires\n    this.generatedCodeLine = 0\n    this.generatedCodeColumn = 0\n    this.raw = []\n    this.rawSegments = this.raw[this.generatedCodeLine] = []\n    this.pending = null\n  }\n\n  addEdit(sourceIndex: number, content: string, loc: SourceLocation, nameIndex: number): void {\n    if (content.length) {\n      const contentLengthMinusOne = content.length - 1\n      let contentLineEnd = content.indexOf('\\n', 0)\n      let previousContentLineEnd = -1\n      // Loop through each line in the content and add a segment, but stop if the last line is empty,\n      // else code afterwards would fill one line too many\n      while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {\n        const segment: SourceMapSegment = [\n          this.generatedCodeColumn,\n          sourceIndex,\n          loc.line,\n          loc.column,\n        ]\n        if (nameIndex >= 0) {\n          segment.push(nameIndex)\n        }\n        this.rawSegments.push(segment)\n\n        this.generatedCodeLine += 1\n        this.raw[this.generatedCodeLine] = this.rawSegments = []\n        this.generatedCodeColumn = 0\n\n        previousContentLineEnd = contentLineEnd\n        contentLineEnd = content.indexOf('\\n', contentLineEnd + 1)\n      }\n\n      const segment: SourceMapSegment = [\n        this.generatedCodeColumn,\n        sourceIndex,\n        loc.line,\n        loc.column,\n      ]\n      if (nameIndex >= 0) {\n        segment.push(nameIndex)\n      }\n      this.rawSegments.push(segment)\n\n      this.advance(content.slice(previousContentLineEnd + 1))\n    }\n    else if (this.pending) {\n      this.rawSegments.push(this.pending)\n      this.advance(content)\n    }\n\n    this.pending = null\n  }\n\n  addUneditedChunk(\n    sourceIndex: number,\n    chunk: Chunk,\n    original: string,\n    loc: SourceLocation,\n    sourcemapLocations: BitSet,\n  ): void {\n    let originalCharIndex = chunk.start\n    let first = true\n    // when iterating each char, check if it's in a word boundary\n    let charInHiresBoundary = false\n\n    while (originalCharIndex < chunk.end) {\n      if (original[originalCharIndex] === '\\n') {\n        loc.line += 1\n        loc.column = 0\n        this.generatedCodeLine += 1\n        this.raw[this.generatedCodeLine] = this.rawSegments = []\n        this.generatedCodeColumn = 0\n        first = true\n        charInHiresBoundary = false\n      }\n      else {\n        if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {\n          const segment: SourceMapSegment = [\n            this.generatedCodeColumn,\n            sourceIndex,\n            loc.line,\n            loc.column,\n          ]\n\n          if (this.hires === 'boundary') {\n            // in hires \"boundary\", group segments per word boundary than per char\n            if (wordRegex.test(original[originalCharIndex])) {\n              // for first char in the boundary found, start the boundary by pushing a segment\n              if (!charInHiresBoundary) {\n                this.rawSegments.push(segment)\n                charInHiresBoundary = true\n              }\n            }\n            else {\n              // for non-word char, end the boundary by pushing a segment\n              this.rawSegments.push(segment)\n              charInHiresBoundary = false\n            }\n          }\n          else {\n            this.rawSegments.push(segment)\n          }\n        }\n\n        loc.column += 1\n        this.generatedCodeColumn += 1\n        first = false\n      }\n\n      originalCharIndex += 1\n    }\n\n    this.pending = null\n  }\n\n  advance(str: string): void {\n    if (!str)\n      return\n\n    const lines = str.split('\\n')\n\n    if (lines.length > 1) {\n      for (let i = 0; i < lines.length - 1; i++) {\n        this.generatedCodeLine++\n        this.raw[this.generatedCodeLine] = this.rawSegments = []\n      }\n      this.generatedCodeColumn = 0\n    }\n\n    this.generatedCodeColumn += lines[lines.length - 1].length\n  }\n}\n","import type { DecodedSourceMap, SourceMapOptions } from './SourceMap.ts'\nimport BitSet from './BitSet.ts'\nimport Chunk from './Chunk.ts'\nimport SourceMap from './SourceMap.ts'\nimport getLocator from './utils/getLocator.ts'\nimport getRelativePath from './utils/getRelativePath.ts'\nimport guessIndent from './utils/guessIndent.ts'\nimport isObject from './utils/isObject.ts'\nimport Mappings from './utils/Mappings.ts'\nimport Stats from './utils/Stats.ts'\n\nexport type ExclusionRange = [number, number]\n\nexport interface MagicStringOptions {\n  filename?: string\n  ignoreList?: boolean\n  indentExclusionRanges?: ExclusionRange | ExclusionRange[]\n  offset?: number\n}\n\nexport interface IndentOptions {\n  exclude?: ExclusionRange | ExclusionRange[]\n  indentStart?: boolean\n}\n\nexport interface OverwriteOptions {\n  storeName?: boolean\n  contentOnly?: boolean\n}\n\nexport interface UpdateOptions {\n  storeName?: boolean\n  overwrite?: boolean\n}\n\nexport type ReplacementFunction = (substring: string, ...args: any[]) => string\n\ndeclare const DEBUG: boolean\n\nconst n = '\\n'\nconst NEWLINE_CHAR = '\\n'.charCodeAt(0)\nconst CR_CHAR = '\\r'.charCodeAt(0)\n\nconst warned = {\n  insertLeft: false,\n  insertRight: false,\n  storeName: false,\n}\n\nexport default class MagicString {\n  declare original: string\n  /** @internal */\n  declare outro: string\n  /** @internal */\n  declare intro: string\n  /** @internal */\n  declare filename: string | undefined\n  declare indentExclusionRanges: MagicStringOptions['indentExclusionRanges']\n  /** @internal */\n  declare ignoreList: boolean | undefined\n  declare offset: number\n  /** @internal */\n  declare firstChunk: Chunk\n  /** @internal */\n  declare lastChunk: Chunk\n  /** @internal */\n  declare lastSearchedChunk: Chunk\n  /** @internal */\n  declare byStart: Record<number, Chunk>\n  /** @internal */\n  declare byEnd: Record<number, Chunk>\n  /** @internal */\n  declare sourcemapLocations: BitSet\n  /** @internal */\n  declare storedNames: Record<string, true>\n  /** @internal */\n  declare indentStr: string | null | undefined\n  /** @internal */\n  declare stats: Stats\n\n  constructor(string: string, options: MagicStringOptions = {}) {\n    const chunk = new Chunk(0, string.length, string)\n\n    Object.defineProperties(this, {\n      original: { writable: true, value: string },\n      outro: { writable: true, value: '' },\n      intro: { writable: true, value: '' },\n      firstChunk: { writable: true, value: chunk },\n      lastChunk: { writable: true, value: chunk },\n      lastSearchedChunk: { writable: true, value: chunk },\n      byStart: { writable: true, value: {} },\n      byEnd: { writable: true, value: {} },\n      filename: { writable: true, value: options.filename },\n      indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },\n      sourcemapLocations: { writable: true, value: new BitSet() },\n      storedNames: { writable: true, value: {} },\n      indentStr: { writable: true, value: undefined },\n      ignoreList: { writable: true, value: options.ignoreList },\n      offset: { writable: true, value: options.offset || 0 },\n    })\n\n    if (DEBUG) {\n      Object.defineProperty(this, 'stats', { value: new Stats() })\n    }\n\n    this.byStart[0] = chunk\n    this.byEnd[string.length] = chunk\n  }\n\n  /**\n   * Adds the specified character index (with respect to the original string) to sourcemap mappings, if `hires` is false.\n   */\n  addSourcemapLocation(char: number): void {\n    this.sourcemapLocations.add(char)\n  }\n\n  /**\n   * Appends the specified content to the end of the string.\n   */\n  append(content: string): this {\n    if (typeof content !== 'string')\n      throw new TypeError('outro content must be a string')\n\n    this.outro += content\n    return this\n  }\n\n  /**\n   * Appends the specified content at the index in the original string.\n   * If a range *ending* with index is subsequently moved, the insert will be moved with it.\n   * See also `s.prependLeft(...)`.\n   */\n  appendLeft(index: number, content: string): this {\n    index = index + this.offset\n\n    if (typeof content !== 'string')\n      throw new TypeError('inserted content must be a string')\n\n    if (DEBUG)\n      this.stats.time('appendLeft')\n\n    this._split(index)\n\n    const chunk = this.byEnd[index]\n\n    if (chunk) {\n      chunk.appendLeft(content)\n    }\n    else {\n      this.intro += content\n    }\n\n    if (DEBUG)\n      this.stats.timeEnd('appendLeft')\n    return this\n  }\n\n  /**\n   * Appends the specified content at the index in the original string.\n   * If a range *starting* with index is subsequently moved, the insert will be moved with it.\n   * See also `s.prependRight(...)`.\n   */\n  appendRight(index: number, content: string): this {\n    index = index + this.offset\n\n    if (typeof content !== 'string')\n      throw new TypeError('inserted content must be a string')\n\n    if (DEBUG)\n      this.stats.time('appendRight')\n\n    this._split(index)\n\n    const chunk = this.byStart[index]\n\n    if (chunk) {\n      chunk.appendRight(content)\n    }\n    else {\n      this.outro += content\n    }\n\n    if (DEBUG)\n      this.stats.timeEnd('appendRight')\n    return this\n  }\n\n  /**\n   * Does what you'd expect.\n   */\n  clone(): this {\n    const cloned = new MagicString(this.original, { filename: this.filename, offset: this.offset })\n\n    let originalChunk = this.firstChunk\n    let clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone())\n\n    while (originalChunk) {\n      cloned.byStart[clonedChunk.start] = clonedChunk\n      cloned.byEnd[clonedChunk.end] = clonedChunk\n\n      const nextOriginalChunk = originalChunk.next\n      const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone()\n\n      if (nextClonedChunk) {\n        clonedChunk.next = nextClonedChunk\n        nextClonedChunk.previous = clonedChunk\n\n        clonedChunk = nextClonedChunk\n      }\n\n      originalChunk = nextOriginalChunk\n    }\n\n    cloned.lastChunk = clonedChunk\n\n    if (this.indentExclusionRanges) {\n      cloned.indentExclusionRanges = this.indentExclusionRanges.slice() as\n      | ExclusionRange\n      | ExclusionRange[]\n    }\n\n    cloned.sourcemapLocations = new BitSet(this.sourcemapLocations)\n\n    cloned.intro = this.intro\n    cloned.outro = this.outro\n\n    return cloned as this\n  }\n\n  /**\n   * Generates a sourcemap object with raw mappings in array form, rather than encoded as a string.\n   * Useful if you need to manipulate the sourcemap further, but most of the time you will use `generateMap` instead.\n   */\n  generateDecodedMap(options?: SourceMapOptions): DecodedSourceMap {\n    options = options || {}\n\n    const sourceIndex = 0\n    const names = Object.keys(this.storedNames)\n    const mappings = new Mappings(options.hires)\n\n    const locate = getLocator(this.original)\n\n    if (this.intro) {\n      mappings.advance(this.intro)\n    }\n\n    this.firstChunk.eachNext((chunk) => {\n      const loc = locate(chunk.start)\n\n      if (chunk.intro.length)\n        mappings.advance(chunk.intro)\n\n      if (chunk.edited) {\n        mappings.addEdit(\n          sourceIndex,\n          chunk.content,\n          loc,\n          chunk.storeName ? names.indexOf(chunk.original) : -1,\n        )\n      }\n      else {\n        mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations)\n      }\n\n      if (chunk.outro.length)\n        mappings.advance(chunk.outro)\n    })\n\n    if (this.outro) {\n      mappings.advance(this.outro)\n    }\n\n    return {\n      file: options.file ? options.file.split(/[/\\\\]/).pop() : undefined,\n      sources: [\n        options.source ? getRelativePath(options.file || '', options.source) : options.file || '',\n      ],\n      sourcesContent: options.includeContent ? [this.original] : undefined,\n      names,\n      mappings: mappings.raw,\n      x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined,\n    }\n  }\n\n  /**\n   * Generates a version 3 sourcemap.\n   */\n  generateMap(options?: SourceMapOptions): SourceMap {\n    return new SourceMap(this.generateDecodedMap(options))\n  }\n\n  /** @internal */\n  _ensureindentStr(): void {\n    if (this.indentStr === undefined) {\n      this.indentStr = guessIndent(this.original)\n    }\n  }\n\n  /** @internal */\n  _getRawIndentString(): string | null | undefined {\n    this._ensureindentStr()\n    return this.indentStr\n  }\n\n  getIndentString(): string {\n    this._ensureindentStr()\n    return this.indentStr === null ? '\\t' : this.indentStr\n  }\n\n  /**\n   * Prefixes each line of the string with prefix.\n   * If prefix is not supplied, the indentation will be guessed from the original content, falling back to a single tab character.\n   */\n  indent(options?: IndentOptions): this\n  /**\n   * Prefixes each line of the string with prefix.\n   * If prefix is not supplied, the indentation will be guessed from the original content, falling back to a single tab character.\n   *\n   * The options argument can have an exclude property, which is an array of [start, end] character ranges.\n   * These ranges will be excluded from the indentation - useful for (e.g.) multiline strings.\n   */\n  indent(indentStr?: string, options?: IndentOptions): this\n  indent(indentStr?: string | IndentOptions, options?: IndentOptions): this {\n    const pattern = /^[^\\r\\n]/gm\n\n    if (isObject(indentStr)) {\n      options = indentStr\n      indentStr = undefined\n    }\n\n    if (indentStr === undefined) {\n      this._ensureindentStr()\n      indentStr = this.indentStr || '\\t'\n    }\n\n    if (indentStr === '')\n      return this // noop\n    const resolvedIndentStr = indentStr as string\n\n    options = options || {}\n\n    // Process exclusion ranges\n    const isExcluded: Record<number, boolean> = {}\n\n    if (options.exclude) {\n      const exclusions\n        = typeof options.exclude[0] === 'number'\n          ? [options.exclude as ExclusionRange]\n          : (options.exclude as ExclusionRange[])\n      exclusions.forEach((exclusion) => {\n        for (let i = exclusion[0]; i < exclusion[1]; i += 1) {\n          isExcluded[i] = true\n        }\n      })\n    }\n\n    let shouldIndentNextCharacter = options.indentStart !== false\n    const replacer = (match: string) => {\n      if (shouldIndentNextCharacter)\n        return `${resolvedIndentStr}${match}`\n      shouldIndentNextCharacter = true\n      return match\n    }\n\n    this.intro = this.intro.replace(pattern, replacer)\n\n    let charIndex = 0\n    let chunk = this.firstChunk\n\n    const indentAt = (index: number) => {\n      shouldIndentNextCharacter = false\n\n      if (index === chunk!.start) {\n        chunk!.prependRight(resolvedIndentStr)\n      }\n      else {\n        this._splitChunk(chunk!, index)\n        chunk = chunk!.next\n        chunk!.prependRight(resolvedIndentStr)\n      }\n    }\n\n    while (chunk) {\n      const end = chunk.end\n\n      if (chunk.edited) {\n        if (!isExcluded[charIndex]) {\n          chunk.content = chunk.content.replace(pattern, replacer)\n\n          if (chunk.content.length) {\n            shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\\n'\n          }\n        }\n      }\n      else if (options.exclude) {\n        charIndex = chunk.start\n\n        while (charIndex < end) {\n          if (!isExcluded[charIndex]) {\n            const char = this.original.charCodeAt(charIndex)\n\n            if (char === NEWLINE_CHAR) {\n              shouldIndentNextCharacter = true\n            }\n            else if (char !== CR_CHAR && shouldIndentNextCharacter) {\n              indentAt(charIndex)\n            }\n          }\n\n          charIndex += 1\n        }\n      }\n      else {\n        charIndex = chunk.start\n\n        while (charIndex < end) {\n          if (!shouldIndentNextCharacter) {\n            const nextLine = this.original.indexOf(n, charIndex)\n            if (nextLine === -1 || nextLine >= end)\n              break\n\n            shouldIndentNextCharacter = true\n            charIndex = nextLine + 1\n            continue\n          }\n\n          const char = this.original.charCodeAt(charIndex)\n\n          if (char === NEWLINE_CHAR || char === CR_CHAR) {\n            charIndex += 1\n            continue\n          }\n\n          indentAt(charIndex)\n          charIndex += 1\n        }\n      }\n\n      charIndex = chunk.end\n      chunk = chunk.next\n    }\n\n    this.outro = this.outro.replace(pattern, replacer)\n\n    return this\n  }\n\n  /** @internal */\n  insert(): never {\n    throw new Error(\n      'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)',\n    )\n  }\n\n  /** @internal */\n  insertLeft(index: number, content: string): this {\n    if (!warned.insertLeft) {\n      console.warn(\n        'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead',\n      )\n      warned.insertLeft = true\n    }\n\n    return this.appendLeft(index, content)\n  }\n\n  /** @internal */\n  insertRight(index: number, content: string): this {\n    if (!warned.insertRight) {\n      console.warn(\n        'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead',\n      )\n      warned.insertRight = true\n    }\n\n    return this.prependRight(index, content)\n  }\n\n  /**\n   * Moves the characters from `start` and `end` to `index`.\n   */\n  move(start: number, end: number, index: number): this {\n    start = start + this.offset\n    end = end + this.offset\n    index = index + this.offset\n\n    if (start === end)\n      return this\n\n    if (index >= start && index <= end)\n      throw new Error('Cannot move a selection inside itself')\n\n    if (DEBUG)\n      this.stats.time('move')\n\n    this._split(start)\n    this._split(end)\n    this._split(index)\n\n    const first = this.byStart[start]\n    const last = this.byEnd[end]\n\n    const oldLeft = first.previous\n    const oldRight = last.next\n\n    const newRight = this.byStart[index]\n    if (!newRight && last === this.lastChunk)\n      return this\n    const newLeft = newRight ? newRight.previous : this.lastChunk\n\n    if (oldLeft)\n      oldLeft.next = oldRight\n    if (oldRight)\n      oldRight.previous = oldLeft\n\n    if (newLeft)\n      newLeft.next = first\n    if (newRight)\n      newRight.previous = last\n\n    if (!first.previous)\n      this.firstChunk = last.next\n    if (!last.next) {\n      this.lastChunk = first.previous\n      this.lastChunk.next = null\n    }\n\n    first.previous = newLeft\n    last.next = newRight || null\n\n    if (!newLeft)\n      this.firstChunk = first\n    if (!newRight)\n      this.lastChunk = last\n\n    if (DEBUG)\n      this.stats.timeEnd('move')\n    return this\n  }\n\n  /**\n   * Replaces the characters from `start` to `end` with `content`, along with the appended/prepended content in\n   * that range. The same restrictions as `s.remove()` apply.\n   *\n   * The fourth argument is optional. It can have a storeName property - if true, the original name will be stored\n   * for later inclusion in a sourcemap's names array - and a contentOnly property which determines whether only\n   * the content is overwritten, or anything that was appended/prepended to the range as well.\n   *\n   * It may be preferred to use `s.update(...)` instead if you wish to avoid overwriting the appended/prepended content.\n   */\n  overwrite(\n    start: number,\n    end: number,\n    content: string,\n    options?: boolean | OverwriteOptions,\n  ): this {\n    const optionObject = typeof options === 'object' && options ? options : {}\n    return this.update(start, end, content, {\n      ...optionObject,\n      overwrite: !optionObject.contentOnly,\n    })\n  }\n\n  /**\n   * Replaces the characters from `start` to `end` with `content`. The same restrictions as `s.remove()` apply.\n   *\n   * The fourth argument is optional. It can have a storeName property - if true, the original name will be stored\n   * for later inclusion in a sourcemap's names array - and an overwrite property which determines whether only\n   * the content is overwritten, or anything that was appended/prepended to the range as well.\n   */\n  update(start: number, end: number, content: string, options?: boolean | UpdateOptions): this {\n    start = start + this.offset\n    end = end + this.offset\n\n    if (typeof content !== 'string')\n      throw new TypeError('replacement content must be a string')\n\n    if (this.original.length !== 0) {\n      while (start < 0) start += this.original.length\n      while (end < 0) end += this.original.length\n    }\n\n    if (end > this.original.length)\n      throw new Error('end is out of bounds')\n    if (start === end) {\n      throw new Error(\n        'Cannot overwrite a zero-length range – use appendLeft or prependRight instead',\n      )\n    }\n\n    if (DEBUG)\n      this.stats.time('overwrite')\n\n    this._split(start)\n    this._split(end)\n\n    if (options === true) {\n      if (!warned.storeName) {\n        console.warn(\n          'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string',\n        )\n        warned.storeName = true\n      }\n\n      options = { storeName: true }\n    }\n    const optionObject = typeof options === 'object' && options ? options : {}\n    const storeName = optionObject.storeName || false\n    const overwrite = optionObject.overwrite || false\n\n    if (storeName) {\n      const original = this.original.slice(start, end)\n      Object.defineProperty(this.storedNames, original, {\n        writable: true,\n        value: true,\n        enumerable: true,\n      })\n    }\n\n    const first = this.byStart[start]\n    const last = this.byEnd[end]\n\n    if (first) {\n      let chunk = first\n      while (chunk !== last) {\n        if (chunk.next !== this.byStart[chunk.end]) {\n          throw new Error('Cannot overwrite across a split point')\n        }\n        chunk = chunk.next\n        chunk.edit('', false)\n      }\n\n      first.edit(content, storeName, !overwrite)\n    }\n    else {\n      // must be inserting at the end\n      const newChunk = new Chunk(start, end, '').edit(content, storeName)\n\n      // TODO last chunk in the array may not be the last chunk, if it's moved...\n      last.next = newChunk\n      newChunk.previous = last\n    }\n\n    if (DEBUG)\n      this.stats.timeEnd('overwrite')\n    return this\n  }\n\n  /**\n   * Prepends the string with the specified content.\n   */\n  prepend(content: string): this {\n    if (typeof content !== 'string')\n      throw new TypeError('outro content must be a string')\n\n    this.intro = content + this.intro\n    return this\n  }\n\n  /**\n   * Same as `s.appendLeft(...)`, except that the inserted content will go *before* any previous appends or prepends at index\n   */\n  prependLeft(index: number, content: string): this {\n    index = index + this.offset\n\n    if (typeof content !== 'string')\n      throw new TypeError('inserted content must be a string')\n\n    if (DEBUG)\n      this.stats.time('insertRight')\n\n    this._split(index)\n\n    const chunk = this.byEnd[index]\n\n    if (chunk) {\n      chunk.prependLeft(content)\n    }\n    else {\n      this.intro = content + this.intro\n    }\n\n    if (DEBUG)\n      this.stats.timeEnd('insertRight')\n    return this\n  }\n\n  /**\n   * Same as `s.appendRight(...)`, except that the inserted content will go *before* any previous appends or prepends at `index`\n   */\n  prependRight(index: number, content: string): this {\n    index = index + this.offset\n\n    if (typeof content !== 'string')\n      throw new TypeError('inserted content must be a string')\n\n    if (DEBUG)\n      this.stats.time('insertRight')\n\n    this._split(index)\n\n    const chunk = this.byStart[index]\n\n    if (chunk) {\n      chunk.prependRight(content)\n    }\n    else {\n      this.outro = content + this.outro\n    }\n\n    if (DEBUG)\n      this.stats.timeEnd('insertRight')\n    return this\n  }\n\n  /**\n   * Removes the characters from `start` to `end` (of the original string, **not** the generated string).\n   * Removing the same content twice, or making removals that partially overlap, will cause an error.\n   */\n  remove(start: number, end: number): this {\n    start = start + this.offset\n    end = end + this.offset\n\n    if (this.original.length !== 0) {\n      while (start < 0) start += this.original.length\n      while (end < 0) end += this.original.length\n    }\n\n    if (start === end)\n      return this\n\n    if (start < 0 || end > this.original.length)\n      throw new Error('Character is out of bounds')\n    if (start > end)\n      throw new Error('end must be greater than start')\n\n    if (DEBUG)\n      this.stats.time('remove')\n\n    this._split(start)\n    this._split(end)\n\n    let chunk = this.byStart[start]\n\n    while (chunk) {\n      chunk.intro = ''\n      chunk.outro = ''\n      chunk.edit('')\n\n      chunk = end > chunk.end ? this.byStart[chunk.end] : null\n    }\n\n    if (DEBUG)\n      this.stats.timeEnd('remove')\n    return this\n  }\n\n  /**\n   * Reset the modified characters from `start` to `end` (of the original string, **not** the generated string).\n   */\n  reset(start: number, end: number): this {\n    start = start + this.offset\n    end = end + this.offset\n\n    if (this.original.length !== 0) {\n      while (start < 0) start += this.original.length\n      while (end < 0) end += this.original.length\n    }\n\n    if (start === end)\n      return this\n\n    if (start < 0 || end > this.original.length)\n      throw new Error('Character is out of bounds')\n    if (start > end)\n      throw new Error('end must be greater than start')\n\n    if (DEBUG)\n      this.stats.time('reset')\n\n    this._split(start)\n    this._split(end)\n\n    let chunk = this.byStart[start]\n\n    while (chunk) {\n      chunk.reset()\n\n      chunk = end > chunk.end ? this.byStart[chunk.end] : null\n    }\n\n    if (DEBUG)\n      this.stats.timeEnd('reset')\n    return this\n  }\n\n  lastChar(): string {\n    if (this.outro.length)\n      return this.outro[this.outro.length - 1]\n    let chunk: Chunk | null = this.lastChunk\n    while (chunk) {\n      if (chunk.outro.length)\n        return chunk.outro[chunk.outro.length - 1]\n      if (chunk.content.length)\n        return chunk.content[chunk.content.length - 1]\n      if (chunk.intro.length)\n        return chunk.intro[chunk.intro.length - 1]\n      chunk = chunk.previous\n    }\n    if (this.intro.length)\n      return this.intro[this.intro.length - 1]\n    return ''\n  }\n\n  lastLine(): string {\n    let lineIndex = this.outro.lastIndexOf(n)\n    if (lineIndex !== -1)\n      return this.outro.substr(lineIndex + 1)\n    let lineStr = this.outro\n    let chunk: Chunk | null = this.lastChunk\n    while (chunk) {\n      if (chunk.outro.length > 0) {\n        lineIndex = chunk.outro.lastIndexOf(n)\n        if (lineIndex !== -1)\n          return chunk.outro.substr(lineIndex + 1) + lineStr\n        lineStr = chunk.outro + lineStr\n      }\n\n      if (chunk.content.length > 0) {\n        lineIndex = chunk.content.lastIndexOf(n)\n        if (lineIndex !== -1)\n          return chunk.content.substr(lineIndex + 1) + lineStr\n        lineStr = chunk.content + lineStr\n      }\n\n      if (chunk.intro.length > 0) {\n        lineIndex = chunk.intro.lastIndexOf(n)\n        if (lineIndex !== -1)\n          return chunk.intro.substr(lineIndex + 1) + lineStr\n        lineStr = chunk.intro + lineStr\n      }\n      chunk = chunk.previous\n    }\n    lineIndex = this.intro.lastIndexOf(n)\n    if (lineIndex !== -1)\n      return this.intro.substr(lineIndex + 1) + lineStr\n    return this.intro + lineStr\n  }\n\n  /**\n   * Returns the content of the generated string that corresponds to the slice between `start` and `end` of the original string.\n   * Throws error if the indices are for characters that were already removed.\n   */\n  slice(start: number = 0, end: number = this.original.length - this.offset): string {\n    start = start + this.offset\n    end = end + this.offset\n\n    if (this.original.length !== 0) {\n      while (start < 0) start += this.original.length\n      while (end < 0) end += this.original.length\n    }\n\n    let result = ''\n\n    // find start chunk\n    let chunk = this.firstChunk\n    while (chunk && (chunk.start > start || chunk.end <= start)) {\n      // found end chunk before start\n      if (chunk.start < end && chunk.end >= end) {\n        return result\n      }\n\n      chunk = chunk.next\n    }\n\n    if (chunk && chunk.edited && chunk.start !== start)\n      throw new Error(`Cannot use replaced character ${start} as slice start anchor.`)\n\n    const startChunk = chunk\n    while (chunk) {\n      if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {\n        result += chunk.intro\n      }\n\n      const containsEnd = chunk.start < end && chunk.end >= end\n      if (containsEnd && chunk.edited && chunk.end !== end)\n        throw new Error(`Cannot use replaced character ${end} as slice end anchor.`)\n\n      const sliceStart = startChunk === chunk ? start - chunk.start : 0\n      const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length\n\n      result += chunk.content.slice(sliceStart, sliceEnd)\n\n      if (chunk.outro && (!containsEnd || chunk.end === end)) {\n        result += chunk.outro\n      }\n\n      if (containsEnd) {\n        break\n      }\n\n      chunk = chunk.next\n    }\n\n    return result\n  }\n\n  // TODO deprecate this? not really very useful\n  /**\n   * Returns a clone of `s`, with all content before the `start` and `end` characters of the original string removed.\n   */\n  snip(start: number, end: number): this {\n    const clone = this.clone()\n    clone.remove(0, start)\n    clone.remove(end, clone.original.length)\n\n    return clone\n  }\n\n  /** @internal */\n  _split(index: number): boolean | void {\n    if (this.byStart[index] || this.byEnd[index])\n      return\n\n    if (DEBUG)\n      this.stats.time('_split')\n\n    let chunk = this.lastSearchedChunk\n    let previousChunk = chunk\n    const searchForward = index > chunk.end\n\n    while (chunk) {\n      if (chunk.contains(index))\n        return this._splitChunk(chunk, index)\n\n      chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start]\n\n      // Prevent infinite loop (e.g. via empty chunks, where start === end)\n      if (chunk === previousChunk)\n        return\n\n      previousChunk = chunk\n    }\n  }\n\n  /** @internal */\n  _splitChunk(chunk: Chunk, index: number): true {\n    if (chunk.edited && chunk.content.length) {\n      // zero-length edited chunks are a special case (overlapping replacements)\n      const loc = getLocator(this.original)(index)\n      throw new Error(\n        `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – \"${chunk.original}\")`,\n      )\n    }\n\n    const newChunk = chunk.split(index)\n\n    this.byEnd[index] = chunk\n    this.byStart[index] = newChunk\n    this.byEnd[newChunk.end] = newChunk\n\n    if (chunk === this.lastChunk)\n      this.lastChunk = newChunk\n\n    this.lastSearchedChunk = chunk\n    if (DEBUG)\n      this.stats.timeEnd('_split')\n    return true\n  }\n\n  /**\n   * Returns the generated string.\n   */\n  toString(): string {\n    let str = this.intro\n\n    let chunk = this.firstChunk\n    while (chunk) {\n      str += chunk.toString()\n      chunk = chunk.next\n    }\n\n    return str + this.outro\n  }\n\n  /**\n   * Returns true if the resulting source is empty (disregarding white space).\n   */\n  isEmpty(): boolean {\n    let chunk: Chunk | null = this.firstChunk\n    while (chunk) {\n      if (\n        (chunk.intro.length && chunk.intro.trim())\n        || (chunk.content.length && chunk.content.trim())\n        || (chunk.outro.length && chunk.outro.trim())\n      ) {\n        return false\n      }\n      chunk = chunk.next\n    }\n    return true\n  }\n\n  length(): number {\n    let chunk: Chunk | null = this.firstChunk\n    let length = 0\n    while (chunk) {\n      length += chunk.intro.length + chunk.content.length + chunk.outro.length\n      chunk = chunk.next\n    }\n    return length\n  }\n\n  /**\n   * Removes empty lines from the start and end.\n   */\n  trimLines(): this {\n    return this.trim('[\\\\r\\\\n]')\n  }\n\n  /**\n   * Trims content matching `charType` (defaults to `\\s`, i.e. whitespace) from the start and end.\n   */\n  trim(charType?: string): this {\n    return this.trimStart(charType).trimEnd(charType)\n  }\n\n  /** @internal */\n  trimEndAborted(charType?: string): boolean {\n    const rx = new RegExp(`${charType || '\\\\s'}+$`)\n\n    this.outro = this.outro.replace(rx, '')\n    if (this.outro.length)\n      return true\n\n    let chunk = this.lastChunk\n\n    do {\n      const end = chunk.end\n      const aborted = chunk.trimEnd(rx)\n\n      // if chunk was trimmed, we have a new lastChunk\n      if (chunk.end !== end) {\n        if (this.lastChunk === chunk) {\n          this.lastChunk = chunk.next\n        }\n\n        this.byEnd[chunk.end] = chunk\n        this.byStart[chunk.next.start] = chunk.next\n        this.byEnd[chunk.next.end] = chunk.next\n      }\n\n      if (aborted)\n        return true\n      chunk = chunk.previous\n    } while (chunk)\n\n    return false\n  }\n\n  /**\n   * Trims content matching `charType` (defaults to `\\s`, i.e. whitespace) from the end.\n   */\n  trimEnd(charType?: string): this {\n    this.trimEndAborted(charType)\n    return this\n  }\n\n  /** @internal */\n  trimStartAborted(charType?: string): boolean {\n    const rx = new RegExp(`^${charType || '\\\\s'}+`)\n\n    this.intro = this.intro.replace(rx, '')\n    if (this.intro.length)\n      return true\n\n    let chunk = this.firstChunk\n\n    do {\n      const end = chunk.end\n      const aborted = chunk.trimStart(rx)\n\n      if (chunk.end !== end) {\n        // special case...\n        if (chunk === this.lastChunk)\n          this.lastChunk = chunk.next\n\n        this.byEnd[chunk.end] = chunk\n        this.byStart[chunk.next.start] = chunk.next\n        this.byEnd[chunk.next.end] = chunk.next\n      }\n\n      if (aborted)\n        return true\n      chunk = chunk.next\n    } while (chunk)\n\n    return false\n  }\n\n  /**\n   * Trims content matching `charType` (defaults to `\\s`, i.e. whitespace) from the start.\n   */\n  trimStart(charType?: string): this {\n    this.trimStartAborted(charType)\n    return this\n  }\n\n  /**\n   * Indicates if the string has been changed.\n   */\n  hasChanged(): boolean {\n    return this.original !== this.toString()\n  }\n\n  /** @internal */\n  _replaceRegexp(searchValue: RegExp, replacement: string | ReplacementFunction): this {\n    function getReplacement(match: RegExpMatchArray, str: string): string {\n      if (typeof replacement === 'string') {\n        return replacement.replace(/\\$(\\$|&|\\d+)/g, (_: string, i: string) => {\n          // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter\n          if (i === '$')\n            return '$'\n          if (i === '&')\n            return match[0]\n          const num = +i\n          if (num < match.length)\n            return match[+i]\n          return `$${i}`\n        })\n      }\n      else {\n        return replacement(match[0], ...match.slice(1), match.index, str, match.groups)\n      }\n    }\n    function matchAll(re: RegExp, str: string): RegExpExecArray[] {\n      const matches = []\n      while (true) {\n        const match = re.exec(str)\n        if (!match)\n          break\n\n        matches.push(match)\n      }\n      return matches\n    }\n    if (searchValue.global) {\n      const matches = matchAll(searchValue, this.original)\n      matches.forEach((match) => {\n        if (match.index != null) {\n          const replacement = getReplacement(match, this.original)\n          if (replacement !== match[0]) {\n            this.overwrite(match.index, match.index + match[0].length, replacement)\n          }\n        }\n      })\n    }\n    else {\n      const match = this.original.match(searchValue)\n      if (match && match.index != null) {\n        const replacement = getReplacement(match, this.original)\n        if (replacement !== match[0]) {\n          this.overwrite(match.index, match.index + match[0].length, replacement)\n        }\n      }\n    }\n    return this\n  }\n\n  /** @internal */\n  _replaceString(string: string, replacement: string | ReplacementFunction): this {\n    const { original } = this\n    const index = original.indexOf(string)\n\n    if (index !== -1) {\n      if (typeof replacement === 'function') {\n        replacement = replacement(string, index, original)\n      }\n      if (string !== replacement) {\n        this.overwrite(index, index + string.length, replacement)\n      }\n    }\n\n    return this\n  }\n\n  /**\n   * String replacement with RegExp or string.\n   */\n  replace(searchValue: string | RegExp, replacement: string | ReplacementFunction): this {\n    if (typeof searchValue === 'string') {\n      return this._replaceString(searchValue, replacement)\n    }\n\n    return this._replaceRegexp(searchValue, replacement)\n  }\n\n  /** @internal */\n  _replaceAllString(string: string, replacement: string | ReplacementFunction): this {\n    const { original } = this\n    const stringLength = string.length\n    for (\n      let index = original.indexOf(string);\n      index !== -1;\n      index = original.indexOf(string, index + stringLength)\n    ) {\n      const previous = original.slice(index, index + stringLength)\n      const _replacement\n        = typeof replacement === 'function' ? replacement(previous, index, original) : replacement\n      if (previous !== _replacement)\n        this.overwrite(index, index + stringLength, _replacement)\n    }\n\n    return this\n  }\n\n  /**\n   * Same as `s.replace`, but replace all matched strings instead of just one.\n   */\n  replaceAll(searchValue: string | RegExp, replacement: string | ReplacementFunction): this {\n    if (typeof searchValue === 'string') {\n      return this._replaceAllString(searchValue, replacement)\n    }\n\n    if (!searchValue.global) {\n      throw new TypeError(\n        'MagicString.prototype.replaceAll called with a non-global RegExp argument',\n      )\n    }\n\n    return this._replaceRegexp(searchValue, replacement)\n  }\n}\n","import type { ExclusionRange } from './MagicString.ts'\nimport type { DecodedSourceMap, SourceMapOptions } from './SourceMap.ts'\nimport MagicString from './MagicString.ts'\nimport SourceMap from './SourceMap.ts'\nimport getLocator from './utils/getLocator.ts'\nimport getRelativePath from './utils/getRelativePath.ts'\nimport isObject from './utils/isObject.ts'\nimport Mappings from './utils/Mappings.ts'\n\nconst hasOwnProp = Object.prototype.hasOwnProperty\n\nexport interface BundleOptions {\n  intro?: string\n  separator?: string\n}\n\ninterface BundleSourceDescription {\n  filename?: string\n  content: MagicString\n  ignoreList?: boolean\n  indentExclusionRanges?: ExclusionRange | ExclusionRange[]\n  separator?: string\n}\n\ninterface UniqueSource {\n  filename: string\n  content: string\n}\n\nexport interface DecodedSourceMapOrMissingContent extends Omit<DecodedSourceMap, 'sourcesContent'> {\n  sourcesContent: Array<string | null>\n}\n\nexport default class Bundle {\n  /** @internal */\n  declare intro: string\n  /** @internal */\n  declare separator: string\n  /** @internal */\n  declare sources: BundleSourceDescription[]\n  /** @internal */\n  declare uniqueSources: UniqueSource[]\n  /** @internal */\n  declare uniqueSourceIndexByFilename: Record<string, number>\n  declare indentExclusionRanges: ExclusionRange | ExclusionRange[] | undefined\n\n  constructor(options: BundleOptions = {}) {\n    this.intro = options.intro || ''\n    this.separator = options.separator !== undefined ? options.separator : '\\n'\n    this.sources = []\n    this.uniqueSources = []\n    this.uniqueSourceIndexByFilename = {}\n  }\n\n  /**\n   * Adds the specified source to the bundle, which can either be a `MagicString` object directly,\n   * or an options object that holds a magic string `content` property and optionally provides\n   * a `filename` for the source within the bundle, as well as an optional `ignoreList` hint\n   * (which defaults to `false`). The `filename` is used when constructing the source map for the\n   * bundle, to identify this `source` in the source map's `sources` field. The `ignoreList` hint\n   * is used to populate the `x_google_ignoreList` extension field in the source map, which is a\n   * mechanism for tools to signal to debuggers that certain sources should be ignored by default\n   * (depending on user preferences).\n   */\n  addSource(source: MagicString | BundleSourceDescription): this {\n    if (source instanceof MagicString) {\n      return this.addSource({\n        content: source,\n        filename: source.filename,\n        separator: this.separator,\n      })\n    }\n\n    if (!isObject(source) || !source.content) {\n      throw new Error(\n        'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`',\n      )\n    }\n\n    ['filename', 'ignoreList', 'indentExclusionRanges', 'separator'].forEach((option) => {\n      if (!hasOwnProp.call(source, option))\n        source[option] = source.content[option]\n    })\n\n    if (source.separator === undefined) {\n      // TODO there's a bunch of this sort of thing, needs cleaning up\n      source.separator = this.separator\n    }\n\n    if (source.filename) {\n      if (!hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) {\n        this.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length\n        this.uniqueSources.push({ filename: source.filename, content: source.content.original })\n      }\n      else {\n        const uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]]\n        if (source.content.original !== uniqueSource.content) {\n          throw new Error(`Illegal source: same filename (${source.filename}), different contents`)\n        }\n      }\n    }\n\n    this.sources.push(source)\n    return this\n  }\n\n  append(str: string, options?: BundleOptions): this {\n    this.addSource({\n      content: new MagicString(str),\n      separator: (options && options.separator) || '',\n    })\n\n    return this\n  }\n\n  clone(): this {\n    const bundle = new Bundle({\n      intro: this.intro,\n      separator: this.separator,\n    })\n\n    this.sources.forEach((source) => {\n      bundle.addSource({\n        filename: source.filename,\n        content: source.content.clone(),\n        separator: source.separator,\n      })\n    })\n\n    return bundle as this\n  }\n\n  generateDecodedMap(options: SourceMapOptions = {}): DecodedSourceMapOrMissingContent {\n    const names = []\n    let x_google_ignoreList\n    this.sources.forEach((source) => {\n      Object.keys(source.content.storedNames).forEach((name) => {\n        if (!names.includes(name))\n          names.push(name)\n      })\n    })\n\n    const mappings = new Mappings(options.hires)\n\n    if (this.intro) {\n      mappings.advance(this.intro)\n    }\n\n    this.sources.forEach((source, i) => {\n      if (i > 0) {\n        mappings.advance(this.separator)\n      }\n\n      const sourceIndex = source.filename ? this.uniqueSourceIndexByFilename[source.filename] : -1\n      const magicString = source.content\n      const locate = getLocator(magicString.original)\n\n      if (magicString.intro) {\n        mappings.advance(magicString.intro)\n      }\n\n      magicString.firstChunk.eachNext((chunk) => {\n        const loc = locate(chunk.start)\n\n        if (chunk.intro.length)\n          mappings.advance(chunk.intro)\n\n        if (source.filename) {\n          if (chunk.edited) {\n            mappings.addEdit(\n              sourceIndex,\n              chunk.content,\n              loc,\n              chunk.storeName ? names.indexOf(chunk.original) : -1,\n            )\n          }\n          else {\n            mappings.addUneditedChunk(\n              sourceIndex,\n              chunk,\n              magicString.original,\n              loc,\n              magicString.sourcemapLocations,\n            )\n          }\n        }\n        else {\n          mappings.advance(chunk.content)\n        }\n\n        if (chunk.outro.length)\n          mappings.advance(chunk.outro)\n      })\n\n      if (magicString.outro) {\n        mappings.advance(magicString.outro)\n      }\n\n      if (source.ignoreList && sourceIndex !== -1) {\n        if (x_google_ignoreList === undefined) {\n          x_google_ignoreList = []\n        }\n        x_google_ignoreList.push(sourceIndex)\n      }\n    })\n\n    return {\n      file: options.file ? options.file.split(/[/\\\\]/).pop() : undefined,\n      sources: this.uniqueSources.map((source) => {\n        return options.file ? getRelativePath(options.file, source.filename) : source.filename\n      }),\n      sourcesContent: this.uniqueSources.map((source) => {\n        return options.includeContent ? source.content : null\n      }),\n      names,\n      mappings: mappings.raw,\n      x_google_ignoreList,\n    }\n  }\n\n  generateMap(\n    options?: SourceMapOptions,\n  ): Omit<SourceMap, 'sourcesContent'> & { sourcesContent: Array<string | null> } {\n    return new SourceMap(this.generateDecodedMap(options)) as Omit<SourceMap, 'sourcesContent'> & {\n      sourcesContent: Array<string | null>\n    }\n  }\n\n  getIndentString(): string {\n    const indentStringCounts = {}\n\n    this.sources.forEach((source) => {\n      const indentStr = source.content._getRawIndentString()\n\n      if (indentStr === null)\n        return\n\n      if (!indentStringCounts[indentStr])\n        indentStringCounts[indentStr] = 0\n      indentStringCounts[indentStr] += 1\n    })\n\n    return (\n      Object.keys(indentStringCounts).sort((a, b) => {\n        return indentStringCounts[a] - indentStringCounts[b]\n      })[0] || '\\t'\n    )\n  }\n\n  indent(indentStr?: string): this {\n    if (!arguments.length) {\n      indentStr = this.getIndentString()\n    }\n\n    if (indentStr === '')\n      return this // noop\n\n    let trailingNewline = !this.intro || this.intro.slice(-1) === '\\n'\n\n    this.sources.forEach((source, i) => {\n      const separator = source.separator !== undefined ? source.separator : this.separator\n      const indentStart = trailingNewline || (i > 0 && /\\r?\\n$/.test(separator))\n\n      source.content.indent(indentStr, {\n        exclude: source.indentExclusionRanges,\n        indentStart, // : trailingNewline || /\\r?\\n$/.test( separator )  //true///\\r?\\n/.test( separator )\n      })\n\n      trailingNewline = source.content.lastChar() === '\\n'\n    })\n\n    if (this.intro) {\n      this.intro\n        = indentStr\n          + this.intro.replace(/^[^\\n]/gm, (match, index) => {\n            return index > 0 ? indentStr + match : match\n          })\n    }\n\n    return this\n  }\n\n  prepend(str: string): this {\n    this.intro = str + this.intro\n    return this\n  }\n\n  toString(): string {\n    const body = this.sources\n      .map((source, i) => {\n        const separator = source.separator !== undefined ? source.separator : this.separator\n        const str = (i > 0 ? separator : '') + source.content.toString()\n\n        return str\n      })\n      .join('')\n\n    return this.intro + body\n  }\n\n  isEmpty(): boolean {\n    if (this.intro.length && this.intro.trim())\n      return false\n    if (this.sources.some(source => !source.content.isEmpty()))\n      return false\n    return true\n  }\n\n  length(): number {\n    return this.sources.reduce(\n      (length, source) => length + source.content.length(),\n      this.intro.length,\n    )\n  }\n\n  trimLines(): this {\n    return this.trim('[\\\\r\\\\n]')\n  }\n\n  trim(charType?: string): this {\n    return this.trimStart(charType).trimEnd(charType)\n  }\n\n  trimStart(charType?: string): this {\n    const rx = new RegExp(`^${charType || '\\\\s'}+`)\n    this.intro = this.intro.replace(rx, '')\n\n    if (!this.intro) {\n      let source\n      let i = 0\n\n      do {\n        source = this.sources[i++]\n        if (!source) {\n          break\n        }\n      } while (!source.content.trimStartAborted(charType))\n    }\n\n    return this\n  }\n\n  trimEnd(charType?: string): this {\n    const rx = new RegExp(`${charType || '\\\\s'}+$`)\n\n    let source\n    let i = this.sources.length - 1\n\n    do {\n      source = this.sources[i--]\n      if (!source) {\n        this.intro = this.intro.replace(rx, '')\n        break\n      }\n    } while (!source.content.trimEndAborted(charType))\n\n    return this\n  }\n}\n"],"mappings":";;AAAA,IAAqB,SAArB,MAAqB,OAAO;CAG1B,YAAY,KAAc;EACxB,KAAK,OAAO,eAAe,SAAS,IAAI,KAAK,MAAM,IAAI,CAAC;CAC1D;CAEA,IAAI,GAAiB;EACnB,KAAK,KAAK,KAAK,MAAM,MAAM,IAAI;CACjC;CAEA,IAAI,GAAoB;EACtB,OAAO,CAAC,EAAE,KAAK,KAAK,KAAK,KAAM,MAAM,IAAI;CAC3C;AACF;;;ACZA,IAAqB,QAArB,MAAqB,MAAM;CAYzB,YAAY,OAAe,KAAa,SAAiB;EACvD,KAAK,QAAQ;E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