# -*- coding: utf-8 -*-
import io, sys, os, ast
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")

idx = open("index_main.html", encoding="utf-8").read()

anchor = 'url:"details/gatech-human-computer-interaction-ms.html"},\n];'
assert anchor in idx, "PROGRAMS anchor not found"

new_progs = (
'{id:"gatech-nre-ms",s:"gatech",n:"核工程硕士（MS Nuclear Engineering）",en:"Master of Science in Nuclear Engineering",dept:"核与放射工程/医学物理系（NRE）",college:"Georgia Tech",disc:"eng",lvl:"m",deg:"MS",dur:"30 学分；Thesis/Non-Thesis 双选；含核企业管理方向",stem:1,rank:"",test:{cls:""},ddl:"catalog 页未列具体轮次（待补）",lang:"TOEFL iBT / IELTS Academic（最低分待补）",tui:"catalog 页未列打包学费（待补）",url:"details/gatech-nuclear-engineering-ms.html"},\n'
'{id:"gatech-enve-ms",s:"gatech",n:"环境工程硕士（MS Environmental Engineering）",en:"Master of Science in Environmental Engineering",dept:"土木与环境工程系（CEE）",college:"Georgia Tech",disc:"eng",lvl:"m",deg:"MS",dur:"30 学分；Thesis/Non-Thesis 双选；21/30cr 须 6000-level",stem:1,rank:"",test:{cls:""},ddl:"catalog 页未列具体轮次（待补）",lang:"TOEFL iBT / IELTS Academic（最低分待补）",tui:"catalog 页未列打包学费（待补）",url:"details/gatech-environmental-engineering-ms.html"},\n'
'{id:"gatech-chemistry-ms",s:"gatech",n:"化学硕士（MS Chemistry）",en:"Master of Science in Chemistry",dept:"化学与生物化学系",college:"Georgia Tech",disc:"sci",lvl:"m",deg:"MS",dur:"30 学分；Thesis/Non-Thesis 双选；多方向（Graduate Director 批准）",stem:1,rank:"",test:{cls:""},ddl:"catalog 页未列具体轮次（待补）",lang:"TOEFL iBT / IELTS Academic（最低分待补）",tui:"catalog 页未列打包学费（待补）",url:"details/gatech-chemistry-ms.html"},\n'
'{id:"gatech-mgmt-ms",s:"gatech",n:"管理学硕士（MS Management）",en:"Master of Science with a Major in Management",dept:"Scheller 商学院",college:"Georgia Tech",disc:"biz",lvl:"m",deg:"MS",dur:"30 学分；Management/Research 双轨；非 MBA",stem:0,rank:"",test:{cls:""},ddl:"catalog 页未列具体轮次（待补）",lang:"TOEFL iBT / IELTS Academic（最低分待补）",tui:"catalog 页未列打包学费（待补）",url:"details/gatech-management-ms.html"},\n'
'{id:"gatech-digital-media-ms",s:"gatech",n:"数字媒体硕士（MS Digital Media）",en:"Master of Science in Digital Media",dept:"文学媒体传播学院（LMC）跨学院",college:"Georgia Tech",disc:"art",lvl:"m",deg:"MS",dur:"36 学分；项目制；跨 LMC/CS/ID/Psych/Music",stem:0,rank:"",test:{cls:""},ddl:"catalog 页未列具体轮次（待补）",lang:"TOEFL iBT / IELTS Academic（最低分待补）",tui:"catalog 页未列打包学费（待补）",url:"details/gatech-digital-media-ms.html"},\n'
)

idx = idx.replace(anchor, 'url:"details/gatech-human-computer-interaction-ms.html"},\n' + new_progs + '];', 1)

# CATD 补录 5 条（全部无占位）
catd_start = idx.find("const CATD=")
vd_start = idx.find("const VERIFIED_DETAILS=")
catd_seg = idx[catd_start:vd_start]
catd_end = catd_seg.rfind("];")
abs_catd_end = catd_start + catd_end
catd_new = (
',["gatech", "核与放射工程/医学物理系", "Nuclear Engineering", "核工程", "MS", "https://catalog.gatech.edu/programs/nuclear-engineering-ms/", "eng", "details/gatech-nuclear-engineering-ms.html"]'
',["gatech", "土木与环境工程系", "Environmental Engineering", "环境工程", "MS", "https://catalog.gatech.edu/programs/environmental-engineering-ms/", "eng", "details/gatech-environmental-engineering-ms.html"]'
',["gatech", "化学与生物化学系", "Chemistry", "化学", "MS", "https://catalog.gatech.edu/programs/chemistry-ms/", "sci", "details/gatech-chemistry-ms.html"]'
',["gatech", "Scheller 商学院", "Management", "管理学", "MS", "https://catalog.gatech.edu/programs/management-ms/", "biz", "details/gatech-management-ms.html"]'
',["gatech", "文学媒体传播学院", "Digital Media", "数字媒体", "MS", "https://catalog.gatech.edu/programs/digital-media-ms/", "art", "details/gatech-digital-media-ms.html"]'
)
idx = idx[:abs_catd_end] + catd_new + idx[abs_catd_end:]

# VD 追加 5 条
vd_start2 = idx.find("const VERIFIED_DETAILS=new Set([")
vd_end = idx.find("]);", vd_start2)
vd_new = (
',"details/gatech-nuclear-engineering-ms.html"'
',"details/gatech-environmental-engineering-ms.html"'
',"details/gatech-chemistry-ms.html"'
',"details/gatech-management-ms.html"'
',"details/gatech-digital-media-ms.html"'
)
idx = idx[:vd_end] + vd_new + idx[vd_end:]

open("index_main.html", "w", encoding="utf-8").write(idx)
print("DONE size:", len(idx))
ast.parse(open(__file__, encoding="utf-8").read())
print("syntax OK")
