export interface Code {
html: string
css: string
js: string
}
export const emptyCode = (): Code => ({ html: "", css: "", js: "" })
export const sameCode = (a: Code, b: Code) =>
a.html === b.html && a.css === b.css && a.js === b.js
export const isEmptyCode = (c: Code) => !c.html.trim() && !c.css.trim() && !c.js.trim()
// 把一整页 HTML(外部 AI 常给的格式)拆成 html / css / js 三段
export function splitHtml(raw: string): Code {
const cssBlocks: string[] = []
const jsBlocks: string[] = []
let result = raw.replace(/