{"version":3,"sources":["../src/lib/vite.ts","../src/lib/vite-plugin/vitePlugin.ts","../src/lib/vite-plugin/hmr/index.ts","../src/lib/vite-plugin/utils/fileUtils.ts","../src/lib/vite-plugin/utils/componentParser.ts","../src/lib/vite-plugin/utils/componentUtils.ts","../src/lib/vite-plugin/utils/magicStringUtils.ts","../src/lib/vite-plugin/open-in-editor/index.ts","../src/lib/vite-plugin/utils/logger.ts","../src/lib/vite-plugin/static-state/index.ts","../src/lib/config.ts","../src/lib/vite-plugin/transactions/index.ts"],"sourcesContent":["export { plugin as threlteStudio } from './vite-plugin/vitePlugin.js'\n","import type { Plugin } from 'vite'\nimport { createRPCServer } from 'vite-dev-rpc'\nimport * as hmr from './hmr/index.js'\nimport * as openInEditor from './open-in-editor/index.js'\nimport * as staticState from './static-state/index.js'\nimport * as transactions from './transactions/index.js'\nimport * as logger from './utils/logger.js'\nimport type * as rpc from '../rpc/rpc.js'\n\ntype Options = {\n  apply?: 'serve' | 'build'\n}\n\nexport const plugin: (options?: Options) => Plugin = (options) => {\n  return {\n    name: 'Threlte Studio',\n    enforce: 'pre',\n    apply: options?.apply,\n    async transform(code, id) {\n      // do not transform node_modules\n      if (id.includes('node_modules')) return\n\n      // transform static state\n      try {\n        code = await staticState.transformStaticState(code, id)\n      } catch (err) {\n        logger.logError({\n          moduleId: id,\n          error: err,\n          context: logger.Context.ErrorTransformingStaticState\n        })\n        return\n      }\n\n      // transform component\n      try {\n        code = await transactions.transformComponent(code, id)\n      } catch (err) {\n        logger.logError({\n          moduleId: id,\n          context: logger.Context.ErrorCompilingComponent,\n          error: err\n        })\n        return\n      }\n\n      return { code }\n    },\n    handleHotUpdate({ file }) {\n      return hmr.scheduleModuleHmrAvailability(file)\n    },\n    config() {\n      return {\n        define: {\n          __THRELTE_STUDIO_PLUGIN_ENABLED__: 'true'\n        }\n      }\n    },\n    configureServer(server) {\n      createRPCServer<rpc.ClientFunctions, rpc.ServerFunctions>('threlte-studio', server.ws, {\n        mutateStaticState(id, module, className, propertyName, value) {\n          return staticState.mutateStaticState(id, module, className, propertyName, value)\n        },\n        async syncTransactions(t) {\n          return await transactions.syncTransactions(t)\n        },\n        async getColumnAndRow(moduleId, componentIndex) {\n          return await openInEditor.getColumnAndRow(moduleId, componentIndex)\n        }\n      })\n    }\n  }\n}\n","const HmrIgnoredModuleTimeouts = new Map<string, ReturnType<typeof setTimeout>>()\nconst HmrIgnoredModuleIds = new Set<string>()\n\nconst cancelModuleHmrAvailability = (moduleId: string) => {\n  const timneout = HmrIgnoredModuleTimeouts.get(moduleId)\n  if (timneout) {\n    clearTimeout(timneout)\n    HmrIgnoredModuleTimeouts.delete(moduleId)\n  }\n}\n\nexport const disableModuleHmr = (moduleId: string) => {\n  cancelModuleHmrAvailability(moduleId)\n  HmrIgnoredModuleIds.add(moduleId)\n}\n\nexport const scheduleModuleHmrAvailability = (moduleId: string) => {\n  if (!HmrIgnoredModuleIds.has(moduleId)) return\n  cancelModuleHmrAvailability(moduleId)\n  HmrIgnoredModuleTimeouts.set(\n    moduleId,\n    setTimeout(() => {\n      HmrIgnoredModuleIds.delete(moduleId)\n      HmrIgnoredModuleTimeouts.delete(moduleId)\n    }, 500)\n  )\n  return []\n}\n","import { readFileSync, writeFileSync } from 'node:fs'\n\nexport const readFile = (path: string): string => {\n  return readFileSync(path, {\n    encoding: 'utf8'\n  })\n}\n\nexport const writeFile = (path: string, contents: string) => {\n  writeFileSync(path, contents, {\n    encoding: 'utf8'\n  })\n}\n","import type { Expression } from 'estree'\nimport { walk, type Node } from 'estree-walker'\nimport MagicString from 'magic-string'\nimport { inspect } from 'node:util'\nimport { parse } from 'svelte/compiler'\nimport type { StudioProps } from '../../types.js'\nimport json5 from 'json5'\n\nexport const hasTComponent = (code: string): boolean => {\n  return code.includes('<T.') || code.includes('<T ') || code.includes('<T\\n')\n}\ntype BaseAttribute = {\n  name: string\n  start: number\n  end: number\n}\n\ntype BaseAttributeValue = {\n  start: number\n  end: number\n}\n\ntype TextAttributeValue = BaseAttributeValue & {\n  type: 'Text'\n  raw: string\n  data: string\n}\n\ntype AttributeShorthandValue = BaseAttributeValue & {\n  type: 'AttributeShorthand'\n  expression: Expression & {\n    start: number\n    end: number\n  }\n}\n\ntype MustacheTagAttributeValue = BaseAttributeValue & {\n  type: 'MustacheTag'\n  expression: Expression & {\n    start: number\n    end: number\n  }\n}\n\ntype EventHandlerAttribute = BaseAttribute & {\n  type: 'EventHandler'\n  name: string\n}\n\ntype BooleanAttribute = BaseAttribute & {\n  type: 'Attribute'\n  value: true\n}\n\ntype TextAttribute = BaseAttribute & {\n  type: 'Attribute'\n  value: TextAttributeValue[]\n}\n\ntype MustacheTagAttribute = BaseAttribute & {\n  type: 'Attribute'\n  value: MustacheTagAttributeValue[]\n}\n\ntype ShorthandAttribute = BaseAttribute & {\n  type: 'Attribute'\n  value: AttributeShorthandValue[]\n}\n\ntype ValueAttribute = BooleanAttribute | TextAttribute | MustacheTagAttribute | ShorthandAttribute\n\ntype Attribute = EventHandlerAttribute | ValueAttribute\n\nconst isValueAttribute = (attribute: Attribute): attribute is ValueAttribute => {\n  return attribute.type === 'Attribute'\n}\n\nconst isAttributeWithTextValue = (attribute: Attribute): attribute is TextAttribute => {\n  if (!isValueAttribute(attribute)) return false\n  if (attribute.value === true) return false\n  return attribute.value[0].type === 'Text'\n}\n\nconst isAttributeWithMustacheTagValue = (\n  attribute: Attribute\n): attribute is MustacheTagAttribute => {\n  if (!isValueAttribute(attribute)) return false\n  if (attribute.value === true) return false\n  return attribute.value[0].type === 'MustacheTag'\n}\n\nconst isAttributeWithShorthandValue = (attribute: Attribute): attribute is ShorthandAttribute => {\n  if (!isValueAttribute(attribute)) return false\n  if (attribute.value === true) return false\n  return attribute.value[0].type === 'AttributeShorthand'\n}\n\nconst isAttributeWithBooleanValue = (attribute: Attribute): attribute is BooleanAttribute => {\n  if (!isValueAttribute(attribute)) return false\n  return typeof attribute.value === 'boolean'\n}\n\ntype DefinedNode = Omit<Node, 'type'> & {\n  type: Node['type'] | 'InlineComponent'\n  name: string\n  start: number\n  end: number\n  attributes: Attribute[]\n}\n\ntype TComponentNode = DefinedNode & {\n  name: `T.${string}` | 'T'\n}\n\nconst isDefinedNode = (node: unknown): node is DefinedNode => {\n  return (\n    typeof node === 'object' &&\n    node !== null &&\n    'attributes' in node &&\n    Array.isArray(node.attributes) &&\n    'name' in node &&\n    'start' in node &&\n    'end' in node\n  )\n}\n\nconst isTComponentNode = (node: unknown): node is TComponentNode => {\n  return (\n    isDefinedNode(node) &&\n    node.type === 'InlineComponent' &&\n    (node.name.startsWith('T.') || node.name === 'T')\n  )\n}\n\nconst isMultiLineNode = (\n  markup: MagicString,\n  node: DefinedNode\n): { isMultiLine: boolean; indent: string } => {\n  let isMultiLine = false\n  let indent = ''\n  if (node.attributes.length > 0) {\n    // find new line chars in between\n    const firstAttribute = node.attributes.toSorted((a, b) => a.start - b.start).at(0)\n    if (!firstAttribute) throw new Error('No attributes found')\n    const startOfFirstAttribute = firstAttribute.start\n    // +1 for \"<\"\n    const endOfTagOpen = node.start + node.name.length + 1\n    const slice = markup.slice(endOfTagOpen, startOfFirstAttribute)\n    isMultiLine = slice.includes('\\n')\n    indent = slice\n  }\n  return {\n    isMultiLine,\n    indent\n  }\n}\n\nexport const findNodeByIndex = (markup: MagicString, index: number): TComponentNode | undefined => {\n  const ast = parse(markup.toString())\n  let currentIndex = -1\n  let finalNode: TComponentNode | undefined\n  walk((ast as any).html as Node, {\n    enter(node) {\n      if (!isTComponentNode(node)) return\n      currentIndex += 1\n      if (currentIndex === index) finalNode = node\n    }\n  })\n  return finalNode\n}\n\n/**\n * Stringifies any value with a set precision (default 4).\n */\nconst stringifyAttributeValue = (value: unknown, precision = 4): string => {\n  const reducedPrecision = JSON.parse(\n    JSON.stringify(\n      value,\n      (_, val) => {\n        return val.toFixed ? Number(val.toFixed(precision)) : val\n      },\n      ' '\n    )\n  )\n  return inspect(reducedPrecision, {\n    depth: Infinity,\n    breakLength: Infinity,\n    maxArrayLength: Infinity,\n    maxStringLength: Infinity\n  })\n}\n\n/**\n * Upserts an attribute to a `<T>` component.\n */\nexport const upsertAttribute = (\n  markup: MagicString,\n  node: TComponentNode,\n  attributeName: string,\n  value: unknown,\n  position: 'first' | 'last',\n  precision?: number\n) => {\n  const attribute = node.attributes.find((attr) => attr.name === attributeName)\n\n  if (attribute) {\n    if (isAttributeWithBooleanValue(attribute)) {\n      // if the value is \"true\", we can return early: `name` -> `name`\n      if (value === true) return\n      if (typeof value === 'string') {\n        // it's a text value, so we need to convert it to a mustache tag: `name` -> `name=\"value\"`\n        markup.appendLeft(attribute.end, `=\"${value}\"`)\n      } else {\n        // it's a mustache tag value, so we need to stringify it: `name` -> `name={value}`\n        markup.appendLeft(attribute.end, `={${stringifyAttributeValue(value, precision)}}`)\n      }\n    } else if (isAttributeWithTextValue(attribute)) {\n      const firstValue = attribute.value[0]\n      if (typeof value === 'string') {\n        // it's a text value, so we can just update it: `name=\"old\"` -> `name=\"new\"`\n        markup.overwrite(firstValue.start, firstValue.end, value)\n      } else if (typeof value === 'boolean' && value) {\n        // it's a boolean value, so we can remove the text part: `name=\"old\"` -> `name`\n        markup.remove(firstValue.start - 2, firstValue.end + 1)\n      } else {\n        // it's a mustache tag value, so we need to stringify it: `name=\"old\"` -> `name={new}`\n        markup.overwrite(\n          firstValue.start - 1,\n          firstValue.end + 1,\n          `{${stringifyAttributeValue(value, precision)}}`\n        )\n      }\n    } else if (isAttributeWithMustacheTagValue(attribute)) {\n      const firstValue = attribute.value[0]\n      if (typeof value === 'string') {\n        // it's a text value, so we can update it: `name={old}` -> `name=\"new\"`\n        markup.overwrite(firstValue.start, firstValue.end, `\"${value}\"`)\n      } else if (typeof value === 'boolean' && value) {\n        // it's a boolean value, so we can remove the mustache tag part: `name={old}` -> `name`\n        markup.remove(firstValue.start - 1, firstValue.end)\n      } else {\n        // it's a mustache tag value, so we can update it: `name={old}` -> `name={new}`\n        markup.overwrite(\n          firstValue.start + 1,\n          firstValue.end - 1,\n          stringifyAttributeValue(value, precision)\n        )\n      }\n    } else if (isAttributeWithShorthandValue(attribute)) {\n      if (typeof value === 'string') {\n        // it's a text value, so we can update it: `{name}` -> `name=\"new\"`\n        markup.overwrite(attribute.start, attribute.end, `${attributeName}=\"${value}\"`)\n      } else if (typeof value === 'boolean' && value) {\n        // it's a boolean value, so we can remove the shorthand part: `{name}` -> `name`\n        markup.overwrite(attribute.start, attribute.end, attributeName)\n      } else {\n        // it's a mustache tag value, so we can update it: `{name}` -> `name={new}`\n        markup.overwrite(\n          attribute.start,\n          attribute.end,\n          `${attributeName}={${stringifyAttributeValue(value, precision)}}`\n        )\n      }\n    }\n  } else {\n    // insert\n    const { indent } = isMultiLineNode(markup, node)\n\n    let space = ''\n\n    // account for `<` at start of node\n    let start = node.start + node.name.length + 1\n    if (node.attributes.length > 0 && position === 'last') {\n      const lastAttribute = node.attributes.reduce((a, b) => (a.end > b.end ? a : b))\n      start = lastAttribute.end\n    }\n    if (node.attributes.length === 0) {\n      space = ' '\n    }\n    if (typeof value === 'boolean' && value) {\n      markup.appendLeft(start, `${space}${indent}${attributeName}`)\n    } else if (typeof value === 'string') {\n      markup.appendLeft(start, `${space}${indent}${attributeName}=\"${value}\"`)\n    } else {\n      markup.appendLeft(\n        start,\n        `${space}${indent}${attributeName}={${stringifyAttributeValue(value, precision)}}`\n      )\n    }\n  }\n}\n\n/**\n * Removes an attribute from a `<T>` component.\n */\nexport const removeAttribute = (\n  markup: MagicString,\n  node: TComponentNode,\n  attributeName: string\n): void => {\n  const attribute = node.attributes.find((attr) => attr.name === attributeName)\n  if (!attribute) return\n\n  let start = attribute.start\n  if (attribute === node.attributes.at(0)) {\n    // it's the first attribute, either because it's\n    // the only one or because it's the first one\n    start = node.start + node.name.length + 1\n  }\n\n  markup.remove(start, attribute.end)\n}\n\n/**\n * Read the value of an attribute from a `<T>` component.\n */\nexport const readAttribute = (markup: MagicString, node: TComponentNode, attributeName: string) => {\n  const attribute = node.attributes.find((attr) => attr.name === attributeName)\n  if (!attribute) throw new Error(`Attribute not found with name ${attributeName}`)\n  if (isAttributeWithBooleanValue(attribute)) {\n    return true\n  } else if (isAttributeWithTextValue(attribute)) {\n    return attribute.value[0].data\n  } else if (isAttributeWithMustacheTagValue(attribute)) {\n    const firstValue = attribute.value[0]\n    return json5.parse(markup.slice(firstValue.start + 1, firstValue.end - 1))\n  } else if (isAttributeWithShorthandValue(attribute)) {\n    throw new Error('Shorthand props are not supported.')\n  } else {\n    throw new Error('Unknown attribute type')\n  }\n}\n\nexport const addStudioRuntimeProps = (markup: MagicString, id: string): void => {\n  const ast = parse(markup.toString())\n  let index = 0\n  walk((ast as any).html as Node, {\n    enter(node) {\n      if (!isTComponentNode(node)) return\n      const props: StudioProps = { moduleId: id, index }\n      upsertAttribute(markup, node, 'threlteStudio', props, 'last')\n      index += 1\n    }\n  })\n}\n","import { preprocess } from 'svelte/compiler'\n\nexport const isModule = (attributes: Record<string, string | boolean>) => {\n  if (attributes.module && typeof attributes.module === 'boolean') {\n    return attributes.module\n  } else if (attributes.context && attributes.context === 'module') {\n    return true\n  }\n  return false\n}\n\n/**\n * Disassembles a Svelte component into its parts: markup, script, script module,\n * and style. The script and style blocks are replaced with dummy values.\n */\nexport const disassembleComponent = async (code: string) => {\n  let script: string | undefined\n  let scriptModule: string | undefined\n  let style: string | undefined\n\n  const disassembled = await preprocess(code, {\n    script: ({ content, attributes }) => {\n      if (isModule(attributes)) {\n        scriptModule = content\n      } else {\n        script = content\n      }\n      return {\n        code: '/* DUMMY SCRIPT */'\n      }\n    },\n    style: ({ content }) => {\n      style = content\n      return {\n        code: '/* DUMMY STYLE */'\n      }\n    }\n  })\n\n  const reassemble = async (newCode: string) => {\n    const assembled = await preprocess(newCode, {\n      script: ({ attributes }) => {\n        if (isModule(attributes)) {\n          return {\n            code: scriptModule!\n          }\n        } else {\n          return {\n            code: script!\n          }\n        }\n      },\n      style: () => {\n        return {\n          code: style!\n        }\n      }\n    })\n    return assembled.code\n  }\n\n  return {\n    markup: disassembled.code,\n    reassemble\n  }\n}\n","import MagicString from 'magic-string'\n\nexport const toMagicString = (markup: string): MagicString => {\n  return new MagicString(markup)\n}\n\nexport const recreateMagicString = (markup: MagicString): MagicString => {\n  return new MagicString(markup.toString())\n}\n\nexport const isMagicString = (object: unknown): object is MagicString => {\n  return object instanceof MagicString\n}\n","import * as fileUtils from '../utils/fileUtils.js'\nimport * as componentParser from '../utils/componentParser.js'\nimport * as componentUtils from '../utils/componentUtils.js'\nimport { toMagicString } from '../utils/magicStringUtils.js'\nimport indexToPosition from 'index-to-position'\nimport * as logger from '../utils/logger.js'\n\nexport const getColumnAndRow = async (moduleId: string, componentIndex: number) => {\n  const code = fileUtils.readFile(moduleId)\n  if (!componentParser.hasTComponent(code)) {\n    logger.logError({\n      moduleId,\n      context: logger.Context.NoTComponentFound\n    })\n    return { column: 0, row: 0 }\n  }\n  const { markup, reassemble } = await componentUtils.disassembleComponent(code)\n  const magicMarkup = toMagicString(markup)\n  const node = componentParser.findNodeByIndex(magicMarkup, componentIndex)\n  if (!node) {\n    logger.logError({\n      moduleId,\n      context: `Could not find node by index ${componentIndex}`\n    })\n    return { column: 0, row: 0 }\n  }\n  const start = node.start\n  const sliceTo = start + 1 + node.name.length\n  // slice the markup to the start of the node\n  const slice = markup.slice(0, sliceTo)\n  // assemble the component back together to get the index\n  const finalComponent = await reassemble(slice)\n  // get the index of the last character\n  const index = finalComponent.length - 1\n  // convert the index to a position\n  const pos = indexToPosition(finalComponent, index, {\n    oneBased: true\n  })\n  return { column: pos.column, row: pos.line }\n}\n","import colors from 'kleur'\n\nexport enum Context {\n  ErrorTransformingStaticState = 'Error transforming static state',\n  ErrorCompilingComponent = 'Error compiling component',\n  NoTComponentFound = 'No <T> component found'\n}\n\nconst parseErrorMessage = (error: any): string | undefined => {\n  try {\n    return 'message' in error && typeof error.message === 'string'\n      ? error.message\n      : error.toString()\n  } catch {\n    return undefined\n  }\n}\n\nexport const logError = (options: {\n  moduleId?: string\n  context: Context | string\n  error?: any\n}) => {\n  const { moduleId, context, error } = options\n  let log = `Threlte Studio: ${context}`\n  if (error) {\n    log += `: ${parseErrorMessage(error)}`\n  }\n  if (moduleId) {\n    log += `, module id: ${moduleId}`\n  }\n  console.warn(colors.red(log))\n}\n","import util from 'node:util'\nimport { preprocess } from 'svelte/compiler'\nimport ts from 'typescript'\nimport { staticStateMetaKey } from '../../config.js'\nimport type { Members, Modifier, StaticStateMeta } from '../../types.js'\nimport * as hmr from '../hmr/index.js'\nimport { readFile, writeFile } from '../utils/fileUtils.js'\nimport { toMagicString } from '../utils/magicStringUtils.js'\nimport { isModule } from '../utils/componentUtils.js'\n\nconst createAst = (code: string, id: string) => {\n  return ts.createSourceFile(id, code, ts.ScriptTarget.Latest, true)\n}\n\nconst allowedExtensions = ['.svelte.ts', '.svelte.js', '.svelte']\nconst isAllowedExtension = (id: string) => {\n  return allowedExtensions.some((ext) => id.endsWith(ext))\n}\n\nconst isSvelteComponent = (id: string) => {\n  return id.endsWith('.svelte')\n}\n\nconst hasStaticState = (code: string) => {\n  return code.includes('extends StaticState')\n}\n\nconst regex = /extends StaticState[^{]*{/gm\n\nconst appendMeta = (code: string, meta: StaticStateMeta) => {\n  // add meta info to the code: id\n  return code.replace(regex, `$& ${staticStateMetaKey} = ${JSON.stringify(meta)}`)\n}\n\nconst isExtendsStaticState = (node: ts.Node): node is ts.ClassDeclaration => {\n  if (node.kind !== ts.SyntaxKind.ClassDeclaration) return false\n  const n = node as ts.ClassDeclaration\n  return !!n.heritageClauses?.some((clause) => {\n    return clause.getFullText().includes('StaticState')\n  })\n}\n\nconst isClassWithName = (node: ts.ClassDeclaration, name: string): boolean => {\n  if (!node.name) return false\n  if (node.name.kind !== ts.SyntaxKind.Identifier) return false\n  if (node.name.getText() !== name) return false\n  return true\n}\n\nconst extractMembers = (node: ts.ClassDeclaration): Members => {\n  const members: Members = []\n  node.members.forEach((member) => {\n    if (member.kind !== ts.SyntaxKind.PropertyDeclaration) return\n    const modifiers: Modifier[] = []\n    ts.getJSDocTags(member).forEach((tag) => {\n      modifiers.push({\n        name: tag.tagName.getText(),\n        value: tag.comment?.toString() ?? ''\n      })\n    })\n    if (!member.name || member.name.kind !== ts.SyntaxKind.Identifier) return\n    const m = member as ts.PropertyDeclaration\n    if (!m.initializer || m.initializer.kind !== ts.SyntaxKind.CallExpression) return\n    const mi = m.initializer as ts.CallExpression\n    const args = mi.arguments\n    if (args.length !== 1) return\n    const arg = args[0]!\n    members.push({\n      name: member.name!.getText(),\n      argument: {\n        start: arg.pos,\n        end: arg.end\n      },\n      modifiers\n    })\n  })\n  return members\n}\n\nconst transformScript = (code: string, id: string, module: boolean) => {\n  const members: Members = []\n\n  // Recursive function to traverse the AST\n  function traverse(node: ts.Node, depth = 0) {\n    if (isExtendsStaticState(node)) {\n      members.push(...extractMembers(node))\n    }\n    ts.forEachChild(node, (childNode) => traverse(childNode, depth + 1))\n  }\n\n  // Start traversing the AST from the source file\n  traverse(createAst(code, id))\n\n  const meta: StaticStateMeta = {\n    id,\n    members,\n    module\n  }\n\n  return appendMeta(code, meta)\n}\n\nexport const transformStaticState = async (code: string, id: string) => {\n  if (!isAllowedExtension(id)) return code\n  if (!hasStaticState(code)) return code\n\n  if (isSvelteComponent(id)) {\n    const processed = await preprocess(\n      code,\n      {\n        script: ({ content, attributes }) => {\n          const module = isModule(attributes)\n          return {\n            code: transformScript(content, id, module)\n          }\n        }\n      },\n      {\n        filename: id\n      }\n    )\n    return processed.code\n  } else {\n    return transformScript(code, id, false)\n  }\n}\n\nconst mutateScript = (\n  code: string,\n  id: string,\n  className: string,\n  propertyName: string,\n  value: unknown\n): {\n  needsRewrite: boolean\n  code: string\n} => {\n  let needsRewrite = false\n  const ms = toMagicString(code)\n\n  // Recursive function to traverse the AST\n  function traverse(node: ts.Node, depth = 0) {\n    if (isExtendsStaticState(node) && isClassWithName(node, className)) {\n      const members = extractMembers(node)\n      const member = members.find((m) => m.name === propertyName)\n      if (!member) return\n      ms.overwrite(\n        member.argument.start,\n        member.argument.end,\n        util.inspect(value, {\n          maxArrayLength: Infinity,\n          maxStringLength: Infinity,\n          breakLength: Infinity,\n          depth: Infinity\n        })\n      )\n      needsRewrite = true\n    }\n    ts.forEachChild(node, (childNode) => traverse(childNode, depth + 1))\n  }\n\n  // Start traversing the AST from the source file\n  traverse(createAst(code, id))\n\n  return {\n    code: ms.toString(),\n    needsRewrite\n  }\n}\n\nexport const mutateStaticState = async (\n  id: string,\n  module: boolean,\n  className: string,\n  propertyName: string,\n  value: unknown\n) => {\n  if (!isAllowedExtension(id)) return\n  const content = readFile(id)\n  if (!hasStaticState(content)) return\n\n  if (isSvelteComponent(id)) {\n    let needsRewrite = false\n    const processed = await preprocess(\n      content,\n      {\n        script: ({ content, attributes }) => {\n          // If the module attribute is different from the module flag, the\n          // class we're looking for is in a different script block, skip the\n          // mutation\n          if (isModule(attributes) !== module) return\n          if (!hasStaticState(content)) return\n          const mutatedScript = mutateScript(content, id, className, propertyName, value)\n          needsRewrite = mutatedScript.needsRewrite\n          return {\n            code: mutatedScript.code\n          }\n        }\n      },\n      {\n        filename: id\n      }\n    )\n\n    if (needsRewrite) {\n      writeFile(id, processed.code)\n      hmr.disableModuleHmr(id)\n    }\n  } else {\n    const { code, needsRewrite } = mutateScript(content, id, className, propertyName, value)\n    if (needsRewrite) {\n      writeFile(id, code)\n      hmr.disableModuleHmr(id)\n    }\n  }\n}\n","export const staticStateMetaKey =\n  'a_key_with_very_long_name_and_hopefully_no_one_will_use_it' as const\n","import * as hmr from '../hmr/index.js'\nimport * as componentParser from '../utils/componentParser.js'\nimport { addStudioRuntimeProps, hasTComponent } from '../utils/componentParser.js'\nimport * as componentUtils from '../utils/componentUtils.js'\nimport * as fileUtils from '../utils/fileUtils.js'\nimport { toMagicString } from '../utils/magicStringUtils.js'\n\nexport const transformComponent = async (code: string, id: string) => {\n  if (!id.endsWith('.svelte')) return code\n  if (!hasTComponent(code)) return code\n  if (id.includes('node_modules')) return code\n\n  const { markup, reassemble } = await componentUtils.disassembleComponent(code)\n  const magicMarkup = toMagicString(markup)\n  addStudioRuntimeProps(magicMarkup, id)\n  const finalComponent = await reassemble(magicMarkup.toString())\n  return finalComponent\n}\n\nexport const syncTransactions = async (\n  transactions: {\n    attributeName: string\n    attributeValue: unknown\n    componentIndex: number\n    moduleId: string\n    precision?: number\n  }[]\n) => {\n  const transactionsByModuleId = new Map<string, typeof transactions>()\n  transactions.forEach((transaction) => {\n    const transactions = transactionsByModuleId.get(transaction.moduleId) ?? []\n    transactions.push(transaction)\n    transactionsByModuleId.set(transaction.moduleId, transactions)\n  })\n\n  for (const [moduleId, transactions] of transactionsByModuleId.entries()) {\n    const code = fileUtils.readFile(moduleId)\n    if (!componentParser.hasTComponent(code)) {\n      console.error('Component does not need transform')\n      continue\n    }\n    const { markup, reassemble } = await componentUtils.disassembleComponent(code)\n\n    let currentMarkup = markup\n\n    transactions.forEach((transaction) => {\n      const magicMarkup = toMagicString(currentMarkup)\n      const node = componentParser.findNodeByIndex(magicMarkup, transaction.componentIndex)\n      if (!node) {\n        console.error('Could not find node by index', transaction.componentIndex)\n        return\n      }\n      componentParser.upsertAttribute(\n        magicMarkup,\n        node,\n        transaction.attributeName,\n        transaction.attributeValue,\n        'last',\n        transaction.precision\n      )\n\n      currentMarkup = magicMarkup.toString()\n    })\n\n    const finalComponent = await reassemble(currentMarkup)\n    fileUtils.writeFile(moduleId, finalComponent)\n    hmr.disableModuleHmr(moduleId)\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,0BAAgC;;;ACDhC,IAAM,2BAA2B,oBAAI,IAA2C;AAChF,IAAM,sBAAsB,oBAAI,IAAY;AAE5C,IAAM,8BAA8B,wBAAC,aAAqB;AACxD,QAAM,WAAW,yBAAyB,IAAI,QAAQ;AACtD,MAAI,UAAU;AACZ,iBAAa,QAAQ;AACrB,6BAAyB,OAAO,QAAQ;AAAA,E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;AACD;AAAA,MACF;AAEA,aAAO,EAAE,KAAK;AAAA,IAChB;AAAA,IACA,gBAAgB,EAAE,KAAK,GAAG;AACxB,aAAW,8BAA8B,IAAI;AAAA,IAC/C;AAAA,IACA,SAAS;AACP,aAAO;AAAA,QACL,QAAQ;AAAA,UACN,mCAAmC;AAAA,QACrC;AAAA,MACF;AAAA,IACF;AAAA,IACA,gBAAgB,QAAQ;AACtB,+CAA0D,kBAAkB,OAAO,IAAI;AAAA,QACrF,kBAAkB,IAAIC,SAAQ,WAAW,cAAc,OAAO;AAC5D,iBAAmB,kBAAkB,IAAIA,SAAQ,WAAW,cAAc,KAAK;AAAA,QACjF;AAAA,QACA,MAAM,iBAAiB,GAAG;AACxB,iBAAO,MAAmB,iBAAiB,CAAC;AAAA,QAC9C;AAAA,QACA,MAAM,gBAAgB,UAAU,gBAAgB;AAC9C,iBAAO,MAAmB,gBAAgB,UAAU,cAAc;AAAA,QACpE;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF,GA3DqD;","names":["import_compiler","import_magic_string","MagicString","colors","indexToPosition","import_node_util","import_compiler","ts","module","util","content","transactions","module"]}