{"version":3,"file":"utils.mjs","sources":["../../../../../src/components/Table/TableNG/utils.ts"],"sourcesContent":["import clsx from 'clsx';\nimport memoize from 'micro-memoize';\nimport { type CSSProperties } from 'react';\nimport tinycolor from 'tinycolor2';\nimport { type Count, type uWrap, varPreLine } from 'uwrap';\n\nimport {\n  FieldType,\n  type Field,\n  fieldReducers,\n  formattedValueToString,\n  type GrafanaTheme2,\n  type DisplayValue,\n  type DisplayValueAlignmentFactors,\n  type DataFrame,\n  type DisplayProcessor,\n  isDataFrame,\n  reduceField,\n  ReducerID,\n  type FieldSparkline,\n  type DecimalCount,\n} from '@grafana/data';\nimport type { ColumnWidth, ColumnWidths, SortColumn } from '@grafana/react-data-grid';\nimport {\n  BarGaugeDisplayMode,\n  type FieldTextAlignment,\n  TableCellBackgroundDisplayMode,\n  TableCellDisplayMode,\n  TableCellHeight,\n} from '@grafana/schema';\n\nimport { getTextColorForAlphaBackground } from '../../../utils/colors';\nimport { TableCellInspectorMode } from '../TableCellInspector';\nimport { type OpenLayersContextValue, isGeometry } from '../geo';\nimport { type TableCellOptions } from '../types';\n\nimport { AutoCellRenderer, getAutoRendererDisplayMode, getCellRenderer } from './Cells/renderers';\nimport { getCellLinks } from './cellLinks';\nimport {\n  CELL_HORIZONTAL_CHROME,\n  COLUMN,\n  FIRST_COLUMN_CLASS,\n  FIRST_COLUMN_EXTRA_PADDING,\n  HEADER_DRAG_HANDLE_SPACE,\n  HEADER_ICON_SPACE,\n  HEADER_MENU_SPACE,\n  HEADER_TOOLTIP_SPACE,\n  LAST_COLUMN_CLASS,\n  NESTED_ROW_CLASS,\n  STRIPED_ROW_CLASS,\n  TABLE,\n} from './constants';\nimport { getColumnMenuOptions } from './menuOptions';\nimport type { TextAlign } from './styles';\nimport type {\n  TableRow,\n  ColumnTypes,\n  FrameToRowsConverter,\n  Comparator,\n  TypographyCtx,\n  MeasureCellHeight,\n  MeasureCellHeightEntry,\n  FilterType,\n  GetActionsFunctionLocal,\n  TableColumn,\n  TextWrapFallback,\n} from './types';\n\n// inferPills lives here rather than in PillCell.tsx to avoid a circular dependency:\n// styles.ts → utils.tsx → renderers.tsx → PillCell.tsx → styles.ts\n/* ---------------------------- Pill inference ----------------------------- */\nconst SPLIT_RE = /\\s*,\\s*/;\n\nfunction inferPillsImpl(rawValue: unknown): unknown[] {\n  if (rawValue === '' || rawValue == null) {\n    return [];\n  }\n\n  if (Array.isArray(rawValue)) {\n    return rawValue.filter((v) => v != null).map((v) => String(v).trim());\n  }\n\n  const value = String(rawValue);\n\n  if (value[0] === '[') {\n    try {\n      return JSON.parse(value);\n    } catch {\n      return value.trim().split(SPLIT_RE);\n    }\n  }\n\n  return value.trim().split(SPLIT_RE);\n}\n\n/**\n * @internal\n * A bounded cache with O(1) inserts and no per-insert eviction scan. It keeps two generations:\n * writes go to `primary`; when `primary` fills, it becomes `secondary` (whatever was in the old\n * `secondary` is dropped) and a fresh `primary` starts. Reads check both generations and promote a\n * survivor back into `primary`, which approximates LRU. Total live entries stay within ~2x maxSize.\n */\nexport function createBoundedCache<K, V>(maxSize: number) {\n  let primary = new Map<K, V>();\n  let secondary = new Map<K, V>();\n\n  // Every write to `primary` — whether a fresh `set` or a promotion from `secondary` in `get` — goes\n  // through here so the rotation check runs on all growth paths. (Rotating only in `set` let `get`'s\n  // promotions grow `primary` past `maxSize` between writes, breaking the ~2x bound.)\n  const put = (key: K, value: V): void => {\n    primary.set(key, value);\n    if (primary.size >= maxSize) {\n      secondary = primary;\n      primary = new Map<K, V>();\n    }\n  };\n\n  return {\n    get(key: K): V | undefined {\n      const fromPrimary = primary.get(key);\n      if (fromPrimary !== undefined) {\n        return fromPrimary;\n      }\n      const fromSecondary = secondary.get(key);\n      if (fromSecondary !== undefined) {\n        put(key, fromSecondary); // promote into the current generation, keeping the size bound\n      }\n      return fromSecondary;\n    },\n    set: put,\n  };\n}\n\n// inferPills is pure and its inputs are stable across resizes, so we cache results. Array/object\n// values are cached by reference in a WeakMap (unbounded-safe, auto-GC'd). Primitive (string) values\n// persist for the whole app lifetime across every table, so they use a generational bounded cache\n// (see createBoundedCache) sized generously enough that a large table mostly hits.\nconst arrayPillCache = new WeakMap<object, unknown[]>();\nconst primitivePillCache = createBoundedCache<string, unknown[]>(15000);\n\n// Accepts an arbitrary raw cell value: pill columns hold string arrays (not in TableCellValue), and\n// values can be null, so this is deliberately typed `unknown` and narrowed at runtime.\nexport function inferPills(rawValue: unknown): unknown[] {\n  if (rawValue == null || rawValue === '') {\n    return [];\n  }\n\n  if (typeof rawValue === 'object') {\n    let cached = arrayPillCache.get(rawValue);\n    if (cached === undefined) {\n      cached = inferPillsImpl(rawValue);\n      arrayPillCache.set(rawValue, cached);\n    }\n    return cached;\n  }\n\n  const key = String(rawValue);\n  let cached = primitivePillCache.get(key);\n  if (cached === undefined) {\n    cached = inferPillsImpl(rawValue);\n    primitivePillCache.set(key, cached);\n  }\n  return cached;\n}\n\n/* ---------------------------- Cell calculations --------------------------- */\n/**\n * @internal\n * Returns the default row height based on the theme and cell height setting.\n */\nexport function getDefaultRowHeight(\n  theme: GrafanaTheme2,\n  fields?: Field[],\n  cellHeight?: TableCellHeight\n): NonNullable<CSSProperties['height']> {\n  if (fields?.some((field) => field.config?.custom?.cellOptions?.dynamicHeight)) {\n    return 'min-content';\n  }\n\n  switch (cellHeight) {\n    case TableCellHeight.Sm:\n      return 36;\n    case TableCellHeight.Md:\n      return 42;\n    case TableCellHeight.Lg:\n      return TABLE.MAX_CELL_HEIGHT;\n  }\n\n  return TABLE.CELL_PADDING * 2 + theme.typography.fontSize * theme.typography.body.lineHeight;\n}\n\n/**\n * @internal\n * Returns true if cell inspection (hover to see full content) is enabled for the field.\n */\nexport function isCellInspectEnabled(field: Field): boolean {\n  return field.config?.custom?.inspect ?? false;\n}\n\n/**\n * @internal\n * Returns true if text wrapping should be applied to the cell.\n */\nexport function shouldTextWrap(field: Field): boolean {\n  return Boolean(field.config.custom?.wrapText);\n}\n\n/**\n * @internal\n * Returns true if the field's cells pretty-print their value as JSON. An `other` field only does so\n * when no explicit cell type was chosen — one set to Pill or Markdown should render as that instead.\n */\nexport function rendersAsJson(field: Field, cellType = getCellOptions(field).type): boolean {\n  return (\n    cellType === TableCellDisplayMode.JSONView ||\n    ((cellType == null || cellType === TableCellDisplayMode.Auto) &&\n      getAutoRendererDisplayMode(field) === TableCellDisplayMode.JSONView)\n  );\n}\n\n/**\n * @internal wrap a cell height measurer to clamp its output to the maxHeight defined in the field, if any.\n */\nfunction clampByMaxHeight(measurer: MeasureCellHeight, maxHeight = Infinity): MeasureCellHeight {\n  return (value, width, field, rowIdx, lineHeight) => {\n    const rawHeight = measurer(value, width, field, rowIdx, lineHeight);\n    return Math.min(rawHeight, maxHeight);\n  };\n}\n\n/**\n * @internal creates a typography context based on a font size and family. used to measure text\n * and estimate size of text in cells.\n */\nexport function createTypographyContext(\n  fontSize: number,\n  fontFamily: string,\n  letterSpacing = 0.15,\n  fontWeight?: number\n): TypographyCtx {\n  const weightPrefix = fontWeight != null ? `${fontWeight} ` : '';\n  const font = `${weightPrefix}${fontSize}px ${fontFamily}`;\n  const canvas = document.createElement('canvas');\n  const ctx = canvas.getContext('2d')!;\n\n  ctx.letterSpacing = `${letterSpacing}px`;\n  ctx.font = font;\n  // 1/6 of the characters in this string are capitalized. Since the avgCharWidth is used for estimation, it's\n  // better that the estimation over-estimates the width than if it underestimates it, so we're a little on the\n  // aggressive side here and could even go more aggressive if we get complaints in the future.\n  const txt =\n    \"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s. 1234567890 ALL CAPS TO HELP WITH MEASUREMENT.\";\n  const txtWidth = ctx.measureText(txt).width;\n  const avgCharWidth = txtWidth / txt.length + letterSpacing;\n  const uwrap = varPreLine(ctx);\n\n  // The grid applies `font-variant-numeric: tabular-nums`, so every digit renders at the font's\n  // uniform (widest) figure advance. Canvas can't set that feature, so measure each digit and take\n  // the max as a safe over-estimate of the tabular advance.\n  let maxDigitWidth = 0;\n  for (let d = 0; d <= 9; d++) {\n    maxDigitWidth = Math.max(maxDigitWidth, ctx.measureText(String(d)).width);\n  }\n  const numericCharWidth = maxDigitWidth + letterSpacing;\n\n  // JSON/Geo cells render in a monospace font; measure one character there (all are equal-width).\n  ctx.font = `${weightPrefix}${fontSize}px monospace`;\n  const monoCharWidth = ctx.measureText('0').width + letterSpacing;\n  ctx.font = font; // restore the primary font on the shared context\n\n  return {\n    ctx,\n    fontFamily,\n    letterSpacing,\n    avgCharWidth,\n    numericCharWidth,\n    monoCharWidth,\n    estimateHeight: getTextHeightEstimator(avgCharWidth),\n    measureHeight: getTextHeightMeasurerFromUwrapCount(uwrap.count),\n    measureWidth: createFitWidthMeasurer(ctx, uwrap),\n  };\n}\n\n/**\n * @internal The narrowest width at which the line counter agrees the text fits on one line.\n *\n * Not `measureText(text).width`: that is kerned end to end, while uwrap sums its own per-character\n * widths and so reads most strings ~1px wider. Size a column to the kerned number and uwrap wraps\n * the label anyway. uwrap doesn't export its width table, so it arbitrates instead: start from the\n * kerned width, which never over-shoots, and nudge up until `test` agrees. Cheap enough for the\n * handful of labels a header has, but it is work per call — not for every cell.\n */\nexport function createFitWidthMeasurer(ctx: CanvasRenderingContext2D, { test }: uWrap): (text: string) => number {\n  return (text: string) => {\n    let widest = 0;\n    // A `pre-line` newline is a hard break, so uwrap calls a string that contains one wrapped at\n    // *any* width and the nudging below would never terminate. Each hard-broken segment is a line\n    // regardless, so measure them separately: the widest is what the whole string needs.\n    for (const segment of text.slice(0, TABLE.MAX_WRAP_TEXT_LENGTH).split('\\n')) {\n      let width = Math.ceil(ctx.measureText(segment).width);\n      while (test(segment, width)) {\n        width++;\n      }\n      widest = Math.max(widest, width);\n    }\n    return widest;\n  };\n}\n\n/**\n * @internal wraps the uwrap count function to ensure that it is given a string.\n */\nexport function getTextHeightMeasurerFromUwrapCount(count: Count): MeasureCellHeight {\n  return (value, width, _field, _rowIdx, lineHeight) => {\n    if (value == null) {\n      return lineHeight;\n    }\n\n    const lines = count(String(value).slice(0, TABLE.MAX_WRAP_TEXT_LENGTH), width);\n    return lines * lineHeight;\n  };\n}\n\n/**\n * @internal returns a measurer which guesstimates a number of lines in a text cell based on the typography context's avgCharWidth.\n */\nexport function getTextHeightEstimator(avgCharWidth: number): MeasureCellHeight {\n  return (value, width, _field, _rowIdx, lineHeight) => {\n    if (!value) {\n      return -1;\n    }\n\n    // we don't have string breaking enabled in the table,\n    // so an unbroken string is by definition a single line.\n    const strValue = String(value);\n    if (!spaceRegex.test(strValue)) {\n      return -1;\n    }\n\n    const charsPerLine = width / avgCharWidth;\n    // A pretty-printed JSON value (and any other multi-line string) carries real newlines that the\n    // renderer preserves (`pre-wrap`/`pre-line`), so each one forces a line break regardless of width.\n    // Estimating off the total string length alone ignores those breaks and badly undercounts a value\n    // with many short lines. Sum the wrapped-line estimate per newline-delimited segment instead,\n    // matching how the precise uwrap measurer already treats embedded newlines.\n    const lines = strValue\n      .split('\\n')\n      .reduce((total, line) => total + Math.max(1, Math.ceil(line.length / charsPerLine)), 0);\n    return lines * lineHeight;\n  };\n}\n\n/**\n * @internal\n */\nexport function getDataLinksHeightMeasurer(): MeasureCellHeight {\n  const linksCountCache: Record<string, number> = {};\n\n  // when we render links, we need to filter out the invalid links. since the call to `getLinks` is expensive,\n  // we'll cache the result and reuse it for every row in the table. this cache is cleared when line counts are\n  // rebuilt anytime from the `useRowHeight` hook, and that includes adding and removing data links.\n  return (_value, _width, field, _rowIdx, lineHeight) => {\n    const cacheKey = getDisplayName(field);\n    if (linksCountCache[cacheKey] === undefined) {\n      let count = 0;\n      for (const l of field.config?.links ?? []) {\n        if (l.onClick || l.url) {\n          count += 1;\n        }\n      }\n      linksCountCache[cacheKey] = count;\n    }\n\n    return linksCountCache[cacheKey] * lineHeight;\n  };\n}\n\nconst getPillMetrics = (theme?: GrafanaTheme2) => {\n  if (!theme) {\n    throw new Error('A theme is required to measure pill cells');\n  }\n\n  const refreshed = theme.flags.visualDesignRefresh;\n  const fontSize = refreshed ? theme.typography.size.xs : theme.typography.size.sm;\n  const horizontalPadding = refreshed ? theme.spacing.x1 : theme.spacing(0.75);\n\n  return {\n    fontSize: extractPixelValue(fontSize),\n    spacing: 2 * extractPixelValue(horizontalPadding),\n    gap: extractPixelValue(theme.spacing(0.5)),\n  };\n};\n\n// Fuzzy chrome estimates for the other inline-run cell types (see measureInlineRunWidth). Used only\n// for auto-width sizing, so approximate values that slightly over-reserve are fine.\nconst LINK_SPACING = 8; // paddingInline (~4px each side) when data links sit inline\nconst LINK_GAP = 2; // separator border between inline data links\nconst ACTION_SPACING = 20; // horizontal padding of a small action Button\nconst ACTION_GAP = 6; // theme.spacing(0.75) gap between action buttons\n\nexport function getPillCellHeightMeasurer(\n  measureWidth: (value: string) => number,\n  spacing: number,\n  gap: number\n): MeasureCellHeight {\n  // Per-pill intrinsic width, keyed by the pill string — shared across values (e.g. an actor who\n  // appears in many rows) and across column widths, so a resize never re-measures pill text.\n  const pillWidthCache: Record<string, number> = {};\n  // Per-value laid-out pill widths (intrinsic width + chip padding), keyed by the cell value and\n  // therefore width-independent: on a resize we reuse these and skip both inferPills and text\n  // measurement, redoing only the cheap wrap arithmetic below. Neither cache needs eviction: the\n  // whole closure is rebuilt when fields/typography/maxHeight change, so they live only as long as\n  // the current table structure and are bounded by its distinct values.\n  const pillWidthsByValue = new Map<string, number[]>();\n\n  return (value, width, _field, _rowIdx, lineHeight) => {\n    if (value == null) {\n      return 0;\n    }\n\n    const strValue = String(value);\n    let pillWidths = pillWidthsByValue.get(strValue);\n    if (pillWidths === undefined) {\n      pillWidths = inferPills(strValue).map((pill) => {\n        const strPill = String(pill);\n        let rawWidth = pillWidthCache[strPill];\n        if (rawWidth === undefined) {\n          rawWidth = measureWidth(strPill);\n          pillWidthCache[strPill] = rawWidth;\n        }\n        return rawWidth + spacing;\n      });\n      pillWidthsByValue.set(strValue, pillWidths);\n    }\n\n    if (pillWidths.length === 0) {\n      return 0;\n    }\n\n    // wrap arithmetic over the (cached) pill widths. This is cheap enough to run per cell; the\n    // expensive parts — parsing and text measurement — are what the caches above eliminate.\n    let lines = 0;\n    let currentLineUse = width;\n    for (const pillWidth of pillWidths) {\n      if (currentLineUse + pillWidth + gap > width) {\n        lines++;\n        currentLineUse = pillWidth;\n      } else {\n        currentLineUse += pillWidth + gap;\n      }\n    }\n\n    // default line height happens to be the height of a pill, but maybe we need a custom\n    // const here to make sure this doesn't get out of sync with the actual pill height.\n    return lines * lineHeight + (lines - 1) * gap;\n  };\n}\n\n/**\n * @internal return a text measurer for every field which has wrapHeaderText enabled.\n */\nexport function buildHeaderHeightMeasurers(\n  fields: Field[],\n  typographyCtx: TypographyCtx\n): MeasureCellHeightEntry[] | undefined {\n  const wrappedColIdxs = fields.reduce((acc: number[], field, idx) => {\n    if (field.config?.custom?.wrapHeaderText) {\n      acc.push(idx);\n    }\n    return acc;\n  }, []);\n\n  if (wrappedColIdxs.length === 0) {\n    return undefined;\n  }\n\n  // don't bother with estimating the line counts for the headers, because it's punishing\n  // when we get it wrong and there won't be that many compared to how many rows a table might contain.\n  return [{ measure: typographyCtx.measureHeight, fieldIdxs: wrappedColIdxs }];\n}\n\nconst spaceRegex = /[\\s-]/;\n\n/**\n * @internal return a text height measurer for every field which has wrapHeaderText enabled. we do this once as we're rendering\n * the table, and then getRowHeight uses the output of this to caluclate the height of each row.\n */\nexport function buildCellHeightMeasurers(\n  fields: Field[],\n  typographyCtx: TypographyCtx,\n  theme: GrafanaTheme2,\n  maxHeight?: number,\n  wrapFallback?: TextWrapFallback\n): MeasureCellHeightEntry[] | undefined {\n  const result: Record<string, MeasureCellHeightEntry> = {};\n  let wrappedFields = 0;\n\n  const measurerFactory: Record<\n    TableCellDisplayMode.Auto | TableCellDisplayMode.DataLinks | TableCellDisplayMode.Pill,\n    () => [MeasureCellHeight, MeasureCellHeight?]\n  > = {\n    // for string fields, we estimate the length of a line using `avgCharWidth` to limit expensive calls `count`.\n    [TableCellDisplayMode.Auto]: () => [typographyCtx.measureHeight, typographyCtx.estimateHeight],\n    [TableCellDisplayMode.DataLinks]: () => [getDataLinksHeightMeasurer(), undefined],\n    // pills use a different font size, so they require their own typography context.\n    [TableCellDisplayMode.Pill]: () => {\n      const { fontSize, spacing, gap } = getPillMetrics(theme);\n      const pillTypographyCtx = createTypographyContext(\n        fontSize,\n        typographyCtx.fontFamily,\n        typographyCtx.letterSpacing\n      );\n      return [\n        getPillCellHeightMeasurer((value) => pillTypographyCtx.ctx.measureText(value).width, spacing, gap),\n        undefined,\n      ];\n    },\n  } as const;\n\n  const setupMeasurerForIdx = (measurerFactoryKey: keyof typeof measurerFactory, fieldIdx: number) => {\n    if (!result[measurerFactoryKey]) {\n      const [measure, estimate] = measurerFactory[measurerFactoryKey]();\n      const guard = (measurer: MeasureCellHeight): MeasureCellHeight => {\n        if (measurerFactoryKey !== TableCellDisplayMode.Auto || wrapFallback == null) {\n          return measurer;\n        }\n        return (value, width, field, rowIdx, lineHeight) =>\n          wrapFallback.shouldDisable(field, value) ? -1 : measurer(value, width, field, rowIdx, lineHeight);\n      };\n      result[measurerFactoryKey] = {\n        measure: guard(clampByMaxHeight(measure, maxHeight)),\n        estimate: estimate != null ? guard(clampByMaxHeight(estimate, maxHeight)) : undefined,\n        fieldIdxs: [],\n      };\n    }\n    result[measurerFactoryKey].fieldIdxs.push(fieldIdx);\n  };\n\n  for (let fieldIdx = 0; fieldIdx < fields.length; fieldIdx++) {\n    const field = fields[fieldIdx];\n    if (shouldTextWrap(field) && !wrapFallback?.disabledFields.has(getDisplayName(field))) {\n      wrappedFields++;\n\n      const cellType = getCellOptions(field).type;\n      if (cellType === TableCellDisplayMode.DataLinks) {\n        setupMeasurerForIdx(TableCellDisplayMode.DataLinks, fieldIdx);\n      } else if (cellType === TableCellDisplayMode.Pill) {\n        setupMeasurerForIdx(TableCellDisplayMode.Pill, fieldIdx);\n      } else if (rendersAsJson(field) || getCellRenderer(field, getCellOptions(field)) === AutoCellRenderer) {\n        // JSON and Auto cells can produce multiline formatted strings, so both need measurement.\n        setupMeasurerForIdx(TableCellDisplayMode.Auto, fieldIdx);\n      } else {\n        // no measurer was configured for this cell type\n        wrappedFields--;\n      }\n    }\n  }\n\n  if (wrappedFields === 0) {\n    return undefined;\n  }\n\n  return Object.values(result);\n}\n\n// in some cases, the estimator might return a value that is less than 1, but when calculated by the measurer, it actually\n// realizes that it's a multi-line cell. to avoid this, we want to give a little buffer away from 1 before we fully trust\n// the estimator to have told us that a cell is single-line.\nexport const SINGLE_LINE_ESTIMATE_THRESHOLD = 18.5;\n\n/**\n * @internal\n * loop through the fields and their values, determine which cell is going to determine the height of the row based\n * on its content and width, and return the height in pixels of that row, with vertial padding applied.\n */\nexport function getRowHeight(\n  fields: Field[],\n  row: TableRow,\n  columnWidths: number[],\n  defaultHeight: number,\n  measurers?: MeasureCellHeightEntry[],\n  lineHeight = TABLE.LINE_HEIGHT,\n  verticalPadding = TABLE.CELL_PADDING * 2\n): number {\n  if (!measurers?.length) {\n    return defaultHeight;\n  }\n\n  let maxHeight = -1;\n  let maxValue: unknown = '';\n  let maxWidth = 0;\n  let maxField: Field | undefined;\n  let preciseMeasurer: MeasureCellHeight | undefined;\n  // Tallest height from measurers that already ran precisely (pills, data links). The estimated\n  // winner is remeasured below and can shrink beneath one of these, so we clamp back up to it —\n  // otherwise an over-estimating Auto column could beat a precise pill height and then discard it,\n  // sizing the row too short and clipping the pills.\n  let maxPreciseHeight = -1;\n\n  for (const { estimate, measure, fieldIdxs } of measurers) {\n    // for some of the cell height measurers, getting the precise height is expensive. those entries set\n    // both \"estimate\" and \"measure\" functions. if the cell we find to be the max was estimated, we will\n    // get the \"true\" value right before calculating the row height by keeping a reference to the measure fn.\n    const measurer = (estimate ?? measure) satisfies MeasureCellHeight;\n    const isEstimating = estimate !== undefined;\n\n    for (const fieldIdx of fieldIdxs) {\n      const field = fields[fieldIdx];\n      const displayName = getDisplayName(field);\n      // special case: for the header, provide `-1` as the row index.\n      const cellValueRaw = row.__index === -1 ? displayName : row[displayName];\n      if (cellValueRaw != null) {\n        // For non-string fields (e.g. Time, Number), the raw value is a number/epoch that\n        // AutoCell formats via field.display() before rendering. A JSON cell reformats strings too,\n        // expanding compact source into an indented block. Measure the rendered string either way\n        // so the height matches what is actually displayed in the cell.\n        const needsFormatting = field.type !== FieldType.string || rendersAsJson(field);\n        const cellValueForMeasuring =\n          needsFormatting && row.__index !== -1 && field.display != null\n            ? formattedValueToString(field.display(cellValueRaw))\n            : cellValueRaw;\n        const colWidth = columnWidths[fieldIdx];\n        const estimatedHeight = measurer(cellValueForMeasuring, colWidth, field, row.__index, lineHeight);\n        if (!isEstimating && estimatedHeight > maxPreciseHeight) {\n          maxPreciseHeight = estimatedHeight;\n        }\n        if (estimatedHeight > maxHeight) {\n          maxHeight = estimatedHeight;\n          maxValue = cellValueForMeasuring;\n          maxWidth = colWidth;\n          maxField = field;\n          preciseMeasurer = isEstimating ? measure : undefined;\n        }\n      }\n    }\n  }\n\n  // if the value is -1 or the estimate for the max cell was less than the SINGLE_LINE_ESTIMATE_THRESHOLD, we trust\n  // that the estimator correctly identified that no text wrapping is needed for this row, skipping the preciseMeasurer.\n  if (maxField === undefined || maxHeight < SINGLE_LINE_ESTIMATE_THRESHOLD) {\n    return defaultHeight;\n  }\n\n  // if we finished this row height loop with an estimate, we need to call\n  // the `preciseMeasurer` method to get the exact line count. the remeasured winner can come back\n  // shorter than a column we already measured precisely, so never drop below that height.\n  if (preciseMeasurer !== undefined) {\n    maxHeight = Math.max(preciseMeasurer(maxValue, maxWidth, maxField, row.__index, lineHeight), maxPreciseHeight);\n  }\n\n  // adjust for vertical padding, and clamp to a minimum default height\n  return Math.max(maxHeight + verticalPadding, defaultHeight);\n}\n\n/**\n * @internal\n * Returns true if text overflow handling should be applied to the cell.\n */\nexport function shouldTextOverflow(field: Field): boolean {\n  const cellOptions = getCellOptions(field);\n  const eligibleCellType =\n    // Tech debt: Technically image cells are of type string, which is misleading (kinda?)\n    // so we need to ensurefield.type === FieldType.string we don't apply overflow hover states for type image\n    (field.type === FieldType.string && cellOptions.type !== TableCellDisplayMode.Image) ||\n    // regardless of the underlying cell type, data links cells have text overflow.\n    cellOptions.type === TableCellDisplayMode.DataLinks ||\n    // an unwrapped JSON cell collapses its pretty-printed block to a single truncated line, so\n    // expanding on hover is the only way to read the value short of opening the inspector.\n    rendersAsJson(field, cellOptions.type);\n\n  return eligibleCellType && !shouldTextWrap(field) && !isCellInspectEnabled(field);\n}\n\n// we only want to infer justifyContent and textAlign for these cellTypes\nconst TEXT_CELL_TYPES = new Set<TableCellDisplayMode>([\n  TableCellDisplayMode.Auto,\n  TableCellDisplayMode.ColorText,\n  TableCellDisplayMode.ColorBackground,\n]);\n\n/**\n * @internal\n * Returns the text-align value for inline-displayed cells for a field based on its type and configuration.\n */\nexport function getAlignment(field: Field): TextAlign {\n  const align: FieldTextAlignment | undefined = field.config.custom?.align;\n\n  if (!align || align === 'auto') {\n    if (TEXT_CELL_TYPES.has(getCellOptions(field).type) && field.type === FieldType.number) {\n      return 'right';\n    }\n    return 'left';\n  }\n\n  return align;\n}\n\nconst DEFAULT_CELL_OPTIONS = { type: TableCellDisplayMode.Auto } as const;\n\n/**\n * @internal\n * Returns the cell options for a field, migrating from legacy displayMode if necessary.\n * TODO: remove live migration in favor of doing it in dashboard or panel migrator\n */\nexport function getCellOptions(field: Field): TableCellOptions {\n  if (field.config.custom?.displayMode) {\n    return migrateTableDisplayModeToCellOptions(field.config.custom?.displayMode);\n  }\n\n  return field.config.custom?.cellOptions ?? DEFAULT_CELL_OPTIONS;\n}\n\n/**\n * @internal\n * Getting gauge or sparkline values to align is very tricky without looking at all values and passing them through display processor.\n * For very large tables that could pretty expensive. So this is kind of a compromise. We look at the first 1000 rows and cache the longest value.\n * If we have a cached value we just check if the current value is longer and update the alignmentFactor. This can obviously still lead to\n * unaligned gauges but it should a lot less common.\n **/\nexport function getAlignmentFactor(\n  field: Field,\n  displayValue: DisplayValue,\n  rowIndex: number\n): DisplayValueAlignmentFactors {\n  let alignmentFactor = field.state?.alignmentFactors;\n\n  if (alignmentFactor) {\n    // check if current alignmentFactor is still the longest\n    if (formattedValueToString(alignmentFactor).length < formattedValueToString(displayValue).length) {\n      alignmentFactor = { ...displayValue };\n      field.state!.alignmentFactors = alignmentFactor;\n    }\n    return alignmentFactor;\n  } else {\n    // look at the next 1000 rows\n    alignmentFactor = { ...displayValue };\n    const maxIndex = Math.min(field.values.length, rowIndex + 1000);\n\n    for (let i = rowIndex + 1; i < maxIndex; i++) {\n      const nextDisplayValue = field.display?.(field.values[i]) ?? field.values[i];\n      if (formattedValueToString(alignmentFactor).length > formattedValueToString(nextDisplayValue).length) {\n        alignmentFactor.text = displayValue.text;\n      }\n    }\n\n    if (field.state) {\n      field.state.alignmentFactors = alignmentFactor;\n    } else {\n      field.state = { alignmentFactors: alignmentFactor };\n    }\n\n    return alignmentFactor;\n  }\n}\n\n/* ------------------------- Cell color calculation ------------------------- */\nconst CELL_COLOR_DARKENING_MULTIPLIER = 10;\nconst CELL_GRADIENT_HUE_ROTATION_DEGREES = 5;\n\n/**\n * @internal\n * Returns the text and background colors for a table cell based on its options and display value.\n */\nexport function getCellColorInlineStylesFactory(theme: GrafanaTheme2) {\n  const bgCellTextColor = memoize((color: string) => getTextColorForAlphaBackground(color, theme.isDark), {\n    maxSize: 1000,\n  });\n  const darkeningFactor = theme.isDark ? 1 : -0.7; // How much to darken elements depends upon if we're in dark mode\n  const gradientBg = memoize(\n    (color: string) =>\n      tinycolor(color)\n        .darken(CELL_COLOR_DARKENING_MULTIPLIER * darkeningFactor)\n        .spin(CELL_GRADIENT_HUE_ROTATION_DEGREES)\n        .toRgbString(),\n    { maxSize: 1000 }\n  );\n  const isTransparent = memoize(\n    (color: string) => {\n      // if hex, do the simple thing.\n      if (color[0] === '#') {\n        return color.length === 9 && color.endsWith('00');\n      }\n      // if not hex, just use tinycolor to avoid extra logic.\n      return tinycolor(color).getAlpha() === 0;\n    },\n    { maxSize: 1000 }\n  );\n\n  return (cellOptions: TableCellOptions, displayValue: DisplayValue, hasApplyToRow: boolean): CSSProperties => {\n    const result: CSSProperties = {};\n    const displayValueColor = displayValue.color;\n\n    if (!displayValueColor) {\n      return result;\n    }\n\n    if (cellOptions.type === TableCellDisplayMode.ColorText) {\n      result.color = displayValueColor;\n    } else if (cellOptions.type === TableCellDisplayMode.ColorBackground) {\n      // return without setting anything if the bg is transparent. this allows\n      // the cell to inherit the row bg color if `applyToRow` is set.\n      if (hasApplyToRow && isTransparent(displayValueColor)) {\n        return result;\n      }\n\n      const mode = cellOptions.mode ?? TableCellBackgroundDisplayMode.Gradient;\n      result.color = bgCellTextColor(displayValueColor);\n      result.background =\n        mode === TableCellBackgroundDisplayMode.Gradient\n          ? `linear-gradient(120deg, ${gradientBg(displayValueColor)}, ${displayValueColor})`\n          : displayValueColor;\n    }\n\n    return result;\n  };\n}\n\n/**\n * @internal\n * Extracts numeric pixel value from theme spacing\n */\nexport const extractPixelValue = (spacing: string | number): number => {\n  return typeof spacing === 'number' ? spacing : parseFloat(spacing) || 0;\n};\n\nexport { getCellLinks } from './cellLinks';\n\n/**\n * @internal\n * Processes nested table rows\n */\nconst processNestedTableRows = (rows: TableRow[], processParents: (parents: TableRow[]) => TableRow[]): TableRow[] => {\n  // Separate parent and child rows\n  // Array for parentRows: enables sorting and maintains order for iteration\n  // Map for childRows: provides O(1) lookup by parent index when reconstructing the result\n  const parentRows: TableRow[] = [];\n  const childRows: Map<number, TableRow> = new Map();\n\n  for (const row of rows) {\n    if (row.__depth === 0) {\n      parentRows.push(row);\n    } else {\n      childRows.set(row.__index, row);\n    }\n  }\n\n  // Process parent rows (filter or sort)\n  const processedParents = processParents(parentRows);\n\n  // Reconstruct the result\n  const result: TableRow[] = [];\n  for (const row of processedParents) {\n    result.push(row);\n    const childRow = childRows.get(row.__index);\n    if (childRow) {\n      result.push(childRow);\n    }\n  }\n\n  return result;\n};\n\n/* ----------------------------- Data grid sorting ---------------------------- */\n/**\n * @internal\n * Columns are sortable unless explicitly disabled. Shared by the column definitions, the header\n * cell, and the width/height measurement, which reserve room for the sort arrow.\n */\nexport function isSortableField(field: Field): boolean {\n  return field.config.custom?.sortable !== false;\n}\n\n/**\n * @internal\n */\nexport function applySort(\n  rows: TableRow[],\n  fields: Field[],\n  sortColumns: SortColumn[],\n  columnTypes: ColumnTypes,\n  hasNestedFrames?: boolean\n): TableRow[] {\n  if (sortColumns.length === 0) {\n    return rows;\n  }\n\n  const sortNanos = sortColumns.map(\n    (c) => fields.find((f) => f.type === FieldType.time && getDisplayName(f) === c.columnKey)?.nanos\n  );\n\n  const compareRows = (a: TableRow, b: TableRow): number => {\n    let result = 0;\n\n    for (let i = 0; i < sortColumns.length; i++) {\n      const { columnKey, direction } = sortColumns[i];\n      const compare = getComparator(columnTypes[columnKey]);\n      const sortDir = direction === 'ASC' ? 1 : -1;\n\n      result = sortDir * compare(a[columnKey], b[columnKey]);\n\n      if (result === 0) {\n        const nanos = sortNanos[i];\n\n        if (nanos !== undefined) {\n          result = sortDir * (nanos[a.__index] - nanos[b.__index]);\n        }\n      }\n\n      if (result !== 0) {\n        break;\n      }\n    }\n\n    return result;\n  };\n\n  return hasNestedFrames\n    ? processNestedTableRows(rows, (parents) => parents.sort(compareRows))\n    : [...rows].sort(compareRows);\n}\n\nexport interface ApplyFilterResult {\n  crossFilterOrder: string[];\n  crossFilterRows: Record<string, TableRow[]>;\n  crossFilterTailRows: TableRow[];\n  filteredRows: TableRow[];\n}\n\n/**\n * @internal\n * Applies active filters to `rows` and computes cross-filter metadata for filter popup UIs.\n *\n * Filters are chained sequentially so that for each filter key, `crossFilterRows[key]`\n * holds the rows available *before* that filter was applied (i.e. the rows that passed all\n * preceding filters in the same scope). `crossFilterTailRows` holds the rows that survive\n * *all* filters — used for new filters that have not yet been applied.\n *\n * `filteredRows` is the display-ready result: equal to `crossFilterTailRows` for flat tables,\n * or wrapped with `processNestedTableRows` to preserve parent-child structure when\n * `hasNestedFrames` is true.\n *\n * When called for a nested table instance, pass `parentIndex` to scope filters to that level.\n */\nexport function applyFilter(\n  rows: TableRow[],\n  filter: FilterType,\n  fields: Field[],\n  hasNestedFrames?: boolean,\n  parentIndex?: number\n): ApplyFilterResult {\n  // Scope rows to the relevant nesting level\n  const isNested = parentIndex !== undefined;\n  const scopedRows = !isNested ? rows.filter((r) => r.__depth === 0) : rows;\n\n  // Collect filter keys that belong to this scope (preserving JS insertion order)\n  const crossFilterOrder = Object.keys(filter).filter((key) => {\n    const entry = filter[key];\n    return !isNested ? entry.parentIndex == null : entry.parentIndex === parentIndex;\n  });\n\n  const crossFilterRows: Record<string, TableRow[]> = {};\n  let crossFilterTailRows = scopedRows;\n\n  for (const filterKey of crossFilterOrder) {\n    const filterEntry = filter[filterKey];\n    // Store rows available *before* this filter is applied\n    crossFilterRows[filterKey] = crossFilterTailRows;\n    // Advance the chain by applying this filter\n    crossFilterTailRows = crossFilterTailRows.filter((row) => {\n      const field = fields.find((f) => getDisplayName(f) === filterEntry.displayName);\n      if (!field || !field.display) {\n        return true;\n      }\n      const displayedValue = formattedValueToString(field.display(row[filterEntry.displayName]));\n      return filterEntry.filteredSet.has(displayedValue);\n    });\n  }\n\n  // For nested frames, wrap with processNestedTableRows so parent rows that have matching\n  // children are preserved for the expander UI. Use a Set for O(1) membership checks.\n  let filteredRows = crossFilterTailRows;\n  if (hasNestedFrames) {\n    const tailSet = new Set(crossFilterTailRows);\n    filteredRows = processNestedTableRows(rows, (parents) => parents.filter((row) => tailSet.has(row)));\n  }\n\n  return { crossFilterOrder, crossFilterRows, crossFilterTailRows, filteredRows };\n}\n\n/* ----------------------------- Data grid mapping ---------------------------- */\n// Row metadata keys that must never be shadowed by a same-named data column when\n// building rows via prototype getters (a column named e.g. \"__index\" would otherwise\n// override the metadata that every cell lookup depends on).\nconst RESERVED_ROW_KEYS = new Set(['__depth', '__index', '__parentIndex']);\n\n/**\n * @internal\n * Builds a converter that maps a DataFrame (struct-of-arrays) into an array of\n * TableRows (array-of-structs) without eval/`unsafe-eval`.\n *\n * Rather than copying every cell value into each row (which forces V8 to use\n * slow computed-key stores and dominates conversion time on wide frames), each\n * data row is created from a per-frame prototype that exposes one getter per\n * column. The getter reads `frame.fields[col].values[this.__index]` on demand,\n * so construction is O(rows) tiny objects instead of O(rows * cols) writes.\n *\n * The `row[displayName]` access contract is preserved for all consumers (sort,\n * filter, row-height measuring). Note that columns are exposed via the prototype\n * rather than as own properties, so they do not appear in `Object.keys(row)` /\n * `JSON.stringify(row)`; no consumer relies on enumerating row own-keys.\n *\n * @param displayNames The display names of the frame's fields, in the order they are stored in the frame.\n * @param nestedFramesFieldName name of the field that contains nested frames. If provided, an expander placeholder row will be emitted for each non-empty nested frame.\n */\nexport function compileFrameToRecords(displayNames: string[], nestedFramesFieldName?: string): FrameToRowsConverter {\n  const nestedColIdx = nestedFramesFieldName ? displayNames.indexOf(nestedFramesFieldName) : -1;\n\n  return (frame: DataFrame, nestedRowIndex?: number): TableRow[] => {\n    const values = frame.fields.map((f) => f.values);\n    const frameLength = frame.length ?? values[0]?.length ?? 0;\n\n    // Build a prototype carrying one getter per column. The nested-frames column\n    // is intentionally not exposed (it is replaced by an expander placeholder row),\n    // and the reserved meta keys are never shadowed by a same-named column so the\n    // true row metadata (notably __index, used to resolve every cell) always wins.\n    const proto = {\n      __depth: -1,\n      __index: -1,\n      __parentIndex: undefined,\n    };\n    const descriptors: PropertyDescriptorMap = {};\n    for (let j = 0; j < displayNames.length; j++) {\n      const name = displayNames[j];\n      if (j === nestedColIdx || RESERVED_ROW_KEYS.has(name)) {\n        continue;\n      }\n      const col = values[j];\n      descriptors[name] = {\n        enumerable: true,\n        get(this: TableRow) {\n          return col[this.__index];\n        },\n      };\n    }\n    Object.defineProperties(proto, descriptors);\n\n    const hasParent = nestedRowIndex != null;\n    const nestedValues = nestedColIdx === -1 ? undefined : values[nestedColIdx];\n\n    const createRow = (index: number, depth: number): TableRow => {\n      const row: TableRow = Object.create(proto);\n      row.__depth = depth;\n      row.__index = index;\n      if (hasParent) {\n        row.__parentIndex = nestedRowIndex;\n      }\n      return row;\n    };\n\n    // Fast path: without a nested-frames column the output is exactly one row\n    // per frame entry, so it can be sized up front and written by index.\n    if (nestedValues === undefined) {\n      const result = Array(frameLength);\n      for (let i = 0; i < frameLength; i++) {\n        result[i] = createRow(i, 0);\n      }\n      return result;\n    }\n\n    // Nested path: each entry may emit an extra expander placeholder row, so the\n    // final length isn't known without inspecting the nested column.\n    const rows: TableRow[] = [];\n    for (let i = 0; i < frameLength; i++) {\n      rows.push(createRow(i, 0));\n      if (nestedValues[i]) {\n        rows.push({ __depth: 1, __index: i });\n      }\n    }\n\n    return rows;\n  };\n}\n\n/* ----------------------------- Data grid comparator ---------------------------- */\n// The numeric: true option is used to sort numbers as strings correctly. It recognizes numeric sequences\n// within strings and sorts numerically instead of lexicographically.\nconst compare = new Intl.Collator('en', { sensitivity: 'base', numeric: true }).compare;\nconst strCompare: Comparator = (a, b) => compare(String(a ?? ''), String(b ?? ''));\nconst numCompare: Comparator = (a, b) => {\n  if (a === b) {\n    return 0;\n  }\n  if (a == null) {\n    return -1;\n  }\n  if (b == null) {\n    return 1;\n  }\n  return Number(a) - Number(b);\n};\nconst frameCompare: Comparator = (a, b) => {\n  // @ts-ignore The compared vals are DataFrameWithValue. the value is the rendered stat (first, last, etc.)\n  return (a?.value ?? 0) - (b?.value ?? 0);\n};\n\n/**\n * @internal\n */\nexport function getComparator(sortColumnType: FieldType): Comparator {\n  switch (sortColumnType) {\n    // Handle sorting for frame type fields (sparklines)\n    case FieldType.frame:\n      return frameCompare;\n    case FieldType.time:\n    case FieldType.number:\n    case FieldType.boolean:\n      return numCompare;\n    case FieldType.string:\n    case FieldType.enum:\n    default:\n      return strCompare;\n  }\n}\n\ntype TableCellGaugeDisplayModes =\n  | TableCellDisplayMode.BasicGauge\n  | TableCellDisplayMode.GradientGauge\n  | TableCellDisplayMode.LcdGauge;\nconst TABLE_CELL_GAUGE_DISPLAY_MODES_TO_DISPLAY_MODES: Record<TableCellGaugeDisplayModes, BarGaugeDisplayMode> = {\n  [TableCellDisplayMode.BasicGauge]: BarGaugeDisplayMode.Basic,\n  [TableCellDisplayMode.GradientGauge]: BarGaugeDisplayMode.Gradient,\n  [TableCellDisplayMode.LcdGauge]: BarGaugeDisplayMode.Lcd,\n};\n\ntype TableCellColorBackgroundDisplayModes =\n  | TableCellDisplayMode.ColorBackground\n  | TableCellDisplayMode.ColorBackgroundSolid;\nconst TABLE_CELL_COLOR_BACKGROUND_DISPLAY_MODES_TO_DISPLAY_MODES: Record<\n  TableCellColorBackgroundDisplayModes,\n  TableCellBackgroundDisplayMode\n> = {\n  [TableCellDisplayMode.ColorBackground]: TableCellBackgroundDisplayMode.Gradient,\n  [TableCellDisplayMode.ColorBackgroundSolid]: TableCellBackgroundDisplayMode.Basic,\n};\n\n/* ---------------------------- Miscellaneous ---------------------------- */\n/**\n * Migrates table cell display mode to new object format.\n *\n * @param displayMode The display mode of the cell\n * @returns TableCellOptions object in the correct format\n * relative to the old display mode.\n */\nexport function migrateTableDisplayModeToCellOptions(displayMode: TableCellDisplayMode): TableCellOptions {\n  switch (displayMode) {\n    // In the case of the gauge we move to a different option\n    case TableCellDisplayMode.BasicGauge:\n    case TableCellDisplayMode.GradientGauge:\n    case TableCellDisplayMode.LcdGauge:\n      return {\n        type: TableCellDisplayMode.Gauge,\n        mode: TABLE_CELL_GAUGE_DISPLAY_MODES_TO_DISPLAY_MODES[displayMode],\n      };\n    // Also true in the case of the color background\n    case TableCellDisplayMode.ColorBackground:\n    case TableCellDisplayMode.ColorBackgroundSolid:\n      return {\n        type: TableCellDisplayMode.ColorBackground,\n        mode: TABLE_CELL_COLOR_BACKGROUND_DISPLAY_MODES_TO_DISPLAY_MODES[displayMode],\n      };\n    // catching a nonsense case: `displayMode`: 'custom' should pre-date the CustomCell.\n    // if it doesn't, we need to just nope out and return an auto cell.\n    case TableCellDisplayMode.Custom:\n      return {\n        type: TableCellDisplayMode.Auto,\n      };\n    default:\n      return {\n        type: displayMode,\n      };\n  }\n}\n\n/**\n * @internal\n * Returns unique key for each row\n */\nexport function rowKeyGetter(row: TableRow): string {\n  return row.__index + '_' + row.__depth;\n}\n\n/**\n * @internal\n * Calculate the footer height based on the maximum reducer count\n */\nexport const calculateFooterHeight = (fields: Field[]): number => {\n  let maxReducerCount = 0;\n  for (const field of fields) {\n    maxReducerCount = Math.max(maxReducerCount, field.config.custom?.footer?.reducers?.length ?? 0);\n  }\n\n  // Base height (+ padding) + height per reducer\n  return maxReducerCount > 0 ? maxReducerCount * TABLE.LINE_HEIGHT + TABLE.CELL_PADDING * 2 : 0;\n};\n\n/**\n * @internal\n * returns the display name of a field\n * returns the display name of a field.\n * We intentionally do not want to use @grafana/data's getFieldDisplayName here,\n * instead we have a call to cacheFieldDisplayNames up in TablePanel to handle this\n * before we begin.\n */\nexport const getDisplayName = (field: Field): string => {\n  return field.state?.displayName ?? field.name;\n};\n\n/**\n * @internal given a field name or display name, returns a predicate function that checks if a field matches that name.\n */\nexport const predicateByName = (name: string) => (f: Field) => f.name === name || getDisplayName(f) === name;\n\n/**\n * @internal\n * returns only fields that are not nested tables and not explicitly hidden\n */\nexport function getVisibleFields(fields: Field[]): Field[] {\n  return fields.filter((field) => field.type !== FieldType.nestedFrames && field.config.custom?.hideFrom?.viz !== true);\n}\n\n/** Reorders fields by display name and appends unmentioned fields. @internal */\nexport function orderFieldsByDisplayNames(fields: Field[], order?: string[]): Field[] {\n  if (!order || order.length === 0) {\n    return fields;\n  }\n  const byDisplayName = new Map(fields.map((field) => [getDisplayName(field), field]));\n  const ordered: Field[] = [];\n  for (const name of order) {\n    const field = byDisplayName.get(name);\n    if (field) {\n      ordered.push(field);\n      byDisplayName.delete(name);\n    }\n  }\n  for (const field of fields) {\n    if (byDisplayName.has(getDisplayName(field))) {\n      ordered.push(field);\n    }\n  }\n  return ordered;\n}\n\n/** Removes fields hidden through table controls. @internal */\nexport function filterFieldsByHiddenColumns(fields: Field[], hiddenColumns?: ReadonlySet<string>): Field[] {\n  if (!hiddenColumns || hiddenColumns.size === 0) {\n    return fields;\n  }\n  return fields.filter((field) => !hiddenColumns.has(getDisplayName(field)));\n}\n\n/**\n * @internal\n * returns a map of column types by display name\n */\nexport function getColumnTypes(fields: Field[]): ColumnTypes {\n  return fields.reduce<ColumnTypes>((acc, field) => {\n    switch (field.type) {\n      case FieldType.nestedFrames:\n        return { ...acc, ...getColumnTypes(field.values[0]?.[0]?.fields ?? []) };\n      default:\n        return { ...acc, [getDisplayName(field)]: field.type };\n    }\n  }, {});\n}\n\n/**\n * @internal\n * calculates the width of each field, with the following logic:\n * 1. manual sizing minWidth is hard-coded to 50px, we set this in RDG since it enforces the hard limit correctly\n * 2. if minWidth is configured in fieldConfig (or defaults to 150), it serves as the bottom of the auto-size clamp\n */\nexport function computeColWidths(fields: Field[], availWidth: number) {\n  let autoCount = 0;\n  let definedWidth = 0;\n\n  return (\n    fields\n      // first pass to add up how many fields have pre-defined widths and what that width totals to.\n      .map((field) => {\n        const width: number = field.config.custom?.width ?? 0;\n\n        if (width === 0) {\n          autoCount++;\n        } else {\n          definedWidth += width;\n        }\n\n        return width;\n      })\n      // second pass once `autoCount` and `definedWidth` are known.\n      .map(\n        (width, i) =>\n          width ||\n          Math.max(fields[i].config.custom?.minWidth ?? COLUMN.DEFAULT_WIDTH, (availWidth - definedWidth) / autoCount)\n      )\n  );\n}\n\n// Bounds the amount of work content-aware sizing does. We sample at most MAX_SAMPLE rows per\n// column and shrink the per-column sample as the column count grows so a very wide frame doesn't\n// blow up the measurement budget. The sample is spread evenly across the whole field (see\n// sampleIndices) rather than taken from the front, so a sorted or clustered column isn't sized from\n// just its first — e.g. smallest — values.\nconst TARGET_MEASUREMENTS = 2000;\nconst MIN_SAMPLE = 20;\nconst MAX_SAMPLE = 100;\n\n/**\n * Evenly-spaced row indices spanning the whole field, inclusive of the first and last rows. Sizing\n * from the first N rows biases sorted/clustered columns (an ascending column would be measured from\n * its shortest values, an alphabetical one from a single letter); spreading the sample across the\n * field — and always including the last row — captures the extremes wherever the sort puts them.\n * Deterministic on purpose: true random sampling would make column widths jitter between recomputes.\n */\nfunction sampleIndices(totalLen: number, sampleSize: number): number[] {\n  const n = Math.min(sampleSize, totalLen);\n  if (n <= 0) {\n    return [];\n  }\n  if (n === 1) {\n    return [0];\n  }\n  const step = (totalLen - 1) / (n - 1);\n  const indices = new Array<number>(n);\n  for (let k = 0; k < n; k++) {\n    indices[k] = Math.round(k * step);\n  }\n  return indices;\n}\n\nexport interface ContentAwareColWidthsOptions {\n  hasAssistantAction?: boolean;\n  typographyCtx: TypographyCtx;\n  /**\n   * Header labels render at `fontWeightMedium`, which is wider than the body text `typographyCtx`\n   * measures, so headers get their own context and a column that hugs its header doesn't\n   * ellipsize the title.\n   */\n  headerTypographyCtx: TypographyCtx;\n  showTypeIcons?: boolean;\n  /**\n   * Whether the table renders a header row. When it doesn't, the header label is not a lower bound on\n   * the column, so it is left out of the measurement entirely. Defaults to true.\n   */\n  hasHeader?: boolean;\n  /** Bound `(field, rowIdx) => actions`, so Actions columns can be sized to their button labels. */\n  getActions?: GetActionsFunctionLocal;\n  /** `table.refresh`: a filterable column reserves the column menu button instead of a filter icon. */\n  tableRefreshEnabled?: boolean;\n  theme?: GrafanaTheme2;\n  /**\n   * Active filters. Under `table.refresh` a filtered column also reserves space for the persistent\n   * filter icon that marks it — unlike the sort arrow, that icon only exists while the state holds.\n   */\n  filter?: FilterType;\n  hasColumnSidebar?: boolean;\n  reorderable?: boolean;\n  /** The first column carries extra inline-start padding to line up with the panel title. */\n  noPanelPadding?: boolean;\n  /**\n   * Truncate rather than scroll: auto columns are levelled down to fit `availWidth` even when their\n   * content doesn't wrap, so an embedding layout that has already reserved room for every column\n   * doesn't lose the last of them behind a horizontal scrollbar.\n   */\n  preventHorizontalOverflow?: boolean;\n  /** overridable for testing; otherwise derived from the auto-column count */\n  sampleSize?: number;\n}\n\n/** Formats a raw cell value the way it renders, so we measure what the user actually sees. */\nfunction formatCellValue(field: Field, value: unknown): string {\n  if (value == null) {\n    return '';\n  }\n  // AutoCell renders field.display(value) for every field type, so measure the same thing.\n  // String fields go through it too: they can carry units, value mappings, or other formatting.\n  if (field.display != null) {\n    return formattedValueToString(field.display(value));\n  }\n  return String(value);\n}\n\n/**\n * Estimates the pixel width of the longest content in a field from character count. Width is\n * proportional to length under `avgCharWidth`, so the longest-by-length value is the widest — we\n * just track the max length and scale it, no per-value canvas measurement. This trades exact\n * proportional-font width (e.g. \"WWW\" vs \"iiiiii\") for a cheap estimate the global cap bounds.\n */\nfunction measureLongestContentWidth(field: Field, sampleSize: number, avgCharWidth: number): number {\n  let maxLen = 0;\n  for (const i of sampleIndices(field.values.length, sampleSize)) {\n    maxLen = Math.max(maxLen, formatCellValue(field, field.values[i]).length);\n  }\n  return maxLen * avgCharWidth;\n}\n\n/**\n * Like {@link measureLongestContentWidth} but measures the longest single line rather than the whole\n * string. For content that renders as a pre-formatted multi-line block (JSON), the total length is\n * dominated by newlines and indentation and would wildly over-size the column; the rendered width is\n * the widest line.\n */\nfunction measureLongestLineWidth(field: Field, sampleSize: number, avgCharWidth: number): number {\n  let maxLen = 0;\n  for (const i of sampleIndices(field.values.length, sampleSize)) {\n    for (const line of formatCellValue(field, field.values[i]).split('\\n')) {\n      maxLen = Math.max(maxLen, line.length);\n    }\n  }\n  return maxLen * avgCharWidth;\n}\n\n/**\n * Width for cells holding several chips/links/buttons that flow horizontally and wrap (pills, data\n * links, actions). Since a cell holds multiple items, we size to an *average row's* combined item\n * width (per-item `chrome` + inter-item `gap`) rather than the single longest value, so long runs\n * wrap to a few lines rather than one item per line once the global cap applies. The floor is the\n * widest single item so none is ever clipped.\n *\n * `itemsForRow` returns the display text of each item in a sampled row; `indices` are the sampled\n * rows (see sampleIndices).\n */\nfunction measureInlineRunWidth(\n  indices: number[],\n  itemsForRow: (rowIdx: number) => string[],\n  avgCharWidth: number,\n  chrome: number,\n  gap: number,\n  // When the items stack vertically instead of flowing horizontally (e.g. a wrapped DataLinks cell\n  // lays its links out in a column), the width follows the widest single item, not the row's run.\n  stack = false\n): number {\n  let widestItem = 0;\n  let rowTotalSum = 0;\n  let sampledRows = 0;\n\n  for (const i of indices) {\n    const items = itemsForRow(i);\n    if (items.length === 0) {\n      continue;\n    }\n\n    let rowTotal = 0;\n    for (const text of items) {\n      const itemWidth = text.length * avgCharWidth + chrome;\n      widestItem = Math.max(widestItem, itemWidth);\n      rowTotal += itemWidth;\n    }\n    rowTotal += gap * (items.length - 1);\n    rowTotalSum += rowTotal;\n    sampledRows++;\n  }\n\n  if (sampledRows === 0) {\n    return 0;\n  }\n\n  return stack ? widestItem : Math.max(rowTotalSum / sampledRows, widestItem);\n}\n\nexport function isFieldFilterable(field: Field): boolean {\n  return field.config.custom?.filterable ?? false;\n}\n\n/** @internal */\nexport function isFieldHideable(field: Field): boolean {\n  return field.config.custom?.hideable ?? false;\n}\n\n/**\n * Width the header label needs, including its filter/sort/type-icon affordances.\n *\n * Canvas-measured exactly rather than estimated from `avgCharWidth`: this is a hard lower bound on\n * the column, so an under-estimate truncates the title outright — and it's one short string per\n * column, not a sample across many rows.\n *\n * Sort-arrow space is reserved for every sortable column, whether or not it is currently sorted:\n * reserving it only for the sorted column would make every auto width a function of the sort state,\n * so clicking a header would resize the whole table (the sorted column gains the arrow's width, and\n * that shifts every other column's share of the leftover space).\n */\nexport interface HeaderAffordanceOptions {\n  hasColumnOptions?: boolean;\n  showTypeIcons: boolean;\n  tableRefreshEnabled: boolean;\n  /** Whether a filter is currently active on this column — only the refreshed header marks that. */\n  isFiltered: boolean;\n  reorderable?: boolean;\n}\n\n/**\n * @internal Horizontal space the header's affordances take beside the label.\n *\n * The single description of what sits next to a header's text, so the two paths that care can't\n * drift: `measureHeaderWidth` adds it when sizing an auto column, and `useHeaderHeight` subtracts it\n * to find the room a wrapped label has.\n */\nexport function getHeaderAffordanceWidth(\n  field: Field,\n  {\n    showTypeIcons,\n    tableRefreshEnabled,\n    isFiltered,\n    hasColumnOptions = false,\n    reorderable = false,\n  }: HeaderAffordanceOptions\n): number {\n  const isFilterable = isFieldFilterable(field);\n  let width = 0;\n  width += showTypeIcons ? HEADER_ICON_SPACE : 0;\n  // reserved on every sortable column, not just the currently-sorted one, so a wrapped header doesn't\n  // gain a line (shifting the whole grid down) the moment it's sorted.\n  width += isSortableField(field) ? HEADER_ICON_SPACE : 0;\n  // `headerTooltip` renders its info button in both header variants, and like the sort arrow above it\n  // is there for as long as the option is set rather than only while some state holds.\n  width += field.config.custom?.headerTooltip ? HEADER_TOOLTIP_SPACE : 0;\n  width += reorderable ? HEADER_DRAG_HANDLE_SPACE : 0;\n  if (tableRefreshEnabled) {\n    width += hasColumnOptions ? HEADER_MENU_SPACE : 0;\n    // an active filter additionally marks itself with a persistent icon. Unlike the arrow, that icon\n    // only exists while the filter holds, so its space is reserved only then (the widths recompute\n    // when the filter changes).\n    width += isFiltered ? HEADER_ICON_SPACE : 0;\n  } else {\n    // the classic header renders its filter icon inline whenever the column is filterable, whether\n    // or not a filter is currently active.\n    width += isFilterable ? HEADER_ICON_SPACE : 0;\n  }\n  return width;\n}\n\nfunction measureHeaderWidth(field: Field, ctx: TypographyCtx, opts: HeaderAffordanceOptions): number {\n  return ctx.measureWidth(getDisplayName(field)) + CELL_HORIZONTAL_CHROME + getHeaderAffordanceWidth(field, opts);\n}\n\n// gap between a footer reducer's label and its value (theme.spacing(0.5), matches SummaryCell).\nconst FOOTER_LABEL_GAP = 4;\n\n// Reducers the footer renders unformatted (raw count), skipping the field's display processor —\n// mirrors SummaryCell so a count on a time/unit column isn't measured as a formatted value.\nconst FOOTER_UNFORMATTED_REDUCERS = new Set<string>([ReducerID.count, ReducerID.countAll]);\n\n/**\n * Width a column's footer/summary cell needs. Each reducer renders label + value inline, so\n * size to the widest reducer row; returns 0 if no footer. Values computed/formatted as the\n * footer renders them.\n *\n * Label and value are canvas-measured exactly (medium-weight header context), not estimated via\n * `avgCharWidth` — footer values are digit/symbol/unit-heavy and the label is `flex-shrink: 0`,\n * so an under-measure would truncate the value. (Label renders slightly smaller than header font\n * in practice, so this slightly over-reserves — safe direction.)\n */\nfunction measureFooterWidth(field: Field, headerCtx: TypographyCtx): number {\n  const reducers = field.config.custom?.footer?.reducers;\n  if (reducers == null || reducers.length === 0) {\n    return 0;\n  }\n  // Reduce over a copy with its own `state` so we never touch the shared `field.state.calcs`:\n  // reduceField reads and writes that cache, and the footer (useReducerEntries) relies on it —\n  // reducing the full, unfiltered values here would otherwise leave the footer showing whole-dataset\n  // stats while the table is filtered.\n  const results = reduceField({ field: { ...field, state: undefined }, reducers });\n  let widest = 0;\n  for (const id of reducers) {\n    // SummaryCell uppercases the label; the value goes through the display processor (except the raw\n    // count reducers, which render unformatted).\n    const label = (fieldReducers.get(id)?.name ?? id).toUpperCase();\n    const value = results[id];\n    let valueText = '';\n    if (value != null) {\n      valueText = FOOTER_UNFORMATTED_REDUCERS.has(id) ? String(value) : formatCellValue(field, value);\n    }\n    // kerned whole-string widths, deliberately: footer text is `nowrap` and never line-counted, so\n    // unlike a header label it wants the width the browser draws, not the width uwrap would assume.\n    const rowWidth =\n      headerCtx.ctx.measureText(label).width + FOOTER_LABEL_GAP + headerCtx.ctx.measureText(valueText).width;\n    widest = Math.max(widest, rowWidth);\n  }\n\n  return widest + CELL_HORIZONTAL_CHROME;\n}\n\ninterface ColWidthMeasureCtx {\n  typographyCtx: TypographyCtx;\n  /** Bound `(field, rowIdx) => actions`, used to size Actions columns; absent when not wired. */\n  getActions?: GetActionsFunctionLocal;\n  theme?: GrafanaTheme2;\n}\n\n/**\n * A cell type's content-width strategy: the width its content wants, including any horizontal\n * chrome. The caller unions this with the header width and clamps it to `[floor, cap]`.\n */\ntype MeasureColWidth = (field: Field, sampleSize: number, ctx: ColWidthMeasureCtx) => number;\n\n// Graphical cells don't render free text — gauges need bar room, sparklines/geo are pictorial — so\n// they take a fixed default instead of being measured.\nconst measureGraphicalColWidth: MeasureColWidth = () => COLUMN.DEFAULT_WIDTH;\n\n// Images scale to the cell (object-fit: contain), so a wide column is mostly whitespace — a small\n// fixed default reads better than the graphical default.\nconst measureImageColWidth: MeasureColWidth = () => COLUMN.IMAGE_WIDTH;\n\nconst measurePillColWidth: MeasureColWidth = (field, sampleSize, { typographyCtx, theme }) => {\n  const { spacing, gap } = getPillMetrics(theme);\n  return (\n    measureInlineRunWidth(\n      sampleIndices(field.values.length, sampleSize),\n      // PillCell renders formattedValueToString(field.display(pill)); estimate from that same text so\n      // value mappings/units are reflected. formatCellValue falls back to String() with no display.\n      (i) => inferPills(field.values[i]).map((pill) => formatCellValue(field, pill)),\n      typographyCtx.avgCharWidth,\n      spacing,\n      gap\n    ) + CELL_HORIZONTAL_CHROME\n  );\n};\n\nconst measureDataLinksColWidth: MeasureColWidth = (field, sampleSize, { typographyCtx }) =>\n  measureInlineRunWidth(\n    sampleIndices(field.values.length, sampleSize),\n    // DataLinksCell renders one <a> per link title; getCellLinks resolves the same links per row.\n    (i) => getCellLinks(field, i)?.map((link) => link.title ?? '') ?? [],\n    typographyCtx.avgCharWidth,\n    LINK_SPACING,\n    LINK_GAP,\n    // when wrapping, DataLinksCell stacks its links vertically, so size to the widest single link.\n    shouldTextWrap(field)\n  ) + CELL_HORIZONTAL_CHROME;\n\nconst measureActionsColWidth: MeasureColWidth = (field, sampleSize, { typographyCtx, getActions }) => {\n  if (getActions == null) {\n    return 0; // actions aren't wired in this context; fall back to the header/floor width\n  }\n  return (\n    measureInlineRunWidth(\n      sampleIndices(field.values.length, sampleSize),\n      // ActionsCell renders one Button per action, labelled action.title.\n      (i) => getActions(field, i).map((action) => action.title),\n      typographyCtx.avgCharWidth,\n      ACTION_SPACING,\n      ACTION_GAP\n    ) + CELL_HORIZONTAL_CHROME\n  );\n};\n\n// `avgCharWidth` comes from a prose sample, so it under-estimates digit/symbol-heavy strings like\n// timestamps. String/time columns get a padding's worth of slack to compensate; numeric/boolean\n// columns stay tight on purpose.\nconst TEXT_WIDTH_WIGGLE = TABLE.CELL_PADDING;\n\nconst measureTextColWidth: MeasureColWidth = (field, sampleSize, { typographyCtx, theme }) => {\n  // Numeric and date/time columns are digit-dominated and render with tabular-nums under\n  // `dataviz.tabularNums`, so estimate them with the (wider, uniform) tabular digit width rather than the\n  // prose average. Without the toggle the grid keeps proportional digits, so fall back to the prose\n  // average and the original wiggle rule (string and time both get slack).\n  if (!theme?.flags.tabularNums) {\n    const width = measureLongestContentWidth(field, sampleSize, typographyCtx.avgCharWidth) + CELL_HORIZONTAL_CHROME;\n    const isText = field.type === FieldType.string || field.type === FieldType.time;\n    return isText ? width + TEXT_WIDTH_WIGGLE : width;\n  }\n\n  const isNumericLike = field.type === FieldType.number || field.type === FieldType.time;\n  const charWidth = isNumericLike ? typographyCtx.numericCharWidth : typographyCtx.avgCharWidth;\n  const width = measureLongestContentWidth(field, sampleSize, charWidth) + CELL_HORIZONTAL_CHROME;\n  // String columns still get slack because the prose average under-measures them; numeric/time now\n  // use the wider tabular width, so they no longer need the extra wiggle.\n  return field.type === FieldType.string ? width + TEXT_WIDTH_WIGGLE : width;\n};\n\n// Markdown always wraps and renders formatted, so its raw source is a poor proxy for rendered width\n// — markup syntax and long link URLs would stretch the column to the cap. Contribute no content\n// width so it sizes to its header and wraps to extra height instead.\nconst measureMarkdownColWidth: MeasureColWidth = () => 0;\n\n// JSON pretty-prints to a multi-line block, but its layout depends on wrapping: wrapped renders as\n// `pre`/`pre-line` (newlines preserved), so width is the widest line; unwrapped collapses to a\n// single line, so width is the whole value. Measuring an unwrapped column by its widest line would\n// under-measure and clip it.\nconst measureJsonColWidth: MeasureColWidth = (field, sampleSize, { typographyCtx }) => {\n  const measure = shouldTextWrap(field) ? measureLongestLineWidth : measureLongestContentWidth;\n  // JSON renders in a monospace font, so size with the monospace character width.\n  return measure(field, sampleSize, typographyCtx.monoCharWidth) + CELL_HORIZONTAL_CHROME;\n};\n\n// Cell types that size differently from plain text register here; anything absent falls back to\n// measureTextColWidth. Mirrors the buildCellHeightMeasurers factory map.\nconst COL_WIDTH_MEASURERS: Partial<Record<TableCellDisplayMode, MeasureColWidth>> = {\n  [TableCellDisplayMode.Sparkline]: measureGraphicalColWidth,\n  [TableCellDisplayMode.Gauge]: measureGraphicalColWidth,\n  [TableCellDisplayMode.BasicGauge]: measureGraphicalColWidth,\n  [TableCellDisplayMode.GradientGauge]: measureGraphicalColWidth,\n  [TableCellDisplayMode.LcdGauge]: measureGraphicalColWidth,\n  [TableCellDisplayMode.Image]: measureImageColWidth,\n  [TableCellDisplayMode.Geo]: measureGraphicalColWidth,\n  [TableCellDisplayMode.Pill]: measurePillColWidth,\n  [TableCellDisplayMode.Actions]: measureActionsColWidth,\n  [TableCellDisplayMode.DataLinks]: measureDataLinksColWidth,\n  [TableCellDisplayMode.Markdown]: measureMarkdownColWidth,\n  [TableCellDisplayMode.JSONView]: measureJsonColWidth,\n};\n\nconst DEFAULT_GROWTH_WEIGHT = 1;\n\n// Per-field-type multiplier on a column's share of the panel's leftover space (see the grow step\n// below); types absent here fall back to DEFAULT_GROWTH_WEIGHT. Numeric and boolean values are short\n// and fixed-width, so a smaller weight keeps them tight while strings/dates/pills take most of the\n// slack. A shared weight cancels out, so an all-numeric table still fills the panel.\nconst GROWTH_WEIGHTS: Partial<Record<FieldType, number>> = {\n  [FieldType.number]: 0.35,\n  [FieldType.boolean]: 0.35,\n};\n\nfunction growthWeight(type: FieldType): number {\n  return GROWTH_WEIGHTS[type] ?? DEFAULT_GROWTH_WEIGHT;\n}\n\n// Below half a pixel there's nothing left worth redistributing, and the accumulated float error is\n// the same order as the gain, so the levelling below stops here rather than chasing an exact fit.\nconst SHRINK_EPS = 0.5;\n\n// Cell types that reflow their content into extra row height rather than clipping it. Their measured\n// content width is a preference rather than a requirement, so it's the first thing we give back when\n// the table would otherwise overflow the panel.\nfunction isReflowingCol(field: Field, resolvedType: TableCellDisplayMode): boolean {\n  // Markdown renders wrapped whatever `wrapText` says (see measureMarkdownColWidth).\n  return shouldTextWrap(field) || resolvedType === TableCellDisplayMode.Markdown;\n}\n\n// Cell types whose width is chrome rather than text: a gauge, a sparkline, an image, a row of action\n// buttons. There is nothing in them to ellipsize, so squeezing one clips the control itself — they\n// stay at their measured width even under `preventHorizontalOverflow`.\nconst UNSHRINKABLE_CELL_TYPES = new Set<TableCellDisplayMode>([\n  TableCellDisplayMode.Sparkline,\n  TableCellDisplayMode.Gauge,\n  TableCellDisplayMode.BasicGauge,\n  TableCellDisplayMode.GradientGauge,\n  TableCellDisplayMode.LcdGauge,\n  TableCellDisplayMode.Image,\n  TableCellDisplayMode.Geo,\n  TableCellDisplayMode.Actions,\n]);\n\n/**\n * Reclaims up to `deficit` px from `widths` (mutated in place) by levelling its widest entries down:\n * the widest column is cut to the next-widest, then the two are cut together, and so on. The columns\n * responsible for the overflow therefore give the space back before their narrower neighbours give\n * up any, and a column already narrower than the level we land on is never touched at all. No column\n * goes below its `floors` entry, so this returns less than `deficit` when the floors are hit first.\n *\n * Only columns present in `floors` are candidates.\n */\nfunction levelDownColWidths(widths: Map<number, number>, floors: Map<number, number>, deficit: number): number {\n  let pool = Array.from(floors.keys()).filter((i) => widths.get(i)! > floors.get(i)! + SHRINK_EPS);\n  let remaining = deficit;\n\n  while (remaining > SHRINK_EPS && pool.length > 0) {\n    const level = Math.max(...pool.map((i) => widths.get(i)!));\n    const tier: number[] = [];\n    let nextLevel = 0;\n    for (const i of pool) {\n      const width = widths.get(i)!;\n      if (width >= level - SHRINK_EPS) {\n        tier.push(i);\n      } else {\n        nextLevel = Math.max(nextLevel, width);\n      }\n    }\n\n    // How deep the current tier can be cut in one pass: down to the next-widest column, down to the\n    // highest floor in the tier, or just far enough to cover what's left of the deficit — whichever\n    // comes first. Each of those outcomes re-tiers the next pass (a wider tier, a smaller pool, or\n    // done), so the loop always makes progress.\n    const tierFloor = Math.max(...tier.map((i) => floors.get(i)!));\n    const step = Math.min(remaining / tier.length, level - nextLevel, level - tierFloor);\n    for (const i of tier) {\n      widths.set(i, widths.get(i)! - step);\n    }\n    remaining -= step * tier.length;\n    pool = pool.filter((i) => widths.get(i)! > floors.get(i)! + SHRINK_EPS);\n  }\n\n  return deficit - remaining;\n}\n\n/**\n * @internal\n * Content-aware variant of {@link computeColWidths}. Columns with a configured `custom.width` keep\n * that exact width. Every other (\"auto\") column is sized to fit its content:\n *   1. its cell content (a sampled, display-formatted, measured max) or a per-type default for\n *      graphical cells, whichever applies, unioned with its header label width (skipped when the\n *      header row is hidden);\n *   2. clamped to `[max(MIN_WIDTH, custom.minWidth), MAX_AUTO_WIDTH]`;\n *   3. then, if the auto columns overflow the available width, the overflow is taken back out of the\n *      columns that can absorb it, widest first (see {@link levelDownColWidths}): a wrapped column\n *      trades the width for extra row height, and under `preventHorizontalOverflow` every\n *      text-bearing column trades it for an ellipsis, either being preferable to a horizontal\n *      scrollbar;\n *   4. or, if the auto columns don't fill the available width, the leftover is distributed by a\n *      growth share of `growthWeight × √(content width)`, so a column with more content still takes\n *      more slack (a busy pill column beats a sparse one) while the √ damps the spread enough that\n *      the widest column doesn't run away from its neighbours; numeric/boolean columns grow only\n *      modestly (see {@link growthWeight}).\n * When the overflow survives step 3 — nothing able to absorb it, or the floors reached — the\n * remaining content widths are kept and the grid scrolls.\n *\n * Every input is independent of the sort and filter state (fields hold the full, unsorted values),\n * so widths stay put when the user sorts or filters. See {@link measureHeaderWidth} for the sort\n * arrow, the one affordance that would otherwise make them sort-dependent.\n */\nexport function computeContentAwareColWidths(\n  fields: Field[],\n  availWidth: number,\n  {\n    typographyCtx,\n    headerTypographyCtx,\n    showTypeIcons = false,\n    hasAssistantAction = false,\n    hasHeader = true,\n    getActions,\n    tableRefreshEnabled = false,\n    theme,\n    filter,\n    sampleSize,\n    hasColumnSidebar = false,\n    reorderable = false,\n    noPanelPadding = false,\n    preventHorizontalOverflow = false,\n  }: ContentAwareColWidthsOptions\n): number[] {\n  const autoIdxs: number[] = [];\n  let definedWidth = 0;\n\n  const widths = fields.map((field, i) => {\n    const configured = field.config.custom?.width ?? 0;\n    if (configured) {\n      definedWidth += configured;\n      return configured;\n    }\n    autoIdxs.push(i);\n    return 0;\n  });\n\n  if (autoIdxs.length === 0) {\n    return widths;\n  }\n\n  const effectiveSampleSize =\n    sampleSize ?? Math.min(MAX_SAMPLE, Math.max(MIN_SAMPLE, Math.floor(TARGET_MEASUREMENTS / autoIdxs.length)));\n\n  // content width per auto column, clamped to [floor, cap]\n  const contentWidths = new Map<number, number>();\n  let contentTotal = 0;\n  // lower bound per shrinkable auto column, for the overflow step below; absent for columns that\n  // can't give width back, or that are already sitting at their bound.\n  const shrinkFloors = new Map<number, number>();\n\n  const measureCtx: ColWidthMeasureCtx = { typographyCtx, getActions, theme };\n  // Filter entries are keyed per parent on nested tables, so match on the display name they carry\n  // rather than the key: nested columns share one width, so any active filter widens the column.\n  const filteredKeys = new Set(\n    Object.values(filter ?? {})\n      .filter((entry) => entry.filtered != null)\n      .map((entry) => entry.displayName)\n  );\n\n  for (const i of autoIdxs) {\n    const field = fields[i];\n    // A hidden header row has no label to fit, so it doesn't bound the column at all.\n    const headerWidth = hasHeader\n      ? measureHeaderWidth(field, headerTypographyCtx, {\n          showTypeIcons,\n          tableRefreshEnabled,\n          isFiltered: filteredKeys.has(getDisplayName(field)),\n          reorderable,\n          hasColumnOptions:\n            getColumnMenuOptions({\n              filterable: isFieldFilterable(field),\n              hideable: isFieldHideable(field),\n              hasColumnSidebar,\n              hasAssistantAction,\n            }).length > 0,\n        })\n      : 0;\n\n    // Size to content (unioned with header width below), even for wrapped columns — the cap bounds\n    // it, wrapping adds height instead. Registered measurer picks pill/link/action/graphical; default is text.\n    const cellType = getCellOptions(field).type;\n    const resolvedType =\n      cellType == null || cellType === TableCellDisplayMode.Auto ? getAutoRendererDisplayMode(field) : cellType;\n    const measure = COL_WIDTH_MEASURERS[resolvedType] ?? measureTextColWidth;\n    const cellWidth = measure(field, effectiveSampleSize, measureCtx);\n    const footerWidth = measureFooterWidth(field, headerTypographyCtx);\n\n    const floor = Math.max(COLUMN.MIN_WIDTH, field.config.custom?.minWidth ?? 0);\n    const cap = Math.max(COLUMN.MAX_AUTO_WIDTH, floor);\n    const clamped = Math.min(Math.max(Math.max(cellWidth, headerWidth, footerWidth), floor), cap);\n    // The first column's extra padding is chrome, not content, so it's added after the cap rather\n    // than eating into the room the content was measured to need.\n    const extraPadding = noPanelPadding && i === 0 ? FIRST_COLUMN_EXTRA_PADDING : 0;\n\n    contentWidths.set(i, clamped + extraPadding);\n    contentTotal += clamped + extraPadding;\n\n    // Two ways a column can give width back rather than push the table into a horizontal scroll: a\n    // wrapped column reflows the content it gives up into extra row height, and under\n    // `preventHorizontalOverflow` the caller has said it would rather see content ellipsized than\n    // scroll, which puts every text-bearing column in play.\n    const canShrink =\n      !UNSHRINKABLE_CELL_TYPES.has(resolvedType) && (isReflowingCol(field, resolvedType) || preventHorizontalOverflow);\n    if (canShrink) {\n      // Anything the column asked for above its header, footer and configured minimum is width it\n      // gives up first. The header label and footer summary can neither reflow nor ellipsize without\n      // costing the column its identity, so they stay a hard bound however it was measured.\n      const shrinkFloor = Math.min(Math.max(headerWidth, footerWidth, floor), cap) + extraPadding;\n      if (shrinkFloor < clamped + extraPadding) {\n        shrinkFloors.set(i, shrinkFloor);\n      }\n    }\n  }\n\n  // Hand the overflow back to the columns that can absorb it — as height, or as an ellipsis — before\n  // letting the grid scroll sideways.\n  const deficit = definedWidth + contentTotal - availWidth;\n  const reclaimed =\n    deficit > SHRINK_EPS && shrinkFloors.size > 0 ? levelDownColWidths(contentWidths, shrinkFloors, deficit) : 0;\n  contentTotal -= reclaimed;\n\n  // Distribute leftover space by growthWeight × √(content width): a column with more content grows\n  // more, but the √ damps the spread so the widest column doesn't run away from its neighbours. If\n  // the columns still overflow after the level-down above, their widths are kept and the grid\n  // scrolls.\n  const growShare = (i: number) => growthWeight(fields[i].type) * Math.sqrt(contentWidths.get(i)!);\n  const growTotal = autoIdxs.reduce((sum, i) => sum + growShare(i), 0);\n\n  const leftover = availWidth - definedWidth - contentTotal;\n  const shouldGrow = leftover > 0 && growTotal > 0;\n  // A level-down that absorbed the whole deficit leaves the columns summing to availWidth exactly,\n  // so rounding up from there would put them straight back over it. One that ran into the floors\n  // still overflows, and takes the round-up path below like any other overflow.\n  const shrankToFit = reclaimed > 0 && leftover > -SHRINK_EPS;\n  // Round cumulatively so the rounded widths sum to the same total as the exact ones. Rounding each\n  // independently can push the total past availWidth and trigger a spurious horizontal scrollbar.\n  let exactSoFar = 0;\n  let roundedSoFar = 0;\n  for (const i of autoIdxs) {\n    const contentWidth = contentWidths.get(i)!;\n    if (!shouldGrow && !shrankToFit) {\n      // No leftover to distribute — the columns already fill or overflow availWidth, so the grid\n      // scrolls regardless and matching the total exactly no longer matters. Round up instead of\n      // cumulatively: a column sitting exactly at its measured content need (canvas measurement is\n      // fractional) has no slack to give up, and cumulative rounding can shave a column below that\n      // need and truncate its header for no benefit.\n      widths[i] = Math.ceil(contentWidth);\n      continue;\n    }\n    const target = shouldGrow ? contentWidth + leftover * (growShare(i) / growTotal) : contentWidth;\n    exactSoFar += target;\n    const rounded = Math.round(exactSoFar) - roundedSoFar;\n    roundedSoFar += rounded;\n    widths[i] = rounded;\n  }\n\n  return widths;\n}\n\ntype CellClass<TRow> = string | null | undefined | ((row: TRow) => string | null | undefined);\n\nconst appendCellClass = <TRow>(existing: CellClass<TRow>, edgeClass: string): CellClass<TRow> =>\n  typeof existing === 'function' ? (row: TRow) => clsx(existing(row), edgeClass) : clsx(existing, edgeClass);\n\nconst withEdgeClass = (column: TableColumn, edgeClass: string): TableColumn => ({\n  ...column,\n  headerCellClass: clsx(column.headerCellClass, edgeClass),\n  cellClass: appendCellClass(column.cellClass, edgeClass),\n  summaryCellClass: appendCellClass(column.summaryCellClass, edgeClass),\n});\n\n/**\n * @internal\n * Tags the edge columns with {@link FIRST_COLUMN_CLASS}/{@link LAST_COLUMN_CLASS}. Call this on the\n * finished column list, after any programmatically injected columns (the nested table's row\n * expander) are in place — a field's own index isn't enough to tell whether it ends up on an edge.\n */\nexport function markEdgeColumns(columns: TableColumn[]): TableColumn[] {\n  if (columns.length === 0) {\n    return columns;\n  }\n  const marked = [...columns];\n  marked[0] = withEdgeClass(marked[0], FIRST_COLUMN_CLASS);\n  const lastIdx = marked.length - 1;\n  marked[lastIdx] = withEdgeClass(marked[lastIdx], LAST_COLUMN_CLASS);\n  return marked;\n}\n\n/**\n * True when a cell keydown is Shift+Tab on the first cell of the first row — the point where focus\n * should jump back up into the header. `column`/`row` can be undefined for keydowns that aren't on a\n * data cell (e.g. header/summary rows), so both are guarded.\n */\nexport function isShiftTabToHeader(\n  column: { key: string } | undefined,\n  row: { __index: number } | undefined,\n  event: Pick<KeyboardEvent, 'shiftKey' | 'key'>,\n  firstColumnKey: string\n): boolean {\n  return column?.key === firstColumnKey && row?.__index === 0 && event.shiftKey && event.key === 'Tab';\n}\n\nexport function buildNestedColumnWidthsMap(fields: Field[], widths: number[]): ColumnWidths {\n  return new Map<string, ColumnWidth>(\n    fields.map((field, idx) => [getDisplayName(field), { type: 'resized', width: widths[idx] }])\n  );\n}\n\n/**\n * @internal\n * if applyToRow is true in any field, return a function that gets the row background color\n */\nexport function getApplyToRowBgFn(\n  fields: Field[],\n  getCellColorInlineStyles: ReturnType<typeof getCellColorInlineStylesFactory>\n): ((rowIndex: number) => CSSProperties) | void {\n  for (const field of fields) {\n    const cellOptions = getCellOptions(field);\n    const fieldDisplay = field.display;\n    if (\n      fieldDisplay !== undefined &&\n      cellOptions.type === TableCellDisplayMode.ColorBackground &&\n      cellOptions.applyToRow === true\n    ) {\n      return (rowIndex: number) => getCellColorInlineStyles(cellOptions, fieldDisplay(field.values[rowIndex]), true);\n    }\n  }\n}\n\n/** @internal */\nexport function canFieldBeColorized(\n  cellType: TableCellDisplayMode,\n  applyToRowBgFn?: (rowIndex: number) => CSSProperties\n) {\n  return (\n    cellType === TableCellDisplayMode.ColorBackground ||\n    cellType === TableCellDisplayMode.ColorText ||\n    Boolean(applyToRowBgFn)\n  );\n}\n\nexport const displayJsonValue: (field: Field) => DisplayProcessor = (field: Field, decimals?: DecimalCount) => {\n  const origDisplay = field.display!;\n  return (value: unknown): DisplayValue => {\n    const displayValue = origDisplay(value, decimals);\n\n    let jsonText: string;\n    if (!Array.isArray(value) && !isPlainObject(value)) {\n      const formattedValue = formattedValueToString(displayValue);\n      try {\n        const parsed = JSON.parse(formattedValue);\n        jsonText = JSON.stringify(parsed, null, ' ');\n      } catch {\n        jsonText = formattedValue; // Keep original if not valid JSON\n      }\n    } else {\n      try {\n        jsonText = JSON.stringify(value, null, ' ');\n      } catch {\n        // Frame references can be circular; retain the field formatter's representation.\n        jsonText = formattedValueToString(displayValue);\n      }\n    }\n\n    return { ...displayValue, text: jsonText };\n  };\n};\n\nexport function prepareSparklineValue(value: unknown, field: Field): FieldSparkline | undefined {\n  if (Array.isArray(value)) {\n    return {\n      y: {\n        name: `${field.name}-sparkline`,\n        type: FieldType.number,\n        values: value,\n        config: {},\n      },\n    };\n  }\n\n  if (isDataFrame(value)) {\n    const timeField = value.fields.find((x) => x.type === FieldType.time);\n    const numberField = value.fields.find((x) => x.type === FieldType.number);\n\n    if (timeField && numberField) {\n      return { x: timeField, y: numberField };\n    }\n  }\n\n  return;\n}\n\nfunction isPlainObject(value: unknown): value is object {\n  return typeof value === 'object' && value != null && !Array.isArray(value);\n}\n\nexport function buildInspectValue(\n  value: unknown,\n  field: Field,\n  formatGeometry?: OpenLayersContextValue['formatGeometry']\n): [string, TableCellInspectorMode] {\n  const cellOptions = getCellOptions(field);\n\n  let inspectValue: string;\n  let mode = TableCellInspectorMode.text;\n\n  if (field.type === FieldType.geo && isGeometry(value)) {\n    inspectValue = formatGeometry ? formatGeometry(value) : JSON.stringify(value, null, '  ');\n    mode = TableCellInspectorMode.code;\n  } else if (\n    cellOptions.type === TableCellDisplayMode.Sparkline ||\n    getAutoRendererDisplayMode(field) === TableCellDisplayMode.Sparkline\n  ) {\n    // rather than JSON.stringify this, manually format it to make the coordinate tuples more legible to the user.\n    const fieldSparkline = prepareSparklineValue(value, field);\n    inspectValue = '[';\n    if (fieldSparkline != null) {\n      // if an x value exists, render as a tuple [x,y], otherwise just y\n      const buildValString: (idx: number) => string =\n        fieldSparkline.x != null\n          ? (idx) => `[${fieldSparkline.x!.values[idx] ?? 'null'}, ${fieldSparkline.y.values[idx] ?? 'null'}]`\n          : (idx) => `${fieldSparkline.y.values[idx] ?? 'null'}`;\n      for (let i = 0; i < fieldSparkline.y.values.length; i++) {\n        inspectValue += `\\n  ${buildValString(i)}${i === fieldSparkline.y.values.length - 1 ? '\\n' : ','}`;\n      }\n    }\n    inspectValue += ']';\n    mode = TableCellInspectorMode.code;\n  } else if (cellOptions.type === TableCellDisplayMode.JSONView || Array.isArray(value) || isPlainObject(value)) {\n    let toStringify = value;\n    if (typeof value === 'string') {\n      try {\n        toStringify = JSON.parse(value);\n      } catch {\n        // do nothing, toStringify will stay as the raw string\n      }\n    }\n    inspectValue = JSON.stringify(toStringify, null, '  ');\n    mode = TableCellInspectorMode.code;\n  } else {\n    inspectValue = String(value ?? '');\n  }\n\n  return [inspectValue, mode];\n}\n\nexport function getSummaryCellTextAlign(textAlign: TextAlign, cellType: TableCellDisplayMode): TextAlign {\n  // gauge is weird. left-aligned gauge has the viz on the left and its numbers on the right, and vice-versa.\n  // if you center-aligned your gauge... ok.\n  if (cellType === TableCellDisplayMode.Gauge) {\n    return (\n      {\n        left: 'right',\n        right: 'left',\n        center: 'center',\n      } as const\n    )[textAlign];\n  }\n\n  return textAlign;\n}\n\n// we keep this set to avoid spamming the heck out of the console, since it's quite likely that if we fail to parse\n// a value once, it'll happen again and again for many rows in a table, and spamming the console is slow.\nlet warnedAboutStyleJsonSet = new Set<string>();\nexport function parseStyleJson(rawValue: unknown): CSSProperties | void {\n  // confirms existence of value and serves as a type guard\n  if (typeof rawValue === 'string') {\n    try {\n      const parsedJsonValue = JSON.parse(rawValue);\n      if (parsedJsonValue != null && typeof parsedJsonValue === 'object' && !Array.isArray(parsedJsonValue)) {\n        return parsedJsonValue;\n      }\n    } catch (e) {\n      if (!warnedAboutStyleJsonSet.has(rawValue)) {\n        console.error(`encountered invalid cell style JSON: ${rawValue}`, e);\n        warnedAboutStyleJsonSet.add(rawValue);\n      }\n    }\n  }\n}\n\nexport const getStableRowKey = (rowIndex: number, frame?: DataFrame): string => {\n  const key = frame?.meta?.custom?.stableRowKey;\n  return key != null ? String(key) : String(rowIndex);\n};\n\n/**\n * Builds a `rowClass` that stripes every other row of data.\n *\n * react-data-grid's `rdg-row-odd` counts nested container rows, making parent-row parity depend on\n * which rows have nested data. Count only depth-0 data rows to keep the stripe pattern stable.\n * Containers get a separate class so hover styles can exclude them.\n */\nexport function makeStripedRowClass(rows: TableRow[]): (row: TableRow) => string | undefined {\n  const striped = new WeakSet<TableRow>();\n  let ordinal = 0;\n  for (const row of rows) {\n    if (row.__depth !== 0) {\n      continue;\n    }\n    if (ordinal % 2 === 1) {\n      striped.add(row);\n    }\n    ordinal++;\n  }\n\n  return (row) => {\n    if (row.__depth !== 0) {\n      return NESTED_ROW_CLASS;\n    }\n    return striped.has(row) ? STRIPED_ROW_CLASS : undefined;\n  };\n}\n"],"names":["cached","compare","_a","width","_b"],"mappings":";;;;;;;;;;;;;;;;AAuEA,MAAM,QAAA,GAAW,SAAA;AAEjB,SAAS,eAAe,QAAA,EAA8B;AACpD,EAAA,IAAI,QAAA,KAAa,EAAA,IAAM,QAAA,IAAY,IAAA,EAAM;AACvC,IAAA,OAAO,EAAC;AAAA,EACV;AAEA,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,QAAQ,CAAA,EAAG;AAC3B,IAAA,OAAO,QAAA,CAAS,MAAA,CAAO,CAAC,CAAA,KAAM,KAAK,IAAI,CAAA,CAAE,GAAA,CAAI,CAAC,CAAA,KAAM,MAAA,CAAO,CAAC,CAAA,CAAE,MAAM,CAAA;AAAA,EACtE;AAEA,EAAA,MAAM,KAAA,GAAQ,OAAO,QAAQ,CAAA;AAE7B,EAAA,IAAI,KAAA,CAAM,CAAC,C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