@shepai/cli 1.150.2 → 1.151.1-pr474.b3fcccd
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/packages/core/src/application/ports/output/services/github-repository-service.interface.d.ts +17 -0
- package/dist/packages/core/src/application/ports/output/services/github-repository-service.interface.d.ts.map +1 -1
- package/dist/packages/core/src/application/ports/output/services/github-repository-service.interface.js +12 -0
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/evidence.node.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/evidence.node.js +8 -2
- package/dist/packages/core/src/infrastructure/services/external/github-repository.service.d.ts +1 -0
- package/dist/packages/core/src/infrastructure/services/external/github-repository.service.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/external/github-repository.service.js +18 -1
- package/dist/src/presentation/web/app/(dashboard)/@drawer/create/page.d.ts.map +1 -1
- package/dist/src/presentation/web/app/(dashboard)/@drawer/create/page.js +6 -2
- package/dist/src/presentation/web/app/actions/get-viewer-permission.d.ts +4 -0
- package/dist/src/presentation/web/app/actions/get-viewer-permission.d.ts.map +1 -0
- package/dist/src/presentation/web/app/actions/get-viewer-permission.js +14 -0
- package/dist/src/presentation/web/components/common/control-center-drawer/create-drawer-client.d.ts +2 -1
- package/dist/src/presentation/web/components/common/control-center-drawer/create-drawer-client.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/control-center-drawer/create-drawer-client.js +2 -2
- package/dist/src/presentation/web/components/common/feature-create-drawer/feature-create-drawer.d.ts +3 -1
- package/dist/src/presentation/web/components/common/feature-create-drawer/feature-create-drawer.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/feature-create-drawer/feature-create-drawer.js +29 -3
- package/dist/src/presentation/web/components/common/feature-create-drawer/feature-create-drawer.stories.d.ts +10 -0
- package/dist/src/presentation/web/components/common/feature-create-drawer/feature-create-drawer.stories.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/feature-create-drawer/feature-create-drawer.stories.js +37 -3
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/fallback-build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +3 -3
- package/web/.next/required-server-files.js +3 -3
- package/web/.next/required-server-files.json +3 -3
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +71 -56
- package/web/.next/server/app/(dashboard)/@drawer/create/page.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +71 -56
- package/web/.next/server/app/(dashboard)/create/page.js +1 -1
- package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/_not-found/page/server-reference-manifest.json +3 -3
- package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/api/attachments/preview/route.js.nft.json +1 -1
- package/web/.next/server/app/api/evidence/route.js.nft.json +1 -1
- package/web/.next/server/app/api/graph-data/route.js.nft.json +1 -1
- package/web/.next/server/app/settings/page/server-reference-manifest.json +8 -8
- package/web/.next/server/app/settings/page.js.nft.json +1 -1
- package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/skills/page/server-reference-manifest.json +8 -8
- package/web/.next/server/app/skills/page.js.nft.json +1 -1
- package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/tools/page/server-reference-manifest.json +8 -8
- package/web/.next/server/app/tools/page.js.nft.json +1 -1
- package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/version/page/server-reference-manifest.json +3 -3
- package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__2138fa7e._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__2138fa7e._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__29580090._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__29580090._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__357d99f9._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__3ef34e4c._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__3ef34e4c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__43f51aa6._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__43f51aa6._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__815546bd._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__815546bd._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__c094882b._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__c094882b._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__c9777776._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__c9777776._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__d48c5b11._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__d48c5b11._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__dac5dbf1._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__dac5dbf1._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__fae8b355._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__fae8b355._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_05c23ad9._.js +1 -1
- package/web/.next/server/chunks/ssr/_05c23ad9._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_0c5f56e3._.js → _0c473fef._.js} +3 -3
- package/web/.next/server/chunks/ssr/_0c473fef._.js.map +1 -0
- package/web/.next/server/chunks/ssr/_16eb4fec._.js +1 -1
- package/web/.next/server/chunks/ssr/_16eb4fec._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_1b719e7f._.js +1 -1
- package/web/.next/server/chunks/ssr/_1b719e7f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_37e8548b._.js +1 -1
- package/web/.next/server/chunks/ssr/_37e8548b._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_f8187a14._.js → _40137351._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_f8187a14._.js.map → _40137351._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_55d763e2._.js +1 -1
- package/web/.next/server/chunks/ssr/_55d763e2._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_6256a985._.js +1 -1
- package/web/.next/server/chunks/ssr/_6256a985._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_8fcc39d4._.js +1 -1
- package/web/.next/server/chunks/ssr/_b71645b4._.js +1 -1
- package/web/.next/server/chunks/ssr/_b71645b4._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_695769ba._.js → _c6834859._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_695769ba._.js.map → _c6834859._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_d8575088._.js +1 -1
- package/web/.next/server/chunks/ssr/_d8575088._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_64bdfc6f._.js → _e9e9ed20._.js} +3 -3
- package/web/.next/server/chunks/ssr/_e9e9ed20._.js.map +1 -0
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{src_presentation_web_94d3ebb0._.js → src_presentation_web_3ad30c04._.js} +2 -2
- package/web/.next/server/chunks/ssr/{src_presentation_web_94d3ebb0._.js.map → src_presentation_web_3ad30c04._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1b176e3c.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1b176e3c.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_bd9f0dda.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_bd9f0dda.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
- package/web/.next/server/pages/500.html +2 -2
- package/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/server/server-reference-manifest.json +122 -100
- package/web/.next/static/chunks/1407e8b6c16c67c6.js +1 -0
- package/web/.next/static/chunks/{36b9b5fd99a44449.js → 14fd67a4cce78dd2.js} +1 -1
- package/web/.next/static/chunks/36e2ea3906244cc7.js +1 -0
- package/web/.next/static/chunks/{25dc964bed9ed181.js → 3cbd99e1aee217b8.js} +1 -1
- package/web/.next/static/chunks/{7a347740423afe43.js → 409c1ee5c9f120dd.js} +1 -1
- package/web/.next/static/chunks/5e8ebcc5aea53fd1.js +5 -0
- package/web/.next/static/chunks/{3818fbb40965ae3f.js → 6e2dacd537b03b0e.js} +1 -1
- package/web/.next/static/chunks/{e16c5caa0013aaf0.js → 8a8ae33c3a4ab7c9.js} +1 -1
- package/web/.next/static/chunks/{1726b267b5058237.js → 96a5ecd44068eb9d.js} +1 -1
- package/web/.next/static/chunks/{47cfc2a88674ac18.js → b1205af11ef8f8fe.js} +1 -1
- package/web/.next/static/chunks/{5afd402b04d34aef.js → b2a634c13d8bd107.js} +1 -1
- package/web/.next/static/chunks/{65426ebcea60e166.js → cdccfd02f455fca3.js} +1 -1
- package/web/.next/server/chunks/ssr/_0c5f56e3._.js.map +0 -1
- package/web/.next/server/chunks/ssr/_64bdfc6f._.js.map +0 -1
- package/web/.next/static/chunks/261c1d86233fc28b.js +0 -1
- package/web/.next/static/chunks/48591f3d861a3c52.js +0 -1
- package/web/.next/static/chunks/9a5c77f449eaa1b3.js +0 -5
- /package/web/.next/static/{HsdbagW-OgDuUo9t_JJ83 → Deht51Lw76a3wSEpPQAvK}/_buildManifest.js +0 -0
- /package/web/.next/static/{HsdbagW-OgDuUo9t_JJ83 → Deht51Lw76a3wSEpPQAvK}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{HsdbagW-OgDuUo9t_JJ83 → Deht51Lw76a3wSEpPQAvK}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/build/webpack/loaders/next-flight-loader/server-reference.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/build/webpack/loaders/next-flight-loader/action-validate.ts","../../../../../../../packages/core/src/infrastructure/services/folder-dialog.service.ts","../../../../../../../src/presentation/web/app/actions/pick-folder.ts","../../../../../../../src/presentation/web/app/actions/list-github-repositories.ts","../../../../../../../packages/core/src/application/ports/output/services/github-repository-service.interface.ts","../../../../../../../src/presentation/web/app/actions/import-github-repository.ts","../../../../../../../src/presentation/web/app/actions/deploy-feature.ts","../../../../../../../packages/core/src/infrastructure/services/deployment/deployment-logger.ts","../../../../../../../src/presentation/web/lib/is-same-shep-instance.ts","../../../../../../../src/presentation/web/app/actions/deploy-repository.ts","../../../../../../../src/presentation/web/app/actions/stop-deployment.ts","../../../../../../../src/presentation/web/app/actions/get-deployment-status.ts","../../../../../../../src/presentation/web/app/actions/get-deployment-logs.ts","../../../../../../../src/presentation/web/app/actions/get-all-agent-models.ts","../../../../../../../src/presentation/web/lib/model-metadata.ts","../../../../../../../src/presentation/web/app/actions/update-agent-and-model.ts","../../../../../../../src/presentation/web/app/actions/get-workflow-defaults.ts","../../../../../../../src/presentation/web/app/actions/create-feature.ts","../../../../../../../src/presentation/web/app/actions/compose-user-input.ts","../../../../../../../src/presentation/web/.next-internal/server/app/%28dashboard%29/%40drawer/create/page/actions.js%20%28server%20actions%20loader%29"],"sourcesContent":["/* eslint-disable import/no-extraneous-dependencies */\nexport { registerServerReference } from 'react-server-dom-webpack/server'\n","// This function ensures that all the exported values are valid server actions,\n// during the runtime. By definition all actions are required to be async\n// functions, but here we can only check that they are functions.\nexport function ensureServerEntryExports(actions: any[]) {\n for (let i = 0; i < actions.length; i++) {\n const action = actions[i]\n if (typeof action !== 'function') {\n throw new Error(\n `A \"use server\" file can only export async functions, found ${typeof action}.\\nRead more: https://nextjs.org/docs/messages/invalid-use-server-value`\n )\n }\n }\n}\n","import { execSync } from 'node:child_process';\n\nexport interface FolderDialogDeps {\n platform: NodeJS.Platform;\n exec: (cmd: string, opts?: { encoding: BufferEncoding; timeout?: number }) => string;\n}\n\nconst defaultDeps: FolderDialogDeps = {\n platform: process.platform,\n exec: (cmd, opts) => execSync(cmd, opts) as unknown as string,\n};\n\n/**\n * Platform-specific commands that open a native OS folder picker dialog.\n * Each returns the chosen absolute folder path on stdout, or exits non-zero / returns empty on cancel.\n */\nconst PLATFORM_COMMANDS: Record<string, string> = {\n darwin: `osascript -e 'POSIX path of (choose folder with prompt \"Select a repository folder\")'`,\n linux: `zenity --file-selection --directory --title=\"Select a repository folder\" 2>/dev/null`,\n win32: `powershell -NoProfile -Command \"Add-Type -AssemblyName System.Windows.Forms; $f = New-Object System.Windows.Forms.FolderBrowserDialog; $f.Description = 'Select a repository folder'; if ($f.ShowDialog() -eq 'OK') { $f.SelectedPath } else { exit 1 }\"`,\n};\n\nexport class FolderDialogService {\n private deps: FolderDialogDeps;\n\n constructor(deps: Partial<FolderDialogDeps> = {}) {\n this.deps = { ...defaultDeps, ...deps };\n }\n\n /** Returns the OS-specific command string, or null if the platform is unsupported. */\n getCommand(): string | null {\n return PLATFORM_COMMANDS[this.deps.platform] ?? null;\n }\n\n /**\n * Opens a native folder picker dialog and returns the selected absolute path.\n * Returns `null` if the user cancels the dialog.\n * Throws if the platform is unsupported or the command fails unexpectedly.\n */\n pickFolder(): string | null {\n const command = this.getCommand();\n if (!command) {\n throw new Error(`Unsupported platform: ${this.deps.platform}`);\n }\n\n try {\n const result = this.deps.exec(command, { encoding: 'utf-8', timeout: 60_000 });\n const trimmed = result.trim();\n return trimmed.length > 0 ? trimmed : null;\n } catch (error: unknown) {\n // User cancelled the dialog — exit code 1 from osascript/zenity/powershell\n if (isExecError(error) && error.status === 1) {\n return null;\n }\n throw error;\n }\n }\n}\n\nfunction isExecError(error: unknown): error is { status: number } {\n return typeof error === 'object' && error !== null && 'status' in error;\n}\n","'use server';\n\nimport { FolderDialogService } from '@shepai/core/infrastructure/services/folder-dialog.service';\n\nexport async function pickFolder(): Promise<{ path: string | null; error?: string }> {\n const service = new FolderDialogService();\n\n try {\n const path = service.pickFolder();\n return { path };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to open folder dialog';\n return { path: null, error: message };\n }\n}\n","'use server';\n\nimport { resolve } from '@/lib/server-container';\nimport type { ListGitHubRepositoriesUseCase } from '@shepai/core/application/use-cases/repositories/list-github-repositories.use-case';\nimport type { GitHubRepo } from '@shepai/core/application/ports/output/services/github-repository-service.interface';\nimport { GitHubAuthError } from '@shepai/core/application/ports/output/services/github-repository-service.interface';\n\ninterface ListGitHubRepositoriesInput {\n search?: string;\n limit?: number;\n}\n\nexport async function listGitHubRepositories(\n input?: ListGitHubRepositoriesInput\n): Promise<{ repos?: GitHubRepo[]; error?: string }> {\n try {\n const useCase = resolve<ListGitHubRepositoriesUseCase>('ListGitHubRepositoriesUseCase');\n const repos = await useCase.execute(input);\n return { repos };\n } catch (error: unknown) {\n if (error instanceof GitHubAuthError) {\n return { error: 'GitHub CLI is not authenticated. Run `gh auth login` to sign in.' };\n }\n const message = error instanceof Error ? error.message : 'Failed to list repositories';\n return { error: message };\n }\n}\n","/**\n * GitHub Repository Service Interface\n *\n * Output port for GitHub repository operations via the gh CLI.\n * Implementations manage authentication checks, repository cloning,\n * user repository listing, and GitHub URL parsing.\n */\n\n// ---------------------------------------------------------------------------\n// Error classes\n// ---------------------------------------------------------------------------\n\n/**\n * Thrown when the GitHub CLI is not authenticated.\n */\nexport class GitHubAuthError extends Error {\n constructor(message: string, cause?: Error) {\n super(message);\n this.name = 'GitHubAuthError';\n Object.setPrototypeOf(this, new.target.prototype);\n if (cause) this.cause = cause;\n }\n}\n\n/**\n * Thrown when a `gh repo clone` operation fails.\n */\nexport class GitHubCloneError extends Error {\n constructor(message: string, cause?: Error) {\n super(message);\n this.name = 'GitHubCloneError';\n Object.setPrototypeOf(this, new.target.prototype);\n if (cause) this.cause = cause;\n }\n}\n\n/**\n * Thrown when a GitHub URL cannot be parsed into owner/repo.\n */\nexport class GitHubUrlParseError extends Error {\n constructor(message: string, cause?: Error) {\n super(message);\n this.name = 'GitHubUrlParseError';\n Object.setPrototypeOf(this, new.target.prototype);\n if (cause) this.cause = cause;\n }\n}\n\n/**\n * Thrown when listing the user's GitHub repositories fails.\n */\nexport class GitHubRepoListError extends Error {\n constructor(message: string, cause?: Error) {\n super(message);\n this.name = 'GitHubRepoListError';\n Object.setPrototypeOf(this, new.target.prototype);\n if (cause) this.cause = cause;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/**\n * A GitHub repository as returned by `gh repo list --json`.\n */\nexport interface GitHubRepo {\n /** Repository name (e.g. \"my-project\") */\n name: string;\n /** Full owner/repo identifier (e.g. \"octocat/my-project\") */\n nameWithOwner: string;\n /** Repository description (may be empty string) */\n description: string;\n /** Whether the repository is private */\n isPrivate: boolean;\n /** ISO 8601 timestamp of the most recent push */\n pushedAt: string;\n}\n\n/**\n * Options for listing user repositories.\n */\nexport interface ListUserRepositoriesOptions {\n /** Maximum number of repos to return (default: 30) */\n limit?: number;\n /** Filter repos by name substring */\n search?: string;\n}\n\n/**\n * Options for cloning a repository.\n */\nexport interface CloneOptions {\n /** Callback invoked with stderr chunks during clone for progress display */\n onProgress?: (data: string) => void;\n}\n\n/**\n * Result of parsing a GitHub URL.\n */\nexport interface ParsedGitHubUrl {\n /** Repository owner (e.g. \"octocat\") */\n owner: string;\n /** Repository name (e.g. \"my-project\") */\n repo: string;\n /** Combined owner/repo (e.g. \"octocat/my-project\") */\n nameWithOwner: string;\n}\n\n// ---------------------------------------------------------------------------\n// Service interface\n// ---------------------------------------------------------------------------\n\n/**\n * Output port for GitHub repository operations.\n *\n * Implementations use the `gh` CLI for all GitHub interactions.\n */\nexport interface IGitHubRepositoryService {\n /**\n * Verify that the GitHub CLI is authenticated.\n *\n * @throws {GitHubAuthError} if `gh auth status` indicates the user is not logged in\n */\n checkAuth(): Promise<void>;\n\n /**\n * Clone a GitHub repository to a local destination directory.\n *\n * @param nameWithOwner - Full owner/repo identifier (e.g. \"octocat/my-project\")\n * @param destination - Absolute path to clone into\n * @param options - Optional clone configuration (e.g. progress callback)\n * @throws {GitHubCloneError} if the clone subprocess fails\n */\n cloneRepository(\n nameWithOwner: string,\n destination: string,\n options?: CloneOptions\n ): Promise<void>;\n\n /**\n * List the authenticated user's GitHub repositories.\n *\n * @param options - Optional filtering and pagination\n * @returns Array of GitHub repositories sorted by most recently pushed\n * @throws {GitHubRepoListError} if the list operation fails\n */\n listUserRepositories(options?: ListUserRepositoriesOptions): Promise<GitHubRepo[]>;\n\n /**\n * Parse a GitHub URL or shorthand into its owner/repo components.\n *\n * Supported formats:\n * - `https://github.com/owner/repo`\n * - `https://github.com/owner/repo.git`\n * - `git@github.com:owner/repo.git`\n * - `owner/repo` (shorthand)\n *\n * @param url - The GitHub URL or shorthand to parse\n * @returns Parsed owner, repo, and nameWithOwner\n * @throws {GitHubUrlParseError} if the URL does not match any supported format\n */\n parseGitHubUrl(url: string): ParsedGitHubUrl;\n}\n","'use server';\n\nimport { resolve } from '@/lib/server-container';\nimport type { ImportGitHubRepositoryUseCase } from '@shepai/core/application/use-cases/repositories/import-github-repository.use-case';\nimport type { Repository } from '@shepai/core/domain/generated/output';\nimport {\n GitHubAuthError,\n GitHubUrlParseError,\n GitHubCloneError,\n} from '@shepai/core/application/ports/output/services/github-repository-service.interface';\n\ninterface ImportGitHubRepositoryInput {\n url: string;\n dest?: string;\n}\n\nexport async function importGitHubRepository(\n input: ImportGitHubRepositoryInput\n): Promise<{ repository?: Repository; error?: string }> {\n const { url, dest } = input;\n\n if (!url?.trim()) {\n return { error: 'GitHub URL is required' };\n }\n\n try {\n const useCase = resolve<ImportGitHubRepositoryUseCase>('ImportGitHubRepositoryUseCase');\n const repository = await useCase.execute({ url, dest });\n return { repository };\n } catch (error: unknown) {\n if (error instanceof GitHubAuthError) {\n return { error: 'GitHub CLI is not authenticated. Run `gh auth login` to sign in.' };\n }\n if (error instanceof GitHubUrlParseError) {\n return { error: `Invalid GitHub URL: ${error.message}` };\n }\n if (error instanceof GitHubCloneError) {\n return { error: `Clone failed: ${error.message}` };\n }\n const message = error instanceof Error ? error.message : 'Failed to import repository';\n return { error: message };\n }\n}\n","'use server';\n\nimport { existsSync } from 'node:fs';\nimport { resolve } from '@/lib/server-container';\nimport { createDeploymentLogger } from '@shepai/core/infrastructure/services/deployment/deployment-logger';\nimport { computeWorktreePath } from '@shepai/core/infrastructure/services/ide-launchers/compute-worktree-path';\nimport type { IFeatureRepository } from '@shepai/core/application/ports/output/repositories/feature-repository.interface';\nimport type { IDeploymentService } from '@shepai/core/application/ports/output/services/deployment-service.interface';\nimport { DeploymentState } from '@shepai/core/domain/generated/output';\nimport { isSameShepInstance } from '@/lib/is-same-shep-instance';\n\nconst log = createDeploymentLogger('[deployFeature]');\n\nexport async function deployFeature(\n featureId: string\n): Promise<{ success: boolean; error?: string; state?: DeploymentState }> {\n log.info(`called — featureId=\"${featureId}\"`);\n\n if (!featureId?.trim()) {\n log.warn('rejected — featureId is empty');\n return { success: false, error: 'featureId is required' };\n }\n\n try {\n const featureRepo = resolve<IFeatureRepository>('IFeatureRepository');\n const feature = await featureRepo.findById(featureId);\n\n if (!feature) {\n log.warn(`feature not found in repository: \"${featureId}\"`);\n return { success: false, error: `Feature not found: ${featureId}` };\n }\n\n log.info(\n `feature found — repositoryPath=\"${feature.repositoryPath}\", branch=\"${feature.branch}\"`\n );\n\n const worktreePath = computeWorktreePath(feature.repositoryPath, feature.branch);\n log.info(`computed worktreePath=\"${worktreePath}\"`);\n\n if (!existsSync(worktreePath)) {\n log.warn(`worktree path does not exist on disk: \"${worktreePath}\"`);\n return { success: false, error: `Worktree path does not exist: ${worktreePath}` };\n }\n\n if (isSameShepInstance(feature.repositoryPath)) {\n log.warn('rejected — feature belongs to the running shep instance');\n return {\n success: false,\n error: 'Cannot start a dev server for features of the repository Shep is running from',\n };\n }\n\n log.info('worktree path exists, calling deploymentService.start()');\n const deploymentService = resolve<IDeploymentService>('IDeploymentService');\n deploymentService.start(featureId, worktreePath, 'feature');\n\n log.info('start() returned successfully — state=Booting');\n return { success: true, state: DeploymentState.Booting };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to deploy feature';\n log.error(`error: ${message}`, error);\n return { success: false, error: message };\n }\n}\n","/* eslint-disable no-console */\n\n/**\n * Debug-gated logger for deployment services.\n *\n * - `info` and `debug` only emit when `process.env.DEBUG` is set.\n * - `warn` and `error` always emit (they indicate real problems).\n */\n\nconst noop = () => undefined;\n\nexport function createDeploymentLogger(prefix: string) {\n const isDebug = !!process.env.DEBUG;\n\n return {\n info: isDebug ? (...args: unknown[]) => console.info(prefix, ...args) : noop,\n debug: isDebug ? (...args: unknown[]) => console.debug(prefix, ...args) : noop,\n warn: (...args: unknown[]) => console.warn(prefix, ...args),\n error: (...args: unknown[]) => console.error(prefix, ...args),\n };\n}\n","import { realpathSync } from 'node:fs';\nimport { resolve } from 'node:path';\n\n/**\n * Check if a target path is the same directory (or a worktree of) the\n * currently running shep instance. Starting a dev server there would spawn\n * another shep instance that conflicts with the shared ~/.shep/data DB.\n */\nexport function isSameShepInstance(targetPath: string): boolean {\n const instancePath = process.env.NEXT_PUBLIC_SHEP_INSTANCE_PATH ?? process.cwd();\n\n try {\n const normalizedTarget = realpathSync(resolve(targetPath)).replace(/\\\\/g, '/');\n const normalizedInstance = realpathSync(resolve(instancePath)).replace(/\\\\/g, '/');\n return normalizedTarget === normalizedInstance;\n } catch {\n return false;\n }\n}\n","'use server';\n\nimport { existsSync } from 'node:fs';\nimport { isAbsolute } from 'node:path';\nimport { resolve } from '@/lib/server-container';\nimport { createDeploymentLogger } from '@shepai/core/infrastructure/services/deployment/deployment-logger';\nimport type { IDeploymentService } from '@shepai/core/application/ports/output/services/deployment-service.interface';\nimport { DeploymentState } from '@shepai/core/domain/generated/output';\nimport { isSameShepInstance } from '@/lib/is-same-shep-instance';\n\nconst log = createDeploymentLogger('[deployRepository]');\n\nexport async function deployRepository(\n repositoryPath: string\n): Promise<{ success: boolean; error?: string; state?: DeploymentState }> {\n log.info(`called — repositoryPath=\"${repositoryPath}\"`);\n\n if (!repositoryPath || !isAbsolute(repositoryPath)) {\n log.warn('rejected — not an absolute path');\n return { success: false, error: 'repositoryPath must be an absolute path' };\n }\n\n try {\n if (!existsSync(repositoryPath)) {\n log.warn(`directory does not exist: \"${repositoryPath}\"`);\n return { success: false, error: `Directory does not exist: ${repositoryPath}` };\n }\n\n if (isSameShepInstance(repositoryPath)) {\n log.warn('rejected — target is the running shep instance');\n return {\n success: false,\n error: 'Cannot start a dev server for the repository Shep is running from',\n };\n }\n\n log.info('directory exists, calling deploymentService.start()');\n const deploymentService = resolve<IDeploymentService>('IDeploymentService');\n deploymentService.start(repositoryPath, repositoryPath, 'repository');\n\n log.info('start() returned successfully — state=Booting');\n return { success: true, state: DeploymentState.Booting };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to deploy repository';\n log.error(`error: ${message}`, error);\n return { success: false, error: message };\n }\n}\n","'use server';\n\nimport { resolve } from '@/lib/server-container';\nimport type { IDeploymentService } from '@shepai/core/application/ports/output/services/deployment-service.interface';\n\nexport async function stopDeployment(\n targetId: string\n): Promise<{ success: boolean; error?: string }> {\n if (!targetId?.trim()) {\n return { success: false, error: 'targetId is required' };\n }\n\n try {\n const deploymentService = resolve<IDeploymentService>('IDeploymentService');\n await deploymentService.stop(targetId);\n\n return { success: true };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to stop deployment';\n return { success: false, error: message };\n }\n}\n","'use server';\n\nimport { resolve } from '@/lib/server-container';\nimport type {\n IDeploymentService,\n DeploymentStatus,\n} from '@shepai/core/application/ports/output/services/deployment-service.interface';\n\nexport async function getDeploymentStatus(targetId: string): Promise<DeploymentStatus | null> {\n if (!targetId?.trim()) {\n return null;\n }\n\n const deploymentService = resolve<IDeploymentService>('IDeploymentService');\n return deploymentService.getStatus(targetId);\n}\n","'use server';\n\nimport { resolve } from '@/lib/server-container';\nimport type {\n IDeploymentService,\n LogEntry,\n} from '@shepai/core/application/ports/output/services/deployment-service.interface';\n\nexport async function getDeploymentLogs(targetId: string): Promise<LogEntry[] | null> {\n if (!targetId?.trim()) {\n return null;\n }\n\n const deploymentService = resolve<IDeploymentService>('IDeploymentService');\n return deploymentService.getLogs(targetId);\n}\n","'use server';\n\nimport { resolve } from '@/lib/server-container';\nimport { getModelMeta } from '@/lib/model-metadata';\nimport type { IAgentExecutorFactory } from '@shepai/core/application/ports/output/agents/agent-executor-factory.interface';\n\nexport interface ModelInfo {\n id: string;\n displayName: string;\n description: string;\n}\n\nexport interface AgentModelGroup {\n agentType: string;\n label: string;\n models: ModelInfo[];\n}\n\nconst AGENT_LABELS: Record<string, string> = {\n 'claude-code': 'Claude Code',\n cursor: 'Cursor CLI',\n 'gemini-cli': 'Gemini CLI',\n dev: 'Demo',\n};\n\n/** Sort weight — higher = further down. Demo always last. */\nconst AGENT_ORDER: Record<string, number> = {\n 'claude-code': 0,\n cursor: 1,\n 'gemini-cli': 2,\n dev: 99,\n};\n\nexport async function getAllAgentModels(): Promise<AgentModelGroup[]> {\n try {\n const factory = resolve<IAgentExecutorFactory>('IAgentExecutorFactory');\n const agents = factory.getSupportedAgents();\n return agents\n .map((agentType) => ({\n agentType: agentType as string,\n label: AGENT_LABELS[agentType as string] ?? (agentType as string),\n models: factory.getSupportedModels(agentType).map((id) => ({\n id,\n ...getModelMeta(id),\n })),\n }))\n .map((g) => {\n // Dev agent gets fun demo models\n if (g.agentType === 'dev' && g.models.length === 0) {\n return {\n ...g,\n models: [\n { id: 'gpt-8', ...getModelMeta('gpt-8') },\n { id: 'opus-7', ...getModelMeta('opus-7') },\n ],\n };\n }\n return g;\n })\n .filter((g) => g.models.length > 0)\n .sort((a, b) => (AGENT_ORDER[a.agentType] ?? 50) - (AGENT_ORDER[b.agentType] ?? 50));\n } catch {\n return [];\n }\n}\n","export interface ModelMeta {\n displayName: string;\n description: string;\n}\n\n/**\n * Presentation-layer metadata for known LLM model identifiers.\n * Maps raw model IDs to human-friendly display names and short descriptions.\n */\nconst MODEL_METADATA: Record<string, ModelMeta> = {\n // Claude models\n 'claude-opus-4-6': { displayName: 'Opus 4.6', description: 'Most capable, complex tasks' },\n 'claude-sonnet-4-6': { displayName: 'Sonnet 4.6', description: 'Fast & balanced' },\n 'claude-haiku-4-5': { displayName: 'Haiku 4.5', description: 'Lightweight & quick' },\n\n // Gemini models\n 'gemini-3.1-pro': { displayName: 'Gemini 3.1 Pro', description: 'Advanced reasoning' },\n 'gemini-3-flash': { displayName: 'Gemini 3 Flash', description: 'Ultra-fast responses' },\n 'gemini-2.5-pro': { displayName: 'Gemini 2.5 Pro', description: 'Reliable workhorse' },\n 'gemini-2.5-flash': { displayName: 'Gemini 2.5 Flash', description: 'Speed-optimized' },\n\n // OpenAI models\n 'gpt-5.4-high': { displayName: 'GPT-5.4', description: 'Latest reasoning model' },\n 'gpt-5.2': { displayName: 'GPT-5.2', description: 'Flagship model' },\n 'gpt-5.3-codex': { displayName: 'GPT-5.3 Codex', description: 'Code specialist' },\n\n // Other\n 'composer-1.5': { displayName: 'Composer 1.5', description: 'Multi-file editing' },\n 'grok-code': { displayName: 'Grok Code', description: 'xAI code model' },\n\n // Demo / fun models\n 'gpt-8': { displayName: 'GPT-8', description: 'Writes code before you think it' },\n 'opus-7': { displayName: 'Opus 7', description: 'Achieved consciousness, ships on time' },\n};\n\nconst FALLBACK: ModelMeta = { displayName: '', description: '' };\n\nexport function getModelMeta(modelId: string): ModelMeta {\n const meta = MODEL_METADATA[modelId];\n if (meta) return meta;\n // Fallback: prettify the raw ID\n return {\n ...FALLBACK,\n displayName: modelId\n .replace(/^claude-/, '')\n .replace(/^gemini-/, 'Gemini ')\n .replace(/^gpt-/, 'GPT-')\n .replace(/-/g, ' ')\n .replace(/\\b\\w/g, (c) => c.toUpperCase()),\n };\n}\n","'use server';\n\nimport { resolve } from '@/lib/server-container';\nimport {\n resetSettings,\n initializeSettings,\n} from '@shepai/core/infrastructure/services/settings.service';\nimport type { CompleteWebOnboardingUseCase } from '@shepai/core/application/use-cases/settings/complete-web-onboarding.use-case';\nimport type { AgentType } from '@shepai/core/domain/generated/output';\n\nexport async function updateAgentAndModel(\n agentType: string,\n model: string | null\n): Promise<{ ok: boolean; error?: string }> {\n if (!agentType.trim()) {\n return { ok: false, error: 'agent type is required' };\n }\n\n try {\n const useCase = resolve<CompleteWebOnboardingUseCase>('CompleteWebOnboardingUseCase');\n const updatedSettings = await useCase.execute({\n agentType: agentType.trim() as AgentType,\n model,\n });\n\n resetSettings();\n initializeSettings(updatedSettings);\n\n return { ok: true };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to update agent and model';\n return { ok: false, error: message };\n }\n}\n","'use server';\n\nimport { getSettings } from '@shepai/core/infrastructure/services/settings.service';\n\nexport interface WorkflowDefaults {\n approvalGates: {\n allowPrd: boolean;\n allowPlan: boolean;\n allowMerge: boolean;\n };\n push: boolean;\n openPr: boolean;\n ciWatchEnabled: boolean;\n enableEvidence: boolean;\n commitEvidence: boolean;\n}\n\nexport async function getWorkflowDefaults(): Promise<WorkflowDefaults> {\n const settings = getSettings();\n const { workflow } = settings;\n\n return {\n approvalGates: {\n allowPrd: workflow.approvalGateDefaults.allowPrd,\n allowPlan: workflow.approvalGateDefaults.allowPlan,\n allowMerge: workflow.approvalGateDefaults.allowMerge,\n },\n push: workflow.approvalGateDefaults.pushOnImplementationComplete,\n openPr: workflow.openPrOnImplementationComplete,\n ciWatchEnabled: workflow.ciWatchEnabled,\n enableEvidence: workflow.enableEvidence,\n commitEvidence: workflow.commitEvidence,\n };\n}\n","'use server';\n\nimport { resolve } from '@/lib/server-container';\nimport type { CreateFeatureUseCase } from '@shepai/core/application/use-cases/features/create/create-feature.use-case';\nimport type { Feature } from '@shepai/core/domain/generated/output';\nimport { composeUserInput } from './compose-user-input';\n\ninterface Attachment {\n path: string;\n name: string;\n notes?: string;\n}\n\ninterface ApprovalGates {\n allowPrd: boolean;\n allowPlan: boolean;\n allowMerge: boolean;\n}\n\ninterface CreateFeatureInput {\n description: string;\n repositoryPath: string;\n attachments?: Attachment[];\n sessionId?: string;\n approvalGates?: {\n allowPrd: boolean;\n allowPlan: boolean;\n allowMerge?: boolean;\n };\n push?: boolean;\n openPr?: boolean;\n parentId?: string;\n /** When true, skip SDLC phases and implement directly from the prompt. */\n fast?: boolean;\n /** When true, create the feature in pending state (no agent spawned). */\n pending?: boolean;\n /** Fork repo and create PR to upstream at merge time. */\n forkAndPr?: boolean;\n /** Commit specs/evidences into the repo (default: true, auto-false when forkAndPr). */\n commitSpecs?: boolean;\n /** Enable CI watch/fix loop after push. */\n ciWatchEnabled?: boolean;\n /** Enable evidence collection after implementation. */\n enableEvidence?: boolean;\n /** Commit evidence to PR. */\n commitEvidence?: boolean;\n /** Optional agent type override for this feature run */\n agentType?: string;\n /** Optional model identifier for this feature run */\n model?: string;\n}\n\nexport async function createFeature(\n input: CreateFeatureInput\n): Promise<{ feature?: Feature; error?: string }> {\n const {\n description,\n repositoryPath,\n attachments,\n sessionId,\n approvalGates,\n push,\n openPr,\n parentId,\n fast,\n pending,\n forkAndPr,\n commitSpecs,\n ciWatchEnabled,\n enableEvidence,\n commitEvidence,\n agentType,\n model,\n } = input;\n\n if (!description?.trim()) {\n return { error: 'description is required' };\n }\n\n if (!repositoryPath?.trim()) {\n return { error: 'repositoryPath is required' };\n }\n\n const userInput = composeUserInput(description, attachments);\n const gates: ApprovalGates = {\n allowPrd: approvalGates?.allowPrd ?? false,\n allowPlan: approvalGates?.allowPlan ?? false,\n allowMerge: approvalGates?.allowMerge ?? false,\n };\n\n try {\n const createFeatureUseCase = resolve<CreateFeatureUseCase>('CreateFeatureUseCase');\n\n // Phase 1 (fast): create DB record with real UUID — returns immediately\n const { feature, shouldSpawn } = await createFeatureUseCase.createRecord({\n userInput,\n repositoryPath,\n approvalGates: gates,\n push: push ?? false,\n openPr: openPr ?? false,\n ...(parentId ? { parentId } : {}),\n description,\n ...(fast ? { fast } : {}),\n ...(pending ? { pending } : {}),\n ...(forkAndPr != null ? { forkAndPr } : {}),\n ...(commitSpecs != null ? { commitSpecs } : {}),\n ...(ciWatchEnabled != null ? { ciWatchEnabled } : {}),\n ...(enableEvidence != null ? { enableEvidence } : {}),\n ...(commitEvidence != null ? { commitEvidence } : {}),\n ...(agentType ? { agentType } : {}),\n ...(model ? { model } : {}),\n });\n\n // Phase 2 (background): metadata generation, worktree, spec, agent spawn\n // Fire-and-forget — the UI gets the real feature ID immediately\n createFeatureUseCase\n .initializeAndSpawn(\n feature,\n {\n userInput,\n repositoryPath,\n approvalGates: gates,\n push: push ?? false,\n openPr: openPr ?? false,\n ...(parentId ? { parentId } : {}),\n ...(fast ? { fast } : {}),\n ...(pending ? { pending } : {}),\n ...(forkAndPr != null ? { forkAndPr } : {}),\n ...(commitSpecs != null ? { commitSpecs } : {}),\n ...(agentType ? { agentType } : {}),\n ...(model ? { model } : {}),\n ...(sessionId ? { sessionId } : {}),\n },\n shouldSpawn\n )\n .catch((err: unknown) => {\n // eslint-disable-next-line no-console\n console.error('[createFeature] initializeAndSpawn failed:', err);\n });\n\n return { feature };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to create feature';\n return { error: message };\n }\n}\n","interface Attachment {\n path: string;\n name: string;\n notes?: string;\n}\n\nexport function composeUserInput(\n description: string,\n attachments: Attachment[] | undefined\n): string {\n if (!attachments || attachments.length === 0) {\n return description;\n }\n\n const refs = attachments\n .map((a) => (a.notes?.trim() ? `@${a.path} [Note: ${a.notes.trim()}]` : `@${a.path}`))\n .join(' ');\n return `${description}\\n\\n${refs}`;\n}\n","export {pickFolder as '00a1702c5497ab545cc26952633ca87f147c7ceb62'} from 'ACTIONS_MODULE0'\nexport {listGitHubRepositories as '40c7fdb3d95e595436383d5eadb40d2bf6bce47bdb'} from 'ACTIONS_MODULE1'\nexport {importGitHubRepository as '40d8777d24cfa24beb80ea752e2a2027e66cf2dbd9'} from 'ACTIONS_MODULE2'\nexport {deployFeature as '405a4a70fdc3a3cb7c981360bcec49a022cdf8198f'} from 'ACTIONS_MODULE3'\nexport {deployRepository as '40c847f4ffe0a158570dc5ed2d22d8451b68796adf'} from 'ACTIONS_MODULE4'\nexport {stopDeployment as '408d59d801fa02fda87d32465f4d0b0f44a7d0e6b3'} from 'ACTIONS_MODULE5'\nexport {getDeploymentStatus as '409870ee3cc282f696a558ce6dfd0eca5fb302a0c2'} from 'ACTIONS_MODULE6'\nexport {openIde as '4063780e02948547c3134ab1406acd54955721a262'} from 'ACTIONS_MODULE7'\nexport {openShell as '40d5c96f95df6d2411c8e540b9c93ed57c0100cf69'} from 'ACTIONS_MODULE8'\nexport {openFolder as '40c052181d02dd8dd5d4c796ab7f7ea458eab5722e'} from 'ACTIONS_MODULE9'\nexport {syncRepository as '408cdf6e2fd4975d7b8a17ace5526d80cfe21edefe'} from 'ACTIONS_MODULE10'\nexport {getDeploymentLogs as '40e0d54712f66867e642b534b6b8af4a706eba8468'} from 'ACTIONS_MODULE11'\nexport {isAgentSetupComplete as '007fdf65f3e7f35c5393f6c399f8537da6f2e699e3'} from 'ACTIONS_MODULE12'\nexport {checkAgentAuth as '00471a2eae954710269653932b3c791a3399bc26db'} from 'ACTIONS_MODULE13'\nexport {checkToolStatus as '008639d6b465e33498dd04219d4fe7b5996fbc3cbb'} from 'ACTIONS_MODULE14'\nexport {getAllAgentModels as '007e9b74bf9ae67d99881beff65868dbc1685b13e2'} from 'ACTIONS_MODULE15'\nexport {updateAgentAndModel as '60124454584b1b2bdf2a30a9e4ad153d18a7b0483e'} from 'ACTIONS_MODULE16'\nexport {archiveFeature as '4084351e57290b145f7ca941e2f61b3932d10c261f'} from 'ACTIONS_MODULE17'\nexport {deleteFeature as '78d20c6a0d2019f5afdf16c2b6a22320c9223fb17c'} from 'ACTIONS_MODULE18'\nexport {resumeFeature as '402210d2877cc7f641e74a88d9da4202ae7990c913'} from 'ACTIONS_MODULE19'\nexport {startFeature as '408eebbff96dc907014dc61672481ad3d4cd29f86a'} from 'ACTIONS_MODULE20'\nexport {stopFeature as '40384170d2dc6a10665ef518999052b039b1410f15'} from 'ACTIONS_MODULE21'\nexport {unarchiveFeature as '40ed36299a7712620e96dec2662e31fc49c454a0ab'} from 'ACTIONS_MODULE22'\nexport {addRepository as '409ee2e39090c95feac24f0ec4c3ce75491e842e34'} from 'ACTIONS_MODULE23'\nexport {deleteRepository as '4085686561bb145b7adcfe573c948004edc8ceea2e'} from 'ACTIONS_MODULE24'\nexport {getFeatureMetadata as '4087fed787899614c9661603d12013407f23b1581a'} from 'ACTIONS_MODULE25'\nexport {getWorkflowDefaults as '00d6d59d5b4e4d02ad1c25b58452525e47cc8959a6'} from 'ACTIONS_MODULE26'\nexport {createFeature as '4010123ef92f8caeef071e18cdd49329a5b4c08371'} from 'ACTIONS_MODULE27'\n"],"names":["registerServerReference","ensureServerEntryExports","actions","i","length","action","Error"],"mappings":"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","ignoreList":[0,1]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,17840,e=>{"use strict";var t=e.i(79054),r=e.i(31406),n=e.i(60112),a=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),o=a((e,t)=>{var r=Object.defineProperty,n=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),a=(e,t,n)=>{let a;return(a="symbol"!=typeof t?t+"":t)in e?r(e,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[a]=n},o=n((e,t)=>{function r(e,t){e[t]?e[t]++:e[t]=1}function n(e,t){--e[t]||delete e[t]}function o(e,t,r,n){var a=""+t,o=""+r;if(!e&&a>o){var s=a;a=o,o=s}return a+"\x01"+o+"\x01"+(void 0===n?"\0":n)}function s(e,t){return o(e,t.v,t.w,t.name)}t.exports=class{constructor(e){a(this,"_isDirected",!0),a(this,"_isMultigraph",!1),a(this,"_isCompound",!1),a(this,"_label"),a(this,"_defaultNodeLabelFn",()=>{}),a(this,"_defaultEdgeLabelFn",()=>{}),a(this,"_nodes",{}),a(this,"_in",{}),a(this,"_preds",{}),a(this,"_out",{}),a(this,"_sucs",{}),a(this,"_edgeObjs",{}),a(this,"_edgeLabels",{}),a(this,"_nodeCount",0),a(this,"_edgeCount",0),a(this,"_parent"),a(this,"_children"),e&&(this._isDirected=!Object.hasOwn(e,"directed")||e.directed,this._isMultigraph=!!Object.hasOwn(e,"multigraph")&&e.multigraph,this._isCompound=!!Object.hasOwn(e,"compound")&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,"function"!=typeof e&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>0===Object.keys(e._in[t]).length)}sinks(){var e=this;return this.nodes().filter(t=>0===Object.keys(e._out[t]).length)}setNodes(e,t){var r=arguments,n=this;return e.forEach(function(e){r.length>1?n.setNode(e,t):n.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?arguments.length>1&&(this._nodes[e]=t):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount),this}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var r=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(r),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error("Cannot set parent in a non-compound graph");if(void 0===t)t="\0";else{t+="";for(var r=t;void 0!==r;r=this.parent(r))if(r===e)throw Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if("\0"!==t)return t}}children(e="\0"){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else{if("\0"===e)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let n=new Set(t);for(var r of this.successors(e))n.add(r);return Array.from(n.values())}}isLeaf(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;Object.entries(this._nodes).forEach(function([r,n]){e(r)&&t.setNode(r,n)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))});var n={};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,function e(a){var o=r.parent(a);return void 0===o||t.hasNode(o)?(n[a]=o,o):o in n?n[o]:e(o)}(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,"function"!=typeof e&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var r=this,n=arguments;return e.reduce(function(e,a){return n.length>1?r.setEdge(e,a,t):r.setEdge(e,a),a}),this}setEdge(){var e,t,n,a,s=!1,i=arguments[0];"object"==typeof i&&null!==i&&"v"in i?(e=i.v,t=i.w,n=i.name,2==arguments.length&&(a=arguments[1],s=!0)):(e=i,t=arguments[1],n=arguments[3],arguments.length>2&&(a=arguments[2],s=!0)),e=""+e,t=""+t,void 0!==n&&(n=""+n);var l=o(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,l))return s&&(this._edgeLabels[l]=a),this;if(void 0!==n&&!this._isMultigraph)throw Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[l]=s?a:this._defaultEdgeLabelFn(e,t,n);var d=function(e,t,r,n){var a=""+t,o=""+r;if(!e&&a>o){var s=a;a=o,o=s}var i={v:a,w:o};return n&&(i.name=n),i}(this._isDirected,e,t,n);return e=d.v,t=d.w,Object.freeze(d),this._edgeObjs[l]=d,r(this._preds[t],e),r(this._sucs[e],t),this._in[t][l]=d,this._out[e][l]=d,this._edgeCount++,this}edge(e,t,r){var n=1==arguments.length?s(this._isDirected,arguments[0]):o(this._isDirected,e,t,r);return this._edgeLabels[n]}edgeAsObj(){let e=this.edge(...arguments);return"object"!=typeof e?{label:e}:e}hasEdge(e,t,r){var n=1==arguments.length?s(this._isDirected,arguments[0]):o(this._isDirected,e,t,r);return Object.hasOwn(this._edgeLabels,n)}removeEdge(e,t,r){var a=1==arguments.length?s(this._isDirected,arguments[0]):o(this._isDirected,e,t,r),i=this._edgeObjs[a];return i&&(e=i.v,t=i.w,delete this._edgeLabels[a],delete this._edgeObjs[a],n(this._preds[t],e),n(this._sucs[e],t),delete this._in[t][a],delete this._out[e][a],this._edgeCount--),this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}filterEdges(e,t,r){if(e){var n=Object.values(e);return r?n.filter(function(e){return e.v===t&&e.w===r||e.v===r&&e.w===t}):n}}}}),s=n((e,t)=>{t.exports="3.0.2"}),i=n((e,t)=>{t.exports={Graph:o(),version:s()}}),l=n((e,t)=>{var r=o();t.exports={write:function(e){var t,r,n={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:(t=e).nodes().map(function(e){var r=t.node(e),n=t.parent(e),a={v:e};return void 0!==r&&(a.value=r),void 0!==n&&(a.parent=n),a}),edges:(r=e).edges().map(function(e){var t=r.edge(e),n={v:e.v,w:e.w};return void 0!==e.name&&(n.name=e.name),void 0!==t&&(n.value=t),n})};return void 0!==e.graph()&&(n.value=structuredClone(e.graph())),n},read:function(e){var t=new r(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}}}),d=n((e,t)=>{t.exports=function(e,t,n,a){return function(e,t,r,n){var a={},o=!0,s=0,i=e.nodes(),l=function(e){var t=r(e);a[e.v].distance+t<a[e.w].distance&&(a[e.w]={distance:a[e.v].distance+t,predecessor:e.v},o=!0)},d=function(){i.forEach(function(e){n(e).forEach(function(t){var r=t.v===e?t.v:t.w,n=r===t.v?t.w:t.v;l({v:r,w:n})})})};i.forEach(function(e){a[e]={distance:e===t?0:1/0}});for(var c=i.length,u=1;u<c&&(o=!1,s++,d(),o);u++);if(s===c-1&&(o=!1,d(),o))throw Error("The graph contains a negative weight cycle");return a}(e,String(t),n||r,a||function(t){return e.outEdges(t)})};var r=()=>1}),c=n((e,t)=>{t.exports=function(e){var t,r={},n=[];return e.nodes().forEach(function(a){t=[],function n(a){Object.hasOwn(r,a)||(r[a]=!0,t.push(a),e.successors(a).forEach(n),e.predecessors(a).forEach(n))}(a),t.length&&n.push(t)}),n}}),u=n((e,t)=>{t.exports=class{constructor(){a(this,"_arr",[]),a(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority}min(){if(0===this.size())throw Error("Queue underflow");return this._arr[0].key}add(e,t){var r=this._keyIndices;if(!Object.hasOwn(r,e=String(e))){var n=this._arr,a=n.length;return r[e]=a,n.push({key:e,priority:t}),this._decrease(a),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var r=this._keyIndices[e];if(t>this._arr[r].priority)throw Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[r].priority+" New: "+t);this._arr[r].priority=t,this._decrease(r)}_heapify(e){var t=this._arr,r=2*e,n=r+1,a=e;r<t.length&&(a=t[r].priority<t[a].priority?r:a,n<t.length&&(a=t[n].priority<t[a].priority?n:a),a!==e&&(this._swap(e,a),this._heapify(a)))}_decrease(e){for(var t,r=this._arr,n=r[e].priority;0!==e&&!(r[t=e>>1].priority<n);)this._swap(e,t),e=t}_swap(e,t){var r=this._arr,n=this._keyIndices,a=r[e],o=r[t];r[e]=o,r[t]=a,n[o.key]=e,n[a.key]=t}}}),h=n((e,t)=>{var r=u();t.exports=function(e,t,a,o){return function(e,t,n,a){var o,s,i={},l=new r,d=function(e){var t=e.v!==o?e.v:e.w,r=i[t],a=n(e),d=s.distance+a;if(a<0)throw Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+a);d<r.distance&&(r.distance=d,r.predecessor=o,l.decrease(t,d))};for(e.nodes().forEach(function(e){var r=e===t?0:1/0;i[e]={distance:r},l.add(e,r)});l.size()>0&&(s=i[o=l.removeMin()]).distance!==1/0;)a(o).forEach(d);return i}(e,String(t),a||n,o||function(t){return e.outEdges(t)})};var n=()=>1}),f=n((e,t)=>{var r=h();t.exports=function(e,t,n){return e.nodes().reduce(function(a,o){return a[o]=r(e,o,t,n),a},{})}}),p=n((e,t)=>{t.exports=function(e,t,r){if(void 0!==e[t].predecessor)throw Error("Invalid source vertex");if(void 0===e[r].predecessor&&r!==t)throw Error("Invalid destination vertex");return{weight:e[r].distance,path:function(e,t,r){for(var n=[],a=r;a!==t;)n.push(a),a=e[a].predecessor;return n.push(t),n.reverse()}(e,t,r)}}}),g=n((e,t)=>{t.exports=function(e){var t=0,r=[],n={},a=[];return e.nodes().forEach(function(o){Object.hasOwn(n,o)||function o(s){var i=n[s]={onStack:!0,lowlink:t,index:t++};if(r.push(s),e.successors(s).forEach(function(e){Object.hasOwn(n,e)?n[e].onStack&&(i.lowlink=Math.min(i.lowlink,n[e].index)):(o(e),i.lowlink=Math.min(i.lowlink,n[e].lowlink))}),i.lowlink===i.index){var l,d=[];do n[l=r.pop()].onStack=!1,d.push(l);while(s!==l)a.push(d)}}(o)}),a}}),m=n((e,t)=>{var r=g();t.exports=function(e){return r(e).filter(function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])})}}),x=n((e,t)=>{t.exports=function(e,t,n){var a,o,s,i,l;return a=e,o=t||r,s=n||function(t){return e.outEdges(t)},i={},(l=a.nodes()).forEach(function(e){i[e]={},i[e][e]={distance:0},l.forEach(function(t){e!==t&&(i[e][t]={distance:1/0})}),s(e).forEach(function(t){var r=t.v===e?t.w:t.v,n=o(t);i[e][r]={distance:n,predecessor:e}})}),l.forEach(function(e){var t=i[e];l.forEach(function(r){var n=i[r];l.forEach(function(r){var a=n[e],o=t[r],s=n[r],i=a.distance+o.distance;i<s.distance&&(s.distance=i,s.predecessor=o.predecessor)})})}),i};var r=()=>1}),v=n((e,t)=>{function r(e){var t={},r={},a=[];if(e.sinks().forEach(function o(s){if(Object.hasOwn(r,s))throw new n;Object.hasOwn(t,s)||(r[s]=!0,t[s]=!0,e.predecessors(s).forEach(o),delete r[s],a.push(s))}),Object.keys(t).length!==e.nodeCount())throw new n;return a}var n=class extends Error{constructor(){super(...arguments)}};t.exports=r,r.CycleException=n}),b=n((e,t)=>{var r=v();t.exports=function(e){try{r(e)}catch(e){if(e instanceof r.CycleException)return!1;throw e}return!0}}),y=n((e,t)=>{t.exports=function(e,t,r,n,a){Array.isArray(t)||(t=[t]);var o=(e.isDirected()?e.successors:e.neighbors).bind(e),s={};return t.forEach(function(t){if(!e.hasNode(t))throw Error("Graph does not have node: "+t);a=function e(t,r,n,a,o,s,i){return Object.hasOwn(a,r)||(a[r]=!0,n||(i=s(i,r)),o(r).forEach(function(r){i=e(t,r,n,a,o,s,i)}),n&&(i=s(i,r))),i}(e,t,"post"===r,s,o,n,a)}),a}}),w=n((e,t)=>{var r=y();t.exports=function(e,t,n){return r(e,t,n,function(e,t){return e.push(t),e},[])}}),k=n((e,t)=>{var r=w();t.exports=function(e,t){return r(e,t,"post")}}),j=n((e,t)=>{var r=w();t.exports=function(e,t){return r(e,t,"pre")}}),E=n((e,t)=>{var r=o(),n=u();t.exports=function(e,t){var a,o=new r,s={},i=new n;function l(e){var r=e.v===a?e.w:e.v,n=i.priority(r);if(void 0!==n){var o=t(e);o<n&&(s[r]=a,i.decrease(r,o))}}if(0===e.nodeCount())return o;e.nodes().forEach(function(e){i.add(e,1/0),o.setNode(e)}),i.decrease(e.nodes()[0],0);for(var d=!1;i.size()>0;){if(Object.hasOwn(s,a=i.removeMin()))o.setEdge(a,s[a]);else{if(d)throw Error("Input graph is not connected: "+e);d=!0}e.nodeEdges(a).forEach(l)}return o}}),N=n((e,t)=>{var r=h(),n=d();t.exports=function(e,t,a,o){return function(e,t,a,o){if(void 0===a)return r(e,t,a,o);for(var s=!1,i=e.nodes(),l=0;l<i.length;l++){for(var d=o(i[l]),c=0;c<d.length;c++){var u=d[c],h=u.v===i[l]?u.v:u.w,f=h===u.v?u.w:u.v;0>a({v:h,w:f})&&(s=!0)}if(s)return n(e,t,a,o)}return r(e,t,a,o)}(e,t,a,o||function(t){return e.outEdges(t)})}}),C=n((e,t)=>{t.exports={bellmanFord:d(),components:c(),dijkstra:h(),dijkstraAll:f(),extractPath:p(),findCycles:m(),floydWarshall:x(),isAcyclic:b(),postorder:k(),preorder:j(),prim:E(),shortestPaths:N(),reduce:y(),tarjan:g(),topsort:v()}}),_=i();t.exports={Graph:_.Graph,json:l(),alg:C(),version:_.version}}),s=a((e,t)=>{function r(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function n(e,t){if("_next"!==e&&"_prev"!==e)return t}t.exports=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return r(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&r(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,r=t._prev;for(;r!==t;)e.push(JSON.stringify(r,n)),r=r._prev;return"["+e.join(", ")+"]"}}}),i=a((e,t)=>{var r=o().Graph,n=s();t.exports=function(e,t){var o,s;let d,c,u,h,f;if(1>=e.nodeCount())return[];let p=(o=e,s=t||a,d=new r,c=0,u=0,o.nodes().forEach(e=>{d.setNode(e,{v:e,in:0,out:0})}),o.edges().forEach(e=>{let t=d.edge(e.v,e.w)||0,r=s(e);d.setEdge(e.v,e.w,t+r),u=Math.max(u,d.node(e.v).out+=r),c=Math.max(c,d.node(e.w).in+=r)}),h=(function(e){let t=[];for(let r=0;r<e;r++)t.push(r);return t})(u+c+3).map(()=>new n),f=c+1,d.nodes().forEach(e=>{l(h,f,d.node(e))}),{graph:d,buckets:h,zeroIdx:f});return(function(e,t,r){let n=[],a=t[t.length-1],o=t[0],s;for(;e.nodeCount();){for(;s=o.dequeue();)i(e,t,r,s);for(;s=a.dequeue();)i(e,t,r,s);if(e.nodeCount()){for(let a=t.length-2;a>0;--a)if(s=t[a].dequeue()){n=n.concat(i(e,t,r,s,!0));break}}}return n})(p.graph,p.buckets,p.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))};var a=()=>1;function i(e,t,r,n,a){let o=a?[]:void 0;return e.inEdges(n.v).forEach(n=>{let s=e.edge(n),i=e.node(n.v);a&&o.push({v:n.v,w:n.w}),i.out-=s,l(t,r,i)}),e.outEdges(n.v).forEach(n=>{let a=e.edge(n),o=n.w,s=e.node(o);s.in-=a,l(t,r,s)}),e.removeNode(n.v),o}function l(e,t,r){r.out?r.in?e[r.out-r.in+t].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}}),l=a((e,t)=>{var r=o().Graph;function n(e,t,r,n){for(var a=n;e.hasNode(a);)a=l(n);return r.dummy=t,e.setNode(a,r),a}t.exports={addBorderNode:function(e,t,r,a){let o={width:0,height:0};return arguments.length>=4&&(o.rank=r,o.order=a),n(e,"border",o,t)},addDummyNode:n,applyWithChunking:a,asNonCompoundGraph:function(e){let t=new r({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(r=>{e.children(r).length||t.setNode(r,e.node(r))}),e.edges().forEach(r=>{t.setEdge(r,e.edge(r))}),t},buildLayerMatrix:function(e){let t=d(s(e)+1).map(()=>[]);return e.nodes().forEach(r=>{let n=e.node(r),a=n.rank;void 0!==a&&(t[a][n.order]=r)}),t},intersectRect:function(e,t){let r,n,a=e.x,o=e.y,s=t.x-a,i=t.y-o,l=e.width/2,d=e.height/2;if(!s&&!i)throw Error("Not possible to find intersection inside of the rectangle");return Math.abs(i)*l>Math.abs(s)*d?(i<0&&(d=-d),r=d*s/i,n=d):(s<0&&(l=-l),r=l,n=l*i/s),{x:a+r,y:o+n}},mapValues:function(e,t){let r=t;return"string"==typeof t&&(r=e=>e[t]),Object.entries(e).reduce((e,[t,n])=>(e[t]=r(n,t),e),{})},maxRank:s,normalizeRanks:function(e){let t=a(Math.min,e.nodes().map(t=>{let r=e.node(t).rank;return void 0===r?Number.MAX_VALUE:r}));e.nodes().forEach(r=>{let n=e.node(r);Object.hasOwn(n,"rank")&&(n.rank-=t)})},notime:function(e,t){return t()},partition:function(e,t){let r={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?r.lhs.push(e):r.rhs.push(e)}),r},pick:function(e,t){let r={};for(let n of t)void 0!==e[n]&&(r[n]=e[n]);return r},predecessorWeights:function(e){let t=e.nodes().map(t=>{let r={};return e.inEdges(t).forEach(t=>{r[t.v]=(r[t.v]||0)+e.edge(t).weight}),r});return c(e.nodes(),t)},range:d,removeEmptyRanks:function(e){let t=a(Math.min,e.nodes().map(t=>e.node(t).rank).filter(e=>void 0!==e)),r=[];e.nodes().forEach(n=>{let a=e.node(n).rank-t;r[a]||(r[a]=[]),r[a].push(n)});let n=0,o=e.graph().nodeRankFactor;Array.from(r).forEach((t,r)=>{void 0===t&&r%o!=0?--n:void 0!==t&&n&&t.forEach(t=>e.node(t).rank+=n)})},simplify:function(e){let t=new r().setGraph(e.graph());return e.nodes().forEach(r=>t.setNode(r,e.node(r))),e.edges().forEach(r=>{let n=t.edge(r.v,r.w)||{weight:0,minlen:1},a=e.edge(r);t.setEdge(r.v,r.w,{weight:n.weight+a.weight,minlen:Math.max(n.minlen,a.minlen)})}),t},successorWeights:function(e){let t=e.nodes().map(t=>{let r={};return e.outEdges(t).forEach(t=>{r[t.w]=(r[t.w]||0)+e.edge(t).weight}),r});return c(e.nodes(),t)},time:function(e,t){let r=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-r)+"ms")}},uniqueId:l,zipObject:c};function a(e,t){if(!(t.length>65535))return e.apply(null,t);{let r=function(e,t=65535){let r=[];for(let n=0;n<e.length;n+=t){let a=e.slice(n,n+t);r.push(a)}return r}(t);return e.apply(null,r.map(t=>e.apply(null,t)))}}function s(e){return a(Math.max,e.nodes().map(t=>{let r=e.node(t).rank;return void 0===r?5e-324:r}))}var i=0;function l(e){return e+""+ ++i}function d(e,t,r=1){null==t&&(t=e,e=0);let n=e=>e<t;r<0&&(n=e=>t<e);let a=[];for(let t=e;n(t);t+=r)a.push(t);return a}function c(e,t){return e.reduce((e,r,n)=>(e[r]=t[n],e),{})}}),d=a((e,t)=>{var r=i(),n=l().uniqueId;t.exports={run:function(e){var t,a;let o,s,i;("greedy"===e.graph().acyclicer?r(e,(t=e,e=>t.edge(e).weight)):(o=[],s={},i={},(a=e).nodes().forEach(function e(t){Object.hasOwn(i,t)||(i[t]=!0,s[t]=!0,a.outEdges(t).forEach(t=>{Object.hasOwn(s,t.w)?o.push(t):e(t.w)}),delete s[t])}),o)).forEach(t=>{let r=e.edge(t);e.removeEdge(t),r.forwardName=t.name,r.reversed=!0,e.setEdge(t.w,t.v,r,n("rev"))})},undo:function(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.reversed){e.removeEdge(t);let n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})}}}),c=a((e,t)=>{var r=l();t.exports={run:function(e){e.graph().dummyChains=[],e.edges().forEach(t=>(function(e,t){let n,a,o,s=t.v,i=e.node(s).rank,l=t.w,d=e.node(l).rank,c=t.name,u=e.edge(t),h=u.labelRank;if(d!==i+1){for(e.removeEdge(t),o=0,++i;i<d;++o,++i)u.points=[],a={width:0,height:0,edgeLabel:u,edgeObj:t,rank:i},n=r.addDummyNode(e,"edge",a,"_d"),i===h&&(a.width=u.width,a.height=u.height,a.dummy="edge-label",a.labelpos=u.labelpos),e.setEdge(s,n,{weight:u.weight},c),0===o&&e.graph().dummyChains.push(n),s=n;e.setEdge(s,l,{weight:u.weight},c)}})(e,t))},undo:function(e){e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeLabel,a;for(e.setEdge(r.edgeObj,n);r.dummy;)a=e.successors(t)[0],e.removeNode(t),n.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height),t=a,r=e.node(t)})}}}),u=a((e,t)=>{var{applyWithChunking:r}=l();t.exports={longestPath:function(e){var t={};e.sources().forEach(function n(a){var o=e.node(a);if(Object.hasOwn(t,a))return o.rank;t[a]=!0;var s=r(Math.min,e.outEdges(a).map(t=>null==t?1/0:n(t.w)-e.edge(t).minlen));return s===1/0&&(s=0),o.rank=s})},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}}}),h=a((e,t)=>{var r=o().Graph,n=u().slack;t.exports=function(e){var t,a,o,s,i=new r({directed:!1}),l=e.nodes()[0],d=e.nodeCount();for(i.setNode(l,{});t=i,a=e,t.nodes().forEach(function e(r){a.nodeEdges(r).forEach(o=>{var s=o.v,i=r===s?o.w:s;t.hasNode(i)||n(a,o)||(t.setNode(i,{}),t.setEdge(r,i,{}),e(i))})}),t.nodeCount()<d;)o=function(e,t){return t.edges().reduce((r,a)=>{let o=1/0;return e.hasNode(a.v)!==e.hasNode(a.w)&&(o=n(t,a)),o<r[0]?[o,a]:r},[1/0,null])[1]}(i,e),s=i.hasNode(o.v)?n(e,o):-n(e,o),function(e,t,r){e.nodes().forEach(e=>t.node(e).rank+=r)}(i,e,s);return i}}),f=a((e,t)=>{var r=h(),n=u().slack,a=u().longestPath,s=o().alg.preorder,i=o().alg.postorder,d=l().simplify;function c(e){a(e=d(e));var t,n,o=r(e);for(g(o),f(o,e);t=m(o);)n=x(o,e,t),v(o,e,t,n)}function f(e,t){var r=i(e,e.nodes());(r=r.slice(0,r.length-1)).forEach(r=>{var n,a,o,s;return n=e,a=t,o=r,s=n.node(o).parent,void(n.edge(o,s).cutvalue=p(n,a,o))})}function p(e,t,r){var n=e.node(r).parent,a=!0,o=t.edge(r,n),s=0;return o||(a=!1,o=t.edge(n,r)),s=o.weight,t.nodeEdges(r).forEach(o=>{var i=o.v===r,l=i?o.w:o.v;if(l!==n){var d,c,u,h=i===a,f=t.edge(o).weight;if(s+=h?f:-f,d=e,c=r,u=l,d.hasEdge(c,u)){var p=e.edge(r,l).cutvalue;s+=h?-p:p}}}),s}function g(e,t){arguments.length<2&&(t=e.nodes()[0]),function e(t,r,n,a,o){var s=n,i=t.node(a);return r[a]=!0,t.neighbors(a).forEach(o=>{Object.hasOwn(r,o)||(n=e(t,r,n,o,a))}),i.low=s,i.lim=n++,o?i.parent=o:delete i.parent,n}(e,{},1,t)}function m(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function x(e,t,r){var a=r.v,o=r.w;t.hasEdge(a,o)||(a=r.w,o=r.v);var s=e.node(a),i=e.node(o),l=s,d=!1;return s.lim>i.lim&&(l=i,d=!0),t.edges().filter(t=>d===b(e,e.node(t.v),l)&&d!==b(e,e.node(t.w),l)).reduce((e,r)=>n(t,r)<n(t,e)?r:e)}function v(e,t,r,n){var a,o,i,l,d=r.v,c=r.w;e.removeEdge(d,c),e.setEdge(n.v,n.w,{}),g(e),f(e,t),a=e,o=t,i=a.nodes().find(e=>!o.node(e).parent),(l=(l=s(a,i)).slice(1)).forEach(e=>{var t=a.node(e).parent,r=o.edge(e,t),n=!1;r||(r=o.edge(t,e),n=!0),o.node(e).rank=o.node(t).rank+(n?r.minlen:-r.minlen)})}function b(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}t.exports=c,c.initLowLimValues=g,c.initCutValues=f,c.calcCutValue=p,c.leaveEdge=m,c.enterEdge=x,c.exchangeEdges=v}),p=a((e,t)=>{var r=u().longestPath,n=h(),a=f();t.exports=function(e){var t,s=e.graph().ranker;if(s instanceof Function)return s(e);switch(e.graph().ranker){case"network-simplex":default:a(e);break;case"tight-tree":r(t=e),n(t);break;case"longest-path":o(e);case"none":}};var o=r}),g=a((e,t)=>{t.exports=function(e){var t;let r,n,a=(r={},n=0,(t=e).children().forEach(function e(a){let o=n;t.children(a).forEach(e),r[a]={low:o,lim:n++}}),r);e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeObj,o=function(e,t,r,n){let a=[],o=[],s=Math.min(t[r].low,t[n].low),i=Math.max(t[r].lim,t[n].lim),l,d;l=r;do a.push(l=e.parent(l));while(l&&(t[l].low>s||i>t[l].lim))for(d=l,l=n;(l=e.parent(l))!==d;)o.push(l);return{path:a.concat(o.reverse()),lca:d}}(e,a,n.v,n.w),s=o.path,i=o.lca,l=0,d=s[0],c=!0;for(;t!==n.w;){if(r=e.node(t),c){for(;(d=s[l])!==i&&e.node(d).maxRank<r.rank;)l++;d===i&&(c=!1)}if(!c){for(;l<s.length-1&&e.node(d=s[l+1]).minRank<=r.rank;)l++;d=s[l]}e.setParent(t,d),t=e.successors(t)[0]}})}}),m=a((e,t)=>{var r=l();t.exports={run:function(e){var t,n,a;let o=r.addDummyNode(e,"root",{},"_root"),s=(n={},(t=e).children().forEach(e=>(function e(r,a){var o=t.children(r);o&&o.length&&o.forEach(t=>e(t,a+1)),n[r]=a})(e,1)),n),i=Object.values(s),l=r.applyWithChunking(Math.max,i)-1,d=2*l+1;e.graph().nestingRoot=o,e.edges().forEach(t=>e.edge(t).minlen*=d);let c=(a=e).edges().reduce((e,t)=>e+a.edge(t).weight,0)+1;e.children().forEach(t=>(function e(t,n,a,o,s,i,l){let d=t.children(l);if(!d.length){l!==n&&t.setEdge(n,l,{weight:0,minlen:a});return}let c=r.addBorderNode(t,"_bt"),u=r.addBorderNode(t,"_bb"),h=t.node(l);t.setParent(c,l),h.borderTop=c,t.setParent(u,l),h.borderBottom=u,d.forEach(r=>{e(t,n,a,o,s,i,r);let d=t.node(r),h=d.borderTop?d.borderTop:r,f=d.borderBottom?d.borderBottom:r,p=d.borderTop?o:2*o,g=h!==f?1:s-i[l]+1;t.setEdge(c,h,{weight:p,minlen:g,nestingEdge:!0}),t.setEdge(f,u,{weight:p,minlen:g,nestingEdge:!0})}),t.parent(l)||t.setEdge(n,c,{weight:0,minlen:s+i[l]})})(e,o,d,c,l,s,t)),e.graph().nodeRankFactor=d},cleanup:function(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}}}),x=a((e,t)=>{var r=l();function n(e,t,n,a,o,s){let i=o[t][s-1],l=r.addDummyNode(e,"border",{width:0,height:0,rank:s,borderType:t},n);o[t][s]=l,e.setParent(l,a),i&&e.setEdge(i,l,{weight:1})}t.exports=function(e){e.children().forEach(function t(r){let a=e.children(r),o=e.node(r);if(a.length&&a.forEach(t),Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let t=o.minRank,a=o.maxRank+1;t<a;++t)n(e,"borderLeft","_bl",r,o,t),n(e,"borderRight","_br",r,o,t)}})}}),v=a((e,t)=>{function r(e){e.nodes().forEach(t=>n(e.node(t))),e.edges().forEach(t=>n(e.edge(t)))}function n(e){let t=e.width;e.width=e.height,e.height=t}function a(e){e.y=-e.y}function o(e){let t=e.x;e.x=e.y,e.y=t}t.exports={adjust:function(e){let t=e.graph().rankdir.toLowerCase();("lr"===t||"rl"===t)&&r(e)},undo:function(e){var t,n;let s=e.graph().rankdir.toLowerCase();("bt"===s||"rl"===s)&&((t=e).nodes().forEach(e=>a(t.node(e))),t.edges().forEach(e=>{let r=t.edge(e);r.points.forEach(a),Object.hasOwn(r,"y")&&a(r)})),("lr"===s||"rl"===s)&&((n=e).nodes().forEach(e=>o(n.node(e))),n.edges().forEach(e=>{let t=n.edge(e);t.points.forEach(o),Object.hasOwn(t,"x")&&o(t)}),r(e))}}}),b=a((e,t)=>{var r=l();t.exports=function(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),a=n.map(t=>e.node(t).rank),o=r.applyWithChunking(Math.max,a),s=r.range(o+1).map(()=>[]);return n.sort((t,r)=>e.node(t).rank-e.node(r).rank).forEach(function r(n){t[n]||(t[n]=!0,s[e.node(n).rank].push(n),e.successors(n).forEach(r))}),s}}),y=a((e,t)=>{var r=l().zipObject;t.exports=function(e,t){let n=0;for(let a=1;a<t.length;++a)n+=function(e,t,n){let a=r(n,n.map((e,t)=>t)),o=t.flatMap(t=>e.outEdges(t).map(t=>({pos:a[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),s=1;for(;s<n.length;)s<<=1;let i=2*s-1;s-=1;let l=Array(i).fill(0),d=0;return o.forEach(e=>{let t=e.pos+s;l[t]+=e.weight;let r=0;for(;t>0;)t%2&&(r+=l[t+1]),t=t-1>>1,l[t]+=e.weight;d+=e.weight*r}),d}(e,t[a-1],t[a]);return n}}),w=a((e,t)=>{t.exports=function(e,t=[]){return t.map(t=>{let r=e.inEdges(t);if(!r.length)return{v:t};{let n=r.reduce((t,r)=>{let n=e.edge(r),a=e.node(r.v);return{sum:t.sum+n.weight*a.order,weight:t.weight+n.weight}},{sum:0,weight:0});return{v:t,barycenter:n.sum/n.weight,weight:n.weight}}})}}),k=a((e,t)=>{var r=l();t.exports=function(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};void 0!==e.barycenter&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];void 0!==t&&void 0!==r&&(r.indegree++,t.out.push(n[e.w]))}),function(e){let t=[];for(;e.length;){let r=e.pop();t.push(r),r.in.reverse().forEach(function(e){return t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&function(e,t){let r=0,n=0;e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/n,e.weight=n,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}(r)),r.out.forEach(function(t){return r=>{r.in.push(t),0==--r.indegree&&e.push(r)}}(r))}return t.filter(e=>!e.merged).map(e=>r.pick(e,["vs","i","barycenter","weight"]))}(Object.values(n).filter(e=>!e.indegree))}}),j=a((e,t)=>{var r=l();function n(e,t,r){let n;for(;t.length&&(n=t[t.length-1]).i<=r;)t.pop(),e.push(n.vs),r++;return r}t.exports=function(e,t){var a;let o=r.partition(e,e=>Object.hasOwn(e,"barycenter")),s=o.lhs,i=o.rhs.sort((e,t)=>t.i-e.i),l=[],d=0,c=0,u=0;s.sort((a=!!t,(e,t)=>e.barycenter<t.barycenter?-1:e.barycenter>t.barycenter?1:a?t.i-e.i:e.i-t.i)),u=n(l,i,u),s.forEach(e=>{u+=e.vs.length,l.push(e.vs),d+=e.barycenter*e.weight,c+=e.weight,u=n(l,i,u)});let h={vs:l.flat(!0)};return c&&(h.barycenter=d/c,h.weight=c),h}}),E=a((e,t)=>{var r=w(),n=k(),a=j();t.exports=function e(t,o,s,i){var l,d;let c=t.children(o),u=t.node(o),h=u?u.borderLeft:void 0,f=u?u.borderRight:void 0,p={};h&&(c=c.filter(e=>e!==h&&e!==f));let g=r(t,c);g.forEach(r=>{if(t.children(r.v).length){var n,a;let o=e(t,r.v,s,i);p[r.v]=o,Object.hasOwn(o,"barycenter")&&(n=r,a=o,void 0!==n.barycenter?(n.barycenter=(n.barycenter*n.weight+a.barycenter*a.weight)/(n.weight+a.weight),n.weight+=a.weight):(n.barycenter=a.barycenter,n.weight=a.weight))}});let m=n(g,s);l=m,d=p,l.forEach(e=>{e.vs=e.vs.flatMap(e=>d[e]?d[e].vs:e)});let x=a(m,i);if(h&&(x.vs=[h,x.vs,f].flat(!0),t.predecessors(h).length)){let e=t.node(t.predecessors(h)[0]),r=t.node(t.predecessors(f)[0]);Object.hasOwn(x,"barycenter")||(x.barycenter=0,x.weight=0),x.barycenter=(x.barycenter*x.weight+e.order+r.order)/(x.weight+2),x.weight+=2}return x}}),N=a((e,t)=>{var r=o().Graph,n=l();t.exports=function(e,t,a,o){o||(o=e.nodes());let s=function(e){for(var t;e.hasNode(t=n.uniqueId("_root")););return t}(e),i=new r({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(t=>e.node(t));return o.forEach(r=>{let n=e.node(r),o=e.parent(r);(n.rank===t||n.minRank<=t&&t<=n.maxRank)&&(i.setNode(r),i.setParent(r,o||s),e[a](r).forEach(t=>{let n=t.v===r?t.w:t.v,a=i.edge(n,r),o=void 0!==a?a.weight:0;i.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(n,"minRank")&&i.setNode(r,{borderLeft:n.borderLeft[t],borderRight:n.borderRight[t]}))}),i}}),C=a((e,t)=>{t.exports=function(e,t,r){let n={},a;r.forEach(r=>{let o=e.parent(r),s,i;for(;o;){if((s=e.parent(o))?(i=n[s],n[s]=o):(i=a,a=o),i&&i!==o)return void t.setEdge(i,o);o=s}})}}),_=a((e,t)=>{var r=b(),n=y(),a=E(),s=N(),i=C(),d=o().Graph,c=l();function u(e,t,r){let n=new Map,a=(e,t)=>{n.has(e)||n.set(e,[]),n.get(e).push(t)};for(let t of e.nodes()){let r=e.node(t);if("number"==typeof r.rank&&a(r.rank,t),"number"==typeof r.minRank&&"number"==typeof r.maxRank)for(let e=r.minRank;e<=r.maxRank;e++)e!==r.rank&&a(e,t)}return t.map(function(t){return s(e,t,r,n.get(t)||[])})}function h(e,t){Object.values(t).forEach(t=>t.forEach((t,r)=>e.node(t).order=r))}t.exports=function e(t,o={}){if("function"==typeof o.customOrder)return void o.customOrder(t,e);let s=c.maxRank(t),l=u(t,c.range(1,s+1),"inEdges"),f=u(t,c.range(s-1,-1,-1),"outEdges"),p=r(t);if(h(t,p),o.disableOptimalOrderHeuristic)return;let g=1/0,m,x=o.constraints||[];for(let e=0,r=0;r<4;++e,++r){(function(e,t,r){let n=new d;e.forEach(function(e){r.forEach(e=>n.setEdge(e.left,e.right));let o=e.graph().root,s=a(e,o,n,t);s.vs.forEach((t,r)=>e.node(t).order=r),i(e,n,s.vs)})})(e%2?l:f,e%4>=2,x),p=c.buildLayerMatrix(t);let o=n(t,p);o<g?(r=0,m=Object.assign({},p),g=o):o===g&&(m=structuredClone(p))}h(t,m)}}),O=a((e,t)=>{var r=o().Graph,n=l();function a(e,t){let r={};return t.length&&t.reduce(function(t,n){let a=0,o=0,s=t.length,l=n[n.length-1];return n.forEach((t,d)=>{let c=function(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}(e,t),u=c?e.node(c).order:s;(c||t===l)&&(n.slice(o,d+1).forEach(t=>{e.predecessors(t).forEach(n=>{let o=e.node(n),s=o.order;(s<a||u<s)&&!(o.dummy&&e.node(t).dummy)&&i(r,n,t)})}),o=d+1,a=u)}),n}),r}function s(e,t){let r={};function a(t,a,o,s,l){let d;n.range(a,o).forEach(n=>{d=t[n],e.node(d).dummy&&e.predecessors(d).forEach(t=>{let n=e.node(t);n.dummy&&(n.order<s||n.order>l)&&i(r,t,d)})})}return t.length&&t.reduce(function(t,r){let n=-1,o,s=0;return r.forEach((i,l)=>{if("border"===e.node(i).dummy){let t=e.predecessors(i);t.length&&(o=e.node(t[0]).order,a(r,s,l,n,o),s=l,n=o)}a(r,s,r.length,o,t.length)}),r}),r}function i(e,t,r){if(t>r){let e=t;t=r,r=e}let n=e[t];n||(e[t]=n={}),n[r]=!0}function d(e,t,r){if(t>r){let e=t;t=r,r=e}return!!e[t]&&Object.hasOwn(e[t],r)}function c(e,t,r,n){let a={},o={},s={};return t.forEach(e=>{e.forEach((e,t)=>{a[e]=e,o[e]=e,s[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let i=n(e);if(i.length){let n=((i=i.sort((e,t)=>s[e]-s[t])).length-1)/2;for(let l=Math.floor(n),c=Math.ceil(n);l<=c;++l){let n=i[l];o[e]===e&&t<s[n]&&!d(r,e,n)&&(o[n]=e,o[e]=a[e]=a[n],t=s[n])}}})}),{root:a,align:o}}function u(e,t,n,a,o){var s,i,l,d,c,u,h;let f,p,g,m={},x=(s=e,i=t,l=n,d=o,f=new r,g=(c=(p=s.graph()).nodesep,u=p.edgesep,h=d,(e,t,r)=>{let n=e.node(t),a=e.node(r),o,s;if(o=0+n.width/2,Object.hasOwn(n,"labelpos"))switch(n.labelpos.toLowerCase()){case"l":s=-n.width/2;break;case"r":s=n.width/2}if(s&&(o+=h?s:-s),s=0,o+=(n.dummy?u:c)/2,o+=(a.dummy?u:c)/2,o+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":s=a.width/2;break;case"r":s=-a.width/2}return s&&(o+=h?s:-s),s=0,o}),i.forEach(e=>{let t;e.forEach(e=>{let r=l[e];if(f.setNode(r),t){var n=l[t],a=f.edge(n,r);f.setEdge(n,r,Math.max(g(s,e,t),a||0))}t=e})}),f),v=o?"borderLeft":"borderRight";function b(e,t){let r=x.nodes().slice(),n={},a=r.pop();for(;a;){if(n[a])e(a);else for(let e of(n[a]=!0,r.push(a),t(a)))r.push(e);a=r.pop()}}return b(function(e){m[e]=x.inEdges(e).reduce((e,t)=>Math.max(e,m[t.v]+x.edge(t)),0)},x.predecessors.bind(x)),b(function(t){let r=x.outEdges(t).reduce((e,t)=>Math.min(e,m[t.w]-x.edge(t)),1/0),n=e.node(t);r!==1/0&&n.borderType!==v&&(m[t]=Math.max(m[t],r))},x.successors.bind(x)),Object.keys(a).forEach(e=>m[e]=m[n[e]]),m}function h(e,t){return Object.values(t).reduce((t,r)=>{let n=-1/0,a=1/0;Object.entries(r).forEach(([t,r])=>{var o,s;let i=(o=e,s=t,o.node(s).width/2);n=Math.max(r+i,n),a=Math.min(r-i,a)});let o=n-a;return o<t[0]&&(t=[o,r]),t},[1/0,null])[1]}function f(e,t){let r=Object.values(t),a=n.applyWithChunking(Math.min,r),o=n.applyWithChunking(Math.max,r);["u","d"].forEach(r=>{["l","r"].forEach(s=>{let i=r+s,l=e[i];if(l===t)return;let d=Object.values(l),c=a-n.applyWithChunking(Math.min,d);"l"!==s&&(c=o-n.applyWithChunking(Math.max,d)),c&&(e[i]=n.mapValues(l,e=>e+c))})})}function p(e,t){return n.mapValues(e.ul,(r,n)=>{if(t)return e[t.toLowerCase()][n];{let t=Object.values(e).map(e=>e[n]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}t.exports={positionX:function(e){let t=n.buildLayerMatrix(e),r=Object.assign(a(e,t),s(e,t)),o={},i;["u","d"].forEach(a=>{i="u"===a?t:Object.values(t).reverse(),["l","r"].forEach(t=>{"r"===t&&(i=i.map(e=>Object.values(e).reverse()));let s=("u"===a?e.predecessors:e.successors).bind(e),l=c(e,i,r,s),d=u(e,i,l.root,l.align,"r"===t);"r"===t&&(d=n.mapValues(d,e=>-e)),o[a+t]=d})});let l=h(e,o);return f(o,l),p(o,e.graph().align)},findType1Conflicts:a,findType2Conflicts:s,addConflict:i,hasConflict:d,verticalAlignment:c,horizontalCompaction:u,alignCoordinates:f,findSmallestWidthAlignment:h,balance:p}}),S=a((e,t)=>{var r=l(),n=O().positionX;t.exports=function(e){var t;let a,o,s,i;t=e=r.asNonCompoundGraph(e),a=r.buildLayerMatrix(t),o=t.graph().ranksep,s=t.graph().rankalign,i=0,a.forEach(e=>{let r=e.reduce((e,r)=>{let n=t.node(r).height;return e>n?e:n},0);e.forEach(e=>{let n=t.node(e);"top"===s?n.y=i+n.height/2:"bottom"===s?n.y=i+r-n.height/2:n.y=i+r/2}),i+=r+o}),Object.entries(n(e)).forEach(([t,r])=>e.node(t).x=r)}}),R=a((e,t)=>{var r=d(),n=c(),a=p(),s=l().normalizeRanks,i=g(),u=l().removeEmptyRanks,h=m(),f=x(),b=v(),y=_(),w=S(),k=l(),j=o().Graph;t.exports=function(e,t={}){let o=t.debugTiming?k.time:k.notime;return o("layout",()=>{let l=o(" buildLayoutGraph",()=>{var t;let r,n;return t=e,r=new j({multigraph:!0,compound:!0}),n=L(t.graph()),r.setGraph(Object.assign({},N,T(n,E),k.pick(n,C))),t.nodes().forEach(e=>{let n=T(L(t.node(e)),O);Object.keys(R).forEach(e=>{void 0===n[e]&&(n[e]=R[e])}),r.setNode(e,n),r.setParent(e,t.parent(e))}),t.edges().forEach(e=>{let n=L(t.edge(e));r.setEdge(e,Object.assign({},P,T(n,M),k.pick(n,F)))}),r});return o(" runLayout",()=>{var e,d,c;return e=l,d=o,c=t,void(d(" makeSpaceForEdgeLabels",()=>{var t;let r;return r=(t=e).graph(),void(r.ranksep/=2,t.edges().forEach(e=>{let n=t.edge(e);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===r.rankdir||"BT"===r.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)}))}),d(" removeSelfEdges",()=>{var t;(t=e).edges().forEach(e=>{if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}),d(" acyclic",()=>r.run(e)),d(" nestingGraph.run",()=>h.run(e)),d(" rank",()=>a(k.asNonCompoundGraph(e))),d(" injectEdgeLabelProxies",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);if(r.width&&r.height){let r=t.node(e.v),n={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e:e};k.addDummyNode(t,"edge-proxy",n,"_ep")}})}),d(" removeEmptyRanks",()=>u(e)),d(" nestingGraph.cleanup",()=>h.cleanup(e)),d(" normalizeRanks",()=>s(e)),d(" assignRankMinMax",()=>{var t;let r;return r=0,void((t=e).nodes().forEach(e=>{let n=t.node(e);n.borderTop&&(n.minRank=t.node(n.borderTop).rank,n.maxRank=t.node(n.borderBottom).rank,r=Math.max(r,n.maxRank))}),t.graph().maxRank=r)}),d(" removeEdgeLabelProxies",()=>{var t;(t=e).nodes().forEach(e=>{let r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))})}),d(" normalize.run",()=>n.run(e)),d(" parentDummyChains",()=>i(e)),d(" addBorderSegments",()=>f(e)),d(" order",()=>y(e,c)),d(" insertSelfEdges",()=>{var t;return t=e,void k.buildLayerMatrix(t).forEach(e=>{var r=0;e.forEach((e,n)=>{var a=t.node(e);a.order=n+r,(a.selfEdges||[]).forEach(e=>{k.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:a.rank,order:n+ ++r,e:e.e,label:e.label},"_se")}),delete a.selfEdges})})}),d(" adjustCoordinateSystem",()=>b.adjust(e)),d(" position",()=>w(e)),d(" positionSelfEdges",()=>{var t;(t=e).nodes().forEach(e=>{var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),a=n.x+n.width/2,o=n.y,s=r.x-a,i=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:a+2*s/3,y:o-i},{x:a+5*s/6,y:o-i},{x:a+s,y:o},{x:a+5*s/6,y:o+i},{x:a+2*s/3,y:o+i}],r.label.x=r.x,r.label.y=r.y}})}),d(" removeBorderNodes",()=>{var t;(t=e).nodes().forEach(e=>{if(t.children(e).length){let r=t.node(e),n=t.node(r.borderTop),a=t.node(r.borderBottom),o=t.node(r.borderLeft[r.borderLeft.length-1]),s=t.node(r.borderRight[r.borderRight.length-1]);r.width=Math.abs(s.x-o.x),r.height=Math.abs(a.y-n.y),r.x=o.x+r.width/2,r.y=n.y+r.height/2}}),t.nodes().forEach(e=>{"border"===t.node(e).dummy&&t.removeNode(e)})}),d(" normalize.undo",()=>n.undo(e)),d(" fixupEdgeLabelCoords",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);if(Object.hasOwn(r,"x"))switch(("l"===r.labelpos||"r"===r.labelpos)&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}})}),d(" undoCoordinateSystem",()=>b.undo(e)),d(" translateGraph",()=>(function(e){let t=1/0,r=0,n=1/0,a=0,o=e.graph(),s=o.marginx||0,i=o.marginy||0;function l(e){let o=e.x,s=e.y,i=e.width,l=e.height;t=Math.min(t,o-i/2),r=Math.max(r,o+i/2),n=Math.min(n,s-l/2),a=Math.max(a,s+l/2)}e.nodes().forEach(t=>l(e.node(t))),e.edges().forEach(t=>{let r=e.edge(t);Object.hasOwn(r,"x")&&l(r)}),t-=s,n-=i,e.nodes().forEach(r=>{let a=e.node(r);a.x-=t,a.y-=n}),e.edges().forEach(r=>{let a=e.edge(r);a.points.forEach(e=>{e.x-=t,e.y-=n}),Object.hasOwn(a,"x")&&(a.x-=t),Object.hasOwn(a,"y")&&(a.y-=n)}),o.width=r-t+s,o.height=a-n+i})(e)),d(" assignNodeIntersects",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e),n=t.node(e.v),a=t.node(e.w),o,s;r.points?(o=r.points[0],s=r.points[r.points.length-1]):(r.points=[],o=a,s=n),r.points.unshift(k.intersectRect(n,o)),r.points.push(k.intersectRect(a,s))})}),d(" reversePoints",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);r.reversed&&r.points.reverse()})}),d(" acyclic.undo",()=>r.undo(e)))}),o(" updateInputGraph",()=>{var t,r;return t=e,r=l,void(t.nodes().forEach(e=>{let n=t.node(e),a=r.node(e);n&&(n.x=a.x,n.y=a.y,n.order=a.order,n.rank=a.rank,r.children(e).length&&(n.width=a.width,n.height=a.height))}),t.edges().forEach(e=>{let n=t.edge(e),a=r.edge(e);n.points=a.points,Object.hasOwn(a,"x")&&(n.x=a.x,n.y=a.y)}),t.graph().width=r.graph().width,t.graph().height=r.graph().height)}),l})};var E=["nodesep","edgesep","ranksep","marginx","marginy"],N={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},C=["acyclicer","ranker","rankdir","align","rankalign"],O=["width","height","rank"],R={width:0,height:0},M=["minlen","weight","width","height","labeloffset"],P={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},F=["labelpos"];function T(e,t){return k.mapValues(k.pick(e,t),Number)}function L(e){var t={};return e&&Object.entries(e).forEach(([e,r])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=r}),t}}),M=a((e,t)=>{var r=l(),n=o().Graph;t.exports={debugOrdering:function(e){let t=r.buildLayerMatrix(e),a=new n({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{a.setNode(t,{label:t}),a.setParent(t,"layer"+e.node(t).rank)}),e.edges().forEach(e=>a.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{a.setNode("layer"+t,{rank:"same"}),e.reduce((e,t)=>(a.setEdge(e,t,{style:"invis"}),t))}),a}}}),P=a((e,t)=>{t.exports="2.0.4"});let F=a((e,t)=>{t.exports={graphlib:o(),layout:R(),debug:M(),util:{time:l().time,notime:l().notime},version:P()}})(),T={direction:"LR",ranksep:200,nodesep:30},L={featureNode:{width:388,height:140},repositoryNode:{width:400,height:140}};function A(e,t){let r=e.data;return r&&"number"==typeof r.width&&"number"==typeof r.height?{width:r.width,height:r.height}:L[e.type??""]??t}function D(e,t,r={}){let{direction:n="TB",nodeSize:a={width:172,height:36},ranksep:o=80,nodesep:s=30}=r;if(0===e.length)return{nodes:[],edges:[]};let i=new F.graphlib.Graph({multigraph:!0});i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:n,ranksep:o,nodesep:s});let l=new Set;for(let e of t)l.add(e.source),l.add(e.target);let d=e.filter(e=>l.has(e.id)),c=e.filter(e=>!l.has(e.id));for(let e of d){let t=A(e,a);i.setNode(e.id,{width:t.width,height:t.height})}for(let e of t)i.hasNode(e.source)&&i.hasNode(e.target)&&i.setEdge(e.source,e.target,{},e.id);F.layout(i);let{targetPosition:u,sourcePosition:h}=function(e){switch(e){case"LR":return{targetPosition:"left",sourcePosition:"right"};case"RL":return{targetPosition:"right",sourcePosition:"left"};case"BT":return{targetPosition:"bottom",sourcePosition:"top"};default:return{targetPosition:"top",sourcePosition:"bottom"}}}(n),f="LR"===n||"RL"===n,p=new Map;for(let e of d){let t=i.node(e.id),r=A(e,a);p.set(e.id,{cx:t.x,cy:t.y,w:r.width,h:r.height})}let g=0;for(let e of p.values()){g=f?e.cx:e.cy;break}for(let e of c){let t=A(e,a);p.set(e.id,{cx:f?g:0,cy:f?0:g,w:t.width,h:t.height})}let m=new Map;for(let e of t)p.has(e.source)&&p.has(e.target)&&(m.has(e.source)||m.set(e.source,[]),m.get(e.source).push(e.target));let x=new Map;for(let t=0;t<e.length;t++)x.set(e[t].id,t);for(let[,e]of m)e.sort((e,t)=>(x.get(e)??0)-(x.get(t)??0));let v=new Set;for(let e of m.values())for(let t of e)v.add(t);let b=[...[...l].filter(e=>p.has(e)&&!v.has(e)),...c.map(e=>e.id)];b.sort((e,t)=>(x.get(e)??0)-(x.get(t)??0));let y=new Map;for(let e of b)!function e(t){if(y.has(t))return y.get(t);let r=p.get(t),n=f?r.h:r.w,a=m.get(t);if(!a||0===a.length)return y.set(t,n),n;let o=0;for(let t of a)o+=e(t);let i=Math.max(n,o+=(a.length-1)*s);return y.set(t,i),i}(e);let w=0;for(let e of b){let t=y.get(e)??0;!function e(t,r){let n=p.get(t);f?n.cy=r:n.cx=r;let a=m.get(t);if(!a||0===a.length)return;let o=0;for(let e of a)o+=y.get(e)??0;let i=r-(o+=(a.length-1)*s)/2;for(let t of a){let r=y.get(t)??0;e(t,i+r/2),i+=r+s}}(e,w+t/2),w+=t+s}let k=[];for(let t of e){let e=p.get(t.id);e&&k.push({...t,targetPosition:u,sourcePosition:h,position:{x:e.cx-e.w/2,y:e.cy-e.h/2}})}return{nodes:k,edges:[...t]}}var I=e.i(21023);let $=(0,I.createServerReference)("4084351e57290b145f7ca941e2f61b3932d10c261f",I.callServer,void 0,I.findSourceMapURL,"archiveFeature"),z=(0,I.createServerReference)("78d20c6a0d2019f5afdf16c2b6a22320c9223fb17c",I.callServer,void 0,I.findSourceMapURL,"deleteFeature");var G=e.i(58628),B=e.i(9374);let U=(0,I.createServerReference)("40384170d2dc6a10665ef518999052b039b1410f15",I.callServer,void 0,I.findSourceMapURL,"stopFeature"),q=(0,I.createServerReference)("40ed36299a7712620e96dec2662e31fc49c454a0ab",I.callServer,void 0,I.findSourceMapURL,"unarchiveFeature");var W=e.i(36462);let H=(0,I.createServerReference)("4085686561bb145b7adcfe573c948004edc8ceea2e",I.callServer,void 0,I.findSourceMapURL,"deleteRepository"),V=(0,I.createServerReference)("4087fed787899614c9661603d12013407f23b1581a",I.callServer,void 0,I.findSourceMapURL,"getFeatureMetadata");var X=e.i(39443),J=e.i(8361),K=e.i(18354),Y=e.i(99045);function Q(e,t){let r=new Map;for(let e of t)"dependencyEdge"===e.type&&r.set(e.target,e.source);let n=new Map,a=new Map;for(let t of e)"featureNode"===t.type?n.set(t.id,{nodeId:t.id,data:t.data,parentNodeId:r.get(t.id)}):"repositoryNode"===t.type&&a.set(t.id,{nodeId:t.id,data:t.data});return{featureMap:n,repoMap:a}}function Z(e,t){return(void 0===t.state||t.state===e.state)&&(void 0===t.lifecycle||t.lifecycle===e.lifecycle)&&(void 0===t.name||t.name===e.name)&&(void 0===t.description||t.description===e.description)}function ee(e,t){if(e.size!==t.size)return!1;for(let[r,n]of e){let e=t.get(r);if(!e||n.parentNodeId!==e.parentNodeId||n.data!==e.data&&JSON.stringify(n.data)!==JSON.stringify(e.data))return!1}return!0}let et=(0,K.createLogger)("[Polling]"),er=0,en=0;function ea(e,a){let o=(0,r.useRouter)(),s=(0,J.useSoundAction)("delete"),i=(0,J.useSoundAction)("create"),[l,d]=(0,t.useState)(!1),{nodes:c,edges:u,reconcile:h,updateFeature:f,addPendingFeature:p,removeFeature:g,restoreFeature:m,addRepository:x,removeRepository:v,replaceRepository:b,getFeatureRepositoryPath:y,getRepositoryData:w,getRepoMapSize:k,setCallbacks:j,beginMutation:E,endMutation:N,isMutating:C}=function(e,r,n=!1){let a=(0,t.useMemo)(()=>Q(e,r),[]),[o,s]=(0,t.useState)(a.featureMap),[i,l]=(0,t.useState)(a.repoMap),[d,c]=(0,t.useState)(new Map),u=(0,t.useRef)(new Map),h=(0,t.useRef)(new Set),f=(0,t.useRef)(0),p=(0,t.useRef)(new Set),g=(0,t.useRef)(new Set),m=(0,t.useRef)({}),x=(0,t.useMemo)(()=>({onNodeAction:e=>m.current.onNodeAction?.(e),onNodeSettings:e=>m.current.onNodeSettings?.(e),onFeatureDelete:(e,t,r,n)=>m.current.onFeatureDelete?.(e,t,r,n),onRepositoryAdd:e=>m.current.onRepositoryAdd?.(e),onRepositoryClick:e=>m.current.onRepositoryClick?.(e),onRepositoryDelete:e=>m.current.onRepositoryDelete?.(e),onRetryFeature:e=>m.current.onRetryFeature?.(e),onStartFeature:e=>m.current.onStartFeature?.(e),onArchiveFeature:e=>m.current.onArchiveFeature?.(e),onUnarchiveFeature:e=>m.current.onUnarchiveFeature?.(e)}),[]),v=(0,t.useRef)(o);v.current=o;let b=(0,t.useRef)(i);b.current=i;let y=(0,t.useMemo)(()=>{if(n)return o;let e=new Map;for(let[t,r]of o)"archived"!==r.data.state&&e.set(t,r);return e.size===o.size?o:e},[o,n]),w=(0,t.useMemo)(()=>(function(e,t,r,n){let a=[],o=[],s=e=>e.replace(/\\/g,"/"),i=new Map;for(let[e,r]of t)r.data.repositoryPath&&i.set(s(r.data.repositoryPath),e);let l=new Map;for(let[e,r]of[...t.entries()].sort((e,t)=>{let r=e[1].data.createdAt,n=t[1].data.createdAt;return("number"!=typeof r||Number.isNaN(r)?1/0:r)-("number"!=typeof n||Number.isNaN(n)?1/0:n)})){let t={...r.data,...n?.onRepositoryAdd&&{onAdd:()=>n.onRepositoryAdd(e)},...n?.onRepositoryClick&&{onClick:()=>n.onRepositoryClick(e)},...n?.onRepositoryDelete&&{onDelete:n.onRepositoryDelete}};a.push({id:e,type:"repositoryNode",position:{x:0,y:0},data:t})}for(let[t,d,c]of[...[...e.entries()].map(([e,t])=>[e,t,!1]),...[...r.entries()].filter(([t])=>!e.has(t)).map(([e,t])=>[e,t,!0])]){let u="creating"===d.data.state||c,h={...d.data,...!u&&n?.onNodeAction&&{onAction:()=>n.onNodeAction(t)},...!u&&n?.onNodeSettings&&{onSettings:()=>n.onNodeSettings(t)},...!u&&n?.onFeatureDelete&&{onDelete:n.onFeatureDelete},...!u&&"error"===d.data.state&&n?.onRetryFeature&&{onRetry:n.onRetryFeature},...!u&&"pending"===d.data.state&&n?.onStartFeature&&{onStart:n.onStartFeature},...!u&&("running"===d.data.state||"action-required"===d.data.state)&&n?.onStopFeature&&{onStop:n.onStopFeature},...!u&&"archived"!==d.data.state&&"deleting"!==d.data.state&&n?.onArchiveFeature&&{onArchive:n.onArchiveFeature},...!u&&"archived"===d.data.state&&n?.onUnarchiveFeature&&{onUnarchive:n.onUnarchiveFeature}};if(a.push({id:t,type:"featureNode",position:{x:0,y:0},data:h}),d.parentNodeId&&(e.has(d.parentNodeId)||r.has(d.parentNodeId)))o.push({id:`dep-${d.parentNodeId}-${t}`,source:d.parentNodeId,target:t,type:"dependencyEdge"});else{let e=s(d.data.repositoryPath),r=i.get(e)??function(e){if(l.has(e))return l.get(e);let t=`virtual-repo-${e}`,r=e.split("/").filter(Boolean).at(-1)??e;return a.push({id:t,type:"repositoryNode",position:{x:0,y:0},data:{name:r,repositoryPath:e}}),l.set(e,t),t}(e);o.push({id:`edge-${r}-${t}`,source:r,target:t,style:{strokeDasharray:"5 5"}})}}let d=new Set;for(let e of o)"dependencyEdge"===e.type&&d.add(e.source);let c=o.length>0;for(let e of a){let t=e.data;t.showHandles=c,"featureNode"===e.type&&(t.hasChildren=d.has(e.id))}return{nodes:a,edges:o}})(y,i,d,x),[y,i,d,x]),k=(0,t.useRef)({key:"",positions:new Map}),{nodes:j,edges:E}=(0,t.useMemo)(()=>{let e=w.nodes.map(e=>e.id).sort().join(","),t=w.edges.map(e=>`${e.source}-${e.target}`).sort().join(","),r=`${e}|${t}`;if(r!==k.current.key){let e=D(w.nodes,w.edges,T),t=new Map;for(let r of e.nodes)t.set(r.id,{position:r.position,targetPosition:r.targetPosition,sourcePosition:r.sourcePosition});let n=k.current.positions;if(n.size>0){let r=0,a=0;for(let[e,o]of t){let t=n.get(e);if(t){r=t.position.x-o.position.x,a=t.position.y-o.position.y;break}}if(0!==r||0!==a){for(let e of t.values())e.position={x:e.position.x+r,y:e.position.y+a};for(let t of e.nodes)t.position={x:t.position.x+r,y:t.position.y+a}}}return k.current={key:r,positions:t},e}let{positions:n}=k.current;return{nodes:w.nodes.map(e=>{let t=n.get(e.id);return t?{...e,...t}:e}),edges:w.edges}},[w]),N=(0,t.useCallback)((e,t)=>{if(f.current>0)return;let{featureMap:r,repoMap:n}=Q(e,t),a=new Set([...r.values()].map(e=>`${e.data.name}\0${e.data.repositoryPath}`));s(e=>{let t=[...e.entries()].filter(([,e])=>"creating"===e.data.state),n=new Map(r);for(let[e,r]of t){let t=`${r.data.name}\0${r.data.repositoryPath}`;a.has(t)||n.set(e,r)}let o=new Set;for(let[t,r]of e)"deleting"===r.data.state&&(n.has(t)?n.set(t,{...n.get(t),data:{...n.get(t).data,state:"deleting"}}):g.current.has(t)||(n.set(t,r),o.add(t)));for(let[e,t]of(g.current=o,u.current)){let r=n.get(e);r&&(n.set(e,{...r,data:{...r.data,...t}}),u.current.delete(e))}return ee(e,n)?e:n}),c(e=>{if(0===e.size)return e;let t=!1,r=new Map(e);for(let[n,o]of e){let e=`${o.data.name}\0${o.data.repositoryPath}`;a.has(e)&&(r.delete(n),t=!0)}return t?r:e}),l(e=>{let t=new Map(n),r=new Set([...n.values()].map(e=>e.data.repositoryPath));for(let[n,a]of e){if(t.has(n)||r.has(a.data.repositoryPath)){h.current.delete(n);continue}(n.startsWith("repo-temp-")||h.current.has(n))&&t.set(n,a)}return ee(e,t)?e:t})},[]),C=(0,t.useCallback)((e,t)=>{s(r=>{let n=r.get(e);if(!n)return u.current.set(e,{...u.current.get(e),...t}),r;if(u.current.delete(e),Z(n.data,t))return r;let a=new Map(r);return a.set(e,{...n,data:{...n.data,...t}}),a}),c(r=>{let n=r.get(e);if(!n||Z(n.data,t))return r;let a=new Map(r);return a.set(e,{...n,data:{...n.data,...t}}),a})},[]),_=(0,t.useCallback)((e,t,r)=>{c(n=>{let a=new Map(n);return a.set(e,{nodeId:e,data:t,parentNodeId:r}),a})},[]),O=(0,t.useCallback)(e=>{c(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),S=(0,t.useCallback)(e=>{s(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),R=(0,t.useCallback)((e,t)=>{s(r=>{let n=new Map(r);return n.set(e,t),n})},[]),M=(0,t.useCallback)((e,t)=>{h.current.add(e),l(r=>{let n=new Map(r);return n.set(e,{nodeId:e,data:t}),n})},[]),P=(0,t.useCallback)(e=>{h.current.delete(e),l(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),F=(0,t.useCallback)((e,t,r)=>{h.current.delete(e),h.current.add(t),l(n=>{if(!n.has(e))return n;let a=new Map(n);return a.delete(e),a.set(t,{nodeId:t,data:r}),a})},[]),L=(0,t.useCallback)(e=>v.current.get(e)?.data.repositoryPath,[]),A=(0,t.useCallback)(e=>b.current.get(e)?.data,[]),I=(0,t.useCallback)(()=>b.current.size,[]),$=(0,t.useCallback)(e=>{m.current=e},[]),z=(0,t.useCallback)(()=>{f.current++},[]),G=(0,t.useCallback)((e=3e3)=>{let t=setTimeout(()=>{f.current=Math.max(0,f.current-1),p.current.delete(t)},e);p.current.add(t)},[]),B=(0,t.useCallback)(()=>f.current>0,[]);return(0,t.useEffect)(()=>{let e=p.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[]),{nodes:j,edges:E,reconcile:N,updateFeature:C,addPendingFeature:_,removePendingFeature:O,removeFeature:S,restoreFeature:R,addRepository:M,removeRepository:P,replaceRepository:F,getFeatureRepositoryPath:L,getRepositoryData:A,getRepoMapSize:I,setCallbacks:$,beginMutation:z,endMutation:G,isMutating:B}}(e,a,l),_=(0,t.useRef)(c),O=(0,t.useRef)(u);(0,t.useEffect)(()=>{_.current=c,O.current=u},[c,u]);let S=(0,t.useMemo)(()=>e.map(e=>e.id).sort().join(","),[e]),R=(0,t.useMemo)(()=>e.filter(e=>"featureNode"===e.type).map(e=>{let t=e.data;return`${e.id}:${t.state}:${t.lifecycle}`}).sort().join(","),[e]),M=(0,t.useRef)("");(0,t.useEffect)(()=>{let t=`${S}|${R}`;t!==M.current&&(M.current=t,h(e,a))},[S,R,e,a,h]);let P=(0,t.useRef)(new Map),{events:F}=(0,X.useAgentEventsContext)();(0,t.useEffect)(()=>{let t=P.current;for(let r of e){if("featureNode"!==r.type)continue;let e=r.data,a=t.get(r.id);void 0!==a&&a!==e.state&&(F.some(t=>t.featureId===e.featureId&&(0,Y.mapEventTypeToState)(t.eventType)===e.state)||("done"===e.state?n.toast.success(e.name,{description:"Feature completed!"}):"action-required"===e.state?n.toast.warning(e.name,{description:"Waiting for your approval",action:{label:"Review",onClick:()=>o.push(`/feature/${e.featureId}`)}}):"error"===e.state&&n.toast.error(e.name,{description:e.errorMessage??"Agent failed"}))),t.set(r.id,e.state)}},[R,e,F,o]);let L=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(L.current>F.length&&(L.current=0),F.length<=L.current)return;let e=F.slice(L.current);for(let{featureId:t,state:r,lifecycle:n}of(L.current=F.length,(0,Y.resolveSseEventUpdates)(e)))if(void 0!==r||void 0!==n){let e=`feat-${t}`,a=_.current.find(t=>t.id===e),o=a?a.data.state:void 0;if("deleting"===o||"error"===r&&C()&&"running"===o)continue;f(e,{...void 0!==r&&{state:r},...void 0!==n&&{lifecycle:n}})}},[F,f,C]),(0,t.useEffect)(()=>{let e=e=>{let{featureId:t}=e.detail;E(),f(`feat-${t}`,{state:"running"}),N()};return window.addEventListener("shep:feature-approved",e),()=>window.removeEventListener("shep:feature-approved",e)},[f,E,N]);let A=(0,t.useRef)(new Set),I=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(I.current>F.length&&(I.current=0),F.length<=I.current)return;let e=F.slice(I.current);for(let t of(I.current=F.length,e)){if("Feature metadata updated"!==t.message||A.current.has(t.featureId))continue;A.current.add(t.featureId);let e=`feat-${t.featureId}`;V(t.featureId).then(t=>{t&&f(e,{name:t.name,description:t.description})}).catch(()=>{})}},[F,f]),(0,t.useEffect)(()=>{et.debug("polling enabled (15000ms interval)");let e=setInterval(async()=>{if(!document.hidden&&!C())try{let e=await fetch("/api/graph-data");if(!e.ok)throw Error(`status ${e.status}`);let{nodes:t,edges:r}=await e.json();h(t,r)}catch{et.warn("poll fetch failed — will retry next interval")}},15e3);return()=>{et.debug("polling disabled"),clearInterval(e)}},[h,C]);let K=(0,t.useCallback)(e=>{},[]),ea=(0,t.useCallback)(e=>{},[]),eo=(0,t.useCallback)((e,t,r)=>{let n=t?.featureId?`feat-${t.featureId}`:`feature-${Date.now()}-${er++}`,a={name:t?.name??"New Feature",description:t?.description??"Describe what this feature does",featureId:t?.featureId??`#${n.slice(-4)}`,lifecycle:"requirements",state:t?.state??"running",progress:0,repositoryPath:t?.repositoryPath??"",branch:t?.branch??""};return p(n,a,"dependencyEdge"===r&&e?e:void 0),n},[p]),es=(0,t.useCallback)(e=>{let t=`feat-${e}`;E(),f(t,{state:"running"}),(0,G.resumeFeature)(e).then(e=>{e.error?(f(t,{state:"error"}),n.toast.error(e.error)):n.toast.success("Feature resumed")}).catch(()=>{f(t,{state:"error"}),n.toast.error("Failed to resume feature")}).finally(()=>N())},[f,E,N]),ei=(0,t.useCallback)(e=>{let t=`feat-${e}`;E(),f(t,{state:"running"}),(0,B.startFeature)(e).then(e=>{e.error?(f(t,{state:"pending"}),n.toast.error(e.error)):n.toast.success("Feature started")}).catch(()=>{f(t,{state:"pending"}),n.toast.error("Failed to start feature")}).finally(()=>N())},[f,E,N]),el=(0,t.useCallback)(e=>{E(),U(e).then(e=>{e.error?n.toast.error(e.error):n.toast.success("Agent stopped")}).catch(()=>{n.toast.error("Failed to stop agent")}).finally(()=>N())},[E,N]),ed=(0,t.useCallback)(e=>{let t=`feat-${e}`;E(),f(t,{state:"archived"}),$(e).then(e=>{e.error?(f(t,{state:"done"}),n.toast.error(e.error)):n.toast.success("Feature archived")}).catch(()=>{f(t,{state:"done"}),n.toast.error("Failed to archive feature")}).finally(()=>N())},[f,E,N]),ec=(0,t.useCallback)(e=>{let t=`feat-${e}`;E(),f(t,{state:"done"}),q(e).then(e=>{e.error?(f(t,{state:"archived"}),n.toast.error(e.error)):n.toast.success("Feature unarchived")}).catch(()=>{f(t,{state:"archived"}),n.toast.error("Failed to unarchive feature")}).finally(()=>N())},[f,E,N]),eu=(0,t.useCallback)((e,t,r,a)=>{let i=`feat-${e}`,l=[];if(!0===r){let e=[i];for(;e.length>0;){let t=e.shift();for(let r of O.current)"dependencyEdge"===r.type&&r.source===t&&(l.push(r.target),e.push(r.target))}}let d=new Map;for(let e of[i,...l]){let t=_.current.find(t=>t.id===e);t&&d.set(e,t.data.state)}for(let e of(E(),f(i,{state:"deleting"}),l))f(e,{state:"deleting"});s.play(),o.push("/"),z(e,t,r,a).then(e=>{if(e.error){for(let[e,t]of d)t&&f(e,{state:t});n.toast.error(e.error)}else for(let e of(g(i),l))g(e)}).catch(()=>{for(let[e,t]of d)t&&f(e,{state:t});n.toast.error("Failed to delete feature")}).finally(()=>N())},[o,s,f,g,E,N]),eh=(0,t.useCallback)(async e=>{let t=`repo-${e}`,r=new Set(O.current.filter(e=>e.source===t).map(e=>e.target)),a=w(t),o=new Map;for(let e of r){let t=_.current.find(t=>t.id===e);t&&o.set(e,{nodeId:e,data:t.data})}let i=()=>{for(let[e,r]of(a&&x(t,a),o))m(e,r)};for(let e of(E(),v(t),r))g(e);try{let t=await H(e);if(!t.success){n.toast.error(t.error??"Failed to remove repository"),i();return}s.play()}catch{n.toast.error("Failed to remove repository"),i()}finally{N()}},[s,v,g,x,m,w,E,N]),ef=(0,t.useCallback)(e=>{let t=D(_.current,O.current,{...T,direction:e});h(t.nodes,t.edges)},[h]);return{nodes:c,edges:u,onNodesChange:K,handleConnect:ea,handleAddRepository:(0,t.useCallback)(e=>{let t=0===k(),r=`repo-temp-${++en}`,a=e.replace(/[\\/]+$/,"").split(/[\\/]/).pop()??e;return E(),x(r,{name:a,repositoryPath:e,id:r,createdAt:Date.now(),gitInfoStatus:"loading"}),(0,W.addRepository)({path:e,name:a}).then(e=>{if(e.error){v(r),n.toast.error(e.error);return}let t=e.repository;b(r,`repo-${t.id}`,{name:t.name,repositoryPath:t.path,id:t.id,createdAt:t.createdAt instanceof Date?t.createdAt.getTime():Number(t.createdAt)}),i.play()}).catch(()=>{v(r),n.toast.error("Failed to add repository")}).finally(()=>N()),{wasEmpty:t,repoPath:e}},[x,v,b,i,k,E,N]),handleArchiveFeature:ed,handleLayout:ef,handleDeleteFeature:eu,handleRetryFeature:es,handleStartFeature:ei,handleStopFeature:el,handleUnarchiveFeature:ec,handleDeleteRepository:eh,createFeatureNode:eo,showArchived:l,setShowArchived:d,getFeatureRepositoryPath:y,getRepositoryData:w,setCallbacks:j}}e.s(["useControlCenterState",()=>ea],17840)},48246,e=>{"use strict";var t=e.i(20314),r=e.i(53271),n=e.i(92786),a=e.i(79054),o=e.i(31406),s=e.i(87889),i=e.i(3645);let l=(0,i.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var d=e.i(31777),c=e.i(3214),u=e.i(38227),h=e.i(35364);e.i(54793);var f=e.i(7729);e.i(47506);var p=e.i(89313),g=e.i(92002),m=e.i(82569),x=e.i(8986),v=e.i(38573),b=e.i(19933),y=e.i(67669),w=e.i(24042),k=e.i(64970),j=e.i(49228),E=e.i(65530),N=e.i(7311);let C=(0,i.default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);e.i(81803);var _=e.i(72714),O=e.i(2287),S=e.i(2828),R=e.i(8537),M=e.i(75921),P=e.i(76852),F=e.i(80519);function T({data:e,selected:n}){let s=(0,o.useRouter)(),i=(0,M.useFeatureFlags)(),[l,f]=(0,a.useState)(!1),p=(0,P.useRepositoryActions)(e.repositoryPath?{repositoryId:e.id,repositoryPath:e.repositoryPath}:null),T=(0,R.useDeployAction)(e.repositoryPath?{targetId:e.repositoryPath,targetType:"repository",repositoryPath:e.repositoryPath}:null),L="Booting"===T.status||"Ready"===T.status,A=(0,a.useCallback)((t,r)=>{if(!e.repositoryPath)return;let n=t.preview?t.preview.slice(0,200):"Unknown conversation",a=["Continue work from a previous agent session.","","## Session Context",`- Session ID: ${t.id}`,`- Messages: ${t.messageCount}`,t.lastMessageAt?`- Last active: ${t.lastMessageAt}`:"",`- Conversation file: ${r}`,"","## Session Preview",`> ${n}`,"","## Instructions","1. Read the full conversation history from the file above",`2. Analyze the current state of the repository — what was done, what remains`,"3. Create or update spec files to accurately reflect the current state and remaining work","4. Continue implementing any unfinished work from the conversation"].filter(Boolean).join("\n"),o=new URLSearchParams({repo:e.repositoryPath,prompt:a});s.push(`/create?${o.toString()}`)},[e.repositoryPath,s]);return(0,t.jsxs)("div",{className:(0,d.cn)("group relative",e.onDelete&&e.id&&"pl-10"),children:[e.showHandles?(0,t.jsx)(r.Handle,{type:"target",position:g.Position.Left,isConnectable:!1,className:"opacity-0!",style:{top:70}}):null,e.onDelete&&e.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"absolute top-1/2 left-0 -translate-y-1/2 opacity-0 transition-opacity group-hover:opacity-100",children:(0,t.jsx)(S.TooltipProvider,{children:(0,t.jsxs)(S.Tooltip,{children:[(0,t.jsx)(S.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{"aria-label":"Remove repository","data-testid":"repository-node-delete-button",onClick:e=>{e.stopPropagation(),f(!0)},className:"bg-card text-muted-foreground hover:border-destructive hover:text-destructive flex h-7 w-7 cursor-pointer items-center justify-center rounded-full border shadow-sm transition-colors",children:(0,t.jsx)(y.Trash2,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(S.TooltipContent,{children:"Remove repository"})]})})}),(0,t.jsx)(O.Dialog,{open:l,onOpenChange:f,children:(0,t.jsxs)(O.DialogContent,{className:"max-w-xs",children:[(0,t.jsxs)(O.DialogHeader,{children:[(0,t.jsx)(O.DialogTitle,{children:"Remove repository?"}),(0,t.jsxs)(O.DialogDescription,{children:["This will remove ",(0,t.jsx)("strong",{children:e.name})," and all its features from your workspace. The repository files on disk won't be affected."]})]}),(0,t.jsxs)(O.DialogFooter,{className:"grid grid-cols-2 gap-2 sm:flex-none",children:[(0,t.jsx)(O.DialogClose,{asChild:!0,children:(0,t.jsx)(h.Button,{variant:"outline",children:"Cancel"})}),(0,t.jsx)(h.Button,{variant:"destructive",onClick:()=>{f(!1),e.onDelete?.(e.id)},children:"Remove"})]})]})})]}):null,(0,t.jsxs)("div",{role:"button",tabIndex:0,"data-testid":"repository-node-card","data-repo-name":e.name,onClick:t=>{t.stopPropagation(),e.onClick?.()},onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),t.stopPropagation(),e.onClick?.())},className:(0,d.cn)("nodrag bg-card flex w-[26rem] cursor-pointer flex-col overflow-hidden rounded-xl border shadow-sm transition-[border-color,box-shadow] duration-200 dark:bg-neutral-800/80",n&&"border-blue-400 dark:border-amber-500/60"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3",children:[(0,t.jsx)(m.Github,{className:"text-muted-foreground h-5 w-5 shrink-0"}),(0,t.jsx)("span",{"data-testid":"repository-node-name",className:"min-w-0 truncate text-sm font-medium",children:e.name}),(0,t.jsxs)("div",{className:(0,d.cn)("flex shrink-0 items-center gap-2",(e.repositoryPath??e.onAdd)&&"ml-auto"),onClick:e=>e.stopPropagation(),children:[e.repositoryPath?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(S.TooltipProvider,{children:(0,t.jsxs)(S.Tooltip,{children:[(0,t.jsx)(S.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(_.ActionButton,{label:"Open in IDE",onClick:p.openInIde,loading:p.ideLoading,error:!!p.ideError,icon:x.Code2,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(S.TooltipContent,{children:"Open in IDE"})]})}),(0,t.jsx)(S.TooltipProvider,{children:(0,t.jsxs)(S.Tooltip,{children:[(0,t.jsx)(S.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(_.ActionButton,{label:"Open in Shell",onClick:p.openInShell,loading:p.shellLoading,error:!!p.shellError,icon:v.Terminal,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(S.TooltipContent,{children:"Open in Shell"})]})}),(0,t.jsx)(S.TooltipProvider,{children:(0,t.jsxs)(S.Tooltip,{children:[(0,t.jsx)(S.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(_.ActionButton,{label:"Open Folder",onClick:p.openFolder,loading:p.folderLoading,error:!!p.folderError,icon:b.FolderOpen,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(S.TooltipContent,{children:"Open Folder"})]})}),(0,t.jsx)(F.FeatureSessionsDropdown,{repositoryPath:e.repositoryPath,includeWorktrees:!0,onCreateFromSession:A})]}):null,e.onAdd?(0,t.jsx)("div",{className:"ml-1.5"}):null,e.onAdd?(0,t.jsx)(S.TooltipProvider,{children:(0,t.jsxs)(S.Tooltip,{children:[(0,t.jsx)(S.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("button",{"aria-label":"New feature","data-testid":"repository-node-add-button",onClick:t=>{t.stopPropagation(),e.onAdd?.()},className:(0,d.cn)("flex h-6 shrink-0 cursor-pointer items-center gap-0.5 rounded bg-blue-500 px-1.5 text-[11px] font-bold text-white transition-colors hover:bg-blue-600 dark:bg-amber-500 dark:hover:bg-amber-400",e.pulseAdd&&"animate-pulse-cta"),children:[(0,t.jsx)(c.Plus,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"translate-y-px",children:"New"})]})}),(0,t.jsx)(S.TooltipContent,{side:"top",children:"New feature"})]})}):null]})]}),e.branch?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"data-testid":"repository-node-git-info",className:"text-muted-foreground border-border/50 border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-3 text-xs",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1 truncate","data-testid":"repository-node-branch",children:[(0,t.jsx)(j.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.branch})]}),null!=e.behindCount&&e.behindCount>0?(0,t.jsxs)("span",{className:"flex shrink-0 items-center gap-1 whitespace-nowrap text-amber-500","data-testid":"repository-node-behind",children:[(0,t.jsx)(N.ArrowDown,{className:"h-3 w-3 shrink-0"}),e.behindCount," behind"]}):null]})}),e.commitMessage?(0,t.jsx)("div",{"data-testid":"repository-node-commit-info",className:"text-muted-foreground border-border/50 border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,t.jsx)(E.GitCommitHorizontal,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 truncate","data-testid":"repository-node-commit-message",children:e.commitMessage}),e.committer?(0,t.jsxs)("span",{className:"text-muted-foreground/70 ml-auto flex shrink-0 items-center gap-1","data-testid":"repository-node-committer",children:[(0,t.jsx)(C,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{children:e.committer})]}):null]})}):null]}):"not-a-repo"===e.gitInfoStatus?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"data-testid":"repository-node-not-repo",className:"text-muted-foreground border-border/50 border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,t.jsx)(b.FolderOpen,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 truncate opacity-60",children:e.repositoryPath??"Unknown path"})]})}),(0,t.jsx)("div",{className:"text-muted-foreground border-border/50 border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs opacity-40",children:[(0,t.jsx)(j.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{children:"Not a git repository"})]})})]}):"ready"!==e.gitInfoStatus?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"data-testid":"repository-node-git-loading",className:"border-border/50 border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex h-4 items-center gap-2 text-xs",children:[(0,t.jsx)(j.GitBranch,{className:"text-muted-foreground h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:"bg-muted h-3 w-20 animate-pulse rounded"})]})}),(0,t.jsx)("div",{className:"border-border/50 border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex h-4 items-center gap-2 text-xs",children:[(0,t.jsx)(E.GitCommitHorizontal,{className:"text-muted-foreground h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:"bg-muted h-3 w-36 animate-pulse rounded"})]})})]}):null,i.envDeploy&&e.repositoryPath?(0,t.jsx)("div",{"data-testid":"repository-node-dev-preview",className:"border-border/50 border-t px-4 py-2",onClick:e=>e.stopPropagation(),children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[T.deployError?(0,t.jsx)("span",{className:"truncate text-xs text-red-500",children:T.deployError}):L?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"mr-0.5 inline-block h-2 w-2 shrink-0 rounded-full bg-green-500"}),T.url?(0,t.jsx)("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"truncate text-green-700 hover:underline dark:text-green-400",children:T.url}):(0,t.jsx)("span",{className:"text-muted-foreground",children:"Starting..."})]}):(0,t.jsxs)("span",{className:"text-muted-foreground",children:["Run",(0,t.jsx)("span",{className:"text-muted-foreground/50 ml-2 text-[10px]",children:"start local environment"})]}),(0,t.jsx)(S.TooltipProvider,{children:(0,t.jsxs)(S.Tooltip,{children:[(0,t.jsx)(S.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:(0,d.cn)("ml-auto flex items-center",!L&&!T.deployError&&"[&_button]:text-green-600 [&_button]:hover:text-green-700 dark:[&_button]:text-green-400 dark:[&_button]:hover:text-green-300"),children:(0,t.jsx)(_.ActionButton,{label:T.deployError?"Retry":L?"Stop Dev Server":"Start Dev Server",onClick:L?T.stop:T.deploy,loading:T.deployLoading||T.stopLoading,error:!1,icon:T.deployError?u.RotateCcw:L?k.Square:w.Play,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(S.TooltipContent,{children:L?"Stop Dev Server":"Start Dev Server"})]})})]})}):null]}),e.onAdd||e.showHandles?(0,t.jsx)(r.Handle,{type:"source",position:g.Position.Right,isConnectable:!e.showHandles,className:"opacity-0!",style:{top:70}}):null]})}function L(e){let[n]=(0,g.getBezierPath)({sourceX:e.sourceX,sourceY:e.sourceY,targetX:e.targetX,targetY:e.targetY,sourcePosition:e.sourcePosition,targetPosition:e.targetPosition});return(0,t.jsx)(r.BaseEdge,{id:e.id,path:n,style:{strokeDasharray:"5 5"}})}e.i(1650),e.i(45811),e.i(25235);let A={x:30,y:30,zoom:.85};function D({onResetViewport:e}){let{setViewport:n}=(0,r.useReactFlow)(),o=(0,a.useCallback)(()=>{n(e(),{duration:400})},[e,n]);return(0,t.jsx)(r.ControlButton,{onClick:o,title:"Reset view","aria-label":"Reset view",children:(0,t.jsx)(u.RotateCcw,{style:{fill:"none"}})})}function I({nodes:e,edges:n,selectedFeatureId:o,selectedRepository:s,defaultViewport:i,onNodesChange:l,onAddFeature:u,onConnect:g,onNodeClick:m,onPaneClick:x,onCanvasDrag:v,onMoveEnd:b,onResetViewport:y,toolbar:w,emptyState:k}){let j=(0,a.useMemo)(()=>({featureNode:p.FeatureNode,repositoryNode:T}),[]),E=(0,a.useMemo)(()=>({dependencyEdge:L}),[]),N=(0,a.useMemo)(()=>{let t=null!=o,r=null!=s&&(null!=s.id||null!=s.path);return t||r?e.map(e=>{if(t&&"featureNode"===e.type&&e.data.featureId===o)return{...e,selected:!0};if(r&&"repositoryNode"===e.type){let t=e.data,r=null!=s.id&&(e.id===s.id||t.id===s.id),n=null!=s.path&&t.repositoryPath===s.path;if(r||n)return{...e,selected:!0}}return e}):e},[e,o,s]),C=0===e.length,[_,O]=(0,a.useState)(C),[S,R]=(0,a.useState)(!1),M=(0,a.useRef)(C);(0,a.useEffect)(()=>{if(M.current&&!C){R(!0);let e=setTimeout(()=>{O(!1),R(!1)},300);return M.current=C,()=>clearTimeout(e)}!M.current&&C&&O(!0),M.current=C},[C]);let P=C&&!k?(0,t.jsx)(f.EmptyState,{title:"No features yet",description:"Get started by creating your first feature.",action:(0,t.jsxs)(h.Button,{onClick:u,children:[(0,t.jsx)(c.Plus,{className:"mr-2 h-4 w-4"}),"New Feature"]})}):null,F=k??P;return(0,t.jsxs)("div",{"data-testid":C?"features-canvas-empty":"features-canvas","data-no-drawer-close":!0,className:"dark:bg-background pointer-events-auto relative h-full w-full bg-[#f6f7f8]",children:[(0,t.jsxs)(r.ReactFlow,{nodes:N,edges:n,nodeTypes:j,edgeTypes:E,onConnect:g,onNodesChange:l,onNodeClick:m,onPaneClick:x,onMoveStart:v,onMoveEnd:b,defaultViewport:i??A,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},className:"[&_.react-flow__pane]:!cursor-default",children:[(0,t.jsx)(r.Background,{variant:r.BackgroundVariant.Dots,gap:24,size:1,color:"#b8bcc4",className:"dark:[&_circle]:!fill-white/[0.1]"}),!C&&(0,t.jsx)(r.Controls,{showInteractive:!1,children:y?(0,t.jsx)(D,{onResetViewport:y}):null}),w]}),_&&F?(0,t.jsx)("div",{className:(0,d.cn)("pointer-events-none absolute inset-0 z-10 flex items-center justify-center transition-opacity duration-300",S?"opacity-0":"animate-in fade-in opacity-100 duration-200"),children:(0,t.jsx)("div",{className:"pointer-events-auto h-full w-full",children:F})}):null]})}var $=e.i(5147),z=e.i(8361),G=e.i(30153);let B="shep-canvas-viewport",U={x:30,y:30,zoom:.85};var q=e.i(33548),W=e.i(23925),H=e.i(83428),V=e.i(35e3),X=e.i(79687),J=e.i(99105),K=e.i(30702),Y=e.i(78521);e.i(13322);var Q=e.i(61201),Z=e.i(21023);let ee=(0,Z.createServerReference)("007fdf65f3e7f35c5393f6c399f8537da6f2e699e3",Z.callServer,void 0,Z.findSourceMapURL,"isAgentSetupComplete"),et=(0,Z.createServerReference)("00471a2eae954710269653932b3c791a3399bc26db",Z.callServer,void 0,Z.findSourceMapURL,"checkAgentAuth"),er=(0,Z.createServerReference)("008639d6b465e33498dd04219d4fe7b5996fbc3cbb",Z.callServer,void 0,Z.findSourceMapURL,"checkToolStatus");var en=e.i(11345),ea=e.i(58481),eo=e.i(66967),es=e.i(22503),ei=e.i(86782),el=e.i(29847);let ed=["select-agent","select-model"];function ec({onComplete:e,className:r}){let[n,o]=(0,a.useState)([]),[s,i]=(0,a.useState)(!0),[l,c]=(0,a.useState)("select-agent"),[u,h]=(0,a.useState)(null),[f,p]=(0,a.useState)(!1),[g,m]=(0,a.useState)(!1),[x,v]=(0,a.useState)(!0),b=(0,a.useRef)(void 0);(0,a.useEffect)(()=>{(0,eo.getAllAgentModels)().then(o).finally(()=>i(!1))},[]);let y=u?n.find(e=>e.agentType===u):null,w=(0,a.useCallback)((e,t)=>{m(!0),v(!1),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{t?.(),c(e),requestAnimationFrame(()=>{v(!0),m(!1)})},150)},[]);(0,a.useEffect)(()=>()=>{b.current&&clearTimeout(b.current)},[]);let k=(0,a.useCallback)(async(t,r)=>{p(!0);try{await (0,es.updateAgentAndModel)(t,r),v(!1),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{e()},200)}catch{p(!1)}},[e]),j=(0,a.useCallback)(e=>{let t=n.find(t=>t.agentType===e);t&&t.models.length>0?w("select-model",()=>{h(e)}):k(e,null)},[n,w,k]),E=(0,a.useCallback)(e=>{u&&k(u,e)},[u,k]),N=(0,a.useCallback)(()=>{"select-model"===l&&w("select-agent",()=>{h(null)})},[l,w]);if(s)return(0,t.jsxs)("div",{"data-testid":"welcome-agent-setup",className:(0,d.cn)("flex flex-col items-center justify-center gap-4",r),children:[(0,t.jsx)(H.Loader2,{className:"text-muted-foreground h-5 w-5 animate-spin"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:"Loading agents…"})]});let C=ed.indexOf(l),_="select-agent"===l?"Choose your agent":"Pick a model",O="select-agent"===l?"Select the AI coding agent you want Shep to use.":y?`Choose which ${y.label} model to run.`:"";return(0,t.jsxs)("div",{"data-testid":"welcome-agent-setup",className:(0,d.cn)("flex w-full flex-col items-center",r),children:[(0,t.jsx)("div",{className:"mb-8 flex w-full max-w-xs items-center gap-1.5",children:ed.map((e,r)=>(0,t.jsx)("div",{className:(0,d.cn)("h-[3px] flex-1 rounded-full transition-colors duration-300",r<=C?"bg-foreground/60":"bg-muted")},e))}),(0,t.jsxs)("div",{className:(0,d.cn)("flex w-full flex-col items-center transition-opacity duration-200",x&&!g?"opacity-100":"opacity-0"),children:[(0,t.jsx)("h1",{className:"text-foreground/90 text-center text-5xl font-extralight tracking-tight",children:_}),(0,t.jsx)("p",{className:"text-muted-foreground mt-3 text-center text-lg leading-relaxed font-light",children:O}),"select-agent"===l&&(0,t.jsxs)("div",{"data-testid":"gh-cli-notice",className:"mt-5 flex items-start gap-2 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 dark:border-amber-900 dark:bg-amber-950/40",children:[(0,t.jsx)(ea.AlertTriangle,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-500"}),(0,t.jsxs)("p",{className:"text-sm leading-relaxed text-amber-800 dark:text-amber-300",children:[(0,t.jsx)("span",{className:"font-medium",children:"GitHub CLI (gh)"})," is required for full CI/CD self-healing capabilities."," ",(0,t.jsx)("a",{href:"https://cli.github.com/",target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-amber-900 dark:hover:text-amber-200",children:"Install it here"}),"."]})]}),(0,t.jsxs)("div",{className:"mt-8 flex w-full flex-col items-center",children:["select-agent"===l&&(0,t.jsx)("div",{"data-testid":"agent-list",className:"grid w-full max-w-lg gap-3",style:{gridTemplateColumns:`repeat(${Math.min(n.length,4)}, minmax(0, 1fr))`},children:n.map(e=>{let r=(0,ei.getAgentTypeIcon)(e.agentType);return(0,t.jsxs)("button",{type:"button",disabled:f,"data-testid":`agent-option-${e.agentType}`,className:"border-border hover:bg-accent hover:border-foreground/20 flex cursor-pointer flex-col items-center gap-3 rounded-2xl border px-4 py-5 transition-all duration-150 active:scale-[0.97] disabled:opacity-50",onClick:()=>j(e.agentType),children:[(0,t.jsx)(r,{className:"text-foreground/70 h-7 w-7"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:e.label})]},e.agentType)})}),"select-model"===l&&y?(0,t.jsxs)("div",{"data-testid":"model-list",className:"flex w-full max-w-lg flex-col items-center gap-4",children:[(0,t.jsxs)("button",{type:"button",disabled:f,className:"text-muted-foreground hover:text-foreground flex cursor-pointer items-center gap-1.5 self-start text-sm transition-colors",onClick:N,children:[(0,t.jsx)(en.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,t.jsx)("div",{className:"grid w-full gap-3",style:{gridTemplateColumns:`repeat(${Math.min(y.models.length,3)}, minmax(0, 1fr))`},children:y.models.map(e=>{let r=(0,el.getModelMeta)(e.id);return(0,t.jsxs)("button",{type:"button",disabled:f,"data-testid":`model-option-${e.id}`,className:"border-border hover:bg-accent hover:border-foreground/20 flex cursor-pointer flex-col items-center gap-2 rounded-2xl border px-4 py-5 text-center transition-all duration-150 active:scale-[0.97] disabled:opacity-50",onClick:()=>E(e.id),children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:r.displayName||e.displayName}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs leading-tight",children:r.description||e.description})]},e.id)})})]}):null]})]})]})}let eu=["cd ~/my-repo",'shep feat new "sleek dashboard"'];function eh({onRepositorySelect:e,className:r}){let[n,o]=(0,a.useState)(!1),[s,i]=(0,a.useState)(!1),[l,c]=(0,a.useState)(!1),[u,h]=(0,a.useState)(null),[f,p]=(0,a.useState)(null),[g,m]=(0,a.useState)(!1),[x,y]=(0,a.useState)(null),{reactFileManager:w}=(0,M.useFeatureFlags)();async function k(){if(!s){if(w)return void c(!0);i(!0);try{let t=await (0,Y.pickFolder)();t&&e?.(t)}catch{c(!0)}finally{i(!1)}}}(0,a.useEffect)(()=>{ee().then(e=>{h(e)})},[]),(0,a.useEffect)(()=>{u&&(et().then(p),er().then(y))},[u]);let j=(0,a.useCallback)(async()=>{await navigator.clipboard.writeText(eu.join("\n")),o(!0),setTimeout(()=>o(!1),2e3)},[]),E=(0,a.useCallback)(()=>{h(!0)},[]),N=(0,a.useCallback)(()=>{p(null),et().then(p)},[]);return null===u?null:(0,t.jsxs)("div",{"data-testid":"control-center-empty-state",className:(0,d.cn)("relative flex h-full w-full flex-col items-center justify-center px-8",r),children:[u?(0,t.jsxs)("div",{className:"animate-in fade-in flex w-full max-w-md flex-col items-center duration-300",children:[(0,t.jsx)("h1",{className:"text-foreground/90 text-center text-5xl font-extralight tracking-tight",children:"Add a project"}),(0,t.jsxs)("p",{className:"text-muted-foreground mt-3 text-center text-lg leading-relaxed font-light",children:["Add your project folder to unlock feature creation.",(0,t.jsx)("br",{}),"Describe what you need — Shep handles the rest."]}),(0,t.jsxs)("div",{className:"mt-8 flex w-full flex-col gap-3",children:[(0,t.jsx)(ef,{status:f,onRetry:N}),(0,t.jsx)(ep,{label:"Git",status:x?.git??null,missingHint:"Required for all phases"}),(0,t.jsx)(ep,{label:"GitHub CLI",status:x?.gh??null,missingHint:"Required for pull requests"})]}),(0,t.jsxs)("button",{type:"button","data-testid":"empty-state-add-repository",onClick:k,disabled:s,className:"bg-foreground text-background hover:bg-foreground/90 mt-10 flex w-full cursor-pointer items-center justify-center gap-2.5 rounded-xl px-6 py-4 text-base font-medium shadow-lg transition-all duration-200 hover:shadow-xl active:scale-[0.98] disabled:cursor-wait disabled:opacity-50",children:[s?(0,t.jsx)(H.Loader2,{className:"h-5 w-5 animate-spin"}):(0,t.jsx)(b.FolderOpen,{className:"h-5 w-5"}),s?"Opening…":"Choose a Folder"]}),(0,t.jsx)("p",{className:"text-muted-foreground/60 mt-3 text-center text-sm",children:"Any folder works — git will be initialized automatically if needed."})]}):(0,t.jsx)(ec,{onComplete:E}),u?(0,t.jsxs)("div",{className:"absolute bottom-8 flex flex-col items-center",style:{animationDelay:"400ms",animationDuration:"600ms",animationFillMode:"both"},children:[(0,t.jsxs)("button",{type:"button",onClick:()=>m(!g),className:"text-muted-foreground hover:text-foreground flex cursor-pointer items-center gap-1.5 transition-colors duration-200",children:[(0,t.jsx)(v.Terminal,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-sm",children:"or use the CLI"}),(0,t.jsx)(J.ChevronDown,{className:(0,d.cn)("h-3.5 w-3.5 transition-transform duration-200",g?"":"rotate-180")})]}),g?(0,t.jsx)("div",{className:"animate-in fade-in slide-in-from-top-1 mt-3 w-80 duration-200",children:(0,t.jsxs)("div",{"data-testid":"cli-code-block",className:"relative rounded-xl bg-zinc-900 px-5 py-4 font-mono text-[13px] leading-relaxed text-zinc-400",children:[(0,t.jsx)("button",{type:"button","data-testid":"cli-code-block-copy",onClick:j,className:"absolute top-3 right-3 cursor-pointer rounded-md p-1.5 text-zinc-600 transition-colors hover:bg-zinc-800 hover:text-zinc-300","aria-label":"Copy commands",children:n?(0,t.jsx)(W.Check,{className:"h-3.5 w-3.5 text-emerald-400"}):(0,t.jsx)(q.Copy,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("div",{className:"space-y-1",children:eu.map(e=>(0,t.jsxs)("div",{className:"whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-zinc-600 select-none",children:"$ "}),(0,t.jsx)("span",{className:"text-zinc-300",children:e})]},e))})]})}):null]}):null,(0,t.jsx)(Q.ReactFileManagerDialog,{open:l,onOpenChange:e=>{e||c(!1)},onSelect:function(t){t&&e?.(t),c(!1)}})]})}function ef({status:e,onRetry:r}){return e?e.installed&&e.authenticated?(0,t.jsx)(eg,{icon:(0,t.jsx)(V.CheckCircle2,{className:"h-4 w-4 text-emerald-500"}),children:(0,t.jsxs)("span",{className:"text-sm text-emerald-600 dark:text-emerald-400",children:[e.label," ready"]})}):e.installed?(0,t.jsxs)(eg,{icon:(0,t.jsx)(X.AlertCircle,{className:"h-4 w-4 text-amber-500"}),children:[(0,t.jsxs)("span",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:[e.label," needs authentication"]}),e.authCommand?(0,t.jsx)(em,{command:e.authCommand}):null,(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[e.binaryName?(0,t.jsxs)("button",{type:"button","data-testid":"auth-banner-open-terminal",onClick:async()=>{try{let t="claude-code"===e.agentType?"claude-code":e.agentType;await fetch(`/api/tools/${t}/launch`,{method:"POST"})}catch{}},className:"flex items-center gap-1 text-xs font-medium text-amber-600 underline underline-offset-2 hover:text-amber-800 dark:text-amber-400",children:[(0,t.jsx)(v.Terminal,{className:"h-3 w-3"}),"Open ",e.label]}):null,(0,t.jsx)("button",{type:"button",onClick:r,className:"text-xs text-amber-600 underline underline-offset-2 hover:text-amber-800 dark:text-amber-400",children:"Re-check"})]})]}):(0,t.jsxs)(eg,{icon:(0,t.jsx)(X.AlertCircle,{className:"h-4 w-4 text-amber-500"}),children:[(0,t.jsxs)("span",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:[e.label," not installed"]}),e.installCommand?(0,t.jsx)(em,{command:e.installCommand}):null,(0,t.jsx)("button",{type:"button",onClick:r,className:"text-xs text-amber-600 underline underline-offset-2 hover:text-amber-800 dark:text-amber-400",children:"Re-check"})]}):(0,t.jsx)(eg,{icon:(0,t.jsx)(H.Loader2,{className:"text-muted-foreground/50 h-4 w-4 animate-spin"}),children:(0,t.jsx)("span",{className:"text-muted-foreground/50 text-sm",children:"Checking setup…"})})}function ep({label:e,status:r,missingHint:n}){return r?r.installed?(0,t.jsx)(eg,{icon:(0,t.jsx)(V.CheckCircle2,{className:"h-4 w-4 text-emerald-500"}),children:(0,t.jsxs)("span",{className:"flex items-baseline gap-2",children:[(0,t.jsxs)("span",{className:"text-sm text-emerald-600 dark:text-emerald-400",children:[e," ready"]}),r.version?(0,t.jsxs)("span",{className:"text-muted-foreground/40 text-xs",children:["v",r.version]}):null]})}):(0,t.jsxs)(eg,{icon:(0,t.jsx)(X.AlertCircle,{className:"h-4 w-4 text-amber-500"}),children:[(0,t.jsxs)("span",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:[e," not found"]}),(0,t.jsx)("span",{className:"text-muted-foreground/50 text-xs",children:n}),r.installCommand?(0,t.jsx)(em,{command:r.installCommand}):null,r.installUrl?(0,t.jsxs)("a",{href:r.installUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-amber-600 underline underline-offset-2 hover:text-amber-800 dark:text-amber-400",children:["Docs ",(0,t.jsx)(K.ExternalLink,{className:"h-3 w-3"})]}):null]}):(0,t.jsx)(eg,{icon:(0,t.jsx)(H.Loader2,{className:"text-muted-foreground/50 h-4 w-4 animate-spin"}),children:(0,t.jsxs)("span",{className:"text-muted-foreground/50 text-sm",children:["Checking ",e,"…"]})})}function eg({icon:e,children:r}){return(0,t.jsxs)("div",{className:"animate-in fade-in flex items-start gap-2.5",children:[(0,t.jsx)("div",{className:"mt-0.5 shrink-0",children:e}),(0,t.jsx)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:r})]})}function em({command:e}){let[r,n]=(0,a.useState)(!1);return(0,t.jsxs)("button",{type:"button",onClick:async()=>{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)},className:"group/cmd flex cursor-pointer items-center justify-between gap-2 rounded-md bg-zinc-100 py-1 pr-2 pl-2.5 text-left transition-colors hover:bg-zinc-200 dark:bg-zinc-800 dark:hover:bg-zinc-700",children:[(0,t.jsx)("code",{className:"min-w-0 truncate text-[11px] leading-relaxed text-zinc-600 dark:text-zinc-300",children:e}),r?(0,t.jsx)(W.Check,{className:"h-3 w-3 shrink-0 text-emerald-500"}):(0,t.jsx)(q.Copy,{className:"h-3 w-3 shrink-0 text-zinc-400 opacity-0 transition-opacity group-hover/cmd:opacity-100"})]})}var ex=e.i(17840);let ev={maxZoom:1,padding:.5,duration:500};function eb({initialNodes:e,initialEdges:n}){let i,c,u,h,f,p,g=(0,o.useRouter)(),m=(0,o.usePathname)(),x=(i=(0,o.usePathname)().match(/^\/feature\/([^/]+)/),i?.[1]??null),v=(c=(0,o.usePathname)(),u=(0,o.useSearchParams)(),h=c.match(/^\/repository\/([^/]+)/),{id:h?.[1]??null,path:c.startsWith("/create")?u.get("repo"):null}),b=(0,z.useSoundAction)("click"),{guardedNavigate:y}=(0,G.useDrawerCloseGuard)(),{fitView:w}=(0,r.useReactFlow)(),k=(0,a.useRef)(null),{defaultViewport:j,onMoveEnd:E,resetViewport:N}=(f=(0,a.useRef)(function(){try{let e=localStorage.getItem(B);if(null==e)return U;let t=JSON.parse(e);return!(null==t||"object"!=typeof t||Array.isArray(t))&&"number"==typeof t.x&&"number"==typeof t.y&&"number"==typeof t.zoom&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.zoom)&&t.zoom>0?t:U}catch{return U}}()).current,p=(0,a.useRef)(null),(0,a.useEffect)(()=>()=>{null!=p.current&&clearTimeout(p.current)},[]),{defaultViewport:f,onMoveEnd:(0,a.useCallback)(e=>{null!=p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{try{localStorage.setItem(B,JSON.stringify(e))}catch{}},500)},[]),resetViewport:(0,a.useCallback)(()=>{try{localStorage.removeItem(B)}catch{}return U},[])}),{nodes:C,edges:_,onNodesChange:O,handleConnect:S,handleAddRepository:R,handleArchiveFeature:M,handleDeleteFeature:P,handleRetryFeature:F,handleStartFeature:T,handleStopFeature:L,handleUnarchiveFeature:A,handleDeleteRepository:D,createFeatureNode:q,showArchived:W,setShowArchived:H,setCallbacks:V}=(0,ex.useControlCenterState)(e,n),{setFeatures:X,setHasRepositories:J}=(0,$.useSidebarFeaturesContext)(),K=(0,a.useMemo)(()=>C.filter(e=>"featureNode"===e.type),[C]),Y=(0,a.useMemo)(()=>K.map(e=>{let t=e.data;return`${t.featureId}:${t.state}:${t.name}`}).sort().join(","),[K]);(0,a.useEffect)(()=>{X(K.map(e=>{let t=e.data,r=(0,$.mapNodeStateToSidebarStatus)(t.state);return r?{featureId:t.featureId,name:t.name,status:r,...null!=t.startedAt&&{startedAt:t.startedAt},...null!=t.runtime&&{duration:t.runtime},...t.agentType&&{agentType:t.agentType},...t.modelId&&{modelId:t.modelId}}:null}).filter(Boolean))},[Y,K,X]);let Q=(0,a.useCallback)((e,t)=>{if("featureNode"===t.type){let r=t.data;"creating"!==r.state&&"deleting"!==r.state&&e.target.closest('[data-testid="feature-node-card"]')&&y(()=>{b.play(),g.push(`/feature/${r.featureId}`)})}},[g,b,y]),Z=(0,a.useCallback)(()=>{b.play(),g.push("/create")},[g,b]),ee=(0,a.useCallback)(e=>{b.play();let t=C.find(t=>t.id===e),r=t?.data?.repositoryPath;r?g.push(`/create?repo=${encodeURIComponent(r)}`):g.push("/create")},[C,g,b]),et=(0,a.useCallback)(e=>{let t=e.startsWith("feat-")?e.slice(5):e,r=_.find(t=>t.target===e),n=r?C.find(e=>e.id===r.source):null,a=n?.data?.repositoryPath;b.play();let o=new URLSearchParams;a&&o.set("repo",a),o.set("parent",t),g.push(`/create?${o.toString()}`)},[C,_,g,b]),er=(0,a.useCallback)(e=>{let t=C.find(t=>t.id===e);if(t?.type==="repositoryNode"){let e=t.data;e.id&&y(()=>g.push(`/repository/${e.id}`))}},[C,g,y]),en=(0,a.useCallback)(()=>{"/"!==m&&y(()=>g.push("/"))},[g,m,y]),ea=(0,a.useCallback)(e=>{setTimeout(()=>{w(ev),k.current=setTimeout(()=>{y(()=>g.push(`/create?repo=${encodeURIComponent(e)}`))},600)},0)},[w,y,g]),eo=(0,a.useCallback)(e=>{let{wasEmpty:t,repoPath:r}=R(e);t&&ea(r)},[R,ea]);(0,a.useEffect)(()=>{let e=e=>{eo(e.detail.path)};return window.addEventListener("shep:add-repository",e),()=>{window.removeEventListener("shep:add-repository",e),null!=k.current&&clearTimeout(k.current)}},[eo]),(0,a.useEffect)(()=>{let e=e=>{let t=e.detail;if(t.parentId)return void q(`feat-${t.parentId}`,{state:"creating",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath},"dependencyEdge");let r=C.find(e=>"repositoryNode"===e.type&&e.data.repositoryPath===t.repositoryPath);q(r?.id??null,{state:"running",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath})};return window.addEventListener("shep:feature-created",e),()=>window.removeEventListener("shep:feature-created",e)},[C,q]),(0,a.useEffect)(()=>{let e=e=>{let{featureId:t,cleanup:r,cascadeDelete:n,closePr:a}=e.detail;P(t,r,n,a)};return window.addEventListener("shep:feature-delete-requested",e),()=>window.removeEventListener("shep:feature-delete-requested",e)},[P]),(0,a.useEffect)(()=>{let e=e=>{let{featureId:t}=e.detail;M(t)};return window.addEventListener("shep:feature-archive-requested",e),()=>window.removeEventListener("shep:feature-archive-requested",e)},[M]),(0,a.useEffect)(()=>{let e=e=>{let{featureId:t}=e.detail;A(t)};return window.addEventListener("shep:feature-unarchive-requested",e),()=>window.removeEventListener("shep:feature-unarchive-requested",e)},[A]),(0,a.useEffect)(()=>{V({onNodeAction:et,onFeatureDelete:P,onRetryFeature:F,onStartFeature:T,onStopFeature:L,onArchiveFeature:M,onUnarchiveFeature:A,onRepositoryAdd:ee,onRepositoryClick:er,onRepositoryDelete:D})},[V,et,M,P,F,T,L,A,ee,er,D]);let es=(0,a.useCallback)((e,t)=>{E(t)},[E]),ei=C.some(e=>"repositoryNode"===e.type);(0,a.useEffect)(()=>{J(ei)},[ei,J]);let[el,ed]=(0,a.useState)(ei),ec=(0,a.useRef)(null);(0,a.useEffect)(()=>(ei?(ec.current&&(clearTimeout(ec.current),ec.current=null),ed(!0)):el&&(N(),ec.current=setTimeout(()=>{ed(!1),ec.current=null},500)),()=>{ec.current&&clearTimeout(ec.current)}),[ei,el,N]);let eu=m.startsWith("/create"),ef=(0,a.useMemo)(()=>{let e=C.filter(e=>"repositoryNode"===e.type),t=C.some(e=>"featureNode"===e.type);return 1!==e.length||t||eu?C:C.map(e=>"repositoryNode"===e.type?{...e,data:{...e.data,pulseAdd:!0}}:e)},[C,eu]),ep=(0,t.jsx)(r.Panel,{position:"top-right",children:(0,t.jsxs)("button",{type:"button","aria-label":W?"Hide archived features":"Show archived features","data-testid":"archive-toggle-button",onClick:()=>H(!W),className:(0,d.cn)("bg-card flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-xs font-medium shadow-sm transition-colors",W?"border-primary/30 text-primary":"text-muted-foreground hover:text-foreground"),children:[W?(0,t.jsx)(s.Eye,{className:"h-3.5 w-3.5"}):(0,t.jsx)(l,{className:"h-3.5 w-3.5"}),W?"Archived visible":"Show archived"]})});return(0,t.jsx)(I,{nodes:el?ef:[],edges:el?_:[],selectedFeatureId:x,selectedRepository:v,defaultViewport:j,onNodesChange:O,onConnect:S,onAddFeature:Z,onNodeClick:Q,onPaneClick:en,onMoveEnd:es,onResetViewport:N,toolbar:ep,emptyState:(0,t.jsx)(eh,{onRepositorySelect:eo})})}function ey({initialNodes:e,initialEdges:a,drawer:o}){return(0,t.jsxs)("div",{"data-testid":"control-center",className:"h-full w-full",children:[(0,t.jsx)(n.SessionsProvider,{children:(0,t.jsx)(r.ReactFlowProvider,{children:(0,t.jsx)(eb,{initialNodes:e,initialEdges:a})})}),(0,t.jsx)("div",{children:o},"drawer")]})}e.s(["ControlCenter",()=>ey],48246)}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,93752,e=>{"use strict";let t=(0,e.i(3645).default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);e.s(["default",()=>t])},95230,e=>{"use strict";let t=(0,e.i(3645).default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);e.s(["default",()=>t])},16868,e=>{"use strict";let t=(0,e.i(3645).default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);e.s(["PaperclipIcon",()=>t],16868)},16298,e=>{"use strict";let t=(0,e.i(3645).default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["default",()=>t])},70471,e=>{"use strict";var t=e.i(16298);e.s(["FileText",()=>t.default])},48306,64764,80436,17087,28267,57484,e=>{"use strict";var t=e.i(20314),r=e.i(31777);function a({className:e,...a}){return(0,t.jsx)("textarea",{"data-slot":"textarea",className:(0,r.cn)("placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input field-sizing-content min-h-[80px] w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...a})}e.s(["Textarea",()=>a],48306);var s=e.i(15506);e.s(["Loader2Icon",()=>s.default],64764);var o=e.i(95230);e.s(["DownloadIcon",()=>o.default],80436);var i=e.i(3645);let n=(0,i.default)("sticky-note",[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]]);e.s(["StickyNoteIcon",()=>n],17087);var l=e.i(1693);e.s(["VisuallyHidden",0,l],28267);let d=(0,i.default)("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]);e.s(["FileIcon",()=>d],57484)},50032,86254,42076,e=>{"use strict";var t=e.i(20314),r=e.i(60253),a=e.i(64764),s=e.i(80436),o=e.i(17087),i=e.i(31777),n=e.i(2287),l=e.i(48306),d=e.i(2828),c=e.i(28267),p=e.i(57484),u=e.i(16298),u=u;let h=(0,e.i(3645).default)("image",[["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"}]]);var m=e.i(93752),m=m;e.i(35364);let x=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]),f=new Set([".ts",".tsx",".js",".jsx",".json",".yaml",".yml",".xml",".html",".css",".md"]);function g(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024));return`${(e/Math.pow(1024,t)).toFixed(+(0!==t))} ${["B","KB","MB","GB"][t]}`}let b=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]);function v(e,t){let r=new URLSearchParams({path:e,mimeType:t});return`/api/attachments/preview?${r.toString()}`}function j({name:e,size:j,mimeType:w,path:y,onRemove:C,loading:k=!1,disabled:N=!1,notes:T,onNotesChange:P}){let S,R,F=(S=e.lastIndexOf("."))>=0?e.slice(S).toLowerCase():"",A=x.has(F)?h:".pdf"===F?u.default:f.has(F)?m.default:p.FileIcon,E=".pdf"===F?"bg-red-50 text-red-600":x.has(F)?"bg-blue-50 text-blue-600":f.has(F)?"bg-emerald-50 text-emerald-600":"bg-gray-50 text-gray-600",D=(R=e.lastIndexOf("."))>=0&&b.has(e.slice(R).toLowerCase());if(k)return(0,t.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-md border",children:(0,t.jsx)(a.Loader2Icon,{className:"text-muted-foreground h-5 w-5 animate-spin"})});if(D){let a=(0,t.jsxs)("button",{type:"button",className:"relative block cursor-pointer rounded-md",children:[(0,t.jsx)("img",{src:v(y,w),alt:e,title:e,className:"h-12 w-12 rounded-md border object-cover transition-opacity hover:opacity-80"}),T?(0,t.jsx)("span",{className:"ring-background absolute -right-1 -bottom-1 flex h-4 w-4 items-center justify-center rounded-full bg-amber-500 text-white shadow-sm ring-2",children:(0,t.jsx)(o.StickyNoteIcon,{className:"h-2.5 w-2.5"})}):null]});return(0,t.jsx)(d.TooltipProvider,{delayDuration:200,children:(0,t.jsxs)(n.Dialog,{children:[(0,t.jsxs)(d.Tooltip,{children:[(0,t.jsxs)("div",{className:"group relative",children:[(0,t.jsx)(d.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(n.DialogTrigger,{asChild:!0,children:a})}),!N&&(0,t.jsx)("button",{type:"button",onClick:C,className:"absolute -top-1.5 -right-1.5 hidden h-5 w-5 cursor-pointer items-center justify-center rounded-full bg-black/70 text-white group-hover:flex","aria-label":`Remove ${e}`,children:(0,t.jsx)(r.X,{className:"h-3 w-3"})})]}),T?(0,t.jsx)(d.TooltipContent,{side:"bottom",className:"max-w-[220px] border border-amber-200 bg-amber-50 text-amber-950 dark:border-amber-800 dark:bg-amber-950 dark:text-amber-100",children:(0,t.jsx)("p",{className:"line-clamp-3 text-xs leading-snug",children:T})}):null]}),(0,t.jsxs)(n.DialogContent,{className:"max-w-3xl gap-0 overflow-hidden border-0 p-0 [&>button:last-child]:!cursor-pointer [&>button:last-child]:!rounded-full [&>button:last-child]:!bg-black/70 [&>button:last-child]:!p-1.5 [&>button:last-child]:!text-white [&>button:last-child]:!opacity-100 [&>button:last-child]:!shadow-lg [&>button:last-child]:!backdrop-blur-md [&>button:last-child]:hover:!bg-black/90",children:[(0,t.jsx)(c.VisuallyHidden.Root,{children:(0,t.jsxs)(n.DialogTitle,{children:["Preview: ",e]})}),(0,t.jsx)("div",{className:"relative bg-black/90",children:(0,t.jsx)("img",{src:v(y,w),alt:e,className:"h-auto max-h-[70vh] w-full object-contain"})}),(0,t.jsxs)("div",{className:"bg-background flex flex-col gap-2 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,t.jsx)("span",{className:"truncate text-sm font-medium",children:e}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:g(j)})]}),(0,t.jsx)("a",{href:v(y,w),download:e,className:"text-muted-foreground hover:text-foreground shrink-0 cursor-pointer rounded p-1.5 transition-colors","aria-label":`Download ${e}`,children:(0,t.jsx)(s.DownloadIcon,{className:"h-4 w-4"})})]}),P?(0,t.jsx)(l.Textarea,{placeholder:"Add notes about this image…",value:T??"",onChange:e=>P(e.target.value),rows:2,className:"resize-none text-sm","aria-label":"Image notes"}):T?(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:T}):null]})]})]})})}return(0,t.jsxs)("div",{className:"group relative flex items-center gap-2 rounded-full border py-1 pr-3 pl-2",children:[(0,t.jsx)("div",{className:(0,i.cn)("flex h-6 w-6 shrink-0 items-center justify-center rounded-full",E),children:(0,t.jsx)(A,{className:"h-3 w-3"})}),(0,t.jsx)("span",{className:"max-w-[120px] truncate text-sm",children:e}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:g(j)}),!N&&(0,t.jsx)("button",{type:"button",onClick:C,className:"absolute -top-1.5 -right-1.5 hidden h-5 w-5 cursor-pointer items-center justify-center rounded-full bg-black/70 text-white group-hover:flex","aria-label":`Remove ${e}`,children:(0,t.jsx)(r.X,{className:"h-3 w-3"})})]})}async function w(){let e=await fetch("/api/dialog/pick-files",{method:"POST"});if(!e.ok)throw Error("Failed to open file dialog");let t=await e.json();return t.cancelled?null:t.files}e.s(["AttachmentChip",()=>j],86254),e.s([],50032),e.s(["pickFiles",()=>w],42076)},90382,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(91967),s=e.i(5978),o=e.i(22528),i=e.i(53532),n=e.i(41687),l=e.i(56720),d=e.i(13123),c=e.i(52740),p=e.i(39979),u=e.i(85995),h=e.i(87620),m=e.i(86874),x=e.i(36589),f=e.i(73772),g=e.i(13044),b="Popover",[v,j]=(0,o.createContextScope)(b,[c.createPopperScope]),w=(0,c.createPopperScope)(),[y,C]=v(b),k=e=>{let{__scopePopover:a,children:s,open:o,defaultOpen:i,onOpenChange:n,modal:l=!1}=e,p=w(a),u=r.useRef(null),[h,m]=r.useState(!1),[f,g]=(0,x.useControllableState)({prop:o,defaultProp:i??!1,onChange:n,caller:b});return(0,t.jsx)(c.Root,{...p,children:(0,t.jsx)(y,{scope:a,contentId:(0,d.useId)(),triggerRef:u,open:f,onOpenChange:g,onOpenToggle:r.useCallback(()=>g(e=>!e),[g]),hasCustomAnchor:h,onCustomAnchorAdd:r.useCallback(()=>m(!0),[]),onCustomAnchorRemove:r.useCallback(()=>m(!1),[]),modal:l,children:s})})};k.displayName=b;var N="PopoverAnchor",T=r.forwardRef((e,a)=>{let{__scopePopover:s,...o}=e,i=C(N,s),n=w(s),{onCustomAnchorAdd:l,onCustomAnchorRemove:d}=i;return r.useEffect(()=>(l(),()=>d()),[l,d]),(0,t.jsx)(c.Anchor,{...n,...o,ref:a})});T.displayName=N;var P="PopoverTrigger",S=r.forwardRef((e,r)=>{let{__scopePopover:o,...i}=e,n=C(P,o),l=w(o),d=(0,s.useComposedRefs)(r,n.triggerRef),p=(0,t.jsx)(h.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":$(n.open),...i,ref:d,onClick:(0,a.composeEventHandlers)(e.onClick,n.onOpenToggle)});return n.hasCustomAnchor?p:(0,t.jsx)(c.Anchor,{asChild:!0,...l,children:p})});S.displayName=P;var R="PopoverPortal",[F,A]=v(R,{forceMount:void 0}),E=e=>{let{__scopePopover:r,forceMount:a,children:s,container:o}=e,i=C(R,r);return(0,t.jsx)(F,{scope:r,forceMount:a,children:(0,t.jsx)(u.Presence,{present:a||i.open,children:(0,t.jsx)(p.Portal,{asChild:!0,container:o,children:s})})})};E.displayName=R;var D="PopoverContent",I=r.forwardRef((e,r)=>{let a=A(D,e.__scopePopover),{forceMount:s=a.forceMount,...o}=e,i=C(D,e.__scopePopover);return(0,t.jsx)(u.Presence,{present:s||i.open,children:i.modal?(0,t.jsx)(M,{...o,ref:r}):(0,t.jsx)(O,{...o,ref:r})})});I.displayName=D;var z=(0,m.createSlot)("PopoverContent.RemoveScroll"),M=r.forwardRef((e,o)=>{let i=C(D,e.__scopePopover),n=r.useRef(null),l=(0,s.useComposedRefs)(o,n),d=r.useRef(!1);return r.useEffect(()=>{let e=n.current;if(e)return(0,f.hideOthers)(e)},[]),(0,t.jsx)(g.RemoveScroll,{as:z,allowPinchZoom:!0,children:(0,t.jsx)(L,{...e,ref:l,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,a.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),d.current||i.triggerRef.current?.focus()}),onPointerDownOutside:(0,a.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;d.current=2===t.button||r},{checkForDefaultPrevented:!1}),onFocusOutside:(0,a.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),O=r.forwardRef((e,a)=>{let s=C(D,e.__scopePopover),o=r.useRef(!1),i=r.useRef(!1);return(0,t.jsx)(L,{...e,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||s.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));let r=t.target;s.triggerRef.current?.contains(r)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),L=r.forwardRef((e,r)=>{let{__scopePopover:a,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:d,disableOutsidePointerEvents:p,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:x,...f}=e,g=C(D,a),b=w(a);return(0,n.useFocusGuards)(),(0,t.jsx)(l.FocusScope,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:d,children:(0,t.jsx)(i.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:p,onInteractOutside:x,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:m,onDismiss:()=>g.onOpenChange(!1),children:(0,t.jsx)(c.Content,{"data-state":$(g.open),role:"dialog",id:g.contentId,...b,...f,ref:r,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),U="PopoverClose",B=r.forwardRef((e,r)=>{let{__scopePopover:s,...o}=e,i=C(U,s);return(0,t.jsx)(h.Primitive.button,{type:"button",...o,ref:r,onClick:(0,a.composeEventHandlers)(e.onClick,()=>i.onOpenChange(!1))})});B.displayName=U;var H=r.forwardRef((e,r)=>{let{__scopePopover:a,...s}=e,o=w(a);return(0,t.jsx)(c.Arrow,{...o,...s,ref:r})});function $(e){return e?"open":"closed"}H.displayName="PopoverArrow",e.s(["Anchor",()=>T,"Arrow",()=>H,"Close",()=>B,"Content",()=>I,"Popover",()=>k,"PopoverAnchor",()=>T,"PopoverArrow",()=>H,"PopoverClose",()=>B,"PopoverContent",()=>I,"PopoverPortal",()=>E,"PopoverTrigger",()=>S,"Portal",()=>E,"Root",()=>k,"Trigger",()=>S,"createPopoverScope",()=>j],89920);var q=e.i(89920),q=q,G=e.i(31777);let V=q.Root,_=q.Trigger;q.Anchor;let K=r.forwardRef(({className:e,align:r="center",sideOffset:a=4,...s},o)=>(0,t.jsx)(q.Portal,{children:(0,t.jsx)(q.Content,{ref:o,align:r,sideOffset:a,className:(0,G.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...s})}));K.displayName=q.Content.displayName,e.s(["Popover",()=>V,"PopoverContent",()=>K,"PopoverTrigger",()=>_],90382)},83843,e=>{"use strict";let t=(0,e.i(3645).default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);e.s(["ChevronsUpDown",()=>t],83843)},51911,41413,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(91967),s=e.i(5978),o=e.i(22528),i=e.i(36589),n=e.i(23405),l=e.i(77624),d=e.i(87620),c="Switch",[p,u]=(0,o.createContextScope)(c),[h,m]=p(c),x=r.forwardRef((e,o)=>{let{__scopeSwitch:n,name:l,checked:p,defaultChecked:u,required:m,disabled:x,value:f="on",onCheckedChange:g,form:j,...w}=e,[y,C]=r.useState(null),k=(0,s.useComposedRefs)(o,e=>C(e)),N=r.useRef(!1),T=!y||j||!!y.closest("form"),[P,S]=(0,i.useControllableState)({prop:p,defaultProp:u??!1,onChange:g,caller:c});return(0,t.jsxs)(h,{scope:n,checked:P,disabled:x,children:[(0,t.jsx)(d.Primitive.button,{type:"button",role:"switch","aria-checked":P,"aria-required":m,"data-state":v(P),"data-disabled":x?"":void 0,disabled:x,value:f,...w,ref:k,onClick:(0,a.composeEventHandlers)(e.onClick,e=>{S(e=>!e),T&&(N.current=e.isPropagationStopped(),N.current||e.stopPropagation())})}),T&&(0,t.jsx)(b,{control:y,bubbles:!N.current,name:l,value:f,checked:P,required:m,disabled:x,form:j,style:{transform:"translateX(-100%)"}})]})});x.displayName=c;var f="SwitchThumb",g=r.forwardRef((e,r)=>{let{__scopeSwitch:a,...s}=e,o=m(f,a);return(0,t.jsx)(d.Primitive.span,{"data-state":v(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:r})});g.displayName=f;var b=r.forwardRef(({__scopeSwitch:e,control:a,checked:o,bubbles:i=!0,...d},c)=>{let p=r.useRef(null),u=(0,s.useComposedRefs)(p,c),h=(0,n.usePrevious)(o),m=(0,l.useSize)(a);return r.useEffect(()=>{let e=p.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(h!==o&&t){let r=new Event("click",{bubbles:i});t.call(e,o),e.dispatchEvent(r)}},[h,o,i]),(0,t.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o,...d,tabIndex:-1,ref:u,style:{...d.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function v(e){return e?"checked":"unchecked"}b.displayName="SwitchBubbleInput",e.s(["Root",()=>x,"Switch",()=>x,"SwitchThumb",()=>g,"Thumb",()=>g,"createSwitchScope",()=>u],95291);var j=e.i(95291),j=j,w=e.i(31777);function y({className:e,size:r="default",...a}){return(0,t.jsx)(j.Root,{"data-slot":"switch","data-size":r,className:(0,w.cn)("peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80 inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6",e),...a,children:(0,t.jsx)(j.Thumb,{"data-slot":"switch-thumb",className:(0,w.cn)("bg-background dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}e.s(["Switch",()=>y],51911);var C=e.i(23925),k=e.i(11345),N=e.i(76016),T=e.i(66967),P=e.i(22503),S=e.i(86782),R=e.i(29847),F=e.i(35364),A=e.i(90382);function E({initialAgentType:e,initialModel:a,onAgentModelChange:s,disabled:o,className:i,mode:n}){let[l,d]=r.useState(!1),[c,p]=r.useState([]),[u,h]=r.useState(!0),[m,x]=r.useState(e),[f,g]=r.useState(a),[b,v]=r.useState(null),[j,y]=r.useState(0),[E,D]=r.useState(null);r.useEffect(()=>{(0,T.getAllAgentModels)().then(p).finally(()=>h(!1))},[]),r.useEffect(()=>{if(!l){let e=setTimeout(()=>{y(0),D(null)},150);return()=>clearTimeout(e)}},[l]);let I=async(e,t)=>{if(d(!1),e!==m||t!==f){if("override"===n){x(e),g(t),s?.(e,t);return}x(e),g(t),s?.(e,t),v(null);try{let r=await (0,P.updateAgentAndModel)(e,t||null);r.ok||(x(m),g(f),s?.(m,f),v(r.error??"Failed to save"))}catch{x(m),g(f),s?.(m,f),v("Failed to save")}}},z=(0,S.getAgentTypeIcon)(m),M=c.find(e=>e.agentType===m)?.label??m,O=f?(0,R.getModelMeta)(f).displayName||f:null,L=E?c.find(e=>e.agentType===E):null;return(0,t.jsxs)("div",{className:(0,w.cn)("flex flex-col gap-1",i),children:[(0,t.jsxs)(A.Popover,{open:l,onOpenChange:d,children:[(0,t.jsx)(A.PopoverTrigger,{asChild:!0,children:(0,t.jsx)(F.Button,{variant:"outline",role:"combobox","aria-expanded":l,disabled:(o??!1)||u,className:"w-auto cursor-pointer justify-start font-normal hover:border-violet-300 hover:bg-violet-50/50 dark:hover:border-violet-700 dark:hover:bg-violet-950/30",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 truncate",children:[(0,t.jsx)(z,{className:"h-4 w-4 shrink-0"}),u?"Loading…":(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:M}),O?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-muted-foreground/50 text-xs",children:"·"}),(0,t.jsx)("span",{className:"text-xs font-medium",children:O})]}):null]})]})})}),(0,t.jsx)(A.PopoverContent,{className:"w-(--radix-popover-trigger-width) overflow-hidden p-0",align:"start",children:(0,t.jsxs)("div",{className:"flex transition-transform duration-200 ease-in-out",style:{transform:`translateX(${1===j?"-50%":"0%"})`,width:"200%"},children:[(0,t.jsxs)("div",{className:"w-1/2 shrink-0",children:[(0,t.jsx)("div",{className:"text-muted-foreground border-b px-3 py-2 text-xs font-medium",children:"Select agent"}),c.map(e=>{let r=(0,S.getAgentTypeIcon)(e.agentType),a=m===e.agentType,s=e.models.length>0;return(0,t.jsxs)("button",{type:"button",className:(0,w.cn)("flex w-full cursor-pointer items-center gap-2.5 px-3 py-2 text-xs transition-colors","hover:bg-accent hover:text-accent-foreground",a&&"bg-accent/50"),onClick:()=>{s?(D(e.agentType),requestAnimationFrame(()=>{requestAnimationFrame(()=>y(1))})):I(e.agentType,"")},children:[(0,t.jsx)(r,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"flex-1 text-left",children:e.label}),a&&!s?(0,t.jsx)(C.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null,s?(0,t.jsx)(N.ChevronRight,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}):null]},e.agentType)})]}),(0,t.jsx)("div",{className:"w-1/2 shrink-0",children:L?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button",className:"text-muted-foreground hover:text-foreground flex w-full cursor-pointer items-center gap-1.5 border-b px-3 py-2 text-xs font-medium transition-colors",onClick:()=>{y(0),setTimeout(()=>D(null),220)},children:[(0,t.jsx)(k.ChevronLeft,{className:"h-3.5 w-3.5"}),L.label]}),L.models.map(e=>{let r=m===L.agentType&&f===e.id;return(0,t.jsxs)("button",{type:"button",className:(0,w.cn)("flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors","hover:bg-accent hover:text-accent-foreground",r&&"bg-accent/50"),onClick:()=>I(L.agentType,e.id),children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:e.displayName}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:e.description})]}),r?(0,t.jsx)(C.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null]},e.id)})]}):null})]})})]}),!!b&&(0,t.jsx)("p",{className:"text-destructive text-sm",children:b})]})}e.s(["AgentModelPicker",()=>E],41413)},15203,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(31406),s=e.i(60112),o=e.i(21023);let i=(0,o.createServerReference)("4010123ef92f8caeef071e18cdd49329a5b4c08371",o.callServer,void 0,o.findSourceMapURL,"createFeature");var n=e.i(16868),l=e.i(83843),d=e.i(97667),c=e.i(53360),p=e.i(55016),u=e.i(91925),h=e.i(83428);let m=(0,e.i(3645).default)("git-fork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);var x=e.i(70471),f=e.i(31777),g=e.i(8361);e.i(1650);var b=e.i(11495),v=e.i(45811),j=e.i(35364),w=e.i(98127),y=e.i(48306),C=e.i(41957),k=e.i(81846),N=e.i(90382),T=e.i(51911),P=e.i(2828),S=e.i(30153);e.i(50032);var R=e.i(86254),F=e.i(41413),A=e.i(25235),E=e.i(78521);e.i(13322);var D=e.i(61201),I=e.i(75921),z=e.i(36462),M=e.i(42076);let O=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp",".ico",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".csv",".json",".yaml",".yml",".xml",".ts",".tsx",".js",".jsx",".py",".rb",".go",".rs",".java",".c",".cpp",".h",".hpp",".cs",".swift",".kt",".html",".css",".scss",".less",".sh",".bash",".zsh",".fish",".toml",".ini",".cfg",".conf",".env",".zip",".tar",".gz",".log"]),L=[{id:"allowPrd",label:"PRD",description:"Auto-approve requirements move to planning."},{id:"allowPlan",label:"Plan",description:"Auto-approve planning move to implementation."},{id:"allowMerge",label:"Merge",description:"Auto-approve merge move to Done."}],U={allowPrd:!1,allowPlan:!1,allowMerge:!1};function B({open:e,onClose:a,onSubmit:s,repositoryPath:o,isSubmitting:i=!1,workflowDefaults:l,features:d,repositories:u,initialParentId:h,currentAgentType:w,currentModel:N,initialDescription:A}){let E=(0,g.useSoundAction)("create"),D=o&&(!u||0===u.length||u.some(e=>e.path===o))?o:"",I=l?.approvalGates??U,z=l?.push??!1,B=l?.openPr??!1,q=l?.ciWatchEnabled!==!1,G=l?.enableEvidence??!1,V=l?.commitEvidence??!1,[_,K]=(0,r.useState)(A??"");(0,r.useEffect)(()=>{A&&K(A)},[A]);let[W,X]=(0,r.useState)([]),[Y,Z]=(0,r.useState)({...I}),[J,Q]=(0,r.useState)(z),[ee,et]=(0,r.useState)(B),[er,ea]=(0,r.useState)(l?.ciWatchEnabled!==!1),[es,eo]=(0,r.useState)(G),[ei,en]=(0,r.useState)(V),[el,ed]=(0,r.useState)(void 0),[ec,ep]=(0,r.useState)(!1),[eu,eh]=(0,r.useState)(!1),[em,ex]=(0,r.useState)(!1),[ef,eg]=(0,r.useState)(!0),[eb,ev]=(0,r.useState)(void 0),[ej,ew]=(0,r.useState)(void 0),[ey,eC]=(0,r.useState)(D||void 0),[ek,eN]=(0,r.useState)(u??[]),[eT,eP]=(0,r.useState)(!1),[eS,eR]=(0,r.useState)(null),[eF,eA]=(0,r.useState)(!1),eE=(0,r.useRef)(crypto.randomUUID()),eD=(0,r.useRef)(0),eI=(0,r.useRef)(null);(0,r.useEffect)(()=>{l&&(Z({...l.approvalGates}),Q(l.push),et(l.openPr),ea(!1!==l.ciWatchEnabled),eo(l.enableEvidence),en(l.commitEvidence))},[l]),(0,r.useEffect)(()=>{eN(u??[])},[u]),(0,r.useEffect)(()=>{e&&h&&ed(h)},[e,h]);let ez=(0,r.useCallback)(()=>{K(""),X([]),Z({...I}),Q(z),et(B),ea(q),eo(G),en(V),ed(void 0),eC(D||void 0),eN(u??[]),ep(!1),eh(!1),ex(!1),eg(!0),ev(void 0),ew(void 0),eR(null),eD.current=0,eP(!1)},[I,z,B,G,q,V,D,u]),eM=""!==_.trim()||W.length>0,{attemptClose:eO}=(0,S.useGuardedDrawerClose)({open:e,isDirty:eM,onClose:a,onReset:ez}),eL=(0,r.useCallback)(async e=>{for(let t of(eR(null),e)){if(t.size>0xa00000)return void eR(`"${t.name}" exceeds 10 MB limit`);let e=function(e){let t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}(t.name);if(e&&!O.has(e))return void eR(`File type "${e}" is not allowed`)}for(let t of e){let e=crypto.randomUUID();X(r=>[...r,{id:e,name:t.name,size:t.size,mimeType:t.type||"application/octet-stream",path:"",loading:!0}]);try{let r=new FormData;r.append("file",t),r.append("sessionId",eE.current);let a=await fetch("/api/attachments/upload",{method:"POST",body:r});if(!a.ok){let t=await a.json().catch(()=>({error:"Upload failed"}));X(t=>t.filter(t=>t.id!==e)),eR(t.error??"Upload failed");return}let s=await a.json();X(t=>t.some(t=>t.id!==e&&t.path===s.path)?t.filter(t=>t.id!==e):t.map(t=>t.id===e?{...s,id:e,loading:!1}:t))}catch{X(t=>t.filter(t=>t.id!==e)),eR("Upload failed")}}},[]),eU=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),eD.current+=1,1===eD.current&&eP(!0)},[]),eB=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),eD.current-=1,0===eD.current&&eP(!1)},[]),eH=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),e$=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),eD.current=0,eP(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&eL(t)},[eL]),eq=(0,r.useCallback)(e=>{let t=e.clipboardData?.items;if(!t)return;let r=[];for(let e of Array.from(t))if("file"===e.kind){let t=e.getAsFile();t&&r.push(t)}r.length>0&&(e.preventDefault(),eL(r))},[eL]),eG=(0,r.useCallback)(e=>{if(e.preventDefault(),!_.trim())return;let t=ey??D;t&&(E.play(),s({description:_.trim(),attachments:W.filter(e=>!e.loading),repositoryPath:t,approvalGates:{allowPrd:Y.allowPrd??!1,allowPlan:Y.allowPlan??!1,allowMerge:Y.allowMerge??!1},push:!!em||J||ee,openPr:!!em||ee,ciWatchEnabled:er,enableEvidence:es,commitEvidence:ei,fast:ec,forkAndPr:em,commitSpecs:ef,...eu?{pending:eu}:{},...eb?{agentType:eb}:{},...ej?{model:ej}:{},...el?{parentId:el}:{},sessionId:eE.current}),ez())},[_,W,Y,ey,D,s,J,ee,es,er,ei,ec,em,ef,eu,eb,ej,el,E,ez]),eV=(0,r.useCallback)(async()=>{try{let e=await (0,M.pickFiles)();if(!e)return;for(let t of e){let e=crypto.randomUUID();X(r=>[...r,{id:e,name:t.name,size:t.size,mimeType:"application/octet-stream",path:"",loading:!0}]);try{let r=await fetch("/api/attachments/upload-from-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t.path,sessionId:eE.current})});if(!r.ok){let t=await r.json().catch(()=>({error:"Upload failed"}));X(t=>t.filter(t=>t.id!==e)),eR(t.error??"Upload failed");return}let a=await r.json();X(t=>t.some(t=>t.id!==e&&t.path===a.path)?t.filter(t=>t.id!==e):t.map(t=>t.id===e?{...a,id:e,loading:!1}:t))}catch{X(t=>t.filter(t=>t.id!==e)),eR("Upload failed")}}}catch{}},[]),e_=(0,r.useCallback)(e=>{X(t=>t.filter(t=>t.id!==e))},[]),eK=(0,r.useCallback)((e,t)=>{X(r=>r.map(r=>r.id===e?{...r,notes:t}:r))},[]),eW=(0,r.useRef)(null),eX=(0,r.useCallback)(e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),eW.current?.requestSubmit())},[]),eY=(0,r.useCallback)(()=>{eA(!0)},[]),eZ=(0,r.useCallback)(()=>{setTimeout(()=>{let e=eI.current?.contains(document.activeElement),t=eI.current?.querySelector('[aria-expanded="true"]')!==null;e||t||eA(!1)},0)},[]),eJ=d&&d.length>0,eQ=!D&&!ey,e0=!D&&void 0!==u;return(0,t.jsx)(b.BaseDrawer,{open:e,onClose:eO,size:"md",modal:!1,dismissOnOutsideClick:!0,"data-testid":"feature-create-drawer",header:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"h-2.5 w-2.5 shrink-0 rounded-full bg-blue-500"}),(0,t.jsx)(v.DrawerTitle,{children:"NEW FEATURE"})]}),i?(0,t.jsx)(v.DrawerDescription,{asChild:!0,children:(0,t.jsx)("div",{children:(0,t.jsx)(k.Badge,{variant:"secondary",children:"Creating..."})})}):null]}),footer:(0,t.jsxs)("div",{className:"flex flex-row justify-end gap-2",children:[(0,t.jsx)(j.Button,{variant:"outline",onClick:eO,disabled:i,children:"Cancel"}),(0,t.jsx)(j.Button,{type:"submit",form:"create-feature-form",disabled:!_.trim()||i||eQ,children:i?"Creating...":"+ Create Feature"})]}),children:(0,t.jsx)("div",{className:"overflow-y-auto p-4",children:(0,t.jsx)(P.TooltipProvider,{delayDuration:400,children:(0,t.jsxs)("form",{ref:eW,id:"create-feature-form",onSubmit:eG,onKeyDown:eX,className:"flex flex-col gap-4",children:[e0?(0,t.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"repo-selector-section",children:[(0,t.jsx)(C.Label,{className:"text-muted-foreground text-xs font-semibold tracking-wider",children:"REPOSITORY"}),(0,t.jsx)($,{repositories:ek,value:ey,onChange:eC,onAddRepository:e=>{eN(t=>[...t,e]),eC(e.path)},disabled:i})]}):D?(0,t.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"repo-readonly-section",children:[(0,t.jsx)(C.Label,{className:"text-muted-foreground text-xs font-semibold tracking-wider",children:"REPOSITORY"}),(0,t.jsx)("p",{className:"text-sm","data-testid":"repo-readonly-label",children:u?.find(e=>e.path===D)?.name??D.split("/").pop()})]}):null,(0,t.jsxs)("div",{role:"region","aria-label":"File drop zone","data-drag-over":eT?"true":"false",onDragEnter:eU,onDragLeave:eB,onDragOver:eH,onDrop:e$,className:(0,f.cn)("flex flex-col gap-1.5 rounded-md border-2 border-transparent p-1 transition-colors",eT&&"border-primary/50 bg-primary/5"),children:[(0,t.jsx)(C.Label,{htmlFor:"feature-description",className:"text-muted-foreground text-xs font-semibold tracking-wider",children:"DESCRIBE YOUR FEATURE"}),(0,t.jsxs)("div",{ref:eI,onFocus:eY,onBlur:eZ,className:(0,f.cn)("border-input flex h-56 flex-col overflow-hidden rounded-md border shadow-xs transition-[color,box-shadow]",eF&&"ring-ring/50 border-ring ring-[3px]"),children:[(0,t.jsx)(y.Textarea,{id:"feature-description",placeholder:"e.g. Add GitHub OAuth login with callback handling and token refresh...",value:_,onChange:e=>K(e.target.value),onPaste:eq,required:!0,disabled:i,className:"min-h-0 flex-1 resize-none rounded-none border-0 shadow-none focus-visible:ring-0"}),W.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2",children:W.map(e=>(0,t.jsx)(R.AttachmentChip,{name:e.name,size:e.size,mimeType:e.mimeType,path:e.path,onRemove:()=>e_(e.id),disabled:i,loading:e.loading,notes:e.notes,onNotesChange:t=>eK(e.id,t)},e.id))}),eS?(0,t.jsx)("p",{className:"text-destructive px-3 pb-2 text-xs",children:eS}):null,(0,t.jsxs)("div",{className:"border-input flex items-center gap-3 border-t px-3 py-1.5",children:[(0,t.jsx)(F.AgentModelPicker,{initialAgentType:eb??w??"claude-code",initialModel:ej??N??"claude-sonnet-4-6",mode:"override",onAgentModelChange:(e,t)=>{ev(e),ew(t)},disabled:i,className:"w-55"}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"ml-auto flex cursor-pointer items-center gap-2",children:[(0,t.jsx)(T.Switch,{id:"pending-mode",checked:eu,onCheckedChange:eh,disabled:i}),(0,t.jsxs)(C.Label,{htmlFor:"pending-mode",className:"flex cursor-pointer items-center gap-1 text-sm font-medium",children:[(0,t.jsx)(p.Clock,{className:"h-3.5 w-3.5"}),"Pending"]})]})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",children:"Create without starting — start manually later."})]}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-2",children:[(0,t.jsx)(T.Switch,{id:"fast-mode",checked:ec,onCheckedChange:ep,disabled:i}),(0,t.jsxs)(C.Label,{htmlFor:"fast-mode",className:"flex cursor-pointer items-center gap-1 text-sm font-medium",children:[(0,t.jsx)(c.Zap,{className:"h-3.5 w-3.5"}),"Fast Mode"]})]})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",children:"Skip SDLC phases and implement directly from your prompt."})]}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:eV,disabled:i,"aria-label":"Attach files",className:"text-muted-foreground hover:text-foreground cursor-pointer rounded p-1 transition-colors",children:(0,t.jsx)(n.PaperclipIcon,{className:"h-4 w-4"})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",children:"Attach files"})]})]})]})]}),eJ&&void 0!==h?(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(C.Label,{htmlFor:"parent-feature",className:"text-muted-foreground text-xs font-semibold tracking-wider",children:"PARENT FEATURE"}),(0,t.jsx)(H,{features:d,value:el,onChange:ed,disabled:i})]}):null,(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"border-input flex items-center gap-4 rounded-md border px-3 py-2.5",children:[(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0 cursor-default text-xs font-semibold tracking-wider",children:"APPROVE"})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",children:"Auto-approve phase transitions without manual review."})]}),(0,t.jsx)("div",{className:"flex flex-1 items-center gap-4",children:L.map(e=>(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(T.Switch,{id:`approve-${e.id}`,size:"sm",checked:Y[e.id]??!1,onCheckedChange:t=>Z(r=>({...r,[e.id]:t})),disabled:i||ec&&("allowPrd"===e.id||"allowPlan"===e.id)}),(0,t.jsx)(C.Label,{htmlFor:`approve-${e.id}`,className:"cursor-pointer text-xs font-medium",children:e.label})]})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",children:ec&&("allowPrd"===e.id||"allowPlan"===e.id)?"Skipped in Fast Mode":e.description})]},e.id))}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:()=>{let e=L.every(e=>Y[e.id]),t={};for(let r of L)t[r.id]=!e;Z(t)},disabled:i,className:(0,f.cn)("text-muted-foreground hover:text-foreground cursor-pointer rounded px-1.5 py-0.5 text-[10px] font-semibold tracking-wider uppercase transition-colors",L.every(e=>Y[e.id])&&"text-primary"),children:"All"})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",children:"Toggle all approval gates"})]})]}),(0,t.jsxs)("div",{className:"border-input flex items-center gap-4 rounded-md border px-3 py-2.5",children:[(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0 cursor-default text-xs font-semibold tracking-wider",children:"EVIDENCE"})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",children:"Collect and attach evidence after implementation."})]}),(0,t.jsxs)("div",{className:"flex flex-1 items-center gap-4",children:[(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(T.Switch,{id:"enable-evidence",size:"sm",checked:es,onCheckedChange:e=>{eo(e),e||en(!1)},disabled:i}),(0,t.jsx)(C.Label,{htmlFor:"enable-evidence",className:"cursor-pointer text-xs font-medium",children:"Collect"})]})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",children:"Capture screenshots and artifacts after implementation."})]}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(T.Switch,{id:"commit-evidence",size:"sm",checked:ei,onCheckedChange:en,disabled:i||!es||!ee&&!em}),(0,t.jsx)(C.Label,{htmlFor:"commit-evidence",className:(0,f.cn)("cursor-pointer text-xs font-medium",(!es||!ee&&!em)&&"opacity-50"),children:"Add to PR"})]})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",children:ee||em?es?"Include evidence in the pull request body.":"Requires evidence collection to be enabled":"Requires PR to be enabled"})]})]})]}),(0,t.jsxs)("div",{className:"border-input flex items-start gap-4 rounded-md border px-3 py-2.5",children:[(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0 pt-0.5 text-xs font-semibold tracking-wider",children:"GIT"}),(0,t.jsxs)("div",{className:"flex flex-1 flex-wrap items-center gap-4",children:[(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(T.Switch,{id:"push",size:"sm",checked:!!em||J||ee,onCheckedChange:e=>{Q(e),!e&&ee&&et(!1)},disabled:i||em}),(0,t.jsx)(C.Label,{htmlFor:"push",className:(0,f.cn)("cursor-pointer text-xs font-medium",em&&"opacity-50"),children:"Push"})]})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",children:em?"Enabled — contributing to upstream":"Push branch to remote after implementation."})]}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(T.Switch,{id:"open-pr",size:"sm",checked:!!em||ee,onCheckedChange:e=>{et(e),e||en(!1)},disabled:i||em}),(0,t.jsx)(C.Label,{htmlFor:"open-pr",className:(0,f.cn)("cursor-pointer text-xs font-medium",em&&"opacity-50"),children:"PR"})]})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",children:em?"Enabled — contributing to upstream":"Open a pull request after pushing."})]}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(T.Switch,{id:"ci-watch",size:"sm",checked:er,onCheckedChange:ea,disabled:i}),(0,t.jsx)(C.Label,{htmlFor:"ci-watch",className:"cursor-pointer text-xs font-medium",children:"Watch"})]})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",children:"Watch CI and auto-fix after push."})]}),(0,t.jsx)("div",{className:"bg-border h-4 w-px shrink-0"}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(T.Switch,{id:"commit-specs",size:"sm",checked:ef,onCheckedChange:eg,disabled:i}),(0,t.jsxs)(C.Label,{htmlFor:"commit-specs",className:"flex cursor-pointer items-center gap-1 text-xs font-medium",children:[(0,t.jsx)(x.FileText,{className:"h-3 w-3"}),"Commit Specs"]})]})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",children:"Commit specs to repository."})]}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(T.Switch,{id:"fork-and-pr",size:"sm",checked:em,onCheckedChange:e=>{ex(e),e&&eg(!1)},disabled:i}),(0,t.jsxs)(C.Label,{htmlFor:"fork-and-pr",className:"flex cursor-pointer items-center gap-1 text-xs font-medium",children:[(0,t.jsx)(m,{className:"h-3 w-3"}),"Fork & PR"]})]})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",children:"Contribute via fork (PR to upstream)."})]})]})]})]})]})})})})}function H({features:e,value:a,onChange:s,disabled:o}){let[i,n]=(0,r.useState)(!1),[c,p]=(0,r.useState)(""),u=(0,r.useRef)(null),h=e.find(e=>e.id===a),m=c.trim()?e.filter(e=>e.name.toLowerCase().includes(c.toLowerCase())||e.id.toLowerCase().includes(c.toLowerCase())):e,x=(0,r.useCallback)(e=>{s(e),n(!1),p("")},[s]);return(0,r.useEffect)(()=>{i?setTimeout(()=>u.current?.focus(),0):p("")},[i]),(0,t.jsxs)(N.Popover,{open:i,onOpenChange:n,children:[(0,t.jsx)(N.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)("button",{id:"parent-feature",type:"button",role:"combobox","aria-expanded":i,"aria-label":"Parent Feature",disabled:o,"data-testid":"parent-feature-combobox",className:(0,f.cn)("border-input bg-background ring-offset-background focus:ring-ring flex h-9 w-full items-center justify-between rounded-md border px-3 py-2 text-sm focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",!h&&"text-muted-foreground"),children:[(0,t.jsx)("span",{className:"truncate",children:h?`${h.name} (${h.id.slice(0,8)})`:"Select parent feature..."}),(0,t.jsx)(l.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(N.PopoverContent,{className:"w-80 p-0",align:"start","data-testid":"parent-feature-combobox-content",children:(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("div",{className:"border-b p-2",children:(0,t.jsx)(w.Input,{ref:u,placeholder:"Search features...",value:c,onChange:e=>p(e.target.value),className:"h-8 border-0 p-0 text-sm shadow-none focus-visible:ring-0","data-testid":"parent-feature-search"})}),(0,t.jsxs)("div",{className:"max-h-48 overflow-y-auto py-1",role:"listbox","aria-label":"Features",children:[(0,t.jsxs)("button",{type:"button",role:"option","aria-selected":void 0===a,onClick:()=>x(void 0),className:(0,f.cn)("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 px-3 py-2 text-sm",void 0===a&&"bg-accent/50"),"data-testid":"parent-feature-option-none",children:[(0,t.jsx)(d.CheckIcon,{className:(0,f.cn)("h-4 w-4 shrink-0",void 0!==a&&"invisible")}),(0,t.jsx)("span",{className:"text-muted-foreground italic",children:"No parent"})]}),0===m.length&&c?(0,t.jsx)("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:"No features found."}):m.map(e=>(0,t.jsxs)("button",{type:"button",role:"option","aria-selected":a===e.id,onClick:()=>x(e.id),className:(0,f.cn)("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 px-3 py-2 text-sm",a===e.id&&"bg-accent/50"),"data-testid":`parent-feature-option-${e.id}`,children:[(0,t.jsx)(d.CheckIcon,{className:(0,f.cn)("h-4 w-4 shrink-0",a!==e.id&&"invisible")}),(0,t.jsxs)("span",{className:"truncate",children:[e.name," ",(0,t.jsxs)("span",{className:"text-muted-foreground font-mono text-xs",children:["(",e.id.slice(0,8),")"]})]})]},e.id))]})]})})]})}function $({repositories:e,value:a,onChange:s,onAddRepository:o,disabled:i}){let[n,c]=(0,r.useState)(!1),[p,m]=(0,r.useState)(""),[x,g]=(0,r.useState)(!1),[b,v]=(0,r.useState)(null),[j,y]=(0,r.useState)(!1),C=(0,r.useRef)(null),{reactFileManager:k}=(0,I.useFeatureFlags)(),T=e.find(e=>e.path===a),P=p.trim()?e.filter(e=>e.name.toLowerCase().includes(p.toLowerCase())||e.path.toLowerCase().includes(p.toLowerCase())):e,S=(0,r.useCallback)(e=>{s(e),c(!1),m("")},[s]),R=(0,r.useCallback)(async e=>{let t=await (0,z.addRepository)({path:e});if(t.error){v(t.error),g(!1);return}if(t.repository){let e={id:t.repository.id,name:t.repository.name,path:t.repository.path};o?.(e),s(e.path),c(!1),m("")}},[o,s]),F=(0,r.useCallback)(async()=>{if(!x){if(k)return void y(!0);g(!0),v(null);try{let e=await (0,E.pickFolder)();if(!e)return void g(!1);await R(e)}catch{y(!0)}finally{g(!1)}}},[x,k,R]),M=(0,r.useCallback)(async e=>{if(y(!1),e){g(!0),v(null);try{await R(e)}catch(e){v(e instanceof Error?e.message:"Failed to add repository")}finally{g(!1)}}},[R]);return(0,r.useEffect)(()=>{n?setTimeout(()=>C.current?.focus(),0):m("")},[n]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(N.Popover,{open:n,onOpenChange:c,children:[(0,t.jsx)(N.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",role:"combobox","aria-expanded":n,"aria-label":"Repository",disabled:i,"data-testid":"repository-combobox",className:(0,f.cn)("border-input bg-background ring-offset-background focus:ring-ring flex h-9 w-full items-center justify-between rounded-md border px-3 py-2 text-sm focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",!T&&"text-muted-foreground"),children:[(0,t.jsx)("span",{className:"truncate",children:T?T.name:"Select repository..."}),(0,t.jsx)(l.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(N.PopoverContent,{className:"w-80 p-0",align:"start","data-testid":"repository-combobox-content",children:(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("div",{className:"border-b p-2",children:(0,t.jsx)(w.Input,{ref:C,placeholder:"Search repositories...",value:p,onChange:e=>m(e.target.value),className:"h-8 border-0 p-0 text-sm shadow-none focus-visible:ring-0","data-testid":"repository-search"})}),(0,t.jsx)("div",{className:"max-h-48 overflow-y-auto py-1",role:"listbox","aria-label":"Repositories",children:0===P.length?(0,t.jsx)("p",{className:"text-muted-foreground px-3 py-2 text-sm","data-testid":"repository-empty",children:"No repositories found."}):P.map(e=>(0,t.jsxs)("button",{type:"button",role:"option","aria-selected":a===e.path,onClick:()=>S(e.path),className:(0,f.cn)("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 px-3 py-2 text-sm",a===e.path&&"bg-accent/50"),"data-testid":`repository-option-${e.id}`,children:[(0,t.jsx)(d.CheckIcon,{className:(0,f.cn)("h-4 w-4 shrink-0",a!==e.path&&"invisible")}),(0,t.jsxs)("span",{className:"flex flex-col items-start truncate",children:[(0,t.jsx)("span",{className:"truncate",children:e.name}),(0,t.jsx)("span",{className:"text-muted-foreground truncate text-xs",children:e.path})]})]},e.id))}),(0,t.jsx)(A.Separator,{}),(0,t.jsxs)("button",{type:"button",onClick:F,disabled:x,className:"hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 px-3 py-2 text-sm","data-testid":"add-repository-item",children:[x?(0,t.jsx)(h.Loader2,{className:"h-4 w-4 shrink-0 animate-spin"}):(0,t.jsx)(u.FolderPlus,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:"Add new repository..."})]}),b?(0,t.jsx)("p",{className:"px-3 pb-2 text-xs text-red-500","data-testid":"add-repository-error",children:b}):null]})})]}),(0,t.jsx)(D.ReactFileManagerDialog,{open:j,onOpenChange:e=>{e||y(!1)},onSelect:M})]})}function q({repositoryPath:e,initialParentId:o,initialDescription:n,features:l,repositories:d,workflowDefaults:c,currentAgentType:p,currentModel:u}){let h=(0,a.useRouter)(),[m,x]=(0,r.useState)(!1),f=(0,a.usePathname)().startsWith("/create"),g=!m&&f;(0,r.useEffect)(()=>{!f&&m&&x(!1)},[f,m]);let b=(0,r.useCallback)(()=>{h.push("/")},[h]),v=(0,r.useCallback)(e=>{x(!0),h.push("/"),i(e).then(t=>{t.error?s.toast.error(t.error):window.dispatchEvent(new CustomEvent("shep:feature-created",{detail:{featureId:t.feature.id,name:t.feature.name,description:t.feature.description,repositoryPath:t.feature.repositoryPath,parentId:e.parentId}}))}).catch(()=>{s.toast.error("Failed to create feature"),x(!1)})},[h]);return(0,t.jsx)(B,{open:g,onClose:b,onSubmit:v,repositoryPath:e,features:l,repositories:d,workflowDefaults:c,initialParentId:o,initialDescription:n,isSubmitting:m,currentAgentType:p,currentModel:u})}e.s(["CreateDrawerClient",()=>q],15203)}]);
|