import type { Token } from '../core/types';

export const DEFAULT_TOO_LONG_THRESHOLDS = Object.freeze({ EN: 30, TC: 60 });

export function isTooLong(tokens: Token[], lang: 'TC' | 'EN', thresholds: { EN: number; TC: number }): boolean {
  const n = Math.max(0, tokens.length | 0);
  const limit = lang === 'EN' ? thresholds.EN : thresholds.TC;
  return n > limit;
}

export function isLineStartPunctTC(tokens: Token[], pos: number, tcPunctuations: string[]): boolean {
  const p = pos | 0;
  if (p <= 0) return false; // 第一行不受 H6 影响
  const t = tokens[p]?.text ?? '';
  return tcPunctuations.includes(t);
}

export function isOverWidth(width: number, availableWidth: number): boolean {
  return width > availableWidth;
}

