@lovelybunch/api 1.0.71-alpha.1 → 1.0.71-alpha.2
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.
- package/dist/lib/auth/auth-manager.d.ts.map +1 -0
- package/dist/lib/auth/auth-manager.js.map +1 -0
- package/dist/lib/gait-path.d.ts.map +1 -0
- package/dist/lib/gait-path.js.map +1 -0
- package/dist/lib/git-settings.d.ts.map +1 -0
- package/dist/lib/git-settings.js.map +1 -0
- package/dist/lib/git.d.ts.map +1 -0
- package/dist/lib/git.js.map +1 -0
- package/dist/lib/jobs/global-job-scheduler.d.ts.map +1 -0
- package/dist/lib/jobs/global-job-scheduler.js.map +1 -0
- package/dist/lib/jobs/job-runner.d.ts.map +1 -0
- package/dist/lib/jobs/job-runner.js.map +1 -0
- package/dist/lib/jobs/job-scheduler.d.ts.map +1 -0
- package/dist/lib/jobs/job-scheduler.js.map +1 -0
- package/dist/lib/jobs/job-store.d.ts.map +1 -0
- package/dist/lib/jobs/job-store.js.map +1 -0
- package/dist/lib/project-paths.d.ts.map +1 -0
- package/dist/lib/project-paths.js.map +1 -0
- package/dist/lib/storage/file-storage.d.ts.map +1 -0
- package/dist/lib/storage/file-storage.js.map +1 -0
- package/dist/lib/symlinks/symlink-manager.d.ts.map +1 -0
- package/dist/lib/symlinks/symlink-manager.js.map +1 -0
- package/dist/lib/symlinks/types.d.ts.map +1 -0
- package/dist/lib/symlinks/types.js.map +1 -0
- package/dist/lib/terminal/context-helper.d.ts.map +1 -0
- package/dist/lib/terminal/context-helper.js.map +1 -0
- package/dist/lib/terminal/global-manager.d.ts.map +1 -0
- package/dist/lib/terminal/global-manager.js.map +1 -0
- package/dist/lib/terminal/shell-utils.d.ts.map +1 -0
- package/dist/lib/terminal/shell-utils.js.map +1 -0
- package/dist/lib/terminal/terminal-manager.d.ts.map +1 -0
- package/dist/lib/terminal/terminal-manager.js.map +1 -0
- package/dist/lib/user-preferences.d.ts.map +1 -0
- package/dist/lib/user-preferences.js.map +1 -0
- package/dist/middleware/auth.d.ts.map +1 -0
- package/dist/middleware/auth.js.map +1 -0
- package/dist/routes/api/v1/agents/[id]/index.d.ts.map +1 -0
- package/dist/routes/api/v1/agents/[id]/index.js.map +1 -0
- package/dist/routes/api/v1/agents/[id]/route.d.ts.map +1 -0
- package/dist/routes/api/v1/agents/[id]/route.js.map +1 -0
- package/dist/routes/api/v1/agents/index.d.ts.map +1 -0
- package/dist/routes/api/v1/agents/index.js.map +1 -0
- package/dist/routes/api/v1/agents/route.d.ts.map +1 -0
- package/dist/routes/api/v1/agents/route.js.map +1 -0
- package/dist/routes/api/v1/ai/index.d.ts.map +1 -0
- package/dist/routes/api/v1/ai/index.js.map +1 -0
- package/dist/routes/api/v1/ai/route.d.ts.map +1 -0
- package/dist/routes/api/v1/ai/route.js.map +1 -0
- package/dist/routes/api/v1/api-keys/index.d.ts.map +1 -0
- package/dist/routes/api/v1/api-keys/index.js.map +1 -0
- package/dist/routes/api/v1/api-keys/route.d.ts.map +1 -0
- package/dist/routes/api/v1/api-keys/route.js.map +1 -0
- package/dist/routes/api/v1/auth/index.d.ts.map +1 -0
- package/dist/routes/api/v1/auth/index.js.map +1 -0
- package/dist/routes/api/v1/auth/route.d.ts.map +1 -0
- package/dist/routes/api/v1/auth/route.js.map +1 -0
- package/dist/routes/api/v1/auth-settings/index.d.ts.map +1 -0
- package/dist/routes/api/v1/auth-settings/index.js.map +1 -0
- package/dist/routes/api/v1/auth-settings/route.d.ts.map +1 -0
- package/dist/routes/api/v1/auth-settings/route.js.map +1 -0
- package/dist/routes/api/v1/chats/[id]/index.d.ts.map +1 -0
- package/dist/routes/api/v1/chats/[id]/index.js.map +1 -0
- package/dist/routes/api/v1/chats/[id]/route.d.ts.map +1 -0
- package/dist/routes/api/v1/chats/[id]/route.js.map +1 -0
- package/dist/routes/api/v1/chats/index.d.ts.map +1 -0
- package/dist/routes/api/v1/chats/index.js.map +1 -0
- package/dist/routes/api/v1/chats/route.d.ts.map +1 -0
- package/dist/routes/api/v1/chats/route.js.map +1 -0
- package/dist/routes/api/v1/config/index.d.ts.map +1 -0
- package/dist/routes/api/v1/config/index.js.map +1 -0
- package/dist/routes/api/v1/config/route.d.ts.map +1 -0
- package/dist/routes/api/v1/config/route.js.map +1 -0
- package/dist/routes/api/v1/context/architecture/route.d.ts.map +1 -0
- package/dist/routes/api/v1/context/architecture/route.js.map +1 -0
- package/dist/routes/api/v1/context/index.d.ts.map +1 -0
- package/dist/routes/api/v1/context/index.js.map +1 -0
- package/dist/routes/api/v1/context/knowledge/[filename]/index.d.ts.map +1 -0
- package/dist/routes/api/v1/context/knowledge/[filename]/index.js.map +1 -0
- package/dist/routes/api/v1/context/knowledge/[filename]/route.d.ts.map +1 -0
- package/dist/routes/api/v1/context/knowledge/[filename]/route.js.map +1 -0
- package/dist/routes/api/v1/context/knowledge/index.d.ts.map +1 -0
- package/dist/routes/api/v1/context/knowledge/index.js.map +1 -0
- package/dist/routes/api/v1/context/knowledge/route.d.ts.map +1 -0
- package/dist/routes/api/v1/context/knowledge/route.js.map +1 -0
- package/dist/routes/api/v1/context/project/route.d.ts.map +1 -0
- package/dist/routes/api/v1/context/project/route.js.map +1 -0
- package/dist/routes/api/v1/events/status/route.d.ts +1 -1
- package/dist/routes/api/v1/git/index.d.ts.map +1 -0
- package/dist/routes/api/v1/git/index.js.map +1 -0
- package/dist/routes/api/v1/jobs/[id]/route.d.ts.map +1 -0
- package/dist/routes/api/v1/jobs/[id]/route.js.map +1 -0
- package/dist/routes/api/v1/jobs/[id]/run/route.d.ts +2 -2
- package/dist/routes/api/v1/jobs/[id]/run/route.d.ts.map +1 -0
- package/dist/routes/api/v1/jobs/[id]/run/route.js.map +1 -0
- package/dist/routes/api/v1/jobs/index.d.ts.map +1 -0
- package/dist/routes/api/v1/jobs/index.js.map +1 -0
- package/dist/routes/api/v1/jobs/route.d.ts.map +1 -0
- package/dist/routes/api/v1/jobs/route.js.map +1 -0
- package/dist/routes/api/v1/jobs/status/route.d.ts +1 -1
- package/dist/routes/api/v1/jobs/status/route.d.ts.map +1 -0
- package/dist/routes/api/v1/jobs/status/route.js.map +1 -0
- package/dist/routes/api/v1/mcp/index.d.ts.map +1 -0
- package/dist/routes/api/v1/mcp/index.js.map +1 -0
- package/dist/routes/api/v1/mcp/route.d.ts.map +1 -0
- package/dist/routes/api/v1/mcp/route.js.map +1 -0
- package/dist/routes/api/v1/proposals/[id]/route.d.ts +8 -8
- package/dist/routes/api/v1/proposals/[id]/route.d.ts.map +1 -0
- package/dist/routes/api/v1/proposals/[id]/route.js.map +1 -0
- package/dist/routes/api/v1/proposals/index.d.ts.map +1 -0
- package/dist/routes/api/v1/proposals/index.js.map +1 -0
- package/dist/routes/api/v1/proposals/route.d.ts.map +1 -0
- package/dist/routes/api/v1/proposals/route.js.map +1 -0
- package/dist/routes/api/v1/resources/[id]/index.d.ts.map +1 -0
- package/dist/routes/api/v1/resources/[id]/index.js.map +1 -0
- package/dist/routes/api/v1/resources/[id]/route.js.map +1 -0
- package/dist/routes/api/v1/resources/[id]/thumbnail/index.d.ts.map +1 -0
- package/dist/routes/api/v1/resources/[id]/thumbnail/index.js.map +1 -0
- package/dist/routes/api/v1/resources/[id]/thumbnail/route.js.map +1 -0
- package/dist/routes/api/v1/resources/index.d.ts.map +1 -0
- package/dist/routes/api/v1/resources/index.js.map +1 -0
- package/dist/routes/api/v1/resources/route.d.ts.map +1 -0
- package/dist/routes/api/v1/resources/route.js.map +1 -0
- package/dist/routes/api/v1/symlinks/index.d.ts.map +1 -0
- package/dist/routes/api/v1/symlinks/index.js.map +1 -0
- package/dist/routes/api/v1/symlinks/route.d.ts.map +1 -0
- package/dist/routes/api/v1/symlinks/route.js.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/create/index.d.ts.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/create/index.js.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/create/route.d.ts.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/create/route.js.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/destroy/index.d.ts.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/destroy/index.js.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/destroy/route.d.ts.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/destroy/route.js.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/resize/index.d.ts.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/resize/index.js.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/resize/route.d.ts.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/resize/route.js.map +1 -0
- package/dist/routes/api/v1/terminal/sessions/index.d.ts.map +1 -0
- package/dist/routes/api/v1/terminal/sessions/index.js.map +1 -0
- package/dist/routes/api/v1/terminal/sessions/route.d.ts.map +1 -0
- package/dist/routes/api/v1/terminal/sessions/route.js.map +1 -0
- package/dist/routes/api/v1/user/index.d.ts.map +1 -0
- package/dist/routes/api/v1/user/index.js.map +1 -0
- package/dist/routes/api/v1/user/settings/index.d.ts.map +1 -0
- package/dist/routes/api/v1/user/settings/index.js.map +1 -0
- package/dist/routes/api/v1/user/settings/route.d.ts.map +1 -0
- package/dist/routes/api/v1/user/settings/route.js.map +1 -0
- package/dist/server-with-static.d.ts.map +1 -0
- package/dist/server-with-static.js.map +1 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js.map +1 -0
- package/package.json +4 -4
- package/static/assets/AgentDetailPage-DwWIjGx1.js +1 -0
- package/static/assets/AgentEditPage-BvVPfYR3.js +1 -0
- package/static/assets/AgentsPage-D-Uy87Gh.js +3 -0
- package/static/assets/AgentsSettingsPage-CDuAvFxu.js +6 -0
- package/static/assets/ApiKeysSettingsPage-Jug0kB7Z.js +7 -0
- package/static/assets/ArchitectureEditPage-BmAgJAMV.js +21 -0
- package/static/assets/ArchitecturePage-ZjbdnDA7.js +1 -0
- package/static/assets/AuthSettingsPage-_pXoewOB.js +11 -0
- package/static/assets/CallbackPage-CaAOpz4z.js +1 -0
- package/static/assets/CodePage-DEbgr8C1.js +2 -0
- package/static/assets/CollapsibleSection-msxUBh1L.js +1 -0
- package/static/assets/DashboardPage-BXu-fikP.js +11 -0
- package/static/assets/GitPage-B7qFcP-K.js +16 -0
- package/static/assets/GitSettingsPage-D7GjdOnE.js +6 -0
- package/static/assets/IdentityPage-BR48gNhN.js +11 -0
- package/static/assets/ImplementationStepsEditor-BdHMNVVd.js +6 -0
- package/static/assets/IntegrationsSettingsPage-B1OHGlDC.js +1 -0
- package/static/assets/KnowledgeDetailPage-DBOQQs3R.js +1 -0
- package/static/assets/KnowledgeEditPage-DHJxLPwi.js +1 -0
- package/static/assets/KnowledgePage-CuuDTMa_.js +8 -0
- package/static/assets/LoginPage-IIU6NAG9.js +1 -0
- package/static/assets/McpSettingsPage-iz5gLGWt.js +1 -0
- package/static/assets/NewAgentPage-DolltGy5.js +1 -0
- package/static/assets/NewKnowledgePage-_jbUZqBU.js +9 -0
- package/static/assets/NewProposalPage-bFnfuuoA.js +90 -0
- package/static/assets/ProjectEditPage-DTTjPnGj.js +11 -0
- package/static/assets/ProjectPage-DhwrnEq2.js +1 -0
- package/static/assets/PromptsSettingsPage-DLOVysbE.js +1 -0
- package/static/assets/ProposalDetailPage-KvjXUaaf.js +1 -0
- package/static/assets/ProposalEditPage-BmzkHL9a.js +1 -0
- package/static/assets/ProposalsPage-DwQr1ycd.js +17 -0
- package/static/assets/ResourcesPage-B8Hm_j47.js +66 -0
- package/static/assets/RulesSettingsPage-CsGXFTFY.js +16 -0
- package/static/assets/SchedulePage-CY8GdQlp.js +4 -0
- package/static/assets/TagInput-CbH9zq5n.js +1 -0
- package/static/assets/TerminalPage-DsjOLnyY.js +1 -0
- package/static/assets/TerminalSessionPage-DQ065WYU.js +13 -0
- package/static/assets/UserPreferencesPage-55VTrzfQ.js +1 -0
- package/static/assets/UserSettingsPage-BZwb93B4.js +1 -0
- package/static/assets/UtilitiesPage-BmEW7eJ_.js +1 -0
- package/static/assets/alert-CNSGDe1U.js +1 -0
- package/static/assets/arrow-down-D1dapxzl.js +6 -0
- package/static/assets/arrow-left-CEZFPQje.js +6 -0
- package/static/assets/arrow-up-D-lB4Ah6.js +6 -0
- package/static/assets/badge-DO6e5hC1.js +1 -0
- package/static/assets/browser-modal-BTxVvZIA.js +6 -0
- package/static/assets/calendar-DWaFMSXH.js +6 -0
- package/static/assets/card-Cnz8b7Ou.js +1 -0
- package/static/assets/chevron-left-CNgc28Tc.js +6 -0
- package/static/assets/circle-alert-Dick-jNf.js +6 -0
- package/static/assets/circle-check-DDk43rYV.js +6 -0
- package/static/assets/circle-check-big-B70gdce7.js +6 -0
- package/static/assets/circle-play-TJEfmKde.js +6 -0
- package/static/assets/circle-x-BfR2YcXx.js +6 -0
- package/static/assets/clipboard-B9ndUJKl.js +1 -0
- package/static/assets/clipboard-BTZru8wn.js +11 -0
- package/static/assets/clock-DQXbrDkQ.js +6 -0
- package/static/assets/download-CW_rWwud.js +6 -0
- package/static/assets/droid-CmYuCN_q.js +4 -0
- package/static/assets/eye-Bv6mO2ld.js +6 -0
- package/static/assets/folder-git-2-Cv5NbBZZ.js +6 -0
- package/static/assets/index-BSBM4i_g.js +458 -0
- package/static/assets/{index-Bo1l13x2.css → index-CKwmN6yL.css} +2 -33
- package/static/assets/label-vEgNxdb2.js +1 -0
- package/static/assets/markdown-editor-DUEthZ0y.css +1 -0
- package/static/assets/markdown-editor-O6tGYa1a.js +62 -0
- package/static/assets/pause-6aQLhmG9.js +6 -0
- package/static/assets/play-DsDsjO2V.js +6 -0
- package/static/assets/plus-BfBtnncn.js +6 -0
- package/static/assets/radio-group-D_RD_9vY.js +1 -0
- package/static/assets/refresh-cw-DvFNtws1.js +6 -0
- package/static/assets/search-kcgmZUqQ.js +6 -0
- package/static/assets/switch-Bjq8cgQn.js +1 -0
- package/static/assets/tabs-DDbBXbPg.js +1 -0
- package/static/assets/tag-Czz-3rNY.js +6 -0
- package/static/assets/terminal-preview-B7iP2vUT.js +11 -0
- package/static/assets/use-terminal-CN3pheMp.js +1 -0
- package/static/assets/xterm-DTxiCjtJ.js +9 -0
- package/static/assets/xterm-qxJ8_QYu.css +32 -0
- package/static/assets/zap-BMkP_c9R.js +6 -0
- package/static/index.html +2 -2
- package/static/assets/index-DgZp291y.js +0 -973
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import{u as Q,H as G,m as Y,r as n,A as E,j as e,B as j,L as F,v as P,w as k,x as L,y as I,z as r,I as y,a2 as J,M as X,O as Z,P as ee,Q as te,R as se,U as ae,V as ie,W as ne}from"./index-BSBM4i_g.js";import{C as re,b as oe,c as le,a as ce}from"./card-Cnz8b7Ou.js";import{L as h}from"./label-vEgNxdb2.js";import{M as de}from"./markdown-editor-O6tGYa1a.js";import{C as he}from"./CollapsibleSection-msxUBh1L.js";import{I as ue,L as me}from"./ImplementationStepsEditor-BdHMNVVd.js";import{T as pe}from"./TagInput-CbH9zq5n.js";import{A as ge}from"./arrow-left-CEZFPQje.js";import"./plus-BfBtnncn.js";import"./badge-DO6e5hC1.js";const v={feature:{name:"New Feature",content:`## Problem Statement
|
|
2
|
+
Describe the problem this new feature addresses.
|
|
3
|
+
|
|
4
|
+
## Proposed Solution
|
|
5
|
+
Describe the solution you're proposing.
|
|
6
|
+
|
|
7
|
+
### Key Features
|
|
8
|
+
- Feature 1
|
|
9
|
+
- Feature 2
|
|
10
|
+
- Feature 3
|
|
11
|
+
|
|
12
|
+
## Implementation Details
|
|
13
|
+
Describe the technical implementation approach.
|
|
14
|
+
|
|
15
|
+
## Testing Strategy
|
|
16
|
+
- [ ] Unit tests
|
|
17
|
+
- [ ] Integration tests
|
|
18
|
+
- [ ] Manual testing
|
|
19
|
+
|
|
20
|
+
## Rollout Plan
|
|
21
|
+
1. Development and testing
|
|
22
|
+
2. Staging deployment
|
|
23
|
+
3. Production rollout
|
|
24
|
+
|
|
25
|
+
## Success Metrics
|
|
26
|
+
Define how you'll measure the success of this change.`},"quick-change":{name:"Quick Change",content:`## Overview
|
|
27
|
+
Describe the quick change you're proposing.`},"bug-fix":{name:"Bug Fix",content:`## Bug Description
|
|
28
|
+
Describe the bug that needs to be fixed.
|
|
29
|
+
|
|
30
|
+
## Steps to Reproduce
|
|
31
|
+
1. Step 1
|
|
32
|
+
2. Step 2
|
|
33
|
+
3. Step 3
|
|
34
|
+
|
|
35
|
+
## Expected Behavior
|
|
36
|
+
Describe what should happen.
|
|
37
|
+
|
|
38
|
+
## Actual Behavior
|
|
39
|
+
Describe what currently happens.
|
|
40
|
+
|
|
41
|
+
## Root Cause Analysis
|
|
42
|
+
Explain the underlying cause of the bug.
|
|
43
|
+
|
|
44
|
+
## Proposed Fix
|
|
45
|
+
Describe the solution to fix the bug.
|
|
46
|
+
|
|
47
|
+
## Testing Plan
|
|
48
|
+
- [ ] Verify fix resolves the original issue
|
|
49
|
+
- [ ] Test edge cases
|
|
50
|
+
- [ ] Regression testing
|
|
51
|
+
|
|
52
|
+
## Risk Assessment
|
|
53
|
+
- Impact: Low/Medium/High
|
|
54
|
+
- Complexity: Low/Medium/High
|
|
55
|
+
- Risk of introducing new bugs: Low/Medium/High`},refactor:{name:"Refactor",content:`## Current State
|
|
56
|
+
Describe what needs to be refactored and why.
|
|
57
|
+
|
|
58
|
+
## Refactoring Goals
|
|
59
|
+
- Improve code readability
|
|
60
|
+
- Reduce complexity
|
|
61
|
+
- Enhance maintainability
|
|
62
|
+
|
|
63
|
+
## Proposed Changes
|
|
64
|
+
Describe the refactoring approach.
|
|
65
|
+
|
|
66
|
+
## Risk Assessment
|
|
67
|
+
- Breaking changes: None/Low/Medium/High
|
|
68
|
+
- Testing strategy for regression prevention`},documentation:{name:"Documentation",content:`## Documentation Gap
|
|
69
|
+
What documentation is missing or outdated?
|
|
70
|
+
|
|
71
|
+
## Proposed Updates
|
|
72
|
+
- [ ] API documentation
|
|
73
|
+
- [ ] User guides
|
|
74
|
+
- [ ] Code comments
|
|
75
|
+
- [ ] README updates
|
|
76
|
+
|
|
77
|
+
## Target Audience
|
|
78
|
+
Who will benefit from these documentation changes?`},"security-fix":{name:"Security Fix",content:`## Security Issue
|
|
79
|
+
Brief description (avoid sensitive details).
|
|
80
|
+
|
|
81
|
+
## Impact Assessment
|
|
82
|
+
- Severity: Low/Medium/High/Critical
|
|
83
|
+
- Affected components
|
|
84
|
+
- User impact
|
|
85
|
+
|
|
86
|
+
## Proposed Fix
|
|
87
|
+
High-level approach to resolution.
|
|
88
|
+
|
|
89
|
+
## Verification Plan
|
|
90
|
+
How to confirm the fix works without exposing the vulnerability.`}},w="feature";function Te(){const M=Q(),{toast:C}=G(),{user:u,authEnabled:S}=Y(),[c,b]=n.useState(!1),[R,B]=n.useState(w),[H,p]=n.useState(!1),[N,g]=n.useState(null),[a,l]=n.useState({intent:"",description:v[w].content,priority:"medium",author:{id:"current-user",name:"",email:""}}),[m,U]=n.useState([]),[D,q]=n.useState([]),[O,V]=n.useState(v[w].content),x=n.useCallback(t=>{if((t.metaKey||t.ctrlKey)&&t.key==="Enter"&&(t.preventDefault(),!c&&a.intent)){const s=document.querySelector("form");s&&s.requestSubmit()}},[c,a.intent]),$=a.description!==O,z=t=>{$?(g(t),p(!0)):T(t)},T=t=>{const s=v[t];B(t),l(i=>({...i,description:s.content})),V(s.content)},K=()=>{N&&(T(N),g(null)),p(!1)},W=()=>{g(null),p(!1)};n.useEffect(()=>(document.addEventListener("keydown",x),()=>{document.removeEventListener("keydown",x)}),[x]);const A=n.useCallback(async()=>{try{const s=await(await fetch(`${E}/api/v1/user/settings`)).json();if(s.success&&s.data){const{profile:i}=s.data;l(d=>({...d,author:{...d.author,name:i?.firstName&&i?.lastName?`${i.firstName} ${i.lastName}`.trim():i?.firstName||i?.lastName||d.author.name,email:i?.email||d.author.email}}))}}catch(t){console.error("Failed to load user settings:",t)}},[]);n.useEffect(()=>{S?u&&l(t=>({...t,author:{...t.author,id:u.id||t.author.id,name:u.name||t.author.name,email:u.email||t.author.email}})):A()},[S,u,A]);const _=async t=>{t.preventDefault(),b(!0);try{const s=m.map(o=>({id:o.id,description:o.description.trim(),status:o.status})).filter(o=>o.description.length>0),i=D.map(o=>o.trim()).filter(o=>o.length>0),d={intent:a.intent,author:{...a.author,type:"human"},planSteps:s,metadata:{priority:a.priority,tags:i},content:a.description},f=await(await fetch(`${E}/api/v1/proposals`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)})).json();if(f.success)C({title:"Success",description:"Proposal created successfully."}),M(`/proposals/${f.data.id}`);else throw new Error(f.error?.message||"Failed to create proposal")}catch(s){const i=s instanceof Error?s.message:"Unknown error occurred";C({title:"Error",description:`Error creating proposal: ${i}`,variant:"destructive"})}finally{b(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"New Proposal"}),e.jsx("p",{className:"text-muted-foreground",children:"Create a new change proposal for your project"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(j,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(F,{to:"/proposals",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(ge,{className:"h-4 w-4"})})})})]}),e.jsx("form",{onSubmit:_,children:e.jsxs(re,{children:[e.jsx(oe,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(le,{children:"Proposal Details"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{htmlFor:"template-select",className:"text-sm text-muted-foreground",children:"Template:"}),e.jsxs(P,{value:R,onValueChange:z,children:[e.jsx(k,{className:"w-36",children:e.jsx(L,{})}),e.jsxs(I,{children:[e.jsx(r,{value:"feature",children:"New Feature"}),e.jsx(r,{value:"quick-change",children:"Quick Change"}),e.jsx(r,{value:"bug-fix",children:"Bug Fix"}),e.jsx(r,{value:"refactor",children:"Refactor"}),e.jsx(r,{value:"documentation",children:"Documentation"}),e.jsx(r,{value:"security-fix",children:"Security Fix"})]})]})]})]})}),e.jsxs(ce,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"intent",children:"Title *"}),e.jsx(y,{id:"intent",placeholder:"Brief overview of the proposal",value:a.intent,onChange:t=>l(s=>({...s,intent:t.target.value})),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"description",children:"Description"}),e.jsx(de,{value:a.description,onChange:t=>l(s=>({...s,description:t||""})),placeholder:"Write your proposal description in markdown...",height:300})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"author-name",children:"Author Name"}),e.jsx(y,{id:"author-name",value:a.author.name,onChange:t=>l(s=>({...s,author:{...s.author,name:t.target.value}})),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"author-email",children:"Author Email"}),e.jsx(y,{id:"author-email",type:"email",value:a.author.email,onChange:t=>l(s=>({...s,author:{...s.author,email:t.target.value}}))})]})]}),e.jsx(he,{icon:e.jsx(me,{className:"h-4 w-4"}),title:"Optional Implementation Detail",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"priority",children:"Priority"}),e.jsxs(P,{value:a.priority,onValueChange:t=>l(s=>({...s,priority:t})),children:[e.jsx(k,{children:e.jsx(L,{placeholder:"Select priority"})}),e.jsxs(I,{children:[e.jsx(r,{value:"low",children:"Low"}),e.jsx(r,{value:"medium",children:"Medium"}),e.jsx(r,{value:"high",children:"High"}),e.jsx(r,{value:"critical",children:"Critical"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Implementation Steps"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Break the change into actionable steps."})]}),m.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.length," step",m.length===1?"":"s"]})]}),e.jsx(ue,{steps:m,onChange:U,disabled:c})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Tags"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Use tags to categorize this proposal by area, team, or priority."}),e.jsx(pe,{tags:D,onChange:q,disabled:c,placeholder:"Add a tag (e.g. frontend, infra)"})]})]})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(j,{type:"button",variant:"outline",asChild:!0,children:e.jsx(F,{to:"/proposals",children:"Cancel"})}),e.jsx(j,{type:"submit",disabled:c||!a.intent,className:"relative",children:c?e.jsx(e.Fragment,{children:"Creating..."}):e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"mr-2 h-4 w-4"}),"Create Proposal",e.jsx("span",{className:"ml-2 text-xs opacity-60 font-mono",children:"⌘↵"})]})})]})]})]})}),e.jsx(X,{open:H,onOpenChange:p,children:e.jsxs(Z,{children:[e.jsxs(ee,{children:[e.jsx(te,{children:"Switch Template?"}),e.jsx(se,{children:"You have unsaved changes to your proposal description. Switching templates will replace your current content with the new template. This action cannot be undone."})]}),e.jsxs(ae,{children:[e.jsx(ie,{onClick:W,children:"Cancel"}),e.jsx(ne,{onClick:K,children:"Switch Template"})]})]})})]})}export{Te as NewProposalPage};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{u as L,H as I,r as i,A as S,j as e,B as C,L as M,a2 as A,I as p,v as B,w as D,x as T,y as O,z as j}from"./index-BSBM4i_g.js";import{C as m,a as x,b,c as P}from"./card-Cnz8b7Ou.js";import{L as l}from"./label-vEgNxdb2.js";import{M as V}from"./markdown-editor-O6tGYa1a.js";import{A as W}from"./arrow-left-CEZFPQje.js";import{C as z}from"./circle-check-big-B70gdce7.js";function K(){const E=L(),{toast:d}=I(),[a,v]=i.useState({project:{name:"",description:"",website:"",version:"1.0.0",stage:"development"}}),[u,g]=i.useState(""),[F,f]=i.useState(!0),[y,w]=i.useState(!1);i.useEffect(()=>{fetch(`${S}/api/v1/context/project`).then(t=>t.json()).then(t=>{if(t.success){const s=t.document;v({project:{name:s.metadata.project?.name||"",description:s.metadata.project?.description||"",website:s.metadata.project?.website||s.metadata.project?.repository||"",version:s.metadata.project?.version||"1.0.0",stage:s.metadata.project?.stage||"development"}}),g(s.content.trim())}f(!1)}).catch(t=>{console.error("Failed to load context:",t),d({title:"Error",description:"Failed to load project context",variant:"destructive"}),f(!1)})},[d]);const k=async()=>{w(!0);try{const s={project:Object.fromEntries(Object.entries(a.project).map(([o,r])=>[o,typeof r=="string"?r.trim():r]))},n=await(await fetch(`${S}/api/v1/context/project`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:u,metadata:s})})).json();if(n.success)d({title:"Success",description:"Project context saved successfully",action:e.jsx(z,{className:"h-4 w-4"})}),E("/context/project");else throw new Error(n.error||"Failed to save context")}catch(t){console.error("Save error:",t),d({title:"Error",description:"Failed to save project context",variant:"destructive"})}finally{w(!1)}},c=(t,s)=>{v(N=>{const n={...N},o=t.split(".");let r=n;for(let h=0;h<o.length-1;h++)r=r[o[h]];return r[o[o.length-1]]=s,n})};return F?e.jsx("div",{className:"space-y-6",children:e.jsx(m,{children:e.jsx(x,{className:"pt-6",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{children:"Loading..."})})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Edit Project Overview"}),e.jsx("p",{className:"text-muted-foreground",children:"Edit project information and documentation"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(M,{to:"/context/project",children:[e.jsx(W,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Back"})]})}),e.jsxs(C,{size:"sm",onClick:k,disabled:y,children:[e.jsx(A,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:y?"Saving...":"Save"})]})]})]}),e.jsxs(m,{children:[e.jsx(b,{children:e.jsx(P,{children:"Project Information"})}),e.jsxs(x,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-name",children:"Project Name"}),e.jsx(p,{id:"project-name",value:a.project.name,onChange:t=>c("project.name",t.target.value),placeholder:"My Awesome Project"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-version",children:"Version"}),e.jsx(p,{id:"project-version",value:a.project.version,onChange:t=>c("project.version",t.target.value),placeholder:"1.0.0"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-description",children:"Description"}),e.jsx(p,{id:"project-description",value:a.project.description,onChange:t=>c("project.description",t.target.value),placeholder:"Brief description of what this project does"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-website",children:"Website"}),e.jsx(p,{id:"project-website",value:a.project.website,onChange:t=>c("project.website",t.target.value),placeholder:"https://yourproject.com"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-stage",children:"Development Stage"}),e.jsxs(B,{value:a.project.stage,onValueChange:t=>c("project.stage",t),children:[e.jsx(D,{children:e.jsx(T,{placeholder:"Select stage"})}),e.jsxs(O,{children:[e.jsx(j,{value:"prototype",children:"Prototype"}),e.jsx(j,{value:"development",children:"Development"}),e.jsx(j,{value:"mvp",children:"MVP"}),e.jsx(j,{value:"production",children:"Production"})]})]})]})]})]})]}),e.jsxs(m,{children:[e.jsx(b,{children:e.jsx(P,{children:"Documentation"})}),e.jsx(x,{children:e.jsx(V,{value:u,onChange:t=>g(t||""),placeholder:`Write your project documentation in markdown...
|
|
2
|
+
|
|
3
|
+
## What is this project?
|
|
4
|
+
|
|
5
|
+
Describe what your project does, who it's for, and why it exists.
|
|
6
|
+
|
|
7
|
+
## Current State
|
|
8
|
+
|
|
9
|
+
- Development stage
|
|
10
|
+
- Key features that are working
|
|
11
|
+
- What's planned for next releases`,height:800})})]})]})}export{K as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{H as w,r,A as y,j as e,n as C,g as b,B as n,ap as P,ao as k,L as E,J as L,aq as z,al as B}from"./index-BSBM4i_g.js";import{C as c,a as i,b as p,c as D}from"./card-Cnz8b7Ou.js";import{B as x}from"./badge-DO6e5hC1.js";import{c as F}from"./clipboard-B9ndUJKl.js";function A(){const{toast:d}=w(),[o,h]=r.useState(null),[j,u]=r.useState(!0),[f,l]=r.useState(!1);r.useEffect(()=>{fetch(`${y}/api/v1/context/project`).then(s=>{if(s.ok)return s.json();throw new Error("Not found")}).then(s=>{s.success?(h(s.document),l(!0)):l(!1)}).catch(()=>{l(!1)}).finally(()=>{u(!1)})},[]);const v=async()=>{const s=".nut/context/project.md";try{await F(s),d({title:"Copied!",description:`Path ${s} copied to clipboard`})}catch(m){console.error("Failed to copy path:",m),d({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},N=()=>{const s=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"project-md",filename:"project.md",name:"project.md",path:".nut/context/project.md"}});window.dispatchEvent(s)};if(j)return e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(i,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(C,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading Project Overview..."})]})})})});if(!f||!o)return e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(i,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(b,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Project Overview Found"}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["Run ",e.jsx("code",{className:"bg-muted px-2 py-1 rounded",children:"coconut init"})," to create the project overview."]})]})})})});const t=o.metadata,a=t.project?.website||t.project?.repository,g=a?(s=>{try{return new URL(s.startsWith("http")?s:`https://${s}`).host.replace(/^www\./,"")}catch{return s.replace(/^https?:\/\//,"")}})(a):null;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Project Overview"}),e.jsx("p",{className:"text-muted-foreground",children:"Core project information and configuration"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(n,{variant:"outline",size:"sm",onClick:N,children:[e.jsx(P,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(n,{variant:"outline",size:"sm",onClick:v,children:[e.jsx(k,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(n,{size:"sm",asChild:!0,children:e.jsxs(E,{to:"/context/project/edit",children:[e.jsx(L,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),t&&e.jsx("div",{className:"grid grid-cols-1 gap-4",children:e.jsxs(c,{children:[e.jsx(p,{className:"pb-3",children:e.jsx(D,{className:"text-lg font-semibold",children:"Project Info"})}),e.jsxs(i,{className:"space-y-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:t.project?.name||"Unnamed Project"}),t.project?.description&&e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:t.project.description})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a&&e.jsx(n,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(z,{className:"w-3 h-3 mr-2"}),g||"Website"]})}),e.jsxs("div",{className:"flex gap-2 ml-auto",children:[t.project?.version&&e.jsxs(x,{variant:"secondary",children:["v",t.project.version]}),t.project?.stage&&e.jsx(x,{variant:t.project.stage==="mvp"?"default":"secondary",children:t.project.stage})]})]})]})]})}),e.jsxs(c,{children:[e.jsx(p,{}),e.jsx(i,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(B,{children:o.content||"No content available"})})})]})]})}export{A as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,a1 as p,B as r,J as h,ai as j,T as u,I as l,v as g,w as f,x as v,y as N,z as y}from"./index-BSBM4i_g.js";import{C as t,b as i,c as n,d as c,a as d}from"./card-Cnz8b7Ou.js";import{L as a}from"./label-vEgNxdb2.js";import{B as o}from"./badge-DO6e5hC1.js";import{P as w}from"./plus-BfBtnncn.js";import{E as b}from"./eye-Bv6mO2ld.js";import{D as C}from"./download-CW_rWwud.js";function E(){const m=[{id:"1",name:"Code Review Assistant",description:"Prompt for AI agents to perform thorough code reviews",category:"Code Review",usage:"cursor-cli, claude-code",lastUpdated:"2 days ago",active:!0},{id:"2",name:"Architecture Advisor",description:"System prompt for architectural decision guidance",category:"Architecture",usage:"gemini-cli, claude-code",lastUpdated:"1 week ago",active:!0},{id:"3",name:"Bug Analysis Expert",description:"Specialized prompt for debugging and error analysis",category:"Debugging",usage:"cursor-cli",lastUpdated:"3 days ago",active:!1},{id:"4",name:"Documentation Generator",description:"Prompt for generating comprehensive code documentation",category:"Documentation",usage:"github-copilot, claude-code",lastUpdated:"5 days ago",active:!0}],x=["Code Review","Architecture","Debugging","Documentation","Testing","Refactoring","Security","Performance"];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"System Prompts"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage system prompts used by AI agents and integrations for consistent behavior."})]}),e.jsx(p,{}),e.jsxs(t,{children:[e.jsx(i,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(n,{children:"Prompt Library"}),e.jsx(c,{children:"Pre-configured prompts for different AI agents and use cases."})]}),e.jsxs(r,{size:"sm",children:[e.jsx(w,{className:"h-4 w-4 mr-2"}),"New Prompt"]})]})}),e.jsx(d,{children:e.jsx("div",{className:"space-y-4",children:m.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h4",{className:"font-medium",children:s.name}),e.jsx(o,{variant:s.active?"default":"secondary",children:s.active?"Active":"Inactive"}),e.jsx(o,{variant:"outline",children:s.category})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s.description}),e.jsxs("div",{className:"flex items-center space-x-4 mt-2",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Used by: ",s.usage]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Updated: ",s.lastUpdated]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(h,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(j,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(u,{className:"h-4 w-4"})})]})]},s.id))})})]}),e.jsxs(t,{children:[e.jsxs(i,{children:[e.jsx(n,{children:"Create New Prompt"}),e.jsx(c,{children:"Design a new system prompt for your AI agents and integrations."})]}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptName",children:"Prompt Name"}),e.jsx(l,{id:"promptName",placeholder:"Enter prompt name"})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptCategory",children:"Category"}),e.jsxs(g,{children:[e.jsx(f,{children:e.jsx(v,{placeholder:"Select category"})}),e.jsx(N,{children:x.map(s=>e.jsx(y,{value:s.toLowerCase(),children:s},s))})]})]})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptDescription",children:"Description"}),e.jsx(l,{id:"promptDescription",placeholder:"Brief description of the prompt's purpose"})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"targetIntegrations",children:"Target Integrations"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:["cursor-cli","claude-code","gemini-cli","github-copilot"].map(s=>e.jsxs("label",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",className:"rounded"}),e.jsx("span",{className:"text-sm",children:s})]},s))})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptContent",children:"Prompt Content"}),e.jsx("textarea",{id:"promptContent",className:"w-full min-h-[200px] p-3 border rounded-md font-mono text-sm",placeholder:"You are an expert code reviewer. Your task is to..."})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptVariables",children:"Variables (JSON format)"}),e.jsx("textarea",{id:"promptVariables",className:"w-full min-h-[100px] p-3 border rounded-md font-mono text-sm",placeholder:'{"language": "typescript", "framework": "react", "style": "functional"}'})]}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(r,{variant:"outline",children:"Preview"}),e.jsx(r,{variant:"outline",children:"Save as Draft"}),e.jsx(r,{children:"Save & Activate"})]})]})]}),e.jsxs(t,{children:[e.jsxs(i,{children:[e.jsx(n,{children:"Prompt Templates"}),e.jsx(c,{children:"Import and export prompt templates for sharing across teams."})]}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(r,{variant:"outline",size:"sm",children:[e.jsx(C,{className:"h-4 w-4 mr-2"}),"Import Template"]}),e.jsx(r,{variant:"outline",size:"sm",children:"Export All Prompts"}),e.jsx(r,{variant:"outline",size:"sm",children:"Export Selected"})]}),e.jsx("div",{className:"p-4 border-2 border-dashed rounded-lg text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Drag and drop prompt template files here, or click to browse"})})]})]})]})}export{E as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as re,u as ne,r as l,H as le,j as e,B as n,L as h,J as ie,M as oe,N as ce,T as de,O as me,P as he,Q as xe,R as pe,U as ue,V as je,W as fe,Y as I,Z as F,k as ge,D as R,_ as B,a as z,b as H,d as V,e as J,v as ve,w as Ne,x as Ce,y as ye,z as c,$ as M,a0 as we,a1 as Se,A as g}from"./index-BSBM4i_g.js";import{c as be}from"./clipboard-B9ndUJKl.js";import{C as d,b as x,a as m,c as u,d as _}from"./card-Cnz8b7Ou.js";import{B as p}from"./badge-DO6e5hC1.js";import{L as q}from"./label-vEgNxdb2.js";import{A as S}from"./arrow-left-CEZFPQje.js";import{C as De,a as Ae}from"./clipboard-BTZru8wn.js";import{D as Pe}from"./download-CW_rWwud.js";import{C as ke}from"./calendar-DWaFMSXH.js";import{C as Ee}from"./clock-DQXbrDkQ.js";function Q(r){switch(r){case"approved":case"code-complete":return"default";case"in-review":return"secondary";case"rejected":return"destructive";default:return"outline"}}function W(r){switch(r){case"high":case"critical":return"destructive";case"medium":return"secondary";default:return"outline"}}function He(){const{id:r}=re(),Y=ne(),[s,v]=l.useState(null),[Z,b]=l.useState(!0),[N,D]=l.useState(null),[A,P]=l.useState(!1),[k,E]=l.useState(!1),[T,$]=l.useState(!1),[j,C]=l.useState(""),[G,y]=l.useState(!1),[K,w]=l.useState(!1),[f,U]=l.useState("draft"),[X,L]=l.useState(!1),{toast:O}=le();l.useEffect(()=>{async function t(){if(r)try{b(!0);const o=await(await fetch(`${g}/api/v1/proposals/${r}`)).json();o.success?v(o.data):D(o.error?.message||"Failed to fetch proposal")}catch(a){D(a instanceof Error?a.message:"Unknown error")}finally{b(!1)}}t()},[r]);const ee=async()=>{if(r){P(!0);try{const a=await(await fetch(`${g}/api/v1/proposals/${r}`,{method:"DELETE"})).json();a.success?Y("/proposals"):alert(a.error?.message||"Failed to delete proposal")}catch(t){alert(`Error deleting proposal: ${t instanceof Error?t.message:"Unknown error"}`)}finally{P(!1)}}},se=async()=>{if(!(!s||!r||f===s.status)){E(!0);try{const a=await(await fetch(`${g}/api/v1/proposals/${r}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:f})})).json();a.success?(v(a.data),y(!1)):alert(a.error?.message||"Failed to update status")}catch(t){alert(`Error updating status: ${t instanceof Error?t.message:"Unknown error"}`)}finally{E(!1)}}},te=async()=>{if(!(!s||!r||!j.trim())){$(!0);try{const t={id:`comment-${Date.now()}`,text:j,author:"current-user",timestamp:new Date().toISOString()},a=[...s.metadata.comments||[],t],i=await(await fetch(`${g}/api/v1/proposals/${r}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comments:a})})).json();i.success?(v(i.data),C(""),w(!1)):alert(i.error?.message||"Failed to add comment")}catch(t){alert(`Error adding comment: ${t instanceof Error?t.message:"Unknown error"}`)}finally{$(!1)}}},ae=()=>{if(!s)return;const t={...s,exportedAt:new Date().toISOString()},a=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),o=URL.createObjectURL(a),i=document.createElement("a");i.href=o,i.download=`proposal-${s.id}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)};return Z?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-3/4 animate-pulse"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(h,{to:"/proposals",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(S,{className:"h-4 w-4"})})})})]}),e.jsxs(d,{children:[e.jsx(x,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-3/4 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-1/2 animate-pulse"})]})}),e.jsx(m,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-4 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-5/6 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-4/6 animate-pulse"})]})})]})]}):N||!s?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:N||"Proposal not found"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(h,{to:"/proposals",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(S,{className:"h-4 w-4"})})})})]}),e.jsx(d,{children:e.jsx(m,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:N||"Proposal not found"}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:['The proposal with ID "',r,'" could not be found.']}),e.jsx(n,{asChild:!0,className:"mt-4",children:e.jsx(h,{to:"/proposals",children:"Back to Proposals"})})]})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight min-w-0",children:s.intent}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(h,{to:"/proposals",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(S,{className:"h-4 w-4"})})}),e.jsx(n,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(h,{to:`/proposals/${r}/edit`,children:[e.jsx(ie,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})}),e.jsxs(oe,{children:[e.jsx(ce,{asChild:!0,children:e.jsxs(n,{variant:"destructive",size:"sm",disabled:A,children:[e.jsx(de,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:A?"Deleting...":"Delete"})]})}),e.jsxs(me,{children:[e.jsxs(he,{children:[e.jsx(xe,{children:"Are you absolutely sure?"}),e.jsxs(pe,{children:["This action cannot be undone. This will permanently delete the change proposal",e.jsxs("span",{className:"font-semibold",children:[' "',s.intent,'"']})," and remove it from the system."]})]}),e.jsxs(ue,{children:[e.jsx(je,{children:"Cancel"}),e.jsx(fe,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Proposal"})]})]})]})]})]}),e.jsxs("button",{type:"button",onClick:async()=>{const t=`.nut/proposals/${s.id}.md`;try{await be(t),L(!0),O({title:"Copied!",description:`${t} copied to clipboard`}),setTimeout(()=>L(!1),2e3)}catch(a){console.error("Failed to copy path:",a),O({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors font-mono",children:[e.jsx("span",{children:`.nut/proposals/${s.id}.md`}),X?e.jsx(De,{className:"h-3.5 w-3.5"}):e.jsx(Ae,{className:"h-3.5 w-3.5"})]})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(d,{children:[e.jsx(x,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(u,{children:"Proposal Details"}),e.jsxs("div",{className:"flex gap-2",children:[s.metadata.priority&&e.jsx(p,{variant:W(s.metadata.priority),children:s.metadata.priority}),e.jsx(p,{variant:Q(s.status),children:s.status})]})]})}),e.jsx(m,{className:"space-y-4",children:s.content?e.jsx(I,{children:s.content}):e.jsx("p",{className:"text-muted-foreground",children:"No detailed content available for this proposal."})})]}),s.planSteps&&s.planSteps.length>0&&e.jsxs(d,{children:[e.jsxs(x,{children:[e.jsx(u,{children:"Implementation Steps"}),e.jsxs(_,{children:[s.planSteps.length," step",s.planSteps.length!==1?"s":""," planned"]})]}),e.jsx(m,{children:e.jsx("div",{className:"space-y-3",children:s.planSteps.map((t,a)=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-muted text-xs font-medium",children:a+1}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:t.description}),e.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:e.jsx(p,{variant:"outline",className:"text-xs",children:t.status})})]})]},t.id))})})]}),s.metadata.comments&&s.metadata.comments.length>0&&e.jsxs(d,{children:[e.jsxs(x,{children:[e.jsx(u,{children:"Comments"}),e.jsxs(_,{children:[s.metadata.comments.length," comment",s.metadata.comments.length!==1?"s":""]})]}),e.jsx(m,{children:e.jsx("div",{className:"space-y-4",children:s.metadata.comments.map((t,a)=>e.jsxs("div",{className:"border-l-2 border-muted pl-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(F,{className:"h-3 w-3"}),e.jsx("span",{children:t.author}),e.jsx("span",{children:"•"}),e.jsx("span",{children:new Date(t.timestamp).toLocaleString()})]}),e.jsx(I,{className:"prose-sm prose-p:mb-2 prose-ul:my-2 prose-ol:my-2",children:t.text})]},t.id||a))})})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(d,{children:[e.jsx(x,{children:e.jsx(u,{children:"Proposal Actions"})}),e.jsxs(m,{className:"space-y-2",children:[e.jsx(n,{variant:"default",className:"w-full justify-start",asChild:!0,children:e.jsxs(h,{to:`/terminal/${r}`,children:[e.jsx(ge,{className:"h-4 w-4 mr-2"}),"Prepare Coding Agent"]})}),e.jsxs(R,{open:G,onOpenChange:y,children:[e.jsx(B,{asChild:!0,children:e.jsx(n,{variant:"outline",className:"w-full justify-start",onClick:()=>U(s?.status||"draft"),children:"Change Status"})}),e.jsxs(z,{children:[e.jsxs(H,{children:[e.jsx(V,{children:"Change Proposal Status"}),e.jsx(J,{children:"Update the status of this change proposal."})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(q,{htmlFor:"status",children:"Status"}),e.jsxs(ve,{value:f,onValueChange:t=>U(t),children:[e.jsx(Ne,{children:e.jsx(Ce,{placeholder:"Select status"})}),e.jsxs(ye,{children:[e.jsx(c,{value:"draft",children:"Draft"}),e.jsx(c,{value:"proposed",children:"Proposed"}),e.jsx(c,{value:"in-review",children:"In Review"}),e.jsx(c,{value:"approved",children:"Approved"}),e.jsx(c,{value:"code-complete",children:"Code Complete"}),e.jsx(c,{value:"merged",children:"Merged"}),e.jsx(c,{value:"rejected",children:"Rejected"})]})]})]})}),e.jsxs(M,{children:[e.jsx(n,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),e.jsx(n,{onClick:se,disabled:k||f===s?.status,children:k?"Updating...":"Update Status"})]})]})]}),e.jsxs(R,{open:K,onOpenChange:w,children:[e.jsx(B,{asChild:!0,children:e.jsx(n,{variant:"outline",className:"w-full justify-start",children:"Add Comment"})}),e.jsxs(z,{children:[e.jsxs(H,{children:[e.jsx(V,{children:"Add Comment"}),e.jsx(J,{children:"Add a comment to this change proposal."})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(q,{htmlFor:"comment",children:"Comment"}),e.jsx(we,{id:"comment",placeholder:"Enter your comment...",value:j,onChange:t=>C(t.target.value),rows:4})]})}),e.jsxs(M,{children:[e.jsx(n,{variant:"outline",onClick:()=>{w(!1),C("")},children:"Cancel"}),e.jsx(n,{onClick:te,disabled:T||!j.trim(),children:T?"Adding...":"Add Comment"})]})]})]}),e.jsxs(n,{variant:"outline",className:"w-full justify-start",onClick:ae,children:[e.jsx(Pe,{className:"h-4 w-4 mr-2"}),"Export"]})]})]}),e.jsxs(d,{children:[e.jsx(x,{children:e.jsx(u,{children:"Information"})}),e.jsxs(m,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(F,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:"Author:"}),e.jsx("span",{children:s.author.name})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(ke,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:"Created:"}),e.jsx("span",{children:new Date(s.metadata.createdAt).toLocaleDateString()})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ee,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:"Updated:"}),e.jsx("span",{children:new Date(s.metadata.updatedAt).toLocaleDateString()})]}),e.jsx(Se,{}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:"Status:"}),e.jsx("div",{className:"mt-1",children:e.jsx(p,{variant:Q(s.status),children:s.status})})]}),s.metadata.priority&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:"Priority:"}),e.jsx("div",{className:"mt-1",children:e.jsx(p,{variant:W(s.metadata.priority),children:s.metadata.priority})})]}),s.metadata.tags&&s.metadata.tags.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:"Tags:"}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:s.metadata.tags.map(t=>e.jsx(p,{variant:"outline",className:"text-xs",children:t},t))})]})]})]})]})]})]})}export{He as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as M,u as R,H as U,r as o,A as I,j as e,B as m,L as x,I as O,v as L,w as T,x as k,y as D,z as r,X as V,a2 as _}from"./index-BSBM4i_g.js";import{L as j}from"./label-vEgNxdb2.js";import{C as f,b as F,a as v,c as q,d as J}from"./card-Cnz8b7Ou.js";import{M as K}from"./markdown-editor-O6tGYa1a.js";import{C as W}from"./CollapsibleSection-msxUBh1L.js";import{I as X,L as G}from"./ImplementationStepsEditor-BdHMNVVd.js";import{T as Q}from"./TagInput-CbH9zq5n.js";import{A as N}from"./arrow-left-CEZFPQje.js";import"./plus-BfBtnncn.js";import"./badge-DO6e5hC1.js";function oe(){const{id:i}=M(),$=R(),{toast:y}=U(),[z,S]=o.useState(!0),[h,w]=o.useState(!1),[C,b]=o.useState(null),[n,d]=o.useState({intent:"",description:"",priority:"medium",status:"draft",author:{id:"current-user",name:"Current User",email:"user@example.com"}}),[p,E]=o.useState([]),[P,A]=o.useState([]);o.useEffect(()=>{i&&B()},[i]);const B=async()=>{try{S(!0);const t=await fetch(`${I}/api/v1/proposals/${i}`),s=await t.json();if(s.success||s.data||t.ok){const a=s.data||s;d({intent:a.intent||"",description:a.content||"",priority:a.metadata?.priority||"medium",status:a.status||"draft",author:{id:a.author?.id||"current-user",name:a.author?.name||"Current User",email:a.author?.email||"user@example.com"}});const g=Array.isArray(a.planSteps)?a.planSteps:[];E(g.map((c,u)=>({id:c.id||`step-${u+1}`,description:c.description||"",status:c.status||"pending"}))),A(a.metadata?.tags||[])}else b(s.error?.message||"Failed to fetch proposal")}catch(t){b(t instanceof Error?t.message:"An error occurred")}finally{S(!1)}},H=async t=>{t.preventDefault(),w(!0);try{const s=p.map(l=>({id:l.id,description:l.description.trim(),status:l.status})).filter(l=>l.description.length>0),a=P.map(l=>l.trim()).filter(l=>l.length>0),g={intent:n.intent,status:n.status,planSteps:s,metadata:{priority:n.priority,tags:a},content:n.description},c=await fetch(`${I}/api/v1/proposals/${i}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}),u=await c.json();if(u.success||c.ok)y({title:"Success",description:"Proposal updated successfully."}),$(`/proposals/${i}`);else throw new Error(u.error?.message||"Failed to update proposal")}catch(s){y({title:"Error",description:`Failed to update proposal: ${s instanceof Error?s.message:"An error occurred"}`,variant:"destructive"})}finally{w(!1)}};return z?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Edit Proposal"}),e.jsx("p",{className:"text-muted-foreground",children:"Loading proposal data..."})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(x,{to:`/proposals/${i}`,className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(N,{className:"h-4 w-4"})})})})]}),e.jsxs(f,{children:[e.jsx(F,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-6 bg-muted rounded w-1/2 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-3/4 animate-pulse"})]})}),e.jsx(v,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"h-10 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-64 bg-muted rounded animate-pulse"})]})})]})]}):C?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Error"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(x,{to:"/proposals",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(N,{className:"h-4 w-4"})})})})]}),e.jsx(f,{children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Error"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:C})]})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Edit Proposal"}),e.jsxs("p",{className:"text-muted-foreground",children:["Editing ",i]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(x,{to:`/proposals/${i}`,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(N,{className:"h-4 w-4"})})})})]}),e.jsx("form",{onSubmit:H,children:e.jsxs(f,{children:[e.jsxs(F,{children:[e.jsx(q,{children:"Proposal Details"}),e.jsx(J,{children:"Update the information for your change proposal"})]}),e.jsxs(v,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"intent",children:"Intent *"}),e.jsx(O,{id:"intent",placeholder:"Brief description of what you want to change",value:n.intent,onChange:t=>d(s=>({...s,intent:t.target.value})),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"description",children:"Description"}),e.jsx(K,{value:n.description,onChange:t=>d(s=>({...s,description:t||""})),placeholder:"Write your proposal description in markdown...",height:400})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"status",children:"Status"}),e.jsxs(L,{value:n.status,onValueChange:t=>d(s=>({...s,status:t})),children:[e.jsx(T,{children:e.jsx(k,{placeholder:"Select status"})}),e.jsxs(D,{children:[e.jsx(r,{value:"draft",children:"Draft"}),e.jsx(r,{value:"proposed",children:"Proposed"}),e.jsx(r,{value:"in-review",children:"In Review"}),e.jsx(r,{value:"approved",children:"Approved"}),e.jsx(r,{value:"code-complete",children:"Code Complete"}),e.jsx(r,{value:"rejected",children:"Rejected"}),e.jsx(r,{value:"merged",children:"Merged"})]})]})]}),e.jsx(W,{defaultOpen:!0,icon:e.jsx(G,{className:"h-4 w-4"}),title:"Optional Implementation Detail",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"priority",children:"Priority"}),e.jsxs(L,{value:n.priority,onValueChange:t=>d(s=>({...s,priority:t})),children:[e.jsx(T,{children:e.jsx(k,{placeholder:"Select priority"})}),e.jsxs(D,{children:[e.jsx(r,{value:"low",children:"Low"}),e.jsx(r,{value:"medium",children:"Medium"}),e.jsx(r,{value:"high",children:"High"}),e.jsx(r,{value:"critical",children:"Critical"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Implementation Steps"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Keep the implementation plan accurate as work progresses."})]}),p.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[p.length," step",p.length===1?"":"s"]})]}),e.jsx(X,{steps:p,onChange:E,disabled:h})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Tags"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Tags power filtering and discovery across the proposal list."}),e.jsx(Q,{tags:P,onChange:A,disabled:h,placeholder:"Add a tag (e.g. backend, rollout)"})]})]})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(m,{type:"button",variant:"outline",asChild:!0,children:e.jsxs(x,{to:`/proposals/${i}`,children:[e.jsx(V,{className:"mr-2 h-4 w-4"}),"Cancel"]})}),e.jsx(m,{type:"submit",disabled:h||!n.intent,children:h?e.jsx(e.Fragment,{children:"Saving..."}):e.jsxs(e.Fragment,{children:[e.jsx(_,{className:"mr-2 h-4 w-4"}),"Save Changes"]})})]})]})]})})]})}export{oe as ProposalEditPage};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import{c as xe,o as _e,u as Ie,l as Le,r as j,j as t,B as V,L as Y,I as Re,X,K as Pe,p as Oe,q as $e,s as Te,v as ie,w as ae,x as ce,y as ue,z as w,G as Ke,A as ze}from"./index-BSBM4i_g.js";import{C as J,b as Ve,a as Z,c as We}from"./card-Cnz8b7Ou.js";import{B as q}from"./badge-DO6e5hC1.js";import{P as ee}from"./plus-BfBtnncn.js";import{S as Ue}from"./search-kcgmZUqQ.js";/**
|
|
2
|
+
* @license lucide-react v0.542.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const Ge=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]],He=xe("arrow-down-wide-narrow",Ge);/**
|
|
7
|
+
* @license lucide-react v0.542.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const Qe=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]],Ye=xe("arrow-up-narrow-wide",Qe);/**
|
|
12
|
+
* @license lucide-react v0.542.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const Xe=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Ae=xe("funnel",Xe);function P(s){return Array.isArray?Array.isArray(s):be(s)==="[object Array]"}function Je(s){if(typeof s=="string")return s;let e=s+"";return e=="0"&&1/s==-1/0?"-0":e}function Ze(s){return s==null?"":Je(s)}function R(s){return typeof s=="string"}function ve(s){return typeof s=="number"}function qe(s){return s===!0||s===!1||et(s)&&be(s)=="[object Boolean]"}function Ee(s){return typeof s=="object"}function et(s){return Ee(s)&&s!==null}function S(s){return s!=null}function le(s){return!s.trim().length}function be(s){return s==null?s===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(s)}const tt="Incorrect 'index' type",st=s=>`Invalid value for key ${s}`,rt=s=>`Pattern length exceeds max of ${s}.`,nt=s=>`Missing ${s} property in key`,it=s=>`Property 'weight' in key '${s}' must be a positive integer`,je=Object.prototype.hasOwnProperty;class at{constructor(e){this._keys=[],this._keyMap={};let r=0;e.forEach(n=>{let i=Fe(n);this._keys.push(i),this._keyMap[i.id]=i,r+=i.weight}),this._keys.forEach(n=>{n.weight/=r})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Fe(s){let e=null,r=null,n=null,i=1,a=null;if(R(s)||P(s))n=s,e=ye(s),r=oe(s);else{if(!je.call(s,"name"))throw new Error(nt("name"));const c=s.name;if(n=c,je.call(s,"weight")&&(i=s.weight,i<=0))throw new Error(it(c));e=ye(c),r=oe(c),a=s.getFn}return{path:e,id:r,weight:i,src:n,getFn:a}}function ye(s){return P(s)?s:s.split(".")}function oe(s){return P(s)?s.join("."):s}function ct(s,e){let r=[],n=!1;const i=(a,c,l)=>{if(S(a))if(!c[l])r.push(a);else{let o=c[l];const h=a[o];if(!S(h))return;if(l===c.length-1&&(R(h)||ve(h)||qe(h)))r.push(Ze(h));else if(P(h)){n=!0;for(let d=0,m=h.length;d<m;d+=1)i(h[d],c,l+1)}else c.length&&i(h,c,l+1)}};return i(s,R(e)?e.split("."):e,0),n?r:r[0]}const ut={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},lt={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(s,e)=>s.score===e.score?s.idx<e.idx?-1:1:s.score<e.score?-1:1},ot={location:0,threshold:.6,distance:100},ht={useExtendedSearch:!1,getFn:ct,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var f={...lt,...ut,...ot,...ht};const dt=/[^ ]+/g;function ft(s=1,e=3){const r=new Map,n=Math.pow(10,e);return{get(i){const a=i.match(dt).length;if(r.has(a))return r.get(a);const c=1/Math.pow(a,.5*s),l=parseFloat(Math.round(c*n)/n);return r.set(a,l),l},clear(){r.clear()}}}class pe{constructor({getFn:e=f.getFn,fieldNormWeight:r=f.fieldNormWeight}={}){this.norm=ft(r,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((r,n)=>{this._keysMap[r.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,R(this.docs[0])?this.docs.forEach((e,r)=>{this._addString(e,r)}):this.docs.forEach((e,r)=>{this._addObject(e,r)}),this.norm.clear())}add(e){const r=this.size();R(e)?this._addString(e,r):this._addObject(e,r)}removeAt(e){this.records.splice(e,1);for(let r=e,n=this.size();r<n;r+=1)this.records[r].i-=1}getValueForItemAtKeyId(e,r){return e[this._keysMap[r]]}size(){return this.records.length}_addString(e,r){if(!S(e)||le(e))return;let n={v:e,i:r,n:this.norm.get(e)};this.records.push(n)}_addObject(e,r){let n={i:r,$:{}};this.keys.forEach((i,a)=>{let c=i.getFn?i.getFn(e):this.getFn(e,i.path);if(S(c)){if(P(c)){let l=[];const o=[{nestedArrIndex:-1,value:c}];for(;o.length;){const{nestedArrIndex:h,value:d}=o.pop();if(S(d))if(R(d)&&!le(d)){let m={v:d,i:h,n:this.norm.get(d)};l.push(m)}else P(d)&&d.forEach((m,x)=>{o.push({nestedArrIndex:x,value:m})})}n.$[a]=l}else if(R(c)&&!le(c)){let l={v:c,n:this.norm.get(c)};n.$[a]=l}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Me(s,e,{getFn:r=f.getFn,fieldNormWeight:n=f.fieldNormWeight}={}){const i=new pe({getFn:r,fieldNormWeight:n});return i.setKeys(s.map(Fe)),i.setSources(e),i.create(),i}function mt(s,{getFn:e=f.getFn,fieldNormWeight:r=f.fieldNormWeight}={}){const{keys:n,records:i}=s,a=new pe({getFn:e,fieldNormWeight:r});return a.setKeys(n),a.setIndexRecords(i),a}function te(s,{errors:e=0,currentLocation:r=0,expectedLocation:n=0,distance:i=f.distance,ignoreLocation:a=f.ignoreLocation}={}){const c=e/s.length;if(a)return c;const l=Math.abs(n-r);return i?c+l/i:l?1:c}function gt(s=[],e=f.minMatchCharLength){let r=[],n=-1,i=-1,a=0;for(let c=s.length;a<c;a+=1){let l=s[a];l&&n===-1?n=a:!l&&n!==-1&&(i=a-1,i-n+1>=e&&r.push([n,i]),n=-1)}return s[a-1]&&a-n>=e&&r.push([n,a-1]),r}const W=32;function xt(s,e,r,{location:n=f.location,distance:i=f.distance,threshold:a=f.threshold,findAllMatches:c=f.findAllMatches,minMatchCharLength:l=f.minMatchCharLength,includeMatches:o=f.includeMatches,ignoreLocation:h=f.ignoreLocation}={}){if(e.length>W)throw new Error(rt(W));const d=e.length,m=s.length,x=Math.max(0,Math.min(n,m));let g=a,A=x;const C=l>1||o,M=C?Array(m):[];let E;for(;(E=s.indexOf(e,A))>-1;){let F=te(e,{currentLocation:E,expectedLocation:x,distance:i,ignoreLocation:h});if(g=Math.min(F,g),A=E+d,C){let k=0;for(;k<d;)M[E+k]=1,k+=1}}A=-1;let _=[],b=1,L=d+m;const G=1<<d-1;for(let F=0;F<d;F+=1){let k=0,y=L;for(;k<y;)te(e,{errors:F,currentLocation:x+y,expectedLocation:x,distance:i,ignoreLocation:h})<=g?k=y:L=y,y=Math.floor((L-k)/2+k);L=y;let z=Math.max(1,x-y+1),O=c?m:Math.min(x+y,m)+d,I=Array(O+2);I[O+1]=(1<<F)-1;for(let D=O;D>=z;D-=1){let $=D-1,Q=r[s.charAt($)];if(C&&(M[$]=+!!Q),I[D]=(I[D+1]<<1|1)&Q,F&&(I[D]|=(_[D+1]|_[D])<<1|1|_[D+1]),I[D]&G&&(b=te(e,{errors:F,currentLocation:$,expectedLocation:x,distance:i,ignoreLocation:h}),b<=g)){if(g=b,A=$,A<=x)break;z=Math.max(1,2*x-A)}}if(te(e,{errors:F+1,currentLocation:x,expectedLocation:x,distance:i,ignoreLocation:h})>g)break;_=I}const H={isMatch:A>=0,score:Math.max(.001,b)};if(C){const F=gt(M,l);F.length?o&&(H.indices=F):H.isMatch=!1}return H}function pt(s){let e={};for(let r=0,n=s.length;r<n;r+=1){const i=s.charAt(r);e[i]=(e[i]||0)|1<<n-r-1}return e}const se=String.prototype.normalize?(s=>s.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(s=>s);class De{constructor(e,{location:r=f.location,threshold:n=f.threshold,distance:i=f.distance,includeMatches:a=f.includeMatches,findAllMatches:c=f.findAllMatches,minMatchCharLength:l=f.minMatchCharLength,isCaseSensitive:o=f.isCaseSensitive,ignoreDiacritics:h=f.ignoreDiacritics,ignoreLocation:d=f.ignoreLocation}={}){if(this.options={location:r,threshold:n,distance:i,includeMatches:a,findAllMatches:c,minMatchCharLength:l,isCaseSensitive:o,ignoreDiacritics:h,ignoreLocation:d},e=o?e:e.toLowerCase(),e=h?se(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const m=(g,A)=>{this.chunks.push({pattern:g,alphabet:pt(g),startIndex:A})},x=this.pattern.length;if(x>W){let g=0;const A=x%W,C=x-A;for(;g<C;)m(this.pattern.substr(g,W),g),g+=W;if(A){const M=x-W;m(this.pattern.substr(M),M)}}else m(this.pattern,0)}searchIn(e){const{isCaseSensitive:r,ignoreDiacritics:n,includeMatches:i}=this.options;if(e=r?e:e.toLowerCase(),e=n?se(e):e,this.pattern===e){let C={isMatch:!0,score:0};return i&&(C.indices=[[0,e.length-1]]),C}const{location:a,distance:c,threshold:l,findAllMatches:o,minMatchCharLength:h,ignoreLocation:d}=this.options;let m=[],x=0,g=!1;this.chunks.forEach(({pattern:C,alphabet:M,startIndex:E})=>{const{isMatch:_,score:b,indices:L}=xt(e,C,M,{location:a+E,distance:c,threshold:l,findAllMatches:o,minMatchCharLength:h,includeMatches:i,ignoreLocation:d});_&&(g=!0),x+=b,_&&L&&(m=[...m,...L])});let A={isMatch:g,score:g?x/this.chunks.length:1};return g&&i&&(A.indices=m),A}}class K{constructor(e){this.pattern=e}static isMultiMatch(e){return Ce(e,this.multiRegex)}static isSingleMatch(e){return Ce(e,this.singleRegex)}search(){}}function Ce(s,e){const r=s.match(e);return r?r[1]:null}class At extends K{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const r=e===this.pattern;return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class jt extends K{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class yt extends K{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const r=e.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class Ct extends K{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const r=!e.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class wt extends K{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const r=e.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class Nt extends K{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const r=!e.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class Be extends K{constructor(e,{location:r=f.location,threshold:n=f.threshold,distance:i=f.distance,includeMatches:a=f.includeMatches,findAllMatches:c=f.findAllMatches,minMatchCharLength:l=f.minMatchCharLength,isCaseSensitive:o=f.isCaseSensitive,ignoreDiacritics:h=f.ignoreDiacritics,ignoreLocation:d=f.ignoreLocation}={}){super(e),this._bitapSearch=new De(e,{location:r,threshold:n,distance:i,includeMatches:a,findAllMatches:c,minMatchCharLength:l,isCaseSensitive:o,ignoreDiacritics:h,ignoreLocation:d})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class Se extends K{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let r=0,n;const i=[],a=this.pattern.length;for(;(n=e.indexOf(this.pattern,r))>-1;)r=n+a,i.push([n,r-1]);const c=!!i.length;return{isMatch:c,score:c?0:1,indices:i}}}const he=[At,Se,yt,Ct,Nt,wt,jt,Be],we=he.length,vt=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Et="|";function bt(s,e={}){return s.split(Et).map(r=>{let n=r.trim().split(vt).filter(a=>a&&!!a.trim()),i=[];for(let a=0,c=n.length;a<c;a+=1){const l=n[a];let o=!1,h=-1;for(;!o&&++h<we;){const d=he[h];let m=d.isMultiMatch(l);m&&(i.push(new d(m,e)),o=!0)}if(!o)for(h=-1;++h<we;){const d=he[h];let m=d.isSingleMatch(l);if(m){i.push(new d(m,e));break}}}return i})}const Ft=new Set([Be.type,Se.type]);class Mt{constructor(e,{isCaseSensitive:r=f.isCaseSensitive,ignoreDiacritics:n=f.ignoreDiacritics,includeMatches:i=f.includeMatches,minMatchCharLength:a=f.minMatchCharLength,ignoreLocation:c=f.ignoreLocation,findAllMatches:l=f.findAllMatches,location:o=f.location,threshold:h=f.threshold,distance:d=f.distance}={}){this.query=null,this.options={isCaseSensitive:r,ignoreDiacritics:n,includeMatches:i,minMatchCharLength:a,findAllMatches:l,ignoreLocation:c,location:o,threshold:h,distance:d},e=r?e:e.toLowerCase(),e=n?se(e):e,this.pattern=e,this.query=bt(this.pattern,this.options)}static condition(e,r){return r.useExtendedSearch}searchIn(e){const r=this.query;if(!r)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:i,ignoreDiacritics:a}=this.options;e=i?e:e.toLowerCase(),e=a?se(e):e;let c=0,l=[],o=0;for(let h=0,d=r.length;h<d;h+=1){const m=r[h];l.length=0,c=0;for(let x=0,g=m.length;x<g;x+=1){const A=m[x],{isMatch:C,indices:M,score:E}=A.search(e);if(C){if(c+=1,o+=E,n){const _=A.constructor.type;Ft.has(_)?l=[...l,...M]:l.push(M)}}else{o=0,c=0,l.length=0;break}}if(c){let x={isMatch:!0,score:o/c};return n&&(x.indices=l),x}}return{isMatch:!1,score:1}}}const de=[];function Dt(...s){de.push(...s)}function fe(s,e){for(let r=0,n=de.length;r<n;r+=1){let i=de[r];if(i.condition(s,e))return new i(s,e)}return new De(s,e)}const re={AND:"$and",OR:"$or"},me={PATH:"$path",PATTERN:"$val"},ge=s=>!!(s[re.AND]||s[re.OR]),Bt=s=>!!s[me.PATH],St=s=>!P(s)&&Ee(s)&&!ge(s),Ne=s=>({[re.AND]:Object.keys(s).map(e=>({[e]:s[e]}))});function ke(s,e,{auto:r=!0}={}){const n=i=>{let a=Object.keys(i);const c=Bt(i);if(!c&&a.length>1&&!ge(i))return n(Ne(i));if(St(i)){const o=c?i[me.PATH]:a[0],h=c?i[me.PATTERN]:i[o];if(!R(h))throw new Error(st(o));const d={keyId:oe(o),pattern:h};return r&&(d.searcher=fe(h,e)),d}let l={children:[],operator:a[0]};return a.forEach(o=>{const h=i[o];P(h)&&h.forEach(d=>{l.children.push(n(d))})}),l};return ge(s)||(s=Ne(s)),n(s)}function kt(s,{ignoreFieldNorm:e=f.ignoreFieldNorm}){s.forEach(r=>{let n=1;r.matches.forEach(({key:i,norm:a,score:c})=>{const l=i?i.weight:null;n*=Math.pow(c===0&&l?Number.EPSILON:c,(l||1)*(e?1:a))}),r.score=n})}function _t(s,e){const r=s.matches;e.matches=[],S(r)&&r.forEach(n=>{if(!S(n.indices)||!n.indices.length)return;const{indices:i,value:a}=n;let c={indices:i,value:a};n.key&&(c.key=n.key.src),n.idx>-1&&(c.refIndex=n.idx),e.matches.push(c)})}function It(s,e){e.score=s.score}function Lt(s,e,{includeMatches:r=f.includeMatches,includeScore:n=f.includeScore}={}){const i=[];return r&&i.push(_t),n&&i.push(It),s.map(a=>{const{idx:c}=a,l={item:e[c],refIndex:c};return i.length&&i.forEach(o=>{o(a,l)}),l})}class U{constructor(e,r={},n){this.options={...f,...r},this.options.useExtendedSearch,this._keyStore=new at(this.options.keys),this.setCollection(e,n)}setCollection(e,r){if(this._docs=e,r&&!(r instanceof pe))throw new Error(tt);this._myIndex=r||Me(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){S(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const r=[];for(let n=0,i=this._docs.length;n<i;n+=1){const a=this._docs[n];e(a,n)&&(this.removeAt(n),n-=1,i-=1,r.push(a))}return r}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:r=-1}={}){const{includeMatches:n,includeScore:i,shouldSort:a,sortFn:c,ignoreFieldNorm:l}=this.options;let o=R(e)?R(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return kt(o,{ignoreFieldNorm:l}),a&&o.sort(c),ve(r)&&r>-1&&(o=o.slice(0,r)),Lt(o,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(e){const r=fe(e,this.options),{records:n}=this._myIndex,i=[];return n.forEach(({v:a,i:c,n:l})=>{if(!S(a))return;const{isMatch:o,score:h,indices:d}=r.searchIn(a);o&&i.push({item:a,idx:c,matches:[{score:h,value:a,norm:l,indices:d}]})}),i}_searchLogical(e){const r=ke(e,this.options),n=(l,o,h)=>{if(!l.children){const{keyId:m,searcher:x}=l,g=this._findMatches({key:this._keyStore.get(m),value:this._myIndex.getValueForItemAtKeyId(o,m),searcher:x});return g&&g.length?[{idx:h,item:o,matches:g}]:[]}const d=[];for(let m=0,x=l.children.length;m<x;m+=1){const g=l.children[m],A=n(g,o,h);if(A.length)d.push(...A);else if(l.operator===re.AND)return[]}return d},i=this._myIndex.records,a={},c=[];return i.forEach(({$:l,i:o})=>{if(S(l)){let h=n(r,l,o);h.length&&(a[o]||(a[o]={idx:o,item:l,matches:[]},c.push(a[o])),h.forEach(({matches:d})=>{a[o].matches.push(...d)}))}}),c}_searchObjectList(e){const r=fe(e,this.options),{keys:n,records:i}=this._myIndex,a=[];return i.forEach(({$:c,i:l})=>{if(!S(c))return;let o=[];n.forEach((h,d)=>{o.push(...this._findMatches({key:h,value:c[d],searcher:r}))}),o.length&&a.push({idx:l,item:c,matches:o})}),a}_findMatches({key:e,value:r,searcher:n}){if(!S(r))return[];let i=[];if(P(r))r.forEach(({v:a,i:c,n:l})=>{if(!S(a))return;const{isMatch:o,score:h,indices:d}=n.searchIn(a);o&&i.push({score:h,key:e,value:a,idx:c,norm:l,indices:d})});else{const{v:a,n:c}=r,{isMatch:l,score:o,indices:h}=n.searchIn(a);l&&i.push({score:o,key:e,value:a,norm:c,indices:h})}return i}}U.version="7.1.0";U.createIndex=Me;U.parseIndex=mt;U.config=f;U.parseQuery=ke;Dt(Mt);function Rt(s){switch(s){case"approved":case"code-complete":return"default";case"in-review":return"secondary";case"rejected":return"destructive";default:return"outline"}}function Pt(s){switch(s){case"high":case"critical":return"destructive";case"medium":return"secondary";default:return"outline"}}function Vt(){const[s]=_e(),e=Ie(),r=Le(),[n,i]=j.useState([]),[a,c]=j.useState([]),[l,o]=j.useState(!0),[h,d]=j.useState(null),[m,x]=j.useState(s.get("status")||"active"),[g,A]=j.useState(s.get("priority")||"all"),[C,M]=j.useState(s.get("search")||""),[E,_]=j.useState(s.get("sortBy")||"created"),[b,L]=j.useState(s.get("order")||"desc"),[G,H]=j.useState(!1),F=j.useRef(null),k=[m!=="active",g!=="all",E!=="created",b!=="desc"].filter(Boolean).length,y=j.useCallback(u=>{const p=new URLSearchParams(s);Object.entries(u).forEach(([B,T])=>{T&&T!=="all"&&T!=="active"&&T!==""?p.set(B,T):p.delete(B)});const N=p.toString(),v=N?`?${N}`:"";e(`${r.pathname}${v}`)},[s,e,r.pathname]),z=j.useCallback(u=>{x(u),y({status:u==="active"?null:u})},[y]),O=j.useCallback(u=>{A(u),y({priority:u==="all"?null:u})},[y]),I=j.useCallback(u=>{M(u),y({search:u||null})},[y]),ne=j.useCallback(u=>{_(u),y({sortBy:u==="created"?null:u})},[y]),D=j.useCallback(()=>{const u=b==="asc"?"desc":"asc";L(u),y({order:u==="desc"?null:u})},[b,y]),$=j.useCallback(u=>{if(u.key==="s"||u.key==="S"){const p=document.activeElement;p?.tagName==="INPUT"||p?.tagName==="TEXTAREA"||p?.getAttribute("contenteditable")==="true"||(u.preventDefault(),F.current?.focus())}},[]);j.useEffect(()=>(document.addEventListener("keydown",$),()=>{document.removeEventListener("keydown",$)}),[$]);const Q=j.useMemo(()=>{const u={keys:[{name:"intent",weight:.4},{name:"id",weight:.3},{name:"author.name",weight:.2},{name:"metadata.tags",weight:.1}],threshold:.3,includeScore:!0};return new U(n,u)},[n]);return j.useEffect(()=>{async function u(){try{o(!0);const N=await(await fetch(`${ze}/api/v1/proposals`)).json();N.success?(i(N.data),c(N.data)):d(N.error?.message||"Failed to fetch proposals")}catch(p){d(p instanceof Error?p.message:"Unknown error")}finally{o(!1)}}u()},[]),j.useEffect(()=>{let u=n;if(m==="active"?u=u.filter(p=>["draft","proposed","in-review","approved","code-complete"].includes(p.status)):m==="approved"?u=u.filter(p=>["approved","code-complete"].includes(p.status)):m!=="all"&&(u=u.filter(p=>p.status===m)),g!=="all"&&(u=u.filter(p=>p.metadata.priority===g)),C.trim()){const p=Q.search(C),N=new Set(p.map(v=>v.item.id));u=u.filter(v=>N.has(v.id))}u=u.sort((p,N)=>{let v,B;switch(E){case"created":{v=new Date(p.metadata.createdAt).getTime(),B=new Date(N.metadata.createdAt).getTime();break}case"updated":{v=new Date(p.metadata.updatedAt).getTime(),B=new Date(N.metadata.updatedAt).getTime();break}case"status":{v=p.status,B=N.status;break}case"priority":{const T={critical:4,high:3,medium:2,low:1};v=T[p.metadata.priority]||0,B=T[N.metadata.priority]||0;break}case"intent":{v=p.intent.toLowerCase(),B=N.intent.toLowerCase();break}default:v=new Date(p.metadata.createdAt).getTime(),B=new Date(N.metadata.createdAt).getTime()}return b==="asc"?v<B?-1:v>B?1:0:v>B?-1:v<B?1:0}),c(u)},[n,m,g,C,E,b,Q]),l?t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Proposals"}),t.jsx("p",{className:"text-muted-foreground",children:"Manage change proposals for your project"})]}),t.jsx(V,{asChild:!0,children:t.jsxs(Y,{to:"/proposals/new",children:[t.jsx(ee,{className:"mr-2 h-4 w-4"}),"New Proposal"]})})]}),t.jsx("div",{className:"space-y-4",children:[...Array(3)].map((u,p)=>t.jsx(J,{children:t.jsx(Ve,{children:t.jsxs("div",{className:"flex justify-between items-start",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("div",{className:"h-6 bg-muted rounded w-3/4 animate-pulse"}),t.jsx("div",{className:"h-4 bg-muted rounded w-1/2 animate-pulse"})]}),t.jsx("div",{className:"h-6 bg-muted rounded w-20 animate-pulse"})]})})},p))})]}):h?t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Proposals"}),t.jsx("p",{className:"text-muted-foreground",children:"Manage change proposals for your project"})]}),t.jsx(V,{asChild:!0,children:t.jsxs(Y,{to:"/proposals/new",children:[t.jsx(ee,{className:"mr-2 h-4 w-4"}),"New Proposal"]})})]}),t.jsx(J,{children:t.jsx(Z,{className:"pt-6",children:t.jsx("div",{className:"text-center",children:t.jsxs("p",{className:"text-destructive",children:["Error: ",h]})})})})]}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Proposals"}),t.jsx("p",{className:"text-muted-foreground",children:"Manage change proposals for your project"})]}),t.jsx(V,{asChild:!0,children:t.jsxs(Y,{to:"/proposals/new",children:[t.jsx(ee,{className:"mr-2 h-4 w-4"}),"New Proposal"]})})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"relative",children:[t.jsx(Ue,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),t.jsx(Re,{ref:F,placeholder:"Search proposals...",value:C,onChange:u=>I(u.target.value),className:"pl-9 pr-20 h-11 bg-muted/40 border-muted-foreground/20 focus:bg-background transition-colors"}),t.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-2",children:C?t.jsx("button",{onClick:()=>I(""),className:"h-5 w-5 rounded-full bg-muted-foreground/20 hover:bg-muted-foreground/30 flex items-center justify-center transition-colors",children:t.jsx(X,{className:"h-3 w-3"})}):t.jsx(Pe,{children:t.jsx(Oe,{children:"S"})})})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{onClick:()=>H(!G),className:"flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-lg border border-muted-foreground/20 hover:bg-muted/50 transition-colors",children:[t.jsx(Ae,{className:"h-4 w-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Filters & Sort"}),t.jsx("span",{className:"sm:hidden",children:"Filters"}),k>0&&t.jsx("span",{className:"flex items-center justify-center h-5 w-5 text-xs font-bold rounded-full bg-primary text-primary-foreground",children:k}),G?t.jsx($e,{className:"h-4 w-4 ml-1"}):t.jsx(Te,{className:"h-4 w-4 ml-1"})]}),t.jsxs("div",{className:"flex-1 flex items-center gap-2 overflow-x-auto scrollbar-hide",children:[m!=="active"&&t.jsxs("button",{onClick:()=>z("active"),className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-blue-500/15 text-blue-600 dark:text-blue-400 hover:bg-blue-500/25 transition-colors whitespace-nowrap",children:[m,t.jsx(X,{className:"h-3 w-3"})]}),g!=="all"&&t.jsxs("button",{onClick:()=>O("all"),className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-amber-500/15 text-amber-600 dark:text-amber-400 hover:bg-amber-500/25 transition-colors whitespace-nowrap",children:[g," priority",t.jsx(X,{className:"h-3 w-3"})]}),(E!=="created"||b!=="desc")&&t.jsxs("button",{onClick:()=>{ne("created"),L("desc"),y({sortBy:null,order:null})},className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-purple-500/15 text-purple-600 dark:text-purple-400 hover:bg-purple-500/25 transition-colors whitespace-nowrap",children:[E," ",b==="asc"?"↑":"↓",t.jsx(X,{className:"h-3 w-3"})]})]}),t.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[a.length," result",a.length!==1?"s":""]})]}),G&&t.jsxs("div",{className:"p-4 rounded-lg border border-muted-foreground/20 bg-muted/30 space-y-4 animate-in slide-in-from-top-2 duration-200",children:[t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Status"}),t.jsxs(ie,{value:m,onValueChange:z,children:[t.jsx(ae,{className:"w-full bg-background",children:t.jsx(ce,{placeholder:"Filter by status"})}),t.jsxs(ue,{children:[t.jsx(w,{value:"active",children:"Active (Default)"}),t.jsx(w,{value:"all",children:"All statuses"}),t.jsx(w,{value:"draft",children:"Draft"}),t.jsx(w,{value:"proposed",children:"Proposed"}),t.jsx(w,{value:"in-review",children:"In Review"}),t.jsx(w,{value:"approved",children:"Approved"}),t.jsx(w,{value:"code-complete",children:"Code Complete"}),t.jsx(w,{value:"merged",children:"Merged"}),t.jsx(w,{value:"rejected",children:"Rejected"})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Priority"}),t.jsxs(ie,{value:g,onValueChange:O,children:[t.jsx(ae,{className:"w-full bg-background",children:t.jsx(ce,{placeholder:"Filter by priority"})}),t.jsxs(ue,{children:[t.jsx(w,{value:"all",children:"All priorities"}),t.jsx(w,{value:"low",children:"Low"}),t.jsx(w,{value:"medium",children:"Medium"}),t.jsx(w,{value:"high",children:"High"}),t.jsx(w,{value:"critical",children:"Critical"})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Sort By"}),t.jsxs(ie,{value:E,onValueChange:u=>ne(u),children:[t.jsx(ae,{className:"w-full bg-background",children:t.jsx(ce,{})}),t.jsxs(ue,{children:[t.jsx(w,{value:"created",children:"Created Date"}),t.jsx(w,{value:"updated",children:"Updated Date"}),t.jsx(w,{value:"status",children:"Status"}),t.jsx(w,{value:"priority",children:"Priority"}),t.jsx(w,{value:"intent",children:"Title"})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Order"}),t.jsx(V,{variant:"outline",onClick:D,className:"w-full justify-between bg-background",children:b==="asc"?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"Ascending"}),t.jsx(Ye,{className:"h-4 w-4"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"Descending"}),t.jsx(He,{className:"h-4 w-4"})]})})]})]}),k>0&&t.jsx("div",{className:"pt-2 border-t border-muted-foreground/10",children:t.jsxs(V,{variant:"ghost",size:"sm",onClick:()=>{z("active"),O("all"),I("")},className:"text-muted-foreground hover:text-foreground",children:[t.jsx(X,{className:"h-3 w-3 mr-1"}),"Reset all filters"]})})]})]}),a.length===0&&n.length>0?t.jsx(J,{children:t.jsx(Z,{className:"pt-6",children:t.jsxs("div",{className:"text-center py-6",children:[t.jsx(Ae,{className:"mx-auto h-12 w-12 text-muted-foreground/50"}),t.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No proposals match your filters"}),t.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Try adjusting your status or priority filters."}),t.jsx(V,{variant:"outline",className:"mt-4",onClick:()=>{z("active"),O("all"),I("")},children:"Clear Filters"})]})})}):n.length===0?t.jsx(J,{children:t.jsx(Z,{className:"pt-6",children:t.jsxs("div",{className:"text-center py-6",children:[t.jsx(Ke,{className:"mx-auto h-12 w-12 text-muted-foreground/50"}),t.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No proposals yet"}),t.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Create your first change proposal to get started."}),t.jsx(V,{asChild:!0,className:"mt-4",children:t.jsxs(Y,{to:"/proposals/new",children:[t.jsx(ee,{className:"mr-2 h-4 w-4"}),"New Proposal"]})})]})})}):t.jsx("div",{className:"space-y-4",children:a.map(u=>t.jsx(Y,{to:`/proposals/${u.id}`,className:"block",children:t.jsx(J,{className:"hover:shadow-md hover:bg-muted/30 transition-all cursor-pointer",children:t.jsx(Z,{className:"py-4",children:t.jsx("div",{className:"flex justify-between items-start gap-4",children:t.jsxs("div",{className:"flex-1 space-y-2",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsx(We,{className:"text-base leading-tight",children:u.intent}),t.jsxs("div",{className:"flex gap-1 ml-3 flex-shrink-0",children:[u.metadata.priority&&t.jsx(q,{variant:Pt(u.metadata.priority),className:"text-xs",children:u.metadata.priority}),t.jsx(q,{variant:Rt(u.status),className:"text-xs",children:u.status})]})]}),u.content&&t.jsxs("div",{className:"text-sm text-muted-foreground leading-relaxed",children:[u.content.split(`
|
|
17
|
+
`).slice(0,2).join(" ").substring(0,150),u.content.length>150?"...":""]}),t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{className:"text-xs text-muted-foreground",children:[u.id," • by ",u.author.name," • ",new Date(u.metadata.createdAt).toLocaleDateString()]}),t.jsxs("div",{className:"flex gap-3 text-xs text-muted-foreground",children:[u.planSteps.length>0&&t.jsxs("span",{children:[u.planSteps.length," step",u.planSteps.length!==1?"s":""]}),u.evidence.length>0&&t.jsxs("span",{children:[u.evidence.length," evidence"]}),u.metadata.tags&&u.metadata.tags.length>0&&t.jsxs("span",{children:[u.metadata.tags.length," tag",u.metadata.tags.length!==1?"s":""]})]})]}),u.metadata.tags&&u.metadata.tags.length>0&&t.jsxs("div",{className:"flex gap-1 mt-2",children:[u.metadata.tags.slice(0,3).map(p=>t.jsx(q,{variant:"outline",className:"text-xs",children:p},p)),u.metadata.tags.length>3&&t.jsxs(q,{variant:"outline",className:"text-xs",children:["+",u.metadata.tags.length-3]})]})]})})})})},u.id))})]})}export{Vt as default};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import{c as F,r as n,j as e,D as le,a as ne,b as re,d as ie,S as Fe,B as m,ah as Me,H as He,A as E,n as ee,aj as we,a0 as be,v as T,w as I,x as D,y as L,z as U,ac as Pe,ai as qe,X as Je,C as Ye,g as te,ak as Ne,al as Xe,am as Ze,an as es,e as Te,T as Ie,I as De,ao as ss}from"./index-BSBM4i_g.js";import{C as je,b as Le,a as ve,c as as,d as ts}from"./card-Cnz8b7Ou.js";import{L as u}from"./label-vEgNxdb2.js";import{B as ye}from"./badge-DO6e5hC1.js";import{c as ls}from"./clipboard-B9ndUJKl.js";import{D as ke}from"./download-CW_rWwud.js";import{C as ns}from"./chevron-left-CNgc28Tc.js";import{C as rs}from"./calendar-DWaFMSXH.js";import{P as Ue}from"./plus-BfBtnncn.js";import{S as is}from"./search-kcgmZUqQ.js";/**
|
|
2
|
+
* @license lucide-react v0.542.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const os=[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]],Ee=F("file-audio",os);/**
|
|
7
|
+
* @license lucide-react v0.542.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const cs=[["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"}]],Ce=F("file-code",cs);/**
|
|
12
|
+
* @license lucide-react v0.542.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const ds=[["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"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],Re=F("file-image",ds);/**
|
|
17
|
+
* @license lucide-react v0.542.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const ms=[["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 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],_e=F("file-json",ms);/**
|
|
22
|
+
* @license lucide-react v0.542.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const hs=[["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"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],$e=F("file-play",hs);/**
|
|
27
|
+
* @license lucide-react v0.542.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const us=[["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:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],ze=F("file-spreadsheet",us);/**
|
|
32
|
+
* @license lucide-react v0.542.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const xs=[["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:"M9 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]],Oe=F("file-type",xs);/**
|
|
37
|
+
* @license lucide-react v0.542.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/const ps=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],fs=F("hard-drive",ps);/**
|
|
42
|
+
* @license lucide-react v0.542.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/const gs=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],oe=F("image",gs);/**
|
|
47
|
+
* @license lucide-react v0.542.0 - ISC
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the ISC license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/const js=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],Ve=F("music",js);/**
|
|
52
|
+
* @license lucide-react v0.542.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/const vs=[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]],Ae=F("presentation",vs);/**
|
|
57
|
+
* @license lucide-react v0.542.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/const ws=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],bs=F("upload",ws);/**
|
|
62
|
+
* @license lucide-react v0.542.0 - ISC
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the ISC license.
|
|
65
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/const Ns=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],ys=F("video",Ns),xe=[{id:"example-1",prompt:"A serene Japanese garden at dawn, with cherry blossoms falling gently onto a still koi pond. Morning mist rises from the water, and a traditional red wooden bridge arches gracefully in the background. Shot on medium format film with soft, diffused lighting.",imageUrl:"https://replicate.delivery/pbxt/O7kbtH7wgLIItlCyeWjm0fgPpx7OpGsT9VbYyxBXnfieVxQe/woman-by-car.jpg"},{id:"example-2",prompt:"Glossy candy-colored 3D letters in hot pink, electric orange, and lime green on a sun-drenched poolside patio with bold terrazzo tiles and vintage lounge chairs in turquoise and yellow. Shot on Kodachrome film with a Hasselblad 500C, warm golden afternoon sunlight, dramatic lens flare, punchy oversaturated colors.",imageUrl:"https://replicate.delivery/pbxt/LUSNRiITNZzwaVXiSAWYzDeMJDVgF64hxmfJY5LEXVgdFXKA/out-0.webp"},{id:"example-3",prompt:"A cozy coffee shop interior with exposed brick walls, warm Edison bulb lighting, and steam rising from freshly brewed espresso. Vintage wooden furniture, potted plants on windowsills, and rain gently pattering against large windows. Moody, intimate atmosphere.",imageUrl:"https://replicate.delivery/pbxt/IJbGk2DEcUPrq1x8z6Cg7MJsKRdYhAcEHCKlkMzxPLQfVaNA/out-0.webp"},{id:"example-4",prompt:"Futuristic neon-lit cityscape at night, towering skyscrapers with holographic advertisements, flying vehicles streaking through the sky leaving light trails. Cyberpunk aesthetic with rain-slicked streets reflecting vibrant pink and blue neon lights. Blade Runner inspired.",imageUrl:"https://replicate.delivery/pbxt/K1juSILfCPTmGRnl1gBOzZQS4gVj4YCuSHVJ8KjVPMDfXaNA/out-0.webp"},{id:"example-5",prompt:"A whimsical treehouse village suspended in an ancient forest, connected by rope bridges and spiral staircases. Warm lantern light glows from circular windows, fireflies dance in the twilight air, and moss covers the weathered wooden structures. Fantasy illustration style.",imageUrl:"https://replicate.delivery/pbxt/M2ndEILfCPTmGRnl1gBOzZQS4gVj4YCuSHVJ8KjVPMDfXaNA/out-0.webp"},{id:"example-6",prompt:"Minimalist product photography of a luxury perfume bottle on a marble surface. Soft directional lighting creates elegant shadows, with fresh white flowers blurred in the background. Clean, sophisticated aesthetic with subtle reflections.",imageUrl:"https://replicate.delivery/pbxt/N3oeJKMgDQUnHSnm2hCPaAST5hWk5ZDvTIWK9LkWQNEgYbOB/out-0.webp"},{id:"example-7",prompt:"An astronaut floating in the vastness of space, Earth visible in the background with swirling clouds and deep blue oceans. Stars scatter infinitely into the darkness. The astronaut's visor reflects distant galaxies. Photorealistic, awe-inspiring scale.",imageUrl:"https://replicate.delivery/pbxt/O4pfLMNhERVoITon3iDQbBTU6iXl6AEwUJXL0MlXROFhZcPC/out-0.webp"},{id:"example-8",prompt:"Delicious artisan pizza fresh from a wood-fired oven, with bubbling mozzarella, fresh basil leaves, and drizzled olive oil. Rustic wooden table background, natural lighting, steam rising from the crispy crust. Food photography, appetizing and warm.",imageUrl:"https://replicate.delivery/pbxt/P5qgMNOiFS5pJUpn4jERcCUV7jYm7BFxVKYM1NmYSPGiAdQD/out-0.webp"}];function ks({open:x,onOpenChange:C,onSelectExample:l}){const[d,b]=n.useState(xe.length>0?xe[0]:null),h=()=>{d&&(l(d.prompt),C(!1))},y=c=>{l(c.prompt),C(!1)};return e.jsx(le,{open:x,onOpenChange:C,children:e.jsxs(ne,{className:"max-w-[95vw] sm:max-w-[90vw] w-full sm:w-[90vw] max-h-[95vh] sm:max-h-[90vh] h-[95vh] sm:h-[90vh] p-0 gap-0 flex flex-col",children:[e.jsx(re,{className:"px-4 sm:px-6 pt-4 sm:pt-6 pb-3 sm:pb-4 border-b flex-shrink-0",children:e.jsx(ie,{className:"text-base sm:text-lg",children:"Example Prompts"})}),e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden md:hidden",children:[e.jsx("div",{className:"h-[40%] min-h-0 p-3 flex items-center justify-center bg-muted/30 overflow-hidden",children:d?e.jsx("img",{src:d.imageUrl,alt:"Example",className:"max-w-full max-h-full object-contain rounded-lg shadow-lg"}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Select an example"})}),e.jsxs("div",{className:"flex-1 min-h-0 border-t flex flex-col",children:[e.jsx(Fe,{className:"flex-1",children:e.jsx("div",{className:"p-3 space-y-2",children:xe.map(c=>e.jsxs("button",{onClick:()=>b(c),onDoubleClick:()=>y(c),className:`w-full text-left p-2 rounded-lg border-2 transition-all flex gap-3 ${d?.id===c.id?"border-primary bg-primary/5":"border-transparent bg-muted/50 hover:bg-muted"}`,children:[e.jsx("img",{src:c.imageUrl,alt:"",className:"w-12 h-12 rounded object-cover flex-shrink-0"}),e.jsx("p",{className:"text-sm line-clamp-3 flex-1",children:c.prompt})]},c.id))})}),e.jsx("div",{className:"p-3 border-t flex-shrink-0",children:e.jsxs(m,{onClick:h,disabled:!d,className:"w-full",children:[e.jsx(Me,{className:"mr-2 h-4 w-4"}),"Use This Prompt"]})})]})]}),e.jsxs("div",{className:"flex-1 hidden md:flex overflow-hidden",children:[e.jsxs("div",{className:"w-[35%] border-r flex flex-col",children:[e.jsx(Fe,{className:"flex-1",children:e.jsx("div",{className:"p-4 space-y-3",children:xe.map(c=>e.jsxs("button",{onClick:()=>b(c),onDoubleClick:()=>y(c),className:`w-full text-left p-3 rounded-lg border-2 transition-all flex gap-3 ${d?.id===c.id?"border-primary bg-primary/5 shadow-sm":"border-transparent bg-muted/50 hover:bg-muted hover:border-muted-foreground/20"}`,children:[e.jsx("img",{src:c.imageUrl,alt:"",className:"w-16 h-16 rounded object-cover flex-shrink-0"}),e.jsx("p",{className:"text-sm leading-relaxed line-clamp-4 flex-1",children:c.prompt})]},c.id))})}),e.jsx("div",{className:"p-4 border-t flex-shrink-0",children:e.jsxs(m,{onClick:h,disabled:!d,className:"w-full",children:[e.jsx(Me,{className:"mr-2 h-4 w-4"}),"Use This Prompt"]})})]}),e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx("div",{className:"flex-1 min-h-0 p-6 flex items-center justify-center bg-muted/30 overflow-hidden",children:d?e.jsx("img",{src:d.imageUrl,alt:"Example",className:"max-w-full max-h-full object-contain rounded-lg shadow-lg"}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Select an example to preview"})}),d&&e.jsxs("div",{className:"border-t p-4 bg-background flex-shrink-0 max-h-[30%] overflow-y-auto",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2 font-medium",children:"Full Prompt:"}),e.jsx("p",{className:"text-sm leading-relaxed",children:d.prompt})]})]})]})]})})}const Se={"nano-banana-pro":{id:"nano-banana-pro",label:"Nano Banana Pro",replicateId:"google/nano-banana-pro",features:{resolution:!0,outputQuality:!1,goFast:!1,safetyTolerance:!1,matchInputImage:!1},resolutionOptions:[{value:"1K",label:"1K"},{value:"2K",label:"2K"},{value:"4K",label:"4K"}],defaults:{resolution:"2K"}},"flux-2-dev":{id:"flux-2-dev",label:"FLUX.2 Dev",replicateId:"black-forest-labs/flux-2-dev",features:{resolution:!1,outputQuality:!0,goFast:!0,safetyTolerance:!1,matchInputImage:!0},defaults:{outputQuality:80,goFast:!0}},"flux-2-pro":{id:"flux-2-pro",label:"FLUX.2 Pro",replicateId:"black-forest-labs/flux-2-pro",features:{resolution:!0,outputQuality:!0,goFast:!1,safetyTolerance:!0,matchInputImage:!1},resolutionOptions:[{value:"0.5 MP",label:"0.5 MP"},{value:"1 MP",label:"1 MP"},{value:"2 MP",label:"2 MP"},{value:"4 MP",label:"4 MP"}],defaults:{resolution:"2 MP",outputQuality:80,safetyTolerance:2}}},Ge=Object.values(Se).map(x=>({value:x.id,label:x.label})),We=[{value:"1:1",label:"1:1"},{value:"2:3",label:"2:3"},{value:"3:2",label:"3:2"},{value:"3:4",label:"3:4"},{value:"4:3",label:"4:3"},{value:"4:5",label:"4:5"},{value:"5:4",label:"5:4"},{value:"9:16",label:"9:16"},{value:"16:9",label:"16:9"},{value:"21:9",label:"21:9"}],Cs={value:"match_input_image",label:"Match Input"},Qe=[{value:"png",label:"PNG"},{value:"jpg",label:"JPG"},{value:"webp",label:"WebP"}],Be=[{value:"60",label:"60"},{value:"70",label:"70"},{value:"80",label:"80"},{value:"90",label:"90"},{value:"100",label:"100"}],Ke=[{value:"1",label:"1 (Strict)"},{value:"2",label:"2"},{value:"3",label:"3"},{value:"4",label:"4"},{value:"5",label:"5"},{value:"6",label:"6 (Relaxed)"}];function Ss({open:x,onOpenChange:C,onSave:l}){const[d,b]=n.useState(""),[h,y]=n.useState("nano-banana-pro"),[c,p]=n.useState("4:3"),[M,f]=n.useState("2K"),[R,k]=n.useState("png"),[z,O]=n.useState("80"),[B,g]=n.useState(!0),[V,A]=n.useState("2"),[N,G]=n.useState(null),[j,P]=n.useState(!1),[S,_]=n.useState(!1),[K,r]=n.useState([]),[i,$]=n.useState([]),[W,Z]=n.useState(!0),[ce,se]=n.useState(!1),{toast:X}=He(),w=Se[h],de=w.features.matchInputImage?[Cs,...We]:We,ae=w.resolutionOptions||[];n.useEffect(()=>{const a=Se[h];a.defaults.resolution&&a.features.resolution&&f(a.defaults.resolution),a.defaults.outputQuality!==void 0&&O(String(a.defaults.outputQuality)),a.defaults.goFast!==void 0&&g(a.defaults.goFast),a.defaults.safetyTolerance!==void 0&&A(String(a.defaults.safetyTolerance)),p(v=>v==="match_input_image"&&!a.features.matchInputImage?"4:3":v)},[h]),n.useEffect(()=>{x&&pe()},[x]);const pe=async()=>{try{const v=await(await fetch(`${E}/api/v1/resources`)).json();if(v.success){const q=(v.data||[]).filter(Q=>{const s=Q.type==="image/jpeg"||Q.name.toLowerCase().endsWith(".jpg")||Q.name.toLowerCase().endsWith(".jpeg"),t=Q.type==="image/png"||Q.name.toLowerCase().endsWith(".png");return(s||t)&&Q.thumbnailPath});r(q)}}catch(a){console.error("Failed to fetch image resources:",a)}},me=async()=>{if(!d.trim()){X({title:"Prompt required",description:"Please enter a prompt to generate an image",variant:"destructive"});return}P(!0),G(null);try{const a=W||i.length===0?[]:[...i],v=await fetch(`${E}/api/v1/resources/generate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:d,model:h,dimensions:c,resolution:w.features.resolution?M:void 0,output_format:R,output_quality:w.features.outputQuality?parseInt(z):void 0,go_fast:w.features.goFast?B:void 0,safety_tolerance:w.features.safetyTolerance?parseInt(V):void 0,image_input:a})}),q=await v.json();if(!v.ok||!q.success){const Q=q.error?.message||"Failed to generate image",s=q.error?.code==="MISSING_API_TOKEN";throw new Error(s?"Replicate API token not configured. Please add it in Settings → Integrations.":Q)}G(q.data.imageUrl),X({title:"Image generated",description:"Your image has been generated successfully"})}catch(a){console.error("Generation error:",a),X({title:"Generation failed",description:a instanceof Error?a.message:"Failed to generate image. Please try again.",variant:"destructive"})}finally{P(!1)}},he=async()=>{if(N){_(!0);try{await l(N),b(""),y("nano-banana-pro"),p("4:3"),f("2K"),k("png"),O("80"),g(!0),A("2"),G(null),Z(!0),$([]),C(!1)}catch(a){X({title:"Save failed",description:a instanceof Error?a.message:"Failed to save image. Please try again.",variant:"destructive"})}finally{_(!1)}}},fe=()=>{!j&&!S&&C(!1)},H=()=>{Z(!0),$([])},ue=a=>{W&&Z(!1),i.includes(a)?($(i.filter(v=>v!==a)),i.length===1&&Z(!0)):i.length<3?$([...i,a]):X({title:"Maximum selection",description:"You can only select up to 3 images",variant:"destructive"})},ge=a=>{b(a)};return e.jsxs(le,{open:x,onOpenChange:fe,children:[e.jsxs(ne,{className:"max-w-[95vw] sm:max-w-[90vw] w-full sm:w-[90vw] max-h-[95vh] sm:max-h-[90vh] h-[95vh] sm:h-[90vh] p-0 gap-0 flex flex-col",children:[e.jsx(re,{className:"px-4 sm:px-6 pt-4 sm:pt-6 pb-3 sm:pb-4 border-b flex-shrink-0",children:e.jsx(ie,{className:"text-base sm:text-lg",children:"Generate Image"})}),e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden md:hidden",children:[e.jsx("div",{className:"flex-1 min-h-0 p-3 flex items-center justify-center bg-muted/30 overflow-hidden",children:j?e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-3",children:[e.jsx(ee,{className:"h-10 w-10 animate-spin text-muted-foreground"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Generating..."})]}):N?e.jsx("div",{className:"w-full h-full min-h-0 flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:N,alt:"Generated",className:"max-w-full max-h-full object-contain rounded-lg shadow-lg"})}):e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-3 text-muted-foreground",children:[e.jsx(oe,{className:"h-12 w-12"}),e.jsx("p",{className:"text-xs",children:"Preview"}),e.jsxs(m,{size:"sm",onClick:()=>se(!0),className:"mt-2",children:[e.jsx(we,{className:"mr-2 h-4 w-4"}),"View Examples"]})]})}),e.jsx("div",{className:"border-t bg-background p-2 flex-shrink-0",children:e.jsxs("div",{className:"flex gap-1.5 overflow-x-auto pb-1",children:[e.jsx("button",{onClick:H,className:`flex-shrink-0 h-16 w-16 flex items-center justify-center border-2 rounded-md transition-colors text-xs ${W?"border-primary bg-primary/10":"border-muted hover:border-muted-foreground/50"}`,children:"None"}),K.map(a=>{const v=i.includes(a.id);return e.jsx("button",{onClick:()=>ue(a.id),className:`flex-shrink-0 h-16 w-16 border-2 rounded-md overflow-hidden transition-colors ${v?"border-primary ring-2 ring-primary":"border-muted hover:border-muted-foreground/50"}`,children:e.jsx("img",{src:`${E}/api/v1/resources/${a.id}/thumbnail`,alt:a.name,className:"w-full h-full object-cover"})},a.id)})]})}),e.jsx("div",{className:"border-t p-3 overflow-y-auto flex-shrink-0 max-h-[45vh]",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(u,{htmlFor:"prompt-mobile",className:"text-xs",children:"Prompt"}),e.jsx(be,{id:"prompt-mobile",placeholder:"Describe the image...",value:d,onChange:a=>b(a.target.value),rows:2,className:"resize-none text-sm"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(u,{htmlFor:"model-mobile",className:"text-xs",children:"Model"}),e.jsxs(T,{value:h,onValueChange:a=>y(a),children:[e.jsx(I,{id:"model-mobile",className:"h-8 text-xs",children:e.jsx(D,{})}),e.jsx(L,{children:Ge.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(u,{htmlFor:"outputFormat-mobile",className:"text-xs",children:"Format"}),e.jsxs(T,{value:R,onValueChange:k,children:[e.jsx(I,{id:"outputFormat-mobile",className:"h-8 text-xs",children:e.jsx(D,{})}),e.jsx(L,{children:Qe.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),w.features.goFast&&e.jsx("div",{className:"space-y-1 flex flex-col justify-end",children:e.jsxs("div",{className:"flex items-center space-x-2 h-8",children:[e.jsx(Pe,{id:"goFast-mobile",checked:B,onCheckedChange:a=>g(a===!0)}),e.jsx(u,{htmlFor:"goFast-mobile",className:"text-xs cursor-pointer",children:"Go Fast"})]})}),w.features.safetyTolerance&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(u,{htmlFor:"safetyTolerance-mobile",className:"text-xs",children:"Safety"}),e.jsxs(T,{value:V,onValueChange:A,children:[e.jsx(I,{id:"safetyTolerance-mobile",className:"h-8 text-xs",children:e.jsx(D,{})}),e.jsx(L,{children:Ke.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]})]}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[w.features.resolution&&e.jsxs("div",{className:"space-y-1 flex-1 min-w-[80px]",children:[e.jsx(u,{htmlFor:"resolution-mobile",className:"text-xs",children:"Resolution"}),e.jsxs(T,{value:M,onValueChange:f,children:[e.jsx(I,{id:"resolution-mobile",className:"h-8 text-xs",children:e.jsx(D,{})}),e.jsx(L,{children:ae.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),e.jsxs("div",{className:"space-y-1 flex-1 min-w-[80px]",children:[e.jsx(u,{htmlFor:"aspectRatio-mobile",className:"text-xs",children:"Ratio"}),e.jsxs(T,{value:c,onValueChange:p,children:[e.jsx(I,{id:"aspectRatio-mobile",className:"h-8 text-xs",children:e.jsx(D,{})}),e.jsx(L,{children:de.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),w.features.outputQuality&&e.jsxs("div",{className:"space-y-1 flex-1 min-w-[80px]",children:[e.jsx(u,{htmlFor:"outputQuality-mobile",className:"text-xs",children:"Quality"}),e.jsxs(T,{value:z,onValueChange:O,children:[e.jsx(I,{id:"outputQuality-mobile",className:"h-8 text-xs",children:e.jsx(D,{})}),e.jsx(L,{children:Be.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx(m,{onClick:me,disabled:!d.trim()||j||S,className:"flex-1 h-9",size:"sm",children:j?e.jsx(ee,{className:"h-4 w-4 animate-spin"}):"Generate"}),e.jsx(m,{onClick:he,disabled:!N||j||S,variant:"outline",className:"flex-1 h-9",size:"sm",children:S?e.jsx(ee,{className:"h-4 w-4 animate-spin"}):"Save"})]})]})})]}),e.jsxs("div",{className:"flex-1 hidden md:flex overflow-hidden",children:[e.jsx("div",{className:"w-[22%] border-r p-6 overflow-y-auto",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"prompt",children:"Prompt"}),e.jsx(be,{id:"prompt",placeholder:"Describe the image you want to generate...",value:d,onChange:a=>b(a.target.value),rows:4,className:"resize-none"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"model",children:"Model"}),e.jsxs(T,{value:h,onValueChange:a=>y(a),children:[e.jsx(I,{id:"model",children:e.jsx(D,{})}),e.jsx(L,{children:Ge.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"aspectRatio",children:"Aspect Ratio"}),e.jsxs(T,{value:c,onValueChange:p,children:[e.jsx(I,{id:"aspectRatio",children:e.jsx(D,{})}),e.jsx(L,{children:de.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),w.features.resolution&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"resolution",children:"Resolution"}),e.jsxs(T,{value:M,onValueChange:f,children:[e.jsx(I,{id:"resolution",children:e.jsx(D,{})}),e.jsx(L,{children:ae.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"outputFormat",children:"Output Format"}),e.jsxs(T,{value:R,onValueChange:k,children:[e.jsx(I,{id:"outputFormat",children:e.jsx(D,{})}),e.jsx(L,{children:Qe.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),w.features.outputQuality&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"outputQuality",children:"Output Quality"}),e.jsxs(T,{value:z,onValueChange:O,children:[e.jsx(I,{id:"outputQuality",children:e.jsx(D,{})}),e.jsx(L,{children:Be.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),w.features.goFast&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{id:"goFast",checked:B,onCheckedChange:a=>g(a===!0)}),e.jsx(u,{htmlFor:"goFast",className:"cursor-pointer",children:"Go Fast"})]}),w.features.safetyTolerance&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"safetyTolerance",children:"Safety Tolerance"}),e.jsxs(T,{value:V,onValueChange:A,children:[e.jsx(I,{id:"safetyTolerance",children:e.jsx(D,{})}),e.jsx(L,{children:Ke.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 pt-4",children:[e.jsx(m,{onClick:me,disabled:!d.trim()||j||S,className:"w-full",children:j?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"mr-2 h-4 w-4 animate-spin"}),"Generating..."]}):"Generate"}),e.jsx(m,{onClick:he,disabled:!N||j||S,variant:"outline",className:"w-full",children:S?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})]})]})}),e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsx("div",{className:"flex-1 min-h-0 p-6 flex items-center justify-center bg-muted/30 overflow-hidden",children:j?e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4",children:[e.jsx(ee,{className:"h-12 w-12 animate-spin text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Generating image..."})]}):N?e.jsx("div",{className:"w-full h-full min-h-0 flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:N,alt:"Generated",className:"max-w-full max-h-full object-contain rounded-lg shadow-lg"})}):e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4 text-muted-foreground",children:[e.jsx(oe,{className:"h-16 w-16"}),e.jsx("p",{className:"text-sm",children:"Generated image will appear here"}),e.jsxs(m,{onClick:()=>se(!0),className:"mt-2",children:[e.jsx(we,{className:"mr-2 h-4 w-4"}),"View Examples"]})]})}),e.jsx("div",{className:"border-t bg-background p-4 flex-shrink-0",children:e.jsxs("div",{className:"flex gap-2 overflow-x-auto",children:[e.jsx("button",{onClick:H,className:`flex-shrink-0 h-32 w-32 flex items-center justify-center border-2 rounded-md transition-colors ${W?"border-primary bg-primary/10":"border-muted hover:border-muted-foreground/50"}`,children:e.jsx("span",{className:"text-sm font-medium",children:"None"})}),K.map(a=>{const v=i.includes(a.id);return e.jsx("button",{onClick:()=>ue(a.id),className:`flex-shrink-0 h-32 w-32 border-2 rounded-md overflow-hidden transition-colors ${v?"border-primary ring-2 ring-primary":"border-muted hover:border-muted-foreground/50"}`,children:e.jsx("img",{src:`${E}/api/v1/resources/${a.id}/thumbnail`,alt:a.name,className:"w-full h-full object-cover"})},a.id)})]})})]})]})]}),e.jsx(ks,{open:ce,onOpenChange:se,onSelectExample:ge})]})}function Fs({open:x,onOpenChange:C,resource:l,onCopyPath:d,onDownload:b,onNavigate:h,canNavigatePrev:y,canNavigateNext:c}){const[p,M]=n.useState(null),[f,R]=n.useState(!1),k=l?`${E}/api/v1/resources/${l.id}`:"",z=l?.type.startsWith("image/")??!1,O=l?l.type==="image/svg+xml"||l.name.toLowerCase().endsWith(".svg"):!1,B=l?l.type==="application/pdf"||l.name.toLowerCase().endsWith(".pdf"):!1,g=l?.type.startsWith("video/")??!1,V=l?.type.startsWith("audio/")??!1,A=l?l.type.startsWith("text/")||l.type==="application/json"||l.type.includes("javascript")||l.type.includes("typescript")||l.type.includes("xml")||l.name.toLowerCase().match(/\.(txt|md|json|js|ts|jsx|tsx|css|html|xml|yaml|yml|log|sh|bash|zsh|fish)$/)!==null:!1,N=l?l.name.toLowerCase().endsWith(".md")||l.name.toLowerCase().endsWith(".markdown"):!1,G=l?l.type==="application/json"||l.name.toLowerCase().endsWith(".json"):!1,j=l?l.type==="text/html"||l.name.toLowerCase().endsWith(".html"):!1;if(n.useEffect(()=>{const r=i=>{if(x){if(i.key==="Escape"){C(!1);return}if(i.key==="ArrowLeft"&&y){i.preventDefault(),h("prev");return}i.key==="ArrowRight"&&c&&(i.preventDefault(),h("next"))}};if(x)return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[x,C,h,y,c]),n.useEffect(()=>{x&&l&&(A||N||G||j)?(R(!0),fetch(k).then(r=>{if(r.ok)return r.text();throw new Error("Failed to load file")}).then(r=>{M(r)}).catch(r=>{console.error("Failed to load text content:",r),M(null)}).finally(()=>{R(!1)})):M(null)},[x,l?.id,A,N,G,j,k]),!l)return null;const P=r=>{if(r===0)return"0 B";const i=1024,$=["B","KB","MB","GB"],W=Math.floor(Math.log(r)/Math.log(i));return parseFloat((r/Math.pow(i,W)).toFixed(2))+" "+$[W]},S=r=>new Date(r).toLocaleString(),_=r=>r.startsWith("image/")?e.jsx(oe,{className:"h-6 w-6"}):r.startsWith("video/")?e.jsx(ys,{className:"h-6 w-6"}):r.startsWith("audio/")?e.jsx(Ve,{className:"h-6 w-6"}):r.includes("text")||r.includes("document")||r.includes("code")?e.jsx(te,{className:"h-6 w-6"}):r.includes("json")||r.includes("javascript")||r.includes("typescript")?e.jsx(Ce,{className:"h-6 w-6"}):e.jsx(Ne,{className:"h-6 w-6"}),K=()=>{if(O)return e.jsx("img",{src:k,alt:l.name,className:"max-w-full max-h-full object-contain rounded-lg shadow-lg"});if(B)return e.jsx("iframe",{src:k,className:"w-full h-full min-h-[600px] rounded-lg border",title:l.name});if(g)return e.jsx("video",{src:k,controls:!0,className:"max-w-full max-h-full rounded-lg shadow-lg",children:"Your browser does not support the video tag."});if(V)return e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4 p-8",children:[e.jsx(Ve,{className:"h-16 w-16 text-muted-foreground"}),e.jsx("audio",{src:k,controls:!0,className:"w-full max-w-md",children:"Your browser does not support the audio tag."})]});if(N&&p!==null)return f?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}):e.jsx("div",{className:"w-full h-full overflow-auto p-6 prose prose-sm dark:prose-invert max-w-none",children:e.jsx(Xe,{remarkPlugins:[es],rehypePlugins:[Ze],children:p})});if(j&&p!==null)return f?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}):e.jsx("iframe",{srcDoc:p,className:"w-full h-full min-h-[600px] rounded-lg border",title:l.name,sandbox:"allow-same-origin"});if(G&&p!==null){if(f)return e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})});let r=p;try{const i=JSON.parse(p);r=JSON.stringify(i,null,2)}catch{}return e.jsx("div",{className:"w-full h-full overflow-auto p-6",children:e.jsx("pre",{className:"text-xs bg-muted p-4 rounded-lg overflow-auto",children:e.jsx("code",{children:r})})})}return A&&p!==null?f?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}):e.jsx("div",{className:"w-full h-full overflow-auto p-6",children:e.jsx("pre",{className:"text-xs bg-muted p-4 rounded-lg overflow-auto whitespace-pre-wrap",children:e.jsx("code",{children:p})})}):z?e.jsx("img",{src:k,alt:l.name,className:"max-w-full max-h-full object-contain rounded-lg shadow-lg"}):e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4 text-muted-foreground",children:[_(l.type),e.jsx("p",{className:"text-sm",children:"Preview not available for this file type"}),e.jsxs(m,{variant:"outline",onClick:()=>b(l),children:[e.jsx(ke,{className:"mr-2 h-4 w-4"}),"Download to view"]})]})};return e.jsx(le,{open:x,onOpenChange:C,children:e.jsxs(ne,{className:"max-w-[90vw] w-[90vw] max-h-[90vh] h-[90vh] p-0 gap-0 flex flex-col [&>button]:hidden",children:[e.jsx(re,{className:"px-6 pt-6 pb-4 border-b flex-shrink-0",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[_(l.type),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(ie,{className:"text-xl truncate",children:l.name}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:l.type})]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>d(l),title:"Copy path to clipboard",children:e.jsx(qe,{className:"h-4 w-4"})}),e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>b(l),title:"Download",children:e.jsx(ke,{className:"h-4 w-4"})}),e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>C(!1),title:"Close",children:e.jsx(Je,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"flex-1 flex overflow-hidden",children:e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex-1 relative flex items-center justify-center bg-muted/30 p-6 overflow-auto",children:[y&&e.jsx("button",{type:"button",onClick:()=>h("prev"),className:"absolute left-4 top-1/2 -translate-y-1/2 rounded-full border bg-background/80 p-2 shadow-sm hover:bg-background transition-colors","aria-label":"Previous resource",children:e.jsx(ns,{className:"h-5 w-5"})}),c&&e.jsx("button",{type:"button",onClick:()=>h("next"),className:"absolute right-4 top-1/2 -translate-y-1/2 rounded-full border bg-background/80 p-2 shadow-sm hover:bg-background transition-colors","aria-label":"Next resource",children:e.jsx(Ye,{className:"h-5 w-5"})}),K()]}),e.jsx("div",{className:"border-t p-6 flex-shrink-0 bg-background",children:e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-3",children:"Information"}),e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Size:"}),e.jsx("span",{children:P(l.size)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(rs,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Uploaded:"}),e.jsx("span",{children:S(l.uploadedAt)})]})]})]})}),e.jsxs("div",{className:"space-y-4",children:[l.metadata.description&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-2",children:"Description"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l.metadata.description})]}),l.metadata.tags&&l.metadata.tags.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-2",children:"Tags"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:l.metadata.tags.map(r=>e.jsx(ye,{variant:"secondary",children:r},r))})]})]})]})})]})})]})})}function zs(){const[x,C]=n.useState([]),[l,d]=n.useState(!0),[b,h]=n.useState(!1),[y,c]=n.useState(""),[p,M]=n.useState(!1),[f,R]=n.useState([]),[k,z]=n.useState(""),[O,B]=n.useState(""),[g,V]=n.useState([]),[A,N]=n.useState(!1),[G,j]=n.useState(null),[P,S]=n.useState(null),[_,K]=n.useState(null),r=n.useRef(null),{toast:i}=He();n.useEffect(()=>{$()},[]);const $=async()=>{try{d(!0);const t=await(await fetch(`${E}/api/v1/resources`)).json();t.success&&C(t.data||[])}catch(s){console.error("Failed to fetch resources:",s)}finally{d(!1)}},W=s=>{s.length!==0&&V(Array.from(s))},Z=async()=>{if(g.length!==0){h(!0);try{for(const s of g){const t=new FormData;if(t.append("file",s),t.append("tags",f.join(", ")),t.append("description",O),!(await fetch(`${E}/api/v1/resources`,{method:"POST",body:t})).ok)throw new Error("Upload failed")}R([]),z(""),B(""),V([]),M(!1),await $(),i({title:"Upload successful",description:`${g.length} file(s) uploaded successfully`})}catch(s){console.error("Upload failed:",s),i({title:"Upload failed",description:"Failed to upload files. Please try again.",variant:"destructive"})}finally{h(!1)}}},ce=()=>{R([]),z(""),B(""),V([]),M(!1)},se=s=>{if(s.key==="Enter"){s.preventDefault();const t=k.trim();t&&!f.includes(t)&&(R([...f,t]),z(""))}},X=s=>{R(f.filter(t=>t!==s))},w=s=>{V(g.filter((t,o)=>o!==s))},de=async()=>{if(_)try{if((await fetch(`${E}/api/v1/resources/${_.id}`,{method:"DELETE"})).ok)await $(),i({title:"Resource deleted",description:`${_.name} has been deleted`});else throw new Error("Delete failed")}catch(s){console.error("Failed to delete resource:",s),i({title:"Delete failed",description:"Failed to delete resource. Please try again.",variant:"destructive"})}finally{K(null)}},ae=async s=>{try{const t=`.nut/resources/files/${s.path}`;await ls(t),i({title:"Path copied!",description:`Copied ${t} to clipboard`})}catch(t){console.error("Failed to copy path:",t),i({title:"Failed to copy",description:"Unable to copy path to clipboard",variant:"destructive"})}},pe=s=>{if(s===0)return"0 B";const t=1024,o=["B","KB","MB","GB"],J=Math.floor(Math.log(s)/Math.log(t));return parseFloat((s/Math.pow(t,J)).toFixed(2))+" "+o[J]},me=(s,t)=>{const o=t.toLowerCase();return s.startsWith("image/")?s==="image/svg+xml"||o.endsWith(".svg")?e.jsx(Re,{className:"h-4 w-4"}):e.jsx(oe,{className:"h-4 w-4"}):s.startsWith("video/")?e.jsx($e,{className:"h-4 w-4"}):s.startsWith("audio/")?e.jsx(Ee,{className:"h-4 w-4"}):s==="application/pdf"||o.endsWith(".pdf")?e.jsx(te,{className:"h-4 w-4"}):o.match(/\.(js|jsx|ts|tsx|py|java|cpp|c|h|hpp|cs|go|rs|rb|php|swift|kt|scala|r|m|mm)$/)?e.jsx(Ce,{className:"h-4 w-4"}):s==="application/json"||o.endsWith(".json")?e.jsx(_e,{className:"h-4 w-4"}):s.includes("spreadsheet")||s.includes("excel")||o.match(/\.(xls|xlsx|csv)$/)?e.jsx(ze,{className:"h-4 w-4"}):s.includes("presentation")||s.includes("powerpoint")||o.match(/\.(ppt|pptx)$/)?e.jsx(Ae,{className:"h-4 w-4"}):s.startsWith("text/")||s.includes("document")||s.includes("word")?e.jsx(te,{className:"h-4 w-4"}):s.includes("font")||o.match(/\.(ttf|otf|woff|woff2|eot)$/)?e.jsx(Oe,{className:"h-4 w-4"}):e.jsx(Ne,{className:"h-4 w-4"})},he=(s,t)=>{const o=t.toLowerCase();return s.startsWith("image/")?s==="image/svg+xml"||o.endsWith(".svg")?e.jsx(Re,{className:"h-16 w-16"}):e.jsx(oe,{className:"h-16 w-16"}):s.startsWith("video/")?e.jsx($e,{className:"h-16 w-16"}):s.startsWith("audio/")?e.jsx(Ee,{className:"h-16 w-16"}):s==="application/pdf"||o.endsWith(".pdf")?e.jsx(te,{className:"h-16 w-16"}):o.match(/\.(js|jsx|ts|tsx|py|java|cpp|c|h|hpp|cs|go|rs|rb|php|swift|kt|scala|r|m|mm)$/)?e.jsx(Ce,{className:"h-16 w-16"}):s==="application/json"||o.endsWith(".json")?e.jsx(_e,{className:"h-16 w-16"}):s.includes("spreadsheet")||s.includes("excel")||o.match(/\.(xls|xlsx|csv)$/)?e.jsx(ze,{className:"h-16 w-16"}):s.includes("presentation")||s.includes("powerpoint")||o.match(/\.(ppt|pptx)$/)?e.jsx(Ae,{className:"h-16 w-16"}):s.startsWith("text/")||s.includes("document")||s.includes("word")?e.jsx(te,{className:"h-16 w-16"}):s.includes("font")||o.match(/\.(ttf|otf|woff|woff2|eot)$/)?e.jsx(Oe,{className:"h-16 w-16"}):e.jsx(Ne,{className:"h-16 w-16"})},fe=s=>{const t=s.name.toLowerCase(),o=s.type.startsWith("image/");return s.type==="image/svg+xml"||t.endsWith(".svg")?e.jsx("div",{className:"w-full h-32 flex items-center justify-center bg-muted/30 rounded-md border overflow-hidden p-2",children:e.jsx("img",{src:`${E}/api/v1/resources/${s.id}`,alt:s.name,className:"w-full h-full object-contain"})}):o&&s.thumbnailPath?e.jsx("img",{src:`${E}/api/v1/resources/${s.id}/thumbnail`,alt:s.name,className:"w-full h-32 object-cover rounded-md border",onError:Y=>{Y.currentTarget.style.display="none"}}):e.jsx("div",{className:"w-full h-32 flex items-center justify-center bg-muted/50 rounded-md border",children:e.jsx("div",{className:"text-muted-foreground",children:he(s.type,s.name)})})},H=x.filter(s=>{if(!y)return!0;const t=y.toLowerCase();return s.name.toLowerCase().includes(t)||s.metadata.description?.toLowerCase().includes(t)||s.metadata.tags?.some(o=>o.toLowerCase().includes(t))}),ue=s=>{s.preventDefault(),s.stopPropagation()},ge=s=>{s.preventDefault(),s.stopPropagation(),s.dataTransfer.files&&s.dataTransfer.files.length>0&&W(s.dataTransfer.files)},a=(s,t)=>{if(t.target.closest("button"))return;j(s);const J=H.findIndex(Y=>Y.id===s.id);S(J>=0?J:null)},v=s=>{window.open(`${E}/api/v1/resources/${s.id}?download=true`)},q=async s=>{h(!0);try{const t=await fetch(s);if(!t.ok)throw new Error("Failed to download generated image");const o=await t.blob(),J=`generated-image-${Date.now()}.png`,Y=new FormData;if(Y.append("file",o,J),Y.append("tags",f.join(",")),Y.append("description",O),!(await fetch(`${E}/api/v1/resources`,{method:"POST",body:Y})).ok)throw new Error("Upload failed");await $(),i({title:"Image saved",description:"Generated image has been saved to resources"})}catch(t){throw console.error("Failed to save generated image:",t),i({title:"Save failed",description:t.message||"Failed to save generated image",variant:"destructive"}),t}finally{h(!1)}},Q=s=>{if(P===null)return;const t=s==="next"?P+1:P-1;if(t<0||t>=H.length)return;const o=H[t];S(t),j(o)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Resources"}),e.jsx("p",{className:"text-muted-foreground text-sm hidden sm:block",children:"Manage files and resources for your project"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsxs(m,{variant:"outline",size:"sm",onClick:()=>N(!0),children:[e.jsx(we,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Generate"})]}),e.jsxs(m,{size:"sm",onClick:()=>M(!p),children:[e.jsx(Ue,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Add Resource"})]})]})]}),e.jsx(le,{open:p,onOpenChange:s=>!s&&ce(),children:e.jsxs(ne,{className:"max-w-2xl",children:[e.jsxs(re,{children:[e.jsx(ie,{children:"Upload Resource"}),e.jsx(Te,{children:"Add files to your project resources"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"border-2 border-dashed border-muted-foreground/25 rounded-lg p-8 text-center cursor-pointer hover:border-muted-foreground/50 transition-colors",onDragOver:ue,onDrop:ge,onClick:()=>r.current?.click(),children:[e.jsx(bs,{className:"mx-auto h-8 w-8 text-muted-foreground"}),e.jsx("p",{className:"mt-2 text-sm font-medium",children:"Drop files here or click to browse"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Support for images, documents, and other files"})]}),e.jsx("input",{ref:r,type:"file",multiple:!0,className:"hidden",onChange:s=>s.target.files&&W(s.target.files)}),g.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs(u,{children:["Selected Files (",g.length,")"]}),e.jsx("div",{className:"border rounded-lg p-3 max-h-40 overflow-y-auto space-y-2",children:g.map((s,t)=>e.jsxs("div",{className:"flex items-center justify-between text-sm bg-muted/50 rounded px-3 py-2",children:[e.jsx("span",{className:"truncate flex-1",children:s.name}),e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>w(t),className:"h-6 w-6 p-0 ml-2",children:e.jsx(Ie,{className:"h-3 w-3"})})]},t))})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"tags",children:"Tags"}),e.jsx(De,{id:"tags",placeholder:"Type a tag and press Enter",value:k,onChange:s=>z(s.target.value),onKeyDown:se}),f.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:f.map(s=>e.jsxs(ye,{variant:"secondary",className:"text-xs",children:[s,e.jsx("button",{type:"button",onClick:()=>X(s),className:"ml-1 hover:text-destructive",children:"×"})]},s))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"description",children:"Description"}),e.jsx(be,{id:"description",placeholder:"Brief description of this resource...",value:O,onChange:s=>B(s.target.value),rows:3})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(m,{variant:"outline",onClick:ce,disabled:b,children:"Cancel"}),e.jsx(m,{onClick:Z,disabled:g.length===0||b,children:b?"Uploading...":`Upload ${g.length>0?`(${g.length})`:""}`})]})]})]})}),e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs("div",{className:"relative flex-1 w-full",children:[e.jsx(is,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(De,{placeholder:"Search resources...",value:y,onChange:s=>c(s.target.value),className:"pl-8"})]})}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:l?Array.from({length:6}).map((s,t)=>e.jsxs(je,{className:"animate-pulse",children:[e.jsxs(Le,{children:[e.jsx("div",{className:"h-4 bg-muted rounded w-3/4"}),e.jsx("div",{className:"h-3 bg-muted rounded w-1/2"})]}),e.jsx(ve,{children:e.jsx("div",{className:"h-20 bg-muted rounded"})})]},t)):H.length>0?H.map(s=>e.jsxs(je,{className:"hover:shadow-lg hover:bg-muted transition-all cursor-pointer",onClick:t=>a(s,t),children:[e.jsxs(Le,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[me(s.type,s.name),e.jsx(as,{className:"text-sm font-medium truncate",children:s.name})]}),e.jsxs(ts,{className:"text-xs",children:[pe(s.size)," • ",new Date(s.uploadedAt).toLocaleDateString()]}),e.jsxs("div",{className:"flex justify-end space-x-1 mt-2",children:[e.jsx(m,{variant:"ghost",size:"sm",onClick:t=>{t.stopPropagation(),ae(s)},title:"Copy path to clipboard",children:e.jsx(qe,{className:"h-3 w-3"})}),e.jsx(m,{variant:"ghost",size:"sm",onClick:t=>{t.stopPropagation(),v(s)},children:e.jsx(ke,{className:"h-3 w-3"})}),e.jsx(m,{variant:"ghost",size:"sm",onClick:t=>{t.stopPropagation(),K(s)},children:e.jsx(Ie,{className:"h-3 w-3"})})]})]}),e.jsxs(ve,{className:"pt-0",children:[e.jsx("div",{className:"mb-3",children:fe(s)}),s.metadata.description&&e.jsx("p",{className:"text-sm text-muted-foreground mb-2 line-clamp-2",children:s.metadata.description}),s.metadata.tags&&s.metadata.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:s.metadata.tags.map(t=>e.jsx(ye,{variant:"secondary",className:"text-xs",children:t},t))})]})]},s.id)):e.jsx("div",{className:"col-span-full",children:e.jsx(je,{children:e.jsxs(ve,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(ss,{className:"h-12 w-12 text-muted-foreground/50"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No resources yet"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground text-center max-w-sm",children:"Upload files to get started. Resources can be referenced by LLMs and team members for enhanced context."}),e.jsxs(m,{className:"mt-4",onClick:()=>M(!0),children:[e.jsx(Ue,{className:"mr-2 h-4 w-4"}),"Add First Resource"]})]})})})}),b&&e.jsx("div",{className:"fixed bottom-4 right-4 bg-background border rounded-lg shadow-lg p-4",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-primary"}),e.jsx("span",{className:"text-sm",children:"Uploading files..."})]})}),e.jsx(Ss,{open:A,onOpenChange:N,onSave:q}),e.jsx(Fs,{open:!!G,onOpenChange:s=>{s||j(null),s||S(null)},resource:G,onCopyPath:ae,onDownload:v,onNavigate:Q,canNavigatePrev:P!==null&&P>0,canNavigateNext:P!==null&&P<H.length-1}),e.jsx(le,{open:!!_,onOpenChange:s=>!s&&K(null),children:e.jsxs(ne,{className:"max-w-md",children:[e.jsxs(re,{children:[e.jsx(ie,{children:"Delete Resource"}),e.jsxs(Te,{children:["Are you sure you want to delete ",e.jsx("strong",{children:_?.name}),"? This action cannot be undone."]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(m,{variant:"outline",onClick:()=>K(null),children:"Cancel"}),e.jsx(m,{variant:"destructive",onClick:de,children:"Delete"})]})]})})]})}export{zs as default};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{c as f,r,A as p,j as e,a1 as F,B as l,I as c,T as L}from"./index-BSBM4i_g.js";import{C as T,b as I,a as z}from"./card-Cnz8b7Ou.js";import{L as n}from"./label-vEgNxdb2.js";import{B as _}from"./badge-DO6e5hC1.js";import{P as D}from"./plus-BfBtnncn.js";/**
|
|
2
|
+
* @license lucide-react v0.542.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const q=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],O=f("link",q);/**
|
|
7
|
+
* @license lucide-react v0.542.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const B=[["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"}]],M=f("pen",B);/**
|
|
12
|
+
* @license lucide-react v0.542.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const R=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],w=f("unlink",R);function K(){const[v,C]=r.useState([]),[y,k]=r.useState(!1),[o,h]=r.useState(null),[u,j]=r.useState(!1),[g,N]=r.useState(null),[a,d]=r.useState({name:"",description:"",linkPath:"",targetPath:"",isActive:!1}),[i,m]=r.useState({name:"",description:"",linkPath:"",targetPath:"",isActive:!1});r.useEffect(()=>{x()},[]);const x=async()=>{try{const s=await(await fetch(`${p}/api/v1/symlinks`)).json();s.success&&C(s.symlinks)}catch(t){console.error("Error fetching symlinks:",t)}},S=async t=>{h(t);try{(await fetch(`${p}/api/v1/symlinks/${t}/toggle`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok?await x():console.error("Error toggling symlink")}catch(s){console.error("Error toggling symlink:",s)}finally{h(null)}},A=async t=>{if(confirm("Are you sure you want to delete this symlink configuration?")){h(t);try{(await fetch(`${p}/api/v1/symlinks/${t}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok?await x():console.error("Error deleting symlink")}catch(s){console.error("Error deleting symlink:",s)}finally{h(null)}}},E=async()=>{if(!a.name||!a.linkPath||!a.targetPath){alert("Please fill in all required fields");return}k(!0);try{const t=await fetch(`${p}/api/v1/symlinks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(t.ok)await x(),j(!1),d({name:"",description:"",linkPath:"",targetPath:"",isActive:!1});else{const s=await t.json();alert(s.error?.message||"Error creating symlink")}}catch(t){console.error("Error adding symlink:",t),alert("Failed to create symlink")}finally{k(!1)}},b=t=>{N(t.id),m({name:t.name,description:t.description||"",linkPath:t.linkPath,targetPath:t.targetPath,isActive:t.isActive})},P=()=>{N(null),m({name:"",description:"",linkPath:"",targetPath:"",isActive:!1})},$=async()=>{if(g){if(!i.name||!i.linkPath||!i.targetPath){alert("Please fill in all required fields");return}h(g);try{const t=await fetch(`${p}/api/v1/symlinks/${g}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(t.ok)await x(),P();else{const s=await t.json();alert(s.error?.message||"Error updating symlink")}}catch(t){console.error("Error updating symlink:",t),alert("Failed to update symlink")}finally{h(null)}}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Symlinks Configuration"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage symlinks for easy access to project rules and configurations."})]}),e.jsx(F,{}),e.jsxs(T,{children:[e.jsx(I,{children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs(l,{size:"sm",variant:"outline",onClick:()=>j(!u),children:[e.jsx(D,{className:"h-4 w-4 mr-2"}),u?"Cancel":"Add Symlink"]})})}),e.jsxs(z,{children:[u&&e.jsxs("div",{className:"mb-6 p-4 border rounded-lg bg-muted/50",children:[e.jsx("h4",{className:"font-medium mb-4",children:"New Symlink Configuration"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(n,{htmlFor:"new-name",children:"Name *"}),e.jsx(c,{id:"new-name",placeholder:"e.g., Claude Rules",value:a.name,onChange:t=>d({...a,name:t.target.value})})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"new-description",children:"Description"}),e.jsx(c,{id:"new-description",placeholder:"e.g., Project-specific rules for Claude AI",value:a.description,onChange:t=>d({...a,description:t.target.value})})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"new-link-path",children:"Link Path * (relative to project root)"}),e.jsx(c,{id:"new-link-path",placeholder:"e.g., CLAUDE.md or docs/README.md",value:a.linkPath,onChange:t=>d({...a,linkPath:t.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Where the symlink will be created in your project"})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"new-target-path",children:"Target Path * (relative to project root)"}),e.jsx(c,{id:"new-target-path",placeholder:"e.g., .nut/rules/CLAUDE.md",value:a.targetPath,onChange:t=>d({...a,targetPath:t.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"The actual file that the symlink will point to"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"new-active",checked:a.isActive,onChange:t=>d({...a,isActive:t.target.checked}),className:"rounded"}),e.jsx(n,{htmlFor:"new-active",children:"Activate immediately"})]}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(l,{variant:"outline",onClick:()=>{j(!1),d({name:"",description:"",linkPath:"",targetPath:"",isActive:!1})},children:"Cancel"}),e.jsx(l,{onClick:E,disabled:y,children:y?"Creating...":"Create Symlink"})]})]})]}),v.length===0&&!u?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(w,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No symlinks configured"}),e.jsx("p",{className:"text-sm mt-2",children:'Click "Add Symlink" to create your first symlink configuration.'})]}):e.jsx("div",{className:"space-y-4",children:v.map(t=>e.jsx("div",{className:"border rounded-lg",children:g===t.id?e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx(n,{htmlFor:`edit-name-${t.id}`,children:"Name *"}),e.jsx(c,{id:`edit-name-${t.id}`,value:i.name,onChange:s=>m({...i,name:s.target.value})})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:`edit-desc-${t.id}`,children:"Description"}),e.jsx(c,{id:`edit-desc-${t.id}`,value:i.description,onChange:s=>m({...i,description:s.target.value})})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:`edit-link-${t.id}`,children:"Link Path *"}),e.jsx(c,{id:`edit-link-${t.id}`,value:i.linkPath,onChange:s=>m({...i,linkPath:s.target.value})})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:`edit-target-${t.id}`,children:"Target Path *"}),e.jsx(c,{id:`edit-target-${t.id}`,value:i.targetPath,onChange:s=>m({...i,targetPath:s.target.value})})]}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(l,{variant:"outline",size:"sm",onClick:P,children:"Cancel"}),e.jsx(l,{size:"sm",onClick:$,disabled:o===t.id,children:o===t.id?"Saving...":"Save"})]})]}):e.jsx("div",{className:"p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[t.isActive?e.jsx(O,{className:"h-4 w-4 text-green-600 flex-shrink-0"}):e.jsx(w,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),e.jsx("h4",{className:"font-medium text-sm sm:text-base",children:t.name})]}),e.jsx(_,{variant:t.isActive?"default":"secondary",className:"text-xs",children:t.isActive?"Active":"Inactive"})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:t.description}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-2 font-mono break-all",children:[e.jsx("span",{className:"text-foreground/70",children:t.linkPath}),e.jsx("span",{className:"mx-1",children:"→"}),e.jsx("span",{children:t.targetPath})]})]}),e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2 flex-shrink-0",children:[e.jsx(l,{onClick:()=>S(t.id),disabled:o===t.id,variant:t.isActive?"outline":"default",size:"sm",children:o===t.id?"...":e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"hidden sm:inline",children:t.isActive?"Disable":"Enable"}),e.jsx("span",{className:"sm:hidden",children:t.isActive?"Off":"On"})]})}),e.jsx(l,{onClick:()=>b(t),variant:"outline",size:"icon",className:"h-8 w-8",disabled:o===t.id,children:e.jsx(M,{className:"h-4 w-4"})}),e.jsx(l,{onClick:()=>A(t.id),variant:"outline",size:"icon",className:"h-8 w-8",disabled:o===t.id,children:e.jsx(L,{className:"h-4 w-4"})})]})]})})},t.id))})]})]})]})}export{K as default};
|