with open('/app/working/workspaces/default/build_merged.js', 'r') as f:
    content = f.read()

# Fix 1: Replace "Talk to our friendly team" with escaped quotes
# In the file it appears as: / "Talk to our friendly team"
content = content.replace(
    '/ "Talk to our friendly team""',
    '/ \\"Talk to our friendly team\\""'
)

# Fix 2: Add missing headers and rows to the makeTableFull call after 'Ad Copy Themes'
ad = content.find('Ad Copy Themes')
idx = content.find('makeTableFull(', ad)

# Find the exact pattern to replace
# The current content from makeTableFull( through the first few rows
old_start = content.find('makeTableFull(\n                        ["Harga Transparan"', ad)
if old_start >= 0:
    # Build the replacement
    replacement = """makeTableFull(
                    ["Theme", "Contoh Copy", "Digunakan Oleh"],
                    [
                        ["Trust / Legitimasi", "\\"Licensed agency since 2006\\" / \\"12+ years experience\\" / \\"Trusted by 30.000+ clients\\"", "eVisa Bali, VISALF, Bali Visa Agency"],
                        ["Kecepatan", "\\"Visa approved in 5 days\\" / \\"Fast processing\\" / \\"Express service\\"", "Flado, Bali Visa Agency, Rumaka"],
                        ["Harga Transparan", "\\"No hidden fees\\" / \\"IDR 2.150.000 all-in\\" / \\"Pay after approval\\"", "Flado, Bali Visa Agency, Bahalap Uras"],
                        ["Simplicity", "\\"Easy online application\\" / \\"3 simple steps\\" / \\"Just send your passport\\"", "Rumaka, eVisa Bali, Flado"],
                        ["Multi-Language", "\\"We speak your language\\" / Russian-French-English team", "Bahalap Uras, Peak Solutions, Flado"],
                        ["Human Touch", "\\"Real people, not robots\\" / \\"Talk to our friendly team\\"", "Bali Visa Agency, Bahalap Uras"],
                        ["Community", "Telegram groups, customer WhatsApp communities", "Flado"],"""
    
    old_text = """makeTableFull(
                        ["Harga Transparan", "\\"No hidden fees\\" / \\"IDR 2.150.000 all-in\\" / \\"Pay after approval\\"", "Flado, Bali Visa Agency, Bahalap Uras"],
                        ["Simplicity", "\\"Easy online application\\" / \\"3 simple steps\\" / \\"Just send your passport\\"", "Rumaka, eVisa Bali, Flado"],
                        ["Multi-Language", "\\"We speak your language\\" / Russian-French-English team", "Bahalap Uras, Peak Solutions, Flado"],
                        ["Human Touch", "\\"Real people, not robots\\" / \\"Talk to our friendly team\\"", "Bali Visa Agency, Bahalap Uras"],
                        ["Community", "Telegram groups, customer WhatsApp communities", "Flado"],"""
    
    if old_text in content:
        content = content.replace(old_text, replacement)
        print("Fixed makeTableFull headers")
    else:
        print("Could not find exact pattern for makeTableFull fix")

with open('/app/working/workspaces/default/build_merged.js', 'w') as f:
    f.write(content)
print("Done")
