@powerhousedao/connect 6.2.3-dev.77 → 6.2.3-dev.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +3 -3
  2. package/dist/{AddDriveModal-BjgmiHJr.js → AddDriveModal-CFi-9FQU.js} +22 -9
  3. package/dist/AddDriveModal-CFi-9FQU.js.map +1 -0
  4. package/dist/{ClearStorageModal-i9FKEx_Z.js → ClearStorageModal-CeIUOS3b.js} +4 -4
  5. package/dist/{ClearStorageModal-i9FKEx_Z.js.map → ClearStorageModal-CeIUOS3b.js.map} +1 -1
  6. package/dist/{DebugSettingsModal-DZV2fbRB.js → DebugSettingsModal-BPxepTqH.js} +4 -4
  7. package/dist/{DebugSettingsModal-DZV2fbRB.js.map → DebugSettingsModal-BPxepTqH.js.map} +1 -1
  8. package/dist/{InspectorModal-B1nrgNqN.js → InspectorModal-C3idQF-2.js} +4 -4
  9. package/dist/{InspectorModal-B1nrgNqN.js.map → InspectorModal-C3idQF-2.js.map} +1 -1
  10. package/dist/{OpenFileDocumentsModal-B9c-CsKT.js → OpenFileDocumentsModal-DJsC1oR1.js} +10 -6
  11. package/dist/OpenFileDocumentsModal-DJsC1oR1.js.map +1 -0
  12. package/dist/{app-loader-DXgAoCn8.js → app-loader-7OUjO5bP.js} +9 -8
  13. package/dist/{app-loader-DXgAoCn8.js.map → app-loader-7OUjO5bP.js.map} +1 -1
  14. package/dist/app-loader-DNAJ-Yy4.js +4 -0
  15. package/dist/{app-skeleton-WGKR7IBB.js → app-skeleton-CMUP2zaz.js} +4 -4
  16. package/dist/{app-skeleton-WGKR7IBB.js.map → app-skeleton-CMUP2zaz.js.map} +1 -1
  17. package/dist/{app-skeleton-CPjpFScH.js → app-skeleton-CdD1m8G3.js} +3 -3
  18. package/dist/{boot-BsDeQV5C.js → boot-Bj8cb1nU.js} +5 -5
  19. package/dist/{boot-BsDeQV5C.js.map → boot-Bj8cb1nU.js.map} +1 -1
  20. package/dist/{build-info-CsorwB_R.js → build-info-DuD57dLW.js} +5 -5
  21. package/dist/{build-info-CsorwB_R.js.map → build-info-DuD57dLW.js.map} +1 -1
  22. package/dist/{components-BuJEx-4m.js → components-C_JnePUO.js} +6 -6
  23. package/dist/{components-BuJEx-4m.js.map → components-C_JnePUO.js.map} +1 -1
  24. package/dist/generic.d.ts +11 -5
  25. package/dist/generic.d.ts.map +1 -1
  26. package/dist/generic.js +3 -3
  27. package/dist/index-D7c2WAbn.d.ts +4 -0
  28. package/dist/layout-Dj3_KscE.js +5 -0
  29. package/dist/layout.d.ts +2 -2
  30. package/dist/layout.js +4 -4
  31. package/dist/{load-Pg2jPlQG.js → load-Cx5LF8Oq.js} +6 -6
  32. package/dist/{load-Pg2jPlQG.js.map → load-Cx5LF8Oq.js.map} +1 -1
  33. package/dist/{load-runtime-config-DUDmjysn.js → load-runtime-config-Ccr-CSrB.js} +4 -4
  34. package/dist/{load-runtime-config-DUDmjysn.js.map → load-runtime-config-Ccr-CSrB.js.map} +1 -1
  35. package/dist/main.js +2 -2
  36. package/dist/{package-manager-DbsImtAj.js → package-manager-CxeIUE9M.js} +6 -6
  37. package/dist/{package-manager-DbsImtAj.js.map → package-manager-CxeIUE9M.js.map} +1 -1
  38. package/dist/{plugins-B6fx4DYq.js → plugins-BPEiqk54.js} +4 -4
  39. package/dist/{plugins-B6fx4DYq.js.map → plugins-BPEiqk54.js.map} +1 -1
  40. package/dist/prerender.js +3 -3
  41. package/dist/{reactor-DzmKoZta.js → reactor-Dz5I-nuF.js} +8 -7
  42. package/dist/{reactor-DzmKoZta.js.map → reactor-Dz5I-nuF.js.map} +1 -1
  43. package/dist/route-tree.d.ts +28 -28
  44. package/dist/route-tree.d.ts.map +1 -1
  45. package/dist/route-tree.js +1 -1
  46. package/dist/{route-views-C84NRBou.js → route-views-C-H3ofJW.js} +3 -3
  47. package/dist/{route-views-DmmQ1DzX.js → route-views-CKBivPxe.js} +4 -4
  48. package/dist/{route-views-DmmQ1DzX.js.map → route-views-CKBivPxe.js.map} +1 -1
  49. package/dist/{route-views-zHuBM6Nq.js → route-views-DzgRMAx8.js} +4 -4
  50. package/dist/{route-views-zHuBM6Nq.js.map → route-views-DzgRMAx8.js.map} +1 -1
  51. package/dist/route-views.js +3 -3
  52. package/dist/{router-9jEQB-nr.js → router-CWIsjETx.js} +4 -4
  53. package/dist/{router-9jEQB-nr.js.map → router-CWIsjETx.js.map} +1 -1
  54. package/dist/router-CnWkTEey.js +4 -0
  55. package/dist/{settings-BIDeP8Tk.js → settings-CBZxJ2Q7.js} +6 -8
  56. package/dist/{settings-BIDeP8Tk.js.map → settings-CBZxJ2Q7.js.map} +1 -1
  57. package/dist/{settings-tabs-Du7xiSzi.js → settings-tabs-CX9Ui6ph.js} +19 -12
  58. package/dist/settings-tabs-CX9Ui6ph.js.map +1 -0
  59. package/dist/shell-core-head.html +1 -1
  60. package/dist/shell-head.html +1 -1
  61. package/dist/start-connect.js +2 -2
  62. package/dist/style.css +85 -0
  63. package/dist/{ui-Blbu9aQD.js → ui-BMwuUre8.js} +8 -8
  64. package/dist/{ui-Blbu9aQD.js.map → ui-BMwuUre8.js.map} +1 -1
  65. package/package.json +16 -18
  66. package/skills/customize-connect/SKILL.md +22 -19
  67. package/{docs/customizing → skills/customize-connect/references}/data-and-navigation.md +17 -5
  68. package/{docs/customizing → skills/customize-connect/references}/drive-apps.md +5 -3
  69. package/{docs/customizing → skills/customize-connect/references}/layout.md +7 -1
  70. package/{docs/customizing → skills/customize-connect/references}/modals.md +1 -1
  71. package/{docs/customizing → skills/customize-connect/references}/overrides.md +10 -1
  72. package/{docs/customizing → skills/customize-connect/references}/pages.md +9 -1
  73. package/{RUNTIME-CONFIG.md → skills/customize-connect/references/runtime-config.md} +12 -2
  74. package/{docs/customizing → skills/customize-connect/references}/styles-and-branding.md +1 -1
  75. package/{docs/customizing → skills/customize-connect/references}/types-and-troubleshooting.md +0 -1
  76. package/dist/AddDriveModal-BjgmiHJr.js.map +0 -1
  77. package/dist/OpenFileDocumentsModal-B9c-CsKT.js.map +0 -1
  78. package/dist/app-loader-CZUBwD2Y.js +0 -4
  79. package/dist/index-NyJPEHvw.d.ts +0 -4
  80. package/dist/layout-wfvkfP4J.js +0 -5
  81. package/dist/router-D8NyXlh0.js +0 -4
  82. package/dist/settings-tabs-Du7xiSzi.js.map +0 -1
  83. /package/{docs/customizing → skills/customize-connect/references}/hosts-and-plugins.md +0 -0
  84. /package/{docs/customizing → skills/customize-connect/references}/packages.md +0 -0
@@ -4,7 +4,7 @@ A drive app is the view Connect shows for a drive: its own listing, forms and to
4
4
 
5
5
  ## Make one
6
6
 
7
- Create a `powerhouse/app` document in the Vetra drive, the way `AGENTS.md` makes an editor: give it a name and the document types it holds, then set it to CONFIRMED. Codegen writes `editors/<app-id>/`:
7
+ Create a `powerhouse/app` document in the Vetra drive, the way the powerhouse-editors skill makes an editor: give it a name and the document types it holds, then set it to CONFIRMED. Codegen writes `editors/<app-id>/`:
8
8
 
9
9
  - `editor.tsx`, the app's root. Codegen writes it once and never again, so edit it.
10
10
  - `components/`, a folder tree, folder contents and a create button to start from; it too stays yours.
@@ -22,7 +22,8 @@ Inside it, the `@powerhousedao/reactor-browser` hooks read the route it is shown
22
22
 
23
23
  - `useSelectedDrive()` (a `[drive, dispatch]` pair), `useSelectedFolder()`, `useSelectedNode()` and `useNodesInSelectedDrive()`.
24
24
  - `useNodesInSelectedDriveOrFolder()` lists the open folder, or the drive's root when no folder is open. `useNodesInSelectedFolder()` and the generated `use<Model>DocumentsInSelectedFolder()` give `undefined` at the root.
25
- - `setSelectedNode(id)` opens a folder or document; `setSelectedNode(undefined)` goes back to the drive's root. Both are router navigations, so Back, Forward and reloads land on the same node.
25
+ - The drive view sizes the app to its content: give the app's root element `w-full` (and `h-full` for a full-height layout).
26
+ - `const setSelectedNode = useSetSelectedNode()` inside a drive app: `setSelectedNode(id)` opens a folder or document; `setSelectedNode(undefined)` goes back to the drive's root. Both are router navigations, so Back, Forward and reloads land on the same node.
26
27
  - `useLinkProps(useNodeTarget(node))` makes a row a real link.
27
28
  - `getDriveName(drive)` is the drive's display name; drives made in the UI leave `header.name` empty.
28
29
  - `showCreateDocumentModal(type)` opens Connect's create modal, which adds the document to the open folder and opens it.
@@ -36,7 +37,8 @@ A drive shows the app its `header.meta.preferredEditor` names. With none, or an
36
37
 
37
38
  - **A new drive in the UI:** Create Drive's "Drive App" picker. Package apps are listed first, so a project's app is preselected.
38
39
  - **A new drive in code:** `addDrive(input, appId)` from `@powerhousedao/reactor-browser`, or `driveInput.preferredEditor` in the MCP `addDrive` tool.
39
- - **A drive every user gets:** a local entry in `connect.drives.defaultDrives` with `"app": "<app-id>"` ([RUNTIME-CONFIG.md](../../RUNTIME-CONFIG.md)). Connect creates it on first boot and opens it in that app.
40
+ - **A drive every user gets:** a local entry in `connect.drives.defaultDrives` with `"app": "<app-id>"` ([runtime-config.md](./runtime-config.md)). Connect creates it on first boot and opens it in that app.
41
+ - **The Vetra Preview drive:** `"vetra": { "previewDrive": { "app": "<app-id>" } }` in `powerhouse.config.json`. `ph vetra --watch` sets that app on the drive each time it starts, so a fresh clone gets it too.
40
42
  - **An existing drive:** `setPreferredEditorOnNode(driveId, appId)` from `@powerhousedao/reactor-browser`, which dispatches `setPreferredEditor`. Connect has no UI for this yet, so a project that needs it adds a button, e.g. on a page that lists the drives. The change syncs like any other drive operation.
41
43
 
42
44
  The home cards and `useAppModuleById(drive.header.meta?.preferredEditor)` show which app a drive uses.
@@ -2,11 +2,17 @@
2
2
 
3
3
  A project's `_app.tsx` replaces the layout around Connect's pages: keep Connect's and change its sidebar, or build another from its parts. The layout is also the loading screen.
4
4
 
5
+ ## Contents
6
+
7
+ - [Replace the sidebar](#replace-the-sidebar)
8
+ - [Replace the layout](#replace-the-layout)
9
+ - [The loading screen](#the-loading-screen)
10
+
5
11
  ## Replace the sidebar
6
12
 
7
13
  A project's `_app.tsx` replaces Connect's `_app` layout. Connect's routes and the project's `_app/` routes then render inside it.
8
14
 
9
- To keep Connect's layout and change only the sidebar, render `AppLayout` with your own `sidebar`. `ConnectSidebar` is Connect's sidebar; `extraItems` go after the drives and nav links. Both are the generic plugin's UI, exported from `@powerhousedao/connect/generic` with core's parts:
15
+ To keep Connect's layout and add a header or footer bar, render `AppLayout` with `header` and `footer`; to change only the sidebar, pass your own `sidebar`. In a layout of your own, `useConnectChrome()` gives `{ embedded, sidebarHidden, sidebarCollapsed }`. `ConnectSidebar` is Connect's sidebar; `extraItems` go after the drives and nav links. Both are the generic plugin's UI, exported from `@powerhousedao/connect/generic` with core's parts:
10
16
 
11
17
  ```tsx
12
18
  // hosts/connect/routes/_app.tsx
@@ -37,7 +37,7 @@ function NewTodoListLink() {
37
37
 
38
38
  ## Replace a modal's view
39
39
 
40
- A route's `staticData.modals` replaces the host's view of a modal while the route matches; the deepest matched route wins. The view reads the modal with `usePHModal()`:
40
+ A route's `staticData.modals` replaces the host's view of a modal while the route matches; the deepest matched route wins. The view reads the modal with `usePHModal()`. In `_app.tsx` and overrides, `ModalDialog` comes from `@powerhousedao/connect/layout`, as below; in any other route (an offered one), import it from `@powerhousedao/connect-core/router`:
41
41
 
42
42
  ```tsx
43
43
  // hosts/connect/routes/_app.tsx
@@ -1,8 +1,17 @@
1
1
  # Override Connect's routes, loading, not found and errors
2
2
 
3
+ ## Contents
4
+
5
+ - [Override a Connect route](#override-a-connect-route)
6
+ - [Build on the home page](#build-on-the-home-page)
7
+ - [Loading, not found and errors](#loading-not-found-and-errors)
8
+ - [Slow routes](#slow-routes)
9
+ - [Not found](#not-found)
10
+ - [Errors](#errors)
11
+
3
12
  ## Override a Connect route
4
13
 
5
- Every page Connect shows is a file route in `@powerhousedao/connect`'s `src/routes/` (`node_modules/@powerhousedao/connect/src/routes/` in a project). A project file at the same path replaces Connect's file. Each of Connect's files exports `options`: everything but the component (loader, search params, pending view, title). An override spreads them and sets its own `component`:
14
+ Every page Connect shows is a file route in `@powerhousedao/connect`'s `src/routes/` (`node_modules/@powerhousedao/connect/src/routes/` in a project). A project file at the same path replaces Connect's file. Each of Connect's files exports `options`: everything but the component (loader, search params, pending view, title). Every route option key is present, typed `undefined` where the route doesn't set it. An override spreads them and sets its own `component`; don't call `options.loader` directly, since a loader can be an object with a `handler`:
6
15
 
7
16
  ```tsx
8
17
  // hosts/connect/routes/_app/d/$driveSlug.tsx
@@ -2,6 +2,14 @@
2
2
 
3
3
  A project adds pages to Connect with file routes in `hosts/connect/routes/`. A route lists itself in the sidebar, changes the sidebar on its page, adds a settings tab and sets its title through its own options.
4
4
 
5
+ ## Contents
6
+
7
+ - [Add a page](#add-a-page)
8
+ - [Add a sidebar link](#add-a-sidebar-link)
9
+ - [Hide or collapse the sidebar on a page](#hide-or-collapse-the-sidebar-on-a-page)
10
+ - [Add a settings tab](#add-a-settings-tab)
11
+ - [Set the page title](#set-the-page-title)
12
+
5
13
  ## Add a page
6
14
 
7
15
  Routes import `@tanstack/react-router`. A project from `ph init` has it as a `peerDependency`, and as a `devDependency` at the version Connect is built with; `ph migrate` adds it to an older project. Connect uses the project's copy, so keep that version rather than adding another.
@@ -23,7 +31,7 @@ Routes import `@tanstack/react-router`. A project from `ph init` has it as a `pe
23
31
  }
24
32
  ```
25
33
 
26
- 2. Open `/inventory` in Studio: `ph vetra` if it's running, else `ph connect studio`. Run only one: each has its own reactor.
34
+ 2. Open `/inventory` in Vetra Studio, at the `connectUrl` in `.ph/vetra-runtime.json`.
27
35
 
28
36
  A file outside `_app/` is a full page, without Connect's layout:
29
37
 
@@ -2,6 +2,16 @@
2
2
 
3
3
  How runtime values reach the Connect SPA, where they're defined, who can change them, and how the SPA picks them up.
4
4
 
5
+ ## Contents
6
+
7
+ - [TL;DR](#tldr)
8
+ - [The file](#the-file): [Renown sign-in](#renown-in-page-sign-in-connectrenownswitchboardurl--adapters), [reactor flags](#reactor-enforcement-flags-connectreactorfeatureflags), [creation signature policy](#creation-signature-policy-connectreactorcreatesignaturepolicy), [unsupported stored documents](#stored-documents-this-build-does-not-run-connectreactorunsupportedstoreddocuments), [multi-reactor routing](#multi-reactor-routing-connectinstancemultireactor)
9
+ - [Setting values — the precedence ladder](#setting-values--the-precedence-ladder): [five ways to feed a value](#the-five-ways-to-feed-a-value-into-a-layer), [notes on each method](#notes-on-each-method)
10
+ - [How Connect reads the file at boot](#how-connect-reads-the-file-at-boot)
11
+ - [Other consumers of the same file](#other-consumers-of-the-same-file)
12
+ - [Common operator workflows](#common-operator-workflows)
13
+ - [Design principle, in one line](#design-principle-in-one-line)
14
+
5
15
  ## TL;DR
6
16
 
7
17
  Connect's runtime configuration lives in a single JSON file: `powerhouse.config.json`. The file exists in two places — a hand-edited _source_ in the project root, and a built _dist_ that Connect actually serves at runtime. The SPA reads it once at boot via `fetch()` and never looks at environment variables for its own settings. Operators set values by editing the source file, passing CLI flags, running `ph connect config`, or — at deploy time — setting environment variables that a Docker entrypoint translates into the dist file.
@@ -70,7 +80,7 @@ The defaults for the `connect.*` block are defined once in `packages/shared/conn
70
80
 
71
81
  By default Connect authenticates by **redirecting** to the Renown portal (`connect.renown.url`). Setting `connect.renown.switchboardUrl` enables **in-page** sign-in — the user signs a Renown credential inside Connect and it is written/logged in via that switchboard, with no redirect. If it isn't set, or no adapter can produce a wallet session, Connect falls back to the redirect flow automatically.
72
82
 
73
- `connect.renown.adapters` selects which wallet adapters power in-page sign-in. Presence of a key enables that adapter. Connect ships with every adapter's peer dependencies installed, so operators need only edit the config; each adapter's libraries are still lazy-loaded on the first login click, so a privy-only deployment never downloads the RainbowKit chunk. (Standalone apps embedding `RenownWalletProvider` install peers per adapter they import — see the [Renown SDK README](../../packages/renown/README.md#wallet-adapters-in-page-sign-in).) Connect's config-to-adapter mapping lives in `src/components/renown-adapter-descriptors.ts`.
83
+ `connect.renown.adapters` selects which wallet adapters power in-page sign-in. Presence of a key enables that adapter. Connect ships with every adapter's peer dependencies installed, so operators need only edit the config; each adapter's libraries are still lazy-loaded on the first login click, so a privy-only deployment never downloads the RainbowKit chunk. (Standalone apps embedding `RenownWalletProvider` install peers per adapter they import — see "Wallet adapters (in-page sign-in)" in the `@renown/sdk` README.) Connect's config-to-adapter mapping lives in `src/components/renown-adapter-descriptors.ts`.
74
84
 
75
85
  ```jsonc
76
86
  "renown": {
@@ -227,7 +237,7 @@ Two fields interact with the service worker and deserve a caveat:
227
237
  Two special-case writers also exist:
228
238
 
229
239
  - `ph install --registry <url>` writes the top-level `packageRegistryUrl` (overwrites when `--registry` is explicit, otherwise preserves existing).
230
- - `ph vetra` passes a programmatic `callerOverride` to `ph connect studio` so default drives don't have to be tipped on every invocation.
240
+ - `ph vetra` passes a programmatic `callerOverride` to `ph connect studio` so default drives don't have to be tipped on every invocation. It also sets `instance.reactorClient: "remote"`, so Studio reads and writes every drive on the local Switchboard (drives created in Studio land there too), unless the project sets `instance.multiReactor` or `instance.reactorClient`, or runs `ph vetra --remote-drive`. `ph migrate` drops the `connect.instance` block older scaffolds wrote.
231
241
 
232
242
  ### Notes on each method
233
243
 
@@ -59,7 +59,7 @@ A project's styles are in two files, which the page builds as one Tailwind build
59
59
 
60
60
  ## Name and icon per host
61
61
 
62
- `connect.branding.appName` and `connect.branding.favicon` in `powerhouse.config.json` name the app and set its tab icon for every host. The app name also names the installed app (the PWA manifest), unless `connect.pwa.manifest` sets `name` or `short_name`; its icons, and the tab's when there's no `favicon`, come from `connect.branding.icon` (see [RUNTIME-CONFIG.md](../../RUNTIME-CONFIG.md)). A running `ph vetra` or `ph connect studio` reads `connect.branding` at startup: restart it after changing it. A host overrides either in its `config`:
62
+ `connect.branding.appName` and `connect.branding.favicon` in `powerhouse.config.json` name the app and set its tab icon for every host. The app name also names the installed app (the PWA manifest), unless `connect.pwa.manifest` sets `name` or `short_name`; its icons, and the tab's when there's no `favicon`, come from `connect.branding.icon` (see [runtime-config.md](./runtime-config.md)). A running `ph vetra` or `ph connect studio` restarts Studio when `powerhouse.config.json` changes, and the open tab reloads. Inside an editor, the `ph-default-styles` wrapper styles inputs, buttons, selects, checkboxes and radios; utility classes on an element win. A host overrides either in its `config`:
63
63
 
64
64
  ```js
65
65
  // hosts/lab/host.js
@@ -15,7 +15,6 @@ The build generates `.ph/connect-routes.gen.ts`: the route tree of Connect's rou
15
15
  | Symptom | Cause |
16
16
  | --- | --- |
17
17
  | `Connect could not mount the routes in hosts/connect/routes/` | A route outside `_app/` collides with one of Connect's, or two project files have one path. The message names the files. |
18
- | A new routes folder is ignored by a running `ph connect studio` | Connect checks for the folder at startup. Restart it. |
19
18
  | `tsc` reports `TS2883: The inferred type of 'Route' cannot be named without a reference to 'ConnectRouterContext'` | The route tree hasn't been generated yet. Run `ph build` (or start Studio) once; the error goes with the unknown route ids. |
20
19
  | `createFileRoute("/_app/x")` is a type error | The tree is not generated yet, or the tsconfig lacks the `route-tree` path. See [Types](#types). |
21
20
  | A sidebar link reloads the whole app | It is a plain `href`. Navigate through the router; see [Replace the sidebar](./layout.md#replace-the-sidebar). |
@@ -1 +0,0 @@
1
- {"version":3,"file":"AddDriveModal-BjgmiHJr.js","sources":["../src/generic/pages/create-drive-app-options.ts","../src/generic/modals/AddDriveModal.tsx"],"sourcesContent":["import type { AppOptions } from \"@powerhousedao/design-system/connect\";\nimport type { EditorModule } from \"document-model\";\n\n// Create Drive picker order: installed/custom apps first (rank 0), then the\n// generic explorer, then the vetra drive app last.\nconst DRIVE_APP_RANK: Record<string, number> = {\n GenericDriveExplorer: 1,\n \"vetra-drive-app\": 2,\n};\n\nexport function getCreateDriveAppOptions(\n appModules: EditorModule[] | undefined,\n): AppOptions[] {\n if (!appModules?.length) {\n return [];\n }\n\n return appModules\n .map((pkg) => ({\n id: pkg.config.id,\n name: pkg.config.name,\n sharingType: \"LOCAL\" as const,\n availableOffline: false,\n }))\n .sort((a, b) => (DRIVE_APP_RANK[a.id] ?? 0) - (DRIVE_APP_RANK[b.id] ?? 0));\n}\n","import { toast } from \"@powerhousedao/connect/services\";\nimport type {\n AddRemoteDriveInput,\n AppOptions,\n} from \"@powerhousedao/design-system/connect\";\nimport { AddDriveModal as ConnectAddLocalDriveModal } from \"@powerhousedao/design-system/connect\";\nimport {\n addDrive,\n addRemoteDrive,\n closePHModal,\n extractDriveSlugFromPath,\n fetchDriveInfo,\n getFullReactorClient,\n getDrives,\n getPHNavigation,\n setSelectedDrive,\n useAppModules,\n usePHModal,\n waitForDocumentReady,\n getPHStore,\n} from \"@powerhousedao/reactor-browser\";\nimport { t } from \"i18next\";\nimport { getCreateDriveAppOptions } from \"../pages/create-drive-app-options.js\";\n\n// Max wait for a remote drive's initial sync before skipping navigation.\n// Safe to be generous: navigation only fires if the user is still on home.\nconst REMOTE_DRIVE_NAV_TIMEOUT_MS = 30_000;\n\nexport function AddDriveModal() {\n const phModal = usePHModal();\n const open = phModal?.type === \"addDrive\";\n const appModules = useAppModules();\n const onAddLocalDrive = async (data: AppOptions) => {\n try {\n const app = appModules?.find((a) => a.config.id === data.id);\n const newDrive = await addDrive(\n {\n id: \"\",\n slug: \"\",\n global: {\n name: data.name,\n icon: null,\n },\n local: {\n availableOffline: data.availableOffline,\n sharingType: data.sharingType.toLowerCase(),\n listeners: [],\n triggers: [],\n },\n },\n app?.config.id,\n );\n\n toast(t(\"notifications.addDriveSuccess\"), {\n type: \"connect-success\",\n });\n\n if (!newDrive) {\n return;\n }\n\n setSelectedDrive(newDrive);\n } catch (e) {\n console.error(e);\n }\n };\n\n const onAddRemoteDrive = async (data: AddRemoteDriveInput) => {\n try {\n const driveId = await addRemoteDrive(data.url, data.id);\n\n toast(t(\"notifications.addDriveSuccess\"), {\n type: \"connect-success\",\n });\n\n // Navigate into the drive if its initial sync lands in time.\n // Not awaited so the modal closes immediately.\n // waiting for the drive and listing drives both need the full reactor client\n const reactorClient = getFullReactorClient();\n // Only a still unselected, un-pinned (home) view gets pulled into the\n // new drive — the user may have navigated elsewhere meanwhile.\n const stillOnHome = () =>\n !getPHStore()?.selectedDriveId &&\n !extractDriveSlugFromPath(getPHNavigation().location().pathname);\n void (async () => {\n try {\n if (!reactorClient) {\n return;\n }\n await waitForDocumentReady(reactorClient, driveId, {\n timeoutMs: REMOTE_DRIVE_NAV_TIMEOUT_MS,\n });\n const drives = await getDrives(reactorClient);\n const drive = drives.find((d) => d.header.id === driveId);\n if (drive && stillOnHome()) {\n setSelectedDrive(drive);\n }\n } catch {\n // sync still in flight — the drive shows up on home once it lands\n }\n })();\n } catch (e) {\n console.error(e);\n }\n };\n async function onAddLocalDriveSubmit(data: AppOptions) {\n await onAddLocalDrive(data);\n closePHModal();\n }\n\n async function onAddRemoteDriveSubmit(data: AddRemoteDriveInput) {\n await onAddRemoteDrive(data);\n closePHModal();\n }\n\n const ready = !!appModules?.length;\n\n return (\n <ConnectAddLocalDriveModal\n open={open && ready}\n onAddLocalDrive={(data) => {\n void onAddLocalDriveSubmit(data);\n }}\n onAddRemoteDrive={(data) => {\n void onAddRemoteDriveSubmit(data);\n }}\n requestPublicDrive={(url: string) => fetchDriveInfo(url)}\n onOpenChange={(status) => {\n if (!status) return closePHModal();\n }}\n appOptions={getCreateDriveAppOptions(appModules)}\n />\n );\n}\n"],"names":["ConnectAddLocalDriveModal"],"mappings":";;;;;;;;AAKA,MAAM,iBAAyC;CAC7C,sBAAsB;CACtB,mBAAmB;AACrB;AAEA,SAAgB,yBACd,YACc;CACd,IAAI,CAAC,YAAY,QACf,OAAO,CAAC;CAGV,OAAO,WACJ,KAAK,SAAS;EACb,IAAI,IAAI,OAAO;EACf,MAAM,IAAI,OAAO;EACjB,aAAa;EACb,kBAAkB;CACpB,EAAE,CAAC,CACF,MAAM,GAAG,OAAO,eAAe,EAAE,OAAO,MAAM,eAAe,EAAE,OAAO,EAAE;AAC7E;;;ACCA,MAAM,8BAA8B;AAEpC,SAAgB,gBAAgB;CAE9B,MAAM,OADU,WACG,CAAC,EAAE,SAAS;CAC/B,MAAM,aAAa,cAAc;CACjC,MAAM,kBAAkB,OAAO,SAAqB;EAClD,IAAI;GACF,MAAM,MAAM,YAAY,MAAM,MAAM,EAAE,OAAO,OAAO,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,QAAQ;EACd,kBAAkB,SAAS;GACzB,sBAA2B,IAAI;EACjC;EACA,mBAAmB,SAAS;GAC1B,uBAA4B,IAAI;EAClC;EACA,qBAAqB,QAAgB,eAAe,GAAG;EACvD,eAAe,WAAW;GACxB,IAAI,CAAC,QAAQ,OAAO,aAAa;EACnC;EACA,YAAY,yBAAyB,UAAU;CAChD,CAAA;AAEL","debug_id":"cb114064-0090-5da7-a317-5056a3e9d8b7"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"OpenFileDocumentsModal-B9c-CsKT.js","sources":["../src/utils/open-file-plan.ts","../src/components/modal/modals/OpenFileDocumentsModal.tsx"],"sourcesContent":["import { isDocumentTypeSupported } from \"@powerhousedao/reactor-browser\";\nimport type { Node } from \"@powerhousedao/shared/document-drive\";\nimport {\n getNextCopyNumber,\n isFileNode,\n} from \"@powerhousedao/shared/document-drive\";\n\n// Pure pre-flight planning for the open-file picker: given the pending files,\n// their parse results and the selected drive's nodes, decide per file whether\n// it can be imported, whether it collides with an existing document, and what\n// name it should be stored under. No reactor access — everything here derives\n// synchronously so the picker can recompute on every drive switch.\n\n/** What the one-time parse of a pending file yielded. */\nexport type ParsedFileInfo =\n | { state: \"parsed\"; id: string; documentType: string; headerName: string }\n // The document model isn't installed: the import path's package\n // auto-discovery may still resolve it, so the file stays importable —\n // but its header is unknown, so no duplicate check is possible.\n | { state: \"model-missing\" }\n // The document needs a newer document model version than any installed\n // module can replay.\n | {\n state: \"version-unsupported\";\n documentType: string;\n requiredVersion: number;\n }\n // Corrupt zip / not a Powerhouse document.\n | { state: \"invalid\" };\n\nexport type PlannedRow =\n | { kind: \"checking\" }\n | { kind: \"invalid\" }\n | {\n kind: \"version-unsupported\";\n documentType: string;\n requiredVersion: number;\n }\n | { kind: \"unsupported\" }\n | {\n kind: \"ready\";\n finalName: string;\n duplicate?: \"id\" | \"name\";\n renamed: boolean;\n };\n\nexport type PlanEntry = {\n /** Stable identity of the pending file (see pendingFileKey). */\n key: string;\n file: File;\n /** undefined while the parse is still in flight. */\n parsed: ParsedFileInfo | undefined;\n};\n\n/** Same name normalization the import stores (use-on-drop-file convention). */\nexport function storedFileName(file: File): string {\n return file.name.replace(/\\..+/gim, \"\");\n}\n\n/**\n * Duplicate semantics mirror the import path's isDocumentInLocation, scoped\n * to the drive ROOT: an id match, or a file node with the same name AND the\n * same document type. Renames follow the drive-tree copy convention\n * (\"name (copy) N\" via getNextCopyNumber). Names assigned within the batch\n * accumulate into the collision set, so two pending files that would store\n * the same name never end up identical either.\n */\nexport function planOpenFileImports(args: {\n entries: PlanEntry[];\n nodes: Node[];\n documentTypes: string[] | undefined;\n}): Map<string, PlannedRow> {\n const { entries, nodes, documentTypes } = args;\n const rootNodes = nodes.filter(\n (node) => (node.parentFolder ?? null) === null,\n );\n const rows = new Map<string, PlannedRow>();\n const assignedNames = new Set<string>();\n\n function uniqueName(base: string, driveNames: string[]): string {\n const collides = driveNames.includes(base) || assignedNames.has(base);\n if (!collides) return base;\n const candidates = [...driveNames, ...assignedNames];\n return `${base} (copy) ${getNextCopyNumber(candidates, base)}`;\n }\n\n for (const { key, file, parsed } of entries) {\n if (!parsed) {\n rows.set(key, { kind: \"checking\" });\n continue;\n }\n if (parsed.state === \"invalid\") {\n rows.set(key, { kind: \"invalid\" });\n continue;\n }\n\n if (parsed.state === \"version-unsupported\") {\n rows.set(key, {\n kind: \"version-unsupported\",\n documentType: parsed.documentType,\n requiredVersion: parsed.requiredVersion,\n });\n continue;\n }\n\n if (parsed.state === \"model-missing\") {\n const base = storedFileName(file) || file.name;\n const finalName = uniqueName(base, []);\n assignedNames.add(finalName);\n rows.set(key, {\n kind: \"ready\",\n finalName,\n renamed: finalName !== base,\n });\n continue;\n }\n\n if (!isDocumentTypeSupported(parsed.documentType, documentTypes)) {\n rows.set(key, { kind: \"unsupported\" });\n continue;\n }\n\n // The stored name falls back to the document's own header name when the\n // file name is extension-only (\".phd\" normalizes to \"\").\n const base = storedFileName(file) || parsed.headerName;\n const sameTypeNames = rootNodes\n .filter(\n (node) => isFileNode(node) && node.documentType === parsed.documentType,\n )\n .map((node) => node.name);\n const idDuplicate = rootNodes.some((node) => node.id === parsed.id);\n const nameDuplicate = sameTypeNames.includes(base);\n\n const finalName = uniqueName(base, sameTypeNames);\n assignedNames.add(finalName);\n rows.set(key, {\n kind: \"ready\",\n finalName,\n duplicate: nameDuplicate ? \"name\" : idDuplicate ? \"id\" : undefined,\n renamed: finalName !== base,\n });\n }\n\n return rows;\n}\n","import {\n clearPendingImportFiles,\n getPendingImportFiles,\n pendingFileKey,\n subscribePendingImportFiles,\n} from \"../../../utils/launch-queue.js\";\nimport {\n planOpenFileImports,\n type ParsedFileInfo,\n type PlanEntry,\n} from \"../../../utils/open-file-plan.js\";\nimport {\n runOpenFileImports,\n type PlannedOpenFileImport,\n} from \"../../../utils/open-file-uploads.js\";\nimport { DriveIcon } from \"../../drive-icon.js\";\nimport { Modal } from \"@powerhousedao/design-system\";\nimport {\n Combobox,\n formatFileSize,\n ModalButton,\n} from \"@powerhousedao/design-system/connect\";\nimport {\n closePHModal,\n DocumentModelNotFoundError,\n loadFile,\n setSelectedDrive,\n showPHModal,\n useDocumentTypes,\n useDrives,\n usePHModal,\n useUserPermissions,\n getPHStore,\n getDriveName,\n} from \"@powerhousedao/reactor-browser\";\nimport { UnsupportedDocumentModelVersionError } from \"@powerhousedao/shared/document-model\";\nimport { useEffect, useState, useSyncExternalStore } from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\n// Drive picker for documents opened through the OS file association (PWA\n// File Handling). This is the flow's ONLY dialog state: validity and\n// duplicate checks run up-front against the selected drive (inline errors,\n// automatic \"(copy) N\" renames surfaced as \"Rename and import\"), and on\n// confirmation the dialog closes — progress is shown by the floating upload\n// panel (OpenFileUploadList) driven from utils/open-file-uploads.ts, the same\n// UI drag-and-drop uses.\n//\n// The component only mounts while the modal is shown (ModalOutlet keys on\n// the modal type), so picker state starts fresh on every open.\n\n// Parse results are cached at module level so they survive the create-drive\n// detour (which unmounts this component) and are computed once per pending\n// file — loadFile replays the file's full operation history. Only header\n// fields are retained, never the parsed document. In-flight promises are\n// cached too, deduplicating StrictMode double-effects.\nconst parseCache = new Map<string, ParsedFileInfo | Promise<ParsedFileInfo>>();\n\nasync function parsePendingFile(file: File): Promise<ParsedFileInfo> {\n try {\n const document = await loadFile(file);\n return {\n state: \"parsed\",\n id: document.header.id,\n documentType: document.header.documentType,\n headerName: document.header.name,\n };\n } catch (error) {\n if (UnsupportedDocumentModelVersionError.isError(error)) {\n return {\n state: \"version-unsupported\",\n documentType: error.documentType,\n requiredVersion: error.requiredVersion,\n };\n }\n // Missing document model ≠ invalid: the import path's package\n // auto-discovery may still resolve it.\n if (DocumentModelNotFoundError.isError(error)) {\n return { state: \"model-missing\" };\n }\n return { state: \"invalid\" };\n }\n}\n\nexport function OpenFileDocumentsModal() {\n const phModal = usePHModal();\n const open = phModal?.type === \"openFileDocuments\";\n const { t } = useTranslation();\n const drives = useDrives();\n const documentTypes = useDocumentTypes();\n const { isAllowedToCreateDocuments } = useUserPermissions();\n const pendingFiles = useSyncExternalStore(\n subscribePendingImportFiles,\n getPendingImportFiles,\n );\n\n const [pickedDriveId, setPickedDriveId] = useState<string>();\n const [, setParseVersion] = useState(0);\n\n // Kick off (and cache) the one-time parse of each pending file. Gated on\n // the reactor being ready — never cache \"reactor not initialized\" as a\n // parse result; the effect re-runs when files change and drives arriving\n // re-render the modal anyway.\n useEffect(() => {\n if (!getPHStore()?.reactorClient) return;\n let cancelled = false;\n const pendingKeys = new Set(pendingFiles.map(pendingFileKey));\n for (const key of parseCache.keys()) {\n if (!pendingKeys.has(key)) parseCache.delete(key);\n }\n for (const file of pendingFiles) {\n const key = pendingFileKey(file);\n if (parseCache.has(key)) continue;\n const promise = parsePendingFile(file).then((info) => {\n parseCache.set(key, info);\n return info;\n });\n parseCache.set(key, promise);\n void promise.then(() => {\n if (!cancelled) setParseVersion((version) => version + 1);\n });\n }\n return () => {\n cancelled = true;\n };\n }, [pendingFiles]);\n\n // The first drive is preselected so opening a file is a single\n // confirmation; the select lets the user switch destination.\n const selectedDriveId = pickedDriveId ?? drives?.[0]?.header.id;\n const selectedDrive = drives?.find(\n (drive) => drive.header.id === selectedDriveId,\n );\n\n const driveOptions = (drives ?? []).map((drive) => ({\n label: getDriveName(drive),\n value: drive.header.id,\n drive,\n }));\n type DriveOption = (typeof driveOptions)[number];\n\n // Pure derivations — recomputed on drive switch, on files arriving, and on\n // parses settling.\n const entries: PlanEntry[] = pendingFiles.map((file) => {\n const cached = parseCache.get(pendingFileKey(file));\n return {\n key: pendingFileKey(file),\n file,\n parsed: cached instanceof Promise ? undefined : cached,\n };\n });\n const plan = selectedDrive\n ? planOpenFileImports({\n entries,\n nodes: selectedDrive.state.global.nodes,\n documentTypes,\n })\n : new Map<string, never>();\n\n const planRows = [...plan.values()];\n const readyCount = planRows.filter((row) => row.kind === \"ready\").length;\n const anyChecking = planRows.some((row) => row.kind === \"checking\");\n const anyRenamed = planRows.some(\n (row) => row.kind === \"ready\" && row.renamed,\n );\n\n function onImport() {\n const drive = selectedDrive;\n if (!drive) return;\n const imports: PlannedOpenFileImport[] = [];\n for (const { key, file } of entries) {\n const row = plan.get(key);\n if (row?.kind === \"ready\") imports.push({ file, name: row.finalName });\n }\n if (imports.length === 0) return;\n // Ordering matters: the pending store must be cleared BEFORE the modal\n // closes — the launch-queue listener reopens this picker whenever the\n // modal clears while files are still pending.\n clearPendingImportFiles();\n closePHModal();\n setSelectedDrive(drive);\n void runOpenFileImports({\n driveId: drive.header.id,\n imports,\n documentTypes,\n });\n }\n\n function onCancel() {\n clearPendingImportFiles();\n closePHModal();\n }\n\n if (!open) return null;\n\n const hasDrives = (drives?.length ?? 0) > 0;\n\n function rowAnnotation(key: string) {\n const row = plan.get(key);\n if (!row) return null;\n switch (row.kind) {\n case \"checking\":\n return (\n <span className=\"text-xs text-muted-foreground\">\n {t(\"modals.openFileDocuments.checking\")}\n </span>\n );\n case \"invalid\":\n return (\n <span className=\"text-xs text-destructive\">\n {t(\"modals.openFileDocuments.invalidFile\")}\n </span>\n );\n case \"version-unsupported\":\n return (\n <span className=\"text-xs text-destructive\">\n {`Requires version ${row.requiredVersion} of ${row.documentType} — update the package`}\n </span>\n );\n case \"unsupported\":\n return (\n <span className=\"text-xs text-destructive\">\n {t(\"modals.openFileDocuments.unsupportedType\")}\n </span>\n );\n case \"ready\":\n // \"name\": same name + type already in the drive, so the file is\n // renamed to a copy. \"id\": same document id, imported as a fresh copy\n // under its original name. A row that only got renamed to avoid\n // clashing with another file in THIS batch is NOT in the drive, so it\n // must not claim to be — it gets the neutral rename hint instead.\n if (row.duplicate === \"name\") {\n return (\n <span className=\"text-xs text-muted-foreground\">\n {t(\"modals.openFileDocuments.duplicateHint\", {\n name: row.finalName,\n })}\n </span>\n );\n }\n if (row.duplicate === \"id\") {\n return (\n <span className=\"text-xs text-muted-foreground\">\n {t(\"modals.openFileDocuments.duplicateCopyHint\")}\n </span>\n );\n }\n if (row.renamed) {\n return (\n <span className=\"text-xs text-muted-foreground\">\n {t(\"modals.openFileDocuments.renamedHint\", {\n name: row.finalName,\n })}\n </span>\n );\n }\n return null;\n }\n }\n\n return (\n <Modal\n open={open}\n onOpenChange={(status) => {\n if (!status) onCancel();\n }}\n // The drive select's dropdown must be able to spill past the dialog\n // bounds instead of being clipped (the menu cannot portal to <body>:\n // Radix's modal pointer-events lock would make it unclickable there).\n contentProps={{ className: \"overflow-visible\" }}\n >\n <div className=\"w-[520px] p-6\">\n <div className=\"pb-2 text-2xl font-bold text-foreground\">\n {t(\"modals.openFileDocuments.title\", {\n count: pendingFiles.length,\n })}\n </div>\n\n {!isAllowedToCreateDocuments ? (\n <>\n <div className=\"my-6 rounded-md bg-background p-4 text-center text-foreground\">\n {t(\"modals.openFileDocuments.notAllowed\")}\n </div>\n <div className=\"mt-8 flex\">\n <ModalButton variant=\"cancel\" onClick={onCancel}>\n {t(\"common.cancel\")}\n </ModalButton>\n </div>\n </>\n ) : (\n <>\n <div className=\"my-4 flex flex-col gap-1 text-sm text-foreground\">\n {pendingFiles.map((file, index) => {\n const key = pendingFileKey(file);\n const annotation = rowAnnotation(key);\n return (\n <div\n key={`${index}-${key}`}\n className=\"flex flex-col gap-0.5 rounded-md bg-background px-3 py-2\"\n >\n <div className=\"flex justify-between gap-2\">\n <span className=\"truncate\">{file.name}</span>\n <span className=\"shrink-0 text-muted-foreground\">\n {formatFileSize(file.size)}\n </span>\n </div>\n {annotation}\n </div>\n );\n })}\n </div>\n\n {hasDrives ? (\n <>\n <div className=\"mb-2 text-sm text-muted-foreground\">\n {t(\"modals.openFileDocuments.body\")}\n </div>\n <Combobox\n id=\"open-file-documents-drive\"\n isSearchable={false}\n options={driveOptions}\n value={\n driveOptions.find(\n (option) => option.value === selectedDriveId,\n ) ?? null\n }\n onChange={(option) =>\n setPickedDriveId((option as DriveOption).value)\n }\n formatOptionLabel={(option) => {\n const { label, drive } = option as DriveOption;\n return (\n <span className=\"flex items-center gap-2\">\n <DriveIcon drive={drive} />\n <span className=\"truncate\">{label}</span>\n </span>\n );\n }}\n maxMenuHeight={200}\n />\n </>\n ) : (\n <div className=\"my-6 rounded-md bg-background p-4 text-center text-foreground\">\n {t(\"modals.openFileDocuments.noDrives\")}\n </div>\n )}\n\n <div className=\"mt-8 flex justify-between gap-3\">\n <ModalButton variant=\"cancel\" onClick={onCancel}>\n {t(\"common.cancel\")}\n </ModalButton>\n {hasDrives ? (\n <ModalButton\n variant=\"confirm\"\n disabled={!selectedDriveId || readyCount === 0 || anyChecking}\n onClick={onImport}\n >\n {anyRenamed\n ? t(\"modals.openFileDocuments.renameAndImport\")\n : t(\"modals.openFileDocuments.import\")}\n </ModalButton>\n ) : (\n <ModalButton\n variant=\"confirm\"\n onClick={() => showPHModal({ type: \"addDrive\" })}\n >\n {t(\"modals.openFileDocuments.createDrive\")}\n </ModalButton>\n )}\n </div>\n </>\n )}\n </div>\n </Modal>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;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,OAAD;KAAK,WAAU;KACZ,UAAA,EAAE,+BAA+B;IAC/B,CAAA,GACL,oBAAC,UAAD;KACE,IAAG;KACH,cAAc;KACd,SAAS;KACT,OACE,aAAa,MACV,WAAW,OAAO,UAAU,eAC/B,KAAK;KAEP,WAAW,WACT,iBAAkB,OAAuB,KAAK;KAEhD,oBAAoB,WAAW;MAC7B,MAAM,EAAE,OAAO,UAAU;MACzB,OACE,qBAAC,QAAD;OAAM,WAAU;OAAhB,UAAA,CACE,oBAAC,WAAD,EAAkB,MAAQ,CAAA,GAC1B,oBAAC,QAAD;QAAM,WAAU;QAAY,UAAA;OAAY,CAAA,CACpC;;KAEV;KACA,eAAe;IAChB,CAAA,CACD,EAAA,CAAA,IAEF,oBAAC,OAAD;KAAK,WAAU;KACZ,UAAA,EAAE,mCAAmC;IACnC,CAAA;IAGP,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,oBAAC,aAAD;MAAa,SAAQ;MAAS,SAAS;MACpC,UAAA,EAAE,eAAe;KACP,CAAA,GACZ,YACC,oBAAC,aAAD;MACE,SAAQ;MACR,UAAU,CAAC,mBAAmB,eAAe,KAAK;MAClD,SAAS;MAER,UAAA,aACG,EAAE,0CAA0C,IAC5C,EAAE,iCAAiC;KAC5B,CAAA,IAEb,oBAAC,aAAD;MACE,SAAQ;MACR,eAAe,YAAY,EAAE,MAAM,WAAW,CAAC;MAE9C,UAAA,EAAE,sCAAsC;KAC9B,CAAA,CAEZ;;GACL,EAAA,CAAA,CAED;;CACA,CAAA;AAEX","debug_id":"afc3d1f0-0acf-5c30-b0e9-d5cc1f0d5c33"}
@@ -1,4 +0,0 @@
1
- import { t as AppLoader } from "./app-loader-DXgAoCn8.js";
2
- export { AppLoader };
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="fe552051-8b42-5713-abb3-bc77bb818f70")}catch(e){}}();
4
- //# debugId=fe552051-8b42-5713-abb3-bc77bb818f70
@@ -1,4 +0,0 @@
1
- import { ContentOutlet as ContentOutlet$1, ModalDialog, ModalFrameProps, useDriveRouteData as useDriveRouteData$1, useNavRoutes as useNavRoutes$1, useSidebarMode as useSidebarMode$1 } from "@powerhousedao/connect-core/router";
2
- import { SidebarItem as SidebarItem$1 } from "@powerhousedao/design-system/connect";
3
- export { useDriveRouteData$1 as a, SidebarItem$1 as i, ModalDialog as n, useNavRoutes$1 as o, ModalFrameProps as r, useSidebarMode$1 as s, ContentOutlet$1 as t };
4
- export {};
@@ -1,5 +0,0 @@
1
- import { ContentOutlet as ContentOutlet$1, ModalDialog, useDriveRouteData as useDriveRouteData$1, useNavRoutes as useNavRoutes$1, useSidebarMode as useSidebarMode$1 } from "@powerhousedao/connect-core/router";
2
- import { SidebarItem as SidebarItem$1 } from "@powerhousedao/design-system/connect";
3
- export { useNavRoutes$1 as a, useDriveRouteData$1 as i, ModalDialog as n, useSidebarMode$1 as o, SidebarItem$1 as r, ContentOutlet$1 as t };
4
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c5047263-3869-58eb-b27a-8fe01ad6dff0")}catch(e){}}();
5
- //# debugId=c5047263-3869-58eb-b27a-8fe01ad6dff0
@@ -1,4 +0,0 @@
1
- import { n as getConnectRouter } from "./router-9jEQB-nr.js";
2
- export { getConnectRouter };
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a90769d8-2935-5302-8a65-e477bcd32ea3")}catch(e){}}();
4
- //# debugId=a90769d8-2935-5302-8a65-e477bcd32ea3
@@ -1 +0,0 @@
1
- {"version":3,"file":"settings-tabs-Du7xiSzi.js","sources":["../src/generic/pages/use-drive-auth-gate.ts","../src/generic/layout/sidebar.tsx","../src/generic/layout/app-layout.tsx","../src/generic/layout/route-views.tsx","../src/generic/editors/app-container.tsx","../src/generic/pages/content.tsx","../src/generic/settings/tabs.ts","../src/generic/settings-tabs.ts"],"sourcesContent":["import {\n setSelectedDrive,\n useConnectionStates,\n useDrives,\n useSelectedDriveId,\n useSync,\n useUser,\n type ConnectionStateSnapshot,\n} from \"@powerhousedao/reactor-browser\";\nimport type { DocumentDriveDocument } from \"@powerhousedao/shared/document-drive\";\nimport { useCallback, useEffect, useMemo, useSyncExternalStore } from \"react\";\n\n/** Return code for the auth gate decision:\n * - `\"login\"` : anonymous user, the selected drive's channel rejected with `requiresAuth`.\n * - `\"unauthorized\"` : signed in, but the selected drive's channel was rejected — they aren't the owner.\n * - `null` : no auth barrier on the selected drive, carry on. */\nexport type AuthGate = \"login\" | \"unauthorized\" | null;\n\n/** A remote, reduced to the two fields the gate decision needs. */\nexport type AuthGateRemote = {\n readonly name: string;\n readonly driveId: string;\n};\n\nexport type AuthGateSelection = {\n readonly selectedDriveId: string | undefined;\n readonly remotes: readonly AuthGateRemote[];\n};\n\n/**\n * Decides the gate for the drive the user selected, and only that drive. A\n * refusal on any other drive must not hide the rest of Connect.\n *\n * Connection states are keyed by remote name, which is a random uuid, so the\n * caller supplies the remote -> drive mapping.\n */\nexport function computeAuthGate(\n isAuthenticated: boolean,\n connectionStates: ReadonlyMap<string, ConnectionStateSnapshot>,\n selection: AuthGateSelection,\n): AuthGate {\n const { selectedDriveId, remotes } = selection;\n if (!selectedDriveId) return null;\n\n let refused = false;\n for (const remote of remotes) {\n if (remote.driveId !== selectedDriveId) continue;\n const snapshot = connectionStates.get(remote.name);\n if (snapshot?.state === \"error\" && snapshot.requiresAuth) {\n refused = true;\n break;\n }\n }\n if (!refused) return null;\n return isAuthenticated ? \"unauthorized\" : \"login\";\n}\n\n// Drives dismissed from the auth gate. Deliberately in memory and session\n// scoped: the reactor keeps a refused drive's storage record, so a reload while\n// signed in must bring the drive back rather than fight that recovery.\nconst hiddenDriveIds = new Set<string>();\nlet hiddenDriveIdsSnapshot: readonly string[] = [];\nconst hiddenDriveListeners = new Set<() => void>();\n\nfunction publishHiddenDrives(): void {\n hiddenDriveIdsSnapshot = [...hiddenDriveIds];\n for (const listener of [...hiddenDriveListeners]) {\n listener();\n }\n}\n\nfunction subscribeHiddenDrives(listener: () => void): () => void {\n hiddenDriveListeners.add(listener);\n return () => {\n hiddenDriveListeners.delete(listener);\n };\n}\n\nfunction getHiddenDriveIds(): readonly string[] {\n return hiddenDriveIdsSnapshot;\n}\n\n/** Hides a drive from Connect's drive lists until the page reloads. */\nexport function hideDriveForSession(driveId: string): void {\n if (hiddenDriveIds.has(driveId)) return;\n hiddenDriveIds.add(driveId);\n publishHiddenDrives();\n}\n\n/** Restores every drive hidden this session. */\nexport function clearHiddenDrives(): void {\n if (hiddenDriveIds.size === 0) return;\n hiddenDriveIds.clear();\n publishHiddenDrives();\n}\n\nexport function useHiddenDriveIds(): readonly string[] {\n return useSyncExternalStore(\n subscribeHiddenDrives,\n getHiddenDriveIds,\n getHiddenDriveIds,\n );\n}\n\n/** `useDrives()` minus the drives dismissed from the auth gate this session. */\nexport function useVisibleDrives(): DocumentDriveDocument[] | undefined {\n const drives = useDrives();\n const hidden = useHiddenDriveIds();\n return useMemo(() => {\n if (!drives || hidden.length === 0) return drives;\n return drives.filter((drive) => !hidden.includes(drive.header.id));\n }, [drives, hidden]);\n}\n\n/** Live wrapper over {@link computeAuthGate}, plus the dismiss action. */\nexport function useDriveAuthGate(): { gate: AuthGate; dismiss: () => void } {\n const user = useUser();\n const connectionStates = useConnectionStates();\n const syncManager = useSync();\n const selectedDriveId = useSelectedDriveId();\n\n // Remote names are random uuids; `meta.collectionId.driveId` is the only link\n // from a connection state back to the drive it belongs to. Recomputed\n // alongside `connectionStates`, which also refreshes as remotes come and go.\n const remotes = useMemo<AuthGateRemote[]>(\n () =>\n (syncManager?.list() ?? []).map((remote) => ({\n name: remote.meta.name,\n driveId: remote.meta.collectionId.driveId,\n })),\n [syncManager, connectionStates],\n );\n\n // A change of identity changes who the drive would be fetched as, so give the\n // dismissed drives another chance instead of waiting for a reload.\n const address = user?.address;\n useEffect(() => {\n clearHiddenDrives();\n }, [address]);\n\n const dismiss = useCallback(() => {\n if (selectedDriveId) {\n hideDriveForSession(selectedDriveId);\n }\n setSelectedDrive(undefined);\n }, [selectedDriveId]);\n\n const gate = computeAuthGate(Boolean(user), connectionStates, {\n selectedDriveId,\n remotes,\n });\n return { gate, dismiss };\n}\n","import {\n ConnectSidebar,\n ConnectTooltipProvider,\n SidebarAddDriveItem,\n SidebarItem,\n useEns,\n} from \"@powerhousedao/design-system/connect\";\n\nimport {\n isPlainClick,\n logout,\n makeDriveSlug,\n preloadDrive,\n setSelectedDrive,\n showPHModal,\n useIsAddDriveEnabled,\n useLinkProps,\n useSelectedDriveSafe,\n useUser,\n getDriveName,\n} from \"@powerhousedao/reactor-browser\";\nimport type { DocumentDriveDocument } from \"@powerhousedao/shared/document-drive\";\nimport type { AnyRouter } from \"@tanstack/react-router\";\nimport { useRouter, useRouterState } from \"@tanstack/react-router\";\nimport type { ReactNode } from \"react\";\nimport { useOpenRenownLogin } from \"../hooks/use-renown-login.js\";\nimport type { NavRouteEntry } from \"@powerhousedao/connect-core/router\";\nimport { useNavRoutes } from \"@powerhousedao/connect-core/router\";\nimport { DriveIcon } from \"@powerhousedao/connect/components/shared\";\nimport { ErrorBoundary } from \"@powerhousedao/connect/components/shared\";\nimport { useVisibleDrives } from \"../pages/use-drive-auth-gate.js\";\n\nfunction DriveSidebarItem(props: {\n drive: DocumentDriveDocument;\n active: boolean;\n}) {\n const { drive, active } = props;\n const link = useLinkProps({ driveSlug: makeDriveSlug(drive) }, () =>\n setSelectedDrive(drive),\n );\n return (\n <SidebarItem\n title={getDriveName(drive)}\n href={link.href}\n aria-current={link[\"aria-current\"]}\n onClick={link.onClick}\n onPreload={() => preloadDrive(drive)}\n active={active}\n icon={<DriveIcon drive={drive} />}\n />\n );\n}\n\n/** The drives the user may open, and the add-drive item when enabled. */\nexport function SidebarDriveItems() {\n const drives = useVisibleDrives();\n const isAddDriveEnabled = useIsAddDriveEnabled();\n const [selectedDrive] = useSelectedDriveSafe();\n return (\n <>\n {drives?.map((drive) => (\n <DriveSidebarItem\n key={drive.header.id}\n drive={drive}\n active={selectedDrive?.header.id === drive.header.id}\n />\n ))}\n {isAddDriveEnabled && (\n <SidebarAddDriveItem\n onClick={() => showPHModal({ type: \"addDrive\" })}\n />\n )}\n </>\n );\n}\n\nfunction NavSidebarItem({ item }: { item: NavRouteEntry }) {\n // Nav routes can come from a project's tree, unknown to Connect's types.\n const router = useRouter() as unknown as AnyRouter;\n // A boolean select: loading state changes don't re-render the item.\n const current = useRouterState({\n select: () => !!router.matchRoute({ to: item.to }, { fuzzy: true }),\n });\n const Icon = item.icon;\n return (\n <SidebarItem\n title={item.label}\n href={router.buildLocation({ to: item.to }).publicHref}\n aria-current={current ? \"page\" : undefined}\n onClick={(event) => {\n if (!isPlainClick(event)) return;\n event.preventDefault();\n void router.navigate({ to: item.to });\n }}\n onPreload={() => {\n router.preloadRoute({ to: item.to }).catch(() => undefined);\n }}\n icon={Icon ? <Icon size={24} /> : undefined}\n />\n );\n}\n\n/** Links to the routes that declare `staticData.nav`, in order. */\nexport function SidebarNavItems() {\n const items = useNavRoutes();\n return (\n <>\n {items.map((item) => (\n <NavSidebarItem key={item.routeId} item={item} />\n ))}\n </>\n );\n}\n\nexport type SidebarProps = {\n /** Items after the drives and nav routes, e.g. a custom layout's links. */\n extraItems?: ReactNode;\n /** Header and footer only, no items. */\n collapsed?: boolean;\n};\n\n/** Connect's sidebar: drives, nav routes, settings and the user. */\nexport function Sidebar({ extraItems, collapsed }: SidebarProps = {}) {\n const user = useUser();\n const openLogin = useOpenRenownLogin();\n const connectDebug =\n typeof localStorage !== \"undefined\" &&\n localStorage.getItem(\"CONNECT_DEBUG\") === \"true\";\n\n const ensName = user?.ens?.name || user?.profile?.username || undefined;\n const avatarUrl =\n user?.ens?.avatarUrl || user?.profile?.userImage || undefined;\n\n const ensInfo = useEns(!avatarUrl ? user?.address : undefined);\n\n const settingsLink = useLinkProps({ settings: true });\n\n const etherscanUrl = user?.address\n ? `https://etherscan.io/address/${user.address}`\n : \"\";\n\n return (\n <ConnectTooltipProvider>\n <ConnectSidebar\n id=\"sidebar\"\n data-collapsed={collapsed ? \"\" : undefined}\n onClick={() => setSelectedDrive(undefined)}\n onClickSettings={settingsLink.onClick}\n settingsHref={settingsLink.href}\n settingsCurrent={settingsLink[\"aria-current\"]}\n address={user?.address}\n onLogin={openLogin}\n onDisconnect={() => {\n void logout();\n }}\n ensName={ensName || ensInfo.data?.ens}\n avatarUrl={\n avatarUrl ||\n ensInfo.data?.avatar_small ||\n ensInfo.data?.avatar_url ||\n undefined\n }\n etherscanUrl={etherscanUrl}\n showDebug={connectDebug}\n onDebugClick={() => showPHModal({ type: \"debugSettings\" })}\n >\n {!collapsed && (\n <ErrorBoundary\n variant=\"text\"\n fallbackMessage=\"There was an error loading drives\"\n loggerContext={[\"Connect\", \"Sidebar\"]}\n >\n <SidebarDriveItems />\n <SidebarNavItems />\n {extraItems}\n </ErrorBoundary>\n )}\n </ConnectSidebar>\n </ConnectTooltipProvider>\n );\n}\n","import { useIsEmbedded } from \"@powerhousedao/connect-core/embedded\";\nimport type { ReactNode } from \"react\";\nimport {\n ContentOutlet,\n useSidebarMode,\n} from \"@powerhousedao/connect-core/router\";\nimport { Sidebar } from \"./sidebar.js\";\n\nexport type AppLayoutProps = {\n /** Replaces Connect's sidebar, e.g. `<ConnectSidebar extraItems={...} />`. */\n sidebar?: ReactNode;\n};\n\n/** The `_app` layout: the sidebar beside the matched route. Embedded mode and\n * `staticData.sidebar: \"hidden\"` drop the sidebar. */\nexport function AppLayout({ sidebar }: AppLayoutProps = {}) {\n const isEmbedded = useIsEmbedded();\n const mode = useSidebarMode();\n const showSidebar = !isEmbedded && mode !== \"hidden\";\n return (\n <div\n // On a phone Connect's sidebar, wrapped or not, is a bar under the page; a project's keeps its place.\n className=\"flex h-full items-stretch overflow-auto max-sm:has-[>[data-connect-sidebar]]:flex-col-reverse\"\n role=\"presentation\"\n tabIndex={0}\n >\n {showSidebar && (sidebar ?? <Sidebar collapsed={mode === \"collapsed\"} />)}\n <ContentOutlet className=\"relative flex flex-1 flex-col overflow-auto\" />\n </div>\n );\n}\n","import { CenteredErrorMessage } from \"@powerhousedao/connect/components/shared\";\nimport { useIsColdStart } from \"@powerhousedao/connect-core/router\";\nimport { DefaultEditorLoader } from \"@powerhousedao/design-system/connect\";\nimport type { ErrorComponentProps } from \"@tanstack/react-router\";\n\n// Fades the cold-start loader in, so a load ending just past pendingMs doesn't flash.\nconst DRIVE_PENDING_FADE = \"ph-drive-pending-in 200ms ease-in 100ms both\";\n\n/** A loader on a cold start; otherwise the open view stays while loading. */\nexport function DrivePending() {\n const isColdStart = useIsColdStart();\n if (!isColdStart) return null;\n return (\n <div\n className=\"flex size-full items-center justify-center\"\n style={{ animation: DRIVE_PENDING_FADE }}\n >\n <style>\n {`@keyframes ph-drive-pending-in{from{opacity:0}to{opacity:1}}`}\n </style>\n <DefaultEditorLoader message=\"Loading drive\" />\n </div>\n );\n}\n\n/** A route's loader or render error, as Connect's error boundaries show it. */\nexport function RouteError({ error, reset }: ErrorComponentProps) {\n return <CenteredErrorMessage error={error} resetErrorBoundary={reset} />;\n}\n","import { DropZoneWrapper } from \"@powerhousedao/design-system/connect\";\nimport { GenericDriveExplorer } from \"@powerhousedao/powerhouse-vetra-packages/editors\";\nimport {\n DriveProvider,\n useAppModuleById,\n useDefaultAppModule,\n useDispatch,\n} from \"@powerhousedao/reactor-browser\";\nimport { useDriveRouteData } from \"@powerhousedao/connect-core/router\";\nimport type { ReactNode } from \"react\";\nimport { Suspense, useEffect, useMemo } from \"react\";\nimport { EditorLoader } from \"./editor-loader.js\";\nimport { ErrorBoundary } from \"@powerhousedao/connect/components/shared\";\n\n/** Packages load progressively, so a missing drive app is only a finding once\n * it stays missing; the warning fires once per drive. */\nconst MISSING_APP_GRACE_MS = 3000;\nconst warnedDrives = new Set<string>();\n\n/**\n * A drive that names a preferred editor no installed package provides falls\n * back to the generic explorer silently otherwise — which reads as \"the drive\n * ignores its editor\" when the cause is a package that is not composed in\n * (e.g. Workflow Studio without `@powerhousedao/connect/plugins/workflows`).\n */\nfunction useWarnOnMissingDriveApp(\n driveId: string | undefined,\n preferredEditor: string | undefined,\n found: boolean,\n): void {\n useEffect(() => {\n if (!driveId || !preferredEditor || found || warnedDrives.has(driveId)) {\n return;\n }\n const timer = setTimeout(() => {\n warnedDrives.add(driveId);\n console.warn(\n `[Connect] Drive \"${driveId}\" prefers the drive app \"${preferredEditor}\", but no installed package provides it; showing the generic drive explorer. ` +\n \"Install or compose in the package that registers that app (for Workflow Studio: the @powerhousedao/connect/plugins/workflows plugin).\",\n );\n }, MISSING_APP_GRACE_MS);\n return () => clearTimeout(timer);\n }, [driveId, preferredEditor, found]);\n}\n\n/** The route's drive's app around `children`, the open document's view;\n * drive apps show their own view while `children` is null. */\nexport function AppContainer({ children = null }: { children?: ReactNode }) {\n const { drive: selectedDrive, folder, documentId } = useDriveRouteData();\n\n const app = useAppModuleById(selectedDrive?.header.meta?.preferredEditor);\n const defaultApp = useDefaultAppModule();\n useWarnOnMissingDriveApp(\n selectedDrive?.header.id,\n selectedDrive?.header.meta?.preferredEditor,\n app !== undefined,\n );\n const [, dispatch] = useDispatch(selectedDrive);\n const nodeId = documentId ?? folder?.id;\n // The drive app's useSelected* read this; opening goes through the router.\n const context = useMemo(\n () => selectedDrive && { drive: selectedDrive, dispatch, folder, nodeId },\n [selectedDrive, dispatch, folder, nodeId],\n );\n\n if (!selectedDrive || !context) {\n return <EditorLoader />;\n }\n\n const AppComponent =\n app?.Component ?? defaultApp?.Component ?? GenericDriveExplorer.Component;\n return (\n <ErrorBoundary\n variant=\"detailed\"\n resetKeys={[selectedDrive.header.id]}\n loggerContext={[\"Connect\", \"App\"]}\n >\n <Suspense fallback={<EditorLoader />}>\n <DriveProvider value={context}>\n <DropZoneWrapper className=\"flex h-full flex-col overflow-auto\">\n <AppComponent document={selectedDrive} dispatch={dispatch}>\n {children}\n </AppComponent>\n </DropZoneWrapper>\n </DriveProvider>\n </Suspense>\n </ErrorBoundary>\n );\n}\n","import { AppContainer } from \"../editors/app-container.js\";\nimport { DocumentEditorContainer } from \"../editors/document-editor-container.js\";\nimport { DriveIcon } from \"@powerhousedao/connect/components/shared\";\nimport {\n DriveAuthGate,\n HomeScreen,\n HomeScreenAddDriveItem,\n HomeScreenItem,\n} from \"@powerhousedao/design-system/connect\";\nimport {\n logout,\n makeDriveSlug,\n preloadDrive,\n setSelectedDrive,\n useAppModuleById,\n useIsAddDriveEnabled,\n useLinkProps,\n getDriveName,\n} from \"@powerhousedao/reactor-browser\";\nimport type { DocumentDriveDocument } from \"@powerhousedao/shared/document-drive\";\nimport { Outlet } from \"@tanstack/react-router\";\nimport type { ReactNode } from \"react\";\nimport { useDriveRouteData } from \"@powerhousedao/connect-core/router\";\nimport { getRuntimeConfig } from \"@powerhousedao/connect-core/runtime-config\";\nimport { useDriveAuthGate, useVisibleDrives } from \"./use-drive-auth-gate.js\";\nimport { useOpenRenownLogin } from \"../hooks/use-renown-login.js\";\n\n/** Connect's home: the drives, and adding one. A custom home builds on its\n * parts: ConnectHomeScreen, HomeDriveItem, HomeAddDriveItem, useVisibleDrives. */\nexport function Home() {\n const drives = useVisibleDrives();\n return (\n <ConnectHomeScreen>\n {drives?.map((drive) => (\n <HomeDriveItem key={drive.header.id} drive={drive} />\n ))}\n <HomeAddDriveItem />\n </ConnectHomeScreen>\n );\n}\n\n/** The home's grid, on the configured `home.background`. */\nexport function ConnectHomeScreen({ children }: { children?: ReactNode }) {\n const homeBackground = getRuntimeConfig().connect.home?.background;\n return <HomeScreen homeBackground={homeBackground}>{children}</HomeScreen>;\n}\n\n/** The add-drive tile, or nothing where adding drives is turned off. */\nexport function HomeAddDriveItem() {\n return useIsAddDriveEnabled() ? <HomeScreenAddDriveItem /> : null;\n}\n\n/** Connect's drive layout: the drive app around the open document, or the\n * sign-in gate when the drive's remote refuses the user. */\nexport function DriveLayout() {\n const { gate, dismiss } = useDriveAuthGate();\n const openLogin = useOpenRenownLogin();\n const { documentId } = useDriveRouteData();\n if (gate) {\n return (\n <div className=\"flex h-full items-center justify-center p-4\">\n <DriveAuthGate\n mode={gate}\n onLogin={openLogin}\n onLogout={() => void logout()}\n onClose={dismiss}\n />\n </div>\n );\n }\n return <AppContainer>{documentId ? <Outlet /> : null}</AppContainer>;\n}\n\n/** Connect's node route: the open document's editor. */\nexport function NodeView() {\n const { documentId } = useDriveRouteData();\n return documentId ? (\n <DocumentEditorContainer documentId={documentId} />\n ) : null;\n}\n\n/** A drive's card: its name, its app and a link that opens it. */\nexport function HomeDriveItem({ drive }: { drive: DocumentDriveDocument }) {\n const editorModule = useAppModuleById(drive.header.meta?.preferredEditor);\n const description = editorModule?.config.name || \"Drive Explorer App\";\n const link = useLinkProps({ driveSlug: makeDriveSlug(drive) }, () =>\n setSelectedDrive(drive),\n );\n return (\n <HomeScreenItem\n title={getDriveName(drive)}\n description={description}\n icon={<DriveIcon drive={drive} />}\n href={link.href}\n aria-current={link[\"aria-current\"]}\n onClick={link.onClick}\n onPreload={() => preloadDrive(drive)}\n />\n );\n}\n","import { getRuntimeConfig } from \"@powerhousedao/connect-core/runtime-config\";\nimport { lazyRouteComponent } from \"@tanstack/react-router\";\nimport type * as SettingsModule from \"./index.js\";\n\n/** Whether the AI assistant is configured. Not connect.config, which a project\n * route importing the tabs would evaluate before the config loads. */\nexport const aiAssistantEnabled = () =>\n getRuntimeConfig().connect.ai?.assistantEnabled ?? false;\n\n// Loaded with the settings page, not with the app; the router preloads it on intent.\nconst settings = () => import(\"./index.js\");\n\n/** Connect's settings page around the shown tab. */\nexport const SettingsPage = lazyRouteComponent(settings, \"SettingsPage\");\n\n/** One of Connect's settings tabs. */\nexport function settingsTab(\n name: Exclude<keyof typeof SettingsModule, \"SettingsPage\">,\n) {\n return lazyRouteComponent(settings, name);\n}\n","import type {\n ConnectRoutes,\n ConnectSettingsTab,\n} from \"@powerhousedao/connect-core/router\";\nimport type { AnyRoute } from \"@tanstack/react-router\";\nimport { createRoute } from \"@tanstack/react-router\";\nimport { Bot, CircleHelp, Package, PenLine, TriangleAlert } from \"lucide-react\";\nimport { aiAssistantEnabled, settingsTab } from \"./settings/tabs.js\";\n\nconst tab = (settings: ConnectSettingsTab) => ({ staticData: { settings } });\n\n/** The generic plugin's settings tabs by path: each tab's route options, which a\n * project file at that path spreads to replace the tab's view. */\nexport const genericSettingsTabs = {\n \"ai-assistant\": tab({\n label: \"AI Assistant\",\n order: 0,\n icon: Bot,\n enabled: aiAssistantEnabled,\n }),\n \"package-manager\": tab({\n label: \"Package Manager\",\n order: 10,\n icon: Package,\n }),\n \"default-editors\": tab({\n label: \"Default Editors\",\n order: 20,\n icon: PenLine,\n }),\n \"danger-zone\": tab({\n label: \"Danger Zone\",\n order: 80,\n icon: TriangleAlert,\n destructive: true,\n }),\n about: tab({ label: \"About\", order: 90, icon: CircleHelp }),\n};\n\ntype GenericSettingsTab = keyof typeof genericSettingsTabs;\n\nconst VIEWS: Record<GenericSettingsTab, Parameters<typeof settingsTab>[0]> = {\n \"ai-assistant\": \"AiAssistant\",\n \"package-manager\": \"ConnectPackageManager\",\n \"default-editors\": \"DefaultEditor\",\n \"danger-zone\": \"DangerZone\",\n about: \"About\",\n};\n\n/** The generic settings tabs, under the settings route. */\nexport function settingsTabRoutes({ settingsRoute }: ConnectRoutes) {\n return Object.entries(genericSettingsTabs).map(([path, options]) =>\n createRoute({\n getParentRoute: () => settingsRoute,\n path,\n ...options,\n component: settingsTab(VIEWS[path as GenericSettingsTab]),\n }),\n ) as AnyRoute[];\n}\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