@powerhousedao/connect 6.2.3-dev.7 → 6.2.3-dev.70

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 (235) hide show
  1. package/CUSTOMIZING.md +80 -0
  2. package/README.md +28 -0
  3. package/RUNTIME-CONFIG.md +472 -0
  4. package/dist/{AddDriveModal-xAw48kdl.js → AddDriveModal-BjgmiHJr.js} +10 -10
  5. package/dist/AddDriveModal-BjgmiHJr.js.map +1 -0
  6. package/dist/{ClearStorageModal-Czo-h6OE.js → ClearStorageModal-BwGVIuLX.js} +11 -13
  7. package/dist/ClearStorageModal-BwGVIuLX.js.map +1 -0
  8. package/dist/{ConfirmDocumentUpgradeModal-FUOhZsk7.js → ConfirmDocumentUpgradeModal-CoixS60F.js} +9 -8
  9. package/dist/ConfirmDocumentUpgradeModal-CoixS60F.js.map +1 -0
  10. package/dist/{CookiesPolicyModal-BpyPPyxS.js → CookiesPolicyModal-BpFjYc7T.js} +5 -5
  11. package/dist/{CookiesPolicyModal-BpyPPyxS.js.map → CookiesPolicyModal-BpFjYc7T.js.map} +1 -1
  12. package/dist/{CreateDocumentModal-C45W8J0V.js → CreateDocumentModal-B-cXzeOA.js} +11 -10
  13. package/dist/CreateDocumentModal-B-cXzeOA.js.map +1 -0
  14. package/dist/{DebugSettingsModal-BUkre5Ke.js → DebugSettingsModal-DfOnR4iY.js} +9 -9
  15. package/dist/DebugSettingsModal-DfOnR4iY.js.map +1 -0
  16. package/dist/{DeleteDriveModal-Dug84t1j.js → DeleteDriveModal-1pAIayG_.js} +7 -7
  17. package/dist/DeleteDriveModal-1pAIayG_.js.map +1 -0
  18. package/dist/{DeleteItemModal-mMzy3V8o.js → DeleteItemModal-BUpqmFxS.js} +8 -8
  19. package/dist/DeleteItemModal-BUpqmFxS.js.map +1 -0
  20. package/dist/{DisclaimerModal-DvpD5dPM.js → DisclaimerModal-TIJXRYLF.js} +7 -7
  21. package/dist/DisclaimerModal-TIJXRYLF.js.map +1 -0
  22. package/dist/{DocumentVersionUnsupportedModal-C3Q0V75l.js → DocumentVersionUnsupportedModal-DH9Zzsyw.js} +6 -6
  23. package/dist/DocumentVersionUnsupportedModal-DH9Zzsyw.js.map +1 -0
  24. package/dist/{DownloadDocumentWithErrorsModal-IKl0ljQb.js → DownloadDocumentWithErrorsModal-Beh-xw8B.js} +8 -7
  25. package/dist/DownloadDocumentWithErrorsModal-Beh-xw8B.js.map +1 -0
  26. package/dist/{DriveAuthRequiredModal-DVK7ZQzO.js → DriveAuthRequiredModal-XTcoJKvj.js} +7 -7
  27. package/dist/DriveAuthRequiredModal-XTcoJKvj.js.map +1 -0
  28. package/dist/{DriveSettingsModal-C6-mRQiv.js → DriveSettingsModal-DZKawN7w.js} +6 -6
  29. package/dist/DriveSettingsModal-DZKawN7w.js.map +1 -0
  30. package/dist/FloatingTanStackRouterDevtools-CqogiFob-dxj8lrTP.js +2565 -0
  31. package/dist/FloatingTanStackRouterDevtools-CqogiFob-dxj8lrTP.js.map +1 -0
  32. package/dist/{InspectorModal-C-dm0iSW.js → InspectorModal-BVqRNFfP.js} +70 -30
  33. package/dist/InspectorModal-BVqRNFfP.js.map +1 -0
  34. package/dist/{LoginModal-CybbOm3N.js → LoginModal-O06ZvWFI.js} +8 -8
  35. package/dist/LoginModal-O06ZvWFI.js.map +1 -0
  36. package/dist/{OpenFileDocumentsModal-DEcFBZ5I.js → OpenFileDocumentsModal-BNHD0vg9.js} +16 -14
  37. package/dist/OpenFileDocumentsModal-BNHD0vg9.js.map +1 -0
  38. package/dist/{UpgradeDriveModal-_8t9slxQ.js → UpgradeDriveModal-CCWKp5yn.js} +7 -7
  39. package/dist/UpgradeDriveModal-CCWKp5yn.js.map +1 -0
  40. package/dist/app-loader-BjAXSJQ6.js +4 -0
  41. package/dist/app-loader-DtH6v5CE.js +1244 -0
  42. package/dist/app-loader-DtH6v5CE.js.map +1 -0
  43. package/dist/app-skeleton-BFjvlTWd.js +112 -0
  44. package/dist/app-skeleton-BFjvlTWd.js.map +1 -0
  45. package/dist/app-skeleton-DFg65Rxa.js +4 -0
  46. package/dist/boot-N7f3RrY_.js +233 -0
  47. package/dist/boot-N7f3RrY_.js.map +1 -0
  48. package/dist/buffer-DNTcuap_.js +66 -0
  49. package/dist/buffer-DNTcuap_.js.map +1 -0
  50. package/dist/{build-info-N6D-34wu.js → build-info-TgBEqTq1.js} +10 -6
  51. package/dist/build-info-TgBEqTq1.js.map +1 -0
  52. package/dist/components-B_wpF5Is.js +121 -0
  53. package/dist/components-B_wpF5Is.js.map +1 -0
  54. package/dist/{connect.config-DaHDEUrw.js → connect.config-D1pGNmaF.js} +25 -13
  55. package/dist/connect.config-D1pGNmaF.js.map +1 -0
  56. package/dist/{connection-state-3w4liC1X.js → connection-state-B6fleM37.js} +20 -9
  57. package/dist/connection-state-B6fleM37.js.map +1 -0
  58. package/dist/context-De2EB1AA-Ni0d829Q.js +1759 -0
  59. package/dist/context-De2EB1AA-Ni0d829Q.js.map +1 -0
  60. package/dist/{cookie-banner-BH6bIq24.js → cookie-banner-CAvd3PC3.js} +7 -7
  61. package/dist/{cookie-banner-BH6bIq24.js.map → cookie-banner-CAvd3PC3.js.map} +1 -1
  62. package/dist/document-editor-container-CGLXOl0t.js +4 -0
  63. package/dist/document-editor-container-FNIEsf8H.js +310 -0
  64. package/dist/document-editor-container-FNIEsf8H.js.map +1 -0
  65. package/dist/drive-icon-BiVP8yJc.js +38 -0
  66. package/dist/drive-icon-BiVP8yJc.js.map +1 -0
  67. package/dist/error-boundary-BsUBww61.js +155 -0
  68. package/dist/error-boundary-BsUBww61.js.map +1 -0
  69. package/dist/esm-BDACZntJ.js +148 -0
  70. package/dist/esm-BDACZntJ.js.map +1 -0
  71. package/dist/generic.d.ts +116 -0
  72. package/dist/generic.d.ts.map +1 -0
  73. package/dist/generic.js +31 -0
  74. package/dist/generic.js.map +1 -0
  75. package/dist/{i18n-CWO0vYVd.js → i18n-D9WYPgk9.js} +4 -4
  76. package/dist/{i18n-CWO0vYVd.js.map → i18n-D9WYPgk9.js.map} +1 -1
  77. package/dist/index-NyJPEHvw.d.ts +4 -0
  78. package/dist/layout-wfvkfP4J.js +5 -0
  79. package/dist/layout.d.ts +3 -0
  80. package/dist/layout.js +4 -0
  81. package/dist/{load-BxUCaDLH.js → load-CkbGF6wB.js} +48 -46
  82. package/dist/load-CkbGF6wB.js.map +1 -0
  83. package/dist/load-runtime-config-DXswYA71.js +14 -0
  84. package/dist/load-runtime-config-DXswYA71.js.map +1 -0
  85. package/dist/main.d.ts +2 -1
  86. package/dist/main.js +8 -8
  87. package/dist/main.js.map +1 -1
  88. package/dist/open-file-uploads-B5pr1sA2.js +183 -0
  89. package/dist/open-file-uploads-B5pr1sA2.js.map +1 -0
  90. package/dist/package-manager-CPqbVSd8.js +524 -0
  91. package/dist/package-manager-CPqbVSd8.js.map +1 -0
  92. package/dist/{pglite-major-B39aOEiE.js → pglite-major-p4_YefAE.js} +23 -5
  93. package/dist/pglite-major-p4_YefAE.js.map +1 -0
  94. package/dist/{pglite-migrate-core-Boxqqx-c.js → pglite-migrate-core-DBlU6HIc.js} +9 -7
  95. package/dist/pglite-migrate-core-DBlU6HIc.js.map +1 -0
  96. package/dist/{pglite-seed-BqAUvNFw.js → pglite-seed-eGzXMld2.js} +4 -4
  97. package/dist/{pglite-seed-BqAUvNFw.js.map → pglite-seed-eGzXMld2.js.map} +1 -1
  98. package/dist/pglite.worker.d.ts +2 -1
  99. package/dist/pglite.worker.js +4 -3
  100. package/dist/pglite.worker.js.map +1 -1
  101. package/dist/pglite.worker.legacy.d.ts +2 -1
  102. package/dist/pglite.worker.legacy.js +4 -3
  103. package/dist/pglite.worker.legacy.js.map +1 -1
  104. package/dist/plugins-CWbr0n_Q.js +246 -0
  105. package/dist/plugins-CWbr0n_Q.js.map +1 -0
  106. package/dist/{preferences-store-_5Cw4_YV.js → preferences-store-CSqauT9V.js} +6 -25
  107. package/dist/preferences-store-CSqauT9V.js.map +1 -0
  108. package/dist/prerender.d.ts +38 -0
  109. package/dist/prerender.d.ts.map +1 -0
  110. package/dist/prerender.js +177 -0
  111. package/dist/prerender.js.map +1 -0
  112. package/dist/prerendered-shell-peKE7AqI.js +51 -0
  113. package/dist/prerendered-shell-peKE7AqI.js.map +1 -0
  114. package/dist/{pwa-manifest-link-DIgOSo2Q.js → pwa-manifest-link-DQRJpF0r.js} +3 -3
  115. package/dist/{pwa-manifest-link-DIgOSo2Q.js.map → pwa-manifest-link-DQRJpF0r.js.map} +1 -1
  116. package/dist/{reactor-Bg0Y9sdl.js → reactor-DLCl-WHi.js} +509 -562
  117. package/dist/reactor-DLCl-WHi.js.map +1 -0
  118. package/dist/reactor-chat-LAB-9G3G.js +50 -0
  119. package/dist/reactor-chat-LAB-9G3G.js.map +1 -0
  120. package/dist/reactor.worker.d.ts +2 -1
  121. package/dist/reactor.worker.js +478 -156
  122. package/dist/reactor.worker.js.map +1 -1
  123. package/dist/{registerServiceWorker-BSzbNfvz.js → registerServiceWorker-APlHkrmH.js} +5 -5
  124. package/dist/{registerServiceWorker-BSzbNfvz.js.map → registerServiceWorker-APlHkrmH.js.map} +1 -1
  125. package/dist/root-B1Pq9x6S.js +24 -0
  126. package/dist/root-B1Pq9x6S.js.map +1 -0
  127. package/dist/route-tree.d.ts +2220 -0
  128. package/dist/route-tree.d.ts.map +1 -0
  129. package/dist/route-tree.js +135 -0
  130. package/dist/route-tree.js.map +1 -0
  131. package/dist/route-views-BF0p-4Fi.js +60 -0
  132. package/dist/route-views-BF0p-4Fi.js.map +1 -0
  133. package/dist/route-views-CTARvT5N.js +55 -0
  134. package/dist/route-views-CTARvT5N.js.map +1 -0
  135. package/dist/route-views-D8I-1PWU.js +4 -0
  136. package/dist/route-views.d.ts +7 -0
  137. package/dist/route-views.d.ts.map +1 -0
  138. package/dist/route-views.js +4 -0
  139. package/dist/router-BguOMBUh.js +4 -0
  140. package/dist/router-L9X9U-97.js +46 -0
  141. package/dist/router-L9X9U-97.js.map +1 -0
  142. package/dist/router.d.ts +2 -0
  143. package/dist/router.js +3 -0
  144. package/dist/sentry-Cuc_Nbba.js +22 -0
  145. package/dist/sentry-Cuc_Nbba.js.map +1 -0
  146. package/dist/settings-B-apZN_f.js +1084 -0
  147. package/dist/settings-B-apZN_f.js.map +1 -0
  148. package/dist/settings-tabs-CRgiuZcb.js +385 -0
  149. package/dist/settings-tabs-CRgiuZcb.js.map +1 -0
  150. package/dist/shell-core-head.html +2 -0
  151. package/dist/shell-core.html +1 -0
  152. package/dist/shell-head.html +2 -0
  153. package/dist/shell-plugins.json +1 -0
  154. package/dist/shell.html +1 -0
  155. package/dist/start-connect.d.ts +7 -9
  156. package/dist/start-connect.d.ts.map +1 -1
  157. package/dist/start-connect.js +9 -8
  158. package/dist/start-connect.js.map +1 -1
  159. package/dist/store-lock-Bi3B9VJD.js +159 -0
  160. package/dist/store-lock-Bi3B9VJD.js.map +1 -0
  161. package/dist/style.css +3131 -774
  162. package/dist/{toast-BXIGd4Eb.js → toast-C6WW-_O-.js} +3 -3
  163. package/dist/{toast-BXIGd4Eb.js.map → toast-C6WW-_O-.js.map} +1 -1
  164. package/dist/ui-CwbE23ra.js +66 -0
  165. package/dist/ui-CwbE23ra.js.map +1 -0
  166. package/dist/{use-renown-login-Cf3va6u_.js → use-renown-login-dPpDOYq5.js} +4 -4
  167. package/dist/use-renown-login-dPpDOYq5.js.map +1 -0
  168. package/docs/customizing/data-and-navigation.md +232 -0
  169. package/docs/customizing/hosts-and-plugins.md +65 -0
  170. package/docs/customizing/layout.md +149 -0
  171. package/docs/customizing/modals.md +78 -0
  172. package/docs/customizing/overrides.md +113 -0
  173. package/docs/customizing/packages.md +39 -0
  174. package/docs/customizing/pages.md +136 -0
  175. package/docs/customizing/styles-and-branding.md +69 -0
  176. package/docs/customizing/types-and-troubleshooting.md +63 -0
  177. package/fonts.css +177 -0
  178. package/package.json +81 -25
  179. package/scripts/prerender-shell.ts +51 -0
  180. package/skills/customize-connect/SKILL.md +74 -0
  181. package/src/route-tree.ts +3 -0
  182. package/src/routeTree.gen.ts +235 -0
  183. package/src/router/index.ts +2 -0
  184. package/src/router/register.ts +9 -0
  185. package/src/routes/__root.tsx +12 -0
  186. package/src/routes/_app/$.tsx +13 -0
  187. package/src/routes/_app/d/$driveSlug/{-$nodeSlug}.tsx +13 -0
  188. package/src/routes/_app/d/$driveSlug.tsx +13 -0
  189. package/src/routes/_app/index.tsx +13 -0
  190. package/src/routes/_app/settings/appearance.tsx +13 -0
  191. package/src/routes/_app/settings/packages.tsx +13 -0
  192. package/src/routes/_app/settings.tsx +13 -0
  193. package/src/routes/_app.tsx +13 -0
  194. package/style.css +8 -23
  195. package/tailwind.css +12 -0
  196. package/theme.css +5 -0
  197. package/dist/AddDriveModal-xAw48kdl.js.map +0 -1
  198. package/dist/ClearStorageModal-Czo-h6OE.js.map +0 -1
  199. package/dist/ConfirmDocumentUpgradeModal-FUOhZsk7.js.map +0 -1
  200. package/dist/CreateDocumentModal-C45W8J0V.js.map +0 -1
  201. package/dist/DebugSettingsModal-BUkre5Ke.js.map +0 -1
  202. package/dist/DeleteDriveModal-Dug84t1j.js.map +0 -1
  203. package/dist/DeleteItemModal-mMzy3V8o.js.map +0 -1
  204. package/dist/DisclaimerModal-DvpD5dPM.js.map +0 -1
  205. package/dist/DocumentVersionUnsupportedModal-C3Q0V75l.js.map +0 -1
  206. package/dist/DownloadDocumentWithErrorsModal-IKl0ljQb.js.map +0 -1
  207. package/dist/DriveAuthRequiredModal-DVK7ZQzO.js.map +0 -1
  208. package/dist/DriveSettingsModal-C6-mRQiv.js.map +0 -1
  209. package/dist/InspectorModal-C-dm0iSW.js.map +0 -1
  210. package/dist/LoginModal-CybbOm3N.js.map +0 -1
  211. package/dist/MissingPackageModal-nBnExqO0.js +0 -49
  212. package/dist/MissingPackageModal-nBnExqO0.js.map +0 -1
  213. package/dist/OpenFileDocumentsModal-DEcFBZ5I.js.map +0 -1
  214. package/dist/SettingsModal-CRBkw7d0.js +0 -569
  215. package/dist/SettingsModal-CRBkw7d0.js.map +0 -1
  216. package/dist/UpgradeDriveModal-_8t9slxQ.js.map +0 -1
  217. package/dist/app-loader-DkQhle_a.js +0 -4
  218. package/dist/app-loader-lsCT8EWA.js +0 -2244
  219. package/dist/app-loader-lsCT8EWA.js.map +0 -1
  220. package/dist/build-info-N6D-34wu.js.map +0 -1
  221. package/dist/components-DHzkxxly.js +0 -4
  222. package/dist/connect.config-DaHDEUrw.js.map +0 -1
  223. package/dist/connection-state-3w4liC1X.js.map +0 -1
  224. package/dist/load-BxUCaDLH.js.map +0 -1
  225. package/dist/pglite-major-B39aOEiE.js.map +0 -1
  226. package/dist/pglite-migrate-core-Boxqqx-c.js.map +0 -1
  227. package/dist/preferences-store-_5Cw4_YV.js.map +0 -1
  228. package/dist/reactor-Bg0Y9sdl.js.map +0 -1
  229. package/dist/runtime-config-DL3QjcfM.js +0 -24
  230. package/dist/runtime-config-DL3QjcfM.js.map +0 -1
  231. package/dist/sentry-QXKgQmr2.js +0 -15
  232. package/dist/sentry-QXKgQmr2.js.map +0 -1
  233. package/dist/use-renown-login-Cf3va6u_.js.map +0 -1
  234. package/dist/useRegistryPackages-BnUcL_nZ.js +0 -390
  235. package/dist/useRegistryPackages-BnUcL_nZ.js.map +0 -1
@@ -0,0 +1,1244 @@
1
+
2
+ !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]="74dc8a6a-3a52-58ef-b09e-daec104e79d7")}catch(e){}}();
3
+ import { n as LoadingShell } from "./prerendered-shell-peKE7AqI.js";
4
+ import { n as drainOpenPanelBuffer, t as clearOpenPanelBuffer } from "./buffer-DNTcuap_.js";
5
+ import { n as DetailedFallback, r as ErrorBoundary } from "./error-boundary-BsUBww61.js";
6
+ import { n as setMigrationStatus, t as AppSkeleton } from "./app-skeleton-BFjvlTWd.js";
7
+ import { r as connectConfig } from "./connect.config-D1pGNmaF.js";
8
+ import { n as setSentryModule } from "./sentry-Cuc_Nbba.js";
9
+ import { n as useAcceptedCookies } from "./preferences-store-CSqauT9V.js";
10
+ import { t as ToastContainer } from "./toast-C6WW-_O-.js";
11
+ import { c as idbError, d as isStoredDocumentsRefused } from "./pglite-major-p4_YefAE.js";
12
+ import { n as cloneFileData, r as migrateIdb } from "./pglite-migrate-core-DBlU6HIc.js";
13
+ import "./i18n-D9WYPgk9.js";
14
+ import { t as Router } from "./router-L9X9U-97.js";
15
+ import { a as subscribeOpenFileUploads, c as initLaunchQueueFileHandling, n as getOpenFileUploads, r as removeOpenFileUpload, t as clearOpenFileUploads } from "./open-file-uploads-B5pr1sA2.js";
16
+ import { c as getCachedMigrationMajor, d as subscribeMigrationMajor, i as subscribeWorkerConnection, n as getWorkerConnectionStatus, p as PRIMARY_IDB_NAMES } from "./connection-state-B6fleM37.js";
17
+ import { n as serviceWorkerManager, r as subscribeServiceWorkerUpdate, t as getServiceWorkerUpdateAvailable } from "./registerServiceWorker-APlHkrmH.js";
18
+ import { StrictMode, Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
19
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
20
+ import { getRuntimeConfig } from "@powerhousedao/connect-core/runtime-config";
21
+ import { PackageInstallModal, UploadFileListContainer } from "@powerhousedao/design-system/connect";
22
+ import { PHStoreProvider, RenownWalletProvider, setSelectedNode, showPHModal, useEditorPreloader, usePackageDiscoveryService, useReactorClientModule, useTheme, useUser } from "@powerhousedao/reactor-browser";
23
+ import { Icon, Modal, PowerhouseButton } from "@powerhousedao/design-system";
24
+ import { childLogger } from "document-model";
25
+ import { z } from "zod";
26
+ import { getConnectPluginUi } from "@powerhousedao/connect-core/plugins";
27
+ import { getConnectPHStore } from "@powerhousedao/connect-core/runtime";
28
+ import { twMerge } from "tailwind-merge";
29
+ import { mockAdapter } from "@renown/sdk/wallet/mock";
30
+ import { privyAdapter } from "@renown/sdk/wallet/privy";
31
+ import { rainbowAdapter } from "@renown/sdk/wallet/rainbow";
32
+ import { arbitrum, base, mainnet, optimism, polygon, sepolia } from "wagmi/chains";
33
+ //#region src/hooks/useFailedInstallations.ts
34
+ const emptyArray$1 = [];
35
+ function useFailedInstallations() {
36
+ const discoveryService = usePackageDiscoveryService();
37
+ return useSyncExternalStore((cb) => discoveryService?.subscribeFailed(cb) ?? (() => {}), () => discoveryService?.getFailedInstallations() ?? emptyArray$1);
38
+ }
39
+ //#endregion
40
+ //#region src/hooks/useInitSentry.ts
41
+ const logger$1 = childLogger(["sentry"]);
42
+ let clientStarted = false;
43
+ async function getSentry() {
44
+ return await import("@sentry/react");
45
+ }
46
+ async function initSentry() {
47
+ const Sentry = await getSentry();
48
+ const integrations = [
49
+ Sentry.httpClientIntegration(),
50
+ Sentry.extraErrorDataIntegration({ depth: 5 }),
51
+ Sentry.replayIntegration(),
52
+ Sentry.captureConsoleIntegration({ levels: ["error"] })
53
+ ];
54
+ if (connectConfig.sentry.tracing) {
55
+ const { getConnectRouter } = await import("./router-BguOMBUh.js");
56
+ integrations.push(Sentry.tanstackRouterBrowserTracingIntegration(getConnectRouter()));
57
+ }
58
+ Sentry.init({
59
+ release: connectConfig.sentry.release,
60
+ dsn: connectConfig.sentry.dsn ?? void 0,
61
+ environment: connectConfig.sentry.env,
62
+ integrations,
63
+ ignoreErrors: [
64
+ "User is not allowed to create files",
65
+ "User is not allowed to move documents",
66
+ "The user aborted a request."
67
+ ],
68
+ sendDefaultPii: true,
69
+ tracesSampleRate: 1,
70
+ replaysSessionSampleRate: .1,
71
+ replaysOnErrorSampleRate: 1,
72
+ beforeSend(event, hint) {
73
+ const error = hint.originalException;
74
+ if (error instanceof TypeError && error.message.includes("Failed to fetch") && !navigator.onLine) return null;
75
+ return event;
76
+ }
77
+ });
78
+ setSentryModule(Sentry);
79
+ clientStarted = true;
80
+ }
81
+ async function closeClient() {
82
+ if (!clientStarted) return;
83
+ const sentry = await getSentry();
84
+ setSentryModule(void 0);
85
+ return sentry.getClient()?.close();
86
+ }
87
+ function useInitSentry() {
88
+ const [acceptedCookies] = useAcceptedCookies();
89
+ const { analytics } = acceptedCookies;
90
+ useEffect(() => {
91
+ if (!analytics) {
92
+ closeClient().catch((error) => logger$1.error("@error", error));
93
+ return;
94
+ }
95
+ if (clientStarted || connectConfig.sentry.dsn === null || connectConfig.sentry.dsn === void 0 || connectConfig.sentry.dsn === "") return;
96
+ initSentry().catch((error) => logger$1.error("@error", error));
97
+ }, [analytics]);
98
+ }
99
+ //#endregion
100
+ //#region src/hooks/usePendingInstallations.ts
101
+ const emptyArray = [];
102
+ function usePendingInstallations() {
103
+ const discoveryService = usePackageDiscoveryService();
104
+ const cacheRef = useRef(emptyArray);
105
+ const getSnapshot = useCallback(() => {
106
+ if (!discoveryService) return emptyArray;
107
+ const next = discoveryService.getPendingInstallations() ?? emptyArray;
108
+ const prev = cacheRef.current;
109
+ if (next === prev || next.length === prev.length && next.every((p, i) => p === prev[i])) return prev;
110
+ cacheRef.current = next;
111
+ return next;
112
+ }, [discoveryService]);
113
+ return useSyncExternalStore((cb) => discoveryService?.subscribePending(cb) ?? (() => {}), getSnapshot);
114
+ }
115
+ //#endregion
116
+ //#region src/services/openpanel/client.ts
117
+ let client;
118
+ /**
119
+ * Returns the cached `OpenPanel` singleton, building it on first call.
120
+ *
121
+ * When `config.clientId` is empty it returns `undefined` without importing
122
+ * `@openpanel/web`, so the bundler can tree-shake the SDK out of production.
123
+ */
124
+ async function getOpenPanelClient(config) {
125
+ if (!config.clientId) return;
126
+ if (client) return client;
127
+ const { OpenPanel: OpenPanelClass } = await import("@openpanel/web");
128
+ client = new OpenPanelClass({
129
+ clientId: config.clientId,
130
+ ...config.apiUrl ? { apiUrl: config.apiUrl } : {},
131
+ trackScreenViews: true,
132
+ trackOutgoingLinks: true
133
+ });
134
+ client.setGlobalProperties({ app: "connect" });
135
+ drainOpenPanelBuffer(client);
136
+ return client;
137
+ }
138
+ /**
139
+ * Clears the cached singleton and the pre-init buffer. Call on consent
140
+ * revocation or during tests; buffered events are discarded, not replayed.
141
+ */
142
+ function resetOpenPanelClient() {
143
+ client = void 0;
144
+ clearOpenPanelBuffer();
145
+ }
146
+ //#endregion
147
+ //#region src/services/openpanel/events.json
148
+ var events_default = [
149
+ {
150
+ "documentType": "powerhouse/document-drive",
151
+ "actionTypes": [
152
+ "ADD_FOLDER",
153
+ "DELETE_NODE",
154
+ "ADD_FILE",
155
+ "UPDATE_FILE",
156
+ "COPY_NODE",
157
+ "MOVE_NODE",
158
+ "SET_DRIVE_NAME",
159
+ "SET_DRIVE_ICON"
160
+ ]
161
+ },
162
+ {
163
+ "documentType": "powerhouse/document-model",
164
+ "actionTypes": [
165
+ "SET_MODEL_NAME",
166
+ "SET_MODEL_ID",
167
+ "ADD_MODULE",
168
+ "DELETE_MODULE",
169
+ "ADD_OPERATION",
170
+ "DELETE_OPERATION"
171
+ ]
172
+ },
173
+ {
174
+ "documentType": "powerhouse/reactor-drive",
175
+ "actionTypes": [
176
+ "ADD_FOLDER",
177
+ "REMOVE_FOLDER",
178
+ "UPDATE_FOLDER"
179
+ ]
180
+ }
181
+ ];
182
+ //#endregion
183
+ //#region src/services/openpanel/events.ts
184
+ const EventMappingSchema = z.object({
185
+ documentType: z.string().min(1),
186
+ actionTypes: z.array(z.string().min(1)).min(1),
187
+ alias: z.string().optional()
188
+ }).strict();
189
+ const EventMappingsSchema = z.array(EventMappingSchema).readonly();
190
+ /**
191
+ * Parses and validates the event mapping table, returning the validated array
192
+ * and an O(1) lookup map. Accepts a `raw` override for tests. Throws on zod
193
+ * failures and on duplicate `(documentType, actionType)` pairs.
194
+ */
195
+ function loadEvents(raw = events_default) {
196
+ const result = EventMappingsSchema.safeParse(raw);
197
+ if (!result.success) throw new Error(`Invalid OpenPanel events.json: ${result.error.message}`);
198
+ const mappings = result.data;
199
+ const lookupMap = /* @__PURE__ */ new Map();
200
+ for (const mapping of mappings) {
201
+ let inner = lookupMap.get(mapping.documentType);
202
+ if (!inner) {
203
+ inner = /* @__PURE__ */ new Map();
204
+ lookupMap.set(mapping.documentType, inner);
205
+ }
206
+ for (const actionType of mapping.actionTypes) {
207
+ if (inner.has(actionType)) throw new Error(`Duplicate OpenPanel event mapping for ${mapping.documentType}/${actionType}`);
208
+ inner.set(actionType, mapping);
209
+ }
210
+ }
211
+ return {
212
+ mappings,
213
+ lookupMap
214
+ };
215
+ }
216
+ const { mappings: defaultMappings, lookupMap: defaultLookupMap } = loadEvents();
217
+ /** Validated mapping array from the bundled events.json. */
218
+ const eventMappings = defaultMappings;
219
+ /** O(1) lookup map: documentType → actionType → mapping. */
220
+ const eventLookupMap = defaultLookupMap;
221
+ /**
222
+ * Normalizes a document type into a safe event-name segment: lowercased, `/`
223
+ * replaced with `.`, and any character outside `[a-z0-9._-]` stripped.
224
+ * e.g. `powerhouse/document-drive` → `powerhouse.document-drive`.
225
+ */
226
+ function normalize(documentType) {
227
+ return documentType.toLowerCase().replace(/\//g, ".").replace(/[^a-z0-9._-]/g, "");
228
+ }
229
+ /**
230
+ * Derives the OpenPanel event name: `mapping.alias` when present, otherwise
231
+ * `${normalize(documentType)}.${actionType.toLowerCase()}`.
232
+ */
233
+ function deriveEventName(mapping, op) {
234
+ if (mapping.alias) return mapping.alias;
235
+ return `${normalize(op.context.documentType)}.${op.operation.action.type.toLowerCase()}`;
236
+ }
237
+ /**
238
+ * Builds the default properties attached to every OpenPanel event. The `app`
239
+ * property is stamped globally by the client, not here.
240
+ */
241
+ function buildDefaultProperties(op) {
242
+ return {
243
+ documentType: op.context.documentType,
244
+ actionType: op.operation.action.type,
245
+ documentId: op.context.documentId,
246
+ scope: op.context.scope,
247
+ branch: op.context.branch
248
+ };
249
+ }
250
+ //#endregion
251
+ //#region src/services/openpanel/processor.ts
252
+ /**
253
+ * Read-only reactor `IProcessor` that translates matching document operations
254
+ * into OpenPanel analytics events. Operations whose `(documentType, actionType)`
255
+ * pair is absent from the lookup map are skipped; per-operation errors are
256
+ * routed to `onError` and never thrown back to the manager.
257
+ */
258
+ var OpenPanelProcessor = class {
259
+ client;
260
+ lookupMap;
261
+ onError;
262
+ constructor(client, lookupMap, onError = (err) => console.warn("[OpenPanelProcessor] Error tracking event:", err)) {
263
+ this.client = client;
264
+ this.lookupMap = lookupMap;
265
+ this.onError = onError;
266
+ }
267
+ async onOperations(operations) {
268
+ for (const op of operations) {
269
+ const inner = this.lookupMap.get(op.context.documentType);
270
+ if (!inner) continue;
271
+ const mapping = inner.get(op.operation.action.type);
272
+ if (!mapping) continue;
273
+ const name = deriveEventName(mapping, op);
274
+ const payload = buildDefaultProperties(op);
275
+ try {
276
+ await this.client.track(name, payload);
277
+ } catch (err) {
278
+ this.onError(err, op);
279
+ }
280
+ }
281
+ }
282
+ onDisconnect() {
283
+ this.client.flush?.();
284
+ return Promise.resolve();
285
+ }
286
+ };
287
+ //#endregion
288
+ //#region src/services/openpanel/factory.ts
289
+ /**
290
+ * Returns a `ProcessorFactory` that, for each drive, creates a single
291
+ * `OpenPanelProcessor` record whose `filter.documentType` is the union of all
292
+ * document types present in the event mapping table.
293
+ */
294
+ function createOpenPanelProcessorFactory(config) {
295
+ return function openPanelProcessorFactory(_driveHeader) {
296
+ const documentType = Array.from(config.events.lookupMap.keys());
297
+ return [{
298
+ processor: new OpenPanelProcessor(config.client, config.events.lookupMap, config.onError),
299
+ filter: { documentType },
300
+ startFrom: config.startFrom ?? "current"
301
+ }];
302
+ };
303
+ }
304
+ //#endregion
305
+ //#region src/components/analytics.tsx
306
+ function gtag(...args) {
307
+ window.dataLayer?.push(...args);
308
+ }
309
+ const Analytics = () => {
310
+ const gaTrackingId = connectConfig.gaTrackingId;
311
+ const [{ analytics }] = useAcceptedCookies();
312
+ const useAnalytics = gaTrackingId && analytics;
313
+ useEffect(() => {
314
+ if (useAnalytics) {
315
+ const script = document.createElement("script");
316
+ script.src = `https://www.googletagmanager.com/gtag/js?id=${gaTrackingId}`;
317
+ script.async = true;
318
+ document.head.appendChild(script);
319
+ window.dataLayer = window.dataLayer || [];
320
+ gtag("js", /* @__PURE__ */ new Date());
321
+ gtag("config", gaTrackingId);
322
+ return () => {
323
+ document.head.removeChild(script);
324
+ };
325
+ }
326
+ }, [useAnalytics, gaTrackingId]);
327
+ return null;
328
+ };
329
+ //#endregion
330
+ //#region src/components/openpanel-traits.ts
331
+ /**
332
+ * Builds the OpenPanel identity traits from a renown User.
333
+ *
334
+ * Canonical trait schema (shared with Renown and Vetra — each app sends every
335
+ * field it has data for, under these names):
336
+ * - `address`, `did`, `networkId`, `chainId`, `caip2` — wallet/chain facts.
337
+ * - `ensName`, `ensAvatar` — raw ENS facts.
338
+ * - `username`, `userImage`, `profileDocumentId`, `profileCreatedAt` — raw
339
+ * Renown profile facts.
340
+ * - `accountType` — wallet-adapter concept; only Renown has it.
341
+ *
342
+ * Rules:
343
+ * - `credential` (contains a JWT) is **never** forwarded.
344
+ * - Traits carry raw facts only; resolved presentation values (avatar,
345
+ * display name) go in OpenPanel's native identify fields — see
346
+ * {@link buildIdentifyPayload}.
347
+ * - Optional fields (`ens`, `profile`) are only included when their value is
348
+ * non-nullish (guards against `null` from `RenownProfile` fields as well
349
+ * as plain `undefined`).
350
+ *
351
+ * Mirror the Sentry pattern in `store/user.ts`: destructure off `credential`
352
+ * first, then assemble the trait payload from the remainder.
353
+ */
354
+ function buildTraits(user) {
355
+ const { credential: _credential, ...rest } = user;
356
+ const traits = {
357
+ address: rest.address,
358
+ did: rest.did,
359
+ networkId: rest.networkId,
360
+ chainId: rest.chainId,
361
+ caip2: `${rest.networkId}:${rest.chainId}`
362
+ };
363
+ if (rest.ens?.name != null) traits.ensName = rest.ens.name;
364
+ if (rest.ens?.avatarUrl != null) traits.ensAvatar = rest.ens.avatarUrl;
365
+ if (rest.profile?.username != null) traits.username = rest.profile.username;
366
+ if (rest.profile?.userImage != null) traits.userImage = rest.profile.userImage;
367
+ if (rest.profile?.documentId != null) traits.profileDocumentId = rest.profile.documentId;
368
+ if (rest.profile?.createdAt != null) traits.profileCreatedAt = rest.profile.createdAt;
369
+ return traits;
370
+ }
371
+ /**
372
+ * Builds the full `identify()` payload:
373
+ * - `profileId` is the wallet address — the cross-app profile key shared with
374
+ * Renown and Vetra.
375
+ * - `avatar` / `firstName` are OpenPanel's native profile fields (they drive
376
+ * the picture and name in the dashboard UI), resolved as
377
+ * `userImage ?? ensAvatar` and `ensName ?? username`.
378
+ * - `properties` are the raw traits from {@link buildTraits}.
379
+ */
380
+ function buildIdentifyPayload(user) {
381
+ const avatar = user.profile?.userImage ?? user.ens?.avatarUrl;
382
+ const firstName = user.ens?.name ?? user.profile?.username;
383
+ return {
384
+ profileId: user.address,
385
+ ...avatar != null ? { avatar } : {},
386
+ ...firstName != null ? { firstName } : {},
387
+ properties: buildTraits(user)
388
+ };
389
+ }
390
+ //#endregion
391
+ //#region src/components/openpanel.tsx
392
+ /**
393
+ * `OpenPanel` is a `null`-rendering component that manages the full lifecycle
394
+ * of the OpenPanel analytics subsystem.
395
+ *
396
+ * Gates:
397
+ * - `useAcceptedCookies().analytics === true` — the existing analytics cookie.
398
+ * - `connectConfig.openPanel.clientId` non-empty — no client ID → no-op.
399
+ *
400
+ * Behaviour when both gates pass:
401
+ * 1. Lazy-imports `@openpanel/web` and builds the singleton via
402
+ * `getOpenPanelClient(connectConfig.openPanel)`.
403
+ * 2. Exposes the client on `window.openPanel` for the card-6
404
+ * `useOpenPanelAnalytics()` hook to consume.
405
+ * 3. If `connectConfig.openPanel.trackOperations`, registers the processor
406
+ * factory against `processorManager` so document operations are forwarded.
407
+ * 4. Calls `client.identify()` when the renown user transitions from
408
+ * `undefined` → defined (login). The profile ID is the wallet address —
409
+ * the cross-app key shared with Renown and Vetra.
410
+ * 5. Calls `client.clear()` when the user transitions from defined →
411
+ * `undefined` (logout).
412
+ *
413
+ * Teardown (unmount **or** consent revocation):
414
+ * - `unregisterFactory("openpanel")` to remove the processor.
415
+ * - `resetOpenPanelClient()` to clear the singleton.
416
+ * - `window.openPanel` is cleared.
417
+ *
418
+ * Mirrors the Sentry pattern in `store/user.ts` for login/logout detection.
419
+ * Analytics failures are caught and forwarded to `console.warn` — they must
420
+ * never throw into the application.
421
+ *
422
+ * Mounted next to `<Analytics />` in `app.tsx`.
423
+ */
424
+ function OpenPanel() {
425
+ const [{ analytics }] = useAcceptedCookies();
426
+ const user = useUser();
427
+ const module = useReactorClientModule();
428
+ const reactorClientModule = module?.kind === "browser" ? module : void 0;
429
+ const [client, setClient] = useState();
430
+ /**
431
+ * Tracks the previous `user` value so we can detect the two transitions:
432
+ * undefined → defined (login)
433
+ * defined → undefined (logout)
434
+ */
435
+ const prevUserRef = useRef(void 0);
436
+ const enabled = analytics && !!connectConfig.openPanel.clientId;
437
+ const processorManager = reactorClientModule?.reactorModule?.processorManager;
438
+ useEffect(() => {
439
+ if (!enabled) return;
440
+ let cancelled = false;
441
+ const isCancelled = () => cancelled;
442
+ const setup = async () => {
443
+ let builtClient;
444
+ try {
445
+ builtClient = await getOpenPanelClient(connectConfig.openPanel);
446
+ } catch (err) {
447
+ console.warn("[OpenPanel] Failed to build client:", err);
448
+ return;
449
+ }
450
+ if (isCancelled() || !builtClient) return;
451
+ setClient(builtClient);
452
+ window.openPanel = builtClient;
453
+ if (connectConfig.openPanel.trackOperations && processorManager) try {
454
+ await processorManager.registerFactory("openpanel", createOpenPanelProcessorFactory({
455
+ client: builtClient,
456
+ events: {
457
+ mappings: eventMappings,
458
+ lookupMap: eventLookupMap
459
+ },
460
+ startFrom: "current"
461
+ }));
462
+ if (isCancelled()) await processorManager.unregisterFactory("openpanel").catch((err) => console.warn("[OpenPanel] Failed to unregister factory after cancellation:", err));
463
+ } catch (err) {
464
+ console.warn("[OpenPanel] Failed to register processor factory:", err);
465
+ }
466
+ };
467
+ setup();
468
+ return () => {
469
+ cancelled = true;
470
+ prevUserRef.current = void 0;
471
+ if (connectConfig.openPanel.trackOperations && processorManager) processorManager.unregisterFactory("openpanel").catch((err) => console.warn("[OpenPanel] Failed to unregister processor factory:", err));
472
+ resetOpenPanelClient();
473
+ window.openPanel = void 0;
474
+ setClient(void 0);
475
+ };
476
+ }, [enabled, processorManager]);
477
+ useEffect(() => {
478
+ if (!enabled || !client) return;
479
+ const prev = prevUserRef.current;
480
+ prevUserRef.current = user;
481
+ if (!prev && user) try {
482
+ client.identify(buildIdentifyPayload(user));
483
+ } catch (err) {
484
+ console.warn("[OpenPanel] Failed to identify user:", err);
485
+ }
486
+ else if (prev && !user) try {
487
+ client.clear();
488
+ } catch (err) {
489
+ console.warn("[OpenPanel] Failed to clear user:", err);
490
+ }
491
+ }, [
492
+ client,
493
+ user,
494
+ enabled
495
+ ]);
496
+ return null;
497
+ }
498
+ //#endregion
499
+ //#region src/context/sentry-provider.tsx
500
+ const SentryProvider = ({ children }) => {
501
+ useInitSentry();
502
+ return children;
503
+ };
504
+ //#endregion
505
+ //#region src/utils/document-editor-debug-tools.ts
506
+ var DocumentEditorDebugTools = class {
507
+ document;
508
+ operations = [];
509
+ constructor(document) {
510
+ if (document) this.document = document;
511
+ }
512
+ operationsToTableObject(operations) {
513
+ return operations.map((op) => ({
514
+ ...op,
515
+ input: JSON.stringify(op.action.input)
516
+ }));
517
+ }
518
+ setDocument(document) {
519
+ this.document = document;
520
+ }
521
+ getDocument() {
522
+ return this.document;
523
+ }
524
+ getOperations() {
525
+ return this.operations;
526
+ }
527
+ pushOperation(operation) {
528
+ this.operations.push(operation);
529
+ }
530
+ operationsTable() {
531
+ if (!this.document) console.warn("No document");
532
+ const ops = Object.values(this.document?.operations || {}).filter((array) => array !== void 0).flatMap((array) => array).sort((a, b) => a.index - b.index);
533
+ console.table(this.operationsToTableObject(ops));
534
+ }
535
+ scopeOperationsTable(scope) {
536
+ if (!this.document) console.warn("No document");
537
+ const ops = this.document?.operations[scope] || [];
538
+ console.table(this.operationsToTableObject(ops));
539
+ }
540
+ operationsLog() {
541
+ console.log(this.operations);
542
+ }
543
+ operationsLogTable() {
544
+ console.table(this.operationsToTableObject(this.operations));
545
+ }
546
+ clear() {
547
+ this.operations = [];
548
+ this.document = void 0;
549
+ }
550
+ };
551
+ //#endregion
552
+ //#region src/utils/pglite-migration.ts
553
+ const BACKUP_PREFIX = "ph-pglite-backup::";
554
+ const BACKUP_INDEX_KEY = "ph:pglite-backups";
555
+ const BACKUP_RETENTION_MS = 2592e6;
556
+ function deleteIdb(name, timeoutMs = 15e3) {
557
+ return new Promise((resolve, reject) => {
558
+ const req = indexedDB.deleteDatabase(name);
559
+ let settled = false;
560
+ const done = (fn) => {
561
+ if (settled) return;
562
+ settled = true;
563
+ fn();
564
+ };
565
+ const timer = setTimeout(() => done(() => reject(/* @__PURE__ */ new Error(`IDB delete timed out for ${name} after ${timeoutMs}ms`))), timeoutMs);
566
+ req.onsuccess = () => done(() => {
567
+ clearTimeout(timer);
568
+ resolve();
569
+ });
570
+ req.onerror = () => done(() => {
571
+ clearTimeout(timer);
572
+ reject(idbError(req, `IDB delete failed for ${name}`));
573
+ });
574
+ });
575
+ }
576
+ function readBackupIndex() {
577
+ try {
578
+ const raw = localStorage.getItem(BACKUP_INDEX_KEY);
579
+ if (!raw) return [];
580
+ const parsed = JSON.parse(raw);
581
+ return Array.isArray(parsed) ? parsed : [];
582
+ } catch {
583
+ return [];
584
+ }
585
+ }
586
+ function writeBackupIndex(records) {
587
+ try {
588
+ localStorage.setItem(BACKUP_INDEX_KEY, JSON.stringify(records));
589
+ } catch {}
590
+ }
591
+ function registerBackup(rec) {
592
+ writeBackupIndex([...readBackupIndex(), rec]);
593
+ }
594
+ function forgetBackup(name) {
595
+ writeBackupIndex(readBackupIndex().filter((r) => r.name !== name));
596
+ }
597
+ async function janitor() {
598
+ const cutoff = Date.now() - BACKUP_RETENTION_MS;
599
+ const keep = [];
600
+ for (const rec of readBackupIndex()) {
601
+ if (rec.createdAt >= cutoff) {
602
+ keep.push(rec);
603
+ continue;
604
+ }
605
+ try {
606
+ await deleteIdb(rec.name);
607
+ } catch (err) {
608
+ console.warn(`Failed to delete expired pglite backup ${rec.name}`, err);
609
+ keep.push(rec);
610
+ }
611
+ }
612
+ writeBackupIndex(keep);
613
+ }
614
+ function createPersistentBackup() {
615
+ return {
616
+ snapshot: async (idbName) => {
617
+ const backupName = `${BACKUP_PREFIX}${idbName}::${(/* @__PURE__ */ new Date()).toISOString()}`;
618
+ await cloneFileData(idbName, backupName);
619
+ registerBackup({
620
+ name: backupName,
621
+ idbName,
622
+ createdAt: Date.now()
623
+ });
624
+ return backupName;
625
+ },
626
+ rollback: async (handle, idbName, cause) => {
627
+ const backupName = handle;
628
+ try {
629
+ await cloneFileData(backupName, idbName);
630
+ } catch (rollbackErr) {
631
+ console.error(`PGlite migration rollback failed for ${idbName}; backup ${backupName} retained. Primary migration error:`, cause, "Rollback error:", rollbackErr);
632
+ return;
633
+ }
634
+ await deleteIdb(backupName).catch(() => void 0);
635
+ forgetBackup(backupName);
636
+ },
637
+ discard: async (handle) => {
638
+ const backupName = handle;
639
+ await deleteIdb(backupName).catch(() => void 0);
640
+ forgetBackup(backupName);
641
+ },
642
+ commit: () => Promise.resolve()
643
+ };
644
+ }
645
+ async function migrateAllLocked() {
646
+ const backup = createPersistentBackup();
647
+ try {
648
+ for (const idbName of PRIMARY_IDB_NAMES) await migrateIdb(idbName, (phase) => setMigrationStatus({
649
+ idbName,
650
+ phase
651
+ }), backup);
652
+ } finally {
653
+ setMigrationStatus(null);
654
+ }
655
+ }
656
+ async function migrateAllIfNeeded() {
657
+ janitor().catch((err) => console.warn("PGlite backup janitor failed", err));
658
+ if (!(typeof navigator !== "undefined" && "locks" in navigator && typeof navigator.locks.request === "function")) {
659
+ await migrateAllLocked();
660
+ return;
661
+ }
662
+ await navigator.locks.request("ph-pglite-migration", { mode: "exclusive" }, async () => {
663
+ await migrateAllLocked();
664
+ });
665
+ }
666
+ //#endregion
667
+ //#region src/components/missing-model-banner.tsx
668
+ const reasonLabels = {
669
+ "no-registry": "No package registry is configured.",
670
+ "not-in-registry": "No matching package found in the registry.",
671
+ "registry-error": "Couldn't reach the package registry.",
672
+ "install-failed": "Package failed to install.",
673
+ dismissed: "Installation was dismissed.",
674
+ offline: "You're offline — this package can't be loaded until you reconnect."
675
+ };
676
+ function canRetry(reason) {
677
+ return reason !== "no-registry";
678
+ }
679
+ function MissingModelBanner() {
680
+ const failed = useFailedInstallations();
681
+ const discoveryService = usePackageDiscoveryService();
682
+ const [open, setOpen] = useState(false);
683
+ const [dismissed, setDismissed] = useState(false);
684
+ useEffect(() => {
685
+ return discoveryService?.subscribeEvents((event) => {
686
+ if (event.type === "load-failed") setDismissed(false);
687
+ });
688
+ }, [discoveryService]);
689
+ if (failed.length === 0) return null;
690
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [dismissed ? null : /* @__PURE__ */ jsx("div", {
691
+ className: "absolute inset-x-0 top-0 z-200 bg-background",
692
+ children: /* @__PURE__ */ jsxs("div", {
693
+ className: "flex items-center justify-between gap-3 bg-warning/10 px-4 py-2 text-sm text-warning",
694
+ children: [/* @__PURE__ */ jsx("span", { children: failed.length === 1 ? "1 document type couldn't load (missing model)." : `${failed.length} document types couldn't load (missing models).` }), /* @__PURE__ */ jsxs("div", {
695
+ className: "flex items-center gap-2",
696
+ children: [/* @__PURE__ */ jsx("button", {
697
+ type: "button",
698
+ onClick: () => setOpen(true),
699
+ className: "rounded-md border border-warning bg-background px-3 py-1 text-warning hover:hover-effect",
700
+ children: "View"
701
+ }), /* @__PURE__ */ jsx("button", {
702
+ type: "button",
703
+ onClick: () => setDismissed(true),
704
+ "aria-label": "Dismiss",
705
+ className: "flex items-center text-warning hover:hover-effect",
706
+ children: /* @__PURE__ */ jsx(Icon, {
707
+ name: "XmarkLight",
708
+ size: 16
709
+ })
710
+ })]
711
+ })]
712
+ })
713
+ }), /* @__PURE__ */ jsx(MissingModelDetailsModal, {
714
+ open,
715
+ failed,
716
+ onClose: () => setOpen(false)
717
+ })] });
718
+ }
719
+ function MissingModelDetailsModal(props) {
720
+ const { open, failed, onClose } = props;
721
+ const discoveryService = usePackageDiscoveryService();
722
+ const [retrying, setRetrying] = useState(() => /* @__PURE__ */ new Set());
723
+ async function handleRetry(documentType) {
724
+ if (!discoveryService) return;
725
+ setRetrying((prev) => new Set(prev).add(documentType));
726
+ try {
727
+ await discoveryService.retryInstallation(documentType);
728
+ } finally {
729
+ setRetrying((prev) => {
730
+ const next = new Set(prev);
731
+ next.delete(documentType);
732
+ return next;
733
+ });
734
+ }
735
+ }
736
+ return /* @__PURE__ */ jsx(Modal, {
737
+ open,
738
+ onOpenChange: (isOpen) => {
739
+ if (!isOpen) onClose();
740
+ },
741
+ contentProps: { className: "rounded-3xl" },
742
+ children: /* @__PURE__ */ jsxs("div", {
743
+ className: "w-[520px] max-w-[90vw] bg-background p-6",
744
+ children: [
745
+ /* @__PURE__ */ jsx("div", {
746
+ className: "border-b border-border pb-2 text-2xl font-bold text-foreground",
747
+ children: "Missing document models"
748
+ }),
749
+ /* @__PURE__ */ jsx("div", {
750
+ className: "my-4 text-sm text-foreground",
751
+ children: "The following document types couldn't be loaded. Documents using them won't display until the underlying package is installed."
752
+ }),
753
+ failed.length === 0 ? /* @__PURE__ */ jsx("div", {
754
+ className: "rounded-xl bg-background p-4 text-sm text-foreground",
755
+ children: "No outstanding failures."
756
+ }) : /* @__PURE__ */ jsx("div", {
757
+ className: "flex max-h-[60vh] flex-col gap-3 overflow-y-auto",
758
+ children: failed.map((entry) => {
759
+ const isRetrying = retrying.has(entry.documentType);
760
+ const retryDisabled = !canRetry(entry.reason) || isRetrying;
761
+ return /* @__PURE__ */ jsxs("div", {
762
+ className: "rounded-xl bg-background p-4",
763
+ children: [
764
+ /* @__PURE__ */ jsx("div", {
765
+ className: "mb-1 font-mono text-sm font-semibold text-foreground",
766
+ children: entry.documentType
767
+ }),
768
+ /* @__PURE__ */ jsx("div", {
769
+ className: "mb-2 text-xs text-foreground",
770
+ children: reasonLabels[entry.reason]
771
+ }),
772
+ entry.packageNames.length > 0 ? /* @__PURE__ */ jsxs("div", {
773
+ className: "mb-2 text-xs text-muted-foreground",
774
+ children: [
775
+ "Package",
776
+ entry.packageNames.length > 1 ? "s" : "",
777
+ ":",
778
+ " ",
779
+ entry.packageNames.join(", ")
780
+ ]
781
+ }) : null,
782
+ entry.error ? /* @__PURE__ */ jsx("div", {
783
+ className: "mb-2 font-mono text-xs wrap-break-word text-destructive",
784
+ children: entry.error.message
785
+ }) : null,
786
+ /* @__PURE__ */ jsx("div", {
787
+ className: "flex justify-end",
788
+ children: /* @__PURE__ */ jsx("button", {
789
+ type: "button",
790
+ onClick: () => void handleRetry(entry.documentType),
791
+ disabled: retryDisabled,
792
+ title: canRetry(entry.reason) ? void 0 : "No registry is configured; nothing to retry against.",
793
+ className: twMerge("min-h-[32px] rounded-xl px-3 py-1 text-sm font-semibold text-foreground transition-all hover:hover-effect", retryDisabled ? "cursor-not-allowed bg-secondary hover:hover-effect" : "bg-primary text-primary-foreground active:active-effect"),
794
+ children: isRetrying ? "Retrying..." : "Try install again"
795
+ })
796
+ })
797
+ ]
798
+ }, entry.documentType);
799
+ })
800
+ }),
801
+ /* @__PURE__ */ jsx("div", {
802
+ className: "mt-4 flex justify-end",
803
+ children: /* @__PURE__ */ jsx("button", {
804
+ type: "button",
805
+ onClick: onClose,
806
+ className: "min-h-[36px] rounded-xl border border-border bg-background px-4 py-2 text-sm font-semibold text-foreground hover:hover-effect",
807
+ children: "Close"
808
+ })
809
+ })
810
+ ]
811
+ })
812
+ });
813
+ }
814
+ //#endregion
815
+ //#region src/components/open-file-upload-list.tsx
816
+ function OpenFileUploadList() {
817
+ const uploads = useSyncExternalStore(subscribeOpenFileUploads, getOpenFileUploads);
818
+ return /* @__PURE__ */ jsx(UploadFileListContainer, {
819
+ uploadsArray: uploads,
820
+ uploadsCount: uploads.length,
821
+ removeUpload: removeOpenFileUpload,
822
+ clearAllUploads: clearOpenFileUploads,
823
+ setSelectedNode
824
+ });
825
+ }
826
+ //#endregion
827
+ //#region src/components/package-install-prompt.tsx
828
+ function PackageInstallPrompt() {
829
+ const pendingInstallations = usePendingInstallations();
830
+ const discoveryService = usePackageDiscoveryService();
831
+ if (!discoveryService || pendingInstallations.length === 0) return null;
832
+ const installations = pendingInstallations.flatMap((p) => p.packageNames.map((packageName) => ({
833
+ documentType: p.documentType,
834
+ packageName
835
+ })));
836
+ return /* @__PURE__ */ jsx(PackageInstallModal, {
837
+ pendingInstallations: installations,
838
+ onInstall: (packageName) => discoveryService.approveInstallation(packageName),
839
+ onDismiss: (packageName) => discoveryService.dismissInstallation(packageName)
840
+ });
841
+ }
842
+ //#endregion
843
+ //#region src/components/renown-adapter-descriptors.ts
844
+ function describe(id, build) {
845
+ try {
846
+ return [build()];
847
+ } catch (error) {
848
+ console.error(`[connect] Ignoring the "${id}" wallet adapter: connect.renown.adapters.${id} was rejected.`, error);
849
+ return [];
850
+ }
851
+ }
852
+ const CHAINS_BY_ID = new Map([
853
+ mainnet,
854
+ sepolia,
855
+ polygon,
856
+ optimism,
857
+ arbitrum,
858
+ base
859
+ ].map((chain) => [chain.id, chain]));
860
+ function chainsFor(chainId) {
861
+ if (chainId === void 0) return void 0;
862
+ const chain = CHAINS_BY_ID.get(chainId);
863
+ if (!chain) {
864
+ console.error(`[connect] connect.renown.chainId ${chainId} is not a chain Connect can offer, so in-page sign-in will be rejected. Supported: ${[...CHAINS_BY_ID.keys()].join(", ")}.`);
865
+ return;
866
+ }
867
+ return [chain];
868
+ }
869
+ /** Map Connect's declarative `connect.renown.adapters` config to the descriptors `RenownWalletProvider` takes. Array order sets the order of the login buttons. A rejected adapter config is dropped (logged), leaving the others working. `chainId` is `connect.renown.chainId`, the chain Renown issues credentials on. */
870
+ function configToDescriptors(config, chainId) {
871
+ if (!config) return [];
872
+ const { rainbow, privy, mock } = config;
873
+ const descriptors = [];
874
+ const chains = chainsFor(chainId);
875
+ if (rainbow) descriptors.push(...describe("rainbow", () => rainbowAdapter({
876
+ ...rainbow,
877
+ ...chains ? { chains } : {}
878
+ })));
879
+ if (privy) {
880
+ const { appId, clientId, methods } = privy;
881
+ if (appId) descriptors.push(...describe("privy", () => privyAdapter({
882
+ appId,
883
+ clientId,
884
+ methods,
885
+ chain: chains?.[0]
886
+ })));
887
+ }
888
+ if (mock) descriptors.push(...describe("mock", () => mockAdapter({
889
+ ...mock,
890
+ methods: mock.methods
891
+ })));
892
+ return descriptors;
893
+ }
894
+ //#endregion
895
+ //#region src/components/renown-wallet-providers.tsx
896
+ function resolveColor(expr, fallback) {
897
+ if (typeof document === "undefined") return fallback;
898
+ const probe = document.createElement("span");
899
+ probe.style.color = fallback;
900
+ probe.style.color = expr;
901
+ probe.style.display = "none";
902
+ document.body.appendChild(probe);
903
+ const resolved = getComputedStyle(probe).color;
904
+ probe.remove();
905
+ return resolved || fallback;
906
+ }
907
+ function RenownWalletProviders({ children }) {
908
+ const config = getRuntimeConfig().connect.renown?.adapters;
909
+ const chainId = getRuntimeConfig().connect.renown?.chainId;
910
+ const { theme } = useTheme();
911
+ const adapters = useMemo(() => configToDescriptors(config, chainId), [config, chainId]);
912
+ const walletTheme = useMemo(() => adapters.length > 0 ? {
913
+ mode: theme,
914
+ accentColor: resolveColor("var(--primary)", "#0084ff"),
915
+ accentColorForeground: resolveColor("var(--primary-foreground)", "#ffffff")
916
+ } : void 0, [theme, adapters]);
917
+ if (adapters.length === 0) return /* @__PURE__ */ jsx(Fragment$1, { children });
918
+ return /* @__PURE__ */ jsx(RenownWalletProvider, {
919
+ adapters,
920
+ theme: walletTheme,
921
+ children
922
+ });
923
+ }
924
+ //#endregion
925
+ //#region src/components/app.tsx
926
+ const ConnectReactorChatFab = lazy(() => import("./reactor-chat-LAB-9G3G.js").then((m) => ({ default: m.ConnectReactorChatFab })));
927
+ const App = () => {
928
+ useTheme();
929
+ useEditorPreloader();
930
+ useEffect(() => {
931
+ const handlePreloadError = (event) => {
932
+ const payload = event.payload;
933
+ const failedUrl = (payload instanceof Error ? payload.message : typeof payload === "string" ? payload : "").match(/https?:\/\/[^\s"']+/)?.[0];
934
+ if (failedUrl && !failedUrl.startsWith(window.location.origin)) {
935
+ console.debug(`[Connect] Skipping reload — vite:preloadError for off-origin URL: ${failedUrl}`);
936
+ return;
937
+ }
938
+ console.log("Outdated chunks detected, reloading page...");
939
+ window.location.reload();
940
+ };
941
+ window.addEventListener("vite:preloadError", handlePreloadError);
942
+ return () => {
943
+ window.removeEventListener("vite:preloadError", handlePreloadError);
944
+ };
945
+ }, []);
946
+ useEffect(() => {
947
+ if (import.meta.env.MODE === "development") window.documentEditorDebugTools = new DocumentEditorDebugTools();
948
+ else if (connectConfig.offline) serviceWorkerManager.registerServiceWorker(false);
949
+ else serviceWorkerManager.unregisterAll();
950
+ }, []);
951
+ useEffect(() => {
952
+ initLaunchQueueFileHandling();
953
+ }, []);
954
+ return /* @__PURE__ */ jsx(SentryProvider, { children: /* @__PURE__ */ jsxs(RenownWalletProviders, { children: [
955
+ /* @__PURE__ */ jsx(ToastContainer, { position: "bottom-right" }),
956
+ connectConfig.aiAssistantEnabled && /* @__PURE__ */ jsx(Suspense, {
957
+ name: "ReactorChat",
958
+ fallback: null,
959
+ children: /* @__PURE__ */ jsx(ConnectReactorChatFab, {})
960
+ }),
961
+ /* @__PURE__ */ jsx(MissingModelBanner, {}),
962
+ /* @__PURE__ */ jsx(Router, {}),
963
+ /* @__PURE__ */ jsx(OpenFileUploadList, {}),
964
+ /* @__PURE__ */ jsx(PackageInstallPrompt, {}),
965
+ /* @__PURE__ */ jsx(Analytics, {}),
966
+ /* @__PURE__ */ jsx(OpenPanel, {})
967
+ ] }) });
968
+ };
969
+ //#endregion
970
+ //#region src/components/connection-banner.tsx
971
+ const CONNECTED = "connected";
972
+ const BANNER_TEXT = {
973
+ failed: {
974
+ title: "Reactor worker failed to load",
975
+ detail: "The background worker script could not be loaded. Reload to retry."
976
+ },
977
+ lost: {
978
+ title: "Lost connection to the reactor",
979
+ detail: "The background worker stopped responding. Reload to reconnect."
980
+ },
981
+ "storage-held": {
982
+ title: "Waiting for another Connect tab",
983
+ detail: "Another Connect tab still holds local storage. Close or reload the other Connect tabs to continue."
984
+ },
985
+ "version-conflict": {
986
+ title: "Connect tabs are on different builds",
987
+ detail: "Open tabs keep restarting the reactor. Close the other Connect tabs, then reload."
988
+ },
989
+ "storage-unusable": {
990
+ title: "Local storage is unusable",
991
+ detail: "The local database stopped responding. Clear storage to start over, or reload to retry."
992
+ }
993
+ };
994
+ const ConnectionBanner = () => {
995
+ const status = useSyncExternalStore(subscribeWorkerConnection, getWorkerConnectionStatus, () => CONNECTED);
996
+ if (status === "connected") return null;
997
+ const { title, detail } = BANNER_TEXT[status];
998
+ return /* @__PURE__ */ jsx("div", {
999
+ className: "absolute inset-x-0 top-0 z-30 flex justify-center p-3",
1000
+ children: /* @__PURE__ */ jsxs("div", {
1001
+ className: "flex max-w-3xl items-center gap-3 rounded-lg border border-destructive bg-warning px-4 py-3 text-sm text-warning-foreground shadow-lg",
1002
+ children: [
1003
+ /* @__PURE__ */ jsxs("div", {
1004
+ className: "flex-1",
1005
+ children: [/* @__PURE__ */ jsx("div", {
1006
+ className: "font-semibold",
1007
+ children: title
1008
+ }), /* @__PURE__ */ jsx("div", {
1009
+ className: "text-foreground",
1010
+ children: detail
1011
+ })]
1012
+ }),
1013
+ status === "storage-unusable" && /* @__PURE__ */ jsx("button", {
1014
+ type: "button",
1015
+ onClick: () => showPHModal({ type: "clearStorage" }),
1016
+ className: "rounded-sm bg-primary px-3 py-1 text-sm font-medium text-primary-foreground hover:hover-effect",
1017
+ children: "Clear storage"
1018
+ }),
1019
+ /* @__PURE__ */ jsx("button", {
1020
+ type: "button",
1021
+ onClick: () => window.location.reload(),
1022
+ className: "rounded-sm bg-primary px-3 py-1 text-sm font-medium text-primary-foreground hover:hover-effect",
1023
+ children: "Reload"
1024
+ })
1025
+ ]
1026
+ })
1027
+ });
1028
+ };
1029
+ //#endregion
1030
+ //#region src/components/cookie-consent.tsx
1031
+ const CookieBanner$1 = lazy(() => import("./cookie-banner-CAvd3PC3.js").then((m) => ({ default: m.CookieBanner })));
1032
+ /** Asks for the analytics consent that active plugins need; without one, consent stays rejected. */
1033
+ function CookieConsent() {
1034
+ return /* @__PURE__ */ jsx(ErrorBoundary, {
1035
+ variant: "silent",
1036
+ loggerContext: ["Connect", "CookieBanner"],
1037
+ children: /* @__PURE__ */ jsx(Suspense, {
1038
+ fallback: null,
1039
+ name: "CookieBanner",
1040
+ children: /* @__PURE__ */ jsx(CookieBanner$1, {})
1041
+ })
1042
+ });
1043
+ }
1044
+ //#endregion
1045
+ //#region src/components/plugin-roots.tsx
1046
+ /** What the active plugins render beside the app, and the consent banner when one needs it. */
1047
+ function PluginRoots() {
1048
+ const { roots, consent } = getConnectPluginUi();
1049
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [consent && /* @__PURE__ */ jsx(CookieConsent, {}), roots.map((Root, i) => /* @__PURE__ */ jsx(Root, {}, i))] });
1050
+ }
1051
+ //#endregion
1052
+ //#region src/components/migration-banner.tsx
1053
+ function BannerShell({ title, body, error, children }) {
1054
+ return /* @__PURE__ */ jsx("div", {
1055
+ className: "absolute inset-x-0 top-0 z-30 flex justify-center p-3",
1056
+ children: /* @__PURE__ */ jsxs("div", {
1057
+ className: "flex max-w-3xl items-center gap-3 rounded-lg border border-warning bg-warning px-4 py-3 text-sm text-warning-foreground shadow-lg",
1058
+ children: [/* @__PURE__ */ jsxs("div", {
1059
+ className: "flex-1",
1060
+ children: [
1061
+ /* @__PURE__ */ jsx("div", {
1062
+ className: "font-semibold",
1063
+ children: title
1064
+ }),
1065
+ /* @__PURE__ */ jsx("div", {
1066
+ className: "text-foreground",
1067
+ children: body
1068
+ }),
1069
+ error && /* @__PURE__ */ jsxs("div", {
1070
+ className: "mt-2 font-medium text-destructive",
1071
+ children: ["Migration failed: ", error]
1072
+ })
1073
+ ]
1074
+ }), children]
1075
+ })
1076
+ });
1077
+ }
1078
+ const actionButton = "rounded-sm bg-primary px-3 py-1 text-sm font-medium text-primary-foreground hover:hover-effect disabled:disabled-effect";
1079
+ const dismissButton = "rounded-sm border border-foreground bg-transparent px-3 py-1 text-sm font-medium text-foreground hover:hover-effect disabled:disabled-effect";
1080
+ let browserDismissed = false;
1081
+ const browserListeners = /* @__PURE__ */ new Set();
1082
+ function WorkerMigrationBanner({ adminClient }) {
1083
+ const state = useSyncExternalStore((cb) => adminClient.subscribeMigration(cb), () => adminClient.getMigrationState());
1084
+ const [dismissed, setDismissed] = useState(false);
1085
+ const [error, setError] = useState(null);
1086
+ if (state.status === "idle") return null;
1087
+ if (state.status === "needed" && dismissed) return null;
1088
+ const migrating = state.status === "migrating";
1089
+ const handleMigrate = () => {
1090
+ setError(null);
1091
+ adminClient.migrate().catch((err) => {
1092
+ setError(err instanceof Error ? err.message : String(err));
1093
+ });
1094
+ };
1095
+ return /* @__PURE__ */ jsxs(BannerShell, {
1096
+ title: migrating ? `Migrating to Postgres 17…` : `Your local database uses Postgres ${state.legacyMajor ?? "?"}.`,
1097
+ body: migrating ? `Working (${state.phase ?? "starting"}). Your data is backed up first.` : `Migrate to Postgres 17 to pick up the latest features. Your data will be backed up first.`,
1098
+ error: error ?? (state.status === "failed" ? state.error : null),
1099
+ children: [!migrating && /* @__PURE__ */ jsx("button", {
1100
+ type: "button",
1101
+ onClick: handleMigrate,
1102
+ className: actionButton,
1103
+ children: state.status === "failed" ? "Retry" : "Migrate now"
1104
+ }), state.status === "needed" && /* @__PURE__ */ jsx("button", {
1105
+ type: "button",
1106
+ onClick: () => setDismissed(true),
1107
+ className: dismissButton,
1108
+ children: "Dismiss"
1109
+ })]
1110
+ });
1111
+ }
1112
+ function BrowserMigrationBanner() {
1113
+ const isDismissed = useSyncExternalStore((cb) => {
1114
+ browserListeners.add(cb);
1115
+ return () => browserListeners.delete(cb);
1116
+ }, () => browserDismissed, () => false);
1117
+ const major = useSyncExternalStore(subscribeMigrationMajor, getCachedMigrationMajor, () => void 0);
1118
+ const [migrating, setMigrating] = useState(false);
1119
+ const [error, setError] = useState(null);
1120
+ if (major === void 0 || major === null || major === 17) return null;
1121
+ if (isDismissed) return null;
1122
+ const handleMigrate = () => {
1123
+ setError(null);
1124
+ setMigrating(true);
1125
+ migrateAllIfNeeded().then(() => window.location.reload()).catch((err) => {
1126
+ setError(err instanceof Error ? err.message : String(err));
1127
+ setMigrating(false);
1128
+ });
1129
+ };
1130
+ return /* @__PURE__ */ jsxs(BannerShell, {
1131
+ title: `Your local database uses Postgres ${major}.`,
1132
+ body: `Migrate to Postgres 17 to pick up the latest features. Your data will be backed up first.`,
1133
+ error,
1134
+ children: [/* @__PURE__ */ jsx("button", {
1135
+ type: "button",
1136
+ disabled: migrating,
1137
+ onClick: handleMigrate,
1138
+ className: actionButton,
1139
+ children: migrating ? "Migrating…" : "Migrate now"
1140
+ }), /* @__PURE__ */ jsx("button", {
1141
+ type: "button",
1142
+ disabled: migrating,
1143
+ onClick: () => {
1144
+ browserDismissed = true;
1145
+ for (const l of browserListeners) l();
1146
+ },
1147
+ className: dismissButton,
1148
+ children: "Dismiss"
1149
+ })]
1150
+ });
1151
+ }
1152
+ const MigrationBanner = () => {
1153
+ const module = useReactorClientModule();
1154
+ if (module?.kind === "worker") return /* @__PURE__ */ jsx(WorkerMigrationBanner, { adminClient: module.adminClient });
1155
+ return /* @__PURE__ */ jsx(BrowserMigrationBanner, {});
1156
+ };
1157
+ //#endregion
1158
+ //#region src/components/service-worker-update-prompt.tsx
1159
+ const ServiceWorkerUpdatePrompt = () => {
1160
+ if (!useSyncExternalStore(subscribeServiceWorkerUpdate, getServiceWorkerUpdateAvailable, () => false)) return null;
1161
+ return /* @__PURE__ */ jsx("div", {
1162
+ className: "absolute inset-x-0 bottom-0 z-30 flex justify-center p-3",
1163
+ children: /* @__PURE__ */ jsxs("div", {
1164
+ className: "flex max-w-3xl items-center gap-3 rounded-lg border border-foreground bg-primary px-4 py-3 text-sm text-primary-foreground shadow-lg",
1165
+ children: [/* @__PURE__ */ jsx("div", {
1166
+ className: "flex-1 font-medium",
1167
+ children: "A new version of Connect is available."
1168
+ }), /* @__PURE__ */ jsx("button", {
1169
+ type: "button",
1170
+ onClick: () => serviceWorkerManager.applyUpdate(),
1171
+ className: "rounded-sm bg-primary-foreground px-3 py-1 text-sm font-medium text-primary hover:hover-effect",
1172
+ children: "Refresh"
1173
+ })]
1174
+ })
1175
+ });
1176
+ };
1177
+ //#endregion
1178
+ //#region src/components/stored-documents-refused.tsx
1179
+ /** Boot screen for a reactor that refused this browser's stored documents. */
1180
+ function StoredDocumentsRefusedFallback({ error }) {
1181
+ return /* @__PURE__ */ jsx("div", {
1182
+ className: "z-10 mx-auto flex max-w-[80%] flex-1 items-center justify-center p-6",
1183
+ children: /* @__PURE__ */ jsxs("div", {
1184
+ role: "alert",
1185
+ className: "w-full max-w-lg rounded-lg border border-border bg-card p-6 text-foreground shadow-sm",
1186
+ children: [
1187
+ /* @__PURE__ */ jsxs("div", {
1188
+ className: "mb-3 flex items-center gap-2",
1189
+ children: [/* @__PURE__ */ jsx(Icon, {
1190
+ name: "Error",
1191
+ className: "size-5 shrink-0 text-destructive"
1192
+ }), /* @__PURE__ */ jsx("h1", {
1193
+ className: "text-lg font-semibold text-foreground",
1194
+ children: "Connect cannot open this browser's documents"
1195
+ })]
1196
+ }),
1197
+ /* @__PURE__ */ jsx("p", {
1198
+ className: "mb-4 text-sm wrap-break-word text-foreground",
1199
+ children: error.message
1200
+ }),
1201
+ /* @__PURE__ */ jsx(PowerhouseButton, {
1202
+ type: "button",
1203
+ onClick: () => {
1204
+ window.location.reload();
1205
+ },
1206
+ className: "px-3 py-1.5 text-base font-medium",
1207
+ children: "Reload"
1208
+ })
1209
+ ]
1210
+ })
1211
+ });
1212
+ }
1213
+ //#endregion
1214
+ //#region src/components/app-loader.tsx
1215
+ const AppLoader = (props) => {
1216
+ const phStore = getConnectPHStore();
1217
+ const Load = lazy(() => import("./load-CkbGF6wB.js").then((m) => m.loadComponent(props.localPackage, phStore)));
1218
+ return /* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsx(PHStoreProvider, {
1219
+ store: phStore,
1220
+ children: /* @__PURE__ */ jsxs(ErrorBoundary, {
1221
+ fallbackRender: (props) => /* @__PURE__ */ jsx(AppSkeleton, { children: isStoredDocumentsRefused(props.error) ? /* @__PURE__ */ jsx(StoredDocumentsRefusedFallback, { error: props.error }) : /* @__PURE__ */ jsx(DetailedFallback, { ...props }) }),
1222
+ resetKeys: [props.localPackage],
1223
+ loggerContext: ["Connect"],
1224
+ children: [
1225
+ /* @__PURE__ */ jsx(Suspense, {
1226
+ fallback: /* @__PURE__ */ jsx(LoadingShell, { Fallback: AppSkeleton }),
1227
+ name: "AppLoader",
1228
+ children: /* @__PURE__ */ jsxs(Load, {
1229
+ ...props,
1230
+ children: [/* @__PURE__ */ jsx(App, {}), /* @__PURE__ */ jsx(PluginRoots, {})]
1231
+ })
1232
+ }),
1233
+ /* @__PURE__ */ jsx(MigrationBanner, {}),
1234
+ /* @__PURE__ */ jsx(ServiceWorkerUpdatePrompt, {}),
1235
+ /* @__PURE__ */ jsx(ConnectionBanner, {})
1236
+ ]
1237
+ })
1238
+ }) });
1239
+ };
1240
+ //#endregion
1241
+ export { Analytics as i, App as n, OpenPanel as r, AppLoader as t };
1242
+
1243
+ //# sourceMappingURL=app-loader-DtH6v5CE.js.map
1244
+ //# debugId=74dc8a6a-3a52-58ef-b09e-daec104e79d7