```ts
export function stripNote(title: string): string {
  const opened = title.indexOf("(");
  if (opened === -1) {
    return title;
  }
  const closed = title.lastIndexOf(")");
  if (closed === -1 || closed <= opened) {
    throw new Error("Invalid note format");
  }
  return title.slice(0, closed + 1).trimEnd();
}
```