@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 @@
1
+ {"version":3,"file":"pglite-major-p4_YefAE.js","sources":["../src/utils/stored-documents-refused.ts","../src/utils/pglite-idb.ts","../src/utils/pglite-major.ts"],"sourcesContent":["import { UnsupportedStoredProtocolError } from \"@powerhousedao/reactor\";\n\nexport const STORED_DOCUMENTS_REFUSED = \"StoredDocumentsRefusedError\";\n\n// Only name and message cross the worker boundary, so the message says it all.\nexport class StoredDocumentsRefusedError extends Error {\n constructor(cause: UnsupportedStoredProtocolError) {\n const named = cause.versions\n .map(({ protocol, version }) => `${protocol} ${version}`)\n .join(\", \");\n super(\n `This browser holds ${cause.documents} document(s) that require ${named}, which this version of Connect does not run. ` +\n `Open them with a Connect build that runs ${named}, or set connect.reactor.unsupportedStoredDocuments to \"read-only\" in powerhouse.config.json to open them read-only.`,\n { cause },\n );\n this.name = STORED_DOCUMENTS_REFUSED;\n }\n}\n\n/** Rewrites the reactor's refusal for the boot screen. */\nexport function toStoredDocumentsRefused(error: unknown): unknown {\n return UnsupportedStoredProtocolError.isError(error)\n ? new StoredDocumentsRefusedError(error)\n : error;\n}\n\nexport function isStoredDocumentsRefused(error: unknown): error is Error {\n return error instanceof Error && error.name === STORED_DOCUMENTS_REFUSED;\n}\n","export const IDB_STORE_NAME = \"FILE_DATA\";\nexport const IDB_DB_VERSION = 21;\n\ntype FileDataValue = {\n contents: Uint8Array | number[];\n mode: number;\n timestamp: Date | number;\n};\n\nexport function idbError(\n req: IDBRequest | IDBTransaction,\n context: string,\n): Error {\n const cause = req.error ?? new Error(\"unknown IDB error\");\n return new Error(`${context}: ${cause.message}`, { cause });\n}\n\nexport function indexedDbExists(name: string): Promise<boolean> {\n if (typeof indexedDB.databases === \"function\") {\n return indexedDB\n .databases()\n .then((dbs) => dbs.some((d) => d.name === name))\n .catch(() => true);\n }\n return Promise.resolve(true);\n}\n\nexport function openIdb(\n name: string,\n version: number,\n upgrade?: (db: IDBDatabase) => void,\n): Promise<IDBDatabase> {\n return new Promise((resolve, reject) => {\n const req = indexedDB.open(name, version);\n req.onerror = () => reject(idbError(req, `IDB open failed for ${name}`));\n req.onblocked = () => reject(new Error(`IDB open blocked for ${name}`));\n req.onupgradeneeded = () => upgrade?.(req.result);\n req.onsuccess = () => resolve(req.result);\n });\n}\n\nexport function createFileDataStore(db: IDBDatabase): void {\n if (!db.objectStoreNames.contains(IDB_STORE_NAME)) {\n const store = db.createObjectStore(IDB_STORE_NAME);\n store.createIndex(\"timestamp\", \"timestamp\", { unique: false });\n }\n}\n\nexport async function readPgVersionFile(\n idbName: string,\n): Promise<number | null> {\n if (!(await indexedDbExists(idbName))) return null;\n let db: IDBDatabase;\n try {\n db = await openIdb(idbName, IDB_DB_VERSION, createFileDataStore);\n } catch {\n return null;\n }\n try {\n if (!db.objectStoreNames.contains(IDB_STORE_NAME)) return null;\n const tx = db.transaction(IDB_STORE_NAME, \"readonly\");\n const store = tx.objectStore(IDB_STORE_NAME);\n const value = await new Promise<FileDataValue | null>((resolve, reject) => {\n const req = store.openCursor();\n req.onerror = () =>\n reject(idbError(req, `FILE_DATA cursor failed for ${idbName}`));\n req.onsuccess = () => {\n const cursor = req.result;\n if (!cursor) return resolve(null);\n const key = typeof cursor.key === \"string\" ? cursor.key : \"\";\n if (key.endsWith(\"/PG_VERSION\")) {\n resolve(cursor.value as FileDataValue);\n } else {\n cursor.continue();\n }\n };\n });\n if (!value) return null;\n const bytes =\n value.contents instanceof Uint8Array\n ? value.contents\n : new Uint8Array(value.contents);\n const text = new TextDecoder().decode(bytes).trim();\n const major = parseInt(text, 10);\n return Number.isFinite(major) ? major : null;\n } finally {\n db.close();\n }\n}\n","import type * as CurrentPGliteModuleNs from \"@electric-sql/pglite\";\n\nexport const CURRENT_PG_MAJOR = 17;\nexport const SUPPORTED_PG_MAJORS = [16, 17] as const;\nexport type SupportedPgMajor = (typeof SUPPORTED_PG_MAJORS)[number];\nexport type DetectedMajor = SupportedPgMajor | null;\n\ntype CurrentPGliteModule = typeof CurrentPGliteModuleNs;\n\nexport function coerceMajor(value: number | null): DetectedMajor {\n if (value === null) return null;\n return (SUPPORTED_PG_MAJORS as readonly number[]).includes(value)\n ? (value as SupportedPgMajor)\n : null;\n}\n\nexport function isMigratableMajor(\n value: number | null,\n): value is SupportedPgMajor {\n const major = coerceMajor(value);\n return major !== null && major !== CURRENT_PG_MAJOR;\n}\n\n/**\n * Pick the PGlite major to use for *new* reactor clients: fall back to the\n * current version when there is no existing data dir.\n */\nexport function resolvePgMajorForRuntime(\n detected: DetectedMajor,\n): SupportedPgMajor {\n return detected ?? CURRENT_PG_MAJOR;\n}\n\n/**\n * Loads the PGlite module that matches an on-disk data dir major version.\n *\n * The 0.2.x and 0.3.x modules expose the same runtime interface (PGlite class,\n * `idb://` data-dir support, waitReady, exec/query/transaction, close). The\n * return type is pinned to the current package's module so callers can use it\n * against `kysely-pglite-dialect` which peer-depends on both majors.\n */\nexport async function loadPGliteModule(\n major: SupportedPgMajor,\n): Promise<CurrentPGliteModule> {\n if (major === 16) {\n return (await import(\"pglite-legacy-02\")) as unknown as CurrentPGliteModule;\n }\n if (major === 17) return import(\"@electric-sql/pglite\");\n throw new Error(`Unsupported PGlite major: ${String(major)}`);\n}\n\ntype PgDumpFn = (options: {\n pg: unknown;\n}) => Promise<{ text(): Promise<string> }>;\n\n/**\n * Loads the pg_dump tool for the given PGlite major. pg_dump's VFS layout is\n * version-specific, so using the wrong major against a live PGlite instance\n * fails with Emscripten ENOENT (errno 44).\n */\nexport async function loadPgDump(major: SupportedPgMajor): Promise<PgDumpFn> {\n if (major === 16) {\n const mod = (await import(\"pglite-tools-legacy-02/pg_dump\")) as {\n pgDump: PgDumpFn;\n };\n return mod.pgDump;\n }\n if (major === 17) {\n const mod = (await import(\"@electric-sql/pglite-tools/pg_dump\")) as {\n pgDump: PgDumpFn;\n };\n return mod.pgDump;\n }\n throw new Error(`Unsupported PGlite major: ${String(major)}`);\n}\n"],"names":[],"mappings":";;;;AAEA,MAAa,2BAA2B;AAGxC,IAAa,8BAAb,cAAiD,MAAM;CACrD,YAAY,OAAuC;EACjD,MAAM,QAAQ,MAAM,SACjB,KAAK,EAAE,UAAU,cAAc,GAAG,SAAS,GAAG,SAAS,CAAC,CACxD,KAAK,IAAI;EACZ,MACE,sBAAsB,MAAM,UAAU,4BAA4B,MAAM,yFAC1B,MAAM,uHACpD,EAAE,MAAM,CACV;EACA,KAAK,OAAO;CACd;AACF;;AAGA,SAAgB,yBAAyB,OAAyB;CAChE,OAAO,+BAA+B,QAAQ,KAAK,IAC/C,IAAI,4BAA4B,KAAK,IACrC;AACN;AAEA,SAAgB,yBAAyB,OAAgC;CACvE,OAAO,iBAAiB,SAAS,MAAM,SAAA;AACzC;;;AC5BA,MAAa,iBA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sCAAA,CAGf;CAEb,MAAM,IAAI,MAAM,6BAA6B,OAAO,KAAK,GAAG;AAC9D","debug_id":"bf83be21-3f86-55bd-ae14-c4aa466d5a81"}
@@ -1,12 +1,12 @@
1
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]="5602ae27-0e93-52ce-93a2-befe343f87dd")}catch(e){}}();
3
- import { c as idbError, l as openIdb, n as isMigratableMajor, o as IDB_STORE_NAME, s as createFileDataStore, u as readPgVersionFile } from "./pglite-major-B39aOEiE.js";
4
- import { PGlite } from "@electric-sql/pglite";
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]="406e9432-1e2d-544e-a5e2-46358ba484d3")}catch(e){}}();
3
+ import { c as idbError, l as openIdb, n as isMigratableMajor, o as IDB_STORE_NAME, s as createFileDataStore, u as readPgVersionFile } from "./pglite-major-p4_YefAE.js";
5
4
  //#region src/utils/pglite-migrate-core.ts
6
5
  const LEGACY_DUMPERS = { 16: async () => {
7
6
  const [{ PGlite: LegacyPGlite }, { pgDump }] = await Promise.all([import("pglite-legacy-02"), import("pglite-tools-legacy-02/pg_dump")]);
8
7
  return async (idbName) => {
9
- const pg = new LegacyPGlite(`idb://${idbName.replace(/^\/pglite\//, "")}`);
8
+ const stripped = idbName.replace(/^\/pglite\//, "");
9
+ const pg = new LegacyPGlite(`idb://${stripped}`);
10
10
  try {
11
11
  await pg.waitReady;
12
12
  return await (await pgDump({ pg })).text();
@@ -89,7 +89,9 @@ function logRestoreFailure(idbName, sql, err) {
89
89
  } else console.error(`[pglite-migration] No position info. First 2000 chars of dump:\n${sql.slice(0, 2e3)}`);
90
90
  }
91
91
  async function restoreDumpIntoIdb(idbName, sql) {
92
- const pg = new PGlite(`idb://${idbName.replace(/^\/pglite\//, "")}`, { relaxedDurability: false });
92
+ const stripped = idbName.replace(/^\/pglite\//, "");
93
+ const { PGlite } = await import("@electric-sql/pglite");
94
+ const pg = new PGlite(`idb://${stripped}`, { relaxedDurability: false });
93
95
  try {
94
96
  await pg.waitReady;
95
97
  try {
@@ -139,5 +141,5 @@ async function migrateIdb(idbName, publishPhase, backup) {
139
141
  //#endregion
140
142
  export { writeFileData as a, readFileData as i, cloneFileData as n, migrateIdb as r, clearFileData as t };
141
143
 
142
- //# sourceMappingURL=pglite-migrate-core-Boxqqx-c.js.map
143
- //# debugId=5602ae27-0e93-52ce-93a2-befe343f87dd
144
+ //# sourceMappingURL=pglite-migrate-core-DBlU6HIc.js.map
145
+ //# debugId=406e9432-1e2d-544e-a5e2-46358ba484d3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pglite-migrate-core-DBlU6HIc.js","sources":["../src/utils/pglite-migrate-core.ts"],"sourcesContent":["import {\n createFileDataStore,\n IDB_DB_VERSION,\n IDB_STORE_NAME,\n idbError,\n openIdb,\n readPgVersionFile,\n} from \"./pglite-idb.js\";\nimport { CURRENT_PG_MAJOR, isMigratableMajor } from \"./pglite-major.js\";\n\nexport type MigrationPhase = \"clone\" | \"dump\" | \"restore\";\n\nexport type FileDataValue = {\n contents: Uint8Array | number[];\n mode: number;\n timestamp: Date | number;\n};\n\nexport type FileDataEntry = { key: IDBValidKey; value: FileDataValue };\n\n// Snapshots a data dir before migration and restores/discards it after. The\n// flag-off path persists to an IDB backup (with retention); the worker keeps\n// the snapshot in memory for same-run rollback only.\nexport interface BackupStrategy {\n snapshot(idbName: string): Promise<unknown>;\n rollback(handle: unknown, idbName: string, cause: unknown): Promise<void>;\n discard(handle: unknown): Promise<void>;\n commit(handle: unknown): Promise<void>;\n}\n\ntype LegacyDumper = (idbName: string) => Promise<string>;\n\nconst LEGACY_DUMPERS: Partial<Record<number, () => Promise<LegacyDumper>>> = {\n 16: async () => {\n const [{ PGlite: LegacyPGlite }, { pgDump }] = await Promise.all([\n import(\"pglite-legacy-02\"),\n import(\"pglite-tools-legacy-02/pg_dump\"),\n ]);\n return async (idbName: string) => {\n const stripped = idbName.replace(/^\\/pglite\\//, \"\");\n const pg = new LegacyPGlite(`idb://${stripped}`);\n try {\n await pg.waitReady;\n const file = await pgDump({ pg });\n return await file.text();\n } finally {\n await pg.close();\n }\n };\n },\n};\n\nexport async function clearFileData(idbName: string): Promise<void> {\n const db = await openIdb(idbName, IDB_DB_VERSION, createFileDataStore);\n try {\n await new Promise<void>((resolve, reject) => {\n const tx = db.transaction(IDB_STORE_NAME, \"readwrite\");\n tx.oncomplete = () => resolve();\n tx.onerror = () =>\n reject(idbError(tx, `FILE_DATA clear failed for ${idbName}`));\n tx.onabort = () =>\n reject(idbError(tx, `FILE_DATA clear aborted for ${idbName}`));\n tx.objectStore(IDB_STORE_NAME).clear();\n });\n } finally {\n db.close();\n }\n}\n\nexport async function readFileData(idbName: string): Promise<FileDataEntry[]> {\n const db = await openIdb(idbName, IDB_DB_VERSION, createFileDataStore);\n try {\n return await new Promise<FileDataEntry[]>((resolve, reject) => {\n const out: FileDataEntry[] = [];\n const req = db\n .transaction(IDB_STORE_NAME, \"readonly\")\n .objectStore(IDB_STORE_NAME)\n .openCursor();\n req.onerror = () =>\n reject(idbError(req, `FILE_DATA read cursor failed for ${idbName}`));\n req.onsuccess = () => {\n const cursor = req.result;\n if (!cursor) return resolve(out);\n out.push({ key: cursor.key, value: cursor.value as FileDataValue });\n cursor.continue();\n };\n });\n } finally {\n db.close();\n }\n}\n\nexport async function writeFileData(\n idbName: string,\n entries: FileDataEntry[],\n): Promise<void> {\n const db = await openIdb(idbName, IDB_DB_VERSION, createFileDataStore);\n try {\n await new Promise<void>((resolve, reject) => {\n const tx = db.transaction(IDB_STORE_NAME, \"readwrite\");\n tx.oncomplete = () => resolve();\n tx.onerror = () =>\n reject(idbError(tx, `FILE_DATA write failed for ${idbName}`));\n tx.onabort = () =>\n reject(idbError(tx, `FILE_DATA write aborted for ${idbName}`));\n const store = tx.objectStore(IDB_STORE_NAME);\n store.clear();\n for (const { key, value } of entries) {\n store.put(value, key);\n }\n });\n } finally {\n db.close();\n }\n}\n\nexport async function cloneFileData(\n sourceName: string,\n destName: string,\n): Promise<void> {\n await writeFileData(destName, await readFileData(sourceName));\n}\n\nfunction logRestoreFailure(idbName: string, sql: string, err: unknown): void {\n const errObj = err as {\n message?: string;\n position?: string | number;\n severity?: string;\n code?: string;\n detail?: string;\n where?: string;\n };\n const position =\n typeof errObj.position === \"string\"\n ? parseInt(errObj.position, 10)\n : typeof errObj.position === \"number\"\n ? errObj.position\n : NaN;\n\n console.error(`[pglite-migration] Restore failed for ${idbName}`, {\n message: errObj.message,\n code: errObj.code,\n severity: errObj.severity,\n detail: errObj.detail,\n where: errObj.where,\n position: errObj.position,\n sqlLength: sql.length,\n });\n\n if (Number.isFinite(position) && position > 0) {\n const zeroBased = position - 1;\n const start = Math.max(0, zeroBased - 200);\n const end = Math.min(sql.length, zeroBased + 200);\n console.error(\n `[pglite-migration] SQL context around position ${position}:\\n${sql.slice(start, zeroBased)}»${sql.slice(zeroBased, zeroBased + 1)}«${sql.slice(zeroBased + 1, end)}`,\n );\n } else {\n console.error(\n `[pglite-migration] No position info. First 2000 chars of dump:\\n${sql.slice(0, 2000)}`,\n );\n }\n}\n\nasync function restoreDumpIntoIdb(idbName: string, sql: string): Promise<void> {\n const stripped = idbName.replace(/^\\/pglite\\//, \"\");\n // Dynamic: a static import puts PGlite (~350 KB) in the app-loader chunk.\n const { PGlite } = await import(\"@electric-sql/pglite\");\n const pg = new PGlite(`idb://${stripped}`, { relaxedDurability: false });\n try {\n await pg.waitReady;\n // PG16 pg_dump emits doubled backslashes (escape-string form) without the\n // matching SET; PG17 defaults standard_conforming_strings on, breaking JSONB.\n try {\n await pg.exec(\"SET standard_conforming_strings = off;\");\n } catch (gucErr) {\n console.warn(\n \"[pglite-migration] Could not force standard_conforming_strings=off\",\n gucErr,\n );\n }\n try {\n await pg.exec(sql);\n } catch (execErr) {\n logRestoreFailure(idbName, sql, execErr);\n throw execErr;\n }\n } finally {\n await pg.close();\n }\n}\n\nexport async function migrateIdb(\n idbName: string,\n publishPhase: (phase: MigrationPhase) => void,\n backup: BackupStrategy,\n): Promise<void> {\n const major = await readPgVersionFile(idbName);\n if (major === null || major === CURRENT_PG_MAJOR) return;\n\n if (!isMigratableMajor(major)) {\n console.warn(\n `[pglite-migration] Skipping ${idbName}: unsupported PG_VERSION=${major}; no migration path.`,\n );\n return;\n }\n\n const loader = LEGACY_DUMPERS[major];\n if (!loader) {\n throw new Error(\n `No legacy dumper for supported PG_VERSION=${major} (${idbName}); ` +\n `SUPPORTED_PG_MAJORS and LEGACY_DUMPERS are out of sync.`,\n );\n }\n\n publishPhase(\"clone\");\n const handle = await backup.snapshot(idbName);\n\n let sql: string;\n try {\n publishPhase(\"dump\");\n const dump = await loader();\n sql = await dump(idbName);\n } catch (err) {\n await backup.discard(handle);\n throw err;\n }\n\n try {\n await clearFileData(idbName);\n publishPhase(\"restore\");\n await restoreDumpIntoIdb(idbName, sql);\n } catch (err) {\n await backup.rollback(handle, idbName, err);\n throw err;\n }\n await backup.commit(handle);\n}\n"],"names":[],"mappings":";;;;AAgCA,MAAM,iBAAuE,EAC3E,IAAI,YAAY;CACd,MAAM,CAAC,EAAE,QAAQ,gBAAgB,EAAE,YAAY,MAAM,QAAQ,IAAI,CAC/D,OAAO,qBACP,OAAO,iCACT,CAAC;CACD,OAAO,OAAO,YAAoB;EAChC,MAAM,WAAW,QAAQ,QAAQ,eAAe,EAAE;EAClD,MAAM,KAAK,IAAI,aAAa,SAAS,UAAU;EAC/C,IAAI;GACF,MAAM,GAAG;GAET,OAAO,OAAM,MADM,OAAO,EAAE,GAAG,CAAC,EAAA,CACd,KAAK;EACzB,UAAU;GACR,MAAM,GAAG,MAAM;EACjB;CAC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F,MAAM,GAAG;EAGT,IAAI;GACF,MAAM,GAAG,KAAK,wCAAwC;EACxD,SAAS,QAAQ;GACf,QAAQ,KACN,sEACA,MACF;EACF;EACA,IAAI;GACF,MAAM,GAAG,KAAK,GAAG;EACnB,SAAS,SAAS;GAChB,kBAAkB,SAAS,KAAK,OAAO;GACvC,MAAM;EACR;CACF,UAAU;EACR,MAAM,GAAG,MAAM;CACjB;AACF;AAEA,eAAsB,WACpB,SACA,cACA,QACe;CACf,MAAM,QAAQ,MAAM,kBAAkB,OAAO;CAC7C,IAAI,UAAU,QAAQ,UAAA,IAA4B;CAElD,IAAI,CAAC,kBAAkB,KAAK,GAAG;EAC7B,QAAQ,KACN,+BAA+B,QAAQ,2BAA2B,MAAM,qBAC1E;EACA;CACF;CAEA,MAAM,SAAS,eAAe;CAC9B,IAAI,CAAC,QACH,MAAM,IAAI,MACR,6CAA6C,MAAM,IAAI,QAAQ,2DAEjE;CAGF,aAAa,OAAO;CACpB,MAAM,SAAS,MAAM,OAAO,SAAS,OAAO;CAE5C,IAAI;CACJ,IAAI;EACF,aAAa,MAAM;EAEnB,MAAM,OAAM,MADO,OAAO,EAAA,CACT,OAAO;CAC1B,SAAS,KAAK;EACZ,MAAM,OAAO,QAAQ,MAAM;EAC3B,MAAM;CACR;CAEA,IAAI;EACF,MAAM,cAAc,OAAO;EAC3B,aAAa,SAAS;EACtB,MAAM,mBAAmB,SAAS,GAAG;CACvC,SAAS,KAAK;EACZ,MAAM,OAAO,SAAS,QAAQ,SAAS,GAAG;EAC1C,MAAM;CACR;CACA,MAAM,OAAO,OAAO,MAAM;AAC5B","debug_id":"406e9432-1e2d-544e-a5e2-46358ba484d3"}
@@ -1,6 +1,6 @@
1
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]="80c44266-18c5-5681-aebc-58df7e206589")}catch(e){}}();
3
- import { l as invalidateReactorPgMajorCache, m as REACTOR_PGLITE_NAME } from "./connection-state-3w4liC1X.js";
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]="9086d4ee-d81d-56a9-af04-cea2fbf013a2")}catch(e){}}();
3
+ import { h as REACTOR_PGLITE_NAME, u as invalidateReactorPgMajorCache } from "./connection-state-B6fleM37.js";
4
4
  //#region src/utils/pglite-seed.ts
5
5
  const PENDING_PG_SEED_KEY = "ph:pending-pg-seed";
6
6
  /**
@@ -45,5 +45,5 @@ async function seedPendingPgVersion() {
45
45
  //#endregion
46
46
  export { seedPendingPgVersion as n, PENDING_PG_SEED_KEY as t };
47
47
 
48
- //# sourceMappingURL=pglite-seed-BqAUvNFw.js.map
49
- //# debugId=80c44266-18c5-5681-aebc-58df7e206589
48
+ //# sourceMappingURL=pglite-seed-eGzXMld2.js.map
49
+ //# debugId=9086d4ee-d81d-56a9-af04-cea2fbf013a2
@@ -1 +1 @@
1
- {"version":3,"file":"pglite-seed-BqAUvNFw.js","sources":["../src/utils/pglite-seed.ts"],"sourcesContent":["import { invalidateReactorPgMajorCache } from \"./pglite-runtime.js\";\nimport { REACTOR_PGLITE_NAME } from \"./storage-namespace.js\";\n\nexport const PENDING_PG_SEED_KEY = \"ph:pending-pg-seed\";\n\n/**\n * If the Debug Inspector requested a forced PG version reset, this runs\n * before the reactor is created on the subsequent page load: opens a fresh\n * PGlite of the requested major against the reactor data dir, lets `initdb`\n * populate `PG_VERSION`, then closes. The next step of app boot then\n * detects this fresh data dir and picks the matching runtime.\n */\nexport async function seedPendingPgVersion(): Promise<void> {\n const raw = localStorage.getItem(PENDING_PG_SEED_KEY);\n if (!raw) return;\n\n const major = parseInt(raw, 10);\n console.info(`[pglite-seed] Seeding fresh PG${major} data dir...`);\n\n try {\n if (major === 16) {\n const { PGlite } = await import(\"pglite-legacy-02\");\n const pg = new PGlite(`idb://${REACTOR_PGLITE_NAME}`);\n try {\n await pg.waitReady;\n } finally {\n await pg.close();\n }\n } else if (major === 17) {\n const { PGlite } = await import(\"@electric-sql/pglite\");\n const pg = new PGlite(`idb://${REACTOR_PGLITE_NAME}`);\n try {\n await pg.waitReady;\n } finally {\n await pg.close();\n }\n } else {\n console.warn(`[pglite-seed] Unsupported version ${raw}, skipping`);\n return;\n }\n console.info(`[pglite-seed] Seeded PG${major} data dir.`);\n } finally {\n localStorage.removeItem(PENDING_PG_SEED_KEY);\n invalidateReactorPgMajorCache();\n }\n}\n"],"names":[],"mappings":";;;;AAGA,MAAa,sBAAsB;;;;;;;;AASnC,eAAsB,uBAAsC;CAC1D,MAAM,MAAM,aAAa,QAAQ,oBAAoB;AACrD,KAAI,CAAC,IAAK;CAEV,MAAM,QAAQ,SAAS,KAAK,GAAG;AAC/B,SAAQ,KAAK,iCAAiC,MAAM,cAAc;AAElE,KAAI;AACF,MAAI,UAAU,IAAI;GAChB,MAAM,EAAE,WAAW,MAAM,OAAO;GAChC,MAAM,KAAK,IAAI,OAAO,SAAS,sBAAsB;AACrD,OAAI;AACF,UAAM,GAAG;aACD;AACR,UAAM,GAAG,OAAO;;aAET,UAAU,IAAI;GACvB,MAAM,EAAE,WAAW,MAAM,OAAO;GAChC,MAAM,KAAK,IAAI,OAAO,SAAS,sBAAsB;AACrD,OAAI;AACF,UAAM,GAAG;aACD;AACR,UAAM,GAAG,OAAO;;SAEb;AACL,WAAQ,KAAK,qCAAqC,IAAI,YAAY;AAClE;;AAEF,UAAQ,KAAK,0BAA0B,MAAM,YAAY;WACjD;AACR,eAAa,WAAW,oBAAoB;AAC5C,iCAA+B","debug_id":"80c44266-18c5-5681-aebc-58df7e206589"}
1
+ {"version":3,"file":"pglite-seed-eGzXMld2.js","sources":["../src/utils/pglite-seed.ts"],"sourcesContent":["import { invalidateReactorPgMajorCache } from \"./pglite-runtime.js\";\nimport { REACTOR_PGLITE_NAME } from \"./storage-namespace.js\";\n\nexport const PENDING_PG_SEED_KEY = \"ph:pending-pg-seed\";\n\n/**\n * If the Debug Inspector requested a forced PG version reset, this runs\n * before the reactor is created on the subsequent page load: opens a fresh\n * PGlite of the requested major against the reactor data dir, lets `initdb`\n * populate `PG_VERSION`, then closes. The next step of app boot then\n * detects this fresh data dir and picks the matching runtime.\n */\nexport async function seedPendingPgVersion(): Promise<void> {\n const raw = localStorage.getItem(PENDING_PG_SEED_KEY);\n if (!raw) return;\n\n const major = parseInt(raw, 10);\n console.info(`[pglite-seed] Seeding fresh PG${major} data dir...`);\n\n try {\n if (major === 16) {\n const { PGlite } = await import(\"pglite-legacy-02\");\n const pg = new PGlite(`idb://${REACTOR_PGLITE_NAME}`);\n try {\n await pg.waitReady;\n } finally {\n await pg.close();\n }\n } else if (major === 17) {\n const { PGlite } = await import(\"@electric-sql/pglite\");\n const pg = new PGlite(`idb://${REACTOR_PGLITE_NAME}`);\n try {\n await pg.waitReady;\n } finally {\n await pg.close();\n }\n } else {\n console.warn(`[pglite-seed] Unsupported version ${raw}, skipping`);\n return;\n }\n console.info(`[pglite-seed] Seeded PG${major} data dir.`);\n } finally {\n localStorage.removeItem(PENDING_PG_SEED_KEY);\n invalidateReactorPgMajorCache();\n }\n}\n"],"names":[],"mappings":";;;;AAGA,MAAa,sBAAsB;;;;;;;;AASnC,eAAsB,uBAAsC;CAC1D,MAAM,MAAM,aAAa,QAAQ,mBAAmB;CACpD,IAAI,CAAC,KAAK;CAEV,MAAM,QAAQ,SAAS,KAAK,EAAE;CAC9B,QAAQ,KAAK,iCAAiC,MAAM,aAAa;CAEjE,IAAI;EACF,IAAI,UAAU,IAAI;GAChB,MAAM,EAAE,WAAW,MAAM,OAAO;GAChC,MAAM,KAAK,IAAI,OAAO,SAAS,qBAAqB;GACpD,IAAI;IACF,MAAM,GAAG;GACX,UAAU;IACR,MAAM,GAAG,MAAM;GACjB;EACF,OAAO,IAAI,UAAU,IAAI;GACvB,MAAM,EAAE,WAAW,MAAM,OAAO;GAChC,MAAM,KAAK,IAAI,OAAO,SAAS,qBAAqB;GACpD,IAAI;IACF,MAAM,GAAG;GACX,UAAU;IACR,MAAM,GAAG,MAAM;GACjB;EACF,OAAO;GACL,QAAQ,KAAK,qCAAqC,IAAI,WAAW;GACjE;EACF;EACA,QAAQ,KAAK,0BAA0B,MAAM,WAAW;CAC1D,UAAU;EACR,aAAa,WAAW,mBAAmB;EAC3C,8BAA8B;CAChC;AACF","debug_id":"9086d4ee-d81d-56a9-af04-cea2fbf013a2"}
@@ -1 +1,2 @@
1
- export { };
1
+ export {}
2
+ export {};
@@ -1,12 +1,13 @@
1
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]="7e6b10c2-9669-557b-9d49-19e30e9e5241")}catch(e){}}();
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]="d41200c7-f359-5872-986a-21f333235e55")}catch(e){}}();
3
3
  import { IdbFs, PGlite } from "@electric-sql/pglite";
4
4
  import { live } from "@electric-sql/pglite/live";
5
5
  import { worker } from "@electric-sql/pglite/worker";
6
6
  import { DEFAULT_RELATIONAL_PROCESSOR_DB_NAME } from "@powerhousedao/shared/processors";
7
7
  //#region pglite.worker.ts
8
8
  worker({ init(options) {
9
- const idbFs = new IdbFs((options?.meta)?.dbName ?? DEFAULT_RELATIONAL_PROCESSOR_DB_NAME);
9
+ const dbName = (options?.meta)?.dbName ?? DEFAULT_RELATIONAL_PROCESSOR_DB_NAME;
10
+ const idbFs = new IdbFs(dbName);
10
11
  return Promise.resolve(new PGlite({
11
12
  fs: idbFs,
12
13
  relaxedDurability: true,
@@ -16,4 +17,4 @@ worker({ init(options) {
16
17
  //#endregion
17
18
 
18
19
  //# sourceMappingURL=pglite.worker.js.map
19
- //# debugId=7e6b10c2-9669-557b-9d49-19e30e9e5241
20
+ //# debugId=d41200c7-f359-5872-986a-21f333235e55
@@ -1 +1 @@
1
- {"version":3,"file":"pglite.worker.js","sources":["../pglite.worker.ts"],"sourcesContent":["import { IdbFs, PGlite } from \"@electric-sql/pglite\";\nimport { live } from \"@electric-sql/pglite/live\";\nimport { worker } from \"@electric-sql/pglite/worker\";\nimport { DEFAULT_RELATIONAL_PROCESSOR_DB_NAME } from \"@powerhousedao/shared/processors\";\n\nworker({\n init(options) {\n // dbName carries the origin-scoped storage namespace from the main thread.\n const dbName =\n (options?.meta as { dbName?: string } | undefined)?.dbName ??\n DEFAULT_RELATIONAL_PROCESSOR_DB_NAME;\n const idbFs = new IdbFs(dbName);\n return Promise.resolve(\n new PGlite({\n fs: idbFs,\n relaxedDurability: true,\n extensions: { live },\n }),\n );\n },\n}).catch(console.error);\n"],"names":[],"mappings":";;;;;;;AAKA,OAAO,EACL,KAAK,SAAS;CAKZ,MAAM,QAAQ,IAAI,OAFf,SAAS,OAA0C,UACpD,qCAC6B;AAC/B,QAAO,QAAQ,QACb,IAAI,OAAO;EACT,IAAI;EACJ,mBAAmB;EACnB,YAAY,EAAE,MAAM;EACrB,CAAC,CACH;GAEJ,CAAC,CAAC,MAAM,QAAQ,MAAM","debug_id":"7e6b10c2-9669-557b-9d49-19e30e9e5241"}
1
+ {"version":3,"file":"pglite.worker.js","sources":["../pglite.worker.ts"],"sourcesContent":["import { IdbFs, PGlite } from \"@electric-sql/pglite\";\nimport { live } from \"@electric-sql/pglite/live\";\nimport { worker } from \"@electric-sql/pglite/worker\";\nimport { DEFAULT_RELATIONAL_PROCESSOR_DB_NAME } from \"@powerhousedao/shared/processors\";\n\nworker({\n init(options) {\n // dbName carries the origin-scoped storage namespace from the main thread.\n const dbName =\n (options?.meta as { dbName?: string } | undefined)?.dbName ??\n DEFAULT_RELATIONAL_PROCESSOR_DB_NAME;\n const idbFs = new IdbFs(dbName);\n return Promise.resolve(\n new PGlite({\n fs: idbFs,\n relaxedDurability: true,\n extensions: { live },\n }),\n );\n },\n}).catch(console.error);\n"],"names":[],"mappings":";;;;;;;AAKA,OAAO,EACL,KAAK,SAAS;CAEZ,MAAM,UACH,SAAS,KAAA,EAA0C,UACpD;CACF,MAAM,QAAQ,IAAI,MAAM,MAAM;CAC9B,OAAO,QAAQ,QACb,IAAI,OAAO;EACT,IAAI;EACJ,mBAAmB;EACnB,YAAY,EAAE,KAAK;CACrB,CAAC,CACH;AACF,EACF,CAAC,CAAC,CAAC,MAAM,QAAQ,KAAK","debug_id":"d41200c7-f359-5872-986a-21f333235e55"}
@@ -1 +1,2 @@
1
- export { };
1
+ export {}
2
+ export {};
@@ -1,12 +1,13 @@
1
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]="b70dcd19-85a8-5811-af59-7dc14c24c386")}catch(e){}}();
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]="7d3ab944-b06a-5973-b3ff-073440f249b5")}catch(e){}}();
3
3
  import { DEFAULT_RELATIONAL_PROCESSOR_DB_NAME } from "@powerhousedao/shared/processors";
4
4
  import { IdbFs, PGlite } from "pglite-legacy-02";
5
5
  import { live } from "pglite-legacy-02/live";
6
6
  import { worker } from "pglite-legacy-02/worker";
7
7
  //#region pglite.worker.legacy.ts
8
8
  worker({ init(options) {
9
- const idbFs = new IdbFs((options?.meta)?.dbName ?? DEFAULT_RELATIONAL_PROCESSOR_DB_NAME);
9
+ const dbName = (options?.meta)?.dbName ?? DEFAULT_RELATIONAL_PROCESSOR_DB_NAME;
10
+ const idbFs = new IdbFs(dbName);
10
11
  return Promise.resolve(new PGlite({
11
12
  fs: idbFs,
12
13
  relaxedDurability: true,
@@ -16,4 +17,4 @@ worker({ init(options) {
16
17
  //#endregion
17
18
 
18
19
  //# sourceMappingURL=pglite.worker.legacy.js.map
19
- //# debugId=b70dcd19-85a8-5811-af59-7dc14c24c386
20
+ //# debugId=7d3ab944-b06a-5973-b3ff-073440f249b5
@@ -1 +1 @@
1
- {"version":3,"file":"pglite.worker.legacy.js","sources":["../pglite.worker.legacy.ts"],"sourcesContent":["import { IdbFs, PGlite } from \"pglite-legacy-02\";\nimport { live } from \"pglite-legacy-02/live\";\nimport { worker } from \"pglite-legacy-02/worker\";\nimport { DEFAULT_RELATIONAL_PROCESSOR_DB_NAME } from \"@powerhousedao/shared/processors\";\n\nworker({\n init(options) {\n // dbName carries the origin-scoped storage namespace from the main thread.\n const dbName =\n (options?.meta as { dbName?: string } | undefined)?.dbName ??\n DEFAULT_RELATIONAL_PROCESSOR_DB_NAME;\n const idbFs = new IdbFs(dbName);\n return Promise.resolve(\n new PGlite({\n fs: idbFs,\n relaxedDurability: true,\n extensions: { live },\n }),\n );\n },\n}).catch(console.error);\n"],"names":[],"mappings":";;;;;;;AAKA,OAAO,EACL,KAAK,SAAS;CAKZ,MAAM,QAAQ,IAAI,OAFf,SAAS,OAA0C,UACpD,qCAC6B;AAC/B,QAAO,QAAQ,QACb,IAAI,OAAO;EACT,IAAI;EACJ,mBAAmB;EACnB,YAAY,EAAE,MAAM;EACrB,CAAC,CACH;GAEJ,CAAC,CAAC,MAAM,QAAQ,MAAM","debug_id":"b70dcd19-85a8-5811-af59-7dc14c24c386"}
1
+ {"version":3,"file":"pglite.worker.legacy.js","sources":["../pglite.worker.legacy.ts"],"sourcesContent":["import { IdbFs, PGlite } from \"pglite-legacy-02\";\nimport { live } from \"pglite-legacy-02/live\";\nimport { worker } from \"pglite-legacy-02/worker\";\nimport { DEFAULT_RELATIONAL_PROCESSOR_DB_NAME } from \"@powerhousedao/shared/processors\";\n\nworker({\n init(options) {\n // dbName carries the origin-scoped storage namespace from the main thread.\n const dbName =\n (options?.meta as { dbName?: string } | undefined)?.dbName ??\n DEFAULT_RELATIONAL_PROCESSOR_DB_NAME;\n const idbFs = new IdbFs(dbName);\n return Promise.resolve(\n new PGlite({\n fs: idbFs,\n relaxedDurability: true,\n extensions: { live },\n }),\n );\n },\n}).catch(console.error);\n"],"names":[],"mappings":";;;;;;;AAKA,OAAO,EACL,KAAK,SAAS;CAEZ,MAAM,UACH,SAAS,KAAA,EAA0C,UACpD;CACF,MAAM,QAAQ,IAAI,MAAM,MAAM;CAC9B,OAAO,QAAQ,QACb,IAAI,OAAO;EACT,IAAI;EACJ,mBAAmB;EACnB,YAAY,EAAE,KAAK;CACrB,CAAC,CACH;AACF,EACF,CAAC,CAAC,CAAC,MAAM,QAAQ,KAAK","debug_id":"7d3ab944-b06a-5973-b3ff-073440f249b5"}
@@ -0,0 +1,246 @@
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]="12bba573-1829-54ba-93ff-88f5dd246cb5")}catch(e){}}();
3
+ import { DEFAULT_CONNECT_CONFIG } from "@powerhousedao/shared/connect";
4
+ import { z } from "zod";
5
+ //#region src/plugins/assistant.ts
6
+ /**
7
+ * The Connect AI assistant (`@powerhousedao/connect/plugins/assistant`).
8
+ * Presence flips `ai.assistantEnabled` on and merges the entry config
9
+ * (endpoint, agent, defaultOpen, …); absence forces it off. The assistant FAB
10
+ * in app.tsx already renders on `ai.assistantEnabled`, so this plugin's
11
+ * config shuffle is immediately visible in the UI.
12
+ */
13
+ const createAssistantPlugin = (config) => {
14
+ return {
15
+ name: "connect-assistant",
16
+ appliesTo: "connect",
17
+ hooks: { transformConnectConfig(served) {
18
+ return {
19
+ ...served,
20
+ ai: {
21
+ ...served.ai,
22
+ assistantEnabled: true,
23
+ ...config
24
+ }
25
+ };
26
+ } }
27
+ };
28
+ };
29
+ //#endregion
30
+ //#region src/plugins/generic.ts
31
+ /**
32
+ * The generic Connect shell plugin (`@powerhousedao/connect/plugins/generic`).
33
+ *
34
+ * It OWNS the drive-chrome UI toggles — `allowAddDrive` and the per-section
35
+ * `sections.{remote,local}` switches (enabled / allowAdd / allowDelete). These
36
+ * describe nothing outside the generic chrome (connect.config.ts reads them to
37
+ * decide whether the add-drive affordance and the drive sections render), so
38
+ * under uniform runners they are configured HERE, through this plugin's entry
39
+ * config, not as free-standing top-level connect.drives values:
40
+ *
41
+ * - present + entry provides a value -> that value
42
+ * - present + entry omits it -> inherit DEFAULT_CONNECT_CONFIG
43
+ * - absent from the composition -> zeroed off (see plugin-host's
44
+ * zeroAbsentSlices — no chrome, no
45
+ * toggles)
46
+ *
47
+ * The top-level served value is deliberately NOT a fallback: ownership means a
48
+ * single source. `branding` is intentionally NOT handled here — it has reach
49
+ * beyond the chrome (e.g. document.title), so it stays a Connect-level config
50
+ * value that survives this plugin's absence.
51
+ */
52
+ const sectionSchema = z.object({
53
+ enabled: z.boolean().optional(),
54
+ allowAdd: z.boolean().optional(),
55
+ allowDelete: z.boolean().optional()
56
+ }).optional();
57
+ const genericConfigSchema = z.object({
58
+ allowAddDrive: z.boolean().optional(),
59
+ sections: z.object({
60
+ remote: sectionSchema,
61
+ local: sectionSchema
62
+ }).optional()
63
+ }).partial();
64
+ const DEFAULT_DRIVES = DEFAULT_CONNECT_CONFIG.drives;
65
+ const createGenericPlugin = (rawConfig) => {
66
+ const config = genericConfigSchema.parse(rawConfig ?? {});
67
+ return {
68
+ name: "connect-generic",
69
+ appliesTo: "connect",
70
+ configSchema: genericConfigSchema,
71
+ hooks: { transformConnectConfig(served) {
72
+ const entrySections = config.sections ?? {};
73
+ return {
74
+ ...served,
75
+ drives: {
76
+ ...served.drives,
77
+ allowAddDrive: config.allowAddDrive ?? DEFAULT_DRIVES?.allowAddDrive,
78
+ sections: {
79
+ remote: {
80
+ ...DEFAULT_DRIVES?.sections?.remote,
81
+ ...entrySections.remote
82
+ },
83
+ local: {
84
+ ...DEFAULT_DRIVES?.sections?.local,
85
+ ...entrySections.local
86
+ }
87
+ }
88
+ }
89
+ };
90
+ } }
91
+ };
92
+ };
93
+ //#endregion
94
+ //#region src/plugins/openpanel.ts
95
+ /**
96
+ * OpenPanel analytics (`@powerhousedao/connect/plugins/openpanel`). Presence
97
+ * is activation: the entry config (clientId, trackUiEvents, trackOperations)
98
+ * merges into the served `openPanel` block; absence clears the clientId and
99
+ * turns tracking off. Config shuffle today; the Analytics/OpenPanel
100
+ * components that consume it already live in the app tree.
101
+ */
102
+ const createOpenPanelPlugin = (config) => {
103
+ return {
104
+ name: "connect-openpanel",
105
+ appliesTo: "connect",
106
+ hooks: { transformConnectConfig(served) {
107
+ return {
108
+ ...served,
109
+ openPanel: {
110
+ ...served.openPanel,
111
+ ...config
112
+ }
113
+ };
114
+ } }
115
+ };
116
+ };
117
+ //#endregion
118
+ //#region src/plugins/sentry.ts
119
+ /**
120
+ * Sentry error reporting (`@powerhousedao/connect/plugins/sentry`). Presence
121
+ * is activation: listing it merges the entry config (dsn, env, tracing) into
122
+ * the served `sentry` block; omitting it nulls the dsn (see the absence
123
+ * zeroing in plugin-host). A thin config shuffle today — the SentryProvider
124
+ * that reads this slice already exists in the app.
125
+ */
126
+ const createSentryPlugin = (config) => {
127
+ return {
128
+ name: "connect-sentry",
129
+ appliesTo: "connect",
130
+ hooks: { transformConnectConfig(served) {
131
+ return {
132
+ ...served,
133
+ sentry: {
134
+ ...served.sentry,
135
+ ...config
136
+ }
137
+ };
138
+ } }
139
+ };
140
+ };
141
+ //#endregion
142
+ //#region src/plugins/ids.ts
143
+ /** The generic shell: Connect's sidebar, home screen and settings tabs. */
144
+ const GENERIC_PLUGIN = "@powerhousedao/connect/plugins/generic";
145
+ //#endregion
146
+ //#region src/plugins/vetra-studio.ts
147
+ /**
148
+ * Vetra Studio, browser side (`@powerhousedao/vetra-studio/connect`). Its
149
+ * presence turns Connect's studio mode on; the classic `app.studioMode`
150
+ * consumer paths run unchanged, and absence forces studio off (the zeroing in
151
+ * plugin-host). Lives here, in Connect's own source, because the studio-mode
152
+ * behaviour is Connect browser behaviour — the published vetra-studio/connect
153
+ * module is only the server-resolvable identity of the same plugin.
154
+ */
155
+ const createVetraStudioPlugin = (config) => {
156
+ return {
157
+ name: "vetra-studio-connect",
158
+ appliesTo: "connect",
159
+ hooks: { transformConnectConfig(served) {
160
+ return {
161
+ ...served,
162
+ app: {
163
+ ...served.app,
164
+ studioMode: true,
165
+ ...config
166
+ }
167
+ };
168
+ } }
169
+ };
170
+ };
171
+ //#endregion
172
+ //#region src/plugins/index.ts
173
+ const ANALYTICS_CONSENT = { consent: true };
174
+ const driveSectionOff = {
175
+ enabled: false,
176
+ allowAdd: false,
177
+ allowDelete: false
178
+ };
179
+ /** Connect's built-in plugins, by the specifier a composition names. */
180
+ const connectPlugins = {
181
+ [GENERIC_PLUGIN]: {
182
+ create: createGenericPlugin,
183
+ ui: () => import("./ui-CwbE23ra.js").then((m) => m.default),
184
+ shell: "generic",
185
+ whenAbsent: (config) => ({
186
+ ...config,
187
+ drives: {
188
+ ...config.drives,
189
+ allowAddDrive: false,
190
+ sections: {
191
+ remote: driveSectionOff,
192
+ local: driveSectionOff
193
+ }
194
+ }
195
+ })
196
+ },
197
+ "@powerhousedao/connect/plugins/sentry": {
198
+ create: createSentryPlugin,
199
+ ui: () => Promise.resolve(ANALYTICS_CONSENT),
200
+ whenAbsent: (config) => ({
201
+ ...config,
202
+ sentry: {
203
+ ...config.sentry,
204
+ dsn: null
205
+ }
206
+ })
207
+ },
208
+ "@powerhousedao/connect/plugins/openpanel": {
209
+ create: createOpenPanelPlugin,
210
+ ui: () => Promise.resolve(ANALYTICS_CONSENT),
211
+ whenAbsent: (config) => ({
212
+ ...config,
213
+ openPanel: {
214
+ ...config.openPanel,
215
+ clientId: "",
216
+ trackUiEvents: false,
217
+ trackOperations: false
218
+ }
219
+ })
220
+ },
221
+ "@powerhousedao/connect/plugins/assistant": {
222
+ create: createAssistantPlugin,
223
+ whenAbsent: (config) => ({
224
+ ...config,
225
+ ai: {
226
+ ...config.ai,
227
+ assistantEnabled: false
228
+ }
229
+ })
230
+ },
231
+ "@powerhousedao/vetra-studio/connect": {
232
+ create: createVetraStudioPlugin,
233
+ whenAbsent: (config) => ({
234
+ ...config,
235
+ app: {
236
+ ...config.app,
237
+ studioMode: false
238
+ }
239
+ })
240
+ }
241
+ };
242
+ //#endregion
243
+ export { connectPlugins };
244
+
245
+ //# sourceMappingURL=plugins-CWbr0n_Q.js.map
246
+ //# debugId=12bba573-1829-54ba-93ff-88f5dd246cb5
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins-CWbr0n_Q.js","sources":["../src/plugins/assistant.ts","../src/plugins/generic.ts","../src/plugins/openpanel.ts","../src/plugins/sentry.ts","../src/plugins/ids.ts","../src/plugins/vetra-studio.ts","../src/plugins/index.ts"],"sourcesContent":["import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\n\n/**\n * The Connect AI assistant (`@powerhousedao/connect/plugins/assistant`).\n * Presence flips `ai.assistantEnabled` on and merges the entry config\n * (endpoint, agent, defaultOpen, …); absence forces it off. The assistant FAB\n * in app.tsx already renders on `ai.assistantEnabled`, so this plugin's\n * config shuffle is immediately visible in the UI.\n */\nexport const createAssistantPlugin: ConnectPluginFactory = (config) => {\n const plugin: ConnectPlugin = {\n name: \"connect-assistant\",\n appliesTo: \"connect\",\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n ai: { ...served.ai, assistantEnabled: true, ...config } as never,\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createAssistantPlugin;\n","import { DEFAULT_CONNECT_CONFIG } from \"@powerhousedao/shared/connect\";\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport { z } from \"zod\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\n\n/**\n * The generic Connect shell plugin (`@powerhousedao/connect/plugins/generic`).\n *\n * It OWNS the drive-chrome UI toggles — `allowAddDrive` and the per-section\n * `sections.{remote,local}` switches (enabled / allowAdd / allowDelete). These\n * describe nothing outside the generic chrome (connect.config.ts reads them to\n * decide whether the add-drive affordance and the drive sections render), so\n * under uniform runners they are configured HERE, through this plugin's entry\n * config, not as free-standing top-level connect.drives values:\n *\n * - present + entry provides a value -> that value\n * - present + entry omits it -> inherit DEFAULT_CONNECT_CONFIG\n * - absent from the composition -> zeroed off (see plugin-host's\n * zeroAbsentSlices — no chrome, no\n * toggles)\n *\n * The top-level served value is deliberately NOT a fallback: ownership means a\n * single source. `branding` is intentionally NOT handled here — it has reach\n * beyond the chrome (e.g. document.title), so it stays a Connect-level config\n * value that survives this plugin's absence.\n */\n\nconst sectionSchema = z\n .object({\n enabled: z.boolean().optional(),\n allowAdd: z.boolean().optional(),\n allowDelete: z.boolean().optional(),\n })\n .optional();\n\nconst genericConfigSchema = z\n .object({\n allowAddDrive: z.boolean().optional(),\n sections: z\n .object({ remote: sectionSchema, local: sectionSchema })\n .optional(),\n })\n .partial();\n\ntype GenericConfig = z.infer<typeof genericConfigSchema>;\n\nconst DEFAULT_DRIVES = DEFAULT_CONNECT_CONFIG.drives;\n\nexport const createGenericPlugin: ConnectPluginFactory = (rawConfig) => {\n const config = genericConfigSchema.parse(rawConfig ?? {}) as GenericConfig;\n const plugin: ConnectPlugin = {\n name: \"connect-generic\",\n appliesTo: \"connect\",\n configSchema: genericConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n const entrySections = config.sections ?? {};\n return {\n ...served,\n drives: {\n ...served.drives,\n // Owned: entry value, else the single-source default — never the\n // served top-level value.\n allowAddDrive:\n config.allowAddDrive ?? DEFAULT_DRIVES?.allowAddDrive,\n sections: {\n remote: {\n ...DEFAULT_DRIVES?.sections?.remote,\n ...entrySections.remote,\n },\n local: {\n ...DEFAULT_DRIVES?.sections?.local,\n ...entrySections.local,\n },\n },\n } as never,\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createGenericPlugin;\n","import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\n\n/**\n * OpenPanel analytics (`@powerhousedao/connect/plugins/openpanel`). Presence\n * is activation: the entry config (clientId, trackUiEvents, trackOperations)\n * merges into the served `openPanel` block; absence clears the clientId and\n * turns tracking off. Config shuffle today; the Analytics/OpenPanel\n * components that consume it already live in the app tree.\n */\nexport const createOpenPanelPlugin: ConnectPluginFactory = (config) => {\n const plugin: ConnectPlugin = {\n name: \"connect-openpanel\",\n appliesTo: \"connect\",\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n openPanel: { ...served.openPanel, ...config } as never,\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createOpenPanelPlugin;\n","import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\n\n/**\n * Sentry error reporting (`@powerhousedao/connect/plugins/sentry`). Presence\n * is activation: listing it merges the entry config (dsn, env, tracing) into\n * the served `sentry` block; omitting it nulls the dsn (see the absence\n * zeroing in plugin-host). A thin config shuffle today — the SentryProvider\n * that reads this slice already exists in the app.\n */\nexport const createSentryPlugin: ConnectPluginFactory = (config) => {\n const plugin: ConnectPlugin = {\n name: \"connect-sentry\",\n appliesTo: \"connect\",\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n sentry: { ...served.sentry, ...config } as never,\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createSentryPlugin;\n","/** The generic shell: Connect's sidebar, home screen and settings tabs. */\nexport const GENERIC_PLUGIN = \"@powerhousedao/connect/plugins/generic\";\n","import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\n\n/**\n * Vetra Studio, browser side (`@powerhousedao/vetra-studio/connect`). Its\n * presence turns Connect's studio mode on; the classic `app.studioMode`\n * consumer paths run unchanged, and absence forces studio off (the zeroing in\n * plugin-host). Lives here, in Connect's own source, because the studio-mode\n * behaviour is Connect browser behaviour — the published vetra-studio/connect\n * module is only the server-resolvable identity of the same plugin.\n */\nexport const createVetraStudioPlugin: ConnectPluginFactory = (config) => {\n const plugin: ConnectPlugin = {\n name: \"vetra-studio-connect\",\n appliesTo: \"connect\",\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n app: { ...served.app, studioMode: true, ...config } as never,\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createVetraStudioPlugin;\n","import type { ConnectPluginDefinition } from \"@powerhousedao/connect-core/plugins\";\nimport createAssistantPlugin from \"./assistant.js\";\nimport createGenericPlugin from \"./generic.js\";\nimport createOpenPanelPlugin from \"./openpanel.js\";\nimport createSentryPlugin from \"./sentry.js\";\nimport { GENERIC_PLUGIN } from \"./ids.js\";\nimport createVetraStudioPlugin from \"./vetra-studio.js\";\n\nexport { GENERIC_PLUGIN };\n\n// Sentry and OpenPanel start only once the viewer accepts analytics cookies.\nconst ANALYTICS_CONSENT = { consent: true };\n\n// Each built-in zeroes the config slice it owns when a composition leaves it out.\nconst driveSectionOff = { enabled: false, allowAdd: false, allowDelete: false };\n\n/** Connect's built-in plugins, by the specifier a composition names. */\nexport const connectPlugins: Record<string, ConnectPluginDefinition> = {\n [GENERIC_PLUGIN]: {\n create: createGenericPlugin,\n ui: () => import(\"../generic/ui.js\").then((m) => m.default),\n shell: \"generic\",\n // Branding is not zeroed: it is Connect-level and outlives the plugin.\n whenAbsent: (config) => ({\n ...config,\n drives: {\n ...config.drives,\n allowAddDrive: false,\n sections: { remote: driveSectionOff, local: driveSectionOff },\n } as never,\n }),\n },\n \"@powerhousedao/connect/plugins/sentry\": {\n create: createSentryPlugin,\n ui: () => Promise.resolve(ANALYTICS_CONSENT),\n whenAbsent: (config) => ({\n ...config,\n sentry: { ...config.sentry, dsn: null } as never,\n }),\n },\n \"@powerhousedao/connect/plugins/openpanel\": {\n create: createOpenPanelPlugin,\n ui: () => Promise.resolve(ANALYTICS_CONSENT),\n whenAbsent: (config) => ({\n ...config,\n openPanel: {\n ...config.openPanel,\n clientId: \"\",\n trackUiEvents: false,\n trackOperations: false,\n } as never,\n }),\n },\n \"@powerhousedao/connect/plugins/assistant\": {\n create: createAssistantPlugin,\n whenAbsent: (config) => ({\n ...config,\n ai: { ...config.ai, assistantEnabled: false } as never,\n }),\n },\n \"@powerhousedao/vetra-studio/connect\": {\n create: createVetraStudioPlugin,\n whenAbsent: (config) => ({\n ...config,\n app: { ...config.app, studioMode: false } as never,\n }),\n },\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAaA,MAAa,yBAA+C,WAAW;CAarE,OAAO;EAXL,MAAM;EACN,WAAW;EACX,OAAO,EACL,uBAAuB,QAAgC;GACrD,OAAO;IACL,GAAG;IACH,IAAI;KAAE,GAAG,OAAO;KAAI,kBAAkB;KAAM,GAAG;IAAO;GACxD;EACF,EACF;CAEU;AACd;;;;;;;;;;;;;;;;;;;;;;;;ACGA,MAAM,gBAAgB,EACnB,OAAO;CACN,SAAS,EAAE,QAAQ,CAAC,CAAC,SAAS;CAC9B,UAAU,EAAE,QAAQ,CAAC,CAAC,SAAS;CAC/B,aAAa,EAAE,QAAQ,CAAC,CAAC,SAAS;AACpC,CAAC,C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ACL,GAAG;IACH,KAAK;KAAE,GAAG,OAAO;KAAK,YAAY;KAAM,GAAG;IAAO;GACpD;EACF,EACF;CAEU;AACd;;;ACjBA,MAAM,oBAAoB,EAAE,SAAS,KAAK;AAG1C,MAAM,kBAAkB;CAAE,SAAS;CAAO,UAAU;CAAO,aAAa;AAAM;;AAG9E,MAAa,iBAA0D;EACpE,iBAAiB;EAChB,QAAQ;EACR,UAAU,OAAO,mBAAmB,CAAC,MAAM,MAAM,EAAE,OAAO;EAC1D,OAAO;EAEP,aAAa,YAAY;GACvB,GAAG;GACH,QAAQ;IACN,GAAG,OAAO;IACV,eAAe;IACf,UAAU;KAAE,QAAQ;KAAiB,OAAO;IAAgB;GAC9D;EACF;CACF;CACA,yCAAyC;EACvC,QAAQ;EACR,UAAU,QAAQ,QAAQ,iBAAiB;EAC3C,aAAa,YAAY;GACvB,GAAG;GACH,QAAQ;IAAE,GAAG,OAAO;IAAQ,KAAK;GAAK;EACxC;CACF;CACA,4CAA4C;EAC1C,QAAQ;EACR,UAAU,QAAQ,QAAQ,iBAAiB;EAC3C,aAAa,YAAY;GACvB,GAAG;GACH,WAAW;IACT,GAAG,OAAO;IACV,UAAU;IACV,eAAe;IACf,iBAAiB;GACnB;EACF;CACF;CACA,4CAA4C;EAC1C,QAAQ;EACR,aAAa,YAAY;GACvB,GAAG;GACH,IAAI;IAAE,GAAG,OAAO;IAAI,kBAAkB;GAAM;EAC9C;CACF;CACA,uCAAuC;EACrC,QAAQ;EACR,aAAa,YAAY;GACvB,GAAG;GACH,KAAK;IAAE,GAAG,OAAO;IAAK,YAAY;GAAM;EAC1C;CACF;AACF","debug_id":"12bba573-1829-54ba-93ff-88f5dd246cb5"}
@@ -1,27 +1,8 @@
1
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]="dbbeb3d8-22d7-5df6-a263-a0c970e9578b")}catch(e){}}();
3
- import { r as connectConfig } from "./connect.config-DaHDEUrw.js";
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]="d7f96eb0-7292-5f81-9659-4f2579d46dd3")}catch(e){}}();
3
+ import { r as connectConfig } from "./connect.config-D1pGNmaF.js";
4
4
  import { useSyncExternalStore } from "react";
5
- //#region src/hooks/useIsEmbedded.ts
6
- /**
7
- * Detects whether Connect is being rendered inside another app (e.g. inside
8
- * an iframe in the vetra-cli drive editor). When `?embed=1` is present in the
9
- * URL, chrome that doesn't make sense in the embedded context — the cookie
10
- * banner, the outer sidebar — is suppressed.
11
- */
12
- function getIsEmbedded() {
13
- if (typeof window === "undefined") return false;
14
- try {
15
- const value = new URLSearchParams(window.location.search).get("embed");
16
- return value !== null && value !== "0" && value !== "false";
17
- } catch {
18
- return false;
19
- }
20
- }
21
- function useIsEmbedded() {
22
- return getIsEmbedded();
23
- }
24
- //#endregion
5
+ import { getIsEmbedded } from "@powerhousedao/connect-core/embedded";
25
6
  //#region src/hooks/preferences-store.ts
26
7
  const namespace = connectConfig.routerBasename;
27
8
  /**
@@ -98,7 +79,7 @@ const useCookieBanner = () => {
98
79
  return [useSyncExternalStore(subscribeBannerShown, getBannerShown, getBannerShown), setBannerShown];
99
80
  };
100
81
  //#endregion
101
- export { useIsEmbedded as i, useCookieBanner as n, getIsEmbedded as r, useAcceptedCookies as t };
82
+ export { useAcceptedCookies as n, useCookieBanner as r, setBannerShown as t };
102
83
 
103
- //# sourceMappingURL=preferences-store-_5Cw4_YV.js.map
104
- //# debugId=dbbeb3d8-22d7-5df6-a263-a0c970e9578b
84
+ //# sourceMappingURL=preferences-store-CSqauT9V.js.map
85
+ //# debugId=d7f96eb0-7292-5f81-9659-4f2579d46dd3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preferences-store-CSqauT9V.js","sources":["../src/hooks/preferences-store.ts"],"sourcesContent":["import { connectConfig } from \"@powerhousedao/connect/config\";\nimport { useSyncExternalStore } from \"react\";\n\nimport { getIsEmbedded } from \"@powerhousedao/connect-core/embedded\";\n\nconst namespace = connectConfig.routerBasename;\n\n/**\n * Block-proof home for Connect's consent and banner state.\n *\n * The file name deliberately avoids words that appear in ad-blocker\n * filter lists (cookie, banner, consent, analytics, ...). Modules in the\n * app's critical import chain import from here, never from files whose\n * URLs match those filters. If an ad blocker blocks the lazy-loaded\n * cookie-banner chunk instead, the app simply never shows the banner —\n * which leaves the flags at their rejected defaults (analytics off) —\n * and everything else keeps working.\n */\n\n// ---------------------------------------------------------------------------\n// Accepted cookies (analytics / marketing / functional)\n// ---------------------------------------------------------------------------\n\nexport const ACCEPTED_COOKIES_KEY_STORAGE = `${namespace}:acceptedCookies`;\n\nexport interface AcceptedCookies {\n analytics: boolean;\n marketing: boolean;\n functional: boolean;\n}\n\nconst REJECTED_COOKIES: AcceptedCookies = {\n analytics: false,\n marketing: false,\n functional: false,\n};\n\nconst cookieListeners = new Set<() => void>();\n\nlet acceptedCookies: AcceptedCookies = getInitialAcceptedCookies();\n\nfunction getInitialAcceptedCookies(): AcceptedCookies {\n try {\n const value = localStorage.getItem(ACCEPTED_COOKIES_KEY_STORAGE);\n return value ? (JSON.parse(value) as AcceptedCookies) : REJECTED_COOKIES;\n } catch {\n return REJECTED_COOKIES;\n }\n}\n\nfunction subscribeAcceptedCookies(fn: () => void) {\n cookieListeners.add(fn);\n return () => {\n cookieListeners.delete(fn);\n };\n}\n\nfunction getAcceptedCookies(): AcceptedCookies {\n return acceptedCookies;\n}\n\nexport function setAcceptedCookies(\n setter: (prev: AcceptedCookies) => AcceptedCookies,\n) {\n acceptedCookies = setter(acceptedCookies);\n localStorage.setItem(\n ACCEPTED_COOKIES_KEY_STORAGE,\n JSON.stringify(acceptedCookies),\n );\n cookieListeners.forEach((fn) => fn());\n}\n\nexport const useAcceptedCookies = () => {\n const cookies = useSyncExternalStore(\n subscribeAcceptedCookies,\n getAcceptedCookies,\n getAcceptedCookies,\n );\n return [cookies, setAcceptedCookies] as const;\n};\n\n// ---------------------------------------------------------------------------\n// Cookie banner visibility\n// ---------------------------------------------------------------------------\n\nexport const COOKIE_BANNER_KEY_STORAGE = `${namespace}:display-cookie-banner`;\n\nconst bannerListeners = new Set<() => void>();\n\nlet bannerShown = getInitialBannerShown();\n\nfunction getInitialBannerShown(): boolean {\n if (getIsEmbedded()) return false;\n try {\n const value = localStorage.getItem(COOKIE_BANNER_KEY_STORAGE);\n return value !== \"false\";\n } catch (error) {\n console.error(error);\n return true;\n }\n}\n\nfunction subscribeBannerShown(fn: () => void) {\n bannerListeners.add(fn);\n return () => {\n bannerListeners.delete(fn);\n };\n}\n\nfunction getBannerShown(): boolean {\n return bannerShown;\n}\n\nexport function setBannerShown(state: boolean) {\n bannerShown = state;\n localStorage.setItem(COOKIE_BANNER_KEY_STORAGE, JSON.stringify(state));\n bannerListeners.forEach((fn) => fn());\n}\n\nexport const useCookieBanner = () => {\n const shown = useSyncExternalStore(\n subscribeBannerShown,\n getBannerShown,\n getBannerShown,\n );\n return [shown, setBannerShown] as const;\n};\n"],"names":[],"mappings":";;;;;;AAKA,MAAM,YAAY,cAAc;;;;;;;;;;;;AAkBhC,MAAa,+BAA+B,GAAG,UAAU;AAQzD,MAAM,mBAAoC;CACxC,WAAW;CACX,WAAW;CACX,YAAY;AACd;AAEA,MAAM,kCAAkB,IAAI,IAAgB;AAE5C,IAAI,kBAAmC,0BAA0B;AAEjE,SAAS,4BAA6C;CACpD,IAAI;EACF,MAAM,QAAQ,aAAa,QAAQ,4BAA4B;EAC/D,OAAO,QAAS,KAAK,MAAM,KAAK,IAAwB;CAC1D,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,yBAAyB,IAAgB;CAChD,gBAAgB,IAAI,EAAE;CACtB,aAAa;EACX,gBAAgB,OAAO,EAAE;CAC3B;AACF;AAEA,SAAS,qBAAsC;CAC7C,OAAO;AACT;AAEA,SAAgB,mBACd,QACA;CACA,kBAAkB,OAAO,eAAe;CACxC,aAAa,QACX,8BACA,KAAK,UAAU,eAAe,CAChC;CACA,gBAAgB,SAAS,OAAO,GAAG,CAAC;AACtC;AAEA,MAAa,2BAA2B;CAMtC,OAAO,CALS,qBACd,0BACA,oBACA,kBAEY,GAAG,kBAAkB;AACrC;AAMA,MAAa,4BAA4B,GAAG,UAAU;AAEtD,MAAM,kCAAkB,IAAI,IAAgB;AAE5C,IAAI,cAAc,sBAAsB;AAExC,SAAS,wBAAiC;CACxC,IAAI,cAAc,GAAG,OAAO;CAC5B,IAAI;EAEF,OADc,aAAa,QAAQ,yBACxB,MAAM;CACnB,SAAS,OAAO;EACd,QAAQ,MAAM,KAAK;EACnB,OAAO;CACT;AACF;AAEA,SAAS,qBAAqB,IAAgB;CAC5C,gBAAgB,IAAI,EAAE;CACtB,aAAa;EACX,gBAAgB,OAAO,EAAE;CAC3B;AACF;AAEA,SAAS,iBAA0B;CACjC,OAAO;AACT;AAEA,SAAgB,eAAe,OAAgB;CAC7C,cAAc;CACd,aAAa,QAAQ,2BAA2B,KAAK,UAAU,KAAK,CAAC;CACrE,gBAAgB,SAAS,OAAO,GAAG,CAAC;AACtC;AAEA,MAAa,wBAAwB;CAMnC,OAAO,CALO,qBACZ,sBACA,gBACA,cAEU,GAAG,cAAc;AAC/B","debug_id":"d7f96eb0-7292-5f81-9659-4f2579d46dd3"}
@@ -0,0 +1,38 @@
1
+ //#region src/prerender/app-shell.d.ts
2
+ /** `generic`: Connect's chrome. `core`: core's views. `project`: a project's routes. */
3
+ type AppShellKind = "generic" | "core" | "project";
4
+ /** Rendered where the app's name goes. */
5
+ export declare const APP_NAME_TOKEN = "__PH_SHELL_APP_NAME__";
6
+ /** The rendered shell as #root's static markup: no scripts or title, images as
7
+ * boxes, the app's name delimited. */
8
+ export declare function shellMarkup(rendered: string): string;
9
+ /** #root's markup and <head>'s critical CSS (`css`, see shellCss) and guard.
10
+ * `variant` names it for a server that swaps it. */
11
+ export declare function appShell(kind: AppShellKind, variant: "generic" | "core", markup: string, css: string): {
12
+ body: string;
13
+ head: string;
14
+ };
15
+ //#endregion
16
+ //#region src/prerender/shell-css.d.ts
17
+ /** `entry`, a Tailwind stylesheet (its text `css` when given), built for the
18
+ * classes in `markup` only: its tokens, reset and rules, without third-party CSS. */
19
+ export declare function shellCss(entry: string, markup: string, css?: string): Promise<string>;
20
+ //#endregion
21
+ //#region src/prerender/shell.d.ts
22
+ /** Each prerendered shell's plugin, whose presence in a composition picks it; core's has none. */
23
+ export declare function shellPlugins(): Promise<Partial<Record<ShellVariant, string>>>;
24
+ /** `generic`: Connect's chrome. `core`: core's views, for a composition without the generic plugin. */
25
+ export type ShellVariant = "generic" | "core";
26
+ /** Renders the route tree at `/` before the reactor is up. `kind` picks the
27
+ * loader: Connect's logo for its chrome, core's spinner otherwise. */
28
+ export declare function renderShell(variant?: ShellVariant, kind?: AppShellKind): Promise<string>;
29
+ /** A project's shells, one per variant: its route tree rendered at `/`, with
30
+ * CSS that `stylesheet`, its Tailwind entry (text `css`), builds for the markup's classes. */
31
+ export declare function renderProjectShells(stylesheet: string, css?: string): Promise<Partial<Record<ShellVariant, {
32
+ body: string;
33
+ head: string;
34
+ }>>>;
35
+ //#endregion
36
+ export type { AppShellKind };
37
+ export {};
38
+ //# sourceMappingURL=prerender.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prerender.d.ts","names":[],"sources":["../src/prerender/app-shell.ts","../src/prerender/shell-css.ts","../src/prerender/shell.tsx"],"mappings":";;KAMY;;qBAGC;;;wBA8DG,YAAY;;;wBAYZ,SACd,MAAM,cACN,6BACA,gBACA;EAME;EAGA;;;;;;wBCnEkB,SACpB,eACA,gBACA,eAAiC;;;;wBCUb,gBAAgB,QACpC,QAAQ,OAAO;;YAUL;;;wBAMU,YACpB,UAAS,cACT,OAAM,eACL;;;wBA4DmB,oBAAoB,oBAAoB,eAAY,QAAA,QAAA,OAAA;EACrB;EAAc"}