powerlines 0.42.31 → 0.42.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{api-D8Y1e08b.mjs → api-D6i8MmbC.mjs} +3 -3
- package/dist/api-D6i8MmbC.mjs.map +1 -0
- package/dist/{api-B7pnJNWj.cjs → api-DZoRNTY7.cjs} +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/nuxt.cjs +1 -1
- package/dist/nuxt.mjs +1 -1
- package/dist/unplugin.cjs +1 -1
- package/dist/unplugin.mjs +1 -1
- package/package.json +3 -3
- package/dist/api-D8Y1e08b.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-D6i8MmbC.mjs","names":["sortComparator","isObject","getLocator","normalizePath","resolve","resolveUri","COLUMN","cast","resolve","picomatch","nativeFs","fdir","ts9","tsu.isExportKeyword","tsu.isDefaultKeyword","tsu.isNamespaceDeclaration","tsu.isEndOfFileToken","tsu.isNamespaceDeclaration","tsu.isDeclareKeyword","isParentPath","#context","#addPlugin","packageJson.version","#executeEnvironments","defu","#types","#handleBuild","#getEnvironments","#initPlugin","#resolvePlugin","isPlugin","isPluginConfig"],"sources":["../package.json","../../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs","../../../node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs","../../../node_modules/.pnpm/locate-character@3.0.0/node_modules/locate-character/src/index.js","../../../node_modules/.pnpm/@jridgewell+resolve-uri@3.1.2/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs","../../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs","../../../node_modules/.pnpm/@jridgewell+gen-mapping@0.3.13/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs","../../../node_modules/.pnpm/@jridgewell+source-map@0.3.11/node_modules/@jridgewell/source-map/dist/source-map.mjs","../../../node_modules/.pnpm/fdir@6.5.0_@types+picomatch@4.0.3_picomatch@4.0.4/node_modules/fdir/dist/index.mjs","../../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js","../../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js","../../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js","../../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js","../../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js","../../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js","../../../node_modules/.pnpm/tinyglobby@0.2.15/node_modules/tinyglobby/dist/index.mjs","../../../node_modules/.pnpm/ts-api-utils@1.4.3_typescript@6.0.2/node_modules/ts-api-utils/lib/index.js","../../../node_modules/.pnpm/dts-buddy@0.7.0_patch_hash=d6d05bac57e41db2099a985dd9d3456dcc71745b3c78e32e73fd9877d264c204_typescript@6.0.2/node_modules/dts-buddy/src/utils.js","../../../node_modules/.pnpm/dts-buddy@0.7.0_patch_hash=d6d05bac57e41db2099a985dd9d3456dcc71745b3c78e32e73fd9877d264c204_typescript@6.0.2/node_modules/dts-buddy/src/create-module-declaration.js","../../../node_modules/.pnpm/dts-buddy@0.7.0_patch_hash=d6d05bac57e41db2099a985dd9d3456dcc71745b3c78e32e73fd9877d264c204_typescript@6.0.2/node_modules/dts-buddy/src/index.js","../src/_internal/helpers/generate-types.ts","../src/_internal/helpers/install.ts","../src/_internal/helpers/install-dependencies.ts","../src/_internal/helpers/resolve-tsconfig.ts","../src/api.ts"],"sourcesContent":["","// src/vlq.ts\nvar comma = \",\".charCodeAt(0);\nvar semicolon = \";\".charCodeAt(0);\nvar chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nvar intToChar = new Uint8Array(64);\nvar charToInt = new Uint8Array(128);\nfor (let i = 0; i < chars.length; i++) {\n const c = chars.charCodeAt(i);\n intToChar[i] = c;\n charToInt[c] = i;\n}\nfunction decodeInteger(reader, relative) {\n let value = 0;\n let shift = 0;\n let integer = 0;\n do {\n const c = reader.next();\n integer = charToInt[c];\n value |= (integer & 31) << shift;\n shift += 5;\n } while (integer & 32);\n const shouldNegate = value & 1;\n value >>>= 1;\n if (shouldNegate) {\n value = -2147483648 | -value;\n }\n return relative + value;\n}\nfunction encodeInteger(builder, num, relative) {\n let delta = num - relative;\n delta = delta < 0 ? -delta << 1 | 1 : delta << 1;\n do {\n let clamped = delta & 31;\n delta >>>= 5;\n if (delta > 0) clamped |= 32;\n builder.write(intToChar[clamped]);\n } while (delta > 0);\n return num;\n}\nfunction hasMoreVlq(reader, max) {\n if (reader.pos >= max) return false;\n return reader.peek() !== comma;\n}\n\n// src/strings.ts\nvar bufLength = 1024 * 16;\nvar td = typeof TextDecoder !== \"undefined\" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== \"undefined\" ? {\n decode(buf) {\n const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);\n return out.toString();\n }\n} : {\n decode(buf) {\n let out = \"\";\n for (let i = 0; i < buf.length; i++) {\n out += String.fromCharCode(buf[i]);\n }\n return out;\n }\n};\nvar StringWriter = class {\n constructor() {\n this.pos = 0;\n this.out = \"\";\n this.buffer = new Uint8Array(bufLength);\n }\n write(v) {\n const { buffer } = this;\n buffer[this.pos++] = v;\n if (this.pos === bufLength) {\n this.out += td.decode(buffer);\n this.pos = 0;\n }\n }\n flush() {\n const { buffer, out, pos } = this;\n return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;\n }\n};\nvar StringReader = class {\n constructor(buffer) {\n this.pos = 0;\n this.buffer = buffer;\n }\n next() {\n return this.buffer.charCodeAt(this.pos++);\n }\n peek() {\n return this.buffer.charCodeAt(this.pos);\n }\n indexOf(char) {\n const { buffer, pos } = this;\n const idx = buffer.indexOf(char, pos);\n return idx === -1 ? buffer.length : idx;\n }\n};\n\n// src/scopes.ts\nvar EMPTY = [];\nfunction decodeOriginalScopes(input) {\n const { length } = input;\n const reader = new StringReader(input);\n const scopes = [];\n const stack = [];\n let line = 0;\n for (; reader.pos < length; reader.pos++) {\n line = decodeInteger(reader, line);\n const column = decodeInteger(reader, 0);\n if (!hasMoreVlq(reader, length)) {\n const last = stack.pop();\n last[2] = line;\n last[3] = column;\n continue;\n }\n const kind = decodeInteger(reader, 0);\n const fields = decodeInteger(reader, 0);\n const hasName = fields & 1;\n const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind];\n let vars = EMPTY;\n if (hasMoreVlq(reader, length)) {\n vars = [];\n do {\n const varsIndex = decodeInteger(reader, 0);\n vars.push(varsIndex);\n } while (hasMoreVlq(reader, length));\n }\n scope.vars = vars;\n scopes.push(scope);\n stack.push(scope);\n }\n return scopes;\n}\nfunction encodeOriginalScopes(scopes) {\n const writer = new StringWriter();\n for (let i = 0; i < scopes.length; ) {\n i = _encodeOriginalScopes(scopes, i, writer, [0]);\n }\n return writer.flush();\n}\nfunction _encodeOriginalScopes(scopes, index, writer, state) {\n const scope = scopes[index];\n const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;\n if (index > 0) writer.write(comma);\n state[0] = encodeInteger(writer, startLine, state[0]);\n encodeInteger(writer, startColumn, 0);\n encodeInteger(writer, kind, 0);\n const fields = scope.length === 6 ? 1 : 0;\n encodeInteger(writer, fields, 0);\n if (scope.length === 6) encodeInteger(writer, scope[5], 0);\n for (const v of vars) {\n encodeInteger(writer, v, 0);\n }\n for (index++; index < scopes.length; ) {\n const next = scopes[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || l === endLine && c >= endColumn) {\n break;\n }\n index = _encodeOriginalScopes(scopes, index, writer, state);\n }\n writer.write(comma);\n state[0] = encodeInteger(writer, endLine, state[0]);\n encodeInteger(writer, endColumn, 0);\n return index;\n}\nfunction decodeGeneratedRanges(input) {\n const { length } = input;\n const reader = new StringReader(input);\n const ranges = [];\n const stack = [];\n let genLine = 0;\n let definitionSourcesIndex = 0;\n let definitionScopeIndex = 0;\n let callsiteSourcesIndex = 0;\n let callsiteLine = 0;\n let callsiteColumn = 0;\n let bindingLine = 0;\n let bindingColumn = 0;\n do {\n const semi = reader.indexOf(\";\");\n let genColumn = 0;\n for (; reader.pos < semi; reader.pos++) {\n genColumn = decodeInteger(reader, genColumn);\n if (!hasMoreVlq(reader, semi)) {\n const last = stack.pop();\n last[2] = genLine;\n last[3] = genColumn;\n continue;\n }\n const fields = decodeInteger(reader, 0);\n const hasDefinition = fields & 1;\n const hasCallsite = fields & 2;\n const hasScope = fields & 4;\n let callsite = null;\n let bindings = EMPTY;\n let range;\n if (hasDefinition) {\n const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);\n definitionScopeIndex = decodeInteger(\n reader,\n definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0\n );\n definitionSourcesIndex = defSourcesIndex;\n range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex];\n } else {\n range = [genLine, genColumn, 0, 0];\n }\n range.isScope = !!hasScope;\n if (hasCallsite) {\n const prevCsi = callsiteSourcesIndex;\n const prevLine = callsiteLine;\n callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);\n const sameSource = prevCsi === callsiteSourcesIndex;\n callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);\n callsiteColumn = decodeInteger(\n reader,\n sameSource && prevLine === callsiteLine ? callsiteColumn : 0\n );\n callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];\n }\n range.callsite = callsite;\n if (hasMoreVlq(reader, semi)) {\n bindings = [];\n do {\n bindingLine = genLine;\n bindingColumn = genColumn;\n const expressionsCount = decodeInteger(reader, 0);\n let expressionRanges;\n if (expressionsCount < -1) {\n expressionRanges = [[decodeInteger(reader, 0)]];\n for (let i = -1; i > expressionsCount; i--) {\n const prevBl = bindingLine;\n bindingLine = decodeInteger(reader, bindingLine);\n bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);\n const expression = decodeInteger(reader, 0);\n expressionRanges.push([expression, bindingLine, bindingColumn]);\n }\n } else {\n expressionRanges = [[expressionsCount]];\n }\n bindings.push(expressionRanges);\n } while (hasMoreVlq(reader, semi));\n }\n range.bindings = bindings;\n ranges.push(range);\n stack.push(range);\n }\n genLine++;\n reader.pos = semi + 1;\n } while (reader.pos < length);\n return ranges;\n}\nfunction encodeGeneratedRanges(ranges) {\n if (ranges.length === 0) return \"\";\n const writer = new StringWriter();\n for (let i = 0; i < ranges.length; ) {\n i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);\n }\n return writer.flush();\n}\nfunction _encodeGeneratedRanges(ranges, index, writer, state) {\n const range = ranges[index];\n const {\n 0: startLine,\n 1: startColumn,\n 2: endLine,\n 3: endColumn,\n isScope,\n callsite,\n bindings\n } = range;\n if (state[0] < startLine) {\n catchupLine(writer, state[0], startLine);\n state[0] = startLine;\n state[1] = 0;\n } else if (index > 0) {\n writer.write(comma);\n }\n state[1] = encodeInteger(writer, range[1], state[1]);\n const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0);\n encodeInteger(writer, fields, 0);\n if (range.length === 6) {\n const { 4: sourcesIndex, 5: scopesIndex } = range;\n if (sourcesIndex !== state[2]) {\n state[3] = 0;\n }\n state[2] = encodeInteger(writer, sourcesIndex, state[2]);\n state[3] = encodeInteger(writer, scopesIndex, state[3]);\n }\n if (callsite) {\n const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite;\n if (sourcesIndex !== state[4]) {\n state[5] = 0;\n state[6] = 0;\n } else if (callLine !== state[5]) {\n state[6] = 0;\n }\n state[4] = encodeInteger(writer, sourcesIndex, state[4]);\n state[5] = encodeInteger(writer, callLine, state[5]);\n state[6] = encodeInteger(writer, callColumn, state[6]);\n }\n if (bindings) {\n for (const binding of bindings) {\n if (binding.length > 1) encodeInteger(writer, -binding.length, 0);\n const expression = binding[0][0];\n encodeInteger(writer, expression, 0);\n let bindingStartLine = startLine;\n let bindingStartColumn = startColumn;\n for (let i = 1; i < binding.length; i++) {\n const expRange = binding[i];\n bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);\n bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);\n encodeInteger(writer, expRange[0], 0);\n }\n }\n }\n for (index++; index < ranges.length; ) {\n const next = ranges[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || l === endLine && c >= endColumn) {\n break;\n }\n index = _encodeGeneratedRanges(ranges, index, writer, state);\n }\n if (state[0] < endLine) {\n catchupLine(writer, state[0], endLine);\n state[0] = endLine;\n state[1] = 0;\n } else {\n writer.write(comma);\n }\n state[1] = encodeInteger(writer, endColumn, state[1]);\n return index;\n}\nfunction catchupLine(writer, lastLine, line) {\n do {\n writer.write(semicolon);\n } while (++lastLine < line);\n}\n\n// src/sourcemap-codec.ts\nfunction decode(mappings) {\n const { length } = mappings;\n const reader = new StringReader(mappings);\n const decoded = [];\n let genColumn = 0;\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n do {\n const semi = reader.indexOf(\";\");\n const line = [];\n let sorted = true;\n let lastCol = 0;\n genColumn = 0;\n while (reader.pos < semi) {\n let seg;\n genColumn = decodeInteger(reader, genColumn);\n if (genColumn < lastCol) sorted = false;\n lastCol = genColumn;\n if (hasMoreVlq(reader, semi)) {\n sourcesIndex = decodeInteger(reader, sourcesIndex);\n sourceLine = decodeInteger(reader, sourceLine);\n sourceColumn = decodeInteger(reader, sourceColumn);\n if (hasMoreVlq(reader, semi)) {\n namesIndex = decodeInteger(reader, namesIndex);\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];\n } else {\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];\n }\n } else {\n seg = [genColumn];\n }\n line.push(seg);\n reader.pos++;\n }\n if (!sorted) sort(line);\n decoded.push(line);\n reader.pos = semi + 1;\n } while (reader.pos <= length);\n return decoded;\n}\nfunction sort(line) {\n line.sort(sortComparator);\n}\nfunction sortComparator(a, b) {\n return a[0] - b[0];\n}\nfunction encode(decoded) {\n const writer = new StringWriter();\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n if (i > 0) writer.write(semicolon);\n if (line.length === 0) continue;\n let genColumn = 0;\n for (let j = 0; j < line.length; j++) {\n const segment = line[j];\n if (j > 0) writer.write(comma);\n genColumn = encodeInteger(writer, segment[0], genColumn);\n if (segment.length === 1) continue;\n sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);\n sourceLine = encodeInteger(writer, segment[2], sourceLine);\n sourceColumn = encodeInteger(writer, segment[3], sourceColumn);\n if (segment.length === 4) continue;\n namesIndex = encodeInteger(writer, segment[4], namesIndex);\n }\n }\n return writer.flush();\n}\nexport {\n decode,\n decodeGeneratedRanges,\n decodeOriginalScopes,\n encode,\n encodeGeneratedRanges,\n encodeOriginalScopes\n};\n//# sourceMappingURL=sourcemap-codec.mjs.map\n","import { encode } from '@jridgewell/sourcemap-codec';\n\nclass BitSet {\n\tconstructor(arg) {\n\t\tthis.bits = arg instanceof BitSet ? arg.bits.slice() : [];\n\t}\n\n\tadd(n) {\n\t\tthis.bits[n >> 5] |= 1 << (n & 31);\n\t}\n\n\thas(n) {\n\t\treturn !!(this.bits[n >> 5] & (1 << (n & 31)));\n\t}\n}\n\nclass Chunk {\n\tconstructor(start, end, content) {\n\t\tthis.start = start;\n\t\tthis.end = end;\n\t\tthis.original = content;\n\n\t\tthis.intro = '';\n\t\tthis.outro = '';\n\n\t\tthis.content = content;\n\t\tthis.storeName = false;\n\t\tthis.edited = false;\n\n\t\t{\n\t\t\tthis.previous = null;\n\t\t\tthis.next = null;\n\t\t}\n\t}\n\n\tappendLeft(content) {\n\t\tthis.outro += content;\n\t}\n\n\tappendRight(content) {\n\t\tthis.intro = this.intro + content;\n\t}\n\n\tclone() {\n\t\tconst chunk = new Chunk(this.start, this.end, this.original);\n\n\t\tchunk.intro = this.intro;\n\t\tchunk.outro = this.outro;\n\t\tchunk.content = this.content;\n\t\tchunk.storeName = this.storeName;\n\t\tchunk.edited = this.edited;\n\n\t\treturn chunk;\n\t}\n\n\tcontains(index) {\n\t\treturn this.start < index && index < this.end;\n\t}\n\n\teachNext(fn) {\n\t\tlet chunk = this;\n\t\twhile (chunk) {\n\t\t\tfn(chunk);\n\t\t\tchunk = chunk.next;\n\t\t}\n\t}\n\n\teachPrevious(fn) {\n\t\tlet chunk = this;\n\t\twhile (chunk) {\n\t\t\tfn(chunk);\n\t\t\tchunk = chunk.previous;\n\t\t}\n\t}\n\n\tedit(content, storeName, contentOnly) {\n\t\tthis.content = content;\n\t\tif (!contentOnly) {\n\t\t\tthis.intro = '';\n\t\t\tthis.outro = '';\n\t\t}\n\t\tthis.storeName = storeName;\n\n\t\tthis.edited = true;\n\n\t\treturn this;\n\t}\n\n\tprependLeft(content) {\n\t\tthis.outro = content + this.outro;\n\t}\n\n\tprependRight(content) {\n\t\tthis.intro = content + this.intro;\n\t}\n\n\treset() {\n\t\tthis.intro = '';\n\t\tthis.outro = '';\n\t\tif (this.edited) {\n\t\t\tthis.content = this.original;\n\t\t\tthis.storeName = false;\n\t\t\tthis.edited = false;\n\t\t}\n\t}\n\n\tsplit(index) {\n\t\tconst sliceIndex = index - this.start;\n\n\t\tconst originalBefore = this.original.slice(0, sliceIndex);\n\t\tconst originalAfter = this.original.slice(sliceIndex);\n\n\t\tthis.original = originalBefore;\n\n\t\tconst newChunk = new Chunk(index, this.end, originalAfter);\n\t\tnewChunk.outro = this.outro;\n\t\tthis.outro = '';\n\n\t\tthis.end = index;\n\n\t\tif (this.edited) {\n\t\t\t// after split we should save the edit content record into the correct chunk\n\t\t\t// to make sure sourcemap correct\n\t\t\t// For example:\n\t\t\t// ' test'.trim()\n\t\t\t// split -> ' ' + 'test'\n\t\t\t// ✔️ edit -> '' + 'test'\n\t\t\t// ✖️ edit -> 'test' + ''\n\t\t\t// TODO is this block necessary?...\n\t\t\tnewChunk.edit('', false);\n\t\t\tthis.content = '';\n\t\t} else {\n\t\t\tthis.content = originalBefore;\n\t\t}\n\n\t\tnewChunk.next = this.next;\n\t\tif (newChunk.next) newChunk.next.previous = newChunk;\n\t\tnewChunk.previous = this;\n\t\tthis.next = newChunk;\n\n\t\treturn newChunk;\n\t}\n\n\ttoString() {\n\t\treturn this.intro + this.content + this.outro;\n\t}\n\n\ttrimEnd(rx) {\n\t\tthis.outro = this.outro.replace(rx, '');\n\t\tif (this.outro.length) return true;\n\n\t\tconst trimmed = this.content.replace(rx, '');\n\n\t\tif (trimmed.length) {\n\t\t\tif (trimmed !== this.content) {\n\t\t\t\tthis.split(this.start + trimmed.length).edit('', undefined, true);\n\t\t\t\tif (this.edited) {\n\t\t\t\t\t// save the change, if it has been edited\n\t\t\t\t\tthis.edit(trimmed, this.storeName, true);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t} else {\n\t\t\tthis.edit('', undefined, true);\n\n\t\t\tthis.intro = this.intro.replace(rx, '');\n\t\t\tif (this.intro.length) return true;\n\t\t}\n\t}\n\n\ttrimStart(rx) {\n\t\tthis.intro = this.intro.replace(rx, '');\n\t\tif (this.intro.length) return true;\n\n\t\tconst trimmed = this.content.replace(rx, '');\n\n\t\tif (trimmed.length) {\n\t\t\tif (trimmed !== this.content) {\n\t\t\t\tconst newChunk = this.split(this.end - trimmed.length);\n\t\t\t\tif (this.edited) {\n\t\t\t\t\t// save the change, if it has been edited\n\t\t\t\t\tnewChunk.edit(trimmed, this.storeName, true);\n\t\t\t\t}\n\t\t\t\tthis.edit('', undefined, true);\n\t\t\t}\n\t\t\treturn true;\n\t\t} else {\n\t\t\tthis.edit('', undefined, true);\n\n\t\t\tthis.outro = this.outro.replace(rx, '');\n\t\t\tif (this.outro.length) return true;\n\t\t}\n\t}\n}\n\nfunction getBtoa() {\n\tif (typeof globalThis !== 'undefined' && typeof globalThis.btoa === 'function') {\n\t\treturn (str) => globalThis.btoa(unescape(encodeURIComponent(str)));\n\t} else if (typeof Buffer === 'function') {\n\t\treturn (str) => Buffer.from(str, 'utf-8').toString('base64');\n\t} else {\n\t\treturn () => {\n\t\t\tthrow new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');\n\t\t};\n\t}\n}\n\nconst btoa = /*#__PURE__*/ getBtoa();\n\nclass SourceMap {\n\tconstructor(properties) {\n\t\tthis.version = 3;\n\t\tthis.file = properties.file;\n\t\tthis.sources = properties.sources;\n\t\tthis.sourcesContent = properties.sourcesContent;\n\t\tthis.names = properties.names;\n\t\tthis.mappings = encode(properties.mappings);\n\t\tif (typeof properties.x_google_ignoreList !== 'undefined') {\n\t\t\tthis.x_google_ignoreList = properties.x_google_ignoreList;\n\t\t}\n\t\tif (typeof properties.debugId !== 'undefined') {\n\t\t\tthis.debugId = properties.debugId;\n\t\t}\n\t}\n\n\ttoString() {\n\t\treturn JSON.stringify(this);\n\t}\n\n\ttoUrl() {\n\t\treturn 'data:application/json;charset=utf-8;base64,' + btoa(this.toString());\n\t}\n}\n\nfunction guessIndent(code) {\n\tconst lines = code.split('\\n');\n\n\tconst tabbed = lines.filter((line) => /^\\t+/.test(line));\n\tconst spaced = lines.filter((line) => /^ {2,}/.test(line));\n\n\tif (tabbed.length === 0 && spaced.length === 0) {\n\t\treturn null;\n\t}\n\n\t// More lines tabbed than spaced? Assume tabs, and\n\t// default to tabs in the case of a tie (or nothing\n\t// to go on)\n\tif (tabbed.length >= spaced.length) {\n\t\treturn '\\t';\n\t}\n\n\t// Otherwise, we need to guess the multiple\n\tconst min = spaced.reduce((previous, current) => {\n\t\tconst numSpaces = /^ +/.exec(current)[0].length;\n\t\treturn Math.min(numSpaces, previous);\n\t}, Infinity);\n\n\treturn new Array(min + 1).join(' ');\n}\n\nfunction getRelativePath(from, to) {\n\tconst fromParts = from.split(/[/\\\\]/);\n\tconst toParts = to.split(/[/\\\\]/);\n\n\tfromParts.pop(); // get dirname\n\n\twhile (fromParts[0] === toParts[0]) {\n\t\tfromParts.shift();\n\t\ttoParts.shift();\n\t}\n\n\tif (fromParts.length) {\n\t\tlet i = fromParts.length;\n\t\twhile (i--) fromParts[i] = '..';\n\t}\n\n\treturn fromParts.concat(toParts).join('/');\n}\n\nconst toString = Object.prototype.toString;\n\nfunction isObject(thing) {\n\treturn toString.call(thing) === '[object Object]';\n}\n\nfunction getLocator(source) {\n\tconst originalLines = source.split('\\n');\n\tconst lineOffsets = [];\n\n\tfor (let i = 0, pos = 0; i < originalLines.length; i++) {\n\t\tlineOffsets.push(pos);\n\t\tpos += originalLines[i].length + 1;\n\t}\n\n\treturn function locate(index) {\n\t\tlet i = 0;\n\t\tlet j = lineOffsets.length;\n\t\twhile (i < j) {\n\t\t\tconst m = (i + j) >> 1;\n\t\t\tif (index < lineOffsets[m]) {\n\t\t\t\tj = m;\n\t\t\t} else {\n\t\t\t\ti = m + 1;\n\t\t\t}\n\t\t}\n\t\tconst line = i - 1;\n\t\tconst column = index - lineOffsets[line];\n\t\treturn { line, column };\n\t};\n}\n\nconst wordRegex = /\\w/;\n\nclass Mappings {\n\tconstructor(hires) {\n\t\tthis.hires = hires;\n\t\tthis.generatedCodeLine = 0;\n\t\tthis.generatedCodeColumn = 0;\n\t\tthis.raw = [];\n\t\tthis.rawSegments = this.raw[this.generatedCodeLine] = [];\n\t\tthis.pending = null;\n\t}\n\n\taddEdit(sourceIndex, content, loc, nameIndex) {\n\t\tif (content.length) {\n\t\t\tconst contentLengthMinusOne = content.length - 1;\n\t\t\tlet contentLineEnd = content.indexOf('\\n', 0);\n\t\t\tlet previousContentLineEnd = -1;\n\t\t\t// Loop through each line in the content and add a segment, but stop if the last line is empty,\n\t\t\t// else code afterwards would fill one line too many\n\t\t\twhile (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {\n\t\t\t\tconst segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];\n\t\t\t\tif (nameIndex >= 0) {\n\t\t\t\t\tsegment.push(nameIndex);\n\t\t\t\t}\n\t\t\t\tthis.rawSegments.push(segment);\n\n\t\t\t\tthis.generatedCodeLine += 1;\n\t\t\t\tthis.raw[this.generatedCodeLine] = this.rawSegments = [];\n\t\t\t\tthis.generatedCodeColumn = 0;\n\n\t\t\t\tpreviousContentLineEnd = contentLineEnd;\n\t\t\t\tcontentLineEnd = content.indexOf('\\n', contentLineEnd + 1);\n\t\t\t}\n\n\t\t\tconst segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];\n\t\t\tif (nameIndex >= 0) {\n\t\t\t\tsegment.push(nameIndex);\n\t\t\t}\n\t\t\tthis.rawSegments.push(segment);\n\n\t\t\tthis.advance(content.slice(previousContentLineEnd + 1));\n\t\t} else if (this.pending) {\n\t\t\tthis.rawSegments.push(this.pending);\n\t\t\tthis.advance(content);\n\t\t}\n\n\t\tthis.pending = null;\n\t}\n\n\taddUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {\n\t\tlet originalCharIndex = chunk.start;\n\t\tlet first = true;\n\t\t// when iterating each char, check if it's in a word boundary\n\t\tlet charInHiresBoundary = false;\n\n\t\twhile (originalCharIndex < chunk.end) {\n\t\t\tif (original[originalCharIndex] === '\\n') {\n\t\t\t\tloc.line += 1;\n\t\t\t\tloc.column = 0;\n\t\t\t\tthis.generatedCodeLine += 1;\n\t\t\t\tthis.raw[this.generatedCodeLine] = this.rawSegments = [];\n\t\t\t\tthis.generatedCodeColumn = 0;\n\t\t\t\tfirst = true;\n\t\t\t\tcharInHiresBoundary = false;\n\t\t\t} else {\n\t\t\t\tif (this.hires || first || sourcemapLocations.has(originalCharIndex)) {\n\t\t\t\t\tconst segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];\n\n\t\t\t\t\tif (this.hires === 'boundary') {\n\t\t\t\t\t\t// in hires \"boundary\", group segments per word boundary than per char\n\t\t\t\t\t\tif (wordRegex.test(original[originalCharIndex])) {\n\t\t\t\t\t\t\t// for first char in the boundary found, start the boundary by pushing a segment\n\t\t\t\t\t\t\tif (!charInHiresBoundary) {\n\t\t\t\t\t\t\t\tthis.rawSegments.push(segment);\n\t\t\t\t\t\t\t\tcharInHiresBoundary = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// for non-word char, end the boundary by pushing a segment\n\t\t\t\t\t\t\tthis.rawSegments.push(segment);\n\t\t\t\t\t\t\tcharInHiresBoundary = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.rawSegments.push(segment);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tloc.column += 1;\n\t\t\t\tthis.generatedCodeColumn += 1;\n\t\t\t\tfirst = false;\n\t\t\t}\n\n\t\t\toriginalCharIndex += 1;\n\t\t}\n\n\t\tthis.pending = null;\n\t}\n\n\tadvance(str) {\n\t\tif (!str) return;\n\n\t\tconst lines = str.split('\\n');\n\n\t\tif (lines.length > 1) {\n\t\t\tfor (let i = 0; i < lines.length - 1; i++) {\n\t\t\t\tthis.generatedCodeLine++;\n\t\t\t\tthis.raw[this.generatedCodeLine] = this.rawSegments = [];\n\t\t\t}\n\t\t\tthis.generatedCodeColumn = 0;\n\t\t}\n\n\t\tthis.generatedCodeColumn += lines[lines.length - 1].length;\n\t}\n}\n\nconst n = '\\n';\n\nconst warned = {\n\tinsertLeft: false,\n\tinsertRight: false,\n\tstoreName: false,\n};\n\nclass MagicString {\n\tconstructor(string, options = {}) {\n\t\tconst chunk = new Chunk(0, string.length, string);\n\n\t\tObject.defineProperties(this, {\n\t\t\toriginal: { writable: true, value: string },\n\t\t\toutro: { writable: true, value: '' },\n\t\t\tintro: { writable: true, value: '' },\n\t\t\tfirstChunk: { writable: true, value: chunk },\n\t\t\tlastChunk: { writable: true, value: chunk },\n\t\t\tlastSearchedChunk: { writable: true, value: chunk },\n\t\t\tbyStart: { writable: true, value: {} },\n\t\t\tbyEnd: { writable: true, value: {} },\n\t\t\tfilename: { writable: true, value: options.filename },\n\t\t\tindentExclusionRanges: { writable: true, value: options.indentExclusionRanges },\n\t\t\tsourcemapLocations: { writable: true, value: new BitSet() },\n\t\t\tstoredNames: { writable: true, value: {} },\n\t\t\tindentStr: { writable: true, value: undefined },\n\t\t\tignoreList: { writable: true, value: options.ignoreList },\n\t\t\toffset: { writable: true, value: options.offset || 0 },\n\t\t});\n\n\t\tthis.byStart[0] = chunk;\n\t\tthis.byEnd[string.length] = chunk;\n\t}\n\n\taddSourcemapLocation(char) {\n\t\tthis.sourcemapLocations.add(char);\n\t}\n\n\tappend(content) {\n\t\tif (typeof content !== 'string') throw new TypeError('outro content must be a string');\n\n\t\tthis.outro += content;\n\t\treturn this;\n\t}\n\n\tappendLeft(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byEnd[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.appendLeft(content);\n\t\t} else {\n\t\t\tthis.intro += content;\n\t\t}\n\t\treturn this;\n\t}\n\n\tappendRight(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byStart[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.appendRight(content);\n\t\t} else {\n\t\t\tthis.outro += content;\n\t\t}\n\t\treturn this;\n\t}\n\n\tclone() {\n\t\tconst cloned = new MagicString(this.original, { filename: this.filename, offset: this.offset });\n\n\t\tlet originalChunk = this.firstChunk;\n\t\tlet clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());\n\n\t\twhile (originalChunk) {\n\t\t\tcloned.byStart[clonedChunk.start] = clonedChunk;\n\t\t\tcloned.byEnd[clonedChunk.end] = clonedChunk;\n\n\t\t\tconst nextOriginalChunk = originalChunk.next;\n\t\t\tconst nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();\n\n\t\t\tif (nextClonedChunk) {\n\t\t\t\tclonedChunk.next = nextClonedChunk;\n\t\t\t\tnextClonedChunk.previous = clonedChunk;\n\n\t\t\t\tclonedChunk = nextClonedChunk;\n\t\t\t}\n\n\t\t\toriginalChunk = nextOriginalChunk;\n\t\t}\n\n\t\tcloned.lastChunk = clonedChunk;\n\n\t\tif (this.indentExclusionRanges) {\n\t\t\tcloned.indentExclusionRanges = this.indentExclusionRanges.slice();\n\t\t}\n\n\t\tcloned.sourcemapLocations = new BitSet(this.sourcemapLocations);\n\n\t\tcloned.intro = this.intro;\n\t\tcloned.outro = this.outro;\n\n\t\treturn cloned;\n\t}\n\n\tgenerateDecodedMap(options) {\n\t\toptions = options || {};\n\n\t\tconst sourceIndex = 0;\n\t\tconst names = Object.keys(this.storedNames);\n\t\tconst mappings = new Mappings(options.hires);\n\n\t\tconst locate = getLocator(this.original);\n\n\t\tif (this.intro) {\n\t\t\tmappings.advance(this.intro);\n\t\t}\n\n\t\tthis.firstChunk.eachNext((chunk) => {\n\t\t\tconst loc = locate(chunk.start);\n\n\t\t\tif (chunk.intro.length) mappings.advance(chunk.intro);\n\n\t\t\tif (chunk.edited) {\n\t\t\t\tmappings.addEdit(\n\t\t\t\t\tsourceIndex,\n\t\t\t\t\tchunk.content,\n\t\t\t\t\tloc,\n\t\t\t\t\tchunk.storeName ? names.indexOf(chunk.original) : -1,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tmappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);\n\t\t\t}\n\n\t\t\tif (chunk.outro.length) mappings.advance(chunk.outro);\n\t\t});\n\n\t\tif (this.outro) {\n\t\t\tmappings.advance(this.outro);\n\t\t}\n\n\t\treturn {\n\t\t\tfile: options.file ? options.file.split(/[/\\\\]/).pop() : undefined,\n\t\t\tsources: [\n\t\t\t\toptions.source ? getRelativePath(options.file || '', options.source) : options.file || '',\n\t\t\t],\n\t\t\tsourcesContent: options.includeContent ? [this.original] : undefined,\n\t\t\tnames,\n\t\t\tmappings: mappings.raw,\n\t\t\tx_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined,\n\t\t};\n\t}\n\n\tgenerateMap(options) {\n\t\treturn new SourceMap(this.generateDecodedMap(options));\n\t}\n\n\t_ensureindentStr() {\n\t\tif (this.indentStr === undefined) {\n\t\t\tthis.indentStr = guessIndent(this.original);\n\t\t}\n\t}\n\n\t_getRawIndentString() {\n\t\tthis._ensureindentStr();\n\t\treturn this.indentStr;\n\t}\n\n\tgetIndentString() {\n\t\tthis._ensureindentStr();\n\t\treturn this.indentStr === null ? '\\t' : this.indentStr;\n\t}\n\n\tindent(indentStr, options) {\n\t\tconst pattern = /^[^\\r\\n]/gm;\n\n\t\tif (isObject(indentStr)) {\n\t\t\toptions = indentStr;\n\t\t\tindentStr = undefined;\n\t\t}\n\n\t\tif (indentStr === undefined) {\n\t\t\tthis._ensureindentStr();\n\t\t\tindentStr = this.indentStr || '\\t';\n\t\t}\n\n\t\tif (indentStr === '') return this; // noop\n\n\t\toptions = options || {};\n\n\t\t// Process exclusion ranges\n\t\tconst isExcluded = {};\n\n\t\tif (options.exclude) {\n\t\t\tconst exclusions =\n\t\t\t\ttypeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;\n\t\t\texclusions.forEach((exclusion) => {\n\t\t\t\tfor (let i = exclusion[0]; i < exclusion[1]; i += 1) {\n\t\t\t\t\tisExcluded[i] = true;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tlet shouldIndentNextCharacter = options.indentStart !== false;\n\t\tconst replacer = (match) => {\n\t\t\tif (shouldIndentNextCharacter) return `${indentStr}${match}`;\n\t\t\tshouldIndentNextCharacter = true;\n\t\t\treturn match;\n\t\t};\n\n\t\tthis.intro = this.intro.replace(pattern, replacer);\n\n\t\tlet charIndex = 0;\n\t\tlet chunk = this.firstChunk;\n\n\t\twhile (chunk) {\n\t\t\tconst end = chunk.end;\n\n\t\t\tif (chunk.edited) {\n\t\t\t\tif (!isExcluded[charIndex]) {\n\t\t\t\t\tchunk.content = chunk.content.replace(pattern, replacer);\n\n\t\t\t\t\tif (chunk.content.length) {\n\t\t\t\t\t\tshouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\\n';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcharIndex = chunk.start;\n\n\t\t\t\twhile (charIndex < end) {\n\t\t\t\t\tif (!isExcluded[charIndex]) {\n\t\t\t\t\t\tconst char = this.original[charIndex];\n\n\t\t\t\t\t\tif (char === '\\n') {\n\t\t\t\t\t\t\tshouldIndentNextCharacter = true;\n\t\t\t\t\t\t} else if (char !== '\\r' && shouldIndentNextCharacter) {\n\t\t\t\t\t\t\tshouldIndentNextCharacter = false;\n\n\t\t\t\t\t\t\tif (charIndex === chunk.start) {\n\t\t\t\t\t\t\t\tchunk.prependRight(indentStr);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis._splitChunk(chunk, charIndex);\n\t\t\t\t\t\t\t\tchunk = chunk.next;\n\t\t\t\t\t\t\t\tchunk.prependRight(indentStr);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tcharIndex += 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcharIndex = chunk.end;\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\tthis.outro = this.outro.replace(pattern, replacer);\n\n\t\treturn this;\n\t}\n\n\tinsert() {\n\t\tthrow new Error(\n\t\t\t'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)',\n\t\t);\n\t}\n\n\tinsertLeft(index, content) {\n\t\tif (!warned.insertLeft) {\n\t\t\tconsole.warn(\n\t\t\t\t'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead',\n\t\t\t);\n\t\t\twarned.insertLeft = true;\n\t\t}\n\n\t\treturn this.appendLeft(index, content);\n\t}\n\n\tinsertRight(index, content) {\n\t\tif (!warned.insertRight) {\n\t\t\tconsole.warn(\n\t\t\t\t'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead',\n\t\t\t);\n\t\t\twarned.insertRight = true;\n\t\t}\n\n\t\treturn this.prependRight(index, content);\n\t}\n\n\tmove(start, end, index) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\t\tindex = index + this.offset;\n\n\t\tif (index >= start && index <= end) throw new Error('Cannot move a selection inside itself');\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\t\tthis._split(index);\n\n\t\tconst first = this.byStart[start];\n\t\tconst last = this.byEnd[end];\n\n\t\tconst oldLeft = first.previous;\n\t\tconst oldRight = last.next;\n\n\t\tconst newRight = this.byStart[index];\n\t\tif (!newRight && last === this.lastChunk) return this;\n\t\tconst newLeft = newRight ? newRight.previous : this.lastChunk;\n\n\t\tif (oldLeft) oldLeft.next = oldRight;\n\t\tif (oldRight) oldRight.previous = oldLeft;\n\n\t\tif (newLeft) newLeft.next = first;\n\t\tif (newRight) newRight.previous = last;\n\n\t\tif (!first.previous) this.firstChunk = last.next;\n\t\tif (!last.next) {\n\t\t\tthis.lastChunk = first.previous;\n\t\t\tthis.lastChunk.next = null;\n\t\t}\n\n\t\tfirst.previous = newLeft;\n\t\tlast.next = newRight || null;\n\n\t\tif (!newLeft) this.firstChunk = first;\n\t\tif (!newRight) this.lastChunk = last;\n\t\treturn this;\n\t}\n\n\toverwrite(start, end, content, options) {\n\t\toptions = options || {};\n\t\treturn this.update(start, end, content, { ...options, overwrite: !options.contentOnly });\n\t}\n\n\tupdate(start, end, content, options) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('replacement content must be a string');\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tif (end > this.original.length) throw new Error('end is out of bounds');\n\t\tif (start === end)\n\t\t\tthrow new Error(\n\t\t\t\t'Cannot overwrite a zero-length range – use appendLeft or prependRight instead',\n\t\t\t);\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\n\t\tif (options === true) {\n\t\t\tif (!warned.storeName) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string',\n\t\t\t\t);\n\t\t\t\twarned.storeName = true;\n\t\t\t}\n\n\t\t\toptions = { storeName: true };\n\t\t}\n\t\tconst storeName = options !== undefined ? options.storeName : false;\n\t\tconst overwrite = options !== undefined ? options.overwrite : false;\n\n\t\tif (storeName) {\n\t\t\tconst original = this.original.slice(start, end);\n\t\t\tObject.defineProperty(this.storedNames, original, {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: true,\n\t\t\t\tenumerable: true,\n\t\t\t});\n\t\t}\n\n\t\tconst first = this.byStart[start];\n\t\tconst last = this.byEnd[end];\n\n\t\tif (first) {\n\t\t\tlet chunk = first;\n\t\t\twhile (chunk !== last) {\n\t\t\t\tif (chunk.next !== this.byStart[chunk.end]) {\n\t\t\t\t\tthrow new Error('Cannot overwrite across a split point');\n\t\t\t\t}\n\t\t\t\tchunk = chunk.next;\n\t\t\t\tchunk.edit('', false);\n\t\t\t}\n\n\t\t\tfirst.edit(content, storeName, !overwrite);\n\t\t} else {\n\t\t\t// must be inserting at the end\n\t\t\tconst newChunk = new Chunk(start, end, '').edit(content, storeName);\n\n\t\t\t// TODO last chunk in the array may not be the last chunk, if it's moved...\n\t\t\tlast.next = newChunk;\n\t\t\tnewChunk.previous = last;\n\t\t}\n\t\treturn this;\n\t}\n\n\tprepend(content) {\n\t\tif (typeof content !== 'string') throw new TypeError('outro content must be a string');\n\n\t\tthis.intro = content + this.intro;\n\t\treturn this;\n\t}\n\n\tprependLeft(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byEnd[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.prependLeft(content);\n\t\t} else {\n\t\t\tthis.intro = content + this.intro;\n\t\t}\n\t\treturn this;\n\t}\n\n\tprependRight(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byStart[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.prependRight(content);\n\t\t} else {\n\t\t\tthis.outro = content + this.outro;\n\t\t}\n\t\treturn this;\n\t}\n\n\tremove(start, end) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tif (start === end) return this;\n\n\t\tif (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');\n\t\tif (start > end) throw new Error('end must be greater than start');\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\n\t\tlet chunk = this.byStart[start];\n\n\t\twhile (chunk) {\n\t\t\tchunk.intro = '';\n\t\t\tchunk.outro = '';\n\t\t\tchunk.edit('');\n\n\t\t\tchunk = end > chunk.end ? this.byStart[chunk.end] : null;\n\t\t}\n\t\treturn this;\n\t}\n\n\treset(start, end) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tif (start === end) return this;\n\n\t\tif (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');\n\t\tif (start > end) throw new Error('end must be greater than start');\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\n\t\tlet chunk = this.byStart[start];\n\n\t\twhile (chunk) {\n\t\t\tchunk.reset();\n\n\t\t\tchunk = end > chunk.end ? this.byStart[chunk.end] : null;\n\t\t}\n\t\treturn this;\n\t}\n\n\tlastChar() {\n\t\tif (this.outro.length) return this.outro[this.outro.length - 1];\n\t\tlet chunk = this.lastChunk;\n\t\tdo {\n\t\t\tif (chunk.outro.length) return chunk.outro[chunk.outro.length - 1];\n\t\t\tif (chunk.content.length) return chunk.content[chunk.content.length - 1];\n\t\t\tif (chunk.intro.length) return chunk.intro[chunk.intro.length - 1];\n\t\t} while ((chunk = chunk.previous));\n\t\tif (this.intro.length) return this.intro[this.intro.length - 1];\n\t\treturn '';\n\t}\n\n\tlastLine() {\n\t\tlet lineIndex = this.outro.lastIndexOf(n);\n\t\tif (lineIndex !== -1) return this.outro.substr(lineIndex + 1);\n\t\tlet lineStr = this.outro;\n\t\tlet chunk = this.lastChunk;\n\t\tdo {\n\t\t\tif (chunk.outro.length > 0) {\n\t\t\t\tlineIndex = chunk.outro.lastIndexOf(n);\n\t\t\t\tif (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;\n\t\t\t\tlineStr = chunk.outro + lineStr;\n\t\t\t}\n\n\t\t\tif (chunk.content.length > 0) {\n\t\t\t\tlineIndex = chunk.content.lastIndexOf(n);\n\t\t\t\tif (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;\n\t\t\t\tlineStr = chunk.content + lineStr;\n\t\t\t}\n\n\t\t\tif (chunk.intro.length > 0) {\n\t\t\t\tlineIndex = chunk.intro.lastIndexOf(n);\n\t\t\t\tif (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;\n\t\t\t\tlineStr = chunk.intro + lineStr;\n\t\t\t}\n\t\t} while ((chunk = chunk.previous));\n\t\tlineIndex = this.intro.lastIndexOf(n);\n\t\tif (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;\n\t\treturn this.intro + lineStr;\n\t}\n\n\tslice(start = 0, end = this.original.length - this.offset) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tlet result = '';\n\n\t\t// find start chunk\n\t\tlet chunk = this.firstChunk;\n\t\twhile (chunk && (chunk.start > start || chunk.end <= start)) {\n\t\t\t// found end chunk before start\n\t\t\tif (chunk.start < end && chunk.end >= end) {\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\tif (chunk && chunk.edited && chunk.start !== start)\n\t\t\tthrow new Error(`Cannot use replaced character ${start} as slice start anchor.`);\n\n\t\tconst startChunk = chunk;\n\t\twhile (chunk) {\n\t\t\tif (chunk.intro && (startChunk !== chunk || chunk.start === start)) {\n\t\t\t\tresult += chunk.intro;\n\t\t\t}\n\n\t\t\tconst containsEnd = chunk.start < end && chunk.end >= end;\n\t\t\tif (containsEnd && chunk.edited && chunk.end !== end)\n\t\t\t\tthrow new Error(`Cannot use replaced character ${end} as slice end anchor.`);\n\n\t\t\tconst sliceStart = startChunk === chunk ? start - chunk.start : 0;\n\t\t\tconst sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;\n\n\t\t\tresult += chunk.content.slice(sliceStart, sliceEnd);\n\n\t\t\tif (chunk.outro && (!containsEnd || chunk.end === end)) {\n\t\t\t\tresult += chunk.outro;\n\t\t\t}\n\n\t\t\tif (containsEnd) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// TODO deprecate this? not really very useful\n\tsnip(start, end) {\n\t\tconst clone = this.clone();\n\t\tclone.remove(0, start);\n\t\tclone.remove(end, clone.original.length);\n\n\t\treturn clone;\n\t}\n\n\t_split(index) {\n\t\tif (this.byStart[index] || this.byEnd[index]) return;\n\n\t\tlet chunk = this.lastSearchedChunk;\n\t\tlet previousChunk = chunk;\n\t\tconst searchForward = index > chunk.end;\n\n\t\twhile (chunk) {\n\t\t\tif (chunk.contains(index)) return this._splitChunk(chunk, index);\n\n\t\t\tchunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];\n\n\t\t\t// Prevent infinite loop (e.g. via empty chunks, where start === end)\n\t\t\tif (chunk === previousChunk) return;\n\n\t\t\tpreviousChunk = chunk;\n\t\t}\n\t}\n\n\t_splitChunk(chunk, index) {\n\t\tif (chunk.edited && chunk.content.length) {\n\t\t\t// zero-length edited chunks are a special case (overlapping replacements)\n\t\t\tconst loc = getLocator(this.original)(index);\n\t\t\tthrow new Error(\n\t\t\t\t`Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – \"${chunk.original}\")`,\n\t\t\t);\n\t\t}\n\n\t\tconst newChunk = chunk.split(index);\n\n\t\tthis.byEnd[index] = chunk;\n\t\tthis.byStart[index] = newChunk;\n\t\tthis.byEnd[newChunk.end] = newChunk;\n\n\t\tif (chunk === this.lastChunk) this.lastChunk = newChunk;\n\n\t\tthis.lastSearchedChunk = chunk;\n\t\treturn true;\n\t}\n\n\ttoString() {\n\t\tlet str = this.intro;\n\n\t\tlet chunk = this.firstChunk;\n\t\twhile (chunk) {\n\t\t\tstr += chunk.toString();\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\treturn str + this.outro;\n\t}\n\n\tisEmpty() {\n\t\tlet chunk = this.firstChunk;\n\t\tdo {\n\t\t\tif (\n\t\t\t\t(chunk.intro.length && chunk.intro.trim()) ||\n\t\t\t\t(chunk.content.length && chunk.content.trim()) ||\n\t\t\t\t(chunk.outro.length && chunk.outro.trim())\n\t\t\t)\n\t\t\t\treturn false;\n\t\t} while ((chunk = chunk.next));\n\t\treturn true;\n\t}\n\n\tlength() {\n\t\tlet chunk = this.firstChunk;\n\t\tlet length = 0;\n\t\tdo {\n\t\t\tlength += chunk.intro.length + chunk.content.length + chunk.outro.length;\n\t\t} while ((chunk = chunk.next));\n\t\treturn length;\n\t}\n\n\ttrimLines() {\n\t\treturn this.trim('[\\\\r\\\\n]');\n\t}\n\n\ttrim(charType) {\n\t\treturn this.trimStart(charType).trimEnd(charType);\n\t}\n\n\ttrimEndAborted(charType) {\n\t\tconst rx = new RegExp((charType || '\\\\s') + '+$');\n\n\t\tthis.outro = this.outro.replace(rx, '');\n\t\tif (this.outro.length) return true;\n\n\t\tlet chunk = this.lastChunk;\n\n\t\tdo {\n\t\t\tconst end = chunk.end;\n\t\t\tconst aborted = chunk.trimEnd(rx);\n\n\t\t\t// if chunk was trimmed, we have a new lastChunk\n\t\t\tif (chunk.end !== end) {\n\t\t\t\tif (this.lastChunk === chunk) {\n\t\t\t\t\tthis.lastChunk = chunk.next;\n\t\t\t\t}\n\n\t\t\t\tthis.byEnd[chunk.end] = chunk;\n\t\t\t\tthis.byStart[chunk.next.start] = chunk.next;\n\t\t\t\tthis.byEnd[chunk.next.end] = chunk.next;\n\t\t\t}\n\n\t\t\tif (aborted) return true;\n\t\t\tchunk = chunk.previous;\n\t\t} while (chunk);\n\n\t\treturn false;\n\t}\n\n\ttrimEnd(charType) {\n\t\tthis.trimEndAborted(charType);\n\t\treturn this;\n\t}\n\ttrimStartAborted(charType) {\n\t\tconst rx = new RegExp('^' + (charType || '\\\\s') + '+');\n\n\t\tthis.intro = this.intro.replace(rx, '');\n\t\tif (this.intro.length) return true;\n\n\t\tlet chunk = this.firstChunk;\n\n\t\tdo {\n\t\t\tconst end = chunk.end;\n\t\t\tconst aborted = chunk.trimStart(rx);\n\n\t\t\tif (chunk.end !== end) {\n\t\t\t\t// special case...\n\t\t\t\tif (chunk === this.lastChunk) this.lastChunk = chunk.next;\n\n\t\t\t\tthis.byEnd[chunk.end] = chunk;\n\t\t\t\tthis.byStart[chunk.next.start] = chunk.next;\n\t\t\t\tthis.byEnd[chunk.next.end] = chunk.next;\n\t\t\t}\n\n\t\t\tif (aborted) return true;\n\t\t\tchunk = chunk.next;\n\t\t} while (chunk);\n\n\t\treturn false;\n\t}\n\n\ttrimStart(charType) {\n\t\tthis.trimStartAborted(charType);\n\t\treturn this;\n\t}\n\n\thasChanged() {\n\t\treturn this.original !== this.toString();\n\t}\n\n\t_replaceRegexp(searchValue, replacement) {\n\t\tfunction getReplacement(match, str) {\n\t\t\tif (typeof replacement === 'string') {\n\t\t\t\treturn replacement.replace(/\\$(\\$|&|\\d+)/g, (_, i) => {\n\t\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter\n\t\t\t\t\tif (i === '$') return '$';\n\t\t\t\t\tif (i === '&') return match[0];\n\t\t\t\t\tconst num = +i;\n\t\t\t\t\tif (num < match.length) return match[+i];\n\t\t\t\t\treturn `$${i}`;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\treturn replacement(...match, match.index, str, match.groups);\n\t\t\t}\n\t\t}\n\t\tfunction matchAll(re, str) {\n\t\t\tlet match;\n\t\t\tconst matches = [];\n\t\t\twhile ((match = re.exec(str))) {\n\t\t\t\tmatches.push(match);\n\t\t\t}\n\t\t\treturn matches;\n\t\t}\n\t\tif (searchValue.global) {\n\t\t\tconst matches = matchAll(searchValue, this.original);\n\t\t\tmatches.forEach((match) => {\n\t\t\t\tif (match.index != null) {\n\t\t\t\t\tconst replacement = getReplacement(match, this.original);\n\t\t\t\t\tif (replacement !== match[0]) {\n\t\t\t\t\t\tthis.overwrite(match.index, match.index + match[0].length, replacement);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tconst match = this.original.match(searchValue);\n\t\t\tif (match && match.index != null) {\n\t\t\t\tconst replacement = getReplacement(match, this.original);\n\t\t\t\tif (replacement !== match[0]) {\n\t\t\t\t\tthis.overwrite(match.index, match.index + match[0].length, replacement);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\t_replaceString(string, replacement) {\n\t\tconst { original } = this;\n\t\tconst index = original.indexOf(string);\n\n\t\tif (index !== -1) {\n\t\t\tif (typeof replacement === 'function') {\n\t\t\t\treplacement = replacement(string, index, original);\n\t\t\t}\n\t\t\tif (string !== replacement) {\n\t\t\t\tthis.overwrite(index, index + string.length, replacement);\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n\n\treplace(searchValue, replacement) {\n\t\tif (typeof searchValue === 'string') {\n\t\t\treturn this._replaceString(searchValue, replacement);\n\t\t}\n\n\t\treturn this._replaceRegexp(searchValue, replacement);\n\t}\n\n\t_replaceAllString(string, replacement) {\n\t\tconst { original } = this;\n\t\tconst stringLength = string.length;\n\t\tfor (\n\t\t\tlet index = original.indexOf(string);\n\t\t\tindex !== -1;\n\t\t\tindex = original.indexOf(string, index + stringLength)\n\t\t) {\n\t\t\tconst previous = original.slice(index, index + stringLength);\n\t\t\tlet _replacement = replacement;\n\t\t\tif (typeof replacement === 'function') {\n\t\t\t\t_replacement = replacement(previous, index, original);\n\t\t\t}\n\t\t\tif (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\treplaceAll(searchValue, replacement) {\n\t\tif (typeof searchValue === 'string') {\n\t\t\treturn this._replaceAllString(searchValue, replacement);\n\t\t}\n\n\t\tif (!searchValue.global) {\n\t\t\tthrow new TypeError(\n\t\t\t\t'MagicString.prototype.replaceAll called with a non-global RegExp argument',\n\t\t\t);\n\t\t}\n\n\t\treturn this._replaceRegexp(searchValue, replacement);\n\t}\n}\n\nconst hasOwnProp = Object.prototype.hasOwnProperty;\n\nclass Bundle {\n\tconstructor(options = {}) {\n\t\tthis.intro = options.intro || '';\n\t\tthis.separator = options.separator !== undefined ? options.separator : '\\n';\n\t\tthis.sources = [];\n\t\tthis.uniqueSources = [];\n\t\tthis.uniqueSourceIndexByFilename = {};\n\t}\n\n\taddSource(source) {\n\t\tif (source instanceof MagicString) {\n\t\t\treturn this.addSource({\n\t\t\t\tcontent: source,\n\t\t\t\tfilename: source.filename,\n\t\t\t\tseparator: this.separator,\n\t\t\t});\n\t\t}\n\n\t\tif (!isObject(source) || !source.content) {\n\t\t\tthrow new Error(\n\t\t\t\t'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`',\n\t\t\t);\n\t\t}\n\n\t\t['filename', 'ignoreList', 'indentExclusionRanges', 'separator'].forEach((option) => {\n\t\t\tif (!hasOwnProp.call(source, option)) source[option] = source.content[option];\n\t\t});\n\n\t\tif (source.separator === undefined) {\n\t\t\t// TODO there's a bunch of this sort of thing, needs cleaning up\n\t\t\tsource.separator = this.separator;\n\t\t}\n\n\t\tif (source.filename) {\n\t\t\tif (!hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) {\n\t\t\t\tthis.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length;\n\t\t\t\tthis.uniqueSources.push({ filename: source.filename, content: source.content.original });\n\t\t\t} else {\n\t\t\t\tconst uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]];\n\t\t\t\tif (source.content.original !== uniqueSource.content) {\n\t\t\t\t\tthrow new Error(`Illegal source: same filename (${source.filename}), different contents`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.sources.push(source);\n\t\treturn this;\n\t}\n\n\tappend(str, options) {\n\t\tthis.addSource({\n\t\t\tcontent: new MagicString(str),\n\t\t\tseparator: (options && options.separator) || '',\n\t\t});\n\n\t\treturn this;\n\t}\n\n\tclone() {\n\t\tconst bundle = new Bundle({\n\t\t\tintro: this.intro,\n\t\t\tseparator: this.separator,\n\t\t});\n\n\t\tthis.sources.forEach((source) => {\n\t\t\tbundle.addSource({\n\t\t\t\tfilename: source.filename,\n\t\t\t\tcontent: source.content.clone(),\n\t\t\t\tseparator: source.separator,\n\t\t\t});\n\t\t});\n\n\t\treturn bundle;\n\t}\n\n\tgenerateDecodedMap(options = {}) {\n\t\tconst names = [];\n\t\tlet x_google_ignoreList = undefined;\n\t\tthis.sources.forEach((source) => {\n\t\t\tObject.keys(source.content.storedNames).forEach((name) => {\n\t\t\t\tif (!~names.indexOf(name)) names.push(name);\n\t\t\t});\n\t\t});\n\n\t\tconst mappings = new Mappings(options.hires);\n\n\t\tif (this.intro) {\n\t\t\tmappings.advance(this.intro);\n\t\t}\n\n\t\tthis.sources.forEach((source, i) => {\n\t\t\tif (i > 0) {\n\t\t\t\tmappings.advance(this.separator);\n\t\t\t}\n\n\t\t\tconst sourceIndex = source.filename ? this.uniqueSourceIndexByFilename[source.filename] : -1;\n\t\t\tconst magicString = source.content;\n\t\t\tconst locate = getLocator(magicString.original);\n\n\t\t\tif (magicString.intro) {\n\t\t\t\tmappings.advance(magicString.intro);\n\t\t\t}\n\n\t\t\tmagicString.firstChunk.eachNext((chunk) => {\n\t\t\t\tconst loc = locate(chunk.start);\n\n\t\t\t\tif (chunk.intro.length) mappings.advance(chunk.intro);\n\n\t\t\t\tif (source.filename) {\n\t\t\t\t\tif (chunk.edited) {\n\t\t\t\t\t\tmappings.addEdit(\n\t\t\t\t\t\t\tsourceIndex,\n\t\t\t\t\t\t\tchunk.content,\n\t\t\t\t\t\t\tloc,\n\t\t\t\t\t\t\tchunk.storeName ? names.indexOf(chunk.original) : -1,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmappings.addUneditedChunk(\n\t\t\t\t\t\t\tsourceIndex,\n\t\t\t\t\t\t\tchunk,\n\t\t\t\t\t\t\tmagicString.original,\n\t\t\t\t\t\t\tloc,\n\t\t\t\t\t\t\tmagicString.sourcemapLocations,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tmappings.advance(chunk.content);\n\t\t\t\t}\n\n\t\t\t\tif (chunk.outro.length) mappings.advance(chunk.outro);\n\t\t\t});\n\n\t\t\tif (magicString.outro) {\n\t\t\t\tmappings.advance(magicString.outro);\n\t\t\t}\n\n\t\t\tif (source.ignoreList && sourceIndex !== -1) {\n\t\t\t\tif (x_google_ignoreList === undefined) {\n\t\t\t\t\tx_google_ignoreList = [];\n\t\t\t\t}\n\t\t\t\tx_google_ignoreList.push(sourceIndex);\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tfile: options.file ? options.file.split(/[/\\\\]/).pop() : undefined,\n\t\t\tsources: this.uniqueSources.map((source) => {\n\t\t\t\treturn options.file ? getRelativePath(options.file, source.filename) : source.filename;\n\t\t\t}),\n\t\t\tsourcesContent: this.uniqueSources.map((source) => {\n\t\t\t\treturn options.includeContent ? source.content : null;\n\t\t\t}),\n\t\t\tnames,\n\t\t\tmappings: mappings.raw,\n\t\t\tx_google_ignoreList,\n\t\t};\n\t}\n\n\tgenerateMap(options) {\n\t\treturn new SourceMap(this.generateDecodedMap(options));\n\t}\n\n\tgetIndentString() {\n\t\tconst indentStringCounts = {};\n\n\t\tthis.sources.forEach((source) => {\n\t\t\tconst indentStr = source.content._getRawIndentString();\n\n\t\t\tif (indentStr === null) return;\n\n\t\t\tif (!indentStringCounts[indentStr]) indentStringCounts[indentStr] = 0;\n\t\t\tindentStringCounts[indentStr] += 1;\n\t\t});\n\n\t\treturn (\n\t\t\tObject.keys(indentStringCounts).sort((a, b) => {\n\t\t\t\treturn indentStringCounts[a] - indentStringCounts[b];\n\t\t\t})[0] || '\\t'\n\t\t);\n\t}\n\n\tindent(indentStr) {\n\t\tif (!arguments.length) {\n\t\t\tindentStr = this.getIndentString();\n\t\t}\n\n\t\tif (indentStr === '') return this; // noop\n\n\t\tlet trailingNewline = !this.intro || this.intro.slice(-1) === '\\n';\n\n\t\tthis.sources.forEach((source, i) => {\n\t\t\tconst separator = source.separator !== undefined ? source.separator : this.separator;\n\t\t\tconst indentStart = trailingNewline || (i > 0 && /\\r?\\n$/.test(separator));\n\n\t\t\tsource.content.indent(indentStr, {\n\t\t\t\texclude: source.indentExclusionRanges,\n\t\t\t\tindentStart, //: trailingNewline || /\\r?\\n$/.test( separator ) //true///\\r?\\n/.test( separator )\n\t\t\t});\n\n\t\t\ttrailingNewline = source.content.lastChar() === '\\n';\n\t\t});\n\n\t\tif (this.intro) {\n\t\t\tthis.intro =\n\t\t\t\tindentStr +\n\t\t\t\tthis.intro.replace(/^[^\\n]/gm, (match, index) => {\n\t\t\t\t\treturn index > 0 ? indentStr + match : match;\n\t\t\t\t});\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tprepend(str) {\n\t\tthis.intro = str + this.intro;\n\t\treturn this;\n\t}\n\n\ttoString() {\n\t\tconst body = this.sources\n\t\t\t.map((source, i) => {\n\t\t\t\tconst separator = source.separator !== undefined ? source.separator : this.separator;\n\t\t\t\tconst str = (i > 0 ? separator : '') + source.content.toString();\n\n\t\t\t\treturn str;\n\t\t\t})\n\t\t\t.join('');\n\n\t\treturn this.intro + body;\n\t}\n\n\tisEmpty() {\n\t\tif (this.intro.length && this.intro.trim()) return false;\n\t\tif (this.sources.some((source) => !source.content.isEmpty())) return false;\n\t\treturn true;\n\t}\n\n\tlength() {\n\t\treturn this.sources.reduce(\n\t\t\t(length, source) => length + source.content.length(),\n\t\t\tthis.intro.length,\n\t\t);\n\t}\n\n\ttrimLines() {\n\t\treturn this.trim('[\\\\r\\\\n]');\n\t}\n\n\ttrim(charType) {\n\t\treturn this.trimStart(charType).trimEnd(charType);\n\t}\n\n\ttrimStart(charType) {\n\t\tconst rx = new RegExp('^' + (charType || '\\\\s') + '+');\n\t\tthis.intro = this.intro.replace(rx, '');\n\n\t\tif (!this.intro) {\n\t\t\tlet source;\n\t\t\tlet i = 0;\n\n\t\t\tdo {\n\t\t\t\tsource = this.sources[i++];\n\t\t\t\tif (!source) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} while (!source.content.trimStartAborted(charType));\n\t\t}\n\n\t\treturn this;\n\t}\n\n\ttrimEnd(charType) {\n\t\tconst rx = new RegExp((charType || '\\\\s') + '+$');\n\n\t\tlet source;\n\t\tlet i = this.sources.length - 1;\n\n\t\tdo {\n\t\t\tsource = this.sources[i--];\n\t\t\tif (!source) {\n\t\t\t\tthis.intro = this.intro.replace(rx, '');\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} while (!source.content.trimEndAborted(charType));\n\n\t\treturn this;\n\t}\n}\n\nexport { Bundle, SourceMap, MagicString as default };\n//# sourceMappingURL=magic-string.es.mjs.map\n","/** @typedef {import('./types').Location} Location */\n\n/**\n * @param {import('./types').Range} range\n * @param {number} index\n */\nfunction rangeContains(range, index) {\n\treturn range.start <= index && index < range.end;\n}\n\n/**\n * @param {string} source\n * @param {import('./types').Options} [options]\n */\nexport function getLocator(source, options = {}) {\n\tconst { offsetLine = 0, offsetColumn = 0 } = options;\n\n\tlet start = 0;\n\tconst ranges = source.split('\\n').map((line, i) => {\n\t\tconst end = start + line.length + 1;\n\n\t\t/** @type {import('./types').Range} */\n\t\tconst range = { start, end, line: i };\n\n\t\tstart = end;\n\t\treturn range;\n\t});\n\n\tlet i = 0;\n\n\t/**\n\t * @param {string | number} search\n\t * @param {number} [index]\n\t * @returns {Location | undefined}\n\t */\n\tfunction locator(search, index) {\n\t\tif (typeof search === 'string') {\n\t\t\tsearch = source.indexOf(search, index ?? 0);\n\t\t}\n\n\t\tif (search === -1) return undefined;\n\n\t\tlet range = ranges[i];\n\n\t\tconst d = search >= range.end ? 1 : -1;\n\n\t\twhile (range) {\n\t\t\tif (rangeContains(range, search)) {\n\t\t\t\treturn {\n\t\t\t\t\tline: offsetLine + range.line,\n\t\t\t\t\tcolumn: offsetColumn + search - range.start,\n\t\t\t\t\tcharacter: search\n\t\t\t\t};\n\t\t\t}\n\n\t\t\ti += d;\n\t\t\trange = ranges[i];\n\t\t}\n\t}\n\n\treturn locator;\n}\n\n/**\n * @param {string} source\n * @param {string | number} search\n * @param {import('./types').Options} [options]\n * @returns {Location | undefined}\n */\nexport function locate(source, search, options) {\n\treturn getLocator(source, options)(search, options && options.startIndex);\n}\n","// Matches the scheme of a URL, eg \"http://\"\nconst schemeRegex = /^[\\w+.-]+:\\/\\//;\n/**\n * Matches the parts of a URL:\n * 1. Scheme, including \":\", guaranteed.\n * 2. User/password, including \"@\", optional.\n * 3. Host, guaranteed.\n * 4. Port, including \":\", optional.\n * 5. Path, including \"/\", optional.\n * 6. Query, including \"?\", optional.\n * 7. Hash, including \"#\", optional.\n */\nconst urlRegex = /^([\\w+.-]+:)\\/\\/([^@/#?]*@)?([^:/#?]*)(:\\d+)?(\\/[^#?]*)?(\\?[^#]*)?(#.*)?/;\n/**\n * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start\n * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).\n *\n * 1. Host, optional.\n * 2. Path, which may include \"/\", guaranteed.\n * 3. Query, including \"?\", optional.\n * 4. Hash, including \"#\", optional.\n */\nconst fileRegex = /^file:(?:\\/\\/((?![a-z]:)[^/#?]*)?)?(\\/?[^#?]*)(\\?[^#]*)?(#.*)?/i;\nfunction isAbsoluteUrl(input) {\n return schemeRegex.test(input);\n}\nfunction isSchemeRelativeUrl(input) {\n return input.startsWith('//');\n}\nfunction isAbsolutePath(input) {\n return input.startsWith('/');\n}\nfunction isFileUrl(input) {\n return input.startsWith('file:');\n}\nfunction isRelative(input) {\n return /^[.?#]/.test(input);\n}\nfunction parseAbsoluteUrl(input) {\n const match = urlRegex.exec(input);\n return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || '');\n}\nfunction parseFileUrl(input) {\n const match = fileRegex.exec(input);\n const path = match[2];\n return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || '');\n}\nfunction makeUrl(scheme, user, host, port, path, query, hash) {\n return {\n scheme,\n user,\n host,\n port,\n path,\n query,\n hash,\n type: 7 /* Absolute */,\n };\n}\nfunction parseUrl(input) {\n if (isSchemeRelativeUrl(input)) {\n const url = parseAbsoluteUrl('http:' + input);\n url.scheme = '';\n url.type = 6 /* SchemeRelative */;\n return url;\n }\n if (isAbsolutePath(input)) {\n const url = parseAbsoluteUrl('http://foo.com' + input);\n url.scheme = '';\n url.host = '';\n url.type = 5 /* AbsolutePath */;\n return url;\n }\n if (isFileUrl(input))\n return parseFileUrl(input);\n if (isAbsoluteUrl(input))\n return parseAbsoluteUrl(input);\n const url = parseAbsoluteUrl('http://foo.com/' + input);\n url.scheme = '';\n url.host = '';\n url.type = input\n ? input.startsWith('?')\n ? 3 /* Query */\n : input.startsWith('#')\n ? 2 /* Hash */\n : 4 /* RelativePath */\n : 1 /* Empty */;\n return url;\n}\nfunction stripPathFilename(path) {\n // If a path ends with a parent directory \"..\", then it's a relative path with excess parent\n // paths. It's not a file, so we can't strip it.\n if (path.endsWith('/..'))\n return path;\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}\nfunction mergePaths(url, base) {\n normalizePath(base, base.type);\n // If the path is just a \"/\", then it was an empty path to begin with (remember, we're a relative\n // path).\n if (url.path === '/') {\n url.path = base.path;\n }\n else {\n // Resolution happens relative to the base path's directory, not the file.\n url.path = stripPathFilename(base.path) + url.path;\n }\n}\n/**\n * The path can have empty directories \"//\", unneeded parents \"foo/..\", or current directory\n * \"foo/.\". We need to normalize to a standard representation.\n */\nfunction normalizePath(url, type) {\n const rel = type <= 4 /* RelativePath */;\n const pieces = url.path.split('/');\n // We need to preserve the first piece always, so that we output a leading slash. The item at\n // pieces[0] is an empty string.\n let pointer = 1;\n // Positive is the number of real directories we've output, used for popping a parent directory.\n // Eg, \"foo/bar/..\" will have a positive 2, and we can decrement to be left with just \"foo\".\n let positive = 0;\n // We need to keep a trailing slash if we encounter an empty directory (eg, splitting \"foo/\" will\n // generate `[\"foo\", \"\"]` pieces). And, if we pop a parent directory. But once we encounter a\n // real directory, we won't need to append, unless the other conditions happen again.\n let addTrailingSlash = false;\n for (let i = 1; i < pieces.length; i++) {\n const piece = pieces[i];\n // An empty directory, could be a trailing slash, or just a double \"//\" in the path.\n if (!piece) {\n addTrailingSlash = true;\n continue;\n }\n // If we encounter a real directory, then we don't need to append anymore.\n addTrailingSlash = false;\n // A current directory, which we can always drop.\n if (piece === '.')\n continue;\n // A parent directory, we need to see if there are any real directories we can pop. Else, we\n // have an excess of parents, and we'll need to keep the \"..\".\n if (piece === '..') {\n if (positive) {\n addTrailingSlash = true;\n positive--;\n pointer--;\n }\n else if (rel) {\n // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute\n // URL, protocol relative URL, or an absolute path, we don't need to keep excess.\n pieces[pointer++] = piece;\n }\n continue;\n }\n // We've encountered a real directory. Move it to the next insertion pointer, which accounts for\n // any popped or dropped directories.\n pieces[pointer++] = piece;\n positive++;\n }\n let path = '';\n for (let i = 1; i < pointer; i++) {\n path += '/' + pieces[i];\n }\n if (!path || (addTrailingSlash && !path.endsWith('/..'))) {\n path += '/';\n }\n url.path = path;\n}\n/**\n * Attempts to resolve `input` URL/path relative to `base`.\n */\nfunction resolve(input, base) {\n if (!input && !base)\n return '';\n const url = parseUrl(input);\n let inputType = url.type;\n if (base && inputType !== 7 /* Absolute */) {\n const baseUrl = parseUrl(base);\n const baseType = baseUrl.type;\n switch (inputType) {\n case 1 /* Empty */:\n url.hash = baseUrl.hash;\n // fall through\n case 2 /* Hash */:\n url.query = baseUrl.query;\n // fall through\n case 3 /* Query */:\n case 4 /* RelativePath */:\n mergePaths(url, baseUrl);\n // fall through\n case 5 /* AbsolutePath */:\n // The host, user, and port are joined, you can't copy one without the others.\n url.user = baseUrl.user;\n url.host = baseUrl.host;\n url.port = baseUrl.port;\n // fall through\n case 6 /* SchemeRelative */:\n // The input doesn't have a schema at least, so we need to copy at least that over.\n url.scheme = baseUrl.scheme;\n }\n if (baseType > inputType)\n inputType = baseType;\n }\n normalizePath(url, inputType);\n const queryHash = url.query + url.hash;\n switch (inputType) {\n // This is impossible, because of the empty checks at the start of the function.\n // case UrlType.Empty:\n case 2 /* Hash */:\n case 3 /* Query */:\n return queryHash;\n case 4 /* RelativePath */: {\n // The first char is always a \"/\", and we need it to be relative.\n const path = url.path.slice(1);\n if (!path)\n return queryHash || '.';\n if (isRelative(base || input) && !isRelative(path)) {\n // If base started with a leading \".\", or there is no base and input started with a \".\",\n // then we need to ensure that the relative path starts with a \".\". We don't know if\n // relative starts with a \"..\", though, so check before prepending.\n return './' + path + queryHash;\n }\n return path + queryHash;\n }\n case 5 /* AbsolutePath */:\n return url.path + queryHash;\n default:\n return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;\n }\n}\n\nexport { resolve as default };\n//# sourceMappingURL=resolve-uri.mjs.map\n","// src/trace-mapping.ts\nimport { encode, decode } from \"@jridgewell/sourcemap-codec\";\n\n// src/resolve.ts\nimport resolveUri from \"@jridgewell/resolve-uri\";\n\n// src/strip-filename.ts\nfunction stripFilename(path) {\n if (!path) return \"\";\n const index = path.lastIndexOf(\"/\");\n return path.slice(0, index + 1);\n}\n\n// src/resolve.ts\nfunction resolver(mapUrl, sourceRoot) {\n const from = stripFilename(mapUrl);\n const prefix = sourceRoot ? sourceRoot + \"/\" : \"\";\n return (source) => resolveUri(prefix + (source || \"\"), from);\n}\n\n// src/sourcemap-segment.ts\nvar COLUMN = 0;\nvar SOURCES_INDEX = 1;\nvar SOURCE_LINE = 2;\nvar SOURCE_COLUMN = 3;\nvar NAMES_INDEX = 4;\nvar REV_GENERATED_LINE = 1;\nvar REV_GENERATED_COLUMN = 2;\n\n// src/sort.ts\nfunction maybeSort(mappings, owned) {\n const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);\n if (unsortedIndex === mappings.length) return mappings;\n if (!owned) mappings = mappings.slice();\n for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {\n mappings[i] = sortSegments(mappings[i], owned);\n }\n return mappings;\n}\nfunction nextUnsortedSegmentLine(mappings, start) {\n for (let i = start; i < mappings.length; i++) {\n if (!isSorted(mappings[i])) return i;\n }\n return mappings.length;\n}\nfunction isSorted(line) {\n for (let j = 1; j < line.length; j++) {\n if (line[j][COLUMN] < line[j - 1][COLUMN]) {\n return false;\n }\n }\n return true;\n}\nfunction sortSegments(line, owned) {\n if (!owned) line = line.slice();\n return line.sort(sortComparator);\n}\nfunction sortComparator(a, b) {\n return a[COLUMN] - b[COLUMN];\n}\n\n// src/by-source.ts\nfunction buildBySources(decoded, memos) {\n const sources = memos.map(() => []);\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n if (seg.length === 1) continue;\n const sourceIndex2 = seg[SOURCES_INDEX];\n const sourceLine = seg[SOURCE_LINE];\n const sourceColumn = seg[SOURCE_COLUMN];\n const source = sources[sourceIndex2];\n const segs = source[sourceLine] || (source[sourceLine] = []);\n segs.push([sourceColumn, i, seg[COLUMN]]);\n }\n }\n for (let i = 0; i < sources.length; i++) {\n const source = sources[i];\n for (let j = 0; j < source.length; j++) {\n const line = source[j];\n if (line) line.sort(sortComparator);\n }\n }\n return sources;\n}\n\n// src/binary-search.ts\nvar found = false;\nfunction binarySearch(haystack, needle, low, high) {\n while (low <= high) {\n const mid = low + (high - low >> 1);\n const cmp = haystack[mid][COLUMN] - needle;\n if (cmp === 0) {\n found = true;\n return mid;\n }\n if (cmp < 0) {\n low = mid + 1;\n } else {\n high = mid - 1;\n }\n }\n found = false;\n return low - 1;\n}\nfunction upperBound(haystack, needle, index) {\n for (let i = index + 1; i < haystack.length; index = i++) {\n if (haystack[i][COLUMN] !== needle) break;\n }\n return index;\n}\nfunction lowerBound(haystack, needle, index) {\n for (let i = index - 1; i >= 0; index = i--) {\n if (haystack[i][COLUMN] !== needle) break;\n }\n return index;\n}\nfunction memoizedState() {\n return {\n lastKey: -1,\n lastNeedle: -1,\n lastIndex: -1\n };\n}\nfunction memoizedBinarySearch(haystack, needle, state, key) {\n const { lastKey, lastNeedle, lastIndex } = state;\n let low = 0;\n let high = haystack.length - 1;\n if (key === lastKey) {\n if (needle === lastNeedle) {\n found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;\n return lastIndex;\n }\n if (needle >= lastNeedle) {\n low = lastIndex === -1 ? 0 : lastIndex;\n } else {\n high = lastIndex;\n }\n }\n state.lastKey = key;\n state.lastNeedle = needle;\n return state.lastIndex = binarySearch(haystack, needle, low, high);\n}\n\n// src/types.ts\nfunction parse(map) {\n return typeof map === \"string\" ? JSON.parse(map) : map;\n}\n\n// src/flatten-map.ts\nvar FlattenMap = function(map, mapUrl) {\n const parsed = parse(map);\n if (!(\"sections\" in parsed)) {\n return new TraceMap(parsed, mapUrl);\n }\n const mappings = [];\n const sources = [];\n const sourcesContent = [];\n const names = [];\n const ignoreList = [];\n recurse(\n parsed,\n mapUrl,\n mappings,\n sources,\n sourcesContent,\n names,\n ignoreList,\n 0,\n 0,\n Infinity,\n Infinity\n );\n const joined = {\n version: 3,\n file: parsed.file,\n names,\n sources,\n sourcesContent,\n mappings,\n ignoreList\n };\n return presortedDecodedMap(joined);\n};\nfunction recurse(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {\n const { sections } = input;\n for (let i = 0; i < sections.length; i++) {\n const { map, offset } = sections[i];\n let sl = stopLine;\n let sc = stopColumn;\n if (i + 1 < sections.length) {\n const nextOffset = sections[i + 1].offset;\n sl = Math.min(stopLine, lineOffset + nextOffset.line);\n if (sl === stopLine) {\n sc = Math.min(stopColumn, columnOffset + nextOffset.column);\n } else if (sl < stopLine) {\n sc = columnOffset + nextOffset.column;\n }\n }\n addSection(\n map,\n mapUrl,\n mappings,\n sources,\n sourcesContent,\n names,\n ignoreList,\n lineOffset + offset.line,\n columnOffset + offset.column,\n sl,\n sc\n );\n }\n}\nfunction addSection(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {\n const parsed = parse(input);\n if (\"sections\" in parsed) return recurse(...arguments);\n const map = new TraceMap(parsed, mapUrl);\n const sourcesOffset = sources.length;\n const namesOffset = names.length;\n const decoded = decodedMappings(map);\n const { resolvedSources, sourcesContent: contents, ignoreList: ignores } = map;\n append(sources, resolvedSources);\n append(names, map.names);\n if (contents) append(sourcesContent, contents);\n else for (let i = 0; i < resolvedSources.length; i++) sourcesContent.push(null);\n if (ignores) for (let i = 0; i < ignores.length; i++) ignoreList.push(ignores[i] + sourcesOffset);\n for (let i = 0; i < decoded.length; i++) {\n const lineI = lineOffset + i;\n if (lineI > stopLine) return;\n const out = getLine(mappings, lineI);\n const cOffset = i === 0 ? columnOffset : 0;\n const line = decoded[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n const column = cOffset + seg[COLUMN];\n if (lineI === stopLine && column >= stopColumn) return;\n if (seg.length === 1) {\n out.push([column]);\n continue;\n }\n const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX];\n const sourceLine = seg[SOURCE_LINE];\n const sourceColumn = seg[SOURCE_COLUMN];\n out.push(\n seg.length === 4 ? [column, sourcesIndex, sourceLine, sourceColumn] : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]\n );\n }\n }\n}\nfunction append(arr, other) {\n for (let i = 0; i < other.length; i++) arr.push(other[i]);\n}\nfunction getLine(arr, index) {\n for (let i = arr.length; i <= index; i++) arr[i] = [];\n return arr[index];\n}\n\n// src/trace-mapping.ts\nvar LINE_GTR_ZERO = \"`line` must be greater than 0 (lines start at line 1)\";\nvar COL_GTR_EQ_ZERO = \"`column` must be greater than or equal to 0 (columns start at column 0)\";\nvar LEAST_UPPER_BOUND = -1;\nvar GREATEST_LOWER_BOUND = 1;\nvar TraceMap = class {\n constructor(map, mapUrl) {\n const isString = typeof map === \"string\";\n if (!isString && map._decodedMemo) return map;\n const parsed = parse(map);\n const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;\n this.version = version;\n this.file = file;\n this.names = names || [];\n this.sourceRoot = sourceRoot;\n this.sources = sources;\n this.sourcesContent = sourcesContent;\n this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;\n const resolve = resolver(mapUrl, sourceRoot);\n this.resolvedSources = sources.map(resolve);\n const { mappings } = parsed;\n if (typeof mappings === \"string\") {\n this._encoded = mappings;\n this._decoded = void 0;\n } else if (Array.isArray(mappings)) {\n this._encoded = void 0;\n this._decoded = maybeSort(mappings, isString);\n } else if (parsed.sections) {\n throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);\n } else {\n throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);\n }\n this._decodedMemo = memoizedState();\n this._bySources = void 0;\n this._bySourceMemos = void 0;\n }\n};\nfunction cast(map) {\n return map;\n}\nfunction encodedMappings(map) {\n var _a, _b;\n return (_b = (_a = cast(map))._encoded) != null ? _b : _a._encoded = encode(cast(map)._decoded);\n}\nfunction decodedMappings(map) {\n var _a;\n return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));\n}\nfunction traceSegment(map, line, column) {\n const decoded = decodedMappings(map);\n if (line >= decoded.length) return null;\n const segments = decoded[line];\n const index = traceSegmentInternal(\n segments,\n cast(map)._decodedMemo,\n line,\n column,\n GREATEST_LOWER_BOUND\n );\n return index === -1 ? null : segments[index];\n}\nfunction originalPositionFor(map, needle) {\n let { line, column, bias } = needle;\n line--;\n if (line < 0) throw new Error(LINE_GTR_ZERO);\n if (column < 0) throw new Error(COL_GTR_EQ_ZERO);\n const decoded = decodedMappings(map);\n if (line >= decoded.length) return OMapping(null, null, null, null);\n const segments = decoded[line];\n const index = traceSegmentInternal(\n segments,\n cast(map)._decodedMemo,\n line,\n column,\n bias || GREATEST_LOWER_BOUND\n );\n if (index === -1) return OMapping(null, null, null, null);\n const segment = segments[index];\n if (segment.length === 1) return OMapping(null, null, null, null);\n const { names, resolvedSources } = map;\n return OMapping(\n resolvedSources[segment[SOURCES_INDEX]],\n segment[SOURCE_LINE] + 1,\n segment[SOURCE_COLUMN],\n segment.length === 5 ? names[segment[NAMES_INDEX]] : null\n );\n}\nfunction generatedPositionFor(map, needle) {\n const { source, line, column, bias } = needle;\n return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false);\n}\nfunction allGeneratedPositionsFor(map, needle) {\n const { source, line, column, bias } = needle;\n return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true);\n}\nfunction eachMapping(map, cb) {\n const decoded = decodedMappings(map);\n const { names, resolvedSources } = map;\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n const generatedLine = i + 1;\n const generatedColumn = seg[0];\n let source = null;\n let originalLine = null;\n let originalColumn = null;\n let name = null;\n if (seg.length !== 1) {\n source = resolvedSources[seg[1]];\n originalLine = seg[2] + 1;\n originalColumn = seg[3];\n }\n if (seg.length === 5) name = names[seg[4]];\n cb({\n generatedLine,\n generatedColumn,\n source,\n originalLine,\n originalColumn,\n name\n });\n }\n }\n}\nfunction sourceIndex(map, source) {\n const { sources, resolvedSources } = map;\n let index = sources.indexOf(source);\n if (index === -1) index = resolvedSources.indexOf(source);\n return index;\n}\nfunction sourceContentFor(map, source) {\n const { sourcesContent } = map;\n if (sourcesContent == null) return null;\n const index = sourceIndex(map, source);\n return index === -1 ? null : sourcesContent[index];\n}\nfunction isIgnored(map, source) {\n const { ignoreList } = map;\n if (ignoreList == null) return false;\n const index = sourceIndex(map, source);\n return index === -1 ? false : ignoreList.includes(index);\n}\nfunction presortedDecodedMap(map, mapUrl) {\n const tracer = new TraceMap(clone(map, []), mapUrl);\n cast(tracer)._decoded = map.mappings;\n return tracer;\n}\nfunction decodedMap(map) {\n return clone(map, decodedMappings(map));\n}\nfunction encodedMap(map) {\n return clone(map, encodedMappings(map));\n}\nfunction clone(map, mappings) {\n return {\n version: map.version,\n file: map.file,\n names: map.names,\n sourceRoot: map.sourceRoot,\n sources: map.sources,\n sourcesContent: map.sourcesContent,\n mappings,\n ignoreList: map.ignoreList || map.x_google_ignoreList\n };\n}\nfunction OMapping(source, line, column, name) {\n return { source, line, column, name };\n}\nfunction GMapping(line, column) {\n return { line, column };\n}\nfunction traceSegmentInternal(segments, memo, line, column, bias) {\n let index = memoizedBinarySearch(segments, column, memo, line);\n if (found) {\n index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);\n } else if (bias === LEAST_UPPER_BOUND) index++;\n if (index === -1 || index === segments.length) return -1;\n return index;\n}\nfunction sliceGeneratedPositions(segments, memo, line, column, bias) {\n let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND);\n if (!found && bias === LEAST_UPPER_BOUND) min++;\n if (min === -1 || min === segments.length) return [];\n const matchedColumn = found ? column : segments[min][COLUMN];\n if (!found) min = lowerBound(segments, matchedColumn, min);\n const max = upperBound(segments, matchedColumn, min);\n const result = [];\n for (; min <= max; min++) {\n const segment = segments[min];\n result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]));\n }\n return result;\n}\nfunction generatedPosition(map, source, line, column, bias, all) {\n var _a, _b;\n line--;\n if (line < 0) throw new Error(LINE_GTR_ZERO);\n if (column < 0) throw new Error(COL_GTR_EQ_ZERO);\n const { sources, resolvedSources } = map;\n let sourceIndex2 = sources.indexOf(source);\n if (sourceIndex2 === -1) sourceIndex2 = resolvedSources.indexOf(source);\n if (sourceIndex2 === -1) return all ? [] : GMapping(null, null);\n const bySourceMemos = (_a = cast(map))._bySourceMemos || (_a._bySourceMemos = sources.map(memoizedState));\n const generated = (_b = cast(map))._bySources || (_b._bySources = buildBySources(decodedMappings(map), bySourceMemos));\n const segments = generated[sourceIndex2][line];\n if (segments == null) return all ? [] : GMapping(null, null);\n const memo = bySourceMemos[sourceIndex2];\n if (all) return sliceGeneratedPositions(segments, memo, line, column, bias);\n const index = traceSegmentInternal(segments, memo, line, column, bias);\n if (index === -1) return GMapping(null, null);\n const segment = segments[index];\n return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]);\n}\nexport {\n FlattenMap as AnyMap,\n FlattenMap,\n GREATEST_LOWER_BOUND,\n LEAST_UPPER_BOUND,\n TraceMap,\n allGeneratedPositionsFor,\n decodedMap,\n decodedMappings,\n eachMapping,\n encodedMap,\n encodedMappings,\n generatedPositionFor,\n isIgnored,\n originalPositionFor,\n presortedDecodedMap,\n sourceContentFor,\n traceSegment\n};\n//# sourceMappingURL=trace-mapping.mjs.map\n","// src/set-array.ts\nvar SetArray = class {\n constructor() {\n this._indexes = { __proto__: null };\n this.array = [];\n }\n};\nfunction cast(set) {\n return set;\n}\nfunction get(setarr, key) {\n return cast(setarr)._indexes[key];\n}\nfunction put(setarr, key) {\n const index = get(setarr, key);\n if (index !== void 0) return index;\n const { array, _indexes: indexes } = cast(setarr);\n const length = array.push(key);\n return indexes[key] = length - 1;\n}\nfunction remove(setarr, key) {\n const index = get(setarr, key);\n if (index === void 0) return;\n const { array, _indexes: indexes } = cast(setarr);\n for (let i = index + 1; i < array.length; i++) {\n const k = array[i];\n array[i - 1] = k;\n indexes[k]--;\n }\n indexes[key] = void 0;\n array.pop();\n}\n\n// src/gen-mapping.ts\nimport {\n encode\n} from \"@jridgewell/sourcemap-codec\";\nimport { TraceMap, decodedMappings } from \"@jridgewell/trace-mapping\";\n\n// src/sourcemap-segment.ts\nvar COLUMN = 0;\nvar SOURCES_INDEX = 1;\nvar SOURCE_LINE = 2;\nvar SOURCE_COLUMN = 3;\nvar NAMES_INDEX = 4;\n\n// src/gen-mapping.ts\nvar NO_NAME = -1;\nvar GenMapping = class {\n constructor({ file, sourceRoot } = {}) {\n this._names = new SetArray();\n this._sources = new SetArray();\n this._sourcesContent = [];\n this._mappings = [];\n this.file = file;\n this.sourceRoot = sourceRoot;\n this._ignoreList = new SetArray();\n }\n};\nfunction cast2(map) {\n return map;\n}\nfunction addSegment(map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) {\n return addSegmentInternal(\n false,\n map,\n genLine,\n genColumn,\n source,\n sourceLine,\n sourceColumn,\n name,\n content\n );\n}\nfunction addMapping(map, mapping) {\n return addMappingInternal(false, map, mapping);\n}\nvar maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {\n return addSegmentInternal(\n true,\n map,\n genLine,\n genColumn,\n source,\n sourceLine,\n sourceColumn,\n name,\n content\n );\n};\nvar maybeAddMapping = (map, mapping) => {\n return addMappingInternal(true, map, mapping);\n};\nfunction setSourceContent(map, source, content) {\n const {\n _sources: sources,\n _sourcesContent: sourcesContent\n // _originalScopes: originalScopes,\n } = cast2(map);\n const index = put(sources, source);\n sourcesContent[index] = content;\n}\nfunction setIgnore(map, source, ignore = true) {\n const {\n _sources: sources,\n _sourcesContent: sourcesContent,\n _ignoreList: ignoreList\n // _originalScopes: originalScopes,\n } = cast2(map);\n const index = put(sources, source);\n if (index === sourcesContent.length) sourcesContent[index] = null;\n if (ignore) put(ignoreList, index);\n else remove(ignoreList, index);\n}\nfunction toDecodedMap(map) {\n const {\n _mappings: mappings,\n _sources: sources,\n _sourcesContent: sourcesContent,\n _names: names,\n _ignoreList: ignoreList\n // _originalScopes: originalScopes,\n // _generatedRanges: generatedRanges,\n } = cast2(map);\n removeEmptyFinalLines(mappings);\n return {\n version: 3,\n file: map.file || void 0,\n names: names.array,\n sourceRoot: map.sourceRoot || void 0,\n sources: sources.array,\n sourcesContent,\n mappings,\n // originalScopes,\n // generatedRanges,\n ignoreList: ignoreList.array\n };\n}\nfunction toEncodedMap(map) {\n const decoded = toDecodedMap(map);\n return Object.assign({}, decoded, {\n // originalScopes: decoded.originalScopes.map((os) => encodeOriginalScopes(os)),\n // generatedRanges: encodeGeneratedRanges(decoded.generatedRanges as GeneratedRange[]),\n mappings: encode(decoded.mappings)\n });\n}\nfunction fromMap(input) {\n const map = new TraceMap(input);\n const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot });\n putAll(cast2(gen)._names, map.names);\n putAll(cast2(gen)._sources, map.sources);\n cast2(gen)._sourcesContent = map.sourcesContent || map.sources.map(() => null);\n cast2(gen)._mappings = decodedMappings(map);\n if (map.ignoreList) putAll(cast2(gen)._ignoreList, map.ignoreList);\n return gen;\n}\nfunction allMappings(map) {\n const out = [];\n const { _mappings: mappings, _sources: sources, _names: names } = cast2(map);\n for (let i = 0; i < mappings.length; i++) {\n const line = mappings[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n const generated = { line: i + 1, column: seg[COLUMN] };\n let source = void 0;\n let original = void 0;\n let name = void 0;\n if (seg.length !== 1) {\n source = sources.array[seg[SOURCES_INDEX]];\n original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] };\n if (seg.length === 5) name = names.array[seg[NAMES_INDEX]];\n }\n out.push({ generated, source, original, name });\n }\n }\n return out;\n}\nfunction addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) {\n const {\n _mappings: mappings,\n _sources: sources,\n _sourcesContent: sourcesContent,\n _names: names\n // _originalScopes: originalScopes,\n } = cast2(map);\n const line = getIndex(mappings, genLine);\n const index = getColumnIndex(line, genColumn);\n if (!source) {\n if (skipable && skipSourceless(line, index)) return;\n return insert(line, index, [genColumn]);\n }\n assert(sourceLine);\n assert(sourceColumn);\n const sourcesIndex = put(sources, source);\n const namesIndex = name ? put(names, name) : NO_NAME;\n if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content != null ? content : null;\n if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {\n return;\n }\n return insert(\n line,\n index,\n name ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex] : [genColumn, sourcesIndex, sourceLine, sourceColumn]\n );\n}\nfunction assert(_val) {\n}\nfunction getIndex(arr, index) {\n for (let i = arr.length; i <= index; i++) {\n arr[i] = [];\n }\n return arr[index];\n}\nfunction getColumnIndex(line, genColumn) {\n let index = line.length;\n for (let i = index - 1; i >= 0; index = i--) {\n const current = line[i];\n if (genColumn >= current[COLUMN]) break;\n }\n return index;\n}\nfunction insert(array, index, value) {\n for (let i = array.length; i > index; i--) {\n array[i] = array[i - 1];\n }\n array[index] = value;\n}\nfunction removeEmptyFinalLines(mappings) {\n const { length } = mappings;\n let len = length;\n for (let i = len - 1; i >= 0; len = i, i--) {\n if (mappings[i].length > 0) break;\n }\n if (len < length) mappings.length = len;\n}\nfunction putAll(setarr, array) {\n for (let i = 0; i < array.length; i++) put(setarr, array[i]);\n}\nfunction skipSourceless(line, index) {\n if (index === 0) return true;\n const prev = line[index - 1];\n return prev.length === 1;\n}\nfunction skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) {\n if (index === 0) return false;\n const prev = line[index - 1];\n if (prev.length === 1) return false;\n return sourcesIndex === prev[SOURCES_INDEX] && sourceLine === prev[SOURCE_LINE] && sourceColumn === prev[SOURCE_COLUMN] && namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME);\n}\nfunction addMappingInternal(skipable, map, mapping) {\n const { generated, source, original, name, content } = mapping;\n if (!source) {\n return addSegmentInternal(\n skipable,\n map,\n generated.line - 1,\n generated.column,\n null,\n null,\n null,\n null,\n null\n );\n }\n assert(original);\n return addSegmentInternal(\n skipable,\n map,\n generated.line - 1,\n generated.column,\n source,\n original.line - 1,\n original.column,\n name,\n content\n );\n}\nexport {\n GenMapping,\n addMapping,\n addSegment,\n allMappings,\n fromMap,\n maybeAddMapping,\n maybeAddSegment,\n setIgnore,\n setSourceContent,\n toDecodedMap,\n toEncodedMap\n};\n//# sourceMappingURL=gen-mapping.mjs.map\n","// src/source-map.ts\nimport {\n AnyMap,\n originalPositionFor,\n generatedPositionFor,\n allGeneratedPositionsFor,\n eachMapping,\n encodedMappings,\n sourceContentFor\n} from \"@jridgewell/trace-mapping\";\nimport {\n GenMapping,\n maybeAddMapping,\n toDecodedMap,\n toEncodedMap,\n setSourceContent,\n fromMap\n} from \"@jridgewell/gen-mapping\";\nvar SourceMapConsumer = class _SourceMapConsumer {\n constructor(map, mapUrl) {\n const trace = this._map = new AnyMap(map, mapUrl);\n this.file = trace.file;\n this.names = trace.names;\n this.sourceRoot = trace.sourceRoot;\n this.sources = trace.resolvedSources;\n this.sourcesContent = trace.sourcesContent;\n this.version = trace.version;\n }\n static fromSourceMap(map, mapUrl) {\n if (map.toDecodedMap) {\n return new _SourceMapConsumer(map.toDecodedMap(), mapUrl);\n }\n return new _SourceMapConsumer(map.toJSON(), mapUrl);\n }\n get mappings() {\n return encodedMappings(this._map);\n }\n originalPositionFor(needle) {\n return originalPositionFor(this._map, needle);\n }\n generatedPositionFor(originalPosition) {\n return generatedPositionFor(this._map, originalPosition);\n }\n allGeneratedPositionsFor(originalPosition) {\n return allGeneratedPositionsFor(this._map, originalPosition);\n }\n hasContentsOfAllSources() {\n if (!this.sourcesContent || this.sourcesContent.length !== this.sources.length) {\n return false;\n }\n for (const content of this.sourcesContent) {\n if (content == null) {\n return false;\n }\n }\n return true;\n }\n sourceContentFor(source, nullOnMissing) {\n const sourceContent = sourceContentFor(this._map, source);\n if (sourceContent != null) {\n return sourceContent;\n }\n if (nullOnMissing) {\n return null;\n }\n throw new Error(`\"${source}\" is not in the SourceMap.`);\n }\n eachMapping(callback, context) {\n eachMapping(this._map, context ? callback.bind(context) : callback);\n }\n destroy() {\n }\n};\nvar SourceMapGenerator = class _SourceMapGenerator {\n constructor(opts) {\n this._map = opts instanceof GenMapping ? opts : new GenMapping(opts);\n }\n static fromSourceMap(consumer) {\n return new _SourceMapGenerator(fromMap(consumer));\n }\n addMapping(mapping) {\n maybeAddMapping(this._map, mapping);\n }\n setSourceContent(source, content) {\n setSourceContent(this._map, source, content);\n }\n toJSON() {\n return toEncodedMap(this._map);\n }\n toString() {\n return JSON.stringify(this.toJSON());\n }\n toDecodedMap() {\n return toDecodedMap(this._map);\n }\n};\nexport {\n SourceMapConsumer,\n SourceMapGenerator\n};\n//# sourceMappingURL=source-map.mjs.map\n","import { createRequire } from \"module\";\nimport { basename, dirname, normalize, relative, resolve, sep } from \"path\";\nimport * as nativeFs from \"fs\";\n\n//#region rolldown:runtime\nvar __require = /* @__PURE__ */ createRequire(import.meta.url);\n\n//#endregion\n//#region src/utils.ts\nfunction cleanPath(path) {\n\tlet normalized = normalize(path);\n\tif (normalized.length > 1 && normalized[normalized.length - 1] === sep) normalized = normalized.substring(0, normalized.length - 1);\n\treturn normalized;\n}\nconst SLASHES_REGEX = /[\\\\/]/g;\nfunction convertSlashes(path, separator) {\n\treturn path.replace(SLASHES_REGEX, separator);\n}\nconst WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\\\/]$/i;\nfunction isRootDirectory(path) {\n\treturn path === \"/\" || WINDOWS_ROOT_DIR_REGEX.test(path);\n}\nfunction normalizePath(path, options) {\n\tconst { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;\n\tconst pathNeedsCleaning = process.platform === \"win32\" && path.includes(\"/\") || path.startsWith(\".\");\n\tif (resolvePaths) path = resolve(path);\n\tif (normalizePath$1 || pathNeedsCleaning) path = cleanPath(path);\n\tif (path === \".\") return \"\";\n\tconst needsSeperator = path[path.length - 1] !== pathSeparator;\n\treturn convertSlashes(needsSeperator ? path + pathSeparator : path, pathSeparator);\n}\n\n//#endregion\n//#region src/api/functions/join-path.ts\nfunction joinPathWithBasePath(filename, directoryPath) {\n\treturn directoryPath + filename;\n}\nfunction joinPathWithRelativePath(root, options) {\n\treturn function(filename, directoryPath) {\n\t\tconst sameRoot = directoryPath.startsWith(root);\n\t\tif (sameRoot) return directoryPath.slice(root.length) + filename;\n\t\telse return convertSlashes(relative(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;\n\t};\n}\nfunction joinPath(filename) {\n\treturn filename;\n}\nfunction joinDirectoryPath(filename, directoryPath, separator) {\n\treturn directoryPath + filename + separator;\n}\nfunction build$7(root, options) {\n\tconst { relativePaths, includeBasePath } = options;\n\treturn relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath;\n}\n\n//#endregion\n//#region src/api/functions/push-directory.ts\nfunction pushDirectoryWithRelativePath(root) {\n\treturn function(directoryPath, paths) {\n\t\tpaths.push(directoryPath.substring(root.length) || \".\");\n\t};\n}\nfunction pushDirectoryFilterWithRelativePath(root) {\n\treturn function(directoryPath, paths, filters) {\n\t\tconst relativePath = directoryPath.substring(root.length) || \".\";\n\t\tif (filters.every((filter) => filter(relativePath, true))) paths.push(relativePath);\n\t};\n}\nconst pushDirectory = (directoryPath, paths) => {\n\tpaths.push(directoryPath || \".\");\n};\nconst pushDirectoryFilter = (directoryPath, paths, filters) => {\n\tconst path = directoryPath || \".\";\n\tif (filters.every((filter) => filter(path, true))) paths.push(path);\n};\nconst empty$2 = () => {};\nfunction build$6(root, options) {\n\tconst { includeDirs, filters, relativePaths } = options;\n\tif (!includeDirs) return empty$2;\n\tif (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root);\n\treturn filters && filters.length ? pushDirectoryFilter : pushDirectory;\n}\n\n//#endregion\n//#region src/api/functions/push-file.ts\nconst pushFileFilterAndCount = (filename, _paths, counts, filters) => {\n\tif (filters.every((filter) => filter(filename, false))) counts.files++;\n};\nconst pushFileFilter = (filename, paths, _counts, filters) => {\n\tif (filters.every((filter) => filter(filename, false))) paths.push(filename);\n};\nconst pushFileCount = (_filename, _paths, counts, _filters) => {\n\tcounts.files++;\n};\nconst pushFile = (filename, paths) => {\n\tpaths.push(filename);\n};\nconst empty$1 = () => {};\nfunction build$5(options) {\n\tconst { excludeFiles, filters, onlyCounts } = options;\n\tif (excludeFiles) return empty$1;\n\tif (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter;\n\telse if (onlyCounts) return pushFileCount;\n\telse return pushFile;\n}\n\n//#endregion\n//#region src/api/functions/get-array.ts\nconst getArray = (paths) => {\n\treturn paths;\n};\nconst getArrayGroup = () => {\n\treturn [\"\"].slice(0, 0);\n};\nfunction build$4(options) {\n\treturn options.group ? getArrayGroup : getArray;\n}\n\n//#endregion\n//#region src/api/functions/group-files.ts\nconst groupFiles = (groups, directory, files) => {\n\tgroups.push({\n\t\tdirectory,\n\t\tfiles,\n\t\tdir: directory\n\t});\n};\nconst empty = () => {};\nfunction build$3(options) {\n\treturn options.group ? groupFiles : empty;\n}\n\n//#endregion\n//#region src/api/functions/resolve-symlink.ts\nconst resolveSymlinksAsync = function(path, state, callback$1) {\n\tconst { queue, fs, options: { suppressErrors } } = state;\n\tqueue.enqueue();\n\tfs.realpath(path, (error, resolvedPath) => {\n\t\tif (error) return queue.dequeue(suppressErrors ? null : error, state);\n\t\tfs.stat(resolvedPath, (error$1, stat) => {\n\t\t\tif (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);\n\t\t\tif (stat.isDirectory() && isRecursive(path, resolvedPath, state)) return queue.dequeue(null, state);\n\t\t\tcallback$1(stat, resolvedPath);\n\t\t\tqueue.dequeue(null, state);\n\t\t});\n\t});\n};\nconst resolveSymlinks = function(path, state, callback$1) {\n\tconst { queue, fs, options: { suppressErrors } } = state;\n\tqueue.enqueue();\n\ttry {\n\t\tconst resolvedPath = fs.realpathSync(path);\n\t\tconst stat = fs.statSync(resolvedPath);\n\t\tif (stat.isDirectory() && isRecursive(path, resolvedPath, state)) return;\n\t\tcallback$1(stat, resolvedPath);\n\t} catch (e) {\n\t\tif (!suppressErrors) throw e;\n\t}\n};\nfunction build$2(options, isSynchronous) {\n\tif (!options.resolveSymlinks || options.excludeSymlinks) return null;\n\treturn isSynchronous ? resolveSymlinks : resolveSymlinksAsync;\n}\nfunction isRecursive(path, resolved, state) {\n\tif (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);\n\tlet parent = dirname(path);\n\tlet depth = 1;\n\twhile (parent !== state.root && depth < 2) {\n\t\tconst resolvedPath = state.symlinks.get(parent);\n\t\tconst isSameRoot = !!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath));\n\t\tif (isSameRoot) depth++;\n\t\telse parent = dirname(parent);\n\t}\n\tstate.symlinks.set(path, resolved);\n\treturn depth > 1;\n}\nfunction isRecursiveUsingRealPaths(resolved, state) {\n\treturn state.visited.includes(resolved + state.options.pathSeparator);\n}\n\n//#endregion\n//#region src/api/functions/invoke-callback.ts\nconst onlyCountsSync = (state) => {\n\treturn state.counts;\n};\nconst groupsSync = (state) => {\n\treturn state.groups;\n};\nconst defaultSync = (state) => {\n\treturn state.paths;\n};\nconst limitFilesSync = (state) => {\n\treturn state.paths.slice(0, state.options.maxFiles);\n};\nconst onlyCountsAsync = (state, error, callback$1) => {\n\treport(error, callback$1, state.counts, state.options.suppressErrors);\n\treturn null;\n};\nconst defaultAsync = (state, error, callback$1) => {\n\treport(error, callback$1, state.paths, state.options.suppressErrors);\n\treturn null;\n};\nconst limitFilesAsync = (state, error, callback$1) => {\n\treport(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);\n\treturn null;\n};\nconst groupsAsync = (state, error, callback$1) => {\n\treport(error, callback$1, state.groups, state.options.suppressErrors);\n\treturn null;\n};\nfunction report(error, callback$1, output, suppressErrors) {\n\tif (error && !suppressErrors) callback$1(error, output);\n\telse callback$1(null, output);\n}\nfunction build$1(options, isSynchronous) {\n\tconst { onlyCounts, group, maxFiles } = options;\n\tif (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync;\n\telse if (group) return isSynchronous ? groupsSync : groupsAsync;\n\telse if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync;\n\telse return isSynchronous ? defaultSync : defaultAsync;\n}\n\n//#endregion\n//#region src/api/functions/walk-directory.ts\nconst readdirOpts = { withFileTypes: true };\nconst walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {\n\tstate.queue.enqueue();\n\tif (currentDepth < 0) return state.queue.dequeue(null, state);\n\tconst { fs } = state;\n\tstate.visited.push(crawlPath);\n\tstate.counts.directories++;\n\tfs.readdir(crawlPath || \".\", readdirOpts, (error, entries = []) => {\n\t\tcallback$1(entries, directoryPath, currentDepth);\n\t\tstate.queue.dequeue(state.options.suppressErrors ? null : error, state);\n\t});\n};\nconst walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {\n\tconst { fs } = state;\n\tif (currentDepth < 0) return;\n\tstate.visited.push(crawlPath);\n\tstate.counts.directories++;\n\tlet entries = [];\n\ttry {\n\t\tentries = fs.readdirSync(crawlPath || \".\", readdirOpts);\n\t} catch (e) {\n\t\tif (!state.options.suppressErrors) throw e;\n\t}\n\tcallback$1(entries, directoryPath, currentDepth);\n};\nfunction build(isSynchronous) {\n\treturn isSynchronous ? walkSync : walkAsync;\n}\n\n//#endregion\n//#region src/api/queue.ts\n/**\n* This is a custom stateless queue to track concurrent async fs calls.\n* It increments a counter whenever a call is queued and decrements it\n* as soon as it completes. When the counter hits 0, it calls onQueueEmpty.\n*/\nvar Queue = class {\n\tcount = 0;\n\tconstructor(onQueueEmpty) {\n\t\tthis.onQueueEmpty = onQueueEmpty;\n\t}\n\tenqueue() {\n\t\tthis.count++;\n\t\treturn this.count;\n\t}\n\tdequeue(error, output) {\n\t\tif (this.onQueueEmpty && (--this.count <= 0 || error)) {\n\t\t\tthis.onQueueEmpty(error, output);\n\t\t\tif (error) {\n\t\t\t\toutput.controller.abort();\n\t\t\t\tthis.onQueueEmpty = void 0;\n\t\t\t}\n\t\t}\n\t}\n};\n\n//#endregion\n//#region src/api/counter.ts\nvar Counter = class {\n\t_files = 0;\n\t_directories = 0;\n\tset files(num) {\n\t\tthis._files = num;\n\t}\n\tget files() {\n\t\treturn this._files;\n\t}\n\tset directories(num) {\n\t\tthis._directories = num;\n\t}\n\tget directories() {\n\t\treturn this._directories;\n\t}\n\t/**\n\t* @deprecated use `directories` instead\n\t*/\n\t/* c8 ignore next 3 */\n\tget dirs() {\n\t\treturn this._directories;\n\t}\n};\n\n//#endregion\n//#region src/api/aborter.ts\n/**\n* AbortController is not supported on Node 14 so we use this until we can drop\n* support for Node 14.\n*/\nvar Aborter = class {\n\taborted = false;\n\tabort() {\n\t\tthis.aborted = true;\n\t}\n};\n\n//#endregion\n//#region src/api/walker.ts\nvar Walker = class {\n\troot;\n\tisSynchronous;\n\tstate;\n\tjoinPath;\n\tpushDirectory;\n\tpushFile;\n\tgetArray;\n\tgroupFiles;\n\tresolveSymlink;\n\twalkDirectory;\n\tcallbackInvoker;\n\tconstructor(root, options, callback$1) {\n\t\tthis.isSynchronous = !callback$1;\n\t\tthis.callbackInvoker = build$1(options, this.isSynchronous);\n\t\tthis.root = normalizePath(root, options);\n\t\tthis.state = {\n\t\t\troot: isRootDirectory(this.root) ? this.root : this.root.slice(0, -1),\n\t\t\tpaths: [\"\"].slice(0, 0),\n\t\t\tgroups: [],\n\t\t\tcounts: new Counter(),\n\t\t\toptions,\n\t\t\tqueue: new Queue((error, state) => this.callbackInvoker(state, error, callback$1)),\n\t\t\tsymlinks: /* @__PURE__ */ new Map(),\n\t\t\tvisited: [\"\"].slice(0, 0),\n\t\t\tcontroller: new Aborter(),\n\t\t\tfs: options.fs || nativeFs\n\t\t};\n\t\tthis.joinPath = build$7(this.root, options);\n\t\tthis.pushDirectory = build$6(this.root, options);\n\t\tthis.pushFile = build$5(options);\n\t\tthis.getArray = build$4(options);\n\t\tthis.groupFiles = build$3(options);\n\t\tthis.resolveSymlink = build$2(options, this.isSynchronous);\n\t\tthis.walkDirectory = build(this.isSynchronous);\n\t}\n\tstart() {\n\t\tthis.pushDirectory(this.root, this.state.paths, this.state.options.filters);\n\t\tthis.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);\n\t\treturn this.isSynchronous ? this.callbackInvoker(this.state, null) : null;\n\t}\n\twalk = (entries, directoryPath, depth) => {\n\t\tconst { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state;\n\t\tif (controller.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles) return;\n\t\tconst files = this.getArray(this.state.paths);\n\t\tfor (let i = 0; i < entries.length; ++i) {\n\t\t\tconst entry = entries[i];\n\t\t\tif (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) {\n\t\t\t\tconst filename = this.joinPath(entry.name, directoryPath);\n\t\t\t\tthis.pushFile(filename, files, this.state.counts, filters);\n\t\t\t} else if (entry.isDirectory()) {\n\t\t\t\tlet path = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);\n\t\t\t\tif (exclude && exclude(entry.name, path)) continue;\n\t\t\t\tthis.pushDirectory(path, paths, filters);\n\t\t\t\tthis.walkDirectory(this.state, path, path, depth - 1, this.walk);\n\t\t\t} else if (this.resolveSymlink && entry.isSymbolicLink()) {\n\t\t\t\tlet path = joinPathWithBasePath(entry.name, directoryPath);\n\t\t\t\tthis.resolveSymlink(path, this.state, (stat, resolvedPath) => {\n\t\t\t\t\tif (stat.isDirectory()) {\n\t\t\t\t\t\tresolvedPath = normalizePath(resolvedPath, this.state.options);\n\t\t\t\t\t\tif (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path + pathSeparator)) return;\n\t\t\t\t\t\tthis.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth - 1, this.walk);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresolvedPath = useRealPaths ? resolvedPath : path;\n\t\t\t\t\t\tconst filename = basename(resolvedPath);\n\t\t\t\t\t\tconst directoryPath$1 = normalizePath(dirname(resolvedPath), this.state.options);\n\t\t\t\t\t\tresolvedPath = this.joinPath(filename, directoryPath$1);\n\t\t\t\t\t\tthis.pushFile(resolvedPath, files, this.state.counts, filters);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tthis.groupFiles(this.state.groups, directoryPath, files);\n\t};\n};\n\n//#endregion\n//#region src/api/async.ts\nfunction promise(root, options) {\n\treturn new Promise((resolve$1, reject) => {\n\t\tcallback(root, options, (err, output) => {\n\t\t\tif (err) return reject(err);\n\t\t\tresolve$1(output);\n\t\t});\n\t});\n}\nfunction callback(root, options, callback$1) {\n\tlet walker = new Walker(root, options, callback$1);\n\twalker.start();\n}\n\n//#endregion\n//#region src/api/sync.ts\nfunction sync(root, options) {\n\tconst walker = new Walker(root, options);\n\treturn walker.start();\n}\n\n//#endregion\n//#region src/builder/api-builder.ts\nvar APIBuilder = class {\n\tconstructor(root, options) {\n\t\tthis.root = root;\n\t\tthis.options = options;\n\t}\n\twithPromise() {\n\t\treturn promise(this.root, this.options);\n\t}\n\twithCallback(cb) {\n\t\tcallback(this.root, this.options, cb);\n\t}\n\tsync() {\n\t\treturn sync(this.root, this.options);\n\t}\n};\n\n//#endregion\n//#region src/builder/index.ts\nlet pm = null;\n/* c8 ignore next 6 */\ntry {\n\t__require.resolve(\"picomatch\");\n\tpm = __require(\"picomatch\");\n} catch {}\nvar Builder = class {\n\tglobCache = {};\n\toptions = {\n\t\tmaxDepth: Infinity,\n\t\tsuppressErrors: true,\n\t\tpathSeparator: sep,\n\t\tfilters: []\n\t};\n\tglobFunction;\n\tconstructor(options) {\n\t\tthis.options = {\n\t\t\t...this.options,\n\t\t\t...options\n\t\t};\n\t\tthis.globFunction = this.options.globFunction;\n\t}\n\tgroup() {\n\t\tthis.options.group = true;\n\t\treturn this;\n\t}\n\twithPathSeparator(separator) {\n\t\tthis.options.pathSeparator = separator;\n\t\treturn this;\n\t}\n\twithBasePath() {\n\t\tthis.options.includeBasePath = true;\n\t\treturn this;\n\t}\n\twithRelativePaths() {\n\t\tthis.options.relativePaths = true;\n\t\treturn this;\n\t}\n\twithDirs() {\n\t\tthis.options.includeDirs = true;\n\t\treturn this;\n\t}\n\twithMaxDepth(depth) {\n\t\tthis.options.maxDepth = depth;\n\t\treturn this;\n\t}\n\twithMaxFiles(limit) {\n\t\tthis.options.maxFiles = limit;\n\t\treturn this;\n\t}\n\twithFullPaths() {\n\t\tthis.options.resolvePaths = true;\n\t\tthis.options.includeBasePath = true;\n\t\treturn this;\n\t}\n\twithErrors() {\n\t\tthis.options.suppressErrors = false;\n\t\treturn this;\n\t}\n\twithSymlinks({ resolvePaths = true } = {}) {\n\t\tthis.options.resolveSymlinks = true;\n\t\tthis.options.useRealPaths = resolvePaths;\n\t\treturn this.withFullPaths();\n\t}\n\twithAbortSignal(signal) {\n\t\tthis.options.signal = signal;\n\t\treturn this;\n\t}\n\tnormalize() {\n\t\tthis.options.normalizePath = true;\n\t\treturn this;\n\t}\n\tfilter(predicate) {\n\t\tthis.options.filters.push(predicate);\n\t\treturn this;\n\t}\n\tonlyDirs() {\n\t\tthis.options.excludeFiles = true;\n\t\tthis.options.includeDirs = true;\n\t\treturn this;\n\t}\n\texclude(predicate) {\n\t\tthis.options.exclude = predicate;\n\t\treturn this;\n\t}\n\tonlyCounts() {\n\t\tthis.options.onlyCounts = true;\n\t\treturn this;\n\t}\n\tcrawl(root) {\n\t\treturn new APIBuilder(root || \".\", this.options);\n\t}\n\twithGlobFunction(fn) {\n\t\tthis.globFunction = fn;\n\t\treturn this;\n\t}\n\t/**\n\t* @deprecated Pass options using the constructor instead:\n\t* ```ts\n\t* new fdir(options).crawl(\"/path/to/root\");\n\t* ```\n\t* This method will be removed in v7.0\n\t*/\n\t/* c8 ignore next 4 */\n\tcrawlWithOptions(root, options) {\n\t\tthis.options = {\n\t\t\t...this.options,\n\t\t\t...options\n\t\t};\n\t\treturn new APIBuilder(root || \".\", this.options);\n\t}\n\tglob(...patterns) {\n\t\tif (this.globFunction) return this.globWithOptions(patterns);\n\t\treturn this.globWithOptions(patterns, ...[{ dot: true }]);\n\t}\n\tglobWithOptions(patterns, ...options) {\n\t\tconst globFn = this.globFunction || pm;\n\t\t/* c8 ignore next 5 */\n\t\tif (!globFn) throw new Error(\"Please specify a glob function to use glob matching.\");\n\t\tvar isMatch = this.globCache[patterns.join(\"\\0\")];\n\t\tif (!isMatch) {\n\t\t\tisMatch = globFn(patterns, ...options);\n\t\t\tthis.globCache[patterns.join(\"\\0\")] = isMatch;\n\t\t}\n\t\tthis.options.filters.push((path) => isMatch(path));\n\t\treturn this;\n\t}\n};\n\n//#endregion\nexport { Builder as fdir };","'use strict';\n\nconst WIN_SLASH = '\\\\\\\\/';\nconst WIN_NO_SLASH = `[^${WIN_SLASH}]`;\n\nconst DEFAULT_MAX_EXTGLOB_RECURSION = 0;\n\n/**\n * Posix glob regex\n */\n\nconst DOT_LITERAL = '\\\\.';\nconst PLUS_LITERAL = '\\\\+';\nconst QMARK_LITERAL = '\\\\?';\nconst SLASH_LITERAL = '\\\\/';\nconst ONE_CHAR = '(?=.)';\nconst QMARK = '[^/]';\nconst END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;\nconst START_ANCHOR = `(?:^|${SLASH_LITERAL})`;\nconst DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;\nconst NO_DOT = `(?!${DOT_LITERAL})`;\nconst NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;\nconst NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;\nconst NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;\nconst QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;\nconst STAR = `${QMARK}*?`;\nconst SEP = '/';\n\nconst POSIX_CHARS = {\n DOT_LITERAL,\n PLUS_LITERAL,\n QMARK_LITERAL,\n SLASH_LITERAL,\n ONE_CHAR,\n QMARK,\n END_ANCHOR,\n DOTS_SLASH,\n NO_DOT,\n NO_DOTS,\n NO_DOT_SLASH,\n NO_DOTS_SLASH,\n QMARK_NO_DOT,\n STAR,\n START_ANCHOR,\n SEP\n};\n\n/**\n * Windows glob regex\n */\n\nconst WINDOWS_CHARS = {\n ...POSIX_CHARS,\n\n SLASH_LITERAL: `[${WIN_SLASH}]`,\n QMARK: WIN_NO_SLASH,\n STAR: `${WIN_NO_SLASH}*?`,\n DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,\n NO_DOT: `(?!${DOT_LITERAL})`,\n NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,\n NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,\n NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,\n QMARK_NO_DOT: `[^.${WIN_SLASH}]`,\n START_ANCHOR: `(?:^|[${WIN_SLASH}])`,\n END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,\n SEP: '\\\\'\n};\n\n/**\n * POSIX Bracket Regex\n */\n\nconst POSIX_REGEX_SOURCE = {\n __proto__: null,\n alnum: 'a-zA-Z0-9',\n alpha: 'a-zA-Z',\n ascii: '\\\\x00-\\\\x7F',\n blank: ' \\\\t',\n cntrl: '\\\\x00-\\\\x1F\\\\x7F',\n digit: '0-9',\n graph: '\\\\x21-\\\\x7E',\n lower: 'a-z',\n print: '\\\\x20-\\\\x7E ',\n punct: '\\\\-!\"#$%&\\'()\\\\*+,./:;<=>?@[\\\\]^_`{|}~',\n space: ' \\\\t\\\\r\\\\n\\\\v\\\\f',\n upper: 'A-Z',\n word: 'A-Za-z0-9_',\n xdigit: 'A-Fa-f0-9'\n};\n\nmodule.exports = {\n DEFAULT_MAX_EXTGLOB_RECURSION,\n MAX_LENGTH: 1024 * 64,\n POSIX_REGEX_SOURCE,\n\n // regular expressions\n REGEX_BACKSLASH: /\\\\(?![*+?^${}(|)[\\]])/g,\n REGEX_NON_SPECIAL_CHARS: /^[^@![\\].,$*+?^{}()|\\\\/]+/,\n REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\\]]/,\n REGEX_SPECIAL_CHARS_BACKREF: /(\\\\?)((\\W)(\\3*))/g,\n REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\\]])/g,\n REGEX_REMOVE_BACKSLASH: /(?:\\[.*?[^\\\\]\\]|\\\\(?=.))/g,\n\n // Replace globs with equivalent patterns to reduce parsing time.\n REPLACEMENTS: {\n __proto__: null,\n '***': '*',\n '**/**': '**',\n '**/**/**': '**'\n },\n\n // Digits\n CHAR_0: 48, /* 0 */\n CHAR_9: 57, /* 9 */\n\n // Alphabet chars.\n CHAR_UPPERCASE_A: 65, /* A */\n CHAR_LOWERCASE_A: 97, /* a */\n CHAR_UPPERCASE_Z: 90, /* Z */\n CHAR_LOWERCASE_Z: 122, /* z */\n\n CHAR_LEFT_PARENTHESES: 40, /* ( */\n CHAR_RIGHT_PARENTHESES: 41, /* ) */\n\n CHAR_ASTERISK: 42, /* * */\n\n // Non-alphabetic chars.\n CHAR_AMPERSAND: 38, /* & */\n CHAR_AT: 64, /* @ */\n CHAR_BACKWARD_SLASH: 92, /* \\ */\n CHAR_CARRIAGE_RETURN: 13, /* \\r */\n CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */\n CHAR_COLON: 58, /* : */\n CHAR_COMMA: 44, /* , */\n CHAR_DOT: 46, /* . */\n CHAR_DOUBLE_QUOTE: 34, /* \" */\n CHAR_EQUAL: 61, /* = */\n CHAR_EXCLAMATION_MARK: 33, /* ! */\n CHAR_FORM_FEED: 12, /* \\f */\n CHAR_FORWARD_SLASH: 47, /* / */\n CHAR_GRAVE_ACCENT: 96, /* ` */\n CHAR_HASH: 35, /* # */\n CHAR_HYPHEN_MINUS: 45, /* - */\n CHAR_LEFT_ANGLE_BRACKET: 60, /* < */\n CHAR_LEFT_CURLY_BRACE: 123, /* { */\n CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */\n CHAR_LINE_FEED: 10, /* \\n */\n CHAR_NO_BREAK_SPACE: 160, /* \\u00A0 */\n CHAR_PERCENT: 37, /* % */\n CHAR_PLUS: 43, /* + */\n CHAR_QUESTION_MARK: 63, /* ? */\n CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */\n CHAR_RIGHT_CURLY_BRACE: 125, /* } */\n CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */\n CHAR_SEMICOLON: 59, /* ; */\n CHAR_SINGLE_QUOTE: 39, /* ' */\n CHAR_SPACE: 32, /* */\n CHAR_TAB: 9, /* \\t */\n CHAR_UNDERSCORE: 95, /* _ */\n CHAR_VERTICAL_LINE: 124, /* | */\n CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \\uFEFF */\n\n /**\n * Create EXTGLOB_CHARS\n */\n\n extglobChars(chars) {\n return {\n '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },\n '?': { type: 'qmark', open: '(?:', close: ')?' },\n '+': { type: 'plus', open: '(?:', close: ')+' },\n '*': { type: 'star', open: '(?:', close: ')*' },\n '@': { type: 'at', open: '(?:', close: ')' }\n };\n },\n\n /**\n * Create GLOB_CHARS\n */\n\n globChars(win32) {\n return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;\n }\n};\n","/*global navigator*/\n'use strict';\n\nconst {\n REGEX_BACKSLASH,\n REGEX_REMOVE_BACKSLASH,\n REGEX_SPECIAL_CHARS,\n REGEX_SPECIAL_CHARS_GLOBAL\n} = require('./constants');\n\nexports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);\nexports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);\nexports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);\nexports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\\\$1');\nexports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');\n\nexports.isWindows = () => {\n if (typeof navigator !== 'undefined' && navigator.platform) {\n const platform = navigator.platform.toLowerCase();\n return platform === 'win32' || platform === 'windows';\n }\n\n if (typeof process !== 'undefined' && process.platform) {\n return process.platform === 'win32';\n }\n\n return false;\n};\n\nexports.removeBackslashes = str => {\n return str.replace(REGEX_REMOVE_BACKSLASH, match => {\n return match === '\\\\' ? '' : match;\n });\n};\n\nexports.escapeLast = (input, char, lastIdx) => {\n const idx = input.lastIndexOf(char, lastIdx);\n if (idx === -1) return input;\n if (input[idx - 1] === '\\\\') return exports.escapeLast(input, char, idx - 1);\n return `${input.slice(0, idx)}\\\\${input.slice(idx)}`;\n};\n\nexports.removePrefix = (input, state = {}) => {\n let output = input;\n if (output.startsWith('./')) {\n output = output.slice(2);\n state.prefix = './';\n }\n return output;\n};\n\nexports.wrapOutput = (input, state = {}, options = {}) => {\n const prepend = options.contains ? '' : '^';\n const append = options.contains ? '' : '$';\n\n let output = `${prepend}(?:${input})${append}`;\n if (state.negated === true) {\n output = `(?:^(?!${output}).*$)`;\n }\n return output;\n};\n\nexports.basename = (path, { windows } = {}) => {\n const segs = path.split(windows ? /[\\\\/]/ : '/');\n const last = segs[segs.length - 1];\n\n if (last === '') {\n return segs[segs.length - 2];\n }\n\n return last;\n};\n","'use strict';\n\nconst utils = require('./utils');\nconst {\n CHAR_ASTERISK, /* * */\n CHAR_AT, /* @ */\n CHAR_BACKWARD_SLASH, /* \\ */\n CHAR_COMMA, /* , */\n CHAR_DOT, /* . */\n CHAR_EXCLAMATION_MARK, /* ! */\n CHAR_FORWARD_SLASH, /* / */\n CHAR_LEFT_CURLY_BRACE, /* { */\n CHAR_LEFT_PARENTHESES, /* ( */\n CHAR_LEFT_SQUARE_BRACKET, /* [ */\n CHAR_PLUS, /* + */\n CHAR_QUESTION_MARK, /* ? */\n CHAR_RIGHT_CURLY_BRACE, /* } */\n CHAR_RIGHT_PARENTHESES, /* ) */\n CHAR_RIGHT_SQUARE_BRACKET /* ] */\n} = require('./constants');\n\nconst isPathSeparator = code => {\n return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;\n};\n\nconst depth = token => {\n if (token.isPrefix !== true) {\n token.depth = token.isGlobstar ? Infinity : 1;\n }\n};\n\n/**\n * Quickly scans a glob pattern and returns an object with a handful of\n * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),\n * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not\n * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).\n *\n * ```js\n * const pm = require('picomatch');\n * console.log(pm.scan('foo/bar/*.js'));\n * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }\n * ```\n * @param {String} `str`\n * @param {Object} `options`\n * @return {Object} Returns an object with tokens and regex source string.\n * @api public\n */\n\nconst scan = (input, options) => {\n const opts = options || {};\n\n const length = input.length - 1;\n const scanToEnd = opts.parts === true || opts.scanToEnd === true;\n const slashes = [];\n const tokens = [];\n const parts = [];\n\n let str = input;\n let index = -1;\n let start = 0;\n let lastIndex = 0;\n let isBrace = false;\n let isBracket = false;\n let isGlob = false;\n let isExtglob = false;\n let isGlobstar = false;\n let braceEscaped = false;\n let backslashes = false;\n let negated = false;\n let negatedExtglob = false;\n let finished = false;\n let braces = 0;\n let prev;\n let code;\n let token = { value: '', depth: 0, isGlob: false };\n\n const eos = () => index >= length;\n const peek = () => str.charCodeAt(index + 1);\n const advance = () => {\n prev = code;\n return str.charCodeAt(++index);\n };\n\n while (index < length) {\n code = advance();\n let next;\n\n if (code === CHAR_BACKWARD_SLASH) {\n backslashes = token.backslashes = true;\n code = advance();\n\n if (code === CHAR_LEFT_CURLY_BRACE) {\n braceEscaped = true;\n }\n continue;\n }\n\n if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {\n braces++;\n\n while (eos() !== true && (code = advance())) {\n if (code === CHAR_BACKWARD_SLASH) {\n backslashes = token.backslashes = true;\n advance();\n continue;\n }\n\n if (code === CHAR_LEFT_CURLY_BRACE) {\n braces++;\n continue;\n }\n\n if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {\n isBrace = token.isBrace = true;\n isGlob = token.isGlob = true;\n finished = true;\n\n if (scanToEnd === true) {\n continue;\n }\n\n break;\n }\n\n if (braceEscaped !== true && code === CHAR_COMMA) {\n isBrace = token.isBrace = true;\n isGlob = token.isGlob = true;\n finished = true;\n\n if (scanToEnd === true) {\n continue;\n }\n\n break;\n }\n\n if (code === CHAR_RIGHT_CURLY_BRACE) {\n braces--;\n\n if (braces === 0) {\n braceEscaped = false;\n isBrace = token.isBrace = true;\n finished = true;\n break;\n }\n }\n }\n\n if (scanToEnd === true) {\n continue;\n }\n\n break;\n }\n\n if (code === CHAR_FORWARD_SLASH) {\n slashes.push(index);\n tokens.push(token);\n token = { value: '', depth: 0, isGlob: false };\n\n if (finished === true) continue;\n if (prev === CHAR_DOT && index === (start + 1)) {\n start += 2;\n continue;\n }\n\n lastIndex = index + 1;\n continue;\n }\n\n if (opts.noext !== true) {\n const isExtglobChar = code === CHAR_PLUS\n || code === CHAR_AT\n || code === CHAR_ASTERISK\n || code === CHAR_QUESTION_MARK\n || code === CHAR_EXCLAMATION_MARK;\n\n if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {\n isGlob = token.isGlob = true;\n isExtglob = token.isExtglob = true;\n finished = true;\n if (code === CHAR_EXCLAMATION_MARK && index === start) {\n negatedExtglob = true;\n }\n\n if (scanToEnd === true) {\n while (eos() !== true && (code = advance())) {\n if (code === CHAR_BACKWARD_SLASH) {\n backslashes = token.backslashes = true;\n code = advance();\n continue;\n }\n\n if (code === CHAR_RIGHT_PARENTHESES) {\n isGlob = token.isGlob = true;\n finished = true;\n break;\n }\n }\n continue;\n }\n break;\n }\n }\n\n if (code === CHAR_ASTERISK) {\n if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;\n isGlob = token.isGlob = true;\n finished = true;\n\n if (scanToEnd === true) {\n continue;\n }\n break;\n }\n\n if (code === CHAR_QUESTION_MARK) {\n isGlob = token.isGlob = true;\n finished = true;\n\n if (scanToEnd === true) {\n continue;\n }\n break;\n }\n\n if (code === CHAR_LEFT_SQUARE_BRACKET) {\n while (eos() !== true && (next = advance())) {\n if (next === CHAR_BACKWARD_SLASH) {\n backslashes = token.backslashes = true;\n advance();\n continue;\n }\n\n if (next === CHAR_RIGHT_SQUARE_BRACKET) {\n isBracket = token.isBracket = true;\n isGlob = token.isGlob = true;\n finished = true;\n break;\n }\n }\n\n if (scanToEnd === true) {\n continue;\n }\n\n break;\n }\n\n if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {\n negated = token.negated = true;\n start++;\n continue;\n }\n\n if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {\n isGlob = token.isGlob = true;\n\n if (scanToEnd === true) {\n while (eos() !== true && (code = advance())) {\n if (code === CHAR_LEFT_PARENTHESES) {\n backslashes = token.backslashes = true;\n code = advance();\n continue;\n }\n\n if (code === CHAR_RIGHT_PARENTHESES) {\n finished = true;\n break;\n }\n }\n continue;\n }\n break;\n }\n\n if (isGlob === true) {\n finished = true;\n\n if (scanToEnd === true) {\n continue;\n }\n\n break;\n }\n }\n\n if (opts.noext === true) {\n isExtglob = false;\n isGlob = false;\n }\n\n let base = str;\n let prefix = '';\n let glob = '';\n\n if (start > 0) {\n prefix = str.slice(0, start);\n str = str.slice(start);\n lastIndex -= start;\n }\n\n if (base && isGlob === true && lastIndex > 0) {\n base = str.slice(0, lastIndex);\n glob = str.slice(lastIndex);\n } else if (isGlob === true) {\n base = '';\n glob = str;\n } else {\n base = str;\n }\n\n if (base && base !== '' && base !== '/' && base !== str) {\n if (isPathSeparator(base.charCodeAt(base.length - 1))) {\n base = base.slice(0, -1);\n }\n }\n\n if (opts.unescape === true) {\n if (glob) glob = utils.removeBackslashes(glob);\n\n if (base && backslashes === true) {\n base = utils.removeBackslashes(base);\n }\n }\n\n const state = {\n prefix,\n input,\n start,\n base,\n glob,\n isBrace,\n isBracket,\n isGlob,\n isExtglob,\n isGlobstar,\n negated,\n negatedExtglob\n };\n\n if (opts.tokens === true) {\n state.maxDepth = 0;\n if (!isPathSeparator(code)) {\n tokens.push(token);\n }\n state.tokens = tokens;\n }\n\n if (opts.parts === true || opts.tokens === true) {\n let prevIndex;\n\n for (let idx = 0; idx < slashes.length; idx++) {\n const n = prevIndex ? prevIndex + 1 : start;\n const i = slashes[idx];\n const value = input.slice(n, i);\n if (opts.tokens) {\n if (idx === 0 && start !== 0) {\n tokens[idx].isPrefix = true;\n tokens[idx].value = prefix;\n } else {\n tokens[idx].value = value;\n }\n depth(tokens[idx]);\n state.maxDepth += tokens[idx].depth;\n }\n if (idx !== 0 || value !== '') {\n parts.push(value);\n }\n prevIndex = i;\n }\n\n if (prevIndex && prevIndex + 1 < input.length) {\n const value = input.slice(prevIndex + 1);\n parts.push(value);\n\n if (opts.tokens) {\n tokens[tokens.length - 1].value = value;\n depth(tokens[tokens.length - 1]);\n state.maxDepth += tokens[tokens.length - 1].depth;\n }\n }\n\n state.slashes = slashes;\n state.parts = parts;\n }\n\n return state;\n};\n\nmodule.exports = scan;\n","'use strict';\n\nconst constants = require('./constants');\nconst utils = require('./utils');\n\n/**\n * Constants\n */\n\nconst {\n MAX_LENGTH,\n POSIX_REGEX_SOURCE,\n REGEX_NON_SPECIAL_CHARS,\n REGEX_SPECIAL_CHARS_BACKREF,\n REPLACEMENTS\n} = constants;\n\n/**\n * Helpers\n */\n\nconst expandRange = (args, options) => {\n if (typeof options.expandRange === 'function') {\n return options.expandRange(...args, options);\n }\n\n args.sort();\n const value = `[${args.join('-')}]`;\n\n try {\n /* eslint-disable-next-line no-new */\n new RegExp(value);\n } catch (ex) {\n return args.map(v => utils.escapeRegex(v)).join('..');\n }\n\n return value;\n};\n\n/**\n * Create the message for a syntax error\n */\n\nconst syntaxError = (type, char) => {\n return `Missing ${type}: \"${char}\" - use \"\\\\\\\\${char}\" to match literal characters`;\n};\n\nconst splitTopLevel = input => {\n const parts = [];\n let bracket = 0;\n let paren = 0;\n let quote = 0;\n let value = '';\n let escaped = false;\n\n for (const ch of input) {\n if (escaped === true) {\n value += ch;\n escaped = false;\n continue;\n }\n\n if (ch === '\\\\') {\n value += ch;\n escaped = true;\n continue;\n }\n\n if (ch === '\"') {\n quote = quote === 1 ? 0 : 1;\n value += ch;\n continue;\n }\n\n if (quote === 0) {\n if (ch === '[') {\n bracket++;\n } else if (ch === ']' && bracket > 0) {\n bracket--;\n } else if (bracket === 0) {\n if (ch === '(') {\n paren++;\n } else if (ch === ')' && paren > 0) {\n paren--;\n } else if (ch === '|' && paren === 0) {\n parts.push(value);\n value = '';\n continue;\n }\n }\n }\n\n value += ch;\n }\n\n parts.push(value);\n return parts;\n};\n\nconst isPlainBranch = branch => {\n let escaped = false;\n\n for (const ch of branch) {\n if (escaped === true) {\n escaped = false;\n continue;\n }\n\n if (ch === '\\\\') {\n escaped = true;\n continue;\n }\n\n if (/[?*+@!()[\\]{}]/.test(ch)) {\n return false;\n }\n }\n\n return true;\n};\n\nconst normalizeSimpleBranch = branch => {\n let value = branch.trim();\n let changed = true;\n\n while (changed === true) {\n changed = false;\n\n if (/^@\\([^\\\\()[\\]{}|]+\\)$/.test(value)) {\n value = value.slice(2, -1);\n changed = true;\n }\n }\n\n if (!isPlainBranch(value)) {\n return;\n }\n\n return value.replace(/\\\\(.)/g, '$1');\n};\n\nconst hasRepeatedCharPrefixOverlap = branches => {\n const values = branches.map(normalizeSimpleBranch).filter(Boolean);\n\n for (let i = 0; i < values.length; i++) {\n for (let j = i + 1; j < values.length; j++) {\n const a = values[i];\n const b = values[j];\n const char = a[0];\n\n if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {\n continue;\n }\n\n if (a === b || a.startsWith(b) || b.startsWith(a)) {\n return true;\n }\n }\n }\n\n return false;\n};\n\nconst parseRepeatedExtglob = (pattern, requireEnd = true) => {\n if ((pattern[0] !== '+' && pattern[0] !== '*') || pattern[1] !== '(') {\n return;\n }\n\n let bracket = 0;\n let paren = 0;\n let quote = 0;\n let escaped = false;\n\n for (let i = 1; i < pattern.length; i++) {\n const ch = pattern[i];\n\n if (escaped === true) {\n escaped = false;\n continue;\n }\n\n if (ch === '\\\\') {\n escaped = true;\n continue;\n }\n\n if (ch === '\"') {\n quote = quote === 1 ? 0 : 1;\n continue;\n }\n\n if (quote === 1) {\n continue;\n }\n\n if (ch === '[') {\n bracket++;\n continue;\n }\n\n if (ch === ']' && bracket > 0) {\n bracket--;\n continue;\n }\n\n if (bracket > 0) {\n continue;\n }\n\n if (ch === '(') {\n paren++;\n continue;\n }\n\n if (ch === ')') {\n paren--;\n\n if (paren === 0) {\n if (requireEnd === true && i !== pattern.length - 1) {\n return;\n }\n\n return {\n type: pattern[0],\n body: pattern.slice(2, i),\n end: i\n };\n }\n }\n }\n};\n\nconst getStarExtglobSequenceOutput = pattern => {\n let index = 0;\n const chars = [];\n\n while (index < pattern.length) {\n const match = parseRepeatedExtglob(pattern.slice(index), false);\n\n if (!match || match.type !== '*') {\n return;\n }\n\n const branches = splitTopLevel(match.body).map(branch => branch.trim());\n if (branches.length !== 1) {\n return;\n }\n\n const branch = normalizeSimpleBranch(branches[0]);\n if (!branch || branch.length !== 1) {\n return;\n }\n\n chars.push(branch);\n index += match.end + 1;\n }\n\n if (chars.length < 1) {\n return;\n }\n\n const source = chars.length === 1\n ? utils.escapeRegex(chars[0])\n : `[${chars.map(ch => utils.escapeRegex(ch)).join('')}]`;\n\n return `${source}*`;\n};\n\nconst repeatedExtglobRecursion = pattern => {\n let depth = 0;\n let value = pattern.trim();\n let match = parseRepeatedExtglob(value);\n\n while (match) {\n depth++;\n value = match.body.trim();\n match = parseRepeatedExtglob(value);\n }\n\n return depth;\n};\n\nconst analyzeRepeatedExtglob = (body, options) => {\n if (options.maxExtglobRecursion === false) {\n return { risky: false };\n }\n\n const max =\n typeof options.maxExtglobRecursion === 'number'\n ? options.maxExtglobRecursion\n : constants.DEFAULT_MAX_EXTGLOB_RECURSION;\n\n const branches = splitTopLevel(body).map(branch => branch.trim());\n\n if (branches.length > 1) {\n if (\n branches.some(branch => branch === '') ||\n branches.some(branch => /^[*?]+$/.test(branch)) ||\n hasRepeatedCharPrefixOverlap(branches)\n ) {\n return { risky: true };\n }\n }\n\n for (const branch of branches) {\n const safeOutput = getStarExtglobSequenceOutput(branch);\n if (safeOutput) {\n return { risky: true, safeOutput };\n }\n\n if (repeatedExtglobRecursion(branch) > max) {\n return { risky: true };\n }\n }\n\n return { risky: false };\n};\n\n/**\n * Parse the given input string.\n * @param {String} input\n * @param {Object} options\n * @return {Object}\n */\n\nconst parse = (input, options) => {\n if (typeof input !== 'string') {\n throw new TypeError('Expected a string');\n }\n\n input = REPLACEMENTS[input] || input;\n\n const opts = { ...options };\n const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;\n\n let len = input.length;\n if (len > max) {\n throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);\n }\n\n const bos = { type: 'bos', value: '', output: opts.prepend || '' };\n const tokens = [bos];\n\n const capture = opts.capture ? '' : '?:';\n\n // create constants based on platform, for windows or posix\n const PLATFORM_CHARS = constants.globChars(opts.windows);\n const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);\n\n const {\n DOT_LITERAL,\n PLUS_LITERAL,\n SLASH_LITERAL,\n ONE_CHAR,\n DOTS_SLASH,\n NO_DOT,\n NO_DOT_SLASH,\n NO_DOTS_SLASH,\n QMARK,\n QMARK_NO_DOT,\n STAR,\n START_ANCHOR\n } = PLATFORM_CHARS;\n\n const globstar = opts => {\n return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;\n };\n\n const nodot = opts.dot ? '' : NO_DOT;\n const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;\n let star = opts.bash === true ? globstar(opts) : STAR;\n\n if (opts.capture) {\n star = `(${star})`;\n }\n\n // minimatch options support\n if (typeof opts.noext === 'boolean') {\n opts.noextglob = opts.noext;\n }\n\n const state = {\n input,\n index: -1,\n start: 0,\n dot: opts.dot === true,\n consumed: '',\n output: '',\n prefix: '',\n backtrack: false,\n negated: false,\n brackets: 0,\n braces: 0,\n parens: 0,\n quotes: 0,\n globstar: false,\n tokens\n };\n\n input = utils.removePrefix(input, state);\n len = input.length;\n\n const extglobs = [];\n const braces = [];\n const stack = [];\n let prev = bos;\n let value;\n\n /**\n * Tokenizing helpers\n */\n\n const eos = () => state.index === len - 1;\n const peek = state.peek = (n = 1) => input[state.index + n];\n const advance = state.advance = () => input[++state.index] || '';\n const remaining = () => input.slice(state.index + 1);\n const consume = (value = '', num = 0) => {\n state.consumed += value;\n state.index += num;\n };\n\n const append = token => {\n state.output += token.output != null ? token.output : token.value;\n consume(token.value);\n };\n\n const negate = () => {\n let count = 1;\n\n while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {\n advance();\n state.start++;\n count++;\n }\n\n if (count % 2 === 0) {\n return false;\n }\n\n state.negated = true;\n state.start++;\n return true;\n };\n\n const increment = type => {\n state[type]++;\n stack.push(type);\n };\n\n const decrement = type => {\n state[type]--;\n stack.pop();\n };\n\n /**\n * Push tokens onto the tokens array. This helper speeds up\n * tokenizing by 1) helping us avoid backtracking as much as possible,\n * and 2) helping us avoid creating extra tokens when consecutive\n * characters are plain text. This improves performance and simplifies\n * lookbehinds.\n */\n\n const push = tok => {\n if (prev.type === 'globstar') {\n const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');\n const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));\n\n if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {\n state.output = state.output.slice(0, -prev.output.length);\n prev.type = 'star';\n prev.value = '*';\n prev.output = star;\n state.output += prev.output;\n }\n }\n\n if (extglobs.length && tok.type !== 'paren') {\n extglobs[extglobs.length - 1].inner += tok.value;\n }\n\n if (tok.value || tok.output) append(tok);\n if (prev && prev.type === 'text' && tok.type === 'text') {\n prev.output = (prev.output || prev.value) + tok.value;\n prev.value += tok.value;\n return;\n }\n\n tok.prev = prev;\n tokens.push(tok);\n prev = tok;\n };\n\n const extglobOpen = (type, value) => {\n const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };\n\n token.prev = prev;\n token.parens = state.parens;\n token.output = state.output;\n token.startIndex = state.index;\n token.tokensIndex = tokens.length;\n const output = (opts.capture ? '(' : '') + token.open;\n\n increment('parens');\n push({ type, value, output: state.output ? '' : ONE_CHAR });\n push({ type: 'paren', extglob: true, value: advance(), output });\n extglobs.push(token);\n };\n\n const extglobClose = token => {\n const literal = input.slice(token.startIndex, state.index + 1);\n const body = input.slice(token.startIndex + 2, state.index);\n const analysis = analyzeRepeatedExtglob(body, opts);\n\n if ((token.type === 'plus' || token.type === 'star') && analysis.risky) {\n const safeOutput = analysis.safeOutput\n ? (token.output ? '' : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput)\n : undefined;\n const open = tokens[token.tokensIndex];\n\n open.type = 'text';\n open.value = literal;\n open.output = safeOutput || utils.escapeRegex(literal);\n\n for (let i = token.tokensIndex + 1; i < tokens.length; i++) {\n tokens[i].value = '';\n tokens[i].output = '';\n delete tokens[i].suffix;\n }\n\n state.output = token.output + open.output;\n state.backtrack = true;\n\n push({ type: 'paren', extglob: true, value, output: '' });\n decrement('parens');\n return;\n }\n\n let output = token.close + (opts.capture ? ')' : '');\n let rest;\n\n if (token.type === 'negate') {\n let extglobStar = star;\n\n if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {\n extglobStar = globstar(opts);\n }\n\n if (extglobStar !== star || eos() || /^\\)+$/.test(remaining())) {\n output = token.close = `)$))${extglobStar}`;\n }\n\n if (token.inner.includes('*') && (rest = remaining()) && /^\\.[^\\\\/.]+$/.test(rest)) {\n // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.\n // In this case, we need to parse the string and use it in the output of the original pattern.\n // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.\n //\n // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.\n const expression = parse(rest, { ...options, fastpaths: false }).output;\n\n output = token.close = `)${expression})${extglobStar})`;\n }\n\n if (token.prev.type === 'bos') {\n state.negatedExtglob = true;\n }\n }\n\n push({ type: 'paren', extglob: true, value, output });\n decrement('parens');\n };\n\n /**\n * Fast paths\n */\n\n if (opts.fastpaths !== false && !/(^[*!]|[/()[\\]{}\"])/.test(input)) {\n let backslashes = false;\n\n let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {\n if (first === '\\\\') {\n backslashes = true;\n return m;\n }\n\n if (first === '?') {\n if (esc) {\n return esc + first + (rest ? QMARK.repeat(rest.length) : '');\n }\n if (index === 0) {\n return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');\n }\n return QMARK.repeat(chars.length);\n }\n\n if (first === '.') {\n return DOT_LITERAL.repeat(chars.length);\n }\n\n if (first === '*') {\n if (esc) {\n return esc + first + (rest ? star : '');\n }\n return star;\n }\n return esc ? m : `\\\\${m}`;\n });\n\n if (backslashes === true) {\n if (opts.unescape === true) {\n output = output.replace(/\\\\/g, '');\n } else {\n output = output.replace(/\\\\+/g, m => {\n return m.length % 2 === 0 ? '\\\\\\\\' : (m ? '\\\\' : '');\n });\n }\n }\n\n if (output === input && opts.contains === true) {\n state.output = input;\n return state;\n }\n\n state.output = utils.wrapOutput(output, state, options);\n return state;\n }\n\n /**\n * Tokenize input until we reach end-of-string\n */\n\n while (!eos()) {\n value = advance();\n\n if (value === '\\u0000') {\n continue;\n }\n\n /**\n * Escaped characters\n */\n\n if (value === '\\\\') {\n const next = peek();\n\n if (next === '/' && opts.bash !== true) {\n continue;\n }\n\n if (next === '.' || next === ';') {\n continue;\n }\n\n if (!next) {\n value += '\\\\';\n push({ type: 'text', value });\n continue;\n }\n\n // collapse slashes to reduce potential for exploits\n const match = /^\\\\+/.exec(remaining());\n let slashes = 0;\n\n if (match && match[0].length > 2) {\n slashes = match[0].length;\n state.index += slashes;\n if (slashes % 2 !== 0) {\n value += '\\\\';\n }\n }\n\n if (opts.unescape === true) {\n value = advance();\n } else {\n value += advance();\n }\n\n if (state.brackets === 0) {\n push({ type: 'text', value });\n continue;\n }\n }\n\n /**\n * If we're inside a regex character class, continue\n * until we reach the closing bracket.\n */\n\n if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {\n if (opts.posix !== false && value === ':') {\n const inner = prev.value.slice(1);\n if (inner.includes('[')) {\n prev.posix = true;\n\n if (inner.includes(':')) {\n const idx = prev.value.lastIndexOf('[');\n const pre = prev.value.slice(0, idx);\n const rest = prev.value.slice(idx + 2);\n const posix = POSIX_REGEX_SOURCE[rest];\n if (posix) {\n prev.value = pre + posix;\n state.backtrack = true;\n advance();\n\n if (!bos.output && tokens.indexOf(prev) === 1) {\n bos.output = ONE_CHAR;\n }\n continue;\n }\n }\n }\n }\n\n if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {\n value = `\\\\${value}`;\n }\n\n if (value === ']' && (prev.value === '[' || prev.value === '[^')) {\n value = `\\\\${value}`;\n }\n\n if (opts.posix === true && value === '!' && prev.value === '[') {\n value = '^';\n }\n\n prev.value += value;\n append({ value });\n continue;\n }\n\n /**\n * If we're inside a quoted string, continue\n * until we reach the closing double quote.\n */\n\n if (state.quotes === 1 && value !== '\"') {\n value = utils.escapeRegex(value);\n prev.value += value;\n append({ value });\n continue;\n }\n\n /**\n * Double quotes\n */\n\n if (value === '\"') {\n state.quotes = state.quotes === 1 ? 0 : 1;\n if (opts.keepQuotes === true) {\n push({ type: 'text', value });\n }\n continue;\n }\n\n /**\n * Parentheses\n */\n\n if (value === '(') {\n increment('parens');\n push({ type: 'paren', value });\n continue;\n }\n\n if (value === ')') {\n if (state.parens === 0 && opts.strictBrackets === true) {\n throw new SyntaxError(syntaxError('opening', '('));\n }\n\n const extglob = extglobs[extglobs.length - 1];\n if (extglob && state.parens === extglob.parens + 1) {\n extglobClose(extglobs.pop());\n continue;\n }\n\n push({ type: 'paren', value, output: state.parens ? ')' : '\\\\)' });\n decrement('parens');\n continue;\n }\n\n /**\n * Square brackets\n */\n\n if (value === '[') {\n if (opts.nobracket === true || !remaining().includes(']')) {\n if (opts.nobracket !== true && opts.strictBrackets === true) {\n throw new SyntaxError(syntaxError('closing', ']'));\n }\n\n value = `\\\\${value}`;\n } else {\n increment('brackets');\n }\n\n push({ type: 'bracket', value });\n continue;\n }\n\n if (value === ']') {\n if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {\n push({ type: 'text', value, output: `\\\\${value}` });\n continue;\n }\n\n if (state.brackets === 0) {\n if (opts.strictBrackets === true) {\n throw new SyntaxError(syntaxError('opening', '['));\n }\n\n push({ type: 'text', value, output: `\\\\${value}` });\n continue;\n }\n\n decrement('brackets');\n\n const prevValue = prev.value.slice(1);\n if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {\n value = `/${value}`;\n }\n\n prev.value += value;\n append({ value });\n\n // when literal brackets are explicitly disabled\n // assume we should match with a regex character class\n if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {\n continue;\n }\n\n const escaped = utils.escapeRegex(prev.value);\n state.output = state.output.slice(0, -prev.value.length);\n\n // when literal brackets are explicitly enabled\n // assume we should escape the brackets to match literal characters\n if (opts.literalBrackets === true) {\n state.output += escaped;\n prev.value = escaped;\n continue;\n }\n\n // when the user specifies nothing, try to match both\n prev.value = `(${capture}${escaped}|${prev.value})`;\n state.output += prev.value;\n continue;\n }\n\n /**\n * Braces\n */\n\n if (value === '{' && opts.nobrace !== true) {\n increment('braces');\n\n const open = {\n type: 'brace',\n value,\n output: '(',\n outputIndex: state.output.length,\n tokensIndex: state.tokens.length\n };\n\n braces.push(open);\n push(open);\n continue;\n }\n\n if (value === '}') {\n const brace = braces[braces.length - 1];\n\n if (opts.nobrace === true || !brace) {\n push({ type: 'text', value, output: value });\n continue;\n }\n\n let output = ')';\n\n if (brace.dots === true) {\n const arr = tokens.slice();\n const range = [];\n\n for (let i = arr.length - 1; i >= 0; i--) {\n tokens.pop();\n if (arr[i].type === 'brace') {\n break;\n }\n if (arr[i].type !== 'dots') {\n range.unshift(arr[i].value);\n }\n }\n\n output = expandRange(range, opts);\n state.backtrack = true;\n }\n\n if (brace.comma !== true && brace.dots !== true) {\n const out = state.output.slice(0, brace.outputIndex);\n const toks = state.tokens.slice(brace.tokensIndex);\n brace.value = brace.output = '\\\\{';\n value = output = '\\\\}';\n state.output = out;\n for (const t of toks) {\n state.output += (t.output || t.value);\n }\n }\n\n push({ type: 'brace', value, output });\n decrement('braces');\n braces.pop();\n continue;\n }\n\n /**\n * Pipes\n */\n\n if (value === '|') {\n if (extglobs.length > 0) {\n extglobs[extglobs.length - 1].conditions++;\n }\n push({ type: 'text', value });\n continue;\n }\n\n /**\n * Commas\n */\n\n if (value === ',') {\n let output = value;\n\n const brace = braces[braces.length - 1];\n if (brace && stack[stack.length - 1] === 'braces') {\n brace.comma = true;\n output = '|';\n }\n\n push({ type: 'comma', value, output });\n continue;\n }\n\n /**\n * Slashes\n */\n\n if (value === '/') {\n // if the beginning of the glob is \"./\", advance the start\n // to the current index, and don't add the \"./\" characters\n // to the state. This greatly simplifies lookbehinds when\n // checking for BOS characters like \"!\" and \".\" (not \"./\")\n if (prev.type === 'dot' && state.index === state.start + 1) {\n state.start = state.index + 1;\n state.consumed = '';\n state.output = '';\n tokens.pop();\n prev = bos; // reset \"prev\" to the first token\n continue;\n }\n\n push({ type: 'slash', value, output: SLASH_LITERAL });\n continue;\n }\n\n /**\n * Dots\n */\n\n if (value === '.') {\n if (state.braces > 0 && prev.type === 'dot') {\n if (prev.value === '.') prev.output = DOT_LITERAL;\n const brace = braces[braces.length - 1];\n prev.type = 'dots';\n prev.output += value;\n prev.value += value;\n brace.dots = true;\n continue;\n }\n\n if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {\n push({ type: 'text', value, output: DOT_LITERAL });\n continue;\n }\n\n push({ type: 'dot', value, output: DOT_LITERAL });\n continue;\n }\n\n /**\n * Question marks\n */\n\n if (value === '?') {\n const isGroup = prev && prev.value === '(';\n if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {\n extglobOpen('qmark', value);\n continue;\n }\n\n if (prev && prev.type === 'paren') {\n const next = peek();\n let output = value;\n\n if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\\w+>)/.test(remaining()))) {\n output = `\\\\${value}`;\n }\n\n push({ type: 'text', value, output });\n continue;\n }\n\n if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {\n push({ type: 'qmark', value, output: QMARK_NO_DOT });\n continue;\n }\n\n push({ type: 'qmark', value, output: QMARK });\n continue;\n }\n\n /**\n * Exclamation\n */\n\n if (value === '!') {\n if (opts.noextglob !== true && peek() === '(') {\n if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {\n extglobOpen('negate', value);\n continue;\n }\n }\n\n if (opts.nonegate !== true && state.index === 0) {\n negate();\n continue;\n }\n }\n\n /**\n * Plus\n */\n\n if (value === '+') {\n if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {\n extglobOpen('plus', value);\n continue;\n }\n\n if ((prev && prev.value === '(') || opts.regex === false) {\n push({ type: 'plus', value, output: PLUS_LITERAL });\n continue;\n }\n\n if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {\n push({ type: 'plus', value });\n continue;\n }\n\n push({ type: 'plus', value: PLUS_LITERAL });\n continue;\n }\n\n /**\n * Plain text\n */\n\n if (value === '@') {\n if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {\n push({ type: 'at', extglob: true, value, output: '' });\n continue;\n }\n\n push({ type: 'text', value });\n continue;\n }\n\n /**\n * Plain text\n */\n\n if (value !== '*') {\n if (value === '$' || value === '^') {\n value = `\\\\${value}`;\n }\n\n const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());\n if (match) {\n value += match[0];\n state.index += match[0].length;\n }\n\n push({ type: 'text', value });\n continue;\n }\n\n /**\n * Stars\n */\n\n if (prev && (prev.type === 'globstar' || prev.star === true)) {\n prev.type = 'star';\n prev.star = true;\n prev.value += value;\n prev.output = star;\n state.backtrack = true;\n state.globstar = true;\n consume(value);\n continue;\n }\n\n let rest = remaining();\n if (opts.noextglob !== true && /^\\([^?]/.test(rest)) {\n extglobOpen('star', value);\n continue;\n }\n\n if (prev.type === 'star') {\n if (opts.noglobstar === true) {\n consume(value);\n continue;\n }\n\n const prior = prev.prev;\n const before = prior.prev;\n const isStart = prior.type === 'slash' || prior.type === 'bos';\n const afterStar = before && (before.type === 'star' || before.type === 'globstar');\n\n if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {\n push({ type: 'star', value, output: '' });\n continue;\n }\n\n const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');\n const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');\n if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {\n push({ type: 'star', value, output: '' });\n continue;\n }\n\n // strip consecutive `/**/`\n while (rest.slice(0, 3) === '/**') {\n const after = input[state.index + 4];\n if (after && after !== '/') {\n break;\n }\n rest = rest.slice(3);\n consume('/**', 3);\n }\n\n if (prior.type === 'bos' && eos()) {\n prev.type = 'globstar';\n prev.value += value;\n prev.output = globstar(opts);\n state.output = prev.output;\n state.globstar = true;\n consume(value);\n continue;\n }\n\n if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {\n state.output = state.output.slice(0, -(prior.output + prev.output).length);\n prior.output = `(?:${prior.output}`;\n\n prev.type = 'globstar';\n prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');\n prev.value += value;\n state.globstar = true;\n state.output += prior.output + prev.output;\n consume(value);\n continue;\n }\n\n if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {\n const end = rest[1] !== void 0 ? '|$' : '';\n\n state.output = state.output.slice(0, -(prior.output + prev.output).length);\n prior.output = `(?:${prior.output}`;\n\n prev.type = 'globstar';\n prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;\n prev.value += value;\n\n state.output += prior.output + prev.output;\n state.globstar = true;\n\n consume(value + advance());\n\n push({ type: 'slash', value: '/', output: '' });\n continue;\n }\n\n if (prior.type === 'bos' && rest[0] === '/') {\n prev.type = 'globstar';\n prev.value += value;\n prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;\n state.output = prev.output;\n state.globstar = true;\n consume(value + advance());\n push({ type: 'slash', value: '/', output: '' });\n continue;\n }\n\n // remove single star from output\n state.output = state.output.slice(0, -prev.output.length);\n\n // reset previous token to globstar\n prev.type = 'globstar';\n prev.output = globstar(opts);\n prev.value += value;\n\n // reset output with globstar\n state.output += prev.output;\n state.globstar = true;\n consume(value);\n continue;\n }\n\n const token = { type: 'star', value, output: star };\n\n if (opts.bash === true) {\n token.output = '.*?';\n if (prev.type === 'bos' || prev.type === 'slash') {\n token.output = nodot + token.output;\n }\n push(token);\n continue;\n }\n\n if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {\n token.output = value;\n push(token);\n continue;\n }\n\n if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {\n if (prev.type === 'dot') {\n state.output += NO_DOT_SLASH;\n prev.output += NO_DOT_SLASH;\n\n } else if (opts.dot === true) {\n state.output += NO_DOTS_SLASH;\n prev.output += NO_DOTS_SLASH;\n\n } else {\n state.output += nodot;\n prev.output += nodot;\n }\n\n if (peek() !== '*') {\n state.output += ONE_CHAR;\n prev.output += ONE_CHAR;\n }\n }\n\n push(token);\n }\n\n while (state.brackets > 0) {\n if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));\n state.output = utils.escapeLast(state.output, '[');\n decrement('brackets');\n }\n\n while (state.parens > 0) {\n if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));\n state.output = utils.escapeLast(state.output, '(');\n decrement('parens');\n }\n\n while (state.braces > 0) {\n if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));\n state.output = utils.escapeLast(state.output, '{');\n decrement('braces');\n }\n\n if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {\n push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });\n }\n\n // rebuild the output if we had to backtrack at any point\n if (state.backtrack === true) {\n state.output = '';\n\n for (const token of state.tokens) {\n state.output += token.output != null ? token.output : token.value;\n\n if (token.suffix) {\n state.output += token.suffix;\n }\n }\n }\n\n return state;\n};\n\n/**\n * Fast paths for creating regular expressions for common glob patterns.\n * This can significantly speed up processing and has very little downside\n * impact when none of the fast paths match.\n */\n\nparse.fastpaths = (input, options) => {\n const opts = { ...options };\n const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;\n const len = input.length;\n if (len > max) {\n throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);\n }\n\n input = REPLACEMENTS[input] || input;\n\n // create constants based on platform, for windows or posix\n const {\n DOT_LITERAL,\n SLASH_LITERAL,\n ONE_CHAR,\n DOTS_SLASH,\n NO_DOT,\n NO_DOTS,\n NO_DOTS_SLASH,\n STAR,\n START_ANCHOR\n } = constants.globChars(opts.windows);\n\n const nodot = opts.dot ? NO_DOTS : NO_DOT;\n const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;\n const capture = opts.capture ? '' : '?:';\n const state = { negated: false, prefix: '' };\n let star = opts.bash === true ? '.*?' : STAR;\n\n if (opts.capture) {\n star = `(${star})`;\n }\n\n const globstar = opts => {\n if (opts.noglobstar === true) return star;\n return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;\n };\n\n const create = str => {\n switch (str) {\n case '*':\n return `${nodot}${ONE_CHAR}${star}`;\n\n case '.*':\n return `${DOT_LITERAL}${ONE_CHAR}${star}`;\n\n case '*.*':\n return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;\n\n case '*/*':\n return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;\n\n case '**':\n return nodot + globstar(opts);\n\n case '**/*':\n return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;\n\n case '**/*.*':\n return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;\n\n case '**/.*':\n return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;\n\n default: {\n const match = /^(.*?)\\.(\\w+)$/.exec(str);\n if (!match) return;\n\n const source = create(match[1]);\n if (!source) return;\n\n return source + DOT_LITERAL + match[2];\n }\n }\n };\n\n const output = utils.removePrefix(input, state);\n let source = create(output);\n\n if (source && opts.strictSlashes !== true) {\n source += `${SLASH_LITERAL}?`;\n }\n\n return source;\n};\n\nmodule.exports = parse;\n","'use strict';\n\nconst scan = require('./scan');\nconst parse = require('./parse');\nconst utils = require('./utils');\nconst constants = require('./constants');\nconst isObject = val => val && typeof val === 'object' && !Array.isArray(val);\n\n/**\n * Creates a matcher function from one or more glob patterns. The\n * returned function takes a string to match as its first argument,\n * and returns true if the string is a match. The returned matcher\n * function also takes a boolean as the second argument that, when true,\n * returns an object with additional information.\n *\n * ```js\n * const picomatch = require('picomatch');\n * // picomatch(glob[, options]);\n *\n * const isMatch = picomatch('*.!(*a)');\n * console.log(isMatch('a.a')); //=> false\n * console.log(isMatch('a.b')); //=> true\n * ```\n * @name picomatch\n * @param {String|Array} `globs` One or more glob patterns.\n * @param {Object=} `options`\n * @return {Function=} Returns a matcher function.\n * @api public\n */\n\nconst picomatch = (glob, options, returnState = false) => {\n if (Array.isArray(glob)) {\n const fns = glob.map(input => picomatch(input, options, returnState));\n const arrayMatcher = str => {\n for (const isMatch of fns) {\n const state = isMatch(str);\n if (state) return state;\n }\n return false;\n };\n return arrayMatcher;\n }\n\n const isState = isObject(glob) && glob.tokens && glob.input;\n\n if (glob === '' || (typeof glob !== 'string' && !isState)) {\n throw new TypeError('Expected pattern to be a non-empty string');\n }\n\n const opts = options || {};\n const posix = opts.windows;\n const regex = isState\n ? picomatch.compileRe(glob, options)\n : picomatch.makeRe(glob, options, false, true);\n\n const state = regex.state;\n delete regex.state;\n\n let isIgnored = () => false;\n if (opts.ignore) {\n const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };\n isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);\n }\n\n const matcher = (input, returnObject = false) => {\n const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });\n const result = { glob, state, regex, posix, input, output, match, isMatch };\n\n if (typeof opts.onResult === 'function') {\n opts.onResult(result);\n }\n\n if (isMatch === false) {\n result.isMatch = false;\n return returnObject ? result : false;\n }\n\n if (isIgnored(input)) {\n if (typeof opts.onIgnore === 'function') {\n opts.onIgnore(result);\n }\n result.isMatch = false;\n return returnObject ? result : false;\n }\n\n if (typeof opts.onMatch === 'function') {\n opts.onMatch(result);\n }\n return returnObject ? result : true;\n };\n\n if (returnState) {\n matcher.state = state;\n }\n\n return matcher;\n};\n\n/**\n * Test `input` with the given `regex`. This is used by the main\n * `picomatch()` function to test the input string.\n *\n * ```js\n * const picomatch = require('picomatch');\n * // picomatch.test(input, regex[, options]);\n *\n * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\\/([^/]*?))$/));\n * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }\n * ```\n * @param {String} `input` String to test.\n * @param {RegExp} `regex`\n * @return {Object} Returns an object with matching info.\n * @api public\n */\n\npicomatch.test = (input, regex, options, { glob, posix } = {}) => {\n if (typeof input !== 'string') {\n throw new TypeError('Expected input to be a string');\n }\n\n if (input === '') {\n return { isMatch: false, output: '' };\n }\n\n const opts = options || {};\n const format = opts.format || (posix ? utils.toPosixSlashes : null);\n let match = input === glob;\n let output = (match && format) ? format(input) : input;\n\n if (match === false) {\n output = format ? format(input) : input;\n match = output === glob;\n }\n\n if (match === false || opts.capture === true) {\n if (opts.matchBase === true || opts.basename === true) {\n match = picomatch.matchBase(input, regex, options, posix);\n } else {\n match = regex.exec(output);\n }\n }\n\n return { isMatch: Boolean(match), match, output };\n};\n\n/**\n * Match the basename of a filepath.\n *\n * ```js\n * const picomatch = require('picomatch');\n * // picomatch.matchBase(input, glob[, options]);\n * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true\n * ```\n * @param {String} `input` String to test.\n * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).\n * @return {Boolean}\n * @api public\n */\n\npicomatch.matchBase = (input, glob, options) => {\n const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);\n return regex.test(utils.basename(input));\n};\n\n/**\n * Returns true if **any** of the given glob `patterns` match the specified `string`.\n *\n * ```js\n * const picomatch = require('picomatch');\n * // picomatch.isMatch(string, patterns[, options]);\n *\n * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true\n * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false\n * ```\n * @param {String|Array} str The string to test.\n * @param {String|Array} patterns One or more glob patterns to use for matching.\n * @param {Object} [options] See available [options](#options).\n * @return {Boolean} Returns true if any patterns match `str`\n * @api public\n */\n\npicomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);\n\n/**\n * Parse a glob pattern to create the source string for a regular\n * expression.\n *\n * ```js\n * const picomatch = require('picomatch');\n * const result = picomatch.parse(pattern[, options]);\n * ```\n * @param {String} `pattern`\n * @param {Object} `options`\n * @return {Object} Returns an object with useful properties and output to be used as a regex source string.\n * @api public\n */\n\npicomatch.parse = (pattern, options) => {\n if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));\n return parse(pattern, { ...options, fastpaths: false });\n};\n\n/**\n * Scan a glob pattern to separate the pattern into segments.\n *\n * ```js\n * const picomatch = require('picomatch');\n * // picomatch.scan(input[, options]);\n *\n * const result = picomatch.scan('!./foo/*.js');\n * console.log(result);\n * { prefix: '!./',\n * input: '!./foo/*.js',\n * start: 3,\n * base: 'foo',\n * glob: '*.js',\n * isBrace: false,\n * isBracket: false,\n * isGlob: true,\n * isExtglob: false,\n * isGlobstar: false,\n * negated: true }\n * ```\n * @param {String} `input` Glob pattern to scan.\n * @param {Object} `options`\n * @return {Object} Returns an object with\n * @api public\n */\n\npicomatch.scan = (input, options) => scan(input, options);\n\n/**\n * Compile a regular expression from the `state` object returned by the\n * [parse()](#parse) method.\n *\n * ```js\n * const picomatch = require('picomatch');\n * const state = picomatch.parse('*.js');\n * // picomatch.compileRe(state[, options]);\n *\n * console.log(picomatch.compileRe(state));\n * //=> /^(?:(?!\\.)(?=.)[^/]*?\\.js)$/\n * ```\n * @param {Object} `state`\n * @param {Object} `options`\n * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.\n * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.\n * @return {RegExp}\n * @api public\n */\n\npicomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {\n if (returnOutput === true) {\n return state.output;\n }\n\n const opts = options || {};\n const prepend = opts.contains ? '' : '^';\n const append = opts.contains ? '' : '$';\n\n let source = `${prepend}(?:${state.output})${append}`;\n if (state && state.negated === true) {\n source = `^(?!${source}).*$`;\n }\n\n const regex = picomatch.toRegex(source, options);\n if (returnState === true) {\n regex.state = state;\n }\n\n return regex;\n};\n\n/**\n * Create a regular expression from a parsed glob pattern.\n *\n * ```js\n * const picomatch = require('picomatch');\n * // picomatch.makeRe(state[, options]);\n *\n * const result = picomatch.makeRe('*.js');\n * console.log(result);\n * //=> /^(?:(?!\\.)(?=.)[^/]*?\\.js)$/\n * ```\n * @param {String} `state` The object returned from the `.parse` method.\n * @param {Object} `options`\n * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.\n * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.\n * @return {RegExp} Returns a regex created from the given pattern.\n * @api public\n */\n\npicomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {\n if (!input || typeof input !== 'string') {\n throw new TypeError('Expected a non-empty string');\n }\n\n let parsed = { negated: false, fastpaths: true };\n\n if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {\n parsed.output = parse.fastpaths(input, options);\n }\n\n if (!parsed.output) {\n parsed = parse(input, options);\n }\n\n return picomatch.compileRe(parsed, options, returnOutput, returnState);\n};\n\n/**\n * Create a regular expression from the given regex source string.\n *\n * ```js\n * const picomatch = require('picomatch');\n * // picomatch.toRegex(source[, options]);\n *\n * const { output } = picomatch.parse('*.js');\n * console.log(picomatch.toRegex(output));\n * //=> /^(?:(?!\\.)(?=.)[^/]*?\\.js)$/\n * ```\n * @param {String} `source` Regular expression source string.\n * @param {Object} `options`\n * @return {RegExp}\n * @api public\n */\n\npicomatch.toRegex = (source, options) => {\n try {\n const opts = options || {};\n return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));\n } catch (err) {\n if (options && options.debug === true) throw err;\n return /$^/;\n }\n};\n\n/**\n * Picomatch constants.\n * @return {Object}\n */\n\npicomatch.constants = constants;\n\n/**\n * Expose \"picomatch\"\n */\n\nmodule.exports = picomatch;\n","'use strict';\n\nconst pico = require('./lib/picomatch');\nconst utils = require('./lib/utils');\n\nfunction picomatch(glob, options, returnState = false) {\n // default to os.platform()\n if (options && (options.windows === null || options.windows === undefined)) {\n // don't mutate the original options object\n options = { ...options, windows: utils.isWindows() };\n }\n\n return pico(glob, options, returnState);\n}\n\nObject.assign(picomatch, pico);\nmodule.exports = picomatch;\n","import nativeFs from \"fs\";\nimport path, { posix } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { fdir } from \"fdir\";\nimport picomatch from \"picomatch\";\n\n//#region src/utils.ts\nconst isReadonlyArray = Array.isArray;\nconst isWin = process.platform === \"win32\";\nconst ONLY_PARENT_DIRECTORIES = /^(\\/?\\.\\.)+$/;\nfunction getPartialMatcher(patterns, options = {}) {\n\tconst patternsCount = patterns.length;\n\tconst patternsParts = Array(patternsCount);\n\tconst matchers = Array(patternsCount);\n\tconst globstarEnabled = !options.noglobstar;\n\tfor (let i = 0; i < patternsCount; i++) {\n\t\tconst parts = splitPattern(patterns[i]);\n\t\tpatternsParts[i] = parts;\n\t\tconst partsCount = parts.length;\n\t\tconst partMatchers = Array(partsCount);\n\t\tfor (let j = 0; j < partsCount; j++) partMatchers[j] = picomatch(parts[j], options);\n\t\tmatchers[i] = partMatchers;\n\t}\n\treturn (input) => {\n\t\tconst inputParts = input.split(\"/\");\n\t\tif (inputParts[0] === \"..\" && ONLY_PARENT_DIRECTORIES.test(input)) return true;\n\t\tfor (let i = 0; i < patterns.length; i++) {\n\t\t\tconst patternParts = patternsParts[i];\n\t\t\tconst matcher = matchers[i];\n\t\t\tconst inputPatternCount = inputParts.length;\n\t\t\tconst minParts = Math.min(inputPatternCount, patternParts.length);\n\t\t\tlet j = 0;\n\t\t\twhile (j < minParts) {\n\t\t\t\tconst part = patternParts[j];\n\t\t\t\tif (part.includes(\"/\")) return true;\n\t\t\t\tconst match = matcher[j](inputParts[j]);\n\t\t\t\tif (!match) break;\n\t\t\t\tif (globstarEnabled && part === \"**\") return true;\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tif (j === inputPatternCount) return true;\n\t\t}\n\t\treturn false;\n\t};\n}\n/* node:coverage ignore next 2 */\nconst WIN32_ROOT_DIR = /^[A-Z]:\\/$/i;\nconst isRoot = isWin ? (p) => WIN32_ROOT_DIR.test(p) : (p) => p === \"/\";\nfunction buildFormat(cwd, root, absolute) {\n\tif (cwd === root || root.startsWith(`${cwd}/`)) {\n\t\tif (absolute) {\n\t\t\tconst start = isRoot(cwd) ? cwd.length : cwd.length + 1;\n\t\t\treturn (p, isDir) => p.slice(start, isDir ? -1 : void 0) || \".\";\n\t\t}\n\t\tconst prefix = root.slice(cwd.length + 1);\n\t\tif (prefix) return (p, isDir) => {\n\t\t\tif (p === \".\") return prefix;\n\t\t\tconst result = `${prefix}/${p}`;\n\t\t\treturn isDir ? result.slice(0, -1) : result;\n\t\t};\n\t\treturn (p, isDir) => isDir && p !== \".\" ? p.slice(0, -1) : p;\n\t}\n\tif (absolute) return (p) => posix.relative(cwd, p) || \".\";\n\treturn (p) => posix.relative(cwd, `${root}/${p}`) || \".\";\n}\nfunction buildRelative(cwd, root) {\n\tif (root.startsWith(`${cwd}/`)) {\n\t\tconst prefix = root.slice(cwd.length + 1);\n\t\treturn (p) => `${prefix}/${p}`;\n\t}\n\treturn (p) => {\n\t\tconst result = posix.relative(cwd, `${root}/${p}`);\n\t\tif (p.endsWith(\"/\") && result !== \"\") return `${result}/`;\n\t\treturn result || \".\";\n\t};\n}\nconst splitPatternOptions = { parts: true };\nfunction splitPattern(path$1) {\n\tvar _result$parts;\n\tconst result = picomatch.scan(path$1, splitPatternOptions);\n\treturn ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1];\n}\nconst ESCAPED_WIN32_BACKSLASHES = /\\\\(?![()[\\]{}!+@])/g;\nfunction convertPosixPathToPattern(path$1) {\n\treturn escapePosixPath(path$1);\n}\nfunction convertWin32PathToPattern(path$1) {\n\treturn escapeWin32Path(path$1).replace(ESCAPED_WIN32_BACKSLASHES, \"/\");\n}\n/**\n* Converts a path to a pattern depending on the platform.\n* Identical to {@link escapePath} on POSIX systems.\n* @see {@link https://superchupu.dev/tinyglobby/documentation#convertPathToPattern}\n*/\n/* node:coverage ignore next 3 */\nconst convertPathToPattern = isWin ? convertWin32PathToPattern : convertPosixPathToPattern;\nconst POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\\\)([()[\\]{}*?|]|^!|[!+@](?=\\()|\\\\(?![()[\\]{}!*+?@|]))/g;\nconst WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\\\)([()[\\]{}]|^!|[!+@](?=\\())/g;\nconst escapePosixPath = (path$1) => path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, \"\\\\$&\");\nconst escapeWin32Path = (path$1) => path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, \"\\\\$&\");\n/**\n* Escapes a path's special characters depending on the platform.\n* @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}\n*/\n/* node:coverage ignore next */\nconst escapePath = isWin ? escapeWin32Path : escapePosixPath;\n/**\n* Checks if a pattern has dynamic parts.\n*\n* Has a few minor differences with [`fast-glob`](https://github.com/mrmlnc/fast-glob) for better accuracy:\n*\n* - Doesn't necessarily return `false` on patterns that include `\\`.\n* - Returns `true` if the pattern includes parentheses, regardless of them representing one single pattern or not.\n* - Returns `true` for unfinished glob extensions i.e. `(h`, `+(h`.\n* - Returns `true` for unfinished brace expansions as long as they include `,` or `..`.\n*\n* @see {@link https://superchupu.dev/tinyglobby/documentation#isDynamicPattern}\n*/\nfunction isDynamicPattern(pattern, options) {\n\tif ((options === null || options === void 0 ? void 0 : options.caseSensitiveMatch) === false) return true;\n\tconst scan = picomatch.scan(pattern);\n\treturn scan.isGlob || scan.negated;\n}\nfunction log(...tasks) {\n\tconsole.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString(\"es\")}]`, ...tasks);\n}\n\n//#endregion\n//#region src/index.ts\nconst PARENT_DIRECTORY = /^(\\/?\\.\\.)+/;\nconst ESCAPING_BACKSLASHES = /\\\\(?=[()[\\]{}!*+?@|])/g;\nconst BACKSLASHES = /\\\\/g;\nfunction normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {\n\tlet result = pattern;\n\tif (pattern.endsWith(\"/\")) result = pattern.slice(0, -1);\n\tif (!result.endsWith(\"*\") && expandDirectories) result += \"/**\";\n\tconst escapedCwd = escapePath(cwd);\n\tif (path.isAbsolute(result.replace(ESCAPING_BACKSLASHES, \"\"))) result = posix.relative(escapedCwd, result);\n\telse result = posix.normalize(result);\n\tconst parentDirectoryMatch = PARENT_DIRECTORY.exec(result);\n\tconst parts = splitPattern(result);\n\tif (parentDirectoryMatch === null || parentDirectoryMatch === void 0 ? void 0 : parentDirectoryMatch[0]) {\n\t\tconst n = (parentDirectoryMatch[0].length + 1) / 3;\n\t\tlet i = 0;\n\t\tconst cwdParts = escapedCwd.split(\"/\");\n\t\twhile (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {\n\t\t\tresult = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || \".\";\n\t\t\ti++;\n\t\t}\n\t\tconst potentialRoot = posix.join(cwd, parentDirectoryMatch[0].slice(i * 3));\n\t\tif (!potentialRoot.startsWith(\".\") && props.root.length > potentialRoot.length) {\n\t\t\tprops.root = potentialRoot;\n\t\t\tprops.depthOffset = -n + i;\n\t\t}\n\t}\n\tif (!isIgnore && props.depthOffset >= 0) {\n\t\tvar _props$commonPath;\n\t\t(_props$commonPath = props.commonPath) !== null && _props$commonPath !== void 0 || (props.commonPath = parts);\n\t\tconst newCommonPath = [];\n\t\tconst length = Math.min(props.commonPath.length, parts.length);\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\tconst part = parts[i];\n\t\t\tif (part === \"**\" && !parts[i + 1]) {\n\t\t\t\tnewCommonPath.pop();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (part !== props.commonPath[i] || isDynamicPattern(part) || i === parts.length - 1) break;\n\t\t\tnewCommonPath.push(part);\n\t\t}\n\t\tprops.depthOffset = newCommonPath.length;\n\t\tprops.commonPath = newCommonPath;\n\t\tprops.root = newCommonPath.length > 0 ? posix.join(cwd, ...newCommonPath) : cwd;\n\t}\n\treturn result;\n}\nfunction processPatterns({ patterns = [\"**/*\"], ignore = [], expandDirectories = true }, cwd, props) {\n\tif (typeof patterns === \"string\") patterns = [patterns];\n\tif (typeof ignore === \"string\") ignore = [ignore];\n\tconst matchPatterns = [];\n\tconst ignorePatterns = [];\n\tfor (const pattern of ignore) {\n\t\tif (!pattern) continue;\n\t\tif (pattern[0] !== \"!\" || pattern[1] === \"(\") ignorePatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, true));\n\t}\n\tfor (const pattern of patterns) {\n\t\tif (!pattern) continue;\n\t\tif (pattern[0] !== \"!\" || pattern[1] === \"(\") matchPatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, false));\n\t\telse if (pattern[1] !== \"!\" || pattern[2] === \"(\") ignorePatterns.push(normalizePattern(pattern.slice(1), expandDirectories, cwd, props, true));\n\t}\n\treturn {\n\t\tmatch: matchPatterns,\n\t\tignore: ignorePatterns\n\t};\n}\nfunction formatPaths(paths, relative) {\n\tfor (let i = paths.length - 1; i >= 0; i--) {\n\t\tconst path$1 = paths[i];\n\t\tpaths[i] = relative(path$1);\n\t}\n\treturn paths;\n}\nfunction normalizeCwd(cwd) {\n\tif (!cwd) return process.cwd().replace(BACKSLASHES, \"/\");\n\tif (cwd instanceof URL) return fileURLToPath(cwd).replace(BACKSLASHES, \"/\");\n\treturn path.resolve(cwd).replace(BACKSLASHES, \"/\");\n}\nfunction getCrawler(patterns, inputOptions = {}) {\n\tconst options = process.env.TINYGLOBBY_DEBUG ? {\n\t\t...inputOptions,\n\t\tdebug: true\n\t} : inputOptions;\n\tconst cwd = normalizeCwd(options.cwd);\n\tif (options.debug) log(\"globbing with:\", {\n\t\tpatterns,\n\t\toptions,\n\t\tcwd\n\t});\n\tif (Array.isArray(patterns) && patterns.length === 0) return [{\n\t\tsync: () => [],\n\t\twithPromise: async () => []\n\t}, false];\n\tconst props = {\n\t\troot: cwd,\n\t\tcommonPath: null,\n\t\tdepthOffset: 0\n\t};\n\tconst processed = processPatterns({\n\t\t...options,\n\t\tpatterns\n\t}, cwd, props);\n\tif (options.debug) log(\"internal processing patterns:\", processed);\n\tconst matchOptions = {\n\t\tdot: options.dot,\n\t\tnobrace: options.braceExpansion === false,\n\t\tnocase: options.caseSensitiveMatch === false,\n\t\tnoextglob: options.extglob === false,\n\t\tnoglobstar: options.globstar === false,\n\t\tposix: true\n\t};\n\tconst matcher = picomatch(processed.match, {\n\t\t...matchOptions,\n\t\tignore: processed.ignore\n\t});\n\tconst ignore = picomatch(processed.ignore, matchOptions);\n\tconst partialMatcher = getPartialMatcher(processed.match, matchOptions);\n\tconst format = buildFormat(cwd, props.root, options.absolute);\n\tconst formatExclude = options.absolute ? format : buildFormat(cwd, props.root, true);\n\tconst fdirOptions = {\n\t\tfilters: [options.debug ? (p, isDirectory) => {\n\t\t\tconst path$1 = format(p, isDirectory);\n\t\t\tconst matches = matcher(path$1);\n\t\t\tif (matches) log(`matched ${path$1}`);\n\t\t\treturn matches;\n\t\t} : (p, isDirectory) => matcher(format(p, isDirectory))],\n\t\texclude: options.debug ? (_, p) => {\n\t\t\tconst relativePath = formatExclude(p, true);\n\t\t\tconst skipped = relativePath !== \".\" && !partialMatcher(relativePath) || ignore(relativePath);\n\t\t\tif (skipped) log(`skipped ${p}`);\n\t\t\telse log(`crawling ${p}`);\n\t\t\treturn skipped;\n\t\t} : (_, p) => {\n\t\t\tconst relativePath = formatExclude(p, true);\n\t\t\treturn relativePath !== \".\" && !partialMatcher(relativePath) || ignore(relativePath);\n\t\t},\n\t\tfs: options.fs ? {\n\t\t\treaddir: options.fs.readdir || nativeFs.readdir,\n\t\t\treaddirSync: options.fs.readdirSync || nativeFs.readdirSync,\n\t\t\trealpath: options.fs.realpath || nativeFs.realpath,\n\t\t\trealpathSync: options.fs.realpathSync || nativeFs.realpathSync,\n\t\t\tstat: options.fs.stat || nativeFs.stat,\n\t\t\tstatSync: options.fs.statSync || nativeFs.statSync\n\t\t} : void 0,\n\t\tpathSeparator: \"/\",\n\t\trelativePaths: true,\n\t\tresolveSymlinks: true,\n\t\tsignal: options.signal\n\t};\n\tif (options.deep !== void 0) fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);\n\tif (options.absolute) {\n\t\tfdirOptions.relativePaths = false;\n\t\tfdirOptions.resolvePaths = true;\n\t\tfdirOptions.includeBasePath = true;\n\t}\n\tif (options.followSymbolicLinks === false) {\n\t\tfdirOptions.resolveSymlinks = false;\n\t\tfdirOptions.excludeSymlinks = true;\n\t}\n\tif (options.onlyDirectories) {\n\t\tfdirOptions.excludeFiles = true;\n\t\tfdirOptions.includeDirs = true;\n\t} else if (options.onlyFiles === false) fdirOptions.includeDirs = true;\n\tprops.root = props.root.replace(BACKSLASHES, \"\");\n\tconst root = props.root;\n\tif (options.debug) log(\"internal properties:\", props);\n\tconst relative = cwd !== root && !options.absolute && buildRelative(cwd, props.root);\n\treturn [new fdir(fdirOptions).crawl(root), relative];\n}\nasync function glob(patternsOrOptions, options) {\n\tif (patternsOrOptions && (options === null || options === void 0 ? void 0 : options.patterns)) throw new Error(\"Cannot pass patterns as both an argument and an option\");\n\tconst isModern = isReadonlyArray(patternsOrOptions) || typeof patternsOrOptions === \"string\";\n\tconst opts = isModern ? options : patternsOrOptions;\n\tconst patterns = isModern ? patternsOrOptions : patternsOrOptions.patterns;\n\tconst [crawler, relative] = getCrawler(patterns, opts);\n\tif (!relative) return crawler.withPromise();\n\treturn formatPaths(await crawler.withPromise(), relative);\n}\nfunction globSync(patternsOrOptions, options) {\n\tif (patternsOrOptions && (options === null || options === void 0 ? void 0 : options.patterns)) throw new Error(\"Cannot pass patterns as both an argument and an option\");\n\tconst isModern = isReadonlyArray(patternsOrOptions) || typeof patternsOrOptions === \"string\";\n\tconst opts = isModern ? options : patternsOrOptions;\n\tconst patterns = isModern ? patternsOrOptions : patternsOrOptions.patterns;\n\tconst [crawler, relative] = getCrawler(patterns, opts);\n\tif (!relative) return crawler.sync();\n\treturn formatPaths(crawler.sync(), relative);\n}\n\n//#endregion\nexport { convertPathToPattern, escapePath, glob, globSync, isDynamicPattern };","import ts9 from 'typescript';\n\n// src/comments.ts\nfunction forEachToken(node, callback, sourceFile = node.getSourceFile()) {\n const queue = [];\n while (true) {\n if (ts9.isTokenKind(node.kind)) {\n callback(node);\n } else if (\n // eslint-disable-next-line deprecation/deprecation -- need for support of TS < 4.7\n node.kind !== ts9.SyntaxKind.JSDocComment\n ) {\n const children = node.getChildren(sourceFile);\n if (children.length === 1) {\n node = children[0];\n continue;\n }\n for (let i = children.length - 1; i >= 0; --i) {\n queue.push(children[i]);\n }\n }\n if (queue.length === 0) {\n break;\n }\n node = queue.pop();\n }\n}\n\n// src/comments.ts\nfunction canHaveTrailingTrivia(token) {\n switch (token.kind) {\n case ts9.SyntaxKind.CloseBraceToken:\n return token.parent.kind !== ts9.SyntaxKind.JsxExpression || !isJsxElementOrFragment(token.parent.parent);\n case ts9.SyntaxKind.GreaterThanToken:\n switch (token.parent.kind) {\n case ts9.SyntaxKind.JsxOpeningElement:\n return token.end !== token.parent.end;\n case ts9.SyntaxKind.JsxOpeningFragment:\n return false;\n // would be inside the fragment\n case ts9.SyntaxKind.JsxSelfClosingElement:\n return token.end !== token.parent.end || // if end is not equal, this is part of the type arguments list\n !isJsxElementOrFragment(token.parent.parent);\n // there's only trailing trivia if it's the end of the top element\n case ts9.SyntaxKind.JsxClosingElement:\n case ts9.SyntaxKind.JsxClosingFragment:\n return !isJsxElementOrFragment(token.parent.parent.parent);\n }\n }\n return true;\n}\nfunction isJsxElementOrFragment(node) {\n return node.kind === ts9.SyntaxKind.JsxElement || node.kind === ts9.SyntaxKind.JsxFragment;\n}\nfunction forEachComment(node, callback, sourceFile = node.getSourceFile()) {\n const fullText = sourceFile.text;\n const notJsx = sourceFile.languageVariant !== ts9.LanguageVariant.JSX;\n return forEachToken(\n node,\n (token) => {\n if (token.pos === token.end) {\n return;\n }\n if (token.kind !== ts9.SyntaxKind.JsxText) {\n ts9.forEachLeadingCommentRange(\n fullText,\n // skip shebang at position 0\n token.pos === 0 ? (ts9.getShebang(fullText) ?? \"\").length : token.pos,\n commentCallback\n );\n }\n if (notJsx || canHaveTrailingTrivia(token)) {\n return ts9.forEachTrailingCommentRange(\n fullText,\n token.end,\n commentCallback\n );\n }\n },\n sourceFile\n );\n function commentCallback(pos, end, kind) {\n callback(fullText, { end, kind, pos });\n }\n}\nfunction isCompilerOptionEnabled(options, option) {\n switch (option) {\n case \"stripInternal\":\n case \"declarationMap\":\n case \"emitDeclarationOnly\":\n return options[option] === true && isCompilerOptionEnabled(options, \"declaration\");\n case \"declaration\":\n return options.declaration || isCompilerOptionEnabled(options, \"composite\");\n case \"incremental\":\n return options.incremental === void 0 ? isCompilerOptionEnabled(options, \"composite\") : options.incremental;\n case \"skipDefaultLibCheck\":\n return options.skipDefaultLibCheck || isCompilerOptionEnabled(options, \"skipLibCheck\");\n case \"suppressImplicitAnyIndexErrors\":\n return options.suppressImplicitAnyIndexErrors === true && isCompilerOptionEnabled(options, \"noImplicitAny\");\n case \"allowSyntheticDefaultImports\":\n return options.allowSyntheticDefaultImports !== void 0 ? options.allowSyntheticDefaultImports : isCompilerOptionEnabled(options, \"esModuleInterop\") || options.module === ts9.ModuleKind.System;\n case \"noUncheckedIndexedAccess\":\n return options.noUncheckedIndexedAccess === true && isCompilerOptionEnabled(options, \"strictNullChecks\");\n case \"allowJs\":\n return options.allowJs === void 0 ? isCompilerOptionEnabled(options, \"checkJs\") : options.allowJs;\n case \"noImplicitAny\":\n case \"noImplicitThis\":\n case \"strictNullChecks\":\n case \"strictFunctionTypes\":\n case \"strictPropertyInitialization\":\n case \"alwaysStrict\":\n case \"strictBindCallApply\":\n return isStrictCompilerOptionEnabled(\n options,\n option\n );\n }\n return options[option] === true;\n}\nfunction isStrictCompilerOptionEnabled(options, option) {\n return (options.strict ? options[option] !== false : options[option] === true) && (option !== \"strictPropertyInitialization\" || isStrictCompilerOptionEnabled(options, \"strictNullChecks\"));\n}\nfunction isFlagSet(allFlags, flag) {\n return (allFlags & flag) !== 0;\n}\nfunction isFlagSetOnObject(obj, flag) {\n return isFlagSet(obj.flags, flag);\n}\nfunction isModifierFlagSet(node, flag) {\n return isFlagSet(ts9.getCombinedModifierFlags(node), flag);\n}\nvar isNodeFlagSet = isFlagSetOnObject;\nfunction isObjectFlagSet(objectType, flag) {\n return isFlagSet(objectType.objectFlags, flag);\n}\nvar isSymbolFlagSet = isFlagSetOnObject;\nfunction isTransientSymbolLinksFlagSet(links, flag) {\n return isFlagSet(links.checkFlags, flag);\n}\nvar isTypeFlagSet = isFlagSetOnObject;\n\n// src/modifiers.ts\nfunction includesModifier(modifiers, ...kinds) {\n if (modifiers === void 0) {\n return false;\n }\n for (const modifier of modifiers) {\n if (kinds.includes(modifier.kind)) {\n return true;\n }\n }\n return false;\n}\nfunction isAssignmentKind(kind) {\n return kind >= ts9.SyntaxKind.FirstAssignment && kind <= ts9.SyntaxKind.LastAssignment;\n}\nfunction isNumericPropertyName(name) {\n return String(+name) === name;\n}\nfunction charSize(ch) {\n return ch >= 65536 ? 2 : 1;\n}\nfunction isValidPropertyAccess(text, languageVersion = ts9.ScriptTarget.Latest) {\n if (text.length === 0) {\n return false;\n }\n let ch = text.codePointAt(0);\n if (!ts9.isIdentifierStart(ch, languageVersion)) {\n return false;\n }\n for (let i = charSize(ch); i < text.length; i += charSize(ch)) {\n ch = text.codePointAt(i);\n if (!ts9.isIdentifierPart(ch, languageVersion)) {\n return false;\n }\n }\n return true;\n}\n\n// src/nodes/access.ts\nvar AccessKind = /* @__PURE__ */ ((AccessKind2) => {\n AccessKind2[AccessKind2[\"None\"] = 0] = \"None\";\n AccessKind2[AccessKind2[\"Read\"] = 1] = \"Read\";\n AccessKind2[AccessKind2[\"Write\"] = 2] = \"Write\";\n AccessKind2[AccessKind2[\"Delete\"] = 4] = \"Delete\";\n AccessKind2[AccessKind2[\"ReadWrite\"] = 3] = \"ReadWrite\";\n return AccessKind2;\n})(AccessKind || {});\nfunction getAccessKind(node) {\n const parent = node.parent;\n switch (parent.kind) {\n case ts9.SyntaxKind.DeleteExpression:\n return 4 /* Delete */;\n case ts9.SyntaxKind.PostfixUnaryExpression:\n return 3 /* ReadWrite */;\n case ts9.SyntaxKind.PrefixUnaryExpression:\n return parent.operator === ts9.SyntaxKind.PlusPlusToken || parent.operator === ts9.SyntaxKind.MinusMinusToken ? 3 /* ReadWrite */ : 1 /* Read */;\n case ts9.SyntaxKind.BinaryExpression:\n return parent.right === node ? 1 /* Read */ : !isAssignmentKind(parent.operatorToken.kind) ? 1 /* Read */ : parent.operatorToken.kind === ts9.SyntaxKind.EqualsToken ? 2 /* Write */ : 3 /* ReadWrite */;\n case ts9.SyntaxKind.ShorthandPropertyAssignment:\n return parent.objectAssignmentInitializer === node ? 1 /* Read */ : isInDestructuringAssignment(parent) ? 2 /* Write */ : 1 /* Read */;\n case ts9.SyntaxKind.PropertyAssignment:\n return parent.name === node ? 0 /* None */ : isInDestructuringAssignment(parent) ? 2 /* Write */ : 1 /* Read */;\n case ts9.SyntaxKind.ArrayLiteralExpression:\n case ts9.SyntaxKind.SpreadElement:\n case ts9.SyntaxKind.SpreadAssignment:\n return isInDestructuringAssignment(\n parent\n ) ? 2 /* Write */ : 1 /* Read */;\n case ts9.SyntaxKind.ParenthesizedExpression:\n case ts9.SyntaxKind.NonNullExpression:\n case ts9.SyntaxKind.TypeAssertionExpression:\n case ts9.SyntaxKind.AsExpression:\n return getAccessKind(parent);\n case ts9.SyntaxKind.ForOfStatement:\n case ts9.SyntaxKind.ForInStatement:\n return parent.initializer === node ? 2 /* Write */ : 1 /* Read */;\n case ts9.SyntaxKind.ExpressionWithTypeArguments:\n return parent.parent.token === ts9.SyntaxKind.ExtendsKeyword && parent.parent.parent.kind !== ts9.SyntaxKind.InterfaceDeclaration ? 1 /* Read */ : 0 /* None */;\n case ts9.SyntaxKind.ComputedPropertyName:\n case ts9.SyntaxKind.ExpressionStatement:\n case ts9.SyntaxKind.TypeOfExpression:\n case ts9.SyntaxKind.ElementAccessExpression:\n case ts9.SyntaxKind.ForStatement:\n case ts9.SyntaxKind.IfStatement:\n case ts9.SyntaxKind.DoStatement:\n case ts9.SyntaxKind.WhileStatement:\n case ts9.SyntaxKind.SwitchStatement:\n case ts9.SyntaxKind.WithStatement:\n case ts9.SyntaxKind.ThrowStatement:\n case ts9.SyntaxKind.CallExpression:\n case ts9.SyntaxKind.NewExpression:\n case ts9.SyntaxKind.TaggedTemplateExpression:\n case ts9.SyntaxKind.JsxExpression:\n case ts9.SyntaxKind.Decorator:\n case ts9.SyntaxKind.TemplateSpan:\n case ts9.SyntaxKind.JsxOpeningElement:\n case ts9.SyntaxKind.JsxSelfClosingElement:\n case ts9.SyntaxKind.JsxSpreadAttribute:\n case ts9.SyntaxKind.VoidExpression:\n case ts9.SyntaxKind.ReturnStatement:\n case ts9.SyntaxKind.AwaitExpression:\n case ts9.SyntaxKind.YieldExpression:\n case ts9.SyntaxKind.ConditionalExpression:\n case ts9.SyntaxKind.CaseClause:\n case ts9.SyntaxKind.JsxElement:\n return 1 /* Read */;\n case ts9.SyntaxKind.ArrowFunction:\n return parent.body === node ? 1 /* Read */ : 2 /* Write */;\n case ts9.SyntaxKind.PropertyDeclaration:\n case ts9.SyntaxKind.VariableDeclaration:\n case ts9.SyntaxKind.Parameter:\n case ts9.SyntaxKind.EnumMember:\n case ts9.SyntaxKind.BindingElement:\n case ts9.SyntaxKind.JsxAttribute:\n return parent.initializer === node ? 1 /* Read */ : 0 /* None */;\n case ts9.SyntaxKind.PropertyAccessExpression:\n return parent.expression === node ? 1 /* Read */ : 0 /* None */;\n case ts9.SyntaxKind.ExportAssignment:\n return parent.isExportEquals ? 1 /* Read */ : 0 /* None */;\n }\n return 0 /* None */;\n}\nfunction isInDestructuringAssignment(node) {\n switch (node.kind) {\n case ts9.SyntaxKind.ShorthandPropertyAssignment:\n if (node.objectAssignmentInitializer !== void 0) {\n return true;\n }\n // falls through\n case ts9.SyntaxKind.PropertyAssignment:\n case ts9.SyntaxKind.SpreadAssignment:\n node = node.parent;\n break;\n case ts9.SyntaxKind.SpreadElement:\n if (node.parent.kind !== ts9.SyntaxKind.ArrayLiteralExpression) {\n return false;\n }\n node = node.parent;\n }\n while (true) {\n switch (node.parent.kind) {\n case ts9.SyntaxKind.BinaryExpression:\n return node.parent.left === node && node.parent.operatorToken.kind === ts9.SyntaxKind.EqualsToken;\n case ts9.SyntaxKind.ForOfStatement:\n return node.parent.initializer === node;\n case ts9.SyntaxKind.ArrayLiteralExpression:\n case ts9.SyntaxKind.ObjectLiteralExpression:\n node = node.parent;\n break;\n case ts9.SyntaxKind.SpreadAssignment:\n case ts9.SyntaxKind.PropertyAssignment:\n node = node.parent.parent;\n break;\n case ts9.SyntaxKind.SpreadElement:\n if (node.parent.parent.kind !== ts9.SyntaxKind.ArrayLiteralExpression) {\n return false;\n }\n node = node.parent.parent;\n break;\n default:\n return false;\n }\n }\n}\nfunction isAbstractKeyword(node) {\n return node.kind === ts9.SyntaxKind.AbstractKeyword;\n}\nfunction isAccessorKeyword(node) {\n return node.kind === ts9.SyntaxKind.AccessorKeyword;\n}\nfunction isAnyKeyword(node) {\n return node.kind === ts9.SyntaxKind.AnyKeyword;\n}\nfunction isAssertKeyword(node) {\n return node.kind === ts9.SyntaxKind.AssertKeyword;\n}\nfunction isAssertsKeyword(node) {\n return node.kind === ts9.SyntaxKind.AssertsKeyword;\n}\nfunction isAsyncKeyword(node) {\n return node.kind === ts9.SyntaxKind.AsyncKeyword;\n}\nfunction isAwaitKeyword(node) {\n return node.kind === ts9.SyntaxKind.AwaitKeyword;\n}\nfunction isBigIntKeyword(node) {\n return node.kind === ts9.SyntaxKind.BigIntKeyword;\n}\nfunction isBooleanKeyword(node) {\n return node.kind === ts9.SyntaxKind.BooleanKeyword;\n}\nfunction isColonToken(node) {\n return node.kind === ts9.SyntaxKind.ColonToken;\n}\nfunction isConstKeyword(node) {\n return node.kind === ts9.SyntaxKind.ConstKeyword;\n}\nfunction isDeclareKeyword(node) {\n return node.kind === ts9.SyntaxKind.DeclareKeyword;\n}\nfunction isDefaultKeyword(node) {\n return node.kind === ts9.SyntaxKind.DefaultKeyword;\n}\nfunction isDotToken(node) {\n return node.kind === ts9.SyntaxKind.DotToken;\n}\nfunction isEndOfFileToken(node) {\n return node.kind === ts9.SyntaxKind.EndOfFileToken;\n}\nfunction isEqualsGreaterThanToken(node) {\n return node.kind === ts9.SyntaxKind.EqualsGreaterThanToken;\n}\nfunction isEqualsToken(node) {\n return node.kind === ts9.SyntaxKind.EqualsToken;\n}\nfunction isExclamationToken(node) {\n return node.kind === ts9.SyntaxKind.ExclamationToken;\n}\nfunction isExportKeyword(node) {\n return node.kind === ts9.SyntaxKind.ExportKeyword;\n}\nfunction isFalseKeyword(node) {\n return node.kind === ts9.SyntaxKind.FalseKeyword;\n}\nfunction isFalseLiteral(node) {\n return node.kind === ts9.SyntaxKind.FalseKeyword;\n}\nfunction isImportExpression(node) {\n return node.kind === ts9.SyntaxKind.ImportKeyword;\n}\nfunction isImportKeyword(node) {\n return node.kind === ts9.SyntaxKind.ImportKeyword;\n}\nfunction isInKeyword(node) {\n return node.kind === ts9.SyntaxKind.InKeyword;\n}\nfunction isInputFiles(node) {\n return node.kind === ts9.SyntaxKind.InputFiles;\n}\nfunction isJSDocText(node) {\n return node.kind === ts9.SyntaxKind.JSDocText;\n}\nfunction isJsonMinusNumericLiteral(node) {\n return node.kind === ts9.SyntaxKind.PrefixUnaryExpression;\n}\nfunction isNeverKeyword(node) {\n return node.kind === ts9.SyntaxKind.NeverKeyword;\n}\nfunction isNullKeyword(node) {\n return node.kind === ts9.SyntaxKind.NullKeyword;\n}\nfunction isNullLiteral(node) {\n return node.kind === ts9.SyntaxKind.NullKeyword;\n}\nfunction isNumberKeyword(node) {\n return node.kind === ts9.SyntaxKind.NumberKeyword;\n}\nfunction isObjectKeyword(node) {\n return node.kind === ts9.SyntaxKind.ObjectKeyword;\n}\nfunction isOutKeyword(node) {\n return node.kind === ts9.SyntaxKind.OutKeyword;\n}\nfunction isOverrideKeyword(node) {\n return node.kind === ts9.SyntaxKind.OverrideKeyword;\n}\nfunction isPrivateKeyword(node) {\n return node.kind === ts9.SyntaxKind.PrivateKeyword;\n}\nfunction isProtectedKeyword(node) {\n return node.kind === ts9.SyntaxKind.ProtectedKeyword;\n}\nfunction isPublicKeyword(node) {\n return node.kind === ts9.SyntaxKind.PublicKeyword;\n}\nfunction isQuestionDotToken(node) {\n return node.kind === ts9.SyntaxKind.QuestionDotToken;\n}\nfunction isQuestionToken(node) {\n return node.kind === ts9.SyntaxKind.QuestionToken;\n}\nfunction isReadonlyKeyword(node) {\n return node.kind === ts9.SyntaxKind.ReadonlyKeyword;\n}\nfunction isStaticKeyword(node) {\n return node.kind === ts9.SyntaxKind.StaticKeyword;\n}\nfunction isStringKeyword(node) {\n return node.kind === ts9.SyntaxKind.StringKeyword;\n}\nfunction isSuperExpression(node) {\n return node.kind === ts9.SyntaxKind.SuperKeyword;\n}\nfunction isSuperKeyword(node) {\n return node.kind === ts9.SyntaxKind.SuperKeyword;\n}\nfunction isSymbolKeyword(node) {\n return node.kind === ts9.SyntaxKind.SymbolKeyword;\n}\nfunction isSyntaxList(node) {\n return node.kind === ts9.SyntaxKind.SyntaxList;\n}\nfunction isThisExpression(node) {\n return node.kind === ts9.SyntaxKind.ThisKeyword;\n}\nfunction isThisKeyword(node) {\n return node.kind === ts9.SyntaxKind.ThisKeyword;\n}\nfunction isTrueKeyword(node) {\n return node.kind === ts9.SyntaxKind.TrueKeyword;\n}\nfunction isTrueLiteral(node) {\n return node.kind === ts9.SyntaxKind.TrueKeyword;\n}\nfunction isUndefinedKeyword(node) {\n return node.kind === ts9.SyntaxKind.UndefinedKeyword;\n}\nfunction isUnknownKeyword(node) {\n return node.kind === ts9.SyntaxKind.UnknownKeyword;\n}\nfunction isUnparsedPrologue(node) {\n return node.kind === ts9.SyntaxKind.UnparsedPrologue;\n}\nfunction isUnparsedSyntheticReference(node) {\n return node.kind === ts9.SyntaxKind.UnparsedSyntheticReference;\n}\nfunction isVoidKeyword(node) {\n return node.kind === ts9.SyntaxKind.VoidKeyword;\n}\nvar [tsMajor, tsMinor] = ts9.versionMajorMinor.split(\".\").map((raw) => Number.parseInt(raw, 10));\nfunction isTsVersionAtLeast(major, minor = 0) {\n return tsMajor > major || tsMajor === major && tsMinor >= minor;\n}\n\n// src/nodes/typeGuards/union.ts\nfunction isAccessExpression(node) {\n return ts9.isPropertyAccessExpression(node) || ts9.isElementAccessExpression(node);\n}\nfunction isAccessibilityModifier(node) {\n return isPublicKeyword(node) || isPrivateKeyword(node) || isProtectedKeyword(node);\n}\nfunction isAccessorDeclaration(node) {\n return ts9.isGetAccessorDeclaration(node) || ts9.isSetAccessorDeclaration(node);\n}\nfunction isArrayBindingElement(node) {\n return ts9.isBindingElement(node) || ts9.isOmittedExpression(node);\n}\nfunction isArrayBindingOrAssignmentPattern(node) {\n return ts9.isArrayBindingPattern(node) || ts9.isArrayLiteralExpression(node);\n}\nfunction isAssignmentPattern(node) {\n return ts9.isObjectLiteralExpression(node) || ts9.isArrayLiteralExpression(node);\n}\nfunction isBindingOrAssignmentElementRestIndicator(node) {\n if (ts9.isSpreadElement(node) || ts9.isSpreadAssignment(node)) {\n return true;\n }\n if (isTsVersionAtLeast(4, 4)) {\n return ts9.isDotDotDotToken(node);\n }\n return false;\n}\nfunction isBindingOrAssignmentElementTarget(node) {\n return isBindingOrAssignmentPattern(node) || ts9.isIdentifier(node) || ts9.isPropertyAccessExpression(node) || ts9.isElementAccessExpression(node) || ts9.isOmittedExpression(node);\n}\nfunction isBindingOrAssignmentPattern(node) {\n return isObjectBindingOrAssignmentPattern(node) || isArrayBindingOrAssignmentPattern(node);\n}\nfunction isBindingPattern(node) {\n return ts9.isObjectBindingPattern(node) || ts9.isArrayBindingPattern(node);\n}\nfunction isBlockLike(node) {\n return ts9.isSourceFile(node) || ts9.isBlock(node) || ts9.isModuleBlock(node) || ts9.isCaseOrDefaultClause(node);\n}\nfunction isBooleanLiteral(node) {\n return isTrueLiteral(node) || isFalseLiteral(node);\n}\nfunction isClassLikeDeclaration(node) {\n return ts9.isClassDeclaration(node) || ts9.isClassExpression(node);\n}\nfunction isClassMemberModifier(node) {\n return isAccessibilityModifier(node) || isReadonlyKeyword(node) || isStaticKeyword(node) || isAccessorKeyword(node);\n}\nfunction isDeclarationName(node) {\n return ts9.isIdentifier(node) || ts9.isPrivateIdentifier(node) || ts9.isStringLiteralLike(node) || ts9.isNumericLiteral(node) || ts9.isComputedPropertyName(node) || ts9.isElementAccessExpression(node) || isBindingPattern(node) || isEntityNameExpression(node);\n}\nfunction isDeclarationWithTypeParameterChildren(node) {\n return isSignatureDeclaration(node) || // eslint-disable-next-line deprecation/deprecation -- Keep compatibility with ts <5\n isClassLikeDeclaration(node) || ts9.isInterfaceDeclaration(node) || ts9.isTypeAliasDeclaration(node) || ts9.isJSDocTemplateTag(node);\n}\nfunction isDeclarationWithTypeParameters(node) {\n return isDeclarationWithTypeParameterChildren(node) || ts9.isJSDocTypedefTag(node) || ts9.isJSDocCallbackTag(node) || ts9.isJSDocSignature(node);\n}\nfunction isDestructuringPattern(node) {\n return isBindingPattern(node) || ts9.isObjectLiteralExpression(node) || ts9.isArrayLiteralExpression(node);\n}\nfunction isEntityNameExpression(node) {\n return ts9.isIdentifier(node) || isPropertyAccessEntityNameExpression(node);\n}\nfunction isEntityNameOrEntityNameExpression(node) {\n return ts9.isEntityName(node) || isEntityNameExpression(node);\n}\nfunction isForInOrOfStatement(node) {\n return ts9.isForInStatement(node) || ts9.isForOfStatement(node);\n}\nfunction isFunctionLikeDeclaration(node) {\n return ts9.isFunctionDeclaration(node) || ts9.isMethodDeclaration(node) || ts9.isGetAccessorDeclaration(node) || ts9.isSetAccessorDeclaration(node) || ts9.isConstructorDeclaration(node) || ts9.isFunctionExpression(node) || ts9.isArrowFunction(node);\n}\nfunction hasDecorators(node) {\n return ts9.isParameter(node) || ts9.isPropertyDeclaration(node) || ts9.isMethodDeclaration(node) || ts9.isGetAccessorDeclaration(node) || ts9.isSetAccessorDeclaration(node) || ts9.isClassExpression(node) || ts9.isClassDeclaration(node);\n}\nfunction hasExpressionInitializer(node) {\n return ts9.isVariableDeclaration(node) || ts9.isParameter(node) || ts9.isBindingElement(node) || ts9.isPropertyDeclaration(node) || ts9.isPropertyAssignment(node) || ts9.isEnumMember(node);\n}\nfunction hasInitializer(node) {\n return hasExpressionInitializer(node) || ts9.isForStatement(node) || ts9.isForInStatement(node) || ts9.isForOfStatement(node) || ts9.isJsxAttribute(node);\n}\nfunction hasJSDoc(node) {\n if (\n // eslint-disable-next-line deprecation/deprecation -- Keep compatibility with ts <5\n isAccessorDeclaration(node) || ts9.isArrowFunction(node) || ts9.isBlock(node) || ts9.isBreakStatement(node) || ts9.isCallSignatureDeclaration(node) || ts9.isCaseClause(node) || // eslint-disable-next-line deprecation/deprecation -- Keep compatibility with ts <5\n isClassLikeDeclaration(node) || ts9.isConstructorDeclaration(node) || ts9.isConstructorTypeNode(node) || ts9.isConstructSignatureDeclaration(node) || ts9.isContinueStatement(node) || ts9.isDebuggerStatement(node) || ts9.isDoStatement(node) || ts9.isEmptyStatement(node) || isEndOfFileToken(node) || ts9.isEnumDeclaration(node) || ts9.isEnumMember(node) || ts9.isExportAssignment(node) || ts9.isExportDeclaration(node) || ts9.isExportSpecifier(node) || ts9.isExpressionStatement(node) || ts9.isForInStatement(node) || ts9.isForOfStatement(node) || ts9.isForStatement(node) || ts9.isFunctionDeclaration(node) || ts9.isFunctionExpression(node) || ts9.isFunctionTypeNode(node) || ts9.isIfStatement(node) || ts9.isImportDeclaration(node) || ts9.isImportEqualsDeclaration(node) || ts9.isIndexSignatureDeclaration(node) || ts9.isInterfaceDeclaration(node) || ts9.isJSDocFunctionType(node) || ts9.isLabeledStatement(node) || ts9.isMethodDeclaration(node) || ts9.isMethodSignature(node) || ts9.isModuleDeclaration(node) || ts9.isNamedTupleMember(node) || ts9.isNamespaceExportDeclaration(node) || ts9.isParameter(node) || ts9.isParenthesizedExpression(node) || ts9.isPropertyAssignment(node) || ts9.isPropertyDeclaration(node) || ts9.isPropertySignature(node) || ts9.isReturnStatement(node) || ts9.isShorthandPropertyAssignment(node) || ts9.isSpreadAssignment(node) || ts9.isSwitchStatement(node) || ts9.isThrowStatement(node) || ts9.isTryStatement(node) || ts9.isTypeAliasDeclaration(node) || ts9.isVariableDeclaration(node) || ts9.isVariableStatement(node) || ts9.isWhileStatement(node) || ts9.isWithStatement(node)\n ) {\n return true;\n }\n if (isTsVersionAtLeast(4, 4) && ts9.isClassStaticBlockDeclaration(node)) {\n return true;\n }\n if (isTsVersionAtLeast(5, 0) && (ts9.isBinaryExpression(node) || ts9.isElementAccessExpression(node) || ts9.isIdentifier(node) || ts9.isJSDocSignature(node) || ts9.isObjectLiteralExpression(node) || ts9.isPropertyAccessExpression(node) || ts9.isTypeParameterDeclaration(node))) {\n return true;\n }\n return false;\n}\nfunction hasModifiers(node) {\n return ts9.isTypeParameterDeclaration(node) || ts9.isParameter(node) || ts9.isConstructorTypeNode(node) || ts9.isPropertySignature(node) || ts9.isPropertyDeclaration(node) || ts9.isMethodSignature(node) || ts9.isMethodDeclaration(node) || ts9.isConstructorDeclaration(node) || ts9.isGetAccessorDeclaration(node) || ts9.isSetAccessorDeclaration(node) || ts9.isIndexSignatureDeclaration(node) || ts9.isFunctionExpression(node) || ts9.isArrowFunction(node) || ts9.isClassExpression(node) || ts9.isVariableStatement(node) || ts9.isFunctionDeclaration(node) || ts9.isClassDeclaration(node) || ts9.isInterfaceDeclaration(node) || ts9.isTypeAliasDeclaration(node) || ts9.isEnumDeclaration(node) || ts9.isModuleDeclaration(node) || ts9.isImportEqualsDeclaration(node) || ts9.isImportDeclaration(node) || ts9.isExportAssignment(node) || ts9.isExportDeclaration(node);\n}\nfunction hasType(node) {\n return isSignatureDeclaration(node) || ts9.isVariableDeclaration(node) || ts9.isParameter(node) || ts9.isPropertySignature(node) || ts9.isPropertyDeclaration(node) || ts9.isTypePredicateNode(node) || ts9.isParenthesizedTypeNode(node) || ts9.isTypeOperatorNode(node) || ts9.isMappedTypeNode(node) || ts9.isAssertionExpression(node) || ts9.isTypeAliasDeclaration(node) || ts9.isJSDocTypeExpression(node) || ts9.isJSDocNonNullableType(node) || ts9.isJSDocNullableType(node) || ts9.isJSDocOptionalType(node) || ts9.isJSDocVariadicType(node);\n}\nfunction hasTypeArguments(node) {\n return ts9.isCallExpression(node) || ts9.isNewExpression(node) || ts9.isTaggedTemplateExpression(node) || ts9.isJsxOpeningElement(node) || ts9.isJsxSelfClosingElement(node);\n}\nfunction isJSDocComment(node) {\n if (isJSDocText(node)) {\n return true;\n }\n if (isTsVersionAtLeast(4, 4)) {\n return ts9.isJSDocLink(node) || ts9.isJSDocLinkCode(node) || ts9.isJSDocLinkPlain(node);\n }\n return false;\n}\nfunction isJSDocNamespaceBody(node) {\n return ts9.isIdentifier(node) || isJSDocNamespaceDeclaration(node);\n}\nfunction isJSDocTypeReferencingNode(node) {\n return ts9.isJSDocVariadicType(node) || ts9.isJSDocOptionalType(node) || ts9.isJSDocNullableType(node) || ts9.isJSDocNonNullableType(node);\n}\nfunction isJsonObjectExpression(node) {\n return ts9.isObjectLiteralExpression(node) || ts9.isArrayLiteralExpression(node) || isJsonMinusNumericLiteral(node) || ts9.isNumericLiteral(node) || ts9.isStringLiteral(node) || isBooleanLiteral(node) || isNullLiteral(node);\n}\nfunction isJsxAttributeLike(node) {\n return ts9.isJsxAttribute(node) || ts9.isJsxSpreadAttribute(node);\n}\nfunction isJsxAttributeValue(node) {\n return ts9.isStringLiteral(node) || ts9.isJsxExpression(node) || ts9.isJsxElement(node) || ts9.isJsxSelfClosingElement(node) || ts9.isJsxFragment(node);\n}\nfunction isJsxChild(node) {\n return ts9.isJsxText(node) || ts9.isJsxExpression(node) || ts9.isJsxElement(node) || ts9.isJsxSelfClosingElement(node) || ts9.isJsxFragment(node);\n}\nfunction isJsxTagNameExpression(node) {\n return ts9.isIdentifier(node) || isThisExpression(node) || isJsxTagNamePropertyAccess(node);\n}\nfunction isLiteralToken(node) {\n return ts9.isNumericLiteral(node) || ts9.isBigIntLiteral(node) || ts9.isStringLiteral(node) || ts9.isJsxText(node) || ts9.isRegularExpressionLiteral(node) || ts9.isNoSubstitutionTemplateLiteral(node);\n}\nfunction isModuleBody(node) {\n return isNamespaceBody(node) || isJSDocNamespaceBody(node);\n}\nfunction isModuleName(node) {\n return ts9.isIdentifier(node) || ts9.isStringLiteral(node);\n}\nfunction isModuleReference(node) {\n return ts9.isEntityName(node) || ts9.isExternalModuleReference(node);\n}\nfunction isNamedImportBindings(node) {\n return ts9.isNamespaceImport(node) || ts9.isNamedImports(node);\n}\nfunction isNamedImportsOrExports(node) {\n return ts9.isNamedImports(node) || ts9.isNamedExports(node);\n}\nfunction isNamespaceBody(node) {\n return ts9.isModuleBlock(node) || isNamespaceDeclaration(node);\n}\nfunction isObjectBindingOrAssignmentElement(node) {\n return ts9.isBindingElement(node) || ts9.isPropertyAssignment(node) || ts9.isShorthandPropertyAssignment(node) || ts9.isSpreadAssignment(node);\n}\nfunction isObjectBindingOrAssignmentPattern(node) {\n return ts9.isObjectBindingPattern(node) || ts9.isObjectLiteralExpression(node);\n}\nfunction isObjectTypeDeclaration(node) {\n return (\n // eslint-disable-next-line deprecation/deprecation -- Keep compatibility with ts <5\n isClassLikeDeclaration(node) || ts9.isInterfaceDeclaration(node) || ts9.isTypeLiteralNode(node)\n );\n}\nfunction isParameterPropertyModifier(node) {\n return isAccessibilityModifier(node) || isReadonlyKeyword(node);\n}\nfunction isPropertyNameLiteral(node) {\n return ts9.isIdentifier(node) || ts9.isStringLiteralLike(node) || ts9.isNumericLiteral(node);\n}\nfunction isPseudoLiteralToken(node) {\n return ts9.isTemplateHead(node) || ts9.isTemplateMiddle(node) || ts9.isTemplateTail(node);\n}\nfunction isSignatureDeclaration(node) {\n return ts9.isCallSignatureDeclaration(node) || ts9.isConstructSignatureDeclaration(node) || ts9.isMethodSignature(node) || ts9.isIndexSignatureDeclaration(node) || ts9.isFunctionTypeNode(node) || ts9.isConstructorTypeNode(node) || ts9.isJSDocFunctionType(node) || ts9.isFunctionDeclaration(node) || ts9.isMethodDeclaration(node) || ts9.isConstructorDeclaration(node) || // eslint-disable-next-line deprecation/deprecation -- Keep compatibility with ts <5\n isAccessorDeclaration(node) || ts9.isFunctionExpression(node) || ts9.isArrowFunction(node);\n}\nfunction isSuperProperty(node) {\n return isSuperPropertyAccessExpression(node) || isSuperElementAccessExpression(node);\n}\nfunction isTypeOnlyCompatibleAliasDeclaration(node) {\n if (ts9.isImportClause(node) || ts9.isImportEqualsDeclaration(node) || ts9.isNamespaceImport(node) || ts9.isImportOrExportSpecifier(node)) {\n return true;\n }\n if (isTsVersionAtLeast(5, 0) && (ts9.isExportDeclaration(node) || ts9.isNamespaceExport(node))) {\n return true;\n }\n return false;\n}\nfunction isTypeReferenceType(node) {\n return ts9.isTypeReferenceNode(node) || ts9.isExpressionWithTypeArguments(node);\n}\nfunction isUnionOrIntersectionTypeNode(node) {\n return ts9.isUnionTypeNode(node) || ts9.isIntersectionTypeNode(node);\n}\nfunction isUnparsedSourceText(node) {\n return ts9.isUnparsedPrepend(node) || ts9.isUnparsedTextLike(node);\n}\nfunction isVariableLikeDeclaration(node) {\n return ts9.isVariableDeclaration(node) || ts9.isParameter(node) || ts9.isBindingElement(node) || ts9.isPropertyDeclaration(node) || ts9.isPropertyAssignment(node) || ts9.isPropertySignature(node) || ts9.isJsxAttribute(node) || ts9.isShorthandPropertyAssignment(node) || ts9.isEnumMember(node) || ts9.isJSDocPropertyTag(node) || ts9.isJSDocParameterTag(node);\n}\n\n// src/nodes/typeGuards/compound.ts\nfunction isConstAssertionExpression(node) {\n return ts9.isTypeReferenceNode(node.type) && ts9.isIdentifier(node.type.typeName) && node.type.typeName.escapedText === \"const\";\n}\nfunction isIterationStatement(node) {\n switch (node.kind) {\n case ts9.SyntaxKind.DoStatement:\n case ts9.SyntaxKind.ForInStatement:\n case ts9.SyntaxKind.ForOfStatement:\n case ts9.SyntaxKind.ForStatement:\n case ts9.SyntaxKind.WhileStatement:\n return true;\n default:\n return false;\n }\n}\nfunction isJSDocNamespaceDeclaration(node) {\n return ts9.isModuleDeclaration(node) && ts9.isIdentifier(node.name) && (node.body === void 0 || isJSDocNamespaceBody(node.body));\n}\nfunction isJsxTagNamePropertyAccess(node) {\n return ts9.isPropertyAccessExpression(node) && // eslint-disable-next-line deprecation/deprecation -- Keep compatibility with ts < 5\n isJsxTagNameExpression(node.expression);\n}\nfunction isNamedDeclarationWithName(node) {\n return \"name\" in node && node.name !== void 0 && node.name !== null && isDeclarationName(node.name);\n}\nfunction isNamespaceDeclaration(node) {\n return ts9.isModuleDeclaration(node) && ts9.isIdentifier(node.name) && node.body !== void 0 && isNamespaceBody(node.body);\n}\nfunction isNumericOrStringLikeLiteral(node) {\n switch (node.kind) {\n case ts9.SyntaxKind.StringLiteral:\n case ts9.SyntaxKind.NumericLiteral:\n case ts9.SyntaxKind.NoSubstitutionTemplateLiteral:\n return true;\n default:\n return false;\n }\n}\nfunction isPropertyAccessEntityNameExpression(node) {\n return ts9.isPropertyAccessExpression(node) && ts9.isIdentifier(node.name) && isEntityNameExpression(node.expression);\n}\nfunction isSuperElementAccessExpression(node) {\n return ts9.isElementAccessExpression(node) && isSuperExpression(node.expression);\n}\nfunction isSuperPropertyAccessExpression(node) {\n return ts9.isPropertyAccessExpression(node) && isSuperExpression(node.expression);\n}\nfunction isFunctionScopeBoundary(node) {\n switch (node.kind) {\n case ts9.SyntaxKind.FunctionExpression:\n case ts9.SyntaxKind.ArrowFunction:\n case ts9.SyntaxKind.Constructor:\n case ts9.SyntaxKind.ModuleDeclaration:\n case ts9.SyntaxKind.ClassDeclaration:\n case ts9.SyntaxKind.ClassExpression:\n case ts9.SyntaxKind.EnumDeclaration:\n case ts9.SyntaxKind.MethodDeclaration:\n case ts9.SyntaxKind.FunctionDeclaration:\n case ts9.SyntaxKind.GetAccessor:\n case ts9.SyntaxKind.SetAccessor:\n case ts9.SyntaxKind.MethodSignature:\n case ts9.SyntaxKind.CallSignature:\n case ts9.SyntaxKind.ConstructSignature:\n case ts9.SyntaxKind.ConstructorType:\n case ts9.SyntaxKind.FunctionType:\n return true;\n case ts9.SyntaxKind.SourceFile:\n return ts9.isExternalModule(node);\n default:\n return false;\n }\n}\nfunction isIntrinsicAnyType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Any);\n}\nfunction isIntrinsicBooleanType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Boolean);\n}\nfunction isIntrinsicBigIntType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.BigInt);\n}\nfunction isIntrinsicErrorType(type) {\n return isIntrinsicType(type) && type.intrinsicName === \"error\";\n}\nfunction isIntrinsicESSymbolType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.ESSymbol);\n}\nvar IntrinsicTypeFlags = ts9.TypeFlags.Intrinsic ?? ts9.TypeFlags.Any | ts9.TypeFlags.Unknown | ts9.TypeFlags.String | ts9.TypeFlags.Number | ts9.TypeFlags.BigInt | ts9.TypeFlags.Boolean | ts9.TypeFlags.BooleanLiteral | ts9.TypeFlags.ESSymbol | ts9.TypeFlags.Void | ts9.TypeFlags.Undefined | ts9.TypeFlags.Null | ts9.TypeFlags.Never | ts9.TypeFlags.NonPrimitive;\nfunction isIntrinsicType(type) {\n return isTypeFlagSet(type, IntrinsicTypeFlags);\n}\nfunction isIntrinsicNeverType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Never);\n}\nfunction isIntrinsicNonPrimitiveType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.NonPrimitive);\n}\nfunction isIntrinsicNullType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Null);\n}\nfunction isIntrinsicNumberType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Number);\n}\nfunction isIntrinsicStringType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.String);\n}\nfunction isIntrinsicUndefinedType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Undefined);\n}\nfunction isIntrinsicUnknownType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Unknown);\n}\nfunction isIntrinsicVoidType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Void);\n}\nfunction isConditionalType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Conditional);\n}\nfunction isEnumType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Enum);\n}\nfunction isFreshableType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Freshable);\n}\nfunction isIndexType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Index);\n}\nfunction isIndexedAccessType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.IndexedAccess);\n}\nfunction isInstantiableType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Instantiable);\n}\nfunction isIntersectionType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Intersection);\n}\nfunction isObjectType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Object);\n}\nfunction isStringMappingType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.StringMapping);\n}\nfunction isSubstitutionType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Substitution);\n}\nfunction isTypeParameter(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.TypeParameter);\n}\nfunction isTypeVariable(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.TypeVariable);\n}\nfunction isUnionType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Union);\n}\nfunction isUnionOrIntersectionType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.UnionOrIntersection);\n}\nfunction isUniqueESSymbolType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.UniqueESSymbol);\n}\n\n// src/types/typeGuards/objects.ts\nfunction isEvolvingArrayType(type) {\n return isObjectType(type) && isObjectFlagSet(type, ts9.ObjectFlags.EvolvingArray);\n}\nfunction isTupleType(type) {\n return isObjectType(type) && isObjectFlagSet(type, ts9.ObjectFlags.Tuple);\n}\nfunction isTypeReference(type) {\n return isObjectType(type) && isObjectFlagSet(type, ts9.ObjectFlags.Reference);\n}\n\n// src/types/typeGuards/compound.ts\nfunction isFreshableIntrinsicType(type) {\n return isIntrinsicType(type) && isFreshableType(type);\n}\nfunction isTupleTypeReference(type) {\n return isTypeReference(type) && isTupleType(type.target);\n}\nfunction isBooleanLiteralType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.BooleanLiteral);\n}\nfunction isBigIntLiteralType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.BigIntLiteral);\n}\nfunction isFalseLiteralType(type) {\n return isBooleanLiteralType(type) && type.intrinsicName === \"false\";\n}\nfunction isLiteralType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Literal);\n}\nfunction isNumberLiteralType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.NumberLiteral);\n}\nfunction isStringLiteralType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.StringLiteral);\n}\nfunction isTemplateLiteralType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.TemplateLiteral);\n}\nfunction isTrueLiteralType(type) {\n return isBooleanLiteralType(type) && type.intrinsicName === \"true\";\n}\nfunction isUnknownLiteralType(type) {\n return isTypeFlagSet(type, ts9.TypeFlags.Literal);\n}\n\n// src/types/getters.ts\nfunction getCallSignaturesOfType(type) {\n if (isUnionType(type)) {\n const signatures = [];\n for (const subType of type.types) {\n signatures.push(...getCallSignaturesOfType(subType));\n }\n return signatures;\n }\n if (isIntersectionType(type)) {\n let signatures;\n for (const subType of type.types) {\n const sig = getCallSignaturesOfType(subType);\n if (sig.length !== 0) {\n if (signatures !== void 0) {\n return [];\n }\n signatures = sig;\n }\n }\n return signatures === void 0 ? [] : signatures;\n }\n return type.getCallSignatures();\n}\nfunction getPropertyOfType(type, name) {\n if (!name.startsWith(\"__\")) {\n return type.getProperty(name);\n }\n return type.getProperties().find((s) => s.escapedName === name);\n}\nfunction getWellKnownSymbolPropertyOfType(type, wellKnownSymbolName, typeChecker) {\n const prefix = \"__@\" + wellKnownSymbolName;\n for (const prop of type.getProperties()) {\n if (!prop.name.startsWith(prefix)) {\n continue;\n }\n const declaration = prop.valueDeclaration ?? prop.getDeclarations()[0];\n if (!isNamedDeclarationWithName(declaration) || declaration.name === void 0 || !ts9.isComputedPropertyName(declaration.name)) {\n continue;\n }\n const globalSymbol = typeChecker.getApparentType(\n typeChecker.getTypeAtLocation(declaration.name.expression)\n ).symbol;\n if (prop.escapedName === getPropertyNameOfWellKnownSymbol(\n typeChecker,\n globalSymbol,\n wellKnownSymbolName\n )) {\n return prop;\n }\n }\n return void 0;\n}\nfunction getPropertyNameOfWellKnownSymbol(typeChecker, symbolConstructor, symbolName) {\n const knownSymbol = symbolConstructor && typeChecker.getTypeOfSymbolAtLocation(\n symbolConstructor,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access\n symbolConstructor.valueDeclaration\n ).getProperty(symbolName);\n const knownSymbolType = knownSymbol && typeChecker.getTypeOfSymbolAtLocation(\n knownSymbol,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access\n knownSymbol.valueDeclaration\n );\n if (knownSymbolType && isUniqueESSymbolType(knownSymbolType)) {\n return knownSymbolType.escapedName;\n }\n return \"__@\" + symbolName;\n}\nfunction isBindableObjectDefinePropertyCall(node) {\n return node.arguments.length === 3 && isEntityNameExpression(node.arguments[0]) && isNumericOrStringLikeLiteral(node.arguments[1]) && ts9.isPropertyAccessExpression(node.expression) && node.expression.name.escapedText === \"defineProperty\" && ts9.isIdentifier(node.expression.expression) && node.expression.expression.escapedText === \"Object\";\n}\nfunction isInConstContext(node, typeChecker) {\n var _a, _b;\n let current = node;\n while (true) {\n const parent = current.parent;\n outer: switch (parent.kind) {\n case ts9.SyntaxKind.TypeAssertionExpression:\n case ts9.SyntaxKind.AsExpression:\n return isConstAssertionExpression(parent);\n case ts9.SyntaxKind.PrefixUnaryExpression:\n if (current.kind !== ts9.SyntaxKind.NumericLiteral) {\n return false;\n }\n switch (parent.operator) {\n case ts9.SyntaxKind.PlusToken:\n case ts9.SyntaxKind.MinusToken:\n current = parent;\n break outer;\n default:\n return false;\n }\n case ts9.SyntaxKind.PropertyAssignment:\n if (parent.initializer !== current) {\n return false;\n }\n current = parent.parent;\n break;\n case ts9.SyntaxKind.ShorthandPropertyAssignment:\n current = parent.parent;\n break;\n case ts9.SyntaxKind.ParenthesizedExpression:\n case ts9.SyntaxKind.ArrayLiteralExpression:\n case ts9.SyntaxKind.ObjectLiteralExpression:\n case ts9.SyntaxKind.TemplateExpression:\n current = parent;\n break;\n case ts9.SyntaxKind.CallExpression:\n if (!ts9.isExpression(current)) {\n return false;\n }\n const functionSignature = typeChecker.getResolvedSignature(\n parent\n );\n if (functionSignature === void 0) {\n return false;\n }\n const argumentIndex = parent.arguments.indexOf(\n current\n );\n if (argumentIndex < 0) {\n return false;\n }\n const parameterSymbol = functionSignature.getParameters()[argumentIndex];\n if (parameterSymbol === void 0 || !(\"links\" in parameterSymbol)) {\n return false;\n }\n const parameterSymbolLinks = parameterSymbol.links;\n const propertySymbol = (_b = (_a = parameterSymbolLinks.type) == null ? void 0 : _a.getProperties()) == null ? void 0 : _b[argumentIndex];\n if (propertySymbol === void 0 || !(\"links\" in propertySymbol)) {\n return false;\n }\n return isTransientSymbolLinksFlagSet(\n propertySymbol.links,\n ts9.CheckFlags.Readonly\n );\n default:\n return false;\n }\n }\n}\n\n// src/types/utilities.ts\nfunction isFalsyType(type) {\n if (isTypeFlagSet(\n type,\n ts9.TypeFlags.Undefined | ts9.TypeFlags.Null | ts9.TypeFlags.Void\n )) {\n return true;\n }\n if (typeIsLiteral(type)) {\n if (typeof type.value === \"object\") {\n return type.value.base10Value === \"0\";\n } else {\n return !type.value;\n }\n }\n return isFalseLiteralType(type);\n}\nfunction intersectionTypeParts(type) {\n return isIntersectionType(type) ? type.types : [type];\n}\nfunction typeParts(type) {\n return isIntersectionType(type) || isUnionType(type) ? type.types : [type];\n}\nfunction isReadonlyPropertyIntersection(type, name, typeChecker) {\n const typeParts2 = isIntersectionType(type) ? type.types : [type];\n return typeParts2.some((subType) => {\n const prop = getPropertyOfType(subType, name);\n if (prop === void 0) {\n return false;\n }\n if (prop.flags & ts9.SymbolFlags.Transient) {\n if (/^(?:[1-9]\\d*|0)$/.test(name) && isTupleTypeReference(subType)) {\n return subType.target.readonly;\n }\n switch (isReadonlyPropertyFromMappedType(subType, name, typeChecker)) {\n case true:\n return true;\n case false:\n return false;\n }\n }\n return !!// members of namespace import\n (isSymbolFlagSet(prop, ts9.SymbolFlags.ValueModule) || // we unwrapped every mapped type, now we can check the actual declarations\n symbolHasReadonlyDeclaration(prop, typeChecker));\n });\n}\nfunction isReadonlyPropertyFromMappedType(type, name, typeChecker) {\n if (!isObjectType(type) || !isObjectFlagSet(type, ts9.ObjectFlags.Mapped)) {\n return;\n }\n const declaration = type.symbol.declarations[0];\n if (declaration.readonlyToken !== void 0 && !/^__@[^@]+$/.test(name)) {\n return declaration.readonlyToken.kind !== ts9.SyntaxKind.MinusToken;\n }\n const { modifiersType } = type;\n return modifiersType && isPropertyReadonlyInType(modifiersType, name, typeChecker);\n}\nfunction isCallback(typeChecker, param, node) {\n let type = typeChecker.getApparentType(\n typeChecker.getTypeOfSymbolAtLocation(param, node)\n );\n if (param.valueDeclaration.dotDotDotToken) {\n type = type.getNumberIndexType();\n if (type === void 0) {\n return false;\n }\n }\n for (const subType of unionTypeParts(type)) {\n if (subType.getCallSignatures().length !== 0) {\n return true;\n }\n }\n return false;\n}\nfunction isPropertyReadonlyInType(type, name, typeChecker) {\n let seenProperty = false;\n let seenReadonlySignature = false;\n for (const subType of unionTypeParts(type)) {\n if (getPropertyOfType(subType, name) === void 0) {\n const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.Number) : void 0) ?? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.String);\n if (index == null ? void 0 : index.isReadonly) {\n if (seenProperty) {\n return true;\n }\n seenReadonlySignature = true;\n }\n } else if (seenReadonlySignature || isReadonlyPropertyIntersection(subType, name, typeChecker)) {\n return true;\n } else {\n seenProperty = true;\n }\n }\n return false;\n}\nfunction isReadonlyAssignmentDeclaration(node, typeChecker) {\n if (!isBindableObjectDefinePropertyCall(node)) {\n return false;\n }\n const descriptorType = typeChecker.getTypeAtLocation(node.arguments[2]);\n if (descriptorType.getProperty(\"value\") === void 0) {\n return descriptorType.getProperty(\"set\") === void 0;\n }\n const writableProp = descriptorType.getProperty(\"writable\");\n if (writableProp === void 0) {\n return false;\n }\n const writableType = writableProp.valueDeclaration !== void 0 && ts9.isPropertyAssignment(writableProp.valueDeclaration) ? typeChecker.getTypeAtLocation(writableProp.valueDeclaration.initializer) : typeChecker.getTypeOfSymbolAtLocation(writableProp, node.arguments[2]);\n return isFalseLiteralType(writableType);\n}\nfunction isThenableType(typeChecker, node, type = typeChecker.getTypeAtLocation(node)) {\n for (const typePart of unionTypeParts(typeChecker.getApparentType(type))) {\n const then = typePart.getProperty(\"then\");\n if (then === void 0) {\n continue;\n }\n const thenType = typeChecker.getTypeOfSymbolAtLocation(then, node);\n for (const subTypePart of unionTypeParts(thenType)) {\n for (const signature of subTypePart.getCallSignatures()) {\n if (signature.parameters.length !== 0 && isCallback(typeChecker, signature.parameters[0], node)) {\n return true;\n }\n }\n }\n }\n return false;\n}\nfunction symbolHasReadonlyDeclaration(symbol, typeChecker) {\n var _a;\n return !!((symbol.flags & ts9.SymbolFlags.Accessor) === ts9.SymbolFlags.GetAccessor || ((_a = symbol.declarations) == null ? void 0 : _a.some(\n (node) => isModifierFlagSet(node, ts9.ModifierFlags.Readonly) || ts9.isVariableDeclaration(node) && isNodeFlagSet(node.parent, ts9.NodeFlags.Const) || ts9.isCallExpression(node) && isReadonlyAssignmentDeclaration(node, typeChecker) || ts9.isEnumMember(node) || (ts9.isPropertyAssignment(node) || ts9.isShorthandPropertyAssignment(node)) && isInConstContext(node, typeChecker)\n )));\n}\nfunction unionTypeParts(type) {\n return isUnionType(type) ? type.types : [type];\n}\nfunction typeIsLiteral(type) {\n if (isTsVersionAtLeast(5, 0)) {\n return type.isLiteral();\n } else {\n return isTypeFlagSet(\n type,\n ts9.TypeFlags.StringLiteral | ts9.TypeFlags.NumberLiteral | ts9.TypeFlags.BigIntLiteral\n );\n }\n}\nfunction isBlockScopeBoundary(node) {\n switch (node.kind) {\n case ts9.SyntaxKind.Block: {\n const parent = node.parent;\n return parent.kind !== ts9.SyntaxKind.CatchClause && // blocks inside SourceFile are block scope boundaries\n (parent.kind === ts9.SyntaxKind.SourceFile || // blocks that are direct children of a function scope boundary are no scope boundary\n // for example the FunctionBlock is part of the function scope of the containing function\n !isFunctionScopeBoundary(parent)) ? 2 /* Block */ : 0 /* None */;\n }\n case ts9.SyntaxKind.ForStatement:\n case ts9.SyntaxKind.ForInStatement:\n case ts9.SyntaxKind.ForOfStatement:\n case ts9.SyntaxKind.CaseBlock:\n case ts9.SyntaxKind.CatchClause:\n case ts9.SyntaxKind.WithStatement:\n return 2 /* Block */;\n default:\n return 0 /* None */;\n }\n}\nfunction identifierToKeywordKind(node) {\n return \"identifierToKeywordKind\" in ts9 ? ts9.identifierToKeywordKind(node) : (\n // eslint-disable-next-line deprecation/deprecation\n node.originalKeywordKind\n );\n}\nfunction canHaveDecorators(node) {\n return \"canHaveDecorators\" in ts9 ? ts9.canHaveDecorators(node) : \"decorators\" in node;\n}\nfunction getDecorators(node) {\n return \"getDecorators\" in ts9 ? ts9.getDecorators(node) : node.decorators;\n}\n\n// src/usage/declarations.ts\nvar DeclarationDomain = /* @__PURE__ */ ((DeclarationDomain2) => {\n DeclarationDomain2[DeclarationDomain2[\"Import\"] = 8] = \"Import\";\n DeclarationDomain2[DeclarationDomain2[\"Namespace\"] = 1] = \"Namespace\";\n DeclarationDomain2[DeclarationDomain2[\"Type\"] = 2] = \"Type\";\n DeclarationDomain2[DeclarationDomain2[\"Value\"] = 4] = \"Value\";\n DeclarationDomain2[DeclarationDomain2[\"Any\"] = 7] = \"Any\";\n return DeclarationDomain2;\n})(DeclarationDomain || {});\nfunction getDeclarationDomain(node) {\n switch (node.parent.kind) {\n case ts9.SyntaxKind.TypeParameter:\n case ts9.SyntaxKind.InterfaceDeclaration:\n case ts9.SyntaxKind.TypeAliasDeclaration:\n return 2 /* Type */;\n case ts9.SyntaxKind.ClassDeclaration:\n case ts9.SyntaxKind.ClassExpression:\n return 2 /* Type */ | 4 /* Value */;\n case ts9.SyntaxKind.EnumDeclaration:\n return 7 /* Any */;\n case ts9.SyntaxKind.NamespaceImport:\n case ts9.SyntaxKind.ImportClause:\n return 7 /* Any */ | 8 /* Import */;\n // TODO handle type-only imports\n case ts9.SyntaxKind.ImportEqualsDeclaration:\n case ts9.SyntaxKind.ImportSpecifier:\n return node.parent.name === node ? 7 /* Any */ | 8 /* Import */ : void 0;\n case ts9.SyntaxKind.ModuleDeclaration:\n return 1 /* Namespace */;\n case ts9.SyntaxKind.Parameter:\n if (node.parent.parent.kind === ts9.SyntaxKind.IndexSignature || identifierToKeywordKind(node) === ts9.SyntaxKind.ThisKeyword) {\n return;\n }\n // falls through\n case ts9.SyntaxKind.BindingElement:\n case ts9.SyntaxKind.VariableDeclaration:\n return node.parent.name === node ? 4 /* Value */ : void 0;\n case ts9.SyntaxKind.FunctionDeclaration:\n case ts9.SyntaxKind.FunctionExpression:\n return 4 /* Value */;\n }\n}\nfunction unwrapParentheses(node) {\n while (node.kind === ts9.SyntaxKind.ParenthesizedExpression) {\n node = node.expression;\n }\n return node;\n}\nfunction getPropertyName(propertyName) {\n if (propertyName.kind === ts9.SyntaxKind.ComputedPropertyName) {\n const expression = unwrapParentheses(propertyName.expression);\n if (ts9.isPrefixUnaryExpression(expression)) {\n let negate = false;\n switch (expression.operator) {\n case ts9.SyntaxKind.MinusToken:\n negate = true;\n // falls through\n case ts9.SyntaxKind.PlusToken:\n return ts9.isNumericLiteral(expression.operand) ? `${negate ? \"-\" : \"\"}${expression.operand.text}` : ts9.isBigIntLiteral(expression.operand) ? `${negate ? \"-\" : \"\"}${expression.operand.text.slice(0, -1)}` : void 0;\n default:\n return;\n }\n }\n if (ts9.isBigIntLiteral(expression)) {\n return expression.text.slice(0, -1);\n }\n if (isNumericOrStringLikeLiteral(expression)) {\n return expression.text;\n }\n return;\n }\n return propertyName.kind === ts9.SyntaxKind.PrivateIdentifier ? void 0 : propertyName.text;\n}\nvar UsageDomain = /* @__PURE__ */ ((UsageDomain2) => {\n UsageDomain2[UsageDomain2[\"Namespace\"] = 1] = \"Namespace\";\n UsageDomain2[UsageDomain2[\"Type\"] = 2] = \"Type\";\n UsageDomain2[UsageDomain2[\"TypeQuery\"] = 8] = \"TypeQuery\";\n UsageDomain2[UsageDomain2[\"Value\"] = 4] = \"Value\";\n UsageDomain2[UsageDomain2[\"ValueOrNamespace\"] = 5] = \"ValueOrNamespace\";\n UsageDomain2[UsageDomain2[\"Any\"] = 7] = \"Any\";\n return UsageDomain2;\n})(UsageDomain || {});\nfunction getUsageDomain(node) {\n const parent = node.parent;\n switch (parent.kind) {\n case ts9.SyntaxKind.TypeReference:\n return identifierToKeywordKind(node) !== ts9.SyntaxKind.ConstKeyword ? 2 /* Type */ : void 0;\n case ts9.SyntaxKind.ExpressionWithTypeArguments:\n return parent.parent.token === ts9.SyntaxKind.ImplementsKeyword || parent.parent.parent.kind === ts9.SyntaxKind.InterfaceDeclaration ? 2 /* Type */ : 4 /* Value */;\n case ts9.SyntaxKind.TypeQuery:\n return 5 /* ValueOrNamespace */ | 8 /* TypeQuery */;\n case ts9.SyntaxKind.QualifiedName:\n if (parent.left === node) {\n if (getEntityNameParent(parent).kind === ts9.SyntaxKind.TypeQuery) {\n return 1 /* Namespace */ | 8 /* TypeQuery */;\n }\n return 1 /* Namespace */;\n }\n break;\n case ts9.SyntaxKind.ExportSpecifier:\n if (parent.propertyName === void 0 || parent.propertyName === node) {\n return 7 /* Any */;\n }\n break;\n case ts9.SyntaxKind.ExportAssignment:\n return 7 /* Any */;\n // Value\n case ts9.SyntaxKind.BindingElement:\n if (parent.initializer === node) {\n return 5 /* ValueOrNamespace */;\n }\n break;\n case ts9.SyntaxKind.Parameter:\n case ts9.SyntaxKind.EnumMember:\n case ts9.SyntaxKind.PropertyDeclaration:\n case ts9.SyntaxKind.VariableDeclaration:\n case ts9.SyntaxKind.PropertyAssignment:\n case ts9.SyntaxKind.PropertyAccessExpression:\n case ts9.SyntaxKind.ImportEqualsDeclaration:\n if (parent.name !== node) {\n return 5 /* ValueOrNamespace */;\n }\n break;\n case ts9.SyntaxKind.JsxAttribute:\n case ts9.SyntaxKind.FunctionDeclaration:\n case ts9.SyntaxKind.FunctionExpression:\n case ts9.SyntaxKind.NamespaceImport:\n case ts9.SyntaxKind.ClassDeclaration:\n case ts9.SyntaxKind.ClassExpression:\n case ts9.SyntaxKind.ModuleDeclaration:\n case ts9.SyntaxKind.MethodDeclaration:\n case ts9.SyntaxKind.EnumDeclaration:\n case ts9.SyntaxKind.GetAccessor:\n case ts9.SyntaxKind.SetAccessor:\n case ts9.SyntaxKind.LabeledStatement:\n case ts9.SyntaxKind.BreakStatement:\n case ts9.SyntaxKind.ContinueStatement:\n case ts9.SyntaxKind.ImportClause:\n case ts9.SyntaxKind.ImportSpecifier:\n case ts9.SyntaxKind.TypePredicate:\n // TODO this actually references a parameter\n case ts9.SyntaxKind.MethodSignature:\n case ts9.SyntaxKind.PropertySignature:\n case ts9.SyntaxKind.NamespaceExportDeclaration:\n case ts9.SyntaxKind.NamespaceExport:\n case ts9.SyntaxKind.InterfaceDeclaration:\n case ts9.SyntaxKind.TypeAliasDeclaration:\n case ts9.SyntaxKind.TypeParameter:\n case ts9.SyntaxKind.NamedTupleMember:\n break;\n default:\n return 5 /* ValueOrNamespace */;\n }\n}\nfunction getEntityNameParent(name) {\n let parent = name.parent;\n while (parent.kind === ts9.SyntaxKind.QualifiedName) {\n parent = parent.parent;\n }\n return parent;\n}\n\n// src/usage/scopes.ts\nvar AbstractScope = class {\n constructor(global) {\n this.global = global;\n this.#enumScopes = void 0;\n this.namespaceScopes = void 0;\n this.uses = [];\n this.variables = /* @__PURE__ */ new Map();\n }\n #enumScopes;\n addUse(use) {\n this.uses.push(use);\n }\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n addUseToParent(_use) {\n }\n addVariable(identifier, name, selector, exported, domain) {\n const variables = this.getDestinationScope(selector).getVariables();\n const declaration = {\n declaration: name,\n domain,\n exported\n };\n const variable = variables.get(identifier);\n if (variable === void 0) {\n variables.set(identifier, {\n declarations: [declaration],\n domain,\n uses: []\n });\n } else {\n variable.domain |= domain;\n variable.declarations.push(declaration);\n }\n }\n applyUse(use, variables = this.variables) {\n const variable = variables.get(use.location.text);\n if (variable === void 0 || (variable.domain & use.domain) === 0) {\n return false;\n }\n variable.uses.push(use);\n return true;\n }\n applyUses() {\n for (const use of this.uses) {\n if (!this.applyUse(use)) {\n this.addUseToParent(use);\n }\n }\n this.uses = [];\n }\n createOrReuseEnumScope(name, _exported) {\n let scope;\n if (this.#enumScopes === void 0) {\n this.#enumScopes = /* @__PURE__ */ new Map();\n } else {\n scope = this.#enumScopes.get(name);\n }\n if (scope === void 0) {\n scope = new EnumScope(this);\n this.#enumScopes.set(name, scope);\n }\n return scope;\n }\n // only relevant for the root scope\n createOrReuseNamespaceScope(name, _exported, ambient, hasExportStatement) {\n let scope;\n if (this.namespaceScopes === void 0) {\n this.namespaceScopes = /* @__PURE__ */ new Map();\n } else {\n scope = this.namespaceScopes.get(name);\n }\n if (scope === void 0) {\n scope = new NamespaceScope(ambient, hasExportStatement, this);\n this.namespaceScopes.set(name, scope);\n } else {\n scope.refresh(ambient, hasExportStatement);\n }\n return scope;\n }\n end(cb) {\n if (this.namespaceScopes !== void 0) {\n this.namespaceScopes.forEach((value) => value.finish(cb));\n }\n this.namespaceScopes = this.#enumScopes = void 0;\n this.applyUses();\n this.variables.forEach((variable) => {\n for (const declaration of variable.declarations) {\n const result = {\n declarations: [],\n domain: declaration.domain,\n exported: declaration.exported,\n inGlobalScope: this.global,\n uses: []\n };\n for (const other of variable.declarations) {\n if (other.domain & declaration.domain) {\n result.declarations.push(other.declaration);\n }\n }\n for (const use of variable.uses) {\n if (use.domain & declaration.domain) {\n result.uses.push(use);\n }\n }\n cb(result, declaration.declaration, this);\n }\n });\n }\n getFunctionScope() {\n return this;\n }\n getVariables() {\n return this.variables;\n }\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n markExported(_name) {\n }\n};\nvar NonRootScope = class extends AbstractScope {\n constructor(parent, boundary) {\n super(false);\n this.parent = parent;\n this.boundary = boundary;\n }\n addUseToParent(use) {\n return this.parent.addUse(use, this);\n }\n getDestinationScope(selector) {\n return this.boundary & selector ? this : this.parent.getDestinationScope(selector);\n }\n};\nvar EnumScope = class extends NonRootScope {\n constructor(parent) {\n super(parent, 1 /* Function */);\n }\n end() {\n this.applyUses();\n }\n};\nvar RootScope = class extends AbstractScope {\n #exportAll;\n #exports = void 0;\n #innerScope = new NonRootScope(this, 1 /* Function */);\n constructor(exportAll, global) {\n super(global);\n this.#exportAll = exportAll;\n }\n addUse(use, origin) {\n if (origin === this.#innerScope) {\n return super.addUse(use);\n }\n return this.#innerScope.addUse(use);\n }\n addVariable(identifier, name, selector, exported, domain) {\n if (domain & 8 /* Import */) {\n return super.addVariable(identifier, name, selector, exported, domain);\n }\n return this.#innerScope.addVariable(\n identifier,\n name,\n selector,\n exported,\n domain\n );\n }\n end(cb) {\n this.#innerScope.end((value, key) => {\n value.exported ||= this.#exportAll || this.#exports !== void 0 && this.#exports.includes(key.text);\n value.inGlobalScope = this.global;\n return cb(value, key, this);\n });\n return super.end((value, key, scope) => {\n value.exported ||= scope === this && this.#exports !== void 0 && this.#exports.includes(key.text);\n return cb(value, key, scope);\n });\n }\n getDestinationScope() {\n return this;\n }\n markExported(id) {\n if (this.#exports === void 0) {\n this.#exports = [id.text];\n } else {\n this.#exports.push(id.text);\n }\n }\n};\nvar NamespaceScope = class extends NonRootScope {\n #ambient;\n #exports = void 0;\n #hasExport;\n #innerScope = new NonRootScope(this, 1 /* Function */);\n constructor(ambient, hasExport, parent) {\n super(parent, 1 /* Function */);\n this.#ambient = ambient;\n this.#hasExport = hasExport;\n }\n addUse(use, source) {\n if (source !== this.#innerScope) {\n return this.#innerScope.addUse(use);\n }\n this.uses.push(use);\n }\n createOrReuseEnumScope(name, exported) {\n if (!exported && (!this.#ambient || this.#hasExport)) {\n return this.#innerScope.createOrReuseEnumScope(name, exported);\n }\n return super.createOrReuseEnumScope(name, exported);\n }\n createOrReuseNamespaceScope(name, exported, ambient, hasExportStatement) {\n if (!exported && (!this.#ambient || this.#hasExport)) {\n return this.#innerScope.createOrReuseNamespaceScope(\n name,\n exported,\n ambient || this.#ambient,\n hasExportStatement\n );\n }\n return super.createOrReuseNamespaceScope(\n name,\n exported,\n ambient || this.#ambient,\n hasExportStatement\n );\n }\n end(cb) {\n this.#innerScope.end((variable, key, scope) => {\n if (scope !== this.#innerScope || !variable.exported && (!this.#ambient || this.#exports !== void 0 && !this.#exports.has(key.text))) {\n return cb(variable, key, scope);\n }\n const namespaceVar = this.variables.get(key.text);\n if (namespaceVar === void 0) {\n this.variables.set(key.text, {\n declarations: variable.declarations.map(mapDeclaration),\n domain: variable.domain,\n uses: [...variable.uses]\n });\n } else {\n outer: for (const declaration of variable.declarations) {\n for (const existing of namespaceVar.declarations) {\n if (existing.declaration === declaration) {\n continue outer;\n }\n namespaceVar.declarations.push(mapDeclaration(declaration));\n }\n }\n namespaceVar.domain |= variable.domain;\n for (const use of variable.uses) {\n if (namespaceVar.uses.includes(use)) {\n continue;\n }\n namespaceVar.uses.push(use);\n }\n }\n });\n this.applyUses();\n this.#innerScope = new NonRootScope(this, 1 /* Function */);\n }\n finish(cb) {\n return super.end(cb);\n }\n getDestinationScope() {\n return this.#innerScope;\n }\n markExported(name) {\n if (this.#exports === void 0) {\n this.#exports = /* @__PURE__ */ new Set();\n }\n this.#exports.add(name.text);\n }\n refresh(ambient, hasExport) {\n this.#ambient = ambient;\n this.#hasExport = hasExport;\n }\n};\nfunction mapDeclaration(declaration) {\n return {\n declaration,\n domain: getDeclarationDomain(declaration),\n exported: true\n };\n}\nvar FunctionScope = class extends NonRootScope {\n constructor(parent) {\n super(parent, 1 /* Function */);\n }\n beginBody() {\n this.applyUses();\n }\n};\nvar AbstractNamedExpressionScope = class extends NonRootScope {\n #domain;\n #name;\n constructor(name, domain, parent) {\n super(parent, 1 /* Function */);\n this.#name = name;\n this.#domain = domain;\n }\n addUse(use, source) {\n if (source !== this.innerScope) {\n return this.innerScope.addUse(use);\n }\n if (use.domain & this.#domain && use.location.text === this.#name.text) {\n this.uses.push(use);\n } else {\n return this.parent.addUse(use, this);\n }\n }\n end(cb) {\n this.innerScope.end(cb);\n return cb(\n {\n declarations: [this.#name],\n domain: this.#domain,\n exported: false,\n inGlobalScope: false,\n uses: this.uses\n },\n this.#name,\n this\n );\n }\n getDestinationScope() {\n return this.innerScope;\n }\n getFunctionScope() {\n return this.innerScope;\n }\n};\nvar FunctionExpressionScope = class extends AbstractNamedExpressionScope {\n constructor(name, parent) {\n super(name, 4 /* Value */, parent);\n this.innerScope = new FunctionScope(this);\n }\n beginBody() {\n return this.innerScope.beginBody();\n }\n};\nvar BlockScope = class extends NonRootScope {\n #functionScope;\n constructor(functionScope, parent) {\n super(parent, 2 /* Block */);\n this.#functionScope = functionScope;\n }\n getFunctionScope() {\n return this.#functionScope;\n }\n};\nvar ClassExpressionScope = class extends AbstractNamedExpressionScope {\n constructor(name, parent) {\n super(name, 4 /* Value */ | 2 /* Type */, parent);\n this.innerScope = new NonRootScope(this, 1 /* Function */);\n }\n};\nvar ConditionalTypeScope = class extends NonRootScope {\n #state = 0 /* Initial */;\n constructor(parent) {\n super(parent, 8 /* ConditionalType */);\n }\n addUse(use) {\n if (this.#state === 2 /* TrueType */) {\n return void this.uses.push(use);\n }\n return this.parent.addUse(use, this);\n }\n updateState(newState) {\n this.#state = newState;\n }\n};\n\n// src/usage/UsageWalker.ts\nvar UsageWalker = class {\n #result = /* @__PURE__ */ new Map();\n #scope;\n #handleBindingName(name, blockScoped, exported) {\n if (name.kind === ts9.SyntaxKind.Identifier) {\n return this.#scope.addVariable(\n name.text,\n name,\n blockScoped ? 3 /* Block */ : 1 /* Function */,\n exported,\n 4 /* Value */\n );\n }\n forEachDestructuringIdentifier(name, (declaration) => {\n this.#scope.addVariable(\n declaration.name.text,\n declaration.name,\n blockScoped ? 3 /* Block */ : 1 /* Function */,\n exported,\n 4 /* Value */\n );\n });\n }\n #handleConditionalType(node, cb, varCb) {\n const savedScope = this.#scope;\n const scope = this.#scope = new ConditionalTypeScope(savedScope);\n cb(node.checkType);\n scope.updateState(1 /* Extends */);\n cb(node.extendsType);\n scope.updateState(2 /* TrueType */);\n cb(node.trueType);\n scope.updateState(3 /* FalseType */);\n cb(node.falseType);\n scope.end(varCb);\n this.#scope = savedScope;\n }\n #handleDeclaration(node, blockScoped, domain) {\n if (node.name !== void 0) {\n this.#scope.addVariable(\n node.name.text,\n node.name,\n blockScoped ? 3 /* Block */ : 1 /* Function */,\n includesModifier(\n node.modifiers,\n ts9.SyntaxKind.ExportKeyword\n ),\n domain\n );\n }\n }\n #handleFunctionLikeDeclaration(node, cb, varCb) {\n var _a;\n if (canHaveDecorators(node)) {\n (_a = getDecorators(node)) == null ? void 0 : _a.forEach(cb);\n }\n const savedScope = this.#scope;\n if (node.kind === ts9.SyntaxKind.FunctionDeclaration) {\n this.#handleDeclaration(node, false, 4 /* Value */);\n }\n const scope = this.#scope = node.kind === ts9.SyntaxKind.FunctionExpression && node.name !== void 0 ? new FunctionExpressionScope(node.name, savedScope) : new FunctionScope(savedScope);\n if (node.name !== void 0) {\n cb(node.name);\n }\n if (node.typeParameters !== void 0) {\n node.typeParameters.forEach(cb);\n }\n node.parameters.forEach(cb);\n if (node.type !== void 0) {\n cb(node.type);\n }\n if (node.body !== void 0) {\n scope.beginBody();\n cb(node.body);\n }\n scope.end(varCb);\n this.#scope = savedScope;\n }\n #handleModule(node, next) {\n if (node.flags & ts9.NodeFlags.GlobalAugmentation) {\n return next(\n node,\n this.#scope.createOrReuseNamespaceScope(\"-global\", false, true, false)\n );\n }\n if (node.name.kind === ts9.SyntaxKind.Identifier) {\n const exported = isNamespaceExported(node);\n this.#scope.addVariable(\n node.name.text,\n node.name,\n 1 /* Function */,\n exported,\n 1 /* Namespace */ | 4 /* Value */\n );\n const ambient = includesModifier(\n node.modifiers,\n ts9.SyntaxKind.DeclareKeyword\n );\n return next(\n node,\n this.#scope.createOrReuseNamespaceScope(\n node.name.text,\n exported,\n ambient,\n ambient && namespaceHasExportStatement(node)\n )\n );\n }\n return next(\n node,\n this.#scope.createOrReuseNamespaceScope(\n `\"${node.name.text}\"`,\n false,\n true,\n namespaceHasExportStatement(node)\n )\n );\n }\n #handleVariableDeclaration(declarationList) {\n const blockScoped = isBlockScopedVariableDeclarationList(declarationList);\n const exported = declarationList.parent.kind === ts9.SyntaxKind.VariableStatement && includesModifier(\n declarationList.parent.modifiers,\n ts9.SyntaxKind.ExportKeyword\n );\n for (const declaration of declarationList.declarations) {\n this.#handleBindingName(declaration.name, blockScoped, exported);\n }\n }\n getUsage(sourceFile) {\n const variableCallback = (variable, key) => {\n this.#result.set(key, variable);\n };\n const isModule = ts9.isExternalModule(sourceFile);\n this.#scope = new RootScope(\n sourceFile.isDeclarationFile && isModule && !containsExportStatement(sourceFile),\n !isModule\n );\n const cb = (node) => {\n if (isBlockScopeBoundary(node)) {\n return continueWithScope(\n node,\n new BlockScope(this.#scope.getFunctionScope(), this.#scope),\n handleBlockScope\n );\n }\n switch (node.kind) {\n case ts9.SyntaxKind.ClassExpression:\n return continueWithScope(\n node,\n node.name !== void 0 ? new ClassExpressionScope(\n node.name,\n this.#scope\n ) : new NonRootScope(this.#scope, 1 /* Function */)\n );\n case ts9.SyntaxKind.ClassDeclaration:\n this.#handleDeclaration(\n node,\n true,\n 4 /* Value */ | 2 /* Type */\n );\n return continueWithScope(\n node,\n new NonRootScope(this.#scope, 1 /* Function */)\n );\n case ts9.SyntaxKind.InterfaceDeclaration:\n case ts9.SyntaxKind.TypeAliasDeclaration:\n this.#handleDeclaration(\n node,\n true,\n 2 /* Type */\n );\n return continueWithScope(\n node,\n new NonRootScope(this.#scope, 4 /* Type */)\n );\n case ts9.SyntaxKind.EnumDeclaration:\n this.#handleDeclaration(\n node,\n true,\n 7 /* Any */\n );\n return continueWithScope(\n node,\n this.#scope.createOrReuseEnumScope(\n node.name.text,\n includesModifier(\n node.modifiers,\n ts9.SyntaxKind.ExportKeyword\n )\n )\n );\n case ts9.SyntaxKind.ModuleDeclaration:\n return this.#handleModule(\n node,\n continueWithScope\n );\n case ts9.SyntaxKind.MappedType:\n return continueWithScope(\n node,\n new NonRootScope(this.#scope, 4 /* Type */)\n );\n case ts9.SyntaxKind.FunctionExpression:\n case ts9.SyntaxKind.ArrowFunction:\n case ts9.SyntaxKind.Constructor:\n case ts9.SyntaxKind.MethodDeclaration:\n case ts9.SyntaxKind.FunctionDeclaration:\n case ts9.SyntaxKind.GetAccessor:\n case ts9.SyntaxKind.SetAccessor:\n case ts9.SyntaxKind.MethodSignature:\n case ts9.SyntaxKind.CallSignature:\n case ts9.SyntaxKind.ConstructSignature:\n case ts9.SyntaxKind.ConstructorType:\n case ts9.SyntaxKind.FunctionType:\n return this.#handleFunctionLikeDeclaration(\n node,\n cb,\n variableCallback\n );\n case ts9.SyntaxKind.ConditionalType:\n return this.#handleConditionalType(\n node,\n cb,\n variableCallback\n );\n // End of Scope specific handling\n case ts9.SyntaxKind.VariableDeclarationList:\n this.#handleVariableDeclaration(node);\n break;\n case ts9.SyntaxKind.Parameter:\n if (node.parent.kind !== ts9.SyntaxKind.IndexSignature && (node.name.kind !== ts9.SyntaxKind.Identifier || identifierToKeywordKind(\n node.name\n ) !== ts9.SyntaxKind.ThisKeyword)) {\n this.#handleBindingName(\n node.name,\n false,\n false\n );\n }\n break;\n case ts9.SyntaxKind.EnumMember:\n this.#scope.addVariable(\n getPropertyName(node.name),\n node.name,\n 1 /* Function */,\n true,\n 4 /* Value */\n );\n break;\n case ts9.SyntaxKind.ImportClause:\n case ts9.SyntaxKind.ImportSpecifier:\n case ts9.SyntaxKind.NamespaceImport:\n case ts9.SyntaxKind.ImportEqualsDeclaration:\n this.#handleDeclaration(\n node,\n false,\n 7 /* Any */ | 8 /* Import */\n );\n break;\n case ts9.SyntaxKind.TypeParameter:\n this.#scope.addVariable(\n node.name.text,\n node.name,\n node.parent.kind === ts9.SyntaxKind.InferType ? 8 /* InferType */ : 7 /* Type */,\n false,\n 2 /* Type */\n );\n break;\n case ts9.SyntaxKind.ExportSpecifier:\n if (node.propertyName !== void 0) {\n return this.#scope.markExported(\n node.propertyName,\n node.name\n );\n }\n return this.#scope.markExported(node.name);\n case ts9.SyntaxKind.ExportAssignment:\n if (node.expression.kind === ts9.SyntaxKind.Identifier) {\n return this.#scope.markExported(\n node.expression\n );\n }\n break;\n case ts9.SyntaxKind.Identifier: {\n const domain = getUsageDomain(node);\n if (domain !== void 0) {\n this.#scope.addUse({ domain, location: node });\n }\n return;\n }\n }\n return ts9.forEachChild(node, cb);\n };\n const continueWithScope = (node, scope, next = forEachChild) => {\n const savedScope = this.#scope;\n this.#scope = scope;\n next(node);\n this.#scope.end(variableCallback);\n this.#scope = savedScope;\n };\n const handleBlockScope = (node) => {\n if (node.kind === ts9.SyntaxKind.CatchClause && node.variableDeclaration !== void 0) {\n this.#handleBindingName(\n node.variableDeclaration.name,\n true,\n false\n );\n }\n return ts9.forEachChild(node, cb);\n };\n ts9.forEachChild(sourceFile, cb);\n this.#scope.end(variableCallback);\n return this.#result;\n function forEachChild(node) {\n return ts9.forEachChild(node, cb);\n }\n }\n};\nfunction isNamespaceExported(node) {\n return node.parent.kind === ts9.SyntaxKind.ModuleDeclaration || includesModifier(node.modifiers, ts9.SyntaxKind.ExportKeyword);\n}\nfunction namespaceHasExportStatement(ns) {\n if (ns.body === void 0 || ns.body.kind !== ts9.SyntaxKind.ModuleBlock) {\n return false;\n }\n return containsExportStatement(ns.body);\n}\nfunction containsExportStatement(block) {\n for (const statement of block.statements) {\n if (statement.kind === ts9.SyntaxKind.ExportDeclaration || statement.kind === ts9.SyntaxKind.ExportAssignment) {\n return true;\n }\n }\n return false;\n}\nfunction isBlockScopedVariableDeclarationList(declarationList) {\n return (declarationList.flags & ts9.NodeFlags.BlockScoped) !== 0;\n}\nfunction forEachDestructuringIdentifier(pattern, fn) {\n for (const element of pattern.elements) {\n if (element.kind !== ts9.SyntaxKind.BindingElement) {\n continue;\n }\n let result;\n if (element.name.kind === ts9.SyntaxKind.Identifier) {\n result = fn(element);\n } else {\n result = forEachDestructuringIdentifier(element.name, fn);\n }\n if (result) {\n return result;\n }\n }\n}\n\n// src/usage/collectVariableUsage.ts\nfunction collectVariableUsage(sourceFile) {\n return new UsageWalker().getUsage(sourceFile);\n}\n\nexport { AccessKind, DeclarationDomain, UsageDomain, collectVariableUsage, forEachComment, forEachToken, getAccessKind, getCallSignaturesOfType, getPropertyOfType, getWellKnownSymbolPropertyOfType, hasDecorators, hasExpressionInitializer, hasInitializer, hasJSDoc, hasModifiers, hasType, hasTypeArguments, includesModifier, intersectionTypeParts, isAbstractKeyword, isAccessExpression, isAccessibilityModifier, isAccessorDeclaration, isAccessorKeyword, isAnyKeyword, isArrayBindingElement, isArrayBindingOrAssignmentPattern, isAssertKeyword, isAssertsKeyword, isAssignmentKind, isAssignmentPattern, isAsyncKeyword, isAwaitKeyword, isBigIntKeyword, isBigIntLiteralType, isBindingOrAssignmentElementRestIndicator, isBindingOrAssignmentElementTarget, isBindingOrAssignmentPattern, isBindingPattern, isBlockLike, isBooleanKeyword, isBooleanLiteral, isBooleanLiteralType, isClassLikeDeclaration, isClassMemberModifier, isColonToken, isCompilerOptionEnabled, isConditionalType, isConstAssertionExpression, isConstKeyword, isDeclarationName, isDeclarationWithTypeParameterChildren, isDeclarationWithTypeParameters, isDeclareKeyword, isDefaultKeyword, isDestructuringPattern, isDotToken, isEndOfFileToken, isEntityNameExpression, isEntityNameOrEntityNameExpression, isEnumType, isEqualsGreaterThanToken, isEqualsToken, isEvolvingArrayType, isExclamationToken, isExportKeyword, isFalseKeyword, isFalseLiteral, isFalseLiteralType, isFalsyType, isForInOrOfStatement, isFreshableIntrinsicType, isFreshableType, isFunctionLikeDeclaration, isFunctionScopeBoundary, isImportExpression, isImportKeyword, isInKeyword, isIndexType, isIndexedAccessType, isInputFiles, isInstantiableType, isIntersectionType, isIntrinsicAnyType, isIntrinsicBigIntType, isIntrinsicBooleanType, isIntrinsicESSymbolType, isIntrinsicErrorType, isIntrinsicNeverType, isIntrinsicNonPrimitiveType, isIntrinsicNullType, isIntrinsicNumberType, isIntrinsicStringType, isIntrinsicType, isIntrinsicUndefinedType, isIntrinsicUnknownType, isIntrinsicVoidType, isIterationStatement, isJSDocComment, isJSDocNamespaceBody, isJSDocNamespaceDeclaration, isJSDocText, isJSDocTypeReferencingNode, isJsonMinusNumericLiteral, isJsonObjectExpression, isJsxAttributeLike, isJsxAttributeValue, isJsxChild, isJsxTagNameExpression, isJsxTagNamePropertyAccess, isLiteralToken, isLiteralType, isModifierFlagSet, isModuleBody, isModuleName, isModuleReference, isNamedDeclarationWithName, isNamedImportBindings, isNamedImportsOrExports, isNamespaceBody, isNamespaceDeclaration, isNeverKeyword, isNodeFlagSet, isNullKeyword, isNullLiteral, isNumberKeyword, isNumberLiteralType, isNumericOrStringLikeLiteral, isNumericPropertyName, isObjectBindingOrAssignmentElement, isObjectBindingOrAssignmentPattern, isObjectFlagSet, isObjectKeyword, isObjectType, isObjectTypeDeclaration, isOutKeyword, isOverrideKeyword, isParameterPropertyModifier, isPrivateKeyword, isPropertyAccessEntityNameExpression, isPropertyNameLiteral, isPropertyReadonlyInType, isProtectedKeyword, isPseudoLiteralToken, isPublicKeyword, isQuestionDotToken, isQuestionToken, isReadonlyKeyword, isSignatureDeclaration, isStaticKeyword, isStrictCompilerOptionEnabled, isStringKeyword, isStringLiteralType, isStringMappingType, isSubstitutionType, isSuperElementAccessExpression, isSuperExpression, isSuperKeyword, isSuperProperty, isSuperPropertyAccessExpression, isSymbolFlagSet, isSymbolKeyword, isSyntaxList, isTemplateLiteralType, isThenableType, isThisExpression, isThisKeyword, isTransientSymbolLinksFlagSet, isTrueKeyword, isTrueLiteral, isTrueLiteralType, isTupleType, isTupleTypeReference, isTypeFlagSet, isTypeOnlyCompatibleAliasDeclaration, isTypeParameter, isTypeReference, isTypeReferenceType, isTypeVariable, isUndefinedKeyword, isUnionOrIntersectionType, isUnionOrIntersectionTypeNode, isUnionType, isUniqueESSymbolType, isUnknownKeyword, isUnknownLiteralType, isUnparsedPrologue, isUnparsedSourceText, isUnparsedSyntheticReference, isValidPropertyAccess, isVariableLikeDeclaration, isVoidKeyword, symbolHasReadonlyDeclaration, typeIsLiteral, typeParts, unionTypeParts };\n","/** @import { Binding, Declaration, Module, Namespace } from './types' */\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { globSync } from 'tinyglobby';\nimport ts from 'typescript';\nimport * as tsu from 'ts-api-utils';\nimport { getLocator } from 'locate-character';\nimport { decode } from '@jridgewell/sourcemap-codec';\n\nconst preserved_jsdoc_tags = new Set(['default', 'deprecated', 'example']);\n\n/** @param {ts.Node} node */\nexport function get_jsdoc(node) {\n\tconst { jsDoc } = /** @type {{ jsDoc?: ts.JSDoc[] }} */ (/** @type {*} */ (node));\n\treturn jsDoc;\n}\n\n/** @param {ts.Node} node */\nexport function is_internal(node) {\n\tconst jsdoc = get_jsdoc(node);\n\n\tif (jsdoc) {\n\t\tfor (const jsDoc of jsdoc) {\n\t\t\tif (jsDoc.tags?.some((tag) => tag.tagName.escapedText === 'internal')) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/** @param {ts.Node} node */\nexport function get_jsdoc_imports(node) {\n\t/** @type {import('typescript').TypeNode[]} */\n\tconst imports = [];\n\n\tconst jsdoc = get_jsdoc(node);\n\tfor (const comment of jsdoc ?? []) {\n\t\tfor (const tag of comment.tags ?? []) {\n\t\t\tcollect_jsdoc_imports(tag, imports);\n\t\t}\n\t}\n\n\treturn imports;\n}\n\n/**\n *\n * @param {ts.JSDocTag} node\n * @param {ts.TypeNode[]} imports\n */\nfunction collect_jsdoc_imports(node, imports) {\n\tconst type_expression = /** @type {ts.JSDocTag & { typeExpression?: ts.Node}} */ (node)\n\t\t.typeExpression;\n\n\tif (type_expression) {\n\t\t/**\n\t\t * @type {ts.JSDocTag[]}\n\t\t */\n\t\tconst sub_tags = [];\n\n\t\tif (ts.isJSDocTypeLiteral(type_expression)) {\n\t\t\tsub_tags.push(...(type_expression.jsDocPropertyTags ?? []));\n\t\t} else if (ts.isJSDocSignature(type_expression)) {\n\t\t\tsub_tags.push(...type_expression.parameters, ...(type_expression.typeParameters ?? []));\n\t\t\tif (type_expression.type) {\n\t\t\t\tsub_tags.push(type_expression.type);\n\t\t\t}\n\t\t} else if (ts.isJSDocTypeExpression(type_expression)) {\n\t\t\twalk(type_expression.type, (node) => {\n\t\t\t\tif (ts.isImportTypeNode(node)) {\n\t\t\t\t\timports.push(node.argument);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tfor (const sub_tag of sub_tags) {\n\t\t\tcollect_jsdoc_imports(sub_tag, imports);\n\t\t}\n\t}\n}\n\n/**\n * @param {ts.Node} node\n * @param {import('magic-string').default} code\n */\nexport function clean_jsdoc(node, code) {\n\tconst jsdoc = get_jsdoc(node);\n\n\tif (jsdoc) {\n\t\tfor (const jsDoc of jsdoc) {\n\t\t\tlet should_keep = !!jsDoc.comment;\n\n\t\t\tjsDoc.tags?.forEach((tag) => {\n\t\t\t\tconst type = /** @type {string} */ (tag.tagName.escapedText);\n\n\t\t\t\t// @ts-ignore\n\t\t\t\tconst name = /** @type {ts.Identifier | undefined} */ (tag.name);\n\t\t\t\tif (name) {\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\tif (tag.isBracketed) {\n\t\t\t\t\t\t// in JSDoc, we might have an optional [foo] parameter. in a .d.ts context,\n\t\t\t\t\t\t// the brackets cause the parameter to be interpreted as a comment,\n\t\t\t\t\t\t// so we have to remove them\n\t\t\t\t\t\tlet a = name.pos - 1;\n\t\t\t\t\t\tlet b = name.end;\n\n\t\t\t\t\t\twhile (code.original[a] === ' ') a -= 1;\n\t\t\t\t\t\twhile (code.original[b] === ' ') b += 1;\n\n\t\t\t\t\t\tcode.remove(a, name.pos);\n\t\t\t\t\t\tcode.remove(name.end, b + 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (tag.comment) {\n\t\t\t\t\tshould_keep = true;\n\n\t\t\t\t\tif (type === 'param' || type === 'returns') {\n\t\t\t\t\t\tconst typeExpression = /** @type {ts.JSDocTypeExpression | undefined} */ (\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\ttag.typeExpression\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif (typeExpression) {\n\t\t\t\t\t\t\t// turn `@param {string} foo description` into `@param foo description`\n\t\t\t\t\t\t\tlet a = typeExpression.pos;\n\t\t\t\t\t\t\tlet b = typeExpression.end;\n\n\t\t\t\t\t\t\twhile (code.original[b] === ' ') b += 1;\n\t\t\t\t\t\t\tcode.remove(a, b);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (preserved_jsdoc_tags.has(type)) {\n\t\t\t\t\tshould_keep = true;\n\t\t\t\t} else {\n\t\t\t\t\tcode.remove(tag.pos, tag.end);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (!should_keep) {\n\t\t\t\tcode.remove(jsDoc.pos, jsDoc.end);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * @param {string} cwd\n * @param {string[]} include\n * @param {string[]} exclude\n * @returns {string[]}\n */\nexport function get_input_files(cwd, include, exclude) {\n\t/** @type {Set<string>} */\n\tconst included = new Set();\n\n\tfor (const pattern of include) {\n\t\tfor (const file of globSync(pattern, { cwd })) {\n\t\t\tconst resolved = path.resolve(cwd, file);\n\t\t\tif (fs.statSync(resolved).isDirectory()) {\n\t\t\t\tfor (const file of globSync('**/*.{js,jsx,ts,tsx}', { cwd: resolved, ignore: exclude })) {\n\t\t\t\t\tincluded.add(path.resolve(resolved, file));\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tincluded.add(resolved);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Array.from(included).map((file) => path.resolve(file));\n}\n\n/**\n * @param {string} file\n * @param {string} contents\n */\nexport function write(file, contents) {\n\ttry {\n\t\tfs.mkdirSync(path.dirname(file), { recursive: true });\n\t} catch {}\n\tfs.writeFileSync(file, contents);\n}\n\n/**\n * @param {string} file\n * @param {Record<string, string>} created\n * @param {(file: string, specifier: string) => string | null} resolve\n * @param {{ stripInternal?: boolean }} options\n * @param {Record<string, any>} context\n */\nexport function get_dts(file, created, resolve, options, context) {\n\tconst dts = created[file] ?? context.fs.readSync(file);\n\tconst ast = ts.createSourceFile(file, dts, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n\tconst locator = getLocator(dts, { offsetLine: 1 });\n\n\t/** @type {Module} */\n\tconst module = {\n\t\tfile,\n\t\tdts,\n\t\tast,\n\t\tlocator,\n\t\tsource: null,\n\t\tdependencies: [],\n\t\tglobals: [],\n\t\treferences: new Set(),\n\t\tdeclarations: new Map(),\n\t\timports: new Map(),\n\t\texports: new Map(),\n\t\texport_from: new Map(),\n\t\timport_all: new Map(),\n\t\texport_all: [],\n\t\tambient_imports: []\n\t};\n\n\tif (file in created) {\n\t\tconst map = JSON.parse(created[file + '.map']);\n\n\t\tconst source_file = path.resolve(path.dirname(file), map.sources[0]);\n\t\tconst code = context.fs.readSync(source_file);\n\n\t\tmodule.source = {\n\t\t\tcode,\n\t\t\tmap,\n\t\t\tmappings: decode(map.mappings)\n\t\t};\n\t}\n\n\t/** @type {Module | Namespace} */\n\tlet current = module;\n\n\t/** @param {ts.Node} node */\n\tfunction scan(node) {\n\t\t// follow imports\n\t\tif (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {\n\t\t\tif (node.moduleSpecifier && ts.isStringLiteral(node.moduleSpecifier)) {\n\t\t\t\tconst { text } = node.moduleSpecifier;\n\t\t\t\tconst resolved = resolve(file, text);\n\t\t\t\tconst external = !resolved;\n\t\t\t\tconst id = resolved ?? text;\n\n\t\t\t\t// if a local module, and _not_ an ambient import, add it to dependencies\n\t\t\t\tif (!external && !(ts.isImportDeclaration(node) && !node.importClause)) {\n\t\t\t\t\tmodule.dependencies.push(id);\n\t\t\t\t}\n\n\t\t\t\tif (ts.isImportDeclaration(node)) {\n\t\t\t\t\tif (node.importClause) {\n\t\t\t\t\t\t// `import foo`\n\t\t\t\t\t\tif (node.importClause.name) {\n\t\t\t\t\t\t\tconst name = node.importClause.name.getText(module.ast);\n\t\t\t\t\t\t\tmodule.imports.set(name, {\n\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\texternal,\n\t\t\t\t\t\t\t\tname: 'default'\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else if (node.importClause.namedBindings) {\n\t\t\t\t\t\t\t// `import * as foo`\n\t\t\t\t\t\t\tif (ts.isNamespaceImport(node.importClause.namedBindings)) {\n\t\t\t\t\t\t\t\tconst name = node.importClause.namedBindings.name.getText(module.ast);\n\t\t\t\t\t\t\t\tmodule.import_all.set(name, {\n\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\texternal,\n\t\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// `import { foo }`, `import { foo as bar }`\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tnode.importClause.namedBindings.elements.forEach((specifier) => {\n\t\t\t\t\t\t\t\t\tconst local = specifier.name.getText(module.ast);\n\n\t\t\t\t\t\t\t\t\tmodule.imports.set(local, {\n\t\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\t\texternal,\n\t\t\t\t\t\t\t\t\t\tname: specifier.propertyName?.getText(module.ast) ?? local\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// assume this is an ambient module\n\t\t\t\t\t\tmodule.ambient_imports.push({ id, external });\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (ts.isExportDeclaration(node)) {\n\t\t\t\t\tif (node.exportClause && ts.isNamedExports(node.exportClause)) {\n\t\t\t\t\t\t// `export { foo as bar } from '...'`\n\t\t\t\t\t\tif (ts.isNamedExports(node.exportClause)) {\n\t\t\t\t\t\t\tnode.exportClause.elements.forEach((specifier) => {\n\t\t\t\t\t\t\t\tconst name = specifier.name.getText(module.ast);\n\t\t\t\t\t\t\t\tconst local = specifier.propertyName\n\t\t\t\t\t\t\t\t\t? specifier.propertyName.getText(module.ast)\n\t\t\t\t\t\t\t\t\t: name;\n\n\t\t\t\t\t\t\t\tmodule.export_from.set(name, {\n\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\texternal,\n\t\t\t\t\t\t\t\t\tname: local\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// `export * as foo from '...'`\n\t\t\t\t\t\tif (node.exportClause) {\n\t\t\t\t\t\t\t// in this case, we need to generate an `export namespace` declaration\n\t\t\t\t\t\t\tconst name = node.exportClause?.name?.getText(module.ast) ?? null;\n\t\t\t\t\t\t\tthrow new Error(`TODO export * as ${name}`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// `export * from '...'`\n\t\t\t\t\t\tmodule.export_all.push({ id, external });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (ts.isExportDeclaration(node)) {\n\t\t\t\tif (node.exportClause && ts.isNamedExports(node.exportClause)) {\n\t\t\t\t\t// `export { foo as bar }`\n\t\t\t\t\tif (ts.isNamedExports(node.exportClause)) {\n\t\t\t\t\t\tnode.exportClause.elements.forEach((specifier) => {\n\t\t\t\t\t\t\tconst name = specifier.name.getText(module.ast);\n\t\t\t\t\t\t\tconst local = specifier.propertyName\n\t\t\t\t\t\t\t\t? specifier.propertyName.getText(module.ast)\n\t\t\t\t\t\t\t\t: name;\n\n\t\t\t\t\t\t\tmodule.exports.set(name, local);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (is_declaration(node)) {\n\t\t\tif (is_internal(node) && options.stripInternal) return;\n\n\t\t\tconst identifier = ts.isVariableStatement(node)\n\t\t\t\t? ts.getNameOfDeclaration(node.declarationList.declarations[0])\n\t\t\t\t: ts.getNameOfDeclaration(node);\n\n\t\t\tif (!identifier) {\n\t\t\t\tthrow new Error('TODO'); // unnamed default export?\n\t\t\t}\n\n\t\t\tconst name = identifier.getText(module.ast);\n\n\t\t\t// in the case of overloads, declaration may already exist\n\t\t\tconst existing = current.declarations.get(name);\n\t\t\tif (!existing) {\n\t\t\t\tcurrent.declarations.set(name, {\n\t\t\t\t\tmodule: file,\n\t\t\t\t\tname,\n\t\t\t\t\talias: '',\n\t\t\t\t\texport: false,\n\t\t\t\t\tdefault: false,\n\t\t\t\t\tincluded: false,\n\t\t\t\t\texternal: false,\n\t\t\t\t\tdependencies: [],\n\t\t\t\t\tpreferred_alias: ''\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst declaration = /** @type {Declaration} */ (current.declarations.get(name));\n\n\t\t\tconst export_modifier = node.modifiers?.find((node) => tsu.isExportKeyword(node));\n\n\t\t\tif (export_modifier) {\n\t\t\t\tconst default_modifier = node.modifiers?.find((node) => tsu.isDefaultKeyword(node));\n\t\t\t\tcurrent.exports.set(default_modifier ? 'default' : name, name);\n\t\t\t}\n\n\t\t\tconst params = new Set();\n\t\t\tif (ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node)) {\n\t\t\t\tif (node.typeParameters) {\n\t\t\t\t\tfor (const param of node.typeParameters) {\n\t\t\t\t\t\tparams.add(param.name.getText(module.ast));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (tsu.isNamespaceDeclaration(node)) {\n\t\t\t\tconst previous = current;\n\t\t\t\tcurrent = {\n\t\t\t\t\tdeclarations: new Map(),\n\t\t\t\t\treferences: new Set(),\n\t\t\t\t\texports: new Map()\n\t\t\t\t};\n\n\t\t\t\tnode.body.forEachChild(scan);\n\n\t\t\t\tfor (const name of current.references) {\n\t\t\t\t\tif (!current.declarations.has(name)) {\n\t\t\t\t\t\tprevious.references.add(name);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor (const inner of current.declarations.values()) {\n\t\t\t\t\tfor (const inner_dep of inner.dependencies) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t!declaration.dependencies.some(\n\t\t\t\t\t\t\t\t(dep) => dep.name === inner_dep.name && dep.module === inner_dep.module\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tdeclaration.dependencies.push(inner_dep);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcurrent = previous;\n\t\t\t} else {\n\t\t\t\twalk(node, (node) => {\n\t\t\t\t\tif (ts.isPropertySignature(node) && is_internal(node) && options.stripInternal) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\t// `import('./foo').Foo` -> `Foo`\n\t\t\t\t\tif (\n\t\t\t\t\t\tts.isImportTypeNode(node) &&\n\t\t\t\t\t\tts.isLiteralTypeNode(node.argument) &&\n\t\t\t\t\t\tts.isStringLiteral(node.argument.literal)\n\t\t\t\t\t) {\n\t\t\t\t\t\t// follow import\n\t\t\t\t\t\tconst resolved = resolve(file, node.argument.literal.text);\n\t\t\t\t\t\tif (resolved) {\n\t\t\t\t\t\t\tmodule.dependencies.push(resolved);\n\n\t\t\t\t\t\t\tif (node.qualifier) {\n\t\t\t\t\t\t\t\t// In the case of `import('./foo').Foo.Bar`, this contains `Foo.Bar`,\n\t\t\t\t\t\t\t\t// but we only want `Foo` (because we don't traverse into namespaces)\n\t\t\t\t\t\t\t\tlet id = node.qualifier;\n\t\t\t\t\t\t\t\twhile (ts.isQualifiedName(id)) {\n\t\t\t\t\t\t\t\t\tid = id.left;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdeclaration.dependencies.push({\n\t\t\t\t\t\t\t\t\tmodule: resolved ?? node.argument.literal.text,\n\t\t\t\t\t\t\t\t\tname: id.getText(module.ast)\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (is_reference(node)) {\n\t\t\t\t\t\tconst name = node.getText(module.ast);\n\t\t\t\t\t\tif (params.has(name)) return;\n\n\t\t\t\t\t\tcurrent.references.add(name);\n\n\t\t\t\t\t\tif (name !== declaration.name) {\n\t\t\t\t\t\t\t// If this references an import * as X statement, we add a dependency to Y of the X.Y access\n\t\t\t\t\t\t\tif (module.import_all.has(name) && ts.isQualifiedName(node.parent)) {\n\t\t\t\t\t\t\t\tdeclaration.dependencies.push({\n\t\t\t\t\t\t\t\t\tmodule: /** @type {Binding} */ (module.import_all.get(name)).id,\n\t\t\t\t\t\t\t\t\tname: node.parent.right.getText(module.ast)\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdeclaration.dependencies.push({\n\t\t\t\t\t\t\t\t\tmodule: file,\n\t\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (ts.isExportAssignment(node)) {\n\t\t\tconst name = node.expression.getText(module.ast);\n\t\t\tcurrent.exports.set('default', name);\n\t\t\treturn;\n\t\t}\n\n\t\tif (ts.isModuleDeclaration(node)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (tsu.isEndOfFileToken(node)) return;\n\n\t\tif (ts.isEnumDeclaration(node)) return;\n\n\t\t// throw new Error(`Unimplemented node type ${ts.SyntaxKind[node.kind]}`);\n\t}\n\n\tast.statements.forEach(scan);\n\n\tfor (const name of module.references) {\n\t\tif (!module.declarations.has(name) && !module.imports.has(name)) {\n\t\t\tmodule.globals.push(name);\n\t\t}\n\t}\n\n\treturn module;\n}\n\n/**\n * @param {string} from\n * @param {string} to\n * @param {Record<string, any>} context\n */\nexport function resolve_dts(from, to, context) {\n\tconst file = path.resolve(from, to);\n\tif (file.endsWith('.d.ts')) return file;\n\tif (file.endsWith('.ts')) return file.replace(/\\.ts$/, '.d.ts');\n\tif (file.endsWith('.js')) return file.replace(/\\.js$/, '.d.ts');\n\tif (file.endsWith('.jsx')) return file.replace(/\\.jsx$/, '.d.ts');\n\tif (file.endsWith('.tsx')) return file.replace(/\\.tsx$/, '.d.ts');\n\tif (context.fs.existsSync(file) && context.fs.isDirectorySync(file)) return file + '/index.d.ts';\n\treturn file + '.d.ts';\n}\n\n/**\n * @param {ts.Node} node\n * @param {(node: ts.Node) => void | false} callback\n */\nexport function walk(node, callback) {\n\tconst go_on = callback(node);\n\tif (go_on !== false) {\n\t\tts.forEachChild(node, (child) => walk(child, callback));\n\t}\n}\n\n/**\n * @param {ts.Node} node\n * @returns {node is\n * ts.InterfaceDeclaration |\n * ts.TypeAliasDeclaration |\n * ts.ClassDeclaration |\n * ts.FunctionDeclaration |\n * ts.VariableStatement |\n * ts.EnumDeclaration |\n * ts.ModuleDeclaration\n * }\n */\nexport function is_declaration(node) {\n\treturn (\n\t\tts.isInterfaceDeclaration(node) ||\n\t\tts.isTypeAliasDeclaration(node) ||\n\t\tts.isClassDeclaration(node) ||\n\t\tts.isFunctionDeclaration(node) ||\n\t\tts.isVariableStatement(node) ||\n\t\tts.isEnumDeclaration(node) ||\n\t\ttsu.isNamespaceDeclaration(node)\n\t);\n}\n\n/**\n * @param {ts.Node} node\n * @param {boolean} [include_declarations]\n * @returns {node is ts.Identifier}\n */\nexport function is_reference(node, include_declarations = false) {\n\tif (!ts.isIdentifier(node)) return false;\n\n\tif (node.parent) {\n\t\tif (is_declaration(node.parent)) {\n\t\t\tif (ts.isVariableStatement(node.parent)) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn include_declarations && node.parent.name === node;\n\t\t}\n\n\t\tif (ts.isPropertyAccessExpression(node.parent)) return node === node.parent.expression;\n\t\tif (ts.isPropertyDeclaration(node.parent)) return node === node.parent.initializer;\n\t\tif (ts.isPropertyAssignment(node.parent)) return node === node.parent.initializer;\n\t\tif (ts.isMethodSignature(node.parent)) return node !== node.parent.name;\n\n\t\tif (ts.isImportTypeNode(node.parent)) return false;\n\t\tif (ts.isPropertySignature(node.parent)) return false;\n\t\tif (ts.isGetAccessor(node.parent)) return false;\n\t\tif (ts.isSetAccessor(node.parent)) return false;\n\t\tif (ts.isParameter(node.parent)) return false;\n\t\tif (ts.isMethodDeclaration(node.parent)) return false;\n\t\tif (ts.isLabeledStatement(node.parent)) return false;\n\t\tif (ts.isBreakOrContinueStatement(node.parent)) return false;\n\t\tif (ts.isEnumMember(node.parent)) return false;\n\t\tif (ts.isModuleDeclaration(node.parent)) return false;\n\n\t\t// Only X in X.Y.Z is a reference we care about\n\t\tif (ts.isQualifiedName(node.parent)) {\n\t\t\treturn node.parent.left === node && ts.isIdentifier(node.parent.right);\n\t\t}\n\n\t\t// `const = { x: 1 }` inexplicably becomes `namespace a { let x: number; }`\n\t\tif (ts.isVariableDeclaration(node.parent)) {\n\t\t\tif (node === node.parent.initializer) return true;\n\n\t\t\tconst ancestor = node.parent.parent?.parent?.parent?.parent;\n\n\t\t\tif (ancestor && tsu.isNamespaceDeclaration(node.parent.parent.parent.parent.parent)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * parse tsconfig.json with typescript api\n * @param {string} tsconfig_file\n * @returns {{\n * include: string[]|undefined,\n * exclude: string[]|undefined,\n * compilerOptions: ts.CompilerOptions\n * }}\n * @throws {Error} if ts api returns error diagnostics\n */\nexport function parse_tsconfig(tsconfig_file) {\n\tconst { config, error: read_diagnostic } = ts.readConfigFile(tsconfig_file, ts.sys.readFile);\n\tif (read_diagnostic != null) {\n\t\treport_ts_errors(tsconfig_file, 'readConfigFile', [read_diagnostic]);\n\t}\n\tconst {\n\t\traw,\n\t\toptions,\n\t\terrors: parse_diagnostics\n\t} = ts.parseJsonConfigFileContent(config, ts.sys, path.dirname(tsconfig_file));\n\treport_ts_errors(tsconfig_file, 'parseJsonConfigFileContent', parse_diagnostics);\n\t// only returns what's needed later on\n\treturn {\n\t\tinclude: raw.include,\n\t\texclude: raw.exclude,\n\t\tcompilerOptions: options\n\t};\n}\n\n/**\n * log and throw error diagnostics\n * @param {string} tsconfig_file\n * @param {string} phase\n * @param {ts.Diagnostic[]} diagnostics\n */\nfunction report_ts_errors(tsconfig_file, phase, diagnostics) {\n\tconst errors = diagnostics.filter((d) => d.category === ts.DiagnosticCategory.Error);\n\tif (errors.length > 0) {\n\t\tconst msg = `parsing ${tsconfig_file} failed during ${phase}`;\n\t\tconsole.error(\n\t\t\t`${msg}\\n`,\n\t\t\tts.formatDiagnostics(diagnostics, {\n\t\t\t\tgetCurrentDirectory: () => ts.sys.getCurrentDirectory(),\n\t\t\t\tgetCanonicalFileName: (f) => f,\n\t\t\t\tgetNewLine: () => '\\n'\n\t\t\t})\n\t\t);\n\t\tthrow new Error(msg);\n\t}\n}\n","/** @import { Binding, Declaration, Mapping, Module, ModuleReference } from './types' */\nimport path from 'node:path';\nimport ts from 'typescript';\nimport * as tsu from 'ts-api-utils';\nimport MagicString from 'magic-string';\nimport {\n\tclean_jsdoc,\n\tget_dts,\n\tis_declaration,\n\tis_internal,\n\tis_reference,\n\tresolve_dts,\n\twalk\n} from './utils.js';\n\n/**\n * @param {string} id\n * @param {string} entry\n * @param {Record<string, string>} created\n * @param {(file: string, specifier: string) => string | null} resolve\n * @param {{ stripInternal?: boolean }} options\n * @param {Record<string, string>} context\n * @returns {{\n * content: string;\n * mappings: Map<string, Mapping>;\n * ambient: ModuleReference[];\n * }}\n */\nexport function create_module_declaration(id, entry, created, resolve, options, context) {\n\tlet content = '';\n\n\t/** @type {Map<string, Mapping>} */\n\tconst mappings = new Map();\n\n\t/** @type {ModuleReference[]} */\n\tconst ambient = [];\n\n\t/** @type {Record<string, Record<string, Declaration>>} */\n\tconst external_imports = {};\n\n\t/** @type {Record<string, Record<string, Declaration>>} */\n\tconst external_import_alls = {};\n\n\t/** @type {Record<string, Record<string, Declaration>>} */\n\tconst external_export_from = {};\n\n\t/** @type {Set<string>} */\n\tconst external_export_all_from = new Set();\n\n\t/** @type {Map<string, Module>} */\n\tconst bundle = new Map();\n\n\t/** @type {Map<string, Map<string, Declaration>>} */\n\tconst traced = new Map();\n\n\t/** @type {Set<string>} */\n\tconst exports = new Set();\n\n\t/** @type {Set<string>} */\n\tconst reserved = new Set(['default']);\n\n\t/** @type {string[]} */\n\tconst export_specifiers = [];\n\n\t// step 1 — discover which modules are included in the bundle\n\t{\n\t\tconst included = new Set([entry]);\n\n\t\tfor (const file of included) {\n\t\t\tconst module = get_dts(file, created, resolve, options, context);\n\n\t\t\tfor (const name of module.globals) {\n\t\t\t\treserved.add(name);\n\t\t\t}\n\n\t\t\tfor (const dep of module.dependencies) {\n\t\t\t\tincluded.add(dep);\n\t\t\t}\n\n\t\t\tfor (const dep of module.ambient_imports) {\n\t\t\t\tambient.push(dep);\n\t\t\t}\n\n\t\t\tfor (const [name, binding] of module.imports) {\n\t\t\t\tif (binding.external) {\n\t\t\t\t\t(external_imports[binding.id] ??= {})[binding.name] ??= create_external_declaration(\n\t\t\t\t\t\tbinding,\n\t\t\t\t\t\tname\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const [name, binding] of module.import_all) {\n\t\t\t\tif (binding.external) {\n\t\t\t\t\t(external_import_alls[binding.id] ??= {})[binding.name] ??= create_external_declaration(\n\t\t\t\t\t\tbinding,\n\t\t\t\t\t\tname\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const [name, binding] of module.export_from) {\n\t\t\t\tif (binding.external) {\n\t\t\t\t\t(external_export_from[binding.id] ??= {})[binding.name] ??= create_external_declaration(\n\t\t\t\t\t\tbinding,\n\t\t\t\t\t\tname\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const binding of module.export_all.values()) {\n\t\t\t\tif (binding.external) {\n\t\t\t\t\texternal_export_all_from.add(binding.id);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbundle.set(file, module);\n\t\t\ttraced.set(file, new Map());\n\t\t}\n\n\t\t/** @type {Set<Module>} */\n\t\tconst modules_to_export_all_from = new Set([/** @type {Module} */ (bundle.get(entry))]);\n\n\t\tfor (const module of modules_to_export_all_from) {\n\t\t\tfor (const exported of module.exports.keys()) {\n\t\t\t\texports.add(exported);\n\t\t\t}\n\n\t\t\tfor (const exported of module.export_from.keys()) {\n\t\t\t\texports.add(exported);\n\t\t\t}\n\n\t\t\tfor (const next of module.export_all) {\n\t\t\t\tconst m = bundle.get(next.id);\n\t\t\t\tif (m) modules_to_export_all_from.add(m);\n\t\t\t}\n\t\t}\n\t}\n\n\t// step 2 - treeshaking\n\t{\n\t\t/** @type {Set<string>} */\n\t\tconst names = new Set(reserved);\n\n\t\t/** @type {Set<Declaration>} */\n\t\tconst declarations = new Set();\n\n\t\t/** @param {string} name */\n\t\tfunction get_name(name) {\n\t\t\tlet i = 1;\n\t\t\twhile (names.has(name)) {\n\t\t\t\tname = `${name}_${i++}`;\n\t\t\t}\n\n\t\t\tnames.add(name);\n\t\t\treturn name;\n\t\t}\n\n\t\t/**\n\t\t * @param {Declaration} declaration\n\t\t */\n\t\tconst mark = (declaration) => {\n\t\t\tif (declaration.included) return;\n\n\t\t\tdeclarations.add(declaration);\n\t\t\tdeclaration.included = true;\n\n\t\t\tfor (const { module, name } of declaration.dependencies) {\n\t\t\t\tconst dependency = trace(module, name);\n\t\t\t\tmark(dependency);\n\t\t\t}\n\t\t};\n\n\t\tfor (const name of exports) {\n\t\t\tconst declaration = trace_export(entry, name);\n\t\t\tif (declaration) {\n\t\t\t\tdeclaration.alias = get_name(reserved.has(name) ? declaration.name : name);\n\t\t\t\tmark(declaration);\n\n\t\t\t\tif (name === 'default') {\n\t\t\t\t\tdeclaration.default = true;\n\t\t\t\t} else if (declaration.alias !== name) {\n\t\t\t\t\texport_specifiers.push(`${declaration.alias} as ${name}`);\n\t\t\t\t} else {\n\t\t\t\t\tdeclaration.export = true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow new Error('Something strange happened');\n\t\t\t}\n\t\t}\n\n\t\t// provide a name for declarations that are included but not exported\n\t\tfor (const declaration of declarations) {\n\t\t\tif (!declaration.alias) {\n\t\t\t\tdeclaration.alias = get_name(declaration.preferred_alias || declaration.name);\n\t\t\t}\n\t\t}\n\t}\n\n\t// step 3 - generate code\n\t{\n\t\tcontent += `declare module '${id}' {`;\n\n\t\t// inject imports from external modules\n\t\tfor (const id in external_imports) {\n\t\t\tconst specifiers = [];\n\n\t\t\tfor (const name in external_imports[id]) {\n\t\t\t\tconst declaration = external_imports[id][name];\n\t\t\t\tif (declaration.included) {\n\t\t\t\t\tspecifiers.push(name === declaration.alias ? name : `${name} as ${declaration.alias}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (specifiers.length > 0) {\n\t\t\t\tcontent += `\\n\\timport type { ${specifiers.join(', ')} } from '${id}';`;\n\t\t\t}\n\t\t}\n\n\t\tfor (const id in external_import_alls) {\n\t\t\tfor (const name in external_import_alls[id]) {\n\t\t\t\tcontent += `\\n\\timport * as ${name} from '${id}';`; // TODO could this have been aliased?\n\t\t\t}\n\t\t}\n\n\t\tfor (const id in external_export_from) {\n\t\t\tconst specifiers = Object.keys(external_export_from[id]).map((name) => {\n\t\t\t\t// this is a bit of a hack, but it makes life easier\n\t\t\t\texports.delete(name);\n\n\t\t\t\tconst declaration = external_export_from[id][name];\n\t\t\t\treturn name === declaration.alias ? name : `${name} as ${declaration.alias}`;\n\t\t\t});\n\n\t\t\tcontent += `\\n\\texport { ${specifiers.join(', ')} } from '${id}';`;\n\t\t}\n\n\t\t// second pass — editing\n\t\tfor (const module of bundle.values()) {\n\t\t\tconst result = new MagicString(module.dts);\n\n\t\t\tconst index = module.dts.indexOf('//# sourceMappingURL=');\n\t\t\tif (index !== -1) result.remove(index, module.dts.length);\n\n\t\t\tif (module.import_all.size > 0) {\n\t\t\t\t// remove the leading `Foo.` from references to `import * as Foo` namespace imports\n\t\t\t\twalk(module.ast, (node) => {\n\t\t\t\t\tif (is_reference(node) && ts.isQualifiedName(node.parent)) {\n\t\t\t\t\t\tconst binding = module.import_all.get(node.getText(module.ast));\n\t\t\t\t\t\tif (binding) {\n\t\t\t\t\t\t\tresult.remove(node.pos, result.original.indexOf('.', node.end) + 1);\n\t\t\t\t\t\t\tconst declaration = bundle\n\t\t\t\t\t\t\t\t.get(binding.id)\n\t\t\t\t\t\t\t\t?.declarations.get(node.parent.right.getText(module.ast));\n\t\t\t\t\t\t\tif (declaration?.alias) {\n\t\t\t\t\t\t\t\tresult.overwrite(node.parent.right.pos, node.parent.right.end, declaration.alias);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tts.forEachChild(module.ast, (node) => {\n\t\t\t\tif (\n\t\t\t\t\tts.isImportDeclaration(node) ||\n\t\t\t\t\tts.isExportDeclaration(node) ||\n\t\t\t\t\tts.isExportAssignment(node)\n\t\t\t\t) {\n\t\t\t\t\tresult.remove(node.pos, node.end);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// remove `declare module 'foo'`\n\t\t\t\tif (\n\t\t\t\t\tts.isModuleDeclaration(node) &&\n\t\t\t\t\t!tsu.isNamespaceDeclaration(node) &&\n\t\t\t\t\tnode.modifiers?.some((modifier) => tsu.isDeclareKeyword(modifier))\n\t\t\t\t) {\n\t\t\t\t\tresult.remove(node.pos, node.end);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (!is_declaration(node)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (is_internal(node) && options.stripInternal) {\n\t\t\t\t\tresult.remove(node.pos, node.end);\n\t\t\t\t}\n\n\t\t\t\tconst identifier = /** @type {ts.DeclarationName} */ (\n\t\t\t\t\tts.isVariableStatement(node)\n\t\t\t\t\t\t? ts.getNameOfDeclaration(node.declarationList.declarations[0])\n\t\t\t\t\t\t: ts.getNameOfDeclaration(node)\n\t\t\t\t);\n\n\t\t\t\tconst name = identifier.getText(module.ast);\n\n\t\t\t\tconst declaration = /** @type {Declaration} */ (module.declarations.get(name));\n\n\t\t\t\tif (!declaration.included) {\n\t\t\t\t\tresult.remove(node.pos, node.end);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// special case — TS turns `export default 42` into `const _default: 42; export default _default` —\n\t\t\t\t// the `export default` assignment is already taken care of, we just need to remove the `const _default:`\n\t\t\t\tif (declaration.default && ts.isVariableStatement(node)) {\n\t\t\t\t\tresult.remove(\n\t\t\t\t\t\tnode.getStart(),\n\t\t\t\t\t\t/** @type {ts.TypeNode} */ (node.declarationList.declarations[0].type).getStart()\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst modifiers = declaration.default\n\t\t\t\t\t? 'export default '\n\t\t\t\t\t: declaration.export\n\t\t\t\t\t? 'export '\n\t\t\t\t\t: '';\n\n\t\t\t\tif (node.modifiers) {\n\t\t\t\t\tlet end = node.modifiers[node.modifiers.length - 1].end;\n\t\t\t\t\twhile (/\\s/.test(result.original[end])) end += 1;\n\t\t\t\t\tresult.overwrite(node.getStart(), end, modifiers);\n\t\t\t\t} else if (modifiers) {\n\t\t\t\t\tresult.prependRight(node.getStart(), modifiers);\n\t\t\t\t}\n\n\t\t\t\tconst loc = module.locator(identifier.getStart(module.ast));\n\n\t\t\t\tif (loc) {\n\t\t\t\t\t// the sourcemaps generated by TypeScript are very inaccurate, borderline useless.\n\t\t\t\t\t// we need to fix them up here. TODO is it only inaccurate in the JSDoc case?\n\t\t\t\t\tconst segments = module.source?.mappings?.[loc.line - 1];\n\n\t\t\t\t\tif (module.source && segments) {\n\t\t\t\t\t\t// find the segments immediately before and after the generated column\n\t\t\t\t\t\tconst index = segments.findIndex((segment) => segment[0] >= loc.column);\n\n\t\t\t\t\t\tconst a = segments[index - 1] ?? segments[0];\n\t\t\t\t\t\tif (a) {\n\t\t\t\t\t\t\tlet l = /** @type {number} */ (a[2]);\n\n\t\t\t\t\t\t\tconst source_line = module.source.code.split('\\n')[l];\n\t\t\t\t\t\t\tconst regex = new RegExp(`\\\\b${name}\\\\b`);\n\t\t\t\t\t\t\tconst match = regex.exec(source_line);\n\n\t\t\t\t\t\t\tif (match) {\n\t\t\t\t\t\t\t\tconst mapping = {\n\t\t\t\t\t\t\t\t\tsource: path.resolve(path.dirname(module.file), module.source.map.sources[0]),\n\t\t\t\t\t\t\t\t\tline: l + 1,\n\t\t\t\t\t\t\t\t\tcolumn: match.index\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\tmappings.set(name, /** @type {Mapping} */ (mapping));\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// TODO figure out how to repair sourcemaps in this case\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// TODO how does this happen?\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmappings.set(name, {\n\t\t\t\t\t\t\tsource: module.file,\n\t\t\t\t\t\t\tline: loc.line,\n\t\t\t\t\t\t\tcolumn: loc.column\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\twalk(node, (node) => {\n\t\t\t\t\tif (ts.isPropertySignature(node) && is_internal(node) && options.stripInternal) {\n\t\t\t\t\t\tresult.remove(node.pos, node.end);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\t// We need to include the declarations because if references to them have changed, we need to update the declarations, too\n\t\t\t\t\tif (is_reference(node, true)) {\n\t\t\t\t\t\tconst name = node.getText(module.ast);\n\n\t\t\t\t\t\tconst { alias } = trace(module.file, name);\n\n\t\t\t\t\t\tif (alias !== name) {\n\t\t\t\t\t\t\tresult.overwrite(node.getStart(module.ast), node.getEnd(), alias);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// `import('./foo').Foo` -> `Foo`\n\t\t\t\t\tif (\n\t\t\t\t\t\tts.isImportTypeNode(node) &&\n\t\t\t\t\t\tts.isLiteralTypeNode(node.argument) &&\n\t\t\t\t\t\tts.isStringLiteral(node.argument.literal) &&\n\t\t\t\t\t\tnode.argument.literal.text.startsWith('.')\n\t\t\t\t\t) {\n\t\t\t\t\t\t// follow import\n\t\t\t\t\t\tconst resolved = resolve_dts(path.dirname(module.file), node.argument.literal.text, context);\n\n\t\t\t\t\t\t// included.add(resolved);\n\t\t\t\t\t\t// remove the `import(...)`\n\t\t\t\t\t\tif (node.qualifier) {\n\t\t\t\t\t\t\tconst name = node.qualifier.getText(module.ast);\n\t\t\t\t\t\t\tconst declaration = trace(resolved, name);\n\n\t\t\t\t\t\t\tresult.overwrite(node.getStart(module.ast), node.qualifier.end, declaration.alias);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthrow new Error('TODO');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tclean_jsdoc(node, result);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tconst mod = result\n\t\t\t\t.trim()\n\t\t\t\t.indent()\n\t\t\t\t.toString()\n\t\t\t\t.replace(/^( )+/gm, (match) => '\\t'.repeat(match.length / 4));\n\n\t\t\tif (mod) content += '\\n' + mod;\n\t\t}\n\n\t\t// finally, export any bindings that are exported from external modules\n\n\t\tfor (const name of exports) {\n\t\t\tconst declaration = trace_export(entry, name);\n\t\t\tif (declaration?.external) {\n\t\t\t\texport_specifiers.push(declaration.alias);\n\t\t\t}\n\t\t}\n\n\t\t// Always add an export { .. } statement, even if there are no exports. This ensures\n\t\t// that only the public types are exposed to consumers of the declaration file. Due to some\n\t\t// old TypeScript inconsistency, omitting the export statement would expose all types.\n\t\tif (export_specifiers.length > 0) {\n\t\t\tcontent += `\\n\\n\\texport { ${export_specifiers.join(', ')} };`;\n\t\t} else {\n\t\t\tcontent += '\\n\\n\\texport {};';\n\t\t}\n\n\t\tcontent += `\\n}`;\n\t}\n\n\t/**\n\t * @param {string} module_id\n\t * @param {string} name\n\t * @returns {Declaration | null}\n\t */\n\tfunction trace_export(module_id, name) {\n\t\tif (module_id === id) {\n\t\t\treturn trace_export(entry, name);\n\t\t}\n\n\t\tconst module = bundle.get(module_id);\n\t\tif (module) {\n\t\t\tconst local = module.exports.get(name);\n\t\t\tif (local) {\n\t\t\t\treturn trace(module_id, local);\n\t\t\t}\n\n\t\t\tconst binding = module.export_from.get(name);\n\t\t\tif (binding) {\n\t\t\t\treturn trace_export(binding.id, binding.name);\n\t\t\t}\n\n\t\t\tfor (const reference of module.export_all) {\n\t\t\t\tconst declaration = trace_export(reference.id, name);\n\t\t\t\tif (declaration) return declaration;\n\t\t\t}\n\t\t} else {\n\t\t\tconst declaration =\n\t\t\t\texternal_imports[module_id]?.[name] ??\n\t\t\t\texternal_import_alls[module_id]?.[name] ??\n\t\t\t\texternal_export_from[module_id]?.[name];\n\n\t\t\tif (declaration) return declaration;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * @param {string} id\n\t * @param {string} name\n\t * @returns {Declaration}\n\t */\n\tfunction trace(id, name) {\n\t\tconst cache = traced.get(id);\n\n\t\tif (!cache) {\n\t\t\t// this means we're dealing with an external module\n\t\t\treturn (\n\t\t\t\texternal_imports[id]?.[name] ??\n\t\t\t\texternal_import_alls[id]?.[name] ??\n\t\t\t\texternal_export_from[id]?.[name]\n\t\t\t);\n\t\t}\n\n\t\tif (cache.has(name)) {\n\t\t\treturn /** @type {Declaration} */ (cache.get(name));\n\t\t}\n\n\t\tconst module = bundle.get(id);\n\t\tif (module) {\n\t\t\tconst declaration = module.declarations.get(name);\n\t\t\tif (declaration) {\n\t\t\t\tcache.set(name, declaration);\n\t\t\t\treturn declaration;\n\t\t\t}\n\n\t\t\tconst binding = module.imports.get(name) ?? module.export_from.get(name);\n\t\t\tif (binding) {\n\t\t\t\tconst declaration = trace_export(binding.id, binding.name);\n\t\t\t\tif (declaration) return declaration;\n\t\t\t}\n\n\t\t\tfor (const reference of module.export_all) {\n\t\t\t\tconst declaration = trace_export(reference.id, name);\n\t\t\t\tif (declaration) {\n\t\t\t\t\tcache.set(name, declaration);\n\t\t\t\t\treturn declaration;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// otherwise it's presumably a built-in\n\t\t\treturn {\n\t\t\t\tmodule: '<builtin>',\n\t\t\t\texternal: false,\n\t\t\t\tincluded: true,\n\t\t\t\texport: false,\n\t\t\t\tdefault: false,\n\t\t\t\tname,\n\t\t\t\talias: name,\n\t\t\t\tdependencies: [],\n\t\t\t\tpreferred_alias: ''\n\t\t\t};\n\t\t} else {\n\t\t\tthrow new Error('TODO external imports');\n\t\t}\n\t}\n\n\treturn {\n\t\tcontent,\n\t\tmappings,\n\t\tambient\n\t};\n}\n\n/**\n * @param {Binding} binding\n * @param {string} alias\n * @returns {Declaration}\n */\nfunction create_external_declaration(binding, alias) {\n\treturn {\n\t\tmodule: binding.id,\n\t\tname: binding.name,\n\t\talias: '',\n\t\texport: false,\n\t\tdefault: false,\n\t\texternal: true,\n\t\tincluded: false,\n\t\tdependencies: [],\n\t\tpreferred_alias: alias\n\t};\n}\n","import path from 'node:path';\nimport ts from 'typescript';\nimport MagicString from 'magic-string';\nimport { getLocator } from 'locate-character';\nimport { SourceMapGenerator } from '@jridgewell/source-map';\nimport {\n\tclean_jsdoc,\n\tget_input_files,\n\tget_jsdoc_imports,\n\tis_declaration,\n\tparse_tsconfig,\n\tresolve_dts,\n\twalk,\n} from './utils.js';\nimport { create_module_declaration } from './create-module-declaration.js';\n\n/**\n * @param {{\n * output: string;\n * modules: Record<string, string>;\n * project?: string;\n * compilerOptions?: ts.CompilerOptions;\n * include?: string[];\n * exclude?: string[];\n * debug?: string;\n * context: Record<string, any>;\n * }} config\n * @returns {Promise<string>}\n */\nexport async function createBundle(config) {\n\tconst project = config.project ?? 'tsconfig.json';\n\tconst output = path.resolve(config.output);\n\tconst debug = config.debug && path.resolve(config.debug);\n\n\t/** @type {Record<string, string>} */\n\tconst modules = {};\n\tfor (const id in config.modules) {\n\t\tmodules[id] = path.resolve(config.modules[id]).replace(/(\\.d\\.ts|\\.js|\\.ts)$/, '.d.ts');\n\t}\n\n\tconst cwd = config.context?.workspaceConfig?.workspaceRoot ? path.resolve(config.context.workspaceConfig.workspaceRoot) : path.resolve(path.dirname(project));\n\tconst tsconfig = parse_tsconfig(project);\n\n\tconst input = get_input_files(\n\t\tcwd,\n\t\tconfig.include ?? tsconfig.include ?? ['**'],\n\t\tconfig.exclude ?? tsconfig.exclude ?? []\n\t);\n\n\tconst original_cwd = process.cwd();\n\tprocess.chdir(cwd);\n\n\ttry {\n\t\tconst baseUrl =\n\t\t\ttsconfig.compilerOptions?.baseUrl ?? config.compilerOptions?.baseUrl\n\t\t\t\t? path.resolve(original_cwd, config.compilerOptions?.baseUrl ?? '.')\n\t\t\t\t: cwd;\n\n\t\tconst paths = {\n\t\t\t...tsconfig.compilerOptions?.paths,\n\t\t\t...config.compilerOptions?.paths\n\t\t};\n\n\t\t/** @type {ts.CompilerOptions} */\n\t\tconst compilerOptions = {\n\t\t\t...tsconfig.compilerOptions,\n\t\t\t...config.compilerOptions,\n\t\t\tbaseUrl,\n\t\t\tallowJs: true,\n\t\t\tcheckJs: true,\n\t\t\tdeclaration: true,\n\t\t\tdeclarationDir: undefined,\n\t\t\tdeclarationMap: true,\n\t\t\temitDeclarationOnly: true,\n\t\t\tlib: undefined,\n\t\t\tnoEmit: false,\n\t\t\tnoEmitOnError: false,\n\t\t\toutDir: undefined,\n\t\t\tpaths\n\t\t};\n\n\t\tfor (const key in paths) {\n\t\t\tpaths[key] = paths[key].map((p) => path.resolve(baseUrl, p));\n\t\t}\n\n\t\t// if `compilerOptions.paths` is used, we need to update the source before TypeScript sees it,\n\t\t// otherwise the unresolved aliases will be present in the output\n\t\tconst paths_to_replace = Object.keys(paths).filter((key) => !(key in modules));\n\n\t\tconst paths_regex = new RegExp(\n\t\t\t`(['\"])(${paths_to_replace\n\t\t\t\t.map((path) => path.replace(/[-[\\]{}()+?.,\\\\^$|#\\s]/g, '\\\\$&').replace(/\\*/g, '(.+)'))\n\t\t\t\t.join('|')})\\\\1`\n\t\t);\n\n\t\t/** @type {Record<string, string>} */\n\t\tconst created = {};\n\t\tconst host = ts.createCompilerHost(compilerOptions);\n\t\thost.writeFile = (file, contents) => (created[file.replace(/\\//g, path.sep)] = contents);\n\t\thost.readFile = (file) => {\n\t\t\tfile = file.replace(/\\//g, path.sep);\n\t\t\tconst contents = config.context.fs.readSync(file);\n\n\t\t\tif (!input.includes(file)) return contents;\n\t\t\tif (!paths_regex.test(contents)) return contents;\n\n\t\t\tconst code = new MagicString(contents);\n\t\t\tconst ast = ts.createSourceFile(\n\t\t\t\tfile,\n\t\t\t\tcontents,\n\t\t\t\tts.ScriptTarget.Latest,\n\t\t\t\tfalse,\n\t\t\t\tts.ScriptKind.TS\n\t\t\t);\n\n\t\t\t/** @param {import('typescript').Node} node */\n\t\t\tfunction replace_path(node) {\n\t\t\t\tconst imported = node.getText(ast);\n\t\t\t\tconst match = paths_regex.exec(imported);\n\n\t\t\t\tif (!match) return;\n\n\t\t\t\tconst replacements = paths[match[2]];\n\t\t\t\tconst substitution = match[3];\n\n\t\t\t\t/** @type {string | null} */\n\t\t\t\tlet replacement = null;\n\n\t\t\t\tfor (const candidate of replacements) {\n\t\t\t\t\tconst substituted = candidate.replace('*', substitution);\n\n\t\t\t\t\tif (input.includes(substituted)) {\n\t\t\t\t\t\treplacement = substituted;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst extensionless = substituted.replace(/\\.((d\\.)?ts|js)$/, '');\n\t\t\t\t\tfor (const extension of ['.d.ts', '.ts', '.js']) {\n\t\t\t\t\t\tif (input.includes(extensionless + extension)) {\n\t\t\t\t\t\t\treplacement = extensionless + extension;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (replacement) {\n\t\t\t\t\tlet relative = path.relative(path.dirname(file), replacement).replaceAll('\\\\', '/');\n\t\t\t\t\tif (relative[0] !== '.') relative = `./${relative}`;\n\n\t\t\t\t\tcode.overwrite(node.pos, node.end, `${match[1]}${relative}${match[1]}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tts.forEachChild(ast, (node) => {\n\t\t\t\twalk(node, (node) => {\n\t\t\t\t\tif (ts.isImportDeclaration(node)) {\n\t\t\t\t\t\treplace_path(node.moduleSpecifier);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (ts.isExportDeclaration(node) && node.moduleSpecifier) {\n\t\t\t\t\t\treplace_path(node.moduleSpecifier);\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (const source of get_jsdoc_imports(node)) {\n\t\t\t\t\t\treplace_path(source);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\n\t\t\treturn code.toString();\n\t\t};\n\n\t\tconst program = ts.createProgram(input, compilerOptions, host);\n\t\tprogram.emit();\n\n\t\tif (debug) {\n\t\t\tfor (const file in created) {\n\t\t\t\tconst relative = path.relative(cwd, file);\n\t\t\t\tconst dest = path.join(debug, relative);\n\t\t\t\tconfig.context.fs.writeSync(dest, created[file]);\n\t\t\t}\n\n\t\t\tfor (const file of input) {\n\t\t\t\tif (!file.endsWith('.d.ts')) continue;\n\t\t\t\tconst relative = path.relative(cwd, file);\n\t\t\t\tconst dest = path.join(debug, relative);\n\t\t\t\tconfig.context.fs.writeSync(dest, config.context.fs.readSync(file));\n\t\t\t}\n\t\t}\n\n\t\tlet types = '';\n\n\t\t/** @type {Map<string, Map<string, import('./types').Mapping>>} */\n\t\tconst all_mappings = new Map();\n\n\t\t/** @type {Set<string>} */\n\t\tconst ambient_modules = new Set();\n\n\t\t/** @type {Set<string>} */\n\t\tconst external_ambient_modules = new Set();\n\n\t\tlet first = true;\n\n\t\t/**\n\t\t * @param {string} file\n\t\t * @param {string} specifier\n\t\t * @returns {string | null}\n\t\t */\n\t\tfunction resolve(file, specifier) {\n\t\t\t// if a module imports from another module we're declaring,\n\t\t\t// leave the import intact\n\t\t\tif (specifier in modules) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// resolve relative imports and aliases (from tsconfig.paths)\n\t\t\treturn config.context.fs.isVirtual(specifier, file) \n ? config.context.fs.resolveSync(specifier, file)\n : specifier.startsWith('.')\n\t\t\t\t? resolve_dts(path.dirname(file), specifier, config.context)\n\t\t\t\t: compilerOptions.paths?.[specifier]?.[0] ?? null;\n\t\t}\n\n\t\tfor (const id in modules) {\n\t\t\tif (!first) types += '\\n\\n';\n\t\t\tfirst = false;\n\n\t\t\tconst { content, mappings, ambient } = create_module_declaration(\n\t\t\t\tid,\n\t\t\t\tmodules[id],\n\t\t\t\tcreated,\n\t\t\t\tresolve,\n\t\t\t\tcompilerOptions,\n config.context\n\t\t\t);\n\n\t\t\ttypes += content;\n\t\t\tall_mappings.set(id, mappings);\n\t\t\tfor (const dep of ambient) {\n\t\t\t\tif (dep.external) {\n\t\t\t\t\texternal_ambient_modules.add(dep.id);\n\t\t\t\t} else {\n\t\t\t\t\tambient_modules.add(dep.id);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const file of ambient_modules) {\n\t\t\t// clean up ambient module then inject wholesale\n\t\t\t// TODO do we need sourcemaps here?\n\t\t\tconst dts = created[file] ?? config.context.fs.readSync(file);\n\t\t\tconst result = new MagicString(dts);\n\n\t\t\tconst index = dts.indexOf('//# sourceMappingURL=');\n\t\t\tif (index !== -1) result.remove(index, dts.length);\n\n\t\t\tconst ast = ts.createSourceFile(file, dts, ts.ScriptTarget.Latest, false, ts.ScriptKind.TS);\n\n\t\t\tts.forEachChild(ast, (node) => {\n\t\t\t\tif (ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node)) {\n\t\t\t\t\twalk(node, (node) => {\n\t\t\t\t\t\tclean_jsdoc(node, result);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\n\t\t\ttypes += result.trim().toString();\n\t\t}\n\n\t\tif (external_ambient_modules.size > 0) {\n\t\t\tconst imports = Array.from(external_ambient_modules)\n\t\t\t\t.map((id) => `/// <reference types=\"${id}\" />`)\n\t\t\t\t.join('\\n');\n\n\t\t\ttypes = `${imports}\\n\\n${types}`;\n\t\t}\n\n\t\t// finally, add back exports as appropriate\n\t\tconst ast = ts.createSourceFile(output, types, ts.ScriptTarget.Latest, false, ts.ScriptKind.TS);\n\t\tconst magic_string = new MagicString(types);\n\t\tconst locator = getLocator(types, { offsetLine: 1 });\n\t\tconst smg = new SourceMapGenerator({ file: path.basename(output) });\n\n\t\t/** @type {Set<string>} */\n\t\tconst sources = new Set();\n\n\t\tts.forEachChild(ast, (node) => {\n\t\t\tif (ts.isModuleDeclaration(node)) {\n\t\t\t\tif (!node.body) return;\n\n\t\t\t\tconst name = node.name.text;\n\n\t\t\t\tconst mappings = all_mappings.get(name);\n\n\t\t\t\tnode.body.forEachChild((node) => {\n\t\t\t\t\tif (is_declaration(node)) {\n\t\t\t\t\t\tconst identifier = ts.isVariableStatement(node)\n\t\t\t\t\t\t\t? ts.getNameOfDeclaration(node.declarationList.declarations[0])\n\t\t\t\t\t\t\t: ts.getNameOfDeclaration(node);\n\n\t\t\t\t\t\tif (identifier) {\n\t\t\t\t\t\t\tconst name = identifier.getText(ast);\n\n\t\t\t\t\t\t\tconst mapping = mappings?.get(name);\n\n\t\t\t\t\t\t\tif (mapping) {\n\t\t\t\t\t\t\t\tconst start = identifier.getStart(ast);\n\t\t\t\t\t\t\t\tconst location = locator(start);\n\n\t\t\t\t\t\t\t\tif (location) {\n\t\t\t\t\t\t\t\t\tlet { line, column } = location;\n\n\t\t\t\t\t\t\t\t\tconst relative = path\n\t\t\t\t\t\t\t\t\t\t.relative(path.dirname(output), mapping.source)\n\t\t\t\t\t\t\t\t\t\t.replace(/\\\\/g, '/');\n\n\t\t\t\t\t\t\t\t\tsmg.addMapping({\n\t\t\t\t\t\t\t\t\t\tgenerated: { line, column },\n\t\t\t\t\t\t\t\t\t\toriginal: { line: mapping.line, column: mapping.column },\n\t\t\t\t\t\t\t\t\t\tsource: relative,\n\t\t\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\tsmg.addMapping({\n\t\t\t\t\t\t\t\t\t\tgenerated: { line, column: column + name.length },\n\t\t\t\t\t\t\t\t\t\toriginal: { line: mapping.line, column: mapping.column + name.length },\n\t\t\t\t\t\t\t\t\t\tsource: relative,\n\t\t\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\tsources.add(mapping.source);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\t// for (const source of sources) {\n\t\t// \tsmg.setSourceContent(\n\t\t// \t\tpath.relative(path.dirname(output), source),\n\t\t// \t\toptions.readSync(source)\n\t\t// \t);\n\t\t// }\n\n if (config.context.config?.output?.sourceMap) {\n const comment = `//# sourceMappingURL=${path.basename(output)}.map`;\n\t\t magic_string.append(`\\n\\n${comment}`);\n\n\t\t config.context.fs.writeSync(`${output}.map`, JSON.stringify(smg.toJSON(), null, '\\t'));\n } else {\n config.context.fs.removeSync(`${output}.map`);\n }\n\n return magic_string.toString();\n\t} finally {\n\t\tprocess.chdir(original_cwd);\n\t}\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { isParentPath } from \"@stryke/path\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { prettyBytes } from \"@stryke/string-format/pretty-bytes\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { match } from \"bundle-require\";\nimport { createBundle } from \"dts-buddy\";\nimport { Context } from \"../../types\";\nimport { format } from \"../../utils\";\n\n/**\n * Formats the generated TypeScript types source code.\n *\n * @param code - The generated TypeScript code.\n * @returns The formatted TypeScript code.\n */\nexport function formatTypes(code = \"\"): string {\n return code.replaceAll(\"#private;\", \"\").replace(/__Ω/g, \"\");\n}\n\n/**\n * Formats a generated TypeScript module in the types source code.\n *\n * @param context - The Powerlines context.\n * @param id - The module ID for the generated TypeScript module.\n * @param code - The generated TypeScript module code.\n * @returns The formatted TypeScript module code.\n */\nexport async function formatTypesModule(\n context: Context,\n id: string,\n code: string\n): Promise<{ code: string; directives: string[] }> {\n const ast = await context.parse(code, {\n lang: \"dts\",\n astType: \"ts\"\n });\n\n return {\n code: `declare module \"${context.config.framework}:${id}\" {\n ${ast.module.staticImports\n .filter(\n staticImport =>\n !match(\n staticImport.moduleRequest.value,\n context.config.resolve.external\n ) && !staticImport.moduleRequest.value.startsWith(\"node:\")\n )\n .map(staticImport => {\n return `import type { ${staticImport.entries\n .map(\n entry =>\n `${entry.importName.name}${entry.localName.value ? ` as ${entry.localName.value}` : \"\"}`\n )\n .join(\", \")} } from \"${staticImport.moduleRequest.value}\"; `;\n })\n .join(\"\\n\")}\n\n ${ast.module.staticImports\n .filter(\n staticImport =>\n !match(\n staticImport.moduleRequest.value,\n context.config.resolve.external\n ) && !staticImport.moduleRequest.value.startsWith(\"node:\")\n )\n .reduce((ret, staticImport) => {\n return `import type { ${staticImport.entries\n .map(\n entry =>\n `${entry.importName.name}${entry.localName.value ? ` as ${entry.localName.value}` : \"\"}`\n )\n .join(\n \", \"\n )} } from \"${staticImport.moduleRequest.value}\";${ret.replaceAll(\n new RegExp(\n `^import.*from\\\\s+['\"]${staticImport.moduleRequest.value}['\"]\\\\s*;?$`,\n \"gm\"\n ),\n \"\"\n )}`;\n }, code)\n .replaceAll(/^\\s*export\\s*declare\\s*/gm, \"export \")\n .replaceAll(/^\\s*declare\\s*/gm, \"\")\n .replaceAll(/^\\s*export\\s*\\{\\s*\\}/gm, \"\")\n .replaceAll(/^\\s*export\\s*=\\s*/gm, \"export default \")\n .replaceAll(/^\\s*export\\s*\\{/gm, \"export {\")\n .replaceAll(/^\\s*export\\s*default\\s*\\{/gm, \"export default {\")\n .replaceAll(/^\\s*export\\s*function\\s*/gm, \"export function \")\n .replaceAll(/^\\s*export\\s*class\\s*/gm, \"export class \")\n .replaceAll(/^\\s*export\\s*interface\\s*/gm, \"export interface \")\n .replaceAll(/^\\s*export\\s*type\\s*/gm, \"export type \")\n .replaceAll(/^\\s*export\\s*enum\\s*/gm, \"export enum \")\n .replaceAll(/^\\s*export\\s*namespace\\s*/gm, \"export namespace \")}${\n ast.module.staticExports.length === 0\n ? `\n export {};`\n : \"\"\n }\n}\n`,\n directives: ast.module.staticImports\n .filter(\n staticImport =>\n match(\n staticImport.moduleRequest.value,\n context.config.resolve.external\n ) || staticImport.moduleRequest.value.startsWith(\"node:\")\n )\n .map(staticImport => staticImport.moduleRequest.value)\n };\n}\n\n/**\n * Emits TypeScript declaration types for the provided files using the given TypeScript configuration.\n *\n * @param context - The context containing options and environment paths.\n * @param files - The list of files to generate types for.\n * @returns A promise that resolves to the generated TypeScript declaration types.\n */\nexport async function emitBuiltinTypes<TContext extends Context>(\n context: TContext,\n files: string[]\n): Promise<{ code: string; directives: string[] }> {\n if (files.length === 0) {\n context.debug(\n \"No files provided for TypeScript types generation. Typescript compilation for built-in modules will be skipped.\"\n );\n return { code: \"\", directives: [] };\n }\n\n context.debug(\n `Running the TypeScript compiler for ${\n files.length\n } generated built-in module files.`\n );\n\n let result = await createBundle({\n context,\n project: context.tsconfig.tsconfigFilePath,\n output: context.typesPath,\n include: files.map(file =>\n appendPath(file, context.workspaceConfig.workspaceRoot)\n ),\n modules: (await context.getBuiltins()).reduce(\n (ret, file) => {\n ret[`${context.config.framework}:${file.id}`] = file.path;\n return ret;\n },\n {} as Record<string, string>\n ),\n compilerOptions: {\n declaration: true,\n declarationMap: false,\n emitDeclarationOnly: true,\n sourceMap: false,\n outDir: replacePath(\n context.builtinsPath,\n context.workspaceConfig.workspaceRoot\n ),\n composite: false,\n incremental: false,\n tsBuildInfoFile: undefined\n }\n });\n\n result = formatTypes(result);\n for (const file of files\n .map(file => appendPath(file, context.workspaceConfig.workspaceRoot))\n .filter(file => isParentPath(file, context.builtinsPath))) {\n const content = await context.fs.read(file);\n if (isSetString(content)) {\n const moduleComment = content\n .match(\n new RegExp(\n `\\\\/\\\\*\\\\*(?s:.)*?@module\\\\s+${\n context.config.framework\n }:(?:${context.builtins.join(\"|\")})(?s:.)*?\\\\*\\\\/\\\\s+`\n )\n )\n ?.find(comment => isSetString(comment?.trim()));\n\n if (moduleComment) {\n context.debug(\n `Adding module-level comment for the built-in module types declaration for file: ${file}`\n );\n\n const metadata = context.fs.getMetadata(file);\n if (metadata?.id) {\n result = result.replace(\n `declare module \"${context.config.framework}:${metadata.id}\" {`,\n `${moduleComment.trim()}\ndeclare module \"${context.config.framework}:${metadata.id}\" {`\n );\n }\n }\n }\n }\n\n result = await format(context, context.typesPath, result);\n\n context.debug(\n `A TypeScript declaration file (size: ${prettyBytes(\n new Blob(toArray(result)).size\n )}) emitted for the built-in modules types.`\n );\n\n return { code: result, directives: [] };\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { install } from \"@stryke/fs/install\";\nimport {\n doesPackageMatch,\n getPackageListing,\n isPackageListed\n} from \"@stryke/fs/package-fns\";\nimport {\n getPackageName,\n getPackageVersion,\n hasPackageVersion\n} from \"@stryke/string-format/package\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport type { Context } from \"../../types\";\n\n/**\n * Installs a package if it is not already installed.\n *\n * @param context - The resolved options\n * @param packageName - The name of the package to install\n * @param dev - Whether to install the package as a dev dependency\n */\nexport async function installPackage(\n context: Context,\n packageName: string,\n dev = false\n) {\n if (\n !(await isPackageListed(getPackageName(packageName), {\n cwd: context.config.root\n }))\n ) {\n if (context.config.autoInstall) {\n context.warn(\n `The package \"${packageName}\" is not installed. It will be installed automatically.`\n );\n\n const result = await install(packageName, {\n cwd: context.config.root,\n dev\n });\n if (isNumber(result.exitCode) && result.exitCode > 0) {\n context.error(result.stderr);\n throw new Error(\n `An error occurred while installing the package \"${packageName}\"`\n );\n }\n } else {\n context.warn(\n `The package \"${packageName}\" is not installed. Since the \"autoInstall\" option is set to false, it will not be installed automatically.`\n );\n }\n } else if (\n hasPackageVersion(packageName) &&\n !process.env.POWERLINES_SKIP_VERSION_CHECK\n ) {\n const isMatching = await doesPackageMatch(\n getPackageName(packageName),\n getPackageVersion(packageName)!,\n context.config.root\n );\n if (!isMatching) {\n const packageListing = await getPackageListing(\n getPackageName(packageName),\n {\n cwd: context.config.root\n }\n );\n if (\n !packageListing?.version.startsWith(\"catalog:\") &&\n !packageListing?.version.startsWith(\"workspace:\")\n ) {\n context.warn(\n `The package \"${getPackageName(packageName)}\" is installed but does not match the expected version ${getPackageVersion(\n packageName\n )} (installed version: ${packageListing?.version || \"<Unknown>\"}). Please ensure this is intentional before proceeding. Note: You can skip this validation with the \"STORM_STACK_SKIP_VERSION_CHECK\" environment variable.`\n );\n }\n }\n }\n}\n\n/**\n * Installs a package if it is not already installed.\n *\n * @param context - The resolved options\n * @param packages - The list of packages to install\n */\nexport async function installPackages(\n context: Context,\n packages: Array<{ name: string; dev?: boolean }>\n) {\n return Promise.all(\n packages.map(async pkg => installPackage(context, pkg.name, pkg.dev))\n );\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getPackageName } from \"@stryke/string-format/package\";\nimport { Context } from \"../../types\";\nimport { installPackage } from \"./install\";\n\n/**\n * Install missing project dependencies.\n *\n * @param context - The build context.\n */\nexport async function installDependencies<TContext extends Context = Context>(\n context: TContext\n): Promise<void> {\n context.debug(`Checking and installing missing project dependencies.`);\n\n context.dependencies ??= {};\n context.devDependencies ??= {};\n\n if (\n Object.keys(context.dependencies).length === 0 &&\n Object.keys(context.devDependencies).length === 0\n ) {\n context.debug(\n `No dependencies or devDependencies to install. Skipping installation step.`\n );\n return;\n }\n\n context.debug(\n `The following packages are required: \\nDependencies: \\n${Object.entries(\n context.dependencies\n )\n .map(([name, version]) => `- ${name}@${String(version)}`)\n .join(\" \\n\")}\\n\\nDevDependencies: \\n${Object.entries(\n context.devDependencies\n )\n .map(([name, version]) => `- ${name}@${String(version)}`)\n .join(\" \\n\")}`\n );\n\n await Promise.all([\n Promise.all(\n Object.entries(context.dependencies).map(async ([name, version]) =>\n installPackage(\n context,\n `${getPackageName(name)}@${String(version)}`,\n false\n )\n )\n ),\n Promise.all(\n Object.entries(context.devDependencies).map(async ([name, version]) =>\n installPackage(\n context,\n `${getPackageName(name)}@${String(version)}`,\n true\n )\n )\n )\n ]);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Diff, ObjectData } from \"@donedeal0/superdiff\";\nimport { getObjectDiff } from \"@donedeal0/superdiff\";\nimport { readJsonFile } from \"@stryke/fs/json\";\nimport { isPackageExists } from \"@stryke/fs/package-fns\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport {\n findFileName,\n findFilePath,\n relativePath\n} from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { TsConfigJson } from \"@stryke/types/tsconfig\";\nimport chalk from \"chalk\";\nimport type { EnvironmentContext } from \"../../types\";\nimport { ResolvedConfig } from \"../../types\";\nimport {\n getParsedTypeScriptConfig,\n getTsconfigFilePath,\n isIncludeMatchFound\n} from \"../../typescript/tsconfig\";\n\nexport function getTsconfigDtsPath<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>(context: EnvironmentContext<TResolvedConfig>): string {\n const dtsRelativePath = joinPaths(\n relativePath(\n joinPaths(context.workspaceConfig.workspaceRoot, context.config.root),\n findFilePath(context.typesPath)\n ),\n findFileName(context.typesPath)\n );\n\n return dtsRelativePath;\n}\n\nasync function resolveTsconfigChanges<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>(context: EnvironmentContext<TResolvedConfig>): Promise<TsConfigJson> {\n const tsconfig = getParsedTypeScriptConfig(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.config.tsconfig,\n context.config.tsconfigRaw\n );\n\n const tsconfigFilePath = getTsconfigFilePath(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.config.tsconfig\n );\n\n const tsconfigJson = await readJsonFile<TsConfigJson>(tsconfigFilePath);\n tsconfigJson.compilerOptions ??= {};\n\n if (context.config.output.dts !== false) {\n const dtsRelativePath = getTsconfigDtsPath(context);\n\n if (\n !tsconfigJson.include?.some(filePattern =>\n isIncludeMatchFound(filePattern, [context.typesPath, dtsRelativePath])\n )\n ) {\n tsconfigJson.include ??= [];\n tsconfigJson.include.push(\n dtsRelativePath.startsWith(\"./\")\n ? dtsRelativePath.slice(2)\n : dtsRelativePath\n );\n }\n }\n\n if (\n !tsconfig.options.lib?.some(lib =>\n [\n \"lib.esnext.d.ts\",\n \"lib.es2021.d.ts\",\n \"lib.es2022.d.ts\",\n \"lib.es2023.d.ts\"\n ].includes(lib.toLowerCase())\n )\n ) {\n tsconfigJson.compilerOptions.lib ??= [];\n tsconfigJson.compilerOptions.lib.push(\"esnext\");\n }\n\n // if (tsconfig.options.module !== ts.ModuleKind.ESNext) {\n // tsconfigJson.compilerOptions.module = \"ESNext\";\n // }\n\n // if (\n // !tsconfig.options.target ||\n // ![\n // ts.ScriptTarget.ESNext,\n // ts.ScriptTarget.ES2024,\n // ts.ScriptTarget.ES2023,\n // ts.ScriptTarget.ES2022,\n // ts.ScriptTarget.ES2021\n // ].includes(tsconfig.options.target)\n // ) {\n // tsconfigJson.compilerOptions.target = \"ESNext\";\n // }\n\n // if (tsconfig.options.moduleResolution !== ts.ModuleResolutionKind.Bundler) {\n // tsconfigJson.compilerOptions.moduleResolution = \"Bundler\";\n // }\n\n // if (tsconfig.options.moduleDetection !== ts.ModuleDetectionKind.Force) {\n // tsconfigJson.compilerOptions.moduleDetection = \"force\";\n // }\n\n // if (tsconfig.options.allowSyntheticDefaultImports !== true) {\n // tsconfigJson.compilerOptions.allowSyntheticDefaultImports = true;\n // }\n\n // if (tsconfig.options.noImplicitOverride !== true) {\n // tsconfigJson.compilerOptions.noImplicitOverride = true;\n // }\n\n // if (tsconfig.options.noUncheckedIndexedAccess !== true) {\n // tsconfigJson.compilerOptions.noUncheckedIndexedAccess = true;\n // }\n\n // if (tsconfig.options.skipLibCheck !== true) {\n // tsconfigJson.compilerOptions.skipLibCheck = true;\n // }\n\n // if (tsconfig.options.resolveJsonModule !== true) {\n // tsconfigJson.compilerOptions.resolveJsonModule = true;\n // }\n\n // if (tsconfig.options.verbatimModuleSyntax !== false) {\n // tsconfigJson.compilerOptions.verbatimModuleSyntax = false;\n // }\n\n // if (tsconfig.options.allowJs !== true) {\n // tsconfigJson.compilerOptions.allowJs = true;\n // }\n\n // if (tsconfig.options.declaration !== true) {\n // tsconfigJson.compilerOptions.declaration = true;\n // }\n\n if (tsconfig.options.esModuleInterop !== true) {\n tsconfigJson.compilerOptions.esModuleInterop = true;\n }\n\n if (tsconfig.options.isolatedModules !== true) {\n tsconfigJson.compilerOptions.isolatedModules = true;\n }\n\n if (context.config.platform === \"node\") {\n if (\n !tsconfig.options.types?.some(\n type =>\n type.toLowerCase() === \"node\" || type.toLowerCase() === \"@types/node\"\n )\n ) {\n tsconfigJson.compilerOptions.types ??= [];\n tsconfigJson.compilerOptions.types.push(\"node\");\n }\n }\n\n return tsconfigJson;\n}\n\nexport async function initializeTsconfig<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TContext extends EnvironmentContext<TResolvedConfig> =\n EnvironmentContext<TResolvedConfig>\n>(context: TContext): Promise<void> {\n context.debug(\n \"Initializing TypeScript configuration (tsconfig.json) for the Powerlines project.\"\n );\n\n if (!isPackageExists(\"typescript\")) {\n throw new Error(\n 'The TypeScript package is not installed. Please install the package using the command: \"npm install typescript --save-dev\"'\n );\n }\n\n const tsconfigFilePath = getTsconfigFilePath(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.config.tsconfig\n );\n\n context.tsconfig.originalTsconfigJson =\n await readJsonFile<TsConfigJson>(tsconfigFilePath);\n\n context.tsconfig.tsconfigJson =\n await resolveTsconfigChanges<TResolvedConfig>(context);\n\n context.debug(\n \"Writing updated TypeScript configuration (tsconfig.json) file to disk.\"\n );\n\n await context.fs.write(\n tsconfigFilePath,\n StormJSON.stringify(context.tsconfig.tsconfigJson)\n );\n\n context.tsconfig = getParsedTypeScriptConfig(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.config.tsconfig,\n context.config.tsconfigRaw,\n context.tsconfig.originalTsconfigJson\n );\n}\n\nexport async function resolveTsconfig<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TContext extends EnvironmentContext<TResolvedConfig> =\n EnvironmentContext<TResolvedConfig>\n>(context: TContext): Promise<void> {\n const updateTsconfigJson = await readJsonFile<TsConfigJson>(\n context.tsconfig.tsconfigFilePath\n );\n if (\n updateTsconfigJson?.compilerOptions?.types &&\n Array.isArray(updateTsconfigJson.compilerOptions.types) &&\n !updateTsconfigJson.compilerOptions.types.length\n ) {\n // If the types array is empty, we can safely remove it\n delete updateTsconfigJson.compilerOptions.types;\n }\n\n const result = getObjectDiff(\n context.tsconfig.originalTsconfigJson as NonNullable<ObjectData>,\n updateTsconfigJson as ObjectData,\n {\n ignoreArrayOrder: true,\n showOnly: {\n statuses: [\"added\", \"deleted\", \"updated\"],\n granularity: \"deep\"\n }\n }\n );\n\n const changes = [] as {\n field: string;\n status: \"added\" | \"deleted\" | \"updated\";\n previous: string;\n current: string;\n }[];\n const getChanges = (difference: Diff, property?: string) => {\n if (\n difference.status === \"added\" ||\n difference.status === \"deleted\" ||\n difference.status === \"updated\"\n ) {\n if (difference.diff) {\n for (const diff of difference.diff) {\n getChanges(\n diff,\n property\n ? `${property}.${difference.property}`\n : difference.property\n );\n }\n } else {\n changes.push({\n field: property\n ? `${property}.${difference.property}`\n : difference.property,\n status: difference.status,\n previous:\n difference.status === \"added\"\n ? \"---\"\n : StormJSON.stringify(difference.previousValue),\n current:\n difference.status === \"deleted\"\n ? \"---\"\n : StormJSON.stringify(difference.currentValue)\n });\n }\n }\n };\n\n for (const diff of result.diff) {\n getChanges(diff);\n }\n\n if (changes.length > 0) {\n context.warn(\n `Updating the following configuration values in \"${context.tsconfig.tsconfigFilePath}\" file:\n\n ${changes\n .map(\n (change, i) => `${chalk.bold.whiteBright(\n `${i + 1}. ${titleCase(change.status)} the ${change.field} field: `\n )}\n ${chalk.red(` - Previous: ${change.previous} `)}\n ${chalk.green(` - Updated: ${change.current} `)}\n `\n )\n .join(\"\\n\")}\n `\n );\n }\n\n await context.fs.write(\n context.tsconfig.tsconfigFilePath,\n StormJSON.stringify(updateTsconfigJson)\n );\n\n context.tsconfig = getParsedTypeScriptConfig(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.config.tsconfig\n );\n if (!context.tsconfig) {\n throw new Error(\"Failed to parse the TypeScript configuration file.\");\n }\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Unstable_APIContext } from \"@powerlines/core/types/_internal\";\nimport { formatLogMessage } from \"@storm-software/config-tools/logger/console\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { copyFiles } from \"@stryke/fs/copy-file\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { createDirectory, removeDirectory } from \"@stryke/fs/helpers\";\nimport { install } from \"@stryke/fs/install\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { isPackageExists } from \"@stryke/fs/package-fns\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isError } from \"@stryke/type-checks/is-error\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isPromiseLike } from \"@stryke/type-checks/is-promise\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { MaybePromise, PartialKeys, RequiredKeys } from \"@stryke/types/base\";\nimport chalk from \"chalk\";\nimport defu from \"defu\";\nimport Handlebars from \"handlebars\";\nimport packageJson from \"../package.json\" assert { type: \"json\" };\nimport {\n emitBuiltinTypes,\n formatTypes\n} from \"./_internal/helpers/generate-types\";\nimport { callHook, mergeConfigs } from \"./_internal/helpers/hooks\";\nimport { installDependencies } from \"./_internal/helpers/install-dependencies\";\nimport { writeMetaFile } from \"./_internal/helpers/meta\";\nimport {\n initializeTsconfig,\n resolveTsconfig\n} from \"./_internal/helpers/resolve-tsconfig\";\nimport { PowerlinesAPIContext } from \"./context/api-context\";\nimport {\n checkDedupe,\n findInvalidPluginConfig,\n isPlugin,\n isPluginConfig,\n isPluginConfigObject,\n isPluginConfigTuple\n} from \"./plugin-utils\";\nimport type {\n API,\n APIContext,\n BuildInlineConfig,\n CallHookOptions,\n CleanInlineConfig,\n DeployInlineConfig,\n DocsInlineConfig,\n EnvironmentContext,\n EnvironmentResolvedConfig,\n InferHookParameters,\n InitialUserConfig,\n LintInlineConfig,\n NewInlineConfig,\n Plugin,\n PluginConfig,\n PluginConfigObject,\n PluginConfigTuple,\n PluginContext,\n PluginFactory,\n PrepareInlineConfig,\n ResolvedConfig,\n TypesInlineConfig,\n TypesResult\n} from \"./types\";\nimport {\n colorText,\n format,\n formatFolder,\n getTypescriptFileHeader\n} from \"./utils\";\n\n/**\n * The Powerlines API class\n *\n * @remarks\n * This class is responsible for managing the Powerlines project lifecycle, including initialization, building, and finalization.\n *\n * @public\n */\nexport class PowerlinesAPI<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>\n implements API<TResolvedConfig>, AsyncDisposable\n{\n /**\n * The Powerlines context\n */\n #context: Unstable_APIContext<TResolvedConfig>;\n\n /**\n * The Powerlines context\n */\n public get context(): APIContext<TResolvedConfig> {\n return this.#context;\n }\n\n /**\n * Create a new Powerlines API instance\n *\n * @param context - The Powerlines context\n */\n private constructor(context: APIContext<TResolvedConfig>) {\n this.#context = context as Unstable_APIContext<TResolvedConfig>;\n }\n\n /**\n * Initialize a Powerlines API instance\n *\n * @param workspaceRoot - The directory of the underlying workspace the Powerlines project exists in\n * @param config - An object containing the configuration required to run Powerlines tasks.\n * @returns A new instance of the Powerlines API\n */\n public static async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n >(\n workspaceRoot: string,\n config: InitialUserConfig<TResolvedConfig[\"userConfig\"]>\n ): Promise<PowerlinesAPI<TResolvedConfig>> {\n const api = new PowerlinesAPI<TResolvedConfig>(\n await PowerlinesAPIContext.from(workspaceRoot, config)\n );\n api.#context.$$internal = {\n api,\n addPlugin: api.#addPlugin.bind(api)\n };\n\n api.context.info(\n `🔌 The Powerlines Engine v${packageJson.version} has started`\n );\n\n for (const plugin of api.context.config.plugins.flat(10) ?? []) {\n await api.#addPlugin(plugin);\n }\n\n if (api.context.plugins.length === 0) {\n api.context.warn(\n \"No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended.\"\n );\n } else {\n api.context.info(\n `🔌 Loaded ${api.context.plugins.length} ${titleCase(\n api.context.config.framework\n )} plugin${api.context.plugins.length > 1 ? \"s\" : \"\"}: \\n\\n${api.context.plugins\n .map((plugin, index) => ` ${index + 1}. ${colorText(plugin.name)}`)\n .join(\"\\n\")}`\n );\n }\n\n const pluginConfig = await api.callHook(\"config\", {\n environment: await api.context.getEnvironment(),\n sequential: true,\n result: \"merge\",\n merge: mergeConfigs\n });\n await api.context.withUserConfig(\n pluginConfig as TResolvedConfig[\"userConfig\"],\n { isHighPriority: false }\n );\n\n return api;\n }\n\n /**\n * Generate the Powerlines typescript declaration file\n *\n * @remarks\n * This method will only generate the typescript declaration file for the Powerlines project. It is generally recommended to run the full `prepare` command, which will run this method as part of its process.\n *\n * @param inlineConfig - The inline configuration for the types command\n */\n public async types(\n inlineConfig: PartialKeys<TypesInlineConfig, \"command\"> = {\n command: \"types\"\n }\n ) {\n this.context.info(\n \" 🏗️ Generating typescript declarations for the Powerlines project\"\n );\n\n this.context.debug(\n \" Aggregating configuration options for the Powerlines project\"\n );\n\n inlineConfig.command ??= \"types\";\n\n await this.context.withInlineConfig(\n inlineConfig as RequiredKeys<TypesInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n context.debug(\n `Initializing the processing options for the Powerlines project.`\n );\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"pre\"\n });\n\n await initializeTsconfig<TResolvedConfig>(context);\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"normal\"\n });\n\n if (context.entry.length > 0) {\n context.debug(\n `The configuration provided ${\n isObject(context.config.input)\n ? Object.keys(context.config.input).length\n : toArray(context.config.input).length\n } entry point(s), Powerlines has found ${\n context.entry.length\n } entry files(s) for the ${context.config.title} project${\n context.entry.length > 0 && context.entry.length < 10\n ? `: \\n${context.entry\n .map(\n entry =>\n `- ${entry.file}${\n entry.output ? ` -> ${entry.output}` : \"\"\n }`\n )\n .join(\" \\n\")}`\n : \"\"\n }`\n );\n } else {\n context.warn(\n `No entry files were found for the ${\n context.config.title\n } project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`\n );\n }\n\n await resolveTsconfig<TResolvedConfig>(context);\n await installDependencies(context);\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"post\"\n });\n\n context.trace(\n `Powerlines configuration has been resolved: \\n\\n${formatLogMessage({\n ...context.config,\n userConfig: isSetObject(context.config.userConfig)\n ? omit(context.config.userConfig, [\"plugins\"])\n : undefined,\n inlineConfig: isSetObject(context.config.inlineConfig)\n ? omit(context.config.inlineConfig, [\"plugins\"])\n : undefined,\n plugins: context.plugins.map(plugin => plugin.plugin.name)\n })}`\n );\n\n if (!context.fs.existsSync(context.cachePath)) {\n await createDirectory(context.cachePath);\n }\n\n if (!context.fs.existsSync(context.dataPath)) {\n await createDirectory(context.dataPath);\n }\n\n if (\n context.config.skipCache === true ||\n context.persistedMeta?.checksum !== context.meta.checksum\n ) {\n context.debug(\n `Using previously prepared files as the meta checksum has not changed.`\n );\n } else {\n context.info(\n `Running \\`prepare\\` command as the meta checksum has changed since the last run.`\n );\n\n await this.prepare(\n defu(\n {\n output: {\n types: false\n }\n },\n inlineConfig\n ) as PrepareInlineConfig<TResolvedConfig>\n );\n }\n\n await this.#types(context);\n\n this.context.debug(\"Formatting files generated during the types step.\");\n\n await format(\n context,\n context.typesPath,\n (await context.fs.read(context.typesPath)) ?? \"\"\n );\n\n await writeMetaFile(context);\n context.persistedMeta = context.meta;\n });\n\n this.context.debug(\n \"✔ Powerlines types generation has completed successfully\"\n );\n }\n\n /**\n * Prepare the Powerlines API\n *\n * @remarks\n * This method will prepare the Powerlines API for use, initializing any necessary resources.\n *\n * @param inlineConfig - The inline configuration for the prepare command\n */\n public async prepare(\n inlineConfig:\n | PartialKeys<PrepareInlineConfig, \"command\">\n | PartialKeys<TypesInlineConfig, \"command\">\n | PartialKeys<NewInlineConfig, \"command\">\n | PartialKeys<CleanInlineConfig, \"command\">\n | PartialKeys<BuildInlineConfig, \"command\">\n | PartialKeys<LintInlineConfig, \"command\">\n | PartialKeys<DocsInlineConfig, \"command\">\n | PartialKeys<DeployInlineConfig, \"command\"> = { command: \"prepare\" }\n ) {\n this.context.info(\" 🏗️ Preparing the Powerlines project\");\n\n this.context.debug(\n \" Aggregating configuration options for the Powerlines project\"\n );\n\n inlineConfig.command ??= \"prepare\";\n\n await this.context.withInlineConfig(\n inlineConfig as RequiredKeys<PrepareInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n context.debug(\n `Initializing the processing options for the Powerlines project.`\n );\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"pre\"\n });\n\n await initializeTsconfig<TResolvedConfig>(context);\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"normal\"\n });\n\n if (context.entry.length > 0) {\n context.debug(\n `The configuration provided ${\n isObject(context.config.input)\n ? Object.keys(context.config.input).length\n : toArray(context.config.input).length\n } entry point(s), Powerlines has found ${\n context.entry.length\n } entry files(s) for the ${context.config.title} project${\n context.entry.length > 0 && context.entry.length < 10\n ? `: \\n${context.entry\n .map(\n entry =>\n `- ${entry.file}${\n entry.output ? ` -> ${entry.output}` : \"\"\n }`\n )\n .join(\" \\n\")}`\n : \"\"\n }`\n );\n } else {\n context.warn(\n `No entry files were found for the ${\n context.config.title\n } project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`\n );\n }\n\n await resolveTsconfig<TResolvedConfig>(context);\n await installDependencies(context);\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"post\"\n });\n\n context.trace(\n `Powerlines configuration has been resolved: \\n\\n${formatLogMessage({\n ...context.config,\n userConfig: isSetObject(context.config.userConfig)\n ? omit(context.config.userConfig, [\"plugins\"])\n : undefined,\n inlineConfig: isSetObject(context.config.inlineConfig)\n ? omit(context.config.inlineConfig, [\"plugins\"])\n : undefined,\n plugins: context.plugins.map(plugin => plugin.plugin.name)\n })}`\n );\n\n if (!context.fs.existsSync(context.cachePath)) {\n await createDirectory(context.cachePath);\n }\n\n if (!context.fs.existsSync(context.dataPath)) {\n await createDirectory(context.dataPath);\n }\n\n await this.callHook(\"prepare\", {\n environment: context,\n order: \"pre\"\n });\n await this.callHook(\"prepare\", {\n environment: context,\n order: \"normal\"\n });\n\n await this.callHook(\"prepare\", {\n environment: context,\n order: \"post\"\n });\n\n if (context.config.output.types !== false) {\n await this.#types(context);\n }\n\n this.context.debug(\"Formatting files generated during the prepare step.\");\n\n await Promise.all([\n formatFolder(context, context.builtinsPath),\n formatFolder(context, context.entryPath)\n ]);\n\n await writeMetaFile(context);\n context.persistedMeta = context.meta;\n });\n\n this.context.debug(\"✔ Powerlines preparation has completed successfully\");\n }\n\n /**\n * Create a new Powerlines project\n *\n * @remarks\n * This method will create a new Powerlines project in the current directory.\n *\n * @param inlineConfig - The inline configuration for the new command\n * @returns A promise that resolves when the project has been created\n */\n public async new(inlineConfig: PartialKeys<NewInlineConfig, \"command\">) {\n this.context.info(\" 🆕 Creating a new Powerlines project\");\n\n inlineConfig.command ??= \"new\";\n\n await this.prepare(\n inlineConfig as RequiredKeys<NewInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n context.debug(\n \"Initializing the processing options for the Powerlines project.\"\n );\n\n await this.callHook(\"new\", {\n environment: context,\n order: \"pre\"\n });\n\n const files = await listFiles(\n joinPaths(context.powerlinesPath, \"files/common/**/*.hbs\")\n );\n for (const file of files) {\n context.trace(`Adding template file to project: ${file}`);\n\n const template = Handlebars.compile(file);\n await context.fs.write(\n joinPaths(context.config.root, file.replace(\".hbs\", \"\")),\n template(context)\n );\n }\n\n await this.callHook(\"new\", {\n environment: context,\n order: \"normal\"\n });\n\n if (context.config.projectType === \"application\") {\n const files = await listFiles(\n joinPaths(context.powerlinesPath, \"files/application/**/*.hbs\")\n );\n for (const file of files) {\n context.trace(`Adding application template file: ${file}`);\n\n const template = Handlebars.compile(file);\n await context.fs.write(\n joinPaths(context.config.root, file.replace(\".hbs\", \"\")),\n template(context)\n );\n }\n } else {\n const files = await listFiles(\n joinPaths(context.powerlinesPath, \"files/library/**/*.hbs\")\n );\n for (const file of files) {\n context.trace(`Adding library template file: ${file}`);\n\n const template = Handlebars.compile(file);\n await context.fs.write(\n joinPaths(context.config.root, file.replace(\".hbs\", \"\")),\n template(context)\n );\n }\n }\n\n await this.callHook(\"new\", {\n environment: context,\n order: \"post\"\n });\n });\n\n this.context.debug(\"✔ Powerlines new command completed successfully\");\n }\n\n /**\n * Clean any previously prepared artifacts\n *\n * @remarks\n * This method will remove the previous Powerlines artifacts from the project.\n *\n * @param inlineConfig - The inline configuration for the clean command\n * @returns A promise that resolves when the clean command has completed\n */\n public async clean(\n inlineConfig:\n | PartialKeys<CleanInlineConfig, \"command\">\n | PartialKeys<PrepareInlineConfig, \"command\"> = {\n command: \"clean\"\n }\n ) {\n this.context.info(\" 🧹 Cleaning the previous Powerlines artifacts\");\n\n inlineConfig.command ??= \"clean\";\n\n await this.prepare(\n inlineConfig as RequiredKeys<CleanInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n context.debug(\"Cleaning the project's dist and artifacts directories.\");\n\n await context.fs.remove(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.output.path\n )\n );\n await context.fs.remove(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.config.output.artifactsPath\n )\n );\n\n await this.callHook(\"clean\", {\n environment: context,\n sequential: false\n });\n });\n\n this.context.debug(\"✔ Powerlines cleaning completed successfully\");\n }\n\n /**\n * Lint the project\n *\n * @param inlineConfig - The inline configuration for the lint command\n * @returns A promise that resolves when the lint command has completed\n */\n public async lint(\n inlineConfig:\n | PartialKeys<LintInlineConfig, \"command\">\n | PartialKeys<BuildInlineConfig, \"command\"> = { command: \"lint\" }\n ) {\n this.context.info(\" 📝 Linting the Powerlines project\");\n\n inlineConfig.command ??= \"lint\";\n await this.prepare(\n inlineConfig as RequiredKeys<LintInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n await this.callHook(\"lint\", {\n environment: context,\n sequential: false\n });\n });\n\n this.context.debug(\"✔ Powerlines linting completed successfully\");\n }\n\n /**\n * Build the project\n *\n * @remarks\n * This method will build the Powerlines project, generating the necessary artifacts.\n *\n * @param inlineConfig - The inline configuration for the build command\n * @returns A promise that resolves when the build command has completed\n */\n public async build(\n inlineConfig: PartialKeys<BuildInlineConfig, \"command\"> = {\n command: \"build\"\n }\n ) {\n this.context.info(\" 📦 Building the Powerlines project\");\n\n await this.context.generateChecksum();\n if (\n this.context.meta.checksum !== this.context.persistedMeta?.checksum ||\n this.context.config.skipCache\n ) {\n this.context.info(\n !this.context.persistedMeta?.checksum\n ? \"No previous build cache found. Preparing the project for the initial build.\"\n : this.context.meta.checksum !== this.context.persistedMeta.checksum\n ? \"The project has been modified since the last time `prepare` was ran. Re-preparing the project.\"\n : \"The project is configured to skip cache. Re-preparing the project.\"\n );\n\n inlineConfig.command ??= \"build\";\n\n await this.prepare(\n inlineConfig as RequiredKeys<BuildInlineConfig, \"command\">\n );\n }\n\n if (this.context.config.singleBuild) {\n await this.#handleBuild(await this.#context.toEnvironment());\n } else {\n await this.#executeEnvironments(async context => {\n await this.#handleBuild(context);\n });\n }\n\n this.context.debug(\"✔ Powerlines build completed successfully\");\n }\n\n /**\n * Prepare the documentation for the project\n *\n * @param inlineConfig - The inline configuration for the docs command\n * @returns A promise that resolves when the documentation generation has completed\n */\n public async docs(inlineConfig: DocsInlineConfig = { command: \"docs\" }) {\n this.context.info(\n \" 📓 Generating documentation for the Powerlines project\"\n );\n\n inlineConfig.command ??= \"docs\";\n await this.prepare(\n inlineConfig as RequiredKeys<DocsInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n context.debug(\n \"Writing documentation for the Powerlines project artifacts.\"\n );\n\n inlineConfig.command ??= \"docs\";\n\n await this.prepare(\n inlineConfig as RequiredKeys<DocsInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n await this.callHook(\"docs\", {\n environment: context\n });\n });\n });\n\n this.context.debug(\n \"✔ Powerlines documentation generation completed successfully\"\n );\n }\n\n /**\n * Deploy the project source code\n *\n * @remarks\n * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.\n *\n * @param inlineConfig - The inline configuration for the deploy command\n */\n public async deploy(\n inlineConfig: PartialKeys<DeployInlineConfig, \"command\"> = {\n command: \"deploy\"\n }\n ) {\n this.context.info(\" 🚀 Deploying the Powerlines project\");\n\n inlineConfig.command ??= \"deploy\";\n\n await this.prepare(\n inlineConfig as RequiredKeys<DeployInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n await this.callHook(\"deploy\", { environment: context });\n });\n\n this.context.debug(\"✔ Powerlines deploy completed successfully\");\n }\n\n /**\n * Finalization process\n *\n * @remarks\n * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.\n *\n * @returns A promise that resolves when the finalization process has completed\n */\n public async finalize() {\n this.context.info(\" 🏁 Powerlines finalization processes started\");\n\n await this.#executeEnvironments(async context => {\n await this.callHook(\"finalize\", { environment: context });\n await context.fs.dispose();\n\n if (\n existsSync(context.cachePath) &&\n !(await listFiles(joinPaths(context.cachePath, \"**/*\")))?.length\n ) {\n await removeDirectory(context.cachePath);\n }\n });\n\n this.context.debug(\"✔ Powerlines finalization completed successfully\");\n }\n\n /**\n * Invokes the configured plugin hooks\n *\n * @remarks\n * By default, it will call the `\"pre\"`, `\"normal\"`, and `\"post\"` ordered hooks in sequence\n *\n * @param hook - The hook to call\n * @param options - The options to provide to the hook\n * @param args - The arguments to pass to the hook\n * @returns The result of the hook call\n */\n public async callHook<TKey extends string>(\n hook: TKey,\n options: CallHookOptions & {\n environment?: string | EnvironmentContext<TResolvedConfig>;\n },\n ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey>\n ) {\n return callHook<TResolvedConfig, TKey>(\n isSetObject(options?.environment)\n ? options.environment\n : await this.#context.getEnvironment(options?.environment),\n hook,\n { sequential: true, ...options },\n ...args\n );\n }\n\n /**\n * Dispose of the Powerlines API instance\n *\n * @remarks\n * This method will finalize the Powerlines API instance, cleaning up any resources used.\n */\n public async [Symbol.asyncDispose]() {\n await this.finalize();\n }\n\n async #handleBuild(context: EnvironmentContext<TResolvedConfig>) {\n await this.callHook(\"build\", {\n environment: context,\n order: \"pre\"\n });\n\n context.debug(\n \"Formatting the generated entry files before the build process starts.\"\n );\n await formatFolder(context, context.entryPath);\n\n await this.callHook(\"build\", {\n environment: context,\n order: \"normal\"\n });\n\n if (context.config.output.copy) {\n context.debug(\"Copying project's files from build output directory.\");\n\n const destinationPath = isParentPath(\n appendPath(\n context.config.output.path,\n context.workspaceConfig.workspaceRoot\n ),\n appendPath(context.config.root, context.workspaceConfig.workspaceRoot)\n )\n ? joinPaths(\n context.config.output.copy.path,\n relativePath(\n appendPath(\n context.config.root,\n context.workspaceConfig.workspaceRoot\n ),\n appendPath(\n context.config.output.path,\n context.workspaceConfig.workspaceRoot\n )\n )\n )\n : joinPaths(context.config.output.copy.path, \"dist\");\n const sourcePath = appendPath(\n context.config.output.path,\n context.workspaceConfig.workspaceRoot\n );\n\n if (existsSync(sourcePath) && sourcePath !== destinationPath) {\n context.debug(\n `Copying files from project's build output directory (${\n context.config.output.path\n }) to the project's copy/publish directory (${destinationPath}).`\n );\n\n await copyFiles(sourcePath, destinationPath);\n } else {\n context.warn(\n `The source path for the copy operation ${\n !existsSync(sourcePath)\n ? \"does not exist\"\n : \"is the same as the destination path\"\n }. Source: ${sourcePath}, Destination: ${\n destinationPath\n }. Skipping copying of build output files.`\n );\n }\n\n if (\n context.config.output.copy.assets &&\n Array.isArray(context.config.output.copy.assets)\n ) {\n await Promise.all(\n context.config.output.copy.assets.map(async asset => {\n context.trace(\n `Copying asset(s): ${chalk.redBright(\n context.workspaceConfig.workspaceRoot === asset.input\n ? asset.glob\n : appendPath(\n asset.glob,\n replacePath(\n asset.input,\n context.workspaceConfig.workspaceRoot\n )\n )\n )} -> ${chalk.greenBright(\n appendPath(\n asset.glob,\n replacePath(\n asset.output,\n context.workspaceConfig.workspaceRoot\n )\n )\n )} ${\n Array.isArray(asset.ignore) && asset.ignore.length > 0\n ? ` (ignoring: ${asset.ignore\n .map(i => chalk.yellowBright(i))\n .join(\", \")})`\n : \"\"\n }`\n );\n\n await context.fs.copy(asset, asset.output);\n })\n );\n }\n } else {\n context.debug(\n \"No copy configuration found for the project output. Skipping the copying of build output files.\"\n );\n }\n\n await this.callHook(\"build\", {\n environment: context,\n order: \"post\"\n });\n }\n\n /**\n * Get the configured environments\n *\n * @returns The configured environments\n */\n async #getEnvironments() {\n if (\n !this.context.config.environments ||\n Object.keys(this.context.config.environments).length <= 1\n ) {\n this.context.debug(\n \"No environments are configured for this Powerlines project. Using the default environment.\"\n );\n\n return [await this.context.getEnvironment()];\n }\n\n this.context.debug(\n `Found ${Object.keys(this.context.config.environments).length} configured environment(s) for this Powerlines project.`\n );\n\n return (\n await Promise.all(\n Object.entries(this.context.config.environments).map(\n async ([name, config]) => {\n const environment = await this.context.getEnvironmentSafe(name);\n if (!environment) {\n const resolvedEnvironment = await this.callHook(\n \"configEnvironment\",\n {\n environment: name\n },\n name,\n config\n );\n\n if (resolvedEnvironment) {\n this.context.environments[name] = await this.context.in(\n resolvedEnvironment as EnvironmentResolvedConfig\n );\n }\n }\n\n return this.context.environments[name];\n }\n )\n )\n ).filter(context => isSet(context));\n }\n\n /**\n * Execute a handler function for each environment\n *\n * @param handle - The handler function to execute for each environment\n */\n async #executeEnvironments(\n handle: (context: EnvironmentContext<TResolvedConfig>) => MaybePromise<void>\n ) {\n await Promise.all(\n (await this.#getEnvironments()).map(async context => {\n return Promise.resolve(handle(context));\n })\n );\n }\n\n /**\n * Add a Powerlines plugin used in the build process\n *\n * @param config - The import path of the plugin to add\n */\n async #addPlugin(config: PluginConfig<PluginContext<TResolvedConfig>>) {\n if (config) {\n const result = await this.#initPlugin(config);\n if (!result) {\n return;\n }\n\n for (const plugin of result) {\n this.context.debug(\n `Successfully initialized the ${chalk.bold.cyanBright(\n plugin.name\n )} plugin`\n );\n\n await this.context.addPlugin(plugin);\n }\n }\n }\n\n /**\n * Initialize a Powerlines plugin\n *\n * @param config - The configuration for the plugin\n * @returns The initialized plugin instance, or null if the plugin was a duplicate\n * @throws Will throw an error if the plugin cannot be found or is invalid\n */\n async #initPlugin(\n config: PluginConfig<PluginContext<TResolvedConfig>>\n ): Promise<Plugin<PluginContext<TResolvedConfig>>[] | null> {\n let awaited = config;\n if (isPromiseLike(config)) {\n awaited = (await Promise.resolve(config as Promise<any>)) as PluginConfig<\n PluginContext<TResolvedConfig>\n >;\n }\n\n if (!isPluginConfig<PluginContext<TResolvedConfig>>(awaited)) {\n const invalid = findInvalidPluginConfig(awaited);\n\n throw new Error(\n `Invalid ${\n invalid && invalid.length > 1 ? \"plugins\" : \"plugin\"\n } specified in the configuration - ${\n invalid && invalid.length > 0\n ? JSON.stringify(awaited)\n : invalid?.join(\"\\n\\n\")\n } \\n\\nPlease ensure the value is one of the following: \\n - an instance of \\`Plugin\\` \\n - a plugin name \\n - an object with the \\`plugin\\` and \\`options\\` properties \\n - a tuple array with the plugin and options \\n - a factory function that returns a plugin or array of plugins \\n - an array of plugins or plugin configurations`\n );\n }\n\n let plugins!: Plugin<PluginContext<TResolvedConfig>>[];\n if (isPlugin<PluginContext<TResolvedConfig>>(awaited)) {\n plugins = [awaited];\n } else if (isFunction(awaited)) {\n plugins = toArray(await Promise.resolve(awaited()));\n } else if (isString(awaited)) {\n const resolved = await this.#resolvePlugin(awaited);\n if (isFunction(resolved)) {\n plugins = toArray(await Promise.resolve(resolved()));\n } else {\n plugins = toArray(resolved);\n }\n } else if (\n Array.isArray(awaited) &&\n (awaited as PluginContext<TResolvedConfig>[]).every(\n isPlugin<PluginContext<TResolvedConfig>>\n )\n ) {\n plugins = awaited as Plugin<PluginContext<TResolvedConfig>>[];\n } else if (\n Array.isArray(awaited) &&\n (awaited as PluginConfig<PluginContext<TResolvedConfig>>[]).every(\n isPluginConfig<PluginContext<TResolvedConfig>>\n )\n ) {\n plugins = [];\n for (const pluginConfig of awaited as PluginConfig<\n PluginContext<TResolvedConfig>\n >[]) {\n const initialized = await this.#initPlugin(pluginConfig);\n if (initialized) {\n plugins.push(...initialized);\n }\n }\n } else if (\n isPluginConfigTuple<PluginContext<TResolvedConfig>>(awaited) ||\n isPluginConfigObject<PluginContext<TResolvedConfig>>(awaited)\n ) {\n let pluginConfig!:\n | string\n | PluginFactory<PluginContext<TResolvedConfig>>\n | Plugin<PluginContext<TResolvedConfig>>;\n let pluginOptions: any;\n\n if (isPluginConfigTuple<PluginContext<TResolvedConfig>>(awaited)) {\n pluginConfig = awaited[0] as Plugin<PluginContext<TResolvedConfig>>;\n pluginOptions =\n (awaited as PluginConfigTuple)?.length === 2 ? awaited[1] : undefined;\n } else {\n pluginConfig = (awaited as PluginConfigObject).plugin as Plugin<\n PluginContext<TResolvedConfig>\n >;\n pluginOptions = (awaited as PluginConfigObject).options;\n }\n\n if (isSetString(pluginConfig)) {\n const resolved = await this.#resolvePlugin(pluginConfig);\n if (isFunction(resolved)) {\n plugins = toArray(\n await Promise.resolve(\n pluginOptions ? resolved(pluginOptions) : resolved()\n )\n );\n } else {\n plugins = toArray(resolved);\n }\n } else if (isFunction(pluginConfig)) {\n plugins = toArray(await Promise.resolve(pluginConfig(pluginOptions)));\n } else if (\n Array.isArray(pluginConfig) &&\n pluginConfig.every(isPlugin<PluginContext<TResolvedConfig>>)\n ) {\n plugins = pluginConfig;\n } else if (isPlugin<PluginContext<TResolvedConfig>>(pluginConfig)) {\n plugins = toArray(pluginConfig);\n }\n }\n\n if (!plugins) {\n throw new Error(\n `The plugin configuration ${JSON.stringify(awaited)} is invalid. This configuration must point to a valid Powerlines plugin module.`\n );\n }\n\n if (\n plugins.length > 0 &&\n !plugins.every(isPlugin<PluginContext<TResolvedConfig>>)\n ) {\n throw new Error(\n `The plugin option ${JSON.stringify(plugins)} does not export a valid module. This configuration must point to a valid Powerlines plugin module.`\n );\n }\n\n const result = [] as Plugin<PluginContext<TResolvedConfig>>[];\n for (const plugin of plugins) {\n if (checkDedupe<TResolvedConfig>(plugin, this.context.plugins)) {\n this.context.trace(\n `Duplicate ${chalk.bold.cyanBright(\n plugin.name\n )} plugin dependency detected - Skipping initialization.`\n );\n } else {\n result.push(plugin);\n\n this.context.trace(\n `Initializing the ${chalk.bold.cyanBright(plugin.name)} plugin...`\n );\n }\n }\n\n return result;\n }\n\n async #resolvePlugin<TOptions>(\n pluginPath: string\n ): Promise<\n | Plugin<PluginContext<TResolvedConfig>>\n | Plugin<PluginContext<TResolvedConfig>>[]\n | ((\n options?: TOptions\n ) => MaybePromise<\n | Plugin<PluginContext<TResolvedConfig>>\n | Plugin<PluginContext<TResolvedConfig>>[]\n >)\n > {\n if (\n pluginPath.startsWith(\"@\") &&\n pluginPath.split(\"/\").filter(Boolean).length > 2\n ) {\n const splits = pluginPath.split(\"/\").filter(Boolean);\n pluginPath = `${splits[0]}/${splits[1]}`;\n }\n\n const isInstalled = isPackageExists(pluginPath, {\n paths: [\n this.context.workspaceConfig.workspaceRoot,\n this.context.config.root\n ]\n });\n if (!isInstalled && this.context.config.autoInstall) {\n this.#context.warn(\n `The plugin package \"${\n pluginPath\n }\" is not installed. It will be installed automatically.`\n );\n\n const result = await install(pluginPath, {\n cwd: this.context.config.root\n });\n if (isNumber(result.exitCode) && result.exitCode > 0) {\n this.#context.error(result.stderr);\n\n throw new Error(\n `An error occurred while installing the build plugin package \"${\n pluginPath\n }\" `\n );\n }\n }\n\n try {\n // First check if the package has a \"plugin\" subdirectory - @scope/package/plugin\n const module = await this.context.resolver.plugin.import<{\n plugin?:\n | Plugin<PluginContext<TResolvedConfig>>\n | ((\n options?: TOptions\n ) => MaybePromise<Plugin<PluginContext<TResolvedConfig>>>);\n default?:\n | Plugin<PluginContext<TResolvedConfig>>\n | ((\n options?: TOptions\n ) => MaybePromise<Plugin<PluginContext<TResolvedConfig>>>);\n }>(\n this.context.resolver.plugin.esmResolve(joinPaths(pluginPath, \"plugin\"))\n );\n\n const result = module.plugin ?? module.default;\n if (!result) {\n throw new Error(\n `The plugin package \"${pluginPath}\" does not export a valid module.`\n );\n }\n\n return result;\n } catch (error) {\n try {\n const module = await this.context.resolver.plugin.import<{\n plugin?:\n | Plugin<PluginContext<TResolvedConfig>>\n | ((\n options?: TOptions\n ) => MaybePromise<Plugin<PluginContext<TResolvedConfig>>>);\n default?:\n | Plugin<PluginContext<TResolvedConfig>>\n | ((\n options?: TOptions\n ) => MaybePromise<Plugin<PluginContext<TResolvedConfig>>>);\n }>(this.context.resolver.plugin.esmResolve(pluginPath));\n\n const result = module.plugin ?? module.default;\n if (!result) {\n throw new Error(\n `The plugin package \"${pluginPath}\" does not export a valid module.`\n );\n }\n\n return result;\n } catch {\n if (!isInstalled) {\n throw new Error(\n `The plugin package \"${\n pluginPath\n }\" is not installed. Please install the package using the command: \"npm install ${\n pluginPath\n } --save-dev\"`\n );\n } else {\n throw new Error(\n `An error occurred while importing the build plugin package \"${\n pluginPath\n }\":\n${isError(error) ? error.message : String(error)}\n\nNote: Please ensure the plugin package's default export is a class that extends \\`Plugin\\` with a constructor that excepts a single arguments of type \\`PluginOptions\\`.`\n );\n }\n }\n }\n }\n\n /**\n * Generate the Powerlines TypeScript declaration file\n *\n * @remarks\n * This method will generate the TypeScript declaration file for the Powerlines project, including any types provided by plugins.\n *\n * @param context - The environment context to use for generating the TypeScript declaration file\n * @returns A promise that resolves when the TypeScript declaration file has been generated\n */\n async #types(context: EnvironmentContext<TResolvedConfig>) {\n context.debug(\n `Preparing the TypeScript definitions for the Powerlines project.`\n );\n\n if (context.fs.existsSync(context.typesPath)) {\n await context.fs.remove(context.typesPath);\n }\n\n const typescriptPath = await resolvePackage(\"typescript\");\n if (!typescriptPath) {\n throw new Error(\n \"Could not resolve TypeScript package location. Please ensure TypeScript is installed.\"\n );\n }\n\n context.debug(\n \"Running TypeScript compiler for built-in runtime module files.\"\n );\n\n let { code, directives } = await emitBuiltinTypes(\n context,\n (await context.getBuiltins()).reduce<string[]>((ret, builtin) => {\n const formatted = replacePath(\n builtin.path,\n context.workspaceConfig.workspaceRoot\n );\n if (!ret.includes(formatted)) {\n ret.push(formatted);\n }\n\n return ret;\n }, [])\n );\n\n context.debug(\n `Generating TypeScript declaration file ${context.typesPath}.`\n );\n\n const merge = async (\n currentResult: string | TypesResult,\n previousResult: string | TypesResult\n ): Promise<string | TypesResult> => {\n if (\n !isSetString(currentResult) &&\n !isSetObject(currentResult) &&\n !isSetString(previousResult) &&\n !isSetObject(previousResult)\n ) {\n return { code, directives };\n }\n\n const previous = (\n await format(\n context,\n context.typesPath,\n isSetString(previousResult)\n ? previousResult\n : isSetObject(previousResult)\n ? previousResult.code\n : \"\"\n )\n )\n .trim()\n .replace(code, \"\")\n .trim();\n const current = (\n await format(\n context,\n context.typesPath,\n isSetString(currentResult)\n ? currentResult\n : isSetObject(currentResult)\n ? currentResult.code\n : \"\"\n )\n )\n .trim()\n .replace(previous, \"\")\n .trim()\n .replace(code, \"\")\n .trim();\n\n return {\n directives: [\n ...(isSetObject(currentResult) && currentResult.directives\n ? currentResult.directives\n : []),\n ...(isSetObject(previousResult) && previousResult.directives\n ? previousResult.directives\n : [])\n ],\n code: await format(\n context,\n context.typesPath,\n `${\n !previous.includes(getTypescriptFileHeader(context)) &&\n !current.includes(getTypescriptFileHeader(context))\n ? `${code}\\n`\n : \"\"\n }${previous}\\n${current}`.trim()\n )\n };\n };\n const asNextParam = (\n previousResult: string | TypesResult | null | undefined\n ) => (isObject(previousResult) ? previousResult.code : previousResult);\n\n let result = await this.callHook(\n \"types\",\n {\n environment: context,\n sequential: true,\n order: \"pre\",\n result: \"merge\",\n merge,\n asNextParam\n },\n code\n );\n if (result) {\n if (isSetObject(result)) {\n code = result.code;\n if (Array.isArray(result.directives) && result.directives.length > 0) {\n directives = getUnique([...directives, ...result.directives]).filter(\n Boolean\n );\n }\n } else if (isSetString(result)) {\n code = result;\n }\n }\n\n result = await this.callHook(\n \"types\",\n {\n environment: context,\n sequential: true,\n order: \"normal\",\n result: \"merge\",\n merge,\n asNextParam\n },\n code\n );\n if (result) {\n if (isSetObject(result)) {\n code = result.code;\n if (Array.isArray(result.directives) && result.directives.length > 0) {\n directives = getUnique([...directives, ...result.directives]).filter(\n Boolean\n );\n }\n } else if (isSetString(result)) {\n code = result;\n }\n }\n\n result = await this.callHook(\n \"types\",\n {\n environment: context,\n sequential: true,\n order: \"post\",\n result: \"merge\",\n merge,\n asNextParam\n },\n code\n );\n if (result) {\n if (isSetObject(result)) {\n code = result.code;\n if (Array.isArray(result.directives) && result.directives.length > 0) {\n directives = getUnique([...directives, ...result.directives]).filter(\n Boolean\n );\n }\n } else if (isSetString(result)) {\n code = result;\n }\n }\n\n if (isSetString(code?.trim()) || directives.length > 0) {\n await context.fs.write(\n context.typesPath,\n `${\n directives.length > 0\n ? `${directives.map(directive => `/// <reference types=\"${directive}\" />`).join(\"\\n\")}\n\n`\n : \"\"\n }${getTypescriptFileHeader(context, { directive: null, prettierIgnore: false })}\n\n${formatTypes(code)}\n`\n );\n }\n\n // else {\n // const dtsRelativePath = getTsconfigDtsPath(context);\n // if (\n // context.tsconfig.tsconfigJson.include &&\n // isIncludeMatchFound(\n // dtsRelativePath,\n // context.tsconfig.tsconfigJson.include\n // )\n // ) {\n // const normalizedDtsRelativePath = dtsRelativePath.startsWith(\"./\")\n // ? dtsRelativePath.slice(2)\n // : dtsRelativePath;\n // context.tsconfig.tsconfigJson.include =\n // context.tsconfig.tsconfigJson.include.filter(\n // includeValue =>\n // includeValue?.toString() !== normalizedDtsRelativePath\n // );\n\n // await context.fs.write(\n // context.tsconfig.tsconfigFilePath,\n // JSON.stringify(context.tsconfig.tsconfigJson, null, 2)\n // );\n // }\n // }\n\n // // Re-resolve the tsconfig to ensure it is up to date\n // context.tsconfig = getParsedTypeScriptConfig(\n // context.workspaceConfig.workspaceRoot,\n // context.config.root,\n // context.config.tsconfig\n // );\n // if (!context.tsconfig) {\n // throw new Error(\"Failed to parse the TypeScript configuration file.\");\n // }\n }\n}\n"],"x_google_ignoreList":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;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