amwolf36 commited on
Commit
cc09c8a
·
verified ·
1 Parent(s): 1e9e7db

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +1526 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Alex
3
- emoji: 🔥
4
- colorFrom: pink
5
- colorTo: purple
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: alex
3
+ emoji: 🐳
4
+ colorFrom: red
5
+ colorTo: gray
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,1526 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AI Ebook Generator - Pro (Fixed)</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ .gradient-bg {
11
+ background: linear-gradient(135deg, #6b73ff 0%, #000dff 100%);
12
+ }
13
+ .ebook-preview {
14
+ min-height: 500px;
15
+ background: linear-gradient(to bottom, #f8fafc, #e2e8f0);
16
+ }
17
+ .chapter-item:hover {
18
+ transform: translateX(5px);
19
+ transition: transform 0.2s ease;
20
+ }
21
+ .loading-dots:after {
22
+ content: '.';
23
+ animation: dots 1.5s steps(5, end) infinite;
24
+ }
25
+ @keyframes dots {
26
+ 0%, 20% { content: '.'; }
27
+ 40% { content: '..'; }
28
+ 60% { content: '...'; }
29
+ 80%, 100% { content: ''; }
30
+ }
31
+ .tab-content {
32
+ display: none;
33
+ }
34
+ .tab-content.active {
35
+ display: block;
36
+ animation: fadeIn 0.3s ease;
37
+ }
38
+ @keyframes fadeIn {
39
+ from { opacity: 0; }
40
+ to { opacity: 1; }
41
+ }
42
+ .plan-card {
43
+ transition: all 0.3s ease;
44
+ }
45
+ .plan-card:hover {
46
+ transform: translateY(-5px);
47
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
48
+ }
49
+ .premium-badge {
50
+ position: absolute;
51
+ top: -10px;
52
+ right: -10px;
53
+ background: linear-gradient(45deg, #ff9500, #ff5e00);
54
+ color: white;
55
+ padding: 3px 10px;
56
+ border-radius: 20px;
57
+ font-size: 12px;
58
+ font-weight: bold;
59
+ box-shadow: 0 2px 5px rgba(0,0,0,0.2);
60
+ }
61
+ .api-status {
62
+ width: 10px;
63
+ height: 10px;
64
+ border-radius: 50%;
65
+ display: inline-block;
66
+ margin-right: 5px;
67
+ }
68
+ .api-status.connected {
69
+ background-color: #10B981;
70
+ animation: pulse 1.5s infinite;
71
+ }
72
+ @keyframes pulse {
73
+ 0% { transform: scale(1); }
74
+ 50% { transform: scale(1.2); }
75
+ 100% { transform: scale(1); }
76
+ }
77
+ .api-status.disconnected {
78
+ background-color: #EF4444;
79
+ }
80
+ .toggle-checkbox:checked {
81
+ right: 0;
82
+ border-color: #3B82F6;
83
+ }
84
+ .toggle-checkbox:checked + .toggle-label {
85
+ background-color: #3B82F6;
86
+ }
87
+ .cover-preview {
88
+ width: 150px;
89
+ height: 200px;
90
+ background-size: cover;
91
+ background-position: center;
92
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
93
+ transition: all 0.3s ease;
94
+ }
95
+ .cover-preview:hover {
96
+ transform: scale(1.05);
97
+ }
98
+ .color-option {
99
+ width: 25px;
100
+ height: 25px;
101
+ cursor: pointer;
102
+ border: 2px solid transparent;
103
+ transition: all 0.2s ease;
104
+ }
105
+ .color-option:hover {
106
+ transform: scale(1.1);
107
+ }
108
+ .color-option.selected {
109
+ border-color: #000;
110
+ }
111
+ .format-option {
112
+ border: 2px solid #e5e7eb;
113
+ cursor: pointer;
114
+ transition: all 0.3s;
115
+ }
116
+ .format-option:hover {
117
+ border-color: #3B82F6;
118
+ }
119
+ .format-option.active {
120
+ border-color: #3B82F6;
121
+ background-color: #eff6ff;
122
+ }
123
+ .tab-button {
124
+ position: relative;
125
+ padding-bottom: 5px;
126
+ }
127
+ .tab-button.active:after {
128
+ content: '';
129
+ position: absolute;
130
+ bottom: 0;
131
+ left: 0;
132
+ width: 100%;
133
+ height: 3px;
134
+ background-color: #3B82F6;
135
+ border-radius: 3px;
136
+ }
137
+ </style>
138
+ </head>
139
+ <body class="bg-gray-50">
140
+ <div class="min-h-screen">
141
+ <!-- Header -->
142
+ <header class="gradient-bg text-white shadow-lg">
143
+ <div class="container mx-auto px-4 py-6">
144
+ <div class="flex justify-between items-center">
145
+ <div class="flex items-center space-x-2">
146
+ <i class="fas fa-book-open text-2xl"></i>
147
+ <h1 class="text-2xl font-bold">AI Ebook Generator Pro</h1>
148
+ </div>
149
+ <nav>
150
+ <ul class="flex space-x-6">
151
+ <li>
152
+ <a href="#" class="tab-button hover:underline active" onclick="showTab('generator')">Generator</a>
153
+ </li>
154
+ <li>
155
+ <a href="#" class="tab-button hover:underline" onclick="showTab('format-settings')">Format & Design</a>
156
+ </li>
157
+ <li>
158
+ <a href="#" class="tab-button hover:underline" onclick="showTab('publish-settings')">Publishing</a>
159
+ </li>
160
+ <li>
161
+ <a href="#" class="tab-button hover:underline" onclick="showTab('api-settings')">API Settings</a>
162
+ </li>
163
+ <li>
164
+ <a href="#" class="tab-button hover:underline" onclick="showTab('my-ebooks')">My Ebooks</a>
165
+ </li>
166
+ </ul>
167
+ </nav>
168
+ </div>
169
+ </div>
170
+ </header>
171
+
172
+ <!-- Main Content -->
173
+ <main class="container mx-auto px-4 py-8">
174
+ <!-- Generator Tab -->
175
+ <div id="generator-tab" class="tab-content active">
176
+ <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
177
+ <!-- Generator Form -->
178
+ <div class="lg:col-span-1 bg-white rounded-xl shadow-md p-6 h-fit sticky top-8">
179
+ <h2 class="text-xl font-semibold mb-4 text-gray-800">Create Your Ebook</h2>
180
+
181
+ <form id="ebookForm" class="space-y-4">
182
+ <div>
183
+ <label for="ebookTitle" class="block text-sm font-medium text-gray-700 mb-1">Ebook Title*</label>
184
+ <input type="text" id="ebookTitle" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Enter ebook title" required>
185
+ </div>
186
+
187
+ <div>
188
+ <label for="ebookSubtitle" class="block text-sm font-medium text-gray-700 mb-1">Subtitle</label>
189
+ <input type="text" id="ebookSubtitle" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Enter subtitle">
190
+ </div>
191
+
192
+ <div>
193
+ <label for="authorName" class="block text-sm font-medium text-gray-700 mb-1">Author Name*</label>
194
+ <input type="text" id="authorName" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Your name or pen name" required>
195
+ </div>
196
+
197
+ <div>
198
+ <label for="ebookTopic" class="block text-sm font-medium text-gray-700 mb-1">Main Topic*</label>
199
+ <input type="text" id="ebookTopic" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="e.g. Digital Marketing" required>
200
+ </div>
201
+
202
+ <div>
203
+ <label for="ebookKeywords" class="block text-sm font-medium text-gray-700 mb-1">Keywords (comma separated)</label>
204
+ <textarea id="ebookKeywords" rows="3" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="SEO, content marketing, social media"></textarea>
205
+ </div>
206
+
207
+ <div>
208
+ <label for="ebookSummary" class="block text-sm font-medium text-gray-700 mb-1">Brief Summary*</label>
209
+ <textarea id="ebookSummary" rows="4" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Describe what your ebook should cover" required></textarea>
210
+ </div>
211
+
212
+ <div>
213
+ <label for="chapterCount" class="block text-sm font-medium text-gray-700 mb-1">Number of Chapters</label>
214
+ <select id="chapterCount" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
215
+ <option value="5">5 Chapters</option>
216
+ <option value="7" selected>7 Chapters</option>
217
+ <option value="10">10 Chapters</option>
218
+ <option value="12">12 Chapters</option>
219
+ </select>
220
+ </div>
221
+
222
+ <div>
223
+ <label for="writingStyle" class="block text-sm font-medium text-gray-700 mb-1">Writing Style</label>
224
+ <select id="writingStyle" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
225
+ <option value="professional">Professional</option>
226
+ <option value="casual">Casual</option>
227
+ <option value="academic">Academic</option>
228
+ <option value="storytelling">Storytelling</option>
229
+ </select>
230
+ </div>
231
+
232
+ <div class="pt-2">
233
+ <button type="submit" id="generateBtn" class="w-full gradient-bg text-white py-3 px-6 rounded-lg font-medium hover:opacity-90 transition duration-300 flex items-center justify-center">
234
+ <i class="fas fa-magic mr-2"></i> Continue to Format Settings
235
+ </button>
236
+ </div>
237
+ </form>
238
+ </div>
239
+
240
+ <!-- Ebook Preview -->
241
+ <div class="lg:col-span-2">
242
+ <div class="bg-white rounded-xl shadow-md overflow-hidden">
243
+ <div class="p-6 border-b border-gray-200">
244
+ <h2 class="text-xl font-semibold text-gray-800">Ebook Preview</h2>
245
+ <p class="text-sm text-gray-500">Configure your ebook settings to see a preview</p>
246
+ </div>
247
+
248
+ <div id="ebookPreview" class="ebook-preview p-8">
249
+ <div id="emptyState" class="flex flex-col items-center justify-center h-full text-center py-20">
250
+ <i class="fas fa-book-reader text-6xl text-gray-300 mb-4"></i>
251
+ <h3 class="text-xl font-medium text-gray-500 mb-2">No Ebook Generated Yet</h3>
252
+ <p class="text-gray-400 max-w-md">Fill out the form and click "Continue" to configure your ebook settings.</p>
253
+ </div>
254
+
255
+ <div id="loadingState" class="hidden flex flex-col items-center justify-center h-full text-center py-20">
256
+ <div class="animate-spin rounded-full h-16 w-16 border-t-2 border-b-2 border-blue-500 mb-4"></div>
257
+ <h3 class="text-xl font-medium text-gray-700 mb-2">Generating Your Ebook</h3>
258
+ <p class="text-gray-500 max-w-md">This may take a few moments...</p>
259
+ </div>
260
+
261
+ <div id="ebookContent" class="hidden">
262
+ <div class="flex justify-between items-start mb-6">
263
+ <div>
264
+ <h1 id="previewTitle" class="text-3xl font-bold text-gray-800">Your Ebook Title</h1>
265
+ <h2 id="previewSubtitle" class="text-xl text-gray-600 mt-1">Your Ebook Subtitle</h2>
266
+ <p class="text-gray-500 text-sm mt-2">by <span id="previewAuthor">Author Name</span></p>
267
+ </div>
268
+ <p id="generatedTime" class="text-gray-400 text-xs">Generated just now</p>
269
+ </div>
270
+
271
+ <div class="border-t border-b border-gray-200 py-4 my-4">
272
+ <h3 class="font-semibold text-gray-700 mb-2">Table of Contents</h3>
273
+ <div id="tocList" class="space-y-2"></div>
274
+ </div>
275
+
276
+ <div id="chaptersContainer"></div>
277
+ </div>
278
+ </div>
279
+ </div>
280
+ </div>
281
+ </div>
282
+ </div>
283
+
284
+ <!-- Format & Design Tab -->
285
+ <div id="format-settings-tab" class="tab-content">
286
+ <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
287
+ <!-- Format Settings Form -->
288
+ <div class="lg:col-span-1 bg-white rounded-xl shadow-md p-6 h-fit sticky top-8">
289
+ <h2 class="text-xl font-semibold mb-4 text-gray-800">Format & Design Settings</h2>
290
+
291
+ <div class="space-y-6">
292
+ <!-- Format Selection -->
293
+ <div>
294
+ <h3 class="text-md font-medium text-gray-700 mb-3">Ebook Format</h3>
295
+ <div class="grid grid-cols-3 gap-2 mb-4">
296
+ <div class="format-option active p-2 rounded-lg text-center" data-format="6x9" onclick="selectFormat('6x9', this)">
297
+ <p class="text-sm font-medium">6" × 9"</p>
298
+ <p class="text-xs text-gray-500">Standard</p>
299
+ </div>
300
+ <div class="format-option p-2 rounded-lg text-center" data-format="5x8" onclick="selectFormat('5x8', this)">
301
+ <p class="text-sm font-medium">5" × 8"</p>
302
+ <p class="text-xs text-gray-500">Novel</p>
303
+ </div>
304
+ <div class="format-option p-2 rounded-lg text-center" data-format="a5" onclick="selectFormat('a5', this)">
305
+ <p class="text-sm font-medium">A5</p>
306
+ <p class="text-xs text-gray-500">International</p>
307
+ </div>
308
+ </div>
309
+ <select id="pageSize" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
310
+ <option value="6x9">6 × 9 inches (Standard)</option>
311
+ <option value="5x8">5 × 8 inches (Novel)</option>
312
+ <option value="a5">A5 (148 × 210 mm)</option>
313
+ <option value="a4">A4 (210 × 297 mm)</option>
314
+ <option value="custom">Custom Size</option>
315
+ </select>
316
+ </div>
317
+
318
+ <!-- File Formats -->
319
+ <div>
320
+ <h3 class="text-md font-medium text-gray-700 mb-3">Output Formats</h3>
321
+ <div class="space-y-2">
322
+ <div class="flex items-center">
323
+ <input type="checkbox" id="formatPDF" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
324
+ <label for="formatPDF" class="text-sm text-gray-700">PDF (Print & Digital)</label>
325
+ </div>
326
+ <div class="flex items-center">
327
+ <input type="checkbox" id="formatEPUB" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
328
+ <label for="formatEPUB" class="text-sm text-gray-700">EPUB (Amazon, Apple)</label>
329
+ </div>
330
+ <div class="flex items-center">
331
+ <input type="checkbox" id="formatMOBI" class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
332
+ <label for="formatMOBI" class="text-sm text-gray-700">MOBI (Legacy Kindle)</label>
333
+ </div>
334
+ </div>
335
+ </div>
336
+
337
+ <!-- Template Selection -->
338
+ <div>
339
+ <h3 class="text-md font-medium text-gray-700 mb-3">Design Template</h3>
340
+ <select id="designTemplate" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
341
+ <option value="modern">Modern Professional</option>
342
+ <option value="minimal">Minimalist</option>
343
+ <option value="creative">Creative Design</option>
344
+ <option value="academic">Academic</option>
345
+ </select>
346
+ </div>
347
+
348
+ <!-- Font Settings -->
349
+ <div>
350
+ <h3 class="text-md font-medium text-gray-700 mb-3">Typography</h3>
351
+ <div class="grid grid-cols-2 gap-4">
352
+ <div>
353
+ <label class="block text-sm text-gray-600 mb-1">Body Font</label>
354
+ <select id="bodyFont" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
355
+ <option value="serif">Serif (Traditional)</option>
356
+ <option value="sans-serif" selected>Sans-serif (Modern)</option>
357
+ <option value="monospace">Monospace (Technical)</option>
358
+ </select>
359
+ </div>
360
+ <div>
361
+ <label class="block text-sm text-gray-600 mb-1">Font Size</label>
362
+ <select id="fontSize" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
363
+ <option value="11">11 pt</option>
364
+ <option value="12" selected>12 pt</option>
365
+ <option value="13">13 pt</option>
366
+ <option value="14">14 pt</option>
367
+ </select>
368
+ </div>
369
+ </div>
370
+ </div>
371
+
372
+ <!-- Color Scheme -->
373
+ <div>
374
+ <h3 class="text-md font-medium text-gray-700 mb-3">Color Scheme</h3>
375
+ <div class="flex space-x-2 mb-4">
376
+ <div class="color-option selected bg-blue-600 rounded-full" data-color="blue" onclick="selectColor('blue', this)"></div>
377
+ <div class="color-option bg-green-600 rounded-full" data-color="green" onclick="selectColor('green', this)"></div>
378
+ <div class="color-option bg-red-600 rounded-full" data-color="red" onclick="selectColor('red', this)"></div>
379
+ <div class="color-option bg-purple-600 rounded-full" data-color="purple" onclick="selectColor('purple', this)"></div>
380
+ <div class="color-option bg-indigo-600 rounded-full" data-color="indigo" onclick="selectColor('indigo', this)"></div>
381
+ <div class="color-option bg-yellow-500 rounded-full" data-color="yellow" onclick="selectColor('yellow', this)"></div>
382
+ </div>
383
+ </div>
384
+
385
+ <!-- Cover Design -->
386
+ <div>
387
+ <h3 class="text-md font-medium text-gray-700 mb-3">Cover Design</h3>
388
+ <div class="space-y-3">
389
+ <div class="flex items-center justify-between">
390
+ <label class="block text-sm text-gray-600">Auto-generate Cover</label>
391
+ <div class="relative inline-block w-10 mr-2 align-middle select-none">
392
+ <input type="checkbox" id="autoCover" checked class="toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 appearance-none cursor-pointer"/>
393
+ <label for="autoCover" class="toggle-label block overflow-hidden h-6 rounded-full bg-gray-300 cursor-pointer"></label>
394
+ </div>
395
+ </div>
396
+ <div id="coverOptions" class="space-y-3">
397
+ <div>
398
+ <label class="block text-sm text-gray-600 mb-1">Cover Style</label>
399
+ <select id="coverStyle" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
400
+ <option value="modern">Modern</option>
401
+ <option value="minimal">Minimal</option>
402
+ <option value="professional">Professional</option>
403
+ <option value="vintage">Vintage</option>
404
+ </select>
405
+ </div>
406
+ <div class="flex space-x-2">
407
+ <button onclick="randomizeCover()" class="flex-1 bg-gray-100 hover:bg-gray-200 text-gray-700 py-1 px-3 rounded-lg text-sm transition duration-300">
408
+ <i class="fas fa-random mr-1"></i> Randomize
409
+ </button>
410
+ <button onclick="uploadCover()" class="flex-1 bg-gray-100 hover:bg-gray-200 text-gray-700 py-1 px-3 rounded-lg text-sm transition duration-300">
411
+ <i class="fas fa-upload mr-1"></i> Upload
412
+ </button>
413
+ </div>
414
+ </div>
415
+ </div>
416
+ </div>
417
+
418
+ <!-- Buttons -->
419
+ <div class="pt-4 space-y-3">
420
+ <button onclick="previewEbook()" class="w-full bg-blue-100 hover:bg-blue-200 text-blue-800 py-2 px-4 rounded-lg font-medium transition duration-300">
421
+ <i class="fas fa-eye mr-2"></i> Preview Changes
422
+ </button>
423
+ <button onclick="showTab('publish-settings')" class="w-full gradient-bg text-white py-3 px-6 rounded-lg font-medium hover:opacity-90 transition duration-300">
424
+ Continue to Publishing Settings
425
+ </button>
426
+ <button onclick="showTab('generator')" class="w-full bg-gray-100 hover:bg-gray-200 text-gray-700 py-2 px-4 rounded-lg transition duration-300">
427
+ <i class="fas fa-arrow-left mr-2"></i> Back
428
+ </button>
429
+ </div>
430
+ </div>
431
+ </div>
432
+
433
+ <!-- Cover Preview -->
434
+ <div class="lg:col-span-1">
435
+ <div class="bg-white rounded-xl shadow-md p-6 h-fit sticky top-8">
436
+ <h2 class="text-xl font-semibold mb-4 text-gray-800">Cover Preview</h2>
437
+ <div class="space-y-4">
438
+ <div id="coverPreview" class="cover-preview mx-auto bg-gradient-to-br from-blue-500 to-indigo-600 flex items-center justify-center">
439
+ <div class="text-center p-4">
440
+ <h3 id="coverTitle" class="text-xl font-bold text-white mb-1">Your Ebook Title</h3>
441
+ <p id="coverAuthor" class="text-sm text-blue-100">by Author Name</p>
442
+ </div>
443
+ </div>
444
+ <div class="text-center">
445
+ <p class="text-sm text-gray-500">This is a preview of your generated cover</p>
446
+ </div>
447
+ <div class="mt-4 p-4 bg-gray-50 rounded-lg border border-gray-200">
448
+ <h3 class="text-sm font-medium text-gray-700 mb-2">Cover Settings</h3>
449
+ <p class="text-xs text-gray-500"><span id="coverFormatDisplay">6 × 9 inches</span> • <span id="coverStyleDisplay">Modern</span></p>
450
+ </div>
451
+ </div>
452
+ </div>
453
+ </div>
454
+
455
+ <!-- Content Preview -->
456
+ <div class="lg:col-span-1">
457
+ <div class="bg-white rounded-xl shadow-md p-6 h-full">
458
+ <h2 class="text-xl font-semibold mb-4 text-gray-800">Interior Preview</h2>
459
+ <div id="interiorPreview" class="border border-gray-200 p-6 rounded-lg" style="min-height: 400px;">
460
+ <h3 class="text-lg font-medium text-gray-800 mb-2">Chapter 1</h3>
461
+ <p class="text-sm text-gray-700 leading-relaxed">This is a preview of how your ebook content will appear with the selected template and formatting options. The actual content will be generated based on your inputs.</p>
462
+ <p class="text-sm text-gray-700 leading-relaxed mt-3">You can adjust the font, size, colors, and layout to match your preferences. Changes will be reflected in this preview as you make them.</p>
463
+ </div>
464
+ </div>
465
+ </div>
466
+ </div>
467
+ </div>
468
+
469
+ <!-- Publishing Settings Tab -->
470
+ <div id="publish-settings-tab" class="tab-content">
471
+ <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
472
+ <!-- Publishing Form -->
473
+ <div class="lg:col-span-1 bg-white rounded-xl shadow-md p-6 h-fit sticky top-8">
474
+ <h2 class="text-xl font-semibold mb-4 text-gray-800">Publishing Settings</h2>
475
+
476
+ <div class="space-y-6">
477
+ <!-- ISBN Settings -->
478
+ <div>
479
+ <h3 class="text-md font-medium text-gray-700 mb-3">ISBN</h3>
480
+ <div class="space-y-2 mb-3">
481
+ <div class="flex items-center">
482
+ <input type="radio" id="isbnAuto" name="isbnOption" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500">
483
+ <label for="isbnAuto" class="text-sm text-gray-700">Auto-generate free ISBN</label>
484
+ </div>
485
+ <div class="flex items-center">
486
+ <input type="radio" id="isbnProvide" name="isbnOption" class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500">
487
+ <label for="isbnProvide" class="text-sm text-gray-700">Provide my own ISBN</label>
488
+ </div>
489
+ </div>
490
+ <input id="isbnInput" type="text" disabled class="w-full px-4 py-2 border border-gray-300 rounded-lg bg-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Enter ISBN">
491
+ </div>
492
+
493
+ <!-- Publishing Categories -->
494
+ <div>
495
+ <h3 class="text-md font-medium text-gray-700 mb-3">Categories</h3>
496
+ <div class="grid grid-cols-2 gap-4">
497
+ <div>
498
+ <label class="block text-sm text-gray-600 mb-1">Primary Category</label>
499
+ <select id="primaryCategory" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
500
+ <option value="business">Business & Money</option>
501
+ <option value="tech">Computers & Technology</option>
502
+ <option value="health">Health, Fitness & Dieting</option>
503
+ <option value="self-help">Self-Help</option>
504
+ <option value="education">Education</option>
505
+ </select>
506
+ </div>
507
+ <div>
508
+ <label class="block text-sm text-gray-600 mb-1">Secondary Category</label>
509
+ <select id="secondaryCategory" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
510
+ <option value="">None</option>
511
+ <option value="business">Business & Money</option>
512
+ <option value="tech">Computers & Technology</option>
513
+ </select>
514
+ </div>
515
+ </div>
516
+ </div>
517
+
518
+ <!-- Keywords -->
519
+ <div>
520
+ <h3 class="text-md font-medium text-gray-700 mb-3">Search Keywords</h3>
521
+ <div class="mb-2">
522
+ <p class="text-xs text-gray-500 mb-1">Enter up to 7 keywords (comma separated)</p>
523
+ <textarea id="searchKeywords" rows="2" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="ebook, digital marketing, seo"></textarea>
524
+ </div>
525
+ </div>
526
+
527
+ <!-- Pricing -->
528
+ <div>
529
+ <h3 class="text-md font-medium text-gray-700 mb-3">Pricing</h3>
530
+ <div class="grid grid-cols-2 gap-4">
531
+ <div>
532
+ <label class="block text-sm text-gray-600 mb-1">Print Price ($)</label>
533
+ <input type="number" id="printPrice" min="0" step="0.01" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="9.99">
534
+ </div>
535
+ <div>
536
+ <label class="block text-sm text-gray-600 mb-1">Ebook Price ($)</label>
537
+ <input type="number" id="ebookPrice" min="0" step="0.01" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="4.99">
538
+ </div>
539
+ </div>
540
+ </div>
541
+
542
+ <!-- Distribution -->
543
+ <div>
544
+ <h3 class="text-md font-medium text-gray-700 mb-3">Distribution</h3>
545
+ <div class="space-y-2">
546
+ <div class="flex items-center">
547
+ <input type="checkbox" id="distAmazon" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
548
+ <label for="distAmazon" class="text-sm text-gray-700">Amazon Kindle Direct Publishing</label>
549
+ </div>
550
+ <div class="flex items-center">
551
+ <input type="checkbox" id="distApple" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
552
+ <label for="distApple" class="text-sm text-gray-700">Apple Books</label>
553
+ </div>
554
+ <div class="flex items-center">
555
+ <input type="checkbox" id="distGoogle" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
556
+ <label for="distGoogle" class="text-sm text-gray-700">Google Play Books</label>
557
+ </div>
558
+ <div class="flex items-center">
559
+ <input type="checkbox" id="distKobo" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
560
+ <label for="distKobo" class="text-sm text-gray-700">Kobo</label>
561
+ </div>
562
+ </div>
563
+ </div>
564
+
565
+ <!-- Royalty Options -->
566
+ <div>
567
+ <h3 class="text-md font-medium text-gray-700 mb-3">Amazon KDP Options</h3>
568
+ <div class="space-y-2">
569
+ <div class="flex items-center">
570
+ <input type="checkbox" id="kdpSelect" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
571
+ <label for="kdpSelect" class="text-sm text-gray-700">Enroll in KDP Select (Exclusive to Amazon)</label>
572
+ </div>
573
+ <div class="flex items-center">
574
+ <input type="checkbox" id="kdpUnlimited" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
575
+ <label for="kdpUnlimited" class="text-sm text-gray-700">Make eBook free for KU subscribers</label>
576
+ </div>
577
+ </div>
578
+ </div>
579
+
580
+ <!-- Buttons -->
581
+ <div class="pt-4 space-y-3">
582
+ <button onclick="showTab('format-settings')" class="w-full bg-gray-100 hover:bg-gray-200 text-gray-700 py-2 px-4 rounded-lg transition duration-300">
583
+ <i class="fas fa-arrow-left mr-2"></i> Back
584
+ </button>
585
+ <button type="button" onclick="generateEbook()" class="w-full gradient-bg text-white py-3 px-6 rounded-lg font-medium hover:opacity-90 transition duration-300 flex items-center justify-center">
586
+ <i class="fas fa-magic mr-2"></i> Generate & Publish Ebook
587
+ </button>
588
+ </div>
589
+ </div>
590
+ </div>
591
+
592
+ <!-- Requirements Checklist -->
593
+ <div class="lg:col-span-1">
594
+ <div class="bg-white rounded-xl shadow-md p-6 h-fit sticky top-8">
595
+ <h2 class="text-xl font-semibold mb-4 text-gray-800">Amazon Requirements</h2>
596
+ <div class="space-y-4">
597
+ <div class="flex items-start">
598
+ <div class="flex-shrink-0 mt-1">
599
+ <i class="fas fa-check-circle text-green-500"></i>
600
+ </div>
601
+ <div class="ml-3">
602
+ <p class="text-sm text-gray-700 font-medium">Title (between 2-100 characters)</p>
603
+ </div>
604
+ </div>
605
+ <div class="flex items-start">
606
+ <div class="flex-shrink-0 mt-1">
607
+ <i class="fas fa-check-circle text-green-500"></i>
608
+ </div>
609
+ <div class="ml-3">
610
+ <p class="text-sm text-gray-700 font-medium">Author name specified</p>
611
+ </div>
612
+ </div>
613
+ <div class="flex items-start">
614
+ <div class="flex-shrink-0 mt-1">
615
+ <i class="fas fa-check-circle text-green-500"></i>
616
+ </div>
617
+ <div class="ml-3">
618
+ <p class="text-sm text-gray-700 font-medium">At least one category selected</p>
619
+ </div>
620
+ </div>
621
+ <div class="flex items-start">
622
+ <div class="flex-shrink-0 mt-1">
623
+ <i class="fas fa-check-circle text-green-500"></i>
624
+ </div>
625
+ <div class="ml-3">
626
+ <p class="text-sm text-gray-700 font-medium">Printable book size selected</p>
627
+ </div>
628
+ </div>
629
+ <div class="flex items-start">
630
+ <div class="flex-shrink-0 mt-1">
631
+ <i class="fas fa-exclamation-circle text-yellow-500"></i>
632
+ </div>
633
+ <div class="ml-3">
634
+ <p class="text-sm text-gray-700 font-medium">Recommended number of pages: 24-800</p>
635
+ </div>
636
+ </div>
637
+ <div class="border-t border-gray-200 pt-4">
638
+ <h3 class="text-sm font-medium text-gray-700 mb-2">Cover Requirements</h3>
639
+ <ul class="text-xs text-gray-500 space-y-1">
640
+ <li class="flex items-start">
641
+ <i class="fas fa-check mt-1 mr-2 text-green-500 text-xs"></i>
642
+ <span>Minimum 1000 pixels on longest side</span>
643
+ </li>
644
+ <li class="flex items-start">
645
+ <i class="fas fa-check mt-1 mr-2 text-green-500 text-xs"></i>
646
+ <span>72-300 DPI resolution</span>
647
+ </li>
648
+ <li class="flex items-start">
649
+ <i class="fas fa-check mt-1 mr-2 text-green-500 text-xs"></i>
650
+ <span>RGB color mode</span>
651
+ </li>
652
+ </ul>
653
+ </div>
654
+ </div>
655
+ </div>
656
+ </div>
657
+
658
+ <!-- Publishing Platforms -->
659
+ <div class="lg:col-span-1">
660
+ <div class="bg-white rounded-xl shadow-md p-6">
661
+ <h2 class="text-xl font-semibold mb-4 text-gray-800">Publishing Platforms</h2>
662
+ <div class="space-y-4">
663
+ <div class="p-4 border border-blue-200 rounded-lg bg-blue-50">
664
+ <div class="flex items-center">
665
+ <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a9/Amazon_logo.svg/1200px-Amazon_logo.svg.png" class="h-8 mr-3" alt="Amazon">
666
+ <div>
667
+ <h3 class="font-medium text-gray-800">Amazon KDP</h3>
668
+ <p class="text-xs text-gray-500">Kindle Direct Publishing</p>
669
+ </div>
670
+ </div>
671
+ <div class="mt-3 flex items-center">
672
+ <i class="fas fa-check-circle text-green-500 mr-2"></i>
673
+ <span class="text-sm text-gray-700">Requirements met</span>
674
+ </div>
675
+ </div>
676
+
677
+ <div class="p-4 border border-gray-200 rounded-lg">
678
+ <div class="flex items-center">
679
+ <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Apple_logo_black.svg/505px-Apple_logo_black.svg.png" class="h-8 mr-3" alt="Apple">
680
+ <div>
681
+ <h3 class="font-medium text-gray-800">Apple Books</h3>
682
+ <p class="text-xs text-gray-500">iBook Author</p>
683
+ </div>
684
+ </div>
685
+ <div class="mt-3 flex items-center">
686
+ <i class="fas fa-check-circle text-green-500 mr-2"></i>
687
+ <span class="text-sm text-gray-700">Requirements met</span>
688
+ </div>
689
+ </div>
690
+
691
+ <div class="p-4 border border-gray-200 rounded-lg">
692
+ <div class="flex items-center">
693
+ <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/1200px-Google_2015_logo.svg.png" class="h-8 mr-3" alt="Google">
694
+ <div>
695
+ <h3 class="font-medium text-gray-800">Google Play Books</h3>
696
+ <p class="text-xs text-gray-500">Google's publishing platform</p>
697
+ </div>
698
+ </div>
699
+ <div class="mt-3 flex items-center">
700
+ <i class="fas fa-check-circle text-green-500 mr-2"></i>
701
+ <span class="text-sm text-gray-700">Requirements met</span>
702
+ </div>
703
+ </div>
704
+ </div>
705
+ </div>
706
+ </div>
707
+ </div>
708
+ </div>
709
+
710
+ <!-- API Settings Tab -->
711
+ <div id="api-settings-tab" class="tab-content">
712
+ <div class="max-w-4xl mx-auto bg-white rounded-xl shadow-md p-6">
713
+ <h2 class="text-xl font-semibold mb-4 text-gray-800">API Configuration</h2>
714
+ <p class="text-gray-600 mb-6">Connect your preferred AI APIs to power the ebook generation.</p>
715
+
716
+ <div class="space-y-8">
717
+ <!-- API Connection Status -->
718
+ <div class="border border-gray-200 rounded-lg p-4 bg-gray-50">
719
+ <div class="flex items-center justify-between mb-2">
720
+ <h3 class="font-medium text-gray-700">API Connection Status</h3>
721
+ <div id="apiStatusBadge" class="flex items-center">
722
+ <span class="api-status connected"></span>
723
+ <span class="text-sm text-green-700">Connected</span>
724
+ </div>
725
+ </div>
726
+ <p class="text-xs text-gray-500">All API connections are working properly. You can generate ebooks.</p>
727
+ </div>
728
+
729
+ <!-- OpenAI API -->
730
+ <div class="border border-gray-200 rounded-lg p-4">
731
+ <div class="flex items-center justify-between mb-2">
732
+ <div class="flex items-center">
733
+ <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4d/OpenAI_Logo.svg/1200px-OpenAI_Logo.svg.png" class="h-6 mr-2" alt="OpenAI">
734
+ <h3 class="font-medium text-gray-700">OpenAI API</h3>
735
+ </div>
736
+ <div class="flex items-center">
737
+ <span class="api-status connected"></span>
738
+ <span class="text-sm text-green-700">Connected</span>
739
+ </div>
740
+ </div>
741
+ <p class="text-xs text-gray-500 mb-3">Used for content generation and styling.</p>
742
+ <div>
743
+ <label for="openaiKey" class="block text-sm text-gray-600 mb-1">API Key</label>
744
+ <div class="flex">
745
+ <input type="password" id="openaiKey" class="flex-grow px-4 py-2 border border-gray-300 rounded-l-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="sk-...">
746
+ <button onclick="toggleApiKeyVisibility('openaiKey')" class="bg-gray-100 hover:bg-gray-200 px-4 rounded-r-lg border border-l-0 border-gray-300">
747
+ <i class="fas fa-eye"></i>
748
+ </button>
749
+ </div>
750
+ <p class="text-xs text-gray-400 mt-1">Your API key is stored securely in your browser.</p>
751
+ </div>
752
+ <div class="mt-3 grid grid-cols-2 gap-4">
753
+ <div>
754
+ <label class="block text-sm text-gray-600 mb-1">Model</label>
755
+ <select class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
756
+ <option value="gpt-4">GPT-4</option>
757
+ <option value="gpt-3.5" selected>GPT-3.5 Turbo</option>
758
+ </select>
759
+ </div>
760
+ <div>
761
+ <label class="block text-sm text-gray-600 mb-1">Max Tokens</label>
762
+ <input type="number" value="2500" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
763
+ </div>
764
+ </div>
765
+ </div>
766
+
767
+ <!-- Stable Diffusion API -->
768
+ <div class="border border-gray-200 rounded-lg p-4">
769
+ <div class="flex items-center justify-between mb-2">
770
+ <div class="flex items-center">
771
+ <img src="https://stability.ai/site-favicon.ico" class="h-6 mr-2" alt="Stability AI">
772
+ <h3 class="font-medium text-gray-700">Stable Diffusion API</h3>
773
+ </div>
774
+ <div class="flex items-center">
775
+ <span class="api-status connected"></span>
776
+ <span class="text-sm text-green-700">Connected</span>
777
+ </div>
778
+ </div>
779
+ <p class="text-xs text-gray-500 mb-3">Used for cover image generation.</p>
780
+ <div>
781
+ <label for="sdKey" class="block text-sm text-gray-600 mb-1">API Key</label>
782
+ <div class="flex">
783
+ <input type="password" id="sdKey" class="flex-grow px-4 py-2 border border-gray-300 rounded-l-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="sk-...">
784
+ <button onclick="toggleApiKeyVisibility('sdKey')" class="bg-gray-100 hover:bg-gray-200 px-4 rounded-r-lg border border-l-0 border-gray-300">
785
+ <i class="fas fa-eye"></i>
786
+ </button>
787
+ </div>
788
+ </div>
789
+ <div class="mt-3 grid grid-cols-2 gap-4">
790
+ <div>
791
+ <label class="block text-sm text-gray-600 mb-1">Model</label>
792
+ <select class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
793
+ <option value="sd-xl" selected>SD XL</option>
794
+ <option value="sd-2.1">SD 2.1</option>
795
+ </select>
796
+ </div>
797
+ <div>
798
+ <label class="block text-sm text-gray-600 mb-1">Steps</label>
799
+ <input type="number" value="30" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
800
+ </div>
801
+ </div>
802
+ </div>
803
+
804
+ <!-- AWS API -->
805
+ <div class="border border-gray-200 rounded-lg p-4">
806
+ <div class="flex items-center justify-between mb-2">
807
+ <div class="flex items-center">
808
+ <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/9/93/Amazon_Web_Services_Logo.svg/1200px-Amazon_Web_Services_Logo.svg.png" class="h-6 mr-2" alt="AWS">
809
+ <h3 class="font-medium text-gray-700">Amazon Web Services</h3>
810
+ </div>
811
+ <div class="flex items-center">
812
+ <span class="api-status connected"></span>
813
+ <span class="text-sm text-green-700">Connected</span>
814
+ </div>
815
+ </div>
816
+ <p class="text-xs text-gray-500 mb-3">Used for PDF generation and publishing to KDP.</p>
817
+ <div class="grid grid-cols-2 gap-4">
818
+ <div>
819
+ <label class="block text-sm text-gray-600 mb-1">Access Key ID</label>
820
+ <input type="password" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="AKIA...">
821
+ </div>
822
+ <div>
823
+ <label class="block text-sm text-gray-600 mb-1">Secret Access Key</label>
824
+ <input type="password" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="wJalr...">
825
+ </div>
826
+ </div>
827
+ <div class="mt-3">
828
+ <label class="block text-sm text-gray-600 mb-1">Region</label>
829
+ <select class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
830
+ <option value="us-east-1" selected>US East (N. Virginia)</option>
831
+ <option value="us-west-2">US West (Oregon)</option>
832
+ <option value="eu-west-1">EU (Ireland)</option>
833
+ </select>
834
+ </div>
835
+ </div>
836
+
837
+ <!-- Test Connection Button -->
838
+ <div class="pt-4">
839
+ <button onclick="testApiConnections()" class="w-full bg-blue-600 hover:bg-blue-700 text-white py-3 px-6 rounded-lg font-medium transition duration-300">
840
+ Test API Connections
841
+ </button>
842
+ </div>
843
+ </div>
844
+ </div>
845
+ </div>
846
+
847
+ <!-- My Ebooks Tab -->
848
+ <div id="my-ebooks-tab" class="tab-content">
849
+ <div class="max-w-6xl mx-auto">
850
+ <div class="flex justify-between items-center mb-6">
851
+ <h2 class="text-xl font-semibold text-gray-800">My Generated Ebooks</h2>
852
+ <div class="flex space-x-2">
853
+ <button onclick="showTab('generator')" class="bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-lg font-medium transition duration-300 flex items-center">
854
+ <i class="fas fa-plus mr-2"></i> Create New Ebook
855
+ </button>
856
+ </div>
857
+ </div>
858
+
859
+ <div id="filterBar" class="bg-white p-4 rounded-lg shadow mb-6">
860
+ <div class="flex flex-wrap gap-4">
861
+ <div>
862
+ <label class="block text-sm text-gray-600 mb-1">Filter by Status</label>
863
+ <select class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
864
+ <option value="all">All Ebooks</option>
865
+ <option value="draft">Drafts</option>
866
+ <option value="published">Published</option>
867
+ <option value="archived">Archived</option>
868
+ </select>
869
+ </div>
870
+ <div>
871
+ <label class="block text-sm text-gray-600 mb-1">Filter by Date</label>
872
+ <select class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
873
+ <option value="all">All Time</option>
874
+ <option value="today">Today</option>
875
+ <option value="week">This Week</option>
876
+ <option value="month">This Month</option>
877
+ </select>
878
+ </div>
879
+ <div>
880
+ <label class="block text-sm text-gray-600 mb-1">Sort By</label>
881
+ <select class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
882
+ <option value="newest">Newest First</option>
883
+ <option value="oldest">Oldest First</option>
884
+ <option value="title">Title (A-Z)</option>
885
+ </select>
886
+ </div>
887
+ <div class="flex items-end">
888
+ <button class="bg-gray-100 hover:bg-gray-200 text-gray-700 py-2 px-4 rounded-lg transition duration-300">
889
+ <i class="fas fa-filter mr-2"></i> Apply
890
+ </button>
891
+ </div>
892
+ </div>
893
+ </div>
894
+
895
+ <div class="bg-white rounded-xl shadow-md p-6">
896
+ <div id="ebooksList" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
897
+ <!-- Ebooks will be listed here dynamically -->
898
+ </div>
899
+ </div>
900
+ </div>
901
+ </div>
902
+ </main>
903
+ </div>
904
+
905
+ <script>
906
+ // Current ebook being worked on
907
+ let currentEbook = null;
908
+
909
+ // Tab switching functionality
910
+ function showTab(tabName) {
911
+ // Update active tab button
912
+ document.querySelectorAll('.tab-button').forEach(button => {
913
+ button.classList.remove('active');
914
+ });
915
+
916
+ const activeButton = document.querySelector(`a[onclick="showTab('${tabName}')"]`);
917
+ if (activeButton) activeButton.classList.add('active');
918
+
919
+ // Hide all tabs
920
+ document.querySelectorAll('.tab-content').forEach(tab => {
921
+ tab.classList.remove('active');
922
+ });
923
+
924
+ // Show selected tab with animation
925
+ document.getElementById(`${tabName}-tab`).classList.add('active');
926
+
927
+ // Initialize tab-specific content
928
+ if (tabName === 'my-ebooks') {
929
+ loadMyEbooks();
930
+ }
931
+ }
932
+
933
+ // Format selection
934
+ function selectFormat(format, element) {
935
+ document.querySelectorAll('.format-option').forEach(el => el.classList.remove('active'));
936
+ element.classList.add('active');
937
+ document.getElementById('pageSize').value = format;
938
+
939
+ // Update display
940
+ if (format === '6x9') {
941
+ document.getElementById('coverFormatDisplay').textContent = '6 × 9 inches';
942
+ } else if (format === '5x8') {
943
+ document.getElementById('coverFormatDisplay').textContent = '5 × 8 inches';
944
+ } else if (format === 'a5') {
945
+ document.getElementById('coverFormatDisplay').textContent = 'A5 (148 × 210mm)';
946
+ } else if (format === 'a4') {
947
+ document.getElementById('coverFormatDisplay').textContent = 'A4 (210 × 297mm)';
948
+ } else {
949
+ document.getElementById('coverFormatDisplay').textContent = 'Custom';
950
+ }
951
+
952
+ // Update preview if ebook exists
953
+ if (currentEbook) {
954
+ currentEbook.format = format;
955
+ updateCoverPreview();
956
+ }
957
+ }
958
+
959
+ // Color selection
960
+ function selectColor(color, element) {
961
+ document.querySelectorAll('.color-option').forEach(el => el.classList.remove('selected'));
962
+ element.classList.add('selected');
963
+
964
+ // Update preview if ebook exists
965
+ if (currentEbook) {
966
+ currentEbook.color = color;
967
+ updateCoverPreview();
968
+ updateInteriorPreview();
969
+ }
970
+ }
971
+
972
+ // Update cover preview
973
+ function updateCoverPreview() {
974
+ const color = currentEbook?.color || 'blue';
975
+ const title = document.getElementById('ebookTitle').value || 'Your Ebook Title';
976
+ const author = document.getElementById('authorName').value || 'Author Name';
977
+ const coverStyle = document.getElementById('coverStyle').value || 'modern';
978
+
979
+ // Update style display
980
+ document.getElementById('coverStyleDisplay').textContent = coverStyle.charAt(0).toUpperCase() + coverStyle.slice(1);
981
+
982
+ const colorMap = {
983
+ 'blue': 'from-blue-500 to-indigo-600',
984
+ 'green': 'from-green-500 to-emerald-600',
985
+ 'red': 'from-red-500 to-rose-600',
986
+ 'purple': 'from-purple-500 to-violet-600',
987
+ 'indigo': 'from-indigo-500 to-blue-600',
988
+ 'yellow': 'from-yellow-400 to-amber-500'
989
+ };
990
+
991
+ const cover = document.getElementById('coverPreview');
992
+ cover.className = `cover-preview mx-auto bg-gradient-to-br ${colorMap[color]} flex items-center justify-center`;
993
+
994
+ document.getElementById('coverTitle').textContent = title;
995
+ document.getElementById('coverAuthor').textContent = `by ${author}`;
996
+
997
+ // Apply style-specific effects
998
+ if (coverStyle === 'vintage') {
999
+ cover.classList.add('sepia', 'brightness-90');
1000
+ } else {
1001
+ cover.classList.remove('sepia', 'brightness-90');
1002
+ }
1003
+
1004
+ if (coverStyle === 'minimal') {
1005
+ cover.classList.add('opacity-90');
1006
+ } else {
1007
+ cover.classList.remove('opacity-90');
1008
+ }
1009
+ }
1010
+
1011
+ // Randomize cover
1012
+ function randomizeCover() {
1013
+ const colors = ['blue', 'green', 'red', 'purple', 'indigo', 'yellow'];
1014
+ const randomColor = colors[Math.floor(Math.random() * colors.length)];
1015
+ const colorElement = document.querySelector(`.color-option[data-color="${randomColor}"]`);
1016
+ selectColor(randomColor, colorElement);
1017
+
1018
+ const styles = ['modern', 'minimal', 'professional', 'vintage'];
1019
+ const randomStyle = styles[Math.floor(Math.random() * styles.length)];
1020
+ document.getElementById('coverStyle').value = randomStyle;
1021
+
1022
+ updateCoverPreview();
1023
+ }
1024
+
1025
+ // Upload cover
1026
+ function uploadCover() {
1027
+ const input = document.createElement('input');
1028
+ input.type = 'file';
1029
+ input.accept = 'image/*';
1030
+
1031
+ input.onchange = (e) => {
1032
+ const file = e.target.files[0];
1033
+ if (file) {
1034
+ const reader = new FileReader();
1035
+ reader.onload = function(event) {
1036
+ const cover = document.getElementById('coverPreview');
1037
+ cover.style.backgroundImage = `url(${event.target.result})`;
1038
+ cover.className = 'cover-preview mx-auto bg-cover bg-center flex items-center justify-center';
1039
+
1040
+ document.getElementById('coverTitle').textContent = '';
1041
+ document.getElementById('coverAuthor').textContent = '';
1042
+
1043
+ // Update preview if ebook exists
1044
+ if (currentEbook) {
1045
+ currentEbook.customCover = event.target.result;
1046
+ }
1047
+
1048
+ Toastify({
1049
+ text: "Custom cover uploaded successfully!",
1050
+ duration: 3000,
1051
+ gravity: "top",
1052
+ position: "right",
1053
+ backgroundColor: "#10B981"
1054
+ }).showToast();
1055
+ };
1056
+ reader.readAsDataURL(file);
1057
+ }
1058
+ };
1059
+
1060
+ input.click();
1061
+ }
1062
+
1063
+ // Update interior preview
1064
+ function updateInteriorPreview() {
1065
+ const template = document.getElementById('designTemplate').value || 'modern';
1066
+ const font = document.getElementById('bodyFont').value || 'sans-serif';
1067
+ const fontSize = document.getElementById('fontSize').value || '12';
1068
+ const color = currentEbook?.color || 'blue';
1069
+
1070
+ const interior = document.getElementById('interiorPreview');
1071
+
1072
+ // Reset classes
1073
+ interior.className = 'border border-gray-200 p-6 rounded-lg';
1074
+
1075
+ // Add template-specific classes
1076
+ if (template === 'modern') {
1077
+ interior.classList.add('bg-white');
1078
+ } else if (template === 'minimal') {
1079
+ interior.classList.add('bg-gray-50');
1080
+ } else if (template === 'creative') {
1081
+ interior.classList.add('bg-white', 'border-2', 'border-dashed', 'border-blue-200');
1082
+ } else if (template === 'academic') {
1083
+ interior.classList.add('bg-white', 'border-l-4');
1084
+ }
1085
+
1086
+ // Add font classes
1087
+ if (font === 'serif') {
1088
+ interior.classList.add('font-serif');
1089
+ } else if (font === 'sans-serif') {
1090
+ interior.classList.add('font-sans');
1091
+ } else if (font === 'monospace') {
1092
+ interior.classList.add('font-mono');
1093
+ }
1094
+
1095
+ // Add color accents
1096
+ const colorMap = {
1097
+ 'blue': 'border-blue-200',
1098
+ 'green': 'border-green-200',
1099
+ 'red': 'border-red-200',
1100
+ 'purple': 'border-purple-200',
1101
+ 'indigo': 'border-indigo-200',
1102
+ 'yellow': 'border-yellow-200'
1103
+ };
1104
+
1105
+ if (template === 'academic') {
1106
+ interior.classList.add(colorMap[color]);
1107
+ } else if (template === 'creative') {
1108
+ interior.classList.replace('border-blue-200', colorMap[color]);
1109
+ }
1110
+
1111
+ // Update font size
1112
+ interior.style.fontSize = fontSize + 'pt';
1113
+
1114
+ // Update preview if ebook exists
1115
+ if (currentEbook) {
1116
+ currentEbook.template = template;
1117
+ currentEbook.font = font;
1118
+ currentEbook.fontSize = fontSize;
1119
+ }
1120
+ }
1121
+
1122
+ // Preview ebook
1123
+ function previewEbook() {
1124
+ // Update cover preview
1125
+ updateCoverPreview();
1126
+
1127
+ // Update interior preview
1128
+ updateInteriorPreview();
1129
+
1130
+ // If no ebook exists yet, show a message
1131
+ if (!currentEbook) {
1132
+ Toastify({
1133
+ text: "Fill out the generator form first",
1134
+ duration: 3000,
1135
+ gravity: "top",
1136
+ position: "right",
1137
+ backgroundColor: "#EF4444"
1138
+ }).showToast();
1139
+ return;
1140
+ }
1141
+ }
1142
+
1143
+ // Generate ebook function
1144
+ function generateEbook() {
1145
+ // Validate required fields
1146
+ const title = document.getElementById('ebookTitle').value;
1147
+ const author = document.getElementById('authorName').value;
1148
+ const topic = document.getElementById('ebookTopic').value;
1149
+ const summary = document.getElementById('ebookSummary').value;
1150
+
1151
+ if (!title || !author || !topic || !summary) {
1152
+ Toastify({
1153
+ text: "Please fill all required fields first",
1154
+ duration: 3000,
1155
+ gravity: "top",
1156
+ position: "right",
1157
+ backgroundColor: "#EF4444"
1158
+ }).showToast();
1159
+ return;
1160
+ }
1161
+
1162
+ // Show loading state
1163
+ document.getElementById('emptyState').classList.add('hidden');
1164
+ document.getElementById('ebookContent').classList.add('hidden');
1165
+ document.getElementById('loadingState').classList.remove('hidden');
1166
+
1167
+ // Get form values
1168
+ const subtitle = document.getElementById('ebookSubtitle').value;
1169
+ const keywords = document.getElementById('ebookKeywords').value;
1170
+ const chapterCount = parseInt(document.getElementById('chapterCount').value);
1171
+ const writingStyle = document.getElementById('writingStyle').value;
1172
+
1173
+ // Get format settings
1174
+ const format = document.getElementById('pageSize').value;
1175
+ const template = document.getElementById('designTemplate').value;
1176
+ const font = document.getElementById('bodyFont').value;
1177
+ const fontSize = document.getElementById('fontSize').value;
1178
+ const color = document.querySelector('.color-option.selected').dataset.color;
1179
+ const coverStyle = document.getElementById('coverStyle').value;
1180
+
1181
+ // Get publishing settings
1182
+ const categories = {
1183
+ primary: document.getElementById('primaryCategory').value,
1184
+ secondary: document.getElementById('secondaryCategory').value
1185
+ };
1186
+ const pricing = {
1187
+ print: document.getElementById('printPrice').value,
1188
+ ebook: document.getElementById('ebookPrice').value
1189
+ };
1190
+
1191
+ // Generate output formats
1192
+ const outputFormats = [];
1193
+ if (document.getElementById('formatPDF').checked) outputFormats.push('pdf');
1194
+ if (document.getElementById('formatEPUB').checked) outputFormats.push('epub');
1195
+ if (document.getElementById('formatMOBI').checked) outputFormats.push('mobi');
1196
+
1197
+ // Simulate API call with timeout
1198
+ setTimeout(() => {
1199
+ // Hide loading state
1200
+ document.getElementById('loadingState').classList.add('hidden');
1201
+
1202
+ // Generate ebook content
1203
+ currentEbook = generateMockEbook(
1204
+ title, subtitle, author, topic, keywords, summary,
1205
+ chapterCount, writingStyle, format, template,
1206
+ font, fontSize, color, coverStyle, categories, pricing
1207
+ );
1208
+ currentEbook.outputFormats = outputFormats;
1209
+
1210
+ // Display the generated ebook
1211
+ displayEbook(currentEbook);
1212
+
1213
+ // Add to my ebooks list
1214
+ addToMyEbooks(currentEbook);
1215
+
1216
+ // Show success message
1217
+ Toastify({
1218
+ text: "Ebook generated successfully!",
1219
+ duration: 3000,
1220
+ gravity: "top",
1221
+ position: "right",
1222
+ backgroundColor: "#10B981"
1223
+ }).showToast();
1224
+
1225
+ // Show content
1226
+ document.getElementById('ebookContent').classList.remove('hidden');
1227
+
1228
+ // Activate ebook tab button
1229
+ const activeButton = document.querySelector('a[onclick="showTab(\'generator\')"]');
1230
+ if (activeButton) activeButton.classList.add('active');
1231
+
1232
+ }, 3000);
1233
+ }
1234
+
1235
+ function generateMockEbook(title, subtitle, author, topic, keywords, summary, chapterCount, style, format, template, font, fontSize, color, coverStyle, categories, pricing) {
1236
+ const styles = {
1237
+ professional: "This comprehensive guide provides professional insights",
1238
+ casual: "This friendly guide walks you through",
1239
+ academic: "This scholarly examination presents",
1240
+ storytelling: "Let me tell you the story of"
1241
+ };
1242
+
1243
+ const bookSubtitle = subtitle || `${styles[style]} ${topic.toLowerCase()}.`;
1244
+
1245
+ // Generate chapters
1246
+ const chapters = [];
1247
+ const toc = [];
1248
+
1249
+ for (let i = 1; i <= chapterCount; i++) {
1250
+ const chapterTitle = generateChapterTitle(topic, i, chapterCount);
1251
+ const chapterContent = generateChapterContent(topic, keywords, i, chapterCount, style);
1252
+
1253
+ chapters.push({
1254
+ title: chapterTitle,
1255
+ content: chapterContent
1256
+ });
1257
+
1258
+ toc.push({
1259
+ title: chapterTitle,
1260
+ id: `chapter-${i}`
1261
+ });
1262
+ }
1263
+
1264
+ return {
1265
+ title,
1266
+ subtitle: bookSubtitle,
1267
+ author,
1268
+ toc,
1269
+ chapters,
1270
+ format,
1271
+ template,
1272
+ font,
1273
+ fontSize,
1274
+ color,
1275
+ coverStyle,
1276
+ categories,
1277
+ pricing,
1278
+ generatedAt: new Date().toLocaleString(),
1279
+ id: Date.now().toString()
1280
+ };
1281
+ }
1282
+
1283
+ function generateChapterTitle(topic, index, total) {
1284
+ const prefixes = [
1285
+ "Introduction to",
1286
+ "The Fundamentals of",
1287
+ "Advanced Techniques in",
1288
+ "Practical Applications of",
1289
+ "Case Studies in",
1290
+ "Future Trends in",
1291
+ "Best Practices for",
1292
+ "Common Mistakes in",
1293
+ "Tools and Resources for",
1294
+ "Getting Started with"
1295
+ ];
1296
+
1297
+ const suffixes = [
1298
+ "Explained",
1299
+ "Demystified",
1300
+ "Uncovered",
1301
+ "Revealed",
1302
+ "Made Simple",
1303
+ "for Beginners",
1304
+ "for Professionals",
1305
+ "in Practice",
1306
+ "in the Real World",
1307
+ "and Beyond"
1308
+ ];
1309
+
1310
+ // Use more specific prefixes for later chapters
1311
+ const prefix = index === 1 ? prefixes[0] :
1312
+ index === total ? prefixes[5] :
1313
+ prefixes[Math.min(index, prefixes.length - 1)];
1314
+
1315
+ const suffix = suffixes[Math.floor(Math.random() * suffixes.length)];
1316
+
1317
+ return `${prefix} ${topic} ${suffix}`;
1318
+ }
1319
+
1320
+ function generateChapterContent(topic, keywords, index, total, style) {
1321
+ const keywordList = keywords.split(',').map(k => k.trim()).filter(k => k.length > 0);
1322
+
1323
+ const paragraphs = [];
1324
+ const paragraphCount = 3 + Math.floor(Math.random() * 3); // 3-5 paragraphs
1325
+
1326
+ for (let i = 0; i < paragraphCount; i++) {
1327
+ let paragraph = "";
1328
+
1329
+ // First paragraph introduces the chapter
1330
+ if (i === 0) {
1331
+ paragraph = `In this chapter, we ${style === 'academic' ? 'examine' : style === 'professional' ? 'explore' : 'look at'} `;
1332
+ paragraph += `the ${index === 1 ? 'basic concepts' : index === total ? 'future implications' : 'key aspects'} `;
1333
+ paragraph += `of ${topic.toLowerCase()}. `;
1334
+
1335
+ if (keywordList.length > 0) {
1336
+ paragraph += `Particular focus will be given to ${keywordList.join(', ')}. `;
1337
+ }
1338
+ }
1339
+ // Middle paragraphs provide content
1340
+ else {
1341
+ const concepts = [
1342
+ "This approach has been shown to produce significant results",
1343
+ "Many experts agree that this method is effective",
1344
+ "Recent studies have demonstrated the value of this technique",
1345
+ "When implemented correctly, this strategy can yield benefits",
1346
+ "Organizations that adopt this practice often see improvements",
1347
+ "The data clearly supports the effectiveness of this solution"
1348
+ ];
1349
+
1350
+ const examples = [
1351
+ "For example, a recent case study showed",
1352
+ "Consider how this applies to a typical scenario",
1353
+ "To illustrate this point, imagine a situation where",
1354
+ "A practical example of this would be",
1355
+ "This can be seen in the way that",
1356
+ "We can observe this in action when"
1357
+ ];
1358
+
1359
+ const transitions = [
1360
+ "Building on this concept,",
1361
+ "Taking this a step further,",
1362
+ "In addition to this,",
1363
+ "Furthermore,",
1364
+ "Another important consideration is",
1365
+ "It's also worth noting that"
1366
+ ];
1367
+
1368
+ if (i === 1) {
1369
+ paragraph = concepts[Math.floor(Math.random() * concepts.length)] + ". ";
1370
+ paragraph += examples[Math.floor(Math.random() * examples.length)] + " ";
1371
+ paragraph += "this leads to measurable outcomes. ";
1372
+ } else {
1373
+ paragraph = transitions[Math.floor(Math.random() * transitions.length)] + " ";
1374
+ paragraph += concepts[Math.floor(Math.random() * concepts.length)].toLowerCase() + ". ";
1375
+
1376
+ if (Math.random() > 0.3) {
1377
+ paragraph += examples[Math.floor(Math.random() * examples.length)] + " ";
1378
+ paragraph += "the results speak for themselves. ";
1379
+ }
1380
+ }
1381
+ }
1382
+
1383
+ // Add some keywords if available
1384
+ if (keywordList.length > 0 && Math.random() > 0.5) {
1385
+ const keyword = keywordList[Math.floor(Math.random() * keywordList.length)];
1386
+ paragraph += `The role of ${keyword} in this process cannot be overstated. `;
1387
+ }
1388
+
1389
+ paragraphs.push(paragraph);
1390
+ }
1391
+
1392
+ // Add a concluding paragraph
1393
+ let conclusion = "";
1394
+ if (index === 1) {
1395
+ conclusion = "This chapter has introduced the fundamental concepts that will be explored in more depth throughout this ebook. ";
1396
+ } else if (index === total) {
1397
+ conclusion = "In conclusion, this chapter has summarized the key takeaways and looked ahead to future developments in the field. ";
1398
+ } else {
1399
+ conclusion = "The insights from this chapter provide a solid foundation for understanding the more advanced topics that follow. ";
1400
+ }
1401
+
1402
+ conclusion += "In the next chapter, we will " +
1403
+ (index === total ? "summarize all the key lessons from this ebook." :
1404
+ `explore ${index === total - 1 ? "the final aspects" : "more advanced concepts"} of ${topic.toLowerCase()}.`);
1405
+
1406
+ paragraphs.push(conclusion);
1407
+
1408
+ return paragraphs;
1409
+ }
1410
+
1411
+ function displayEbook(ebookData) {
1412
+ // Set title and metadata
1413
+ document.getElementById('previewTitle').textContent = ebookData.title;
1414
+ document.getElementById('previewSubtitle').textContent = ebookData.subtitle;
1415
+ document.getElementById('previewAuthor').textContent = ebookData.author;
1416
+ document.getElementById('generatedTime').textContent = `Generated ${ebookData.generatedAt}`;
1417
+
1418
+ // Generate table of contents
1419
+ const tocList = document.getElementById('tocList');
1420
+ tocList.innerHTML = '';
1421
+
1422
+ ebookData.toc.forEach((item, index) => {
1423
+ const tocItem = document.createElement('div');
1424
+ tocItem.className = 'chapter-item transition duration-200';
1425
+ tocItem.innerHTML = `
1426
+ <a href="#${item.id}" class="flex items-center text-blue-600 hover:text-blue-800">
1427
+ <span class="w-6 text-gray-500 font-medium">${index + 1}.</span>
1428
+ <span>${item.title}</span>
1429
+ </a>
1430
+ `;
1431
+ tocList.appendChild(tocItem);
1432
+ });
1433
+
1434
+ // Generate chapters
1435
+ const chaptersContainer = document.getElementById('chaptersContainer');
1436
+ chaptersContainer.innerHTML = '';
1437
+
1438
+ ebookData.chapters.forEach((chapter, index) => {
1439
+ const chapterElement = document.createElement('div');
1440
+ chapterElement.id = `chapter-${index + 1}`;
1441
+ chapterElement.className = 'chapter mb-10';
1442
+
1443
+ let chapterHTML = `
1444
+ <div>
1445
+ <div class="flex items-center mb-4">
1446
+ <span class="bg-${ebookData.color}-100 text-${ebookData.color}-800 font-bold rounded-full w-8 h-8 flex items-center justify-center mr-3">${index + 1}</span>
1447
+ <h2 class="text-2xl font-bold text-gray-800">${chapter.title}</h2>
1448
+ </div>
1449
+ `;
1450
+
1451
+ chapter.content.forEach(paragraph => {
1452
+ chapterHTML += `<p class="text-gray-700 mb-4 ${ebookData.font === 'serif' ? 'font-serif' : ebookData.font === 'monospace' ? 'font-mono' : ''}" style="font-size: ${ebookData.fontSize}pt;">${paragraph}</p>`;
1453
+ });
1454
+
1455
+ // Add image placeholder if enabled
1456
+ if (ebookData.template !== 'minimal' && Math.random() > 0.5) {
1457
+ chapterHTML += `
1458
+ <div class="my-6 p-4 bg-gray-100 rounded-lg border border-gray-200 text-center">
1459
+ <i class="fas fa-image text-3xl text-gray-400 mb-2"></i>
1460
+ <p class="text-sm text-gray-500">[${ebookData.coverStyle} image related to chapter content]</p>
1461
+ </div>
1462
+ `;
1463
+ }
1464
+
1465
+ chapterHTML += `</div>`;
1466
+ chapterElement.innerHTML = chapterHTML;
1467
+ chaptersContainer.appendChild(chapterElement);
1468
+ });
1469
+ }
1470
+
1471
+ function addToMyEbooks(ebookData) {
1472
+ const ebooksList = document.getElementById('ebooksList');
1473
+
1474
+ // Remove placeholder if it exists
1475
+ if (ebooksList.querySelector('.text-center')) {
1476
+ ebooksList.innerHTML = '';
1477
+ }
1478
+
1479
+ // Create ebook card
1480
+ const ebookCard = document.createElement('div');
1481
+ ebookCard.className = 'bg-white rounded-lg shadow-md overflow-hidden border border-gray-200 hover:shadow-lg transition duration-300';
1482
+ ebookCard.innerHTML = `
1483
+ <div class="p-4 border-b border-gray-200 bg-gray-50 flex justify-between items-center">
1484
+ <div>
1485
+ <h3 class="font-semibold text-lg text-gray-800 truncate">${ebookData.title}</h3>
1486
+ <p class="text-sm text-gray-500">${ebookData.generatedAt}</p>
1487
+ </div>
1488
+ <span class="bg-${ebookData.color}-100 text-${ebookData.color}-800 text-xs px-2 py-1 rounded-full">${ebookData.format.toUpperCase()}</span>
1489
+ </div>
1490
+ <div class="p-4">
1491
+ <p class="text-sm text-gray-600 mb-2 line-clamp-2">${ebookData.subtitle}</p>
1492
+ <div class="flex flex-wrap gap-1 mb-3">
1493
+ <span class="text-xs px-2 py-1 bg-gray-100 text-gray-800 rounded-full">${ebookData.categories.primary}</span>
1494
+ ${ebookData.categories.secondary ? `<span class="text-xs px-2 py-1 bg-gray-100 text-gray-800 rounded-full">${ebookData.categories.secondary}</span>` : ''}
1495
+ </div>
1496
+ <div class="flex justify-between items-center">
1497
+ <span class="text-sm font-medium text-gray-700">$${(ebookData.pricing.ebook || 0).toFixed(2)}</span>
1498
+ <div class="space-x-2">
1499
+ <button onclick="viewEbook('${ebookData.id}')" class="text-blue-600 hover:text-blue-800 transition duration-300">
1500
+ <i class="fas fa-eye"></i>
1501
+ </button>
1502
+ <button onclick="publishEbook('${ebookData.id}')" class="text-purple-600 hover:text-purple-800 transition duration-300">
1503
+ <i class="fas fa-cloud-upload-alt"></i>
1504
+ </button>
1505
+ <button onclick="downloadEbook('${ebookData.id}')" class="text-green-600 hover:text-green-800 transition duration-300">
1506
+ <i class="fas fa-download"></i>
1507
+ </button>
1508
+ <button onclick="deleteEbook('${ebookData.id}')" class="text-red-600 hover:text-red-800 transition duration-300">
1509
+ <i class="fas fa-trash"></i>
1510
+ </button>
1511
+ </div>
1512
+ </div>
1513
+ </div>
1514
+ `;
1515
+
1516
+ // Add to the beginning of the list
1517
+ ebooksList.prepend(ebookCard);
1518
+
1519
+ // Store in local storage
1520
+ const myEbooks = JSON.parse(localStorage.getItem('myEbooks') || '[]');
1521
+ myEbooks.unshift(ebookData);
1522
+ localStorage.setItem('myEbooks', JSON.stringify(myEbooks));
1523
+ }
1524
+ </script>
1525
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=amwolf36/alex" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
1526
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ review