@opencx/widget-react 4.0.61 → 5.0.0-beta.0
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/Chart.impl-BnzKZLOH.js +153 -0
- package/dist/Chart.impl-BnzKZLOH.js.map +1 -0
- package/dist/Chart.impl-DOSb1NJk.cjs +2 -0
- package/dist/Chart.impl-DOSb1NJk.cjs.map +1 -0
- package/dist/index-BCiFOCVT.js +11548 -0
- package/dist/index-BCiFOCVT.js.map +1 -0
- package/dist/index-CqbztkwP.cjs +234 -0
- package/dist/index-CqbztkwP.cjs.map +1 -0
- package/dist/index.cjs +1 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -3391
- package/dist/index.js.map +1 -1
- package/dist/package.json.d.ts +82 -0
- package/dist/src/WidgetImperativeHandler.d.ts +1 -0
- package/dist/src/WidgetImperativeHandler.d.ts.map +1 -1
- package/dist/src/WidgetPopoverContent.d.ts.map +1 -1
- package/dist/src/WidgetPopoverTrigger.d.ts.map +1 -1
- package/dist/src/__tests__/motion-contract.spec.d.ts +2 -0
- package/dist/src/__tests__/motion-contract.spec.d.ts.map +1 -0
- package/dist/src/companion/CompanionContent.d.ts +30 -0
- package/dist/src/companion/CompanionContent.d.ts.map +1 -0
- package/dist/src/companion/CompanionFaceIcon.d.ts +15 -0
- package/dist/src/companion/CompanionFaceIcon.d.ts.map +1 -0
- package/dist/src/companion/CompanionFrame.d.ts +19 -0
- package/dist/src/companion/CompanionFrame.d.ts.map +1 -0
- package/dist/src/companion/FrameIconButton.d.ts +15 -0
- package/dist/src/companion/FrameIconButton.d.ts.map +1 -0
- package/dist/src/companion/LayoutPicker.d.ts +7 -0
- package/dist/src/companion/LayoutPicker.d.ts.map +1 -0
- package/dist/src/companion/PanelControls.d.ts +15 -0
- package/dist/src/companion/PanelControls.d.ts.map +1 -0
- package/dist/src/companion/RestingPill.d.ts +14 -0
- package/dist/src/companion/RestingPill.d.ts.map +1 -0
- package/dist/src/companion/SidebarSubmenu.d.ts +21 -0
- package/dist/src/companion/SidebarSubmenu.d.ts.map +1 -0
- package/dist/src/companion/WidgetCompanion.d.ts +3 -0
- package/dist/src/companion/WidgetCompanion.d.ts.map +1 -0
- package/dist/src/companion/__tests__/app-frame.spec.d.ts +2 -0
- package/dist/src/companion/__tests__/app-frame.spec.d.ts.map +1 -0
- package/dist/src/companion/__tests__/companion-dismissal.spec.d.ts +2 -0
- package/dist/src/companion/__tests__/companion-dismissal.spec.d.ts.map +1 -0
- package/dist/src/companion/__tests__/companion-focus.spec.d.ts +2 -0
- package/dist/src/companion/__tests__/companion-focus.spec.d.ts.map +1 -0
- package/dist/src/companion/__tests__/companion-frame.spec.d.ts +2 -0
- package/dist/src/companion/__tests__/companion-frame.spec.d.ts.map +1 -0
- package/dist/src/companion/__tests__/companion-geometry.spec.d.ts +2 -0
- package/dist/src/companion/__tests__/companion-geometry.spec.d.ts.map +1 -0
- package/dist/src/companion/__tests__/companion-keyboard.spec.d.ts +2 -0
- package/dist/src/companion/__tests__/companion-keyboard.spec.d.ts.map +1 -0
- package/dist/src/companion/__tests__/host-scroll-lock.spec.d.ts +2 -0
- package/dist/src/companion/__tests__/host-scroll-lock.spec.d.ts.map +1 -0
- package/dist/src/companion/__tests__/layout-picker.spec.d.ts +2 -0
- package/dist/src/companion/__tests__/layout-picker.spec.d.ts.map +1 -0
- package/dist/src/companion/__tests__/message-styles.spec.d.ts +2 -0
- package/dist/src/companion/__tests__/message-styles.spec.d.ts.map +1 -0
- package/dist/src/companion/__tests__/use-companion-host-effects.spec.d.ts +2 -0
- package/dist/src/companion/__tests__/use-companion-host-effects.spec.d.ts.map +1 -0
- package/dist/src/companion/__tests__/use-companion-measurements.spec.d.ts +2 -0
- package/dist/src/companion/__tests__/use-companion-measurements.spec.d.ts.map +1 -0
- package/dist/src/companion/__tests__/use-host-portal.spec.d.ts +2 -0
- package/dist/src/companion/__tests__/use-host-portal.spec.d.ts.map +1 -0
- package/dist/src/companion/__tests__/use-persisted-pill-drag.spec.d.ts +2 -0
- package/dist/src/companion/__tests__/use-persisted-pill-drag.spec.d.ts.map +1 -0
- package/dist/src/companion/app-frame.d.ts +13 -0
- package/dist/src/companion/app-frame.d.ts.map +1 -0
- package/dist/src/companion/companion-dismissal.d.ts +21 -0
- package/dist/src/companion/companion-dismissal.d.ts.map +1 -0
- package/dist/src/companion/companion-geometry.d.ts +101 -0
- package/dist/src/companion/companion-geometry.d.ts.map +1 -0
- package/dist/src/companion/companion-keyboard.d.ts +43 -0
- package/dist/src/companion/companion-keyboard.d.ts.map +1 -0
- package/dist/src/companion/host-scroll-lock.d.ts +5 -0
- package/dist/src/companion/host-scroll-lock.d.ts.map +1 -0
- package/dist/src/companion/layout-glyphs.d.ts +14 -0
- package/dist/src/companion/layout-glyphs.d.ts.map +1 -0
- package/dist/src/companion/message-styles.d.ts +2 -0
- package/dist/src/companion/message-styles.d.ts.map +1 -0
- package/dist/src/companion/types.d.ts +3 -0
- package/dist/src/companion/types.d.ts.map +1 -0
- package/dist/src/companion/useCompanionHostEffects.d.ts +46 -0
- package/dist/src/companion/useCompanionHostEffects.d.ts.map +1 -0
- package/dist/src/companion/useCompanionMeasurements.d.ts +12 -0
- package/dist/src/companion/useCompanionMeasurements.d.ts.map +1 -0
- package/dist/src/companion/useHostPortal.d.ts +22 -0
- package/dist/src/companion/useHostPortal.d.ts.map +1 -0
- package/dist/src/companion/usePersistedPillDrag.d.ts +29 -0
- package/dist/src/companion/usePersistedPillDrag.d.ts.map +1 -0
- package/dist/src/components/AgentAvatar.d.ts.map +1 -1
- package/dist/src/components/AgentMessageGroup.d.ts +6 -1
- package/dist/src/components/AgentMessageGroup.d.ts.map +1 -1
- package/dist/src/components/ClarificationQuestions.d.ts +17 -0
- package/dist/src/components/ClarificationQuestions.d.ts.map +1 -0
- package/dist/src/components/Dialoger.d.ts.map +1 -1
- package/dist/src/components/FrameDocument.d.ts +31 -0
- package/dist/src/components/FrameDocument.d.ts.map +1 -0
- package/dist/src/components/GroupTimestamp.d.ts.map +1 -1
- package/dist/src/components/Header.d.ts +7 -0
- package/dist/src/components/Header.d.ts.map +1 -1
- package/dist/src/components/MessageActions.d.ts +21 -0
- package/dist/src/components/MessageActions.d.ts.map +1 -0
- package/dist/src/components/RichText.d.ts.map +1 -1
- package/dist/src/components/StepsGroup.d.ts +10 -0
- package/dist/src/components/StepsGroup.d.ts.map +1 -0
- package/dist/src/components/StreamingTurn.d.ts +33 -0
- package/dist/src/components/StreamingTurn.d.ts.map +1 -0
- package/dist/src/components/UserMessage.d.ts.map +1 -1
- package/dist/src/components/ZoomableImage.d.ts +1 -1
- package/dist/src/components/ZoomableImage.d.ts.map +1 -1
- package/dist/src/components/__tests__/clarification-questions.spec.d.ts +2 -0
- package/dist/src/components/__tests__/clarification-questions.spec.d.ts.map +1 -0
- package/dist/src/components/__tests__/dialoger-escape.spec.d.ts +2 -0
- package/dist/src/components/__tests__/dialoger-escape.spec.d.ts.map +1 -0
- package/dist/src/components/__tests__/header-title.spec.d.ts +2 -0
- package/dist/src/components/__tests__/header-title.spec.d.ts.map +1 -0
- package/dist/src/components/__tests__/message-actions.spec.d.ts +2 -0
- package/dist/src/components/__tests__/message-actions.spec.d.ts.map +1 -0
- package/dist/src/components/__tests__/rich-text-sanitize.spec.d.ts +2 -0
- package/dist/src/components/__tests__/rich-text-sanitize.spec.d.ts.map +1 -0
- package/dist/src/components/__tests__/steps-group-collapse.spec.d.ts +2 -0
- package/dist/src/components/__tests__/steps-group-collapse.spec.d.ts.map +1 -0
- package/dist/src/components/__tests__/steps-reasoning-markdown.spec.d.ts +2 -0
- package/dist/src/components/__tests__/steps-reasoning-markdown.spec.d.ts.map +1 -0
- package/dist/src/components/__tests__/steps-tool-io.spec.d.ts +2 -0
- package/dist/src/components/__tests__/steps-tool-io.spec.d.ts.map +1 -0
- package/dist/src/components/__tests__/streaming-turn-customization.spec.d.ts +2 -0
- package/dist/src/components/__tests__/streaming-turn-customization.spec.d.ts.map +1 -0
- package/dist/src/components/__tests__/streaming-turn-working.spec.d.ts +2 -0
- package/dist/src/components/__tests__/streaming-turn-working.spec.d.ts.map +1 -0
- package/dist/src/components/custom-components/AgentMessageDefaultComponent.d.ts.map +1 -1
- package/dist/src/components/custom-components/__tests__/agent-message-spec-history.spec.d.ts +2 -0
- package/dist/src/components/custom-components/__tests__/agent-message-spec-history.spec.d.ts.map +1 -0
- package/dist/src/components/lib/BrailleSpinner.d.ts +10 -0
- package/dist/src/components/lib/BrailleSpinner.d.ts.map +1 -0
- package/dist/src/components/lib/DynamicIcon.d.ts.map +1 -1
- package/dist/src/components/lib/MotionDiv.d.ts.map +1 -1
- package/dist/src/components/lib/MotionDiv__VerticalReveal.d.ts.map +1 -1
- package/dist/src/components/lib/badge.d.ts +1 -1
- package/dist/src/components/lib/button.d.ts +2 -2
- package/dist/src/components/lib/input.d.ts.map +1 -1
- package/dist/src/components/lib/tooltip.d.ts +18 -2
- package/dist/src/components/lib/tooltip.d.ts.map +1 -1
- package/dist/src/hooks/useCanHover.d.ts +8 -0
- package/dist/src/hooks/useCanHover.d.ts.map +1 -0
- package/dist/src/hooks/useTheme.d.ts +17 -2
- package/dist/src/hooks/useTheme.d.ts.map +1 -1
- package/dist/src/hooks/useTranslation.d.ts +3 -2
- package/dist/src/hooks/useTranslation.d.ts.map +1 -1
- package/dist/src/hooks/useTriggerLabel.d.ts +6 -0
- package/dist/src/hooks/useTriggerLabel.d.ts.map +1 -0
- package/dist/src/index.d.ts +12 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/json-render/Chart.d.ts +4 -0
- package/dist/src/json-render/Chart.d.ts.map +1 -0
- package/dist/src/json-render/Chart.impl.d.ts +4 -0
- package/dist/src/json-render/Chart.impl.d.ts.map +1 -0
- package/dist/src/json-render/JsonRenderErrorBoundary.d.ts +27 -0
- package/dist/src/json-render/JsonRenderErrorBoundary.d.ts.map +1 -0
- package/dist/src/json-render/SpecRenderer.d.ts +28 -0
- package/dist/src/json-render/SpecRenderer.d.ts.map +1 -0
- package/dist/src/json-render/__tests__/catalog.spec.d.ts +2 -0
- package/dist/src/json-render/__tests__/catalog.spec.d.ts.map +1 -0
- package/dist/src/json-render/__tests__/chart.spec.d.ts +2 -0
- package/dist/src/json-render/__tests__/chart.spec.d.ts.map +1 -0
- package/dist/src/json-render/__tests__/json-render-error-boundary.spec.d.ts +2 -0
- package/dist/src/json-render/__tests__/json-render-error-boundary.spec.d.ts.map +1 -0
- package/dist/src/json-render/__tests__/normalize-spec.spec.d.ts +2 -0
- package/dist/src/json-render/__tests__/normalize-spec.spec.d.ts.map +1 -0
- package/dist/src/json-render/__tests__/phone-agent-card.spec.d.ts +2 -0
- package/dist/src/json-render/__tests__/phone-agent-card.spec.d.ts.map +1 -0
- package/dist/src/json-render/__tests__/props.spec.d.ts +2 -0
- package/dist/src/json-render/__tests__/props.spec.d.ts.map +1 -0
- package/dist/src/json-render/__tests__/segment-content.spec.d.ts +2 -0
- package/dist/src/json-render/__tests__/segment-content.spec.d.ts.map +1 -0
- package/dist/src/json-render/__tests__/spec-renderer.spec.d.ts +2 -0
- package/dist/src/json-render/__tests__/spec-renderer.spec.d.ts.map +1 -0
- package/dist/src/json-render/catalog.d.ts +260 -0
- package/dist/src/json-render/catalog.d.ts.map +1 -0
- package/dist/src/json-render/host.d.ts +27 -0
- package/dist/src/json-render/host.d.ts.map +1 -0
- package/dist/src/json-render/index.d.ts +12 -0
- package/dist/src/json-render/index.d.ts.map +1 -0
- package/dist/src/json-render/normalize-spec.d.ts +22 -0
- package/dist/src/json-render/normalize-spec.d.ts.map +1 -0
- package/dist/src/json-render/props.d.ts +207 -0
- package/dist/src/json-render/props.d.ts.map +1 -0
- package/dist/src/json-render/registry.d.ts +5 -0
- package/dist/src/json-render/registry.d.ts.map +1 -0
- package/dist/src/json-render/segment-content.d.ts +25 -0
- package/dist/src/json-render/segment-content.d.ts.map +1 -0
- package/dist/src/json-render/ui-prompt.d.ts +22 -0
- package/dist/src/json-render/ui-prompt.d.ts.map +1 -0
- package/dist/src/motion.d.ts +55 -0
- package/dist/src/motion.d.ts.map +1 -0
- package/dist/src/page-context/PageContextPill.d.ts +17 -0
- package/dist/src/page-context/PageContextPill.d.ts.map +1 -0
- package/dist/src/page-context/usePageEntity.d.ts +15 -0
- package/dist/src/page-context/usePageEntity.d.ts.map +1 -0
- package/dist/src/page-marks/MarkThumbnail.d.ts +19 -0
- package/dist/src/page-marks/MarkThumbnail.d.ts.map +1 -0
- package/dist/src/page-marks/PageMarkOverlay.d.ts +23 -0
- package/dist/src/page-marks/PageMarkOverlay.d.ts.map +1 -0
- package/dist/src/page-marks/PageMarkPill.d.ts +16 -0
- package/dist/src/page-marks/PageMarkPill.d.ts.map +1 -0
- package/dist/src/page-marks/PageMarksProvider.d.ts +21 -0
- package/dist/src/page-marks/PageMarksProvider.d.ts.map +1 -0
- package/dist/src/page-marks/SentMarkChip.d.ts +15 -0
- package/dist/src/page-marks/SentMarkChip.d.ts.map +1 -0
- package/dist/src/page-marks/__tests__/agent-mark.spec.d.ts +2 -0
- package/dist/src/page-marks/__tests__/agent-mark.spec.d.ts.map +1 -0
- package/dist/src/page-marks/__tests__/mark-snapshot-upload.spec.d.ts +2 -0
- package/dist/src/page-marks/__tests__/mark-snapshot-upload.spec.d.ts.map +1 -0
- package/dist/src/page-marks/__tests__/page-element-name.spec.d.ts +2 -0
- package/dist/src/page-marks/__tests__/page-element-name.spec.d.ts.map +1 -0
- package/dist/src/page-marks/__tests__/page-element.spec.d.ts +2 -0
- package/dist/src/page-marks/__tests__/page-element.spec.d.ts.map +1 -0
- package/dist/src/page-marks/__tests__/page-mark-pill.spec.d.ts +2 -0
- package/dist/src/page-marks/__tests__/page-mark-pill.spec.d.ts.map +1 -0
- package/dist/src/page-marks/__tests__/page-mark-theme.spec.d.ts +2 -0
- package/dist/src/page-marks/__tests__/page-mark-theme.spec.d.ts.map +1 -0
- package/dist/src/page-marks/__tests__/page-mark-tile.spec.d.ts +2 -0
- package/dist/src/page-marks/__tests__/page-mark-tile.spec.d.ts.map +1 -0
- package/dist/src/page-marks/__tests__/page-marks-provider.spec.d.ts +2 -0
- package/dist/src/page-marks/__tests__/page-marks-provider.spec.d.ts.map +1 -0
- package/dist/src/page-marks/__tests__/picked-elements.spec.d.ts +2 -0
- package/dist/src/page-marks/__tests__/picked-elements.spec.d.ts.map +1 -0
- package/dist/src/page-marks/__tests__/sent-mark-chip.spec.d.ts +2 -0
- package/dist/src/page-marks/__tests__/sent-mark-chip.spec.d.ts.map +1 -0
- package/dist/src/page-marks/__tests__/use-page-marking.spec.d.ts +2 -0
- package/dist/src/page-marks/__tests__/use-page-marking.spec.d.ts.map +1 -0
- package/dist/src/page-marks/agent-mark.d.ts +37 -0
- package/dist/src/page-marks/agent-mark.d.ts.map +1 -0
- package/dist/src/page-marks/mark-thumbnail.d.ts +25 -0
- package/dist/src/page-marks/mark-thumbnail.d.ts.map +1 -0
- package/dist/src/page-marks/page-element.d.ts +89 -0
- package/dist/src/page-marks/page-element.d.ts.map +1 -0
- package/dist/src/page-marks/page-mark-theme.d.ts +30 -0
- package/dist/src/page-marks/page-mark-theme.d.ts.map +1 -0
- package/dist/src/page-marks/page-mark.d.ts +103 -0
- package/dist/src/page-marks/page-mark.d.ts.map +1 -0
- package/dist/src/page-marks/useMarkThumbnail.d.ts +8 -0
- package/dist/src/page-marks/useMarkThumbnail.d.ts.map +1 -0
- package/dist/src/page-marks/usePageMarking.d.ts +53 -0
- package/dist/src/page-marks/usePageMarking.d.ts.map +1 -0
- package/dist/src/screens/chat/ChatCanvas.d.ts.map +1 -1
- package/dist/src/screens/chat/ChatFooter.d.ts.map +1 -1
- package/dist/src/screens/chat/ChatFooterItems.d.ts.map +1 -1
- package/dist/src/screens/chat/ChatInput.d.ts +27 -0
- package/dist/src/screens/chat/ChatInput.d.ts.map +1 -0
- package/dist/src/screens/chat/ChatMain.d.ts.map +1 -1
- package/dist/src/screens/chat/DictationMicButton.d.ts +18 -0
- package/dist/src/screens/chat/DictationMicButton.d.ts.map +1 -0
- package/dist/src/screens/chat/InitialMessages.d.ts +7 -1
- package/dist/src/screens/chat/InitialMessages.d.ts.map +1 -1
- package/dist/src/screens/chat/MentionPicker.d.ts +39 -0
- package/dist/src/screens/chat/MentionPicker.d.ts.map +1 -0
- package/dist/src/screens/chat/MentionText.d.ts +16 -0
- package/dist/src/screens/chat/MentionText.d.ts.map +1 -0
- package/dist/src/screens/chat/MessageGroups.d.ts +12 -0
- package/dist/src/screens/chat/MessageGroups.d.ts.map +1 -0
- package/dist/src/screens/chat/UploadPreview.d.ts +23 -0
- package/dist/src/screens/chat/UploadPreview.d.ts.map +1 -0
- package/dist/src/screens/chat/__tests__/chat-input-clarification.spec.d.ts +2 -0
- package/dist/src/screens/chat/__tests__/chat-input-clarification.spec.d.ts.map +1 -0
- package/dist/src/screens/chat/__tests__/chatInput.spec.d.ts +2 -0
- package/dist/src/screens/chat/__tests__/chatInput.spec.d.ts.map +1 -0
- package/dist/src/screens/chat/__tests__/use-mentions.spec.d.ts +2 -0
- package/dist/src/screens/chat/__tests__/use-mentions.spec.d.ts.map +1 -0
- package/dist/src/screens/chat/__tests__/useSentTextRecall.spec.d.ts +2 -0
- package/dist/src/screens/chat/__tests__/useSentTextRecall.spec.d.ts.map +1 -0
- package/dist/src/screens/chat/agent/AgentChatMain.d.ts +16 -0
- package/dist/src/screens/chat/agent/AgentChatMain.d.ts.map +1 -0
- package/dist/src/screens/chat/agent/AgentChatPageEffects.d.ts +9 -0
- package/dist/src/screens/chat/agent/AgentChatPageEffects.d.ts.map +1 -0
- package/dist/src/screens/chat/agent/QueuedSendsPill.d.ts +18 -0
- package/dist/src/screens/chat/agent/QueuedSendsPill.d.ts.map +1 -0
- package/dist/src/screens/chat/agent/__tests__/agent-chat-main.promotion.spec.d.ts +2 -0
- package/dist/src/screens/chat/agent/__tests__/agent-chat-main.promotion.spec.d.ts.map +1 -0
- package/dist/src/screens/chat/agent/__tests__/agent-chat-page-effects.spec.d.ts +2 -0
- package/dist/src/screens/chat/agent/__tests__/agent-chat-page-effects.spec.d.ts.map +1 -0
- package/dist/src/screens/chat/agent/__tests__/scroll-follow.utils.spec.d.ts +2 -0
- package/dist/src/screens/chat/agent/__tests__/scroll-follow.utils.spec.d.ts.map +1 -0
- package/dist/src/screens/chat/agent/__tests__/useStreamFollow.spec.d.ts +2 -0
- package/dist/src/screens/chat/agent/__tests__/useStreamFollow.spec.d.ts.map +1 -0
- package/dist/src/screens/chat/agent/scroll-follow.utils.d.ts +17 -0
- package/dist/src/screens/chat/agent/scroll-follow.utils.d.ts.map +1 -0
- package/dist/src/screens/chat/agent/useStreamFollow.d.ts +23 -0
- package/dist/src/screens/chat/agent/useStreamFollow.d.ts.map +1 -0
- package/dist/src/screens/chat/caret-position.d.ts +19 -0
- package/dist/src/screens/chat/caret-position.d.ts.map +1 -0
- package/dist/src/screens/chat/composer-styles.d.ts +21 -0
- package/dist/src/screens/chat/composer-styles.d.ts.map +1 -0
- package/dist/src/screens/chat/index.d.ts.map +1 -1
- package/dist/src/screens/chat/useMentions.d.ts +60 -0
- package/dist/src/screens/chat/useMentions.d.ts.map +1 -0
- package/dist/src/screens/chat/usePageMarkComposer.d.ts +25 -0
- package/dist/src/screens/chat/usePageMarkComposer.d.ts.map +1 -0
- package/dist/src/screens/chat/useSentTextRecall.d.ts +29 -0
- package/dist/src/screens/chat/useSentTextRecall.d.ts.map +1 -0
- package/dist/src/screens/sessions/index.d.ts.map +1 -1
- package/dist/src/utils/__tests__/keybindings.spec.d.ts +2 -0
- package/dist/src/utils/__tests__/keybindings.spec.d.ts.map +1 -0
- package/dist/src/utils/__tests__/strip-citation-refs.spec.d.ts +2 -0
- package/dist/src/utils/__tests__/strip-citation-refs.spec.d.ts.map +1 -0
- package/dist/src/utils/__tests__/strip-inline-markdown.spec.d.ts +2 -0
- package/dist/src/utils/__tests__/strip-inline-markdown.spec.d.ts.map +1 -0
- package/dist/src/utils/group-messages-by-type.d.ts +1 -2
- package/dist/src/utils/group-messages-by-type.d.ts.map +1 -1
- package/dist/src/utils/keybindings.d.ts +24 -0
- package/dist/src/utils/keybindings.d.ts.map +1 -0
- package/dist/src/utils/render-custom-trigger.d.ts +11 -0
- package/dist/src/utils/render-custom-trigger.d.ts.map +1 -0
- package/dist/src/utils/strip-citation-refs.d.ts +10 -0
- package/dist/src/utils/strip-citation-refs.d.ts.map +1 -0
- package/dist/src/utils/strip-inline-markdown.d.ts +14 -0
- package/dist/src/utils/strip-inline-markdown.d.ts.map +1 -0
- package/package.json +16 -6
- package/dist/src/components/lib/dropdown-menu.d.ts +0 -28
- package/dist/src/components/lib/dropdown-menu.d.ts.map +0 -1
- package/dist/src/components/lib/popover.d.ts +0 -9
- package/dist/src/components/lib/popover.d.ts.map +0 -1
- package/dist/src/components/lib/switch.d.ts +0 -5
- package/dist/src/components/lib/switch.d.ts.map +0 -1
- package/dist/src/screens/chat/AdvancedInitialMessages.d.ts +0 -3
- package/dist/src/screens/chat/AdvancedInitialMessages.d.ts.map +0 -1
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import d from "react";
|
|
3
|
+
import { PieChart as b, Tooltip as f, Legend as S, Pie as k, Cell as C, Label as R, LineChart as v, CartesianGrid as p, XAxis as y, YAxis as g, Line as z, BarChart as O, Bar as _ } from "recharts";
|
|
4
|
+
import { u as K } from "./index-BCiFOCVT.js";
|
|
5
|
+
function A() {
|
|
6
|
+
const t = d.useRef(null), [n, c] = d.useState(0);
|
|
7
|
+
return d.useLayoutEffect(() => {
|
|
8
|
+
const r = t.current;
|
|
9
|
+
if (!r) return;
|
|
10
|
+
const i = () => c(r.clientWidth);
|
|
11
|
+
i();
|
|
12
|
+
const l = new ResizeObserver(i);
|
|
13
|
+
return l.observe(r), () => l.disconnect();
|
|
14
|
+
}, []), { ref: t, width: n };
|
|
15
|
+
}
|
|
16
|
+
const L = "hsl(var(--opencx-foreground, 240 10% 20%))", x = [90, 70, 50, 30].map(
|
|
17
|
+
(t) => `color-mix(in oklch, ${L} ${t}%, transparent)`
|
|
18
|
+
), u = (t) => x[t % x.length] ?? L, h = {
|
|
19
|
+
borderRadius: 8,
|
|
20
|
+
border: "1px solid color-mix(in oklch, currentColor 15%, transparent)",
|
|
21
|
+
fontSize: 12
|
|
22
|
+
};
|
|
23
|
+
function P({
|
|
24
|
+
type: t,
|
|
25
|
+
data: n,
|
|
26
|
+
height: c,
|
|
27
|
+
centerLabel: r
|
|
28
|
+
}) {
|
|
29
|
+
const i = c ?? 220, { ref: l, width: a } = A();
|
|
30
|
+
return n.length === 0 ? /* @__PURE__ */ e(T, { height: i }) : /* @__PURE__ */ e("div", { ref: l, className: "w-full text-foreground", style: { height: i }, children: a > 0 && (t === "pie" ? /* @__PURE__ */ s(b, { width: a, height: i, children: [
|
|
31
|
+
/* @__PURE__ */ e(f, { contentStyle: h }),
|
|
32
|
+
/* @__PURE__ */ e(
|
|
33
|
+
S,
|
|
34
|
+
{
|
|
35
|
+
verticalAlign: "bottom",
|
|
36
|
+
iconType: "circle",
|
|
37
|
+
iconSize: 8,
|
|
38
|
+
wrapperStyle: { fontSize: 12 }
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
/* @__PURE__ */ s(
|
|
42
|
+
k,
|
|
43
|
+
{
|
|
44
|
+
data: n,
|
|
45
|
+
dataKey: "value",
|
|
46
|
+
nameKey: "label",
|
|
47
|
+
outerRadius: "85%",
|
|
48
|
+
innerRadius: "60%",
|
|
49
|
+
children: [
|
|
50
|
+
n.map((o, m) => /* @__PURE__ */ e(C, { fill: u(m) }, m)),
|
|
51
|
+
r && /* @__PURE__ */ e(
|
|
52
|
+
R,
|
|
53
|
+
{
|
|
54
|
+
position: "center",
|
|
55
|
+
content: ({ viewBox: o }) => {
|
|
56
|
+
if (o && "cx" in o && "cy" in o)
|
|
57
|
+
return /* @__PURE__ */ e(
|
|
58
|
+
"text",
|
|
59
|
+
{
|
|
60
|
+
x: o.cx,
|
|
61
|
+
y: o.cy,
|
|
62
|
+
textAnchor: "middle",
|
|
63
|
+
dominantBaseline: "middle",
|
|
64
|
+
className: "fill-foreground text-2xl font-medium",
|
|
65
|
+
children: r
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] }) : t === "line" ? /* @__PURE__ */ s(
|
|
75
|
+
v,
|
|
76
|
+
{
|
|
77
|
+
width: a,
|
|
78
|
+
height: i,
|
|
79
|
+
data: n,
|
|
80
|
+
margin: { top: 8, right: 8, bottom: 0, left: -16 },
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ e(p, { strokeOpacity: 0.15, vertical: !1 }),
|
|
83
|
+
/* @__PURE__ */ e(
|
|
84
|
+
y,
|
|
85
|
+
{
|
|
86
|
+
dataKey: "label",
|
|
87
|
+
tickLine: !1,
|
|
88
|
+
axisLine: !1,
|
|
89
|
+
tickMargin: 10,
|
|
90
|
+
fontSize: 11
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
/* @__PURE__ */ e(g, { tickLine: !1, axisLine: !1, fontSize: 11, width: 32 }),
|
|
94
|
+
/* @__PURE__ */ e(f, { contentStyle: h }),
|
|
95
|
+
/* @__PURE__ */ e(
|
|
96
|
+
z,
|
|
97
|
+
{
|
|
98
|
+
type: "monotone",
|
|
99
|
+
dataKey: "value",
|
|
100
|
+
stroke: u(0),
|
|
101
|
+
strokeWidth: 2,
|
|
102
|
+
dot: !1
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
) : /* @__PURE__ */ s(
|
|
108
|
+
O,
|
|
109
|
+
{
|
|
110
|
+
width: a,
|
|
111
|
+
height: i,
|
|
112
|
+
data: n,
|
|
113
|
+
margin: { top: 8, right: 8, bottom: 0, left: -16 },
|
|
114
|
+
children: [
|
|
115
|
+
/* @__PURE__ */ e(p, { strokeOpacity: 0.15, vertical: !1 }),
|
|
116
|
+
/* @__PURE__ */ e(
|
|
117
|
+
y,
|
|
118
|
+
{
|
|
119
|
+
dataKey: "label",
|
|
120
|
+
tickLine: !1,
|
|
121
|
+
axisLine: !1,
|
|
122
|
+
tickMargin: 10,
|
|
123
|
+
fontSize: 11
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
/* @__PURE__ */ e(g, { tickLine: !1, axisLine: !1, fontSize: 11, width: 32 }),
|
|
127
|
+
/* @__PURE__ */ e(
|
|
128
|
+
f,
|
|
129
|
+
{
|
|
130
|
+
contentStyle: h,
|
|
131
|
+
cursor: { fillOpacity: 0.06 }
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
/* @__PURE__ */ e(_, { dataKey: "value", fill: u(0), radius: [4, 4, 0, 0] })
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
)) });
|
|
138
|
+
}
|
|
139
|
+
function T({ height: t }) {
|
|
140
|
+
const { t: n } = K();
|
|
141
|
+
return /* @__PURE__ */ e(
|
|
142
|
+
"div",
|
|
143
|
+
{
|
|
144
|
+
className: "flex w-full items-center justify-center rounded-lg border border-muted-foreground/15 text-xs text-muted-foreground",
|
|
145
|
+
style: { height: t },
|
|
146
|
+
children: n("json_no_chart_data")
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
export {
|
|
151
|
+
P as default
|
|
152
|
+
};
|
|
153
|
+
//# sourceMappingURL=Chart.impl-BnzKZLOH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chart.impl-BnzKZLOH.js","sources":["../src/json-render/Chart.impl.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Bar,\n BarChart,\n CartesianGrid,\n Cell,\n Label,\n Legend,\n Line,\n LineChart,\n Pie,\n PieChart,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts';\nimport type { ChartProps } from './props';\nimport { useJsonRenderHost } from './host';\n\n/**\n * Measure the wrapper width ourselves instead of relying on recharts'\n * `ResponsiveContainer`. On recharts 2.12 that container renders an empty,\n * svg-less box whenever it mounts measuring 0 — which is exactly this case: the\n * chart is a `React.lazy` chunk that mounts after the widget popover has laid\n * out, and it never re-measures on its own. Feeding recharts an explicit numeric\n * width sidesteps the trap; the `ResizeObserver` keeps it in sync when the embed\n * is resized.\n */\nfunction useContainerWidth(): {\n ref: React.RefObject<HTMLDivElement | null>;\n width: number;\n} {\n const ref = React.useRef<HTMLDivElement>(null);\n const [width, setWidth] = React.useState(0);\n React.useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n const update = () => setWidth(el.clientWidth);\n update();\n const observer = new ResizeObserver(update);\n observer.observe(el);\n return () => observer.disconnect();\n }, []);\n return { ref, width };\n}\n\n/**\n * The actual chart renderer. Loaded lazily (see `Chart.tsx`) so recharts — the\n * one heavy dependency in the registry — is a separate chunk that only downloads\n * when the agent actually emits a Chart.\n *\n * Styled to match the companion/Impact-Dashboard charts: a monochrome ramp of\n * the theme foreground (90/70/50/30% alpha), donut pie with an optional center\n * label + legend, and clean axes (no tick/axis lines). The ramp reads the\n * widget's `--opencx-foreground` token so charts follow the embed theme, with\n * a neutral fallback for any context where the token is missing.\n */\n\nconst FOREGROUND = 'hsl(var(--opencx-foreground, 240 10% 20%))';\n// Same ramp as the dashboard's REPORTS_COLOR (surface-foreground at 90/70/50/30%).\nconst RAMP = [90, 70, 50, 30].map(\n (pct) => `color-mix(in oklch, ${FOREGROUND} ${pct}%, transparent)`,\n);\nconst rampColor = (i: number): string => RAMP[i % RAMP.length] ?? FOREGROUND;\n\nconst TOOLTIP_STYLE: React.CSSProperties = {\n borderRadius: 8,\n border: '1px solid color-mix(in oklch, currentColor 15%, transparent)',\n fontSize: 12,\n};\n\nexport default function ChartImpl({\n type,\n data,\n height,\n centerLabel,\n}: ChartProps) {\n const h = height ?? 220;\n const { ref, width } = useContainerWidth();\n\n if (data.length === 0) {\n return <ChartEmpty height={h} />;\n }\n\n return (\n <div ref={ref} className=\"w-full text-foreground\" style={{ height: h }}>\n {width > 0 &&\n (type === 'pie' ? (\n <PieChart width={width} height={h}>\n <Tooltip contentStyle={TOOLTIP_STYLE} />\n <Legend\n verticalAlign=\"bottom\"\n iconType=\"circle\"\n iconSize={8}\n wrapperStyle={{ fontSize: 12 }}\n />\n <Pie\n data={data}\n dataKey=\"value\"\n nameKey=\"label\"\n outerRadius=\"85%\"\n innerRadius=\"60%\"\n >\n {data.map((_, i) => (\n <Cell key={i} fill={rampColor(i)} />\n ))}\n {centerLabel && (\n <Label\n position=\"center\"\n content={({ viewBox }) => {\n if (viewBox && 'cx' in viewBox && 'cy' in viewBox) {\n return (\n <text\n x={viewBox.cx}\n y={viewBox.cy}\n textAnchor=\"middle\"\n dominantBaseline=\"middle\"\n className=\"fill-foreground text-2xl font-medium\"\n >\n {centerLabel}\n </text>\n );\n }\n }}\n />\n )}\n </Pie>\n </PieChart>\n ) : type === 'line' ? (\n <LineChart\n width={width}\n height={h}\n data={data}\n margin={{ top: 8, right: 8, bottom: 0, left: -16 }}\n >\n <CartesianGrid strokeOpacity={0.15} vertical={false} />\n <XAxis\n dataKey=\"label\"\n tickLine={false}\n axisLine={false}\n tickMargin={10}\n fontSize={11}\n />\n <YAxis tickLine={false} axisLine={false} fontSize={11} width={32} />\n <Tooltip contentStyle={TOOLTIP_STYLE} />\n <Line\n type=\"monotone\"\n dataKey=\"value\"\n stroke={rampColor(0)}\n strokeWidth={2}\n dot={false}\n />\n </LineChart>\n ) : (\n <BarChart\n width={width}\n height={h}\n data={data}\n margin={{ top: 8, right: 8, bottom: 0, left: -16 }}\n >\n <CartesianGrid strokeOpacity={0.15} vertical={false} />\n <XAxis\n dataKey=\"label\"\n tickLine={false}\n axisLine={false}\n tickMargin={10}\n fontSize={11}\n />\n <YAxis tickLine={false} axisLine={false} fontSize={11} width={32} />\n <Tooltip\n contentStyle={TOOLTIP_STYLE}\n cursor={{ fillOpacity: 0.06 }}\n />\n <Bar dataKey=\"value\" fill={rampColor(0)} radius={[4, 4, 0, 0]} />\n </BarChart>\n ))}\n </div>\n );\n}\n\nfunction ChartEmpty({ height }: { height: number }) {\n const { t } = useJsonRenderHost();\n return (\n <div\n className=\"flex w-full items-center justify-center rounded-lg border border-muted-foreground/15 text-xs text-muted-foreground\"\n style={{ height }}\n >\n {t('json_no_chart_data')}\n </div>\n );\n}\n"],"names":["useContainerWidth","ref","React","width","setWidth","el","update","observer","FOREGROUND","RAMP","pct","rampColor","i","TOOLTIP_STYLE","ChartImpl","type","data","height","centerLabel","h","jsx","ChartEmpty","PieChart","Tooltip","Legend","jsxs","Pie","_","Cell","Label","viewBox","LineChart","CartesianGrid","XAxis","YAxis","Line","BarChart","Bar","t","useJsonRenderHost"],"mappings":";;;;AA4BA,SAASA,IAGP;AACA,QAAMC,IAAMC,EAAM,OAAuB,IAAI,GACvC,CAACC,GAAOC,CAAQ,IAAIF,EAAM,SAAS,CAAC;AAC1CA,SAAAA,EAAM,gBAAgB,MAAM;AAC1B,UAAMG,IAAKJ,EAAI;AACf,QAAI,CAACI,EAAI;AACT,UAAMC,IAAS,MAAMF,EAASC,EAAG,WAAW;AAC5C,IAAAC,EAAA;AACA,UAAMC,IAAW,IAAI,eAAeD,CAAM;AAC1C,WAAAC,EAAS,QAAQF,CAAE,GACZ,MAAME,EAAS,WAAA;AAAA,EACxB,GAAG,CAAA,CAAE,GACE,EAAE,KAAAN,GAAK,OAAAE,EAAA;AAChB;AAcA,MAAMK,IAAa,8CAEbC,IAAO,CAAC,IAAI,IAAI,IAAI,EAAE,EAAE;AAAA,EAC5B,CAACC,MAAQ,uBAAuBF,CAAU,IAAIE,CAAG;AACnD,GACMC,IAAY,CAACC,MAAsBH,EAAKG,IAAIH,EAAK,MAAM,KAAKD,GAE5DK,IAAqC;AAAA,EACzC,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,UAAU;AACZ;AAEA,SAAwBC,EAAU;AAAA,EAChC,MAAA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AAA,UAAA;AAAA,QAAA;AAAA,QAEZ,gBAAAb,EAACc,KAAM,UAAU,IAAO,UAAU,IAAO,UAAU,IAAI,OAAO,GAAA,CAAI;AAAA,QAClE,gBAAAd;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,cAAcV;AAAA,YACd,QAAQ,EAAE,aAAa,KAAA;AAAA,UAAK;AAAA,QAAA;AAAA,QAE9B,gBAAAO,EAACiB,GAAA,EAAI,SAAQ,SAAQ,MAAM1B,EAAU,CAAC,GAAG,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC,EAAA,CAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAGvE;AAEJ;AAEA,SAASU,EAAW,EAAE,QAAAJ,KAA8B;AAClD,QAAM,EAAE,GAAAqB,EAAA,IAAMC,EAAA;AACd,SACE,gBAAAnB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,OAAO,EAAE,QAAAH,EAAA;AAAA,MAER,YAAE,oBAAoB;AAAA,IAAA;AAAA,EAAA;AAG7B;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),t=require("recharts"),j=require("./index-CqbztkwP.cjs");function p(){const i=d.useRef(null),[n,c]=d.useState(0);return d.useLayoutEffect(()=>{const s=i.current;if(!s)return;const r=()=>c(s.clientWidth);r();const l=new ResizeObserver(r);return l.observe(s),()=>l.disconnect()},[]),{ref:i,width:n}}const m="hsl(var(--opencx-foreground, 240 10% 20%))",h=[90,70,50,30].map(i=>`color-mix(in oklch, ${m} ${i}%, transparent)`),u=i=>h[i%h.length]??m,f={borderRadius:8,border:"1px solid color-mix(in oklch, currentColor 15%, transparent)",fontSize:12};function y({type:i,data:n,height:c,centerLabel:s}){const r=c??220,{ref:l,width:a}=p();return n.length===0?e.jsx(g,{height:r}):e.jsx("div",{ref:l,className:"w-full text-foreground",style:{height:r},children:a>0&&(i==="pie"?e.jsxs(t.PieChart,{width:a,height:r,children:[e.jsx(t.Tooltip,{contentStyle:f}),e.jsx(t.Legend,{verticalAlign:"bottom",iconType:"circle",iconSize:8,wrapperStyle:{fontSize:12}}),e.jsxs(t.Pie,{data:n,dataKey:"value",nameKey:"label",outerRadius:"85%",innerRadius:"60%",children:[n.map((o,x)=>e.jsx(t.Cell,{fill:u(x)},x)),s&&e.jsx(t.Label,{position:"center",content:({viewBox:o})=>{if(o&&"cx"in o&&"cy"in o)return e.jsx("text",{x:o.cx,y:o.cy,textAnchor:"middle",dominantBaseline:"middle",className:"fill-foreground text-2xl font-medium",children:s})}})]})]}):i==="line"?e.jsxs(t.LineChart,{width:a,height:r,data:n,margin:{top:8,right:8,bottom:0,left:-16},children:[e.jsx(t.CartesianGrid,{strokeOpacity:.15,vertical:!1}),e.jsx(t.XAxis,{dataKey:"label",tickLine:!1,axisLine:!1,tickMargin:10,fontSize:11}),e.jsx(t.YAxis,{tickLine:!1,axisLine:!1,fontSize:11,width:32}),e.jsx(t.Tooltip,{contentStyle:f}),e.jsx(t.Line,{type:"monotone",dataKey:"value",stroke:u(0),strokeWidth:2,dot:!1})]}):e.jsxs(t.BarChart,{width:a,height:r,data:n,margin:{top:8,right:8,bottom:0,left:-16},children:[e.jsx(t.CartesianGrid,{strokeOpacity:.15,vertical:!1}),e.jsx(t.XAxis,{dataKey:"label",tickLine:!1,axisLine:!1,tickMargin:10,fontSize:11}),e.jsx(t.YAxis,{tickLine:!1,axisLine:!1,fontSize:11,width:32}),e.jsx(t.Tooltip,{contentStyle:f,cursor:{fillOpacity:.06}}),e.jsx(t.Bar,{dataKey:"value",fill:u(0),radius:[4,4,0,0]})]}))})}function g({height:i}){const{t:n}=j.useJsonRenderHost();return e.jsx("div",{className:"flex w-full items-center justify-center rounded-lg border border-muted-foreground/15 text-xs text-muted-foreground",style:{height:i},children:n("json_no_chart_data")})}exports.default=y;
|
|
2
|
+
//# sourceMappingURL=Chart.impl-DOSb1NJk.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chart.impl-DOSb1NJk.cjs","sources":["../src/json-render/Chart.impl.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Bar,\n BarChart,\n CartesianGrid,\n Cell,\n Label,\n Legend,\n Line,\n LineChart,\n Pie,\n PieChart,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts';\nimport type { ChartProps } from './props';\nimport { useJsonRenderHost } from './host';\n\n/**\n * Measure the wrapper width ourselves instead of relying on recharts'\n * `ResponsiveContainer`. On recharts 2.12 that container renders an empty,\n * svg-less box whenever it mounts measuring 0 — which is exactly this case: the\n * chart is a `React.lazy` chunk that mounts after the widget popover has laid\n * out, and it never re-measures on its own. Feeding recharts an explicit numeric\n * width sidesteps the trap; the `ResizeObserver` keeps it in sync when the embed\n * is resized.\n */\nfunction useContainerWidth(): {\n ref: React.RefObject<HTMLDivElement | null>;\n width: number;\n} {\n const ref = React.useRef<HTMLDivElement>(null);\n const [width, setWidth] = React.useState(0);\n React.useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n const update = () => setWidth(el.clientWidth);\n update();\n const observer = new ResizeObserver(update);\n observer.observe(el);\n return () => observer.disconnect();\n }, []);\n return { ref, width };\n}\n\n/**\n * The actual chart renderer. Loaded lazily (see `Chart.tsx`) so recharts — the\n * one heavy dependency in the registry — is a separate chunk that only downloads\n * when the agent actually emits a Chart.\n *\n * Styled to match the companion/Impact-Dashboard charts: a monochrome ramp of\n * the theme foreground (90/70/50/30% alpha), donut pie with an optional center\n * label + legend, and clean axes (no tick/axis lines). The ramp reads the\n * widget's `--opencx-foreground` token so charts follow the embed theme, with\n * a neutral fallback for any context where the token is missing.\n */\n\nconst FOREGROUND = 'hsl(var(--opencx-foreground, 240 10% 20%))';\n// Same ramp as the dashboard's REPORTS_COLOR (surface-foreground at 90/70/50/30%).\nconst RAMP = [90, 70, 50, 30].map(\n (pct) => `color-mix(in oklch, ${FOREGROUND} ${pct}%, transparent)`,\n);\nconst rampColor = (i: number): string => RAMP[i % RAMP.length] ?? FOREGROUND;\n\nconst TOOLTIP_STYLE: React.CSSProperties = {\n borderRadius: 8,\n border: '1px solid color-mix(in oklch, currentColor 15%, transparent)',\n fontSize: 12,\n};\n\nexport default function ChartImpl({\n type,\n data,\n height,\n centerLabel,\n}: ChartProps) {\n const h = height ?? 220;\n const { ref, width } = useContainerWidth();\n\n if (data.length === 0) {\n return <ChartEmpty height={h} />;\n }\n\n return (\n <div ref={ref} className=\"w-full text-foreground\" style={{ height: h }}>\n {width > 0 &&\n (type === 'pie' ? (\n <PieChart width={width} height={h}>\n <Tooltip contentStyle={TOOLTIP_STYLE} />\n <Legend\n verticalAlign=\"bottom\"\n iconType=\"circle\"\n iconSize={8}\n wrapperStyle={{ fontSize: 12 }}\n />\n <Pie\n data={data}\n dataKey=\"value\"\n nameKey=\"label\"\n outerRadius=\"85%\"\n innerRadius=\"60%\"\n >\n {data.map((_, i) => (\n <Cell key={i} fill={rampColor(i)} />\n ))}\n {centerLabel && (\n <Label\n position=\"center\"\n content={({ viewBox }) => {\n if (viewBox && 'cx' in viewBox && 'cy' in viewBox) {\n return (\n <text\n x={viewBox.cx}\n y={viewBox.cy}\n textAnchor=\"middle\"\n dominantBaseline=\"middle\"\n className=\"fill-foreground text-2xl font-medium\"\n >\n {centerLabel}\n </text>\n );\n }\n }}\n />\n )}\n </Pie>\n </PieChart>\n ) : type === 'line' ? (\n <LineChart\n width={width}\n height={h}\n data={data}\n margin={{ top: 8, right: 8, bottom: 0, left: -16 }}\n >\n <CartesianGrid strokeOpacity={0.15} vertical={false} />\n <XAxis\n dataKey=\"label\"\n tickLine={false}\n axisLine={false}\n tickMargin={10}\n fontSize={11}\n />\n <YAxis tickLine={false} axisLine={false} fontSize={11} width={32} />\n <Tooltip contentStyle={TOOLTIP_STYLE} />\n <Line\n type=\"monotone\"\n dataKey=\"value\"\n stroke={rampColor(0)}\n strokeWidth={2}\n dot={false}\n />\n </LineChart>\n ) : (\n <BarChart\n width={width}\n height={h}\n data={data}\n margin={{ top: 8, right: 8, bottom: 0, left: -16 }}\n >\n <CartesianGrid strokeOpacity={0.15} vertical={false} />\n <XAxis\n dataKey=\"label\"\n tickLine={false}\n axisLine={false}\n tickMargin={10}\n fontSize={11}\n />\n <YAxis tickLine={false} axisLine={false} fontSize={11} width={32} />\n <Tooltip\n contentStyle={TOOLTIP_STYLE}\n cursor={{ fillOpacity: 0.06 }}\n />\n <Bar dataKey=\"value\" fill={rampColor(0)} radius={[4, 4, 0, 0]} />\n </BarChart>\n ))}\n </div>\n );\n}\n\nfunction ChartEmpty({ height }: { height: number }) {\n const { t } = useJsonRenderHost();\n return (\n <div\n className=\"flex w-full items-center justify-center rounded-lg border border-muted-foreground/15 text-xs text-muted-foreground\"\n style={{ height }}\n >\n {t('json_no_chart_data')}\n </div>\n );\n}\n"],"names":["useContainerWidth","ref","React","width","setWidth","el","update","observer","FOREGROUND","RAMP","pct","rampColor","TOOLTIP_STYLE","ChartImpl","type","data","height","centerLabel","h","jsx","ChartEmpty","PieChart","Tooltip","Legend","jsxs","Pie","_","i","Cell","Label","viewBox","LineChart","CartesianGrid","XAxis","YAxis","Line","BarChart","Bar","t","useJsonRenderHost"],"mappings":"gMA4BA,SAASA,GAGP,CACA,MAAMC,EAAMC,EAAM,OAAuB,IAAI,EACvC,CAACC,EAAOC,CAAQ,EAAIF,EAAM,SAAS,CAAC,EAC1C,OAAAA,EAAM,gBAAgB,IAAM,CAC1B,MAAMG,EAAKJ,EAAI,QACf,GAAI,CAACI,EAAI,OACT,MAAMC,EAAS,IAAMF,EAASC,EAAG,WAAW,EAC5CC,EAAA,EACA,MAAMC,EAAW,IAAI,eAAeD,CAAM,EAC1C,OAAAC,EAAS,QAAQF,CAAE,EACZ,IAAME,EAAS,WAAA,CACxB,EAAG,CAAA,CAAE,EACE,CAAE,IAAAN,EAAK,MAAAE,CAAA,CAChB,CAcA,MAAMK,EAAa,6CAEbC,EAAO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