{"version":3,"sources":["../kind-kit.ts","../kind-kit/SortableList.tsx","../kind-kit/icons.tsx","../kind-kit/kind-kit-host.tsx","../kind-kit/KindImageDefault.tsx","../kind-kit/KindVideoDefault.tsx","../kind-kit/kind-media.ts","../kind-kit/KindAudioDefault.tsx","../kind-kit/KindEmbedDefault.tsx","../kind-kit/embed-url.ts","../kind-kit/KindPanelGrid.tsx","../kind-kit/KindPanel.tsx","../kind-kit/icon-slot.tsx","../kind-kit/KindHeaderBar.tsx","../kind-kit/KindActionButton.tsx","../kind-kit/StreamingSkeleton.tsx","../kind-kit/TagList.tsx","../kind-kit/KindImage.tsx","../kind-kit/KindFile.tsx","../kind-kit/file-icons.tsx","../kind-kit/KindVideo.tsx","../kind-kit/KindAudio.tsx","../kind-kit/KindEmbed.tsx","../kind-kit/kind-locale.ts"],"sourcesContent":["\"use client\";\n\nexport { SortableList, type SortableListProps, type SortableRenderContext } from \"./kind-kit/SortableList\";\nexport { KindPanelGrid, type KindPanelGridProps } from \"./kind-kit/KindPanelGrid\";\nexport * from \"./kind-kit/KindPanel\";\nexport { KindHeaderBar, type KindHeaderBarProps, type KindHeaderStat } from \"./kind-kit/KindHeaderBar\";\nexport {\n  KindActionButton,\n  type KindActionButtonProps,\n  type KindActionEnvelope,\n} from \"./kind-kit/KindActionButton\";\nexport {\n  StreamingSkeleton,\n  useStreamingValue,\n  streamList,\n  streamText,\n  type StreamingSkeletonProps,\n} from \"./kind-kit/StreamingSkeleton\";\nexport { KeywordChip, TagList, type KeywordChipProps, type TagItem, type TagListProps } from \"./kind-kit/TagList\";\nexport { renderKindKitIcon, type KindKitIcon } from \"./kind-kit/icon-slot\";\nexport {\n  setKindKitHost,\n  getKindKitHost,\n  resetKindKitHost,\n  DefaultCopyButtons,\n  DefaultReadEmpty,\n  DefaultReadStaleNotice,\n  type KindKitHost,\n  type KindKitCopyProps,\n  type KindKitReadEmptyProps,\n  type KindKitReadStaleNoticeProps,\n  type ReadOutcome,\n  type ReadStatus,\n} from \"./kind-kit/kind-kit-host\";\nexport {\n  KindImage,\n  DefaultKindImage,\n  kindImageBoxStyle,\n  toKindImageRef,\n  loadKindImage,\n  useKindImageSource,\n  resetKindImageCache,\n  type KindImageProps,\n  type KindImageRef,\n} from \"./kind-kit/KindImage\";\nexport { KindFile, kindFileType, type KindFileProps, type KindFileRef, type KindFileType } from \"./kind-kit/KindFile\";\nexport {\n  KindVideo,\n  DefaultKindVideo,\n  kindVideoBoxStyle,\n  formatMediaDuration,\n  type KindVideoProps,\n  type KindMediaRef,\n} from \"./kind-kit/KindVideo\";\nexport { KindAudio, DefaultKindAudio, type KindAudioProps } from \"./kind-kit/KindAudio\";\nexport {\n  KindEmbed,\n  DefaultKindEmbed,\n  kindEmbedBoxStyle,\n  parseEmbed,\n  type KindEmbedProps,\n  type ParsedEmbed,\n  type EmbedProvider,\n} from \"./kind-kit/KindEmbed\";\nexport {\n  useKindLocale,\n  getKindLocale,\n  setKindLocale,\n  readDocumentLocale,\n  type KindLocale,\n} from \"./kind-kit/kind-locale\";\n","\"use client\";\n\n/**\n * SortableList — drag-to-reorder list for kind components.\n *\n * The mandated reorder UX, built once: while a row is dragged, the rows it\n * passes DISPLACE (translate) out of the way and a SHADOWED placeholder marks\n * exactly where the item will land. Native HTML5 drag-and-drop (no deps); a\n * grab handle starts the drag (so text and inputs inside rows stay usable);\n * up/down buttons are the keyboard + touch fallback; `onRemove` adds an inline\n * remove control. Rows are FLAT, split by hairlines (`divide-y`) — never a\n * bordered box per row; the row's own controls sit in flow, always reachable.\n * Contract: `kind-kit/README.md`.\n *\n * Sandbox-safe by construction: imports only react, the design system,\n * and `cn`.\n */\n\nimport * as React from \"react\";\nimport { ChevronDown, ChevronUp } from \"./icons\";\nimport { GripVerticalIcon, XIcon } from \"@ai-matrx/design-system/icons\";\nimport { cn } from \"@ai-matrx/design-system\";\nimport { getKindKitHost, type ReadOutcome } from \"./kind-kit-host\";\n\nexport interface SortableRenderContext {\n  index: number;\n  /** True for the row currently being dragged (rendered as the placeholder). */\n  isDragging: boolean;\n}\n\nexport interface SortableListProps<T> {\n  /** Current order. Treated as read-only; the new order arrives via `onReorder`. */\n  items: readonly T[];\n  /**\n   * Stable key per item. Default: the item itself when it is a string, else\n   * `item.id` / `item.key` when present, else the index (unstable — pass one).\n   */\n  getKey?: (item: T, index: number) => string;\n  /** Called with the full reordered array after a drop or an arrow press. */\n  onReorder: (items: T[]) => void;\n  /**\n   * Row content. Default: the item when it is a string/number, else its\n   * `label` / `title` / `name` / `text` field, else `JSON.stringify`.\n   */\n  renderItem?: (item: T, ctx: SortableRenderContext) => React.ReactNode;\n  /** When set, every row gets an inline remove (X) control. */\n  onRemove?: (item: T, index: number) => void;\n  /** Disables drag, arrows and remove (rows still render). */\n  disabled?: boolean;\n  /** Hide the up/down arrow buttons (drag only). Default false. */\n  hideArrows?: boolean;\n  /** Shown when `items` is empty. */\n  emptyState?: React.ReactNode;\n  /**\n   * The outcome of the read behind the rows (RC-B12 r13). `emptyState` shows\n   * only after a read that succeeded; a failed read shows the failure + retry.\n   */\n  read?: ReadOutcome;\n  /** Wrapper `<ul>` className. */\n  className?: string;\n  /** Per-row className (applied to every `<li>`). */\n  itemClassName?: string;\n  /** Accessible name for the list. */\n  ariaLabel?: string;\n}\n\nfunction defaultKey<T>(item: T, index: number): string {\n  if (typeof item === \"string\" || typeof item === \"number\") return String(item);\n  if (item && typeof item === \"object\") {\n    const rec = item as Record<string, unknown>;\n    if (typeof rec.id === \"string\" || typeof rec.id === \"number\")\n      return String(rec.id);\n    if (typeof rec.key === \"string\") return rec.key;\n  }\n  return String(index);\n}\n\nfunction defaultRender<T>(item: T): React.ReactNode {\n  if (typeof item === \"string\" || typeof item === \"number\") return String(item);\n  if (item && typeof item === \"object\") {\n    const rec = item as Record<string, unknown>;\n    for (const k of [\"label\", \"title\", \"name\", \"text\"]) {\n      if (typeof rec[k] === \"string\") return rec[k] as string;\n    }\n    return JSON.stringify(item);\n  }\n  return String(item);\n}\n\nfunction moveItem<T>(items: readonly T[], from: number, to: number): T[] {\n  const next = items.slice();\n  const [moved] = next.splice(from, 1);\n  next.splice(to, 0, moved as T);\n  return next;\n}\n\ninterface DragState {\n  from: number;\n  over: number;\n  /**\n   * Row rects captured at drag start, relative to the list's top — a fixed\n   * ruler: the pointer's position on it decides the landing slot, so the\n   * target never depends on which (already displaced) row fires the event.\n   */\n  rects: { top: number; bottom: number; height: number }[];\n}\n\nexport function SortableList<T>({\n  items,\n  getKey = defaultKey,\n  onReorder,\n  renderItem,\n  onRemove,\n  disabled = false,\n  hideArrows = false,\n  emptyState,\n  read,\n  className,\n  itemClassName,\n  ariaLabel,\n}: SortableListProps<T>) {\n  const { ReadEmpty, ReadStaleNotice } = getKindKitHost();\n  const [drag, setDrag] = React.useState<DragState | null>(null);\n  const [armed, setArmed] = React.useState<number | null>(null);\n  const listRef = React.useRef<HTMLUListElement | null>(null);\n  const rowRefs = React.useRef<(HTMLLIElement | null)[]>([]);\n\n  const canInteract = !disabled;\n\n  const handleDragStart = (index: number) => (e: React.DragEvent<HTMLLIElement>) => {\n    if (!canInteract || armed !== index) {\n      e.preventDefault();\n      return;\n    }\n    e.dataTransfer.effectAllowed = \"move\";\n    // Firefox requires data to start a drag.\n    e.dataTransfer.setData(\"text/plain\", String(index));\n    const listTop = listRef.current?.getBoundingClientRect().top ?? 0;\n    const rects = rowRefs.current.slice(0, items.length).map((el) => {\n      const r = el ? el.getBoundingClientRect() : new DOMRect();\n      return { top: r.top - listTop, bottom: r.bottom - listTop, height: r.height };\n    });\n    setDrag({ from: index, over: index, rects });\n  };\n\n  const handleDragOver = (e: React.DragEvent) => {\n    if (!drag) return;\n    e.preventDefault();\n    e.dataTransfer.dropEffect = \"move\";\n    const listTop = listRef.current?.getBoundingClientRect().top ?? 0;\n    const y = e.clientY - listTop;\n    let over = drag.rects.length - 1;\n    for (let i = 0; i < drag.rects.length; i++) {\n      const r = drag.rects[i];\n      if (r && y < r.bottom) {\n        over = i;\n        break;\n      }\n    }\n    if (over !== drag.over) setDrag({ ...drag, over });\n  };\n\n  const finish = () => {\n    setDrag(null);\n    setArmed(null);\n  };\n\n  const handleDrop = (e: React.DragEvent) => {\n    e.preventDefault();\n    if (drag && drag.from !== drag.over) {\n      onReorder(moveItem(items, drag.from, drag.over));\n    }\n    finish();\n  };\n\n  const move = (from: number, to: number) => {\n    if (to < 0 || to >= items.length || from === to) return;\n    onReorder(moveItem(items, from, to));\n  };\n\n  /** Translate (px) for row `index` while a drag is in flight. */\n  const translateFor = (index: number): number => {\n    if (!drag) return 0;\n    const { from, over, rects } = drag;\n    if (from === over) return 0;\n    const dragged = rects[from];\n    if (!dragged) return 0;\n    // Slot size = row height + the gap to its neighbour (so displaced rows\n    // land exactly on the grid the dragged row vacates).\n    const neighbour = rects[from + 1] ?? rects[from - 1];\n    const gap = neighbour\n      ? Math.max(\n          0,\n          from + 1 < rects.length\n            ? neighbour.top - dragged.bottom\n            : dragged.top - neighbour.bottom,\n        )\n      : 0;\n    const slot = dragged.height + gap;\n    if (index === from) {\n      const target = rects[over];\n      if (!target) return 0;\n      return over > from\n        ? target.bottom - dragged.bottom\n        : target.top - dragged.top;\n    }\n    if (from < over && index > from && index <= over) return -slot;\n    if (over < from && index >= over && index < from) return slot;\n    return 0;\n  };\n\n  if (items.length === 0) {\n    if (read && read.status !== \"ready\") return <ReadEmpty read={read} />;\n    return emptyState !== undefined ? (\n      <div className={cn(\"text-xs text-muted-foreground\", className)}>\n        {emptyState}\n      </div>\n    ) : null;\n  }\n\n  return (\n    <>\n    <ReadStaleNotice read={read} className=\"mb-1.5\" />\n    <ul\n      role=\"list\"\n      aria-label={ariaLabel}\n      ref={listRef}\n      className={cn(\"flex flex-col divide-y divide-border\", className)}\n      onDragOver={handleDragOver}\n      onDrop={handleDrop}\n    >\n      {items.map((item, index) => {\n        const key = getKey(item, index);\n        const isDragging = drag?.from === index;\n        const translate = translateFor(index);\n        return (\n          <li\n            key={key}\n            ref={(el) => {\n              rowRefs.current[index] = el;\n            }}\n            draggable={canInteract && armed === index}\n            onDragStart={handleDragStart(index)}\n            onDragEnd={finish}\n            style={{\n              transform: translate ? `translate3d(0, ${translate}px, 0)` : undefined,\n            }}\n            className={cn(\n              \"flex items-center gap-1.5 py-1.5 text-sm text-foreground\",\n              \"transition-transform duration-150 ease-out will-change-transform\",\n              // The drop placeholder: an outline costs no layout, so the\n              // captured row rects stay exact while it shows.\n              isDragging &&\n                \"rounded-md bg-primary/5 outline-1 outline-dashed -outline-offset-1 outline-primary/60\",\n              itemClassName,\n            )}\n          >\n            <button\n              type=\"button\"\n              aria-label=\"Drag to reorder\"\n              disabled={!canInteract}\n              onPointerDown={() => canInteract && setArmed(index)}\n              onPointerUp={() => !drag && setArmed(null)}\n              className={cn(\n                \"flex h-7 w-6 shrink-0 touch-none items-center justify-center rounded text-muted-foreground\",\n                canInteract\n                  ? \"cursor-grab hover:bg-muted hover:text-foreground active:cursor-grabbing\"\n                  : \"opacity-40\",\n              )}\n            >\n              <GripVerticalIcon className=\"h-4 w-4\" />\n            </button>\n            <div\n              className={cn(\n                \"min-w-0 flex-1 break-words\",\n                isDragging && \"opacity-40\",\n              )}\n            >\n              {renderItem\n                ? renderItem(item, { index, isDragging })\n                : defaultRender(item)}\n            </div>\n            {(!hideArrows || onRemove) && (\n              /*\n               * Controls sit IN FLOW at the row's end — never floating.\n               *\n               * A cluster that costs no layout width must, by construction,\n               * land on top of something when it appears, and it wins every\n               * click there because it is the layer above. Rows here carry the\n               * host component's own trailing controls (copy, edit, menus), so\n               * a floating cluster covered live buttons on every consumer:\n               * measured on `artisan_demo_reading_list`, it sat on \"Copy for\n               * AI\" and \"Edit book\". The kit cannot know what a row draws in\n               * its corner, so it takes its own width instead of borrowing the\n               * row's. Ruled 2026-08-30: overlap is never worth the density.\n               */\n              <div\n                className={cn(\n                  \"flex shrink-0 items-center gap-px self-start\",\n                  isDragging && \"opacity-40\",\n                )}\n              >\n                {!hideArrows && (\n                  /* Chevrons stack so the pair costs one 20px column, not two. */\n                  <div className=\"flex flex-col items-center pointer-coarse:flex-row\">\n                    <button\n                      type=\"button\"\n                      aria-label=\"Move up\"\n                      disabled={!canInteract || index === 0}\n                      onClick={() => move(index, index - 1)}\n                      className=\"flex h-3.5 w-5 items-center justify-center rounded-sm text-muted-foreground/70 hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-30 pointer-coarse:h-7 pointer-coarse:w-7\"\n                    >\n                      <ChevronUp className=\"h-3 w-3\" />\n                    </button>\n                    <button\n                      type=\"button\"\n                      aria-label=\"Move down\"\n                      disabled={!canInteract || index === items.length - 1}\n                      onClick={() => move(index, index + 1)}\n                      className=\"flex h-3.5 w-5 items-center justify-center rounded-sm text-muted-foreground/70 hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-30 pointer-coarse:h-7 pointer-coarse:w-7\"\n                    >\n                      <ChevronDown className=\"h-3 w-3\" />\n                    </button>\n                  </div>\n                )}\n                {onRemove && (\n                  <button\n                    type=\"button\"\n                    aria-label=\"Remove\"\n                    disabled={!canInteract}\n                    onClick={() => onRemove(item, index)}\n                    className=\"flex h-6 w-6 items-center justify-center rounded text-muted-foreground/70 hover:bg-muted hover:text-destructive disabled:pointer-events-none disabled:opacity-30 pointer-coarse:h-7 pointer-coarse:w-7\"\n                  >\n                    <XIcon className=\"h-3.5 w-3.5\" />\n                  </button>\n                )}\n              </div>\n            )}\n          </li>\n        );\n      })}\n    </ul>\n    </>\n  );\n}\n","/**\n * content-ir-core/kind-kit/icons.tsx — this package's glyph names, as aliases of the ONE glyph home,\n * `@ai-matrx/design-system/icons`. No path data lives here (policy C19: no icon library, and one drawing per\n * glyph); the alias only fixes this package's historical size and stroke. Exports are unchanged.\n */\n\nimport {\n  CheckIcon as GCheckIcon,\n  ChevronDownIcon as GChevronDownIcon,\n  ChevronUpIcon as GChevronUpIcon,\n  ExternalLinkIcon as GExternalLinkIcon,\n  MoreHorizontalIcon as GMoreHorizontalIcon,\n  MusicIcon as GMusicIcon,\n  PlayIcon as GPlayIcon,\n  Share2Icon as GShare2Icon,\n  withGlyphDefaults,\n  type GlyphComponent,\n} from \"@ai-matrx/design-system/icons\";\n\nconst sized = (Glyph: GlyphComponent): GlyphComponent => withGlyphDefaults(Glyph, { width: 24, height: 24 });\n\nconst MoreHorizontal = sized(GMoreHorizontalIcon);\nconst ChevronDown = sized(GChevronDownIcon);\nconst ChevronUp = sized(GChevronUpIcon);\nconst Check = sized(GCheckIcon);\nconst Share2 = sized(GShare2Icon);\nconst Play = sized(GPlayIcon);\nconst ExternalLink = sized(GExternalLinkIcon);\nconst Music = sized(GMusicIcon);\n\nexport {\n  MoreHorizontal,\n  ChevronDown,\n  ChevronUp,\n  Check,\n  Share2,\n  Play,\n  ExternalLink,\n  Music,\n};\n","\"use client\";\n\n/**\n * The kit's HOST SLOTS. The kit never imports app code; the three things it cannot own are\n * handed in once by the host through `setKindKitHost`:\n *   - `CopyButtons`   the copy bar `KindHeaderBar` renders for its `copy` prop;\n *   - `ReadEmpty`     what `SortableList` / `TagList` show instead of an empty state while a\n *                     read has not succeeded;\n *   - `ReadStaleNotice` the notice above rows left on screen by a failed refresh;\n *   - `Image`         what `KindImage` renders: the host's canonical image component.\n *   - `Video`, `Audio`, `Embed`  the same for `KindVideo`, `KindAudio`, `KindEmbed`.\n * Each default is honest and working: a plain Copy button, and text that says what happened.\n * State lives on globalThis under a Symbol.for key so two copies of the package share one host.\n */\nimport * as React from \"react\";\nimport { copyText } from \"@ai-matrx/kit/clipboard\";\nimport { DefaultKindImage, type KindImageProps } from \"./KindImageDefault\";\nimport { DefaultKindVideo, type KindVideoProps } from \"./KindVideoDefault\";\nimport { DefaultKindAudio, type KindAudioProps } from \"./KindAudioDefault\";\nimport { DefaultKindEmbed, type KindEmbedProps } from \"./KindEmbedDefault\";\n\n/**\n * The copy bar's props: a LOCAL port shape, so this package never imports the copy menu's own\n * package (that would make a dependency cycle). It is a structural subset of the copy menu's props\n * (`label`, `human`, `json`, `size`, `className`), so a host registers its own `CopyButtons`\n * (the full copy menu takes this shape) with no adapter. Every other copy-menu prop\n * (`agent`, `references`, `export`, ...) passes through untouched, which is what the index signature is for.\n * Type-only: no runtime import.\n */\nexport interface KindKitCopyProps {\n  label: string;\n  human?: string | (() => string);\n  json?: unknown;\n  size?: \"xs\" | \"icon\" | \"sm\" | \"toolbar\";\n  className?: string;\n  [passthrough: string]: unknown;\n}\n\nexport type ReadStatus = \"loading\" | \"error\" | \"ready\";\n\n/** A read's outcome, handed to a list primitive's `read` prop. */\nexport interface ReadOutcome {\n  status: ReadStatus;\n  /** The failure itself, or a truthy flag when the read only says it failed. */\n  error?: unknown;\n  onRetry?: (() => void) | undefined;\n  /** What was read, in the reader's words: \"your tasks\". */\n  what?: string | undefined;\n  /** A successful read has already produced a value. */\n  hasData?: boolean | undefined;\n}\n\nexport interface KindKitReadEmptyProps {\n  read?: ReadOutcome | undefined;\n  loading?: React.ReactNode;\n  children?: React.ReactNode;\n}\nexport interface KindKitReadStaleNoticeProps {\n  read?: ReadOutcome | undefined;\n  className?: string;\n}\n\nexport interface KindKitHost {\n  CopyButtons: React.ComponentType<KindKitCopyProps>;\n  ReadEmpty: React.ComponentType<KindKitReadEmptyProps>;\n  ReadStaleNotice: React.ComponentType<KindKitReadStaleNoticeProps>;\n  Image: React.ComponentType<KindImageProps>;\n  Video: React.ComponentType<KindVideoProps>;\n  Audio: React.ComponentType<KindAudioProps>;\n  Embed: React.ComponentType<KindEmbedProps>;\n}\n\nconst KEY = Symbol.for(\"ai-matrx.content-ir.kind-kit-host\");\ntype Store = { [KEY]?: Partial<KindKitHost> };\n\nfunction resolveText(human: KindKitCopyProps[\"human\"], json: KindKitCopyProps[\"json\"]): string {\n  if (typeof human === \"function\") return human();\n  if (typeof human === \"string\") return human;\n  if (json !== undefined) return JSON.stringify(typeof json === \"function\" ? (json as () => unknown)() : json, null, 2);\n  return \"\";\n}\n\n/** Default copy bar: one \"Copy\" button that writes the `human` text (else the JSON) to the clipboard. */\nexport function DefaultCopyButtons({ label, human, json, size, className }: KindKitCopyProps) {\n  const [state, setState] = React.useState<\"idle\" | \"copied\" | \"failed\">(\"idle\");\n  const onClick = async () => {\n    setState((await copyText(resolveText(human, json))) ? \"copied\" : \"failed\");\n    setTimeout(() => setState(\"idle\"), 1500);\n  };\n  return (\n    <button\n      type=\"button\"\n      onClick={onClick}\n      title={`Copy ${label}`}\n      aria-label={`Copy ${label}`}\n      className={\n        className ??\n        `inline-flex items-center rounded-md border border-border px-2 text-xs text-foreground hover:bg-muted ${size === \"icon\" ? \"h-7\" : \"h-8\"}`\n      }\n    >\n      {state === \"copied\" ? \"Copied\" : state === \"failed\" ? \"Copy failed\" : \"Copy\"}\n    </button>\n  );\n}\n\nfunction RetryButton({ onRetry }: { onRetry: (() => void) | undefined }) {\n  if (!onRetry) return null;\n  return (\n    <button type=\"button\" onClick={onRetry} className=\"ml-2 underline underline-offset-2\">\n      Try again\n    </button>\n  );\n}\n\n/** Default: loading says it is loading; an error says what failed (with retry); ready shows the host's empty state. */\nexport function DefaultReadEmpty({ read, loading, children }: KindKitReadEmptyProps) {\n  const status = read?.status ?? \"ready\";\n  const what = read?.what ?? \"this list\";\n  if (status === \"loading\") return <>{loading ?? <div role=\"status\" className=\"text-xs text-muted-foreground\">{`Loading ${what}…`}</div>}</>;\n  if (status === \"error\") {\n    return (\n      <div role=\"alert\" className=\"text-xs text-destructive\">\n        {`Could not load ${what}.`}\n        <RetryButton onRetry={read?.onRetry} />\n      </div>\n    );\n  }\n  return <>{children ?? null}</>;\n}\n\n/** Default: when the latest read failed, the rows on screen may be out of date; says so, with retry. */\nexport function DefaultReadStaleNotice({ read, className }: KindKitReadStaleNoticeProps) {\n  if (read?.status !== \"error\") return null;\n  return (\n    <div role=\"alert\" className={`text-xs text-muted-foreground ${className ?? \"\"}`}>\n      {`Showing earlier ${read.what ?? \"results\"}; the latest refresh failed.`}\n      <RetryButton onRetry={read.onRetry} />\n    </div>\n  );\n}\n\nconst DEFAULTS: KindKitHost = {\n  CopyButtons: DefaultCopyButtons,\n  ReadEmpty: DefaultReadEmpty,\n  ReadStaleNotice: DefaultReadStaleNotice,\n  Image: DefaultKindImage,\n  Video: DefaultKindVideo,\n  Audio: DefaultKindAudio,\n  Embed: DefaultKindEmbed,\n};\n\n/** Register the host's copy bar and read notices. Call once at boot; a slot left out keeps its default. */\nexport function setKindKitHost(host: Partial<KindKitHost>): void {\n  (globalThis as Store)[KEY] = { ...(globalThis as Store)[KEY], ...host };\n}\n\n/** The slots in force: the host's where registered, the defaults elsewhere. */\nexport function getKindKitHost(): KindKitHost {\n  return { ...DEFAULTS, ...(globalThis as Store)[KEY] };\n}\n\n/** Clear every registered slot (tests, hot reload). */\nexport function resetKindKitHost(): void {\n  delete (globalThis as Store)[KEY];\n}\n","\"use client\";\n\n/**\n * KindImage parts — the props, the sizing rule and the frame-safe default.\n * (Split from KindImage.tsx so the kit host can name the default without a cycle.)\n *\n * KindImage — THE image a shape shows. Never a bare `<img>`.\n *\n * A shape that shows a generated or saved image hands this the saved ref\n * (`itemState.<key>` after `run_shortcut … expect:\"image\"`, or any\n * `{ file_id, src?, width?, height?, mime_type? }`), or a web address (`{ url }` or the bare\n * string), whose bytes the host fetches through the image door (`fetch_image`). It:\n *   - sizes itself from the image's real width/height and shows the WHOLE image\n *     (`object-contain`) inside `maxHeight` — it never crops;\n *   - renders the host's canonical image component when the host registered one\n *     (the app's image block: expand, share, download, context menu);\n *   - otherwise (the sandbox frame, where no app component can run) shows the\n *     image with Expand and Share, which ask the host — through the component's\n *     own `runAction` — to open the canonical file preview / share window.\n *\n * Interface text is layout: labels only, one short line for an error.\n */\nimport * as React from \"react\";\nimport { cn } from \"@ai-matrx/design-system\";\nimport { Share2 } from \"./icons\";\nimport { Loader2Icon, Maximize2Icon } from \"@ai-matrx/design-system/icons\";\n\n/**\n * An image a shape shows: a saved file (durable identity) or a web address. `src` is added by the\n * host when it hands state back. A bare string is a web address.\n */\nexport interface KindImageRef {\n  file_id?: string | null;\n  /** A web address (https). The host fetches it through the platform image door, size-capped. */\n  url?: string | null;\n  src?: string | null;\n  src_error?: string | null;\n  width?: number | null;\n  height?: number | null;\n  mime_type?: string | null;\n  organization_id?: string | null;\n}\n\ntype RunAction = (key: string, input: unknown) => Promise<{ ok: true; result: unknown } | { ok: false; error: string }>;\n\nexport interface KindImageProps {\n  /** The saved image ref or a web address; a missing ref renders nothing, a ref with no `src` yet shows a placeholder. */\n  image: KindImageRef | string | null | undefined;\n  /** What the image shows (also the file name in the viewer). */\n  alt?: string;\n  /** The component's `runAction` prop — Expand and Share go through it inside a sandbox frame. */\n  runAction?: RunAction;\n  /** Tallest the image may render, in px. The whole image always shows; it scales down to fit. */\n  maxHeight?: number;\n  /** While a run is producing the image (no ref yet), show the placeholder anyway. */\n  pending?: boolean;\n  className?: string;\n}\n\nconst DEFAULT_MAX_HEIGHT = 480;\n\n/** A bare web address is a ref with a url; anything else passes through. */\nexport function toKindImageRef(image: KindImageRef | string | null | undefined): KindImageRef | null {\n  if (!image) return null;\n  if (typeof image === \"string\") return image.trim() ? { url: image.trim() } : null;\n  return image;\n}\n\ntype Loaded = { src: string } | { error: string };\n/** One fetch per address/file per page (or frame) lifetime; the blob: URL lives as long. */\nconst loaded = new Map<string, Promise<Loaded>>();\n\n/** Test seam: forget every loaded image. */\nexport function resetKindImageCache(): void {\n  loaded.clear();\n}\n\n/**\n * Bytes for an image the host has not handed over yet (a web address, or a saved file shown\n * outside item state), asked of the host with `fetch_image`; the answer's Blob becomes a local\n * `blob:` URL. Never throws; a refusal is the host's own sentence.\n */\nexport function loadKindImage(\n  runAction: RunAction,\n  source: { url: string } | { file_id: string },\n): Promise<Loaded> {\n  const key = \"url\" in source ? `url:${source.url}` : `file:${source.file_id}`;\n  let pending = loaded.get(key);\n  if (!pending) {\n    pending = runAction(\"fetch_image\", source).then((out): Loaded => {\n      if (!out.ok) {\n        loaded.delete(key);\n        return { error: out.error };\n      }\n      const blob = (out.result as { blob?: unknown } | null)?.blob;\n      if (typeof Blob === \"undefined\" || !(blob instanceof Blob)) {\n        loaded.delete(key);\n        return { error: \"The page sent no image back.\" };\n      }\n      return { src: URL.createObjectURL(blob) };\n    });\n    loaded.set(key, pending);\n  }\n  return pending;\n}\n\n/**\n * The `src` to draw for a ref: the host-supplied one, else bytes fetched through `fetch_image`\n * (web addresses always; saved files only when `fetchSaved`). Without `runAction` a web address is\n * drawn as is (inside the frame the image door routes it).\n */\nexport function useKindImageSource(\n  ref: KindImageRef | null,\n  runAction: RunAction | undefined,\n  fetchSaved = false,\n): { src: string | null; error: string | null } {\n  const given = typeof ref?.src === \"string\" && ref.src ? ref.src : null;\n  const url = !given && typeof ref?.url === \"string\" && ref.url ? ref.url : null;\n  const fileId = !given && !url && fetchSaved && typeof ref?.file_id === \"string\" && ref.file_id ? ref.file_id : null;\n  const [state, setState] = React.useState<{ key: string; out: Loaded } | null>(null);\n  const key = url ? `url:${url}` : fileId ? `file:${fileId}` : \"\";\n  React.useEffect(() => {\n    if (!key || !runAction) return undefined;\n    let live = true;\n    void loadKindImage(runAction, url ? { url } : { file_id: fileId as string }).then((out) => {\n      if (live) setState({ key, out });\n    });\n    return () => {\n      live = false;\n    };\n    // runAction identity may change per render; the key decides what is fetched.\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [key]);\n  if (given) return { src: given, error: null };\n  if (url && !runAction) return { src: url, error: null };\n  const out = state && state.key === key ? state.out : null;\n  if (!out) return { src: null, error: null };\n  return \"src\" in out ? { src: out.src, error: null } : { src: null, error: out.error };\n}\n\nfunction ratioOf(image: KindImageRef | null | undefined): number | null {\n  const w = image?.width ?? null;\n  const h = image?.height ?? null;\n  return w && h && w > 0 && h > 0 ? w / h : null;\n}\n\n/** The box the image lives in: as wide as it can be without exceeding maxHeight, at its own ratio. */\nexport function kindImageBoxStyle(image: KindImageRef | null | undefined, maxHeight: number): React.CSSProperties {\n  const ratio = ratioOf(image);\n  if (!ratio) return { maxHeight, maxWidth: \"100%\" };\n  return {\n    aspectRatio: String(ratio),\n    width: `min(100%, ${Math.round(maxHeight * ratio)}px)`,\n    maxHeight,\n  };\n}\n\n/** The frame-safe image: whole image, sized box, Expand + Share through the host. */\nexport function DefaultKindImage({ image: given, alt, runAction, maxHeight = DEFAULT_MAX_HEIGHT, pending, className }: KindImageProps) {\n  const [notice, setNotice] = React.useState<string | null>(null);\n  const [natural, setNatural] = React.useState<{ width: number; height: number } | null>(null);\n  const image = toKindImageRef(given);\n  const loadedSource = useKindImageSource(image, runAction);\n  if (!image && !pending) return null;\n  const src = loadedSource.src;\n  const error = image?.src_error ?? loadedSource.error ?? null;\n  const fileId = image?.file_id ?? null;\n  const webUrl = !fileId && image?.url ? image.url : null;\n  const name = alt?.trim() || \"Image\";\n  const canOpen = Boolean(runAction && (fileId || webUrl));\n  const ask = async (key: \"open_file\" | \"share_file\") => {\n    if (!runAction) return;\n    const out = fileId\n      ? await runAction(key, { file_id: fileId, name })\n      : webUrl && key === \"open_file\"\n        ? await runAction(\"open_url\", { url: webUrl })\n        : null;\n    if (out) setNotice(out.ok ? null : out.error);\n  };\n  // A web image's size is known only once it loads: size the box from it then, never crop.\n  const sized = image && !ratioOf(image) && natural ? { ...image, ...natural } : image;\n  const box = kindImageBoxStyle(sized, maxHeight);\n  const onLoad = (event: React.SyntheticEvent<HTMLImageElement>) => {\n    const el = event.currentTarget;\n    if (!ratioOf(image) && el.naturalWidth > 0 && el.naturalHeight > 0) {\n      setNatural({ width: el.naturalWidth, height: el.naturalHeight });\n    }\n  };\n  return (\n    <figure className={cn(\"group relative my-1 max-w-full\", className)} style={box} data-kind-image=\"\">\n      {src ? (\n        <button\n          type=\"button\"\n          className=\"block h-full w-full overflow-hidden rounded-md bg-muted/30\"\n          onClick={() => void ask(\"open_file\")}\n          disabled={!canOpen}\n          aria-label={`Open ${name}`}\n        >\n          <img src={src} alt={name} onLoad={onLoad} className=\"h-full w-full object-contain\" style={{ maxHeight }} />\n        </button>\n      ) : error ? (\n        <div role=\"alert\" className=\"flex h-full min-h-24 w-full items-center justify-center rounded-md bg-muted/40 p-3 text-xs text-muted-foreground\">\n          {error}\n        </div>\n      ) : (\n        <div\n          role=\"status\"\n          aria-label=\"Loading image\"\n          className=\"flex h-full min-h-24 w-full items-center justify-center rounded-md bg-muted\"\n          style={ratioOf(sized) ? undefined : { aspectRatio: \"1\" }}\n        >\n          <Loader2Icon className=\"h-4 w-4 animate-spin text-muted-foreground\" />\n        </div>\n      )}\n      {src && canOpen ? (\n        <div className=\"absolute right-1.5 top-1.5 flex gap-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100\">\n          <button\n            type=\"button\"\n            title=\"Expand\"\n            aria-label=\"Expand\"\n            onClick={() => void ask(\"open_file\")}\n            className=\"inline-flex h-7 w-7 items-center justify-center rounded-md border border-border bg-background/90 text-foreground shadow-sm hover:bg-muted\"\n          >\n            <Maximize2Icon className=\"h-3.5 w-3.5\" />\n          </button>\n          {fileId ? (\n            <button\n              type=\"button\"\n              title=\"Share\"\n              aria-label=\"Share\"\n              onClick={() => void ask(\"share_file\")}\n              className=\"inline-flex h-7 w-7 items-center justify-center rounded-md border border-border bg-background/90 text-foreground shadow-sm hover:bg-muted\"\n            >\n              <Share2 className=\"h-3.5 w-3.5\" />\n            </button>\n          ) : null}\n        </div>\n      ) : null}\n      {notice ? (\n        <figcaption role=\"alert\" className=\"mt-1 truncate text-xs text-destructive\" title={notice}>\n          {notice}\n        </figcaption>\n      ) : null}\n    </figure>\n  );\n}\n\n","\"use client\";\n\n/**\n * KindVideo parts — the props and the frame-safe default.\n *\n * KindVideo — THE video a shape shows. Never a bare `<video>`.\n *\n * A shape hands it a saved ref (`itemState.<key>` / `{ file_id, mime_type, width?, height?, duration? }`)\n * or a web address (`{ url }` or a plain string). It:\n *   - shows the WHOLE video at its real aspect (`object-contain`) inside `maxHeight`, never cropped;\n *   - renders the host's canonical video block when the host registered one (the app's video block:\n *     expand, download, share, context menu);\n *   - otherwise (the sandbox frame, where no app component can run and no network is reachable) shows a\n *     poster card whose Play asks the host, through the component's own `runAction`, for the bytes\n *     (`load_media`) and plays them from a blob: URL. Nothing downloads until Play, so a large file\n *     costs nothing until the reader asks. A web address cannot play inside the frame; its Play asks\n *     the host to open the real player in a window (`play_embed`).\n *\n * Interface text is layout: labels only, one short line for an error.\n */\nimport * as React from \"react\";\nimport { cn } from \"@ai-matrx/design-system\";\nimport { Loader2Icon, Maximize2Icon } from \"@ai-matrx/design-system/icons\";\nimport { Play } from \"./icons\";\nimport {\n  formatMediaDuration,\n  kindVideoBoxStyle,\n  loadMediaThroughHost,\n  toMediaRef,\n  type KindMediaRef,\n  type KindRunAction,\n} from \"./kind-media\";\n\nexport interface KindVideoProps {\n  /** The saved video ref, a web address, or a ref carrying `url`. Missing renders nothing. */\n  video: KindMediaRef | string | null | undefined;\n  /** What the video shows (also its title in the viewer). */\n  title?: string;\n  /** The component's `runAction` prop — Play and Expand go through it inside a sandbox frame. */\n  runAction?: KindRunAction;\n  /** Tallest the video may render, in px. The whole video always shows; it scales down to fit. */\n  maxHeight?: number;\n  /** While a run is producing the video (no ref yet), show the placeholder anyway. */\n  pending?: boolean;\n  className?: string;\n}\n\nconst DEFAULT_MAX_HEIGHT = 480;\n\n/** The frame-safe video: poster card → Play loads the bytes on demand → whole video, real aspect. */\nexport function DefaultKindVideo({ video, title, runAction, maxHeight = DEFAULT_MAX_HEIGHT, pending, className }: KindVideoProps) {\n  const ref = toMediaRef(video);\n  const [state, setState] = React.useState<{ phase: \"idle\" | \"loading\" | \"ready\" | \"error\"; url?: string; error?: string }>({ phase: \"idle\" });\n  const urlRef = React.useRef<string | null>(null);\n  React.useEffect(\n    () => () => {\n      if (urlRef.current) URL.revokeObjectURL(urlRef.current);\n    },\n    [],\n  );\n  if (!ref && !pending) return null;\n  const name = title?.trim() || \"Video\";\n  const box = kindVideoBoxStyle(ref, maxHeight);\n  const duration = formatMediaDuration(ref?.duration);\n  const playable = ref?.src || (state.phase === \"ready\" ? state.url : null);\n\n  const play = async () => {\n    if (!ref) return;\n    if (ref.file_id) {\n      setState({ phase: \"loading\" });\n      const out = await loadMediaThroughHost(runAction, ref);\n      if (out.ok) {\n        urlRef.current = out.url;\n        setState({ phase: \"ready\", url: out.url });\n      } else setState({ phase: \"error\", error: out.error });\n    } else if (ref.url && runAction) {\n      const out = await runAction(\"play_embed\", { url: ref.url, title: name });\n      if (!out.ok) setState({ phase: \"error\", error: out.error });\n    }\n  };\n  const expand = async () => {\n    if (!runAction || !ref?.file_id) return;\n    const out = await runAction(\"open_file\", { file_id: ref.file_id, name });\n    if (!out.ok) setState({ phase: \"error\", error: out.error });\n  };\n\n  return (\n    <figure className={cn(\"group relative my-1 max-w-full\", className)} style={box} data-kind-video=\"\">\n      {playable ? (\n        <video\n          src={playable}\n          controls\n          autoPlay={!ref?.src}\n          playsInline\n          preload=\"metadata\"\n          aria-label={name}\n          className=\"h-full w-full rounded-md bg-black object-contain\"\n          style={{ maxHeight }}\n        />\n      ) : state.phase === \"loading\" || (pending && !ref) ? (\n        <div role=\"status\" aria-label=\"Loading video\" className=\"flex h-full min-h-24 w-full items-center justify-center rounded-md bg-muted\">\n          <Loader2Icon className=\"h-4 w-4 animate-spin text-muted-foreground\" />\n        </div>\n      ) : (\n        <button\n          type=\"button\"\n          onClick={() => void play()}\n          disabled={!runAction}\n          aria-label={`Play ${name}`}\n          className=\"relative flex h-full min-h-24 w-full flex-col items-center justify-center gap-2 overflow-hidden rounded-md bg-muted/40 text-foreground hover:bg-muted\"\n        >\n          {ref?.poster ? <img src={ref.poster} alt=\"\" className=\"absolute inset-0 h-full w-full object-contain\" /> : null}\n          <span className=\"relative inline-flex h-12 w-12 items-center justify-center rounded-full bg-background/90 shadow-sm ring-1 ring-border\">\n            <Play className=\"h-5 w-5\" />\n          </span>\n          <span className=\"relative max-w-full truncate px-3 text-xs text-muted-foreground\">\n            {duration ? `${name} · ${duration}` : name}\n          </span>\n        </button>\n      )}\n      {runAction && ref?.file_id && !playable ? (\n        <div className=\"absolute right-1.5 top-1.5 flex gap-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100\">\n          <button\n            type=\"button\"\n            title=\"Expand\"\n            aria-label=\"Expand\"\n            onClick={() => void expand()}\n            className=\"inline-flex h-7 w-7 items-center justify-center rounded-md border border-border bg-background/90 text-foreground shadow-sm hover:bg-muted\"\n          >\n            <Maximize2Icon className=\"h-3.5 w-3.5\" />\n          </button>\n        </div>\n      ) : null}\n      {state.phase === \"error\" ? (\n        <figcaption role=\"alert\" className=\"mt-1 truncate text-xs text-destructive\" title={state.error}>\n          {state.error}\n        </figcaption>\n      ) : null}\n    </figure>\n  );\n}\n","/**\n * Shared bits of KindVideo / KindAudio: the ref shape, the actions' answer shape and small pure helpers.\n */\nimport type * as React from \"react\";\nimport { formatDurationMs } from \"@ai-matrx/kit/format\";\n\n/** A video or audio a shape shows: a saved file (durable identity) or a web address. */\nexport interface KindMediaRef {\n  /** A saved file's id — preferred. The host fetches the bytes on demand. */\n  file_id?: string | null;\n  /** A web address, when the media is not a saved file. */\n  url?: string | null;\n  mime_type?: string | null;\n  width?: number | null;\n  height?: number | null;\n  /** Length in seconds, when known. */\n  duration?: number | null;\n  organization_id?: string | null;\n  /** A poster image address (web, or a blob: URL the host made). Optional. */\n  poster?: string | null;\n  /** A playable address the host already made (a blob: URL). When present the media plays at once. */\n  src?: string | null;\n}\n\n/** What the host's `load_media` action answers: the file's bytes. */\nexport interface KindLoadedMedia {\n  blob: Blob;\n  mime_type?: string | null;\n}\n\nexport type KindRunAction = (\n  key: string,\n  input: unknown,\n) => Promise<{ ok: true; result: unknown } | { ok: false; error: string }>;\n\n/** A bare web address is a ref with a url. */\nexport function toMediaRef(value: KindMediaRef | string | null | undefined): KindMediaRef | null {\n  if (!value) return null;\n  if (typeof value === \"string\") return value.trim() ? { url: value.trim() } : null;\n  return value;\n}\n\n/** 83 → \"1:23\", 3725 → \"1:02:05\"; null when not a usable number. */\nexport function formatMediaDuration(seconds: number | null | undefined): string | null {\n  if (typeof seconds !== \"number\" || !Number.isFinite(seconds) || seconds < 0) return null;\n  return formatDurationMs(Math.round(seconds) * 1000, { style: \"clock\" });\n}\n\n/** The box a video lives in: its real ratio, as wide as it can be without exceeding maxHeight. */\nexport function kindVideoBoxStyle(ref: KindMediaRef | null | undefined, maxHeight: number): React.CSSProperties {\n  const w = ref?.width ?? 0;\n  const h = ref?.height ?? 0;\n  const ratio = w > 0 && h > 0 ? w / h : 16 / 9;\n  return {\n    aspectRatio: String(ratio),\n    width: `min(100%, ${Math.round(maxHeight * ratio)}px)`,\n    maxHeight,\n  };\n}\n\n/**\n * Fetch a saved file's bytes through the host (`load_media`) and mint a playable blob: URL.\n * Used by the sealed frame, where nothing can reach a file host. The caller revokes the URL.\n */\nexport async function loadMediaThroughHost(\n  runAction: KindRunAction | undefined,\n  ref: KindMediaRef,\n): Promise<{ ok: true; url: string } | { ok: false; error: string }> {\n  if (!runAction || !ref.file_id) return { ok: false, error: \"This file can't be played here.\" };\n  const out = await runAction(\"load_media\", { file_id: ref.file_id, organization_id: ref.organization_id ?? undefined });\n  if (!out.ok) return { ok: false, error: out.error };\n  const loaded = out.result as Partial<KindLoadedMedia> | null;\n  const blob = loaded && loaded.blob instanceof Blob ? loaded.blob : null;\n  if (!blob) return { ok: false, error: \"The file came back empty.\" };\n  return { ok: true, url: URL.createObjectURL(blob) };\n}\n","\"use client\";\n\n/**\n * KindAudio parts — the props and the frame-safe default.\n *\n * KindAudio — THE audio a shape plays. Never a bare `<audio>`.\n *\n * Takes a saved ref (`{ file_id, mime_type, duration? }`) or a web address. In the page it is the\n * host's canonical audio player (durable file handle, retry, playback session). In the sealed frame it\n * is a compact row with Play: Play asks the host for the bytes (`load_media`) and plays them from a\n * blob: URL — nothing downloads until Play. A web address cannot play inside the frame; its Play asks\n * the host to open the real player in a window (`play_embed`).\n */\nimport * as React from \"react\";\nimport { cn } from \"@ai-matrx/design-system\";\nimport { Loader2Icon } from \"@ai-matrx/design-system/icons\";\nimport { Music, Play } from \"./icons\";\nimport {\n  formatMediaDuration,\n  loadMediaThroughHost,\n  toMediaRef,\n  type KindMediaRef,\n  type KindRunAction,\n} from \"./kind-media\";\n\nexport interface KindAudioProps {\n  /** The saved audio ref, a web address, or a ref carrying `url`. Missing renders nothing. */\n  audio: KindMediaRef | string | null | undefined;\n  /** What the audio is (shown on the row). */\n  title?: string;\n  /** The component's `runAction` prop — Play goes through it inside a sandbox frame. */\n  runAction?: KindRunAction;\n  /** While a run is producing the audio (no ref yet), show the placeholder anyway. */\n  pending?: boolean;\n  className?: string;\n}\n\n/** The frame-safe audio row: Play loads the bytes on demand, then the native controls take over. */\nexport function DefaultKindAudio({ audio, title, runAction, pending, className }: KindAudioProps) {\n  const ref = toMediaRef(audio);\n  const [state, setState] = React.useState<{ phase: \"idle\" | \"loading\" | \"ready\" | \"error\"; url?: string; error?: string }>({ phase: \"idle\" });\n  const urlRef = React.useRef<string | null>(null);\n  React.useEffect(\n    () => () => {\n      if (urlRef.current) URL.revokeObjectURL(urlRef.current);\n    },\n    [],\n  );\n  if (!ref && !pending) return null;\n  const name = title?.trim() || \"Audio\";\n  const duration = formatMediaDuration(ref?.duration);\n  const playable = ref?.src || (state.phase === \"ready\" ? state.url : null);\n\n  const play = async () => {\n    if (!ref) return;\n    if (ref.file_id) {\n      setState({ phase: \"loading\" });\n      const out = await loadMediaThroughHost(runAction, ref);\n      if (out.ok) {\n        urlRef.current = out.url;\n        setState({ phase: \"ready\", url: out.url });\n      } else setState({ phase: \"error\", error: out.error });\n    } else if (ref.url && runAction) {\n      const out = await runAction(\"play_embed\", { url: ref.url, title: name });\n      if (!out.ok) setState({ phase: \"error\", error: out.error });\n    }\n  };\n\n  return (\n    <div className={cn(\"my-1 w-full max-w-full\", className)} data-kind-audio=\"\">\n      {playable ? (\n        <audio src={playable} controls autoPlay={!ref?.src} preload=\"metadata\" aria-label={name} className=\"w-full\" />\n      ) : (\n        <button\n          type=\"button\"\n          onClick={() => void play()}\n          disabled={!runAction || state.phase === \"loading\"}\n          aria-label={`Play ${name}`}\n          className=\"flex w-full items-center gap-3 rounded-md bg-muted/40 px-3 py-2 text-left text-foreground hover:bg-muted\"\n        >\n          <span className=\"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-background ring-1 ring-border\">\n            {state.phase === \"loading\" || (pending && !ref) ? <Loader2Icon className=\"h-4 w-4 animate-spin\" /> : <Play className=\"h-4 w-4\" />}\n          </span>\n          <Music className=\"h-4 w-4 shrink-0 text-muted-foreground\" />\n          <span className=\"min-w-0 flex-1 truncate text-sm\">{name}</span>\n          {duration ? <span className=\"shrink-0 text-xs tabular-nums text-muted-foreground\">{duration}</span> : null}\n        </button>\n      )}\n      {state.phase === \"error\" ? (\n        <p role=\"alert\" className=\"mt-1 truncate text-xs text-destructive\" title={state.error}>\n          {state.error}\n        </p>\n      ) : null}\n    </div>\n  );\n}\n","\"use client\";\n\n/**\n * KindEmbed parts — the props and the frame-safe default.\n *\n * KindEmbed — THE way a shape shows a YouTube / Vimeo / Loom / Google Maps / Figma link. Never an\n * `<iframe>` (the sealed frame cannot open one, and an author must not try).\n *\n * In the page the host renders the provider's own embed. In the sealed frame — no frame-src, no\n * network — it is a poster card: the thumbnail where the link alone gives one (YouTube), the provider\n * and the title, and Play, which asks the host through `runAction(\"play_embed\", { url, title })` to open\n * the real embed in a window. A link with no known embed shows an Open card (`open_url`).\n */\nimport * as React from \"react\";\nimport { cn } from \"@ai-matrx/design-system\";\nimport { ExternalLink, Play } from \"./icons\";\nimport { parseEmbed } from \"./embed-url\";\nimport type { KindRunAction } from \"./kind-media\";\n\nexport interface KindEmbedProps {\n  /** The link to show: a YouTube, Vimeo, Loom, Google Maps or Figma address (any other link becomes an Open card). */\n  url: string | null | undefined;\n  /** What it is (card title and window title). Defaults to the provider's name. */\n  title?: string;\n  /** The component's `runAction` prop — Play and Open go through it inside a sandbox frame. */\n  runAction?: KindRunAction;\n  /** Tallest the embed may render, in px. */\n  maxHeight?: number;\n  className?: string;\n}\n\nconst DEFAULT_MAX_HEIGHT = 480;\n\n/** The embed's box: its provider's ratio, as wide as it can be without exceeding maxHeight. */\nexport function kindEmbedBoxStyle(aspect: number, maxHeight: number): React.CSSProperties {\n  return { aspectRatio: String(aspect), width: `min(100%, ${Math.round(maxHeight * aspect)}px)`, maxHeight };\n}\n\nfunction hostLabel(url: string): string {\n  try {\n    return new URL(url).hostname.replace(/^www\\./, \"\");\n  } catch {\n    return url;\n  }\n}\n\n/** The frame-safe embed: a poster card whose Play opens the real embed through the host. */\nexport function DefaultKindEmbed({ url, title, runAction, maxHeight = DEFAULT_MAX_HEIGHT, className }: KindEmbedProps) {\n  const [error, setError] = React.useState<string | null>(null);\n  if (!url || !url.trim()) return null;\n  const embed = parseEmbed(url);\n  const embeddable = embed.embedUrl !== null;\n  const name = title?.trim() || (embeddable ? embed.label : hostLabel(embed.url));\n  const go = async () => {\n    if (!runAction) return;\n    const out = embeddable\n      ? await runAction(\"play_embed\", { url: embed.url, title: name })\n      : await runAction(\"open_url\", { url: embed.url });\n    setError(out.ok ? null : out.error);\n  };\n  return (\n    <figure className={cn(\"my-1 max-w-full\", className)} style={kindEmbedBoxStyle(embed.aspect, maxHeight)} data-kind-embed=\"\" data-provider={embed.provider}>\n      <button\n        type=\"button\"\n        onClick={() => void go()}\n        disabled={!runAction}\n        aria-label={embeddable ? `Play ${name}` : `Open ${name}`}\n        className=\"relative flex h-full min-h-24 w-full flex-col items-center justify-center gap-2 overflow-hidden rounded-md bg-muted/40 text-foreground hover:bg-muted\"\n      >\n        {embed.poster ? <img src={embed.poster} alt=\"\" className=\"absolute inset-0 h-full w-full object-cover opacity-90\" /> : null}\n        <span className=\"relative inline-flex h-12 w-12 items-center justify-center rounded-full bg-background/90 shadow-sm ring-1 ring-border\">\n          {embeddable ? <Play className=\"h-5 w-5\" /> : <ExternalLink className=\"h-5 w-5\" />}\n        </span>\n        <span className=\"relative max-w-full truncate rounded bg-background/80 px-2 py-0.5 text-xs text-foreground\">\n          {embeddable ? `${embed.label} · ${name === embed.label ? \"Play\" : name}` : name}\n        </span>\n      </button>\n      {error ? (\n        <figcaption role=\"alert\" className=\"mt-1 truncate text-xs text-destructive\" title={error}>\n          {error}\n        </figcaption>\n      ) : null}\n    </figure>\n  );\n}\n","/**\n * embed-url — pure: a pasted link → how to show it. No network, no DOM.\n *\n * Providers: YouTube, Vimeo, Loom, Google Maps, Figma. Anything else is `generic`: it has no known\n * embed, so a shape shows a link card and the host opens it in a new tab.\n * `embedUrl` is the provider's own embeddable address (the page puts it in an iframe; the sealed\n * frame never does — it opens it through the host, see KindEmbedDefault).\n */\nexport type EmbedProvider = \"youtube\" | \"vimeo\" | \"loom\" | \"google-maps\" | \"figma\" | \"generic\";\n\nexport interface ParsedEmbed {\n  provider: EmbedProvider;\n  /** The link as the person gave it (trimmed). */\n  url: string;\n  /** What to put in an iframe; null when the provider has no embed for this link. */\n  embedUrl: string | null;\n  /** A thumbnail derivable from the link alone (YouTube); null otherwise. */\n  poster: string | null;\n  /** width / height of the embed. */\n  aspect: number;\n  /** A short name for the provider, for a card with no better title. */\n  label: string;\n  /** YouTube only: the video id. */\n  videoId?: string;\n  /** YouTube only: start offset in seconds. */\n  start?: number;\n}\n\nconst LABELS: Record<EmbedProvider, string> = {\n  youtube: \"YouTube\",\n  vimeo: \"Vimeo\",\n  loom: \"Loom\",\n  \"google-maps\": \"Google Maps\",\n  figma: \"Figma\",\n  generic: \"Link\",\n};\n\nfunction hostOf(u: URL): string {\n  return u.hostname.toLowerCase().replace(/^www\\./, \"\");\n}\n\nfunction ytStart(u: URL): number | undefined {\n  const raw = u.searchParams.get(\"t\") ?? u.searchParams.get(\"start\");\n  if (!raw) return undefined;\n  if (/^\\d+$/.test(raw)) return Number(raw);\n  const m = /^(?:(\\d+)h)?(?:(\\d+)m)?(?:(\\d+)s)?$/.exec(raw);\n  if (!m) return undefined;\n  const secs = Number(m[1] ?? 0) * 3600 + Number(m[2] ?? 0) * 60 + Number(m[3] ?? 0);\n  return secs > 0 ? secs : undefined;\n}\n\nfunction youtubeId(u: URL): string | null {\n  const host = hostOf(u);\n  let id: string | null = null;\n  if (host === \"youtu.be\") id = u.pathname.split(\"/\")[1] ?? null;\n  else if (host === \"youtube.com\" || host === \"m.youtube.com\" || host === \"youtube-nocookie.com\" || host === \"music.youtube.com\") {\n    if (u.pathname === \"/watch\") id = u.searchParams.get(\"v\");\n    else {\n      const m = /^\\/(?:embed|shorts|live|v)\\/([^/?#]+)/.exec(u.pathname);\n      id = m ? (m[1] ?? null) : null;\n    }\n  }\n  return id && /^[A-Za-z0-9_-]{6,20}$/.test(id) ? id : null;\n}\n\nfunction mapsEmbed(u: URL): string | null {\n  const host = hostOf(u);\n  const isMaps = (host === \"google.com\" || host.endsWith(\".google.com\")) && u.pathname.startsWith(\"/maps\");\n  if (host === \"maps.app.goo.gl\" || host === \"goo.gl\") return null;\n  if (!isMaps && !(host === \"maps.google.com\")) return null;\n  if (u.pathname.startsWith(\"/maps/embed\")) return u.href;\n  const place = /\\/maps\\/place\\/([^/@?#]+)/.exec(u.pathname);\n  const at = /@(-?\\d+(?:\\.\\d+)?),(-?\\d+(?:\\.\\d+)?)/.exec(u.pathname);\n  const q =\n    (place?.[1] ? decodeURIComponent(place[1].replace(/\\+/g, \" \")) : null) ??\n    u.searchParams.get(\"q\") ??\n    u.searchParams.get(\"query\") ??\n    (at ? `${at[1]},${at[2]}` : null);\n  if (!q) return null;\n  return `https://maps.google.com/maps?q=${encodeURIComponent(q)}&output=embed`;\n}\n\n/** Parse a link. A string that is not an http(s) URL is `generic` with no embed. */\nexport function parseEmbed(input: string | null | undefined): ParsedEmbed {\n  const url = (input ?? \"\").trim();\n  const generic: ParsedEmbed = { provider: \"generic\", url, embedUrl: null, poster: null, aspect: 16 / 9, label: LABELS.generic };\n  let u: URL;\n  try {\n    u = new URL(url);\n  } catch {\n    return generic;\n  }\n  if (u.protocol !== \"https:\" && u.protocol !== \"http:\") return generic;\n  const host = hostOf(u);\n\n  const yt = youtubeId(u);\n  if (yt) {\n    const start = ytStart(u);\n    return {\n      provider: \"youtube\",\n      url,\n      videoId: yt,\n      ...(start ? { start } : {}),\n      embedUrl: `https://www.youtube-nocookie.com/embed/${yt}?autoplay=1&rel=0${start ? `&start=${start}` : \"\"}`,\n      poster: `https://i.ytimg.com/vi/${yt}/hqdefault.jpg`,\n      aspect: 16 / 9,\n      label: LABELS.youtube,\n    };\n  }\n  if (host === \"vimeo.com\" || host === \"player.vimeo.com\") {\n    const m = /\\/(?:video\\/)?(\\d{5,})/.exec(u.pathname);\n    if (m) {\n      return { provider: \"vimeo\", url, embedUrl: `https://player.vimeo.com/video/${m[1]}?autoplay=1`, poster: null, aspect: 16 / 9, label: LABELS.vimeo };\n    }\n  }\n  if (host === \"loom.com\") {\n    const m = /\\/(?:share|embed)\\/([a-f0-9]{16,})/i.exec(u.pathname);\n    if (m) {\n      return { provider: \"loom\", url, embedUrl: `https://www.loom.com/embed/${m[1]}`, poster: null, aspect: 16 / 9, label: LABELS.loom };\n    }\n  }\n  const maps = mapsEmbed(u);\n  if (maps) return { provider: \"google-maps\", url, embedUrl: maps, poster: null, aspect: 4 / 3, label: LABELS[\"google-maps\"] };\n  if (host === \"figma.com\" && /^\\/(file|design|proto|board|slides|deck)\\//.test(u.pathname)) {\n    return {\n      provider: \"figma\",\n      url,\n      embedUrl: `https://www.figma.com/embed?embed_host=matrx&url=${encodeURIComponent(u.href)}`,\n      poster: null,\n      aspect: 16 / 10,\n      label: LABELS.figma,\n    };\n  }\n  return generic;\n}\n","\"use client\";\n\n/**\n * KindPanelGrid — content-aware responsive grid for side-by-side panels.\n *\n * Never more columns than the content can afford: every track is at least\n * `minColumnWidth` (default 280px) wide, the column count is whatever fits\n * (`auto-fit`), and every panel in a row stretches to the same height so the\n * panels' footers line up. Pair with `KindPanel` (its `footer` is pinned to\n * the bottom). Panels are flat by default, so the grid separates them by\n * SPACE (default 16px), never by boxing them. Contract: `kind-kit/README.md`.\n */\n\nimport * as React from \"react\";\nimport { cn } from \"@ai-matrx/design-system\";\n\nconst GAP_PX = { sm: 8, md: 12, lg: 16 } as const;\nconst GAP_CLASS = { sm: \"gap-2\", md: \"gap-3\", lg: \"gap-4\" } as const;\n\nexport interface KindPanelGridProps {\n  children: React.ReactNode;\n  /** Minimum width (px) of a column before the grid drops a column. Default 280. */\n  minColumnWidth?: number;\n  /** Hard ceiling on columns, however wide the container is. */\n  maxColumns?: number;\n  /** Space between panels. Default \"lg\" (16px) — flat sections need air, not borders. */\n  gap?: keyof typeof GAP_PX;\n  /**\n   * \"auto-fit\" (default): a short last row lets panels grow to fill the width.\n   * \"auto-fill\": tracks stay the same width and the row is left short.\n   */\n  fill?: \"auto-fit\" | \"auto-fill\";\n  className?: string;\n}\n\nexport function KindPanelGrid({\n  children,\n  minColumnWidth = 280,\n  maxColumns,\n  gap = \"lg\",\n  fill = \"auto-fit\",\n  className,\n}: KindPanelGridProps) {\n  const min = `min(100%, ${minColumnWidth}px)`;\n  // With a column ceiling, each track must also be at least 1/n of the row —\n  // which caps the count at n while still never going under minColumnWidth.\n  const track =\n    maxColumns && maxColumns > 0\n      ? `max(${min}, calc((100% - ${GAP_PX[gap] * (maxColumns - 1)}px) / ${maxColumns}))`\n      : min;\n  return (\n    <div\n      className={cn(\"grid items-stretch\", GAP_CLASS[gap], className)}\n      style={{ gridTemplateColumns: `repeat(${fill}, minmax(${track}, 1fr))` }}\n    >\n      {children}\n    </div>\n  );\n}\n","\"use client\";\n\n/**\n * KindPanel — the standard section of a kind component (a keyword bucket, an\n * option, a group of results).\n *\n * FLAT BY DEFAULT (Arman, 2026-10-24: \"Avoid cards at all costs. Especially\n * cards within other cards.\"): no border, no card background, no shadow, no\n * padding of its own — the section sits on the shape's surface, aligned to the\n * header's edge, and siblings in a `KindPanelGrid` are separated by spacing.\n * `variant=\"card\"` is the one deliberate opt-in surface; it is never the\n * default. `title` is optional: a shape with one section omits it (the header\n * already named the thing), and the icon is optional too — never repeat the\n * header's icon here.\n *\n * Layout is fixed so agent-authored panels come out right by construction:\n *  - quiet heading row: icon · title (wraps, never squeezed) · count · ≤2 inline\n *    actions · an overflow menu that absorbs EVERY other control (no control\n *    row ever gets crammed);\n *  - full-width subline (a rationale, a hint) on its own line UNDER the\n *    header — never beside the title;\n *  - body;\n *  - `footer` pinned to the bottom (flex column + mt-auto) so \"Add\" rows\n *    line up across sibling panels in a `KindPanelGrid`.\n * Contract: `kind-kit/README.md`.\n */\n\nimport * as React from \"react\";\nimport { MoreHorizontal } from \"./icons\";\nimport { Loader2Icon } from \"@ai-matrx/design-system/icons\";\nimport {\n  Button,\n  cn,\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuSeparator,\n  DropdownMenuTrigger,\n} from \"@ai-matrx/design-system\";\n\nimport {\n  renderKindKitIcon,\n  type KindKitIcon,\n} from \"./icon-slot\";\n\nexport interface KindPanelMenuItem {\n  label: string;\n  onSelect: () => void;\n  icon?: React.ComponentType<{ className?: string }>;\n  disabled?: boolean;\n  /** Renders in the destructive color (delete, clear, reset). */\n  destructive?: boolean;\n  /** Draws a separator ABOVE this item. */\n  separatorBefore?: boolean;\n}\n\nexport interface KindPanelProps {\n  /**\n   * Section heading. Wraps onto extra lines rather than truncating. Omit it\n   * (with no count/badge/actions/menu) and the heading row is not drawn — a\n   * shape with a single section never repeats the header's title.\n   */\n  title?: React.ReactNode;\n  /** Optional glyph before the title. Never the header's icon again. */\n  icon?: KindKitIcon;\n  /** Quiet count after the title (e.g. number of items). */\n  count?: number | string;\n  /** Any extra pill/badge after the count (a status, a score); plain text is drawn as a tag. */\n  badge?: React.ReactNode;\n  /** Shows a spinner in the header while this panel's data is still arriving. */\n  streaming?: boolean;\n  /**\n   * At most one or two compact controls rendered inline on the right of the\n   * header (a toggle, a tiny icon button). Put everything else in `menuItems`.\n   */\n  actions?: React.ReactNode;\n  /** Controls collapsed into the header's overflow (⋯) menu. */\n  menuItems?: KindPanelMenuItem[];\n  /** Full-width line under the header — a rationale, a hint. Never beside the title. */\n  subline?: React.ReactNode;\n  /** Panel body. */\n  children?: React.ReactNode;\n  /** Pinned to the bottom of the panel (an \"Add\" row, a summary, a copy bar). */\n  footer?: React.ReactNode;\n  /**\n   * \"flat\" (default): no border, background or padding — the section sits on\n   * the shape's surface. \"card\": the deliberate opt-in bordered surface (a\n   * thing that truly is an object on a board); never nest one in another.\n   * \"bare\" is accepted as \"flat\".\n   */\n  variant?: \"flat\" | \"card\" | \"bare\";\n  /** Tighter paddings for dense lists. */\n  dense?: boolean;\n  className?: string;\n  /** className for the body wrapper. */\n  bodyClassName?: string;\n}\n\nexport function KindPanel({\n  title,\n  icon,\n  count,\n  badge,\n  streaming = false,\n  actions,\n  menuItems,\n  subline,\n  children,\n  footer,\n  variant = \"flat\",\n  dense = false,\n  className,\n  bodyClassName,\n}: KindPanelProps) {\n  const card = variant === \"card\";\n  // A card pads its content; a flat section aligns to the shape's own edge.\n  const px = card ? (dense ? \"px-2.5\" : \"px-3\") : \"px-0\";\n  const menu = menuItems && menuItems.length > 0 ? menuItems : null;\n  const hasTitle = title !== undefined && title !== null && title !== \"\";\n  const hasHeading =\n    hasTitle ||\n    count !== undefined ||\n    (badge !== undefined && badge !== null && badge !== \"\") ||\n    streaming ||\n    !!actions ||\n    !!menu;\n  return (\n    <section\n      data-kind-panel={card ? \"card\" : \"flat\"}\n      className={cn(\n        \"flex h-full min-h-0 min-w-0 flex-col\",\n        card && \"rounded-lg border border-border bg-card\",\n        className,\n      )}\n    >\n      {hasHeading && (\n      <header\n        className={cn(\n          \"flex min-h-6 items-start gap-2 text-xs leading-6\",\n          px,\n          card ? (dense ? \"pt-2\" : \"pt-3\") : \"pt-0\",\n        )}\n      >\n        {renderKindKitIcon(icon, \"matrx-line-icon-sm text-muted-foreground\")}\n        <h3 className=\"min-w-0 flex-1 text-xs font-semibold uppercase leading-6 tracking-wide text-muted-foreground break-words\">\n          {title}\n        </h3>\n        {count !== undefined && (\n          <span className=\"shrink-0 text-xs leading-6 tabular-nums text-muted-foreground\">\n            {count}\n          </span>\n        )}\n        {/* A plain-text badge (a category, a status word) is drawn as a tag; empty text is no badge. */}\n        {typeof badge === \"string\" || typeof badge === \"number\" ? (\n          badge !== \"\" && (\n            <span className=\"mt-1 shrink-0 rounded-md border border-border px-1.5 py-0.5 text-[10px] leading-none text-muted-foreground\">\n              {badge}\n            </span>\n          )\n        ) : badge !== undefined && badge !== null ? (\n          <span className=\"shrink-0\">{badge}</span>\n        ) : null}\n        {streaming && (\n          <Loader2Icon\n            aria-label=\"Still arriving\"\n            className=\"matrx-line-icon-xs animate-spin text-muted-foreground\"\n          />\n        )}\n        {actions && (\n          <div className=\"flex shrink-0 items-center gap-1\">{actions}</div>\n        )}\n        {menu && (\n          <DropdownMenu>\n            <DropdownMenuTrigger asChild>\n              <Button\n                type=\"button\"\n                variant=\"ghost\"\n                size=\"icon\"\n                aria-label=\"More actions\"\n                className=\"-mr-1 h-6 w-6 shrink-0 text-muted-foreground\"\n              >\n                <MoreHorizontal className=\"h-4 w-4\" />\n              </Button>\n            </DropdownMenuTrigger>\n            <DropdownMenuContent align=\"end\" className=\"min-w-44\">\n              {menu.map((item, i) => (\n                <React.Fragment key={`${i}-${item.label}`}>\n                  {item.separatorBefore && i > 0 && <DropdownMenuSeparator />}\n                  <DropdownMenuItem\n                    disabled={item.disabled ?? false}\n                    onSelect={() => item.onSelect()}\n                    className={cn(\n                      \"text-xs\",\n                      item.destructive &&\n                        \"text-destructive focus:text-destructive\",\n                    )}\n                  >\n                    {item.icon && <item.icon className=\"mr-2 h-3.5 w-3.5\" />}\n                    {item.label}\n                  </DropdownMenuItem>\n                </React.Fragment>\n              ))}\n            </DropdownMenuContent>\n          </DropdownMenu>\n        )}\n      </header>\n      )}\n      {subline !== undefined && subline !== null && subline !== \"\" && (\n        <div\n          className={cn(\n            \"pt-0.5 text-xs leading-snug text-muted-foreground break-words\",\n            px,\n          )}\n        >\n          {subline}\n        </div>\n      )}\n      <div\n        className={cn(\n          \"min-w-0 flex-1\",\n          px,\n          card ? (dense ? \"py-1.5\" : \"py-2\") : hasHeading ? \"pt-1\" : \"\",\n          bodyClassName,\n        )}\n      >\n        {children}\n      </div>\n      {footer !== undefined && footer !== null && (\n        <div\n          className={cn(\n            \"mt-auto\",\n            px,\n            card\n              ? cn(\"border-t border-border\", dense ? \"py-1.5\" : \"py-2\")\n              : \"pt-2\",\n          )}\n        >\n          {footer}\n        </div>\n      )}\n    </section>\n  );\n}\n","import * as React from \"react\";\n\nimport { cn } from \"@ai-matrx/design-system\";\n\nexport type KindKitIcon =\n  | React.ComponentType<{ className?: string }>\n  | React.ReactElement<{ className?: string }>;\n\n/**\n * Babel-sandbox imports normally bind a component directly, but an ESM/CJS\n * interop boundary may hand us `{ default: Component }`. React reports that\n * wrapper as error #130 if it is passed to createElement unchanged.\n */\nfunction resolveIconType(icon: unknown): React.ElementType | null {\n  if (typeof icon === \"function\") return icon as React.ElementType;\n  if (typeof icon !== \"object\" || icon === null) return null;\n\n  const candidate = icon as Record<PropertyKey, unknown>;\n  if (typeof candidate.$$typeof === \"symbol\") {\n    return icon as React.ElementType;\n  }\n  if (\"default\" in candidate && candidate.default !== icon) {\n    return resolveIconType(candidate.default);\n  }\n  return null;\n}\n\n/** Render either icon authoring form without treating an element as a component type. */\nexport function renderKindKitIcon(\n  icon: KindKitIcon | undefined,\n  className: string,\n): React.ReactElement | null {\n  if (!icon) return null;\n  if (React.isValidElement<{ className?: string }>(icon)) {\n    return React.cloneElement(icon, {\n      className: cn(className, icon.props.className),\n    });\n  }\n  const Icon = resolveIconType(icon);\n  return Icon ? React.createElement(Icon, { className }) : null;\n}\n","\"use client\";\n\n/**\n * KindHeaderBar — the standard compact header of a kind component:\n * icon · title (the instance's `title_key` value) · at-a-glance stats · the\n * copy bar (the host's `CopyButtons` slot: Copy / Copy-for-AI / JSON / Export from builders\n * the caller supplies). One row that wraps on narrow widths; the copy bar\n * stays on the right. Never a card: a full-width row with no border or\n * background, and no padding of its own — the shape's frame supplies the one\n * normal padding, so the header and the sections under it share one left\n * edge. The icon and the title appear here ONCE; sections never repeat them.\n * Contract: `kind-kit/README.md`.\n */\n\nimport * as React from \"react\";\nimport { Loader2Icon } from \"@ai-matrx/design-system/icons\";\nimport { cn } from \"@ai-matrx/design-system\";\nimport { getKindKitHost, type KindKitCopyProps } from \"./kind-kit-host\";\nimport {\n  renderKindKitIcon,\n  type KindKitIcon,\n} from \"./icon-slot\";\n\nexport interface KindHeaderStat {\n  /** Short label, e.g. \"keywords\". */\n  label: string;\n  /** The number/text, e.g. 42 or \"3 buckets\". */\n  value: React.ReactNode;\n  /** Lucide component or an already-created icon element. */\n  icon?: KindKitIcon;\n  /** Optional hover text. */\n  title?: string;\n}\n\nexport interface KindHeaderBarProps {\n  /** The instance title (usually `data[title_key]`). */\n  title: React.ReactNode;\n  /** Lucide component or an already-created icon element. */\n  icon?: KindKitIcon;\n  /** Small muted line under the title (a primary keyword, a subtitle). */\n  subtitle?: React.ReactNode;\n  /** At-a-glance numbers rendered as compact \"value label\" stats. */\n  stats?: KindHeaderStat[];\n  /** Shows a spinner + \"Streaming\" while the instance is still arriving. */\n  streaming?: boolean;\n  /** Word shown beside the spinner. Default \"Streaming\". */\n  streamingLabel?: string;\n  /**\n   * The copy bar. Pass the builders you have — `human` (text), `agent`\n   * (payload or string), `json` (raw record), `export` (download items) and\n   * the `label` used in toasts. Omit to render no copy bar.\n   */\n  copy?: KindKitCopyProps;\n  /** Extra controls rendered between the stats and the copy bar. */\n  actions?: React.ReactNode;\n  /** \"sm\" (default) for in-chat blocks; \"md\" for page-level kind surfaces. */\n  size?: \"sm\" | \"md\";\n  className?: string;\n}\n\nexport function KindHeaderBar({\n  title,\n  icon,\n  subtitle,\n  stats,\n  streaming = false,\n  streamingLabel = \"Streaming\",\n  copy,\n  actions,\n  size = \"sm\",\n  className,\n}: KindHeaderBarProps) {\n  const { CopyButtons } = getKindKitHost();\n  const titleCls = size === \"md\" ? \"text-base\" : \"text-sm\";\n  const iconNode = renderKindKitIcon(\n    icon,\n    cn(size === \"md\" ? \"matrx-line-icon-lg\" : \"matrx-line-icon\", \"text-primary\"),\n  );\n  return (\n    <div\n      data-kind-header=\"\"\n      className={cn(\"flex w-full flex-wrap items-center gap-x-3 gap-y-1.5\", className)}\n    >\n      <div className={cn(\"flex min-w-0 flex-1 basis-48 items-start gap-2 leading-tight\", titleCls)}>\n        {iconNode}\n        <div className=\"min-w-0 flex-1\">\n          <div\n            className={cn(\n              \"font-semibold leading-tight text-foreground break-words\",\n              titleCls,\n            )}\n          >\n            {title}\n          </div>\n          {subtitle !== undefined && subtitle !== null && subtitle !== \"\" && (\n            <div className=\"mt-0.5 text-xs leading-snug text-muted-foreground break-words\">\n              {subtitle}\n            </div>\n          )}\n        </div>\n      </div>\n      {stats && stats.length > 0 && (\n        <dl className=\"flex flex-wrap items-center gap-x-3 gap-y-1\">\n          {stats.map((s, i) => (\n            <div\n              key={`${i}-${s.label}`}\n              title={s.title}\n              className=\"flex items-baseline gap-1 text-xs\"\n            >\n              {renderKindKitIcon(\n                s.icon,\n                \"h-3 w-3 self-center text-muted-foreground\",\n              )}\n              <dd className=\"font-semibold tabular-nums text-foreground\">\n                {s.value}\n              </dd>\n              <dt className=\"text-muted-foreground\">{s.label}</dt>\n            </div>\n          ))}\n        </dl>\n      )}\n      {streaming && (\n        <span className=\"inline-flex items-center gap-1 text-xs text-muted-foreground\">\n          <Loader2Icon className=\"h-3 w-3 animate-spin\" />\n          {streamingLabel}\n        </span>\n      )}\n      {(actions || copy) && (\n        <div className=\"ml-auto flex shrink-0 items-center gap-1.5\">\n          {actions}\n          {copy && (\n            <CopyButtons {...copy} size={size === \"md\" ? \"sm\" : \"icon\"} />\n          )}\n        </div>\n      )}\n    </div>\n  );\n}\n","\"use client\";\n\n/**\n * KindActionButton — the one-click door from a kind component to a host\n * Action. Wraps the component's `runAction(key, input)` prop (the ONLY\n * side-effect channel; it never throws, it returns an `{ok}` envelope), with\n * a busy state, no double fire, an optional inline confirm that states the\n * consequence, and a one-line inline error (the host already toasts).\n * Contract: `kind-kit/README.md`.\n */\n\nimport * as React from \"react\";\nimport { Button, cn } from \"@ai-matrx/design-system\";\nimport { Loader2Icon } from \"@ai-matrx/design-system/icons\";\nimport { renderKindKitIcon, type KindKitIcon } from \"./icon-slot\";\n\nexport type KindActionEnvelope =\n  | { ok: true; result?: unknown }\n  | { ok: false; error: string };\n\n/** One action: `runAction` + `action` + `input`. */\ninterface KindActionSingle {\n  /** The component's `runAction` prop, passed straight through. */\n  runAction: (key: string, input: unknown) => Promise<KindActionEnvelope>;\n  /** Action key, e.g. \"run_shortcut\". */\n  action: string;\n  /** The action input, or a function that builds it at click time. */\n  input: unknown | (() => unknown);\n  run?: never;\n}\n\n/** A chain: `run` awaits several `runAction` calls and returns the final envelope. */\ninterface KindActionChain {\n  run: () => Promise<KindActionEnvelope>;\n  runAction?: never;\n  action?: never;\n  input?: never;\n}\n\ninterface KindActionButtonBase {\n  /** Short label. Also the aria-label/tooltip when `compact`. */\n  label: string;\n  /** Lucide component or an already-created icon element. */\n  icon?: KindKitIcon;\n  /** Label while running. Defaults to `label`. */\n  busyLabel?: string;\n  /** One-sentence consequence. When set, the first click asks to confirm. */\n  confirm?: string;\n  onDone?: (result: unknown) => void;\n  onError?: (error: string) => void;\n  variant?:\n    | \"default\"\n    | \"primary\"\n    | \"destructive\"\n    | \"success\"\n    | \"outline\"\n    | \"secondary\"\n    | \"ghost\"\n    | \"subtle\";\n  /** Icon-only with tooltip + aria-label, for menus and header rows. */\n  compact?: boolean;\n  disabled?: boolean;\n  className?: string;\n}\n\nexport type KindActionButtonProps = KindActionButtonBase &\n  (KindActionSingle | KindActionChain);\n\nconst ERROR_MAX = 60;\n\nexport function KindActionButton({\n  runAction,\n  action,\n  input,\n  run: runChain,\n  label,\n  icon,\n  busyLabel,\n  confirm,\n  onDone,\n  onError,\n  variant = \"outline\",\n  compact = false,\n  disabled = false,\n  className,\n}: KindActionButtonProps) {\n  const [busy, setBusy] = React.useState(false);\n  const [asking, setAsking] = React.useState(false);\n  const [error, setError] = React.useState<string | null>(null);\n  const inFlight = React.useRef(false);\n  const mounted = React.useRef(true);\n  const errorTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n  React.useEffect(() => {\n    mounted.current = true;\n    return () => {\n      mounted.current = false;\n      if (errorTimer.current) clearTimeout(errorTimer.current);\n    };\n  }, []);\n\n  const run = React.useCallback(async () => {\n    if (inFlight.current) return;\n    inFlight.current = true;\n    setAsking(false);\n    setError(null);\n    setBusy(true);\n    try {\n      let res: KindActionEnvelope;\n      if (runChain) {\n        res = await runChain();\n      } else {\n        const payload = typeof input === \"function\" ? (input as () => unknown)() : input;\n        res = await runAction!(action!, payload);\n      }\n      if (res && res.ok) {\n        onDone?.(res.result);\n      } else {\n        const message = (res && \"error\" in res && res.error) || \"Action failed\";\n        if (mounted.current) {\n          setError(message);\n          if (errorTimer.current) clearTimeout(errorTimer.current);\n          errorTimer.current = setTimeout(() => {\n            if (mounted.current) setError(null);\n          }, 8000);\n        }\n        onError?.(message);\n      }\n    } catch (e) {\n      // runAction promises never to throw; stay honest if a host breaks that.\n      const message = e instanceof Error ? e.message : \"Action failed\";\n      if (mounted.current) setError(message);\n      onError?.(message);\n    } finally {\n      inFlight.current = false;\n      if (mounted.current) setBusy(false);\n    }\n  }, [action, input, onDone, onError, runAction, runChain]);\n\n  const onClick = () => {\n    if (busy || disabled || inFlight.current) return;\n    if (confirm) setAsking(true);\n    else void run();\n  };\n\n  if (asking && !busy) {\n    return (\n      <span\n        role=\"group\"\n        aria-label={label}\n        className={cn(\n          \"inline-flex flex-wrap items-center gap-x-2 gap-y-1 rounded-md border border-border bg-card px-2 py-1 text-xs\",\n          className,\n        )}\n      >\n        <span className=\"text-foreground\">{confirm}</span>\n        <Button type=\"button\" size=\"xs\" variant={variant === \"outline\" ? \"default\" : variant} onClick={() => void run()}>\n          {label}\n        </Button>\n        <Button type=\"button\" size=\"xs\" variant=\"ghost\" onClick={() => setAsking(false)}>\n          Cancel\n        </Button>\n      </span>\n    );\n  }\n\n  const shownLabel = busy ? (busyLabel ?? label) : label;\n  const glyph = busy ? (\n    <Loader2Icon className=\"h-4 w-4 animate-spin\" />\n  ) : (\n    renderKindKitIcon(icon, \"h-4 w-4\")\n  );\n\n  return (\n    <span className={cn(\"inline-flex min-w-0 items-center gap-2\", className)}>\n      <Button\n        type=\"button\"\n        variant={variant}\n        size={compact ? \"icon-sm\" : \"sm\"}\n        disabled={disabled || busy}\n        aria-busy={busy || undefined}\n        aria-label={compact ? shownLabel : undefined}\n        title={compact ? label : undefined}\n        onClick={onClick}\n      >\n        {glyph}\n        {!compact && <span>{shownLabel}</span>}\n      </Button>\n      {error && (\n        <span\n          role=\"alert\"\n          title={error}\n          className=\"min-w-0 text-xs text-destructive\"\n        >\n          {error.length > ERROR_MAX ? `${error.slice(0, ERROR_MAX - 1)}…` : error}\n        </span>\n      )}\n    </span>\n  );\n}\n","\"use client\";\n\n/**\n * StreamingSkeleton + useStreamingValue — the \"before data lands\" kit.\n *\n * A kind component receives partial `data` on every envelope flush while the\n * agent streams: fields are absent, arrays are short, strings are cut. The\n * skeleton mimics the layout the real content will have (list / sections\n * (\"cards\", a legacy name — drawn flat) / table / text) for the instant before anything arrives; the helpers make\n * field reads tolerant so a component never crashes on a half-built\n * instance and never flickers a value away. Contract:\n * `kind-kit/README.md`.\n */\n\nimport * as React from \"react\";\nimport { cn, Skeleton } from \"@ai-matrx/design-system\";\n\nexport interface StreamingSkeletonProps {\n  /** Layout to mimic. Default \"list\". */\n  layout?: \"list\" | \"cards\" | \"table\" | \"text\";\n  /** Rows (list/table/text lines) or cards. Default 3. */\n  rows?: number;\n  /** Columns for \"table\" / \"cards\". Default 3 (table) / 2 (cards). */\n  columns?: number;\n  /** Render a title bar line above the body. Default true. */\n  header?: boolean;\n  /** Accessible label. Default \"Loading\". */\n  label?: string;\n  className?: string;\n}\n\nexport function StreamingSkeleton({\n  layout = \"list\",\n  rows = 3,\n  columns,\n  header = true,\n  label = \"Loading\",\n  className,\n}: StreamingSkeletonProps) {\n  const n = Math.max(1, rows);\n  const cols = Math.max(1, columns ?? (layout === \"cards\" ? 2 : 3));\n  return (\n    <div\n      role=\"status\"\n      aria-busy=\"true\"\n      aria-label={label}\n      className={cn(\"space-y-2\", className)}\n    >\n      {header && (\n        <div className=\"flex items-center gap-2\">\n          <Skeleton className=\"h-4 w-4 rounded\" />\n          <Skeleton className=\"h-4 w-40\" />\n          <Skeleton className=\"ml-auto h-6 w-16\" />\n        </div>\n      )}\n      {/* Every layout mimics the FLAT kit: hairline rows, unboxed sections, 6px chips — never cards. */}\n      {layout === \"list\" && (\n        <div className=\"flex flex-col divide-y divide-border\">\n          {Array.from({ length: n }).map((_, i) => (\n            <div key={i} className=\"flex items-center gap-2 py-2\">\n              <Skeleton className=\"h-4 w-4 rounded\" />\n              <Skeleton className={cn(\"h-3.5\", i % 3 === 0 ? \"w-2/3\" : i % 3 === 1 ? \"w-1/2\" : \"w-3/4\")} />\n            </div>\n          ))}\n        </div>\n      )}\n      {layout === \"cards\" && (\n        <div\n          className=\"grid gap-4\"\n          style={{ gridTemplateColumns: `repeat(auto-fit, minmax(min(100%, 240px), 1fr))` }}\n        >\n          {Array.from({ length: Math.max(n, cols) }).map((_, i) => (\n            <div key={i} className=\"space-y-2\">\n              <Skeleton className=\"h-3.5 w-1/2\" />\n              <Skeleton className=\"h-3 w-full\" />\n              <div className=\"flex flex-wrap gap-1.5 pt-1\">\n                <Skeleton className=\"h-5 w-16 rounded-md\" />\n                <Skeleton className=\"h-5 w-24 rounded-md\" />\n                <Skeleton className=\"h-5 w-12 rounded-md\" />\n              </div>\n            </div>\n          ))}\n        </div>\n      )}\n      {layout === \"table\" && (\n        <div className=\"flex flex-col divide-y divide-border\">\n          <div\n            className=\"grid gap-2 py-1.5\"\n            style={{ gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))` }}\n          >\n            {Array.from({ length: cols }).map((_, c) => (\n              <Skeleton key={c} className=\"h-3 w-2/3\" />\n            ))}\n          </div>\n          {Array.from({ length: n }).map((_, r) => (\n            <div\n              key={r}\n              className=\"grid gap-2 py-2\"\n              style={{ gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))` }}\n            >\n              {Array.from({ length: cols }).map((_, c) => (\n                <Skeleton key={c} className={cn(\"h-3\", c === 0 ? \"w-3/4\" : \"w-1/2\")} />\n              ))}\n            </div>\n          ))}\n        </div>\n      )}\n      {layout === \"text\" &&\n        Array.from({ length: n }).map((_, i) => (\n          <Skeleton\n            key={i}\n            className={cn(\"h-3\", i === n - 1 ? \"w-2/5\" : i % 2 === 0 ? \"w-full\" : \"w-11/12\")}\n          />\n        ))}\n      <span className=\"sr-only\">{label}</span>\n    </div>\n  );\n}\n\n/**\n * Sticky, tolerant read of a value that may be absent mid-stream.\n *\n * Returns the latest DEFINED value seen (so a re-parse that momentarily drops\n * a field does not blank the UI), `fallback` until one arrives, and `arrived`\n * once any real value has been observed. Implemented with the React\n * \"remember the previous render\" pattern (state updated during render), so\n * pass a FIELD READ (`data?.summary`) — never an expression that builds a\n * new object/array on every render (`data?.items ?? []`), which would\n * re-trigger the update each render.\n */\nexport function useStreamingValue<T>(\n  value: T | null | undefined,\n  fallback: T,\n): { value: T; arrived: boolean } {\n  const [last, setLast] = React.useState<{ value: T; arrived: boolean }>({\n    value: fallback,\n    arrived: false,\n  });\n  const defined = value !== null && value !== undefined;\n  if (defined && (!last.arrived || !Object.is(value, last.value))) {\n    const next = { value: value as T, arrived: true };\n    setLast(next);\n    return next;\n  }\n  return last;\n}\n\n/** `value` when it is an array, else `[]` — for `data.items` that is not there yet. */\nexport function streamList<T = unknown>(value: unknown): T[] {\n  return Array.isArray(value) ? (value as T[]) : [];\n}\n\n/** `value` when it is a non-empty string, else `fallback` (\"\" by default). */\nexport function streamText(value: unknown, fallback = \"\"): string {\n  return typeof value === \"string\" && value.length > 0 ? value : fallback;\n}\n","\"use client\";\n\n/**\n * KeywordChip + TagList — chips that WRAP, never truncate.\n *\n * A keyword / tag / phrase is always shown in full: the chip wraps its text\n * onto extra lines inside the chip, and the list wraps chips onto extra rows.\n *\n * ONE GEOMETRY (the design system's chip: a 6px-radius rectangle, 24px tall\n * for a single line, 8px text inset, 12px/500 label) for every chip, the add\n * control and the inline inputs, so a row of labels is one even band. Before\n * 2026-10-24 each chip was a capsule that grew a checkbox square, a pencil and\n * an X of three different sizes, and the add control was a differently padded\n * dashed capsule — every chip a different height and width of chrome.\n * Now:\n *  - select: the chip itself is the toggle (tinted when on) — no checkbox box;\n *  - edit: the label is the edit control (click; or double-click / F2 when the\n *    chip also selects) — no pencil;\n *  - remove: one small X in flow, quiet until the chip is hovered or focused.\n * `TagList` adds an \"Add\" control at the end when `onAdd` is given.\n * Contract: `kind-kit/README.md`.\n */\n\nimport * as React from \"react\";\nimport { PlusIcon, XIcon } from \"@ai-matrx/design-system/icons\";\nimport { cn } from \"@ai-matrx/design-system\";\nimport {\n  renderKindKitIcon,\n  type KindKitIcon,\n} from \"./icon-slot\";\nimport { getKindKitHost, type ReadOutcome } from \"./kind-kit-host\";\n\nexport interface KeywordChipProps {\n  /** The phrase. Rendered in full — wraps, never truncates. */\n  label: string;\n  /** Small trailing detail (a count, a volume, a score). */\n  meta?: React.ReactNode;\n  /** Lucide component or an already-created icon element. */\n  icon?: KindKitIcon;\n  /** Selected state; pass `onSelect` to make the chip a toggle. */\n  selected?: boolean;\n  /** Makes the chip a toggle; called with the next selected state. */\n  onSelect?: ((selected: boolean) => void) | undefined;\n  /** Adds an X control. */\n  onRemove?: (() => void) | undefined;\n  /** Enables inline edit (the label is the edit control; double-click / F2 when the chip also selects); called with the committed text. */\n  onEdit?: ((next: string) => void) | undefined;\n  /** Grays the chip and disables select/remove/edit. */\n  disabled?: boolean | undefined;\n  tone?: \"default\" | \"primary\" | \"muted\" | undefined;\n  size?: \"sm\" | \"md\";\n  className?: string;\n}\n\nconst TONE = {\n  default: \"border-border text-foreground\",\n  primary: \"border-primary/30 bg-primary/10 text-foreground\",\n  muted: \"border-transparent bg-muted text-muted-foreground\",\n} as const;\n\n/** The one chip geometry: 6px rectangle, 24px single-line height, 8px inset, 12px/500. */\nfunction kindChipGeometry(size: \"sm\" | \"md\" = \"sm\"): string {\n  return size === \"md\"\n    ? \"min-h-7 rounded-md border px-2.5 py-1 text-sm font-medium leading-5\"\n    : \"min-h-6 rounded-md border px-2 py-0.5 text-xs font-medium leading-4\";\n}\n\nexport function KeywordChip({\n  label,\n  meta,\n  icon,\n  selected = false,\n  onSelect,\n  onRemove,\n  onEdit,\n  disabled = false,\n  tone = \"default\",\n  size = \"sm\",\n  className,\n}: KeywordChipProps) {\n  const [editing, setEditing] = React.useState(false);\n  const [draft, setDraft] = React.useState(label);\n  const inputRef = React.useRef<HTMLInputElement | null>(null);\n\n  const selectable = !!onSelect && !disabled;\n  const editable = !!onEdit && !disabled;\n\n  const startEdit = () => {\n    if (!editable) return;\n    setDraft(label);\n    setEditing(true);\n    // Focus after the input mounts.\n    requestAnimationFrame(() => inputRef.current?.select());\n  };\n  const commit = () => {\n    setEditing(false);\n    const next = draft.trim();\n    if (next && next !== label) onEdit?.(next);\n  };\n  const cancel = () => {\n    setEditing(false);\n    setDraft(label);\n  };\n\n  // Inputs stay >=16px on phones (no iOS zoom), shrink to the chip size on sm+.\n  const inputText = size === \"md\" ? \"text-[16px] sm:text-sm\" : \"text-[16px] sm:text-xs\";\n  const labelCls =\n    \"min-w-0 whitespace-normal break-words text-left outline-none\";\n\n  let body: React.ReactNode;\n  if (editing) {\n    body = (\n      <input\n        ref={inputRef}\n        value={draft}\n        onChange={(e) => setDraft(e.target.value)}\n        onBlur={commit}\n        onKeyDown={(e) => {\n          if (e.key === \"Enter\") {\n            e.preventDefault();\n            commit();\n          } else if (e.key === \"Escape\") {\n            e.preventDefault();\n            cancel();\n          }\n        }}\n        aria-label={`Edit ${label}`}\n        size={Math.max(4, draft.length + 1)}\n        className={cn(\"min-w-0 bg-transparent outline-none\", inputText)}\n      />\n    );\n  } else if (selectable) {\n    body = (\n      <button\n        type=\"button\"\n        role=\"checkbox\"\n        aria-checked={selected}\n        aria-label={`${selected ? \"Deselect\" : \"Select\"} ${label}`}\n        title={editable ? \"Double-click to edit\" : undefined}\n        onClick={() => onSelect?.(!selected)}\n        onDoubleClick={startEdit}\n        onKeyDown={(e) => {\n          if (e.key === \"F2\") {\n            e.preventDefault();\n            startEdit();\n          }\n        }}\n        className={labelCls}\n      >\n        {label}\n      </button>\n    );\n  } else if (editable) {\n    body = (\n      <button\n        type=\"button\"\n        aria-label={`Edit ${label}`}\n        title=\"Edit\"\n        onClick={startEdit}\n        className={cn(labelCls, \"cursor-text\")}\n      >\n        {label}\n      </button>\n    );\n  } else {\n    body = <span className={labelCls}>{label}</span>;\n  }\n\n  return (\n    <span\n      data-kind-chip=\"\"\n      className={cn(\n        // max-w-full + min-w-0 + break-words: the text wraps INSIDE the chip.\n        \"group/chip inline-flex max-w-full min-w-0 items-center gap-1 transition-colors\",\n        kindChipGeometry(size),\n        selected ? \"border-primary/50 bg-primary/10 text-foreground\" : TONE[tone],\n        (selectable || editable) && !selected && !editing && \"hover:bg-muted/60\",\n        editing && \"border-primary/60 bg-background\",\n        \"focus-within:border-primary/60\",\n        disabled && \"opacity-60\",\n        className,\n      )}\n    >\n      {renderKindKitIcon(icon, \"matrx-line-icon-xs text-muted-foreground\")}\n      {body}\n      {meta !== undefined && meta !== null && (\n        <span className=\"shrink-0 font-normal tabular-nums text-muted-foreground\">{meta}</span>\n      )}\n      {onRemove && !editing && (\n        <button\n          type=\"button\"\n          aria-label={`Remove ${label}`}\n          disabled={disabled}\n          onClick={onRemove}\n          className=\"-mr-1 flex h-4 w-4 shrink-0 items-center justify-center rounded-sm text-muted-foreground/50 transition-colors hover:bg-muted hover:text-destructive focus-visible:text-foreground group-hover/chip:text-muted-foreground group-focus-within/chip:text-muted-foreground disabled:pointer-events-none\"\n        >\n          <XIcon width={24} height={24} className=\"h-3 w-3\" />\n        </button>\n      )}\n    </span>\n  );\n}\n\nexport interface TagItem {\n  label: string;\n  /** Stable key; defaults to `label`. */\n  key?: string;\n  meta?: React.ReactNode;\n  disabled?: boolean;\n}\n\nexport interface TagListProps {\n  /** Phrases, as strings or `{ label, key?, meta?, disabled? }` objects. */\n  items: readonly (string | TagItem)[];\n  /** Selected keys (label when no key). Pass with `onToggle` for selectable chips. */\n  selected?: readonly string[];\n  /** Makes chips toggles; called with (key, nextSelected). */\n  onToggle?: (key: string, selected: boolean) => void;\n  /** Adds an X on every chip; called with (key, index). */\n  onRemove?: (key: string, index: number) => void;\n  /** Enables inline edit on every chip; called with (key, index, nextLabel). */\n  onEdit?: (key: string, index: number, next: string) => void;\n  /** Renders an inline \"Add\" input at the end; called with the trimmed text. */\n  onAdd?: (label: string) => void;\n  /** Placeholder of the add input. Default \"Add…\". */\n  addPlaceholder?: string;\n  /** Shown when `items` is empty (and there is no add input). */\n  emptyState?: React.ReactNode;\n  /**\n   * The outcome of the read behind the rows (RC-B12 r13). `emptyState` shows\n   * only after a read that succeeded; a failed read shows the failure + retry.\n   */\n  read?: ReadOutcome;\n  tone?: KeywordChipProps[\"tone\"];\n  size?: KeywordChipProps[\"size\"];\n  disabled?: boolean;\n  className?: string;\n}\n\nfunction normalize(item: string | TagItem): TagItem {\n  return typeof item === \"string\" ? { label: item } : item;\n}\n\nexport function TagList({\n  items,\n  selected,\n  onToggle,\n  onRemove,\n  onEdit,\n  onAdd,\n  addPlaceholder = \"Add…\",\n  emptyState,\n  read,\n  tone,\n  size = \"sm\",\n  disabled = false,\n  className,\n}: TagListProps) {\n  const { ReadEmpty, ReadStaleNotice } = getKindKitHost();\n  const [adding, setAdding] = React.useState(false);\n  const [draft, setDraft] = React.useState(\"\");\n  const inputText = size === \"md\" ? \"text-[16px] sm:text-sm\" : \"text-[16px] sm:text-xs\";\n  const selectedSet = new Set(selected ?? []);\n\n  const commitAdd = () => {\n    const next = draft.trim();\n    if (next) onAdd?.(next);\n    setDraft(\"\");\n    setAdding(false);\n  };\n\n  if (items.length === 0 && read && read.status !== \"ready\") return <ReadEmpty read={read} />;\n  if (items.length === 0 && !onAdd) {\n    return emptyState !== undefined ? (\n      <div className={cn(\"text-xs text-muted-foreground\", className)}>\n        {emptyState}\n      </div>\n    ) : null;\n  }\n\n  return (\n    <div className={cn(\"flex flex-wrap items-start gap-1.5\", className)}>\n      <ReadStaleNotice read={read} className=\"w-full\" />\n      {items.map((raw, index) => {\n        const item = normalize(raw);\n        const key = item.key ?? item.label;\n        return (\n          <KeywordChip\n            key={`${key}-${index}`}\n            label={item.label}\n            meta={item.meta}\n            tone={tone}\n            size={size}\n            disabled={disabled || item.disabled}\n            selected={selectedSet.has(key)}\n            onSelect={onToggle ? (next) => onToggle(key, next) : undefined}\n            onRemove={onRemove ? () => onRemove(key, index) : undefined}\n            onEdit={onEdit ? (next) => onEdit(key, index, next) : undefined}\n          />\n        );\n      })}\n      {items.length === 0 && emptyState !== undefined && (\n        <span className=\"text-xs text-muted-foreground\">{emptyState}</span>\n      )}\n      {onAdd && !disabled && (\n        adding ? (\n          <span\n            className={cn(\n              \"inline-flex items-center border-primary/60 bg-background\",\n              kindChipGeometry(size),\n            )}\n          >\n            <input\n              autoFocus\n              value={draft}\n              placeholder={addPlaceholder}\n              onChange={(e) => setDraft(e.target.value)}\n              onBlur={commitAdd}\n              onKeyDown={(e) => {\n                if (e.key === \"Enter\") {\n                  e.preventDefault();\n                  commitAdd();\n                } else if (e.key === \"Escape\") {\n                  e.preventDefault();\n                  setDraft(\"\");\n                  setAdding(false);\n                }\n              }}\n              aria-label={addPlaceholder}\n              size={Math.max(6, draft.length + 1)}\n              className={cn(\"min-w-0 bg-transparent font-normal outline-none placeholder:text-muted-foreground\", inputText)}\n            />\n          </span>\n        ) : (\n          /* The design system's `add` chip: same geometry as every chip, dashed, quiet, a leading +. */\n          <button\n            type=\"button\"\n            onClick={() => setAdding(true)}\n            className={cn(\n              \"inline-flex items-center gap-1 border-dashed border-border text-muted-foreground transition-colors hover:border-primary/60 hover:text-foreground\",\n              kindChipGeometry(size),\n            )}\n          >\n            <PlusIcon className=\"matrx-line-icon-xs\" />\n            {addPlaceholder.replace(/…$/, \"\")}\n          </button>\n        )\n      )}\n    </div>\n  );\n}\n","\"use client\";\n\n/** KindImage — THE image a shape shows (see KindImageDefault.tsx for the contract). */\nimport { getKindKitHost } from \"./kind-kit-host\";\nimport type { KindImageProps } from \"./KindImageDefault\";\n\nexport {\n  DefaultKindImage,\n  kindImageBoxStyle,\n  toKindImageRef,\n  loadKindImage,\n  useKindImageSource,\n  resetKindImageCache,\n  type KindImageProps,\n  type KindImageRef,\n} from \"./KindImageDefault\";\n\n/** The image a shape shows: the host's canonical image component when registered, else the frame-safe one. */\nexport function KindImage(props: KindImageProps) {\n  const { Image } = getKindKitHost();\n  return <Image {...props} />;\n}\n","\"use client\";\n\n/**\n * KindFile — THE way a shape shows any saved file: one flat row (never a card) with the file's type glyph (an\n * image file shows its own thumbnail), its name and size, and Open / Download / Share.\n *\n * Every button goes through the component's own `runAction`, so it works the same in the page and\n * inside the sealed frame:\n *   - Open     → `open_file`  (the platform's file preview: PDFs, documents, images, media);\n *   - Download → `download { file_id, filename }` (the platform's download door);\n *   - Share    → `share_file` (the platform's share window).\n * A shape never builds a URL from a `file_id`.\n *\n * Interface text is layout: labels only, one short line for an error.\n */\nimport * as React from \"react\";\nimport { cn } from \"@ai-matrx/design-system\";\nimport { formatFileSize } from \"@ai-matrx/kit/format\";\nimport { Share2 } from \"./icons\";\nimport {\n  AudioGlyph,\n  DownloadGlyph,\n  FileArchiveGlyph,\n  FileGlyph,\n  FileSheetGlyph,\n  FileTextGlyph,\n  FilmGlyph,\n  ImageGlyph,\n  OpenGlyph,\n} from \"./file-icons\";\nimport { useKindImageSource } from \"./KindImageDefault\";\n\n/** A saved file, by durable identity. */\nexport interface KindFileRef {\n  file_id?: string | null;\n  name?: string | null;\n  mime_type?: string | null;\n  /** Size in bytes, when known. */\n  size?: number | null;\n  organization_id?: string | null;\n}\n\ntype RunAction = (key: string, input: unknown) => Promise<{ ok: true; result: unknown } | { ok: false; error: string }>;\n\nexport interface KindFileProps {\n  /** The saved file; a missing ref (or one with no `file_id`) renders nothing. */\n  file: KindFileRef | null | undefined;\n  /** The component's `runAction` prop — every button goes through it. */\n  runAction?: RunAction;\n  /** Leave buttons out: `hide={[\"share\"]}`. */\n  hide?: ReadonlyArray<\"open\" | \"download\" | \"share\">;\n  className?: string;\n}\n\nexport type KindFileType = \"image\" | \"pdf\" | \"video\" | \"audio\" | \"sheet\" | \"archive\" | \"text\" | \"file\";\n\nconst EXTENSION_TYPES: Record<string, KindFileType> = {\n  png: \"image\", jpg: \"image\", jpeg: \"image\", gif: \"image\", webp: \"image\", svg: \"image\", avif: \"image\", heic: \"image\",\n  pdf: \"pdf\",\n  mp4: \"video\", mov: \"video\", webm: \"video\", mkv: \"video\",\n  mp3: \"audio\", wav: \"audio\", m4a: \"audio\", ogg: \"audio\", flac: \"audio\",\n  csv: \"sheet\", xlsx: \"sheet\", xls: \"sheet\", tsv: \"sheet\",\n  zip: \"archive\", gz: \"archive\", tar: \"archive\", rar: \"archive\", \"7z\": \"archive\",\n  txt: \"text\", md: \"text\", doc: \"text\", docx: \"text\", rtf: \"text\", json: \"text\", html: \"text\",\n};\n\n/** What kind of file this is, from its mime type, else its name's extension. */\nexport function kindFileType(mime: string | null | undefined, name: string | null | undefined): KindFileType {\n  const m = (mime ?? \"\").toLowerCase();\n  if (m.startsWith(\"image/\")) return \"image\";\n  if (m === \"application/pdf\") return \"pdf\";\n  if (m.startsWith(\"video/\")) return \"video\";\n  if (m.startsWith(\"audio/\")) return \"audio\";\n  if (m.includes(\"spreadsheet\") || m.includes(\"excel\") || m === \"text/csv\") return \"sheet\";\n  if (m.includes(\"zip\") || m.includes(\"compressed\") || m.includes(\"tar\")) return \"archive\";\n  if (m.startsWith(\"text/\") || m.includes(\"word\") || m === \"application/json\") return \"text\";\n  const ext = /\\.([a-z0-9]+)$/i.exec(name ?? \"\")?.[1]?.toLowerCase();\n  return (ext && EXTENSION_TYPES[ext]) || \"file\";\n}\n\nconst GLYPHS: Record<KindFileType, React.ComponentType<{ className?: string }>> = {\n  image: ImageGlyph,\n  pdf: FileTextGlyph,\n  video: FilmGlyph,\n  audio: AudioGlyph,\n  sheet: FileSheetGlyph,\n  archive: FileArchiveGlyph,\n  text: FileTextGlyph,\n  file: FileGlyph,\n};\n\nfunction Thumbnail({ fileId, runAction }: { fileId: string; runAction: RunAction | undefined }) {\n  const { src } = useKindImageSource({ file_id: fileId }, runAction, true);\n  if (!src) return <ImageGlyph className=\"h-5 w-5 text-muted-foreground\" />;\n  return <img src={src} alt=\"\" className=\"h-full w-full object-contain\" />;\n}\n\nconst BUTTON =\n  \"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50\";\n\n/** A saved file as one flat row: glyph or thumbnail tile, name, size, Open / Download / Share. */\nexport function KindFile({ file, runAction, hide, className }: KindFileProps) {\n  const [notice, setNotice] = React.useState<string | null>(null);\n  const [busy, setBusy] = React.useState<string | null>(null);\n  const fileId = typeof file?.file_id === \"string\" && file.file_id ? file.file_id : null;\n  if (!file || !fileId) return null;\n  const name = file.name?.trim() || \"File\";\n  const type = kindFileType(file.mime_type, file.name);\n  const Glyph = GLYPHS[type];\n  const size = typeof file.size === \"number\" ? formatFileSize(file.size) : null;\n  const shown = (key: \"open\" | \"download\" | \"share\") => !hide?.includes(key);\n  const ask = async (key: \"open_file\" | \"share_file\" | \"download\") => {\n    if (!runAction) return;\n    setBusy(key);\n    const out =\n      key === \"download\"\n        ? await runAction(\"download\", { file_id: fileId, filename: name })\n        : await runAction(key, { file_id: fileId, name });\n    setBusy(null);\n    setNotice(out.ok ? null : out.error);\n  };\n  return (\n    <div\n      className={cn(\"flex min-w-0 max-w-full flex-col gap-1 py-1\", className)}\n      data-kind-file={type}\n    >\n      <div className=\"flex min-w-0 items-center gap-2\">\n        <button\n          type=\"button\"\n          onClick={() => void ask(\"open_file\")}\n          disabled={!runAction}\n          aria-label={`Open ${name}`}\n          className=\"flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-md bg-muted\"\n        >\n          {type === \"image\" ? (\n            <Thumbnail fileId={fileId} runAction={runAction} />\n          ) : (\n            <Glyph className=\"h-5 w-5 text-muted-foreground\" />\n          )}\n        </button>\n        <div className=\"min-w-0 flex-1\">\n          <div className=\"truncate text-sm text-foreground\" title={name}>\n            {name}\n          </div>\n          {size ? <div className=\"text-xs text-muted-foreground\">{size}</div> : null}\n        </div>\n        {runAction ? (\n          <div className=\"flex shrink-0 items-center\">\n            {shown(\"open\") ? (\n              <button type=\"button\" title=\"Open\" aria-label=\"Open\" disabled={busy !== null} onClick={() => void ask(\"open_file\")} className={BUTTON}>\n                <OpenGlyph className=\"h-3.5 w-3.5\" />\n              </button>\n            ) : null}\n            {shown(\"download\") ? (\n              <button type=\"button\" title=\"Download\" aria-label=\"Download\" disabled={busy !== null} onClick={() => void ask(\"download\")} className={BUTTON}>\n                <DownloadGlyph className=\"h-3.5 w-3.5\" />\n              </button>\n            ) : null}\n            {shown(\"share\") ? (\n              <button type=\"button\" title=\"Share\" aria-label=\"Share\" disabled={busy !== null} onClick={() => void ask(\"share_file\")} className={BUTTON}>\n                <Share2 className=\"h-3.5 w-3.5\" />\n              </button>\n            ) : null}\n          </div>\n        ) : null}\n      </div>\n      {notice ? (\n        <div role=\"alert\" className=\"truncate text-xs text-destructive\" title={notice}>\n          {notice}\n        </div>\n      ) : null}\n    </div>\n  );\n}\n","/**\n * content-ir-core/kind-kit/file-icons.tsx — this package's glyph names, as aliases of the ONE glyph home,\n * `@ai-matrx/design-system/icons`. No path data lives here (policy C19: no icon library, and one drawing per\n * glyph); the alias only fixes this package's historical size and stroke. Exports are unchanged.\n */\n\nimport {\n  AudioLinesIcon as GAudioLinesIcon,\n  DownloadIcon as GDownloadIcon,\n  FileArchiveIcon as GFileArchiveIcon,\n  FilePageIcon as GFilePageIcon,\n  FileSpreadsheetIcon as GFileSpreadsheetIcon,\n  FileTextIcon as GFileTextIcon,\n  FilmIcon as GFilmIcon,\n  ImageIcon as GImageIcon,\n  MaximizeIcon as GMaximizeIcon,\n  withGlyphDefaults,\n  type GlyphComponent,\n} from \"@ai-matrx/design-system/icons\";\n\nconst sized = (Glyph: GlyphComponent): GlyphComponent => withGlyphDefaults(Glyph, { width: 24, height: 24 });\n\nconst FileGlyph = sized(GFilePageIcon);\nconst FileTextGlyph = sized(GFileTextIcon);\nconst FileSheetGlyph = sized(GFileSpreadsheetIcon);\nconst FileArchiveGlyph = sized(GFileArchiveIcon);\nconst ImageGlyph = sized(GImageIcon);\nconst FilmGlyph = sized(GFilmIcon);\nconst AudioGlyph = sized(GAudioLinesIcon);\nconst DownloadGlyph = sized(GDownloadIcon);\nconst OpenGlyph = sized(GMaximizeIcon);\n\nexport {\n  FileGlyph,\n  FileTextGlyph,\n  FileSheetGlyph,\n  FileArchiveGlyph,\n  ImageGlyph,\n  FilmGlyph,\n  AudioGlyph,\n  DownloadGlyph,\n  OpenGlyph,\n};\n","\"use client\";\n\n/** KindVideo — THE video a shape shows (see KindVideoDefault.tsx for the contract). */\nimport { getKindKitHost } from \"./kind-kit-host\";\nimport type { KindVideoProps } from \"./KindVideoDefault\";\n\nexport { DefaultKindVideo, type KindVideoProps } from \"./KindVideoDefault\";\nexport { kindVideoBoxStyle, formatMediaDuration, type KindMediaRef } from \"./kind-media\";\n\n/** The video a shape shows: the host's canonical video block when registered, else the frame-safe one. */\nexport function KindVideo(props: KindVideoProps) {\n  const { Video } = getKindKitHost();\n  return <Video {...props} />;\n}\n","\"use client\";\n\n/** KindAudio — THE audio a shape plays (see KindAudioDefault.tsx for the contract). */\nimport { getKindKitHost } from \"./kind-kit-host\";\nimport type { KindAudioProps } from \"./KindAudioDefault\";\n\nexport { DefaultKindAudio, type KindAudioProps } from \"./KindAudioDefault\";\n\n/** The audio a shape plays: the host's canonical player when registered, else the frame-safe row. */\nexport function KindAudio(props: KindAudioProps) {\n  const { Audio } = getKindKitHost();\n  return <Audio {...props} />;\n}\n","\"use client\";\n\n/** KindEmbed — THE embed a shape shows (see KindEmbedDefault.tsx for the contract). */\nimport { getKindKitHost } from \"./kind-kit-host\";\nimport type { KindEmbedProps } from \"./KindEmbedDefault\";\n\nexport { DefaultKindEmbed, kindEmbedBoxStyle, type KindEmbedProps } from \"./KindEmbedDefault\";\nexport { parseEmbed, type ParsedEmbed, type EmbedProvider } from \"./embed-url\";\n\n/** The embed a shape shows: the host's provider embed when registered, else the frame-safe poster card. */\nexport function KindEmbed(props: KindEmbedProps) {\n  const { Embed } = getKindKitHost();\n  return <Embed {...props} />;\n}\n","\"use client\";\n\n/**\n * The READER's language, time zone and text direction — for a shape that formats dates, numbers or\n * money. `useKindLocale()` returns `{ locale, timeZone, dir }`; pass them to `Intl.DateTimeFormat`,\n * `Intl.NumberFormat`, `Intl.RelativeTimeFormat`, or date-fns' `format(..., { locale })` equivalents:\n *\n *   const { locale, timeZone } = useKindLocale();\n *   new Intl.DateTimeFormat(locale, { dateStyle: \"medium\", timeStyle: \"short\", timeZone }).format(date)\n *\n * Never hard-code \"en-US\" or UTC. In the page the values come from the document (`lang`, `dir`) and the\n * browser's time zone; in the sealed frame the host sends them at mount and on every change, and the\n * frame sets `<html lang dir>` to match. State lives on globalThis under a Symbol.for key so two copies\n * of the package share one value.\n */\nimport * as React from \"react\";\n\nexport interface KindLocale {\n  /** BCP-47 language tag, e.g. \"en-US\", \"ar-EG\". */\n  locale: string;\n  /** IANA time zone, e.g. \"America/Los_Angeles\". */\n  timeZone: string;\n  /** Text direction of the reader's page. */\n  dir: \"ltr\" | \"rtl\";\n}\n\nconst KEY = Symbol.for(\"ai-matrx.content-ir.kind-locale\");\ntype Store = { [KEY]?: { value: KindLocale | null; listeners: Set<() => void> } };\n\nfunction store(): NonNullable<Store[typeof KEY]> {\n  const g = globalThis as Store;\n  if (!g[KEY]) g[KEY] = { value: null, listeners: new Set() };\n  return g[KEY]!;\n}\n\nconst RTL_LANGS = new Set([\"ar\", \"he\", \"fa\", \"ur\", \"ps\", \"sd\", \"yi\", \"dv\", \"ug\", \"ckb\"]);\n\n/** Where nothing was sent: the document and browser the code is running in. */\nexport function readDocumentLocale(): KindLocale {\n  const doc = typeof document !== \"undefined\" ? document.documentElement : null;\n  const nav = typeof navigator !== \"undefined\" ? navigator : null;\n  const locale = (doc?.lang && doc.lang.trim()) || nav?.language || \"en-US\";\n  let timeZone = \"UTC\";\n  try {\n    timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || \"UTC\";\n  } catch {\n    /* keep UTC */\n  }\n  const attr = doc?.dir;\n  const dir: \"ltr\" | \"rtl\" =\n    attr === \"rtl\" || attr === \"ltr\" ? attr : RTL_LANGS.has(locale.toLowerCase().split(\"-\")[0] ?? \"\") ? \"rtl\" : \"ltr\";\n  return { locale, timeZone, dir };\n}\n\nlet fallback: KindLocale | null = null;\nfunction snapshot(): KindLocale {\n  const v = store().value;\n  if (v) return v;\n  const next = readDocumentLocale();\n  // Same content → same object, so useSyncExternalStore stays stable between reads.\n  if (!fallback || fallback.locale !== next.locale || fallback.timeZone !== next.timeZone || fallback.dir !== next.dir) fallback = next;\n  return fallback;\n}\n\n/** The host (or the sealed frame, on a message) states the reader's locale. Idempotent. */\nexport function setKindLocale(value: KindLocale | null): void {\n  const s = store();\n  const prev = s.value;\n  if (prev === value) return;\n  if (prev && value && prev.locale === value.locale && prev.timeZone === value.timeZone && prev.dir === value.dir) return;\n  s.value = value;\n  s.listeners.forEach((l) => l());\n}\n\n/** The locale in force right now (non-hook). */\nexport function getKindLocale(): KindLocale {\n  return snapshot();\n}\n\n/** The reader's `{ locale, timeZone, dir }`; re-renders when the host says it changed. */\nexport function useKindLocale(): KindLocale {\n  const subscribe = React.useCallback((cb: () => void) => {\n    const s = store();\n    s.listeners.add(cb);\n    return () => {\n      s.listeners.delete(cb);\n    };\n  }, []);\n  return React.useS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;AACf,MAAI,SAAS,MAAO;AACpB,MAAI,QAAQ,SAAS,KAAK,WAAW,MAAM,UAAU,KAAK,aAAa,MAAM,YAAY,KAAK,QAAQ,MAAM,IAAK;AACjH,IAAE,QAAQ;AACV,IAAE,UAAU,QAAQ,CAAC,MAAM,EAAE,CAAC;AAChC;AAGO,SAAS,gBAA4B;AAC1C,SAAO,SAAS;AAClB;AAGO,SAAS,gBAA4B;AAC1C,QAAM,YAAkB,oBAAY,CAAC,OAAmB;AACtD,UAAM,IAAI,MAAM;AAChB,MAAE,UAAU,IAAI,EAAE;AAClB,WAAO,MAAM;AACX,QAAE,UAAU,OAAO,EAAE;AAAA,IACvB;AAAA,EACF,GAAG,CAAC,CAAC;AACL,SAAa,6BAAqB,WAAW,UAAU,QAAQ;AACjE;","names":["React","GMoreHorizontalIcon","GChevronDownIcon","GChevronUpIcon","GCheckIcon","GShare2Icon","GPlayIcon","GExternalLinkIcon","GMusicIcon","import_icons","import_design_system","React","import_icons","out","sized","React","import_design_system","import_icons","loaded","import_jsx_runtime","DEFAULT_MAX_HEIGHT","React","import_design_system","import_icons","import_jsx_runtime","React","import_design_system","import_jsx_runtime","DEFAULT_MAX_HEIGHT","import_jsx_runtime","import_jsx_runtime","React","import_design_system","import_jsx_runtime","React","import_icons","import_design_system","React","import_design_system","import_jsx_runtime","React","import_icons","import_design_system","import_jsx_runtime","React","import_design_system","import_icons","import_jsx_runtime","React","import_design_system","import_jsx_runtime","_","fallback","React","import_icons","import_design_system","import_jsx_runtime","import_jsx_runtime","React","import_design_system","import_format","import_icons","sized","GFilePageIcon","GFileTextIcon","GFileSpreadsheetIcon","GFileArchiveIcon","GImageIcon","GFilmIcon","GAudioLinesIcon","GDownloadIcon","GMaximizeIcon","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","React","KEY"]}