@flytedan/flytebot-design-system 0.12.11 → 0.12.13

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/index.d.cts CHANGED
@@ -1939,18 +1939,18 @@ interface FilePickButtonProps extends Omit<DropzoneProps, "children" | "label" |
1939
1939
  }
1940
1940
  /** A file input behind any trigger. Resets between picks so re-picking the same file fires. */
1941
1941
  declare function FilePickButton({ onFiles, onReject, accept, maxFileSize, multiple, disabled, label, icon, className, children, }: FilePickButtonProps): React.JSX.Element;
1942
- type FileUploadHandler = (file: File, onProgress: (pct: number) => void, signal?: AbortSignal) => Promise<{
1943
- url: string;
1944
- thumb?: {
1945
- url: string;
1946
- };
1947
- } | void>;
1942
+ type FileUploadHandler = (file: File, onProgress: (pct: number) => void, signal?: AbortSignal) => Promise<Partial<Attachment> | void>;
1948
1943
  /**
1949
1944
  * Upload orchestration for a staged set of files: progress per file, per-file
1950
1945
  * errors, retry, and cancel — the same behaviour an upload field has.
1951
1946
  *
1952
- * `upload(file, onProgress, signal)` must resolve to `{url, thumb?}` or throw.
1953
- * Nothing here knows what a chat is; it is the app's upload handler that does.
1947
+ * `upload(file, onProgress, signal)` must resolve to `Partial<Attachment>` (at
1948
+ * least the server-assigned `id`, typically `url` and `thumb` too) or throw.
1949
+ * When the result carries an `id`, it REPLACES the local staged id — the id a
1950
+ * host sends onward (`ChatComposer.onSubmit`) is therefore always the id the
1951
+ * server gave the file, never the client-local placeholder `toAttachment`
1952
+ * minted. Nothing here knows what a chat is; it is the app's upload handler
1953
+ * that does.
1954
1954
  */
1955
1955
  declare function useStagedFiles(upload?: FileUploadHandler, opts?: {
1956
1956
  onUploaded?: (a: Attachment) => void;
@@ -3370,6 +3370,54 @@ declare const TranscriptKit: {
3370
3370
  groupMessages: typeof groupMessages;
3371
3371
  };
3372
3372
 
3373
+ /** Kept modest on purpose: this is a PREVIEW, not a document viewer. A file past this
3374
+ * many characters still opens — it just shows its first slice, same as CodeBlock's own
3375
+ * line fold for a long file. */
3376
+ declare const FILE_VIEWER_TEXT_LIMIT = 500000;
3377
+ /** CSV/TSV render as a real table, which means real DOM rows — bounded for the same
3378
+ * reason a virtualized list is, just simpler: this is a preview, and a spreadsheet with
3379
+ * 50,000 rows is what the "download" action is for. */
3380
+ declare const FILE_VIEWER_CSV_ROW_LIMIT = 500;
3381
+ /**
3382
+ * A minimal, dependency-free delimited-text reader: quoted fields, `""` as an escaped
3383
+ * quote inside one, and either line ending. Not a full RFC 4180 implementation — good
3384
+ * enough for a bounded preview table, which is all this ever renders.
3385
+ */
3386
+ declare function parseDelimited(text: string, delimiter: string): string[][];
3387
+ interface FileViewerProps {
3388
+ file: Attachment;
3389
+ /**
3390
+ * Mints a short-lived URL for THIS file on demand — called once for the inline
3391
+ * preview and again, separately, for a download. The component never reads
3392
+ * `file.url` itself: production URLs are signed and expire in minutes, so the
3393
+ * only correct URL is one just resolved for the disposition in hand.
3394
+ */
3395
+ resolveUrl: (disposition: "inline" | "attachment") => Promise<string>;
3396
+ /**
3397
+ * A companion panel — notes, metadata, associations, whatever the host wants
3398
+ * beside the file. Generic on purpose: FileViewer has no idea what a "note" or
3399
+ * a "campaign" is. Beside the preview when there's room, a tab next to Preview
3400
+ * when there isn't. Omit it and there is no side panel and no tab bar at all.
3401
+ */
3402
+ sidePanel?: React.ReactNode;
3403
+ /** Tab label / region name for `sidePanel`. Default "Details". */
3404
+ sidePanelLabel?: string;
3405
+ onClose?: () => void;
3406
+ /** Extra controls beside the built-in Download action, e.g. a host's "Save to campaign". */
3407
+ actions?: React.ReactNode;
3408
+ className?: string;
3409
+ }
3410
+ /**
3411
+ * A file preview with an optional companion side panel: image, PDF, text/markdown/JSON,
3412
+ * a bounded CSV/TSV table, or an honest "no preview" fallback with the file's own
3413
+ * metadata — plus download, close and a host action slot. Fully responsive: side by side
3414
+ * with `sidePanel` while there's room, a tab next to Preview below a narrow width of its
3415
+ * OWN container (a `@container` query, not the viewport — see the stylesheet), with
3416
+ * exactly one scroll region per pane either way. Renders inside the kit's `Modal` or
3417
+ * `Drawer`, or inline in a page — it has no opinion on how it got on screen.
3418
+ */
3419
+ declare function FileViewer({ file, resolveUrl, sidePanel, sidePanelLabel, onClose, actions, className }: FileViewerProps): React.JSX.Element;
3420
+
3373
3421
  interface TableQuery {
3374
3422
  /** 1-indexed. */
3375
3423
  page: number;
@@ -3642,4 +3690,4 @@ interface VersionStore<TState, TDiff = unknown> {
3642
3690
  }
3643
3691
  declare function createVersionStore<TState, TDiff = unknown>(initialState: TState, options?: CreateVersionStoreOptions<TState, TDiff>): VersionStore<TState, TDiff>;
3644
3692
 
3645
- export { AccountMenu, type AccountMenuLink, type AccountMenuProps, AgentChatPanel, type AgentChatPanelProps, ApiSpecBrowser, type ApiSpecBrowserProps, type Attachment, Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, BudgetReallocator, type BudgetReallocatorProps, Button, type ButtonProps, CHANNELS, CHANNEL_WEIGHTS, CHAT_UNAVAILABLE, Calendar, type CalendarProps, Card, type CardProps, CardRow, type CardRowProps, ChannelContribution, type ChannelContributionChannel, type ChannelContributionProps, ChannelMeta, type ChannelMetaRecord, ChannelTag, type ChannelTagProps, ChannelWeightOf, type ChatAdapter, ChatComposer, type ChatComposerProps, type ChatEngine, type ChatEngineOptions, ChatKit, type ChatMessage, type ChatRenderContext, ChatSessionBar, type ChatSessionBarProps, ChatTranscript, type ChatTranscriptProps, ChatTurn, type ChatTurnProps, Checkbox, type CheckboxProps, type Citation, Citations, type CitationsProps, Clamp, type ClampProps, ClockFace, type ClockFaceProps, CodeBlock, type CodeBlockProps, Collapsible, type CollapsibleProps, ComingSoon, type ComingSoonProps, type ContextUsage, type CreateVersionStoreOptions, CsiBadge, type CsiBadgeProps, CsiHero, type CsiHeroProps, CsiMeter, type CsiMeterProps, DataTable, type DataTableColumn, type DataTableProps, DatePicker, type DatePickerProps, type DeviceSession, DiffBlock, type DiffBlockProps, Drawer, type DrawerProps, Dropzone, DropzoneKit, type DropzoneProps, ENTITY_ROW_METRIC_WIDTH, type EditorTrigger, EmptyState, type EmptyStateProps, type EndpointSpec, EntityRow, type EntityRowAction, type EntityRowContent, type EntityRowMetric, EntityRowMetrics, type EntityRowMetricsProps, type EntityRowProps, FeatureGate, type FeatureGateProps, type FeatureStatus, FileChip, type FileChipProps, FileGrid, type FileGridProps, FileKit, FilePickButton, type FilePickButtonProps, type FileRejection, FileStrip, type FileStripProps, FileTile, type FileTileProps, type FileUploadHandler, FilterBar, type FilterBarProps, type FilterField, type FilterFieldOption, type FilterFieldSelect, type FilterFieldText, Flag$1 as Flag, type FlagExplanation, type FlagProps, FlytedeskBrand, type FlytedeskBrandProps, FlytedeskMark, type FlytedeskMarkProps, FormatEta, Gate, type GateProps, IMPORTANCE_LEVELS, IconButton, type IconButtonProps, type ImportanceLevel, type ImportanceLevelId, ImportanceTag, type ImportanceTagProps, type ImportanceTokens, Input, type InputProps, type JobStatus, Json, KeyHint, type KeyHintProps, type ListEnvelope, LoadingRegion, type LoadingRegionProps, Markdown, MarkdownEditor, type MarkdownEditorHandle, type MarkdownEditorProps, MarkdownInline, type MarkdownProps, type MentionSource, Menu, MenuButton, type MenuButtonProps, type MenuItem, type MenuProps, MessageBody, type MessageBodyProps, type MessageGroup, Meter, type MeterProps, type MeterSegment, type MeterSegmentInput, MixGap, type MixGapProps, type MixGapRow, MockJobKit, type MockJobStatus, Modal, type ModalProps, ModeSwitch, type ModeSwitchProps, type Model, ModelControls, type ModelControlsProps, NumberInput, type NumberInputProps, POPOVER_BODY_MIN, type Packet, PacketCard, type PacketCardProps, type PacketSchema, type Pager, Pagination, type PaginationProps, PermissionDenied, type PermissionDeniedProps, type PermissionGroup, PermissionHint, type PermissionItem, type Placement, type PollOptions, Popover, type PopoverProps, type PreferenceCriterion, PreferenceMeter, type PreferenceMeterProps, ProfilePage, type ProfilePageProps, ProgressBar, type ProgressBarProps, QueryKit, type QueuedTurn, QuotaRow, type QuotaRowProps, Radio, type RadioProps, RangeSlider, type RangeSliderProps, RelativeTime, type RelativeTimeProps, type RoadmapItem, type RoadmapResult, RoadmapTimeline, type RoadmapTimelineProps, type Role, RunActions, type RunActionsProps, type RunConfig, RuntimeKit, type RuntimeSummary, SaturationDistribution, type SaturationDistributionCampus, type SaturationDistributionProps, ScoreMeter, type ScoreMeterProps, SearchField, type SearchFieldProps, SegmentedControl, type SegmentedControlProps, SegmentedMeter, type SegmentedMeterProps, Select, type SelectOption, type SelectProps, type SendMessageResult, type ServerTable, type Session, type Flag as SessionFlag, SessionKit, type SessionStats, SidebarNav, type SidebarNavItem, type SidebarNavProps, Skeleton, type SkeletonProps, SkeletonText, type SkeletonTextProps, type SlashCommand, Slider, type SliderProps, SortMenu, type SortMenuField, type SortMenuProps, type SpecModule, Spinner, type SpinnerProps, StatTile, type StatTileProps, type Step, StepList, type StepListProps, type StreamHandlers, type Suggestion, SurroundSound, type SurroundSoundProps, Switch, type SwitchProps, type TableQuery, Tabs, type TabsProps, Tag, type TagProps, TestModeBar, type TestModeBarProps, Textarea, type TextareaProps, ThinkingBlock, type ThinkingBlockProps, type ThreadSummary, TimePicker, type TimePickerProps, Toast, type ToastProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, TranscriptKit, TransferList, type TransferListProps, type TransferListSide, type TransferListSideProps, type UsageLimit, UseFeatureStatus, UseRuntimeMode, type UseServerTableOptions, type User, VIRTUAL_LIST_BUFFER_ROWS, VIRTUAL_LIST_ROW_GAP, type VersionRecord, type VersionStore, VirtualList, type VirtualListProps, type VirtualLoadedBand, type VirtualWindow, type VoiceHandler, acceptMatches, anyOfFilter, channelWeightOf, computeNeedMore, computeVirtualWindow, createVersionStore, eqFilter, extensionOf, extractClipboardFiles, filterFiles, formatAbsolute, formatBytes, formatClock, formatDuration, formatEta, formatRelative, groupMessages, hasModifier, iconForMime, importanceLevel, importanceTokens, isImage, isSystemMessage, jobBucket, languageLabel, markdownToText, meterFormats, modifierLabel, pastedTextName, pluralizeUnit, preferenceScore, preferenceSegments, rangeFilter, revokeAttachment, toAttachment, tokenize, useChatEngine, useFeatureStatus, usePopoverPosition, useRuntimeMode, useServerTable, useStagedFiles, visibleMessages };
3693
+ export { AccountMenu, type AccountMenuLink, type AccountMenuProps, AgentChatPanel, type AgentChatPanelProps, ApiSpecBrowser, type ApiSpecBrowserProps, type Attachment, Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, BudgetReallocator, type BudgetReallocatorProps, Button, type ButtonProps, CHANNELS, CHANNEL_WEIGHTS, CHAT_UNAVAILABLE, Calendar, type CalendarProps, Card, type CardProps, CardRow, type CardRowProps, ChannelContribution, type ChannelContributionChannel, type ChannelContributionProps, ChannelMeta, type ChannelMetaRecord, ChannelTag, type ChannelTagProps, ChannelWeightOf, type ChatAdapter, ChatComposer, type ChatComposerProps, type ChatEngine, type ChatEngineOptions, ChatKit, type ChatMessage, type ChatRenderContext, ChatSessionBar, type ChatSessionBarProps, ChatTranscript, type ChatTranscriptProps, ChatTurn, type ChatTurnProps, Checkbox, type CheckboxProps, type Citation, Citations, type CitationsProps, Clamp, type ClampProps, ClockFace, type ClockFaceProps, CodeBlock, type CodeBlockProps, Collapsible, type CollapsibleProps, ComingSoon, type ComingSoonProps, type ContextUsage, type CreateVersionStoreOptions, CsiBadge, type CsiBadgeProps, CsiHero, type CsiHeroProps, CsiMeter, type CsiMeterProps, DataTable, type DataTableColumn, type DataTableProps, DatePicker, type DatePickerProps, type DeviceSession, DiffBlock, type DiffBlockProps, Drawer, type DrawerProps, Dropzone, DropzoneKit, type DropzoneProps, ENTITY_ROW_METRIC_WIDTH, type EditorTrigger, EmptyState, type EmptyStateProps, type EndpointSpec, EntityRow, type EntityRowAction, type EntityRowContent, type EntityRowMetric, EntityRowMetrics, type EntityRowMetricsProps, type EntityRowProps, FILE_VIEWER_CSV_ROW_LIMIT, FILE_VIEWER_TEXT_LIMIT, FeatureGate, type FeatureGateProps, type FeatureStatus, FileChip, type FileChipProps, FileGrid, type FileGridProps, FileKit, FilePickButton, type FilePickButtonProps, type FileRejection, FileStrip, type FileStripProps, FileTile, type FileTileProps, type FileUploadHandler, FileViewer, type FileViewerProps, FilterBar, type FilterBarProps, type FilterField, type FilterFieldOption, type FilterFieldSelect, type FilterFieldText, Flag$1 as Flag, type FlagExplanation, type FlagProps, FlytedeskBrand, type FlytedeskBrandProps, FlytedeskMark, type FlytedeskMarkProps, FormatEta, Gate, type GateProps, IMPORTANCE_LEVELS, IconButton, type IconButtonProps, type ImportanceLevel, type ImportanceLevelId, ImportanceTag, type ImportanceTagProps, type ImportanceTokens, Input, type InputProps, type JobStatus, Json, KeyHint, type KeyHintProps, type ListEnvelope, LoadingRegion, type LoadingRegionProps, Markdown, MarkdownEditor, type MarkdownEditorHandle, type MarkdownEditorProps, MarkdownInline, type MarkdownProps, type MentionSource, Menu, MenuButton, type MenuButtonProps, type MenuItem, type MenuProps, MessageBody, type MessageBodyProps, type MessageGroup, Meter, type MeterProps, type MeterSegment, type MeterSegmentInput, MixGap, type MixGapProps, type MixGapRow, MockJobKit, type MockJobStatus, Modal, type ModalProps, ModeSwitch, type ModeSwitchProps, type Model, ModelControls, type ModelControlsProps, NumberInput, type NumberInputProps, POPOVER_BODY_MIN, type Packet, PacketCard, type PacketCardProps, type PacketSchema, type Pager, Pagination, type PaginationProps, PermissionDenied, type PermissionDeniedProps, type PermissionGroup, PermissionHint, type PermissionItem, type Placement, type PollOptions, Popover, type PopoverProps, type PreferenceCriterion, PreferenceMeter, type PreferenceMeterProps, ProfilePage, type ProfilePageProps, ProgressBar, type ProgressBarProps, QueryKit, type QueuedTurn, QuotaRow, type QuotaRowProps, Radio, type RadioProps, RangeSlider, type RangeSliderProps, RelativeTime, type RelativeTimeProps, type RoadmapItem, type RoadmapResult, RoadmapTimeline, type RoadmapTimelineProps, type Role, RunActions, type RunActionsProps, type RunConfig, RuntimeKit, type RuntimeSummary, SaturationDistribution, type SaturationDistributionCampus, type SaturationDistributionProps, ScoreMeter, type ScoreMeterProps, SearchField, type SearchFieldProps, SegmentedControl, type SegmentedControlProps, SegmentedMeter, type SegmentedMeterProps, Select, type SelectOption, type SelectProps, type SendMessageResult, type ServerTable, type Session, type Flag as SessionFlag, SessionKit, type SessionStats, SidebarNav, type SidebarNavItem, type SidebarNavProps, Skeleton, type SkeletonProps, SkeletonText, type SkeletonTextProps, type SlashCommand, Slider, type SliderProps, SortMenu, type SortMenuField, type SortMenuProps, type SpecModule, Spinner, type SpinnerProps, StatTile, type StatTileProps, type Step, StepList, type StepListProps, type StreamHandlers, type Suggestion, SurroundSound, type SurroundSoundProps, Switch, type SwitchProps, type TableQuery, Tabs, type TabsProps, Tag, type TagProps, TestModeBar, type TestModeBarProps, Textarea, type TextareaProps, ThinkingBlock, type ThinkingBlockProps, type ThreadSummary, TimePicker, type TimePickerProps, Toast, type ToastProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, TranscriptKit, TransferList, type TransferListProps, type TransferListSide, type TransferListSideProps, type UsageLimit, UseFeatureStatus, UseRuntimeMode, type UseServerTableOptions, type User, VIRTUAL_LIST_BUFFER_ROWS, VIRTUAL_LIST_ROW_GAP, type VersionRecord, type VersionStore, VirtualList, type VirtualListProps, type VirtualLoadedBand, type VirtualWindow, type VoiceHandler, acceptMatches, anyOfFilter, channelWeightOf, computeNeedMore, computeVirtualWindow, createVersionStore, eqFilter, extensionOf, extractClipboardFiles, filterFiles, formatAbsolute, formatBytes, formatClock, formatDuration, formatEta, formatRelative, groupMessages, hasModifier, iconForMime, importanceLevel, importanceTokens, isImage, isSystemMessage, jobBucket, languageLabel, markdownToText, meterFormats, modifierLabel, parseDelimited, pastedTextName, pluralizeUnit, preferenceScore, preferenceSegments, rangeFilter, revokeAttachment, toAttachment, tokenize, useChatEngine, useFeatureStatus, usePopoverPosition, useRuntimeMode, useServerTable, useStagedFiles, visibleMessages };
package/dist/index.d.ts CHANGED
@@ -1939,18 +1939,18 @@ interface FilePickButtonProps extends Omit<DropzoneProps, "children" | "label" |
1939
1939
  }
1940
1940
  /** A file input behind any trigger. Resets between picks so re-picking the same file fires. */
1941
1941
  declare function FilePickButton({ onFiles, onReject, accept, maxFileSize, multiple, disabled, label, icon, className, children, }: FilePickButtonProps): React.JSX.Element;
1942
- type FileUploadHandler = (file: File, onProgress: (pct: number) => void, signal?: AbortSignal) => Promise<{
1943
- url: string;
1944
- thumb?: {
1945
- url: string;
1946
- };
1947
- } | void>;
1942
+ type FileUploadHandler = (file: File, onProgress: (pct: number) => void, signal?: AbortSignal) => Promise<Partial<Attachment> | void>;
1948
1943
  /**
1949
1944
  * Upload orchestration for a staged set of files: progress per file, per-file
1950
1945
  * errors, retry, and cancel — the same behaviour an upload field has.
1951
1946
  *
1952
- * `upload(file, onProgress, signal)` must resolve to `{url, thumb?}` or throw.
1953
- * Nothing here knows what a chat is; it is the app's upload handler that does.
1947
+ * `upload(file, onProgress, signal)` must resolve to `Partial<Attachment>` (at
1948
+ * least the server-assigned `id`, typically `url` and `thumb` too) or throw.
1949
+ * When the result carries an `id`, it REPLACES the local staged id — the id a
1950
+ * host sends onward (`ChatComposer.onSubmit`) is therefore always the id the
1951
+ * server gave the file, never the client-local placeholder `toAttachment`
1952
+ * minted. Nothing here knows what a chat is; it is the app's upload handler
1953
+ * that does.
1954
1954
  */
1955
1955
  declare function useStagedFiles(upload?: FileUploadHandler, opts?: {
1956
1956
  onUploaded?: (a: Attachment) => void;
@@ -3370,6 +3370,54 @@ declare const TranscriptKit: {
3370
3370
  groupMessages: typeof groupMessages;
3371
3371
  };
3372
3372
 
3373
+ /** Kept modest on purpose: this is a PREVIEW, not a document viewer. A file past this
3374
+ * many characters still opens — it just shows its first slice, same as CodeBlock's own
3375
+ * line fold for a long file. */
3376
+ declare const FILE_VIEWER_TEXT_LIMIT = 500000;
3377
+ /** CSV/TSV render as a real table, which means real DOM rows — bounded for the same
3378
+ * reason a virtualized list is, just simpler: this is a preview, and a spreadsheet with
3379
+ * 50,000 rows is what the "download" action is for. */
3380
+ declare const FILE_VIEWER_CSV_ROW_LIMIT = 500;
3381
+ /**
3382
+ * A minimal, dependency-free delimited-text reader: quoted fields, `""` as an escaped
3383
+ * quote inside one, and either line ending. Not a full RFC 4180 implementation — good
3384
+ * enough for a bounded preview table, which is all this ever renders.
3385
+ */
3386
+ declare function parseDelimited(text: string, delimiter: string): string[][];
3387
+ interface FileViewerProps {
3388
+ file: Attachment;
3389
+ /**
3390
+ * Mints a short-lived URL for THIS file on demand — called once for the inline
3391
+ * preview and again, separately, for a download. The component never reads
3392
+ * `file.url` itself: production URLs are signed and expire in minutes, so the
3393
+ * only correct URL is one just resolved for the disposition in hand.
3394
+ */
3395
+ resolveUrl: (disposition: "inline" | "attachment") => Promise<string>;
3396
+ /**
3397
+ * A companion panel — notes, metadata, associations, whatever the host wants
3398
+ * beside the file. Generic on purpose: FileViewer has no idea what a "note" or
3399
+ * a "campaign" is. Beside the preview when there's room, a tab next to Preview
3400
+ * when there isn't. Omit it and there is no side panel and no tab bar at all.
3401
+ */
3402
+ sidePanel?: React.ReactNode;
3403
+ /** Tab label / region name for `sidePanel`. Default "Details". */
3404
+ sidePanelLabel?: string;
3405
+ onClose?: () => void;
3406
+ /** Extra controls beside the built-in Download action, e.g. a host's "Save to campaign". */
3407
+ actions?: React.ReactNode;
3408
+ className?: string;
3409
+ }
3410
+ /**
3411
+ * A file preview with an optional companion side panel: image, PDF, text/markdown/JSON,
3412
+ * a bounded CSV/TSV table, or an honest "no preview" fallback with the file's own
3413
+ * metadata — plus download, close and a host action slot. Fully responsive: side by side
3414
+ * with `sidePanel` while there's room, a tab next to Preview below a narrow width of its
3415
+ * OWN container (a `@container` query, not the viewport — see the stylesheet), with
3416
+ * exactly one scroll region per pane either way. Renders inside the kit's `Modal` or
3417
+ * `Drawer`, or inline in a page — it has no opinion on how it got on screen.
3418
+ */
3419
+ declare function FileViewer({ file, resolveUrl, sidePanel, sidePanelLabel, onClose, actions, className }: FileViewerProps): React.JSX.Element;
3420
+
3373
3421
  interface TableQuery {
3374
3422
  /** 1-indexed. */
3375
3423
  page: number;
@@ -3642,4 +3690,4 @@ interface VersionStore<TState, TDiff = unknown> {
3642
3690
  }
3643
3691
  declare function createVersionStore<TState, TDiff = unknown>(initialState: TState, options?: CreateVersionStoreOptions<TState, TDiff>): VersionStore<TState, TDiff>;
3644
3692
 
3645
- export { AccountMenu, type AccountMenuLink, type AccountMenuProps, AgentChatPanel, type AgentChatPanelProps, ApiSpecBrowser, type ApiSpecBrowserProps, type Attachment, Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, BudgetReallocator, type BudgetReallocatorProps, Button, type ButtonProps, CHANNELS, CHANNEL_WEIGHTS, CHAT_UNAVAILABLE, Calendar, type CalendarProps, Card, type CardProps, CardRow, type CardRowProps, ChannelContribution, type ChannelContributionChannel, type ChannelContributionProps, ChannelMeta, type ChannelMetaRecord, ChannelTag, type ChannelTagProps, ChannelWeightOf, type ChatAdapter, ChatComposer, type ChatComposerProps, type ChatEngine, type ChatEngineOptions, ChatKit, type ChatMessage, type ChatRenderContext, ChatSessionBar, type ChatSessionBarProps, ChatTranscript, type ChatTranscriptProps, ChatTurn, type ChatTurnProps, Checkbox, type CheckboxProps, type Citation, Citations, type CitationsProps, Clamp, type ClampProps, ClockFace, type ClockFaceProps, CodeBlock, type CodeBlockProps, Collapsible, type CollapsibleProps, ComingSoon, type ComingSoonProps, type ContextUsage, type CreateVersionStoreOptions, CsiBadge, type CsiBadgeProps, CsiHero, type CsiHeroProps, CsiMeter, type CsiMeterProps, DataTable, type DataTableColumn, type DataTableProps, DatePicker, type DatePickerProps, type DeviceSession, DiffBlock, type DiffBlockProps, Drawer, type DrawerProps, Dropzone, DropzoneKit, type DropzoneProps, ENTITY_ROW_METRIC_WIDTH, type EditorTrigger, EmptyState, type EmptyStateProps, type EndpointSpec, EntityRow, type EntityRowAction, type EntityRowContent, type EntityRowMetric, EntityRowMetrics, type EntityRowMetricsProps, type EntityRowProps, FeatureGate, type FeatureGateProps, type FeatureStatus, FileChip, type FileChipProps, FileGrid, type FileGridProps, FileKit, FilePickButton, type FilePickButtonProps, type FileRejection, FileStrip, type FileStripProps, FileTile, type FileTileProps, type FileUploadHandler, FilterBar, type FilterBarProps, type FilterField, type FilterFieldOption, type FilterFieldSelect, type FilterFieldText, Flag$1 as Flag, type FlagExplanation, type FlagProps, FlytedeskBrand, type FlytedeskBrandProps, FlytedeskMark, type FlytedeskMarkProps, FormatEta, Gate, type GateProps, IMPORTANCE_LEVELS, IconButton, type IconButtonProps, type ImportanceLevel, type ImportanceLevelId, ImportanceTag, type ImportanceTagProps, type ImportanceTokens, Input, type InputProps, type JobStatus, Json, KeyHint, type KeyHintProps, type ListEnvelope, LoadingRegion, type LoadingRegionProps, Markdown, MarkdownEditor, type MarkdownEditorHandle, type MarkdownEditorProps, MarkdownInline, type MarkdownProps, type MentionSource, Menu, MenuButton, type MenuButtonProps, type MenuItem, type MenuProps, MessageBody, type MessageBodyProps, type MessageGroup, Meter, type MeterProps, type MeterSegment, type MeterSegmentInput, MixGap, type MixGapProps, type MixGapRow, MockJobKit, type MockJobStatus, Modal, type ModalProps, ModeSwitch, type ModeSwitchProps, type Model, ModelControls, type ModelControlsProps, NumberInput, type NumberInputProps, POPOVER_BODY_MIN, type Packet, PacketCard, type PacketCardProps, type PacketSchema, type Pager, Pagination, type PaginationProps, PermissionDenied, type PermissionDeniedProps, type PermissionGroup, PermissionHint, type PermissionItem, type Placement, type PollOptions, Popover, type PopoverProps, type PreferenceCriterion, PreferenceMeter, type PreferenceMeterProps, ProfilePage, type ProfilePageProps, ProgressBar, type ProgressBarProps, QueryKit, type QueuedTurn, QuotaRow, type QuotaRowProps, Radio, type RadioProps, RangeSlider, type RangeSliderProps, RelativeTime, type RelativeTimeProps, type RoadmapItem, type RoadmapResult, RoadmapTimeline, type RoadmapTimelineProps, type Role, RunActions, type RunActionsProps, type RunConfig, RuntimeKit, type RuntimeSummary, SaturationDistribution, type SaturationDistributionCampus, type SaturationDistributionProps, ScoreMeter, type ScoreMeterProps, SearchField, type SearchFieldProps, SegmentedControl, type SegmentedControlProps, SegmentedMeter, type SegmentedMeterProps, Select, type SelectOption, type SelectProps, type SendMessageResult, type ServerTable, type Session, type Flag as SessionFlag, SessionKit, type SessionStats, SidebarNav, type SidebarNavItem, type SidebarNavProps, Skeleton, type SkeletonProps, SkeletonText, type SkeletonTextProps, type SlashCommand, Slider, type SliderProps, SortMenu, type SortMenuField, type SortMenuProps, type SpecModule, Spinner, type SpinnerProps, StatTile, type StatTileProps, type Step, StepList, type StepListProps, type StreamHandlers, type Suggestion, SurroundSound, type SurroundSoundProps, Switch, type SwitchProps, type TableQuery, Tabs, type TabsProps, Tag, type TagProps, TestModeBar, type TestModeBarProps, Textarea, type TextareaProps, ThinkingBlock, type ThinkingBlockProps, type ThreadSummary, TimePicker, type TimePickerProps, Toast, type ToastProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, TranscriptKit, TransferList, type TransferListProps, type TransferListSide, type TransferListSideProps, type UsageLimit, UseFeatureStatus, UseRuntimeMode, type UseServerTableOptions, type User, VIRTUAL_LIST_BUFFER_ROWS, VIRTUAL_LIST_ROW_GAP, type VersionRecord, type VersionStore, VirtualList, type VirtualListProps, type VirtualLoadedBand, type VirtualWindow, type VoiceHandler, acceptMatches, anyOfFilter, channelWeightOf, computeNeedMore, computeVirtualWindow, createVersionStore, eqFilter, extensionOf, extractClipboardFiles, filterFiles, formatAbsolute, formatBytes, formatClock, formatDuration, formatEta, formatRelative, groupMessages, hasModifier, iconForMime, importanceLevel, importanceTokens, isImage, isSystemMessage, jobBucket, languageLabel, markdownToText, meterFormats, modifierLabel, pastedTextName, pluralizeUnit, preferenceScore, preferenceSegments, rangeFilter, revokeAttachment, toAttachment, tokenize, useChatEngine, useFeatureStatus, usePopoverPosition, useRuntimeMode, useServerTable, useStagedFiles, visibleMessages };
3693
+ export { AccountMenu, type AccountMenuLink, type AccountMenuProps, AgentChatPanel, type AgentChatPanelProps, ApiSpecBrowser, type ApiSpecBrowserProps, type Attachment, Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, BudgetReallocator, type BudgetReallocatorProps, Button, type ButtonProps, CHANNELS, CHANNEL_WEIGHTS, CHAT_UNAVAILABLE, Calendar, type CalendarProps, Card, type CardProps, CardRow, type CardRowProps, ChannelContribution, type ChannelContributionChannel, type ChannelContributionProps, ChannelMeta, type ChannelMetaRecord, ChannelTag, type ChannelTagProps, ChannelWeightOf, type ChatAdapter, ChatComposer, type ChatComposerProps, type ChatEngine, type ChatEngineOptions, ChatKit, type ChatMessage, type ChatRenderContext, ChatSessionBar, type ChatSessionBarProps, ChatTranscript, type ChatTranscriptProps, ChatTurn, type ChatTurnProps, Checkbox, type CheckboxProps, type Citation, Citations, type CitationsProps, Clamp, type ClampProps, ClockFace, type ClockFaceProps, CodeBlock, type CodeBlockProps, Collapsible, type CollapsibleProps, ComingSoon, type ComingSoonProps, type ContextUsage, type CreateVersionStoreOptions, CsiBadge, type CsiBadgeProps, CsiHero, type CsiHeroProps, CsiMeter, type CsiMeterProps, DataTable, type DataTableColumn, type DataTableProps, DatePicker, type DatePickerProps, type DeviceSession, DiffBlock, type DiffBlockProps, Drawer, type DrawerProps, Dropzone, DropzoneKit, type DropzoneProps, ENTITY_ROW_METRIC_WIDTH, type EditorTrigger, EmptyState, type EmptyStateProps, type EndpointSpec, EntityRow, type EntityRowAction, type EntityRowContent, type EntityRowMetric, EntityRowMetrics, type EntityRowMetricsProps, type EntityRowProps, FILE_VIEWER_CSV_ROW_LIMIT, FILE_VIEWER_TEXT_LIMIT, FeatureGate, type FeatureGateProps, type FeatureStatus, FileChip, type FileChipProps, FileGrid, type FileGridProps, FileKit, FilePickButton, type FilePickButtonProps, type FileRejection, FileStrip, type FileStripProps, FileTile, type FileTileProps, type FileUploadHandler, FileViewer, type FileViewerProps, FilterBar, type FilterBarProps, type FilterField, type FilterFieldOption, type FilterFieldSelect, type FilterFieldText, Flag$1 as Flag, type FlagExplanation, type FlagProps, FlytedeskBrand, type FlytedeskBrandProps, FlytedeskMark, type FlytedeskMarkProps, FormatEta, Gate, type GateProps, IMPORTANCE_LEVELS, IconButton, type IconButtonProps, type ImportanceLevel, type ImportanceLevelId, ImportanceTag, type ImportanceTagProps, type ImportanceTokens, Input, type InputProps, type JobStatus, Json, KeyHint, type KeyHintProps, type ListEnvelope, LoadingRegion, type LoadingRegionProps, Markdown, MarkdownEditor, type MarkdownEditorHandle, type MarkdownEditorProps, MarkdownInline, type MarkdownProps, type MentionSource, Menu, MenuButton, type MenuButtonProps, type MenuItem, type MenuProps, MessageBody, type MessageBodyProps, type MessageGroup, Meter, type MeterProps, type MeterSegment, type MeterSegmentInput, MixGap, type MixGapProps, type MixGapRow, MockJobKit, type MockJobStatus, Modal, type ModalProps, ModeSwitch, type ModeSwitchProps, type Model, ModelControls, type ModelControlsProps, NumberInput, type NumberInputProps, POPOVER_BODY_MIN, type Packet, PacketCard, type PacketCardProps, type PacketSchema, type Pager, Pagination, type PaginationProps, PermissionDenied, type PermissionDeniedProps, type PermissionGroup, PermissionHint, type PermissionItem, type Placement, type PollOptions, Popover, type PopoverProps, type PreferenceCriterion, PreferenceMeter, type PreferenceMeterProps, ProfilePage, type ProfilePageProps, ProgressBar, type ProgressBarProps, QueryKit, type QueuedTurn, QuotaRow, type QuotaRowProps, Radio, type RadioProps, RangeSlider, type RangeSliderProps, RelativeTime, type RelativeTimeProps, type RoadmapItem, type RoadmapResult, RoadmapTimeline, type RoadmapTimelineProps, type Role, RunActions, type RunActionsProps, type RunConfig, RuntimeKit, type RuntimeSummary, SaturationDistribution, type SaturationDistributionCampus, type SaturationDistributionProps, ScoreMeter, type ScoreMeterProps, SearchField, type SearchFieldProps, SegmentedControl, type SegmentedControlProps, SegmentedMeter, type SegmentedMeterProps, Select, type SelectOption, type SelectProps, type SendMessageResult, type ServerTable, type Session, type Flag as SessionFlag, SessionKit, type SessionStats, SidebarNav, type SidebarNavItem, type SidebarNavProps, Skeleton, type SkeletonProps, SkeletonText, type SkeletonTextProps, type SlashCommand, Slider, type SliderProps, SortMenu, type SortMenuField, type SortMenuProps, type SpecModule, Spinner, type SpinnerProps, StatTile, type StatTileProps, type Step, StepList, type StepListProps, type StreamHandlers, type Suggestion, SurroundSound, type SurroundSoundProps, Switch, type SwitchProps, type TableQuery, Tabs, type TabsProps, Tag, type TagProps, TestModeBar, type TestModeBarProps, Textarea, type TextareaProps, ThinkingBlock, type ThinkingBlockProps, type ThreadSummary, TimePicker, type TimePickerProps, Toast, type ToastProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, TranscriptKit, TransferList, type TransferListProps, type TransferListSide, type TransferListSideProps, type UsageLimit, UseFeatureStatus, UseRuntimeMode, type UseServerTableOptions, type User, VIRTUAL_LIST_BUFFER_ROWS, VIRTUAL_LIST_ROW_GAP, type VersionRecord, type VersionStore, VirtualList, type VirtualListProps, type VirtualLoadedBand, type VirtualWindow, type VoiceHandler, acceptMatches, anyOfFilter, channelWeightOf, computeNeedMore, computeVirtualWindow, createVersionStore, eqFilter, extensionOf, extractClipboardFiles, filterFiles, formatAbsolute, formatBytes, formatClock, formatDuration, formatEta, formatRelative, groupMessages, hasModifier, iconForMime, importanceLevel, importanceTokens, isImage, isSystemMessage, jobBucket, languageLabel, markdownToText, meterFormats, modifierLabel, parseDelimited, pastedTextName, pluralizeUnit, preferenceScore, preferenceSegments, rangeFilter, revokeAttachment, toAttachment, tokenize, useChatEngine, useFeatureStatus, usePopoverPosition, useRuntimeMode, useServerTable, useStagedFiles, visibleMessages };
package/dist/index.js CHANGED
@@ -568,6 +568,11 @@ function SegmentedControl({ options = [], value, onChange, className = "", ...re
568
568
  }) });
569
569
  }
570
570
 
571
+ // src/components/textExposure.ts
572
+ function truncationTitle(content) {
573
+ return typeof content === "string" || typeof content === "number" ? String(content) : void 0;
574
+ }
575
+
571
576
  // src/components/surfaces/Card.tsx
572
577
  import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
573
578
  function Card({
@@ -589,7 +594,7 @@ function Card({
589
594
  ].filter(Boolean).join(" ");
590
595
  return /* @__PURE__ */ jsxs4("div", { className: cls, ...rest, children: [
591
596
  title ? /* @__PURE__ */ jsxs4("div", { className: "fd-card-head", children: [
592
- /* @__PURE__ */ jsx5("span", { className: "fd-card-head-title", children: title }),
597
+ /* @__PURE__ */ jsx5("span", { className: "fd-card-head-title", title: truncationTitle(title), children: title }),
593
598
  action
594
599
  ] }) : null,
595
600
  padded ? /* @__PURE__ */ jsx5("div", { className: "fd-card-body", children }) : children,
@@ -665,7 +670,7 @@ function Drawer({ open = true, title, onClose, footer, children, className = "",
665
670
  /* @__PURE__ */ jsx7("div", { className: "fd-scrim" + (closing ? " is-closing" : ""), style: { display: "block", zIndex: zIndex - LAYER_STEP }, onClick: close }),
666
671
  /* @__PURE__ */ jsxs6("aside", { className: ["fd-drawer", closing ? "is-closing" : "", className].filter(Boolean).join(" "), role: "dialog", "aria-modal": "true", ...rest, style: { zIndex }, children: [
667
672
  /* @__PURE__ */ jsxs6("div", { className: "fd-card-head", style: { flex: "none" }, children: [
668
- /* @__PURE__ */ jsx7("span", { className: "fd-card-head-title", children: title }),
673
+ /* @__PURE__ */ jsx7("span", { className: "fd-card-head-title", title: truncationTitle(title), children: title }),
669
674
  onClose ? /* @__PURE__ */ jsx7("button", { type: "button", className: "fd-btn-icon", "aria-label": "Close", onClick: close, children: /* @__PURE__ */ jsx7("i", { className: "ph ph-x" }) }) : null
670
675
  ] }),
671
676
  /* @__PURE__ */ jsx7("div", { style: { flex: "1 1 auto", minHeight: 0, overflow: "auto", padding: 20 }, children }),
@@ -947,7 +952,12 @@ function Topbar({
947
952
  onMenu ? /* @__PURE__ */ jsx16("button", { type: "button", className: "fd-btn-icon", "aria-label": "Menu", onClick: onMenu, children: /* @__PURE__ */ jsx16("i", { className: "ph ph-list" }) }) : null,
948
953
  /* @__PURE__ */ jsx16("nav", { className: "fd-crumb", "aria-label": "Breadcrumb", children: crumbs.map((c, i) => /* @__PURE__ */ jsxs13(React6.Fragment, { children: [
949
954
  i > 0 ? /* @__PURE__ */ jsx16("i", { className: "ph ph-caret-right", style: { fontSize: 11, opacity: 0.6 }, "aria-hidden": "true" }) : null,
950
- i === crumbs.length - 1 ? /* @__PURE__ */ jsx16("span", { className: "fd-crumb-current", children: c.label }) : /* @__PURE__ */ jsx16(
955
+ i === crumbs.length - 1 ? (
956
+ // MP-141: the current crumb mixes a static route label with (usually) a
957
+ // user-entered campaign name and is single-line by design — exposure,
958
+ // not wrapping, is the fix here, same rule as every other identifier.
959
+ /* @__PURE__ */ jsx16("span", { className: "fd-crumb-current", title: truncationTitle(c.label), children: c.label })
960
+ ) : /* @__PURE__ */ jsx16(
951
961
  "a",
952
962
  {
953
963
  href: c.href || "#",
@@ -2542,12 +2552,12 @@ function SegmentedMeter({
2542
2552
  legend ? /* @__PURE__ */ jsxs31("ul", { className: "fd-segmeter-legend", children: [
2543
2553
  items.map((s, i) => /* @__PURE__ */ jsxs31("li", { children: [
2544
2554
  /* @__PURE__ */ jsx34("span", { className: "fd-segmeter-dot", style: { background: fill(s, i) }, "aria-hidden": "true" }),
2545
- /* @__PURE__ */ jsx34("span", { className: "fd-segmeter-key", children: s.label }),
2555
+ /* @__PURE__ */ jsx34("span", { className: "fd-segmeter-key", title: truncationTitle(s.label), children: s.label }),
2546
2556
  /* @__PURE__ */ jsx34("span", { className: "fd-segmeter-val fd-tabular", children: format(s.value) })
2547
2557
  ] }, s.id || s.label || i)),
2548
2558
  safeTotal && used < safeTotal ? /* @__PURE__ */ jsxs31("li", { className: "is-remainder", children: [
2549
2559
  /* @__PURE__ */ jsx34("span", { className: "fd-segmeter-dot is-empty", "aria-hidden": "true" }),
2550
- /* @__PURE__ */ jsx34("span", { className: "fd-segmeter-key", children: remainderLabel }),
2560
+ /* @__PURE__ */ jsx34("span", { className: "fd-segmeter-key", title: truncationTitle(remainderLabel), children: remainderLabel }),
2551
2561
  /* @__PURE__ */ jsx34("span", { className: "fd-segmeter-val fd-tabular", children: format(safeTotal - used) })
2552
2562
  ] }) : null
2553
2563
  ] }) : null
@@ -2989,7 +2999,11 @@ function EntityRow({
2989
2999
  /* @__PURE__ */ jsx39("span", { className: "fd-erow-title fd-body-sm", children: title })
2990
3000
  ]
2991
3001
  }
2992
- ) }) : /* @__PURE__ */ jsx39("span", { className: "fd-erow-title fd-body-sm", children: title }),
3002
+ ) }) : (
3003
+ // MP-141: dense-row identifier, no Tooltip wrapper in this branch — a native
3004
+ // `title` is the exposure mechanism, same rule as every other identifier.
3005
+ /* @__PURE__ */ jsx39("span", { className: "fd-erow-title fd-body-sm", title: truncationTitle(title), children: title })
3006
+ ),
2993
3007
  meta ? /* @__PURE__ */ jsx39("span", { className: "fd-erow-meta", children: meta }) : null
2994
3008
  ] }),
2995
3009
  hasStrip ? /* @__PURE__ */ jsxs36("span", { className: "fd-erow-strip", children: [
@@ -4468,7 +4482,7 @@ function useStagedFiles(upload, opts) {
4468
4482
  patch(att.id, { progress: 0, error: void 0 });
4469
4483
  Promise.resolve().then(() => upload(att.file, (p) => patch(att.id, { progress: Math.max(0, Math.min(99, p)) }), ac ? ac.signal : void 0)).then((res) => {
4470
4484
  const r = res || {};
4471
- patch(att.id, { progress: 100, url: r.url || att.url, thumb: r.thumb || att.thumb, error: void 0, remote: true });
4485
+ patch(att.id, Object.assign({}, r, { id: r.id || att.id, progress: 100, error: void 0 }));
4472
4486
  o.onUploaded && o.onUploaded(att);
4473
4487
  }).catch((err) => {
4474
4488
  if (ac && ac.signal.aborted) return;
@@ -9464,7 +9478,9 @@ function ChatComposer({
9464
9478
  const submit = () => {
9465
9479
  if (!canSend) return;
9466
9480
  onSubmit(text.trim(), staged.items.map((f) => {
9467
- const { file: _file, ...rest } = f;
9481
+ const { file, blobUrl, ...rest } = f;
9482
+ void file;
9483
+ void blobUrl;
9468
9484
  return rest;
9469
9485
  }));
9470
9486
  change("");
@@ -10159,8 +10175,219 @@ function AgentChatPanel({
10159
10175
  );
10160
10176
  }
10161
10177
 
10162
- // src/kits/query.ts
10178
+ // src/components/files/FileViewer.tsx
10163
10179
  import * as React47 from "react";
10180
+ import { jsx as jsx77, jsxs as jsxs73 } from "react/jsx-runtime";
10181
+ function previewKindOf(file) {
10182
+ const mime = (file.mime || "").toLowerCase();
10183
+ const ext = extensionOf(file.name || "");
10184
+ if (isImage(mime, file.name)) return "image";
10185
+ if (mime === "application/pdf" || ext === "pdf") return "pdf";
10186
+ if (mime === "text/markdown" || ext === "md" || ext === "markdown") return "markdown";
10187
+ if (mime === "application/json" || ext === "json") return "json";
10188
+ if (mime === "text/csv" || mime === "text/tab-separated-values" || ext === "csv" || ext === "tsv") return "csv";
10189
+ if (mime.startsWith("text/") || ext === "txt" || ext === "log") return "text";
10190
+ return "none";
10191
+ }
10192
+ var FILE_VIEWER_TEXT_LIMIT = 5e5;
10193
+ var FILE_VIEWER_CSV_ROW_LIMIT = 500;
10194
+ function parseDelimited(text, delimiter) {
10195
+ const rows = [];
10196
+ let row = [];
10197
+ let field = "";
10198
+ let inQuotes = false;
10199
+ for (let i = 0; i < text.length; i++) {
10200
+ const c = text[i];
10201
+ if (inQuotes) {
10202
+ if (c === '"') {
10203
+ if (text[i + 1] === '"') {
10204
+ field += '"';
10205
+ i++;
10206
+ } else inQuotes = false;
10207
+ } else field += c;
10208
+ continue;
10209
+ }
10210
+ if (c === '"') {
10211
+ inQuotes = true;
10212
+ continue;
10213
+ }
10214
+ if (c === delimiter) {
10215
+ row.push(field);
10216
+ field = "";
10217
+ continue;
10218
+ }
10219
+ if (c === "\n") {
10220
+ row.push(field);
10221
+ rows.push(row);
10222
+ row = [];
10223
+ field = "";
10224
+ continue;
10225
+ }
10226
+ if (c === "\r") continue;
10227
+ field += c;
10228
+ }
10229
+ if (field.length || row.length) {
10230
+ row.push(field);
10231
+ rows.push(row);
10232
+ }
10233
+ return rows;
10234
+ }
10235
+ function usePreview(file, kind, resolveUrl) {
10236
+ const [state, setState] = React47.useState({ status: "loading" });
10237
+ const [attempt, setAttempt] = React47.useState(0);
10238
+ const resolveRef = React47.useRef(resolveUrl);
10239
+ React47.useEffect(() => {
10240
+ resolveRef.current = resolveUrl;
10241
+ }, [resolveUrl]);
10242
+ React47.useEffect(() => {
10243
+ if (kind === "none") {
10244
+ setState({ status: "ready" });
10245
+ return;
10246
+ }
10247
+ let dead = false;
10248
+ const ac = typeof AbortController !== "undefined" ? new AbortController() : void 0;
10249
+ setState({ status: "loading" });
10250
+ resolveRef.current("inline").then((url) => {
10251
+ if (dead) return void 0;
10252
+ if (kind === "image" || kind === "pdf") {
10253
+ setState({ status: "ready", url });
10254
+ return void 0;
10255
+ }
10256
+ return fetch(url, ac ? { signal: ac.signal } : void 0).then((res) => {
10257
+ if (!res.ok) throw new Error("The preview didn't load (" + res.status + ").");
10258
+ return res.text();
10259
+ }).then((body) => {
10260
+ if (dead) return;
10261
+ setState({ status: "ready", url, text: body.length > FILE_VIEWER_TEXT_LIMIT ? body.slice(0, FILE_VIEWER_TEXT_LIMIT) : body });
10262
+ });
10263
+ }).catch((err) => {
10264
+ if (dead || ac && ac.signal.aborted) return;
10265
+ setState({ status: "error", error: err && err.message || "The preview didn't load." });
10266
+ });
10267
+ return () => {
10268
+ dead = true;
10269
+ if (ac) ac.abort();
10270
+ };
10271
+ }, [file.id, kind, attempt]);
10272
+ return { ...state, retry: React47.useCallback(() => setAttempt((a) => a + 1), []) };
10273
+ }
10274
+ function PreviewBody({ file, kind, state }) {
10275
+ if (kind === "image") return /* @__PURE__ */ jsx77("img", { className: "fd-fv-image", src: state.url, alt: file.name || "Preview" });
10276
+ if (kind === "pdf") return /* @__PURE__ */ jsx77("iframe", { className: "fd-fv-pdf", src: state.url, title: file.name || "PDF preview" });
10277
+ if (kind === "markdown") return /* @__PURE__ */ jsx77(Markdown, { className: "fd-fv-markdown", source: state.text || "" });
10278
+ if (kind === "json") {
10279
+ let pretty = state.text || "";
10280
+ try {
10281
+ pretty = JSON.stringify(JSON.parse(pretty), null, 2);
10282
+ } catch {
10283
+ }
10284
+ return /* @__PURE__ */ jsx77(CodeBlock, { code: pretty, language: "json" });
10285
+ }
10286
+ if (kind === "csv") {
10287
+ const tsv = extensionOf(file.name || "") === "tsv" || (file.mime || "").toLowerCase().includes("tab-separated");
10288
+ const rows = parseDelimited(state.text || "", tsv ? " " : ",").filter((r) => r.length > 1 || r[0] !== "");
10289
+ const head = rows[0] || [];
10290
+ const dataRows = rows.slice(1);
10291
+ const shown = dataRows.slice(0, FILE_VIEWER_CSV_ROW_LIMIT);
10292
+ return /* @__PURE__ */ jsxs73("div", { className: "fd-fv-csv", children: [
10293
+ /* @__PURE__ */ jsxs73("table", { className: "fd-fv-csv-table", children: [
10294
+ /* @__PURE__ */ jsx77("thead", { children: /* @__PURE__ */ jsx77("tr", { children: head.map((c, i) => /* @__PURE__ */ jsx77("th", { children: c }, i)) }) }),
10295
+ /* @__PURE__ */ jsx77("tbody", { children: shown.map((r, ri) => /* @__PURE__ */ jsx77("tr", { children: head.map((_, ci) => /* @__PURE__ */ jsx77("td", { children: r[ci] ?? "" }, ci)) }, ri)) })
10296
+ ] }),
10297
+ dataRows.length > FILE_VIEWER_CSV_ROW_LIMIT ? /* @__PURE__ */ jsxs73("p", { className: "fd-fv-csv-note fd-body-sm fd-muted", children: [
10298
+ "Showing the first ",
10299
+ FILE_VIEWER_CSV_ROW_LIMIT.toLocaleString(),
10300
+ " of ",
10301
+ dataRows.length.toLocaleString(),
10302
+ " rows."
10303
+ ] }) : null
10304
+ ] });
10305
+ }
10306
+ if (kind === "text") return /* @__PURE__ */ jsx77(CodeBlock, { code: state.text || "", language: extensionOf(file.name || "") || void 0 });
10307
+ return /* @__PURE__ */ jsxs73("div", { className: "fd-fv-fallback", children: [
10308
+ /* @__PURE__ */ jsx77("span", { className: "fd-fv-fallback-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx77("i", { className: "ph ph-" + iconForMime(file.mime, file.name) }) }),
10309
+ /* @__PURE__ */ jsx77("span", { className: "fd-fv-fallback-title", children: "No preview available" }),
10310
+ /* @__PURE__ */ jsxs73("span", { className: "fd-fv-fallback-meta", children: [
10311
+ file.mime || "Unknown type",
10312
+ file.size ? " \xB7 " + formatBytes(file.size) : ""
10313
+ ] })
10314
+ ] });
10315
+ }
10316
+ function FileViewer({ file, resolveUrl, sidePanel, sidePanelLabel = "Details", onClose, actions, className = "" }) {
10317
+ const kind = React47.useMemo(() => previewKindOf(file), [file]);
10318
+ const preview = usePreview(file, kind, resolveUrl);
10319
+ const [tab, setTab] = React47.useState("preview");
10320
+ const [downloading, setDownloading] = React47.useState(false);
10321
+ const [downloadError, setDownloadError] = React47.useState(null);
10322
+ const hasSide = sidePanel != null;
10323
+ React47.useEffect(() => {
10324
+ setTab("preview");
10325
+ }, [file.id]);
10326
+ const download = () => {
10327
+ setDownloading(true);
10328
+ setDownloadError(null);
10329
+ resolveUrl("attachment").then((url) => {
10330
+ const a = document.createElement("a");
10331
+ a.href = url;
10332
+ a.rel = "noopener";
10333
+ a.download = file.name || "";
10334
+ document.body.appendChild(a);
10335
+ a.click();
10336
+ a.remove();
10337
+ }).catch((err) => setDownloadError(err && err.message || "Download failed.")).finally(() => setDownloading(false));
10338
+ };
10339
+ return /* @__PURE__ */ jsxs73(
10340
+ "section",
10341
+ {
10342
+ className: ["fd-fv", hasSide && tab === "side" ? "is-tab-side" : "is-tab-preview", className].filter(Boolean).join(" "),
10343
+ "aria-label": file.name || "File",
10344
+ children: [
10345
+ /* @__PURE__ */ jsxs73("header", { className: "fd-fv-head", children: [
10346
+ /* @__PURE__ */ jsx77("span", { className: "fd-fv-head-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx77("i", { className: "ph ph-" + iconForMime(file.mime, file.name) }) }),
10347
+ /* @__PURE__ */ jsxs73("span", { className: "fd-fv-head-titles", children: [
10348
+ /* @__PURE__ */ jsx77("span", { className: "fd-fv-head-title", title: file.name, children: file.name }),
10349
+ /* @__PURE__ */ jsxs73("span", { className: "fd-fv-head-meta", children: [
10350
+ file.mime || "Unknown type",
10351
+ file.size ? " \xB7 " + formatBytes(file.size) : ""
10352
+ ] })
10353
+ ] }),
10354
+ /* @__PURE__ */ jsxs73("span", { className: "fd-fv-head-actions", children: [
10355
+ actions,
10356
+ /* @__PURE__ */ jsx77(Button, { variant: "secondary", size: "sm", icon: "download-simple", loading: downloading, onClick: download, children: "Download" }),
10357
+ onClose ? /* @__PURE__ */ jsx77(IconButton, { icon: "x", label: "Close", onClick: onClose }) : null
10358
+ ] })
10359
+ ] }),
10360
+ downloadError ? /* @__PURE__ */ jsx77("div", { className: "fd-fv-download-error", role: "alert", children: downloadError }) : null,
10361
+ hasSide ? /* @__PURE__ */ jsx77(
10362
+ Tabs,
10363
+ {
10364
+ className: "fd-fv-tabs",
10365
+ tabs: [{ value: "preview", label: "Preview" }, { value: "side", label: sidePanelLabel }],
10366
+ value: tab,
10367
+ onChange: (v) => setTab(v)
10368
+ }
10369
+ ) : null,
10370
+ /* @__PURE__ */ jsxs73("div", { className: "fd-fv-body", children: [
10371
+ /* @__PURE__ */ jsx77("div", { className: "fd-fv-preview", role: "region", "aria-label": "Preview of " + (file.name || "file"), children: /* @__PURE__ */ jsx77(
10372
+ LoadingRegion,
10373
+ {
10374
+ state: preview.status === "loading" ? "loading" : preview.status === "error" ? "error" : "ready",
10375
+ error: preview.error,
10376
+ label: "Loading preview of " + (file.name || "file"),
10377
+ onRetry: preview.status === "error" ? preview.retry : void 0,
10378
+ skeleton: /* @__PURE__ */ jsx77(Skeleton, { shape: "card", h: 220 }),
10379
+ children: /* @__PURE__ */ jsx77(PreviewBody, { file, kind, state: preview })
10380
+ }
10381
+ ) }),
10382
+ hasSide ? /* @__PURE__ */ jsx77("div", { className: "fd-fv-side", role: "region", "aria-label": sidePanelLabel, children: sidePanel }) : null
10383
+ ] })
10384
+ ]
10385
+ }
10386
+ );
10387
+ }
10388
+
10389
+ // src/kits/query.ts
10390
+ import * as React48 from "react";
10164
10391
  function eqFilter(get2) {
10165
10392
  return (row, value) => Array.isArray(value) ? value.includes(get2(row)) : get2(row) === value;
10166
10393
  }
@@ -10192,22 +10419,22 @@ function compare(a, b, dir) {
10192
10419
  var API = null;
10193
10420
  var PREFS = null;
10194
10421
  function useServerTable({ endpoint, params, defaults, deps, prefsKey }) {
10195
- const [query, setQuery] = React47.useState(() => {
10422
+ const [query, setQuery] = React48.useState(() => {
10196
10423
  const store = PREFS || window.PlannerPrefs;
10197
10424
  const saved = prefsKey && store ? store.getTable(prefsKey) : {};
10198
10425
  return { ...DEFAULTS, ...defaults || {}, ...saved.pageSize ? { pageSize: saved.pageSize } : {}, ...saved.sort ? { sort: saved.sort, dir: saved.dir || "desc" } : {} };
10199
10426
  });
10200
- const savePref = React47.useCallback((patch2) => {
10427
+ const savePref = React48.useCallback((patch2) => {
10201
10428
  const store = PREFS || window.PlannerPrefs;
10202
10429
  if (prefsKey && store) store.setTable(prefsKey, patch2);
10203
10430
  }, [prefsKey]);
10204
- const [res, setRes] = React47.useState(null);
10205
- const [loading, setLoading] = React47.useState(true);
10206
- const seq2 = React47.useRef(0);
10431
+ const [res, setRes] = React48.useState(null);
10432
+ const [loading, setLoading] = React48.useState(true);
10433
+ const seq2 = React48.useRef(0);
10207
10434
  const depKey = (deps || []).join("|");
10208
10435
  const paramKey = JSON.stringify(params || {});
10209
10436
  const queryKey = JSON.stringify(query);
10210
- React47.useEffect(() => {
10437
+ React48.useEffect(() => {
10211
10438
  const id = ++seq2.current;
10212
10439
  setLoading(true);
10213
10440
  const t = setTimeout(() => {
@@ -10548,6 +10775,8 @@ export {
10548
10775
  EmptyState,
10549
10776
  EntityRow,
10550
10777
  EntityRowMetrics,
10778
+ FILE_VIEWER_CSV_ROW_LIMIT,
10779
+ FILE_VIEWER_TEXT_LIMIT,
10551
10780
  FeatureGate,
10552
10781
  FileChip,
10553
10782
  FileGrid,
@@ -10555,6 +10784,7 @@ export {
10555
10784
  FilePickButton,
10556
10785
  FileStrip,
10557
10786
  FileTile,
10787
+ FileViewer,
10558
10788
  FilterBar,
10559
10789
  Flag,
10560
10790
  FlytedeskBrand,
@@ -10659,6 +10889,7 @@ export {
10659
10889
  markdownToText,
10660
10890
  meterFormats,
10661
10891
  modifierLabel,
10892
+ parseDelimited,
10662
10893
  pastedTextName,
10663
10894
  pluralizeUnit,
10664
10895
  preferenceScore,