#!/usr/bin/env python3 """ Script to extract components from the monolithic studio.py file. This script analyzes studio.py and extracts sections into separate component files. """ import re from pathlib import Path def read_file_lines(filepath: str, start: int, end: int) -> str: """Read specific lines from a file.""" with open(filepath, 'r', encoding='utf-8') as f: lines = f.readlines() return ''.join(lines[start-1:end]) def find_section_boundaries(filepath: str): """Find all section boundaries in the file.""" with open(filepath, 'r', encoding='utf-8') as f: lines = f.readlines() css_sections = [] html_sections = [] js_sections = [] for i, line in enumerate(lines, 1): # Find CSS section markers if '/* ==========================================' in line: if i + 1 < len(lines): title = lines[i].strip() css_sections.append((i, title)) # Find JS section markers if '// ==========================================' in line: if i + 1 < len(lines): title = lines[i].strip() js_sections.append((i, title)) # Find HTML sections (major modal divs) if '