vibebusiness 1.2.49 → 1.2.53

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 (101) hide show
  1. package/.next/standalone/.env +1 -1
  2. package/.next/standalone/.next/BUILD_ID +1 -1
  3. package/.next/standalone/.next/app-build-manifest.json +20 -20
  4. package/.next/standalone/.next/app-path-routes-manifest.json +1 -1
  5. package/.next/standalone/.next/build-manifest.json +4 -4
  6. package/.next/standalone/.next/prerender-manifest.json +1 -1
  7. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  8. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  9. package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
  10. package/.next/standalone/.next/server/app/api/analyze/route.js +1 -1
  11. package/.next/standalone/.next/server/app/api/analyze/route.js.nft.json +1 -1
  12. package/.next/standalone/.next/server/app/api/config/route.js.nft.json +1 -1
  13. package/.next/standalone/.next/server/app/api/epics/[id]/ideas/route.js.nft.json +1 -1
  14. package/.next/standalone/.next/server/app/api/epics/[id]/route.js.nft.json +1 -1
  15. package/.next/standalone/.next/server/app/api/epics/route.js.nft.json +1 -1
  16. package/.next/standalone/.next/server/app/api/goals/[id]/kpis/route.js.nft.json +1 -1
  17. package/.next/standalone/.next/server/app/api/goals/[id]/route.js.nft.json +1 -1
  18. package/.next/standalone/.next/server/app/api/goals/route.js.nft.json +1 -1
  19. package/.next/standalone/.next/server/app/api/hypotheses/[id]/route.js.nft.json +1 -1
  20. package/.next/standalone/.next/server/app/api/hypotheses/route.js.nft.json +1 -1
  21. package/.next/standalone/.next/server/app/api/ideas/[id]/comments/route.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/api/ideas/[id]/implement/route.js +1 -1
  23. package/.next/standalone/.next/server/app/api/ideas/[id]/implement/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/ideas/[id]/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/ideas/[id]/transition/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/ideas/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/implementations/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/kpis/refresh/route.js +1 -1
  29. package/.next/standalone/.next/server/app/api/kpis/refresh/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/provider-status/route.js +1 -0
  31. package/.next/standalone/.next/server/app/api/provider-status/route.js.nft.json +1 -0
  32. package/.next/standalone/.next/server/app/api/social/[id]/publish/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/api/social/[id]/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/api/social/route.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/goals/[id]/page_client-reference-manifest.js +1 -1
  36. package/.next/standalone/.next/server/app/goals/page.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/goals/page_client-reference-manifest.js +1 -1
  38. package/.next/standalone/.next/server/app/hypotheses/[id]/page_client-reference-manifest.js +1 -1
  39. package/.next/standalone/.next/server/app/hypotheses/page.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/hypotheses/page_client-reference-manifest.js +1 -1
  41. package/.next/standalone/.next/server/app/ideas/[id]/page.js +1 -1
  42. package/.next/standalone/.next/server/app/ideas/[id]/page.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/ideas/[id]/page_client-reference-manifest.js +1 -1
  44. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  46. package/.next/standalone/.next/server/app/roadmap/[id]/page_client-reference-manifest.js +1 -1
  47. package/.next/standalone/.next/server/app/roadmap/page.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/roadmap/page_client-reference-manifest.js +1 -1
  49. package/.next/standalone/.next/server/app/sessions/page.js.nft.json +1 -1
  50. package/.next/standalone/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  51. package/.next/standalone/.next/server/app/settings/page.js +1 -1
  52. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  53. package/.next/standalone/.next/server/app/settings.html +1 -1
  54. package/.next/standalone/.next/server/app/settings.rsc +2 -2
  55. package/.next/standalone/.next/server/app/social/page.js +1 -1
  56. package/.next/standalone/.next/server/app/social/page_client-reference-manifest.js +1 -1
  57. package/.next/standalone/.next/server/app/social.html +1 -1
  58. package/.next/standalone/.next/server/app/social.rsc +2 -2
  59. package/.next/standalone/.next/server/app-paths-manifest.json +12 -11
  60. package/.next/standalone/.next/server/chunks/3794.js +92 -17
  61. package/.next/standalone/.next/server/middleware-build-manifest.js +1 -1
  62. package/.next/standalone/.next/server/pages/404.html +1 -1
  63. package/.next/standalone/.next/server/pages/500.html +1 -1
  64. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  65. package/.next/standalone/data/business-context.json +60 -6
  66. package/.next/standalone/data/goals.json +50 -10
  67. package/.next/standalone/data/ideas.json +1278 -597
  68. package/.next/standalone/data/implementations.json +101 -0
  69. package/.next/standalone/data/posthog.json +68 -0
  70. package/.next/standalone/data/sessions.json +5 -4
  71. package/.next/standalone/data/social.json +86 -3
  72. package/.next/standalone/package.json +1 -1
  73. package/.next/standalone/scripts/analyze.ts +10 -0
  74. package/.next/standalone/scripts/implement.ts +37 -30
  75. package/.next/standalone/scripts/skills/social-media.ts +172 -2
  76. package/.next/static/chunks/59-76eecfb6e8216043.js +1 -0
  77. package/.next/static/chunks/app/goals/[id]/page-051064c3146131cc.js +1 -0
  78. package/.next/static/chunks/app/ideas/[id]/page-adaeb619cd0425e9.js +1 -0
  79. package/.next/static/chunks/app/roadmap/[id]/page-3822586c0d64fff1.js +1 -0
  80. package/.next/static/chunks/app/settings/page-2204cc936ec9474b.js +1 -0
  81. package/.next/static/chunks/app/social/page-018893f87b308651.js +1 -0
  82. package/.next/static/chunks/{main-61d2f25883998186.js → main-c99f3473a63aa803.js} +1 -1
  83. package/.next/static/css/d8bd6d69d1ff97e3.css +3 -0
  84. package/dist/bin/vibebusiness.js +12 -0
  85. package/dist/scripts/analyze.js +170 -68
  86. package/dist/scripts/chat.js +137 -36
  87. package/dist/scripts/heartbeat.js +617 -348
  88. package/dist/scripts/implement.js +218 -70
  89. package/dist/scripts/init.js +164 -16
  90. package/dist/scripts/provider.js +428 -0
  91. package/dist/scripts/scan.js +44 -5
  92. package/package.json +1 -1
  93. package/.next/static/chunks/59-a053b1c0e85128de.js +0 -1
  94. package/.next/static/chunks/app/goals/[id]/page-8dbeab5cc8cf0988.js +0 -1
  95. package/.next/static/chunks/app/ideas/[id]/page-89e3625db9017166.js +0 -1
  96. package/.next/static/chunks/app/roadmap/[id]/page-f437e783039534c4.js +0 -1
  97. package/.next/static/chunks/app/settings/page-d2d630a799b6b495.js +0 -1
  98. package/.next/static/chunks/app/social/page-69e480936711ccf2.js +0 -1
  99. package/.next/static/css/179dd3e0738c2fe4.css +0 -3
  100. /package/.next/static/{zIIaTqrawBK1MmHg37JOr → p1Sl4kPMQcYC3c1LgbNSP}/_buildManifest.js +0 -0
  101. /package/.next/static/{zIIaTqrawBK1MmHg37JOr → p1Sl4kPMQcYC3c1LgbNSP}/_ssgManifest.js +0 -0
@@ -8,6 +8,7 @@
8
8
  *
9
9
  * Task prefixes handled:
10
10
  * social-setup-x → Validate X credentials, save username
11
+ * social-plan-week → Generate a 7-day content calendar with AI-optimized drafts
11
12
  * social-draft-ship → Draft a "just shipped" tweet from latest shipped idea
12
13
  * social-draft-ship-visual → Draft ship tweet with card/video media
13
14
  * social-draft-update → Draft a product update from positioning data
@@ -24,7 +25,7 @@
24
25
  import * as fs from 'fs';
25
26
  import * as path from 'path';
26
27
  import { v4 as uuidv4 } from 'uuid';
27
- import { SOCIAL_FILE, GOALS_FILE, DATA_DIR } from '../lib/paths';
28
+ import { SOCIAL_FILE, GOALS_FILE, IDEAS_FILE, POSITIONING_FILE, DATA_DIR } from '../lib/paths';
28
29
  import {
29
30
  loadCredentials,
30
31
  createXClient,
@@ -45,10 +46,11 @@ import {
45
46
  import {
46
47
  generateViralTweet,
47
48
  generateViralThread,
49
+ generateWeekPlan,
48
50
  scoreDraft,
49
51
  type TweetTopic,
50
52
  } from '../lib/social/ai-content-generator';
51
- import type { SocialConfig, SocialDraft, SocialDraftSource, TweetEngagement, BusinessGoal } from '../../src/lib/types';
53
+ import type { SocialConfig, SocialDraft, SocialDraftSource, TweetEngagement, BusinessGoal, PositioningData } from '../../src/lib/types';
52
54
 
53
55
  // ─── State ───────────────────────────────────────────────────────────────────
54
56
 
@@ -159,6 +161,7 @@ function createDraft(
159
161
 
160
162
  const SOCIAL_PREFIXES = [
161
163
  'social-setup-x',
164
+ 'social-plan-week',
162
165
  'social-draft-ship-visual',
163
166
  'social-draft-ship',
164
167
  'social-draft-update',
@@ -191,6 +194,9 @@ export async function executeSocialTask(
191
194
  if (taskId === 'social-setup-x') {
192
195
  return await executeSetupX();
193
196
  }
197
+ if (taskId === 'social-plan-week') {
198
+ return await executePlanWeek();
199
+ }
194
200
  if (taskId === 'social-draft-ship-visual') {
195
201
  return executeDraftShipVisual();
196
202
  }
@@ -251,6 +257,7 @@ export function readSocialFreshness(): {
251
257
  best_tweet_id: string | null;
252
258
  best_engagement_rate: number | null;
253
259
  thread_count: number;
260
+ scheduled_draft_count: number;
254
261
  } {
255
262
  const state = loadState();
256
263
  const pendingDrafts = state.drafts.filter((d) => d.status === 'draft').length;
@@ -278,6 +285,12 @@ export function readSocialFreshness(): {
278
285
 
279
286
  const threadCount = state.drafts.filter((d) => d.is_thread && d.status === 'published').length;
280
287
 
288
+ // Count drafts with future scheduled dates
289
+ const today = new Date().toISOString().split('T')[0];
290
+ const scheduledDraftCount = state.drafts.filter(
291
+ (d) => d.status === 'draft' && d.scheduled_date && d.scheduled_date >= today
292
+ ).length;
293
+
281
294
  return {
282
295
  configured: state.credentials_valid,
283
296
  credentials_valid: state.credentials_valid,
@@ -290,6 +303,7 @@ export function readSocialFreshness(): {
290
303
  best_tweet_id: bestTweetId,
291
304
  best_engagement_rate: bestEngagementRate,
292
305
  thread_count: threadCount,
306
+ scheduled_draft_count: scheduledDraftCount,
293
307
  };
294
308
  }
295
309
 
@@ -616,6 +630,161 @@ async function executeDraftThread(
616
630
  };
617
631
  }
618
632
 
633
+ // ─── Weekly Content Plan ─────────────────────────────────────────────────
634
+
635
+ async function executePlanWeek(): Promise<{ success: boolean; output: string }> {
636
+ const state = loadState();
637
+
638
+ // Gather context for the AI planner
639
+ const pastPerformance = collectEngagementHistory(state);
640
+
641
+ // Read positioning data
642
+ let positioning: PositioningData | null = null;
643
+ try {
644
+ if (fs.existsSync(POSITIONING_FILE)) {
645
+ positioning = JSON.parse(fs.readFileSync(POSITIONING_FILE, 'utf-8'));
646
+ }
647
+ } catch { /* ignore */ }
648
+
649
+ // Read goals for behind-schedule context
650
+ let goalsContext = '';
651
+ try {
652
+ if (fs.existsSync(GOALS_FILE)) {
653
+ const { goals } = JSON.parse(fs.readFileSync(GOALS_FILE, 'utf-8')) as { goals: BusinessGoal[] };
654
+ const relevant = goals
655
+ .filter((g) => g.status === 'on_track' || g.status === 'at_risk' || g.status === 'behind')
656
+ .map((g) => {
657
+ const progress = g.current_value != null && g.target_value
658
+ ? `${Math.round((g.current_value / g.target_value) * 100)}%`
659
+ : 'unknown';
660
+ return `- ${g.title} (${g.status}, ${progress} complete, deadline: ${g.deadline})`;
661
+ });
662
+ goalsContext = relevant.length > 0 ? relevant.join('\n') : 'No active goals.';
663
+ }
664
+ } catch { /* ignore */ }
665
+
666
+ // Read recently shipped ideas (last 14 days)
667
+ let recentShips = '';
668
+ try {
669
+ if (fs.existsSync(IDEAS_FILE)) {
670
+ const { ideas } = JSON.parse(fs.readFileSync(IDEAS_FILE, 'utf-8')) as {
671
+ ideas: Array<{ id: string; title: string; stage: string; updated_at: string }>;
672
+ };
673
+ const twoWeeksAgo = new Date(Date.now() - 14 * 24 * 60 * 60 * 1000).toISOString();
674
+ const shipped = ideas
675
+ .filter((i) => i.stage === 'shipped' && i.updated_at > twoWeeksAgo)
676
+ .map((i) => `- ${i.title} (shipped ${i.updated_at.split('T')[0]})`);
677
+ recentShips = shipped.length > 0 ? shipped.join('\n') : 'No recent ships.';
678
+ }
679
+ } catch { /* ignore */ }
680
+
681
+ // KPI highlights
682
+ let kpiHighlights = '';
683
+ try {
684
+ if (fs.existsSync(GOALS_FILE)) {
685
+ const { goals } = JSON.parse(fs.readFileSync(GOALS_FILE, 'utf-8')) as { goals: BusinessGoal[] };
686
+ const highlights: string[] = [];
687
+ for (const goal of goals) {
688
+ for (const kpi of goal.kpis) {
689
+ if (kpi.current_value != null && kpi.target_value != null) {
690
+ const pct = Math.round((kpi.current_value / kpi.target_value) * 100);
691
+ highlights.push(`- ${kpi.name}: ${kpi.current_value}/${kpi.target_value} ${kpi.unit} (${pct}%)`);
692
+ }
693
+ }
694
+ }
695
+ kpiHighlights = highlights.length > 0 ? highlights.join('\n') : 'No KPI data.';
696
+ }
697
+ } catch { /* ignore */ }
698
+
699
+ const plan = await generateWeekPlan({
700
+ positioning,
701
+ pastPerformance,
702
+ goalsContext,
703
+ recentShips,
704
+ kpiHighlights,
705
+ });
706
+
707
+ if (plan.days.length === 0) {
708
+ return { success: false, output: 'AI failed to generate a weekly content plan.' };
709
+ }
710
+
711
+ // Create drafts for each non-rest day
712
+ const createdDrafts: Array<{ day: string; date: string; type: string; id: string }> = [];
713
+
714
+ for (const day of plan.days) {
715
+ if (day.type === 'rest' || !day.content) continue;
716
+
717
+ if (day.type === 'thread' && day.thread_tweets && day.thread_tweets.length > 0) {
718
+ // Thread draft
719
+ const draft: SocialDraft = {
720
+ id: `draft-${uuidv4().slice(0, 8)}`,
721
+ text: day.thread_tweets[0],
722
+ source: 'thread',
723
+ source_ref: null,
724
+ status: 'draft',
725
+ created_at: new Date().toISOString(),
726
+ published_at: null,
727
+ tweet_id: null,
728
+ tweet_url: null,
729
+ is_thread: true,
730
+ thread_tweets: day.thread_tweets,
731
+ scheduled_date: day.date,
732
+ };
733
+ state.drafts.push(draft);
734
+ createdDrafts.push({ day: day.day, date: day.date, type: 'thread', id: draft.id });
735
+ } else {
736
+ // Single tweet draft
737
+ const source: SocialDraftSource = (['ship', 'milestone', 'update', 'digest', 'insight'].includes(day.topic as string)
738
+ ? day.topic
739
+ : 'insight') as SocialDraftSource;
740
+ const draft = createDraft(state, day.content, source, null);
741
+ draft.scheduled_date = day.date;
742
+ createdDrafts.push({ day: day.day, date: day.date, type: day.type, id: draft.id });
743
+ }
744
+ }
745
+
746
+ saveState(state);
747
+
748
+ // Format calendar output
749
+ const monday = plan.days.find((d) => d.day === 'monday')?.date ?? '';
750
+ const sunday = plan.days.find((d) => d.day === 'sunday')?.date ?? '';
751
+ const dateRange = monday && sunday
752
+ ? `${formatDateShort(monday)} - ${formatDateShort(sunday)}`
753
+ : 'This Week';
754
+
755
+ const lines: string[] = [`Weekly Content Plan (${dateRange})`, ''];
756
+
757
+ for (const day of plan.days) {
758
+ const dayLabel = day.day.charAt(0).toUpperCase() + day.day.slice(1, 3);
759
+ if (day.type === 'rest') {
760
+ lines.push(`${dayLabel} -- Rest`);
761
+ } else {
762
+ const threadInfo = day.type === 'thread' && day.thread_tweets
763
+ ? ` (${day.thread_tweets.length} tweets)`
764
+ : '';
765
+ const preview = day.content.length > 60
766
+ ? `"${day.content.slice(0, 57)}..."`
767
+ : `"${day.content}"`;
768
+ lines.push(`${dayLabel} [${day.type}] ${preview}${threadInfo}`);
769
+ lines.push(` Hook: ${day.hook_type} | ${day.rationale}`);
770
+ }
771
+ }
772
+
773
+ lines.push('');
774
+ lines.push(`${createdDrafts.length} drafts created. Review and edit at: vibebusiness start -> /social`);
775
+
776
+ return { success: true, output: lines.join('\n') };
777
+ }
778
+
779
+ /**
780
+ * Format YYYY-MM-DD to "Mon DD" short form.
781
+ */
782
+ function formatDateShort(isoDate: string): string {
783
+ const d = new Date(isoDate + 'T00:00:00');
784
+ const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
785
+ return `${months[d.getMonth()]} ${d.getDate()}`;
786
+ }
787
+
619
788
  // ─── Engagement Tracking ──────────────────────────────────────────────────
620
789
 
621
790
  async function executeTrackMetrics(): Promise<{ success: boolean; output: string }> {
@@ -777,6 +946,7 @@ async function executeCheckStatus(): Promise<{ success: boolean; output: string
777
946
  }
778
947
 
779
948
  lines.push(` Pending drafts: ${freshness.draft_count}`);
949
+ lines.push(` Scheduled drafts: ${freshness.scheduled_draft_count}`);
780
950
  lines.push(` Post streak: ${freshness.post_streak_days} day(s)`);
781
951
  lines.push(` Total posts: ${freshness.total_posts}`);
782
952
  lines.push(` Threads published: ${freshness.thread_count}`);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[59],{2660:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},1047:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]])},401:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},875:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},407:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},1671:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},2934:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},5368:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},9388:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},519:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])},1723:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},8867:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},6362:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},1947:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]])},8736:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},3781:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]])},5846:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]])},5554:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]])},1817:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},9554:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},1102:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("OctagonAlert",[["polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2",key:"h1p8hx"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},9227:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]])},3276:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},7168:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},6076:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]])},9076:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]])},4743:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]])},4286:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},933:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("SquareCheckBig",[["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}],["path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11",key:"1jnkn4"}]])},221:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]])},7829:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("TestTube",[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]])},525:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]])},6865:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},2369:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])},1239:function(t,e,n){n.d(e,{Z:function(){return c}});let c=(0,n(9205).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[945],{1806:function(e,t,s){Promise.resolve().then(s.bind(s,8935))},2660:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},1047:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]])},6362:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},5846:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]])},9554:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},9397:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8935:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return Z}});var a=s(7437),l=s(2265),r=s(9376),i=s(7648),n=s(525),c=s(6865),d=s(3085),x=s(2934),o=s(7168),h=s(2660),m=s(8896),u=s(1047),p=s(5846),j=s(6362),g=s(1994),f=s(1259),N=s(104),b=s(9554),v=s(9397),y=s(6153),w=s(281);function k(e){let{kpis:t,goalId:s,onUpdateKPI:r}=e,[i,c]=(0,l.useState)(null),[x,o]=(0,l.useState)(null),[h,m]=(0,l.useState)(""),[u,p]=(0,l.useState)(!1),j=async e=>{if(!r||!h.trim())return;let t=parseFloat(h);if(!isNaN(t)){p(!0);try{await r(e,t),o(null),m("")}catch(e){console.error("Failed to update KPI:",e)}finally{p(!1)}}};return(0,a.jsx)("div",{className:"bg-white rounded-lg border border-slate-200 overflow-hidden",children:(0,a.jsxs)("table",{className:"w-full",children:[(0,a.jsx)("thead",{className:"bg-slate-50 border-b border-slate-200",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"text-left text-xs font-medium text-slate-500 uppercase tracking-wider px-4 py-3",children:"KPI"}),(0,a.jsx)("th",{className:"text-center text-xs font-medium text-slate-500 uppercase tracking-wider px-4 py-3 w-24",children:"Trend"}),(0,a.jsx)("th",{className:"text-right text-xs font-medium text-slate-500 uppercase tracking-wider px-4 py-3 w-24",children:"Current"}),(0,a.jsx)("th",{className:"text-right text-xs font-medium text-slate-500 uppercase tracking-wider px-4 py-3 w-24",children:"Target"}),(0,a.jsx)("th",{className:"text-center text-xs font-medium text-slate-500 uppercase tracking-wider px-4 py-3 w-20",children:"Progress"}),(0,a.jsx)("th",{className:"text-center text-xs font-medium text-slate-500 uppercase tracking-wider px-4 py-3 w-16",children:"Source"}),r&&(0,a.jsx)("th",{className:"text-center text-xs font-medium text-slate-500 uppercase tracking-wider px-4 py-3 w-16",children:"Action"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-slate-100",children:t.map(e=>{let t=function(e){if(e.history.length<2)return{icon:b.Z,color:"text-slate-400",label:"No trend"};let t=e.history[0].value,s=e.history[e.history.length-1].value,a="higher_is_better"===e.direction?s>t:s<t;return t===s?{icon:b.Z,color:"text-slate-400",label:"Stable"}:a?{icon:n.Z,color:"text-emerald-500",label:"Improving"}:{icon:d.Z,color:"text-red-500",label:"Declining"}}(e),s=null===e.current_value||null===e.target_value?null:"higher_is_better"===e.direction?e.current_value/e.target_value*100:e.current_value<=e.target_value?100:e.target_value/e.current_value*100,l=t.icon,p=i===e.id,f=x===e.id;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("tr",{className:(0,g.Z)("hover:bg-slate-50 cursor-pointer transition-colors",p&&"bg-slate-50"),onClick:()=>c(p?null:e.id),children:[(0,a.jsx)("td",{className:"px-4 py-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-16 h-8",children:(0,a.jsx)(w.Z,{kpi:e,height:32,width:64})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium text-slate-900",children:e.name}),(0,a.jsx)("p",{className:"text-xs text-slate-500 line-clamp-1",children:e.description})]})]})}),(0,a.jsx)("td",{className:"px-4 py-3 text-center",children:(0,a.jsx)("span",{className:(0,g.Z)("inline-flex items-center gap-1",t.color),title:t.label,children:(0,a.jsx)(l,{className:"w-4 h-4"})})}),(0,a.jsx)("td",{className:"px-4 py-3 text-right",children:(0,a.jsx)("span",{className:"text-sm font-medium text-slate-900",children:null!==e.current_value?"".concat(e.current_value).concat(e.unit):"--"})}),(0,a.jsx)("td",{className:"px-4 py-3 text-right",children:(0,a.jsx)("span",{className:"text-sm text-slate-500",children:null!==e.target_value?"".concat(e.target_value).concat(e.unit):"--"})}),(0,a.jsx)("td",{className:"px-4 py-3",children:null!==s?(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)("div",{className:"w-12 h-1.5 bg-slate-100 rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:(0,g.Z)("h-full rounded-full",s>=100?"bg-emerald-500":s>=70?"bg-amber-500":"bg-red-500"),style:{width:"".concat(Math.min(s,100),"%")}})})}):(0,a.jsx)("span",{className:"text-xs text-slate-400 text-center block",children:"--"})}),(0,a.jsx)("td",{className:"px-4 py-3 text-center",children:(0,a.jsx)("span",{className:(0,g.Z)("text-xs px-1.5 py-0.5 rounded","manual"===e.source?"bg-slate-100 text-slate-600":"bg-blue-50 text-blue-600"),children:y.en[e.source]})}),r&&(0,a.jsx)("td",{className:"px-4 py-3 text-center",onClick:e=>e.stopPropagation(),children:"manual"===e.source&&(0,a.jsx)("button",{onClick:t=>{var s;t.stopPropagation(),o(e.id),m((null===(s=e.current_value)||void 0===s?void 0:s.toString())||"")},className:"p-1 text-slate-400 hover:text-emerald-600 transition-colors",title:"Add value",children:(0,a.jsx)(v.Z,{className:"w-4 h-4"})})})]},e.id),p&&(0,a.jsx)("tr",{children:(0,a.jsxs)("td",{colSpan:r?7:6,className:"px-4 py-4 bg-slate-50",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-xs font-medium text-slate-500 uppercase mb-2",children:"History"}),e.history.length>0?(0,a.jsx)("div",{className:"h-32 bg-white rounded border border-slate-200 p-2",children:(0,a.jsx)(w.Z,{kpi:e,height:112,showTarget:!0})}):(0,a.jsx)("div",{className:"h-32 bg-white rounded border border-slate-200 flex items-center justify-center text-sm text-slate-400",children:"No historical data"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-xs font-medium text-slate-500 uppercase mb-2",children:"Details"}),(0,a.jsxs)("dl",{className:"space-y-2 text-sm",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("dt",{className:"text-slate-500",children:"Direction"}),(0,a.jsx)("dd",{className:"text-slate-900",children:"higher_is_better"===e.direction?"Higher is better":"Lower is better"})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("dt",{className:"text-slate-500",children:"Data points"}),(0,a.jsx)("dd",{className:"text-slate-900",children:e.history.length})]}),e.history.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("dt",{className:"text-slate-500",children:"First recorded"}),(0,a.jsx)("dd",{className:"text-slate-900",children:e.history[0].date})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("dt",{className:"text-slate-500",children:"Last updated"}),(0,a.jsx)("dd",{className:"text-slate-900",children:e.history[e.history.length-1].date})]})]})]}),(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsx)("h4",{className:"text-xs font-medium text-slate-500 uppercase mb-1",children:"Query"}),(0,a.jsx)("pre",{className:"text-xs text-slate-600 bg-white p-2 rounded border border-slate-200 overflow-x-auto",children:e.query})]})]})]}),f&&"manual"===e.source&&r&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-slate-200 flex items-center gap-3",children:[(0,a.jsx)("label",{className:"text-sm text-slate-600",children:"Add new value:"}),(0,a.jsx)("input",{type:"number",value:h,onChange:e=>m(e.target.value),className:"w-24 px-2 py-1 text-sm border border-slate-300 rounded focus:ring-2 focus:ring-emerald-500 focus:border-emerald-500",placeholder:"Value",step:"any"}),(0,a.jsx)("span",{className:"text-sm text-slate-500",children:e.unit}),(0,a.jsx)("button",{onClick:()=>j(e.id),disabled:u||!h.trim(),className:"px-3 py-1 text-sm bg-emerald-600 text-white rounded hover:bg-emerald-700 disabled:opacity-50 disabled:cursor-not-allowed",children:u?"Saving...":"Save"}),(0,a.jsx)("button",{onClick:()=>{o(null),m("")},className:"px-3 py-1 text-sm text-slate-600 hover:text-slate-900",children:"Cancel"})]})]})},"".concat(e.id,"-expanded"))]})})})]})})}function _(e){let{status:t}=e;switch(t){case"on_track":return(0,a.jsx)(n.Z,{className:"w-5 h-5"});case"at_risk":return(0,a.jsx)(c.Z,{className:"w-5 h-5"});case"behind":return(0,a.jsx)(d.Z,{className:"w-5 h-5"});case"achieved":return(0,a.jsx)(x.Z,{className:"w-5 h-5"})}}function Z(e){let{params:t}=e;(0,r.useRouter)();let{id:s}=t,[n,c]=(0,l.useState)(null),[d,x]=(0,l.useState)([]),[b,v]=(0,l.useState)(!0),[w,Z]=(0,l.useState)(!1),[S,C]=(0,l.useState)(null),P=async()=>{try{let e=await fetch("/api/goals/".concat(s)),t=await e.json();if(!t.success){C(t.error||"Failed to load goal");return}if(c(t.data),t.data.related_ideas.length>0){let e=await fetch("/api/ideas"),s=await e.json();if(s.success){let e=s.data.filter(e=>t.data.related_ideas.includes(e.id));x(e)}}}catch(e){C("Failed to load goal"),console.error("Error fetching goal:",e)}finally{v(!1)}};(0,l.useEffect)(()=>{P()},[s]);let I=async(e,t)=>{try{let a=await fetch("/api/goals/".concat(s,"/kpis"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kpi_id:e,action:"add_history",value:t})}),l=await a.json();if(l.success)await P();else throw Error(l.error)}catch(e){throw console.error("Failed to update KPI:",e),e}},M=async e=>{try{let t=await fetch("/api/goals/".concat(s),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:e})}),a=await t.json();a.success&&c(a.data)}catch(e){console.error("Failed to update status:",e)}},T=async()=>{Z(!0);try{let e=await fetch("/api/kpis/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({goal_id:s})}),t=await e.json();t.success||console.error("KPI refresh failed:",t.error),await P()}catch(e){console.error("Error refreshing KPIs:",e)}finally{Z(!1)}};return b?(0,a.jsx)(f.default,{children:(0,a.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,a.jsx)(o.Z,{className:"w-8 h-8 text-slate-400 animate-spin"})})}):S||!n?(0,a.jsx)(f.default,{children:(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsxs)(i.default,{href:"/goals",className:"inline-flex items-center gap-2 text-slate-600 hover:text-slate-900 mb-6",children:[(0,a.jsx)(h.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Back to Goals"})]}),(0,a.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 text-center",children:(0,a.jsx)("p",{className:"text-red-600",children:S||"Goal not found"})})]})}):(0,a.jsx)(f.default,{children:(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsxs)(i.default,{href:"/goals",className:"inline-flex items-center gap-2 text-slate-600 hover:text-slate-900 mb-6",children:[(0,a.jsx)(h.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Back to Goals"})]}),(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6 mb-6",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-4",children:[(0,a.jsx)("div",{className:"w-14 h-14 bg-emerald-100 rounded-xl flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(m.Z,{className:"w-7 h-7 text-emerald-600"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,a.jsx)("span",{className:(0,g.Z)("text-xs px-2 py-0.5 rounded-full",y.l5[n.category]),children:y.kT[n.category]})}),(0,a.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-1",children:n.title}),(0,a.jsx)("p",{className:"text-slate-500",children:n.description})]})]}),(0,a.jsxs)("div",{className:"flex flex-col items-end gap-2",children:[(0,a.jsxs)("span",{className:(0,g.Z)("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium border",y.i2[n.status]),children:[(0,a.jsx)(_,{status:n.status}),(0,a.jsx)("span",{children:y.tV[n.status]})]}),(0,a.jsxs)("select",{value:n.status,onChange:e=>M(e.target.value),className:"text-xs border border-slate-200 rounded px-2 py-1 text-slate-600",children:[(0,a.jsx)("option",{value:"on_track",children:"On Track"}),(0,a.jsx)("option",{value:"at_risk",children:"At Risk"}),(0,a.jsx)("option",{value:"behind",children:"Behind"}),(0,a.jsx)("option",{value:"achieved",children:"Achieved"})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-6 text-sm text-slate-500 mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(u.Z,{className:"w-4 h-4"}),(0,a.jsxs)("span",{children:["Deadline: ",(0,a.jsx)("span",{className:"font-medium text-slate-700",children:n.deadline})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(p.Z,{className:"w-4 h-4"}),(0,a.jsxs)("span",{children:[n.related_ideas.length," linked ideas"]})]})]}),(0,a.jsx)(N.Z,{current:n.current_value,target:n.target_value,unit:n.target_unit,status:n.status})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[(0,a.jsxs)("div",{className:"lg:col-span-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold text-slate-900",children:["Key Performance Indicators (",n.kpis.length,")"]}),(0,a.jsxs)("button",{onClick:T,disabled:w,className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm text-slate-600 hover:text-slate-900 border border-slate-200 rounded-lg hover:bg-slate-50 disabled:opacity-50",children:[(0,a.jsx)(o.Z,{className:(0,g.Z)("w-4 h-4",w&&"animate-spin")}),(0,a.jsx)("span",{children:w?"Refreshing...":"Refresh KPIs"})]})]}),n.kpis.length>0?(0,a.jsx)(k,{kpis:n.kpis,goalId:n.id,onUpdateKPI:I}):(0,a.jsx)("div",{className:"bg-white rounded-lg border border-slate-200 p-8 text-center",children:(0,a.jsx)("p",{className:"text-slate-500",children:"No KPIs defined for this goal."})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-slate-900 mb-4",children:"Related Ideas"}),d.length>0?(0,a.jsx)("div",{className:"space-y-3",children:d.map(e=>(0,a.jsxs)(i.default,{href:"/ideas/".concat(e.id),className:"block bg-white rounded-lg border border-slate-200 p-4 hover:border-emerald-300 hover:shadow-sm transition-all",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-slate-900 mb-1",children:e.title}),(0,a.jsx)("p",{className:"text-xs text-slate-500 line-clamp-2",children:e.summary})]}),(0,a.jsx)(j.Z,{className:"w-4 h-4 text-slate-400 flex-shrink-0"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,a.jsx)("span",{className:(0,g.Z)("text-xs px-1.5 py-0.5 rounded","shipped"===e.stage?"bg-green-100 text-green-700":"in_progress"===e.stage?"bg-violet-100 text-violet-700":"bg-slate-100 text-slate-600"),children:e.stage.replace("_"," ")}),e.expected_impact&&(0,a.jsx)("span",{className:"text-xs text-slate-400",children:e.expected_impact})]})]},e.id))}):(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6 text-center",children:[(0,a.jsx)(p.Z,{className:"w-8 h-8 text-slate-300 mx-auto mb-2"}),(0,a.jsx)("p",{className:"text-sm text-slate-500 mb-3",children:"No ideas linked to this goal yet."}),(0,a.jsx)(i.default,{href:"/",className:"text-sm text-emerald-600 hover:text-emerald-700",children:"Browse Ideas"})]}),(0,a.jsxs)("div",{className:"mt-6 bg-slate-50 rounded-lg border border-slate-200 p-4",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-slate-700 mb-2",children:"Tip: Link Ideas to Goals"}),(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"When approving ideas, link them to this goal to track which improvements support your business objectives. Ideas linked to goals are prioritized in the analysis process."})]})]})]}),(0,a.jsxs)("div",{className:"mt-6 text-xs text-slate-400",children:[(0,a.jsxs)("p",{children:["Created: ",new Date(n.created_at).toLocaleString()]}),(0,a.jsxs)("p",{children:["Last updated: ",new Date(n.updated_at).toLocaleString()]})]})]})})}}},function(e){e.O(0,[746,444,971,117,744],function(){return e(e.s=1806)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[594],{703:function(e,t,s){Promise.resolve().then(s.bind(s,1259)),Promise.resolve().then(s.bind(s,9534))},1259:function(e,t,s){"use strict";s.d(t,{default:function(){return j}});var a=s(7437),r=s(7648),l=s(9376),n=s(5466),i=s(2048),c=s(8896),d=s(8220),o=s(2718),m=s(5621),x=s(8728),h=s(2222),u=s(2023),p=s(1994),b=s(257);let g=[{href:"/",label:"Dashboard",icon:(0,a.jsx)(n.Z,{className:"w-5 h-5"})},{href:"/roadmap",label:"Roadmap",icon:(0,a.jsx)(i.Z,{className:"w-5 h-5"})},{href:"/goals",label:"Goals",icon:(0,a.jsx)(c.Z,{className:"w-5 h-5"})},{href:"/hypotheses",label:"Hypotheses",icon:(0,a.jsx)(d.Z,{className:"w-5 h-5"})},{href:"/social",label:"Social",icon:(0,a.jsx)(o.Z,{className:"w-5 h-5"})},{href:"/sessions",label:"Sessions",icon:(0,a.jsx)(m.Z,{className:"w-5 h-5"})},{href:"/settings",label:"Settings",icon:(0,a.jsx)(x.Z,{className:"w-5 h-5"})}];function j(e){let{children:t}=e,s=(0,l.usePathname)();return(0,a.jsxs)("div",{className:"min-h-screen flex",children:[(0,a.jsxs)("aside",{className:"w-64 bg-slate-900 text-white flex flex-col",children:[(0,a.jsx)("div",{className:"p-4 border-b border-slate-700",children:(0,a.jsxs)(r.default,{href:"/",className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-emerald-500 rounded-lg flex items-center justify-center",children:(0,a.jsx)(h.Z,{className:"w-6 h-6 text-white"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"font-bold text-lg leading-tight",children:"Analyst"}),(0,a.jsx)("p",{className:"text-xs text-slate-400",children:b.env.NEXT_PUBLIC_PRODUCT_NAME||"Business"})]})]})}),(0,a.jsx)("nav",{className:"flex-1 p-4",children:(0,a.jsx)("ul",{className:"space-y-1",children:g.map(e=>{let t="/"===e.href?"/"===s:s.startsWith(e.href);return(0,a.jsx)("li",{children:(0,a.jsxs)(r.default,{href:e.href,className:(0,p.Z)("flex items-center gap-3 px-3 py-2 rounded-lg transition-colors",t?"bg-slate-800 text-white":"text-slate-400 hover:text-white hover:bg-slate-800"),children:[e.icon,(0,a.jsx)("span",{children:e.label})]})},e.href)})})}),(0,a.jsx)("div",{className:"p-4 border-t border-slate-700",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[(0,a.jsx)(u.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Powered by Claude"})]})})]}),(0,a.jsx)("main",{className:"flex-1 overflow-auto",children:t})]})}},9534:function(e,t,s){"use strict";s.d(t,{default:function(){return el}});var a=s(7437),r=s(7648),l=s(2265),n=s(519),i=s(1817),c=s(2934),d=s(9388),o=s(5554),m=s(6865),x=s(875),h=s(407),u=s(1723),p=s(1947),b=s(221),g=s(5368),j=s(9554),f=s(4286),N=s(1102),v=s(2660),w=s(1047),_=s(1239),y=s(525),Z=s(8736),S=s(3781),k=s(6362),C=s(5846),R=s(8896),P=s(933),I=s(1994),T=s(6153),A=s(9376),D=s(1671),F=s(9227),M=s(3276),q=s(7829),E=s(9076),O=s(6076);let U={primary:"btn-primary",secondary:"btn-secondary",danger:"btn-danger",warning:"bg-amber-500 text-white hover:bg-amber-600 focus:ring-amber-500"};function L(e){let{ideaId:t,currentStage:s}=e,r=(0,A.useRouter)(),[n,c]=(0,l.useState)(!1),[o,m]=(0,l.useState)(null),[x,h]=(0,l.useState)(null),[p,b]=(0,l.useState)(""),g=function(e){switch(e){case"inbox":return[{toStage:"under_review",label:"Start Review",icon:(0,a.jsx)(u.Z,{className:"w-4 h-4"}),variant:"primary"},{toStage:"rejected",label:"Reject",icon:(0,a.jsx)(d.Z,{className:"w-4 h-4"}),variant:"danger",requiresComment:!0}];case"under_review":return[{toStage:"approved",label:"Approve",icon:(0,a.jsx)(D.Z,{className:"w-4 h-4"}),variant:"primary"},{toStage:"deferred",label:"Defer",icon:(0,a.jsx)(F.Z,{className:"w-4 h-4"}),variant:"warning",requiresComment:!0},{toStage:"rejected",label:"Reject",icon:(0,a.jsx)(d.Z,{className:"w-4 h-4"}),variant:"danger",requiresComment:!0}];case"approved":return[{toStage:"in_progress",label:"Start Implementation",icon:(0,a.jsx)(M.Z,{className:"w-4 h-4"}),variant:"primary",triggerImplementation:!0},{toStage:"deferred",label:"Defer",icon:(0,a.jsx)(F.Z,{className:"w-4 h-4"}),variant:"warning",requiresComment:!0}];case"in_progress":return[{toStage:"testing",label:"Move to Testing",icon:(0,a.jsx)(q.Z,{className:"w-4 h-4"}),variant:"primary"},{toStage:"approved",label:"Back to Approved",icon:(0,a.jsx)(E.Z,{className:"w-4 h-4"}),variant:"secondary"}];case"testing":return[{toStage:"shipped",label:"Ship It!",icon:(0,a.jsx)(O.Z,{className:"w-4 h-4"}),variant:"primary"},{toStage:"in_progress",label:"Back to In Progress",icon:(0,a.jsx)(E.Z,{className:"w-4 h-4"}),variant:"secondary"}];case"shipped":return[{toStage:"rolled_back",label:"Roll Back",icon:(0,a.jsx)(E.Z,{className:"w-4 h-4"}),variant:"danger",requiresComment:!0}];case"deferred":return[{toStage:"under_review",label:"Reopen Review",icon:(0,a.jsx)(u.Z,{className:"w-4 h-4"}),variant:"primary"},{toStage:"rejected",label:"Reject",icon:(0,a.jsx)(d.Z,{className:"w-4 h-4"}),variant:"danger",requiresComment:!0}];case"rejected":case"rolled_back":return[{toStage:"inbox",label:"Reopen",icon:(0,a.jsx)(E.Z,{className:"w-4 h-4"}),variant:"secondary"}];default:return[]}}(s),j=async(e,s)=>{c(!0),m(e);try{(await fetch("/api/ideas/".concat(t,"/transition"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({to_stage:e,comment:s})})).ok&&r.refresh()}catch(e){console.error("Failed to transition stage:",e)}finally{c(!1),m(null),h(null),b("")}},f=async()=>{c(!0),m("in_progress");try{let e=await fetch("/api/ideas/".concat(t,"/implement"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),s=await e.json();s.success?r.refresh():(console.error("Failed to start implementation:",s.error),alert(s.error||"Failed to start implementation"))}catch(e){console.error("Failed to start implementation:",e),alert("Failed to start implementation")}finally{c(!1),m(null)}},N=e=>{e.triggerImplementation?f():e.requiresComment?h(e):j(e.toStage)};return 0===g.length?null:(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"text-sm text-slate-500",children:["Current stage: ",(0,a.jsx)("span",{className:"font-medium text-slate-700",children:T.yb[s]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:g.map(e=>(0,a.jsxs)("button",{onClick:()=>N(e),disabled:n,className:(0,I.Z)("btn gap-2",U[e.variant],n&&"opacity-75"),children:[o===e.toStage?(0,a.jsx)(i.Z,{className:"w-4 h-4 animate-spin"}):e.icon,(0,a.jsx)("span",{children:e.label})]},e.toStage))}),x&&(0,a.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:(0,a.jsxs)("div",{className:"bg-white rounded-lg shadow-xl p-6 w-full max-w-md animate-slide-in",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-slate-900 mb-2",children:x.label}),(0,a.jsx)("p",{className:"text-sm text-slate-500 mb-4",children:"Please provide a reason for this action."}),(0,a.jsx)("textarea",{value:p,onChange:e=>b(e.target.value),placeholder:"Enter your comment...",className:"textarea h-24 mb-4",autoFocus:!0}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)("button",{onClick:()=>{h(null),b("")},className:"btn btn-secondary",disabled:n,children:"Cancel"}),(0,a.jsxs)("button",{onClick:()=>j(x.toStage,p),disabled:n||!p.trim(),className:(0,I.Z)("btn gap-2",U[x.variant]),children:[n?(0,a.jsx)(i.Z,{className:"w-4 h-4 animate-spin"}):x.icon,(0,a.jsx)("span",{children:"Confirm"})]})]})]})})]})}var G=s(2222),z=s(2369),B=s(4743);function V(e){let{ideaId:t,comments:s}=e,r=(0,A.useRouter)(),[n,c]=(0,l.useState)(""),[d,o]=(0,l.useState)(!1),m=async e=>{if(e.preventDefault(),n.trim()&&!d){o(!0);try{(await fetch("/api/ideas/".concat(t,"/comments"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({author:"human",author_name:"Founder",content:n.trim()})})).ok&&(c(""),r.refresh())}catch(e){console.error("Failed to add comment:",e)}finally{o(!1)}}};return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("h3",{className:"font-semibold text-slate-900",children:"Discussion"}),(0,a.jsx)("div",{className:"space-y-3",children:0===s.length?(0,a.jsx)("p",{className:"text-sm text-slate-400 italic",children:"No comments yet"}):s.map(e=>(0,a.jsxs)("div",{className:(0,I.Z)("comment-bubble",e.author),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:["ai"===e.author?(0,a.jsx)("div",{className:"w-6 h-6 bg-emerald-100 rounded-full flex items-center justify-center",children:(0,a.jsx)(G.Z,{className:"w-3.5 h-3.5 text-emerald-600"})}):(0,a.jsx)("div",{className:"w-6 h-6 bg-blue-100 rounded-full flex items-center justify-center",children:(0,a.jsx)(z.Z,{className:"w-3.5 h-3.5 text-blue-600"})}),(0,a.jsx)("span",{className:"text-sm font-medium text-slate-700",children:e.author_name}),(0,a.jsx)("span",{className:"text-xs text-slate-400",children:new Date(e.created_at).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})})]}),(0,a.jsx)("p",{className:"text-sm text-slate-600 whitespace-pre-wrap",children:e.content})]},e.id))}),(0,a.jsxs)("form",{onSubmit:m,className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:n,onChange:e=>c(e.target.value),placeholder:"Add a comment...",className:"input flex-1",disabled:d}),(0,a.jsx)("button",{type:"submit",disabled:!n.trim()||d,className:"btn btn-primary",children:d?(0,a.jsx)(i.Z,{className:"w-4 h-4 animate-spin"}):(0,a.jsx)(B.Z,{className:"w-4 h-4"})})]})]})}var H=s(7168),W=s(401),X=s(8867);let J={cloning:{label:"Cloning repository...",color:"text-blue-600"},branching:{label:"Creating branch...",color:"text-blue-600"},decomposing:{label:"Decomposing into sub-tasks...",color:"text-amber-600"},implementing:{label:"Implementing changes...",color:"text-violet-600"},testing:{label:"Running tests...",color:"text-cyan-600"},creating_pr:{label:"Creating PR...",color:"text-cyan-600"},completed:{label:"Completed",color:"text-emerald-600"},failed:{label:"Failed",color:"text-red-600"}};function K(e){let{ideaId:t,onComplete:s}=e,[r,n]=(0,l.useState)(null),[c,o]=(0,l.useState)(!0),[m,x]=(0,l.useState)(!1),[h,u]=(0,l.useState)(!1),p=async()=>{try{let e=await fetch("/api/ideas/".concat(t,"/implement")),a=await e.json();a.success&&a.data?(n(a.data),("completed"===a.data.status||"failed"===a.data.status)&&(null==s||s())):n(null)}catch(e){console.error("Failed to fetch implementation status:",e)}finally{o(!1)}};if((0,l.useEffect)(()=>{p();let e=setInterval(()=>{r&&"completed"!==r.status&&"failed"!==r.status&&p()},3e3);return()=>clearInterval(e)},[t]),(0,l.useEffect)(()=>{if(r&&("completed"===r.status||"failed"===r.status))return;let e=setInterval(p,3e3);return()=>clearInterval(e)},[null==r?void 0:r.status]),c)return(0,a.jsxs)("div",{className:"flex items-center gap-2 text-slate-500",children:[(0,a.jsx)(i.Z,{className:"w-4 h-4 animate-spin"}),(0,a.jsx)("span",{className:"text-sm",children:"Loading..."})]});if(!r)return null;let g=J[r.status]||{label:r.status,color:"text-slate-600"},j=!["completed","failed"].includes(r.status);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("h3",{className:"font-semibold text-slate-900 flex items-center gap-2",children:[(0,a.jsx)(b.Z,{className:"w-4 h-4"}),"Implementation Progress"]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[j?(0,a.jsx)(i.Z,{className:(0,I.Z)("w-5 h-5 animate-spin",g.color)}):"completed"===r.status?(0,a.jsx)(D.Z,{className:"w-5 h-5 text-emerald-600"}):(0,a.jsx)(d.Z,{className:"w-5 h-5 text-red-600"}),(0,a.jsx)("span",{className:(0,I.Z)("font-medium",g.color),children:g.label}),j&&(0,a.jsx)("button",{onClick:p,className:"p-1 text-slate-400 hover:text-slate-600",title:"Refresh",children:(0,a.jsx)(H.Z,{className:"w-4 h-4"})})]}),(0,a.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)(S.Z,{className:"w-4 h-4 text-slate-500"}),(0,a.jsx)("code",{className:"flex-1 bg-slate-200 px-2 py-0.5 rounded font-mono text-xs",children:r.branch_name}),(0,a.jsx)("button",{onClick:()=>{(null==r?void 0:r.branch_name)&&(navigator.clipboard.writeText(r.branch_name),u(!0),setTimeout(()=>u(!1),2e3))},className:"p-1 text-slate-400 hover:text-slate-600",title:"Copy branch name",children:h?(0,a.jsx)(W.Z,{className:"w-4 h-4 text-emerald-600"}):(0,a.jsx)(X.Z,{className:"w-4 h-4"})})]}),(0,a.jsxs)("div",{className:"mt-2 text-xs text-slate-500",children:["Repo: ",r.repo_name," • Workspace: ",r.workspace_path]}),r.pr_url&&(0,a.jsxs)("a",{href:r.pr_url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 flex items-center gap-1 text-sm text-blue-600 hover:underline",children:[(0,a.jsx)("span",{children:"View Pull Request"}),(0,a.jsx)(k.Z,{className:"w-3 h-3"})]})]}),r.error_message&&(0,a.jsx)("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700",children:r.error_message}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("button",{onClick:()=>x(!m),className:"text-sm text-slate-500 hover:text-slate-700",children:[m?"Hide":"Show"," logs (",r.logs.length,")"]}),m&&(0,a.jsx)("div",{className:"mt-2 p-3 bg-slate-900 rounded-lg max-h-64 overflow-y-auto",children:(0,a.jsx)("pre",{className:"text-xs text-slate-300 font-mono whitespace-pre-wrap",children:r.logs.join("\n")})})]})]})}function Q(e){return new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit"})}function $(e){let{title:t,icon:s,children:r}=e;return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("h3",{className:"flex items-center gap-2 font-semibold text-slate-900",children:[s,(0,a.jsx)("span",{children:t})]}),(0,a.jsx)("div",{className:"text-sm text-slate-600",children:r})]})}function Y(e){let{status:t}=e;switch(t){case"pending":return(0,a.jsx)(n.Z,{className:"w-4 h-4 text-slate-400"});case"in_progress":return(0,a.jsx)(i.Z,{className:"w-4 h-4 text-violet-500 animate-spin"});case"completed":return(0,a.jsx)(c.Z,{className:"w-4 h-4 text-emerald-500"});case"failed":return(0,a.jsx)(d.Z,{className:"w-4 h-4 text-red-500"})}}function ee(e){return e?new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}):""}function et(e){let{failureType:t}=e;if(!t)return null;let s={timeout:{text:"timeout",className:"bg-orange-100 text-orange-700"},error:{text:"error",className:"bg-red-100 text-red-700"},tests_failed:{text:"tests failed",className:"bg-amber-100 text-amber-700"}}[t];return(0,a.jsx)("span",{className:(0,I.Z)("text-xs px-1.5 py-0.5 rounded font-medium",s.className),children:s.text})}function es(e){let{subTasks:t}=e,[s,r]=(0,l.useState)(null);if(0===t.length)return null;let n=t.filter(e=>"completed"===e.status).length,i=t.filter(e=>"failed"===e.status).length,c=Math.round(n/t.length*100);return(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsxs)($,{title:"Sub-Tasks",icon:(0,a.jsx)(o.Z,{className:"w-4 h-4 text-violet-500"}),children:[(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs mb-1",children:[(0,a.jsxs)("span",{className:"text-slate-500",children:[n,"/",t.length," done",i>0&&(0,a.jsxs)("span",{className:"text-red-500 ml-1",children:["(",i," failed)"]})]}),(0,a.jsxs)("span",{className:"text-slate-500",children:[c,"%"]})]}),(0,a.jsx)("div",{className:"w-full bg-slate-200 rounded-full h-2",children:(0,a.jsx)("div",{className:(0,I.Z)("h-2 rounded-full transition-all",i>0?"bg-red-500":"bg-emerald-500"),style:{width:"".concat(c,"%")}})})]}),(0,a.jsx)("ul",{className:"space-y-2",children:t.map(e=>{let t=s===e.id;return(0,a.jsxs)("li",{className:"border border-slate-100 rounded-lg",children:[(0,a.jsxs)("button",{onClick:()=>r(t?null:e.id),className:"w-full flex items-center gap-2 p-2 text-left hover:bg-slate-50 rounded-lg",children:[(0,a.jsx)(Y,{status:e.status}),(0,a.jsx)("span",{className:(0,I.Z)("flex-1 text-sm","completed"===e.status&&"line-through text-slate-400","failed"===e.status&&"text-red-600"),children:e.title}),"failed"===e.status&&e.failure_type&&(0,a.jsx)(et,{failureType:e.failure_type}),e.has_uncommitted_changes&&(0,a.jsx)("span",{title:"Uncommitted changes in workspace",children:(0,a.jsx)(m.Z,{className:"w-3.5 h-3.5 text-amber-500"})}),t?(0,a.jsx)(x.Z,{className:"w-3 h-3 text-slate-400"}):(0,a.jsx)(h.Z,{className:"w-3 h-3 text-slate-400"})]}),t&&(0,a.jsxs)("div",{className:"px-8 pb-3 space-y-3",children:[(0,a.jsx)("p",{className:"text-xs text-slate-600 whitespace-pre-wrap",children:e.description}),(e.duration_ms||e.lines_added||e.lines_removed)&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-3 text-xs text-slate-500",children:[e.duration_ms&&(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(u.Z,{className:"w-3 h-3"}),function(e){if(!e)return"";let t=Math.floor(e/1e3),s=Math.floor(t/60),a=Math.floor(s/60);return a>0?"".concat(a,"h ").concat(s%60,"m"):s>0?"".concat(s,"m ").concat(t%60,"s"):"".concat(t,"s")}(e.duration_ms)]}),(e.lines_added||e.lines_removed)&&(0,a.jsxs)("span",{className:"flex items-center gap-1 font-mono",children:[(0,a.jsx)(p.Z,{className:"w-3 h-3"}),(0,a.jsxs)("span",{className:"text-emerald-600",children:["+",e.lines_added||0]}),(0,a.jsxs)("span",{className:"text-red-600",children:["-",e.lines_removed||0]})]})]}),e.files_changed&&e.files_changed.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("span",{className:"text-xs font-medium text-emerald-600 flex items-center gap-1",children:[(0,a.jsx)(p.Z,{className:"w-3 h-3"}),"Files Changed:"]}),(0,a.jsx)("ul",{className:"mt-1",children:e.files_changed.map(e=>(0,a.jsx)("li",{className:"text-xs text-slate-600 font-mono",children:e},e))})]}),e.files_to_modify.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-xs font-medium text-slate-500",children:"Planned Files:"}),(0,a.jsx)("ul",{className:"mt-1",children:e.files_to_modify.map(e=>(0,a.jsx)("li",{className:"text-xs text-slate-400 font-mono",children:e},e))})]}),e.error_message&&(0,a.jsx)("div",{className:"p-2 bg-red-50 border border-red-200 rounded text-xs text-red-700 whitespace-pre-wrap",children:e.error_message}),e.output_snippet&&(0,a.jsxs)("details",{className:"group",children:[(0,a.jsxs)("summary",{className:"text-xs font-medium text-slate-500 cursor-pointer flex items-center gap-1",children:[(0,a.jsx)(b.Z,{className:"w-3 h-3"}),"Output",(0,a.jsx)(h.Z,{className:"w-3 h-3 group-open:rotate-90 transition-transform"})]}),(0,a.jsx)("pre",{className:"mt-1 p-2 bg-slate-50 border border-slate-200 rounded text-xs text-slate-600 overflow-x-auto max-h-48 overflow-y-auto whitespace-pre-wrap",children:e.output_snippet})]}),e.has_uncommitted_changes&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-2 bg-amber-50 border border-amber-200 rounded text-xs text-amber-700",children:[(0,a.jsx)(m.Z,{className:"w-3.5 h-3.5"}),"Uncommitted changes in workspace"]}),e.commit_hash&&(0,a.jsxs)("div",{className:"text-xs text-slate-400",children:["Commit: ",(0,a.jsx)("code",{className:"bg-slate-100 px-1 rounded",children:e.commit_hash.slice(0,8)})]}),(e.started_at||e.completed_at)&&(0,a.jsxs)("div",{className:"text-xs text-slate-400",children:[e.started_at&&(0,a.jsxs)("span",{children:["Started: ",ee(e.started_at)]}),e.completed_at&&(0,a.jsxs)("span",{className:"ml-3",children:["Finished: ",ee(e.completed_at)]})]})]})]},e.id)})})]})})}function ea(e){let{status:t}=e;switch(t){case"met":return(0,a.jsx)(c.Z,{className:"w-4 h-4 text-emerald-500"});case"partially_met":return(0,a.jsx)(m.Z,{className:"w-4 h-4 text-amber-500"});case"not_met":return(0,a.jsx)(d.Z,{className:"w-4 h-4 text-red-500"});case"no_data":return(0,a.jsx)(g.Z,{className:"w-4 h-4 text-slate-400"});default:return(0,a.jsx)(j.Z,{className:"w-4 h-4 text-slate-400"})}}function er(e){let{verification:t}=e;return(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsxs)($,{title:"Post-Ship Verification",icon:(0,a.jsx)(f.Z,{className:"w-4 h-4 text-emerald-500"}),children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,a.jsx)("span",{className:(0,I.Z)("text-xs font-medium px-2 py-1 rounded",T.aR[t.status]),children:T.Wb[t.status]}),t.confidence&&(0,a.jsxs)("span",{className:"text-xs text-slate-500",children:["Confidence: ",t.confidence]})]}),t.summary&&(0,a.jsx)("p",{className:"text-sm text-slate-700 mb-4",children:t.summary}),t.requires_human_review&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-2 mb-4 bg-amber-50 border border-amber-200 rounded text-xs text-amber-700",children:[(0,a.jsx)(N.Z,{className:"w-3.5 h-3.5 flex-shrink-0"}),(0,a.jsxs)("span",{children:["Requires human review: ",t.human_review_reason||"Review needed"]})]}),t.metric_evaluations.length>0&&(0,a.jsxs)("div",{className:"space-y-2 mb-4",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-slate-500 uppercase",children:"Metric Results"}),(0,a.jsx)("ul",{className:"space-y-1.5",children:t.metric_evaluations.map((e,t)=>(0,a.jsxs)("li",{className:"flex items-start gap-2",children:[(0,a.jsx)(ea,{status:e.status}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-xs text-slate-700",children:e.metric}),(0,a.jsx)("p",{className:"text-xs text-slate-500 mt-0.5",children:e.evidence})]})]},t))})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-4 text-xs text-slate-400 pt-3 border-t border-slate-100",children:[t.first_evaluated_at&&(0,a.jsxs)("span",{children:["First evaluated: ",Q(t.first_evaluated_at)]}),t.evaluation_count>0&&(0,a.jsxs)("span",{children:["Evaluations: ",t.evaluation_count]}),t.next_evaluation_after&&(0,a.jsxs)("span",{children:["Next check: ",new Date(t.next_evaluation_after).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})]})]}),t.follow_up_idea_ids.length>0&&(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-slate-100",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-slate-500",children:"Follow-up ideas:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5 mt-1",children:t.follow_up_idea_ids.map(e=>(0,a.jsx)(r.default,{href:"/ideas/".concat(e),className:"text-xs text-blue-600 hover:underline bg-blue-50 px-1.5 py-0.5 rounded",children:e},e))})]})]})})}function el(e){let{idea:t,linkedGoal:s}=e;return(0,a.jsxs)("div",{className:"max-w-4xl mx-auto p-6",children:[(0,a.jsxs)(r.default,{href:"/",className:"inline-flex items-center gap-2 text-sm text-slate-500 hover:text-slate-700 mb-6",children:[(0,a.jsx)(v.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Back to Dashboard"})]}),(0,a.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6 mb-6",children:[(0,a.jsx)("div",{className:"flex items-start justify-between mb-4",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-3",children:[(0,a.jsx)("span",{className:(0,I.Z)("priority-badge",T.Gs[t.priority]),children:T.rF[t.priority]}),(0,a.jsx)("span",{className:(0,I.Z)("category-badge",T.pG[t.category]),children:T.Hs[t.category]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("div",{className:(0,I.Z)("stage-indicator",T.lv[t.stage])}),(0,a.jsx)("span",{className:"text-xs text-slate-500",children:T.yb[t.stage]})]})]}),(0,a.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:t.title}),(0,a.jsx)("p",{className:"text-slate-600",children:t.summary})]})}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-6 text-sm text-slate-500 pt-4 border-t border-slate-100",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(w.Z,{className:"w-4 h-4"}),(0,a.jsxs)("span",{children:["Created ",Q(t.created_at)]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(_.Z,{className:"w-4 h-4"}),(0,a.jsxs)("span",{children:["Effort: ",T.bi[t.effort]]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(y.Z,{className:"w-4 h-4"}),(0,a.jsxs)("span",{children:["Impact: ",T.bi[t.impact]]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(Z.Z,{className:"w-4 h-4"}),(0,a.jsxs)("span",{children:["Source: ",T.Vr[t.source.type]]})]})]}),t.tags.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-2 mt-4",children:t.tags.map(e=>(0,a.jsx)("span",{className:"px-2 py-1 bg-slate-100 text-slate-600 text-xs rounded",children:e},e))}),t.implementation.branch_name&&(0,a.jsx)("div",{className:"mt-4 p-3 bg-slate-50 rounded-lg border border-slate-200",children:(0,a.jsxs)("div",{className:"flex items-center gap-4 text-sm",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-slate-600",children:[(0,a.jsx)(S.Z,{className:"w-4 h-4"}),(0,a.jsx)("code",{className:"bg-slate-200 px-2 py-0.5 rounded",children:t.implementation.branch_name})]}),t.implementation.pr_url&&(0,a.jsxs)("a",{href:t.implementation.pr_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-blue-600 hover:underline",children:[(0,a.jsx)("span",{children:"View PR"}),(0,a.jsx)(k.Z,{className:"w-3 h-3"})]})]})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[(0,a.jsxs)("div",{className:"lg:col-span-2 space-y-6",children:[(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsx)($,{title:"Context",icon:(0,a.jsx)(C.Z,{className:"w-4 h-4 text-amber-500"}),children:(0,a.jsx)("p",{className:"whitespace-pre-wrap",children:t.context})})}),(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsx)($,{title:"Rationale",icon:(0,a.jsx)(R.Z,{className:"w-4 h-4 text-blue-500"}),children:(0,a.jsx)("p",{className:"whitespace-pre-wrap",children:t.rationale})})}),(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsx)($,{title:"Implementation Plan",icon:(0,a.jsx)(P.Z,{className:"w-4 h-4 text-emerald-500"}),children:(0,a.jsx)("div",{className:"whitespace-pre-wrap",children:t.implementation_plan})})}),t.implementation.sub_tasks&&t.implementation.sub_tasks.length>0&&(0,a.jsx)(es,{subTasks:t.implementation.sub_tasks}),"shipped"===t.stage&&t.verification&&(0,a.jsx)(er,{verification:t.verification}),(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsx)($,{title:"Success Metrics",icon:(0,a.jsx)(y.Z,{className:"w-4 h-4 text-violet-500"}),children:(0,a.jsx)("ul",{className:"list-disc list-inside space-y-1",children:t.success_metrics.map((e,t)=>(0,a.jsx)("li",{children:e},t))})})})]}),(0,a.jsxs)("div",{className:"space-y-6",children:[(s||t.expected_impact)&&(0,a.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:[(0,a.jsxs)("h3",{className:"flex items-center gap-2 font-semibold text-slate-900 mb-3",children:[(0,a.jsx)(R.Z,{className:"w-4 h-4 text-emerald-500"}),(0,a.jsx)("span",{children:"Goal Alignment"})]}),s?(0,a.jsxs)(r.default,{href:"/goals/".concat(s.id),className:"block p-3 bg-emerald-50 border border-emerald-200 rounded-lg hover:border-emerald-300 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-emerald-800",children:s.title}),(0,a.jsx)(k.Z,{className:"w-3 h-3 text-emerald-600"})]}),(0,a.jsx)("p",{className:"text-xs text-emerald-600 line-clamp-2",children:s.description})]}):t.goal_id?(0,a.jsxs)("p",{className:"text-sm text-slate-500",children:["Linked to goal: ",(0,a.jsx)("code",{className:"text-xs bg-slate-100 px-1 rounded",children:t.goal_id})]}):null,t.expected_impact&&(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-slate-100",children:[(0,a.jsx)("p",{className:"text-xs text-slate-500 uppercase font-medium mb-1",children:"Expected Impact"}),(0,a.jsx)("p",{className:"text-sm text-slate-700",children:t.expected_impact})]})]}),(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsx)(L,{ideaId:t.id,currentStage:t.stage})}),["in_progress","testing","shipped","rolled_back"].includes(t.stage)&&(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsx)(K,{ideaId:t.id})}),(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsx)(V,{ideaId:t.id,comments:t.comments})}),t.source.files_analyzed&&t.source.files_analyzed.length>0&&(0,a.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:[(0,a.jsx)("h3",{className:"font-semibold text-slate-900 mb-3",children:"Files Analyzed"}),(0,a.jsx)("ul",{className:"space-y-1",children:t.source.files_analyzed.map((e,t)=>(0,a.jsx)("li",{className:"text-xs text-slate-500 font-mono truncate",children:e},t))})]})]})]})]})}},6153:function(e,t,s){"use strict";s.d(t,{G:function(){return i},GK:function(){return Z},Gs:function(){return o},Hs:function(){return a},PN:function(){return u},PW:function(){return _},Q_:function(){return p},R$:function(){return v},Vr:function(){return m},Wb:function(){return h},aR:function(){return x},bi:function(){return c},en:function(){return N},i2:function(){return f},kT:function(){return b},l5:function(){return g},lE:function(){return w},lv:function(){return n},pG:function(){return r},rF:function(){return d},tV:function(){return j},tl:function(){return y},xP:function(){return S},yb:function(){return l}});let a={product:"Product",ux_design:"UX/Design",growth:"Growth",performance:"Performance",tech_debt:"Tech Debt",security:"Security",infrastructure:"Infrastructure",content:"Content",analytics:"Analytics",integration:"Integration"},r={product:"bg-blue-100 text-blue-800",ux_design:"bg-purple-100 text-purple-800",growth:"bg-green-100 text-green-800",performance:"bg-orange-100 text-orange-800",tech_debt:"bg-yellow-100 text-yellow-800",security:"bg-red-100 text-red-800",infrastructure:"bg-gray-100 text-gray-800",content:"bg-pink-100 text-pink-800",analytics:"bg-cyan-100 text-cyan-800",integration:"bg-indigo-100 text-indigo-800"},l={inbox:"Inbox",under_review:"Under Review",approved:"Approved",in_progress:"In Progress",testing:"Testing",shipped:"Shipped",deferred:"Deferred",rejected:"Rejected",rolled_back:"Rolled Back"},n={inbox:"bg-amber-500",under_review:"bg-blue-500",approved:"bg-emerald-500",in_progress:"bg-violet-500",testing:"bg-cyan-500",shipped:"bg-green-500",deferred:"bg-gray-500",rejected:"bg-red-500",rolled_back:"bg-orange-500"},i=["inbox","under_review","approved","in_progress","testing","shipped"],c={xs:"XS",s:"S",m:"M",l:"L",xl:"XL"},d={critical:"Critical",high:"High",medium:"Medium",low:"Low"},o={critical:"bg-red-100 text-red-800 border-red-300",high:"bg-orange-100 text-orange-800 border-orange-300",medium:"bg-yellow-100 text-yellow-800 border-yellow-300",low:"bg-gray-100 text-gray-800 border-gray-300"},m={codebase_analysis:"Codebase Analysis",metrics_review:"Metrics Review",market_research:"Market Research",seo_audit:"SEO Audit",manual:"Manual"},x={pending:"bg-slate-100 text-slate-700",validated:"bg-emerald-100 text-emerald-800",needs_investigation:"bg-amber-100 text-amber-800",inconclusive:"bg-slate-100 text-slate-600",invalidated:"bg-red-100 text-red-800"},h={pending:"Pending",validated:"Validated",needs_investigation:"Needs Investigation",inconclusive:"Inconclusive",invalidated:"Invalidated"},u={ship:"Ship",update:"Update",milestone:"Milestone",digest:"Digest",manual:"Manual",thread:"Thread",insight:"Insight"},p={ship:"bg-green-100 text-green-800",update:"bg-blue-100 text-blue-800",milestone:"bg-amber-100 text-amber-800",digest:"bg-purple-100 text-purple-800",manual:"bg-slate-100 text-slate-800",thread:"bg-indigo-100 text-indigo-800",insight:"bg-cyan-100 text-cyan-800"},b={acquisition:"Acquisition",activation:"Activation",retention:"Retention",revenue:"Revenue",referral:"Referral"},g={acquisition:"bg-blue-100 text-blue-800",activation:"bg-emerald-100 text-emerald-800",retention:"bg-purple-100 text-purple-800",revenue:"bg-amber-100 text-amber-800",referral:"bg-pink-100 text-pink-800"},j={on_track:"On Track",at_risk:"At Risk",behind:"Behind",achieved:"Achieved"},f={on_track:"bg-emerald-100 text-emerald-800 border-emerald-300",at_risk:"bg-amber-100 text-amber-800 border-amber-300",behind:"bg-red-100 text-red-800 border-red-300",achieved:"bg-blue-100 text-blue-800 border-blue-300"},N={manual:"Manual",rest_api:"REST API",posthog:"PostHog",firestore:"Firestore",stripe:"Stripe",whatsapp:"WhatsApp"},v={stated:"Stated",testing:"Testing",validated:"Validated",invalidated:"Invalidated",deferred:"Deferred"},w={stated:"bg-slate-100 text-slate-800 border-slate-300",testing:"bg-amber-100 text-amber-800 border-amber-300",validated:"bg-emerald-100 text-emerald-800 border-emerald-300",invalidated:"bg-red-100 text-red-800 border-red-300",deferred:"bg-slate-100 text-slate-500 border-slate-200"},_={acquisition:"Acquisition",engagement:"Engagement",conversion:"Conversion",monetization:"Monetization"},y={acquisition:"bg-blue-100 text-blue-800",engagement:"bg-purple-100 text-purple-800",conversion:"bg-amber-100 text-amber-800",monetization:"bg-emerald-100 text-emerald-800"},Z={planned:"Planned",active:"Active",completed:"Completed",paused:"Paused"},S={planned:"bg-slate-100 text-slate-700 border-slate-300",active:"bg-blue-100 text-blue-800 border-blue-300",completed:"bg-emerald-100 text-emerald-800 border-emerald-300",paused:"bg-amber-100 text-amber-800 border-amber-300"}}},function(e){e.O(0,[746,59,971,117,744],function(){return e(e.s=703)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25],{9375:function(e,t,a){Promise.resolve().then(a.bind(a,47))},2660:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},1047:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]])},6362:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},5846:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]])},47:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return m}});var s=a(7437),r=a(2265),n=a(7648),l=a(2660);let i=(0,a(9205).Z)("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);var d=a(5846),c=a(8896),o=a(1047),x=a(6362),u=a(1994),h=a(1259),p=a(6153);function m(e){let{params:t}=e,{id:a}=t,[m,b]=(0,r.useState)(null),[g,f]=(0,r.useState)([]),[j,v]=(0,r.useState)(null),[N,y]=(0,r.useState)(!0),[w,_]=(0,r.useState)(null);(0,r.useEffect)(()=>{!async function(){try{let e=await fetch("/api/epics/".concat(a)),t=await e.json();if(!t.success){_(t.error||"Failed to load epic");return}if(b(t.data),t.data.idea_ids.length>0){let e=await fetch("/api/ideas"),a=await e.json();if(a.success){let e=t.data.idea_ids.map(e=>a.data.find(t=>t.id===e)).filter(Boolean);f(e)}}if(t.data.goal_id){let e=await fetch("/api/goals/".concat(t.data.goal_id)),a=await e.json();a.success&&v(a.data)}}catch(e){_("Failed to load epic"),console.error("Error fetching epic:",e)}finally{y(!1)}}()},[a]);let k=async e=>{try{let t=await fetch("/api/epics/".concat(a),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:e,status_override:!0})}),s=await t.json();s.success&&b(s.data)}catch(e){console.error("Failed to update status:",e)}};return N?(0,s.jsx)(h.default,{children:(0,s.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,s.jsx)("div",{className:"w-8 h-8 border-4 border-slate-200 border-t-blue-500 rounded-full animate-spin"})})}):w||!m?(0,s.jsx)(h.default,{children:(0,s.jsxs)("div",{className:"p-6",children:[(0,s.jsxs)(n.default,{href:"/roadmap",className:"inline-flex items-center gap-2 text-slate-600 hover:text-slate-900 mb-6",children:[(0,s.jsx)(l.Z,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Back to Roadmap"})]}),(0,s.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 text-center",children:(0,s.jsx)("p",{className:"text-red-600",children:w||"Epic not found"})})]})}):(0,s.jsx)(h.default,{children:(0,s.jsxs)("div",{className:"p-6",children:[(0,s.jsxs)(n.default,{href:"/roadmap",className:"inline-flex items-center gap-2 text-slate-600 hover:text-slate-900 mb-6",children:[(0,s.jsx)(l.Z,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Back to Roadmap"})]}),(0,s.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6 mb-6",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between mb-4",children:[(0,s.jsxs)("div",{className:"flex items-start gap-4",children:[(0,s.jsx)("div",{className:"w-14 h-14 bg-blue-100 rounded-xl flex items-center justify-center flex-shrink-0",children:(0,s.jsx)(i,{className:"w-7 h-7 text-blue-600"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,s.jsx)("span",{className:(0,u.Z)("text-xs px-2 py-0.5 rounded-full",p.pG[m.category]),children:p.Hs[m.category]})}),(0,s.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-1",children:m.title}),(0,s.jsx)("p",{className:"text-slate-500",children:m.description})]})]}),(0,s.jsxs)("div",{className:"flex flex-col items-end gap-2",children:[(0,s.jsx)("span",{className:(0,u.Z)("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium border",p.xP[m.status]),children:p.GK[m.status]}),(0,s.jsxs)("select",{value:m.status,onChange:e=>k(e.target.value),className:"text-xs border border-slate-200 rounded px-2 py-1 text-slate-600",children:[(0,s.jsx)("option",{value:"planned",children:"Planned"}),(0,s.jsx)("option",{value:"active",children:"Active"}),(0,s.jsx)("option",{value:"completed",children:"Completed"}),(0,s.jsx)("option",{value:"paused",children:"Paused"})]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-6 text-sm text-slate-500 mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(d.Z,{className:"w-4 h-4"}),(0,s.jsxs)("span",{children:[m.idea_ids.length," ideas"]})]}),j&&(0,s.jsxs)(n.default,{href:"/goals/".concat(j.id),className:"flex items-center gap-2 text-emerald-600 hover:text-emerald-700",children:[(0,s.jsx)(c.Z,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:j.title})]})]}),(0,s.jsxs)("div",{className:"flex items-start gap-4 mb-4",children:[(0,s.jsx)(o.Z,{className:"w-4 h-4 text-slate-400 mt-2"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-slate-500 mb-1",children:"Target Start"}),(0,s.jsx)("input",{type:"date",value:m.target_start||"",onChange:async e=>{let t=e.target.value||null;try{let e=await fetch("/api/epics/".concat(a),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({target_start:t})}),s=await e.json();s.success&&b(s.data)}catch(e){console.error("Failed to update target_start:",e)}},className:"text-sm border border-slate-200 rounded px-2 py-1 text-slate-700"}),!m.target_start&&(0,s.jsx)("span",{className:"text-[10px] text-slate-400 block mt-0.5",children:"auto-estimated"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-slate-500 mb-1",children:"Target End"}),(0,s.jsx)("input",{type:"date",value:m.target_end||"",onChange:async e=>{let t=e.target.value||null;try{let e=await fetch("/api/epics/".concat(a),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({target_end:t})}),s=await e.json();s.success&&b(s.data)}catch(e){console.error("Failed to update target_end:",e)}},className:"text-sm border border-slate-200 rounded px-2 py-1 text-slate-700"}),!m.target_end&&(0,s.jsx)("span",{className:"text-[10px] text-slate-400 block mt-0.5",children:"auto-estimated"})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,s.jsxs)("span",{className:"text-xs text-slate-500",children:[m.progress.shipped_count,"/",m.progress.total_ideas," ideas shipped"]}),(0,s.jsxs)("span",{className:"text-xs font-medium text-slate-700",children:[m.progress.progress_pct,"%"]})]}),(0,s.jsx)("div",{className:"relative h-2 bg-slate-100 rounded-full overflow-hidden",children:(0,s.jsx)("div",{className:(0,u.Z)("absolute left-0 top-0 h-full rounded-full transition-all duration-500","completed"===m.status?"bg-emerald-500":"active"===m.status?"bg-blue-500":"bg-slate-300"),style:{width:"".concat(m.progress.progress_pct,"%")}})}),m.progress.effort_total>0&&(0,s.jsxs)("p",{className:"text-xs text-slate-400 mt-1",children:["Effort: ",m.progress.effort_completed,"/",m.progress.effort_total," points completed"]})]})]}),(0,s.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200",children:[(0,s.jsx)("div",{className:"px-6 py-4 border-b border-slate-200",children:(0,s.jsxs)("h2",{className:"text-lg font-semibold text-slate-900",children:["Ideas (",g.length,")"]})}),g.length>0?(0,s.jsx)("div",{className:"divide-y divide-slate-100",children:g.map((e,t)=>(0,s.jsxs)(n.default,{href:"/ideas/".concat(e.id),className:"flex items-center gap-4 px-6 py-3 hover:bg-slate-50 transition-colors",children:[(0,s.jsx)("span",{className:"text-xs text-slate-400 w-6 text-center",children:t+1}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("h3",{className:"text-sm font-medium text-slate-900 truncate",children:e.title}),(0,s.jsx)("p",{className:"text-xs text-slate-500 truncate",children:e.summary})]}),(0,s.jsx)("span",{className:(0,u.Z)("text-xs px-2 py-0.5 rounded-full text-white",p.lv[e.stage]),children:p.yb[e.stage]}),(0,s.jsx)("span",{className:"text-xs text-slate-400 w-8 text-center",children:p.bi[e.effort]}),(0,s.jsx)(x.Z,{className:"w-4 h-4 text-slate-300 flex-shrink-0"})]},e.id))}):(0,s.jsxs)("div",{className:"p-8 text-center",children:[(0,s.jsx)(d.Z,{className:"w-8 h-8 text-slate-300 mx-auto mb-2"}),(0,s.jsx)("p",{className:"text-sm text-slate-500",children:"No ideas in this epic yet. Add ideas via the API."})]})]}),(0,s.jsxs)("div",{className:"mt-6 text-xs text-slate-400",children:[(0,s.jsxs)("p",{children:["Created: ",new Date(m.created_at).toLocaleString()]}),(0,s.jsxs)("p",{children:["Last updated: ",new Date(m.updated_at).toLocaleString()]})]})]})})}},1259:function(e,t,a){"use strict";a.d(t,{default:function(){return f}});var s=a(7437),r=a(7648),n=a(9376),l=a(5466),i=a(2048),d=a(8896),c=a(8220),o=a(2718),x=a(5621),u=a(8728),h=a(2222),p=a(2023),m=a(1994),b=a(257);let g=[{href:"/",label:"Dashboard",icon:(0,s.jsx)(l.Z,{className:"w-5 h-5"})},{href:"/roadmap",label:"Roadmap",icon:(0,s.jsx)(i.Z,{className:"w-5 h-5"})},{href:"/goals",label:"Goals",icon:(0,s.jsx)(d.Z,{className:"w-5 h-5"})},{href:"/hypotheses",label:"Hypotheses",icon:(0,s.jsx)(c.Z,{className:"w-5 h-5"})},{href:"/social",label:"Social",icon:(0,s.jsx)(o.Z,{className:"w-5 h-5"})},{href:"/sessions",label:"Sessions",icon:(0,s.jsx)(x.Z,{className:"w-5 h-5"})},{href:"/settings",label:"Settings",icon:(0,s.jsx)(u.Z,{className:"w-5 h-5"})}];function f(e){let{children:t}=e,a=(0,n.usePathname)();return(0,s.jsxs)("div",{className:"min-h-screen flex",children:[(0,s.jsxs)("aside",{className:"w-64 bg-slate-900 text-white flex flex-col",children:[(0,s.jsx)("div",{className:"p-4 border-b border-slate-700",children:(0,s.jsxs)(r.default,{href:"/",className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-10 h-10 bg-emerald-500 rounded-lg flex items-center justify-center",children:(0,s.jsx)(h.Z,{className:"w-6 h-6 text-white"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"font-bold text-lg leading-tight",children:"Analyst"}),(0,s.jsx)("p",{className:"text-xs text-slate-400",children:b.env.NEXT_PUBLIC_PRODUCT_NAME||"Business"})]})]})}),(0,s.jsx)("nav",{className:"flex-1 p-4",children:(0,s.jsx)("ul",{className:"space-y-1",children:g.map(e=>{let t="/"===e.href?"/"===a:a.startsWith(e.href);return(0,s.jsx)("li",{children:(0,s.jsxs)(r.default,{href:e.href,className:(0,m.Z)("flex items-center gap-3 px-3 py-2 rounded-lg transition-colors",t?"bg-slate-800 text-white":"text-slate-400 hover:text-white hover:bg-slate-800"),children:[e.icon,(0,s.jsx)("span",{children:e.label})]})},e.href)})})}),(0,s.jsx)("div",{className:"p-4 border-t border-slate-700",children:(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[(0,s.jsx)(p.Z,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Powered by Claude"})]})})]}),(0,s.jsx)("main",{className:"flex-1 overflow-auto",children:t})]})}},6153:function(e,t,a){"use strict";a.d(t,{G:function(){return i},GK:function(){return k},Gs:function(){return o},Hs:function(){return s},PN:function(){return p},PW:function(){return w},Q_:function(){return m},R$:function(){return N},Vr:function(){return x},Wb:function(){return h},aR:function(){return u},bi:function(){return d},en:function(){return v},i2:function(){return j},kT:function(){return b},l5:function(){return g},lE:function(){return y},lv:function(){return l},pG:function(){return r},rF:function(){return c},tV:function(){return f},tl:function(){return _},xP:function(){return Z},yb:function(){return n}});let s={product:"Product",ux_design:"UX/Design",growth:"Growth",performance:"Performance",tech_debt:"Tech Debt",security:"Security",infrastructure:"Infrastructure",content:"Content",analytics:"Analytics",integration:"Integration"},r={product:"bg-blue-100 text-blue-800",ux_design:"bg-purple-100 text-purple-800",growth:"bg-green-100 text-green-800",performance:"bg-orange-100 text-orange-800",tech_debt:"bg-yellow-100 text-yellow-800",security:"bg-red-100 text-red-800",infrastructure:"bg-gray-100 text-gray-800",content:"bg-pink-100 text-pink-800",analytics:"bg-cyan-100 text-cyan-800",integration:"bg-indigo-100 text-indigo-800"},n={inbox:"Inbox",under_review:"Under Review",approved:"Approved",in_progress:"In Progress",testing:"Testing",shipped:"Shipped",deferred:"Deferred",rejected:"Rejected",rolled_back:"Rolled Back"},l={inbox:"bg-amber-500",under_review:"bg-blue-500",approved:"bg-emerald-500",in_progress:"bg-violet-500",testing:"bg-cyan-500",shipped:"bg-green-500",deferred:"bg-gray-500",rejected:"bg-red-500",rolled_back:"bg-orange-500"},i=["inbox","under_review","approved","in_progress","testing","shipped"],d={xs:"XS",s:"S",m:"M",l:"L",xl:"XL"},c={critical:"Critical",high:"High",medium:"Medium",low:"Low"},o={critical:"bg-red-100 text-red-800 border-red-300",high:"bg-orange-100 text-orange-800 border-orange-300",medium:"bg-yellow-100 text-yellow-800 border-yellow-300",low:"bg-gray-100 text-gray-800 border-gray-300"},x={codebase_analysis:"Codebase Analysis",metrics_review:"Metrics Review",market_research:"Market Research",seo_audit:"SEO Audit",manual:"Manual"},u={pending:"bg-slate-100 text-slate-700",validated:"bg-emerald-100 text-emerald-800",needs_investigation:"bg-amber-100 text-amber-800",inconclusive:"bg-slate-100 text-slate-600",invalidated:"bg-red-100 text-red-800"},h={pending:"Pending",validated:"Validated",needs_investigation:"Needs Investigation",inconclusive:"Inconclusive",invalidated:"Invalidated"},p={ship:"Ship",update:"Update",milestone:"Milestone",digest:"Digest",manual:"Manual",thread:"Thread",insight:"Insight"},m={ship:"bg-green-100 text-green-800",update:"bg-blue-100 text-blue-800",milestone:"bg-amber-100 text-amber-800",digest:"bg-purple-100 text-purple-800",manual:"bg-slate-100 text-slate-800",thread:"bg-indigo-100 text-indigo-800",insight:"bg-cyan-100 text-cyan-800"},b={acquisition:"Acquisition",activation:"Activation",retention:"Retention",revenue:"Revenue",referral:"Referral"},g={acquisition:"bg-blue-100 text-blue-800",activation:"bg-emerald-100 text-emerald-800",retention:"bg-purple-100 text-purple-800",revenue:"bg-amber-100 text-amber-800",referral:"bg-pink-100 text-pink-800"},f={on_track:"On Track",at_risk:"At Risk",behind:"Behind",achieved:"Achieved"},j={on_track:"bg-emerald-100 text-emerald-800 border-emerald-300",at_risk:"bg-amber-100 text-amber-800 border-amber-300",behind:"bg-red-100 text-red-800 border-red-300",achieved:"bg-blue-100 text-blue-800 border-blue-300"},v={manual:"Manual",rest_api:"REST API",posthog:"PostHog",firestore:"Firestore",stripe:"Stripe",whatsapp:"WhatsApp"},N={stated:"Stated",testing:"Testing",validated:"Validated",invalidated:"Invalidated",deferred:"Deferred"},y={stated:"bg-slate-100 text-slate-800 border-slate-300",testing:"bg-amber-100 text-amber-800 border-amber-300",validated:"bg-emerald-100 text-emerald-800 border-emerald-300",invalidated:"bg-red-100 text-red-800 border-red-300",deferred:"bg-slate-100 text-slate-500 border-slate-200"},w={acquisition:"Acquisition",engagement:"Engagement",conversion:"Conversion",monetization:"Monetization"},_={acquisition:"bg-blue-100 text-blue-800",engagement:"bg-purple-100 text-purple-800",conversion:"bg-amber-100 text-amber-800",monetization:"bg-emerald-100 text-emerald-800"},k={planned:"Planned",active:"Active",completed:"Completed",paused:"Paused"},Z={planned:"bg-slate-100 text-slate-700 border-slate-300",active:"bg-blue-100 text-blue-800 border-blue-300",completed:"bg-emerald-100 text-emerald-800 border-emerald-300",paused:"bg-amber-100 text-amber-800 border-amber-300"}}},function(e){e.O(0,[746,971,117,744],function(){return e(e.s=9375)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[938],{8645:function(e,s,t){Promise.resolve().then(t.bind(t,8444))},401:function(e,s,t){"use strict";t.d(s,{Z:function(){return a}});let a=(0,t(9205).Z)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},1723:function(e,s,t){"use strict";t.d(s,{Z:function(){return a}});let a=(0,t(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},6362:function(e,s,t){"use strict";t.d(s,{Z:function(){return a}});let a=(0,t(9205).Z)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},1817:function(e,s,t){"use strict";t.d(s,{Z:function(){return a}});let a=(0,t(9205).Z)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},9397:function(e,s,t){"use strict";t.d(s,{Z:function(){return a}});let a=(0,t(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},7168:function(e,s,t){"use strict";t.d(s,{Z:function(){return a}});let a=(0,t(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},3247:function(e,s,t){"use strict";t.d(s,{Z:function(){return a}});let a=(0,t(9205).Z)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},8930:function(e,s,t){"use strict";t.d(s,{Z:function(){return a}});let a=(0,t(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},2489:function(e,s,t){"use strict";t.d(s,{Z:function(){return a}});let a=(0,t(9205).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},8444:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return v}});var a=t(7437),l=t(2265),n=t(1817),i=t(7168),r=t(9205);let c=(0,r.Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),d=(0,r.Z)("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),o=(0,r.Z)("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);var m=t(401),x=t(2489),h=t(9397),p=t(8930),u=t(3247),b=t(1723);let j=(0,r.Z)("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);var f=t(6362);let y=(0,r.Z)("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);var g=t(1259),N=t(1994);function v(){let[e,s]=(0,l.useState)(null),[t,r]=(0,l.useState)(!0),[v,k]=(0,l.useState)(!1),[w,C]=(0,l.useState)(null),[Z,S]=(0,l.useState)(""),[M,_]=(0,l.useState)(!1),[A,I]=(0,l.useState)(null),[P,L]=(0,l.useState)(null),[T,E]=(0,l.useState)(null),[R,H]=(0,l.useState)(null),[O,q]=(0,l.useState)(null),[D,F]=(0,l.useState)(""),[z,K]=(0,l.useState)(!1),[U,V]=(0,l.useState)(null);(0,l.useEffect)(()=>{B(),J(),G()},[]);let B=async()=>{try{let e=await fetch("/api/config"),t=await e.json();t.success&&s(t.data)}catch(e){console.error("Failed to load config:",e)}finally{r(!1)}},J=async()=>{try{let e=await fetch("/api/license"),s=await e.json();s.success&&q(s.data)}catch(e){}},G=async()=>{try{let e=await fetch("/api/provider-status"),s=await e.json();s.success&&H(s.data)}catch(e){}},W=async()=>{if(D.trim()){K(!0),V(null);try{let e=await fetch("/api/license",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:D.trim()})}),s=await e.json();s.success?(V({type:"success",text:s.data.message}),q(s.data),F("")):V({type:"error",text:s.error||"Activation failed"})}catch(e){V({type:"error",text:"Failed to activate license"})}finally{K(!1),setTimeout(()=>V(null),5e3)}}},X=async()=>{if(e){k(!0),C(null);try{(await fetch("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok?C({type:"success",text:"Settings saved successfully"}):C({type:"error",text:"Failed to save settings"})}catch(e){C({type:"error",text:"Failed to save settings"})}finally{k(!1),setTimeout(()=>C(null),3e3)}}},Q=(t,a,l)=>{if(!e)return;let n=[...e.repos];n[t]={...n[t],[a]:l},s({...e,repos:n})},Y=t=>{if(!e)return;let a=e.repos.filter((e,s)=>s!==t);s({...e,repos:a})},$=async()=>{if(Z.trim()){_(!0),I(null),L(null),E(null);try{let e=await fetch("/api/config/detect-repos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rootDir:Z.trim()})}),s=await e.json();if(!s.success){E(s.error||"Scan failed");return}I(s.data.repos),s.data.warning&&L(s.data.warning)}catch(e){E("Failed to scan directory")}finally{_(!1)}}},ee=t=>{if(!e)return;let a=new Set(e.repos.map(e=>e.path)),l=t.filter(e=>!a.has(e.path)).map(e=>({name:e.name,path:e.path,type:e.type,default_branch:"main"}));s({...e,repos:[...e.repos,...l]}),I(null),L(null)},es=t=>{e&&(s({...e,repos:t.map(e=>({name:e.name,path:e.path,type:e.type,default_branch:"main"}))}),I(null),L(null))},et=(t,a,l)=>{if(!e)return;let n={...e.schedules};"focus"===a?n[t]={...n[t],focus:l.split(",").map(e=>e.trim())}:"max_ideas"===a&&(n[t]={...n[t],max_ideas:l}),s({...e,schedules:n})};return t?(0,a.jsx)(g.default,{children:(0,a.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,a.jsx)(n.Z,{className:"w-8 h-8 text-slate-400 animate-spin"})})}):e?(0,a.jsx)(g.default,{children:(0,a.jsxs)("div",{className:"p-6 max-w-4xl",children:[(0,a.jsxs)("header",{className:"flex items-center justify-between mb-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold text-slate-900",children:"Settings"}),(0,a.jsx)("p",{className:"text-slate-500 mt-1",children:"Configure analysis settings and repositories"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)("button",{onClick:B,className:"btn btn-secondary gap-2",disabled:t,children:[(0,a.jsx)(i.Z,{className:(0,N.Z)("w-4 h-4",t&&"animate-spin")}),"Reload"]}),(0,a.jsxs)("button",{onClick:X,className:"btn btn-primary gap-2",disabled:v,children:[v?(0,a.jsx)(n.Z,{className:"w-4 h-4 animate-spin"}):(0,a.jsx)(c,{className:"w-4 h-4"}),"Save Changes"]})]})]}),w&&(0,a.jsx)("div",{className:(0,N.Z)("mb-6 p-4 rounded-lg border animate-slide-in","success"===w.type?"bg-emerald-50 border-emerald-200 text-emerald-700":"bg-red-50 border-red-200 text-red-700"),children:w.text}),(0,a.jsxs)("section",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6 mb-6",children:[(0,a.jsxs)("h2",{className:"flex items-center gap-2 text-lg font-semibold text-slate-900 mb-4",children:[(0,a.jsx)(d,{className:"w-5 h-5"}),"Implementation Workspace"]}),(0,a.jsx)("p",{className:"text-sm text-slate-500 mb-4",children:"Directory where the analyst clones repositories for implementation work (separate from your working copies)."}),(0,a.jsx)("input",{type:"text",value:e.workspace_dir||"",onChange:t=>s({...e,workspace_dir:t.target.value}),className:"input font-mono text-sm",placeholder:"/Users/you/Code/analyst-workspaces"})]}),(0,a.jsxs)("section",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6 mb-6",children:[(0,a.jsxs)("h2",{className:"flex items-center gap-2 text-lg font-semibold text-slate-900 mb-4",children:[(0,a.jsx)(o,{className:"w-5 h-5"}),"AI Provider"]}),R?(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{className:"p-4 bg-slate-50 rounded-lg",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-slate-500 mb-1",children:"Provider"}),(0,a.jsx)("p",{className:"text-sm font-semibold text-slate-900",children:R.provider||"None"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-slate-500 mb-1",children:"Status"}),(0,a.jsx)("span",{className:(0,N.Z)("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",R.provider?"bg-emerald-100 text-emerald-700":"bg-slate-100 text-slate-600"),children:R.provider?"Active":"Not configured"})]}),R.keyMasked&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-slate-500 mb-1",children:"API Key"}),(0,a.jsx)("p",{className:"text-sm font-mono text-slate-700",children:R.keyMasked})]}),R.model&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-slate-500 mb-1",children:"Model"}),(0,a.jsx)("p",{className:"text-sm text-slate-700",children:R.model})]}),R.keySource&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-slate-500 mb-1",children:"Key Source"}),(0,a.jsx)("p",{className:"text-sm text-slate-700 capitalize",children:"credentials"===R.keySource?"~/.vibebusiness/credentials.json":"Environment variable"})]}),R.cli&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-slate-500 mb-1",children:"Claude CLI"}),(0,a.jsx)("p",{className:"text-sm text-slate-700",children:R.cli.version||"Installed"})]})]})}),(0,a.jsxs)("div",{className:"p-4 bg-slate-50 rounded-lg",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-slate-700 mb-3",children:"Capabilities"}),(0,a.jsx)("div",{className:"grid grid-cols-2 gap-2",children:[{key:"heartbeat_reasoning",label:"Heartbeat reasoning",needs:"API key"},{key:"idea_evaluation",label:"Idea evaluation",needs:"API key"},{key:"idea_decomposition",label:"Idea decomposition",needs:"API key"},{key:"codebase_analysis",label:"Codebase analysis",needs:"Claude CLI"},{key:"implementation",label:"Implementation",needs:"Claude CLI"},{key:"interactive_chat",label:"Interactive chat",needs:"Claude CLI"}].map(e=>{let{key:s,label:t,needs:l}=e;return(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[R.capabilities[s]?(0,a.jsx)(m.Z,{className:"w-3.5 h-3.5 text-emerald-600 flex-shrink-0"}):(0,a.jsx)(x.Z,{className:"w-3.5 h-3.5 text-slate-400 flex-shrink-0"}),(0,a.jsx)("span",{className:R.capabilities[s]?"text-slate-700":"text-slate-400",children:t}),!R.capabilities[s]&&(0,a.jsxs)("span",{className:"text-xs text-slate-400",children:["(needs ",l,")"]})]},s)})})]}),(0,a.jsxs)("p",{className:"text-xs text-slate-500",children:["Manage via CLI: ",(0,a.jsx)("code",{className:"text-xs bg-slate-100 px-1.5 py-0.5 rounded",children:"vibebusiness provider setup"})]})]}):(0,a.jsxs)("p",{className:"text-sm text-slate-500",children:["No AI provider configured. Run ",(0,a.jsx)("code",{className:"text-xs bg-slate-100 px-1.5 py-0.5 rounded",children:"vibebusiness provider setup"})," to set up."]})]}),(0,a.jsxs)("section",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6 mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h2",{className:"flex items-center gap-2 text-lg font-semibold text-slate-900",children:[(0,a.jsx)(d,{className:"w-5 h-5"}),"Repositories"]}),(0,a.jsxs)("button",{onClick:()=>{e&&s({...e,repos:[...e.repos,{name:"",path:"",type:"nodejs",default_branch:"main"}]})},className:"btn btn-secondary gap-2 text-sm",children:[(0,a.jsx)(h.Z,{className:"w-4 h-4"}),"Add Repository"]})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[e.repos.map((e,s)=>(0,a.jsxs)("div",{className:"p-4 bg-slate-50 rounded-lg space-y-3 relative group",children:[(0,a.jsx)("button",{onClick:()=>Y(s),className:"absolute top-3 right-3 p-1.5 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded transition-colors",title:"Remove repository",children:(0,a.jsx)(p.Z,{className:"w-4 h-4"})}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-4 pr-10",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Name"}),(0,a.jsx)("input",{type:"text",value:e.name,onChange:e=>Q(s,"name",e.target.value),className:"input",placeholder:"my-repo"})]}),(0,a.jsxs)("div",{className:"col-span-2",children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Local Path (for analysis)"}),(0,a.jsx)("input",{type:"text",value:e.path,onChange:e=>Q(s,"path",e.target.value),className:"input font-mono text-sm",placeholder:"/Users/you/Code/my-repo"})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-4 gap-4 pr-10",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Type"}),(0,a.jsx)("input",{type:"text",value:e.type||"",onChange:e=>Q(s,"type",e.target.value),className:"input text-sm",placeholder:"nextjs"})]}),(0,a.jsxs)("div",{className:"col-span-2",children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"GitHub URL (for cloning to workspace)"}),(0,a.jsx)("input",{type:"text",value:e.github_url||"",onChange:e=>Q(s,"github_url",e.target.value),className:"input font-mono text-sm",placeholder:"git@github.com:user/repo.git"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Default Branch"}),(0,a.jsx)("input",{type:"text",value:e.default_branch||"main",onChange:e=>Q(s,"default_branch",e.target.value),className:"input",placeholder:"main"})]})]})]},s)),0===e.repos.length&&(0,a.jsx)("div",{className:"text-center py-8 text-slate-400",children:"No repositories configured. Add one manually or scan a directory below."})]}),(0,a.jsxs)("div",{className:"mt-6 pt-6 border-t border-slate-200",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-slate-700 mb-2",children:"Scan Directory"}),(0,a.jsx)("p",{className:"text-sm text-slate-500 mb-3",children:"Auto-detect repositories in a directory."}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:Z,onChange:e=>S(e.target.value),className:"input font-mono text-sm flex-1",placeholder:"/Users/you/Code/my-project",onKeyDown:e=>"Enter"===e.key&&$()}),(0,a.jsxs)("button",{onClick:$,className:"btn btn-secondary gap-2 text-sm whitespace-nowrap",disabled:M||!Z.trim(),children:[M?(0,a.jsx)(n.Z,{className:"w-4 h-4 animate-spin"}):(0,a.jsx)(u.Z,{className:"w-4 h-4"}),"Scan"]})]}),T&&(0,a.jsx)("div",{className:"mt-3 p-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700",children:T}),P&&(0,a.jsx)("div",{className:"mt-3 p-3 bg-amber-50 border border-amber-200 rounded-lg text-sm text-amber-700",children:P}),A&&(0,a.jsx)("div",{className:"mt-3",children:0===A.length?(0,a.jsx)("div",{className:"p-3 bg-slate-50 rounded-lg text-sm text-slate-500",children:"No repositories detected in that directory."}):(0,a.jsxs)("div",{className:"p-4 bg-slate-50 rounded-lg space-y-3",children:[(0,a.jsxs)("div",{className:"text-sm font-medium text-slate-700",children:["Found ",A.length," repo",1!==A.length?"s":"",":"]}),(0,a.jsx)("div",{className:"space-y-1",children:A.map((e,s)=>(0,a.jsxs)("div",{className:"flex items-center gap-3 text-sm",children:[(0,a.jsx)("span",{className:(0,N.Z)("inline-block w-2 h-2 rounded-full","high"===e.confidence?"bg-emerald-500":"bg-amber-500")}),(0,a.jsx)("span",{className:"font-medium text-slate-900",children:e.name}),(0,a.jsxs)("span",{className:"text-slate-500",children:["(",e.type,")"]}),(0,a.jsx)("span",{className:"text-slate-400 font-mono text-xs truncate",children:e.path})]},s))}),(0,a.jsxs)("div",{className:"flex gap-2 pt-2",children:[(0,a.jsx)("button",{onClick:()=>ee(A),className:"btn btn-secondary text-sm",children:"Add to existing"}),(0,a.jsx)("button",{onClick:()=>es(A),className:"btn btn-secondary text-sm text-red-600 hover:text-red-700",children:"Replace all"}),(0,a.jsx)("button",{onClick:()=>{I(null),L(null)},className:"btn btn-secondary text-sm",children:"Dismiss"})]})]})})]})]}),(0,a.jsxs)("section",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:[(0,a.jsxs)("h2",{className:"flex items-center gap-2 text-lg font-semibold text-slate-900 mb-4",children:[(0,a.jsx)(b.Z,{className:"w-5 h-5"}),"Analysis Schedules"]}),(0,a.jsx)("div",{className:"space-y-6",children:Object.keys(e.schedules).map(s=>(0,a.jsxs)("div",{className:"p-4 bg-slate-50 rounded-lg",children:[(0,a.jsxs)("h3",{className:"font-medium text-slate-900 mb-3 capitalize",children:[s," Analysis"]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Focus Areas (comma-separated)"}),(0,a.jsx)("input",{type:"text",value:e.schedules[s].focus.join(", "),onChange:e=>et(s,"focus",e.target.value),className:"input"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Max Ideas"}),(0,a.jsx)("input",{type:"number",value:e.schedules[s].max_ideas,onChange:e=>et(s,"max_ideas",parseInt(e.target.value,10)),className:"input",min:1,max:50})]})]})]},s))})]}),(0,a.jsxs)("section",{className:"mt-6 p-4 bg-slate-100 rounded-lg",children:[(0,a.jsx)("h3",{className:"font-medium text-slate-700 mb-2",children:"Cron Setup"}),(0,a.jsx)("p",{className:"text-sm text-slate-600 mb-2",children:"To enable automated analysis, run the setup script:"}),(0,a.jsx)("pre",{className:"bg-slate-800 text-slate-100 p-3 rounded text-sm font-mono overflow-x-auto",children:"./scripts/setup-cron.sh"})]}),(0,a.jsxs)("section",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6 mt-6",children:[(0,a.jsxs)("h2",{className:"flex items-center gap-2 text-lg font-semibold text-slate-900 mb-4",children:[(0,a.jsx)(j,{className:"w-5 h-5"}),"Subscription & Billing"]}),O?(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"p-4 bg-slate-50 rounded-lg",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-slate-500 mb-1",children:"Plan"}),(0,a.jsx)("p",{className:"text-sm font-semibold text-slate-900 capitalize",children:O.tier})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-slate-500 mb-1",children:"Status"}),(0,a.jsx)("span",{className:(0,N.Z)("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium","valid"===O.status&&"bg-emerald-100 text-emerald-700","trial"===O.status&&"bg-blue-100 text-blue-700","expired"===O.status&&"bg-red-100 text-red-700",(!O.status||"unknown"===O.status)&&"bg-slate-100 text-slate-600"),children:O.status})]}),O.keyMasked&&"(trial)"!==O.keyMasked&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-slate-500 mb-1",children:"License Key"}),(0,a.jsx)("p",{className:"text-sm font-mono text-slate-700",children:O.keyMasked})]}),O.email&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-slate-500 mb-1",children:"Email"}),(0,a.jsx)("p",{className:"text-sm text-slate-700",children:O.email})]})]}),(0,a.jsx)("p",{className:"text-xs text-slate-500 mt-3",children:O.message})]}),(0,a.jsxs)("a",{href:"https://vibebusiness.com/pricing",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-emerald-600 hover:text-emerald-700 font-medium",children:[(0,a.jsx)(f.Z,{className:"w-3.5 h-3.5"}),"Manage Subscription"]})]}):(0,a.jsxs)("p",{className:"text-sm text-slate-500",children:["License information unavailable. Run ",(0,a.jsx)("code",{className:"text-xs bg-slate-100 px-1.5 py-0.5 rounded",children:"vibebusiness init"})," to set up."]}),(0,a.jsxs)("div",{className:"mt-6 pt-6 border-t border-slate-200",children:[(0,a.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-slate-700 mb-2",children:[(0,a.jsx)(y,{className:"w-4 h-4"}),"Enter License Key"]}),(0,a.jsx)("p",{className:"text-sm text-slate-500 mb-3",children:"Activate a license key purchased from vibebusiness.com."}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:D,onChange:e=>F(e.target.value),className:"input font-mono text-sm flex-1",placeholder:"PRO-xxxxxxxxxxxx",onKeyDown:e=>"Enter"===e.key&&W()}),(0,a.jsxs)("button",{onClick:W,className:"btn btn-primary gap-2 text-sm whitespace-nowrap",disabled:z||!D.trim(),children:[z?(0,a.jsx)(n.Z,{className:"w-4 h-4 animate-spin"}):(0,a.jsx)(y,{className:"w-4 h-4"}),"Activate"]})]}),U&&(0,a.jsx)("div",{className:(0,N.Z)("mt-3 p-3 rounded-lg text-sm","success"===U.type?"bg-emerald-50 border border-emerald-200 text-emerald-700":"bg-red-50 border border-red-200 text-red-700"),children:U.text})]})]})]})}):(0,a.jsx)(g.default,{children:(0,a.jsx)("div",{className:"p-6",children:(0,a.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 text-red-700",children:"Failed to load configuration. Please check that data/config.json exists."})})})}},1259:function(e,s,t){"use strict";t.d(s,{default:function(){return f}});var a=t(7437),l=t(7648),n=t(9376),i=t(5466),r=t(2048),c=t(8896),d=t(8220),o=t(2718),m=t(5621),x=t(8728),h=t(2222),p=t(2023),u=t(1994),b=t(257);let j=[{href:"/",label:"Dashboard",icon:(0,a.jsx)(i.Z,{className:"w-5 h-5"})},{href:"/roadmap",label:"Roadmap",icon:(0,a.jsx)(r.Z,{className:"w-5 h-5"})},{href:"/goals",label:"Goals",icon:(0,a.jsx)(c.Z,{className:"w-5 h-5"})},{href:"/hypotheses",label:"Hypotheses",icon:(0,a.jsx)(d.Z,{className:"w-5 h-5"})},{href:"/social",label:"Social",icon:(0,a.jsx)(o.Z,{className:"w-5 h-5"})},{href:"/sessions",label:"Sessions",icon:(0,a.jsx)(m.Z,{className:"w-5 h-5"})},{href:"/settings",label:"Settings",icon:(0,a.jsx)(x.Z,{className:"w-5 h-5"})}];function f(e){let{children:s}=e,t=(0,n.usePathname)();return(0,a.jsxs)("div",{className:"min-h-screen flex",children:[(0,a.jsxs)("aside",{className:"w-64 bg-slate-900 text-white flex flex-col",children:[(0,a.jsx)("div",{className:"p-4 border-b border-slate-700",children:(0,a.jsxs)(l.default,{href:"/",className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-emerald-500 rounded-lg flex items-center justify-center",children:(0,a.jsx)(h.Z,{className:"w-6 h-6 text-white"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"font-bold text-lg leading-tight",children:"Analyst"}),(0,a.jsx)("p",{className:"text-xs text-slate-400",children:b.env.NEXT_PUBLIC_PRODUCT_NAME||"Business"})]})]})}),(0,a.jsx)("nav",{className:"flex-1 p-4",children:(0,a.jsx)("ul",{className:"space-y-1",children:j.map(e=>{let s="/"===e.href?"/"===t:t.startsWith(e.href);return(0,a.jsx)("li",{children:(0,a.jsxs)(l.default,{href:e.href,className:(0,u.Z)("flex items-center gap-3 px-3 py-2 rounded-lg transition-colors",s?"bg-slate-800 text-white":"text-slate-400 hover:text-white hover:bg-slate-800"),children:[e.icon,(0,a.jsx)("span",{children:e.label})]})},e.href)})})}),(0,a.jsx)("div",{className:"p-4 border-t border-slate-700",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[(0,a.jsx)(p.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Powered by Claude"})]})})]}),(0,a.jsx)("main",{className:"flex-1 overflow-auto",children:s})]})}}},function(e){e.O(0,[746,971,117,744],function(){return e(e.s=8645)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[674],{337:function(e,t,s){Promise.resolve().then(s.bind(s,833))},1047:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]])},401:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},875:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},9322:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},6362:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},9397:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},7168:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},4743:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]])},8930:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},2489:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},833:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return w}});var a=s(7437),r=s(2265),n=s(9397),l=s(7168),i=s(9322),d=s(9205);let c=(0,d.Z)("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);var o=s(4743),x=s(1259),u=s(1047),m=s(2489),h=s(401);let b=(0,d.Z)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var p=s(875),g=s(6362);let f=(0,d.Z)("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);var j=s(8930),v=s(1994),y=s(6153);function N(e){let{draft:t,onPublish:s,onEdit:n,onDiscard:l}=e,[i,d]=(0,r.useState)(!1),[c,x]=(0,r.useState)(t.text),[N,w]=(0,r.useState)(!1),[k,_]=(0,r.useState)(!1),Z=i?c.length:t.text.length,C=Z>280,S="draft"===t.status;async function M(){w(!0);try{await s(t.id)}finally{w(!1)}}async function P(){if(!C&&c.trim()){w(!0);try{await n(t.id,c),d(!1)}finally{w(!1)}}}async function E(){w(!0);try{await l(t.id)}finally{w(!1)}}return(0,a.jsxs)("div",{className:(0,v.Z)("border rounded-lg p-4 transition-colors",S?"bg-white border-slate-200":"bg-slate-50 border-slate-100"),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:(0,v.Z)("text-xs px-2 py-0.5 rounded-full font-medium",y.Q_[t.source]),children:y.PN[t.source]}),t.is_thread&&t.thread_tweets&&(0,a.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded-full font-medium bg-indigo-50 text-indigo-600 border border-indigo-200",children:[t.thread_tweets.length," tweets"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[t.scheduled_date&&(0,a.jsxs)("span",{className:"text-xs text-slate-500 flex items-center gap-1",children:[(0,a.jsx)(u.Z,{className:"w-3 h-3"}),new Date(t.scheduled_date+"T00:00:00").toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})]}),(0,a.jsx)("span",{className:"text-xs text-slate-400",children:new Date(t.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]})]}),i?(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsx)("textarea",{value:c,onChange:e=>x(e.target.value),className:"w-full border border-slate-300 rounded-md p-3 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-blue-500",rows:4,maxLength:300}),(0,a.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,a.jsxs)("span",{className:(0,v.Z)("text-xs",C?"text-red-500 font-medium":"text-slate-400"),children:[Z,"/280"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("button",{onClick:()=>{d(!1),x(t.text)},className:"text-xs text-slate-500 hover:text-slate-700 flex items-center gap-1",disabled:N,children:[(0,a.jsx)(m.Z,{className:"w-3 h-3"})," Cancel"]}),(0,a.jsxs)("button",{onClick:P,className:"text-xs text-blue-600 hover:text-blue-800 flex items-center gap-1 disabled:opacity-50",disabled:N||C||!c.trim(),children:[(0,a.jsx)(h.Z,{className:"w-3 h-3"})," Save"]})]})]})]}):(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsx)("p",{className:"text-sm text-slate-800 whitespace-pre-wrap leading-relaxed",children:t.text}),S&&!t.is_thread&&(0,a.jsx)("div",{className:"mt-1",children:(0,a.jsxs)("span",{className:(0,v.Z)("text-xs",Z>260?"text-amber-500":"text-slate-400"),children:[Z,"/280"]})}),t.is_thread&&t.thread_tweets&&t.thread_tweets.length>1&&(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsxs)("button",{onClick:()=>_(!k),className:"text-xs text-indigo-600 hover:text-indigo-800 flex items-center gap-1 transition-colors",children:[k?(0,a.jsx)(b,{className:"w-3 h-3"}):(0,a.jsx)(p.Z,{className:"w-3 h-3"}),k?"Collapse thread":"Show all ".concat(t.thread_tweets.length," tweets")]}),k&&(0,a.jsx)("div",{className:"mt-2 space-y-2 border-l-2 border-indigo-200 pl-3",children:t.thread_tweets.slice(1).map((e,t)=>(0,a.jsxs)("div",{className:"text-sm text-slate-700 whitespace-pre-wrap leading-relaxed",children:[(0,a.jsxs)("span",{className:"text-xs font-medium text-indigo-400 mr-1",children:[t+2,"/"]}),e]},t))})]})]}),"published"===t.status&&t.tweet_url&&(0,a.jsxs)("a",{href:t.tweet_url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-500 hover:text-blue-700 flex items-center gap-1 mb-3",children:[(0,a.jsx)(g.Z,{className:"w-3 h-3"}),"View on X"]}),S&&!i&&(0,a.jsxs)("div",{className:"flex items-center gap-2 pt-3 border-t border-slate-100",children:[(0,a.jsxs)("button",{onClick:M,className:"flex items-center gap-1.5 px-3 py-1.5 bg-slate-900 text-white text-xs rounded-md hover:bg-slate-800 disabled:opacity-50 transition-colors",disabled:N,children:[(0,a.jsx)(o.Z,{className:"w-3 h-3"}),N?"Publishing...":"Publish"]}),(0,a.jsxs)("button",{onClick:()=>d(!0),className:"flex items-center gap-1.5 px-3 py-1.5 border border-slate-200 text-slate-600 text-xs rounded-md hover:bg-slate-50 disabled:opacity-50 transition-colors",disabled:N,children:[(0,a.jsx)(f,{className:"w-3 h-3"}),"Edit"]}),(0,a.jsxs)("button",{onClick:E,className:"flex items-center gap-1.5 px-3 py-1.5 text-red-500 text-xs rounded-md hover:bg-red-50 disabled:opacity-50 transition-colors ml-auto",disabled:N,children:[(0,a.jsx)(j.Z,{className:"w-3 h-3"}),"Discard"]})]})]})}function w(){var e;let[t,s]=(0,r.useState)(null),[d,u]=(0,r.useState)(!0),[m,h]=(0,r.useState)(null),[b,p]=(0,r.useState)(!1),[g,f]=(0,r.useState)(""),[j,v]=(0,r.useState)(!1),y=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/social"),t=await e.json();t.success?(s(t.data),h(null)):h(t.error||"Failed to load social data")}catch(e){h("Failed to connect to server")}finally{u(!1)}},[]);async function w(e){let t=await fetch("/api/social/".concat(e,"/publish"),{method:"POST"}),s=await t.json();if(!s.success){alert(s.error||"Failed to publish");return}await y()}async function k(e,t){let s=await fetch("/api/social/".concat(e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:t})}),a=await s.json();if(!a.success){alert(a.error||"Failed to update");return}await y()}async function _(e){let t=await fetch("/api/social/".concat(e),{method:"DELETE"}),s=await t.json();if(!s.success){alert(s.error||"Failed to discard");return}await y()}async function Z(){if(g.trim()&&!(g.length>280)){v(!0);try{let e=await fetch("/api/social",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:g})}),t=await e.json();t.success?(f(""),p(!1),await y()):alert(t.error||"Failed to create draft")}finally{v(!1)}}}(0,r.useEffect)(()=>{y()},[y]);let C=(null==t?void 0:t.drafts.filter(e=>"draft"===e.status))||[],S=(null==t?void 0:t.drafts.filter(e=>"published"===e.status).sort((e,t)=>(t.published_at||"").localeCompare(e.published_at||"")))||[];return(0,a.jsx)(x.default,{children:(0,a.jsxs)("div",{className:"p-6 max-w-3xl mx-auto",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold text-slate-900",children:"Social Media"}),(0,a.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:"Review and publish tweet drafts for your build-in-public journey."})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("button",{onClick:()=>p(!0),className:"flex items-center gap-1.5 px-3 py-2 bg-slate-900 text-white text-sm rounded-lg hover:bg-slate-800 transition-colors",children:[(0,a.jsx)(n.Z,{className:"w-4 h-4"}),"New Draft"]}),(0,a.jsx)("button",{onClick:()=>{u(!0),y()},className:"p-2 text-slate-400 hover:text-slate-600 transition-colors",title:"Refresh",children:(0,a.jsx)(l.Z,{className:"w-4 h-4 ".concat(d?"animate-spin":"")})})]})]}),t&&!t.metrics.credentials_valid&&(0,a.jsxs)("div",{className:"mb-6 p-4 bg-amber-50 border border-amber-200 rounded-lg flex items-start gap-3",children:[(0,a.jsx)(i.Z,{className:"w-5 h-5 text-amber-500 mt-0.5 flex-shrink-0"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium text-amber-800",children:"X/Twitter not connected"}),(0,a.jsxs)("p",{className:"text-xs text-amber-600 mt-1",children:["Add X_API_KEY, X_API_SECRET, X_ACCESS_TOKEN, and X_ACCESS_SECRET to your .env file, then run the ",(0,a.jsx)("code",{className:"bg-amber-100 px-1 rounded",children:"social-setup-x"})," task."]})]})]}),t&&t.metrics.credentials_valid&&(0,a.jsxs)("div",{className:"mb-6 grid grid-cols-4 gap-4",children:[(0,a.jsxs)("div",{className:"bg-white border border-slate-200 rounded-lg p-3 text-center",children:[(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"Account"}),(0,a.jsx)("p",{className:"text-sm font-medium text-slate-900 mt-1",children:t.metrics.username||"—"})]}),(0,a.jsxs)("div",{className:"bg-white border border-slate-200 rounded-lg p-3 text-center",children:[(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"Followers"}),(0,a.jsx)("p",{className:"text-sm font-medium text-slate-900 mt-1",children:null!==(e=t.metrics.followers_count)&&void 0!==e?e:"—"})]}),(0,a.jsxs)("div",{className:"bg-white border border-slate-200 rounded-lg p-3 text-center",children:[(0,a.jsxs)("p",{className:"text-xs text-slate-500 flex items-center justify-center gap-1",children:[(0,a.jsx)(c,{className:"w-3 h-3"})," Streak"]}),(0,a.jsxs)("p",{className:"text-sm font-medium text-slate-900 mt-1",children:[t.metrics.post_streak_days," day",1!==t.metrics.post_streak_days?"s":""]})]}),(0,a.jsxs)("div",{className:"bg-white border border-slate-200 rounded-lg p-3 text-center",children:[(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"Total Posts"}),(0,a.jsx)("p",{className:"text-sm font-medium text-slate-900 mt-1",children:t.metrics.total_posts})]})]}),b&&(0,a.jsxs)("div",{className:"mb-6 bg-white border border-slate-200 rounded-lg p-4",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-slate-900 mb-2",children:"Compose Tweet"}),(0,a.jsx)("textarea",{value:g,onChange:e=>f(e.target.value),className:"w-full border border-slate-300 rounded-md p-3 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-blue-500",rows:4,placeholder:"What's happening with your product?",maxLength:300,autoFocus:!0}),(0,a.jsxs)("div",{className:"flex items-center justify-between mt-2",children:[(0,a.jsxs)("span",{className:"text-xs ".concat(g.length>280?"text-red-500 font-medium":"text-slate-400"),children:[g.length,"/280"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:()=>{p(!1),f("")},className:"px-3 py-1.5 text-sm text-slate-500 hover:text-slate-700",children:"Cancel"}),(0,a.jsxs)("button",{onClick:Z,className:"flex items-center gap-1.5 px-3 py-1.5 bg-slate-900 text-white text-sm rounded-md hover:bg-slate-800 disabled:opacity-50 transition-colors",disabled:j||!g.trim()||g.length>280,children:[(0,a.jsx)(o.Z,{className:"w-3 h-3"}),"Save Draft"]})]})]})]}),d&&!t&&(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)(l.Z,{className:"w-6 h-6 animate-spin text-slate-400 mx-auto"}),(0,a.jsx)("p",{className:"text-sm text-slate-500 mt-2",children:"Loading drafts..."})]}),m&&(0,a.jsx)("div",{className:"text-center py-12",children:(0,a.jsx)("p",{className:"text-sm text-red-500",children:m})}),t&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsxs)("h2",{className:"text-lg font-semibold text-slate-900",children:["Drafts (",C.length,")"]})}),0===C.length?(0,a.jsx)("div",{className:"text-center py-8 bg-slate-50 rounded-lg border border-dashed border-slate-200",children:(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"No pending drafts. The heartbeat will generate drafts as you ship features and hit milestones."})}):(0,a.jsx)("div",{className:"space-y-3 mb-8",children:C.map(e=>(0,a.jsx)(N,{draft:e,onPublish:w,onEdit:k,onDiscard:_},e.id))}),S.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-4 mt-8",children:(0,a.jsxs)("h2",{className:"text-lg font-semibold text-slate-900",children:["Published (",S.length,")"]})}),(0,a.jsx)("div",{className:"space-y-3",children:S.map(e=>(0,a.jsx)(N,{draft:e,onPublish:w,onEdit:k,onDiscard:_},e.id))})]})]})]})})}},1259:function(e,t,s){"use strict";s.d(t,{default:function(){return f}});var a=s(7437),r=s(7648),n=s(9376),l=s(5466),i=s(2048),d=s(8896),c=s(8220),o=s(2718),x=s(5621),u=s(8728),m=s(2222),h=s(2023),b=s(1994),p=s(257);let g=[{href:"/",label:"Dashboard",icon:(0,a.jsx)(l.Z,{className:"w-5 h-5"})},{href:"/roadmap",label:"Roadmap",icon:(0,a.jsx)(i.Z,{className:"w-5 h-5"})},{href:"/goals",label:"Goals",icon:(0,a.jsx)(d.Z,{className:"w-5 h-5"})},{href:"/hypotheses",label:"Hypotheses",icon:(0,a.jsx)(c.Z,{className:"w-5 h-5"})},{href:"/social",label:"Social",icon:(0,a.jsx)(o.Z,{className:"w-5 h-5"})},{href:"/sessions",label:"Sessions",icon:(0,a.jsx)(x.Z,{className:"w-5 h-5"})},{href:"/settings",label:"Settings",icon:(0,a.jsx)(u.Z,{className:"w-5 h-5"})}];function f(e){let{children:t}=e,s=(0,n.usePathname)();return(0,a.jsxs)("div",{className:"min-h-screen flex",children:[(0,a.jsxs)("aside",{className:"w-64 bg-slate-900 text-white flex flex-col",children:[(0,a.jsx)("div",{className:"p-4 border-b border-slate-700",children:(0,a.jsxs)(r.default,{href:"/",className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-emerald-500 rounded-lg flex items-center justify-center",children:(0,a.jsx)(m.Z,{className:"w-6 h-6 text-white"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"font-bold text-lg leading-tight",children:"Analyst"}),(0,a.jsx)("p",{className:"text-xs text-slate-400",children:p.env.NEXT_PUBLIC_PRODUCT_NAME||"Business"})]})]})}),(0,a.jsx)("nav",{className:"flex-1 p-4",children:(0,a.jsx)("ul",{className:"space-y-1",children:g.map(e=>{let t="/"===e.href?"/"===s:s.startsWith(e.href);return(0,a.jsx)("li",{children:(0,a.jsxs)(r.default,{href:e.href,className:(0,b.Z)("flex items-center gap-3 px-3 py-2 rounded-lg transition-colors",t?"bg-slate-800 text-white":"text-slate-400 hover:text-white hover:bg-slate-800"),children:[e.icon,(0,a.jsx)("span",{children:e.label})]})},e.href)})})}),(0,a.jsx)("div",{className:"p-4 border-t border-slate-700",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[(0,a.jsx)(h.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Powered by Claude"})]})})]}),(0,a.jsx)("main",{className:"flex-1 overflow-auto",children:t})]})}},6153:function(e,t,s){"use strict";s.d(t,{G:function(){return i},GK:function(){return _},Gs:function(){return o},Hs:function(){return a},PN:function(){return h},PW:function(){return w},Q_:function(){return b},R$:function(){return y},Vr:function(){return x},Wb:function(){return m},aR:function(){return u},bi:function(){return d},en:function(){return v},i2:function(){return j},kT:function(){return p},l5:function(){return g},lE:function(){return N},lv:function(){return l},pG:function(){return r},rF:function(){return c},tV:function(){return f},tl:function(){return k},xP:function(){return Z},yb:function(){return n}});let a={product:"Product",ux_design:"UX/Design",growth:"Growth",performance:"Performance",tech_debt:"Tech Debt",security:"Security",infrastructure:"Infrastructure",content:"Content",analytics:"Analytics",integration:"Integration"},r={product:"bg-blue-100 text-blue-800",ux_design:"bg-purple-100 text-purple-800",growth:"bg-green-100 text-green-800",performance:"bg-orange-100 text-orange-800",tech_debt:"bg-yellow-100 text-yellow-800",security:"bg-red-100 text-red-800",infrastructure:"bg-gray-100 text-gray-800",content:"bg-pink-100 text-pink-800",analytics:"bg-cyan-100 text-cyan-800",integration:"bg-indigo-100 text-indigo-800"},n={inbox:"Inbox",under_review:"Under Review",approved:"Approved",in_progress:"In Progress",testing:"Testing",shipped:"Shipped",deferred:"Deferred",rejected:"Rejected",rolled_back:"Rolled Back"},l={inbox:"bg-amber-500",under_review:"bg-blue-500",approved:"bg-emerald-500",in_progress:"bg-violet-500",testing:"bg-cyan-500",shipped:"bg-green-500",deferred:"bg-gray-500",rejected:"bg-red-500",rolled_back:"bg-orange-500"},i=["inbox","under_review","approved","in_progress","testing","shipped"],d={xs:"XS",s:"S",m:"M",l:"L",xl:"XL"},c={critical:"Critical",high:"High",medium:"Medium",low:"Low"},o={critical:"bg-red-100 text-red-800 border-red-300",high:"bg-orange-100 text-orange-800 border-orange-300",medium:"bg-yellow-100 text-yellow-800 border-yellow-300",low:"bg-gray-100 text-gray-800 border-gray-300"},x={codebase_analysis:"Codebase Analysis",metrics_review:"Metrics Review",market_research:"Market Research",seo_audit:"SEO Audit",manual:"Manual"},u={pending:"bg-slate-100 text-slate-700",validated:"bg-emerald-100 text-emerald-800",needs_investigation:"bg-amber-100 text-amber-800",inconclusive:"bg-slate-100 text-slate-600",invalidated:"bg-red-100 text-red-800"},m={pending:"Pending",validated:"Validated",needs_investigation:"Needs Investigation",inconclusive:"Inconclusive",invalidated:"Invalidated"},h={ship:"Ship",update:"Update",milestone:"Milestone",digest:"Digest",manual:"Manual",thread:"Thread",insight:"Insight"},b={ship:"bg-green-100 text-green-800",update:"bg-blue-100 text-blue-800",milestone:"bg-amber-100 text-amber-800",digest:"bg-purple-100 text-purple-800",manual:"bg-slate-100 text-slate-800",thread:"bg-indigo-100 text-indigo-800",insight:"bg-cyan-100 text-cyan-800"},p={acquisition:"Acquisition",activation:"Activation",retention:"Retention",revenue:"Revenue",referral:"Referral"},g={acquisition:"bg-blue-100 text-blue-800",activation:"bg-emerald-100 text-emerald-800",retention:"bg-purple-100 text-purple-800",revenue:"bg-amber-100 text-amber-800",referral:"bg-pink-100 text-pink-800"},f={on_track:"On Track",at_risk:"At Risk",behind:"Behind",achieved:"Achieved"},j={on_track:"bg-emerald-100 text-emerald-800 border-emerald-300",at_risk:"bg-amber-100 text-amber-800 border-amber-300",behind:"bg-red-100 text-red-800 border-red-300",achieved:"bg-blue-100 text-blue-800 border-blue-300"},v={manual:"Manual",rest_api:"REST API",posthog:"PostHog",firestore:"Firestore",stripe:"Stripe",whatsapp:"WhatsApp"},y={stated:"Stated",testing:"Testing",validated:"Validated",invalidated:"Invalidated",deferred:"Deferred"},N={stated:"bg-slate-100 text-slate-800 border-slate-300",testing:"bg-amber-100 text-amber-800 border-amber-300",validated:"bg-emerald-100 text-emerald-800 border-emerald-300",invalidated:"bg-red-100 text-red-800 border-red-300",deferred:"bg-slate-100 text-slate-500 border-slate-200"},w={acquisition:"Acquisition",engagement:"Engagement",conversion:"Conversion",monetization:"Monetization"},k={acquisition:"bg-blue-100 text-blue-800",engagement:"bg-purple-100 text-purple-800",conversion:"bg-amber-100 text-amber-800",monetization:"bg-emerald-100 text-emerald-800"},_={planned:"Planned",active:"Active",completed:"Completed",paused:"Paused"},Z={planned:"bg-slate-100 text-slate-700 border-slate-300",active:"bg-blue-100 text-blue-800 border-blue-300",completed:"bg-emerald-100 text-emerald-800 border-emerald-300",paused:"bg-amber-100 text-amber-800 border-amber-300"}}},function(e){e.O(0,[746,971,117,744],function(){return e(e.s=337)}),_N_E=e.O()}]);