@umituz/web-ai 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/{AIErrors-B2ogd1PB.d.ts → AIErrors-CLjXRty-.d.ts} +99 -92
  2. package/dist/{AIErrors-C5EasV_c.d.cts → AIErrors-DjZXUiLT.d.cts} +99 -92
  3. package/dist/PromptBuilder-B5Lm1znm.d.ts +215 -0
  4. package/dist/PromptBuilder-DIUZlfV6.d.cts +215 -0
  5. package/dist/{cancellation-error-DwHrDKBz.d.cts → cancellation-error-Cj7fJyCg.d.cts} +3 -3
  6. package/dist/{cancellation-error-CKcZRhFg.d.ts → cancellation-error-CkMn5Kft.d.ts} +3 -3
  7. package/dist/chat/index.cjs.map +1 -1
  8. package/dist/chat/index.d.cts +3 -3
  9. package/dist/chat/index.d.ts +3 -3
  10. package/dist/chat/index.js.map +1 -1
  11. package/dist/{chat.service-CL1qtYxe.d.cts → chat.service-9M-KpLo-.d.cts} +1 -1
  12. package/dist/{chat.service-q05GnhEm.d.ts → chat.service-B4FLFxR1.d.ts} +1 -1
  13. package/dist/content/index.cjs +759 -400
  14. package/dist/content/index.cjs.map +1 -1
  15. package/dist/content/index.d.cts +165 -219
  16. package/dist/content/index.d.ts +165 -219
  17. package/dist/content/index.js +702 -401
  18. package/dist/content/index.js.map +1 -1
  19. package/dist/{create-ai-9PW752z8.d.ts → create-ai-0eZFFqTw.d.ts} +1 -1
  20. package/dist/{create-ai-CXYKPK6G.d.cts → create-ai-BrKR_5fQ.d.cts} +1 -1
  21. package/dist/hooks/index.cjs +2 -0
  22. package/dist/hooks/index.cjs.map +1 -1
  23. package/dist/hooks/index.d.cts +9 -9
  24. package/dist/hooks/index.d.ts +9 -9
  25. package/dist/hooks/index.js +1 -1
  26. package/dist/hooks/index.js.map +1 -1
  27. package/dist/index-BUVULo3h.d.ts +177 -0
  28. package/dist/index-BulSkB2L.d.cts +177 -0
  29. package/dist/index.cjs +1727 -15
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +8 -5
  32. package/dist/index.d.ts +8 -5
  33. package/dist/index.js +1690 -15
  34. package/dist/index.js.map +1 -1
  35. package/dist/{provider.factory-DfDfk0dK.d.ts → provider.factory-BwPnqSEU.d.ts} +3 -1
  36. package/dist/{provider.factory-BxsfK4WW.d.cts → provider.factory-DyfJtR8M.d.cts} +3 -1
  37. package/dist/providers/index.cjs +9 -0
  38. package/dist/providers/index.cjs.map +1 -1
  39. package/dist/providers/index.d.cts +10 -8
  40. package/dist/providers/index.d.ts +10 -8
  41. package/dist/providers/index.js +7 -1
  42. package/dist/providers/index.js.map +1 -1
  43. package/dist/wizard/index.d.cts +2 -86
  44. package/dist/wizard/index.d.ts +2 -86
  45. package/package.json +16 -1
  46. package/dist/ContentGeneration-B6iK2B33.d.cts +0 -93
  47. package/dist/ContentGeneration-B6iK2B33.d.ts +0 -93
@@ -1,5 +1,63 @@
1
1
  'use strict';
2
2
 
3
+ // src/content/domain/types/index.ts
4
+ var PLATFORM_SPECS = {
5
+ twitter: {
6
+ maxLength: 280,
7
+ style: "concise, engaging, thread-friendly",
8
+ emojiSupport: true,
9
+ hashtagSupport: true,
10
+ imageSupport: true,
11
+ videoSupport: true,
12
+ maxHashtags: 5
13
+ },
14
+ linkedin: {
15
+ maxLength: 3e3,
16
+ style: "professional, insightful, industry-focused",
17
+ emojiSupport: true,
18
+ hashtagSupport: true,
19
+ imageSupport: true,
20
+ videoSupport: true,
21
+ maxHashtags: 5
22
+ },
23
+ instagram: {
24
+ maxLength: 2200,
25
+ style: "visual, engaging, emoji-rich",
26
+ emojiSupport: true,
27
+ hashtagSupport: true,
28
+ imageSupport: true,
29
+ videoSupport: true,
30
+ maxHashtags: 30
31
+ },
32
+ threads: {
33
+ maxLength: 500,
34
+ style: "conversational, community-driven",
35
+ emojiSupport: true,
36
+ hashtagSupport: true,
37
+ imageSupport: true,
38
+ videoSupport: true,
39
+ maxHashtags: 5
40
+ },
41
+ tiktok: {
42
+ maxLength: 150,
43
+ style: "catchy, trending, short-form",
44
+ emojiSupport: true,
45
+ hashtagSupport: true,
46
+ imageSupport: false,
47
+ videoSupport: true,
48
+ maxHashtags: 5
49
+ },
50
+ facebook: {
51
+ maxLength: 63206,
52
+ style: "conversational, engaging, shareable",
53
+ emojiSupport: true,
54
+ hashtagSupport: true,
55
+ imageSupport: true,
56
+ videoSupport: true,
57
+ maxHashtags: 5
58
+ }
59
+ };
60
+
3
61
  // src/content/domain/calculations/ContentCreditCost.ts
4
62
  var CREDIT_COSTS = {
5
63
  "text-to-image": { standard: 1, hd: 2, "4k": 4 },
@@ -176,27 +234,407 @@ var AIError = class _AIError extends Error {
176
234
  metadata: this.metadata
177
235
  };
178
236
  }
179
- };
180
-
181
- // src/content/domain/errors/AIErrors.ts
182
- var ValidationError = class extends AIError {
183
- constructor(message) {
184
- super(message, "VALIDATION_ERROR");
185
- this.name = "ValidationError";
237
+ };
238
+
239
+ // src/content/domain/errors/AIErrors.ts
240
+ var ValidationError = class extends AIError {
241
+ constructor(message) {
242
+ super(message, "VALIDATION_ERROR");
243
+ this.name = "ValidationError";
244
+ }
245
+ };
246
+ var ProviderUnavailableError = class extends AIError {
247
+ constructor(providerId) {
248
+ super(`Provider ${providerId} is not available`, "PROVIDER_UNAVAILABLE");
249
+ this.name = "ProviderUnavailableError";
250
+ }
251
+ };
252
+ var ProviderQuotaExhaustedError = class extends AIError {
253
+ constructor(providerId) {
254
+ super(`Provider ${providerId} quota exhausted`, "PROVIDER_QUOTA_EXHAUSTED");
255
+ this.name = "ProviderQuotaExhaustedError";
256
+ }
257
+ };
258
+
259
+ // src/content/domain/limits/ValidationLimits.ts
260
+ var ValidationLimits = {
261
+ TOPIC: {
262
+ MIN: 1,
263
+ MAX: 500
264
+ },
265
+ CONTENT: {
266
+ MIN: 1,
267
+ MAX: 1e4
268
+ },
269
+ KEYWORD: {
270
+ MAX_COUNT: 20,
271
+ MAX_LENGTH: 50
272
+ },
273
+ DURATION_SECONDS: {
274
+ MIN: 10,
275
+ MAX: 600
276
+ },
277
+ CALENDAR_DAYS: {
278
+ MIN: 1,
279
+ MAX: 90
280
+ },
281
+ HASHTAG_COUNT: {
282
+ MIN: 1,
283
+ MAX: 50
284
+ },
285
+ SEO_CONTENT_PREVIEW: 500,
286
+ BLOG_PROMPT_PREVIEW: 1e3,
287
+ AB_VARIANT_CONTENT_PREVIEW: 200
288
+ };
289
+
290
+ // src/content/domain/limits/SpeechPaceConfig.ts
291
+ var SpeechPaceConfig = {
292
+ WORDS_PER_SECOND: 2.5,
293
+ TOKENS_PER_SECOND: 10,
294
+ JSON_TOKEN_OVERHEAD: 500,
295
+ TOKENS_PER_CALENDAR_DAY: 150
296
+ };
297
+
298
+ // src/content/domain/limits/ProviderTimingConfig.ts
299
+ var ProviderTimingConfig = {
300
+ DEFAULT_TIMEOUT_MS: 3e4,
301
+ DEFAULT_RETRY_ATTEMPTS: 3,
302
+ FAL_TIMEOUT_MS: 12e4,
303
+ FAL_RETRY_ATTEMPTS: 2,
304
+ GEMINI_TIMEOUT_MS: 6e4,
305
+ GEMINI_RETRY_ATTEMPTS: 3,
306
+ GROQ_TIMEOUT_MS: 3e4,
307
+ GROQ_RETRY_ATTEMPTS: 3,
308
+ HEALTH_CHECK_TTL_MS: 5 * 60 * 1e3,
309
+ RETRY_BACKOFF_BASE_MS: 1e3
310
+ };
311
+
312
+ // src/content/domain/limits/ModelDefaults.ts
313
+ var ModelDefaults = {
314
+ GROQ_TEXT: "llama-3.1-8b-instant",
315
+ GROQ_CHAT: "llama-3.1-8b-instant",
316
+ FAL_IMAGE: "fal-ai/flux/schnell",
317
+ FAL_VIDEO: "fal-ai/hunyuan-video/1",
318
+ FAL_IMAGE_TO_VIDEO: "fal-ai/fast-animatediff/image-to-video",
319
+ GEMINI_TEXT: "gemini-2.0-flash",
320
+ GEMINI_IMAGE: "imagen-4.0-generate-001",
321
+ PRUNA_IMAGE: "p-image",
322
+ PRUNA_IMAGE_EDIT: "p-image-edit",
323
+ PRUNA_VIDEO: "p-video"
324
+ };
325
+ var TextModelDefaults = {
326
+ TEXT_MODEL: "claude-sonnet-4-20250514",
327
+ MAX_TOKENS: 4096,
328
+ DEFAULT_TEMPERATURE: 0.7,
329
+ DEFAULT_TOP_P: 0.9
330
+ };
331
+
332
+ // src/content/domain/limits/RequestQueueConfig.ts
333
+ var RequestQueueConfig = {
334
+ MAX_CONCURRENT: 3,
335
+ MAX_QUEUE_SIZE: 50,
336
+ DEFAULT_TIMEOUT_MS: 3e4,
337
+ RETRY_DELAY_MS: 1e3,
338
+ RATE_LIMIT: {
339
+ ENABLED: true,
340
+ WINDOW_MS: 6e4,
341
+ MAX_REQUESTS_PER_WINDOW: 100
342
+ },
343
+ POLL_INTERVAL_MS: 100
344
+ };
345
+
346
+ // src/content/domain/limits/MemoryConfig.ts
347
+ var MemoryConfig = {
348
+ MANAGER: {
349
+ MAX_SIZE_BYTES: 50 * 1024 * 1024,
350
+ CLEANUP_THRESHOLD_RATIO: 0.8,
351
+ RETENTION_RATIO: 0.5
352
+ },
353
+ POOL: {
354
+ DEFAULT_MAX_SIZE: 100
355
+ },
356
+ EXPIRING_CACHE: {
357
+ DEFAULT_TTL_MS: 6e4,
358
+ CLEANUP_INTERVAL_MS: 6e4
359
+ }
360
+ };
361
+
362
+ // src/content/domain/calculations/SpeechPaceEstimate.ts
363
+ function estimateWordCountForDuration(durationSeconds) {
364
+ return Math.floor(durationSeconds * SpeechPaceConfig.WORDS_PER_SECOND);
365
+ }
366
+ function estimateTokenBudgetForDuration(durationSeconds) {
367
+ return durationSeconds * SpeechPaceConfig.TOKENS_PER_SECOND + SpeechPaceConfig.JSON_TOKEN_OVERHEAD;
368
+ }
369
+ function estimateTokenBudgetForCalendarDays(days) {
370
+ return days * SpeechPaceConfig.TOKENS_PER_CALENDAR_DAY + SpeechPaceConfig.JSON_TOKEN_OVERHEAD;
371
+ }
372
+
373
+ // src/content/domain/calculations/SeoKeywordDensity.ts
374
+ function countKeywordOccurrences(content, keyword) {
375
+ if (!keyword) return 0;
376
+ const escaped = keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
377
+ const matches = content.match(new RegExp(escaped, "gi"));
378
+ return matches ? matches.length : 0;
379
+ }
380
+ function countWordsInContent(content) {
381
+ const tokens = content.split(/\s+/).filter(Boolean);
382
+ return tokens.length || 1;
383
+ }
384
+ function calculateKeywordDensity(content, keyword) {
385
+ const totalWords = countWordsInContent(content);
386
+ const occurrences = countKeywordOccurrences(content, keyword);
387
+ return occurrences / totalWords * 100;
388
+ }
389
+
390
+ // src/content/domain/calculations/AbTestImprovementRatio.ts
391
+ function calculateImprovementPercentage(scoreA, scoreB) {
392
+ const higher = Math.max(scoreA, scoreB);
393
+ const lower = Math.min(scoreA, scoreB);
394
+ if (lower <= 0) {
395
+ return "100";
396
+ }
397
+ const delta = (higher / lower - 1) * 100;
398
+ return Math.abs(delta).toFixed(0);
399
+ }
400
+ function selectHigherScoreVariantId(scoreA, scoreB, idA = "A", idB = "B") {
401
+ return scoreA > scoreB ? idA : idB;
402
+ }
403
+
404
+ // src/content/domain/calculations/RetryBackoffDelay.ts
405
+ function calculateRetryBackoffDelayMs(attemptIndex) {
406
+ return ProviderTimingConfig.RETRY_BACKOFF_BASE_MS * Math.pow(2, attemptIndex);
407
+ }
408
+
409
+ // src/content/domain/calculations/ContentCalendarDateOffset.ts
410
+ var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
411
+ function resolveCalendarEntryDate(dayIndex, baseTimestamp = Date.now()) {
412
+ return new Date(baseTimestamp + (dayIndex - 1) * ONE_DAY_MS);
413
+ }
414
+
415
+ // src/content/domain/calculations/DefaultModelSelection.ts
416
+ function resolveDefaultPrunaModel(generationType) {
417
+ switch (generationType) {
418
+ case "image-to-image":
419
+ return ModelDefaults.PRUNA_IMAGE_EDIT;
420
+ case "image-to-video":
421
+ return ModelDefaults.PRUNA_VIDEO;
422
+ case "text-to-image":
423
+ return ModelDefaults.PRUNA_IMAGE;
424
+ case "text-to-video":
425
+ return ModelDefaults.PRUNA_VIDEO;
426
+ }
427
+ }
428
+
429
+ // src/content/domain/predicates/KeywordProminenceClassifier.ts
430
+ var HIGH_DENSITY_THRESHOLD = 2;
431
+ var MEDIUM_DENSITY_THRESHOLD = 1;
432
+ function classifyKeywordProminence(densityPercent) {
433
+ if (densityPercent > HIGH_DENSITY_THRESHOLD) return "high";
434
+ if (densityPercent > MEDIUM_DENSITY_THRESHOLD) return "medium";
435
+ return "low";
436
+ }
437
+ function isUnderutilizedKeyword(densityPercent) {
438
+ return densityPercent < 1;
439
+ }
440
+
441
+ // src/content/domain/predicates/HashtagPriorityRanker.ts
442
+ var DEFAULT_HASHTAG_BUDGET = Number.MAX_SAFE_INTEGER;
443
+ function resolveHashtagBudget(platform) {
444
+ return PLATFORM_SPECS[platform]?.maxHashtags ?? DEFAULT_HASHTAG_BUDGET;
445
+ }
446
+ function rankAndTrimHashtags(hashtags, budget) {
447
+ if (hashtags.length <= budget) return [...hashtags];
448
+ return [...hashtags].sort((a, b) => b.length - a.length).slice(0, budget);
449
+ }
450
+
451
+ // src/content/domain/predicates/PlatformSpecResolver.ts
452
+ var FALLBACK_SPEC = {
453
+ maxLength: 280,
454
+ style: "concise, engaging, audience-friendly",
455
+ emojiSupport: true,
456
+ hashtagSupport: true,
457
+ imageSupport: true,
458
+ videoSupport: true,
459
+ maxHashtags: 5
460
+ };
461
+ function resolvePlatformSpec(platform) {
462
+ return PLATFORM_SPECS[platform] ?? FALLBACK_SPEC;
463
+ }
464
+ function resolveMaxContentLength(platform, override) {
465
+ return override ?? resolvePlatformSpec(platform).maxLength;
466
+ }
467
+
468
+ // src/content/domain/predicates/ScoreRangeGuard.ts
469
+ var SCORE_MIN = 0;
470
+ var SCORE_MAX = 100;
471
+ var SCORE_FALLBACK = 50;
472
+ var CONFIDENCE_MIN = 0;
473
+ var CONFIDENCE_MAX = 1;
474
+ var CONFIDENCE_FALLBACK = 0.5;
475
+ function clampScoreToValidRange(score, fallback = SCORE_FALLBACK) {
476
+ if (!Number.isFinite(score)) return fallback;
477
+ return Math.max(SCORE_MIN, Math.min(SCORE_MAX, score));
478
+ }
479
+ function clampConfidenceToValidRange(confidence, fallback = CONFIDENCE_FALLBACK) {
480
+ if (!Number.isFinite(confidence)) return fallback;
481
+ return Math.max(CONFIDENCE_MIN, Math.min(CONFIDENCE_MAX, confidence));
482
+ }
483
+
484
+ // src/content/domain/predicates/AbTestConfidence.ts
485
+ var AB_TEST_DEFAULT_CONFIDENCE = 0.7;
486
+
487
+ // src/content/domain/predicates/ProviderCostEstimator.ts
488
+ var FAL_FIXED_COST = 1;
489
+ var GROQ_FREE_TIER_COST = 0;
490
+ var GEMINI_IMAGE_COST = 0.02;
491
+ var GEMINI_TEXT_PER_1K_CHARS_COST = 1e-4;
492
+ var PRUNA_FIXED_COST = 1;
493
+ var UNKNOWN_PROVIDER_COST = 0;
494
+ function estimateGroqGenerationCost(_request) {
495
+ return GROQ_FREE_TIER_COST;
496
+ }
497
+ function estimateFalGenerationCost(_request) {
498
+ return FAL_FIXED_COST;
499
+ }
500
+ function estimateGeminiGenerationCost(request) {
501
+ if (request.type === "image") return GEMINI_IMAGE_COST;
502
+ return GEMINI_TEXT_PER_1K_CHARS_COST;
503
+ }
504
+ function estimatePrunaGenerationCost() {
505
+ return PRUNA_FIXED_COST;
506
+ }
507
+ function estimateUnknownProviderCost() {
508
+ return UNKNOWN_PROVIDER_COST;
509
+ }
510
+
511
+ // src/content/domain/predicates/FalImageRenderingOptions.ts
512
+ var FAL_FORMAT_TO_IMAGE_SIZE = {
513
+ square: "square_hd",
514
+ landscape: "landscape_16_9",
515
+ portrait: "portrait_9_16",
516
+ story: "portrait_9_16",
517
+ banner: "landscape_16_9"
518
+ };
519
+ var FAL_DEFAULT_IMAGE_SIZE = "square_hd";
520
+ var FAL_QUALITY_TO_STEPS = {
521
+ standard: 4,
522
+ high: 6,
523
+ ultra: 8
524
+ };
525
+ var FAL_DEFAULT_QUALITY_STEPS = 6;
526
+ function resolveFalImageSize(format) {
527
+ if (!format) return FAL_DEFAULT_IMAGE_SIZE;
528
+ return FAL_FORMAT_TO_IMAGE_SIZE[format] ?? FAL_DEFAULT_IMAGE_SIZE;
529
+ }
530
+ function resolveFalInferenceSteps(quality) {
531
+ if (!quality) return FAL_DEFAULT_QUALITY_STEPS;
532
+ return FAL_QUALITY_TO_STEPS[quality] ?? FAL_DEFAULT_QUALITY_STEPS;
533
+ }
534
+
535
+ // src/content/domain/validation/TopicTextValidator.ts
536
+ function validateTopicText(topic) {
537
+ if (typeof topic !== "string" || topic.trim().length < ValidationLimits.TOPIC.MIN) {
538
+ throw new ValidationError("Topic cannot be empty");
539
+ }
540
+ const trimmed = topic.trim();
541
+ if (trimmed.length > ValidationLimits.TOPIC.MAX) {
542
+ throw new ValidationError(`Topic exceeds maximum length of ${ValidationLimits.TOPIC.MAX} characters`);
543
+ }
544
+ return trimmed;
545
+ }
546
+
547
+ // src/content/domain/validation/ContentBodyValidator.ts
548
+ function validateContentBody(content) {
549
+ if (typeof content !== "string" || content.trim().length < ValidationLimits.CONTENT.MIN) {
550
+ throw new ValidationError("Content cannot be empty");
551
+ }
552
+ const trimmed = content.trim();
553
+ if (trimmed.length > ValidationLimits.CONTENT.MAX) {
554
+ throw new ValidationError(`Content exceeds maximum length of ${ValidationLimits.CONTENT.MAX} characters`);
555
+ }
556
+ return trimmed;
557
+ }
558
+ function truncateForSeoPreview(content) {
559
+ return content.substring(0, ValidationLimits.SEO_CONTENT_PREVIEW);
560
+ }
561
+ function truncateForBlogPromptPreview(content) {
562
+ return content.substring(0, ValidationLimits.BLOG_PROMPT_PREVIEW);
563
+ }
564
+ function truncateForAbVariantPreview(content) {
565
+ return content.substring(0, ValidationLimits.AB_VARIANT_CONTENT_PREVIEW);
566
+ }
567
+
568
+ // src/content/domain/validation/KeywordListValidator.ts
569
+ function validateKeywordList(keywords) {
570
+ if (!Array.isArray(keywords)) {
571
+ throw new ValidationError("Keywords must be an array");
572
+ }
573
+ if (keywords.length > ValidationLimits.KEYWORD.MAX_COUNT) {
574
+ throw new ValidationError(`Cannot process more than ${ValidationLimits.KEYWORD.MAX_COUNT} keywords`);
575
+ }
576
+ return keywords.filter((k) => typeof k === "string" && k.trim().length > 0).map((keyword) => {
577
+ const trimmed = keyword.trim();
578
+ if (trimmed.length > ValidationLimits.KEYWORD.MAX_LENGTH) {
579
+ const preview = trimmed.substring(0, 20);
580
+ throw new ValidationError(
581
+ `Keyword "${preview}..." exceeds maximum length of ${ValidationLimits.KEYWORD.MAX_LENGTH} characters`
582
+ );
583
+ }
584
+ return trimmed;
585
+ });
586
+ }
587
+
588
+ // src/content/domain/validation/DurationSecondsValidator.ts
589
+ function validateDurationSeconds(duration) {
590
+ if (!Number.isFinite(duration)) {
591
+ throw new ValidationError(
592
+ `Duration must be between ${ValidationLimits.DURATION_SECONDS.MIN} and ${ValidationLimits.DURATION_SECONDS.MAX} seconds`
593
+ );
594
+ }
595
+ if (duration < ValidationLimits.DURATION_SECONDS.MIN || duration > ValidationLimits.DURATION_SECONDS.MAX) {
596
+ throw new ValidationError(
597
+ `Duration must be between ${ValidationLimits.DURATION_SECONDS.MIN} and ${ValidationLimits.DURATION_SECONDS.MAX} seconds`
598
+ );
599
+ }
600
+ return duration;
601
+ }
602
+
603
+ // src/content/domain/validation/CalendarDaysValidator.ts
604
+ function validateCalendarDays(days) {
605
+ if (!Number.isFinite(days)) {
606
+ throw new ValidationError(
607
+ `Days must be between ${ValidationLimits.CALENDAR_DAYS.MIN} and ${ValidationLimits.CALENDAR_DAYS.MAX}`
608
+ );
609
+ }
610
+ if (days < ValidationLimits.CALENDAR_DAYS.MIN || days > ValidationLimits.CALENDAR_DAYS.MAX) {
611
+ throw new ValidationError(
612
+ `Days must be between ${ValidationLimits.CALENDAR_DAYS.MIN} and ${ValidationLimits.CALENDAR_DAYS.MAX}`
613
+ );
186
614
  }
187
- };
188
- var ProviderUnavailableError = class extends AIError {
189
- constructor(providerId) {
190
- super(`Provider ${providerId} is not available`, "PROVIDER_UNAVAILABLE");
191
- this.name = "ProviderUnavailableError";
615
+ return days;
616
+ }
617
+
618
+ // src/content/domain/validation/HashtagCountValidator.ts
619
+ function validateHashtagCount(count) {
620
+ if (!Number.isFinite(count)) {
621
+ throw new ValidationError(
622
+ `Hashtag count must be between ${ValidationLimits.HASHTAG_COUNT.MIN} and ${ValidationLimits.HASHTAG_COUNT.MAX}`
623
+ );
192
624
  }
193
- };
194
- var ProviderQuotaExhaustedError = class extends AIError {
195
- constructor(providerId) {
196
- super(`Provider ${providerId} quota exhausted`, "PROVIDER_QUOTA_EXHAUSTED");
197
- this.name = "ProviderQuotaExhaustedError";
625
+ if (count < ValidationLimits.HASHTAG_COUNT.MIN || count > ValidationLimits.HASHTAG_COUNT.MAX) {
626
+ throw new ValidationError(
627
+ `Hashtag count must be between ${ValidationLimits.HASHTAG_COUNT.MIN} and ${ValidationLimits.HASHTAG_COUNT.MAX}`
628
+ );
198
629
  }
199
- };
630
+ return Math.floor(count);
631
+ }
632
+
633
+ // src/content/domain/utils/IdGenerator.ts
634
+ function generateId(prefix) {
635
+ const id = typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 11)}`;
636
+ return prefix ? `${prefix}-${id}` : id;
637
+ }
200
638
 
201
639
  // src/core/errors/groq-error.ts
202
640
  var GroqError = class extends AIError {
@@ -265,18 +703,6 @@ function isTextProvider(provider) {
265
703
  return provider.capabilities.includes("text");
266
704
  }
267
705
 
268
- // src/content/domain/limits/ProviderTimingConfig.ts
269
- var ProviderTimingConfig = {
270
- DEFAULT_TIMEOUT_MS: 3e4,
271
- DEFAULT_RETRY_ATTEMPTS: 3,
272
- FAL_TIMEOUT_MS: 12e4,
273
- FAL_RETRY_ATTEMPTS: 2,
274
- GEMINI_TIMEOUT_MS: 6e4,
275
- GEMINI_RETRY_ATTEMPTS: 3,
276
- HEALTH_CHECK_TTL_MS: 5 * 60 * 1e3,
277
- RETRY_BACKOFF_BASE_MS: 1e3
278
- };
279
-
280
706
  // src/providers/factory/provider.factory.ts
281
707
  var ProviderFactory = class {
282
708
  providers = /* @__PURE__ */ new Map();
@@ -2050,11 +2476,6 @@ function findLastIndex2(items, predicate) {
2050
2476
  return -1;
2051
2477
  }
2052
2478
 
2053
- // src/content/domain/calculations/RetryBackoffDelay.ts
2054
- function calculateRetryBackoffDelayMs(attemptIndex) {
2055
- return ProviderTimingConfig.RETRY_BACKOFF_BASE_MS * Math.pow(2, attemptIndex);
2056
- }
2057
-
2058
2479
  // src/providers/base/base.provider.ts
2059
2480
  var BaseProvider = class {
2060
2481
  config;
@@ -2103,26 +2524,6 @@ var BaseProvider = class {
2103
2524
  }
2104
2525
  };
2105
2526
 
2106
- // src/content/domain/predicates/ProviderCostEstimator.ts
2107
- var FAL_FIXED_COST = 1;
2108
- var GEMINI_IMAGE_COST = 0.02;
2109
- var GEMINI_TEXT_PER_1K_CHARS_COST = 1e-4;
2110
- function estimateFalGenerationCost(_request) {
2111
- return FAL_FIXED_COST;
2112
- }
2113
- function estimateGeminiGenerationCost(request) {
2114
- if (request.type === "image") return GEMINI_IMAGE_COST;
2115
- return GEMINI_TEXT_PER_1K_CHARS_COST;
2116
- }
2117
-
2118
- // src/content/domain/limits/ModelDefaults.ts
2119
- var ModelDefaults = {
2120
- FAL_IMAGE: "fal-ai/flux/schnell",
2121
- FAL_VIDEO: "fal-ai/hunyuan-video/1",
2122
- FAL_IMAGE_TO_VIDEO: "fal-ai/fast-animatediff/image-to-video",
2123
- GEMINI_TEXT: "gemini-2.0-flash",
2124
- GEMINI_IMAGE: "imagen-4.0-generate-001"};
2125
-
2126
2527
  // src/providers/gemini/gemini.provider.ts
2127
2528
  var GEMINI_TIERS = {
2128
2529
  fast: "gemini-2.0-flash-lite",
@@ -2359,146 +2760,6 @@ function findLastIndex3(items, predicate) {
2359
2760
  return -1;
2360
2761
  }
2361
2762
 
2362
- // src/content/domain/predicates/KeywordProminenceClassifier.ts
2363
- var HIGH_DENSITY_THRESHOLD = 2;
2364
- var MEDIUM_DENSITY_THRESHOLD = 1;
2365
- function classifyKeywordProminence(densityPercent) {
2366
- if (densityPercent > HIGH_DENSITY_THRESHOLD) return "high";
2367
- if (densityPercent > MEDIUM_DENSITY_THRESHOLD) return "medium";
2368
- return "low";
2369
- }
2370
- function isUnderutilizedKeyword(densityPercent) {
2371
- return densityPercent < 1;
2372
- }
2373
-
2374
- // src/content/domain/types/index.ts
2375
- var PLATFORM_SPECS = {
2376
- twitter: {
2377
- maxLength: 280,
2378
- style: "concise, engaging, thread-friendly",
2379
- emojiSupport: true,
2380
- hashtagSupport: true,
2381
- imageSupport: true,
2382
- videoSupport: true,
2383
- maxHashtags: 5
2384
- },
2385
- linkedin: {
2386
- maxLength: 3e3,
2387
- style: "professional, insightful, industry-focused",
2388
- emojiSupport: true,
2389
- hashtagSupport: true,
2390
- imageSupport: true,
2391
- videoSupport: true,
2392
- maxHashtags: 5
2393
- },
2394
- instagram: {
2395
- maxLength: 2200,
2396
- style: "visual, engaging, emoji-rich",
2397
- emojiSupport: true,
2398
- hashtagSupport: true,
2399
- imageSupport: true,
2400
- videoSupport: true,
2401
- maxHashtags: 30
2402
- },
2403
- threads: {
2404
- maxLength: 500,
2405
- style: "conversational, community-driven",
2406
- emojiSupport: true,
2407
- hashtagSupport: true,
2408
- imageSupport: true,
2409
- videoSupport: true,
2410
- maxHashtags: 5
2411
- },
2412
- tiktok: {
2413
- maxLength: 150,
2414
- style: "catchy, trending, short-form",
2415
- emojiSupport: true,
2416
- hashtagSupport: true,
2417
- imageSupport: false,
2418
- videoSupport: true,
2419
- maxHashtags: 5
2420
- },
2421
- facebook: {
2422
- maxLength: 63206,
2423
- style: "conversational, engaging, shareable",
2424
- emojiSupport: true,
2425
- hashtagSupport: true,
2426
- imageSupport: true,
2427
- videoSupport: true,
2428
- maxHashtags: 5
2429
- }
2430
- };
2431
-
2432
- // src/content/domain/predicates/HashtagPriorityRanker.ts
2433
- var DEFAULT_HASHTAG_BUDGET = Number.MAX_SAFE_INTEGER;
2434
- function resolveHashtagBudget(platform) {
2435
- return PLATFORM_SPECS[platform]?.maxHashtags ?? DEFAULT_HASHTAG_BUDGET;
2436
- }
2437
- function rankAndTrimHashtags(hashtags, budget) {
2438
- if (hashtags.length <= budget) return [...hashtags];
2439
- return [...hashtags].sort((a, b) => b.length - a.length).slice(0, budget);
2440
- }
2441
-
2442
- // src/content/domain/predicates/PlatformSpecResolver.ts
2443
- var FALLBACK_SPEC = {
2444
- maxLength: 280,
2445
- style: "concise, engaging, audience-friendly",
2446
- emojiSupport: true,
2447
- hashtagSupport: true,
2448
- imageSupport: true,
2449
- videoSupport: true,
2450
- maxHashtags: 5
2451
- };
2452
- function resolvePlatformSpec(platform) {
2453
- return PLATFORM_SPECS[platform] ?? FALLBACK_SPEC;
2454
- }
2455
- function resolveMaxContentLength(platform, override) {
2456
- return override ?? resolvePlatformSpec(platform).maxLength;
2457
- }
2458
-
2459
- // src/content/domain/predicates/ScoreRangeGuard.ts
2460
- var SCORE_MIN = 0;
2461
- var SCORE_MAX = 100;
2462
- var SCORE_FALLBACK = 50;
2463
- var CONFIDENCE_MIN = 0;
2464
- var CONFIDENCE_MAX = 1;
2465
- var CONFIDENCE_FALLBACK = 0.5;
2466
- function clampScoreToValidRange(score, fallback = SCORE_FALLBACK) {
2467
- if (!Number.isFinite(score)) return fallback;
2468
- return Math.max(SCORE_MIN, Math.min(SCORE_MAX, score));
2469
- }
2470
- function clampConfidenceToValidRange(confidence, fallback = CONFIDENCE_FALLBACK) {
2471
- if (!Number.isFinite(confidence)) return fallback;
2472
- return Math.max(CONFIDENCE_MIN, Math.min(CONFIDENCE_MAX, confidence));
2473
- }
2474
-
2475
- // src/content/domain/predicates/AbTestConfidence.ts
2476
- var AB_TEST_DEFAULT_CONFIDENCE = 0.7;
2477
-
2478
- // src/content/domain/predicates/FalImageRenderingOptions.ts
2479
- var FAL_FORMAT_TO_IMAGE_SIZE = {
2480
- square: "square_hd",
2481
- landscape: "landscape_16_9",
2482
- portrait: "portrait_9_16",
2483
- story: "portrait_9_16",
2484
- banner: "landscape_16_9"
2485
- };
2486
- var FAL_DEFAULT_IMAGE_SIZE = "square_hd";
2487
- var FAL_QUALITY_TO_STEPS = {
2488
- standard: 4,
2489
- high: 6,
2490
- ultra: 8
2491
- };
2492
- var FAL_DEFAULT_QUALITY_STEPS = 6;
2493
- function resolveFalImageSize(format) {
2494
- if (!format) return FAL_DEFAULT_IMAGE_SIZE;
2495
- return FAL_FORMAT_TO_IMAGE_SIZE[format] ?? FAL_DEFAULT_IMAGE_SIZE;
2496
- }
2497
- function resolveFalInferenceSteps(quality) {
2498
- if (!quality) return FAL_DEFAULT_QUALITY_STEPS;
2499
- return FAL_QUALITY_TO_STEPS[quality] ?? FAL_DEFAULT_QUALITY_STEPS;
2500
- }
2501
-
2502
2763
  // src/providers/fal/fal.provider.ts
2503
2764
  var FalProvider = class extends BaseProvider {
2504
2765
  id = "fal";
@@ -3565,39 +3826,20 @@ function createAI(config = {}) {
3565
3826
  });
3566
3827
  if (config.anthropic?.apiKey) {
3567
3828
  factory.register(new AnthropicProvider(config.anthropic));
3568
- }
3569
- if (config.groq?.apiKey) {
3570
- factory.register(new GroqProvider(config.groq));
3571
- }
3572
- if (config.gemini?.apiKey) {
3573
- factory.register(new GeminiProvider({ ...config.gemini, enabled: true }));
3574
- }
3575
- if (config.fal?.apiKey) {
3576
- factory.register(new FalProvider({ ...config.fal, enabled: true }));
3577
- }
3578
- if (config.pruna?.apiKey) {
3579
- factory.register(new PrunaProvider({ ...config.pruna, enabled: true }));
3580
- }
3581
- return factory;
3582
- }
3583
-
3584
- // src/content/domain/limits/SpeechPaceConfig.ts
3585
- var SpeechPaceConfig = {
3586
- WORDS_PER_SECOND: 2.5,
3587
- TOKENS_PER_SECOND: 10,
3588
- JSON_TOKEN_OVERHEAD: 500,
3589
- TOKENS_PER_CALENDAR_DAY: 150
3590
- };
3591
-
3592
- // src/content/domain/calculations/SpeechPaceEstimate.ts
3593
- function estimateWordCountForDuration(durationSeconds) {
3594
- return Math.floor(durationSeconds * SpeechPaceConfig.WORDS_PER_SECOND);
3595
- }
3596
- function estimateTokenBudgetForDuration(durationSeconds) {
3597
- return durationSeconds * SpeechPaceConfig.TOKENS_PER_SECOND + SpeechPaceConfig.JSON_TOKEN_OVERHEAD;
3598
- }
3599
- function estimateTokenBudgetForCalendarDays(days) {
3600
- return days * SpeechPaceConfig.TOKENS_PER_CALENDAR_DAY + SpeechPaceConfig.JSON_TOKEN_OVERHEAD;
3829
+ }
3830
+ if (config.groq?.apiKey) {
3831
+ factory.register(new GroqProvider(config.groq));
3832
+ }
3833
+ if (config.gemini?.apiKey) {
3834
+ factory.register(new GeminiProvider({ ...config.gemini, enabled: true }));
3835
+ }
3836
+ if (config.fal?.apiKey) {
3837
+ factory.register(new FalProvider({ ...config.fal, enabled: true }));
3838
+ }
3839
+ if (config.pruna?.apiKey) {
3840
+ factory.register(new PrunaProvider({ ...config.pruna, enabled: true }));
3841
+ }
3842
+ return factory;
3601
3843
  }
3602
3844
 
3603
3845
  // src/content/application/prompts/PromptBuilder.ts
@@ -3910,75 +4152,6 @@ Return only the JSON:
3910
4152
  }
3911
4153
  };
3912
4154
 
3913
- // src/content/domain/limits/ValidationLimits.ts
3914
- var ValidationLimits = {
3915
- TOPIC: {
3916
- MIN: 1,
3917
- MAX: 500
3918
- },
3919
- CONTENT: {
3920
- MIN: 1,
3921
- MAX: 1e4
3922
- },
3923
- KEYWORD: {
3924
- MAX_COUNT: 20,
3925
- MAX_LENGTH: 50
3926
- },
3927
- DURATION_SECONDS: {
3928
- MIN: 10,
3929
- MAX: 600
3930
- },
3931
- CALENDAR_DAYS: {
3932
- MIN: 1,
3933
- MAX: 90
3934
- },
3935
- HASHTAG_COUNT: {
3936
- MIN: 1,
3937
- MAX: 50
3938
- },
3939
- SEO_CONTENT_PREVIEW: 500,
3940
- BLOG_PROMPT_PREVIEW: 1e3,
3941
- AB_VARIANT_CONTENT_PREVIEW: 200
3942
- };
3943
-
3944
- // src/content/domain/validation/TopicTextValidator.ts
3945
- function validateTopicText(topic) {
3946
- if (typeof topic !== "string" || topic.trim().length < ValidationLimits.TOPIC.MIN) {
3947
- throw new ValidationError("Topic cannot be empty");
3948
- }
3949
- const trimmed = topic.trim();
3950
- if (trimmed.length > ValidationLimits.TOPIC.MAX) {
3951
- throw new ValidationError(`Topic exceeds maximum length of ${ValidationLimits.TOPIC.MAX} characters`);
3952
- }
3953
- return trimmed;
3954
- }
3955
-
3956
- // src/content/domain/validation/KeywordListValidator.ts
3957
- function validateKeywordList(keywords) {
3958
- if (!Array.isArray(keywords)) {
3959
- throw new ValidationError("Keywords must be an array");
3960
- }
3961
- if (keywords.length > ValidationLimits.KEYWORD.MAX_COUNT) {
3962
- throw new ValidationError(`Cannot process more than ${ValidationLimits.KEYWORD.MAX_COUNT} keywords`);
3963
- }
3964
- return keywords.filter((k) => typeof k === "string" && k.trim().length > 0).map((keyword) => {
3965
- const trimmed = keyword.trim();
3966
- if (trimmed.length > ValidationLimits.KEYWORD.MAX_LENGTH) {
3967
- const preview = trimmed.substring(0, 20);
3968
- throw new ValidationError(
3969
- `Keyword "${preview}..." exceeds maximum length of ${ValidationLimits.KEYWORD.MAX_LENGTH} characters`
3970
- );
3971
- }
3972
- return trimmed;
3973
- });
3974
- }
3975
-
3976
- // src/content/domain/utils/IdGenerator.ts
3977
- function generateId(prefix) {
3978
- const id = typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 11)}`;
3979
- return prefix ? `${prefix}-${id}` : id;
3980
- }
3981
-
3982
4155
  // src/content/application/services/BlogService.ts
3983
4156
  var BlogService = class {
3984
4157
  constructor(executor) {
@@ -4015,6 +4188,17 @@ var BlogService = class {
4015
4188
  };
4016
4189
  }
4017
4190
  };
4191
+
4192
+ // src/content/infrastructure/utils/requestQueue.ts
4193
+ ({
4194
+ maxConcurrent: RequestQueueConfig.MAX_CONCURRENT,
4195
+ maxQueueSize: RequestQueueConfig.MAX_QUEUE_SIZE,
4196
+ defaultTimeout: RequestQueueConfig.DEFAULT_TIMEOUT_MS,
4197
+ retryDelay: RequestQueueConfig.RETRY_DELAY_MS,
4198
+ enableRateLimit: RequestQueueConfig.RATE_LIMIT.ENABLED,
4199
+ rateLimitWindow: RequestQueueConfig.RATE_LIMIT.WINDOW_MS,
4200
+ rateLimitMaxRequests: RequestQueueConfig.RATE_LIMIT.MAX_REQUESTS_PER_WINDOW
4201
+ });
4018
4202
  async function batchRequest(requests, options = {}) {
4019
4203
  const {
4020
4204
  concurrency = 3,
@@ -4046,21 +4230,6 @@ async function batchRequest(requests, options = {}) {
4046
4230
  return results;
4047
4231
  }
4048
4232
 
4049
- // src/content/domain/validation/HashtagCountValidator.ts
4050
- function validateHashtagCount(count) {
4051
- if (!Number.isFinite(count)) {
4052
- throw new ValidationError(
4053
- `Hashtag count must be between ${ValidationLimits.HASHTAG_COUNT.MIN} and ${ValidationLimits.HASHTAG_COUNT.MAX}`
4054
- );
4055
- }
4056
- if (count < ValidationLimits.HASHTAG_COUNT.MIN || count > ValidationLimits.HASHTAG_COUNT.MAX) {
4057
- throw new ValidationError(
4058
- `Hashtag count must be between ${ValidationLimits.HASHTAG_COUNT.MIN} and ${ValidationLimits.HASHTAG_COUNT.MAX}`
4059
- );
4060
- }
4061
- return Math.floor(count);
4062
- }
4063
-
4064
4233
  // src/content/application/services/SocialService.ts
4065
4234
  var MULTI_PLATFORMS = [
4066
4235
  "twitter",
@@ -4138,21 +4307,6 @@ var SocialService = class {
4138
4307
  }
4139
4308
  };
4140
4309
 
4141
- // src/content/domain/validation/DurationSecondsValidator.ts
4142
- function validateDurationSeconds(duration) {
4143
- if (!Number.isFinite(duration)) {
4144
- throw new ValidationError(
4145
- `Duration must be between ${ValidationLimits.DURATION_SECONDS.MIN} and ${ValidationLimits.DURATION_SECONDS.MAX} seconds`
4146
- );
4147
- }
4148
- if (duration < ValidationLimits.DURATION_SECONDS.MIN || duration > ValidationLimits.DURATION_SECONDS.MAX) {
4149
- throw new ValidationError(
4150
- `Duration must be between ${ValidationLimits.DURATION_SECONDS.MIN} and ${ValidationLimits.DURATION_SECONDS.MAX} seconds`
4151
- );
4152
- }
4153
- return duration;
4154
- }
4155
-
4156
4310
  // src/content/application/services/VideoScriptService.ts
4157
4311
  var buildScriptResult = (parsed, duration) => {
4158
4312
  const script = parsed.script ?? "";
@@ -4207,27 +4361,6 @@ var VideoScriptService = class {
4207
4361
  }
4208
4362
  };
4209
4363
 
4210
- // src/content/domain/validation/ContentBodyValidator.ts
4211
- function validateContentBody(content) {
4212
- if (typeof content !== "string" || content.trim().length < ValidationLimits.CONTENT.MIN) {
4213
- throw new ValidationError("Content cannot be empty");
4214
- }
4215
- const trimmed = content.trim();
4216
- if (trimmed.length > ValidationLimits.CONTENT.MAX) {
4217
- throw new ValidationError(`Content exceeds maximum length of ${ValidationLimits.CONTENT.MAX} characters`);
4218
- }
4219
- return trimmed;
4220
- }
4221
- function truncateForSeoPreview(content) {
4222
- return content.substring(0, ValidationLimits.SEO_CONTENT_PREVIEW);
4223
- }
4224
- function truncateForBlogPromptPreview(content) {
4225
- return content.substring(0, ValidationLimits.BLOG_PROMPT_PREVIEW);
4226
- }
4227
- function truncateForAbVariantPreview(content) {
4228
- return content.substring(0, ValidationLimits.AB_VARIANT_CONTENT_PREVIEW);
4229
- }
4230
-
4231
4364
  // src/content/application/services/AnalysisService.ts
4232
4365
  var DEFAULT_SENTIMENT = {
4233
4366
  sentiment: "neutral",
@@ -4280,23 +4413,6 @@ var AnalysisService = class {
4280
4413
  }
4281
4414
  };
4282
4415
 
4283
- // src/content/domain/calculations/SeoKeywordDensity.ts
4284
- function countKeywordOccurrences(content, keyword) {
4285
- if (!keyword) return 0;
4286
- const escaped = keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4287
- const matches = content.match(new RegExp(escaped, "gi"));
4288
- return matches ? matches.length : 0;
4289
- }
4290
- function countWordsInContent(content) {
4291
- const tokens = content.split(/\s+/).filter(Boolean);
4292
- return tokens.length || 1;
4293
- }
4294
- function calculateKeywordDensity(content, keyword) {
4295
- const totalWords = countWordsInContent(content);
4296
- const occurrences = countKeywordOccurrences(content, keyword);
4297
- return occurrences / totalWords * 100;
4298
- }
4299
-
4300
4416
  // src/content/application/services/SeoService.ts
4301
4417
  var DEFAULT_SEO_SCORE = {
4302
4418
  keywordDensity: 50,
@@ -4373,20 +4489,6 @@ var SeoService = class {
4373
4489
  }
4374
4490
  };
4375
4491
 
4376
- // src/content/domain/calculations/AbTestImprovementRatio.ts
4377
- function calculateImprovementPercentage(scoreA, scoreB) {
4378
- const higher = Math.max(scoreA, scoreB);
4379
- const lower = Math.min(scoreA, scoreB);
4380
- if (lower <= 0) {
4381
- return "100";
4382
- }
4383
- const delta = (higher / lower - 1) * 100;
4384
- return Math.abs(delta).toFixed(0);
4385
- }
4386
- function selectHigherScoreVariantId(scoreA, scoreB, idA = "A", idB = "B") {
4387
- return scoreA > scoreB ? idA : idB;
4388
- }
4389
-
4390
4492
  // src/content/application/services/ABTestService.ts
4391
4493
  var DEFAULT_PREDICTION = {
4392
4494
  variantId: "",
@@ -4488,27 +4590,6 @@ var ImagePromptService = class {
4488
4590
  }
4489
4591
  };
4490
4592
 
4491
- // src/content/domain/validation/CalendarDaysValidator.ts
4492
- function validateCalendarDays(days) {
4493
- if (!Number.isFinite(days)) {
4494
- throw new ValidationError(
4495
- `Days must be between ${ValidationLimits.CALENDAR_DAYS.MIN} and ${ValidationLimits.CALENDAR_DAYS.MAX}`
4496
- );
4497
- }
4498
- if (days < ValidationLimits.CALENDAR_DAYS.MIN || days > ValidationLimits.CALENDAR_DAYS.MAX) {
4499
- throw new ValidationError(
4500
- `Days must be between ${ValidationLimits.CALENDAR_DAYS.MIN} and ${ValidationLimits.CALENDAR_DAYS.MAX}`
4501
- );
4502
- }
4503
- return days;
4504
- }
4505
-
4506
- // src/content/domain/calculations/ContentCalendarDateOffset.ts
4507
- var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
4508
- function resolveCalendarEntryDate(dayIndex, baseTimestamp = Date.now()) {
4509
- return new Date(baseTimestamp + (dayIndex - 1) * ONE_DAY_MS);
4510
- }
4511
-
4512
4593
  // src/content/application/services/ContentCalendarService.ts
4513
4594
  var toCalendarEntry = (item) => ({
4514
4595
  date: resolveCalendarEntryDate(item.day),
@@ -4819,35 +4900,313 @@ var AIContentService = class {
4819
4900
  }
4820
4901
  };
4821
4902
 
4903
+ // src/wizard/content.wizard.ts
4904
+ var CONTENT_WIZARD_STEPS = [
4905
+ {
4906
+ id: "select-type",
4907
+ label: "Select Type",
4908
+ icon: "Layers",
4909
+ description: "Choose the type of content you want to generate",
4910
+ validate: (data) => Boolean(data.contentType)
4911
+ },
4912
+ {
4913
+ id: "input-topic",
4914
+ label: "Topic",
4915
+ icon: "Lightbulb",
4916
+ description: "Enter your topic or idea",
4917
+ validate: (data) => {
4918
+ const topic = data.topic;
4919
+ return typeof topic === "string" && topic.length > 0;
4920
+ }
4921
+ },
4922
+ {
4923
+ id: "configure",
4924
+ label: "Configure",
4925
+ icon: "Settings",
4926
+ description: "Set tone, audience, and platform",
4927
+ validate: (data) => {
4928
+ const d = data;
4929
+ return Boolean(d.tone && d.targetAudience);
4930
+ }
4931
+ },
4932
+ {
4933
+ id: "advanced",
4934
+ label: "Advanced",
4935
+ icon: "Sliders",
4936
+ description: "Additional options and optimizations",
4937
+ optional: true
4938
+ },
4939
+ {
4940
+ id: "preview",
4941
+ label: "Preview",
4942
+ icon: "Eye",
4943
+ description: "Review your settings before generation"
4944
+ },
4945
+ {
4946
+ id: "generating",
4947
+ label: "Generating",
4948
+ icon: "Sparkles",
4949
+ description: "AI is generating your content"
4950
+ },
4951
+ {
4952
+ id: "results",
4953
+ label: "Results",
4954
+ icon: "CheckCircle",
4955
+ description: "Your generated content is ready"
4956
+ }
4957
+ ];
4958
+ function buildContentRequest(data) {
4959
+ switch (data.contentType) {
4960
+ case "blog":
4961
+ return {
4962
+ topic: data.topic ?? "",
4963
+ blogType: "tutorial",
4964
+ targetKeywords: data.keywords ?? [],
4965
+ tone: data.tone ?? "professional",
4966
+ wordCount: data.wordCount ?? 1e3,
4967
+ targetAudience: data.targetAudience ?? "",
4968
+ seoOptimization: data.seoOptimization ?? false,
4969
+ includeImages: data.includeImages ?? false,
4970
+ includeSchema: false
4971
+ };
4972
+ case "social":
4973
+ return {
4974
+ topic: data.topic ?? "",
4975
+ platform: data.platform ?? "twitter",
4976
+ tone: data.tone ?? "casual",
4977
+ hashtags: true,
4978
+ targetAudience: data.targetAudience,
4979
+ includeCallToAction: data.includeCallToAction
4980
+ };
4981
+ case "script":
4982
+ return {
4983
+ topic: data.topic ?? "",
4984
+ tone: data.tone ?? "professional",
4985
+ duration: data.duration ?? 60,
4986
+ targetAudience: data.targetAudience ?? "",
4987
+ includeVisuals: true,
4988
+ includeCallToAction: data.includeCallToAction ?? false
4989
+ };
4990
+ default:
4991
+ throw new Error(`Unsupported content type: ${data.contentType}`);
4992
+ }
4993
+ }
4994
+
4995
+ // src/wizard/image.wizard.ts
4996
+ var IMAGE_WIZARD_STEPS = [
4997
+ {
4998
+ id: "input-prompt",
4999
+ label: "Describe Image",
5000
+ icon: "Image",
5001
+ description: "Describe the image you want to create",
5002
+ validate: (data) => {
5003
+ const prompt = data.prompt;
5004
+ return typeof prompt === "string" && prompt.length > 0;
5005
+ }
5006
+ },
5007
+ {
5008
+ id: "select-style",
5009
+ label: "Style",
5010
+ icon: "Palette",
5011
+ description: "Choose the artistic style",
5012
+ validate: (data) => Boolean(data.style)
5013
+ },
5014
+ {
5015
+ id: "configure",
5016
+ label: "Configure",
5017
+ icon: "Settings",
5018
+ description: "Set format, quality, and quantity",
5019
+ validate: (data) => {
5020
+ const d = data;
5021
+ return Boolean(d.format && d.quality);
5022
+ }
5023
+ },
5024
+ {
5025
+ id: "advanced",
5026
+ label: "Advanced",
5027
+ icon: "Sliders",
5028
+ description: "Color palette and platform optimization",
5029
+ optional: true
5030
+ },
5031
+ { id: "preview", label: "Preview", icon: "Eye", description: "Review your settings" },
5032
+ { id: "generating", label: "Generating", icon: "Sparkles", description: "AI is creating your image" },
5033
+ { id: "results", label: "Results", icon: "Image", description: "Your generated image is ready" }
5034
+ ];
5035
+ function buildImageRequest(data) {
5036
+ return {
5037
+ type: "image",
5038
+ prompt: data.prompt ?? "",
5039
+ style: data.style,
5040
+ format: data.format,
5041
+ quality: data.quality,
5042
+ quantity: data.quantity ?? 1
5043
+ };
5044
+ }
5045
+
5046
+ // src/wizard/video.wizard.ts
5047
+ var validateSource = (data) => {
5048
+ const d = data;
5049
+ if (d.generationType === "text-to-video") {
5050
+ return typeof d.prompt === "string" && d.prompt.length > 0;
5051
+ }
5052
+ if (d.generationType === "image-to-video") {
5053
+ return typeof d.imageUrl === "string" && d.imageUrl.length > 0;
5054
+ }
5055
+ if (d.generationType === "video-to-video") {
5056
+ return typeof d.sourceVideoUrl === "string" && d.sourceVideoUrl.length > 0 && typeof d.prompt === "string" && d.prompt.length > 0;
5057
+ }
5058
+ return false;
5059
+ };
5060
+ var VIDEO_WIZARD_STEPS = [
5061
+ {
5062
+ id: "select-type",
5063
+ label: "Select Type",
5064
+ icon: "Video",
5065
+ description: "Choose video generation type",
5066
+ validate: (data) => Boolean(data.generationType)
5067
+ },
5068
+ {
5069
+ id: "input-source",
5070
+ label: "Source",
5071
+ icon: "FileInput",
5072
+ description: "Provide your source (prompt, image, or video)",
5073
+ validate: validateSource
5074
+ },
5075
+ {
5076
+ id: "configure",
5077
+ label: "Configure",
5078
+ icon: "Settings",
5079
+ description: "Set duration, aspect ratio, and style",
5080
+ validate: (data) => {
5081
+ const d = data;
5082
+ return Boolean(d.duration && d.aspectRatio);
5083
+ }
5084
+ },
5085
+ { id: "advanced", label: "Advanced", icon: "Sliders", description: "Additional video options", optional: true },
5086
+ { id: "preview", label: "Preview", icon: "Eye", description: "Review your settings" },
5087
+ { id: "generating", label: "Generating", icon: "Sparkles", description: "AI is creating your video" },
5088
+ { id: "results", label: "Results", icon: "Video", description: "Your generated video is ready" }
5089
+ ];
5090
+ function buildVideoRequest(data) {
5091
+ switch (data.generationType) {
5092
+ case "text-to-video":
5093
+ return {
5094
+ type: "video",
5095
+ prompt: data.prompt ?? "",
5096
+ duration: data.duration ?? 5,
5097
+ aspectRatio: data.aspectRatio ?? "16:9",
5098
+ style: data.style,
5099
+ quality: data.quality
5100
+ };
5101
+ case "image-to-video":
5102
+ return {
5103
+ type: "video",
5104
+ imageUrl: data.imageUrl ?? "",
5105
+ prompt: data.prompt,
5106
+ duration: data.duration ?? 5,
5107
+ motion: data.motion ?? "medium",
5108
+ camera: data.camera ?? "static"
5109
+ };
5110
+ case "video-to-video":
5111
+ return {
5112
+ type: "video",
5113
+ sourceVideoUrl: data.sourceVideoUrl ?? "",
5114
+ prompt: data.prompt ?? "",
5115
+ styleTransfer: data.styleTransfer,
5116
+ enhanceQuality: data.enhanceQuality
5117
+ };
5118
+ default:
5119
+ throw new Error(`Unsupported generation type: ${data.generationType}`);
5120
+ }
5121
+ }
5122
+
4822
5123
  exports.ABTestService = ABTestService;
5124
+ exports.AB_TEST_DEFAULT_CONFIDENCE = AB_TEST_DEFAULT_CONFIDENCE;
4823
5125
  exports.AIContentService = AIContentService;
4824
5126
  exports.AIError = AIError;
4825
5127
  exports.ASPECT_RATIO_OPTIONS = ASPECT_RATIO_OPTIONS;
4826
5128
  exports.ASPECT_RATIO_VALUES = ASPECT_RATIO_VALUES;
4827
5129
  exports.AnalysisService = AnalysisService;
4828
5130
  exports.BlogService = BlogService;
5131
+ exports.CONTENT_WIZARD_STEPS = CONTENT_WIZARD_STEPS;
5132
+ exports.CREDIT_COSTS = CREDIT_COSTS;
4829
5133
  exports.ContentCalendarService = ContentCalendarService;
5134
+ exports.DEFAULT_CREDIT_COST = DEFAULT_CREDIT_COST;
5135
+ exports.DEFAULT_HASHTAG_BUDGET = DEFAULT_HASHTAG_BUDGET;
4830
5136
  exports.GENERATION_COSTS = CREDIT_COSTS;
4831
5137
  exports.GenerationExecutor = GenerationExecutor;
4832
5138
  exports.IMAGE_QUALITY_OPTIONS = IMAGE_QUALITY_OPTIONS;
4833
5139
  exports.IMAGE_QUALITY_VALUES = IMAGE_QUALITY_VALUES;
5140
+ exports.IMAGE_WIZARD_STEPS = IMAGE_WIZARD_STEPS;
4834
5141
  exports.ImagePromptService = ImagePromptService;
4835
5142
  exports.MOTION_OPTIONS = MOTION_OPTIONS;
4836
5143
  exports.MediaGenerationService = MediaGenerationService;
5144
+ exports.MemoryConfig = MemoryConfig;
5145
+ exports.ModelDefaults = ModelDefaults;
5146
+ exports.PLATFORM_SPECS = PLATFORM_SPECS;
4837
5147
  exports.PromptBuilder = PromptBuilder;
4838
5148
  exports.ProviderQuotaExhaustedError = ProviderQuotaExhaustedError;
5149
+ exports.ProviderTimingConfig = ProviderTimingConfig;
4839
5150
  exports.ProviderUnavailableError = ProviderUnavailableError;
5151
+ exports.RequestQueueConfig = RequestQueueConfig;
4840
5152
  exports.STYLE_PRESETS = STYLE_PRESETS;
4841
5153
  exports.SeoService = SeoService;
4842
5154
  exports.SocialService = SocialService;
5155
+ exports.SpeechPaceConfig = SpeechPaceConfig;
5156
+ exports.TextModelDefaults = TextModelDefaults;
4843
5157
  exports.VIDEO_DURATION_OPTIONS = VIDEO_DURATION_OPTIONS;
4844
5158
  exports.VIDEO_DURATION_OPTIONS_SECONDS = VIDEO_DURATION_OPTIONS_SECONDS;
4845
5159
  exports.VIDEO_QUALITY_OPTIONS = VIDEO_QUALITY_OPTIONS;
4846
5160
  exports.VIDEO_QUALITY_VALUES = VIDEO_QUALITY_VALUES;
5161
+ exports.VIDEO_WIZARD_STEPS = VIDEO_WIZARD_STEPS;
4847
5162
  exports.ValidationError = ValidationError;
5163
+ exports.ValidationLimits = ValidationLimits;
4848
5164
  exports.VideoScriptService = VideoScriptService;
5165
+ exports.buildContentRequest = buildContentRequest;
5166
+ exports.buildImageRequest = buildImageRequest;
5167
+ exports.buildVideoRequest = buildVideoRequest;
5168
+ exports.calculateContentCreditCost = calculateContentCreditCost;
4849
5169
  exports.calculateCreditCost = calculateContentCreditCost;
5170
+ exports.calculateImprovementPercentage = calculateImprovementPercentage;
5171
+ exports.calculateKeywordDensity = calculateKeywordDensity;
5172
+ exports.calculateRetryBackoffDelayMs = calculateRetryBackoffDelayMs;
5173
+ exports.clampConfidenceToValidRange = clampConfidenceToValidRange;
5174
+ exports.clampScoreToValidRange = clampScoreToValidRange;
5175
+ exports.classifyKeywordProminence = classifyKeywordProminence;
5176
+ exports.countKeywordOccurrences = countKeywordOccurrences;
5177
+ exports.countWordsInContent = countWordsInContent;
5178
+ exports.estimateFalGenerationCost = estimateFalGenerationCost;
5179
+ exports.estimateGeminiGenerationCost = estimateGeminiGenerationCost;
5180
+ exports.estimateGroqGenerationCost = estimateGroqGenerationCost;
5181
+ exports.estimatePrunaGenerationCost = estimatePrunaGenerationCost;
5182
+ exports.estimateTokenBudgetForCalendarDays = estimateTokenBudgetForCalendarDays;
5183
+ exports.estimateTokenBudgetForDuration = estimateTokenBudgetForDuration;
5184
+ exports.estimateUnknownProviderCost = estimateUnknownProviderCost;
5185
+ exports.estimateWordCountForDuration = estimateWordCountForDuration;
5186
+ exports.generateId = generateId;
4850
5187
  exports.getDimensionsForAspectRatio = getDimensionsForAspectRatio;
4851
5188
  exports.getRecommendedQuality = getRecommendedQuality;
5189
+ exports.isUnderutilizedKeyword = isUnderutilizedKeyword;
5190
+ exports.rankAndTrimHashtags = rankAndTrimHashtags;
5191
+ exports.recommendQualityForAspectRatio = recommendQualityForAspectRatio;
5192
+ exports.resolveCalendarEntryDate = resolveCalendarEntryDate;
5193
+ exports.resolveDefaultPrunaModel = resolveDefaultPrunaModel;
5194
+ exports.resolveDimensionsForAspectRatio = resolveDimensionsForAspectRatio;
5195
+ exports.resolveFalImageSize = resolveFalImageSize;
5196
+ exports.resolveFalInferenceSteps = resolveFalInferenceSteps;
5197
+ exports.resolveHashtagBudget = resolveHashtagBudget;
5198
+ exports.resolveMaxContentLength = resolveMaxContentLength;
5199
+ exports.resolvePlatformSpec = resolvePlatformSpec;
5200
+ exports.selectHigherScoreVariantId = selectHigherScoreVariantId;
5201
+ exports.toQualityTier = toQualityTier;
5202
+ exports.truncateForAbVariantPreview = truncateForAbVariantPreview;
5203
+ exports.truncateForBlogPromptPreview = truncateForBlogPromptPreview;
5204
+ exports.truncateForSeoPreview = truncateForSeoPreview;
5205
+ exports.validateCalendarDays = validateCalendarDays;
5206
+ exports.validateContentBody = validateContentBody;
5207
+ exports.validateDurationSeconds = validateDurationSeconds;
5208
+ exports.validateHashtagCount = validateHashtagCount;
5209
+ exports.validateKeywordList = validateKeywordList;
5210
+ exports.validateTopicText = validateTopicText;
4852
5211
  //# sourceMappingURL=index.cjs.map
4853
5212
  //# sourceMappingURL=index.cjs.map