{"version":3,"file":"core.cjs","names":["fs","path"],"sources":["../src/core.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nexport type Confidence = 'high' | 'medium' | 'low' | 'generated';\n\nexport interface SourceMapInfo {\n  path: string;\n  sources: string[];\n  sourcesContent: string[];\n  names: string[];\n}\n\nexport interface WxmlUsage {\n  index: number;\n  snippet: string;\n}\n\nexport interface TemplateAttribute {\n  name: string;\n  value: string;\n}\n\nexport interface TemplateNode {\n  id: string;\n  tag: string;\n  kind: 'element' | 'component' | 'text';\n  snippet: string;\n  keyRefs: string[];\n  attrs: TemplateAttribute[];\n  text: string | null;\n  children: TemplateNode[];\n}\n\nexport interface KeyMapItem {\n  key: string;\n  sourceName: string | null;\n  generatedName: string | null;\n  kind: string;\n  confidence: Confidence;\n  expressionSummary: string;\n  expression: string;\n  wxmlUsages: WxmlUsage[];\n}\n\nexport interface PageAnalysis {\n  page: string;\n  jsFile: string;\n  wxmlFile: string | null;\n  sourceMap: SourceMapInfo | null;\n  keys: KeyMapItem[];\n  templateTree: TemplateNode | null;\n}\n\nexport interface ProjectAnalysis {\n  tool: 'uniappx-keymap-devtools';\n  version: string;\n  targetRoot: string;\n  generatedAt: string;\n  pages: Record<string, PageAnalysis>;\n}\n\ninterface GeneratedPattern {\n  re: RegExp;\n  name: string;\n  kind: string;\n}\n\ninterface ParsedProperty {\n  key: string;\n  expression: string;\n}\n\ninterface InferredExpression {\n  sourceName: string | null;\n  generatedName: string | null;\n  kind: string;\n  confidence: Confidence;\n  expressionSummary: string;\n}\n\nconst TEMPLATE_EXTENSIONS = ['.wxml'];\nconst NATIVE_TEMPLATE_TAGS = new Set([\n  'view',\n  'text',\n  'image',\n  'button',\n  'input',\n  'textarea',\n  'scroll-view',\n  'swiper',\n  'swiper-item',\n  'icon',\n  'progress',\n  'rich-text',\n  'checkbox',\n  'checkbox-group',\n  'radio',\n  'radio-group',\n  'switch',\n  'slider',\n  'picker',\n  'picker-view',\n  'picker-view-column',\n  'navigator',\n  'form',\n  'label',\n  'map',\n  'canvas',\n  'camera',\n  'video',\n  'live-player',\n  'live-pusher',\n  'movable-area',\n  'movable-view',\n  'cover-view',\n  'cover-image',\n  'slot',\n  'block',\n  'template',\n  'ad',\n  'open-data',\n  'official-account',\n  'editor',\n  'page-meta',\n  'navigation-bar',\n  'match-media',\n  'sticky-section',\n  'sticky-header',\n]);\n\nconst GENERATED_PATTERNS: GeneratedPattern[] = [\n  {\n    re: /\\bsei\\s*\\(\\s*common_vendor\\.gei|common_vendor\\.sei\\s*\\(\\s*common_vendor\\.gei|\\bgei\\s*\\(/,\n    name: 'generated element id',\n    kind: 'element-id',\n  },\n  { re: /common_assets\\._imports_\\d+|\\b_imports_\\d+\\b/, name: 'generated static asset', kind: 'static-asset' },\n  { re: /u_s_b_h/, name: 'generated CSS var --status-bar-height', kind: 'css-var' },\n  { re: /u_s_a_i_b/, name: 'generated CSS var --uni-safe-area-inset-bottom', kind: 'css-var' },\n  { re: /virtualHostClass/, name: 'generated virtualHostClass', kind: 'virtual-host-class' },\n  { re: /virtualHostStyle/, name: 'generated virtualHostStyle', kind: 'virtual-host-style' },\n  { re: /virtualHostHidden/, name: 'generated virtualHostHidden', kind: 'virtual-host-hidden' },\n];\n\nfunction walkFiles(root: string, predicate?: (file: string) => boolean): string[] {\n  const output: string[] = [];\n  function walk(dir: string): void {\n    if (!fs.existsSync(dir)) return;\n    for (const name of fs.readdirSync(dir)) {\n      const full = path.join(dir, name);\n      const stat = fs.statSync(full);\n      if (stat.isDirectory()) walk(full);\n      else if (!predicate || predicate(full)) output.push(full);\n    }\n  }\n  walk(root);\n  return output;\n}\n\nfunction normalizeSlashes(value: string): string {\n  return value.split(path.sep).join('/');\n}\n\nfunction stripJsComments(input: string): string {\n  let output = '';\n  let state: 'normal' | 'line' | 'block' | '\"' | \"'\" | '`' = 'normal';\n\n  for (let index = 0; index < input.length; index += 1) {\n    const ch = input[index];\n    const next = input[index + 1];\n\n    if (state === 'normal') {\n      if (ch === '/' && next === '/') {\n        state = 'line';\n        output += '  ';\n        index += 1;\n      } else if (ch === '/' && next === '*') {\n        state = 'block';\n        output += '  ';\n        index += 1;\n      } else if (ch === '\"' || ch === \"'\" || ch === '`') {\n        state = ch;\n        output += ch;\n      } else {\n        output += ch;\n      }\n    } else if (state === 'line') {\n      if (ch === '\\n') {\n        state = 'normal';\n        output += ch;\n      } else {\n        output += ' ';\n      }\n    } else if (state === 'block') {\n      if (ch === '*' && next === '/') {\n        state = 'normal';\n        output += '  ';\n        index += 1;\n      } else {\n        output += ch === '\\n' ? '\\n' : ' ';\n      }\n    } else {\n      output += ch;\n      if (ch === '\\\\') {\n        index += 1;\n        output += input[index] || '';\n      } else if (ch === state) {\n        state = 'normal';\n      }\n    }\n  }\n  return output;\n}\n\nfunction findMatchingBrace(input: string, openIndex: number): number {\n  let depth = 0;\n  let state: 'normal' | '\"' | \"'\" | '`' = 'normal';\n\n  for (let index = openIndex; index < input.length; index += 1) {\n    const ch = input[index];\n    if (state === 'normal') {\n      if (ch === '\"' || ch === \"'\" || ch === '`') state = ch;\n      else if (ch === '{') depth += 1;\n      else if (ch === '}') {\n        depth -= 1;\n        if (depth === 0) return index;\n      }\n    } else if (ch === '\\\\') {\n      index += 1;\n    } else if (ch === state) {\n      state = 'normal';\n    }\n  }\n  return -1;\n}\n\nexport function extractReturnedObject(js: string): string | null {\n  const marker = 'const __returned__ =';\n  const start = js.indexOf(marker);\n  if (start !== -1) {\n    const open = js.indexOf('{', start + marker.length);\n    if (open === -1) return null;\n    const close = findMatchingBrace(js, open);\n    if (close === -1) return null;\n    return js.slice(open + 1, close);\n  }\n  return extractRenderReturnObject(js) || extractSetupRenderReturnObject(js);\n}\n\nfunction extractRenderReturnObject(js: string): string | null {\n  const marker = 'function _sfc_render';\n  const start = js.indexOf(marker);\n  if (start === -1) return null;\n\n  const open = js.indexOf('{', start + marker.length);\n  if (open === -1) return null;\n  const close = findMatchingBrace(js, open);\n  if (close === -1) return null;\n\n  const body = js.slice(open + 1, close);\n  let state: 'normal' | '\"' | \"'\" | '`' = 'normal';\n  let depthParen = 0;\n  let depthBracket = 0;\n  let depthBrace = 0;\n\n  for (let index = 0; index < body.length; index += 1) {\n    const ch = body[index];\n    if (state === 'normal') {\n      if (ch === '\"' || ch === \"'\" || ch === '`') {\n        state = ch;\n      } else if (ch === '(') {\n        depthParen += 1;\n      } else if (ch === ')') {\n        depthParen -= 1;\n      } else if (ch === '[') {\n        depthBracket += 1;\n      } else if (ch === ']') {\n        depthBracket -= 1;\n      } else if (ch === '{') {\n        depthBrace += 1;\n      } else if (ch === '}') {\n        depthBrace -= 1;\n      } else if (\n        depthParen === 0 &&\n        depthBracket === 0 &&\n        depthBrace === 0 &&\n        body.startsWith('return', index) &&\n        !/[A-Za-z0-9_$]/.test(body[index - 1] || '') &&\n        !/[A-Za-z0-9_$]/.test(body[index + 6] || '')\n      ) {\n        let probe = index + 6;\n        while (/\\s/.test(body[probe] || '')) probe += 1;\n        if (body[probe] !== '{') return null;\n        const returnClose = findMatchingBrace(body, probe);\n        if (returnClose === -1) return null;\n        return body.slice(probe + 1, returnClose);\n      }\n    } else if (ch === '\\\\') {\n      index += 1;\n    } else if (ch === state) {\n      state = 'normal';\n    }\n  }\n\n  return null;\n}\n\nfunction extractSetupRenderReturnObject(js: string): string | null {\n  const re = /return\\s*\\([^)]*\\)\\s*=>\\s*\\{/g;\n  let match: RegExpExecArray | null = re.exec(js);\n\n  while (match) {\n    const currentMatch = match;\n    match = re.exec(js);\n    const open = js.indexOf('{', currentMatch.index);\n    if (open === -1) continue;\n    const close = findMatchingBrace(js, open);\n    if (close === -1) continue;\n    const body = js.slice(open + 1, close);\n    const returned = extractTopLevelReturnObject(body);\n    if (returned) return returned;\n  }\n\n  return null;\n}\n\nfunction extractTopLevelReturnObject(body: string): string | null {\n  let state: 'normal' | '\"' | \"'\" | '`' = 'normal';\n  let depthParen = 0;\n  let depthBracket = 0;\n  let depthBrace = 0;\n\n  for (let index = 0; index < body.length; index += 1) {\n    const ch = body[index];\n    if (state === 'normal') {\n      if (ch === '\"' || ch === \"'\" || ch === '`') {\n        state = ch;\n      } else if (ch === '(') {\n        depthParen += 1;\n      } else if (ch === ')') {\n        depthParen -= 1;\n      } else if (ch === '[') {\n        depthBracket += 1;\n      } else if (ch === ']') {\n        depthBracket -= 1;\n      } else if (ch === '{') {\n        depthBrace += 1;\n      } else if (ch === '}') {\n        depthBrace -= 1;\n      } else if (\n        depthParen === 0 &&\n        depthBracket === 0 &&\n        depthBrace === 0 &&\n        body.startsWith('return', index) &&\n        !/[A-Za-z0-9_$]/.test(body[index - 1] || '') &&\n        !/[A-Za-z0-9_$]/.test(body[index + 6] || '')\n      ) {\n        let probe = index + 6;\n        while (/\\s/.test(body[probe] || '')) probe += 1;\n        if (body[probe] !== '{') continue;\n        const returnClose = findMatchingBrace(body, probe);\n        if (returnClose === -1) return null;\n        return body.slice(probe + 1, returnClose);\n      }\n    } else if (ch === '\\\\') {\n      index += 1;\n    } else if (ch === state) {\n      state = 'normal';\n    }\n  }\n\n  return null;\n}\n\nexport function splitTopLevelProperties(body: string): string[] {\n  const props: string[] = [];\n  let state: 'normal' | '\"' | \"'\" | '`' = 'normal';\n  let depthParen = 0;\n  let depthBrace = 0;\n  let depthBracket = 0;\n  let start = 0;\n\n  function push(end: number): void {\n    const part = body.slice(start, end).trim();\n    if (part) props.push(part);\n    start = end + 1;\n  }\n\n  for (let index = 0; index < body.length; index += 1) {\n    const ch = body[index];\n    if (state === 'normal') {\n      if (ch === '\"' || ch === \"'\" || ch === '`') state = ch;\n      else if (ch === '(') depthParen += 1;\n      else if (ch === ')') depthParen -= 1;\n      else if (ch === '{') depthBrace += 1;\n      else if (ch === '}') depthBrace -= 1;\n      else if (ch === '[') depthBracket += 1;\n      else if (ch === ']') depthBracket -= 1;\n      else if (ch === ',' && depthParen === 0 && depthBrace === 0 && depthBracket === 0) push(index);\n    } else if (ch === '\\\\') {\n      index += 1;\n    } else if (ch === state) {\n      state = 'normal';\n    }\n  }\n  push(body.length);\n  return props;\n}\n\nexport function parseProperty(part: string): ParsedProperty | null {\n  let state: 'normal' | '\"' | \"'\" | '`' = 'normal';\n  let depthParen = 0;\n  let depthBrace = 0;\n  let depthBracket = 0;\n\n  for (let index = 0; index < part.length; index += 1) {\n    const ch = part[index];\n    if (state === 'normal') {\n      if (ch === '\"' || ch === \"'\" || ch === '`') state = ch;\n      else if (ch === '(') depthParen += 1;\n      else if (ch === ')') depthParen -= 1;\n      else if (ch === '{') depthBrace += 1;\n      else if (ch === '}') depthBrace -= 1;\n      else if (ch === '[') depthBracket += 1;\n      else if (ch === ']') depthBracket -= 1;\n      else if (ch === ':' && depthParen === 0 && depthBrace === 0 && depthBracket === 0) {\n        const rawKey = part.slice(0, index).trim();\n        const key = rawKey.replace(/^['\"]|['\"]$/g, '');\n        return { key, expression: part.slice(index + 1).trim() };\n      }\n    } else if (ch === '\\\\') {\n      index += 1;\n    } else if (ch === state) {\n      state = 'normal';\n    }\n  }\n  return null;\n}\n\nfunction extractSetupBindings(js: string): Set<string> {\n  const names = new Set<string>();\n  const blocked = new Set(['__returned__', 'common_vendor', '_sfc_main']);\n  const variableRe = /\\b(?:const|let|var)\\s+([A-Za-z_$][\\w$]*)\\b/g;\n  const functionRe = /\\bfunction\\s+([A-Za-z_$][\\w$]*)\\s*\\(/g;\n  let match: RegExpExecArray | null = variableRe.exec(js);\n\n  while (match) {\n    if (!blocked.has(match[1])) names.add(match[1]);\n    match = variableRe.exec(js);\n  }\n  match = functionRe.exec(js);\n  while (match) {\n    if (!blocked.has(match[1])) names.add(match[1]);\n    match = functionRe.exec(js);\n  }\n  return names;\n}\n\nexport function inferFromExpression(expression: string, setupBindings: Set<string>): InferredExpression {\n  const normalized = expression.replace(/\\s+/g, ' ');\n  for (const item of GENERATED_PATTERNS) {\n    if (item.re.test(expression)) {\n      return {\n        sourceName: null,\n        generatedName: item.name,\n        kind: item.kind,\n        confidence: 'generated',\n        expressionSummary: normalized,\n      };\n    }\n  }\n\n  const eventMatch = expression.match(/(?:\\bcommon_vendor\\.)?\\bo\\s*\\(/);\n  if (eventMatch) {\n    return {\n      sourceName: inferEventSourceName(expression),\n      generatedName: 'event handler',\n      kind: 'event-handler',\n      confidence: 'high',\n      expressionSummary: normalized,\n    };\n  }\n\n  const unrefMatch = expression.match(/(?:common_vendor\\.)?unref\\s*\\(\\s*([A-Za-z_$][\\w$]*)\\s*\\)/);\n  if (unrefMatch) {\n    return {\n      sourceName: unrefMatch[1],\n      generatedName: null,\n      kind: 'binding',\n      confidence: 'high',\n      expressionSummary: normalized,\n    };\n  }\n\n  const refValueMatch = expression.match(/\\b([A-Za-z_$][\\w$]*)\\.value\\b/);\n  if (refValueMatch && setupBindings.has(refValueMatch[1])) {\n    return {\n      sourceName: refValueMatch[1],\n      generatedName: null,\n      kind: 'binding',\n      confidence: 'high',\n      expressionSummary: normalized,\n    };\n  }\n\n  const instanceValueMatch = expression.match(/\\$(?:data|setup|props|options)\\.([A-Za-z_$][\\w$]*)/);\n  if (instanceValueMatch) {\n    return {\n      sourceName: instanceValueMatch[1],\n      generatedName: null,\n      kind: 'binding',\n      confidence: 'high',\n      expressionSummary: normalized,\n    };\n  }\n\n  const directNames: string[] = [];\n  for (const name of setupBindings) {\n    const re = new RegExp(`(^|[^\\\\w$])${escapeRegExp(name)}([^\\\\w$]|$)`);\n    if (re.test(expression)) directNames.push(name);\n  }\n\n  if (directNames.length === 1) {\n    return {\n      sourceName: directNames[0],\n      generatedName: null,\n      kind: 'binding',\n      confidence: 'medium',\n      expressionSummary: normalized,\n    };\n  }\n\n  if (directNames.length > 1) {\n    return {\n      sourceName: directNames.join(', '),\n      generatedName: null,\n      kind: 'expression',\n      confidence: 'medium',\n      expressionSummary: normalized,\n    };\n  }\n\n  return {\n    sourceName: null,\n    generatedName: null,\n    kind: 'unknown',\n    confidence: 'low',\n    expressionSummary: normalized,\n  };\n}\n\nfunction inferEventSourceName(expression: string): string | null {\n  const directMatch = expression.match(/(?:\\bcommon_vendor\\.)?\\bo\\s*\\(\\s*([A-Za-z_$][\\w$]*)/);\n  if (directMatch) return directMatch[1];\n\n  const methodMatch = expression.match(/\\$(?:options|setup|ctx)\\.([A-Za-z_$][\\w$]*)/);\n  if (methodMatch) return methodMatch[1];\n\n  const assignmentMatch = expression.match(/\\$data\\.([A-Za-z_$][\\w$]*)\\s*=/);\n  if (assignmentMatch) return `${assignmentMatch[1]} setter`;\n\n  return null;\n}\n\nfunction escapeRegExp(value: string): string {\n  return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nfunction findWxmlUsages(wxml: string, key: string): WxmlUsage[] {\n  if (!wxml) return [];\n  const usages: WxmlUsage[] = [];\n  const re = new RegExp(`(^|[^A-Za-z0-9_$])${escapeRegExp(key)}([^A-Za-z0-9_$]|$)`, 'g');\n  let match: RegExpExecArray | null = re.exec(wxml);\n\n  while (match) {\n    const index = match.index + match[1].length;\n    const start = Math.max(0, index - 45);\n    const end = Math.min(wxml.length, index + key.length + 45);\n    const snippet = wxml.slice(start, end).replace(/\\s+/g, ' ').trim();\n    usages.push({ index, snippet });\n    if (usages.length >= 8) break;\n    match = re.exec(wxml);\n  }\n  return usages;\n}\n\nfunction isTemplateEventAttribute(name: string): boolean {\n  const normalized = name.toLowerCase();\n  return (\n    normalized.startsWith('bind') ||\n    normalized.startsWith('catch') ||\n    normalized.startsWith('capture-bind') ||\n    normalized.startsWith('capture-catch') ||\n    normalized.startsWith('mut-bind') ||\n    normalized.startsWith('@')\n  );\n}\n\nfunction stripTemplateEventAttributes(wxml: string): string {\n  return wxml.replace(/<[^>]+>/g, (tag) =>\n    tag.replace(/\\s+([:@A-Za-z0-9._-]+)(?:=(?:\"[^\"]*\"|'[^']*'))?/g, (attribute, name: string) =>\n      isTemplateEventAttribute(name) ? '' : attribute,\n    ),\n  );\n}\n\nfunction inferEventSourceNameFromUsages(usages: WxmlUsage[], key: string): string | null {\n  const keyPattern = escapeRegExp(key);\n  for (const usage of usages) {\n    const match = usage.snippet.match(\n      new RegExp(`\\\\b(?:capture-)?(?:bind|catch|mut-bind)([A-Za-z0-9_-]*)\\\\s*=\\\\s*[\"']\\\\{\\\\{${keyPattern}\\\\}\\\\}`),\n    );\n    if (match) return match[1] ? `${match[1]} event` : 'event handler';\n  }\n  return null;\n}\n\nfunction extractTemplateKeyRefs(source: string, keys: string[]): string[] {\n  const matched = new Set<string>();\n  for (const key of keys) {\n    const re = new RegExp(`(^|[^A-Za-z0-9_$])${escapeRegExp(key)}([^A-Za-z0-9_$]|$)`);\n    if (re.test(source)) matched.add(key);\n  }\n  return Array.from(matched);\n}\n\nfunction normalizeSnippet(value: string, limit = 120): string {\n  const normalized = value.replace(/\\s+/g, ' ').trim();\n  return normalized.length > limit ? `${normalized.slice(0, limit - 1)}...` : normalized;\n}\n\nfunction classifyTemplateTag(tag: string): 'element' | 'component' {\n  return NATIVE_TEMPLATE_TAGS.has(tag) ? 'element' : 'component';\n}\n\nfunction parseTemplateAttributes(source: string): TemplateAttribute[] {\n  const attrs: TemplateAttribute[] = [];\n  const attrSource = source.replace(/^<[^/\\s>]+/, '').replace(/\\/?>$/, '');\n  const re = /([:@A-Za-z0-9._-]+)(?:=(?:\"([^\"]*)\"|'([^']*)'))?/g;\n  let match: RegExpExecArray | null = re.exec(attrSource);\n  while (match) {\n    if (!isTemplateEventAttribute(match[1])) {\n      attrs.push({\n        name: match[1],\n        value: match[2] ?? match[3] ?? '',\n      });\n    }\n    match = re.exec(attrSource);\n  }\n  return attrs;\n}\n\nfunction parseTemplateTree(wxml: string, keys: KeyMapItem[]): TemplateNode | null {\n  if (!wxml.trim()) return null;\n\n  const keyNames = keys.map((item) => item.key);\n  const root: TemplateNode = {\n    id: 'root',\n    tag: 'page',\n    kind: 'element',\n    snippet: 'page',\n    keyRefs: [],\n    attrs: [],\n    text: null,\n    children: [],\n  };\n  const stack: TemplateNode[] = [root];\n  const tokenRe = /<!--[\\s\\S]*?-->|<\\/?[^>]+>|[^<]+/g;\n  let match: RegExpExecArray | null = tokenRe.exec(wxml);\n  let counter = 0;\n\n  while (match) {\n    const token = match[0];\n    if (!token || token.startsWith('<!--')) {\n      match = tokenRe.exec(wxml);\n      continue;\n    }\n\n    if (token.startsWith('</')) {\n      if (stack.length > 1) stack.pop();\n      match = tokenRe.exec(wxml);\n      continue;\n    }\n\n    if (token.startsWith('<')) {\n      const tagMatch = token.match(/^<\\s*([^\\s/>]+)/);\n      if (!tagMatch) {\n        match = tokenRe.exec(wxml);\n        continue;\n      }\n      const tag = tagMatch[1];\n      counter += 1;\n      const node: TemplateNode = {\n        id: `node-${counter}`,\n        tag,\n        kind: classifyTemplateTag(tag),\n        snippet: normalizeSnippet(token),\n        keyRefs: extractTemplateKeyRefs(token, keyNames),\n        attrs: parseTemplateAttributes(token),\n        text: null,\n        children: [],\n      };\n      stack[stack.length - 1].children.push(node);\n      if (!/\\/>$/.test(token) && !token.startsWith('<input')) stack.push(node);\n      match = tokenRe.exec(wxml);\n      continue;\n    }\n\n    const text = normalizeSnippet(token, 80);\n    if (!text) {\n      match = tokenRe.exec(wxml);\n      continue;\n    }\n    counter += 1;\n    stack[stack.length - 1].children.push({\n      id: `node-${counter}`,\n      tag: '#text',\n      kind: 'text',\n      snippet: text,\n      keyRefs: extractTemplateKeyRefs(token, keyNames),\n      attrs: [],\n      text,\n      children: [],\n    });\n    match = tokenRe.exec(wxml);\n  }\n\n  return root;\n}\n\nfunction readSourceMap(targetRoot: string, jsFile: string): SourceMapInfo | null {\n  const js = fs.readFileSync(jsFile, 'utf8');\n  const match = js.match(/\\/\\/# sourceMappingURL=(.+)$/m);\n  if (!match) return null;\n\n  const mapPath = path.resolve(path.dirname(jsFile), match[1]);\n  if (!mapPath.startsWith(path.dirname(targetRoot)) || !fs.existsSync(mapPath)) return null;\n\n  try {\n    const map = JSON.parse(fs.readFileSync(mapPath, 'utf8')) as Partial<SourceMapInfo>;\n    return {\n      path: normalizeSlashes(path.relative(targetRoot, mapPath)),\n      sources: Array.isArray(map.sources) ? map.sources : [],\n      sourcesContent: Array.isArray(map.sourcesContent) ? map.sourcesContent : [],\n      names: Array.isArray(map.names) ? map.names : [],\n    };\n  } catch (_error) {\n    return null;\n  }\n}\n\nfunction findTemplateFile(jsFile: string): string | null {\n  for (const extension of TEMPLATE_EXTENSIONS) {\n    const file = jsFile.replace(/\\.js$/, extension);\n    if (fs.existsSync(file)) return file;\n  }\n  return null;\n}\n\nexport function analyzePage(targetRoot: string, jsFile: string): PageAnalysis {\n  const js = fs.readFileSync(jsFile, 'utf8');\n  const jsNoComments = stripJsComments(js);\n  const relJs = normalizeSlashes(path.relative(targetRoot, jsFile));\n  const page = relJs.replace(/\\.js$/, '');\n  const wxmlFile = findTemplateFile(jsFile);\n  const wxml = wxmlFile ? fs.readFileSync(wxmlFile, 'utf8') : '';\n  const displayWxml = stripTemplateEventAttributes(wxml);\n  const sourceMap = readSourceMap(targetRoot, jsFile);\n  const setupBindings = extractSetupBindings(jsNoComments);\n  const body = extractReturnedObject(jsNoComments);\n  const keys: KeyMapItem[] = [];\n\n  if (body) {\n    for (const part of splitTopLevelProperties(body)) {\n      const parsed = parseProperty(part);\n      if (!parsed || !parsed.key) continue;\n      const inferred = inferFromExpression(parsed.expression, setupBindings);\n      const wxmlUsages = findWxmlUsages(inferred.kind === 'event-handler' ? wxml : displayWxml, parsed.key);\n      const sourceName =\n        inferred.sourceName ||\n        (inferred.kind === 'event-handler' ? inferEventSourceNameFromUsages(wxmlUsages, parsed.key) : null);\n      keys.push({\n        key: parsed.key,\n        ...inferred,\n        sourceName,\n        expression: parsed.expression,\n        wxmlUsages,\n      });\n    }\n  }\n\n  const templateTree = parseTemplateTree(displayWxml, keys);\n\n  return {\n    page,\n    jsFile: relJs,\n    wxmlFile: wxmlFile ? normalizeSlashes(path.relative(targetRoot, wxmlFile)) : null,\n    sourceMap,\n    keys,\n    templateTree,\n  };\n}\n\nexport function analyzeProject(targetRoot: string): ProjectAnalysis {\n  if (!fs.existsSync(targetRoot)) throw new Error(`Target does not exist: ${targetRoot}`);\n\n  const jsFiles = walkFiles(\n    targetRoot,\n    (file) => file.endsWith('.js') && !file.includes(`${path.sep}common${path.sep}`),\n  );\n  const pageFiles = jsFiles.filter((file) => {\n    const js = fs.readFileSync(file, 'utf8');\n    return js.includes('const __returned__ =') || js.includes('function _sfc_render') || !!findTemplateFile(file);\n  });\n\n  const pages: Record<string, PageAnalysis> = {};\n  for (const file of pageFiles) {\n    const page = analyzePage(targetRoot, file);\n    pages[page.page] = page;\n  }\n\n  return {\n    tool: 'uniappx-keymap-devtools',\n    version: '0.1.0',\n    targetRoot,\n    generatedAt: new Date().toISOString(),\n    pages,\n  };\n}\n"],"mappings":";;;;;;;AAgFA,MAAM,sBAAsB,CAAC,QAAQ;AACrC,MAAM,uBAAuB,IAAI,IAAI;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,MAAM,qBAAyC;CAC7C;EACE,IAAI;EACJ,MAAM;EACN,MAAM;EACP;CACD;EAAE,IAAI;EAAgD,MAAM;EAA0B,MAAM;EAAgB;CAC5G;EAAE,IAAI;EAAW,MAAM;EAAyC,MAAM;EAAW;CACjF;EAAE,IAAI;EAAa,MAAM;EAAkD,MAAM;EAAW;CAC5F;EAAE,IAAI;EAAoB,MAAM;EAA8B,MAAM;EAAsB;CAC1F;EAAE,IAAI;EAAoB,MAAM;EAA8B,MAAM;EAAsB;CAC1F;EAAE,IAAI;EAAqB,MAAM;EAA+B,MAAM;EAAuB;CAC9F;AAED,SAAS,UAAU,MAAc,WAAiD;CAChF,MAAM,SAAmB,EAAE;CAC3B,SAAS,KAAK,KAAmB;AAC/B,MAAI,CAACA,QAA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