{"version":3,"file":"ToolRendererBoundary.cjs","names":["Component"],"sources":["../../../src/web/lib/ToolRendererBoundary.tsx"],"sourcesContent":["import { Component, type ReactNode } from 'react';\n\ninterface ToolRendererBoundaryProps {\n  toolName: string;\n  /** Renders the item; `failed` is true once the plugin renderer threw, so the host item stands in. */\n  children: (failed: boolean) => ReactNode;\n}\n\ninterface ToolRendererBoundaryState {\n  failed: boolean;\n}\n\n/**\n * Keeps one plugin's tool renderer from taking the timeline down with it: a\n * throw during render is logged once and the call falls back to the host's\n * own item, while every other entry keeps rendering.\n */\nexport class ToolRendererBoundary extends Component<ToolRendererBoundaryProps, ToolRendererBoundaryState> {\n  override state: ToolRendererBoundaryState = { failed: false };\n\n  static getDerivedStateFromError(): ToolRendererBoundaryState {\n    return { failed: true };\n  }\n\n  override componentDidCatch(error: unknown): void {\n    console.error(`web plugin renderer '${this.props.toolName}' threw; showing the host fallback instead`, error);\n  }\n\n  override render(): ReactNode {\n    return this.props.children(this.state.failed);\n  }\n}\n"],"mappings":";;;;;;;AAiBA,IAAa,uBAAb,cAA0CA,MAAAA,UAAgE;CACxG,QAA4C,EAAE,QAAQ,MAAM;CAE5D,OAAO,2BAAsD;EAC3D,OAAO,EAAE,QAAQ,KAAK;CACxB;CAEA,kBAA2B,OAAsB;EAC/C,QAAQ,MAAM,wBAAwB,KAAK,MAAM,SAAS,6CAA6C,KAAK;CAC9G;CAEA,SAA6B;EAC3B,OAAO,KAAK,MAAM,SAAS,KAAK,MAAM,MAAM;CAC9C;AACF"}