graph TD
A[Start Chat UI Builder] --> B[Input Processing]
B --> C[Load Brand Guidelines]
B --> D[Load Layout Requirements]
B --> E[Load Interaction Flow]
B --> F[Load Styling Preferences]
C --> G[Generate HTML Structure]
D --> G
E --> H[Generate JavaScript Logic]
F --> I[Generate CSS Styling]
C --> I
G --> J[Combine Components]
H --> J
I --> J
J --> K[Validate Code]
K --> L{Valid?}
L -->|No| M[Error Handling]
M --> B
L -->|Yes| N[Output chat-ui-code]
N --> O[End Chat UI Builder]