@powerhousedao/connect 6.2.3-dev.8 → 6.2.3-dev.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -1
- package/dist/{AddDriveModal-xAw48kdl.js → AddDriveModal-CFi-9FQU.js} +28 -15
- package/dist/AddDriveModal-CFi-9FQU.js.map +1 -0
- package/dist/{ClearStorageModal-BAqs4G2s.js → ClearStorageModal-CGlJXcv8.js} +11 -13
- package/dist/ClearStorageModal-CGlJXcv8.js.map +1 -0
- package/dist/{ConfirmDocumentUpgradeModal-FUOhZsk7.js → ConfirmDocumentUpgradeModal-CoixS60F.js} +9 -8
- package/dist/ConfirmDocumentUpgradeModal-CoixS60F.js.map +1 -0
- package/dist/{CookiesPolicyModal-BpyPPyxS.js → CookiesPolicyModal-BpFjYc7T.js} +5 -5
- package/dist/{CookiesPolicyModal-BpyPPyxS.js.map → CookiesPolicyModal-BpFjYc7T.js.map} +1 -1
- package/dist/CreateDocumentModal-CiIW3pzx.js +45 -0
- package/dist/CreateDocumentModal-CiIW3pzx.js.map +1 -0
- package/dist/{DebugSettingsModal-rV_v0F0d.js → DebugSettingsModal-rV53_oRL.js} +9 -9
- package/dist/DebugSettingsModal-rV53_oRL.js.map +1 -0
- package/dist/{DeleteDriveModal-Dug84t1j.js → DeleteDriveModal-1pAIayG_.js} +7 -7
- package/dist/DeleteDriveModal-1pAIayG_.js.map +1 -0
- package/dist/{DeleteItemModal-mMzy3V8o.js → DeleteItemModal-BUpqmFxS.js} +8 -8
- package/dist/DeleteItemModal-BUpqmFxS.js.map +1 -0
- package/dist/{DisclaimerModal-DvpD5dPM.js → DisclaimerModal-TIJXRYLF.js} +7 -7
- package/dist/DisclaimerModal-TIJXRYLF.js.map +1 -0
- package/dist/{DocumentVersionUnsupportedModal-C3Q0V75l.js → DocumentVersionUnsupportedModal-DH9Zzsyw.js} +6 -6
- package/dist/DocumentVersionUnsupportedModal-DH9Zzsyw.js.map +1 -0
- package/dist/{DownloadDocumentWithErrorsModal-IKl0ljQb.js → DownloadDocumentWithErrorsModal-Beh-xw8B.js} +8 -7
- package/dist/DownloadDocumentWithErrorsModal-Beh-xw8B.js.map +1 -0
- package/dist/{DriveAuthRequiredModal-DVK7ZQzO.js → DriveAuthRequiredModal-XTcoJKvj.js} +7 -7
- package/dist/DriveAuthRequiredModal-XTcoJKvj.js.map +1 -0
- package/dist/{DriveSettingsModal-C6-mRQiv.js → DriveSettingsModal-DZKawN7w.js} +6 -6
- package/dist/DriveSettingsModal-DZKawN7w.js.map +1 -0
- package/dist/FloatingTanStackRouterDevtools-CqogiFob-dxj8lrTP.js +2565 -0
- package/dist/FloatingTanStackRouterDevtools-CqogiFob-dxj8lrTP.js.map +1 -0
- package/dist/{InspectorModal-CpEhVnM6.js → InspectorModal-B1lPkiWJ.js} +70 -30
- package/dist/InspectorModal-B1lPkiWJ.js.map +1 -0
- package/dist/{LoginModal-CybbOm3N.js → LoginModal-O06ZvWFI.js} +8 -8
- package/dist/LoginModal-O06ZvWFI.js.map +1 -0
- package/dist/{OpenFileDocumentsModal-BW3ZFRDR.js → OpenFileDocumentsModal-DJsC1oR1.js} +22 -16
- package/dist/OpenFileDocumentsModal-DJsC1oR1.js.map +1 -0
- package/dist/{UpgradeDriveModal-_8t9slxQ.js → UpgradeDriveModal-CCWKp5yn.js} +7 -7
- package/dist/UpgradeDriveModal-CCWKp5yn.js.map +1 -0
- package/dist/app-loader-CMAa5mfx.js +1254 -0
- package/dist/app-loader-CMAa5mfx.js.map +1 -0
- package/dist/app-loader-CQsvtwUk.js +4 -0
- package/dist/app-skeleton-CMUP2zaz.js +132 -0
- package/dist/app-skeleton-CMUP2zaz.js.map +1 -0
- package/dist/app-skeleton-CdD1m8G3.js +4 -0
- package/dist/boot-DACMlLYH.js +233 -0
- package/dist/boot-DACMlLYH.js.map +1 -0
- package/dist/buffer-DNTcuap_.js +66 -0
- package/dist/buffer-DNTcuap_.js.map +1 -0
- package/dist/{build-info-D1h45Bga.js → build-info-DTbDwLqz.js} +10 -6
- package/dist/build-info-DTbDwLqz.js.map +1 -0
- package/dist/components-CPNWirU8.js +121 -0
- package/dist/components-CPNWirU8.js.map +1 -0
- package/dist/{connect.config-DaHDEUrw.js → connect.config-DL9nKtlW.js} +28 -15
- package/dist/connect.config-DL9nKtlW.js.map +1 -0
- package/dist/{connection-state-3w4liC1X.js → connection-state-Bwm9Agwy.js} +20 -9
- package/dist/connection-state-Bwm9Agwy.js.map +1 -0
- package/dist/context-De2EB1AA-Ni0d829Q.js +1759 -0
- package/dist/context-De2EB1AA-Ni0d829Q.js.map +1 -0
- package/dist/{cookie-banner-BH6bIq24.js → cookie-banner-NclLYtB0.js} +7 -7
- package/dist/{cookie-banner-BH6bIq24.js.map → cookie-banner-NclLYtB0.js.map} +1 -1
- package/dist/document-editor-container-CGLXOl0t.js +4 -0
- package/dist/document-editor-container-FNIEsf8H.js +310 -0
- package/dist/document-editor-container-FNIEsf8H.js.map +1 -0
- package/dist/drive-icon-BIpd8edR.js +49 -0
- package/dist/drive-icon-BIpd8edR.js.map +1 -0
- package/dist/error-boundary-BsUBww61.js +155 -0
- package/dist/error-boundary-BsUBww61.js.map +1 -0
- package/dist/esm-BDACZntJ.js +148 -0
- package/dist/esm-BDACZntJ.js.map +1 -0
- package/dist/generic.d.ts +140 -0
- package/dist/generic.d.ts.map +1 -0
- package/dist/generic.js +31 -0
- package/dist/generic.js.map +1 -0
- package/dist/{i18n-CWO0vYVd.js → i18n-D9WYPgk9.js} +4 -4
- package/dist/{i18n-CWO0vYVd.js.map → i18n-D9WYPgk9.js.map} +1 -1
- package/dist/index-D7c2WAbn.d.ts +4 -0
- package/dist/layout-Dj3_KscE.js +5 -0
- package/dist/layout.d.ts +3 -0
- package/dist/layout.js +4 -0
- package/dist/{load-B0xIT-MF.js → load-BhsJ7dwk.js} +48 -46
- package/dist/load-BhsJ7dwk.js.map +1 -0
- package/dist/load-runtime-config-DXr-ugHq.js +14 -0
- package/dist/load-runtime-config-DXr-ugHq.js.map +1 -0
- package/dist/main.d.ts +2 -1
- package/dist/main.js +8 -8
- package/dist/main.js.map +1 -1
- package/dist/open-file-uploads-B5pr1sA2.js +183 -0
- package/dist/open-file-uploads-B5pr1sA2.js.map +1 -0
- package/dist/package-manager-DOP3hl5_.js +543 -0
- package/dist/package-manager-DOP3hl5_.js.map +1 -0
- package/dist/{pglite-major-B39aOEiE.js → pglite-major-p4_YefAE.js} +23 -5
- package/dist/pglite-major-p4_YefAE.js.map +1 -0
- package/dist/{pglite-migrate-core-Boxqqx-c.js → pglite-migrate-core-DBlU6HIc.js} +9 -7
- package/dist/pglite-migrate-core-DBlU6HIc.js.map +1 -0
- package/dist/{pglite-seed-BqAUvNFw.js → pglite-seed-QPbGbLB_.js} +4 -4
- package/dist/{pglite-seed-BqAUvNFw.js.map → pglite-seed-QPbGbLB_.js.map} +1 -1
- package/dist/pglite.worker.d.ts +2 -1
- package/dist/pglite.worker.js +4 -3
- package/dist/pglite.worker.js.map +1 -1
- package/dist/pglite.worker.legacy.d.ts +2 -1
- package/dist/pglite.worker.legacy.js +4 -3
- package/dist/pglite.worker.legacy.js.map +1 -1
- package/dist/plugin-configs.d.ts +242 -0
- package/dist/plugin-configs.d.ts.map +1 -0
- package/dist/plugin-configs.js +26 -0
- package/dist/plugin-configs.js.map +1 -0
- package/dist/plugins-bj4VTT8Q.js +264 -0
- package/dist/plugins-bj4VTT8Q.js.map +1 -0
- package/dist/{preferences-store-_5Cw4_YV.js → preferences-store-DxYAnGCc.js} +6 -25
- package/dist/preferences-store-DxYAnGCc.js.map +1 -0
- package/dist/prerender.d.ts +38 -0
- package/dist/prerender.d.ts.map +1 -0
- package/dist/prerender.js +195 -0
- package/dist/prerender.js.map +1 -0
- package/dist/prerendered-shell-peKE7AqI.js +51 -0
- package/dist/prerendered-shell-peKE7AqI.js.map +1 -0
- package/dist/{pwa-manifest-link-DIgOSo2Q.js → pwa-manifest-link-DQRJpF0r.js} +3 -3
- package/dist/{pwa-manifest-link-DIgOSo2Q.js.map → pwa-manifest-link-DQRJpF0r.js.map} +1 -1
- package/dist/{reactor-B6xhZK1N.js → reactor-BZZsohdi.js} +565 -567
- package/dist/reactor-BZZsohdi.js.map +1 -0
- package/dist/reactor-chat-BwR9R1ah.js +46 -0
- package/dist/reactor-chat-BwR9R1ah.js.map +1 -0
- package/dist/reactor.worker.d.ts +2 -1
- package/dist/reactor.worker.js +478 -158
- package/dist/reactor.worker.js.map +1 -1
- package/dist/{registerServiceWorker-BSzbNfvz.js → registerServiceWorker-X6fT91iL.js} +5 -5
- package/dist/{registerServiceWorker-BSzbNfvz.js.map → registerServiceWorker-X6fT91iL.js.map} +1 -1
- package/dist/root-v9fj27sn.js +27 -0
- package/dist/root-v9fj27sn.js.map +1 -0
- package/dist/route-tree.d.ts +2220 -0
- package/dist/route-tree.d.ts.map +1 -0
- package/dist/route-tree.js +135 -0
- package/dist/route-tree.js.map +1 -0
- package/dist/route-views-BovMNHyn.js +60 -0
- package/dist/route-views-BovMNHyn.js.map +1 -0
- package/dist/route-views-C-H3ofJW.js +4 -0
- package/dist/route-views-DzgRMAx8.js +55 -0
- package/dist/route-views-DzgRMAx8.js.map +1 -0
- package/dist/route-views.d.ts +7 -0
- package/dist/route-views.d.ts.map +1 -0
- package/dist/route-views.js +4 -0
- package/dist/router-CWIsjETx.js +54 -0
- package/dist/router-CWIsjETx.js.map +1 -0
- package/dist/router-CnWkTEey.js +4 -0
- package/dist/router.d.ts +2 -0
- package/dist/router.js +3 -0
- package/dist/sentry-Cuc_Nbba.js +22 -0
- package/dist/sentry-Cuc_Nbba.js.map +1 -0
- package/dist/settings-BIrAGDtS.js +1089 -0
- package/dist/settings-BIrAGDtS.js.map +1 -0
- package/dist/settings-tabs-BuUATf4H.js +424 -0
- package/dist/settings-tabs-BuUATf4H.js.map +1 -0
- package/dist/shell-core-head.html +2 -0
- package/dist/shell-core.html +1 -0
- package/dist/shell-head.html +2 -0
- package/dist/shell-plugins.json +1 -0
- package/dist/shell.html +1 -0
- package/dist/start-connect.d.ts +7 -9
- package/dist/start-connect.d.ts.map +1 -1
- package/dist/start-connect.js +9 -8
- package/dist/start-connect.js.map +1 -1
- package/dist/store-lock-Bi3B9VJD.js +159 -0
- package/dist/store-lock-Bi3B9VJD.js.map +1 -0
- package/dist/style.css +3384 -730
- package/dist/{toast-BXIGd4Eb.js → toast-C6WW-_O-.js} +3 -3
- package/dist/{toast-BXIGd4Eb.js.map → toast-C6WW-_O-.js.map} +1 -1
- package/dist/ui-1i7VXzpG.js +66 -0
- package/dist/ui-1i7VXzpG.js.map +1 -0
- package/dist/ui-C1-l-Eyh.js +170 -0
- package/dist/ui-C1-l-Eyh.js.map +1 -0
- package/dist/{use-renown-login-Cf3va6u_.js → use-renown-login-dPpDOYq5.js} +4 -4
- package/dist/use-renown-login-dPpDOYq5.js.map +1 -0
- package/dist/workflows-C3qEvx1R.js +63 -0
- package/dist/workflows-C3qEvx1R.js.map +1 -0
- package/fonts.css +177 -0
- package/generic-routes.json +9 -0
- package/package.json +87 -26
- package/scripts/assert-plugin-configs.mjs +47 -0
- package/scripts/prerender-shell.ts +51 -0
- package/skills/customize-connect/SKILL.md +80 -0
- package/skills/customize-connect/references/data-and-navigation.md +315 -0
- package/skills/customize-connect/references/drive-apps.md +44 -0
- package/skills/customize-connect/references/hosts-and-plugins.md +88 -0
- package/skills/customize-connect/references/layout.md +162 -0
- package/skills/customize-connect/references/modals.md +99 -0
- package/skills/customize-connect/references/overrides.md +177 -0
- package/skills/customize-connect/references/packages.md +41 -0
- package/skills/customize-connect/references/pages.md +141 -0
- package/skills/customize-connect/references/runtime-config.md +403 -0
- package/skills/customize-connect/references/styles-and-branding.md +76 -0
- package/skills/customize-connect/references/types-and-troubleshooting.md +64 -0
- package/src/route-tree.ts +3 -0
- package/src/routeTree.gen.ts +235 -0
- package/src/router/index.ts +2 -0
- package/src/router/register.ts +9 -0
- package/src/routes/__root.tsx +12 -0
- package/src/routes/_app/$.tsx +13 -0
- package/src/routes/_app/d/$driveSlug/{-$nodeSlug}.tsx +13 -0
- package/src/routes/_app/d/$driveSlug.tsx +13 -0
- package/src/routes/_app/index.tsx +13 -0
- package/src/routes/_app/settings/appearance.tsx +13 -0
- package/src/routes/_app/settings/packages.tsx +13 -0
- package/src/routes/_app/settings.tsx +13 -0
- package/src/routes/_app.tsx +13 -0
- package/style.css +8 -23
- package/tailwind.css +12 -0
- package/theme.css +5 -0
- package/dist/AddDriveModal-xAw48kdl.js.map +0 -1
- package/dist/ClearStorageModal-BAqs4G2s.js.map +0 -1
- package/dist/ConfirmDocumentUpgradeModal-FUOhZsk7.js.map +0 -1
- package/dist/CreateDocumentModal-C45W8J0V.js +0 -35
- package/dist/CreateDocumentModal-C45W8J0V.js.map +0 -1
- package/dist/DebugSettingsModal-rV_v0F0d.js.map +0 -1
- package/dist/DeleteDriveModal-Dug84t1j.js.map +0 -1
- package/dist/DeleteItemModal-mMzy3V8o.js.map +0 -1
- package/dist/DisclaimerModal-DvpD5dPM.js.map +0 -1
- package/dist/DocumentVersionUnsupportedModal-C3Q0V75l.js.map +0 -1
- package/dist/DownloadDocumentWithErrorsModal-IKl0ljQb.js.map +0 -1
- package/dist/DriveAuthRequiredModal-DVK7ZQzO.js.map +0 -1
- package/dist/DriveSettingsModal-C6-mRQiv.js.map +0 -1
- package/dist/InspectorModal-CpEhVnM6.js.map +0 -1
- package/dist/LoginModal-CybbOm3N.js.map +0 -1
- package/dist/MissingPackageModal-nBnExqO0.js +0 -49
- package/dist/MissingPackageModal-nBnExqO0.js.map +0 -1
- package/dist/OpenFileDocumentsModal-BW3ZFRDR.js.map +0 -1
- package/dist/SettingsModal-DlxUZEQ4.js +0 -569
- package/dist/SettingsModal-DlxUZEQ4.js.map +0 -1
- package/dist/UpgradeDriveModal-_8t9slxQ.js.map +0 -1
- package/dist/app-loader-D4tbk4ev.js +0 -4
- package/dist/app-loader-Dz_X0r7a.js +0 -2244
- package/dist/app-loader-Dz_X0r7a.js.map +0 -1
- package/dist/build-info-D1h45Bga.js.map +0 -1
- package/dist/components-Bmn9nGdQ.js +0 -4
- package/dist/connect.config-DaHDEUrw.js.map +0 -1
- package/dist/connection-state-3w4liC1X.js.map +0 -1
- package/dist/load-B0xIT-MF.js.map +0 -1
- package/dist/pglite-major-B39aOEiE.js.map +0 -1
- package/dist/pglite-migrate-core-Boxqqx-c.js.map +0 -1
- package/dist/preferences-store-_5Cw4_YV.js.map +0 -1
- package/dist/reactor-B6xhZK1N.js.map +0 -1
- package/dist/runtime-config-DL3QjcfM.js +0 -24
- package/dist/runtime-config-DL3QjcfM.js.map +0 -1
- package/dist/sentry-QXKgQmr2.js +0 -15
- package/dist/sentry-QXKgQmr2.js.map +0 -1
- package/dist/use-renown-login-Cf3va6u_.js.map +0 -1
- package/dist/useRegistryPackages-BnUcL_nZ.js +0 -390
- package/dist/useRegistryPackages-BnUcL_nZ.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prerender.js","sources":["../src/prerender/app-shell.ts","../src/prerender/shell-css.ts","../src/prerender/shell-loader.tsx","../src/prerender/shell.tsx"],"sourcesContent":["// Turns a rendered shell into what index.html carries: #root's markup and <head>'s CSS.\n\n/** The marker boot.tsx and the project build look for. */\nexport const SHELL_MARKER = \"data-ph-shell\";\n\n/** `generic`: Connect's chrome. `core`: core's views. `project`: a project's routes. */\nexport type AppShellKind = \"generic\" | \"core\" | \"project\";\n\n/** Rendered where the app's name goes. */\nexport const APP_NAME_TOKEN = \"__PH_SHELL_APP_NAME__\";\n\n// The app's name, delimited for the project build to fill in; the default is core's own.\n// Keep in sync with builder-tools' app-shell.ts.\nconst APP_NAME_REGION =\n \"<!--ph-shell:app-name-->Connect<!--/ph-shell:app-name-->\";\n\n// Before first paint: no sidebar in an embed, and the home view hidden off the home path.\nconst GUARD_SCRIPT =\n `(function(){try{var h=document.documentElement;` +\n `var e=new URLSearchParams(location.search).get('embed');` +\n `if(e!==null&&e!=='0'&&e!=='false')h.classList.add('ph-shell-embed');` +\n `var p=location.pathname;` +\n `if(!/\\\\/$/.test(p)||/\\\\/d\\\\//.test(p))h.classList.add('ph-shell-route')` +\n `}catch(x){}})();`;\n\n// The shell renders `/`: off it, its links mark no current page until the app routes.\nconst CURRENT_GUARD_SCRIPT =\n `(function(){if(!document.documentElement.classList.contains('ph-shell-route'))return;` +\n `document.querySelectorAll('[${SHELL_MARKER}] [aria-current]').forEach(function(e){` +\n `e.removeAttribute('aria-current');e.classList.remove('active')})})();`;\n\n// The loader fades in late so fast loads never show it; --ph-shell-t (set when\n// React re-renders the shell) keeps both animations on the navigation's clock.\nconst LOADER_CSS =\n `@keyframes ph-shell-loader-in{from{opacity:0}to{opacity:1}}` +\n `.ph-shell-loader{animation:ph-shell-loader-in .2s ease-in both;animation-delay:calc(.25s + var(--ph-shell-t,0ms))}` +\n `.ph-shell-loader>*{animation-delay:var(--ph-shell-t,0ms)}`;\n\n// The shell renders `/`: off the home path its content view hides until the app routes.\nconst ROUTE_GUARD = `.ph-shell-route [${SHELL_MARKER}] #content-view{visibility:hidden}`;\n\n// Core's header goes in an embed, and its static theme toggle shows the wrong glyph in one theme.\nconst GUARD_CSS: Record<AppShellKind, string> = {\n generic:\n `.ph-shell-embed [${SHELL_MARKER}] #sidebar{display:none}` +\n ROUTE_GUARD +\n LOADER_CSS,\n core:\n `.ph-shell-embed [${SHELL_MARKER}] header{display:none}` +\n `[${SHELL_MARKER}] header button{visibility:hidden}` +\n LOADER_CSS,\n project: ROUTE_GUARD + LOADER_CSS,\n};\n\n// Data-URI images (the login button's PNGs) weigh more than the rest of the\n// shell; a box of their size keeps the layout.\nfunction replaceInlineImages(html: string) {\n return html.replace(/<img\\b[^>]*\\bsrc=\"data:[^\"]*\"[^>]*>/g, (img) => {\n const attr = (name: string) =>\n new RegExp(`\\\\b${name}=\"([^\"]*)\"`).exec(img)?.[1];\n // A hidden variant (e.g. the hover image) needs no box.\n if (/(^| )hidden( |$)/.test(attr(\"class\") ?? \"\")) return \"\";\n const width = attr(\"width\");\n const height = attr(\"height\");\n const size = `${width ? `width:${width}px;` : \"\"}${height ? `height:${height}px;` : \"\"}`;\n return `<span style=\"display:inline-block;${size}\"></span>`;\n });\n}\n\n/** The rendered shell as #root's static markup: no scripts or title, images as\n * boxes, the app's name delimited. */\nexport function shellMarkup(rendered: string) {\n // The router's scroll restoration script is for hydration, and the page keeps\n // its own title until the app's routes set one.\n return replaceInlineImages(\n rendered\n .replace(/<script\\b[^>]*>[\\s\\S]*?<\\/script>/g, \"\")\n .replace(/<title\\b[^>]*>[\\s\\S]*?<\\/title>/g, \"\"),\n ).replaceAll(APP_NAME_TOKEN, APP_NAME_REGION);\n}\n\n/** #root's markup and <head>'s critical CSS (`css`, see shellCss) and guard.\n * `variant` names it for a server that swaps it. */\nexport function appShell(\n kind: AppShellKind,\n variant: \"generic\" | \"core\",\n markup: string,\n css: string,\n) {\n const guard = GUARD_CSS[kind];\n const marker = `${SHELL_MARKER}=\"${variant}\"`;\n return {\n // Inert: clicks and focus wait for the app; a static shell does nothing with them.\n body:\n `<div ${marker} inert style=\"display:contents\">${markup}</div>` +\n `<script ${marker}>${CURRENT_GUARD_SCRIPT}</script>`,\n head:\n `<style ${marker}>${css}${guard}</style>` +\n `<script ${marker}>${GUARD_SCRIPT}</script>`,\n };\n}\n","// The loading screen's CSS: Tailwind builds a stylesheet for just the classes its markup uses.\nimport { compile, optimize } from \"@tailwindcss/node\";\nimport { mkdtempSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nlet emptyFile: string | undefined;\nconst empty = () => {\n if (!emptyFile) {\n emptyFile = join(mkdtempSync(join(tmpdir(), \"ph-shell-\")), \"empty.css\");\n writeFileSync(emptyFile, \"\");\n }\n return emptyFile;\n};\n\n// Plain third-party CSS stays out: a vendor.css, or another package's stylesheet.\nconst isVendor = (id: string) =>\n id.endsWith(\"/vendor.css\") ||\n !(\n id.startsWith(\".\") ||\n id.startsWith(\"/\") ||\n id.startsWith(\"tailwindcss\") ||\n id.startsWith(\"@powerhousedao/\")\n );\n\nconst CLASS_ATTRIBUTE = /\\sclass=\"([^\"]*)\"/g;\n\n/** `entry`, a Tailwind stylesheet (its text `css` when given), built for the\n * classes in `markup` only: its tokens, reset and rules, without third-party CSS. */\nexport async function shellCss(\n entry: string,\n markup: string,\n css = readFileSync(entry, \"utf8\"),\n) {\n const compiler = await compile(css, {\n base: dirname(entry),\n from: entry,\n onDependency: () => {},\n customCssResolver: (id) =>\n Promise.resolve(isVendor(id) ? empty() : undefined),\n });\n const classes = new Set(\n [...markup.matchAll(CLASS_ATTRIBUTE)].flatMap((m) => m[1].split(/\\s+/)),\n );\n const built = compiler.build([...classes].filter(Boolean));\n return optimize(built, { file: entry, minify: true }).code;\n}\n","import { Icon } from \"@powerhousedao/design-system\";\n\n/** Class of the shell's loader; scripts/prerender-shell.ts fades it in. */\nexport const SHELL_LOADER_CLASS = \"ph-shell-loader\";\n\n// The static shell's \"starting\" state: a pulsing Powerhouse logo, CSS only.\nexport function ShellLoader() {\n return (\n <div\n role=\"status\"\n aria-label=\"Starting Connect\"\n className={`${SHELL_LOADER_CLASS} pointer-events-none fixed inset-0 z-10 flex items-center justify-center`}\n >\n {/* data-ph-loader-slot: a project build swaps this logo for its own\n loader (connect.branding.loader). */}\n <div\n data-ph-loader-slot=\"\"\n className=\"animate-pulse rounded-full bg-background p-4 text-foreground shadow-lg motion-reduce:animate-none\"\n >\n <Icon name=\"ConnectSmall\" size={40} />\n </div>\n </div>\n );\n}\n\n// Core's \"starting\" state: a small neutral spinner, no logo. The project's\n// loader (connect.branding.loader) is Connect-level branding, so a project\n// build swaps the spinner for it here too.\nexport function CoreShellLoader() {\n return (\n <div\n role=\"status\"\n aria-label=\"Starting\"\n className={`${SHELL_LOADER_CLASS} pointer-events-none fixed inset-0 z-10 flex items-center justify-center`}\n >\n <div\n data-ph-loader-slot=\"\"\n className=\"size-5 animate-spin rounded-full border-2 border-core-border border-t-core-muted motion-reduce:animate-none\"\n />\n </div>\n );\n}\n","// Renders the app shell at `/` before the reactor is up; `pnpm build` writes it to dist/shell.html.\nimport { createPHStore, PHStoreProvider } from \"@powerhousedao/reactor-browser\";\nimport type { AnyRoute } from \"@tanstack/react-router\";\nimport { createMemoryHistory, RouterProvider } from \"@tanstack/react-router\";\nimport { prerender } from \"react-dom/static\";\nimport {\n getConnectPluginUi,\n loadConnectPluginUi,\n registerConnectPlugins,\n resetConnectPluginUi,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { primeRuntimeConfig } from \"@powerhousedao/connect-core/runtime-config\";\nimport type { RuntimePowerhouseConfig } from \"@powerhousedao/shared/connect\";\nimport { DEFAULT_CONNECT_CONFIG } from \"@powerhousedao/shared/connect\";\nimport type { AppShellKind } from \"./app-shell.js\";\nimport { APP_NAME_TOKEN, appShell, shellMarkup } from \"./app-shell.js\";\nimport { shellCss } from \"./shell-css.js\";\nimport { CoreShellLoader, ShellLoader } from \"./shell-loader.js\";\n\nexport { appShell, shellCss, shellMarkup };\nexport type { AppShellKind };\n\nasync function loadDefaultConfig(variant: ShellVariant) {\n // The config file is read at runtime; the shell renders Connect's defaults.\n // Not through the config loader: its cache is the realm's, so a dev server's\n // next render would read the variant primed last.\n primeRuntimeConfig({\n connect: {\n ...DEFAULT_CONNECT_CONFIG,\n // Core's shell is the one for a composition without a plugin that has a shell.\n composition: variant === \"core\" ? [] : undefined,\n },\n } as RuntimePowerhouseConfig);\n registerConnectPlugins(connectPlugins);\n const plugin = (await shellPlugins())[variant];\n await loadConnectPluginUi(plugin ? [{ module: plugin }] : []);\n}\n\nconst connectPlugins = () =>\n import(\"../plugins/index.js\").then((m) => m.connectPlugins);\n\n/** Each prerendered shell's plugin, whose presence in a composition picks it; core's has none. */\nexport async function shellPlugins(): Promise<\n Partial<Record<ShellVariant, string>>\n> {\n return Object.fromEntries(\n Object.entries(await connectPlugins()).flatMap(([module, definition]) =>\n definition.shell ? [[definition.shell, module]] : [],\n ),\n );\n}\n\n/** `generic`: Connect's chrome. `core`: core's views, for a composition without the generic plugin. */\nexport type ShellVariant = \"generic\" | \"core\";\n\nexport { APP_NAME_TOKEN };\n\n/** Renders the route tree at `/` before the reactor is up. `kind` picks the\n * loader: Connect's logo for its chrome, core's spinner otherwise. */\nexport async function renderShell(\n variant: ShellVariant = \"generic\",\n kind: AppShellKind = variant,\n): Promise<string> {\n await loadDefaultConfig(variant);\n // After the config: these modules read it as they evaluate.\n const [{ routeTree }, { RouterChrome }, routerModule, skeleton] =\n await Promise.all([\n import(\"@powerhousedao/connect/route-tree\"),\n import(\"../components/route-views.js\"),\n import(\"@powerhousedao/connect-core/router\"),\n import(\"../components/app-skeleton.js\"),\n ]);\n // No reactor and no drives, as the app is until the reactor is up.\n const store = createPHStore();\n // A server router reuses the tree processed for the last variant; plugins' routes change it.\n delete (globalThis as { __TSR_CACHE__?: unknown }).__TSR_CACHE__;\n const connectRouter = routerModule.createConnectRouter({\n routeTree,\n store,\n history: createMemoryHistory({ initialEntries: [\"/\"] }),\n InnerWrap: RouterChrome,\n // The project's name is only known at its build; scripts/prerender-shell.ts marks this.\n appName: APP_NAME_TOKEN,\n // A project's layout shows its pendingComponent in place of the page.\n shell: kind === \"project\",\n pluginUi: getConnectPluginUi(),\n });\n routerModule.bindConnectRouter(connectRouter, store);\n await connectRouter.router.load();\n // A project layout's own pending view is its loader; core's spinner without one.\n const { appRoute } = routerModule.connectRoutes(routeTree as AnyRoute);\n const layoutPending = appRoute.options.pendingComponent;\n const Loader =\n kind === \"generic\"\n ? ShellLoader\n : kind === \"project\" && layoutPending\n ? () => null\n : CoreShellLoader;\n\n const errors: unknown[] = [];\n const causes: string[] = [];\n // A project's own layout loads with the loader alone, as the browser's\n // skeleton does once it sees the project's meta tag: not Connect's sidebar.\n skeleton.setPrerenderingCustomShell(kind === \"project\");\n let prelude: ReadableStream<Uint8Array>;\n try {\n ({ prelude } = await prerender(\n <PHStoreProvider store={store}>\n <RouterProvider router={connectRouter.router} />\n <Loader />\n </PHStoreProvider>,\n {\n // Inline every boundary; outlined ones need React's runtime to reveal.\n progressiveChunkSize: Number.POSITIVE_INFINITY,\n onError: (error, info) => {\n errors.push(error);\n causes.push(describeRenderError(error, info?.componentStack));\n },\n },\n ));\n } finally {\n skeleton.setPrerenderingCustomShell(false);\n }\n // The next variant renders the tree with its own plugins' UI.\n resetConnectPluginUi(routeTree as AnyRoute);\n // A boundary that errored renders its fallback, which is not the shell.\n if (errors.length) {\n throw new AggregateError(\n errors,\n `The app shell failed to prerender:\\n${causes.join(\"\\n\")}`,\n );\n }\n return await new Response(prelude).text();\n}\n\n/** A project's shells, one per variant: its route tree rendered at `/`, with\n * CSS that `stylesheet`, its Tailwind entry (text `css`), builds for the markup's classes. */\nexport async function renderProjectShells(stylesheet: string, css?: string) {\n const shells: Partial<Record<ShellVariant, { body: string; head: string }>> =\n {};\n for (const variant of [\"generic\", \"core\"] as const) {\n const markup = shellMarkup(await renderShell(variant, \"project\"));\n const shellStyles = await shellCss(stylesheet, markup, css);\n shells[variant] = appShell(\"project\", variant, markup, shellStyles);\n }\n return shells;\n}\n\n// The message and the component it came from: the stack is Connect's own code.\nfunction describeRenderError(error: unknown, componentStack?: string | null) {\n const message = error instanceof Error ? error.message : String(error);\n const component = componentStack?.trim().split(\"\\n\")[0]?.trim();\n return ` - ${message}${component ? ` (${component})` : \"\"}`;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,MAAa,eAAe;;AAM5B,MAAa,iBAAiB;AAI9B,MAAM,kBACJ;AAGF,MAAM,eACJ;AAQF,MAAM,uBACJ,oHAC+B,aAAa;AAK9C,MAAM,aACJ;AAKF,MAAM,cAAc,oBAAoB,aAAa;AAGrD,MAAM,YAA0C;CAC9C,SACE,oBAAoB,aAAa,4BACjC,cACA;CACF,MACE,oBAAoB,aAAa,yBAC7B,aAAa;CAEnB,SAAS,cAAc;AACzB;AAIA,SAAS,oBAAoB,MAAc;CACz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AAK;CAC3C;CAEA,qBAAqB,SAAqB;CAE1C,IAAI,OAAO,QACT,MAAM,IAAI,eACR,QACA,uCAAuC,OAAO,KAAK,IAAI,GACzD;CAEF,OAAO,MAAM,IAAI,SAAS,OAAO,CAAC,CAAC,KAAK;AAC1C;;;AAIA,eAAsB,oBAAoB,YAAoB,KAAc;CAC1E,MAAM,SACJ,CAAC;CACH,KAAK,MAAM,WAAW,CAAC,WAAW,MAAM,GAAY;EAClD,MAAM,SAAS,YAAY,MAAM,YAAY,SAAS,SAAS,CAAC;EAEhE,OAAO,WAAW,SAAS,WAAW,SAAS,QAAQ,MAD7B,SAAS,YAAY,QAAQ,GAAG,CACQ;CACpE;CACA,OAAO;AACT;AAGA,SAAS,oBAAoB,OAAgB,gBAAgC;CAC3E,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACrE,MAAM,YAAY,gBAAgB,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,EAAE,EAAE,KAAK;CAC9D,OAAO,MAAM,UAAU,YAAY,KAAK,UAAU,KAAK;AACzD","debug_id":"b14c6d0e-8f4f-5f75-be86-cfd57859628f"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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]="0d9ea2f0-19d5-5ebd-9396-34af1dffa9f6")}catch(e){}}();
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/prerendered-shell.tsx
|
|
6
|
+
/** Marks the prerendered markup; the build's guard CSS keys on it too. */
|
|
7
|
+
const SHELL_MARKER = "data-ph-shell";
|
|
8
|
+
/** Set on `<html>` by the build's pre-paint guard (scripts/prerender-shell.ts). */
|
|
9
|
+
const SHELL_GUARD_CLASSES = ["ph-shell-route", "ph-shell-embed"];
|
|
10
|
+
let shellHtml;
|
|
11
|
+
/** Keeps `root`'s prerendered shell to render until the app shows. */
|
|
12
|
+
function adoptPrerenderedShell(root) {
|
|
13
|
+
shellHtml = root?.querySelector(`:scope > [${SHELL_MARKER}]`)?.innerHTML;
|
|
14
|
+
}
|
|
15
|
+
function hasPrerenderedShell() {
|
|
16
|
+
return shellHtml !== void 0;
|
|
17
|
+
}
|
|
18
|
+
/** The prerendered shell until the app releases it, else `Fallback`. */
|
|
19
|
+
function LoadingShell({ Fallback }) {
|
|
20
|
+
const [style] = useState(() => ({
|
|
21
|
+
display: "contents",
|
|
22
|
+
"--ph-shell-t": `-${Math.round(performance.now())}ms`
|
|
23
|
+
}));
|
|
24
|
+
if (shellHtml === void 0) return /* @__PURE__ */ jsx(Fallback, {});
|
|
25
|
+
return /* @__PURE__ */ jsx("div", {
|
|
26
|
+
[SHELL_MARKER]: "",
|
|
27
|
+
inert: true,
|
|
28
|
+
style,
|
|
29
|
+
dangerouslySetInnerHTML: { __html: shellHtml }
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const Blank = () => null;
|
|
33
|
+
/** The router's pending view: the shell while a cold start's route chunks
|
|
34
|
+
* load, so a lazy layout leaves no blank frame; nothing once released. */
|
|
35
|
+
function ColdStartPending() {
|
|
36
|
+
return /* @__PURE__ */ jsx(LoadingShell, { Fallback: Blank });
|
|
37
|
+
}
|
|
38
|
+
/** Drops the shell once the app shows; later loads use their own fallback. */
|
|
39
|
+
function useReleasePrerenderedShell(released) {
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!released) return;
|
|
42
|
+
shellHtml = void 0;
|
|
43
|
+
document.documentElement.classList.remove(...SHELL_GUARD_CLASSES);
|
|
44
|
+
for (const style of document.head.querySelectorAll(`style[${SHELL_MARKER}]`)) style.remove();
|
|
45
|
+
}, [released]);
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { useReleasePrerenderedShell as a, hasPrerenderedShell as i, LoadingShell as n, adoptPrerenderedShell as r, ColdStartPending as t };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=prerendered-shell-peKE7AqI.js.map
|
|
51
|
+
//# debugId=0d9ea2f0-19d5-5ebd-9396-34af1dffa9f6
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prerendered-shell-peKE7AqI.js","sources":["../src/components/prerendered-shell.tsx"],"sourcesContent":["// The app shell `ph connect build` prerenders into #root. React renders the same\n// markup while the app loads, so the swap to the app has no blank frame.\nimport type { ComponentType, CSSProperties } from \"react\";\nimport { useEffect, useState } from \"react\";\n\n/** Marks the prerendered markup; the build's guard CSS keys on it too. */\nexport const SHELL_MARKER = \"data-ph-shell\";\n\n/** Set on `<html>` by the build's pre-paint guard (scripts/prerender-shell.ts). */\nexport const SHELL_GUARD_CLASSES = [\"ph-shell-route\", \"ph-shell-embed\"];\n\nlet shellHtml: string | undefined;\n\n/** Keeps `root`'s prerendered shell to render until the app shows. */\nexport function adoptPrerenderedShell(root: Element | null) {\n shellHtml = root?.querySelector(`:scope > [${SHELL_MARKER}]`)?.innerHTML;\n}\n\nexport function hasPrerenderedShell() {\n return shellHtml !== undefined;\n}\n\n/** The prerendered shell until the app releases it, else `Fallback`. */\nexport function LoadingShell({ Fallback }: { Fallback: ComponentType }) {\n // A remount restarts CSS animations; this keeps the loader's on the page's clock.\n const [style] = useState(\n () =>\n ({\n display: \"contents\",\n \"--ph-shell-t\": `-${Math.round(performance.now())}ms`,\n }) as CSSProperties,\n );\n if (shellHtml === undefined) return <Fallback />;\n return (\n <div\n {...{ [SHELL_MARKER]: \"\" }}\n inert\n style={style}\n dangerouslySetInnerHTML={{ __html: shellHtml }}\n />\n );\n}\n\nconst Blank = () => null;\n\n/** The router's pending view: the shell while a cold start's route chunks\n * load, so a lazy layout leaves no blank frame; nothing once released. */\nexport function ColdStartPending() {\n return <LoadingShell Fallback={Blank} />;\n}\n\n/** Drops the shell once the app shows; later loads use their own fallback. */\nexport function useReleasePrerenderedShell(released: boolean) {\n useEffect(() => {\n if (!released) return;\n shellHtml = undefined;\n // The pre-paint guard's classes and critical CSS were for the shell only.\n document.documentElement.classList.remove(...SHELL_GUARD_CLASSES);\n for (const style of document.head.querySelectorAll(\n `style[${SHELL_MARKER}]`,\n )) {\n style.remove();\n }\n }, [released]);\n}\n"],"names":[],"mappings":";;;;;;AAMA,MAAa,eAAe;;AAG5B,MAAa,sBAAsB,CAAC,kBAAkB,gBAAgB;AAEtE,IAAI;;AAGJ,SAAgB,sBAAsB,MAAsB;CAC1D,YAAY,MAAM,cAAc,aAAa,aAAa,EAAE,CAAC,EAAE;AACjE;AAEA,SAAgB,sBAAsB;CACpC,OAAO,cAAc,KAAA;AACvB;;AAGA,SAAgB,aAAa,EAAE,YAAyC;CAEtE,MAAM,CAAC,SAAS,gBAEX;EACC,SAAS;EACT,gBAAgB,IAAI,KAAK,MAAM,YAAY,IAAI,CAAC,EAAE;CACpD,EACJ;CACA,IAAI,cAAc,KAAA,GAAW,OAAO,oBAAC,UAAD,CAAW,CAAA;CAC/C,OACE,oBAAC,OAAD;GACS,eAAe;EACtB,OAAA;EACO;EACP,yBAAyB,EAAE,QAAQ,UAAU;CAC9C,CAAA;AAEL;AAEA,MAAM,cAAc;;;AAIpB,SAAgB,mBAAmB;CACjC,OAAO,oBAAC,cAAD,EAAc,UAAU,MAAQ,CAAA;AACzC;;AAGA,SAAgB,2BAA2B,UAAmB;CAC5D,gBAAgB;EACd,IAAI,CAAC,UAAU;EACf,YAAY,KAAA;EAEZ,SAAS,gBAAgB,UAAU,OAAO,GAAG,mBAAmB;EAChE,KAAK,MAAM,SAAS,SAAS,KAAK,iBAChC,SAAS,aAAa,EACxB,GACE,MAAM,OAAO;CAEjB,GAAG,CAAC,QAAQ,CAAC;AACf","debug_id":"0d9ea2f0-19d5-5ebd-9396-34af1dffa9f6"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/utils/pwa-manifest-link.ts
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0e412e66-7d59-5eec-9dd7-16040f9e56b6")}catch(e){}}();
|
|
4
4
|
let manifestRevision = 0;
|
|
5
5
|
/**
|
|
6
6
|
* Force the browser to re-consume `manifest.webmanifest` by replacing the
|
|
@@ -30,5 +30,5 @@ function refreshPwaManifestLink() {
|
|
|
30
30
|
//#endregion
|
|
31
31
|
export { refreshPwaManifestLink as t };
|
|
32
32
|
|
|
33
|
-
//# sourceMappingURL=pwa-manifest-link-
|
|
34
|
-
//# debugId=
|
|
33
|
+
//# sourceMappingURL=pwa-manifest-link-DQRJpF0r.js.map
|
|
34
|
+
//# debugId=0e412e66-7d59-5eec-9dd7-16040f9e56b6
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pwa-manifest-link-
|
|
1
|
+
{"version":3,"file":"pwa-manifest-link-DQRJpF0r.js","sources":["../src/utils/pwa-manifest-link.ts"],"sourcesContent":["// After a runtime package install/removal updates the PWA fragment in\n// IndexedDB (BrowserPackageManager.#syncPwaFragments), the service worker\n// already serves an up-to-date `manifest.webmanifest` — it reads IndexedDB\n// fresh on every request. But the browser only parsed `<link rel=\"manifest\">`\n// ONCE, at page load, so its in-memory manifest (the install prompt, and the\n// manifest's declared fields as the browser reads them — visible in\n// DevTools → Application → Manifest) stays frozen until something makes it\n// re-consume. That \"something\" used to be a manual reload / service-worker\n// update.\n//\n// Re-attaching the manifest `<link>` with a fresh, cache-busting href triggers\n// Chromium's manifest-change invalidation (it recomputes the manifest URL and\n// notifies its consumers), so the install pipeline / DevTools re-fetch the\n// (dynamically served) manifest on demand — no full page reload. The SW route\n// matches on the pathname, so the extra query param doesn't change which\n// response is served, and `start_url`/`scope`/`id` are unaffected (they resolve\n// to the same directory, dropping the query).\n//\n// Caveat (unavoidable, not app-fixable): the OS-level registrations the manifest\n// drives — file associations and launch_handler — are snapshotted by the OS at\n// install time and only re-read on the browser's own throttled manifest-update\n// schedule, so those still lag. The reliable, immediate signal is the served\n// manifest itself (DevTools → Application → Manifest).\n\n// Monotonic per-session revision so each re-attach uses a distinct href (a\n// counter, not a timestamp — deterministic and dependency-free).\nlet manifestRevision = 0;\n\n/**\n * Force the browser to re-consume `manifest.webmanifest` by replacing the\n * `<link rel=\"manifest\">` element with a fresh, cache-busting one. No-op when\n * there is no DOM or no manifest link (dev mode / offline disabled — the build\n * only injects the link when the service worker is enabled).\n */\nexport function refreshPwaManifestLink(): void {\n if (typeof document === \"undefined\") return;\n const existing = document.querySelector<HTMLLinkElement>(\n 'link[rel=\"manifest\"]',\n );\n if (!existing) return;\n // An absent/empty href would resolve to the document URL (new URL(\"\", base)\n // does not throw), producing a manifest link pointing at the HTML page. Bail.\n if (!existing.getAttribute(\"href\")) return;\n\n let href: string;\n try {\n const url = new URL(existing.href, document.baseURI);\n url.searchParams.set(\"ph-manifest-rev\", String(++manifestRevision));\n href = url.toString();\n } catch {\n return;\n }\n\n const link = document.createElement(\"link\");\n link.rel = \"manifest\";\n // Preserve crossorigin (vite-plugin-pwa sets it when useCredentials is on).\n if (existing.crossOrigin) link.crossOrigin = existing.crossOrigin;\n link.href = href;\n existing.replaceWith(link);\n}\n"],"names":[],"mappings":";;;AA0BA,IAAI,mBAAmB;;;;;;;AAQvB,SAAgB,yBAA+B;CAC7C,IAAI,OAAO,aAAa,aAAa;CACrC,MAAM,WAAW,SAAS,cACxB,wBACF;CACA,IAAI,CAAC,UAAU;CAGf,IAAI,CAAC,SAAS,aAAa,MAAM,GAAG;CAEpC,IAAI;CACJ,IAAI;EACF,MAAM,MAAM,IAAI,IAAI,SAAS,MAAM,SAAS,OAAO;EACnD,IAAI,aAAa,IAAI,mBAAmB,OAAO,EAAE,gBAAgB,CAAC;EAClE,OAAO,IAAI,SAAS;CACtB,QAAQ;EACN;CACF;CAEA,MAAM,OAAO,SAAS,cAAc,MAAM;CAC1C,KAAK,MAAM;CAEX,IAAI,SAAS,aAAa,KAAK,cAAc,SAAS;CACtD,KAAK,OAAO;CACZ,SAAS,YAAY,IAAI;AAC3B","debug_id":"0e412e66-7d59-5eec-9dd7-16040f9e56b6"}
|