import glob
import re

old_icon = r'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="[^"]*"/><rect[^>]*/><rect[^>]*/><rect[^>]*/></svg>'
new_icon = '<script src="https://unpkg.com/@lottiefiles/dotlottie-wc@0.9.4/dist/dotlottie-wc.js" type="module"></script>\n        <dotlottie-wc src="https://lottie.host/7b2916b3-0215-48d7-9027-9b00d77f098b/QkgT0kRT6F.json" style="width: 50px; height: 50px;" autoplay loop></dotlottie-wc>'

for filepath in glob.glob('*.html'):
    with open(filepath, 'r', encoding='utf-8') as f:
        content = f.read()

    # Replace the SVG with the Lottie animation
    content = re.sub(old_icon, new_icon, content)

    with open(filepath, 'w', encoding='utf-8') as f:
        f.write(content)

print("Restored Lottie icon in all files")
