// SPEC: PJ2026-010401 Web工作台 draft-2026-06-17-r0.
// Responsibility: Stable DOM selectors for Workbench browser regression tests.

export const selectors = {
  workspace: "#workspace",
  sessionCreate: "#session-create",
  sessionDetailToggle: "#session-detail-toggle",
  sessionDetailDialog: "#session-detail-dialog",
  sessionDetailCopy: "#session-detail-copy",
  sessionCollapseToggle: "#session-collapse-toggle",
  sessionCopy: "#session-copy",
  sessionDelete: "#session-delete",
  sessionTabs: "#session-tabs",
  commandInput: "#command-input",
  commandSend: "#command-send",
  conversationList: "#conversation-list",
  messageCard: ".message-card",
  messageTimingMeta: ".message-timing-meta",
  messageDurationMeta: ".message-duration-meta",
  messageActivityMeta: ".message-activity-meta",
  traceTimeline: ".trace-timeline",
  traceRow: ".trace-render-row",
  messageDetailDialog: "#message-detail-dialog"
} as const;

export function sessionTab(sessionId: string): string {
  return `.session-tab[data-session-id="${cssEscape(sessionId)}"]`;
}

function cssEscape(value: string): string {
  return value.replace(/\\/gu, "\\\\").replace(/"/gu, "\\\"");
}
