import sys
import re

with open(r'C:\Users\Nikita Rajput\.gemini\antigravity-ide\brain\28413561-d1e4-432f-92a9-82b86e63153c\.system_generated\steps\42\content.md', 'r', encoding='utf-8') as f:
    shared_hosting_md = f.read()

# Find the row containing the plans in the shared hosting HTML
match = re.search(r'<div class="row">\s*<!-- col -->\s*<div class="col-xl-3(.*?)</div>\s*</div>\s*</div>\s*<!-- se-footer -->', shared_hosting_md, re.DOTALL)
if match:
    plans_html = '<div class="row mx-xl-0">\n          <!-- col -->\n          <div class="col-xl-3' + match.group(1) + '</div>\n          </div>'
    
    # replace data-src with src
    plans_html = plans_html.replace('data-src="', 'src="')
    # fix the paths to match final-page.html
    plans_html = plans_html.replace('src="/assets/', 'src="assets/')
    
    # Now read final-page.html
    with open(r'd:\DN\final_page_project\final-page.html', 'r', encoding='utf-8') as f:
        final_page_html = f.read()
        
    # Replace the existing row mx-xl-0
    new_final_page = re.sub(r'<div class="row mx-xl-0">.*?</div>\s*</div>\s*<!-- se-footer -->', plans_html + '\n        </div>\n        <!-- se-footer -->', final_page_html, flags=re.DOTALL)
    
    with open(r'd:\DN\final_page_project\final-page.html', 'w', encoding='utf-8') as f:
        f.write(new_final_page)
    print('Successfully replaced plans.')
else:
    print('Could not extract plans from shared hosting md.')
