{"version":3,"file":"CopilotKitInspector.mjs","names":["React"],"sources":["../../src/components/CopilotKitInspector.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { createComponent } from \"@lit-labs/react\";\nimport type { CopilotKitCore } from \"@copilotkitnext/core\";\n\ntype CopilotKitInspectorBaseProps = {\n  core?: CopilotKitCore | null;\n  [key: string]: unknown;\n};\n\ntype InspectorComponent = React.ComponentType<CopilotKitInspectorBaseProps>;\n\nexport interface CopilotKitInspectorProps extends CopilotKitInspectorBaseProps {}\n\nexport const CopilotKitInspector: React.FC<CopilotKitInspectorProps> = ({\n  core,\n  ...rest\n}) => {\n  const [InspectorComponent, setInspectorComponent] =\n    React.useState<InspectorComponent | null>(null);\n\n  React.useEffect(() => {\n    let mounted = true;\n\n    // Load the web component only on the client to keep SSR output stable.\n    import(\"@copilotkitnext/web-inspector\").then((mod) => {\n      mod.defineWebInspector?.();\n\n      const Component = createComponent({\n        tagName: mod.WEB_INSPECTOR_TAG,\n        elementClass: mod.WebInspectorElement,\n        react: React,\n      }) as InspectorComponent;\n\n      if (mounted) {\n        setInspectorComponent(() => Component);\n      }\n    });\n\n    return () => {\n      mounted = false;\n    };\n  }, []);\n\n  // During SSR (and until the client finishes loading), render nothing to keep markup consistent.\n  if (!InspectorComponent) return null;\n\n  return <InspectorComponent {...rest} core={core ?? null} />;\n};\n\nCopilotKitInspector.displayName = \"CopilotKitInspector\";\n"],"mappings":";;;;;AAaA,MAAa,uBAA2D,EACtE,MACA,GAAG,WACC;CACJ,MAAM,CAAC,oBAAoB,yBACzBA,QAAM,SAAoC,KAAK;AAEjD,SAAM,gBAAgB;EACpB,IAAI,UAAU;AAGd,SAAO,iCAAiC,MAAM,QAAQ;AACpD,OAAI,sBAAsB;GAE1B,MAAM,YAAY,gBAAgB;IAChC,SAAS,IAAI;IACb,cAAc,IAAI;IAClB,OAAOA;IACR,CAAC;AAEF,OAAI,QACF,6BAA4B,UAAU;IAExC;AAEF,eAAa;AACX,aAAU;;IAEX,EAAE,CAAC;AAGN,KAAI,CAAC,mBAAoB,QAAO;AAEhC,QAAO,oBAAC;EAAmB,GAAI;EAAM,MAAM,QAAQ;GAAQ;;AAG7D,oBAAoB,cAAc"}